hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 | qsc_code_num_words_quality_signal int64 | qsc_code_num_chars_quality_signal float64 | qsc_code_mean_word_length_quality_signal float64 | qsc_code_frac_words_unique_quality_signal float64 | qsc_code_frac_chars_top_2grams_quality_signal float64 | qsc_code_frac_chars_top_3grams_quality_signal float64 | qsc_code_frac_chars_top_4grams_quality_signal float64 | qsc_code_frac_chars_dupe_5grams_quality_signal float64 | qsc_code_frac_chars_dupe_6grams_quality_signal float64 | qsc_code_frac_chars_dupe_7grams_quality_signal float64 | qsc_code_frac_chars_dupe_8grams_quality_signal float64 | qsc_code_frac_chars_dupe_9grams_quality_signal float64 | qsc_code_frac_chars_dupe_10grams_quality_signal float64 | qsc_code_frac_chars_replacement_symbols_quality_signal float64 | qsc_code_frac_chars_digital_quality_signal float64 | qsc_code_frac_chars_whitespace_quality_signal float64 | qsc_code_size_file_byte_quality_signal float64 | qsc_code_num_lines_quality_signal float64 | qsc_code_num_chars_line_max_quality_signal float64 | qsc_code_num_chars_line_mean_quality_signal float64 | qsc_code_frac_chars_alphabet_quality_signal float64 | qsc_code_frac_chars_comments_quality_signal float64 | qsc_code_cate_xml_start_quality_signal float64 | qsc_code_frac_lines_dupe_lines_quality_signal float64 | qsc_code_cate_autogen_quality_signal float64 | qsc_code_frac_lines_long_string_quality_signal float64 | qsc_code_frac_chars_string_length_quality_signal float64 | qsc_code_frac_chars_long_word_length_quality_signal float64 | qsc_code_frac_lines_string_concat_quality_signal float64 | qsc_code_cate_encoded_data_quality_signal float64 | qsc_code_frac_chars_hex_words_quality_signal float64 | qsc_code_frac_lines_prompt_comments_quality_signal float64 | qsc_code_frac_lines_assert_quality_signal float64 | qsc_codepython_cate_ast_quality_signal float64 | qsc_codepython_frac_lines_func_ratio_quality_signal float64 | qsc_codepython_cate_var_zero_quality_signal bool | qsc_codepython_frac_lines_pass_quality_signal float64 | qsc_codepython_frac_lines_import_quality_signal float64 | qsc_codepython_frac_lines_simplefunc_quality_signal float64 | qsc_codepython_score_lines_no_logic_quality_signal float64 | qsc_codepython_frac_lines_print_quality_signal float64 | qsc_code_num_words int64 | qsc_code_num_chars int64 | qsc_code_mean_word_length int64 | qsc_code_frac_words_unique null | qsc_code_frac_chars_top_2grams int64 | qsc_code_frac_chars_top_3grams int64 | qsc_code_frac_chars_top_4grams int64 | qsc_code_frac_chars_dupe_5grams int64 | qsc_code_frac_chars_dupe_6grams int64 | qsc_code_frac_chars_dupe_7grams int64 | qsc_code_frac_chars_dupe_8grams int64 | qsc_code_frac_chars_dupe_9grams int64 | qsc_code_frac_chars_dupe_10grams int64 | qsc_code_frac_chars_replacement_symbols int64 | qsc_code_frac_chars_digital int64 | qsc_code_frac_chars_whitespace int64 | qsc_code_size_file_byte int64 | qsc_code_num_lines int64 | qsc_code_num_chars_line_max int64 | qsc_code_num_chars_line_mean int64 | qsc_code_frac_chars_alphabet int64 | qsc_code_frac_chars_comments int64 | qsc_code_cate_xml_start int64 | qsc_code_frac_lines_dupe_lines int64 | qsc_code_cate_autogen int64 | qsc_code_frac_lines_long_string int64 | qsc_code_frac_chars_string_length int64 | qsc_code_frac_chars_long_word_length int64 | qsc_code_frac_lines_string_concat null | qsc_code_cate_encoded_data int64 | qsc_code_frac_chars_hex_words int64 | qsc_code_frac_lines_prompt_comments int64 | qsc_code_frac_lines_assert int64 | qsc_codepython_cate_ast int64 | qsc_codepython_frac_lines_func_ratio int64 | qsc_codepython_cate_var_zero int64 | qsc_codepython_frac_lines_pass int64 | qsc_codepython_frac_lines_import int64 | qsc_codepython_frac_lines_simplefunc int64 | qsc_codepython_score_lines_no_logic int64 | qsc_codepython_frac_lines_print int64 | effective string | hits int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b3ae85e0328f8990b94475c96c30221a282e8306 | 98,419 | py | Python | gen-py/nautilus/common/ttypes.py | hmn21/pyContoller | ad3b64436c4eaa9636936389ef29dde59bf0842b | [
"MIT"
] | null | null | null | gen-py/nautilus/common/ttypes.py | hmn21/pyContoller | ad3b64436c4eaa9636936389ef29dde59bf0842b | [
"MIT"
] | null | null | null | gen-py/nautilus/common/ttypes.py | hmn21/pyContoller | ad3b64436c4eaa9636936389ef29dde59bf0842b | [
"MIT"
] | null | null | null | #
# Autogenerated by Thrift Compiler (0.9.2)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
from thrift.protocol import fastbinary
except:
fastbinary = None
class MsgType:
INFO = 0
ERROR = 1
WARNING = 2
UNKNOWN = 99999
_VALUES_TO_NAMES = {
0: "INFO",
1: "ERROR",
2: "WARNING",
99999: "UNKNOWN",
}
_NAMES_TO_VALUES = {
"INFO": 0,
"ERROR": 1,
"WARNING": 2,
"UNKNOWN": 99999,
}
class StratStatus:
Run = 1
Stop = 2
Pause = 3
UNKNOWN = 99999
_VALUES_TO_NAMES = {
1: "Run",
2: "Stop",
3: "Pause",
99999: "UNKNOWN",
}
_NAMES_TO_VALUES = {
"Run": 1,
"Stop": 2,
"Pause": 3,
"UNKNOWN": 99999,
}
class Direction:
Buy = 0
Sell = 1
UNKNOWN = 99999
_VALUES_TO_NAMES = {
0: "Buy",
1: "Sell",
99999: "UNKNOWN",
}
_NAMES_TO_VALUES = {
"Buy": 0,
"Sell": 1,
"UNKNOWN": 99999,
}
class OrderType:
Limit = 0
Market = 1
FAK = 2
FOK = 3
UNKNOWN = 99999
_VALUES_TO_NAMES = {
0: "Limit",
1: "Market",
2: "FAK",
3: "FOK",
99999: "UNKNOWN",
}
_NAMES_TO_VALUES = {
"Limit": 0,
"Market": 1,
"FAK": 2,
"FOK": 3,
"UNKNOWN": 99999,
}
class Offset:
Open = 0
Close = 1
CloseYd = 2
CloseTd = 3
UNKNOWN = 99999
_VALUES_TO_NAMES = {
0: "Open",
1: "Close",
2: "CloseYd",
3: "CloseTd",
99999: "UNKNOWN",
}
_NAMES_TO_VALUES = {
"Open": 0,
"Close": 1,
"CloseYd": 2,
"CloseTd": 3,
"UNKNOWN": 99999,
}
class OrderStatus:
AllTraded = 0
PartTradedQueueing = 1
PartTradedNotQueueing = 2
NoTradeQueueing = 3
NoTradeNotQueueing = 4
Canceled = 5
AcceptedNoReply = 6
UNKNOWN = 99999
_VALUES_TO_NAMES = {
0: "AllTraded",
1: "PartTradedQueueing",
2: "PartTradedNotQueueing",
3: "NoTradeQueueing",
4: "NoTradeNotQueueing",
5: "Canceled",
6: "AcceptedNoReply",
99999: "UNKNOWN",
}
_NAMES_TO_VALUES = {
"AllTraded": 0,
"PartTradedQueueing": 1,
"PartTradedNotQueueing": 2,
"NoTradeQueueing": 3,
"NoTradeNotQueueing": 4,
"Canceled": 5,
"AcceptedNoReply": 6,
"UNKNOWN": 99999,
}
class HedgeType:
Arbitrage = 1
Speculation = 2
Hedge = 3
UNKNOWN = 99999
_VALUES_TO_NAMES = {
1: "Arbitrage",
2: "Speculation",
3: "Hedge",
99999: "UNKNOWN",
}
_NAMES_TO_VALUES = {
"Arbitrage": 1,
"Speculation": 2,
"Hedge": 3,
"UNKNOWN": 99999,
}
class InstrumentType:
IndexFutures = 1
CommodityFutures = 2
Cash = 3
Stock = 4
ETF = 5
UNKNOWN = 99999
_VALUES_TO_NAMES = {
1: "IndexFutures",
2: "CommodityFutures",
3: "Cash",
4: "Stock",
5: "ETF",
99999: "UNKNOWN",
}
_NAMES_TO_VALUES = {
"IndexFutures": 1,
"CommodityFutures": 2,
"Cash": 3,
"Stock": 4,
"ETF": 5,
"UNKNOWN": 99999,
}
class ValType:
String = 1
Bool = 2
Int = 3
Double = 4
UNKNOWN = 99999
_VALUES_TO_NAMES = {
1: "String",
2: "Bool",
3: "Int",
4: "Double",
99999: "UNKNOWN",
}
_NAMES_TO_VALUES = {
"String": 1,
"Bool": 2,
"Int": 3,
"Double": 4,
"UNKNOWN": 99999,
}
class RtnOrder:
"""
Attributes:
- stratID
- clientOrderID
- instrumentID
- exchangeID
- hedge
- offset
- dire
- orderPrice
- size
- type
- status
- tradedVol
- systemOrderID
- insertTime
- updateTime
- volOriginal
- errorID
- errorMsg
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'stratID', None, "", ), # 1
(2, TType.STRING, 'clientOrderID', None, "", ), # 2
(3, TType.STRING, 'instrumentID', None, "", ), # 3
(4, TType.STRING, 'exchangeID', None, "", ), # 4
(5, TType.I32, 'hedge', None, 99999, ), # 5
(6, TType.I32, 'offset', None, 99999, ), # 6
(7, TType.I32, 'dire', None, 99999, ), # 7
(8, TType.DOUBLE, 'orderPrice', None, -1, ), # 8
(9, TType.I32, 'size', None, -1, ), # 9
(10, TType.I32, 'type', None, 99999, ), # 10
(11, TType.I32, 'status', None, 99999, ), # 11
(12, TType.I32, 'tradedVol', None, -1, ), # 12
(13, TType.STRING, 'systemOrderID', None, "", ), # 13
(14, TType.STRING, 'insertTime', None, "", ), # 14
None, # 15
None, # 16
(17, TType.STRING, 'updateTime', None, "", ), # 17
(18, TType.I32, 'volOriginal', None, -1, ), # 18
None, # 19
None, # 20
None, # 21
None, # 22
None, # 23
None, # 24
None, # 25
None, # 26
None, # 27
None, # 28
None, # 29
None, # 30
None, # 31
None, # 32
None, # 33
None, # 34
None, # 35
None, # 36
None, # 37
None, # 38
None, # 39
None, # 40
None, # 41
None, # 42
None, # 43
None, # 44
None, # 45
None, # 46
None, # 47
None, # 48
None, # 49
(50, TType.I32, 'errorID', None, -1, ), # 50
(51, TType.STRING, 'errorMsg', None, "", ), # 51
)
def __init__(self, stratID=thrift_spec[1][4], clientOrderID=thrift_spec[2][4], instrumentID=thrift_spec[3][4], exchangeID=thrift_spec[4][4], hedge=thrift_spec[5][4], offset=thrift_spec[6][4], dire=thrift_spec[7][4], orderPrice=thrift_spec[8][4], size=thrift_spec[9][4], type=thrift_spec[10][4], status=thrift_spec[11][4], tradedVol=thrift_spec[12][4], systemOrderID=thrift_spec[13][4], insertTime=thrift_spec[14][4], updateTime=thrift_spec[17][4], volOriginal=thrift_spec[18][4], errorID=thrift_spec[50][4], errorMsg=thrift_spec[51][4],):
self.stratID = stratID
self.clientOrderID = clientOrderID
self.instrumentID = instrumentID
self.exchangeID = exchangeID
self.hedge = hedge
self.offset = offset
self.dire = dire
self.orderPrice = orderPrice
self.size = size
self.type = type
self.status = status
self.tradedVol = tradedVol
self.systemOrderID = systemOrderID
self.insertTime = insertTime
self.updateTime = updateTime
self.volOriginal = volOriginal
self.errorID = errorID
self.errorMsg = errorMsg
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.stratID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.clientOrderID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.instrumentID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.exchangeID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.I32:
self.hedge = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.I32:
self.offset = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.I32:
self.dire = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 8:
if ftype == TType.DOUBLE:
self.orderPrice = iprot.readDouble();
else:
iprot.skip(ftype)
elif fid == 9:
if ftype == TType.I32:
self.size = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 10:
if ftype == TType.I32:
self.type = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 11:
if ftype == TType.I32:
self.status = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 12:
if ftype == TType.I32:
self.tradedVol = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 13:
if ftype == TType.STRING:
self.systemOrderID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 14:
if ftype == TType.STRING:
self.insertTime = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 17:
if ftype == TType.STRING:
self.updateTime = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 18:
if ftype == TType.I32:
self.volOriginal = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 50:
if ftype == TType.I32:
self.errorID = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 51:
if ftype == TType.STRING:
self.errorMsg = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RtnOrder')
if self.stratID is not None:
oprot.writeFieldBegin('stratID', TType.STRING, 1)
oprot.writeString(self.stratID)
oprot.writeFieldEnd()
if self.clientOrderID is not None:
oprot.writeFieldBegin('clientOrderID', TType.STRING, 2)
oprot.writeString(self.clientOrderID)
oprot.writeFieldEnd()
if self.instrumentID is not None:
oprot.writeFieldBegin('instrumentID', TType.STRING, 3)
oprot.writeString(self.instrumentID)
oprot.writeFieldEnd()
if self.exchangeID is not None:
oprot.writeFieldBegin('exchangeID', TType.STRING, 4)
oprot.writeString(self.exchangeID)
oprot.writeFieldEnd()
if self.hedge is not None:
oprot.writeFieldBegin('hedge', TType.I32, 5)
oprot.writeI32(self.hedge)
oprot.writeFieldEnd()
if self.offset is not None:
oprot.writeFieldBegin('offset', TType.I32, 6)
oprot.writeI32(self.offset)
oprot.writeFieldEnd()
if self.dire is not None:
oprot.writeFieldBegin('dire', TType.I32, 7)
oprot.writeI32(self.dire)
oprot.writeFieldEnd()
if self.orderPrice is not None:
oprot.writeFieldBegin('orderPrice', TType.DOUBLE, 8)
oprot.writeDouble(self.orderPrice)
oprot.writeFieldEnd()
if self.size is not None:
oprot.writeFieldBegin('size', TType.I32, 9)
oprot.writeI32(self.size)
oprot.writeFieldEnd()
if self.type is not None:
oprot.writeFieldBegin('type', TType.I32, 10)
oprot.writeI32(self.type)
oprot.writeFieldEnd()
if self.status is not None:
oprot.writeFieldBegin('status', TType.I32, 11)
oprot.writeI32(self.status)
oprot.writeFieldEnd()
if self.tradedVol is not None:
oprot.writeFieldBegin('tradedVol', TType.I32, 12)
oprot.writeI32(self.tradedVol)
oprot.writeFieldEnd()
if self.systemOrderID is not None:
oprot.writeFieldBegin('systemOrderID', TType.STRING, 13)
oprot.writeString(self.systemOrderID)
oprot.writeFieldEnd()
if self.insertTime is not None:
oprot.writeFieldBegin('insertTime', TType.STRING, 14)
oprot.writeString(self.insertTime)
oprot.writeFieldEnd()
if self.updateTime is not None:
oprot.writeFieldBegin('updateTime', TType.STRING, 17)
oprot.writeString(self.updateTime)
oprot.writeFieldEnd()
if self.volOriginal is not None:
oprot.writeFieldBegin('volOriginal', TType.I32, 18)
oprot.writeI32(self.volOriginal)
oprot.writeFieldEnd()
if self.errorID is not None:
oprot.writeFieldBegin('errorID', TType.I32, 50)
oprot.writeI32(self.errorID)
oprot.writeFieldEnd()
if self.errorMsg is not None:
oprot.writeFieldBegin('errorMsg', TType.STRING, 51)
oprot.writeString(self.errorMsg)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.stratID is None:
raise TProtocol.TProtocolException(message='Required field stratID is unset!')
if self.clientOrderID is None:
raise TProtocol.TProtocolException(message='Required field clientOrderID is unset!')
if self.instrumentID is None:
raise TProtocol.TProtocolException(message='Required field instrumentID is unset!')
if self.exchangeID is None:
raise TProtocol.TProtocolException(message='Required field exchangeID is unset!')
if self.hedge is None:
raise TProtocol.TProtocolException(message='Required field hedge is unset!')
if self.offset is None:
raise TProtocol.TProtocolException(message='Required field offset is unset!')
if self.dire is None:
raise TProtocol.TProtocolException(message='Required field dire is unset!')
if self.orderPrice is None:
raise TProtocol.TProtocolException(message='Required field orderPrice is unset!')
if self.size is None:
raise TProtocol.TProtocolException(message='Required field size is unset!')
if self.type is None:
raise TProtocol.TProtocolException(message='Required field type is unset!')
if self.status is None:
raise TProtocol.TProtocolException(message='Required field status is unset!')
if self.tradedVol is None:
raise TProtocol.TProtocolException(message='Required field tradedVol is unset!')
if self.systemOrderID is None:
raise TProtocol.TProtocolException(message='Required field systemOrderID is unset!')
if self.errorID is None:
raise TProtocol.TProtocolException(message='Required field errorID is unset!')
if self.errorMsg is None:
raise TProtocol.TProtocolException(message='Required field errorMsg is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.stratID)
value = (value * 31) ^ hash(self.clientOrderID)
value = (value * 31) ^ hash(self.instrumentID)
value = (value * 31) ^ hash(self.exchangeID)
value = (value * 31) ^ hash(self.hedge)
value = (value * 31) ^ hash(self.offset)
value = (value * 31) ^ hash(self.dire)
value = (value * 31) ^ hash(self.orderPrice)
value = (value * 31) ^ hash(self.size)
value = (value * 31) ^ hash(self.type)
value = (value * 31) ^ hash(self.status)
value = (value * 31) ^ hash(self.tradedVol)
value = (value * 31) ^ hash(self.systemOrderID)
value = (value * 31) ^ hash(self.insertTime)
value = (value * 31) ^ hash(self.updateTime)
value = (value * 31) ^ hash(self.volOriginal)
value = (value * 31) ^ hash(self.errorID)
value = (value * 31) ^ hash(self.errorMsg)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Response:
"""
Attributes:
- sendMsg
- errorID
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'sendMsg', None, "", ), # 1
None, # 2
None, # 3
None, # 4
None, # 5
None, # 6
None, # 7
None, # 8
None, # 9
None, # 10
None, # 11
None, # 12
None, # 13
None, # 14
None, # 15
None, # 16
None, # 17
None, # 18
None, # 19
None, # 20
None, # 21
None, # 22
None, # 23
None, # 24
None, # 25
None, # 26
None, # 27
None, # 28
None, # 29
None, # 30
None, # 31
None, # 32
None, # 33
None, # 34
None, # 35
None, # 36
None, # 37
None, # 38
None, # 39
None, # 40
None, # 41
None, # 42
None, # 43
None, # 44
None, # 45
None, # 46
None, # 47
None, # 48
None, # 49
(50, TType.I32, 'errorID', None, -1, ), # 50
)
def __init__(self, sendMsg=thrift_spec[1][4], errorID=thrift_spec[50][4],):
self.sendMsg = sendMsg
self.errorID = errorID
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.sendMsg = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 50:
if ftype == TType.I32:
self.errorID = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Response')
if self.sendMsg is not None:
oprot.writeFieldBegin('sendMsg', TType.STRING, 1)
oprot.writeString(self.sendMsg)
oprot.writeFieldEnd()
if self.errorID is not None:
oprot.writeFieldBegin('errorID', TType.I32, 50)
oprot.writeI32(self.errorID)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.errorID is None:
raise TProtocol.TProtocolException(message='Required field errorID is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.sendMsg)
value = (value * 31) ^ hash(self.errorID)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Request:
"""
Attributes:
- result
- guestName
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'result', None, -1, ), # 1
(2, TType.STRING, 'guestName', None, "", ), # 2
)
def __init__(self, result=thrift_spec[1][4], guestName=thrift_spec[2][4],):
self.result = result
self.guestName = guestName
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.result = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.guestName = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Request')
if self.result is not None:
oprot.writeFieldBegin('result', TType.I32, 1)
oprot.writeI32(self.result)
oprot.writeFieldEnd()
if self.guestName is not None:
oprot.writeFieldBegin('guestName', TType.STRING, 2)
oprot.writeString(self.guestName)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.result)
value = (value * 31) ^ hash(self.guestName)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Config:
"""
Attributes:
- userName
- errorID
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'userName', None, "", ), # 1
None, # 2
None, # 3
None, # 4
None, # 5
None, # 6
None, # 7
None, # 8
None, # 9
None, # 10
None, # 11
None, # 12
None, # 13
None, # 14
None, # 15
None, # 16
None, # 17
None, # 18
None, # 19
None, # 20
None, # 21
None, # 22
None, # 23
None, # 24
None, # 25
None, # 26
None, # 27
None, # 28
None, # 29
None, # 30
None, # 31
None, # 32
None, # 33
None, # 34
None, # 35
None, # 36
None, # 37
None, # 38
None, # 39
None, # 40
None, # 41
None, # 42
None, # 43
None, # 44
None, # 45
None, # 46
None, # 47
None, # 48
None, # 49
(50, TType.I32, 'errorID', None, -1, ), # 50
)
def __init__(self, userName=thrift_spec[1][4], errorID=thrift_spec[50][4],):
self.userName = userName
self.errorID = errorID
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.userName = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 50:
if ftype == TType.I32:
self.errorID = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Config')
if self.userName is not None:
oprot.writeFieldBegin('userName', TType.STRING, 1)
oprot.writeString(self.userName)
oprot.writeFieldEnd()
if self.errorID is not None:
oprot.writeFieldBegin('errorID', TType.I32, 50)
oprot.writeI32(self.errorID)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.userName is None:
raise TProtocol.TProtocolException(message='Required field userName is unset!')
if self.errorID is None:
raise TProtocol.TProtocolException(message='Required field errorID is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.userName)
value = (value * 31) ^ hash(self.errorID)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RtnOrders:
"""
Attributes:
- orders
- count
- errorID
"""
thrift_spec = (
None, # 0
(1, TType.LIST, 'orders', (TType.STRUCT,(RtnOrder, RtnOrder.thrift_spec)), None, ), # 1
(2, TType.I32, 'count', None, -1, ), # 2
None, # 3
None, # 4
None, # 5
None, # 6
None, # 7
None, # 8
None, # 9
None, # 10
None, # 11
None, # 12
None, # 13
None, # 14
None, # 15
None, # 16
None, # 17
None, # 18
None, # 19
None, # 20
None, # 21
None, # 22
None, # 23
None, # 24
None, # 25
None, # 26
None, # 27
None, # 28
None, # 29
None, # 30
None, # 31
None, # 32
None, # 33
None, # 34
None, # 35
None, # 36
None, # 37
None, # 38
None, # 39
None, # 40
None, # 41
None, # 42
None, # 43
None, # 44
None, # 45
None, # 46
None, # 47
None, # 48
None, # 49
(50, TType.I32, 'errorID', None, -1, ), # 50
)
def __init__(self, orders=None, count=thrift_spec[2][4], errorID=thrift_spec[50][4],):
self.orders = orders
self.count = count
self.errorID = errorID
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.LIST:
self.orders = []
(_etype3, _size0) = iprot.readListBegin()
for _i4 in xrange(_size0):
_elem5 = RtnOrder()
_elem5.read(iprot)
self.orders.append(_elem5)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.count = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 50:
if ftype == TType.I32:
self.errorID = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RtnOrders')
if self.orders is not None:
oprot.writeFieldBegin('orders', TType.LIST, 1)
oprot.writeListBegin(TType.STRUCT, len(self.orders))
for iter6 in self.orders:
iter6.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.count is not None:
oprot.writeFieldBegin('count', TType.I32, 2)
oprot.writeI32(self.count)
oprot.writeFieldEnd()
if self.errorID is not None:
oprot.writeFieldBegin('errorID', TType.I32, 50)
oprot.writeI32(self.errorID)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.orders is None:
raise TProtocol.TProtocolException(message='Required field orders is unset!')
if self.count is None:
raise TProtocol.TProtocolException(message='Required field count is unset!')
if self.errorID is None:
raise TProtocol.TProtocolException(message='Required field errorID is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.orders)
value = (value * 31) ^ hash(self.count)
value = (value * 31) ^ hash(self.errorID)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class InputOrder:
"""
Attributes:
- stratID
- clientOrderID
- instrumentID
- exchangeID
- hedge
- offse
- dire
- price
- size
- type
- systemOrderID
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'stratID', None, "", ), # 1
(2, TType.STRING, 'clientOrderID', None, "", ), # 2
(3, TType.STRING, 'instrumentID', None, "", ), # 3
(4, TType.STRING, 'exchangeID', None, "", ), # 4
(5, TType.I32, 'hedge', None, 99999, ), # 5
(6, TType.I32, 'offse', None, 99999, ), # 6
(7, TType.I32, 'dire', None, 99999, ), # 7
(8, TType.DOUBLE, 'price', None, -1, ), # 8
(9, TType.I32, 'size', None, -1, ), # 9
(10, TType.I32, 'type', None, 99999, ), # 10
(11, TType.STRING, 'systemOrderID', None, "", ), # 11
)
def __init__(self, stratID=thrift_spec[1][4], clientOrderID=thrift_spec[2][4], instrumentID=thrift_spec[3][4], exchangeID=thrift_spec[4][4], hedge=thrift_spec[5][4], offse=thrift_spec[6][4], dire=thrift_spec[7][4], price=thrift_spec[8][4], size=thrift_spec[9][4], type=thrift_spec[10][4], systemOrderID=thrift_spec[11][4],):
self.stratID = stratID
self.clientOrderID = clientOrderID
self.instrumentID = instrumentID
self.exchangeID = exchangeID
self.hedge = hedge
self.offse = offse
self.dire = dire
self.price = price
self.size = size
self.type = type
self.systemOrderID = systemOrderID
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.stratID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.clientOrderID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.instrumentID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.exchangeID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.I32:
self.hedge = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.I32:
self.offse = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.I32:
self.dire = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 8:
if ftype == TType.DOUBLE:
self.price = iprot.readDouble();
else:
iprot.skip(ftype)
elif fid == 9:
if ftype == TType.I32:
self.size = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 10:
if ftype == TType.I32:
self.type = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 11:
if ftype == TType.STRING:
self.systemOrderID = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('InputOrder')
if self.stratID is not None:
oprot.writeFieldBegin('stratID', TType.STRING, 1)
oprot.writeString(self.stratID)
oprot.writeFieldEnd()
if self.clientOrderID is not None:
oprot.writeFieldBegin('clientOrderID', TType.STRING, 2)
oprot.writeString(self.clientOrderID)
oprot.writeFieldEnd()
if self.instrumentID is not None:
oprot.writeFieldBegin('instrumentID', TType.STRING, 3)
oprot.writeString(self.instrumentID)
oprot.writeFieldEnd()
if self.exchangeID is not None:
oprot.writeFieldBegin('exchangeID', TType.STRING, 4)
oprot.writeString(self.exchangeID)
oprot.writeFieldEnd()
if self.hedge is not None:
oprot.writeFieldBegin('hedge', TType.I32, 5)
oprot.writeI32(self.hedge)
oprot.writeFieldEnd()
if self.offse is not None:
oprot.writeFieldBegin('offse', TType.I32, 6)
oprot.writeI32(self.offse)
oprot.writeFieldEnd()
if self.dire is not None:
oprot.writeFieldBegin('dire', TType.I32, 7)
oprot.writeI32(self.dire)
oprot.writeFieldEnd()
if self.price is not None:
oprot.writeFieldBegin('price', TType.DOUBLE, 8)
oprot.writeDouble(self.price)
oprot.writeFieldEnd()
if self.size is not None:
oprot.writeFieldBegin('size', TType.I32, 9)
oprot.writeI32(self.size)
oprot.writeFieldEnd()
if self.type is not None:
oprot.writeFieldBegin('type', TType.I32, 10)
oprot.writeI32(self.type)
oprot.writeFieldEnd()
if self.systemOrderID is not None:
oprot.writeFieldBegin('systemOrderID', TType.STRING, 11)
oprot.writeString(self.systemOrderID)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.stratID is None:
raise TProtocol.TProtocolException(message='Required field stratID is unset!')
if self.clientOrderID is None:
raise TProtocol.TProtocolException(message='Required field clientOrderID is unset!')
if self.instrumentID is None:
raise TProtocol.TProtocolException(message='Required field instrumentID is unset!')
if self.exchangeID is None:
raise TProtocol.TProtocolException(message='Required field exchangeID is unset!')
if self.hedge is None:
raise TProtocol.TProtocolException(message='Required field hedge is unset!')
if self.offse is None:
raise TProtocol.TProtocolException(message='Required field offse is unset!')
if self.dire is None:
raise TProtocol.TProtocolException(message='Required field dire is unset!')
if self.price is None:
raise TProtocol.TProtocolException(message='Required field price is unset!')
if self.size is None:
raise TProtocol.TProtocolException(message='Required field size is unset!')
if self.type is None:
raise TProtocol.TProtocolException(message='Required field type is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.stratID)
value = (value * 31) ^ hash(self.clientOrderID)
value = (value * 31) ^ hash(self.instrumentID)
value = (value * 31) ^ hash(self.exchangeID)
value = (value * 31) ^ hash(self.hedge)
value = (value * 31) ^ hash(self.offse)
value = (value * 31) ^ hash(self.dire)
value = (value * 31) ^ hash(self.price)
value = (value * 31) ^ hash(self.size)
value = (value * 31) ^ hash(self.type)
value = (value * 31) ^ hash(self.systemOrderID)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class OrderIDCancel:
"""
Attributes:
- clientOrderID
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'clientOrderID', None, "", ), # 1
)
def __init__(self, clientOrderID=thrift_spec[1][4],):
self.clientOrderID = clientOrderID
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.clientOrderID = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('OrderIDCancel')
if self.clientOrderID is not None:
oprot.writeFieldBegin('clientOrderID', TType.STRING, 1)
oprot.writeString(self.clientOrderID)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.clientOrderID is None:
raise TProtocol.TProtocolException(message='Required field clientOrderID is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.clientOrderID)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RtnTrade:
"""
Attributes:
- stratID
- clientOrderID
- instrumentID
- exchangeID
- hedge
- offset
- dire
- tradePrice
- tradeVol
- tradeTime
- systemOrderID
- tradeID
- errorID
- errorMsg
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'stratID', None, "", ), # 1
(2, TType.STRING, 'clientOrderID', None, "", ), # 2
(3, TType.STRING, 'instrumentID', None, "", ), # 3
(4, TType.STRING, 'exchangeID', None, "", ), # 4
(5, TType.I32, 'hedge', None, 99999, ), # 5
(6, TType.I32, 'offset', None, 99999, ), # 6
(7, TType.I32, 'dire', None, 99999, ), # 7
(8, TType.DOUBLE, 'tradePrice', None, -1, ), # 8
(9, TType.I32, 'tradeVol', None, -1, ), # 9
(10, TType.STRING, 'tradeTime', None, "", ), # 10
(11, TType.STRING, 'systemOrderID', None, "", ), # 11
(12, TType.STRING, 'tradeID', None, "", ), # 12
None, # 13
None, # 14
None, # 15
None, # 16
None, # 17
None, # 18
None, # 19
None, # 20
None, # 21
None, # 22
None, # 23
None, # 24
None, # 25
None, # 26
None, # 27
None, # 28
None, # 29
None, # 30
None, # 31
None, # 32
None, # 33
None, # 34
None, # 35
None, # 36
None, # 37
None, # 38
None, # 39
None, # 40
None, # 41
None, # 42
None, # 43
None, # 44
None, # 45
None, # 46
None, # 47
None, # 48
None, # 49
(50, TType.I32, 'errorID', None, -1, ), # 50
(51, TType.STRING, 'errorMsg', None, "", ), # 51
)
def __init__(self, stratID=thrift_spec[1][4], clientOrderID=thrift_spec[2][4], instrumentID=thrift_spec[3][4], exchangeID=thrift_spec[4][4], hedge=thrift_spec[5][4], offset=thrift_spec[6][4], dire=thrift_spec[7][4], tradePrice=thrift_spec[8][4], tradeVol=thrift_spec[9][4], tradeTime=thrift_spec[10][4], systemOrderID=thrift_spec[11][4], tradeID=thrift_spec[12][4], errorID=thrift_spec[50][4], errorMsg=thrift_spec[51][4],):
self.stratID = stratID
self.clientOrderID = clientOrderID
self.instrumentID = instrumentID
self.exchangeID = exchangeID
self.hedge = hedge
self.offset = offset
self.dire = dire
self.tradePrice = tradePrice
self.tradeVol = tradeVol
self.tradeTime = tradeTime
self.systemOrderID = systemOrderID
self.tradeID = tradeID
self.errorID = errorID
self.errorMsg = errorMsg
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.stratID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.clientOrderID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.instrumentID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.exchangeID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.I32:
self.hedge = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.I32:
self.offset = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.I32:
self.dire = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 8:
if ftype == TType.DOUBLE:
self.tradePrice = iprot.readDouble();
else:
iprot.skip(ftype)
elif fid == 9:
if ftype == TType.I32:
self.tradeVol = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 10:
if ftype == TType.STRING:
self.tradeTime = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 11:
if ftype == TType.STRING:
self.systemOrderID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 12:
if ftype == TType.STRING:
self.tradeID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 50:
if ftype == TType.I32:
self.errorID = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 51:
if ftype == TType.STRING:
self.errorMsg = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RtnTrade')
if self.stratID is not None:
oprot.writeFieldBegin('stratID', TType.STRING, 1)
oprot.writeString(self.stratID)
oprot.writeFieldEnd()
if self.clientOrderID is not None:
oprot.writeFieldBegin('clientOrderID', TType.STRING, 2)
oprot.writeString(self.clientOrderID)
oprot.writeFieldEnd()
if self.instrumentID is not None:
oprot.writeFieldBegin('instrumentID', TType.STRING, 3)
oprot.writeString(self.instrumentID)
oprot.writeFieldEnd()
if self.exchangeID is not None:
oprot.writeFieldBegin('exchangeID', TType.STRING, 4)
oprot.writeString(self.exchangeID)
oprot.writeFieldEnd()
if self.hedge is not None:
oprot.writeFieldBegin('hedge', TType.I32, 5)
oprot.writeI32(self.hedge)
oprot.writeFieldEnd()
if self.offset is not None:
oprot.writeFieldBegin('offset', TType.I32, 6)
oprot.writeI32(self.offset)
oprot.writeFieldEnd()
if self.dire is not None:
oprot.writeFieldBegin('dire', TType.I32, 7)
oprot.writeI32(self.dire)
oprot.writeFieldEnd()
if self.tradePrice is not None:
oprot.writeFieldBegin('tradePrice', TType.DOUBLE, 8)
oprot.writeDouble(self.tradePrice)
oprot.writeFieldEnd()
if self.tradeVol is not None:
oprot.writeFieldBegin('tradeVol', TType.I32, 9)
oprot.writeI32(self.tradeVol)
oprot.writeFieldEnd()
if self.tradeTime is not None:
oprot.writeFieldBegin('tradeTime', TType.STRING, 10)
oprot.writeString(self.tradeTime)
oprot.writeFieldEnd()
if self.systemOrderID is not None:
oprot.writeFieldBegin('systemOrderID', TType.STRING, 11)
oprot.writeString(self.systemOrderID)
oprot.writeFieldEnd()
if self.tradeID is not None:
oprot.writeFieldBegin('tradeID', TType.STRING, 12)
oprot.writeString(self.tradeID)
oprot.writeFieldEnd()
if self.errorID is not None:
oprot.writeFieldBegin('errorID', TType.I32, 50)
oprot.writeI32(self.errorID)
oprot.writeFieldEnd()
if self.errorMsg is not None:
oprot.writeFieldBegin('errorMsg', TType.STRING, 51)
oprot.writeString(self.errorMsg)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.stratID is None:
raise TProtocol.TProtocolException(message='Required field stratID is unset!')
if self.clientOrderID is None:
raise TProtocol.TProtocolException(message='Required field clientOrderID is unset!')
if self.instrumentID is None:
raise TProtocol.TProtocolException(message='Required field instrumentID is unset!')
if self.exchangeID is None:
raise TProtocol.TProtocolException(message='Required field exchangeID is unset!')
if self.hedge is None:
raise TProtocol.TProtocolException(message='Required field hedge is unset!')
if self.offset is None:
raise TProtocol.TProtocolException(message='Required field offset is unset!')
if self.dire is None:
raise TProtocol.TProtocolException(message='Required field dire is unset!')
if self.tradePrice is None:
raise TProtocol.TProtocolException(message='Required field tradePrice is unset!')
if self.tradeVol is None:
raise TProtocol.TProtocolException(message='Required field tradeVol is unset!')
if self.tradeTime is None:
raise TProtocol.TProtocolException(message='Required field tradeTime is unset!')
if self.systemOrderID is None:
raise TProtocol.TProtocolException(message='Required field systemOrderID is unset!')
if self.tradeID is None:
raise TProtocol.TProtocolException(message='Required field tradeID is unset!')
if self.errorID is None:
raise TProtocol.TProtocolException(message='Required field errorID is unset!')
if self.errorMsg is None:
raise TProtocol.TProtocolException(message='Required field errorMsg is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.stratID)
value = (value * 31) ^ hash(self.clientOrderID)
value = (value * 31) ^ hash(self.instrumentID)
value = (value * 31) ^ hash(self.exchangeID)
value = (value * 31) ^ hash(self.hedge)
value = (value * 31) ^ hash(self.offset)
value = (value * 31) ^ hash(self.dire)
value = (value * 31) ^ hash(self.tradePrice)
value = (value * 31) ^ hash(self.tradeVol)
value = (value * 31) ^ hash(self.tradeTime)
value = (value * 31) ^ hash(self.systemOrderID)
value = (value * 31) ^ hash(self.tradeID)
value = (value * 31) ^ hash(self.errorID)
value = (value * 31) ^ hash(self.errorMsg)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class QryStep:
"""
Attributes:
- startNum
- range
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'startNum', None, -1, ), # 1
(2, TType.I32, 'range', None, -1, ), # 2
)
def __init__(self, startNum=thrift_spec[1][4], range=thrift_spec[2][4],):
self.startNum = startNum
self.range = range
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.startNum = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.range = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('QryStep')
if self.startNum is not None:
oprot.writeFieldBegin('startNum', TType.I32, 1)
oprot.writeI32(self.startNum)
oprot.writeFieldEnd()
if self.range is not None:
oprot.writeFieldBegin('range', TType.I32, 2)
oprot.writeI32(self.range)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.startNum is None:
raise TProtocol.TProtocolException(message='Required field startNum is unset!')
if self.range is None:
raise TProtocol.TProtocolException(message='Required field range is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.startNum)
value = (value * 31) ^ hash(self.range)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RtnTrades:
"""
Attributes:
- trades
- count
- errorID
- errorMsg
"""
thrift_spec = (
None, # 0
(1, TType.LIST, 'trades', (TType.STRUCT,(RtnTrade, RtnTrade.thrift_spec)), None, ), # 1
(2, TType.I32, 'count', None, -1, ), # 2
None, # 3
None, # 4
None, # 5
None, # 6
None, # 7
None, # 8
None, # 9
None, # 10
None, # 11
None, # 12
None, # 13
None, # 14
None, # 15
None, # 16
None, # 17
None, # 18
None, # 19
None, # 20
None, # 21
None, # 22
None, # 23
None, # 24
None, # 25
None, # 26
None, # 27
None, # 28
None, # 29
None, # 30
None, # 31
None, # 32
None, # 33
None, # 34
None, # 35
None, # 36
None, # 37
None, # 38
None, # 39
None, # 40
None, # 41
None, # 42
None, # 43
None, # 44
None, # 45
None, # 46
None, # 47
None, # 48
None, # 49
(50, TType.I32, 'errorID', None, -1, ), # 50
(51, TType.STRING, 'errorMsg', None, "", ), # 51
)
def __init__(self, trades=None, count=thrift_spec[2][4], errorID=thrift_spec[50][4], errorMsg=thrift_spec[51][4],):
self.trades = trades
self.count = count
self.errorID = errorID
self.errorMsg = errorMsg
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.LIST:
self.trades = []
(_etype10, _size7) = iprot.readListBegin()
for _i11 in xrange(_size7):
_elem12 = RtnTrade()
_elem12.read(iprot)
self.trades.append(_elem12)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.count = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 50:
if ftype == TType.I32:
self.errorID = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 51:
if ftype == TType.STRING:
self.errorMsg = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RtnTrades')
if self.trades is not None:
oprot.writeFieldBegin('trades', TType.LIST, 1)
oprot.writeListBegin(TType.STRUCT, len(self.trades))
for iter13 in self.trades:
iter13.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.count is not None:
oprot.writeFieldBegin('count', TType.I32, 2)
oprot.writeI32(self.count)
oprot.writeFieldEnd()
if self.errorID is not None:
oprot.writeFieldBegin('errorID', TType.I32, 50)
oprot.writeI32(self.errorID)
oprot.writeFieldEnd()
if self.errorMsg is not None:
oprot.writeFieldBegin('errorMsg', TType.STRING, 51)
oprot.writeString(self.errorMsg)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.trades is None:
raise TProtocol.TProtocolException(message='Required field trades is unset!')
if self.count is None:
raise TProtocol.TProtocolException(message='Required field count is unset!')
if self.errorID is None:
raise TProtocol.TProtocolException(message='Required field errorID is unset!')
if self.errorMsg is None:
raise TProtocol.TProtocolException(message='Required field errorMsg is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.trades)
value = (value * 31) ^ hash(self.count)
value = (value * 31) ^ hash(self.errorID)
value = (value * 31) ^ hash(self.errorMsg)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class SubscribeReq:
"""
Attributes:
- Type
- instrumentID
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'Type', None, None, ), # 1
(2, TType.STRING, 'instrumentID', None, "", ), # 2
)
def __init__(self, Type=None, instrumentID=thrift_spec[2][4],):
self.Type = Type
self.instrumentID = instrumentID
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.Type = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.instrumentID = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('SubscribeReq')
if self.Type is not None:
oprot.writeFieldBegin('Type', TType.I32, 1)
oprot.writeI32(self.Type)
oprot.writeFieldEnd()
if self.instrumentID is not None:
oprot.writeFieldBegin('instrumentID', TType.STRING, 2)
oprot.writeString(self.instrumentID)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.Type is None:
raise TProtocol.TProtocolException(message='Required field Type is unset!')
if self.instrumentID is None:
raise TProtocol.TProtocolException(message='Required field instrumentID is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.Type)
value = (value * 31) ^ hash(self.instrumentID)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Feed:
"""
Attributes:
- Type
- instrumentID
- ExchangeID
- lastTradePrice
- LastTradeVol
- UpperLml
- LowLml
- depth
- bids
- bidVols
- ask
- askVols
- QuoteUpdateMillisec
- ReceiveUpdateMillisec
- strategyID
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'Type', None, None, ), # 1
(2, TType.STRING, 'instrumentID', None, "", ), # 2
(3, TType.STRING, 'ExchangeID', None, "", ), # 3
(4, TType.DOUBLE, 'lastTradePrice', None, -1, ), # 4
(5, TType.I32, 'LastTradeVol', None, -1, ), # 5
(6, TType.DOUBLE, 'UpperLml', None, -1, ), # 6
(7, TType.DOUBLE, 'LowLml', None, -1, ), # 7
(8, TType.I32, 'depth', None, -1, ), # 8
(9, TType.LIST, 'bids', (TType.DOUBLE,None), None, ), # 9
(10, TType.LIST, 'bidVols', (TType.I32,None), None, ), # 10
(11, TType.LIST, 'ask', (TType.DOUBLE,None), None, ), # 11
(12, TType.LIST, 'askVols', (TType.I32,None), None, ), # 12
(13, TType.I64, 'QuoteUpdateMillisec', None, -1, ), # 13
(14, TType.I64, 'ReceiveUpdateMillisec', None, -1, ), # 14
(15, TType.STRING, 'strategyID', None, "", ), # 15
)
def __init__(self, Type=None, instrumentID=thrift_spec[2][4], ExchangeID=thrift_spec[3][4], lastTradePrice=thrift_spec[4][4], LastTradeVol=thrift_spec[5][4], UpperLml=thrift_spec[6][4], LowLml=thrift_spec[7][4], depth=thrift_spec[8][4], bids=None, bidVols=None, ask=None, askVols=None, QuoteUpdateMillisec=thrift_spec[13][4], ReceiveUpdateMillisec=thrift_spec[14][4], strategyID=thrift_spec[15][4],):
self.Type = Type
self.instrumentID = instrumentID
self.ExchangeID = ExchangeID
self.lastTradePrice = lastTradePrice
self.LastTradeVol = LastTradeVol
self.UpperLml = UpperLml
self.LowLml = LowLml
self.depth = depth
self.bids = bids
self.bidVols = bidVols
self.ask = ask
self.askVols = askVols
self.QuoteUpdateMillisec = QuoteUpdateMillisec
self.ReceiveUpdateMillisec = ReceiveUpdateMillisec
self.strategyID = strategyID
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.Type = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.instrumentID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.ExchangeID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.DOUBLE:
self.lastTradePrice = iprot.readDouble();
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.I32:
self.LastTradeVol = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.DOUBLE:
self.UpperLml = iprot.readDouble();
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.DOUBLE:
self.LowLml = iprot.readDouble();
else:
iprot.skip(ftype)
elif fid == 8:
if ftype == TType.I32:
self.depth = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 9:
if ftype == TType.LIST:
self.bids = []
(_etype17, _size14) = iprot.readListBegin()
for _i18 in xrange(_size14):
_elem19 = iprot.readDouble();
self.bids.append(_elem19)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 10:
if ftype == TType.LIST:
self.bidVols = []
(_etype23, _size20) = iprot.readListBegin()
for _i24 in xrange(_size20):
_elem25 = iprot.readI32();
self.bidVols.append(_elem25)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 11:
if ftype == TType.LIST:
self.ask = []
(_etype29, _size26) = iprot.readListBegin()
for _i30 in xrange(_size26):
_elem31 = iprot.readDouble();
self.ask.append(_elem31)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 12:
if ftype == TType.LIST:
self.askVols = []
(_etype35, _size32) = iprot.readListBegin()
for _i36 in xrange(_size32):
_elem37 = iprot.readI32();
self.askVols.append(_elem37)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 13:
if ftype == TType.I64:
self.QuoteUpdateMillisec = iprot.readI64();
else:
iprot.skip(ftype)
elif fid == 14:
if ftype == TType.I64:
self.ReceiveUpdateMillisec = iprot.readI64();
else:
iprot.skip(ftype)
elif fid == 15:
if ftype == TType.STRING:
self.strategyID = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Feed')
if self.Type is not None:
oprot.writeFieldBegin('Type', TType.I32, 1)
oprot.writeI32(self.Type)
oprot.writeFieldEnd()
if self.instrumentID is not None:
oprot.writeFieldBegin('instrumentID', TType.STRING, 2)
oprot.writeString(self.instrumentID)
oprot.writeFieldEnd()
if self.ExchangeID is not None:
oprot.writeFieldBegin('ExchangeID', TType.STRING, 3)
oprot.writeString(self.ExchangeID)
oprot.writeFieldEnd()
if self.lastTradePrice is not None:
oprot.writeFieldBegin('lastTradePrice', TType.DOUBLE, 4)
oprot.writeDouble(self.lastTradePrice)
oprot.writeFieldEnd()
if self.LastTradeVol is not None:
oprot.writeFieldBegin('LastTradeVol', TType.I32, 5)
oprot.writeI32(self.LastTradeVol)
oprot.writeFieldEnd()
if self.UpperLml is not None:
oprot.writeFieldBegin('UpperLml', TType.DOUBLE, 6)
oprot.writeDouble(self.UpperLml)
oprot.writeFieldEnd()
if self.LowLml is not None:
oprot.writeFieldBegin('LowLml', TType.DOUBLE, 7)
oprot.writeDouble(self.LowLml)
oprot.writeFieldEnd()
if self.depth is not None:
oprot.writeFieldBegin('depth', TType.I32, 8)
oprot.writeI32(self.depth)
oprot.writeFieldEnd()
if self.bids is not None:
oprot.writeFieldBegin('bids', TType.LIST, 9)
oprot.writeListBegin(TType.DOUBLE, len(self.bids))
for iter38 in self.bids:
oprot.writeDouble(iter38)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.bidVols is not None:
oprot.writeFieldBegin('bidVols', TType.LIST, 10)
oprot.writeListBegin(TType.I32, len(self.bidVols))
for iter39 in self.bidVols:
oprot.writeI32(iter39)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.ask is not None:
oprot.writeFieldBegin('ask', TType.LIST, 11)
oprot.writeListBegin(TType.DOUBLE, len(self.ask))
for iter40 in self.ask:
oprot.writeDouble(iter40)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.askVols is not None:
oprot.writeFieldBegin('askVols', TType.LIST, 12)
oprot.writeListBegin(TType.I32, len(self.askVols))
for iter41 in self.askVols:
oprot.writeI32(iter41)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.QuoteUpdateMillisec is not None:
oprot.writeFieldBegin('QuoteUpdateMillisec', TType.I64, 13)
oprot.writeI64(self.QuoteUpdateMillisec)
oprot.writeFieldEnd()
if self.ReceiveUpdateMillisec is not None:
oprot.writeFieldBegin('ReceiveUpdateMillisec', TType.I64, 14)
oprot.writeI64(self.ReceiveUpdateMillisec)
oprot.writeFieldEnd()
if self.strategyID is not None:
oprot.writeFieldBegin('strategyID', TType.STRING, 15)
oprot.writeString(self.strategyID)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.Type is None:
raise TProtocol.TProtocolException(message='Required field Type is unset!')
if self.instrumentID is None:
raise TProtocol.TProtocolException(message='Required field instrumentID is unset!')
if self.ExchangeID is None:
raise TProtocol.TProtocolException(message='Required field ExchangeID is unset!')
if self.lastTradePrice is None:
raise TProtocol.TProtocolException(message='Required field lastTradePrice is unset!')
if self.LastTradeVol is None:
raise TProtocol.TProtocolException(message='Required field LastTradeVol is unset!')
if self.UpperLml is None:
raise TProtocol.TProtocolException(message='Required field UpperLml is unset!')
if self.LowLml is None:
raise TProtocol.TProtocolException(message='Required field LowLml is unset!')
if self.depth is None:
raise TProtocol.TProtocolException(message='Required field depth is unset!')
if self.bids is None:
raise TProtocol.TProtocolException(message='Required field bids is unset!')
if self.bidVols is None:
raise TProtocol.TProtocolException(message='Required field bidVols is unset!')
if self.ask is None:
raise TProtocol.TProtocolException(message='Required field ask is unset!')
if self.askVols is None:
raise TProtocol.TProtocolException(message='Required field askVols is unset!')
if self.QuoteUpdateMillisec is None:
raise TProtocol.TProtocolException(message='Required field QuoteUpdateMillisec is unset!')
if self.ReceiveUpdateMillisec is None:
raise TProtocol.TProtocolException(message='Required field ReceiveUpdateMillisec is unset!')
if self.strategyID is None:
raise TProtocol.TProtocolException(message='Required field strategyID is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.Type)
value = (value * 31) ^ hash(self.instrumentID)
value = (value * 31) ^ hash(self.ExchangeID)
value = (value * 31) ^ hash(self.lastTradePrice)
value = (value * 31) ^ hash(self.LastTradeVol)
value = (value * 31) ^ hash(self.UpperLml)
value = (value * 31) ^ hash(self.LowLml)
value = (value * 31) ^ hash(self.depth)
value = (value * 31) ^ hash(self.bids)
value = (value * 31) ^ hash(self.bidVols)
value = (value * 31) ^ hash(self.ask)
value = (value * 31) ^ hash(self.askVols)
value = (value * 31) ^ hash(self.QuoteUpdateMillisec)
value = (value * 31) ^ hash(self.ReceiveUpdateMillisec)
value = (value * 31) ^ hash(self.strategyID)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RtnFeeds:
"""
Attributes:
- feeds
- count
- errorID
- errorMsg
"""
thrift_spec = (
None, # 0
(1, TType.LIST, 'feeds', (TType.STRUCT,(Feed, Feed.thrift_spec)), None, ), # 1
(2, TType.I32, 'count', None, -1, ), # 2
None, # 3
None, # 4
None, # 5
None, # 6
None, # 7
None, # 8
None, # 9
None, # 10
None, # 11
None, # 12
None, # 13
None, # 14
None, # 15
None, # 16
None, # 17
None, # 18
None, # 19
None, # 20
None, # 21
None, # 22
None, # 23
None, # 24
None, # 25
None, # 26
None, # 27
None, # 28
None, # 29
None, # 30
None, # 31
None, # 32
None, # 33
None, # 34
None, # 35
None, # 36
None, # 37
None, # 38
None, # 39
None, # 40
None, # 41
None, # 42
None, # 43
None, # 44
None, # 45
None, # 46
None, # 47
None, # 48
None, # 49
(50, TType.I32, 'errorID', None, -1, ), # 50
(51, TType.STRING, 'errorMsg', None, "", ), # 51
)
def __init__(self, feeds=None, count=thrift_spec[2][4], errorID=thrift_spec[50][4], errorMsg=thrift_spec[51][4],):
self.feeds = feeds
self.count = count
self.errorID = errorID
self.errorMsg = errorMsg
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.LIST:
self.feeds = []
(_etype45, _size42) = iprot.readListBegin()
for _i46 in xrange(_size42):
_elem47 = Feed()
_elem47.read(iprot)
self.feeds.append(_elem47)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.count = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 50:
if ftype == TType.I32:
self.errorID = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 51:
if ftype == TType.STRING:
self.errorMsg = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RtnFeeds')
if self.feeds is not None:
oprot.writeFieldBegin('feeds', TType.LIST, 1)
oprot.writeListBegin(TType.STRUCT, len(self.feeds))
for iter48 in self.feeds:
iter48.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.count is not None:
oprot.writeFieldBegin('count', TType.I32, 2)
oprot.writeI32(self.count)
oprot.writeFieldEnd()
if self.errorID is not None:
oprot.writeFieldBegin('errorID', TType.I32, 50)
oprot.writeI32(self.errorID)
oprot.writeFieldEnd()
if self.errorMsg is not None:
oprot.writeFieldBegin('errorMsg', TType.STRING, 51)
oprot.writeString(self.errorMsg)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.feeds is None:
raise TProtocol.TProtocolException(message='Required field feeds is unset!')
if self.count is None:
raise TProtocol.TProtocolException(message='Required field count is unset!')
if self.errorID is None:
raise TProtocol.TProtocolException(message='Required field errorID is unset!')
if self.errorMsg is None:
raise TProtocol.TProtocolException(message='Required field errorMsg is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.feeds)
value = (value * 31) ^ hash(self.count)
value = (value * 31) ^ hash(self.errorID)
value = (value * 31) ^ hash(self.errorMsg)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Notification:
"""
Attributes:
- stratID
- msgType
- msg
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'stratID', None, "", ), # 1
(2, TType.I32, 'msgType', None, None, ), # 2
(3, TType.STRING, 'msg', None, "", ), # 3
)
def __init__(self, stratID=thrift_spec[1][4], msgType=None, msg=thrift_spec[3][4],):
self.stratID = stratID
self.msgType = msgType
self.msg = msg
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.stratID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.msgType = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.msg = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Notification')
if self.stratID is not None:
oprot.writeFieldBegin('stratID', TType.STRING, 1)
oprot.writeString(self.stratID)
oprot.writeFieldEnd()
if self.msgType is not None:
oprot.writeFieldBegin('msgType', TType.I32, 2)
oprot.writeI32(self.msgType)
oprot.writeFieldEnd()
if self.msg is not None:
oprot.writeFieldBegin('msg', TType.STRING, 3)
oprot.writeString(self.msg)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.stratID is None:
raise TProtocol.TProtocolException(message='Required field stratID is unset!')
if self.msgType is None:
raise TProtocol.TProtocolException(message='Required field msgType is unset!')
if self.msg is None:
raise TProtocol.TProtocolException(message='Required field msg is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.stratID)
value = (value * 31) ^ hash(self.msgType)
value = (value * 31) ^ hash(self.msg)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class RspPullMsg:
"""
Attributes:
- notifications
- count
"""
thrift_spec = (
None, # 0
(1, TType.LIST, 'notifications', (TType.STRUCT,(Notification, Notification.thrift_spec)), None, ), # 1
(2, TType.I32, 'count', None, -1, ), # 2
)
def __init__(self, notifications=None, count=thrift_spec[2][4],):
self.notifications = notifications
self.count = count
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.LIST:
self.notifications = []
(_etype52, _size49) = iprot.readListBegin()
for _i53 in xrange(_size49):
_elem54 = Notification()
_elem54.read(iprot)
self.notifications.append(_elem54)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.count = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('RspPullMsg')
if self.notifications is not None:
oprot.writeFieldBegin('notifications', TType.LIST, 1)
oprot.writeListBegin(TType.STRUCT, len(self.notifications))
for iter55 in self.notifications:
iter55.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.count is not None:
oprot.writeFieldBegin('count', TType.I32, 2)
oprot.writeI32(self.count)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.notifications is None:
raise TProtocol.TProtocolException(message='Required field notifications is unset!')
if self.count is None:
raise TProtocol.TProtocolException(message='Required field count is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.notifications)
value = (value * 31) ^ hash(self.count)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Param:
"""
Attributes:
- name
- val
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'name', None, "", ), # 1
(2, TType.STRING, 'val', None, "", ), # 2
)
def __init__(self, name=thrift_spec[1][4], val=thrift_spec[2][4],):
self.name = name
self.val = val
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.name = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.val = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Param')
if self.name is not None:
oprot.writeFieldBegin('name', TType.STRING, 1)
oprot.writeString(self.name)
oprot.writeFieldEnd()
if self.val is not None:
oprot.writeFieldBegin('val', TType.STRING, 2)
oprot.writeString(self.val)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.name is None:
raise TProtocol.TProtocolException(message='Required field name is unset!')
if self.val is None:
raise TProtocol.TProtocolException(message='Required field val is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.name)
value = (value * 31) ^ hash(self.val)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Trigger:
"""
Attributes:
- stratID
- slotNum
- arg
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'stratID', None, "", ), # 1
(2, TType.I32, 'slotNum', None, -1, ), # 2
(3, TType.STRING, 'arg', None, "", ), # 3
)
def __init__(self, stratID=thrift_spec[1][4], slotNum=thrift_spec[2][4], arg=thrift_spec[3][4],):
self.stratID = stratID
self.slotNum = slotNum
self.arg = arg
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.stratID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.slotNum = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.arg = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Trigger')
if self.stratID is not None:
oprot.writeFieldBegin('stratID', TType.STRING, 1)
oprot.writeString(self.stratID)
oprot.writeFieldEnd()
if self.slotNum is not None:
oprot.writeFieldBegin('slotNum', TType.I32, 2)
oprot.writeI32(self.slotNum)
oprot.writeFieldEnd()
if self.arg is not None:
oprot.writeFieldBegin('arg', TType.STRING, 3)
oprot.writeString(self.arg)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.stratID is None:
raise TProtocol.TProtocolException(message='Required field stratID is unset!')
if self.slotNum is None:
raise TProtocol.TProtocolException(message='Required field slotNum is unset!')
if self.arg is None:
raise TProtocol.TProtocolException(message='Required field arg is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.stratID)
value = (value * 31) ^ hash(self.slotNum)
value = (value * 31) ^ hash(self.arg)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Settings:
"""
Attributes:
- fields
- count
"""
thrift_spec = (
None, # 0
(1, TType.LIST, 'fields', (TType.STRUCT,(Param, Param.thrift_spec)), None, ), # 1
(2, TType.I32, 'count', None, -1, ), # 2
)
def __init__(self, fields=None, count=thrift_spec[2][4],):
self.fields = fields
self.count = count
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.LIST:
self.fields = []
(_etype59, _size56) = iprot.readListBegin()
for _i60 in xrange(_size56):
_elem61 = Param()
_elem61.read(iprot)
self.fields.append(_elem61)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I32:
self.count = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Settings')
if self.fields is not None:
oprot.writeFieldBegin('fields', TType.LIST, 1)
oprot.writeListBegin(TType.STRUCT, len(self.fields))
for iter62 in self.fields:
iter62.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.count is not None:
oprot.writeFieldBegin('count', TType.I32, 2)
oprot.writeI32(self.count)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.fields is None:
raise TProtocol.TProtocolException(message='Required field fields is unset!')
if self.count is None:
raise TProtocol.TProtocolException(message='Required field count is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.fields)
value = (value * 31) ^ hash(self.count)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Status:
"""
Attributes:
- status
- stratID
"""
thrift_spec = (
None, # 0
(1, TType.I32, 'status', None, None, ), # 1
(2, TType.STRING, 'stratID', None, "", ), # 2
)
def __init__(self, status=None, stratID=thrift_spec[2][4],):
self.status = status
self.stratID = stratID
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I32:
self.status = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.stratID = iprot.readString();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Status')
if self.status is not None:
oprot.writeFieldBegin('status', TType.I32, 1)
oprot.writeI32(self.status)
oprot.writeFieldEnd()
if self.stratID is not None:
oprot.writeFieldBegin('stratID', TType.STRING, 2)
oprot.writeString(self.stratID)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.status is None:
raise TProtocol.TProtocolException(message='Required field status is unset!')
if self.stratID is None:
raise TProtocol.TProtocolException(message='Required field stratID is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.status)
value = (value * 31) ^ hash(self.stratID)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Position:
"""
Attributes:
- instrumentID
- stratID
- Long
- Short
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'instrumentID', None, "", ), # 1
(2, TType.STRING, 'stratID', None, "", ), # 2
(3, TType.I32, 'Long', None, -1, ), # 3
(4, TType.I32, 'Short', None, -1, ), # 4
)
def __init__(self, instrumentID=thrift_spec[1][4], stratID=thrift_spec[2][4], Long=thrift_spec[3][4], Short=thrift_spec[4][4],):
self.instrumentID = instrumentID
self.stratID = stratID
self.Long = Long
self.Short = Short
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.instrumentID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.stratID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.I32:
self.Long = iprot.readI32();
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.I32:
self.Short = iprot.readI32();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Position')
if self.instrumentID is not None:
oprot.writeFieldBegin('instrumentID', TType.STRING, 1)
oprot.writeString(self.instrumentID)
oprot.writeFieldEnd()
if self.stratID is not None:
oprot.writeFieldBegin('stratID', TType.STRING, 2)
oprot.writeString(self.stratID)
oprot.writeFieldEnd()
if self.Long is not None:
oprot.writeFieldBegin('Long', TType.I32, 3)
oprot.writeI32(self.Long)
oprot.writeFieldEnd()
if self.Short is not None:
oprot.writeFieldBegin('Short', TType.I32, 4)
oprot.writeI32(self.Short)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.instrumentID is None:
raise TProtocol.TProtocolException(message='Required field instrumentID is unset!')
if self.stratID is None:
raise TProtocol.TProtocolException(message='Required field stratID is unset!')
if self.Long is None:
raise TProtocol.TProtocolException(message='Required field Long is unset!')
if self.Short is None:
raise TProtocol.TProtocolException(message='Required field Short is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.instrumentID)
value = (value * 31) ^ hash(self.stratID)
value = (value * 31) ^ hash(self.Long)
value = (value * 31) ^ hash(self.Short)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
class Pnl:
"""
Attributes:
- instrumentID
- stratID
- pnl
"""
thrift_spec = (
None, # 0
(1, TType.STRING, 'instrumentID', None, "", ), # 1
(2, TType.STRING, 'stratID', None, "", ), # 2
(3, TType.DOUBLE, 'pnl', None, -1, ), # 3
)
def __init__(self, instrumentID=thrift_spec[1][4], stratID=thrift_spec[2][4], pnl=thrift_spec[3][4],):
self.instrumentID = instrumentID
self.stratID = stratID
self.pnl = pnl
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.instrumentID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.stratID = iprot.readString();
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.DOUBLE:
self.pnl = iprot.readDouble();
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
return
oprot.writeStructBegin('Pnl')
if self.instrumentID is not None:
oprot.writeFieldBegin('instrumentID', TType.STRING, 1)
oprot.writeString(self.instrumentID)
oprot.writeFieldEnd()
if self.stratID is not None:
oprot.writeFieldBegin('stratID', TType.STRING, 2)
oprot.writeString(self.stratID)
oprot.writeFieldEnd()
if self.pnl is not None:
oprot.writeFieldBegin('pnl', TType.DOUBLE, 3)
oprot.writeDouble(self.pnl)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
if self.instrumentID is None:
raise TProtocol.TProtocolException(message='Required field instrumentID is unset!')
if self.stratID is None:
raise TProtocol.TProtocolException(message='Required field stratID is unset!')
if self.pnl is None:
raise TProtocol.TProtocolException(message='Required field pnl is unset!')
return
def __hash__(self):
value = 17
value = (value * 31) ^ hash(self.instrumentID)
value = (value * 31) ^ hash(self.stratID)
value = (value * 31) ^ hash(self.pnl)
return value
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.iteritems()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
| 30.755938 | 540 | 0.624849 | 11,624 | 98,419 | 5.151755 | 0.028476 | 0.033064 | 0.027804 | 0.036671 | 0.850528 | 0.811803 | 0.792516 | 0.7843 | 0.729544 | 0.722898 | 0 | 0.033765 | 0.250704 | 98,419 | 3,199 | 541 | 30.765552 | 0.778276 | 0.027627 | 0 | 0.755242 | 1 | 0 | 0.060286 | 0.001107 | 0 | 0 | 0 | 0 | 0 | 1 | 0.060738 | false | 0 | 0.001446 | 0.015546 | 0.156182 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
b3f94bcfbce5a45394787e78434c314616eb16ae | 65,345 | py | Python | tests/frames.py | OpenStuder/openstuder-client-python | ade667116afcd084faed93febfa4e267972f5250 | [
"MIT"
] | null | null | null | tests/frames.py | OpenStuder/openstuder-client-python | ade667116afcd084faed93febfa4e267972f5250 | [
"MIT"
] | null | null | null | tests/frames.py | OpenStuder/openstuder-client-python | ade667116afcd084faed93febfa4e267972f5250 | [
"MIT"
] | null | null | null | import datetime
import random
import string
import unittest
# noinspection PyProtectedMember
from openstuder import _SIAbstractGatewayClient, SIAccessLevel, SIStatus, SIDescriptionFlags, SIWriteFlags, SIProtocolError
def random_int(start: int, end: int) -> int:
return random.randint(start, end)
def random_string(length: int) -> str:
return ''.join(random.choice(string.ascii_letters + string.digits + string.punctuation) for _ in range(length))
class AUTHORIZEFrame(unittest.TestCase):
def test_encode_without_credentials(self):
frame = _SIAbstractGatewayClient.encode_authorize_frame_without_credentials()
self.assertEqual('AUTHORIZE\nprotocol_version:1\n\n', frame)
def test_encode_with_credentials(self):
for _ in range(1000):
user = random_string(random_int(3, 32))
password = random_string(random_int(1, 64))
frame = _SIAbstractGatewayClient.encode_authorize_frame_with_credentials(user, password)
self.assertEqual(f'AUTHORIZE\nuser:{user}\npassword:{password}\nprotocol_version:1\n\n', frame)
class AUTHORIZEDFrame(unittest.TestCase):
def test_decode_basic(self):
access_level, gateway_version = _SIAbstractGatewayClient.decode_authorized_frame('AUTHORIZED\naccess_level:Basic\nprotocol_version:1\ngateway_version:0.0.0.348734\n\n')
self.assertEqual(SIAccessLevel.BASIC, access_level)
self.assertEqual('0.0.0.348734', gateway_version)
def test_decode_installer(self):
access_level, gateway_version = _SIAbstractGatewayClient.decode_authorized_frame('AUTHORIZED\naccess_level:Installer\nprotocol_version:1\ngateway_version:0.0.0.348734\n\n')
self.assertEqual(SIAccessLevel.INSTALLER, access_level)
self.assertEqual('0.0.0.348734', gateway_version)
def test_decode_expert(self):
access_level, gateway_version = _SIAbstractGatewayClient.decode_authorized_frame('AUTHORIZED\naccess_level:Expert\nprotocol_version:1\ngateway_version:0.0.0.348734\n\n')
self.assertEqual(SIAccessLevel.EXPERT, access_level)
self.assertEqual('0.0.0.348734', gateway_version)
def test_decode_qsp(self):
access_level, gateway_version = _SIAbstractGatewayClient.decode_authorized_frame('AUTHORIZED\naccess_level:QSP\nprotocol_version:1\ngateway_version:0.0.0.348734\n\n')
self.assertEqual(SIAccessLevel.QUALIFIED_SERVICE_PERSONNEL, access_level)
self.assertEqual('0.0.0.348734', gateway_version)
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_authorized_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_authorized_frame('AUTHORIZE\naccess_level:Basic\nprotocol_version:1\ngateway_version:0.0.0.348734\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_authorized_frame('AUTHORIZED\naccess_level:Basic\nprotocol_version:1\ngateway_version:0.0.0.348734\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_authorized_frame('AUTHORIZED\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_authorized_frame('AUTHORIZED')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_authorized_frame('AUTHORIZED\nprotocol_version:1\ngateway_version:0.0.0.348734\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_authorized_frame('AUTHORIZED\naccess_level:Basic\ngateway_version:0.0.0.348734\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_authorized_frame('AUTHORIZED\naccess_level:Basic\nprotocol_version:1\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_authorized_frame('AUTHORIZED\n\n')
class ENUMERATEFrame(unittest.TestCase):
def test_encode(self):
frame = _SIAbstractGatewayClient.encode_enumerate_frame()
self.assertEqual('ENUMERATE\n\n', frame)
class ENUMERATEDFrame(unittest.TestCase):
def test_decode_success(self):
for count in range(1000):
status, device_count = _SIAbstractGatewayClient.decode_enumerated_frame(f'ENUMERATED\nstatus:Success\ndevice_count:{count}\n\n')
self.assertEqual(SIStatus.SUCCESS, status)
self.assertEqual(count, device_count)
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_enumerated_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_enumerated_frame('ENUMRATED\nstatus:Success\ndevice_count:3\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_enumerated_frame('ENUMERATED\nstatus:Success\ndevice_count:3\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_enumerated_frame('ENUMERATED\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_enumerated_frame('ENUMERATED')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_enumerated_frame('ENUMERATED\ndevice_count:3\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_enumerated_frame('ENUMERATED\nstatus:Success\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_enumerated_frame('ENUMERATED\n\n')
def test_decode_in_progress(self):
status, device_count = _SIAbstractGatewayClient.decode_enumerated_frame(f'ENUMERATED\nstatus:InProgress\ndevice_count:0\n\n')
self.assertEqual(SIStatus.IN_PROGRESS, status)
self.assertEqual(0, device_count)
def test_decode_error(self):
status, device_count = _SIAbstractGatewayClient.decode_enumerated_frame(f'ENUMERATED\nstatus:Error\ndevice_count:0\n\n')
self.assertEqual(SIStatus.ERROR, status)
self.assertEqual(0, device_count)
def test_decode_no_property(self):
status, device_count = _SIAbstractGatewayClient.decode_enumerated_frame(f'ENUMERATED\nstatus:NoProperty\ndevice_count:0\n\n')
self.assertEqual(SIStatus.NO_PROPERTY, status)
self.assertEqual(0, device_count)
def test_decode_no_device(self):
status, device_count = _SIAbstractGatewayClient.decode_enumerated_frame(f'ENUMERATED\nstatus:NoDevice\ndevice_count:0\n\n')
self.assertEqual(SIStatus.NO_DEVICE, status)
self.assertEqual(0, device_count)
def test_decode_no_device_access(self):
status, device_count = _SIAbstractGatewayClient.decode_enumerated_frame(f'ENUMERATED\nstatus:NoDeviceAccess\ndevice_count:0\n\n')
self.assertEqual(SIStatus.NO_DEVICE_ACCESS, status)
self.assertEqual(0, device_count)
def test_decode_timeout(self):
status, device_count = _SIAbstractGatewayClient.decode_enumerated_frame(f'ENUMERATED\nstatus:Timeout\ndevice_count:0\n\n')
self.assertEqual(SIStatus.TIMEOUT, status)
self.assertEqual(0, device_count)
def test_decode_invalid_value(self):
status, device_count = _SIAbstractGatewayClient.decode_enumerated_frame(f'ENUMERATED\nstatus:InvalidValue\ndevice_count:0\n\n')
self.assertEqual(SIStatus.INVALID_VALUE, status)
self.assertEqual(0, device_count)
class DESCRIBEFrame(unittest.TestCase):
def test_encode(self):
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, None)
self.assertEqual('DESCRIBE\n\n', frame)
def test_encode_with_access_id(self):
for _ in range(1000):
access_id = random_string(random_int(3, 32))
frame = _SIAbstractGatewayClient.encode_describe_frame(access_id, None, None, None)
self.assertEqual(f'DESCRIBE\nid:{access_id}\n\n', frame)
def test_encode_with_device_id(self):
for _ in range(1000):
access_id = random_string(random_int(3, 32))
device_id = random_string(random_int(3, 32))
frame = _SIAbstractGatewayClient.encode_describe_frame(access_id, device_id, None, None)
self.assertEqual(f'DESCRIBE\nid:{access_id}.{device_id}\n\n', frame)
def test_encode_with_property_id(self):
for _ in range(1000):
access_id = random_string(random_int(3, 32))
device_id = random_string(random_int(3, 32))
property_id = random_int(0, 32000)
frame = _SIAbstractGatewayClient.encode_describe_frame(access_id, device_id, property_id, None)
self.assertEqual(f'DESCRIBE\nid:{access_id}.{device_id}.{property_id}\n\n', frame)
def test_encode_with_flags(self):
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_ACCESS_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludeAccessInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_DEVICE_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludeDeviceInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_PROPERTY_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludePropertyInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_DRIVER_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludeDriverInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_ACCESS_INFORMATION | SIDescriptionFlags.INCLUDE_DEVICE_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludeAccessInformation,IncludeDeviceInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_ACCESS_INFORMATION | SIDescriptionFlags.INCLUDE_PROPERTY_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludeAccessInformation,IncludePropertyInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_ACCESS_INFORMATION | SIDescriptionFlags.INCLUDE_DRIVER_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludeAccessInformation,IncludeDriverInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_DEVICE_INFORMATION | SIDescriptionFlags.INCLUDE_PROPERTY_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludeDeviceInformation,IncludePropertyInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_DEVICE_INFORMATION | SIDescriptionFlags.INCLUDE_DRIVER_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludeDeviceInformation,IncludeDriverInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_PROPERTY_INFORMATION | SIDescriptionFlags.INCLUDE_DRIVER_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludePropertyInformation,IncludeDriverInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_ACCESS_INFORMATION | SIDescriptionFlags.INCLUDE_DEVICE_INFORMATION |
SIDescriptionFlags.INCLUDE_PROPERTY_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludeAccessInformation,IncludeDeviceInformation,IncludePropertyInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_ACCESS_INFORMATION | SIDescriptionFlags.INCLUDE_DEVICE_INFORMATION |
SIDescriptionFlags.INCLUDE_DRIVER_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludeAccessInformation,IncludeDeviceInformation,IncludeDriverInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_ACCESS_INFORMATION | SIDescriptionFlags.INCLUDE_PROPERTY_INFORMATION |
SIDescriptionFlags.INCLUDE_DRIVER_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludeAccessInformation,IncludePropertyInformation,IncludeDriverInformation\n\n', frame)
frame = _SIAbstractGatewayClient.encode_describe_frame(None, None, None, SIDescriptionFlags.INCLUDE_DEVICE_INFORMATION | SIDescriptionFlags.INCLUDE_PROPERTY_INFORMATION |
SIDescriptionFlags.INCLUDE_DRIVER_INFORMATION)
self.assertEqual('DESCRIBE\nflags:IncludeDeviceInformation,IncludePropertyInformation,IncludeDriverInformation\n\n', frame)
def test_encode_complete(self):
for _ in range(1000):
access_id = random_string(random_int(3, 32))
device_id = random_string(random_int(3, 32))
property_id = random_int(0, 32000)
frame = _SIAbstractGatewayClient.encode_describe_frame(access_id, device_id, property_id, SIDescriptionFlags.INCLUDE_DEVICE_INFORMATION)
self.assertEqual(f'DESCRIBE\nid:{access_id}.{device_id}.{property_id}\nflags:IncludeDeviceInformation\n\n', frame)
class DESCRIPTIONFrame(unittest.TestCase):
def test_decode_success(self):
status, id_, body = _SIAbstractGatewayClient.decode_description_frame('DESCRIPTION\nstatus:Success\n\n{"a": "b"}')
self.assertEqual(SIStatus.SUCCESS, status)
self.assertIsNone(id_)
self.assertEqual({"a": "b"}, body)
def test_decode_error(self):
status, id_, body = _SIAbstractGatewayClient.decode_description_frame('DESCRIPTION\nstatus:Error\n\n')
self.assertEqual(SIStatus.ERROR, status)
self.assertIsNone(id_)
self.assertEqual({}, body)
def test_decode_with_access_id_success(self):
status, id_, body = _SIAbstractGatewayClient.decode_description_frame('DESCRIPTION\nstatus:Success\nid:demo\n\n{"a": "b"}')
self.assertEqual(SIStatus.SUCCESS, status)
self.assertEqual('demo', id_)
self.assertEqual({"a": "b"}, body)
def test_decode_with_access_id_error(self):
status, id_, body = _SIAbstractGatewayClient.decode_description_frame('DESCRIPTION\nstatus:Error\nid:demo\n\n')
self.assertEqual(SIStatus.ERROR, status)
self.assertEqual('demo', id_)
self.assertEqual({}, body)
def test_decode_with_device_id_success(self):
status, id_, body = _SIAbstractGatewayClient.decode_description_frame('DESCRIPTION\nstatus:Success\nid:demo.inv\n\n{"a": "b"}')
self.assertEqual(SIStatus.SUCCESS, status)
self.assertEqual('demo.inv', id_)
self.assertEqual({"a": "b"}, body)
def test_decode_with_device_id_error(self):
status, id_, body = _SIAbstractGatewayClient.decode_description_frame('DESCRIPTION\nstatus:Error\nid:demo.bat\n\n')
self.assertEqual(SIStatus.ERROR, status)
self.assertEqual('demo.bat', id_)
self.assertEqual({}, body)
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_description_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_description_frame('DSCRIPTION\nstatus:Success\n\n{"a": "b"}')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_description_frame('DESCRIPTION\nstatus:Success\n{"a": "b"}')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_description_frame('DESCRIPTION\nstatus:Success\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_description_frame('DESCRIPTION\n\n{"a": "b"}')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_description_frame('DESCRIPTION\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_description_frame('DESCRIPTION\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_description_frame('DESCRIPTION')
class READPROPERTYFrame(unittest.TestCase):
def test_encode(self):
frame = _SIAbstractGatewayClient.encode_read_property_frame('demo.inv.3136')
self.assertEqual('READ PROPERTY\nid:demo.inv.3136\n\n', frame)
class PROPERTYREADFrame(unittest.TestCase):
def test_decode_success_float(self):
result = _SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\nstatus:Success\nid:demo.inv.3136\nvalue:0.123\n\n')
self.assertEqual(SIStatus.SUCCESS, result.status)
self.assertEqual('demo.inv.3136', result.id)
self.assertEqual(0.123, result.value)
def test_decode_success_false(self):
result = _SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\nstatus:Success\nid:demo.inv.3136\nvalue:false\n\n')
self.assertEqual(SIStatus.SUCCESS, result.status)
self.assertEqual('demo.inv.3136', result.id)
self.assertEqual(False, result.value)
def test_decode_success_true(self):
result = _SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\nstatus:Success\nid:demo.inv.3136\nvalue:true\n\n')
self.assertEqual(SIStatus.SUCCESS, result.status)
self.assertEqual('demo.inv.3136', result.id)
self.assertEqual(True, result.value)
def test_decode_error(self):
result = _SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\nstatus:Error\nid:demo.inv.3136\n\n')
self.assertEqual(SIStatus.ERROR, result.status)
self.assertEqual('demo.inv.3136', result.id)
self.assertIsNone(result.value)
def test_decode_no_property(self):
result = _SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\nstatus:NoProperty\nid:demo.inv.3136\n\n')
self.assertEqual(SIStatus.NO_PROPERTY, result.status)
self.assertEqual('demo.inv.3136', result.id)
self.assertIsNone(result.value)
def test_decode_no_device(self):
result = _SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\nstatus:NoDevice\nid:demo.inv.3136\n\n')
self.assertEqual(SIStatus.NO_DEVICE, result.status)
self.assertEqual('demo.inv.3136', result.id)
self.assertIsNone(result.value)
def test_decode_no_device_access(self):
result = _SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\nstatus:NoDeviceAccess\nid:demo.inv.3136\n\n')
self.assertEqual(SIStatus.NO_DEVICE_ACCESS, result.status)
self.assertEqual('demo.inv.3136', result.id)
self.assertIsNone(result.value)
def test_decode_timeout(self):
result = _SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\nstatus:Timeout\nid:demo.inv.3136\n\n')
self.assertEqual(SIStatus.TIMEOUT, result.status)
self.assertEqual('demo.inv.3136', result.id)
self.assertIsNone(result.value)
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_property_read_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_read_frame('PROPRTY READ\nstatus:Success\nid:demo.inv.3136\nvalue:0.123\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\nstatus:Success\nid:demo.inv.3136\nvalue:0.123\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\nstatus:Success\nvalue:0.123\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\nid:demo.inv.3136\nvalue:0.123\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\nvalue:0.123\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_read_frame('PROPERTY READ')
class READPROPERTIESFrame(unittest.TestCase):
def test_encode(self):
frame = _SIAbstractGatewayClient.encode_read_properties_frame(['demo.inv.3136', 'demo.inv.3137'])
self.assertEqual('READ PROPERTIES\n\n["demo.inv.3136", "demo.inv.3137"]', frame)
class PROPERTIESREADFrame(unittest.TestCase):
def test_decode_success_float(self):
results = _SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n\n[{"status": "Success", "id": "demo.inv.3136", "value": 0.123}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.SUCCESS, results[0].status)
self.assertEqual('demo.inv.3136', results[0].id)
self.assertEqual(0.123, results[0].value)
def test_decode_success_false(self):
results = _SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n\n[{"status": "Success", "id": "demo.inv.3136", "value": false}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.SUCCESS, results[0].status)
self.assertEqual('demo.inv.3136', results[0].id)
self.assertEqual(False, results[0].value)
def test_decode_success_true(self):
results = _SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n\n[{"status": "Success", "id": "demo.inv.3136", "value": true}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.SUCCESS, results[0].status)
self.assertEqual('demo.inv.3136', results[0].id)
self.assertEqual(True, results[0].value)
def test_decode_success_multiple(self):
results = _SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n\n[{"status": "Success", "id": "demo.inv.3136", "value": true}, '
'{"status": "Success", "id": "demo.inv.3137", "value": 0}]')
self.assertEqual(2, len(results))
self.assertEqual(SIStatus.SUCCESS, results[0].status)
self.assertEqual('demo.inv.3136', results[0].id)
self.assertEqual(True, results[0].value)
self.assertEqual(SIStatus.SUCCESS, results[1].status)
self.assertEqual('demo.inv.3137', results[1].id)
self.assertEqual(0, results[1].value)
def test_decode_error(self):
results = _SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n\n[{"status": "Error", "id": "demo.inv.3136"}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.ERROR, results[0].status)
self.assertEqual('demo.inv.3136', results[0].id)
self.assertIsNone(results[0].value)
def test_decode_no_property(self):
results = _SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n\n[{"status": "NoProperty", "id": "demo.inv.3136"}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.NO_PROPERTY, results[0].status)
self.assertEqual('demo.inv.3136', results[0].id)
self.assertIsNone(results[0].value)
def test_decode_no_device(self):
results = _SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n\n[{"status": "NoDevice", "id": "demo.inv.3136"}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.NO_DEVICE, results[0].status)
self.assertEqual('demo.inv.3136', results[0].id)
self.assertIsNone(results[0].value)
def test_decode_no_device_access(self):
results = _SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n\n[{"status": "NoDeviceAccess", "id": "demo.inv.3136"}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.NO_DEVICE_ACCESS, results[0].status)
self.assertEqual('demo.inv.3136', results[0].id)
self.assertIsNone(results[0].value)
def test_decode_timeout(self):
results = _SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n\n[{"status": "Timeout", "id": "demo.inv.3136"}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.TIMEOUT, results[0].status)
self.assertEqual('demo.inv.3136', results[0].id)
self.assertIsNone(results[0].value)
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_properties_read_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPRTIES READ\nstatus:Success\n\n[]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n[]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n\n[{"status": "Success", "value": 0.123}]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n\n[{"id": "demo.inv.3136", "value": 0.123}]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\nstatus:Success\n\n[{"value": 0.123}]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES READ')
class WRITEPROPERTYFrame(unittest.TestCase):
def test_encode_without_value(self):
frame = _SIAbstractGatewayClient.encode_write_property_frame('demo.inv.1415', None, None)
self.assertEqual('WRITE PROPERTY\nid:demo.inv.1415\n\n', frame)
def test_encode_with_value(self):
frame = _SIAbstractGatewayClient.encode_write_property_frame('demo.inv.3333', 42.24, None)
self.assertEqual('WRITE PROPERTY\nid:demo.inv.3333\nvalue:42.24\n\n', frame)
def test_encode_with_value_empty_flags(self):
frame = _SIAbstractGatewayClient.encode_write_property_frame('demo.inv.3333', 42.24, SIWriteFlags.NONE)
self.assertEqual('WRITE PROPERTY\nid:demo.inv.3333\nflags:\nvalue:42.24\n\n', frame)
def test_encode_with_value_permanent_flag(self):
frame = _SIAbstractGatewayClient.encode_write_property_frame('demo.inv.3333', 42.24, SIWriteFlags.PERMANENT)
self.assertEqual('WRITE PROPERTY\nid:demo.inv.3333\nflags:Permanent\nvalue:42.24\n\n', frame)
class PROPERTYWRITTENFrame(unittest.TestCase):
def test_decode_success(self):
status, id_ = _SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITTEN\nstatus:Success\nid:demo.inv.1399\n\n')
self.assertEqual(SIStatus.SUCCESS, status)
self.assertEqual('demo.inv.1399', id_)
def test_decode_error(self):
status, id_ = _SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITTEN\nstatus:Error\nid:demo.inv.1399\n\n')
self.assertEqual(SIStatus.ERROR, status)
self.assertEqual('demo.inv.1399', id_)
def test_decode_no_property(self):
status, id_ = _SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITTEN\nstatus:NoProperty\nid:demo.inv.1399\n\n')
self.assertEqual(SIStatus.NO_PROPERTY, status)
self.assertEqual('demo.inv.1399', id_)
def test_decode_no_device(self):
status, id_ = _SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITTEN\nstatus:NoDevice\nid:demo.inv.1399\n\n')
self.assertEqual(SIStatus.NO_DEVICE, status)
self.assertEqual('demo.inv.1399', id_)
def test_decode_no_device_access(self):
status, id_ = _SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITTEN\nstatus:NoDeviceAccess\nid:demo.inv.1399\n\n')
self.assertEqual(SIStatus.NO_DEVICE_ACCESS, status)
self.assertEqual('demo.inv.1399', id_)
def test_decode_timeout(self):
status, id_ = _SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITTEN\nstatus:Timeout\nid:demo.inv.1399\n\n')
self.assertEqual(SIStatus.TIMEOUT, status)
self.assertEqual('demo.inv.1399', id_)
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_property_written_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITEN\nstatus:Success\nid:demo.inv.1399\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITTEN\nstatus:Success\nid:demo.inv.1399\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITTEN\nstatus:Success\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITTEN\nid:demo.inv.1399\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITTEN\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITTEN\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_written_frame('PROPERTY WRITTEN')
class SUBSCRIBEPROPERTYFrame(unittest.TestCase):
def test_encode(self):
frame = _SIAbstractGatewayClient.encode_subscribe_property_frame('demo.bat.7003')
self.assertEqual('SUBSCRIBE PROPERTY\nid:demo.bat.7003\n\n', frame)
class PROPERTYSUBSCRIBEDFrame(unittest.TestCase):
def test_decode_success(self):
status, id_ = _SIAbstractGatewayClient.decode_property_subscribed_frame('PROPERTY SUBSCRIBED\nstatus:Success\nid:demo.bat.7003\n\n')
self.assertEqual(SIStatus.SUCCESS, status)
self.assertEqual('demo.bat.7003', id_)
def test_decode_error(self):
status, id_ = _SIAbstractGatewayClient.decode_property_subscribed_frame('PROPERTY SUBSCRIBED\nstatus:Error\nid:demo.bat.7003\n\n')
self.assertEqual(SIStatus.ERROR, status)
self.assertEqual('demo.bat.7003', id_)
def test_decode_no_property(self):
status, id_ = _SIAbstractGatewayClient.decode_property_subscribed_frame('PROPERTY SUBSCRIBED\nstatus:NoProperty\nid:demo.bat.7003\n\n')
self.assertEqual(SIStatus.NO_PROPERTY, status)
self.assertEqual('demo.bat.7003', id_)
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_property_subscribed_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_subscribed_frame('PROPERTY SUBSCIBED\nstatus:Success\nid:demo.bat.7003\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_subscribed_frame('PROPERTY SUBSCRIBED\nstatus:Success\nid:demo.bat.7003\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_subscribed_frame('PROPERTY SUBSCRIBED\nstatus:Success\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_subscribed_frame('PROPERTY SUBSCRIBED\nid:demo.bat.7003\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_subscribed_frame('PROPERTY SUBSCRIBED\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_subscribed_frame('PROPERTY SUBSCRIBED\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_subscribed_frame('PROPERTY SUBSCRIBED')
class SUBSCRIBEPROPERTIESFrame(unittest.TestCase):
def test_encode(self):
frame = _SIAbstractGatewayClient.encode_subscribe_properties_frame(['demo.bat.7003', 'demo.bat.7004'])
self.assertEqual('SUBSCRIBE PROPERTIES\n\n["demo.bat.7003", "demo.bat.7004"]', frame)
class PROPERTIESSUBSCRIBEDFrame(unittest.TestCase):
def test_decode_success(self):
results = _SIAbstractGatewayClient.decode_properties_subscribed_frame('PROPERTIES SUBSCRIBED\nstatus:Success\n\n[{"status": "Success", "id": "demo.bat.7003"}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.SUCCESS, results[0].status)
self.assertEqual('demo.bat.7003', results[0].id)
def test_decode_multiple(self):
results = _SIAbstractGatewayClient.decode_properties_subscribed_frame('PROPERTIES SUBSCRIBED\nstatus:Success\n\n[{"status": "Success", "id": "demo.bat.7003"}, {"status": '
'"Error", "id": "demo.bat.7004"}]')
self.assertEqual(2, len(results))
self.assertEqual(SIStatus.SUCCESS, results[0].status)
self.assertEqual('demo.bat.7003', results[0].id)
self.assertEqual(SIStatus.ERROR, results[1].status)
self.assertEqual('demo.bat.7004', results[1].id)
def test_decode_error(self):
results = _SIAbstractGatewayClient.decode_properties_subscribed_frame('PROPERTIES SUBSCRIBED\nstatus:Success\n\n[{"status": "Error", "id": "demo.bat.7003"}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.ERROR, results[0].status)
self.assertEqual('demo.bat.7003', results[0].id)
def test_decode_no_property(self):
results = _SIAbstractGatewayClient.decode_properties_subscribed_frame('PROPERTIES SUBSCRIBED\nstatus:Success\n\n[{"status": "NoProperty", "id": "demo.bat.7003"}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.NO_PROPERTY, results[0].status)
self.assertEqual('demo.bat.7003', results[0].id)
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_properties_subscribed_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_subscribed_frame('PROPERTIES SUBSCIBED\nstatus:Success\n\n[]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_subscribed_frame('PROPERTIES SUBSCRIBED\nstatus:Success\n[{"status": "Success", "id": "demo.bat.7003"}]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_subscribed_frame('PROPERTIES SUBSCRIBED\nstatus:Success\n[{"status": "Success"}]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_subscribed_frame('PROPERTIES SUBSCRIBED\nstatus:Success\n[{"id": "demo.bat.7003"}]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_subscribed_frame('PROPERTIES SUBSCRIBED\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_subscribed_frame('PROPERTIES SUBSCRIBED\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_subscribed_frame('PROPERTIES SUBSCRIBED')
class PROPERTYUPDATEFrame(unittest.TestCase):
def test_decode_float(self):
id_, value = _SIAbstractGatewayClient.decode_property_update_frame('PROPERTY UPDATE\nid:demo.bat.7003\nvalue:3.874\n\n')
self.assertEqual('demo.bat.7003', id_)
self.assertEqual(3.874, value)
def test_decode_false(self):
id_, value = _SIAbstractGatewayClient.decode_property_update_frame('PROPERTY UPDATE\nid:demo.bat.7003\nvalue:false\n\n')
self.assertEqual('demo.bat.7003', id_)
self.assertEqual(False, value)
def test_decode_true(self):
id_, value = _SIAbstractGatewayClient.decode_property_update_frame('PROPERTY UPDATE\nid:demo.bat.7003\nvalue:true\n\n')
self.assertEqual('demo.bat.7003', id_)
self.assertEqual(True, value)
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_property_update_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_update_frame('PROPRTY UPDATE\nid:demo.bat.7003\nvalue:3.874\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_update_frame('PROPERTY UPDATE\nid:demo.bat.7003\nvalue:3.874\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_update_frame('PROPERTY UPDATE\nid:demo.bat.7003\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_update_frame('PROPERTY UPDATE\nvalue:3.874\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_update_frame('PROPERTY UPDATE\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_update_frame('PROPERTY UPDATE\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_update_frame('PROPERTY UPDATE')
class UNSUBSCRIBEPROPERTYFrame(unittest.TestCase):
def test_encode(self):
frame = _SIAbstractGatewayClient.encode_unsubscribe_property_frame('demo.bat.7003')
self.assertEqual('UNSUBSCRIBE PROPERTY\nid:demo.bat.7003\n\n', frame)
class PROPERTYUNSUBSCRIBEDFrame(unittest.TestCase):
def test_decode_success(self):
status, id_ = _SIAbstractGatewayClient.decode_property_unsubscribed_frame('PROPERTY UNSUBSCRIBED\nstatus:Success\nid:demo.bat.7003\n\n')
self.assertEqual(SIStatus.SUCCESS, status)
self.assertEqual('demo.bat.7003', id_)
def test_decode_error(self):
status, id_ = _SIAbstractGatewayClient.decode_property_unsubscribed_frame('PROPERTY UNSUBSCRIBED\nstatus:Error\nid:demo.bat.7003\n\n')
self.assertEqual(SIStatus.ERROR, status)
self.assertEqual('demo.bat.7003', id_)
def test_decode_no_property(self):
status, id_ = _SIAbstractGatewayClient.decode_property_unsubscribed_frame('PROPERTY UNSUBSCRIBED\nstatus:NoProperty\nid:demo.bat.7003\n\n')
self.assertEqual(SIStatus.NO_PROPERTY, status)
self.assertEqual('demo.bat.7003', id_)
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_property_unsubscribed_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_unsubscribed_frame('PROPERTY UNSUBSCIBED\nstatus:Success\nid:demo.bat.7003\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_unsubscribed_frame('PROPERTY SUNUBSCRIBED\nstatus:Success\nid:demo.bat.7003\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_unsubscribed_frame('PROPERTY UNSUBSCRIBED\nstatus:Success\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_unsubscribed_frame('PROPERTY UNSUBSCRIBED\nid:demo.bat.7003\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_unsubscribed_frame('PROPERTY UNSUBSCRIBED\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_unsubscribed_frame('PROPERTY UNSUBSCRIBED\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_property_unsubscribed_frame('PROPERTY UNSUBSCRIBED')
class UNSUBSCRIBEPROPERTIESFrame(unittest.TestCase):
def test_encode(self):
frame = _SIAbstractGatewayClient.encode_unsubscribe_properties_frame(['demo.bat.7003', 'demo.bat.7004'])
self.assertEqual('UNSUBSCRIBE PROPERTIES\n\n["demo.bat.7003", "demo.bat.7004"]', frame)
class PROPERTIESUNSUBSCRIBEDFrame(unittest.TestCase):
def test_decode_success(self):
results = _SIAbstractGatewayClient.decode_properties_unsubscribed_frame('PROPERTIES UNSUBSCRIBED\nstatus:Success\n\n[{"status": "Success", "id": "demo.bat.7003"}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.SUCCESS, results[0].status)
self.assertEqual('demo.bat.7003', results[0].id)
def test_decode_multiple(self):
results = _SIAbstractGatewayClient.decode_properties_unsubscribed_frame('PROPERTIES UNSUBSCRIBED\nstatus:Success\n\n[{"status": "Success", "id": "demo.bat.7003"}, '
'{"status": "Error", "id": "demo.bat.7004"}]')
self.assertEqual(2, len(results))
self.assertEqual(SIStatus.SUCCESS, results[0].status)
self.assertEqual('demo.bat.7003', results[0].id)
self.assertEqual(SIStatus.ERROR, results[1].status)
self.assertEqual('demo.bat.7004', results[1].id)
def test_decode_error(self):
results = _SIAbstractGatewayClient.decode_properties_unsubscribed_frame('PROPERTIES UNSUBSCRIBED\nstatus:Success\n\n[{"status": "Error", "id": "demo.bat.7003"}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.ERROR, results[0].status)
self.assertEqual('demo.bat.7003', results[0].id)
def test_decode_no_property(self):
results = _SIAbstractGatewayClient.decode_properties_unsubscribed_frame('PROPERTIES UNSUBSCRIBED\nstatus:Success\n\n[{"status": "NoProperty", "id": "demo.bat.7003"}]')
self.assertEqual(1, len(results))
self.assertEqual(SIStatus.NO_PROPERTY, results[0].status)
self.assertEqual('demo.bat.7003', results[0].id)
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_properties_unsubscribed_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_unsubscribed_frame('PROPERTIES UNSUBSCIBED\nstatus:Success\n\n[]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_unsubscribed_frame('PROPERTIES UNSUBSCRIBED\nstatus:Success\n[{"status": "Success", "id": "demo.bat.7003"}]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_unsubscribed_frame('PROPERTIES UNSUBSCRIBED\nstatus:Success\n[{"status": "Success"}]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_unsubscribed_frame('PROPERTIES UNSUBSCRIBED\nstatus:Success\n[{"id": "demo.bat.7003"}]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_unsubscribed_frame('PROPERTIES UNSUBSCRIBED\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_unsubscribed_frame('PROPERTIES UNSUBSCRIBED\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_unsubscribed_frame('PROPERTIES UNSUBSCRIBED')
class READDATALOGFrame(unittest.TestCase):
def test_encode_property_list(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame(None, None, None, None)
self.assertEqual('READ DATALOG\n\n', frame)
def test_encode_property_list_from_date(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame(None, datetime.datetime(year=1987, month=12, day=19), None, None)
self.assertEqual('READ DATALOG\nfrom:1987-12-19T00:00:00\n\n', frame)
def test_encode_property_list_from_datetime(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame(None, datetime.datetime(year=1987, month=12, day=19, hour=13, minute=10, second=30), None, None)
self.assertEqual('READ DATALOG\nfrom:1987-12-19T13:10:30\n\n', frame)
def test_encode_property_list_to_date(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame(None, None, datetime.datetime(year=1987, month=12, day=19), None)
self.assertEqual('READ DATALOG\nto:1987-12-19T00:00:00\n\n', frame)
def test_encode_property_list_to_datetime(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame(None, None, datetime.datetime(year=1987, month=12, day=19, hour=13, minute=10, second=30), None)
self.assertEqual('READ DATALOG\nto:1987-12-19T13:10:30\n\n', frame)
def test_encode_property_list_from_to(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame(None, datetime.datetime(year=1987, month=12, day=19, hour=13, minute=10, second=30),
datetime.datetime(year=1987, month=12, day=20, hour=13, minute=10, second=30), None)
self.assertEqual('READ DATALOG\nfrom:1987-12-19T13:10:30\nto:1987-12-20T13:10:30\n\n', frame)
def test_encode_minimal(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame('demo.inv.3137', None, None, None)
self.assertEqual('READ DATALOG\nid:demo.inv.3137\n\n', frame)
def test_encode_from_date(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame('demo.inv.3137', datetime.datetime(year=1987, month=12, day=19), None, None)
self.assertEqual('READ DATALOG\nid:demo.inv.3137\nfrom:1987-12-19T00:00:00\n\n', frame)
def test_encode_from_datetime(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame('demo.inv.3137', datetime.datetime(year=1987, month=12, day=19, hour=13, minute=10, second=30), None, None)
self.assertEqual('READ DATALOG\nid:demo.inv.3137\nfrom:1987-12-19T13:10:30\n\n', frame)
def test_encode_to_date(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame('demo.inv.3137', None, datetime.datetime(year=1987, month=12, day=19), None)
self.assertEqual('READ DATALOG\nid:demo.inv.3137\nto:1987-12-19T00:00:00\n\n', frame)
def test_encode_to_datetime(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame('demo.inv.3137', None, datetime.datetime(year=1987, month=12, day=19, hour=13, minute=10, second=30), None)
self.assertEqual('READ DATALOG\nid:demo.inv.3137\nto:1987-12-19T13:10:30\n\n', frame)
def test_encode_limit(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame('demo.inv.3137', None, None, 42)
self.assertEqual('READ DATALOG\nid:demo.inv.3137\nlimit:42\n\n', frame)
def test_encode_from_to(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame('demo.inv.3137', datetime.datetime(year=1987, month=12, day=19, hour=13, minute=10, second=30),
datetime.datetime(year=1987, month=12, day=20, hour=13, minute=10, second=30), None)
self.assertEqual('READ DATALOG\nid:demo.inv.3137\nfrom:1987-12-19T13:10:30\nto:1987-12-20T13:10:30\n\n', frame)
def test_encode_complete(self):
frame = _SIAbstractGatewayClient.encode_read_datalog_frame('demo.inv.3137', datetime.datetime(year=1987, month=12, day=19, hour=13, minute=10, second=30),
datetime.datetime(year=1987, month=12, day=20, hour=13, minute=10, second=30), 13)
self.assertEqual('READ DATALOG\nid:demo.inv.3137\nfrom:1987-12-19T13:10:30\nto:1987-12-20T13:10:30\nlimit:13\n\n', frame)
class DATALOGREADFrame(unittest.TestCase):
def test_decode_property_list(self):
status, id_, count, properties = _SIAbstractGatewayClient.decode_datalog_read_frame('DATALOG READ\nstatus:Success\ncount:2\n\ndemo.bat.7003\ndemo.inv.3136')
self.assertEqual(SIStatus.SUCCESS, status)
self.assertEqual(None, id_)
self.assertEqual(2, count)
self.assertEqual('demo.bat.7003\ndemo.inv.3136', properties)
def test_decode_success(self):
status, id_, count, csv = _SIAbstractGatewayClient.decode_datalog_read_frame('DATALOG READ\nstatus:Success\nid:demo.bat.7003\ncount:2\n\n2021-02-07T20:18:00,0.03145\n2021-02-07T20:17:00,0.84634')
self.assertEqual(SIStatus.SUCCESS, status)
self.assertEqual('demo.bat.7003', id_)
self.assertEqual(2, count)
self.assertEqual('2021-02-07T20:18:00,0.03145\n2021-02-07T20:17:00,0.84634', csv)
def test_decode_error(self):
status, id_, count, csv = _SIAbstractGatewayClient.decode_datalog_read_frame('DATALOG READ\nstatus:Error\nid:demo.bat.7003\ncount:0\n\n')
self.assertEqual(SIStatus.ERROR, status)
self.assertEqual('demo.bat.7003', id_)
self.assertEqual(0, count)
self.assertEqual('', csv)
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_datalog_read_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_datalog_read_frame('DATLOG READ\nstatus:Success\nid:demo.bat.7003\ncount:2\n\n2021-02-07T20:18:00,0.03145\n2021-02-07T20:17:00,0.84634')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_datalog_read_frame('DATALOG READ\nstatus:Success\nid:demo.bat.7003\ncount:2\n2021-02-07T20:18:00,0.03145\n2021-02-07T20:17:00,0.84634')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_datalog_read_frame('DATALOG READ\nstatus:Success\nid:demo.bat.7003\n\n2021-02-07T20:18:00,0.03145\n2021-02-07T20:17:00,0.84634')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_datalog_read_frame('DATALOG READ\nid:demo.bat.7003\ncount:2\n\n2021-02-07T20:18:00,0.03145\n2021-02-07T20:17:00,0.84634')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_datalog_read_frame('DATALOG READ\ncount:2\n\n2021-02-07T20:18:00,0.03145\n2021-02-07T20:17:00,0.84634')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_datalog_read_frame('DATALOG READ\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_datalog_read_frame('DATALOG READ\n')
class DEVICEMESSAGEFrame(unittest.TestCase):
def test_decode(self):
message = _SIAbstractGatewayClient.decode_device_message_frame('DEVICE MESSAGE\ntimestamp:2020-01-01T00:00:00\naccess_id:A303\ndevice_id:11\nmessage_id:210\nmessage:AUX2 relay deactivation\n\n')
self.assertEqual(datetime.datetime(year=2020, month=1, day=1), message.timestamp)
self.assertEqual('A303', message.access_id)
self.assertEqual('11', message.device_id)
self.assertEqual('210', message.message_id)
self.assertEqual('AUX2 relay deactivation', message.message)
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_device_message_frame('DEVICE MESAGE\ntimestamp:2020-01-01T00:00:00\naccess_id:A303\ndevice_id:11\nmessage_id:210\nmessage:AUX2 relay deactivation\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_device_message_frame('DEVICE MESSAGE\ntimestamp:2020-01-01T00:00:00\naccess_id:A303\ndevice_id:11\nmessage_id:210\nmessage:AUX2 relay deactivation\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_device_message_frame('DEVICE MESSAGE\ntimestamp:2020-01-01T00:00:00\naccess_id:A303\ndevice_id:11\nmessage_id:210\nmessage:AUX2 relay deactivation')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_device_message_frame('DEVICE MESSAGE\naccess_id:A303\ndevice_id:11\nmessage_id:210\nmessage:AUX2 relay deactivation\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_device_message_frame('DEVICE MESSAGE\ntimestamp:2020-01-01T00:00:00\ndevice_id:11\nmessage_id:210\nmessage:AUX2 relay deactivation\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_device_message_frame('DEVICE MESSAGE\ntimestamp:2020-01-01T00:00:00\naccess_id:A303\nmessage_id:210\nmessage:AUX2 relay deactivation\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_device_message_frame('DEVICE MESSAGE\ntimestamp:2020-01-01T00:00:00\naccess_id:A303\ndevice_id:11\nmessage:AUX2 relay deactivation\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_device_message_frame('DEVICE MESSAGE\ntimestamp:2020-01-01T00:00:00\naccess_id:A303\ndevice_id:11\nmessage_id:210\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_device_message_frame('DEVICE MESSAGE\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_device_message_frame('DEVICE MESSAGE\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_device_message_frame('DEVICE MESSAGE')
class READMESSAGESFrame(unittest.TestCase):
def test_encode_minimal(self):
frame = _SIAbstractGatewayClient.encode_read_messages_frame(None, None, None)
self.assertEqual('READ MESSAGES\n\n', frame)
def test_encode_from_date(self):
frame = _SIAbstractGatewayClient.encode_read_messages_frame(datetime.datetime(year=1987, month=12, day=19), None, None)
self.assertEqual('READ MESSAGES\nfrom:1987-12-19T00:00:00\n\n', frame)
def test_encode_from_datetime(self):
frame = _SIAbstractGatewayClient.encode_read_messages_frame(datetime.datetime(year=1987, month=12, day=19, hour=13, minute=10, second=30), None, None)
self.assertEqual('READ MESSAGES\nfrom:1987-12-19T13:10:30\n\n', frame)
def test_encode_to_date(self):
frame = _SIAbstractGatewayClient.encode_read_messages_frame(None, datetime.datetime(year=1987, month=12, day=19), None)
self.assertEqual('READ MESSAGES\nto:1987-12-19T00:00:00\n\n', frame)
def test_encode_to_datetime(self):
frame = _SIAbstractGatewayClient.encode_read_messages_frame(None, datetime.datetime(year=1987, month=12, day=19, hour=13, minute=10, second=30), None)
self.assertEqual('READ MESSAGES\nto:1987-12-19T13:10:30\n\n', frame)
def test_encode_limit(self):
frame = _SIAbstractGatewayClient.encode_read_messages_frame(None, None, 42)
self.assertEqual('READ MESSAGES\nlimit:42\n\n', frame)
def test_encode_from_to(self):
frame = _SIAbstractGatewayClient.encode_read_messages_frame(datetime.datetime(year=1987, month=12, day=19, hour=13, minute=10, second=30),
datetime.datetime(year=1987, month=12, day=20, hour=13, minute=10, second=30), None)
self.assertEqual('READ MESSAGES\nfrom:1987-12-19T13:10:30\nto:1987-12-20T13:10:30\n\n', frame)
def test_encode_complete(self):
frame = _SIAbstractGatewayClient.encode_read_messages_frame(datetime.datetime(year=1987, month=12, day=19, hour=13, minute=10, second=30),
datetime.datetime(year=1987, month=12, day=20, hour=13, minute=10, second=30), 13)
self.assertEqual('READ MESSAGES\nfrom:1987-12-19T13:10:30\nto:1987-12-20T13:10:30\nlimit:13\n\n', frame)
class MESSAGESREADFrame(unittest.TestCase):
def test_decode_success(self):
status, count, messages = _SIAbstractGatewayClient.decode_messages_read_frame("""MESSAGES READ
status:Success
count:2
[
{
"access_id": "demo",
"device_id": "inv",
"message": "AUX2 relay activation",
"message_id": 209,
"timestamp": "2020-01-01T00:00:00Z"
},
{
"access_id": "demo",
"device_id": "inv",
"message": "AUX2 relay deactivation",
"message_id": 210,
"timestamp": "2020-01-01T00:15:00Z"
}
]""")
self.assertEqual(SIStatus.SUCCESS, status)
self.assertEqual(2, count)
self.assertEqual(datetime.datetime(year=2020, month=1, day=1, tzinfo=datetime.timezone.utc), messages[0].timestamp)
self.assertEqual('demo', messages[0].access_id)
self.assertEqual('inv', messages[0].device_id)
self.assertEqual(209, messages[0].message_id)
self.assertEqual('AUX2 relay activation', messages[0].message)
self.assertEqual(datetime.datetime(year=2020, month=1, day=1, hour=0, minute=15, tzinfo=datetime.timezone.utc), messages[1].timestamp)
self.assertEqual('demo', messages[1].access_id)
self.assertEqual('inv', messages[1].device_id)
self.assertEqual(210, messages[1].message_id)
self.assertEqual('AUX2 relay deactivation', messages[1].message)
def test_decode_error(self):
status, count, messages = _SIAbstractGatewayClient.decode_messages_read_frame('MESSAGES READ\nstatus:Error\ncount:0\n\n')
self.assertEqual(SIStatus.ERROR, status)
self.assertEqual(0, count)
self.assertEqual(0, len(messages))
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_messages_read_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_messages_read_frame("""MESAGES READ
status:Success
count:2
[
{
"access_id": "demo",
"device_id": "inv",
"message": "AUX2 relay activation",
"message_id": 209,
"timestamp": "2020-01-01T00:00:00Z"
},
{
"access_id": "demo",
"device_id": "inv",
"message": "AUX2 relay deactivation",
"message_id": 210,
"timestamp": "2020-01-01T00:15:00Z"
}
]""")
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_messages_read_frame("""MESSAGES READ
count:2
[
{
"access_id": "demo",
"device_id": "inv",
"message": "AUX2 relay activation",
"message_id": 209,
"timestamp": "2020-01-01T00:00:00Z"
},
{
"access_id": "demo",
"device_id": "inv",
"message": "AUX2 relay deactivation",
"message_id": 210,
"timestamp": "2020-01-01T00:15:00Z"
}
]""")
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_messages_read_frame("""MESSAGES READ
status:Success
[
{
"access_id": "demo",
"device_id": "inv",
"message": "AUX2 relay activation",
"message_id": 209,
"timestamp": "2020-01-01T00:00:00Z"
},
{
"access_id": "demo",
"device_id": "inv",
"message": "AUX2 relay deactivation",
"message_id": 210,
"timestamp": "2020-01-01T00:15:00Z"
}
]""")
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_messages_read_frame("""MESSAGES READ
[
{
"access_id": "demo",
"device_id": "inv",
"message": "AUX2 relay activation",
"message_id": 209,
"timestamp": "2020-01-01T00:00:00Z"
},
{
"access_id": "demo",
"device_id": "inv",
"message": "AUX2 relay deactivation",
"message_id": 210,
"timestamp": "2020-01-01T00:15:00Z"
}
]""")
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_messages_read_frame("""MESSAGES READ
status:Success
count:2
[
{
"access_id": "demo",
"device_id": "inv",
"message": "AUX2 relay activation",
"message_id": 209,
"timestamp": "2020-01-01T00:00:00Z"
},
{
"access_id": "demo",
"device_id": "inv",
"message": "AUX2 relay deactivation",
"message_id": 210,
"timestamp": "2020-01-01T00:15:00Z"
}
]""")
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_messages_read_frame('MESSAGES READ\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_messages_read_frame('MESSAGES READ\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_messages_read_frame('MESSAGES READ')
class FINDPROPERTIESFrame(unittest.TestCase):
def test_encode(self):
frame = _SIAbstractGatewayClient.encode_find_properties_frame('*.*.3136')
self.assertEqual('FIND PROPERTIES\nid:*.*.3136\n\n', frame)
class PROPERTIESFOUNDFrame(unittest.TestCase):
def test_decode_success(self):
status, property_id, count, properties = _SIAbstractGatewayClient.decode_properties_found_frame('PROPERTIES FOUND\nstatus:Success\nid:*.*.3136\ncount:2\n\n["demo.inv.3136", "demo2.inv.3136"]')
self.assertEqual(SIStatus.SUCCESS, status)
self.assertEqual("*.*.3136", property_id)
self.assertEqual(2, count)
self.assertEqual(2, len(properties))
self.assertEqual('demo.inv.3136', properties[0])
self.assertEqual('demo2.inv.3136', properties[1])
def test_decode_frame_error(self):
with self.assertRaises(SIProtocolError) as context:
_SIAbstractGatewayClient.decode_properties_found_frame('ERROR\nreason:test\n\n')
self.assertEqual('test', context.exception.reason())
def test_decode_invalid_frame(self):
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPETIES FOUND\nstatus:Success\nid:*.*.3136\ncount:2\n\n["demo.inv.3136", "demo2.inv.3136"]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES FOUND\nstatus:Success\nid:*.*.3136\ncount:2\n["demo.inv.3136", "demo2.inv.3136"]')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES FOUND\nstatus:Success\nid:*.*.3136\ncount:2\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES FOUND\n\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES FOUND\n')
with self.assertRaises(SIProtocolError):
_SIAbstractGatewayClient.decode_properties_read_frame('PROPERTIES FOUND')
if __name__ == '__main__':
unittest.main()
| 57.929965 | 203 | 0.724952 | 7,463 | 65,345 | 6.128635 | 0.034437 | 0.084612 | 0.055096 | 0.096419 | 0.946521 | 0.925204 | 0.907801 | 0.890638 | 0.872426 | 0.836722 | 0 | 0.044026 | 0.161252 | 65,345 | 1,127 | 204 | 57.981366 | 0.790487 | 0.000459 | 0 | 0.527368 | 0 | 0.069474 | 0.247026 | 0.146816 | 0 | 0 | 0 | 0 | 0.416842 | 1 | 0.145263 | false | 0.003158 | 0.005263 | 0.002105 | 0.182105 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
b60abd21da7180bc967a6f2b17488eee29d5a9c5 | 4,420 | py | Python | TextClassification/sentiment_analysis/sentiment_analysis_zh/globe.py | STHSF/DeepNaturallanguageprocessing | 1fe79a961abf3e55fb3ce2b0266b26f56ade2483 | [
"Apache-2.0"
] | 15 | 2016-09-13T05:41:53.000Z | 2019-12-30T13:01:33.000Z | TextClassification/sentiment_analysis/sentiment_analysis_zh/globe.py | STHSF/DeepNaturallanguageprocessing | 1fe79a961abf3e55fb3ce2b0266b26f56ade2483 | [
"Apache-2.0"
] | 20 | 2020-01-28T21:42:25.000Z | 2022-02-10T00:44:02.000Z | TextClassification/sentiment_analysis/sentiment_analysis_zh/globe.py | STHSF/DeepNaturallanguageprocessing | 1fe79a961abf3e55fb3ce2b0266b26f56ade2483 | [
"Apache-2.0"
] | 10 | 2016-09-28T02:56:11.000Z | 2022-03-12T16:41:20.000Z | #!/usr/bin/env python
# coding:utf-8
# -*- coding: utf-8 -*-
# 全局变量模块
# corpus
# input_txt = '/home/zhangxin/work/workplace_python/DeepNaturalLanguageProcessing/DeepNLP/data/input/myInput.txt'
# output_txt = '/home/zhangxin/work/workplace_python/DeepNaturalLanguageProcessing/DeepNLP/data/input/myOutput.txt'
# stopword = 'data/stopword.txt'
#
# data_patent = ''
# data_process_result = '/home/zhangxin/work/workplace_python/DeepSentiment/data/tagging/result.txt'
#
# # train
#
# train_data = ('neg', '/home/zhangxin/work/DeepSentiment/data/train/result_neg.txt')
# train_neu = ('neu', '/home/zhangxin/work/DeepSentiment/data/train/result_neu.txt')
# train_pos = ('pos', '/home/zhangxin/work/DeepSentiment/data/train/result_pos.txt')
# train_data = [(1, '/home/zhangxin/work/DeepSentiment/data/train/result_neg.txt'),
# (2, '/home/zhangxin/work/DeepSentiment/data/train/result_neu.txt'),
# (3, '/home/zhangxin/work/DeepSentiment/data/train/result_pos.txt')]
# train_data = [(0, '/home/zhangxin/work/DeepSentiment/data/train/result_neg.txt'),
# (1, '/home/zhangxin/work/DeepSentiment/data/train/result_pos.txt')]
#
# file_parent = '/home/zhangxin/work/workplace_python/DeepNaturalLanguageProcessing/DeepNLP/data'
# file_pos = '/home/zhangxin/work/workplace_python/DeepNaturalLanguageProcessing/DeepNLP/data/test3.txt'
# file_neg = '/home/zhangxin/work/workplace_python/DeepNaturalLanguageProcessing/DeepNLP/data/test2.txt'
# model_path = '/home/zhangxin/work/workplace_python/DeepSentiment/data/word2vec_model/'
# model_path = 'data/model_w2v/mymodel'
#================================================================================
# train_data = ('neg', '/home/zhangxin/work/DeepSentiment/data/train/result_neg.txt')
# train_neu = ('neu', '/home/zhangxin/work/DeepSentiment/data/train/result_neu.txt')
# train_pos = ('pos', '/home/zhangxin/work/DeepSentiment/data/train/result_pos.txt')
# train_data = [('neg', '/home/zhangxin/work/DeepSentiment/data/train/result_neg.txt'),
# ('neu', '/home/zhangxin/work/DeepSentiment/data/train/result_neu.txt'),
# ('pos', '/home/zhangxin/work/DeepSentiment/data/train/result_pos.txt')]
# file_parent = '/home/zhangxin/work/workplace_python/DeepNaturalLanguageProcessing/DeepNLP/data'
# file_neg = '/home/zhangxin/work/workplace_python/DeepNaturalLanguageProcessing/DeepNLP/data/test3.txt'
# file_pos = '/home/zhangxin/work/workplace_python/DeepNaturalLanguageProcessing/DeepNLP/data/test2.txt'
# model_path = '/home/zhangxin/work/workplace_python/DeepNaturalLanguageProcessing/DeepNLP/word2vecmodel/mymodel'
# input_txt = '/Users/li/workshop/MyRepository/DeepNaturalLanguageProcessing/DeepNLP/data/input/myInput.txt'
# output_txt = '/Users/li/workshop/MyRepository/DeepNaturalLanguageProcessing/DeepNLP/data/input/myOutput.txt'
# stopword = '/Users/li/workshop/MyRepository/DeepNaturalLanguageProcessing/DeepNLP/data/stopword.txt'
# data_process_result = '/Users/li/workshop/DataSet/sentiment/tagging/result.txt'
# train_data = ('neg', '/Users/li/workshop/DataSet/sentiment/train/result_neg.txt')
# train_neu = ('neu', '/Users/li/workshop/DataSet/sentiment/train/result_neu.txt')
# train_pos = ('pos', '/Users/li/workshop/DataSet/sentiment/train/result_pos.txt')
#
# train_data = [('neg', '/Users/li/workshop/DataSet/sentiment/train/result_neg.txt'),
# ('neu', '/Users/li/workshop/DataSet/sentiment/train/result_neu.txt'),
# ('pos', '/Users/li/workshop/DataSet/sentiment/train/result_pos.txt')]
# file_parent = '/Users/li/workshop/MyRepository/DeepNaturalLanguageProcessing/DeepNLP/data'
file_neg = '/Users/li/workshop/MyRepository/DeepNaturalLanguageProcessing/DeepNLP/data/test3.txt'
file_pos = '/Users/li/workshop/MyRepository/DeepNaturalLanguageProcessing/DeepNLP/data/test2.txt'
model_path = '/Users/li/workshop/MyRepository/DeepNaturalLanguageProcessing/DeepNLP/word2vecmodel/model'
# w2v模型的参数
n_dim = 200
min_count = 2
pos_file_path = '/Users/li/workshop/DataSet/sentiment/train/result_pos.txt'
neg_file_path = '/Users/li/workshop/DataSet/sentiment/train/result_neg.txt'
# pos_file_path = '/home/zhangxin/work/workplace_python/DeepSentiment/data/train/result_pos.txt'
# neg_file_path = '/home/zhangxin/work/workplace_python/DeepSentiment/data/train/result_neg.txt'
#预测
# model_rnn_path = 'data/model_rnn/model.ckpt'
# predict_parent_file = 'data/text_predict' | 54.567901 | 115 | 0.750905 | 540 | 4,420 | 5.97963 | 0.114815 | 0.100341 | 0.133788 | 0.138743 | 0.894704 | 0.882936 | 0.85847 | 0.719108 | 0.703314 | 0.57572 | 0 | 0.00539 | 0.076471 | 4,420 | 81 | 116 | 54.567901 | 0.785644 | 0.861991 | 0 | 0 | 0 | 0 | 0.670886 | 0.670886 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
3737cc10c332f4ea1acfd799e4d83d2e1c2a7978 | 335,534 | py | Python | py65816/tests/devices/test_mpu65c816_native_16.py | tmr4/py65816 | 00d9a378ebd0e27378c8ce9e6611a7fec0020b44 | [
"BSD-3-Clause"
] | 1 | 2022-02-22T18:04:26.000Z | 2022-02-22T18:04:26.000Z | py65816/tests/devices/test_mpu65c816_native_16.py | tmr4/py65816 | 00d9a378ebd0e27378c8ce9e6611a7fec0020b44 | [
"BSD-3-Clause"
] | null | null | null | py65816/tests/devices/test_mpu65c816_native_16.py | tmr4/py65816 | 00d9a378ebd0e27378c8ce9e6611a7fec0020b44 | [
"BSD-3-Clause"
] | null | null | null | import unittest # python -m unittest discover -p "*816_native_16.py"
import sys
from py65816.devices.mpu65c816 import MPU
#from py65816.tests.devices.mpu65816_Common_tests_6502 import Common6502Tests
#from py65816.tests.devices.mpu65816_Common_tests_65c02 import Common65C02Tests
from py65816.tests.devices.mpu65816_Common_tests_native import Common65816NativeTests
# x tests
class MPUTests(unittest.TestCase, Common65816NativeTests):
#class MPUTests(unittest.TestCase):
"""CMOS 65C816 Tests - Native Mode - 16 Bit"""
def test_repr(self):
mpu = self._make_mpu()
self.assertTrue('65C816' in repr(mpu))
# Native Mode - 16 bit
# Page Bounday Wrap Tests
def test_dpx_no_wraps_page_boundary_when_dl_zero(self):
mpu = self._make_mpu()
mpu.dpr = 0x0100
mpu.x = 1
self._write(mpu.memory, 0x00ff, (0x34, 0x12))
self._write(mpu.memory, 0x01ff, (0xcd, 0xab, 0xff))
# $0000 LDA $ff,X
self._write(mpu.memory, 0x0000, (0xb5, 0xff))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xffab, mpu.a)
def test_dpx_no_wrap_page_boundary_when_dl_not_zero(self):
mpu = self._make_mpu()
mpu.dpr = 0x0101
mpu.x = 0
self._write(mpu.memory, 0x00ff, (0x34, 0x12))
self._write(mpu.memory, 0x01ff, (0xcd, 0xab, 0xff))
# $0000 LDA $ff,X
self._write(mpu.memory, 0x0000, (0xb5, 0xff))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xffab, mpu.a)
def test_dpi_no_wrap_page_boundary_when_dl_zero(self):
mpu = self._make_mpu()
mpu.dpr = 0x0100
self._write(mpu.memory, 0x0100, (0xcd, 0xab))
self._write(mpu.memory, 0x01ff, (0x34, 0x12))
self._write(mpu.memory, 0x1234, (0x78, 0x56))
self._write(mpu.memory, 0xabcd, (0xbc, 0x9a))
self._write(mpu.memory, 0xcd34, (0x10, 0x20))
# $0000 LDA ($ff)
self._write(mpu.memory, 0x0000, (0xb2, 0xff))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x5678, mpu.a)
def test_dix_no_wraps_page_boundary_when_dl_zero(self):
mpu = self._make_mpu()
mpu.dpr = 0x0100
mpu.x = 1
self._write(mpu.memory, 0x0100, (0xcd, 0xab))
self._write(mpu.memory, 0x01ff, (0x34, 0x12))
self._write(mpu.memory, 0x1234, (0x78, 0x56))
self._write(mpu.memory, 0xabcd, (0xbc, 0x9a))
self._write(mpu.memory, 0xcd34, (0x10, 0x20))
# $0000 LDA ($ff,X)
self._write(mpu.memory, 0x0000, (0xa1, 0xfe))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x5678, mpu.a)
def test_no_stack_wrap(self):
mpu = self._make_mpu()
mpu.sp = 0x01ff
self._write(mpu.memory, 0x00ff, (0x34, 0x12))
self._write(mpu.memory, 0x01ff, (0xcd, 0xab, 0xff))
# $000 PLA
mpu.memory[0x0000] = 0x68
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xffab, mpu.a)
# Bank Bounday Wrap Tests
def test_dpx_wraps_at_bank_zero_boundary(self):
mpu = self._make_mpu()
mpu.pc = 0x0100
mpu.dpr = 0xff01
mpu.x = 0x00
self._write(mpu.memory, 0x0000, (0x34, 0x12))
self._write(mpu.memory, 0x10000, (0xcd, 0xab))
# $0000 LDA $ff,X
self._write(mpu.memory, 0x0100, (0xb5, 0xff))
mpu.step()
self.assertEqual(0x0102, mpu.pc)
self.assertEqual(0x1234, mpu.a)
def test_dpi_dp_wraps_at_bank_zero_boundary(self):
mpu = self._make_mpu()
mpu.pc = 0x0100
mpu.dpr = 0xff01
mpu.dbr = 0x01
self._write(mpu.memory, 0x0000, (0x34, 0x12))
self._write(mpu.memory, 0xffff, (0xcd, 0xab))
self._write(mpu.memory, 0x011234, (0x78, 0x56))
self._write(mpu.memory, 0x01abcd, (0xbc, 0x9a))
self._write(mpu.memory, 0x0134cd, (0x10, 0x20))
# $0000 LDA ($ff)
self._write(mpu.memory, 0x0100, (0xb2, 0xff))
mpu.step()
self.assertEqual(0x0102, mpu.pc)
self.assertEqual(0x5678, mpu.a)
def test_dpi_indaddr_wraps_at_bank_zero_boundary(self):
mpu = self._make_mpu()
mpu.pc = 0x0100
mpu.dpr = 0xff01
mpu.dbr = 0x01
self._write(mpu.memory, 0x0000, (0x34, 0x12))
self._write(mpu.memory, 0xffff, (0xcd, 0xab))
self._write(mpu.memory, 0x011234, (0x78, 0x56))
self._write(mpu.memory, 0x01abcd, (0xbc, 0x9a))
self._write(mpu.memory, 0x0134cd, (0x10, 0x20))
# $0000 LDA ($ff)
self._write(mpu.memory, 0x0100, (0xb2, 0xfe))
mpu.step()
self.assertEqual(0x0102, mpu.pc)
self.assertEqual(0x2010, mpu.a)
def test_dix_wraps_at_bank_zero_boundary(self):
mpu = self._make_mpu()
mpu.pc = 0x0100
mpu.dpr = 0xff01
mpu.dbr = 0x01
mpu.x = 0x00
self._write(mpu.memory, 0x0000, (0x34, 0x12))
self._write(mpu.memory, 0x10000, (0xcd, 0xab))
self._write(mpu.memory, 0x011234, (0x78, 0x56))
self._write(mpu.memory, 0x01abcd, (0xbc, 0x9a))
self._write(mpu.memory, 0x0134cd, (0x10, 0x20))
# $0000 LDA ($ff,X)
self._write(mpu.memory, 0x0100, (0xa1, 0xff))
mpu.step()
self.assertEqual(0x0102, mpu.pc)
self.assertEqual(0x5678, mpu.a)
def test_dil_no_wraps_at_page_boundary(self):
mpu = self._make_mpu()
mpu.pc = 0x0100
mpu.dpr = 0xff00
mpu.dbr = 0x01
self._write(mpu.memory, 0x0000, (0x34, 0x01))
self._write(mpu.memory, 0xff00, (0xab, 0x01))
self._write(mpu.memory, 0xffff, (0xcd, 0xab, 0x01))
self._write(mpu.memory, 0x011234, (0x78, 0x56))
self._write(mpu.memory, 0x01abcd, (0xbc, 0x9a))
self._write(mpu.memory, 0x0134cd, (0x10, 0x20))
# $0000 LDA ($ff)
self._write(mpu.memory, 0x0100, (0xa7, 0xff))
mpu.step()
self.assertEqual(0x0102, mpu.pc)
self.assertEqual(0x2010, mpu.a)
def test_dil_indaddr_wraps_at_bank_zero_boundary_1_byte(self):
mpu = self._make_mpu()
mpu.pc = 0x0100
mpu.dpr = 0xff00
mpu.dbr = 0x01
self._write(mpu.memory, 0x0000, (0x01, 0x34, 0x01))
self._write(mpu.memory, 0xff00, (0x01, 0xab, 0x01))
self._write(mpu.memory, 0xfffe, (0xcd, 0xab, 0x01))
self._write(mpu.memory, 0x011234, (0x78, 0x56))
self._write(mpu.memory, 0x01abcd, (0xbc, 0x9a))
self._write(mpu.memory, 0x0134cd, (0x10, 0x20))
# $0000 LDA ($fe)
self._write(mpu.memory, 0x0100, (0xa7, 0xfe))
mpu.step()
self.assertEqual(0x0102, mpu.pc)
self.assertEqual(0x9abc, mpu.a)
def test_dil_indaddr_wraps_at_bank_zero_boundary_2_bytes(self):
mpu = self._make_mpu()
mpu.pc = 0x0100
mpu.dpr = 0xff01
mpu.dbr = 0x01
self._write(mpu.memory, 0x0000, (0x34, 0x01))
self._write(mpu.memory, 0xff00, (0xab, 0x01))
self._write(mpu.memory, 0xffff, (0xcd, 0xab, 0x01))
self._write(mpu.memory, 0x011234, (0x78, 0x56))
self._write(mpu.memory, 0x01abcd, (0xbc, 0x9a))
self._write(mpu.memory, 0x0134cd, (0x10, 0x20))
# $0000 LDA ($fe)
self._write(mpu.memory, 0x0100, (0xa7, 0xfe))
mpu.step()
self.assertEqual(0x0102, mpu.pc)
self.assertEqual(0x2010, mpu.a)
def test_pc_wraps_bank_zero_boundary(self):
mpu = self._make_mpu()
mpu.pc = 0xffff
mpu.a = 0xffff
mpu.x = 0x1111
# $ffff TXA
mpu.memory[0xffff] = 0x8a
mpu.step()
self.assertEqual(0x0000, mpu.pc)
self.assertEqual(0x1111, mpu.a)
def test_pc_wraps_bank_k_boundary(self):
mpu = self._make_mpu()
mpu.pc = 0xffff
mpu.pbr = 0x01
mpu.a = 0xffff
mpu.x = 0x1111
# $ffff TXA
mpu.memory[0x01ffff] = 0x8a
mpu.step()
self.assertEqual(0x0000, mpu.pc)
self.assertEqual(0x01, mpu.pbr)
self.assertEqual(0x1111, mpu.a)
# ADC Absolute
def test_adc_bcd_off_absolute_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0
# $0000 ADC $C000
self._write(mpu.memory, 0x0000, (0x6D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_absolute_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.p |= mpu.CARRY
# $0000 ADC $C000
self._write(mpu.memory, 0x0000, (0x6D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_adc_bcd_off_absolute_carry_clear_in_no_carry_clear_out(self):
mpu = self._make_mpu()
mpu.a = 0x01
# $0000 ADC $C000
self._write(mpu.memory, 0x0000, (0x6D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000, (0xFE, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_absolute_carry_clear_in_carry_set_out(self):
mpu = self._make_mpu()
mpu.a = 0x02
# $0000 ADC $C000
self._write(mpu.memory, 0x0000, (0x6D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x0001, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_absolute_overflow_clr_no_carry_01_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC $C000
self._write(mpu.memory, 0x0000, (0x6D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x02, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_absolute_overflow_clr_no_carry_01_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC $C000
self._write(mpu.memory, 0x0000, (0x6D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_absolute_overflow_set_no_carry_7f_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x7fff
# $0000 ADC $C000
self._write(mpu.memory, 0x0000, (0x6D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_absolute_overflow_set_no_carry_80_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x8000
# $0000 ADC $C000
self._write(mpu.memory, 0x0000, (0x6D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x7fff, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_absolute_overflow_set_on_40_plus_40(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
mpu.a = 0x4000
# $0000 ADC $C000
self._write(mpu.memory, 0x0000, (0x6D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ADC Absolute, X-Indexed
def test_adc_bcd_off_abs_x_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.x = 0x03
# $0000 ADC $C000,X
self._write(mpu.memory, 0x0000, (0x7D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_abs_x_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.x = 0x03
mpu.p |= mpu.CARRY
# $0000 ADC $C000,X
self._write(mpu.memory, 0x0000, (0x7D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_adc_bcd_off_abs_x_carry_clear_in_no_carry_clear_out(self):
mpu = self._make_mpu()
mpu.a = 0x01
mpu.x = 0x03
# $0000 ADC $C000,X
self._write(mpu.memory, 0x0000, (0x7D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.x, (0xFE, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_abs_x_carry_clear_in_carry_set_out(self):
mpu = self._make_mpu()
mpu.a = 0x02
mpu.x = 0x03
# $0000 ADC $C000,X
self._write(mpu.memory, 0x0000, (0x7D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x0001, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_abs_x_overflow_clr_no_carry_01_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC $C000,X
self._write(mpu.memory, 0x0000, (0x7D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.x, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x02, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_abs_x_overflow_clr_no_carry_01_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC $C000,X
self._write(mpu.memory, 0x0000, (0x7D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.x, (0xFF, 0xff))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_abs_x_overflow_set_no_carry_7f_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x7fff
# $0000 ADC $C000,X
self._write(mpu.memory, 0x0000, (0x7D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.x, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_abs_x_overflow_set_no_carry_80_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x8000
# $0000 ADC $C000,X
self._write(mpu.memory, 0x0000, (0x7D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x7fff, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_abs_x_overflow_set_on_40_plus_40(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
mpu.a = 0x4000
mpu.x = 0x03
# $0000 ADC $C000,X
self._write(mpu.memory, 0x0000, (0x7D, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.x, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ADC Absolute, Y-Indexed
def test_adc_bcd_off_abs_y_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.y = 0x03
# $0000 ADC $C000,Y
self._write(mpu.memory, 0x0000, (0x79, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_abs_y_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.y = 0x03
mpu.p |= mpu.CARRY
# $0000 ADC $C000,Y
self._write(mpu.memory, 0x0000, (0x79, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_adc_bcd_off_abs_y_carry_clear_in_no_carry_clear_out(self):
mpu = self._make_mpu()
mpu.a = 0x01
mpu.y = 0x03
# $0000 ADC $C000,Y
self._write(mpu.memory, 0x0000, (0x79, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.y, (0xFE, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_abs_y_carry_clear_in_carry_set_out(self):
mpu = self._make_mpu()
mpu.a = 0x02
mpu.y = 0x03
# $0000 ADC $C000,Y
self._write(mpu.memory, 0x0000, (0x79, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x0001, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_abs_y_overflow_clr_no_carry_01_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC $C000,Y
self._write(mpu.memory, 0x0000, (0x79, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.y, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x02, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_abs_y_overflow_clr_no_carry_01_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC $C000,Y
self._write(mpu.memory, 0x0000, (0x79, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.y, (0xFF, 0xff))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_abs_y_overflow_set_no_carry_7f_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x7fff
# $0000 ADC $C000,Y
self._write(mpu.memory, 0x0000, (0x79, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.y, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_abs_y_overflow_set_no_carry_80_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x8000
# $0000 ADC $C000,Y
self._write(mpu.memory, 0x0000, (0x79, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x7fff, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_abs_y_overflow_set_on_40_plus_40(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
mpu.a = 0x4000
mpu.y = 0x03
# $0000 ADC $C000,Y
self._write(mpu.memory, 0x0000, (0x79, 0x00, 0xC0))
self._write(mpu.memory, 0xC000 + mpu.y, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ADC Absolute Long
def test_adc_bcd_off_absolute_long_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0
# $0000 ADC $01C000
self._write(mpu.memory, 0x0000, (0x6F, 0x00, 0xC0, 0x01))
self._write(mpu.memory, 0x01C000, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_absolute_long_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.p |= mpu.CARRY
# $0000 ADC $01C000
self._write(mpu.memory, 0x0000, (0x6F, 0x00, 0xC0, 0x01))
self._write(mpu.memory, 0x01C000, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_adc_bcd_off_absolute_long_carry_clear_in_no_carry_clear_out(self):
mpu = self._make_mpu()
mpu.a = 0x01
# $0000 ADC $01C000
self._write(mpu.memory, 0x0000, (0x6F, 0x00, 0xC0, 0x01))
self._write(mpu.memory, 0x01C000, (0xFE, 0xFF))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_absolute_long_carry_clear_in_carry_set_out(self):
mpu = self._make_mpu()
mpu.a = 0x02
# $0000 ADC $01C000
self._write(mpu.memory, 0x0000, (0x6F, 0x00, 0xC0, 0x01))
self._write(mpu.memory, 0x01C000, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x0001, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_absolute_long_overflow_clr_no_carry_01_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC $01C000
self._write(mpu.memory, 0x0000, (0x6F, 0x00, 0xC0, 0x01))
self._write(mpu.memory, 0x01C000, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x02, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_absolute_long_overflow_clr_no_carry_01_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC $01C000
self._write(mpu.memory, 0x0000, (0x6F, 0x00, 0xC0, 0x01))
self._write(mpu.memory, 0x01C000, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_absolute_long_overflow_set_no_carry_7f_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x7fff
# $0000 ADC $01C000
self._write(mpu.memory, 0x0000, (0x6F, 0x00, 0xC0, 0x01))
self._write(mpu.memory, 0x01C000, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_absolute_long_overflow_set_no_carry_80_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x8000
# $0000 ADC $01C000
self._write(mpu.memory, 0x0000, (0x6F, 0x00, 0xC0, 0x01))
self._write(mpu.memory, 0x01C000, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x7fff, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_absolute_long_overflow_set_on_40_plus_40(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
mpu.a = 0x4000
# $0000 ADC $01C000
self._write(mpu.memory, 0x0000, (0x6F, 0x00, 0xC0, 0x01))
self._write(mpu.memory, 0x01C000, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ADC Absolute Long, X-Indexed
def test_adc_bcd_off_abs_long_x_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.x = 0x03
# $0000 ADC $01C000,X
self._write(mpu.memory, 0x0000, (0x7F, 0x00, 0xC0, 0x01))
self._write(mpu.memory, 0x01C000 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_abs_long_x_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.x = 0x03
mpu.p |= mpu.CARRY
# $0000 ADC $01C000,X
self._write(mpu.memory, 0x0000, (0x7F, 0x00, 0xC0, 0x01))
self._write(mpu.memory, 0x01C000 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ADC Direct Page
def test_adc_bcd_off_dp_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0
# $0000 ADC $00B0
self._write(mpu.memory, 0x0000, (0x65, 0xB0))
self._write(mpu.memory, 0xB0, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_dp_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.p |= mpu.CARRY
# $0000 ADC $00B0
self._write(mpu.memory, 0x0000, (0x65, 0xB0))
self._write(mpu.memory, 0xB0, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_adc_bcd_off_dp_carry_clear_in_no_carry_clear_out(self):
mpu = self._make_mpu()
mpu.a = 0x01
# $0000 ADC $00B0
self._write(mpu.memory, 0x0000, (0x65, 0xB0))
self._write(mpu.memory, 0xB0, (0xFE, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_dp_carry_clear_in_carry_set_out(self):
mpu = self._make_mpu()
mpu.a = 0x02
# $0000 ADC $00B0
self._write(mpu.memory, 0x0000, (0x65, 0xB0))
self._write(mpu.memory, 0xB0, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x0001, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_dp_overflow_clr_no_carry_01_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC $00B0
self._write(mpu.memory, 0x0000, (0x65, 0xB0))
self._write(mpu.memory, 0xB0, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x02, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_dp_overflow_clr_no_carry_01_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC $00B0
self._write(mpu.memory, 0x0000, (0x65, 0xB0))
self._write(mpu.memory, 0xB0, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_dp_overflow_set_no_carry_7f_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x7fff
# $0000 ADC $00B0
self._write(mpu.memory, 0x0000, (0x65, 0xB0))
self._write(mpu.memory, 0xB0, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_dp_overflow_set_no_carry_80_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x8000
# $0000 ADC $00B0
self._write(mpu.memory, 0x0000, (0x65, 0xB0))
self._write(mpu.memory, 0xB0, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x7fff, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_dp_overflow_set_on_40_plus_40(self):
mpu = self._make_mpu()
mpu.a = 0x4000
mpu.p &= ~(mpu.OVERFLOW)
# $0000 ADC $00B0
self._write(mpu.memory, 0x0000, (0x65, 0xB0))
self._write(mpu.memory, 0xB0, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ADC Direct Page, X-Indexed
def test_adc_bcd_off_dp_x_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.x = 0x03
# $0000 ADC $0010,X
self._write(mpu.memory, 0x0000, (0x75, 0x10))
self._write(mpu.memory, 0x10 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_dp_x_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.x = 0x03
mpu.p |= mpu.CARRY
# $0000 ADC $0010,X
self._write(mpu.memory, 0x0000, (0x75, 0x10))
self._write(mpu.memory, 0x10 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_adc_bcd_off_dp_x_carry_clear_in_no_carry_clear_out(self):
mpu = self._make_mpu()
mpu.a = 0x01
mpu.x = 0x03
# $0000 ADC $0010,X
self._write(mpu.memory, 0x0000, (0x75, 0x10))
self._write(mpu.memory, 0x10 + mpu.x, (0xFE, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_dp_x_carry_clear_in_carry_set_out(self):
mpu = self._make_mpu()
mpu.a = 0x02
mpu.x = 0x03
# $0000 ADC $0010,X
self._write(mpu.memory, 0x0000, (0x75, 0x10))
self._write(mpu.memory, 0x10 + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x0001, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_dp_x_overflow_clr_no_carry_01_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
mpu.x = 0x03
# $0000 ADC $0010,X
self._write(mpu.memory, 0x0000, (0x75, 0x10))
self._write(mpu.memory, 0x10 + mpu.x, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x02, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_dp_x_overflow_clr_no_carry_01_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
mpu.x = 0x03
# $0000 ADC $0010,X
self._write(mpu.memory, 0x0000, (0x75, 0x10))
self._write(mpu.memory, 0x10 + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_dp_x_overflow_set_no_carry_7f_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x7fff
mpu.x = 0x03
# $0000 ADC $0010,X
self._write(mpu.memory, 0x0000, (0x75, 0x10))
self._write(mpu.memory, 0x10 + mpu.x, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_dp_x_overflow_set_no_carry_80_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x8000
mpu.x = 0x03
# $0000 ADC $0010,X
self._write(mpu.memory, 0x0000, (0x75, 0x10))
self._write(mpu.memory, 0x10 + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x7fff, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_dp_x_overflow_set_on_40_plus_40(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
mpu.a = 0x4000
mpu.x = 0x03
# $0000 ADC $0010,X
self._write(mpu.memory, 0x0000, (0x75, 0x10))
self._write(mpu.memory, 0x10 + mpu.x, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ADC Direct Page Indirect, Indexed (X)
def test_adc_bcd_off_ind_indexed_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.x = 0x03
# $0000 ADC ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x61, 0x10))
self._write(mpu.memory, 0x0013, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_ind_indexed_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.x = 0x03
mpu.p |= mpu.CARRY
# $0000 ADC ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x61, 0x10))
self._write(mpu.memory, 0x0013, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_adc_bcd_off_ind_indexed_carry_clear_in_no_carry_clear_out(self):
mpu = self._make_mpu()
mpu.a = 0x01
mpu.x = 0x03
# $0000 ADC ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x61, 0x10))
self._write(mpu.memory, 0x0013, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFE, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_ind_indexed_carry_clear_in_carry_set_out(self):
mpu = self._make_mpu()
mpu.a = 0x02
mpu.x = 0x03
# $0000 ADC ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x61, 0x10))
self._write(mpu.memory, 0x0013, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x0001, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_ind_indexed_overflow_clr_no_carry_01_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
mpu.x = 0x03
# $0000 ADC ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x61, 0x10))
self._write(mpu.memory, 0x0013, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x02, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_ind_indexed_overflow_clr_no_carry_01_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
mpu.x = 0x03
# $0000 ADC ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x61, 0x10))
self._write(mpu.memory, 0x0013, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_ind_indexed_overflow_set_no_carry_7f_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x7fff
mpu.x = 0x03
# $0000 ADC ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x61, 0x10))
self._write(mpu.memory, 0x0013, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_ind_indexed_overflow_set_no_carry_80_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x8000
mpu.x = 0x03
# $0000 ADC ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x61, 0x10))
self._write(mpu.memory, 0x0013, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x7fff, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_ind_indexed_overflow_set_on_40_plus_40(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
mpu.a = 0x4000
mpu.x = 0x03
# $0000 ADC ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x61, 0x10))
self._write(mpu.memory, 0x0013, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ADC Direct Page, Indirect
def test_adc_bcd_off_dp_ind_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0x00
# $0000 ADC ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x72, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_dp_ind_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.p |= mpu.CARRY
# $0000 ADC ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x72, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_adc_bcd_off_dp_ind_carry_clear_in_no_carry_clear_out(self):
mpu = self._make_mpu()
mpu.a = 0x01
# $0000 ADC ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x72, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFE, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_dp_ind_carry_clear_in_carry_set_out(self):
mpu = self._make_mpu()
mpu.a = 0x02
# $0000 ADC ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x72, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x0001, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_dp_ind_overflow_cleared_no_carry_01_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x72, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x02, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_dp_ind_overflow_cleared_no_carry_01_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x72, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_dp_ind_overflow_set_no_carry_7f_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x7fff
# $0000 ADC ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x72, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_dp_ind_overflow_set_no_carry_80_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x8000
# $0000 ADC ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x72, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x7fff, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_dp_ind_overflow_set_on_40_plus_40(self):
mpu = self._make_mpu()
mpu.a = 0x4000
# $0000 ADC ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x72, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ADC Direct Page, Indirect Long
def test_adc_bcd_off_dp_ind_long_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0x00
# $0000 ADC ($0010)
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x67, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_dp_ind_long_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.p |= mpu.CARRY
# $0000 ADC ($0010)
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x67, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ADC Direct Page Indexed, Indirect (Y)
def test_adc_bcd_off_indexed_ind_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.y = 0x03
# $0000 ADC ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x71, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_indexed_ind_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.y = 0x03
mpu.p |= mpu.CARRY
# $0000 ADC ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x71, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_adc_bcd_off_indexed_ind_carry_clear_in_no_carry_clear_out(self):
mpu = self._make_mpu()
mpu.a = 0x01
mpu.y = 0x03
# $0000 ADC ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x71, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0xFE, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_indexed_ind_carry_clear_in_carry_set_out(self):
mpu = self._make_mpu()
mpu.a = 0x02
mpu.y = 0x03
# $0000 ADC ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x71, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x0001, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_indexed_ind_overflow_clr_no_carry_01_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
mpu.y = 0x03
# $0000 $0000 ADC ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x71, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x02, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_indexed_ind_overflow_clr_no_carry_01_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
mpu.y = 0x03
# $0000 ADC ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x71, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x0000, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_indexed_ind_overflow_set_no_carry_7f_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x7fff
mpu.y = 0x03
# $0000 ADC ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x71, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_indexed_ind_overflow_set_no_carry_80_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x8000
mpu.y = 0x03
# $0000 $0000 ADC ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x71, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x7fff, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_indexed_ind_overflow_set_on_40_plus_40(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
mpu.a = 0x4000
mpu.y = 0x03
# $0000 ADC ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x71, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ADC Direct Page Indexed, Indirect Long (Y)
def test_adc_bcd_off_indexed_ind_long_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.y = 0x03
# $0000 ADC [$0010],Y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x77, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_indexed_ind_long_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.y = 0x03
mpu.p |= mpu.CARRY
# $0000 ADC [$0010],Y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x77, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ADC Immediate
def test_adc_bcd_off_immediate_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0
# $0000 ADC #$0000
self._write(mpu.memory, 0x0000, (0x69, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_immediate_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.p |= mpu.CARRY
# $0000 ADC #$0000
self._write(mpu.memory, 0x0000, (0x69, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_adc_bcd_off_immediate_carry_clear_in_no_carry_clear_out(self):
mpu = self._make_mpu()
mpu.a = 0x01
# $0000 ADC #$FEFF
self._write(mpu.memory, 0x0000, (0x69, 0xFE, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_immediate_carry_clear_in_carry_set_out(self):
mpu = self._make_mpu()
mpu.a = 0x02
# $0000 ADC #$FFFF
self._write(mpu.memory, 0x0000, (0x69, 0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x0001, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_adc_bcd_off_immediate_overflow_clr_no_carry_01_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC #$01
self._write(mpu.memory, 0x000, (0x69, 0x01, 0X00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x02, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_immediate_overflow_clr_no_carry_01_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x01
# $0000 ADC #$FFFF
self._write(mpu.memory, 0x000, (0x69, 0xff, 0xff))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_immediate_overflow_set_no_carry_7f_plus_01(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x7fff
# $0000 ADC #$01
self._write(mpu.memory, 0x000, (0x69, 0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_immediate_overflow_set_no_carry_80_plus_ff(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x8000
# $0000 ADC #$FFFF
self._write(mpu.memory, 0x000, (0x69, 0xff, 0xff))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x7fff, mpu.a)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_adc_bcd_off_immediate_overflow_set_on_40_plus_40(self):
mpu = self._make_mpu()
mpu.a = 0x4000
# $0000 ADC #$4000
self._write(mpu.memory, 0x0000, (0x69, 0x00, 0x40))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ADC Stack Relative
def test_adc_bcd_off_sp_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.sp = 0x1E0
# $0000 ADC $00B0,S
self._write(mpu.memory, 0x0000, (0x63, 0xB0))
self._write(mpu.memory, 0xB0 + mpu.sp, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_sp_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.sp = 0x1E0
mpu.p |= mpu.CARRY
# $0000 ADC $00B0,S
self._write(mpu.memory, 0x0000, (0x63, 0xB0))
self._write(mpu.memory, 0xB0 + mpu.sp, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ADC Stack Relative Indexed, Indirect (Y)
def test_adc_bcd_sp_off_indexed_ind_carry_clear_in_accumulator_zeroes(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.y = 0x03
mpu.sp = 0x1E0
mpu.dbr = 1
# $0000 ADC ($0010,S),Y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x73, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xCD, 0xAB))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_adc_bcd_off_sp_indexed_ind_carry_set_in_accumulator_zero(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.y = 0x03
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.p |= mpu.CARRY
# $0000 ADC ($0010,S),Y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x73, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xCD, 0xAB))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertNotEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ADC Immediate
def test_adc_bcd_on_immediate_79_plus_00_carry_set(self):
mpu = self._make_mpu()
mpu.p |= mpu.DECIMAL
mpu.p |= mpu.CARRY
mpu.a = 0x79
# $0000 ADC #$00
self._write(mpu.memory, 0x0000, (0x69, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x80, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
# self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
# I'm not interested in non-BCD functionality
def dont_test_adc_bcd_on_immediate_6f_plus_00_carry_set(self):
mpu = self._make_mpu()
mpu.p |= mpu.DECIMAL
mpu.p |= mpu.CARRY
mpu.a = 0x6f
# $0000 ADC #$00
self._write(mpu.memory, 0x0000, (0x69, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x76, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
# the simulated 65816 fails this but I'm not sure it's valid in the first place as py65 has some errors in BCD
# I'm not interested in non-BCD functionality
def dont_test_adc_bcd_on_immediate_9c_plus_9d(self):
mpu = self._make_mpu()
mpu.p |= mpu.DECIMAL
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x9c
# $0000 ADC #$9d
# $0002 ADC #$9d
self._write(mpu.memory, 0x0000, (0x69, 0x9d))
self._write(mpu.memory, 0x0002, (0x69, 0x9d))
mpu.step()
self.assertEqual(0x9f, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x93, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def dont_test_adc_bcd_on_immediate_99_plus_00_carry_set(self):
mpu = self._make_mpu()
mpu.p |= mpu.DECIMAL
mpu.p |= mpu.CARRY
mpu.a = 0x99
# $0000 ADC #$0000
self._write(mpu.memory, 0x0000, (0x69, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x0000, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def dont_test_adc_bcd_on_immediate_99_plus_99(self):
mpu = self._make_mpu()
mpu.p |= mpu.DECIMAL
mpu.p &= ~(mpu.CARRY)
mpu.a = 0x9999
# $0000 ADC #$9999
# $0002 ADC #$9999
self._write(mpu.memory, 0x0000, (0x69, 0x99, 0x99))
self._write(mpu.memory, 0x0002, (0x69, 0x99, 0x99))
mpu.step()
self.assertEqual(0x9f, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x93, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
# AND Absolute
def test_and_absolute_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 AND $ABCD
self._write(mpu.memory, 0x0000, (0x2D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_absolute_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 AND $ABCD
self._write(mpu.memory, 0x0000, (0x2D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Absolute, X-Indexed
def test_and_abs_x_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
# $0000 AND $ABCD,X
self._write(mpu.memory, 0x0000, (0x3d, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_abs_x_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
# $0000 AND $ABCD,X
self._write(mpu.memory, 0x0000, (0x3d, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Absolute, Y-Indexed
def test_and_abs_y_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.y = 0x03
# $0000 AND $ABCD,X
self._write(mpu.memory, 0x0000, (0x39, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_abs_y_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.y = 0x03
# $0000 AND $ABCD,X
self._write(mpu.memory, 0x0000, (0x39, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Absolute Long
def test_and_absolute_long_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 AND $01ABCD
self._write(mpu.memory, 0x0000, (0x2F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_absolute_long_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 AND $01ABCD
self._write(mpu.memory, 0x0000, (0x2F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Absolute Long, X-Indexed
def test_and_abs_long_x_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
# $0000 AND $01ABCD,X
self._write(mpu.memory, 0x0000, (0x3F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_abs_long_x_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
# $0000 AND $01ABCD,X
self._write(mpu.memory, 0x0000, (0x3F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.x, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Direct Page
def test_and_dp_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 AND $0010
self._write(mpu.memory, 0x0000, (0x25, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_dp_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 AND $0010
self._write(mpu.memory, 0x0000, (0x25, 0x10))
self._write(mpu.memory, 0x0010, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Direct Page, X-Indexed
def test_and_dp_x_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
# $0000 AND $0010,X
self._write(mpu.memory, 0x0000, (0x35, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_dp_x_all_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
# $0000 AND $0010,X
self._write(mpu.memory, 0x0000, (0x35, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Direct Page Indirect, Indexed (X)
def test_and_ind_indexed_x_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
# $0000 AND ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x21, 0x10))
self._write(mpu.memory, 0x0013, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_ind_indexed_x_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
# $0000 AND ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x21, 0x10))
self._write(mpu.memory, 0x0013, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Direct Page, Indirect
def test_and_dp_ind_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 AND ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x32, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_dp_ind_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 AND ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x32, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Direct Page, Indirect Long
def test_and_dp_ind_long_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 AND ($0010)
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x27, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_dp_ind_long_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 AND ($0010)
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x27, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Direct Page Indexed, Indirect (Y)
def test_and_indexed_ind_y_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.y = 0x03
# $0000 AND ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x31, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_indexed_ind_y_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.y = 0x03
# $0000 AND ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x31, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Direct Page Indexed, Indirect Long (Y)
def test_and_indexed_ind_long_y_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.y = 0x03
# $0000 AND ($0010),Y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x37, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_indexed_ind_long_y_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.y = 0x03
# $0000 AND ($0010),Y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x37, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Immediate
def test_and_immediate_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 AND #$00
self._write(mpu.memory, 0x0000, (0x29, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_immediate_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 AND #$AA
self._write(mpu.memory, 0x0000, (0x29, 0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Stack Relative
def test_and_sp_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.sp = 0x1E0
# $0000 AND $0010,S
self._write(mpu.memory, 0x0000, (0x23, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_sp_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.sp = 0x1E0
# $0000 AND $0010,S
self._write(mpu.memory, 0x0000, (0x23, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# AND Stack Relative Indexed, Indirect (Y)
def test_and_sp_indexed_ind_y_all_zeros_setting_zero_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.sp = 0x1E0
mpu.y = 0x03
# $0000 AND ($0010,S),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x33, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_and_sp_indexed_ind_y_zeros_and_ones_setting_negative_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.sp = 0x1E0
mpu.y = 0x03
# $0000 AND ($0010,S),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x33, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0xAA, 0xAA))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xAAAA, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ASL Accumulator
def test_asl_accumulator_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
# $0000 ASL
mpu.memory[0x0000] = 0x0A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_asl_accumulator_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x4000
# $0000 ASL
mpu.memory[0x0000] = 0x0A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_asl_accumulator_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.a = 0x7FFF
# $0000 ASL
mpu.memory[0x0000] = 0x0A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xFFFE, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_asl_accumulator_shifts_out_one(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 ASL
mpu.memory[0x0000] = 0x0A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xFFFE, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_asl_accumulator_80_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0x8000
mpu.p &= ~(mpu.ZERO)
# $0000 ASL
mpu.memory[0x0000] = 0x0A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
# ASL Absolute
def test_asl_absolute_sets_z_flag(self):
mpu = self._make_mpu()
# $0000 ASL $ABCD
self._write(mpu.memory, 0x0000, (0x0E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x00, mpu.memory[0xABCD+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_asl_absolute_sets_n_flag(self):
mpu = self._make_mpu()
# $0000 ASL $ABCD
self._write(mpu.memory, 0x0000, (0x0E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x80, mpu.memory[0xABCD+1])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_asl_absolute_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.a = 0xAA
# $0000 ASL $ABCD
self._write(mpu.memory, 0x0000, (0x0E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0x7F))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xAA, mpu.a)
self.assertEqual(0xFE, mpu.memory[0xABCD])
self.assertEqual(0xFF, mpu.memory[0xABCD+1])
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_asl_absolute_shifts_out_one(self):
mpu = self._make_mpu()
mpu.a = 0xAA
# $0000 ASL $ABCD
self._write(mpu.memory, 0x0000, (0x0E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xAA, mpu.a)
self.assertEqual(0xFE, mpu.memory[0xABCD])
self.assertEqual(0xFF, mpu.memory[0xABCD+1])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ASL Absolute, X-Indexed
def test_asl_abs_x_indexed_sets_z_flag(self):
mpu = self._make_mpu()
mpu.x = 0x03
# $0000 ASL $ABCD,X
self._write(mpu.memory, 0x0000, (0x1E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x00, mpu.memory[0xABCD + 1 + mpu.x])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_asl_abs_x_indexed_sets_n_flag(self):
mpu = self._make_mpu()
mpu.x = 0x03
# $0000 ASL $ABCD,X
self._write(mpu.memory, 0x0000, (0x1E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x80, mpu.memory[0xABCD + 1 + mpu.x])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_asl_abs_x_indexed_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.a = 0xAA
mpu.x = 0x03
# $0000 ASL $ABCD,X
self._write(mpu.memory, 0x0000, (0x1E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0xFF, 0x7F))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xAA, mpu.a)
self.assertEqual(0xFE, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0xFF, mpu.memory[0xABCD + 1 + mpu.x])
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_asl_abs_x_indexed_shifts_out_one(self):
mpu = self._make_mpu()
mpu.a = 0xAA
mpu.x = 0x03
# $0000 ASL $ABCD,X
self._write(mpu.memory, 0x0000, (0x1E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xAA, mpu.a)
self.assertEqual(0xFE, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0xFF, mpu.memory[0xABCD + 1 + mpu.x])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ASL Direct Page
def test_asl_dp_sets_z_flag(self):
mpu = self._make_mpu()
# $0000 ASL $0010
self._write(mpu.memory, 0x0000, (0x06, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x00, mpu.memory[0x0010 + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_asl_dp_sets_n_flag(self):
mpu = self._make_mpu()
# $0000 ASL $0010
self._write(mpu.memory, 0x0000, (0x06, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x80, mpu.memory[0x0010 + 1])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_asl_dp_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.a = 0xAA
# $0000 ASL $0010
self._write(mpu.memory, 0x0000, (0x06, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0x7F))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xAA, mpu.a)
self.assertEqual(0xFE, mpu.memory[0x0010])
self.assertEqual(0xFF, mpu.memory[0x0010 + 1])
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_asl_dp_shifts_out_one(self):
mpu = self._make_mpu()
mpu.a = 0xAA
# $0000 ASL $0010
self._write(mpu.memory, 0x0000, (0x06, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xAA, mpu.a)
self.assertEqual(0xFE, mpu.memory[0x0010])
self.assertEqual(0xFF, mpu.memory[0x0010 + 1])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ASL Direct Page, X-Indexed
def test_asl_dp_x_indexed_sets_z_flag(self):
mpu = self._make_mpu()
mpu.x = 0x03
# $0000 ASL $0010,X
self._write(mpu.memory, 0x0000, (0x16, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x00, mpu.memory[0x0010 + 1 + mpu.x])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_asl_dp_x_indexed_sets_n_flag(self):
mpu = self._make_mpu()
mpu.x = 0x03
# $0000 ASL $0010,X
self._write(mpu.memory, 0x0000, (0x16, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x40))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x80, mpu.memory[0x0010 + 1 + mpu.x])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_asl_dp_x_indexed_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.x = 0x03
mpu.a = 0xAA
# $0000 ASL $0010,X
self._write(mpu.memory, 0x0000, (0x16, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0xFF, 0x7F))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xAA, mpu.a)
self.assertEqual(0xFE, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0xFF, mpu.memory[0x0010 + 1 + mpu.x])
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_asl_dp_x_indexed_shifts_out_one(self):
mpu = self._make_mpu()
mpu.x = 0x03
mpu.a = 0xAA
# $0000 ASL $0010,X
self._write(mpu.memory, 0x0000, (0x16, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xAA, mpu.a)
self.assertEqual(0xFE, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0xFF, mpu.memory[0x0010 + 1 + mpu.x])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# BIT Absolute
def test_bit_abs_copies_bit_7_of_memory_to_n_flag_when_0(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
# $0000 BIT $FEED
self._write(mpu.memory, 0x0000, (0x2C, 0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0xFF, 0xFF))
mpu.a = 0xFF
mpu.step()
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_bit_abs_copies_bit_7_of_memory_to_n_flag_when_1(self):
mpu = self._make_mpu()
mpu.p |= mpu.NEGATIVE
# $0000 BIT $FEED
self._write(mpu.memory, 0x0000, (0x2C, 0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.a = 0xFF
mpu.step()
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_bit_abs_copies_bit_6_of_memory_to_v_flag_when_0(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
# $0000 BIT $FEED
self._write(mpu.memory, 0x0000, (0x2C, 0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0xFF, 0xFF))
mpu.a = 0xFF
mpu.step()
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_bit_abs_copies_bit_6_of_memory_to_v_flag_when_1(self):
mpu = self._make_mpu()
mpu.p |= mpu.OVERFLOW
# $0000 BIT $FEED
self._write(mpu.memory, 0x0000, (0x2C, 0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.a = 0xFF
mpu.step()
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_bit_abs_stores_result_of_and_in_z_preserves_a_when_1(self):
mpu = self._make_mpu()
mpu.p &= ~mpu.ZERO
# $0000 BIT $FEED
self._write(mpu.memory, 0x0000, (0x2C, 0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.a = 0x01
mpu.step()
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x00, mpu.memory[0xFEED])
def test_bit_abs_stores_result_of_and_when_nonzero_in_z_preserves_a(self):
mpu = self._make_mpu()
mpu.p |= mpu.ZERO
# $0000 BIT $FEED
self._write(mpu.memory, 0x0000, (0x2C, 0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0x01, 0x00))
mpu.a = 0x01
mpu.step()
self.assertEqual(0, mpu.p & mpu.ZERO) # result of AND is non-zero
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x01, mpu.memory[0xFEED])
def test_bit_abs_stores_result_of_and_when_zero_in_z_preserves_a(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
# $0000 BIT $FEED
self._write(mpu.memory, 0x0000, (0x2C, 0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.a = 0x01
mpu.step()
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO) # result of AND is zero
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x00, mpu.memory[0xFEED])
# BIT Absolute, X-Indexed
def test_bit_abs_x_copies_bit_7_of_memory_to_n_flag_when_0(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.x = 0x02
# $0000 BIT $FEEB,X
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE))
self._write(mpu.memory, 0xFEED, (0xFF, 0xFF))
mpu.a = 0xFF
mpu.step()
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
def test_bit_abs_x_copies_bit_7_of_memory_to_n_flag_when_1(self):
mpu = self._make_mpu()
mpu.p |= mpu.NEGATIVE
mpu.x = 0x02
# $0000 BIT $FEEB,X
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE))
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.a = 0xFF
mpu.step()
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
def test_bit_abs_x_copies_bit_6_of_memory_to_v_flag_when_0(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
mpu.x = 0x02
# $0000 BIT $FEEB,X
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE))
self._write(mpu.memory, 0xFEED, (0xFF, 0xFF))
mpu.a = 0xFF
mpu.step()
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
def test_bit_abs_x_copies_bit_6_of_memory_to_v_flag_when_1(self):
mpu = self._make_mpu()
mpu.p |= mpu.OVERFLOW
mpu.x = 0x02
# $0000 BIT $FEEB,X
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE))
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.a = 0xFF
mpu.step()
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
def test_bit_abs_x_stores_result_of_and_in_z_preserves_a_when_1(self):
mpu = self._make_mpu()
mpu.p &= ~mpu.ZERO
mpu.x = 0x02
# $0000 BIT $FEEB,X
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE))
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.a = 0x01
mpu.step()
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x00, mpu.memory[0xFEED])
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
def test_bit_abs_x_stores_result_of_and_nonzero_in_z_preserves_a(self):
mpu = self._make_mpu()
mpu.p |= mpu.ZERO
mpu.x = 0x02
# $0000 BIT $FEEB,X
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE))
self._write(mpu.memory, 0xFEED, (0x01, 0x00))
mpu.a = 0x01
mpu.step()
self.assertEqual(0, mpu.p & mpu.ZERO) # result of AND is non-zero
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x01, mpu.memory[0xFEED])
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
def test_bit_abs_x_stores_result_of_and_when_zero_in_z_preserves_a(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.x = 0x02
# $0000 BIT $FEEB,X
self._write(mpu.memory, 0x0000, (0x3C, 0xEB, 0xFE))
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.a = 0x01
mpu.step()
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO) # result of AND is zero
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x00, mpu.memory[0xFEED])
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x0003, mpu.pc)
# BIT Direct Page
def test_bit_dp_copies_bit_7_of_memory_to_n_flag_when_0(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
# $0000 BIT $0010
self._write(mpu.memory, 0x0000, (0x24, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0xFF))
mpu.a = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(3, mpu.processorCycles)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_bit_dp_copies_bit_7_of_memory_to_n_flag_when_1(self):
mpu = self._make_mpu()
mpu.p |= mpu.NEGATIVE
# $0000 BIT $0010
self._write(mpu.memory, 0x0000, (0x24, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.a = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(3, mpu.processorCycles)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_bit_dp_copies_bit_6_of_memory_to_v_flag_when_0(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
# $0000 BIT $0010
self._write(mpu.memory, 0x0000, (0x24, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0xFF))
mpu.a = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(3, mpu.processorCycles)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_bit_dp_copies_bit_6_of_memory_to_v_flag_when_1(self):
mpu = self._make_mpu()
mpu.p |= mpu.OVERFLOW
# $0000 BIT $0010
self._write(mpu.memory, 0x0000, (0x24, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.a = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(3, mpu.processorCycles)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_bit_dp_stores_result_of_and_in_z_preserves_a_when_1(self):
mpu = self._make_mpu()
mpu.p &= ~mpu.ZERO
# $0000 BIT $0010
self._write(mpu.memory, 0x0000, (0x24, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.a = 0x01
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(3, mpu.processorCycles)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x00, mpu.memory[0x0010])
def test_bit_dp_stores_result_of_and_when_nonzero_in_z_preserves_a(self):
mpu = self._make_mpu()
mpu.p |= mpu.ZERO
# $0000 BIT $0010
self._write(mpu.memory, 0x0000, (0x24, 0x10))
self._write(mpu.memory, 0x0010, (0x01, 0x00))
mpu.a = 0x01
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(3, mpu.processorCycles)
self.assertEqual(0, mpu.p & mpu.ZERO) # result of AND is non-zero
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x01, mpu.memory[0x0010])
def test_bit_dp_stores_result_of_and_when_zero_in_z_preserves_a(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
# $0000 BIT $0010
self._write(mpu.memory, 0x0000, (0x24, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.a = 0x01
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(3, mpu.processorCycles)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO) # result of AND is zero
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x00, mpu.memory[0x0010])
# BIT Direct Page, X-Indexed
def test_bit_dp_x_copies_bit_7_of_memory_to_n_flag_when_0(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
# $0000 BIT $0010,X
self._write(mpu.memory, 0x0000, (0x34, 0x10))
self._write(mpu.memory, 0x0013, (0xFF, 0xFF))
mpu.x = 0x03
mpu.a = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_bit_dp_x_copies_bit_7_of_memory_to_n_flag_when_1(self):
mpu = self._make_mpu()
mpu.p |= mpu.NEGATIVE
# $0000 BIT $0010,X
self._write(mpu.memory, 0x0000, (0x34, 0x10))
self._write(mpu.memory, 0x0013, (0x00, 0x00))
mpu.x = 0x03
mpu.a = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_bit_dp_x_copies_bit_6_of_memory_to_v_flag_when_0(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.OVERFLOW)
# $0000 BIT $0010,X
self._write(mpu.memory, 0x0000, (0x34, 0x10))
self._write(mpu.memory, 0x0013, (0xFF, 0xFF))
mpu.x = 0x03
mpu.a = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
def test_bit_dp_x_copies_bit_6_of_memory_to_v_flag_when_1(self):
mpu = self._make_mpu()
mpu.p |= mpu.OVERFLOW
# $0000 BIT $0010,X
self._write(mpu.memory, 0x0000, (0x34, 0x10))
self._write(mpu.memory, 0x0013, (0x00, 0x00))
mpu.x = 0x03
mpu.a = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_bit_dp_x_stores_result_of_and_in_z_preserves_a_when_1(self):
mpu = self._make_mpu()
mpu.p &= ~mpu.ZERO
# $0000 BIT $0010,X
self._write(mpu.memory, 0x0000, (0x34, 0x10))
self._write(mpu.memory, 0x0013, (0x00, 0x00))
mpu.x = 0x03
mpu.a = 0x01
mpu.step()
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
def test_bit_dp_x_stores_result_of_and_when_nonzero_in_z_preserves_a(self):
mpu = self._make_mpu()
mpu.p |= mpu.ZERO
# $0000 BIT $0010,X
self._write(mpu.memory, 0x0000, (0x34, 0x10))
self._write(mpu.memory, 0x0013, (0x01, 0x00))
mpu.x = 0x03
mpu.a = 0x01
mpu.step()
self.assertEqual(0, mpu.p & mpu.ZERO) # result of AND is non-zero
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x01, mpu.memory[0x0010 + mpu.x])
def test_bit_dp_x_stores_result_of_and_when_zero_in_z_preserves_a(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
# $0000 BIT $0010,X
self._write(mpu.memory, 0x0000, (0x34, 0x10))
self._write(mpu.memory, 0x0013, (0x00, 0x00))
mpu.x = 0x03
mpu.a = 0x01
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO) # result of AND is zero
self.assertEqual(0x01, mpu.a)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
# BIT Immediate
def test_bit_imm_does_not_affect_n_and_z_flags(self):
mpu = self._make_mpu()
mpu.p |= mpu.NEGATIVE | mpu.OVERFLOW
# $0000 BIT #$FFFF
self._write(mpu.memory, 0x0000, (0x89, 0xff, 0xff))
mpu.a = 0x00
mpu.step()
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.OVERFLOW, mpu.p & mpu.OVERFLOW)
self.assertEqual(0x00, mpu.a)
self.assertEqual(2, mpu.processorCycles)
self.assertEqual(0x03, mpu.pc)
def test_bit_imm_stores_result_of_and_in_z_preserves_a_when_1(self):
mpu = self._make_mpu()
mpu.p &= ~mpu.ZERO
# $0000 BIT #$0000
self._write(mpu.memory, 0x0000, (0x89, 0x00, 0x00))
mpu.a = 0x01
mpu.step()
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0x01, mpu.a)
self.assertEqual(2, mpu.processorCycles)
self.assertEqual(0x03, mpu.pc)
def test_bit_imm_stores_result_of_and_when_nonzero_in_z_preserves_a(self):
mpu = self._make_mpu()
mpu.p |= mpu.ZERO
# $0000 BIT #$0001
self._write(mpu.memory, 0x0000, (0x89, 0x01, 0x00))
mpu.a = 0x01
mpu.step()
self.assertEqual(0, mpu.p & mpu.ZERO) # result of AND is non-zero
self.assertEqual(0x01, mpu.a)
self.assertEqual(2, mpu.processorCycles)
self.assertEqual(0x03, mpu.pc)
def test_bit_imm_stores_result_of_and_when_zero_in_z_preserves_a(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
# $0000 BIT #$0000
self._write(mpu.memory, 0x0000, (0x89, 0x00, 0x00))
mpu.a = 0x01
mpu.step()
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO) # result of AND is zero
self.assertEqual(0x01, mpu.a)
self.assertEqual(2, mpu.processorCycles)
self.assertEqual(0x03, mpu.pc)
# Compare instructions
# See http://6502.org/tutorials/compare_instructions.html
# and http://www.6502.org/tutorials/compare_beyond.html
# Cheat sheet:
#
# - Comparison is actually subtraction "register - memory"
# - Z contains equality result (1 equal, 0 not equal)
# - C contains result of unsigned comparison (0 if A<m, 1 if A>=m)
# - N holds MSB of subtraction result (*NOT* of signed subtraction)
# - V is not affected by comparison
# - D has no effect on comparison
# CMP Absolute
def test_cmp_abs(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xCD, 0xCD, 0xAB))
mpu.step()
# CMP Absolute Indexed X
def test_cmp_abs_x(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xDD, 0xCD, 0xAB))
mpu.step()
# CMP Absolute Indexed Y
def test_cmp_abs_y(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xD9, 0xCD, 0xAB))
mpu.step()
# CMP Absolute Long
def test_cmp_abs_long_sets_z_flag_if_equal(self):
mpu = self._make_mpu()
mpu.a = 0x42FF
# $0000 AND $01ABCD
self._write(mpu.memory, 0x0000, (0xCF, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x42FF, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_cmp_abs_long_resets_z_flag_if_unequal(self):
mpu = self._make_mpu()
mpu.a = 0x43FF
# $0000 AND $01ABCD
self._write(mpu.memory, 0x0000, (0xCF, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x43FF, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# CMP Absolute Long, X
def test_cmp_abs_long_x_sets_z_flag_if_equal(self):
mpu = self._make_mpu()
mpu.a = 0x42FF
mpu.x = 0x103
# $0000 AND $01ABCD
self._write(mpu.memory, 0x0000, (0xDF, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.x, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x42FF, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_cmp_abs_long_x_resets_z_flag_if_unequal(self):
mpu = self._make_mpu()
mpu.a = 0x43FF
mpu.x = 0x103
# $0000 AND $01ABCD
self._write(mpu.memory, 0x0000, (0xDF, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.x, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x43FF, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# CMP Direct Page
def test_cmp_dp(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xC5, 0x0010))
mpu.step()
# CMP Direct Page Indexed X
def test_cmp_dp_x(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xD5, 0x0010))
mpu.step()
# CMP Direct Page Indexed Indirect X
def test_cmp_dp_ind_x(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xC1, 0x0010))
mpu.step()
# CMP Direct Page, Indirect
def test_cmp_dpi_sets_z_flag_if_equal(self):
mpu = self._make_mpu()
mpu.a = 0x42FF
# $0000 AND ($10)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0xd2, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x42FF, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_cmp_dpi_resets_z_flag_if_unequal(self):
mpu = self._make_mpu()
mpu.a = 0x43FF
# $0000 AND ($10)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0xd2, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x43FF, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# CMP Direct Page, Indirect Long
def test_cmp_dpi_long_sets_z_flag_if_equal(self):
mpu = self._make_mpu()
mpu.a = 0x42FF
# $0000 AND ($10)
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0xC7, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x42FF, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_cmp_dpi_long_resets_z_flag_if_unequal(self):
mpu = self._make_mpu()
mpu.a = 0x43FF
# $0000 AND ($10)
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0xC7, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x43FF, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# CMP Direct Page, Indirect Indexed Y
def test_cmp_dpi_y_sets_z_flag_if_equal(self):
mpu = self._make_mpu()
mpu.a = 0x42FF
mpu.y = 0x103
# $0000 AND ($10),y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0xD1, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD+mpu.y, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x42FF, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_cmp_dpi_y_resets_z_flag_if_unequal(self):
mpu = self._make_mpu()
mpu.a = 0x43FF
mpu.y = 0x103
# $0000 AND ($10),y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0xD1, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD+mpu.y, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x43FF, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# CMP Direct Page, Indirect Long Indexed Y
def test_cmp_dpi_long_y_sets_z_flag_if_equal(self):
mpu = self._make_mpu()
mpu.a = 0x42FF
mpu.y = 0x103
# $0000 AND [$10],y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0xD7, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD+mpu.y, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x42FF, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_cmp_dpi_long_y_resets_z_flag_if_unequal(self):
mpu = self._make_mpu()
mpu.a = 0x43FF
mpu.y = 0x103
# $0000 AND [$10],y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0xD7, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD+mpu.y, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x43FF, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# CMP Immediate
def test_cmp_imm_sets_zero_carry_clears_neg_flags_if_equal(self):
"""Comparison: A == m"""
mpu = self._make_mpu()
# $0000 CMP #10 , A will be 0x1010
self._write(mpu.memory, 0x0000, (0xC9, 0x10, 0x10))
mpu.a = 0x1010
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_cmp_imm_clears_zero_carry_takes_neg_if_less_unsigned(self):
"""Comparison: A < m (unsigned)"""
mpu = self._make_mpu()
# $0000 CMP #10 , A will be 1
self._write(mpu.memory, 0x0000, (0xC9, 0x10, 0x10))
mpu.a = 1
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE) # 0x01-0x0A=0xF7
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_cmp_imm_clears_zero_sets_carry_takes_neg_if_less_signed(self):
"""Comparison: A < #nn (signed), A negative"""
mpu = self._make_mpu()
# $0000 CMP #1, A will be -1 (0xFFFF)
self._write(mpu.memory, 0x0000, (0xC9, 0x01, 0x00))
mpu.a = 0xFFFF
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE) # 0xFFFF-0x0001=0xFFFE
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY) # A>m unsigned
def test_cmp_imm_clears_zero_carry_takes_neg_if_less_signed_nega(self):
"""Comparison: A < m (signed), A and m both negative"""
mpu = self._make_mpu()
# $0000 CMP #0xFFFF (-1), A will be -2 (0xFFFE)
self._write(mpu.memory, 0x0000, (0xC9, 0xFF, 0xFF))
mpu.a = 0xFFFE
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE) # 0xFE-0xFF=0xFF
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY) # A<m unsigned
def test_cmp_imm_clears_zero_sets_carry_takes_neg_if_more_unsigned(self):
"""Comparison: A > m (unsigned)"""
mpu = self._make_mpu()
# $0000 CMP #1 , A will be 10
self._write(mpu.memory, 0x0000, (0xC9, 0X01, 0X00))
mpu.a = 10
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0, mpu.p & mpu.NEGATIVE) # 0x0A-0x01 = 0x09
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY) # A>m unsigned
def test_cmp_imm_clears_zero_carry_takes_neg_if_more_signed(self):
"""Comparison: A > m (signed), memory negative"""
mpu = self._make_mpu()
# $0000 CMP #$FFFF (-1), A will be 2
self._write(mpu.memory, 0x0000, (0xC9, 0xFF, 0XFF))
mpu.a = 2
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0, mpu.p & mpu.NEGATIVE) # 0x02-0xFF=0x01
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY) # A<m unsigned
def test_cmp_imm_clears_zero_carry_takes_neg_if_more_signed_nega(self):
"""Comparison: A > m (signed), A and m both negative"""
mpu = self._make_mpu()
# $0000 CMP #$FFFE (-2), A will be -1 (0xFFFF)
self._write(mpu.memory, 0x0000, (0xC9, 0xFE, 0xFF))
mpu.a = 0xFFFF
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0, mpu.p & mpu.NEGATIVE) # 0xFF-0xFE=0x01
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY) # A>m unsigned
# CMP Stack Relative
def test_cmp_sp(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xC3, 0x0010))
mpu.step()
# CMP Stack Relative, Indirect Indexed Y
def test_cmp_spi_y_sets_z_flag_if_equal(self):
mpu = self._make_mpu()
mpu.a = 0x42FF
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.y = 0x103
# $0000 AND ($10,S),y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0xD3, 0x10))
self._write(mpu.memory, 0x0010+mpu.sp, (0xCD, 0xAB))
self._write(mpu.memory, 0x01ABCD+mpu.y, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(7, mpu.processorCycles)
self.assertEqual(0x42FF, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_cmp_spi_y_resets_z_flag_if_unequal(self):
mpu = self._make_mpu()
mpu.a = 0x43FF
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.y = 0x103
# $0000 AND ($10,S),y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0xD3, 0x10))
self._write(mpu.memory, 0x0010+mpu.sp, (0xCD, 0xAB))
self._write(mpu.memory, 0x01ABCD+mpu.y, (0xFF, 0x42))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(7, mpu.processorCycles)
self.assertEqual(0x43FF, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# CPX Absolute
def test_cpx_abs(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xEC, 0xCD, 0xAB))
mpu.step()
# CPX Direct Page
def test_cpx_dp(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xE4, 0x0010))
mpu.step()
# CPX Immediate
def test_cpx_imm_sets_zero_carry_clears_neg_flags_if_equal(self):
"""Comparison: X == m"""
mpu = self._make_mpu()
# $0000 CPX #$20ff
self._write(mpu.memory, 0x0000, (0xE0, 0xff, 0x20))
mpu.x = 0x20ff
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# CPY Absolute
def test_cpy_abs(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xCC, 0xCD, 0xAB))
mpu.step()
# CPY Direct Page
def test_cpy_dp(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xC4, 0x0010))
mpu.step()
# CPY Immediate
def test_cpy_imm_sets_zero_carry_clears_neg_flags_if_equal(self):
"""Comparison: Y == m"""
mpu = self._make_mpu()
# $0000 CPY #$30ff
self._write(mpu.memory, 0x0000, (0xC0, 0xff, 0x30))
mpu.y = 0x30ff
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# DEC Absolute
def test_dec_abs_decrements_memory(self):
mpu = self._make_mpu()
# $0000 DEC 0xABCD
self._write(mpu.memory, 0x0000, (0xCE, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x10, 0x10))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x0F, mpu.memory[0xABCD])
self.assertEqual(0x10, mpu.memory[0xABCD+1])
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_dec_abs_below_00_rolls_over_and_sets_negative_flag(self):
mpu = self._make_mpu()
# $0000 DEC 0xABCD
self._write(mpu.memory, 0x0000, (0xCE, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0xABCD])
self.assertEqual(0xFF, mpu.memory[0xABCD+1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_dec_abs_sets_zero_flag_when_decrementing_to_zero(self):
mpu = self._make_mpu()
# $0000 DEC 0xABCD
self._write(mpu.memory, 0x0000, (0xCE, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x00, mpu.memory[0xABCD+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# DEC Accumulator
def test_dec_a_decreases_a(self):
mpu = self._make_mpu()
# $0000 DEC
self._write(mpu.memory, 0x0000, [0x3A])
mpu.a = 0x0148
mpu.step()
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0x0147, mpu.a)
def test_dec_a_sets_zero_flag(self):
mpu = self._make_mpu()
# $0000 DEC
self._write(mpu.memory, 0x0000, [0x3A])
mpu.a = 0x01
mpu.step()
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0x00, mpu.a)
def test_dec_a_wraps_at_zero(self):
mpu = self._make_mpu()
# $0000 DEC
self._write(mpu.memory, 0x0000, [0x3A])
mpu.a = 0x00
mpu.step()
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0xffFF, mpu.a)
# DEC Direct Page
def test_dec_dp_decrements_memory(self):
mpu = self._make_mpu()
# $0000 DEC 0x0010
self._write(mpu.memory, 0x0000, (0xC6, 0x10))
self._write(mpu.memory, 0x0010, (0x10, 0x10))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x0F, mpu.memory[0x0010])
self.assertEqual(0x10, mpu.memory[0x0010+1])
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_dec_dp_below_00_rolls_over_and_sets_negative_flag(self):
mpu = self._make_mpu()
# $0000 DEC 0x0010
self._write(mpu.memory, 0x0000, (0xC6, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x0010])
self.assertEqual(0xFF, mpu.memory[0x0010+1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_dec_dp_sets_zero_flag_when_decrementing_to_zero(self):
mpu = self._make_mpu()
# $0000 DEC 0x0010
self._write(mpu.memory, 0x0000, (0xC6, 0x10))
self._write(mpu.memory, 0x0010, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x00, mpu.memory[0x0010+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# DEC Absolute, X-Indexed
def test_dec_abs_x_decrements_memory(self):
mpu = self._make_mpu()
# $0000 DEC 0xABCD,X
self._write(mpu.memory, 0x0000, (0xDE, 0xCD, 0xAB))
mpu.x = 0x03
self._write(mpu.memory, 0xABCD + mpu.x, (0x10, 0x10))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x0F, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x10, mpu.memory[0xABCD + 1 + mpu.x])
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_dec_abs_x_below_00_rolls_over_and_sets_negative_flag(self):
mpu = self._make_mpu()
# $0000 DEC 0xABCD,X
self._write(mpu.memory, 0x0000, (0xDE, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0xFF, mpu.memory[0xABCD + 1 + mpu.x])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_dec_abs_x_sets_zero_flag_when_decrementing_to_zero(self):
mpu = self._make_mpu()
# $0000 DEC 0xABCD,X
self._write(mpu.memory, 0x0000, (0xDE, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x00, mpu.memory[0xABCD + 1 + mpu.x])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# DEC Direct Page, X-Indexed
def test_dec_dp_x_decrements_memory(self):
mpu = self._make_mpu()
# $0000 DEC 0x0010,X
self._write(mpu.memory, 0x0000, (0xD6, 0x10))
mpu.x = 0x03
self._write(mpu.memory, 0x0010 + mpu.x, (0x10, 0x10))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x0F, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x10, mpu.memory[0x0010 + 1 + mpu.x])
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_dec_dp_x_below_00_rolls_over_and_sets_negative_flag(self):
mpu = self._make_mpu()
# $0000 DEC 0x0010,X
self._write(mpu.memory, 0x0000, (0xD6, 0x10))
mpu.x = 0x03
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0xFF, mpu.memory[0x0010 + 1 + mpu.x])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_dec_dp_x_sets_zero_flag_when_decrementing_to_zero(self):
mpu = self._make_mpu()
# $0000 DEC 0x0010,X
self._write(mpu.memory, 0x0000, (0xD6, 0x10))
mpu.x = 0x03
self._write(mpu.memory, 0x0010 + mpu.x, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x00, mpu.memory[0x0010 + 1 + mpu.x])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# DEX
def test_dex_decrements_x(self):
mpu = self._make_mpu()
mpu.x = 0x110
# $0000 DEX
mpu.memory[0x0000] = 0xCA
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x10F, mpu.x)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_dex_below_00_rolls_over_and_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.x = 0x00
# $0000 DEX
mpu.memory[0x0000] = 0xCA
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xffFF, mpu.x)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_dex_sets_zero_flag_when_decrementing_to_zero(self):
mpu = self._make_mpu()
mpu.x = 0x01
# $0000 DEX
mpu.memory[0x0000] = 0xCA
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x0000, mpu.x)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# DEY
def test_dey_decrements_y(self):
mpu = self._make_mpu()
mpu.y = 0x110
# $0000 DEY
mpu.memory[0x0000] = 0x88
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x10F, mpu.y)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_dey_below_00_rolls_over_and_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.y = 0x00
# $0000 DEY
mpu.memory[0x0000] = 0x88
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xFFff, mpu.y)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_dey_sets_zero_flag_when_decrementing_to_zero(self):
mpu = self._make_mpu()
mpu.y = 0x01
# $0000 DEY
mpu.memory[0x0000] = 0x88
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x0000, mpu.y)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
# EOR Absolute
def test_eor_absolute_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
self._write(mpu.memory, 0x0000, (0x4D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD])
self.assertEqual(0xFF, mpu.memory[0xABCD+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_absolute_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
self._write(mpu.memory, 0x0000, (0x4D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD])
self.assertEqual(0xFF, mpu.memory[0xABCD+1])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Absolute, X-Indexed
def test_eor_abs_x_indexed_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
self._write(mpu.memory, 0x0000, (0x5D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0xFF, mpu.memory[0xABCD + 1 + mpu.x])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_abs_x_indexed_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.x = 0x03
self._write(mpu.memory, 0x0000, (0x5D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0xFF, mpu.memory[0xABCD + 1 + mpu.x])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Absolute, Y-Indexed
def test_eor_abs_y_indexed_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.y = 0x03
self._write(mpu.memory, 0x0000, (0x59, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.y])
self.assertEqual(0xFF, mpu.memory[0xABCD + 1 + mpu.y])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_abs_y_indexed_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.y = 0x03
self._write(mpu.memory, 0x0000, (0x59, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.y])
self.assertEqual(0xFF, mpu.memory[0xABCD + 1 + mpu.y])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Absolute Long
def test_eor_absolute_long_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
self._write(mpu.memory, 0x0000, (0x4F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x01ABCD])
self.assertEqual(0xFF, mpu.memory[0x01ABCD+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_absolute_long_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
self._write(mpu.memory, 0x0000, (0x4F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x01ABCD])
self.assertEqual(0xFF, mpu.memory[0x01ABCD+1])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Absolute Long, X-Indexed
def test_eor_abs_long_x_indexed_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
self._write(mpu.memory, 0x0000, (0x5F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x01ABCD + mpu.x])
self.assertEqual(0xFF, mpu.memory[0x01ABCD + 1 + mpu.x])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_abs_long_x_indexed_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.x = 0x03
self._write(mpu.memory, 0x0000, (0x5F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x01ABCD + mpu.x])
self.assertEqual(0xFF, mpu.memory[0x01ABCD + 1 + mpu.x])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Direct Page
def test_eor_dp_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
self._write(mpu.memory, 0x0000, (0x45, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x0010])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_dp_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
self._write(mpu.memory, 0x0000, (0x45, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x0010])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Direct Page, X-Indexed
def test_eor_dp_x_indexed_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
self._write(mpu.memory, 0x0000, (0x55, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.x])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_dp_x_indexed_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.x = 0x03
self._write(mpu.memory, 0x0000, (0x55, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.x])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Direct Page, Indirect
def test_eor_dp_ind_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 EOR ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x52, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD])
self.assertEqual(0xFF, mpu.memory[0xABCD+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_dp_ind_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
# $0000 EOR ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x52, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD])
self.assertEqual(0xFF, mpu.memory[0xABCD+1])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Direct Page, Indirect Long
def test_eor_dp_ind_long_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 EOR ($0010)
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x47, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x01ABCD])
self.assertEqual(0xFF, mpu.memory[0x01ABCD+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_dp_ind_long_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
# $0000 EOR ($0010)
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x47, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x01ABCD])
self.assertEqual(0xFF, mpu.memory[0x01ABCD+1])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Direct Page Indirect, Indexed (X)
def test_eor_ind_indexed_x_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
self._write(mpu.memory, 0x0000, (0x41, 0x10)) # => EOR ($0010,X)
self._write(mpu.memory, 0x0013, (0xCD, 0xAB)) # => Vector to $ABCD
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_ind_indexed_x_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.x = 0x03
self._write(mpu.memory, 0x0000, (0x41, 0x10)) # => EOR ($0010,X)
self._write(mpu.memory, 0x0013, (0xCD, 0xAB)) # => Vector to $ABCD
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Direct Page Indexed, Indirect (Y)
def test_eor_indexed_ind_y_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.y = 0x03
self._write(mpu.memory, 0x0000, (0x51, 0x10)) # => EOR ($0010),Y
self._write(mpu.memory, 0x0010, (0xCD, 0xAB)) # => Vector to $ABCD
self._write(mpu.memory, 0xABCD + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.y])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_indexed_ind_y_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.y = 0x03
self._write(mpu.memory, 0x0000, (0x51, 0x10)) # => EOR ($0010),Y
self._write(mpu.memory, 0x0010, (0xCD, 0xAB)) # => Vector to $ABCD
self._write(mpu.memory, 0xABCD + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.y])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Direct Page Indexed, Indirect Long (Y)
def test_eor_indexed_ind_long_y_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.y = 0x03
self._write(mpu.memory, 0x0000, (0x57, 0x10)) # => EOR ($0010),Y
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01)) # => Vector to $01ABCD
self._write(mpu.memory, 0x01ABCD + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x01ABCD + mpu.y])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_indexed_ind_long_y_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.y = 0x03
self._write(mpu.memory, 0x0000, (0x57, 0x10)) # => EOR ($0010),Y
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01)) # => Vector to $01ABCD
self._write(mpu.memory, 0x01ABCD + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x01ABCD + mpu.y])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Immediate
def test_eor_immediate_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
self._write(mpu.memory, 0x0000, (0x49, 0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_immediate_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
self._write(mpu.memory, 0x0000, (0x49, 0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Stack Relative
def test_eor_sp_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.sp = 0x1E0
self._write(mpu.memory, 0x0000, (0x43, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.sp])
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.sp + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_sp_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.sp = 0x1E0
self._write(mpu.memory, 0x0000, (0x43, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.sp])
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.sp + 1])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# EOR Stack Relative Indirect Indexed Y
def test_eor_sp_indexed_ind_y_flips_bits_over_setting_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.y = 0x03
self._write(mpu.memory, 0x0000, (0x53, 0x10)) # => EOR ($0010,S),Y
self._write(mpu.memory, 0x0010 + mpu.sp, (0xCD, 0xAB)) # => Vector to $01ABCD
self._write(mpu.memory, 0x01ABCD + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x01ABCD + mpu.y])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_eor_sp_indexed_ind_y_flips_bits_over_setting_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.y = 0x03
self._write(mpu.memory, 0x0000, (0x53, 0x10)) # => EOR ($0010,S),Y
self._write(mpu.memory, 0x0010 + mpu.sp, (0xCD, 0xAB)) # => Vector to $01ABCD
self._write(mpu.memory, 0x01ABCD + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(0xFF, mpu.memory[0x01ABCD + mpu.y])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# INC Absolute
def test_inc_abs_increments_memory(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xEE, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x01, mpu.memory[0xABCD + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_inc_abs_increments_memory_rolls_over_and_sets_zero_flag(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xEE, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x00, mpu.memory[0xABCD+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_inc_abs_sets_negative_flag_when_incrementing_above_7F(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xEE, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0x7F))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x80, mpu.memory[0xABCD+1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
# INC Absolute, X-Indexed
def test_inc_abs_x_increments_memory(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xFE, 0xCD, 0xAB))
mpu.x = 0x03
self._write(mpu.memory, 0xABCD + mpu.x, (0xFF, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x01, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_inc_abs_x_increments_memory_rolls_over_and_sets_zero_flag(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xFE, 0xCD, 0xAB))
mpu.x = 0x03
self._write(mpu.memory, 0xABCD + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_inc_abs_x_sets_negative_flag_when_incrementing_above_7F(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xFE, 0xCD, 0xAB))
mpu.x = 0x03
self._write(mpu.memory, 0xABCD + mpu.x, (0xFF, 0x7F))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x80, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
# INC Accumulator
def test_inc_acc_increments_accum(self):
mpu = self._make_mpu()
mpu.memory[0x0000] = 0x1A
mpu.a = 0x4242
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x4243, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_inc_acc_increments_accum_rolls_over_and_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.memory[0x0000] = 0x1A
mpu.a = 0xFFFF
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_inc_acc_sets_negative_flag_when_incrementing_above_7F(self):
mpu = self._make_mpu()
mpu.memory[0x0000] = 0x1A
mpu.a = 0x7FFF
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
# INC Direct Page
def test_inc_dp_increments_memory(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xE6, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x01, mpu.memory[0x0010 + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_inc_dp_increments_memory_rolls_over_and_sets_zero_flag(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xE6, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x00, mpu.memory[0x0010 + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_inc_dp_sets_negative_flag_when_incrementing_above_7F(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xE6, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0x7F))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x80, mpu.memory[0x0010 + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
# INC Direct Page, X-Indexed
def test_inc_dp_x_increments_memory(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xF6, 0x10))
mpu.x = 0x03
self._write(mpu.memory, 0x0010 + mpu.x, (0xFF, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x01, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_inc_dp_x_increments_memory_rolls_over_and_sets_zero_flag(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xF6, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_inc_dp_x_sets_negative_flag_when_incrementing_above_7F(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0000, (0xF6, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0xFF, 0x7F))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x80, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
# INX
def test_inx_increments_x(self):
mpu = self._make_mpu()
mpu.x = 0x4242
mpu.memory[0x0000] = 0xE8 # => INX
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x4243, mpu.x)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_inx_above_FF_rolls_over_and_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.x = 0xFFFF
mpu.memory[0x0000] = 0xE8 # => INX
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.x)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_inx_sets_negative_flag_when_incrementing_above_7F(self):
mpu = self._make_mpu()
mpu.x = 0x7fff
mpu.memory[0x0000] = 0xE8 # => INX
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.x)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
# INY
def test_iny_increments_y(self):
mpu = self._make_mpu()
mpu.y = 0X4242
mpu.memory[0x0000] = 0xC8 # => INY
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x4243, mpu.y)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_iny_above_FF_rolls_over_and_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.y = 0xFFFF
mpu.memory[0x0000] = 0xC8 # => INY
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.y)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_iny_sets_negative_flag_when_incrementing_above_7F(self):
mpu = self._make_mpu()
mpu.y = 0x7fff
mpu.memory[0x0000] = 0xC8 # => INY
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.y)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
# JMP Absolute Indirect X-Indexed
def test_jmp_iax_jumps_to_address(self):
mpu = self._make_mpu()
mpu.x = 0x102
# $0000 JMP ($ABCD,X)
# $ACCF Vector to $1234
self._write(mpu.memory, 0x0000, (0x7C, 0xCD, 0xAB))
self._write(mpu.memory, 0xACCF, (0x34, 0x12))
mpu.step()
self.assertEqual(0x1234, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
# JSR Absolute Indirect X-Indexed
def test_jsr_abs_ind_x_pushes_pc_plus_2_and_sets_pc(self):
mpu = self._make_mpu()
mpu.x = 0x102
# $0000 JSR ($ABCD,X)
# $ACCF Vector to $1234
self._write(mpu.memory, 0x0000, (0xFC, 0xCD, 0xAB))
self._write(mpu.memory, 0xACCF, (0x34, 0x12))
mpu.step()
self.assertEqual(0x1234, mpu.pc)
self.assertEqual(0x1FD, mpu.sp)
self.assertEqual(0x00, mpu.memory[0x01FF]) # PCH
self.assertEqual(0x02, mpu.memory[0x01FE]) # PCL+2
# LDA Absolute
def test_lda_absolute_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
# $0000 LDA $ABCD
self._write(mpu.memory, 0x0000, (0xAD, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_absolute_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 LDA $ABCD
self._write(mpu.memory, 0x0000, (0xAD, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDA Absolute, X-Indexed
def test_lda_abs_x_indexed_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.x = 0x03
# $0000 LDA $ABCD,X
self._write(mpu.memory, 0x0000, (0xBD, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_abs_x_indexed_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
# $0000 LDA $ABCD,X
self._write(mpu.memory, 0x0000, (0xBD, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lda_abs_x_indexed_does_not_page_wrap(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.x = 0x1FF
# $0000 LDA $0080,X
self._write(mpu.memory, 0x0000, (0xBD, 0x80, 0x00))
self._write(mpu.memory, 0x0080 + mpu.x, (0x43, 0x42))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x4243, mpu.a)
# LDA Absolute, Y-Indexed
def test_lda_abs_y_indexed_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.y = 0x03
# $0000 LDA $ABCD,Y
self._write(mpu.memory, 0x0000, (0xB9, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_abs_y_indexed_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.y = 0x03
# $0000 LDA $ABCD,Y
self._write(mpu.memory, 0x0000, (0xB9, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lda_abs_y_indexed_does_not_page_wrap(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.y = 0x1FF
# $0000 LDA $0080,X
self._write(mpu.memory, 0x0000, (0xB9, 0x80, 0x00))
self._write(mpu.memory, 0x0080 + mpu.y, (0x43, 0x42))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x4243, mpu.a)
# LDA Absolute Long
def test_lda_absolute_long_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
# $0000 LDA $01ABCD
self._write(mpu.memory, 0x0000, (0xAF, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_absolute_long_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 LDA $01ABCD
self._write(mpu.memory, 0x0000, (0xAF, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDA Absolute Long, X-Indexed
def test_lda_abs_x_long_indexed_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.x = 0x03
# $0000 LDA $01ABCD,X
self._write(mpu.memory, 0x0000, (0xBF, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.x, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_abs_long_x_indexed_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x03
# $0000 LDA $01ABCD,X
self._write(mpu.memory, 0x0000, (0xBF, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lda_abs_long_x_indexed_does_not_page_wrap(self):
mpu = self._make_mpu()
mpu.a = 0
mpu.x = 0x1FF
# $0000 LDA $010080,X
self._write(mpu.memory, 0x0000, (0xBF, 0x80, 0x00, 0x01))
self._write(mpu.memory, 0x010080 + mpu.x, (0x43, 0x42))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x4243, mpu.a)
# LDA Direct Page
def test_lda_dp_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
# $0000 LDA $0010
self._write(mpu.memory, 0x0000, (0xA5, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_dp_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 LDA $0010
self._write(mpu.memory, 0x0000, (0xA5, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDA Direct Page, X-Indexed
def test_lda_dp_x_indexed_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.x = 0x103
# $0000 LDA $10,X
self._write(mpu.memory, 0x0000, (0xB5, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_dp_x_indexed_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x103
# $0000 LDA $10,X
self._write(mpu.memory, 0x0000, (0xB5, 0x10))
mpu.memory[0x0010] = 0x00
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDA Direct Page, Indirect
def test_lda_dp_ind_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
# $0000 LDA ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0xB2, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_dp_ind_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 LDA ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0xB2, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDA Direct Page, Indirect Long
def test_lda_dp_ind_long_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
# $0000 LDA ($0010)
# $0010 Vector to 01$ABCD
self._write(mpu.memory, 0x0000, (0xA7, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_dp_ind_long_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 LDA ($0010)
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0xA7, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDA Direct Page Indirect, Indexed (X)
def test_lda_ind_indexed_x_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.x = 0x103
# $0000 LDA ($0010,X)
# $0113 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0xA1, 0x10))
self._write(mpu.memory, 0x0113, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_ind_indexed_x_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.x = 0x103
# $0000 LDA ($0010,X)
# $0113 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0xA1, 0x10))
self._write(mpu.memory, 0x0113, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDA Direct Page Indexed, Indirect (Y)
def test_lda_indexed_ind_y_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.y = 0x103
# $0000 LDA ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0xB1, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_indexed_ind_y_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.y = 0x103
# $0000 LDA ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0xB1, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDA Direct Page Indexed, Indirect Long (Y)
def test_lda_indexed_ind_long_y_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.y = 0x103
# $0000 LDA ($0010),Y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0xB7, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_indexed_ind_long_y_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.y = 0x103
# $0000 LDA ($0010),Y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0xB7, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDA Immediate
def test_lda_immediate_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
# $0000 LDA #$80
self._write(mpu.memory, 0x0000, (0xA9, 0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_immediate_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
# $0000 LDA #$00
self._write(mpu.memory, 0x0000, (0xA9, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDA Stack Relative
def test_lda_sp_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.sp = 0x1E0
# $0000 LDA $0010.S
self._write(mpu.memory, 0x0000, (0xA3, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_sp_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.sp = 0x1E0
# $0000 LDA $0010,S
self._write(mpu.memory, 0x0000, (0xA3, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDA Stack Relative Indexed, Indirect (Y)
def test_lda_sp_indexed_ind_y_loads_a_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.y = 0x103
# $0000 LDA ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0xB3, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xCD, 0xAB))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_lda_sp_indexed_ind_y_loads_a_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.y = 0x103
# $0000 LDA ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0xB3, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xCD, 0xAB))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDX Absolute
def test_ldx_absolute_loads_x_sets_n_flag(self):
mpu = self._make_mpu()
mpu.x = 0x00
# $0000 LDX $ABCD
self._write(mpu.memory, 0x0000, (0xAE, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.x)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_ldx_absolute_loads_x_sets_z_flag(self):
mpu = self._make_mpu()
mpu.x = 0xFFFF
# $0000 LDX $ABCD
self._write(mpu.memory, 0x0000, (0xAE, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.x)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDX Absolute, Y-Indexed
def test_ldx_abs_y_indexed_loads_x_sets_n_flag(self):
mpu = self._make_mpu()
mpu.x = 0x00
mpu.y = 0x103
# $0000 LDX $ABCD,Y
self._write(mpu.memory, 0x0000, (0xBE, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.x)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_ldx_abs_y_indexed_loads_x_sets_z_flag(self):
mpu = self._make_mpu()
mpu.x = 0xFFFF
mpu.y = 0x103
# $0000 LDX $ABCD,Y
self._write(mpu.memory, 0x0000, (0xBE, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.x)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDX Direct Page
def test_ldx_dp_loads_x_sets_n_flag(self):
mpu = self._make_mpu()
mpu.x = 0x00
# $0000 LDX $0010
self._write(mpu.memory, 0x0000, (0xA6, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.x)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_ldx_dp_loads_x_sets_z_flag(self):
mpu = self._make_mpu()
mpu.x = 0xFFFF
# $0000 LDX $0010
self._write(mpu.memory, 0x0000, (0xA6, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.x)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDX Direct Page, Y-Indexed
def test_ldx_dp_y_indexed_loads_x_sets_n_flag(self):
mpu = self._make_mpu()
mpu.x = 0x00
mpu.y = 0x03
# $0000 LDX $0010,Y
self._write(mpu.memory, 0x0000, (0xB6, 0x10))
self._write(mpu.memory, 0x0010 + mpu.y, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.x)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_ldx_dp_y_indexed_loads_x_sets_z_flag(self):
mpu = self._make_mpu()
mpu.x = 0xFFFF
mpu.y = 0x103
# $0000 LDX $0010,Y
self._write(mpu.memory, 0x0000, (0xB6, 0x10))
self._write(mpu.memory, 0x0010 + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.x)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDX Immediate
def test_ldx_immediate_loads_x_sets_n_flag(self):
mpu = self._make_mpu()
mpu.x = 0x00
# $0000 LDX #$80
self._write(mpu.memory, 0x0000, (0xA2, 0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.x)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_ldx_immediate_loads_x_sets_z_flag(self):
mpu = self._make_mpu()
mpu.x = 0xFFFF
# $0000 LDX #$00
self._write(mpu.memory, 0x0000, (0xA2, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.x)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDY Absolute
def test_ldy_absolute_loads_y_sets_n_flag(self):
mpu = self._make_mpu()
mpu.y = 0x00
# $0000 LDY $ABCD
self._write(mpu.memory, 0x0000, (0xAC, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.y)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_ldy_absolute_loads_y_sets_z_flag(self):
mpu = self._make_mpu()
mpu.y = 0xFFFF
# $0000 LDY $ABCD
self._write(mpu.memory, 0x0000, (0xAC, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.y)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDY Absolute, X-Indexed
def test_ldy_abs_x_indexed_loads_x_sets_n_flag(self):
mpu = self._make_mpu()
mpu.y = 0x00
mpu.x = 0x103
# $0000 LDY $ABCD,X
self._write(mpu.memory, 0x0000, (0xBC, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.y)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_ldy_abs_x_indexed_loads_x_sets_z_flag(self):
mpu = self._make_mpu()
mpu.y = 0xFFFF
mpu.x = 0x103
# $0000 LDY $ABCD,X
self._write(mpu.memory, 0x0000, (0xBC, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.y)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDY Direct Page
def test_ldy_dp_loads_y_sets_n_flag(self):
mpu = self._make_mpu()
mpu.y = 0x00
# $0000 LDY $0010
self._write(mpu.memory, 0x0000, (0xA4, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.y)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_ldy_dp_loads_y_sets_z_flag(self):
mpu = self._make_mpu()
mpu.y = 0xFF
# $0000 LDY $0010
self._write(mpu.memory, 0x0000, (0xA4, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.y)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDY Direct Page, X-Indexed
def test_ldy_dp_x_indexed_loads_x_sets_n_flag(self):
mpu = self._make_mpu()
mpu.y = 0x00
mpu.x = 0x103
# $0000 LDY $0010,X
self._write(mpu.memory, 0x0000, (0xB4, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8000, mpu.y)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_ldy_dp_x_indexed_loads_x_sets_z_flag(self):
mpu = self._make_mpu()
mpu.y = 0xFFFF
mpu.x = 0x03
# $0000 LDY $0010,X
self._write(mpu.memory, 0x0000, (0xB4, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.y)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LDY Immediate
def test_ldy_immediate_loads_y_sets_n_flag(self):
mpu = self._make_mpu()
mpu.y = 0x00
# $0000 LDY #$80
self._write(mpu.memory, 0x0000, (0xA0, 0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8000, mpu.y)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_ldy_immediate_loads_y_sets_z_flag(self):
mpu = self._make_mpu()
mpu.y = 0xFFFF
# $0000 LDY #$00
self._write(mpu.memory, 0x0000, (0xA0, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.y)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LSR Absolute
def test_lsr_absolute_rotates_in_zero_not_carry(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 LSR $ABCD
self._write(mpu.memory, 0x0000, (0x4E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x00, mpu.memory[0xABCD+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lsr_absolute_sets_carry_and_zero_flags_after_rotation(self):
mpu = self._make_mpu()
mpu.p &= ~mpu.CARRY
# $0000 LSR $ABCD
self._write(mpu.memory, 0x0000, (0x4E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x00, mpu.memory[0xABCD+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lsr_absolute_rotates_bits_right(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 LSR $ABCD
self._write(mpu.memory, 0x0000, (0x4E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x04, 0x04))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x02, mpu.memory[0xABCD])
self.assertEqual(0x02, mpu.memory[0xABCD+1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LSR Absolute, X-Indexed
def test_lsr_abs_x_indexed_rotates_in_zero_not_carry(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
mpu.x = 0x103
# $0000 LSR $ABCD,X
self._write(mpu.memory, 0x0000, (0x5E, 0xCD, 0xAB))
mpu.memory[0xABCD] = 0x00
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lsr_abs_x_indexed_sets_c_and_z_flags_after_rotation(self):
mpu = self._make_mpu()
mpu.p &= ~mpu.CARRY
mpu.x = 0x103
# $0000 LSR $ABCD,X
self._write(mpu.memory, 0x0000, (0x5E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lsr_abs_x_indexed_rotates_bits_right(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
mpu.x = 0x103
# $0000 LSR $ABCD,X
self._write(mpu.memory, 0x0000, (0x5E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x04, 0x04))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x02, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x02, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LSR Accumulator
def test_lsr_accumulator_rotates_in_zero_not_carry(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 LSR A
mpu.memory[0x0000] = (0x4A)
mpu.a = 0x00
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lsr_accumulator_sets_carry_and_zero_flags_after_rotation(self):
mpu = self._make_mpu()
mpu.p &= ~mpu.CARRY
# $0000 LSR A
mpu.memory[0x0000] = (0x4A)
mpu.a = 0x01
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lsr_accumulator_rotates_bits_right(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 LSR A
mpu.memory[0x0000] = (0x4A)
mpu.a = 0x0404
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x0202, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LSR Direct Page
def test_lsr_dp_rotates_in_zero_not_carry(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 LSR $0010
self._write(mpu.memory, 0x0000, (0x46, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x00, mpu.memory[0x0010 + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lsr_dp_sets_carry_and_zero_flags_after_rotation(self):
mpu = self._make_mpu()
mpu.p &= ~mpu.CARRY
# $0000 LSR $0010
self._write(mpu.memory, 0x0000, (0x46, 0x10))
self._write(mpu.memory, 0x0010, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x00, mpu.memory[0x0010 + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lsr_dp_rotates_bits_right(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 LSR $0010
self._write(mpu.memory, 0x0000, (0x46, 0x10))
self._write(mpu.memory, 0x0010, (0x04, 0x04))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x02, mpu.memory[0x0010])
self.assertEqual(0x02, mpu.memory[0x0010 + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# LSR Direct Page, X-Indexed
def test_lsr_dp_x_indexed_rotates_in_zero_not_carry(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
mpu.x = 0x103
# $0000 LSR $0010,X
self._write(mpu.memory, 0x0000, (0x56, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lsr_dp_x_indexed_sets_carry_and_zero_flags_after_rotation(self):
mpu = self._make_mpu()
mpu.p &= ~mpu.CARRY
mpu.x = 0x103
# $0000 LSR $0010,X
self._write(mpu.memory, 0x0000, (0x56, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x+ 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_lsr_dp_x_indexed_rotates_bits_right(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
mpu.x = 0x103
# $0000 LSR $0010,X
self._write(mpu.memory, 0x0000, (0x56, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x04, 0x04))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x02, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x02, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
# MVN
def test_mvn(self):
mpu = self._make_mpu()
mpu.x = 0x200
mpu.y = 0x100
mpu.a = 0x100
# $0000 MVN $00,$01
self._write(mpu.memory, 0x0000, (0x54, 0X01, 0x00))
self._write(mpu.memory, mpu.x, [0x55] * mpu.a)
for addr in range(mpu.x, 0x0300):
self.assertEqual(0x55, mpu.memory[addr])
for addr in range(0x10100, 0x10200):
mpu.step()
self.assertEqual(0x55, mpu.memory[addr])
def test_mvn_wrap_at_bank_boundary(self):
mpu = self._make_mpu()
mpu.pc = 0x100
mpu.x = 0xff80
mpu.y = 0xff80
mpu.a = 0x100
# $0100 MVN $00,$01
self._write(mpu.memory, 0x0100, (0x54, 0X01, 0x00))
self._write(mpu.memory, 0x0000, [0x55] * (mpu.a >> 1))
self._write(mpu.memory, mpu.x, [0x55] * (mpu.a >> 1))
for addr in range(0x0000, 0x0080):
self.assertEqual(0x55, mpu.memory[addr])
for addr in range(mpu.x, 0x10000):
self.assertEqual(0x55, mpu.memory[addr])
for addr in range(0x1ff80, 0x20000):
mpu.step()
self.assertEqual(0x55, mpu.memory[addr])
for addr in range(0x10000, 0x10080):
mpu.step()
self.assertEqual(0x55, mpu.memory[addr])
# MVP
def test_mvp(self):
mpu = self._make_mpu()
mpu.x = 0x2ff
mpu.y = 0x1ff
mpu.a = 0x100
# $0000 MVN $00,$01
self._write(mpu.memory, 0x0000, (0x44, 0X01, 0x00))
self._write(mpu.memory, 0x0200, [0x55] * mpu.a)
for addr in range(0x0200, 0x0300):
self.assertEqual(0x55, mpu.memory[addr])
for addr in range(0x101ff, 0x100ff, -1):
mpu.step()
self.assertEqual(0x55, mpu.memory[addr])
def test_mvp_wrap_at_bank_boundary(self):
mpu = self._make_mpu()
mpu.pc = 0x100
mpu.x = 0x007f
mpu.y = 0x007f
mpu.a = 0x100
# $0100 MVN $00,$01
self._write(mpu.memory, 0x0100, (0x44, 0X01, 0x00))
self._write(mpu.memory, 0x0000, [0x55] * (mpu.a >> 1))
self._write(mpu.memory, 0xff80, [0x55] * (mpu.a >> 1))
for addr in range(0x0000, 0x0080):
self.assertEqual(0x55, mpu.memory[addr])
for addr in range(0xff80, 0xffff):
self.assertEqual(0x55, mpu.memory[addr])
for addr in range(0x1007f, 0xffff, -1):
mpu.step()
self.assertEqual(0x55, mpu.memory[addr])
for addr in range(0x1ffff, 0x1ff7f, -1):
mpu.step()
self.assertEqual(0x55, mpu.memory[addr])
# ORA Absolute
def test_ora_absolute_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
# $0000 ORA $ABCD
self._write(mpu.memory, 0x0000, (0x0D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_absolute_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
# $0000 ORA $ABCD
self._write(mpu.memory, 0x0000, (0x0D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Absolute, X
def test_ora_abs_x_indexed_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.x = 0x103
# $0000 ORA $ABCD,X
self._write(mpu.memory, 0x0000, (0x1D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_abs_x_indexed_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
mpu.x = 0x103
# $0000 ORA $ABCD,X
self._write(mpu.memory, 0x0000, (0x1D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Absolute, Y
def test_ora_abs_y_indexed_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.y = 0x103
# $0000 ORA $ABCD,Y
self._write(mpu.memory, 0x0000, (0x19, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_abs_y_indexed_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
mpu.y = 0x103
# $0000 ORA $ABCD,Y
self._write(mpu.memory, 0x0000, (0x19, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Absolute Long
def test_ora_absolute_long_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
# $0000 ORA $01ABCD
self._write(mpu.memory, 0x0000, (0x0F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_absolute_long_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
# $0000 ORA $01ABCD
self._write(mpu.memory, 0x0000, (0x0F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Absolute Long, X
def test_ora_abs_long_x_indexed_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.x = 0x103
# $0000 ORA $01ABCD,X
self._write(mpu.memory, 0x0000, (0x1F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_abs_long_x_indexed_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
mpu.x = 0x103
# $0000 ORA $01ABCD,X
self._write(mpu.memory, 0x0000, (0x1F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.x, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Direct Page
def test_ora_dp_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
# $0000 ORA $0010
self._write(mpu.memory, 0x0000, (0x05, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_dp_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
# $0000 ORA $0010
self._write(mpu.memory, 0x0000, (0x05, 0x10))
self._write(mpu.memory, 0x0010, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Direct Page, X
def test_ora_dp_x_indexed_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.x = 0x103
# $0000 ORA $0010,X
self._write(mpu.memory, 0x0000, (0x15, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_dp_x_indexed_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
mpu.x = 0x103
# $0000 ORA $0010,X
self._write(mpu.memory, 0x0000, (0x15, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Direct Page, Indirect
def test_ora_dp_ind_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.y = 0x1234 # These should not affect the ORA
mpu.x = 0x3456
# $0000 ORA ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x12, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_dp_ind_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
# $0000 ORA ($0010)
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x12, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Direct Page, Indirect Long
def test_ora_dp_ind_long_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.y = 0x1234 # These should not affect the ORA
mpu.x = 0x3456
# $0000 ORA ($0010)
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x07, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_dp_ind_long_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
# $0000 ORA ($0010)
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x07, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Direct Page Indirect, Indexed (X)
def test_ora_ind_indexed_x_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.x = 0x103
# $0000 ORA ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x01, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_ind_indexed_x_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
mpu.x = 0x103
# $0000 ORA ($0010,X)
# $0013 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x01, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Direct Page Indexed, Indirect (Y)
def test_ora_indexed_ind_y_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.y = 0x103
# $0000 ORA ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x11, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_indexed_ind_y_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
mpu.y = 0x103
# $0000 ORA ($0010),Y
# $0010 Vector to $ABCD
self._write(mpu.memory, 0x0000, (0x11, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Direct Page Indexed, Indirect Long (Y)
def test_ora_indexed_ind_long_y_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.y = 0x103
# $0000 ORA ($0010),Y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x17, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_indexed_ind_long_y_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
mpu.y = 0x103
# $0000 ORA ($0010),Y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x17, 0x10))
self._write(mpu.memory, 0x0010, (0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Immediate
def test_ora_immediate_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
# $0000 ORA #$00
self._write(mpu.memory, 0x0000, (0x09, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_immediate_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
# $0000 ORA #$8022
self._write(mpu.memory, 0x0000, (0x09, 0x22, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Stack Relative
def test_ora_sp_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.sp = 0x1E0
# $0000 ORA $0010
self._write(mpu.memory, 0x0000, (0x03, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_sp_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
mpu.sp = 0x1E0
# $0000 ORA $0010
self._write(mpu.memory, 0x0000, (0x03, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# ORA Stack Relative Indexed, Indirect (Y)
def test_ora_sp_indexed_ind_y_zeroes_or_zeros_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.y = 0x103
# $0000 ORA ($0010,S),Y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x13, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xCD, 0xAB))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_ora_sp_indexed_ind_y_turns_bits_on_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x0303
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.y = 0x103
# $0000 ORA ($0010,S),Y
# $0010 Vector to $01ABCD
self._write(mpu.memory, 0x0000, (0x13, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xCD, 0xAB))
self._write(mpu.memory, 0x01ABCD + mpu.y, (0x22, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x8323, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
# PHA
def test_pha_pushes_a_and_updates_sp(self):
mpu = self._make_mpu()
mpu.a = 0xABCD
# $0000 PHA
mpu.memory[0x0000] = 0x48
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.a)
self.assertEqual(0xAB, mpu.memory[0x01FF])
self.assertEqual(0xCD, mpu.memory[0x01FE])
self.assertEqual(0x1FD, mpu.sp)
# PHP
def test_php_pushes_processor_status_and_updates_sp(self):
for flags in range(0x100):
mpu = self._make_mpu()
mpu.p = flags & ((not mpu.MS) | (not mpu.IRS))
# $0000 PHP
mpu.memory[0x0000] = 0x08
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual((flags & ((not mpu.MS) | (not mpu.IRS))), mpu.memory[0x1FF])
self.assertEqual(0x1FE, mpu.sp)
# PHX
def test_phx_pushes_x_and_updates_sp(self):
mpu = self._make_mpu()
mpu.x = 0xABCD
# $0000 PHX
mpu.memory[0x0000] = 0xDA
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.x)
self.assertEqual(0xAB, mpu.memory[0x01FF])
self.assertEqual(0xCD, mpu.memory[0x01FE])
self.assertEqual(0x1FD, mpu.sp)
self.assertEqual(3, mpu.processorCycles)
# PHY
def test_phy_pushes_y_and_updates_sp(self):
mpu = self._make_mpu()
mpu.y = 0xABCD
# $0000 PHY
mpu.memory[0x0000] = 0x5A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.y)
self.assertEqual(0xAB, mpu.memory[0x01FF])
self.assertEqual(0xCD, mpu.memory[0x01FE])
self.assertEqual(0x1FD, mpu.sp)
self.assertEqual(3, mpu.processorCycles)
# PLA
def test_pla_pulls_top_byte_from_stack_into_a_and_updates_sp(self):
mpu = self._make_mpu()
# $0000 PLA
mpu.memory[0x0000] = 0x68
mpu.memory[0x01FF] = 0xAB
mpu.memory[0x01FE] = 0xCD
mpu.sp = 0x1FD
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.a)
self.assertEqual(0x1FF, mpu.sp)
# PLP
def test_plp_pulls_top_byte_from_stack_into_flags_and_updates_sp(self):
mpu = self._make_mpu()
# $0000 PLP
mpu.memory[0x0000] = 0x28
mpu.memory[0x01FF] = 0xCF # must have MS and IRS cleared
mpu.sp = 0x1FE
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xCF, mpu.p)
self.assertEqual(0x1FF, mpu.sp)
def test_plp_16_bit_to_8_affects_registers(self):
mpu = self._make_mpu()
mpu.a = 0x1234
mpu.x = 0x1234
mpu.y = 0x1234
mpu.sp = 0x1FE
mpu.memory[0x01FF] = 0xBA
self.assertEqual(0, mpu.p & mpu.MS)
self.assertEqual(0, mpu.p & mpu.IRS)
# $0000 PLP
mpu.memory[0x0000] = 0x28
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x34, mpu.a)
self.assertEqual(0x12, mpu.b)
self.assertEqual(0x34, mpu.x)
self.assertEqual(0x34, mpu.y)
self.assertEqual(mpu.MS, mpu.p & mpu.MS)
self.assertEqual(mpu.IRS, mpu.p & mpu.IRS)
self.assertEqual(0xBA, mpu.p)
self.assertEqual(0x1FF, mpu.sp)
# PLX
def test_plx_pulls_two_bytes_from_stack_into_x_and_updates_sp(self):
mpu = self._make_mpu()
# $0000 PLX
mpu.memory[0x0000] = 0xFA
mpu.memory[0x01FF] = 0xAB
mpu.memory[0x01FE] = 0xCD
mpu.sp = 0x1FD
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.x)
self.assertEqual(0x1FF, mpu.sp)
self.assertEqual(4, mpu.processorCycles)
# PLY
def test_ply_pulls_two_bytes_from_stack_into_y_and_updates_sp(self):
mpu = self._make_mpu()
# $0000 PLY
mpu.memory[0x0000] = 0x7A
mpu.memory[0x01FF] = 0xAB
mpu.memory[0x01FE] = 0xCD
mpu.sp = 0x1FD
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.y)
self.assertEqual(0x1FF, mpu.sp)
self.assertEqual(4, mpu.processorCycles)
# ROL Absolute
def test_rol_absolute_zero_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
# $0000 ROL $ABCD
self._write(mpu.memory, 0x0000, (0x2E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x00, mpu.memory[0xABCD+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_absolute_80_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.p &= ~(mpu.ZERO)
# $0000 ROL $ABCD
self._write(mpu.memory, 0x0000, (0x2E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x00, mpu.memory[0xABCD+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_absolute_80_and_carry_set_remains_set(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
mpu.p &= ~(mpu.ZERO)
# $0000 ROL $ABCD
self._write(mpu.memory, 0x0000, (0x2E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x01, mpu.memory[0xABCD])
self.assertEqual(0x00, mpu.memory[0xABCD+1])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_absolute_zero_and_carry_one_clears_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.p |= mpu.CARRY
# $0000 ROL $ABCD
self._write(mpu.memory, 0x0000, (0x2E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x01, mpu.memory[0xABCD])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_absolute_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 ROL $ABCD
self._write(mpu.memory, 0x0000, (0x2E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x40, 0x40))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x81, mpu.memory[0xABCD])
self.assertEqual(0x80, mpu.memory[0xABCD + 1])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_rol_absolute_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
# $0000 ROL $ABCD
self._write(mpu.memory, 0x0000, (0x2E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0x7F))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFE, mpu.memory[0xABCD])
self.assertEqual(0xFF, mpu.memory[0xABCD+1])
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_rol_absolute_shifts_out_one(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
# $0000 ROL $ABCD
self._write(mpu.memory, 0x0000, (0x2E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFE, mpu.memory[0xABCD])
self.assertEqual(0xFF, mpu.memory[0xABCD+1])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ROL Absolute, X-Indexed
def test_rol_abs_x_indexed_zero_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.x = 0x103
# $0000 ROL $ABCD,X
self._write(mpu.memory, 0x0000, (0x3E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_abs_x_indexed_80_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.p &= ~(mpu.ZERO)
mpu.x = 0x103
# $0000 ROL $ABCD,X
self._write(mpu.memory, 0x0000, (0x3E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_abs_x_indexed_zero_and_carry_one_clears_z_flag(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p |= mpu.CARRY
# $0000 ROL $ABCD,X
self._write(mpu.memory, 0x0000, (0x3E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x01, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_abs_x_indexed_sets_n_flag(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p |= mpu.CARRY
# $0000 ROL $ABCD,X
self._write(mpu.memory, 0x0000, (0x3E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x40, 0x40))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x81, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x80, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_rol_abs_x_indexed_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p &= ~(mpu.CARRY)
# $0000 ROL $ABCD,X
self._write(mpu.memory, 0x0000, (0x3E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0xFF, 0x7F))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFE, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_rol_abs_x_indexed_shifts_out_one(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p &= ~(mpu.CARRY)
# $0000 ROL $ABCD,X
self._write(mpu.memory, 0x0000, (0x3E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFE, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ROL Accumulator
def test_rol_accumulator_zero_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.p &= ~(mpu.CARRY)
# $0000 ROL A
mpu.memory[0x0000] = 0x2A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_accumulator_80_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0x8000
mpu.p &= ~(mpu.CARRY)
mpu.p &= ~(mpu.ZERO)
# $0000 ROL A
mpu.memory[0x0000] = 0x2A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_accumulator_zero_and_carry_one_clears_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.p |= mpu.CARRY
# $0000 ROL A
mpu.memory[0x0000] = 0x2A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x01, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_accumulator_sets_n_flag(self):
mpu = self._make_mpu()
mpu.a = 0x4040
mpu.p |= mpu.CARRY
# $0000 ROL A
mpu.memory[0x0000] = 0x2A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8081, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_rol_accumulator_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.a = 0x7FFF
mpu.p &= ~(mpu.CARRY)
# $0000 ROL A
mpu.memory[0x0000] = 0x2A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xFFFE, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_rol_accumulator_shifts_out_one(self):
mpu = self._make_mpu()
mpu.a = 0xFFFF
mpu.p &= ~(mpu.CARRY)
# $0000 ROL A
mpu.memory[0x0000] = 0x2A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xFFFE, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ROL Direct Page
def test_rol_dp_zero_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
# $0000 ROL $0010
self._write(mpu.memory, 0x0000, (0x26, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x00, mpu.memory[0x0010 + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_dp_80_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.p &= ~(mpu.ZERO)
# $0000 ROL $0010
self._write(mpu.memory, 0x0000, (0x26, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x00, mpu.memory[0x0010 + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_dp_zero_and_carry_one_clears_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.p |= mpu.CARRY
# $0000 ROL $0010
self._write(mpu.memory, 0x0000, (0x26, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.memory[0x0010])
self.assertEqual(0x00, mpu.memory[0x0010 + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_dp_sets_n_flag(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 ROL $0010
self._write(mpu.memory, 0x0000, (0x26, 0x10))
self._write(mpu.memory, 0x0010, (0x40, 0x40))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x81, mpu.memory[0x0010])
self.assertEqual(0x80, mpu.memory[0x0010 + 1])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_rol_dp_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
# $0000 ROL $0010
self._write(mpu.memory, 0x0000, (0x26, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0x7F))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFE, mpu.memory[0x0010])
self.assertEqual(0xFF, mpu.memory[0x0010] + 1)
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_rol_dp_shifts_out_one(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
# $0000 ROL $0010
self._write(mpu.memory, 0x0000, (0x26, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFE, mpu.memory[0x0010])
self.assertEqual(0xFF, mpu.memory[0x0010 + 1])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ROL Direct Page, X-Indexed
def test_rol_dp_x_indexed_zero_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.x = 0x103
# $0000 ROL $0010,X
self._write(mpu.memory, 0x0000, (0x36, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_dp_x_indexed_80_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
mpu.p &= ~(mpu.ZERO)
mpu.x = 0x103
self._write(mpu.memory, 0x0000, (0x36, 0x10))
# $0000 ROL $0010,X
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x80))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_dp_x_indexed_zero_and_carry_one_clears_z_flag(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p |= mpu.CARRY
self._write(mpu.memory, 0x0000, (0x36, 0x10))
# $0000 ROL $0010,X
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_rol_dp_x_indexed_sets_n_flag(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p |= mpu.CARRY
# $0000 ROL $0010,X
self._write(mpu.memory, 0x0000, (0x36, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x40, 0x40))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x81, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x80, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
def test_rol_dp_x_indexed_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p &= ~(mpu.CARRY)
# $0000 ROL $0010,X
self._write(mpu.memory, 0x0000, (0x36, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0xFF, 0x7F))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFE, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_rol_dp_x_indexed_shifts_out_one(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p &= ~(mpu.CARRY)
# $0000 ROL $0010,X
self._write(mpu.memory, 0x0000, (0x36, 0x10))
mpu.memory[0x0010 + mpu.x] = 0xFF
self._write(mpu.memory, 0x0010 + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFE, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ROR Absolute
def test_ror_absolute_zero_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
# $0000 ROR $ABCD
self._write(mpu.memory, 0x0000, (0x6E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x00, mpu.memory[0xABCD+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_ror_absolute_zero_and_carry_one_rotates_in_sets_n_flags(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 ROR $ABCD
self._write(mpu.memory, 0x0000, (0x6E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x80, mpu.memory[0xABCD+1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_ror_absolute_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 ROR $ABCD
self._write(mpu.memory, 0x0000, (0x6E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x02, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x01, mpu.memory[0xABCD])
self.assertEqual(0xC0, mpu.memory[0xABCD+1])
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_ror_absolute_shifts_out_one(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 ROR $ABCD
self._write(mpu.memory, 0x0000, (0x6E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x03, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x01, mpu.memory[0xABCD])
self.assertEqual(0xC0, mpu.memory[0xABCD+1])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_ror_absolute_carry_clear_shifts_out_one(self):
mpu = self._make_mpu()
# $0000 ROR $ABCD
self._write(mpu.memory, 0x0000, (0x6E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x03, 0x80))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x01, mpu.memory[0xABCD])
self.assertEqual(0x40, mpu.memory[0xABCD+1])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ROR Absolute, X-Indexed
def test_ror_abs_x_indexed_zero_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p &= ~(mpu.CARRY)
# $0000 ROR $ABCD,X
self._write(mpu.memory, 0x0000, (0x7E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_ror_abs_x_indexed_z_and_c_1_rotates_in_sets_n_flags(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p |= mpu.CARRY
# $0000 ROR $ABCD,X
self._write(mpu.memory, 0x0000, (0x7E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x80, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_ror_abs_x_indexed_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p |= mpu.CARRY
# $0000 ROR $ABCD,X
self._write(mpu.memory, 0x0000, (0x7E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x02, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x01, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x80, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_ror_abs_x_indexed_shifts_out_one(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p |= mpu.CARRY
# $0000 ROR $ABCD,X
self._write(mpu.memory, 0x0000, (0x7E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x03, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x01, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x80, mpu.memory[0xABCD + mpu.x + 1])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ROR Accumulator
def test_ror_accumulator_zero_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.p &= ~(mpu.CARRY)
# $0000 ROR A
mpu.memory[0x0000] = 0x6A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_ror_accumulator_zero_and_carry_one_rotates_in_sets_n_flags(self):
mpu = self._make_mpu()
mpu.a = 0x00
mpu.p |= mpu.CARRY
# $0000 ROR A
mpu.memory[0x0000] = 0x6A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_ror_accumulator_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.a = 0x02
mpu.p |= mpu.CARRY
# $0000 ROR A
mpu.memory[0x0000] = 0x6A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8001, mpu.a)
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_ror_accumulator_shifts_out_one(self):
mpu = self._make_mpu()
mpu.a = 0x03
mpu.p |= mpu.CARRY
# $0000 ROR A
mpu.memory[0x0000] = 0x6A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8001, mpu.a)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ROR Direct Page
def test_ror_dp_zero_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.CARRY)
# $0000 ROR $0010
self._write(mpu.memory, 0x0000, (0x66, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x00, mpu.memory[0x0010 + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_ror_dp_zero_and_carry_one_rotates_in_sets_n_flags(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 ROR $0010
self._write(mpu.memory, 0x0000, (0x66, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x80, mpu.memory[0x0010 + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_ror_dp_zero_absolute_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 ROR $0010
self._write(mpu.memory, 0x0000, (0x66, 0x10))
self._write(mpu.memory, 0x0010, (0x02, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.memory[0x0010])
self.assertEqual(0x80, mpu.memory[0x0010 + 1])
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_ror_dp_shifts_out_one(self):
mpu = self._make_mpu()
mpu.p |= mpu.CARRY
# $0000 ROR $0010
self._write(mpu.memory, 0x0000, (0x66, 0x10))
self._write(mpu.memory, 0x0010, (0x03, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.memory[0x0010])
self.assertEqual(0x80, mpu.memory[0x0010 + 1])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# ROR Direct Page, X-Indexed
def test_ror_dp_x_indexed_zero_and_carry_zero_sets_z_flag(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p &= ~(mpu.CARRY)
# $0000 ROR $0010,X
self._write(mpu.memory, 0x0000, (0x76, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_ror_dp_x_indexed_zero_and_carry_one_rotates_in_sets_n_flags(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p |= mpu.CARRY
# $0000 ROR $0010,X
self._write(mpu.memory, 0x0000, (0x76, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x80, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_ror_dp_x_indexed_zero_absolute_shifts_out_zero(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p |= mpu.CARRY
# $0000 ROR $0010,X
self._write(mpu.memory, 0x0000, (0x76, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x02, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x80, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_ror_dp_x_indexed_shifts_out_one(self):
mpu = self._make_mpu()
mpu.x = 0x103
mpu.p |= mpu.CARRY
# $0000 ROR $0010,X
self._write(mpu.memory, 0x0000, (0x76, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x03, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x01, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x80, mpu.memory[0x0010 + mpu.x + 1])
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# RTI
def test_rti_restores_status_and_pc_and_updates_sp(self):
mpu = self._make_mpu()
# $0000 RTI
mpu.memory[0x0000] = 0x40
self._write(mpu.memory, 0x01FC, (0xFC, 0x03, 0xC0, 0x00)) # Status, PCL, PCH, PBR
mpu.sp = 0x1FB
mpu.step()
self.assertEqual(0xC003, mpu.pc)
self.assertEqual(0xFC, mpu.p)
self.assertEqual(0x1FF, mpu.sp)
self.assertEqual(0, mpu.pbr)
def test_rti_16_bit_to_8_affects_registers(self):
mpu = self._make_mpu()
mpu.a = 0x1234
mpu.x = 0x1234
mpu.y = 0x1234
mpu.sp = 0x01FB
self.assertEqual(0, mpu.p & mpu.MS)
self.assertEqual(0, mpu.p & mpu.IRS)
# $0000 RTI
mpu.memory[0x0000] = 0x40
self._write(mpu.memory, 0x01FC, (0xBA, 0x03, 0xC0, 0x00)) # Status, PCL, PCH
mpu.step()
self.assertEqual(0xC003, mpu.pc)
self.assertEqual(0x34, mpu.a)
self.assertEqual(0x12, mpu.b)
self.assertEqual(0x34, mpu.x)
self.assertEqual(0x34, mpu.y)
self.assertEqual(mpu.MS, mpu.p & mpu.MS)
self.assertEqual(mpu.IRS, mpu.p & mpu.IRS)
self.assertEqual(0xBA, mpu.p)
self.assertEqual(0x1FF, mpu.sp)
self.assertEqual(0, mpu.pbr)
# *** TODO: probably makes sense to move the relevant values to the high byte or perhaps both since we've already tested the low byte in 8 bit ***
# *** TODO: need a test that sets overflow ***
# SBC Absolute
def test_sbc_abs_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
# $0000 SBC $ABCD
self._write(mpu.memory, 0x0000, (0xED, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
# $0000 SBC $ABCD
self._write(mpu.memory, 0x0000, (0xED, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x01, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
# $0000 SBC $ABCD
self._write(mpu.memory, 0x0000, (0xED, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
# $0000 SBC $ABCD
self._write(mpu.memory, 0x0000, (0xED, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x02, 0x00))
mpu.step()
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Absolute, X-Indexed
def test_sbc_abs_x_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
# $0000 SBC $FEE0,X
self._write(mpu.memory, 0x0000, (0xFD, 0xE0, 0xFE))
mpu.x = 0x0D
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_x_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
# $0000 SBC $FEE0,X
self._write(mpu.memory, 0x0000, (0xFD, 0xE0, 0xFE))
mpu.x = 0x0D
self._write(mpu.memory, 0xFEED, (0x01, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_x_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
# $0000 SBC $FEE0,X
self._write(mpu.memory, 0x0000, (0xFD, 0xE0, 0xFE))
mpu.x = 0x0D
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_x_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
# $0000 SBC $FEE0,X
self._write(mpu.memory, 0x0000, (0xFD, 0xE0, 0xFE))
mpu.x = 0x0D
self._write(mpu.memory, 0xFEED, (0x02, 0x00))
mpu.step()
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Absolute, Y-Indexed
def test_sbc_abs_y_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
# $0000 SBC $FEE0,Y
self._write(mpu.memory, 0x0000, (0xF9, 0xE0, 0xFE))
mpu.y = 0x0D
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_y_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
# $0000 SBC $FEE0,Y
self._write(mpu.memory, 0x0000, (0xF9, 0xE0, 0xFE))
mpu.y = 0x0D
self._write(mpu.memory, 0xFEED, (0x01, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_y_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
# $0000 SBC $FEE0,Y
self._write(mpu.memory, 0x0000, (0xF9, 0xE0, 0xFE))
mpu.y = 0x0D
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_y_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
# $0000 SBC $FEE0,Y
self._write(mpu.memory, 0x0000, (0xF9, 0xE0, 0xFE))
mpu.y = 0x0D
self._write(mpu.memory, 0xFEED, (0x02, 0x00))
mpu.step()
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Absolute Long
def test_sbc_abs_long_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
# $0000 SBC $01ABCD
self._write(mpu.memory, 0x0000, (0xEF, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_long_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
# $0000 SBC $01ABCD
self._write(mpu.memory, 0x0000, (0xEF, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x01, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_long_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
# $0000 SBC $01ABCD
self._write(mpu.memory, 0x0000, (0xEF, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_long_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
# $0000 SBC $01ABCD
self._write(mpu.memory, 0x0000, (0xEF, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x02, 0x00))
mpu.step()
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Absolute Long, X-Indexed
def test_sbc_abs_long_x_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
# $0000 SBC $01FEE0,X
self._write(mpu.memory, 0x0000, (0xFF, 0xE0, 0xFE, 0x01))
mpu.x = 0x0D
self._write(mpu.memory, 0x01FEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_long_x_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
# $0000 SBC $01FEE0,X
self._write(mpu.memory, 0x0000, (0xFF, 0xE0, 0xFE, 0x01))
mpu.x = 0x0D
self._write(mpu.memory, 0x01FEED, (0x01, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_long_x_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
# $0000 SBC $01FEE0,X
self._write(mpu.memory, 0x0000, (0xFF, 0xE0, 0xFE, 0x01))
mpu.x = 0x0D
self._write(mpu.memory, 0x01FEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_abs_long_x_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
# $0000 SBC $01FEE0,X
self._write(mpu.memory, 0x0000, (0xFF, 0xE0, 0xFE, 0x01))
mpu.x = 0x0D
self._write(mpu.memory, 0x01FEED, (0x02, 0x00))
mpu.step()
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Direct Page
def test_sbc_dp_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
# $0000 SBC $10
self._write(mpu.memory, 0x0000, (0xE5, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_dp_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
# $0000 SBC $10
self._write(mpu.memory, 0x0000, (0xE5, 0x10))
self._write(mpu.memory, 0x0010, (0x01, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_dp_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
# => SBC $10
self._write(mpu.memory, 0x0000, (0xE5, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_dp_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
# => SBC $10
self._write(mpu.memory, 0x0000, (0xE5, 0x10))
self._write(mpu.memory, 0x0010, (0x02, 0x00))
mpu.step()
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Direct Page, X-Indexed
def test_sbc_dp_x_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
# $0000 SBC $10,X
self._write(mpu.memory, 0x0000, (0xF5, 0x10))
mpu.x = 0x0D
self._write(mpu.memory, 0x001D, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_dp_x_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
# $0000 SBC $10,X
self._write(mpu.memory, 0x0000, (0xF5, 0x10))
mpu.x = 0x0D
self._write(mpu.memory, 0x001D, (0x01, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_dp_x_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
# $0000 SBC $10,X
self._write(mpu.memory, 0x0000, (0xF5, 0x10))
mpu.x = 0x0D
self._write(mpu.memory, 0x001D, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_dp_x_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
# $0000 SBC $10,X
self._write(mpu.memory, 0x0000, (0xF5, 0x10))
mpu.x = 0x0D
self._write(mpu.memory, 0x001D, (0x02, 0x00))
mpu.step()
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Direct Page Indirect, Indexed (X)
def test_sbc_ind_x_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
# $0000 SBC ($10,X)
# $0013 Vector to $FEED
self._write(mpu.memory, 0x0000, (0xE1, 0x10))
self._write(mpu.memory, 0x0013, (0xED, 0xFE))
mpu.x = 0x03
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_ind_x_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
# $0000 SBC ($10,X)
# $0013 Vector to $FEED
self._write(mpu.memory, 0x0000, (0xE1, 0x10))
self._write(mpu.memory, 0x0013, (0xED, 0xFE))
mpu.x = 0x03
self._write(mpu.memory, 0xFEED, (0x01, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_ind_x_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
# $0000 SBC ($10,X)
# $0013 Vector to $FEED
self._write(mpu.memory, 0x0000, (0xE1, 0x10))
self._write(mpu.memory, 0x0013, (0xED, 0xFE))
mpu.x = 0x03
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_ind_x_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
# $0000 SBC ($10,X)
# $0013 Vector to $FEED
self._write(mpu.memory, 0x0000, (0xE1, 0x10))
self._write(mpu.memory, 0x0013, (0xED, 0xFE))
mpu.x = 0x03
self._write(mpu.memory, 0xFEED, (0x02, 0x00))
mpu.step()
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Direct Page, Indirect
def test_sbc_dp_ind_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
# $0000 SBC ($10)
# $0010 Vector to $FEED
self._write(mpu.memory, 0x0000, (0xF2, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_dp_ind_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
# $0000 SBC ($10)
# $0010 Vector to $FEED
self._write(mpu.memory, 0x0000, (0xF2, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_dp_ind_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
# $0000 SBC ($10)
# $0010 Vector to $FEED
self._write(mpu.memory, 0x0000, (0xF2, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_dp_ind_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
# $0000 SBC ($10)
# $0010 Vector to $FEED
self._write(mpu.memory, 0x0000, (0xF2, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0x02, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Direct Page, Indirect Long
def test_sbc_dp_ind_long_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
# $0000 SBC ($10)
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0xE7, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE, 0x01))
self._write(mpu.memory, 0x01FEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_dp_ind_long_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
# $0000 SBC ($10)
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0xE7, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE, 0x01))
self._write(mpu.memory, 0x01FEED, (0x01, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_dp_ind_long_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
# $0000 SBC ($10)
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0xE7, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE, 0x01))
self._write(mpu.memory, 0x01FEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_dp_ind_long_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
# $0000 SBC ($10)
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0xE7, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE, 0x01))
self._write(mpu.memory, 0x01FEED, (0x02, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Direct Page Indexed, Indirect (Y)
def test_sbc_ind_y_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
mpu.y = 0x03
# $0000 SBC ($10),Y
# $0010 Vector to $FEED
self._write(mpu.memory, 0x0000, (0xF1, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE))
self._write(mpu.memory, 0xFEED + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_ind_y_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
mpu.y = 0x03
# $0000 SBC ($10),Y
# $0010 Vector to $FEED
self._write(mpu.memory, 0x0000, (0xF1, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE))
self._write(mpu.memory, 0xFEED + mpu.y, (0x01, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_ind_y_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
mpu.y = 0x03
# $0000 SBC ($10),Y
# $0010 Vector to $FEED
self._write(mpu.memory, 0x0000, (0xF1, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE))
self._write(mpu.memory, 0xFEED + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_ind_y_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
mpu.y = 0x03
# $0000 SBC ($10),Y
# $0010 Vector to $FEED
self._write(mpu.memory, 0x0000, (0xF1, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE))
self._write(mpu.memory, 0xFEED + mpu.y, (0x02, 0x00))
mpu.step()
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Direct Page Indexed, Indirect Long (Y)
def test_sbc_ind_long_y_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
mpu.y = 0x03
# $0000 SBC ($10),Y
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0xF7, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE, 0x01))
self._write(mpu.memory, 0x01FEED + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_ind_long_y_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
mpu.y = 0x03
# $0000 SBC ($10),Y
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0xF7, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE, 0x01))
self._write(mpu.memory, 0x01FEED + mpu.y, (0x01, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_ind_long_y_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
mpu.y = 0x03
# $0000 SBC ($10),Y
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0xF7, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE, 0x01))
self._write(mpu.memory, 0x01FEED + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_ind_long_y_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
mpu.y = 0x03
# $0000 SBC ($10),Y
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0xF7, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE, 0x01))
self._write(mpu.memory, 0x01FEED + mpu.y, (0x02, 0x00))
mpu.step()
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Immediate
def test_sbc_imm_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
# $0000 SBC #$00
self._write(mpu.memory, 0x0000, (0xE9, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_imm_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
# $0000 SBC #$01
self._write(mpu.memory, 0x0000, (0xE9, 0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_imm_downto_zero_with_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x01
# $0000 SBC #$00
self._write(mpu.memory, 0x0000, (0xE9, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_imm_downto_four_with_borrow_clears_z_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p &= ~(mpu.CARRY) # borrow = 1
mpu.a = 0x07
# $0000 SBC #$02
self._write(mpu.memory, 0x0000, (0xE9, 0x02, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x04, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.CARRY)
# SBC Stack Relative
def test_sbc_sp_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
mpu.sp = 0x1E0
# $0000 SBC $10,S
self._write(mpu.memory, 0x0000, (0xE3, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_sp_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
mpu.sp = 0x1E0
# $0000 SBC $10,S
self._write(mpu.memory, 0x0000, (0xE3, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0x01, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
# SBC Stack Relative Indexed, Indirect (Y)
def test_sbc_sp_ind_y_all_zeros_and_no_borrow_is_zero(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x00
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.y = 0x03
# $0000 SBC ($10,S),Y
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0xF3, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xED, 0xFE))
self._write(mpu.memory, 0x01FEED + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_sp_ind_y_downto_zero_no_borrow_sets_z_clears_n(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.DECIMAL)
mpu.p |= mpu.CARRY # borrow = 0
mpu.a = 0x01
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.y = 0x03
# $0000 SBC ($10,S),Y
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0xF3, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xED, 0xFE))
self._write(mpu.memory, 0x01FEED + mpu.y, (0x01, 0x00))
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(mpu.CARRY, mpu.CARRY)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_sbc_bcd_on_immediate_0a_minus_00_carry_set(self):
mpu = self._make_mpu()
mpu.p |= mpu.DECIMAL
mpu.p |= mpu.CARRY
mpu.a = 0x0a
# $0000 SBC #$00
self._write(mpu.memory, 0x0000, (0xe9, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x0a, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# the simulated 65816 fails this but I'm not sure it's valid in the first place as py65 has some errors in BCD
# I'm not interested in non-BCD functionality
def dont_test_sbc_bcd_on_immediate_9a_minus_00_carry_set(self):
mpu = self._make_mpu()
mpu.p |= mpu.DECIMAL
mpu.p |= mpu.CARRY
mpu.a = 0x9a
#$0000 SBC #$00
self._write(mpu.memory, 0x0000, (0xe9, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x9a, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
def test_sbc_bcd_on_immediate_99_minus_00_carry_set(self):
mpu = self._make_mpu()
mpu.p |= mpu.DECIMAL
mpu.p |= mpu.CARRY
mpu.a = 0x9999
#$0000 SBC #$00
self._write(mpu.memory, 0x0000, (0xe9, 0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x9999, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
def test_sbc_bcd_on_immediate_00_minus_01_carry_set(self):
mpu = self._make_mpu()
mpu.p |= mpu.DECIMAL
mpu.p |= mpu.OVERFLOW
mpu.p |= mpu.ZERO
mpu.p |= mpu.CARRY
mpu.a = 0x00
# => $0000 SBC #$00
self._write(mpu.memory, 0x0000, (0xe9, 0x01, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x9999, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0, mpu.p & mpu.CARRY)
def test_sbc_bcd_on_immediate_20_minus_0a_carry_unset(self):
mpu = self._make_mpu()
mpu.p |= mpu.DECIMAL
mpu.a = 0x20
# $0000 SBC #$00
self._write(mpu.memory, 0x0000, (0xe9, 0x0a, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x1f, mpu.a)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
self.assertEqual(0, mpu.p & mpu.OVERFLOW)
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(mpu.CARRY, mpu.p & mpu.CARRY)
# SEP
def test_sep_16_bit_to_8_affects_registers(self):
mpu = self._make_mpu()
mpu.a = 0x1234
mpu.x = 0x1234
mpu.y = 0x1234
self.assertEqual(0, mpu.p & mpu.MS)
self.assertEqual(0, mpu.p & mpu.IRS)
# $0000 SEP #$30
self._write(mpu.memory, 0x0000, (0xE2, 0x30))
mpu.step()
self.assertEqual(0x34, mpu.a)
self.assertEqual(0x12, mpu.b)
self.assertEqual(0x34, mpu.x)
self.assertEqual(0x34, mpu.y)
self.assertEqual(mpu.MS, mpu.p & mpu.MS)
self.assertEqual(mpu.IRS, mpu.p & mpu.IRS)
# STA Absolute
def test_sta_absolute_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
# $0000 STA $ABCD
self._write(mpu.memory, 0x0000, (0x8D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0xABCD])
self.assertEqual(0xFF, mpu.memory[0xABCD+1])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_absolute_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
# $0000 STA $ABCD
self._write(mpu.memory, 0x0000, (0x8D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x00, mpu.memory[0xABCD+1])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Absolute, X-Indexed
def test_sta_abs_x_indexed_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
mpu.x = 0x103
# $0000 STA $ABCD,X
self._write(mpu.memory, 0x0000, (0x9D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.x+1])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_abs_x_indexed_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
mpu.x = 0x103
# $0000 STA $ABCD,X
self._write(mpu.memory, 0x0000, (0x9D, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x])
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.x+1])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Absolute, Y-Indexed
def test_sta_abs_y_indexed_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
mpu.y = 0x103
# $0000 STA $ABCD,Y
self._write(mpu.memory, 0x0000, (0x99, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.y])
self.assertEqual(0xFF, mpu.memory[0xABCD + mpu.y+1])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_abs_y_indexed_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
mpu.y = 0x103
# $0000 STA $ABCD,Y
self._write(mpu.memory, 0x0000, (0x99, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.y])
self.assertEqual(0x00, mpu.memory[0xABCD + mpu.y+1])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Absolute Long
def test_sta_absolute_long_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
# $0000 STA $01ABCD
self._write(mpu.memory, 0x0000, (0x8F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x01ABCD])
self.assertEqual(0xFF, mpu.memory[0x01ABCD+1])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_absolute_long_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
# $0000 STA $01ABCD
self._write(mpu.memory, 0x0000, (0x8F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x01ABCD])
self.assertEqual(0x00, mpu.memory[0x01ABCD+1])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Absolute Long, X-Indexed
def test_sta_abs_long_x_indexed_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
mpu.x = 0x103
# $0000 STA $01ABCD,X
self._write(mpu.memory, 0x0000, (0x9F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x01ABCD + mpu.x])
self.assertEqual(0xFF, mpu.memory[0x01ABCD + mpu.x+1])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_abs_long_x_indexed_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
mpu.x = 0x103
# $0000 STA $01ABCD,X
self._write(mpu.memory, 0x0000, (0x9F, 0xCD, 0xAB, 0x01))
self._write(mpu.memory, 0x01ABCD + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0004, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x01ABCD + mpu.x])
self.assertEqual(0x00, mpu.memory[0x01ABCD + mpu.x+1])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Direct Page
def test_sta_dp_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
# $0000 STA $0010
self._write(mpu.memory, 0x0000, (0x85, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x0010])
self.assertEqual(0xFF, mpu.memory[0x0010+1])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_dp_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
# $0000 STA $0010
self._write(mpu.memory, 0x0000, (0x85, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x00, mpu.memory[0x0010+1])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Direct Page, X-Indexed
def test_sta_dp_x_indexed_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
mpu.x = 0x103
# $0000 STA $0010,X
self._write(mpu.memory, 0x0000, (0x95, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.x+1])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_dp_x_indexed_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
mpu.x = 0x103
# $0000 STA $0010,X
self._write(mpu.memory, 0x0000, (0x95, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x+1])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Direct Page, Indirect
def test_sta_dp_ind_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
# $0000 STA ($0010)
# $0010 Vector to $FEED
self._write(mpu.memory, 0x0000, (0x92, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0xFF, mpu.memory[0xFEED])
self.assertEqual(0xFF, mpu.memory[0xFEEE])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_dp_ind_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
# $0000 STA ($0010)
# $0010 Vector to $FEED
self._write(mpu.memory, 0x0000, (0x92, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
self.assertEqual(0x00, mpu.memory[0xFEED])
self.assertEqual(0x00, mpu.memory[0xFEEE])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Direct Page, Indirect Long
def test_sta_dp_ind_long_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
# $0000 STA ($0010)
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0x87, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE, 0x01))
self._write(mpu.memory, 0x01FEED, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0xFF, mpu.memory[0x01FEED])
self.assertEqual(0xFF, mpu.memory[0x01FEEE])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_dp_ind_long_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
# $0000 STA ($0010)
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0x87, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE, 0x01))
self._write(mpu.memory, 0x01FEED, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
self.assertEqual(0x00, mpu.memory[0x01FEED])
self.assertEqual(0x00, mpu.memory[0x01FEEE])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Direct Page Indirect, Indexed (X)
def test_sta_ind_indexed_x_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
mpu.x = 0x103
# $0000 STA ($0010,X)
# $0013 Vector to $FEED
self._write(mpu.memory, 0x0000, (0x81, 0x10))
self._write(mpu.memory, 0x0113, (0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0xFEED])
self.assertEqual(0xFF, mpu.memory[0xFEEE])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_ind_indexed_x_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
mpu.x = 0x103
# $0000 STA ($0010,X)
# $0013 Vector to $FEED
self._write(mpu.memory, 0x0000, (0x81, 0x10))
self._write(mpu.memory, 0x0113, (0xED, 0xFE))
self._write(mpu.memory, 0xFEED, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xFEED])
self.assertEqual(0x00, mpu.memory[0xFEEE])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Direct Page Indexed, Indirect (Y)
def test_sta_indexed_ind_y_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
mpu.y = 0x103
# $0000 STA ($0010),Y
# $0010 Vector to $FEED
self._write(mpu.memory, 0x0000, (0x91, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE))
mpu.memory[0xFEED + mpu.y] = 0x00
mpu.memory[0xFEEE + mpu.y] = 0x00
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0xFEED + mpu.y])
self.assertEqual(0xFF, mpu.memory[0xFEEE + mpu.y])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_indexed_ind_y_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
mpu.y = 0x103
# $0000 STA ($0010),Y
# $0010 Vector to $FEED
self._write(mpu.memory, 0x0000, (0x91, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE))
mpu.memory[0xFEED + mpu.y] = 0xFF
mpu.memory[0xFEEE + mpu.y] = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xFEED + mpu.y])
self.assertEqual(0x00, mpu.memory[0xFEEE + mpu.y])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Direct Page Indexed, Indirect Long (Y)
def test_sta_indexed_ind_long_y_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
mpu.y = 0x103
# $0000 STA ($0010),Y
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0x97, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE, 0x01))
mpu.memory[0xFEED + mpu.y] = 0x00
mpu.memory[0xFEEE + mpu.y] = 0x00
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x01FEED + mpu.y])
self.assertEqual(0xFF, mpu.memory[0x01FEEE + mpu.y])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_indexed_ind_long_y_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
mpu.y = 0x103
# $0000 STA ($0010),Y
# $0010 Vector to 01$FEED
self._write(mpu.memory, 0x0000, (0x97, 0x10))
self._write(mpu.memory, 0x0010, (0xED, 0xFE, 0x01))
mpu.memory[0xFEED + mpu.y] = 0xFF
mpu.memory[0xFEEE + mpu.y] = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x01FEED + mpu.y])
self.assertEqual(0x00, mpu.memory[0x01FEEE + mpu.y])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Stack Relative
def test_sta_sp_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
mpu.sp = 0x1E0
# $0000 STA $0010,S
self._write(mpu.memory, 0x0000, (0x83, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.sp])
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.sp+1])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_sp_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
mpu.sp = 0x1E0
# $0000 STA $0010,S
self._write(mpu.memory, 0x0000, (0x83, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.sp])
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.sp+1])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STA Stack Relative Indexed, Indirect (Y)
def test_sta_sp_indexed_ind_y_stores_a_leaves_a_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.a = 0xFFFF
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.y = 0x103
# $0000 STA ($0010,S),Y
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0x93, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xED, 0xFE))
mpu.memory[0x01FEED + mpu.y] = 0x00
mpu.memory[0x01FEEE + mpu.y] = 0x00
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x01FEED + mpu.y])
self.assertEqual(0xFF, mpu.memory[0x01FEEE + mpu.y])
self.assertEqual(0xFFFF, mpu.a)
self.assertEqual(flags, mpu.p)
def test_sta_sp_indexed_ind_y_stores_a_leaves_a_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.a = 0x00
mpu.sp = 0x1E0
mpu.dbr = 1
mpu.y = 0x103
# $0000 STA ($0010,S),Y
# $0010 Vector to $01FEED
self._write(mpu.memory, 0x0000, (0x93, 0x10))
self._write(mpu.memory, 0x0010 + mpu.sp, (0xED, 0xFE))
mpu.memory[0x01FEED + mpu.y] = 0xFF
mpu.memory[0x01FEEE + mpu.y] = 0xFF
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x01FEED + mpu.y])
self.assertEqual(0x00, mpu.memory[0x01FEEE + mpu.y])
self.assertEqual(0x00, mpu.a)
self.assertEqual(flags, mpu.p)
# STX Absolute
def test_stx_absolute_stores_x_leaves_x_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.x = 0xFFFF
# $0000 STX $ABCD
self._write(mpu.memory, 0x0000, (0x8E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0xABCD])
self.assertEqual(0xFF, mpu.memory[0xABCD+1])
self.assertEqual(0xFFFF, mpu.x)
self.assertEqual(flags, mpu.p)
def test_stx_absolute_stores_x_leaves_x_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.x = 0x00
# $0000 STX $ABCD
self._write(mpu.memory, 0x0000, (0x8E, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x00, mpu.memory[0xABCD+1])
self.assertEqual(0x00, mpu.x)
self.assertEqual(flags, mpu.p)
# STX Direct Page
def test_stx_dp_stores_x_leaves_x_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.x = 0xFFFF
# $0000 STX $0010
self._write(mpu.memory, 0x0000, (0x86, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x0010])
self.assertEqual(0xFF, mpu.memory[0x0010+1])
self.assertEqual(0xFFFF, mpu.x)
self.assertEqual(flags, mpu.p)
def test_stx_dp_stores_x_leaves_x_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.x = 0x00
# $0000 STX $0010
self._write(mpu.memory, 0x0000, (0x86, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x00, mpu.memory[0x0010+1])
self.assertEqual(0x00, mpu.x)
self.assertEqual(flags, mpu.p)
# STX Direct Page, Y-Indexed
def test_stx_dp_y_indexed_stores_x_leaves_x_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.x = 0xFFFF
mpu.y = 0x103
# $0000 STX $0010,Y
self._write(mpu.memory, 0x0000, (0x96, 0x10))
self._write(mpu.memory, 0x0010 + mpu.y, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.y])
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.y+1])
self.assertEqual(0xFFFF, mpu.x)
self.assertEqual(flags, mpu.p)
def test_stx_dp_y_indexed_stores_x_leaves_x_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.x = 0x00
mpu.y = 0x103
# $0000 STX $0010,Y
self._write(mpu.memory, 0x0000, (0x96, 0x10))
self._write(mpu.memory, 0x0010 + mpu.y, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.y])
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.y+1])
self.assertEqual(0x00, mpu.x)
self.assertEqual(flags, mpu.p)
# STY Absolute
def test_sty_absolute_stores_y_leaves_y_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.y = 0xFFFF
# $0000 STY $ABCD
self._write(mpu.memory, 0x0000, (0x8C, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0xABCD])
self.assertEqual(0xFF, mpu.memory[0xABCD+1])
self.assertEqual(0xFFFF, mpu.y)
self.assertEqual(flags, mpu.p)
def test_sty_absolute_stores_y_leaves_y_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.y = 0x00
# $0000 STY $ABCD
self._write(mpu.memory, 0x0000, (0x8C, 0xCD, 0xAB))
self._write(mpu.memory, 0xABCD, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(0x00, mpu.memory[0xABCD])
self.assertEqual(0x00, mpu.memory[0xABCD+1])
self.assertEqual(0x00, mpu.y)
self.assertEqual(flags, mpu.p)
# STY Direct Page
def test_sty_dp_stores_y_leaves_y_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.y = 0xFFFF
# $0000 STY $0010
self._write(mpu.memory, 0x0000, (0x84, 0x10))
self._write(mpu.memory, 0x0010, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x0010])
self.assertEqual(0xFF, mpu.memory[0x0010+1])
self.assertEqual(0xFFFF, mpu.y)
self.assertEqual(flags, mpu.p)
def test_sty_dp_stores_y_leaves_y_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.y = 0x00
# $0000 STY $0010
self._write(mpu.memory, 0x0000, (0x84, 0x10))
self._write(mpu.memory, 0x0010, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010])
self.assertEqual(0x00, mpu.memory[0x0010+1])
self.assertEqual(0x00, mpu.y)
self.assertEqual(flags, mpu.p)
# STY Direct Page, X-Indexed
def test_sty_dp_x_indexed_stores_y_leaves_y_and_n_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.NEGATIVE)
mpu.y = 0xFFFF
mpu.x = 0x103
# $0000 STY $0010,X
self._write(mpu.memory, 0x0000, (0x94, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0x00, 0x00))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0xFF, mpu.memory[0x0010 + mpu.x+1])
self.assertEqual(0xFFFF, mpu.y)
self.assertEqual(flags, mpu.p)
def test_sty_dp_x_indexed_stores_y_leaves_y_and_z_flag_unchanged(self):
mpu = self._make_mpu()
mpu.p = flags = 0xCF & ~(mpu.ZERO)
mpu.y = 0x00
mpu.x = 0x103
# $0000 STY $0010,X
self._write(mpu.memory, 0x0000, (0x94, 0x10))
self._write(mpu.memory, 0x0010 + mpu.x, (0xFF, 0xFF))
mpu.step()
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x])
self.assertEqual(0x00, mpu.memory[0x0010 + mpu.x+1])
self.assertEqual(0x00, mpu.y)
self.assertEqual(flags, mpu.p)
# STZ Absolute
def test_stz_abs_stores_zero(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0xFEED + mpu.x, (0xFF, 0xFF))
# $0000 STZ $FEED
mpu.memory[0x0000:0x0000 + 3] = [0x9C, 0xED, 0xFE]
mpu.step()
self.assertEqual(0x00, mpu.memory[0xFEED])
self.assertEqual(0x00, mpu.memory[0xFEED+1])
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
# STZ Absolute, X-Indexed
def test_stz_abs_x_stores_zero(self):
mpu = self._make_mpu()
mpu.x = 0x0D
self._write(mpu.memory, 0xFEED + mpu.x, (0xFF, 0xFF))
# $0000 STZ $FEE0,X
mpu.memory[0x0000:0x0000 + 3] = [0x9E, 0xE0, 0xFE]
mpu.step()
self.assertEqual(0x00, mpu.memory[0xFEED])
self.assertEqual(0x00, mpu.memory[0xFEED+1])
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
# STZ Direct Page
def test_stz_dp_stores_zero(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x0032, (0xFF, 0xFF))
# #0000 STZ $32
mpu.memory[0x0000:0x0000 + 2] = [0x64, 0x32]
mpu.step()
self.assertEqual(0x00, mpu.memory[0x0032])
self.assertEqual(0x00, mpu.memory[0x0032+1])
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(3, mpu.processorCycles)
# STZ Direct Page, X-Indexed
def test_stz_dp_x_stores_zero(self):
mpu = self._make_mpu()
mpu.x = 0x0D
self._write(mpu.memory, 0x0032 + mpu.x, (0xFF, 0xFF))
# $0000 STZ $32,X
mpu.memory[0x0000:0x0000 + 2] = [0x74, 0x32]
mpu.step()
self.assertEqual(0x00, mpu.memory[0x0032 + mpu.x])
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(4, mpu.processorCycles)
# TAX
def test_tax_transfers_accumulator_into_x(self):
mpu = self._make_mpu()
mpu.a = 0xABCD
mpu.x = 0x00
# $0000 TAX
mpu.memory[0x0000] = 0xAA
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.a)
self.assertEqual(0xABCD, mpu.x)
def test_tax_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x8000
mpu.x = 0x00
# $0000 TAX
mpu.memory[0x0000] = 0xAA
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(0x8000, mpu.x)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_tax_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.x = 0xFFFF
# $0000 TAX
mpu.memory[0x0000] = 0xAA
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0x00, mpu.x)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_tax_transfers_16_bit_accumulator_into_8_bit_x(self):
mpu = self._make_mpu()
mpu.a = 0xABCD
mpu.x = 0x00
self.assertEqual(0, mpu.p & mpu.IRS)
mpu.pSET(mpu.IRS) # 8-bit index registers
self.assertEqual(mpu.IRS, mpu.p & mpu.IRS)
# $0000 TAX
mpu.memory[0x0000] = 0xAA
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.a)
self.assertEqual(0xCD, mpu.x)
def test_tax_transfers_8_bit_accumulator_into_16_bit_x(self):
mpu = self._make_mpu()
mpu.a = 0xCD
mpu.b = 0xAB
mpu.x = 0x00
self.assertEqual(0, mpu.p & mpu.MS)
mpu.pSET(mpu.MS) # 8-bit accumulator
self.assertEqual(mpu.MS, mpu.p & mpu.MS)
# $0000 TAX
mpu.memory[0x0000] = 0xAA
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.x)
self.assertEqual(0xCD, mpu.a)
self.assertEqual(0xAB, mpu.b)
# TAY
def test_tay_transfers_accumulator_into_y(self):
mpu = self._make_mpu()
mpu.a = 0xABCD
mpu.y = 0x00
# $0000 TAY
mpu.memory[0x0000] = 0xA8
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.a)
self.assertEqual(0xABCD, mpu.y)
def test_tay_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x8000
mpu.y = 0x00
# $0000 TAY
mpu.memory[0x0000] = 0xA8
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(0x8000, mpu.y)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_tay_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
mpu.y = 0xFFFF
# $0000 TAY
mpu.memory[0x0000] = 0xA8
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0x00, mpu.y)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_tay_transfers_16_bit_accumulator_into_8_bit_y(self):
mpu = self._make_mpu()
mpu.a = 0xABCD
mpu.y = 0x00
self.assertEqual(0, mpu.p & mpu.IRS)
mpu.pSET(mpu.IRS) # 8-bit index registers
self.assertEqual(mpu.IRS, mpu.p & mpu.IRS)
# $0000 TAY
mpu.memory[0x0000] = 0xA8
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.a)
self.assertEqual(0xCD, mpu.y)
def test_tay_transfers_8_bit_accumulator_into_16_bit_y(self):
mpu = self._make_mpu()
mpu.a = 0xCD
mpu.b = 0xAB
mpu.y = 0x00
self.assertEqual(0, mpu.p & mpu.MS)
mpu.pSET(mpu.MS) # 8-bit accumulator
self.assertEqual(mpu.MS, mpu.p & mpu.MS)
# $0000 TAY
mpu.memory[0x0000] = 0xA8
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.y)
self.assertEqual(0xCD, mpu.a)
self.assertEqual(0xAB, mpu.b)
# TCD
def test_tcd_transfers_accumulator_into_d(self):
mpu = self._make_mpu()
mpu.a = 0xABCD
# $0000 TCD
mpu.memory[0x0000] = 0x5B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.a)
self.assertEqual(0xABCD, mpu.dpr)
def test_tcd_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x8000
# $0000 TCD
mpu.memory[0x0000] = 0x5B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(0x8000, mpu.dpr)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_tcd_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
# $0000 TCD
mpu.memory[0x0000] = 0x5B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0x00, mpu.dpr)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
# TCS
def test_tcs_transfers_accumulator_into_s(self):
mpu = self._make_mpu()
mpu.a = 0xABCD
# $0000 TCS
mpu.memory[0x0000] = 0x1B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.a)
self.assertEqual(0xABCD, mpu.sp)
def test_tcs_does_not_set_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x8000
# $0000 TCS
mpu.memory[0x0000] = 0x1B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(0x8000, mpu.sp)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_tcs_does_not_set_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00
# $0000 TCS
mpu.memory[0x0000] = 0x1B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0x00, mpu.sp)
self.assertEqual(0, mpu.p & mpu.ZERO)
# TDC
def test_tdc_transfers_d_to_accumulator(self):
mpu = self._make_mpu()
mpu.dpr = 0xABCD
# $0000 TDC
mpu.memory[0x0000] = 0x7B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.a)
self.assertEqual(0xABCD, mpu.dpr)
def test_tdc_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.dpr = 0x8000
# $0000 TDC
mpu.memory[0x0000] = 0x7B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(0x8000, mpu.dpr)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_tdc_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.dpr = 0x00
# $0000 TDC
mpu.memory[0x0000] = 0x7B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0x00, mpu.dpr)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
# TRB Absolute
def test_trb_abs_ones(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0xFEED, (0xE0, 0xE0))
# $0000 TRB $FEED
self._write(mpu.memory, 0x0000, [0x1C, 0xED, 0xFE])
mpu.a = 0x7070
mpu.step()
self.assertEqual(0x80, mpu.memory[0xFEED])
self.assertEqual(0x80, mpu.memory[0xFEED+1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
def test_trb_abs_zeros(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0xFEED, (0x80, 0x80))
# $0000 TRB $FEED
self._write(mpu.memory, 0x0000, [0x1C, 0xED, 0xFE])
mpu.a = 0x6060
mpu.step()
self.assertEqual(0x80, mpu.memory[0xFEED])
self.assertEqual(0x80, mpu.memory[0xFEED+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
# TRB Direct Page
def test_trb_dp_ones(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x00BB, (0xE0, 0xE0))
# $0000 TRB $BB
self._write(mpu.memory, 0x0000, [0x14, 0xBB])
mpu.a = 0x7070
mpu.step()
self.assertEqual(0x80, mpu.memory[0x00BB])
self.assertEqual(0x80, mpu.memory[0x00BB+1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
def test_trb_dp_zeros(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x00BB, (0x80, 0x80))
# $0000 TRB $BB
self._write(mpu.memory, 0x0000, [0x14, 0xBB])
mpu.a = 0x6060
mpu.step()
self.assertEqual(0x80, mpu.memory[0x00BB])
self.assertEqual(0x80, mpu.memory[0x00BB+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
# TSB Absolute
def test_tsb_abs_ones(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0xFEED, (0xE0, 0xE0))
# $0000 TSB $FEED
self._write(mpu.memory, 0x0000, [0x0C, 0xED, 0xFE])
mpu.a = 0x7070
mpu.step()
self.assertEqual(0xF0, mpu.memory[0xFEED])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
def test_tsb_abs_zeros(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0xFEED, (0x80, 0x80))
# $0000 TSB $FEED
self._write(mpu.memory, 0x0000, [0x0C, 0xED, 0xFE])
mpu.a = 0x6060
mpu.step()
self.assertEqual(0xE0, mpu.memory[0xFEED])
self.assertEqual(0xE0, mpu.memory[0xFEED+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0x0003, mpu.pc)
self.assertEqual(6, mpu.processorCycles)
# TSB Direct Page
def test_tsb_dp_ones(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x00BB, (0xE0, 0xE0))
# $0000 TSB $BB
self._write(mpu.memory, 0x0000, [0x04, 0xBB])
mpu.a = 0x7070
mpu.step()
self.assertEqual(0xF0, mpu.memory[0x00BB])
self.assertEqual(0xF0, mpu.memory[0x00BB+1])
self.assertEqual(0, mpu.p & mpu.ZERO)
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
def test_tsb_dp_zeros(self):
mpu = self._make_mpu()
self._write(mpu.memory, 0x00BB, (0x80, 0x80))
# $0000 TSB $BB
self._write(mpu.memory, 0x0000, [0x04, 0xBB])
mpu.a = 0x6060
mpu.step()
self.assertEqual(0xE0, mpu.memory[0x00BB])
self.assertEqual(0xE0, mpu.memory[0x00BB+1])
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0x0002, mpu.pc)
self.assertEqual(5, mpu.processorCycles)
# TSC
def test_tsc_transfers_accumulator_into_s(self):
mpu = self._make_mpu()
mpu.sp = 0xABCD
# $0000 TSC
mpu.memory[0x0000] = 0x3B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.a)
self.assertEqual(0xABCD, mpu.sp)
def test_tsc_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.sp = 0x8000
# $0000 TSC
mpu.memory[0x0000] = 0x3B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(0x8000, mpu.sp)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_tsc_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.sp = 0x00
# $0000 TSC
mpu.memory[0x0000] = 0x3B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0x00, mpu.sp)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
# TSX
def test_tsx_transfers_stack_pointer_into_x(self):
mpu = self._make_mpu()
mpu.sp = 0xABCD
mpu.x = 0x00
# $0000 TSX
mpu.memory[0x0000] = 0xBA
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.sp)
self.assertEqual(0xABCD, mpu.x)
def test_tsx_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.sp = 0x8000
mpu.x = 0x00
# $0000 TSX
mpu.memory[0x0000] = 0xBA
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.sp)
self.assertEqual(0x8000, mpu.x)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_tsx_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.sp = 0x00
mpu.x = 0xFFFF
# $0000 TSX
mpu.memory[0x0000] = 0xBA
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.sp)
self.assertEqual(0x00, mpu.x)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
# TXA
def test_txa_transfers_x_into_a(self):
mpu = self._make_mpu()
mpu.x = 0xABCD
mpu.a = 0x00
# $0000 TXA
mpu.memory[0x0000] = 0x8A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.a)
self.assertEqual(0xABCD, mpu.x)
def test_txa_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.x = 0x8000
mpu.a = 0x00
# $0000 TXA
mpu.memory[0x0000] = 0x8A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(0x8000, mpu.x)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_txa_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.x = 0x00
mpu.a = 0xFFFF
# $0000 TXA
mpu.memory[0x0000] = 0x8A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.a)
self.assertEqual(0x00, mpu.x)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
def test_txa_transfers_16_bit_x_into_8_bit_accumulator(self):
mpu = self._make_mpu()
mpu.a = 0xCD
mpu.b = 0xAB
mpu.x = 0x1234
self.assertEqual(0, mpu.p & mpu.MS)
mpu.pSET(mpu.MS) # 8-bit accumulator
self.assertEqual(mpu.MS, mpu.p & mpu.MS)
# $0000 TXA
mpu.memory[0x0000] = 0x8A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x34, mpu.a)
self.assertEqual(0xAB, mpu.b)
self.assertEqual(0x1234, mpu.x)
def test_txa_transfers_8_bit_x_into_16_bit_accumulator(self):
mpu = self._make_mpu()
mpu.a = 0xABCD
mpu.b = 0x0
mpu.x = 0x34
self.assertEqual(0, mpu.p & mpu.IRS)
mpu.pSET(mpu.IRS) # 8-bit index registers
self.assertEqual(mpu.IRS, mpu.p & mpu.IRS)
# $0000 TXA
mpu.memory[0x0000] = 0x8A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x34, mpu.x)
self.assertEqual(0x34, mpu.a)
self.assertEqual(0x0, mpu.b)
# TXS
def test_txs_transfers_x_into_stack_pointer(self):
mpu = self._make_mpu()
mpu.x = 0xABCD
# $0000 TXS
mpu.memory[0x0000] = 0x9A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.sp)
self.assertEqual(0xABCD, mpu.x)
def test_txs_does_not_set_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.x = 0x8000
# $0000 TXS
mpu.memory[0x0000] = 0x9A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.sp)
self.assertEqual(0x8000, mpu.x)
self.assertEqual(0, mpu.p & mpu.NEGATIVE)
def test_txs_does_not_set_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.x = 0x00
# $0000 TXS
mpu.memory[0x0000] = 0x9A
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.sp)
self.assertEqual(0x00, mpu.x)
self.assertEqual(0, mpu.p & mpu.ZERO)
# TXY
def test_txy_transfers_x_into_y(self):
mpu = self._make_mpu()
mpu.x = 0xABCD
mpu.y = 0x00
# $0000 TXY
mpu.memory[0x0000] = 0x9B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.y)
self.assertEqual(0xABCD, mpu.x)
def test_txy_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.x = 0x8000
mpu.y = 0x00
# $0000 TXY
mpu.memory[0x0000] = 0x9B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.y)
self.assertEqual(0x8000, mpu.x)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_txy_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.x = 0x00
mpu.y = 0xFFFF
# $0000 TXY
mpu.memory[0x0000] = 0x9B
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.y)
self.assertEqual(0x00, mpu.x)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
# TYA
def test_tya_transfers_y_into_a(self):
mpu = self._make_mpu()
mpu.y = 0xABCD
mpu.a = 0x00
# $0000 TYA
mpu.memory[0x0000] = 0x98
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.a)
self.assertEqual(0xABCD, mpu.y)
def test_tya_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.y = 0x8000
mpu.a = 0x00
# $0000 TYA
mpu.memory[0x0000] = 0x98
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.a)
self.assertEqual(0x8000, mpu.y)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_tya_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.y = 0x00
mpu.a = 0xFFFF
# $0000 TYA
mpu.memory[0x0000] = 0x98
mpu.step()
self.assertEqual(0x00, mpu.a)
self.assertEqual(0x00, mpu.y)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
self.assertEqual(0x0001, mpu.pc)
def test_tya_transfers_16_bit_y_into_8_bit_accumulator(self):
mpu = self._make_mpu()
mpu.a = 0xCD
mpu.b = 0xAB
mpu.y = 0x1234
self.assertEqual(0, mpu.p & mpu.MS)
mpu.pSET(mpu.MS) # 8-bit accumulator
self.assertEqual(mpu.MS, mpu.p & mpu.MS)
# $0000 TYA
mpu.memory[0x0000] = 0x98
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x34, mpu.a)
self.assertEqual(0xAB, mpu.b)
self.assertEqual(0x1234, mpu.y)
def test_tya_transfers_8_bit_y_into_16_bit_accumulator(self):
mpu = self._make_mpu()
mpu.a = 0xABCD
mpu.b = 0x0
mpu.y = 0x34
self.assertEqual(0, mpu.p & mpu.IRS)
mpu.pSET(mpu.IRS) # 8-bit index registers
self.assertEqual(mpu.IRS, mpu.p & mpu.IRS)
# $0000 TYA
mpu.memory[0x0000] = 0x98
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x34, mpu.y)
self.assertEqual(0x34, mpu.a)
self.assertEqual(0x0, mpu.b)
# TYX
def test_tyx_transfers_y_into_x(self):
mpu = self._make_mpu()
mpu.y = 0xABCD
mpu.x = 0x00
# $0000 TYX
mpu.memory[0x0000] = 0xBB
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xABCD, mpu.y)
self.assertEqual(0xABCD, mpu.x)
def test_tyx_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.y = 0x8000
mpu.x = 0x00
# $0000 TYX
mpu.memory[0x0000] = 0xBB
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x8000, mpu.y)
self.assertEqual(0x8000, mpu.x)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_tyx_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.y = 0x00
mpu.x = 0xFFFF
# $0000 TYX
mpu.memory[0x0000] = 0xBB
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x00, mpu.y)
self.assertEqual(0x00, mpu.x)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
# XBA
def test_xba_exchanges_b_and_a(self):
mpu = self._make_mpu()
mpu.a = 0xABCD
# $0000 XBA
mpu.memory[0x0000] = 0xEB
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xCDAB, mpu.a)
def test_xba_sets_negative_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.NEGATIVE)
mpu.a = 0x8000
# $0000 XBA
mpu.memory[0x0000] = 0xEB
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0x0080, mpu.a)
self.assertEqual(mpu.NEGATIVE, mpu.p & mpu.NEGATIVE)
def test_xba_sets_zero_flag(self):
mpu = self._make_mpu()
mpu.p &= ~(mpu.ZERO)
mpu.a = 0x00FF
# $0000 XBA
mpu.memory[0x0000] = 0xEB
mpu.step()
self.assertEqual(0x0001, mpu.pc)
self.assertEqual(0xFF00, mpu.a)
self.assertEqual(mpu.ZERO, mpu.p & mpu.ZERO)
# XCE
def test_xce_exchange_c_and_e_bits(self):
mpu = self._make_mpu() # native mode, carry is cleared
mpu.pSET(mpu.CARRY)
mpu.memory[0x0000] = 0xFB
mpu.step()
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(mpu.BREAK, mpu.p & mpu.BREAK)
self.assertEqual(mpu.UNUSED, mpu.p & mpu.UNUSED)
self.assertEqual(1, mpu.mode)
def test_xce_forces_a_to_8_bits(self):
mpu = self._make_mpu() # native mode, carry is cleared
mpu.a = 0xabcd
mpu.pSET(mpu.CARRY)
mpu.memory[0x0000] = 0xFB
mpu.step()
self.assertEqual(0, mpu.p & mpu.CARRY)
self.assertEqual(1, mpu.mode)
self.assertEqual(0xcd, mpu.a)
self.assertEqual(0xab, mpu.b)
# Test Helpers
def _make_mpu(self, *args, **kargs):
klass = self._get_target_class()
mpu = klass(*args, **kargs)
if 'memory' not in kargs:
mpu.memory = 0x30000 * [0xAA]
# set native mode
mpu.pCLR(mpu.CARRY)
mpu.inst_0xfb() # XCE
mpu.pCLR(mpu.CARRY) # many 6502 based tests expect the carry flag to be clear
mpu.pCLR(mpu.MS)
mpu.pCLR(mpu.IRS)
# py65 mpus have sp set to $ff, I've modeled the 65816
# based on the physical chip which requires sp to be set
# in software. The core tests assume sp is set to $ff,
# so we have to set sp here
mpu.sp = 0x1ff
return mpu
def _write(self, memory, start_address, bytes):
memory[start_address:start_address + len(bytes)] = bytes
def _get_target_class(self):
return MPU
def test_suite():
return unittest.findTestCases(sys.modules[__name__])
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
| 36.762792 | 150 | 0.601829 | 46,388 | 335,534 | 4.177826 | 0.015974 | 0.208668 | 0.049592 | 0.109783 | 0.97467 | 0.968581 | 0.957993 | 0.946486 | 0.941817 | 0.93257 | 0 | 0.105639 | 0.267973 | 335,534 | 9,126 | 151 | 36.76682 | 0.683389 | 0.061278 | 0 | 0.864505 | 0 | 0 | 0.000096 | 0 | 0 | 0 | 0.107139 | 0.00011 | 0.372544 | 1 | 0.088361 | false | 0 | 0.00055 | 0.000275 | 0.08946 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
3746b8090ac45367c1000674c020041bbc6b85cc | 12,437 | py | Python | fit.py | Allen319/TnPtuple | 16b389ad6fb6652ae5e8d5321137b015e7e6c5cc | [
"MIT"
] | null | null | null | fit.py | Allen319/TnPtuple | 16b389ad6fb6652ae5e8d5321137b015e7e6c5cc | [
"MIT"
] | null | null | null | fit.py | Allen319/TnPtuple | 16b389ad6fb6652ae5e8d5321137b015e7e6c5cc | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import ROOT, array
ROOT.gROOT.LoadMacro('libCpp/RooCMSShape.cc+')
ROOT.gROOT.SetBatch(1)
import sys, getopt
import yaml
import copy
def do1DFit(rootFile, obs, aBin, flag, theWorkSpace, outputDir):
theWorkSpace.factory("expr::nSignalPass('efficiency*fSigAll*numTot', efficiency, fSigAll[0.9,0,1],numTot[1,0,1e10])")
theWorkSpace.factory("expr::nSignalFail('(1-efficiency)*fSigAll*numTot', efficiency, fSigAll,numTot)")
theWorkSpace.factory("expr::nBkgPass('effBkg*(1-fSigAll)*numTot', effBkg[0.9,0,1],fSigAll,numTot)")
theWorkSpace.factory("expr::nBkgFail('(1-effBkg)*(1-fSigAll)*numTot', effBkg,fSigAll,numTot)")
theWorkSpace.factory("SUM::passing(nSignalPass*signalPass,nBkgPass*backgroundPass)")
theWorkSpace.factory("SUM::failling(nSignalFail*signalFail,nBkgFail*backgroundFail)")
theWorkSpace.factory("expr::nPass('nSignalPass+nBkgPass',nSignalPass,nBkgPass)")
theWorkSpace.factory("expr::nFail('nSignalFail+nBkgFail',nSignalFail,nBkgFail)")
theWorkSpace.factory("SUM::tot(nPass*passing, nFail*failling)")
theWorkSpace.factory("SUM::bgExtended(nBkgPass*backgroundPass,theZero[0]*backgroundFail)")
TnPcat = ROOT.RooCategory("TnP","TnP")
TnPcat.defineType("passing")
TnPcat.defineType("failling")
simPdf= ROOT.RooSimultaneous("simPdf","simultaneous pdf",TnPcat)
simPdf.addPdf(theWorkSpace.pdf("passing"),"passing")
simPdf.addPdf( theWorkSpace.pdf("failling"),"failling")
nameofHisto = obs+"_"+str(aBin)+"_"+flag
histoPass = rootFile.Get(nameofHisto+"1")
histoFail = rootFile.Get(nameofHisto+"0")
histoAll = rootFile.Get(nameofHisto+"total")
print(histoFail)
dataPass= ROOT.RooDataHist("dataPass","dataPass", ROOT.RooArgList(theWorkSpace.var("mass")),histoPass)
dataFail = ROOT.RooDataHist("dataFail","dataFail", ROOT.RooArgList(theWorkSpace.var("mass")),histoFail)
dataAll = ROOT.RooDataHist("dataAll","dataAll", ROOT.RooArgList(theWorkSpace.var("mass")),histoAll)
combData = ROOT.RooDataHist("combData","combined data", ROOT.RooArgList(theWorkSpace.var("mass")),ROOT.RooFit.Index(TnPcat),ROOT.RooFit.Import("passing", dataPass),ROOT.RooFit.Import("failling", dataFail))
simPdf.fitTo(combData)
simPdf.fitTo(combData)
simPdf.fitTo(combData)
xframe = theWorkSpace.var("mass").frame(ROOT.RooFit.Title("TnP model Passing"),ROOT.RooFit.Bins(50))
dataPass.plotOn(xframe)
theWorkSpace.pdf("passing").plotOn(xframe,ROOT.RooFit.LineColor(ROOT.kGreen))
#cmdArg1 = ROOT.RooLinkedList();
#cmdArg1.Add(ROOT.RooFit.Components(ROOT.RooArgSet(theWorkSpace.pdf("backgroundPass"))))
#cmdArg1.Add(ROOT.RooFit.LineStyle(ROOT.kDashed))
#cmdArg1.Add(ROOT.RooFit.LineColor(ROOT.kGreen))
theWorkSpace.pdf("passing").plotOn(xframe,ROOT.RooFit.Components("backgroundPass"), ROOT.RooFit.LineStyle(ROOT.kDashed), ROOT.RooFit.LineColor(ROOT.kGreen))
#theWorkSpace.pdf("passing").plotOn(xframe,ROOT.RooFit.Components(ROOT.RooArgSet(theWorkSpace.pdf("backgroundPass"))))
#theWorkSpace.pdf("passing").plotOn(xframe, cmdArg1)
xframe2 = theWorkSpace.var("mass").frame(ROOT.RooFit.Title("TnP model Failling"),ROOT.RooFit.Bins(50))
dataFail.plotOn(xframe2)
theWorkSpace.pdf("failling").plotOn(xframe2,ROOT.RooFit.LineColor(ROOT.kRed))
theWorkSpace.pdf("failling").plotOn(xframe2,ROOT.RooFit.Components("backgroundFail"), ROOT.RooFit.LineStyle(ROOT.kDashed),ROOT.RooFit.LineColor(ROOT.kRed))
xframe3 = theWorkSpace.var("mass").frame(ROOT.RooFit.Title("TnP model Total"),ROOT.RooFit.Bins(50))
dataAll.plotOn(xframe3)
theWorkSpace.pdf("tot").plotOn(xframe3,ROOT.RooFit.LineColor(ROOT.kBlue))
numTot = theWorkSpace.var("numTot").getVal()
fSigAll = theWorkSpace.var("fSigAll").getVal()
efficiency = theWorkSpace.var("efficiency").getVal()
effBkg = theWorkSpace.var("effBkg").getVal()
theEfficiency = theWorkSpace.var("efficiency").getVal()
theEffError = theWorkSpace.var("efficiency").getError()
nbPass = (efficiency*fSigAll*numTot+effBkg*(1-fSigAll)*numTot)
nbFail = ((1-efficiency)*fSigAll*numTot + (1-effBkg)*(1-fSigAll)*numTot)
print("nb pass ", nbPass)
print("nbfail ",nbFail)
c0 = ROOT.TCanvas("c0","coucou",800,800)
c0.SetFillColor(0)
c0.Divide(2,2)
c0.cd(1)
xframe.Draw()
c0.cd(2)
xframe2.Draw()
c0.cd(3)
xframe3.Draw()
c0.Print(outputDir+"/"+nameofHisto+".png")
return (theEfficiency,theEffError)
def do2DFit(rootFile, histoNames, obs1, obs2, firstBin, secondBin, flag, theWorkSpace, outputDir):
theWorkSpace.factory("expr::nSignalPass('efficiency*fSigAll*numTot', efficiency, fSigAll[0.9,0,1],numTot[1,0,1e10])")
theWorkSpace.factory("expr::nSignalFail('(1-efficiency)*fSigAll*numTot', efficiency, fSigAll,numTot)")
theWorkSpace.factory("expr::nBkgPass('effBkg*(1-fSigAll)*numTot', effBkg[0.9,0,1],fSigAll,numTot)")
theWorkSpace.factory("expr::nBkgFail('(1-effBkg)*(1-fSigAll)*numTot', effBkg,fSigAll,numTot)")
theWorkSpace.factory("SUM::passing(nSignalPass*signalPass,nBkgPass*backgroundPass)")
theWorkSpace.factory("SUM::failling(nSignalFail*signalFail,nBkgFail*backgroundFail)")
theWorkSpace.factory("expr::nPass('nSignalPass+nBkgPass',nSignalPass,nBkgPass)")
theWorkSpace.factory("expr::nFail('nSignalFail+nBkgFail',nSignalFail,nBkgFail)")
theWorkSpace.factory("SUM::tot(nPass*passing, nFail*failling)")
theWorkSpace.factory("SUM::bgExtended(nBkgPass*backgroundPass,theZero[0]*backgroundFail)")
TnPcat = ROOT.RooCategory("TnP","TnP")
TnPcat.defineType("passing")
TnPcat.defineType("failling")
simPdf= ROOT.RooSimultaneous("simPdf","simultaneous pdf",TnPcat)
simPdf.addPdf(theWorkSpace.pdf("passing"),"passing")
simPdf.addPdf( theWorkSpace.pdf("failling"),"failling")
nameofHisto = obs1+obs2+"_"+str(firstBin)+"-"+str(secondBin)+"_"+flag
print(nameofHisto+"0")
if nameofHisto+"0" in histoNames:
histoFail = copy.deepcopy(rootFile.Get(nameofHisto+"0"))
else:
histoFail = copy.deepcopy(rootFile.Get(nameofHisto+"total"))
histoFail.Scale(0.0)
histoFail.SetEntries(0)
if nameofHisto+"1" in histoNames:
histoPass = rootFile.Get(nameofHisto+"1")
else:
histoPass = copy.deepcopy(rootFile.Get(nameofHisto+"total"))
histoPass.Scale(0.0)
histoPass.SetEntries(0)
histoAll = rootFile.Get(nameofHisto+"total")
dataPass= ROOT.RooDataHist("dataPass","dataPass", ROOT.RooArgList(theWorkSpace.var("mass")),histoPass)
dataFail = ROOT.RooDataHist("dataFail","dataFail", ROOT.RooArgList(theWorkSpace.var("mass")),histoFail)
dataAll = ROOT.RooDataHist("dataAll","dataAll", ROOT.RooArgList(theWorkSpace.var("mass")),histoAll)
combData = ROOT.RooDataHist("combData","combined data", ROOT.RooArgList(theWorkSpace.var("mass")),ROOT.RooFit.Index(TnPcat),ROOT.RooFit.Import("passing", dataPass),ROOT.RooFit.Import("failling", dataFail))
simPdf.fitTo(combData)
simPdf.fitTo(combData)
simPdf.fitTo(combData)
xframe = theWorkSpace.var("mass").frame(ROOT.RooFit.Title("TnP model Passing"),ROOT.RooFit.Bins(50))
dataPass.plotOn(xframe)
theWorkSpace.pdf("passing").plotOn(xframe,ROOT.RooFit.LineColor(ROOT.kGreen))
#cmdArg1 = ROOT.RooLinkedList();
#cmdArg1.Add(ROOT.RooFit.Components(ROOT.RooArgSet(theWorkSpace.pdf("backgroundPass"))))
#cmdArg1.Add(ROOT.RooFit.LineStyle(ROOT.kDashed))
#cmdArg1.Add(ROOT.RooFit.LineColor(ROOT.kGreen))
theWorkSpace.pdf("passing").plotOn(xframe,ROOT.RooFit.Components("backgroundPass"), ROOT.RooFit.LineStyle(ROOT.kDashed), ROOT.RooFit.LineColor(ROOT.kGreen))
#theWorkSpace.pdf("passing").plotOn(xframe,ROOT.RooFit.Components(ROOT.RooArgSet(theWorkSpace.pdf("backgroundPass"))))
#theWorkSpace.pdf("passing").plotOn(xframe, cmdArg1)
xframe2 = theWorkSpace.var("mass").frame(ROOT.RooFit.Title("TnP model Failling"),ROOT.RooFit.Bins(50))
dataFail.plotOn(xframe2)
theWorkSpace.pdf("failling").plotOn(xframe2,ROOT.RooFit.LineColor(ROOT.kRed))
theWorkSpace.pdf("failling").plotOn(xframe2,ROOT.RooFit.Components("backgroundFail"), ROOT.RooFit.LineStyle(ROOT.kDashed),ROOT.RooFit.LineColor(ROOT.kRed))
xframe3 = theWorkSpace.var("mass").frame(ROOT.RooFit.Title("TnP model Total"),ROOT.RooFit.Bins(50))
dataAll.plotOn(xframe3)
theWorkSpace.pdf("tot").plotOn(xframe3,ROOT.RooFit.LineColor(ROOT.kBlue))
numTot = theWorkSpace.var("numTot").getVal()
fSigAll = theWorkSpace.var("fSigAll").getVal()
efficiency = theWorkSpace.var("efficiency").getVal()
effBkg = theWorkSpace.var("effBkg").getVal()
theEfficiency = theWorkSpace.var("efficiency").getVal()
theEffError = theWorkSpace.var("efficiency").getError()
nbPass = (efficiency*fSigAll*numTot+effBkg*(1-fSigAll)*numTot)
nbFail = ((1-efficiency)*fSigAll*numTot + (1-effBkg)*(1-fSigAll)*numTot)
print("nb pass ", nbPass)
print("nbfail ",nbFail)
c0 = ROOT.TCanvas("c0","coucou",800,800)
c0.SetFillColor(0)
c0.Divide(2,2)
c0.cd(1)
xframe.Draw()
c0.cd(2)
xframe2.Draw()
c0.cd(3)
xframe3.Draw()
c0.Print(outputDir+"/"+nameofHisto+".png")
return (theEfficiency,theEffError)
def main(argv):
inputfile = ''
outputdir = ''
yamlfile = '../config.yaml'
samplename = 'mc'
fitmodel = 'vpvPlusExpo' #default
try:
opts, args = getopt.getopt(argv,"hi:o:y:s:f:",["inputFile=","outputDir=","yamlFile=", "sampleName=","fitModel="])
except getopt.GetoptError:
err_line = ""
err_line += "test.py -h\n"
err_line += "-i input\n"
err_line += "-o output\n"
err_line += "-y configFile\n"
err_line += "-f fitModel\n"
err_line += "-s sampleName\n"
print(err_line)
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print('test.py -i <inputfile>')
sys.exit()
elif opt in ("-i", "--inputFile"):
inputfile = arg
elif opt in ("-o", "--outputDir"):
outputdir = arg
elif opt in ("-y", "--yamlFile"):
yamlfile = arg
elif opt in ("-s", "--sampleName"):
samplename = arg
elif opt in ("-f", "--fitModel"):
fitmodel = arg
f1 = ROOT.TFile(inputfile)
f2 = open(yamlfile)
config = yaml.load(f2)
theWorkSpace = ROOT.RooWorkspace("theWorkSpace")
# theWorkSpace.factory("mass[90,70,130]")
for aLine in config["pdfs"][fitmodel]:
theWorkSpace.factory(aLine)
print(aLine)
###write all histogram names in the list###
histoNames = []
for i in range(0,f1.GetListOfKeys().Capacity()):
histoNames.append(f1.GetListOfKeys().At(i).GetName())
### create root file to save efficiencies
f3 = ROOT.TFile(outputdir+"/efficiencies.root","update")
### 1D fit ###
for flag in config['flags']:
for obs in config['observable']:
h1 = ROOT.TH1F(samplename+'_'+obs+'_'+flag, obs+' '+flag,len(config["binning"][obs])-1, array.array("d",config["binning"][obs]))
for aBin in range (1,len(config["binning"][obs])):
effs = do1DFit(f1, obs , aBin, flag, theWorkSpace, outputdir)
h1.SetBinContent(aBin, effs[0])
h1.SetBinError(aBin, effs[1])
h1.Write()
### 2D fit ###
for flag in config['flags']:
for obs in config['observable2D']:
h2 = ROOT.TH2F(samplename+'_'+obs+config['observable2D'][obs]+'_'+flag, obs+' '+config['observable2D'][obs]+' '+flag, len(config["binning"][obs])-1, array.array("d",config["binning"][obs]), len(config["binning"][config['observable2D'][obs]])-1, array.array("d",config["binning"][config['observable2D'][obs]]))
for secondBin in range (1,len(config["binning"][config['observable2D'][obs]])):
for firstBin in range (1,len(config["binning"][obs])):
effs = do2DFit (f1,histoNames, obs, config['observable2D'][obs], firstBin, secondBin, flag, theWorkSpace, outputdir)
h2.SetBinContent(firstBin, secondBin, effs[0] )
h2.SetBinError(firstBin, secondBin, effs[1] )
h2.Write()
### 2D fit with 1D binning ###
for flag in config['flags']:
for obs in config['observable2D']:
for firstBin in range (1,len(config["binning"][obs])):
h3 = ROOT.TH1F(samplename+'_'+config['observable2D'][obs]+'_'+obs+str(firstBin)+'_'+flag, obs+'%.1f'%config["binning"][obs][firstBin-1]+'-'+'%.1f'%config["binning"][obs][firstBin]+' '+config['observable2D'][obs]+' '+flag, len(config["binning"][config['observable2D'][obs]])-1, array.array("d",config["binning"][config['observable2D'][obs]]))
for secondBin in range (1,len(config["binning"][config['observable2D'][obs]])):
effs = do2DFit (f1,histoNames, obs, config['observable2D'][obs], firstBin, secondBin, flag, theWorkSpace, outputdir)
h3.SetBinContent(secondBin, effs[0] )
h3.SetBinError(secondBin, effs[1] )
h3.Write()
f3.Close()
f1.Close()
if __name__ == '__main__':
main(sys.argv[1:])
| 42.447099 | 345 | 0.719788 | 1,516 | 12,437 | 5.887203 | 0.144459 | 0.0493 | 0.029804 | 0.030924 | 0.809972 | 0.787227 | 0.764594 | 0.759776 | 0.756303 | 0.748123 | 0 | 0.019536 | 0.094557 | 12,437 | 292 | 346 | 42.592466 | 0.773022 | 0.076144 | 0 | 0.601896 | 0 | 0.018957 | 0.238141 | 0.105879 | 0 | 0 | 0 | 0 | 0 | 1 | 0.014218 | false | 0.175355 | 0.028436 | 0 | 0.052133 | 0.042654 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 7 |
3775d81d350678584481b78826378f1bbe1a17d4 | 14,445 | py | Python | pymtl3/passes/sverilog/translation/test/SVTranslator_L1_cases_test.py | hsqforfun/pymtl3 | 05e06601cf262a663a95d1235cb99056ece84580 | [
"BSD-3-Clause"
] | 1 | 2019-11-12T12:26:01.000Z | 2019-11-12T12:26:01.000Z | pymtl3/passes/sverilog/translation/test/SVTranslator_L1_cases_test.py | hsqforfun/pymtl3 | 05e06601cf262a663a95d1235cb99056ece84580 | [
"BSD-3-Clause"
] | null | null | null | pymtl3/passes/sverilog/translation/test/SVTranslator_L1_cases_test.py | hsqforfun/pymtl3 | 05e06601cf262a663a95d1235cb99056ece84580 | [
"BSD-3-Clause"
] | null | null | null | #=========================================================================
# SVTranslator_L1_cases_test.py
#=========================================================================
"""Test the SystemVerilog translator."""
from pymtl3.datatypes import Bits1, Bits4, Bits32, Bits64, concat, sext, zext
from pymtl3.dsl import Component, InPort, OutPort, Wire, connect
from pymtl3.passes.rtlir.util.test_utility import do_test
from pymtl3.passes.sverilog.translation.structural.test.SVStructuralTranslatorL1_test import (
check_eq,
)
from pymtl3.passes.sverilog.translation.SVTranslator import SVTranslator
def local_do_test( m ):
m.elaborate()
tr = SVTranslator( m )
tr.translate( m )
check_eq( tr.hierarchy.src, m._ref_src )
#-------------------------------------------------------------------------
# Behavioral
#-------------------------------------------------------------------------
def test_comb_assign( do_test ):
class A( Component ):
def construct( s ):
s.in_ = InPort( Bits32 )
s.out = OutPort( Bits32 )
@s.update
def upblk():
s.out = s.in_
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_,
output logic [31:0] out,
input logic [0:0] reset
);
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out = s.in_
always_comb begin : upblk
out = in_;
end
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_seq_assign( do_test ):
class A( Component ):
def construct( s ):
s.in_ = InPort( Bits32 )
s.out = OutPort( Bits32 )
@s.update_ff
def upblk():
s.out <<= s.in_
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_,
output logic [31:0] out,
input logic [0:0] reset
);
// PYMTL SOURCE:
//
// @s.update_ff
// def upblk():
// s.out <<= s.in_
always_ff @(posedge clk) begin : upblk
out <= in_;
end
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_concat( do_test ):
class A( Component ):
def construct( s ):
s.in_1 = InPort( Bits32 )
s.in_2 = InPort( Bits32 )
s.out = OutPort( Bits64 )
@s.update
def upblk():
s.out = concat( s.in_1, s.in_2 )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_1,
input logic [31:0] in_2,
output logic [63:0] out,
input logic [0:0] reset
);
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out = concat( s.in_1, s.in_2 )
always_comb begin : upblk
out = { in_1, in_2 };
end
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_concat_constants( do_test ):
class A( Component ):
def construct( s ):
s.out = OutPort( Bits64 )
@s.update
def upblk():
s.out = concat( Bits32(42), Bits32(0) )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
output logic [63:0] out,
input logic [0:0] reset
);
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out = concat( Bits32(42), Bits32(0) )
always_comb begin : upblk
out = { 32'd42, 32'd0 };
end
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_concat_mixed( do_test ):
class A( Component ):
def construct( s ):
s.in_ = InPort( Bits32 )
s.out = OutPort( Bits64 )
@s.update
def upblk():
s.out = concat( s.in_, Bits32(0) )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_,
output logic [63:0] out,
input logic [0:0] reset
);
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out = concat( s.in_, Bits32(0) )
always_comb begin : upblk
out = { in_, 32'd0 };
end
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_sext( do_test ):
class A( Component ):
def construct( s ):
s.in_ = InPort( Bits32 )
s.out = OutPort( Bits64 )
@s.update
def upblk():
s.out = sext( s.in_, 64 )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_,
output logic [63:0] out,
input logic [0:0] reset
);
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out = sext( s.in_, 64 )
always_comb begin : upblk
out = { { 32 { in_[31] } }, in_ };
end
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_zext( do_test ):
class A( Component ):
def construct( s ):
s.in_ = InPort( Bits32 )
s.out = OutPort( Bits64 )
@s.update
def upblk():
s.out = zext( s.in_, 64 )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_,
output logic [63:0] out,
input logic [0:0] reset
);
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out = zext( s.in_, 64 )
always_comb begin : upblk
out = { { 32 { 1'b0 } }, in_ };
end
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_freevar( do_test ):
class A( Component ):
def construct( s ):
STATE_IDLE = Bits32(42)
s.in_ = InPort( Bits32 )
s.out = OutPort( Bits64 )
@s.update
def upblk():
s.out = concat( s.in_, STATE_IDLE )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_,
output logic [63:0] out,
input logic [0:0] reset
);
localparam [31:0] __const__STATE_IDLE = 32'd42;
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out = concat( s.in_, STATE_IDLE )
always_comb begin : upblk
out = { in_, __const__STATE_IDLE };
end
endmodule
"""
a._ref_src_yosys = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_,
output logic [63:0] out,
input logic [0:0] reset
);
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out = concat( s.in_, STATE_IDLE )
always_comb begin : upblk
out = { in_, 32'd42 };
end
endmodule
"""
do_test( a )
def test_unpacked_signal_index( do_test ):
class A( Component ):
def construct( s ):
s.in_ = [ InPort( Bits32 ) for _ in range(2) ]
s.out = OutPort( Bits64 )
@s.update
def upblk():
s.out = concat( s.in_[0], s.in_[1] )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_ [0:1],
output logic [63:0] out,
input logic [0:0] reset
);
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out = concat( s.in_[0], s.in_[1] )
always_comb begin : upblk
out = { in_[0], in_[1] };
end
endmodule
"""
a._ref_src_yosys = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in___0,
input logic [31:0] in___1,
output logic [63:0] out,
input logic [0:0] reset
);
logic [31:0] in_ [0:1];
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out = concat( s.in_[0], s.in_[1] )
always_comb begin : upblk
out = { in_[0], in_[1] };
end
assign in_[0] = in___0;
assign in_[1] = in___1;
endmodule
"""
do_test( a )
def test_bit_selection( do_test ):
class A( Component ):
def construct( s ):
s.in_ = InPort( Bits32 )
s.out = OutPort( Bits1 )
@s.update
def upblk():
s.out = s.in_[1]
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_,
output logic [0:0] out,
input logic [0:0] reset
);
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out = s.in_[1]
always_comb begin : upblk
out = in_[1];
end
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_part_selection( do_test ):
class A( Component ):
def construct( s ):
s.in_ = InPort( Bits64 )
s.out = OutPort( Bits32 )
@s.update
def upblk():
s.out = s.in_[4:36]
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [63:0] in_,
output logic [31:0] out,
input logic [0:0] reset
);
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out = s.in_[4:36]
always_comb begin : upblk
out = in_[35:4];
end
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
#-------------------------------------------------------------------------
# Structural
#-------------------------------------------------------------------------
def test_port_wire( do_test ):
class A( Component ):
def construct( s ):
s.in_ = InPort( Bits32 )
s.wire_ = Wire( Bits32 )
s.out = OutPort( Bits32 )
connect( s.in_, s.wire_ )
connect( s.wire_, s.out )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_,
output logic [31:0] out,
input logic [0:0] reset
);
logic [31:0] wire_;
assign wire_ = in_;
assign out = wire_;
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_connect_constant( do_test ):
class A( Component ):
def construct( s ):
s.out = OutPort( Bits32 )
connect( 42, s.out )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
output logic [31:0] out,
input logic [0:0] reset
);
assign out = 32'd42;
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_port_const_unaccessed( do_test ):
class A( Component ):
def construct( s ):
s.STATE_IDLE = 42
s.out = OutPort( Bits32 )
connect( s.STATE_IDLE, s.out )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
output logic [31:0] out,
input logic [0:0] reset
);
assign out = 32'd42;
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_port_const_accessed( do_test ):
class A( Component ):
def construct( s ):
s.STATE_IDLE = 42
s.out_1 = OutPort( Bits32 )
s.out_2 = OutPort( Bits32 )
connect( s.STATE_IDLE, s.out_1 )
@s.update
def upblk():
s.out_2 = s.STATE_IDLE
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
output logic [31:0] out_1,
output logic [31:0] out_2,
input logic [0:0] reset
);
localparam [31:0] STATE_IDLE = 32'd42;
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out_2 = s.STATE_IDLE
always_comb begin : upblk
out_2 = STATE_IDLE;
end
assign out_1 = 32'd42;
endmodule
"""
a._ref_src_yosys = \
"""
module A
(
input logic [0:0] clk,
output logic [31:0] out_1,
output logic [31:0] out_2,
input logic [0:0] reset
);
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.out_2 = s.STATE_IDLE
always_comb begin : upblk
out_2 = 32'd42;
end
assign out_1 = 32'd42;
endmodule
"""
do_test( a )
def test_port_const_array( do_test ):
class A( Component ):
def construct( s ):
s.STATES = [ 1, 2, 3, 4, 5 ]
s.out = [ OutPort( Bits32 ) for _ in range(5) ]
s.tmp = OutPort( Bits32 )
for i in range(5):
connect( s.STATES[i], s.out[i] )
@s.update
def upblk():
s.tmp = s.STATES[0]
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
output logic [31:0] out [0:4],
input logic [0:0] reset,
output logic [31:0] tmp
);
localparam [31:0] STATES [0:4] = '{ 32'd1, 32'd2, 32'd3, 32'd4, 32'd5 };
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.tmp = s.STATES[0]
always_comb begin : upblk
tmp = STATES[0];
end
assign out[0] = 32'd1;
assign out[1] = 32'd2;
assign out[2] = 32'd3;
assign out[3] = 32'd4;
assign out[4] = 32'd5;
endmodule
"""
a._ref_src_yosys = \
"""
module A
(
input logic [0:0] clk,
output logic [31:0] out__0,
output logic [31:0] out__1,
output logic [31:0] out__2,
output logic [31:0] out__3,
output logic [31:0] out__4,
input logic [0:0] reset,
output logic [31:0] tmp
);
logic [31:0] out [0:4];
// PYMTL SOURCE:
//
// @s.update
// def upblk():
// s.tmp = s.STATES[0]
always_comb begin : upblk
tmp = 32'd1;
end
assign out__0 = out[0];
assign out__1 = out[1];
assign out__2 = out[2];
assign out__3 = out[3];
assign out__4 = out[4];
assign out[0] = 32'd1;
assign out[1] = 32'd2;
assign out[2] = 32'd3;
assign out[3] = 32'd4;
assign out[4] = 32'd5;
endmodule
"""
do_test( a )
def test_port_bit_selection( do_test ):
class A( Component ):
def construct( s ):
s.in_ = InPort( Bits32 )
s.out = OutPort( Bits1 )
connect( s.out, s.in_[2] )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_,
output logic [0:0] out,
input logic [0:0] reset
);
assign out = in_[2:2];
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_port_part_selection( do_test ):
class A( Component ):
def construct( s ):
s.in_ = InPort( Bits32 )
s.out = OutPort( Bits4 )
connect( s.out, s.in_[2:6] )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
input logic [31:0] in_,
output logic [3:0] out,
input logic [0:0] reset
);
assign out = in_[5:2];
endmodule
"""
a._ref_src_yosys = a._ref_src
do_test( a )
def test_port_wire_array_index( do_test ):
class A( Component ):
def construct( s ):
s.out = [ OutPort( Bits32 ) for _ in range(5) ]
s.wire_ = [ Wire(Bits32) for _ in range(5) ]
for i in range(5):
connect( s.wire_[i], s.out[i] )
connect( s.wire_[i], i )
a = A()
a._ref_src = \
"""
module A
(
input logic [0:0] clk,
output logic [31:0] out [0:4],
input logic [0:0] reset
);
logic [31:0] wire_ [0:4];
assign out[0] = wire_[0];
assign wire_[0] = 32'd0;
assign out[1] = wire_[1];
assign wire_[1] = 32'd1;
assign out[2] = wire_[2];
assign wire_[2] = 32'd2;
assign out[3] = wire_[3];
assign wire_[3] = 32'd3;
assign out[4] = wire_[4];
assign wire_[4] = 32'd4;
endmodule
"""
a._ref_src_yosys = \
"""
module A
(
input logic [0:0] clk,
output logic [31:0] out__0,
output logic [31:0] out__1,
output logic [31:0] out__2,
output logic [31:0] out__3,
output logic [31:0] out__4,
input logic [0:0] reset
);
logic [31:0] out [0:4];
logic [31:0] wire_ [0:4];
assign out__0 = out[0];
assign out__1 = out[1];
assign out__2 = out[2];
assign out__3 = out[3];
assign out__4 = out[4];
assign out[0] = wire_[0];
assign wire_[0] = 32'd0;
assign out[1] = wire_[1];
assign wire_[1] = 32'd1;
assign out[2] = wire_[2];
assign wire_[2] = 32'd2;
assign out[3] = wire_[3];
assign wire_[3] = 32'd3;
assign out[4] = wire_[4];
assign wire_[4] = 32'd4;
endmodule
"""
do_test( a )
| 18.471867 | 94 | 0.555002 | 2,250 | 14,445 | 3.368 | 0.052 | 0.085775 | 0.048034 | 0.07601 | 0.883347 | 0.868171 | 0.846266 | 0.818026 | 0.801531 | 0.767881 | 0 | 0.064622 | 0.259744 | 14,445 | 781 | 95 | 18.495519 | 0.644066 | 0.036345 | 0 | 0.7173 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.219409 | false | 0.012658 | 0.021097 | 0 | 0.320675 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
378518cb518000c3738232366769f482cf0236ff | 759,218 | py | Python | Location.py | ucddj/StardewSeedScripts | 3f93eccb61118d0acde6f443bba22703c7950483 | [
"MIT"
] | 5 | 2020-03-25T00:51:30.000Z | 2022-03-03T05:29:23.000Z | Location.py | ucddj/StardewSeedScripts | 3f93eccb61118d0acde6f443bba22703c7950483 | [
"MIT"
] | null | null | null | Location.py | ucddj/StardewSeedScripts | 3f93eccb61118d0acde6f443bba22703c7950483 | [
"MIT"
] | 6 | 2020-10-21T13:35:26.000Z | 2022-03-15T22:55:15.000Z | from CSRandom import CSRandom,CSRandomLite
from ObjectInfo import ObjectInfo
from Utility import dayToYSD
class Location():
def __init__(self, name):
self.name = "";
self.items = {};
self.spawnable = {};
self.front = {};
self.alwaysFront = {};
self.behindbush = {};
self.behindtree = {};
self.buildings = {};
self.terrainFeatures = {};
self.spawns = {}
self.back = {}
self.notPassable = {}
self.noFurniture = {}
self.water = {}
self.width = 0;
self.height = 0;
self.fspawnables = {};
self.diggable = {}
self.artifactSpots = []
self.startingObjects = {}
def calculateSpawns(self,seed,daysplayed,useStartingObjects = False):
#GameLocation::spawnObjects
itemsLength = len(self.items)
if itemsLength >= 6:
return
if daysplayed != 0:
season = (daysplayed-1) // 28 % 4
else:
season = 1
rand = CSRandomLite(int(seed // 2) +daysplayed)
num1 = rand.Next(1, min(5, 7 - itemsLength))
for index1 in range(num1):
for index2 in range(11):
x = rand.Next(self.width)
y = rand.Next(self.height)
tile = (x,y)
index3 = rand.Next(len(self.spawns[season]))
if useStartingObjects and tile in self.startingObjects:
continue;
if self.items.get(tile) == None:
if tile in self.spawnable and tile not in self.fspawnables:
result = rand.Sample()
comparison = self.spawns[season][index3][1]
if result < comparison:
if tile not in self.buildings:
if tile not in self.front and tile not in self.alwaysFront:
if tile not in self.terrainFeatures:
if tile not in self.behindbush:
#if Code uses Game1.random here. Can't guarantee what state this is going to be in... (game1 rand.Sample() < 0.1 or tile not in location.behindtree):
if tile not in self.behindtree:
objectIndex = self.spawns[season][index3][0]
self.items[tile] = ObjectInfo[objectIndex].split('/')[0]
break;
# Not accounting for winter, and for spots despawning (Uses Game1.random)
if self.artifactSpots != []:
return
chance = 1
while rand.Sample() < chance:
x = rand.Next(self.width)
y = rand.Next(self.height)
tile = (x,y)
if tile not in self.buildings:
if tile not in self.front and tile not in self.alwaysFront:
if tile not in self.terrainFeatures:
if tile not in self.behindbush:
if tile in self.diggable:
if self.name == "Forest" and x >= 93 and y >= 22:
continue
self.artifactSpots.append(tile)
break
chance *= 0.75
def processDay(self,seed,daysplayed):
self.items.clear();
dayOfMonth = ((daysplayed-1) % 28) + 1;
day = dayOfMonth % 7;
for dayOfWeek in range(day+1):
localDaysPlayed = daysplayed - (day-dayOfWeek)
dayOfMonth = ((localDaysPlayed-1) % 28) + 1
if dayOfWeek == 0:
if dayOfMonth == 28:
continue;
self.calculateSpawns(seed,localDaysPlayed);
self.calculateSpawns(seed,localDaysPlayed);
self.calculateSpawns(seed,localDaysPlayed);
if dayOfMonth == 1:
self.calculateSpawns(seed,localDaysPlayed);
if localDaysPlayed < 4:
self.calculateSpawns(seed,localDaysPlayed);
def distanceToLand(self,x,y):
num = 0;
startx = x - 1;
starty = y - 1;
endx = x + 2;
endy = y + 2;
width = endx - startx;
flag = False;
while not flag and width <= 11:
vector2List = [];
index = startx
while index < endx:
vector2List.append((index,starty))
index = index + 1
index = starty + 1
while index < endy:
vector2List.append(((endx - 1), index))
index = index + 1
index = endx - 2
while index >= startx:
vector2List.append((index, (endy - 1)))
index = index - 1
index = endy - 2
while index >= starty + 1:
vector2List.append((startx, index))
index = index - 1
for position in vector2List:
if (position[0] > 0 and position[1] > 0 and position[0] <= self.width - 1 and position[1] <= self.height - 1):
if position not in self.water:
flag = True;
num = width // 2;
break;
startx = startx - 1
starty = starty - 1
endx = endx + 1
endy = endy + 1
width = endx - startx;
if (width > 11):
num = 6;
num = num - 1
return num;
def bubbles(self,seed,day,bubblesExistOnDayStart=False):
bubblesStart = 600
point2 = (0,0)
land = 0
bubblesExist = bubblesExistOnDayStart
bubblesResult = []
timeOfDay = 610
while timeOfDay < 2600:
if (timeOfDay % 100 >= 60):
timeOfDay = timeOfDay + 10
continue;
random = CSRandomLite(timeOfDay + seed // 2 + day)
if not bubblesExist:
if (random.Sample() < 0.5):
for index in range(2):
point2 = (random.Next(0, self.width), random.Next(0, self.height));
if point2 in self.water:
land = self.distanceToLand(point2[0], point2[1]);
if (land > 1 and land <= 4):
bubblesExist = True;
bubblesStart = timeOfDay
break;
else:
if (random.Sample() < 0.1):
bubblesExist = False;
bubblesResult.append((bubblesStart,timeOfDay,point2,land))
timeOfDay = timeOfDay + 10
if bubblesExist:
bubblesResult.append((bubblesStart,2600,point2,land))
return bubblesResult
def createBusstop(version="1.4"):
location = Location("Busstop")
location.width = 35;
location.height = 30;
location.spawns = {
0: [[18, 0.9], [20, .4], [22, .7]],
1: [[396, .4], [398, .4], [402, .7]],
2: [[406, .6], [408, .4]],
3: [[414, .33], [418, .6], [283, .5]]};
if version == "1.4":
location.spawnable = {(0,0),(1,0),(3,0),(5,0),(8,0),(9,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(25,0),(26,0),(0,1),(1,1),(3,1),(6,1),(13,1),(14,1),(15,1),(20,1),(21,1),(22,1),(24,1),(26,1),(34,1),(0,2),(1,2),(2,2),(3,2),(8,2),(10,2),(11,2),(18,2),(21,2),(22,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(2,3),(5,3),(11,3),(12,3),(15,3),(19,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(0,4),(1,4),(5,4),(6,4),(7,4),(8,4),(9,4),(17,4),(18,4),(21,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(0,5),(1,5),(3,5),(5,5),(6,5),(7,5),(9,5),(10,5),(11,5),(12,5),(13,5),(15,5),(17,5),(18,5),(19,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(21,11),(22,11),(23,11),(24,11),(27,11),(28,11),(33,11),(34,11),(0,12),(1,12),(2,12),(4,12),(6,12),(7,12),(8,12),(9,12),(10,12),(11,12),(12,12),(14,12),(15,12),(16,12),(17,12),(18,12),(19,12),(20,12),(24,12),(28,12),(31,12),(32,12),(0,13),(2,13),(3,13),(4,13),(6,13),(8,13),(11,13),(14,13),(15,13),(17,13),(22,13),(28,13),(30,13),(31,13),(34,13),(4,14),(6,14),(15,14),(16,14),(20,14),(28,14),(4,15),(6,15),(7,15),(15,15),(21,15),(23,15),(24,15),(25,15),(26,15),(28,15),(31,15),(0,16),(4,16),(6,16),(7,16),(8,16),(10,16),(23,16),(24,16),(25,16),(26,16),(27,16),(28,16),(0,17),(4,17),(6,17),(7,17),(8,17),(9,17),(10,17),(16,17),(21,17),(23,17),(24,17),(26,17),(27,17),(30,17),(31,17),(33,17),(0,18),(1,18),(2,18),(4,18),(9,18),(20,18),(21,18),(22,18),(23,18),(28,18),(30,18),(31,18),(0,19),(1,19),(2,19),(9,19),(12,19),(21,19),(22,19),(25,19),(27,19),(28,19),(30,19),(31,19),(4,20),(5,20),(7,20),(9,20),(10,20),(23,20),(27,20),(28,20),(31,20),(33,20),(23,21),(24,21),(25,21),(26,21),(27,21),(28,21),(3,22),(11,22),(22,22),(23,22),(32,22),(33,22),(27,25),(28,25),(30,25),(31,25),(33,25),(0,26),(1,26),(2,26),(3,26),(4,26),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(11,26),(12,26),(13,26),(14,26),(15,26),(16,26),(17,26),(18,26),(19,26),(20,26),(21,26),(22,26),(23,26),(24,26),(25,26),(26,26),(0,27),(1,27),(2,27),(3,27),(4,27),(5,27),(6,27),(7,27),(8,27),(9,27),(10,27),(11,27),(12,27),(13,27),(14,27),(15,27),(16,27),(17,27),(18,27),(24,27),(25,27),(26,27),(0,28),(1,28),(2,28),(3,28),(4,28),(5,28),(7,28),(9,28),(10,28),(11,28),(12,28),(13,28),(14,28),(15,28),(16,28),(17,28),(18,28),(19,28),(20,28),(21,28),(22,28),(23,28),(24,28),(25,28),(26,28),(27,28),(28,28),(29,28),(30,28),(31,28),(32,28),(33,28),(34,28),(0,29),(1,29),(2,29),(3,29),(4,29),(5,29),(6,29),(7,29),(8,29),(9,29),(10,29),(11,29),(12,29),(13,29),(14,29),(15,29),(16,29),(17,29),(18,29),(19,29),(20,29),(21,29),(22,29),(23,29),(24,29),(25,29),(26,29),(27,29),(28,29),(29,29),(30,29),(31,29),(32,29),(33,29),(34,29)}
location.alwaysFront = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(14,0),(15,0),(16,0),(17,0),(22,0),(24,0),(26,0),(7,1),(8,1),(14,1),(15,1),(16,1),(17,1),(15,2),(16,2),(0,5),(1,5),(2,5),(3,5),(4,5),(0,6),(1,6),(2,6),(3,6),(4,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(0,7),(1,7),(2,7),(3,7),(4,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(0,8),(1,8),(2,8),(3,8),(4,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(0,9),(1,9),(2,9),(28,9),(29,9),(30,9),(31,9),(32,9),(33,9),(34,9),(0,10),(1,10),(30,10),(31,10),(32,10),(33,10),(34,10),(0,11),(1,11),(30,11),(31,11),(32,11),(33,11),(34,11),(30,12),(31,12),(32,12),(33,12),(34,12),(3,13),(30,13),(31,13),(32,13),(2,14),(3,14),(4,14),(5,14),(6,14),(30,14),(31,14),(2,15),(3,15),(4,15),(5,15),(6,15),(7,15),(2,16),(3,16),(4,16),(5,16),(6,16),(7,16),(2,17),(3,17),(4,17),(5,17),(6,17),(7,17),(4,18),(5,18),(7,23),(8,23),(9,23),(0,24),(1,24),(7,24),(8,24),(9,24),(23,24),(24,24),(25,24),(0,25),(1,25),(7,25),(8,25),(9,25),(23,25),(24,25),(25,25),(0,26),(1,26),(7,26),(8,26),(9,26),(10,26),(11,26),(12,26),(13,26),(14,26),(15,26),(23,26),(24,26),(25,26),(30,26),(31,26),(32,26),(33,26),(34,26),(0,27),(1,27),(2,27),(3,27),(10,27),(11,27),(12,27),(13,27),(14,27),(15,27),(21,27),(22,27),(23,27),(24,27),(25,27),(26,27),(30,27),(31,27),(32,27),(33,27),(34,27),(1,28),(2,28),(3,28),(10,28),(11,28),(12,28),(13,28),(14,28),(15,28),(21,28),(22,28),(23,28),(26,28),(30,28),(31,28),(32,28),(33,28),(34,28),(1,29),(2,29),(3,29),(10,29),(11,29),(12,29),(13,29),(14,29),(15,29),(21,29),(22,29),(23,29),(24,29),(25,29),(26,29),(30,29),(31,29),(32,29),(33,29),(34,29)}
location.front = {(0,0),(1,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(17,0),(0,1),(1,1),(7,1),(8,1),(0,2),(4,2),(15,3),(16,3),(0,9),(1,9),(2,9),(30,9),(31,9),(33,9),(0,10),(1,10),(2,10),(7,10),(30,10),(31,10),(0,11),(1,11),(2,11),(31,11),(0,12),(1,12),(30,12),(31,12),(0,13),(1,13),(30,13),(31,13),(34,13),(2,14),(3,14),(4,14),(5,14),(6,14),(7,14),(31,14),(34,14),(2,15),(3,15),(4,15),(5,15),(6,15),(7,15),(31,15),(2,16),(3,16),(4,16),(5,16),(6,16),(7,16),(31,16),(2,17),(3,17),(4,17),(5,17),(6,17),(7,17),(31,17),(4,18),(5,18),(31,18),(6,19),(0,20),(1,20),(2,20),(4,20),(5,20),(6,20),(7,20),(8,20),(9,20),(10,20),(16,20),(17,20),(18,20),(19,20),(20,20),(21,20),(22,20),(23,20),(24,20),(25,20),(26,20),(27,20),(28,20),(29,20),(30,20),(31,20),(32,20),(33,20),(34,20),(11,21),(0,25),(1,25),(2,25),(3,25),(4,25),(5,25),(6,25),(7,25),(8,25),(9,25),(10,25),(11,25),(12,25),(13,25),(14,25),(15,25),(16,25),(17,25),(18,25),(19,25),(20,25),(21,25),(22,25),(23,25),(24,25),(25,25),(26,25),(27,25),(28,25),(29,25),(30,25),(31,25),(32,25),(33,25),(34,25),(1,26),(16,26),(17,26),(18,26),(1,27),(8,27),(16,27),(17,27),(18,27),(21,27),(22,27),(23,27),(27,27),(28,27),(0,28),(3,28),(4,28),(7,28),(8,28),(9,28),(10,28),(16,28),(17,28),(18,28),(21,28),(22,28),(24,28),(27,28),(28,28),(0,29),(16,29),(17,29),(18,29),(21,29),(22,29),(24,29),(26,29),(27,29),(28,29)}
location.buildings = {(0,0),(1,0),(2,0),(3,0),(8,0),(9,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(26,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(0,2),(1,2),(3,2),(4,2),(5,2),(6,2),(7,2),(8,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(0,3),(4,3),(5,3),(6,3),(7,3),(8,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(0,4),(1,4),(15,4),(16,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(0,5),(1,5),(2,5),(8,5),(23,5),(24,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(34,6),(11,7),(12,7),(13,7),(14,7),(15,7),(16,7),(17,7),(18,7),(34,7),(11,8),(12,8),(13,8),(14,8),(15,8),(16,8),(17,8),(18,8),(34,8),(11,9),(13,9),(14,9),(15,9),(16,9),(17,9),(18,9),(34,9),(0,10),(1,10),(2,10),(32,10),(33,10),(34,10),(0,11),(1,11),(2,11),(7,11),(30,11),(31,11),(32,11),(33,11),(34,11),(0,12),(1,12),(2,12),(30,12),(31,12),(32,12),(33,12),(34,12),(0,13),(1,13),(2,13),(5,13),(16,13),(30,13),(33,13),(0,14),(1,14),(2,14),(3,14),(30,14),(32,14),(33,14),(0,15),(1,15),(2,15),(3,15),(22,15),(30,15),(32,15),(33,15),(34,15),(0,16),(1,16),(2,16),(3,16),(30,16),(31,16),(32,16),(33,16),(34,16),(0,17),(1,17),(2,17),(3,17),(4,17),(30,17),(32,17),(33,17),(34,17),(0,18),(1,18),(2,18),(3,18),(30,18),(32,18),(33,18),(34,18),(0,19),(1,19),(2,19),(3,19),(4,19),(5,19),(30,19),(31,19),(32,19),(33,19),(34,19),(0,20),(1,20),(2,20),(3,20),(4,20),(5,20),(30,20),(31,20),(34,20),(0,21),(1,21),(2,21),(3,21),(4,21),(5,21),(6,21),(7,21),(8,21),(9,21),(10,21),(16,21),(17,21),(18,21),(19,21),(20,21),(21,21),(22,21),(23,21),(24,21),(25,21),(26,21),(27,21),(28,21),(29,21),(30,21),(31,21),(32,21),(33,21),(34,21),(11,22),(26,25),(0,26),(1,26),(2,26),(3,26),(4,26),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(11,26),(12,26),(13,26),(14,26),(15,26),(16,26),(17,26),(18,26),(19,26),(20,26),(21,26),(22,26),(23,26),(24,26),(25,26),(26,26),(27,26),(28,26),(29,26),(30,26),(31,26),(32,26),(33,26),(34,26),(0,27),(1,27),(2,27),(3,27),(4,27),(5,27),(6,27),(7,27),(8,27),(9,27),(10,27),(11,27),(12,27),(13,27),(14,27),(15,27),(16,27),(17,27),(18,27),(19,27),(20,27),(21,27),(22,27),(23,27),(24,27),(25,27),(26,27),(28,27),(29,27),(30,27),(31,27),(34,27),(0,28),(1,28),(2,28),(3,28),(4,28),(5,28),(6,28),(7,28),(8,28),(9,28),(10,28),(11,28),(12,28),(13,28),(14,28),(15,28),(16,28),(17,28),(18,28),(19,28),(20,28),(21,28),(22,28),(23,28),(24,28),(25,28),(26,28),(29,28),(30,28),(31,28),(0,29),(1,29),(2,29),(3,29),(4,29),(5,29),(6,29),(7,29),(8,29),(9,29),(10,29),(11,29),(12,29),(13,29),(14,29),(15,29),(16,29),(17,29),(18,29),(19,29),(20,29),(21,29),(22,29),(23,29),(24,29),(25,29),(26,29),(29,29),(30,29),(31,29)}
if version == "1.3":
location.spawnable = {(0,0),(1,0),(3,0),(5,0),(8,0),(9,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(25,0),(26,0),(0,1),(1,1),(3,1),(6,1),(13,1),(14,1),(15,1),(20,1),(21,1),(22,1),(24,1),(26,1),(34,1),(0,2),(1,2),(2,2),(3,2),(8,2),(10,2),(11,2),(18,2),(21,2),(22,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(2,3),(5,3),(11,3),(12,3),(15,3),(19,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(0,4),(1,4),(5,4),(6,4),(7,4),(8,4),(9,4),(17,4),(18,4),(21,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(0,5),(1,5),(3,5),(5,5),(6,5),(7,5),(9,5),(10,5),(11,5),(12,5),(13,5),(15,5),(17,5),(18,5),(19,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(21,11),(22,11),(23,11),(24,11),(27,11),(28,11),(33,11),(34,11),(0,12),(1,12),(2,12),(4,12),(6,12),(7,12),(8,12),(9,12),(10,12),(11,12),(12,12),(14,12),(15,12),(16,12),(17,12),(18,12),(19,12),(20,12),(24,12),(28,12),(31,12),(32,12),(0,13),(2,13),(3,13),(4,13),(6,13),(8,13),(11,13),(14,13),(15,13),(17,13),(22,13),(28,13),(30,13),(31,13),(34,13),(4,14),(6,14),(15,14),(16,14),(20,14),(28,14),(4,15),(6,15),(7,15),(15,15),(21,15),(23,15),(24,15),(25,15),(26,15),(28,15),(31,15),(0,16),(4,16),(6,16),(7,16),(8,16),(10,16),(23,16),(24,16),(25,16),(26,16),(27,16),(28,16),(0,17),(4,17),(6,17),(7,17),(8,17),(9,17),(10,17),(16,17),(21,17),(23,17),(24,17),(26,17),(27,17),(30,17),(31,17),(33,17),(0,18),(1,18),(2,18),(4,18),(9,18),(20,18),(21,18),(22,18),(23,18),(28,18),(30,18),(31,18),(0,19),(1,19),(2,19),(9,19),(12,19),(21,19),(22,19),(25,19),(27,19),(28,19),(30,19),(31,19),(4,20),(5,20),(7,20),(9,20),(10,20),(23,20),(27,20),(28,20),(31,20),(33,20),(23,21),(24,21),(25,21),(26,21),(27,21),(28,21),(3,22),(11,22),(22,22),(23,22),(32,22),(33,22),(27,25),(28,25),(30,25),(31,25),(33,25),(0,26),(1,26),(2,26),(3,26),(4,26),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(11,26),(12,26),(13,26),(14,26),(15,26),(16,26),(17,26),(18,26),(19,26),(20,26),(21,26),(22,26),(23,26),(24,26),(25,26),(26,26),(0,27),(1,27),(2,27),(3,27),(4,27),(5,27),(6,27),(7,27),(8,27),(9,27),(10,27),(11,27),(12,27),(13,27),(14,27),(15,27),(16,27),(17,27),(18,27),(24,27),(25,27),(26,27),(0,28),(1,28),(2,28),(3,28),(4,28),(5,28),(7,28),(9,28),(10,28),(11,28),(12,28),(13,28),(14,28),(15,28),(16,28),(17,28),(18,28),(19,28),(20,28),(21,28),(22,28),(23,28),(24,28),(25,28),(26,28),(27,28),(28,28),(29,28),(30,28),(31,28),(32,28),(33,28),(34,28),(0,29),(1,29),(2,29),(3,29),(4,29),(5,29),(6,29),(7,29),(8,29),(9,29),(10,29),(11,29),(12,29),(13,29),(14,29),(15,29),(16,29),(17,29),(18,29),(19,29),(20,29),(21,29),(22,29),(23,29),(24,29),(25,29),(26,29),(27,29),(28,29),(29,29),(30,29),(31,29),(32,29),(33,29),(34,29)}
location.alwaysFront = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(14,0),(15,0),(16,0),(17,0),(22,0),(24,0),(26,0),(7,1),(8,1),(14,1),(15,1),(16,1),(17,1),(15,2),(16,2),(0,5),(1,5),(2,5),(3,5),(4,5),(0,6),(1,6),(2,6),(3,6),(4,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(0,7),(1,7),(2,7),(3,7),(4,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(0,8),(1,8),(2,8),(3,8),(4,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(0,9),(1,9),(2,9),(28,9),(29,9),(30,9),(31,9),(32,9),(33,9),(34,9),(0,10),(1,10),(30,10),(31,10),(32,10),(33,10),(34,10),(0,11),(1,11),(30,11),(31,11),(32,11),(33,11),(34,11),(30,12),(31,12),(32,12),(33,12),(34,12),(3,13),(30,13),(31,13),(32,13),(2,14),(3,14),(4,14),(5,14),(6,14),(30,14),(31,14),(2,15),(3,15),(4,15),(5,15),(6,15),(7,15),(2,16),(3,16),(4,16),(5,16),(6,16),(7,16),(2,17),(3,17),(4,17),(5,17),(6,17),(7,17),(4,18),(5,18),(7,23),(8,23),(9,23),(0,24),(1,24),(7,24),(8,24),(9,24),(23,24),(24,24),(25,24),(0,25),(1,25),(7,25),(8,25),(9,25),(23,25),(24,25),(25,25),(0,26),(1,26),(7,26),(8,26),(9,26),(10,26),(11,26),(12,26),(13,26),(14,26),(15,26),(23,26),(24,26),(25,26),(30,26),(31,26),(32,26),(33,26),(34,26),(0,27),(1,27),(2,27),(3,27),(10,27),(11,27),(12,27),(13,27),(14,27),(15,27),(21,27),(22,27),(23,27),(24,27),(25,27),(26,27),(30,27),(31,27),(32,27),(33,27),(34,27),(1,28),(2,28),(3,28),(10,28),(11,28),(12,28),(13,28),(14,28),(15,28),(21,28),(22,28),(23,28),(26,28),(30,28),(31,28),(32,28),(33,28),(34,28),(1,29),(2,29),(3,29),(10,29),(11,29),(12,29),(13,29),(14,29),(15,29),(21,29),(22,29),(23,29),(24,29),(25,29),(26,29),(30,29),(31,29),(32,29),(33,29),(34,29)}
location.front = {(0,0),(1,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(17,0),(0,1),(1,1),(7,1),(8,1),(0,2),(4,2),(15,3),(16,3),(0,9),(1,9),(2,9),(30,9),(31,9),(33,9),(0,10),(1,10),(2,10),(7,10),(30,10),(31,10),(0,11),(1,11),(2,11),(31,11),(0,12),(1,12),(30,12),(31,12),(0,13),(1,13),(30,13),(31,13),(34,13),(2,14),(3,14),(4,14),(5,14),(6,14),(7,14),(31,14),(34,14),(2,15),(3,15),(4,15),(5,15),(6,15),(7,15),(31,15),(2,16),(3,16),(4,16),(5,16),(6,16),(7,16),(31,16),(2,17),(3,17),(4,17),(5,17),(6,17),(7,17),(31,17),(4,18),(5,18),(31,18),(6,19),(0,20),(1,20),(2,20),(4,20),(5,20),(6,20),(7,20),(8,20),(9,20),(10,20),(16,20),(17,20),(18,20),(19,20),(20,20),(21,20),(22,20),(23,20),(24,20),(25,20),(26,20),(27,20),(28,20),(29,20),(30,20),(31,20),(32,20),(33,20),(34,20),(11,21),(0,25),(1,25),(2,25),(3,25),(4,25),(5,25),(6,25),(7,25),(8,25),(9,25),(10,25),(11,25),(12,25),(13,25),(14,25),(15,25),(16,25),(17,25),(18,25),(19,25),(20,25),(21,25),(22,25),(23,25),(24,25),(25,25),(26,25),(27,25),(28,25),(29,25),(30,25),(31,25),(32,25),(33,25),(34,25),(1,26),(16,26),(17,26),(18,26),(1,27),(8,27),(16,27),(17,27),(18,27),(21,27),(22,27),(23,27),(27,27),(28,27),(0,28),(3,28),(4,28),(7,28),(8,28),(9,28),(10,28),(16,28),(17,28),(18,28),(21,28),(22,28),(24,28),(27,28),(28,28),(0,29),(16,29),(17,29),(18,29),(21,29),(22,29),(24,29),(26,29),(27,29),(28,29)}
location.buildings = {(0,0),(1,0),(2,0),(3,0),(8,0),(9,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(26,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(0,2),(1,2),(3,2),(4,2),(5,2),(6,2),(7,2),(8,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(0,3),(4,3),(5,3),(6,3),(7,3),(8,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(0,4),(1,4),(15,4),(16,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(0,5),(1,5),(2,5),(8,5),(23,5),(24,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(34,6),(11,7),(12,7),(13,7),(14,7),(15,7),(16,7),(17,7),(18,7),(34,7),(11,8),(12,8),(13,8),(14,8),(15,8),(16,8),(17,8),(18,8),(34,8),(11,9),(13,9),(14,9),(15,9),(16,9),(17,9),(18,9),(34,9),(0,10),(1,10),(2,10),(32,10),(33,10),(34,10),(0,11),(1,11),(2,11),(7,11),(30,11),(31,11),(32,11),(33,11),(34,11),(0,12),(1,12),(2,12),(30,12),(31,12),(32,12),(33,12),(34,12),(0,13),(1,13),(2,13),(5,13),(16,13),(30,13),(33,13),(0,14),(1,14),(2,14),(3,14),(30,14),(32,14),(33,14),(0,15),(1,15),(2,15),(3,15),(22,15),(30,15),(32,15),(33,15),(34,15),(0,16),(1,16),(2,16),(3,16),(30,16),(31,16),(32,16),(33,16),(34,16),(0,17),(1,17),(2,17),(3,17),(4,17),(30,17),(32,17),(33,17),(34,17),(0,18),(1,18),(2,18),(3,18),(30,18),(32,18),(33,18),(34,18),(0,19),(1,19),(2,19),(3,19),(4,19),(5,19),(30,19),(31,19),(32,19),(33,19),(34,19),(0,20),(1,20),(2,20),(3,20),(4,20),(5,20),(30,20),(31,20),(34,20),(0,21),(1,21),(2,21),(3,21),(4,21),(5,21),(6,21),(7,21),(8,21),(9,21),(10,21),(16,21),(17,21),(18,21),(19,21),(20,21),(21,21),(22,21),(23,21),(24,21),(25,21),(26,21),(27,21),(28,21),(29,21),(30,21),(31,21),(32,21),(33,21),(34,21),(11,22),(26,25),(0,26),(1,26),(2,26),(3,26),(4,26),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(11,26),(12,26),(13,26),(14,26),(15,26),(16,26),(17,26),(18,26),(19,26),(20,26),(21,26),(22,26),(23,26),(24,26),(25,26),(26,26),(27,26),(28,26),(29,26),(30,26),(31,26),(32,26),(33,26),(34,26),(0,27),(1,27),(2,27),(3,27),(4,27),(5,27),(6,27),(7,27),(8,27),(9,27),(10,27),(11,27),(12,27),(13,27),(14,27),(15,27),(16,27),(17,27),(18,27),(19,27),(20,27),(21,27),(22,27),(23,27),(24,27),(25,27),(26,27),(28,27),(29,27),(30,27),(31,27),(34,27),(0,28),(1,28),(2,28),(3,28),(4,28),(5,28),(6,28),(7,28),(8,28),(9,28),(10,28),(11,28),(12,28),(13,28),(14,28),(15,28),(16,28),(17,28),(18,28),(19,28),(20,28),(21,28),(22,28),(23,28),(24,28),(25,28),(26,28),(29,28),(30,28),(31,28),(0,29),(1,29),(2,29),(3,29),(4,29),(5,29),(6,29),(7,29),(8,29),(9,29),(10,29),(11,29),(12,29),(13,29),(14,29),(15,29),(16,29),(17,29),(18,29),(19,29),(20,29),(21,29),(22,29),(23,29),(24,29),(25,29),(26,29),(29,29),(30,29),(31,29)}
location.terrainFeatures = {(3,11),(4,12),(5,12),(6,12),(5,1),(6,1),(7,1),(7,20),(8,20),(9,20),(10,2),(14,3),(19,2),(20,4),(21,4),(22,4),(21,20),(22,17),(23,17),(24,17),(22,20),(21,20),(27,16),(28,16),(28,11),(29,11),(29,14),(29,19),(12,4),(19,17),(22,13),(25,19)};
location.behindbush = {(3,10),(4,11),(5,11),(6,11),(5,0),(6,0),(7,0),(7,19),(8,19),(9,19),(10,1),(14,2),(19,1),(20,3),(21,3),(22,3),(21,19),(22,16),(23,16),(24,16),(22,19),(21,19),(27,15),(28,15),(28,10),(29,10),(29,13),(29,18)};
location.behindtree = {(11,1),(11,2),(11,3),(11,4),(12,1),(12,2),(12,3),(12,4),(13,1),(13,2),(13,3),(13,4),(18,14),(18,15),(18,16),(18,17),(19,14),(19,15),(19,16),(19,17),(20,14),(20,15),(20,16),(20,17),(21,10),(21,11),(21,12),(21,13),(22,10),(22,11),(22,12),(22,13),(23,10),(23,11),(23,12),(23,13),(24,16),(24,17),(24,18),(24,19),(25,16),(25,17),(25,18),(25,19),(26,16),(26,17),(26,18),(26,19)};
location.diggable = {(25,13),(26,13),(9,14),(12,14),(18,14),(12,15),(18,15),(12,16),(13,16),(13,17),(14,17),(14,18),(13,20),(14,21),(14,22),(0,23),(1,23),(2,23),(3,23),(4,23),(5,23),(6,23),(7,23),(8,23),(9,23),(10,23),(11,23),(12,23),(13,23),(14,23),(15,23),(16,23),(17,23),(18,23),(19,23),(20,23),(21,23),(22,23),(23,23),(24,23),(25,23),(26,23),(27,23),(28,23),(29,23),(30,23),(31,23),(32,23),(33,23),(34,23)}
return location
def createBackwoods(version="1.4"):
location = Location("Backwoods")
location.width = 50;
location.height = 40;
location.spawns = {
0: [[20, .7], [16, .5]],
1: [[396, .5], [398, .8]],
2: [[404, .4], [406, .4], [408, .9]],
3: [[414, .25], [418, .4], [283, .5]]};
if version == "1.4":
location.spawnable = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(26,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(41,0),(42,0),(43,0),(44,0),(45,0),(46,0),(47,0),(48,0),(49,0),(0,1),(1,1),(2,1),(3,1),(4,1),(0,2),(1,2),(2,2),(3,2),(6,2),(7,2),(8,2),(11,2),(12,2),(13,2),(15,2),(16,2),(18,2),(22,2),(27,2),(29,2),(32,2),(37,2),(38,2),(39,2),(42,2),(43,2),(44,2),(45,2),(46,2),(48,2),(0,3),(1,3),(2,3),(6,3),(7,3),(8,3),(9,3),(11,3),(12,3),(13,3),(15,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(31,3),(35,3),(36,3),(39,3),(41,3),(42,3),(44,3),(45,3),(47,3),(48,3),(0,4),(1,4),(4,4),(9,4),(10,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(44,4),(48,4),(0,5),(3,5),(4,5),(5,5),(7,5),(9,5),(10,5),(12,5),(16,5),(17,5),(18,5),(19,5),(20,5),(22,5),(24,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(49,5),(3,6),(4,6),(5,6),(9,6),(10,6),(15,6),(17,6),(18,6),(19,6),(20,6),(21,6),(29,6),(31,6),(32,6),(34,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(42,6),(43,6),(44,6),(45,6),(46,6),(47,6),(48,6),(49,6),(1,7),(2,7),(3,7),(4,7),(5,7),(15,7),(17,7),(19,7),(22,7),(23,7),(24,7),(25,7),(26,7),(27,7),(28,7),(29,7),(36,7),(37,7),(38,7),(0,8),(1,8),(2,8),(6,8),(7,8),(9,8),(11,8),(20,8),(21,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(34,8),(35,8),(36,8),(37,8),(38,8),(0,9),(1,9),(2,9),(4,9),(6,9),(7,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(23,9),(24,9),(38,9),(39,9),(40,9),(41,9),(42,9),(43,9),(44,9),(45,9),(46,9),(47,9),(48,9),(49,9),(7,10),(8,10),(9,10),(12,10),(13,10),(14,10),(21,10),(23,10),(27,10),(31,10),(36,10),(1,11),(3,11),(4,11),(5,11),(12,11),(16,11),(17,11),(19,11),(22,11),(25,11),(26,11),(27,11),(28,11),(31,11),(32,11),(35,11),(37,11),(40,11),(42,11),(43,11),(44,11),(45,11),(49,11),(3,12),(4,12),(7,12),(10,12),(11,12),(13,12),(15,12),(16,12),(21,12),(22,12),(23,12),(25,12),(26,12),(40,12),(47,12),(5,13),(10,13),(14,13),(15,13),(16,13),(18,13),(20,13),(21,13),(0,14),(1,14),(3,14),(12,14),(13,14),(20,14),(33,14),(0,15),(1,15),(5,15),(11,15),(12,15),(17,15),(18,15),(19,15),(33,15),(0,16),(1,16),(2,16),(3,16),(4,16),(5,16),(6,16),(9,16),(10,16),(11,16),(16,16),(24,16),(29,16),(30,16),(31,16),(32,16),(33,16),(34,16),(35,16),(36,16),(43,16),(49,16),(2,17),(3,17),(4,17),(5,17),(6,17),(7,17),(9,17),(10,17),(26,17),(27,17),(28,17),(29,17),(33,17),(34,17),(35,17),(36,17),(37,17),(38,17),(39,17),(41,17),(42,17),(44,17),(45,17),(46,17),(47,17),(48,17),(0,18),(2,18),(3,18),(4,18),(5,18),(6,18),(9,18),(14,18),(24,18),(25,18),(26,18),(2,19),(3,19),(4,19),(5,19),(6,19),(9,19),(12,19),(13,19),(23,19),(24,19),(25,19),(26,19),(33,19),(34,19),(35,19),(36,19),(37,19),(38,19),(39,19),(40,19),(42,19),(43,19),(44,19),(45,19),(46,19),(47,19),(48,19),(49,19),(0,20),(1,20),(2,20),(3,20),(4,20),(5,20),(6,20),(9,20),(10,20),(11,20),(12,20),(22,20),(25,20),(26,20),(33,20),(34,20),(35,20),(36,20),(37,20),(38,20),(39,20),(40,20),(42,20),(43,20),(44,20),(45,20),(46,20),(47,20),(48,20),(49,20),(0,21),(1,21),(2,21),(3,21),(4,21),(5,21),(6,21),(7,21),(10,21),(11,21),(18,21),(20,21),(21,21),(22,21),(25,21),(0,22),(1,22),(2,22),(3,22),(4,22),(5,22),(6,22),(9,22),(10,22),(11,22),(20,22),(21,22),(28,22),(29,22),(30,22),(31,22),(32,22),(33,22),(34,22),(35,22),(36,22),(37,22),(38,22),(39,22),(40,22),(41,22),(42,22),(43,22),(44,22),(45,22),(46,22),(47,22),(48,22),(49,22),(1,23),(2,23),(3,23),(4,23),(9,23),(10,23),(15,23),(19,23),(23,23),(24,23),(26,23),(27,23),(28,23),(29,23),(30,23),(31,23),(32,23),(33,23),(34,23),(35,23),(36,23),(37,23),(38,23),(39,23),(40,23),(41,23),(42,23),(43,23),(44,23),(45,23),(46,23),(47,23),(48,23),(49,23),(0,24),(1,24),(7,24),(8,24),(9,24),(10,24),(15,24),(19,24),(20,24),(21,24),(24,24),(25,24),(26,24),(28,24),(37,24),(38,24),(39,24),(40,24),(49,24),(5,25),(6,25),(7,25),(8,25),(9,25),(10,25),(17,25),(19,25),(20,25),(21,25),(23,25),(24,25),(25,25),(26,25),(28,25),(31,25),(32,25),(33,25),(34,25),(42,25),(44,25),(45,25),(46,25),(1,26),(2,26),(3,26),(4,26),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(15,26),(18,26),(20,26),(21,26),(23,26),(24,26),(25,26),(26,26),(27,26),(28,26),(30,26),(31,26),(34,26),(35,26),(37,26),(38,26),(39,26),(40,26),(42,26),(43,26),(45,26),(46,26),(48,26),(0,27),(1,27),(2,27),(3,27),(4,27),(5,27),(6,27),(7,27),(18,27),(19,27),(20,27),(21,27),(30,27),(34,27),(35,27),(36,27),(38,27),(41,27),(42,27),(44,27),(46,27),(47,27),(48,27),(49,27),(0,28),(1,28),(2,28),(3,28),(9,28),(10,28),(18,28),(19,28),(20,28),(21,28),(5,29),(6,29),(7,29),(9,29),(17,29),(19,29),(21,29),(0,30),(1,30),(2,30),(3,30),(4,30),(5,30),(6,30),(11,30),(17,30),(20,30),(21,30),(0,31),(1,31),(2,31),(3,31),(4,31),(10,31),(19,31),(21,31),(9,32),(10,32),(11,32),(20,32),(21,32),(1,33),(6,33),(7,33),(8,33),(10,33),(11,33),(17,33),(20,33),(21,33),(40,33),(43,33),(44,33),(46,33),(48,33),(49,33),(4,34),(17,34),(20,34),(21,34),(22,34),(27,34),(28,34),(29,34),(36,34),(37,34),(39,34),(43,34),(44,34),(45,34),(46,34),(47,34),(49,34),(1,35),(9,35),(17,35),(19,35),(20,35),(21,35),(22,35),(25,35),(34,35),(39,35),(45,35),(46,35),(48,35),(49,35),(7,36),(17,36),(28,36),(34,36),(35,36),(39,36),(41,36),(42,36),(43,36),(45,36),(46,36),(47,36),(49,36),(1,37),(4,37),(21,37),(24,37),(26,37),(28,37),(30,37),(31,37),(39,37),(40,37),(42,37),(43,37),(44,37),(45,37),(46,37),(47,37),(49,37),(0,38),(1,38),(2,38),(6,38),(7,38),(8,38),(9,38),(11,38),(17,38),(19,38),(23,38),(24,38),(28,38),(30,38),(31,38),(33,38),(34,38),(40,38),(42,38),(44,38),(45,38),(46,38),(47,38),(48,38),(1,39),(3,39),(5,39),(6,39),(8,39),(19,39),(20,39),(21,39),(22,39),(23,39),(24,39),(25,39),(26,39),(27,39),(28,39),(34,39),(37,39),(38,39),(39,39),(40,39),(42,39),(44,39),(45,39),(46,39),(47,39),(49,39)}
location.alwaysFront = {(5,19),(6,19),(7,19),(5,20),(6,20),(7,20),(5,21),(6,21),(7,21),(5,22),(6,22),(7,22),(20,24),(21,24),(22,24),(20,25),(21,25),(22,25),(20,26),(21,26),(22,26),(23,26),(20,27),(21,27),(22,27),(23,27),(22,28),(23,28),(22,29),(23,29),(22,30),(23,30),(44,30),(45,30),(46,30),(22,31),(23,31),(44,31),(45,31),(46,31),(20,32),(21,32),(22,32),(23,32),(25,32),(26,32),(27,32),(28,32),(29,32),(30,32),(31,32),(32,32),(33,32),(44,32),(45,32),(46,32),(20,33),(21,33),(22,33),(23,33),(25,33),(26,33),(27,33),(28,33),(29,33),(30,33),(31,33),(32,33),(33,33),(44,33),(45,33),(46,33),(20,34),(21,34),(22,34),(25,34),(26,34),(27,34),(28,34),(29,34),(30,34),(31,34),(32,34),(33,34),(46,34),(28,35),(29,35),(30,35),(31,35),(32,35),(33,35),(44,35),(46,35)}
location.front = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(10,0),(11,0),(12,0),(13,0),(15,0),(16,0),(22,0),(23,0),(26,0),(27,0),(28,0),(30,0),(31,0),(41,0),(42,0),(43,0),(44,0),(45,0),(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(11,1),(12,1),(13,1),(15,1),(16,1),(22,1),(23,1),(34,1),(35,1),(43,1),(44,1),(45,1),(0,2),(1,2),(2,2),(3,2),(4,2),(6,2),(7,2),(8,2),(11,2),(12,2),(13,2),(17,2),(18,2),(34,2),(35,2),(40,2),(41,2),(42,2),(47,2),(48,2),(0,3),(1,3),(2,3),(3,3),(6,3),(7,3),(8,3),(9,3),(10,3),(11,3),(12,3),(13,3),(17,3),(18,3),(40,3),(41,3),(42,3),(47,3),(48,3),(0,4),(1,4),(2,4),(3,4),(4,4),(5,4),(8,4),(9,4),(10,4),(0,5),(1,5),(3,5),(4,5),(5,5),(8,5),(9,5),(10,5),(0,6),(1,6),(2,6),(3,6),(4,6),(5,6),(8,6),(9,6),(10,6),(0,7),(1,7),(2,7),(3,7),(4,7),(5,7),(6,7),(7,7),(8,7),(11,7),(12,7),(13,7),(0,8),(1,8),(2,8),(6,8),(7,8),(8,8),(11,8),(12,8),(13,8),(0,9),(1,9),(2,9),(3,9),(4,9),(6,9),(7,9),(8,9),(2,10),(3,10),(4,10),(6,10),(7,10),(8,10),(9,10),(2,11),(3,11),(4,11),(2,12),(3,12),(4,12),(0,13),(1,13),(0,14),(1,14),(0,15),(1,15),(2,15),(3,15),(4,15),(5,15),(6,15),(7,15),(0,16),(1,16),(2,16),(3,16),(4,16),(5,16),(6,16),(7,16),(0,17),(1,17),(2,17),(3,17),(4,17),(5,17),(6,17),(7,17),(22,17),(23,17),(24,17),(25,17),(26,17),(27,17),(28,17),(29,17),(30,17),(31,17),(32,17),(33,17),(34,17),(35,17),(36,17),(37,17),(38,17),(39,17),(40,17),(41,17),(42,17),(43,17),(44,17),(45,17),(46,17),(47,17),(48,17),(49,17),(0,18),(1,18),(2,18),(3,18),(4,18),(5,18),(6,18),(7,18),(22,18),(23,18),(24,18),(25,18),(26,18),(27,18),(4,19),(25,19),(26,19),(27,19),(33,20),(34,20),(35,20),(0,21),(1,21),(2,21),(3,21),(4,21),(5,21),(8,21),(16,21),(17,21),(18,21),(19,21),(20,21),(21,21),(29,21),(30,21),(31,21),(33,21),(34,21),(35,21),(42,21),(43,21),(44,21),(45,21),(46,21),(47,21),(1,22),(2,22),(3,22),(16,22),(17,22),(18,22),(19,22),(20,22),(21,22),(28,22),(29,22),(30,22),(31,22),(33,22),(34,22),(35,22),(42,22),(43,22),(44,22),(45,22),(46,22),(47,22),(48,22),(49,22),(1,23),(2,23),(3,23),(19,23),(20,23),(21,23),(33,23),(34,23),(35,23),(45,23),(46,23),(47,23),(48,23),(49,23),(20,24),(22,24),(45,24),(46,24),(47,24),(32,25),(33,25),(17,26),(18,26),(19,26),(22,26),(23,26),(35,26),(36,26),(37,26),(38,26),(39,26),(40,26),(41,26),(42,26),(43,26),(44,26),(45,26),(46,26),(47,26),(48,26),(49,26),(9,27),(10,27),(11,27),(17,27),(18,27),(19,27),(21,27),(22,27),(9,28),(10,28),(11,28),(17,28),(18,28),(19,28),(21,28),(22,28),(6,29),(7,29),(9,29),(10,29),(11,29),(17,29),(18,29),(19,29),(0,30),(1,30),(2,30),(4,30),(5,30),(9,30),(10,30),(11,30),(16,30),(17,30),(18,30),(20,30),(21,30),(0,31),(1,31),(2,31),(6,31),(7,31),(8,31),(10,31),(16,31),(17,31),(18,31),(20,31),(21,31),(0,32),(1,32),(2,32),(3,32),(4,32),(5,32),(6,32),(7,32),(8,32),(16,32),(17,32),(18,32),(20,32),(22,32),(23,32),(25,32),(26,32),(27,32),(29,32),(30,32),(31,32),(32,32),(33,32),(34,32),(35,32),(36,32),(37,32),(38,32),(39,32),(45,32),(46,32),(47,32),(48,32),(49,32),(0,33),(1,33),(2,33),(3,33),(4,33),(5,33),(6,33),(7,33),(8,33),(10,33),(11,33),(16,33),(17,33),(18,33),(20,33),(21,33),(22,33),(23,33),(24,33),(25,33),(26,33),(27,33),(28,33),(29,33),(30,33),(31,33),(32,33),(33,33),(34,33),(35,33),(36,33),(37,33),(38,33),(48,33),(49,33),(1,34),(3,34),(4,34),(5,34),(6,34),(7,34),(8,34),(17,34),(20,34),(21,34),(22,34),(23,34),(24,34),(25,34),(26,34),(27,34),(28,34),(29,34),(30,34),(31,34),(32,34),(33,34),(36,34),(37,34),(38,34),(39,34),(45,34),(48,34),(49,34),(0,35),(1,35),(3,35),(4,35),(5,35),(7,35),(18,35),(19,35),(20,35),(21,35),(22,35),(25,35),(26,35),(27,35),(28,35),(29,35),(30,35),(31,35),(32,35),(33,35),(34,35),(35,35),(39,35),(41,35),(42,35),(43,35),(48,35),(49,35),(4,36),(8,36),(9,36),(10,36),(21,36),(26,36),(27,36),(28,36),(30,36),(31,36),(33,36),(34,36),(35,36),(41,36),(42,36),(43,36),(45,36),(46,36),(47,36),(48,36),(49,36),(1,37),(2,37),(3,37),(5,37),(6,37),(7,37),(8,37),(9,37),(10,37),(17,37),(18,37),(19,37),(23,37),(24,37),(25,37),(26,37),(27,37),(28,37),(33,37),(34,37),(35,37),(38,37),(39,37),(40,37),(41,37),(42,37),(43,37),(45,37),(46,37),(47,37),(1,38),(2,38),(3,38),(5,38),(6,38),(7,38),(8,38),(9,38),(10,38),(17,38),(18,38),(19,38),(20,38),(21,38),(22,38),(23,38),(24,38),(25,38),(26,38),(27,38),(28,38),(29,38),(30,38),(31,38),(33,38),(34,38),(35,38),(38,38),(39,38),(40,38),(41,38),(42,38),(43,38),(45,38),(46,38),(47,38),(1,39),(2,39),(3,39),(5,39),(6,39),(7,39),(8,39),(9,39),(10,39),(17,39),(18,39),(19,39),(20,39),(21,39),(22,39),(23,39),(24,39),(25,39),(26,39),(27,39),(28,39),(29,39),(30,39),(31,39),(34,39),(38,39),(39,39),(40,39),(45,39),(46,39),(47,39)}
location.buildings = {(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(13,0),(14,0),(17,0),(18,0),(19,0),(20,0),(21,0),(24,0),(25,0),(29,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(46,0),(47,0),(48,0),(49,0),(4,1),(5,1),(9,1),(10,1),(13,1),(14,1),(17,1),(18,1),(19,1),(20,1),(21,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(36,1),(37,1),(38,1),(39,1),(40,1),(41,1),(42,1),(44,1),(46,1),(47,1),(48,1),(49,1),(2,2),(3,2),(4,2),(5,2),(9,2),(10,2),(11,2),(13,2),(14,2),(15,2),(16,2),(19,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(36,2),(37,2),(38,2),(39,2),(43,2),(44,2),(45,2),(46,2),(49,2),(2,3),(3,3),(4,3),(5,3),(8,3),(9,3),(10,3),(11,3),(13,3),(14,3),(15,3),(16,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(43,3),(44,3),(45,3),(46,3),(49,3),(0,4),(1,4),(2,4),(3,4),(5,4),(6,4),(7,4),(9,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(47,4),(48,4),(49,4),(0,5),(1,5),(2,5),(6,5),(7,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(18,5),(19,5),(20,5),(21,5),(22,5),(23,5),(24,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(48,5),(49,5),(0,6),(2,6),(6,6),(7,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(21,6),(22,6),(23,6),(24,6),(25,6),(26,6),(27,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(34,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(42,6),(43,6),(44,6),(45,6),(46,6),(47,6),(48,6),(49,6),(9,7),(10,7),(11,7),(12,7),(13,7),(14,7),(15,7),(16,7),(17,7),(18,7),(19,7),(20,7),(21,7),(22,7),(23,7),(24,7),(25,7),(26,7),(27,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(34,7),(35,7),(36,7),(37,7),(38,7),(39,7),(40,7),(41,7),(42,7),(43,7),(44,7),(45,7),(46,7),(47,7),(48,7),(49,7),(3,8),(4,8),(5,8),(9,8),(14,8),(15,8),(16,8),(17,8),(18,8),(19,8),(20,8),(21,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(34,8),(35,8),(36,8),(37,8),(38,8),(39,8),(40,8),(41,8),(42,8),(43,8),(44,8),(45,8),(46,8),(47,8),(48,8),(49,8),(2,9),(4,9),(5,9),(9,9),(10,9),(11,9),(12,9),(13,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(38,9),(39,9),(40,9),(41,9),(42,9),(43,9),(44,9),(45,9),(46,9),(47,9),(48,9),(49,9),(0,10),(1,10),(5,10),(10,10),(11,10),(12,10),(13,10),(14,10),(15,10),(0,11),(1,11),(5,11),(6,11),(7,11),(8,11),(9,11),(10,11),(11,11),(12,11),(13,11),(14,11),(15,11),(0,12),(1,12),(5,12),(6,12),(7,12),(8,12),(9,12),(10,12),(11,12),(12,12),(13,12),(14,12),(15,12),(1,13),(2,13),(3,13),(4,13),(5,13),(6,13),(7,13),(8,13),(9,13),(10,13),(11,13),(12,13),(13,13),(14,13),(15,13),(2,14),(3,14),(4,14),(5,14),(6,14),(7,14),(8,14),(9,14),(10,14),(11,14),(12,14),(13,14),(14,14),(15,14),(1,15),(2,15),(3,15),(4,15),(5,15),(6,15),(7,15),(8,15),(9,15),(10,15),(11,15),(12,15),(13,15),(1,16),(2,16),(3,16),(8,16),(9,16),(10,16),(11,16),(1,17),(2,17),(3,17),(8,17),(9,17),(10,17),(1,18),(8,18),(9,18),(10,18),(22,18),(23,18),(24,18),(25,18),(26,18),(27,18),(28,18),(29,18),(30,18),(31,18),(32,18),(33,18),(34,18),(35,18),(36,18),(37,18),(38,18),(39,18),(40,18),(41,18),(42,18),(43,18),(44,18),(45,18),(46,18),(47,18),(48,18),(49,18),(0,19),(1,19),(2,19),(3,19),(5,19),(8,19),(9,19),(10,19),(22,19),(23,19),(24,19),(28,19),(29,19),(30,19),(31,19),(32,19),(33,19),(34,19),(35,19),(36,19),(37,19),(38,19),(39,19),(40,19),(41,19),(42,19),(43,19),(44,19),(45,19),(46,19),(47,19),(48,19),(49,19),(0,20),(1,20),(2,20),(3,20),(4,20),(5,20),(8,20),(9,20),(10,20),(22,20),(23,20),(24,20),(25,20),(26,20),(27,20),(28,20),(29,20),(30,20),(31,20),(32,20),(33,20),(34,20),(35,20),(36,20),(37,20),(38,20),(39,20),(40,20),(41,20),(42,20),(43,20),(44,20),(45,20),(46,20),(47,20),(48,20),(49,20),(0,21),(1,21),(4,21),(5,21),(6,21),(7,21),(9,21),(10,21),(22,21),(23,21),(24,21),(25,21),(26,21),(27,21),(28,21),(29,21),(30,21),(31,21),(32,21),(33,21),(34,21),(35,21),(36,21),(37,21),(38,21),(39,21),(40,21),(41,21),(42,21),(43,21),(44,21),(45,21),(46,21),(47,21),(48,21),(49,21),(0,22),(1,22),(2,22),(3,22),(4,22),(5,22),(6,22),(7,22),(8,22),(9,22),(10,22),(16,22),(17,22),(18,22),(19,22),(20,22),(21,22),(22,22),(23,22),(24,22),(25,22),(26,22),(27,22),(28,22),(29,22),(30,22),(31,22),(32,22),(33,22),(34,22),(35,22),(36,22),(37,22),(38,22),(39,22),(40,22),(41,22),(42,22),(43,22),(44,22),(45,22),(46,22),(47,22),(48,22),(49,22),(0,23),(4,23),(5,23),(6,23),(7,23),(8,23),(9,23),(10,23),(16,23),(17,23),(18,23),(22,23),(23,23),(24,23),(25,23),(26,23),(27,23),(28,23),(29,23),(30,23),(31,23),(32,23),(36,23),(37,23),(38,23),(39,23),(40,23),(41,23),(42,23),(43,23),(44,23),(0,24),(1,24),(2,24),(3,24),(4,24),(5,24),(6,24),(7,24),(8,24),(9,24),(10,24),(16,24),(17,24),(18,24),(19,24),(20,24),(21,24),(22,24),(23,24),(24,24),(25,24),(26,24),(27,24),(28,24),(29,24),(30,24),(31,24),(32,24),(33,24),(34,24),(35,24),(36,24),(37,24),(38,24),(39,24),(40,24),(41,24),(42,24),(43,24),(44,24),(48,24),(49,24),(0,25),(1,25),(2,25),(3,25),(4,25),(5,25),(6,25),(7,25),(8,25),(9,25),(10,25),(16,25),(17,25),(18,25),(19,25),(20,25),(21,25),(22,25),(23,25),(24,25),(25,25),(26,25),(27,25),(28,25),(29,25),(30,25),(31,25),(34,25),(35,25),(36,25),(37,25),(38,25),(39,25),(40,25),(41,25),(42,25),(43,25),(44,25),(45,25),(46,25),(47,25),(48,25),(49,25),(0,26),(1,26),(2,26),(3,26),(4,26),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(16,26),(17,26),(18,26),(19,26),(20,26),(21,26),(23,26),(24,26),(25,26),(26,26),(27,26),(28,26),(29,26),(30,26),(31,26),(32,26),(33,26),(35,26),(46,26),(0,27),(1,27),(2,27),(3,27),(4,27),(5,27),(6,27),(7,27),(8,27),(9,27),(10,27),(16,27),(17,27),(18,27),(19,27),(20,27),(21,27),(23,27),(35,27),(36,27),(37,27),(38,27),(39,27),(40,27),(41,27),(42,27),(43,27),(44,27),(45,27),(46,27),(47,27),(48,27),(49,27),(0,28),(1,28),(2,28),(3,28),(4,28),(5,28),(6,28),(7,28),(8,28),(9,28),(10,28),(16,28),(17,28),(18,28),(19,28),(20,28),(21,28),(0,29),(1,29),(2,29),(3,29),(4,29),(5,29),(6,29),(7,29),(8,29),(9,29),(10,29),(12,29),(16,29),(17,29),(18,29),(19,29),(20,29),(21,29),(0,30),(1,30),(2,30),(3,30),(4,30),(5,30),(6,30),(7,30),(8,30),(9,30),(10,30),(11,30),(12,30),(16,30),(17,30),(18,30),(19,30),(0,31),(1,31),(2,31),(3,31),(4,31),(5,31),(8,31),(9,31),(11,31),(12,31),(16,31),(18,31),(19,31),(9,32),(10,32),(11,32),(12,32),(16,32),(19,32),(9,33),(12,33),(16,33),(19,33),(22,33),(23,33),(24,33),(25,33),(26,33),(27,33),(28,33),(29,33),(30,33),(31,33),(32,33),(33,33),(34,33),(35,33),(36,33),(37,33),(38,33),(39,33),(45,33),(46,33),(47,33),(48,33),(49,33),(0,34),(2,34),(9,34),(10,34),(11,34),(12,34),(16,34),(18,34),(19,34),(21,34),(22,34),(34,34),(35,34),(38,34),(40,34),(41,34),(42,34),(43,34),(44,34),(46,34),(47,34),(1,35),(2,35),(6,35),(8,35),(9,35),(10,35),(11,35),(12,35),(16,35),(17,35),(23,35),(24,35),(36,35),(37,35),(38,35),(39,35),(40,35),(44,35),(45,35),(46,35),(47,35),(0,36),(1,36),(2,36),(3,36),(5,36),(6,36),(7,36),(11,36),(12,36),(16,36),(17,36),(18,36),(19,36),(20,36),(22,36),(23,36),(24,36),(25,36),(26,36),(28,36),(29,36),(32,36),(36,36),(37,36),(38,36),(39,36),(40,36),(44,36),(49,36),(0,37),(4,37),(11,37),(12,37),(16,37),(17,37),(20,37),(21,37),(22,37),(23,37),(24,37),(25,37),(26,37),(28,37),(29,37),(30,37),(31,37),(32,37),(36,37),(37,37),(38,37),(39,37),(40,37),(44,37),(49,37),(0,38),(4,38),(11,38),(12,38),(16,38),(30,38),(31,38),(32,38),(36,38),(37,38),(38,38),(39,38),(40,38),(42,38),(43,38),(44,38),(48,38),(49,38),(0,39),(4,39),(11,39),(12,39),(16,39),(32,39),(33,39),(35,39),(36,39),(37,39),(38,39),(39,39),(40,39),(41,39),(42,39),(43,39),(44,39),(48,39),(49,39)}
if version == "1.3":
location.spawnable = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(26,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(41,0),(42,0),(43,0),(44,0),(45,0),(46,0),(47,0),(48,0),(49,0),(0,1),(1,1),(2,1),(3,1),(4,1),(0,2),(1,2),(2,2),(3,2),(6,2),(7,2),(8,2),(11,2),(12,2),(13,2),(15,2),(16,2),(18,2),(22,2),(27,2),(29,2),(32,2),(37,2),(38,2),(39,2),(42,2),(43,2),(44,2),(45,2),(46,2),(48,2),(0,3),(1,3),(2,3),(6,3),(7,3),(8,3),(9,3),(11,3),(12,3),(13,3),(15,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(31,3),(35,3),(36,3),(39,3),(41,3),(42,3),(44,3),(45,3),(47,3),(48,3),(0,4),(1,4),(4,4),(9,4),(10,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(44,4),(48,4),(0,5),(3,5),(4,5),(5,5),(7,5),(9,5),(10,5),(12,5),(16,5),(17,5),(18,5),(19,5),(20,5),(22,5),(24,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(49,5),(3,6),(4,6),(5,6),(9,6),(10,6),(15,6),(17,6),(18,6),(19,6),(20,6),(21,6),(29,6),(31,6),(32,6),(34,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(42,6),(43,6),(44,6),(45,6),(46,6),(47,6),(48,6),(49,6),(1,7),(2,7),(3,7),(4,7),(5,7),(15,7),(17,7),(19,7),(22,7),(23,7),(24,7),(25,7),(26,7),(27,7),(28,7),(29,7),(36,7),(37,7),(38,7),(0,8),(1,8),(2,8),(6,8),(7,8),(9,8),(11,8),(20,8),(21,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(34,8),(35,8),(36,8),(37,8),(38,8),(0,9),(1,9),(2,9),(4,9),(6,9),(7,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(23,9),(24,9),(38,9),(39,9),(40,9),(41,9),(42,9),(43,9),(44,9),(45,9),(46,9),(47,9),(48,9),(49,9),(7,10),(8,10),(9,10),(12,10),(13,10),(14,10),(21,10),(23,10),(27,10),(31,10),(36,10),(1,11),(3,11),(4,11),(5,11),(12,11),(16,11),(17,11),(19,11),(22,11),(25,11),(26,11),(27,11),(28,11),(31,11),(32,11),(35,11),(37,11),(40,11),(42,11),(43,11),(44,11),(45,11),(49,11),(3,12),(4,12),(7,12),(10,12),(11,12),(13,12),(15,12),(16,12),(21,12),(22,12),(23,12),(25,12),(26,12),(40,12),(47,12),(5,13),(10,13),(14,13),(15,13),(16,13),(18,13),(20,13),(21,13),(0,14),(1,14),(3,14),(12,14),(13,14),(20,14),(33,14),(0,15),(1,15),(5,15),(11,15),(12,15),(18,15),(19,15),(33,15),(0,16),(1,16),(2,16),(3,16),(4,16),(5,16),(6,16),(9,16),(10,16),(11,16),(16,16),(24,16),(29,16),(30,16),(31,16),(32,16),(33,16),(34,16),(35,16),(36,16),(43,16),(49,16),(2,17),(3,17),(4,17),(5,17),(6,17),(7,17),(9,17),(10,17),(26,17),(27,17),(28,17),(29,17),(33,17),(34,17),(35,17),(36,17),(37,17),(38,17),(39,17),(41,17),(42,17),(44,17),(45,17),(46,17),(47,17),(48,17),(0,18),(2,18),(3,18),(4,18),(5,18),(6,18),(9,18),(14,18),(24,18),(25,18),(26,18),(2,19),(3,19),(4,19),(5,19),(6,19),(9,19),(12,19),(13,19),(23,19),(24,19),(25,19),(26,19),(33,19),(34,19),(35,19),(36,19),(37,19),(38,19),(39,19),(40,19),(42,19),(43,19),(44,19),(45,19),(46,19),(47,19),(48,19),(49,19),(0,20),(1,20),(2,20),(3,20),(4,20),(5,20),(6,20),(9,20),(10,20),(11,20),(12,20),(22,20),(25,20),(26,20),(33,20),(34,20),(35,20),(36,20),(37,20),(38,20),(39,20),(40,20),(42,20),(43,20),(44,20),(45,20),(46,20),(47,20),(48,20),(49,20),(0,21),(1,21),(2,21),(3,21),(4,21),(5,21),(6,21),(7,21),(10,21),(11,21),(18,21),(20,21),(21,21),(22,21),(25,21),(0,22),(1,22),(2,22),(3,22),(4,22),(5,22),(6,22),(9,22),(10,22),(11,22),(20,22),(21,22),(28,22),(29,22),(30,22),(31,22),(32,22),(33,22),(34,22),(35,22),(36,22),(37,22),(38,22),(39,22),(40,22),(41,22),(42,22),(43,22),(44,22),(45,22),(46,22),(47,22),(48,22),(49,22),(1,23),(2,23),(3,23),(4,23),(9,23),(10,23),(15,23),(19,23),(23,23),(24,23),(26,23),(27,23),(28,23),(29,23),(30,23),(31,23),(32,23),(33,23),(34,23),(35,23),(36,23),(37,23),(38,23),(39,23),(40,23),(41,23),(42,23),(43,23),(44,23),(45,23),(46,23),(47,23),(48,23),(49,23),(0,24),(1,24),(7,24),(8,24),(9,24),(10,24),(15,24),(19,24),(20,24),(21,24),(24,24),(25,24),(26,24),(28,24),(37,24),(38,24),(39,24),(40,24),(49,24),(5,25),(6,25),(7,25),(8,25),(9,25),(10,25),(17,25),(19,25),(20,25),(21,25),(23,25),(24,25),(25,25),(26,25),(28,25),(31,25),(32,25),(33,25),(34,25),(42,25),(44,25),(45,25),(46,25),(1,26),(2,26),(3,26),(4,26),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(15,26),(18,26),(20,26),(21,26),(23,26),(24,26),(25,26),(26,26),(27,26),(28,26),(30,26),(31,26),(34,26),(35,26),(37,26),(38,26),(39,26),(40,26),(42,26),(43,26),(45,26),(46,26),(48,26),(0,27),(1,27),(2,27),(3,27),(4,27),(5,27),(6,27),(7,27),(18,27),(19,27),(20,27),(21,27),(30,27),(34,27),(35,27),(36,27),(38,27),(41,27),(42,27),(44,27),(46,27),(47,27),(48,27),(49,27),(0,28),(1,28),(2,28),(3,28),(9,28),(10,28),(18,28),(19,28),(20,28),(21,28),(5,29),(6,29),(7,29),(9,29),(17,29),(19,29),(21,29),(0,30),(1,30),(2,30),(3,30),(4,30),(5,30),(6,30),(11,30),(17,30),(20,30),(21,30),(0,31),(1,31),(2,31),(3,31),(4,31),(10,31),(19,31),(21,31),(9,32),(10,32),(11,32),(20,32),(21,32),(1,33),(6,33),(7,33),(8,33),(10,33),(11,33),(17,33),(20,33),(21,33),(40,33),(43,33),(44,33),(46,33),(48,33),(49,33),(4,34),(17,34),(20,34),(21,34),(22,34),(27,34),(28,34),(29,34),(36,34),(37,34),(39,34),(43,34),(44,34),(45,34),(46,34),(47,34),(49,34),(1,35),(9,35),(17,35),(19,35),(20,35),(21,35),(22,35),(25,35),(34,35),(39,35),(45,35),(46,35),(48,35),(49,35),(7,36),(17,36),(28,36),(34,36),(35,36),(39,36),(41,36),(42,36),(43,36),(45,36),(46,36),(47,36),(49,36),(1,37),(4,37),(21,37),(24,37),(26,37),(28,37),(30,37),(31,37),(39,37),(40,37),(42,37),(43,37),(44,37),(45,37),(46,37),(47,37),(49,37),(0,38),(1,38),(2,38),(6,38),(7,38),(8,38),(9,38),(11,38),(17,38),(19,38),(23,38),(24,38),(28,38),(30,38),(31,38),(33,38),(34,38),(40,38),(42,38),(44,38),(45,38),(46,38),(47,38),(48,38),(1,39),(3,39),(5,39),(6,39),(8,39),(19,39),(20,39),(21,39),(22,39),(23,39),(24,39),(25,39),(26,39),(27,39),(28,39),(34,39),(37,39),(38,39),(39,39),(40,39),(42,39),(44,39),(45,39),(46,39),(47,39),(49,39)}
location.alwaysFront = {(5,19),(6,19),(7,19),(5,20),(6,20),(7,20),(5,21),(6,21),(7,21),(5,22),(6,22),(7,22),(20,24),(21,24),(22,24),(20,25),(21,25),(22,25),(20,26),(21,26),(22,26),(23,26),(20,27),(21,27),(22,27),(23,27),(22,28),(23,28),(22,29),(23,29),(22,30),(23,30),(44,30),(45,30),(46,30),(22,31),(23,31),(44,31),(45,31),(46,31),(20,32),(21,32),(22,32),(23,32),(25,32),(26,32),(27,32),(28,32),(29,32),(30,32),(31,32),(32,32),(33,32),(44,32),(45,32),(46,32),(20,33),(21,33),(22,33),(23,33),(25,33),(26,33),(27,33),(28,33),(29,33),(30,33),(31,33),(32,33),(33,33),(44,33),(45,33),(46,33),(20,34),(21,34),(22,34),(25,34),(26,34),(27,34),(28,34),(29,34),(30,34),(31,34),(32,34),(33,34),(46,34),(28,35),(29,35),(30,35),(31,35),(32,35),(33,35),(44,35),(46,35)}
location.front = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(10,0),(11,0),(12,0),(13,0),(15,0),(16,0),(22,0),(23,0),(26,0),(27,0),(28,0),(30,0),(31,0),(41,0),(42,0),(43,0),(44,0),(45,0),(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(11,1),(12,1),(13,1),(15,1),(16,1),(22,1),(23,1),(34,1),(35,1),(43,1),(44,1),(45,1),(0,2),(1,2),(2,2),(3,2),(4,2),(6,2),(7,2),(8,2),(11,2),(12,2),(13,2),(17,2),(18,2),(34,2),(35,2),(40,2),(41,2),(42,2),(47,2),(48,2),(0,3),(1,3),(2,3),(3,3),(6,3),(7,3),(8,3),(9,3),(10,3),(11,3),(12,3),(13,3),(17,3),(18,3),(40,3),(41,3),(42,3),(47,3),(48,3),(0,4),(1,4),(2,4),(3,4),(4,4),(5,4),(8,4),(9,4),(10,4),(0,5),(1,5),(3,5),(4,5),(5,5),(8,5),(9,5),(10,5),(0,6),(1,6),(2,6),(3,6),(4,6),(5,6),(8,6),(9,6),(10,6),(0,7),(1,7),(2,7),(3,7),(4,7),(5,7),(6,7),(7,7),(8,7),(11,7),(12,7),(13,7),(0,8),(1,8),(2,8),(6,8),(7,8),(8,8),(11,8),(12,8),(13,8),(0,9),(1,9),(2,9),(3,9),(4,9),(6,9),(7,9),(8,9),(2,10),(3,10),(4,10),(6,10),(7,10),(8,10),(9,10),(2,11),(3,11),(4,11),(2,12),(3,12),(4,12),(0,13),(1,13),(0,14),(1,14),(0,15),(1,15),(2,15),(3,15),(4,15),(5,15),(6,15),(7,15),(0,16),(1,16),(2,16),(3,16),(4,16),(5,16),(6,16),(7,16),(0,17),(1,17),(2,17),(3,17),(4,17),(5,17),(6,17),(7,17),(22,17),(23,17),(24,17),(25,17),(26,17),(27,17),(28,17),(29,17),(30,17),(31,17),(32,17),(33,17),(34,17),(35,17),(36,17),(37,17),(38,17),(39,17),(40,17),(41,17),(42,17),(43,17),(44,17),(45,17),(46,17),(47,17),(48,17),(49,17),(0,18),(1,18),(2,18),(3,18),(4,18),(5,18),(6,18),(7,18),(22,18),(23,18),(24,18),(25,18),(26,18),(27,18),(4,19),(25,19),(26,19),(27,19),(33,20),(34,20),(35,20),(0,21),(1,21),(2,21),(3,21),(4,21),(5,21),(8,21),(16,21),(17,21),(18,21),(19,21),(20,21),(21,21),(29,21),(30,21),(31,21),(33,21),(34,21),(35,21),(42,21),(43,21),(44,21),(45,21),(46,21),(47,21),(1,22),(2,22),(3,22),(16,22),(17,22),(18,22),(19,22),(20,22),(21,22),(28,22),(29,22),(30,22),(31,22),(33,22),(34,22),(35,22),(42,22),(43,22),(44,22),(45,22),(46,22),(47,22),(48,22),(49,22),(1,23),(2,23),(3,23),(19,23),(20,23),(21,23),(33,23),(34,23),(35,23),(45,23),(46,23),(47,23),(48,23),(49,23),(20,24),(22,24),(45,24),(46,24),(47,24),(32,25),(33,25),(17,26),(18,26),(19,26),(22,26),(23,26),(35,26),(36,26),(37,26),(38,26),(39,26),(40,26),(41,26),(42,26),(43,26),(44,26),(45,26),(46,26),(47,26),(48,26),(49,26),(9,27),(10,27),(11,27),(17,27),(18,27),(19,27),(21,27),(22,27),(9,28),(10,28),(11,28),(17,28),(18,28),(19,28),(21,28),(22,28),(6,29),(7,29),(9,29),(10,29),(11,29),(17,29),(18,29),(19,29),(0,30),(1,30),(2,30),(4,30),(5,30),(9,30),(10,30),(11,30),(16,30),(17,30),(18,30),(20,30),(21,30),(0,31),(1,31),(2,31),(6,31),(7,31),(8,31),(10,31),(16,31),(17,31),(18,31),(20,31),(21,31),(0,32),(1,32),(2,32),(3,32),(4,32),(5,32),(6,32),(7,32),(8,32),(16,32),(17,32),(18,32),(20,32),(22,32),(23,32),(25,32),(26,32),(27,32),(29,32),(30,32),(31,32),(32,32),(33,32),(34,32),(35,32),(36,32),(37,32),(38,32),(39,32),(45,32),(46,32),(47,32),(48,32),(49,32),(0,33),(1,33),(2,33),(3,33),(4,33),(5,33),(6,33),(7,33),(8,33),(10,33),(11,33),(16,33),(17,33),(18,33),(20,33),(21,33),(22,33),(23,33),(24,33),(25,33),(26,33),(27,33),(28,33),(29,33),(30,33),(31,33),(32,33),(33,33),(34,33),(35,33),(36,33),(37,33),(38,33),(48,33),(49,33),(1,34),(3,34),(4,34),(5,34),(6,34),(7,34),(8,34),(17,34),(20,34),(21,34),(22,34),(23,34),(24,34),(25,34),(26,34),(27,34),(28,34),(29,34),(30,34),(31,34),(32,34),(33,34),(36,34),(37,34),(38,34),(39,34),(45,34),(48,34),(49,34),(0,35),(1,35),(3,35),(4,35),(5,35),(7,35),(18,35),(19,35),(20,35),(21,35),(22,35),(25,35),(26,35),(27,35),(28,35),(29,35),(30,35),(31,35),(32,35),(33,35),(34,35),(35,35),(39,35),(41,35),(42,35),(43,35),(48,35),(49,35),(4,36),(8,36),(9,36),(10,36),(21,36),(26,36),(27,36),(28,36),(30,36),(31,36),(33,36),(34,36),(35,36),(41,36),(42,36),(43,36),(45,36),(46,36),(47,36),(48,36),(49,36),(1,37),(2,37),(3,37),(5,37),(6,37),(7,37),(8,37),(9,37),(10,37),(17,37),(18,37),(19,37),(23,37),(24,37),(25,37),(26,37),(27,37),(28,37),(33,37),(34,37),(35,37),(38,37),(39,37),(40,37),(41,37),(42,37),(43,37),(45,37),(46,37),(47,37),(1,38),(2,38),(3,38),(5,38),(6,38),(7,38),(8,38),(9,38),(10,38),(17,38),(18,38),(19,38),(20,38),(21,38),(22,38),(23,38),(24,38),(25,38),(26,38),(27,38),(28,38),(29,38),(30,38),(31,38),(33,38),(34,38),(35,38),(38,38),(39,38),(40,38),(41,38),(42,38),(43,38),(45,38),(46,38),(47,38),(1,39),(2,39),(3,39),(5,39),(6,39),(7,39),(8,39),(9,39),(10,39),(17,39),(18,39),(19,39),(20,39),(21,39),(22,39),(23,39),(24,39),(25,39),(26,39),(27,39),(28,39),(29,39),(30,39),(31,39),(34,39),(38,39),(39,39),(40,39),(45,39),(46,39),(47,39)}
location.buildings = {(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(13,0),(14,0),(17,0),(18,0),(19,0),(20,0),(21,0),(24,0),(25,0),(29,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(46,0),(47,0),(48,0),(49,0),(4,1),(5,1),(9,1),(10,1),(13,1),(14,1),(17,1),(18,1),(19,1),(20,1),(21,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(36,1),(37,1),(38,1),(39,1),(40,1),(41,1),(42,1),(44,1),(46,1),(47,1),(48,1),(49,1),(2,2),(3,2),(4,2),(5,2),(9,2),(10,2),(11,2),(13,2),(14,2),(15,2),(16,2),(19,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(36,2),(37,2),(38,2),(39,2),(43,2),(44,2),(45,2),(46,2),(49,2),(2,3),(3,3),(4,3),(5,3),(8,3),(9,3),(10,3),(11,3),(13,3),(14,3),(15,3),(16,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(43,3),(44,3),(45,3),(46,3),(49,3),(0,4),(1,4),(2,4),(3,4),(5,4),(6,4),(7,4),(9,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(47,4),(48,4),(49,4),(0,5),(1,5),(2,5),(6,5),(7,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(18,5),(19,5),(20,5),(21,5),(22,5),(23,5),(24,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(48,5),(49,5),(0,6),(2,6),(6,6),(7,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(21,6),(22,6),(23,6),(24,6),(25,6),(26,6),(27,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(34,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(42,6),(43,6),(44,6),(45,6),(46,6),(47,6),(48,6),(49,6),(9,7),(10,7),(11,7),(12,7),(13,7),(14,7),(15,7),(16,7),(17,7),(18,7),(19,7),(20,7),(21,7),(22,7),(23,7),(24,7),(25,7),(26,7),(27,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(34,7),(35,7),(36,7),(37,7),(38,7),(39,7),(40,7),(41,7),(42,7),(43,7),(44,7),(45,7),(46,7),(47,7),(48,7),(49,7),(3,8),(4,8),(5,8),(9,8),(14,8),(15,8),(16,8),(17,8),(18,8),(19,8),(20,8),(21,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(34,8),(35,8),(36,8),(37,8),(38,8),(39,8),(40,8),(41,8),(42,8),(43,8),(44,8),(45,8),(46,8),(47,8),(48,8),(49,8),(2,9),(4,9),(5,9),(9,9),(10,9),(11,9),(12,9),(13,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(38,9),(39,9),(40,9),(41,9),(42,9),(43,9),(44,9),(45,9),(46,9),(47,9),(48,9),(49,9),(0,10),(1,10),(5,10),(10,10),(11,10),(12,10),(13,10),(14,10),(15,10),(0,11),(1,11),(5,11),(6,11),(7,11),(8,11),(9,11),(10,11),(11,11),(12,11),(13,11),(14,11),(15,11),(0,12),(1,12),(5,12),(6,12),(7,12),(8,12),(9,12),(10,12),(11,12),(12,12),(13,12),(14,12),(15,12),(1,13),(2,13),(3,13),(4,13),(5,13),(6,13),(7,13),(8,13),(9,13),(10,13),(11,13),(12,13),(13,13),(14,13),(15,13),(2,14),(3,14),(4,14),(5,14),(6,14),(7,14),(8,14),(9,14),(10,14),(11,14),(12,14),(13,14),(14,14),(15,14),(1,15),(2,15),(3,15),(4,15),(5,15),(6,15),(7,15),(8,15),(9,15),(10,15),(11,15),(12,15),(13,15),(1,16),(2,16),(3,16),(8,16),(9,16),(10,16),(11,16),(1,17),(2,17),(3,17),(8,17),(9,17),(10,17),(1,18),(8,18),(9,18),(10,18),(22,18),(23,18),(24,18),(25,18),(26,18),(27,18),(28,18),(29,18),(30,18),(31,18),(32,18),(33,18),(34,18),(35,18),(36,18),(37,18),(38,18),(39,18),(40,18),(41,18),(42,18),(43,18),(44,18),(45,18),(46,18),(47,18),(48,18),(49,18),(0,19),(1,19),(2,19),(3,19),(5,19),(8,19),(9,19),(10,19),(22,19),(23,19),(24,19),(28,19),(29,19),(30,19),(31,19),(32,19),(33,19),(34,19),(35,19),(36,19),(37,19),(38,19),(39,19),(40,19),(41,19),(42,19),(43,19),(44,19),(45,19),(46,19),(47,19),(48,19),(49,19),(0,20),(1,20),(2,20),(3,20),(4,20),(5,20),(8,20),(9,20),(10,20),(22,20),(23,20),(24,20),(25,20),(26,20),(27,20),(28,20),(29,20),(30,20),(31,20),(32,20),(33,20),(34,20),(35,20),(36,20),(37,20),(38,20),(39,20),(40,20),(41,20),(42,20),(43,20),(44,20),(45,20),(46,20),(47,20),(48,20),(49,20),(0,21),(1,21),(4,21),(5,21),(6,21),(7,21),(9,21),(10,21),(22,21),(23,21),(24,21),(25,21),(26,21),(27,21),(28,21),(29,21),(30,21),(31,21),(32,21),(33,21),(34,21),(35,21),(36,21),(37,21),(38,21),(39,21),(40,21),(41,21),(42,21),(43,21),(44,21),(45,21),(46,21),(47,21),(48,21),(49,21),(0,22),(1,22),(2,22),(3,22),(4,22),(5,22),(6,22),(7,22),(8,22),(9,22),(10,22),(16,22),(17,22),(18,22),(19,22),(20,22),(21,22),(22,22),(23,22),(24,22),(25,22),(26,22),(27,22),(28,22),(29,22),(30,22),(31,22),(32,22),(33,22),(34,22),(35,22),(36,22),(37,22),(38,22),(39,22),(40,22),(41,22),(42,22),(43,22),(44,22),(45,22),(46,22),(47,22),(48,22),(49,22),(0,23),(4,23),(5,23),(6,23),(7,23),(8,23),(9,23),(10,23),(16,23),(17,23),(18,23),(22,23),(23,23),(24,23),(25,23),(26,23),(27,23),(28,23),(29,23),(30,23),(31,23),(32,23),(36,23),(37,23),(38,23),(39,23),(40,23),(41,23),(42,23),(43,23),(44,23),(0,24),(1,24),(2,24),(3,24),(4,24),(5,24),(6,24),(7,24),(8,24),(9,24),(10,24),(16,24),(17,24),(18,24),(19,24),(20,24),(21,24),(22,24),(23,24),(24,24),(25,24),(26,24),(27,24),(28,24),(29,24),(30,24),(31,24),(32,24),(33,24),(34,24),(35,24),(36,24),(37,24),(38,24),(39,24),(40,24),(41,24),(42,24),(43,24),(44,24),(48,24),(49,24),(0,25),(1,25),(2,25),(3,25),(4,25),(5,25),(6,25),(7,25),(8,25),(9,25),(10,25),(16,25),(17,25),(18,25),(19,25),(20,25),(21,25),(22,25),(23,25),(24,25),(25,25),(26,25),(27,25),(28,25),(29,25),(30,25),(31,25),(34,25),(35,25),(36,25),(37,25),(38,25),(39,25),(40,25),(41,25),(42,25),(43,25),(44,25),(45,25),(46,25),(47,25),(48,25),(49,25),(0,26),(1,26),(2,26),(3,26),(4,26),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(16,26),(17,26),(18,26),(19,26),(20,26),(21,26),(23,26),(24,26),(25,26),(26,26),(27,26),(28,26),(29,26),(30,26),(31,26),(32,26),(33,26),(35,26),(46,26),(0,27),(1,27),(2,27),(3,27),(4,27),(5,27),(6,27),(7,27),(8,27),(9,27),(10,27),(16,27),(17,27),(18,27),(19,27),(20,27),(21,27),(23,27),(35,27),(36,27),(37,27),(38,27),(39,27),(40,27),(41,27),(42,27),(43,27),(44,27),(45,27),(46,27),(47,27),(48,27),(49,27),(0,28),(1,28),(2,28),(3,28),(4,28),(5,28),(6,28),(7,28),(8,28),(9,28),(10,28),(16,28),(17,28),(18,28),(19,28),(20,28),(21,28),(0,29),(1,29),(2,29),(3,29),(4,29),(5,29),(6,29),(7,29),(8,29),(9,29),(10,29),(12,29),(16,29),(17,29),(18,29),(19,29),(20,29),(21,29),(0,30),(1,30),(2,30),(3,30),(4,30),(5,30),(6,30),(7,30),(8,30),(9,30),(10,30),(11,30),(12,30),(16,30),(17,30),(18,30),(19,30),(0,31),(1,31),(2,31),(3,31),(4,31),(5,31),(8,31),(9,31),(11,31),(12,31),(16,31),(18,31),(19,31),(9,32),(10,32),(11,32),(12,32),(16,32),(19,32),(9,33),(12,33),(16,33),(19,33),(22,33),(23,33),(24,33),(25,33),(26,33),(27,33),(28,33),(29,33),(30,33),(31,33),(32,33),(33,33),(34,33),(35,33),(36,33),(37,33),(38,33),(39,33),(45,33),(46,33),(47,33),(48,33),(49,33),(0,34),(2,34),(9,34),(10,34),(11,34),(12,34),(16,34),(18,34),(19,34),(21,34),(22,34),(34,34),(35,34),(38,34),(40,34),(41,34),(42,34),(43,34),(44,34),(46,34),(47,34),(1,35),(2,35),(6,35),(8,35),(9,35),(10,35),(11,35),(12,35),(16,35),(17,35),(23,35),(24,35),(36,35),(37,35),(38,35),(39,35),(40,35),(44,35),(45,35),(46,35),(47,35),(0,36),(1,36),(2,36),(3,36),(5,36),(6,36),(7,36),(11,36),(12,36),(16,36),(17,36),(18,36),(19,36),(20,36),(22,36),(23,36),(24,36),(25,36),(26,36),(28,36),(29,36),(32,36),(36,36),(37,36),(38,36),(39,36),(40,36),(44,36),(49,36),(0,37),(4,37),(11,37),(12,37),(16,37),(17,37),(20,37),(21,37),(22,37),(23,37),(24,37),(25,37),(26,37),(28,37),(29,37),(30,37),(31,37),(32,37),(36,37),(37,37),(38,37),(39,37),(40,37),(44,37),(49,37),(0,38),(4,38),(11,38),(12,38),(16,38),(30,38),(31,38),(32,38),(36,38),(37,38),(38,38),(39,38),(40,38),(42,38),(43,38),(44,38),(48,38),(49,38),(0,39),(4,39),(11,39),(12,39),(16,39),(32,39),(33,39),(35,39),(36,39),(37,39),(38,39),(39,39),(40,39),(41,39),(42,39),(43,39),(44,39),(48,39),(49,39)}
location.terrainFeatures = {(11,17),(12,17),(12,16),(14,15),(15,15),(16,10),(17,10),(18,10),(16,11),(20,9),(22,8),(23,8),(24,8),(24,27),(24,33),(25,33),(26,33),(25,27),(26,27),(26,8),(27,8),(27,33),(28,33),(28,16),(29,16),(28,26),(29,26),(29,33),(30,33),(30,27),(31,9),(32,9),(31,17),(31,26),(32,27),(33,27),(34,27),(34,15),(34,17),(35,17),(36,11),(37,16),(38,16),(39,16),(38,10),(39,10),(40,10),(40,33),(41,33),(42,33),(43,33),(44,33),(44,10),(45,17),(46,17),(47,17),(46,10),(47,10),(48,10),(48,17),(49,10),(24,10),(32,16),(42,11)};
location.behindbush = {(11,16),(12,16),(12,15),(14,14),(15,14),(16,9),(17,9),(18,9),(16,10),(20,8),(22,7),(23,7),(24,7),(24,26),(24,32),(25,32),(26,32),(25,26),(26,26),(26,7),(27,7),(27,32),(28,32),(28,15),(29,15),(28,25),(29,25),(29,32),(30,32),(30,26),(31,8),(32,8),(31,16),(31,25),(32,26),(33,26),(34,26),(34,14),(34,16),(35,16),(36,10),(37,15),(38,15),(39,15),(38,9),(39,9),(40,9),(40,32),(41,32),(42,32),(43,32),(44,32),(44,9),(45,16),(46,16),(47,16),(46,9),(47,9),(48,9),(48,16),(49,9)};
location.behindtree = {(23,7),(23,8),(23,9),(23,10),(24,7),(24,8),(24,9),(24,10),(25,7),(25,8),(25,9),(25,10),(31,13),(31,14),(31,15),(31,16),(32,13),(32,14),(32,15),(32,16),(33,13),(33,14),(33,15),(33,16),(41,8),(41,9),(41,10),(41,11),(42,8),(42,9),(42,10),(42,11),(43,8),(43,9),(43,10),(43,11)};
location.diggable = {(33,12),(27,13),(28,13),(29,13),(30,13),(31,13),(34,13),(22,14),(23,14),(25,14),(38,14),(39,14),(40,14),(41,14),(42,14),(43,14),(45,14),(46,14),(47,14),(48,14),(49,14),(21,15),(22,15),(20,16),(21,16),(17,17),(18,17),(19,17),(20,17),(18,18),(19,18),(15,19),(16,19),(17,19),(14,20),(15,20),(16,20),(13,21),(14,21),(13,22),(12,23),(13,23),(12,24),(13,24),(12,25),(13,25),(12,26),(13,26),(13,27),(13,28),(13,29),(14,30),(15,30),(14,38),(14,39)}
return location
def createMountain(version="1.4"):
location = Location("Mountain")
location.width = 135;
location.height = 41;
location.spawns = {
0: [[20, .7], [16, .5]],
1: [[396, .5], [398, .8]],
2: [[404, .4], [406, .4], [408, .9]],
3: [[414, .85], [418, .9], [283, .5]]}
if version == "1.4":
location.spawnable = {(0,0),(1,0),(3,0),(4,0),(5,0),(6,0),(7,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(26,0),(28,0),(29,0),(30,0),(32,0),(34,0),(35,0),(36,0),(37,0),(38,0),(64,0),(65,0),(66,0),(67,0),(68,0),(69,0),(70,0),(71,0),(72,0),(73,0),(74,0),(75,0),(76,0),(77,0),(78,0),(79,0),(80,0),(81,0),(82,0),(86,0),(88,0),(91,0),(96,0),(105,0),(106,0),(107,0),(109,0),(110,0),(111,0),(113,0),(114,0),(115,0),(116,0),(117,0),(119,0),(121,0),(122,0),(123,0),(124,0),(125,0),(127,0),(128,0),(129,0),(131,0),(132,0),(133,0),(0,1),(1,1),(3,1),(4,1),(5,1),(6,1),(7,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(28,1),(29,1),(30,1),(32,1),(34,1),(35,1),(36,1),(37,1),(43,1),(47,1),(53,1),(56,1),(57,1),(58,1),(59,1),(63,1),(85,1),(86,1),(87,1),(91,1),(92,1),(93,1),(94,1),(107,1),(112,1),(122,1),(130,1),(132,1),(134,1),(0,2),(1,2),(3,2),(4,2),(5,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(28,2),(29,2),(30,2),(31,2),(32,2),(34,2),(35,2),(36,2),(37,2),(38,2),(41,2),(42,2),(43,2),(44,2),(45,2),(46,2),(47,2),(48,2),(49,2),(50,2),(51,2),(52,2),(53,2),(54,2),(55,2),(56,2),(57,2),(58,2),(59,2),(60,2),(61,2),(62,2),(64,2),(67,2),(74,2),(81,2),(85,2),(87,2),(89,2),(90,2),(91,2),(92,2),(105,2),(111,2),(112,2),(113,2),(114,2),(115,2),(116,2),(117,2),(118,2),(119,2),(120,2),(121,2),(122,2),(123,2),(124,2),(125,2),(126,2),(127,2),(128,2),(129,2),(131,2),(132,2),(133,2),(134,2),(0,3),(3,3),(4,3),(5,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(41,3),(42,3),(43,3),(44,3),(45,3),(46,3),(49,3),(50,3),(51,3),(52,3),(53,3),(55,3),(56,3),(57,3),(58,3),(59,3),(60,3),(61,3),(62,3),(63,3),(64,3),(66,3),(69,3),(70,3),(71,3),(72,3),(73,3),(74,3),(75,3),(76,3),(77,3),(78,3),(79,3),(80,3),(81,3),(83,3),(84,3),(89,3),(90,3),(91,3),(105,3),(109,3),(110,3),(111,3),(112,3),(113,3),(114,3),(115,3),(116,3),(117,3),(118,3),(119,3),(120,3),(121,3),(122,3),(123,3),(124,3),(125,3),(126,3),(127,3),(128,3),(129,3),(130,3),(132,3),(133,3),(134,3),(0,4),(3,4),(4,4),(5,4),(6,4),(11,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(34,4),(35,4),(36,4),(37,4),(38,4),(41,4),(42,4),(43,4),(45,4),(49,4),(50,4),(51,4),(52,4),(53,4),(55,4),(56,4),(57,4),(58,4),(59,4),(60,4),(61,4),(62,4),(63,4),(64,4),(65,4),(66,4),(67,4),(68,4),(69,4),(70,4),(71,4),(72,4),(73,4),(74,4),(75,4),(76,4),(77,4),(78,4),(79,4),(80,4),(81,4),(82,4),(83,4),(84,4),(85,4),(86,4),(87,4),(88,4),(91,4),(106,4),(109,4),(110,4),(111,4),(112,4),(113,4),(114,4),(115,4),(116,4),(117,4),(118,4),(119,4),(120,4),(121,4),(122,4),(123,4),(124,4),(125,4),(126,4),(127,4),(128,4),(129,4),(130,4),(133,4),(134,4),(0,5),(3,5),(59,5),(60,5),(61,5),(62,5),(63,5),(64,5),(65,5),(66,5),(67,5),(68,5),(69,5),(70,5),(71,5),(72,5),(73,5),(82,5),(83,5),(84,5),(85,5),(91,5),(103,5),(105,5),(109,5),(110,5),(111,5),(112,5),(113,5),(114,5),(115,5),(116,5),(117,5),(118,5),(119,5),(120,5),(121,5),(122,5),(123,5),(124,5),(125,5),(126,5),(127,5),(128,5),(129,5),(130,5),(133,5),(134,5),(15,6),(16,6),(23,6),(27,6),(28,6),(30,6),(33,6),(35,6),(36,6),(37,6),(62,6),(63,6),(64,6),(65,6),(66,6),(67,6),(68,6),(69,6),(70,6),(71,6),(72,6),(73,6),(74,6),(75,6),(76,6),(77,6),(78,6),(79,6),(83,6),(91,6),(103,6),(107,6),(109,6),(110,6),(111,6),(112,6),(113,6),(114,6),(115,6),(116,6),(117,6),(118,6),(119,6),(120,6),(121,6),(122,6),(123,6),(124,6),(125,6),(126,6),(127,6),(128,6),(129,6),(130,6),(133,6),(134,6),(5,7),(6,7),(15,7),(16,7),(22,7),(23,7),(35,7),(36,7),(37,7),(39,7),(64,7),(65,7),(66,7),(67,7),(68,7),(69,7),(74,7),(75,7),(76,7),(77,7),(78,7),(79,7),(80,7),(81,7),(83,7),(89,7),(102,7),(103,7),(104,7),(109,7),(110,7),(111,7),(112,7),(113,7),(114,7),(115,7),(116,7),(117,7),(118,7),(119,7),(120,7),(121,7),(122,7),(123,7),(124,7),(125,7),(126,7),(127,7),(128,7),(129,7),(130,7),(134,7),(0,8),(1,8),(5,8),(32,8),(33,8),(34,8),(36,8),(37,8),(40,8),(62,8),(66,8),(67,8),(68,8),(69,8),(74,8),(75,8),(76,8),(77,8),(78,8),(81,8),(82,8),(88,8),(89,8),(102,8),(103,8),(109,8),(110,8),(111,8),(112,8),(113,8),(114,8),(115,8),(116,8),(117,8),(118,8),(119,8),(120,8),(121,8),(122,8),(123,8),(124,8),(125,8),(126,8),(127,8),(128,8),(129,8),(130,8),(133,8),(0,9),(1,9),(3,9),(36,9),(37,9),(38,9),(40,9),(64,9),(83,9),(85,9),(86,9),(89,9),(102,9),(103,9),(107,9),(133,9),(134,9),(3,10),(61,10),(62,10),(63,10),(65,10),(67,10),(69,10),(85,10),(86,10),(101,10),(102,10),(103,10),(104,10),(105,10),(106,10),(107,10),(133,10),(134,10),(24,11),(64,11),(69,11),(82,11),(83,11),(88,11),(101,11),(102,11),(103,11),(104,11),(105,11),(106,11),(107,11),(133,11),(134,11),(1,12),(24,12),(29,12),(64,12),(82,12),(83,12),(84,12),(85,12),(86,12),(87,12),(88,12),(101,12),(102,12),(103,12),(104,12),(105,12),(106,12),(107,12),(133,12),(134,12),(23,13),(24,13),(26,13),(27,13),(30,13),(31,13),(33,13),(34,13),(84,13),(86,13),(87,13),(101,13),(102,13),(103,13),(104,13),(105,13),(106,13),(107,13),(133,13),(134,13),(34,14),(36,14),(83,14),(85,14),(86,14),(88,14),(101,14),(102,14),(103,14),(104,14),(105,14),(106,14),(107,14),(133,14),(134,14),(0,15),(7,15),(8,15),(9,15),(10,15),(11,15),(12,15),(13,15),(14,15),(15,15),(27,15),(28,15),(33,15),(36,15),(40,15),(85,15),(87,15),(101,15),(105,15),(106,15),(107,15),(133,15),(134,15),(0,16),(7,16),(8,16),(9,16),(10,16),(11,16),(12,16),(13,16),(14,16),(15,16),(16,16),(24,16),(40,16),(85,16),(86,16),(106,16),(107,16),(133,16),(134,16),(0,17),(7,17),(8,17),(9,17),(10,17),(11,17),(12,17),(13,17),(14,17),(15,17),(16,17),(22,17),(24,17),(39,17),(40,17),(89,17),(107,17),(133,17),(134,17),(0,18),(8,18),(9,18),(10,18),(11,18),(12,18),(13,18),(14,18),(15,18),(16,18),(22,18),(24,18),(25,18),(26,18),(30,18),(31,18),(32,18),(33,18),(34,18),(35,18),(39,18),(40,18),(41,18),(57,18),(84,18),(85,18),(86,18),(87,18),(88,18),(89,18),(106,18),(107,18),(134,18),(0,19),(8,19),(9,19),(10,19),(11,19),(12,19),(13,19),(14,19),(15,19),(16,19),(17,19),(18,19),(19,19),(20,19),(26,19),(38,19),(40,19),(42,19),(57,19),(85,19),(87,19),(88,19),(101,19),(102,19),(103,19),(104,19),(105,19),(133,19),(134,19),(0,20),(8,20),(9,20),(10,20),(11,20),(12,20),(13,20),(14,20),(15,20),(16,20),(17,20),(18,20),(19,20),(20,20),(27,20),(28,20),(33,20),(38,20),(39,20),(40,20),(41,20),(42,20),(43,20),(57,20),(58,20),(59,20),(67,20),(88,20),(133,20),(134,20),(0,21),(2,21),(16,21),(17,21),(18,21),(19,21),(20,21),(21,21),(37,21),(38,21),(39,21),(40,21),(42,21),(43,21),(58,21),(59,21),(67,21),(88,21),(133,21),(134,21),(0,22),(15,22),(16,22),(17,22),(18,22),(19,22),(20,22),(21,22),(29,22),(41,22),(43,22),(44,22),(45,22),(58,22),(133,22),(134,22),(0,23),(15,23),(16,23),(17,23),(18,23),(19,23),(20,23),(21,23),(42,23),(43,23),(44,23),(45,23),(46,23),(89,23),(105,23),(133,23),(134,23),(0,24),(15,24),(20,24),(21,24),(24,24),(25,24),(26,24),(27,24),(28,24),(29,24),(30,24),(31,24),(32,24),(33,24),(34,24),(44,24),(45,24),(133,24),(134,24),(0,25),(2,25),(21,25),(35,25),(36,25),(44,25),(46,25),(133,25),(134,25),(0,26),(2,26),(21,26),(22,26),(23,26),(24,26),(25,26),(26,26),(27,26),(28,26),(29,26),(30,26),(31,26),(32,26),(33,26),(34,26),(35,26),(36,26),(37,26),(45,26),(46,26),(133,26),(134,26),(0,27),(2,27),(23,27),(24,27),(25,27),(26,27),(27,27),(28,27),(29,27),(30,27),(31,27),(32,27),(33,27),(34,27),(35,27),(36,27),(37,27),(38,27),(44,27),(45,27),(46,27),(84,27),(134,27),(0,28),(2,28),(23,28),(24,28),(25,28),(26,28),(27,28),(28,28),(29,28),(30,28),(33,28),(34,28),(35,28),(36,28),(37,28),(38,28),(43,28),(44,28),(45,28),(46,28),(47,28),(83,28),(84,28),(85,28),(89,28),(133,28),(134,28),(0,29),(3,29),(36,29),(37,29),(38,29),(43,29),(44,29),(45,29),(46,29),(83,29),(84,29),(85,29),(133,29),(134,29),(3,30),(4,30),(6,30),(43,30),(44,30),(45,30),(47,30),(83,30),(86,30),(88,30),(89,30),(133,30),(134,30),(0,31),(1,31),(2,31),(4,31),(27,31),(28,31),(29,31),(30,31),(42,31),(43,31),(44,31),(45,31),(46,31),(83,31),(86,31),(88,31),(90,31),(105,31),(133,31),(134,31),(0,32),(1,32),(2,32),(3,32),(22,32),(23,32),(24,32),(31,32),(33,32),(42,32),(44,32),(45,32),(46,32),(83,32),(86,32),(89,32),(90,32),(93,32),(133,32),(134,32),(0,33),(2,33),(3,33),(22,33),(24,33),(25,33),(26,33),(31,33),(33,33),(34,33),(35,33),(36,33),(37,33),(40,33),(43,33),(44,33),(45,33),(46,33),(55,33),(84,33),(86,33),(88,33),(90,33),(133,33),(134,33),(0,34),(1,34),(2,34),(19,34),(28,34),(29,34),(30,34),(33,34),(34,34),(43,34),(44,34),(45,34),(46,34),(55,34),(86,34),(87,34),(89,34),(91,34),(134,34),(0,35),(1,35),(2,35),(3,35),(20,35),(22,35),(23,35),(26,35),(27,35),(28,35),(29,35),(30,35),(33,35),(34,35),(43,35),(44,35),(46,35),(47,35),(48,35),(49,35),(50,35),(51,35),(53,35),(54,35),(56,35),(86,35),(90,35),(133,35),(134,35),(0,36),(1,36),(2,36),(4,36),(5,36),(19,36),(20,36),(22,36),(23,36),(24,36),(26,36),(27,36),(28,36),(29,36),(34,36),(44,36),(45,36),(46,36),(47,36),(49,36),(50,36),(51,36),(52,36),(53,36),(54,36),(55,36),(56,36),(87,36),(88,36),(89,36),(107,36),(112,36),(113,36),(114,36),(115,36),(116,36),(117,36),(118,36),(119,36),(120,36),(121,36),(122,36),(123,36),(124,36),(125,36),(126,36),(133,36),(134,36),(0,37),(1,37),(19,37),(20,37),(22,37),(24,37),(26,37),(27,37),(28,37),(29,37),(30,37),(31,37),(32,37),(53,37),(89,37),(91,37),(111,37),(112,37),(113,37),(117,37),(118,37),(119,37),(120,37),(121,37),(122,37),(123,37),(124,37),(125,37),(126,37),(127,37),(128,37),(129,37),(130,37),(132,37),(133,37),(134,37),(0,38),(1,38),(2,38),(3,38),(4,38),(6,38),(18,38),(19,38),(20,38),(21,38),(22,38),(24,38),(26,38),(27,38),(28,38),(29,38),(30,38),(31,38),(32,38),(33,38),(35,38),(36,38),(37,38),(38,38),(39,38),(40,38),(41,38),(42,38),(43,38),(44,38),(45,38),(46,38),(47,38),(48,38),(49,38),(50,38),(51,38),(52,38),(53,38),(54,38),(55,38),(56,38),(57,38),(59,38),(111,38),(112,38),(113,38),(117,38),(118,38),(119,38),(120,38),(121,38),(122,38),(123,38),(124,38),(125,38),(126,38),(127,38),(128,38),(129,38),(132,38),(133,38),(134,38),(0,39),(1,39),(2,39),(3,39),(4,39),(5,39),(17,39),(18,39),(19,39),(20,39),(21,39),(22,39),(24,39),(26,39),(27,39),(28,39),(29,39),(30,39),(31,39),(32,39),(34,39),(35,39),(36,39),(58,39),(59,39),(112,39),(131,39),(132,39),(133,39),(134,39),(0,40),(1,40),(2,40),(3,40),(4,40),(5,40),(6,40),(7,40),(8,40),(9,40),(10,40),(11,40),(12,40),(13,40),(17,40),(18,40),(19,40),(20,40),(21,40),(22,40),(24,40),(26,40),(27,40),(28,40),(29,40),(30,40),(31,40),(32,40),(34,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(46,40),(47,40),(48,40),(49,40),(50,40),(51,40),(52,40),(53,40),(54,40),(55,40),(56,40),(57,40),(58,40),(59,40),(114,40),(115,40),(116,40),(117,40),(118,40),(119,40),(120,40),(121,40),(122,40),(123,40),(124,40),(125,40),(126,40),(127,40),(128,40),(129,40),(130,40),(131,40),(132,40),(133,40),(134,40)}
location.alwaysFront = {(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(0,1),(1,1),(2,1),(14,1),(15,1),(16,1),(17,1),(29,1),(30,1),(31,1),(32,1),(33,1),(0,2),(1,2),(2,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(28,2),(0,3),(1,3),(2,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(101,3),(102,3),(103,3),(0,4),(1,4),(2,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(29,4),(59,4),(60,4),(61,4),(62,4),(101,4),(102,4),(103,4),(0,5),(29,5),(58,5),(59,5),(60,5),(61,5),(62,5),(63,5),(101,5),(102,5),(103,5),(104,5),(106,5),(134,5),(0,6),(58,6),(59,6),(60,6),(61,6),(62,6),(63,6),(101,6),(102,6),(103,6),(134,6),(0,7),(58,7),(59,7),(60,7),(61,7),(62,7),(63,7),(134,7),(134,8),(132,12),(133,12),(134,12),(0,13),(1,13),(132,13),(133,13),(134,13),(0,14),(1,14),(7,14),(102,14),(103,14),(104,14),(132,14),(133,14),(134,14),(0,15),(1,15),(15,15),(16,15),(17,15),(132,15),(133,15),(134,15),(0,16),(1,16),(15,16),(16,16),(17,16),(18,16),(19,16),(20,16),(0,17),(1,17),(15,17),(16,17),(17,17),(18,17),(19,17),(20,17),(0,18),(1,18),(15,18),(16,18),(17,18),(18,18),(19,18),(20,18),(0,19),(1,19),(2,19),(18,19),(19,19),(20,19),(0,20),(1,20),(2,20),(0,21),(1,21),(2,21),(12,21),(131,21),(132,21),(133,21),(0,22),(1,22),(2,22),(131,22),(132,22),(133,22),(1,23),(2,23),(131,23),(132,23),(133,23),(0,24),(1,24),(2,24),(131,24),(132,24),(133,24),(134,24),(134,25),(134,26),(134,27),(0,28),(1,28),(2,28),(0,29),(1,29),(2,29),(0,30),(1,30),(2,30),(0,31),(1,31),(2,31),(0,32),(2,32),(116,34),(117,34),(118,34),(119,34),(130,34),(131,34),(9,35),(10,35),(11,35),(112,35),(113,35),(117,35),(118,35),(119,35),(123,35),(124,35),(125,35),(128,35),(129,35),(130,35),(9,36),(10,36),(11,36),(112,36),(113,36),(115,36),(117,36),(118,36),(119,36),(123,36),(124,36),(125,36),(126,36),(128,36),(129,36),(130,36),(131,36),(9,37),(10,37),(11,37),(37,37),(38,37),(39,37),(46,37),(47,37),(48,37),(90,37),(91,37),(92,37),(105,37),(106,37),(107,37),(113,37),(114,37),(115,37),(117,37),(118,37),(119,37),(121,37),(122,37),(123,37),(124,37),(125,37),(128,37),(129,37),(130,37),(2,38),(3,38),(4,38),(6,38),(7,38),(9,38),(10,38),(11,38),(18,38),(19,38),(20,38),(86,38),(87,38),(88,38),(90,38),(91,38),(92,38),(105,38),(106,38),(107,38),(110,38),(111,38),(112,38),(113,38),(114,38),(115,38),(116,38),(118,38),(119,38),(120,38),(121,38),(122,38),(123,38),(124,38),(125,38),(126,38),(127,38),(128,38),(129,38),(130,38),(131,38),(132,38),(133,38),(0,39),(1,39),(2,39),(3,39),(4,39),(5,39),(7,39),(8,39),(9,39),(10,39),(11,39),(12,39),(18,39),(19,39),(20,39),(54,39),(55,39),(56,39),(86,39),(87,39),(88,39),(90,39),(91,39),(92,39),(105,39),(106,39),(107,39),(110,39),(111,39),(112,39),(113,39),(114,39),(115,39),(118,39),(119,39),(120,39),(121,39),(122,39),(123,39),(124,39),(125,39),(126,39),(127,39),(129,39),(131,39),(132,39),(133,39),(0,40),(1,40),(2,40),(3,40),(4,40),(5,40),(7,40),(8,40),(9,40),(10,40),(11,40),(12,40),(18,40),(19,40),(20,40),(54,40),(55,40),(56,40),(86,40),(87,40),(88,40),(90,40),(91,40),(92,40),(105,40),(106,40),(107,40),(110,40),(111,40),(112,40),(113,40),(114,40),(115,40),(116,40),(117,40),(118,40),(119,40),(120,40),(121,40),(122,40),(123,40),(124,40),(125,40),(126,40),(127,40),(129,40),(131,40),(132,40),(133,40)}
location.front = {(1,0),(2,0),(3,0),(67,0),(68,0),(69,0),(71,0),(72,0),(73,0),(74,0),(75,0),(76,0),(77,0),(78,0),(79,0),(86,0),(87,0),(88,0),(89,0),(103,0),(104,0),(105,0),(106,0),(107,0),(108,0),(116,0),(128,0),(1,1),(2,1),(3,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(31,1),(32,1),(34,1),(67,1),(68,1),(69,1),(71,1),(72,1),(73,1),(74,1),(75,1),(76,1),(77,1),(78,1),(79,1),(87,1),(88,1),(89,1),(104,1),(106,1),(107,1),(108,1),(1,2),(2,2),(3,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(28,2),(29,2),(30,2),(31,2),(32,2),(67,2),(68,2),(69,2),(71,2),(72,2),(73,2),(74,2),(75,2),(76,2),(77,2),(78,2),(79,2),(84,2),(85,2),(86,2),(87,2),(88,2),(89,2),(106,2),(107,2),(108,2),(133,2),(134,2),(2,3),(3,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(28,3),(29,3),(30,3),(53,3),(54,3),(55,3),(67,3),(68,3),(69,3),(70,3),(71,3),(72,3),(73,3),(74,3),(75,3),(76,3),(77,3),(78,3),(79,3),(80,3),(84,3),(85,3),(86,3),(88,3),(106,3),(107,3),(108,3),(133,3),(134,3),(8,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(28,4),(29,4),(30,4),(58,4),(59,4),(60,4),(61,4),(62,4),(63,4),(67,4),(68,4),(69,4),(70,4),(71,4),(72,4),(73,4),(74,4),(75,4),(76,4),(77,4),(78,4),(79,4),(84,4),(85,4),(86,4),(107,4),(133,4),(134,4),(15,5),(16,5),(29,5),(58,5),(59,5),(60,5),(61,5),(62,5),(63,5),(73,5),(74,5),(75,5),(76,5),(77,5),(78,5),(79,5),(80,5),(81,5),(84,5),(85,5),(86,5),(123,5),(124,5),(125,5),(133,5),(134,5),(15,6),(16,6),(28,6),(29,6),(30,6),(58,6),(59,6),(60,6),(61,6),(62,6),(63,6),(85,6),(101,6),(102,6),(103,6),(123,6),(124,6),(125,6),(134,6),(58,7),(59,7),(60,7),(61,7),(62,7),(63,7),(70,7),(71,7),(72,7),(80,7),(81,7),(82,7),(83,7),(101,7),(102,7),(123,7),(124,7),(125,7),(31,8),(60,8),(61,8),(101,8),(131,8),(132,8),(133,8),(28,9),(117,9),(118,9),(120,9),(121,9),(123,9),(127,9),(129,9),(130,9),(131,9),(132,9),(133,9),(110,10),(122,10),(124,10),(128,10),(131,10),(132,10),(133,10),(105,11),(131,11),(132,11),(133,11),(102,12),(105,12),(129,12),(130,12),(132,12),(103,13),(105,13),(107,13),(109,13),(110,13),(0,14),(1,14),(2,14),(104,14),(105,14),(0,15),(1,15),(6,15),(7,15),(8,15),(9,15),(10,15),(11,15),(12,15),(102,15),(103,15),(105,15),(107,15),(0,16),(6,16),(7,16),(8,16),(9,16),(10,16),(11,16),(12,16),(105,16),(133,16),(1,17),(6,17),(7,17),(8,17),(9,17),(10,17),(11,17),(12,17),(13,17),(14,17),(105,17),(6,18),(7,18),(8,18),(9,18),(10,18),(11,18),(12,18),(13,18),(14,18),(31,18),(133,18),(134,18),(0,19),(6,19),(9,19),(10,19),(11,19),(12,19),(13,19),(14,19),(15,19),(16,19),(19,19),(133,19),(134,19),(0,20),(9,20),(10,20),(11,20),(12,20),(13,20),(14,20),(15,20),(16,20),(17,20),(18,20),(19,20),(20,20),(129,20),(130,20),(133,20),(134,20),(9,21),(10,21),(11,21),(12,21),(13,21),(14,21),(15,21),(16,21),(17,21),(18,21),(19,21),(20,21),(43,21),(44,21),(45,21),(46,21),(133,21),(134,21),(7,22),(9,22),(10,22),(11,22),(12,22),(13,22),(14,22),(16,22),(17,22),(18,22),(19,22),(20,22),(134,22),(16,23),(17,23),(18,23),(19,23),(20,23),(8,24),(16,24),(89,24),(90,24),(91,24),(92,24),(93,24),(94,24),(97,24),(98,24),(99,24),(100,24),(101,24),(102,24),(103,24),(104,24),(105,24),(0,25),(1,25),(16,25),(129,25),(130,25),(132,25),(0,26),(1,26),(134,26),(89,27),(90,27),(91,27),(92,27),(93,27),(94,27),(97,27),(98,27),(99,27),(100,27),(101,27),(102,27),(103,27),(104,27),(105,27),(132,28),(133,28),(134,28),(1,29),(2,29),(132,29),(133,29),(134,29),(132,30),(133,30),(134,30),(93,31),(132,31),(133,31),(134,31),(1,32),(94,32),(133,32),(129,34),(130,34),(131,34),(132,34),(133,34),(134,34),(9,35),(10,35),(11,35),(111,35),(112,35),(113,35),(114,35),(115,35),(116,35),(117,35),(118,35),(119,35),(120,35),(121,35),(122,35),(123,35),(124,35),(125,35),(126,35),(127,35),(128,35),(129,35),(130,35),(131,35),(132,35),(133,35),(134,35),(9,36),(10,36),(11,36),(111,36),(112,36),(113,36),(114,36),(115,36),(116,36),(117,36),(118,36),(119,36),(120,36),(121,36),(122,36),(123,36),(124,36),(125,36),(126,36),(127,36),(128,36),(129,36),(130,36),(132,36),(133,36),(134,36),(3,37),(4,37),(5,37),(6,37),(7,37),(8,37),(9,37),(10,37),(11,37),(12,37),(13,37),(20,37),(21,37),(30,37),(31,37),(34,37),(35,37),(36,37),(37,37),(38,37),(39,37),(40,37),(41,37),(42,37),(43,37),(44,37),(45,37),(46,37),(47,37),(48,37),(49,37),(50,37),(51,37),(52,37),(53,37),(54,37),(55,37),(56,37),(57,37),(58,37),(59,37),(60,37),(111,37),(112,37),(113,37),(114,37),(115,37),(116,37),(117,37),(118,37),(119,37),(120,37),(121,37),(122,37),(123,37),(124,37),(125,37),(126,37),(127,37),(128,37),(129,37),(130,37),(132,37),(133,37),(134,37),(0,38),(1,38),(2,38),(3,38),(4,38),(5,38),(9,38),(10,38),(11,38),(21,38),(26,38),(29,38),(37,38),(38,38),(39,38),(46,38),(47,38),(48,38),(58,38),(59,38),(60,38),(112,38),(113,38),(114,38),(115,38),(116,38),(117,38),(118,38),(119,38),(120,38),(121,38),(122,38),(123,38),(124,38),(125,38),(126,38),(127,38),(128,38),(129,38),(133,38),(0,39),(1,39),(2,39),(3,39),(4,39),(5,39),(6,39),(7,39),(10,39),(11,39),(12,39),(21,39),(22,39),(58,39),(59,39),(60,39),(112,39),(113,39),(114,39),(115,39),(116,39),(117,39),(118,39),(119,39),(120,39),(121,39),(122,39),(123,39),(124,39),(125,39),(126,39),(127,39),(128,39),(129,39),(0,40),(1,40),(2,40),(3,40),(4,40),(5,40),(6,40),(7,40),(10,40),(21,40),(58,40),(59,40),(60,40),(112,40),(113,40),(114,40),(115,40),(119,40),(125,40),(128,40),(129,40),(131,40)}
location.buildings = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(26,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(41,0),(42,0),(43,0),(44,0),(45,0),(46,0),(47,0),(48,0),(49,0),(50,0),(51,0),(52,0),(53,0),(54,0),(55,0),(56,0),(57,0),(58,0),(59,0),(60,0),(61,0),(62,0),(63,0),(64,0),(65,0),(66,0),(67,0),(69,0),(70,0),(71,0),(72,0),(73,0),(74,0),(75,0),(76,0),(77,0),(78,0),(79,0),(80,0),(81,0),(82,0),(83,0),(84,0),(85,0),(90,0),(91,0),(92,0),(93,0),(94,0),(95,0),(96,0),(97,0),(98,0),(99,0),(102,0),(103,0),(104,0),(105,0),(106,0),(107,0),(108,0),(109,0),(110,0),(111,0),(112,0),(113,0),(114,0),(115,0),(117,0),(118,0),(119,0),(120,0),(121,0),(122,0),(123,0),(124,0),(125,0),(126,0),(127,0),(129,0),(130,0),(131,0),(132,0),(133,0),(134,0),(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(36,1),(37,1),(38,1),(39,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(50,1),(51,1),(52,1),(53,1),(54,1),(55,1),(56,1),(57,1),(58,1),(59,1),(60,1),(61,1),(62,1),(63,1),(64,1),(65,1),(66,1),(67,1),(69,1),(70,1),(71,1),(72,1),(73,1),(74,1),(75,1),(76,1),(77,1),(78,1),(79,1),(80,1),(81,1),(82,1),(83,1),(84,1),(85,1),(86,1),(90,1),(91,1),(92,1),(93,1),(94,1),(95,1),(96,1),(97,1),(98,1),(99,1),(103,1),(104,1),(105,1),(106,1),(107,1),(108,1),(109,1),(110,1),(111,1),(112,1),(113,1),(114,1),(115,1),(116,1),(117,1),(118,1),(119,1),(120,1),(121,1),(122,1),(123,1),(124,1),(125,1),(126,1),(127,1),(128,1),(129,1),(130,1),(131,1),(132,1),(133,1),(134,1),(0,2),(1,2),(2,2),(3,2),(4,2),(5,2),(6,2),(7,2),(8,2),(11,2),(12,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(40,2),(41,2),(42,2),(43,2),(44,2),(45,2),(46,2),(47,2),(48,2),(49,2),(50,2),(51,2),(52,2),(53,2),(54,2),(55,2),(56,2),(57,2),(58,2),(59,2),(60,2),(61,2),(62,2),(63,2),(64,2),(65,2),(66,2),(67,2),(68,2),(69,2),(70,2),(71,2),(72,2),(73,2),(74,2),(75,2),(76,2),(77,2),(78,2),(79,2),(80,2),(81,2),(82,2),(83,2),(84,2),(85,2),(86,2),(87,2),(90,2),(91,2),(92,2),(93,2),(94,2),(95,2),(96,2),(97,2),(98,2),(99,2),(103,2),(104,2),(105,2),(106,2),(107,2),(108,2),(109,2),(110,2),(111,2),(112,2),(113,2),(114,2),(115,2),(116,2),(117,2),(118,2),(119,2),(120,2),(121,2),(122,2),(123,2),(124,2),(125,2),(126,2),(127,2),(128,2),(129,2),(130,2),(131,2),(132,2),(133,2),(134,2),(0,3),(1,3),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(8,3),(11,3),(12,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(40,3),(41,3),(42,3),(43,3),(44,3),(45,3),(46,3),(47,3),(48,3),(49,3),(50,3),(51,3),(52,3),(53,3),(55,3),(56,3),(57,3),(58,3),(59,3),(60,3),(61,3),(62,3),(63,3),(64,3),(65,3),(66,3),(67,3),(69,3),(70,3),(71,3),(72,3),(73,3),(74,3),(75,3),(76,3),(77,3),(78,3),(79,3),(80,3),(81,3),(82,3),(83,3),(84,3),(86,3),(87,3),(89,3),(90,3),(91,3),(92,3),(93,3),(94,3),(95,3),(96,3),(97,3),(98,3),(99,3),(103,3),(104,3),(105,3),(106,3),(107,3),(108,3),(109,3),(110,3),(111,3),(112,3),(113,3),(114,3),(115,3),(116,3),(117,3),(118,3),(119,3),(120,3),(121,3),(122,3),(123,3),(124,3),(125,3),(126,3),(127,3),(128,3),(129,3),(130,3),(131,3),(132,3),(133,3),(134,3),(2,4),(3,4),(4,4),(5,4),(6,4),(7,4),(8,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(47,4),(48,4),(49,4),(50,4),(51,4),(52,4),(53,4),(55,4),(56,4),(57,4),(58,4),(59,4),(60,4),(61,4),(62,4),(63,4),(64,4),(65,4),(66,4),(67,4),(69,4),(70,4),(71,4),(80,4),(81,4),(82,4),(83,4),(84,4),(86,4),(87,4),(88,4),(89,4),(90,4),(91,4),(92,4),(93,4),(94,4),(95,4),(96,4),(97,4),(99,4),(103,4),(104,4),(105,4),(106,4),(108,4),(109,4),(110,4),(111,4),(112,4),(113,4),(114,4),(115,4),(116,4),(117,4),(118,4),(119,4),(120,4),(121,4),(122,4),(123,4),(124,4),(125,4),(126,4),(127,4),(128,4),(129,4),(130,4),(131,4),(132,4),(0,5),(1,5),(2,5),(3,5),(8,5),(27,5),(28,5),(29,5),(30,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(49,5),(50,5),(51,5),(52,5),(53,5),(55,5),(56,5),(57,5),(58,5),(59,5),(60,5),(61,5),(62,5),(63,5),(64,5),(65,5),(66,5),(67,5),(68,5),(69,5),(70,5),(71,5),(72,5),(80,5),(81,5),(82,5),(83,5),(84,5),(86,5),(87,5),(88,5),(89,5),(90,5),(91,5),(92,5),(93,5),(94,5),(95,5),(98,5),(102,5),(103,5),(104,5),(105,5),(106,5),(107,5),(108,5),(109,5),(110,5),(111,5),(112,5),(113,5),(114,5),(115,5),(116,5),(117,5),(118,5),(119,5),(120,5),(121,5),(122,5),(123,5),(124,5),(125,5),(126,5),(127,5),(128,5),(129,5),(130,5),(131,5),(132,5),(1,6),(2,6),(3,6),(4,6),(28,6),(30,6),(36,6),(37,6),(38,6),(39,6),(40,6),(46,6),(49,6),(62,6),(63,6),(64,6),(65,6),(66,6),(67,6),(68,6),(69,6),(70,6),(71,6),(72,6),(73,6),(74,6),(75,6),(76,6),(77,6),(78,6),(79,6),(80,6),(81,6),(82,6),(83,6),(84,6),(86,6),(87,6),(88,6),(89,6),(90,6),(91,6),(92,6),(93,6),(96,6),(102,6),(103,6),(104,6),(105,6),(106,6),(107,6),(108,6),(109,6),(110,6),(111,6),(112,6),(113,6),(114,6),(115,6),(116,6),(117,6),(118,6),(119,6),(120,6),(121,6),(122,6),(123,6),(124,6),(125,6),(126,6),(127,6),(128,6),(129,6),(130,6),(131,6),(132,6),(133,6),(1,7),(2,7),(3,7),(15,7),(16,7),(28,7),(30,7),(36,7),(37,7),(38,7),(39,7),(40,7),(46,7),(47,7),(48,7),(49,7),(64,7),(65,7),(66,7),(67,7),(68,7),(69,7),(70,7),(72,7),(73,7),(74,7),(75,7),(76,7),(77,7),(78,7),(79,7),(80,7),(81,7),(84,7),(85,7),(86,7),(87,7),(88,7),(89,7),(90,7),(91,7),(92,7),(95,7),(96,7),(97,7),(100,7),(101,7),(104,7),(105,7),(106,7),(107,7),(108,7),(109,7),(110,7),(111,7),(112,7),(113,7),(114,7),(115,7),(116,7),(117,7),(118,7),(119,7),(120,7),(121,7),(122,7),(123,7),(124,7),(125,7),(126,7),(127,7),(128,7),(129,7),(130,7),(131,7),(132,7),(133,7),(134,7),(0,8),(1,8),(2,8),(3,8),(36,8),(37,8),(38,8),(39,8),(40,8),(46,8),(49,8),(66,8),(67,8),(68,8),(69,8),(70,8),(71,8),(72,8),(73,8),(74,8),(75,8),(76,8),(77,8),(78,8),(79,8),(80,8),(81,8),(82,8),(83,8),(84,8),(85,8),(86,8),(87,8),(88,8),(89,8),(90,8),(91,8),(92,8),(93,8),(96,8),(100,8),(102,8),(104,8),(105,8),(106,8),(107,8),(108,8),(109,8),(110,8),(111,8),(112,8),(113,8),(114,8),(115,8),(116,8),(117,8),(118,8),(119,8),(120,8),(121,8),(122,8),(123,8),(124,8),(125,8),(126,8),(127,8),(128,8),(129,8),(130,8),(131,8),(133,8),(0,9),(1,9),(2,9),(3,9),(29,9),(31,9),(36,9),(37,9),(38,9),(39,9),(40,9),(45,9),(46,9),(49,9),(51,9),(52,9),(53,9),(54,9),(55,9),(56,9),(57,9),(60,9),(61,9),(73,9),(74,9),(78,9),(79,9),(83,9),(84,9),(85,9),(86,9),(87,9),(88,9),(89,9),(90,9),(91,9),(92,9),(94,9),(101,9),(102,9),(103,9),(104,9),(105,9),(106,9),(107,9),(108,9),(109,9),(110,9),(111,9),(112,9),(113,9),(114,9),(115,9),(116,9),(117,9),(118,9),(119,9),(120,9),(121,9),(122,9),(123,9),(124,9),(125,9),(126,9),(127,9),(128,9),(129,9),(130,9),(131,9),(134,9),(0,10),(1,10),(2,10),(3,10),(28,10),(36,10),(44,10),(45,10),(48,10),(49,10),(50,10),(51,10),(52,10),(53,10),(54,10),(55,10),(56,10),(57,10),(60,10),(61,10),(84,10),(85,10),(86,10),(87,10),(88,10),(89,10),(90,10),(91,10),(92,10),(97,10),(100,10),(101,10),(102,10),(103,10),(104,10),(105,10),(106,10),(107,10),(108,10),(110,10),(111,10),(112,10),(113,10),(115,10),(116,10),(117,10),(118,10),(119,10),(120,10),(121,10),(122,10),(123,10),(124,10),(125,10),(126,10),(127,10),(128,10),(129,10),(130,10),(131,10),(134,10),(0,11),(1,11),(2,11),(3,11),(24,11),(36,11),(43,11),(44,11),(50,11),(55,11),(57,11),(58,11),(84,11),(85,11),(86,11),(87,11),(88,11),(89,11),(90,11),(91,11),(92,11),(93,11),(96,11),(97,11),(100,11),(101,11),(102,11),(103,11),(104,11),(105,11),(106,11),(107,11),(108,11),(110,11),(111,11),(114,11),(118,11),(122,11),(124,11),(125,11),(126,11),(128,11),(129,11),(130,11),(131,11),(134,11),(24,12),(36,12),(43,12),(44,12),(57,12),(58,12),(59,12),(84,12),(85,12),(86,12),(87,12),(88,12),(89,12),(90,12),(93,12),(97,12),(100,12),(101,12),(102,12),(103,12),(104,12),(105,12),(106,12),(107,12),(108,12),(128,12),(131,12),(134,12),(24,13),(36,13),(43,13),(57,13),(58,13),(59,13),(60,13),(61,13),(62,13),(90,13),(97,13),(100,13),(101,13),(102,13),(104,13),(105,13),(106,13),(107,13),(108,13),(109,13),(129,13),(130,13),(131,13),(132,13),(6,14),(24,14),(36,14),(43,14),(57,14),(58,14),(59,14),(60,14),(61,14),(62,14),(90,14),(94,14),(100,14),(101,14),(102,14),(104,14),(105,14),(106,14),(107,14),(108,14),(109,14),(110,14),(130,14),(131,14),(0,15),(1,15),(2,15),(6,15),(24,15),(25,15),(26,15),(29,15),(30,15),(31,15),(32,15),(33,15),(36,15),(43,15),(52,15),(53,15),(54,15),(55,15),(56,15),(57,15),(58,15),(59,15),(60,15),(62,15),(63,15),(64,15),(65,15),(66,15),(67,15),(68,15),(69,15),(70,15),(71,15),(72,15),(73,15),(74,15),(75,15),(76,15),(77,15),(90,15),(91,15),(99,15),(100,15),(101,15),(102,15),(104,15),(105,15),(106,15),(107,15),(108,15),(109,15),(131,15),(0,16),(1,16),(2,16),(6,16),(7,16),(8,16),(9,16),(10,16),(11,16),(12,16),(13,16),(14,16),(15,16),(16,16),(17,16),(18,16),(19,16),(20,16),(21,16),(24,16),(25,16),(26,16),(27,16),(28,16),(29,16),(30,16),(31,16),(32,16),(33,16),(34,16),(35,16),(36,16),(43,16),(44,16),(52,16),(53,16),(54,16),(55,16),(56,16),(57,16),(58,16),(59,16),(60,16),(61,16),(62,16),(63,16),(64,16),(65,16),(66,16),(67,16),(68,16),(69,16),(70,16),(71,16),(72,16),(73,16),(74,16),(75,16),(76,16),(77,16),(90,16),(91,16),(94,16),(100,16),(101,16),(102,16),(104,16),(105,16),(106,16),(107,16),(108,16),(131,16),(132,16),(134,16),(0,17),(1,17),(2,17),(6,17),(7,17),(8,17),(9,17),(10,17),(11,17),(12,17),(13,17),(14,17),(15,17),(16,17),(17,17),(18,17),(19,17),(20,17),(21,17),(24,17),(25,17),(26,17),(27,17),(28,17),(29,17),(30,17),(31,17),(32,17),(33,17),(34,17),(35,17),(36,17),(44,17),(45,17),(52,17),(53,17),(54,17),(59,17),(60,17),(61,17),(63,17),(65,17),(67,17),(68,17),(69,17),(76,17),(77,17),(90,17),(94,17),(97,17),(100,17),(101,17),(102,17),(104,17),(105,17),(106,17),(107,17),(108,17),(131,17),(132,17),(133,17),(134,17),(0,18),(1,18),(2,18),(6,18),(7,18),(8,18),(9,18),(10,18),(11,18),(12,18),(13,18),(14,18),(15,18),(16,18),(17,18),(18,18),(19,18),(20,18),(21,18),(24,18),(25,18),(26,18),(27,18),(28,18),(29,18),(30,18),(31,18),(32,18),(33,18),(34,18),(35,18),(36,18),(45,18),(46,18),(47,18),(52,18),(53,18),(54,18),(59,18),(60,18),(62,18),(63,18),(64,18),(65,18),(66,18),(69,18),(77,18),(78,18),(89,18),(90,18),(100,18),(106,18),(107,18),(108,18),(129,18),(131,18),(132,18),(133,18),(0,19),(1,19),(2,19),(6,19),(7,19),(8,19),(9,19),(10,19),(11,19),(12,19),(13,19),(14,19),(15,19),(16,19),(17,19),(18,19),(19,19),(20,19),(21,19),(26,19),(27,19),(28,19),(29,19),(31,19),(33,19),(34,19),(35,19),(36,19),(46,19),(52,19),(53,19),(54,19),(55,19),(61,19),(62,19),(63,19),(64,19),(65,19),(70,19),(77,19),(78,19),(79,19),(89,19),(90,19),(91,19),(100,19),(106,19),(107,19),(108,19),(130,19),(131,19),(132,19),(0,20),(1,20),(2,20),(6,20),(7,20),(8,20),(15,20),(16,20),(19,20),(21,20),(47,20),(52,20),(53,20),(54,20),(55,20),(61,20),(63,20),(65,20),(70,20),(77,20),(79,20),(80,20),(89,20),(90,20),(100,20),(101,20),(102,20),(103,20),(130,20),(131,20),(132,20),(0,21),(1,21),(2,21),(6,21),(9,21),(15,21),(16,21),(17,21),(18,21),(19,21),(20,21),(21,21),(48,21),(49,21),(50,21),(51,21),(55,21),(61,21),(62,21),(63,21),(64,21),(65,21),(69,21),(70,21),(71,21),(77,21),(78,21),(80,21),(89,21),(90,21),(92,21),(93,21),(100,21),(101,21),(102,21),(103,21),(104,21),(129,21),(130,21),(131,21),(0,22),(1,22),(2,22),(6,22),(9,22),(15,22),(16,22),(17,22),(18,22),(19,22),(20,22),(21,22),(43,22),(44,22),(45,22),(46,22),(48,22),(49,22),(50,22),(51,22),(55,22),(56,22),(61,22),(62,22),(63,22),(64,22),(65,22),(69,22),(70,22),(77,22),(79,22),(80,22),(89,22),(92,22),(97,22),(100,22),(101,22),(102,22),(103,22),(104,22),(131,22),(0,23),(1,23),(2,23),(6,23),(7,23),(9,23),(10,23),(11,23),(12,23),(13,23),(14,23),(15,23),(16,23),(17,23),(18,23),(19,23),(20,23),(21,23),(48,23),(49,23),(50,23),(51,23),(55,23),(56,23),(60,23),(61,23),(62,23),(63,23),(64,23),(65,23),(66,23),(67,23),(69,23),(70,23),(78,23),(80,23),(90,23),(91,23),(96,23),(100,23),(101,23),(102,23),(103,23),(104,23),(130,23),(131,23),(134,23),(0,24),(1,24),(2,24),(6,24),(9,24),(10,24),(11,24),(12,24),(13,24),(14,24),(15,24),(16,24),(17,24),(18,24),(19,24),(20,24),(21,24),(22,24),(23,24),(49,24),(51,24),(55,24),(56,24),(59,24),(60,24),(61,24),(62,24),(63,24),(64,24),(65,24),(66,24),(67,24),(69,24),(77,24),(78,24),(79,24),(80,24),(90,24),(104,24),(130,24),(131,24),(134,24),(0,25),(1,25),(2,25),(6,25),(8,25),(9,25),(10,25),(11,25),(12,25),(13,25),(14,25),(15,25),(16,25),(17,25),(18,25),(19,25),(20,25),(21,25),(22,25),(23,25),(24,25),(25,25),(26,25),(27,25),(28,25),(29,25),(30,25),(31,25),(32,25),(33,25),(34,25),(35,25),(49,25),(50,25),(51,25),(55,25),(56,25),(59,25),(60,25),(62,25),(63,25),(64,25),(65,25),(67,25),(68,25),(69,25),(77,25),(78,25),(79,25),(80,25),(89,25),(90,25),(91,25),(92,25),(93,25),(94,25),(97,25),(98,25),(99,25),(100,25),(101,25),(102,25),(103,25),(104,25),(105,25),(131,25),(133,25),(0,26),(1,26),(2,26),(16,26),(21,26),(22,26),(23,26),(24,26),(25,26),(26,26),(27,26),(28,26),(29,26),(30,26),(31,26),(32,26),(33,26),(34,26),(35,26),(36,26),(49,26),(50,26),(51,26),(55,26),(56,26),(57,26),(58,26),(59,26),(60,26),(61,26),(62,26),(63,26),(64,26),(66,26),(67,26),(68,26),(69,26),(77,26),(78,26),(80,26),(94,26),(97,26),(129,26),(130,26),(131,26),(132,26),(133,26),(0,27),(1,27),(2,27),(21,27),(22,27),(23,27),(24,27),(25,27),(26,27),(27,27),(28,27),(29,27),(30,27),(31,27),(32,27),(33,27),(34,27),(35,27),(36,27),(37,27),(49,27),(50,27),(51,27),(55,27),(56,27),(57,27),(58,27),(59,27),(60,27),(61,27),(62,27),(63,27),(64,27),(65,27),(66,27),(67,27),(68,27),(69,27),(70,27),(77,27),(79,27),(80,27),(94,27),(97,27),(130,27),(131,27),(132,27),(133,27),(0,28),(1,28),(2,28),(23,28),(24,28),(25,28),(26,28),(27,28),(28,28),(29,28),(30,28),(31,28),(32,28),(33,28),(34,28),(35,28),(36,28),(37,28),(38,28),(49,28),(50,28),(51,28),(55,28),(57,28),(58,28),(59,28),(60,28),(61,28),(62,28),(63,28),(64,28),(65,28),(66,28),(67,28),(68,28),(69,28),(70,28),(79,28),(89,28),(90,28),(91,28),(92,28),(93,28),(94,28),(97,28),(98,28),(99,28),(100,28),(101,28),(102,28),(103,28),(104,28),(105,28),(131,28),(132,28),(134,28),(0,29),(1,29),(2,29),(50,29),(51,29),(55,29),(56,29),(57,29),(77,29),(78,29),(82,29),(91,29),(92,29),(98,29),(103,29),(104,29),(130,29),(131,29),(0,30),(1,30),(2,30),(50,30),(51,30),(55,30),(56,30),(57,30),(77,30),(78,30),(82,30),(92,30),(98,30),(99,30),(102,30),(104,30),(129,30),(131,30),(0,31),(1,31),(2,31),(50,31),(54,31),(58,31),(59,31),(60,31),(61,31),(62,31),(63,31),(64,31),(65,31),(66,31),(67,31),(68,31),(69,31),(70,31),(77,31),(78,31),(82,31),(93,31),(94,31),(95,31),(98,31),(99,31),(100,31),(101,31),(102,31),(103,31),(104,31),(131,31),(0,32),(1,32),(2,32),(50,32),(53,32),(58,32),(59,32),(60,32),(61,32),(62,32),(63,32),(64,32),(65,32),(66,32),(67,32),(68,32),(69,32),(77,32),(78,32),(79,32),(82,32),(93,32),(94,32),(95,32),(98,32),(99,32),(100,32),(101,32),(102,32),(103,32),(104,32),(131,32),(132,32),(134,32),(0,33),(1,33),(2,33),(50,33),(51,33),(52,33),(53,33),(58,33),(60,33),(61,33),(62,33),(63,33),(64,33),(65,33),(66,33),(67,33),(68,33),(69,33),(70,33),(77,33),(78,33),(79,33),(82,33),(83,33),(84,33),(85,33),(86,33),(94,33),(95,33),(98,33),(99,33),(100,33),(101,33),(102,33),(103,33),(104,33),(130,33),(131,33),(132,33),(133,33),(134,33),(0,34),(1,34),(2,34),(58,34),(59,34),(60,34),(61,34),(62,34),(63,34),(64,34),(65,34),(66,34),(67,34),(68,34),(69,34),(70,34),(79,34),(82,34),(83,34),(84,34),(85,34),(86,34),(94,34),(97,34),(104,34),(129,34),(131,34),(132,34),(133,34),(134,34),(0,35),(1,35),(2,35),(22,35),(23,35),(24,35),(25,35),(26,35),(59,35),(60,35),(61,35),(62,35),(63,35),(64,35),(65,35),(66,35),(67,35),(68,35),(69,35),(70,35),(77,35),(79,35),(80,35),(82,35),(83,35),(84,35),(85,35),(86,35),(94,35),(96,35),(99,35),(104,35),(129,35),(130,35),(131,35),(132,35),(133,35),(134,35),(0,36),(1,36),(2,36),(20,36),(21,36),(22,36),(23,36),(24,36),(25,36),(26,36),(27,36),(28,36),(59,36),(60,36),(61,36),(62,36),(63,36),(64,36),(65,36),(66,36),(67,36),(68,36),(69,36),(70,36),(77,36),(78,36),(79,36),(80,36),(82,36),(83,36),(84,36),(85,36),(86,36),(92,36),(93,36),(94,36),(95,36),(102,36),(104,36),(105,36),(106,36),(131,36),(0,37),(1,37),(2,37),(19,37),(20,37),(21,37),(22,37),(23,37),(24,37),(25,37),(26,37),(27,37),(28,37),(29,37),(30,37),(31,37),(32,37),(61,37),(63,37),(65,37),(66,37),(67,37),(68,37),(70,37),(77,37),(78,37),(79,37),(80,37),(81,37),(82,37),(83,37),(84,37),(85,37),(86,37),(90,37),(91,37),(92,37),(93,37),(94,37),(104,37),(105,37),(106,37),(107,37),(108,37),(111,37),(112,37),(113,37),(114,37),(115,37),(116,37),(117,37),(118,37),(119,37),(120,37),(121,37),(122,37),(123,37),(124,37),(125,37),(126,37),(127,37),(128,37),(129,37),(130,37),(131,37),(0,38),(1,38),(2,38),(3,38),(4,38),(5,38),(6,38),(7,38),(8,38),(9,38),(10,38),(11,38),(12,38),(13,38),(18,38),(19,38),(20,38),(21,38),(22,38),(23,38),(24,38),(25,38),(26,38),(27,38),(28,38),(29,38),(30,38),(31,38),(32,38),(33,38),(34,38),(35,38),(36,38),(37,38),(38,38),(39,38),(40,38),(41,38),(42,38),(43,38),(44,38),(45,38),(46,38),(47,38),(48,38),(49,38),(50,38),(51,38),(52,38),(53,38),(54,38),(55,38),(56,38),(57,38),(58,38),(59,38),(60,38),(61,38),(62,38),(63,38),(64,38),(65,38),(66,38),(67,38),(68,38),(69,38),(70,38),(77,38),(79,38),(80,38),(81,38),(82,38),(83,38),(84,38),(85,38),(86,38),(87,38),(88,38),(89,38),(90,38),(91,38),(92,38),(93,38),(94,38),(99,38),(104,38),(105,38),(106,38),(107,38),(108,38),(109,38),(110,38),(111,38),(112,38),(113,38),(114,38),(115,38),(116,38),(117,38),(118,38),(119,38),(120,38),(121,38),(122,38),(123,38),(124,38),(125,38),(126,38),(127,38),(128,38),(129,38),(130,38),(131,38),(132,38),(133,38),(134,38),(1,39),(2,39),(3,39),(4,39),(5,39),(6,39),(7,39),(8,39),(9,39),(10,39),(11,39),(12,39),(13,39),(17,39),(18,39),(19,39),(20,39),(21,39),(22,39),(23,39),(24,39),(25,39),(26,39),(27,39),(28,39),(29,39),(30,39),(31,39),(32,39),(33,39),(34,39),(35,39),(36,39),(37,39),(38,39),(39,39),(40,39),(41,39),(42,39),(43,39),(44,39),(45,39),(46,39),(47,39),(48,39),(49,39),(50,39),(51,39),(52,39),(53,39),(54,39),(55,39),(56,39),(57,39),(58,39),(61,39),(62,39),(63,39),(64,39),(65,39),(66,39),(67,39),(68,39),(70,39),(77,39),(78,39),(79,39),(80,39),(81,39),(82,39),(84,39),(85,39),(86,39),(87,39),(88,39),(89,39),(90,39),(91,39),(92,39),(93,39),(94,39),(100,39),(101,39),(104,39),(105,39),(106,39),(107,39),(108,39),(109,39),(110,39),(111,39),(112,39),(113,39),(114,39),(115,39),(116,39),(117,39),(118,39),(119,39),(120,39),(121,39),(122,39),(123,39),(124,39),(125,39),(126,39),(127,39),(128,39),(129,39),(130,39),(131,39),(132,39),(133,39),(134,39),(0,40),(1,40),(2,40),(3,40),(4,40),(5,40),(6,40),(7,40),(8,40),(9,40),(10,40),(11,40),(12,40),(13,40),(17,40),(18,40),(19,40),(20,40),(21,40),(22,40),(23,40),(24,40),(25,40),(26,40),(27,40),(28,40),(29,40),(30,40),(31,40),(32,40),(33,40),(34,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(46,40),(47,40),(48,40),(49,40),(50,40),(51,40),(52,40),(53,40),(54,40),(55,40),(56,40),(57,40),(58,40),(61,40),(62,40),(64,40),(65,40),(66,40),(67,40),(68,40),(69,40),(70,40),(77,40),(78,40),(80,40),(81,40),(82,40),(83,40),(84,40),(85,40),(86,40),(87,40),(88,40),(89,40),(90,40),(91,40),(92,40),(96,40),(106,40),(107,40),(108,40),(109,40),(110,40),(111,40),(112,40),(113,40),(114,40),(115,40),(116,40),(117,40),(118,40),(119,40),(120,40),(121,40),(122,40),(123,40),(124,40),(125,40),(126,40),(127,40),(128,40),(129,40),(130,40),(131,40),(132,40),(133,40),(134,40)}
if version == "1.3":
location.spawnable = {(0,0),(1,0),(3,0),(4,0),(5,0),(6,0),(7,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(26,0),(28,0),(29,0),(30,0),(32,0),(34,0),(35,0),(36,0),(37,0),(38,0),(64,0),(65,0),(66,0),(67,0),(68,0),(69,0),(70,0),(71,0),(72,0),(73,0),(74,0),(75,0),(76,0),(77,0),(78,0),(79,0),(80,0),(81,0),(82,0),(86,0),(88,0),(91,0),(96,0),(105,0),(106,0),(107,0),(109,0),(110,0),(111,0),(113,0),(114,0),(115,0),(116,0),(117,0),(119,0),(121,0),(122,0),(123,0),(124,0),(125,0),(127,0),(128,0),(129,0),(131,0),(132,0),(133,0),(0,1),(1,1),(3,1),(4,1),(5,1),(6,1),(7,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(28,1),(29,1),(30,1),(32,1),(34,1),(35,1),(36,1),(37,1),(43,1),(47,1),(53,1),(56,1),(57,1),(58,1),(59,1),(63,1),(85,1),(86,1),(87,1),(91,1),(92,1),(93,1),(94,1),(107,1),(112,1),(122,1),(130,1),(132,1),(134,1),(0,2),(1,2),(3,2),(4,2),(5,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(28,2),(29,2),(30,2),(31,2),(32,2),(34,2),(35,2),(36,2),(37,2),(38,2),(41,2),(42,2),(43,2),(44,2),(45,2),(46,2),(47,2),(48,2),(49,2),(50,2),(51,2),(52,2),(53,2),(54,2),(55,2),(56,2),(57,2),(58,2),(59,2),(60,2),(61,2),(62,2),(64,2),(67,2),(74,2),(81,2),(85,2),(87,2),(89,2),(90,2),(91,2),(92,2),(105,2),(111,2),(112,2),(113,2),(114,2),(115,2),(116,2),(117,2),(118,2),(119,2),(120,2),(121,2),(122,2),(123,2),(124,2),(125,2),(126,2),(127,2),(128,2),(129,2),(131,2),(132,2),(133,2),(134,2),(0,3),(3,3),(4,3),(5,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(41,3),(42,3),(43,3),(44,3),(45,3),(46,3),(49,3),(50,3),(51,3),(52,3),(53,3),(55,3),(56,3),(57,3),(58,3),(59,3),(60,3),(61,3),(62,3),(63,3),(64,3),(66,3),(69,3),(70,3),(71,3),(72,3),(73,3),(74,3),(75,3),(76,3),(77,3),(78,3),(79,3),(80,3),(81,3),(83,3),(84,3),(89,3),(90,3),(91,3),(105,3),(109,3),(110,3),(111,3),(112,3),(113,3),(114,3),(115,3),(116,3),(117,3),(118,3),(119,3),(120,3),(121,3),(122,3),(123,3),(124,3),(125,3),(126,3),(127,3),(128,3),(129,3),(130,3),(132,3),(133,3),(134,3),(0,4),(3,4),(4,4),(5,4),(6,4),(11,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(34,4),(35,4),(36,4),(37,4),(38,4),(41,4),(42,4),(43,4),(45,4),(49,4),(50,4),(51,4),(52,4),(53,4),(55,4),(56,4),(57,4),(58,4),(59,4),(60,4),(61,4),(62,4),(63,4),(64,4),(65,4),(66,4),(67,4),(68,4),(69,4),(70,4),(71,4),(72,4),(73,4),(74,4),(75,4),(76,4),(77,4),(78,4),(79,4),(80,4),(81,4),(82,4),(83,4),(84,4),(85,4),(86,4),(87,4),(88,4),(91,4),(106,4),(109,4),(110,4),(111,4),(112,4),(113,4),(114,4),(115,4),(116,4),(117,4),(118,4),(119,4),(120,4),(121,4),(122,4),(123,4),(124,4),(125,4),(126,4),(127,4),(128,4),(129,4),(130,4),(133,4),(134,4),(0,5),(3,5),(59,5),(60,5),(61,5),(62,5),(63,5),(64,5),(65,5),(66,5),(67,5),(68,5),(69,5),(70,5),(71,5),(72,5),(73,5),(82,5),(83,5),(84,5),(85,5),(91,5),(103,5),(105,5),(109,5),(110,5),(111,5),(112,5),(113,5),(114,5),(115,5),(116,5),(117,5),(118,5),(119,5),(120,5),(121,5),(122,5),(123,5),(124,5),(125,5),(126,5),(127,5),(128,5),(129,5),(130,5),(133,5),(134,5),(15,6),(16,6),(23,6),(27,6),(28,6),(30,6),(33,6),(35,6),(36,6),(37,6),(62,6),(63,6),(64,6),(65,6),(66,6),(67,6),(68,6),(69,6),(70,6),(71,6),(72,6),(73,6),(74,6),(75,6),(76,6),(77,6),(78,6),(79,6),(83,6),(91,6),(103,6),(107,6),(109,6),(110,6),(111,6),(112,6),(113,6),(114,6),(115,6),(116,6),(117,6),(118,6),(119,6),(120,6),(121,6),(122,6),(123,6),(124,6),(125,6),(126,6),(127,6),(128,6),(129,6),(130,6),(133,6),(134,6),(5,7),(6,7),(15,7),(16,7),(22,7),(23,7),(35,7),(36,7),(37,7),(39,7),(64,7),(65,7),(66,7),(67,7),(68,7),(69,7),(74,7),(75,7),(76,7),(77,7),(78,7),(79,7),(80,7),(81,7),(83,7),(89,7),(103,7),(104,7),(109,7),(110,7),(111,7),(112,7),(113,7),(114,7),(115,7),(116,7),(117,7),(118,7),(119,7),(120,7),(121,7),(122,7),(123,7),(124,7),(125,7),(126,7),(127,7),(128,7),(129,7),(130,7),(134,7),(0,8),(1,8),(5,8),(32,8),(33,8),(34,8),(36,8),(37,8),(40,8),(62,8),(66,8),(67,8),(68,8),(69,8),(74,8),(75,8),(76,8),(77,8),(78,8),(81,8),(82,8),(88,8),(89,8),(103,8),(106,8),(109,8),(110,8),(111,8),(112,8),(113,8),(114,8),(115,8),(116,8),(117,8),(118,8),(119,8),(120,8),(121,8),(122,8),(123,8),(124,8),(125,8),(126,8),(127,8),(128,8),(129,8),(130,8),(133,8),(0,9),(1,9),(3,9),(36,9),(37,9),(38,9),(39,9),(64,9),(83,9),(85,9),(86,9),(89,9),(103,9),(105,9),(133,9),(134,9),(3,10),(61,10),(62,10),(63,10),(65,10),(67,10),(69,10),(85,10),(86,10),(103,10),(107,10),(133,10),(134,10),(24,11),(64,11),(69,11),(82,11),(83,11),(88,11),(103,11),(104,11),(105,11),(106,11),(107,11),(133,11),(134,11),(1,12),(24,12),(29,12),(64,12),(82,12),(83,12),(84,12),(85,12),(86,12),(87,12),(88,12),(103,12),(104,12),(105,12),(106,12),(107,12),(133,12),(134,12),(23,13),(24,13),(26,13),(27,13),(30,13),(31,13),(33,13),(34,13),(84,13),(86,13),(87,13),(103,13),(104,13),(105,13),(106,13),(107,13),(133,13),(134,13),(34,14),(83,14),(85,14),(86,14),(88,14),(103,14),(104,14),(105,14),(106,14),(107,14),(133,14),(134,14),(0,15),(7,15),(8,15),(9,15),(10,15),(11,15),(12,15),(13,15),(14,15),(15,15),(27,15),(28,15),(33,15),(40,15),(85,15),(87,15),(103,15),(104,15),(105,15),(106,15),(107,15),(133,15),(134,15),(0,16),(7,16),(8,16),(9,16),(10,16),(11,16),(12,16),(13,16),(14,16),(15,16),(16,16),(24,16),(35,16),(40,16),(85,16),(86,16),(103,16),(104,16),(105,16),(106,16),(107,16),(133,16),(134,16),(0,17),(7,17),(8,17),(9,17),(10,17),(11,17),(12,17),(13,17),(14,17),(15,17),(16,17),(22,17),(24,17),(35,17),(39,17),(40,17),(89,17),(103,17),(104,17),(105,17),(106,17),(107,17),(133,17),(134,17),(0,18),(8,18),(9,18),(10,18),(11,18),(12,18),(13,18),(14,18),(15,18),(16,18),(22,18),(24,18),(25,18),(26,18),(30,18),(31,18),(32,18),(33,18),(34,18),(35,18),(39,18),(40,18),(41,18),(57,18),(84,18),(85,18),(86,18),(87,18),(88,18),(89,18),(103,18),(104,18),(105,18),(106,18),(107,18),(134,18),(0,19),(8,19),(9,19),(10,19),(11,19),(12,19),(13,19),(14,19),(15,19),(16,19),(17,19),(18,19),(19,19),(20,19),(26,19),(38,19),(40,19),(42,19),(57,19),(85,19),(87,19),(88,19),(103,19),(104,19),(133,19),(134,19),(0,20),(8,20),(9,20),(10,20),(11,20),(12,20),(13,20),(14,20),(15,20),(16,20),(17,20),(18,20),(19,20),(20,20),(27,20),(28,20),(33,20),(38,20),(39,20),(40,20),(41,20),(42,20),(43,20),(57,20),(58,20),(59,20),(67,20),(88,20),(133,20),(134,20),(0,21),(2,21),(16,21),(17,21),(18,21),(19,21),(20,21),(21,21),(37,21),(38,21),(39,21),(40,21),(42,21),(43,21),(58,21),(59,21),(67,21),(88,21),(133,21),(134,21),(0,22),(15,22),(16,22),(17,22),(18,22),(19,22),(20,22),(21,22),(29,22),(41,22),(43,22),(44,22),(45,22),(58,22),(133,22),(134,22),(0,23),(15,23),(16,23),(17,23),(18,23),(19,23),(20,23),(21,23),(42,23),(43,23),(44,23),(45,23),(46,23),(89,23),(105,23),(133,23),(134,23),(0,24),(15,24),(20,24),(21,24),(24,24),(25,24),(26,24),(27,24),(28,24),(29,24),(30,24),(31,24),(32,24),(33,24),(34,24),(44,24),(45,24),(133,24),(134,24),(0,25),(2,25),(21,25),(35,25),(36,25),(44,25),(46,25),(133,25),(134,25),(0,26),(2,26),(21,26),(22,26),(23,26),(24,26),(25,26),(26,26),(27,26),(28,26),(29,26),(30,26),(31,26),(32,26),(33,26),(34,26),(35,26),(36,26),(37,26),(45,26),(46,26),(133,26),(134,26),(0,27),(2,27),(23,27),(24,27),(25,27),(26,27),(27,27),(28,27),(29,27),(30,27),(31,27),(32,27),(33,27),(34,27),(35,27),(36,27),(37,27),(38,27),(44,27),(45,27),(46,27),(84,27),(134,27),(0,28),(2,28),(23,28),(24,28),(25,28),(26,28),(27,28),(28,28),(29,28),(30,28),(33,28),(34,28),(35,28),(36,28),(37,28),(38,28),(43,28),(44,28),(45,28),(46,28),(47,28),(83,28),(84,28),(85,28),(89,28),(133,28),(134,28),(0,29),(3,29),(36,29),(37,29),(38,29),(43,29),(44,29),(45,29),(46,29),(83,29),(84,29),(85,29),(133,29),(134,29),(3,30),(4,30),(6,30),(43,30),(44,30),(45,30),(47,30),(83,30),(86,30),(88,30),(89,30),(133,30),(134,30),(0,31),(1,31),(2,31),(4,31),(27,31),(28,31),(29,31),(30,31),(42,31),(43,31),(44,31),(45,31),(46,31),(83,31),(86,31),(88,31),(90,31),(105,31),(133,31),(134,31),(0,32),(1,32),(2,32),(3,32),(22,32),(23,32),(24,32),(31,32),(33,32),(42,32),(44,32),(45,32),(46,32),(83,32),(86,32),(89,32),(90,32),(93,32),(133,32),(134,32),(0,33),(2,33),(3,33),(22,33),(24,33),(25,33),(26,33),(31,33),(33,33),(34,33),(35,33),(36,33),(37,33),(40,33),(43,33),(44,33),(45,33),(46,33),(55,33),(84,33),(86,33),(88,33),(90,33),(133,33),(134,33),(0,34),(1,34),(2,34),(19,34),(28,34),(29,34),(30,34),(33,34),(34,34),(43,34),(44,34),(45,34),(46,34),(55,34),(86,34),(87,34),(89,34),(91,34),(134,34),(0,35),(1,35),(2,35),(3,35),(20,35),(22,35),(23,35),(26,35),(27,35),(28,35),(29,35),(30,35),(33,35),(34,35),(43,35),(44,35),(46,35),(47,35),(48,35),(49,35),(50,35),(51,35),(53,35),(54,35),(56,35),(86,35),(90,35),(133,35),(134,35),(0,36),(1,36),(2,36),(4,36),(5,36),(19,36),(20,36),(22,36),(23,36),(24,36),(26,36),(27,36),(28,36),(29,36),(34,36),(44,36),(45,36),(46,36),(47,36),(49,36),(50,36),(51,36),(52,36),(53,36),(54,36),(55,36),(56,36),(87,36),(88,36),(89,36),(107,36),(112,36),(113,36),(114,36),(115,36),(116,36),(117,36),(118,36),(119,36),(120,36),(121,36),(122,36),(123,36),(124,36),(125,36),(126,36),(133,36),(134,36),(0,37),(1,37),(19,37),(20,37),(22,37),(24,37),(26,37),(27,37),(28,37),(29,37),(30,37),(31,37),(32,37),(53,37),(89,37),(91,37),(111,37),(112,37),(113,37),(117,37),(118,37),(119,37),(120,37),(121,37),(122,37),(123,37),(124,37),(125,37),(126,37),(127,37),(128,37),(129,37),(130,37),(132,37),(133,37),(134,37),(0,38),(1,38),(2,38),(3,38),(4,38),(6,38),(18,38),(19,38),(20,38),(21,38),(22,38),(24,38),(26,38),(27,38),(28,38),(29,38),(30,38),(31,38),(32,38),(33,38),(35,38),(36,38),(37,38),(38,38),(39,38),(40,38),(41,38),(42,38),(43,38),(44,38),(45,38),(46,38),(47,38),(48,38),(49,38),(50,38),(51,38),(52,38),(53,38),(54,38),(55,38),(56,38),(57,38),(59,38),(111,38),(112,38),(113,38),(117,38),(118,38),(119,38),(120,38),(121,38),(122,38),(123,38),(124,38),(125,38),(126,38),(127,38),(128,38),(129,38),(132,38),(133,38),(134,38),(0,39),(1,39),(2,39),(3,39),(4,39),(5,39),(12,39),(13,39),(17,39),(18,39),(19,39),(20,39),(21,39),(22,39),(24,39),(26,39),(27,39),(28,39),(29,39),(30,39),(31,39),(32,39),(34,39),(35,39),(36,39),(58,39),(59,39),(112,39),(131,39),(132,39),(133,39),(134,39),(0,40),(1,40),(2,40),(3,40),(4,40),(5,40),(6,40),(7,40),(8,40),(9,40),(10,40),(11,40),(12,40),(13,40),(17,40),(18,40),(19,40),(20,40),(21,40),(22,40),(24,40),(26,40),(27,40),(28,40),(29,40),(30,40),(31,40),(32,40),(34,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(46,40),(47,40),(48,40),(49,40),(50,40),(51,40),(52,40),(53,40),(54,40),(55,40),(56,40),(57,40),(58,40),(59,40),(114,40),(115,40),(116,40),(117,40),(118,40),(119,40),(120,40),(121,40),(122,40),(123,40),(124,40),(125,40),(126,40),(127,40),(128,40),(129,40),(130,40),(131,40),(132,40),(133,40),(134,40)}
location.alwaysFront = {(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(0,1),(1,1),(2,1),(14,1),(15,1),(16,1),(17,1),(29,1),(30,1),(31,1),(32,1),(33,1),(0,2),(1,2),(2,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(28,2),(0,3),(1,3),(2,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(0,4),(1,4),(2,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(29,4),(59,4),(60,4),(61,4),(62,4),(0,5),(29,5),(58,5),(59,5),(60,5),(61,5),(62,5),(63,5),(104,5),(105,5),(106,5),(134,5),(0,6),(58,6),(59,6),(60,6),(61,6),(62,6),(63,6),(104,6),(105,6),(106,6),(134,6),(0,7),(58,7),(59,7),(60,7),(61,7),(62,7),(63,7),(104,7),(105,7),(106,7),(134,7),(104,8),(105,8),(106,8),(134,8),(132,12),(133,12),(134,12),(0,13),(1,13),(132,13),(133,13),(134,13),(0,14),(1,14),(7,14),(132,14),(133,14),(134,14),(0,15),(1,15),(15,15),(16,15),(17,15),(132,15),(133,15),(134,15),(0,16),(1,16),(15,16),(16,16),(17,16),(18,16),(19,16),(20,16),(0,17),(1,17),(15,17),(16,17),(17,17),(18,17),(19,17),(20,17),(0,18),(1,18),(15,18),(16,18),(17,18),(18,18),(19,18),(20,18),(0,19),(1,19),(2,19),(18,19),(19,19),(20,19),(0,20),(1,20),(2,20),(0,21),(1,21),(2,21),(12,21),(131,21),(132,21),(133,21),(0,22),(1,22),(2,22),(131,22),(132,22),(133,22),(1,23),(2,23),(131,23),(132,23),(133,23),(0,24),(1,24),(2,24),(131,24),(132,24),(133,24),(134,24),(134,25),(134,26),(134,27),(0,28),(1,28),(2,28),(0,29),(1,29),(2,29),(0,30),(1,30),(2,30),(0,31),(1,31),(2,31),(0,32),(2,32),(116,34),(117,34),(118,34),(119,34),(130,34),(131,34),(9,35),(10,35),(11,35),(112,35),(113,35),(117,35),(118,35),(119,35),(123,35),(124,35),(125,35),(128,35),(129,35),(130,35),(9,36),(10,36),(11,36),(112,36),(113,36),(115,36),(117,36),(118,36),(119,36),(123,36),(124,36),(125,36),(126,36),(128,36),(129,36),(130,36),(131,36),(9,37),(10,37),(11,37),(37,37),(38,37),(39,37),(46,37),(47,37),(48,37),(90,37),(91,37),(92,37),(105,37),(106,37),(107,37),(113,37),(114,37),(115,37),(117,37),(118,37),(119,37),(121,37),(122,37),(123,37),(124,37),(125,37),(128,37),(129,37),(130,37),(2,38),(3,38),(4,38),(6,38),(7,38),(9,38),(10,38),(11,38),(18,38),(19,38),(20,38),(86,38),(87,38),(88,38),(90,38),(91,38),(92,38),(105,38),(106,38),(107,38),(110,38),(111,38),(112,38),(113,38),(114,38),(115,38),(116,38),(118,38),(119,38),(120,38),(121,38),(122,38),(123,38),(124,38),(125,38),(126,38),(127,38),(128,38),(129,38),(130,38),(131,38),(132,38),(133,38),(0,39),(1,39),(2,39),(3,39),(4,39),(5,39),(7,39),(8,39),(9,39),(10,39),(11,39),(12,39),(18,39),(19,39),(20,39),(54,39),(55,39),(56,39),(86,39),(87,39),(88,39),(90,39),(91,39),(92,39),(105,39),(106,39),(107,39),(110,39),(111,39),(112,39),(113,39),(114,39),(115,39),(118,39),(119,39),(120,39),(121,39),(122,39),(123,39),(124,39),(125,39),(126,39),(127,39),(129,39),(131,39),(132,39),(133,39),(0,40),(1,40),(2,40),(3,40),(4,40),(5,40),(8,40),(9,40),(10,40),(11,40),(12,40),(18,40),(19,40),(20,40),(54,40),(55,40),(56,40),(86,40),(87,40),(88,40),(90,40),(91,40),(92,40),(105,40),(106,40),(107,40),(110,40),(111,40),(112,40),(113,40),(114,40),(115,40),(116,40),(117,40),(118,40),(119,40),(120,40),(121,40),(122,40),(123,40),(124,40),(125,40),(126,40),(127,40),(129,40),(131,40),(132,40),(133,40)}
location.front = {(1,0),(2,0),(3,0),(7,0),(8,0),(67,0),(68,0),(69,0),(71,0),(72,0),(73,0),(74,0),(75,0),(76,0),(77,0),(78,0),(79,0),(86,0),(87,0),(88,0),(89,0),(103,0),(104,0),(105,0),(106,0),(107,0),(108,0),(116,0),(128,0),(1,1),(2,1),(3,1),(7,1),(8,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(31,1),(32,1),(34,1),(67,1),(68,1),(69,1),(71,1),(72,1),(73,1),(74,1),(75,1),(76,1),(77,1),(78,1),(79,1),(87,1),(88,1),(89,1),(104,1),(106,1),(107,1),(108,1),(1,2),(2,2),(3,2),(7,2),(8,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(28,2),(29,2),(30,2),(31,2),(32,2),(67,2),(68,2),(69,2),(71,2),(72,2),(73,2),(74,2),(75,2),(76,2),(77,2),(78,2),(79,2),(84,2),(85,2),(86,2),(87,2),(88,2),(89,2),(106,2),(107,2),(108,2),(133,2),(134,2),(2,3),(3,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(28,3),(29,3),(30,3),(53,3),(54,3),(55,3),(67,3),(68,3),(69,3),(70,3),(71,3),(72,3),(73,3),(74,3),(75,3),(76,3),(77,3),(78,3),(79,3),(80,3),(84,3),(85,3),(86,3),(88,3),(106,3),(107,3),(108,3),(133,3),(134,3),(8,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(28,4),(29,4),(30,4),(58,4),(59,4),(60,4),(61,4),(62,4),(63,4),(67,4),(68,4),(69,4),(70,4),(71,4),(72,4),(73,4),(74,4),(75,4),(76,4),(77,4),(78,4),(79,4),(84,4),(85,4),(86,4),(107,4),(133,4),(134,4),(15,5),(16,5),(29,5),(58,5),(59,5),(60,5),(61,5),(62,5),(63,5),(73,5),(74,5),(75,5),(76,5),(77,5),(78,5),(79,5),(80,5),(81,5),(84,5),(85,5),(86,5),(123,5),(124,5),(125,5),(133,5),(134,5),(15,6),(16,6),(28,6),(29,6),(30,6),(58,6),(59,6),(60,6),(61,6),(62,6),(63,6),(85,6),(123,6),(124,6),(125,6),(134,6),(58,7),(59,7),(60,7),(61,7),(62,7),(63,7),(70,7),(71,7),(72,7),(80,7),(81,7),(82,7),(83,7),(123,7),(124,7),(125,7),(31,8),(60,8),(61,8),(131,8),(132,8),(133,8),(28,9),(105,9),(117,9),(118,9),(120,9),(121,9),(123,9),(127,9),(129,9),(130,9),(131,9),(132,9),(133,9),(110,10),(122,10),(124,10),(128,10),(131,10),(132,10),(133,10),(131,11),(132,11),(133,11),(129,12),(130,12),(132,12),(109,13),(110,13),(0,14),(1,14),(2,14),(0,15),(1,15),(6,15),(7,15),(8,15),(9,15),(10,15),(11,15),(12,15),(0,16),(6,16),(7,16),(8,16),(9,16),(10,16),(11,16),(12,16),(133,16),(1,17),(6,17),(7,17),(8,17),(9,17),(10,17),(11,17),(12,17),(13,17),(14,17),(6,18),(7,18),(8,18),(9,18),(10,18),(11,18),(12,18),(13,18),(14,18),(31,18),(133,18),(134,18),(0,19),(6,19),(9,19),(10,19),(11,19),(12,19),(13,19),(14,19),(15,19),(16,19),(19,19),(133,19),(134,19),(0,20),(9,20),(10,20),(11,20),(12,20),(13,20),(14,20),(15,20),(16,20),(17,20),(18,20),(19,20),(20,20),(129,20),(130,20),(133,20),(134,20),(9,21),(10,21),(11,21),(12,21),(13,21),(14,21),(15,21),(16,21),(17,21),(18,21),(19,21),(20,21),(43,21),(44,21),(45,21),(46,21),(133,21),(134,21),(7,22),(9,22),(10,22),(11,22),(12,22),(13,22),(14,22),(16,22),(17,22),(18,22),(19,22),(20,22),(134,22),(16,23),(17,23),(18,23),(19,23),(20,23),(8,24),(16,24),(89,24),(90,24),(91,24),(92,24),(93,24),(94,24),(97,24),(98,24),(99,24),(100,24),(101,24),(102,24),(103,24),(104,24),(105,24),(0,25),(1,25),(16,25),(129,25),(130,25),(132,25),(0,26),(1,26),(134,26),(89,27),(90,27),(91,27),(92,27),(93,27),(94,27),(97,27),(98,27),(99,27),(100,27),(101,27),(102,27),(103,27),(104,27),(105,27),(132,28),(133,28),(134,28),(1,29),(2,29),(132,29),(133,29),(134,29),(132,30),(133,30),(134,30),(93,31),(132,31),(133,31),(134,31),(1,32),(94,32),(133,32),(129,34),(130,34),(131,34),(132,34),(133,34),(134,34),(9,35),(10,35),(11,35),(111,35),(112,35),(113,35),(114,35),(115,35),(116,35),(117,35),(118,35),(119,35),(120,35),(121,35),(122,35),(123,35),(124,35),(125,35),(126,35),(127,35),(128,35),(129,35),(130,35),(131,35),(132,35),(133,35),(134,35),(9,36),(10,36),(11,36),(111,36),(112,36),(113,36),(114,36),(115,36),(116,36),(117,36),(118,36),(119,36),(120,36),(121,36),(122,36),(123,36),(124,36),(125,36),(126,36),(127,36),(128,36),(129,36),(130,36),(132,36),(133,36),(134,36),(3,37),(4,37),(5,37),(6,37),(7,37),(8,37),(9,37),(10,37),(11,37),(12,37),(13,37),(20,37),(21,37),(30,37),(31,37),(34,37),(35,37),(36,37),(37,37),(38,37),(39,37),(40,37),(41,37),(42,37),(43,37),(44,37),(45,37),(46,37),(47,37),(48,37),(49,37),(50,37),(51,37),(52,37),(53,37),(54,37),(55,37),(56,37),(57,37),(58,37),(59,37),(60,37),(111,37),(112,37),(113,37),(114,37),(115,37),(116,37),(117,37),(118,37),(119,37),(120,37),(121,37),(122,37),(123,37),(124,37),(125,37),(126,37),(127,37),(128,37),(129,37),(130,37),(132,37),(133,37),(134,37),(0,38),(1,38),(2,38),(3,38),(4,38),(5,38),(9,38),(10,38),(11,38),(21,38),(26,38),(29,38),(37,38),(38,38),(39,38),(46,38),(47,38),(48,38),(58,38),(59,38),(60,38),(112,38),(113,38),(114,38),(115,38),(116,38),(117,38),(118,38),(119,38),(120,38),(121,38),(122,38),(123,38),(124,38),(125,38),(126,38),(127,38),(128,38),(129,38),(133,38),(0,39),(1,39),(2,39),(3,39),(4,39),(5,39),(6,39),(7,39),(10,39),(11,39),(12,39),(21,39),(22,39),(58,39),(59,39),(60,39),(112,39),(113,39),(114,39),(115,39),(116,39),(117,39),(118,39),(119,39),(120,39),(121,39),(122,39),(123,39),(124,39),(125,39),(126,39),(127,39),(128,39),(129,39),(0,40),(1,40),(2,40),(3,40),(4,40),(5,40),(6,40),(7,40),(10,40),(21,40),(58,40),(59,40),(60,40),(112,40),(113,40),(114,40),(115,40),(119,40),(125,40),(128,40),(129,40),(131,40)}
location.buildings = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(26,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(41,0),(42,0),(43,0),(44,0),(45,0),(46,0),(47,0),(48,0),(49,0),(50,0),(51,0),(52,0),(53,0),(54,0),(55,0),(56,0),(57,0),(58,0),(59,0),(60,0),(61,0),(62,0),(63,0),(64,0),(65,0),(66,0),(67,0),(69,0),(70,0),(71,0),(72,0),(73,0),(74,0),(75,0),(76,0),(77,0),(78,0),(79,0),(80,0),(81,0),(82,0),(83,0),(84,0),(85,0),(90,0),(91,0),(92,0),(93,0),(94,0),(95,0),(96,0),(97,0),(98,0),(99,0),(102,0),(103,0),(104,0),(105,0),(106,0),(107,0),(108,0),(109,0),(110,0),(111,0),(112,0),(113,0),(114,0),(115,0),(117,0),(118,0),(119,0),(120,0),(121,0),(122,0),(123,0),(124,0),(125,0),(126,0),(127,0),(129,0),(130,0),(131,0),(132,0),(133,0),(134,0),(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(36,1),(37,1),(38,1),(39,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(50,1),(51,1),(52,1),(53,1),(54,1),(55,1),(56,1),(57,1),(58,1),(59,1),(60,1),(61,1),(62,1),(63,1),(64,1),(65,1),(66,1),(67,1),(69,1),(70,1),(71,1),(72,1),(73,1),(74,1),(75,1),(76,1),(77,1),(78,1),(79,1),(80,1),(81,1),(82,1),(83,1),(84,1),(85,1),(86,1),(90,1),(91,1),(92,1),(93,1),(94,1),(95,1),(96,1),(97,1),(98,1),(99,1),(103,1),(104,1),(105,1),(106,1),(107,1),(108,1),(109,1),(110,1),(111,1),(112,1),(113,1),(114,1),(115,1),(116,1),(117,1),(118,1),(119,1),(120,1),(121,1),(122,1),(123,1),(124,1),(125,1),(126,1),(127,1),(128,1),(129,1),(130,1),(131,1),(132,1),(133,1),(134,1),(0,2),(1,2),(2,2),(3,2),(4,2),(5,2),(6,2),(7,2),(8,2),(11,2),(12,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(40,2),(41,2),(42,2),(43,2),(44,2),(45,2),(46,2),(47,2),(48,2),(49,2),(50,2),(51,2),(52,2),(53,2),(54,2),(55,2),(56,2),(57,2),(58,2),(59,2),(60,2),(61,2),(62,2),(63,2),(64,2),(65,2),(66,2),(67,2),(68,2),(69,2),(70,2),(71,2),(72,2),(73,2),(74,2),(75,2),(76,2),(77,2),(78,2),(79,2),(80,2),(81,2),(82,2),(83,2),(84,2),(85,2),(86,2),(87,2),(90,2),(91,2),(92,2),(93,2),(94,2),(95,2),(96,2),(97,2),(98,2),(99,2),(103,2),(104,2),(105,2),(106,2),(107,2),(108,2),(109,2),(110,2),(111,2),(112,2),(113,2),(114,2),(115,2),(116,2),(117,2),(118,2),(119,2),(120,2),(121,2),(122,2),(123,2),(124,2),(125,2),(126,2),(127,2),(128,2),(129,2),(130,2),(131,2),(132,2),(133,2),(134,2),(0,3),(1,3),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(8,3),(11,3),(12,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(40,3),(41,3),(42,3),(43,3),(44,3),(45,3),(46,3),(47,3),(48,3),(49,3),(50,3),(51,3),(52,3),(53,3),(55,3),(56,3),(57,3),(58,3),(59,3),(60,3),(61,3),(62,3),(63,3),(64,3),(65,3),(66,3),(67,3),(69,3),(70,3),(71,3),(72,3),(73,3),(74,3),(75,3),(76,3),(77,3),(78,3),(79,3),(80,3),(81,3),(82,3),(83,3),(84,3),(86,3),(87,3),(89,3),(90,3),(91,3),(92,3),(93,3),(94,3),(95,3),(96,3),(97,3),(98,3),(99,3),(103,3),(104,3),(105,3),(106,3),(107,3),(108,3),(109,3),(110,3),(111,3),(112,3),(113,3),(114,3),(115,3),(116,3),(117,3),(118,3),(119,3),(120,3),(121,3),(122,3),(123,3),(124,3),(125,3),(126,3),(127,3),(128,3),(129,3),(130,3),(131,3),(132,3),(133,3),(134,3),(2,4),(3,4),(4,4),(5,4),(6,4),(7,4),(8,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(47,4),(48,4),(49,4),(50,4),(51,4),(52,4),(53,4),(55,4),(56,4),(57,4),(58,4),(59,4),(60,4),(61,4),(62,4),(63,4),(64,4),(65,4),(66,4),(67,4),(69,4),(70,4),(71,4),(80,4),(81,4),(82,4),(83,4),(84,4),(86,4),(87,4),(88,4),(89,4),(90,4),(91,4),(92,4),(93,4),(94,4),(95,4),(96,4),(97,4),(99,4),(103,4),(104,4),(105,4),(106,4),(108,4),(109,4),(110,4),(111,4),(112,4),(113,4),(114,4),(115,4),(116,4),(117,4),(118,4),(119,4),(120,4),(121,4),(122,4),(123,4),(124,4),(125,4),(126,4),(127,4),(128,4),(129,4),(130,4),(131,4),(132,4),(0,5),(1,5),(2,5),(3,5),(8,5),(27,5),(28,5),(29,5),(30,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(49,5),(50,5),(51,5),(52,5),(53,5),(55,5),(56,5),(57,5),(58,5),(59,5),(60,5),(61,5),(62,5),(63,5),(64,5),(65,5),(66,5),(67,5),(68,5),(69,5),(70,5),(71,5),(72,5),(80,5),(81,5),(82,5),(83,5),(84,5),(86,5),(87,5),(88,5),(89,5),(90,5),(91,5),(92,5),(93,5),(94,5),(95,5),(98,5),(102,5),(103,5),(104,5),(105,5),(106,5),(107,5),(108,5),(109,5),(110,5),(111,5),(112,5),(113,5),(114,5),(115,5),(116,5),(117,5),(118,5),(119,5),(120,5),(121,5),(122,5),(123,5),(124,5),(125,5),(126,5),(127,5),(128,5),(129,5),(130,5),(131,5),(132,5),(1,6),(2,6),(3,6),(4,6),(28,6),(30,6),(36,6),(37,6),(38,6),(39,6),(40,6),(46,6),(49,6),(62,6),(63,6),(64,6),(65,6),(66,6),(67,6),(68,6),(69,6),(70,6),(71,6),(72,6),(73,6),(74,6),(75,6),(76,6),(77,6),(78,6),(79,6),(80,6),(81,6),(82,6),(83,6),(84,6),(86,6),(87,6),(88,6),(89,6),(90,6),(91,6),(92,6),(93,6),(96,6),(102,6),(103,6),(104,6),(105,6),(106,6),(107,6),(108,6),(109,6),(110,6),(111,6),(112,6),(113,6),(114,6),(115,6),(116,6),(117,6),(118,6),(119,6),(120,6),(121,6),(122,6),(123,6),(124,6),(125,6),(126,6),(127,6),(128,6),(129,6),(130,6),(131,6),(132,6),(133,6),(1,7),(2,7),(3,7),(15,7),(16,7),(28,7),(30,7),(36,7),(37,7),(38,7),(39,7),(40,7),(46,7),(47,7),(48,7),(49,7),(64,7),(65,7),(66,7),(67,7),(68,7),(69,7),(70,7),(72,7),(73,7),(74,7),(75,7),(76,7),(77,7),(78,7),(79,7),(80,7),(81,7),(84,7),(85,7),(86,7),(87,7),(88,7),(89,7),(90,7),(91,7),(92,7),(95,7),(96,7),(97,7),(100,7),(101,7),(102,7),(103,7),(104,7),(105,7),(106,7),(107,7),(108,7),(109,7),(110,7),(111,7),(112,7),(113,7),(114,7),(115,7),(116,7),(117,7),(118,7),(119,7),(120,7),(121,7),(122,7),(123,7),(124,7),(125,7),(126,7),(127,7),(128,7),(129,7),(130,7),(131,7),(132,7),(133,7),(134,7),(0,8),(1,8),(2,8),(3,8),(36,8),(37,8),(38,8),(39,8),(40,8),(46,8),(49,8),(66,8),(67,8),(68,8),(69,8),(70,8),(71,8),(72,8),(73,8),(74,8),(75,8),(76,8),(77,8),(78,8),(79,8),(80,8),(81,8),(82,8),(83,8),(84,8),(85,8),(86,8),(87,8),(88,8),(89,8),(90,8),(91,8),(92,8),(93,8),(96,8),(100,8),(102,8),(103,8),(104,8),(105,8),(106,8),(107,8),(108,8),(109,8),(110,8),(111,8),(112,8),(113,8),(114,8),(115,8),(116,8),(117,8),(118,8),(119,8),(120,8),(121,8),(122,8),(123,8),(124,8),(125,8),(126,8),(127,8),(128,8),(129,8),(130,8),(131,8),(133,8),(0,9),(1,9),(2,9),(3,9),(29,9),(31,9),(36,9),(37,9),(38,9),(39,9),(40,9),(45,9),(46,9),(49,9),(51,9),(52,9),(53,9),(54,9),(55,9),(56,9),(57,9),(60,9),(61,9),(73,9),(74,9),(78,9),(79,9),(83,9),(84,9),(85,9),(86,9),(87,9),(88,9),(89,9),(90,9),(91,9),(92,9),(94,9),(101,9),(102,9),(103,9),(104,9),(105,9),(106,9),(107,9),(108,9),(109,9),(110,9),(111,9),(112,9),(113,9),(114,9),(115,9),(116,9),(117,9),(118,9),(119,9),(120,9),(121,9),(122,9),(123,9),(124,9),(125,9),(126,9),(127,9),(128,9),(129,9),(130,9),(131,9),(134,9),(0,10),(1,10),(2,10),(3,10),(28,10),(36,10),(44,10),(45,10),(48,10),(49,10),(50,10),(51,10),(52,10),(53,10),(54,10),(55,10),(56,10),(57,10),(60,10),(61,10),(84,10),(85,10),(86,10),(87,10),(88,10),(89,10),(90,10),(91,10),(92,10),(97,10),(100,10),(102,10),(103,10),(104,10),(105,10),(106,10),(107,10),(108,10),(110,10),(111,10),(112,10),(113,10),(114,10),(115,10),(116,10),(117,10),(118,10),(119,10),(120,10),(121,10),(122,10),(123,10),(124,10),(125,10),(126,10),(127,10),(128,10),(129,10),(130,10),(131,10),(134,10),(0,11),(1,11),(2,11),(3,11),(24,11),(36,11),(43,11),(44,11),(50,11),(55,11),(57,11),(58,11),(84,11),(85,11),(86,11),(87,11),(88,11),(89,11),(90,11),(91,11),(92,11),(93,11),(96,11),(97,11),(100,11),(102,11),(103,11),(104,11),(105,11),(106,11),(107,11),(108,11),(110,11),(111,11),(112,11),(114,11),(118,11),(122,11),(124,11),(125,11),(126,11),(128,11),(129,11),(130,11),(131,11),(134,11),(24,12),(36,12),(43,12),(44,12),(57,12),(58,12),(59,12),(84,12),(85,12),(86,12),(87,12),(88,12),(89,12),(90,12),(93,12),(97,12),(100,12),(102,12),(103,12),(104,12),(105,12),(106,12),(107,12),(108,12),(128,12),(131,12),(24,13),(36,13),(43,13),(57,13),(58,13),(59,13),(60,13),(61,13),(62,13),(90,13),(97,13),(102,13),(103,13),(104,13),(105,13),(106,13),(107,13),(108,13),(109,13),(129,13),(130,13),(131,13),(132,13),(6,14),(24,14),(36,14),(43,14),(57,14),(58,14),(59,14),(60,14),(61,14),(62,14),(90,14),(94,14),(100,14),(102,14),(103,14),(104,14),(105,14),(106,14),(107,14),(108,14),(109,14),(110,14),(129,14),(130,14),(131,14),(0,15),(1,15),(2,15),(6,15),(24,15),(25,15),(26,15),(29,15),(30,15),(31,15),(32,15),(33,15),(36,15),(43,15),(52,15),(53,15),(54,15),(55,15),(56,15),(57,15),(58,15),(59,15),(60,15),(62,15),(63,15),(64,15),(65,15),(66,15),(67,15),(68,15),(69,15),(70,15),(71,15),(72,15),(73,15),(74,15),(75,15),(76,15),(77,15),(90,15),(91,15),(99,15),(102,15),(103,15),(104,15),(105,15),(106,15),(107,15),(108,15),(109,15),(130,15),(131,15),(0,16),(1,16),(2,16),(6,16),(7,16),(8,16),(9,16),(10,16),(11,16),(12,16),(13,16),(14,16),(15,16),(16,16),(17,16),(18,16),(19,16),(20,16),(21,16),(24,16),(25,16),(26,16),(27,16),(28,16),(29,16),(30,16),(31,16),(32,16),(33,16),(34,16),(35,16),(36,16),(43,16),(44,16),(52,16),(53,16),(54,16),(55,16),(56,16),(57,16),(58,16),(59,16),(60,16),(61,16),(62,16),(63,16),(64,16),(65,16),(66,16),(67,16),(68,16),(69,16),(70,16),(71,16),(72,16),(73,16),(74,16),(75,16),(76,16),(77,16),(90,16),(91,16),(94,16),(102,16),(103,16),(104,16),(105,16),(106,16),(107,16),(108,16),(131,16),(132,16),(134,16),(0,17),(1,17),(2,17),(6,17),(7,17),(8,17),(9,17),(10,17),(11,17),(12,17),(13,17),(14,17),(15,17),(16,17),(17,17),(18,17),(19,17),(20,17),(21,17),(24,17),(25,17),(26,17),(27,17),(28,17),(29,17),(30,17),(31,17),(32,17),(33,17),(34,17),(35,17),(36,17),(44,17),(45,17),(52,17),(53,17),(54,17),(59,17),(60,17),(61,17),(63,17),(65,17),(67,17),(68,17),(69,17),(76,17),(77,17),(90,17),(94,17),(97,17),(102,17),(103,17),(104,17),(105,17),(106,17),(107,17),(108,17),(131,17),(132,17),(133,17),(0,18),(1,18),(2,18),(6,18),(7,18),(8,18),(9,18),(10,18),(11,18),(12,18),(13,18),(14,18),(15,18),(16,18),(17,18),(18,18),(19,18),(20,18),(21,18),(24,18),(25,18),(26,18),(27,18),(28,18),(29,18),(30,18),(31,18),(32,18),(33,18),(34,18),(35,18),(36,18),(45,18),(46,18),(47,18),(52,18),(53,18),(54,18),(59,18),(60,18),(62,18),(63,18),(64,18),(65,18),(66,18),(69,18),(77,18),(78,18),(89,18),(90,18),(102,18),(103,18),(104,18),(105,18),(106,18),(107,18),(108,18),(129,18),(131,18),(132,18),(133,18),(0,19),(1,19),(2,19),(6,19),(7,19),(8,19),(9,19),(10,19),(11,19),(12,19),(13,19),(14,19),(15,19),(16,19),(17,19),(18,19),(19,19),(20,19),(21,19),(26,19),(27,19),(28,19),(29,19),(31,19),(33,19),(34,19),(35,19),(36,19),(46,19),(52,19),(53,19),(54,19),(55,19),(61,19),(62,19),(63,19),(64,19),(65,19),(70,19),(77,19),(78,19),(79,19),(89,19),(90,19),(91,19),(102,19),(103,19),(104,19),(105,19),(106,19),(107,19),(108,19),(130,19),(131,19),(132,19),(0,20),(1,20),(2,20),(6,20),(7,20),(8,20),(15,20),(16,20),(19,20),(21,20),(47,20),(52,20),(53,20),(54,20),(55,20),(61,20),(63,20),(65,20),(70,20),(77,20),(79,20),(80,20),(89,20),(90,20),(102,20),(103,20),(104,20),(130,20),(131,20),(132,20),(0,21),(1,21),(2,21),(6,21),(9,21),(15,21),(16,21),(17,21),(18,21),(19,21),(20,21),(21,21),(48,21),(49,21),(50,21),(51,21),(55,21),(61,21),(62,21),(63,21),(64,21),(65,21),(69,21),(70,21),(71,21),(77,21),(78,21),(80,21),(89,21),(90,21),(92,21),(93,21),(100,21),(102,21),(103,21),(104,21),(129,21),(130,21),(131,21),(0,22),(1,22),(2,22),(6,22),(9,22),(15,22),(16,22),(17,22),(18,22),(19,22),(20,22),(21,22),(43,22),(44,22),(45,22),(46,22),(48,22),(49,22),(50,22),(51,22),(55,22),(56,22),(61,22),(62,22),(63,22),(64,22),(65,22),(69,22),(70,22),(77,22),(79,22),(80,22),(89,22),(92,22),(97,22),(102,22),(103,22),(104,22),(131,22),(0,23),(1,23),(2,23),(6,23),(7,23),(9,23),(10,23),(11,23),(12,23),(13,23),(14,23),(15,23),(16,23),(17,23),(18,23),(19,23),(20,23),(21,23),(48,23),(49,23),(50,23),(51,23),(55,23),(56,23),(60,23),(61,23),(62,23),(63,23),(64,23),(65,23),(66,23),(67,23),(69,23),(70,23),(78,23),(80,23),(90,23),(91,23),(96,23),(101,23),(102,23),(103,23),(104,23),(130,23),(131,23),(134,23),(0,24),(1,24),(2,24),(6,24),(9,24),(10,24),(11,24),(12,24),(13,24),(14,24),(15,24),(16,24),(17,24),(18,24),(19,24),(20,24),(21,24),(22,24),(23,24),(49,24),(51,24),(55,24),(56,24),(59,24),(60,24),(61,24),(62,24),(63,24),(64,24),(65,24),(66,24),(67,24),(69,24),(77,24),(78,24),(79,24),(80,24),(90,24),(104,24),(130,24),(131,24),(134,24),(0,25),(1,25),(2,25),(6,25),(8,25),(9,25),(10,25),(11,25),(12,25),(13,25),(14,25),(15,25),(16,25),(17,25),(18,25),(19,25),(20,25),(21,25),(22,25),(23,25),(24,25),(25,25),(26,25),(27,25),(28,25),(29,25),(30,25),(31,25),(32,25),(33,25),(34,25),(35,25),(49,25),(50,25),(51,25),(55,25),(56,25),(59,25),(60,25),(62,25),(63,25),(64,25),(65,25),(67,25),(68,25),(69,25),(77,25),(78,25),(79,25),(80,25),(89,25),(90,25),(91,25),(92,25),(93,25),(94,25),(97,25),(98,25),(99,25),(100,25),(101,25),(102,25),(103,25),(104,25),(105,25),(131,25),(133,25),(0,26),(1,26),(2,26),(16,26),(21,26),(22,26),(23,26),(24,26),(25,26),(26,26),(27,26),(28,26),(29,26),(30,26),(31,26),(32,26),(33,26),(34,26),(35,26),(36,26),(49,26),(50,26),(51,26),(55,26),(56,26),(57,26),(58,26),(59,26),(60,26),(61,26),(62,26),(63,26),(64,26),(66,26),(67,26),(68,26),(69,26),(77,26),(78,26),(80,26),(94,26),(97,26),(129,26),(130,26),(131,26),(132,26),(133,26),(0,27),(1,27),(2,27),(21,27),(22,27),(23,27),(24,27),(25,27),(26,27),(27,27),(28,27),(29,27),(30,27),(31,27),(32,27),(33,27),(34,27),(35,27),(36,27),(37,27),(49,27),(50,27),(51,27),(55,27),(56,27),(57,27),(58,27),(59,27),(60,27),(61,27),(62,27),(63,27),(64,27),(65,27),(66,27),(67,27),(68,27),(69,27),(70,27),(77,27),(79,27),(80,27),(94,27),(97,27),(130,27),(131,27),(132,27),(133,27),(0,28),(1,28),(2,28),(23,28),(24,28),(25,28),(26,28),(27,28),(28,28),(29,28),(30,28),(31,28),(32,28),(33,28),(34,28),(35,28),(36,28),(37,28),(38,28),(49,28),(50,28),(51,28),(55,28),(57,28),(58,28),(59,28),(60,28),(61,28),(62,28),(63,28),(64,28),(65,28),(66,28),(67,28),(68,28),(69,28),(70,28),(79,28),(89,28),(90,28),(91,28),(92,28),(93,28),(94,28),(97,28),(98,28),(99,28),(100,28),(101,28),(102,28),(103,28),(104,28),(105,28),(130,28),(131,28),(132,28),(0,29),(1,29),(2,29),(50,29),(51,29),(55,29),(56,29),(57,29),(77,29),(78,29),(82,29),(91,29),(92,29),(98,29),(103,29),(104,29),(130,29),(131,29),(0,30),(1,30),(2,30),(50,30),(51,30),(55,30),(56,30),(57,30),(77,30),(78,30),(82,30),(92,30),(98,30),(99,30),(102,30),(104,30),(129,30),(131,30),(0,31),(1,31),(2,31),(50,31),(54,31),(58,31),(59,31),(60,31),(61,31),(62,31),(63,31),(64,31),(65,31),(66,31),(67,31),(68,31),(69,31),(70,31),(77,31),(78,31),(82,31),(93,31),(94,31),(95,31),(98,31),(99,31),(100,31),(101,31),(102,31),(103,31),(104,31),(130,31),(131,31),(0,32),(1,32),(2,32),(50,32),(53,32),(58,32),(59,32),(60,32),(61,32),(62,32),(63,32),(64,32),(65,32),(66,32),(67,32),(68,32),(69,32),(77,32),(78,32),(79,32),(82,32),(93,32),(94,32),(95,32),(98,32),(99,32),(100,32),(101,32),(102,32),(103,32),(104,32),(131,32),(132,32),(0,33),(1,33),(2,33),(50,33),(51,33),(52,33),(53,33),(58,33),(60,33),(61,33),(62,33),(63,33),(64,33),(65,33),(66,33),(67,33),(68,33),(69,33),(70,33),(77,33),(78,33),(79,33),(82,33),(83,33),(84,33),(85,33),(86,33),(94,33),(95,33),(98,33),(99,33),(100,33),(101,33),(102,33),(103,33),(104,33),(130,33),(131,33),(132,33),(133,33),(134,33),(0,34),(1,34),(2,34),(58,34),(59,34),(60,34),(61,34),(62,34),(63,34),(64,34),(65,34),(66,34),(67,34),(68,34),(69,34),(70,34),(79,34),(82,34),(83,34),(84,34),(85,34),(86,34),(94,34),(97,34),(104,34),(129,34),(131,34),(132,34),(133,34),(134,34),(0,35),(1,35),(2,35),(22,35),(23,35),(24,35),(25,35),(26,35),(59,35),(60,35),(61,35),(62,35),(63,35),(64,35),(65,35),(66,35),(67,35),(68,35),(69,35),(70,35),(77,35),(79,35),(80,35),(82,35),(83,35),(84,35),(85,35),(86,35),(94,35),(96,35),(99,35),(104,35),(129,35),(130,35),(131,35),(132,35),(133,35),(134,35),(0,36),(1,36),(2,36),(20,36),(21,36),(22,36),(23,36),(24,36),(25,36),(26,36),(27,36),(28,36),(59,36),(60,36),(61,36),(62,36),(63,36),(64,36),(65,36),(66,36),(67,36),(68,36),(69,36),(70,36),(77,36),(78,36),(79,36),(80,36),(82,36),(83,36),(84,36),(85,36),(86,36),(92,36),(93,36),(94,36),(95,36),(102,36),(104,36),(105,36),(106,36),(131,36),(0,37),(1,37),(2,37),(19,37),(20,37),(21,37),(22,37),(23,37),(24,37),(25,37),(26,37),(27,37),(28,37),(29,37),(30,37),(31,37),(32,37),(61,37),(63,37),(65,37),(66,37),(67,37),(68,37),(70,37),(77,37),(78,37),(79,37),(80,37),(81,37),(82,37),(83,37),(84,37),(85,37),(86,37),(90,37),(91,37),(92,37),(93,37),(94,37),(104,37),(105,37),(106,37),(107,37),(108,37),(111,37),(112,37),(113,37),(114,37),(115,37),(116,37),(117,37),(118,37),(119,37),(120,37),(121,37),(122,37),(123,37),(124,37),(125,37),(126,37),(127,37),(128,37),(129,37),(130,37),(131,37),(0,38),(1,38),(2,38),(3,38),(4,38),(5,38),(6,38),(7,38),(8,38),(9,38),(10,38),(11,38),(12,38),(13,38),(18,38),(19,38),(20,38),(21,38),(22,38),(23,38),(24,38),(25,38),(26,38),(27,38),(28,38),(29,38),(30,38),(31,38),(32,38),(33,38),(34,38),(35,38),(36,38),(37,38),(38,38),(39,38),(40,38),(41,38),(42,38),(43,38),(44,38),(45,38),(46,38),(47,38),(48,38),(49,38),(50,38),(51,38),(52,38),(53,38),(54,38),(55,38),(56,38),(57,38),(58,38),(59,38),(60,38),(61,38),(62,38),(63,38),(64,38),(65,38),(66,38),(67,38),(68,38),(69,38),(70,38),(77,38),(79,38),(80,38),(81,38),(82,38),(83,38),(84,38),(85,38),(86,38),(87,38),(88,38),(89,38),(90,38),(91,38),(92,38),(93,38),(94,38),(99,38),(104,38),(105,38),(106,38),(107,38),(108,38),(109,38),(110,38),(111,38),(112,38),(113,38),(114,38),(115,38),(116,38),(117,38),(118,38),(119,38),(120,38),(121,38),(122,38),(123,38),(124,38),(125,38),(126,38),(127,38),(128,38),(129,38),(130,38),(131,38),(132,38),(133,38),(134,38),(1,39),(2,39),(3,39),(4,39),(5,39),(6,39),(7,39),(8,39),(9,39),(10,39),(11,39),(12,39),(13,39),(17,39),(18,39),(19,39),(20,39),(21,39),(22,39),(23,39),(24,39),(25,39),(26,39),(27,39),(28,39),(29,39),(30,39),(31,39),(32,39),(33,39),(34,39),(35,39),(36,39),(37,39),(38,39),(39,39),(40,39),(41,39),(42,39),(43,39),(44,39),(45,39),(46,39),(47,39),(48,39),(49,39),(50,39),(51,39),(52,39),(53,39),(54,39),(55,39),(56,39),(57,39),(58,39),(61,39),(62,39),(63,39),(64,39),(65,39),(66,39),(67,39),(68,39),(70,39),(77,39),(78,39),(79,39),(80,39),(81,39),(82,39),(84,39),(85,39),(86,39),(87,39),(88,39),(89,39),(90,39),(91,39),(92,39),(93,39),(94,39),(100,39),(101,39),(104,39),(105,39),(106,39),(107,39),(108,39),(109,39),(110,39),(111,39),(112,39),(113,39),(114,39),(115,39),(116,39),(117,39),(118,39),(119,39),(120,39),(121,39),(122,39),(123,39),(124,39),(125,39),(126,39),(127,39),(128,39),(129,39),(130,39),(131,39),(132,39),(133,39),(134,39),(0,40),(1,40),(2,40),(3,40),(4,40),(5,40),(6,40),(7,40),(8,40),(9,40),(10,40),(11,40),(12,40),(13,40),(17,40),(18,40),(19,40),(20,40),(21,40),(22,40),(23,40),(24,40),(25,40),(26,40),(27,40),(28,40),(29,40),(30,40),(31,40),(32,40),(33,40),(34,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(46,40),(47,40),(48,40),(49,40),(50,40),(51,40),(52,40),(53,40),(54,40),(55,40),(56,40),(57,40),(58,40),(61,40),(62,40),(64,40),(65,40),(66,40),(67,40),(68,40),(69,40),(70,40),(77,40),(78,40),(80,40),(81,40),(82,40),(83,40),(84,40),(85,40),(86,40),(87,40),(88,40),(89,40),(90,40),(91,40),(92,40),(96,40),(106,40),(107,40),(108,40),(109,40),(110,40),(111,40),(112,40),(113,40),(114,40),(115,40),(116,40),(117,40),(118,40),(119,40),(120,40),(121,40),(122,40),(123,40),(124,40),(125,40),(126,40),(127,40),(128,40),(129,40),(130,40),(131,40),(132,40),(133,40),(134,40)}
location.terrainFeatures = {(3,11),(4,5),(5,5),(6,5),(4,7),(4,36),(5,36),(5,6),(7,5),(21,5),(22,5),(22,32),(23,32),(23,5),(24,33),(25,33),(25,6),(26,6),(27,6),(25,19),(26,13),(27,13),(28,13),(26,32),(28,14),(28,20),(29,20),(29,12),(30,19),(31,13),(31,32),(32,19),(33,13),(34,13),(33,20),(34,20),(34,33),(35,33),(36,33),(34,37),(35,37),(36,37),(37,10),(38,10),(39,10),(37,17),(38,17),(41,6),(42,6),(43,30),(44,30),(45,30),(43,34),(44,24),(45,24),(44,36),(45,36),(52,36),(54,36),(55,36),(58,20),(59,20),(65,8),(82,11),(83,11),(84,11),(83,7),(83,31),(84,31),(85,31),(86,13),(87,13),(88,36),(89,36),(90,36),(91,31),(92,31),(92,32),(93,33),(101,18),(102,18),(104,21),(105,18),(5,30),(28,33),(32,36),(42,21),(46,30),(57,19),(67,20),(69,10),(85,16),(107,31)};
location.behindbush = {(3,10),(4,4),(5,4),(6,4),(4,6),(4,35),(5,35),(5,5),(7,4),(21,4),(22,4),(22,31),(23,31),(23,4),(24,32),(25,32),(25,5),(26,5),(27,5),(25,18),(26,12),(27,12),(28,12),(26,31),(28,13),(28,19),(29,19),(29,11),(30,18),(31,12),(31,31),(32,18),(33,12),(34,12),(33,19),(34,19),(34,32),(35,32),(36,32),(34,36),(35,36),(36,36),(37,9),(38,9),(39,9),(37,16),(38,16),(41,5),(42,5),(43,29),(44,29),(45,29),(43,33),(44,23),(45,23),(44,35),(45,35),(52,35),(54,35),(55,35),(58,19),(59,19),(65,7),(82,10),(83,10),(84,10),(83,6),(83,30),(84,30),(85,30),(86,12),(87,12),(88,35),(89,35),(90,35),(91,30),(92,30),(92,31),(93,32),(101,17),(102,17),(104,20),(105,17)};
location.behindtree = {(4,27),(4,28),(4,29),(4,30),(5,27),(5,28),(5,29),(5,30),(6,27),(6,28),(6,29),(6,30),(27,30),(27,31),(27,32),(27,33),(28,30),(28,31),(28,32),(28,33),(29,30),(29,31),(29,32),(29,33),(31,33),(31,34),(31,35),(31,36),(32,33),(32,34),(32,35),(32,36),(33,33),(33,34),(33,35),(33,36),(41,18),(41,19),(41,20),(41,21),(42,18),(42,19),(42,20),(42,21),(43,18),(43,19),(43,20),(43,21),(45,27),(45,28),(45,29),(45,30),(46,27),(46,28),(46,29),(46,30),(47,27),(47,28),(47,29),(47,30),(56,16),(56,17),(56,18),(56,19),(57,16),(57,17),(57,18),(57,19),(58,16),(58,17),(58,18),(58,19),(66,17),(66,18),(66,19),(66,20),(67,17),(67,18),(67,19),(67,20),(68,17),(68,18),(68,19),(68,20),(68,7),(68,8),(68,9),(68,10),(69,7),(69,8),(69,9),(69,10),(70,7),(70,8),(70,9),(70,10),(84,13),(84,14),(84,15),(84,16),(85,13),(85,14),(85,15),(85,16),(86,13),(86,14),(86,15),(86,16),(106,28),(106,29),(106,30),(106,31),(107,28),(107,29),(107,30),(107,31),(108,28),(108,29),(108,30),(108,31)};
location.diggable = {(98,0),(98,1),(96,2),(97,2),(94,3),(95,3),(96,3),(97,3),(93,4),(94,4),(50,5),(51,5),(52,5),(53,5),(93,5),(50,6),(51,6),(52,6),(53,6),(54,6),(45,7),(50,7),(51,7),(52,7),(53,7),(54,7),(55,7),(56,7),(57,7),(8,8),(9,8),(10,8),(11,8),(12,8),(13,8),(19,8),(20,8),(21,8),(22,8),(23,8),(24,8),(29,8),(39,8),(44,8),(45,8),(50,8),(51,8),(52,8),(53,8),(54,8),(55,8),(56,8),(57,8),(7,9),(8,9),(9,9),(10,9),(11,9),(12,9),(13,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(20,9),(21,9),(22,9),(23,9),(24,9),(25,9),(26,9),(29,9),(30,9),(43,9),(44,9),(50,9),(58,9),(59,9),(74,9),(75,9),(77,9),(78,9),(6,10),(7,10),(8,10),(9,10),(10,10),(11,10),(12,10),(13,10),(14,10),(15,10),(16,10),(17,10),(18,10),(19,10),(20,10),(21,10),(22,10),(23,10),(25,10),(26,10),(33,10),(43,10),(58,10),(73,10),(74,10),(75,10),(76,10),(77,10),(78,10),(79,10),(7,11),(8,11),(9,11),(10,11),(11,11),(12,11),(13,11),(14,11),(15,11),(16,11),(17,11),(18,11),(19,11),(20,11),(21,11),(22,11),(59,11),(73,11),(74,11),(75,11),(76,11),(77,11),(78,11),(79,11),(6,12),(7,12),(8,12),(9,12),(10,12),(11,12),(12,12),(13,12),(14,12),(15,12),(16,12),(17,12),(18,12),(19,12),(20,12),(21,12),(22,12),(42,12),(60,12),(61,12),(73,12),(74,12),(75,12),(76,12),(77,12),(78,12),(79,12),(0,13),(1,13),(2,13),(3,13),(4,13),(5,13),(6,13),(7,13),(8,13),(9,13),(10,13),(11,13),(12,13),(13,13),(15,13),(16,13),(17,13),(18,13),(19,13),(20,13),(21,13),(38,13),(39,13),(40,13),(41,13),(42,13),(63,13),(64,13),(65,13),(67,13),(68,13),(69,13),(70,13),(71,13),(72,13),(73,13),(74,13),(75,13),(76,13),(77,13),(78,13),(79,13),(113,13),(114,13),(115,13),(116,13),(117,13),(118,13),(119,13),(120,13),(121,13),(122,13),(123,13),(124,13),(125,13),(0,14),(1,14),(2,14),(3,14),(4,14),(5,14),(6,14),(16,14),(17,14),(18,14),(19,14),(20,14),(21,14),(38,14),(39,14),(42,14),(63,14),(64,14),(65,14),(66,14),(67,14),(68,14),(69,14),(70,14),(71,14),(72,14),(73,14),(74,14),(75,14),(76,14),(77,14),(78,14),(79,14),(80,14),(112,14),(113,14),(114,14),(115,14),(116,14),(117,14),(118,14),(119,14),(120,14),(121,14),(122,14),(123,14),(125,14),(126,14),(2,15),(3,15),(4,15),(5,15),(78,15),(79,15),(80,15),(81,15),(111,15),(112,15),(113,15),(114,15),(115,15),(116,15),(117,15),(118,15),(119,15),(120,15),(121,15),(122,15),(123,15),(125,15),(126,15),(127,15),(18,16),(19,16),(20,16),(21,16),(26,16),(27,16),(28,16),(29,16),(30,16),(31,16),(32,16),(33,16),(42,16),(78,16),(79,16),(80,16),(81,16),(82,16),(110,16),(111,16),(112,16),(113,16),(114,16),(115,16),(116,16),(117,16),(118,16),(119,16),(120,16),(121,16),(122,16),(123,16),(125,16),(126,16),(127,16),(18,17),(19,17),(20,17),(21,17),(43,17),(55,17),(58,17),(79,17),(80,17),(81,17),(82,17),(110,17),(111,17),(112,17),(113,17),(114,17),(115,17),(116,17),(117,17),(118,17),(119,17),(120,17),(121,17),(122,17),(123,17),(125,17),(126,17),(127,17),(18,18),(19,18),(20,18),(21,18),(43,18),(44,18),(67,18),(68,18),(79,18),(80,18),(81,18),(82,18),(110,18),(111,18),(112,18),(113,18),(114,18),(115,18),(116,18),(117,18),(118,18),(119,18),(120,18),(125,18),(126,18),(127,18),(21,19),(44,19),(45,19),(60,19),(66,19),(69,19),(80,19),(81,19),(82,19),(107,19),(108,19),(109,19),(110,19),(111,19),(112,19),(113,19),(114,19),(115,19),(116,19),(117,19),(118,19),(119,19),(120,19),(122,19),(123,19),(124,19),(125,19),(126,19),(127,19),(4,20),(5,20),(6,20),(45,20),(46,20),(69,20),(81,20),(82,20),(83,20),(106,20),(107,20),(108,20),(109,20),(110,20),(111,20),(112,20),(113,20),(114,20),(115,20),(116,20),(117,20),(118,20),(122,20),(123,20),(124,20),(125,20),(126,20),(127,20),(5,21),(6,21),(7,21),(9,21),(10,21),(11,21),(12,21),(13,21),(14,21),(15,21),(23,21),(24,21),(46,21),(47,21),(81,21),(82,21),(83,21),(84,21),(107,21),(108,21),(109,21),(110,21),(111,21),(112,21),(113,21),(114,21),(115,21),(116,21),(117,21),(118,21),(120,21),(121,21),(122,21),(123,21),(124,21),(125,21),(126,21),(127,21),(5,22),(9,22),(10,22),(11,22),(12,22),(13,22),(14,22),(24,22),(25,22),(47,22),(81,22),(82,22),(83,22),(84,22),(85,22),(86,22),(107,22),(108,22),(109,22),(110,22),(111,22),(112,22),(113,22),(114,22),(115,22),(116,22),(117,22),(118,22),(120,22),(121,22),(122,22),(123,22),(124,22),(125,22),(126,22),(127,22),(5,23),(10,23),(11,23),(12,23),(13,23),(14,23),(35,23),(36,23),(37,23),(38,23),(68,23),(81,23),(82,23),(83,23),(84,23),(85,23),(86,23),(87,23),(107,23),(108,23),(109,23),(110,23),(111,23),(112,23),(113,23),(114,23),(115,23),(116,23),(117,23),(118,23),(120,23),(121,23),(122,23),(123,23),(124,23),(125,23),(126,23),(127,23),(5,24),(10,24),(11,24),(12,24),(13,24),(14,24),(37,24),(38,24),(39,24),(40,24),(48,24),(68,24),(81,24),(82,24),(83,24),(84,24),(85,24),(86,24),(87,24),(106,24),(107,24),(108,24),(109,24),(110,24),(111,24),(112,24),(113,24),(114,24),(115,24),(116,24),(117,24),(118,24),(120,24),(121,24),(122,24),(123,24),(124,24),(125,24),(126,24),(127,24),(5,25),(10,25),(11,25),(12,25),(13,25),(14,25),(38,25),(39,25),(40,25),(41,25),(42,25),(48,25),(81,25),(82,25),(83,25),(85,25),(86,25),(87,25),(88,25),(106,25),(107,25),(108,25),(109,25),(110,25),(111,25),(112,25),(113,25),(114,25),(115,25),(116,25),(117,25),(118,25),(120,25),(121,25),(122,25),(123,25),(124,25),(125,25),(126,25),(127,25),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(11,26),(13,26),(14,26),(15,26),(16,26),(17,26),(18,26),(19,26),(39,26),(40,26),(41,26),(42,26),(81,26),(82,26),(85,26),(86,26),(87,26),(88,26),(120,26),(121,26),(122,26),(123,26),(124,26),(125,26),(126,26),(127,26),(4,27),(5,27),(6,27),(7,27),(8,27),(9,27),(10,27),(11,27),(12,27),(13,27),(14,27),(15,27),(16,27),(17,27),(18,27),(40,27),(41,27),(42,27),(48,27),(81,27),(82,27),(87,27),(88,27),(107,27),(108,27),(109,27),(110,27),(111,27),(112,27),(113,27),(114,27),(115,27),(116,27),(117,27),(118,27),(119,27),(120,27),(121,27),(122,27),(123,27),(124,27),(125,27),(126,27),(127,27),(5,28),(6,28),(7,28),(8,28),(9,28),(10,28),(11,28),(12,28),(13,28),(14,28),(15,28),(16,28),(17,28),(18,28),(19,28),(40,28),(41,28),(80,28),(81,28),(106,28),(107,28),(108,28),(109,28),(110,28),(111,28),(112,28),(113,28),(114,28),(115,28),(116,28),(117,28),(118,28),(119,28),(120,28),(121,28),(122,28),(123,28),(124,28),(125,28),(126,28),(127,28),(7,29),(8,29),(9,29),(10,29),(11,29),(12,29),(13,29),(14,29),(15,29),(16,29),(17,29),(18,29),(20,29),(21,29),(22,29),(23,29),(24,29),(25,29),(26,29),(27,29),(28,29),(29,29),(30,29),(31,29),(40,29),(41,29),(49,29),(80,29),(107,29),(108,29),(109,29),(110,29),(111,29),(112,29),(113,29),(114,29),(115,29),(116,29),(117,29),(118,29),(119,29),(120,29),(121,29),(122,29),(123,29),(124,29),(125,29),(126,29),(127,29),(8,30),(9,30),(10,30),(11,30),(12,30),(13,30),(14,30),(15,30),(16,30),(17,30),(18,30),(19,30),(20,30),(33,30),(40,30),(41,30),(79,30),(80,30),(106,30),(107,30),(108,30),(109,30),(110,30),(111,30),(112,30),(113,30),(114,30),(115,30),(116,30),(117,30),(118,30),(119,30),(120,30),(121,30),(122,30),(123,30),(124,30),(125,30),(126,30),(127,30),(8,31),(9,31),(10,31),(11,31),(12,31),(13,31),(14,31),(15,31),(16,31),(17,31),(18,31),(19,31),(34,31),(35,31),(36,31),(37,31),(38,31),(39,31),(40,31),(49,31),(55,31),(57,31),(79,31),(80,31),(107,31),(108,31),(109,31),(110,31),(111,31),(112,31),(113,31),(114,31),(115,31),(116,31),(117,31),(118,31),(119,31),(120,31),(121,31),(122,31),(123,31),(124,31),(125,31),(126,31),(127,31),(7,32),(8,32),(9,32),(10,32),(11,32),(12,32),(13,32),(14,32),(15,32),(16,32),(17,32),(18,32),(19,32),(49,32),(54,32),(80,32),(106,32),(107,32),(108,32),(109,32),(110,32),(111,32),(112,32),(113,32),(114,32),(115,32),(116,32),(117,32),(118,32),(119,32),(120,32),(121,32),(122,32),(123,32),(124,32),(125,32),(126,32),(127,32),(5,33),(6,33),(7,33),(8,33),(9,33),(10,33),(11,33),(12,33),(13,33),(14,33),(15,33),(16,33),(17,33),(18,33),(48,33),(49,33),(80,33),(81,33),(106,33),(107,33),(108,33),(109,33),(110,33),(111,33),(112,33),(113,33),(114,33),(115,33),(116,33),(117,33),(118,33),(119,33),(120,33),(121,33),(122,33),(123,33),(124,33),(125,33),(126,33),(127,33),(5,34),(6,34),(7,34),(8,34),(9,34),(10,34),(11,34),(12,34),(13,34),(14,34),(15,34),(16,34),(17,34),(40,34),(41,34),(57,34),(80,34),(81,34),(82,34),(107,34),(108,34),(109,34),(110,34),(111,34),(112,34),(113,34),(114,34),(115,34),(116,34),(117,34),(118,34),(119,34),(120,34),(121,34),(122,34),(123,34),(124,34),(125,34),(126,34),(127,34),(6,35),(7,35),(8,35),(9,35),(10,35),(11,35),(12,35),(13,35),(14,35),(15,35),(16,35),(17,35),(36,35),(37,35),(38,35),(39,35),(40,35),(41,35),(58,35),(81,35),(82,35),(83,35),(84,35),(108,35),(109,35),(110,35),(111,35),(112,35),(113,35),(114,35),(115,35),(116,35),(117,35),(118,35),(119,35),(120,35),(121,35),(122,35),(123,35),(124,35),(125,35),(126,35),(127,35),(7,36),(8,36),(9,36),(10,36),(11,36),(12,36),(13,36),(14,36),(15,36),(16,36),(17,36),(58,36),(82,36),(83,36),(84,36),(92,36),(93,36),(105,36),(106,36),(109,36),(111,36),(127,36),(7,37),(8,37),(9,37),(11,37),(12,37),(13,37),(14,37),(15,37),(16,37),(60,37),(86,37),(93,37),(105,37),(15,38),(16,38),(86,38),(87,38),(91,38),(92,38),(93,38),(105,38),(106,38),(107,38),(86,39),(87,39),(88,39),(89,39),(90,39),(91,39),(92,39),(108,39),(109,39),(86,40),(87,40),(88,40),(89,40),(90,40),(108,40),(109,40),(110,40)}
return location
def createForest(version="1.4"):
location = Location("Forest")
location.width = 120;
location.height = 120;
location.spawns = {
0: [[16, .9], [22, .9]],
1: [[396, .6], [402, .9]],
2: [[404, .9], [410, .9]],
3: [[418, .9], [414, .9], [283, .5]]};
if version == "1.4":
location.fspawnables = {(102,6),(105,6),(109,9),(109,10),(108,11),(109,11),(108,12),(109,12),(105,13),(107,14),(105,15),(106,15),(107,15),(103,16),(108,16),(107,17),(108,17),(107,18),(108,18),(109,18),(110,18),(108,19),(109,19),(110,19),(106,20),(107,20),(108,20)}
location.spawnable = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(17,0),(18,0),(20,0),(21,0),(22,0),(23,0),(24,0),(27,0),(28,0),(29,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(41,0),(42,0),(43,0),(44,0),(45,0),(46,0),(47,0),(48,0),(49,0),(50,0),(58,0),(66,0),(70,0),(73,0),(74,0),(75,0),(78,0),(85,0),(86,0),(87,0),(88,0),(89,0),(91,0),(97,0),(98,0),(99,0),(100,0),(101,0),(102,0),(103,0),(105,0),(106,0),(109,0),(110,0),(111,0),(115,0),(116,0),(117,0),(118,0),(7,1),(8,1),(9,1),(10,1),(17,1),(18,1),(20,1),(21,1),(22,1),(23,1),(27,1),(28,1),(29,1),(32,1),(34,1),(35,1),(36,1),(37,1),(38,1),(39,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(52,1),(53,1),(54,1),(55,1),(56,1),(60,1),(61,1),(65,1),(66,1),(73,1),(74,1),(75,1),(79,1),(80,1),(81,1),(82,1),(84,1),(85,1),(86,1),(89,1),(108,1),(109,1),(110,1),(111,1),(112,1),(113,1),(114,1),(115,1),(116,1),(117,1),(118,1),(119,1),(27,2),(28,2),(29,2),(30,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(40,2),(41,2),(42,2),(43,2),(44,2),(48,2),(49,2),(52,2),(53,2),(54,2),(55,2),(56,2),(57,2),(58,2),(59,2),(60,2),(61,2),(63,2),(65,2),(73,2),(75,2),(76,2),(77,2),(78,2),(81,2),(82,2),(83,2),(84,2),(85,2),(86,2),(87,2),(88,2),(91,2),(92,2),(93,2),(94,2),(95,2),(96,2),(97,2),(98,2),(99,2),(100,2),(101,2),(102,2),(103,2),(104,2),(105,2),(106,2),(107,2),(110,2),(111,2),(112,2),(113,2),(114,2),(116,2),(117,2),(118,2),(119,2),(26,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(40,3),(41,3),(42,3),(43,3),(44,3),(46,3),(48,3),(49,3),(51,3),(52,3),(53,3),(54,3),(55,3),(57,3),(59,3),(61,3),(65,3),(67,3),(73,3),(75,3),(76,3),(77,3),(78,3),(79,3),(80,3),(83,3),(84,3),(85,3),(86,3),(87,3),(91,3),(92,3),(93,3),(94,3),(95,3),(96,3),(97,3),(98,3),(99,3),(100,3),(101,3),(102,3),(103,3),(104,3),(105,3),(106,3),(107,3),(108,3),(109,3),(112,3),(113,3),(114,3),(115,3),(117,3),(118,3),(119,3),(25,4),(26,4),(28,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(48,4),(49,4),(51,4),(52,4),(53,4),(54,4),(55,4),(56,4),(57,4),(58,4),(61,4),(62,4),(63,4),(64,4),(65,4),(75,4),(76,4),(77,4),(78,4),(79,4),(80,4),(81,4),(82,4),(85,4),(86,4),(89,4),(90,4),(91,4),(92,4),(93,4),(94,4),(95,4),(96,4),(97,4),(98,4),(99,4),(100,4),(101,4),(102,4),(103,4),(104,4),(105,4),(106,4),(107,4),(108,4),(109,4),(110,4),(111,4),(113,4),(114,4),(24,5),(25,5),(26,5),(30,5),(31,5),(36,5),(47,5),(48,5),(49,5),(51,5),(52,5),(56,5),(57,5),(58,5),(59,5),(61,5),(62,5),(63,5),(64,5),(65,5),(71,5),(72,5),(73,5),(78,5),(79,5),(85,5),(93,5),(94,5),(95,5),(96,5),(97,5),(98,5),(99,5),(100,5),(101,5),(102,5),(103,5),(104,5),(105,5),(106,5),(107,5),(113,5),(114,5),(23,6),(24,6),(25,6),(26,6),(27,6),(28,6),(29,6),(30,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(42,6),(43,6),(49,6),(52,6),(54,6),(56,6),(57,6),(58,6),(59,6),(60,6),(61,6),(62,6),(63,6),(64,6),(65,6),(67,6),(71,6),(72,6),(73,6),(77,6),(78,6),(82,6),(87,6),(89,6),(93,6),(94,6),(95,6),(96,6),(97,6),(98,6),(99,6),(100,6),(101,6),(102,6),(103,6),(104,6),(105,6),(106,6),(107,6),(108,6),(109,6),(117,6),(118,6),(119,6),(0,7),(22,7),(26,7),(27,7),(28,7),(29,7),(30,7),(32,7),(34,7),(45,7),(47,7),(49,7),(52,7),(58,7),(59,7),(60,7),(62,7),(63,7),(64,7),(65,7),(67,7),(71,7),(72,7),(74,7),(78,7),(79,7),(80,7),(82,7),(83,7),(86,7),(88,7),(92,7),(93,7),(94,7),(95,7),(96,7),(97,7),(98,7),(99,7),(100,7),(101,7),(102,7),(103,7),(104,7),(105,7),(106,7),(107,7),(108,7),(109,7),(110,7),(113,7),(117,7),(118,7),(119,7),(22,8),(24,8),(26,8),(27,8),(28,8),(29,8),(30,8),(32,8),(34,8),(45,8),(47,8),(51,8),(52,8),(53,8),(54,8),(55,8),(56,8),(57,8),(58,8),(59,8),(60,8),(61,8),(62,8),(63,8),(64,8),(65,8),(67,8),(70,8),(72,8),(73,8),(74,8),(79,8),(80,8),(85,8),(90,8),(91,8),(92,8),(93,8),(94,8),(95,8),(96,8),(97,8),(98,8),(99,8),(107,8),(108,8),(109,8),(110,8),(118,8),(119,8),(0,9),(1,9),(6,9),(7,9),(8,9),(9,9),(10,9),(11,9),(12,9),(13,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(20,9),(21,9),(22,9),(26,9),(27,9),(28,9),(29,9),(30,9),(32,9),(34,9),(36,9),(38,9),(39,9),(40,9),(41,9),(45,9),(47,9),(48,9),(49,9),(50,9),(51,9),(52,9),(53,9),(54,9),(55,9),(56,9),(57,9),(58,9),(59,9),(60,9),(61,9),(62,9),(63,9),(64,9),(67,9),(73,9),(74,9),(76,9),(80,9),(81,9),(82,9),(83,9),(89,9),(91,9),(92,9),(103,9),(104,9),(108,9),(109,9),(113,9),(0,10),(1,10),(2,10),(9,10),(10,10),(11,10),(12,10),(13,10),(14,10),(15,10),(16,10),(17,10),(18,10),(19,10),(20,10),(21,10),(22,10),(23,10),(24,10),(25,10),(26,10),(27,10),(28,10),(29,10),(32,10),(34,10),(38,10),(39,10),(40,10),(41,10),(45,10),(47,10),(48,10),(49,10),(50,10),(51,10),(52,10),(53,10),(54,10),(55,10),(56,10),(58,10),(59,10),(60,10),(66,10),(70,10),(71,10),(72,10),(74,10),(75,10),(76,10),(77,10),(78,10),(80,10),(81,10),(82,10),(83,10),(89,10),(90,10),(91,10),(92,10),(96,10),(97,10),(98,10),(99,10),(100,10),(101,10),(104,10),(105,10),(106,10),(108,10),(109,10),(111,10),(112,10),(114,10),(115,10),(116,10),(117,10),(118,10),(2,11),(3,11),(6,11),(31,11),(32,11),(36,11),(47,11),(48,11),(49,11),(50,11),(52,11),(53,11),(54,11),(55,11),(56,11),(57,11),(58,11),(60,11),(64,11),(65,11),(71,11),(76,11),(77,11),(78,11),(80,11),(90,11),(92,11),(94,11),(95,11),(96,11),(97,11),(98,11),(99,11),(100,11),(101,11),(102,11),(103,11),(104,11),(105,11),(109,11),(112,11),(113,11),(116,11),(117,11),(118,11),(119,11),(0,12),(3,12),(4,12),(6,12),(7,12),(8,12),(9,12),(11,12),(12,12),(13,12),(14,12),(16,12),(17,12),(18,12),(19,12),(21,12),(25,12),(26,12),(27,12),(28,12),(29,12),(30,12),(32,12),(39,12),(40,12),(44,12),(45,12),(48,12),(50,12),(51,12),(52,12),(53,12),(54,12),(56,12),(58,12),(59,12),(60,12),(61,12),(63,12),(64,12),(77,12),(78,12),(80,12),(82,12),(83,12),(84,12),(85,12),(89,12),(90,12),(94,12),(95,12),(96,12),(97,12),(98,12),(99,12),(100,12),(102,12),(105,12),(107,12),(109,12),(110,12),(111,12),(113,12),(114,12),(115,12),(117,12),(118,12),(119,12),(0,13),(1,13),(3,13),(4,13),(6,13),(7,13),(8,13),(9,13),(12,13),(13,13),(14,13),(15,13),(16,13),(17,13),(18,13),(19,13),(20,13),(21,13),(22,13),(24,13),(25,13),(27,13),(28,13),(29,13),(30,13),(31,13),(32,13),(33,13),(36,13),(37,13),(39,13),(42,13),(46,13),(47,13),(52,13),(53,13),(54,13),(56,13),(57,13),(58,13),(59,13),(61,13),(63,13),(78,13),(82,13),(83,13),(84,13),(85,13),(88,13),(89,13),(90,13),(94,13),(102,13),(104,13),(106,13),(109,13),(110,13),(111,13),(114,13),(115,13),(116,13),(4,14),(6,14),(7,14),(8,14),(10,14),(11,14),(12,14),(14,14),(15,14),(16,14),(17,14),(18,14),(19,14),(20,14),(21,14),(22,14),(23,14),(24,14),(25,14),(26,14),(27,14),(28,14),(29,14),(30,14),(31,14),(32,14),(33,14),(42,14),(50,14),(54,14),(56,14),(58,14),(62,14),(63,14),(79,14),(81,14),(82,14),(84,14),(85,14),(87,14),(88,14),(89,14),(90,14),(94,14),(102,14),(107,14),(109,14),(110,14),(111,14),(112,14),(113,14),(115,14),(116,14),(118,14),(0,15),(5,15),(6,15),(7,15),(8,15),(9,15),(10,15),(12,15),(13,15),(15,15),(16,15),(17,15),(18,15),(19,15),(20,15),(21,15),(22,15),(23,15),(24,15),(27,15),(29,15),(30,15),(31,15),(32,15),(35,15),(36,15),(38,15),(39,15),(41,15),(42,15),(43,15),(44,15),(45,15),(46,15),(47,15),(48,15),(52,15),(54,15),(60,15),(61,15),(62,15),(78,15),(80,15),(81,15),(82,15),(83,15),(84,15),(85,15),(94,15),(102,15),(104,15),(105,15),(108,15),(111,15),(112,15),(113,15),(114,15),(0,16),(2,16),(6,16),(7,16),(8,16),(9,16),(10,16),(11,16),(13,16),(16,16),(17,16),(18,16),(19,16),(20,16),(21,16),(22,16),(31,16),(34,16),(35,16),(36,16),(38,16),(43,16),(45,16),(46,16),(48,16),(49,16),(53,16),(55,16),(58,16),(59,16),(82,16),(91,16),(92,16),(94,16),(104,16),(105,16),(106,16),(108,16),(109,16),(112,16),(113,16),(114,16),(115,16),(116,16),(117,16),(119,16),(6,17),(7,17),(8,17),(9,17),(10,17),(14,17),(15,17),(17,17),(18,17),(19,17),(20,17),(21,17),(22,17),(23,17),(26,17),(27,17),(43,17),(44,17),(46,17),(47,17),(48,17),(49,17),(50,17),(51,17),(82,17),(87,17),(92,17),(104,17),(105,17),(106,17),(107,17),(110,17),(111,17),(112,17),(113,17),(114,17),(115,17),(116,17),(117,17),(118,17),(119,17),(0,18),(1,18),(2,18),(3,18),(4,18),(8,18),(9,18),(10,18),(11,18),(14,18),(15,18),(16,18),(17,18),(18,18),(19,18),(20,18),(21,18),(22,18),(25,18),(47,18),(48,18),(50,18),(51,18),(52,18),(53,18),(54,18),(55,18),(56,18),(57,18),(59,18),(92,18),(93,18),(105,18),(106,18),(107,18),(112,18),(113,18),(114,18),(115,18),(116,18),(117,18),(118,18),(119,18),(0,19),(2,19),(3,19),(4,19),(9,19),(10,19),(13,19),(14,19),(15,19),(17,19),(18,19),(19,19),(21,19),(22,19),(24,19),(48,19),(49,19),(50,19),(51,19),(54,19),(56,19),(57,19),(61,19),(79,19),(80,19),(91,19),(92,19),(105,19),(106,19),(109,19),(111,19),(112,19),(113,19),(114,19),(115,19),(116,19),(117,19),(118,19),(119,19),(0,20),(2,20),(3,20),(4,20),(5,20),(6,20),(10,20),(11,20),(13,20),(14,20),(15,20),(18,20),(19,20),(20,20),(21,20),(50,20),(51,20),(53,20),(55,20),(56,20),(57,20),(58,20),(61,20),(63,20),(74,20),(75,20),(76,20),(77,20),(79,20),(80,20),(81,20),(82,20),(86,20),(88,20),(92,20),(105,20),(106,20),(107,20),(111,20),(112,20),(115,20),(116,20),(118,20),(119,20),(1,21),(2,21),(3,21),(4,21),(5,21),(6,21),(7,21),(10,21),(11,21),(12,21),(13,21),(14,21),(17,21),(18,21),(19,21),(49,21),(51,21),(52,21),(53,21),(54,21),(55,21),(56,21),(57,21),(59,21),(62,21),(64,21),(65,21),(67,21),(71,21),(74,21),(76,21),(77,21),(79,21),(81,21),(82,21),(87,21),(88,21),(89,21),(105,21),(106,21),(107,21),(108,21),(0,22),(1,22),(2,22),(3,22),(4,22),(5,22),(6,22),(7,22),(10,22),(11,22),(12,22),(13,22),(14,22),(16,22),(17,22),(21,22),(22,22),(23,22),(52,22),(53,22),(54,22),(57,22),(60,22),(63,22),(64,22),(65,22),(66,22),(68,22),(70,22),(74,22),(78,22),(79,22),(80,22),(87,22),(88,22),(115,22),(116,22),(117,22),(118,22),(119,22),(0,23),(1,23),(2,23),(3,23),(4,23),(7,23),(11,23),(12,23),(14,23),(15,23),(16,23),(17,23),(21,23),(22,23),(50,23),(51,23),(53,23),(54,23),(56,23),(57,23),(59,23),(60,23),(61,23),(63,23),(64,23),(65,23),(66,23),(69,23),(72,23),(73,23),(74,23),(75,23),(77,23),(78,23),(89,23),(90,23),(96,23),(100,23),(102,23),(104,23),(105,23),(106,23),(109,23),(110,23),(111,23),(112,23),(114,23),(2,24),(3,24),(10,24),(11,24),(12,24),(13,24),(14,24),(15,24),(16,24),(20,24),(21,24),(22,24),(51,24),(52,24),(54,24),(55,24),(57,24),(58,24),(60,24),(61,24),(64,24),(65,24),(66,24),(68,24),(70,24),(72,24),(73,24),(74,24),(75,24),(76,24),(104,24),(105,24),(106,24),(107,24),(109,24),(110,24),(111,24),(118,24),(0,25),(2,25),(3,25),(7,25),(9,25),(11,25),(12,25),(13,25),(14,25),(15,25),(16,25),(20,25),(21,25),(51,25),(53,25),(56,25),(57,25),(58,25),(61,25),(64,25),(65,25),(67,25),(69,25),(70,25),(77,25),(88,25),(89,25),(91,25),(93,25),(2,26),(3,26),(4,26),(9,26),(12,26),(13,26),(14,26),(15,26),(19,26),(20,26),(51,26),(52,26),(54,26),(55,26),(57,26),(59,26),(60,26),(63,26),(64,26),(67,26),(69,26),(70,26),(73,26),(74,26),(77,26),(78,26),(80,26),(81,26),(87,26),(88,26),(89,26),(90,26),(92,26),(97,26),(99,26),(1,27),(11,27),(13,27),(14,27),(18,27),(19,27),(50,27),(52,27),(53,27),(54,27),(55,27),(58,27),(60,27),(62,27),(65,27),(66,27),(67,27),(68,27),(72,27),(73,27),(77,27),(78,27),(81,27),(82,27),(85,27),(86,27),(90,27),(92,27),(93,27),(97,27),(98,27),(100,27),(101,27),(102,27),(103,27),(104,27),(105,27),(106,27),(107,27),(108,27),(112,27),(113,27),(114,27),(115,27),(119,27),(0,28),(1,28),(2,28),(8,28),(10,28),(14,28),(17,28),(18,28),(51,28),(52,28),(53,28),(54,28),(55,28),(56,28),(58,28),(59,28),(60,28),(65,28),(70,28),(71,28),(72,28),(73,28),(74,28),(75,28),(81,28),(83,28),(84,28),(85,28),(87,28),(88,28),(89,28),(90,28),(97,28),(109,28),(0,29),(1,29),(2,29),(3,29),(8,29),(11,29),(18,29),(51,29),(53,29),(54,29),(55,29),(59,29),(61,29),(64,29),(65,29),(66,29),(69,29),(70,29),(71,29),(74,29),(75,29),(76,29),(82,29),(84,29),(85,29),(86,29),(88,29),(89,29),(102,29),(103,29),(104,29),(105,29),(108,29),(109,29),(113,29),(114,29),(0,30),(16,30),(18,30),(19,30),(51,30),(52,30),(53,30),(54,30),(55,30),(56,30),(58,30),(59,30),(60,30),(61,30),(65,30),(69,30),(70,30),(71,30),(72,30),(75,30),(76,30),(77,30),(78,30),(79,30),(80,30),(85,30),(86,30),(88,30),(92,30),(94,30),(98,30),(100,30),(101,30),(102,30),(103,30),(104,30),(105,30),(107,30),(108,30),(111,30),(113,30),(114,30),(115,30),(117,30),(118,30),(0,31),(2,31),(3,31),(8,31),(9,31),(13,31),(19,31),(55,31),(58,31),(60,31),(61,31),(64,31),(68,31),(69,31),(70,31),(72,31),(73,31),(77,31),(78,31),(79,31),(80,31),(81,31),(82,31),(83,31),(87,31),(91,31),(93,31),(98,31),(100,31),(101,31),(102,31),(104,31),(105,31),(106,31),(107,31),(108,31),(110,31),(113,31),(114,31),(115,31),(0,32),(2,32),(3,32),(9,32),(10,32),(11,32),(17,32),(19,32),(54,32),(55,32),(58,32),(61,32),(63,32),(64,32),(65,32),(67,32),(68,32),(69,32),(70,32),(72,32),(74,32),(75,32),(76,32),(78,32),(79,32),(80,32),(81,32),(82,32),(83,32),(85,32),(86,32),(87,32),(91,32),(92,32),(94,32),(96,32),(97,32),(101,32),(104,32),(105,32),(106,32),(107,32),(108,32),(117,32),(118,32),(0,33),(11,33),(14,33),(17,33),(20,33),(54,33),(57,33),(58,33),(59,33),(60,33),(61,33),(64,33),(65,33),(68,33),(69,33),(71,33),(73,33),(74,33),(76,33),(81,33),(85,33),(86,33),(87,33),(94,33),(99,33),(105,33),(106,33),(107,33),(108,33),(111,33),(112,33),(113,33),(114,33),(116,33),(118,33),(0,34),(1,34),(12,34),(14,34),(17,34),(20,34),(21,34),(57,34),(58,34),(59,34),(63,34),(64,34),(65,34),(67,34),(69,34),(70,34),(71,34),(73,34),(74,34),(75,34),(76,34),(77,34),(85,34),(100,34),(102,34),(110,34),(112,34),(118,34),(119,34),(1,35),(11,35),(12,35),(17,35),(18,35),(21,35),(22,35),(56,35),(57,35),(58,35),(59,35),(60,35),(63,35),(64,35),(65,35),(70,35),(71,35),(72,35),(73,35),(74,35),(75,35),(79,35),(82,35),(85,35),(86,35),(87,35),(94,35),(99,35),(100,35),(101,35),(105,35),(4,36),(5,36),(6,36),(8,36),(11,36),(12,36),(17,36),(19,36),(21,36),(23,36),(56,36),(57,36),(58,36),(59,36),(60,36),(63,36),(64,36),(68,36),(73,36),(79,36),(83,36),(84,36),(86,36),(92,36),(95,36),(96,36),(98,36),(105,36),(11,37),(13,37),(14,37),(15,37),(16,37),(18,37),(19,37),(22,37),(23,37),(56,37),(57,37),(58,37),(59,37),(62,37),(63,37),(65,37),(66,37),(72,37),(73,37),(75,37),(76,37),(78,37),(80,37),(82,37),(88,37),(3,38),(5,38),(6,38),(7,38),(8,38),(11,38),(17,38),(19,38),(23,38),(24,38),(55,38),(58,38),(59,38),(60,38),(63,38),(65,38),(68,38),(69,38),(71,38),(74,38),(75,38),(76,38),(77,38),(78,38),(80,38),(81,38),(94,38),(4,39),(5,39),(7,39),(8,39),(9,39),(12,39),(13,39),(14,39),(15,39),(17,39),(18,39),(20,39),(21,39),(54,39),(55,39),(56,39),(57,39),(58,39),(59,39),(60,39),(61,39),(64,39),(65,39),(69,39),(71,39),(72,39),(73,39),(75,39),(77,39),(79,39),(0,40),(1,40),(3,40),(4,40),(6,40),(7,40),(8,40),(9,40),(10,40),(13,40),(14,40),(17,40),(18,40),(19,40),(21,40),(22,40),(54,40),(55,40),(58,40),(59,40),(61,40),(63,40),(65,40),(66,40),(68,40),(69,40),(71,40),(75,40),(77,40),(78,40),(80,40),(0,41),(1,41),(4,41),(7,41),(8,41),(9,41),(10,41),(11,41),(17,41),(18,41),(19,41),(20,41),(21,41),(22,41),(23,41),(24,41),(25,41),(27,41),(29,41),(53,41),(54,41),(57,41),(58,41),(59,41),(63,41),(65,41),(67,41),(68,41),(69,41),(70,41),(72,41),(74,41),(75,41),(76,41),(77,41),(78,41),(0,42),(1,42),(3,42),(7,42),(8,42),(9,42),(10,42),(11,42),(12,42),(13,42),(14,42),(15,42),(16,42),(17,42),(18,42),(19,42),(20,42),(21,42),(22,42),(23,42),(24,42),(25,42),(26,42),(27,42),(30,42),(31,42),(52,42),(53,42),(54,42),(55,42),(56,42),(57,42),(59,42),(61,42),(64,42),(68,42),(70,42),(71,42),(72,42),(74,42),(76,42),(77,42),(2,43),(8,43),(9,43),(10,43),(11,43),(12,43),(13,43),(14,43),(15,43),(16,43),(17,43),(18,43),(19,43),(20,43),(21,43),(22,43),(23,43),(24,43),(25,43),(26,43),(27,43),(28,43),(35,43),(44,43),(51,43),(52,43),(53,43),(54,43),(55,43),(57,43),(60,43),(61,43),(63,43),(68,43),(70,43),(71,43),(72,43),(73,43),(76,43),(3,44),(4,44),(5,44),(6,44),(11,44),(15,44),(16,44),(17,44),(18,44),(19,44),(21,44),(23,44),(24,44),(25,44),(26,44),(27,44),(28,44),(29,44),(30,44),(32,44),(34,44),(35,44),(36,44),(37,44),(38,44),(39,44),(40,44),(42,44),(43,44),(45,44),(46,44),(48,44),(49,44),(50,44),(51,44),(52,44),(53,44),(54,44),(58,44),(63,44),(64,44),(65,44),(67,44),(68,44),(69,44),(71,44),(73,44),(74,44),(75,44),(0,45),(4,45),(6,45),(10,45),(12,45),(13,45),(16,45),(18,45),(19,45),(20,45),(21,45),(22,45),(23,45),(24,45),(26,45),(28,45),(29,45),(30,45),(32,45),(33,45),(34,45),(35,45),(36,45),(37,45),(39,45),(40,45),(43,45),(44,45),(45,45),(46,45),(47,45),(48,45),(50,45),(51,45),(52,45),(53,45),(54,45),(57,45),(61,45),(63,45),(66,45),(67,45),(68,45),(69,45),(71,45),(72,45),(74,45),(0,46),(1,46),(5,46),(7,46),(10,46),(13,46),(14,46),(15,46),(16,46),(17,46),(18,46),(20,46),(21,46),(22,46),(24,46),(25,46),(26,46),(27,46),(28,46),(29,46),(30,46),(33,46),(34,46),(36,46),(37,46),(38,46),(39,46),(40,46),(41,46),(42,46),(43,46),(44,46),(45,46),(48,46),(49,46),(50,46),(51,46),(52,46),(54,46),(55,46),(57,46),(60,46),(62,46),(64,46),(66,46),(67,46),(71,46),(72,46),(73,46),(1,47),(2,47),(4,47),(5,47),(10,47),(11,47),(12,47),(14,47),(16,47),(19,47),(22,47),(23,47),(25,47),(26,47),(27,47),(28,47),(30,47),(33,47),(34,47),(36,47),(37,47),(39,47),(41,47),(42,47),(43,47),(44,47),(47,47),(50,47),(51,47),(53,47),(54,47),(55,47),(58,47),(60,47),(62,47),(63,47),(64,47),(66,47),(69,47),(71,47),(73,47),(0,48),(1,48),(2,48),(4,48),(5,48),(7,48),(10,48),(11,48),(12,48),(13,48),(14,48),(16,48),(17,48),(23,48),(24,48),(25,48),(26,48),(28,48),(29,48),(30,48),(32,48),(36,48),(37,48),(38,48),(39,48),(40,48),(41,48),(43,48),(46,48),(47,48),(48,48),(49,48),(51,48),(55,48),(58,48),(59,48),(62,48),(63,48),(64,48),(65,48),(67,48),(69,48),(70,48),(72,48),(74,48),(1,49),(2,49),(4,49),(5,49),(6,49),(10,49),(11,49),(12,49),(13,49),(14,49),(17,49),(20,49),(21,49),(22,49),(24,49),(25,49),(27,49),(28,49),(29,49),(30,49),(33,49),(34,49),(35,49),(37,49),(38,49),(39,49),(41,49),(45,49),(46,49),(51,49),(52,49),(53,49),(54,49),(55,49),(58,49),(59,49),(62,49),(63,49),(71,49),(72,49),(85,49),(86,49),(0,50),(2,50),(4,50),(5,50),(6,50),(7,50),(10,50),(12,50),(13,50),(14,50),(15,50),(20,50),(21,50),(24,50),(25,50),(27,50),(28,50),(29,50),(30,50),(34,50),(37,50),(38,50),(39,50),(41,50),(42,50),(43,50),(45,50),(48,50),(49,50),(50,50),(51,50),(52,50),(53,50),(54,50),(55,50),(58,50),(59,50),(60,50),(85,50),(87,50),(109,50),(116,50),(117,50),(118,50),(119,50),(0,51),(1,51),(2,51),(4,51),(5,51),(6,51),(7,51),(12,51),(13,51),(14,51),(15,51),(16,51),(17,51),(18,51),(23,51),(24,51),(25,51),(26,51),(27,51),(28,51),(29,51),(31,51),(32,51),(36,51),(37,51),(38,51),(39,51),(40,51),(41,51),(42,51),(43,51),(47,51),(48,51),(52,51),(58,51),(112,51),(114,51),(117,51),(118,51),(119,51),(5,52),(7,52),(9,52),(10,52),(11,52),(13,52),(14,52),(15,52),(16,52),(17,52),(19,52),(20,52),(21,52),(22,52),(23,52),(24,52),(25,52),(26,52),(27,52),(29,52),(30,52),(31,52),(32,52),(34,52),(35,52),(37,52),(38,52),(40,52),(41,52),(42,52),(43,52),(45,52),(46,52),(50,52),(51,52),(52,52),(53,52),(54,52),(55,52),(56,52),(102,52),(107,52),(108,52),(114,52),(117,52),(118,52),(119,52),(0,53),(3,53),(4,53),(5,53),(7,53),(14,53),(15,53),(16,53),(17,53),(18,53),(19,53),(21,53),(23,53),(24,53),(25,53),(26,53),(28,53),(29,53),(30,53),(31,53),(32,53),(33,53),(35,53),(36,53),(37,53),(38,53),(39,53),(40,53),(43,53),(48,53),(49,53),(50,53),(51,53),(52,53),(105,53),(107,53),(108,53),(112,53),(113,53),(114,53),(115,53),(2,54),(5,54),(7,54),(8,54),(9,54),(15,54),(16,54),(18,54),(19,54),(20,54),(21,54),(22,54),(23,54),(24,54),(25,54),(27,54),(30,54),(31,54),(32,54),(33,54),(34,54),(35,54),(37,54),(38,54),(42,54),(44,54),(45,54),(46,54),(47,54),(48,54),(49,54),(50,54),(51,54),(95,54),(97,54),(98,54),(101,54),(103,54),(106,54),(107,54),(108,54),(109,54),(113,54),(114,54),(115,54),(116,54),(117,54),(118,54),(119,54),(0,55),(1,55),(2,55),(4,55),(5,55),(13,55),(14,55),(16,55),(17,55),(18,55),(19,55),(20,55),(21,55),(22,55),(24,55),(25,55),(27,55),(28,55),(29,55),(30,55),(31,55),(32,55),(33,55),(35,55),(36,55),(40,55),(43,55),(44,55),(46,55),(47,55),(48,55),(49,55),(94,55),(106,55),(107,55),(108,55),(109,55),(111,55),(114,55),(115,55),(4,56),(5,56),(8,56),(13,56),(14,56),(16,56),(17,56),(20,56),(21,56),(22,56),(23,56),(24,56),(25,56),(26,56),(27,56),(29,56),(30,56),(31,56),(34,56),(38,56),(39,56),(41,56),(42,56),(44,56),(45,56),(93,56),(94,56),(97,56),(99,56),(101,56),(102,56),(103,56),(108,56),(111,56),(115,56),(116,56),(117,56),(118,56),(119,56),(0,57),(4,57),(5,57),(11,57),(12,57),(13,57),(14,57),(19,57),(20,57),(21,57),(22,57),(25,57),(26,57),(27,57),(28,57),(29,57),(30,57),(34,57),(35,57),(36,57),(38,57),(39,57),(40,57),(41,57),(91,57),(96,57),(97,57),(98,57),(99,57),(100,57),(101,57),(102,57),(110,57),(116,57),(0,58),(1,58),(2,58),(3,58),(11,58),(14,58),(16,58),(17,58),(18,58),(19,58),(20,58),(21,58),(22,58),(23,58),(24,58),(25,58),(26,58),(27,58),(32,58),(33,58),(34,58),(35,58),(36,58),(37,58),(38,58),(39,58),(40,58),(91,58),(92,58),(95,58),(99,58),(100,58),(101,58),(105,58),(106,58),(107,58),(108,58),(113,58),(114,58),(115,58),(116,58),(117,58),(118,58),(0,59),(1,59),(8,59),(9,59),(13,59),(14,59),(17,59),(18,59),(19,59),(21,59),(22,59),(23,59),(24,59),(25,59),(29,59),(32,59),(33,59),(35,59),(36,59),(89,59),(90,59),(94,59),(95,59),(99,59),(100,59),(101,59),(102,59),(104,59),(110,59),(111,59),(113,59),(114,59),(115,59),(116,59),(2,60),(3,60),(6,60),(7,60),(11,60),(12,60),(13,60),(14,60),(16,60),(17,60),(18,60),(19,60),(20,60),(21,60),(22,60),(24,60),(27,60),(28,60),(29,60),(30,60),(32,60),(33,60),(34,60),(35,60),(89,60),(91,60),(93,60),(94,60),(96,60),(97,60),(98,60),(99,60),(100,60),(101,60),(105,60),(106,60),(110,60),(111,60),(113,60),(114,60),(115,60),(116,60),(117,60),(0,61),(1,61),(2,61),(3,61),(5,61),(9,61),(10,61),(11,61),(12,61),(13,61),(14,61),(17,61),(18,61),(19,61),(20,61),(21,61),(22,61),(27,61),(29,61),(31,61),(33,61),(86,61),(88,61),(89,61),(93,61),(96,61),(97,61),(98,61),(99,61),(100,61),(101,61),(103,61),(105,61),(106,61),(107,61),(109,61),(111,61),(116,61),(117,61),(118,61),(119,61),(1,62),(2,62),(3,62),(5,62),(7,62),(8,62),(9,62),(10,62),(11,62),(12,62),(16,62),(17,62),(18,62),(19,62),(20,62),(24,62),(25,62),(26,62),(28,62),(30,62),(31,62),(32,62),(76,62),(79,62),(83,62),(84,62),(85,62),(86,62),(87,62),(92,62),(93,62),(96,62),(98,62),(105,62),(107,62),(108,62),(109,62),(110,62),(111,62),(112,62),(117,62),(118,62),(119,62),(1,63),(2,63),(3,63),(6,63),(7,63),(8,63),(9,63),(10,63),(14,63),(15,63),(16,63),(18,63),(24,63),(25,63),(26,63),(27,63),(30,63),(70,63),(74,63),(75,63),(76,63),(86,63),(87,63),(88,63),(89,63),(91,63),(93,63),(102,63),(103,63),(105,63),(107,63),(108,63),(109,63),(110,63),(111,63),(112,63),(113,63),(115,63),(118,63),(119,63),(0,64),(2,64),(3,64),(6,64),(7,64),(8,64),(12,64),(13,64),(14,64),(16,64),(17,64),(18,64),(20,64),(22,64),(23,64),(25,64),(26,64),(68,64),(69,64),(70,64),(75,64),(78,64),(83,64),(89,64),(91,64),(92,64),(93,64),(97,64),(98,64),(99,64),(100,64),(103,64),(105,64),(110,64),(111,64),(112,64),(113,64),(114,64),(115,64),(118,64),(119,64),(1,65),(3,65),(5,65),(6,65),(10,65),(11,65),(13,65),(14,65),(15,65),(16,65),(20,65),(21,65),(23,65),(25,65),(26,65),(68,65),(69,65),(75,65),(78,65),(79,65),(80,65),(82,65),(83,65),(84,65),(85,65),(86,65),(93,65),(98,65),(100,65),(105,65),(106,65),(107,65),(108,65),(109,65),(111,65),(112,65),(113,65),(114,65),(115,65),(118,65),(119,65),(3,66),(5,66),(6,66),(9,66),(10,66),(11,66),(12,66),(13,66),(14,66),(18,66),(20,66),(21,66),(24,66),(69,66),(75,66),(78,66),(81,66),(82,66),(83,66),(84,66),(89,66),(90,66),(92,66),(96,66),(97,66),(99,66),(102,66),(106,66),(109,66),(110,66),(113,66),(114,66),(115,66),(119,66),(1,67),(2,67),(3,67),(5,67),(6,67),(8,67),(9,67),(10,67),(12,67),(13,67),(14,67),(15,67),(18,67),(20,67),(68,67),(75,67),(77,67),(80,67),(87,67),(88,67),(90,67),(92,67),(93,67),(96,67),(102,67),(104,67),(105,67),(107,67),(110,67),(111,67),(112,67),(113,67),(114,67),(117,67),(119,67),(2,68),(6,68),(8,68),(10,68),(11,68),(13,68),(17,68),(18,68),(19,68),(20,68),(58,68),(68,68),(69,68),(70,68),(74,68),(79,68),(83,68),(84,68),(90,68),(92,68),(93,68),(96,68),(97,68),(98,68),(99,68),(100,68),(101,68),(102,68),(103,68),(104,68),(105,68),(108,68),(114,68),(115,68),(118,68),(119,68),(5,69),(6,69),(8,69),(9,69),(10,69),(14,69),(16,69),(19,69),(57,69),(58,69),(68,69),(69,69),(70,69),(71,69),(72,69),(74,69),(75,69),(79,69),(80,69),(83,69),(84,69),(90,69),(91,69),(93,69),(96,69),(97,69),(98,69),(99,69),(100,69),(101,69),(102,69),(103,69),(104,69),(105,69),(108,69),(111,69),(113,69),(115,69),(116,69),(117,69),(119,69),(1,70),(2,70),(3,70),(6,70),(8,70),(9,70),(11,70),(12,70),(13,70),(17,70),(18,70),(19,70),(53,70),(54,70),(55,70),(59,70),(69,70),(70,70),(71,70),(72,70),(73,70),(74,70),(75,70),(76,70),(77,70),(78,70),(79,70),(83,70),(84,70),(85,70),(87,70),(88,70),(91,70),(93,70),(97,70),(98,70),(99,70),(100,70),(101,70),(102,70),(103,70),(104,70),(105,70),(107,70),(112,70),(115,70),(116,70),(117,70),(0,71),(1,71),(2,71),(3,71),(5,71),(6,71),(9,71),(10,71),(11,71),(12,71),(16,71),(17,71),(18,71),(46,71),(48,71),(49,71),(50,71),(51,71),(52,71),(53,71),(57,71),(59,71),(69,71),(70,71),(71,71),(72,71),(73,71),(74,71),(75,71),(76,71),(77,71),(78,71),(83,71),(84,71),(85,71),(87,71),(88,71),(95,71),(96,71),(97,71),(98,71),(100,71),(101,71),(102,71),(103,71),(104,71),(105,71),(106,71),(113,71),(115,71),(116,71),(117,71),(119,71),(2,72),(3,72),(5,72),(6,72),(8,72),(9,72),(10,72),(11,72),(12,72),(14,72),(15,72),(17,72),(44,72),(45,72),(46,72),(50,72),(53,72),(56,72),(71,72),(75,72),(76,72),(77,72),(84,72),(85,72),(88,72),(91,72),(92,72),(98,72),(99,72),(100,72),(101,72),(102,72),(103,72),(104,72),(105,72),(108,72),(110,72),(111,72),(112,72),(115,72),(116,72),(117,72),(118,72),(119,72),(0,73),(5,73),(8,73),(9,73),(11,73),(14,73),(15,73),(17,73),(48,73),(50,73),(51,73),(52,73),(53,73),(55,73),(56,73),(70,73),(72,73),(73,73),(74,73),(75,73),(85,73),(86,73),(87,73),(91,73),(92,73),(95,73),(96,73),(104,73),(105,73),(108,73),(109,73),(112,73),(116,73),(117,73),(118,73),(119,73),(5,74),(7,74),(8,74),(9,74),(10,74),(11,74),(14,74),(16,74),(17,74),(18,74),(40,74),(46,74),(47,74),(53,74),(55,74),(56,74),(58,74),(72,74),(74,74),(84,74),(86,74),(89,74),(91,74),(96,74),(97,74),(98,74),(99,74),(100,74),(102,74),(105,74),(107,74),(109,74),(110,74),(111,74),(112,74),(114,74),(117,74),(118,74),(119,74),(4,75),(6,75),(7,75),(8,75),(10,75),(11,75),(12,75),(15,75),(16,75),(18,75),(46,75),(47,75),(48,75),(49,75),(51,75),(53,75),(54,75),(58,75),(70,75),(71,75),(72,75),(73,75),(84,75),(85,75),(86,75),(93,75),(95,75),(97,75),(98,75),(99,75),(100,75),(101,75),(105,75),(107,75),(108,75),(109,75),(110,75),(111,75),(112,75),(114,75),(117,75),(119,75),(4,76),(7,76),(8,76),(9,76),(11,76),(12,76),(13,76),(16,76),(17,76),(18,76),(45,76),(48,76),(49,76),(54,76),(58,76),(59,76),(70,76),(71,76),(72,76),(84,76),(85,76),(94,76),(95,76),(96,76),(100,76),(101,76),(102,76),(103,76),(105,76),(107,76),(108,76),(109,76),(110,76),(111,76),(112,76),(115,76),(117,76),(119,76),(0,77),(2,77),(3,77),(4,77),(5,77),(6,77),(8,77),(9,77),(12,77),(13,77),(17,77),(43,77),(44,77),(45,77),(46,77),(49,77),(50,77),(51,77),(53,77),(54,77),(55,77),(56,77),(70,77),(83,77),(85,77),(95,77),(98,77),(99,77),(102,77),(103,77),(105,77),(106,77),(109,77),(110,77),(111,77),(112,77),(113,77),(115,77),(117,77),(118,77),(119,77),(0,78),(1,78),(2,78),(3,78),(4,78),(5,78),(6,78),(7,78),(16,78),(47,78),(52,78),(54,78),(71,78),(83,78),(84,78),(97,78),(98,78),(99,78),(100,78),(103,78),(106,78),(107,78),(108,78),(110,78),(111,78),(112,78),(113,78),(114,78),(117,78),(118,78),(119,78),(0,79),(1,79),(2,79),(3,79),(4,79),(5,79),(6,79),(12,79),(13,79),(14,79),(16,79),(17,79),(18,79),(51,79),(52,79),(53,79),(59,79),(70,79),(71,79),(72,79),(82,79),(83,79),(85,79),(86,79),(96,79),(99,79),(100,79),(101,79),(104,79),(108,79),(109,79),(110,79),(113,79),(114,79),(117,79),(118,79),(119,79),(0,80),(1,80),(2,80),(3,80),(4,80),(5,80),(6,80),(8,80),(11,80),(13,80),(17,80),(18,80),(19,80),(53,80),(59,80),(70,80),(72,80),(82,80),(83,80),(84,80),(95,80),(96,80),(97,80),(100,80),(101,80),(104,80),(105,80),(106,80),(110,80),(111,80),(112,80),(113,80),(114,80),(117,80),(118,80),(119,80),(0,81),(1,81),(2,81),(3,81),(4,81),(5,81),(6,81),(8,81),(10,81),(11,81),(12,81),(16,81),(17,81),(18,81),(19,81),(56,81),(58,81),(59,81),(70,81),(72,81),(78,81),(80,81),(81,81),(83,81),(84,81),(85,81),(86,81),(87,81),(97,81),(98,81),(99,81),(102,81),(105,81),(106,81),(107,81),(108,81),(112,81),(113,81),(117,81),(118,81),(119,81),(0,82),(10,82),(12,82),(18,82),(19,82),(20,82),(70,82),(72,82),(73,82),(74,82),(75,82),(77,82),(78,82),(80,82),(81,82),(82,82),(83,82),(85,82),(86,82),(88,82),(89,82),(90,82),(97,82),(98,82),(99,82),(100,82),(101,82),(103,82),(105,82),(108,82),(110,82),(112,82),(113,82),(117,82),(118,82),(119,82),(8,83),(11,83),(13,83),(14,83),(15,83),(18,83),(20,83),(70,83),(71,83),(72,83),(73,83),(75,83),(76,83),(77,83),(78,83),(79,83),(80,83),(81,83),(82,83),(83,83),(84,83),(85,83),(86,83),(89,83),(91,83),(92,83),(94,83),(96,83),(97,83),(98,83),(99,83),(101,83),(102,83),(105,83),(106,83),(108,83),(109,83),(110,83),(112,83),(113,83),(115,83),(8,84),(15,84),(16,84),(19,84),(21,84),(68,84),(69,84),(70,84),(71,84),(79,84),(81,84),(82,84),(90,84),(92,84),(94,84),(96,84),(97,84),(98,84),(101,84),(102,84),(103,84),(104,84),(106,84),(110,84),(112,84),(113,84),(116,84),(118,84),(119,84),(8,85),(10,85),(11,85),(13,85),(14,85),(17,85),(20,85),(21,85),(22,85),(23,85),(68,85),(69,85),(75,85),(76,85),(78,85),(79,85),(80,85),(81,85),(90,85),(91,85),(93,85),(95,85),(96,85),(97,85),(100,85),(101,85),(103,85),(104,85),(107,85),(108,85),(109,85),(110,85),(112,85),(113,85),(114,85),(118,85),(8,86),(9,86),(10,86),(12,86),(16,86),(17,86),(18,86),(22,86),(24,86),(25,86),(67,86),(68,86),(72,86),(75,86),(78,86),(79,86),(80,86),(90,86),(91,86),(93,86),(94,86),(95,86),(97,86),(98,86),(99,86),(101,86),(102,86),(104,86),(105,86),(106,86),(108,86),(109,86),(110,86),(112,86),(113,86),(114,86),(115,86),(8,87),(10,87),(12,87),(17,87),(18,87),(19,87),(26,87),(27,87),(67,87),(68,87),(70,87),(71,87),(72,87),(73,87),(78,87),(79,87),(89,87),(91,87),(92,87),(93,87),(94,87),(95,87),(99,87),(101,87),(103,87),(104,87),(108,87),(109,87),(110,87),(112,87),(113,87),(114,87),(115,87),(8,88),(9,88),(13,88),(15,88),(16,88),(17,88),(18,88),(20,88),(21,88),(24,88),(28,88),(67,88),(68,88),(70,88),(71,88),(72,88),(73,88),(74,88),(77,88),(78,88),(89,88),(91,88),(92,88),(93,88),(100,88),(101,88),(102,88),(104,88),(106,88),(109,88),(110,88),(113,88),(114,88),(115,88),(116,88),(119,88),(8,89),(9,89),(11,89),(15,89),(16,89),(18,89),(19,89),(20,89),(21,89),(22,89),(23,89),(25,89),(26,89),(29,89),(30,89),(31,89),(67,89),(68,89),(70,89),(71,89),(72,89),(73,89),(74,89),(75,89),(88,89),(91,89),(92,89),(101,89),(103,89),(105,89),(106,89),(109,89),(110,89),(111,89),(114,89),(115,89),(116,89),(9,90),(11,90),(12,90),(15,90),(16,90),(17,90),(18,90),(19,90),(21,90),(23,90),(25,90),(26,90),(29,90),(30,90),(31,90),(32,90),(33,90),(35,90),(36,90),(37,90),(70,90),(71,90),(72,90),(73,90),(74,90),(75,90),(77,90),(89,90),(90,90),(91,90),(92,90),(101,90),(102,90),(103,90),(104,90),(105,90),(108,90),(110,90),(111,90),(112,90),(116,90),(117,90),(118,90),(8,91),(10,91),(14,91),(18,91),(20,91),(21,91),(23,91),(25,91),(28,91),(30,91),(31,91),(32,91),(33,91),(35,91),(36,91),(37,91),(38,91),(39,91),(40,91),(41,91),(42,91),(69,91),(71,91),(72,91),(73,91),(74,91),(75,91),(78,91),(80,91),(84,91),(86,91),(92,91),(102,91),(107,91),(108,91),(109,91),(110,91),(111,91),(112,91),(113,91),(114,91),(118,91),(119,91),(9,92),(10,92),(11,92),(12,92),(13,92),(14,92),(15,92),(19,92),(20,92),(24,92),(28,92),(29,92),(37,92),(39,92),(71,92),(72,92),(73,92),(74,92),(75,92),(76,92),(78,92),(79,92),(80,92),(81,92),(82,92),(83,92),(84,92),(85,92),(86,92),(88,92),(89,92),(90,92),(94,92),(95,92),(101,92),(104,92),(105,92),(106,92),(107,92),(108,92),(109,92),(110,92),(111,92),(112,92),(113,92),(114,92),(115,92),(116,92),(9,93),(10,93),(11,93),(12,93),(13,93),(15,93),(17,93),(20,93),(21,93),(22,93),(27,93),(28,93),(31,93),(32,93),(33,93),(34,93),(38,93),(41,93),(42,93),(47,93),(69,93),(72,93),(73,93),(75,93),(76,93),(85,93),(88,93),(89,93),(90,93),(93,93),(95,93),(101,93),(103,93),(104,93),(105,93),(106,93),(107,93),(108,93),(109,93),(110,93),(111,93),(112,93),(113,93),(118,93),(9,94),(10,94),(11,94),(13,94),(14,94),(15,94),(17,94),(18,94),(19,94),(21,94),(22,94),(23,94),(24,94),(27,94),(28,94),(30,94),(31,94),(32,94),(33,94),(34,94),(35,94),(36,94),(38,94),(41,94),(44,94),(48,94),(49,94),(69,94),(73,94),(74,94),(75,94),(78,94),(79,94),(80,94),(82,94),(87,94),(93,94),(94,94),(95,94),(96,94),(101,94),(102,94),(104,94),(105,94),(107,94),(108,94),(109,94),(111,94),(112,94),(115,94),(116,94),(117,94),(118,94),(119,94),(9,95),(10,95),(11,95),(12,95),(13,95),(14,95),(15,95),(16,95),(17,95),(18,95),(19,95),(26,95),(27,95),(30,95),(31,95),(32,95),(33,95),(34,95),(35,95),(36,95),(41,95),(42,95),(46,95),(48,95),(49,95),(69,95),(73,95),(74,95),(75,95),(76,95),(79,95),(80,95),(81,95),(82,95),(85,95),(86,95),(91,95),(92,95),(93,95),(94,95),(95,95),(96,95),(101,95),(102,95),(105,95),(106,95),(108,95),(109,95),(111,95),(114,95),(115,95),(116,95),(117,95),(118,95),(119,95),(9,96),(10,96),(11,96),(12,96),(13,96),(14,96),(15,96),(16,96),(17,96),(19,96),(21,96),(22,96),(24,96),(25,96),(26,96),(27,96),(28,96),(39,96),(40,96),(44,96),(45,96),(48,96),(49,96),(69,96),(70,96),(76,96),(77,96),(78,96),(79,96),(81,96),(83,96),(84,96),(89,96),(90,96),(91,96),(92,96),(93,96),(94,96),(95,96),(96,96),(102,96),(103,96),(104,96),(114,96),(115,96),(116,96),(117,96),(118,96),(119,96),(9,97),(10,97),(11,97),(12,97),(13,97),(14,97),(15,97),(16,97),(17,97),(18,97),(19,97),(20,97),(21,97),(22,97),(23,97),(24,97),(25,97),(26,97),(27,97),(28,97),(31,97),(35,97),(38,97),(39,97),(40,97),(41,97),(42,97),(43,97),(49,97),(69,97),(70,97),(73,97),(74,97),(79,97),(82,97),(86,97),(87,97),(88,97),(89,97),(90,97),(91,97),(92,97),(93,97),(94,97),(95,97),(96,97),(101,97),(102,97),(104,97),(105,97),(106,97),(107,97),(108,97),(109,97),(110,97),(112,97),(113,97),(114,97),(115,97),(116,97),(117,97),(118,97),(119,97),(9,98),(10,98),(11,98),(12,98),(13,98),(14,98),(15,98),(16,98),(17,98),(18,98),(19,98),(20,98),(21,98),(22,98),(23,98),(24,98),(25,98),(26,98),(27,98),(28,98),(31,98),(33,98),(34,98),(35,98),(38,98),(39,98),(40,98),(41,98),(42,98),(43,98),(44,98),(46,98),(47,98),(49,98),(70,98),(71,98),(73,98),(74,98),(76,98),(77,98),(78,98),(80,98),(82,98),(83,98),(85,98),(86,98),(87,98),(88,98),(89,98),(90,98),(91,98),(92,98),(93,98),(95,98),(96,98),(101,98),(102,98),(103,98),(104,98),(105,98),(106,98),(107,98),(108,98),(109,98),(111,98),(112,98),(113,98),(114,98),(115,98),(116,98),(117,98),(118,98),(119,98),(10,99),(11,99),(12,99),(13,99),(14,99),(15,99),(16,99),(17,99),(18,99),(19,99),(20,99),(21,99),(22,99),(23,99),(24,99),(25,99),(26,99),(27,99),(29,99),(30,99),(31,99),(32,99),(33,99),(34,99),(35,99),(36,99),(37,99),(38,99),(39,99),(40,99),(41,99),(42,99),(43,99),(44,99),(45,99),(46,99),(47,99),(48,99),(69,99),(70,99),(71,99),(72,99),(73,99),(74,99),(75,99),(76,99),(77,99),(78,99),(79,99),(80,99),(81,99),(82,99),(83,99),(84,99),(85,99),(86,99),(87,99),(88,99),(89,99),(90,99),(91,99),(92,99),(101,99),(102,99),(103,99),(104,99),(105,99),(106,99),(107,99),(108,99),(109,99),(110,99),(111,99),(112,99),(113,99),(114,99),(115,99),(116,99),(117,99),(11,100),(12,100),(13,100),(14,100),(15,100),(16,100),(17,100),(18,100),(19,100),(20,100),(21,100),(22,100),(23,100),(24,100),(25,100),(26,100),(27,100),(28,100),(29,100),(30,100),(31,100),(32,100),(33,100),(34,100),(35,100),(36,100),(37,100),(38,100),(39,100),(40,100),(41,100),(42,100),(43,100),(44,100),(45,100),(46,100),(47,100),(48,100),(49,100),(70,100),(71,100),(72,100),(73,100),(74,100),(75,100),(76,100),(77,100),(78,100),(79,100),(80,100),(81,100),(82,100),(83,100),(84,100),(85,100),(86,100),(87,100),(88,100),(89,100),(90,100),(91,100),(101,100),(102,100),(103,100),(104,100),(105,100),(106,100),(107,100),(108,100),(109,100),(110,100),(111,100),(112,100),(113,100),(114,100),(115,100),(116,100),(12,101),(13,101),(14,101),(15,101),(16,101),(17,101),(18,101),(19,101),(20,101),(21,101),(22,101),(23,101),(24,101),(25,101),(26,101),(27,101),(28,101),(29,101),(30,101),(31,101),(32,101),(33,101),(34,101),(35,101),(36,101),(37,101),(38,101),(39,101),(40,101),(41,101),(42,101),(43,101),(44,101),(45,101),(46,101),(47,101),(48,101),(70,101),(71,101),(72,101),(73,101),(74,101),(75,101),(76,101),(77,101),(78,101),(79,101),(80,101),(81,101),(82,101),(83,101),(84,101),(85,101),(86,101),(87,101),(88,101),(89,101),(90,101),(91,101),(92,101),(94,101),(95,101),(98,101),(99,101),(100,101),(101,101),(102,101),(103,101),(104,101),(105,101),(106,101),(107,101),(108,101),(109,101),(110,101),(111,101),(112,101),(113,101),(114,101),(115,101),(13,102),(14,102),(15,102),(16,102),(17,102),(18,102),(19,102),(20,102),(21,102),(22,102),(23,102),(24,102),(25,102),(26,102),(27,102),(28,102),(29,102),(30,102),(31,102),(32,102),(33,102),(34,102),(35,102),(36,102),(37,102),(38,102),(39,102),(40,102),(41,102),(42,102),(43,102),(44,102),(45,102),(46,102),(47,102),(48,102),(70,102),(71,102),(72,102),(73,102),(74,102),(75,102),(76,102),(77,102),(78,102),(79,102),(80,102),(81,102),(82,102),(83,102),(84,102),(85,102),(86,102),(87,102),(88,102),(89,102),(90,102),(91,102),(92,102),(96,102),(97,102),(98,102),(99,102),(100,102),(101,102),(102,102),(103,102),(104,102),(105,102),(106,102),(107,102),(108,102),(109,102),(110,102),(111,102),(112,102),(113,102),(114,102),(115,102),(26,103),(27,103),(28,103),(29,103),(30,103),(31,103),(32,103),(33,103),(34,103),(35,103),(36,103),(37,103),(38,103),(39,103),(40,103),(41,103),(42,103),(43,103),(44,103),(45,103),(46,103),(47,103),(48,103),(70,103),(71,103),(72,103),(73,103),(74,103),(75,103),(76,103),(77,103),(78,103),(79,103),(80,103),(81,103),(82,103),(83,103),(84,103),(85,103),(86,103),(87,103),(88,103),(89,103),(108,103),(109,103),(110,103),(111,103),(112,103),(113,103),(114,103),(26,104),(27,104),(28,104),(29,104),(30,104),(31,104),(32,104),(33,104),(34,104),(35,104),(36,104),(37,104),(38,104),(39,104),(40,104),(41,104),(42,104),(43,104),(44,104),(45,104),(46,104),(47,104),(48,104),(70,104),(71,104),(72,104),(73,104),(74,104),(75,104),(76,104),(77,104),(78,104),(79,104),(80,104),(81,104),(82,104),(83,104),(84,104),(85,104),(86,104),(87,104),(88,104),(89,104),(107,104),(108,104),(109,104),(110,104),(111,104),(112,104),(113,104),(26,105),(27,105),(28,105),(29,105),(30,105),(31,105),(32,105),(33,105),(34,105),(35,105),(36,105),(45,105),(46,105),(47,105),(48,105),(70,105),(71,105),(72,105),(73,105),(74,105),(75,105),(76,105),(77,105),(78,105),(79,105),(80,105),(81,105),(82,105),(83,105),(84,105),(85,105),(109,105),(110,105),(111,105),(27,106),(28,106),(29,106),(30,106),(31,106),(32,106),(33,106),(34,106),(35,106),(36,106),(46,106),(47,106),(48,106),(70,106),(71,106),(72,106),(73,106),(74,106),(75,106),(76,106),(77,106),(78,106),(79,106),(80,106),(81,106),(82,106),(83,106),(84,106),(85,106),(110,106)}
location.alwaysFront = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(42,0),(43,0),(44,0),(62,0),(63,0),(64,0),(77,0),(78,0),(84,0),(85,0),(86,0),(90,0),(91,0),(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(53,1),(54,1),(55,1),(62,1),(63,1),(64,1),(84,1),(85,1),(86,1),(0,2),(1,2),(2,2),(3,2),(4,2),(5,2),(6,2),(7,2),(8,2),(9,2),(10,2),(11,2),(12,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(29,2),(30,2),(31,2),(53,2),(54,2),(55,2),(79,2),(80,2),(81,2),(82,2),(83,2),(84,2),(85,2),(86,2),(87,2),(88,2),(89,2),(94,2),(96,2),(97,2),(98,2),(101,2),(102,2),(103,2),(104,2),(105,2),(106,2),(111,2),(112,2),(113,2),(114,2),(115,2),(116,2),(117,2),(118,2),(119,2),(0,3),(1,3),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(8,3),(9,3),(10,3),(11,3),(12,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(29,3),(30,3),(31,3),(38,3),(39,3),(40,3),(41,3),(53,3),(54,3),(55,3),(79,3),(80,3),(81,3),(82,3),(83,3),(84,3),(85,3),(86,3),(87,3),(88,3),(89,3),(94,3),(96,3),(97,3),(98,3),(101,3),(102,3),(103,3),(104,3),(105,3),(106,3),(111,3),(112,3),(113,3),(114,3),(115,3),(116,3),(117,3),(118,3),(119,3),(5,4),(6,4),(7,4),(8,4),(9,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(29,4),(30,4),(31,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(53,4),(54,4),(55,4),(79,4),(80,4),(81,4),(82,4),(83,4),(84,4),(85,4),(87,4),(88,4),(89,4),(94,4),(96,4),(97,4),(98,4),(101,4),(102,4),(103,4),(104,4),(105,4),(106,4),(111,4),(112,4),(113,4),(114,4),(115,4),(116,4),(117,4),(118,4),(119,4),(6,5),(7,5),(8,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(18,5),(19,5),(20,5),(21,5),(29,5),(30,5),(31,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(53,5),(54,5),(55,5),(79,5),(80,5),(81,5),(82,5),(83,5),(84,5),(87,5),(88,5),(89,5),(94,5),(96,5),(97,5),(98,5),(101,5),(102,5),(103,5),(104,5),(105,5),(106,5),(111,5),(112,5),(113,5),(114,5),(115,5),(116,5),(117,5),(118,5),(119,5),(7,6),(8,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(42,6),(43,6),(81,6),(82,6),(93,6),(103,6),(104,6),(0,7),(36,7),(37,7),(38,7),(39,7),(40,7),(41,7),(42,7),(43,7),(81,7),(82,7),(83,7),(93,7),(94,7),(95,7),(96,7),(97,7),(98,7),(99,7),(100,7),(101,7),(102,7),(106,7),(107,7),(108,7),(0,8),(81,8),(82,8),(83,8),(93,8),(94,8),(95,8),(96,8),(97,8),(98,8),(99,8),(100,8),(101,8),(102,8),(103,8),(104,8),(105,8),(106,8),(107,8),(108,8),(0,9),(81,9),(82,9),(83,9),(86,9),(88,9),(93,9),(94,9),(95,9),(96,9),(97,9),(98,9),(99,9),(100,9),(101,9),(102,9),(103,9),(104,9),(105,9),(106,9),(107,9),(108,9),(111,9),(112,9),(114,9),(115,9),(116,9),(117,9),(118,9),(119,9),(0,10),(85,10),(86,10),(87,10),(88,10),(89,10),(90,10),(91,10),(92,10),(117,10),(118,10),(119,10),(0,11),(1,11),(2,11),(85,11),(86,11),(87,11),(88,11),(89,11),(90,11),(91,11),(100,11),(117,11),(118,11),(119,11),(0,12),(1,12),(2,12),(85,12),(86,12),(87,12),(88,12),(89,12),(90,12),(91,12),(100,12),(117,12),(118,12),(119,12),(0,13),(1,13),(2,13),(100,13),(101,13),(117,13),(118,13),(119,13),(0,14),(1,14),(2,14),(100,14),(109,14),(110,14),(111,14),(112,14),(113,14),(114,14),(1,15),(4,15),(5,15),(6,15),(7,15),(109,15),(110,15),(111,15),(112,15),(113,15),(114,15),(4,16),(5,16),(6,16),(104,16),(105,16),(106,16),(109,16),(110,16),(111,16),(112,16),(113,16),(114,16),(0,17),(4,17),(5,17),(6,17),(7,17),(104,17),(105,17),(106,17),(109,17),(110,17),(111,17),(112,17),(113,17),(114,17),(0,18),(4,18),(5,18),(6,18),(7,18),(104,18),(105,18),(106,18),(0,19),(4,19),(5,19),(6,19),(7,19),(104,19),(105,19),(106,19),(0,20),(4,20),(5,20),(6,20),(7,20),(105,20),(4,21),(5,21),(6,21),(7,21),(4,22),(5,22),(6,22),(7,22),(117,25),(118,25),(119,25),(110,26),(111,26),(112,26),(117,26),(118,26),(119,26),(101,27),(102,27),(103,27),(104,27),(105,27),(106,27),(107,27),(108,27),(110,27),(111,27),(112,27),(117,27),(118,27),(119,27),(101,28),(102,28),(105,28),(110,28),(111,28),(112,28),(117,28),(118,28),(119,28),(13,29),(14,29),(15,29),(109,29),(110,29),(111,29),(112,29),(117,29),(118,29),(119,29),(0,30),(1,30),(2,30),(13,30),(14,30),(15,30),(0,31),(1,31),(2,31),(13,31),(14,31),(15,31),(0,32),(1,32),(2,32),(13,32),(14,32),(15,32),(0,33),(1,33),(2,33),(13,33),(14,33),(15,33),(0,34),(0,35),(0,36),(0,37),(1,37),(2,37),(0,38),(1,38),(2,38),(0,39),(1,39),(2,39),(0,40),(1,40),(2,40),(5,42),(6,42),(7,42),(8,42),(110,45),(111,45),(112,45),(113,45),(114,45),(115,45),(0,46),(1,46),(110,46),(111,46),(112,46),(113,46),(114,46),(115,46),(0,47),(1,47),(110,47),(111,47),(112,47),(113,47),(114,47),(115,47),(0,48),(1,48),(110,48),(111,48),(112,48),(113,48),(114,48),(115,48),(0,49),(1,49),(100,49),(101,49),(102,49),(107,49),(108,49),(109,49),(0,50),(1,50),(6,50),(7,50),(8,50),(9,50),(10,50),(11,50),(100,50),(101,50),(102,50),(107,50),(108,50),(109,50),(0,51),(1,51),(6,51),(7,51),(8,51),(9,51),(10,51),(11,51),(100,51),(101,51),(102,51),(107,51),(108,51),(109,51),(6,52),(7,52),(8,52),(9,52),(10,52),(11,52),(100,52),(101,52),(102,52),(107,52),(108,52),(109,52),(6,53),(7,53),(8,53),(9,53),(10,53),(11,53),(107,53),(108,53),(117,54),(118,54),(119,54),(106,55),(107,55),(108,55),(117,55),(118,55),(119,55),(101,56),(106,56),(107,56),(108,56),(114,56),(115,56),(116,56),(117,56),(118,56),(119,56),(106,57),(107,57),(108,57),(114,57),(115,57),(116,57),(117,57),(118,57),(119,57),(94,58),(95,58),(96,58),(97,58),(98,58),(99,58),(100,58),(101,58),(102,58),(106,58),(107,58),(108,58),(114,58),(115,58),(116,58),(94,59),(95,59),(96,59),(97,59),(98,59),(99,59),(100,59),(101,59),(102,59),(114,59),(115,59),(116,59),(2,60),(3,60),(4,60),(94,60),(95,60),(96,60),(97,60),(98,60),(99,60),(100,60),(101,60),(102,60),(2,61),(3,61),(4,61),(94,61),(95,61),(96,61),(97,61),(98,61),(99,61),(100,61),(101,61),(102,61),(117,61),(118,61),(119,61),(2,62),(3,62),(4,62),(98,62),(99,62),(100,62),(117,62),(118,62),(119,62),(0,63),(1,63),(2,63),(3,63),(4,63),(98,63),(99,63),(100,63),(117,63),(118,63),(119,63),(0,64),(1,64),(2,64),(3,64),(4,64),(98,64),(99,64),(100,64),(117,64),(118,64),(119,64),(0,65),(1,65),(2,65),(3,65),(4,65),(98,65),(99,65),(100,65),(108,65),(109,65),(110,65),(111,65),(112,65),(113,65),(0,66),(1,66),(108,66),(109,66),(110,66),(111,66),(112,66),(113,66),(105,67),(106,67),(107,67),(108,67),(109,67),(110,67),(111,67),(112,67),(113,67),(1,68),(2,68),(3,68),(105,68),(106,68),(107,68),(108,68),(109,68),(110,68),(111,68),(112,68),(113,68),(119,68),(1,69),(2,69),(3,69),(105,69),(106,69),(107,69),(119,69),(105,70),(106,70),(107,70),(119,70),(113,71),(114,71),(115,71),(119,71),(113,72),(114,72),(115,72),(113,73),(114,73),(115,73),(113,74),(114,74),(115,74),(114,78),(115,78),(116,78),(117,78),(118,78),(119,78),(114,79),(115,79),(116,79),(117,79),(118,79),(119,79),(114,80),(115,80),(116,80),(117,80),(118,80),(119,80),(114,81),(115,81),(116,81),(117,81),(118,81),(119,81),(118,87),(33,88),(34,88),(35,88),(32,89),(33,89),(34,89),(35,89),(36,89),(32,90),(33,90),(34,90),(35,90),(36,90),(32,91),(33,91),(34,91),(35,91),(36,91),(30,92),(31,92),(32,92),(33,92),(34,92),(35,92),(36,92)}
location.front = {(27,0),(28,0),(29,0),(32,0),(33,0),(34,0),(36,0),(37,0),(38,0),(40,0),(41,0),(43,0),(46,0),(49,0),(50,0),(51,0),(55,0),(65,0),(80,0),(81,0),(82,0),(93,0),(94,0),(95,0),(109,0),(110,0),(111,0),(117,0),(118,0),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(39,1),(43,1),(44,1),(45,1),(52,1),(62,1),(76,1),(79,1),(83,1),(87,1),(88,1),(89,1),(25,2),(26,2),(27,2),(34,2),(35,2),(42,2),(44,2),(45,2),(59,2),(60,2),(61,2),(63,2),(88,2),(89,2),(115,2),(116,2),(27,3),(28,3),(34,3),(35,3),(43,3),(47,3),(49,3),(50,3),(51,3),(56,3),(57,3),(60,3),(61,3),(63,3),(64,3),(65,3),(84,3),(90,3),(115,3),(116,3),(0,4),(1,4),(2,4),(23,4),(26,4),(27,4),(28,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(52,4),(56,4),(57,4),(61,4),(62,4),(63,4),(66,4),(24,5),(26,5),(27,5),(28,5),(47,5),(48,5),(57,5),(58,5),(59,5),(60,5),(87,5),(88,5),(89,5),(96,5),(97,5),(98,5),(99,5),(100,5),(101,5),(117,5),(118,5),(119,5),(8,6),(16,6),(17,6),(19,6),(21,6),(22,6),(30,6),(31,6),(49,6),(51,6),(52,6),(60,6),(64,6),(65,6),(84,6),(85,6),(86,6),(87,6),(88,6),(96,6),(97,6),(98,6),(113,6),(114,6),(118,6),(0,7),(15,7),(16,7),(17,7),(20,7),(51,7),(52,7),(53,7),(58,7),(65,7),(85,7),(86,7),(90,7),(116,7),(117,7),(0,8),(1,8),(14,8),(15,8),(16,8),(17,8),(18,8),(19,8),(20,8),(21,8),(22,8),(23,8),(24,8),(25,8),(26,8),(27,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(39,8),(40,8),(46,8),(47,8),(48,8),(49,8),(50,8),(51,8),(52,8),(53,8),(54,8),(55,8),(56,8),(57,8),(58,8),(59,8),(60,8),(61,8),(62,8),(63,8),(64,8),(65,8),(87,8),(101,8),(0,9),(1,9),(2,9),(3,9),(87,9),(94,9),(95,9),(96,9),(97,9),(98,9),(99,9),(100,9),(101,9),(0,10),(1,10),(2,10),(3,10),(65,10),(81,10),(82,10),(83,10),(86,10),(92,10),(93,10),(103,10),(104,10),(105,10),(106,10),(108,10),(0,11),(1,11),(2,11),(3,11),(81,11),(82,11),(83,11),(85,11),(86,11),(87,11),(88,11),(89,11),(90,11),(91,11),(92,11),(95,11),(102,11),(103,11),(104,11),(2,12),(81,12),(82,12),(83,12),(85,12),(86,12),(87,12),(88,12),(89,12),(90,12),(91,12),(92,12),(94,12),(95,12),(101,12),(102,12),(104,12),(86,13),(88,13),(92,13),(95,13),(101,13),(102,13),(3,14),(4,14),(5,14),(6,14),(83,14),(84,14),(88,14),(89,14),(95,14),(102,14),(108,14),(109,14),(110,14),(4,15),(5,15),(6,15),(7,15),(85,15),(86,15),(87,15),(88,15),(91,15),(92,15),(93,15),(94,15),(95,15),(101,15),(102,15),(117,15),(118,15),(0,16),(2,16),(5,16),(6,16),(92,16),(104,16),(105,16),(106,16),(117,16),(118,16),(2,17),(3,17),(4,17),(6,17),(7,17),(8,17),(92,17),(104,17),(105,17),(106,17),(114,17),(115,17),(2,18),(3,18),(4,18),(7,18),(8,18),(9,18),(104,18),(105,18),(106,18),(111,18),(112,18),(2,19),(3,19),(4,19),(8,19),(9,19),(104,19),(105,19),(106,19),(113,19),(114,19),(115,19),(0,20),(2,20),(3,20),(4,20),(9,20),(94,20),(95,20),(105,20),(109,20),(110,20),(1,21),(2,21),(3,21),(94,21),(95,21),(96,21),(97,21),(98,21),(99,21),(100,21),(101,21),(102,21),(103,21),(104,21),(105,21),(106,21),(107,21),(108,21),(109,21),(110,21),(111,21),(112,21),(113,21),(114,21),(115,21),(116,21),(117,21),(118,21),(119,21),(0,22),(1,22),(2,22),(0,23),(1,23),(2,23),(4,23),(5,23),(6,23),(7,23),(106,23),(109,23),(0,24),(1,24),(2,24),(4,24),(9,24),(10,24),(0,25),(1,25),(2,25),(3,25),(4,25),(8,25),(9,25),(10,25),(11,25),(2,26),(3,26),(4,26),(7,26),(10,26),(11,26),(12,26),(13,26),(9,27),(10,27),(11,27),(12,27),(13,27),(104,27),(105,27),(106,27),(107,27),(108,27),(109,27),(110,27),(111,27),(112,27),(113,27),(114,27),(115,27),(116,27),(117,27),(118,27),(119,27),(1,28),(2,28),(13,28),(14,28),(101,28),(102,28),(103,28),(104,28),(106,28),(107,28),(108,28),(115,28),(116,28),(8,29),(10,29),(11,29),(12,29),(14,29),(15,29),(101,29),(102,29),(103,29),(104,29),(105,29),(106,29),(107,29),(108,29),(109,29),(113,29),(114,29),(115,29),(11,30),(12,30),(15,30),(16,30),(101,30),(102,30),(103,30),(104,30),(105,30),(109,30),(111,30),(109,31),(110,31),(111,31),(112,31),(113,31),(114,31),(115,31),(116,31),(117,31),(118,31),(119,31),(13,33),(107,33),(15,34),(0,37),(1,38),(2,38),(1,39),(2,39),(3,39),(2,40),(3,40),(4,40),(1,41),(2,41),(3,41),(4,41),(5,41),(6,41),(7,41),(8,41),(9,41),(3,42),(4,42),(5,42),(6,42),(7,42),(8,42),(9,42),(0,43),(1,43),(3,43),(4,43),(9,43),(2,44),(0,45),(1,45),(2,45),(3,45),(4,45),(7,45),(106,45),(107,45),(108,45),(0,46),(1,46),(2,46),(5,46),(106,46),(107,46),(108,46),(0,47),(1,47),(2,47),(102,47),(103,47),(104,47),(106,47),(107,47),(108,47),(102,48),(103,48),(104,48),(106,48),(107,48),(108,48),(102,49),(103,49),(104,49),(107,49),(110,49),(111,49),(112,49),(113,49),(114,49),(115,49),(116,49),(117,49),(118,49),(119,49),(5,50),(9,50),(10,50),(102,50),(103,50),(104,50),(107,50),(118,50),(6,51),(8,51),(9,51),(10,51),(11,51),(12,51),(102,51),(103,51),(104,51),(109,51),(116,51),(117,51),(118,51),(2,52),(3,52),(9,52),(10,52),(11,52),(12,52),(13,52),(100,52),(102,52),(103,52),(104,52),(108,52),(109,52),(113,52),(114,52),(116,52),(117,52),(118,52),(2,53),(3,53),(10,53),(11,53),(12,53),(13,53),(14,53),(101,53),(107,53),(108,53),(109,53),(111,53),(112,53),(113,53),(114,53),(7,54),(8,54),(9,54),(11,54),(12,54),(13,54),(14,54),(106,54),(107,54),(108,54),(109,54),(113,54),(114,54),(115,54),(116,54),(117,54),(118,54),(119,54),(10,55),(11,55),(12,55),(14,55),(102,55),(104,55),(105,55),(106,55),(107,55),(108,55),(109,55),(112,55),(113,55),(114,55),(115,55),(116,55),(117,55),(118,55),(119,55),(11,56),(100,56),(101,56),(102,56),(103,56),(104,56),(105,56),(106,56),(107,56),(108,56),(109,56),(111,56),(112,56),(113,56),(6,57),(7,57),(8,57),(99,57),(100,57),(101,57),(103,57),(104,57),(110,57),(111,57),(112,57),(113,57),(5,58),(6,58),(7,58),(96,58),(97,58),(98,58),(99,58),(100,58),(105,58),(106,58),(107,58),(108,58),(109,58),(110,58),(111,58),(118,58),(95,59),(96,59),(97,59),(98,59),(99,59),(100,59),(106,59),(107,59),(108,59),(109,59),(110,59),(111,59),(97,60),(98,60),(99,60),(100,60),(115,60),(1,61),(97,61),(98,61),(99,61),(106,61),(109,61),(111,61),(96,62),(97,62),(101,62),(110,62),(113,62),(114,62),(1,63),(6,63),(103,63),(113,63),(114,63),(4,64),(5,64),(6,64),(2,65),(6,65),(118,65),(99,66),(101,66),(102,66),(103,66),(104,66),(1,67),(2,67),(3,67),(6,67),(101,67),(102,67),(114,68),(0,69),(110,69),(111,69),(117,69),(118,69),(109,70),(112,70),(113,70),(117,70),(118,70),(106,71),(107,71),(108,71),(112,71),(113,71),(107,72),(108,72),(111,72),(112,72),(116,73),(118,73),(119,73),(118,74),(119,74),(114,75),(0,78),(1,78),(1,79),(0,80),(1,80),(114,80),(115,80),(1,81),(0,82),(1,82),(72,82),(116,82),(117,82),(0,83),(1,83),(3,83),(67,83),(118,83),(119,83),(0,84),(1,84),(118,84),(119,84),(0,85),(1,85),(118,85),(119,85),(66,86),(32,91),(33,91),(34,91),(35,91),(36,91),(32,92),(33,92),(34,92),(35,92),(36,92),(30,93),(31,93),(32,93),(33,93),(34,93),(35,93),(36,93),(119,93),(97,94),(100,94),(119,94),(117,95),(119,95),(93,96),(94,96),(100,96),(117,96),(119,96),(37,97),(73,97),(91,97),(94,97),(115,97),(117,97),(119,97),(91,98),(101,98),(115,98),(117,98),(119,98),(17,99),(38,99),(87,99),(91,99),(92,99),(100,99),(105,99),(113,99),(115,99),(117,99),(119,99),(17,100),(20,100),(38,100),(41,100),(87,100),(91,100),(100,100),(113,100),(115,100),(117,100),(17,101),(23,101),(24,101),(30,101),(38,101),(43,101),(45,101),(74,101),(87,101),(90,101),(91,101),(92,101),(100,101),(103,101),(107,101),(108,101),(113,101),(115,101),(17,102),(19,102),(24,102),(34,102),(36,102),(38,102),(40,102),(43,102),(47,102),(49,102),(82,102),(85,102),(87,102),(91,102),(95,102),(100,102),(107,102),(108,102),(113,102),(115,102),(24,103),(27,103),(38,103),(43,103),(72,103),(76,103),(87,103),(91,103),(93,103),(95,103),(98,103),(105,103),(107,103),(113,103),(22,104),(24,104),(33,104),(38,104),(42,104),(43,104),(45,104),(48,104),(87,104),(93,104),(95,104),(103,104),(107,104),(113,104),(26,105),(30,105),(35,105),(38,105),(73,105),(77,105),(84,105),(87,105),(48,106),(94,108)}
location.buildings = {(24,0),(25,0),(26,0),(27,0),(29,0),(30,0),(31,0),(35,0),(38,0),(39,0),(45,0),(46,0),(47,0),(48,0),(49,0),(52,0),(53,0),(54,0),(55,0),(56,0),(57,0),(58,0),(59,0),(60,0),(61,0),(62,0),(63,0),(64,0),(65,0),(66,0),(73,0),(74,0),(75,0),(76,0),(77,0),(78,0),(79,0),(80,0),(81,0),(82,0),(83,0),(84,0),(85,0),(86,0),(87,0),(88,0),(89,0),(90,0),(91,0),(92,0),(95,0),(96,0),(97,0),(98,0),(99,0),(100,0),(101,0),(102,0),(103,0),(104,0),(105,0),(106,0),(107,0),(108,0),(109,0),(110,0),(111,0),(112,0),(113,0),(114,0),(115,0),(116,0),(117,0),(118,0),(119,0),(23,1),(25,1),(26,1),(27,1),(29,1),(32,1),(34,1),(35,1),(36,1),(37,1),(38,1),(39,1),(40,1),(41,1),(42,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(50,1),(51,1),(52,1),(53,1),(54,1),(55,1),(56,1),(57,1),(58,1),(59,1),(60,1),(61,1),(62,1),(63,1),(64,1),(65,1),(66,1),(73,1),(74,1),(75,1),(76,1),(77,1),(78,1),(79,1),(80,1),(81,1),(82,1),(83,1),(84,1),(85,1),(86,1),(87,1),(88,1),(89,1),(90,1),(91,1),(92,1),(93,1),(94,1),(95,1),(96,1),(97,1),(98,1),(99,1),(100,1),(101,1),(102,1),(103,1),(104,1),(105,1),(106,1),(107,1),(108,1),(109,1),(110,1),(111,1),(112,1),(113,1),(114,1),(115,1),(116,1),(117,1),(118,1),(119,1),(22,2),(24,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(40,2),(41,2),(43,2),(44,2),(45,2),(46,2),(47,2),(48,2),(49,2),(50,2),(51,2),(52,2),(53,2),(54,2),(55,2),(56,2),(57,2),(58,2),(59,2),(60,2),(61,2),(62,2),(63,2),(64,2),(65,2),(66,2),(73,2),(74,2),(75,2),(76,2),(77,2),(78,2),(79,2),(80,2),(81,2),(82,2),(83,2),(84,2),(85,2),(86,2),(87,2),(88,2),(89,2),(90,2),(91,2),(92,2),(93,2),(95,2),(96,2),(97,2),(98,2),(99,2),(100,2),(101,2),(102,2),(103,2),(104,2),(105,2),(106,2),(107,2),(108,2),(109,2),(110,2),(111,2),(112,2),(113,2),(114,2),(115,2),(116,2),(117,2),(118,2),(119,2),(0,3),(1,3),(2,3),(3,3),(4,3),(5,3),(6,3),(21,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(40,3),(41,3),(42,3),(43,3),(44,3),(45,3),(46,3),(47,3),(48,3),(49,3),(50,3),(51,3),(52,3),(53,3),(54,3),(55,3),(56,3),(57,3),(58,3),(59,3),(60,3),(61,3),(62,3),(63,3),(66,3),(73,3),(74,3),(75,3),(76,3),(77,3),(78,3),(79,3),(80,3),(81,3),(82,3),(83,3),(84,3),(85,3),(86,3),(87,3),(88,3),(89,3),(90,3),(91,3),(92,3),(93,3),(95,3),(96,3),(97,3),(98,3),(99,3),(100,3),(101,3),(102,3),(103,3),(104,3),(105,3),(106,3),(107,3),(108,3),(109,3),(110,3),(111,3),(112,3),(113,3),(114,3),(115,3),(116,3),(117,3),(118,3),(119,3),(1,4),(2,4),(5,4),(6,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(47,4),(48,4),(49,4),(50,4),(51,4),(52,4),(53,4),(54,4),(55,4),(56,4),(57,4),(58,4),(59,4),(60,4),(61,4),(62,4),(63,4),(64,4),(65,4),(66,4),(73,4),(74,4),(75,4),(76,4),(77,4),(78,4),(79,4),(80,4),(81,4),(82,4),(83,4),(84,4),(86,4),(87,4),(88,4),(89,4),(90,4),(91,4),(92,4),(93,4),(95,4),(96,4),(97,4),(98,4),(99,4),(100,4),(101,4),(102,4),(103,4),(104,4),(105,4),(106,4),(107,4),(108,4),(109,4),(110,4),(111,4),(112,4),(113,4),(114,4),(115,4),(116,4),(117,4),(118,4),(119,4),(0,5),(1,5),(2,5),(7,5),(8,5),(19,5),(20,5),(21,5),(22,5),(23,5),(24,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(48,5),(49,5),(50,5),(51,5),(52,5),(53,5),(54,5),(55,5),(56,5),(57,5),(58,5),(59,5),(60,5),(61,5),(62,5),(63,5),(64,5),(65,5),(66,5),(75,5),(76,5),(77,5),(78,5),(79,5),(80,5),(81,5),(82,5),(83,5),(84,5),(85,5),(86,5),(87,5),(88,5),(89,5),(90,5),(91,5),(92,5),(93,5),(94,5),(95,5),(96,5),(97,5),(98,5),(99,5),(100,5),(101,5),(102,5),(103,5),(104,5),(105,5),(106,5),(107,5),(108,5),(109,5),(110,5),(111,5),(112,5),(113,5),(114,5),(115,5),(116,5),(117,5),(118,5),(119,5),(7,6),(8,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(23,6),(24,6),(25,6),(26,6),(27,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(46,6),(47,6),(48,6),(49,6),(50,6),(51,6),(52,6),(53,6),(54,6),(55,6),(56,6),(57,6),(58,6),(59,6),(60,6),(61,6),(62,6),(63,6),(64,6),(65,6),(66,6),(76,6),(77,6),(78,6),(79,6),(80,6),(81,6),(82,6),(83,6),(84,6),(85,6),(86,6),(87,6),(88,6),(89,6),(90,6),(91,6),(92,6),(93,6),(94,6),(95,6),(96,6),(98,6),(99,6),(100,6),(101,6),(102,6),(105,6),(106,6),(107,6),(108,6),(109,6),(110,6),(111,6),(112,6),(113,6),(114,6),(115,6),(116,6),(117,6),(119,6),(8,7),(9,7),(12,7),(13,7),(16,7),(17,7),(18,7),(19,7),(20,7),(21,7),(22,7),(23,7),(24,7),(25,7),(26,7),(27,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(46,7),(47,7),(48,7),(49,7),(50,7),(51,7),(52,7),(53,7),(54,7),(55,7),(56,7),(57,7),(58,7),(59,7),(60,7),(61,7),(62,7),(63,7),(64,7),(65,7),(66,7),(78,7),(79,7),(80,7),(81,7),(82,7),(83,7),(84,7),(85,7),(86,7),(87,7),(88,7),(89,7),(90,7),(91,7),(92,7),(93,7),(94,7),(95,7),(97,7),(99,7),(100,7),(101,7),(103,7),(104,7),(105,7),(109,7),(110,7),(111,7),(112,7),(113,7),(114,7),(115,7),(118,7),(119,7),(0,8),(13,8),(33,8),(46,8),(49,8),(50,8),(51,8),(52,8),(53,8),(54,8),(55,8),(56,8),(57,8),(58,8),(59,8),(60,8),(61,8),(62,8),(63,8),(64,8),(65,8),(66,8),(80,8),(81,8),(82,8),(84,8),(85,8),(86,8),(87,8),(88,8),(89,8),(90,8),(91,8),(92,8),(93,8),(94,8),(95,8),(103,8),(104,8),(109,8),(110,8),(111,8),(112,8),(113,8),(114,8),(115,8),(116,8),(117,8),(118,8),(119,8),(0,9),(1,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(20,9),(21,9),(22,9),(23,9),(24,9),(25,9),(26,9),(27,9),(28,9),(29,9),(30,9),(31,9),(32,9),(33,9),(39,9),(40,9),(46,9),(47,9),(48,9),(49,9),(50,9),(51,9),(52,9),(53,9),(54,9),(55,9),(56,9),(57,9),(58,9),(59,9),(60,9),(61,9),(62,9),(63,9),(64,9),(65,9),(66,9),(80,9),(81,9),(82,9),(83,9),(84,9),(85,9),(86,9),(87,9),(88,9),(89,9),(90,9),(91,9),(92,9),(93,9),(109,9),(110,9),(112,9),(113,9),(114,9),(115,9),(116,9),(117,9),(118,9),(119,9),(0,10),(1,10),(2,10),(3,10),(39,10),(40,10),(76,10),(80,10),(81,10),(82,10),(83,10),(84,10),(85,10),(86,10),(87,10),(88,10),(89,10),(90,10),(91,10),(92,10),(93,10),(94,10),(95,10),(96,10),(97,10),(98,10),(99,10),(100,10),(101,10),(102,10),(104,10),(107,10),(109,10),(110,10),(111,10),(112,10),(113,10),(114,10),(115,10),(116,10),(117,10),(118,10),(119,10),(0,11),(2,11),(3,11),(65,11),(80,11),(81,11),(82,11),(83,11),(84,11),(85,11),(86,11),(87,11),(88,11),(89,11),(90,11),(91,11),(92,11),(93,11),(94,11),(95,11),(96,11),(97,11),(98,11),(99,11),(100,11),(101,11),(105,11),(107,11),(109,11),(110,11),(111,11),(112,11),(113,11),(114,11),(115,11),(116,11),(117,11),(118,11),(119,11),(0,12),(2,12),(3,12),(80,12),(81,12),(82,12),(83,12),(84,12),(85,12),(86,12),(87,12),(88,12),(89,12),(90,12),(91,12),(92,12),(93,12),(94,12),(95,12),(96,12),(97,12),(98,12),(99,12),(100,12),(101,12),(103,12),(105,12),(107,12),(109,12),(110,12),(111,12),(112,12),(113,12),(114,12),(115,12),(116,12),(117,12),(118,12),(119,12),(0,13),(2,13),(3,13),(81,13),(82,13),(83,13),(84,13),(85,13),(86,13),(87,13),(88,13),(89,13),(90,13),(91,13),(92,13),(93,13),(94,13),(96,13),(97,13),(98,13),(99,13),(101,13),(103,13),(104,13),(106,13),(108,13),(109,13),(110,13),(111,13),(112,13),(113,13),(114,13),(115,13),(116,13),(117,13),(118,13),(119,13),(0,14),(2,14),(3,14),(81,14),(82,14),(83,14),(84,14),(85,14),(86,14),(87,14),(88,14),(89,14),(90,14),(91,14),(92,14),(93,14),(94,14),(96,14),(97,14),(98,14),(99,14),(101,14),(103,14),(104,14),(110,14),(111,14),(112,14),(113,14),(114,14),(115,14),(116,14),(117,14),(118,14),(119,14),(0,15),(2,15),(3,15),(4,15),(5,15),(6,15),(82,15),(83,15),(84,15),(85,15),(86,15),(87,15),(88,15),(89,15),(90,15),(91,15),(92,15),(93,15),(94,15),(95,15),(96,15),(97,15),(98,15),(99,15),(100,15),(101,15),(102,15),(103,15),(104,15),(108,15),(109,15),(110,15),(113,15),(114,15),(115,15),(116,15),(117,15),(118,15),(119,15),(0,16),(1,16),(2,16),(3,16),(4,16),(5,16),(6,16),(7,16),(85,16),(86,16),(87,16),(88,16),(91,16),(92,16),(93,16),(94,16),(95,16),(101,16),(102,16),(108,16),(109,16),(110,16),(115,16),(116,16),(117,16),(118,16),(119,16),(0,17),(1,17),(2,17),(3,17),(4,17),(5,17),(7,17),(92,17),(93,17),(116,17),(117,17),(118,17),(119,17),(0,18),(1,18),(2,18),(3,18),(4,18),(5,18),(6,18),(7,18),(8,18),(28,18),(29,18),(30,18),(31,18),(32,18),(36,18),(37,18),(38,18),(39,18),(40,18),(92,18),(93,18),(113,18),(114,18),(115,18),(116,18),(117,18),(118,18),(119,18),(0,19),(1,19),(2,19),(3,19),(4,19),(5,19),(6,19),(7,19),(8,19),(9,19),(26,19),(27,19),(28,19),(29,19),(32,19),(36,19),(39,19),(40,19),(41,19),(93,19),(111,19),(112,19),(116,19),(117,19),(118,19),(119,19),(0,20),(1,20),(2,20),(3,20),(4,20),(5,20),(6,20),(7,20),(8,20),(9,20),(25,20),(26,20),(32,20),(36,20),(37,20),(40,20),(41,20),(42,20),(43,20),(44,20),(93,20),(94,20),(95,20),(111,20),(112,20),(113,20),(114,20),(115,20),(116,20),(117,20),(118,20),(119,20),(0,21),(1,21),(2,21),(3,21),(4,21),(5,21),(6,21),(7,21),(8,21),(9,21),(25,21),(26,21),(31,21),(32,21),(36,21),(44,21),(45,21),(93,21),(94,21),(95,21),(105,21),(106,21),(107,21),(109,21),(110,21),(113,21),(114,21),(115,21),(116,21),(117,21),(118,21),(119,21),(0,22),(1,22),(2,22),(3,22),(4,22),(5,22),(7,22),(8,22),(9,22),(25,22),(32,22),(36,22),(45,22),(46,22),(93,22),(94,22),(95,22),(96,22),(97,22),(98,22),(99,22),(100,22),(101,22),(102,22),(103,22),(104,22),(105,22),(106,22),(107,22),(108,22),(109,22),(110,22),(111,22),(112,22),(113,22),(114,22),(115,22),(116,22),(117,22),(118,22),(119,22),(0,23),(1,23),(2,23),(3,23),(4,23),(7,23),(8,23),(9,23),(25,23),(32,23),(36,23),(45,23),(46,23),(47,23),(119,23),(0,24),(1,24),(2,24),(3,24),(4,24),(5,24),(6,24),(7,24),(8,24),(9,24),(24,24),(25,24),(31,24),(32,24),(36,24),(47,24),(106,24),(109,24),(0,25),(1,25),(2,25),(4,25),(5,25),(6,25),(7,25),(10,25),(23,25),(24,25),(32,25),(36,25),(47,25),(0,26),(1,26),(4,26),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(11,26),(22,26),(23,26),(32,26),(33,26),(34,26),(35,26),(36,26),(37,26),(47,26),(0,27),(1,27),(2,27),(3,27),(4,27),(7,27),(8,27),(11,27),(12,27),(22,27),(47,27),(109,27),(0,28),(3,28),(4,28),(7,28),(8,28),(9,28),(10,28),(11,28),(12,28),(13,28),(22,28),(47,28),(103,28),(104,28),(105,28),(106,28),(107,28),(108,28),(109,28),(110,28),(111,28),(112,28),(113,28),(114,28),(115,28),(116,28),(117,28),(118,28),(119,28),(0,29),(1,29),(2,29),(3,29),(4,29),(7,29),(8,29),(9,29),(10,29),(11,29),(12,29),(13,29),(14,29),(22,29),(47,29),(101,29),(102,29),(106,29),(107,29),(108,29),(110,29),(111,29),(112,29),(113,29),(114,29),(115,29),(116,29),(117,29),(118,29),(119,29),(0,30),(1,30),(2,30),(3,30),(4,30),(7,30),(8,30),(9,30),(10,30),(11,30),(12,30),(13,30),(14,30),(15,30),(22,30),(45,30),(47,30),(101,30),(102,30),(106,30),(107,30),(108,30),(110,30),(112,30),(113,30),(114,30),(115,30),(116,30),(117,30),(118,30),(119,30),(0,31),(1,31),(2,31),(3,31),(4,31),(7,31),(8,31),(9,31),(10,31),(11,31),(12,31),(13,31),(14,31),(15,31),(16,31),(22,31),(47,31),(48,31),(49,31),(101,31),(102,31),(103,31),(104,31),(105,31),(106,31),(107,31),(108,31),(111,31),(112,31),(113,31),(114,31),(115,31),(0,32),(1,32),(2,32),(3,32),(4,32),(7,32),(8,32),(9,32),(10,32),(11,32),(12,32),(13,32),(14,32),(15,32),(16,32),(22,32),(49,32),(50,32),(101,32),(102,32),(103,32),(104,32),(105,32),(106,32),(107,32),(108,32),(109,32),(110,32),(111,32),(112,32),(113,32),(114,32),(115,32),(116,32),(117,32),(118,32),(119,32),(0,33),(1,33),(2,33),(3,33),(4,33),(7,33),(8,33),(9,33),(10,33),(11,33),(12,33),(13,33),(14,33),(15,33),(16,33),(23,33),(48,33),(49,33),(50,33),(51,33),(106,33),(107,33),(108,33),(118,33),(0,34),(1,34),(9,34),(10,34),(11,34),(12,34),(13,34),(14,34),(15,34),(16,34),(24,34),(26,34),(51,34),(107,34),(0,35),(1,35),(12,35),(13,35),(14,35),(15,35),(16,35),(25,35),(51,35),(0,36),(1,36),(12,36),(13,36),(14,36),(15,36),(16,36),(26,36),(27,36),(51,36),(119,36),(0,37),(1,37),(12,37),(13,37),(14,37),(15,37),(16,37),(28,37),(29,37),(51,37),(102,37),(103,37),(104,37),(105,37),(106,37),(107,37),(108,37),(109,37),(110,37),(111,37),(112,37),(113,37),(114,37),(115,37),(116,37),(117,37),(118,37),(119,37),(0,38),(1,38),(12,38),(13,38),(14,38),(15,38),(16,38),(30,38),(51,38),(101,38),(102,38),(103,38),(104,38),(105,38),(106,38),(107,38),(108,38),(109,38),(110,38),(111,38),(112,38),(113,38),(114,38),(115,38),(116,38),(117,38),(118,38),(119,38),(0,39),(1,39),(2,39),(5,39),(12,39),(13,39),(14,39),(15,39),(16,39),(31,39),(32,39),(33,39),(34,39),(40,39),(44,39),(50,39),(99,39),(100,39),(101,39),(102,39),(0,40),(1,40),(2,40),(3,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(46,40),(47,40),(48,40),(49,40),(92,40),(93,40),(94,40),(95,40),(96,40),(97,40),(98,40),(99,40),(100,40),(101,40),(102,40),(0,41),(1,41),(2,41),(3,41),(4,41),(82,41),(83,41),(84,41),(85,41),(86,41),(87,41),(88,41),(89,41),(90,41),(91,41),(92,41),(93,41),(94,41),(95,41),(96,41),(97,41),(98,41),(0,42),(1,42),(2,42),(3,42),(4,42),(5,42),(6,42),(7,42),(8,42),(9,42),(81,42),(82,42),(83,42),(84,42),(85,42),(86,42),(87,42),(88,42),(89,42),(90,42),(91,42),(0,43),(1,43),(2,43),(3,43),(4,43),(5,43),(6,43),(7,43),(8,43),(9,43),(80,43),(81,43),(82,43),(90,43),(91,43),(0,44),(1,44),(2,44),(3,44),(4,44),(5,44),(6,44),(7,44),(8,44),(9,44),(79,44),(80,44),(90,44),(91,44),(0,45),(1,45),(2,45),(3,45),(4,45),(5,45),(6,45),(7,45),(8,45),(9,45),(78,45),(79,45),(80,45),(0,46),(1,46),(2,46),(3,46),(4,46),(5,46),(6,46),(7,46),(8,46),(9,46),(77,46),(78,46),(0,47),(1,47),(2,47),(3,47),(4,47),(5,47),(6,47),(7,47),(8,47),(9,47),(77,47),(83,47),(84,47),(85,47),(86,47),(87,47),(88,47),(0,48),(1,48),(2,48),(3,48),(4,48),(5,48),(6,48),(7,48),(8,48),(9,48),(77,48),(82,48),(83,48),(88,48),(89,48),(104,48),(105,48),(106,48),(107,48),(108,48),(109,48),(110,48),(111,48),(112,48),(113,48),(114,48),(115,48),(116,48),(117,48),(118,48),(0,49),(1,49),(2,49),(3,49),(4,49),(5,49),(6,49),(7,49),(8,49),(9,49),(77,49),(78,49),(79,49),(80,49),(81,49),(82,49),(89,49),(103,49),(104,49),(105,49),(106,49),(107,49),(108,49),(109,49),(110,49),(111,49),(112,49),(113,49),(114,49),(115,49),(116,49),(117,49),(118,49),(119,49),(0,50),(1,50),(2,50),(3,50),(4,50),(5,50),(6,50),(7,50),(8,50),(9,50),(76,50),(77,50),(82,50),(89,50),(101,50),(102,50),(103,50),(105,50),(106,50),(109,50),(110,50),(111,50),(112,50),(113,50),(114,50),(115,50),(116,50),(117,50),(118,50),(119,50),(0,51),(1,51),(2,51),(3,51),(4,51),(5,51),(8,51),(10,51),(62,51),(63,51),(64,51),(65,51),(66,51),(67,51),(68,51),(69,51),(70,51),(71,51),(72,51),(73,51),(74,51),(75,51),(76,51),(82,51),(89,51),(94,51),(95,51),(96,51),(97,51),(100,51),(104,51),(105,51),(106,51),(108,51),(110,51),(111,51),(112,51),(113,51),(114,51),(115,51),(119,51),(0,52),(1,52),(2,52),(3,52),(4,52),(5,52),(6,52),(7,52),(9,52),(10,52),(11,52),(12,52),(60,52),(61,52),(62,52),(70,52),(71,52),(72,52),(73,52),(74,52),(75,52),(82,52),(83,52),(84,52),(86,52),(87,52),(88,52),(89,52),(93,52),(94,52),(97,52),(98,52),(99,52),(104,52),(105,52),(106,52),(107,52),(110,52),(111,52),(112,52),(113,52),(114,52),(115,52),(119,52),(0,53),(1,53),(2,53),(3,53),(4,53),(5,53),(6,53),(7,53),(8,53),(9,53),(10,53),(11,53),(12,53),(13,53),(58,53),(59,53),(60,53),(83,53),(84,53),(85,53),(86,53),(87,53),(88,53),(91,53),(92,53),(100,53),(102,53),(103,53),(104,53),(105,53),(106,53),(110,53),(113,53),(114,53),(115,53),(116,53),(117,53),(118,53),(119,53),(0,54),(1,54),(2,54),(3,54),(4,54),(5,54),(6,54),(7,54),(8,54),(9,54),(10,54),(11,54),(12,54),(13,54),(14,54),(56,54),(57,54),(58,54),(85,54),(86,54),(87,54),(88,54),(90,54),(91,54),(100,54),(101,54),(102,54),(103,54),(104,54),(105,54),(106,54),(108,54),(110,54),(111,54),(112,54),(113,54),(114,54),(115,54),(116,54),(117,54),(118,54),(119,54),(0,55),(1,55),(2,55),(3,55),(4,55),(5,55),(6,55),(7,55),(8,55),(9,55),(10,55),(11,55),(12,55),(13,55),(14,55),(54,55),(55,55),(56,55),(87,55),(88,55),(89,55),(90,55),(91,55),(100,55),(101,55),(103,55),(104,55),(105,55),(106,55),(110,55),(111,55),(112,55),(113,55),(114,55),(115,55),(116,55),(117,55),(118,55),(119,55),(0,56),(1,56),(2,56),(3,56),(4,56),(5,56),(6,56),(7,56),(8,56),(9,56),(10,56),(11,56),(12,56),(13,56),(14,56),(52,56),(53,56),(54,56),(87,56),(88,56),(89,56),(94,56),(100,56),(101,56),(102,56),(103,56),(104,56),(105,56),(106,56),(110,56),(111,56),(112,56),(113,56),(114,56),(115,56),(116,56),(117,56),(118,56),(119,56),(0,57),(1,57),(2,57),(3,57),(4,57),(5,57),(6,57),(7,57),(8,57),(9,57),(10,57),(11,57),(12,57),(13,57),(14,57),(49,57),(50,57),(51,57),(52,57),(86,57),(100,57),(101,57),(102,57),(105,57),(106,57),(109,57),(110,57),(111,57),(112,57),(114,57),(115,57),(116,57),(117,57),(118,57),(119,57),(0,58),(1,58),(2,58),(3,58),(4,58),(5,58),(6,58),(7,58),(8,58),(9,58),(10,58),(11,58),(12,58),(13,58),(14,58),(35,58),(46,58),(47,58),(48,58),(49,58),(84,58),(85,58),(86,58),(100,58),(101,58),(102,58),(103,58),(104,58),(109,58),(110,58),(111,58),(112,58),(113,58),(114,58),(115,58),(116,58),(117,58),(118,58),(119,58),(0,59),(1,59),(2,59),(3,59),(4,59),(5,59),(6,59),(7,59),(8,59),(9,59),(10,59),(11,59),(12,59),(13,59),(14,59),(44,59),(45,59),(46,59),(75,59),(76,59),(77,59),(78,59),(84,59),(96,59),(97,59),(98,59),(99,59),(101,59),(102,59),(103,59),(104,59),(105,59),(106,59),(107,59),(108,59),(109,59),(110,59),(111,59),(112,59),(113,59),(114,59),(115,59),(116,59),(117,59),(118,59),(119,59),(0,60),(1,60),(2,60),(3,60),(4,60),(5,60),(6,60),(7,60),(8,60),(9,60),(10,60),(11,60),(12,60),(13,60),(14,60),(41,60),(42,60),(43,60),(44,60),(69,60),(70,60),(71,60),(72,60),(73,60),(74,60),(79,60),(80,60),(81,60),(82,60),(83,60),(95,60),(100,60),(101,60),(102,60),(103,60),(104,60),(105,60),(106,60),(107,60),(108,60),(109,60),(110,60),(111,60),(112,60),(113,60),(114,60),(115,60),(116,60),(117,60),(118,60),(119,60),(0,61),(1,61),(2,61),(3,61),(4,61),(5,61),(6,61),(7,61),(8,61),(9,61),(10,61),(11,61),(12,61),(13,61),(14,61),(39,61),(40,61),(41,61),(67,61),(68,61),(95,61),(100,61),(101,61),(102,61),(103,61),(104,61),(105,61),(106,61),(107,61),(108,61),(109,61),(110,61),(111,61),(112,61),(113,61),(114,61),(115,61),(116,61),(117,61),(119,61),(0,62),(1,62),(2,62),(3,62),(4,62),(5,62),(6,62),(7,62),(8,62),(9,62),(10,62),(11,62),(12,62),(37,62),(38,62),(39,62),(65,62),(66,62),(95,62),(97,62),(98,62),(99,62),(100,62),(102,62),(103,62),(104,62),(105,62),(106,62),(107,62),(108,62),(109,62),(111,62),(112,62),(113,62),(114,62),(115,62),(116,62),(117,62),(118,62),(119,62),(0,63),(1,63),(2,63),(3,63),(4,63),(5,63),(6,63),(7,63),(8,63),(9,63),(10,63),(35,63),(36,63),(37,63),(64,63),(95,63),(96,63),(97,63),(98,63),(99,63),(100,63),(101,63),(102,63),(103,63),(104,63),(105,63),(106,63),(107,63),(108,63),(109,63),(110,63),(111,63),(112,63),(113,63),(114,63),(115,63),(116,63),(117,63),(118,63),(119,63),(0,64),(1,64),(2,64),(3,64),(4,64),(5,64),(6,64),(7,64),(8,64),(33,64),(34,64),(35,64),(64,64),(95,64),(96,64),(97,64),(98,64),(99,64),(100,64),(101,64),(102,64),(103,64),(104,64),(105,64),(106,64),(107,64),(108,64),(109,64),(110,64),(111,64),(112,64),(113,64),(114,64),(115,64),(116,64),(117,64),(118,64),(119,64),(0,65),(1,65),(2,65),(3,65),(4,65),(5,65),(6,65),(31,65),(32,65),(33,65),(36,65),(64,65),(95,65),(96,65),(97,65),(98,65),(99,65),(100,65),(101,65),(102,65),(103,65),(104,65),(105,65),(106,65),(107,65),(108,65),(109,65),(110,65),(111,65),(112,65),(113,65),(114,65),(115,65),(116,65),(117,65),(118,65),(119,65),(0,66),(1,66),(2,66),(3,66),(4,66),(5,66),(6,66),(29,66),(30,66),(31,66),(53,66),(54,66),(56,66),(57,66),(58,66),(59,66),(64,66),(95,66),(96,66),(97,66),(98,66),(99,66),(100,66),(101,66),(102,66),(105,66),(106,66),(107,66),(108,66),(109,66),(110,66),(111,66),(112,66),(113,66),(114,66),(115,66),(116,66),(117,66),(118,66),(119,66),(0,67),(1,67),(2,67),(3,67),(4,67),(5,67),(6,67),(27,67),(28,67),(29,67),(53,67),(54,67),(55,67),(60,67),(64,67),(95,67),(96,67),(97,67),(98,67),(99,67),(100,67),(101,67),(102,67),(103,67),(104,67),(105,67),(106,67),(107,67),(108,67),(111,67),(112,67),(113,67),(114,67),(115,67),(116,67),(117,67),(118,67),(119,67),(0,68),(1,68),(2,68),(3,68),(4,68),(5,68),(6,68),(25,68),(26,68),(27,68),(49,68),(50,68),(51,68),(52,68),(61,68),(64,68),(65,68),(95,68),(96,68),(97,68),(98,68),(99,68),(100,68),(101,68),(102,68),(103,68),(104,68),(105,68),(107,68),(108,68),(112,68),(113,68),(114,68),(115,68),(116,68),(117,68),(118,68),(119,68),(0,69),(1,69),(2,69),(3,69),(4,69),(5,69),(6,69),(23,69),(24,69),(25,69),(26,69),(45,69),(46,69),(47,69),(48,69),(62,69),(65,69),(95,69),(96,69),(97,69),(98,69),(99,69),(100,69),(101,69),(102,69),(103,69),(104,69),(105,69),(108,69),(109,69),(110,69),(111,69),(112,69),(113,69),(114,69),(115,69),(116,69),(117,69),(118,69),(119,69),(0,70),(1,70),(2,70),(3,70),(4,70),(5,70),(6,70),(22,70),(23,70),(42,70),(43,70),(44,70),(62,70),(63,70),(64,70),(65,70),(95,70),(96,70),(97,70),(98,70),(99,70),(100,70),(101,70),(102,70),(103,70),(104,70),(105,70),(108,70),(110,70),(111,70),(112,70),(113,70),(114,70),(115,70),(116,70),(117,70),(118,70),(119,70),(0,71),(1,71),(2,71),(3,71),(4,71),(5,71),(6,71),(22,71),(40,71),(41,71),(62,71),(65,71),(95,71),(96,71),(97,71),(98,71),(99,71),(100,71),(101,71),(102,71),(103,71),(104,71),(105,71),(109,71),(110,71),(111,71),(112,71),(113,71),(114,71),(115,71),(116,71),(117,71),(118,71),(119,71),(0,72),(1,72),(2,72),(3,72),(4,72),(5,72),(6,72),(21,72),(22,72),(39,72),(62,72),(65,72),(66,72),(99,72),(100,72),(101,72),(102,72),(103,72),(104,72),(105,72),(106,72),(107,72),(108,72),(109,72),(110,72),(113,72),(114,72),(115,72),(116,72),(117,72),(118,72),(119,72),(0,73),(1,73),(2,73),(3,73),(4,73),(5,73),(6,73),(21,73),(38,73),(62,73),(66,73),(105,73),(106,73),(107,73),(108,73),(109,73),(110,73),(111,73),(112,73),(113,73),(114,73),(115,73),(116,73),(117,73),(118,73),(119,73),(0,74),(1,74),(2,74),(3,74),(4,74),(17,74),(21,74),(37,74),(62,74),(63,74),(66,74),(105,74),(106,74),(107,74),(108,74),(109,74),(110,74),(111,74),(112,74),(113,74),(114,74),(115,74),(116,74),(117,74),(118,74),(119,74),(0,75),(1,75),(2,75),(3,75),(4,75),(21,75),(37,75),(62,75),(66,75),(105,75),(106,75),(107,75),(108,75),(109,75),(110,75),(111,75),(112,75),(113,75),(115,75),(116,75),(117,75),(118,75),(119,75),(0,76),(1,76),(2,76),(3,76),(4,76),(21,76),(37,76),(62,76),(66,76),(67,76),(105,76),(106,76),(107,76),(108,76),(109,76),(110,76),(111,76),(112,76),(113,76),(114,76),(115,76),(116,76),(117,76),(118,76),(119,76),(0,77),(1,77),(2,77),(3,77),(4,77),(5,77),(21,77),(37,77),(38,77),(62,77),(67,77),(105,77),(106,77),(107,77),(108,77),(109,77),(110,77),(111,77),(112,77),(113,77),(114,77),(115,77),(116,77),(117,77),(118,77),(119,77),(0,78),(1,78),(2,78),(3,78),(4,78),(5,78),(6,78),(21,78),(38,78),(39,78),(62,78),(67,78),(107,78),(108,78),(109,78),(110,78),(111,78),(112,78),(113,78),(114,78),(115,78),(116,78),(117,78),(118,78),(119,78),(0,79),(1,79),(2,79),(3,79),(4,79),(5,79),(6,79),(7,79),(21,79),(39,79),(40,79),(41,79),(42,79),(62,79),(67,79),(109,79),(110,79),(111,79),(112,79),(113,79),(114,79),(117,79),(118,79),(119,79),(0,80),(1,80),(2,80),(3,80),(4,80),(5,80),(6,80),(7,80),(22,80),(40,80),(41,80),(42,80),(43,80),(44,80),(45,80),(62,80),(67,80),(111,80),(112,80),(113,80),(117,80),(118,80),(119,80),(0,81),(1,81),(2,81),(3,81),(4,81),(5,81),(6,81),(7,81),(22,81),(36,81),(37,81),(40,81),(41,81),(45,81),(46,81),(47,81),(48,81),(62,81),(67,81),(113,81),(114,81),(115,81),(117,81),(118,81),(119,81),(0,82),(1,82),(2,82),(3,82),(4,82),(5,82),(6,82),(7,82),(23,82),(25,82),(35,82),(38,82),(39,82),(40,82),(41,82),(48,82),(49,82),(50,82),(51,82),(52,82),(61,82),(62,82),(67,82),(113,82),(114,82),(115,82),(117,82),(118,82),(119,82),(0,83),(1,83),(2,83),(3,83),(4,83),(5,83),(6,83),(7,83),(24,83),(25,83),(35,83),(42,83),(47,83),(52,83),(53,83),(54,83),(55,83),(60,83),(61,83),(66,83),(72,83),(113,83),(114,83),(115,83),(116,83),(117,83),(118,83),(119,83),(2,84),(3,84),(4,84),(5,84),(6,84),(7,84),(26,84),(27,84),(35,84),(36,84),(42,84),(55,84),(56,84),(59,84),(60,84),(66,84),(67,84),(68,84),(113,84),(114,84),(115,84),(116,84),(117,84),(118,84),(119,84),(2,85),(3,85),(4,85),(5,85),(6,85),(7,85),(28,85),(29,85),(36,85),(37,85),(38,85),(39,85),(40,85),(41,85),(42,85),(56,85),(59,85),(66,85),(67,85),(113,85),(114,85),(115,85),(116,85),(117,85),(0,86),(1,86),(2,86),(3,86),(4,86),(5,86),(6,86),(7,86),(9,86),(30,86),(31,86),(32,86),(37,86),(38,86),(39,86),(56,86),(57,86),(59,86),(66,86),(67,86),(113,86),(114,86),(115,86),(116,86),(117,86),(118,86),(119,86),(0,87),(1,87),(2,87),(3,87),(4,87),(5,87),(6,87),(7,87),(33,87),(34,87),(35,87),(36,87),(37,87),(38,87),(57,87),(59,87),(65,87),(66,87),(113,87),(114,87),(115,87),(116,87),(117,87),(118,87),(119,87),(2,88),(3,88),(4,88),(5,88),(6,88),(7,88),(39,88),(40,88),(41,88),(57,88),(58,88),(59,88),(64,88),(65,88),(66,88),(67,88),(68,88),(113,88),(114,88),(115,88),(116,88),(117,88),(118,88),(119,88),(2,89),(3,89),(4,89),(5,89),(6,89),(7,89),(42,89),(43,89),(44,89),(63,89),(64,89),(65,89),(66,89),(67,89),(68,89),(115,89),(116,89),(117,89),(118,89),(119,89),(2,90),(3,90),(4,90),(5,90),(6,90),(7,90),(45,90),(46,90),(47,90),(63,90),(64,90),(65,90),(66,90),(67,90),(68,90),(117,90),(118,90),(119,90),(3,91),(4,91),(5,91),(6,91),(7,91),(8,91),(48,91),(63,91),(64,91),(65,91),(66,91),(67,91),(68,91),(117,91),(118,91),(119,91),(3,92),(4,92),(5,92),(6,92),(7,92),(8,92),(9,92),(32,92),(33,92),(34,92),(35,92),(36,92),(49,92),(64,92),(65,92),(66,92),(67,92),(68,92),(85,92),(119,92),(3,93),(4,93),(5,93),(6,93),(7,93),(8,93),(9,93),(10,93),(11,93),(32,93),(33,93),(34,93),(35,93),(36,93),(50,93),(64,93),(65,93),(66,93),(67,93),(68,93),(118,93),(119,93),(3,94),(4,94),(5,94),(6,94),(7,94),(8,94),(9,94),(10,94),(11,94),(30,94),(31,94),(32,94),(33,94),(34,94),(35,94),(36,94),(50,94),(51,94),(65,94),(66,94),(67,94),(68,94),(97,94),(100,94),(115,94),(117,94),(118,94),(119,94),(3,95),(4,95),(5,95),(6,95),(7,95),(8,95),(9,95),(10,95),(11,95),(12,95),(30,95),(31,95),(32,95),(33,95),(34,95),(35,95),(36,95),(50,95),(51,95),(52,95),(65,95),(66,95),(67,95),(68,95),(92,95),(93,95),(94,95),(95,95),(96,95),(97,95),(100,95),(116,95),(117,95),(118,95),(119,95),(3,96),(4,96),(5,96),(6,96),(7,96),(8,96),(9,96),(10,96),(11,96),(12,96),(13,96),(14,96),(15,96),(16,96),(17,96),(50,96),(51,96),(52,96),(65,96),(66,96),(67,96),(68,96),(91,96),(92,96),(93,96),(94,96),(95,96),(96,96),(97,96),(100,96),(101,96),(115,96),(116,96),(117,96),(118,96),(119,96),(3,97),(4,97),(5,97),(6,97),(7,97),(8,97),(9,97),(10,97),(11,97),(12,97),(13,97),(14,97),(15,97),(16,97),(17,97),(18,97),(50,97),(51,97),(52,97),(65,97),(66,97),(67,97),(68,97),(69,97),(90,97),(91,97),(92,97),(93,97),(94,97),(95,97),(96,97),(97,97),(100,97),(101,97),(114,97),(115,97),(116,97),(117,97),(118,97),(119,97),(3,98),(4,98),(5,98),(6,98),(7,98),(8,98),(9,98),(10,98),(11,98),(12,98),(13,98),(14,98),(15,98),(16,98),(17,98),(18,98),(19,98),(20,98),(21,98),(22,98),(23,98),(24,98),(37,98),(38,98),(39,98),(40,98),(41,98),(42,98),(43,98),(44,98),(50,98),(51,98),(52,98),(66,98),(67,98),(68,98),(69,98),(73,98),(87,98),(88,98),(89,98),(90,98),(91,98),(92,98),(93,98),(94,98),(95,98),(96,98),(97,98),(100,98),(101,98),(102,98),(103,98),(104,98),(105,98),(106,98),(107,98),(113,98),(114,98),(115,98),(116,98),(117,98),(118,98),(119,98),(3,99),(4,99),(5,99),(6,99),(7,99),(8,99),(9,99),(10,99),(11,99),(12,99),(13,99),(14,99),(15,99),(16,99),(17,99),(18,99),(19,99),(20,99),(21,99),(22,99),(23,99),(24,99),(25,99),(37,99),(38,99),(39,99),(40,99),(41,99),(42,99),(43,99),(44,99),(50,99),(51,99),(52,99),(66,99),(67,99),(68,99),(69,99),(86,99),(87,99),(88,99),(89,99),(90,99),(91,99),(92,99),(93,99),(94,99),(95,99),(96,99),(97,99),(100,99),(101,99),(102,99),(103,99),(104,99),(105,99),(106,99),(107,99),(108,99),(112,99),(113,99),(114,99),(115,99),(116,99),(117,99),(118,99),(119,99),(3,100),(4,100),(5,100),(6,100),(7,100),(8,100),(9,100),(10,100),(11,100),(12,100),(13,100),(14,100),(15,100),(16,100),(17,100),(18,100),(19,100),(20,100),(21,100),(22,100),(23,100),(24,100),(25,100),(26,100),(27,100),(28,100),(29,100),(30,100),(31,100),(32,100),(33,100),(34,100),(35,100),(36,100),(37,100),(38,100),(39,100),(40,100),(41,100),(42,100),(43,100),(44,100),(45,100),(46,100),(47,100),(48,100),(49,100),(50,100),(51,100),(52,100),(66,100),(67,100),(68,100),(69,100),(70,100),(71,100),(72,100),(73,100),(74,100),(75,100),(76,100),(77,100),(78,100),(79,100),(80,100),(81,100),(82,100),(83,100),(84,100),(85,100),(86,100),(87,100),(88,100),(89,100),(90,100),(91,100),(92,100),(94,100),(100,100),(101,100),(102,100),(103,100),(104,100),(105,100),(106,100),(107,100),(108,100),(109,100),(110,100),(111,100),(112,100),(113,100),(114,100),(115,100),(116,100),(117,100),(118,100),(119,100),(3,101),(4,101),(5,101),(6,101),(7,101),(8,101),(9,101),(10,101),(11,101),(12,101),(13,101),(14,101),(15,101),(16,101),(17,101),(18,101),(19,101),(20,101),(21,101),(22,101),(23,101),(24,101),(25,101),(26,101),(27,101),(28,101),(29,101),(30,101),(31,101),(32,101),(33,101),(34,101),(35,101),(36,101),(37,101),(38,101),(39,101),(40,101),(41,101),(42,101),(43,101),(44,101),(45,101),(46,101),(47,101),(48,101),(49,101),(50,101),(51,101),(52,101),(66,101),(67,101),(68,101),(69,101),(70,101),(71,101),(72,101),(73,101),(74,101),(75,101),(76,101),(77,101),(78,101),(79,101),(80,101),(81,101),(82,101),(83,101),(84,101),(85,101),(86,101),(87,101),(88,101),(89,101),(90,101),(91,101),(92,101),(93,101),(94,101),(96,101),(97,101),(98,101),(99,101),(100,101),(101,101),(102,101),(103,101),(104,101),(105,101),(106,101),(107,101),(108,101),(109,101),(110,101),(111,101),(112,101),(113,101),(114,101),(115,101),(116,101),(117,101),(118,101),(119,101),(4,102),(5,102),(6,102),(7,102),(8,102),(9,102),(10,102),(11,102),(12,102),(13,102),(14,102),(15,102),(16,102),(17,102),(18,102),(19,102),(20,102),(21,102),(22,102),(23,102),(24,102),(25,102),(26,102),(27,102),(28,102),(29,102),(30,102),(31,102),(32,102),(33,102),(34,102),(35,102),(36,102),(37,102),(38,102),(39,102),(40,102),(41,102),(42,102),(43,102),(44,102),(45,102),(46,102),(47,102),(48,102),(49,102),(50,102),(51,102),(52,102),(66,102),(67,102),(68,102),(69,102),(70,102),(71,102),(72,102),(73,102),(74,102),(75,102),(76,102),(77,102),(78,102),(79,102),(80,102),(81,102),(82,102),(83,102),(84,102),(85,102),(86,102),(87,102),(88,102),(89,102),(90,102),(91,102),(92,102),(93,102),(94,102),(95,102),(96,102),(97,102),(98,102),(99,102),(100,102),(101,102),(102,102),(103,102),(104,102),(105,102),(106,102),(107,102),(108,102),(109,102),(110,102),(111,102),(112,102),(113,102),(114,102),(115,102),(116,102),(117,102),(118,102),(119,102),(6,103),(7,103),(8,103),(9,103),(10,103),(11,103),(12,103),(13,103),(14,103),(15,103),(16,103),(17,103),(18,103),(19,103),(20,103),(21,103),(22,103),(23,103),(24,103),(25,103),(26,103),(27,103),(28,103),(29,103),(30,103),(31,103),(32,103),(33,103),(34,103),(35,103),(36,103),(37,103),(38,103),(39,103),(40,103),(41,103),(42,103),(43,103),(44,103),(45,103),(46,103),(47,103),(48,103),(49,103),(50,103),(51,103),(52,103),(66,103),(67,103),(68,103),(69,103),(70,103),(71,103),(72,103),(73,103),(74,103),(75,103),(76,103),(77,103),(78,103),(79,103),(80,103),(81,103),(82,103),(83,103),(84,103),(85,103),(86,103),(87,103),(88,103),(89,103),(90,103),(91,103),(92,103),(93,103),(94,103),(95,103),(96,103),(97,103),(98,103),(99,103),(100,103),(101,103),(102,103),(103,103),(104,103),(105,103),(106,103),(107,103),(108,103),(109,103),(110,103),(111,103),(112,103),(113,103),(114,103),(115,103),(116,103),(117,103),(118,103),(119,103),(7,104),(8,104),(9,104),(10,104),(11,104),(12,104),(13,104),(14,104),(15,104),(16,104),(17,104),(18,104),(19,104),(20,104),(21,104),(22,104),(23,104),(24,104),(25,104),(26,104),(27,104),(28,104),(29,104),(30,104),(31,104),(32,104),(33,104),(34,104),(35,104),(36,104),(37,104),(38,104),(39,104),(40,104),(41,104),(42,104),(43,104),(44,104),(45,104),(46,104),(47,104),(48,104),(49,104),(50,104),(51,104),(66,104),(67,104),(68,104),(69,104),(70,104),(71,104),(72,104),(73,104),(74,104),(75,104),(76,104),(77,104),(78,104),(79,104),(80,104),(81,104),(82,104),(83,104),(84,104),(85,104),(86,104),(87,104),(88,104),(89,104),(90,104),(91,104),(92,104),(93,104),(94,104),(95,104),(96,104),(97,104),(98,104),(99,104),(100,104),(101,104),(102,104),(103,104),(104,104),(105,104),(106,104),(107,104),(108,104),(109,104),(110,104),(111,104),(112,104),(113,104),(114,104),(115,104),(116,104),(117,104),(118,104),(119,104),(8,105),(9,105),(10,105),(11,105),(12,105),(13,105),(14,105),(15,105),(16,105),(17,105),(18,105),(19,105),(20,105),(21,105),(22,105),(23,105),(24,105),(25,105),(26,105),(27,105),(28,105),(29,105),(30,105),(31,105),(32,105),(33,105),(34,105),(35,105),(36,105),(37,105),(38,105),(39,105),(40,105),(41,105),(42,105),(43,105),(44,105),(45,105),(46,105),(47,105),(48,105),(49,105),(50,105),(51,105),(66,105),(67,105),(68,105),(69,105),(70,105),(71,105),(72,105),(73,105),(74,105),(75,105),(76,105),(77,105),(78,105),(79,105),(80,105),(81,105),(82,105),(83,105),(84,105),(85,105),(86,105),(87,105),(88,105),(89,105),(90,105),(91,105),(92,105),(93,105),(94,105),(95,105),(96,105),(97,105),(98,105),(99,105),(100,105),(101,105),(102,105),(103,105),(104,105),(105,105),(106,105),(107,105),(108,105),(109,105),(110,105),(111,105),(112,105),(113,105),(114,105),(115,105),(116,105),(117,105),(118,105),(10,106),(11,106),(12,106),(13,106),(14,106),(15,106),(16,106),(17,106),(18,106),(19,106),(20,106),(21,106),(22,106),(23,106),(24,106),(25,106),(26,106),(27,106),(28,106),(29,106),(30,106),(31,106),(32,106),(33,106),(34,106),(35,106),(36,106),(37,106),(38,106),(39,106),(40,106),(41,106),(42,106),(43,106),(44,106),(45,106),(46,106),(47,106),(48,106),(49,106),(50,106),(51,106),(66,106),(67,106),(68,106),(69,106),(70,106),(71,106),(72,106),(73,106),(74,106),(75,106),(76,106),(77,106),(78,106),(79,106),(80,106),(81,106),(82,106),(83,106),(84,106),(85,106),(86,106),(87,106),(88,106),(89,106),(90,106),(91,106),(92,106),(93,106),(94,106),(95,106),(96,106),(97,106),(98,106),(99,106),(100,106),(101,106),(102,106),(103,106),(104,106),(105,106),(106,106),(107,106),(108,106),(109,106),(110,106),(111,106),(112,106),(113,106),(114,106),(115,106),(116,106),(117,106),(11,107),(12,107),(13,107),(14,107),(15,107),(16,107),(17,107),(18,107),(19,107),(20,107),(21,107),(22,107),(23,107),(24,107),(25,107),(26,107),(27,107),(28,107),(29,107),(30,107),(31,107),(32,107),(33,107),(34,107),(35,107),(36,107),(37,107),(38,107),(39,107),(40,107),(41,107),(42,107),(43,107),(44,107),(45,107),(46,107),(47,107),(48,107),(49,107),(50,107),(51,107),(66,107),(67,107),(68,107),(69,107),(70,107),(71,107),(72,107),(73,107),(74,107),(75,107),(76,107),(77,107),(78,107),(79,107),(80,107),(81,107),(82,107),(83,107),(84,107),(85,107),(86,107),(87,107),(88,107),(89,107),(90,107),(91,107),(92,107),(93,107),(94,107),(95,107),(96,107),(97,107),(98,107),(99,107),(100,107),(101,107),(102,107),(103,107),(104,107),(105,107),(106,107),(107,107),(108,107),(109,107),(110,107),(111,107),(112,107),(113,107),(114,107),(115,107),(12,108),(13,108),(14,108),(15,108),(16,108),(17,108),(18,108),(19,108),(20,108),(21,108),(22,108),(23,108),(24,108),(25,108),(26,108),(27,108),(28,108),(29,108),(30,108),(31,108),(32,108),(33,108),(34,108),(35,108),(36,108),(37,108),(38,108),(39,108),(40,108),(41,108),(42,108),(43,108),(44,108),(45,108),(46,108),(47,108),(48,108),(49,108),(50,108),(51,108),(67,108),(68,108),(69,108),(70,108),(71,108),(72,108),(73,108),(74,108),(75,108),(76,108),(77,108),(78,108),(79,108),(80,108),(81,108),(82,108),(83,108),(84,108),(85,108),(86,108),(87,108),(88,108),(89,108),(90,108),(91,108),(92,108),(93,108),(94,108),(95,108),(96,108),(97,108),(98,108),(99,108),(100,108),(101,108),(102,108),(103,108),(105,108),(106,108),(107,108),(108,108),(109,108),(110,108),(111,108),(112,108),(113,108),(114,108),(14,109),(15,109),(16,109),(18,109),(19,109),(20,109),(21,109),(22,109),(23,109),(24,109),(25,109),(26,109),(27,109),(28,109),(29,109),(30,109),(31,109),(32,109),(33,109),(34,109),(35,109),(36,109),(37,109),(38,109),(39,109),(40,109),(41,109),(42,109),(43,109),(44,109),(45,109),(46,109),(47,109),(48,109),(49,109),(50,109),(68,109),(69,109),(70,109),(71,109),(72,109),(73,109),(74,109),(75,109),(76,109),(77,109),(78,109),(79,109),(80,109),(81,109),(82,109),(83,109),(84,109),(85,109),(86,109),(87,109),(88,109),(89,109),(90,109),(91,109),(92,109),(95,109),(96,109),(97,109),(98,109),(99,109),(101,109),(102,109),(103,109),(104,109),(105,109),(106,109),(107,109),(108,109),(109,109),(110,109),(111,109),(112,109),(113,109)}
if version == "1.3":
location.spawnable = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(17,0),(18,0),(20,0),(21,0),(22,0),(23,0),(24,0),(27,0),(28,0),(29,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(41,0),(42,0),(43,0),(44,0),(45,0),(46,0),(47,0),(48,0),(49,0),(50,0),(58,0),(66,0),(70,0),(73,0),(74,0),(75,0),(78,0),(85,0),(86,0),(87,0),(88,0),(89,0),(91,0),(97,0),(98,0),(99,0),(100,0),(101,0),(102,0),(103,0),(105,0),(106,0),(109,0),(110,0),(111,0),(115,0),(116,0),(117,0),(118,0),(7,1),(8,1),(9,1),(10,1),(17,1),(18,1),(20,1),(21,1),(22,1),(23,1),(27,1),(28,1),(29,1),(32,1),(34,1),(35,1),(36,1),(37,1),(38,1),(39,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(52,1),(53,1),(54,1),(55,1),(56,1),(60,1),(61,1),(65,1),(66,1),(73,1),(74,1),(75,1),(79,1),(80,1),(81,1),(82,1),(84,1),(85,1),(86,1),(89,1),(108,1),(109,1),(110,1),(111,1),(112,1),(113,1),(114,1),(115,1),(116,1),(117,1),(118,1),(119,1),(27,2),(28,2),(29,2),(30,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(40,2),(41,2),(42,2),(43,2),(44,2),(48,2),(49,2),(52,2),(53,2),(54,2),(55,2),(56,2),(57,2),(58,2),(59,2),(60,2),(61,2),(63,2),(65,2),(73,2),(75,2),(76,2),(77,2),(78,2),(81,2),(82,2),(83,2),(84,2),(85,2),(86,2),(87,2),(88,2),(91,2),(92,2),(93,2),(94,2),(95,2),(96,2),(97,2),(98,2),(99,2),(100,2),(101,2),(102,2),(103,2),(104,2),(105,2),(106,2),(107,2),(110,2),(111,2),(112,2),(113,2),(114,2),(116,2),(117,2),(118,2),(119,2),(26,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(40,3),(41,3),(42,3),(43,3),(44,3),(46,3),(48,3),(49,3),(51,3),(52,3),(53,3),(54,3),(55,3),(57,3),(59,3),(61,3),(65,3),(67,3),(73,3),(75,3),(76,3),(77,3),(78,3),(79,3),(80,3),(83,3),(84,3),(85,3),(86,3),(87,3),(91,3),(92,3),(93,3),(94,3),(95,3),(96,3),(97,3),(98,3),(99,3),(100,3),(101,3),(102,3),(103,3),(104,3),(105,3),(106,3),(107,3),(108,3),(109,3),(112,3),(113,3),(114,3),(115,3),(117,3),(118,3),(119,3),(25,4),(26,4),(28,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(48,4),(49,4),(51,4),(52,4),(53,4),(54,4),(55,4),(56,4),(57,4),(58,4),(61,4),(62,4),(63,4),(64,4),(65,4),(75,4),(76,4),(77,4),(78,4),(79,4),(80,4),(81,4),(82,4),(85,4),(86,4),(89,4),(90,4),(91,4),(92,4),(93,4),(94,4),(95,4),(96,4),(97,4),(98,4),(99,4),(100,4),(101,4),(102,4),(103,4),(104,4),(105,4),(106,4),(107,4),(108,4),(109,4),(110,4),(111,4),(113,4),(114,4),(24,5),(25,5),(26,5),(30,5),(31,5),(36,5),(47,5),(48,5),(49,5),(51,5),(52,5),(56,5),(57,5),(58,5),(59,5),(61,5),(62,5),(63,5),(64,5),(65,5),(71,5),(72,5),(73,5),(78,5),(79,5),(85,5),(93,5),(94,5),(95,5),(96,5),(97,5),(98,5),(99,5),(100,5),(101,5),(102,5),(103,5),(104,5),(105,5),(106,5),(107,5),(113,5),(114,5),(23,6),(24,6),(25,6),(26,6),(27,6),(28,6),(29,6),(30,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(42,6),(43,6),(49,6),(52,6),(54,6),(56,6),(57,6),(58,6),(59,6),(60,6),(61,6),(62,6),(63,6),(64,6),(65,6),(67,6),(71,6),(72,6),(73,6),(77,6),(78,6),(82,6),(87,6),(89,6),(93,6),(94,6),(95,6),(96,6),(97,6),(98,6),(99,6),(100,6),(101,6),(102,6),(103,6),(104,6),(105,6),(106,6),(107,6),(108,6),(109,6),(117,6),(118,6),(119,6),(0,7),(22,7),(26,7),(27,7),(28,7),(29,7),(30,7),(32,7),(34,7),(45,7),(47,7),(49,7),(52,7),(58,7),(59,7),(60,7),(62,7),(63,7),(64,7),(65,7),(67,7),(71,7),(72,7),(74,7),(78,7),(79,7),(80,7),(82,7),(83,7),(86,7),(88,7),(92,7),(93,7),(94,7),(95,7),(96,7),(97,7),(98,7),(99,7),(100,7),(101,7),(102,7),(103,7),(104,7),(105,7),(106,7),(107,7),(108,7),(109,7),(110,7),(113,7),(117,7),(118,7),(119,7),(22,8),(24,8),(26,8),(27,8),(28,8),(29,8),(30,8),(32,8),(34,8),(45,8),(47,8),(51,8),(52,8),(53,8),(54,8),(55,8),(56,8),(57,8),(58,8),(59,8),(60,8),(61,8),(62,8),(63,8),(64,8),(65,8),(67,8),(70,8),(72,8),(73,8),(74,8),(79,8),(80,8),(85,8),(90,8),(91,8),(92,8),(93,8),(94,8),(95,8),(96,8),(97,8),(98,8),(99,8),(107,8),(108,8),(109,8),(110,8),(118,8),(119,8),(0,9),(1,9),(6,9),(7,9),(8,9),(9,9),(10,9),(11,9),(12,9),(13,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(20,9),(21,9),(22,9),(26,9),(27,9),(28,9),(29,9),(30,9),(32,9),(34,9),(36,9),(38,9),(39,9),(40,9),(41,9),(45,9),(47,9),(48,9),(49,9),(50,9),(51,9),(52,9),(53,9),(54,9),(55,9),(56,9),(57,9),(58,9),(59,9),(60,9),(61,9),(62,9),(63,9),(64,9),(67,9),(73,9),(74,9),(76,9),(80,9),(81,9),(82,9),(83,9),(89,9),(91,9),(92,9),(103,9),(104,9),(108,9),(109,9),(113,9),(0,10),(1,10),(2,10),(9,10),(10,10),(11,10),(12,10),(13,10),(14,10),(15,10),(16,10),(17,10),(18,10),(19,10),(20,10),(21,10),(22,10),(23,10),(24,10),(25,10),(26,10),(27,10),(28,10),(29,10),(32,10),(34,10),(38,10),(39,10),(40,10),(41,10),(45,10),(47,10),(48,10),(49,10),(50,10),(51,10),(52,10),(53,10),(54,10),(55,10),(56,10),(58,10),(59,10),(60,10),(66,10),(70,10),(71,10),(72,10),(74,10),(75,10),(76,10),(77,10),(78,10),(80,10),(81,10),(82,10),(83,10),(89,10),(90,10),(91,10),(92,10),(96,10),(97,10),(98,10),(99,10),(100,10),(101,10),(104,10),(105,10),(106,10),(108,10),(109,10),(111,10),(112,10),(114,10),(115,10),(116,10),(117,10),(118,10),(2,11),(3,11),(6,11),(31,11),(32,11),(36,11),(47,11),(48,11),(49,11),(50,11),(52,11),(53,11),(54,11),(55,11),(56,11),(57,11),(58,11),(60,11),(64,11),(65,11),(71,11),(76,11),(77,11),(78,11),(80,11),(90,11),(92,11),(94,11),(95,11),(96,11),(97,11),(98,11),(99,11),(100,11),(101,11),(102,11),(103,11),(104,11),(105,11),(109,11),(112,11),(113,11),(116,11),(117,11),(118,11),(119,11),(0,12),(3,12),(4,12),(6,12),(7,12),(8,12),(9,12),(11,12),(12,12),(13,12),(14,12),(16,12),(17,12),(18,12),(19,12),(21,12),(25,12),(26,12),(27,12),(28,12),(29,12),(30,12),(32,12),(39,12),(40,12),(44,12),(45,12),(48,12),(50,12),(51,12),(52,12),(53,12),(54,12),(56,12),(58,12),(59,12),(60,12),(61,12),(63,12),(64,12),(77,12),(78,12),(80,12),(82,12),(83,12),(84,12),(85,12),(89,12),(90,12),(94,12),(95,12),(96,12),(97,12),(98,12),(99,12),(100,12),(102,12),(105,12),(107,12),(109,12),(110,12),(111,12),(113,12),(114,12),(115,12),(117,12),(118,12),(119,12),(0,13),(1,13),(3,13),(4,13),(6,13),(7,13),(8,13),(9,13),(12,13),(13,13),(14,13),(15,13),(16,13),(17,13),(18,13),(19,13),(20,13),(21,13),(22,13),(24,13),(25,13),(27,13),(28,13),(29,13),(30,13),(31,13),(32,13),(33,13),(36,13),(37,13),(39,13),(42,13),(46,13),(47,13),(52,13),(53,13),(54,13),(56,13),(57,13),(58,13),(59,13),(61,13),(63,13),(78,13),(82,13),(83,13),(84,13),(85,13),(88,13),(89,13),(90,13),(94,13),(102,13),(104,13),(106,13),(109,13),(110,13),(111,13),(114,13),(115,13),(116,13),(4,14),(6,14),(7,14),(8,14),(10,14),(11,14),(12,14),(14,14),(15,14),(16,14),(17,14),(18,14),(19,14),(20,14),(21,14),(22,14),(23,14),(24,14),(25,14),(26,14),(27,14),(28,14),(29,14),(30,14),(31,14),(32,14),(33,14),(42,14),(50,14),(54,14),(56,14),(58,14),(62,14),(63,14),(79,14),(81,14),(82,14),(84,14),(85,14),(87,14),(88,14),(89,14),(90,14),(94,14),(102,14),(107,14),(109,14),(110,14),(111,14),(112,14),(113,14),(115,14),(116,14),(118,14),(0,15),(5,15),(6,15),(7,15),(8,15),(9,15),(10,15),(12,15),(13,15),(15,15),(16,15),(17,15),(18,15),(19,15),(20,15),(21,15),(22,15),(23,15),(24,15),(27,15),(29,15),(30,15),(31,15),(32,15),(35,15),(36,15),(38,15),(39,15),(41,15),(42,15),(43,15),(44,15),(45,15),(46,15),(47,15),(48,15),(52,15),(54,15),(60,15),(61,15),(62,15),(78,15),(80,15),(81,15),(82,15),(83,15),(84,15),(85,15),(94,15),(102,15),(104,15),(105,15),(108,15),(111,15),(112,15),(113,15),(114,15),(0,16),(2,16),(6,16),(7,16),(8,16),(9,16),(10,16),(11,16),(13,16),(16,16),(17,16),(18,16),(19,16),(20,16),(21,16),(22,16),(31,16),(34,16),(35,16),(36,16),(38,16),(43,16),(45,16),(46,16),(48,16),(49,16),(53,16),(55,16),(58,16),(59,16),(82,16),(91,16),(92,16),(94,16),(104,16),(105,16),(106,16),(108,16),(109,16),(112,16),(113,16),(114,16),(115,16),(116,16),(117,16),(119,16),(6,17),(7,17),(8,17),(9,17),(10,17),(14,17),(15,17),(17,17),(18,17),(19,17),(20,17),(21,17),(22,17),(23,17),(26,17),(27,17),(43,17),(44,17),(46,17),(47,17),(48,17),(49,17),(50,17),(51,17),(82,17),(87,17),(92,17),(104,17),(105,17),(106,17),(107,17),(110,17),(111,17),(112,17),(113,17),(114,17),(115,17),(116,17),(117,17),(118,17),(119,17),(0,18),(1,18),(2,18),(3,18),(4,18),(8,18),(9,18),(10,18),(11,18),(14,18),(15,18),(16,18),(17,18),(18,18),(19,18),(20,18),(21,18),(22,18),(25,18),(47,18),(48,18),(50,18),(51,18),(52,18),(53,18),(54,18),(55,18),(56,18),(57,18),(59,18),(92,18),(93,18),(105,18),(106,18),(107,18),(112,18),(113,18),(114,18),(115,18),(116,18),(117,18),(118,18),(119,18),(0,19),(2,19),(3,19),(4,19),(9,19),(10,19),(13,19),(14,19),(15,19),(17,19),(18,19),(19,19),(21,19),(22,19),(24,19),(48,19),(49,19),(50,19),(51,19),(54,19),(56,19),(57,19),(61,19),(79,19),(80,19),(91,19),(92,19),(105,19),(106,19),(109,19),(111,19),(112,19),(113,19),(114,19),(115,19),(116,19),(117,19),(118,19),(119,19),(0,20),(2,20),(3,20),(4,20),(5,20),(6,20),(10,20),(11,20),(13,20),(14,20),(15,20),(18,20),(19,20),(20,20),(21,20),(50,20),(51,20),(53,20),(55,20),(56,20),(57,20),(58,20),(61,20),(63,20),(74,20),(75,20),(76,20),(77,20),(79,20),(80,20),(81,20),(82,20),(86,20),(88,20),(92,20),(105,20),(106,20),(107,20),(111,20),(112,20),(115,20),(116,20),(118,20),(119,20),(1,21),(2,21),(3,21),(4,21),(5,21),(6,21),(7,21),(10,21),(11,21),(12,21),(13,21),(14,21),(17,21),(18,21),(19,21),(49,21),(51,21),(52,21),(53,21),(54,21),(55,21),(56,21),(57,21),(59,21),(62,21),(64,21),(65,21),(67,21),(71,21),(74,21),(76,21),(77,21),(79,21),(81,21),(82,21),(87,21),(88,21),(89,21),(105,21),(106,21),(107,21),(108,21),(0,22),(1,22),(2,22),(3,22),(4,22),(5,22),(6,22),(7,22),(10,22),(11,22),(12,22),(13,22),(14,22),(16,22),(17,22),(21,22),(22,22),(23,22),(52,22),(53,22),(54,22),(57,22),(60,22),(63,22),(64,22),(65,22),(66,22),(68,22),(70,22),(74,22),(78,22),(79,22),(80,22),(87,22),(88,22),(115,22),(116,22),(117,22),(118,22),(119,22),(0,23),(1,23),(2,23),(3,23),(4,23),(7,23),(11,23),(12,23),(14,23),(15,23),(16,23),(17,23),(21,23),(22,23),(50,23),(51,23),(53,23),(54,23),(56,23),(57,23),(59,23),(60,23),(61,23),(63,23),(64,23),(65,23),(66,23),(69,23),(72,23),(73,23),(74,23),(75,23),(77,23),(78,23),(89,23),(90,23),(96,23),(100,23),(102,23),(104,23),(105,23),(106,23),(109,23),(110,23),(111,23),(112,23),(114,23),(2,24),(3,24),(10,24),(11,24),(12,24),(13,24),(14,24),(15,24),(16,24),(20,24),(21,24),(22,24),(51,24),(52,24),(54,24),(55,24),(57,24),(58,24),(60,24),(61,24),(64,24),(65,24),(66,24),(68,24),(70,24),(72,24),(73,24),(74,24),(75,24),(76,24),(104,24),(106,24),(107,24),(109,24),(110,24),(111,24),(118,24),(0,25),(2,25),(3,25),(7,25),(9,25),(11,25),(12,25),(13,25),(14,25),(15,25),(16,25),(20,25),(21,25),(51,25),(53,25),(56,25),(57,25),(58,25),(61,25),(64,25),(65,25),(67,25),(69,25),(70,25),(77,25),(88,25),(89,25),(91,25),(93,25),(2,26),(3,26),(4,26),(9,26),(12,26),(13,26),(14,26),(15,26),(19,26),(20,26),(51,26),(52,26),(54,26),(55,26),(57,26),(59,26),(60,26),(63,26),(64,26),(67,26),(69,26),(70,26),(73,26),(74,26),(77,26),(78,26),(80,26),(81,26),(87,26),(88,26),(89,26),(90,26),(92,26),(97,26),(99,26),(1,27),(11,27),(13,27),(14,27),(18,27),(19,27),(50,27),(52,27),(53,27),(54,27),(55,27),(58,27),(60,27),(62,27),(65,27),(66,27),(67,27),(68,27),(72,27),(73,27),(77,27),(78,27),(81,27),(82,27),(85,27),(86,27),(90,27),(92,27),(93,27),(97,27),(98,27),(100,27),(101,27),(102,27),(103,27),(104,27),(105,27),(106,27),(107,27),(108,27),(112,27),(113,27),(114,27),(115,27),(119,27),(0,28),(1,28),(2,28),(8,28),(10,28),(14,28),(17,28),(18,28),(51,28),(52,28),(53,28),(54,28),(55,28),(56,28),(58,28),(59,28),(60,28),(65,28),(70,28),(71,28),(72,28),(73,28),(74,28),(75,28),(81,28),(83,28),(84,28),(85,28),(87,28),(88,28),(89,28),(90,28),(97,28),(109,28),(0,29),(1,29),(2,29),(3,29),(8,29),(11,29),(18,29),(51,29),(53,29),(54,29),(55,29),(59,29),(61,29),(64,29),(65,29),(66,29),(69,29),(70,29),(71,29),(74,29),(75,29),(76,29),(82,29),(84,29),(85,29),(86,29),(88,29),(89,29),(102,29),(103,29),(104,29),(105,29),(108,29),(109,29),(113,29),(114,29),(0,30),(16,30),(18,30),(19,30),(51,30),(52,30),(53,30),(54,30),(55,30),(56,30),(58,30),(59,30),(60,30),(61,30),(65,30),(69,30),(70,30),(71,30),(72,30),(75,30),(76,30),(77,30),(78,30),(79,30),(80,30),(85,30),(86,30),(88,30),(92,30),(94,30),(98,30),(100,30),(101,30),(102,30),(103,30),(104,30),(105,30),(107,30),(108,30),(111,30),(113,30),(114,30),(115,30),(117,30),(118,30),(0,31),(2,31),(3,31),(8,31),(9,31),(13,31),(19,31),(55,31),(58,31),(60,31),(61,31),(64,31),(68,31),(69,31),(70,31),(72,31),(73,31),(77,31),(78,31),(79,31),(80,31),(81,31),(82,31),(83,31),(87,31),(91,31),(93,31),(98,31),(100,31),(101,31),(102,31),(104,31),(105,31),(106,31),(107,31),(108,31),(110,31),(113,31),(114,31),(115,31),(0,32),(2,32),(3,32),(9,32),(10,32),(11,32),(17,32),(19,32),(54,32),(55,32),(58,32),(61,32),(63,32),(64,32),(65,32),(67,32),(68,32),(69,32),(70,32),(72,32),(74,32),(75,32),(76,32),(78,32),(79,32),(80,32),(81,32),(82,32),(83,32),(85,32),(86,32),(87,32),(91,32),(92,32),(94,32),(96,32),(97,32),(101,32),(104,32),(105,32),(106,32),(107,32),(108,32),(117,32),(118,32),(0,33),(11,33),(14,33),(17,33),(20,33),(54,33),(57,33),(58,33),(59,33),(60,33),(61,33),(64,33),(65,33),(68,33),(69,33),(71,33),(73,33),(74,33),(76,33),(81,33),(85,33),(86,33),(87,33),(94,33),(99,33),(105,33),(106,33),(107,33),(108,33),(111,33),(112,33),(113,33),(114,33),(116,33),(118,33),(0,34),(1,34),(14,34),(17,34),(20,34),(21,34),(57,34),(58,34),(59,34),(63,34),(64,34),(65,34),(67,34),(69,34),(70,34),(71,34),(73,34),(74,34),(75,34),(76,34),(77,34),(85,34),(100,34),(102,34),(110,34),(112,34),(118,34),(119,34),(1,35),(11,35),(17,35),(18,35),(21,35),(22,35),(56,35),(57,35),(58,35),(59,35),(60,35),(63,35),(64,35),(65,35),(70,35),(71,35),(72,35),(73,35),(74,35),(75,35),(79,35),(82,35),(85,35),(86,35),(87,35),(94,35),(99,35),(100,35),(101,35),(105,35),(4,36),(5,36),(6,36),(8,36),(11,36),(17,36),(19,36),(21,36),(23,36),(56,36),(57,36),(58,36),(59,36),(60,36),(63,36),(64,36),(68,36),(73,36),(79,36),(83,36),(84,36),(86,36),(92,36),(95,36),(96,36),(98,36),(105,36),(11,37),(13,37),(14,37),(15,37),(16,37),(18,37),(19,37),(22,37),(23,37),(56,37),(57,37),(58,37),(59,37),(62,37),(63,37),(65,37),(66,37),(72,37),(73,37),(75,37),(76,37),(78,37),(80,37),(82,37),(88,37),(3,38),(5,38),(6,38),(7,38),(8,38),(11,38),(17,38),(19,38),(23,38),(24,38),(55,38),(58,38),(59,38),(60,38),(63,38),(65,38),(68,38),(69,38),(71,38),(74,38),(75,38),(76,38),(77,38),(78,38),(80,38),(81,38),(94,38),(4,39),(5,39),(7,39),(8,39),(9,39),(12,39),(13,39),(14,39),(15,39),(17,39),(18,39),(20,39),(21,39),(54,39),(55,39),(56,39),(57,39),(58,39),(59,39),(60,39),(61,39),(64,39),(65,39),(69,39),(71,39),(72,39),(73,39),(75,39),(77,39),(79,39),(0,40),(1,40),(3,40),(4,40),(6,40),(7,40),(8,40),(9,40),(10,40),(13,40),(14,40),(17,40),(18,40),(19,40),(21,40),(22,40),(54,40),(55,40),(58,40),(59,40),(61,40),(63,40),(65,40),(66,40),(68,40),(69,40),(71,40),(75,40),(77,40),(78,40),(80,40),(0,41),(1,41),(4,41),(7,41),(8,41),(9,41),(10,41),(11,41),(17,41),(18,41),(19,41),(20,41),(21,41),(22,41),(23,41),(24,41),(25,41),(27,41),(29,41),(53,41),(54,41),(57,41),(58,41),(59,41),(63,41),(65,41),(67,41),(68,41),(69,41),(70,41),(72,41),(74,41),(75,41),(76,41),(77,41),(78,41),(0,42),(1,42),(3,42),(7,42),(8,42),(9,42),(10,42),(11,42),(12,42),(13,42),(14,42),(15,42),(16,42),(17,42),(18,42),(19,42),(20,42),(21,42),(22,42),(23,42),(24,42),(25,42),(26,42),(27,42),(30,42),(31,42),(52,42),(53,42),(54,42),(55,42),(56,42),(57,42),(59,42),(61,42),(64,42),(68,42),(70,42),(71,42),(72,42),(74,42),(76,42),(77,42),(2,43),(8,43),(9,43),(10,43),(11,43),(12,43),(13,43),(14,43),(15,43),(16,43),(17,43),(18,43),(19,43),(20,43),(21,43),(22,43),(23,43),(24,43),(25,43),(26,43),(27,43),(28,43),(35,43),(44,43),(51,43),(52,43),(53,43),(54,43),(55,43),(57,43),(60,43),(61,43),(63,43),(68,43),(70,43),(71,43),(72,43),(73,43),(76,43),(3,44),(4,44),(5,44),(6,44),(11,44),(15,44),(16,44),(17,44),(18,44),(19,44),(21,44),(23,44),(24,44),(25,44),(26,44),(27,44),(28,44),(29,44),(30,44),(32,44),(34,44),(35,44),(36,44),(37,44),(38,44),(39,44),(40,44),(42,44),(43,44),(45,44),(46,44),(48,44),(49,44),(50,44),(51,44),(52,44),(53,44),(54,44),(58,44),(63,44),(64,44),(65,44),(67,44),(68,44),(69,44),(71,44),(73,44),(74,44),(75,44),(0,45),(4,45),(6,45),(10,45),(12,45),(13,45),(16,45),(18,45),(19,45),(20,45),(21,45),(22,45),(23,45),(24,45),(26,45),(28,45),(29,45),(30,45),(32,45),(33,45),(34,45),(35,45),(36,45),(37,45),(39,45),(40,45),(43,45),(44,45),(45,45),(46,45),(47,45),(48,45),(50,45),(51,45),(52,45),(53,45),(54,45),(57,45),(61,45),(63,45),(66,45),(67,45),(68,45),(69,45),(71,45),(72,45),(74,45),(0,46),(1,46),(5,46),(7,46),(10,46),(13,46),(14,46),(15,46),(16,46),(17,46),(18,46),(20,46),(21,46),(22,46),(24,46),(25,46),(26,46),(27,46),(28,46),(29,46),(30,46),(33,46),(34,46),(36,46),(37,46),(38,46),(39,46),(40,46),(41,46),(42,46),(43,46),(44,46),(45,46),(49,46),(50,46),(51,46),(52,46),(54,46),(55,46),(57,46),(60,46),(62,46),(64,46),(66,46),(67,46),(71,46),(72,46),(73,46),(1,47),(2,47),(4,47),(5,47),(10,47),(11,47),(12,47),(14,47),(16,47),(19,47),(22,47),(23,47),(25,47),(26,47),(27,47),(28,47),(30,47),(33,47),(34,47),(36,47),(37,47),(39,47),(41,47),(42,47),(43,47),(44,47),(47,47),(50,47),(51,47),(53,47),(54,47),(55,47),(58,47),(60,47),(62,47),(63,47),(64,47),(66,47),(69,47),(71,47),(73,47),(0,48),(1,48),(2,48),(4,48),(5,48),(7,48),(10,48),(11,48),(12,48),(13,48),(14,48),(16,48),(17,48),(23,48),(24,48),(25,48),(26,48),(28,48),(29,48),(30,48),(32,48),(36,48),(37,48),(38,48),(39,48),(40,48),(41,48),(43,48),(46,48),(47,48),(48,48),(49,48),(51,48),(55,48),(58,48),(59,48),(62,48),(63,48),(64,48),(65,48),(67,48),(69,48),(70,48),(72,48),(74,48),(1,49),(2,49),(4,49),(5,49),(6,49),(10,49),(11,49),(12,49),(13,49),(14,49),(17,49),(20,49),(21,49),(22,49),(24,49),(25,49),(27,49),(28,49),(29,49),(30,49),(33,49),(34,49),(35,49),(37,49),(38,49),(39,49),(41,49),(45,49),(46,49),(51,49),(52,49),(53,49),(54,49),(55,49),(58,49),(59,49),(62,49),(63,49),(71,49),(72,49),(85,49),(86,49),(0,50),(2,50),(4,50),(5,50),(6,50),(7,50),(10,50),(12,50),(13,50),(14,50),(15,50),(20,50),(21,50),(24,50),(25,50),(27,50),(28,50),(29,50),(30,50),(34,50),(37,50),(38,50),(39,50),(41,50),(42,50),(43,50),(45,50),(48,50),(49,50),(50,50),(51,50),(52,50),(53,50),(54,50),(55,50),(58,50),(59,50),(60,50),(85,50),(87,50),(109,50),(116,50),(117,50),(118,50),(119,50),(0,51),(1,51),(2,51),(4,51),(5,51),(6,51),(7,51),(12,51),(13,51),(14,51),(15,51),(16,51),(17,51),(18,51),(23,51),(24,51),(25,51),(26,51),(27,51),(28,51),(29,51),(31,51),(32,51),(36,51),(37,51),(38,51),(39,51),(40,51),(42,51),(43,51),(47,51),(48,51),(52,51),(58,51),(112,51),(114,51),(117,51),(118,51),(119,51),(5,52),(7,52),(9,52),(10,52),(11,52),(13,52),(14,52),(15,52),(16,52),(17,52),(19,52),(20,52),(21,52),(22,52),(23,52),(24,52),(25,52),(26,52),(27,52),(29,52),(30,52),(31,52),(32,52),(34,52),(35,52),(37,52),(38,52),(40,52),(41,52),(42,52),(43,52),(45,52),(46,52),(50,52),(51,52),(52,52),(53,52),(54,52),(55,52),(56,52),(102,52),(107,52),(108,52),(114,52),(117,52),(118,52),(119,52),(0,53),(3,53),(4,53),(5,53),(7,53),(14,53),(15,53),(16,53),(17,53),(18,53),(19,53),(21,53),(23,53),(24,53),(25,53),(26,53),(28,53),(29,53),(30,53),(31,53),(32,53),(33,53),(35,53),(36,53),(37,53),(38,53),(39,53),(40,53),(43,53),(48,53),(49,53),(50,53),(51,53),(52,53),(105,53),(107,53),(108,53),(112,53),(113,53),(114,53),(115,53),(2,54),(5,54),(7,54),(8,54),(9,54),(15,54),(16,54),(18,54),(19,54),(20,54),(21,54),(22,54),(23,54),(24,54),(25,54),(27,54),(30,54),(31,54),(32,54),(33,54),(34,54),(35,54),(37,54),(38,54),(42,54),(44,54),(45,54),(46,54),(47,54),(48,54),(49,54),(50,54),(51,54),(95,54),(97,54),(98,54),(101,54),(103,54),(106,54),(107,54),(108,54),(109,54),(113,54),(114,54),(115,54),(116,54),(117,54),(118,54),(119,54),(0,55),(1,55),(2,55),(4,55),(5,55),(13,55),(14,55),(16,55),(17,55),(18,55),(19,55),(20,55),(21,55),(22,55),(24,55),(25,55),(27,55),(28,55),(29,55),(30,55),(31,55),(32,55),(33,55),(35,55),(36,55),(40,55),(43,55),(44,55),(46,55),(47,55),(48,55),(49,55),(94,55),(106,55),(107,55),(108,55),(109,55),(111,55),(114,55),(115,55),(4,56),(5,56),(8,56),(13,56),(14,56),(16,56),(17,56),(20,56),(21,56),(22,56),(23,56),(24,56),(25,56),(26,56),(27,56),(29,56),(30,56),(31,56),(34,56),(38,56),(39,56),(41,56),(42,56),(44,56),(45,56),(93,56),(94,56),(97,56),(99,56),(101,56),(102,56),(103,56),(108,56),(111,56),(115,56),(116,56),(117,56),(118,56),(119,56),(0,57),(4,57),(5,57),(11,57),(12,57),(13,57),(14,57),(19,57),(20,57),(21,57),(22,57),(25,57),(26,57),(27,57),(28,57),(29,57),(30,57),(34,57),(35,57),(36,57),(38,57),(39,57),(40,57),(41,57),(91,57),(96,57),(97,57),(98,57),(99,57),(100,57),(101,57),(102,57),(110,57),(116,57),(0,58),(1,58),(2,58),(3,58),(11,58),(14,58),(16,58),(17,58),(18,58),(19,58),(20,58),(21,58),(22,58),(23,58),(24,58),(25,58),(26,58),(27,58),(32,58),(33,58),(34,58),(35,58),(36,58),(37,58),(38,58),(39,58),(40,58),(91,58),(92,58),(95,58),(99,58),(100,58),(101,58),(105,58),(106,58),(107,58),(108,58),(113,58),(114,58),(115,58),(116,58),(117,58),(118,58),(0,59),(1,59),(8,59),(9,59),(13,59),(14,59),(17,59),(18,59),(19,59),(21,59),(22,59),(23,59),(24,59),(25,59),(29,59),(32,59),(33,59),(35,59),(36,59),(89,59),(90,59),(94,59),(95,59),(99,59),(100,59),(101,59),(102,59),(104,59),(110,59),(111,59),(113,59),(114,59),(115,59),(116,59),(2,60),(3,60),(6,60),(7,60),(11,60),(12,60),(13,60),(14,60),(16,60),(17,60),(18,60),(19,60),(20,60),(21,60),(22,60),(24,60),(27,60),(28,60),(29,60),(30,60),(32,60),(33,60),(34,60),(35,60),(89,60),(91,60),(93,60),(94,60),(96,60),(97,60),(98,60),(99,60),(100,60),(101,60),(105,60),(106,60),(110,60),(111,60),(113,60),(114,60),(115,60),(116,60),(117,60),(0,61),(1,61),(2,61),(3,61),(5,61),(9,61),(10,61),(11,61),(12,61),(13,61),(14,61),(17,61),(18,61),(19,61),(20,61),(21,61),(22,61),(27,61),(29,61),(31,61),(33,61),(86,61),(88,61),(89,61),(93,61),(96,61),(97,61),(98,61),(99,61),(100,61),(101,61),(103,61),(105,61),(106,61),(107,61),(109,61),(111,61),(116,61),(117,61),(118,61),(119,61),(1,62),(2,62),(3,62),(5,62),(7,62),(8,62),(9,62),(10,62),(11,62),(12,62),(16,62),(17,62),(18,62),(19,62),(20,62),(24,62),(25,62),(26,62),(28,62),(30,62),(31,62),(32,62),(76,62),(79,62),(83,62),(84,62),(85,62),(86,62),(87,62),(92,62),(93,62),(96,62),(98,62),(105,62),(107,62),(108,62),(109,62),(110,62),(111,62),(112,62),(117,62),(118,62),(119,62),(1,63),(2,63),(3,63),(6,63),(7,63),(8,63),(9,63),(10,63),(14,63),(15,63),(16,63),(18,63),(24,63),(25,63),(26,63),(27,63),(30,63),(70,63),(74,63),(75,63),(76,63),(86,63),(87,63),(88,63),(89,63),(91,63),(93,63),(102,63),(103,63),(105,63),(107,63),(108,63),(109,63),(110,63),(111,63),(112,63),(113,63),(115,63),(118,63),(119,63),(0,64),(2,64),(3,64),(6,64),(7,64),(8,64),(12,64),(13,64),(14,64),(16,64),(17,64),(18,64),(20,64),(22,64),(23,64),(25,64),(26,64),(68,64),(69,64),(70,64),(75,64),(78,64),(83,64),(89,64),(91,64),(92,64),(93,64),(97,64),(98,64),(99,64),(100,64),(103,64),(105,64),(110,64),(111,64),(112,64),(113,64),(114,64),(115,64),(118,64),(119,64),(1,65),(3,65),(5,65),(6,65),(10,65),(11,65),(13,65),(14,65),(15,65),(16,65),(20,65),(21,65),(23,65),(25,65),(26,65),(68,65),(69,65),(75,65),(78,65),(79,65),(80,65),(82,65),(83,65),(84,65),(85,65),(86,65),(93,65),(98,65),(100,65),(105,65),(106,65),(107,65),(108,65),(109,65),(111,65),(112,65),(113,65),(114,65),(115,65),(118,65),(119,65),(3,66),(5,66),(6,66),(9,66),(10,66),(11,66),(12,66),(13,66),(14,66),(18,66),(20,66),(21,66),(24,66),(69,66),(75,66),(78,66),(81,66),(82,66),(83,66),(84,66),(89,66),(90,66),(92,66),(96,66),(97,66),(99,66),(102,66),(106,66),(109,66),(110,66),(113,66),(114,66),(115,66),(119,66),(1,67),(2,67),(3,67),(5,67),(6,67),(8,67),(9,67),(10,67),(12,67),(13,67),(14,67),(15,67),(18,67),(20,67),(68,67),(75,67),(77,67),(80,67),(87,67),(88,67),(90,67),(92,67),(93,67),(96,67),(102,67),(104,67),(105,67),(107,67),(110,67),(111,67),(112,67),(113,67),(114,67),(117,67),(119,67),(2,68),(6,68),(8,68),(10,68),(11,68),(13,68),(17,68),(18,68),(19,68),(20,68),(58,68),(68,68),(69,68),(70,68),(74,68),(79,68),(83,68),(84,68),(90,68),(92,68),(93,68),(96,68),(97,68),(98,68),(99,68),(100,68),(101,68),(102,68),(103,68),(104,68),(105,68),(108,68),(114,68),(115,68),(118,68),(119,68),(5,69),(6,69),(8,69),(9,69),(10,69),(14,69),(16,69),(19,69),(57,69),(58,69),(68,69),(69,69),(70,69),(71,69),(72,69),(74,69),(75,69),(79,69),(80,69),(83,69),(84,69),(90,69),(91,69),(93,69),(96,69),(97,69),(98,69),(99,69),(100,69),(101,69),(102,69),(103,69),(104,69),(105,69),(108,69),(111,69),(113,69),(115,69),(116,69),(117,69),(119,69),(1,70),(2,70),(3,70),(6,70),(8,70),(9,70),(11,70),(12,70),(13,70),(17,70),(18,70),(19,70),(53,70),(54,70),(55,70),(59,70),(69,70),(70,70),(71,70),(72,70),(73,70),(74,70),(75,70),(76,70),(77,70),(78,70),(79,70),(83,70),(84,70),(85,70),(87,70),(88,70),(91,70),(93,70),(97,70),(98,70),(99,70),(100,70),(101,70),(102,70),(103,70),(104,70),(105,70),(107,70),(112,70),(115,70),(116,70),(117,70),(0,71),(1,71),(2,71),(3,71),(5,71),(6,71),(9,71),(10,71),(11,71),(12,71),(16,71),(17,71),(18,71),(46,71),(48,71),(49,71),(50,71),(51,71),(52,71),(53,71),(57,71),(59,71),(69,71),(70,71),(71,71),(72,71),(73,71),(74,71),(75,71),(76,71),(77,71),(78,71),(83,71),(84,71),(85,71),(87,71),(88,71),(95,71),(96,71),(97,71),(98,71),(100,71),(101,71),(102,71),(103,71),(104,71),(105,71),(106,71),(113,71),(115,71),(116,71),(117,71),(119,71),(2,72),(3,72),(5,72),(6,72),(8,72),(9,72),(10,72),(11,72),(12,72),(14,72),(15,72),(17,72),(44,72),(45,72),(46,72),(50,72),(53,72),(56,72),(71,72),(75,72),(76,72),(77,72),(84,72),(85,72),(88,72),(91,72),(92,72),(98,72),(99,72),(100,72),(101,72),(102,72),(103,72),(104,72),(105,72),(108,72),(110,72),(111,72),(112,72),(115,72),(116,72),(117,72),(118,72),(119,72),(0,73),(5,73),(8,73),(9,73),(11,73),(14,73),(15,73),(17,73),(48,73),(50,73),(51,73),(52,73),(53,73),(55,73),(56,73),(70,73),(72,73),(73,73),(74,73),(75,73),(85,73),(86,73),(87,73),(91,73),(92,73),(95,73),(96,73),(104,73),(105,73),(108,73),(109,73),(112,73),(116,73),(117,73),(118,73),(119,73),(5,74),(7,74),(8,74),(9,74),(10,74),(11,74),(14,74),(16,74),(17,74),(18,74),(40,74),(46,74),(47,74),(53,74),(55,74),(56,74),(58,74),(72,74),(74,74),(84,74),(86,74),(89,74),(91,74),(96,74),(97,74),(98,74),(99,74),(100,74),(102,74),(105,74),(107,74),(109,74),(110,74),(111,74),(112,74),(114,74),(117,74),(118,74),(119,74),(4,75),(6,75),(7,75),(8,75),(10,75),(11,75),(12,75),(15,75),(16,75),(18,75),(46,75),(47,75),(48,75),(49,75),(51,75),(53,75),(54,75),(58,75),(70,75),(71,75),(72,75),(73,75),(84,75),(85,75),(86,75),(93,75),(95,75),(97,75),(98,75),(99,75),(100,75),(101,75),(105,75),(107,75),(108,75),(109,75),(110,75),(111,75),(112,75),(114,75),(117,75),(119,75),(4,76),(7,76),(8,76),(9,76),(11,76),(12,76),(13,76),(16,76),(17,76),(18,76),(45,76),(48,76),(49,76),(54,76),(58,76),(59,76),(70,76),(71,76),(72,76),(84,76),(85,76),(94,76),(95,76),(96,76),(100,76),(101,76),(102,76),(103,76),(105,76),(107,76),(108,76),(109,76),(110,76),(111,76),(112,76),(115,76),(117,76),(119,76),(0,77),(2,77),(3,77),(4,77),(5,77),(6,77),(8,77),(9,77),(12,77),(13,77),(17,77),(43,77),(44,77),(45,77),(46,77),(49,77),(50,77),(51,77),(53,77),(54,77),(55,77),(56,77),(70,77),(83,77),(85,77),(95,77),(98,77),(99,77),(102,77),(103,77),(105,77),(106,77),(109,77),(110,77),(111,77),(112,77),(113,77),(115,77),(117,77),(118,77),(119,77),(0,78),(1,78),(2,78),(3,78),(4,78),(5,78),(6,78),(7,78),(16,78),(47,78),(52,78),(54,78),(71,78),(83,78),(84,78),(97,78),(98,78),(99,78),(100,78),(103,78),(106,78),(107,78),(108,78),(110,78),(111,78),(112,78),(113,78),(114,78),(117,78),(118,78),(119,78),(0,79),(1,79),(2,79),(3,79),(4,79),(5,79),(6,79),(12,79),(13,79),(14,79),(16,79),(17,79),(18,79),(51,79),(52,79),(53,79),(59,79),(70,79),(71,79),(72,79),(82,79),(83,79),(85,79),(86,79),(96,79),(99,79),(100,79),(101,79),(104,79),(108,79),(109,79),(110,79),(114,79),(117,79),(118,79),(119,79),(0,80),(1,80),(2,80),(3,80),(4,80),(5,80),(6,80),(8,80),(11,80),(13,80),(17,80),(18,80),(19,80),(53,80),(59,80),(70,80),(72,80),(82,80),(83,80),(84,80),(95,80),(96,80),(97,80),(100,80),(101,80),(104,80),(105,80),(106,80),(110,80),(111,80),(112,80),(114,80),(117,80),(118,80),(119,80),(0,81),(1,81),(2,81),(3,81),(4,81),(5,81),(6,81),(8,81),(10,81),(11,81),(12,81),(16,81),(17,81),(18,81),(19,81),(56,81),(58,81),(59,81),(70,81),(72,81),(78,81),(80,81),(81,81),(83,81),(84,81),(85,81),(86,81),(87,81),(97,81),(98,81),(99,81),(102,81),(105,81),(106,81),(107,81),(108,81),(112,81),(117,81),(118,81),(119,81),(0,82),(10,82),(12,82),(18,82),(19,82),(20,82),(70,82),(72,82),(73,82),(74,82),(75,82),(77,82),(78,82),(80,82),(81,82),(82,82),(83,82),(85,82),(86,82),(88,82),(89,82),(90,82),(97,82),(98,82),(99,82),(100,82),(101,82),(103,82),(105,82),(108,82),(110,82),(112,82),(117,82),(118,82),(119,82),(8,83),(11,83),(13,83),(14,83),(15,83),(18,83),(20,83),(70,83),(71,83),(72,83),(73,83),(75,83),(76,83),(77,83),(78,83),(79,83),(80,83),(81,83),(82,83),(83,83),(84,83),(85,83),(86,83),(89,83),(91,83),(92,83),(94,83),(96,83),(97,83),(98,83),(99,83),(101,83),(102,83),(105,83),(106,83),(108,83),(109,83),(110,83),(112,83),(115,83),(8,84),(15,84),(16,84),(19,84),(21,84),(68,84),(69,84),(70,84),(71,84),(79,84),(81,84),(82,84),(90,84),(92,84),(94,84),(96,84),(97,84),(98,84),(101,84),(102,84),(103,84),(104,84),(106,84),(110,84),(112,84),(116,84),(118,84),(119,84),(8,85),(10,85),(11,85),(13,85),(14,85),(17,85),(20,85),(21,85),(22,85),(23,85),(68,85),(69,85),(75,85),(76,85),(78,85),(79,85),(80,85),(81,85),(90,85),(91,85),(93,85),(95,85),(96,85),(97,85),(100,85),(101,85),(103,85),(104,85),(107,85),(108,85),(109,85),(110,85),(112,85),(113,85),(114,85),(118,85),(8,86),(9,86),(10,86),(12,86),(16,86),(17,86),(18,86),(22,86),(24,86),(25,86),(67,86),(68,86),(72,86),(75,86),(78,86),(79,86),(80,86),(90,86),(91,86),(93,86),(94,86),(95,86),(97,86),(98,86),(99,86),(101,86),(102,86),(104,86),(105,86),(106,86),(108,86),(109,86),(110,86),(112,86),(113,86),(114,86),(115,86),(8,87),(10,87),(12,87),(17,87),(18,87),(19,87),(26,87),(27,87),(67,87),(68,87),(70,87),(71,87),(72,87),(73,87),(78,87),(79,87),(89,87),(91,87),(92,87),(93,87),(94,87),(95,87),(99,87),(101,87),(103,87),(104,87),(108,87),(109,87),(110,87),(112,87),(113,87),(114,87),(115,87),(8,88),(9,88),(13,88),(15,88),(16,88),(17,88),(18,88),(20,88),(21,88),(24,88),(28,88),(67,88),(68,88),(70,88),(71,88),(72,88),(73,88),(74,88),(77,88),(78,88),(89,88),(91,88),(92,88),(93,88),(100,88),(101,88),(102,88),(104,88),(106,88),(109,88),(110,88),(113,88),(114,88),(115,88),(116,88),(119,88),(8,89),(9,89),(11,89),(15,89),(16,89),(18,89),(19,89),(20,89),(21,89),(22,89),(23,89),(25,89),(26,89),(29,89),(30,89),(31,89),(67,89),(68,89),(70,89),(71,89),(72,89),(73,89),(74,89),(75,89),(88,89),(91,89),(92,89),(101,89),(103,89),(105,89),(106,89),(109,89),(110,89),(111,89),(114,89),(115,89),(116,89),(9,90),(11,90),(12,90),(15,90),(16,90),(17,90),(18,90),(19,90),(21,90),(23,90),(25,90),(26,90),(29,90),(30,90),(31,90),(32,90),(33,90),(35,90),(36,90),(37,90),(70,90),(71,90),(72,90),(73,90),(74,90),(75,90),(77,90),(89,90),(90,90),(91,90),(92,90),(101,90),(102,90),(103,90),(104,90),(105,90),(108,90),(110,90),(111,90),(112,90),(116,90),(117,90),(118,90),(8,91),(10,91),(14,91),(18,91),(20,91),(21,91),(23,91),(25,91),(28,91),(30,91),(31,91),(32,91),(33,91),(35,91),(36,91),(37,91),(38,91),(39,91),(40,91),(41,91),(42,91),(69,91),(71,91),(72,91),(73,91),(74,91),(75,91),(78,91),(80,91),(84,91),(86,91),(92,91),(102,91),(107,91),(108,91),(109,91),(110,91),(111,91),(112,91),(113,91),(114,91),(118,91),(119,91),(9,92),(10,92),(11,92),(12,92),(13,92),(14,92),(15,92),(19,92),(20,92),(24,92),(28,92),(29,92),(37,92),(39,92),(71,92),(72,92),(73,92),(74,92),(75,92),(76,92),(78,92),(79,92),(80,92),(81,92),(82,92),(83,92),(84,92),(85,92),(86,92),(88,92),(89,92),(90,92),(94,92),(95,92),(101,92),(104,92),(105,92),(106,92),(107,92),(108,92),(109,92),(110,92),(111,92),(112,92),(113,92),(114,92),(115,92),(116,92),(9,93),(10,93),(11,93),(12,93),(13,93),(15,93),(17,93),(20,93),(21,93),(22,93),(27,93),(28,93),(31,93),(32,93),(33,93),(34,93),(38,93),(41,93),(42,93),(47,93),(69,93),(72,93),(73,93),(75,93),(76,93),(85,93),(88,93),(89,93),(90,93),(93,93),(95,93),(101,93),(103,93),(104,93),(105,93),(106,93),(107,93),(108,93),(109,93),(110,93),(111,93),(112,93),(113,93),(118,93),(9,94),(10,94),(11,94),(13,94),(14,94),(15,94),(17,94),(18,94),(19,94),(21,94),(22,94),(23,94),(24,94),(27,94),(28,94),(30,94),(31,94),(32,94),(33,94),(34,94),(35,94),(36,94),(38,94),(41,94),(44,94),(48,94),(49,94),(69,94),(73,94),(74,94),(75,94),(78,94),(79,94),(80,94),(82,94),(87,94),(93,94),(94,94),(95,94),(96,94),(101,94),(102,94),(104,94),(105,94),(107,94),(108,94),(109,94),(111,94),(112,94),(115,94),(116,94),(117,94),(118,94),(119,94),(9,95),(10,95),(11,95),(12,95),(13,95),(14,95),(15,95),(16,95),(17,95),(18,95),(19,95),(26,95),(27,95),(30,95),(31,95),(32,95),(33,95),(34,95),(35,95),(36,95),(41,95),(42,95),(46,95),(48,95),(49,95),(69,95),(73,95),(74,95),(75,95),(76,95),(79,95),(80,95),(81,95),(82,95),(85,95),(86,95),(91,95),(92,95),(93,95),(94,95),(95,95),(96,95),(101,95),(102,95),(105,95),(106,95),(108,95),(109,95),(111,95),(114,95),(115,95),(116,95),(117,95),(118,95),(119,95),(9,96),(10,96),(11,96),(12,96),(13,96),(14,96),(15,96),(16,96),(17,96),(19,96),(21,96),(22,96),(24,96),(25,96),(26,96),(27,96),(28,96),(39,96),(40,96),(44,96),(45,96),(48,96),(49,96),(69,96),(70,96),(76,96),(77,96),(78,96),(79,96),(81,96),(83,96),(84,96),(89,96),(90,96),(91,96),(92,96),(93,96),(94,96),(95,96),(96,96),(102,96),(103,96),(104,96),(114,96),(115,96),(116,96),(117,96),(118,96),(119,96),(9,97),(10,97),(11,97),(12,97),(13,97),(14,97),(15,97),(16,97),(17,97),(18,97),(19,97),(20,97),(21,97),(22,97),(23,97),(24,97),(25,97),(26,97),(27,97),(28,97),(31,97),(35,97),(38,97),(39,97),(40,97),(41,97),(42,97),(43,97),(49,97),(69,97),(70,97),(73,97),(74,97),(79,97),(82,97),(86,97),(87,97),(88,97),(89,97),(90,97),(91,97),(92,97),(93,97),(94,97),(95,97),(96,97),(101,97),(102,97),(104,97),(105,97),(106,97),(107,97),(108,97),(109,97),(110,97),(112,97),(113,97),(114,97),(115,97),(116,97),(117,97),(118,97),(119,97),(9,98),(10,98),(11,98),(12,98),(13,98),(14,98),(15,98),(16,98),(17,98),(18,98),(19,98),(20,98),(21,98),(22,98),(23,98),(24,98),(25,98),(26,98),(27,98),(28,98),(31,98),(33,98),(34,98),(35,98),(38,98),(39,98),(40,98),(41,98),(42,98),(43,98),(44,98),(46,98),(47,98),(49,98),(70,98),(71,98),(73,98),(74,98),(76,98),(77,98),(78,98),(80,98),(82,98),(83,98),(85,98),(86,98),(87,98),(88,98),(89,98),(90,98),(91,98),(92,98),(93,98),(95,98),(96,98),(101,98),(102,98),(103,98),(104,98),(105,98),(106,98),(107,98),(108,98),(109,98),(111,98),(112,98),(113,98),(114,98),(115,98),(116,98),(117,98),(118,98),(119,98),(10,99),(11,99),(12,99),(13,99),(14,99),(15,99),(16,99),(17,99),(18,99),(19,99),(20,99),(21,99),(22,99),(23,99),(24,99),(25,99),(26,99),(27,99),(29,99),(30,99),(31,99),(32,99),(33,99),(34,99),(35,99),(36,99),(37,99),(38,99),(39,99),(40,99),(41,99),(42,99),(43,99),(44,99),(45,99),(46,99),(47,99),(48,99),(69,99),(70,99),(71,99),(72,99),(73,99),(74,99),(75,99),(76,99),(77,99),(78,99),(79,99),(80,99),(81,99),(82,99),(83,99),(84,99),(85,99),(86,99),(87,99),(88,99),(89,99),(90,99),(91,99),(92,99),(101,99),(102,99),(103,99),(104,99),(105,99),(106,99),(107,99),(108,99),(109,99),(110,99),(111,99),(112,99),(113,99),(114,99),(115,99),(116,99),(117,99),(11,100),(12,100),(13,100),(14,100),(15,100),(16,100),(17,100),(18,100),(19,100),(20,100),(21,100),(22,100),(23,100),(24,100),(25,100),(26,100),(27,100),(28,100),(29,100),(30,100),(31,100),(32,100),(33,100),(34,100),(35,100),(36,100),(37,100),(38,100),(39,100),(40,100),(41,100),(42,100),(43,100),(44,100),(45,100),(46,100),(47,100),(48,100),(49,100),(70,100),(71,100),(72,100),(73,100),(74,100),(75,100),(76,100),(77,100),(78,100),(79,100),(80,100),(81,100),(82,100),(83,100),(84,100),(85,100),(86,100),(87,100),(88,100),(89,100),(90,100),(91,100),(101,100),(102,100),(103,100),(104,100),(105,100),(106,100),(107,100),(108,100),(109,100),(110,100),(111,100),(112,100),(113,100),(114,100),(115,100),(116,100),(12,101),(13,101),(14,101),(15,101),(16,101),(17,101),(18,101),(19,101),(20,101),(21,101),(22,101),(23,101),(24,101),(25,101),(26,101),(27,101),(28,101),(29,101),(30,101),(31,101),(32,101),(33,101),(34,101),(35,101),(36,101),(37,101),(38,101),(39,101),(40,101),(41,101),(42,101),(43,101),(44,101),(45,101),(46,101),(47,101),(48,101),(70,101),(71,101),(72,101),(73,101),(74,101),(75,101),(76,101),(77,101),(78,101),(79,101),(80,101),(81,101),(82,101),(83,101),(84,101),(85,101),(86,101),(87,101),(88,101),(89,101),(90,101),(91,101),(92,101),(94,101),(95,101),(98,101),(99,101),(100,101),(101,101),(102,101),(103,101),(104,101),(105,101),(106,101),(107,101),(108,101),(109,101),(110,101),(111,101),(112,101),(113,101),(114,101),(115,101),(13,102),(14,102),(15,102),(16,102),(17,102),(18,102),(19,102),(20,102),(21,102),(22,102),(23,102),(24,102),(25,102),(26,102),(27,102),(28,102),(29,102),(30,102),(31,102),(32,102),(33,102),(34,102),(35,102),(36,102),(37,102),(38,102),(39,102),(40,102),(41,102),(42,102),(43,102),(44,102),(45,102),(46,102),(47,102),(48,102),(70,102),(71,102),(72,102),(73,102),(74,102),(75,102),(76,102),(77,102),(78,102),(79,102),(80,102),(81,102),(82,102),(83,102),(84,102),(85,102),(86,102),(87,102),(88,102),(89,102),(90,102),(91,102),(92,102),(93,102),(95,102),(96,102),(97,102),(98,102),(99,102),(100,102),(101,102),(102,102),(103,102),(104,102),(105,102),(106,102),(107,102),(108,102),(109,102),(110,102),(111,102),(112,102),(113,102),(114,102),(115,102),(26,103),(27,103),(28,103),(29,103),(30,103),(31,103),(32,103),(33,103),(34,103),(35,103),(36,103),(37,103),(38,103),(39,103),(40,103),(41,103),(42,103),(43,103),(44,103),(45,103),(46,103),(47,103),(48,103),(70,103),(71,103),(72,103),(73,103),(74,103),(75,103),(76,103),(77,103),(78,103),(79,103),(80,103),(81,103),(82,103),(83,103),(84,103),(85,103),(86,103),(87,103),(88,103),(89,103),(107,103),(108,103),(109,103),(110,103),(111,103),(112,103),(113,103),(114,103),(26,104),(27,104),(28,104),(29,104),(30,104),(31,104),(32,104),(33,104),(34,104),(35,104),(36,104),(37,104),(38,104),(39,104),(40,104),(41,104),(42,104),(43,104),(44,104),(45,104),(46,104),(47,104),(48,104),(70,104),(71,104),(72,104),(73,104),(74,104),(75,104),(76,104),(77,104),(78,104),(79,104),(80,104),(81,104),(82,104),(83,104),(84,104),(85,104),(86,104),(87,104),(88,104),(89,104),(107,104),(108,104),(109,104),(110,104),(111,104),(112,104),(113,104),(26,105),(27,105),(28,105),(29,105),(30,105),(31,105),(32,105),(33,105),(34,105),(35,105),(36,105),(45,105),(46,105),(47,105),(48,105),(70,105),(71,105),(72,105),(73,105),(74,105),(75,105),(76,105),(77,105),(78,105),(79,105),(80,105),(81,105),(82,105),(83,105),(84,105),(85,105),(109,105),(110,105),(111,105),(26,106),(27,106),(28,106),(29,106),(30,106),(31,106),(32,106),(33,106),(34,106),(35,106),(36,106),(45,106),(46,106),(47,106),(48,106),(70,106),(71,106),(72,106),(73,106),(74,106),(75,106),(76,106),(77,106),(78,106),(79,106),(80,106),(81,106),(82,106),(83,106),(84,106),(85,106),(109,106),(110,106)}
location.alwaysFront = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(42,0),(43,0),(44,0),(62,0),(63,0),(64,0),(77,0),(78,0),(84,0),(85,0),(86,0),(90,0),(91,0),(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(53,1),(54,1),(55,1),(62,1),(63,1),(64,1),(84,1),(85,1),(86,1),(0,2),(1,2),(2,2),(3,2),(4,2),(5,2),(6,2),(7,2),(8,2),(9,2),(10,2),(11,2),(12,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(29,2),(30,2),(31,2),(53,2),(54,2),(55,2),(79,2),(80,2),(81,2),(82,2),(83,2),(84,2),(85,2),(86,2),(87,2),(88,2),(89,2),(94,2),(96,2),(97,2),(98,2),(101,2),(102,2),(103,2),(104,2),(105,2),(106,2),(111,2),(112,2),(113,2),(114,2),(115,2),(116,2),(117,2),(118,2),(119,2),(0,3),(1,3),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(8,3),(9,3),(10,3),(11,3),(12,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(29,3),(30,3),(31,3),(38,3),(39,3),(40,3),(41,3),(53,3),(54,3),(55,3),(79,3),(80,3),(81,3),(82,3),(83,3),(84,3),(85,3),(86,3),(87,3),(88,3),(89,3),(94,3),(96,3),(97,3),(98,3),(101,3),(102,3),(103,3),(104,3),(105,3),(106,3),(111,3),(112,3),(113,3),(114,3),(115,3),(116,3),(117,3),(118,3),(119,3),(5,4),(6,4),(7,4),(8,4),(9,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(29,4),(30,4),(31,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(53,4),(54,4),(55,4),(79,4),(80,4),(81,4),(82,4),(83,4),(84,4),(85,4),(87,4),(88,4),(89,4),(94,4),(96,4),(97,4),(98,4),(101,4),(102,4),(103,4),(104,4),(105,4),(106,4),(111,4),(112,4),(113,4),(114,4),(115,4),(116,4),(117,4),(118,4),(119,4),(6,5),(7,5),(8,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(18,5),(19,5),(20,5),(21,5),(29,5),(30,5),(31,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(53,5),(54,5),(55,5),(79,5),(80,5),(81,5),(82,5),(83,5),(84,5),(87,5),(88,5),(89,5),(94,5),(96,5),(97,5),(98,5),(101,5),(102,5),(103,5),(104,5),(105,5),(106,5),(111,5),(112,5),(113,5),(114,5),(115,5),(116,5),(117,5),(118,5),(119,5),(7,6),(8,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(42,6),(43,6),(81,6),(82,6),(93,6),(103,6),(104,6),(0,7),(36,7),(37,7),(38,7),(39,7),(40,7),(41,7),(42,7),(43,7),(81,7),(82,7),(83,7),(93,7),(94,7),(95,7),(96,7),(97,7),(98,7),(99,7),(100,7),(101,7),(102,7),(106,7),(107,7),(108,7),(0,8),(81,8),(82,8),(83,8),(93,8),(94,8),(95,8),(96,8),(97,8),(98,8),(99,8),(100,8),(101,8),(102,8),(103,8),(104,8),(105,8),(106,8),(107,8),(108,8),(0,9),(81,9),(82,9),(83,9),(86,9),(88,9),(93,9),(94,9),(95,9),(96,9),(97,9),(98,9),(99,9),(100,9),(101,9),(102,9),(103,9),(104,9),(105,9),(106,9),(107,9),(108,9),(111,9),(112,9),(114,9),(115,9),(116,9),(117,9),(118,9),(119,9),(0,10),(85,10),(86,10),(87,10),(88,10),(89,10),(90,10),(91,10),(92,10),(117,10),(118,10),(119,10),(0,11),(1,11),(2,11),(85,11),(86,11),(87,11),(88,11),(89,11),(90,11),(91,11),(100,11),(117,11),(118,11),(119,11),(0,12),(1,12),(2,12),(85,12),(86,12),(87,12),(88,12),(89,12),(90,12),(91,12),(100,12),(117,12),(118,12),(119,12),(0,13),(1,13),(2,13),(100,13),(101,13),(117,13),(118,13),(119,13),(0,14),(1,14),(2,14),(100,14),(109,14),(110,14),(111,14),(112,14),(113,14),(114,14),(1,15),(4,15),(5,15),(6,15),(7,15),(109,15),(110,15),(111,15),(112,15),(113,15),(114,15),(4,16),(5,16),(6,16),(104,16),(105,16),(106,16),(109,16),(110,16),(111,16),(112,16),(113,16),(114,16),(0,17),(4,17),(5,17),(6,17),(7,17),(104,17),(105,17),(106,17),(109,17),(110,17),(111,17),(112,17),(113,17),(114,17),(0,18),(4,18),(5,18),(6,18),(7,18),(104,18),(105,18),(106,18),(0,19),(4,19),(5,19),(6,19),(7,19),(104,19),(105,19),(106,19),(0,20),(4,20),(5,20),(6,20),(7,20),(105,20),(4,21),(5,21),(6,21),(7,21),(4,22),(5,22),(6,22),(7,22),(117,25),(118,25),(119,25),(110,26),(111,26),(112,26),(117,26),(118,26),(119,26),(101,27),(102,27),(103,27),(104,27),(105,27),(106,27),(107,27),(108,27),(110,27),(111,27),(112,27),(117,27),(118,27),(119,27),(101,28),(102,28),(105,28),(110,28),(111,28),(112,28),(117,28),(118,28),(119,28),(13,29),(14,29),(15,29),(109,29),(110,29),(111,29),(112,29),(117,29),(118,29),(119,29),(0,30),(1,30),(2,30),(13,30),(14,30),(15,30),(0,31),(1,31),(2,31),(13,31),(14,31),(15,31),(0,32),(1,32),(2,32),(13,32),(14,32),(15,32),(0,33),(1,33),(2,33),(13,33),(14,33),(15,33),(0,34),(0,35),(0,36),(0,37),(1,37),(2,37),(0,38),(1,38),(2,38),(0,39),(1,39),(2,39),(0,40),(1,40),(2,40),(5,42),(6,42),(7,42),(8,42),(110,45),(111,45),(112,45),(113,45),(114,45),(115,45),(0,46),(1,46),(110,46),(111,46),(112,46),(113,46),(114,46),(115,46),(0,47),(1,47),(110,47),(111,47),(112,47),(113,47),(114,47),(115,47),(0,48),(1,48),(110,48),(111,48),(112,48),(113,48),(114,48),(115,48),(0,49),(1,49),(100,49),(101,49),(102,49),(107,49),(108,49),(109,49),(0,50),(1,50),(6,50),(7,50),(8,50),(9,50),(10,50),(11,50),(100,50),(101,50),(102,50),(107,50),(108,50),(109,50),(0,51),(1,51),(6,51),(7,51),(8,51),(9,51),(10,51),(11,51),(100,51),(101,51),(102,51),(107,51),(108,51),(109,51),(6,52),(7,52),(8,52),(9,52),(10,52),(11,52),(100,52),(101,52),(102,52),(107,52),(108,52),(109,52),(6,53),(7,53),(8,53),(9,53),(10,53),(11,53),(107,53),(108,53),(117,54),(118,54),(119,54),(106,55),(107,55),(108,55),(117,55),(118,55),(119,55),(101,56),(106,56),(107,56),(108,56),(114,56),(115,56),(116,56),(117,56),(118,56),(119,56),(106,57),(107,57),(108,57),(114,57),(115,57),(116,57),(117,57),(118,57),(119,57),(94,58),(95,58),(96,58),(97,58),(98,58),(99,58),(100,58),(101,58),(102,58),(106,58),(107,58),(108,58),(114,58),(115,58),(116,58),(94,59),(95,59),(96,59),(97,59),(98,59),(99,59),(100,59),(101,59),(102,59),(114,59),(115,59),(116,59),(2,60),(3,60),(4,60),(94,60),(95,60),(96,60),(97,60),(98,60),(99,60),(100,60),(101,60),(102,60),(2,61),(3,61),(4,61),(94,61),(95,61),(96,61),(97,61),(98,61),(99,61),(100,61),(101,61),(102,61),(117,61),(118,61),(119,61),(2,62),(3,62),(4,62),(98,62),(99,62),(100,62),(117,62),(118,62),(119,62),(0,63),(1,63),(2,63),(3,63),(4,63),(98,63),(99,63),(100,63),(117,63),(118,63),(119,63),(0,64),(1,64),(2,64),(3,64),(4,64),(98,64),(99,64),(100,64),(117,64),(118,64),(119,64),(0,65),(1,65),(2,65),(3,65),(4,65),(98,65),(99,65),(100,65),(108,65),(109,65),(110,65),(111,65),(112,65),(113,65),(0,66),(1,66),(108,66),(109,66),(110,66),(111,66),(112,66),(113,66),(105,67),(106,67),(107,67),(108,67),(109,67),(110,67),(111,67),(112,67),(113,67),(1,68),(2,68),(3,68),(105,68),(106,68),(107,68),(108,68),(109,68),(110,68),(111,68),(112,68),(113,68),(119,68),(1,69),(2,69),(3,69),(105,69),(106,69),(107,69),(119,69),(105,70),(106,70),(107,70),(119,70),(113,71),(114,71),(115,71),(119,71),(113,72),(114,72),(115,72),(113,73),(114,73),(115,73),(113,74),(114,74),(115,74),(114,78),(115,78),(116,78),(117,78),(118,78),(119,78),(114,79),(115,79),(116,79),(117,79),(118,79),(119,79),(114,80),(115,80),(116,80),(117,80),(118,80),(119,80),(114,81),(115,81),(116,81),(117,81),(118,81),(119,81),(118,87),(33,88),(34,88),(35,88),(32,89),(33,89),(34,89),(35,89),(32,90),(33,90),(34,90),(35,90),(36,90),(32,91),(33,91),(34,91),(35,91),(36,91),(30,92),(31,92),(32,92),(33,92),(34,92),(35,92),(36,92)}
location.front = {(27,0),(28,0),(29,0),(32,0),(33,0),(34,0),(36,0),(37,0),(38,0),(40,0),(41,0),(43,0),(46,0),(49,0),(50,0),(51,0),(55,0),(65,0),(80,0),(81,0),(82,0),(93,0),(94,0),(95,0),(109,0),(110,0),(111,0),(117,0),(118,0),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(39,1),(43,1),(44,1),(45,1),(52,1),(62,1),(76,1),(79,1),(83,1),(87,1),(88,1),(89,1),(25,2),(26,2),(27,2),(34,2),(35,2),(42,2),(44,2),(45,2),(59,2),(60,2),(61,2),(63,2),(88,2),(89,2),(115,2),(116,2),(27,3),(28,3),(34,3),(35,3),(43,3),(47,3),(49,3),(50,3),(51,3),(56,3),(57,3),(60,3),(61,3),(63,3),(64,3),(65,3),(84,3),(90,3),(115,3),(116,3),(0,4),(1,4),(2,4),(23,4),(26,4),(27,4),(28,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(52,4),(56,4),(57,4),(61,4),(62,4),(63,4),(66,4),(24,5),(26,5),(27,5),(28,5),(47,5),(48,5),(57,5),(58,5),(59,5),(60,5),(87,5),(88,5),(89,5),(96,5),(97,5),(98,5),(99,5),(100,5),(101,5),(117,5),(118,5),(119,5),(8,6),(16,6),(17,6),(19,6),(21,6),(22,6),(30,6),(31,6),(49,6),(51,6),(52,6),(60,6),(64,6),(65,6),(84,6),(85,6),(86,6),(87,6),(88,6),(96,6),(97,6),(98,6),(113,6),(114,6),(118,6),(0,7),(15,7),(16,7),(17,7),(20,7),(51,7),(52,7),(53,7),(58,7),(65,7),(85,7),(86,7),(90,7),(116,7),(117,7),(0,8),(1,8),(14,8),(15,8),(16,8),(17,8),(18,8),(19,8),(20,8),(21,8),(22,8),(23,8),(24,8),(25,8),(26,8),(27,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(39,8),(40,8),(46,8),(47,8),(48,8),(49,8),(50,8),(51,8),(52,8),(53,8),(54,8),(55,8),(56,8),(57,8),(58,8),(59,8),(60,8),(61,8),(62,8),(63,8),(64,8),(65,8),(87,8),(101,8),(0,9),(1,9),(2,9),(3,9),(87,9),(94,9),(95,9),(96,9),(97,9),(98,9),(99,9),(100,9),(101,9),(0,10),(1,10),(2,10),(3,10),(65,10),(81,10),(82,10),(83,10),(86,10),(92,10),(93,10),(103,10),(104,10),(105,10),(106,10),(108,10),(0,11),(1,11),(2,11),(3,11),(81,11),(82,11),(83,11),(85,11),(86,11),(87,11),(88,11),(89,11),(90,11),(91,11),(92,11),(95,11),(102,11),(103,11),(104,11),(2,12),(81,12),(82,12),(83,12),(85,12),(86,12),(87,12),(88,12),(89,12),(90,12),(91,12),(92,12),(94,12),(95,12),(101,12),(102,12),(104,12),(86,13),(88,13),(92,13),(95,13),(101,13),(102,13),(3,14),(4,14),(5,14),(6,14),(83,14),(84,14),(88,14),(89,14),(95,14),(102,14),(108,14),(109,14),(110,14),(4,15),(5,15),(6,15),(7,15),(85,15),(86,15),(87,15),(88,15),(91,15),(92,15),(93,15),(94,15),(95,15),(101,15),(102,15),(117,15),(118,15),(0,16),(2,16),(5,16),(6,16),(92,16),(104,16),(105,16),(106,16),(117,16),(118,16),(2,17),(3,17),(4,17),(6,17),(7,17),(8,17),(92,17),(104,17),(105,17),(106,17),(114,17),(115,17),(2,18),(3,18),(4,18),(7,18),(8,18),(9,18),(104,18),(105,18),(106,18),(111,18),(112,18),(2,19),(3,19),(4,19),(8,19),(9,19),(104,19),(105,19),(106,19),(113,19),(114,19),(115,19),(0,20),(2,20),(3,20),(4,20),(9,20),(94,20),(95,20),(105,20),(109,20),(110,20),(1,21),(2,21),(3,21),(94,21),(95,21),(96,21),(97,21),(98,21),(99,21),(100,21),(101,21),(102,21),(103,21),(104,21),(105,21),(106,21),(107,21),(108,21),(109,21),(110,21),(111,21),(112,21),(113,21),(114,21),(115,21),(116,21),(117,21),(118,21),(119,21),(0,22),(1,22),(2,22),(0,23),(1,23),(2,23),(4,23),(5,23),(6,23),(7,23),(106,23),(109,23),(0,24),(1,24),(2,24),(4,24),(9,24),(10,24),(0,25),(1,25),(2,25),(3,25),(4,25),(8,25),(9,25),(10,25),(11,25),(2,26),(3,26),(4,26),(7,26),(10,26),(11,26),(12,26),(13,26),(9,27),(10,27),(11,27),(12,27),(13,27),(104,27),(105,27),(106,27),(107,27),(108,27),(109,27),(110,27),(111,27),(112,27),(113,27),(114,27),(115,27),(116,27),(117,27),(118,27),(119,27),(1,28),(2,28),(13,28),(14,28),(101,28),(102,28),(103,28),(104,28),(106,28),(107,28),(108,28),(115,28),(116,28),(8,29),(10,29),(11,29),(12,29),(14,29),(15,29),(101,29),(102,29),(103,29),(104,29),(105,29),(106,29),(107,29),(108,29),(109,29),(113,29),(114,29),(115,29),(11,30),(12,30),(15,30),(16,30),(101,30),(102,30),(103,30),(104,30),(105,30),(109,30),(111,30),(109,31),(110,31),(111,31),(112,31),(113,31),(114,31),(115,31),(116,31),(117,31),(118,31),(119,31),(13,33),(107,33),(15,34),(0,37),(1,38),(2,38),(1,39),(2,39),(3,39),(2,40),(3,40),(4,40),(1,41),(2,41),(3,41),(4,41),(5,41),(6,41),(7,41),(8,41),(9,41),(3,42),(4,42),(5,42),(6,42),(7,42),(8,42),(9,42),(0,43),(1,43),(3,43),(4,43),(9,43),(2,44),(0,45),(1,45),(2,45),(3,45),(4,45),(7,45),(106,45),(107,45),(108,45),(0,46),(1,46),(2,46),(5,46),(106,46),(107,46),(108,46),(0,47),(1,47),(2,47),(102,47),(103,47),(104,47),(106,47),(107,47),(108,47),(102,48),(103,48),(104,48),(106,48),(107,48),(108,48),(102,49),(103,49),(104,49),(107,49),(110,49),(111,49),(112,49),(113,49),(114,49),(115,49),(116,49),(117,49),(118,49),(119,49),(5,50),(9,50),(10,50),(102,50),(103,50),(104,50),(107,50),(118,50),(6,51),(8,51),(9,51),(10,51),(11,51),(12,51),(102,51),(103,51),(104,51),(109,51),(116,51),(117,51),(118,51),(2,52),(3,52),(9,52),(10,52),(11,52),(12,52),(13,52),(100,52),(102,52),(103,52),(104,52),(108,52),(109,52),(113,52),(114,52),(116,52),(117,52),(118,52),(2,53),(3,53),(10,53),(11,53),(12,53),(13,53),(14,53),(101,53),(107,53),(108,53),(109,53),(111,53),(112,53),(113,53),(114,53),(7,54),(8,54),(9,54),(11,54),(12,54),(13,54),(14,54),(106,54),(107,54),(108,54),(109,54),(113,54),(114,54),(115,54),(116,54),(117,54),(118,54),(119,54),(10,55),(11,55),(12,55),(14,55),(102,55),(104,55),(105,55),(106,55),(107,55),(108,55),(109,55),(112,55),(113,55),(114,55),(115,55),(116,55),(117,55),(118,55),(119,55),(11,56),(100,56),(101,56),(102,56),(103,56),(104,56),(105,56),(106,56),(107,56),(108,56),(109,56),(111,56),(112,56),(113,56),(6,57),(7,57),(8,57),(99,57),(100,57),(101,57),(103,57),(104,57),(110,57),(111,57),(112,57),(113,57),(5,58),(6,58),(7,58),(96,58),(97,58),(98,58),(99,58),(100,58),(105,58),(106,58),(107,58),(108,58),(109,58),(110,58),(111,58),(118,58),(95,59),(96,59),(97,59),(98,59),(99,59),(100,59),(106,59),(107,59),(108,59),(109,59),(110,59),(111,59),(97,60),(98,60),(99,60),(100,60),(115,60),(1,61),(97,61),(98,61),(99,61),(106,61),(109,61),(111,61),(96,62),(97,62),(101,62),(110,62),(113,62),(114,62),(1,63),(6,63),(103,63),(113,63),(114,63),(4,64),(5,64),(6,64),(2,65),(6,65),(118,65),(99,66),(101,66),(102,66),(103,66),(104,66),(1,67),(2,67),(3,67),(6,67),(101,67),(102,67),(114,68),(0,69),(110,69),(111,69),(117,69),(118,69),(109,70),(112,70),(113,70),(117,70),(118,70),(106,71),(107,71),(108,71),(112,71),(113,71),(107,72),(108,72),(111,72),(112,72),(116,73),(118,73),(119,73),(118,74),(119,74),(114,75),(0,78),(1,78),(1,79),(0,80),(1,80),(114,80),(115,80),(1,81),(0,82),(1,82),(72,82),(116,82),(117,82),(0,83),(1,83),(67,83),(118,83),(119,83),(0,84),(1,84),(118,84),(119,84),(0,85),(1,85),(118,85),(119,85),(66,86),(32,91),(33,91),(34,91),(35,91),(36,91),(32,92),(33,92),(34,92),(35,92),(36,92),(30,93),(31,93),(32,93),(33,93),(34,93),(35,93),(36,93),(119,93),(97,94),(100,94),(119,94),(117,95),(119,95),(93,96),(94,96),(95,96),(100,96),(117,96),(119,96),(37,97),(73,97),(91,97),(94,97),(115,97),(117,97),(119,97),(91,98),(101,98),(115,98),(117,98),(119,98),(17,99),(38,99),(87,99),(91,99),(92,99),(100,99),(101,99),(113,99),(115,99),(117,99),(119,99),(17,100),(38,100),(87,100),(91,100),(100,100),(101,100),(113,100),(115,100),(117,100),(17,101),(24,101),(38,101),(43,101),(87,101),(91,101),(92,101),(100,101),(101,101),(107,101),(113,101),(115,101),(17,102),(24,102),(36,102),(38,102),(43,102),(85,102),(87,102),(91,102),(95,102),(100,102),(107,102),(113,102),(115,102),(24,103),(38,103),(43,103),(87,103),(91,103),(93,103),(95,103),(107,103),(113,103),(24,104),(38,104),(43,104),(87,104),(107,104),(113,104),(38,105),(87,105),(94,108)}
location.buildings = {(24,0),(25,0),(26,0),(27,0),(29,0),(30,0),(35,0),(38,0),(45,0),(46,0),(47,0),(48,0),(49,0),(52,0),(53,0),(54,0),(55,0),(56,0),(57,0),(58,0),(59,0),(60,0),(61,0),(62,0),(63,0),(64,0),(65,0),(66,0),(73,0),(74,0),(75,0),(76,0),(77,0),(78,0),(79,0),(80,0),(81,0),(82,0),(83,0),(84,0),(85,0),(86,0),(87,0),(88,0),(89,0),(90,0),(91,0),(92,0),(95,0),(96,0),(97,0),(98,0),(99,0),(100,0),(101,0),(102,0),(103,0),(104,0),(105,0),(106,0),(107,0),(108,0),(109,0),(110,0),(111,0),(112,0),(113,0),(114,0),(115,0),(116,0),(117,0),(118,0),(119,0),(23,1),(25,1),(26,1),(27,1),(29,1),(32,1),(34,1),(35,1),(36,1),(37,1),(38,1),(40,1),(41,1),(42,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(50,1),(51,1),(52,1),(53,1),(54,1),(55,1),(56,1),(57,1),(58,1),(59,1),(60,1),(61,1),(62,1),(63,1),(64,1),(65,1),(66,1),(73,1),(74,1),(75,1),(76,1),(77,1),(78,1),(79,1),(80,1),(81,1),(82,1),(83,1),(84,1),(85,1),(86,1),(87,1),(88,1),(89,1),(90,1),(91,1),(92,1),(93,1),(94,1),(95,1),(96,1),(97,1),(98,1),(99,1),(100,1),(101,1),(102,1),(103,1),(104,1),(105,1),(106,1),(107,1),(108,1),(109,1),(110,1),(111,1),(112,1),(113,1),(114,1),(115,1),(116,1),(117,1),(118,1),(119,1),(22,2),(24,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(40,2),(41,2),(43,2),(44,2),(45,2),(46,2),(47,2),(48,2),(49,2),(50,2),(51,2),(52,2),(53,2),(54,2),(55,2),(56,2),(57,2),(58,2),(59,2),(60,2),(61,2),(62,2),(63,2),(64,2),(65,2),(66,2),(73,2),(74,2),(75,2),(76,2),(77,2),(78,2),(79,2),(80,2),(81,2),(82,2),(83,2),(84,2),(85,2),(86,2),(87,2),(88,2),(89,2),(90,2),(91,2),(92,2),(93,2),(95,2),(96,2),(97,2),(98,2),(99,2),(100,2),(101,2),(102,2),(103,2),(104,2),(105,2),(106,2),(107,2),(108,2),(109,2),(110,2),(111,2),(112,2),(113,2),(114,2),(115,2),(116,2),(117,2),(118,2),(119,2),(0,3),(1,3),(2,3),(3,3),(4,3),(5,3),(6,3),(21,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(32,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(40,3),(41,3),(42,3),(43,3),(44,3),(45,3),(46,3),(47,3),(48,3),(49,3),(50,3),(51,3),(52,3),(53,3),(54,3),(55,3),(56,3),(57,3),(58,3),(59,3),(60,3),(61,3),(62,3),(63,3),(66,3),(73,3),(74,3),(75,3),(76,3),(77,3),(78,3),(79,3),(80,3),(81,3),(82,3),(83,3),(84,3),(85,3),(86,3),(87,3),(88,3),(89,3),(90,3),(91,3),(92,3),(93,3),(95,3),(96,3),(97,3),(98,3),(99,3),(100,3),(101,3),(102,3),(103,3),(104,3),(105,3),(106,3),(107,3),(108,3),(109,3),(110,3),(111,3),(112,3),(113,3),(114,3),(115,3),(116,3),(117,3),(118,3),(119,3),(1,4),(2,4),(5,4),(6,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(47,4),(48,4),(49,4),(50,4),(51,4),(52,4),(53,4),(54,4),(55,4),(56,4),(57,4),(58,4),(59,4),(60,4),(61,4),(62,4),(63,4),(64,4),(65,4),(66,4),(73,4),(74,4),(75,4),(76,4),(77,4),(78,4),(79,4),(80,4),(81,4),(82,4),(83,4),(84,4),(86,4),(87,4),(88,4),(89,4),(90,4),(91,4),(92,4),(93,4),(95,4),(96,4),(97,4),(98,4),(99,4),(100,4),(101,4),(102,4),(103,4),(104,4),(105,4),(106,4),(107,4),(108,4),(109,4),(110,4),(111,4),(112,4),(113,4),(114,4),(115,4),(116,4),(117,4),(118,4),(119,4),(0,5),(1,5),(2,5),(7,5),(8,5),(19,5),(20,5),(21,5),(22,5),(23,5),(24,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(48,5),(49,5),(50,5),(51,5),(52,5),(53,5),(54,5),(55,5),(56,5),(57,5),(58,5),(59,5),(60,5),(61,5),(62,5),(63,5),(64,5),(65,5),(66,5),(75,5),(76,5),(77,5),(78,5),(79,5),(80,5),(81,5),(82,5),(83,5),(84,5),(85,5),(86,5),(87,5),(88,5),(89,5),(90,5),(91,5),(92,5),(93,5),(94,5),(95,5),(96,5),(97,5),(98,5),(99,5),(100,5),(101,5),(102,5),(103,5),(104,5),(105,5),(106,5),(107,5),(108,5),(109,5),(110,5),(111,5),(112,5),(113,5),(114,5),(115,5),(116,5),(117,5),(118,5),(119,5),(7,6),(8,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(23,6),(24,6),(25,6),(26,6),(27,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(46,6),(47,6),(48,6),(49,6),(50,6),(51,6),(52,6),(53,6),(54,6),(55,6),(56,6),(57,6),(58,6),(59,6),(60,6),(61,6),(62,6),(63,6),(64,6),(65,6),(66,6),(76,6),(77,6),(78,6),(79,6),(80,6),(81,6),(82,6),(83,6),(84,6),(85,6),(86,6),(87,6),(88,6),(89,6),(90,6),(91,6),(92,6),(93,6),(94,6),(95,6),(96,6),(98,6),(99,6),(100,6),(101,6),(102,6),(106,6),(107,6),(108,6),(109,6),(110,6),(111,6),(112,6),(113,6),(114,6),(115,6),(116,6),(117,6),(8,7),(9,7),(12,7),(13,7),(16,7),(17,7),(18,7),(19,7),(20,7),(21,7),(22,7),(23,7),(24,7),(25,7),(26,7),(27,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(46,7),(47,7),(48,7),(49,7),(50,7),(51,7),(52,7),(53,7),(54,7),(55,7),(56,7),(57,7),(58,7),(59,7),(60,7),(61,7),(62,7),(63,7),(64,7),(65,7),(66,7),(78,7),(79,7),(80,7),(81,7),(82,7),(83,7),(84,7),(85,7),(86,7),(87,7),(88,7),(89,7),(90,7),(91,7),(92,7),(93,7),(94,7),(95,7),(97,7),(99,7),(100,7),(101,7),(103,7),(104,7),(105,7),(109,7),(110,7),(111,7),(112,7),(113,7),(114,7),(118,7),(0,8),(13,8),(33,8),(46,8),(49,8),(50,8),(51,8),(52,8),(53,8),(54,8),(55,8),(56,8),(57,8),(58,8),(59,8),(60,8),(61,8),(62,8),(63,8),(64,8),(65,8),(66,8),(80,8),(81,8),(82,8),(84,8),(85,8),(86,8),(87,8),(88,8),(89,8),(90,8),(91,8),(92,8),(93,8),(94,8),(95,8),(103,8),(104,8),(109,8),(110,8),(111,8),(112,8),(113,8),(114,8),(116,8),(117,8),(118,8),(0,9),(1,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(20,9),(21,9),(22,9),(23,9),(24,9),(25,9),(26,9),(27,9),(28,9),(29,9),(30,9),(31,9),(32,9),(33,9),(39,9),(40,9),(46,9),(47,9),(48,9),(49,9),(50,9),(51,9),(52,9),(53,9),(54,9),(55,9),(56,9),(57,9),(58,9),(59,9),(60,9),(61,9),(62,9),(63,9),(64,9),(65,9),(66,9),(80,9),(81,9),(82,9),(83,9),(84,9),(85,9),(86,9),(87,9),(88,9),(89,9),(90,9),(91,9),(92,9),(93,9),(110,9),(112,9),(113,9),(114,9),(115,9),(116,9),(117,9),(118,9),(119,9),(0,10),(1,10),(2,10),(3,10),(39,10),(40,10),(76,10),(80,10),(81,10),(82,10),(83,10),(84,10),(85,10),(86,10),(87,10),(88,10),(89,10),(90,10),(91,10),(92,10),(93,10),(94,10),(95,10),(96,10),(97,10),(98,10),(99,10),(100,10),(101,10),(102,10),(104,10),(107,10),(110,10),(111,10),(112,10),(113,10),(114,10),(115,10),(116,10),(117,10),(118,10),(119,10),(0,11),(2,11),(3,11),(65,11),(80,11),(81,11),(82,11),(83,11),(84,11),(85,11),(86,11),(87,11),(88,11),(89,11),(90,11),(91,11),(92,11),(93,11),(94,11),(95,11),(96,11),(97,11),(98,11),(99,11),(100,11),(101,11),(105,11),(107,11),(110,11),(111,11),(112,11),(113,11),(114,11),(115,11),(116,11),(117,11),(118,11),(119,11),(0,12),(2,12),(3,12),(80,12),(81,12),(82,12),(83,12),(84,12),(85,12),(86,12),(87,12),(88,12),(89,12),(90,12),(91,12),(92,12),(93,12),(94,12),(95,12),(96,12),(97,12),(98,12),(99,12),(100,12),(101,12),(103,12),(105,12),(107,12),(110,12),(111,12),(112,12),(113,12),(114,12),(115,12),(116,12),(117,12),(118,12),(119,12),(0,13),(2,13),(3,13),(81,13),(82,13),(83,13),(84,13),(85,13),(86,13),(87,13),(88,13),(89,13),(90,13),(91,13),(92,13),(93,13),(94,13),(96,13),(97,13),(98,13),(99,13),(101,13),(103,13),(104,13),(106,13),(108,13),(109,13),(110,13),(111,13),(112,13),(113,13),(114,13),(115,13),(116,13),(117,13),(118,13),(119,13),(0,14),(2,14),(3,14),(81,14),(82,14),(83,14),(84,14),(85,14),(86,14),(87,14),(88,14),(89,14),(90,14),(91,14),(92,14),(93,14),(94,14),(96,14),(97,14),(98,14),(99,14),(101,14),(103,14),(104,14),(110,14),(111,14),(112,14),(113,14),(114,14),(115,14),(116,14),(117,14),(118,14),(0,15),(2,15),(3,15),(4,15),(5,15),(6,15),(82,15),(83,15),(84,15),(85,15),(86,15),(87,15),(88,15),(89,15),(90,15),(91,15),(92,15),(93,15),(94,15),(95,15),(96,15),(97,15),(98,15),(99,15),(100,15),(101,15),(102,15),(103,15),(104,15),(108,15),(109,15),(110,15),(113,15),(114,15),(115,15),(116,15),(117,15),(118,15),(119,15),(0,16),(1,16),(2,16),(3,16),(4,16),(5,16),(6,16),(7,16),(85,16),(86,16),(87,16),(88,16),(91,16),(92,16),(93,16),(94,16),(95,16),(101,16),(102,16),(108,16),(109,16),(110,16),(115,16),(116,16),(117,16),(118,16),(119,16),(0,17),(1,17),(2,17),(3,17),(4,17),(5,17),(7,17),(92,17),(93,17),(116,17),(117,17),(118,17),(119,17),(0,18),(1,18),(2,18),(3,18),(4,18),(5,18),(6,18),(7,18),(8,18),(28,18),(29,18),(30,18),(31,18),(32,18),(36,18),(37,18),(38,18),(39,18),(40,18),(92,18),(93,18),(113,18),(114,18),(115,18),(116,18),(117,18),(118,18),(119,18),(0,19),(1,19),(2,19),(3,19),(4,19),(5,19),(6,19),(7,19),(8,19),(9,19),(26,19),(27,19),(28,19),(29,19),(32,19),(36,19),(39,19),(40,19),(41,19),(93,19),(111,19),(112,19),(116,19),(117,19),(118,19),(119,19),(0,20),(1,20),(2,20),(3,20),(4,20),(5,20),(6,20),(7,20),(8,20),(9,20),(25,20),(26,20),(32,20),(36,20),(37,20),(40,20),(41,20),(42,20),(43,20),(44,20),(93,20),(94,20),(95,20),(111,20),(112,20),(113,20),(114,20),(115,20),(116,20),(117,20),(118,20),(119,20),(0,21),(1,21),(2,21),(3,21),(4,21),(5,21),(6,21),(7,21),(8,21),(9,21),(25,21),(26,21),(31,21),(32,21),(36,21),(44,21),(45,21),(93,21),(94,21),(95,21),(105,21),(106,21),(107,21),(109,21),(110,21),(113,21),(114,21),(115,21),(116,21),(117,21),(118,21),(119,21),(0,22),(1,22),(2,22),(3,22),(4,22),(5,22),(7,22),(8,22),(9,22),(25,22),(32,22),(36,22),(45,22),(46,22),(93,22),(94,22),(95,22),(96,22),(97,22),(98,22),(99,22),(100,22),(101,22),(102,22),(103,22),(104,22),(105,22),(106,22),(107,22),(108,22),(109,22),(110,22),(111,22),(112,22),(113,22),(114,22),(115,22),(116,22),(117,22),(118,22),(119,22),(0,23),(1,23),(2,23),(3,23),(4,23),(7,23),(8,23),(9,23),(25,23),(32,23),(36,23),(45,23),(46,23),(47,23),(119,23),(0,24),(1,24),(2,24),(3,24),(4,24),(5,24),(6,24),(7,24),(8,24),(9,24),(24,24),(25,24),(31,24),(32,24),(36,24),(47,24),(106,24),(109,24),(0,25),(1,25),(2,25),(4,25),(5,25),(6,25),(7,25),(10,25),(23,25),(24,25),(32,25),(36,25),(47,25),(0,26),(1,26),(4,26),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(11,26),(22,26),(23,26),(32,26),(33,26),(34,26),(35,26),(36,26),(37,26),(47,26),(0,27),(1,27),(2,27),(3,27),(4,27),(7,27),(8,27),(11,27),(12,27),(22,27),(47,27),(109,27),(0,28),(3,28),(4,28),(7,28),(8,28),(9,28),(10,28),(11,28),(12,28),(13,28),(22,28),(47,28),(103,28),(104,28),(105,28),(106,28),(107,28),(108,28),(109,28),(110,28),(111,28),(112,28),(113,28),(114,28),(115,28),(116,28),(117,28),(118,28),(119,28),(0,29),(1,29),(2,29),(3,29),(4,29),(7,29),(8,29),(9,29),(10,29),(11,29),(12,29),(13,29),(14,29),(22,29),(47,29),(101,29),(102,29),(106,29),(107,29),(108,29),(110,29),(111,29),(112,29),(113,29),(114,29),(115,29),(116,29),(117,29),(118,29),(119,29),(0,30),(1,30),(2,30),(3,30),(4,30),(7,30),(8,30),(9,30),(10,30),(11,30),(12,30),(13,30),(14,30),(15,30),(22,30),(45,30),(47,30),(101,30),(102,30),(106,30),(107,30),(108,30),(110,30),(112,30),(113,30),(114,30),(115,30),(116,30),(117,30),(118,30),(119,30),(0,31),(1,31),(2,31),(3,31),(4,31),(7,31),(8,31),(9,31),(10,31),(11,31),(12,31),(13,31),(14,31),(15,31),(16,31),(22,31),(47,31),(48,31),(49,31),(101,31),(102,31),(103,31),(104,31),(105,31),(106,31),(107,31),(108,31),(111,31),(112,31),(113,31),(114,31),(115,31),(0,32),(1,32),(2,32),(3,32),(4,32),(7,32),(8,32),(9,32),(10,32),(11,32),(12,32),(13,32),(14,32),(15,32),(16,32),(22,32),(49,32),(50,32),(101,32),(102,32),(103,32),(104,32),(105,32),(106,32),(107,32),(108,32),(109,32),(110,32),(111,32),(112,32),(113,32),(114,32),(115,32),(116,32),(117,32),(118,32),(119,32),(0,33),(1,33),(2,33),(3,33),(4,33),(7,33),(8,33),(9,33),(10,33),(11,33),(12,33),(13,33),(14,33),(15,33),(16,33),(23,33),(48,33),(49,33),(50,33),(51,33),(106,33),(107,33),(108,33),(118,33),(0,34),(1,34),(9,34),(10,34),(11,34),(12,34),(13,34),(14,34),(15,34),(16,34),(24,34),(26,34),(51,34),(107,34),(0,35),(1,35),(12,35),(13,35),(14,35),(15,35),(16,35),(25,35),(51,35),(0,36),(1,36),(12,36),(13,36),(14,36),(15,36),(16,36),(26,36),(27,36),(51,36),(119,36),(0,37),(1,37),(12,37),(13,37),(14,37),(15,37),(16,37),(28,37),(29,37),(51,37),(102,37),(103,37),(104,37),(105,37),(106,37),(107,37),(108,37),(109,37),(110,37),(111,37),(112,37),(113,37),(114,37),(115,37),(116,37),(117,37),(118,37),(119,37),(0,38),(1,38),(12,38),(13,38),(14,38),(15,38),(16,38),(30,38),(51,38),(101,38),(102,38),(103,38),(104,38),(105,38),(106,38),(107,38),(108,38),(109,38),(110,38),(111,38),(112,38),(113,38),(114,38),(115,38),(116,38),(117,38),(118,38),(119,38),(0,39),(1,39),(2,39),(5,39),(12,39),(13,39),(14,39),(15,39),(16,39),(31,39),(32,39),(33,39),(34,39),(40,39),(44,39),(50,39),(99,39),(100,39),(101,39),(102,39),(0,40),(1,40),(2,40),(3,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(46,40),(47,40),(48,40),(49,40),(92,40),(93,40),(94,40),(95,40),(96,40),(97,40),(98,40),(99,40),(100,40),(101,40),(102,40),(0,41),(1,41),(2,41),(3,41),(4,41),(82,41),(83,41),(84,41),(85,41),(86,41),(87,41),(88,41),(89,41),(90,41),(91,41),(92,41),(93,41),(94,41),(95,41),(96,41),(97,41),(98,41),(0,42),(1,42),(2,42),(3,42),(4,42),(5,42),(6,42),(7,42),(8,42),(9,42),(81,42),(82,42),(83,42),(84,42),(85,42),(86,42),(87,42),(88,42),(89,42),(90,42),(91,42),(0,43),(1,43),(2,43),(3,43),(4,43),(5,43),(6,43),(7,43),(8,43),(9,43),(80,43),(81,43),(82,43),(90,43),(91,43),(0,44),(1,44),(2,44),(3,44),(4,44),(5,44),(6,44),(7,44),(8,44),(9,44),(79,44),(80,44),(90,44),(91,44),(0,45),(1,45),(2,45),(3,45),(4,45),(5,45),(6,45),(7,45),(8,45),(9,45),(78,45),(79,45),(80,45),(0,46),(1,46),(2,46),(3,46),(4,46),(5,46),(6,46),(7,46),(8,46),(9,46),(77,46),(78,46),(0,47),(1,47),(2,47),(3,47),(4,47),(5,47),(6,47),(7,47),(8,47),(9,47),(77,47),(83,47),(84,47),(85,47),(86,47),(87,47),(88,47),(0,48),(1,48),(2,48),(3,48),(4,48),(5,48),(6,48),(7,48),(8,48),(9,48),(77,48),(82,48),(83,48),(88,48),(89,48),(104,48),(105,48),(106,48),(107,48),(108,48),(109,48),(110,48),(111,48),(112,48),(113,48),(114,48),(115,48),(116,48),(117,48),(118,48),(0,49),(1,49),(2,49),(3,49),(4,49),(5,49),(6,49),(7,49),(8,49),(9,49),(77,49),(78,49),(79,49),(80,49),(81,49),(82,49),(89,49),(103,49),(104,49),(105,49),(106,49),(107,49),(108,49),(109,49),(110,49),(111,49),(112,49),(113,49),(114,49),(115,49),(116,49),(117,49),(118,49),(119,49),(0,50),(1,50),(2,50),(3,50),(4,50),(5,50),(6,50),(7,50),(8,50),(9,50),(76,50),(77,50),(82,50),(89,50),(101,50),(102,50),(103,50),(105,50),(106,50),(109,50),(110,50),(111,50),(112,50),(113,50),(114,50),(115,50),(116,50),(117,50),(118,50),(119,50),(0,51),(1,51),(2,51),(3,51),(4,51),(5,51),(8,51),(10,51),(62,51),(63,51),(64,51),(65,51),(66,51),(67,51),(68,51),(69,51),(70,51),(71,51),(72,51),(73,51),(74,51),(75,51),(76,51),(82,51),(89,51),(94,51),(95,51),(96,51),(97,51),(100,51),(104,51),(105,51),(106,51),(108,51),(110,51),(111,51),(112,51),(113,51),(114,51),(115,51),(119,51),(0,52),(1,52),(2,52),(3,52),(4,52),(5,52),(6,52),(7,52),(9,52),(10,52),(11,52),(12,52),(60,52),(61,52),(62,52),(70,52),(71,52),(72,52),(73,52),(74,52),(75,52),(82,52),(83,52),(84,52),(86,52),(87,52),(88,52),(89,52),(93,52),(94,52),(97,52),(98,52),(99,52),(104,52),(105,52),(106,52),(107,52),(110,52),(111,52),(112,52),(113,52),(114,52),(115,52),(119,52),(0,53),(1,53),(2,53),(3,53),(4,53),(5,53),(6,53),(7,53),(8,53),(9,53),(10,53),(11,53),(12,53),(13,53),(58,53),(59,53),(60,53),(83,53),(84,53),(85,53),(86,53),(87,53),(88,53),(91,53),(92,53),(100,53),(102,53),(103,53),(104,53),(105,53),(106,53),(110,53),(113,53),(114,53),(115,53),(116,53),(117,53),(118,53),(119,53),(0,54),(1,54),(2,54),(3,54),(4,54),(5,54),(6,54),(7,54),(8,54),(9,54),(10,54),(11,54),(12,54),(13,54),(14,54),(56,54),(57,54),(58,54),(85,54),(86,54),(87,54),(88,54),(90,54),(91,54),(100,54),(101,54),(102,54),(103,54),(104,54),(105,54),(106,54),(108,54),(110,54),(111,54),(112,54),(113,54),(114,54),(115,54),(116,54),(117,54),(118,54),(119,54),(0,55),(1,55),(2,55),(3,55),(4,55),(5,55),(6,55),(7,55),(8,55),(9,55),(10,55),(11,55),(12,55),(13,55),(14,55),(54,55),(55,55),(56,55),(87,55),(88,55),(89,55),(90,55),(91,55),(100,55),(101,55),(103,55),(104,55),(105,55),(106,55),(110,55),(111,55),(112,55),(113,55),(114,55),(115,55),(116,55),(117,55),(118,55),(119,55),(0,56),(1,56),(2,56),(3,56),(4,56),(5,56),(6,56),(7,56),(8,56),(9,56),(10,56),(11,56),(12,56),(13,56),(14,56),(52,56),(53,56),(54,56),(87,56),(88,56),(89,56),(94,56),(100,56),(101,56),(102,56),(103,56),(104,56),(105,56),(106,56),(110,56),(111,56),(112,56),(113,56),(114,56),(115,56),(116,56),(117,56),(118,56),(119,56),(0,57),(1,57),(2,57),(3,57),(4,57),(5,57),(6,57),(7,57),(8,57),(9,57),(10,57),(11,57),(12,57),(13,57),(14,57),(49,57),(50,57),(51,57),(52,57),(86,57),(100,57),(101,57),(102,57),(105,57),(106,57),(109,57),(110,57),(111,57),(112,57),(114,57),(115,57),(116,57),(117,57),(118,57),(119,57),(0,58),(1,58),(2,58),(3,58),(4,58),(5,58),(6,58),(7,58),(8,58),(9,58),(10,58),(11,58),(12,58),(13,58),(14,58),(35,58),(46,58),(47,58),(48,58),(49,58),(84,58),(85,58),(86,58),(100,58),(101,58),(102,58),(103,58),(104,58),(109,58),(110,58),(111,58),(112,58),(113,58),(114,58),(115,58),(116,58),(117,58),(118,58),(119,58),(0,59),(1,59),(2,59),(3,59),(4,59),(5,59),(6,59),(7,59),(8,59),(9,59),(10,59),(11,59),(12,59),(13,59),(14,59),(44,59),(45,59),(46,59),(75,59),(76,59),(77,59),(78,59),(84,59),(96,59),(97,59),(98,59),(99,59),(101,59),(102,59),(103,59),(104,59),(105,59),(106,59),(107,59),(108,59),(109,59),(110,59),(111,59),(112,59),(113,59),(114,59),(115,59),(116,59),(117,59),(118,59),(119,59),(0,60),(1,60),(2,60),(3,60),(4,60),(5,60),(6,60),(7,60),(8,60),(9,60),(10,60),(11,60),(12,60),(13,60),(14,60),(41,60),(42,60),(43,60),(44,60),(69,60),(70,60),(71,60),(72,60),(73,60),(74,60),(79,60),(80,60),(81,60),(82,60),(83,60),(95,60),(100,60),(101,60),(102,60),(103,60),(104,60),(105,60),(106,60),(107,60),(108,60),(109,60),(110,60),(111,60),(112,60),(113,60),(114,60),(115,60),(116,60),(117,60),(118,60),(119,60),(0,61),(1,61),(2,61),(3,61),(4,61),(5,61),(6,61),(7,61),(8,61),(9,61),(10,61),(11,61),(12,61),(13,61),(14,61),(39,61),(40,61),(41,61),(67,61),(68,61),(95,61),(100,61),(101,61),(102,61),(103,61),(104,61),(105,61),(106,61),(107,61),(108,61),(109,61),(110,61),(111,61),(112,61),(113,61),(114,61),(115,61),(117,61),(119,61),(0,62),(1,62),(2,62),(3,62),(4,62),(5,62),(6,62),(7,62),(8,62),(9,62),(10,62),(11,62),(12,62),(37,62),(38,62),(39,62),(65,62),(66,62),(95,62),(97,62),(98,62),(99,62),(100,62),(102,62),(103,62),(104,62),(105,62),(106,62),(107,62),(108,62),(109,62),(111,62),(112,62),(113,62),(114,62),(115,62),(116,62),(117,62),(118,62),(119,62),(0,63),(1,63),(2,63),(3,63),(4,63),(5,63),(6,63),(7,63),(8,63),(9,63),(10,63),(35,63),(36,63),(37,63),(64,63),(95,63),(96,63),(97,63),(98,63),(99,63),(100,63),(101,63),(102,63),(103,63),(104,63),(105,63),(106,63),(107,63),(108,63),(109,63),(110,63),(111,63),(112,63),(113,63),(114,63),(115,63),(116,63),(117,63),(118,63),(119,63),(0,64),(1,64),(2,64),(3,64),(4,64),(5,64),(6,64),(7,64),(8,64),(33,64),(34,64),(35,64),(64,64),(95,64),(96,64),(97,64),(98,64),(99,64),(100,64),(101,64),(102,64),(103,64),(104,64),(105,64),(106,64),(107,64),(108,64),(109,64),(110,64),(111,64),(112,64),(113,64),(114,64),(115,64),(116,64),(117,64),(118,64),(119,64),(0,65),(1,65),(2,65),(3,65),(4,65),(5,65),(6,65),(31,65),(32,65),(33,65),(36,65),(64,65),(95,65),(96,65),(97,65),(98,65),(99,65),(100,65),(101,65),(102,65),(103,65),(104,65),(105,65),(106,65),(107,65),(108,65),(109,65),(110,65),(111,65),(112,65),(113,65),(114,65),(115,65),(116,65),(117,65),(118,65),(119,65),(0,66),(1,66),(2,66),(3,66),(4,66),(5,66),(6,66),(29,66),(30,66),(31,66),(53,66),(54,66),(56,66),(57,66),(58,66),(59,66),(64,66),(95,66),(96,66),(97,66),(98,66),(99,66),(100,66),(101,66),(102,66),(105,66),(106,66),(107,66),(108,66),(109,66),(110,66),(111,66),(112,66),(113,66),(114,66),(115,66),(116,66),(117,66),(118,66),(119,66),(0,67),(1,67),(2,67),(3,67),(4,67),(5,67),(6,67),(27,67),(28,67),(29,67),(53,67),(54,67),(55,67),(60,67),(64,67),(95,67),(96,67),(97,67),(98,67),(99,67),(100,67),(101,67),(102,67),(103,67),(104,67),(105,67),(106,67),(107,67),(108,67),(111,67),(112,67),(113,67),(114,67),(115,67),(116,67),(117,67),(118,67),(119,67),(0,68),(1,68),(2,68),(3,68),(4,68),(5,68),(6,68),(25,68),(26,68),(27,68),(49,68),(50,68),(51,68),(52,68),(61,68),(64,68),(65,68),(95,68),(96,68),(97,68),(98,68),(99,68),(100,68),(101,68),(102,68),(103,68),(104,68),(105,68),(107,68),(108,68),(112,68),(113,68),(114,68),(115,68),(116,68),(117,68),(118,68),(119,68),(0,69),(1,69),(2,69),(3,69),(4,69),(5,69),(6,69),(23,69),(24,69),(25,69),(26,69),(45,69),(46,69),(47,69),(48,69),(62,69),(65,69),(95,69),(96,69),(97,69),(98,69),(99,69),(100,69),(101,69),(102,69),(103,69),(104,69),(105,69),(108,69),(109,69),(110,69),(111,69),(112,69),(113,69),(114,69),(115,69),(116,69),(117,69),(118,69),(119,69),(0,70),(1,70),(2,70),(3,70),(4,70),(5,70),(6,70),(22,70),(23,70),(42,70),(43,70),(44,70),(62,70),(63,70),(64,70),(65,70),(95,70),(96,70),(97,70),(98,70),(99,70),(100,70),(101,70),(102,70),(103,70),(104,70),(105,70),(108,70),(110,70),(111,70),(112,70),(113,70),(114,70),(115,70),(116,70),(117,70),(118,70),(119,70),(0,71),(1,71),(2,71),(3,71),(4,71),(5,71),(6,71),(22,71),(40,71),(41,71),(62,71),(65,71),(95,71),(96,71),(97,71),(98,71),(99,71),(100,71),(101,71),(102,71),(103,71),(104,71),(105,71),(109,71),(110,71),(111,71),(112,71),(113,71),(114,71),(115,71),(116,71),(117,71),(118,71),(119,71),(0,72),(1,72),(2,72),(3,72),(4,72),(5,72),(6,72),(21,72),(22,72),(39,72),(62,72),(65,72),(66,72),(99,72),(100,72),(101,72),(102,72),(103,72),(104,72),(105,72),(106,72),(107,72),(108,72),(109,72),(110,72),(113,72),(114,72),(115,72),(116,72),(117,72),(118,72),(119,72),(0,73),(1,73),(2,73),(3,73),(4,73),(5,73),(6,73),(21,73),(38,73),(62,73),(66,73),(105,73),(106,73),(107,73),(108,73),(109,73),(110,73),(111,73),(112,73),(113,73),(114,73),(115,73),(116,73),(117,73),(118,73),(119,73),(0,74),(1,74),(2,74),(3,74),(4,74),(17,74),(21,74),(37,74),(62,74),(63,74),(66,74),(105,74),(106,74),(107,74),(108,74),(109,74),(110,74),(111,74),(112,74),(113,74),(114,74),(115,74),(116,74),(117,74),(118,74),(119,74),(0,75),(1,75),(2,75),(3,75),(4,75),(21,75),(37,75),(62,75),(66,75),(105,75),(106,75),(107,75),(108,75),(109,75),(110,75),(111,75),(112,75),(113,75),(115,75),(116,75),(117,75),(118,75),(119,75),(0,76),(1,76),(2,76),(3,76),(4,76),(21,76),(37,76),(62,76),(66,76),(67,76),(105,76),(106,76),(107,76),(108,76),(109,76),(110,76),(111,76),(112,76),(113,76),(114,76),(115,76),(116,76),(117,76),(118,76),(119,76),(0,77),(1,77),(2,77),(3,77),(4,77),(5,77),(21,77),(37,77),(38,77),(62,77),(67,77),(105,77),(106,77),(107,77),(108,77),(109,77),(110,77),(111,77),(112,77),(113,77),(114,77),(115,77),(116,77),(117,77),(118,77),(119,77),(0,78),(1,78),(2,78),(3,78),(4,78),(5,78),(6,78),(21,78),(38,78),(39,78),(62,78),(67,78),(107,78),(108,78),(109,78),(110,78),(111,78),(112,78),(113,78),(114,78),(115,78),(116,78),(117,78),(118,78),(119,78),(0,79),(1,79),(2,79),(3,79),(4,79),(5,79),(6,79),(7,79),(21,79),(39,79),(40,79),(41,79),(42,79),(62,79),(67,79),(109,79),(110,79),(111,79),(112,79),(113,79),(114,79),(117,79),(118,79),(119,79),(0,80),(1,80),(2,80),(3,80),(4,80),(5,80),(6,80),(7,80),(22,80),(40,80),(41,80),(42,80),(43,80),(44,80),(45,80),(62,80),(67,80),(111,80),(112,80),(113,80),(117,80),(118,80),(119,80),(0,81),(1,81),(2,81),(3,81),(4,81),(5,81),(6,81),(7,81),(22,81),(36,81),(37,81),(40,81),(41,81),(45,81),(46,81),(47,81),(48,81),(62,81),(67,81),(113,81),(114,81),(115,81),(117,81),(118,81),(119,81),(0,82),(1,82),(2,82),(3,82),(4,82),(5,82),(6,82),(7,82),(23,82),(25,82),(35,82),(38,82),(39,82),(40,82),(41,82),(48,82),(49,82),(50,82),(51,82),(52,82),(61,82),(62,82),(67,82),(113,82),(114,82),(115,82),(117,82),(118,82),(119,82),(0,83),(1,83),(2,83),(3,83),(4,83),(5,83),(6,83),(7,83),(24,83),(25,83),(35,83),(42,83),(47,83),(52,83),(53,83),(54,83),(55,83),(60,83),(61,83),(66,83),(72,83),(113,83),(114,83),(115,83),(116,83),(117,83),(118,83),(119,83),(2,84),(3,84),(4,84),(5,84),(6,84),(7,84),(26,84),(27,84),(35,84),(36,84),(42,84),(55,84),(56,84),(59,84),(60,84),(66,84),(67,84),(68,84),(113,84),(114,84),(115,84),(116,84),(117,84),(118,84),(119,84),(2,85),(3,85),(4,85),(5,85),(6,85),(7,85),(28,85),(29,85),(36,85),(37,85),(38,85),(39,85),(40,85),(41,85),(42,85),(56,85),(59,85),(66,85),(67,85),(113,85),(114,85),(115,85),(116,85),(117,85),(0,86),(1,86),(2,86),(3,86),(4,86),(5,86),(6,86),(7,86),(9,86),(30,86),(31,86),(32,86),(37,86),(38,86),(39,86),(56,86),(57,86),(59,86),(66,86),(67,86),(113,86),(114,86),(115,86),(116,86),(117,86),(118,86),(119,86),(0,87),(1,87),(2,87),(3,87),(4,87),(5,87),(6,87),(7,87),(33,87),(34,87),(35,87),(36,87),(37,87),(38,87),(57,87),(59,87),(65,87),(66,87),(113,87),(114,87),(115,87),(116,87),(117,87),(118,87),(119,87),(2,88),(3,88),(4,88),(5,88),(6,88),(7,88),(39,88),(40,88),(41,88),(57,88),(58,88),(59,88),(64,88),(65,88),(66,88),(67,88),(68,88),(113,88),(114,88),(115,88),(116,88),(117,88),(118,88),(119,88),(2,89),(3,89),(4,89),(5,89),(6,89),(7,89),(42,89),(43,89),(44,89),(63,89),(64,89),(65,89),(66,89),(67,89),(68,89),(115,89),(116,89),(117,89),(118,89),(119,89),(2,90),(3,90),(4,90),(5,90),(6,90),(7,90),(45,90),(46,90),(47,90),(63,90),(64,90),(65,90),(66,90),(67,90),(68,90),(117,90),(118,90),(119,90),(3,91),(4,91),(5,91),(6,91),(7,91),(8,91),(48,91),(63,91),(64,91),(65,91),(66,91),(67,91),(68,91),(117,91),(118,91),(119,91),(3,92),(4,92),(5,92),(6,92),(7,92),(8,92),(9,92),(32,92),(33,92),(34,92),(35,92),(36,92),(49,92),(64,92),(65,92),(66,92),(67,92),(68,92),(85,92),(119,92),(3,93),(4,93),(5,93),(6,93),(7,93),(8,93),(9,93),(10,93),(11,93),(32,93),(33,93),(34,93),(35,93),(36,93),(50,93),(64,93),(65,93),(66,93),(67,93),(68,93),(118,93),(119,93),(3,94),(4,94),(5,94),(6,94),(7,94),(8,94),(9,94),(10,94),(11,94),(30,94),(31,94),(32,94),(33,94),(34,94),(35,94),(36,94),(50,94),(51,94),(65,94),(66,94),(67,94),(68,94),(97,94),(100,94),(115,94),(117,94),(118,94),(119,94),(3,95),(4,95),(5,95),(6,95),(7,95),(8,95),(9,95),(10,95),(11,95),(12,95),(30,95),(31,95),(32,95),(33,95),(34,95),(35,95),(36,95),(50,95),(51,95),(52,95),(65,95),(66,95),(67,95),(68,95),(92,95),(93,95),(94,95),(95,95),(96,95),(97,95),(100,95),(116,95),(117,95),(118,95),(119,95),(3,96),(4,96),(5,96),(6,96),(7,96),(8,96),(9,96),(10,96),(11,96),(12,96),(13,96),(14,96),(15,96),(16,96),(17,96),(50,96),(51,96),(52,96),(65,96),(66,96),(67,96),(68,96),(91,96),(92,96),(93,96),(94,96),(95,96),(96,96),(97,96),(100,96),(101,96),(115,96),(116,96),(117,96),(118,96),(119,96),(3,97),(4,97),(5,97),(6,97),(7,97),(8,97),(9,97),(10,97),(11,97),(12,97),(13,97),(14,97),(15,97),(16,97),(17,97),(18,97),(50,97),(51,97),(52,97),(65,97),(66,97),(67,97),(68,97),(69,97),(90,97),(91,97),(92,97),(93,97),(94,97),(95,97),(96,97),(97,97),(100,97),(101,97),(114,97),(115,97),(116,97),(117,97),(118,97),(119,97),(3,98),(4,98),(5,98),(6,98),(7,98),(8,98),(9,98),(10,98),(11,98),(12,98),(13,98),(14,98),(15,98),(16,98),(17,98),(18,98),(19,98),(20,98),(21,98),(22,98),(23,98),(24,98),(37,98),(38,98),(39,98),(40,98),(41,98),(42,98),(43,98),(44,98),(50,98),(51,98),(52,98),(66,98),(67,98),(68,98),(69,98),(73,98),(87,98),(88,98),(89,98),(90,98),(91,98),(92,98),(93,98),(94,98),(95,98),(96,98),(97,98),(100,98),(101,98),(102,98),(103,98),(104,98),(105,98),(106,98),(107,98),(113,98),(114,98),(115,98),(116,98),(117,98),(118,98),(119,98),(3,99),(4,99),(5,99),(6,99),(7,99),(8,99),(9,99),(10,99),(11,99),(12,99),(13,99),(14,99),(15,99),(16,99),(17,99),(18,99),(19,99),(20,99),(21,99),(22,99),(23,99),(24,99),(25,99),(37,99),(38,99),(39,99),(40,99),(41,99),(42,99),(43,99),(44,99),(50,99),(51,99),(52,99),(66,99),(67,99),(68,99),(69,99),(86,99),(87,99),(88,99),(89,99),(90,99),(91,99),(92,99),(93,99),(94,99),(95,99),(96,99),(97,99),(100,99),(101,99),(102,99),(103,99),(104,99),(105,99),(106,99),(107,99),(108,99),(112,99),(113,99),(114,99),(115,99),(116,99),(117,99),(118,99),(119,99),(3,100),(4,100),(5,100),(6,100),(7,100),(8,100),(9,100),(10,100),(11,100),(12,100),(13,100),(14,100),(15,100),(16,100),(17,100),(18,100),(19,100),(20,100),(21,100),(22,100),(23,100),(24,100),(25,100),(26,100),(27,100),(28,100),(29,100),(30,100),(31,100),(32,100),(33,100),(34,100),(35,100),(36,100),(37,100),(38,100),(39,100),(40,100),(41,100),(42,100),(43,100),(44,100),(45,100),(46,100),(47,100),(48,100),(49,100),(50,100),(51,100),(52,100),(66,100),(67,100),(68,100),(69,100),(70,100),(71,100),(72,100),(73,100),(74,100),(75,100),(76,100),(77,100),(78,100),(79,100),(80,100),(81,100),(82,100),(83,100),(84,100),(85,100),(86,100),(87,100),(88,100),(89,100),(90,100),(91,100),(92,100),(94,100),(100,100),(101,100),(102,100),(103,100),(104,100),(105,100),(106,100),(107,100),(108,100),(109,100),(110,100),(111,100),(112,100),(113,100),(114,100),(115,100),(116,100),(117,100),(118,100),(119,100),(3,101),(4,101),(5,101),(6,101),(7,101),(8,101),(9,101),(10,101),(11,101),(12,101),(13,101),(14,101),(15,101),(16,101),(17,101),(18,101),(19,101),(20,101),(21,101),(22,101),(23,101),(24,101),(25,101),(26,101),(27,101),(28,101),(29,101),(30,101),(31,101),(32,101),(33,101),(34,101),(35,101),(36,101),(37,101),(38,101),(39,101),(40,101),(41,101),(42,101),(43,101),(44,101),(45,101),(46,101),(47,101),(48,101),(49,101),(50,101),(51,101),(52,101),(66,101),(67,101),(68,101),(69,101),(70,101),(71,101),(72,101),(73,101),(74,101),(75,101),(76,101),(77,101),(78,101),(79,101),(80,101),(81,101),(82,101),(83,101),(84,101),(85,101),(86,101),(87,101),(88,101),(89,101),(90,101),(91,101),(92,101),(93,101),(94,101),(96,101),(97,101),(98,101),(99,101),(100,101),(101,101),(102,101),(103,101),(104,101),(105,101),(106,101),(107,101),(108,101),(109,101),(110,101),(111,101),(112,101),(113,101),(114,101),(115,101),(116,101),(117,101),(118,101),(119,101),(4,102),(5,102),(6,102),(7,102),(8,102),(9,102),(10,102),(11,102),(12,102),(13,102),(14,102),(15,102),(16,102),(17,102),(18,102),(19,102),(20,102),(21,102),(22,102),(23,102),(24,102),(25,102),(26,102),(27,102),(28,102),(29,102),(30,102),(31,102),(32,102),(33,102),(34,102),(35,102),(36,102),(37,102),(38,102),(39,102),(40,102),(41,102),(42,102),(43,102),(44,102),(45,102),(46,102),(47,102),(48,102),(49,102),(50,102),(51,102),(52,102),(66,102),(67,102),(68,102),(69,102),(70,102),(71,102),(72,102),(73,102),(74,102),(75,102),(76,102),(77,102),(78,102),(79,102),(80,102),(81,102),(82,102),(83,102),(84,102),(85,102),(86,102),(87,102),(88,102),(89,102),(90,102),(91,102),(92,102),(93,102),(94,102),(95,102),(96,102),(97,102),(98,102),(99,102),(100,102),(101,102),(102,102),(103,102),(104,102),(105,102),(106,102),(107,102),(108,102),(109,102),(110,102),(111,102),(112,102),(113,102),(114,102),(115,102),(116,102),(117,102),(118,102),(119,102),(6,103),(7,103),(8,103),(9,103),(10,103),(11,103),(12,103),(13,103),(14,103),(15,103),(16,103),(17,103),(18,103),(19,103),(20,103),(21,103),(22,103),(23,103),(24,103),(25,103),(26,103),(27,103),(28,103),(29,103),(30,103),(31,103),(32,103),(33,103),(34,103),(35,103),(36,103),(37,103),(38,103),(39,103),(40,103),(41,103),(42,103),(43,103),(44,103),(45,103),(46,103),(47,103),(48,103),(49,103),(50,103),(51,103),(52,103),(66,103),(67,103),(68,103),(69,103),(70,103),(71,103),(72,103),(73,103),(74,103),(75,103),(76,103),(77,103),(78,103),(79,103),(80,103),(81,103),(82,103),(83,103),(84,103),(85,103),(86,103),(87,103),(88,103),(89,103),(90,103),(91,103),(92,103),(93,103),(94,103),(95,103),(96,103),(97,103),(98,103),(99,103),(100,103),(101,103),(102,103),(103,103),(104,103),(105,103),(106,103),(107,103),(108,103),(109,103),(110,103),(111,103),(112,103),(113,103),(114,103),(115,103),(116,103),(117,103),(118,103),(119,103),(7,104),(8,104),(9,104),(10,104),(11,104),(12,104),(13,104),(14,104),(15,104),(16,104),(17,104),(18,104),(19,104),(20,104),(21,104),(22,104),(23,104),(24,104),(25,104),(26,104),(27,104),(28,104),(29,104),(30,104),(31,104),(32,104),(33,104),(34,104),(35,104),(36,104),(37,104),(38,104),(39,104),(40,104),(41,104),(42,104),(43,104),(44,104),(45,104),(46,104),(47,104),(48,104),(49,104),(50,104),(51,104),(66,104),(67,104),(68,104),(69,104),(70,104),(71,104),(72,104),(73,104),(74,104),(75,104),(76,104),(77,104),(78,104),(79,104),(80,104),(81,104),(82,104),(83,104),(84,104),(85,104),(86,104),(87,104),(88,104),(89,104),(90,104),(91,104),(92,104),(93,104),(94,104),(95,104),(96,104),(97,104),(98,104),(99,104),(100,104),(101,104),(102,104),(103,104),(104,104),(105,104),(106,104),(107,104),(108,104),(109,104),(110,104),(111,104),(112,104),(113,104),(114,104),(115,104),(116,104),(117,104),(118,104),(119,104),(8,105),(9,105),(10,105),(11,105),(12,105),(13,105),(14,105),(15,105),(16,105),(17,105),(18,105),(19,105),(20,105),(21,105),(22,105),(23,105),(24,105),(25,105),(26,105),(27,105),(28,105),(29,105),(30,105),(31,105),(32,105),(33,105),(34,105),(35,105),(36,105),(37,105),(38,105),(39,105),(40,105),(41,105),(42,105),(43,105),(44,105),(45,105),(46,105),(47,105),(48,105),(49,105),(50,105),(51,105),(66,105),(67,105),(68,105),(69,105),(70,105),(71,105),(72,105),(73,105),(74,105),(75,105),(76,105),(77,105),(78,105),(79,105),(80,105),(81,105),(82,105),(83,105),(84,105),(85,105),(86,105),(87,105),(88,105),(89,105),(90,105),(91,105),(92,105),(93,105),(94,105),(95,105),(96,105),(97,105),(98,105),(99,105),(100,105),(101,105),(102,105),(103,105),(104,105),(105,105),(106,105),(107,105),(108,105),(109,105),(110,105),(111,105),(112,105),(113,105),(114,105),(115,105),(116,105),(117,105),(118,105),(10,106),(11,106),(12,106),(13,106),(14,106),(15,106),(16,106),(17,106),(18,106),(19,106),(20,106),(21,106),(22,106),(23,106),(24,106),(25,106),(26,106),(27,106),(28,106),(29,106),(30,106),(31,106),(32,106),(33,106),(34,106),(35,106),(36,106),(37,106),(38,106),(39,106),(40,106),(41,106),(42,106),(43,106),(44,106),(45,106),(46,106),(47,106),(48,106),(49,106),(50,106),(51,106),(66,106),(67,106),(68,106),(69,106),(70,106),(71,106),(72,106),(73,106),(74,106),(75,106),(76,106),(77,106),(78,106),(79,106),(80,106),(81,106),(82,106),(83,106),(84,106),(85,106),(86,106),(87,106),(88,106),(89,106),(90,106),(91,106),(92,106),(93,106),(94,106),(95,106),(96,106),(97,106),(98,106),(99,106),(100,106),(101,106),(102,106),(103,106),(104,106),(105,106),(106,106),(107,106),(108,106),(109,106),(110,106),(111,106),(112,106),(113,106),(114,106),(115,106),(116,106),(117,106),(11,107),(12,107),(13,107),(14,107),(15,107),(16,107),(17,107),(18,107),(19,107),(20,107),(21,107),(22,107),(23,107),(24,107),(25,107),(26,107),(27,107),(28,107),(29,107),(30,107),(31,107),(32,107),(33,107),(34,107),(35,107),(36,107),(37,107),(38,107),(39,107),(40,107),(41,107),(42,107),(43,107),(44,107),(45,107),(46,107),(47,107),(48,107),(49,107),(50,107),(51,107),(66,107),(67,107),(68,107),(69,107),(70,107),(71,107),(72,107),(73,107),(74,107),(75,107),(76,107),(77,107),(78,107),(79,107),(80,107),(81,107),(82,107),(83,107),(84,107),(85,107),(86,107),(87,107),(88,107),(89,107),(90,107),(91,107),(92,107),(93,107),(94,107),(95,107),(96,107),(97,107),(98,107),(99,107),(100,107),(101,107),(102,107),(103,107),(104,107),(105,107),(106,107),(107,107),(108,107),(109,107),(110,107),(111,107),(112,107),(113,107),(114,107),(115,107),(12,108),(13,108),(14,108),(15,108),(16,108),(17,108),(18,108),(19,108),(20,108),(21,108),(22,108),(23,108),(24,108),(25,108),(26,108),(27,108),(28,108),(29,108),(30,108),(31,108),(32,108),(33,108),(34,108),(35,108),(36,108),(37,108),(38,108),(39,108),(40,108),(41,108),(42,108),(43,108),(44,108),(45,108),(46,108),(47,108),(48,108),(49,108),(50,108),(51,108),(67,108),(68,108),(69,108),(70,108),(71,108),(72,108),(73,108),(74,108),(75,108),(76,108),(77,108),(78,108),(79,108),(80,108),(81,108),(82,108),(83,108),(84,108),(85,108),(86,108),(87,108),(88,108),(89,108),(90,108),(91,108),(92,108),(93,108),(94,108),(95,108),(96,108),(97,108),(98,108),(99,108),(100,108),(101,108),(102,108),(103,108),(105,108),(106,108),(107,108),(108,108),(109,108),(110,108),(111,108),(112,108),(113,108),(114,108),(14,109),(15,109),(16,109),(18,109),(19,109),(20,109),(21,109),(22,109),(23,109),(24,109),(25,109),(26,109),(27,109),(28,109),(29,109),(30,109),(31,109),(32,109),(33,109),(34,109),(35,109),(36,109),(37,109),(38,109),(39,109),(40,109),(41,109),(42,109),(43,109),(44,109),(45,109),(46,109),(47,109),(48,109),(49,109),(50,109),(68,109),(69,109),(70,109),(71,109),(72,109),(73,109),(74,109),(75,109),(76,109),(77,109),(78,109),(79,109),(80,109),(81,109),(82,109),(83,109),(84,109),(85,109),(86,109),(87,109),(88,109),(89,109),(90,109),(91,109),(92,109),(95,109),(96,109),(97,109),(98,109),(99,109),(101,109),(102,109),(103,109),(104,109),(105,109),(106,109),(107,109),(108,109),(109,109),(110,109),(111,109),(112,109),(113,109)}
location.terrainFeatures = {(4,13),(5,13),(6,13),(8,40),(8,90),(9,16),(10,16),(11,16),(9,65),(9,69),(10,9),(11,9),(12,9),(10,73),(11,73),(10,91),(11,91),(12,91),(11,44),(11,49),(12,49),(11,81),(12,22),(13,22),(12,68),(12,94),(13,94),(13,10),(14,10),(13,95),(14,46),(14,50),(15,24),(16,24),(15,41),(16,41),(15,66),(15,88),(16,88),(16,46),(17,46),(16,58),(17,58),(17,14),(18,14),(19,14),(17,35),(17,44),(17,56),(17,61),(17,90),(18,11),(18,21),(19,21),(18,39),(18,49),(18,96),(19,10),(20,10),(19,18),(20,18),(21,18),(19,35),(20,35),(19,37),(19,44),(20,44),(19,54),(19,59),(19,97),(20,14),(21,14),(20,39),(21,39),(20,61),(21,61),(20,91),(21,91),(21,45),(22,45),(21,52),(21,89),(22,16),(23,16),(24,16),(22,41),(22,55),(23,55),(22,94),(23,41),(24,41),(23,45),(23,52),(24,52),(25,52),(24,55),(24,59),(25,57),(26,57),(25,97),(26,97),(27,97),(26,47),(27,47),(28,47),(26,53),(26,88),(27,88),(26,91),(26,99),(27,42),(27,50),(28,49),(29,49),(28,55),(28,95),(29,95),(29,93),(30,93),(31,93),(29,96),(30,48),(30,90),(31,90),(31,10),(32,10),(31,53),(32,53),(32,44),(33,44),(32,51),(33,55),(35,54),(36,96),(37,96),(37,49),(37,53),(37,93),(38,93),(38,47),(38,51),(39,51),(38,91),(39,91),(40,91),(39,46),(40,46),(40,44),(42,47),(43,47),(44,47),(42,75),(43,15),(43,44),(43,51),(44,74),(45,74),(46,74),(44,94),(45,45),(46,45),(45,96),(47,45),(47,74),(48,11),(49,11),(48,15),(48,18),(48,50),(48,95),(49,95),(50,77),(51,19),(51,49),(52,49),(51,75),(52,75),(52,12),(53,12),(54,12),(53,42),(54,42),(54,11),(54,23),(54,39),(54,44),(54,47),(55,47),(54,71),(55,71),(54,75),(54,80),(55,80),(55,10),(56,10),(55,19),(56,13),(56,18),(57,18),(56,36),(57,36),(58,36),(56,42),(57,78),(58,78),(59,78),(58,38),(59,38),(59,22),(60,22),(59,35),(60,35),(60,12),(61,12),(60,26),(60,36),(61,10),(61,21),(62,21),(63,21),(61,24),(61,31),(61,39),(61,43),(62,23),(63,23),(67,32),(68,30),(69,30),(68,33),(69,33),(68,35),(68,83),(69,83),(70,83),(70,87),(70,98),(71,98),(71,6),(72,6),(71,92),(72,7),(72,10),(73,10),(74,10),(73,5),(73,72),(74,72),(75,72),(73,92),(74,92),(74,90),(74,95),(75,28),(75,85),(76,85),(75,93),(76,93),(76,22),(77,22),(76,30),(77,30),(78,30),(77,11),(78,11),(77,20),(77,67),(78,12),(78,21),(79,21),(80,21),(78,97),(79,97),(80,97),(79,10),(79,94),(80,13),(80,30),(80,65),(81,65),(80,83),(81,83),(81,81),(81,95),(82,95),(82,32),(83,32),(83,64),(83,66),(84,66),(83,81),(84,81),(84,83),(85,83),(86,83),(84,96),(86,65),(87,65),(88,65),(86,73),(87,73),(88,74),(88,93),(90,73),(90,87),(91,86),(92,86),(92,19),(92,64),(93,64),(92,66),(92,88),(93,62),(93,68),(95,73),(96,73),(96,81),(97,81),(97,56),(97,78),(98,78),(99,29),(100,29),(100,16),(100,28),(101,28),(102,28),(100,32),(100,74),(100,86),(101,86),(101,76),(102,76),(101,94),(102,94),(103,94),(103,74),(103,79),(106,87),(107,87),(108,87),(106,91),(106,95),(108,82),(108,98),(109,98),(109,33),(110,33),(111,33),(109,86),(110,86),(109,93),(110,93),(111,93),(110,84),(111,90),(112,94),(113,91),(114,91),(114,95),(115,95),(115,92),(116,33),(117,33),(117,23),(118,23),(118,34),(119,34),(119,35),(10,53),(11,75),(13,14),(13,67),(13,78),(14,83),(15,21),(16,52),(17,16),(18,89),(19,47),(20,17),(21,59),(23,91),(25,50),(29,46),(30,56),(34,47),(36,44),(40,51),(41,94),(44,55),(48,77),(49,17),(51,45),(52,76),(53,21),(55,40),(55,73),(56,50),(56,80),(57,20),(57,26),(58,13),(59,33),(59,42),(66,43),(71,69),(72,75),(72,89),(77,95),(78,65),(85,79),(85,94),(86,49),(88,71),(89,90),(93,85),(95,77),(98,75),(99,84),(103,82),(104,93),(106,81),(109,89)};
location.behindbush = {(4,12),(5,12),(6,12),(8,39),(8,89),(9,15),(10,15),(11,15),(9,64),(9,68),(10,8),(11,8),(12,8),(10,72),(11,72),(10,90),(11,90),(12,90),(11,43),(11,48),(12,48),(11,80),(12,21),(13,21),(12,67),(12,93),(13,93),(13,9),(14,9),(13,94),(14,45),(14,49),(15,23),(16,23),(15,40),(16,40),(15,65),(15,87),(16,87),(16,45),(17,45),(16,57),(17,57),(17,13),(18,13),(19,13),(17,34),(17,43),(17,55),(17,60),(17,89),(18,10),(18,20),(19,20),(18,38),(18,48),(18,95),(19,9),(20,9),(19,17),(20,17),(21,17),(19,34),(20,34),(19,36),(19,43),(20,43),(19,53),(19,58),(19,96),(20,13),(21,13),(20,38),(21,38),(20,60),(21,60),(20,90),(21,90),(21,44),(22,44),(21,51),(21,88),(22,15),(23,15),(24,15),(22,40),(22,54),(23,54),(22,93),(23,40),(24,40),(23,44),(23,51),(24,51),(25,51),(24,54),(24,58),(25,56),(26,56),(25,96),(26,96),(27,96),(26,46),(27,46),(28,46),(26,52),(26,87),(27,87),(26,90),(26,98),(27,41),(27,49),(28,48),(29,48),(28,54),(28,94),(29,94),(29,92),(30,92),(31,92),(29,95),(30,47),(30,89),(31,89),(31,9),(32,9),(31,52),(32,52),(32,43),(33,43),(32,50),(33,54),(35,53),(36,95),(37,95),(37,48),(37,52),(37,92),(38,92),(38,46),(38,50),(39,50),(38,90),(39,90),(40,90),(39,45),(40,45),(40,43),(42,46),(43,46),(44,46),(42,74),(43,14),(43,43),(43,50),(44,73),(45,73),(46,73),(44,93),(45,44),(46,44),(45,95),(47,44),(47,73),(48,10),(49,10),(48,14),(48,17),(48,49),(48,94),(49,94),(50,76),(51,18),(51,48),(52,48),(51,74),(52,74),(52,11),(53,11),(54,11),(53,41),(54,41),(54,10),(54,22),(54,38),(54,43),(54,46),(55,46),(54,70),(55,70),(54,74),(54,79),(55,79),(55,9),(56,9),(55,18),(56,12),(56,17),(57,17),(56,35),(57,35),(58,35),(56,41),(57,77),(58,77),(59,77),(58,37),(59,37),(59,21),(60,21),(59,34),(60,34),(60,11),(61,11),(60,25),(60,35),(61,9),(61,20),(62,20),(63,20),(61,23),(61,30),(61,38),(61,42),(62,22),(63,22),(67,31),(68,29),(69,29),(68,32),(69,32),(68,34),(68,82),(69,82),(70,82),(70,86),(70,97),(71,97),(71,5),(72,5),(71,91),(72,6),(72,9),(73,9),(74,9),(73,4),(73,71),(74,71),(75,71),(73,91),(74,91),(74,89),(74,94),(75,27),(75,84),(76,84),(75,92),(76,92),(76,21),(77,21),(76,29),(77,29),(78,29),(77,10),(78,10),(77,19),(77,66),(78,11),(78,20),(79,20),(80,20),(78,96),(79,96),(80,96),(79,9),(79,93),(80,12),(80,29),(80,64),(81,64),(80,82),(81,82),(81,80),(81,94),(82,94),(82,31),(83,31),(83,63),(83,65),(84,65),(83,80),(84,80),(84,82),(85,82),(86,82),(84,95),(86,64),(87,64),(88,64),(86,72),(87,72),(88,73),(88,92),(90,72),(90,86),(91,85),(92,85),(92,18),(92,63),(93,63),(92,65),(92,87),(93,61),(93,67),(95,72),(96,72),(96,80),(97,80),(97,55),(97,77),(98,77),(99,28),(100,28),(100,15),(100,27),(101,27),(102,27),(100,31),(100,73),(100,85),(101,85),(101,75),(102,75),(101,93),(102,93),(103,93),(103,73),(103,78),(106,86),(107,86),(108,86),(106,90),(106,94),(108,81),(108,97),(109,97),(109,32),(110,32),(111,32),(109,85),(110,85),(109,92),(110,92),(111,92),(110,83),(111,89),(112,93),(113,90),(114,90),(114,94),(115,94),(115,91),(116,32),(117,32),(117,22),(118,22),(118,33),(119,33),(119,34)};
location.behindtree = {(9,50),(9,51),(9,52),(9,53),(10,50),(10,51),(10,52),(10,53),(11,50),(11,51),(11,52),(11,53),(10,72),(10,73),(10,74),(10,75),(11,72),(11,73),(11,74),(11,75),(12,72),(12,73),(12,74),(12,75),(12,11),(12,12),(12,13),(12,14),(13,11),(13,12),(13,13),(13,14),(14,11),(14,12),(14,13),(14,14),(12,64),(12,65),(12,66),(12,67),(13,64),(13,65),(13,66),(13,67),(14,64),(14,65),(14,66),(14,67),(12,75),(12,76),(12,77),(12,78),(13,75),(13,76),(13,77),(13,78),(14,75),(14,76),(14,77),(14,78),(13,80),(13,81),(13,82),(13,83),(14,80),(14,81),(14,82),(14,83),(15,80),(15,81),(15,82),(15,83),(14,18),(14,19),(14,20),(14,21),(15,18),(15,19),(15,20),(15,21),(16,18),(16,19),(16,20),(16,21),(15,49),(15,50),(15,51),(15,52),(16,49),(16,50),(16,51),(16,52),(17,49),(17,50),(17,51),(17,52),(16,13),(16,14),(16,15),(16,16),(17,13),(17,14),(17,15),(17,16),(18,13),(18,14),(18,15),(18,16),(17,86),(17,87),(17,88),(17,89),(18,86),(18,87),(18,88),(18,89),(19,86),(19,87),(19,88),(19,89),(18,44),(18,45),(18,46),(18,47),(19,44),(19,45),(19,46),(19,47),(20,44),(20,45),(20,46),(20,47),(19,14),(19,15),(19,16),(19,17),(20,14),(20,15),(20,16),(20,17),(21,14),(21,15),(21,16),(21,17),(20,56),(20,57),(20,58),(20,59),(21,56),(21,57),(21,58),(21,59),(22,56),(22,57),(22,58),(22,59),(22,88),(22,89),(22,90),(22,91),(23,88),(23,89),(23,90),(23,91),(24,88),(24,89),(24,90),(24,91),(24,47),(24,48),(24,49),(24,50),(25,47),(25,48),(25,49),(25,50),(26,47),(26,48),(26,49),(26,50),(28,43),(28,44),(28,45),(28,46),(29,43),(29,44),(29,45),(29,46),(30,43),(30,44),(30,45),(30,46),(29,53),(29,54),(29,55),(29,56),(30,53),(30,54),(30,55),(30,56),(31,53),(31,54),(31,55),(31,56),(33,44),(33,45),(33,46),(33,47),(34,44),(34,45),(34,46),(34,47),(35,44),(35,45),(35,46),(35,47),(35,41),(35,42),(35,43),(35,44),(36,41),(36,42),(36,43),(36,44),(37,41),(37,42),(37,43),(37,44),(39,48),(39,49),(39,50),(39,51),(40,48),(40,49),(40,50),(40,51),(41,48),(41,49),(41,50),(41,51),(40,91),(40,92),(40,93),(40,94),(41,91),(41,92),(41,93),(41,94),(42,91),(42,92),(42,93),(42,94),(43,52),(43,53),(43,54),(43,55),(44,52),(44,53),(44,54),(44,55),(45,52),(45,53),(45,54),(45,55),(47,74),(47,75),(47,76),(47,77),(48,74),(48,75),(48,76),(48,77),(49,74),(49,75),(49,76),(49,77),(48,14),(48,15),(48,16),(48,17),(49,14),(49,15),(49,16),(49,17),(50,14),(50,15),(50,16),(50,17),(50,42),(50,43),(50,44),(50,45),(51,42),(51,43),(51,44),(51,45),(52,42),(52,43),(52,44),(52,45),(51,73),(51,74),(51,75),(51,76),(52,73),(52,74),(52,75),(52,76),(53,73),(53,74),(53,75),(53,76),(52,18),(52,19),(52,20),(52,21),(53,18),(53,19),(53,20),(53,21),(54,18),(54,19),(54,20),(54,21),(54,37),(54,38),(54,39),(54,40),(55,37),(55,38),(55,39),(55,40),(56,37),(56,38),(56,39),(56,40),(54,70),(54,71),(54,72),(54,73),(55,70),(55,71),(55,72),(55,73),(56,70),(56,71),(56,72),(56,73),(55,47),(55,48),(55,49),(55,50),(56,47),(56,48),(56,49),(56,50),(57,47),(57,48),(57,49),(57,50),(55,77),(55,78),(55,79),(55,80),(56,77),(56,78),(56,79),(56,80),(57,77),(57,78),(57,79),(57,80),(56,17),(56,18),(56,19),(56,20),(57,17),(57,18),(57,19),(57,20),(58,17),(58,18),(58,19),(58,20),(56,23),(56,24),(56,25),(56,26),(57,23),(57,24),(57,25),(57,26),(58,23),(58,24),(58,25),(58,26),(57,10),(57,11),(57,12),(57,13),(58,10),(58,11),(58,12),(58,13),(59,10),(59,11),(59,12),(59,13),(58,30),(58,31),(58,32),(58,33),(59,30),(59,31),(59,32),(59,33),(60,30),(60,31),(60,32),(60,33),(58,39),(58,40),(58,41),(58,42),(59,39),(59,40),(59,41),(59,42),(60,39),(60,40),(60,41),(60,42),(65,40),(65,41),(65,42),(65,43),(66,40),(66,41),(66,42),(66,43),(67,40),(67,41),(67,42),(67,43),(70,66),(70,67),(70,68),(70,69),(71,66),(71,67),(71,68),(71,69),(72,66),(72,67),(72,68),(72,69),(71,72),(71,73),(71,74),(71,75),(72,72),(72,73),(72,74),(72,75),(73,72),(73,73),(73,74),(73,75),(71,86),(71,87),(71,88),(71,89),(72,86),(72,87),(72,88),(72,89),(73,86),(73,87),(73,88),(73,89),(76,92),(76,93),(76,94),(76,95),(77,92),(77,93),(77,94),(77,95),(78,92),(78,93),(78,94),(78,95),(77,62),(77,63),(77,64),(77,65),(78,62),(78,63),(78,64),(78,65),(79,62),(79,63),(79,64),(79,65),(84,76),(84,77),(84,78),(84,79),(85,76),(85,77),(85,78),(85,79),(86,76),(86,77),(86,78),(86,79),(84,91),(84,92),(84,93),(84,94),(85,91),(85,92),(85,93),(85,94),(86,91),(86,92),(86,93),(86,94),(85,46),(85,47),(85,48),(85,49),(86,46),(86,47),(86,48),(86,49),(87,46),(87,47),(87,48),(87,49),(87,68),(87,69),(87,70),(87,71),(88,68),(88,69),(88,70),(88,71),(89,68),(89,69),(89,70),(89,71),(88,87),(88,88),(88,89),(88,90),(89,87),(89,88),(89,89),(89,90),(90,87),(90,88),(90,89),(90,90),(92,82),(92,83),(92,84),(92,85),(93,82),(93,83),(93,84),(93,85),(94,82),(94,83),(94,84),(94,85),(94,74),(94,75),(94,76),(94,77),(95,74),(95,75),(95,76),(95,77),(96,74),(96,75),(96,76),(96,77),(97,72),(97,73),(97,74),(97,75),(98,72),(98,73),(98,74),(98,75),(99,72),(99,73),(99,74),(99,75),(98,81),(98,82),(98,83),(98,84),(99,81),(99,82),(99,83),(99,84),(100,81),(100,82),(100,83),(100,84),(102,79),(102,80),(102,81),(102,82),(103,79),(103,80),(103,81),(103,82),(104,79),(104,80),(104,81),(104,82),(103,90),(103,91),(103,92),(103,93),(104,90),(104,91),(104,92),(104,93),(105,90),(105,91),(105,92),(105,93),(105,78),(105,79),(105,80),(105,81),(106,78),(106,79),(106,80),(106,81),(107,78),(107,79),(107,80),(107,81),(108,86),(108,87),(108,88),(108,89),(109,86),(109,87),(109,88),(109,89),(110,86),(110,87),(110,88),(110,89)};
location.water = [(70,1),(67,3),(67,5),(68,5),(66,10),(73,11),(64,12),(86,12),(87,12),(76,13),(86,13),(87,13),(63,14),(77,14),(62,15),(59,16),(79,16),(94,16),(100,16),(27,17),(42,17),(59,17),(60,17),(91,17),(103,17),(25,18),(28,18),(29,18),(30,18),(31,18),(32,18),(36,18),(37,18),(38,18),(39,18),(40,18),(44,18),(60,18),(61,18),(62,18),(79,18),(80,18),(81,18),(93,18),(104,18),(24,19),(26,19),(27,19),(28,19),(29,19),(30,19),(31,19),(32,19),(36,19),(37,19),(38,19),(39,19),(40,19),(41,19),(46,19),(62,19),(63,19),(74,19),(75,19),(81,19),(82,19),(83,19),(86,19),(87,19),(88,19),(89,19),(93,19),(94,19),(25,20),(26,20),(27,20),(28,20),(29,20),(30,20),(31,20),(32,20),(36,20),(37,20),(38,20),(39,20),(40,20),(41,20),(42,20),(43,20),(44,20),(47,20),(64,20),(65,20),(66,20),(67,20),(68,20),(25,21),(26,21),(27,21),(28,21),(29,21),(30,21),(31,21),(32,21),(36,21),(37,21),(38,21),(39,21),(40,21),(41,21),(42,21),(43,21),(44,21),(45,21),(48,21),(68,21),(69,21),(82,21),(86,21),(94,21),(95,21),(96,21),(97,21),(98,21),(99,21),(100,21),(101,21),(102,21),(103,21),(23,22),(25,22),(26,22),(27,22),(28,22),(29,22),(30,22),(31,22),(32,22),(36,22),(37,22),(38,22),(39,22),(40,22),(41,22),(42,22),(43,22),(44,22),(45,22),(46,22),(49,22),(80,22),(25,23),(26,23),(27,23),(28,23),(29,23),(30,23),(31,23),(32,23),(36,23),(37,23),(38,23),(39,23),(40,23),(41,23),(42,23),(43,23),(44,23),(45,23),(46,23),(47,23),(78,23),(79,23),(98,23),(22,24),(24,24),(25,24),(26,24),(27,24),(28,24),(29,24),(30,24),(31,24),(32,24),(36,24),(37,24),(38,24),(39,24),(40,24),(41,24),(42,24),(43,24),(44,24),(45,24),(46,24),(47,24),(50,24),(89,24),(90,24),(91,24),(94,24),(97,24),(103,24),(111,24),(116,24),(118,24),(21,25),(23,25),(24,25),(25,25),(26,25),(27,25),(28,25),(29,25),(30,25),(31,25),(32,25),(36,25),(37,25),(38,25),(39,25),(40,25),(41,25),(42,25),(43,25),(44,25),(45,25),(46,25),(47,25),(78,25),(79,25),(82,25),(97,25),(98,25),(101,25),(102,25),(22,26),(23,26),(24,26),(25,26),(26,26),(27,26),(28,26),(29,26),(30,26),(31,26),(32,26),(33,26),(34,26),(35,26),(36,26),(37,26),(38,26),(39,26),(40,26),(41,26),(42,26),(43,26),(44,26),(45,26),(46,26),(47,26),(82,26),(83,26),(102,26),(106,26),(107,26),(108,26),(109,26),(112,26),(113,26),(114,26),(115,26),(116,26),(119,26),(19,27),(22,27),(23,27),(24,27),(25,27),(26,27),(27,27),(28,27),(29,27),(30,27),(31,27),(32,27),(33,27),(34,27),(35,27),(36,27),(37,27),(38,27),(39,27),(40,27),(41,27),(42,27),(43,27),(44,27),(45,27),(46,27),(47,27),(93,27),(109,27),(110,27),(116,27),(117,27),(7,28),(22,28),(23,28),(24,28),(25,28),(26,28),(27,28),(28,28),(29,28),(30,28),(31,28),(32,28),(33,28),(34,28),(35,28),(36,28),(37,28),(38,28),(39,28),(40,28),(41,28),(42,28),(43,28),(44,28),(45,28),(46,28),(47,28),(50,28),(90,28),(96,28),(19,29),(22,29),(23,29),(24,29),(25,29),(26,29),(27,29),(28,29),(29,29),(30,29),(31,29),(32,29),(33,29),(34,29),(35,29),(36,29),(37,29),(38,29),(39,29),(40,29),(41,29),(42,29),(43,29),(44,29),(45,29),(46,29),(47,29),(89,29),(95,29),(6,30),(22,30),(23,30),(24,30),(25,30),(26,30),(27,30),(28,30),(29,30),(30,30),(31,30),(32,30),(33,30),(34,30),(35,30),(36,30),(37,30),(38,30),(39,30),(40,30),(41,30),(42,30),(43,30),(44,30),(45,30),(46,30),(47,30),(88,30),(5,31),(22,31),(23,31),(24,31),(25,31),(26,31),(27,31),(28,31),(29,31),(30,31),(31,31),(32,31),(33,31),(34,31),(35,31),(36,31),(37,31),(38,31),(39,31),(40,31),(41,31),(42,31),(43,31),(44,31),(45,31),(46,31),(47,31),(48,31),(49,31),(52,31),(6,32),(20,32),(21,32),(22,32),(23,32),(24,32),(25,32),(26,32),(27,32),(28,32),(29,32),(30,32),(31,32),(32,32),(33,32),(34,32),(35,32),(36,32),(37,32),(38,32),(39,32),(40,32),(41,32),(42,32),(43,32),(44,32),(45,32),(46,32),(47,32),(48,32),(49,32),(50,32),(3,33),(21,33),(22,33),(23,33),(24,33),(25,33),(26,33),(27,33),(28,33),(29,33),(30,33),(31,33),(32,33),(33,33),(34,33),(35,33),(36,33),(37,33),(38,33),(39,33),(40,33),(41,33),(42,33),(43,33),(44,33),(45,33),(46,33),(47,33),(48,33),(49,33),(50,33),(51,33),(53,33),(87,33),(94,33),(95,33),(22,34),(23,34),(24,34),(25,34),(26,34),(27,34),(28,34),(29,34),(30,34),(31,34),(32,34),(33,34),(34,34),(35,34),(36,34),(37,34),(38,34),(39,34),(40,34),(41,34),(42,34),(43,34),(44,34),(45,34),(46,34),(47,34),(48,34),(49,34),(50,34),(51,34),(54,34),(87,34),(88,34),(90,34),(94,34),(110,34),(116,34),(3,35),(7,35),(23,35),(24,35),(25,35),(26,35),(27,35),(28,35),(29,35),(30,35),(31,35),(32,35),(33,35),(34,35),(35,35),(36,35),(37,35),(38,35),(39,35),(40,35),(41,35),(42,35),(43,35),(44,35),(45,35),(46,35),(47,35),(48,35),(49,35),(50,35),(51,35),(88,35),(89,35),(117,35),(26,36),(27,36),(28,36),(29,36),(30,36),(31,36),(32,36),(33,36),(34,36),(35,36),(36,36),(37,36),(38,36),(39,36),(40,36),(41,36),(42,36),(43,36),(44,36),(45,36),(46,36),(47,36),(48,36),(49,36),(50,36),(51,36),(53,36),(98,36),(24,37),(25,37),(26,37),(28,37),(29,37),(30,37),(31,37),(32,37),(33,37),(34,37),(35,37),(36,37),(37,37),(38,37),(39,37),(40,37),(41,37),(42,37),(43,37),(44,37),(45,37),(46,37),(47,37),(48,37),(49,37),(50,37),(51,37),(82,37),(86,37),(88,37),(102,37),(103,37),(104,37),(105,37),(106,37),(107,37),(108,37),(109,37),(110,37),(111,37),(112,37),(113,37),(114,37),(115,37),(116,37),(117,37),(118,37),(119,37),(26,38),(27,38),(28,38),(30,38),(31,38),(32,38),(33,38),(34,38),(35,38),(36,38),(37,38),(38,38),(39,38),(40,38),(41,38),(42,38),(43,38),(44,38),(45,38),(46,38),(47,38),(48,38),(49,38),(50,38),(51,38),(81,38),(101,38),(102,38),(103,38),(104,38),(105,38),(106,38),(107,38),(108,38),(109,38),(110,38),(111,38),(112,38),(113,38),(114,38),(115,38),(116,38),(117,38),(118,38),(119,38),(28,39),(29,39),(31,39),(32,39),(33,39),(34,39),(35,39),(36,39),(37,39),(38,39),(39,39),(40,39),(41,39),(42,39),(43,39),(44,39),(45,39),(46,39),(47,39),(48,39),(49,39),(50,39),(99,39),(100,39),(101,39),(102,39),(103,39),(104,39),(105,39),(106,39),(107,39),(108,39),(109,39),(110,39),(111,39),(112,39),(113,39),(114,39),(115,39),(116,39),(117,39),(118,39),(119,39),(29,40),(30,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(46,40),(47,40),(48,40),(49,40),(92,40),(93,40),(94,40),(95,40),(96,40),(97,40),(98,40),(99,40),(100,40),(101,40),(102,40),(103,40),(104,40),(105,40),(106,40),(107,40),(108,40),(109,40),(110,40),(111,40),(112,40),(113,40),(114,40),(115,40),(116,40),(117,40),(118,40),(119,40),(30,41),(31,41),(32,41),(41,41),(50,41),(78,41),(82,41),(83,41),(84,41),(85,41),(86,41),(87,41),(88,41),(89,41),(90,41),(91,41),(92,41),(93,41),(94,41),(95,41),(96,41),(97,41),(98,41),(99,41),(100,41),(101,41),(102,41),(103,41),(104,41),(105,41),(106,41),(107,41),(108,41),(109,41),(110,41),(111,41),(112,41),(113,41),(114,41),(115,41),(116,41),(117,41),(118,41),(119,41),(32,42),(33,42),(37,42),(38,42),(39,42),(41,42),(42,42),(46,42),(47,42),(48,42),(77,42),(81,42),(82,42),(83,42),(84,42),(85,42),(86,42),(87,42),(88,42),(89,42),(90,42),(91,42),(92,42),(93,42),(94,42),(95,42),(96,42),(97,42),(98,42),(99,42),(100,42),(101,42),(102,42),(103,42),(104,42),(105,42),(106,42),(107,42),(108,42),(109,42),(110,42),(111,42),(112,42),(113,42),(114,42),(115,42),(116,42),(117,42),(118,42),(119,42),(76,43),(80,43),(81,43),(82,43),(83,43),(84,43),(85,43),(86,43),(87,43),(88,43),(89,43),(90,43),(91,43),(92,43),(93,43),(94,43),(95,43),(96,43),(97,43),(98,43),(99,43),(100,43),(101,43),(102,43),(103,43),(104,43),(105,43),(106,43),(107,43),(108,43),(109,43),(110,43),(111,43),(112,43),(113,43),(114,43),(115,43),(116,43),(117,43),(118,43),(119,43),(75,44),(79,44),(80,44),(81,44),(82,44),(83,44),(84,44),(85,44),(86,44),(87,44),(88,44),(89,44),(90,44),(91,44),(92,44),(93,44),(94,44),(95,44),(96,44),(97,44),(98,44),(99,44),(100,44),(101,44),(102,44),(103,44),(104,44),(105,44),(106,44),(107,44),(108,44),(109,44),(110,44),(111,44),(112,44),(113,44),(114,44),(115,44),(116,44),(117,44),(118,44),(119,44),(74,45),(78,45),(79,45),(80,45),(81,45),(82,45),(83,45),(84,45),(85,45),(86,45),(87,45),(88,45),(89,45),(90,45),(91,45),(92,45),(93,45),(94,45),(95,45),(96,45),(97,45),(98,45),(99,45),(100,45),(101,45),(102,45),(103,45),(104,45),(105,45),(106,45),(107,45),(108,45),(109,45),(110,45),(111,45),(112,45),(113,45),(114,45),(115,45),(116,45),(117,45),(118,45),(119,45),(77,46),(78,46),(79,46),(80,46),(81,46),(82,46),(83,46),(84,46),(85,46),(86,46),(87,46),(88,46),(89,46),(90,46),(91,46),(92,46),(93,46),(94,46),(95,46),(96,46),(97,46),(98,46),(99,46),(100,46),(101,46),(102,46),(103,46),(104,46),(105,46),(106,46),(107,46),(108,46),(109,46),(110,46),(111,46),(112,46),(113,46),(114,46),(115,46),(116,46),(117,46),(118,46),(119,46),(74,47),(75,47),(77,47),(78,47),(79,47),(80,47),(81,47),(82,47),(83,47),(84,47),(85,47),(86,47),(87,47),(88,47),(89,47),(90,47),(91,47),(92,47),(93,47),(94,47),(95,47),(96,47),(97,47),(98,47),(99,47),(100,47),(101,47),(102,47),(103,47),(104,47),(105,47),(106,47),(107,47),(108,47),(109,47),(110,47),(111,47),(112,47),(113,47),(114,47),(115,47),(116,47),(117,47),(118,47),(119,47),(77,48),(78,48),(79,48),(80,48),(81,48),(82,48),(83,48),(85,48),(86,48),(87,48),(88,48),(89,48),(90,48),(91,48),(92,48),(93,48),(94,48),(95,48),(96,48),(97,48),(98,48),(99,48),(100,48),(101,48),(102,48),(103,48),(104,48),(105,48),(106,48),(107,48),(108,48),(109,48),(110,48),(111,48),(112,48),(113,48),(114,48),(115,48),(116,48),(117,48),(118,48),(119,48),(63,49),(77,49),(78,49),(79,49),(80,49),(81,49),(82,49),(87,49),(88,49),(89,49),(90,49),(91,49),(92,49),(93,49),(94,49),(95,49),(96,49),(97,49),(98,49),(99,49),(100,49),(101,49),(102,49),(103,49),(104,49),(105,49),(107,49),(109,49),(110,49),(111,49),(112,49),(113,49),(114,49),(115,49),(116,49),(117,49),(118,49),(119,49),(60,50),(76,50),(77,50),(78,50),(79,50),(80,50),(81,50),(82,50),(84,50),(87,50),(89,50),(90,50),(91,50),(92,50),(93,50),(94,50),(95,50),(96,50),(97,50),(98,50),(99,50),(100,50),(101,50),(102,50),(103,50),(58,51),(62,51),(63,51),(64,51),(65,51),(66,51),(67,51),(68,51),(69,51),(70,51),(71,51),(72,51),(73,51),(74,51),(75,51),(76,51),(77,51),(78,51),(79,51),(80,51),(81,51),(82,51),(89,51),(90,51),(91,51),(92,51),(93,51),(94,51),(95,51),(96,51),(97,51),(98,51),(99,51),(100,51),(102,51),(103,51),(104,51),(56,52),(60,52),(61,52),(62,52),(63,52),(64,52),(65,52),(66,52),(67,52),(68,52),(69,52),(70,52),(71,52),(72,52),(73,52),(74,52),(75,52),(76,52),(77,52),(78,52),(79,52),(80,52),(81,52),(82,52),(83,52),(84,52),(86,52),(87,52),(88,52),(89,52),(90,52),(91,52),(92,52),(93,52),(94,52),(97,52),(98,52),(99,52),(52,53),(58,53),(59,53),(60,53),(61,53),(62,53),(63,53),(64,53),(65,53),(66,53),(67,53),(68,53),(69,53),(70,53),(71,53),(72,53),(73,53),(74,53),(75,53),(76,53),(77,53),(78,53),(79,53),(80,53),(81,53),(82,53),(83,53),(84,53),(85,53),(86,53),(87,53),(88,53),(89,53),(90,53),(91,53),(92,53),(95,53),(96,53),(97,53),(98,53),(99,53),(109,53),(51,54),(56,54),(57,54),(58,54),(59,54),(60,54),(61,54),(62,54),(63,54),(64,54),(65,54),(66,54),(67,54),(68,54),(69,54),(70,54),(71,54),(72,54),(73,54),(74,54),(75,54),(76,54),(77,54),(78,54),(79,54),(80,54),(81,54),(82,54),(83,54),(84,54),(85,54),(86,54),(87,54),(88,54),(89,54),(90,54),(91,54),(49,55),(54,55),(55,55),(56,55),(57,55),(58,55),(59,55),(60,55),(61,55),(62,55),(63,55),(64,55),(65,55),(66,55),(67,55),(68,55),(69,55),(70,55),(71,55),(72,55),(73,55),(74,55),(75,55),(76,55),(77,55),(78,55),(79,55),(80,55),(81,55),(82,55),(83,55),(84,55),(85,55),(86,55),(87,55),(88,55),(89,55),(90,55),(91,55),(45,56),(52,56),(53,56),(54,56),(55,56),(56,56),(57,56),(58,56),(59,56),(60,56),(61,56),(62,56),(63,56),(64,56),(65,56),(66,56),(67,56),(68,56),(69,56),(70,56),(71,56),(72,56),(73,56),(74,56),(75,56),(76,56),(77,56),(78,56),(79,56),(80,56),(81,56),(82,56),(83,56),(84,56),(85,56),(86,56),(87,56),(88,56),(89,56),(91,56),(41,57),(49,57),(50,57),(51,57),(52,57),(53,57),(54,57),(55,57),(56,57),(57,57),(58,57),(59,57),(60,57),(61,57),(62,57),(63,57),(64,57),(65,57),(66,57),(67,57),(68,57),(69,57),(70,57),(71,57),(72,57),(73,57),(74,57),(75,57),(76,57),(77,57),(78,57),(79,57),(80,57),(81,57),(82,57),(83,57),(84,57),(85,57),(86,57),(40,58),(46,58),(47,58),(48,58),(49,58),(50,58),(51,58),(52,58),(53,58),(54,58),(55,58),(56,58),(57,58),(58,58),(59,58),(60,58),(61,58),(62,58),(63,58),(64,58),(65,58),(66,58),(67,58),(68,58),(69,58),(70,58),(71,58),(72,58),(73,58),(74,58),(75,58),(76,58),(77,58),(78,58),(79,58),(80,58),(81,58),(82,58),(83,58),(84,58),(85,58),(86,58),(36,59),(44,59),(45,59),(46,59),(47,59),(48,59),(49,59),(50,59),(51,59),(52,59),(53,59),(54,59),(55,59),(56,59),(57,59),(58,59),(59,59),(60,59),(61,59),(62,59),(63,59),(64,59),(65,59),(66,59),(67,59),(68,59),(69,59),(70,59),(71,59),(72,59),(73,59),(74,59),(75,59),(76,59),(77,59),(78,59),(79,59),(80,59),(81,59),(82,59),(83,59),(84,59),(41,60),(42,60),(43,60),(44,60),(45,60),(46,60),(47,60),(48,60),(49,60),(50,60),(51,60),(52,60),(53,60),(54,60),(55,60),(56,60),(57,60),(58,60),(59,60),(60,60),(61,60),(62,60),(63,60),(64,60),(65,60),(66,60),(67,60),(68,60),(69,60),(70,60),(71,60),(72,60),(73,60),(74,60),(76,60),(77,60),(79,60),(80,60),(81,60),(82,60),(83,60),(86,60),(87,60),(33,61),(39,61),(40,61),(41,61),(42,61),(43,61),(44,61),(45,61),(46,61),(47,61),(48,61),(49,61),(50,61),(51,61),(52,61),(53,61),(54,61),(55,61),(56,61),(57,61),(58,61),(59,61),(60,61),(61,61),(62,61),(63,61),(64,61),(65,61),(66,61),(67,61),(68,61),(70,61),(77,61),(78,61),(79,61),(80,61),(83,61),(84,61),(32,62),(37,62),(38,62),(39,62),(40,62),(41,62),(42,62),(43,62),(44,62),(45,62),(46,62),(47,62),(48,62),(49,62),(50,62),(51,62),(52,62),(53,62),(54,62),(55,62),(56,62),(57,62),(58,62),(59,62),(60,62),(61,62),(62,62),(63,62),(64,62),(65,62),(66,62),(70,62),(71,62),(74,62),(80,62),(81,62),(27,63),(29,63),(30,63),(35,63),(36,63),(37,63),(38,63),(39,63),(40,63),(41,63),(42,63),(43,63),(44,63),(45,63),(46,63),(47,63),(48,63),(49,63),(50,63),(51,63),(52,63),(53,63),(54,63),(55,63),(56,63),(57,63),(58,63),(59,63),(60,63),(61,63),(62,63),(63,63),(64,63),(33,64),(34,64),(35,64),(36,64),(37,64),(38,64),(39,64),(40,64),(41,64),(42,64),(43,64),(44,64),(45,64),(46,64),(47,64),(48,64),(49,64),(50,64),(51,64),(52,64),(53,64),(54,64),(55,64),(56,64),(57,64),(58,64),(59,64),(60,64),(61,64),(62,64),(63,64),(64,64),(70,64),(74,64),(26,65),(31,65),(32,65),(33,65),(34,65),(35,65),(36,65),(37,65),(38,65),(39,65),(40,65),(41,65),(42,65),(43,65),(44,65),(45,65),(46,65),(47,65),(48,65),(49,65),(50,65),(51,65),(52,65),(53,65),(54,65),(55,65),(56,65),(57,65),(58,65),(59,65),(60,65),(61,65),(62,65),(63,65),(64,65),(21,66),(23,66),(24,66),(29,66),(30,66),(31,66),(32,66),(33,66),(34,66),(35,66),(36,66),(37,66),(38,66),(39,66),(40,66),(41,66),(42,66),(43,66),(44,66),(45,66),(46,66),(47,66),(48,66),(49,66),(50,66),(51,66),(52,66),(53,66),(54,66),(55,66),(56,66),(57,66),(58,66),(59,66),(60,66),(61,66),(62,66),(63,66),(64,66),(67,66),(27,67),(28,67),(29,67),(30,67),(31,67),(32,67),(33,67),(34,67),(35,67),(36,67),(37,67),(38,67),(39,67),(40,67),(41,67),(42,67),(43,67),(44,67),(45,67),(46,67),(47,67),(48,67),(49,67),(50,67),(51,67),(52,67),(53,67),(54,67),(55,67),(58,67),(59,67),(60,67),(61,67),(62,67),(63,67),(64,67),(70,67),(71,67),(20,68),(25,68),(26,68),(27,68),(28,68),(29,68),(30,68),(31,68),(32,68),(33,68),(34,68),(35,68),(36,68),(37,68),(38,68),(39,68),(40,68),(41,68),(42,68),(43,68),(44,68),(45,68),(46,68),(47,68),(48,68),(49,68),(50,68),(51,68),(52,68),(61,68),(62,68),(63,68),(64,68),(65,68),(71,68),(72,68),(23,69),(24,69),(25,69),(26,69),(27,69),(28,69),(29,69),(30,69),(31,69),(32,69),(33,69),(34,69),(35,69),(36,69),(37,69),(38,69),(39,69),(40,69),(41,69),(42,69),(43,69),(44,69),(45,69),(46,69),(47,69),(48,69),(52,69),(53,69),(54,69),(55,69),(59,69),(60,69),(62,69),(63,69),(64,69),(65,69),(67,69),(80,69),(82,69),(19,70),(22,70),(23,70),(24,70),(25,70),(26,70),(27,70),(28,70),(29,70),(30,70),(31,70),(32,70),(33,70),(34,70),(35,70),(36,70),(37,70),(38,70),(39,70),(40,70),(41,70),(42,70),(43,70),(44,70),(46,70),(47,70),(48,70),(49,70),(50,70),(62,70),(63,70),(64,70),(65,70),(79,70),(18,71),(22,71),(23,71),(24,71),(25,71),(26,71),(27,71),(28,71),(29,71),(30,71),(31,71),(32,71),(33,71),(34,71),(35,71),(36,71),(37,71),(38,71),(39,71),(40,71),(41,71),(44,71),(59,71),(62,71),(63,71),(64,71),(65,71),(68,71),(78,71),(21,72),(22,72),(23,72),(24,72),(25,72),(26,72),(27,72),(28,72),(29,72),(30,72),(31,72),(32,72),(33,72),(34,72),(35,72),(36,72),(37,72),(38,72),(39,72),(42,72),(62,72),(63,72),(64,72),(65,72),(66,72),(69,72),(77,72),(83,72),(18,73),(19,73),(21,73),(22,73),(23,73),(24,73),(25,73),(26,73),(27,73),(28,73),(29,73),(30,73),(31,73),(32,73),(33,73),(34,73),(35,73),(36,73),(37,73),(38,73),(40,73),(62,73),(63,73),(64,73),(65,73),(66,73),(75,73),(21,74),(22,74),(23,74),(24,74),(25,74),(26,74),(27,74),(28,74),(29,74),(30,74),(31,74),(32,74),(33,74),(34,74),(35,74),(36,74),(37,74),(62,74),(63,74),(64,74),(65,74),(66,74),(74,74),(0,75),(21,75),(22,75),(23,75),(24,75),(25,75),(26,75),(27,75),(28,75),(29,75),(30,75),(31,75),(32,75),(33,75),(34,75),(35,75),(36,75),(37,75),(59,75),(62,75),(63,75),(64,75),(65,75),(66,75),(73,75),(86,75),(91,75),(18,76),(21,76),(22,76),(23,76),(24,76),(25,76),(26,76),(27,76),(28,76),(29,76),(30,76),(31,76),(32,76),(33,76),(34,76),(35,76),(36,76),(37,76),(40,76),(59,76),(62,76),(63,76),(64,76),(65,76),(66,76),(67,76),(69,76),(72,76),(93,76),(21,77),(22,77),(23,77),(24,77),(25,77),(26,77),(27,77),(28,77),(29,77),(30,77),(31,77),(32,77),(33,77),(34,77),(35,77),(36,77),(37,77),(38,77),(42,77),(62,77),(63,77),(64,77),(65,77),(66,77),(67,77),(86,77),(87,77),(18,78),(19,78),(21,78),(22,78),(23,78),(24,78),(25,78),(26,78),(27,78),(28,78),(29,78),(30,78),(31,78),(32,78),(33,78),(34,78),(35,78),(36,78),(37,78),(38,78),(39,78),(46,78),(59,78),(60,78),(62,78),(63,78),(64,78),(65,78),(66,78),(67,78),(72,78),(73,78),(94,78),(19,79),(20,79),(21,79),(22,79),(23,79),(24,79),(25,79),(26,79),(27,79),(28,79),(29,79),(30,79),(31,79),(32,79),(33,79),(34,79),(35,79),(36,79),(37,79),(38,79),(39,79),(40,79),(41,79),(42,79),(49,79),(62,79),(63,79),(64,79),(65,79),(66,79),(67,79),(69,79),(22,80),(23,80),(24,80),(25,80),(26,80),(27,80),(28,80),(29,80),(30,80),(31,80),(32,80),(33,80),(34,80),(35,80),(36,80),(37,80),(38,80),(39,80),(40,80),(41,80),(42,80),(43,80),(44,80),(45,80),(52,80),(62,80),(63,80),(64,80),(65,80),(66,80),(67,80),(78,80),(79,80),(80,80),(87,80),(88,80),(20,81),(22,81),(23,81),(24,81),(25,81),(26,81),(27,81),(28,81),(29,81),(30,81),(31,81),(32,81),(33,81),(34,81),(35,81),(36,81),(37,81),(38,81),(39,81),(40,81),(41,81),(42,81),(43,81),(44,81),(45,81),(46,81),(47,81),(48,81),(54,81),(59,81),(62,81),(63,81),(64,81),(65,81),(66,81),(67,81),(73,81),(74,81),(75,81),(76,81),(88,81),(89,81),(90,81),(1,82),(2,82),(3,82),(4,82),(5,82),(6,82),(23,82),(24,82),(25,82),(26,82),(27,82),(28,82),(29,82),(30,82),(31,82),(32,82),(33,82),(34,82),(35,82),(38,82),(39,82),(40,82),(41,82),(42,82),(43,82),(44,82),(45,82),(46,82),(47,82),(48,82),(49,82),(50,82),(51,82),(52,82),(61,82),(62,82),(63,82),(64,82),(65,82),(66,82),(67,82),(91,82),(92,82),(93,82),(21,83),(22,83),(24,83),(25,83),(26,83),(27,83),(28,83),(29,83),(30,83),(31,83),(32,83),(33,83),(34,83),(35,83),(42,83),(43,83),(44,83),(45,83),(46,83),(47,83),(48,83),(49,83),(50,83),(51,83),(52,83),(53,83),(54,83),(55,83),(60,83),(61,83),(62,83),(63,83),(64,83),(65,83),(66,83),(68,83),(22,84),(23,84),(24,84),(26,84),(27,84),(28,84),(29,84),(30,84),(31,84),(32,84),(33,84),(34,84),(35,84),(36,84),(42,84),(43,84),(44,84),(45,84),(46,84),(47,84),(48,84),(49,84),(50,84),(51,84),(52,84),(53,84),(54,84),(55,84),(56,84),(59,84),(60,84),(61,84),(62,84),(63,84),(64,84),(65,84),(66,84),(82,84),(89,84),(24,85),(25,85),(26,85),(28,85),(29,85),(30,85),(31,85),(32,85),(33,85),(34,85),(35,85),(36,85),(37,85),(38,85),(39,85),(40,85),(41,85),(42,85),(43,85),(44,85),(45,85),(46,85),(47,85),(48,85),(49,85),(50,85),(51,85),(52,85),(53,85),(54,85),(55,85),(56,85),(59,85),(60,85),(61,85),(62,85),(63,85),(64,85),(65,85),(66,85),(81,85),(26,86),(27,86),(28,86),(30,86),(31,86),(32,86),(33,86),(34,86),(35,86),(36,86),(37,86),(38,86),(39,86),(40,86),(41,86),(42,86),(43,86),(44,86),(45,86),(46,86),(47,86),(48,86),(49,86),(50,86),(51,86),(52,86),(53,86),(54,86),(55,86),(56,86),(57,86),(59,86),(60,86),(61,86),(62,86),(63,86),(64,86),(65,86),(66,86),(80,86),(0,87),(1,87),(2,87),(28,87),(29,87),(33,87),(34,87),(35,87),(36,87),(37,87),(38,87),(39,87),(40,87),(41,87),(42,87),(43,87),(44,87),(45,87),(46,87),(47,87),(48,87),(49,87),(50,87),(51,87),(52,87),(53,87),(54,87),(55,87),(56,87),(57,87),(59,87),(60,87),(61,87),(62,87),(63,87),(64,87),(65,87),(79,87),(95,87),(98,87),(0,88),(1,88),(2,88),(29,88),(30,88),(31,88),(32,88),(39,88),(40,88),(41,88),(42,88),(43,88),(44,88),(45,88),(46,88),(47,88),(48,88),(49,88),(50,88),(51,88),(52,88),(53,88),(54,88),(55,88),(56,88),(57,88),(58,88),(59,88),(60,88),(61,88),(62,88),(63,88),(64,88),(78,88),(93,88),(99,88),(0,89),(1,89),(2,89),(32,89),(33,89),(34,89),(35,89),(36,89),(37,89),(38,89),(42,89),(43,89),(44,89),(45,89),(46,89),(47,89),(48,89),(49,89),(50,89),(51,89),(52,89),(53,89),(54,89),(55,89),(56,89),(57,89),(58,89),(59,89),(60,89),(61,89),(62,89),(63,89),(0,90),(1,90),(2,90),(3,90),(38,90),(39,90),(40,90),(41,90),(42,90),(43,90),(45,90),(46,90),(47,90),(48,90),(49,90),(50,90),(51,90),(52,90),(53,90),(54,90),(55,90),(56,90),(57,90),(58,90),(59,90),(60,90),(61,90),(62,90),(63,90),(78,90),(79,90),(80,90),(81,90),(84,90),(85,90),(86,90),(100,90),(0,91),(1,91),(2,91),(3,91),(43,91),(44,91),(48,91),(49,91),(50,91),(51,91),(52,91),(53,91),(54,91),(55,91),(56,91),(57,91),(58,91),(59,91),(60,91),(61,91),(62,91),(63,91),(64,91),(81,91),(82,91),(93,91),(94,91),(95,91),(96,91),(0,92),(1,92),(2,92),(3,92),(44,92),(45,92),(46,92),(47,92),(48,92),(49,92),(50,92),(51,92),(52,92),(53,92),(54,92),(55,92),(56,92),(57,92),(58,92),(59,92),(60,92),(61,92),(62,92),(63,92),(64,92),(0,93),(1,93),(2,93),(3,93),(48,93),(49,93),(50,93),(51,93),(52,93),(53,93),(54,93),(55,93),(56,93),(57,93),(58,93),(59,93),(60,93),(61,93),(62,93),(63,93),(64,93),(65,93),(96,93),(97,93),(0,94),(1,94),(2,94),(3,94),(51,94),(52,94),(53,94),(54,94),(55,94),(56,94),(57,94),(58,94),(59,94),(60,94),(61,94),(62,94),(63,94),(64,94),(65,94),(0,95),(1,95),(2,95),(3,95),(52,95),(53,95),(54,95),(55,95),(56,95),(57,95),(58,95),(59,95),(60,95),(61,95),(62,95),(63,95),(64,95),(65,95),(0,96),(1,96),(2,96),(3,96),(52,96),(53,96),(54,96),(55,96),(56,96),(57,96),(58,96),(59,96),(60,96),(61,96),(62,96),(63,96),(64,96),(65,96),(99,96),(0,97),(1,97),(2,97),(3,97),(52,97),(53,97),(54,97),(55,97),(56,97),(57,97),(58,97),(59,97),(60,97),(61,97),(62,97),(63,97),(64,97),(65,97),(66,97),(99,97),(0,98),(1,98),(2,98),(3,98),(52,98),(53,98),(54,98),(55,98),(56,98),(57,98),(58,98),(59,98),(60,98),(61,98),(62,98),(63,98),(64,98),(65,98),(66,98),(0,99),(1,99),(2,99),(3,99),(52,99),(53,99),(54,99),(55,99),(56,99),(57,99),(58,99),(59,99),(60,99),(61,99),(62,99),(63,99),(64,99),(65,99),(66,99),(117,99),(0,100),(1,100),(2,100),(3,100),(49,100),(52,100),(53,100),(54,100),(55,100),(56,100),(57,100),(58,100),(59,100),(60,100),(61,100),(62,100),(63,100),(64,100),(65,100),(66,100),(116,100),(0,101),(1,101),(2,101),(3,101),(4,101),(52,101),(53,101),(54,101),(55,101),(56,101),(57,101),(58,101),(59,101),(60,101),(61,101),(62,101),(63,101),(64,101),(65,101),(66,101),(96,101),(0,102),(1,102),(2,102),(3,102),(4,102),(5,102),(6,102),(52,102),(53,102),(54,102),(55,102),(56,102),(57,102),(58,102),(59,102),(60,102),(61,102),(62,102),(63,102),(64,102),(65,102),(66,102),(115,102),(0,103),(1,103),(2,103),(3,103),(4,103),(5,103),(6,103),(7,103),(51,103),(52,103),(53,103),(54,103),(55,103),(56,103),(57,103),(58,103),(59,103),(60,103),(61,103),(62,103),(63,103),(64,103),(65,103),(66,103),(114,103),(119,103),(0,104),(1,104),(2,104),(3,104),(4,104),(5,104),(6,104),(7,104),(8,104),(51,104),(52,104),(53,104),(54,104),(55,104),(56,104),(57,104),(58,104),(59,104),(60,104),(61,104),(62,104),(63,104),(64,104),(65,104),(66,104),(113,104),(118,104),(119,104),(0,105),(1,105),(2,105),(3,105),(4,105),(5,105),(6,105),(7,105),(8,105),(9,105),(10,105),(51,105),(52,105),(53,105),(54,105),(55,105),(56,105),(57,105),(58,105),(59,105),(60,105),(61,105),(62,105),(63,105),(64,105),(65,105),(66,105),(111,105),(117,105),(118,105),(119,105),(0,106),(1,106),(2,106),(3,106),(4,106),(5,106),(6,106),(7,106),(8,106),(9,106),(10,106),(11,106),(51,106),(52,106),(53,106),(54,106),(55,106),(56,106),(57,106),(58,106),(59,106),(60,106),(61,106),(62,106),(63,106),(64,106),(65,106),(66,106),(115,106),(116,106),(117,106),(118,106),(119,106),(0,107),(1,107),(2,107),(3,107),(4,107),(5,107),(6,107),(7,107),(8,107),(9,107),(10,107),(11,107),(12,107),(51,107),(52,107),(53,107),(54,107),(55,107),(56,107),(57,107),(58,107),(59,107),(60,107),(61,107),(62,107),(63,107),(64,107),(65,107),(66,107),(67,107),(114,107),(115,107),(116,107),(117,107),(118,107),(119,107),(0,108),(1,108),(2,108),(3,108),(4,108),(5,108),(6,108),(7,108),(8,108),(9,108),(10,108),(11,108),(12,108),(13,108),(14,108),(15,108),(16,108),(17,108),(18,108),(50,108),(51,108),(52,108),(53,108),(54,108),(55,108),(56,108),(57,108),(58,108),(59,108),(60,108),(61,108),(62,108),(63,108),(64,108),(65,108),(66,108),(67,108),(68,108),(92,108),(93,108),(94,108),(95,108),(96,108),(97,108),(98,108),(99,108),(100,108),(101,108),(113,108),(114,108),(115,108),(116,108),(117,108),(118,108),(119,108),(0,109),(1,109),(2,109),(3,109),(4,109),(5,109),(6,109),(7,109),(8,109),(9,109),(10,109),(11,109),(12,109),(13,109),(14,109),(15,109),(16,109),(17,109),(18,109),(19,109),(20,109),(21,109),(22,109),(23,109),(24,109),(25,109),(26,109),(27,109),(28,109),(29,109),(30,109),(31,109),(32,109),(33,109),(34,109),(35,109),(36,109),(37,109),(38,109),(39,109),(40,109),(41,109),(42,109),(43,109),(44,109),(45,109),(46,109),(47,109),(48,109),(49,109),(50,109),(51,109),(52,109),(53,109),(54,109),(55,109),(56,109),(57,109),(58,109),(59,109),(60,109),(61,109),(62,109),(63,109),(64,109),(65,109),(66,109),(67,109),(68,109),(69,109),(70,109),(71,109),(72,109),(73,109),(74,109),(75,109),(76,109),(77,109),(78,109),(79,109),(80,109),(81,109),(82,109),(83,109),(84,109),(85,109),(86,109),(87,109),(88,109),(89,109),(90,109),(91,109),(92,109),(93,109),(94,109),(95,109),(96,109),(97,109),(98,109),(99,109),(100,109),(101,109),(102,109),(103,109),(104,109),(105,109),(106,109),(107,109),(108,109),(109,109),(110,109),(111,109),(112,109),(113,109),(114,109),(115,109),(116,109),(117,109),(118,109),(119,109),(0,110),(1,110),(2,110),(3,110),(4,110),(5,110),(6,110),(7,110),(8,110),(9,110),(10,110),(11,110),(12,110),(13,110),(14,110),(15,110),(16,110),(17,110),(18,110),(19,110),(20,110),(21,110),(22,110),(23,110),(24,110),(25,110),(26,110),(27,110),(28,110),(29,110),(30,110),(31,110),(32,110),(33,110),(34,110),(35,110),(36,110),(37,110),(38,110),(39,110),(40,110),(41,110),(42,110),(43,110),(44,110),(45,110),(46,110),(47,110),(48,110),(49,110),(50,110),(51,110),(52,110),(53,110),(54,110),(55,110),(56,110),(57,110),(58,110),(59,110),(60,110),(61,110),(62,110),(63,110),(64,110),(65,110),(66,110),(67,110),(68,110),(69,110),(70,110),(71,110),(72,110),(73,110),(74,110),(75,110),(76,110),(77,110),(78,110),(79,110),(80,110),(81,110),(82,110),(83,110),(84,110),(85,110),(86,110),(87,110),(88,110),(89,110),(90,110),(91,110),(92,110),(93,110),(94,110),(95,110),(96,110),(97,110),(98,110),(99,110),(100,110),(101,110),(102,110),(103,110),(104,110),(105,110),(106,110),(107,110),(108,110),(109,110),(110,110),(111,110),(112,110),(113,110),(114,110),(115,110),(116,110),(117,110),(118,110),(119,110),(0,111),(1,111),(2,111),(3,111),(4,111),(5,111),(6,111),(7,111),(8,111),(9,111),(10,111),(11,111),(12,111),(13,111),(14,111),(15,111),(16,111),(17,111),(18,111),(19,111),(20,111),(21,111),(22,111),(23,111),(24,111),(25,111),(26,111),(27,111),(28,111),(29,111),(30,111),(31,111),(32,111),(33,111),(34,111),(35,111),(36,111),(37,111),(38,111),(39,111),(40,111),(41,111),(42,111),(43,111),(44,111),(45,111),(46,111),(47,111),(48,111),(49,111),(50,111),(51,111),(52,111),(53,111),(54,111),(55,111),(56,111),(57,111),(58,111),(59,111),(60,111),(61,111),(62,111),(63,111),(64,111),(65,111),(66,111),(67,111),(68,111),(69,111),(70,111),(71,111),(72,111),(73,111),(74,111),(75,111),(76,111),(77,111),(78,111),(79,111),(80,111),(81,111),(82,111),(83,111),(84,111),(85,111),(86,111),(87,111),(88,111),(89,111),(90,111),(91,111),(92,111),(93,111),(94,111),(95,111),(96,111),(97,111),(98,111),(99,111),(100,111),(101,111),(102,111),(103,111),(104,111),(105,111),(106,111),(107,111),(108,111),(109,111),(110,111),(111,111),(112,111),(113,111),(114,111),(115,111),(116,111),(117,111),(118,111),(119,111),(0,112),(1,112),(2,112),(3,112),(4,112),(5,112),(6,112),(7,112),(8,112),(9,112),(10,112),(11,112),(12,112),(13,112),(14,112),(15,112),(16,112),(17,112),(18,112),(19,112),(20,112),(21,112),(22,112),(23,112),(24,112),(25,112),(26,112),(27,112),(28,112),(29,112),(30,112),(31,112),(32,112),(33,112),(34,112),(35,112),(36,112),(37,112),(38,112),(39,112),(40,112),(41,112),(42,112),(43,112),(44,112),(45,112),(46,112),(47,112),(48,112),(49,112),(50,112),(51,112),(52,112),(53,112),(54,112),(55,112),(56,112),(57,112),(58,112),(59,112),(60,112),(61,112),(62,112),(63,112),(64,112),(65,112),(66,112),(67,112),(68,112),(69,112),(70,112),(71,112),(72,112),(73,112),(74,112),(75,112),(76,112),(77,112),(78,112),(79,112),(80,112),(81,112),(82,112),(83,112),(84,112),(85,112),(86,112),(87,112),(88,112),(89,112),(90,112),(91,112),(92,112),(93,112),(94,112),(95,112),(96,112),(97,112),(98,112),(99,112),(100,112),(101,112),(102,112),(103,112),(104,112),(105,112),(106,112),(107,112),(108,112),(109,112),(110,112),(111,112),(112,112),(113,112),(114,112),(115,112),(116,112),(117,112),(118,112),(119,112),(0,113),(1,113),(2,113),(3,113),(4,113),(5,113),(6,113),(7,113),(8,113),(9,113),(10,113),(11,113),(12,113),(13,113),(14,113),(15,113),(16,113),(17,113),(18,113),(19,113),(20,113),(21,113),(22,113),(23,113),(24,113),(25,113),(26,113),(27,113),(28,113),(29,113),(30,113),(31,113),(32,113),(33,113),(34,113),(35,113),(36,113),(37,113),(38,113),(39,113),(40,113),(41,113),(42,113),(43,113),(44,113),(45,113),(46,113),(47,113),(48,113),(49,113),(50,113),(51,113),(52,113),(53,113),(54,113),(55,113),(56,113),(57,113),(58,113),(59,113),(60,113),(61,113),(62,113),(63,113),(64,113),(65,113),(66,113),(67,113),(68,113),(69,113),(70,113),(71,113),(72,113),(73,113),(74,113),(75,113),(76,113),(77,113),(78,113),(79,113),(80,113),(81,113),(82,113),(83,113),(84,113),(85,113),(86,113),(87,113),(88,113),(89,113),(90,113),(91,113),(92,113),(93,113),(94,113),(95,113),(96,113),(97,113),(98,113),(99,113),(100,113),(101,113),(102,113),(103,113),(104,113),(105,113),(106,113),(107,113),(108,113),(109,113),(110,113),(111,113),(112,113),(113,113),(114,113),(115,113),(116,113),(117,113),(118,113),(119,113),(0,114),(1,114),(2,114),(3,114),(4,114),(5,114),(6,114),(7,114),(8,114),(9,114),(10,114),(11,114),(12,114),(13,114),(14,114),(15,114),(16,114),(17,114),(18,114),(19,114),(20,114),(21,114),(22,114),(23,114),(24,114),(25,114),(26,114),(27,114),(28,114),(29,114),(30,114),(31,114),(32,114),(33,114),(34,114),(35,114),(36,114),(37,114),(38,114),(39,114),(40,114),(41,114),(42,114),(43,114),(44,114),(45,114),(46,114),(47,114),(48,114),(49,114),(50,114),(51,114),(52,114),(53,114),(54,114),(55,114),(56,114),(57,114),(58,114),(59,114),(60,114),(61,114),(62,114),(63,114),(64,114),(65,114),(66,114),(67,114),(68,114),(69,114),(70,114),(71,114),(72,114),(73,114),(74,114),(75,114),(76,114),(77,114),(78,114),(79,114),(80,114),(81,114),(82,114),(83,114),(84,114),(85,114),(86,114),(87,114),(88,114),(89,114),(90,114),(91,114),(92,114),(93,114),(94,114),(95,114),(96,114),(97,114),(98,114),(99,114),(100,114),(101,114),(102,114),(103,114),(104,114),(105,114),(106,114),(107,114),(108,114),(109,114),(110,114),(111,114),(112,114),(113,114),(114,114),(115,114),(116,114),(117,114),(118,114),(119,114),(0,115),(1,115),(2,115),(3,115),(4,115),(5,115),(6,115),(7,115),(8,115),(9,115),(10,115),(11,115),(12,115),(13,115),(14,115),(15,115),(16,115),(17,115),(18,115),(19,115),(20,115),(21,115),(22,115),(23,115),(24,115),(25,115),(26,115),(27,115),(28,115),(29,115),(30,115),(31,115),(32,115),(33,115),(34,115),(35,115),(36,115),(37,115),(38,115),(39,115),(40,115),(41,115),(42,115),(43,115),(44,115),(45,115),(46,115),(47,115),(48,115),(49,115),(50,115),(51,115),(52,115),(53,115),(54,115),(55,115),(56,115),(57,115),(58,115),(59,115),(60,115),(61,115),(62,115),(63,115),(64,115),(65,115),(66,115),(67,115),(68,115),(69,115),(70,115),(71,115),(72,115),(73,115),(74,115),(75,115),(76,115),(77,115),(78,115),(79,115),(80,115),(81,115),(82,115),(83,115),(84,115),(85,115),(86,115),(87,115),(88,115),(89,115),(90,115),(91,115),(92,115),(93,115),(94,115),(95,115),(96,115),(97,115),(98,115),(99,115),(100,115),(101,115),(102,115),(103,115),(104,115),(105,115),(106,115),(107,115),(108,115),(109,115),(110,115),(111,115),(112,115),(113,115),(114,115),(115,115),(116,115),(117,115),(118,115),(119,115),(0,116),(1,116),(2,116),(3,116),(4,116),(5,116),(6,116),(7,116),(8,116),(9,116),(10,116),(11,116),(12,116),(13,116),(14,116),(15,116),(16,116),(17,116),(18,116),(19,116),(20,116),(21,116),(22,116),(23,116),(24,116),(25,116),(26,116),(27,116),(28,116),(29,116),(30,116),(31,116),(32,116),(33,116),(34,116),(35,116),(36,116),(37,116),(38,116),(39,116),(40,116),(41,116),(42,116),(43,116),(44,116),(45,116),(46,116),(47,116),(48,116),(49,116),(50,116),(51,116),(52,116),(53,116),(54,116),(55,116),(56,116),(57,116),(58,116),(59,116),(60,116),(61,116),(62,116),(63,116),(64,116),(65,116),(66,116),(67,116),(68,116),(69,116),(70,116),(71,116),(72,116),(73,116),(74,116),(75,116),(76,116),(77,116),(78,116),(79,116),(80,116),(81,116),(82,116),(83,116),(84,116),(85,116),(86,116),(87,116),(88,116),(89,116),(90,116),(91,116),(92,116),(93,116),(94,116),(95,116),(96,116),(97,116),(98,116),(99,116),(100,116),(101,116),(102,116),(103,116),(104,116),(105,116),(106,116),(107,116),(108,116),(109,116),(110,116),(111,116),(112,116),(113,116),(114,116),(115,116),(116,116),(117,116),(118,116),(119,116),(0,117),(1,117),(2,117),(3,117),(4,117),(5,117),(6,117),(7,117),(8,117),(9,117),(10,117),(11,117),(12,117),(13,117),(14,117),(15,117),(16,117),(17,117),(18,117),(19,117),(20,117),(21,117),(22,117),(23,117),(24,117),(25,117),(26,117),(27,117),(28,117),(29,117),(30,117),(31,117),(32,117),(33,117),(34,117),(35,117),(36,117),(37,117),(38,117),(39,117),(40,117),(41,117),(42,117),(43,117),(44,117),(45,117),(46,117),(47,117),(48,117),(49,117),(50,117),(51,117),(52,117),(53,117),(54,117),(55,117),(56,117),(57,117),(58,117),(59,117),(60,117),(61,117),(62,117),(63,117),(64,117),(65,117),(66,117),(67,117),(68,117),(69,117),(70,117),(71,117),(72,117),(73,117),(74,117),(75,117),(76,117),(77,117),(78,117),(79,117),(80,117),(81,117),(82,117),(83,117),(84,117),(85,117),(86,117),(87,117),(88,117),(89,117),(90,117),(91,117),(92,117),(93,117),(94,117),(95,117),(96,117),(97,117),(98,117),(99,117),(100,117),(101,117),(102,117),(103,117),(104,117),(105,117),(106,117),(107,117),(108,117),(109,117),(110,117),(111,117),(112,117),(113,117),(114,117),(115,117),(116,117),(117,117),(118,117),(119,117),(0,118),(1,118),(2,118),(3,118),(4,118),(5,118),(6,118),(7,118),(8,118),(9,118),(10,118),(11,118),(12,118),(13,118),(14,118),(15,118),(16,118),(17,118),(18,118),(19,118),(20,118),(21,118),(22,118),(23,118),(24,118),(25,118),(26,118),(27,118),(28,118),(29,118),(30,118),(31,118),(32,118),(33,118),(34,118),(35,118),(36,118),(37,118),(38,118),(39,118),(40,118),(41,118),(42,118),(43,118),(44,118),(45,118),(46,118),(47,118),(48,118),(49,118),(50,118),(51,118),(52,118),(53,118),(54,118),(55,118),(56,118),(57,118),(58,118),(59,118),(60,118),(61,118),(62,118),(63,118),(64,118),(65,118),(66,118),(67,118),(68,118),(69,118),(70,118),(71,118),(72,118),(73,118),(74,118),(75,118),(76,118),(77,118),(78,118),(79,118),(80,118),(81,118),(82,118),(83,118),(84,118),(85,118),(86,118),(87,118),(88,118),(89,118),(90,118),(91,118),(92,118),(93,118),(94,118),(95,118),(96,118),(97,118),(98,118),(99,118),(100,118),(101,118),(102,118),(103,118),(104,118),(105,118),(106,118),(107,118),(108,118),(109,118),(110,118),(111,118),(112,118),(113,118),(114,118),(115,118),(116,118),(117,118),(118,118),(119,118),(0,119),(1,119),(2,119),(3,119),(4,119),(5,119),(6,119),(7,119),(8,119),(9,119),(10,119),(11,119),(12,119),(13,119),(14,119),(15,119),(16,119),(17,119),(18,119),(19,119),(20,119),(21,119),(22,119),(23,119),(24,119),(25,119),(26,119),(27,119),(28,119),(29,119),(30,119),(31,119),(32,119),(33,119),(34,119),(35,119),(36,119),(37,119),(38,119),(39,119),(40,119),(41,119),(42,119),(43,119),(44,119),(45,119),(46,119),(47,119),(48,119),(49,119),(50,119),(51,119),(52,119),(53,119),(54,119),(55,119),(56,119),(57,119),(58,119),(59,119),(60,119),(61,119),(62,119),(63,119),(64,119),(65,119),(66,119),(67,119),(68,119),(69,119),(70,119),(71,119),(72,119),(73,119),(74,119),(75,119),(76,119),(77,119),(78,119),(79,119),(80,119),(81,119),(82,119),(83,119),(84,119),(85,119),(86,119),(87,119),(88,119),(89,119),(90,119),(91,119),(92,119),(93,119),(94,119),(95,119),(96,119),(97,119),(98,119),(99,119),(100,119),(101,119),(102,119),(103,119),(104,119),(105,119),(106,119),(107,119),(108,119),(109,119),(110,119),(111,119),(112,119),(113,119),(114,119),(115,119),(116,119),(117,119),(118,119),(119,119)]
location.diggable = {(69,2),(68,4),(68,5),(67,11),(68,11),(67,12),(68,12),(69,12),(70,12),(71,12),(66,13),(67,13),(68,13),(69,13),(70,13),(71,13),(72,13),(65,14),(66,14),(67,14),(68,14),(69,14),(70,14),(71,14),(72,14),(73,14),(74,14),(75,14),(64,15),(65,15),(66,15),(67,15),(68,15),(69,15),(70,15),(71,15),(72,15),(73,15),(74,15),(75,15),(76,15),(97,15),(98,15),(99,15),(63,16),(64,16),(65,16),(66,16),(67,16),(68,16),(69,16),(70,16),(71,16),(72,16),(73,16),(74,16),(75,16),(96,16),(98,16),(60,17),(62,17),(63,17),(64,17),(65,17),(66,17),(67,17),(68,17),(69,17),(70,17),(71,17),(72,17),(73,17),(74,17),(75,17),(76,17),(77,17),(78,17),(95,17),(96,17),(97,17),(98,17),(99,17),(41,18),(62,18),(64,18),(65,18),(66,18),(67,18),(68,18),(69,18),(70,18),(71,18),(72,18),(73,18),(74,18),(75,18),(76,18),(77,18),(81,18),(82,18),(83,18),(84,18),(86,18),(87,18),(88,18),(89,18),(95,18),(96,18),(97,18),(98,18),(99,18),(101,18),(102,18),(42,19),(65,19),(66,19),(67,19),(68,19),(69,19),(70,19),(72,19),(83,19),(84,19),(94,19),(96,19),(97,19),(98,19),(99,19),(100,19),(101,19),(102,19),(103,19),(45,20),(68,20),(69,20),(84,20),(97,20),(98,20),(99,20),(100,20),(101,20),(102,20),(46,21),(84,21),(47,22),(83,22),(84,22),(24,23),(48,23),(81,23),(82,23),(83,23),(84,23),(85,23),(82,24),(83,24),(84,24),(85,24),(94,24),(95,24),(97,24),(48,25),(49,25),(82,25),(83,25),(84,25),(85,25),(95,25),(102,25),(112,25),(114,25),(115,25),(119,25),(48,26),(109,26),(110,26),(116,26),(117,26),(48,27),(20,28),(21,28),(48,28),(21,29),(48,29),(21,30),(48,30),(49,30),(21,31),(21,32),(51,32),(3,33),(22,33),(23,34),(52,34),(88,34),(24,35),(52,35),(89,35),(111,35),(112,35),(113,35),(115,35),(25,36),(111,36),(112,36),(113,36),(114,36),(115,36),(116,36),(26,37),(100,37),(101,37),(28,38),(29,38),(84,38),(89,38),(99,38),(100,38),(29,39),(30,39),(82,39),(83,39),(84,39),(85,39),(86,39),(87,39),(88,39),(89,39),(90,39),(93,39),(94,39),(95,39),(96,39),(97,39),(98,39),(30,40),(31,40),(32,40),(33,40),(34,40),(50,40),(82,40),(83,40),(84,40),(85,40),(86,40),(87,40),(88,40),(89,40),(90,40),(91,40),(32,41),(34,41),(35,41),(36,41),(38,41),(39,41),(41,41),(42,41),(43,41),(44,41),(45,41),(46,41),(47,41),(80,42),(79,43),(77,44),(78,44),(77,45),(76,46),(75,47),(76,47),(76,48),(87,48),(76,49),(88,49),(108,49),(64,50),(66,50),(67,50),(68,50),(69,50),(71,50),(72,50),(73,50),(74,50),(75,50),(104,50),(61,51),(83,51),(88,51),(59,52),(85,52),(95,52),(96,52),(57,53),(54,54),(55,54),(92,54),(52,55),(53,55),(50,56),(51,56),(47,57),(48,57),(87,57),(88,57),(43,58),(44,58),(45,58),(87,58),(41,59),(42,59),(43,59),(85,59),(86,59),(87,59),(38,60),(39,60),(40,60),(77,60),(84,60),(37,61),(38,61),(70,61),(71,61),(72,61),(73,61),(74,61),(80,61),(81,61),(35,62),(36,62),(67,62),(71,62),(33,63),(34,63),(65,63),(66,63),(72,63),(31,64),(32,64),(65,64),(72,64),(28,65),(29,65),(30,65),(65,65),(71,65),(72,65),(73,65),(27,66),(28,66),(65,66),(72,66),(73,66),(25,67),(26,67),(56,67),(59,67),(65,67),(66,67),(71,67),(72,67),(22,68),(23,68),(24,68),(53,68),(54,68),(55,68),(60,68),(21,69),(22,69),(49,69),(50,69),(60,69),(61,69),(21,70),(61,70),(66,70),(81,70),(21,71),(42,71),(61,71),(66,71),(80,71),(81,71),(20,72),(40,72),(61,72),(67,72),(80,72),(81,72),(19,73),(20,73),(60,73),(61,73),(67,73),(78,73),(79,73),(80,73),(82,73),(20,74),(38,74),(61,74),(67,74),(76,74),(77,74),(78,74),(79,74),(80,74),(81,74),(82,74),(20,75),(61,75),(67,75),(75,75),(76,75),(77,75),(78,75),(79,75),(80,75),(81,75),(82,75),(20,76),(38,76),(61,76),(74,76),(75,76),(76,76),(77,76),(78,76),(79,76),(80,76),(81,76),(82,76),(87,76),(88,76),(89,76),(90,76),(19,77),(20,77),(39,77),(61,77),(68,77),(73,77),(74,77),(75,77),(76,77),(77,77),(78,77),(79,77),(80,77),(81,77),(87,77),(88,77),(89,77),(90,77),(91,77),(19,78),(40,78),(41,78),(60,78),(61,78),(73,78),(75,78),(76,78),(77,78),(78,78),(79,78),(80,78),(88,78),(89,78),(90,78),(91,78),(92,78),(20,79),(43,79),(44,79),(45,79),(61,79),(74,79),(75,79),(76,79),(77,79),(78,79),(79,79),(80,79),(88,79),(90,79),(91,79),(92,79),(93,79),(21,80),(46,80),(47,80),(48,80),(61,80),(68,80),(75,80),(76,80),(88,80),(89,80),(90,80),(91,80),(92,80),(93,80),(49,81),(50,81),(51,81),(61,81),(92,81),(93,81),(22,82),(36,82),(53,82),(60,82),(68,82),(22,83),(23,83),(38,83),(39,83),(40,83),(41,83),(56,83),(57,83),(58,83),(59,83),(24,84),(25,84),(37,84),(38,84),(40,84),(57,84),(58,84),(26,85),(27,85),(57,85),(58,85),(84,85),(85,85),(86,85),(87,85),(88,85),(28,86),(29,86),(58,86),(82,86),(83,86),(85,86),(86,86),(87,86),(3,87),(4,87),(29,87),(31,87),(32,87),(81,87),(82,87),(83,87),(84,87),(85,87),(86,87),(87,87),(3,88),(4,88),(32,88),(33,88),(34,88),(35,88),(36,88),(37,88),(38,88),(80,88),(81,88),(82,88),(83,88),(84,88),(85,88),(86,88),(96,88),(97,88),(3,89),(4,89),(38,89),(39,89),(41,89),(64,89),(80,89),(81,89),(82,89),(83,89),(84,89),(85,89),(86,89),(94,89),(95,89),(96,89),(97,89),(4,90),(43,90),(44,90),(64,90),(81,90),(82,90),(94,90),(95,90),(96,90),(97,90),(98,90),(4,91),(44,91),(45,91),(46,91),(47,91),(96,91),(97,91),(98,91),(99,91),(4,92),(48,92),(97,92),(98,92),(99,92),(4,93),(66,93),(97,93),(98,93),(99,93),(4,94),(50,94),(66,94),(98,94),(4,95),(51,95),(66,95),(4,96),(51,96),(66,96),(4,97),(51,97),(4,98),(51,98),(4,99),(5,99),(95,99),(96,99),(97,99),(98,99),(99,99),(4,100),(5,100),(51,100),(5,101),(6,101),(50,101),(51,101),(7,102),(50,102),(51,102),(8,103),(50,103),(118,103),(9,104),(50,104),(117,104),(50,105),(116,105),(50,106),(13,107),(14,107),(15,107),(16,107),(17,107),(96,107),(97,107),(98,107),(99,107),(100,107),(19,108),(20,108),(21,108),(22,108),(23,108),(39,108),(40,108),(41,108),(42,108),(88,108),(89,108),(90,108),(102,108),(103,108),(104,108)}
location.startingObjects = {(20,11),(7,12),(9,12),(12,12),(16,12),(8,13),(15,13),(19,13),(21,13),(32,13),(11,14),(33,14),(29,15),(41,15),(42,15),(45,15),(46,16),(15,18),(17,18),(23,18),(51,18),(53,18),(14,19),(49,19),(20,20),(50,20),(55,21),(58,21),(14,22),(16,23),(18,23),(57,23),(12,24),(58,24),(61,25),(14,26),(72,27),(73,28),(61,29),(69,29),(74,29),(75,29),(70,30),(72,30),(75,30),(79,30),(58,31),(73,31),(78,31),(80,31),(82,31),(68,32),(70,32),(75,32),(79,32),(81,32),(17,33),(73,33),(57,34),(76,34),(71,35),(73,35),(68,36),(60,39),(17,40),(21,40),(57,41),(62,41),(61,42),(55,43),(60,43),(24,44),(39,44),(48,44),(49,44),(52,44),(35,45),(33,46),(37,46),(50,46),(55,46),(51,47),(24,48),(54,49),(55,49),(30,50),(42,50),(49,50),(53,50),(24,51),(28,51),(36,51),(47,51),(18,52),(27,52),(29,52),(34,52),(45,52),(33,53),(39,53),(16,54),(32,55),(36,55),(20,56),(26,56),(20,57),(25,58),(27,58),(22,61),(19,62),(15,63),(16,63),(18,63),(16,65),(10,66),(8,68),(10,68),(14,69),(8,70),(12,71)}
return location
def createTown(version="1.4"):
location = Location("Town")
location.width = 120;
location.height = 110;
location.spawns = {
0: [[18, .9]],
1: [[402, .9]],
2: [[410, .6]],
3: [[418, .7], [414, .1], [283, .5]]};
if version == "1.4":
location.spawnable = {(24,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(37,0),(40,0),(41,0),(42,0),(43,0),(45,0),(46,0),(47,0),(48,0),(49,0),(50,0),(51,0),(52,0),(53,0),(54,0),(55,0),(56,0),(60,0),(64,0),(68,0),(69,0),(70,0),(74,0),(75,0),(76,0),(84,0),(86,0),(87,0),(101,0),(102,0),(104,0),(105,0),(106,0),(114,0),(115,0),(116,0),(117,0),(118,0),(119,0),(24,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(38,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(50,1),(51,1),(52,1),(53,1),(54,1),(55,1),(56,1),(58,1),(68,1),(69,1),(72,1),(74,1),(75,1),(76,1),(84,1),(87,1),(89,1),(101,1),(102,1),(104,1),(105,1),(106,1),(107,1),(109,1),(110,1),(111,1),(112,1),(115,1),(116,1),(117,1),(118,1),(119,1),(6,2),(21,2),(22,2),(27,2),(34,2),(35,2),(40,2),(47,2),(48,2),(49,2),(50,2),(51,2),(52,2),(53,2),(55,2),(56,2),(57,2),(67,2),(68,2),(69,2),(74,2),(75,2),(76,2),(84,2),(87,2),(100,2),(102,2),(104,2),(105,2),(106,2),(107,2),(109,2),(111,2),(112,2),(115,2),(116,2),(117,2),(118,2),(119,2),(3,3),(5,3),(6,3),(7,3),(11,3),(14,3),(19,3),(20,3),(21,3),(22,3),(24,3),(25,3),(26,3),(29,3),(30,3),(35,3),(37,3),(70,3),(74,3),(75,3),(76,3),(77,3),(84,3),(87,3),(100,3),(102,3),(104,3),(105,3),(106,3),(107,3),(108,3),(110,3),(111,3),(112,3),(113,3),(117,3),(118,3),(119,3),(4,4),(5,4),(6,4),(7,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(30,4),(31,4),(34,4),(35,4),(36,4),(59,4),(61,4),(68,4),(70,4),(71,4),(72,4),(73,4),(77,4),(80,4),(84,4),(87,4),(104,4),(105,4),(107,4),(109,4),(111,4),(112,4),(113,4),(114,4),(117,4),(118,4),(119,4),(1,5),(6,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(18,5),(19,5),(20,5),(21,5),(22,5),(23,5),(24,5),(25,5),(26,5),(27,5),(28,5),(30,5),(31,5),(32,5),(33,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(48,5),(53,5),(54,5),(55,5),(66,5),(70,5),(71,5),(72,5),(73,5),(75,5),(84,5),(101,5),(104,5),(105,5),(106,5),(108,5),(109,5),(114,5),(115,5),(118,5),(119,5),(0,6),(3,6),(7,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(21,6),(22,6),(23,6),(24,6),(25,6),(26,6),(27,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(34,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(50,6),(51,6),(53,6),(54,6),(55,6),(57,6),(58,6),(59,6),(65,6),(69,6),(70,6),(71,6),(72,6),(82,6),(101,6),(104,6),(105,6),(106,6),(107,6),(108,6),(109,6),(112,6),(114,6),(115,6),(1,7),(5,7),(7,7),(8,7),(9,7),(57,7),(58,7),(62,7),(64,7),(65,7),(66,7),(67,7),(71,7),(72,7),(104,7),(105,7),(106,7),(107,7),(108,7),(109,7),(114,7),(115,7),(116,7),(117,7),(118,7),(5,8),(6,8),(8,8),(9,8),(69,8),(70,8),(74,8),(75,8),(76,8),(77,8),(79,8),(84,8),(101,8),(107,8),(108,8),(109,8),(112,8),(113,8),(114,8),(115,8),(116,8),(117,8),(119,8),(1,9),(4,9),(5,9),(6,9),(7,9),(8,9),(9,9),(18,9),(19,9),(20,9),(21,9),(62,9),(64,9),(67,9),(71,9),(75,9),(76,9),(77,9),(78,9),(83,9),(84,9),(101,9),(103,9),(104,9),(105,9),(107,9),(108,9),(109,9),(110,9),(111,9),(114,9),(115,9),(116,9),(117,9),(119,9),(1,10),(3,10),(5,10),(6,10),(7,10),(8,10),(9,10),(62,10),(63,10),(64,10),(67,10),(70,10),(71,10),(72,10),(76,10),(77,10),(78,10),(82,10),(83,10),(104,10),(105,10),(107,10),(108,10),(109,10),(110,10),(111,10),(112,10),(113,10),(116,10),(117,10),(118,10),(119,10),(3,11),(4,11),(5,11),(6,11),(7,11),(8,11),(31,11),(40,11),(43,11),(45,11),(46,11),(47,11),(48,11),(49,11),(50,11),(53,11),(54,11),(55,11),(57,11),(58,11),(60,11),(61,11),(66,11),(67,11),(70,11),(71,11),(72,11),(75,11),(76,11),(77,11),(78,11),(82,11),(83,11),(84,11),(105,11),(107,11),(108,11),(110,11),(111,11),(113,11),(115,11),(117,11),(118,11),(4,12),(5,12),(12,12),(31,12),(36,12),(38,12),(39,12),(40,12),(44,12),(45,12),(46,12),(47,12),(49,12),(50,12),(51,12),(52,12),(53,12),(54,12),(55,12),(57,12),(59,12),(65,12),(66,12),(71,12),(75,12),(77,12),(82,12),(83,12),(84,12),(107,12),(108,12),(109,12),(110,12),(111,12),(112,12),(113,12),(114,12),(115,12),(116,12),(1,13),(7,13),(12,13),(29,13),(30,13),(34,13),(36,13),(37,13),(38,13),(41,13),(42,13),(45,13),(46,13),(47,13),(48,13),(49,13),(50,13),(51,13),(52,13),(53,13),(54,13),(55,13),(56,13),(57,13),(58,13),(59,13),(60,13),(69,13),(70,13),(71,13),(73,13),(74,13),(75,13),(76,13),(77,13),(82,13),(83,13),(84,13),(107,13),(108,13),(109,13),(110,13),(111,13),(112,13),(113,13),(114,13),(115,13),(116,13),(117,13),(119,13),(2,14),(5,14),(9,14),(27,14),(32,14),(34,14),(36,14),(38,14),(40,14),(41,14),(43,14),(47,14),(48,14),(49,14),(50,14),(51,14),(52,14),(53,14),(54,14),(55,14),(56,14),(57,14),(58,14),(59,14),(65,14),(66,14),(67,14),(71,14),(73,14),(75,14),(76,14),(82,14),(83,14),(107,14),(108,14),(109,14),(110,14),(111,14),(112,14),(113,14),(114,14),(115,14),(116,14),(117,14),(118,14),(119,14),(1,15),(2,15),(4,15),(8,15),(10,15),(13,15),(18,15),(20,15),(21,15),(22,15),(23,15),(24,15),(25,15),(29,15),(30,15),(31,15),(32,15),(33,15),(34,15),(37,15),(39,15),(41,15),(42,15),(43,15),(46,15),(47,15),(48,15),(49,15),(52,15),(53,15),(54,15),(55,15),(56,15),(57,15),(58,15),(70,15),(71,15),(72,15),(73,15),(74,15),(76,15),(77,15),(82,15),(83,15),(84,15),(105,15),(107,15),(108,15),(109,15),(110,15),(111,15),(112,15),(113,15),(114,15),(115,15),(116,15),(117,15),(118,15),(119,15),(4,16),(10,16),(11,16),(18,16),(19,16),(24,16),(25,16),(28,16),(31,16),(32,16),(34,16),(36,16),(37,16),(38,16),(39,16),(40,16),(41,16),(42,16),(45,16),(47,16),(48,16),(49,16),(50,16),(51,16),(52,16),(53,16),(55,16),(56,16),(57,16),(58,16),(61,16),(66,16),(70,16),(73,16),(74,16),(75,16),(76,16),(81,16),(82,16),(83,16),(103,16),(105,16),(106,16),(119,16),(3,17),(4,17),(10,17),(16,17),(17,17),(19,17),(21,17),(27,17),(32,17),(34,17),(36,17),(37,17),(38,17),(42,17),(47,17),(48,17),(49,17),(50,17),(52,17),(53,17),(55,17),(56,17),(58,17),(63,17),(70,17),(71,17),(72,17),(74,17),(75,17),(76,17),(103,17),(105,17),(106,17),(107,17),(111,17),(113,17),(114,17),(115,17),(116,17),(117,17),(4,18),(10,18),(13,18),(14,18),(15,18),(17,18),(26,18),(29,18),(30,18),(35,18),(36,18),(37,18),(39,18),(40,18),(42,18),(45,18),(47,18),(48,18),(50,18),(51,18),(58,18),(70,18),(71,18),(72,18),(73,18),(74,18),(75,18),(76,18),(77,18),(81,18),(82,18),(105,18),(106,18),(107,18),(109,18),(111,18),(112,18),(113,18),(114,18),(115,18),(116,18),(1,19),(3,19),(4,19),(7,19),(16,19),(18,19),(28,19),(29,19),(30,19),(32,19),(34,19),(36,19),(41,19),(46,19),(47,19),(48,19),(50,19),(51,19),(57,19),(59,19),(60,19),(61,19),(66,19),(70,19),(71,19),(72,19),(73,19),(74,19),(75,19),(77,19),(81,19),(82,19),(102,19),(103,19),(104,19),(107,19),(112,19),(116,19),(118,19),(1,20),(4,20),(9,20),(17,20),(18,20),(25,20),(26,20),(27,20),(28,20),(29,20),(31,20),(36,20),(37,20),(38,20),(39,20),(44,20),(45,20),(46,20),(48,20),(49,20),(50,20),(51,20),(54,20),(55,20),(59,20),(60,20),(64,20),(71,20),(72,20),(74,20),(75,20),(76,20),(77,20),(81,20),(103,20),(104,20),(105,20),(108,20),(109,20),(110,20),(111,20),(114,20),(116,20),(117,20),(118,20),(1,21),(4,21),(6,21),(14,21),(18,21),(21,21),(22,21),(23,21),(28,21),(31,21),(32,21),(33,21),(34,21),(37,21),(44,21),(45,21),(46,21),(59,21),(60,21),(61,21),(62,21),(63,21),(67,21),(69,21),(70,21),(73,21),(82,21),(103,21),(104,21),(105,21),(106,21),(109,21),(110,21),(111,21),(116,21),(118,21),(1,22),(4,22),(8,22),(17,22),(20,22),(25,22),(28,22),(29,22),(32,22),(33,22),(34,22),(37,22),(38,22),(43,22),(48,22),(49,22),(50,22),(58,22),(59,22),(61,22),(62,22),(63,22),(64,22),(67,22),(68,22),(69,22),(81,22),(82,22),(103,22),(104,22),(105,22),(106,22),(107,22),(108,22),(111,22),(112,22),(113,22),(114,22),(115,22),(1,23),(4,23),(8,23),(11,23),(12,23),(14,23),(17,23),(19,23),(22,23),(23,23),(30,23),(31,23),(33,23),(34,23),(35,23),(38,23),(39,23),(43,23),(44,23),(45,23),(46,23),(48,23),(49,23),(50,23),(57,23),(58,23),(59,23),(61,23),(62,23),(64,23),(65,23),(68,23),(69,23),(81,23),(82,23),(107,23),(108,23),(109,23),(110,23),(3,24),(4,24),(7,24),(11,24),(13,24),(14,24),(15,24),(18,24),(19,24),(21,24),(22,24),(31,24),(34,24),(35,24),(36,24),(38,24),(42,24),(44,24),(45,24),(46,24),(48,24),(54,24),(58,24),(59,24),(60,24),(62,24),(63,24),(64,24),(65,24),(74,24),(77,24),(80,24),(82,24),(105,24),(107,24),(108,24),(113,24),(114,24),(119,24),(4,25),(11,25),(17,25),(18,25),(21,25),(33,25),(34,25),(36,25),(38,25),(44,25),(45,25),(46,25),(48,25),(49,25),(50,25),(53,25),(57,25),(60,25),(61,25),(62,25),(64,25),(65,25),(66,25),(67,25),(72,25),(73,25),(74,25),(75,25),(76,25),(77,25),(78,25),(79,25),(81,25),(102,25),(107,25),(114,25),(1,26),(4,26),(8,26),(12,26),(13,26),(14,26),(16,26),(17,26),(18,26),(27,26),(34,26),(35,26),(38,26),(43,26),(45,26),(46,26),(47,26),(49,26),(50,26),(60,26),(65,26),(73,26),(74,26),(79,26),(80,26),(81,26),(82,26),(102,26),(105,26),(119,26),(6,27),(13,27),(14,27),(17,27),(18,27),(20,27),(27,27),(35,27),(36,27),(38,27),(43,27),(44,27),(46,27),(47,27),(48,27),(50,27),(51,27),(59,27),(60,27),(75,27),(76,27),(77,27),(79,27),(81,27),(82,27),(102,27),(103,27),(104,27),(118,27),(119,27),(1,28),(2,28),(6,28),(7,28),(9,28),(14,28),(16,28),(20,28),(33,28),(34,28),(39,28),(43,28),(44,28),(45,28),(46,28),(47,28),(48,28),(49,28),(50,28),(51,28),(53,28),(76,28),(79,28),(80,28),(81,28),(102,28),(103,28),(118,28),(119,28),(1,29),(4,29),(7,29),(14,29),(17,29),(18,29),(19,29),(33,29),(34,29),(35,29),(38,29),(39,29),(44,29),(45,29),(46,29),(47,29),(48,29),(49,29),(50,29),(51,29),(77,29),(78,29),(79,29),(80,29),(81,29),(101,29),(102,29),(103,29),(118,29),(119,29),(0,30),(1,30),(4,30),(6,30),(7,30),(8,30),(11,30),(14,30),(15,30),(16,30),(17,30),(31,30),(34,30),(35,30),(37,30),(38,30),(39,30),(43,30),(44,30),(45,30),(47,30),(48,30),(50,30),(51,30),(52,30),(77,30),(78,30),(79,30),(80,30),(81,30),(101,30),(102,30),(103,30),(118,30),(119,30),(8,31),(9,31),(15,31),(22,31),(35,31),(38,31),(42,31),(44,31),(47,31),(48,31),(50,31),(51,31),(70,31),(71,31),(72,31),(76,31),(77,31),(78,31),(79,31),(118,31),(119,31),(0,32),(1,32),(2,32),(4,32),(5,32),(7,32),(8,32),(9,32),(28,32),(33,32),(37,32),(41,32),(44,32),(45,32),(47,32),(48,32),(50,32),(51,32),(52,32),(55,32),(69,32),(71,32),(72,32),(73,32),(76,32),(77,32),(119,32),(0,33),(1,33),(2,33),(3,33),(5,33),(9,33),(10,33),(17,33),(21,33),(22,33),(26,33),(27,33),(28,33),(29,33),(32,33),(35,33),(36,33),(37,33),(38,33),(44,33),(46,33),(54,33),(60,33),(62,33),(70,33),(71,33),(72,33),(102,33),(119,33),(0,34),(1,34),(2,34),(3,34),(5,34),(6,34),(9,34),(10,34),(11,34),(16,34),(18,34),(21,34),(22,34),(23,34),(24,34),(26,34),(27,34),(29,34),(31,34),(32,34),(35,34),(37,34),(38,34),(45,34),(52,34),(53,34),(58,34),(64,34),(65,34),(67,34),(68,34),(69,34),(70,34),(71,34),(104,34),(105,34),(117,34),(119,34),(0,35),(1,35),(2,35),(3,35),(4,35),(6,35),(7,35),(13,35),(18,35),(20,35),(22,35),(24,35),(25,35),(26,35),(34,35),(35,35),(37,35),(42,35),(43,35),(44,35),(49,35),(57,35),(60,35),(61,35),(65,35),(66,35),(67,35),(68,35),(69,35),(70,35),(101,35),(102,35),(103,35),(104,35),(105,35),(109,35),(112,35),(113,35),(114,35),(115,35),(117,35),(119,35),(0,36),(1,36),(2,36),(3,36),(4,36),(6,36),(7,36),(11,36),(20,36),(21,36),(23,36),(24,36),(25,36),(28,36),(36,36),(44,36),(45,36),(59,36),(60,36),(63,36),(65,36),(66,36),(67,36),(101,36),(102,36),(103,36),(104,36),(105,36),(111,36),(119,36),(0,37),(1,37),(2,37),(3,37),(4,37),(7,37),(8,37),(11,37),(21,37),(23,37),(28,37),(30,37),(32,37),(33,37),(36,37),(37,37),(38,37),(39,37),(55,37),(58,37),(59,37),(61,37),(63,37),(65,37),(101,37),(102,37),(103,37),(104,37),(105,37),(106,37),(107,37),(108,37),(109,37),(110,37),(111,37),(112,37),(113,37),(114,37),(115,37),(116,37),(117,37),(118,37),(119,37),(4,38),(5,38),(7,38),(9,38),(10,38),(11,38),(12,38),(13,38),(14,38),(23,38),(29,38),(30,38),(32,38),(33,38),(34,38),(36,38),(37,38),(38,38),(39,38),(40,38),(46,38),(47,38),(51,38),(52,38),(53,38),(57,38),(59,38),(60,38),(61,38),(62,38),(63,38),(102,38),(103,38),(104,38),(105,38),(106,38),(107,38),(108,38),(109,38),(110,38),(111,38),(112,38),(113,38),(114,38),(115,38),(116,38),(117,38),(118,38),(119,38),(14,39),(15,39),(21,39),(24,39),(25,39),(26,39),(27,39),(32,39),(33,39),(34,39),(51,39),(56,39),(57,39),(58,39),(60,39),(61,39),(63,39),(65,39),(101,39),(7,40),(8,40),(12,40),(13,40),(14,40),(15,40),(16,40),(24,40),(25,40),(26,40),(27,40),(28,40),(29,40),(30,40),(31,40),(32,40),(33,40),(34,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(51,40),(53,40),(56,40),(60,40),(61,40),(62,40),(63,40),(65,40),(98,40),(102,40),(104,40),(105,40),(106,40),(107,40),(108,40),(109,40),(110,40),(111,40),(112,40),(113,40),(114,40),(115,40),(116,40),(117,40),(118,40),(119,40),(7,41),(14,41),(15,41),(16,41),(17,41),(22,41),(29,41),(30,41),(31,41),(32,41),(33,41),(34,41),(39,41),(40,41),(41,41),(42,41),(46,41),(47,41),(51,41),(53,41),(55,41),(62,41),(63,41),(65,41),(97,41),(99,41),(101,41),(102,41),(113,41),(114,41),(115,41),(116,41),(117,41),(118,41),(119,41),(7,42),(10,42),(14,42),(16,42),(17,42),(23,42),(29,42),(34,42),(39,42),(41,42),(42,42),(48,42),(49,42),(50,42),(51,42),(54,42),(55,42),(56,42),(57,42),(60,42),(61,42),(63,42),(65,42),(96,42),(97,42),(98,42),(99,42),(102,42),(103,42),(104,42),(105,42),(106,42),(107,42),(108,42),(109,42),(111,42),(113,42),(114,42),(115,42),(116,42),(117,42),(118,42),(119,42),(7,43),(12,43),(17,43),(23,43),(27,43),(31,43),(32,43),(36,43),(37,43),(38,43),(43,43),(46,43),(50,43),(51,43),(53,43),(54,43),(56,43),(58,43),(59,43),(60,43),(62,43),(63,43),(94,43),(95,43),(96,43),(97,43),(98,43),(99,43),(100,43),(103,43),(104,43),(107,43),(108,43),(109,43),(110,43),(111,43),(113,43),(114,43),(115,43),(116,43),(117,43),(118,43),(119,43),(7,44),(9,44),(10,44),(11,44),(12,44),(25,44),(26,44),(27,44),(28,44),(29,44),(30,44),(31,44),(32,44),(33,44),(34,44),(35,44),(41,44),(43,44),(51,44),(53,44),(54,44),(55,44),(56,44),(57,44),(58,44),(59,44),(62,44),(63,44),(65,44),(93,44),(102,44),(103,44),(104,44),(106,44),(109,44),(110,44),(111,44),(114,44),(115,44),(116,44),(117,44),(118,44),(119,44),(7,45),(9,45),(10,45),(14,45),(18,45),(25,45),(26,45),(27,45),(28,45),(29,45),(30,45),(31,45),(32,45),(33,45),(34,45),(35,45),(36,45),(37,45),(38,45),(39,45),(40,45),(41,45),(42,45),(43,45),(45,45),(53,45),(54,45),(55,45),(56,45),(57,45),(59,45),(60,45),(61,45),(63,45),(91,45),(102,45),(103,45),(104,45),(105,45),(106,45),(107,45),(108,45),(109,45),(110,45),(111,45),(112,45),(114,45),(115,45),(116,45),(117,45),(118,45),(119,45),(0,46),(1,46),(2,46),(3,46),(4,46),(5,46),(6,46),(9,46),(12,46),(13,46),(14,46),(15,46),(16,46),(45,46),(52,46),(53,46),(54,46),(55,46),(60,46),(61,46),(64,46),(87,46),(88,46),(94,46),(95,46),(96,46),(102,46),(106,46),(107,46),(108,46),(109,46),(110,46),(111,46),(112,46),(117,46),(118,46),(119,46),(14,47),(15,47),(16,47),(18,47),(24,47),(52,47),(53,47),(57,47),(58,47),(59,47),(61,47),(62,47),(63,47),(64,47),(85,47),(86,47),(87,47),(88,47),(90,47),(91,47),(92,47),(93,47),(94,47),(95,47),(96,47),(97,47),(98,47),(99,47),(100,47),(111,47),(117,47),(118,47),(119,47),(2,48),(3,48),(10,48),(11,48),(14,48),(15,48),(24,48),(51,48),(55,48),(56,48),(57,48),(58,48),(59,48),(82,48),(91,48),(92,48),(93,48),(94,48),(95,48),(96,48),(97,48),(98,48),(99,48),(100,48),(111,48),(112,48),(117,48),(118,48),(119,48),(0,49),(1,49),(2,49),(3,49),(4,49),(5,49),(8,49),(9,49),(14,49),(15,49),(16,49),(23,49),(27,49),(30,49),(31,49),(46,49),(51,49),(56,49),(57,49),(58,49),(59,49),(60,49),(61,49),(62,49),(64,49),(81,49),(82,49),(91,49),(92,49),(93,49),(94,49),(95,49),(96,49),(97,49),(98,49),(99,49),(100,49),(111,49),(112,49),(114,49),(115,49),(116,49),(117,49),(118,49),(119,49),(0,50),(1,50),(2,50),(3,50),(4,50),(11,50),(12,50),(13,50),(14,50),(15,50),(16,50),(23,50),(29,50),(30,50),(31,50),(33,50),(34,50),(35,50),(36,50),(37,50),(38,50),(39,50),(40,50),(41,50),(42,50),(43,50),(44,50),(45,50),(46,50),(60,50),(81,50),(82,50),(111,50),(112,50),(114,50),(115,50),(116,50),(117,50),(118,50),(119,50),(0,51),(1,51),(2,51),(3,51),(4,51),(10,51),(29,51),(30,51),(31,51),(33,51),(34,51),(35,51),(36,51),(37,51),(38,51),(39,51),(40,51),(41,51),(42,51),(43,51),(44,51),(45,51),(46,51),(62,51),(65,51),(66,51),(81,51),(82,51),(85,51),(90,51),(111,51),(112,51),(114,51),(115,51),(116,51),(117,51),(118,51),(119,51),(1,52),(3,52),(5,52),(7,52),(9,52),(13,52),(29,52),(30,52),(31,52),(33,52),(34,52),(35,52),(36,52),(37,52),(38,52),(39,52),(40,52),(41,52),(42,52),(43,52),(44,52),(45,52),(46,52),(51,52),(57,52),(62,52),(64,52),(65,52),(84,52),(111,52),(112,52),(114,52),(115,52),(116,52),(117,52),(118,52),(119,52),(31,53),(33,53),(34,53),(35,53),(36,53),(37,53),(38,53),(39,53),(40,53),(41,53),(42,53),(43,53),(44,53),(45,53),(46,53),(51,53),(57,53),(58,53),(111,53),(112,53),(114,53),(115,53),(116,53),(117,53),(118,53),(119,53),(30,54),(31,54),(35,54),(36,54),(37,54),(38,54),(39,54),(40,54),(41,54),(42,54),(43,54),(44,54),(45,54),(46,54),(103,54),(111,54),(112,54),(114,54),(115,54),(116,54),(117,54),(118,54),(119,54),(35,55),(36,55),(37,55),(38,55),(39,55),(40,55),(41,55),(42,55),(43,55),(44,55),(45,55),(46,55),(51,55),(52,55),(53,55),(54,55),(55,55),(56,55),(57,55),(83,55),(84,55),(86,55),(87,55),(105,55),(108,55),(109,55),(110,55),(111,55),(112,55),(114,55),(115,55),(116,55),(117,55),(118,55),(119,55),(38,56),(39,56),(40,56),(41,56),(42,56),(43,56),(44,56),(45,56),(46,56),(57,56),(58,56),(84,56),(85,56),(87,56),(88,56),(104,56),(105,56),(106,56),(109,56),(110,56),(111,56),(112,56),(114,56),(115,56),(116,56),(117,56),(118,56),(119,56),(7,57),(17,57),(19,57),(20,57),(22,57),(23,57),(52,57),(53,57),(54,57),(55,57),(56,57),(57,57),(58,57),(59,57),(60,57),(61,57),(62,57),(63,57),(84,57),(85,57),(86,57),(87,57),(89,57),(100,57),(106,57),(107,57),(110,57),(112,57),(114,57),(115,57),(116,57),(117,57),(118,57),(119,57),(1,58),(3,58),(5,58),(15,58),(17,58),(19,58),(20,58),(22,58),(54,58),(55,58),(56,58),(57,58),(58,58),(59,58),(60,58),(61,58),(62,58),(63,58),(64,58),(87,58),(88,58),(89,58),(99,58),(103,58),(105,58),(107,58),(108,58),(110,58),(112,58),(114,58),(115,58),(119,58),(1,59),(4,59),(5,59),(17,59),(18,59),(19,59),(21,59),(23,59),(55,59),(56,59),(57,59),(58,59),(59,59),(60,59),(61,59),(62,59),(63,59),(64,59),(67,59),(87,59),(89,59),(95,59),(96,59),(98,59),(99,59),(106,59),(107,59),(108,59),(109,59),(112,59),(114,59),(115,59),(119,59),(0,60),(1,60),(4,60),(5,60),(7,60),(21,60),(22,60),(49,60),(51,60),(54,60),(55,60),(56,60),(57,60),(58,60),(59,60),(60,60),(61,60),(62,60),(63,60),(64,60),(88,60),(89,60),(92,60),(93,60),(96,60),(97,60),(98,60),(99,60),(101,60),(102,60),(103,60),(104,60),(105,60),(108,60),(112,60),(114,60),(115,60),(119,60),(1,61),(5,61),(7,61),(15,61),(16,61),(52,61),(56,61),(57,61),(58,61),(59,61),(60,61),(61,61),(62,61),(63,61),(64,61),(88,61),(89,61),(92,61),(95,61),(96,61),(97,61),(98,61),(99,61),(100,61),(101,61),(102,61),(103,61),(104,61),(106,61),(107,61),(112,61),(114,61),(115,61),(117,61),(118,61),(119,61),(1,62),(7,62),(15,62),(16,62),(18,62),(48,62),(49,62),(50,62),(53,62),(54,62),(56,62),(57,62),(58,62),(59,62),(60,62),(61,62),(62,62),(63,62),(64,62),(88,62),(107,62),(108,62),(110,62),(114,62),(115,62),(119,62),(1,63),(5,63),(7,63),(15,63),(16,63),(17,63),(18,63),(44,63),(45,63),(46,63),(48,63),(49,63),(50,63),(51,63),(52,63),(59,63),(60,63),(61,63),(67,63),(90,63),(91,63),(92,63),(93,63),(94,63),(95,63),(96,63),(97,63),(98,63),(99,63),(100,63),(101,63),(102,63),(103,63),(104,63),(107,63),(108,63),(110,63),(114,63),(115,63),(119,63),(1,64),(3,64),(9,64),(20,64),(40,64),(41,64),(42,64),(43,64),(44,64),(45,64),(61,64),(64,64),(68,64),(69,64),(107,64),(112,64),(114,64),(115,64),(119,64),(1,65),(3,65),(4,65),(6,65),(16,65),(17,65),(19,65),(20,65),(40,65),(41,65),(42,65),(43,65),(44,65),(45,65),(59,65),(61,65),(62,65),(64,65),(65,65),(67,65),(90,65),(94,65),(95,65),(96,65),(100,65),(101,65),(102,65),(103,65),(104,65),(107,65),(108,65),(110,65),(112,65),(114,65),(115,65),(116,65),(117,65),(118,65),(119,65),(1,66),(2,66),(3,66),(4,66),(10,66),(11,66),(16,66),(17,66),(18,66),(19,66),(40,66),(41,66),(42,66),(43,66),(44,66),(45,66),(46,66),(50,66),(52,66),(58,66),(59,66),(60,66),(62,66),(64,66),(65,66),(66,66),(69,66),(71,66),(72,66),(73,66),(74,66),(87,66),(90,66),(94,66),(95,66),(96,66),(98,66),(100,66),(101,66),(102,66),(103,66),(104,66),(107,66),(108,66),(111,66),(114,66),(115,66),(116,66),(117,66),(118,66),(119,66),(2,67),(3,67),(4,67),(6,67),(7,67),(8,67),(16,67),(17,67),(18,67),(40,67),(41,67),(42,67),(43,67),(44,67),(45,67),(46,67),(47,67),(50,67),(54,67),(59,67),(66,67),(68,67),(69,67),(71,67),(72,67),(73,67),(90,67),(94,67),(95,67),(96,67),(100,67),(101,67),(102,67),(104,67),(107,67),(108,67),(110,67),(111,67),(112,67),(117,67),(118,67),(119,67),(4,68),(5,68),(6,68),(7,68),(15,68),(16,68),(17,68),(18,68),(19,68),(42,68),(43,68),(44,68),(45,68),(46,68),(47,68),(50,68),(53,68),(54,68),(66,68),(68,68),(69,68),(71,68),(90,68),(91,68),(92,68),(93,68),(94,68),(95,68),(96,68),(97,68),(98,68),(99,68),(100,68),(101,68),(104,68),(107,68),(110,68),(112,68),(117,68),(118,68),(119,68),(4,69),(5,69),(6,69),(42,69),(43,69),(44,69),(45,69),(46,69),(47,69),(53,69),(54,69),(76,69),(92,69),(93,69),(94,69),(95,69),(96,69),(97,69),(98,69),(99,69),(100,69),(101,69),(102,69),(103,69),(104,69),(107,69),(108,69),(110,69),(112,69),(117,69),(118,69),(119,69),(0,70),(4,70),(5,70),(39,70),(42,70),(43,70),(44,70),(45,70),(46,70),(47,70),(50,70),(52,70),(56,70),(68,70),(89,70),(92,70),(93,70),(94,70),(95,70),(96,70),(97,70),(98,70),(99,70),(102,70),(103,70),(104,70),(107,70),(108,70),(110,70),(111,70),(112,70),(114,70),(115,70),(116,70),(117,70),(118,70),(119,70),(1,71),(2,71),(4,71),(5,71),(11,71),(17,71),(18,71),(42,71),(43,71),(44,71),(46,71),(50,71),(52,71),(53,71),(54,71),(55,71),(92,71),(93,71),(94,71),(95,71),(96,71),(97,71),(98,71),(99,71),(102,71),(103,71),(104,71),(108,71),(110,71),(111,71),(112,71),(114,71),(115,71),(116,71),(117,71),(118,71),(119,71),(1,72),(4,72),(5,72),(47,72),(54,72),(55,72),(87,72),(90,72),(91,72),(92,72),(93,72),(94,72),(95,72),(96,72),(97,72),(98,72),(102,72),(103,72),(104,72),(108,72),(110,72),(111,72),(114,72),(115,72),(116,72),(117,72),(118,72),(119,72),(1,73),(4,73),(5,73),(6,73),(7,73),(14,73),(18,73),(19,73),(54,73),(56,73),(87,73),(90,73),(91,73),(92,73),(93,73),(94,73),(95,73),(96,73),(97,73),(98,73),(102,73),(103,73),(104,73),(107,73),(108,73),(110,73),(111,73),(112,73),(114,73),(115,73),(116,73),(117,73),(118,73),(119,73),(1,74),(4,74),(5,74),(6,74),(7,74),(8,74),(10,74),(11,74),(13,74),(39,74),(40,74),(41,74),(43,74),(46,74),(54,74),(55,74),(87,74),(107,74),(108,74),(111,74),(112,74),(1,75),(5,75),(6,75),(8,75),(10,75),(12,75),(13,75),(17,75),(18,75),(19,75),(20,75),(87,75),(90,75),(97,75),(103,75),(107,75),(108,75),(110,75),(111,75),(3,76),(5,76),(6,76),(7,76),(8,76),(9,76),(10,76),(11,76),(12,76),(13,76),(17,76),(18,76),(19,76),(22,76),(23,76),(32,76),(33,76),(34,76),(35,76),(36,76),(38,76),(41,76),(43,76),(48,76),(54,76),(56,76),(57,76),(58,76),(59,76),(60,76),(61,76),(62,76),(64,76),(65,76),(66,76),(87,76),(89,76),(90,76),(91,76),(92,76),(93,76),(94,76),(95,76),(96,76),(97,76),(98,76),(100,76),(101,76),(102,76),(104,76),(0,77),(6,77),(17,77),(37,77),(38,77),(40,77),(41,77),(42,77),(43,77),(44,77),(45,77),(46,77),(54,77),(56,77),(57,77),(58,77),(59,77),(60,77),(61,77),(65,77),(87,77),(88,77),(93,77),(94,77),(95,77),(96,77),(97,77),(98,77),(99,77),(100,77),(101,77),(104,77),(106,77),(107,77),(108,77),(109,77),(112,77),(0,78),(1,78),(17,78),(18,78),(31,78),(34,78),(35,78),(37,78),(38,78),(40,78),(46,78),(47,78),(49,78),(50,78),(51,78),(52,78),(54,78),(56,78),(57,78),(58,78),(59,78),(60,78),(61,78),(62,78),(63,78),(66,78),(86,78),(91,78),(106,78),(107,78),(108,78),(112,78),(0,79),(3,79),(5,79),(17,79),(31,79),(34,79),(37,79),(39,79),(50,79),(51,79),(52,79),(53,79),(56,79),(57,79),(58,79),(59,79),(60,79),(61,79),(62,79),(63,79),(66,79),(86,79),(88,79),(89,79),(93,79),(94,79),(95,79),(96,79),(100,79),(106,79),(107,79),(108,79),(109,79),(114,79),(115,79),(116,79),(117,79),(118,79),(119,79),(4,80),(17,80),(21,80),(22,80),(23,80),(24,80),(25,80),(26,80),(56,80),(57,80),(58,80),(59,80),(60,80),(61,80),(62,80),(63,80),(66,80),(67,80),(86,80),(88,80),(91,80),(94,80),(95,80),(96,80),(97,80),(98,80),(99,80),(102,80),(107,80),(108,80),(109,80),(114,80),(115,80),(116,80),(117,80),(118,80),(119,80),(2,81),(4,81),(19,81),(20,81),(21,81),(22,81),(23,81),(24,81),(25,81),(26,81),(56,81),(57,81),(58,81),(59,81),(60,81),(61,81),(62,81),(63,81),(66,81),(67,81),(68,81),(85,81),(86,81),(87,81),(91,81),(92,81),(93,81),(95,81),(108,81),(109,81),(114,81),(115,81),(116,81),(117,81),(118,81),(119,81),(0,82),(4,82),(19,82),(20,82),(21,82),(22,82),(23,82),(24,82),(25,82),(26,82),(56,82),(57,82),(58,82),(59,82),(60,82),(61,82),(62,82),(63,82),(66,82),(67,82),(68,82),(83,82),(84,82),(85,82),(86,82),(87,82),(89,82),(106,82),(109,82),(112,82),(114,82),(115,82),(116,82),(117,82),(118,82),(119,82),(4,83),(26,83),(56,83),(57,83),(58,83),(59,83),(60,83),(61,83),(62,83),(63,83),(66,83),(67,83),(82,83),(83,83),(84,83),(85,83),(86,83),(92,83),(94,83),(99,83),(100,83),(101,83),(102,83),(103,83),(104,83),(106,83),(112,83),(114,83),(115,83),(119,83),(0,84),(2,84),(3,84),(4,84),(19,84),(20,84),(21,84),(22,84),(23,84),(24,84),(25,84),(26,84),(35,84),(53,84),(56,84),(57,84),(58,84),(59,84),(60,84),(61,84),(62,84),(63,84),(68,84),(82,84),(89,84),(91,84),(92,84),(95,84),(96,84),(97,84),(98,84),(99,84),(100,84),(101,84),(102,84),(103,84),(104,84),(105,84),(106,84),(107,84),(108,84),(109,84),(112,84),(114,84),(115,84),(119,84),(0,85),(1,85),(2,85),(3,85),(4,85),(8,85),(9,85),(10,85),(11,85),(12,85),(13,85),(19,85),(20,85),(21,85),(22,85),(23,85),(24,85),(25,85),(26,85),(32,85),(33,85),(34,85),(35,85),(37,85),(38,85),(40,85),(41,85),(45,85),(49,85),(52,85),(65,85),(66,85),(68,85),(82,85),(84,85),(85,85),(86,85),(89,85),(90,85),(91,85),(94,85),(96,85),(98,85),(99,85),(100,85),(101,85),(102,85),(103,85),(104,85),(105,85),(106,85),(107,85),(108,85),(109,85),(110,85),(112,85),(114,85),(115,85),(119,85),(0,86),(1,86),(3,86),(4,86),(20,86),(21,86),(22,86),(23,86),(24,86),(25,86),(26,86),(36,86),(38,86),(40,86),(50,86),(56,86),(68,86),(84,86),(85,86),(86,86),(89,86),(90,86),(94,86),(96,86),(97,86),(99,86),(100,86),(101,86),(102,86),(103,86),(104,86),(105,86),(106,86),(107,86),(108,86),(112,86),(114,86),(115,86),(116,86),(117,86),(118,86),(119,86),(5,87),(19,87),(20,87),(21,87),(22,87),(23,87),(24,87),(25,87),(26,87),(33,87),(34,87),(38,87),(67,87),(68,87),(69,87),(85,87),(86,87),(90,87),(94,87),(96,87),(100,87),(106,87),(107,87),(108,87),(109,87),(110,87),(112,87),(114,87),(115,87),(116,87),(21,88),(22,88),(23,88),(24,88),(25,88),(33,88),(34,88),(36,88),(37,88),(40,88),(50,88),(51,88),(52,88),(63,88),(66,88),(67,88),(68,88),(85,88),(87,88),(89,88),(93,88),(94,88),(96,88),(99,88),(100,88),(101,88),(102,88),(103,88),(104,88),(105,88),(107,88),(108,88),(109,88),(110,88),(112,88),(114,88),(115,88),(116,88),(4,89),(5,89),(38,89),(40,89),(41,89),(44,89),(50,89),(51,89),(52,89),(56,89),(57,89),(58,89),(59,89),(61,89),(64,89),(65,89),(66,89),(67,89),(85,89),(86,89),(87,89),(94,89),(96,89),(97,89),(99,89),(100,89),(107,89),(110,89),(114,89),(115,89),(116,89),(1,90),(34,90),(35,90),(40,90),(41,90),(42,90),(43,90),(46,90),(50,90),(51,90),(52,90),(57,90),(59,90),(63,90),(87,90),(94,90),(97,90),(119,90),(7,91),(31,91),(33,91),(34,91),(37,91),(38,91),(39,91),(42,91),(51,91),(52,91),(56,91),(57,91),(58,91),(59,91),(61,91),(62,91),(63,91),(64,91),(65,91),(66,91),(86,91),(87,91),(88,91),(90,91),(94,91),(95,91),(112,91),(114,91),(115,91),(116,91),(117,91),(119,91),(4,92),(5,92),(6,92),(8,92),(86,92),(87,92),(88,92),(90,92),(94,92),(95,92),(96,92),(97,92),(98,92),(99,92),(100,92),(104,92),(105,92),(107,92),(109,92),(111,92),(112,92),(113,92),(114,92),(115,92),(116,92),(119,92),(11,93),(13,93),(15,93),(16,93),(20,93),(23,93),(26,93),(33,93),(35,93),(36,93),(43,93),(44,93),(53,93),(60,93),(87,93),(88,93),(96,93),(103,93),(104,93),(105,93),(106,93),(108,93),(109,93),(111,93),(112,93),(113,93),(114,93),(115,93),(116,93),(118,93),(119,93),(15,94),(16,94),(18,94),(19,94),(20,94),(21,94),(22,94),(23,94),(24,94),(25,94),(26,94),(27,94),(28,94),(31,94),(33,94),(38,94),(48,94),(49,94),(102,94),(103,94),(106,94),(108,94),(111,94),(112,94),(113,94),(114,94),(115,94),(116,94),(117,94),(119,94),(16,95),(19,95),(22,95),(27,95),(28,95),(38,95),(50,95),(102,95),(103,95),(104,95),(106,95),(107,95),(111,95),(112,95),(119,95),(25,96),(27,96),(32,96),(56,96),(57,96),(59,96),(61,96),(62,96),(64,96),(68,96),(71,96),(72,96),(86,96),(87,96),(88,96),(89,96),(91,96),(92,96),(93,96),(95,96),(96,96),(97,96),(98,96),(99,96),(100,96),(101,96),(102,96),(103,96),(104,96),(109,96),(110,96),(111,96),(112,96),(114,96),(115,96),(23,97),(26,97),(27,97),(32,97),(41,97),(42,97),(43,97),(44,97),(46,97),(47,97),(50,97),(56,97),(57,97),(58,97),(59,97),(61,97),(63,97),(64,97),(67,97),(86,97),(87,97),(88,97),(90,97),(107,97),(108,97),(109,97),(110,97),(111,97),(112,97),(114,97),(117,97),(24,98),(25,98),(26,98),(32,98),(37,98),(38,98),(39,98),(41,98),(42,98),(43,98),(44,98),(48,98),(49,98),(51,98),(52,98),(56,98),(58,98),(59,98),(60,98),(62,98),(63,98),(64,98),(68,98),(70,98),(71,98),(73,98),(86,98),(87,98),(88,98),(89,98),(90,98),(92,98),(93,98),(94,98),(95,98),(96,98),(97,98),(98,98),(99,98),(106,98),(107,98),(108,98),(109,98),(110,98),(111,98),(112,98),(116,98),(119,98),(27,99),(30,99),(31,99),(32,99),(36,99),(37,99),(38,99),(39,99),(45,99),(47,99),(48,99),(50,99),(51,99),(52,99),(56,99),(57,99),(58,99),(59,99),(60,99),(61,99),(65,99),(73,99),(85,99),(86,99),(89,99),(90,99),(92,99),(93,99),(101,99),(102,99),(103,99),(104,99),(106,99),(107,99),(108,99),(109,99),(110,99),(111,99),(112,99),(119,99),(26,100),(42,100),(43,100),(45,100),(47,100),(48,100),(50,100),(52,100),(57,100),(85,100),(86,100),(87,100),(89,100),(90,100),(92,100),(93,100),(98,100),(99,100),(100,100),(101,100),(102,100),(103,100),(104,100),(106,100),(107,100),(108,100),(109,100),(114,100),(115,100),(118,100),(119,100),(43,101),(46,101),(89,101),(92,101),(93,101),(96,101),(97,101),(99,101),(100,101),(101,101),(102,101),(103,101),(104,101),(105,101),(112,101),(114,101),(115,101),(116,101),(117,101),(118,101),(119,101),(43,102),(92,102),(93,102),(94,102),(95,102),(96,102),(97,102),(102,102),(103,102),(104,102),(105,102),(106,102),(107,102),(108,102),(109,102),(112,102),(114,102),(115,102),(116,102),(117,102),(118,102),(119,102),(93,103),(94,103),(95,103),(96,103),(97,103),(100,103),(102,103),(103,103),(104,103),(105,103),(106,103),(107,103),(112,103),(116,103),(117,103),(118,103),(119,103),(94,104),(95,104),(96,104),(97,104),(98,104),(100,104),(103,104),(104,104),(105,104),(106,104),(109,104),(110,104),(112,104),(113,104),(114,104),(116,104),(117,104),(118,104),(119,104),(96,105),(97,105),(103,105),(104,105),(105,105),(108,105),(109,105),(110,105),(111,105),(112,105),(113,105),(116,105),(117,105),(118,105),(119,105),(99,106),(100,106),(101,106),(102,106),(103,106),(105,106),(107,106),(108,106),(109,106),(110,106),(111,106),(112,106),(113,106),(116,106),(117,106),(118,106),(119,106),(4,107),(5,107),(6,107),(7,107),(78,107),(98,107),(99,107),(100,107),(101,107),(102,107),(103,107),(104,107),(106,107),(107,107),(108,107),(109,107),(110,107),(111,107),(112,107),(115,107),(116,107),(117,107),(118,107),(119,107),(0,108),(6,108),(12,108),(52,108),(56,108),(57,108),(60,108),(61,108),(62,108),(96,108),(97,108),(98,108),(99,108),(100,108),(101,108),(102,108),(103,108),(104,108),(105,108),(106,108),(107,108),(112,108),(113,108),(114,108),(115,108),(116,108),(117,108),(118,108),(119,108),(0,109),(1,109),(2,109),(3,109),(4,109),(5,109),(6,109),(7,109),(8,109),(9,109),(10,109),(11,109),(12,109),(13,109),(14,109),(15,109),(18,109),(19,109),(28,109),(29,109),(30,109),(31,109),(32,109),(33,109),(34,109),(52,109),(56,109),(73,109),(74,109),(78,109),(80,109),(81,109),(82,109),(83,109),(97,109),(98,109),(99,109),(100,109),(101,109),(102,109),(103,109),(104,109),(105,109),(106,109),(107,109),(108,109),(109,109),(110,109),(111,109),(112,109),(113,109),(114,109),(115,109),(116,109),(117,109),(118,109),(119,109)}
location.alwaysFront = {(5,0),(6,0),(7,0),(8,0),(14,0),(15,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(49,0),(50,0),(51,0),(52,0),(67,0),(68,0),(69,0),(74,0),(75,0),(76,0),(101,0),(102,0),(103,0),(107,0),(108,0),(109,0),(116,0),(117,0),(118,0),(5,1),(6,1),(7,1),(8,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(49,1),(50,1),(51,1),(52,1),(67,1),(68,1),(69,1),(74,1),(75,1),(76,1),(84,1),(85,1),(86,1),(101,1),(102,1),(103,1),(107,1),(108,1),(109,1),(111,1),(112,1),(113,1),(116,1),(117,1),(118,1),(0,2),(1,2),(2,2),(5,2),(6,2),(7,2),(8,2),(30,2),(31,2),(49,2),(50,2),(51,2),(52,2),(67,2),(68,2),(69,2),(74,2),(75,2),(76,2),(84,2),(85,2),(86,2),(101,2),(102,2),(103,2),(107,2),(108,2),(109,2),(111,2),(112,2),(113,2),(116,2),(117,2),(118,2),(0,3),(1,3),(2,3),(50,3),(51,3),(74,3),(75,3),(76,3),(84,3),(85,3),(86,3),(101,3),(102,3),(103,3),(107,3),(108,3),(109,3),(111,3),(112,3),(113,3),(116,3),(117,3),(118,3),(0,4),(1,4),(2,4),(50,4),(51,4),(84,4),(85,4),(86,4),(111,4),(112,4),(113,4),(0,5),(1,5),(2,5),(4,5),(85,5),(114,5),(115,5),(116,5),(0,6),(1,6),(2,6),(109,6),(110,6),(111,6),(114,6),(115,6),(116,6),(28,7),(29,7),(30,7),(104,7),(105,7),(106,7),(109,7),(110,7),(111,7),(114,7),(115,7),(116,7),(28,8),(29,8),(30,8),(44,8),(45,8),(46,8),(47,8),(48,8),(49,8),(104,8),(105,8),(106,8),(109,8),(110,8),(111,8),(114,8),(115,8),(116,8),(0,9),(1,9),(2,9),(3,9),(4,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(20,9),(21,9),(28,9),(29,9),(30,9),(44,9),(45,9),(46,9),(47,9),(48,9),(49,9),(104,9),(105,9),(106,9),(109,9),(110,9),(111,9),(0,10),(1,10),(2,10),(3,10),(4,10),(14,10),(15,10),(16,10),(17,10),(18,10),(19,10),(20,10),(21,10),(28,10),(29,10),(30,10),(44,10),(45,10),(46,10),(47,10),(48,10),(49,10),(65,10),(66,10),(67,10),(68,10),(104,10),(105,10),(106,10),(0,11),(1,11),(2,11),(3,11),(4,11),(14,11),(15,11),(16,11),(17,11),(18,11),(19,11),(20,11),(21,11),(22,11),(44,11),(45,11),(46,11),(47,11),(48,11),(49,11),(50,11),(51,11),(52,11),(53,11),(54,11),(55,11),(56,11),(57,11),(58,11),(65,11),(66,11),(67,11),(68,11),(0,12),(1,12),(2,12),(3,12),(4,12),(6,12),(7,12),(8,12),(9,12),(47,12),(48,12),(49,12),(50,12),(51,12),(52,12),(53,12),(54,12),(55,12),(56,12),(57,12),(58,12),(65,12),(66,12),(67,12),(68,12),(1,13),(2,13),(6,13),(7,13),(8,13),(9,13),(47,13),(48,13),(49,13),(50,13),(51,13),(52,13),(53,13),(54,13),(55,13),(56,13),(57,13),(58,13),(65,13),(66,13),(67,13),(68,13),(108,13),(109,13),(110,13),(6,14),(7,14),(8,14),(9,14),(47,14),(48,14),(49,14),(50,14),(51,14),(52,14),(53,14),(54,14),(55,14),(56,14),(57,14),(58,14),(108,14),(109,14),(110,14),(6,15),(7,15),(8,15),(9,15),(47,15),(48,15),(49,15),(50,15),(51,15),(52,15),(53,15),(54,15),(55,15),(56,15),(57,15),(58,15),(108,15),(109,15),(110,15),(113,15),(114,15),(115,15),(47,16),(48,16),(49,16),(50,16),(51,16),(52,16),(53,16),(54,16),(55,16),(56,16),(57,16),(58,16),(108,16),(109,16),(110,16),(113,16),(114,16),(115,16),(113,17),(114,17),(115,17),(113,18),(114,18),(115,18),(116,19),(117,19),(118,19),(119,19),(103,20),(104,20),(105,20),(116,20),(117,20),(118,20),(119,20),(0,21),(1,21),(2,21),(3,21),(103,21),(104,21),(105,21),(116,21),(117,21),(118,21),(119,21),(0,22),(1,22),(2,22),(3,22),(103,22),(104,22),(105,22),(108,22),(109,22),(116,22),(117,22),(118,22),(119,22),(0,23),(1,23),(2,23),(3,23),(103,23),(104,23),(105,23),(116,23),(117,23),(118,23),(119,23),(0,24),(1,24),(2,24),(3,24),(103,24),(104,24),(105,24),(0,25),(1,25),(2,25),(3,25),(3,26),(45,26),(46,26),(47,26),(48,26),(49,26),(45,27),(46,27),(47,27),(48,27),(49,27),(50,27),(100,27),(101,27),(102,27),(103,27),(104,27),(105,27),(45,28),(46,28),(47,28),(48,28),(49,28),(50,28),(100,28),(101,28),(102,28),(103,28),(104,28),(105,28),(114,28),(115,28),(116,28),(117,28),(118,28),(119,28),(45,29),(46,29),(47,29),(48,29),(49,29),(50,29),(100,29),(101,29),(102,29),(103,29),(104,29),(105,29),(114,29),(115,29),(116,29),(117,29),(118,29),(119,29),(6,30),(100,30),(101,30),(102,30),(103,30),(104,30),(105,30),(108,30),(109,30),(110,30),(114,30),(115,30),(116,30),(117,30),(118,30),(119,30),(0,31),(1,31),(2,31),(3,31),(7,31),(102,31),(103,31),(108,31),(109,31),(110,31),(114,31),(115,31),(116,31),(117,31),(118,31),(119,31),(4,32),(8,32),(108,32),(109,32),(110,32),(116,32),(117,32),(4,33),(8,33),(9,33),(103,33),(104,33),(105,33),(108,33),(109,33),(110,33),(4,34),(7,34),(9,34),(108,34),(109,34),(110,34),(113,34),(114,34),(115,34),(7,35),(113,35),(114,35),(115,35),(117,35),(118,35),(7,36),(2,37),(7,37),(10,37),(11,37),(12,37),(26,37),(27,37),(28,37),(35,37),(36,37),(37,37),(38,37),(39,37),(40,37),(43,37),(44,37),(45,37),(46,37),(2,38),(10,38),(11,38),(12,38),(14,38),(15,38),(16,38),(17,38),(26,38),(27,38),(28,38),(35,38),(36,38),(37,38),(38,38),(39,38),(40,38),(43,38),(44,38),(45,38),(46,38),(112,38),(113,38),(114,38),(10,39),(11,39),(12,39),(14,39),(15,39),(16,39),(17,39),(26,39),(27,39),(28,39),(35,39),(36,39),(37,39),(38,39),(39,39),(40,39),(43,39),(44,39),(45,39),(46,39),(112,39),(113,39),(114,39),(1,40),(10,40),(11,40),(12,40),(14,40),(15,40),(16,40),(17,40),(26,40),(27,40),(28,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(43,40),(44,40),(45,40),(46,40),(112,40),(113,40),(114,40),(1,41),(14,41),(15,41),(16,41),(17,41),(43,41),(44,41),(45,41),(46,41),(112,41),(113,41),(114,41),(1,42),(2,42),(3,42),(4,42),(14,42),(15,42),(16,42),(17,42),(90,42),(91,42),(92,42),(93,42),(94,42),(95,42),(96,42),(97,42),(98,42),(99,42),(100,42),(101,42),(112,42),(113,42),(114,42),(115,42),(116,42),(117,42),(118,42),(1,43),(2,43),(3,43),(4,43),(8,43),(50,43),(51,43),(52,43),(53,43),(54,43),(55,43),(62,43),(63,43),(64,43),(90,43),(91,43),(92,43),(93,43),(94,43),(95,43),(96,43),(97,43),(98,43),(99,43),(100,43),(101,43),(113,43),(114,43),(115,43),(116,43),(117,43),(118,43),(1,44),(2,44),(3,44),(4,44),(50,44),(51,44),(52,44),(53,44),(54,44),(55,44),(62,44),(63,44),(64,44),(84,44),(85,44),(86,44),(87,44),(90,44),(91,44),(92,44),(93,44),(94,44),(95,44),(96,44),(97,44),(98,44),(99,44),(100,44),(101,44),(113,44),(114,44),(115,44),(116,44),(117,44),(118,44),(1,45),(2,45),(3,45),(4,45),(50,45),(51,45),(52,45),(53,45),(54,45),(55,45),(62,45),(63,45),(64,45),(84,45),(85,45),(86,45),(87,45),(90,45),(101,45),(102,45),(103,45),(104,45),(105,45),(113,45),(114,45),(115,45),(116,45),(117,45),(118,45),(1,46),(2,46),(3,46),(4,46),(35,46),(36,46),(37,46),(50,46),(51,46),(52,46),(53,46),(54,46),(55,46),(56,46),(57,46),(58,46),(59,46),(62,46),(63,46),(64,46),(84,46),(85,46),(86,46),(87,46),(90,46),(101,46),(116,46),(35,47),(36,47),(37,47),(38,47),(39,47),(40,47),(41,47),(42,47),(43,47),(44,47),(50,47),(51,47),(52,47),(53,47),(54,47),(55,47),(56,47),(57,47),(58,47),(59,47),(62,47),(63,47),(64,47),(90,47),(101,47),(35,48),(36,48),(37,48),(38,48),(39,48),(40,48),(41,48),(42,48),(43,48),(44,48),(45,48),(46,48),(47,48),(90,48),(101,48),(117,48),(118,48),(119,48),(29,49),(30,49),(31,49),(32,49),(34,49),(35,49),(36,49),(37,49),(38,49),(39,49),(40,49),(41,49),(42,49),(43,49),(44,49),(45,49),(46,49),(47,49),(117,49),(118,49),(119,49),(24,50),(29,50),(30,50),(31,50),(32,50),(33,50),(34,50),(35,50),(36,50),(37,50),(117,50),(118,50),(119,50),(24,51),(29,51),(30,51),(31,51),(32,51),(33,51),(34,51),(117,51),(118,51),(119,51),(29,52),(30,52),(31,52),(32,52),(33,52),(62,52),(63,52),(64,52),(117,52),(118,52),(119,52),(33,53),(62,53),(63,53),(64,53),(33,54),(56,54),(57,54),(58,54),(59,54),(62,54),(63,54),(64,54),(115,54),(116,54),(117,54),(118,54),(119,54),(0,55),(1,55),(2,55),(51,55),(52,55),(53,55),(54,55),(55,55),(56,55),(57,55),(58,55),(59,55),(62,55),(63,55),(64,55),(115,55),(116,55),(117,55),(118,55),(119,55),(0,56),(1,56),(2,56),(51,56),(52,56),(53,56),(54,56),(55,56),(56,56),(57,56),(58,56),(59,56),(60,56),(115,56),(116,56),(117,56),(118,56),(119,56),(0,57),(1,57),(2,57),(51,57),(52,57),(53,57),(54,57),(55,57),(56,57),(57,57),(58,57),(59,57),(60,57),(61,57),(62,57),(63,57),(64,57),(65,57),(66,57),(112,57),(113,57),(114,57),(115,57),(116,57),(117,57),(118,57),(119,57),(0,58),(1,58),(2,58),(5,58),(6,58),(7,58),(8,58),(24,58),(51,58),(52,58),(53,58),(54,58),(55,58),(56,58),(57,58),(58,58),(59,58),(60,58),(61,58),(62,58),(63,58),(64,58),(65,58),(66,58),(112,58),(113,58),(114,58),(117,58),(118,58),(0,59),(1,59),(2,59),(5,59),(6,59),(7,59),(8,59),(24,59),(60,59),(61,59),(62,59),(63,59),(64,59),(65,59),(66,59),(112,59),(113,59),(114,59),(0,60),(1,60),(5,60),(6,60),(7,60),(8,60),(61,60),(62,60),(63,60),(64,60),(65,60),(66,60),(94,60),(95,60),(96,60),(97,60),(98,60),(99,60),(101,60),(102,60),(103,60),(112,60),(113,60),(114,60),(0,61),(1,61),(38,61),(39,61),(40,61),(89,61),(90,61),(91,61),(94,61),(95,61),(96,61),(97,61),(98,61),(99,61),(101,61),(102,61),(103,61),(112,61),(113,61),(114,61),(38,62),(39,62),(40,62),(89,62),(90,62),(91,62),(92,62),(93,62),(94,62),(95,62),(96,62),(97,62),(98,62),(99,62),(100,62),(101,62),(102,62),(103,62),(0,63),(1,63),(2,63),(38,63),(39,63),(40,63),(41,63),(42,63),(43,63),(44,63),(45,63),(46,63),(89,63),(90,63),(91,63),(92,63),(93,63),(94,63),(95,63),(96,63),(97,63),(98,63),(99,63),(100,63),(101,63),(102,63),(103,63),(0,64),(1,64),(2,64),(21,64),(38,64),(39,64),(40,64),(41,64),(42,64),(43,64),(44,64),(45,64),(46,64),(89,64),(90,64),(91,64),(92,64),(93,64),(94,64),(95,64),(98,64),(99,64),(100,64),(101,64),(102,64),(103,64),(0,65),(1,65),(2,65),(21,65),(38,65),(40,65),(41,65),(42,65),(43,65),(44,65),(45,65),(46,65),(89,65),(90,65),(91,65),(92,65),(93,65),(94,65),(95,65),(98,65),(99,65),(100,65),(101,65),(0,66),(1,66),(2,66),(16,66),(17,66),(18,66),(19,66),(38,66),(40,66),(41,66),(42,66),(43,66),(44,66),(45,66),(46,66),(89,66),(90,66),(91,66),(92,66),(93,66),(94,66),(95,66),(98,66),(99,66),(100,66),(101,66),(0,67),(1,67),(2,67),(4,67),(5,67),(6,67),(16,67),(17,67),(18,67),(19,67),(40,67),(41,67),(42,67),(43,67),(44,67),(45,67),(46,67),(89,67),(90,67),(91,67),(92,67),(93,67),(94,67),(101,67),(102,67),(103,67),(104,67),(105,67),(106,67),(0,68),(1,68),(2,68),(4,68),(5,68),(6,68),(16,68),(17,68),(18,68),(19,68),(40,68),(41,68),(42,68),(43,68),(44,68),(45,68),(46,68),(89,68),(90,68),(91,68),(92,68),(93,68),(94,68),(98,68),(99,68),(100,68),(101,68),(102,68),(103,68),(104,68),(105,68),(106,68),(0,69),(1,69),(2,69),(3,69),(4,69),(5,69),(6,69),(19,69),(89,69),(90,69),(91,69),(92,69),(93,69),(94,69),(98,69),(99,69),(100,69),(101,69),(102,69),(103,69),(104,69),(105,69),(106,69),(0,70),(1,70),(2,70),(3,70),(5,70),(6,70),(98,70),(99,70),(100,70),(101,70),(102,70),(103,70),(104,70),(105,70),(106,70),(0,71),(1,71),(2,71),(3,71),(98,71),(99,71),(100,71),(0,72),(1,72),(2,72),(3,72),(27,72),(30,72),(99,72),(101,72),(0,73),(1,73),(2,73),(3,73),(27,73),(30,73),(4,74),(34,74),(35,74),(59,74),(60,74),(61,74),(62,74),(63,74),(91,74),(92,74),(93,74),(94,74),(95,74),(9,75),(10,75),(33,75),(34,75),(35,75),(58,75),(59,75),(60,75),(61,75),(62,75),(63,75),(91,75),(92,75),(93,75),(94,75),(95,75),(112,75),(113,75),(114,75),(3,76),(4,76),(5,76),(9,76),(10,76),(11,76),(57,76),(58,76),(59,76),(60,76),(61,76),(62,76),(63,76),(91,76),(92,76),(93,76),(94,76),(112,76),(113,76),(114,76),(3,77),(4,77),(5,77),(8,77),(9,77),(10,77),(11,77),(12,77),(56,77),(57,77),(58,77),(59,77),(60,77),(61,77),(62,77),(63,77),(64,77),(91,77),(92,77),(93,77),(94,77),(112,77),(113,77),(114,77),(115,77),(116,77),(117,77),(118,77),(119,77),(0,78),(1,78),(2,78),(3,78),(4,78),(5,78),(7,78),(8,78),(9,78),(10,78),(11,78),(12,78),(13,78),(56,78),(57,78),(58,78),(59,78),(60,78),(61,78),(62,78),(63,78),(64,78),(112,78),(113,78),(114,78),(115,78),(116,78),(117,78),(118,78),(119,78),(0,79),(1,79),(2,79),(3,79),(4,79),(5,79),(7,79),(8,79),(9,79),(10,79),(11,79),(12,79),(13,79),(14,79),(56,79),(57,79),(58,79),(59,79),(60,79),(61,79),(62,79),(63,79),(64,79),(112,79),(113,79),(114,79),(115,79),(116,79),(117,79),(118,79),(119,79),(0,80),(1,80),(2,80),(13,80),(14,80),(19,80),(20,80),(21,80),(22,80),(23,80),(24,80),(25,80),(26,80),(56,80),(57,80),(58,80),(59,80),(60,80),(61,80),(62,80),(63,80),(64,80),(84,80),(85,80),(86,80),(87,80),(115,80),(116,80),(117,80),(118,80),(119,80),(0,81),(1,81),(2,81),(13,81),(14,81),(15,81),(19,81),(20,81),(21,81),(22,81),(23,81),(24,81),(25,81),(26,81),(57,81),(58,81),(59,81),(60,81),(62,81),(63,81),(64,81),(84,81),(85,81),(86,81),(87,81),(13,82),(14,82),(15,82),(19,82),(20,82),(21,82),(22,82),(23,82),(24,82),(25,82),(26,82),(57,82),(58,82),(59,82),(60,82),(84,82),(85,82),(86,82),(87,82),(101,82),(102,82),(103,82),(104,82),(105,82),(13,83),(14,83),(15,83),(19,83),(20,83),(21,83),(22,83),(23,83),(24,83),(25,83),(26,83),(32,83),(33,83),(34,83),(35,83),(57,83),(58,83),(59,83),(60,83),(84,83),(85,83),(86,83),(87,83),(99,83),(100,83),(101,83),(102,83),(103,83),(104,83),(105,83),(106,83),(107,83),(4,84),(5,84),(6,84),(13,84),(14,84),(15,84),(32,84),(33,84),(34,84),(35,84),(38,84),(39,84),(40,84),(99,84),(100,84),(101,84),(102,84),(103,84),(104,84),(105,84),(106,84),(107,84),(111,84),(112,84),(113,84),(114,84),(115,84),(116,84),(4,85),(5,85),(6,85),(32,85),(33,85),(34,85),(35,85),(38,85),(39,85),(40,85),(99,85),(100,85),(101,85),(102,85),(103,85),(104,85),(105,85),(106,85),(107,85),(111,85),(112,85),(113,85),(114,85),(115,85),(116,85),(117,85),(118,85),(119,85),(4,86),(5,86),(6,86),(17,86),(27,86),(38,86),(39,86),(40,86),(111,86),(112,86),(113,86),(114,86),(115,86),(116,86),(117,86),(118,86),(119,86),(4,87),(5,87),(6,87),(17,87),(27,87),(38,87),(39,87),(40,87),(111,87),(112,87),(113,87),(114,87),(115,87),(116,87),(117,87),(118,87),(119,87),(50,88),(51,88),(52,88),(53,88),(86,88),(87,88),(88,88),(117,88),(118,88),(119,88),(50,89),(51,89),(52,89),(53,89),(86,89),(87,89),(88,89),(117,89),(118,89),(119,89),(50,90),(51,90),(52,90),(53,90),(88,90),(23,91),(24,91),(25,91),(26,91),(27,91),(28,91),(23,92),(24,92),(25,92),(26,92),(27,92),(28,92),(30,92),(31,92),(32,92),(23,93),(24,93),(25,93),(26,93),(27,93),(28,93),(30,93),(31,93),(32,93),(23,94),(24,94),(25,94),(26,94),(27,94),(28,94),(30,94),(31,94),(32,94),(101,94),(102,94),(103,94),(30,95),(31,95),(32,95),(95,95),(96,95),(97,95),(98,95),(99,95),(100,95),(101,95),(102,95),(103,95),(42,96),(43,96),(44,96),(45,96),(73,96),(95,96),(96,96),(97,96),(98,96),(99,96),(100,96),(101,96),(102,96),(103,96),(42,97),(43,97),(44,97),(45,97),(95,97),(96,97),(97,97),(98,97),(99,97),(100,97),(101,97),(102,97),(103,97),(104,97),(105,97),(106,97),(107,97),(108,97),(109,97),(110,97),(111,97),(112,97),(42,98),(43,98),(44,98),(45,98),(52,98),(56,98),(95,98),(96,98),(97,98),(98,98),(99,98),(100,98),(101,98),(102,98),(103,98),(104,98),(105,98),(106,98),(107,98),(108,98),(109,98),(110,98),(111,98),(112,98),(114,98),(115,98),(116,98),(42,99),(43,99),(44,99),(45,99),(52,99),(56,99),(103,99),(104,99),(105,99),(106,99),(107,99),(108,99),(109,99),(110,99),(111,99),(112,99),(114,99),(115,99),(116,99),(103,100),(104,100),(105,100),(106,100),(107,100),(108,100),(109,100),(110,100),(111,100),(112,100),(114,100),(115,100),(116,100),(118,100),(119,100),(3,101),(4,101),(5,101),(6,101),(7,101),(8,101),(95,101),(96,101),(97,101),(98,101),(103,101),(104,101),(105,101),(106,101),(114,101),(115,101),(116,101),(118,101),(119,101),(3,102),(4,102),(5,102),(6,102),(7,102),(8,102),(95,102),(96,102),(97,102),(98,102),(114,102),(115,102),(116,102),(118,102),(119,102),(3,103),(4,103),(5,103),(6,103),(7,103),(8,103),(95,103),(96,103),(97,103),(98,103),(118,103),(119,103),(3,104),(4,104),(5,104),(6,104),(7,104),(8,104),(12,104),(13,104),(14,104),(33,104),(34,104),(35,104),(36,104),(37,104),(38,104),(95,104),(96,104),(97,104),(98,104),(118,104),(119,104),(0,105),(1,105),(2,105),(5,105),(6,105),(12,105),(13,105),(14,105),(33,105),(34,105),(35,105),(36,105),(37,105),(38,105),(41,105),(42,105),(43,105),(44,105),(45,105),(46,105),(56,105),(57,105),(58,105),(59,105),(73,105),(74,105),(75,105),(76,105),(95,105),(96,105),(97,105),(98,105),(110,105),(111,105),(112,105),(113,105),(0,106),(1,106),(2,106),(5,106),(6,106),(12,106),(13,106),(14,106),(20,106),(21,106),(22,106),(23,106),(33,106),(34,106),(35,106),(36,106),(37,106),(38,106),(41,106),(42,106),(43,106),(44,106),(45,106),(46,106),(49,106),(50,106),(51,106),(52,106),(56,106),(57,106),(58,106),(59,106),(67,106),(68,106),(69,106),(70,106),(71,106),(72,106),(73,106),(74,106),(75,106),(76,106),(77,106),(78,106),(79,106),(94,106),(95,106),(96,106),(97,106),(98,106),(99,106),(104,106),(105,106),(106,106),(107,106),(108,106),(109,106),(110,106),(111,106),(112,106),(113,106),(116,106),(0,107),(1,107),(2,107),(5,107),(6,107),(10,107),(11,107),(12,107),(13,107),(14,107),(16,107),(17,107),(18,107),(20,107),(21,107),(22,107),(23,107),(24,107),(25,107),(26,107),(27,107),(28,107),(29,107),(30,107),(31,107),(32,107),(33,107),(34,107),(35,107),(36,107),(37,107),(38,107),(41,107),(42,107),(43,107),(44,107),(45,107),(46,107),(49,107),(50,107),(51,107),(52,107),(56,107),(57,107),(58,107),(59,107),(63,107),(64,107),(65,107),(66,107),(67,107),(68,107),(69,107),(70,107),(71,107),(72,107),(73,107),(74,107),(75,107),(76,107),(77,107),(78,107),(79,107),(94,107),(95,107),(96,107),(97,107),(98,107),(99,107),(100,107),(101,107),(102,107),(103,107),(104,107),(105,107),(106,107),(107,107),(108,107),(109,107),(110,107),(111,107),(112,107),(113,107),(116,107),(117,107),(118,107),(119,107),(0,108),(1,108),(2,108),(5,108),(6,108),(7,108),(8,108),(9,108),(10,108),(11,108),(12,108),(13,108),(14,108),(16,108),(17,108),(18,108),(20,108),(21,108),(22,108),(23,108),(25,108),(26,108),(27,108),(28,108),(30,108),(31,108),(32,108),(35,108),(36,108),(38,108),(39,108),(40,108),(41,108),(42,108),(43,108),(44,108),(45,108),(46,108),(49,108),(50,108),(51,108),(52,108),(56,108),(57,108),(58,108),(59,108),(63,108),(64,108),(65,108),(66,108),(67,108),(68,108),(69,108),(70,108),(71,108),(72,108),(73,108),(74,108),(75,108),(76,108),(77,108),(78,108),(79,108),(80,108),(94,108),(95,108),(96,108),(97,108),(98,108),(99,108),(100,108),(101,108),(102,108),(103,108),(104,108),(105,108),(106,108),(107,108),(108,108),(109,108),(110,108),(111,108),(112,108),(113,108),(116,108),(117,108),(118,108),(119,108),(0,109),(1,109),(2,109),(5,109),(6,109),(7,109),(8,109),(9,109),(10,109),(11,109),(12,109),(13,109),(14,109),(16,109),(17,109),(18,109),(20,109),(21,109),(22,109),(23,109),(25,109),(26,109),(27,109),(28,109),(30,109),(31,109),(32,109),(35,109),(36,109),(38,109),(39,109),(40,109),(43,109),(44,109),(49,109),(50,109),(51,109),(52,109),(57,109),(58,109),(63,109),(64,109),(65,109),(66,109),(67,109),(68,109),(69,109),(70,109),(71,109),(72,109),(73,109),(74,109),(75,109),(76,109),(78,109),(79,109),(80,109),(94,109),(95,109),(96,109),(97,109),(98,109),(99,109),(100,109),(101,109),(102,109),(103,109),(104,109),(105,109),(106,109),(107,109),(108,109),(109,109),(110,109),(111,109),(112,109),(113,109),(116,109),(117,109),(118,109),(119,109)}
location.front = {(1,0),(2,0),(3,0),(10,0),(11,0),(12,0),(25,0),(72,0),(85,0),(86,0),(1,1),(2,1),(3,1),(44,1),(45,1),(46,1),(58,1),(59,1),(60,1),(88,1),(89,1),(90,1),(3,2),(4,2),(5,2),(41,2),(42,2),(43,2),(44,2),(45,2),(46,2),(53,2),(54,2),(58,2),(59,2),(60,2),(41,3),(42,3),(43,3),(44,3),(45,3),(46,3),(47,3),(48,3),(53,3),(54,3),(58,3),(59,3),(60,3),(64,3),(65,3),(66,3),(68,3),(41,4),(42,4),(43,4),(47,4),(48,4),(64,4),(65,4),(66,4),(70,4),(71,4),(72,4),(73,4),(75,4),(65,5),(6,6),(61,6),(62,6),(60,7),(61,7),(62,7),(63,7),(64,7),(65,7),(66,7),(67,7),(68,7),(69,7),(70,7),(71,7),(72,7),(73,7),(74,7),(75,7),(76,7),(77,7),(70,9),(71,9),(72,9),(11,10),(23,10),(24,10),(27,10),(74,10),(117,10),(118,10),(119,10),(29,11),(36,11),(37,11),(38,11),(39,11),(40,11),(41,11),(42,11),(11,12),(14,12),(15,12),(16,12),(17,12),(18,12),(19,12),(20,12),(21,12),(22,12),(23,12),(27,12),(35,12),(43,12),(46,12),(47,12),(58,13),(59,13),(60,13),(61,13),(62,13),(63,13),(64,13),(65,13),(66,13),(67,13),(68,13),(66,14),(67,14),(72,15),(75,15),(104,15),(105,15),(106,15),(0,16),(7,16),(8,16),(47,16),(48,16),(49,16),(50,16),(51,16),(52,16),(53,16),(54,16),(55,16),(56,16),(57,16),(58,16),(81,16),(0,17),(36,17),(37,17),(38,17),(40,17),(41,17),(42,17),(47,17),(48,17),(49,17),(50,17),(51,17),(52,17),(53,17),(54,17),(55,17),(56,17),(57,17),(58,17),(0,18),(1,18),(2,18),(3,18),(59,18),(60,18),(61,18),(64,18),(65,18),(66,18),(67,18),(0,19),(67,19),(25,20),(26,20),(27,20),(81,20),(26,23),(79,23),(24,24),(25,24),(26,24),(27,24),(28,24),(20,25),(33,25),(76,25),(4,27),(5,27),(6,27),(0,28),(1,28),(4,28),(5,28),(7,30),(8,30),(47,30),(48,30),(8,31),(8,32),(9,32),(4,33),(9,33),(10,33),(1,36),(2,36),(32,36),(33,36),(34,36),(1,37),(2,37),(3,37),(4,37),(9,37),(116,37),(117,37),(118,37),(119,37),(2,38),(3,38),(4,38),(5,38),(6,38),(9,38),(66,38),(116,38),(117,38),(118,38),(119,38),(2,39),(3,39),(4,39),(5,39),(6,39),(7,39),(9,39),(10,39),(11,39),(12,39),(13,39),(14,39),(25,39),(26,39),(27,39),(28,39),(29,39),(30,39),(31,39),(32,39),(33,39),(34,39),(35,39),(36,39),(37,39),(38,39),(39,39),(40,39),(41,39),(42,39),(43,39),(44,39),(45,39),(116,39),(117,39),(118,39),(119,39),(0,40),(2,40),(3,40),(4,40),(5,40),(6,40),(7,40),(8,40),(9,40),(10,40),(11,40),(12,40),(13,40),(14,40),(15,40),(22,40),(23,40),(24,40),(29,40),(30,40),(31,40),(32,40),(33,40),(39,40),(40,40),(46,40),(47,40),(50,40),(51,40),(52,40),(103,40),(108,40),(111,40),(116,40),(117,40),(118,40),(119,40),(0,41),(2,41),(3,41),(4,41),(5,41),(6,41),(7,41),(11,41),(14,41),(15,41),(16,41),(22,41),(24,41),(25,41),(27,41),(29,41),(30,41),(31,41),(37,41),(38,41),(44,41),(45,41),(46,41),(47,41),(50,41),(116,41),(117,41),(118,41),(119,41),(0,42),(1,42),(7,42),(15,42),(16,42),(17,42),(18,42),(19,42),(47,42),(113,42),(0,43),(1,43),(9,43),(10,43),(11,43),(12,43),(13,43),(17,43),(18,43),(19,43),(47,43),(113,43),(118,43),(0,44),(1,44),(6,44),(8,44),(9,44),(10,44),(11,44),(12,44),(13,44),(84,44),(85,44),(86,44),(87,44),(8,45),(9,45),(10,45),(84,45),(85,45),(86,45),(87,45),(91,45),(92,45),(93,45),(94,45),(95,45),(96,45),(97,45),(98,45),(99,45),(100,45),(102,45),(103,45),(104,45),(105,45),(106,45),(107,45),(108,45),(109,45),(110,45),(0,46),(1,46),(4,46),(5,46),(8,46),(9,46),(10,46),(84,46),(85,46),(86,46),(87,46),(91,46),(92,46),(93,46),(94,46),(95,46),(96,46),(97,46),(98,46),(99,46),(100,46),(102,46),(103,46),(104,46),(105,46),(115,46),(8,47),(9,47),(10,47),(84,47),(87,47),(105,47),(110,47),(34,48),(35,48),(36,48),(37,48),(38,48),(39,48),(40,48),(41,48),(42,48),(43,48),(44,48),(45,48),(46,48),(47,48),(56,48),(57,48),(58,48),(59,48),(106,48),(34,49),(35,49),(36,49),(37,49),(38,49),(39,49),(40,49),(41,49),(42,49),(43,49),(44,49),(45,49),(46,49),(47,49),(56,49),(57,49),(58,49),(59,49),(90,49),(101,49),(106,49),(110,49),(111,49),(112,49),(113,49),(114,49),(115,49),(24,50),(33,50),(34,50),(35,50),(36,50),(37,50),(38,50),(39,50),(40,50),(41,50),(42,50),(43,50),(44,50),(45,50),(46,50),(47,50),(55,50),(56,50),(57,50),(58,50),(59,50),(90,50),(93,50),(94,50),(101,50),(109,50),(110,50),(111,50),(112,50),(113,50),(114,50),(115,50),(24,51),(38,51),(39,51),(40,51),(41,51),(42,51),(43,51),(44,51),(45,51),(46,51),(47,51),(55,51),(110,51),(111,51),(112,51),(113,51),(114,51),(115,51),(24,52),(38,52),(39,52),(40,52),(41,52),(42,52),(43,52),(44,52),(45,52),(46,52),(47,52),(110,52),(111,52),(112,52),(113,52),(114,52),(115,52),(30,53),(31,53),(33,53),(38,53),(39,53),(40,53),(41,53),(42,53),(43,53),(44,53),(45,53),(46,53),(47,53),(102,53),(103,53),(104,53),(105,53),(106,53),(107,53),(108,53),(109,53),(110,53),(112,53),(113,53),(33,54),(38,54),(39,54),(40,54),(41,54),(42,54),(43,54),(44,54),(45,54),(46,54),(47,54),(70,54),(71,54),(72,54),(73,54),(74,54),(75,54),(76,54),(77,54),(105,54),(106,54),(107,54),(2,55),(3,55),(4,55),(5,55),(6,55),(7,55),(8,55),(9,55),(10,55),(11,55),(12,55),(13,55),(15,55),(16,55),(33,55),(35,55),(37,55),(51,55),(52,55),(53,55),(54,55),(55,55),(56,55),(57,55),(58,55),(110,55),(16,56),(63,56),(24,58),(24,59),(52,59),(54,59),(55,59),(56,59),(57,59),(58,59),(59,59),(60,59),(116,59),(117,59),(118,59),(119,59),(24,60),(54,60),(55,60),(56,60),(57,60),(58,60),(59,60),(60,60),(63,60),(64,60),(65,60),(66,60),(116,60),(117,60),(118,60),(119,60),(5,61),(6,61),(7,61),(8,61),(63,61),(64,61),(65,61),(66,61),(116,61),(117,61),(118,61),(119,61),(5,62),(6,62),(7,62),(8,62),(17,62),(18,62),(49,62),(52,62),(94,62),(95,62),(98,62),(99,62),(101,62),(116,62),(117,62),(118,62),(119,62),(89,63),(90,63),(91,63),(92,63),(93,63),(94,63),(95,63),(96,63),(97,63),(98,63),(99,63),(100,63),(101,63),(102,63),(103,63),(104,63),(105,63),(113,63),(114,63),(115,63),(116,63),(117,63),(118,63),(119,63),(21,64),(96,64),(97,64),(113,64),(114,64),(115,64),(116,64),(117,64),(118,64),(3,65),(4,65),(21,65),(38,65),(39,65),(51,65),(52,65),(53,65),(54,65),(55,65),(69,65),(70,65),(71,65),(72,65),(73,65),(74,65),(75,65),(76,65),(95,65),(96,65),(97,65),(102,65),(103,65),(104,65),(113,65),(114,65),(115,65),(116,65),(117,65),(118,65),(21,66),(38,66),(53,66),(69,66),(70,66),(71,66),(72,66),(73,66),(74,66),(75,66),(76,66),(93,66),(95,66),(96,66),(97,66),(99,66),(100,66),(102,66),(103,66),(104,66),(113,66),(114,66),(115,66),(116,66),(117,66),(118,66),(16,67),(38,67),(95,67),(96,67),(97,67),(115,67),(116,67),(74,68),(75,68),(95,68),(96,68),(97,68),(110,68),(111,68),(112,68),(113,68),(114,68),(115,68),(16,69),(17,69),(18,69),(47,69),(52,69),(53,69),(54,69),(95,69),(96,69),(97,69),(101,69),(102,69),(110,69),(111,69),(112,69),(113,69),(114,69),(115,69),(4,70),(17,70),(18,70),(19,70),(53,70),(91,70),(92,70),(110,70),(111,70),(112,70),(113,70),(114,70),(115,70),(5,71),(93,71),(94,71),(95,71),(103,71),(104,71),(110,71),(111,71),(112,71),(113,71),(114,71),(115,71),(27,72),(30,72),(93,72),(94,72),(95,72),(99,72),(112,72),(113,72),(114,72),(115,72),(116,72),(117,72),(0,73),(27,73),(30,73),(89,73),(90,73),(91,73),(92,73),(93,73),(94,73),(95,73),(96,73),(97,73),(98,73),(99,73),(100,73),(101,73),(102,73),(103,73),(104,73),(105,73),(114,73),(115,73),(116,73),(117,73),(27,74),(30,74),(34,74),(35,74),(55,74),(56,74),(57,74),(58,74),(59,74),(60,74),(61,74),(62,74),(63,74),(64,74),(65,74),(66,74),(67,74),(114,74),(115,74),(116,74),(117,74),(33,75),(34,75),(35,75),(114,75),(115,75),(116,75),(117,75),(0,76),(1,76),(2,76),(5,76),(6,76),(7,76),(8,76),(9,76),(10,76),(11,76),(12,76),(13,76),(14,76),(15,76),(17,76),(33,76),(34,76),(35,76),(95,76),(111,76),(114,76),(115,76),(116,76),(117,76),(41,77),(46,77),(66,77),(67,77),(95,77),(96,77),(97,77),(98,77),(99,77),(100,77),(101,77),(102,77),(103,77),(96,78),(97,78),(98,78),(99,78),(100,78),(101,78),(102,78),(105,78),(65,79),(66,79),(67,79),(68,79),(96,79),(97,79),(99,79),(100,79),(101,79),(102,79),(3,80),(4,80),(5,80),(6,80),(7,80),(8,80),(9,80),(10,80),(11,80),(12,80),(13,80),(14,80),(90,80),(91,80),(3,81),(4,81),(5,81),(6,81),(7,81),(8,81),(9,81),(10,81),(11,81),(12,81),(13,81),(14,81),(64,81),(91,81),(114,81),(115,81),(116,81),(117,81),(3,82),(4,82),(5,82),(6,82),(7,82),(8,82),(9,82),(10,82),(11,82),(12,82),(13,82),(64,82),(114,82),(115,82),(116,82),(117,82),(3,83),(4,83),(5,83),(6,83),(7,83),(8,83),(9,83),(10,83),(11,83),(12,83),(13,83),(39,83),(96,83),(97,83),(98,83),(99,83),(100,83),(101,83),(102,83),(103,83),(104,83),(105,83),(106,83),(107,83),(108,83),(114,83),(115,83),(116,83),(117,83),(2,84),(3,84),(4,84),(5,84),(6,84),(42,84),(56,84),(85,84),(86,84),(114,84),(115,84),(116,84),(117,84),(13,85),(14,85),(47,85),(53,85),(61,85),(63,85),(64,85),(114,85),(115,85),(116,85),(117,85),(16,86),(17,86),(27,86),(32,86),(33,86),(34,86),(35,86),(67,86),(68,86),(70,86),(85,86),(86,86),(6,87),(7,87),(8,87),(17,87),(27,87),(32,87),(33,87),(34,87),(35,87),(67,87),(5,88),(17,88),(19,88),(22,88),(27,88),(39,88),(113,88),(114,88),(42,89),(53,89),(66,89),(69,89),(70,89),(71,89),(107,89),(53,90),(108,90),(50,91),(51,91),(52,91),(53,91),(57,91),(58,91),(59,91),(60,91),(61,91),(62,91),(63,91),(64,91),(65,91),(66,91),(85,91),(88,91),(94,91),(113,91),(114,91),(115,91),(116,91),(117,91),(118,91),(30,92),(31,92),(32,92),(33,92),(34,92),(35,92),(36,92),(37,92),(38,92),(39,92),(51,92),(52,92),(53,92),(113,92),(114,92),(115,92),(116,92),(117,92),(118,92),(105,93),(113,93),(114,93),(115,93),(116,93),(117,93),(118,93),(113,94),(114,94),(115,94),(116,94),(117,94),(118,94),(25,95),(26,95),(75,95),(76,95),(77,95),(78,95),(79,95),(80,95),(81,95),(82,95),(115,95),(116,95),(118,95),(119,95),(31,96),(113,96),(114,96),(118,96),(119,96),(92,97),(93,97),(94,97),(95,97),(96,97),(97,97),(98,97),(99,97),(100,97),(101,97),(102,97),(103,97),(104,97),(105,97),(106,97),(107,97),(108,97),(109,97),(110,97),(111,97),(31,98),(32,98),(33,98),(36,98),(37,98),(38,98),(39,98),(52,98),(56,98),(88,98),(92,98),(99,98),(100,98),(52,99),(56,99),(93,99),(94,99),(97,99),(98,99),(106,99),(107,99),(108,99),(43,100),(44,100),(52,100),(56,100),(100,100),(101,100),(102,100),(106,100),(107,100),(108,100),(109,101),(110,101),(0,102),(1,102),(9,102),(10,102),(11,102),(51,102),(100,102),(101,102),(102,102),(112,102),(113,102),(114,102),(0,103),(1,103),(9,103),(10,103),(11,103),(92,103),(93,103),(94,103),(100,103),(101,103),(102,103),(103,103),(104,103),(105,103),(106,103),(112,103),(113,103),(114,103),(0,104),(1,104),(9,104),(10,104),(11,104),(12,104),(13,104),(14,104),(25,104),(26,104),(27,104),(28,104),(29,104),(30,104),(100,104),(101,104),(102,104),(103,104),(104,104),(105,104),(106,104),(108,104),(109,104),(114,104),(115,104),(116,104),(117,104),(118,104),(119,104),(0,105),(1,105),(9,105),(10,105),(11,105),(12,105),(13,105),(14,105),(25,105),(26,105),(27,105),(28,105),(29,105),(30,105),(98,105),(99,105),(100,105),(101,105),(102,105),(103,105),(104,105),(105,105),(106,105),(114,105),(115,105),(116,105),(117,105),(118,105),(119,105),(0,106),(1,106),(10,106),(12,106),(13,106),(14,106),(15,106),(16,106),(17,106),(25,106),(26,106),(27,106),(28,106),(29,106),(30,106),(51,106),(52,106),(56,106),(60,106),(61,106),(62,106),(77,106),(78,106),(79,106),(101,106),(103,106),(104,106),(105,106),(106,106),(114,106),(115,106),(116,106),(117,106),(118,106),(119,106),(0,107),(1,107),(2,107),(3,107),(4,107),(5,107),(8,107),(9,107),(10,107),(11,107),(12,107),(13,107),(14,107),(15,107),(16,107),(17,107),(25,107),(26,107),(27,107),(28,107),(29,107),(30,107),(32,107),(33,107),(34,107),(47,107),(48,107),(49,107),(56,107),(57,107),(58,107),(77,107),(78,107),(79,107),(114,107),(115,107),(116,107),(117,107),(118,107),(119,107),(0,108),(1,108),(2,108),(3,108),(4,108),(5,108),(6,108),(7,108),(8,108),(9,108),(10,108),(11,108),(12,108),(13,108),(14,108),(19,108),(20,108),(21,108),(25,108),(26,108),(27,108),(28,108),(32,108),(33,108),(34,108),(59,108),(60,108),(61,108),(62,108),(77,108),(78,108),(79,108),(114,108),(115,108),(0,109),(1,109),(2,109),(6,109),(7,109),(10,109),(11,109),(12,109),(13,109),(14,109),(19,109),(20,109),(21,109),(25,109),(26,109),(27,109),(28,109),(59,109),(60,109),(61,109),(62,109)}
location.buildings = {(0,0),(1,0),(4,0),(5,0),(9,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(26,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(41,0),(42,0),(43,0),(44,0),(45,0),(46,0),(47,0),(48,0),(49,0),(50,0),(51,0),(52,0),(53,0),(54,0),(55,0),(56,0),(57,0),(58,0),(59,0),(60,0),(61,0),(62,0),(63,0),(64,0),(65,0),(66,0),(69,0),(70,0),(71,0),(73,0),(74,0),(75,0),(76,0),(77,0),(78,0),(84,0),(87,0),(88,0),(89,0),(90,0),(91,0),(97,0),(98,0),(99,0),(100,0),(101,0),(102,0),(103,0),(104,0),(105,0),(106,0),(107,0),(108,0),(109,0),(110,0),(111,0),(112,0),(113,0),(114,0),(115,0),(116,0),(117,0),(118,0),(119,0),(0,1),(1,1),(4,1),(5,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(36,1),(38,1),(39,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(50,1),(51,1),(52,1),(53,1),(54,1),(55,1),(56,1),(57,1),(58,1),(59,1),(61,1),(62,1),(63,1),(64,1),(66,1),(70,1),(71,1),(72,1),(73,1),(74,1),(75,1),(77,1),(78,1),(84,1),(86,1),(87,1),(88,1),(89,1),(90,1),(91,1),(97,1),(98,1),(99,1),(100,1),(101,1),(102,1),(103,1),(104,1),(105,1),(106,1),(107,1),(108,1),(109,1),(110,1),(111,1),(112,1),(113,1),(114,1),(115,1),(116,1),(117,1),(118,1),(119,1),(2,2),(8,2),(9,2),(10,2),(11,2),(12,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(40,2),(41,2),(42,2),(43,2),(44,2),(45,2),(46,2),(47,2),(48,2),(49,2),(50,2),(51,2),(52,2),(53,2),(54,2),(55,2),(56,2),(57,2),(61,2),(62,2),(63,2),(64,2),(66,2),(70,2),(71,2),(72,2),(73,2),(74,2),(75,2),(77,2),(78,2),(84,2),(86,2),(87,2),(88,2),(89,2),(90,2),(91,2),(97,2),(98,2),(99,2),(100,2),(104,2),(105,2),(106,2),(107,2),(108,2),(109,2),(110,2),(111,2),(112,2),(113,2),(114,2),(115,2),(116,2),(117,2),(118,2),(119,2),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(8,3),(9,3),(10,3),(11,3),(12,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(40,3),(41,3),(42,3),(43,3),(49,3),(52,3),(55,3),(56,3),(57,3),(60,3),(61,3),(62,3),(63,3),(64,3),(66,3),(67,3),(69,3),(70,3),(71,3),(72,3),(73,3),(74,3),(75,3),(76,3),(77,3),(78,3),(84,3),(86,3),(87,3),(89,3),(91,3),(97,3),(98,3),(99,3),(100,3),(102,3),(104,3),(105,3),(106,3),(107,3),(108,3),(109,3),(110,3),(111,3),(112,3),(113,3),(114,3),(115,3),(116,3),(117,3),(118,3),(119,3),(2,4),(3,4),(4,4),(5,4),(6,4),(7,4),(8,4),(9,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(49,4),(52,4),(53,4),(54,4),(55,4),(56,4),(57,4),(58,4),(59,4),(60,4),(61,4),(62,4),(63,4),(64,4),(65,4),(66,4),(67,4),(68,4),(69,4),(70,4),(71,4),(72,4),(73,4),(74,4),(75,4),(76,4),(77,4),(78,4),(84,4),(86,4),(87,4),(91,4),(97,4),(99,4),(100,4),(101,4),(102,4),(103,4),(104,4),(105,4),(106,4),(107,4),(108,4),(109,4),(110,4),(111,4),(112,4),(113,4),(114,4),(115,4),(116,4),(117,4),(118,4),(119,4),(2,5),(3,5),(4,5),(5,5),(6,5),(7,5),(8,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(18,5),(19,5),(20,5),(21,5),(22,5),(23,5),(24,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(48,5),(49,5),(50,5),(51,5),(52,5),(53,5),(54,5),(55,5),(56,5),(57,5),(58,5),(59,5),(60,5),(61,5),(62,5),(63,5),(64,5),(65,5),(66,5),(67,5),(68,5),(69,5),(70,5),(71,5),(72,5),(73,5),(74,5),(75,5),(77,5),(78,5),(84,5),(86,5),(91,5),(97,5),(99,5),(100,5),(101,5),(102,5),(103,5),(104,5),(105,5),(106,5),(107,5),(108,5),(109,5),(110,5),(111,5),(112,5),(113,5),(114,5),(115,5),(116,5),(117,5),(118,5),(119,5),(2,6),(3,6),(4,6),(5,6),(6,6),(7,6),(8,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(21,6),(22,6),(23,6),(24,6),(25,6),(26,6),(27,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(34,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(42,6),(43,6),(44,6),(45,6),(46,6),(47,6),(48,6),(49,6),(50,6),(51,6),(52,6),(53,6),(54,6),(55,6),(56,6),(57,6),(58,6),(59,6),(60,6),(61,6),(62,6),(63,6),(64,6),(65,6),(66,6),(67,6),(68,6),(69,6),(70,6),(71,6),(72,6),(73,6),(74,6),(75,6),(76,6),(77,6),(78,6),(84,6),(85,6),(86,6),(91,6),(97,6),(99,6),(100,6),(101,6),(102,6),(103,6),(104,6),(105,6),(106,6),(107,6),(108,6),(109,6),(110,6),(111,6),(112,6),(113,6),(114,6),(115,6),(116,6),(117,6),(118,6),(119,6),(0,7),(1,7),(2,7),(3,7),(4,7),(5,7),(6,7),(7,7),(8,7),(9,7),(10,7),(11,7),(12,7),(13,7),(14,7),(15,7),(16,7),(17,7),(18,7),(19,7),(20,7),(21,7),(22,7),(23,7),(24,7),(25,7),(26,7),(27,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(34,7),(35,7),(36,7),(37,7),(38,7),(39,7),(40,7),(41,7),(42,7),(43,7),(44,7),(45,7),(46,7),(47,7),(48,7),(49,7),(50,7),(51,7),(52,7),(53,7),(54,7),(55,7),(56,7),(57,7),(58,7),(59,7),(60,7),(61,7),(62,7),(78,7),(84,7),(85,7),(86,7),(91,7),(97,7),(99,7),(100,7),(101,7),(102,7),(103,7),(104,7),(105,7),(106,7),(107,7),(108,7),(109,7),(110,7),(111,7),(112,7),(113,7),(114,7),(115,7),(116,7),(117,7),(118,7),(119,7),(0,8),(1,8),(2,8),(3,8),(4,8),(5,8),(6,8),(7,8),(8,8),(9,8),(10,8),(11,8),(12,8),(13,8),(14,8),(15,8),(16,8),(17,8),(22,8),(23,8),(24,8),(25,8),(26,8),(27,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(34,8),(35,8),(36,8),(37,8),(38,8),(39,8),(40,8),(41,8),(42,8),(43,8),(44,8),(45,8),(46,8),(47,8),(48,8),(49,8),(50,8),(51,8),(52,8),(53,8),(54,8),(55,8),(56,8),(57,8),(58,8),(60,8),(61,8),(62,8),(63,8),(64,8),(65,8),(66,8),(67,8),(68,8),(69,8),(70,8),(71,8),(72,8),(73,8),(74,8),(75,8),(76,8),(77,8),(85,8),(86,8),(92,8),(97,8),(99,8),(100,8),(101,8),(102,8),(103,8),(104,8),(105,8),(106,8),(107,8),(108,8),(109,8),(110,8),(111,8),(112,8),(113,8),(114,8),(115,8),(116,8),(117,8),(118,8),(119,8),(0,9),(1,9),(2,9),(3,9),(4,9),(5,9),(6,9),(7,9),(8,9),(9,9),(10,9),(28,9),(29,9),(30,9),(31,9),(32,9),(85,9),(86,9),(92,9),(96,9),(100,9),(101,9),(102,9),(103,9),(104,9),(105,9),(106,9),(107,9),(108,9),(109,9),(110,9),(111,9),(112,9),(113,9),(114,9),(115,9),(116,9),(117,9),(118,9),(119,9),(0,10),(1,10),(2,10),(3,10),(4,10),(5,10),(6,10),(7,10),(8,10),(9,10),(10,10),(70,10),(71,10),(72,10),(85,10),(86,10),(92,10),(96,10),(100,10),(101,10),(102,10),(103,10),(104,10),(105,10),(106,10),(107,10),(108,10),(109,10),(110,10),(111,10),(112,10),(113,10),(114,10),(115,10),(116,10),(117,10),(118,10),(119,10),(0,11),(1,11),(2,11),(3,11),(4,11),(5,11),(6,11),(7,11),(8,11),(9,11),(10,11),(11,11),(23,11),(24,11),(27,11),(70,11),(71,11),(72,11),(74,11),(85,11),(92,11),(93,11),(94,11),(95,11),(96,11),(100,11),(101,11),(102,11),(103,11),(104,11),(105,11),(106,11),(107,11),(108,11),(109,11),(110,11),(111,11),(112,11),(113,11),(114,11),(115,11),(116,11),(117,11),(118,11),(119,11),(0,12),(1,12),(2,12),(3,12),(4,12),(5,12),(6,12),(7,12),(8,12),(9,12),(11,12),(27,12),(29,12),(36,12),(37,12),(38,12),(39,12),(40,12),(41,12),(42,12),(85,12),(92,12),(96,12),(100,12),(101,12),(102,12),(103,12),(104,12),(105,12),(106,12),(107,12),(108,12),(109,12),(110,12),(111,12),(112,12),(113,12),(114,12),(115,12),(116,12),(117,12),(118,12),(119,12),(0,13),(1,13),(2,13),(3,13),(4,13),(5,13),(6,13),(7,13),(11,13),(14,13),(15,13),(17,13),(18,13),(19,13),(20,13),(21,13),(22,13),(23,13),(24,13),(27,13),(35,13),(43,13),(46,13),(47,13),(85,13),(92,13),(96,13),(100,13),(101,13),(102,13),(103,13),(104,13),(105,13),(106,13),(107,13),(108,13),(109,13),(110,13),(111,13),(112,13),(113,13),(114,13),(115,13),(116,13),(117,13),(118,13),(119,13),(0,14),(1,14),(2,14),(3,14),(4,14),(5,14),(11,14),(27,14),(35,14),(43,14),(46,14),(47,14),(58,14),(59,14),(60,14),(61,14),(62,14),(63,14),(64,14),(65,14),(66,14),(67,14),(68,14),(85,14),(92,14),(96,14),(101,14),(102,14),(103,14),(104,14),(105,14),(106,14),(107,14),(108,14),(109,14),(110,14),(111,14),(112,14),(113,14),(114,14),(115,14),(116,14),(117,14),(118,14),(119,14),(0,15),(1,15),(2,15),(3,15),(4,15),(35,15),(43,15),(58,15),(59,15),(60,15),(61,15),(62,15),(63,15),(64,15),(65,15),(66,15),(67,15),(68,15),(83,15),(84,15),(85,15),(87,15),(91,15),(92,15),(96,15),(103,15),(104,15),(105,15),(107,15),(108,15),(109,15),(110,15),(111,15),(112,15),(113,15),(114,15),(115,15),(116,15),(117,15),(118,15),(119,15),(0,16),(1,16),(2,16),(3,16),(4,16),(35,16),(43,16),(51,16),(52,16),(53,16),(58,16),(65,16),(66,16),(67,16),(68,16),(72,16),(75,16),(83,16),(84,16),(85,16),(90,16),(91,16),(96,16),(102,16),(103,16),(104,16),(105,16),(106,16),(107,16),(108,16),(109,16),(110,16),(111,16),(112,16),(113,16),(114,16),(115,16),(116,16),(117,16),(118,16),(119,16),(0,17),(1,17),(2,17),(3,17),(4,17),(7,17),(8,17),(35,17),(43,17),(47,17),(48,17),(49,17),(50,17),(51,17),(52,17),(53,17),(54,17),(55,17),(56,17),(57,17),(58,17),(59,17),(67,17),(68,17),(75,17),(81,17),(83,17),(84,17),(85,17),(90,17),(96,17),(102,17),(103,17),(104,17),(105,17),(106,17),(107,17),(108,17),(109,17),(110,17),(111,17),(112,17),(113,17),(114,17),(115,17),(116,17),(117,17),(118,17),(119,17),(0,18),(1,18),(2,18),(3,18),(4,18),(7,18),(8,18),(36,18),(37,18),(38,18),(40,18),(41,18),(42,18),(47,18),(48,18),(49,18),(50,18),(51,18),(52,18),(53,18),(54,18),(55,18),(56,18),(57,18),(58,18),(66,18),(67,18),(68,18),(83,18),(84,18),(85,18),(89,18),(90,18),(95,18),(101,18),(102,18),(103,18),(104,18),(105,18),(106,18),(107,18),(108,18),(109,18),(110,18),(111,18),(112,18),(113,18),(114,18),(115,18),(116,18),(117,18),(118,18),(119,18),(0,19),(1,19),(2,19),(3,19),(4,19),(47,19),(48,19),(49,19),(50,19),(51,19),(52,19),(53,19),(54,19),(55,19),(56,19),(57,19),(58,19),(59,19),(60,19),(61,19),(64,19),(65,19),(66,19),(67,19),(68,19),(83,19),(84,19),(89,19),(95,19),(101,19),(102,19),(103,19),(104,19),(105,19),(106,19),(107,19),(108,19),(109,19),(110,19),(111,19),(112,19),(113,19),(114,19),(115,19),(116,19),(117,19),(118,19),(119,19),(0,20),(1,20),(2,20),(3,20),(4,20),(47,20),(48,20),(49,20),(50,20),(51,20),(54,20),(55,20),(56,20),(57,20),(58,20),(66,20),(67,20),(83,20),(89,20),(94,20),(101,20),(102,20),(103,20),(104,20),(105,20),(106,20),(107,20),(108,20),(109,20),(110,20),(111,20),(112,20),(113,20),(114,20),(119,20),(0,21),(1,21),(2,21),(3,21),(4,21),(25,21),(26,21),(27,21),(47,21),(81,21),(83,21),(89,21),(94,21),(101,21),(102,21),(103,21),(104,21),(105,21),(106,21),(107,21),(108,21),(109,21),(110,21),(111,21),(112,21),(113,21),(114,21),(115,21),(116,21),(117,21),(118,21),(119,21),(0,22),(1,22),(2,22),(3,22),(4,22),(83,22),(89,22),(93,22),(101,22),(102,22),(103,22),(104,22),(105,22),(106,22),(107,22),(108,22),(109,22),(110,22),(111,22),(112,22),(113,22),(114,22),(115,22),(116,22),(117,22),(118,22),(119,22),(0,23),(1,23),(2,23),(3,23),(4,23),(83,23),(89,23),(93,23),(101,23),(102,23),(103,23),(105,23),(106,23),(107,23),(108,23),(109,23),(110,23),(111,23),(112,23),(113,23),(114,23),(115,23),(116,23),(117,23),(118,23),(119,23),(0,24),(1,24),(2,24),(3,24),(4,24),(57,24),(79,24),(83,24),(89,24),(93,24),(102,24),(103,24),(105,24),(106,24),(107,24),(108,24),(109,24),(110,24),(111,24),(112,24),(113,24),(114,24),(115,24),(116,24),(117,24),(118,24),(119,24),(0,25),(1,25),(2,25),(3,25),(4,25),(24,25),(25,25),(26,25),(27,25),(28,25),(83,25),(89,25),(93,25),(101,25),(102,25),(103,25),(104,25),(105,25),(106,25),(107,25),(108,25),(109,25),(110,25),(111,25),(112,25),(113,25),(114,25),(115,25),(116,25),(117,25),(118,25),(119,25),(0,26),(1,26),(2,26),(3,26),(4,26),(20,26),(24,26),(25,26),(27,26),(28,26),(33,26),(76,26),(83,26),(89,26),(93,26),(101,26),(102,26),(103,26),(104,26),(105,26),(106,26),(107,26),(108,26),(109,26),(110,26),(111,26),(112,26),(113,26),(114,26),(115,26),(116,26),(117,26),(118,26),(119,26),(0,27),(1,27),(2,27),(3,27),(4,27),(14,27),(20,27),(24,27),(25,27),(26,27),(27,27),(28,27),(33,27),(83,27),(89,27),(93,27),(101,27),(104,27),(105,27),(106,27),(107,27),(108,27),(109,27),(110,27),(111,27),(112,27),(113,27),(114,27),(115,27),(116,27),(117,27),(118,27),(119,27),(0,28),(1,28),(2,28),(3,28),(4,28),(5,28),(6,28),(24,28),(25,28),(26,28),(27,28),(28,28),(83,28),(88,28),(89,28),(93,28),(100,28),(101,28),(104,28),(105,28),(106,28),(107,28),(108,28),(109,28),(110,28),(111,28),(112,28),(113,28),(114,28),(115,28),(116,28),(117,28),(118,28),(119,28),(0,29),(1,29),(2,29),(3,29),(4,29),(5,29),(6,29),(81,29),(82,29),(83,29),(87,29),(88,29),(93,29),(100,29),(104,29),(105,29),(106,29),(107,29),(108,29),(109,29),(110,29),(111,29),(112,29),(113,29),(114,29),(115,29),(116,29),(117,29),(118,29),(119,29),(0,30),(1,30),(2,30),(3,30),(4,30),(5,30),(6,30),(79,30),(80,30),(81,30),(82,30),(83,30),(87,30),(93,30),(100,30),(104,30),(105,30),(106,30),(107,30),(108,30),(109,30),(110,30),(111,30),(112,30),(113,30),(114,30),(115,30),(116,30),(117,30),(118,30),(119,30),(0,31),(1,31),(2,31),(3,31),(4,31),(5,31),(6,31),(7,31),(8,31),(47,31),(48,31),(73,31),(76,31),(77,31),(78,31),(79,31),(80,31),(81,31),(82,31),(83,31),(87,31),(92,31),(100,31),(101,31),(104,31),(105,31),(106,31),(107,31),(108,31),(109,31),(110,31),(111,31),(112,31),(113,31),(114,31),(115,31),(116,31),(117,31),(118,31),(119,31),(0,32),(1,32),(2,32),(3,32),(4,32),(5,32),(6,32),(7,32),(8,32),(45,32),(47,32),(48,32),(72,32),(73,32),(76,32),(77,32),(78,32),(79,32),(80,32),(81,32),(82,32),(83,32),(86,32),(87,32),(92,32),(100,32),(101,32),(102,32),(103,32),(104,32),(105,32),(106,32),(107,32),(108,32),(109,32),(110,32),(111,32),(112,32),(113,32),(114,32),(115,32),(116,32),(117,32),(118,32),(119,32),(0,33),(1,33),(2,33),(3,33),(4,33),(5,33),(6,33),(7,33),(8,33),(9,33),(71,33),(72,33),(73,33),(76,33),(77,33),(78,33),(79,33),(80,33),(81,33),(85,33),(86,33),(92,33),(100,33),(101,33),(102,33),(103,33),(104,33),(105,33),(106,33),(107,33),(108,33),(109,33),(110,33),(111,33),(112,33),(113,33),(114,33),(115,33),(116,33),(117,33),(118,33),(119,33),(0,34),(1,34),(2,34),(3,34),(4,34),(5,34),(6,34),(7,34),(8,34),(9,34),(10,34),(70,34),(71,34),(72,34),(73,34),(76,34),(77,34),(78,34),(79,34),(83,34),(84,34),(85,34),(92,34),(100,34),(101,34),(102,34),(103,34),(104,34),(105,34),(106,34),(107,34),(108,34),(110,34),(111,34),(112,34),(116,34),(117,34),(118,34),(119,34),(0,35),(1,35),(2,35),(3,35),(4,35),(5,35),(6,35),(7,35),(8,35),(9,35),(10,35),(66,35),(67,35),(68,35),(69,35),(70,35),(71,35),(72,35),(73,35),(76,35),(77,35),(81,35),(82,35),(83,35),(92,35),(100,35),(101,35),(102,35),(103,35),(104,35),(105,35),(106,35),(107,35),(108,35),(109,35),(110,35),(111,35),(112,35),(119,35),(0,36),(1,36),(2,36),(3,36),(4,36),(5,36),(6,36),(7,36),(8,36),(9,36),(10,36),(66,36),(67,36),(68,36),(69,36),(70,36),(71,36),(79,36),(80,36),(81,36),(91,36),(100,36),(101,36),(102,36),(103,36),(104,36),(105,36),(106,36),(107,36),(108,36),(109,36),(110,36),(111,36),(112,36),(113,36),(114,36),(115,36),(117,36),(118,36),(119,36),(0,37),(1,37),(2,37),(4,37),(5,37),(6,37),(7,37),(8,37),(9,37),(10,37),(32,37),(33,37),(34,37),(66,37),(67,37),(68,37),(69,37),(70,37),(78,37),(79,37),(90,37),(100,37),(101,37),(102,37),(103,37),(104,37),(105,37),(106,37),(107,37),(108,37),(109,37),(110,37),(111,37),(112,37),(113,37),(114,37),(115,37),(116,37),(117,37),(118,37),(119,37),(0,38),(1,38),(2,38),(3,38),(4,38),(5,38),(6,38),(7,38),(8,38),(9,38),(10,38),(32,38),(33,38),(34,38),(66,38),(67,38),(68,38),(69,38),(77,38),(78,38),(89,38),(100,38),(101,38),(102,38),(103,38),(104,38),(105,38),(106,38),(107,38),(108,38),(109,38),(110,38),(111,38),(112,38),(113,38),(114,38),(115,38),(116,38),(117,38),(118,38),(119,38),(0,39),(1,39),(2,39),(3,39),(4,39),(5,39),(6,39),(7,39),(8,39),(9,39),(10,39),(66,39),(71,39),(72,39),(73,39),(74,39),(75,39),(76,39),(77,39),(87,39),(88,39),(100,39),(101,39),(102,39),(103,39),(104,39),(105,39),(106,39),(107,39),(108,39),(109,39),(110,39),(111,39),(112,39),(113,39),(114,39),(115,39),(116,39),(117,39),(118,39),(119,39),(1,40),(5,40),(6,40),(7,40),(8,40),(9,40),(10,40),(11,40),(12,40),(13,40),(14,40),(25,40),(26,40),(27,40),(28,40),(29,40),(30,40),(31,40),(32,40),(33,40),(34,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(66,40),(69,40),(70,40),(71,40),(85,40),(86,40),(102,40),(103,40),(104,40),(105,40),(106,40),(107,40),(108,40),(109,40),(110,40),(111,40),(112,40),(113,40),(114,40),(115,40),(116,40),(117,40),(118,40),(119,40),(1,41),(7,41),(8,41),(9,41),(10,41),(11,41),(12,41),(14,41),(15,41),(22,41),(23,41),(24,41),(26,41),(28,41),(32,41),(33,41),(34,41),(35,41),(36,41),(39,41),(40,41),(41,41),(42,41),(43,41),(45,41),(46,41),(47,41),(50,41),(51,41),(52,41),(66,41),(68,41),(69,41),(83,41),(84,41),(103,41),(108,41),(111,41),(114,41),(115,41),(116,41),(119,41),(4,42),(5,42),(6,42),(7,42),(8,42),(9,42),(10,42),(11,42),(12,42),(13,42),(14,42),(15,42),(16,42),(21,42),(22,42),(23,42),(24,42),(25,42),(26,42),(27,42),(28,42),(29,42),(30,42),(31,42),(32,42),(33,42),(34,42),(35,42),(36,42),(37,42),(38,42),(39,42),(40,42),(41,42),(42,42),(43,42),(44,42),(45,42),(46,42),(47,42),(49,42),(50,42),(66,42),(68,42),(81,42),(82,42),(103,42),(111,42),(112,42),(114,42),(115,42),(117,42),(118,42),(119,42),(1,43),(4,43),(5,43),(6,43),(7,43),(8,43),(9,43),(10,43),(14,43),(15,43),(16,43),(17,43),(18,43),(19,43),(21,43),(22,43),(23,43),(24,43),(25,43),(26,43),(27,43),(28,43),(29,43),(30,43),(31,43),(32,43),(33,43),(34,43),(35,43),(36,43),(37,43),(38,43),(39,43),(40,43),(41,43),(42,43),(43,43),(44,43),(45,43),(46,43),(47,43),(49,43),(50,43),(66,43),(68,43),(76,43),(77,43),(78,43),(79,43),(80,43),(103,43),(111,43),(112,43),(113,43),(117,43),(118,43),(119,43),(4,44),(5,44),(7,44),(8,44),(9,44),(10,44),(12,44),(14,44),(15,44),(16,44),(17,44),(18,44),(19,44),(21,44),(22,44),(23,44),(24,44),(25,44),(26,44),(27,44),(28,44),(29,44),(30,44),(31,44),(32,44),(33,44),(34,44),(35,44),(36,44),(37,44),(38,44),(39,44),(40,44),(41,44),(42,44),(43,44),(44,44),(45,44),(46,44),(47,44),(49,44),(50,44),(66,44),(68,44),(75,44),(111,44),(112,44),(117,44),(118,44),(119,44),(0,45),(5,45),(6,45),(7,45),(8,45),(9,45),(10,45),(11,45),(12,45),(13,45),(14,45),(15,45),(16,45),(17,45),(18,45),(19,45),(21,45),(22,45),(23,45),(24,45),(25,45),(26,45),(27,45),(28,45),(29,45),(30,45),(31,45),(32,45),(33,45),(34,45),(35,45),(36,45),(37,45),(38,45),(39,45),(40,45),(41,45),(42,45),(43,45),(44,45),(45,45),(46,45),(47,45),(49,45),(50,45),(66,45),(68,45),(74,45),(91,45),(92,45),(93,45),(94,45),(95,45),(96,45),(97,45),(98,45),(99,45),(100,45),(111,45),(112,45),(113,45),(117,45),(118,45),(119,45),(6,46),(7,46),(8,46),(9,46),(10,46),(11,46),(12,46),(13,46),(14,46),(15,46),(16,46),(17,46),(18,46),(19,46),(21,46),(22,46),(23,46),(24,46),(25,46),(26,46),(27,46),(28,46),(29,46),(30,46),(31,46),(32,46),(33,46),(34,46),(35,46),(36,46),(37,46),(38,46),(39,46),(40,46),(41,46),(42,46),(43,46),(44,46),(45,46),(46,46),(47,46),(49,46),(50,46),(66,46),(68,46),(74,46),(91,46),(92,46),(93,46),(94,46),(95,46),(96,46),(97,46),(98,46),(99,46),(100,46),(102,46),(103,46),(104,46),(105,46),(106,46),(107,46),(108,46),(109,46),(110,46),(111,46),(112,46),(113,46),(114,46),(117,46),(118,46),(119,46),(0,47),(1,47),(2,47),(3,47),(4,47),(5,47),(6,47),(7,47),(8,47),(9,47),(10,47),(11,47),(12,47),(13,47),(14,47),(15,47),(16,47),(17,47),(18,47),(19,47),(22,47),(23,47),(24,47),(25,47),(26,47),(27,47),(28,47),(29,47),(30,47),(31,47),(32,47),(33,47),(34,47),(35,47),(36,47),(37,47),(38,47),(39,47),(40,47),(41,47),(42,47),(43,47),(44,47),(45,47),(46,47),(47,47),(49,47),(50,47),(66,47),(68,47),(74,47),(91,47),(92,47),(93,47),(94,47),(95,47),(96,47),(97,47),(98,47),(99,47),(100,47),(101,47),(102,47),(103,47),(104,47),(105,47),(106,47),(107,47),(108,47),(109,47),(110,47),(111,47),(112,47),(113,47),(114,47),(115,47),(116,47),(117,47),(118,47),(119,47),(0,48),(1,48),(2,48),(3,48),(4,48),(5,48),(6,48),(7,48),(8,48),(9,48),(10,48),(11,48),(12,48),(13,48),(14,48),(15,48),(16,48),(17,48),(18,48),(19,48),(35,48),(36,48),(37,48),(38,48),(39,48),(40,48),(41,48),(42,48),(49,48),(50,48),(51,48),(52,48),(54,48),(55,48),(56,48),(57,48),(58,48),(59,48),(63,48),(64,48),(66,48),(68,48),(74,48),(75,48),(84,48),(85,48),(86,48),(87,48),(91,48),(92,48),(93,48),(94,48),(95,48),(96,48),(97,48),(98,48),(99,48),(100,48),(102,48),(103,48),(104,48),(105,48),(106,48),(107,48),(108,48),(109,48),(110,48),(111,48),(112,48),(113,48),(114,48),(115,48),(116,48),(118,48),(119,48),(0,49),(1,49),(2,49),(3,49),(4,49),(5,49),(6,49),(7,49),(8,49),(9,49),(10,49),(11,49),(12,49),(13,49),(14,49),(15,49),(16,49),(17,49),(18,49),(49,49),(50,49),(51,49),(52,49),(53,49),(54,49),(55,49),(56,49),(57,49),(58,49),(59,49),(60,49),(61,49),(62,49),(63,49),(64,49),(65,49),(66,49),(68,49),(75,49),(76,49),(84,49),(85,49),(86,49),(87,49),(91,49),(92,49),(93,49),(94,49),(95,49),(96,49),(97,49),(98,49),(99,49),(100,49),(102,49),(103,49),(104,49),(105,49),(106,49),(107,49),(108,49),(109,49),(110,49),(111,49),(112,49),(113,49),(114,49),(115,49),(116,49),(117,49),(0,50),(1,50),(2,50),(3,50),(4,50),(5,50),(6,50),(7,50),(8,50),(9,50),(10,50),(11,50),(12,50),(13,50),(14,50),(15,50),(16,50),(35,50),(36,50),(37,50),(38,50),(39,50),(40,50),(41,50),(42,50),(43,50),(44,50),(45,50),(46,50),(47,50),(49,50),(50,50),(51,50),(52,50),(53,50),(54,50),(55,50),(56,50),(57,50),(58,50),(59,50),(60,50),(61,50),(62,50),(63,50),(64,50),(65,50),(66,50),(69,50),(76,50),(77,50),(91,50),(92,50),(93,50),(94,50),(95,50),(96,50),(97,50),(98,50),(99,50),(100,50),(102,50),(103,50),(104,50),(105,50),(106,50),(107,50),(108,50),(109,50),(110,50),(111,50),(115,50),(116,50),(117,50),(0,51),(1,51),(2,51),(3,51),(4,51),(5,51),(6,51),(7,51),(8,51),(9,51),(10,51),(11,51),(33,51),(34,51),(35,51),(36,51),(37,51),(38,51),(39,51),(40,51),(41,51),(42,51),(43,51),(44,51),(45,51),(46,51),(47,51),(49,51),(50,51),(51,51),(52,51),(53,51),(54,51),(55,51),(57,51),(58,51),(59,51),(60,51),(61,51),(62,51),(63,51),(64,51),(65,51),(66,51),(70,51),(77,51),(90,51),(91,51),(92,51),(93,51),(94,51),(97,51),(98,51),(99,51),(100,51),(101,51),(102,51),(103,51),(104,51),(105,51),(106,51),(107,51),(108,51),(109,51),(110,51),(111,51),(115,51),(116,51),(117,51),(0,52),(1,52),(2,52),(3,52),(4,52),(5,52),(6,52),(7,52),(8,52),(9,52),(10,52),(33,52),(34,52),(35,52),(36,52),(37,52),(38,52),(39,52),(40,52),(41,52),(42,52),(43,52),(44,52),(45,52),(46,52),(47,52),(50,52),(51,52),(52,52),(53,52),(54,52),(55,52),(57,52),(58,52),(60,52),(61,52),(62,52),(63,52),(64,52),(65,52),(66,52),(70,52),(71,52),(72,52),(73,52),(74,52),(75,52),(76,52),(77,52),(90,52),(101,52),(102,52),(103,52),(104,52),(105,52),(107,52),(109,52),(111,52),(115,52),(116,52),(117,52),(119,52),(24,53),(33,53),(34,53),(35,53),(36,53),(37,53),(38,53),(39,53),(40,53),(41,53),(42,53),(43,53),(44,53),(45,53),(46,53),(47,53),(111,53),(114,53),(115,53),(116,53),(117,53),(118,53),(119,53),(30,54),(31,54),(33,54),(34,54),(35,54),(36,54),(37,54),(38,54),(39,54),(40,54),(41,54),(42,54),(43,54),(44,54),(45,54),(46,54),(47,54),(102,54),(103,54),(104,54),(105,54),(106,54),(107,54),(108,54),(109,54),(110,54),(111,54),(112,54),(113,54),(114,54),(115,54),(118,54),(119,54),(30,55),(31,55),(33,55),(34,55),(35,55),(36,55),(37,55),(38,55),(39,55),(40,55),(41,55),(42,55),(43,55),(44,55),(45,55),(46,55),(47,55),(70,55),(71,55),(72,55),(73,55),(74,55),(75,55),(76,55),(77,55),(105,55),(106,55),(107,55),(110,55),(111,55),(112,55),(113,55),(114,55),(115,55),(116,55),(0,56),(1,56),(2,56),(3,56),(4,56),(5,56),(6,56),(7,56),(8,56),(9,56),(10,56),(11,56),(12,56),(13,56),(15,56),(16,56),(33,56),(34,56),(35,56),(37,56),(38,56),(39,56),(40,56),(41,56),(42,56),(43,56),(44,56),(45,56),(46,56),(47,56),(51,56),(52,56),(53,56),(54,56),(55,56),(56,56),(57,56),(58,56),(70,56),(77,56),(110,56),(111,56),(112,56),(113,56),(114,56),(115,56),(116,56),(2,57),(3,57),(15,57),(16,57),(63,57),(70,57),(77,57),(111,57),(114,57),(115,57),(116,57),(0,58),(1,58),(2,58),(15,58),(16,58),(70,58),(77,58),(78,58),(111,58),(115,58),(116,58),(119,58),(1,59),(2,59),(15,59),(54,59),(55,59),(56,59),(57,59),(58,59),(59,59),(60,59),(61,59),(62,59),(70,59),(78,59),(79,59),(80,59),(81,59),(82,59),(111,59),(115,59),(117,59),(118,59),(1,60),(2,60),(15,60),(17,60),(18,60),(19,60),(20,60),(52,60),(54,60),(55,60),(56,60),(57,60),(58,60),(59,60),(60,60),(61,60),(62,60),(70,60),(82,60),(83,60),(111,60),(115,60),(117,60),(118,60),(1,61),(2,61),(15,61),(17,61),(18,61),(19,61),(20,61),(24,61),(54,61),(55,61),(56,61),(57,61),(58,61),(59,61),(60,61),(61,61),(62,61),(71,61),(83,61),(84,61),(111,61),(112,61),(114,61),(115,61),(0,62),(1,62),(2,62),(15,62),(17,62),(18,62),(19,62),(54,62),(55,62),(56,62),(57,62),(58,62),(59,62),(60,62),(61,62),(62,62),(63,62),(64,62),(65,62),(72,62),(84,62),(85,62),(111,62),(112,62),(113,62),(114,62),(115,62),(119,62),(1,63),(2,63),(6,63),(7,63),(15,63),(17,63),(18,63),(49,63),(52,63),(54,63),(55,63),(56,63),(57,63),(58,63),(59,63),(60,63),(61,63),(62,63),(64,63),(65,63),(73,63),(74,63),(75,63),(76,63),(85,63),(111,63),(112,63),(113,63),(114,63),(119,63),(1,64),(2,64),(6,64),(7,64),(15,64),(77,64),(85,64),(89,64),(90,64),(91,64),(92,64),(93,64),(94,64),(95,64),(96,64),(97,64),(98,64),(99,64),(100,64),(101,64),(102,64),(103,64),(104,64),(105,64),(111,64),(112,64),(113,64),(114,64),(117,64),(118,64),(119,64),(1,65),(2,65),(15,65),(78,65),(85,65),(89,65),(91,65),(96,65),(97,65),(101,65),(102,65),(105,65),(110,65),(111,65),(112,65),(113,65),(114,65),(117,65),(118,65),(119,65),(1,66),(2,66),(3,66),(4,66),(15,66),(39,66),(51,66),(52,66),(53,66),(54,66),(55,66),(65,66),(69,66),(70,66),(71,66),(72,66),(73,66),(74,66),(75,66),(76,66),(79,66),(85,66),(89,66),(90,66),(96,66),(97,66),(98,66),(100,66),(102,66),(105,66),(111,66),(112,66),(113,66),(118,66),(119,66),(0,67),(1,67),(2,67),(3,67),(4,67),(15,67),(21,67),(51,67),(52,67),(53,67),(54,67),(55,67),(69,67),(70,67),(71,67),(72,67),(73,67),(74,67),(75,67),(76,67),(80,67),(85,67),(89,67),(93,67),(94,67),(98,67),(99,67),(100,67),(102,67),(103,67),(104,67),(105,67),(111,67),(112,67),(113,67),(114,67),(117,67),(118,67),(119,67),(0,68),(2,68),(3,68),(4,68),(15,68),(16,68),(38,68),(40,68),(41,68),(42,68),(43,68),(44,68),(45,68),(46,68),(51,68),(52,68),(53,68),(54,68),(55,68),(63,68),(69,68),(70,68),(71,68),(72,68),(73,68),(74,68),(75,68),(76,68),(80,68),(85,68),(89,68),(93,68),(94,68),(98,68),(99,68),(100,68),(105,68),(111,68),(112,68),(113,68),(114,68),(115,68),(116,68),(117,68),(118,68),(119,68),(4,69),(15,69),(40,69),(41,69),(42,69),(43,69),(44,69),(45,69),(46,69),(47,69),(51,69),(53,69),(55,69),(74,69),(75,69),(79,69),(80,69),(85,69),(89,69),(94,69),(95,69),(97,69),(100,69),(111,69),(115,69),(116,69),(117,69),(118,69),(119,69),(4,70),(40,70),(41,70),(42,70),(43,70),(44,70),(45,70),(46,70),(47,70),(51,70),(52,70),(53,70),(54,70),(55,70),(78,70),(79,70),(84,70),(89,70),(90,70),(93,70),(94,70),(95,70),(96,70),(97,70),(101,70),(102,70),(103,70),(104,70),(105,70),(111,70),(115,70),(116,70),(117,70),(118,70),(119,70),(4,71),(5,71),(17,71),(18,71),(20,71),(40,71),(41,71),(42,71),(43,71),(44,71),(46,71),(53,71),(57,71),(74,71),(78,71),(83,71),(89,71),(90,71),(91,71),(92,71),(96,71),(97,71),(101,71),(102,71),(105,71),(111,71),(115,71),(116,71),(117,71),(118,71),(119,71),(4,72),(5,72),(17,72),(18,72),(62,72),(77,72),(78,72),(83,72),(89,72),(90,72),(91,72),(92,72),(96,72),(97,72),(98,72),(100,72),(101,72),(102,72),(103,72),(104,72),(105,72),(111,72),(117,72),(118,72),(119,72),(3,73),(4,73),(5,73),(16,73),(76,73),(77,73),(83,73),(89,73),(93,73),(94,73),(95,73),(98,73),(99,73),(103,73),(104,73),(105,73),(111,73),(112,73),(113,73),(117,73),(118,73),(119,73),(0,74),(1,74),(2,74),(3,74),(4,74),(75,74),(76,74),(83,74),(89,74),(90,74),(91,74),(92,74),(93,74),(94,74),(95,74),(96,74),(97,74),(98,74),(99,74),(100,74),(101,74),(102,74),(103,74),(104,74),(105,74),(111,74),(112,74),(113,74),(117,74),(118,74),(119,74),(0,75),(1,75),(2,75),(3,75),(4,75),(17,75),(27,75),(30,75),(55,75),(56,75),(57,75),(58,75),(59,75),(60,75),(61,75),(62,75),(63,75),(64,75),(65,75),(66,75),(67,75),(75,75),(83,75),(111,75),(118,75),(119,75),(3,76),(4,76),(42,76),(43,76),(44,76),(45,76),(55,76),(67,76),(73,76),(74,76),(75,76),(82,76),(112,76),(117,76),(118,76),(119,76),(0,77),(1,77),(2,77),(3,77),(4,77),(5,77),(6,77),(7,77),(8,77),(9,77),(10,77),(11,77),(12,77),(13,77),(14,77),(15,77),(17,77),(33,77),(34,77),(35,77),(42,77),(43,77),(44,77),(45,77),(55,77),(67,77),(73,77),(81,77),(91,77),(92,77),(93,77),(94,77),(95,77),(111,77),(115,77),(116,77),(117,77),(118,77),(119,77),(0,78),(1,78),(2,78),(3,78),(4,78),(5,78),(17,78),(33,78),(34,78),(35,78),(41,78),(46,78),(55,78),(66,78),(67,78),(72,78),(73,78),(80,78),(91,78),(92,78),(93,78),(94,78),(95,78),(96,78),(97,78),(98,78),(99,78),(100,78),(101,78),(102,78),(103,78),(111,78),(115,78),(116,78),(3,79),(5,79),(17,79),(41,79),(46,79),(55,79),(56,79),(71,79),(72,79),(79,79),(91,79),(92,79),(93,79),(94,79),(95,79),(102,79),(103,79),(105,79),(106,79),(107,79),(111,79),(112,79),(114,79),(115,79),(3,80),(4,80),(5,80),(7,80),(8,80),(9,80),(10,80),(11,80),(12,80),(13,80),(14,80),(17,80),(55,80),(56,80),(64,80),(65,80),(66,80),(67,80),(68,80),(71,80),(78,80),(91,80),(92,80),(93,80),(94,80),(95,80),(96,80),(97,80),(98,80),(99,80),(100,80),(101,80),(102,80),(103,80),(111,80),(112,80),(113,80),(114,80),(115,80),(3,81),(4,81),(5,81),(7,81),(8,81),(9,81),(10,81),(11,81),(12,81),(13,81),(14,81),(17,81),(55,81),(56,81),(57,81),(58,81),(59,81),(60,81),(61,81),(62,81),(63,81),(64,81),(65,81),(66,81),(67,81),(68,81),(70,81),(71,81),(77,81),(90,81),(91,81),(92,81),(93,81),(94,81),(95,81),(111,81),(112,81),(113,81),(117,81),(118,81),(119,81),(0,82),(1,82),(2,82),(3,82),(5,82),(7,82),(8,82),(9,82),(10,82),(11,82),(12,82),(13,82),(14,82),(17,82),(55,82),(56,82),(57,82),(58,82),(59,82),(60,82),(61,82),(62,82),(63,82),(64,82),(65,82),(66,82),(67,82),(68,82),(70,82),(76,82),(90,82),(91,82),(111,82),(112,82),(113,82),(114,82),(117,82),(118,82),(119,82),(0,83),(1,83),(2,83),(3,83),(5,83),(7,83),(8,83),(9,83),(10,83),(11,83),(12,83),(13,83),(14,83),(17,83),(55,83),(56,83),(57,83),(58,83),(59,83),(60,83),(61,83),(62,83),(63,83),(64,83),(65,83),(66,83),(67,83),(68,83),(70,83),(76,83),(111,83),(112,83),(113,83),(114,83),(117,83),(118,83),(119,83),(0,84),(1,84),(2,84),(3,84),(5,84),(7,84),(8,84),(9,84),(10,84),(11,84),(12,84),(13,84),(14,84),(17,84),(19,84),(20,84),(21,84),(22,84),(23,84),(24,84),(25,84),(26,84),(39,84),(56,84),(57,84),(58,84),(59,84),(60,84),(61,84),(62,84),(63,84),(64,84),(65,84),(66,84),(67,84),(68,84),(70,84),(76,84),(96,84),(97,84),(98,84),(99,84),(100,84),(101,84),(102,84),(103,84),(104,84),(105,84),(106,84),(107,84),(108,84),(111,84),(112,84),(113,84),(114,84),(118,84),(119,84),(0,85),(1,85),(2,85),(3,85),(4,85),(5,85),(7,85),(8,85),(9,85),(10,85),(11,85),(12,85),(13,85),(14,85),(17,85),(19,85),(20,85),(21,85),(22,85),(23,85),(24,85),(25,85),(26,85),(39,85),(42,85),(56,85),(57,85),(58,85),(59,85),(60,85),(61,85),(62,85),(63,85),(64,85),(65,85),(66,85),(67,85),(68,85),(70,85),(76,85),(85,85),(86,85),(96,85),(99,85),(100,85),(101,85),(102,85),(103,85),(104,85),(105,85),(106,85),(107,85),(108,85),(111,85),(118,85),(119,85),(0,86),(1,86),(2,86),(3,86),(4,86),(5,86),(11,86),(13,86),(14,86),(17,86),(19,86),(20,86),(21,86),(22,86),(23,86),(24,86),(25,86),(26,86),(39,86),(47,86),(51,86),(53,86),(56,86),(57,86),(60,86),(62,86),(63,86),(64,86),(70,86),(76,86),(77,86),(85,86),(86,86),(96,86),(99,86),(100,86),(101,86),(102,86),(103,86),(104,86),(105,86),(106,86),(107,86),(108,86),(111,86),(115,86),(116,86),(0,87),(1,87),(2,87),(3,87),(5,87),(16,87),(17,87),(19,87),(20,87),(21,87),(22,87),(23,87),(24,87),(25,87),(26,87),(39,87),(53,87),(60,87),(61,87),(62,87),(63,87),(64,87),(67,87),(68,87),(70,87),(71,87),(77,87),(78,87),(85,87),(86,87),(96,87),(99,87),(100,87),(101,87),(102,87),(103,87),(104,87),(105,87),(106,87),(107,87),(108,87),(111,87),(115,87),(116,87),(0,88),(1,88),(2,88),(3,88),(5,88),(6,88),(7,88),(8,88),(19,88),(20,88),(21,88),(22,88),(23,88),(24,88),(25,88),(26,88),(33,88),(34,88),(39,88),(53,88),(67,88),(72,88),(73,88),(78,88),(79,88),(80,88),(81,88),(96,88),(99,88),(100,88),(101,88),(102,88),(103,88),(104,88),(105,88),(106,88),(107,88),(108,88),(111,88),(112,88),(115,88),(116,88),(5,89),(17,89),(19,89),(22,89),(23,89),(24,89),(25,89),(27,89),(33,89),(34,89),(39,89),(53,89),(67,89),(74,89),(81,89),(96,89),(99,89),(100,89),(101,89),(102,89),(103,89),(105,89),(106,89),(107,89),(108,89),(111,89),(112,89),(113,89),(114,89),(115,89),(116,89),(117,89),(119,89),(42,90),(53,90),(66,90),(67,90),(69,90),(70,90),(71,90),(75,90),(81,90),(86,90),(87,90),(89,90),(96,90),(107,90),(108,90),(111,90),(112,90),(113,90),(114,90),(115,90),(116,90),(117,90),(118,90),(119,90),(53,91),(67,91),(69,91),(70,91),(71,91),(75,91),(81,91),(82,91),(86,91),(87,91),(89,91),(108,91),(111,91),(112,91),(113,91),(114,91),(115,91),(116,91),(117,91),(118,91),(119,91),(53,92),(57,92),(58,92),(59,92),(60,92),(61,92),(62,92),(63,92),(64,92),(65,92),(66,92),(67,92),(75,92),(82,92),(85,92),(86,92),(87,92),(88,92),(89,92),(94,92),(111,92),(112,92),(113,92),(118,92),(119,92),(30,93),(31,93),(32,93),(33,93),(34,93),(35,93),(36,93),(37,93),(38,93),(39,93),(51,93),(52,93),(75,93),(76,93),(77,93),(78,93),(79,93),(80,93),(81,93),(82,93),(111,93),(112,93),(113,93),(118,93),(119,93),(0,94),(1,94),(2,94),(3,94),(4,94),(5,94),(6,94),(7,94),(8,94),(9,94),(30,94),(39,94),(51,94),(52,94),(105,94),(111,94),(112,94),(118,94),(119,94),(9,95),(10,95),(11,95),(12,95),(13,95),(30,95),(34,95),(35,95),(39,95),(111,95),(112,95),(113,95),(114,95),(117,95),(13,96),(14,96),(25,96),(26,96),(30,96),(32,96),(34,96),(35,96),(39,96),(75,96),(76,96),(77,96),(78,96),(79,96),(80,96),(81,96),(82,96),(88,96),(111,96),(112,96),(115,96),(116,96),(117,96),(14,97),(15,97),(16,97),(17,97),(18,97),(19,97),(25,97),(26,97),(30,97),(31,97),(39,97),(58,97),(75,97),(82,97),(111,97),(112,97),(113,97),(114,97),(115,97),(116,97),(117,97),(118,97),(119,97),(19,98),(20,98),(30,98),(39,98),(75,98),(82,98),(92,98),(93,98),(94,98),(95,98),(96,98),(97,98),(98,98),(99,98),(100,98),(101,98),(102,98),(103,98),(104,98),(105,98),(106,98),(107,98),(108,98),(109,98),(110,98),(111,98),(112,98),(113,98),(117,98),(118,98),(119,98),(20,99),(21,99),(30,99),(31,99),(32,99),(33,99),(36,99),(37,99),(38,99),(39,99),(75,99),(82,99),(88,99),(92,99),(95,99),(96,99),(99,99),(100,99),(101,99),(102,99),(113,99),(117,99),(118,99),(119,99),(21,100),(75,100),(82,100),(92,100),(93,100),(94,100),(95,100),(96,100),(97,100),(98,100),(99,100),(113,100),(117,100),(21,101),(22,101),(23,101),(24,101),(25,101),(26,101),(27,101),(28,101),(43,101),(44,101),(52,101),(56,101),(58,101),(59,101),(60,101),(61,101),(62,101),(63,101),(64,101),(65,101),(66,101),(67,101),(68,101),(74,101),(75,101),(82,101),(92,101),(93,101),(94,101),(97,101),(98,101),(99,101),(100,101),(101,101),(102,101),(103,101),(106,101),(107,101),(108,101),(111,101),(112,101),(113,101),(117,101),(28,102),(29,102),(30,102),(31,102),(32,102),(33,102),(34,102),(35,102),(36,102),(37,102),(38,102),(43,102),(44,102),(47,102),(48,102),(49,102),(50,102),(51,102),(52,102),(55,102),(57,102),(58,102),(68,102),(69,102),(70,102),(71,102),(72,102),(73,102),(74,102),(82,102),(83,102),(92,102),(93,102),(94,102),(99,102),(100,102),(101,102),(102,102),(103,102),(104,102),(105,102),(106,102),(107,102),(108,102),(109,102),(110,102),(111,102),(116,102),(117,102),(38,103),(39,103),(40,103),(41,103),(42,103),(43,103),(44,103),(45,103),(46,103),(47,103),(51,103),(52,103),(55,103),(83,103),(84,103),(92,103),(99,103),(103,103),(104,103),(105,103),(107,103),(108,103),(109,103),(110,103),(111,103),(115,103),(116,103),(117,103),(0,104),(1,104),(2,104),(51,104),(52,104),(55,104),(77,104),(78,104),(79,104),(84,104),(85,104),(86,104),(87,104),(88,104),(89,104),(90,104),(92,104),(93,104),(94,104),(99,104),(107,104),(110,104),(111,104),(112,104),(113,104),(114,104),(118,104),(3,105),(4,105),(5,105),(6,105),(7,105),(8,105),(9,105),(10,105),(11,105),(12,105),(13,105),(14,105),(15,105),(16,105),(51,105),(52,105),(55,105),(59,105),(60,105),(61,105),(62,105),(76,105),(77,105),(78,105),(79,105),(80,105),(90,105),(91,105),(92,105),(93,105),(94,105),(95,105),(107,105),(108,105),(109,105),(119,105),(3,106),(4,106),(5,106),(6,106),(7,106),(8,106),(9,106),(11,106),(17,106),(18,106),(19,106),(20,106),(21,106),(22,106),(49,106),(50,106),(51,106),(52,106),(55,106),(57,106),(58,106),(63,106),(64,106),(65,106),(72,106),(73,106),(74,106),(75,106),(76,106),(80,106),(81,106),(91,106),(92,106),(93,106),(94,106),(95,106),(96,106),(97,106),(98,106),(99,106),(100,106),(102,106),(108,106),(109,106),(7,107),(19,107),(23,107),(24,107),(25,107),(26,107),(27,107),(28,107),(29,107),(30,107),(31,107),(32,107),(33,107),(34,107),(35,107),(36,107),(48,107),(51,107),(52,107),(55,107),(56,107),(60,107),(61,107),(62,107),(66,107),(67,107),(68,107),(69,107),(70,107),(71,107),(72,107),(73,107),(76,107),(80,107),(81,107),(82,107),(83,107),(84,107),(92,107),(93,107),(96,107),(97,107),(99,107),(101,107),(104,107),(105,107),(109,107),(14,108),(15,108),(16,108),(17,108),(23,108),(24,108),(25,108),(26,108),(27,108),(28,108),(29,108),(30,108),(31,108),(32,108),(33,108),(34,108),(35,108),(36,108),(37,108),(38,108),(39,108),(40,108),(41,108),(42,108),(43,108),(44,108),(45,108),(46,108),(47,108),(48,108),(49,108),(51,108),(56,108),(57,108),(58,108),(60,108),(61,108),(62,108),(72,108),(73,108),(76,108),(81,108),(82,108),(83,108),(84,108),(85,108),(86,108),(93,108),(94,108),(104,108),(105,108),(109,108),(110,108),(111,108),(112,108),(113,108),(116,108),(117,108),(3,109),(4,109),(5,109),(15,109),(16,109),(23,109),(24,109),(25,109),(26,109),(27,109),(28,109),(29,109),(32,109),(33,109),(34,109),(35,109),(36,109),(37,109),(38,109),(39,109),(40,109),(41,109),(42,109),(43,109),(44,109),(45,109),(46,109),(47,109),(48,109),(49,109),(51,109),(52,109),(56,109),(57,109),(58,109),(72,109),(73,109),(76,109),(81,109),(82,109),(83,109),(84,109),(85,109),(86,109),(87,109),(94,109),(104,109),(105,109),(109,109),(110,109),(111,109),(112,109),(113,109),(114,109),(115,109),(116,109),(117,109)}
if version == "1.3":
location.spawnable = {(24,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(37,0),(40,0),(41,0),(42,0),(43,0),(45,0),(46,0),(47,0),(48,0),(49,0),(50,0),(51,0),(52,0),(53,0),(54,0),(55,0),(56,0),(60,0),(64,0),(68,0),(69,0),(70,0),(74,0),(75,0),(76,0),(84,0),(86,0),(87,0),(101,0),(102,0),(104,0),(105,0),(106,0),(114,0),(115,0),(116,0),(117,0),(118,0),(119,0),(24,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(38,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(50,1),(51,1),(52,1),(53,1),(54,1),(55,1),(56,1),(58,1),(68,1),(69,1),(72,1),(74,1),(75,1),(76,1),(84,1),(87,1),(89,1),(101,1),(102,1),(104,1),(105,1),(106,1),(107,1),(109,1),(110,1),(111,1),(112,1),(115,1),(116,1),(117,1),(118,1),(119,1),(6,2),(21,2),(22,2),(27,2),(34,2),(35,2),(40,2),(47,2),(48,2),(49,2),(50,2),(51,2),(52,2),(53,2),(55,2),(56,2),(57,2),(67,2),(68,2),(69,2),(74,2),(75,2),(76,2),(84,2),(87,2),(100,2),(102,2),(104,2),(105,2),(106,2),(107,2),(109,2),(111,2),(112,2),(115,2),(116,2),(117,2),(118,2),(119,2),(3,3),(5,3),(6,3),(7,3),(11,3),(14,3),(19,3),(20,3),(21,3),(22,3),(24,3),(25,3),(26,3),(29,3),(30,3),(35,3),(37,3),(70,3),(74,3),(75,3),(76,3),(77,3),(84,3),(87,3),(100,3),(102,3),(104,3),(105,3),(106,3),(107,3),(108,3),(110,3),(111,3),(112,3),(113,3),(117,3),(118,3),(119,3),(4,4),(5,4),(6,4),(7,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(30,4),(31,4),(34,4),(35,4),(36,4),(59,4),(61,4),(68,4),(70,4),(71,4),(72,4),(73,4),(77,4),(80,4),(84,4),(87,4),(104,4),(105,4),(107,4),(109,4),(111,4),(112,4),(113,4),(114,4),(117,4),(118,4),(119,4),(1,5),(6,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(18,5),(19,5),(20,5),(21,5),(22,5),(23,5),(24,5),(25,5),(26,5),(27,5),(28,5),(30,5),(31,5),(32,5),(33,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(48,5),(53,5),(54,5),(55,5),(66,5),(70,5),(71,5),(72,5),(73,5),(75,5),(84,5),(101,5),(104,5),(105,5),(106,5),(108,5),(109,5),(114,5),(115,5),(118,5),(119,5),(0,6),(3,6),(7,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(21,6),(22,6),(23,6),(24,6),(25,6),(26,6),(27,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(34,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(50,6),(51,6),(53,6),(54,6),(55,6),(57,6),(58,6),(59,6),(65,6),(69,6),(70,6),(71,6),(72,6),(82,6),(101,6),(104,6),(105,6),(106,6),(107,6),(108,6),(109,6),(112,6),(114,6),(115,6),(1,7),(5,7),(7,7),(8,7),(9,7),(57,7),(58,7),(62,7),(64,7),(65,7),(66,7),(67,7),(71,7),(72,7),(104,7),(105,7),(106,7),(107,7),(108,7),(109,7),(114,7),(115,7),(116,7),(117,7),(118,7),(5,8),(6,8),(8,8),(9,8),(69,8),(70,8),(74,8),(75,8),(76,8),(77,8),(79,8),(84,8),(101,8),(107,8),(108,8),(109,8),(112,8),(113,8),(114,8),(115,8),(116,8),(117,8),(119,8),(1,9),(4,9),(5,9),(6,9),(7,9),(8,9),(9,9),(18,9),(19,9),(20,9),(21,9),(62,9),(64,9),(67,9),(71,9),(75,9),(76,9),(77,9),(78,9),(83,9),(84,9),(101,9),(103,9),(104,9),(105,9),(107,9),(108,9),(109,9),(110,9),(111,9),(114,9),(115,9),(116,9),(117,9),(119,9),(1,10),(3,10),(5,10),(6,10),(7,10),(8,10),(9,10),(62,10),(63,10),(64,10),(67,10),(70,10),(71,10),(72,10),(76,10),(77,10),(78,10),(82,10),(83,10),(104,10),(105,10),(107,10),(108,10),(109,10),(110,10),(111,10),(112,10),(113,10),(116,10),(117,10),(118,10),(119,10),(3,11),(4,11),(5,11),(6,11),(7,11),(8,11),(31,11),(40,11),(43,11),(45,11),(46,11),(47,11),(48,11),(49,11),(50,11),(53,11),(54,11),(55,11),(57,11),(58,11),(60,11),(61,11),(66,11),(67,11),(70,11),(71,11),(72,11),(75,11),(76,11),(77,11),(78,11),(82,11),(83,11),(84,11),(105,11),(107,11),(108,11),(110,11),(111,11),(113,11),(115,11),(117,11),(118,11),(4,12),(5,12),(12,12),(31,12),(36,12),(38,12),(39,12),(40,12),(44,12),(45,12),(46,12),(47,12),(49,12),(50,12),(51,12),(52,12),(53,12),(54,12),(55,12),(57,12),(59,12),(65,12),(66,12),(71,12),(75,12),(77,12),(82,12),(83,12),(84,12),(107,12),(108,12),(109,12),(110,12),(111,12),(112,12),(113,12),(114,12),(115,12),(116,12),(1,13),(7,13),(12,13),(29,13),(30,13),(34,13),(36,13),(37,13),(38,13),(41,13),(42,13),(45,13),(46,13),(47,13),(48,13),(49,13),(50,13),(51,13),(52,13),(53,13),(54,13),(55,13),(56,13),(57,13),(58,13),(59,13),(60,13),(69,13),(70,13),(71,13),(73,13),(74,13),(75,13),(76,13),(77,13),(82,13),(83,13),(84,13),(107,13),(108,13),(109,13),(110,13),(111,13),(112,13),(113,13),(114,13),(115,13),(116,13),(117,13),(119,13),(2,14),(5,14),(9,14),(27,14),(32,14),(34,14),(36,14),(38,14),(40,14),(41,14),(43,14),(47,14),(48,14),(49,14),(50,14),(51,14),(52,14),(53,14),(54,14),(55,14),(56,14),(57,14),(58,14),(59,14),(65,14),(66,14),(67,14),(71,14),(73,14),(75,14),(76,14),(82,14),(83,14),(107,14),(108,14),(109,14),(110,14),(111,14),(112,14),(113,14),(114,14),(115,14),(116,14),(117,14),(118,14),(119,14),(1,15),(2,15),(4,15),(8,15),(10,15),(13,15),(18,15),(20,15),(21,15),(22,15),(23,15),(24,15),(25,15),(29,15),(30,15),(31,15),(32,15),(33,15),(34,15),(37,15),(39,15),(41,15),(42,15),(43,15),(46,15),(47,15),(48,15),(49,15),(52,15),(53,15),(54,15),(55,15),(56,15),(57,15),(58,15),(70,15),(71,15),(72,15),(73,15),(74,15),(76,15),(77,15),(82,15),(83,15),(84,15),(105,15),(107,15),(108,15),(109,15),(110,15),(111,15),(112,15),(113,15),(114,15),(115,15),(116,15),(117,15),(118,15),(119,15),(4,16),(10,16),(11,16),(18,16),(19,16),(24,16),(25,16),(28,16),(31,16),(32,16),(34,16),(36,16),(37,16),(38,16),(39,16),(40,16),(41,16),(42,16),(45,16),(47,16),(48,16),(49,16),(50,16),(51,16),(52,16),(53,16),(55,16),(56,16),(57,16),(58,16),(61,16),(66,16),(70,16),(73,16),(74,16),(75,16),(76,16),(81,16),(82,16),(83,16),(103,16),(105,16),(106,16),(119,16),(3,17),(4,17),(10,17),(16,17),(17,17),(19,17),(21,17),(27,17),(32,17),(34,17),(36,17),(37,17),(38,17),(42,17),(47,17),(48,17),(49,17),(50,17),(52,17),(53,17),(55,17),(56,17),(58,17),(63,17),(70,17),(71,17),(72,17),(74,17),(75,17),(76,17),(103,17),(105,17),(106,17),(107,17),(111,17),(113,17),(114,17),(115,17),(116,17),(117,17),(4,18),(10,18),(13,18),(14,18),(15,18),(17,18),(26,18),(29,18),(30,18),(35,18),(36,18),(37,18),(39,18),(40,18),(42,18),(45,18),(47,18),(48,18),(50,18),(51,18),(58,18),(70,18),(71,18),(72,18),(73,18),(74,18),(75,18),(76,18),(77,18),(81,18),(82,18),(105,18),(106,18),(107,18),(109,18),(111,18),(112,18),(113,18),(114,18),(115,18),(116,18),(1,19),(3,19),(4,19),(7,19),(16,19),(18,19),(28,19),(29,19),(30,19),(32,19),(34,19),(36,19),(41,19),(46,19),(47,19),(48,19),(50,19),(51,19),(57,19),(59,19),(60,19),(61,19),(66,19),(70,19),(71,19),(72,19),(73,19),(74,19),(75,19),(77,19),(81,19),(82,19),(102,19),(103,19),(104,19),(107,19),(112,19),(116,19),(118,19),(1,20),(4,20),(9,20),(17,20),(18,20),(25,20),(26,20),(27,20),(28,20),(29,20),(31,20),(36,20),(37,20),(38,20),(39,20),(44,20),(45,20),(46,20),(48,20),(49,20),(50,20),(51,20),(54,20),(55,20),(59,20),(60,20),(64,20),(71,20),(72,20),(74,20),(75,20),(76,20),(77,20),(81,20),(103,20),(104,20),(105,20),(108,20),(109,20),(110,20),(111,20),(114,20),(116,20),(117,20),(118,20),(1,21),(4,21),(6,21),(14,21),(18,21),(21,21),(22,21),(23,21),(28,21),(31,21),(32,21),(33,21),(34,21),(37,21),(44,21),(45,21),(46,21),(59,21),(60,21),(61,21),(62,21),(63,21),(67,21),(69,21),(70,21),(73,21),(82,21),(103,21),(104,21),(105,21),(106,21),(109,21),(110,21),(111,21),(116,21),(118,21),(1,22),(4,22),(8,22),(17,22),(20,22),(25,22),(28,22),(29,22),(32,22),(33,22),(34,22),(37,22),(38,22),(43,22),(48,22),(49,22),(50,22),(58,22),(59,22),(61,22),(62,22),(63,22),(64,22),(67,22),(68,22),(69,22),(81,22),(82,22),(103,22),(104,22),(105,22),(106,22),(107,22),(108,22),(111,22),(112,22),(113,22),(114,22),(115,22),(1,23),(4,23),(8,23),(11,23),(12,23),(14,23),(17,23),(19,23),(22,23),(23,23),(30,23),(31,23),(33,23),(34,23),(35,23),(38,23),(39,23),(43,23),(44,23),(45,23),(46,23),(48,23),(49,23),(50,23),(57,23),(58,23),(59,23),(61,23),(62,23),(64,23),(65,23),(68,23),(69,23),(81,23),(82,23),(107,23),(108,23),(109,23),(110,23),(3,24),(4,24),(7,24),(11,24),(13,24),(14,24),(15,24),(18,24),(19,24),(21,24),(22,24),(31,24),(34,24),(35,24),(36,24),(38,24),(42,24),(44,24),(45,24),(46,24),(48,24),(54,24),(58,24),(59,24),(60,24),(62,24),(63,24),(64,24),(65,24),(74,24),(77,24),(80,24),(82,24),(105,24),(107,24),(108,24),(113,24),(114,24),(119,24),(4,25),(11,25),(17,25),(18,25),(21,25),(33,25),(34,25),(36,25),(38,25),(44,25),(45,25),(46,25),(48,25),(49,25),(50,25),(53,25),(57,25),(60,25),(61,25),(62,25),(64,25),(65,25),(66,25),(67,25),(72,25),(73,25),(74,25),(75,25),(76,25),(77,25),(78,25),(79,25),(81,25),(102,25),(107,25),(114,25),(1,26),(4,26),(8,26),(12,26),(13,26),(14,26),(16,26),(17,26),(18,26),(27,26),(34,26),(35,26),(38,26),(43,26),(45,26),(46,26),(47,26),(49,26),(50,26),(60,26),(65,26),(73,26),(74,26),(79,26),(80,26),(81,26),(82,26),(102,26),(105,26),(119,26),(6,27),(13,27),(14,27),(17,27),(18,27),(20,27),(27,27),(35,27),(36,27),(38,27),(43,27),(44,27),(46,27),(47,27),(48,27),(50,27),(51,27),(59,27),(60,27),(75,27),(76,27),(77,27),(79,27),(81,27),(82,27),(102,27),(103,27),(104,27),(118,27),(119,27),(1,28),(2,28),(6,28),(7,28),(9,28),(14,28),(16,28),(20,28),(33,28),(34,28),(39,28),(43,28),(44,28),(45,28),(46,28),(47,28),(48,28),(49,28),(50,28),(51,28),(53,28),(76,28),(79,28),(80,28),(81,28),(102,28),(103,28),(118,28),(119,28),(1,29),(4,29),(7,29),(14,29),(17,29),(18,29),(19,29),(33,29),(34,29),(35,29),(38,29),(39,29),(44,29),(45,29),(46,29),(47,29),(48,29),(49,29),(50,29),(51,29),(77,29),(78,29),(79,29),(80,29),(81,29),(101,29),(102,29),(103,29),(118,29),(119,29),(0,30),(1,30),(4,30),(6,30),(7,30),(8,30),(11,30),(14,30),(15,30),(16,30),(17,30),(31,30),(34,30),(35,30),(37,30),(38,30),(39,30),(43,30),(44,30),(45,30),(47,30),(48,30),(50,30),(51,30),(52,30),(77,30),(78,30),(79,30),(80,30),(81,30),(101,30),(102,30),(103,30),(118,30),(119,30),(8,31),(9,31),(15,31),(22,31),(35,31),(38,31),(42,31),(44,31),(47,31),(48,31),(50,31),(51,31),(70,31),(71,31),(72,31),(76,31),(77,31),(78,31),(79,31),(118,31),(119,31),(0,32),(1,32),(2,32),(4,32),(5,32),(7,32),(8,32),(9,32),(28,32),(33,32),(37,32),(41,32),(44,32),(45,32),(47,32),(48,32),(50,32),(51,32),(52,32),(55,32),(69,32),(71,32),(72,32),(73,32),(76,32),(77,32),(119,32),(0,33),(1,33),(2,33),(3,33),(5,33),(9,33),(10,33),(17,33),(21,33),(22,33),(26,33),(27,33),(28,33),(29,33),(32,33),(35,33),(36,33),(37,33),(38,33),(44,33),(46,33),(54,33),(60,33),(62,33),(70,33),(71,33),(72,33),(102,33),(119,33),(0,34),(1,34),(2,34),(3,34),(5,34),(6,34),(9,34),(10,34),(11,34),(16,34),(18,34),(21,34),(22,34),(23,34),(24,34),(26,34),(27,34),(29,34),(31,34),(32,34),(35,34),(37,34),(38,34),(45,34),(52,34),(53,34),(58,34),(64,34),(65,34),(67,34),(68,34),(69,34),(70,34),(71,34),(104,34),(105,34),(117,34),(119,34),(0,35),(1,35),(2,35),(3,35),(4,35),(6,35),(7,35),(13,35),(18,35),(20,35),(22,35),(24,35),(25,35),(26,35),(34,35),(35,35),(37,35),(42,35),(43,35),(44,35),(49,35),(57,35),(60,35),(61,35),(65,35),(66,35),(67,35),(68,35),(69,35),(70,35),(101,35),(102,35),(103,35),(104,35),(105,35),(109,35),(112,35),(113,35),(114,35),(115,35),(117,35),(119,35),(0,36),(1,36),(2,36),(3,36),(4,36),(6,36),(7,36),(11,36),(20,36),(21,36),(23,36),(24,36),(25,36),(28,36),(36,36),(44,36),(45,36),(59,36),(60,36),(63,36),(65,36),(66,36),(67,36),(101,36),(102,36),(103,36),(104,36),(105,36),(111,36),(119,36),(0,37),(1,37),(2,37),(3,37),(4,37),(7,37),(8,37),(11,37),(21,37),(23,37),(28,37),(30,37),(32,37),(33,37),(36,37),(37,37),(38,37),(39,37),(55,37),(58,37),(59,37),(61,37),(63,37),(65,37),(101,37),(102,37),(103,37),(104,37),(105,37),(106,37),(107,37),(108,37),(109,37),(110,37),(111,37),(112,37),(113,37),(114,37),(115,37),(116,37),(117,37),(118,37),(119,37),(4,38),(5,38),(7,38),(9,38),(10,38),(11,38),(12,38),(13,38),(14,38),(23,38),(29,38),(30,38),(32,38),(33,38),(34,38),(36,38),(37,38),(38,38),(39,38),(40,38),(46,38),(47,38),(51,38),(52,38),(53,38),(57,38),(59,38),(60,38),(61,38),(62,38),(63,38),(102,38),(103,38),(104,38),(105,38),(106,38),(107,38),(108,38),(109,38),(110,38),(111,38),(112,38),(113,38),(114,38),(115,38),(116,38),(117,38),(118,38),(119,38),(14,39),(15,39),(21,39),(24,39),(25,39),(26,39),(27,39),(32,39),(33,39),(34,39),(51,39),(56,39),(57,39),(58,39),(60,39),(61,39),(63,39),(65,39),(101,39),(7,40),(8,40),(12,40),(13,40),(14,40),(15,40),(16,40),(24,40),(25,40),(26,40),(27,40),(28,40),(29,40),(30,40),(31,40),(32,40),(33,40),(34,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(51,40),(53,40),(56,40),(60,40),(61,40),(62,40),(63,40),(65,40),(98,40),(102,40),(104,40),(105,40),(106,40),(107,40),(108,40),(109,40),(110,40),(111,40),(112,40),(113,40),(114,40),(115,40),(116,40),(117,40),(118,40),(119,40),(7,41),(14,41),(15,41),(16,41),(17,41),(22,41),(29,41),(30,41),(31,41),(32,41),(33,41),(34,41),(39,41),(40,41),(41,41),(42,41),(46,41),(47,41),(51,41),(53,41),(55,41),(62,41),(63,41),(65,41),(97,41),(99,41),(101,41),(102,41),(113,41),(114,41),(115,41),(116,41),(117,41),(118,41),(119,41),(7,42),(10,42),(14,42),(16,42),(17,42),(23,42),(29,42),(34,42),(39,42),(41,42),(42,42),(48,42),(49,42),(50,42),(51,42),(54,42),(55,42),(56,42),(57,42),(60,42),(61,42),(63,42),(65,42),(96,42),(97,42),(98,42),(99,42),(102,42),(103,42),(104,42),(105,42),(106,42),(107,42),(108,42),(109,42),(111,42),(113,42),(114,42),(115,42),(116,42),(117,42),(118,42),(119,42),(7,43),(12,43),(17,43),(23,43),(27,43),(31,43),(32,43),(36,43),(37,43),(38,43),(43,43),(46,43),(50,43),(51,43),(53,43),(54,43),(56,43),(58,43),(59,43),(60,43),(62,43),(63,43),(94,43),(95,43),(96,43),(97,43),(98,43),(99,43),(100,43),(103,43),(104,43),(107,43),(108,43),(109,43),(110,43),(111,43),(113,43),(114,43),(115,43),(116,43),(117,43),(118,43),(119,43),(7,44),(9,44),(10,44),(11,44),(12,44),(25,44),(26,44),(27,44),(28,44),(29,44),(30,44),(31,44),(32,44),(33,44),(34,44),(35,44),(41,44),(43,44),(51,44),(53,44),(54,44),(55,44),(56,44),(57,44),(58,44),(59,44),(62,44),(63,44),(65,44),(93,44),(102,44),(103,44),(104,44),(106,44),(109,44),(110,44),(111,44),(114,44),(115,44),(116,44),(117,44),(118,44),(119,44),(7,45),(9,45),(10,45),(14,45),(18,45),(25,45),(26,45),(27,45),(28,45),(29,45),(30,45),(31,45),(32,45),(33,45),(34,45),(35,45),(36,45),(37,45),(38,45),(39,45),(40,45),(41,45),(42,45),(43,45),(45,45),(53,45),(54,45),(55,45),(56,45),(57,45),(59,45),(60,45),(61,45),(63,45),(91,45),(102,45),(103,45),(104,45),(105,45),(106,45),(107,45),(108,45),(109,45),(110,45),(111,45),(112,45),(114,45),(115,45),(116,45),(117,45),(118,45),(119,45),(0,46),(1,46),(2,46),(3,46),(4,46),(5,46),(6,46),(9,46),(12,46),(13,46),(14,46),(15,46),(16,46),(45,46),(52,46),(53,46),(54,46),(55,46),(60,46),(61,46),(64,46),(87,46),(88,46),(94,46),(95,46),(96,46),(102,46),(106,46),(107,46),(108,46),(109,46),(110,46),(111,46),(112,46),(117,46),(118,46),(119,46),(14,47),(15,47),(16,47),(18,47),(24,47),(52,47),(53,47),(57,47),(58,47),(59,47),(61,47),(62,47),(63,47),(64,47),(85,47),(86,47),(87,47),(88,47),(90,47),(91,47),(92,47),(93,47),(94,47),(95,47),(96,47),(97,47),(98,47),(99,47),(100,47),(111,47),(117,47),(118,47),(119,47),(2,48),(3,48),(10,48),(11,48),(14,48),(15,48),(24,48),(51,48),(55,48),(56,48),(57,48),(58,48),(59,48),(82,48),(91,48),(92,48),(93,48),(94,48),(95,48),(96,48),(97,48),(98,48),(99,48),(100,48),(111,48),(112,48),(117,48),(118,48),(119,48),(0,49),(1,49),(2,49),(3,49),(4,49),(5,49),(8,49),(9,49),(14,49),(15,49),(16,49),(23,49),(27,49),(30,49),(31,49),(46,49),(51,49),(56,49),(57,49),(58,49),(59,49),(60,49),(61,49),(62,49),(64,49),(81,49),(82,49),(91,49),(92,49),(93,49),(94,49),(95,49),(96,49),(97,49),(98,49),(99,49),(100,49),(111,49),(112,49),(114,49),(115,49),(116,49),(117,49),(118,49),(119,49),(0,50),(1,50),(2,50),(3,50),(4,50),(11,50),(12,50),(13,50),(14,50),(15,50),(16,50),(23,50),(29,50),(30,50),(31,50),(33,50),(34,50),(35,50),(36,50),(37,50),(38,50),(39,50),(40,50),(41,50),(42,50),(43,50),(44,50),(45,50),(46,50),(60,50),(81,50),(82,50),(111,50),(112,50),(114,50),(115,50),(116,50),(117,50),(118,50),(119,50),(0,51),(1,51),(2,51),(3,51),(4,51),(10,51),(29,51),(30,51),(31,51),(33,51),(34,51),(35,51),(36,51),(37,51),(38,51),(39,51),(40,51),(41,51),(42,51),(43,51),(44,51),(45,51),(46,51),(62,51),(65,51),(66,51),(81,51),(82,51),(85,51),(90,51),(111,51),(112,51),(114,51),(115,51),(116,51),(117,51),(118,51),(119,51),(1,52),(3,52),(5,52),(7,52),(9,52),(13,52),(29,52),(30,52),(31,52),(33,52),(34,52),(35,52),(36,52),(37,52),(38,52),(39,52),(40,52),(41,52),(42,52),(43,52),(44,52),(45,52),(46,52),(51,52),(57,52),(62,52),(64,52),(65,52),(84,52),(111,52),(112,52),(114,52),(115,52),(116,52),(117,52),(118,52),(119,52),(31,53),(33,53),(34,53),(35,53),(36,53),(37,53),(38,53),(39,53),(40,53),(41,53),(42,53),(43,53),(44,53),(45,53),(46,53),(51,53),(57,53),(58,53),(111,53),(112,53),(114,53),(115,53),(116,53),(117,53),(118,53),(119,53),(30,54),(31,54),(35,54),(36,54),(37,54),(38,54),(39,54),(40,54),(41,54),(42,54),(43,54),(44,54),(45,54),(46,54),(103,54),(111,54),(112,54),(114,54),(115,54),(116,54),(117,54),(118,54),(119,54),(35,55),(36,55),(37,55),(38,55),(39,55),(40,55),(41,55),(42,55),(43,55),(44,55),(45,55),(46,55),(51,55),(52,55),(53,55),(54,55),(55,55),(56,55),(57,55),(83,55),(84,55),(86,55),(87,55),(105,55),(108,55),(109,55),(110,55),(111,55),(112,55),(114,55),(115,55),(116,55),(117,55),(118,55),(119,55),(0,56),(38,56),(39,56),(40,56),(41,56),(42,56),(43,56),(44,56),(45,56),(46,56),(57,56),(58,56),(84,56),(85,56),(87,56),(88,56),(104,56),(105,56),(106,56),(109,56),(110,56),(111,56),(112,56),(114,56),(115,56),(116,56),(117,56),(118,56),(119,56),(7,57),(17,57),(19,57),(20,57),(22,57),(23,57),(52,57),(53,57),(54,57),(55,57),(56,57),(57,57),(58,57),(59,57),(60,57),(61,57),(62,57),(63,57),(84,57),(85,57),(86,57),(87,57),(89,57),(100,57),(106,57),(107,57),(110,57),(112,57),(114,57),(115,57),(116,57),(117,57),(118,57),(119,57),(1,58),(3,58),(5,58),(15,58),(17,58),(19,58),(20,58),(22,58),(54,58),(55,58),(56,58),(57,58),(58,58),(59,58),(60,58),(61,58),(62,58),(63,58),(64,58),(87,58),(88,58),(89,58),(99,58),(103,58),(105,58),(107,58),(108,58),(110,58),(112,58),(114,58),(115,58),(119,58),(1,59),(4,59),(5,59),(17,59),(18,59),(19,59),(21,59),(23,59),(55,59),(56,59),(57,59),(58,59),(59,59),(60,59),(61,59),(62,59),(63,59),(64,59),(67,59),(87,59),(89,59),(95,59),(96,59),(98,59),(99,59),(106,59),(107,59),(108,59),(109,59),(112,59),(114,59),(115,59),(119,59),(0,60),(1,60),(4,60),(5,60),(7,60),(21,60),(22,60),(49,60),(51,60),(54,60),(55,60),(56,60),(57,60),(58,60),(59,60),(60,60),(61,60),(62,60),(63,60),(64,60),(88,60),(89,60),(92,60),(93,60),(96,60),(97,60),(98,60),(99,60),(101,60),(102,60),(103,60),(104,60),(105,60),(108,60),(112,60),(114,60),(115,60),(119,60),(1,61),(5,61),(7,61),(15,61),(16,61),(52,61),(56,61),(57,61),(58,61),(59,61),(60,61),(61,61),(62,61),(63,61),(64,61),(88,61),(89,61),(92,61),(95,61),(96,61),(97,61),(98,61),(99,61),(100,61),(101,61),(102,61),(103,61),(104,61),(106,61),(107,61),(112,61),(114,61),(115,61),(117,61),(118,61),(119,61),(1,62),(7,62),(15,62),(16,62),(18,62),(48,62),(49,62),(50,62),(53,62),(54,62),(56,62),(57,62),(58,62),(59,62),(60,62),(61,62),(62,62),(63,62),(64,62),(88,62),(107,62),(108,62),(110,62),(114,62),(115,62),(119,62),(1,63),(5,63),(7,63),(15,63),(16,63),(17,63),(18,63),(44,63),(45,63),(46,63),(48,63),(49,63),(50,63),(51,63),(52,63),(59,63),(60,63),(61,63),(67,63),(90,63),(91,63),(92,63),(93,63),(94,63),(95,63),(96,63),(97,63),(98,63),(99,63),(100,63),(101,63),(102,63),(103,63),(104,63),(107,63),(108,63),(110,63),(114,63),(115,63),(119,63),(1,64),(3,64),(9,64),(20,64),(40,64),(41,64),(42,64),(43,64),(44,64),(45,64),(61,64),(64,64),(68,64),(69,64),(107,64),(112,64),(114,64),(115,64),(119,64),(1,65),(3,65),(4,65),(6,65),(16,65),(17,65),(19,65),(20,65),(40,65),(41,65),(42,65),(43,65),(44,65),(45,65),(59,65),(61,65),(62,65),(64,65),(65,65),(67,65),(90,65),(94,65),(95,65),(96,65),(100,65),(101,65),(102,65),(103,65),(104,65),(107,65),(108,65),(110,65),(112,65),(114,65),(115,65),(116,65),(117,65),(118,65),(119,65),(1,66),(2,66),(3,66),(4,66),(10,66),(11,66),(16,66),(17,66),(18,66),(19,66),(40,66),(41,66),(42,66),(43,66),(44,66),(45,66),(46,66),(50,66),(52,66),(58,66),(59,66),(60,66),(62,66),(64,66),(65,66),(66,66),(69,66),(71,66),(72,66),(73,66),(74,66),(87,66),(90,66),(94,66),(95,66),(96,66),(98,66),(100,66),(101,66),(102,66),(103,66),(104,66),(107,66),(108,66),(111,66),(114,66),(115,66),(116,66),(117,66),(118,66),(119,66),(2,67),(3,67),(4,67),(6,67),(7,67),(8,67),(16,67),(17,67),(18,67),(40,67),(41,67),(42,67),(43,67),(44,67),(45,67),(46,67),(47,67),(50,67),(54,67),(59,67),(66,67),(68,67),(69,67),(71,67),(72,67),(73,67),(90,67),(94,67),(95,67),(96,67),(100,67),(101,67),(102,67),(104,67),(107,67),(108,67),(110,67),(111,67),(112,67),(117,67),(118,67),(119,67),(4,68),(5,68),(6,68),(7,68),(15,68),(16,68),(17,68),(18,68),(19,68),(42,68),(43,68),(44,68),(45,68),(46,68),(47,68),(50,68),(53,68),(54,68),(66,68),(68,68),(69,68),(71,68),(90,68),(91,68),(92,68),(93,68),(94,68),(95,68),(96,68),(97,68),(98,68),(99,68),(100,68),(101,68),(104,68),(107,68),(110,68),(112,68),(117,68),(118,68),(119,68),(4,69),(5,69),(6,69),(42,69),(43,69),(44,69),(45,69),(46,69),(47,69),(53,69),(54,69),(76,69),(92,69),(93,69),(94,69),(95,69),(96,69),(97,69),(98,69),(99,69),(100,69),(101,69),(102,69),(103,69),(104,69),(107,69),(108,69),(110,69),(112,69),(117,69),(118,69),(119,69),(0,70),(4,70),(5,70),(39,70),(42,70),(43,70),(44,70),(45,70),(46,70),(47,70),(50,70),(52,70),(56,70),(68,70),(89,70),(92,70),(93,70),(94,70),(95,70),(96,70),(97,70),(98,70),(99,70),(102,70),(103,70),(104,70),(107,70),(108,70),(110,70),(111,70),(112,70),(114,70),(115,70),(116,70),(117,70),(118,70),(119,70),(1,71),(2,71),(4,71),(5,71),(11,71),(17,71),(18,71),(42,71),(43,71),(44,71),(46,71),(50,71),(52,71),(53,71),(54,71),(55,71),(92,71),(93,71),(94,71),(95,71),(96,71),(97,71),(98,71),(99,71),(102,71),(103,71),(104,71),(108,71),(110,71),(111,71),(112,71),(114,71),(115,71),(116,71),(117,71),(118,71),(119,71),(1,72),(4,72),(5,72),(47,72),(54,72),(55,72),(87,72),(90,72),(91,72),(92,72),(93,72),(94,72),(95,72),(96,72),(97,72),(98,72),(102,72),(103,72),(104,72),(108,72),(110,72),(111,72),(114,72),(115,72),(116,72),(117,72),(118,72),(119,72),(1,73),(4,73),(5,73),(6,73),(7,73),(14,73),(18,73),(19,73),(54,73),(56,73),(87,73),(90,73),(91,73),(92,73),(93,73),(94,73),(95,73),(96,73),(97,73),(98,73),(102,73),(103,73),(104,73),(107,73),(108,73),(110,73),(111,73),(112,73),(114,73),(115,73),(116,73),(117,73),(118,73),(119,73),(1,74),(4,74),(5,74),(6,74),(7,74),(8,74),(10,74),(11,74),(13,74),(39,74),(40,74),(41,74),(43,74),(46,74),(54,74),(55,74),(87,74),(107,74),(108,74),(111,74),(112,74),(1,75),(5,75),(6,75),(8,75),(10,75),(12,75),(13,75),(17,75),(18,75),(19,75),(20,75),(87,75),(90,75),(97,75),(103,75),(107,75),(108,75),(110,75),(111,75),(3,76),(5,76),(6,76),(7,76),(8,76),(9,76),(10,76),(11,76),(12,76),(13,76),(17,76),(18,76),(19,76),(22,76),(23,76),(32,76),(33,76),(34,76),(35,76),(36,76),(38,76),(41,76),(43,76),(48,76),(54,76),(56,76),(57,76),(58,76),(59,76),(60,76),(61,76),(62,76),(64,76),(65,76),(66,76),(87,76),(89,76),(90,76),(91,76),(92,76),(93,76),(94,76),(95,76),(96,76),(97,76),(98,76),(100,76),(101,76),(102,76),(104,76),(0,77),(6,77),(17,77),(37,77),(38,77),(40,77),(41,77),(42,77),(43,77),(44,77),(45,77),(46,77),(54,77),(56,77),(57,77),(58,77),(59,77),(60,77),(61,77),(65,77),(87,77),(88,77),(93,77),(94,77),(95,77),(96,77),(97,77),(98,77),(99,77),(100,77),(101,77),(104,77),(106,77),(107,77),(108,77),(109,77),(112,77),(0,78),(1,78),(17,78),(18,78),(31,78),(34,78),(35,78),(37,78),(38,78),(40,78),(46,78),(47,78),(49,78),(50,78),(51,78),(52,78),(54,78),(56,78),(57,78),(58,78),(59,78),(60,78),(61,78),(62,78),(63,78),(66,78),(86,78),(91,78),(106,78),(107,78),(108,78),(112,78),(0,79),(3,79),(5,79),(17,79),(31,79),(34,79),(37,79),(39,79),(50,79),(51,79),(52,79),(53,79),(56,79),(57,79),(58,79),(59,79),(60,79),(61,79),(62,79),(63,79),(66,79),(86,79),(88,79),(89,79),(93,79),(94,79),(95,79),(96,79),(100,79),(106,79),(107,79),(108,79),(109,79),(114,79),(115,79),(116,79),(117,79),(118,79),(119,79),(4,80),(17,80),(21,80),(22,80),(23,80),(24,80),(25,80),(26,80),(56,80),(57,80),(58,80),(59,80),(60,80),(61,80),(62,80),(63,80),(66,80),(67,80),(86,80),(88,80),(91,80),(94,80),(95,80),(96,80),(97,80),(98,80),(99,80),(102,80),(107,80),(108,80),(109,80),(114,80),(115,80),(116,80),(117,80),(118,80),(119,80),(2,81),(4,81),(19,81),(20,81),(21,81),(22,81),(23,81),(24,81),(25,81),(26,81),(56,81),(57,81),(58,81),(59,81),(60,81),(61,81),(62,81),(63,81),(66,81),(67,81),(68,81),(85,81),(86,81),(87,81),(91,81),(92,81),(93,81),(95,81),(108,81),(109,81),(114,81),(115,81),(116,81),(117,81),(118,81),(119,81),(0,82),(4,82),(19,82),(20,82),(21,82),(22,82),(23,82),(24,82),(25,82),(26,82),(56,82),(57,82),(58,82),(59,82),(60,82),(61,82),(62,82),(63,82),(66,82),(67,82),(68,82),(83,82),(84,82),(85,82),(86,82),(87,82),(89,82),(106,82),(109,82),(112,82),(114,82),(115,82),(116,82),(117,82),(118,82),(119,82),(4,83),(26,83),(56,83),(57,83),(58,83),(59,83),(60,83),(61,83),(62,83),(63,83),(66,83),(67,83),(82,83),(83,83),(84,83),(85,83),(86,83),(92,83),(94,83),(99,83),(100,83),(101,83),(102,83),(103,83),(104,83),(106,83),(112,83),(114,83),(115,83),(119,83),(0,84),(2,84),(3,84),(4,84),(19,84),(20,84),(21,84),(22,84),(23,84),(24,84),(25,84),(26,84),(35,84),(53,84),(56,84),(57,84),(58,84),(59,84),(60,84),(61,84),(62,84),(63,84),(68,84),(82,84),(89,84),(91,84),(92,84),(95,84),(96,84),(97,84),(98,84),(99,84),(100,84),(101,84),(102,84),(103,84),(104,84),(105,84),(106,84),(107,84),(108,84),(109,84),(112,84),(114,84),(115,84),(119,84),(0,85),(1,85),(2,85),(3,85),(4,85),(8,85),(9,85),(10,85),(11,85),(12,85),(13,85),(19,85),(20,85),(21,85),(22,85),(23,85),(24,85),(25,85),(26,85),(32,85),(33,85),(34,85),(35,85),(37,85),(38,85),(40,85),(41,85),(45,85),(49,85),(52,85),(65,85),(66,85),(68,85),(82,85),(84,85),(85,85),(86,85),(89,85),(90,85),(91,85),(94,85),(96,85),(98,85),(99,85),(100,85),(101,85),(102,85),(103,85),(104,85),(105,85),(106,85),(107,85),(108,85),(109,85),(110,85),(112,85),(114,85),(115,85),(119,85),(0,86),(1,86),(3,86),(4,86),(20,86),(21,86),(22,86),(23,86),(24,86),(25,86),(26,86),(36,86),(38,86),(40,86),(50,86),(56,86),(68,86),(84,86),(85,86),(86,86),(89,86),(90,86),(94,86),(96,86),(97,86),(99,86),(100,86),(101,86),(102,86),(103,86),(104,86),(105,86),(106,86),(107,86),(108,86),(112,86),(114,86),(115,86),(116,86),(117,86),(118,86),(119,86),(5,87),(19,87),(20,87),(21,87),(22,87),(23,87),(24,87),(25,87),(26,87),(33,87),(34,87),(38,87),(67,87),(68,87),(69,87),(85,87),(86,87),(90,87),(94,87),(96,87),(100,87),(106,87),(107,87),(108,87),(109,87),(110,87),(112,87),(114,87),(115,87),(116,87),(21,88),(22,88),(23,88),(24,88),(25,88),(33,88),(34,88),(36,88),(37,88),(40,88),(50,88),(51,88),(52,88),(63,88),(66,88),(67,88),(68,88),(85,88),(87,88),(89,88),(93,88),(94,88),(96,88),(99,88),(100,88),(101,88),(102,88),(103,88),(104,88),(105,88),(107,88),(108,88),(109,88),(110,88),(112,88),(114,88),(115,88),(116,88),(4,89),(5,89),(38,89),(40,89),(41,89),(44,89),(50,89),(51,89),(52,89),(56,89),(57,89),(58,89),(59,89),(61,89),(64,89),(65,89),(66,89),(67,89),(85,89),(86,89),(87,89),(94,89),(96,89),(97,89),(99,89),(100,89),(107,89),(110,89),(114,89),(115,89),(116,89),(1,90),(34,90),(35,90),(40,90),(41,90),(42,90),(43,90),(46,90),(50,90),(51,90),(52,90),(57,90),(59,90),(63,90),(87,90),(94,90),(97,90),(119,90),(7,91),(31,91),(33,91),(34,91),(37,91),(38,91),(39,91),(42,91),(51,91),(52,91),(56,91),(57,91),(58,91),(59,91),(61,91),(62,91),(63,91),(64,91),(65,91),(66,91),(86,91),(87,91),(88,91),(90,91),(94,91),(95,91),(112,91),(114,91),(115,91),(116,91),(117,91),(119,91),(4,92),(5,92),(6,92),(8,92),(86,92),(87,92),(88,92),(90,92),(94,92),(95,92),(96,92),(97,92),(98,92),(99,92),(100,92),(104,92),(105,92),(107,92),(109,92),(111,92),(112,92),(113,92),(114,92),(115,92),(116,92),(119,92),(11,93),(13,93),(15,93),(16,93),(20,93),(23,93),(26,93),(33,93),(35,93),(36,93),(43,93),(44,93),(53,93),(60,93),(87,93),(88,93),(96,93),(103,93),(104,93),(105,93),(106,93),(108,93),(109,93),(111,93),(112,93),(113,93),(114,93),(115,93),(116,93),(118,93),(119,93),(15,94),(16,94),(18,94),(19,94),(20,94),(21,94),(22,94),(23,94),(24,94),(25,94),(26,94),(27,94),(28,94),(31,94),(33,94),(38,94),(48,94),(49,94),(102,94),(103,94),(106,94),(108,94),(111,94),(112,94),(113,94),(114,94),(115,94),(116,94),(117,94),(119,94),(16,95),(19,95),(22,95),(27,95),(28,95),(38,95),(50,95),(102,95),(103,95),(104,95),(106,95),(107,95),(111,95),(112,95),(119,95),(25,96),(27,96),(32,96),(56,96),(57,96),(59,96),(61,96),(62,96),(64,96),(68,96),(71,96),(72,96),(86,96),(87,96),(88,96),(89,96),(91,96),(92,96),(93,96),(95,96),(96,96),(97,96),(98,96),(99,96),(100,96),(101,96),(102,96),(103,96),(104,96),(109,96),(110,96),(111,96),(112,96),(114,96),(115,96),(23,97),(26,97),(27,97),(32,97),(41,97),(42,97),(43,97),(44,97),(46,97),(47,97),(50,97),(56,97),(57,97),(58,97),(59,97),(61,97),(63,97),(64,97),(67,97),(86,97),(87,97),(88,97),(90,97),(107,97),(108,97),(109,97),(110,97),(111,97),(112,97),(114,97),(117,97),(24,98),(25,98),(26,98),(32,98),(37,98),(38,98),(39,98),(41,98),(42,98),(43,98),(44,98),(48,98),(49,98),(51,98),(52,98),(56,98),(58,98),(59,98),(60,98),(62,98),(63,98),(64,98),(68,98),(70,98),(71,98),(73,98),(86,98),(87,98),(88,98),(89,98),(90,98),(92,98),(93,98),(94,98),(95,98),(96,98),(97,98),(98,98),(99,98),(106,98),(107,98),(108,98),(109,98),(110,98),(111,98),(112,98),(116,98),(119,98),(27,99),(30,99),(31,99),(32,99),(36,99),(37,99),(38,99),(39,99),(45,99),(47,99),(48,99),(50,99),(51,99),(52,99),(56,99),(57,99),(58,99),(59,99),(60,99),(61,99),(65,99),(73,99),(85,99),(86,99),(89,99),(90,99),(92,99),(93,99),(101,99),(102,99),(103,99),(104,99),(106,99),(107,99),(108,99),(109,99),(110,99),(111,99),(112,99),(119,99),(26,100),(42,100),(43,100),(45,100),(47,100),(48,100),(50,100),(52,100),(57,100),(85,100),(86,100),(87,100),(89,100),(90,100),(92,100),(93,100),(98,100),(99,100),(100,100),(101,100),(102,100),(103,100),(104,100),(106,100),(107,100),(108,100),(109,100),(114,100),(115,100),(118,100),(119,100),(43,101),(46,101),(89,101),(92,101),(93,101),(96,101),(97,101),(99,101),(100,101),(101,101),(102,101),(103,101),(104,101),(105,101),(112,101),(114,101),(115,101),(116,101),(117,101),(118,101),(119,101),(43,102),(92,102),(93,102),(94,102),(95,102),(96,102),(97,102),(102,102),(103,102),(104,102),(105,102),(106,102),(107,102),(108,102),(109,102),(112,102),(114,102),(115,102),(116,102),(117,102),(118,102),(119,102),(93,103),(94,103),(95,103),(96,103),(97,103),(100,103),(102,103),(103,103),(104,103),(105,103),(106,103),(107,103),(112,103),(116,103),(117,103),(118,103),(119,103),(94,104),(95,104),(96,104),(97,104),(98,104),(100,104),(103,104),(104,104),(105,104),(106,104),(109,104),(110,104),(112,104),(113,104),(114,104),(116,104),(117,104),(118,104),(119,104),(96,105),(97,105),(103,105),(104,105),(105,105),(108,105),(109,105),(110,105),(111,105),(112,105),(113,105),(116,105),(117,105),(118,105),(119,105),(99,106),(100,106),(101,106),(102,106),(103,106),(105,106),(107,106),(108,106),(109,106),(110,106),(111,106),(112,106),(113,106),(116,106),(117,106),(118,106),(119,106),(4,107),(5,107),(6,107),(7,107),(78,107),(98,107),(99,107),(100,107),(101,107),(102,107),(103,107),(104,107),(106,107),(107,107),(108,107),(109,107),(110,107),(111,107),(112,107),(115,107),(116,107),(117,107),(118,107),(119,107),(0,108),(6,108),(12,108),(52,108),(56,108),(57,108),(60,108),(61,108),(62,108),(96,108),(97,108),(98,108),(99,108),(100,108),(101,108),(102,108),(103,108),(104,108),(105,108),(106,108),(107,108),(112,108),(113,108),(114,108),(115,108),(116,108),(117,108),(118,108),(119,108),(0,109),(1,109),(2,109),(3,109),(4,109),(5,109),(6,109),(7,109),(8,109),(9,109),(10,109),(11,109),(12,109),(13,109),(14,109),(15,109),(18,109),(19,109),(28,109),(29,109),(30,109),(31,109),(32,109),(33,109),(34,109),(52,109),(56,109),(73,109),(74,109),(78,109),(80,109),(81,109),(82,109),(83,109),(97,109),(98,109),(99,109),(100,109),(101,109),(102,109),(103,109),(104,109),(105,109),(106,109),(107,109),(108,109),(109,109),(110,109),(111,109),(112,109),(113,109),(114,109),(115,109),(116,109),(117,109),(118,109),(119,109)}
location.alwaysFront = {(5,0),(6,0),(7,0),(8,0),(14,0),(15,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(49,0),(50,0),(51,0),(52,0),(67,0),(68,0),(69,0),(74,0),(75,0),(76,0),(101,0),(102,0),(103,0),(107,0),(108,0),(109,0),(116,0),(117,0),(118,0),(5,1),(6,1),(7,1),(8,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(49,1),(50,1),(51,1),(52,1),(67,1),(68,1),(69,1),(74,1),(75,1),(76,1),(84,1),(85,1),(86,1),(101,1),(102,1),(103,1),(107,1),(108,1),(109,1),(111,1),(112,1),(113,1),(116,1),(117,1),(118,1),(0,2),(1,2),(2,2),(5,2),(6,2),(7,2),(8,2),(30,2),(31,2),(49,2),(50,2),(51,2),(52,2),(67,2),(68,2),(69,2),(74,2),(75,2),(76,2),(84,2),(85,2),(86,2),(101,2),(102,2),(103,2),(107,2),(108,2),(109,2),(111,2),(112,2),(113,2),(116,2),(117,2),(118,2),(0,3),(1,3),(2,3),(50,3),(51,3),(74,3),(75,3),(76,3),(84,3),(85,3),(86,3),(101,3),(102,3),(103,3),(107,3),(108,3),(109,3),(111,3),(112,3),(113,3),(116,3),(117,3),(118,3),(0,4),(1,4),(2,4),(50,4),(51,4),(84,4),(85,4),(86,4),(111,4),(112,4),(113,4),(0,5),(1,5),(2,5),(4,5),(85,5),(114,5),(115,5),(116,5),(0,6),(1,6),(2,6),(109,6),(110,6),(111,6),(114,6),(115,6),(116,6),(28,7),(29,7),(30,7),(104,7),(105,7),(106,7),(109,7),(110,7),(111,7),(114,7),(115,7),(116,7),(28,8),(29,8),(30,8),(44,8),(45,8),(46,8),(47,8),(48,8),(49,8),(104,8),(105,8),(106,8),(109,8),(110,8),(111,8),(114,8),(115,8),(116,8),(0,9),(1,9),(2,9),(3,9),(4,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(20,9),(21,9),(28,9),(29,9),(30,9),(44,9),(45,9),(46,9),(47,9),(48,9),(49,9),(104,9),(105,9),(106,9),(109,9),(110,9),(111,9),(0,10),(1,10),(2,10),(3,10),(4,10),(14,10),(15,10),(16,10),(17,10),(18,10),(19,10),(20,10),(21,10),(28,10),(29,10),(30,10),(44,10),(45,10),(46,10),(47,10),(48,10),(49,10),(65,10),(66,10),(67,10),(68,10),(104,10),(105,10),(106,10),(0,11),(1,11),(2,11),(3,11),(4,11),(14,11),(15,11),(16,11),(17,11),(18,11),(19,11),(20,11),(21,11),(22,11),(44,11),(45,11),(46,11),(47,11),(48,11),(49,11),(50,11),(51,11),(52,11),(53,11),(54,11),(55,11),(56,11),(57,11),(58,11),(65,11),(66,11),(67,11),(68,11),(0,12),(1,12),(2,12),(3,12),(4,12),(6,12),(7,12),(8,12),(9,12),(47,12),(48,12),(49,12),(50,12),(51,12),(52,12),(53,12),(54,12),(55,12),(56,12),(57,12),(58,12),(65,12),(66,12),(67,12),(68,12),(1,13),(2,13),(6,13),(7,13),(8,13),(9,13),(47,13),(48,13),(49,13),(50,13),(51,13),(52,13),(53,13),(54,13),(55,13),(56,13),(57,13),(58,13),(65,13),(66,13),(67,13),(68,13),(108,13),(109,13),(110,13),(6,14),(7,14),(8,14),(9,14),(47,14),(48,14),(49,14),(50,14),(51,14),(52,14),(53,14),(54,14),(55,14),(56,14),(57,14),(58,14),(108,14),(109,14),(110,14),(6,15),(7,15),(8,15),(9,15),(47,15),(48,15),(49,15),(50,15),(51,15),(52,15),(53,15),(54,15),(55,15),(56,15),(57,15),(58,15),(108,15),(109,15),(110,15),(113,15),(114,15),(115,15),(47,16),(48,16),(49,16),(50,16),(51,16),(52,16),(53,16),(54,16),(55,16),(56,16),(57,16),(58,16),(108,16),(109,16),(110,16),(113,16),(114,16),(115,16),(113,17),(114,17),(115,17),(113,18),(114,18),(115,18),(116,19),(117,19),(118,19),(119,19),(103,20),(104,20),(105,20),(116,20),(117,20),(118,20),(119,20),(0,21),(1,21),(2,21),(3,21),(103,21),(104,21),(105,21),(116,21),(117,21),(118,21),(119,21),(0,22),(1,22),(2,22),(3,22),(103,22),(104,22),(105,22),(108,22),(109,22),(116,22),(117,22),(118,22),(119,22),(0,23),(1,23),(2,23),(3,23),(103,23),(104,23),(105,23),(116,23),(117,23),(118,23),(119,23),(0,24),(1,24),(2,24),(3,24),(103,24),(104,24),(105,24),(0,25),(1,25),(2,25),(3,25),(3,26),(45,26),(46,26),(47,26),(48,26),(49,26),(45,27),(46,27),(47,27),(48,27),(49,27),(50,27),(100,27),(101,27),(102,27),(103,27),(104,27),(105,27),(45,28),(46,28),(47,28),(48,28),(49,28),(50,28),(100,28),(101,28),(102,28),(103,28),(104,28),(105,28),(114,28),(115,28),(116,28),(117,28),(118,28),(119,28),(45,29),(46,29),(47,29),(48,29),(49,29),(50,29),(100,29),(101,29),(102,29),(103,29),(104,29),(105,29),(114,29),(115,29),(116,29),(117,29),(118,29),(119,29),(6,30),(100,30),(101,30),(102,30),(103,30),(104,30),(105,30),(108,30),(109,30),(110,30),(114,30),(115,30),(116,30),(117,30),(118,30),(119,30),(0,31),(1,31),(2,31),(3,31),(7,31),(102,31),(103,31),(108,31),(109,31),(110,31),(114,31),(115,31),(116,31),(117,31),(118,31),(119,31),(4,32),(8,32),(108,32),(109,32),(110,32),(116,32),(117,32),(4,33),(8,33),(9,33),(103,33),(104,33),(105,33),(108,33),(109,33),(110,33),(4,34),(7,34),(9,34),(108,34),(109,34),(110,34),(113,34),(114,34),(115,34),(7,35),(113,35),(114,35),(115,35),(117,35),(118,35),(7,36),(2,37),(7,37),(10,37),(11,37),(12,37),(26,37),(27,37),(28,37),(35,37),(36,37),(37,37),(38,37),(39,37),(40,37),(43,37),(44,37),(45,37),(46,37),(2,38),(10,38),(11,38),(12,38),(14,38),(15,38),(16,38),(17,38),(26,38),(27,38),(28,38),(35,38),(36,38),(37,38),(38,38),(39,38),(40,38),(43,38),(44,38),(45,38),(46,38),(112,38),(113,38),(114,38),(10,39),(11,39),(12,39),(14,39),(15,39),(16,39),(17,39),(26,39),(27,39),(28,39),(35,39),(36,39),(37,39),(38,39),(39,39),(40,39),(43,39),(44,39),(45,39),(46,39),(112,39),(113,39),(114,39),(1,40),(10,40),(11,40),(12,40),(14,40),(15,40),(16,40),(17,40),(26,40),(27,40),(28,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(43,40),(44,40),(45,40),(46,40),(112,40),(113,40),(114,40),(1,41),(14,41),(15,41),(16,41),(17,41),(43,41),(44,41),(45,41),(46,41),(112,41),(113,41),(114,41),(1,42),(2,42),(3,42),(4,42),(14,42),(15,42),(16,42),(17,42),(90,42),(91,42),(92,42),(93,42),(94,42),(95,42),(96,42),(97,42),(98,42),(99,42),(100,42),(101,42),(112,42),(113,42),(114,42),(115,42),(116,42),(117,42),(118,42),(1,43),(2,43),(3,43),(4,43),(8,43),(50,43),(51,43),(52,43),(53,43),(54,43),(55,43),(62,43),(63,43),(64,43),(90,43),(91,43),(92,43),(93,43),(94,43),(95,43),(96,43),(97,43),(98,43),(99,43),(100,43),(101,43),(113,43),(114,43),(115,43),(116,43),(117,43),(118,43),(1,44),(2,44),(3,44),(4,44),(50,44),(51,44),(52,44),(53,44),(54,44),(55,44),(62,44),(63,44),(64,44),(84,44),(85,44),(86,44),(87,44),(90,44),(91,44),(92,44),(93,44),(94,44),(95,44),(96,44),(97,44),(98,44),(99,44),(100,44),(101,44),(113,44),(114,44),(115,44),(116,44),(117,44),(118,44),(1,45),(2,45),(3,45),(4,45),(50,45),(51,45),(52,45),(53,45),(54,45),(55,45),(62,45),(63,45),(64,45),(84,45),(85,45),(86,45),(87,45),(90,45),(101,45),(102,45),(103,45),(104,45),(105,45),(113,45),(114,45),(115,45),(116,45),(117,45),(118,45),(1,46),(2,46),(3,46),(4,46),(35,46),(36,46),(37,46),(50,46),(51,46),(52,46),(53,46),(54,46),(55,46),(56,46),(57,46),(58,46),(59,46),(62,46),(63,46),(64,46),(84,46),(85,46),(86,46),(87,46),(90,46),(101,46),(116,46),(35,47),(36,47),(37,47),(38,47),(39,47),(40,47),(41,47),(42,47),(43,47),(44,47),(50,47),(51,47),(52,47),(53,47),(54,47),(55,47),(56,47),(57,47),(58,47),(59,47),(62,47),(63,47),(64,47),(90,47),(101,47),(35,48),(36,48),(37,48),(90,48),(101,48),(117,48),(118,48),(119,48),(29,49),(30,49),(31,49),(32,49),(34,49),(35,49),(36,49),(37,49),(117,49),(118,49),(119,49),(24,50),(29,50),(30,50),(31,50),(32,50),(33,50),(34,50),(35,50),(36,50),(37,50),(117,50),(118,50),(119,50),(24,51),(29,51),(30,51),(31,51),(32,51),(33,51),(34,51),(117,51),(118,51),(119,51),(29,52),(30,52),(31,52),(32,52),(33,52),(62,52),(63,52),(64,52),(117,52),(118,52),(119,52),(33,53),(62,53),(63,53),(64,53),(33,54),(56,54),(57,54),(58,54),(59,54),(62,54),(63,54),(64,54),(115,54),(116,54),(117,54),(118,54),(119,54),(0,55),(1,55),(2,55),(51,55),(52,55),(53,55),(54,55),(55,55),(56,55),(57,55),(58,55),(59,55),(62,55),(63,55),(64,55),(115,55),(116,55),(117,55),(118,55),(119,55),(0,56),(1,56),(2,56),(51,56),(52,56),(53,56),(54,56),(55,56),(56,56),(57,56),(58,56),(59,56),(60,56),(115,56),(116,56),(117,56),(118,56),(119,56),(0,57),(1,57),(2,57),(51,57),(52,57),(53,57),(54,57),(55,57),(56,57),(57,57),(58,57),(59,57),(60,57),(61,57),(62,57),(63,57),(64,57),(65,57),(66,57),(112,57),(113,57),(114,57),(115,57),(116,57),(117,57),(118,57),(119,57),(0,58),(1,58),(2,58),(5,58),(6,58),(7,58),(8,58),(24,58),(51,58),(52,58),(53,58),(54,58),(55,58),(56,58),(57,58),(58,58),(59,58),(60,58),(61,58),(62,58),(63,58),(64,58),(65,58),(66,58),(112,58),(113,58),(114,58),(117,58),(118,58),(0,59),(1,59),(2,59),(5,59),(6,59),(7,59),(8,59),(24,59),(60,59),(61,59),(62,59),(63,59),(64,59),(65,59),(66,59),(112,59),(113,59),(114,59),(0,60),(1,60),(5,60),(6,60),(7,60),(8,60),(61,60),(62,60),(63,60),(64,60),(65,60),(66,60),(94,60),(95,60),(96,60),(97,60),(98,60),(99,60),(101,60),(102,60),(103,60),(112,60),(113,60),(114,60),(0,61),(1,61),(38,61),(39,61),(40,61),(89,61),(90,61),(91,61),(94,61),(95,61),(96,61),(97,61),(98,61),(99,61),(101,61),(102,61),(103,61),(112,61),(113,61),(114,61),(38,62),(39,62),(40,62),(89,62),(90,62),(91,62),(92,62),(93,62),(94,62),(95,62),(96,62),(97,62),(98,62),(99,62),(100,62),(101,62),(102,62),(103,62),(0,63),(1,63),(2,63),(38,63),(39,63),(40,63),(41,63),(42,63),(43,63),(44,63),(45,63),(46,63),(89,63),(90,63),(91,63),(92,63),(93,63),(94,63),(95,63),(96,63),(97,63),(98,63),(99,63),(100,63),(101,63),(102,63),(103,63),(0,64),(1,64),(2,64),(21,64),(38,64),(39,64),(40,64),(41,64),(42,64),(43,64),(44,64),(45,64),(46,64),(89,64),(90,64),(91,64),(92,64),(93,64),(94,64),(95,64),(98,64),(99,64),(100,64),(101,64),(102,64),(103,64),(0,65),(1,65),(2,65),(21,65),(38,65),(40,65),(41,65),(42,65),(43,65),(44,65),(45,65),(46,65),(89,65),(90,65),(91,65),(92,65),(93,65),(94,65),(95,65),(98,65),(99,65),(100,65),(101,65),(0,66),(1,66),(2,66),(16,66),(17,66),(18,66),(19,66),(38,66),(40,66),(41,66),(42,66),(43,66),(44,66),(45,66),(46,66),(89,66),(90,66),(91,66),(92,66),(93,66),(94,66),(95,66),(98,66),(99,66),(100,66),(101,66),(0,67),(1,67),(2,67),(4,67),(5,67),(6,67),(16,67),(17,67),(18,67),(19,67),(40,67),(41,67),(42,67),(43,67),(44,67),(45,67),(46,67),(89,67),(90,67),(91,67),(92,67),(93,67),(94,67),(101,67),(102,67),(103,67),(104,67),(105,67),(106,67),(0,68),(1,68),(2,68),(4,68),(5,68),(6,68),(16,68),(17,68),(18,68),(19,68),(40,68),(41,68),(42,68),(43,68),(44,68),(45,68),(46,68),(89,68),(90,68),(91,68),(92,68),(93,68),(94,68),(98,68),(99,68),(100,68),(101,68),(102,68),(103,68),(104,68),(105,68),(106,68),(0,69),(1,69),(2,69),(3,69),(4,69),(5,69),(6,69),(19,69),(89,69),(90,69),(91,69),(92,69),(93,69),(94,69),(98,69),(99,69),(100,69),(101,69),(102,69),(103,69),(104,69),(105,69),(106,69),(0,70),(1,70),(2,70),(3,70),(5,70),(6,70),(98,70),(99,70),(100,70),(101,70),(102,70),(103,70),(104,70),(105,70),(106,70),(0,71),(1,71),(2,71),(3,71),(98,71),(99,71),(100,71),(0,72),(1,72),(2,72),(3,72),(27,72),(30,72),(99,72),(101,72),(0,73),(1,73),(2,73),(3,73),(27,73),(30,73),(4,74),(34,74),(35,74),(59,74),(60,74),(61,74),(62,74),(63,74),(91,74),(92,74),(93,74),(94,74),(95,74),(9,75),(10,75),(33,75),(34,75),(35,75),(58,75),(59,75),(60,75),(61,75),(62,75),(63,75),(91,75),(92,75),(93,75),(94,75),(95,75),(112,75),(113,75),(114,75),(3,76),(4,76),(5,76),(9,76),(10,76),(11,76),(57,76),(58,76),(59,76),(60,76),(61,76),(62,76),(63,76),(91,76),(92,76),(93,76),(94,76),(112,76),(113,76),(114,76),(3,77),(4,77),(5,77),(8,77),(9,77),(10,77),(11,77),(12,77),(56,77),(57,77),(58,77),(59,77),(60,77),(61,77),(62,77),(63,77),(64,77),(91,77),(92,77),(93,77),(94,77),(112,77),(113,77),(114,77),(115,77),(116,77),(117,77),(118,77),(119,77),(0,78),(1,78),(2,78),(3,78),(4,78),(5,78),(7,78),(8,78),(9,78),(10,78),(11,78),(12,78),(13,78),(56,78),(57,78),(58,78),(59,78),(60,78),(61,78),(62,78),(63,78),(64,78),(112,78),(113,78),(114,78),(115,78),(116,78),(117,78),(118,78),(119,78),(0,79),(1,79),(2,79),(3,79),(4,79),(5,79),(7,79),(8,79),(9,79),(10,79),(11,79),(12,79),(13,79),(14,79),(56,79),(57,79),(58,79),(59,79),(60,79),(61,79),(62,79),(63,79),(64,79),(112,79),(113,79),(114,79),(115,79),(116,79),(117,79),(118,79),(119,79),(0,80),(1,80),(2,80),(13,80),(14,80),(19,80),(20,80),(21,80),(22,80),(23,80),(24,80),(25,80),(26,80),(56,80),(57,80),(58,80),(59,80),(60,80),(61,80),(62,80),(63,80),(64,80),(84,80),(85,80),(86,80),(87,80),(115,80),(116,80),(117,80),(118,80),(119,80),(0,81),(1,81),(2,81),(13,81),(14,81),(15,81),(19,81),(20,81),(21,81),(22,81),(23,81),(24,81),(25,81),(26,81),(57,81),(58,81),(59,81),(60,81),(62,81),(63,81),(64,81),(84,81),(85,81),(86,81),(87,81),(13,82),(14,82),(15,82),(19,82),(20,82),(21,82),(22,82),(23,82),(24,82),(25,82),(26,82),(57,82),(58,82),(59,82),(60,82),(84,82),(85,82),(86,82),(87,82),(101,82),(102,82),(103,82),(104,82),(105,82),(13,83),(14,83),(15,83),(19,83),(20,83),(21,83),(22,83),(23,83),(24,83),(25,83),(26,83),(32,83),(33,83),(34,83),(35,83),(57,83),(58,83),(59,83),(60,83),(84,83),(85,83),(86,83),(87,83),(99,83),(100,83),(101,83),(102,83),(103,83),(104,83),(105,83),(106,83),(107,83),(4,84),(5,84),(6,84),(13,84),(14,84),(15,84),(32,84),(33,84),(34,84),(35,84),(38,84),(39,84),(40,84),(99,84),(100,84),(101,84),(102,84),(103,84),(104,84),(105,84),(106,84),(107,84),(111,84),(112,84),(113,84),(114,84),(115,84),(116,84),(4,85),(5,85),(6,85),(32,85),(33,85),(34,85),(35,85),(38,85),(39,85),(40,85),(99,85),(100,85),(101,85),(102,85),(103,85),(104,85),(105,85),(106,85),(107,85),(111,85),(112,85),(113,85),(114,85),(115,85),(116,85),(117,85),(118,85),(119,85),(4,86),(5,86),(6,86),(17,86),(27,86),(38,86),(39,86),(40,86),(111,86),(112,86),(113,86),(114,86),(115,86),(116,86),(117,86),(118,86),(119,86),(4,87),(5,87),(6,87),(17,87),(27,87),(38,87),(39,87),(40,87),(111,87),(112,87),(113,87),(114,87),(115,87),(116,87),(117,87),(118,87),(119,87),(50,88),(51,88),(52,88),(53,88),(86,88),(87,88),(88,88),(117,88),(118,88),(119,88),(50,89),(51,89),(52,89),(53,89),(86,89),(87,89),(88,89),(117,89),(118,89),(119,89),(50,90),(51,90),(52,90),(53,90),(88,90),(23,91),(24,91),(25,91),(26,91),(27,91),(28,91),(23,92),(24,92),(25,92),(26,92),(27,92),(28,92),(30,92),(31,92),(32,92),(23,93),(24,93),(25,93),(26,93),(27,93),(28,93),(30,93),(31,93),(32,93),(23,94),(24,94),(25,94),(26,94),(27,94),(28,94),(30,94),(31,94),(32,94),(101,94),(102,94),(103,94),(30,95),(31,95),(32,95),(95,95),(96,95),(97,95),(98,95),(99,95),(100,95),(101,95),(102,95),(103,95),(42,96),(43,96),(44,96),(45,96),(73,96),(95,96),(96,96),(97,96),(98,96),(99,96),(100,96),(101,96),(102,96),(103,96),(42,97),(43,97),(44,97),(45,97),(95,97),(96,97),(97,97),(98,97),(99,97),(100,97),(101,97),(102,97),(103,97),(104,97),(105,97),(106,97),(107,97),(108,97),(109,97),(110,97),(111,97),(112,97),(42,98),(43,98),(44,98),(45,98),(52,98),(56,98),(95,98),(96,98),(97,98),(98,98),(99,98),(100,98),(101,98),(102,98),(103,98),(104,98),(105,98),(106,98),(107,98),(108,98),(109,98),(110,98),(111,98),(112,98),(114,98),(115,98),(116,98),(42,99),(43,99),(44,99),(45,99),(52,99),(56,99),(103,99),(104,99),(105,99),(106,99),(107,99),(108,99),(109,99),(110,99),(111,99),(112,99),(114,99),(115,99),(116,99),(103,100),(104,100),(105,100),(106,100),(107,100),(108,100),(109,100),(110,100),(111,100),(112,100),(114,100),(115,100),(116,100),(118,100),(119,100),(3,101),(4,101),(5,101),(6,101),(7,101),(8,101),(95,101),(96,101),(97,101),(98,101),(103,101),(104,101),(105,101),(106,101),(114,101),(115,101),(116,101),(118,101),(119,101),(3,102),(4,102),(5,102),(6,102),(7,102),(8,102),(95,102),(96,102),(97,102),(98,102),(114,102),(115,102),(116,102),(118,102),(119,102),(3,103),(4,103),(5,103),(6,103),(7,103),(8,103),(95,103),(96,103),(97,103),(98,103),(118,103),(119,103),(3,104),(4,104),(5,104),(6,104),(7,104),(8,104),(12,104),(13,104),(14,104),(33,104),(34,104),(35,104),(36,104),(37,104),(38,104),(95,104),(96,104),(97,104),(98,104),(118,104),(119,104),(0,105),(1,105),(2,105),(5,105),(6,105),(12,105),(13,105),(14,105),(33,105),(34,105),(35,105),(36,105),(37,105),(38,105),(41,105),(42,105),(43,105),(44,105),(45,105),(46,105),(56,105),(57,105),(58,105),(59,105),(73,105),(74,105),(75,105),(76,105),(95,105),(96,105),(97,105),(98,105),(110,105),(111,105),(112,105),(113,105),(0,106),(1,106),(2,106),(5,106),(6,106),(12,106),(13,106),(14,106),(20,106),(21,106),(22,106),(23,106),(33,106),(34,106),(35,106),(36,106),(37,106),(38,106),(41,106),(42,106),(43,106),(44,106),(45,106),(46,106),(49,106),(50,106),(51,106),(52,106),(56,106),(57,106),(58,106),(59,106),(67,106),(68,106),(69,106),(70,106),(71,106),(72,106),(73,106),(74,106),(75,106),(76,106),(77,106),(78,106),(79,106),(94,106),(95,106),(96,106),(97,106),(98,106),(99,106),(104,106),(105,106),(106,106),(107,106),(108,106),(109,106),(110,106),(111,106),(112,106),(113,106),(116,106),(0,107),(1,107),(2,107),(5,107),(6,107),(10,107),(11,107),(12,107),(13,107),(14,107),(16,107),(17,107),(18,107),(20,107),(21,107),(22,107),(23,107),(24,107),(25,107),(26,107),(27,107),(28,107),(29,107),(30,107),(31,107),(32,107),(33,107),(34,107),(35,107),(36,107),(37,107),(38,107),(41,107),(42,107),(43,107),(44,107),(45,107),(46,107),(49,107),(50,107),(51,107),(52,107),(56,107),(57,107),(58,107),(59,107),(63,107),(64,107),(65,107),(66,107),(67,107),(68,107),(69,107),(70,107),(71,107),(72,107),(73,107),(74,107),(75,107),(76,107),(77,107),(78,107),(79,107),(94,107),(95,107),(96,107),(97,107),(98,107),(99,107),(100,107),(101,107),(102,107),(103,107),(104,107),(105,107),(106,107),(107,107),(108,107),(109,107),(110,107),(111,107),(112,107),(113,107),(116,107),(117,107),(118,107),(119,107),(0,108),(1,108),(2,108),(5,108),(6,108),(7,108),(8,108),(9,108),(10,108),(11,108),(12,108),(13,108),(14,108),(16,108),(17,108),(18,108),(20,108),(21,108),(22,108),(23,108),(25,108),(26,108),(27,108),(28,108),(30,108),(31,108),(32,108),(35,108),(36,108),(38,108),(39,108),(40,108),(41,108),(42,108),(43,108),(44,108),(45,108),(46,108),(49,108),(50,108),(51,108),(52,108),(56,108),(57,108),(58,108),(59,108),(63,108),(64,108),(65,108),(66,108),(67,108),(68,108),(69,108),(70,108),(71,108),(72,108),(73,108),(74,108),(75,108),(76,108),(77,108),(78,108),(79,108),(80,108),(94,108),(95,108),(96,108),(97,108),(98,108),(99,108),(100,108),(101,108),(102,108),(103,108),(104,108),(105,108),(106,108),(107,108),(108,108),(109,108),(110,108),(111,108),(112,108),(113,108),(116,108),(117,108),(118,108),(119,108),(0,109),(1,109),(2,109),(5,109),(6,109),(7,109),(8,109),(9,109),(10,109),(11,109),(12,109),(13,109),(14,109),(16,109),(17,109),(18,109),(20,109),(21,109),(22,109),(23,109),(25,109),(26,109),(27,109),(28,109),(30,109),(31,109),(32,109),(35,109),(36,109),(38,109),(39,109),(40,109),(43,109),(44,109),(49,109),(50,109),(51,109),(52,109),(57,109),(58,109),(63,109),(64,109),(65,109),(66,109),(67,109),(68,109),(69,109),(70,109),(71,109),(72,109),(73,109),(74,109),(75,109),(76,109),(78,109),(79,109),(80,109),(94,109),(95,109),(96,109),(97,109),(98,109),(99,109),(100,109),(101,109),(102,109),(103,109),(104,109),(105,109),(106,109),(107,109),(108,109),(109,109),(110,109),(111,109),(112,109),(113,109),(116,109),(117,109),(118,109),(119,109)}
location.front = {(1,0),(2,0),(3,0),(10,0),(11,0),(12,0),(25,0),(72,0),(85,0),(86,0),(1,1),(2,1),(3,1),(44,1),(45,1),(46,1),(58,1),(59,1),(60,1),(88,1),(89,1),(90,1),(3,2),(4,2),(5,2),(41,2),(42,2),(43,2),(44,2),(45,2),(46,2),(53,2),(54,2),(58,2),(59,2),(60,2),(41,3),(42,3),(43,3),(44,3),(45,3),(46,3),(47,3),(48,3),(53,3),(54,3),(58,3),(59,3),(60,3),(64,3),(65,3),(66,3),(68,3),(41,4),(42,4),(43,4),(47,4),(48,4),(64,4),(65,4),(66,4),(70,4),(71,4),(72,4),(73,4),(75,4),(65,5),(6,6),(61,6),(62,6),(60,7),(61,7),(62,7),(63,7),(64,7),(65,7),(66,7),(67,7),(68,7),(69,7),(70,7),(71,7),(72,7),(73,7),(74,7),(75,7),(76,7),(77,7),(70,9),(71,9),(72,9),(11,10),(23,10),(24,10),(27,10),(74,10),(117,10),(118,10),(119,10),(29,11),(36,11),(37,11),(38,11),(39,11),(40,11),(41,11),(42,11),(11,12),(14,12),(15,12),(16,12),(17,12),(18,12),(19,12),(20,12),(21,12),(22,12),(23,12),(27,12),(35,12),(43,12),(46,12),(47,12),(58,13),(59,13),(60,13),(61,13),(62,13),(63,13),(64,13),(65,13),(66,13),(67,13),(68,13),(66,14),(67,14),(72,15),(75,15),(104,15),(105,15),(106,15),(0,16),(7,16),(8,16),(47,16),(48,16),(49,16),(50,16),(51,16),(52,16),(53,16),(54,16),(55,16),(56,16),(57,16),(58,16),(81,16),(0,17),(36,17),(37,17),(38,17),(40,17),(41,17),(42,17),(47,17),(48,17),(49,17),(50,17),(51,17),(52,17),(53,17),(54,17),(55,17),(56,17),(57,17),(58,17),(0,18),(1,18),(2,18),(3,18),(59,18),(60,18),(61,18),(64,18),(65,18),(66,18),(67,18),(0,19),(67,19),(25,20),(26,20),(27,20),(81,20),(26,23),(79,23),(24,24),(25,24),(26,24),(27,24),(28,24),(20,25),(33,25),(76,25),(4,27),(5,27),(6,27),(0,28),(1,28),(4,28),(5,28),(7,30),(8,30),(47,30),(48,30),(8,31),(8,32),(9,32),(4,33),(9,33),(10,33),(1,36),(2,36),(32,36),(33,36),(34,36),(1,37),(2,37),(3,37),(4,37),(9,37),(116,37),(117,37),(118,37),(119,37),(2,38),(3,38),(4,38),(5,38),(6,38),(9,38),(66,38),(116,38),(117,38),(118,38),(119,38),(2,39),(3,39),(4,39),(5,39),(6,39),(7,39),(9,39),(10,39),(11,39),(12,39),(13,39),(14,39),(25,39),(26,39),(27,39),(28,39),(29,39),(30,39),(31,39),(32,39),(33,39),(34,39),(35,39),(36,39),(37,39),(38,39),(39,39),(40,39),(41,39),(42,39),(43,39),(44,39),(45,39),(116,39),(117,39),(118,39),(119,39),(0,40),(2,40),(3,40),(4,40),(5,40),(6,40),(7,40),(8,40),(9,40),(10,40),(11,40),(12,40),(13,40),(14,40),(15,40),(22,40),(23,40),(24,40),(29,40),(30,40),(31,40),(32,40),(33,40),(39,40),(40,40),(46,40),(47,40),(50,40),(51,40),(52,40),(103,40),(108,40),(111,40),(116,40),(117,40),(118,40),(119,40),(0,41),(2,41),(3,41),(4,41),(5,41),(6,41),(7,41),(11,41),(14,41),(15,41),(16,41),(22,41),(24,41),(25,41),(27,41),(29,41),(30,41),(31,41),(37,41),(38,41),(44,41),(45,41),(46,41),(47,41),(50,41),(116,41),(117,41),(118,41),(119,41),(0,42),(1,42),(7,42),(15,42),(16,42),(17,42),(18,42),(19,42),(47,42),(113,42),(0,43),(1,43),(9,43),(10,43),(11,43),(12,43),(13,43),(17,43),(18,43),(19,43),(47,43),(113,43),(118,43),(0,44),(1,44),(6,44),(8,44),(9,44),(10,44),(11,44),(12,44),(13,44),(84,44),(85,44),(86,44),(87,44),(8,45),(9,45),(10,45),(84,45),(85,45),(86,45),(87,45),(91,45),(92,45),(93,45),(94,45),(95,45),(96,45),(97,45),(98,45),(99,45),(100,45),(102,45),(103,45),(104,45),(105,45),(106,45),(107,45),(108,45),(109,45),(110,45),(0,46),(1,46),(4,46),(5,46),(8,46),(9,46),(10,46),(84,46),(85,46),(86,46),(87,46),(91,46),(92,46),(93,46),(94,46),(95,46),(96,46),(97,46),(98,46),(99,46),(100,46),(102,46),(103,46),(104,46),(105,46),(115,46),(8,47),(9,47),(10,47),(84,47),(87,47),(105,47),(110,47),(34,48),(35,48),(36,48),(37,48),(38,48),(39,48),(40,48),(41,48),(42,48),(43,48),(44,48),(45,48),(46,48),(47,48),(56,48),(57,48),(58,48),(59,48),(106,48),(34,49),(35,49),(36,49),(37,49),(38,49),(39,49),(40,49),(41,49),(42,49),(43,49),(44,49),(45,49),(46,49),(47,49),(56,49),(57,49),(58,49),(59,49),(90,49),(101,49),(106,49),(110,49),(111,49),(112,49),(113,49),(114,49),(115,49),(24,50),(33,50),(34,50),(35,50),(36,50),(37,50),(38,50),(39,50),(40,50),(41,50),(42,50),(43,50),(44,50),(45,50),(46,50),(47,50),(55,50),(56,50),(57,50),(58,50),(59,50),(90,50),(93,50),(94,50),(101,50),(109,50),(110,50),(111,50),(112,50),(113,50),(114,50),(115,50),(24,51),(38,51),(39,51),(40,51),(41,51),(42,51),(43,51),(44,51),(45,51),(46,51),(47,51),(55,51),(110,51),(111,51),(112,51),(113,51),(114,51),(115,51),(24,52),(38,52),(39,52),(40,52),(41,52),(42,52),(43,52),(44,52),(45,52),(46,52),(47,52),(110,52),(111,52),(112,52),(113,52),(114,52),(115,52),(30,53),(31,53),(33,53),(38,53),(39,53),(40,53),(41,53),(42,53),(43,53),(44,53),(45,53),(46,53),(47,53),(102,53),(103,53),(104,53),(105,53),(106,53),(107,53),(108,53),(109,53),(110,53),(112,53),(113,53),(33,54),(38,54),(39,54),(40,54),(41,54),(42,54),(43,54),(44,54),(45,54),(46,54),(47,54),(70,54),(71,54),(72,54),(73,54),(74,54),(75,54),(76,54),(77,54),(105,54),(106,54),(107,54),(2,55),(3,55),(4,55),(5,55),(6,55),(7,55),(8,55),(9,55),(10,55),(11,55),(12,55),(13,55),(15,55),(16,55),(33,55),(35,55),(37,55),(51,55),(52,55),(53,55),(54,55),(55,55),(56,55),(57,55),(58,55),(16,56),(63,56),(24,58),(24,59),(52,59),(54,59),(55,59),(56,59),(57,59),(58,59),(59,59),(60,59),(116,59),(117,59),(118,59),(119,59),(24,60),(54,60),(55,60),(56,60),(57,60),(58,60),(59,60),(60,60),(63,60),(64,60),(65,60),(66,60),(116,60),(117,60),(118,60),(119,60),(5,61),(6,61),(7,61),(8,61),(63,61),(64,61),(65,61),(66,61),(116,61),(117,61),(118,61),(119,61),(5,62),(6,62),(7,62),(8,62),(17,62),(18,62),(49,62),(52,62),(94,62),(95,62),(98,62),(99,62),(101,62),(116,62),(117,62),(118,62),(119,62),(89,63),(90,63),(91,63),(92,63),(93,63),(94,63),(95,63),(96,63),(97,63),(98,63),(99,63),(100,63),(101,63),(102,63),(103,63),(104,63),(105,63),(113,63),(114,63),(115,63),(116,63),(117,63),(118,63),(119,63),(21,64),(96,64),(97,64),(113,64),(114,64),(115,64),(116,64),(117,64),(118,64),(3,65),(4,65),(21,65),(38,65),(39,65),(51,65),(52,65),(53,65),(54,65),(55,65),(69,65),(70,65),(71,65),(72,65),(73,65),(74,65),(75,65),(76,65),(95,65),(96,65),(97,65),(102,65),(103,65),(104,65),(113,65),(114,65),(115,65),(116,65),(117,65),(118,65),(21,66),(38,66),(53,66),(69,66),(70,66),(71,66),(72,66),(73,66),(74,66),(75,66),(76,66),(93,66),(95,66),(96,66),(97,66),(99,66),(100,66),(102,66),(103,66),(104,66),(113,66),(114,66),(115,66),(116,66),(117,66),(118,66),(16,67),(38,67),(95,67),(96,67),(97,67),(115,67),(116,67),(74,68),(75,68),(95,68),(96,68),(97,68),(110,68),(111,68),(112,68),(113,68),(114,68),(115,68),(16,69),(17,69),(18,69),(47,69),(52,69),(53,69),(54,69),(95,69),(96,69),(97,69),(101,69),(102,69),(110,69),(111,69),(112,69),(113,69),(114,69),(115,69),(4,70),(17,70),(18,70),(19,70),(53,70),(91,70),(92,70),(110,70),(111,70),(112,70),(113,70),(114,70),(115,70),(5,71),(93,71),(94,71),(95,71),(103,71),(104,71),(110,71),(111,71),(112,71),(113,71),(114,71),(115,71),(27,72),(30,72),(93,72),(94,72),(95,72),(99,72),(112,72),(113,72),(114,72),(115,72),(116,72),(117,72),(0,73),(27,73),(30,73),(89,73),(90,73),(91,73),(92,73),(93,73),(94,73),(95,73),(96,73),(97,73),(98,73),(99,73),(100,73),(101,73),(102,73),(103,73),(104,73),(105,73),(114,73),(115,73),(116,73),(117,73),(27,74),(30,74),(34,74),(35,74),(55,74),(56,74),(57,74),(58,74),(59,74),(60,74),(61,74),(62,74),(63,74),(64,74),(65,74),(66,74),(67,74),(114,74),(115,74),(116,74),(117,74),(33,75),(34,75),(35,75),(114,75),(115,75),(116,75),(117,75),(0,76),(1,76),(2,76),(5,76),(6,76),(7,76),(8,76),(9,76),(10,76),(11,76),(12,76),(13,76),(14,76),(15,76),(17,76),(33,76),(34,76),(35,76),(45,76),(95,76),(111,76),(114,76),(115,76),(116,76),(117,76),(41,77),(46,77),(66,77),(67,77),(95,77),(96,77),(97,77),(98,77),(99,77),(100,77),(101,77),(102,77),(103,77),(96,78),(97,78),(98,78),(99,78),(100,78),(101,78),(102,78),(105,78),(65,79),(66,79),(67,79),(68,79),(96,79),(97,79),(99,79),(100,79),(101,79),(102,79),(3,80),(4,80),(5,80),(6,80),(7,80),(8,80),(9,80),(10,80),(11,80),(12,80),(13,80),(14,80),(90,80),(91,80),(3,81),(4,81),(5,81),(6,81),(7,81),(8,81),(9,81),(10,81),(11,81),(12,81),(13,81),(14,81),(64,81),(91,81),(114,81),(115,81),(116,81),(117,81),(3,82),(4,82),(5,82),(6,82),(7,82),(8,82),(9,82),(10,82),(11,82),(12,82),(13,82),(64,82),(114,82),(115,82),(116,82),(117,82),(3,83),(4,83),(5,83),(6,83),(7,83),(8,83),(9,83),(10,83),(11,83),(12,83),(13,83),(39,83),(96,83),(97,83),(98,83),(99,83),(100,83),(101,83),(102,83),(103,83),(104,83),(105,83),(106,83),(107,83),(108,83),(114,83),(115,83),(116,83),(117,83),(2,84),(3,84),(4,84),(5,84),(6,84),(42,84),(56,84),(85,84),(86,84),(114,84),(115,84),(116,84),(117,84),(13,85),(14,85),(47,85),(53,85),(61,85),(63,85),(64,85),(114,85),(115,85),(116,85),(117,85),(16,86),(17,86),(27,86),(32,86),(33,86),(34,86),(35,86),(67,86),(68,86),(70,86),(85,86),(86,86),(6,87),(7,87),(8,87),(17,87),(27,87),(32,87),(33,87),(34,87),(35,87),(67,87),(5,88),(17,88),(19,88),(22,88),(27,88),(39,88),(113,88),(114,88),(42,89),(53,89),(66,89),(69,89),(70,89),(71,89),(107,89),(53,90),(108,90),(50,91),(51,91),(52,91),(53,91),(57,91),(58,91),(59,91),(60,91),(61,91),(62,91),(63,91),(64,91),(65,91),(66,91),(85,91),(88,91),(94,91),(113,91),(114,91),(115,91),(116,91),(117,91),(118,91),(30,92),(31,92),(32,92),(33,92),(34,92),(35,92),(36,92),(37,92),(38,92),(39,92),(51,92),(52,92),(53,92),(113,92),(114,92),(115,92),(116,92),(117,92),(118,92),(105,93),(113,93),(114,93),(115,93),(116,93),(117,93),(118,93),(113,94),(114,94),(115,94),(116,94),(117,94),(118,94),(25,95),(26,95),(75,95),(76,95),(77,95),(78,95),(79,95),(80,95),(81,95),(82,95),(115,95),(116,95),(118,95),(119,95),(31,96),(113,96),(114,96),(118,96),(119,96),(92,97),(93,97),(94,97),(95,97),(96,97),(97,97),(98,97),(99,97),(100,97),(101,97),(102,97),(103,97),(104,97),(105,97),(106,97),(107,97),(108,97),(109,97),(110,97),(111,97),(31,98),(32,98),(33,98),(36,98),(37,98),(38,98),(39,98),(52,98),(56,98),(88,98),(92,98),(99,98),(100,98),(52,99),(56,99),(93,99),(94,99),(97,99),(98,99),(106,99),(107,99),(108,99),(43,100),(44,100),(52,100),(56,100),(100,100),(101,100),(102,100),(106,100),(107,100),(108,100),(109,101),(110,101),(0,102),(1,102),(9,102),(10,102),(11,102),(51,102),(100,102),(101,102),(102,102),(112,102),(113,102),(114,102),(0,103),(1,103),(9,103),(10,103),(11,103),(92,103),(93,103),(94,103),(100,103),(101,103),(102,103),(103,103),(104,103),(105,103),(106,103),(112,103),(113,103),(114,103),(0,104),(1,104),(9,104),(10,104),(11,104),(12,104),(13,104),(14,104),(25,104),(26,104),(27,104),(28,104),(29,104),(30,104),(100,104),(101,104),(102,104),(103,104),(104,104),(105,104),(106,104),(108,104),(109,104),(114,104),(115,104),(116,104),(117,104),(118,104),(119,104),(0,105),(1,105),(9,105),(10,105),(11,105),(12,105),(13,105),(14,105),(25,105),(26,105),(27,105),(28,105),(29,105),(30,105),(98,105),(99,105),(100,105),(101,105),(102,105),(103,105),(104,105),(105,105),(106,105),(114,105),(115,105),(116,105),(117,105),(118,105),(119,105),(0,106),(1,106),(10,106),(12,106),(13,106),(14,106),(15,106),(16,106),(17,106),(25,106),(26,106),(27,106),(28,106),(29,106),(30,106),(51,106),(52,106),(56,106),(60,106),(61,106),(62,106),(77,106),(78,106),(79,106),(101,106),(103,106),(104,106),(105,106),(106,106),(114,106),(115,106),(116,106),(117,106),(118,106),(119,106),(0,107),(1,107),(2,107),(3,107),(4,107),(5,107),(8,107),(9,107),(10,107),(11,107),(12,107),(13,107),(14,107),(15,107),(16,107),(17,107),(25,107),(26,107),(27,107),(28,107),(29,107),(30,107),(32,107),(33,107),(34,107),(47,107),(48,107),(49,107),(56,107),(57,107),(58,107),(77,107),(78,107),(79,107),(114,107),(115,107),(116,107),(117,107),(118,107),(119,107),(0,108),(1,108),(2,108),(3,108),(4,108),(5,108),(6,108),(7,108),(8,108),(9,108),(10,108),(11,108),(12,108),(13,108),(14,108),(19,108),(20,108),(21,108),(25,108),(26,108),(27,108),(28,108),(32,108),(33,108),(34,108),(59,108),(60,108),(61,108),(62,108),(77,108),(78,108),(79,108),(114,108),(115,108),(0,109),(1,109),(2,109),(6,109),(7,109),(10,109),(11,109),(12,109),(13,109),(14,109),(19,109),(20,109),(21,109),(25,109),(26,109),(27,109),(28,109),(59,109),(60,109),(61,109),(62,109)}
location.buildings = {(0,0),(1,0),(4,0),(5,0),(9,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(26,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(41,0),(42,0),(43,0),(44,0),(45,0),(46,0),(47,0),(48,0),(49,0),(50,0),(51,0),(52,0),(53,0),(54,0),(55,0),(56,0),(57,0),(58,0),(59,0),(60,0),(61,0),(62,0),(63,0),(64,0),(65,0),(66,0),(69,0),(70,0),(71,0),(73,0),(74,0),(75,0),(76,0),(77,0),(78,0),(84,0),(87,0),(88,0),(89,0),(90,0),(91,0),(97,0),(98,0),(99,0),(100,0),(101,0),(102,0),(103,0),(104,0),(105,0),(106,0),(107,0),(108,0),(109,0),(110,0),(111,0),(112,0),(113,0),(114,0),(115,0),(116,0),(117,0),(118,0),(119,0),(0,1),(1,1),(4,1),(5,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(36,1),(38,1),(39,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(50,1),(51,1),(52,1),(53,1),(54,1),(55,1),(56,1),(57,1),(58,1),(59,1),(61,1),(62,1),(63,1),(64,1),(66,1),(70,1),(71,1),(72,1),(73,1),(74,1),(75,1),(77,1),(78,1),(84,1),(86,1),(87,1),(88,1),(89,1),(90,1),(91,1),(97,1),(98,1),(99,1),(100,1),(101,1),(102,1),(103,1),(104,1),(105,1),(106,1),(107,1),(108,1),(109,1),(110,1),(111,1),(112,1),(113,1),(114,1),(115,1),(116,1),(117,1),(118,1),(119,1),(2,2),(8,2),(9,2),(10,2),(11,2),(12,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(40,2),(41,2),(42,2),(43,2),(44,2),(45,2),(46,2),(47,2),(48,2),(49,2),(50,2),(51,2),(52,2),(53,2),(54,2),(55,2),(56,2),(57,2),(61,2),(62,2),(63,2),(64,2),(66,2),(70,2),(71,2),(72,2),(73,2),(74,2),(75,2),(77,2),(78,2),(84,2),(86,2),(87,2),(88,2),(89,2),(90,2),(91,2),(97,2),(98,2),(99,2),(100,2),(104,2),(105,2),(106,2),(107,2),(108,2),(109,2),(110,2),(111,2),(112,2),(113,2),(115,2),(116,2),(117,2),(118,2),(119,2),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(8,3),(9,3),(10,3),(11,3),(12,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(40,3),(41,3),(42,3),(43,3),(49,3),(52,3),(55,3),(56,3),(57,3),(60,3),(61,3),(62,3),(63,3),(64,3),(66,3),(67,3),(69,3),(70,3),(71,3),(72,3),(73,3),(74,3),(75,3),(76,3),(77,3),(78,3),(84,3),(86,3),(87,3),(89,3),(91,3),(97,3),(98,3),(99,3),(100,3),(102,3),(104,3),(105,3),(106,3),(107,3),(108,3),(109,3),(110,3),(111,3),(112,3),(113,3),(114,3),(116,3),(117,3),(118,3),(119,3),(2,4),(3,4),(4,4),(5,4),(6,4),(7,4),(8,4),(9,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(49,4),(52,4),(53,4),(54,4),(55,4),(56,4),(57,4),(58,4),(59,4),(60,4),(61,4),(62,4),(63,4),(64,4),(65,4),(66,4),(67,4),(68,4),(69,4),(70,4),(71,4),(72,4),(73,4),(74,4),(75,4),(76,4),(77,4),(78,4),(84,4),(86,4),(87,4),(91,4),(97,4),(99,4),(100,4),(101,4),(102,4),(103,4),(104,4),(105,4),(106,4),(107,4),(108,4),(109,4),(110,4),(111,4),(112,4),(113,4),(114,4),(115,4),(116,4),(117,4),(118,4),(119,4),(2,5),(3,5),(4,5),(5,5),(6,5),(7,5),(8,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(18,5),(19,5),(20,5),(21,5),(22,5),(23,5),(24,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(48,5),(49,5),(50,5),(51,5),(52,5),(53,5),(54,5),(55,5),(56,5),(57,5),(58,5),(59,5),(60,5),(61,5),(62,5),(63,5),(64,5),(65,5),(66,5),(67,5),(68,5),(69,5),(70,5),(71,5),(72,5),(73,5),(74,5),(75,5),(77,5),(78,5),(84,5),(86,5),(91,5),(97,5),(99,5),(100,5),(101,5),(102,5),(103,5),(104,5),(105,5),(106,5),(107,5),(108,5),(109,5),(110,5),(111,5),(112,5),(113,5),(114,5),(115,5),(116,5),(117,5),(118,5),(119,5),(2,6),(3,6),(4,6),(5,6),(6,6),(7,6),(8,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(21,6),(22,6),(23,6),(24,6),(25,6),(26,6),(27,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(34,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(42,6),(43,6),(44,6),(45,6),(46,6),(47,6),(48,6),(49,6),(50,6),(51,6),(52,6),(53,6),(54,6),(55,6),(56,6),(57,6),(58,6),(59,6),(60,6),(61,6),(62,6),(63,6),(64,6),(65,6),(66,6),(67,6),(68,6),(69,6),(70,6),(71,6),(72,6),(73,6),(74,6),(75,6),(76,6),(77,6),(78,6),(84,6),(85,6),(86,6),(91,6),(97,6),(99,6),(100,6),(101,6),(102,6),(103,6),(104,6),(105,6),(106,6),(107,6),(109,6),(110,6),(111,6),(112,6),(113,6),(114,6),(115,6),(116,6),(117,6),(118,6),(119,6),(0,7),(1,7),(2,7),(3,7),(4,7),(5,7),(6,7),(7,7),(8,7),(9,7),(10,7),(11,7),(12,7),(13,7),(14,7),(15,7),(16,7),(17,7),(18,7),(19,7),(20,7),(21,7),(22,7),(23,7),(24,7),(25,7),(26,7),(27,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(34,7),(35,7),(36,7),(37,7),(38,7),(39,7),(40,7),(41,7),(42,7),(43,7),(44,7),(45,7),(46,7),(47,7),(48,7),(49,7),(50,7),(51,7),(52,7),(53,7),(54,7),(55,7),(56,7),(57,7),(58,7),(59,7),(60,7),(61,7),(62,7),(78,7),(84,7),(85,7),(86,7),(91,7),(97,7),(99,7),(100,7),(101,7),(102,7),(103,7),(104,7),(105,7),(106,7),(107,7),(108,7),(109,7),(110,7),(111,7),(113,7),(114,7),(115,7),(116,7),(117,7),(118,7),(119,7),(0,8),(1,8),(2,8),(3,8),(4,8),(5,8),(6,8),(7,8),(8,8),(9,8),(10,8),(11,8),(12,8),(13,8),(14,8),(15,8),(16,8),(17,8),(22,8),(23,8),(24,8),(25,8),(26,8),(27,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(34,8),(35,8),(36,8),(37,8),(38,8),(39,8),(40,8),(41,8),(42,8),(43,8),(44,8),(45,8),(46,8),(47,8),(48,8),(49,8),(50,8),(51,8),(52,8),(53,8),(54,8),(55,8),(56,8),(57,8),(58,8),(60,8),(61,8),(62,8),(63,8),(64,8),(65,8),(66,8),(67,8),(68,8),(69,8),(70,8),(71,8),(72,8),(73,8),(74,8),(75,8),(76,8),(77,8),(85,8),(86,8),(92,8),(97,8),(99,8),(100,8),(101,8),(102,8),(103,8),(104,8),(105,8),(106,8),(107,8),(108,8),(109,8),(110,8),(111,8),(113,8),(114,8),(115,8),(116,8),(117,8),(118,8),(119,8),(0,9),(1,9),(2,9),(3,9),(4,9),(5,9),(6,9),(7,9),(8,9),(9,9),(10,9),(28,9),(29,9),(30,9),(31,9),(32,9),(85,9),(86,9),(92,9),(96,9),(100,9),(101,9),(102,9),(103,9),(104,9),(105,9),(106,9),(107,9),(108,9),(109,9),(110,9),(111,9),(112,9),(113,9),(114,9),(115,9),(116,9),(117,9),(118,9),(119,9),(0,10),(1,10),(2,10),(3,10),(4,10),(5,10),(6,10),(7,10),(8,10),(9,10),(10,10),(70,10),(71,10),(72,10),(85,10),(86,10),(92,10),(96,10),(100,10),(101,10),(102,10),(103,10),(104,10),(105,10),(106,10),(107,10),(108,10),(109,10),(110,10),(111,10),(112,10),(113,10),(114,10),(115,10),(116,10),(118,10),(119,10),(0,11),(1,11),(2,11),(3,11),(4,11),(5,11),(6,11),(7,11),(8,11),(9,11),(10,11),(11,11),(23,11),(24,11),(27,11),(70,11),(71,11),(72,11),(74,11),(85,11),(92,11),(93,11),(94,11),(95,11),(96,11),(100,11),(101,11),(102,11),(103,11),(104,11),(105,11),(106,11),(107,11),(108,11),(109,11),(110,11),(111,11),(112,11),(113,11),(114,11),(116,11),(117,11),(118,11),(119,11),(0,12),(1,12),(2,12),(3,12),(4,12),(5,12),(6,12),(7,12),(8,12),(9,12),(11,12),(27,12),(29,12),(36,12),(37,12),(38,12),(39,12),(40,12),(41,12),(42,12),(85,12),(92,12),(96,12),(100,12),(101,12),(102,12),(103,12),(104,12),(105,12),(106,12),(107,12),(108,12),(109,12),(110,12),(111,12),(112,12),(113,12),(114,12),(115,12),(116,12),(117,12),(118,12),(119,12),(0,13),(1,13),(2,13),(3,13),(4,13),(5,13),(6,13),(7,13),(11,13),(14,13),(15,13),(17,13),(18,13),(19,13),(20,13),(21,13),(22,13),(23,13),(24,13),(27,13),(35,13),(43,13),(46,13),(47,13),(85,13),(92,13),(96,13),(100,13),(101,13),(102,13),(103,13),(104,13),(105,13),(106,13),(107,13),(108,13),(109,13),(110,13),(111,13),(112,13),(113,13),(114,13),(115,13),(116,13),(117,13),(118,13),(119,13),(0,14),(1,14),(2,14),(3,14),(4,14),(5,14),(11,14),(27,14),(35,14),(43,14),(46,14),(47,14),(58,14),(59,14),(60,14),(61,14),(62,14),(63,14),(64,14),(65,14),(66,14),(67,14),(68,14),(85,14),(92,14),(96,14),(101,14),(102,14),(103,14),(104,14),(105,14),(106,14),(107,14),(108,14),(109,14),(110,14),(111,14),(112,14),(113,14),(114,14),(115,14),(116,14),(117,14),(118,14),(119,14),(0,15),(1,15),(2,15),(3,15),(4,15),(35,15),(43,15),(58,15),(59,15),(60,15),(61,15),(62,15),(63,15),(64,15),(65,15),(66,15),(67,15),(68,15),(83,15),(84,15),(85,15),(87,15),(91,15),(92,15),(96,15),(103,15),(104,15),(105,15),(107,15),(108,15),(109,15),(110,15),(111,15),(112,15),(113,15),(114,15),(115,15),(116,15),(117,15),(118,15),(119,15),(0,16),(1,16),(2,16),(3,16),(4,16),(35,16),(43,16),(51,16),(52,16),(53,16),(58,16),(65,16),(66,16),(67,16),(68,16),(72,16),(75,16),(83,16),(84,16),(85,16),(90,16),(91,16),(96,16),(102,16),(103,16),(104,16),(105,16),(106,16),(107,16),(108,16),(109,16),(110,16),(111,16),(112,16),(113,16),(114,16),(115,16),(116,16),(117,16),(118,16),(119,16),(0,17),(1,17),(2,17),(3,17),(4,17),(7,17),(8,17),(35,17),(43,17),(47,17),(48,17),(49,17),(50,17),(51,17),(52,17),(53,17),(54,17),(55,17),(56,17),(57,17),(58,17),(59,17),(67,17),(68,17),(75,17),(81,17),(83,17),(84,17),(85,17),(90,17),(96,17),(102,17),(103,17),(104,17),(105,17),(106,17),(107,17),(108,17),(109,17),(110,17),(111,17),(112,17),(113,17),(114,17),(115,17),(116,17),(117,17),(118,17),(119,17),(0,18),(1,18),(2,18),(3,18),(4,18),(7,18),(8,18),(36,18),(37,18),(38,18),(40,18),(41,18),(42,18),(47,18),(48,18),(49,18),(50,18),(51,18),(52,18),(53,18),(54,18),(55,18),(56,18),(57,18),(58,18),(66,18),(67,18),(68,18),(83,18),(84,18),(85,18),(89,18),(90,18),(95,18),(101,18),(102,18),(103,18),(104,18),(105,18),(106,18),(107,18),(108,18),(109,18),(110,18),(111,18),(112,18),(113,18),(114,18),(115,18),(116,18),(117,18),(118,18),(119,18),(0,19),(1,19),(2,19),(3,19),(4,19),(47,19),(48,19),(49,19),(50,19),(51,19),(52,19),(53,19),(54,19),(55,19),(56,19),(57,19),(58,19),(59,19),(60,19),(61,19),(64,19),(65,19),(66,19),(67,19),(68,19),(83,19),(84,19),(89,19),(95,19),(101,19),(102,19),(103,19),(104,19),(105,19),(106,19),(107,19),(108,19),(109,19),(110,19),(111,19),(112,19),(113,19),(114,19),(115,19),(116,19),(117,19),(118,19),(119,19),(0,20),(1,20),(2,20),(3,20),(4,20),(47,20),(48,20),(49,20),(50,20),(51,20),(54,20),(55,20),(56,20),(57,20),(58,20),(66,20),(67,20),(83,20),(89,20),(94,20),(101,20),(102,20),(103,20),(104,20),(105,20),(106,20),(107,20),(108,20),(109,20),(110,20),(113,20),(114,20),(119,20),(0,21),(1,21),(2,21),(3,21),(4,21),(25,21),(26,21),(27,21),(47,21),(81,21),(83,21),(89,21),(94,21),(101,21),(102,21),(103,21),(104,21),(105,21),(106,21),(107,21),(108,21),(109,21),(110,21),(111,21),(112,21),(113,21),(114,21),(115,21),(116,21),(117,21),(118,21),(119,21),(0,22),(1,22),(2,22),(3,22),(4,22),(83,22),(89,22),(93,22),(101,22),(102,22),(103,22),(104,22),(105,22),(106,22),(107,22),(108,22),(109,22),(110,22),(111,22),(112,22),(113,22),(114,22),(115,22),(116,22),(117,22),(118,22),(119,22),(0,23),(1,23),(2,23),(3,23),(4,23),(83,23),(89,23),(93,23),(101,23),(102,23),(103,23),(105,23),(106,23),(107,23),(108,23),(109,23),(110,23),(111,23),(112,23),(113,23),(114,23),(115,23),(116,23),(117,23),(118,23),(119,23),(0,24),(1,24),(2,24),(3,24),(4,24),(57,24),(79,24),(83,24),(89,24),(93,24),(102,24),(103,24),(105,24),(106,24),(107,24),(110,24),(111,24),(112,24),(113,24),(114,24),(115,24),(116,24),(117,24),(118,24),(119,24),(0,25),(1,25),(2,25),(3,25),(4,25),(24,25),(25,25),(26,25),(27,25),(28,25),(83,25),(89,25),(93,25),(101,25),(102,25),(103,25),(104,25),(105,25),(106,25),(107,25),(108,25),(109,25),(110,25),(111,25),(112,25),(113,25),(114,25),(115,25),(116,25),(117,25),(118,25),(119,25),(0,26),(1,26),(2,26),(3,26),(4,26),(20,26),(24,26),(25,26),(27,26),(28,26),(33,26),(76,26),(83,26),(89,26),(93,26),(101,26),(102,26),(103,26),(104,26),(105,26),(106,26),(107,26),(108,26),(109,26),(110,26),(111,26),(112,26),(113,26),(114,26),(115,26),(116,26),(117,26),(118,26),(119,26),(0,27),(1,27),(2,27),(3,27),(4,27),(14,27),(20,27),(24,27),(25,27),(26,27),(27,27),(28,27),(33,27),(83,27),(89,27),(93,27),(101,27),(104,27),(105,27),(106,27),(107,27),(108,27),(109,27),(110,27),(111,27),(112,27),(113,27),(114,27),(115,27),(116,27),(117,27),(118,27),(119,27),(0,28),(1,28),(2,28),(3,28),(4,28),(5,28),(6,28),(24,28),(25,28),(26,28),(27,28),(28,28),(83,28),(88,28),(89,28),(93,28),(100,28),(101,28),(104,28),(105,28),(106,28),(107,28),(108,28),(109,28),(110,28),(111,28),(112,28),(113,28),(114,28),(115,28),(116,28),(117,28),(118,28),(119,28),(0,29),(1,29),(2,29),(3,29),(4,29),(5,29),(6,29),(81,29),(82,29),(83,29),(87,29),(88,29),(93,29),(100,29),(104,29),(105,29),(106,29),(107,29),(108,29),(109,29),(110,29),(111,29),(112,29),(113,29),(114,29),(115,29),(116,29),(117,29),(118,29),(119,29),(0,30),(1,30),(2,30),(3,30),(4,30),(5,30),(6,30),(79,30),(80,30),(81,30),(82,30),(83,30),(87,30),(93,30),(100,30),(104,30),(105,30),(106,30),(107,30),(108,30),(109,30),(110,30),(111,30),(112,30),(113,30),(114,30),(115,30),(116,30),(117,30),(118,30),(119,30),(0,31),(1,31),(2,31),(3,31),(4,31),(5,31),(6,31),(7,31),(8,31),(47,31),(48,31),(73,31),(76,31),(77,31),(78,31),(79,31),(80,31),(81,31),(82,31),(83,31),(87,31),(92,31),(100,31),(101,31),(104,31),(105,31),(106,31),(107,31),(108,31),(109,31),(110,31),(111,31),(112,31),(113,31),(114,31),(115,31),(116,31),(117,31),(118,31),(119,31),(0,32),(1,32),(2,32),(3,32),(4,32),(5,32),(6,32),(7,32),(8,32),(45,32),(47,32),(48,32),(72,32),(73,32),(76,32),(77,32),(78,32),(79,32),(80,32),(81,32),(82,32),(83,32),(86,32),(87,32),(92,32),(100,32),(101,32),(102,32),(103,32),(104,32),(105,32),(106,32),(107,32),(108,32),(109,32),(110,32),(111,32),(112,32),(113,32),(114,32),(115,32),(116,32),(117,32),(118,32),(119,32),(0,33),(1,33),(2,33),(3,33),(4,33),(5,33),(6,33),(7,33),(8,33),(9,33),(71,33),(72,33),(73,33),(76,33),(77,33),(78,33),(79,33),(80,33),(81,33),(85,33),(86,33),(92,33),(100,33),(101,33),(102,33),(103,33),(104,33),(105,33),(106,33),(107,33),(108,33),(109,33),(110,33),(111,33),(112,33),(113,33),(114,33),(115,33),(116,33),(117,33),(118,33),(119,33),(0,34),(1,34),(2,34),(3,34),(4,34),(5,34),(6,34),(7,34),(8,34),(9,34),(10,34),(70,34),(71,34),(72,34),(73,34),(76,34),(77,34),(78,34),(79,34),(83,34),(84,34),(85,34),(92,34),(100,34),(101,34),(102,34),(103,34),(104,34),(105,34),(106,34),(107,34),(108,34),(110,34),(111,34),(112,34),(116,34),(117,34),(118,34),(119,34),(0,35),(1,35),(2,35),(3,35),(4,35),(5,35),(6,35),(7,35),(8,35),(9,35),(10,35),(66,35),(67,35),(68,35),(69,35),(70,35),(71,35),(72,35),(73,35),(76,35),(77,35),(81,35),(82,35),(83,35),(92,35),(100,35),(101,35),(102,35),(103,35),(104,35),(105,35),(106,35),(107,35),(108,35),(109,35),(110,35),(111,35),(112,35),(119,35),(0,36),(1,36),(2,36),(3,36),(4,36),(5,36),(6,36),(7,36),(8,36),(9,36),(10,36),(66,36),(67,36),(68,36),(69,36),(70,36),(71,36),(79,36),(80,36),(81,36),(91,36),(100,36),(101,36),(102,36),(103,36),(104,36),(105,36),(106,36),(107,36),(108,36),(109,36),(110,36),(111,36),(112,36),(113,36),(114,36),(115,36),(117,36),(118,36),(119,36),(0,37),(1,37),(2,37),(4,37),(5,37),(6,37),(7,37),(8,37),(9,37),(10,37),(32,37),(33,37),(34,37),(66,37),(67,37),(68,37),(69,37),(70,37),(78,37),(79,37),(90,37),(100,37),(101,37),(102,37),(103,37),(104,37),(105,37),(106,37),(107,37),(108,37),(109,37),(110,37),(111,37),(112,37),(113,37),(114,37),(115,37),(116,37),(117,37),(118,37),(119,37),(0,38),(1,38),(2,38),(3,38),(4,38),(5,38),(6,38),(7,38),(8,38),(9,38),(10,38),(32,38),(33,38),(34,38),(66,38),(67,38),(68,38),(69,38),(77,38),(78,38),(89,38),(100,38),(101,38),(102,38),(103,38),(104,38),(105,38),(106,38),(107,38),(108,38),(109,38),(110,38),(111,38),(112,38),(113,38),(114,38),(115,38),(116,38),(117,38),(118,38),(119,38),(0,39),(1,39),(2,39),(3,39),(4,39),(5,39),(6,39),(7,39),(8,39),(9,39),(10,39),(66,39),(71,39),(72,39),(73,39),(74,39),(75,39),(76,39),(77,39),(87,39),(88,39),(100,39),(101,39),(102,39),(103,39),(104,39),(105,39),(106,39),(107,39),(108,39),(109,39),(110,39),(111,39),(112,39),(113,39),(114,39),(115,39),(116,39),(117,39),(118,39),(119,39),(1,40),(5,40),(6,40),(7,40),(8,40),(9,40),(10,40),(11,40),(12,40),(13,40),(14,40),(25,40),(26,40),(27,40),(28,40),(29,40),(30,40),(31,40),(32,40),(33,40),(34,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(66,40),(69,40),(70,40),(71,40),(85,40),(86,40),(102,40),(103,40),(104,40),(105,40),(106,40),(107,40),(108,40),(109,40),(110,40),(111,40),(112,40),(113,40),(114,40),(115,40),(116,40),(117,40),(118,40),(119,40),(1,41),(7,41),(8,41),(9,41),(10,41),(11,41),(12,41),(14,41),(15,41),(22,41),(23,41),(24,41),(26,41),(28,41),(32,41),(33,41),(34,41),(35,41),(36,41),(39,41),(40,41),(41,41),(42,41),(43,41),(45,41),(46,41),(47,41),(50,41),(51,41),(52,41),(66,41),(68,41),(69,41),(83,41),(84,41),(103,41),(108,41),(111,41),(114,41),(115,41),(116,41),(119,41),(4,42),(5,42),(6,42),(7,42),(8,42),(9,42),(10,42),(11,42),(12,42),(13,42),(14,42),(15,42),(16,42),(21,42),(22,42),(23,42),(24,42),(25,42),(26,42),(27,42),(28,42),(29,42),(30,42),(31,42),(32,42),(33,42),(34,42),(35,42),(36,42),(37,42),(38,42),(39,42),(40,42),(41,42),(42,42),(43,42),(44,42),(45,42),(46,42),(47,42),(49,42),(50,42),(66,42),(68,42),(81,42),(82,42),(103,42),(111,42),(112,42),(114,42),(115,42),(117,42),(118,42),(119,42),(1,43),(4,43),(5,43),(6,43),(7,43),(8,43),(9,43),(10,43),(14,43),(15,43),(16,43),(17,43),(18,43),(19,43),(21,43),(22,43),(23,43),(24,43),(25,43),(26,43),(27,43),(28,43),(29,43),(30,43),(31,43),(32,43),(33,43),(34,43),(35,43),(36,43),(37,43),(38,43),(39,43),(40,43),(41,43),(42,43),(43,43),(44,43),(45,43),(46,43),(47,43),(49,43),(50,43),(66,43),(68,43),(76,43),(77,43),(78,43),(79,43),(80,43),(103,43),(111,43),(112,43),(113,43),(117,43),(118,43),(119,43),(4,44),(5,44),(7,44),(8,44),(9,44),(10,44),(12,44),(14,44),(15,44),(16,44),(17,44),(18,44),(19,44),(21,44),(22,44),(23,44),(24,44),(25,44),(26,44),(27,44),(28,44),(29,44),(30,44),(31,44),(32,44),(33,44),(34,44),(35,44),(36,44),(37,44),(38,44),(39,44),(40,44),(41,44),(42,44),(43,44),(44,44),(45,44),(46,44),(47,44),(49,44),(50,44),(66,44),(68,44),(75,44),(111,44),(112,44),(117,44),(118,44),(119,44),(0,45),(5,45),(6,45),(7,45),(8,45),(9,45),(10,45),(11,45),(12,45),(13,45),(14,45),(15,45),(16,45),(17,45),(18,45),(19,45),(21,45),(22,45),(23,45),(24,45),(25,45),(26,45),(27,45),(28,45),(29,45),(30,45),(31,45),(32,45),(33,45),(34,45),(35,45),(36,45),(37,45),(38,45),(39,45),(40,45),(41,45),(42,45),(43,45),(44,45),(45,45),(46,45),(47,45),(49,45),(50,45),(66,45),(68,45),(74,45),(91,45),(92,45),(93,45),(94,45),(95,45),(96,45),(97,45),(98,45),(99,45),(100,45),(111,45),(112,45),(113,45),(117,45),(118,45),(119,45),(6,46),(7,46),(8,46),(9,46),(10,46),(11,46),(12,46),(13,46),(14,46),(15,46),(16,46),(17,46),(18,46),(19,46),(21,46),(22,46),(23,46),(24,46),(25,46),(26,46),(27,46),(28,46),(29,46),(30,46),(31,46),(32,46),(33,46),(34,46),(35,46),(36,46),(37,46),(38,46),(39,46),(40,46),(41,46),(42,46),(43,46),(44,46),(45,46),(46,46),(47,46),(49,46),(50,46),(66,46),(68,46),(74,46),(91,46),(92,46),(93,46),(94,46),(95,46),(96,46),(97,46),(98,46),(99,46),(100,46),(102,46),(103,46),(104,46),(105,46),(106,46),(107,46),(108,46),(109,46),(110,46),(111,46),(112,46),(113,46),(114,46),(117,46),(118,46),(119,46),(0,47),(1,47),(2,47),(3,47),(4,47),(5,47),(6,47),(7,47),(8,47),(9,47),(10,47),(11,47),(12,47),(13,47),(14,47),(15,47),(16,47),(17,47),(18,47),(19,47),(22,47),(23,47),(24,47),(25,47),(26,47),(27,47),(28,47),(29,47),(30,47),(31,47),(32,47),(33,47),(34,47),(35,47),(36,47),(37,47),(38,47),(39,47),(40,47),(41,47),(42,47),(43,47),(44,47),(45,47),(46,47),(47,47),(49,47),(50,47),(66,47),(68,47),(74,47),(91,47),(92,47),(93,47),(94,47),(95,47),(96,47),(97,47),(98,47),(99,47),(100,47),(101,47),(102,47),(103,47),(104,47),(105,47),(106,47),(107,47),(108,47),(109,47),(110,47),(111,47),(112,47),(113,47),(114,47),(115,47),(116,47),(117,47),(118,47),(119,47),(0,48),(1,48),(2,48),(3,48),(4,48),(5,48),(6,48),(7,48),(8,48),(9,48),(10,48),(11,48),(12,48),(13,48),(14,48),(15,48),(16,48),(17,48),(18,48),(19,48),(35,48),(36,48),(37,48),(38,48),(39,48),(40,48),(41,48),(42,48),(49,48),(50,48),(51,48),(52,48),(54,48),(55,48),(56,48),(57,48),(58,48),(59,48),(63,48),(64,48),(66,48),(68,48),(74,48),(75,48),(84,48),(85,48),(86,48),(87,48),(91,48),(92,48),(93,48),(94,48),(95,48),(96,48),(97,48),(98,48),(99,48),(100,48),(102,48),(103,48),(104,48),(105,48),(106,48),(107,48),(108,48),(109,48),(110,48),(111,48),(112,48),(113,48),(114,48),(115,48),(116,48),(118,48),(119,48),(0,49),(1,49),(2,49),(3,49),(4,49),(5,49),(6,49),(7,49),(8,49),(9,49),(10,49),(11,49),(12,49),(13,49),(14,49),(15,49),(16,49),(17,49),(18,49),(49,49),(50,49),(51,49),(52,49),(53,49),(54,49),(55,49),(56,49),(57,49),(58,49),(59,49),(60,49),(61,49),(62,49),(63,49),(64,49),(65,49),(66,49),(68,49),(75,49),(76,49),(84,49),(85,49),(86,49),(87,49),(91,49),(92,49),(93,49),(94,49),(95,49),(96,49),(97,49),(98,49),(99,49),(100,49),(102,49),(103,49),(104,49),(105,49),(106,49),(107,49),(108,49),(109,49),(110,49),(111,49),(112,49),(113,49),(114,49),(115,49),(116,49),(117,49),(0,50),(1,50),(2,50),(3,50),(4,50),(5,50),(6,50),(7,50),(8,50),(9,50),(10,50),(11,50),(12,50),(13,50),(14,50),(15,50),(16,50),(35,50),(36,50),(37,50),(38,50),(39,50),(40,50),(41,50),(42,50),(43,50),(44,50),(45,50),(46,50),(47,50),(49,50),(50,50),(51,50),(52,50),(53,50),(54,50),(55,50),(56,50),(57,50),(58,50),(59,50),(60,50),(61,50),(62,50),(63,50),(64,50),(65,50),(66,50),(69,50),(76,50),(77,50),(91,50),(92,50),(93,50),(94,50),(95,50),(96,50),(97,50),(98,50),(99,50),(100,50),(102,50),(103,50),(104,50),(105,50),(106,50),(107,50),(108,50),(109,50),(110,50),(111,50),(115,50),(116,50),(117,50),(0,51),(1,51),(2,51),(3,51),(4,51),(5,51),(6,51),(7,51),(8,51),(9,51),(10,51),(11,51),(33,51),(34,51),(35,51),(36,51),(37,51),(38,51),(39,51),(40,51),(41,51),(42,51),(43,51),(44,51),(45,51),(46,51),(47,51),(49,51),(50,51),(51,51),(52,51),(53,51),(54,51),(55,51),(57,51),(58,51),(59,51),(60,51),(61,51),(62,51),(63,51),(64,51),(65,51),(66,51),(70,51),(77,51),(90,51),(91,51),(92,51),(93,51),(94,51),(97,51),(98,51),(99,51),(100,51),(101,51),(102,51),(103,51),(104,51),(105,51),(106,51),(107,51),(108,51),(109,51),(110,51),(111,51),(115,51),(116,51),(117,51),(0,52),(1,52),(2,52),(3,52),(4,52),(5,52),(6,52),(7,52),(8,52),(9,52),(10,52),(33,52),(34,52),(35,52),(36,52),(37,52),(38,52),(39,52),(40,52),(41,52),(42,52),(43,52),(44,52),(45,52),(46,52),(47,52),(50,52),(51,52),(52,52),(53,52),(54,52),(55,52),(57,52),(58,52),(60,52),(61,52),(62,52),(63,52),(64,52),(65,52),(66,52),(70,52),(71,52),(72,52),(73,52),(74,52),(75,52),(76,52),(77,52),(90,52),(101,52),(102,52),(103,52),(104,52),(105,52),(107,52),(109,52),(111,52),(115,52),(116,52),(117,52),(119,52),(24,53),(33,53),(34,53),(35,53),(36,53),(37,53),(38,53),(39,53),(40,53),(41,53),(42,53),(43,53),(44,53),(45,53),(46,53),(47,53),(111,53),(114,53),(115,53),(116,53),(117,53),(118,53),(119,53),(30,54),(31,54),(33,54),(34,54),(35,54),(36,54),(37,54),(38,54),(39,54),(40,54),(41,54),(42,54),(43,54),(44,54),(45,54),(46,54),(47,54),(102,54),(103,54),(104,54),(105,54),(106,54),(107,54),(108,54),(109,54),(110,54),(111,54),(112,54),(113,54),(114,54),(115,54),(118,54),(119,54),(30,55),(31,55),(33,55),(34,55),(35,55),(36,55),(37,55),(38,55),(39,55),(40,55),(41,55),(42,55),(43,55),(44,55),(45,55),(46,55),(47,55),(70,55),(71,55),(72,55),(73,55),(74,55),(75,55),(76,55),(77,55),(105,55),(106,55),(107,55),(110,55),(111,55),(112,55),(113,55),(114,55),(115,55),(116,55),(0,56),(1,56),(2,56),(3,56),(4,56),(5,56),(6,56),(7,56),(8,56),(9,56),(10,56),(11,56),(12,56),(13,56),(15,56),(16,56),(33,56),(34,56),(35,56),(37,56),(38,56),(39,56),(40,56),(41,56),(42,56),(43,56),(44,56),(45,56),(46,56),(47,56),(51,56),(52,56),(53,56),(54,56),(55,56),(56,56),(57,56),(58,56),(70,56),(77,56),(110,56),(111,56),(112,56),(113,56),(114,56),(115,56),(116,56),(2,57),(3,57),(15,57),(16,57),(63,57),(70,57),(77,57),(111,57),(114,57),(115,57),(116,57),(0,58),(1,58),(2,58),(15,58),(16,58),(70,58),(77,58),(78,58),(111,58),(115,58),(116,58),(119,58),(1,59),(2,59),(15,59),(54,59),(55,59),(56,59),(57,59),(58,59),(59,59),(60,59),(61,59),(62,59),(70,59),(78,59),(79,59),(80,59),(81,59),(82,59),(111,59),(115,59),(117,59),(118,59),(1,60),(2,60),(15,60),(17,60),(18,60),(19,60),(20,60),(52,60),(54,60),(55,60),(56,60),(57,60),(58,60),(59,60),(60,60),(61,60),(62,60),(70,60),(82,60),(83,60),(111,60),(115,60),(117,60),(118,60),(1,61),(2,61),(15,61),(17,61),(18,61),(19,61),(20,61),(24,61),(54,61),(55,61),(56,61),(57,61),(58,61),(59,61),(60,61),(61,61),(62,61),(71,61),(83,61),(84,61),(111,61),(112,61),(114,61),(115,61),(0,62),(1,62),(2,62),(15,62),(17,62),(18,62),(19,62),(54,62),(55,62),(56,62),(57,62),(58,62),(59,62),(60,62),(61,62),(62,62),(63,62),(64,62),(65,62),(72,62),(84,62),(85,62),(111,62),(112,62),(113,62),(114,62),(115,62),(119,62),(1,63),(2,63),(6,63),(7,63),(15,63),(17,63),(18,63),(49,63),(52,63),(54,63),(55,63),(56,63),(57,63),(58,63),(59,63),(60,63),(61,63),(62,63),(64,63),(65,63),(73,63),(74,63),(75,63),(76,63),(85,63),(111,63),(112,63),(113,63),(114,63),(119,63),(1,64),(2,64),(6,64),(7,64),(15,64),(77,64),(85,64),(89,64),(90,64),(91,64),(92,64),(93,64),(94,64),(95,64),(96,64),(97,64),(98,64),(99,64),(100,64),(101,64),(102,64),(103,64),(104,64),(105,64),(111,64),(112,64),(113,64),(114,64),(117,64),(118,64),(119,64),(1,65),(2,65),(15,65),(78,65),(85,65),(89,65),(91,65),(96,65),(97,65),(101,65),(102,65),(105,65),(110,65),(111,65),(112,65),(113,65),(114,65),(117,65),(118,65),(119,65),(1,66),(2,66),(3,66),(4,66),(15,66),(39,66),(51,66),(52,66),(53,66),(54,66),(55,66),(65,66),(69,66),(70,66),(71,66),(72,66),(73,66),(74,66),(75,66),(76,66),(79,66),(85,66),(89,66),(90,66),(96,66),(97,66),(98,66),(100,66),(102,66),(105,66),(111,66),(112,66),(113,66),(118,66),(119,66),(0,67),(1,67),(2,67),(3,67),(4,67),(15,67),(21,67),(51,67),(52,67),(53,67),(54,67),(55,67),(69,67),(70,67),(71,67),(72,67),(73,67),(74,67),(75,67),(76,67),(80,67),(85,67),(89,67),(93,67),(94,67),(99,67),(100,67),(102,67),(103,67),(104,67),(105,67),(111,67),(112,67),(113,67),(114,67),(117,67),(118,67),(119,67),(0,68),(2,68),(3,68),(4,68),(15,68),(16,68),(38,68),(40,68),(41,68),(42,68),(43,68),(44,68),(45,68),(46,68),(51,68),(52,68),(53,68),(54,68),(55,68),(63,68),(69,68),(70,68),(71,68),(72,68),(73,68),(74,68),(75,68),(76,68),(80,68),(85,68),(89,68),(93,68),(94,68),(99,68),(100,68),(105,68),(111,68),(112,68),(113,68),(114,68),(115,68),(116,68),(117,68),(118,68),(119,68),(4,69),(15,69),(40,69),(41,69),(42,69),(43,69),(44,69),(45,69),(46,69),(47,69),(51,69),(53,69),(55,69),(74,69),(75,69),(79,69),(80,69),(85,69),(89,69),(97,69),(100,69),(111,69),(115,69),(116,69),(117,69),(118,69),(119,69),(4,70),(40,70),(41,70),(42,70),(43,70),(44,70),(45,70),(46,70),(47,70),(51,70),(52,70),(53,70),(54,70),(55,70),(78,70),(79,70),(84,70),(89,70),(96,70),(101,70),(102,70),(103,70),(104,70),(105,70),(111,70),(115,70),(116,70),(117,70),(118,70),(119,70),(4,71),(5,71),(17,71),(18,71),(20,71),(40,71),(41,71),(42,71),(43,71),(44,71),(46,71),(53,71),(57,71),(74,71),(78,71),(83,71),(89,71),(91,71),(92,71),(105,71),(111,71),(115,71),(116,71),(117,71),(118,71),(119,71),(4,72),(5,72),(17,72),(18,72),(62,72),(77,72),(78,72),(83,72),(89,72),(90,72),(91,72),(92,72),(97,72),(101,72),(103,72),(104,72),(105,72),(111,72),(117,72),(118,72),(119,72),(3,73),(4,73),(5,73),(16,73),(76,73),(77,73),(83,73),(89,73),(93,73),(94,73),(95,73),(99,73),(103,73),(104,73),(105,73),(111,73),(112,73),(113,73),(117,73),(118,73),(119,73),(0,74),(1,74),(2,74),(3,74),(4,74),(75,74),(76,74),(83,74),(89,74),(90,74),(91,74),(92,74),(93,74),(94,74),(95,74),(96,74),(97,74),(98,74),(99,74),(100,74),(101,74),(102,74),(103,74),(104,74),(105,74),(111,74),(112,74),(113,74),(117,74),(118,74),(119,74),(0,75),(1,75),(2,75),(3,75),(4,75),(17,75),(27,75),(30,75),(55,75),(56,75),(57,75),(58,75),(59,75),(60,75),(61,75),(62,75),(63,75),(64,75),(65,75),(66,75),(67,75),(75,75),(83,75),(111,75),(118,75),(119,75),(3,76),(4,76),(42,76),(43,76),(44,76),(55,76),(67,76),(73,76),(74,76),(75,76),(82,76),(112,76),(117,76),(118,76),(119,76),(0,77),(1,77),(2,77),(3,77),(4,77),(5,77),(6,77),(7,77),(8,77),(9,77),(10,77),(11,77),(12,77),(13,77),(14,77),(15,77),(17,77),(33,77),(34,77),(35,77),(42,77),(43,77),(44,77),(45,77),(55,77),(67,77),(73,77),(81,77),(91,77),(92,77),(93,77),(94,77),(95,77),(111,77),(115,77),(116,77),(117,77),(118,77),(119,77),(0,78),(1,78),(2,78),(3,78),(4,78),(5,78),(17,78),(33,78),(34,78),(35,78),(41,78),(46,78),(55,78),(66,78),(67,78),(72,78),(73,78),(80,78),(91,78),(92,78),(93,78),(94,78),(95,78),(96,78),(97,78),(98,78),(99,78),(100,78),(101,78),(102,78),(103,78),(111,78),(115,78),(116,78),(3,79),(5,79),(17,79),(41,79),(46,79),(55,79),(56,79),(71,79),(72,79),(79,79),(91,79),(92,79),(93,79),(94,79),(95,79),(102,79),(103,79),(105,79),(106,79),(107,79),(111,79),(112,79),(114,79),(115,79),(3,80),(4,80),(5,80),(7,80),(8,80),(9,80),(10,80),(11,80),(12,80),(13,80),(14,80),(17,80),(55,80),(56,80),(64,80),(65,80),(66,80),(67,80),(68,80),(71,80),(78,80),(91,80),(92,80),(93,80),(94,80),(95,80),(96,80),(97,80),(98,80),(99,80),(100,80),(101,80),(102,80),(103,80),(111,80),(112,80),(113,80),(114,80),(115,80),(3,81),(4,81),(5,81),(7,81),(8,81),(9,81),(10,81),(11,81),(12,81),(13,81),(14,81),(17,81),(55,81),(56,81),(57,81),(58,81),(59,81),(60,81),(61,81),(62,81),(63,81),(64,81),(65,81),(66,81),(67,81),(68,81),(70,81),(71,81),(77,81),(90,81),(91,81),(92,81),(93,81),(94,81),(95,81),(111,81),(112,81),(113,81),(117,81),(118,81),(119,81),(0,82),(1,82),(2,82),(3,82),(5,82),(7,82),(8,82),(9,82),(10,82),(11,82),(12,82),(13,82),(14,82),(17,82),(55,82),(56,82),(57,82),(58,82),(59,82),(60,82),(61,82),(62,82),(63,82),(64,82),(65,82),(66,82),(67,82),(68,82),(70,82),(76,82),(90,82),(91,82),(111,82),(112,82),(113,82),(114,82),(117,82),(118,82),(119,82),(0,83),(1,83),(2,83),(3,83),(5,83),(7,83),(8,83),(9,83),(10,83),(11,83),(12,83),(13,83),(14,83),(17,83),(55,83),(56,83),(57,83),(58,83),(59,83),(60,83),(61,83),(62,83),(63,83),(64,83),(65,83),(66,83),(67,83),(68,83),(70,83),(76,83),(111,83),(112,83),(113,83),(114,83),(117,83),(118,83),(119,83),(0,84),(1,84),(2,84),(3,84),(5,84),(7,84),(8,84),(9,84),(10,84),(11,84),(12,84),(13,84),(14,84),(17,84),(19,84),(20,84),(21,84),(22,84),(23,84),(24,84),(25,84),(26,84),(39,84),(56,84),(57,84),(58,84),(59,84),(60,84),(61,84),(62,84),(63,84),(64,84),(65,84),(66,84),(67,84),(68,84),(70,84),(76,84),(96,84),(97,84),(98,84),(99,84),(100,84),(101,84),(102,84),(103,84),(104,84),(105,84),(106,84),(107,84),(108,84),(111,84),(112,84),(113,84),(114,84),(118,84),(119,84),(0,85),(1,85),(2,85),(3,85),(4,85),(5,85),(7,85),(8,85),(9,85),(10,85),(11,85),(12,85),(13,85),(14,85),(17,85),(19,85),(20,85),(21,85),(22,85),(23,85),(24,85),(25,85),(26,85),(39,85),(42,85),(56,85),(57,85),(58,85),(59,85),(60,85),(61,85),(62,85),(63,85),(64,85),(65,85),(66,85),(67,85),(68,85),(70,85),(76,85),(85,85),(86,85),(96,85),(99,85),(100,85),(101,85),(102,85),(103,85),(104,85),(105,85),(106,85),(107,85),(108,85),(111,85),(118,85),(119,85),(0,86),(1,86),(2,86),(3,86),(4,86),(5,86),(11,86),(13,86),(14,86),(17,86),(19,86),(20,86),(21,86),(22,86),(23,86),(24,86),(25,86),(26,86),(39,86),(47,86),(51,86),(53,86),(56,86),(57,86),(60,86),(62,86),(63,86),(64,86),(70,86),(76,86),(77,86),(85,86),(86,86),(96,86),(99,86),(100,86),(101,86),(102,86),(103,86),(104,86),(105,86),(106,86),(107,86),(108,86),(111,86),(115,86),(116,86),(0,87),(1,87),(2,87),(3,87),(5,87),(16,87),(17,87),(19,87),(20,87),(21,87),(22,87),(23,87),(24,87),(25,87),(26,87),(39,87),(53,87),(60,87),(61,87),(62,87),(63,87),(64,87),(67,87),(68,87),(70,87),(71,87),(77,87),(78,87),(85,87),(86,87),(96,87),(99,87),(100,87),(101,87),(102,87),(103,87),(104,87),(105,87),(106,87),(107,87),(108,87),(111,87),(115,87),(116,87),(0,88),(1,88),(2,88),(3,88),(5,88),(6,88),(7,88),(8,88),(19,88),(20,88),(21,88),(22,88),(23,88),(24,88),(25,88),(26,88),(33,88),(34,88),(39,88),(53,88),(67,88),(72,88),(73,88),(78,88),(79,88),(80,88),(81,88),(96,88),(99,88),(100,88),(101,88),(102,88),(103,88),(104,88),(105,88),(106,88),(107,88),(108,88),(111,88),(112,88),(115,88),(116,88),(5,89),(17,89),(19,89),(22,89),(23,89),(24,89),(25,89),(27,89),(33,89),(34,89),(39,89),(53,89),(67,89),(74,89),(81,89),(96,89),(99,89),(100,89),(101,89),(102,89),(103,89),(105,89),(106,89),(107,89),(108,89),(111,89),(112,89),(113,89),(114,89),(115,89),(116,89),(117,89),(119,89),(42,90),(53,90),(66,90),(67,90),(69,90),(70,90),(71,90),(75,90),(81,90),(86,90),(87,90),(89,90),(96,90),(107,90),(108,90),(111,90),(112,90),(113,90),(114,90),(115,90),(116,90),(117,90),(118,90),(119,90),(53,91),(67,91),(69,91),(70,91),(71,91),(75,91),(81,91),(82,91),(86,91),(87,91),(89,91),(108,91),(111,91),(112,91),(113,91),(114,91),(115,91),(116,91),(117,91),(118,91),(119,91),(53,92),(57,92),(58,92),(59,92),(60,92),(61,92),(62,92),(63,92),(64,92),(65,92),(66,92),(67,92),(75,92),(82,92),(85,92),(86,92),(87,92),(88,92),(89,92),(94,92),(111,92),(112,92),(113,92),(118,92),(119,92),(30,93),(31,93),(32,93),(33,93),(34,93),(35,93),(36,93),(37,93),(38,93),(39,93),(51,93),(52,93),(75,93),(76,93),(77,93),(78,93),(79,93),(80,93),(81,93),(82,93),(111,93),(112,93),(113,93),(118,93),(119,93),(0,94),(1,94),(2,94),(3,94),(4,94),(5,94),(6,94),(7,94),(8,94),(9,94),(30,94),(39,94),(51,94),(52,94),(105,94),(111,94),(112,94),(118,94),(119,94),(9,95),(10,95),(11,95),(12,95),(13,95),(30,95),(34,95),(35,95),(39,95),(111,95),(112,95),(113,95),(117,95),(13,96),(14,96),(25,96),(26,96),(30,96),(32,96),(34,96),(35,96),(39,96),(75,96),(76,96),(77,96),(78,96),(79,96),(80,96),(81,96),(82,96),(88,96),(111,96),(112,96),(115,96),(116,96),(117,96),(14,97),(15,97),(16,97),(17,97),(18,97),(19,97),(25,97),(26,97),(30,97),(31,97),(39,97),(58,97),(75,97),(82,97),(111,97),(112,97),(113,97),(114,97),(115,97),(116,97),(117,97),(118,97),(119,97),(19,98),(20,98),(30,98),(39,98),(75,98),(82,98),(92,98),(93,98),(94,98),(95,98),(96,98),(97,98),(98,98),(99,98),(100,98),(101,98),(102,98),(103,98),(104,98),(105,98),(106,98),(107,98),(108,98),(109,98),(110,98),(111,98),(112,98),(117,98),(119,98),(20,99),(21,99),(30,99),(31,99),(32,99),(33,99),(36,99),(37,99),(38,99),(39,99),(75,99),(82,99),(88,99),(92,99),(95,99),(96,99),(99,99),(100,99),(101,99),(102,99),(113,99),(117,99),(118,99),(119,99),(21,100),(75,100),(82,100),(92,100),(93,100),(94,100),(95,100),(96,100),(97,100),(98,100),(99,100),(113,100),(117,100),(21,101),(22,101),(23,101),(24,101),(25,101),(26,101),(27,101),(28,101),(43,101),(44,101),(52,101),(56,101),(58,101),(59,101),(60,101),(61,101),(62,101),(63,101),(64,101),(65,101),(66,101),(67,101),(68,101),(74,101),(75,101),(82,101),(92,101),(93,101),(94,101),(97,101),(98,101),(99,101),(100,101),(101,101),(102,101),(103,101),(106,101),(107,101),(108,101),(111,101),(112,101),(113,101),(117,101),(28,102),(29,102),(30,102),(31,102),(32,102),(33,102),(34,102),(35,102),(36,102),(37,102),(38,102),(43,102),(44,102),(47,102),(48,102),(49,102),(50,102),(51,102),(52,102),(55,102),(57,102),(58,102),(68,102),(69,102),(70,102),(71,102),(72,102),(73,102),(74,102),(82,102),(83,102),(92,102),(93,102),(94,102),(99,102),(100,102),(101,102),(102,102),(103,102),(104,102),(105,102),(106,102),(107,102),(108,102),(109,102),(110,102),(111,102),(117,102),(38,103),(39,103),(40,103),(41,103),(42,103),(43,103),(44,103),(45,103),(46,103),(47,103),(51,103),(52,103),(55,103),(83,103),(84,103),(92,103),(99,103),(103,103),(104,103),(105,103),(107,103),(108,103),(109,103),(110,103),(111,103),(115,103),(117,103),(0,104),(1,104),(2,104),(51,104),(52,104),(55,104),(77,104),(78,104),(79,104),(84,104),(85,104),(86,104),(87,104),(88,104),(89,104),(90,104),(92,104),(93,104),(94,104),(99,104),(107,104),(110,104),(111,104),(112,104),(113,104),(114,104),(118,104),(3,105),(4,105),(5,105),(6,105),(7,105),(8,105),(9,105),(10,105),(11,105),(12,105),(13,105),(14,105),(15,105),(16,105),(51,105),(52,105),(55,105),(59,105),(60,105),(61,105),(62,105),(76,105),(77,105),(78,105),(79,105),(80,105),(90,105),(91,105),(92,105),(93,105),(94,105),(95,105),(107,105),(108,105),(109,105),(119,105),(3,106),(4,106),(5,106),(6,106),(7,106),(8,106),(9,106),(11,106),(17,106),(18,106),(19,106),(20,106),(21,106),(22,106),(49,106),(50,106),(51,106),(52,106),(55,106),(57,106),(58,106),(63,106),(64,106),(65,106),(72,106),(73,106),(74,106),(75,106),(76,106),(80,106),(81,106),(91,106),(92,106),(93,106),(94,106),(95,106),(96,106),(97,106),(98,106),(99,106),(100,106),(102,106),(108,106),(109,106),(7,107),(19,107),(23,107),(24,107),(25,107),(26,107),(27,107),(28,107),(29,107),(30,107),(31,107),(32,107),(33,107),(34,107),(35,107),(36,107),(48,107),(51,107),(52,107),(55,107),(56,107),(60,107),(61,107),(62,107),(66,107),(67,107),(68,107),(69,107),(70,107),(71,107),(72,107),(73,107),(76,107),(80,107),(81,107),(82,107),(83,107),(84,107),(92,107),(93,107),(96,107),(97,107),(99,107),(101,107),(104,107),(105,107),(109,107),(14,108),(15,108),(16,108),(17,108),(23,108),(24,108),(25,108),(26,108),(27,108),(28,108),(29,108),(30,108),(31,108),(32,108),(33,108),(34,108),(35,108),(36,108),(37,108),(38,108),(39,108),(40,108),(41,108),(42,108),(43,108),(44,108),(45,108),(46,108),(47,108),(48,108),(49,108),(51,108),(56,108),(57,108),(58,108),(60,108),(61,108),(62,108),(72,108),(73,108),(76,108),(81,108),(82,108),(83,108),(84,108),(85,108),(86,108),(93,108),(94,108),(104,108),(105,108),(109,108),(110,108),(111,108),(112,108),(113,108),(116,108),(117,108),(3,109),(4,109),(5,109),(15,109),(16,109),(23,109),(24,109),(25,109),(26,109),(27,109),(28,109),(29,109),(32,109),(33,109),(34,109),(35,109),(36,109),(37,109),(38,109),(39,109),(40,109),(41,109),(42,109),(43,109),(44,109),(45,109),(46,109),(47,109),(48,109),(49,109),(51,109),(52,109),(56,109),(57,109),(58,109),(72,109),(73,109),(76,109),(81,109),(82,109),(83,109),(84,109),(85,109),(86,109),(87,109),(94,109),(104,109),(105,109),(109,109),(110,109),(111,109),(112,109),(113,109),(114,109),(115,109),(116,109),(117,109)}
location.terrainFeatures = {(0,93),(1,93),(3,89),(4,89),(4,93),(5,93),(6,93),(5,19),(6,19),(5,26),(6,26),(5,68),(6,68),(7,68),(5,74),(6,74),(5,76),(6,76),(7,76),(7,29),(11,9),(12,9),(13,9),(11,58),(12,58),(13,58),(12,51),(13,51),(12,76),(13,76),(14,76),(13,21),(14,21),(15,71),(16,71),(17,26),(18,26),(19,26),(18,73),(19,73),(20,73),(19,59),(20,59),(19,70),(20,70),(19,94),(20,94),(21,94),(20,8),(21,8),(21,17),(22,17),(23,17),(21,33),(22,33),(21,60),(22,60),(23,60),(22,21),(23,21),(24,21),(24,16),(25,16),(27,33),(28,33),(29,33),(28,14),(29,14),(30,14),(28,20),(29,20),(31,12),(32,12),(32,98),(33,98),(33,9),(33,15),(34,15),(33,24),(34,24),(35,24),(33,31),(34,31),(35,31),(34,12),(35,12),(34,17),(34,27),(35,27),(35,18),(36,95),(37,95),(38,95),(38,9),(39,9),(40,9),(38,71),(39,71),(39,76),(40,76),(41,76),(39,79),(40,79),(39,90),(40,90),(41,90),(40,11),(41,11),(40,64),(41,64),(42,64),(40,84),(41,84),(42,84),(40,100),(41,100),(41,19),(42,19),(43,19),(41,94),(42,94),(42,75),(43,75),(44,75),(42,93),(43,93),(44,93),(43,12),(43,63),(44,63),(43,84),(44,84),(44,15),(44,21),(45,21),(46,21),(45,19),(46,19),(45,24),(46,24),(45,75),(46,75),(45,84),(46,84),(47,84),(46,76),(47,76),(48,76),(47,79),(48,79),(47,100),(48,100),(49,100),(48,84),(49,84),(48,94),(49,94),(50,94),(49,13),(50,13),(51,13),(50,84),(51,84),(52,84),(50,101),(51,101),(51,42),(52,42),(51,85),(52,85),(54,12),(55,12),(54,42),(56,42),(57,42),(57,10),(58,10),(57,22),(58,22),(59,22),(57,39),(57,44),(57,76),(58,76),(59,76),(57,99),(58,99),(58,24),(59,24),(58,43),(59,43),(59,9),(60,9),(61,9),(59,16),(60,16),(61,16),(59,20),(60,20),(59,36),(59,98),(60,39),(61,39),(60,48),(61,48),(62,48),(60,91),(61,91),(61,42),(62,10),(63,10),(63,40),(63,61),(64,91),(65,91),(65,17),(66,17),(65,20),(65,76),(66,76),(67,97),(68,97),(68,20),(69,20),(68,68),(69,17),(69,65),(70,65),(70,14),(70,98),(71,98),(72,98),(71,19),(72,19),(72,31),(73,17),(74,14),(75,14),(74,19),(75,19),(76,19),(76,10),(76,13),(77,20),(77,30),(78,30),(78,25),(79,29),(81,28),(82,28),(82,11),(83,11),(84,11),(82,13),(83,13),(82,24),(84,12),(85,90),(86,58),(87,58),(88,79),(89,79),(92,60),(93,60),(94,60),(94,87),(95,87),(95,89),(96,91),(97,86),(98,86),(98,76),(99,76),(100,76),(98,90),(99,90),(102,58),(103,58),(104,58),(104,55),(105,42),(106,42),(107,42),(106,90),(107,60),(108,60),(107,91),(108,42),(109,42),(108,55),(109,55),(108,96),(109,96),(109,82),(110,82),(110,68),(110,73),(110,79)};
location.behindbush = {(0,92),(1,92),(3,88),(4,88),(4,92),(5,92),(6,92),(5,18),(6,18),(5,25),(6,25),(5,67),(6,67),(7,67),(5,73),(6,73),(5,75),(6,75),(7,75),(7,28),(11,8),(12,8),(13,8),(11,57),(12,57),(13,57),(12,50),(13,50),(12,75),(13,75),(14,75),(13,20),(14,20),(15,70),(16,70),(17,25),(18,25),(19,25),(18,72),(19,72),(20,72),(19,58),(20,58),(19,69),(20,69),(19,93),(20,93),(21,93),(20,7),(21,7),(21,16),(22,16),(23,16),(21,32),(22,32),(21,59),(22,59),(23,59),(22,20),(23,20),(24,20),(24,15),(25,15),(27,32),(28,32),(29,32),(28,13),(29,13),(30,13),(28,19),(29,19),(31,11),(32,11),(32,97),(33,97),(33,8),(33,14),(34,14),(33,23),(34,23),(35,23),(33,30),(34,30),(35,30),(34,11),(35,11),(34,16),(34,26),(35,26),(35,17),(36,94),(37,94),(38,94),(38,8),(39,8),(40,8),(38,70),(39,70),(39,75),(40,75),(41,75),(39,78),(40,78),(39,89),(40,89),(41,89),(40,10),(41,10),(40,63),(41,63),(42,63),(40,83),(41,83),(42,83),(40,99),(41,99),(41,18),(42,18),(43,18),(41,93),(42,93),(42,74),(43,74),(44,74),(42,92),(43,92),(44,92),(43,11),(43,62),(44,62),(43,83),(44,83),(44,14),(44,20),(45,20),(46,20),(45,18),(46,18),(45,23),(46,23),(45,74),(46,74),(45,83),(46,83),(47,83),(46,75),(47,75),(48,75),(47,78),(48,78),(47,99),(48,99),(49,99),(48,83),(49,83),(48,93),(49,93),(50,93),(49,12),(50,12),(51,12),(50,83),(51,83),(52,83),(50,100),(51,100),(51,41),(52,41),(51,84),(52,84),(54,11),(55,11),(54,41),(56,41),(57,41),(57,9),(58,9),(57,21),(58,21),(59,21),(57,38),(57,43),(57,75),(58,75),(59,75),(57,98),(58,98),(58,23),(59,23),(58,42),(59,42),(59,8),(60,8),(61,8),(59,15),(60,15),(61,15),(59,19),(60,19),(59,35),(59,97),(60,38),(61,38),(60,47),(61,47),(62,47),(60,90),(61,90),(61,41),(62,9),(63,9),(63,39),(63,60),(64,90),(65,90),(65,16),(66,16),(65,19),(65,75),(66,75),(67,96),(68,96),(68,19),(69,19),(68,67),(69,16),(69,64),(70,64),(70,13),(70,97),(71,97),(72,97),(71,18),(72,18),(72,30),(73,16),(74,13),(75,13),(74,18),(75,18),(76,18),(76,9),(76,12),(77,19),(77,29),(78,29),(78,24),(79,28),(81,27),(82,27),(82,10),(83,10),(84,10),(82,12),(83,12),(82,23),(84,11),(85,89),(86,57),(87,57),(88,78),(89,78),(92,59),(93,59),(94,59),(94,86),(95,86),(95,88),(96,90),(97,85),(98,85),(98,75),(99,75),(100,75),(98,89),(99,89),(102,57),(103,57),(104,57),(104,54),(105,41),(106,41),(107,41),(106,89),(107,59),(108,59),(107,90),(108,41),(109,41),(108,54),(109,54),(108,95),(109,95),(109,81),(110,81),(110,67),(110,72),(110,78)};
location.behindtree = {};
location.water = [(91,0),(92,0),(93,0),(94,0),(95,0),(96,0),(97,0),(91,1),(92,1),(93,1),(94,1),(95,1),(96,1),(97,1),(91,2),(92,2),(93,2),(94,2),(95,2),(96,2),(97,2),(80,3),(81,3),(91,3),(92,3),(93,3),(94,3),(95,3),(96,3),(97,3),(80,4),(87,4),(91,4),(92,4),(93,4),(94,4),(95,4),(96,4),(97,4),(91,5),(92,5),(93,5),(94,5),(95,5),(96,5),(97,5),(91,6),(92,6),(93,6),(94,6),(95,6),(96,6),(97,6),(82,7),(91,7),(92,7),(93,7),(94,7),(95,7),(96,7),(97,7),(79,8),(92,8),(93,8),(94,8),(95,8),(96,8),(97,8),(92,9),(93,9),(94,9),(95,9),(96,9),(92,10),(93,10),(94,10),(95,10),(96,10),(78,11),(92,11),(93,11),(94,11),(95,11),(96,11),(92,12),(93,12),(94,12),(95,12),(96,12),(81,13),(92,13),(93,13),(94,13),(95,13),(96,13),(92,14),(93,14),(94,14),(95,14),(96,14),(13,15),(16,15),(77,15),(84,15),(91,15),(92,15),(93,15),(94,15),(95,15),(96,15),(11,16),(15,16),(90,16),(91,16),(92,16),(93,16),(94,16),(95,16),(96,16),(13,17),(77,17),(78,17),(90,17),(91,17),(92,17),(93,17),(94,17),(95,17),(96,17),(10,18),(89,18),(90,18),(91,18),(92,18),(93,18),(94,18),(95,18),(89,19),(90,19),(91,19),(92,19),(93,19),(94,19),(95,19),(9,20),(39,20),(40,20),(89,20),(90,20),(91,20),(92,20),(93,20),(94,20),(102,20),(41,21),(70,21),(89,21),(90,21),(91,21),(92,21),(93,21),(94,21),(25,22),(27,22),(39,22),(40,22),(89,22),(90,22),(91,22),(92,22),(93,22),(8,23),(23,23),(29,23),(39,23),(69,23),(74,23),(75,23),(76,23),(77,23),(78,23),(89,23),(90,23),(91,23),(92,23),(93,23),(22,24),(30,24),(54,24),(55,24),(72,24),(89,24),(90,24),(91,24),(92,24),(93,24),(108,24),(112,24),(8,25),(9,25),(21,25),(25,25),(26,25),(27,25),(28,25),(31,25),(53,25),(89,25),(90,25),(91,25),(92,25),(93,25),(116,25),(11,26),(26,26),(41,26),(89,26),(90,26),(91,26),(92,26),(93,26),(105,26),(117,26),(9,27),(10,27),(12,27),(25,27),(27,27),(39,27),(40,27),(53,27),(54,27),(74,27),(89,27),(90,27),(91,27),(92,27),(93,27),(104,27),(10,28),(11,28),(13,28),(20,28),(75,28),(88,28),(89,28),(90,28),(91,28),(92,28),(93,28),(11,29),(12,29),(19,29),(54,29),(55,29),(76,29),(87,29),(88,29),(89,29),(90,29),(91,29),(92,29),(93,29),(17,30),(22,30),(23,30),(39,30),(70,30),(71,30),(81,30),(87,30),(88,30),(89,30),(90,30),(91,30),(92,30),(93,30),(14,31),(15,31),(20,31),(23,31),(24,31),(25,31),(26,31),(27,31),(28,31),(29,31),(55,31),(56,31),(73,31),(79,31),(87,31),(88,31),(89,31),(90,31),(91,31),(92,31),(12,32),(13,32),(17,32),(18,32),(55,32),(60,32),(61,32),(62,32),(63,32),(75,32),(77,32),(86,32),(87,32),(88,32),(89,32),(90,32),(91,32),(92,32),(41,33),(54,33),(58,33),(63,33),(64,33),(65,33),(66,33),(67,33),(72,33),(75,33),(85,33),(86,33),(87,33),(88,33),(89,33),(90,33),(91,33),(92,33),(104,33),(105,33),(106,33),(108,33),(109,33),(110,33),(114,33),(115,33),(13,34),(14,34),(38,34),(71,34),(75,34),(83,34),(84,34),(85,34),(86,34),(87,34),(88,34),(89,34),(90,34),(91,34),(92,34),(106,34),(17,35),(41,35),(49,35),(70,35),(81,35),(82,35),(83,35),(84,35),(85,35),(86,35),(87,35),(88,35),(89,35),(90,35),(91,35),(92,35),(14,36),(15,36),(16,36),(18,36),(38,36),(39,36),(40,36),(67,36),(79,36),(80,36),(81,36),(82,36),(83,36),(84,36),(85,36),(86,36),(87,36),(88,36),(89,36),(90,36),(91,36),(16,37),(17,37),(19,37),(40,37),(41,37),(46,37),(47,37),(48,37),(51,37),(52,37),(53,37),(78,37),(79,37),(80,37),(81,37),(82,37),(83,37),(84,37),(85,37),(86,37),(87,37),(88,37),(89,37),(90,37),(17,38),(18,38),(20,38),(41,38),(77,38),(78,38),(79,38),(80,38),(81,38),(82,38),(83,38),(84,38),(85,38),(86,38),(87,38),(88,38),(89,38),(18,39),(19,39),(71,39),(72,39),(73,39),(74,39),(75,39),(76,39),(77,39),(78,39),(79,39),(80,39),(81,39),(82,39),(83,39),(84,39),(85,39),(86,39),(87,39),(88,39),(98,39),(99,39),(21,40),(69,40),(70,40),(71,40),(72,40),(73,40),(74,40),(75,40),(76,40),(77,40),(78,40),(79,40),(80,40),(81,40),(82,40),(83,40),(84,40),(85,40),(86,40),(19,41),(20,41),(48,41),(49,41),(68,41),(69,41),(70,41),(71,41),(72,41),(73,41),(74,41),(75,41),(76,41),(77,41),(78,41),(79,41),(80,41),(81,41),(82,41),(83,41),(84,41),(68,42),(69,42),(70,42),(71,42),(72,42),(73,42),(74,42),(75,42),(76,42),(77,42),(78,42),(79,42),(80,42),(81,42),(82,42),(94,42),(68,43),(69,43),(70,43),(71,43),(72,43),(73,43),(74,43),(75,43),(76,43),(77,43),(78,43),(79,43),(80,43),(68,44),(69,44),(70,44),(71,44),(72,44),(73,44),(74,44),(75,44),(91,44),(68,45),(69,45),(70,45),(71,45),(72,45),(73,45),(74,45),(87,45),(88,45),(89,45),(68,46),(69,46),(70,46),(71,46),(72,46),(73,46),(74,46),(85,46),(68,47),(69,47),(70,47),(71,47),(72,47),(73,47),(74,47),(82,47),(83,47),(68,48),(69,48),(70,48),(71,48),(72,48),(73,48),(74,48),(75,48),(5,49),(13,49),(51,49),(55,49),(62,49),(68,49),(69,49),(70,49),(71,49),(72,49),(73,49),(74,49),(75,49),(76,49),(23,50),(26,50),(66,50),(67,50),(69,50),(70,50),(71,50),(72,50),(73,50),(74,50),(75,50),(76,50),(77,50),(70,51),(71,51),(72,51),(73,51),(74,51),(75,51),(76,51),(77,51),(23,52),(65,52),(70,52),(71,52),(72,52),(73,52),(74,52),(75,52),(76,52),(77,52),(51,53),(51,54),(55,54),(56,54),(57,54),(58,54),(59,54),(60,54),(61,54),(62,54),(64,54),(65,54),(66,54),(81,54),(82,54),(83,54),(84,54),(85,54),(86,54),(87,54),(88,54),(66,55),(67,55),(70,55),(71,55),(72,55),(73,55),(74,55),(75,55),(76,55),(77,55),(82,55),(88,55),(89,55),(67,56),(68,56),(70,56),(71,56),(72,56),(73,56),(74,56),(75,56),(76,56),(77,56),(83,56),(89,56),(90,56),(100,56),(101,56),(70,57),(71,57),(72,57),(73,57),(74,57),(75,57),(76,57),(77,57),(90,57),(91,57),(92,57),(93,57),(10,58),(70,58),(71,58),(72,58),(73,58),(74,58),(75,58),(76,58),(77,58),(78,58),(84,58),(93,58),(94,58),(97,58),(7,59),(13,59),(67,59),(70,59),(71,59),(72,59),(73,59),(74,59),(75,59),(76,59),(77,59),(78,59),(79,59),(80,59),(81,59),(82,59),(86,59),(70,60),(71,60),(72,60),(73,60),(74,60),(75,60),(76,60),(77,60),(78,60),(79,60),(80,60),(81,60),(82,60),(83,60),(87,60),(8,61),(9,61),(67,61),(68,61),(71,61),(72,61),(73,61),(74,61),(75,61),(76,61),(77,61),(78,61),(79,61),(80,61),(81,61),(82,61),(83,61),(84,61),(9,62),(10,62),(11,62),(12,62),(72,62),(73,62),(74,62),(75,62),(76,62),(77,62),(78,62),(79,62),(80,62),(81,62),(82,62),(83,62),(84,62),(85,62),(46,63),(47,63),(68,63),(69,63),(70,63),(73,63),(74,63),(75,63),(76,63),(77,63),(78,63),(79,63),(80,63),(81,63),(82,63),(83,63),(84,63),(85,63),(70,64),(71,64),(77,64),(78,64),(79,64),(80,64),(81,64),(82,64),(83,64),(84,64),(85,64),(46,65),(47,65),(48,65),(50,65),(51,65),(52,65),(53,65),(54,65),(55,65),(56,65),(71,65),(72,65),(73,65),(74,65),(75,65),(78,65),(79,65),(80,65),(81,65),(82,65),(83,65),(84,65),(85,65),(75,66),(76,66),(77,66),(78,66),(79,66),(80,66),(81,66),(82,66),(83,66),(84,66),(85,66),(8,67),(65,67),(80,67),(81,67),(82,67),(83,67),(84,67),(85,67),(87,67),(14,68),(71,68),(73,68),(80,68),(81,68),(82,68),(83,68),(84,68),(85,68),(6,69),(10,69),(11,69),(56,69),(57,69),(66,69),(76,69),(79,69),(80,69),(81,69),(82,69),(83,69),(84,69),(85,69),(11,70),(12,70),(13,70),(56,70),(67,70),(68,70),(78,70),(79,70),(80,70),(81,70),(82,70),(83,70),(84,70),(45,71),(78,71),(79,71),(80,71),(81,71),(82,71),(83,71),(6,72),(7,72),(47,72),(53,72),(56,72),(57,72),(77,72),(78,72),(79,72),(80,72),(81,72),(82,72),(83,72),(56,73),(76,73),(77,73),(78,73),(79,73),(80,73),(81,73),(82,73),(83,73),(46,74),(75,74),(76,74),(77,74),(78,74),(79,74),(80,74),(81,74),(82,74),(83,74),(46,75),(47,75),(48,75),(49,75),(59,75),(62,75),(63,75),(64,75),(65,75),(66,75),(67,75),(75,75),(76,75),(77,75),(78,75),(79,75),(80,75),(81,75),(82,75),(83,75),(19,76),(25,76),(73,76),(74,76),(75,76),(76,76),(77,76),(78,76),(79,76),(80,76),(81,76),(82,76),(26,77),(49,77),(73,77),(74,77),(75,77),(76,77),(77,77),(78,77),(79,77),(80,77),(81,77),(18,78),(72,78),(73,78),(74,78),(75,78),(76,78),(77,78),(78,78),(79,78),(80,78),(5,79),(16,79),(24,79),(25,79),(67,79),(68,79),(71,79),(72,79),(73,79),(74,79),(75,79),(76,79),(77,79),(78,79),(79,79),(18,80),(19,80),(68,80),(69,80),(71,80),(72,80),(73,80),(74,80),(75,80),(76,80),(77,80),(78,80),(70,81),(71,81),(72,81),(73,81),(74,81),(75,81),(76,81),(77,81),(83,81),(68,82),(70,82),(71,82),(72,82),(73,82),(74,82),(75,82),(76,82),(68,83),(69,83),(70,83),(71,83),(72,83),(73,83),(74,83),(75,83),(76,83),(53,84),(55,84),(70,84),(71,84),(72,84),(73,84),(74,84),(75,84),(76,84),(92,84),(93,84),(41,85),(44,85),(45,85),(48,85),(53,85),(54,85),(70,85),(71,85),(72,85),(73,85),(74,85),(75,85),(76,85),(91,85),(49,86),(50,86),(52,86),(69,86),(70,86),(71,86),(72,86),(73,86),(74,86),(75,86),(76,86),(77,86),(82,86),(45,87),(46,87),(50,87),(51,87),(71,87),(72,87),(73,87),(74,87),(75,87),(76,87),(77,87),(78,87),(83,87),(90,87),(6,88),(7,88),(8,88),(12,88),(13,88),(14,88),(41,88),(42,88),(43,88),(56,88),(57,88),(58,88),(68,88),(72,88),(73,88),(74,88),(75,88),(76,88),(77,88),(78,88),(79,88),(80,88),(81,88),(8,89),(46,89),(47,89),(49,89),(67,89),(74,89),(75,89),(76,89),(77,89),(78,89),(79,89),(80,89),(81,89),(90,89),(91,89),(93,89),(7,90),(43,90),(45,90),(46,90),(75,90),(76,90),(77,90),(78,90),(79,90),(80,90),(81,90),(84,90),(0,91),(3,91),(4,91),(5,91),(31,91),(41,91),(43,91),(44,91),(50,91),(75,91),(76,91),(77,91),(78,91),(79,91),(80,91),(81,91),(82,91),(0,92),(1,92),(31,92),(32,92),(33,92),(34,92),(35,92),(36,92),(37,92),(38,92),(39,92),(40,92),(75,92),(76,92),(77,92),(78,92),(79,92),(80,92),(81,92),(82,92),(85,92),(90,92),(100,92),(102,92),(10,93),(48,93),(53,93),(75,93),(76,93),(77,93),(78,93),(79,93),(80,93),(81,93),(82,93),(0,94),(1,94),(2,94),(3,94),(4,94),(5,94),(6,94),(7,94),(8,94),(9,94),(14,94),(33,94),(36,94),(0,95),(1,95),(2,95),(3,95),(4,95),(5,95),(6,95),(7,95),(8,95),(9,95),(10,95),(11,95),(12,95),(13,95),(15,95),(56,95),(59,95),(60,95),(61,95),(66,95),(70,95),(71,95),(72,95),(73,95),(86,95),(87,95),(88,95),(92,95),(96,95),(97,95),(0,96),(1,96),(2,96),(3,96),(4,96),(5,96),(6,96),(7,96),(8,96),(9,96),(10,96),(11,96),(12,96),(13,96),(14,96),(20,96),(40,96),(46,96),(47,96),(50,96),(51,96),(52,96),(53,96),(73,96),(74,96),(75,96),(76,96),(77,96),(78,96),(79,96),(80,96),(81,96),(82,96),(0,97),(1,97),(2,97),(3,97),(4,97),(5,97),(6,97),(7,97),(8,97),(9,97),(10,97),(11,97),(12,97),(13,97),(14,97),(15,97),(16,97),(17,97),(18,97),(19,97),(21,97),(33,97),(34,97),(75,97),(76,97),(77,97),(78,97),(79,97),(80,97),(81,97),(82,97),(0,98),(1,98),(2,98),(3,98),(4,98),(5,98),(6,98),(7,98),(8,98),(9,98),(10,98),(11,98),(12,98),(13,98),(14,98),(15,98),(16,98),(17,98),(18,98),(19,98),(20,98),(22,98),(75,98),(76,98),(77,98),(78,98),(79,98),(80,98),(81,98),(82,98),(0,99),(1,99),(2,99),(3,99),(4,99),(5,99),(6,99),(7,99),(8,99),(9,99),(10,99),(11,99),(12,99),(13,99),(14,99),(15,99),(16,99),(17,99),(18,99),(19,99),(20,99),(21,99),(61,99),(67,99),(73,99),(75,99),(76,99),(77,99),(78,99),(79,99),(80,99),(81,99),(82,99),(0,100),(1,100),(2,100),(3,100),(4,100),(5,100),(6,100),(7,100),(8,100),(9,100),(10,100),(11,100),(12,100),(13,100),(14,100),(15,100),(16,100),(17,100),(18,100),(19,100),(20,100),(21,100),(29,100),(52,100),(56,100),(57,100),(75,100),(76,100),(77,100),(78,100),(79,100),(80,100),(81,100),(82,100),(0,101),(1,101),(2,101),(3,101),(4,101),(5,101),(6,101),(7,101),(8,101),(9,101),(10,101),(11,101),(12,101),(13,101),(14,101),(15,101),(16,101),(17,101),(18,101),(19,101),(20,101),(21,101),(22,101),(23,101),(24,101),(25,101),(26,101),(27,101),(28,101),(40,101),(46,101),(58,101),(59,101),(60,101),(61,101),(62,101),(63,101),(64,101),(65,101),(66,101),(67,101),(68,101),(74,101),(75,101),(76,101),(77,101),(78,101),(79,101),(80,101),(81,101),(82,101),(88,101),(0,102),(1,102),(2,102),(3,102),(4,102),(5,102),(6,102),(7,102),(8,102),(9,102),(10,102),(11,102),(12,102),(13,102),(14,102),(15,102),(16,102),(17,102),(18,102),(19,102),(20,102),(21,102),(22,102),(23,102),(24,102),(25,102),(26,102),(27,102),(28,102),(29,102),(30,102),(31,102),(32,102),(33,102),(34,102),(35,102),(36,102),(37,102),(38,102),(47,102),(48,102),(49,102),(50,102),(51,102),(57,102),(58,102),(59,102),(60,102),(61,102),(62,102),(63,102),(64,102),(65,102),(66,102),(67,102),(68,102),(69,102),(70,102),(71,102),(72,102),(73,102),(74,102),(75,102),(76,102),(77,102),(78,102),(79,102),(80,102),(81,102),(82,102),(83,102),(90,102),(0,103),(1,103),(2,103),(3,103),(4,103),(5,103),(6,103),(7,103),(8,103),(9,103),(10,103),(11,103),(12,103),(13,103),(14,103),(15,103),(16,103),(17,103),(18,103),(19,103),(20,103),(21,103),(22,103),(23,103),(24,103),(25,103),(26,103),(27,103),(28,103),(29,103),(30,103),(31,103),(32,103),(33,103),(34,103),(35,103),(36,103),(37,103),(38,103),(39,103),(40,103),(41,103),(42,103),(43,103),(44,103),(45,103),(46,103),(47,103),(48,103),(49,103),(50,103),(51,103),(57,103),(58,103),(59,103),(60,103),(61,103),(62,103),(63,103),(64,103),(65,103),(66,103),(67,103),(68,103),(69,103),(70,103),(71,103),(72,103),(73,103),(74,103),(75,103),(76,103),(77,103),(78,103),(79,103),(80,103),(81,103),(82,103),(83,103),(84,103),(91,103),(0,104),(1,104),(2,104),(3,104),(4,104),(5,104),(6,104),(7,104),(8,104),(9,104),(10,104),(11,104),(12,104),(13,104),(14,104),(15,104),(16,104),(17,104),(18,104),(19,104),(20,104),(21,104),(22,104),(23,104),(24,104),(25,104),(26,104),(27,104),(28,104),(29,104),(30,104),(31,104),(32,104),(33,104),(34,104),(35,104),(36,104),(37,104),(38,104),(39,104),(40,104),(41,104),(42,104),(43,104),(44,104),(45,104),(46,104),(47,104),(48,104),(49,104),(50,104),(51,104),(57,104),(58,104),(59,104),(60,104),(61,104),(62,104),(63,104),(64,104),(65,104),(66,104),(67,104),(68,104),(69,104),(70,104),(71,104),(72,104),(73,104),(74,104),(75,104),(76,104),(77,104),(78,104),(79,104),(80,104),(81,104),(82,104),(83,104),(84,104),(85,104),(86,104),(87,104),(88,104),(89,104),(90,104),(92,104),(3,105),(4,105),(5,105),(6,105),(7,105),(8,105),(9,105),(10,105),(11,105),(12,105),(13,105),(14,105),(15,105),(16,105),(17,105),(18,105),(19,105),(20,105),(21,105),(22,105),(23,105),(24,105),(25,105),(26,105),(27,105),(28,105),(29,105),(30,105),(31,105),(32,105),(33,105),(34,105),(35,105),(36,105),(37,105),(38,105),(39,105),(40,105),(41,105),(42,105),(43,105),(44,105),(45,105),(46,105),(47,105),(48,105),(49,105),(50,105),(51,105),(57,105),(58,105),(59,105),(60,105),(61,105),(62,105),(63,105),(64,105),(65,105),(66,105),(67,105),(68,105),(69,105),(70,105),(71,105),(72,105),(73,105),(74,105),(75,105),(76,105),(80,105),(81,105),(82,105),(83,105),(84,105),(85,105),(86,105),(87,105),(88,105),(89,105),(90,105),(91,105),(93,105),(0,106),(1,106),(4,106),(5,106),(6,106),(7,106),(8,106),(17,106),(18,106),(19,106),(20,106),(21,106),(22,106),(23,106),(24,106),(25,106),(26,106),(27,106),(28,106),(29,106),(30,106),(31,106),(32,106),(33,106),(34,106),(35,106),(36,106),(37,106),(38,106),(39,106),(40,106),(41,106),(42,106),(43,106),(44,106),(45,106),(46,106),(47,106),(48,106),(49,106),(50,106),(51,106),(57,106),(58,106),(63,106),(64,106),(65,106),(66,106),(67,106),(68,106),(69,106),(70,106),(71,106),(72,106),(73,106),(74,106),(75,106),(78,106),(79,106),(81,106),(82,106),(83,106),(84,106),(85,106),(86,106),(87,106),(88,106),(89,106),(90,106),(91,106),(92,106),(95,106),(1,107),(2,107),(8,107),(9,107),(12,107),(15,107),(16,107),(17,107),(18,107),(19,107),(20,107),(23,107),(24,107),(25,107),(26,107),(27,107),(28,107),(29,107),(30,107),(31,107),(32,107),(33,107),(34,107),(35,107),(36,107),(37,107),(38,107),(39,107),(40,107),(41,107),(42,107),(43,107),(44,107),(45,107),(46,107),(47,107),(48,107),(56,107),(57,107),(58,107),(60,107),(61,107),(62,107),(63,107),(66,107),(67,107),(68,107),(69,107),(70,107),(71,107),(82,107),(83,107),(84,107),(85,107),(86,107),(87,107),(88,107),(89,107),(90,107),(91,107),(92,107),(93,107),(20,108),(23,108),(26,108),(27,108),(28,108),(29,108),(32,108),(33,108),(34,108),(35,108),(37,108),(38,108),(39,108),(40,108),(41,108),(42,108),(43,108),(44,108),(45,108),(46,108),(47,108),(58,108),(63,108),(64,108),(73,108),(74,108),(75,108),(79,108),(80,108),(81,108),(82,108),(83,108),(84,108),(85,108),(86,108),(87,108),(88,108),(89,108),(90,108),(91,108),(92,108),(93,108),(94,108),(35,109),(37,109),(40,109),(41,109),(46,109),(47,109),(50,109),(64,109),(65,109),(66,109),(67,109),(68,109),(69,109),(70,109),(71,109),(87,109),(88,109),(89,109),(90,109),(91,109),(92,109),(93,109),(94,109),(96,109),(97,109)]
location.diggable = {(81,0),(81,2),(81,3),(88,5),(89,5),(90,5),(88,6),(90,6),(88,7),(89,7),(90,7),(81,8),(88,8),(89,8),(90,8),(91,8),(88,9),(90,9),(91,9),(97,9),(80,10),(88,10),(89,10),(90,10),(91,10),(97,10),(98,10),(87,11),(88,11),(89,11),(90,11),(91,11),(97,11),(98,11),(101,11),(79,12),(87,12),(88,12),(89,12),(90,12),(91,12),(97,12),(98,12),(101,12),(79,13),(87,13),(88,13),(89,13),(90,13),(97,13),(98,13),(79,14),(87,14),(88,14),(89,14),(90,14),(91,14),(97,14),(98,14),(99,14),(79,15),(87,15),(88,15),(89,15),(90,15),(97,15),(98,15),(99,15),(100,15),(78,16),(79,16),(87,16),(88,16),(89,16),(97,16),(98,16),(99,16),(100,16),(101,16),(78,17),(79,17),(87,17),(88,17),(89,17),(97,17),(98,17),(99,17),(100,17),(101,17),(61,18),(64,18),(79,18),(87,18),(88,18),(96,18),(97,18),(98,18),(99,18),(100,18),(79,19),(86,19),(87,19),(88,19),(96,19),(97,19),(98,19),(99,19),(79,20),(85,20),(88,20),(95,20),(96,20),(97,20),(99,20),(79,21),(85,21),(86,21),(87,21),(88,21),(95,21),(96,21),(97,21),(98,21),(99,21),(40,22),(72,22),(73,22),(74,22),(75,22),(76,22),(78,22),(85,22),(86,22),(87,22),(88,22),(94,22),(95,22),(96,22),(97,22),(98,22),(99,22),(26,23),(71,23),(72,23),(86,23),(87,23),(88,23),(94,23),(95,23),(96,23),(97,23),(98,23),(99,23),(24,24),(25,24),(26,24),(27,24),(28,24),(70,24),(85,24),(86,24),(87,24),(88,24),(94,24),(95,24),(96,24),(97,24),(98,24),(99,24),(9,25),(23,25),(24,25),(28,25),(29,25),(70,25),(85,25),(86,25),(87,25),(88,25),(94,25),(95,25),(96,25),(97,25),(99,25),(100,25),(109,25),(110,25),(111,25),(22,26),(29,26),(30,26),(70,26),(85,26),(86,26),(87,26),(88,26),(94,26),(95,26),(96,26),(97,26),(98,26),(99,26),(109,26),(110,26),(111,26),(112,26),(113,26),(114,26),(10,27),(22,27),(29,27),(30,27),(40,27),(54,27),(70,27),(85,27),(86,27),(87,27),(88,27),(94,27),(95,27),(96,27),(98,27),(99,27),(106,27),(107,27),(108,27),(109,27),(110,27),(111,27),(112,27),(113,27),(115,27),(116,27),(11,28),(22,28),(29,28),(30,28),(55,28),(56,28),(59,28),(60,28),(61,28),(62,28),(63,28),(64,28),(65,28),(66,28),(67,28),(68,28),(69,28),(70,28),(71,28),(72,28),(73,28),(85,28),(87,28),(94,28),(95,28),(96,28),(97,28),(98,28),(99,28),(105,28),(106,28),(107,28),(109,28),(110,28),(111,28),(112,28),(113,28),(114,28),(115,28),(116,28),(12,29),(22,29),(28,29),(29,29),(55,29),(56,29),(58,29),(59,29),(60,29),(61,29),(62,29),(63,29),(64,29),(65,29),(66,29),(67,29),(68,29),(69,29),(71,29),(72,29),(73,29),(74,29),(85,29),(86,29),(94,29),(95,29),(96,29),(97,29),(98,29),(100,29),(105,29),(106,29),(107,29),(108,29),(109,29),(110,29),(111,29),(112,29),(113,29),(114,29),(115,29),(116,29),(20,30),(23,30),(24,30),(25,30),(26,30),(27,30),(28,30),(56,30),(57,30),(58,30),(59,30),(60,30),(61,30),(62,30),(63,30),(64,30),(65,30),(66,30),(67,30),(74,30),(85,30),(86,30),(94,30),(95,30),(96,30),(97,30),(98,30),(105,30),(106,30),(107,30),(108,30),(109,30),(110,30),(111,30),(112,30),(113,30),(114,30),(115,30),(116,30),(56,31),(57,31),(58,31),(59,31),(60,31),(61,31),(62,31),(63,31),(64,31),(65,31),(66,31),(67,31),(85,31),(86,31),(93,31),(94,31),(95,31),(97,31),(98,31),(105,31),(106,31),(107,31),(108,31),(109,31),(110,31),(111,31),(112,31),(113,31),(114,31),(115,31),(116,31),(13,32),(57,32),(58,32),(63,32),(64,32),(66,32),(67,32),(84,32),(85,32),(93,32),(94,32),(95,32),(96,32),(97,32),(98,32),(105,32),(106,32),(107,32),(108,32),(109,32),(110,32),(111,32),(113,32),(115,32),(14,33),(56,33),(82,33),(83,33),(84,33),(93,33),(94,33),(95,33),(96,33),(97,33),(98,33),(106,33),(14,34),(55,34),(73,34),(81,34),(82,34),(93,34),(94,34),(96,34),(97,34),(98,34),(78,35),(79,35),(93,35),(94,35),(95,35),(96,35),(97,35),(98,35),(16,36),(40,36),(50,36),(51,36),(52,36),(77,36),(78,36),(92,36),(93,36),(94,36),(95,36),(96,36),(97,36),(98,36),(17,37),(41,37),(42,37),(43,37),(44,37),(48,37),(49,37),(68,37),(72,37),(73,37),(74,37),(75,37),(76,37),(77,37),(91,37),(92,37),(93,37),(94,37),(95,37),(96,37),(98,37),(18,38),(49,38),(71,38),(73,38),(74,38),(75,38),(76,38),(90,38),(91,38),(92,38),(93,38),(94,38),(95,38),(96,38),(97,38),(98,38),(19,39),(49,39),(70,39),(89,39),(90,39),(91,39),(92,39),(93,39),(94,39),(95,39),(96,39),(49,40),(68,40),(87,40),(88,40),(89,40),(90,40),(91,40),(92,40),(93,40),(94,40),(95,40),(85,41),(86,41),(87,41),(88,41),(89,41),(90,41),(92,41),(93,41),(19,42),(22,42),(83,42),(84,42),(85,42),(86,42),(88,42),(89,42),(90,42),(91,42),(92,42),(81,43),(82,43),(83,43),(84,43),(85,43),(86,43),(87,43),(88,43),(89,43),(90,43),(91,43),(76,44),(77,44),(78,44),(79,44),(80,44),(81,44),(82,44),(83,44),(84,44),(85,44),(86,44),(87,44),(88,44),(19,45),(75,45),(76,45),(77,45),(78,45),(79,45),(80,45),(81,45),(82,45),(83,45),(84,45),(85,45),(75,46),(76,46),(78,46),(79,46),(80,46),(81,46),(82,46),(75,47),(76,47),(77,47),(78,47),(80,47),(76,48),(77,48),(78,48),(79,48),(77,49),(78,49),(79,49),(6,50),(7,50),(8,50),(9,50),(10,50),(52,50),(53,50),(63,50),(64,50),(65,50),(67,50),(68,50),(78,50),(79,50),(6,51),(7,51),(8,51),(9,51),(24,51),(25,51),(52,51),(53,51),(61,51),(63,51),(64,51),(68,51),(78,51),(79,51),(63,52),(68,52),(69,52),(78,52),(79,52),(28,53),(67,53),(68,53),(69,53),(66,54),(68,54),(69,54),(78,54),(79,54),(88,54),(89,54),(90,54),(67,55),(68,55),(69,55),(79,55),(89,55),(90,55),(91,55),(92,55),(95,55),(96,55),(97,55),(98,55),(99,55),(100,55),(101,55),(24,56),(68,56),(69,56),(78,56),(79,56),(80,56),(81,56),(90,56),(91,56),(92,56),(93,56),(94,56),(95,56),(96,56),(97,56),(98,56),(69,57),(78,57),(79,57),(80,57),(81,57),(82,57),(93,57),(94,57),(95,57),(96,57),(97,57),(69,58),(79,58),(80,58),(81,58),(82,58),(8,59),(9,59),(69,59),(83,59),(9,60),(10,60),(11,60),(12,60),(23,60),(68,60),(69,60),(84,60),(85,60),(9,61),(10,61),(11,61),(12,61),(21,61),(68,61),(69,61),(70,61),(85,61),(12,62),(71,62),(86,62),(57,63),(70,63),(71,63),(72,63),(71,64),(72,64),(73,64),(74,64),(75,64),(76,64),(86,64),(48,65),(56,65),(75,65),(76,65),(77,65),(20,66),(78,66),(39,67),(79,67),(9,68),(10,68),(11,68),(12,68),(21,68),(57,68),(58,68),(59,68),(60,68),(61,68),(62,68),(63,68),(64,68),(79,68),(86,68),(11,69),(13,69),(57,69),(58,69),(59,69),(60,69),(61,69),(62,69),(63,69),(64,69),(86,69),(7,70),(58,70),(60,70),(61,70),(62,70),(63,70),(64,70),(65,70),(72,70),(77,70),(85,70),(7,71),(40,71),(57,71),(58,71),(59,71),(60,71),(61,71),(62,71),(63,71),(64,71),(65,71),(66,71),(69,71),(70,71),(71,71),(72,71),(74,71),(75,71),(77,71),(84,71),(85,71),(57,72),(58,72),(59,72),(60,72),(61,72),(62,72),(65,72),(66,72),(67,72),(68,72),(69,72),(70,72),(71,72),(72,72),(73,72),(74,72),(75,72),(76,72),(84,72),(85,72),(49,73),(50,73),(51,73),(52,73),(59,73),(60,73),(61,73),(62,73),(63,73),(64,73),(65,73),(66,73),(67,73),(68,73),(69,73),(70,73),(71,73),(73,73),(74,73),(75,73),(84,73),(85,73),(48,74),(49,74),(50,74),(52,74),(57,74),(58,74),(59,74),(60,74),(61,74),(62,74),(63,74),(64,74),(65,74),(66,74),(67,74),(68,74),(69,74),(70,74),(71,74),(72,74),(73,74),(74,74),(84,74),(85,74),(26,75),(27,75),(49,75),(50,75),(51,75),(52,75),(67,75),(68,75),(69,75),(70,75),(71,75),(72,75),(73,75),(74,75),(84,75),(27,76),(50,76),(51,76),(68,76),(69,76),(70,76),(71,76),(72,76),(83,76),(84,76),(85,76),(20,77),(21,77),(23,77),(24,77),(68,77),(69,77),(70,77),(71,77),(72,77),(82,77),(83,77),(84,77),(20,78),(21,78),(22,78),(23,78),(24,78),(42,78),(45,78),(68,78),(69,78),(70,78),(71,78),(81,78),(82,78),(83,78),(19,79),(68,79),(69,79),(70,79),(80,79),(81,79),(82,79),(83,79),(84,79),(54,80),(69,80),(70,80),(79,80),(82,80),(83,80),(8,81),(9,81),(10,81),(11,81),(12,81),(13,81),(14,81),(78,81),(79,81),(80,81),(81,81),(8,82),(9,82),(10,82),(11,82),(12,82),(13,82),(14,82),(77,82),(79,82),(80,82),(8,83),(9,83),(10,83),(11,83),(12,83),(13,83),(14,83),(69,83),(77,83),(78,83),(79,83),(80,83),(8,84),(9,84),(10,84),(11,84),(12,84),(13,84),(14,84),(77,84),(78,84),(80,84),(54,85),(77,85),(78,85),(79,85),(80,85),(42,86),(43,86),(46,86),(47,86),(79,86),(80,86),(92,86),(42,87),(43,87),(46,87),(47,87),(79,87),(80,87),(81,87),(16,88),(18,88),(26,88),(47,88),(71,88),(82,88),(91,88),(9,89),(47,89),(70,89),(71,89),(72,89),(82,89),(91,89),(70,90),(71,90),(73,90),(74,90),(82,90),(92,90),(0,91),(1,91),(48,91),(69,91),(70,91),(71,91),(72,91),(73,91),(74,91),(83,91),(40,92),(47,92),(48,92),(68,92),(69,92),(71,92),(72,92),(74,92),(83,92),(92,92),(68,93),(69,93),(70,93),(71,93),(72,93),(73,93),(74,93),(83,93),(84,93),(91,93),(92,93),(55,94),(56,94),(58,94),(65,94),(66,94),(67,94),(69,94),(70,94),(71,94),(73,94),(84,94),(85,94),(86,94),(87,94),(89,94),(90,94),(91,94),(92,94),(93,94),(94,94),(95,94),(96,94),(97,94),(98,94),(99,94),(100,94),(34,95),(35,95),(54,95),(59,95),(60,95),(61,95),(62,95),(63,95),(73,95),(74,95),(83,95),(84,95),(34,96),(35,96),(53,96),(54,96),(74,96),(84,96),(34,97),(54,97),(83,97),(54,98),(83,98),(54,99),(83,99),(54,100),(62,100),(63,100),(64,100),(65,100),(66,100),(74,100),(83,100),(69,101),(70,101),(72,101),(73,101),(83,101),(39,102),(84,102),(85,102),(86,102),(85,103),(86,103),(87,103),(88,103),(89,103),(0,105),(1,105),(2,105),(77,105),(78,105),(79,105),(1,106),(2,106),(8,106),(9,106),(11,106),(12,106),(13,106),(14,106),(15,106),(16,106),(59,106),(60,106),(61,106),(62,106),(76,106),(79,106),(80,106),(20,107),(21,107),(22,107),(49,107),(50,107),(58,107),(63,107),(64,107),(65,107),(72,107),(73,107),(74,107),(75,107),(80,107),(81,107),(94,107),(35,108),(36,108),(48,108),(49,108),(50,108),(54,108),(64,108),(65,108),(66,108),(67,108),(68,108),(69,108),(70,108),(71,108),(84,108),(94,108),(36,109),(47,109),(48,109),(54,109),(85,109),(86,109),(94,109)}
return location
def createBeach(version="1.4"):
location = Location("Beach")
location.width = 104
location.height = 50
location.spawns = {
0: [[372, .9], [718, .1], [719, .3], [723, .3]],
1: [[372, .9], [394, .5], [718, .1], [719, .3], [723, .3]],
2: [[372, .9], [718, .1], [719, .3], [723, .3]],
3: [[372, .4], [392, .8], [718, .05], [719, .2], [723, .2]]};
location.water = [(57,0),(58,0),(59,0),(60,0),(61,0),(62,0),(93,0),(94,0),(95,0),(96,0),(97,0),(98,0),(99,0),(100,0),(101,0),(102,0),(103,0),(57,1),(58,1),(59,1),(60,1),(61,1),(62,1),(93,1),(94,1),(95,1),(96,1),(97,1),(98,1),(99,1),(100,1),(101,1),(102,1),(103,1),(57,2),(58,2),(59,2),(60,2),(61,2),(62,2),(93,2),(94,2),(95,2),(96,2),(97,2),(98,2),(99,2),(100,2),(101,2),(102,2),(103,2),(57,3),(58,3),(59,3),(60,3),(61,3),(62,3),(93,3),(94,3),(95,3),(96,3),(97,3),(98,3),(99,3),(100,3),(101,3),(102,3),(103,3),(57,4),(58,4),(59,4),(60,4),(61,4),(62,4),(93,4),(94,4),(95,4),(96,4),(97,4),(98,4),(99,4),(100,4),(101,4),(102,4),(103,4),(57,5),(58,5),(59,5),(60,5),(61,5),(62,5),(93,5),(94,5),(95,5),(96,5),(97,5),(98,5),(99,5),(100,5),(101,5),(102,5),(103,5),(57,6),(58,6),(59,6),(60,6),(61,6),(62,6),(93,6),(94,6),(95,6),(96,6),(97,6),(98,6),(99,6),(100,6),(101,6),(102,6),(103,6),(0,7),(1,7),(2,7),(3,7),(4,7),(5,7),(6,7),(7,7),(57,7),(58,7),(59,7),(60,7),(61,7),(62,7),(93,7),(94,7),(95,7),(96,7),(97,7),(98,7),(99,7),(100,7),(101,7),(102,7),(103,7),(0,8),(1,8),(2,8),(3,8),(4,8),(5,8),(6,8),(7,8),(8,8),(57,8),(58,8),(59,8),(60,8),(61,8),(62,8),(93,8),(94,8),(95,8),(96,8),(97,8),(98,8),(99,8),(100,8),(101,8),(102,8),(103,8),(0,9),(1,9),(2,9),(3,9),(4,9),(5,9),(6,9),(7,9),(8,9),(57,9),(58,9),(59,9),(60,9),(61,9),(62,9),(85,9),(93,9),(94,9),(95,9),(96,9),(97,9),(98,9),(99,9),(100,9),(101,9),(102,9),(103,9),(0,10),(1,10),(2,10),(3,10),(4,10),(5,10),(6,10),(7,10),(8,10),(57,10),(58,10),(59,10),(60,10),(61,10),(62,10),(83,10),(93,10),(94,10),(95,10),(96,10),(97,10),(98,10),(99,10),(100,10),(101,10),(102,10),(103,10),(0,11),(1,11),(2,11),(3,11),(4,11),(5,11),(6,11),(7,11),(8,11),(57,11),(58,11),(59,11),(60,11),(61,11),(62,11),(93,11),(94,11),(95,11),(96,11),(97,11),(98,11),(99,11),(100,11),(101,11),(102,11),(103,11),(0,12),(1,12),(2,12),(3,12),(4,12),(5,12),(6,12),(7,12),(8,12),(49,12),(57,12),(58,12),(59,12),(60,12),(61,12),(62,12),(79,12),(93,12),(94,12),(95,12),(96,12),(97,12),(98,12),(99,12),(100,12),(101,12),(102,12),(103,12),(0,13),(1,13),(2,13),(3,13),(4,13),(5,13),(6,13),(7,13),(8,13),(58,13),(59,13),(60,13),(61,13),(93,13),(94,13),(95,13),(96,13),(97,13),(98,13),(99,13),(100,13),(101,13),(102,13),(103,13),(0,14),(1,14),(2,14),(3,14),(4,14),(5,14),(6,14),(7,14),(8,14),(57,14),(58,14),(59,14),(60,14),(61,14),(62,14),(93,14),(94,14),(95,14),(96,14),(97,14),(98,14),(99,14),(100,14),(101,14),(102,14),(103,14),(0,15),(1,15),(2,15),(3,15),(4,15),(5,15),(6,15),(7,15),(8,15),(57,15),(58,15),(59,15),(60,15),(61,15),(62,15),(71,15),(93,15),(94,15),(95,15),(96,15),(97,15),(98,15),(99,15),(100,15),(101,15),(102,15),(103,15),(0,16),(1,16),(2,16),(3,16),(4,16),(5,16),(6,16),(7,16),(8,16),(9,16),(49,16),(57,16),(58,16),(59,16),(60,16),(61,16),(62,16),(81,16),(93,16),(94,16),(95,16),(96,16),(97,16),(98,16),(99,16),(100,16),(101,16),(102,16),(103,16),(0,17),(1,17),(2,17),(3,17),(4,17),(5,17),(6,17),(7,17),(8,17),(9,17),(10,17),(14,17),(15,17),(16,17),(57,17),(58,17),(59,17),(60,17),(61,17),(62,17),(93,17),(94,17),(95,17),(96,17),(97,17),(98,17),(99,17),(100,17),(101,17),(102,17),(103,17),(0,18),(1,18),(2,18),(3,18),(4,18),(5,18),(6,18),(7,18),(8,18),(9,18),(10,18),(14,18),(15,18),(16,18),(17,18),(57,18),(58,18),(59,18),(60,18),(61,18),(62,18),(93,18),(94,18),(95,18),(96,18),(97,18),(98,18),(99,18),(100,18),(101,18),(102,18),(103,18),(0,19),(1,19),(2,19),(3,19),(4,19),(5,19),(6,19),(7,19),(8,19),(9,19),(10,19),(14,19),(15,19),(16,19),(17,19),(18,19),(56,19),(57,19),(58,19),(59,19),(60,19),(61,19),(62,19),(92,19),(93,19),(94,19),(95,19),(96,19),(97,19),(98,19),(99,19),(100,19),(101,19),(102,19),(103,19),(0,20),(1,20),(2,20),(3,20),(4,20),(5,20),(6,20),(7,20),(8,20),(9,20),(10,20),(14,20),(15,20),(16,20),(17,20),(18,20),(19,20),(56,20),(57,20),(58,20),(59,20),(60,20),(61,20),(62,20),(67,20),(92,20),(93,20),(94,20),(95,20),(96,20),(97,20),(98,20),(99,20),(100,20),(101,20),(102,20),(103,20),(0,21),(1,21),(2,21),(3,21),(4,21),(5,21),(6,21),(7,21),(8,21),(9,21),(10,21),(14,21),(15,21),(16,21),(17,21),(18,21),(19,21),(20,21),(21,21),(22,21),(23,21),(28,21),(29,21),(30,21),(31,21),(32,21),(33,21),(56,21),(57,21),(58,21),(59,21),(60,21),(61,21),(62,21),(86,21),(92,21),(93,21),(94,21),(95,21),(96,21),(97,21),(98,21),(99,21),(100,21),(101,21),(102,21),(103,21),(0,22),(1,22),(2,22),(3,22),(4,22),(5,22),(6,22),(7,22),(8,22),(9,22),(10,22),(14,22),(15,22),(16,22),(17,22),(18,22),(19,22),(20,22),(21,22),(22,22),(23,22),(28,22),(29,22),(30,22),(31,22),(32,22),(33,22),(34,22),(56,22),(57,22),(58,22),(59,22),(60,22),(61,22),(62,22),(63,22),(92,22),(93,22),(94,22),(95,22),(96,22),(97,22),(98,22),(99,22),(100,22),(101,22),(102,22),(103,22),(0,23),(1,23),(2,23),(3,23),(4,23),(5,23),(6,23),(7,23),(8,23),(9,23),(10,23),(28,23),(29,23),(30,23),(31,23),(32,23),(33,23),(34,23),(35,23),(55,23),(56,23),(57,23),(58,23),(59,23),(60,23),(61,23),(62,23),(63,23),(64,23),(79,23),(91,23),(92,23),(93,23),(94,23),(95,23),(96,23),(97,23),(98,23),(99,23),(100,23),(101,23),(102,23),(103,23),(0,24),(1,24),(2,24),(3,24),(4,24),(5,24),(6,24),(7,24),(8,24),(9,24),(10,24),(28,24),(29,24),(30,24),(31,24),(32,24),(33,24),(34,24),(35,24),(36,24),(54,24),(55,24),(56,24),(57,24),(58,24),(59,24),(60,24),(61,24),(62,24),(63,24),(64,24),(65,24),(90,24),(91,24),(92,24),(93,24),(94,24),(95,24),(96,24),(97,24),(98,24),(99,24),(100,24),(101,24),(102,24),(103,24),(0,25),(1,25),(2,25),(3,25),(4,25),(5,25),(6,25),(7,25),(8,25),(9,25),(10,25),(14,25),(15,25),(16,25),(17,25),(18,25),(19,25),(20,25),(21,25),(22,25),(23,25),(28,25),(29,25),(30,25),(31,25),(32,25),(33,25),(34,25),(35,25),(36,25),(37,25),(38,25),(39,25),(40,25),(41,25),(42,25),(43,25),(44,25),(45,25),(46,25),(47,25),(48,25),(49,25),(50,25),(51,25),(52,25),(53,25),(54,25),(55,25),(56,25),(57,25),(58,25),(59,25),(60,25),(61,25),(62,25),(63,25),(64,25),(65,25),(66,25),(67,25),(68,25),(69,25),(70,25),(71,25),(72,25),(73,25),(74,25),(75,25),(76,25),(77,25),(78,25),(79,25),(80,25),(81,25),(82,25),(83,25),(84,25),(85,25),(89,25),(90,25),(91,25),(92,25),(93,25),(94,25),(95,25),(96,25),(97,25),(98,25),(99,25),(100,25),(101,25),(102,25),(103,25),(0,26),(1,26),(2,26),(3,26),(4,26),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(14,26),(15,26),(16,26),(17,26),(18,26),(19,26),(20,26),(21,26),(22,26),(23,26),(28,26),(29,26),(30,26),(33,26),(34,26),(35,26),(36,26),(37,26),(38,26),(39,26),(40,26),(41,26),(42,26),(43,26),(44,26),(45,26),(46,26),(47,26),(48,26),(49,26),(50,26),(51,26),(52,26),(53,26),(54,26),(55,26),(56,26),(57,26),(58,26),(59,26),(60,26),(61,26),(62,26),(63,26),(64,26),(65,26),(66,26),(67,26),(68,26),(69,26),(70,26),(71,26),(72,26),(73,26),(74,26),(75,26),(76,26),(77,26),(78,26),(79,26),(80,26),(81,26),(82,26),(83,26),(84,26),(85,26),(89,26),(90,26),(91,26),(92,26),(93,26),(94,26),(95,26),(96,26),(97,26),(98,26),(99,26),(100,26),(101,26),(102,26),(103,26),(0,27),(1,27),(2,27),(3,27),(4,27),(5,27),(6,27),(7,27),(8,27),(9,27),(10,27),(14,27),(15,27),(16,27),(17,27),(18,27),(19,27),(20,27),(21,27),(22,27),(23,27),(28,27),(29,27),(34,27),(35,27),(36,27),(37,27),(38,27),(39,27),(40,27),(41,27),(42,27),(43,27),(44,27),(45,27),(46,27),(47,27),(48,27),(49,27),(50,27),(51,27),(52,27),(53,27),(54,27),(55,27),(56,27),(57,27),(58,27),(59,27),(60,27),(61,27),(62,27),(63,27),(64,27),(65,27),(66,27),(67,27),(68,27),(69,27),(70,27),(71,27),(72,27),(73,27),(74,27),(75,27),(76,27),(77,27),(78,27),(79,27),(80,27),(81,27),(82,27),(83,27),(84,27),(85,27),(89,27),(90,27),(91,27),(92,27),(93,27),(94,27),(95,27),(96,27),(97,27),(98,27),(99,27),(100,27),(101,27),(102,27),(103,27),(0,28),(1,28),(2,28),(3,28),(4,28),(5,28),(6,28),(7,28),(8,28),(9,28),(10,28),(14,28),(15,28),(16,28),(17,28),(18,28),(19,28),(20,28),(21,28),(22,28),(23,28),(28,28),(35,28),(36,28),(37,28),(38,28),(39,28),(40,28),(41,28),(42,28),(43,28),(44,28),(45,28),(46,28),(47,28),(48,28),(49,28),(50,28),(51,28),(52,28),(53,28),(54,28),(55,28),(56,28),(57,28),(58,28),(59,28),(60,28),(61,28),(62,28),(63,28),(64,28),(65,28),(66,28),(67,28),(68,28),(69,28),(70,28),(71,28),(72,28),(73,28),(74,28),(75,28),(76,28),(77,28),(78,28),(79,28),(80,28),(81,28),(82,28),(83,28),(84,28),(85,28),(89,28),(90,28),(91,28),(92,28),(93,28),(94,28),(95,28),(96,28),(97,28),(98,28),(99,28),(100,28),(101,28),(102,28),(103,28),(0,29),(1,29),(2,29),(3,29),(4,29),(5,29),(6,29),(7,29),(8,29),(9,29),(10,29),(14,29),(15,29),(16,29),(17,29),(18,29),(19,29),(20,29),(21,29),(22,29),(23,29),(36,29),(37,29),(38,29),(39,29),(40,29),(41,29),(42,29),(43,29),(44,29),(45,29),(46,29),(47,29),(48,29),(49,29),(50,29),(51,29),(52,29),(53,29),(54,29),(55,29),(56,29),(57,29),(58,29),(59,29),(60,29),(61,29),(62,29),(63,29),(64,29),(65,29),(66,29),(67,29),(68,29),(69,29),(70,29),(71,29),(72,29),(73,29),(74,29),(75,29),(76,29),(77,29),(78,29),(79,29),(80,29),(81,29),(82,29),(83,29),(84,29),(85,29),(89,29),(90,29),(91,29),(92,29),(93,29),(94,29),(95,29),(96,29),(97,29),(98,29),(99,29),(100,29),(101,29),(102,29),(103,29),(0,30),(1,30),(2,30),(3,30),(4,30),(5,30),(6,30),(7,30),(8,30),(9,30),(10,30),(14,30),(15,30),(16,30),(17,30),(18,30),(19,30),(20,30),(21,30),(22,30),(23,30),(36,30),(37,30),(38,30),(39,30),(40,30),(41,30),(42,30),(43,30),(44,30),(45,30),(46,30),(47,30),(48,30),(49,30),(50,30),(51,30),(52,30),(53,30),(54,30),(55,30),(56,30),(57,30),(58,30),(59,30),(60,30),(61,30),(62,30),(63,30),(64,30),(65,30),(66,30),(67,30),(68,30),(69,30),(70,30),(71,30),(72,30),(73,30),(74,30),(75,30),(76,30),(77,30),(78,30),(79,30),(80,30),(81,30),(82,30),(83,30),(84,30),(85,30),(89,30),(90,30),(91,30),(92,30),(93,30),(94,30),(95,30),(96,30),(97,30),(98,30),(99,30),(100,30),(101,30),(102,30),(103,30),(0,31),(1,31),(2,31),(3,31),(4,31),(5,31),(6,31),(7,31),(8,31),(9,31),(10,31),(14,31),(15,31),(16,31),(17,31),(18,31),(19,31),(20,31),(21,31),(22,31),(23,31),(40,31),(41,31),(42,31),(43,31),(44,31),(45,31),(46,31),(47,31),(48,31),(49,31),(50,31),(51,31),(52,31),(53,31),(54,31),(55,31),(56,31),(57,31),(58,31),(59,31),(60,31),(61,31),(62,31),(63,31),(64,31),(65,31),(66,31),(67,31),(68,31),(69,31),(70,31),(71,31),(72,31),(73,31),(74,31),(75,31),(76,31),(77,31),(78,31),(79,31),(80,31),(81,31),(82,31),(83,31),(84,31),(85,31),(89,31),(90,31),(91,31),(92,31),(93,31),(94,31),(95,31),(96,31),(97,31),(98,31),(99,31),(100,31),(101,31),(102,31),(103,31),(0,32),(1,32),(2,32),(3,32),(4,32),(5,32),(6,32),(7,32),(8,32),(9,32),(10,32),(14,32),(15,32),(16,32),(17,32),(18,32),(19,32),(20,32),(21,32),(22,32),(23,32),(40,32),(41,32),(42,32),(43,32),(44,32),(45,32),(46,32),(47,32),(48,32),(49,32),(50,32),(51,32),(52,32),(53,32),(54,32),(55,32),(56,32),(57,32),(58,32),(59,32),(60,32),(61,32),(62,32),(63,32),(64,32),(65,32),(66,32),(67,32),(68,32),(69,32),(70,32),(71,32),(72,32),(73,32),(74,32),(75,32),(76,32),(77,32),(78,32),(79,32),(80,32),(81,32),(82,32),(83,32),(84,32),(85,32),(89,32),(90,32),(91,32),(92,32),(93,32),(94,32),(95,32),(96,32),(97,32),(98,32),(99,32),(100,32),(101,32),(102,32),(103,32),(0,33),(1,33),(2,33),(3,33),(4,33),(5,33),(6,33),(7,33),(8,33),(9,33),(10,33),(14,33),(15,33),(16,33),(17,33),(18,33),(19,33),(20,33),(21,33),(22,33),(23,33),(40,33),(41,33),(42,33),(43,33),(44,33),(45,33),(46,33),(47,33),(48,33),(49,33),(50,33),(51,33),(52,33),(53,33),(54,33),(55,33),(56,33),(57,33),(58,33),(59,33),(60,33),(61,33),(62,33),(63,33),(64,33),(65,33),(66,33),(67,33),(68,33),(69,33),(70,33),(71,33),(72,33),(73,33),(74,33),(75,33),(76,33),(77,33),(78,33),(79,33),(80,33),(81,33),(82,33),(83,33),(84,33),(85,33),(89,33),(90,33),(91,33),(92,33),(93,33),(94,33),(95,33),(96,33),(97,33),(98,33),(99,33),(100,33),(101,33),(102,33),(103,33),(0,34),(1,34),(2,34),(3,34),(4,34),(5,34),(6,34),(7,34),(8,34),(9,34),(10,34),(14,34),(15,34),(16,34),(17,34),(18,34),(19,34),(20,34),(21,34),(22,34),(23,34),(45,34),(46,34),(47,34),(48,34),(49,34),(50,34),(51,34),(52,34),(53,34),(54,34),(55,34),(56,34),(57,34),(58,34),(59,34),(60,34),(61,34),(62,34),(63,34),(64,34),(65,34),(66,34),(67,34),(68,34),(69,34),(70,34),(71,34),(72,34),(73,34),(74,34),(75,34),(76,34),(77,34),(78,34),(79,34),(80,34),(81,34),(82,34),(83,34),(84,34),(85,34),(89,34),(90,34),(91,34),(92,34),(93,34),(94,34),(95,34),(96,34),(97,34),(98,34),(99,34),(100,34),(101,34),(102,34),(103,34),(0,35),(1,35),(2,35),(3,35),(4,35),(5,35),(6,35),(7,35),(8,35),(9,35),(10,35),(14,35),(15,35),(16,35),(17,35),(18,35),(19,35),(20,35),(21,35),(22,35),(23,35),(45,35),(46,35),(47,35),(48,35),(49,35),(50,35),(51,35),(52,35),(53,35),(54,35),(55,35),(56,35),(57,35),(58,35),(59,35),(60,35),(61,35),(62,35),(63,35),(64,35),(65,35),(66,35),(67,35),(68,35),(69,35),(70,35),(71,35),(72,35),(73,35),(74,35),(75,35),(76,35),(77,35),(78,35),(79,35),(80,35),(81,35),(82,35),(83,35),(84,35),(85,35),(89,35),(90,35),(91,35),(92,35),(93,35),(94,35),(95,35),(96,35),(97,35),(98,35),(99,35),(100,35),(101,35),(102,35),(103,35),(0,36),(1,36),(2,36),(3,36),(4,36),(5,36),(6,36),(7,36),(8,36),(9,36),(10,36),(14,36),(15,36),(16,36),(17,36),(18,36),(19,36),(20,36),(21,36),(22,36),(23,36),(45,36),(46,36),(47,36),(48,36),(49,36),(50,36),(51,36),(52,36),(53,36),(54,36),(55,36),(56,36),(57,36),(58,36),(59,36),(60,36),(61,36),(62,36),(63,36),(64,36),(65,36),(66,36),(67,36),(68,36),(69,36),(70,36),(71,36),(72,36),(73,36),(74,36),(75,36),(76,36),(77,36),(78,36),(79,36),(80,36),(81,36),(82,36),(83,36),(84,36),(85,36),(89,36),(90,36),(91,36),(92,36),(93,36),(94,36),(95,36),(96,36),(97,36),(98,36),(99,36),(100,36),(101,36),(102,36),(103,36),(0,37),(1,37),(2,37),(3,37),(4,37),(5,37),(6,37),(7,37),(8,37),(9,37),(15,37),(16,37),(17,37),(18,37),(19,37),(20,37),(21,37),(22,37),(23,37),(24,37),(25,37),(26,37),(27,37),(28,37),(29,37),(30,37),(31,37),(32,37),(33,37),(34,37),(35,37),(36,37),(37,37),(38,37),(39,37),(40,37),(41,37),(42,37),(43,37),(44,37),(45,37),(46,37),(47,37),(48,37),(49,37),(50,37),(51,37),(52,37),(53,37),(54,37),(55,37),(56,37),(57,37),(58,37),(59,37),(60,37),(61,37),(62,37),(63,37),(64,37),(65,37),(66,37),(67,37),(68,37),(69,37),(70,37),(71,37),(72,37),(73,37),(74,37),(75,37),(76,37),(77,37),(78,37),(79,37),(80,37),(81,37),(82,37),(83,37),(84,37),(85,37),(89,37),(90,37),(91,37),(92,37),(93,37),(94,37),(95,37),(96,37),(97,37),(98,37),(99,37),(100,37),(101,37),(102,37),(103,37),(0,38),(1,38),(2,38),(3,38),(4,38),(5,38),(6,38),(7,38),(8,38),(9,38),(15,38),(16,38),(17,38),(18,38),(19,38),(20,38),(21,38),(22,38),(23,38),(24,38),(25,38),(26,38),(27,38),(28,38),(29,38),(30,38),(31,38),(32,38),(33,38),(34,38),(35,38),(36,38),(37,38),(38,38),(39,38),(40,38),(41,38),(42,38),(43,38),(44,38),(45,38),(46,38),(47,38),(48,38),(49,38),(50,38),(51,38),(52,38),(53,38),(54,38),(55,38),(56,38),(57,38),(58,38),(59,38),(60,38),(61,38),(62,38),(63,38),(64,38),(65,38),(66,38),(67,38),(68,38),(69,38),(70,38),(71,38),(72,38),(73,38),(74,38),(75,38),(76,38),(77,38),(78,38),(79,38),(80,38),(81,38),(91,38),(92,38),(93,38),(94,38),(95,38),(96,38),(97,38),(98,38),(99,38),(100,38),(101,38),(102,38),(103,38),(0,39),(1,39),(2,39),(3,39),(4,39),(5,39),(6,39),(7,39),(8,39),(9,39),(15,39),(16,39),(17,39),(18,39),(19,39),(20,39),(21,39),(22,39),(23,39),(24,39),(25,39),(26,39),(27,39),(28,39),(29,39),(30,39),(31,39),(32,39),(33,39),(34,39),(35,39),(36,39),(37,39),(38,39),(39,39),(40,39),(41,39),(42,39),(43,39),(44,39),(45,39),(46,39),(47,39),(48,39),(49,39),(50,39),(51,39),(52,39),(53,39),(54,39),(55,39),(56,39),(57,39),(58,39),(59,39),(60,39),(61,39),(62,39),(63,39),(64,39),(65,39),(66,39),(67,39),(68,39),(69,39),(70,39),(71,39),(72,39),(73,39),(74,39),(75,39),(76,39),(77,39),(78,39),(79,39),(80,39),(81,39),(91,39),(92,39),(93,39),(94,39),(95,39),(96,39),(97,39),(98,39),(99,39),(100,39),(101,39),(102,39),(103,39),(0,40),(1,40),(2,40),(3,40),(4,40),(5,40),(6,40),(7,40),(8,40),(9,40),(10,40),(11,40),(12,40),(13,40),(14,40),(15,40),(16,40),(17,40),(18,40),(19,40),(20,40),(21,40),(22,40),(23,40),(24,40),(25,40),(26,40),(27,40),(28,40),(29,40),(30,40),(31,40),(32,40),(33,40),(34,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(46,40),(47,40),(48,40),(49,40),(50,40),(51,40),(52,40),(53,40),(54,40),(55,40),(56,40),(57,40),(58,40),(59,40),(60,40),(61,40),(62,40),(63,40),(64,40),(65,40),(66,40),(67,40),(68,40),(69,40),(70,40),(71,40),(72,40),(73,40),(74,40),(75,40),(76,40),(77,40),(78,40),(79,40),(80,40),(81,40),(91,40),(92,40),(93,40),(94,40),(95,40),(96,40),(97,40),(98,40),(99,40),(100,40),(101,40),(102,40),(103,40),(0,41),(1,41),(2,41),(3,41),(4,41),(5,41),(6,41),(7,41),(8,41),(9,41),(10,41),(11,41),(12,41),(13,41),(14,41),(15,41),(16,41),(17,41),(18,41),(19,41),(20,41),(21,41),(22,41),(23,41),(24,41),(25,41),(26,41),(27,41),(28,41),(29,41),(30,41),(31,41),(32,41),(33,41),(34,41),(35,41),(36,41),(37,41),(38,41),(39,41),(40,41),(41,41),(42,41),(43,41),(44,41),(45,41),(46,41),(47,41),(48,41),(49,41),(50,41),(51,41),(52,41),(53,41),(54,41),(55,41),(56,41),(57,41),(58,41),(59,41),(60,41),(61,41),(62,41),(63,41),(64,41),(65,41),(66,41),(67,41),(68,41),(69,41),(70,41),(71,41),(72,41),(73,41),(74,41),(75,41),(76,41),(77,41),(78,41),(79,41),(80,41),(81,41),(82,41),(83,41),(84,41),(85,41),(86,41),(87,41),(88,41),(89,41),(90,41),(91,41),(92,41),(93,41),(94,41),(95,41),(96,41),(97,41),(98,41),(99,41),(100,41),(101,41),(102,41),(103,41),(0,42),(1,42),(2,42),(3,42),(4,42),(5,42),(6,42),(7,42),(8,42),(9,42),(10,42),(11,42),(12,42),(13,42),(14,42),(15,42),(16,42),(17,42),(18,42),(19,42),(20,42),(21,42),(22,42),(23,42),(24,42),(25,42),(26,42),(27,42),(28,42),(29,42),(30,42),(31,42),(32,42),(33,42),(34,42),(35,42),(36,42),(37,42),(38,42),(39,42),(40,42),(41,42),(42,42),(43,42),(44,42),(45,42),(46,42),(47,42),(48,42),(49,42),(50,42),(51,42),(52,42),(53,42),(54,42),(55,42),(56,42),(57,42),(58,42),(59,42),(60,42),(61,42),(62,42),(63,42),(64,42),(65,42),(66,42),(67,42),(68,42),(69,42),(70,42),(71,42),(72,42),(73,42),(74,42),(75,42),(76,42),(77,42),(78,42),(79,42),(80,42),(81,42),(82,42),(83,42),(84,42),(85,42),(86,42),(87,42),(88,42),(89,42),(90,42),(91,42),(92,42),(93,42),(94,42),(95,42),(96,42),(97,42),(98,42),(99,42),(100,42),(101,42),(102,42),(103,42),(0,43),(1,43),(2,43),(3,43),(4,43),(5,43),(6,43),(7,43),(8,43),(9,43),(10,43),(11,43),(12,43),(13,43),(14,43),(15,43),(16,43),(17,43),(18,43),(19,43),(20,43),(21,43),(22,43),(23,43),(24,43),(25,43),(26,43),(27,43),(28,43),(29,43),(30,43),(31,43),(32,43),(33,43),(34,43),(35,43),(36,43),(37,43),(38,43),(39,43),(40,43),(41,43),(42,43),(43,43),(44,43),(45,43),(46,43),(47,43),(48,43),(49,43),(50,43),(51,43),(52,43),(53,43),(54,43),(55,43),(56,43),(57,43),(58,43),(59,43),(60,43),(61,43),(62,43),(63,43),(64,43),(65,43),(66,43),(67,43),(68,43),(69,43),(70,43),(71,43),(72,43),(73,43),(74,43),(75,43),(76,43),(77,43),(78,43),(79,43),(80,43),(81,43),(82,43),(83,43),(84,43),(85,43),(86,43),(87,43),(88,43),(89,43),(90,43),(91,43),(92,43),(93,43),(94,43),(95,43),(96,43),(97,43),(98,43),(99,43),(100,43),(101,43),(102,43),(103,43),(0,44),(1,44),(2,44),(3,44),(4,44),(5,44),(6,44),(7,44),(8,44),(9,44),(10,44),(11,44),(12,44),(13,44),(14,44),(15,44),(16,44),(17,44),(18,44),(19,44),(20,44),(21,44),(22,44),(23,44),(24,44),(25,44),(26,44),(27,44),(28,44),(29,44),(30,44),(31,44),(32,44),(33,44),(34,44),(35,44),(36,44),(37,44),(38,44),(39,44),(40,44),(41,44),(42,44),(43,44),(44,44),(45,44),(46,44),(47,44),(48,44),(49,44),(50,44),(51,44),(52,44),(53,44),(54,44),(55,44),(56,44),(57,44),(58,44),(59,44),(60,44),(61,44),(62,44),(63,44),(64,44),(65,44),(66,44),(67,44),(68,44),(69,44),(70,44),(71,44),(72,44),(73,44),(74,44),(75,44),(76,44),(77,44),(78,44),(79,44),(80,44),(81,44),(82,44),(83,44),(84,44),(85,44),(86,44),(87,44),(88,44),(89,44),(90,44),(91,44),(92,44),(93,44),(94,44),(95,44),(96,44),(97,44),(98,44),(99,44),(100,44),(101,44),(102,44),(103,44),(0,45),(1,45),(2,45),(3,45),(4,45),(5,45),(6,45),(7,45),(8,45),(9,45),(10,45),(11,45),(12,45),(13,45),(14,45),(15,45),(16,45),(17,45),(18,45),(19,45),(20,45),(21,45),(22,45),(23,45),(24,45),(25,45),(26,45),(27,45),(28,45),(29,45),(30,45),(31,45),(32,45),(33,45),(34,45),(35,45),(36,45),(37,45),(38,45),(39,45),(40,45),(41,45),(42,45),(43,45),(44,45),(45,45),(46,45),(47,45),(48,45),(49,45),(50,45),(51,45),(52,45),(53,45),(54,45),(55,45),(56,45),(57,45),(58,45),(59,45),(60,45),(61,45),(62,45),(63,45),(64,45),(65,45),(66,45),(67,45),(68,45),(69,45),(70,45),(71,45),(72,45),(73,45),(74,45),(75,45),(76,45),(77,45),(78,45),(79,45),(80,45),(81,45),(82,45),(83,45),(84,45),(85,45),(86,45),(87,45),(88,45),(89,45),(90,45),(91,45),(92,45),(93,45),(94,45),(95,45),(96,45),(97,45),(98,45),(99,45),(100,45),(101,45),(102,45),(103,45),(0,46),(1,46),(2,46),(3,46),(4,46),(5,46),(6,46),(7,46),(8,46),(9,46),(10,46),(11,46),(12,46),(13,46),(14,46),(15,46),(16,46),(17,46),(18,46),(19,46),(20,46),(21,46),(22,46),(23,46),(24,46),(25,46),(26,46),(27,46),(28,46),(29,46),(30,46),(31,46),(32,46),(33,46),(34,46),(35,46),(36,46),(37,46),(38,46),(39,46),(40,46),(41,46),(42,46),(43,46),(44,46),(45,46),(46,46),(47,46),(48,46),(49,46),(50,46),(51,46),(52,46),(53,46),(54,46),(55,46),(56,46),(57,46),(58,46),(59,46),(60,46),(61,46),(62,46),(63,46),(64,46),(65,46),(66,46),(67,46),(68,46),(69,46),(70,46),(71,46),(72,46),(73,46),(74,46),(75,46),(76,46),(77,46),(78,46),(79,46),(80,46),(81,46),(82,46),(83,46),(84,46),(85,46),(86,46),(87,46),(88,46),(89,46),(90,46),(91,46),(92,46),(93,46),(94,46),(95,46),(96,46),(97,46),(98,46),(99,46),(100,46),(101,46),(102,46),(103,46),(0,47),(1,47),(2,47),(3,47),(4,47),(5,47),(6,47),(7,47),(8,47),(9,47),(10,47),(11,47),(12,47),(13,47),(14,47),(15,47),(16,47),(17,47),(18,47),(19,47),(20,47),(21,47),(22,47),(23,47),(24,47),(25,47),(26,47),(27,47),(28,47),(29,47),(30,47),(31,47),(32,47),(33,47),(34,47),(35,47),(36,47),(37,47),(38,47),(39,47),(40,47),(41,47),(42,47),(43,47),(44,47),(45,47),(46,47),(47,47),(48,47),(49,47),(50,47),(51,47),(52,47),(53,47),(54,47),(55,47),(56,47),(57,47),(58,47),(59,47),(60,47),(61,47),(62,47),(63,47),(64,47),(65,47),(66,47),(67,47),(68,47),(69,47),(70,47),(71,47),(72,47),(73,47),(74,47),(75,47),(76,47),(77,47),(78,47),(79,47),(80,47),(81,47),(82,47),(83,47),(84,47),(85,47),(86,47),(87,47),(88,47),(89,47),(90,47),(91,47),(92,47),(93,47),(94,47),(95,47),(96,47),(97,47),(98,47),(99,47),(100,47),(101,47),(102,47),(103,47),(0,48),(1,48),(2,48),(3,48),(4,48),(5,48),(6,48),(7,48),(8,48),(9,48),(10,48),(11,48),(12,48),(13,48),(14,48),(15,48),(16,48),(17,48),(18,48),(19,48),(20,48),(21,48),(22,48),(23,48),(24,48),(25,48),(26,48),(27,48),(28,48),(29,48),(30,48),(31,48),(32,48),(33,48),(34,48),(35,48),(36,48),(37,48),(38,48),(39,48),(40,48),(41,48),(42,48),(43,48),(44,48),(45,48),(46,48),(47,48),(48,48),(49,48),(50,48),(51,48),(52,48),(53,48),(54,48),(55,48),(56,48),(57,48),(58,48),(59,48),(60,48),(61,48),(62,48),(63,48),(64,48),(65,48),(66,48),(67,48),(68,48),(69,48),(70,48),(71,48),(72,48),(73,48),(74,48),(75,48),(76,48),(77,48),(78,48),(79,48),(80,48),(81,48),(82,48),(83,48),(84,48),(85,48),(86,48),(87,48),(88,48),(89,48),(90,48),(91,48),(92,48),(93,48),(94,48),(95,48),(96,48),(97,48),(98,48),(99,48),(100,48),(101,48),(102,48),(103,48),(0,49),(1,49),(2,49),(3,49),(4,49),(5,49),(6,49),(7,49),(8,49),(9,49),(10,49),(11,49),(12,49),(13,49),(14,49),(15,49),(16,49),(17,49),(18,49),(19,49),(20,49),(21,49),(22,49),(23,49),(24,49),(25,49),(26,49),(27,49),(28,49),(29,49),(30,49),(31,49),(32,49),(33,49),(34,49),(35,49),(36,49),(37,49),(38,49),(39,49),(40,49),(41,49),(42,49),(43,49),(44,49),(45,49),(46,49),(47,49),(48,49),(49,49),(50,49),(51,49),(52,49),(53,49),(54,49),(55,49),(56,49),(57,49),(58,49),(59,49),(60,49),(61,49),(62,49),(63,49),(64,49),(65,49),(66,49),(67,49),(68,49),(69,49),(70,49),(71,49),(72,49),(73,49),(74,49),(75,49),(76,49),(77,49),(78,49),(79,49),(80,49),(81,49),(82,49),(83,49),(84,49),(85,49),(86,49),(87,49),(88,49),(89,49),(90,49),(91,49),(92,49),(93,49),(94,49),(95,49),(96,49),(97,49),(98,49),(99,49),(100,49),(101,49),(102,49),(103,49)]
location.diggable = {(0,0),(1,0),(2,0),(3,0),(8,0),(9,0),(10,0),(9,1),(10,1),(38,2),(37,3),(38,3),(36,4),(37,4),(38,4),(0,5),(1,5),(2,5),(3,5),(4,5),(5,5),(6,5),(7,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(5,6),(7,6),(8,6),(26,6),(27,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(34,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(43,6),(65,6),(66,6),(67,6),(68,6),(69,6),(76,6),(77,6),(78,6),(79,6),(80,6),(81,6),(82,6),(83,6),(84,6),(85,6),(86,6),(87,6),(88,6),(89,6),(90,6),(9,7),(10,7),(11,7),(12,7),(13,7),(14,7),(15,7),(16,7),(17,7),(18,7),(19,7),(24,7),(25,7),(26,7),(27,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(34,7),(35,7),(36,7),(37,7),(38,7),(39,7),(40,7),(41,7),(42,7),(43,7),(44,7),(65,7),(66,7),(67,7),(68,7),(69,7),(70,7),(71,7),(72,7),(73,7),(74,7),(75,7),(76,7),(77,7),(78,7),(79,7),(80,7),(81,7),(82,7),(83,7),(84,7),(85,7),(86,7),(87,7),(88,7),(89,7),(90,7),(10,8),(11,8),(12,8),(13,8),(14,8),(15,8),(16,8),(17,8),(18,8),(19,8),(20,8),(21,8),(22,8),(23,8),(24,8),(25,8),(26,8),(27,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(34,8),(35,8),(36,8),(37,8),(38,8),(39,8),(40,8),(41,8),(42,8),(43,8),(44,8),(45,8),(46,8),(47,8),(48,8),(49,8),(50,8),(51,8),(52,8),(53,8),(54,8),(65,8),(66,8),(67,8),(68,8),(69,8),(70,8),(71,8),(72,8),(73,8),(74,8),(75,8),(76,8),(77,8),(78,8),(79,8),(80,8),(81,8),(82,8),(83,8),(84,8),(85,8),(86,8),(87,8),(88,8),(89,8),(90,8),(10,9),(11,9),(12,9),(13,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(20,9),(21,9),(22,9),(23,9),(24,9),(25,9),(26,9),(27,9),(28,9),(29,9),(30,9),(31,9),(32,9),(33,9),(34,9),(35,9),(36,9),(37,9),(38,9),(39,9),(40,9),(41,9),(42,9),(43,9),(44,9),(47,9),(48,9),(49,9),(51,9),(52,9),(53,9),(54,9),(65,9),(66,9),(67,9),(68,9),(69,9),(70,9),(71,9),(72,9),(73,9),(74,9),(75,9),(76,9),(77,9),(78,9),(79,9),(80,9),(81,9),(82,9),(83,9),(84,9),(89,9),(90,9),(10,10),(11,10),(12,10),(13,10),(14,10),(17,10),(18,10),(19,10),(20,10),(21,10),(22,10),(23,10),(24,10),(25,10),(26,10),(27,10),(28,10),(29,10),(30,10),(31,10),(32,10),(33,10),(34,10),(35,10),(36,10),(37,10),(38,10),(39,10),(40,10),(41,10),(42,10),(43,10),(52,10),(53,10),(54,10),(65,10),(66,10),(67,10),(68,10),(69,10),(70,10),(71,10),(72,10),(73,10),(80,10),(81,10),(82,10),(12,11),(13,11),(14,11),(17,11),(18,11),(19,11),(22,11),(23,11),(24,11),(25,11),(26,11),(27,11),(28,11),(29,11),(30,11),(31,11),(32,11),(33,11),(34,11),(35,11),(36,11),(37,11),(38,11),(39,11),(40,11),(41,11),(42,11),(43,11),(44,11),(48,11),(50,11),(51,11),(52,11),(53,11),(54,11),(65,11),(66,11),(67,11),(68,11),(69,11),(70,11),(71,11),(79,11),(80,11),(81,11),(82,11),(12,12),(13,12),(14,12),(15,12),(16,12),(17,12),(18,12),(19,12),(22,12),(23,12),(24,12),(25,12),(26,12),(27,12),(28,12),(29,12),(30,12),(31,12),(32,12),(33,12),(34,12),(35,12),(36,12),(37,12),(38,12),(39,12),(40,12),(41,12),(42,12),(43,12),(44,12),(45,12),(46,12),(47,12),(48,12),(50,12),(51,12),(52,12),(53,12),(54,12),(55,12),(64,12),(65,12),(66,12),(67,12),(68,12),(69,12),(70,12),(80,12),(81,12),(82,12),(10,13),(11,13),(12,13),(13,13),(14,13),(15,13),(16,13),(17,13),(18,13),(19,13),(20,13),(21,13),(22,13),(23,13),(24,13),(25,13),(26,13),(27,13),(28,13),(29,13),(30,13),(31,13),(32,13),(33,13),(34,13),(35,13),(36,13),(37,13),(38,13),(39,13),(40,13),(41,13),(42,13),(43,13),(44,13),(45,13),(46,13),(47,13),(48,13),(49,13),(50,13),(51,13),(52,13),(53,13),(54,13),(55,13),(56,13),(63,13),(64,13),(65,13),(71,13),(81,13),(82,13),(10,14),(11,14),(12,14),(13,14),(14,14),(15,14),(16,14),(17,14),(18,14),(19,14),(20,14),(21,14),(22,14),(23,14),(24,14),(25,14),(26,14),(27,14),(28,14),(29,14),(30,14),(31,14),(32,14),(33,14),(34,14),(35,14),(36,14),(37,14),(38,14),(39,14),(40,14),(41,14),(42,14),(43,14),(44,14),(45,14),(46,14),(47,14),(48,14),(50,14),(51,14),(52,14),(53,14),(54,14),(55,14),(63,14),(64,14),(71,14),(82,14),(11,15),(13,15),(14,15),(17,15),(18,15),(19,15),(20,15),(21,15),(22,15),(23,15),(24,15),(25,15),(26,15),(27,15),(28,15),(29,15),(30,15),(31,15),(32,15),(33,15),(34,15),(35,15),(36,15),(37,15),(38,15),(39,15),(40,15),(41,15),(42,15),(43,15),(44,15),(45,15),(46,15),(47,15),(48,15),(49,15),(50,15),(51,15),(52,15),(53,15),(54,15),(64,15),(89,15),(90,15),(17,16),(18,16),(19,16),(20,16),(21,16),(22,16),(23,16),(24,16),(25,16),(26,16),(27,16),(28,16),(29,16),(30,16),(31,16),(32,16),(33,16),(34,16),(35,16),(36,16),(37,16),(38,16),(39,16),(40,16),(41,16),(42,16),(43,16),(44,16),(45,16),(46,16),(47,16),(48,16),(50,16),(51,16),(52,16),(53,16),(54,16),(88,16),(89,16),(90,16),(18,17),(19,17),(20,17),(21,17),(22,17),(23,17),(24,17),(25,17),(26,17),(27,17),(28,17),(29,17),(30,17),(31,17),(32,17),(33,17),(34,17),(35,17),(36,17),(37,17),(38,17),(39,17),(40,17),(41,17),(42,17),(43,17),(44,17),(45,17),(46,17),(47,17),(48,17),(49,17),(50,17),(51,17),(52,17),(53,17),(54,17),(88,17),(89,17),(90,17),(19,18),(21,18),(22,18),(23,18),(24,18),(25,18),(26,18),(27,18),(28,18),(29,18),(30,18),(31,18),(32,18),(33,18),(34,18),(35,18),(36,18),(37,18),(38,18),(39,18),(40,18),(41,18),(42,18),(43,18),(44,18),(45,18),(46,18),(47,18),(48,18),(49,18),(50,18),(51,18),(52,18),(53,18),(54,18),(88,18),(89,18),(90,18),(20,19),(22,19),(23,19),(25,19),(30,19),(31,19),(33,19),(34,19),(35,19),(36,19),(37,19),(38,19),(39,19),(40,19),(41,19),(42,19),(43,19),(44,19),(45,19),(46,19),(47,19),(48,19),(49,19),(50,19),(51,19),(52,19),(53,19),(54,19),(65,19),(66,19),(67,19),(88,19),(89,19),(90,19),(34,20),(35,20),(36,20),(37,20),(38,20),(39,20),(40,20),(41,20),(42,20),(43,20),(44,20),(45,20),(46,20),(47,20),(48,20),(49,20),(50,20),(51,20),(52,20),(53,20),(54,20),(65,20),(66,20),(88,20),(89,20),(90,20),(35,21),(36,21),(37,21),(38,21),(39,21),(40,21),(41,21),(42,21),(43,21),(44,21),(45,21),(46,21),(47,21),(48,21),(49,21),(50,21),(51,21),(52,21),(53,21),(54,21),(65,21),(66,21),(67,21),(87,21),(88,21),(89,21),(90,21),(36,22),(38,22),(39,22),(40,22),(41,22),(42,22),(43,22),(44,22),(45,22),(46,22),(47,22),(48,22),(49,22),(50,22),(51,22),(52,22),(53,22),(54,22),(65,22),(66,22),(67,22),(68,22),(86,22),(87,22),(88,22),(89,22),(90,22),(37,23),(38,23),(39,23),(40,23),(41,23),(42,23),(43,23),(44,23),(45,23),(46,23),(47,23),(48,23),(49,23),(50,23),(52,23),(53,23),(66,23),(67,23),(68,23),(78,23),(86,23),(88,23),(89,23),(38,24),(41,24),(43,24),(45,24),(46,24),(49,24),(51,24),(52,24),(67,24),(70,24),(72,24),(74,24),(75,24),(76,24),(77,24),(80,24),(82,24),(84,24),(85,24),(87,24),(88,24)}
location.spawnable = {(0,0),(1,0),(2,0),(3,0),(8,0),(9,0),(10,0),(9,1),(10,1),(37,4),(38,4),(0,5),(1,5),(2,5),(3,5),(4,5),(5,5),(6,5),(7,5),(26,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(35,5),(36,5),(37,5),(38,5),(26,6),(27,6),(28,6),(29,6),(30,6),(31,6),(33,6),(34,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(66,6),(67,6),(78,6),(79,6),(80,6),(81,6),(82,6),(83,6),(84,6),(85,6),(86,6),(87,6),(88,6),(10,7),(11,7),(12,7),(13,7),(14,7),(15,7),(16,7),(18,7),(25,7),(26,7),(27,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(34,7),(35,7),(36,7),(37,7),(39,7),(40,7),(41,7),(42,7),(43,7),(65,7),(66,7),(67,7),(68,7),(69,7),(70,7),(71,7),(72,7),(73,7),(74,7),(75,7),(76,7),(77,7),(78,7),(79,7),(80,7),(81,7),(82,7),(83,7),(84,7),(85,7),(86,7),(87,7),(88,7),(89,7),(90,7),(10,8),(11,8),(12,8),(13,8),(14,8),(15,8),(17,8),(18,8),(19,8),(20,8),(21,8),(22,8),(23,8),(24,8),(25,8),(26,8),(28,8),(29,8),(30,8),(31,8),(33,8),(34,8),(35,8),(36,8),(37,8),(38,8),(39,8),(40,8),(41,8),(42,8),(43,8),(44,8),(45,8),(47,8),(48,8),(49,8),(50,8),(51,8),(54,8),(65,8),(66,8),(67,8),(68,8),(69,8),(70,8),(71,8),(72,8),(73,8),(74,8),(75,8),(76,8),(77,8),(78,8),(79,8),(80,8),(82,8),(83,8),(84,8),(85,8),(86,8),(88,8),(89,8),(90,8),(11,9),(12,9),(13,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(20,9),(21,9),(22,9),(23,9),(24,9),(25,9),(26,9),(27,9),(28,9),(29,9),(30,9),(31,9),(32,9),(33,9),(34,9),(35,9),(36,9),(37,9),(38,9),(39,9),(40,9),(41,9),(42,9),(43,9),(47,9),(48,9),(49,9),(52,9),(53,9),(54,9),(65,9),(66,9),(67,9),(69,9),(70,9),(71,9),(72,9),(73,9),(74,9),(75,9),(77,9),(78,9),(79,9),(80,9),(81,9),(82,9),(83,9),(84,9),(90,9),(10,10),(11,10),(12,10),(13,10),(14,10),(17,10),(18,10),(19,10),(20,10),(21,10),(22,10),(23,10),(24,10),(25,10),(26,10),(27,10),(29,10),(30,10),(31,10),(32,10),(33,10),(34,10),(35,10),(36,10),(37,10),(38,10),(40,10),(41,10),(42,10),(43,10),(52,10),(53,10),(54,10),(65,10),(66,10),(67,10),(68,10),(69,10),(70,10),(71,10),(73,10),(80,10),(81,10),(82,10),(12,11),(13,11),(14,11),(17,11),(18,11),(19,11),(22,11),(23,11),(25,11),(26,11),(27,11),(28,11),(29,11),(30,11),(31,11),(32,11),(33,11),(34,11),(35,11),(36,11),(37,11),(38,11),(39,11),(40,11),(41,11),(42,11),(43,11),(52,11),(53,11),(54,11),(65,11),(66,11),(67,11),(69,11),(70,11),(80,11),(81,11),(12,12),(13,12),(14,12),(15,12),(16,12),(17,12),(19,12),(22,12),(23,12),(24,12),(25,12),(26,12),(27,12),(28,12),(29,12),(30,12),(31,12),(32,12),(33,12),(34,12),(35,12),(37,12),(38,12),(39,12),(40,12),(41,12),(42,12),(44,12),(45,12),(46,12),(47,12),(48,12),(50,12),(51,12),(52,12),(53,12),(54,12),(65,12),(66,12),(67,12),(68,12),(69,12),(70,12),(81,12),(10,13),(12,13),(13,13),(14,13),(15,13),(16,13),(17,13),(18,13),(19,13),(20,13),(21,13),(22,13),(23,13),(24,13),(25,13),(26,13),(27,13),(28,13),(29,13),(30,13),(31,13),(33,13),(34,13),(35,13),(36,13),(37,13),(38,13),(39,13),(41,13),(42,13),(43,13),(44,13),(45,13),(46,13),(48,13),(49,13),(51,13),(52,13),(53,13),(55,13),(64,13),(65,13),(71,13),(82,13),(10,14),(11,14),(12,14),(13,14),(14,14),(15,14),(16,14),(17,14),(19,14),(20,14),(21,14),(22,14),(23,14),(24,14),(26,14),(27,14),(28,14),(29,14),(30,14),(31,14),(32,14),(33,14),(34,14),(35,14),(36,14),(37,14),(38,14),(39,14),(40,14),(41,14),(42,14),(43,14),(44,14),(45,14),(46,14),(47,14),(48,14),(50,14),(51,14),(52,14),(53,14),(54,14),(64,14),(82,14),(17,15),(18,15),(19,15),(20,15),(21,15),(22,15),(23,15),(24,15),(25,15),(26,15),(27,15),(28,15),(29,15),(30,15),(31,15),(32,15),(33,15),(34,15),(35,15),(36,15),(37,15),(38,15),(39,15),(40,15),(41,15),(42,15),(43,15),(44,15),(45,15),(46,15),(47,15),(48,15),(49,15),(50,15),(51,15),(52,15),(53,15),(54,15),(89,15),(18,16),(19,16),(20,16),(21,16),(22,16),(23,16),(24,16),(25,16),(26,16),(27,16),(28,16),(29,16),(30,16),(31,16),(33,16),(34,16),(35,16),(36,16),(37,16),(38,16),(39,16),(40,16),(41,16),(42,16),(43,16),(44,16),(45,16),(46,16),(47,16),(48,16),(50,16),(51,16),(52,16),(53,16),(54,16),(88,16),(89,16),(90,16),(19,17),(20,17),(21,17),(22,17),(23,17),(24,17),(25,17),(26,17),(27,17),(28,17),(29,17),(31,17),(32,17),(33,17),(34,17),(35,17),(37,17),(38,17),(39,17),(40,17),(41,17),(42,17),(43,17),(44,17),(46,17),(47,17),(48,17),(49,17),(51,17),(52,17),(54,17),(90,17),(21,18),(22,18),(23,18),(24,18),(25,18),(26,18),(27,18),(28,18),(29,18),(30,18),(31,18),(32,18),(33,18),(34,18),(35,18),(36,18),(37,18),(38,18),(39,18),(40,18),(41,18),(42,18),(43,18),(44,18),(45,18),(46,18),(47,18),(48,18),(49,18),(50,18),(51,18),(52,18),(54,18),(88,18),(90,18),(34,19),(35,19),(36,19),(37,19),(38,19),(39,19),(40,19),(42,19),(43,19),(44,19),(45,19),(46,19),(47,19),(48,19),(49,19),(50,19),(51,19),(52,19),(53,19),(54,19),(67,19),(89,19),(90,19),(35,20),(36,20),(37,20),(38,20),(39,20),(40,20),(41,20),(42,20),(43,20),(44,20),(45,20),(47,20),(48,20),(49,20),(50,20),(51,20),(52,20),(53,20),(54,20),(65,20),(66,20),(88,20),(89,20),(90,20),(36,21),(37,21),(38,21),(39,21),(40,21),(41,21),(42,21),(43,21),(44,21),(45,21),(46,21),(47,21),(48,21),(49,21),(50,21),(51,21),(52,21),(53,21),(54,21),(65,21),(66,21),(88,21),(90,21),(38,22),(40,22),(41,22),(42,22),(43,22),(44,22),(45,22),(46,22),(47,22),(48,22),(49,22),(50,22),(51,22),(53,22),(66,22),(67,22),(87,22),(89,22),(38,23),(39,23),(40,23),(41,23),(42,23),(43,23),(44,23),(45,23),(46,23),(47,23),(48,23),(49,23),(50,23),(52,23),(67,23),(68,23),(86,23),(88,23)}
return location
def createDesert():
location = Location("Desert")
location.width = 50
location.height = 60
location.spawns = {
0: [[88, .5], [90, .5]],
1: [[88, .5], [90, .5]],
2: [[88, .5], [90, .5]],
3: [[88, .5], [90, .5]]};
location.spawnable = {(3,0),(17,0),(21,0),(22,0),(23,0),(24,0),(25,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(41,0),(42,0),(43,0),(44,0),(45,0),(46,0),(47,0),(8,1),(9,1),(16,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(36,1),(37,1),(38,1),(39,1),(40,1),(41,1),(42,1),(43,1),(46,1),(8,2),(9,2),(13,2),(17,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(32,2),(33,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(40,2),(41,2),(42,2),(43,2),(46,2),(47,2),(48,2),(49,2),(5,3),(6,3),(7,3),(8,3),(9,3),(10,3),(11,3),(12,3),(13,3),(14,3),(15,3),(16,3),(17,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(40,3),(41,3),(42,3),(43,3),(44,3),(45,3),(46,3),(47,3),(48,3),(49,3),(0,4),(1,4),(3,4),(4,4),(5,4),(6,4),(7,4),(9,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(44,4),(45,4),(46,4),(47,4),(48,4),(49,4),(0,5),(1,5),(2,5),(3,5),(4,5),(5,5),(6,5),(7,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(44,5),(45,5),(46,5),(47,5),(48,5),(49,5),(0,6),(1,6),(2,6),(3,6),(45,6),(46,6),(47,6),(0,7),(1,7),(2,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(34,7),(35,7),(36,7),(37,7),(38,7),(39,7),(40,7),(0,8),(25,8),(26,8),(27,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(34,8),(35,8),(36,8),(37,8),(38,8),(39,8),(40,8),(41,8),(0,9),(23,9),(24,9),(25,9),(26,9),(27,9),(28,9),(29,9),(30,9),(31,9),(32,9),(33,9),(34,9),(35,9),(37,9),(39,9),(40,9),(41,9),(42,9),(43,9),(48,9),(49,9),(0,10),(12,10),(15,10),(18,10),(19,10),(20,10),(22,10),(23,10),(24,10),(25,10),(26,10),(27,10),(28,10),(29,10),(30,10),(31,10),(32,10),(33,10),(34,10),(35,10),(36,10),(37,10),(38,10),(39,10),(40,10),(41,10),(42,10),(43,10),(44,10),(48,10),(49,10),(0,11),(4,11),(13,11),(14,11),(15,11),(17,11),(18,11),(19,11),(20,11),(21,11),(22,11),(23,11),(24,11),(25,11),(26,11),(28,11),(29,11),(30,11),(31,11),(32,11),(33,11),(34,11),(36,11),(38,11),(40,11),(41,11),(42,11),(43,11),(44,11),(48,11),(49,11),(0,12),(3,12),(13,12),(16,12),(17,12),(18,12),(19,12),(20,12),(21,12),(22,12),(23,12),(24,12),(25,12),(26,12),(27,12),(28,12),(29,12),(30,12),(31,12),(32,12),(33,12),(34,12),(35,12),(36,12),(37,12),(38,12),(39,12),(40,12),(41,12),(42,12),(43,12),(44,12),(3,13),(15,13),(16,13),(18,13),(19,13),(20,13),(21,13),(22,13),(23,13),(24,13),(25,13),(26,13),(27,13),(28,13),(29,13),(30,13),(31,13),(32,13),(33,13),(34,13),(35,13),(37,13),(39,13),(40,13),(41,13),(42,13),(43,13),(44,13),(0,14),(3,14),(18,14),(19,14),(20,14),(21,14),(22,14),(23,14),(24,14),(25,14),(26,14),(27,14),(28,14),(29,14),(30,14),(32,14),(33,14),(34,14),(35,14),(36,14),(37,14),(38,14),(39,14),(40,14),(41,14),(42,14),(43,14),(44,14),(0,15),(19,15),(20,15),(21,15),(22,15),(23,15),(24,15),(26,15),(27,15),(28,15),(29,15),(30,15),(31,15),(32,15),(33,15),(34,15),(35,15),(36,15),(37,15),(38,15),(39,15),(40,15),(41,15),(42,15),(43,15),(44,15),(49,15),(0,16),(18,16),(19,16),(20,16),(21,16),(22,16),(23,16),(24,16),(25,16),(26,16),(27,16),(29,16),(30,16),(31,16),(32,16),(33,16),(34,16),(35,16),(36,16),(37,16),(38,16),(39,16),(40,16),(41,16),(42,16),(43,16),(44,16),(45,16),(49,16),(0,17),(3,17),(14,17),(15,17),(17,17),(18,17),(19,17),(20,17),(21,17),(22,17),(23,17),(24,17),(25,17),(26,17),(27,17),(28,17),(29,17),(30,17),(31,17),(32,17),(33,17),(36,17),(37,17),(38,17),(39,17),(41,17),(42,17),(43,17),(44,17),(45,17),(0,18),(15,18),(16,18),(17,18),(18,18),(19,18),(20,18),(21,18),(22,18),(23,18),(24,18),(25,18),(26,18),(27,18),(28,18),(29,18),(30,18),(31,18),(32,18),(33,18),(36,18),(37,18),(38,18),(39,18),(40,18),(41,18),(42,18),(43,18),(44,18),(45,18),(0,19),(3,19),(4,19),(13,19),(14,19),(15,19),(16,19),(17,19),(18,19),(20,19),(21,19),(22,19),(23,19),(24,19),(25,19),(26,19),(27,19),(28,19),(29,19),(30,19),(31,19),(32,19),(33,19),(34,19),(35,19),(36,19),(37,19),(38,19),(39,19),(40,19),(41,19),(42,19),(43,19),(44,19),(45,19),(0,20),(3,20),(4,20),(7,20),(10,20),(11,20),(12,20),(13,20),(14,20),(15,20),(16,20),(17,20),(21,20),(22,20),(23,20),(24,20),(25,20),(26,20),(27,20),(28,20),(29,20),(30,20),(31,20),(32,20),(49,20),(0,21),(3,21),(4,21),(6,21),(9,21),(10,21),(11,21),(12,21),(13,21),(14,21),(15,21),(16,21),(21,21),(22,21),(23,21),(24,21),(25,21),(26,21),(27,21),(28,21),(32,21),(49,21),(0,22),(3,22),(4,22),(5,22),(6,22),(7,22),(8,22),(9,22),(10,22),(11,22),(12,22),(13,22),(14,22),(15,22),(16,22),(17,22),(21,22),(22,22),(23,22),(24,22),(25,22),(26,22),(27,22),(28,22),(32,22),(49,22),(3,23),(4,23),(8,23),(9,23),(10,23),(11,23),(12,23),(13,23),(14,23),(15,23),(16,23),(17,23),(18,23),(19,23),(20,23),(21,23),(22,23),(23,23),(24,23),(25,23),(26,23),(27,23),(28,23),(32,23),(46,23),(1,30),(3,30),(4,30),(5,30),(6,30),(8,30),(9,30),(10,30),(11,30),(12,30),(13,30),(14,30),(15,30),(16,30),(17,30),(21,30),(22,30),(23,30),(24,30),(25,30),(27,30),(28,30),(29,30),(31,30),(32,30),(33,30),(34,30),(35,30),(36,30),(37,30),(38,30),(39,30),(41,30),(42,30),(43,30),(44,30),(46,30),(49,30),(2,31),(3,31),(4,31),(5,31),(6,31),(7,31),(8,31),(9,31),(12,31),(13,31),(14,31),(15,31),(16,31),(17,31),(18,31),(21,31),(22,31),(23,31),(24,31),(25,31),(26,31),(27,31),(28,31),(29,31),(30,31),(31,31),(32,31),(33,31),(34,31),(35,31),(36,31),(37,31),(38,31),(39,31),(40,31),(41,31),(42,31),(43,31),(44,31),(45,31),(0,32),(2,32),(3,32),(4,32),(5,32),(6,32),(7,32),(8,32),(9,32),(10,32),(11,32),(12,32),(13,32),(14,32),(15,32),(16,32),(17,32),(18,32),(21,32),(22,32),(23,32),(24,32),(25,32),(26,32),(27,32),(28,32),(29,32),(30,32),(31,32),(32,32),(33,32),(34,32),(35,32),(36,32),(37,32),(38,32),(39,32),(40,32),(41,32),(42,32),(43,32),(44,32),(45,32),(0,33),(2,33),(3,33),(5,33),(6,33),(7,33),(8,33),(9,33),(10,33),(11,33),(12,33),(16,33),(17,33),(21,33),(22,33),(23,33),(24,33),(25,33),(26,33),(27,33),(28,33),(31,33),(32,33),(33,33),(34,33),(35,33),(36,33),(37,33),(38,33),(39,33),(40,33),(41,33),(42,33),(44,33),(45,33),(49,33),(2,34),(4,34),(10,34),(11,34),(12,34),(16,34),(17,34),(18,34),(20,34),(21,34),(22,34),(23,34),(24,34),(25,34),(26,34),(27,34),(31,34),(32,34),(33,34),(34,34),(35,34),(41,34),(42,34),(43,34),(44,34),(45,34),(49,34),(11,35),(12,35),(16,35),(17,35),(18,35),(20,35),(21,35),(22,35),(23,35),(24,35),(25,35),(26,35),(27,35),(31,35),(32,35),(33,35),(34,35),(35,35),(41,35),(42,35),(43,35),(44,35),(45,35),(7,36),(11,36),(12,36),(13,36),(14,36),(15,36),(16,36),(17,36),(21,36),(22,36),(23,36),(24,36),(25,36),(26,36),(31,36),(32,36),(41,36),(42,36),(43,36),(44,36),(0,37),(11,37),(12,37),(13,37),(14,37),(15,37),(16,37),(17,37),(20,37),(21,37),(22,37),(23,37),(24,37),(25,37),(27,37),(32,37),(36,37),(37,37),(38,37),(42,37),(43,37),(44,37),(45,37),(0,38),(5,38),(6,38),(8,38),(9,38),(11,38),(12,38),(13,38),(14,38),(15,38),(16,38),(17,38),(18,38),(20,38),(27,38),(36,38),(37,38),(38,38),(42,38),(43,38),(44,38),(45,38),(0,39),(2,39),(4,39),(5,39),(6,39),(7,39),(8,39),(9,39),(10,39),(11,39),(12,39),(13,39),(14,39),(15,39),(16,39),(17,39),(20,39),(26,39),(27,39),(31,39),(32,39),(33,39),(34,39),(35,39),(36,39),(37,39),(38,39),(41,39),(42,39),(43,39),(44,39),(45,39),(2,40),(3,40),(4,40),(5,40),(8,40),(9,40),(10,40),(12,40),(13,40),(14,40),(15,40),(17,40),(18,40),(20,40),(26,40),(27,40),(31,40),(32,40),(33,40),(34,40),(35,40),(36,40),(37,40),(41,40),(42,40),(44,40),(45,40),(1,41),(2,41),(3,41),(4,41),(5,41),(7,41),(8,41),(9,41),(10,41),(12,41),(13,41),(14,41),(15,41),(16,41),(18,41),(20,41),(21,41),(22,41),(23,41),(24,41),(25,41),(26,41),(27,41),(31,41),(32,41),(33,41),(34,41),(35,41),(36,41),(41,41),(42,41),(43,41),(44,41),(45,41),(1,42),(2,42),(3,42),(4,42),(5,42),(10,42),(12,42),(13,42),(14,42),(15,42),(20,42),(21,42),(23,42),(24,42),(25,42),(26,42),(27,42),(42,42),(43,42),(44,42),(45,42),(12,43),(13,43),(14,43),(18,43),(19,43),(20,43),(21,43),(22,43),(23,43),(24,43),(25,43),(26,43),(27,43),(41,43),(42,43),(43,43),(44,43),(45,43),(12,44),(13,44),(14,44),(17,44),(18,44),(19,44),(20,44),(21,44),(22,44),(23,44),(24,44),(25,44),(26,44),(27,44),(28,44),(40,44),(41,44),(42,44),(43,44),(44,44),(45,44),(0,45),(1,45),(12,45),(13,45),(14,45),(17,45),(21,45),(22,45),(23,45),(24,45),(25,45),(26,45),(27,45),(28,45),(29,45),(30,45),(31,45),(32,45),(33,45),(34,45),(35,45),(36,45),(37,45),(38,45),(39,45),(40,45),(41,45),(42,45),(43,45),(44,45),(45,45),(0,46),(1,46),(2,46),(3,46),(4,46),(5,46),(6,46),(7,46),(8,46),(9,46),(10,46),(11,46),(12,46),(13,46),(14,46),(15,46),(17,46),(22,46),(23,46),(24,46),(25,46),(28,46),(29,46),(30,46),(31,46),(32,46),(33,46),(34,46),(35,46),(36,46),(40,46),(41,46),(42,46),(43,46),(44,46),(45,46),(0,47),(4,47),(5,47),(6,47),(7,47),(8,47),(9,47),(10,47),(11,47),(12,47),(17,47),(22,47),(23,47),(24,47),(25,47),(26,47),(28,47),(29,47),(30,47),(31,47),(32,47),(33,47),(34,47),(35,47),(36,47),(40,47),(41,47),(42,47),(43,47),(44,47),(45,47),(4,48),(5,48),(6,48),(7,48),(8,48),(9,48),(10,48),(11,48),(12,48),(13,48),(16,48),(17,48),(18,48),(19,48),(24,48),(25,48),(26,48),(27,48),(28,48),(29,48),(30,48),(31,48),(32,48),(33,48),(34,48),(35,48),(36,48),(40,48),(41,48),(42,48),(43,48),(44,48),(45,48),(4,49),(5,49),(6,49),(7,49),(8,49),(9,49),(10,49),(11,49),(12,49),(13,49),(15,49),(16,49),(17,49),(18,49),(19,49),(24,49),(25,49),(27,49),(28,49),(29,49),(30,49),(31,49),(32,49),(33,49),(34,49),(35,49),(36,49),(37,49),(38,49),(39,49),(40,49),(41,49),(42,49),(43,49),(44,49),(45,49),(5,50),(6,50),(7,50),(8,50),(9,50),(13,50),(15,50),(16,50),(17,50),(18,50),(19,50),(20,50),(24,50),(25,50),(26,50),(27,50),(28,50),(29,50),(30,50),(31,50),(32,50),(33,50),(34,50),(35,50),(36,50),(37,50),(38,50),(39,50),(40,50),(41,50),(43,50),(44,50),(45,50),(49,50),(13,51),(15,51),(16,51),(17,51),(18,51),(19,51),(20,51),(21,51),(22,51),(23,51),(24,51),(25,51),(26,51),(27,51),(28,51),(29,51),(30,51),(31,51),(32,51),(33,51),(34,51),(35,51),(36,51),(37,51),(38,51),(39,51),(40,51),(42,51),(43,51),(44,51),(45,51),(49,51),(1,52),(2,52),(13,52),(15,52),(16,52),(17,52),(18,52),(19,52),(20,52),(21,52),(22,52),(23,52),(24,52),(25,52),(26,52),(27,52),(36,52),(37,52),(38,52),(39,52),(40,52),(41,52),(42,52),(43,52),(44,52),(45,52),(49,52),(1,53),(2,53),(3,53),(4,53),(5,53),(9,53),(10,53),(11,53),(12,53),(18,53),(19,53),(20,53),(21,53),(22,53),(23,53),(24,53),(25,53),(26,53),(27,53),(37,53),(38,53),(39,53),(40,53),(41,53),(42,53),(43,53),(44,53),(45,53),(49,53),(1,54),(2,54),(3,54),(4,54),(5,54),(15,54),(16,54),(17,54),(19,54),(20,54),(21,54),(22,54),(23,54),(24,54),(25,54),(26,54),(27,54),(40,54),(41,54),(42,54),(43,54),(44,54),(45,54),(46,54),(1,55),(2,55),(3,55),(4,55),(5,55),(6,55),(7,55),(8,55),(9,55),(10,55),(11,55),(12,55),(14,55),(15,55),(16,55),(17,55),(18,55),(19,55),(20,55),(21,55),(22,55),(23,55),(24,55),(25,55),(26,55),(27,55),(29,55),(30,55),(31,55),(32,55),(33,55),(40,55),(41,55),(42,55),(43,55),(44,55),(45,55),(46,55),(47,55),(48,55),(49,55),(1,56),(2,56),(3,56),(4,56),(5,56),(6,56),(7,56),(9,56),(10,56),(11,56),(12,56),(13,56),(14,56),(15,56),(16,56),(17,56),(18,56),(19,56),(20,56),(21,56),(22,56),(23,56),(24,56),(25,56),(26,56),(27,56),(29,56),(30,56),(31,56),(32,56),(33,56),(34,56),(35,56),(40,56),(41,56),(42,56),(43,56),(44,56),(45,56),(46,56),(47,56),(48,56),(49,56),(0,57),(1,57),(2,57),(3,57),(4,57),(5,57),(6,57),(7,57),(8,57),(9,57),(10,57),(11,57),(12,57),(13,57),(14,57),(15,57),(16,57),(17,57),(18,57),(19,57),(20,57),(21,57),(29,57),(30,57),(31,57),(32,57),(33,57),(34,57),(35,57),(36,57),(40,57),(41,57),(42,57),(43,57),(44,57),(45,57),(46,57),(47,57),(48,57),(49,57),(0,58),(1,58),(2,58),(3,58),(4,58),(5,58),(6,58),(7,58),(8,58),(9,58),(10,58),(11,58),(12,58),(13,58),(14,58),(15,58),(29,58),(30,58),(31,58),(32,58),(33,58),(34,58),(35,58),(36,58),(40,58),(41,58),(42,58),(43,58),(44,58),(45,58),(46,58),(47,58),(0,59),(1,59),(2,59),(3,59),(4,59),(5,59),(6,59),(7,59),(8,59),(9,59),(10,59),(11,59),(12,59),(13,59),(14,59),(15,59),(29,59),(30,59),(31,59),(32,59),(33,59),(34,59),(35,59),(36,59),(40,59),(41,59),(43,59),(44,59),(46,59)}
location.alwaysFront = {(0,0),(1,0),(2,0),(18,0),(19,0),(20,0),(24,0),(41,0),(43,0),(44,0),(45,0),(46,0),(48,0),(49,0),(0,1),(1,1),(2,1),(18,1),(19,1),(22,1),(24,1),(44,1),(45,1),(48,1),(49,1),(0,2),(1,2),(2,2),(18,2),(19,2),(44,2),(45,2),(47,2),(0,3),(1,3),(47,3),(48,3),(49,3),(0,4),(1,4),(47,4),(48,4),(49,4),(0,5),(1,5),(37,5),(47,5),(48,5),(49,5),(0,6),(1,6),(37,6),(47,6),(48,6),(0,7),(47,7),(48,7),(0,8),(0,9),(0,10),(34,10),(40,10),(0,11),(34,11),(40,11),(0,12),(0,14),(1,14),(48,14),(49,14),(0,15),(1,15),(48,15),(49,15),(0,16),(1,16),(48,16),(49,16),(0,17),(48,17),(49,17),(0,18),(48,18),(49,18),(0,26),(1,26),(0,27),(1,27),(48,27),(49,27),(0,28),(1,28),(48,28),(49,28),(0,29),(48,29),(49,29),(0,30),(31,30),(32,30),(33,30),(34,30),(35,30),(36,30),(37,30),(38,30),(48,30),(49,30),(0,31),(1,31),(31,31),(32,31),(33,31),(34,31),(35,31),(36,31),(37,31),(38,31),(48,31),(49,31),(0,32),(1,32),(6,32),(32,32),(36,32),(37,32),(38,32),(0,33),(1,33),(4,33),(8,33),(33,33),(34,33),(35,33),(36,33),(37,33),(38,33),(48,33),(49,33),(0,34),(3,34),(5,34),(7,34),(33,34),(34,34),(35,34),(36,34),(37,34),(48,34),(49,34),(0,35),(33,35),(34,35),(35,35),(36,35),(37,35),(48,35),(49,35),(33,36),(34,36),(48,36),(49,36),(33,37),(34,37),(48,37),(49,37),(0,40),(0,41),(5,41),(6,41),(7,41),(8,41),(0,42),(5,42),(6,42),(7,42),(8,42),(5,43),(6,43),(7,43),(8,43),(1,44),(2,44),(3,44),(4,44),(5,44),(6,44),(7,44),(8,44),(9,44),(48,44),(49,44),(1,45),(2,45),(3,45),(4,45),(5,45),(6,45),(7,45),(8,45),(9,45),(10,45),(48,45),(49,45),(1,46),(2,46),(3,46),(4,46),(5,46),(6,46),(7,46),(8,46),(9,46),(10,46),(48,46),(49,46),(48,47),(49,47),(0,48),(48,48),(49,48),(0,49),(0,50),(30,50),(31,50),(32,50),(30,51),(31,51),(32,51),(30,52),(31,52),(32,52),(30,53),(31,53),(36,54),(37,54),(38,54),(26,55),(27,55),(28,55),(36,55),(37,55),(38,55),(17,56),(18,56),(19,56),(26,56),(27,56),(28,56),(36,56),(37,56),(38,56),(3,57),(4,57),(5,57),(17,57),(18,57),(19,57),(21,57),(22,57),(23,57),(26,57),(27,57),(28,57),(36,57),(37,57),(39,57),(40,57),(41,57),(45,57),(46,57),(47,57),(3,58),(4,58),(5,58),(11,58),(12,58),(13,58),(17,58),(18,58),(19,58),(21,58),(22,58),(23,58),(26,58),(27,58),(39,58),(40,58),(41,58),(45,58),(46,58),(47,58),(3,59),(4,59),(5,59),(11,59),(12,59),(13,59),(17,59),(18,59),(21,59),(22,59),(23,59),(39,59),(40,59),(41,59),(45,59),(46,59),(47,59)}
location.front = {(0,0),(1,0),(2,0),(3,0),(4,0),(6,0),(10,0),(11,0),(12,0),(13,0),(14,0),(0,1),(2,1),(3,1),(10,1),(11,1),(13,1),(14,1),(0,2),(2,2),(3,2),(10,2),(11,2),(18,2),(8,3),(18,3),(8,4),(24,6),(30,7),(37,7),(30,8),(47,8),(34,12),(40,12),(22,13),(48,13),(22,14),(48,14),(48,15),(48,16),(48,17),(48,18),(48,19),(3,20),(13,20),(9,21),(26,21),(9,22),(26,22),(28,22),(29,22),(0,28),(49,28),(0,29),(1,29),(48,29),(49,29),(1,30),(42,30),(3,31),(10,31),(11,31),(32,31),(33,31),(34,31),(35,31),(36,31),(37,31),(38,31),(42,31),(10,32),(17,32),(21,32),(31,32),(39,32),(6,33),(21,33),(30,33),(4,34),(8,34),(30,34),(3,35),(5,35),(7,35),(9,35),(10,35),(30,35),(8,38),(17,38),(44,38),(17,39),(5,41),(5,42),(23,42),(5,43),(3,44),(4,44),(5,44),(3,45),(4,45),(5,45),(14,45),(3,46),(4,46),(5,46),(2,47),(1,48),(1,49),(2,49),(17,49),(10,50),(17,50),(43,53),(44,53),(33,54),(24,58),(24,59)}
location.buildings = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(26,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(41,0),(42,0),(43,0),(44,0),(45,0),(46,0),(47,0),(48,0),(49,0),(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(36,1),(37,1),(38,1),(39,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(0,2),(1,2),(2,2),(3,2),(4,2),(5,2),(6,2),(7,2),(8,2),(9,2),(10,2),(11,2),(12,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(40,2),(41,2),(42,2),(43,2),(44,2),(45,2),(46,2),(47,2),(48,2),(49,2),(0,3),(1,3),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(8,3),(9,3),(10,3),(11,3),(12,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(40,3),(41,3),(42,3),(43,3),(44,3),(45,3),(46,3),(47,3),(48,3),(49,3),(0,4),(1,4),(3,4),(4,4),(5,4),(6,4),(7,4),(9,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(47,4),(48,4),(0,5),(1,5),(2,5),(3,5),(4,5),(5,5),(6,5),(7,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(18,5),(19,5),(20,5),(21,5),(22,5),(23,5),(24,5),(25,5),(26,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(48,5),(0,6),(1,6),(2,6),(3,6),(4,6),(5,6),(6,6),(7,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(21,6),(22,6),(23,6),(43,6),(44,6),(45,6),(46,6),(47,6),(48,6),(49,6),(0,7),(1,7),(2,7),(3,7),(4,7),(5,7),(18,7),(19,7),(20,7),(21,7),(24,7),(45,7),(46,7),(47,7),(48,7),(49,7),(0,8),(1,8),(2,8),(3,8),(37,8),(47,8),(48,8),(49,8),(0,9),(1,9),(30,9),(47,9),(48,9),(49,9),(0,10),(1,10),(47,10),(48,10),(49,10),(0,11),(1,11),(7,11),(8,11),(9,11),(10,11),(11,11),(12,11),(47,11),(48,11),(49,11),(0,12),(1,12),(7,12),(12,12),(47,12),(48,12),(49,12),(0,13),(1,13),(5,13),(6,13),(7,13),(12,13),(13,13),(34,13),(40,13),(49,13),(0,14),(1,14),(5,14),(13,14),(48,14),(49,14),(0,15),(1,15),(4,15),(5,15),(13,15),(22,15),(48,15),(0,16),(1,16),(4,16),(13,16),(48,16),(0,17),(1,17),(4,17),(10,17),(11,17),(12,17),(48,17),(0,18),(1,18),(4,18),(9,18),(48,18),(0,19),(1,19),(4,19),(5,19),(6,19),(7,19),(8,19),(48,19),(49,19),(0,20),(1,20),(33,20),(34,20),(35,20),(36,20),(37,20),(38,20),(39,20),(40,20),(41,20),(42,20),(43,20),(44,20),(45,20),(48,20),(49,20),(0,21),(1,21),(3,21),(13,21),(33,21),(41,21),(45,21),(48,21),(49,21),(0,22),(1,22),(33,22),(45,22),(48,22),(49,22),(0,23),(1,23),(9,23),(26,23),(28,23),(29,23),(33,23),(45,23),(48,23),(49,23),(0,24),(49,24),(0,25),(17,25),(18,25),(19,25),(20,25),(21,25),(22,25),(23,25),(24,25),(49,25),(0,26),(17,26),(18,26),(19,26),(20,26),(21,26),(22,26),(23,26),(24,26),(49,26),(0,27),(17,27),(19,27),(20,27),(21,27),(22,27),(23,27),(24,27),(49,27),(0,28),(49,28),(0,29),(49,29),(0,30),(1,30),(48,30),(49,30),(0,31),(1,31),(48,31),(0,32),(1,32),(3,32),(11,32),(31,32),(32,32),(33,32),(34,32),(35,32),(36,32),(37,32),(38,32),(42,32),(48,32),(49,32),(0,33),(1,33),(10,33),(11,33),(17,33),(31,33),(32,33),(33,33),(34,33),(35,33),(36,33),(37,33),(38,33),(39,33),(48,33),(0,34),(1,34),(6,34),(11,34),(21,34),(30,34),(31,34),(32,34),(33,34),(34,34),(35,34),(36,34),(37,34),(38,34),(39,34),(48,34),(0,35),(1,35),(4,35),(8,35),(11,35),(30,35),(31,35),(32,35),(33,35),(34,35),(35,35),(36,35),(37,35),(38,35),(39,35),(48,35),(0,36),(1,36),(3,36),(5,36),(7,36),(9,36),(10,36),(11,36),(30,36),(31,36),(32,36),(33,36),(34,36),(35,36),(36,36),(37,36),(38,36),(39,36),(48,36),(0,37),(1,37),(11,37),(30,37),(31,37),(32,37),(33,37),(34,37),(35,37),(36,37),(37,37),(38,37),(39,37),(48,37),(0,38),(1,38),(11,38),(30,38),(31,38),(32,38),(33,38),(34,38),(35,38),(36,38),(37,38),(38,38),(39,38),(48,38),(49,38),(0,39),(1,39),(8,39),(11,39),(30,39),(31,39),(32,39),(33,39),(34,39),(35,39),(36,39),(37,39),(38,39),(39,39),(44,39),(48,39),(49,39),(0,40),(1,40),(2,40),(3,40),(4,40),(5,40),(6,40),(7,40),(8,40),(9,40),(10,40),(11,40),(17,40),(30,40),(31,40),(32,40),(33,40),(34,40),(35,40),(36,40),(37,40),(38,40),(39,40),(48,40),(49,40),(0,41),(1,41),(2,41),(3,41),(4,41),(5,41),(6,41),(7,41),(8,41),(9,41),(10,41),(11,41),(30,41),(31,41),(32,41),(33,41),(34,41),(35,41),(36,41),(37,41),(38,41),(39,41),(48,41),(49,41),(0,42),(1,42),(2,42),(3,42),(4,42),(5,42),(6,42),(7,42),(8,42),(9,42),(10,42),(11,42),(30,42),(31,42),(32,42),(33,42),(34,42),(35,42),(36,42),(37,42),(48,42),(49,42),(0,43),(1,43),(2,43),(3,43),(4,43),(5,43),(6,43),(7,43),(8,43),(9,43),(10,43),(11,43),(23,43),(34,43),(36,43),(48,43),(49,43),(0,44),(1,44),(48,44),(0,45),(1,45),(48,45),(0,46),(1,46),(14,46),(48,46),(0,47),(1,47),(3,47),(4,47),(5,47),(6,47),(7,47),(8,47),(9,47),(10,47),(48,47),(0,48),(1,48),(2,48),(3,48),(4,48),(5,48),(6,48),(7,48),(8,48),(9,48),(10,48),(48,48),(0,49),(3,49),(4,49),(5,49),(6,49),(7,49),(8,49),(9,49),(10,49),(28,49),(29,49),(30,49),(31,49),(32,49),(33,49),(34,49),(35,49),(48,49),(49,49),(0,50),(1,50),(2,50),(3,50),(4,50),(5,50),(6,50),(7,50),(8,50),(9,50),(10,50),(28,50),(29,50),(30,50),(31,50),(32,50),(33,50),(34,50),(35,50),(36,50),(37,50),(48,50),(49,50),(0,51),(3,51),(4,51),(5,51),(6,51),(7,51),(8,51),(9,51),(10,51),(17,51),(28,51),(29,51),(30,51),(31,51),(32,51),(33,51),(34,51),(35,51),(36,51),(37,51),(38,51),(39,51),(48,51),(49,51),(0,52),(28,52),(29,52),(30,52),(31,52),(32,52),(33,52),(34,52),(35,52),(36,52),(37,52),(38,52),(39,52),(48,52),(49,52),(0,53),(28,53),(29,53),(30,53),(31,53),(32,53),(33,53),(34,53),(35,53),(36,53),(37,53),(38,53),(39,53),(48,53),(49,53),(0,54),(22,54),(23,54),(24,54),(25,54),(26,54),(27,54),(28,54),(29,54),(30,54),(31,54),(32,54),(33,54),(34,54),(35,54),(36,54),(37,54),(38,54),(39,54),(43,54),(44,54),(48,54),(49,54),(0,55),(16,55),(17,55),(18,55),(19,55),(20,55),(21,55),(22,55),(23,55),(24,55),(25,55),(26,55),(27,55),(28,55),(29,55),(30,55),(31,55),(32,55),(33,55),(34,55),(35,55),(36,55),(37,55),(38,55),(39,55),(47,55),(48,55),(49,55),(0,56),(2,56),(3,56),(4,56),(5,56),(6,56),(7,56),(8,56),(9,56),(10,56),(11,56),(12,56),(13,56),(14,56),(15,56),(16,56),(17,56),(18,56),(19,56),(20,56),(21,56),(22,56),(23,56),(24,56),(25,56),(26,56),(27,56),(28,56),(29,56),(30,56),(31,56),(32,56),(33,56),(34,56),(35,56),(36,56),(37,56),(38,56),(39,56),(40,56),(41,56),(42,56),(43,56),(44,56),(45,56),(46,56),(47,56),(48,56),(49,56),(0,57),(1,57),(2,57),(3,57),(4,57),(5,57),(6,57),(7,57),(8,57),(9,57),(10,57),(11,57),(12,57),(13,57),(14,57),(15,57),(16,57),(17,57),(18,57),(19,57),(20,57),(21,57),(22,57),(23,57),(24,57),(25,57),(26,57),(27,57),(28,57),(29,57),(30,57),(31,57),(32,57),(33,57),(34,57),(35,57),(36,57),(37,57),(38,57),(39,57),(40,57),(41,57),(42,57),(43,57),(44,57),(45,57),(46,57),(47,57),(48,57),(49,57),(0,58),(1,58),(2,58),(3,58),(4,58),(5,58),(6,58),(7,58),(8,58),(9,58),(10,58),(11,58),(12,58),(13,58),(14,58),(15,58),(16,58),(17,58),(18,58),(19,58),(20,58),(21,58),(22,58),(23,58),(24,58),(25,58),(26,58),(27,58),(28,58),(29,58),(30,58),(31,58),(32,58),(33,58),(34,58),(35,58),(36,58),(37,58),(38,58),(39,58),(40,58),(41,58),(42,58),(43,58),(44,58),(45,58),(46,58),(47,58),(48,58),(49,58),(0,59),(1,59),(2,59),(3,59),(4,59),(5,59),(6,59),(7,59),(8,59),(9,59),(10,59),(11,59),(12,59),(13,59),(14,59),(15,59),(16,59),(17,59),(19,59),(20,59),(25,59),(26,59),(27,59),(28,59),(29,59),(30,59),(31,59),(32,59),(33,59),(34,59),(35,59),(36,59),(37,59),(38,59),(39,59),(40,59),(41,59),(42,59),(43,59),(44,59),(45,59),(46,59),(47,59),(48,59),(49,59)}
location.terrainFeatures = {(6,9),(10,9),(14,8),(14,34),(16,15),(19,21),(19,46),(22,49),(23,39),(30,22),(38,47)};
location.behindbush = {};
location.behindtree = {(5,6),(5,7),(5,8),(5,9),(6,6),(6,7),(6,8),(6,9),(7,6),(7,7),(7,8),(7,9),(9,6),(9,7),(9,8),(9,9),(10,6),(10,7),(10,8),(10,9),(11,6),(11,7),(11,8),(11,9),(13,5),(13,6),(13,7),(13,8),(14,5),(14,6),(14,7),(14,8),(15,5),(15,6),(15,7),(15,8),(13,31),(13,32),(13,33),(13,34),(14,31),(14,32),(14,33),(14,34),(15,31),(15,32),(15,33),(15,34),(15,12),(15,13),(15,14),(15,15),(16,12),(16,13),(16,14),(16,15),(17,12),(17,13),(17,14),(17,15),(18,18),(18,19),(18,20),(18,21),(19,18),(19,19),(19,20),(19,21),(20,18),(20,19),(20,20),(20,21),(18,43),(18,44),(18,45),(18,46),(19,43),(19,44),(19,45),(19,46),(20,43),(20,44),(20,45),(20,46),(21,46),(21,47),(21,48),(21,49),(22,46),(22,47),(22,48),(22,49),(23,46),(23,47),(23,48),(23,49),(22,36),(22,37),(22,38),(22,39),(23,36),(23,37),(23,38),(23,39),(24,36),(24,37),(24,38),(24,39),(29,19),(29,20),(29,21),(29,22),(30,19),(30,20),(30,21),(30,22),(31,19),(31,20),(31,21),(31,22),(37,44),(37,45),(37,46),(37,47),(38,44),(38,45),(38,46),(38,47),(39,44),(39,45),(39,46),(39,47)};
location.diggable = {(0,0),(1,0),(3,0),(5,0),(6,0),(7,0),(10,0),(11,0),(12,0),(14,0),(15,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(26,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(41,0),(42,0),(43,0),(44,0),(45,0),(46,0),(47,0),(48,0),(49,0),(0,1),(1,1),(2,1),(3,1),(4,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(13,1),(14,1),(15,1),(16,1),(18,1),(19,1),(20,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(36,1),(37,1),(38,1),(39,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(0,2),(1,2),(2,2),(3,2),(5,2),(6,2),(7,2),(8,2),(9,2),(10,2),(11,2),(12,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(32,2),(33,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(40,2),(41,2),(42,2),(43,2),(44,2),(45,2),(46,2),(47,2),(48,2),(49,2),(0,3),(1,3),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(8,3),(9,3),(10,3),(11,3),(12,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(40,3),(41,3),(42,3),(43,3),(44,3),(45,3),(46,3),(47,3),(48,3),(49,3),(0,4),(1,4),(3,4),(4,4),(5,4),(6,4),(7,4),(9,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(47,4),(48,4),(49,4),(0,5),(1,5),(2,5),(3,5),(4,5),(5,5),(6,5),(7,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(18,5),(19,5),(20,5),(21,5),(22,5),(23,5),(24,5),(25,5),(26,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(48,5),(49,5),(0,6),(1,6),(2,6),(3,6),(4,6),(5,6),(6,6),(7,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(21,6),(22,6),(23,6),(24,6),(25,6),(26,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(34,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(42,6),(43,6),(44,6),(45,6),(46,6),(47,6),(48,6),(49,6),(0,7),(1,7),(2,7),(3,7),(4,7),(5,7),(7,7),(8,7),(9,7),(10,7),(11,7),(12,7),(13,7),(14,7),(15,7),(16,7),(18,7),(19,7),(20,7),(21,7),(23,7),(24,7),(25,7),(26,7),(27,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(34,7),(35,7),(36,7),(37,7),(38,7),(39,7),(40,7),(41,7),(42,7),(43,7),(45,7),(46,7),(47,7),(48,7),(49,7),(0,8),(1,8),(2,8),(3,8),(4,8),(5,8),(6,8),(7,8),(8,8),(9,8),(10,8),(11,8),(12,8),(13,8),(14,8),(15,8),(16,8),(17,8),(18,8),(19,8),(20,8),(21,8),(23,8),(24,8),(25,8),(26,8),(27,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(34,8),(35,8),(36,8),(37,8),(38,8),(39,8),(40,8),(41,8),(42,8),(43,8),(44,8),(45,8),(47,8),(48,8),(49,8),(0,9),(1,9),(3,9),(4,9),(5,9),(6,9),(8,9),(9,9),(10,9),(12,9),(13,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(20,9),(21,9),(22,9),(23,9),(24,9),(25,9),(26,9),(27,9),(28,9),(29,9),(30,9),(31,9),(32,9),(33,9),(34,9),(35,9),(37,9),(39,9),(40,9),(41,9),(42,9),(43,9),(44,9),(45,9),(46,9),(47,9),(48,9),(49,9),(0,10),(1,10),(3,10),(4,10),(5,10),(6,10),(7,10),(9,10),(10,10),(11,10),(12,10),(15,10),(18,10),(19,10),(20,10),(21,10),(22,10),(23,10),(24,10),(25,10),(26,10),(27,10),(28,10),(29,10),(30,10),(31,10),(32,10),(33,10),(34,10),(35,10),(36,10),(37,10),(38,10),(39,10),(40,10),(41,10),(42,10),(43,10),(44,10),(45,10),(46,10),(47,10),(48,10),(49,10),(0,11),(1,11),(2,11),(4,11),(13,11),(14,11),(15,11),(17,11),(18,11),(19,11),(20,11),(21,11),(22,11),(23,11),(24,11),(25,11),(26,11),(28,11),(29,11),(30,11),(31,11),(32,11),(33,11),(34,11),(36,11),(37,11),(38,11),(40,11),(41,11),(42,11),(43,11),(44,11),(45,11),(46,11),(47,11),(48,11),(49,11),(0,12),(1,12),(2,12),(3,12),(13,12),(16,12),(17,12),(18,12),(19,12),(20,12),(21,12),(22,12),(23,12),(24,12),(25,12),(26,12),(27,12),(28,12),(29,12),(30,12),(31,12),(32,12),(33,12),(34,12),(35,12),(36,12),(37,12),(38,12),(39,12),(40,12),(41,12),(42,12),(43,12),(44,12),(45,12),(46,12),(47,12),(48,12),(49,12),(0,13),(1,13),(2,13),(3,13),(15,13),(16,13),(18,13),(19,13),(20,13),(21,13),(22,13),(23,13),(24,13),(25,13),(26,13),(27,13),(28,13),(29,13),(30,13),(31,13),(32,13),(33,13),(34,13),(35,13),(37,13),(39,13),(40,13),(41,13),(42,13),(43,13),(44,13),(45,13),(46,13),(47,13),(49,13),(0,14),(1,14),(2,14),(3,14),(15,14),(16,14),(17,14),(18,14),(19,14),(20,14),(21,14),(22,14),(23,14),(24,14),(25,14),(26,14),(27,14),(28,14),(29,14),(30,14),(32,14),(33,14),(34,14),(35,14),(36,14),(37,14),(38,14),(39,14),(40,14),(41,14),(42,14),(43,14),(44,14),(46,14),(47,14),(48,14),(49,14),(0,15),(1,15),(2,15),(15,15),(16,15),(17,15),(19,15),(20,15),(21,15),(22,15),(23,15),(24,15),(26,15),(27,15),(28,15),(29,15),(30,15),(31,15),(32,15),(33,15),(34,15),(35,15),(36,15),(37,15),(38,15),(39,15),(40,15),(41,15),(42,15),(43,15),(44,15),(46,15),(47,15),(48,15),(49,15),(0,16),(1,16),(2,16),(15,16),(16,16),(17,16),(18,16),(19,16),(20,16),(21,16),(22,16),(23,16),(24,16),(25,16),(26,16),(27,16),(28,16),(29,16),(30,16),(31,16),(32,16),(33,16),(34,16),(35,16),(36,16),(37,16),(38,16),(39,16),(40,16),(41,16),(42,16),(43,16),(44,16),(45,16),(46,16),(47,16),(48,16),(49,16),(0,17),(1,17),(2,17),(3,17),(14,17),(15,17),(17,17),(18,17),(19,17),(20,17),(21,17),(22,17),(23,17),(24,17),(25,17),(26,17),(27,17),(28,17),(29,17),(30,17),(31,17),(32,17),(33,17),(36,17),(37,17),(38,17),(39,17),(40,17),(41,17),(42,17),(43,17),(44,17),(45,17),(46,17),(47,17),(48,17),(49,17),(0,18),(1,18),(2,18),(15,18),(16,18),(17,18),(18,18),(19,18),(20,18),(21,18),(22,18),(23,18),(24,18),(25,18),(26,18),(27,18),(28,18),(29,18),(30,18),(31,18),(32,18),(33,18),(36,18),(37,18),(38,18),(39,18),(40,18),(41,18),(42,18),(43,18),(44,18),(45,18),(46,18),(47,18),(48,18),(49,18),(0,19),(1,19),(2,19),(3,19),(4,19),(13,19),(14,19),(15,19),(16,19),(17,19),(18,19),(20,19),(21,19),(22,19),(23,19),(24,19),(25,19),(26,19),(27,19),(28,19),(29,19),(30,19),(31,19),(32,19),(33,19),(34,19),(35,19),(36,19),(37,19),(38,19),(39,19),(40,19),(41,19),(42,19),(43,19),(44,19),(45,19),(46,19),(47,19),(48,19),(49,19),(0,20),(1,20),(2,20),(3,20),(4,20),(7,20),(10,20),(11,20),(12,20),(13,20),(14,20),(15,20),(16,20),(17,20),(18,20),(19,20),(20,20),(21,20),(22,20),(23,20),(24,20),(25,20),(26,20),(27,20),(28,20),(29,20),(30,20),(31,20),(32,20),(46,20),(47,20),(48,20),(49,20),(0,21),(1,21),(2,21),(3,21),(4,21),(6,21),(9,21),(10,21),(11,21),(12,21),(13,21),(14,21),(15,21),(16,21),(18,21),(19,21),(20,21),(21,21),(22,21),(23,21),(24,21),(25,21),(26,21),(27,21),(28,21),(29,21),(30,21),(31,21),(32,21),(46,21),(47,21),(48,21),(49,21),(0,22),(1,22),(2,22),(3,22),(4,22),(5,22),(6,22),(7,22),(8,22),(9,22),(10,22),(11,22),(12,22),(13,22),(14,22),(15,22),(16,22),(17,22),(18,22),(19,22),(20,22),(21,22),(22,22),(23,22),(24,22),(25,22),(26,22),(27,22),(28,22),(29,22),(30,22),(31,22),(32,22),(46,22),(47,22),(48,22),(49,22),(0,23),(1,23),(2,23),(3,23),(4,23),(8,23),(9,23),(10,23),(11,23),(12,23),(13,23),(14,23),(15,23),(16,23),(17,23),(18,23),(19,23),(20,23),(21,23),(22,23),(23,23),(24,23),(25,23),(26,23),(27,23),(28,23),(29,23),(30,23),(31,23),(32,23),(46,23),(47,23),(48,23),(49,23),(0,29),(0,30),(1,30),(3,30),(4,30),(5,30),(6,30),(8,30),(9,30),(10,30),(11,30),(12,30),(13,30),(14,30),(15,30),(16,30),(17,30),(21,30),(22,30),(23,30),(24,30),(25,30),(27,30),(28,30),(29,30),(31,30),(32,30),(33,30),(34,30),(35,30),(36,30),(37,30),(38,30),(39,30),(41,30),(42,30),(43,30),(44,30),(46,30),(47,30),(48,30),(49,30),(0,31),(1,31),(2,31),(3,31),(4,31),(5,31),(6,31),(7,31),(8,31),(9,31),(12,31),(13,31),(14,31),(15,31),(16,31),(17,31),(18,31),(21,31),(22,31),(23,31),(24,31),(25,31),(26,31),(27,31),(28,31),(29,31),(30,31),(31,31),(32,31),(33,31),(34,31),(35,31),(36,31),(37,31),(38,31),(39,31),(40,31),(41,31),(42,31),(43,31),(44,31),(45,31),(46,31),(47,31),(48,31),(49,31),(0,32),(1,32),(2,32),(3,32),(4,32),(5,32),(6,32),(7,32),(8,32),(9,32),(10,32),(11,32),(12,32),(13,32),(14,32),(15,32),(16,32),(17,32),(18,32),(21,32),(22,32),(23,32),(24,32),(25,32),(26,32),(27,32),(28,32),(29,32),(30,32),(31,32),(32,32),(33,32),(34,32),(35,32),(36,32),(37,32),(38,32),(39,32),(40,32),(41,32),(42,32),(43,32),(44,32),(45,32),(46,32),(47,32),(48,32),(49,32),(0,33),(1,33),(2,33),(3,33),(5,33),(6,33),(7,33),(8,33),(9,33),(10,33),(11,33),(12,33),(13,33),(14,33),(15,33),(16,33),(17,33),(21,33),(22,33),(23,33),(24,33),(25,33),(26,33),(27,33),(28,33),(29,33),(30,33),(31,33),(32,33),(33,33),(34,33),(35,33),(36,33),(37,33),(38,33),(39,33),(40,33),(41,33),(42,33),(44,33),(45,33),(46,33),(47,33),(48,33),(49,33),(0,34),(1,34),(2,34),(4,34),(6,34),(7,34),(10,34),(11,34),(12,34),(13,34),(14,34),(15,34),(16,34),(17,34),(18,34),(20,34),(21,34),(22,34),(23,34),(24,34),(25,34),(26,34),(27,34),(29,34),(30,34),(31,34),(32,34),(33,34),(34,34),(35,34),(36,34),(37,34),(38,34),(39,34),(40,34),(41,34),(42,34),(43,34),(44,34),(45,34),(46,34),(47,34),(48,34),(49,34),(0,35),(1,35),(3,35),(4,35),(5,35),(6,35),(7,35),(8,35),(9,35),(10,35),(11,35),(12,35),(13,35),(14,35),(15,35),(16,35),(17,35),(18,35),(20,35),(21,35),(22,35),(23,35),(24,35),(25,35),(26,35),(27,35),(29,35),(30,35),(31,35),(32,35),(33,35),(34,35),(35,35),(36,35),(37,35),(38,35),(39,35),(40,35),(41,35),(42,35),(43,35),(44,35),(45,35),(46,35),(47,35),(48,35),(49,35),(0,36),(1,36),(3,36),(4,36),(5,36),(7,36),(8,36),(9,36),(10,36),(11,36),(12,36),(13,36),(14,36),(15,36),(16,36),(17,36),(21,36),(22,36),(23,36),(24,36),(25,36),(26,36),(28,36),(29,36),(30,36),(31,36),(32,36),(33,36),(34,36),(35,36),(36,36),(37,36),(38,36),(39,36),(40,36),(41,36),(42,36),(43,36),(44,36),(46,36),(47,36),(48,36),(49,36),(0,37),(1,37),(3,37),(4,37),(5,37),(11,37),(12,37),(13,37),(14,37),(15,37),(16,37),(17,37),(20,37),(21,37),(22,37),(23,37),(24,37),(25,37),(27,37),(28,37),(29,37),(30,37),(32,37),(33,37),(34,37),(35,37),(36,37),(37,37),(38,37),(39,37),(40,37),(42,37),(43,37),(44,37),(45,37),(46,37),(48,37),(49,37),(0,38),(1,38),(5,38),(6,38),(8,38),(9,38),(11,38),(12,38),(13,38),(14,38),(15,38),(16,38),(17,38),(18,38),(20,38),(21,38),(22,38),(23,38),(24,38),(25,38),(27,38),(28,38),(29,38),(30,38),(33,38),(34,38),(35,38),(36,38),(37,38),(38,38),(39,38),(40,38),(42,38),(43,38),(44,38),(45,38),(46,38),(47,38),(48,38),(49,38),(0,39),(1,39),(2,39),(4,39),(5,39),(6,39),(7,39),(8,39),(9,39),(10,39),(11,39),(12,39),(13,39),(14,39),(15,39),(16,39),(17,39),(20,39),(21,39),(22,39),(23,39),(24,39),(25,39),(26,39),(27,39),(28,39),(31,39),(32,39),(33,39),(34,39),(35,39),(36,39),(37,39),(38,39),(39,39),(40,39),(41,39),(42,39),(43,39),(44,39),(45,39),(46,39),(47,39),(48,39),(49,39),(0,40),(2,40),(3,40),(4,40),(5,40),(8,40),(9,40),(10,40),(11,40),(12,40),(13,40),(14,40),(15,40),(17,40),(18,40),(20,40),(21,40),(22,40),(23,40),(24,40),(25,40),(26,40),(27,40),(28,40),(29,40),(30,40),(31,40),(32,40),(33,40),(34,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(44,40),(45,40),(46,40),(47,40),(48,40),(49,40),(1,41),(2,41),(3,41),(4,41),(5,41),(7,41),(8,41),(9,41),(10,41),(11,41),(12,41),(13,41),(14,41),(15,41),(16,41),(18,41),(20,41),(21,41),(22,41),(23,41),(24,41),(25,41),(26,41),(27,41),(28,41),(29,41),(30,41),(31,41),(32,41),(33,41),(34,41),(35,41),(36,41),(37,41),(38,41),(39,41),(40,41),(41,41),(42,41),(43,41),(44,41),(45,41),(46,41),(47,41),(48,41),(49,41),(0,42),(1,42),(2,42),(3,42),(4,42),(5,42),(7,42),(8,42),(9,42),(10,42),(11,42),(12,42),(13,42),(14,42),(15,42),(20,42),(21,42),(23,42),(24,42),(25,42),(26,42),(27,42),(28,42),(29,42),(30,42),(31,42),(32,42),(33,42),(34,42),(35,42),(36,42),(37,42),(40,42),(42,42),(43,42),(44,42),(45,42),(46,42),(47,42),(48,42),(49,42),(0,43),(1,43),(2,43),(3,43),(4,43),(5,43),(6,43),(7,43),(8,43),(9,43),(10,43),(11,43),(12,43),(13,43),(14,43),(18,43),(19,43),(20,43),(21,43),(22,43),(23,43),(24,43),(25,43),(26,43),(27,43),(29,43),(31,43),(34,43),(36,43),(39,43),(41,43),(42,43),(43,43),(44,43),(45,43),(46,43),(47,43),(48,43),(49,43),(0,44),(1,44),(2,44),(4,44),(5,44),(6,44),(7,44),(8,44),(9,44),(10,44),(11,44),(12,44),(13,44),(14,44),(17,44),(18,44),(19,44),(20,44),(21,44),(22,44),(23,44),(24,44),(25,44),(26,44),(27,44),(28,44),(29,44),(30,44),(31,44),(32,44),(33,44),(34,44),(35,44),(36,44),(37,44),(38,44),(40,44),(41,44),(42,44),(43,44),(44,44),(45,44),(46,44),(47,44),(48,44),(49,44),(0,45),(1,45),(2,45),(3,45),(4,45),(5,45),(6,45),(7,45),(8,45),(9,45),(10,45),(11,45),(12,45),(13,45),(14,45),(17,45),(18,45),(19,45),(20,45),(21,45),(22,45),(23,45),(24,45),(25,45),(26,45),(27,45),(28,45),(29,45),(30,45),(31,45),(32,45),(33,45),(34,45),(35,45),(36,45),(37,45),(38,45),(39,45),(40,45),(41,45),(42,45),(43,45),(44,45),(45,45),(46,45),(47,45),(48,45),(49,45),(0,46),(1,46),(2,46),(3,46),(4,46),(5,46),(6,46),(7,46),(8,46),(9,46),(10,46),(11,46),(12,46),(13,46),(14,46),(15,46),(17,46),(18,46),(19,46),(20,46),(22,46),(23,46),(24,46),(25,46),(28,46),(29,46),(30,46),(31,46),(32,46),(33,46),(34,46),(35,46),(36,46),(37,46),(38,46),(39,46),(40,46),(41,46),(42,46),(43,46),(44,46),(45,46),(46,46),(47,46),(48,46),(49,46),(0,47),(1,47),(2,47),(3,47),(4,47),(5,47),(6,47),(7,47),(8,47),(9,47),(10,47),(11,47),(12,47),(17,47),(18,47),(19,47),(20,47),(22,47),(23,47),(24,47),(25,47),(26,47),(28,47),(29,47),(30,47),(31,47),(32,47),(33,47),(34,47),(35,47),(36,47),(37,47),(38,47),(39,47),(40,47),(41,47),(42,47),(43,47),(44,47),(45,47),(46,47),(48,47),(49,47),(0,48),(1,48),(2,48),(3,48),(4,48),(5,48),(6,48),(7,48),(8,48),(9,48),(10,48),(11,48),(12,48),(13,48),(16,48),(17,48),(18,48),(19,48),(21,48),(22,48),(23,48),(24,48),(25,48),(26,48),(27,48),(28,48),(29,48),(30,48),(31,48),(32,48),(33,48),(34,48),(35,48),(36,48),(37,48),(38,48),(39,48),(40,48),(41,48),(42,48),(43,48),(44,48),(45,48),(46,48),(47,48),(48,48),(49,48),(0,49),(1,49),(3,49),(4,49),(5,49),(6,49),(7,49),(8,49),(9,49),(10,49),(11,49),(12,49),(13,49),(15,49),(16,49),(17,49),(18,49),(19,49),(21,49),(22,49),(23,49),(24,49),(25,49),(26,49),(27,49),(28,49),(29,49),(30,49),(31,49),(32,49),(33,49),(34,49),(35,49),(36,49),(37,49),(38,49),(39,49),(40,49),(41,49),(42,49),(43,49),(44,49),(45,49),(46,49),(47,49),(48,49),(49,49),(0,50),(1,50),(2,50),(3,50),(4,50),(5,50),(6,50),(7,50),(8,50),(9,50),(10,50),(11,50),(12,50),(13,50),(15,50),(16,50),(17,50),(18,50),(19,50),(20,50),(21,50),(22,50),(23,50),(24,50),(25,50),(26,50),(27,50),(28,50),(29,50),(30,50),(31,50),(32,50),(33,50),(34,50),(35,50),(36,50),(37,50),(38,50),(39,50),(40,50),(41,50),(43,50),(44,50),(45,50),(46,50),(47,50),(48,50),(49,50),(0,51),(1,51),(2,51),(3,51),(4,51),(5,51),(6,51),(7,51),(8,51),(9,51),(10,51),(11,51),(12,51),(13,51),(15,51),(16,51),(17,51),(18,51),(19,51),(20,51),(21,51),(22,51),(23,51),(24,51),(25,51),(26,51),(27,51),(28,51),(29,51),(30,51),(31,51),(32,51),(33,51),(34,51),(35,51),(36,51),(37,51),(38,51),(39,51),(40,51),(42,51),(43,51),(44,51),(45,51),(46,51),(47,51),(48,51),(49,51),(0,52),(1,52),(2,52),(3,52),(4,52),(5,52),(6,52),(7,52),(8,52),(9,52),(10,52),(11,52),(12,52),(13,52),(15,52),(16,52),(17,52),(18,52),(19,52),(20,52),(21,52),(22,52),(23,52),(24,52),(25,52),(26,52),(27,52),(28,52),(29,52),(30,52),(31,52),(32,52),(33,52),(34,52),(35,52),(36,52),(37,52),(38,52),(39,52),(40,52),(41,52),(42,52),(43,52),(44,52),(45,52),(46,52),(47,52),(48,52),(49,52),(0,53),(1,53),(2,53),(3,53),(4,53),(5,53),(9,53),(10,53),(11,53),(12,53),(18,53),(19,53),(20,53),(21,53),(22,53),(23,53),(24,53),(25,53),(26,53),(27,53),(28,53),(29,53),(30,53),(31,53),(32,53),(33,53),(35,53),(36,53),(37,53),(38,53),(39,53),(40,53),(41,53),(42,53),(43,53),(44,53),(45,53),(46,53),(47,53),(48,53),(49,53),(0,54),(1,54),(2,54),(3,54),(4,54),(5,54),(15,54),(16,54),(17,54),(19,54),(20,54),(21,54),(22,54),(23,54),(24,54),(25,54),(26,54),(27,54),(28,54),(29,54),(30,54),(31,54),(32,54),(33,54),(34,54),(35,54),(36,54),(37,54),(38,54),(39,54),(40,54),(41,54),(42,54),(43,54),(44,54),(45,54),(46,54),(47,54),(48,54),(49,54),(0,55),(1,55),(2,55),(3,55),(4,55),(5,55),(6,55),(7,55),(8,55),(9,55),(10,55),(11,55),(12,55),(13,55),(14,55),(15,55),(16,55),(17,55),(18,55),(19,55),(20,55),(21,55),(22,55),(23,55),(24,55),(25,55),(26,55),(27,55),(28,55),(29,55),(30,55),(31,55),(32,55),(33,55),(34,55),(35,55),(36,55),(37,55),(38,55),(39,55),(40,55),(41,55),(42,55),(43,55),(44,55),(45,55),(46,55),(47,55),(48,55),(49,55),(0,56),(1,56),(2,56),(3,56),(4,56),(5,56),(6,56),(7,56),(9,56),(10,56),(11,56),(12,56),(13,56),(14,56),(15,56),(16,56),(17,56),(18,56),(19,56),(20,56),(21,56),(22,56),(23,56),(24,56),(25,56),(26,56),(27,56),(28,56),(29,56),(30,56),(31,56),(32,56),(33,56),(34,56),(35,56),(36,56),(37,56),(38,56),(39,56),(40,56),(41,56),(42,56),(43,56),(44,56),(45,56),(46,56),(47,56),(48,56),(49,56),(0,57),(1,57),(2,57),(3,57),(4,57),(5,57),(6,57),(7,57),(8,57),(9,57),(10,57),(11,57),(12,57),(13,57),(14,57),(15,57),(16,57),(17,57),(18,57),(19,57),(20,57),(21,57),(22,57),(23,57),(24,57),(25,57),(26,57),(27,57),(28,57),(29,57),(30,57),(31,57),(32,57),(33,57),(34,57),(35,57),(36,57),(37,57),(38,57),(39,57),(40,57),(41,57),(42,57),(43,57),(44,57),(45,57),(46,57),(47,57),(48,57),(49,57),(0,58),(1,58),(2,58),(3,58),(4,58),(5,58),(6,58),(7,58),(8,58),(9,58),(10,58),(11,58),(12,58),(13,58),(14,58),(15,58),(16,58),(17,58),(18,58),(19,58),(20,58),(21,58),(22,58),(23,58),(24,58),(25,58),(27,58),(28,58),(29,58),(30,58),(31,58),(32,58),(33,58),(34,58),(35,58),(36,58),(37,58),(38,58),(39,58),(40,58),(41,58),(42,58),(43,58),(44,58),(45,58),(46,58),(47,58),(48,58),(49,58),(0,59),(1,59),(2,59),(3,59),(4,59),(5,59),(6,59),(7,59),(8,59),(9,59),(10,59),(11,59),(12,59),(13,59),(14,59),(15,59),(16,59),(18,59),(19,59),(20,59),(21,59),(22,59),(23,59),(24,59),(25,59),(26,59),(27,59),(28,59),(29,59),(30,59),(31,59),(32,59),(33,59),(34,59),(35,59),(36,59),(37,59),(38,59),(39,59),(40,59),(41,59),(42,59),(43,59),(44,59),(45,59),(46,59),(47,59),(49,59)}
return location
def createFarm(version="1.4"):
location = Location("StandardFarm")
location.width = 80;
location.height = 65;
location.back = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(8,0),(9,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(26,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(40,0),(41,0),(42,0),(43,0),(44,0),(45,0),(46,0),(47,0),(48,0),(49,0),(50,0),(51,0),(52,0),(53,0),(54,0),(55,0),(56,0),(57,0),(58,0),(59,0),(60,0),(61,0),(62,0),(63,0),(64,0),(65,0),(66,0),(67,0),(68,0),(69,0),(70,0),(71,0),(72,0),(73,0),(74,0),(75,0),(76,0),(77,0),(78,0),(79,0),(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(36,1),(37,1),(38,1),(39,1),(40,1),(41,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(50,1),(51,1),(52,1),(53,1),(54,1),(55,1),(56,1),(57,1),(58,1),(59,1),(60,1),(61,1),(62,1),(63,1),(64,1),(65,1),(66,1),(67,1),(68,1),(69,1),(70,1),(71,1),(72,1),(73,1),(74,1),(75,1),(76,1),(77,1),(78,1),(79,1),(0,2),(1,2),(2,2),(3,2),(4,2),(5,2),(6,2),(7,2),(8,2),(9,2),(10,2),(11,2),(12,2),(13,2),(14,2),(15,2),(16,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(40,2),(41,2),(42,2),(43,2),(44,2),(45,2),(46,2),(47,2),(48,2),(49,2),(50,2),(51,2),(52,2),(53,2),(54,2),(55,2),(56,2),(57,2),(58,2),(59,2),(60,2),(61,2),(62,2),(63,2),(64,2),(65,2),(66,2),(67,2),(68,2),(69,2),(70,2),(71,2),(72,2),(73,2),(74,2),(75,2),(76,2),(77,2),(78,2),(79,2),(0,3),(1,3),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(8,3),(9,3),(10,3),(11,3),(12,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(40,3),(41,3),(42,3),(43,3),(44,3),(45,3),(46,3),(47,3),(48,3),(49,3),(50,3),(51,3),(52,3),(53,3),(54,3),(55,3),(56,3),(57,3),(58,3),(59,3),(60,3),(61,3),(62,3),(63,3),(64,3),(65,3),(66,3),(67,3),(68,3),(69,3),(70,3),(71,3),(72,3),(73,3),(74,3),(75,3),(76,3),(77,3),(78,3),(79,3),(0,4),(1,4),(2,4),(3,4),(4,4),(5,4),(6,4),(7,4),(8,4),(9,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(40,4),(41,4),(42,4),(43,4),(44,4),(45,4),(46,4),(47,4),(48,4),(49,4),(50,4),(51,4),(52,4),(53,4),(54,4),(55,4),(56,4),(57,4),(58,4),(59,4),(60,4),(61,4),(62,4),(63,4),(64,4),(65,4),(66,4),(67,4),(68,4),(69,4),(70,4),(71,4),(72,4),(73,4),(74,4),(75,4),(76,4),(77,4),(78,4),(79,4),(0,5),(1,5),(2,5),(3,5),(4,5),(5,5),(6,5),(7,5),(8,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(18,5),(19,5),(20,5),(21,5),(22,5),(23,5),(24,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(34,5),(35,5),(36,5),(37,5),(38,5),(39,5),(40,5),(41,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(48,5),(49,5),(50,5),(51,5),(52,5),(53,5),(54,5),(55,5),(56,5),(57,5),(58,5),(59,5),(60,5),(61,5),(62,5),(63,5),(64,5),(65,5),(66,5),(67,5),(68,5),(69,5),(70,5),(71,5),(72,5),(73,5),(74,5),(75,5),(76,5),(77,5),(78,5),(79,5),(0,6),(1,6),(2,6),(3,6),(4,6),(5,6),(6,6),(7,6),(8,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(21,6),(22,6),(23,6),(24,6),(25,6),(26,6),(27,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(34,6),(35,6),(36,6),(37,6),(38,6),(39,6),(40,6),(41,6),(42,6),(43,6),(44,6),(45,6),(46,6),(47,6),(48,6),(49,6),(50,6),(51,6),(52,6),(53,6),(54,6),(55,6),(56,6),(57,6),(58,6),(59,6),(60,6),(61,6),(62,6),(63,6),(64,6),(65,6),(66,6),(67,6),(68,6),(69,6),(70,6),(71,6),(72,6),(73,6),(74,6),(75,6),(76,6),(77,6),(78,6),(79,6),(0,7),(1,7),(2,7),(3,7),(4,7),(5,7),(6,7),(7,7),(8,7),(9,7),(10,7),(11,7),(12,7),(13,7),(14,7),(15,7),(16,7),(17,7),(18,7),(19,7),(20,7),(21,7),(22,7),(23,7),(24,7),(25,7),(26,7),(27,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(34,7),(35,7),(36,7),(37,7),(38,7),(39,7),(40,7),(41,7),(42,7),(43,7),(44,7),(45,7),(46,7),(47,7),(48,7),(49,7),(50,7),(51,7),(52,7),(53,7),(54,7),(55,7),(56,7),(57,7),(58,7),(59,7),(60,7),(61,7),(62,7),(63,7),(64,7),(65,7),(66,7),(67,7),(68,7),(69,7),(70,7),(71,7),(72,7),(73,7),(74,7),(75,7),(76,7),(77,7),(78,7),(79,7),(0,8),(1,8),(2,8),(3,8),(4,8),(5,8),(6,8),(7,8),(8,8),(9,8),(10,8),(11,8),(12,8),(13,8),(14,8),(15,8),(16,8),(17,8),(18,8),(19,8),(20,8),(21,8),(22,8),(23,8),(24,8),(25,8),(26,8),(27,8),(28,8),(29,8),(30,8),(31,8),(32,8),(33,8),(34,8),(35,8),(36,8),(37,8),(38,8),(39,8),(40,8),(41,8),(42,8),(43,8),(44,8),(45,8),(46,8),(47,8),(48,8),(49,8),(50,8),(51,8),(52,8),(53,8),(54,8),(55,8),(56,8),(57,8),(58,8),(59,8),(60,8),(61,8),(62,8),(63,8),(64,8),(65,8),(66,8),(67,8),(68,8),(69,8),(70,8),(71,8),(72,8),(73,8),(74,8),(75,8),(76,8),(77,8),(78,8),(79,8),(0,9),(1,9),(2,9),(3,9),(4,9),(5,9),(6,9),(7,9),(8,9),(9,9),(10,9),(11,9),(12,9),(13,9),(14,9),(15,9),(16,9),(17,9),(18,9),(19,9),(20,9),(21,9),(22,9),(23,9),(24,9),(25,9),(26,9),(27,9),(28,9),(29,9),(30,9),(31,9),(32,9),(33,9),(34,9),(35,9),(36,9),(37,9),(38,9),(39,9),(40,9),(41,9),(42,9),(43,9),(44,9),(45,9),(46,9),(47,9),(48,9),(49,9),(50,9),(51,9),(52,9),(53,9),(54,9),(55,9),(56,9),(57,9),(58,9),(59,9),(60,9),(61,9),(62,9),(63,9),(64,9),(65,9),(66,9),(67,9),(68,9),(69,9),(70,9),(71,9),(72,9),(73,9),(74,9),(75,9),(76,9),(77,9),(78,9),(79,9),(0,10),(1,10),(2,10),(3,10),(4,10),(5,10),(6,10),(7,10),(8,10),(9,10),(10,10),(11,10),(12,10),(13,10),(14,10),(15,10),(16,10),(17,10),(18,10),(19,10),(20,10),(21,10),(22,10),(23,10),(24,10),(25,10),(26,10),(27,10),(28,10),(29,10),(30,10),(31,10),(32,10),(33,10),(34,10),(35,10),(36,10),(37,10),(38,10),(39,10),(40,10),(41,10),(42,10),(43,10),(44,10),(45,10),(46,10),(47,10),(48,10),(49,10),(50,10),(51,10),(52,10),(53,10),(54,10),(55,10),(56,10),(57,10),(58,10),(59,10),(60,10),(61,10),(62,10),(63,10),(64,10),(65,10),(66,10),(67,10),(68,10),(69,10),(70,10),(71,10),(72,10),(73,10),(74,10),(75,10),(76,10),(77,10),(78,10),(79,10),(0,11),(1,11),(2,11),(3,11),(4,11),(5,11),(6,11),(7,11),(8,11),(9,11),(10,11),(11,11),(12,11),(13,11),(14,11),(15,11),(16,11),(17,11),(18,11),(19,11),(20,11),(21,11),(22,11),(23,11),(24,11),(25,11),(26,11),(27,11),(28,11),(29,11),(30,11),(31,11),(32,11),(33,11),(34,11),(35,11),(36,11),(37,11),(38,11),(39,11),(40,11),(41,11),(42,11),(43,11),(44,11),(45,11),(46,11),(47,11),(48,11),(49,11),(50,11),(51,11),(52,11),(53,11),(54,11),(55,11),(56,11),(57,11),(58,11),(59,11),(60,11),(61,11),(62,11),(63,11),(64,11),(65,11),(66,11),(67,11),(68,11),(69,11),(70,11),(71,11),(72,11),(73,11),(74,11),(75,11),(76,11),(77,11),(78,11),(79,11),(0,12),(1,12),(2,12),(3,12),(4,12),(5,12),(6,12),(7,12),(8,12),(9,12),(10,12),(11,12),(12,12),(13,12),(14,12),(15,12),(16,12),(17,12),(18,12),(19,12),(20,12),(21,12),(22,12),(23,12),(24,12),(25,12),(26,12),(27,12),(28,12),(29,12),(30,12),(31,12),(32,12),(33,12),(34,12),(35,12),(36,12),(37,12),(38,12),(39,12),(40,12),(41,12),(42,12),(43,12),(44,12),(45,12),(46,12),(47,12),(48,12),(49,12),(50,12),(51,12),(52,12),(53,12),(54,12),(55,12),(56,12),(57,12),(58,12),(59,12),(60,12),(61,12),(62,12),(63,12),(64,12),(65,12),(66,12),(67,12),(68,12),(69,12),(70,12),(71,12),(72,12),(73,12),(74,12),(75,12),(76,12),(77,12),(78,12),(79,12),(0,13),(1,13),(2,13),(3,13),(4,13),(5,13),(6,13),(7,13),(8,13),(9,13),(10,13),(11,13),(12,13),(13,13),(14,13),(15,13),(16,13),(17,13),(18,13),(19,13),(20,13),(21,13),(22,13),(23,13),(24,13),(25,13),(26,13),(27,13),(28,13),(29,13),(30,13),(31,13),(32,13),(33,13),(34,13),(35,13),(36,13),(37,13),(38,13),(39,13),(40,13),(41,13),(42,13),(43,13),(44,13),(45,13),(46,13),(47,13),(48,13),(49,13),(50,13),(51,13),(52,13),(53,13),(54,13),(55,13),(56,13),(57,13),(58,13),(59,13),(60,13),(61,13),(62,13),(63,13),(64,13),(65,13),(66,13),(67,13),(68,13),(69,13),(70,13),(71,13),(72,13),(73,13),(74,13),(75,13),(76,13),(77,13),(78,13),(79,13),(0,14),(1,14),(2,14),(3,14),(4,14),(5,14),(6,14),(7,14),(8,14),(9,14),(10,14),(11,14),(12,14),(13,14),(14,14),(15,14),(16,14),(17,14),(18,14),(19,14),(20,14),(21,14),(22,14),(23,14),(24,14),(25,14),(26,14),(27,14),(28,14),(29,14),(30,14),(31,14),(32,14),(33,14),(34,14),(35,14),(36,14),(37,14),(38,14),(39,14),(40,14),(41,14),(42,14),(43,14),(44,14),(45,14),(46,14),(47,14),(48,14),(49,14),(50,14),(51,14),(52,14),(53,14),(54,14),(55,14),(56,14),(57,14),(58,14),(59,14),(60,14),(61,14),(62,14),(63,14),(64,14),(65,14),(66,14),(67,14),(68,14),(69,14),(70,14),(71,14),(72,14),(73,14),(74,14),(75,14),(76,14),(77,14),(78,14),(79,14),(0,15),(1,15),(2,15),(3,15),(4,15),(5,15),(6,15),(7,15),(8,15),(9,15),(10,15),(11,15),(12,15),(13,15),(14,15),(15,15),(16,15),(17,15),(18,15),(19,15),(20,15),(21,15),(22,15),(23,15),(24,15),(25,15),(26,15),(27,15),(28,15),(29,15),(30,15),(31,15),(32,15),(33,15),(34,15),(35,15),(36,15),(37,15),(38,15),(39,15),(40,15),(41,15),(42,15),(43,15),(44,15),(45,15),(46,15),(47,15),(48,15),(49,15),(50,15),(51,15),(52,15),(53,15),(54,15),(55,15),(56,15),(57,15),(58,15),(59,15),(60,15),(61,15),(62,15),(63,15),(64,15),(65,15),(66,15),(67,15),(68,15),(69,15),(70,15),(71,15),(72,15),(73,15),(74,15),(75,15),(76,15),(77,15),(78,15),(79,15),(0,16),(1,16),(2,16),(3,16),(4,16),(5,16),(6,16),(7,16),(8,16),(9,16),(10,16),(11,16),(12,16),(13,16),(14,16),(15,16),(16,16),(17,16),(18,16),(19,16),(20,16),(21,16),(22,16),(23,16),(24,16),(25,16),(26,16),(27,16),(28,16),(29,16),(30,16),(31,16),(32,16),(33,16),(34,16),(35,16),(36,16),(37,16),(38,16),(39,16),(40,16),(41,16),(42,16),(43,16),(44,16),(45,16),(46,16),(47,16),(48,16),(49,16),(50,16),(51,16),(52,16),(53,16),(54,16),(55,16),(56,16),(57,16),(58,16),(59,16),(60,16),(61,16),(62,16),(63,16),(64,16),(65,16),(66,16),(67,16),(68,16),(69,16),(70,16),(71,16),(72,16),(73,16),(74,16),(75,16),(76,16),(77,16),(78,16),(79,16),(0,17),(1,17),(2,17),(3,17),(4,17),(5,17),(6,17),(7,17),(8,17),(9,17),(10,17),(11,17),(12,17),(13,17),(14,17),(15,17),(16,17),(17,17),(18,17),(19,17),(20,17),(21,17),(22,17),(23,17),(24,17),(25,17),(26,17),(27,17),(28,17),(29,17),(30,17),(31,17),(32,17),(33,17),(34,17),(35,17),(36,17),(37,17),(38,17),(39,17),(40,17),(41,17),(42,17),(43,17),(44,17),(45,17),(46,17),(47,17),(48,17),(49,17),(50,17),(51,17),(52,17),(53,17),(54,17),(55,17),(56,17),(57,17),(58,17),(59,17),(60,17),(61,17),(62,17),(63,17),(64,17),(65,17),(66,17),(67,17),(68,17),(69,17),(70,17),(71,17),(72,17),(73,17),(74,17),(75,17),(76,17),(77,17),(78,17),(79,17),(0,18),(1,18),(2,18),(3,18),(4,18),(5,18),(6,18),(7,18),(8,18),(9,18),(10,18),(11,18),(12,18),(13,18),(14,18),(15,18),(16,18),(17,18),(18,18),(19,18),(20,18),(21,18),(22,18),(23,18),(24,18),(25,18),(26,18),(27,18),(28,18),(29,18),(30,18),(31,18),(32,18),(33,18),(34,18),(35,18),(36,18),(37,18),(38,18),(39,18),(40,18),(41,18),(42,18),(43,18),(44,18),(45,18),(46,18),(47,18),(48,18),(49,18),(50,18),(51,18),(52,18),(53,18),(54,18),(55,18),(56,18),(57,18),(58,18),(59,18),(60,18),(61,18),(62,18),(63,18),(64,18),(65,18),(66,18),(67,18),(68,18),(69,18),(70,18),(71,18),(72,18),(73,18),(74,18),(75,18),(76,18),(77,18),(78,18),(79,18),(0,19),(1,19),(2,19),(3,19),(4,19),(5,19),(6,19),(7,19),(8,19),(9,19),(10,19),(11,19),(12,19),(13,19),(14,19),(15,19),(16,19),(17,19),(18,19),(19,19),(20,19),(21,19),(22,19),(23,19),(24,19),(25,19),(26,19),(27,19),(28,19),(29,19),(30,19),(31,19),(32,19),(33,19),(34,19),(35,19),(36,19),(37,19),(38,19),(39,19),(40,19),(41,19),(42,19),(43,19),(44,19),(45,19),(46,19),(47,19),(48,19),(49,19),(50,19),(51,19),(52,19),(53,19),(54,19),(55,19),(56,19),(57,19),(58,19),(59,19),(60,19),(61,19),(62,19),(63,19),(64,19),(65,19),(66,19),(67,19),(68,19),(69,19),(70,19),(71,19),(72,19),(73,19),(74,19),(75,19),(76,19),(77,19),(78,19),(79,19),(0,20),(1,20),(2,20),(3,20),(4,20),(5,20),(6,20),(7,20),(8,20),(9,20),(10,20),(11,20),(12,20),(13,20),(14,20),(15,20),(16,20),(17,20),(18,20),(19,20),(20,20),(21,20),(22,20),(23,20),(24,20),(25,20),(26,20),(27,20),(28,20),(29,20),(30,20),(31,20),(32,20),(33,20),(34,20),(35,20),(36,20),(37,20),(38,20),(39,20),(40,20),(41,20),(42,20),(43,20),(44,20),(45,20),(46,20),(47,20),(48,20),(49,20),(50,20),(51,20),(52,20),(53,20),(54,20),(55,20),(56,20),(57,20),(58,20),(59,20),(60,20),(61,20),(62,20),(63,20),(64,20),(65,20),(66,20),(67,20),(68,20),(69,20),(70,20),(71,20),(72,20),(73,20),(74,20),(75,20),(76,20),(77,20),(78,20),(79,20),(0,21),(1,21),(2,21),(3,21),(4,21),(5,21),(6,21),(7,21),(8,21),(9,21),(10,21),(11,21),(12,21),(13,21),(14,21),(15,21),(16,21),(17,21),(18,21),(19,21),(20,21),(21,21),(22,21),(23,21),(24,21),(25,21),(26,21),(27,21),(28,21),(29,21),(30,21),(31,21),(32,21),(33,21),(34,21),(35,21),(36,21),(37,21),(38,21),(39,21),(40,21),(41,21),(42,21),(43,21),(44,21),(45,21),(46,21),(47,21),(48,21),(49,21),(50,21),(51,21),(52,21),(53,21),(54,21),(55,21),(56,21),(57,21),(58,21),(59,21),(60,21),(61,21),(62,21),(63,21),(64,21),(65,21),(66,21),(67,21),(68,21),(69,21),(70,21),(71,21),(72,21),(73,21),(74,21),(75,21),(76,21),(77,21),(78,21),(79,21),(0,22),(1,22),(2,22),(3,22),(4,22),(5,22),(6,22),(7,22),(8,22),(9,22),(10,22),(11,22),(12,22),(13,22),(14,22),(15,22),(16,22),(17,22),(18,22),(19,22),(20,22),(21,22),(22,22),(23,22),(24,22),(25,22),(26,22),(27,22),(28,22),(29,22),(30,22),(31,22),(32,22),(33,22),(34,22),(35,22),(36,22),(37,22),(38,22),(39,22),(40,22),(41,22),(42,22),(43,22),(44,22),(45,22),(46,22),(47,22),(48,22),(49,22),(50,22),(51,22),(52,22),(53,22),(54,22),(55,22),(56,22),(57,22),(58,22),(59,22),(60,22),(61,22),(62,22),(63,22),(64,22),(65,22),(66,22),(67,22),(68,22),(69,22),(70,22),(71,22),(72,22),(73,22),(74,22),(75,22),(76,22),(77,22),(78,22),(79,22),(0,23),(1,23),(2,23),(3,23),(4,23),(5,23),(6,23),(7,23),(8,23),(9,23),(10,23),(11,23),(12,23),(13,23),(14,23),(15,23),(16,23),(17,23),(18,23),(19,23),(20,23),(21,23),(22,23),(23,23),(24,23),(25,23),(26,23),(27,23),(28,23),(29,23),(30,23),(31,23),(32,23),(33,23),(34,23),(35,23),(36,23),(37,23),(38,23),(39,23),(40,23),(41,23),(42,23),(43,23),(44,23),(45,23),(46,23),(47,23),(48,23),(49,23),(50,23),(51,23),(52,23),(53,23),(54,23),(55,23),(56,23),(57,23),(58,23),(59,23),(60,23),(61,23),(62,23),(63,23),(64,23),(65,23),(66,23),(67,23),(68,23),(69,23),(70,23),(71,23),(72,23),(73,23),(74,23),(75,23),(76,23),(77,23),(78,23),(79,23),(0,24),(1,24),(2,24),(3,24),(4,24),(5,24),(6,24),(7,24),(8,24),(9,24),(10,24),(11,24),(12,24),(13,24),(14,24),(15,24),(16,24),(17,24),(18,24),(19,24),(20,24),(21,24),(22,24),(23,24),(24,24),(25,24),(26,24),(27,24),(28,24),(29,24),(30,24),(31,24),(32,24),(33,24),(34,24),(35,24),(36,24),(37,24),(38,24),(39,24),(40,24),(41,24),(42,24),(43,24),(44,24),(45,24),(46,24),(47,24),(48,24),(49,24),(50,24),(51,24),(52,24),(53,24),(54,24),(55,24),(56,24),(57,24),(58,24),(59,24),(60,24),(61,24),(62,24),(63,24),(64,24),(65,24),(66,24),(67,24),(68,24),(69,24),(70,24),(71,24),(72,24),(73,24),(74,24),(75,24),(76,24),(77,24),(78,24),(79,24),(0,25),(1,25),(2,25),(3,25),(4,25),(5,25),(6,25),(7,25),(8,25),(9,25),(10,25),(11,25),(12,25),(13,25),(14,25),(15,25),(16,25),(17,25),(18,25),(19,25),(20,25),(21,25),(22,25),(23,25),(24,25),(25,25),(26,25),(27,25),(28,25),(29,25),(30,25),(31,25),(32,25),(33,25),(34,25),(35,25),(36,25),(37,25),(38,25),(39,25),(40,25),(41,25),(42,25),(43,25),(44,25),(45,25),(46,25),(47,25),(48,25),(49,25),(50,25),(51,25),(52,25),(53,25),(54,25),(55,25),(56,25),(57,25),(58,25),(59,25),(60,25),(61,25),(62,25),(63,25),(64,25),(65,25),(66,25),(67,25),(68,25),(69,25),(70,25),(71,25),(72,25),(73,25),(74,25),(75,25),(76,25),(77,25),(78,25),(79,25),(0,26),(1,26),(2,26),(3,26),(4,26),(5,26),(6,26),(7,26),(8,26),(9,26),(10,26),(11,26),(12,26),(13,26),(14,26),(15,26),(16,26),(17,26),(18,26),(19,26),(20,26),(21,26),(22,26),(23,26),(24,26),(25,26),(26,26),(27,26),(28,26),(29,26),(30,26),(31,26),(32,26),(33,26),(34,26),(35,26),(36,26),(37,26),(38,26),(39,26),(40,26),(41,26),(42,26),(43,26),(44,26),(45,26),(46,26),(47,26),(48,26),(49,26),(50,26),(51,26),(52,26),(53,26),(54,26),(55,26),(56,26),(57,26),(58,26),(59,26),(60,26),(61,26),(62,26),(63,26),(64,26),(65,26),(66,26),(67,26),(68,26),(69,26),(70,26),(71,26),(72,26),(73,26),(74,26),(75,26),(76,26),(77,26),(78,26),(79,26),(0,27),(1,27),(2,27),(3,27),(4,27),(5,27),(6,27),(7,27),(8,27),(9,27),(10,27),(11,27),(12,27),(13,27),(14,27),(15,27),(16,27),(17,27),(18,27),(19,27),(20,27),(21,27),(22,27),(23,27),(24,27),(25,27),(26,27),(27,27),(28,27),(29,27),(30,27),(31,27),(32,27),(33,27),(34,27),(35,27),(36,27),(37,27),(38,27),(39,27),(40,27),(41,27),(42,27),(43,27),(44,27),(45,27),(46,27),(47,27),(48,27),(49,27),(50,27),(51,27),(52,27),(53,27),(54,27),(55,27),(56,27),(57,27),(58,27),(59,27),(60,27),(61,27),(62,27),(63,27),(64,27),(65,27),(66,27),(67,27),(68,27),(69,27),(70,27),(71,27),(72,27),(73,27),(74,27),(75,27),(76,27),(77,27),(78,27),(79,27),(0,28),(1,28),(2,28),(3,28),(4,28),(5,28),(6,28),(7,28),(8,28),(9,28),(10,28),(11,28),(12,28),(13,28),(14,28),(15,28),(16,28),(17,28),(18,28),(19,28),(20,28),(21,28),(22,28),(23,28),(24,28),(25,28),(26,28),(27,28),(28,28),(29,28),(30,28),(31,28),(32,28),(33,28),(34,28),(35,28),(36,28),(37,28),(38,28),(39,28),(40,28),(41,28),(42,28),(43,28),(44,28),(45,28),(46,28),(47,28),(48,28),(49,28),(50,28),(51,28),(52,28),(53,28),(54,28),(55,28),(56,28),(57,28),(58,28),(59,28),(60,28),(61,28),(62,28),(63,28),(64,28),(65,28),(66,28),(67,28),(68,28),(69,28),(70,28),(71,28),(72,28),(73,28),(74,28),(75,28),(76,28),(77,28),(78,28),(79,28),(0,29),(1,29),(2,29),(3,29),(4,29),(5,29),(6,29),(7,29),(8,29),(9,29),(10,29),(11,29),(12,29),(13,29),(14,29),(15,29),(16,29),(17,29),(18,29),(19,29),(20,29),(21,29),(22,29),(23,29),(24,29),(25,29),(26,29),(27,29),(28,29),(29,29),(30,29),(31,29),(32,29),(33,29),(34,29),(35,29),(36,29),(37,29),(38,29),(39,29),(40,29),(41,29),(42,29),(43,29),(44,29),(45,29),(46,29),(47,29),(48,29),(49,29),(50,29),(51,29),(52,29),(53,29),(54,29),(55,29),(56,29),(57,29),(58,29),(59,29),(60,29),(61,29),(62,29),(63,29),(64,29),(65,29),(66,29),(67,29),(68,29),(69,29),(70,29),(71,29),(72,29),(73,29),(74,29),(75,29),(76,29),(77,29),(78,29),(79,29),(0,30),(1,30),(2,30),(3,30),(4,30),(5,30),(6,30),(7,30),(8,30),(9,30),(10,30),(11,30),(12,30),(13,30),(14,30),(15,30),(16,30),(17,30),(18,30),(19,30),(20,30),(21,30),(22,30),(23,30),(24,30),(25,30),(26,30),(27,30),(28,30),(29,30),(30,30),(31,30),(32,30),(33,30),(34,30),(35,30),(36,30),(37,30),(38,30),(39,30),(40,30),(41,30),(42,30),(43,30),(44,30),(45,30),(46,30),(47,30),(48,30),(49,30),(50,30),(51,30),(52,30),(53,30),(54,30),(55,30),(56,30),(57,30),(58,30),(59,30),(60,30),(61,30),(62,30),(63,30),(64,30),(65,30),(66,30),(67,30),(68,30),(69,30),(70,30),(71,30),(72,30),(73,30),(74,30),(75,30),(76,30),(77,30),(78,30),(79,30),(0,31),(1,31),(2,31),(3,31),(4,31),(5,31),(6,31),(7,31),(8,31),(9,31),(10,31),(11,31),(12,31),(13,31),(14,31),(15,31),(16,31),(17,31),(18,31),(19,31),(20,31),(21,31),(22,31),(23,31),(24,31),(25,31),(26,31),(27,31),(28,31),(29,31),(30,31),(31,31),(32,31),(33,31),(34,31),(35,31),(36,31),(37,31),(38,31),(39,31),(40,31),(41,31),(42,31),(43,31),(44,31),(45,31),(46,31),(47,31),(48,31),(49,31),(50,31),(51,31),(52,31),(53,31),(54,31),(55,31),(56,31),(57,31),(58,31),(59,31),(60,31),(61,31),(62,31),(63,31),(64,31),(65,31),(66,31),(67,31),(68,31),(69,31),(70,31),(71,31),(72,31),(73,31),(74,31),(75,31),(76,31),(77,31),(78,31),(79,31),(0,32),(1,32),(2,32),(3,32),(4,32),(5,32),(6,32),(7,32),(8,32),(9,32),(10,32),(11,32),(12,32),(13,32),(14,32),(15,32),(16,32),(17,32),(18,32),(19,32),(20,32),(21,32),(22,32),(23,32),(24,32),(25,32),(26,32),(27,32),(28,32),(29,32),(30,32),(31,32),(32,32),(33,32),(34,32),(35,32),(36,32),(37,32),(38,32),(39,32),(40,32),(41,32),(42,32),(43,32),(44,32),(45,32),(46,32),(47,32),(48,32),(49,32),(50,32),(51,32),(52,32),(53,32),(54,32),(55,32),(56,32),(57,32),(58,32),(59,32),(60,32),(61,32),(62,32),(63,32),(64,32),(65,32),(66,32),(67,32),(68,32),(69,32),(70,32),(71,32),(72,32),(73,32),(74,32),(75,32),(76,32),(77,32),(78,32),(79,32),(0,33),(1,33),(2,33),(3,33),(4,33),(5,33),(6,33),(7,33),(8,33),(9,33),(10,33),(11,33),(12,33),(13,33),(14,33),(15,33),(16,33),(17,33),(18,33),(19,33),(20,33),(21,33),(22,33),(23,33),(24,33),(25,33),(26,33),(27,33),(28,33),(29,33),(30,33),(31,33),(32,33),(33,33),(34,33),(35,33),(36,33),(37,33),(38,33),(39,33),(40,33),(41,33),(42,33),(43,33),(44,33),(45,33),(46,33),(47,33),(48,33),(49,33),(50,33),(51,33),(52,33),(53,33),(54,33),(55,33),(56,33),(57,33),(58,33),(59,33),(60,33),(61,33),(62,33),(63,33),(64,33),(65,33),(66,33),(67,33),(68,33),(69,33),(70,33),(71,33),(72,33),(73,33),(74,33),(75,33),(76,33),(77,33),(78,33),(79,33),(0,34),(1,34),(2,34),(3,34),(4,34),(5,34),(6,34),(7,34),(8,34),(9,34),(10,34),(11,34),(12,34),(13,34),(14,34),(15,34),(16,34),(17,34),(18,34),(19,34),(20,34),(21,34),(22,34),(23,34),(24,34),(25,34),(26,34),(27,34),(28,34),(29,34),(30,34),(31,34),(32,34),(33,34),(34,34),(35,34),(36,34),(37,34),(38,34),(39,34),(40,34),(41,34),(42,34),(43,34),(44,34),(45,34),(46,34),(47,34),(48,34),(49,34),(50,34),(51,34),(52,34),(53,34),(54,34),(55,34),(56,34),(57,34),(58,34),(59,34),(60,34),(61,34),(62,34),(63,34),(64,34),(65,34),(66,34),(67,34),(68,34),(69,34),(70,34),(71,34),(72,34),(73,34),(74,34),(75,34),(76,34),(77,34),(78,34),(79,34),(0,35),(1,35),(2,35),(3,35),(4,35),(5,35),(6,35),(7,35),(8,35),(9,35),(10,35),(11,35),(12,35),(13,35),(14,35),(15,35),(16,35),(17,35),(18,35),(19,35),(20,35),(21,35),(22,35),(23,35),(24,35),(25,35),(26,35),(27,35),(28,35),(29,35),(30,35),(31,35),(32,35),(33,35),(34,35),(35,35),(36,35),(37,35),(38,35),(39,35),(40,35),(41,35),(42,35),(43,35),(44,35),(45,35),(46,35),(47,35),(48,35),(49,35),(50,35),(51,35),(52,35),(53,35),(54,35),(55,35),(56,35),(57,35),(58,35),(59,35),(60,35),(61,35),(62,35),(63,35),(64,35),(65,35),(66,35),(67,35),(68,35),(69,35),(70,35),(71,35),(72,35),(73,35),(74,35),(75,35),(76,35),(77,35),(78,35),(79,35),(0,36),(1,36),(2,36),(3,36),(4,36),(5,36),(6,36),(7,36),(8,36),(9,36),(10,36),(11,36),(12,36),(13,36),(14,36),(15,36),(16,36),(17,36),(18,36),(19,36),(20,36),(21,36),(22,36),(23,36),(24,36),(25,36),(26,36),(27,36),(28,36),(29,36),(30,36),(31,36),(32,36),(33,36),(34,36),(35,36),(36,36),(37,36),(38,36),(39,36),(40,36),(41,36),(42,36),(43,36),(44,36),(45,36),(46,36),(47,36),(48,36),(49,36),(50,36),(51,36),(52,36),(53,36),(54,36),(55,36),(56,36),(57,36),(58,36),(59,36),(60,36),(61,36),(62,36),(63,36),(64,36),(65,36),(66,36),(67,36),(68,36),(69,36),(70,36),(71,36),(72,36),(73,36),(74,36),(75,36),(76,36),(77,36),(78,36),(79,36),(0,37),(1,37),(2,37),(3,37),(4,37),(5,37),(6,37),(7,37),(8,37),(9,37),(10,37),(11,37),(12,37),(13,37),(14,37),(15,37),(16,37),(17,37),(18,37),(19,37),(20,37),(21,37),(22,37),(23,37),(24,37),(25,37),(26,37),(27,37),(28,37),(29,37),(30,37),(31,37),(32,37),(33,37),(34,37),(35,37),(36,37),(37,37),(38,37),(39,37),(40,37),(41,37),(42,37),(43,37),(44,37),(45,37),(46,37),(47,37),(48,37),(49,37),(50,37),(51,37),(52,37),(53,37),(54,37),(55,37),(56,37),(57,37),(58,37),(59,37),(60,37),(61,37),(62,37),(63,37),(64,37),(65,37),(66,37),(67,37),(68,37),(69,37),(70,37),(71,37),(72,37),(73,37),(74,37),(75,37),(76,37),(77,37),(78,37),(79,37),(0,38),(1,38),(2,38),(3,38),(4,38),(5,38),(6,38),(7,38),(8,38),(9,38),(10,38),(11,38),(12,38),(13,38),(14,38),(15,38),(16,38),(17,38),(18,38),(19,38),(20,38),(21,38),(22,38),(23,38),(24,38),(25,38),(26,38),(27,38),(28,38),(29,38),(30,38),(31,38),(32,38),(33,38),(34,38),(35,38),(36,38),(37,38),(38,38),(39,38),(40,38),(41,38),(42,38),(43,38),(44,38),(45,38),(46,38),(47,38),(48,38),(49,38),(50,38),(51,38),(52,38),(53,38),(54,38),(55,38),(56,38),(57,38),(58,38),(59,38),(60,38),(61,38),(62,38),(63,38),(64,38),(65,38),(66,38),(67,38),(68,38),(69,38),(70,38),(71,38),(72,38),(73,38),(74,38),(75,38),(76,38),(77,38),(78,38),(79,38),(0,39),(1,39),(2,39),(3,39),(4,39),(5,39),(6,39),(7,39),(8,39),(9,39),(10,39),(11,39),(12,39),(13,39),(14,39),(15,39),(16,39),(17,39),(18,39),(19,39),(20,39),(21,39),(22,39),(23,39),(24,39),(25,39),(26,39),(27,39),(28,39),(29,39),(30,39),(31,39),(32,39),(33,39),(34,39),(35,39),(36,39),(37,39),(38,39),(39,39),(40,39),(41,39),(42,39),(43,39),(44,39),(45,39),(46,39),(47,39),(48,39),(49,39),(50,39),(51,39),(52,39),(53,39),(54,39),(55,39),(56,39),(57,39),(58,39),(59,39),(60,39),(61,39),(62,39),(63,39),(64,39),(65,39),(66,39),(67,39),(68,39),(69,39),(70,39),(71,39),(72,39),(73,39),(74,39),(75,39),(76,39),(77,39),(78,39),(79,39),(0,40),(1,40),(2,40),(3,40),(4,40),(5,40),(6,40),(7,40),(8,40),(9,40),(10,40),(11,40),(12,40),(13,40),(14,40),(15,40),(16,40),(17,40),(18,40),(19,40),(20,40),(21,40),(22,40),(23,40),(24,40),(25,40),(26,40),(27,40),(28,40),(29,40),(30,40),(31,40),(32,40),(33,40),(34,40),(35,40),(36,40),(37,40),(38,40),(39,40),(40,40),(41,40),(42,40),(43,40),(44,40),(45,40),(46,40),(47,40),(48,40),(49,40),(50,40),(51,40),(52,40),(53,40),(54,40),(55,40),(56,40),(57,40),(58,40),(59,40),(60,40),(61,40),(62,40),(63,40),(64,40),(65,40),(66,40),(67,40),(68,40),(69,40),(70,40),(71,40),(72,40),(73,40),(74,40),(75,40),(76,40),(77,40),(78,40),(79,40),(0,41),(1,41),(2,41),(3,41),(4,41),(5,41),(6,41),(7,41),(8,41),(9,41),(10,41),(11,41),(12,41),(13,41),(14,41),(15,41),(16,41),(17,41),(18,41),(19,41),(20,41),(21,41),(22,41),(23,41),(24,41),(25,41),(26,41),(27,41),(28,41),(29,41),(30,41),(31,41),(32,41),(33,41),(34,41),(35,41),(36,41),(37,41),(38,41),(39,41),(40,41),(41,41),(42,41),(43,41),(44,41),(45,41),(46,41),(47,41),(48,41),(49,41),(50,41),(51,41),(52,41),(53,41),(54,41),(55,41),(56,41),(57,41),(58,41),(59,41),(60,41),(61,41),(62,41),(63,41),(64,41),(65,41),(66,41),(67,41),(68,41),(69,41),(70,41),(71,41),(72,41),(73,41),(74,41),(75,41),(76,41),(77,41),(78,41),(79,41),(0,42),(1,42),(2,42),(3,42),(4,42),(5,42),(6,42),(7,42),(8,42),(9,42),(10,42),(11,42),(12,42),(13,42),(14,42),(15,42),(16,42),(17,42),(18,42),(19,42),(20,42),(21,42),(22,42),(23,42),(24,42),(25,42),(26,42),(27,42),(28,42),(29,42),(30,42),(31,42),(32,42),(33,42),(34,42),(35,42),(36,42),(37,42),(38,42),(39,42),(40,42),(41,42),(42,42),(43,42),(44,42),(45,42),(46,42),(47,42),(48,42),(49,42),(50,42),(51,42),(52,42),(53,42),(54,42),(55,42),(56,42),(57,42),(58,42),(59,42),(60,42),(61,42),(62,42),(63,42),(64,42),(65,42),(66,42),(67,42),(68,42),(69,42),(70,42),(71,42),(72,42),(73,42),(74,42),(75,42),(76,42),(77,42),(78,42),(79,42),(0,43),(1,43),(2,43),(3,43),(4,43),(5,43),(6,43),(7,43),(8,43),(9,43),(10,43),(11,43),(12,43),(13,43),(14,43),(15,43),(16,43),(17,43),(18,43),(19,43),(20,43),(21,43),(22,43),(23,43),(24,43),(25,43),(26,43),(27,43),(28,43),(29,43),(30,43),(31,43),(32,43),(33,43),(34,43),(35,43),(36,43),(37,43),(38,43),(39,43),(40,43),(41,43),(42,43),(43,43),(44,43),(45,43),(46,43),(47,43),(48,43),(49,43),(50,43),(51,43),(52,43),(53,43),(54,43),(55,43),(56,43),(57,43),(58,43),(59,43),(60,43),(61,43),(62,43),(63,43),(64,43),(65,43),(66,43),(67,43),(68,43),(69,43),(70,43),(71,43),(72,43),(73,43),(74,43),(75,43),(76,43),(77,43),(78,43),(79,43),(0,44),(1,44),(2,44),(3,44),(4,44),(5,44),(6,44),(7,44),(8,44),(9,44),(10,44),(11,44),(12,44),(13,44),(14,44),(15,44),(16,44),(17,44),(18,44),(19,44),(20,44),(21,44),(22,44),(23,44),(24,44),(25,44),(26,44),(27,44),(28,44),(29,44),(30,44),(31,44),(32,44),(33,44),(34,44),(35,44),(36,44),(37,44),(38,44),(39,44),(40,44),(41,44),(42,44),(43,44),(44,44),(45,44),(46,44),(47,44),(48,44),(49,44),(50,44),(51,44),(52,44),(53,44),(54,44),(55,44),(56,44),(57,44),(58,44),(59,44),(60,44),(61,44),(62,44),(63,44),(64,44),(65,44),(66,44),(67,44),(68,44),(69,44),(70,44),(71,44),(72,44),(73,44),(74,44),(75,44),(76,44),(77,44),(78,44),(79,44),(0,45),(1,45),(2,45),(3,45),(4,45),(5,45),(6,45),(7,45),(8,45),(9,45),(10,45),(11,45),(12,45),(13,45),(14,45),(15,45),(16,45),(17,45),(18,45),(19,45),(20,45),(21,45),(22,45),(23,45),(24,45),(25,45),(26,45),(27,45),(28,45),(29,45),(30,45),(31,45),(32,45),(33,45),(34,45),(35,45),(36,45),(37,45),(38,45),(39,45),(40,45),(41,45),(42,45),(43,45),(44,45),(45,45),(46,45),(47,45),(48,45),(49,45),(50,45),(51,45),(52,45),(53,45),(54,45),(55,45),(56,45),(57,45),(58,45),(59,45),(60,45),(61,45),(62,45),(63,45),(64,45),(65,45),(66,45),(67,45),(68,45),(69,45),(70,45),(71,45),(72,45),(73,45),(74,45),(75,45),(76,45),(77,45),(78,45),(79,45),(0,46),(1,46),(2,46),(3,46),(4,46),(5,46),(6,46),(7,46),(8,46),(9,46),(10,46),(11,46),(12,46),(13,46),(14,46),(15,46),(16,46),(17,46),(18,46),(19,46),(20,46),(21,46),(22,46),(23,46),(24,46),(25,46),(26,46),(27,46),(28,46),(29,46),(30,46),(31,46),(32,46),(33,46),(34,46),(35,46),(36,46),(37,46),(38,46),(39,46),(40,46),(41,46),(42,46),(43,46),(44,46),(45,46),(46,46),(47,46),(48,46),(49,46),(50,46),(51,46),(52,46),(53,46),(54,46),(55,46),(56,46),(57,46),(58,46),(59,46),(60,46),(61,46),(62,46),(63,46),(64,46),(65,46),(66,46),(67,46),(68,46),(69,46),(70,46),(71,46),(72,46),(73,46),(74,46),(75,46),(76,46),(77,46),(78,46),(79,46),(0,47),(1,47),(2,47),(3,47),(4,47),(5,47),(6,47),(7,47),(8,47),(9,47),(10,47),(11,47),(12,47),(13,47),(14,47),(15,47),(16,47),(17,47),(18,47),(19,47),(20,47),(21,47),(22,47),(23,47),(24,47),(25,47),(26,47),(27,47),(28,47),(29,47),(30,47),(31,47),(32,47),(33,47),(34,47),(35,47),(36,47),(37,47),(38,47),(39,47),(40,47),(41,47),(42,47),(43,47),(44,47),(45,47),(46,47),(47,47),(48,47),(49,47),(50,47),(51,47),(52,47),(53,47),(54,47),(55,47),(56,47),(57,47),(58,47),(59,47),(60,47),(61,47),(62,47),(63,47),(64,47),(65,47),(66,47),(67,47),(68,47),(69,47),(70,47),(71,47),(72,47),(73,47),(74,47),(75,47),(76,47),(77,47),(78,47),(79,47),(0,48),(1,48),(2,48),(3,48),(4,48),(5,48),(6,48),(7,48),(8,48),(9,48),(10,48),(11,48),(12,48),(13,48),(14,48),(15,48),(16,48),(17,48),(18,48),(19,48),(20,48),(21,48),(22,48),(23,48),(24,48),(25,48),(26,48),(27,48),(28,48),(29,48),(30,48),(31,48),(32,48),(33,48),(34,48),(35,48),(36,48),(37,48),(38,48),(39,48),(40,48),(41,48),(42,48),(43,48),(44,48),(45,48),(46,48),(47,48),(48,48),(49,48),(50,48),(51,48),(52,48),(53,48),(54,48),(55,48),(56,48),(57,48),(58,48),(59,48),(60,48),(61,48),(62,48),(63,48),(64,48),(65,48),(66,48),(67,48),(68,48),(69,48),(70,48),(71,48),(72,48),(73,48),(74,48),(75,48),(76,48),(77,48),(78,48),(79,48),(0,49),(1,49),(2,49),(3,49),(4,49),(5,49),(6,49),(7,49),(8,49),(9,49),(10,49),(11,49),(12,49),(13,49),(14,49),(15,49),(16,49),(17,49),(18,49),(19,49),(20,49),(21,49),(22,49),(23,49),(24,49),(25,49),(26,49),(27,49),(28,49),(29,49),(30,49),(31,49),(32,49),(33,49),(34,49),(35,49),(36,49),(37,49),(38,49),(39,49),(40,49),(41,49),(42,49),(43,49),(44,49),(45,49),(46,49),(47,49),(48,49),(49,49),(50,49),(51,49),(52,49),(53,49),(54,49),(55,49),(56,49),(57,49),(58,49),(59,49),(60,49),(61,49),(62,49),(63,49),(64,49),(65,49),(66,49),(67,49),(68,49),(69,49),(70,49),(71,49),(72,49),(73,49),(74,49),(75,49),(76,49),(77,49),(78,49),(79,49),(0,50),(1,50),(2,50),(3,50),(4,50),(5,50),(6,50),(7,50),(8,50),(9,50),(10,50),(11,50),(12,50),(13,50),(14,50),(15,50),(16,50),(17,50),(18,50),(19,50),(20,50),(21,50),(22,50),(23,50),(24,50),(25,50),(26,50),(27,50),(28,50),(29,50),(30,50),(31,50),(32,50),(33,50),(34,50),(35,50),(36,50),(37,50),(38,50),(39,50),(40,50),(41,50),(42,50),(43,50),(44,50),(45,50),(46,50),(47,50),(48,50),(49,50),(50,50),(51,50),(52,50),(53,50),(54,50),(55,50),(56,50),(57,50),(58,50),(59,50),(60,50),(61,50),(62,50),(63,50),(64,50),(65,50),(66,50),(67,50),(68,50),(69,50),(70,50),(71,50),(72,50),(73,50),(74,50),(75,50),(76,50),(77,50),(78,50),(79,50),(0,51),(1,51),(2,51),(3,51),(4,51),(5,51),(6,51),(7,51),(8,51),(9,51),(10,51),(11,51),(12,51),(13,51),(14,51),(15,51),(16,51),(17,51),(18,51),(19,51),(20,51),(21,51),(22,51),(23,51),(24,51),(25,51),(26,51),(27,51),(28,51),(29,51),(30,51),(31,51),(32,51),(33,51),(34,51),(35,51),(36,51),(37,51),(38,51),(39,51),(40,51),(41,51),(42,51),(43,51),(44,51),(45,51),(46,51),(47,51),(48,51),(49,51),(50,51),(51,51),(52,51),(53,51),(54,51),(55,51),(56,51),(57,51),(58,51),(59,51),(60,51),(61,51),(62,51),(63,51),(64,51),(65,51),(66,51),(67,51),(68,51),(69,51),(70,51),(71,51),(72,51),(73,51),(74,51),(75,51),(76,51),(77,51),(78,51),(79,51),(0,52),(1,52),(2,52),(3,52),(4,52),(5,52),(6,52),(7,52),(8,52),(9,52),(10,52),(11,52),(12,52),(13,52),(14,52),(15,52),(16,52),(17,52),(18,52),(19,52),(20,52),(21,52),(22,52),(23,52),(24,52),(25,52),(26,52),(27,52),(28,52),(29,52),(30,52),(31,52),(32,52),(33,52),(34,52),(35,52),(36,52),(37,52),(38,52),(39,52),(40,52),(41,52),(42,52),(43,52),(44,52),(45,52),(46,52),(47,52),(48,52),(49,52),(50,52),(51,52),(52,52),(53,52),(54,52),(55,52),(56,52),(57,52),(58,52),(59,52),(60,52),(61,52),(62,52),(63,52),(64,52),(65,52),(66,52),(67,52),(68,52),(69,52),(70,52),(71,52),(72,52),(73,52),(74,52),(75,52),(76,52),(77,52),(78,52),(79,52),(0,53),(1,53),(2,53),(3,53),(4,53),(5,53),(6,53),(7,53),(8,53),(9,53),(10,53),(11,53),(12,53),(13,53),(14,53),(15,53),(16,53),(17,53),(18,53),(19,53),(20,53),(21,53),(22,53),(23,53),(24,53),(25,53),(26,53),(27,53),(28,53),(29,53),(30,53),(31,53),(32,53),(33,53),(34,53),(35,53),(36,53),(37,53),(38,53),(39,53),(40,53),(41,53),(42,53),(43,53),(44,53),(45,53),(46,53),(47,53),(48,53),(49,53),(50,53),(51,53),(52,53),(53,53),(54,53),(55,53),(56,53),(57,53),(58,53),(59,53),(60,53),(61,53),(62,53),(63,53),(64,53),(65,53),(66,53),(67,53),(68,53),(69,53),(70,53),(71,53),(72,53),(73,53),(74,53),(75,53),(76,53),(77,53),(78,53),(79,53),(0,54),(1,54),(2,54),(3,54),(4,54),(5,54),(6,54),(7,54),(8,54),(9,54),(10,54),(11,54),(12,54),(13,54),(14,54),(15,54),(16,54),(17,54),(18,54),(19,54),(20,54),(21,54),(22,54),(23,54),(24,54),(25,54),(26,54),(27,54),(28,54),(29,54),(30,54),(31,54),(32,54),(33,54),(34,54),(35,54),(36,54),(37,54),(38,54),(39,54),(40,54),(41,54),(42,54),(43,54),(44,54),(45,54),(46,54),(47,54),(48,54),(49,54),(50,54),(51,54),(52,54),(53,54),(54,54),(55,54),(56,54),(57,54),(58,54),(59,54),(60,54),(61,54),(62,54),(63,54),(64,54),(65,54),(66,54),(67,54),(68,54),(69,54),(70,54),(71,54),(72,54),(73,54),(74,54),(75,54),(76,54),(77,54),(78,54),(79,54),(0,55),(1,55),(2,55),(3,55),(4,55),(5,55),(6,55),(7,55),(8,55),(9,55),(10,55),(11,55),(12,55),(13,55),(14,55),(15,55),(16,55),(17,55),(18,55),(19,55),(20,55),(21,55),(22,55),(23,55),(24,55),(25,55),(26,55),(27,55),(28,55),(29,55),(30,55),(31,55),(32,55),(33,55),(34,55),(35,55),(36,55),(37,55),(38,55),(39,55),(40,55),(41,55),(42,55),(43,55),(44,55),(45,55),(46,55),(47,55),(48,55),(49,55),(50,55),(51,55),(52,55),(53,55),(54,55),(55,55),(56,55),(57,55),(58,55),(59,55),(60,55),(61,55),(62,55),(63,55),(64,55),(65,55),(66,55),(67,55),(68,55),(69,55),(70,55),(71,55),(72,55),(73,55),(74,55),(75,55),(76,55),(77,55),(78,55),(79,55),(0,56),(1,56),(2,56),(3,56),(4,56),(5,56),(6,56),(7,56),(8,56),(9,56),(10,56),(11,56),(12,56),(13,56),(14,56),(15,56),(16,56),(17,56),(18,56),(19,56),(20,56),(21,56),(22,56),(23,56),(24,56),(25,56),(26,56),(27,56),(28,56),(29,56),(30,56),(31,56),(32,56),(33,56),(34,56),(35,56),(36,56),(37,56),(38,56),(39,56),(40,56),(41,56),(42,56),(43,56),(44,56),(45,56),(46,56),(47,56),(48,56),(49,56),(50,56),(51,56),(52,56),(53,56),(54,56),(55,56),(56,56),(57,56),(58,56),(59,56),(60,56),(61,56),(62,56),(63,56),(64,56),(65,56),(66,56),(67,56),(68,56),(69,56),(70,56),(71,56),(72,56),(73,56),(74,56),(75,56),(76,56),(77,56),(78,56),(79,56),(0,57),(1,57),(2,57),(3,57),(4,57),(5,57),(6,57),(7,57),(8,57),(9,57),(10,57),(11,57),(12,57),(13,57),(14,57),(15,57),(16,57),(17,57),(18,57),(19,57),(20,57),(21,57),(22,57),(23,57),(24,57),(25,57),(26,57),(27,57),(28,57),(29,57),(30,57),(31,57),(32,57),(33,57),(34,57),(35,57),(36,57),(37,57),(38,57),(39,57),(40,57),(41,57),(42,57),(43,57),(44,57),(45,57),(46,57),(47,57),(48,57),(49,57),(50,57),(51,57),(52,57),(53,57),(54,57),(55,57),(56,57),(57,57),(58,57),(59,57),(60,57),(61,57),(62,57),(63,57),(64,57),(65,57),(66,57),(67,57),(68,57),(69,57),(70,57),(71,57),(72,57),(73,57),(74,57),(75,57),(76,57),(77,57),(78,57),(79,57),(0,58),(1,58),(2,58),(3,58),(4,58),(5,58),(6,58),(7,58),(8,58),(9,58),(10,58),(11,58),(12,58),(13,58),(14,58),(15,58),(16,58),(17,58),(18,58),(19,58),(20,58),(21,58),(22,58),(23,58),(24,58),(25,58),(26,58),(27,58),(28,58),(29,58),(30,58),(31,58),(32,58),(33,58),(34,58),(35,58),(36,58),(37,58),(38,58),(39,58),(40,58),(41,58),(42,58),(43,58),(44,58),(45,58),(46,58),(47,58),(48,58),(49,58),(50,58),(51,58),(52,58),(53,58),(54,58),(55,58),(56,58),(57,58),(58,58),(59,58),(60,58),(61,58),(62,58),(63,58),(64,58),(65,58),(66,58),(67,58),(68,58),(69,58),(70,58),(71,58),(72,58),(73,58),(74,58),(75,58),(76,58),(77,58),(78,58),(79,58),(0,59),(1,59),(2,59),(3,59),(4,59),(5,59),(6,59),(7,59),(8,59),(9,59),(10,59),(11,59),(12,59),(13,59),(14,59),(15,59),(16,59),(17,59),(18,59),(19,59),(20,59),(21,59),(22,59),(23,59),(24,59),(25,59),(26,59),(27,59),(28,59),(29,59),(30,59),(31,59),(32,59),(33,59),(34,59),(35,59),(36,59),(37,59),(38,59),(39,59),(40,59),(41,59),(42,59),(43,59),(44,59),(45,59),(46,59),(47,59),(48,59),(49,59),(50,59),(51,59),(52,59),(53,59),(54,59),(55,59),(56,59),(57,59),(58,59),(59,59),(60,59),(61,59),(62,59),(63,59),(64,59),(65,59),(66,59),(67,59),(68,59),(69,59),(70,59),(71,59),(72,59),(73,59),(74,59),(75,59),(76,59),(77,59),(78,59),(79,59),(0,60),(1,60),(2,60),(3,60),(4,60),(5,60),(6,60),(7,60),(8,60),(9,60),(10,60),(11,60),(12,60),(13,60),(14,60),(15,60),(16,60),(17,60),(18,60),(19,60),(20,60),(21,60),(22,60),(23,60),(24,60),(25,60),(26,60),(27,60),(28,60),(29,60),(30,60),(31,60),(32,60),(33,60),(34,60),(35,60),(36,60),(37,60),(38,60),(39,60),(40,60),(41,60),(42,60),(43,60),(44,60),(45,60),(46,60),(47,60),(48,60),(49,60),(50,60),(51,60),(52,60),(53,60),(54,60),(55,60),(56,60),(57,60),(58,60),(59,60),(60,60),(61,60),(62,60),(63,60),(64,60),(65,60),(66,60),(67,60),(68,60),(69,60),(70,60),(71,60),(72,60),(73,60),(74,60),(75,60),(76,60),(77,60),(78,60),(79,60),(0,61),(1,61),(2,61),(3,61),(4,61),(5,61),(6,61),(7,61),(8,61),(9,61),(10,61),(11,61),(12,61),(13,61),(14,61),(15,61),(16,61),(17,61),(18,61),(19,61),(20,61),(21,61),(22,61),(23,61),(24,61),(25,61),(26,61),(27,61),(28,61),(29,61),(30,61),(31,61),(32,61),(33,61),(34,61),(35,61),(36,61),(37,61),(38,61),(39,61),(40,61),(41,61),(42,61),(43,61),(44,61),(45,61),(46,61),(47,61),(48,61),(49,61),(50,61),(51,61),(52,61),(53,61),(54,61),(55,61),(56,61),(57,61),(58,61),(59,61),(60,61),(61,61),(62,61),(63,61),(64,61),(65,61),(66,61),(67,61),(68,61),(69,61),(70,61),(71,61),(72,61),(73,61),(74,61),(75,61),(76,61),(77,61),(78,61),(79,61),(0,62),(1,62),(2,62),(3,62),(4,62),(5,62),(6,62),(7,62),(8,62),(9,62),(10,62),(11,62),(12,62),(13,62),(14,62),(15,62),(16,62),(17,62),(18,62),(19,62),(20,62),(21,62),(22,62),(23,62),(24,62),(25,62),(26,62),(27,62),(28,62),(29,62),(30,62),(31,62),(32,62),(33,62),(34,62),(35,62),(36,62),(37,62),(38,62),(39,62),(40,62),(41,62),(42,62),(43,62),(44,62),(45,62),(46,62),(47,62),(48,62),(49,62),(50,62),(51,62),(52,62),(53,62),(54,62),(55,62),(56,62),(57,62),(58,62),(59,62),(60,62),(61,62),(62,62),(63,62),(64,62),(65,62),(66,62),(67,62),(68,62),(69,62),(70,62),(71,62),(72,62),(73,62),(74,62),(75,62),(76,62),(77,62),(78,62),(79,62),(0,63),(1,63),(2,63),(3,63),(4,63),(5,63),(6,63),(7,63),(8,63),(9,63),(10,63),(11,63),(12,63),(13,63),(14,63),(15,63),(16,63),(17,63),(18,63),(19,63),(20,63),(21,63),(22,63),(23,63),(24,63),(25,63),(26,63),(27,63),(28,63),(29,63),(30,63),(31,63),(32,63),(33,63),(34,63),(35,63),(36,63),(37,63),(38,63),(39,63),(40,63),(41,63),(42,63),(43,63),(44,63),(45,63),(46,63),(47,63),(48,63),(49,63),(50,63),(51,63),(52,63),(53,63),(54,63),(55,63),(56,63),(57,63),(58,63),(59,63),(60,63),(61,63),(62,63),(63,63),(64,63),(65,63),(66,63),(67,63),(68,63),(69,63),(70,63),(71,63),(72,63),(73,63),(74,63),(75,63),(76,63),(77,63),(78,63),(79,63),(0,64),(1,64),(2,64),(3,64),(4,64),(5,64),(6,64),(7,64),(8,64),(9,64),(10,64),(11,64),(12,64),(13,64),(14,64),(15,64),(16,64),(17,64),(18,64),(19,64),(20,64),(21,64),(22,64),(23,64),(24,64),(25,64),(26,64),(27,64),(28,64),(29,64),(30,64),(31,64),(32,64),(33,64),(34,64),(35,64),(36,64),(37,64),(38,64),(39,64),(40,64),(41,64),(42,64),(43,64),(44,64),(45,64),(46,64),(47,64),(48,64),(49,64),(50,64),(51,64),(52,64),(53,64),(54,64),(55,64),(56,64),(57,64),(58,64),(59,64),(60,64),(61,64),(62,64),(63,64),(64,64),(65,64),(66,64),(67,64),(68,64),(69,64),(70,64),(71,64),(72,64),(73,64),(74,64),(75,64),(76,64),(77,64),(78,64),(79,64)}
location.notPassable = {(70,30),(71,30),(72,30),(74,30),(70,31),(72,31),(73,31),(74,31),(75,31),(70,32),(71,32),(72,32),(73,32),(74,32),(75,32),(71,33),(73,33),(74,33),(36,51),(37,51),(38,51),(39,51),(42,51),(35,52),(36,52),(37,52),(38,52),(41,52),(43,52),(34,53),(35,53),(42,53),(43,53),(44,53),(45,53),(33,54),(34,54),(35,54),(43,54),(44,54),(45,54),(46,54),(34,55),(36,55),(42,55),(43,55),(45,55),(46,55),(34,56),(35,56),(36,56),(41,56),(43,56),(44,56),(45,56),(36,57),(37,57),(38,57),(40,57),(41,57),(42,57),(43,57),(44,57),(37,58),(38,58),(39,58),(40,58),(41,58)}
location.buildings = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0),(6,0),(7,0),(10,0),(11,0),(12,0),(13,0),(14,0),(15,0),(16,0),(17,0),(18,0),(19,0),(20,0),(21,0),(22,0),(23,0),(24,0),(25,0),(26,0),(27,0),(28,0),(29,0),(30,0),(31,0),(32,0),(33,0),(34,0),(35,0),(36,0),(37,0),(38,0),(39,0),(42,0),(43,0),(47,0),(48,0),(49,0),(50,0),(51,0),(52,0),(53,0),(54,0),(55,0),(56,0),(57,0),(58,0),(59,0),(60,0),(61,0),(62,0),(63,0),(64,0),(65,0),(66,0),(67,0),(68,0),(69,0),(70,0),(71,0),(72,0),(73,0),(74,0),(75,0),(76,0),(77,0),(78,0),(79,0),(0,1),(1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(9,1),(10,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(28,1),(29,1),(30,1),(31,1),(32,1),(33,1),(34,1),(35,1),(36,1),(37,1),(38,1),(39,1),(42,1),(43,1),(44,1),(45,1),(46,1),(47,1),(48,1),(49,1),(50,1),(51,1),(52,1),(53,1),(54,1),(55,1),(56,1),(57,1),(58,1),(59,1),(60,1),(61,1),(62,1),(63,1),(64,1),(65,1),(66,1),(67,1),(68,1),(69,1),(70,1),(71,1),(72,1),(73,1),(74,1),(75,1),(76,1),(77,1),(78,1),(79,1),(0,2),(3,2),(4,2),(5,2),(6,2),(10,2),(17,2),(18,2),(19,2),(20,2),(21,2),(22,2),(23,2),(24,2),(25,2),(26,2),(27,2),(28,2),(29,2),(30,2),(31,2),(32,2),(33,2),(34,2),(35,2),(36,2),(37,2),(38,2),(39,2),(42,2),(43,2),(44,2),(45,2),(46,2),(47,2),(48,2),(49,2),(50,2),(51,2),(52,2),(53,2),(54,2),(55,2),(56,2),(57,2),(58,2),(59,2),(60,2),(61,2),(62,2),(63,2),(64,2),(65,2),(66,2),(67,2),(68,2),(69,2),(70,2),(71,2),(72,2),(73,2),(74,2),(75,2),(76,2),(77,2),(78,2),(79,2),(0,3),(1,3),(2,3),(3,3),(4,3),(5,3),(6,3),(7,3),(8,3),(9,3),(10,3),(11,3),(12,3),(13,3),(14,3),(15,3),(16,3),(17,3),(18,3),(19,3),(20,3),(21,3),(22,3),(23,3),(24,3),(25,3),(26,3),(27,3),(28,3),(29,3),(30,3),(31,3),(32,3),(33,3),(34,3),(35,3),(36,3),(37,3),(38,3),(39,3),(42,3),(43,3),(44,3),(45,3),(46,3),(47,3),(48,3),(49,3),(50,3),(51,3),(52,3),(53,3),(54,3),(55,3),(56,3),(57,3),(58,3),(59,3),(60,3),(61,3),(62,3),(63,3),(64,3),(65,3),(66,3),(67,3),(68,3),(69,3),(70,3),(71,3),(72,3),(73,3),(74,3),(75,3),(76,3),(77,3),(78,3),(79,3),(0,4),(1,4),(2,4),(3,4),(4,4),(5,4),(6,4),(7,4),(8,4),(9,4),(10,4),(11,4),(12,4),(13,4),(14,4),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),(21,4),(22,4),(23,4),(24,4),(25,4),(26,4),(27,4),(28,4),(29,4),(30,4),(31,4),(32,4),(33,4),(34,4),(35,4),(36,4),(37,4),(38,4),(39,4),(42,4),(43,4),(44,4),(45,4),(46,4),(47,4),(48,4),(49,4),(50,4),(51,4),(52,4),(53,4),(54,4),(55,4),(56,4),(57,4),(58,4),(61,4),(62,4),(63,4),(64,4),(65,4),(66,4),(67,4),(68,4),(69,4),(70,4),(71,4),(72,4),(73,4),(74,4),(75,4),(76,4),(77,4),(78,4),(79,4),(0,5),(1,5),(2,5),(3,5),(4,5),(5,5),(6,5),(7,5),(8,5),(9,5),(10,5),(11,5),(12,5),(13,5),(14,5),(15,5),(16,5),(17,5),(18,5),(19,5),(20,5),(21,5),(22,5),(23,5),(24,5),(25,5),(26,5),(27,5),(28,5),(29,5),(30,5),(31,5),(32,5),(33,5),(35,5),(36,5),(37,5),(38,5),(39,5),(42,5),(43,5),(44,5),(45,5),(46,5),(47,5),(48,5),(49,5),(50,5),(51,5),(52,5),(53,5),(54,5),(55,5),(56,5),(57,5),(58,5),(59,5),(60,5),(61,5),(62,5),(63,5),(64,5),(65,5),(66,5),(67,5),(68,5),(69,5),(70,5),(71,5),(72,5),(73,5),(74,5),(75,5),(76,5),(77,5),(78,5),(79,5),(0,6),(1,6),(2,6),(3,6),(4,6),(5,6),(6,6),(7,6),(8,6),(9,6),(10,6),(11,6),(12,6),(13,6),(14,6),(15,6),(16,6),(17,6),(18,6),(19,6),(20,6),(21,6),(22,6),(23,6),(24,6),(25,6),(26,6),(27,6),(28,6),(29,6),(30,6),(31,6),(32,6),(33,6),(35,6),(36,6),(37,6),(38,6),(39,6),(42,6),(43,6),(44,6),(45,6),(46,6),(48,6),(50,6),(51,6),(52,6),(53,6),(54,6),(55,6),(56,6),(57,6),(58,6),(59,6),(60,6),(61,6),(62,6),(63,6),(64,6),(65,6),(66,6),(67,6),(68,6),(69,6),(70,6),(71,6),(72,6),(73,6),(74,6),(75,6),(76,6),(77,6),(78,6),(79,6),(0,7),(1,7),(2,7),(3,7),(4,7),(5,7),(6,7),(7,7),(8,7),(9,7),(10,7),(11,7),(12,7),(13,7),(14,7),(15,7),(16,7),(17,7),(18,7),(19,7),(20,7),(21,7),(22,7),(23,7),(24,7),(25,7),(26,7),(27,7),(28,7),(29,7),(30,7),(31,7),(32,7),(33,7),(35,7),(36,7),(37,7),(38,7),(39,7),(42,7),(43,7),(44,7),(45,7),(54,7),(55,7),(56,7),(57,7),(58,7),(59,7),(60,7),(61,7),(62,7),(63,7),(64,7),(65,7),(66,7),(67,7),(68,7),(69,7),(70,7),(71,7),(72,7),(73,7),(74,7),(75,7),(76,7),(77,7),(78,7),(79,7),(0,8),(1,8),(2,8),(3,8),(55,8),(56,8),(57,8),(58,8),(59,8),(60,8),(61,8),(62,8),(63,8),(64,8),(65,8),(66,8),(67,8),(68,8),(73,8),(74,8),(75,8),(76,8),(77,8),(78,8),(79,8),(0,9),(1,9),(2,9),(55,9),(56,9),(57,9),(58,9),(59,9),(60,9),(61,9),(62,9),(63,9),(64,9),(65,9),(66,9),(67,9),(68,9),(73,9),(74,9),(75,9),(76,9),(77,9),(78,9),(79,9),(0,10),(1,10),(2,10),(25,10),(26,10),(27,10),(28,10),(29,10),(30,10),(31,10),(78,10),(79,10),(0,11),(1,11),(2,11),(25,11),(26,11),(27,11),(28,11),(29,11),(30,11),(31,11),(59,11),(60,11),(61,11),(62,11),(63,11),(64,11),(65,11),(66,11),(67,11),(78,11),(79,11),(0,12),(1,12),(2,12),(25,12),(26,12),(27,12),(28,12),(29,12),(30,12),(31,12),(59,12),(60,12),(61,12),(62,12),(63,12),(64,12),(65,12),(66,12),(67,12),(78,12),(79,12),(0,13),(1,13),(2,13),(25,13),(26,13),(27,13),(28,13),(29,13),(30,13),(31,13),(59,13),(60,13),(61,13),(62,13),(63,13),(64,13),(65,13),(66,13),(67,13),(78,13),(79,13),(0,14),(1,14),(2,14),(25,14),(26,14),(27,14),(28,14),(29,14),(30,14),(31,14),(59,14),(60,14),(61,14),(62,14),(63,14),(64,14),(65,14),(66,14),(67,14),(71,14),(72,14),(78,14),(79,14),(0,15),(1,15),(2,15),(25,15),(26,15),(27,15),(28,15),(29,15),(30,15),(31,15),(59,15),(67,15),(0,16),(1,16),(2,16),(59,16),(60,16),(61,16),(62,16),(66,16),(67,16),(68,16),(0,17),(1,17),(2,17),(0,18),(1,18),(2,18),(0,19),(1,19),(2,19),(77,19),(78,19),(79,19),(0,20),(1,20),(2,20),(77,20),(78,20),(79,20),(0,21),(1,21),(2,21),(77,21),(78,21),(79,21),(0,22),(1,22),(2,22),(77,22),(78,22),(79,22),(0,23),(1,23),(2,23),(3,23),(4,23),(5,23),(6,23),(77,23),(78,23),(79,23),(0,24),(1,24),(2,24),(3,24),(4,24),(5,24),(6,24),(77,24),(78,24),(79,24),(0,25),(1,25),(2,25),(3,25),(4,25),(5,25),(6,25),(77,25),(78,25),(79,25),(0,26),(1,26),(2,26),(3,26),(4,26),(5,26),(6,26),(77,26),(78,26),(79,26),(0,27),(1,27),(2,27),(3,27),(5,27),(6,27),(77,27),(78,27),(79,27),(0,28),(1,28),(2,28),(5,28),(6,28),(70,28),(71,28),(72,28),(73,28),(74,28),(77,28),(78,28),(79,28),(0,29),(1,29),(2,29),(3,29),(4,29),(5,29),(6,29),(70,29),(71,29),(72,29),(73,29),(74,29),(75,29),(77,29),(78,29),(79,29),(0,30),(1,30),(2,30),(3,30),(4,30),(5,30),(6,30),(70,30),(75,30),(77,30),(78,30),(79,30),(0,31),(1,31),(2,31),(3,31),(4,31),(5,31),(6,31),(70,31),(75,31),(77,31),(78,31),(79,31),(0,32),(1,32),(2,32),(3,32),(4,32),(5,32),(6,32),(70,32),(71,32),(73,32),(74,32),(75,32),(77,32),(78,32),(79,32),(0,33),(1,33),(2,33),(3,33),(4,33),(5,33),(6,33),(71,33),(72,33),(73,33),(74,33),(77,33),(78,33),(79,33),(0,34),(1,34),(2,34),(3,34),(4,34),(77,34),(78,34),(79,34),(0,35),(1,35),(2,35),(3,35),(77,35),(78,35),(79,35),(0,36),(1,36),(2,36),(77,36),(78,36),(79,36),(0,37),(1,37),(2,37),(77,37),(78,37),(79,37),(0,38),(1,38),(2,38),(77,38),(78,38),(79,38),(0,39),(1,39),(2,39),(77,39),(78,39),(79,39),(0,40),(1,40),(2,40),(77,40),(78,40),(79,40),(0,41),(1,41),(2,41),(77,41),(78,41),(79,41),(0,42),(1,42),(2,42),(77,42),(78,42),(79,42),(0,43),(1,43),(2,43),(77,43),(78,43),(79,43),(0,44),(1,44),(2,44),(77,44),(78,44),(79,44),(0,45),(1,45),(2,45),(77,45),(78,45),(79,45),(0,46),(1,46),(2,46),(77,46),(78,46),(79,46),(0,47),(1,47),(2,47),(77,47),(78,47),(79,47),(0,48),(1,48),(2,48),(77,48),(78,48),(79,48),(0,49),(1,49),(2,49),(36,49),(37,49),(38,49),(39,49),(40,49),(41,49),(42,49),(77,49),(78,49),(79,49),(0,50),(1,50),(2,50),(35,50),(36,50),(37,50),(38,50),(39,50),(40,50),(41,50),(42,50),(43,50),(77,50),(78,50),(79,50),(0,51),(1,51),(2,51),(34,51),(35,51),(43,51),(44,51),(45,51),(77,51),(78,51),(79,51),(0,52),(1,52),(2,52),(33,52),(34,52),(44,52),(45,52),(46,52),(77,52),(78,52),(79,52),(0,53),(1,53),(2,53),(33,53),(46,53),(77,53),(78,53),(79,53),(0,54),(1,54),(2,54),(33,54),(34,54),(46,54),(77,54),(78,54),(79,54),(0,55),(1,55),(2,55),(34,55),(45,55),(46,55),(77,55),(78,55),(79,55),(0,56),(1,56),(2,56),(34,56),(35,56),(36,56),(37,56),(44,56),(45,56),(73,56),(74,56),(75,56),(76,56),(77,56),(78,56),(79,56),(0,57),(1,57),(2,57),(36,57),(37,57),(38,57),(41,57),(42,57),(43,57),(44,57),(73,57),(74,57),(75,57),(76,57),(77,57),(78,57),(79,57),(0,58),(1,58),(2,58),(37,58),(38,58),(39,58),(40,58),(41,58),(73,58),(74,58),(75,58),(76,58),(77,58),(78,58),(79,58),(0,59),(1,59),(2,59),(69,59),(70,59),(71,59),(72,59),(73,59),(74,59),(75,59),(76,59),(77,59),(78,59),(79,59),(0,60),(1,60),(2,60),(69,60),(70,60),(71,60),(72,60),(73,60),(74,60),(75,60),(76,60),(77,60),(78,60),(79,60),(0,61),(1,61),(2,61),(69,61),(70,61),(71,61),(72,61),(73,61),(74,61),(75,61),(76,61),(77,61),(78,61),(79,61),(0,62),(1,62),(2,62),(3,62),(4,62),(5,62),(6,62),(7,62),(8,62),(9,62),(10,62),(11,62),(12,62),(13,62),(14,62),(15,62),(16,62),(17,62),(18,62),(19,62),(20,62),(21,62),(22,62),(23,62),(24,62),(25,62),(26,62),(27,62),(28,62),(29,62),(30,62),(31,62),(32,62),(33,62),(34,62),(35,62),(36,62),(37,62),(38,62),(39,62),(42,62),(43,62),(44,62),(45,62),(46,62),(47,62),(48,62),(49,62),(50,62),(51,62),(52,62),(53,62),(54,62),(55,62),(56,62),(57,62),(58,62),(59,62),(60,62),(61,62),(62,62),(63,62),(64,62),(65,62),(66,62),(67,62),(68,62),(69,62),(70,62),(71,62),(72,62),(73,62),(74,62),(75,62),(76,62),(77,62),(78,62),(79,62),(0,63),(1,63),(2,63),(3,63),(4,63),(5,63),(6,63),(7,63),(8,63),(9,63),(10,63),(11,63),(12,63),(13,63),(14,63),(15,63),(16,63),(17,63),(18,63),(19,63),(20,63),(21,63),(22,63),(23,63),(24,63),(25,63),(26,63),(27,63),(28,63),(29,63),(30,63),(31,63),(32,63),(33,63),(34,63),(35,63),(36,63),(37,63),(38,63),(39,63),(42,63),(43,63),(44,63),(45,63),(46,63),(47,63),(48,63),(49,63),(50,63),(51,63),(52,63),(53,63),(54,63),(55,63),(56,63),(57,63),(58,63),(59,63),(60,63),(61,63),(62,63),(63,63),(64,63),(65,63),(66,63),(67,63),(68,63),(69,63),(70,63),(71,63),(72,63),(73,63),(74,63),(75,63),(76,63),(77,63),(78,63),(79,63),(0,64),(1,64),(2,64),(3,64),(4,64),(5,64),(6,64),(7,64),(8,64),(9,64),(10,64),(11,64),(12,64),(13,64),(14,64),(15,64),(16,64),(17,64),(18,64),(19,64),(20,64),(21,64),(22,64),(23,64),(24,64),(25,64),(26,64),(27,64),(28,64),(29,64),(30,64),(31,64),(32,64),(33,64),(34,64),(35,64),(36,64),(37,64),(38,64),(39,64),(42,64),(43,64),(44,64),(45,64),(46,64),(47,64),(48,64),(49,64),(50,64),(51,64),(52,64),(53,64),(54,64),(55,64),(56,64),(57,64),(58,64),(59,64),(60,64),(61,64),(62,64),(63,64),(64,64),(65,64),(66,64),(67,64),(68,64),(69,64),(70,64),(71,64),(72,64),(73,64),(74,64),(75,64),(76,64),(77,64),(78,64),(79,64)}
location.noFurniture = {(34,5),(34,6),(53,7),(53,8),(54,8),(68,14),(63,15),(64,15),(65,15),(66,15),(63,16),(64,16),(65,16),(64,17)}
location.water = [(70,28),(71,28),(72,28),(73,28),(74,28),(70,29),(71,29),(72,29),(73,29),(74,29),(75,29),(70,30),(71,30),(72,30),(73,30),(74,30),(75,30),(70,31),(71,31),(72,31),(73,31),(74,31),(75,31),(70,32),(71,32),(72,32),(73,32),(74,32),(75,32),(71,33),(72,33),(73,33),(74,33),(36,49),(37,49),(38,49),(39,49),(40,49),(41,49),(42,49),(35,50),(36,50),(37,50),(38,50),(39,50),(40,50),(41,50),(42,50),(43,50),(34,51),(35,51),(36,51),(37,51),(38,51),(39,51),(40,51),(41,51),(42,51),(43,51),(44,51),(45,51),(33,52),(34,52),(35,52),(36,52),(37,52),(38,52),(39,52),(40,52),(41,52),(42,52),(43,52),(44,52),(45,52),(46,52),(33,53),(34,53),(35,53),(36,53),(37,53),(38,53),(39,53),(40,53),(41,53),(42,53),(43,53),(44,53),(45,53),(46,53),(33,54),(34,54),(35,54),(36,54),(37,54),(38,54),(39,54),(40,54),(41,54),(42,54),(43,54),(44,54),(45,54),(46,54),(34,55),(35,55),(36,55),(37,55),(38,55),(39,55),(40,55),(41,55),(42,55),(43,55),(44,55),(45,55),(46,55),(34,56),(35,56),(36,56),(37,56),(38,56),(39,56),(40,56),(41,56),(42,56),(43,56),(44,56),(45,56),(36,57),(37,57),(38,57),(39,57),(40,57),(41,57),(42,57),(43,57),(44,57),(37,58),(38,58),(39,58),(40,58),(41,58),(75,63),(76,63),(77,63),(75,64),(76,64),(77,64)]
location.terrainFeatures={(4,43),(5,43),(4,44),(5,44),(8,47),(9,47),(8,48),(9,48),(8,53),(9,53),(8,54),(9,54),(9,44),(10,44),(9,45),(10,45),(12,41),(13,41),(12,42),(13,42),(13,36),(14,36),(13,37),(14,37),(14,48),(15,48),(14,49),(15,49),(18,43),(19,43),(18,44),(19,44),(21,55),(22,55),(21,56),(22,56),(24,51),(25,51),(24,52),(25,52),(24,54),(25,54),(24,55),(25,55),(27,57),(28,57),(27,58),(28,58),(29,54),(30,54),(29,55),(30,55),(30,40),(31,40),(30,41),(31,41),(36,32),(37,32),(36,33),(37,33),(36,40),(37,40),(36,41),(37,41),(37,19),(38,19),(37,20),(38,20),(37,44),(38,44),(37,45),(38,45),(39,42),(40,42),(39,43),(40,43),(40,12),(41,12),(40,13),(41,13),(47,41),(48,41),(47,42),(48,42),(47,57),(48,57),(47,58),(48,58),(48,50),(49,50),(48,51),(49,51),(50,37),(51,37),(50,38),(51,38),(51,45),(52,45),(51,46),(52,46),(54,41),(55,41),(54,42),(55,42),(54,51),(55,51),(54,52),(55,52),(54,56),(55,56),(54,57),(55,57),(56,38),(57,38),(56,39),(57,39),(56,54),(57,54),(56,55),(57,55),(57,58),(58,58),(57,59),(58,59),(58,43),(59,43),(58,44),(59,44),(60,52),(61,52),(60,53),(61,53),(61,40),(62,40),(61,41),(62,41),(65,53),(66,53),(65,54),(66,54),(67,30),(68,30),(67,31),(68,31),(70,51),(71,51),(70,52),(71,52),(72,35),(73,35),(72,36),(73,36),(73,25),(74,25),(73,26),(74,26)}
return location
if __name__ == '__main__':
if True:
town = createTown()
busstop = createBusstop()
backwoods = createBackwoods()
mountain = createMountain()
forest = createForest()
beach = createBeach()
print(beach.bubbles(0,1))
| 1,874.612346 | 40,172 | 0.496872 | 188,822 | 759,218 | 1.997765 | 0.001552 | 0.000334 | 0.000445 | 0.000318 | 0.935431 | 0.920522 | 0.913459 | 0.904046 | 0.893712 | 0.884021 | 0 | 0.492867 | 0.006754 | 759,218 | 405 | 40,173 | 1,874.612346 | 0.007368 | 0.000325 | 0 | 0.25 | 0 | 0 | 0.000162 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.03869 | false | 0.005952 | 0.008929 | 0 | 0.08631 | 0.002976 | 0 | 0 | 1 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 |
37b31961ebcf8739a96037fba1c56f7e1aa5a0a4 | 102 | py | Python | Network_Train/lib/model/__init__.py | zhoubenjia/RAAR3DNet | b5f6486a9f1cbf9fdd2de6a141ad81354f39ee51 | [
"Apache-2.0"
] | 11 | 2021-01-22T02:01:02.000Z | 2022-01-19T06:41:25.000Z | Network_Train/lib/model/__init__.py | zhoubenjia/RAAR3DNet | b5f6486a9f1cbf9fdd2de6a141ad81354f39ee51 | [
"Apache-2.0"
] | 1 | 2021-05-21T02:18:22.000Z | 2021-05-21T02:18:22.000Z | Network_Train/lib/model/__init__.py | zhoubenjia/RAAR3DNet | b5f6486a9f1cbf9fdd2de6a141ad81354f39ee51 | [
"Apache-2.0"
] | 3 | 2021-01-22T02:01:07.000Z | 2021-09-09T07:38:10.000Z | from .NI3D import Network as NI3D
from .RAAR3DNet import Network as RAAR3D
from .genotype import *
| 25.5 | 41 | 0.77451 | 15 | 102 | 5.266667 | 0.533333 | 0.329114 | 0.379747 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.048193 | 0.186275 | 102 | 3 | 42 | 34 | 0.903614 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
37b94f010f9673413761f3a6ffea9f60edea2535 | 22 | py | Python | examples/test.py | yanyongyu/rubbish | 7b7ed83235d1220c1764b84e560c2a2f8a99a326 | [
"MIT"
] | 4 | 2021-06-21T15:28:50.000Z | 2022-01-24T16:23:35.000Z | examples/test.py | yanyongyu/rubbish | 7b7ed83235d1220c1764b84e560c2a2f8a99a326 | [
"MIT"
] | null | null | null | examples/test.py | yanyongyu/rubbish | 7b7ed83235d1220c1764b84e560c2a2f8a99a326 | [
"MIT"
] | null | null | null | print("!23")
pri(123)
| 7.333333 | 12 | 0.590909 | 4 | 22 | 3.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 0.090909 | 22 | 2 | 13 | 11 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0.5 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 7 |
8086deac88470ca1c204f1a21fff582e36de56fb | 7,081 | py | Python | tests/fixtures/asset_file_name_map_45644.py | elifesciences/elife-cleaner | 886be5e0b5317729490a55a8661c1e00e5fc7226 | [
"MIT"
] | null | null | null | tests/fixtures/asset_file_name_map_45644.py | elifesciences/elife-cleaner | 886be5e0b5317729490a55a8661c1e00e5fc7226 | [
"MIT"
] | 2 | 2021-02-25T01:48:00.000Z | 2021-05-27T01:21:40.000Z | tests/fixtures/asset_file_name_map_45644.py | elifesciences/elife-cleaner | 886be5e0b5317729490a55a8661c1e00e5fc7226 | [
"MIT"
] | null | null | null | from collections import OrderedDict
EXPECTED = OrderedDict(
[
(
"30-01-2019-RA-eLife-45644/30-01-2019-RA-eLife-45644.pdf",
"tests/tmp/30-01-2019-RA-eLife-45644/30-01-2019-RA-eLife-45644.pdf",
),
(
"30-01-2019-RA-eLife-45644/30-01-2019-RA-eLife-45644.xml",
"tests/tmp/30-01-2019-RA-eLife-45644/30-01-2019-RA-eLife-45644.xml",
),
(
"30-01-2019-RA-eLife-45644/Answers for the eLife digest.docx",
"tests/tmp/30-01-2019-RA-eLife-45644/Answers for the eLife digest.docx",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1.docx",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1.docx",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 1.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 1.png",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 10.pdf",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 10.pdf",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 11.pdf",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 11.pdf",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 12.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 12.png",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 13.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 13.png",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 14.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 14.png",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 15.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 15.png",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 2.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 2.png",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 3.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 3.png",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 4.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 4.png",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 5.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 5.png",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 6.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 6.png",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 7.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 7.png",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 8.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 8.png",
),
(
"30-01-2019-RA-eLife-45644/Appendix 1figure 9.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Appendix 1figure 9.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 1.tif",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 1.tif",
),
(
"30-01-2019-RA-eLife-45644/Figure 2.tif",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 2.tif",
),
(
"30-01-2019-RA-eLife-45644/Figure 3.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 3.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 4.svg",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 4.svg",
),
(
"30-01-2019-RA-eLife-45644/Figure 4source data 1.zip",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 4source data 1.zip",
),
(
"30-01-2019-RA-eLife-45644/Figure 5.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 5.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 5source code 1.c",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 5source code 1.c",
),
(
"30-01-2019-RA-eLife-45644/Figure 6.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 6.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 6figure supplement 10_HorC.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 6figure supplement 10_HorC.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 6figure supplement 1_U crassus.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 6figure supplement 1_U crassus.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 6figure supplement 2_U pictorum.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 6figure supplement 2_U pictorum.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 6figure supplement 3_M margaritifera.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 6figure supplement 3_M margaritifera.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 6figure supplement 4_P auricularius.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 6figure supplement 4_P auricularius.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 6figure supplement 5_PesB.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 6figure supplement 5_PesB.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 6figure supplement 6_HavA.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 6figure supplement 6_HavA.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 6figure supplement 7_HavB.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 6figure supplement 7_HavB.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 6figure supplement 8_HavC.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 6figure supplement 8_HavC.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 6figure supplement 9_HorB.png",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 6figure supplement 9_HorB.png",
),
(
"30-01-2019-RA-eLife-45644/Figure 6source data 1.pdf",
"tests/tmp/30-01-2019-RA-eLife-45644/Figure 6source data 1.pdf",
),
(
"30-01-2019-RA-eLife-45644/Manuscript.docx",
"tests/tmp/30-01-2019-RA-eLife-45644/Manuscript.docx",
),
(
"30-01-2019-RA-eLife-45644/Potential striking image.tif",
"tests/tmp/30-01-2019-RA-eLife-45644/Potential striking image.tif",
),
(
"30-01-2019-RA-eLife-45644/Table 2source data 1.xlsx",
"tests/tmp/30-01-2019-RA-eLife-45644/Table 2source data 1.xlsx",
),
(
"30-01-2019-RA-eLife-45644/transparent_reporting_Sakalauskaite.docx",
"tests/tmp/30-01-2019-RA-eLife-45644/transparent_reporting_Sakalauskaite.docx",
),
]
)
| 40.462857 | 98 | 0.559384 | 984 | 7,081 | 4.001016 | 0.074187 | 0.089408 | 0.178816 | 0.22352 | 0.987046 | 0.987046 | 0.987046 | 0.987046 | 0.973838 | 0.879604 | 0 | 0.255759 | 0.288801 | 7,081 | 174 | 99 | 40.695402 | 0.526013 | 0 | 0 | 0.242775 | 0 | 0.202312 | 0.675046 | 0.473944 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.00578 | 0 | 0.00578 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 |
8094c8852e419489187eafa884800e6cdf756d32 | 10,547 | py | Python | extra_app/views.py | xjati46/agoraschool | 98e9c6510f50a9ee87b5a6e3627466d244f7a617 | [
"MIT"
] | null | null | null | extra_app/views.py | xjati46/agoraschool | 98e9c6510f50a9ee87b5a6e3627466d244f7a617 | [
"MIT"
] | null | null | null | extra_app/views.py | xjati46/agoraschool | 98e9c6510f50a9ee87b5a6e3627466d244f7a617 | [
"MIT"
] | null | null | null | from django.shortcuts import redirect
from django.views.generic import ListView, DetailView, CreateView
from django.contrib.auth.mixins import UserPassesTestMixin
from extra_app.models import Pengumuman, NilaiMurid, LaporanMurid, TagihanMurid
from django.urls import reverse_lazy
from extra_app.forms import (
PengumumanForm, NilaiMuridForm, LaporanMuridForm,
TagihanMuridForm,)
# ############################## ADMIN VIEWS ##############################
# PENGUMUMAN APPS -------------------------------------------------------------
class PengumumanAdminView(UserPassesTestMixin, ListView):
model = Pengumuman
template_name = 'extra_app/admin/pengumuman/pengumuman_list.html'
def test_func(self):
return self.request.user.groups.filter(name="admin").exists()
def handle_no_permission(self):
return redirect('denied-access')
class PengumumanAdminDetailView(UserPassesTestMixin, DetailView):
model = Pengumuman
template_name = 'extra_app/admin/pengumuman/pengumuman_detail.html'
def test_func(self):
return self.request.user.groups.filter(name="admin").exists()
def handle_no_permission(self):
return redirect('denied-access')
class PengumumanAdminCreateView(UserPassesTestMixin, CreateView):
form_class = PengumumanForm
success_url = reverse_lazy('extra-app:pengumuman-admin')
template_name = 'extra_app/admin/pengumuman/pengumuman_form.html'
def test_func(self):
return self.request.user.groups.filter(name="admin").exists()
def handle_no_permission(self):
return redirect('denied-access')
# NILAI APPS ------------------------------------------------------------------
class NilaiMuridAdminView(UserPassesTestMixin, ListView):
model = NilaiMurid
template_name = 'extra_app/admin/nilai_murid/nilaimurid_list.html'
def test_func(self):
return self.request.user.groups.filter(name="admin").exists()
def handle_no_permission(self):
return redirect('denied-access')
class NilaiMuridAdminCreateView(UserPassesTestMixin, CreateView):
form_class = NilaiMuridForm
success_url = reverse_lazy('extra-app:nilaimurid-admin')
template_name = 'extra_app/admin/nilai_murid/nilaimurid_form.html'
def test_func(self):
return self.request.user.groups.filter(name="admin").exists()
def handle_no_permission(self):
return redirect('denied-access')
# LAPORAN APPS ----------------------------------------------------------------
class LaporanMuridAdminView(UserPassesTestMixin, ListView):
model = LaporanMurid
template_name = 'extra_app/admin/laporan_murid/laporanmurid_list.html'
def test_func(self):
return self.request.user.groups.filter(name="admin").exists()
def handle_no_permission(self):
return redirect('denied-access')
class LaporanMuridAdminDetailView(UserPassesTestMixin, DetailView):
model = LaporanMurid
template_name = 'extra_app/admin/laporan_murid/laporanmurid_detail.html'
def test_func(self):
return self.request.user.groups.filter(name="admin").exists()
def handle_no_permission(self):
return redirect('denied-access')
class LaporanMuridAdminCreateView(UserPassesTestMixin, CreateView):
form_class = LaporanMuridForm
success_url = reverse_lazy('extra-app:laporanmurid-admin')
template_name = 'extra_app/admin/laporan_murid/laporanmurid_form.html'
def test_func(self):
return self.request.user.groups.filter(name="admin").exists()
def handle_no_permission(self):
return redirect('denied-access')
# TAGIHAN APPS ----------------------------------------------------------------
class TagihanMuridAdminView(UserPassesTestMixin, ListView):
model = TagihanMurid
template_name = 'extra_app/admin/tagihan_murid/tagihanmurid_list.html'
def test_func(self):
return self.request.user.groups.filter(name="admin").exists()
def handle_no_permission(self):
return redirect('denied-access')
class TagihanMuridAdminCreateView(UserPassesTestMixin, CreateView):
form_class = TagihanMuridForm
success_url = reverse_lazy('extra-app:tagihanmurid-admin')
template_name = 'extra_app/admin/tagihan_murid/tagihanmurid_form.html'
def test_func(self):
return self.request.user.groups.filter(name="admin").exists()
def handle_no_permission(self):
return redirect('denied-access')
# ############################## END-ADMIN VIEWS ##############################
# ############################## GURU VIEWS ##############################
# NILAI APPS ------------------------------------------------------------------
class NilaiMuridGuruView(UserPassesTestMixin, ListView):
template_name = 'extra_app/guru/nilai_murid/nilaimurid_list.html'
def get_queryset(self):
return NilaiMurid.objects.filter(pembuat_tes=self.request.user.id)
def test_func(self):
return self.request.user.groups.filter(name="guru").exists()
def handle_no_permission(self):
return redirect('denied-access')
class NilaiMuridGuruCreateView(UserPassesTestMixin, CreateView):
form_class = NilaiMuridForm
success_url = reverse_lazy('extra-app:nilaimurid-guru')
template_name = 'extra_app/guru/nilai_murid/nilaimurid_form.html'
def test_func(self):
return self.request.user.groups.filter(name="guru").exists()
def handle_no_permission(self):
return redirect('denied-access')
# LAPORAN APPS ----------------------------------------------------------------
class LaporanMuridGuruView(UserPassesTestMixin, ListView):
template_name = 'extra_app/guru/laporan_murid/laporanmurid_list.html'
def get_queryset(self):
return LaporanMurid.objects.filter(pelapor=self.request.user.id)
def test_func(self):
return self.request.user.groups.filter(name="guru").exists()
def handle_no_permission(self):
return redirect('denied-access')
class LaporanMuridGuruDetailView(UserPassesTestMixin, DetailView):
model = LaporanMurid
template_name = 'extra_app/guru/laporan_murid/laporanmurid_detail.html'
def test_func(self):
return self.request.user.groups.filter(name="guru").exists()
def handle_no_permission(self):
return redirect('denied-access')
class LaporanMuridGuruCreateView(UserPassesTestMixin, CreateView):
form_class = LaporanMuridForm
success_url = reverse_lazy('extra-app:laporanmurid-guru')
template_name = 'extra_app/guru/laporan_murid/laporanmurid_form.html'
def test_func(self):
return self.request.user.groups.filter(name="guru").exists()
def handle_no_permission(self):
return redirect('denied-access')
# PENGUMUMAN APPS -------------------------------------------------------------
class PengumumanGuruView(UserPassesTestMixin, ListView):
template_name = 'extra_app/guru/pengumuman/pengumuman_list.html'
def get_queryset(self):
return Pengumuman.objects.filter(kategori__exact='Guru')
def test_func(self):
return self.request.user.groups.filter(name="guru").exists()
def handle_no_permission(self):
return redirect('denied-access')
class PengumumanGuruDetailView(UserPassesTestMixin, DetailView):
model = Pengumuman
template_name = 'extra_app/guru/pengumuman/pengumuman_detail.html'
def test_func(self):
return self.request.user.groups.filter(name="guru").exists()
def handle_no_permission(self):
return redirect('denied-access')
# ############################## END-GURU VIEWS ##############################
# ############################## MURID VIEWS ##############################
# TAGIHAN APPS ----------------------------------------------------------------
class TagihanMuridMuridView(UserPassesTestMixin, ListView):
template_name = 'extra_app/murid/tagihan_murid/tagihanmurid_list.html'
def get_queryset(self):
return TagihanMurid.objects.filter(
tertagih__murid=self.request.user.id).filter(status_bayar=True)
def test_func(self):
return self.request.user.groups.filter(name="murid").exists()
def handle_no_permission(self):
return redirect('denied-access')
# PENGUMUMAN APPS -------------------------------------------------------------
class PengumumanMuridView(UserPassesTestMixin, ListView):
template_name = 'extra_app/murid/pengumuman/pengumuman_list.html'
def get_queryset(self):
return Pengumuman.objects.filter(kategori__exact='Murid')
def test_func(self):
return self.request.user.groups.filter(name="murid").exists()
def handle_no_permission(self):
return redirect('denied-access')
class PengumumanMuridDetailView(UserPassesTestMixin, DetailView):
model = Pengumuman
template_name = 'extra_app/murid/pengumuman/pengumuman_detail.html'
def test_func(self):
return self.request.user.groups.filter(name="murid").exists()
def handle_no_permission(self):
return redirect('denied-access')
# NILAI APPS ------------------------------------------------------------------
class NilaiMuridMuridView(UserPassesTestMixin, ListView):
template_name = 'extra_app/murid/nilai_murid/nilaimurid_list.html'
def get_queryset(self):
return NilaiMurid.objects.filter(
peserta_tes__murid=self.request.user.id)
def test_func(self):
return self.request.user.groups.filter(name="murid").exists()
def handle_no_permission(self):
return redirect('denied-access')
# LAPORAN APPS ----------------------------------------------------------------
class LaporanMuridMuridView(UserPassesTestMixin, ListView):
template_name = 'extra_app/murid/laporan_murid/laporanmurid_list.html'
def get_queryset(self):
return LaporanMurid.objects.filter(
terlapor__murid=self.request.user.id)
def test_func(self):
return self.request.user.groups.filter(name="murid").exists()
def handle_no_permission(self):
return redirect('denied-access')
class LaporanMuridMuridDetailView(UserPassesTestMixin, DetailView):
model = LaporanMurid
template_name = 'extra_app/murid/laporan_murid/laporanmurid_detail.html'
def test_func(self):
return self.request.user.groups.filter(name="murid").exists()
def handle_no_permission(self):
return redirect('denied-access')
# ############################## END-MURID VIEWS ##############################
| 34.243506 | 79 | 0.661989 | 1,084 | 10,547 | 6.26107 | 0.092251 | 0.07809 | 0.061883 | 0.067777 | 0.803153 | 0.799912 | 0.783704 | 0.728599 | 0.634154 | 0.619419 | 0 | 0 | 0.145918 | 10,547 | 307 | 80 | 34.355049 | 0.753441 | 0.089978 | 0 | 0.6 | 0 | 0 | 0.186808 | 0.141679 | 0 | 0 | 0 | 0 | 0 | 1 | 0.286486 | false | 0.12973 | 0.032432 | 0.286486 | 0.972973 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 9 |
03fd4a1b1d8042231220da2311c3090d1080d7d7 | 4,432 | py | Python | backend/tradersplatform/equipment/migrations/0001_initial.py | ybedirhanpak/bounswe2019group1 | 9572fd307345b3f842c2c2ff4426857086484ed5 | [
"MIT"
] | 10 | 2019-02-14T14:53:49.000Z | 2019-10-23T08:03:39.000Z | backend/tradersplatform/equipment/migrations/0001_initial.py | ybedirhanpak/bounswe2019group1 | 9572fd307345b3f842c2c2ff4426857086484ed5 | [
"MIT"
] | 364 | 2019-02-14T14:50:12.000Z | 2022-02-10T13:43:09.000Z | backend/tradersplatform/equipment/migrations/0001_initial.py | bounswe/bounswe2019group1 | 9572fd307345b3f842c2c2ff4426857086484ed5 | [
"MIT"
] | 8 | 2019-05-05T20:04:31.000Z | 2020-12-24T16:44:54.000Z | # Generated by Django 2.2.6 on 2019-11-23 15:13
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='CryptoCurrencies',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('BTC', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
('ETH', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
('LTC', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
],
),
migrations.CreateModel(
name='Currencies',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('EUR', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
('GBP', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
('TRY', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
],
),
migrations.CreateModel(
name='ETFDetail',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('mobile_title', models.CharField(blank=True, max_length=800, null=True)),
('assets', models.CharField(blank=True, max_length=800, null=True)),
('average_volume', models.CharField(blank=True, max_length=800, null=True)),
('ytd', models.CharField(blank=True, max_length=800, null=True)),
],
),
migrations.CreateModel(
name='ETFPrice',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('price', models.CharField(blank=True, max_length=800, null=True)),
('assets', models.CharField(blank=True, max_length=800, null=True)),
],
),
migrations.CreateModel(
name='Metals',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('XAG', models.DecimalField(blank=True, decimal_places=20, max_digits=30, null=True)),
('XAU', models.DecimalField(blank=True, decimal_places=20, max_digits=30, null=True)),
],
),
migrations.CreateModel(
name='Stocks',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('GOOGL', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
('AAPL', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
('GM', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
],
),
migrations.CreateModel(
name='TraceIndices',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('DJI', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
('IXIC', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
('INX', models.DecimalField(blank=True, decimal_places=10, max_digits=20, null=True)),
],
),
migrations.CreateModel(
name='ETFs',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('IVV', models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, related_name='IVV', to='equipment.ETFPrice')),
('SPY', models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, related_name='SPY', to='equipment.ETFPrice')),
('VTI', models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, related_name='VTI', to='equipment.ETFPrice')),
],
),
]
| 50.942529 | 145 | 0.592509 | 478 | 4,432 | 5.355649 | 0.182008 | 0.070313 | 0.125781 | 0.147656 | 0.839844 | 0.830078 | 0.830078 | 0.830078 | 0.830078 | 0.812891 | 0 | 0.027159 | 0.260605 | 4,432 | 86 | 146 | 51.534884 | 0.754043 | 0.010153 | 0 | 0.531646 | 1 | 0 | 0.060661 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.025316 | 0 | 0.075949 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
ff19006007157fa8bc220fd7a0b697c96427211e | 18,379 | py | Python | rubin_sim/maf/batches/metadataBatch.py | RileyWClarke/flarubin | eb7b1ee21c828523f8a5374fe4510fe6e5ec2a2a | [
"MIT"
] | null | null | null | rubin_sim/maf/batches/metadataBatch.py | RileyWClarke/flarubin | eb7b1ee21c828523f8a5374fe4510fe6e5ec2a2a | [
"MIT"
] | null | null | null | rubin_sim/maf/batches/metadataBatch.py | RileyWClarke/flarubin | eb7b1ee21c828523f8a5374fe4510fe6e5ec2a2a | [
"MIT"
] | null | null | null | """Some basic physical quantity metrics.
"""
import rubin_sim.maf.metrics as metrics
import rubin_sim.maf.slicers as slicers
import rubin_sim.maf.stackers as stackers
import rubin_sim.maf.plots as plots
import rubin_sim.maf.metricBundles as mb
from .colMapDict import ColMapDict
from .common import standardSummary, extendedMetrics, standardAngleMetrics, \
filterList, radecCols, combineMetadata
__all__ = ['metadataBasics', 'metadataBasicsAngle', 'allMetadata', 'metadataMaps']
def metadataBasics(value, colmap=None, runName='opsim',
valueName=None, groupName=None, extraSql=None,
extraMetadata=None, nside=64):
"""Calculate basic metrics on visit metadata 'value' (e.g. airmass, normalized airmass, seeing..).
Calculates this around the sky (HealpixSlicer), makes histograms of all visits (OneDSlicer),
and calculates statistics on all visits (UniSlicer) for the quantity in all visits and per filter.
TODO: handle stackers which need configuration (degrees, in particular) more automatically.
Currently have a hack for HA & normairmass.
Parameters
----------
value : str
The column name for the quantity to evaluate. (column name in the database or created by a stacker).
colmap : dict or None, optional
A dictionary with a mapping of column names. Default will use OpsimV4 column names.
runName : str, optional
The name of the simulated survey. Default is "opsim".
valueName : str, optional
The name of the value to be reported in the resultsDb and added to the metric.
This is intended to help standardize metric comparison between sim versions.
value = name as it is in the database (seeingFwhmGeom, etc).
valueName = name to be recorded ('seeingGeom', etc.). Default is None, which will match 'value'.
groupName : str, optional
The group name for this quantity in the displayDict. Default is the same as 'valueName', capitalized.
extraSql : str, optional
Additional constraint to add to any sql constraints (e.g. 'propId=1' or 'fieldID=522').
Default None, for no additional constraints.
extraMetadata : str, optional
Additional metadata to add before any below (i.e. "WFD"). Default is None.
nside : int, optional
Nside value for healpix slicer. Default 64.
If "None" is passed, the healpixslicer-based metrics will be skipped.
Returns
-------
metricBundleDict
"""
if colmap is None:
colmap = ColMapDict('fbs')
bundleList = []
if valueName is None:
valueName = value
if groupName is None:
groupName = valueName.capitalize()
subgroup = extraMetadata
else:
groupName = groupName.capitalize()
subgroup = valueName.capitalize()
if subgroup is None:
subgroup = 'All visits'
displayDict = {'group': groupName, 'subgroup': subgroup}
raCol, decCol, degrees, ditherStacker, ditherMeta = radecCols(None, colmap, None)
extraMetadata = combineMetadata(extraMetadata, ditherMeta)
# Set up basic all and per filter sql constraints.
filterlist, colors, orders, sqls, metadata = filterList(all=True,
extraSql=extraSql,
extraMetadata=extraMetadata)
# Hack to make HA work, but really I need to account for any stackers/colmaps.
if value == 'HA':
stackerList = [stackers.HourAngleStacker(lstCol=colmap['lst'], raCol=raCol,
degrees=degrees)]
elif value == 'normairmass':
stackerList = [stackers.NormAirmassStacker(degrees=degrees)]
else:
stackerList = None
# Summarize values over all and per filter (min/mean/median/max/percentiles/outliers/rms).
slicer = slicers.UniSlicer()
for f in filterlist:
for m in extendedMetrics(value, replace_colname=valueName):
displayDict['caption'] = '%s for %s.' % (m.name, metadata[f])
displayDict['order'] = orders[f]
bundle = mb.MetricBundle(m, slicer, sqls[f], stackerList=stackerList,
metadata=metadata[f], displayDict=displayDict)
bundleList.append(bundle)
# Histogram values over all and per filter.
for f in filterlist:
displayDict['caption'] = 'Histogram of %s' % (value)
if valueName != value:
displayDict['caption'] += ' (%s)' % (valueName)
displayDict['caption'] += ' for %s.' % (metadata[f])
displayDict['order'] = orders[f]
m = metrics.CountMetric(value, metricName='%s Histogram' % (valueName))
slicer = slicers.OneDSlicer(sliceColName=value)
bundle = mb.MetricBundle(m, slicer, sqls[f], stackerList=stackerList,
metadata=metadata[f], displayDict=displayDict)
bundleList.append(bundle)
# Make maps of min/median/max for all and per filter, per RA/Dec, with standard summary stats.
mList = []
mList.append(metrics.MinMetric(value, metricName='Min %s' % (valueName)))
mList.append(metrics.MedianMetric(value, metricName='Median %s' % (valueName)))
mList.append(metrics.MaxMetric(value, metricName='Max %s' % (valueName)))
slicer = slicers.HealpixSlicer(nside=nside, latCol=decCol, lonCol=raCol,
latLonDeg=degrees)
subsetPlots = [plots.HealpixSkyMap(), plots.HealpixHistogram()]
for f in filterlist:
for m in mList:
displayDict['caption'] = 'Map of %s' % m.name
if valueName != value:
displayDict['caption'] += ' (%s)' % value
displayDict['caption'] += ' for %s.' % metadata[f]
displayDict['order'] = orders[f]
bundle = mb.MetricBundle(m, slicer, sqls[f], stackerList=stackerList,
metadata=metadata[f], plotFuncs=subsetPlots,
displayDict=displayDict,
summaryMetrics=standardSummary())
bundleList.append(bundle)
# Set the runName for all bundles and return the bundleDict.
for b in bundleList:
b.setRunName(runName)
return mb.makeBundlesDictFromList(bundleList)
def metadataBasicsAngle(value, colmap=None, runName='opsim',
valueName=None, groupName=None, extraSql=None,
extraMetadata=None, nside=64,
ditherStacker=None, ditherkwargs=None):
"""Calculate basic metrics on visit metadata 'value', where value is a wrap-around angle.
Calculates extended standard metrics (with unislicer) on the quantity (all visits and per filter),
makes histogram of the value (all visits and per filter),
Parameters
----------
value : str
The column name for the quantity to evaluate. (column name in the database or created by a stacker).
colmap : dict or None, optional
A dictionary with a mapping of column names. Default will use OpsimV4 column names.
runName : str, optional
The name of the simulated survey. Default is "opsim".
valueName : str, optional
The name of the value to be reported in the resultsDb and added to the metric.
This is intended to help standardize metric comparison between sim versions.
value = name as it is in the database (seeingFwhmGeom, etc).
valueName = name to be recorded ('seeingGeom', etc.). Default is None, which will match 'value'.
groupName : str, optional
The group name for this quantity in the displayDict. Default is the same as 'valueName', capitalized.
extraSql : str, optional
Additional constraint to add to any sql constraints (e.g. 'propId=1' or 'fieldID=522').
Default None, for no additional constraints.
extraMetadata : str, optional
Additional metadata to add before any below (i.e. "WFD"). Default is None.
nside : int, optional
Nside value for healpix slicer. Default 64.
If "None" is passed, the healpixslicer-based metrics will be skipped.
ditherStacker: str or rubin_sim.maf.stackers.BaseDitherStacker
Optional dither stacker to use to define ra/dec columns.
ditherkwargs: dict, optional
Optional dictionary of kwargs for the dither stacker.
Returns
-------
metricBundleDict
"""
if colmap is None:
colmap = ColMapDict('opsimV4')
bundleList = []
if valueName is None:
valueName = value
if groupName is None:
groupName = valueName.capitalize()
subgroup = extraMetadata
else:
groupName = groupName.capitalize()
subgroup = valueName.capitalize()
if subgroup is None:
subgroup = 'All visits'
displayDict = {'group': groupName, 'subgroup': subgroup}
raCol, decCol, degrees, ditherStacker, ditherMeta = radecCols(ditherStacker, colmap, ditherkwargs)
extraMetadata = combineMetadata(extraMetadata, ditherMeta)
# Set up basic all and per filter sql constraints.
filterlist, colors, orders, sqls, metadata = filterList(all=True,
extraSql=extraSql,
extraMetadata=extraMetadata)
stackerList = [ditherStacker]
# Summarize values over all and per filter.
slicer = slicers.UniSlicer()
for f in filterlist:
for m in standardAngleMetrics(value, replace_colname=valueName):
displayDict['caption'] = '%s for %s.' % (m.name, metadata[f])
displayDict['order'] = orders[f]
bundle = mb.MetricBundle(m, slicer, sqls[f], stackerList=stackerList,
metadata=metadata[f], displayDict=displayDict)
bundleList.append(bundle)
# Histogram values over all and per filter.
for f in filterlist:
displayDict['caption'] = 'Histogram of %s' % (value)
if valueName != value:
displayDict['caption'] += ' (%s)' % (valueName)
displayDict['caption'] += ' for %s.' % (metadata[f])
displayDict['order'] = orders[f]
m = metrics.CountMetric(value, metricName='%s Histogram' % (valueName))
slicer = slicers.OneDSlicer(sliceColName=value)
bundle = mb.MetricBundle(m, slicer, sqls[f], stackerList=stackerList,
metadata=metadata[f], displayDict=displayDict)
bundleList.append(bundle)
# Make maps of min/median/max for all and per filter, per RA/Dec, with standard summary stats.
mList = []
mList.append(metrics.MeanAngleMetric(value, metricName='AngleMean %s' % (valueName)))
mList.append(metrics.FullRangeAngleMetric(value, metricName='AngleRange %s' % (valueName)))
mList.append(metrics.RmsAngleMetric(value, metricName='AngleRms %s' % (valueName)))
slicer = slicers.HealpixSlicer(nside=nside, latCol=decCol, lonCol=raCol,
latLonDeg=degrees)
subsetPlots = [plots.HealpixSkyMap(), plots.HealpixHistogram()]
for f in filterlist:
for m in mList:
displayDict['caption'] = 'Map of %s' % m.name
if valueName != value:
displayDict['caption'] += ' (%s)' % value
displayDict['caption'] += ' for %s.' % metadata[f]
displayDict['order'] = orders[f]
bundle = mb.MetricBundle(m, slicer, sqls[f], stackerList=stackerList,
metadata=metadata[f], plotFuncs=subsetPlots,
displayDict=displayDict,
summaryMetrics=standardSummary())
bundleList.append(bundle)
# Set the runName for all bundles and return the bundleDict.
for b in bundleList:
b.setRunName(runName)
return mb.makeBundlesDictFromList(bundleList)
def allMetadata(colmap=None, runName='opsim', extraSql=None, extraMetadata=None):
"""Generate a large set of metrics about the metadata of each visit -
distributions of airmass, normalized airmass, seeing, sky brightness, single visit depth,
hour angle, distance to the moon, and solar elongation.
The exact metadata which is analyzed is set by the colmap['metadataList'] value.
Parameters
----------
colmap : dict or None, optional
A dictionary with a mapping of column names. Default will use OpsimV4 column names.
runName : str, optional
The name of the simulated survey. Default is "opsim".
extraSql : str, optional
Sql constraint (such as WFD only). Default is None.
extraMetadata : str, optional
Metadata to identify the sql constraint (such as WFD). Default is None.
Returns
-------
metricBundleDict
"""
if colmap is None:
colmap = ColMapDict('opsimV4')
bdict = {}
for valueName in colmap['metadataList']:
if valueName in colmap:
value = colmap[valueName]
else:
value = valueName
mdict = metadataBasics(value, colmap=colmap, runName=runName, valueName=valueName,
extraSql=extraSql, extraMetadata=extraMetadata)
bdict.update(mdict)
for valueName in colmap['metadataAngleList']:
if valueName in colmap:
value = colmap[valueName]
else:
value = valueName
mdict = metadataBasicsAngle(value, colmap=colmap, runName=runName, valueName=valueName,
extraSql=extraSql, extraMetadata=extraMetadata)
bdict.update(mdict)
return bdict
def metadataMaps(value, colmap=None, runName='opsim',
valueName=None, groupName=None, extraSql=None,
extraMetadata=None, nside=64):
"""Calculate 25/50/75 percentile values on maps across sky for a single metadata value.
TODO: handle stackers which need configuration (degrees, in particular) more automatically.
Currently have a hack for HA & normairmass.
Parameters
----------
value : str
The column name for the quantity to evaluate. (column name in the database or created by a stacker).
colmap : dict or None, optional
A dictionary with a mapping of column names. Default will use OpsimV4 column names.
runName : str, optional
The name of the simulated survey. Default is "opsim".
valueName : str, optional
The name of the value to be reported in the resultsDb and added to the metric.
This is intended to help standardize metric comparison between sim versions.
value = name as it is in the database (seeingFwhmGeom, etc).
valueName = name to be recorded ('seeingGeom', etc.). Default is None, which will match 'value'.
groupName : str, optional
The group name for this quantity in the displayDict. Default is the same as 'valueName', capitalized.
extraSql : str, optional
Additional constraint to add to any sql constraints (e.g. 'propId=1' or 'fieldID=522').
Default None, for no additional constraints.
extraMetadata : str, optional
Additional metadata to add before any below (i.e. "WFD"). Default is None.
nside : int, optional
Nside value for healpix slicer. Default 64.
If "None" is passed, the healpixslicer-based metrics will be skipped.
Returns
-------
metricBundleDict
"""
if colmap is None:
colmap = ColMapDict('opsimV4')
bundleList = []
if valueName is None:
valueName = value
if groupName is None:
groupName = valueName.capitalize()
subgroup = extraMetadata
else:
groupName = groupName.capitalize()
subgroup = valueName.capitalize()
if subgroup is None:
subgroup = 'All visits'
displayDict = {'group': groupName, 'subgroup': subgroup}
raCol, decCol, degrees, ditherStacker, ditherMeta = radecCols(None, colmap, None)
extraMetadata = combineMetadata(extraMetadata, ditherMeta)
# Set up basic all and per filter sql constraints.
filterlist, colors, orders, sqls, metadata = filterList(all=True,
extraSql=extraSql,
extraMetadata=extraMetadata)
# Hack to make HA work, but really I need to account for any stackers/colmaps.
if value == 'HA':
stackerList = [stackers.HourAngleStacker(lstCol=colmap['lst'], raCol=raCol,
degrees=degrees)]
elif value == 'normairmass':
stackerList = [stackers.NormAirmassStacker(degrees=degrees)]
else:
stackerList = None
# Make maps of 25/median/75 for all and per filter, per RA/Dec, with standard summary stats.
mList = []
mList.append(metrics.PercentileMetric(value, percentile=25,
metricName='25thPercentile %s' % (valueName)))
mList.append(metrics.MedianMetric(value, metricName='Median %s' % (valueName)))
mList.append(metrics.PercentileMetric(value, percentile=75,
metricName='75thPercentile %s' % (valueName)))
slicer = slicers.HealpixSlicer(nside=nside, latCol=decCol, lonCol=raCol,
latLonDeg=degrees)
subsetPlots = [plots.HealpixSkyMap(), plots.HealpixHistogram()]
for f in filterlist:
for m in mList:
displayDict['caption'] = 'Map of %s' % m.name
if valueName != value:
displayDict['caption'] += ' (%s)' % value
displayDict['caption'] += ' for %s.' % metadata[f]
displayDict['order'] = orders[f]
bundle = mb.MetricBundle(m, slicer, sqls[f], stackerList=stackerList,
metadata=metadata[f], plotFuncs=subsetPlots,
displayDict=displayDict,
summaryMetrics=standardSummary())
bundleList.append(bundle)
# Set the runName for all bundles and return the bundleDict.
for b in bundleList:
b.setRunName(runName)
plotBundles = []
return mb.makeBundlesDictFromList(bundleList), plotBundles
| 45.605459 | 109 | 0.631264 | 1,985 | 18,379 | 5.838791 | 0.139043 | 0.010871 | 0.01346 | 0.012942 | 0.837187 | 0.818982 | 0.813632 | 0.801467 | 0.801467 | 0.79629 | 0 | 0.003701 | 0.279558 | 18,379 | 402 | 110 | 45.718905 | 0.871611 | 0.364927 | 0 | 0.83105 | 0 | 0 | 0.058103 | 0 | 0 | 0 | 0 | 0.004975 | 0 | 1 | 0.018265 | false | 0 | 0.031963 | 0 | 0.068493 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
2080a119944132774b578a06b2be734cfa6b0f3d | 13,469 | py | Python | test/test_stdin.py | trentm/python-process | 94d2c62244d3c634a3a56a1dde0c09cf2d18fbb2 | [
"MIT"
] | 1 | 2019-08-06T09:30:40.000Z | 2019-08-06T09:30:40.000Z | test/test_stdin.py | trentm/python-process | 94d2c62244d3c634a3a56a1dde0c09cf2d18fbb2 | [
"MIT"
] | null | null | null | test/test_stdin.py | trentm/python-process | 94d2c62244d3c634a3a56a1dde0c09cf2d18fbb2 | [
"MIT"
] | 1 | 2021-04-23T10:07:35.000Z | 2021-04-23T10:07:35.000Z | """Test simple stdout (and stderr) hookup in spawning a child process."""
import os
import sys
import time
import pprint
import threading
import unittest
import process
class MyInFile:
def __init__(self, buf):
self._inBuffer = buf
self._stateChange = threading.Condition()
self._closed = 0
def read(self, size):
#XXX Should this be a 'while' to wait until 'size' bytes and in
# the _inBuffer before returning (unless _closed, of course).
if not self._closed and not self._inBuffer:
self._stateChange.acquire()
self._stateChange.wait()
self._stateChange.release()
text, self._inBuffer = self._inBuffer[:size], self._inBuffer[size:]
return text
def close(self):
self._stateChange.acquire()
self._closed = 1
self._stateChange.notifyAll()
self._stateChange.release()
class MyOutFile:
def __init__(self):
self.log = []
def write(self, text):
self.log.append( (time.time(), 'write', text) )
def close(self):
self.log.append( (time.time(), 'close', None) )
def getOutput(self):
output = ''
for timestamp, event, data in self.log:
if event == 'write':
output += data
return output
class StdinTestCase(unittest.TestCase):
def test_ProcessProxy_stdin_handle_cleanup_1(self):
p1 = process.ProcessProxy(['ask'])
p2 = process.ProcessProxy(['ask'])
p1.stdin.write("Trent\n")
p2.stdin.write("Andrew\n")
p1.stdin.close()
p2.stdin.close()
p1.wait()
del p1
p2.wait()
p1 = process.ProcessProxy(['ask'])
p2 = process.ProcessProxy(['ask'])
p1.stdin.write("Mick\n")
p1.stdin.close()
output = p1.stdout.read()
expected = "What is your name?\nYour name is 'Mick'.\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r" % output)
p2.kill()
def test_ProcessProxy_stdin_handle_cleanup_2(self):
p1 = process.ProcessProxy(['ask'])
p2 = process.ProcessProxy(['ask'])
p1.stdin.write("Trent\n")
p2.stdin.write("Andrew\n")
p1.stdin.close()
p2.stdin.close()
p1.wait()
p2.wait()
p1 = process.ProcessProxy(['ask'])
p2 = process.ProcessProxy(['ask'])
p1.stdin.write("Mick\n")
p1.stdin.close()
p2.kill()
def test_ProcessProxy_stdin_buffer(self):
p = process.ProcessProxy(['ask'])
p.stdin.write("Trent\n")
p.stdin.close()
output = p.stdout.read()
expected = "What is your name?\nYour name is 'Trent'.\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r" % output)
def test_ProcessProxy_stdin_buffer_nonewline(self):
p = process.ProcessProxy(['ask'])
p.stdin.write("Tre")
# Note that we have not sent a newline, so the scanf() (or
# fread() or whatever) in ask.exe is still waiting for input.
# This is testing that the subsequent p.stdin.close()
# successfully communicates to the child that the pipe is closed
# and no more data is forth coming. (This relies on the pipe
# inheritability having been properly set.)
p.stdin.close()
output = p.stdout.read()
expected = "What is your name?\nYour name is 'Tre'.\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r" % output)
def test_ProcessProxy_stdin_donotrespond(self):
p = process.ProcessProxy(['ask_then_talk'],
stdout=MyOutFile(), stderr=MyOutFile())
# Expect this to hang, as the child waits for input that we do
# not send it.
time.sleep(6)
# There should be no output, other that
output = ''.join([item[2] for item in p.stdout.log])
try:
self.failUnless(output == "What is your name?\n",
"Stdout has unexpectedly received other than one "\
"'What is your name?' write. The process should "\
"be hung. log=%r" % p.stdout.log)
finally:
p.kill()
## This is left commented out because the use of 'sys.stdin' requires
## user interaction -- not really an automated test suite then.
#def test_ProcessProxy_stdin_sysstdin(self):
# p = process.ProcessProxy(['ask'], stdin=sys.stdin)
# output = p.stdout.read()
# expected = "What is your name?\nYour name is"
# self.failUnless(output.find(expected) != -1,
# "Unexpected stdout output: %r" % output)
def test_ProcessProxy_stdin_text_mode(self):
# On Linux:
# There is no distinction btwn text- and binary-modes. So this
# really is not providing that useful a test.
p = process.ProcessProxy(['sort'])
p.stdin.write("2\n")
p.stdin.write("1\n")
p.stdin.write("3\n")
p.stdin.close()
output = p.stdout.read()
expected = "1\n2\n3\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r (expected: %r). "\
"Pipes are not doing text translation."\
% (output, expected))
if sys.platform.startswith("win"):
def test_ProcessProxy_stdin_binary_mode(self):
p = process.ProcessProxy(['sort'], mode='b')
p.stdin.write("2\n")
p.stdin.write("1\n")
p.stdin.write("3\n")
p.stdin.close()
output = p.stdout.read()
expected = "???\r\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r (expected: %r). "\
"Pipes are not doing text translation."\
" Make sure that the Windows sort.exe is first on the path."\
% (output, expected))
# Note: reusing 'p' here is subtly testing another aspect of the
# ProcessProxy stuff. If self._hChildStdinWr (and the
# stdout/stderr equivs) are not handled in ProcessProxy.__del__
# then a win32api error on CloseHandle is raised when the
# C runtime closes these handles asynchronously.
p = process.ProcessProxy(['sort'], mode='b')
p.stdin.write("2\r\n")
p.stdin.write("1\r\n")
p.stdin.write("3\r\n")
p.stdin.close()
output = p.stdout.read()
expected = "1\r\n2\r\n3\r\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r (expected: %r). "\
"Pipes are not doing text translation."\
% (output, expected))
def test_ProcessProxy_stdin_buffering_with_mystdin(self):
p = process.ProcessProxy(['ask'], stdin=MyInFile("Trent\n"))
output = p.stdout.read()
expected = "What is your name?\nYour name is 'Trent'.\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r" % output)
def test_ProcessOpen_stdin_handle_cleanup_1(self):
p1 = process.ProcessOpen(['ask'])
p2 = process.ProcessOpen(['ask'])
p1.stdin.write("Trent\n")
p2.stdin.write("Andrew\n")
p1.stdin.close()
p2.stdin.close()
p1.wait()
p1.close()
del p1
p2.wait()
p2.close()
p1 = process.ProcessOpen(['ask'])
p2 = process.ProcessOpen(['ask'])
p1.stdin.write("Mick\n")
p1.stdin.close()
output = p1.stdout.read()
expected = "What is your name?\nYour name is 'Mick'.\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r" % output)
p2.kill()
p1.close()
p2.close()
def test_ProcessOpen_stdin_handle_cleanup_2(self):
p1 = process.ProcessOpen(['ask'])
p2 = process.ProcessOpen(['ask'])
p1.stdin.write("Trent\n")
p2.stdin.write("Andrew\n")
p1.stdin.close()
p2.stdin.close()
p1.wait()
p1.close()
p2.wait()
p2.close()
p1 = process.ProcessOpen(['ask'])
p2 = process.ProcessOpen(['ask'])
p1.stdin.write("Mick\n")
p1.stdin.close()
p2.kill()
p2.close()
p1.close()
def test_ProcessOpen_stdin_buffer(self):
p = process.ProcessOpen(['ask'])
p.stdin.write("Trent\n")
p.stdin.close()
output = p.stdout.read()
p.close()
expected = "What is your name?\nYour name is 'Trent'.\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r" % output)
def test_ProcessOpen_stdin_buffer_nonewline(self):
p = process.ProcessOpen(['ask'])
p.stdin.write("Tre")
# Note that we have not sent a newline, so the scanf() (or
# fread() or whatever) in ask.exe is still waiting for input.
# This is testing that the subsequent p.stdin.close()
# successfully communicates to the child that the pipe is closed
# and no more data is forth coming. (This relies on the pipe
# inheritability having been properly set.)
p.stdin.close()
output = p.stdout.read()
p.close()
expected = "What is your name?\nYour name is 'Tre'.\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r" % output)
def test_ProcessOpen_stdin_donotrespond(self):
p = process.ProcessOpen('ask_then_talk')
# Expect this to hang, as the child waits for input that we do
# not send it.
time.sleep(2)
try:
output = p.stdout.read(4092)
self.failUnless(output.strip() == "What is your name?",
"Stdout has unexpectedly received other than one "\
"'What is your name?' write. The process should "\
"be hung. output=%r" % output)
finally:
p.kill()
p.close()
## This is left commented out because the use of 'sys.stdin' requires
## user interaction -- not really an automated test suite then.
#def test_ProcessOpen_stdin_sysstdin(self):
# p = process.ProcessOpen(['ask'], stdin=sys.stdin)
# output = p.stdout.read()
# expected = "What is your name?\nYour name is"
# self.failUnless(output.find(expected) != -1,
# "Unexpected stdout output: %r" % output)
def test_ProcessOpen_stdin_text_mode(self):
# On Linux:
# There is no distinction btwn text- and binary-modes. So this
# really is not providing that useful a test.
p = process.ProcessOpen(['sort'])
p.stdin.write("2\n")
p.stdin.write("1\n")
p.stdin.write("3\n")
p.stdin.close()
output = p.stdout.read()
p.close()
expected = "1\n2\n3\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r (expected: %r). "\
"Pipes are not doing text translation."\
% (output, expected))
if sys.platform.startswith("win"):
def test_ProcessOpen_stdin_binary_mode(self):
p = process.ProcessOpen(['sort'], mode='b')
p.stdin.write("2\n")
p.stdin.write("1\n")
p.stdin.write("3\n")
p.stdin.close()
output = p.stdout.read()
p.close()
expected = "???\r\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r (expected: %r). "\
"Binary mode pipes are not working as expected."\
" Make sure that the Windows sort.exe is first on the path."\
% (output, expected))
# Note: reusing 'p' here is subtly testing another aspect of the
# ProcessOpen stuff. If self._hChildStdinWr (and the
# stdout/stderr equivs) are not handled in ProcessOpen.__del__
# then a win32api error on CloseHandle is raised when the
# C runtime closes these handles asynchronously.
p = process.ProcessOpen(['sort'], mode='b')
p.stdin.write("2\r\n")
p.stdin.write("1\r\n")
p.stdin.write("3\r\n")
p.stdin.close()
output = p.stdout.read()
p.close()
expected = "1\r\n2\r\n3\r\n"
self.failUnless(output == expected,
"Unexpected stdout output: %r (expected: %r). "\
"Pipes are not doing text translation."\
" Make sure that the Windows sort.exe is first on the path."\
% (output, expected))
def suite():
"""Return a unittest.TestSuite to be used by test.py."""
return unittest.makeSuite(StdinTestCase)
if __name__ == "__main__":
import logging
logging.basicConfig()
testsupport.setup()
sys.argv.insert(1, "-v") # always want verbose output
unittest.main()
| 37.518106 | 89 | 0.552231 | 1,592 | 13,469 | 4.600503 | 0.145729 | 0.046423 | 0.033042 | 0.047105 | 0.804069 | 0.770071 | 0.742217 | 0.732523 | 0.719689 | 0.716548 | 0 | 0.012586 | 0.327493 | 13,469 | 358 | 90 | 37.622905 | 0.795981 | 0.206771 | 0 | 0.732824 | 0 | 0 | 0.170858 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.087786 | false | 0 | 0.030534 | 0 | 0.141221 | 0.003817 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
45acfa7022abc3ed3ad08d9a3a8434697730aec0 | 7,639 | py | Python | game/test_suite/tests/controllers/test_grenade_controller.py | HagenSR/byte_le_royale_2022 | d501bf2418337d543dac982112ea924d37164205 | [
"MIT"
] | 1 | 2022-03-10T01:38:12.000Z | 2022-03-10T01:38:12.000Z | game/test_suite/tests/controllers/test_grenade_controller.py | HagenSR/byte_le_royale_2022 | d501bf2418337d543dac982112ea924d37164205 | [
"MIT"
] | 2 | 2022-01-31T18:28:14.000Z | 2022-01-31T18:28:24.000Z | game/test_suite/tests/controllers/test_grenade_controller.py | HagenSR/byte_le_royale_2022 | d501bf2418337d543dac982112ea924d37164205 | [
"MIT"
] | null | null | null | import unittest
from game.controllers.grenade_controller import *
from game.common.moving.damaging.grenade import Grenade
from game.common.wall import Wall
from game.common.moving.shooter import Shooter
from game.common.game_board import GameBoard
from game.common.player import Player
from game.common.items.money import Money
class TestGrenadeController(unittest.TestCase):
def setUp(self):
self.gCont = GrenadeController()
def test_grenade_damages_object(self):
wall = Wall(Hitbox(100, 100, (399, 399)), 1000)
player = Player(shooter=Shooter(0, 0, Hitbox(10, 10, (380, 450))))
player.action.set_action(ActionType.throw_grenade)
grenade = Grenade(
hitbox=Hitbox(
5,
5,
(player.shooter.hitbox.position[0],
player.shooter.hitbox.position[1])),
health=10,
fuse_time=10,
damage=5)
player.action.grenade_distance = 50
player.shooter.append_inventory(grenade)
game_board = GameBoard()
game_board.partition.add_object(wall)
game_board.partition.add_object(player.shooter)
wall_start_health = wall.health
for i in range(20):
self.gCont.handle_actions(player, game_board)
self.assertEqual(wall.health, wall_start_health - grenade.damage)
def test_grenade_fuse(self):
wall = Wall(Hitbox(100, 100, (399, 399)), 1000)
player = Player(shooter=Shooter(0, 0, Hitbox(10, 10, (380, 450))))
player.action.set_action(ActionType.throw_grenade)
grenade = Grenade(hitbox=Hitbox(5, 5, (player.shooter.hitbox.position[0], player.shooter.hitbox.position[1])),
health=10, fuse_time=10, damage=5)
player.action.grenade_distance = 50
player.shooter.append_inventory(grenade)
game_board = GameBoard()
game_board.partition.add_object(wall)
game_board.partition.add_object(player.shooter)
wall_start_health = wall.health
for i in range(5):
self.gCont.handle_actions(player, game_board)
self.assertEqual(wall.health, wall_start_health)
def test_no_health_object(self):
money = Money(Hitbox(100, 100, (399, 399)), health=None)
player = Player(shooter=Shooter(0, 0, Hitbox(10, 10, (380, 450))))
player.action.set_action(ActionType.throw_grenade)
grenade = Grenade(hitbox=Hitbox(5, 5, (player.shooter.hitbox.position[0], player.shooter.hitbox.position[1])),
health=10, fuse_time=10, damage=5)
player.action.grenade_distance = 50
player.shooter.append_inventory(grenade)
game_board = GameBoard()
game_board.partition.add_object(money)
game_board.partition.add_object(player.shooter)
money_start_health = money.health
for i in range(20):
self.gCont.handle_actions(player, game_board)
self.assertEqual(money.health, money_start_health)
def test_no_collisions(self):
player = Player(shooter=Shooter(0, 0, Hitbox(10, 10, (200, 450))))
player.action.set_action(ActionType.throw_grenade)
grenade = Grenade(hitbox=Hitbox(5, 5, (player.shooter.hitbox.position[0], player.shooter.hitbox.position[1])),
health=10, fuse_time=10, damage=5)
player.action.grenade_distance = 100
player.shooter.append_inventory(grenade)
game_board = GameBoard()
game_board.partition.add_object(player.shooter)
start_health = player.shooter.health
for i in range(20):
self.gCont.handle_actions(player, game_board)
self.assertEqual(player.shooter.health, start_health)
def test_throw_right_map(self):
player = Player(shooter=Shooter(0, 0, Hitbox(10, 10, (490, 490))))
player.action.set_action(ActionType.throw_grenade)
grenade = Grenade(hitbox=Hitbox(5, 5, (player.shooter.hitbox.position[0], player.shooter.hitbox.position[1])),
health=10, fuse_time=10, damage=5)
player.action.grenade_distance = 50
player.shooter.append_inventory(grenade)
game_board = GameBoard()
game_board.partition.add_object(player.shooter)
start_health = player.shooter.health
for i in range(20):
self.gCont.handle_actions(player, game_board)
self.assertEqual(player.shooter.health, start_health - grenade.damage)
def test_destroy_wall(self):
wall = Wall(Hitbox(100, 100, (399, 399)), 10)
player = Player(shooter=Shooter(0, 0, Hitbox(10, 10, (380, 450))))
player.action.set_action(ActionType.throw_grenade)
grenade = Grenade(
hitbox=Hitbox(
5,
5,
(player.shooter.hitbox.position[0],
player.shooter.hitbox.position[1])),
health=10,
fuse_time=10,
damage=50)
player.action.grenade_distance = 50
player.shooter.append_inventory(grenade)
game_board = GameBoard()
game_board.partition.add_object(wall)
game_board.partition.add_object(player.shooter)
for i in range(20):
self.gCont.handle_actions(player, game_board)
self.assertNotIn(wall, game_board.partition.get_all_objects())
def test_throw_left_map(self):
player = Player(shooter=Shooter(180, 0, Hitbox(10, 10, (1, 1))))
player.action.set_action(ActionType.throw_grenade)
grenade = Grenade(hitbox=Hitbox(5, 5, (player.shooter.hitbox.position[0], player.shooter.hitbox.position[1])),
health=10, fuse_time=10, damage=5)
player.action.grenade_distance = 50
player.shooter.append_inventory(grenade)
game_board = GameBoard()
game_board.partition.add_object(player.shooter)
start_health = player.shooter.health
for i in range(20):
self.gCont.handle_actions(player, game_board)
self.assertEqual(player.shooter.health, start_health - grenade.damage)
def test_throw_above_map(self):
player = Player(shooter=Shooter(270, 0, Hitbox(10, 10, (250, 1))))
player.action.set_action(ActionType.throw_grenade)
grenade = Grenade(hitbox=Hitbox(5, 5, (player.shooter.hitbox.position[0], player.shooter.hitbox.position[1])),
health=10, fuse_time=10, damage=5)
player.action.grenade_distance = 50
player.shooter.append_inventory(grenade)
game_board = GameBoard()
game_board.partition.add_object(player.shooter)
start_health = player.shooter.health
for i in range(20):
self.gCont.handle_actions(player, game_board)
self.assertEqual(player.shooter.health, start_health - grenade.damage)
def test_throw_below_map(self):
player = Player(shooter=Shooter(90, 0, Hitbox(10, 10, (250, 489))))
player.action.set_action(ActionType.throw_grenade)
grenade = Grenade(hitbox=Hitbox(5, 5, (player.shooter.hitbox.position[0], player.shooter.hitbox.position[1])),
health=10, fuse_time=10, damage=5)
player.action.grenade_distance = 50
player.shooter.append_inventory(grenade)
game_board = GameBoard()
game_board.partition.add_object(player.shooter)
start_health = player.shooter.health
for i in range(20):
self.gCont.handle_actions(player, game_board)
self.assertEqual(player.shooter.health, start_health - grenade.damage)
if __name__ == '__main__':
unittest.main()
| 46.29697 | 118 | 0.655321 | 944 | 7,639 | 5.136653 | 0.090042 | 0.147453 | 0.07053 | 0.100227 | 0.866983 | 0.851516 | 0.826356 | 0.818107 | 0.81192 | 0.81192 | 0 | 0.048409 | 0.234717 | 7,639 | 164 | 119 | 46.579268 | 0.781047 | 0 | 0 | 0.735099 | 0 | 0 | 0.001047 | 0 | 0 | 0 | 0 | 0 | 0.059603 | 1 | 0.066225 | false | 0 | 0.05298 | 0 | 0.125828 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
45cb14d65386f7a0c4feed435833b8b6d4c34dbd | 646 | py | Python | project/old/ver.py | LolexInc/Lolex-Tools | cfe43e450c0b2d3d2bc936508711a13630493bf5 | [
"Unlicense"
] | 1 | 2018-06-05T14:29:52.000Z | 2018-06-05T14:29:52.000Z | project/old/ver.py | LolexInc/Lolex-Tools | cfe43e450c0b2d3d2bc936508711a13630493bf5 | [
"Unlicense"
] | 2 | 2018-06-11T14:51:52.000Z | 2018-08-11T11:46:43.000Z | project/old/ver.py | LolexInc/Lolex-Tools | cfe43e450c0b2d3d2bc936508711a13630493bf5 | [
"Unlicense"
] | 1 | 2020-05-01T13:55:05.000Z | 2020-05-01T13:55:05.000Z | #! python3
##0
## 0 000000 0 000000 0 0 000000000 00000000 00000000 0 000000
## 0 00 0 0 0 00 00 0 0 0 0 0 0
## 0 00 0 0 00000 00 000000 00 0 0 0 0 0 00000
## 0 00 0 0 0 0 0 00 0 0 0 0 0 0
## 0000000 000000 0000000 000000 0 0 00 00000000 00000000 0000000 000000
##
## authors = Monkeyboy2805
version = 10.000000000000002
| 58.727273 | 115 | 0.342105 | 70 | 646 | 3.157143 | 0.185714 | 0.226244 | 0.217195 | 0.199095 | 0.190045 | 0.162896 | 0.131222 | 0.081448 | 0 | 0 | 0 | 0.793388 | 0.625387 | 646 | 10 | 116 | 64.6 | 0.119835 | 0.914861 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
45dfbdebbc5dc3cfa1c0655abf8280adeb323650 | 21,938 | py | Python | tests/test_store.py | msg-byu/gblearn | 0559c9cb477948717415e90ccb86cd5a0a9240c1 | [
"MIT"
] | 1 | 2020-02-20T20:26:05.000Z | 2020-02-20T20:26:05.000Z | tests/test_store.py | msg-byu/gblearn | 0559c9cb477948717415e90ccb86cd5a0a9240c1 | [
"MIT"
] | null | null | null | tests/test_store.py | msg-byu/gblearn | 0559c9cb477948717415e90ccb86cd5a0a9240c1 | [
"MIT"
] | 2 | 2020-01-14T23:49:18.000Z | 2020-01-20T17:58:11.000Z | from pyrelate.store import Store
from pyrelate.collection import AtomsCollection
import os
import shutil
import unittest
# TODO finish updating unit tests
def _delete_store(store):
shutil.rmtree(store.root)
def _test_descriptor(atoms, **kwargs):
return 'test result'
def _initialize_collection_and_read(aids):
'''Initialize collection and read specified atoms files'''
my_col = AtomsCollection("Test", "tests/results")
data_path = 'tests/test_data/ni.p{0:s}.out'
for aid in aids:
my_col.read(data_path.format(aid), 28, 'lammps-dump-text',
rxid=r'ni.p(?P<aid>\d+).out')
return my_col
def _initialize_collection_and_describe(desc, aids, **kwargs):
'''Initialize collection with specified descriptor and aids and describe'''
my_col = _initialize_collection_and_read(aids)
for d in desc:
my_col.describe(d, fcn=_test_descriptor, **kwargs)
for aid in aids:
assert my_col.get_description(aid, d, **kwargs) is not None
return my_col
class TestStore(unittest.TestCase):
def test_init_store(self):
'''Test initialization of store'''
try:
store = Store('./tests/results')
except TypeError:
assert False
assert True
_delete_store(store)
def test_init_store_default(self):
'''Test initializing store default'''
try:
store = Store()
except TypeError:
assert False
assert True
_delete_store(store)
def test_init_store_expanduser(self):
'''Test initializing store default'''
try:
store = Store("~/test_store")
except TypeError:
assert False
assert True
_delete_store(store)
def test_based_on_is_correct_1(self):
# if based_on is None, and not in dict, true
store = Store("./tests/results")
based_on = None
info = {"other": 1}
assert store._based_on_is_correct(based_on, info)
_delete_store(store)
def test_based_on_is_correct_2(self):
# if based_on is None, and is in dict, false
store = Store("./tests/results")
based_on = None
info = {"other": 1, "based_on_name": "name", "based_on_args": {"a": 1, "b": 2}}
assert not store._based_on_is_correct(based_on, info)
_delete_store(store)
def test_based_on_is_correct_3(self):
# if based_on is not None, and not in dict, false
store = Store("./tests/results")
desc_args = {"a": 1, "b": 2}
based_on = ("desc", desc_args)
info = {"other": 1}
assert not store._based_on_is_correct(based_on, info)
_delete_store(store)
def test_based_on_is_correct_4(self):
# if based_on is not None, and wrong based_on_args, false
store = Store("./tests/results")
desc_args = {"a": 1, "b": 2}
name = "desc"
based_on = (name, desc_args)
info = {"other": 1, "based_on_name": name, "based_on_args": {"a": 1, "b": 22}}
assert not store._based_on_is_correct(based_on, info)
_delete_store(store)
def test_based_on_is_correct_5(self):
# if based_on is not None, and info matches, true
store = Store("./tests/results")
desc_args = {"a": 1, "b": 2}
name = "desc"
based_on = (name, desc_args)
info = {"other": 1, "based_on_name": name, "based_on_args": desc_args}
assert store._based_on_is_correct(based_on, info)
_delete_store(store)
def test_check_exists_description_true(self):
store = Store("./tests/results")
result = "Random test result"
desc = "test_desc"
aid = "111"
kw1 = "option_1"
kw2 = "option_2"
info = {}
store.store_description(result, info, aid, desc, a=kw1, b=kw2)
assert store.check_exists("Descriptions", aid, desc, a=kw1, b=kw2)
assert type(store.check_exists("Descriptions", aid, desc, a=kw1, b=kw2, explicit=True)) is str
_delete_store(store)
def test_check_exists_description_false(self):
store = Store("./tests/results")
desc = "test_desc"
aid = "111"
kw1 = "option_1"
kw2 = "option_2"
assert not store.check_exists("Descriptions", aid, desc, a=kw1, b=kw2)
_delete_store(store)
def test_check_exists_collection_true(self):
store = Store("./tests/results")
result = "Random test result"
info = {
"additional_info": [1, 2, 3, 4, 5]
}
desc = "test_desc"
method = "test_method"
name = "my_collection"
desc_args = {
"kw1": "option_1",
"kw2": "option_2"
}
method_args = {
"eps": 1,
"num": 50
}
store.store_collection_result(result, info, method, name, (desc, desc_args), **method_args)
assert store.check_exists("Collections", name, method, based_on=(desc, desc_args), **method_args)
_delete_store(store)
def test_check_exists_collection_false(self):
store = Store("./tests/results")
desc = "test_desc"
method = "test_method"
name = "my_collection"
desc_args = {
"kw1": "option_1",
"kw2": "option_2"
}
method_args = {
"eps": 1,
"num": 50
}
assert not store.check_exists("Collections", name, method, based_on=(desc, desc_args), **method_args)
_delete_store(store)
def test_generate_default_file_name(self):
'''Test _generate_default_file_name'''
store = Store("./tests/results")
aid = "455"
desc = "soap"
filename = store._generate_default_file_name(aid, desc)
assert filename[:-26] == aid + "_" + desc
assert filename[-4:] == ".pkl"
_delete_store(store)
def test_store_file(self):
test = "thing"
store = Store("./tests/results")
path = os.path.join(store.root, "thing.pkl")
store._store_file(test, path)
assert os.path.exists(path)
_delete_store(store)
def test_store_description(self):
# called in describe()
# result, descriptor, aid, argmuments
store = Store("./tests/results")
result = "Random test result"
desc = "test_desc"
aid = "111"
kw1 = "option_1"
kw2 = "option_2"
info = {}
store.store_description(result, info, aid, desc, a=kw1, b=kw2)
fpath = os.path.join(store.root, "Descriptions", aid, desc)
os.path.join(store.root, "Descriptions", aid, desc)
assert os.path.exists(fpath)
directory = os.fsencode(fpath)
for file in os.listdir(directory):
filename = os.fsdecode(file)
if filename[:-26] == aid + "_" + desc:
fullpath = os.path.join(fpath, filename)
assert os.path.exists(fullpath)
break
else:
assert False, "No correct file found"
_delete_store(store)
def test_store_description_with_info(self):
# called in describe()
# result, descriptor, aid, argmuments
store = Store("./tests/results")
result = "Random test result"
desc = "test_desc"
aid = "111"
kw1 = "option_1"
kw2 = "option_2"
info = {"num": 47, "important_info": 12, "fcn": _test_descriptor}
store.store_description(result, info, aid, desc, a=kw1, b=kw2)
fpath = os.path.join(store.root, "Descriptions", aid, desc)
assert os.path.exists(fpath)
directory = os.fsencode(fpath)
for file in os.listdir(directory):
filename = os.fsdecode(file)
if filename[:-26] == aid + "_" + desc:
fullpath = os.path.join(fpath, filename)
assert os.path.exists(fullpath)
info_fullpath = os.path.join(fpath, "info_" + filename)
assert os.path.exists(info_fullpath)
fetched_info = store._unpickle(info_fullpath)
assert fetched_info['num'] == info['num']
assert fetched_info['important_info'] == info['important_info']
assert fetched_info['desc_args'] == {"a": kw1, "b": kw2}
assert fetched_info['fcn'] == "_test_descriptor"
break
else:
assert False, "No correct file found"
_delete_store(store)
def test_store_collection_result(self):
# called in the process() method
# result, info, collection name, arguments, descriptor_args
store = Store("./tests/results")
result = "Random test result"
info = {
"additional_info": [1, 2, 3, 4, 5]
}
desc = "test_desc"
method = "test_method"
name = "my_collection"
desc_args = {
"kw1": "option_1",
"kw2": "option_2"
}
method_args = {
"eps": 1,
"num": 50
}
store.store_collection_result(result, info, method, name, (desc, desc_args), **method_args)
fpath = os.path.join(store.root, "Collections", name, method)
assert os.path.exists(fpath)
directory = os.fsencode(fpath)
for file in os.listdir(directory):
filename = os.fsdecode(file)
print(filename[:-26], name + "_" + method)
if filename[:-26] == name + "_" + method:
fullpath = os.path.join(fpath, filename)
assert os.path.exists(fullpath)
info_fullpath = os.path.join(fpath, "info_" + filename)
assert os.path.exists(info_fullpath)
fetched_info = store._unpickle(info_fullpath)
assert fetched_info['method_args'] == method_args
assert fetched_info['based_on_name'] == desc
assert fetched_info['based_on_args'] == desc_args
assert fetched_info['additional_info'] == info['additional_info']
break
else:
assert False, "No correct file found"
_delete_store(store)
def test_store_collection_result_with_function_in_args(self):
# called in the process() method
# result, info, collection name, arguments, descriptor_args
store = Store("./tests/results")
result = "Random test result"
info = {
"additional_info": [1, 2, 3, 4, 5]
}
desc = "test_desc"
method = "test_method"
name = "my_collection"
desc_args = {
"kw1": "option_1",
"kw2": "option_2"
}
method_args = {
"eps": 1,
"num": 50,
"fcn": _test_descriptor
}
store.store_collection_result(result, info, method, name, (desc, desc_args), **method_args)
fpath = os.path.join(store.root, "Collections", name, method)
assert os.path.exists(fpath)
directory = os.fsencode(fpath)
for file in os.listdir(directory):
filename = os.fsdecode(file)
print(filename[:-26], name + "_" + method)
if filename[:-26] == name + "_" + method:
fullpath = os.path.join(fpath, filename)
assert os.path.exists(fullpath)
info_fullpath = os.path.join(fpath, "info_" + filename)
assert os.path.exists(info_fullpath)
fetched_info = store._unpickle(info_fullpath)
assert fetched_info['method_args'] != method_args # function converted to string of name
assert fetched_info['method_args']['fcn'] == "_test_descriptor"
assert fetched_info['based_on_name'] == desc
assert fetched_info['based_on_args'] == desc_args
assert fetched_info['additional_info'] == info['additional_info']
break
else:
assert False, "No correct file found"
_delete_store(store)
def test_store_additional(self):
pass
def test_equal_args_true(self):
dic1 = {"a": 1, "b": 2, "c": 3}
dic2 = {"a": 1, "b": 2, "c": 3}
store = Store("./tests/results")
assert store._equal_args(dic1, dic2)
_delete_store(store)
def test_equal_args_false(self):
dic1 = {"a": 1, "b": 2, "c": 3}
dic2 = {"a": 1, "b": 2, "c": 4}
store = Store("./tests/results")
assert not store._equal_args(dic1, dic2)
_delete_store(store)
def test_equal_args_with_function(self):
store = Store("./tests/results")
func = _test_descriptor
dic1 = {"func": func, "b": 2, "c": 3}
dic2 = {"func": func.__name__, "b": 2, "c": 3}
assert store._equal_args(dic1, dic2)
_delete_store(store)
def test_get_description(self):
store = Store("./tests/results")
result = "Random test result"
desc = "test_desc"
aid = "111"
kwargs = {"a": "option_1", "b": "option_2"}
info = {}
store.store_description(result, info, aid, desc, **kwargs)
res = store.get_description(aid, desc, **kwargs)
assert res == result
_delete_store(store)
def test_get_description_metadata(self):
store = Store("./tests/results")
result = "Random test result"
desc = "test_desc"
aid = "111"
kwargs = {"a": "option_1", "b": "option_2"}
info = {}
store.store_description(result, info, aid, desc, **kwargs)
res, info = store.get_description(aid, desc, metadata=True, **kwargs)
assert res == result
assert info["desc_args"] == kwargs
_delete_store(store)
def test_get_collection_results(self):
store = Store("./tests/results")
result = "Random test result"
info = {
"additional_info": [1, 2, 3, 4, 5]
}
desc = "test_desc"
method = "test_method"
name = "my_collection"
desc_args = {
"kw1": "option_1",
"kw2": "option_2"
}
method_args = {
"eps": 1,
"num": 50
}
store.store_collection_result(result, info, method, name, (desc, desc_args), **method_args)
res = store.get_collection_result(method, name, (desc, desc_args), **method_args)
assert res == result
_delete_store(store)
def test_get_collection_results_metadata(self):
store = Store("./tests/results")
result = "Random test result"
info = {
"additional_info": [1, 2, 3, 4, 5]
}
desc = "test_desc"
method = "test_method"
name = "my_collection"
desc_args = {
"kw1": "option_1",
"kw2": "option_2"
}
method_args = {
"eps": 1,
"num": 50
}
store.store_collection_result(result, info, method, name, (desc, desc_args), **method_args)
res, info = store.get_collection_result(method, name, (desc, desc_args), metadata=True, **method_args)
assert res == result
assert info["based_on_args"] == desc_args
assert info["method_args"] == method_args
_delete_store(store)
def test_unpickle_path_and_fname(self):
store = Store("./tests/results")
test = "thing"
fname = "thing.pkl"
path = os.path.join(store.root, fname)
store._store_file(test, path)
fetched = store._unpickle(store.root, fname)
assert fetched == test
_delete_store(store)
def test_unpickle_path(self):
store = Store("./tests/results")
test = "thing"
fname = "thing.pkl"
path = os.path.join(store.root, fname)
store._store_file(test, path)
fetched = store._unpickle(path)
assert fetched == test
_delete_store(store)
def test_unpickle_does_not_exist(self):
store = Store("./tests/results")
try:
store._unpickle("fakepath", "fake_fname")
except FileNotFoundError:
assert True
else:
assert False, "Expected error not thrown"
finally:
_delete_store(store)
def test_unpickle_unpickling_error(self):
import pickle
store = Store("./tests/results/")
fname = "fakepkl.pkl"
try:
store._unpickle("./tests", fname)
except pickle.UnpicklingError:
assert True
else:
assert False, "Expected error not thrown"
finally:
_delete_store(store)
def test_clear_collection_result(self):
'''Test clear, specific result'''
store = Store("./tests/results")
result1 = "Random test result1"
result2 = "Random test result2"
info = {
"additional_info": [1, 2, 3, 4, 5]
}
desc = "test_desc"
method = "test_method"
name = "my_collection"
desc_args = {
"kw1": "option_1",
"kw2": "option_2"
}
method_args1 = {
"eps": 1,
"num": 50
}
method_args2 = {
"eps": 1,
"num": 49
}
store.store_collection_result(result1, info, method, name, (desc, desc_args), **method_args1)
store.store_collection_result(result2, info, method, name, (desc, desc_args), **method_args2)
store.clear_collection_result(method, name, (desc, desc_args), **method_args1)
try:
store.get_collection_result(method, name, (desc, desc_args), **method_args1)
except FileNotFoundError:
assert True
else:
assert False, "Expected error not thrown"
_delete_store(store)
def test_clear_description_result(self):
'''Test clear, clear all results for given discriptor and parameters for all aids in list'''
store = Store("./tests/results")
result = "Random test result"
desc = "test_desc"
aid = "111"
kwargs1 = {"a": "option_1", "b": "option_2"}
kwargs2 = {"a": "option_1", "b": "option_3"}
info = {}
store.store_description(result, info, aid, desc, **kwargs1)
store.store_description(result, info, aid, desc, **kwargs2)
store.clear_description_result(aid, desc, **kwargs1)
try:
store.get_description(aid, desc, **kwargs1)
except FileNotFoundError:
assert True
else:
assert False, "Expected error not thrown"
_delete_store(store)
def test_clear_method(self):
'''Test clear, clear all results for given descriptor'''
store = Store("./tests/results")
result = "Random test result"
info = {
"additional_info": [1, 2, 3, 4, 5]
}
desc = "test_desc"
method = "test_method"
name = "my_collection"
desc_args = {
"kw1": "option_1",
"kw2": "option_2"
}
method_args1 = {
"eps": 1,
"num": 50
}
method_args2 = {
"eps": 1,
"num": 49
}
store.store_collection_result(result, info, method, name, (desc, desc_args), **method_args1)
store.store_collection_result(result, info, method, name, (desc, desc_args), **method_args2)
store.clear_method(method, name)
assert os.path.exists(os.path.join(store.root, "Collections", method, name)) is False
_delete_store(store)
def test_clear_description(self):
'''Test clear, clear all results for given descriptor'''
store = Store("./tests/results")
result = "Random test result"
desc = "test_desc"
aid = "111"
kwargs1 = {"a": "option_1", "b": "option_2"}
kwargs2 = {"a": "option_1", "b": "option_3"}
info = {}
store.store_description(result, info, aid, desc, **kwargs1)
store.store_description(result, info, aid, desc, **kwargs2)
store.clear_description(aid, desc)
assert os.path.exists(os.path.join(store.root, "Descriptions", aid, desc)) is False
_delete_store(store)
def test_clear_all(self):
'''Test clear, clear all'''
store = Store("./tests/results")
result = "Random test result"
info = {
"additional_info": [1, 2, 3, 4, 5]
}
desc = "test_desc"
method = "test_method"
name = "my_collection"
desc_args = {
"kw1": "option_1",
"kw2": "option_2"
}
method_args1 = {
"eps": 1,
"num": 50
}
aid = "111"
kwargs1 = {"a": "option_1", "b": "option_2"}
info = {}
store.store_description(result, info, aid, desc, **kwargs1)
store.store_collection_result(result, info, method, name, (desc, desc_args), **method_args1)
store.clear_all()
assert os.path.exists(os.path.join(store.root, "Descriptions", aid, desc)) is False
assert os.path.exists(os.path.join(store.root, "Collections", method, name)) is False
_delete_store(store)
| 35.044728 | 111 | 0.550688 | 2,473 | 21,938 | 4.65467 | 0.073595 | 0.079924 | 0.048649 | 0.05447 | 0.84302 | 0.795066 | 0.788116 | 0.769438 | 0.728173 | 0.696117 | 0 | 0.019355 | 0.331161 | 21,938 | 625 | 112 | 35.1008 | 0.765147 | 0.049549 | 0 | 0.71785 | 0 | 0 | 0.13594 | 0.001439 | 0 | 0 | 0 | 0.0016 | 0.138196 | 1 | 0.074856 | false | 0.001919 | 0.015355 | 0.001919 | 0.097889 | 0.003839 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
45e524804c4737dd538fcf819b3af32392e1a541 | 30,027 | py | Python | sdk/python/pulumi_openstack/firewall/firewall.py | pulumi/pulumi-openstack | 945eed22a82784e9f0b3aa56168b2397c2f503e8 | [
"ECL-2.0",
"Apache-2.0"
] | 34 | 2018-09-12T12:37:51.000Z | 2022-02-04T19:32:13.000Z | sdk/python/pulumi_openstack/firewall/firewall.py | pulumi/pulumi-openstack | 945eed22a82784e9f0b3aa56168b2397c2f503e8 | [
"ECL-2.0",
"Apache-2.0"
] | 72 | 2018-08-15T13:04:57.000Z | 2022-03-31T15:39:49.000Z | sdk/python/pulumi_openstack/firewall/firewall.py | pulumi/pulumi-openstack | 945eed22a82784e9f0b3aa56168b2397c2f503e8 | [
"ECL-2.0",
"Apache-2.0"
] | 7 | 2019-03-14T08:28:49.000Z | 2021-12-29T04:23:55.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
__all__ = ['FirewallArgs', 'Firewall']
@pulumi.input_type
class FirewallArgs:
def __init__(__self__, *,
policy_id: pulumi.Input[str],
admin_state_up: Optional[pulumi.Input[bool]] = None,
associated_routers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
no_routers: Optional[pulumi.Input[bool]] = None,
region: Optional[pulumi.Input[str]] = None,
tenant_id: Optional[pulumi.Input[str]] = None,
value_specs: Optional[pulumi.Input[Mapping[str, Any]]] = None):
"""
The set of arguments for constructing a Firewall resource.
:param pulumi.Input[str] policy_id: The policy resource id for the firewall. Changing
this updates the `policy_id` of an existing firewall.
:param pulumi.Input[bool] admin_state_up: Administrative up/down status for the firewall
(must be "true" or "false" if provided - defaults to "true").
Changing this updates the `admin_state_up` of an existing firewall.
:param pulumi.Input[Sequence[pulumi.Input[str]]] associated_routers: Router(s) to associate this firewall instance
with. Must be a list of strings. Changing this updates the associated routers
of an existing firewall. Conflicts with `no_routers`.
:param pulumi.Input[str] description: A description for the firewall. Changing this
updates the `description` of an existing firewall.
:param pulumi.Input[str] name: A name for the firewall. Changing this
updates the `name` of an existing firewall.
:param pulumi.Input[bool] no_routers: Should this firewall not be associated with any routers
(must be "true" or "false" if provide - defaults to "false").
Conflicts with `associated_routers`.
:param pulumi.Input[str] region: The region in which to obtain the v1 networking client.
A networking client is needed to create a firewall. If omitted, the
`region` argument of the provider is used. Changing this creates a new
firewall.
:param pulumi.Input[str] tenant_id: The owner of the floating IP. Required if admin wants
to create a firewall for another tenant. Changing this creates a new
firewall.
:param pulumi.Input[Mapping[str, Any]] value_specs: Map of additional options.
"""
pulumi.set(__self__, "policy_id", policy_id)
if admin_state_up is not None:
pulumi.set(__self__, "admin_state_up", admin_state_up)
if associated_routers is not None:
pulumi.set(__self__, "associated_routers", associated_routers)
if description is not None:
pulumi.set(__self__, "description", description)
if name is not None:
pulumi.set(__self__, "name", name)
if no_routers is not None:
pulumi.set(__self__, "no_routers", no_routers)
if region is not None:
pulumi.set(__self__, "region", region)
if tenant_id is not None:
pulumi.set(__self__, "tenant_id", tenant_id)
if value_specs is not None:
pulumi.set(__self__, "value_specs", value_specs)
@property
@pulumi.getter(name="policyId")
def policy_id(self) -> pulumi.Input[str]:
"""
The policy resource id for the firewall. Changing
this updates the `policy_id` of an existing firewall.
"""
return pulumi.get(self, "policy_id")
@policy_id.setter
def policy_id(self, value: pulumi.Input[str]):
pulumi.set(self, "policy_id", value)
@property
@pulumi.getter(name="adminStateUp")
def admin_state_up(self) -> Optional[pulumi.Input[bool]]:
"""
Administrative up/down status for the firewall
(must be "true" or "false" if provided - defaults to "true").
Changing this updates the `admin_state_up` of an existing firewall.
"""
return pulumi.get(self, "admin_state_up")
@admin_state_up.setter
def admin_state_up(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "admin_state_up", value)
@property
@pulumi.getter(name="associatedRouters")
def associated_routers(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
Router(s) to associate this firewall instance
with. Must be a list of strings. Changing this updates the associated routers
of an existing firewall. Conflicts with `no_routers`.
"""
return pulumi.get(self, "associated_routers")
@associated_routers.setter
def associated_routers(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "associated_routers", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
A description for the firewall. Changing this
updates the `description` of an existing firewall.
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
A name for the firewall. Changing this
updates the `name` of an existing firewall.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="noRouters")
def no_routers(self) -> Optional[pulumi.Input[bool]]:
"""
Should this firewall not be associated with any routers
(must be "true" or "false" if provide - defaults to "false").
Conflicts with `associated_routers`.
"""
return pulumi.get(self, "no_routers")
@no_routers.setter
def no_routers(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "no_routers", value)
@property
@pulumi.getter
def region(self) -> Optional[pulumi.Input[str]]:
"""
The region in which to obtain the v1 networking client.
A networking client is needed to create a firewall. If omitted, the
`region` argument of the provider is used. Changing this creates a new
firewall.
"""
return pulumi.get(self, "region")
@region.setter
def region(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "region", value)
@property
@pulumi.getter(name="tenantId")
def tenant_id(self) -> Optional[pulumi.Input[str]]:
"""
The owner of the floating IP. Required if admin wants
to create a firewall for another tenant. Changing this creates a new
firewall.
"""
return pulumi.get(self, "tenant_id")
@tenant_id.setter
def tenant_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "tenant_id", value)
@property
@pulumi.getter(name="valueSpecs")
def value_specs(self) -> Optional[pulumi.Input[Mapping[str, Any]]]:
"""
Map of additional options.
"""
return pulumi.get(self, "value_specs")
@value_specs.setter
def value_specs(self, value: Optional[pulumi.Input[Mapping[str, Any]]]):
pulumi.set(self, "value_specs", value)
@pulumi.input_type
class _FirewallState:
def __init__(__self__, *,
admin_state_up: Optional[pulumi.Input[bool]] = None,
associated_routers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
no_routers: Optional[pulumi.Input[bool]] = None,
policy_id: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
tenant_id: Optional[pulumi.Input[str]] = None,
value_specs: Optional[pulumi.Input[Mapping[str, Any]]] = None):
"""
Input properties used for looking up and filtering Firewall resources.
:param pulumi.Input[bool] admin_state_up: Administrative up/down status for the firewall
(must be "true" or "false" if provided - defaults to "true").
Changing this updates the `admin_state_up` of an existing firewall.
:param pulumi.Input[Sequence[pulumi.Input[str]]] associated_routers: Router(s) to associate this firewall instance
with. Must be a list of strings. Changing this updates the associated routers
of an existing firewall. Conflicts with `no_routers`.
:param pulumi.Input[str] description: A description for the firewall. Changing this
updates the `description` of an existing firewall.
:param pulumi.Input[str] name: A name for the firewall. Changing this
updates the `name` of an existing firewall.
:param pulumi.Input[bool] no_routers: Should this firewall not be associated with any routers
(must be "true" or "false" if provide - defaults to "false").
Conflicts with `associated_routers`.
:param pulumi.Input[str] policy_id: The policy resource id for the firewall. Changing
this updates the `policy_id` of an existing firewall.
:param pulumi.Input[str] region: The region in which to obtain the v1 networking client.
A networking client is needed to create a firewall. If omitted, the
`region` argument of the provider is used. Changing this creates a new
firewall.
:param pulumi.Input[str] tenant_id: The owner of the floating IP. Required if admin wants
to create a firewall for another tenant. Changing this creates a new
firewall.
:param pulumi.Input[Mapping[str, Any]] value_specs: Map of additional options.
"""
if admin_state_up is not None:
pulumi.set(__self__, "admin_state_up", admin_state_up)
if associated_routers is not None:
pulumi.set(__self__, "associated_routers", associated_routers)
if description is not None:
pulumi.set(__self__, "description", description)
if name is not None:
pulumi.set(__self__, "name", name)
if no_routers is not None:
pulumi.set(__self__, "no_routers", no_routers)
if policy_id is not None:
pulumi.set(__self__, "policy_id", policy_id)
if region is not None:
pulumi.set(__self__, "region", region)
if tenant_id is not None:
pulumi.set(__self__, "tenant_id", tenant_id)
if value_specs is not None:
pulumi.set(__self__, "value_specs", value_specs)
@property
@pulumi.getter(name="adminStateUp")
def admin_state_up(self) -> Optional[pulumi.Input[bool]]:
"""
Administrative up/down status for the firewall
(must be "true" or "false" if provided - defaults to "true").
Changing this updates the `admin_state_up` of an existing firewall.
"""
return pulumi.get(self, "admin_state_up")
@admin_state_up.setter
def admin_state_up(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "admin_state_up", value)
@property
@pulumi.getter(name="associatedRouters")
def associated_routers(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
Router(s) to associate this firewall instance
with. Must be a list of strings. Changing this updates the associated routers
of an existing firewall. Conflicts with `no_routers`.
"""
return pulumi.get(self, "associated_routers")
@associated_routers.setter
def associated_routers(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
pulumi.set(self, "associated_routers", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
A description for the firewall. Changing this
updates the `description` of an existing firewall.
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
A name for the firewall. Changing this
updates the `name` of an existing firewall.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="noRouters")
def no_routers(self) -> Optional[pulumi.Input[bool]]:
"""
Should this firewall not be associated with any routers
(must be "true" or "false" if provide - defaults to "false").
Conflicts with `associated_routers`.
"""
return pulumi.get(self, "no_routers")
@no_routers.setter
def no_routers(self, value: Optional[pulumi.Input[bool]]):
pulumi.set(self, "no_routers", value)
@property
@pulumi.getter(name="policyId")
def policy_id(self) -> Optional[pulumi.Input[str]]:
"""
The policy resource id for the firewall. Changing
this updates the `policy_id` of an existing firewall.
"""
return pulumi.get(self, "policy_id")
@policy_id.setter
def policy_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "policy_id", value)
@property
@pulumi.getter
def region(self) -> Optional[pulumi.Input[str]]:
"""
The region in which to obtain the v1 networking client.
A networking client is needed to create a firewall. If omitted, the
`region` argument of the provider is used. Changing this creates a new
firewall.
"""
return pulumi.get(self, "region")
@region.setter
def region(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "region", value)
@property
@pulumi.getter(name="tenantId")
def tenant_id(self) -> Optional[pulumi.Input[str]]:
"""
The owner of the floating IP. Required if admin wants
to create a firewall for another tenant. Changing this creates a new
firewall.
"""
return pulumi.get(self, "tenant_id")
@tenant_id.setter
def tenant_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "tenant_id", value)
@property
@pulumi.getter(name="valueSpecs")
def value_specs(self) -> Optional[pulumi.Input[Mapping[str, Any]]]:
"""
Map of additional options.
"""
return pulumi.get(self, "value_specs")
@value_specs.setter
def value_specs(self, value: Optional[pulumi.Input[Mapping[str, Any]]]):
pulumi.set(self, "value_specs", value)
class Firewall(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
admin_state_up: Optional[pulumi.Input[bool]] = None,
associated_routers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
no_routers: Optional[pulumi.Input[bool]] = None,
policy_id: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
tenant_id: Optional[pulumi.Input[str]] = None,
value_specs: Optional[pulumi.Input[Mapping[str, Any]]] = None,
__props__=None):
"""
Manages a v1 firewall resource within OpenStack.
## Example Usage
```python
import pulumi
import pulumi_openstack as openstack
rule1 = openstack.firewall.Rule("rule1",
action="deny",
description="drop TELNET traffic",
destination_port="23",
enabled=True,
protocol="tcp")
rule2 = openstack.firewall.Rule("rule2",
action="deny",
description="drop NTP traffic",
destination_port="123",
enabled=False,
protocol="udp")
policy1 = openstack.firewall.Policy("policy1", rules=[
rule1.id,
rule2.id,
])
firewall1 = openstack.firewall.Firewall("firewall1", policy_id=policy1.id)
```
## Import
Firewalls can be imported using the `id`, e.g.
```sh
$ pulumi import openstack:firewall/firewall:Firewall firewall_1 c9e39fb2-ce20-46c8-a964-25f3898c7a97
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[bool] admin_state_up: Administrative up/down status for the firewall
(must be "true" or "false" if provided - defaults to "true").
Changing this updates the `admin_state_up` of an existing firewall.
:param pulumi.Input[Sequence[pulumi.Input[str]]] associated_routers: Router(s) to associate this firewall instance
with. Must be a list of strings. Changing this updates the associated routers
of an existing firewall. Conflicts with `no_routers`.
:param pulumi.Input[str] description: A description for the firewall. Changing this
updates the `description` of an existing firewall.
:param pulumi.Input[str] name: A name for the firewall. Changing this
updates the `name` of an existing firewall.
:param pulumi.Input[bool] no_routers: Should this firewall not be associated with any routers
(must be "true" or "false" if provide - defaults to "false").
Conflicts with `associated_routers`.
:param pulumi.Input[str] policy_id: The policy resource id for the firewall. Changing
this updates the `policy_id` of an existing firewall.
:param pulumi.Input[str] region: The region in which to obtain the v1 networking client.
A networking client is needed to create a firewall. If omitted, the
`region` argument of the provider is used. Changing this creates a new
firewall.
:param pulumi.Input[str] tenant_id: The owner of the floating IP. Required if admin wants
to create a firewall for another tenant. Changing this creates a new
firewall.
:param pulumi.Input[Mapping[str, Any]] value_specs: Map of additional options.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: FirewallArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
Manages a v1 firewall resource within OpenStack.
## Example Usage
```python
import pulumi
import pulumi_openstack as openstack
rule1 = openstack.firewall.Rule("rule1",
action="deny",
description="drop TELNET traffic",
destination_port="23",
enabled=True,
protocol="tcp")
rule2 = openstack.firewall.Rule("rule2",
action="deny",
description="drop NTP traffic",
destination_port="123",
enabled=False,
protocol="udp")
policy1 = openstack.firewall.Policy("policy1", rules=[
rule1.id,
rule2.id,
])
firewall1 = openstack.firewall.Firewall("firewall1", policy_id=policy1.id)
```
## Import
Firewalls can be imported using the `id`, e.g.
```sh
$ pulumi import openstack:firewall/firewall:Firewall firewall_1 c9e39fb2-ce20-46c8-a964-25f3898c7a97
```
:param str resource_name: The name of the resource.
:param FirewallArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(FirewallArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
admin_state_up: Optional[pulumi.Input[bool]] = None,
associated_routers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
no_routers: Optional[pulumi.Input[bool]] = None,
policy_id: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
tenant_id: Optional[pulumi.Input[str]] = None,
value_specs: Optional[pulumi.Input[Mapping[str, Any]]] = None,
__props__=None):
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = FirewallArgs.__new__(FirewallArgs)
__props__.__dict__["admin_state_up"] = admin_state_up
__props__.__dict__["associated_routers"] = associated_routers
__props__.__dict__["description"] = description
__props__.__dict__["name"] = name
__props__.__dict__["no_routers"] = no_routers
if policy_id is None and not opts.urn:
raise TypeError("Missing required property 'policy_id'")
__props__.__dict__["policy_id"] = policy_id
__props__.__dict__["region"] = region
__props__.__dict__["tenant_id"] = tenant_id
__props__.__dict__["value_specs"] = value_specs
super(Firewall, __self__).__init__(
'openstack:firewall/firewall:Firewall',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
admin_state_up: Optional[pulumi.Input[bool]] = None,
associated_routers: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
no_routers: Optional[pulumi.Input[bool]] = None,
policy_id: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
tenant_id: Optional[pulumi.Input[str]] = None,
value_specs: Optional[pulumi.Input[Mapping[str, Any]]] = None) -> 'Firewall':
"""
Get an existing Firewall resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[bool] admin_state_up: Administrative up/down status for the firewall
(must be "true" or "false" if provided - defaults to "true").
Changing this updates the `admin_state_up` of an existing firewall.
:param pulumi.Input[Sequence[pulumi.Input[str]]] associated_routers: Router(s) to associate this firewall instance
with. Must be a list of strings. Changing this updates the associated routers
of an existing firewall. Conflicts with `no_routers`.
:param pulumi.Input[str] description: A description for the firewall. Changing this
updates the `description` of an existing firewall.
:param pulumi.Input[str] name: A name for the firewall. Changing this
updates the `name` of an existing firewall.
:param pulumi.Input[bool] no_routers: Should this firewall not be associated with any routers
(must be "true" or "false" if provide - defaults to "false").
Conflicts with `associated_routers`.
:param pulumi.Input[str] policy_id: The policy resource id for the firewall. Changing
this updates the `policy_id` of an existing firewall.
:param pulumi.Input[str] region: The region in which to obtain the v1 networking client.
A networking client is needed to create a firewall. If omitted, the
`region` argument of the provider is used. Changing this creates a new
firewall.
:param pulumi.Input[str] tenant_id: The owner of the floating IP. Required if admin wants
to create a firewall for another tenant. Changing this creates a new
firewall.
:param pulumi.Input[Mapping[str, Any]] value_specs: Map of additional options.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _FirewallState.__new__(_FirewallState)
__props__.__dict__["admin_state_up"] = admin_state_up
__props__.__dict__["associated_routers"] = associated_routers
__props__.__dict__["description"] = description
__props__.__dict__["name"] = name
__props__.__dict__["no_routers"] = no_routers
__props__.__dict__["policy_id"] = policy_id
__props__.__dict__["region"] = region
__props__.__dict__["tenant_id"] = tenant_id
__props__.__dict__["value_specs"] = value_specs
return Firewall(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter(name="adminStateUp")
def admin_state_up(self) -> pulumi.Output[Optional[bool]]:
"""
Administrative up/down status for the firewall
(must be "true" or "false" if provided - defaults to "true").
Changing this updates the `admin_state_up` of an existing firewall.
"""
return pulumi.get(self, "admin_state_up")
@property
@pulumi.getter(name="associatedRouters")
def associated_routers(self) -> pulumi.Output[Sequence[str]]:
"""
Router(s) to associate this firewall instance
with. Must be a list of strings. Changing this updates the associated routers
of an existing firewall. Conflicts with `no_routers`.
"""
return pulumi.get(self, "associated_routers")
@property
@pulumi.getter
def description(self) -> pulumi.Output[Optional[str]]:
"""
A description for the firewall. Changing this
updates the `description` of an existing firewall.
"""
return pulumi.get(self, "description")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
A name for the firewall. Changing this
updates the `name` of an existing firewall.
"""
return pulumi.get(self, "name")
@property
@pulumi.getter(name="noRouters")
def no_routers(self) -> pulumi.Output[Optional[bool]]:
"""
Should this firewall not be associated with any routers
(must be "true" or "false" if provide - defaults to "false").
Conflicts with `associated_routers`.
"""
return pulumi.get(self, "no_routers")
@property
@pulumi.getter(name="policyId")
def policy_id(self) -> pulumi.Output[str]:
"""
The policy resource id for the firewall. Changing
this updates the `policy_id` of an existing firewall.
"""
return pulumi.get(self, "policy_id")
@property
@pulumi.getter
def region(self) -> pulumi.Output[str]:
"""
The region in which to obtain the v1 networking client.
A networking client is needed to create a firewall. If omitted, the
`region` argument of the provider is used. Changing this creates a new
firewall.
"""
return pulumi.get(self, "region")
@property
@pulumi.getter(name="tenantId")
def tenant_id(self) -> pulumi.Output[str]:
"""
The owner of the floating IP. Required if admin wants
to create a firewall for another tenant. Changing this creates a new
firewall.
"""
return pulumi.get(self, "tenant_id")
@property
@pulumi.getter(name="valueSpecs")
def value_specs(self) -> pulumi.Output[Optional[Mapping[str, Any]]]:
"""
Map of additional options.
"""
return pulumi.get(self, "value_specs")
| 43.580552 | 134 | 0.631165 | 3,587 | 30,027 | 5.109562 | 0.059381 | 0.080423 | 0.061109 | 0.050415 | 0.909265 | 0.898407 | 0.891859 | 0.886731 | 0.879583 | 0.866543 | 0 | 0.003933 | 0.271789 | 30,027 | 688 | 135 | 43.643895 | 0.834263 | 0.41809 | 0 | 0.821317 | 1 | 0 | 0.084317 | 0.002375 | 0 | 0 | 0 | 0 | 0 | 1 | 0.163009 | false | 0.003135 | 0.015674 | 0 | 0.275862 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
aff54d191c35fa0ead39ef7690c4ee968615a585 | 4,696 | py | Python | tests/translation/thot/test_thot_word_alignment_parameters.py | johnml1135/machine.py | 7bfb668b81d6af476f7ee797900e111c3027d542 | [
"MIT"
] | null | null | null | tests/translation/thot/test_thot_word_alignment_parameters.py | johnml1135/machine.py | 7bfb668b81d6af476f7ee797900e111c3027d542 | [
"MIT"
] | null | null | null | tests/translation/thot/test_thot_word_alignment_parameters.py | johnml1135/machine.py | 7bfb668b81d6af476f7ee797900e111c3027d542 | [
"MIT"
] | null | null | null | from machine.translation.thot import ThotWordAlignmentParameters
from machine.translation.thot.thot_word_alignment_model_type import ThotWordAlignmentModelType
def test_get_fast_align_iteration_count_default() -> None:
parameters = ThotWordAlignmentParameters()
assert parameters.get_fast_align_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 4
assert parameters.get_fast_align_iteration_count(ThotWordAlignmentModelType.IBM1) == 0
def test_get_fast_align_iteration_count_set() -> None:
parameters = ThotWordAlignmentParameters(fast_align_iteration_count=2)
assert parameters.get_fast_align_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 2
assert parameters.get_fast_align_iteration_count(ThotWordAlignmentModelType.IBM1) == 0
def test_get_ibm1_iteration_count_default() -> None:
parameters = ThotWordAlignmentParameters()
assert parameters.get_ibm1_iteration_count(ThotWordAlignmentModelType.IBM1) == 4
assert parameters.get_ibm1_iteration_count(ThotWordAlignmentModelType.IBM4) == 5
assert parameters.get_ibm1_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 0
def test_get_ibm1_iteration_count_set() -> None:
parameters = ThotWordAlignmentParameters(ibm1_iteration_count=2)
assert parameters.get_ibm1_iteration_count(ThotWordAlignmentModelType.IBM1) == 2
assert parameters.get_ibm1_iteration_count(ThotWordAlignmentModelType.IBM4) == 2
assert parameters.get_ibm1_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 0
def test_get_ibm2_iteration_count_default() -> None:
parameters = ThotWordAlignmentParameters()
assert parameters.get_ibm2_iteration_count(ThotWordAlignmentModelType.IBM2) == 4
assert parameters.get_ibm2_iteration_count(ThotWordAlignmentModelType.IBM4) == 0
assert parameters.get_ibm2_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 0
def test_get_ibm2_iteration_count_set() -> None:
parameters = ThotWordAlignmentParameters(ibm2_iteration_count=2)
assert parameters.get_ibm2_iteration_count(ThotWordAlignmentModelType.IBM2) == 2
assert parameters.get_ibm2_iteration_count(ThotWordAlignmentModelType.IBM4) == 2
assert parameters.get_ibm2_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 0
def test_get_hmm_iteration_count_default() -> None:
parameters = ThotWordAlignmentParameters()
assert parameters.get_hmm_iteration_count(ThotWordAlignmentModelType.HMM) == 4
assert parameters.get_hmm_iteration_count(ThotWordAlignmentModelType.IBM4) == 5
assert parameters.get_hmm_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 0
def test_get_hmm_iteration_count_set() -> None:
parameters = ThotWordAlignmentParameters(hmm_iteration_count=2)
assert parameters.get_hmm_iteration_count(ThotWordAlignmentModelType.HMM) == 2
assert parameters.get_hmm_iteration_count(ThotWordAlignmentModelType.IBM4) == 2
assert parameters.get_hmm_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 0
def test_get_hmm_iteration_count_ibm2_set() -> None:
parameters = ThotWordAlignmentParameters(ibm2_iteration_count=2)
assert parameters.get_hmm_iteration_count(ThotWordAlignmentModelType.HMM) == 4
assert parameters.get_hmm_iteration_count(ThotWordAlignmentModelType.IBM4) == 0
assert parameters.get_hmm_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 0
def test_get_ibm3_iteration_count_default() -> None:
parameters = ThotWordAlignmentParameters()
assert parameters.get_ibm3_iteration_count(ThotWordAlignmentModelType.IBM3) == 4
assert parameters.get_ibm3_iteration_count(ThotWordAlignmentModelType.IBM4) == 5
assert parameters.get_ibm3_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 0
def test_get_ibm3_iteration_count_set() -> None:
parameters = ThotWordAlignmentParameters(ibm3_iteration_count=2)
assert parameters.get_ibm3_iteration_count(ThotWordAlignmentModelType.IBM3) == 2
assert parameters.get_ibm3_iteration_count(ThotWordAlignmentModelType.IBM4) == 2
assert parameters.get_ibm3_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 0
def test_get_ibm4_iteration_count_default() -> None:
parameters = ThotWordAlignmentParameters()
assert parameters.get_ibm4_iteration_count(ThotWordAlignmentModelType.IBM4) == 4
assert parameters.get_ibm4_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 0
def test_get_ibm4_iteration_count_set() -> None:
parameters = ThotWordAlignmentParameters(ibm4_iteration_count=2)
assert parameters.get_ibm4_iteration_count(ThotWordAlignmentModelType.IBM4) == 2
assert parameters.get_ibm4_iteration_count(ThotWordAlignmentModelType.FAST_ALIGN) == 0
| 52.177778 | 96 | 0.833262 | 511 | 4,696 | 7.248532 | 0.062622 | 0.207883 | 0.179536 | 0.091793 | 0.952484 | 0.952484 | 0.87797 | 0.860691 | 0.610691 | 0.50432 | 0 | 0.022883 | 0.097317 | 4,696 | 89 | 97 | 52.764045 | 0.850908 | 0 | 0 | 0.365079 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | 1 | 0.206349 | false | 0 | 0.031746 | 0 | 0.238095 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
aff7e4f7e33b45ff25980c46fd417cbe0a38151c | 919 | py | Python | OnePy/feeds/csvfeed.py | sibuzu/OnePy | 464fca1c68a10f90ad128da3bfb03f05d2fc24bc | [
"MIT"
] | null | null | null | OnePy/feeds/csvfeed.py | sibuzu/OnePy | 464fca1c68a10f90ad128da3bfb03f05d2fc24bc | [
"MIT"
] | null | null | null | OnePy/feeds/csvfeed.py | sibuzu/OnePy | 464fca1c68a10f90ad128da3bfb03f05d2fc24bc | [
"MIT"
] | null | null | null | from .feedbase import CSVFeedBase
class ForexCSVFeed(CSVFeedBase):
"""
如果CSV中日期和时间分为两列,即一列为2017.01.01,一列为12:00:00,
则需要在params中注明 timeindex,以及日期和时间的格式,否则为None
"""
dtformat = "%Y%m%d"
tmformat = "%H:%M:%S"
timeindex = "Timestamp"
class TushareCSVFeed(CSVFeedBase):
"""
如果CSV中日期和时间分为两列,即一列为2017.01.01,一列为12:00:00,
则需要在params中注明 timeindex,以及日期和时间的格式,否则为None
"""
dtformat = "%Y-%m-%d"
tmformat = None
timeindex = None
class FuturesCSVFeed(CSVFeedBase):
"""
如果CSV中日期和时间分为两列,即一列为2017.01.01,一列为12:00:00,
则需要在params中注明 timeindex,以及日期和时间的格式,否则为None
"""
dtformat = "%Y/%m/%d"
tmformat = "%H:%M:%S"
timeindex = "Time"
class GenericCSVFeed(CSVFeedBase):
"""
如果CSV中日期和时间分为两列,即一列为2017.01.01,一列为12:00:00,
则需要在params中注明 timeindex,以及日期和时间的格式,否则为None
"""
dtformat = "%Y-%m-%d"
tmformat = "%H:%M:%S"
timeindex = None
| 20.886364 | 47 | 0.645267 | 98 | 919 | 6.05102 | 0.285714 | 0.175379 | 0.229342 | 0.242833 | 0.768971 | 0.768971 | 0.768971 | 0.768971 | 0.768971 | 0.768971 | 0 | 0.076818 | 0.206746 | 919 | 43 | 48 | 21.372093 | 0.736626 | 0.377584 | 0 | 0.411765 | 0 | 0 | 0.135354 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 8 |
b3655fc5ded328fd58fcb2db7bc365efa847482e | 1,148 | py | Python | src/dsalgo/deque_test.py | kagemeka/python-algorithms | dface89b8c618845cf524429aa8e97c4b2b10ceb | [
"MIT"
] | 1 | 2022-02-10T02:13:07.000Z | 2022-02-10T02:13:07.000Z | src/dsalgo/deque_test.py | kagemeka/python-algorithms | dface89b8c618845cf524429aa8e97c4b2b10ceb | [
"MIT"
] | 6 | 2022-01-05T09:15:54.000Z | 2022-01-09T05:48:43.000Z | src/dsalgo/deque_test.py | kagemeka/python-algorithms | dface89b8c618845cf524429aa8e97c4b2b10ceb | [
"MIT"
] | null | null | null | import unittest
import dsalgo.deque
class TestCircularBuffer(unittest.TestCase):
def test(self) -> None:
que = dsalgo.deque.CircularBuffer[int](2)
que.append_right(1)
self.assertEqual(len(que), 1)
que.append_left(2)
self.assertEqual(len(que), 2)
with self.assertRaises(Exception):
que.append_right(3)
self.assertEqual(que.pop_right(), 1)
self.assertEqual(len(que), 1)
self.assertEqual(que.pop_right(), 2)
self.assertEqual(len(que), 0)
with self.assertRaises(Exception):
que.pop_left()
class TestDoublyLinkedList(unittest.TestCase):
def test(self) -> None:
que = dsalgo.deque.DoublyLinkedList[int]()
que.append_right(1)
self.assertEqual(len(que), 1)
que.append_left(2)
self.assertEqual(len(que), 2)
self.assertEqual(que.pop_right(), 1)
self.assertEqual(len(que), 1)
self.assertEqual(que.pop_right(), 2)
self.assertEqual(len(que), 0)
with self.assertRaises(Exception):
que.pop_left()
if __name__ == "__main__":
unittest.main()
| 28.7 | 50 | 0.619338 | 139 | 1,148 | 4.978417 | 0.230216 | 0.260116 | 0.208092 | 0.242775 | 0.783237 | 0.736994 | 0.736994 | 0.736994 | 0.736994 | 0.606936 | 0 | 0.020906 | 0.25 | 1,148 | 39 | 51 | 29.435897 | 0.782811 | 0 | 0 | 0.71875 | 0 | 0 | 0.006969 | 0 | 0 | 0 | 0 | 0 | 0.46875 | 1 | 0.0625 | false | 0 | 0.0625 | 0 | 0.1875 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 |
64358050a7f867d8ccbfe8bd28161f7725df5c5e | 127 | py | Python | components/water_level/__init__.py | brenshanny/project_lob | 2eb5aca40b5dfae84bdb0eeb19374c93ae0a7a1f | [
"MIT"
] | 1 | 2018-11-09T19:22:23.000Z | 2018-11-09T19:22:23.000Z | components/water_level/__init__.py | brenshanny/project_lob | 2eb5aca40b5dfae84bdb0eeb19374c93ae0a7a1f | [
"MIT"
] | null | null | null | components/water_level/__init__.py | brenshanny/project_lob | 2eb5aca40b5dfae84bdb0eeb19374c93ae0a7a1f | [
"MIT"
] | null | null | null | from . import water_level_manager
from . import water_level_monitor
__all__ = ['water_level_manager', 'water_level_monitor']
| 21.166667 | 56 | 0.811024 | 17 | 127 | 5.352941 | 0.411765 | 0.43956 | 0.32967 | 0.43956 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.110236 | 127 | 5 | 57 | 25.4 | 0.80531 | 0 | 0 | 0 | 0 | 0 | 0.301587 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
ff76b3530aaf753ba1fc504d8ba2e4f2e96988e2 | 2,405 | py | Python | ctkapi/CardRequest.py | larrycameron80/Spend_SDK-Python | 09b7d385f99f7ed0cc0f31b967724804d8149743 | [
"MIT"
] | null | null | null | ctkapi/CardRequest.py | larrycameron80/Spend_SDK-Python | 09b7d385f99f7ed0cc0f31b967724804d8149743 | [
"MIT"
] | null | null | null | ctkapi/CardRequest.py | larrycameron80/Spend_SDK-Python | 09b7d385f99f7ed0cc0f31b967724804d8149743 | [
"MIT"
] | null | null | null | # import requests
# import json
# import yaml
# import request
# def card(authtoken):
# endpoint="/card"
# response = requests.get(
# request.client.url+endpoint,
# headers={'content-type': 'application/json',"Authorization": authtoken})
# output=yaml.load(json.dumps(response.json()))
# if output["success"]==True:
# return output["data"]["cards"]
# else:
# return "error"
# def cardissue(authtoken):
# endpoint="/card/issue"
# response = requests.post(
# request.client.url+endpoint,
# headers={'content-type': 'application/json',"Authorization": authtoken})
# output=yaml.load(json.dumps(response.json()))
# return output
# # if output["success"]==True:
# # return output["data"]
# # else:
# # return "error"
# def cardinfo(authtoken,san):
# endpoint="/card/info"
# rpc_input = {"san" : san}
# response = requests.post(
# request.client.url+endpoint,data=json.dumps(rpc_input),
# headers={'content-type': 'application/json',"Authorization": authtoken})
# output=yaml.load(json.dumps(response.json()))
# return output
# # if output["success"]==True:
# # return output["data"]
# # else:
# # return "error"
# def cardactivate(authtoken):
# endpoint="/card/activate"
# response = requests.get(
# request.client.url+endpoint,
# headers={'content-type': 'application/json',"Authorization": authtoken})
# output=yaml.load(json.dumps(response.json()))
# if output["success"]==True:
# return output["data"]
# else:
# return "error"
# def cardstatus(authtoken,san,bool):
# endpoint="/card/status/" +san
# rpc_input={"status":bool}
# response = requests.get(
# request.client.url+endpoint,
# data=json.dumps(rpc_input),
# headers={'content-type': 'application/json',"Authorization": authtoken})
# output=yaml.load(json.dumps(response.json()))
# if output["success"]==True:
# return output["data"]
# else:
# return "error"
| 32.945205 | 91 | 0.528067 | 219 | 2,405 | 5.780822 | 0.191781 | 0.049763 | 0.063191 | 0.094787 | 0.771722 | 0.771722 | 0.771722 | 0.725118 | 0.725118 | 0.725118 | 0 | 0 | 0.319335 | 2,405 | 72 | 92 | 33.402778 | 0.773366 | 0.941788 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
ff96f6b7c94c0fbd06ea07ca724632827405ef01 | 26,976 | py | Python | src/selectml/sk/preprocessor.py | darcyabjones/selectml | fc63f9de0e0e4c496f34d2a77f169a2c59968786 | [
"Apache-2.0"
] | 1 | 2021-12-07T04:28:39.000Z | 2021-12-07T04:28:39.000Z | src/selectml/sk/preprocessor.py | darcyabjones/selectml | fc63f9de0e0e4c496f34d2a77f169a2c59968786 | [
"Apache-2.0"
] | null | null | null | src/selectml/sk/preprocessor.py | darcyabjones/selectml | fc63f9de0e0e4c496f34d2a77f169a2c59968786 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
import numpy as np
from sklearn.base import TransformerMixin, BaseEstimator
from sklearn.utils.validation import (
check_array,
check_is_fitted,
)
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Sequence, Union, Optional
from typing import List
import numpy.typing as npt
class Unity(TransformerMixin, BaseEstimator):
"""A dummy transformer that does nothing.
This is convenient for optimisation pipelines, but generally won't be used
interactively.
"""
requires_y: bool = False
def __init__(self):
return
def _reset(self):
"""Reset internal data-dependent state of the scaler, if necessary.
__init__ parameters are not touched.
"""
return
def fit(
self,
X: "npt.ArrayLike",
y: "Optional[npt.ArrayLike]" = None,
**kwargs,
) -> "Unity":
"""Compute the mean and std to be used for later scaling.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The data used to compute the mean and standard deviation
used for later scaling along the features axis.
y : None
Ignored.
Returns
-------
self : object
Fitted scaler.
"""
return self
def transform(self, X: "npt.ArrayLike") -> np.ndarray:
"""Scale features of X according to feature_range.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Input data that will be transformed.
Returns
-------
Xt : ndarray of shape (n_samples, n_features)
Transformed data.
"""
return np.array(X)
def inverse_transform(self, X: "npt.ArrayLike") -> np.ndarray:
"""Undo the scaling of X according to feature_range.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Input data that will be transformed. It cannot be sparse.
Returns
-------
Xt : ndarray of shape (n_samples, n_features)
Transformed data.
"""
return np.array(X)
class MAFScaler(TransformerMixin, BaseEstimator):
"""Scale each marker by the minor allele frequency
This is the same scaling applied to the Van Raden similarity computation
before the dot-product is taken.
It is somewhat analogous to mean-centering.
Examples:
>>> import numpy as np
>>> from selectml.sk.preprocessor import MAFScaler
>>> from selectml.data import basic
>>> X, _, _ = basic()
>>> X = np.unique(X, axis=0)
>>> MAFScaler().fit_transform(X)
array([[-1.4, -0.4, -0.4, 0.6, 0.2, -0.2, -0.8, -1. , 0.2, -0.4],
[-0.4, 1.6, 0.6, -0.4, 0.2, -0.2, 1.2, -1. , 0.2, -0.4],
[ 0.6, -0.4, -1.4, 0.6, -0.8, 0.8, -0.8, 1. , 1.2, -0.4],
[ 0.6, -0.4, 0.6, -1.4, 1.2, 0.8, 0.2, 1. , -0.8, 0.6],
[ 0.6, -0.4, 0.6, 0.6, -0.8, -1.2, 0.2, 0. , -0.8, 0.6]])
"""
requires_y: bool = False
def __init__(self, ploidy: int = 2, *, copy: bool = True):
self.ploidy = int(ploidy)
self.copy = bool(copy)
return
def _reset(self):
"""Reset internal data-dependent state of the scaler, if necessary.
__init__ parameters are not touched.
"""
# Checking one attribute is enough, becase they are all set together
# in partial_fit
if hasattr(self, 'n_samples_seen_'):
del self.n_samples_seen_
del self.n_features_in_
del self.n_features_
del self.allele_counts_
del self.P_
def partial_fit(
self,
X: "npt.ArrayLike",
y: "Optional[npt.ArrayLike]" = None
) -> "MAFScaler":
"""Online computation of min and max on X for later scaling.
All of X is processed as a single batch. This is intended for cases
when :meth:`fit` is not feasible due to very large number of
`n_samples` or because X is read from a continuous stream.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data used to compute the mean and standard deviation
used for later scaling along the features axis.
y : None
Ignored.
Returns
-------
self : object
Fitted scaler.
"""
first_pass: bool = not hasattr(self, 'n_samples_seen_')
X_: np.ndarray = check_array(
X,
accept_sparse=False,
accept_large_sparse=False,
dtype="numeric",
force_all_finite="allow-nan",
estimator=self
)
# np.isin(X[~np.isnan(X)], np.arange(self.ploidy + 1)).all()
all_ok = True
if not all_ok:
raise ValueError(
"Encountered a value less than 0 or greater "
f"than {self.ploidy}."
)
# Maybe raise a warning if no 0s or 2s i.e. maybe smaller ploidy than
# specified.
if first_pass:
self.n_samples_seen_: np.ndarray = (~np.isnan(X_)).sum(axis=0)
self.allele_counts_: np.ndarray = (self.ploidy - X_).sum(axis=0)
else:
assert X_.shape[1] == self.n_features_in_, \
"Must have same number of features"
self.n_samples_seen_ += (~np.isnan(X_)).sum(axis=0)
self.allele_counts_ += (self.ploidy - X_).sum(axis=0)
# Frequency of alternate allele
p_i = self.allele_counts_ / (self.ploidy * self.n_samples_seen_)
self.P_: np.ndarray = self.ploidy * (p_i - 0.5)
self.n_features_in_: int = self.P_.shape[0]
self.n_features_ = self.n_features_in_
return self
def fit(
self,
X: "npt.ArrayLike",
y: "Optional[npt.ArrayLike]" = None
) -> "MAFScaler":
"""Compute the mean and std to be used for later scaling.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The data used to compute the mean and standard deviation
used for later scaling along the features axis.
y : None
Ignored.
Returns
-------
self : object
Fitted scaler.
"""
# Reset internal state before fitting
self._reset()
return self.partial_fit(X, y)
def transform(self, X: "npt.ArrayLike") -> np.ndarray:
"""Scale features of X according to feature_range.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Input data that will be transformed.
Returns
-------
Xt : ndarray of shape (n_samples, n_features)
Transformed data.
"""
check_is_fitted(self, 'n_features_in_')
X_: np.ndarray = check_array(
X,
accept_sparse=False,
accept_large_sparse=False,
dtype="numeric",
force_all_finite="allow-nan",
estimator=self,
)
if X_.shape[1] != self.n_features_in_:
raise ValueError("Must have same number of features")
X_ = X_ - (self.ploidy / 2) + self.P_
return X_
def inverse_transform(self, X: "npt.ArrayLike") -> np.ndarray:
"""Undo the scaling of X according to feature_range.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Input data that will be transformed. It cannot be sparse.
Returns
-------
Xt : ndarray of shape (n_samples, n_features)
Transformed data.
"""
check_is_fitted(self, 'n_features_in_')
X_: np.ndarray = check_array(
X,
accept_sparse=False,
accept_large_sparse=False,
dtype="numeric",
force_all_finite="allow-nan",
estimator=self,
)
if X_.shape[1] != self.n_features_in_:
raise ValueError("Must have same number of features")
X_ = X_ + (self.ploidy / 2) + self.P_
return X_
class PercentileRankTransformer(TransformerMixin, BaseEstimator):
"""Convert continuous variables into a quantised ranks.
This is useful for transforming response variables.
Examples:
To quantise by the 25-, 50- and 75-th percentiles, do
>>> from selectml.sk.preprocessor import PercentileRankTransformer
>>> from selectml.data import basic
>>> _, y, _ = basic()
>>> PercentileRankTransformer([25, 50, 75])\
.fit_transform(y.reshape((-1, 1)))
array([[3.],
[3.],
[3.],
[3.],
[3.],
[0.],
[0.],
[0.],
[0.],
[0.],
[2.],
[2.],
[2.],
[2.],
[3.],
[1.],
[2.],
[0.],
[1.],
[1.],
[1.],
[1.],
[1.],
[2.],
[0.]])
"""
requires_y: bool = False
def __init__(
self,
boundaries: "Sequence[int]",
*,
reverse: "Union[bool, Sequence[bool]]" = False,
copy: bool = True
):
self.boundaries = boundaries
if not isinstance(reverse, bool):
self.reverse: Union[bool, List[bool]] = list(reverse)
else:
self.reverse = reverse
self.copy = copy
return
def _reset(self):
"""Reset internal data-dependent state of the scaler, if necessary.
__init__ parameters are not touched.
"""
if hasattr(self, "n_features_in_"):
del self.n_features_in_
del self.n_features_
del self.percentiles_
return self
def fit(
self,
X: "npt.ArrayLike",
y: "Optional[npt.ArrayLike]" = None
) -> "PercentileRankTransformer":
self._reset()
X_: np.ndarray = check_array(
X,
accept_sparse=False,
accept_large_sparse=False,
dtype="numeric",
force_all_finite="allow-nan",
estimator=self
)
if len(X_.shape) == 1:
X_ = X_.reshape(-1, 1)
if isinstance(self.reverse, bool):
reverse: List[bool] = [self.reverse for _ in range(X_.shape[1])]
else:
reverse = self.reverse
if len(reverse) != X_.shape[1]:
raise ValueError(
"Number of reverse specifictions does "
"not match number of columns."
)
boundaries = np.repeat(
np.array(self.boundaries).reshape(-1, 1),
X_.shape[1],
axis=1
)
percentiles = np.zeros(boundaries.shape)
for i, r in enumerate(reverse):
if r:
boundaries[:, i] = (100 - boundaries[:, i])
p = np.percentile(X_[:, i], boundaries[:, i])
percentiles[:, i] = p
self.percentiles_ = percentiles
self.n_features_in_ = X_.shape[1]
self.n_features_ = self.n_features_in_
return self
def transform(self, X: "npt.ArrayLike") -> np.ndarray:
check_is_fitted(self, 'n_features_in_')
X_: np.ndarray = check_array(
X,
accept_sparse=False,
accept_large_sparse=False,
dtype="numeric",
force_all_finite="allow-nan",
estimator=self,
)
if len(X_.shape) == 1:
X_transformed = True
X_ = X_.reshape(-1, 1)
else:
X_transformed = False
if isinstance(self.reverse, bool):
reverse: List[bool] = [self.reverse for _ in range(X_.shape[1])]
else:
reverse = self.reverse
if X_.shape[1] != self.n_features_in_:
raise ValueError(
f"Expected {self.n_features_in_} columns but "
f"received {X_.shape[1]}."
)
ranks = np.zeros(X_.shape, dtype=float)
for i in range(X_.shape[1]):
if reverse[i]:
for j, th in enumerate(self.percentiles_[:, i], 1):
ranks[X_[:, i] < th, i] = j
else:
for j, th in enumerate(self.percentiles_[:, i], 1):
ranks[X_[:, i] > th, i] = j
if X_transformed:
ranks = ranks.reshape(-1)
return ranks
class NOIAAdditiveScaler(TransformerMixin, BaseEstimator):
"""Scale each marker by the minor allele frequency
This is the same scaling applied to the Van Raden similarity computation
before the dot-product is taken.
It is somewhat analogous to mean-centering.
Examples:
>>> import numpy as np
>>> from selectml.sk.preprocessor import NOIAAdditiveScaler
>>> from selectml.data import basic
>>> X, _, _ = basic()
>>> X = np.unique(X, axis=0)
>>> sc = NOIAAdditiveScaler()
>>> trans = sc.fit_transform(X)
>>> trans
array([[-1.4, -0.4, -0.4, 0.6, 0.2, -0.2, -0.8, -1. , 0.2, -0.4],
[-0.4, 1.6, 0.6, -0.4, 0.2, -0.2, 1.2, -1. , 0.2, -0.4],
[ 0.6, -0.4, -1.4, 0.6, -0.8, 0.8, -0.8, 1. , 1.2, -0.4],
[ 0.6, -0.4, 0.6, -1.4, 1.2, 0.8, 0.2, 1. , -0.8, 0.6],
[ 0.6, -0.4, 0.6, 0.6, -0.8, -1.2, 0.2, 0. , -0.8, 0.6]])
>>> assert (sc.inverse_transform(trans) == X).all()
"""
requires_y: bool = False
def __init__(
self,
AA: float = 2,
Aa: float = 1,
aa: float = 0,
copy: bool = True
):
self.AA = AA
self.Aa = Aa
self.aa = aa
self.copy = bool(copy)
return
def _reset(self):
"""Reset internal data-dependent state of the scaler, if necessary.
__init__ parameters are not touched.
"""
# Checking one attribute is enough, becase they are all set together
# in partial_fit
if hasattr(self, 'n_samples_seen_'):
del self.n_samples_seen_
del self.n_features_in_
del self.n_features_
del self.Aa_counts_
del self.aa_counts_
def partial_fit(
self,
X: "npt.ArrayLike",
y: "Optional[npt.ArrayLike]" = None
) -> "NOIAAdditiveScaler":
"""Online computation of min and max on X for later scaling.
All of X is processed as a single batch. This is intended for cases
when :meth:`fit` is not feasible due to very large number of
`n_samples` or because X is read from a continuous stream.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data used to compute the mean and standard deviation
used for later scaling along the features axis.
y : None
Ignored.
Returns
-------
self : object
Fitted scaler.
"""
first_pass: bool = not hasattr(self, 'n_samples_seen_')
X_: np.ndarray = check_array(
X,
accept_sparse=False,
accept_large_sparse=False,
dtype="numeric",
force_all_finite="allow-nan",
estimator=self
)
# np.isin(X[~np.isnan(X)], np.arange(self.ploidy + 1)).all()
all_ok = True
if not all_ok:
raise ValueError(
"Encountered a value less than 0 or greater "
f"than {self.ploidy}."
)
# Maybe raise a warning if no 0s or 2s i.e. maybe smaller ploidy than
# specified.
if first_pass:
self.n_samples_seen_: np.ndarray = (
(~np.isnan(X_))
.astype(int)
.sum(axis=0)
)
self.Aa_counts_: np.ndarray = (
(X_ == self.Aa)
.astype(int)
.sum(axis=0)
)
self.aa_counts_: np.ndarray = (
(X_ == self.aa)
.astype(int)
.sum(axis=0)
)
else:
assert X_.shape[1] == self.n_features_in_, \
"Must have same number of features"
self.n_samples_seen_ += (~np.isnan(X_)).astype(int).sum(axis=0)
self.Aa_counts_ += (
(X_ == self.Aa)
.astype(int)
.sum(axis=0)
)
self.aa_counts_ += (
(X_ == self.aa)
.astype(int)
.sum(axis=0)
)
self.n_features_in_: int = self.aa_counts_.shape[0]
self.n_features_ = self.n_features_in_
return self
def fit(
self,
X: "npt.ArrayLike",
y: "Optional[npt.ArrayLike]" = None
) -> "NOIAAdditiveScaler":
"""Compute the mean and std to be used for later scaling.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The data used to compute the mean and standard deviation
used for later scaling along the features axis.
y : None
Ignored.
Returns
-------
self : object
Fitted scaler.
"""
# Reset internal state before fitting
self._reset()
return self.partial_fit(X, y)
def transform(self, X: "npt.ArrayLike") -> np.ndarray:
"""Scale features of X according to feature_range.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Input data that will be transformed.
Returns
-------
Xt : ndarray of shape (n_samples, n_features)
Transformed data.
"""
check_is_fitted(self, 'n_features_in_')
X_: np.ndarray = check_array(
X,
accept_sparse=False,
accept_large_sparse=False,
dtype="numeric",
force_all_finite="allow-nan",
estimator=self,
)
if X_.shape[1] != self.n_features_in_:
raise ValueError("Must have same number of features")
p_aa = self.aa_counts_ / self.n_samples_seen_
p_Aa = self.Aa_counts_ / self.n_samples_seen_
dom = -1 * (-p_Aa - 2 * p_aa) * (X_ == self.AA).astype(float)
het = -1 * (1 - p_Aa - 2 * p_aa) * (X_ == self.Aa).astype(float)
rec = -1 * (2 - p_Aa - 2 * p_aa) * (X_ == self.aa).astype(float)
return dom + het + rec
def inverse_transform(self, X: "npt.ArrayLike") -> np.ndarray:
"""Undo the scaling of X according to feature_range.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Input data that will be transformed. It cannot be sparse.
Returns
-------
Xt : ndarray of shape (n_samples, n_features)
Transformed data.
"""
check_is_fitted(self, 'n_features_in_')
X_: np.ndarray = check_array(
X,
accept_sparse=False,
accept_large_sparse=False,
dtype="numeric",
force_all_finite="allow-nan",
estimator=self,
)
if X_.shape[1] != self.n_features_in_:
raise ValueError("Must have same number of features")
p_aa = self.aa_counts_ / self.n_samples_seen_
p_Aa = self.Aa_counts_ / self.n_samples_seen_
dom = self.AA * np.isclose(X_, -1 * (-p_Aa - 2 * p_aa)).astype(float)
het = self.Aa * np.isclose(X_, -1 * (1 - p_Aa - 2 * p_aa)).astype(float) # noqa
rec = self.aa * np.isclose(X_, -1 * (2 - p_Aa - 2 * p_aa)).astype(float) # noqa
return dom + het + rec
class NOIADominanceScaler(TransformerMixin, BaseEstimator):
"""Scale each marker by the minor allele frequency
This is the same scaling applied to the Van Raden similarity computation
before the dot-product is taken.
It is somewhat analogous to mean-centering.
Examples:
>>> import numpy as np
>>> from selectml.sk.preprocessor import NOIADominanceScaler
>>> from selectml.data import basic
>>> X, _, _ = basic()
>>> X = np.unique(X, axis=0)
>>> sc = NOIADominanceScaler()
>>> trans = sc.fit_transform(X)
>>> trans
array([[-0.375 , 0. , 0.75 , -0.125 , 0.57142857,
0.57142857, -0.28571429, -0.2 , 0.57142857, 0. ],
[ 0.75 , 0. , -0.125 , 0.75 , 0.57142857,
0.57142857, -0.57142857, -0.2 , 0.57142857, 0. ],
[-0.125 , 0. , -0.375 , -0.125 , -0.28571429,
-0.28571429, -0.28571429, -0.2 , -0.57142857, 0. ],
[-0.125 , 0. , -0.125 , -0.375 , -0.57142857,
-0.28571429, 0.57142857, -0.2 , -0.28571429, 0. ],
[-0.125 , 0. , -0.125 , -0.125 , -0.28571429,
-0.57142857, 0.57142857, 0.8 , -0.28571429, 0. ]])
"""
requires_y: bool = False
def __init__(
self,
AA: float = 2.,
Aa: float = 1.,
aa: float = 0.,
copy: bool = True
):
self.AA = AA
self.Aa = Aa
self.aa = aa
self.copy = bool(copy)
return
def _reset(self):
"""Reset internal data-dependent state of the scaler, if necessary.
__init__ parameters are not touched.
"""
# Checking one attribute is enough, becase they are all set together
# in partial_fit
if hasattr(self, 'n_samples_seen_'):
del self.n_samples_seen_
del self.n_features_in_
del self.n_features_
del self.AA_counts_
del self.Aa_counts_
del self.aa_counts_
def partial_fit(
self,
X: "npt.ArrayLike",
y: "Optional[npt.ArrayLike]" = None
) -> "NOIADominanceScaler":
"""Online computation of min and max on X for later scaling.
All of X is processed as a single batch. This is intended for cases
when :meth:`fit` is not feasible due to very large number of
`n_samples` or because X is read from a continuous stream.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data used to compute the mean and standard deviation
used for later scaling along the features axis.
y : None
Ignored.
Returns
-------
self : object
Fitted scaler.
"""
first_pass: bool = not hasattr(self, 'n_samples_seen_')
X_: np.ndarray = check_array(
X,
accept_sparse=False,
accept_large_sparse=False,
dtype="numeric",
force_all_finite="allow-nan",
estimator=self
)
# np.isin(X[~np.isnan(X)], np.arange(self.ploidy + 1)).all()
all_ok = True
if not all_ok:
raise ValueError(
"Encountered a value less than 0 or greater "
f"than {self.ploidy}."
)
# Maybe raise a warning if no 0s or 2s i.e. maybe smaller ploidy than
# specified.
if first_pass:
self.n_samples_seen_: np.ndarray = (
(~np.isnan(X_))
.astype(int)
.sum(axis=0)
)
self.AA_counts_: np.ndarray = (
(X_ == self.AA)
.astype(int)
.sum(axis=0)
)
self.Aa_counts_: np.ndarray = (
(X_ == self.Aa)
.astype(int)
.sum(axis=0)
)
self.aa_counts_: np.ndarray = (
(X_ == self.aa)
.astype(int)
.sum(axis=0)
)
else:
assert X_.shape[1] == self.n_features_in_, \
"Must have same number of features"
self.n_samples_seen_ += (~np.isnan(X_)).astype(int).sum(axis=0)
self.AA_counts_ += (
(X_ == self.AA)
.astype(int)
.sum(axis=0)
)
self.Aa_counts_ += (
(X_ == self.Aa)
.astype(int)
.sum(axis=0)
)
self.aa_counts_ += (
(X_ == self.aa)
.astype(int)
.sum(axis=0)
)
self.n_features_in_: int = self.aa_counts_.shape[0]
self.n_features_ = self.n_features_in_
return self
def fit(
self,
X: "npt.ArrayLike",
y: "Optional[npt.ArrayLike]" = None
) -> "NOIADominanceScaler":
"""Compute the mean and std to be used for later scaling.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The data used to compute the mean and standard deviation
used for later scaling along the features axis.
y : None
Ignored.
Returns
-------
self : object
Fitted scaler.
"""
# Reset internal state before fitting
self._reset()
return self.partial_fit(X, y)
def transform(self, X: "npt.ArrayLike") -> np.ndarray:
"""Scale features of X according to feature_range.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Input data that will be transformed.
Returns
-------
Xt : ndarray of shape (n_samples, n_features)
Transformed data.
"""
check_is_fitted(self, 'n_features_in_')
X_: np.ndarray = check_array(
X,
accept_sparse=False,
accept_large_sparse=False,
dtype="numeric",
force_all_finite="allow-nan",
estimator=self,
)
if X_.shape[1] != self.n_features_in_:
raise ValueError("Must have same number of features")
p_aa = self.aa_counts_ / self.n_samples_seen_
p_Aa = self.Aa_counts_ / self.n_samples_seen_
p_AA = self.AA_counts_ / self.n_samples_seen_
dom_vals = -1 * (2 * p_Aa * p_aa) / (p_AA + p_aa - (p_AA - p_aa) ** 2)
het_vals = (4 * p_AA * p_aa) / (p_AA + p_aa - (p_AA - p_aa) ** 2)
rec_vals = -1 * (2 * p_AA * p_Aa) / (p_AA + p_aa - (p_AA - p_aa) ** 2)
dom = dom_vals * np.isclose(X_, self.AA).astype(float)
het = het_vals * np.isclose(X_, self.Aa).astype(float)
rec = rec_vals * np.isclose(X_, self.aa).astype(float)
return dom + het + rec
| 31.078341 | 88 | 0.5205 | 3,296 | 26,976 | 4.085255 | 0.082221 | 0.02228 | 0.035722 | 0.032306 | 0.862532 | 0.841589 | 0.832752 | 0.8228 | 0.806758 | 0.796955 | 0 | 0.034342 | 0.364213 | 26,976 | 867 | 89 | 31.114187 | 0.750743 | 0.353907 | 0 | 0.723112 | 0 | 0 | 0.095327 | 0.014784 | 0 | 0 | 0 | 0 | 0.006865 | 1 | 0.059497 | false | 0.01373 | 0.016018 | 0.002288 | 0.15103 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
44188fea9713a504240d08b287ce90d68ef5c10b | 100,166 | py | Python | Thrift/gen-py/SpotifakeServices/PlaylistService.py | BrunoLujan/Spotifake-DESER | a811444af0a1326659dd27949c6a1c66c7cd66a1 | [
"Apache-2.0"
] | null | null | null | Thrift/gen-py/SpotifakeServices/PlaylistService.py | BrunoLujan/Spotifake-DESER | a811444af0a1326659dd27949c6a1c66c7cd66a1 | [
"Apache-2.0"
] | null | null | null | Thrift/gen-py/SpotifakeServices/PlaylistService.py | BrunoLujan/Spotifake-DESER | a811444af0a1326659dd27949c6a1c66c7cd66a1 | [
"Apache-2.0"
] | null | null | null | #
# Autogenerated by Thrift Compiler (0.13.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive import fix_spec
import sys
import logging
from .ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
all_structs = []
class Iface(object):
def AddPlaylist(self, newPlaylist, idConsumer):
"""
Register a Playlist
@param newPlaylist
@return bool
True or False
Parameters:
- newPlaylist
- idConsumer
"""
pass
def GetPlaylistByTitle(self, title):
"""
Get Playlist by Title
@param title
The Playlist Title to be obtained
@return Playlist
Playlist object
Parameters:
- title
"""
pass
def GetPlaylistByLibraryId(self, idLibrary):
"""
Get Playlist by idLibrary
@param idLibrary
The Library Id to be obtained
@return Playlist list
list<Playlist>
Parameters:
- idLibrary
"""
pass
def AddPlaylistToLibrary(self, idLibrary, idPlaylist):
"""
Add a Playlist to Library.
@param idLibrary
The Library Id to which a playlist will be added
@param newPlaylist
@return Playlist
Playlist object added
Parameters:
- idLibrary
- idPlaylist
"""
pass
def DeleteLibraryPlaylist(self, idLibrary, idPlaylist):
"""
Delete a Playlist from a Library
@param idLibrary
The Library Id which a playlist will be deleted.
@param idPlaylist
The Playlist Id which will be deleted
@return Id
The Playlist Id of the Playlist deleted.
Parameters:
- idLibrary
- idPlaylist
"""
pass
def UpdatePlaylistTitle(self, idPlaylist, newPlaylistTitle):
"""
Update previously registered Playlist title.
@param playlistId
The Playlist Id of the Playlist which require an update title.
@return Playlist
Modified Playlist obejct.
Parameters:
- idPlaylist
- newPlaylistTitle
"""
pass
def UpdatePlaylistCover(self, idPlaylist, newImageStoragePath):
"""
Update previously registered Playlist cover.
@param playlistId
The Playlist Id of the Playlist which require an update cover.
@return Playlist
Modified Playlist obejct.
Parameters:
- idPlaylist
- newImageStoragePath
"""
pass
def UpdatePlaylistDescription(self, idPlaylist, newDescription):
"""
Update previously registered Playlist description.
@param playlistId
The Playlist Id of the Playlist which require an update description.
@return Playlist
Modified Playlist obejct.
Parameters:
- idPlaylist
- newDescription
"""
pass
def GetPlaylistByQuery(self, query):
"""
Get Playlist by Query
@param query
The query to be obtained
@return Playlist
list<Playlist>
Parameters:
- query
"""
pass
def AddImageToMedia(self, fileName, image):
"""
Add image file binary
@param binary image
The binary number that will be keep.
@return bool
true or false.
Parameters:
- fileName
- image
"""
pass
def GetImageToMedia(self, fileName):
"""
Get image file binary
@param binary image
The binary number that will be keep.
@return binary
binary image.
Parameters:
- fileName
"""
pass
class Client(Iface):
def __init__(self, iprot, oprot=None):
self._iprot = self._oprot = iprot
if oprot is not None:
self._oprot = oprot
self._seqid = 0
def AddPlaylist(self, newPlaylist, idConsumer):
"""
Register a Playlist
@param newPlaylist
@return bool
True or False
Parameters:
- newPlaylist
- idConsumer
"""
self.send_AddPlaylist(newPlaylist, idConsumer)
return self.recv_AddPlaylist()
def send_AddPlaylist(self, newPlaylist, idConsumer):
self._oprot.writeMessageBegin('AddPlaylist', TMessageType.CALL, self._seqid)
args = AddPlaylist_args()
args.newPlaylist = newPlaylist
args.idConsumer = idConsumer
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_AddPlaylist(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = AddPlaylist_result()
result.read(iprot)
iprot.readMessageEnd()
if result.success is not None:
return result.success
if result.sErrorSystemE is not None:
raise result.sErrorSystemE
raise TApplicationException(TApplicationException.MISSING_RESULT, "AddPlaylist failed: unknown result")
def GetPlaylistByTitle(self, title):
"""
Get Playlist by Title
@param title
The Playlist Title to be obtained
@return Playlist
Playlist object
Parameters:
- title
"""
self.send_GetPlaylistByTitle(title)
return self.recv_GetPlaylistByTitle()
def send_GetPlaylistByTitle(self, title):
self._oprot.writeMessageBegin('GetPlaylistByTitle', TMessageType.CALL, self._seqid)
args = GetPlaylistByTitle_args()
args.title = title
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_GetPlaylistByTitle(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = GetPlaylistByTitle_result()
result.read(iprot)
iprot.readMessageEnd()
if result.success is not None:
return result.success
if result.sErrorNotFoundE is not None:
raise result.sErrorNotFoundE
if result.sErrorSystem is not None:
raise result.sErrorSystem
if result.sErrorInvalidRequestE is not None:
raise result.sErrorInvalidRequestE
raise TApplicationException(TApplicationException.MISSING_RESULT, "GetPlaylistByTitle failed: unknown result")
def GetPlaylistByLibraryId(self, idLibrary):
"""
Get Playlist by idLibrary
@param idLibrary
The Library Id to be obtained
@return Playlist list
list<Playlist>
Parameters:
- idLibrary
"""
self.send_GetPlaylistByLibraryId(idLibrary)
return self.recv_GetPlaylistByLibraryId()
def send_GetPlaylistByLibraryId(self, idLibrary):
self._oprot.writeMessageBegin('GetPlaylistByLibraryId', TMessageType.CALL, self._seqid)
args = GetPlaylistByLibraryId_args()
args.idLibrary = idLibrary
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_GetPlaylistByLibraryId(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = GetPlaylistByLibraryId_result()
result.read(iprot)
iprot.readMessageEnd()
if result.success is not None:
return result.success
if result.sErrorNotFoundE is not None:
raise result.sErrorNotFoundE
if result.sErrorSystem is not None:
raise result.sErrorSystem
if result.sErrorInvalidRequestE is not None:
raise result.sErrorInvalidRequestE
raise TApplicationException(TApplicationException.MISSING_RESULT, "GetPlaylistByLibraryId failed: unknown result")
def AddPlaylistToLibrary(self, idLibrary, idPlaylist):
"""
Add a Playlist to Library.
@param idLibrary
The Library Id to which a playlist will be added
@param newPlaylist
@return Playlist
Playlist object added
Parameters:
- idLibrary
- idPlaylist
"""
self.send_AddPlaylistToLibrary(idLibrary, idPlaylist)
return self.recv_AddPlaylistToLibrary()
def send_AddPlaylistToLibrary(self, idLibrary, idPlaylist):
self._oprot.writeMessageBegin('AddPlaylistToLibrary', TMessageType.CALL, self._seqid)
args = AddPlaylistToLibrary_args()
args.idLibrary = idLibrary
args.idPlaylist = idPlaylist
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_AddPlaylistToLibrary(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = AddPlaylistToLibrary_result()
result.read(iprot)
iprot.readMessageEnd()
if result.success is not None:
return result.success
if result.sErrorSystemE is not None:
raise result.sErrorSystemE
raise TApplicationException(TApplicationException.MISSING_RESULT, "AddPlaylistToLibrary failed: unknown result")
def DeleteLibraryPlaylist(self, idLibrary, idPlaylist):
"""
Delete a Playlist from a Library
@param idLibrary
The Library Id which a playlist will be deleted.
@param idPlaylist
The Playlist Id which will be deleted
@return Id
The Playlist Id of the Playlist deleted.
Parameters:
- idLibrary
- idPlaylist
"""
self.send_DeleteLibraryPlaylist(idLibrary, idPlaylist)
return self.recv_DeleteLibraryPlaylist()
def send_DeleteLibraryPlaylist(self, idLibrary, idPlaylist):
self._oprot.writeMessageBegin('DeleteLibraryPlaylist', TMessageType.CALL, self._seqid)
args = DeleteLibraryPlaylist_args()
args.idLibrary = idLibrary
args.idPlaylist = idPlaylist
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_DeleteLibraryPlaylist(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = DeleteLibraryPlaylist_result()
result.read(iprot)
iprot.readMessageEnd()
if result.success is not None:
return result.success
if result.sErrorNotFoundE is not None:
raise result.sErrorNotFoundE
if result.sErrorSystemE is not None:
raise result.sErrorSystemE
raise TApplicationException(TApplicationException.MISSING_RESULT, "DeleteLibraryPlaylist failed: unknown result")
def UpdatePlaylistTitle(self, idPlaylist, newPlaylistTitle):
"""
Update previously registered Playlist title.
@param playlistId
The Playlist Id of the Playlist which require an update title.
@return Playlist
Modified Playlist obejct.
Parameters:
- idPlaylist
- newPlaylistTitle
"""
self.send_UpdatePlaylistTitle(idPlaylist, newPlaylistTitle)
return self.recv_UpdatePlaylistTitle()
def send_UpdatePlaylistTitle(self, idPlaylist, newPlaylistTitle):
self._oprot.writeMessageBegin('UpdatePlaylistTitle', TMessageType.CALL, self._seqid)
args = UpdatePlaylistTitle_args()
args.idPlaylist = idPlaylist
args.newPlaylistTitle = newPlaylistTitle
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_UpdatePlaylistTitle(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = UpdatePlaylistTitle_result()
result.read(iprot)
iprot.readMessageEnd()
if result.success is not None:
return result.success
if result.sErrorNotFoundE is not None:
raise result.sErrorNotFoundE
if result.sErrorSystemE is not None:
raise result.sErrorSystemE
raise TApplicationException(TApplicationException.MISSING_RESULT, "UpdatePlaylistTitle failed: unknown result")
def UpdatePlaylistCover(self, idPlaylist, newImageStoragePath):
"""
Update previously registered Playlist cover.
@param playlistId
The Playlist Id of the Playlist which require an update cover.
@return Playlist
Modified Playlist obejct.
Parameters:
- idPlaylist
- newImageStoragePath
"""
self.send_UpdatePlaylistCover(idPlaylist, newImageStoragePath)
return self.recv_UpdatePlaylistCover()
def send_UpdatePlaylistCover(self, idPlaylist, newImageStoragePath):
self._oprot.writeMessageBegin('UpdatePlaylistCover', TMessageType.CALL, self._seqid)
args = UpdatePlaylistCover_args()
args.idPlaylist = idPlaylist
args.newImageStoragePath = newImageStoragePath
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_UpdatePlaylistCover(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = UpdatePlaylistCover_result()
result.read(iprot)
iprot.readMessageEnd()
if result.success is not None:
return result.success
if result.sErrorNotFoundE is not None:
raise result.sErrorNotFoundE
if result.sErrorSystemE is not None:
raise result.sErrorSystemE
raise TApplicationException(TApplicationException.MISSING_RESULT, "UpdatePlaylistCover failed: unknown result")
def UpdatePlaylistDescription(self, idPlaylist, newDescription):
"""
Update previously registered Playlist description.
@param playlistId
The Playlist Id of the Playlist which require an update description.
@return Playlist
Modified Playlist obejct.
Parameters:
- idPlaylist
- newDescription
"""
self.send_UpdatePlaylistDescription(idPlaylist, newDescription)
return self.recv_UpdatePlaylistDescription()
def send_UpdatePlaylistDescription(self, idPlaylist, newDescription):
self._oprot.writeMessageBegin('UpdatePlaylistDescription', TMessageType.CALL, self._seqid)
args = UpdatePlaylistDescription_args()
args.idPlaylist = idPlaylist
args.newDescription = newDescription
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_UpdatePlaylistDescription(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = UpdatePlaylistDescription_result()
result.read(iprot)
iprot.readMessageEnd()
if result.success is not None:
return result.success
if result.sErrorNotFoundE is not None:
raise result.sErrorNotFoundE
if result.sErrorSystemE is not None:
raise result.sErrorSystemE
raise TApplicationException(TApplicationException.MISSING_RESULT, "UpdatePlaylistDescription failed: unknown result")
def GetPlaylistByQuery(self, query):
"""
Get Playlist by Query
@param query
The query to be obtained
@return Playlist
list<Playlist>
Parameters:
- query
"""
self.send_GetPlaylistByQuery(query)
return self.recv_GetPlaylistByQuery()
def send_GetPlaylistByQuery(self, query):
self._oprot.writeMessageBegin('GetPlaylistByQuery', TMessageType.CALL, self._seqid)
args = GetPlaylistByQuery_args()
args.query = query
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_GetPlaylistByQuery(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = GetPlaylistByQuery_result()
result.read(iprot)
iprot.readMessageEnd()
if result.success is not None:
return result.success
if result.sErrorNotFoundE is not None:
raise result.sErrorNotFoundE
if result.sErrorSystemE is not None:
raise result.sErrorSystemE
raise TApplicationException(TApplicationException.MISSING_RESULT, "GetPlaylistByQuery failed: unknown result")
def AddImageToMedia(self, fileName, image):
"""
Add image file binary
@param binary image
The binary number that will be keep.
@return bool
true or false.
Parameters:
- fileName
- image
"""
self.send_AddImageToMedia(fileName, image)
return self.recv_AddImageToMedia()
def send_AddImageToMedia(self, fileName, image):
self._oprot.writeMessageBegin('AddImageToMedia', TMessageType.CALL, self._seqid)
args = AddImageToMedia_args()
args.fileName = fileName
args.image = image
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_AddImageToMedia(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = AddImageToMedia_result()
result.read(iprot)
iprot.readMessageEnd()
if result.success is not None:
return result.success
if result.sErrorSystemE is not None:
raise result.sErrorSystemE
raise TApplicationException(TApplicationException.MISSING_RESULT, "AddImageToMedia failed: unknown result")
def GetImageToMedia(self, fileName):
"""
Get image file binary
@param binary image
The binary number that will be keep.
@return binary
binary image.
Parameters:
- fileName
"""
self.send_GetImageToMedia(fileName)
return self.recv_GetImageToMedia()
def send_GetImageToMedia(self, fileName):
self._oprot.writeMessageBegin('GetImageToMedia', TMessageType.CALL, self._seqid)
args = GetImageToMedia_args()
args.fileName = fileName
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_GetImageToMedia(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = GetImageToMedia_result()
result.read(iprot)
iprot.readMessageEnd()
if result.success is not None:
return result.success
if result.sErrorSystemE is not None:
raise result.sErrorSystemE
raise TApplicationException(TApplicationException.MISSING_RESULT, "GetImageToMedia failed: unknown result")
class Processor(Iface, TProcessor):
def __init__(self, handler):
self._handler = handler
self._processMap = {}
self._processMap["AddPlaylist"] = Processor.process_AddPlaylist
self._processMap["GetPlaylistByTitle"] = Processor.process_GetPlaylistByTitle
self._processMap["GetPlaylistByLibraryId"] = Processor.process_GetPlaylistByLibraryId
self._processMap["AddPlaylistToLibrary"] = Processor.process_AddPlaylistToLibrary
self._processMap["DeleteLibraryPlaylist"] = Processor.process_DeleteLibraryPlaylist
self._processMap["UpdatePlaylistTitle"] = Processor.process_UpdatePlaylistTitle
self._processMap["UpdatePlaylistCover"] = Processor.process_UpdatePlaylistCover
self._processMap["UpdatePlaylistDescription"] = Processor.process_UpdatePlaylistDescription
self._processMap["GetPlaylistByQuery"] = Processor.process_GetPlaylistByQuery
self._processMap["AddImageToMedia"] = Processor.process_AddImageToMedia
self._processMap["GetImageToMedia"] = Processor.process_GetImageToMedia
self._on_message_begin = None
def on_message_begin(self, func):
self._on_message_begin = func
def process(self, iprot, oprot):
(name, type, seqid) = iprot.readMessageBegin()
if self._on_message_begin:
self._on_message_begin(name, type, seqid)
if name not in self._processMap:
iprot.skip(TType.STRUCT)
iprot.readMessageEnd()
x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
x.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
return
else:
self._processMap[name](self, seqid, iprot, oprot)
return True
def process_AddPlaylist(self, seqid, iprot, oprot):
args = AddPlaylist_args()
args.read(iprot)
iprot.readMessageEnd()
result = AddPlaylist_result()
try:
result.success = self._handler.AddPlaylist(args.newPlaylist, args.idConsumer)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except SpotifakeManagement.ttypes.SErrorSystemException as sErrorSystemE:
msg_type = TMessageType.REPLY
result.sErrorSystemE = sErrorSystemE
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("AddPlaylist", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_GetPlaylistByTitle(self, seqid, iprot, oprot):
args = GetPlaylistByTitle_args()
args.read(iprot)
iprot.readMessageEnd()
result = GetPlaylistByTitle_result()
try:
result.success = self._handler.GetPlaylistByTitle(args.title)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except SpotifakeManagement.ttypes.SErrorNotFoundException as sErrorNotFoundE:
msg_type = TMessageType.REPLY
result.sErrorNotFoundE = sErrorNotFoundE
except SpotifakeManagement.ttypes.SErrorSystemException as sErrorSystem:
msg_type = TMessageType.REPLY
result.sErrorSystem = sErrorSystem
except SpotifakeManagement.ttypes.SErrorInvalidRequestException as sErrorInvalidRequestE:
msg_type = TMessageType.REPLY
result.sErrorInvalidRequestE = sErrorInvalidRequestE
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("GetPlaylistByTitle", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_GetPlaylistByLibraryId(self, seqid, iprot, oprot):
args = GetPlaylistByLibraryId_args()
args.read(iprot)
iprot.readMessageEnd()
result = GetPlaylistByLibraryId_result()
try:
result.success = self._handler.GetPlaylistByLibraryId(args.idLibrary)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except SpotifakeManagement.ttypes.SErrorNotFoundException as sErrorNotFoundE:
msg_type = TMessageType.REPLY
result.sErrorNotFoundE = sErrorNotFoundE
except SpotifakeManagement.ttypes.SErrorSystemException as sErrorSystem:
msg_type = TMessageType.REPLY
result.sErrorSystem = sErrorSystem
except SpotifakeManagement.ttypes.SErrorInvalidRequestException as sErrorInvalidRequestE:
msg_type = TMessageType.REPLY
result.sErrorInvalidRequestE = sErrorInvalidRequestE
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("GetPlaylistByLibraryId", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_AddPlaylistToLibrary(self, seqid, iprot, oprot):
args = AddPlaylistToLibrary_args()
args.read(iprot)
iprot.readMessageEnd()
result = AddPlaylistToLibrary_result()
try:
result.success = self._handler.AddPlaylistToLibrary(args.idLibrary, args.idPlaylist)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except SpotifakeManagement.ttypes.SErrorSystemException as sErrorSystemE:
msg_type = TMessageType.REPLY
result.sErrorSystemE = sErrorSystemE
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("AddPlaylistToLibrary", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_DeleteLibraryPlaylist(self, seqid, iprot, oprot):
args = DeleteLibraryPlaylist_args()
args.read(iprot)
iprot.readMessageEnd()
result = DeleteLibraryPlaylist_result()
try:
result.success = self._handler.DeleteLibraryPlaylist(args.idLibrary, args.idPlaylist)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except SpotifakeManagement.ttypes.SErrorNotFoundException as sErrorNotFoundE:
msg_type = TMessageType.REPLY
result.sErrorNotFoundE = sErrorNotFoundE
except SpotifakeManagement.ttypes.SErrorSystemException as sErrorSystemE:
msg_type = TMessageType.REPLY
result.sErrorSystemE = sErrorSystemE
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("DeleteLibraryPlaylist", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_UpdatePlaylistTitle(self, seqid, iprot, oprot):
args = UpdatePlaylistTitle_args()
args.read(iprot)
iprot.readMessageEnd()
result = UpdatePlaylistTitle_result()
try:
result.success = self._handler.UpdatePlaylistTitle(args.idPlaylist, args.newPlaylistTitle)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except SpotifakeManagement.ttypes.SErrorNotFoundException as sErrorNotFoundE:
msg_type = TMessageType.REPLY
result.sErrorNotFoundE = sErrorNotFoundE
except SpotifakeManagement.ttypes.SErrorSystemException as sErrorSystemE:
msg_type = TMessageType.REPLY
result.sErrorSystemE = sErrorSystemE
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("UpdatePlaylistTitle", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_UpdatePlaylistCover(self, seqid, iprot, oprot):
args = UpdatePlaylistCover_args()
args.read(iprot)
iprot.readMessageEnd()
result = UpdatePlaylistCover_result()
try:
result.success = self._handler.UpdatePlaylistCover(args.idPlaylist, args.newImageStoragePath)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except SpotifakeManagement.ttypes.SErrorNotFoundException as sErrorNotFoundE:
msg_type = TMessageType.REPLY
result.sErrorNotFoundE = sErrorNotFoundE
except SpotifakeManagement.ttypes.SErrorSystemException as sErrorSystemE:
msg_type = TMessageType.REPLY
result.sErrorSystemE = sErrorSystemE
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("UpdatePlaylistCover", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_UpdatePlaylistDescription(self, seqid, iprot, oprot):
args = UpdatePlaylistDescription_args()
args.read(iprot)
iprot.readMessageEnd()
result = UpdatePlaylistDescription_result()
try:
result.success = self._handler.UpdatePlaylistDescription(args.idPlaylist, args.newDescription)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except SpotifakeManagement.ttypes.SErrorNotFoundException as sErrorNotFoundE:
msg_type = TMessageType.REPLY
result.sErrorNotFoundE = sErrorNotFoundE
except SpotifakeManagement.ttypes.SErrorSystemException as sErrorSystemE:
msg_type = TMessageType.REPLY
result.sErrorSystemE = sErrorSystemE
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("UpdatePlaylistDescription", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_GetPlaylistByQuery(self, seqid, iprot, oprot):
args = GetPlaylistByQuery_args()
args.read(iprot)
iprot.readMessageEnd()
result = GetPlaylistByQuery_result()
try:
result.success = self._handler.GetPlaylistByQuery(args.query)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except SpotifakeManagement.ttypes.SErrorNotFoundException as sErrorNotFoundE:
msg_type = TMessageType.REPLY
result.sErrorNotFoundE = sErrorNotFoundE
except SpotifakeManagement.ttypes.SErrorSystemException as sErrorSystemE:
msg_type = TMessageType.REPLY
result.sErrorSystemE = sErrorSystemE
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("GetPlaylistByQuery", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_AddImageToMedia(self, seqid, iprot, oprot):
args = AddImageToMedia_args()
args.read(iprot)
iprot.readMessageEnd()
result = AddImageToMedia_result()
try:
result.success = self._handler.AddImageToMedia(args.fileName, args.image)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except SpotifakeManagement.ttypes.SErrorSystemException as sErrorSystemE:
msg_type = TMessageType.REPLY
result.sErrorSystemE = sErrorSystemE
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("AddImageToMedia", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_GetImageToMedia(self, seqid, iprot, oprot):
args = GetImageToMedia_args()
args.read(iprot)
iprot.readMessageEnd()
result = GetImageToMedia_result()
try:
result.success = self._handler.GetImageToMedia(args.fileName)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except SpotifakeManagement.ttypes.SErrorSystemException as sErrorSystemE:
msg_type = TMessageType.REPLY
result.sErrorSystemE = sErrorSystemE
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("GetImageToMedia", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
# HELPER FUNCTIONS AND STRUCTURES
class AddPlaylist_args(object):
"""
Attributes:
- newPlaylist
- idConsumer
"""
def __init__(self, newPlaylist=None, idConsumer=None,):
self.newPlaylist = newPlaylist
self.idConsumer = idConsumer
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.newPlaylist = SpotifakeManagement.ttypes.Playlist()
self.newPlaylist.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I16:
self.idConsumer = iprot.readI16()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('AddPlaylist_args')
if self.newPlaylist is not None:
oprot.writeFieldBegin('newPlaylist', TType.STRUCT, 1)
self.newPlaylist.write(oprot)
oprot.writeFieldEnd()
if self.idConsumer is not None:
oprot.writeFieldBegin('idConsumer', TType.I16, 2)
oprot.writeI16(self.idConsumer)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(AddPlaylist_args)
AddPlaylist_args.thrift_spec = (
None, # 0
(1, TType.STRUCT, 'newPlaylist', [SpotifakeManagement.ttypes.Playlist, None], None, ), # 1
(2, TType.I16, 'idConsumer', None, None, ), # 2
)
class AddPlaylist_result(object):
"""
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 0:
if ftype == TType.I16:
self.success = iprot.readI16()
else:
iprot.skip(ftype)
elif fid == 1:
if ftype == TType.STRUCT:
self.sErrorSystemE = SpotifakeManagement.ttypes.SErrorSystemException()
self.sErrorSystemE.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('AddPlaylist_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.I16, 0)
oprot.writeI16(self.success)
oprot.writeFieldEnd()
if self.sErrorSystemE is not None:
oprot.writeFieldBegin('sErrorSystemE', TType.STRUCT, 1)
self.sErrorSystemE.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(AddPlaylist_result)
AddPlaylist_result.thrift_spec = (
(0, TType.I16, 'success', None, None, ), # 0
(1, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErrorSystemException, None], None, ), # 1
)
class GetPlaylistByTitle_args(object):
"""
Attributes:
- title
"""
def __init__(self, title=None,):
self.title = title
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.title = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('GetPlaylistByTitle_args')
if self.title is not None:
oprot.writeFieldBegin('title', TType.STRING, 1)
oprot.writeString(self.title.encode('utf-8') if sys.version_info[0] == 2 else self.title)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(GetPlaylistByTitle_args)
GetPlaylistByTitle_args.thrift_spec = (
None, # 0
(1, TType.STRING, 'title', 'UTF8', None, ), # 1
)
class GetPlaylistByTitle_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystem
- sErrorInvalidRequestE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystem=None, sErrorInvalidRequestE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystem = sErrorSystem
self.sErrorInvalidRequestE = sErrorInvalidRequestE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 0:
if ftype == TType.STRUCT:
self.success = SpotifakeManagement.ttypes.Playlist()
self.success.read(iprot)
else:
iprot.skip(ftype)
elif fid == 1:
if ftype == TType.STRUCT:
self.sErrorNotFoundE = SpotifakeManagement.ttypes.SErrorNotFoundException()
self.sErrorNotFoundE.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.sErrorSystem = SpotifakeManagement.ttypes.SErrorSystemException()
self.sErrorSystem.read(iprot)
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRUCT:
self.sErrorInvalidRequestE = SpotifakeManagement.ttypes.SErrorInvalidRequestException()
self.sErrorInvalidRequestE.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('GetPlaylistByTitle_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.STRUCT, 0)
self.success.write(oprot)
oprot.writeFieldEnd()
if self.sErrorNotFoundE is not None:
oprot.writeFieldBegin('sErrorNotFoundE', TType.STRUCT, 1)
self.sErrorNotFoundE.write(oprot)
oprot.writeFieldEnd()
if self.sErrorSystem is not None:
oprot.writeFieldBegin('sErrorSystem', TType.STRUCT, 2)
self.sErrorSystem.write(oprot)
oprot.writeFieldEnd()
if self.sErrorInvalidRequestE is not None:
oprot.writeFieldBegin('sErrorInvalidRequestE', TType.STRUCT, 3)
self.sErrorInvalidRequestE.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(GetPlaylistByTitle_result)
GetPlaylistByTitle_result.thrift_spec = (
(0, TType.STRUCT, 'success', [SpotifakeManagement.ttypes.Playlist, None], None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystem', [SpotifakeManagement.ttypes.SErrorSystemException, None], None, ), # 2
(3, TType.STRUCT, 'sErrorInvalidRequestE', [SpotifakeManagement.ttypes.SErrorInvalidRequestException, None], None, ), # 3
)
class GetPlaylistByLibraryId_args(object):
"""
Attributes:
- idLibrary
"""
def __init__(self, idLibrary=None,):
self.idLibrary = idLibrary
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I16:
self.idLibrary = iprot.readI16()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('GetPlaylistByLibraryId_args')
if self.idLibrary is not None:
oprot.writeFieldBegin('idLibrary', TType.I16, 1)
oprot.writeI16(self.idLibrary)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(GetPlaylistByLibraryId_args)
GetPlaylistByLibraryId_args.thrift_spec = (
None, # 0
(1, TType.I16, 'idLibrary', None, None, ), # 1
)
class GetPlaylistByLibraryId_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystem
- sErrorInvalidRequestE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystem=None, sErrorInvalidRequestE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystem = sErrorSystem
self.sErrorInvalidRequestE = sErrorInvalidRequestE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 0:
if ftype == TType.LIST:
self.success = []
(_etype94, _size91) = iprot.readListBegin()
for _i95 in range(_size91):
_elem96 = SpotifakeManagement.ttypes.Playlist()
_elem96.read(iprot)
self.success.append(_elem96)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 1:
if ftype == TType.STRUCT:
self.sErrorNotFoundE = SpotifakeManagement.ttypes.SErrorNotFoundException()
self.sErrorNotFoundE.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.sErrorSystem = SpotifakeManagement.ttypes.SErrorSystemException()
self.sErrorSystem.read(iprot)
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRUCT:
self.sErrorInvalidRequestE = SpotifakeManagement.ttypes.SErrorInvalidRequestException()
self.sErrorInvalidRequestE.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('GetPlaylistByLibraryId_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRUCT, len(self.success))
for iter97 in self.success:
iter97.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.sErrorNotFoundE is not None:
oprot.writeFieldBegin('sErrorNotFoundE', TType.STRUCT, 1)
self.sErrorNotFoundE.write(oprot)
oprot.writeFieldEnd()
if self.sErrorSystem is not None:
oprot.writeFieldBegin('sErrorSystem', TType.STRUCT, 2)
self.sErrorSystem.write(oprot)
oprot.writeFieldEnd()
if self.sErrorInvalidRequestE is not None:
oprot.writeFieldBegin('sErrorInvalidRequestE', TType.STRUCT, 3)
self.sErrorInvalidRequestE.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(GetPlaylistByLibraryId_result)
GetPlaylistByLibraryId_result.thrift_spec = (
(0, TType.LIST, 'success', (TType.STRUCT, [SpotifakeManagement.ttypes.Playlist, None], False), None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystem', [SpotifakeManagement.ttypes.SErrorSystemException, None], None, ), # 2
(3, TType.STRUCT, 'sErrorInvalidRequestE', [SpotifakeManagement.ttypes.SErrorInvalidRequestException, None], None, ), # 3
)
class AddPlaylistToLibrary_args(object):
"""
Attributes:
- idLibrary
- idPlaylist
"""
def __init__(self, idLibrary=None, idPlaylist=None,):
self.idLibrary = idLibrary
self.idPlaylist = idPlaylist
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I16:
self.idLibrary = iprot.readI16()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I16:
self.idPlaylist = iprot.readI16()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('AddPlaylistToLibrary_args')
if self.idLibrary is not None:
oprot.writeFieldBegin('idLibrary', TType.I16, 1)
oprot.writeI16(self.idLibrary)
oprot.writeFieldEnd()
if self.idPlaylist is not None:
oprot.writeFieldBegin('idPlaylist', TType.I16, 2)
oprot.writeI16(self.idPlaylist)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(AddPlaylistToLibrary_args)
AddPlaylistToLibrary_args.thrift_spec = (
None, # 0
(1, TType.I16, 'idLibrary', None, None, ), # 1
(2, TType.I16, 'idPlaylist', None, None, ), # 2
)
class AddPlaylistToLibrary_result(object):
"""
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 0:
if ftype == TType.BOOL:
self.success = iprot.readBool()
else:
iprot.skip(ftype)
elif fid == 1:
if ftype == TType.STRUCT:
self.sErrorSystemE = SpotifakeManagement.ttypes.SErrorSystemException()
self.sErrorSystemE.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('AddPlaylistToLibrary_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.BOOL, 0)
oprot.writeBool(self.success)
oprot.writeFieldEnd()
if self.sErrorSystemE is not None:
oprot.writeFieldBegin('sErrorSystemE', TType.STRUCT, 1)
self.sErrorSystemE.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(AddPlaylistToLibrary_result)
AddPlaylistToLibrary_result.thrift_spec = (
(0, TType.BOOL, 'success', None, None, ), # 0
(1, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErrorSystemException, None], None, ), # 1
)
class DeleteLibraryPlaylist_args(object):
"""
Attributes:
- idLibrary
- idPlaylist
"""
def __init__(self, idLibrary=None, idPlaylist=None,):
self.idLibrary = idLibrary
self.idPlaylist = idPlaylist
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I16:
self.idLibrary = iprot.readI16()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I16:
self.idPlaylist = iprot.readI16()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('DeleteLibraryPlaylist_args')
if self.idLibrary is not None:
oprot.writeFieldBegin('idLibrary', TType.I16, 1)
oprot.writeI16(self.idLibrary)
oprot.writeFieldEnd()
if self.idPlaylist is not None:
oprot.writeFieldBegin('idPlaylist', TType.I16, 2)
oprot.writeI16(self.idPlaylist)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(DeleteLibraryPlaylist_args)
DeleteLibraryPlaylist_args.thrift_spec = (
None, # 0
(1, TType.I16, 'idLibrary', None, None, ), # 1
(2, TType.I16, 'idPlaylist', None, None, ), # 2
)
class DeleteLibraryPlaylist_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 0:
if ftype == TType.I16:
self.success = iprot.readI16()
else:
iprot.skip(ftype)
elif fid == 1:
if ftype == TType.STRUCT:
self.sErrorNotFoundE = SpotifakeManagement.ttypes.SErrorNotFoundException()
self.sErrorNotFoundE.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.sErrorSystemE = SpotifakeManagement.ttypes.SErrorSystemException()
self.sErrorSystemE.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('DeleteLibraryPlaylist_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.I16, 0)
oprot.writeI16(self.success)
oprot.writeFieldEnd()
if self.sErrorNotFoundE is not None:
oprot.writeFieldBegin('sErrorNotFoundE', TType.STRUCT, 1)
self.sErrorNotFoundE.write(oprot)
oprot.writeFieldEnd()
if self.sErrorSystemE is not None:
oprot.writeFieldBegin('sErrorSystemE', TType.STRUCT, 2)
self.sErrorSystemE.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(DeleteLibraryPlaylist_result)
DeleteLibraryPlaylist_result.thrift_spec = (
(0, TType.I16, 'success', None, None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErrorSystemException, None], None, ), # 2
)
class UpdatePlaylistTitle_args(object):
"""
Attributes:
- idPlaylist
- newPlaylistTitle
"""
def __init__(self, idPlaylist=None, newPlaylistTitle=None,):
self.idPlaylist = idPlaylist
self.newPlaylistTitle = newPlaylistTitle
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I16:
self.idPlaylist = iprot.readI16()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.newPlaylistTitle = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('UpdatePlaylistTitle_args')
if self.idPlaylist is not None:
oprot.writeFieldBegin('idPlaylist', TType.I16, 1)
oprot.writeI16(self.idPlaylist)
oprot.writeFieldEnd()
if self.newPlaylistTitle is not None:
oprot.writeFieldBegin('newPlaylistTitle', TType.STRING, 2)
oprot.writeString(self.newPlaylistTitle.encode('utf-8') if sys.version_info[0] == 2 else self.newPlaylistTitle)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(UpdatePlaylistTitle_args)
UpdatePlaylistTitle_args.thrift_spec = (
None, # 0
(1, TType.I16, 'idPlaylist', None, None, ), # 1
(2, TType.STRING, 'newPlaylistTitle', 'UTF8', None, ), # 2
)
class UpdatePlaylistTitle_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 0:
if ftype == TType.STRUCT:
self.success = SpotifakeManagement.ttypes.Playlist()
self.success.read(iprot)
else:
iprot.skip(ftype)
elif fid == 1:
if ftype == TType.STRUCT:
self.sErrorNotFoundE = SpotifakeManagement.ttypes.SErrorNotFoundException()
self.sErrorNotFoundE.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.sErrorSystemE = SpotifakeManagement.ttypes.SErrorSystemException()
self.sErrorSystemE.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('UpdatePlaylistTitle_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.STRUCT, 0)
self.success.write(oprot)
oprot.writeFieldEnd()
if self.sErrorNotFoundE is not None:
oprot.writeFieldBegin('sErrorNotFoundE', TType.STRUCT, 1)
self.sErrorNotFoundE.write(oprot)
oprot.writeFieldEnd()
if self.sErrorSystemE is not None:
oprot.writeFieldBegin('sErrorSystemE', TType.STRUCT, 2)
self.sErrorSystemE.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(UpdatePlaylistTitle_result)
UpdatePlaylistTitle_result.thrift_spec = (
(0, TType.STRUCT, 'success', [SpotifakeManagement.ttypes.Playlist, None], None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErrorSystemException, None], None, ), # 2
)
class UpdatePlaylistCover_args(object):
"""
Attributes:
- idPlaylist
- newImageStoragePath
"""
def __init__(self, idPlaylist=None, newImageStoragePath=None,):
self.idPlaylist = idPlaylist
self.newImageStoragePath = newImageStoragePath
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I16:
self.idPlaylist = iprot.readI16()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.newImageStoragePath = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('UpdatePlaylistCover_args')
if self.idPlaylist is not None:
oprot.writeFieldBegin('idPlaylist', TType.I16, 1)
oprot.writeI16(self.idPlaylist)
oprot.writeFieldEnd()
if self.newImageStoragePath is not None:
oprot.writeFieldBegin('newImageStoragePath', TType.STRING, 2)
oprot.writeString(self.newImageStoragePath.encode('utf-8') if sys.version_info[0] == 2 else self.newImageStoragePath)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(UpdatePlaylistCover_args)
UpdatePlaylistCover_args.thrift_spec = (
None, # 0
(1, TType.I16, 'idPlaylist', None, None, ), # 1
(2, TType.STRING, 'newImageStoragePath', 'UTF8', None, ), # 2
)
class UpdatePlaylistCover_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 0:
if ftype == TType.STRUCT:
self.success = SpotifakeManagement.ttypes.Playlist()
self.success.read(iprot)
else:
iprot.skip(ftype)
elif fid == 1:
if ftype == TType.STRUCT:
self.sErrorNotFoundE = SpotifakeManagement.ttypes.SErrorNotFoundException()
self.sErrorNotFoundE.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.sErrorSystemE = SpotifakeManagement.ttypes.SErrorSystemException()
self.sErrorSystemE.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('UpdatePlaylistCover_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.STRUCT, 0)
self.success.write(oprot)
oprot.writeFieldEnd()
if self.sErrorNotFoundE is not None:
oprot.writeFieldBegin('sErrorNotFoundE', TType.STRUCT, 1)
self.sErrorNotFoundE.write(oprot)
oprot.writeFieldEnd()
if self.sErrorSystemE is not None:
oprot.writeFieldBegin('sErrorSystemE', TType.STRUCT, 2)
self.sErrorSystemE.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(UpdatePlaylistCover_result)
UpdatePlaylistCover_result.thrift_spec = (
(0, TType.STRUCT, 'success', [SpotifakeManagement.ttypes.Playlist, None], None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErrorSystemException, None], None, ), # 2
)
class UpdatePlaylistDescription_args(object):
"""
Attributes:
- idPlaylist
- newDescription
"""
def __init__(self, idPlaylist=None, newDescription=None,):
self.idPlaylist = idPlaylist
self.newDescription = newDescription
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I16:
self.idPlaylist = iprot.readI16()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.newDescription = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('UpdatePlaylistDescription_args')
if self.idPlaylist is not None:
oprot.writeFieldBegin('idPlaylist', TType.I16, 1)
oprot.writeI16(self.idPlaylist)
oprot.writeFieldEnd()
if self.newDescription is not None:
oprot.writeFieldBegin('newDescription', TType.STRING, 2)
oprot.writeString(self.newDescription.encode('utf-8') if sys.version_info[0] == 2 else self.newDescription)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(UpdatePlaylistDescription_args)
UpdatePlaylistDescription_args.thrift_spec = (
None, # 0
(1, TType.I16, 'idPlaylist', None, None, ), # 1
(2, TType.STRING, 'newDescription', 'UTF8', None, ), # 2
)
class UpdatePlaylistDescription_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 0:
if ftype == TType.STRUCT:
self.success = SpotifakeManagement.ttypes.Playlist()
self.success.read(iprot)
else:
iprot.skip(ftype)
elif fid == 1:
if ftype == TType.STRUCT:
self.sErrorNotFoundE = SpotifakeManagement.ttypes.SErrorNotFoundException()
self.sErrorNotFoundE.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.sErrorSystemE = SpotifakeManagement.ttypes.SErrorSystemException()
self.sErrorSystemE.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('UpdatePlaylistDescription_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.STRUCT, 0)
self.success.write(oprot)
oprot.writeFieldEnd()
if self.sErrorNotFoundE is not None:
oprot.writeFieldBegin('sErrorNotFoundE', TType.STRUCT, 1)
self.sErrorNotFoundE.write(oprot)
oprot.writeFieldEnd()
if self.sErrorSystemE is not None:
oprot.writeFieldBegin('sErrorSystemE', TType.STRUCT, 2)
self.sErrorSystemE.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(UpdatePlaylistDescription_result)
UpdatePlaylistDescription_result.thrift_spec = (
(0, TType.STRUCT, 'success', [SpotifakeManagement.ttypes.Playlist, None], None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErrorSystemException, None], None, ), # 2
)
class GetPlaylistByQuery_args(object):
"""
Attributes:
- query
"""
def __init__(self, query=None,):
self.query = query
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.query = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('GetPlaylistByQuery_args')
if self.query is not None:
oprot.writeFieldBegin('query', TType.STRING, 1)
oprot.writeString(self.query.encode('utf-8') if sys.version_info[0] == 2 else self.query)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(GetPlaylistByQuery_args)
GetPlaylistByQuery_args.thrift_spec = (
None, # 0
(1, TType.STRING, 'query', 'UTF8', None, ), # 1
)
class GetPlaylistByQuery_result(object):
"""
Attributes:
- success
- sErrorNotFoundE
- sErrorSystemE
"""
def __init__(self, success=None, sErrorNotFoundE=None, sErrorSystemE=None,):
self.success = success
self.sErrorNotFoundE = sErrorNotFoundE
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 0:
if ftype == TType.LIST:
self.success = []
(_etype101, _size98) = iprot.readListBegin()
for _i102 in range(_size98):
_elem103 = SpotifakeManagement.ttypes.Playlist()
_elem103.read(iprot)
self.success.append(_elem103)
iprot.readListEnd()
else:
iprot.skip(ftype)
elif fid == 1:
if ftype == TType.STRUCT:
self.sErrorNotFoundE = SpotifakeManagement.ttypes.SErrorNotFoundException()
self.sErrorNotFoundE.read(iprot)
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRUCT:
self.sErrorSystemE = SpotifakeManagement.ttypes.SErrorSystemException()
self.sErrorSystemE.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('GetPlaylistByQuery_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.LIST, 0)
oprot.writeListBegin(TType.STRUCT, len(self.success))
for iter104 in self.success:
iter104.write(oprot)
oprot.writeListEnd()
oprot.writeFieldEnd()
if self.sErrorNotFoundE is not None:
oprot.writeFieldBegin('sErrorNotFoundE', TType.STRUCT, 1)
self.sErrorNotFoundE.write(oprot)
oprot.writeFieldEnd()
if self.sErrorSystemE is not None:
oprot.writeFieldBegin('sErrorSystemE', TType.STRUCT, 2)
self.sErrorSystemE.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(GetPlaylistByQuery_result)
GetPlaylistByQuery_result.thrift_spec = (
(0, TType.LIST, 'success', (TType.STRUCT, [SpotifakeManagement.ttypes.Playlist, None], False), None, ), # 0
(1, TType.STRUCT, 'sErrorNotFoundE', [SpotifakeManagement.ttypes.SErrorNotFoundException, None], None, ), # 1
(2, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErrorSystemException, None], None, ), # 2
)
class AddImageToMedia_args(object):
"""
Attributes:
- fileName
- image
"""
def __init__(self, fileName=None, image=None,):
self.fileName = fileName
self.image = image
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.fileName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.image = iprot.readBinary()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('AddImageToMedia_args')
if self.fileName is not None:
oprot.writeFieldBegin('fileName', TType.STRING, 1)
oprot.writeString(self.fileName.encode('utf-8') if sys.version_info[0] == 2 else self.fileName)
oprot.writeFieldEnd()
if self.image is not None:
oprot.writeFieldBegin('image', TType.STRING, 2)
oprot.writeBinary(self.image)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(AddImageToMedia_args)
AddImageToMedia_args.thrift_spec = (
None, # 0
(1, TType.STRING, 'fileName', 'UTF8', None, ), # 1
(2, TType.STRING, 'image', 'BINARY', None, ), # 2
)
class AddImageToMedia_result(object):
"""
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 0:
if ftype == TType.BOOL:
self.success = iprot.readBool()
else:
iprot.skip(ftype)
elif fid == 1:
if ftype == TType.STRUCT:
self.sErrorSystemE = SpotifakeManagement.ttypes.SErrorSystemException()
self.sErrorSystemE.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('AddImageToMedia_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.BOOL, 0)
oprot.writeBool(self.success)
oprot.writeFieldEnd()
if self.sErrorSystemE is not None:
oprot.writeFieldBegin('sErrorSystemE', TType.STRUCT, 1)
self.sErrorSystemE.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(AddImageToMedia_result)
AddImageToMedia_result.thrift_spec = (
(0, TType.BOOL, 'success', None, None, ), # 0
(1, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErrorSystemException, None], None, ), # 1
)
class GetImageToMedia_args(object):
"""
Attributes:
- fileName
"""
def __init__(self, fileName=None,):
self.fileName = fileName
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRING:
self.fileName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('GetImageToMedia_args')
if self.fileName is not None:
oprot.writeFieldBegin('fileName', TType.STRING, 1)
oprot.writeString(self.fileName.encode('utf-8') if sys.version_info[0] == 2 else self.fileName)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(GetImageToMedia_args)
GetImageToMedia_args.thrift_spec = (
None, # 0
(1, TType.STRING, 'fileName', 'UTF8', None, ), # 1
)
class GetImageToMedia_result(object):
"""
Attributes:
- success
- sErrorSystemE
"""
def __init__(self, success=None, sErrorSystemE=None,):
self.success = success
self.sErrorSystemE = sErrorSystemE
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 0:
if ftype == TType.STRING:
self.success = iprot.readBinary()
else:
iprot.skip(ftype)
elif fid == 1:
if ftype == TType.STRUCT:
self.sErrorSystemE = SpotifakeManagement.ttypes.SErrorSystemException()
self.sErrorSystemE.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('GetImageToMedia_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.STRING, 0)
oprot.writeBinary(self.success)
oprot.writeFieldEnd()
if self.sErrorSystemE is not None:
oprot.writeFieldBegin('sErrorSystemE', TType.STRUCT, 1)
self.sErrorSystemE.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(GetImageToMedia_result)
GetImageToMedia_result.thrift_spec = (
(0, TType.STRING, 'success', 'BINARY', None, ), # 0
(1, TType.STRUCT, 'sErrorSystemE', [SpotifakeManagement.ttypes.SErrorSystemException, None], None, ), # 1
)
fix_spec(all_structs)
del all_structs
| 35.545067 | 134 | 0.612393 | 9,550 | 100,166 | 6.23466 | 0.025969 | 0.014192 | 0.025545 | 0.021464 | 0.85583 | 0.831578 | 0.819335 | 0.810232 | 0.80919 | 0.80919 | 0 | 0.005878 | 0.296887 | 100,166 | 2,817 | 135 | 35.557685 | 0.839538 | 0.052373 | 0 | 0.834146 | 1 | 0 | 0.04282 | 0.008862 | 0 | 0 | 0 | 0 | 0 | 1 | 0.103902 | false | 0.005366 | 0.003902 | 0.032195 | 0.196098 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
44971f5feac72d688f46c97571c246c1b476f0ad | 11,136 | py | Python | DQM/EcalMonitorTasks/python/TimingTask_cfi.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | DQM/EcalMonitorTasks/python/TimingTask_cfi.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | DQM/EcalMonitorTasks/python/TimingTask_cfi.py | pasmuss/cmssw | 566f40c323beef46134485a45ea53349f59ae534 | [
"Apache-2.0"
] | null | null | null | import FWCore.ParameterSet.Config as cms
bxBins = [
"1",
"271",
"541",
"892",
"1162",
"1432",
"1783",
"2053",
"2323",
"2674",
"2944",
"3214",
"3446",
"3490",
"3491",
"3565"
]
EaxisEdges = []
for i in range(50) :
EaxisEdges.append(pow(10., -0.5 + 2.5 / 50. * i))
chi2ThresholdEE = 50.
chi2ThresholdEB = 16.
energyThresholdEE = 3.
energyThresholdEB = 1.
timeWindow = 12.5
summaryTimeWindow = 7.
ecalTimingTask = cms.untracked.PSet(
params = cms.untracked.PSet(
chi2ThresholdEE = cms.untracked.double(chi2ThresholdEE),
chi2ThresholdEB = cms.untracked.double(chi2ThresholdEB),
energyThresholdEE = cms.untracked.double(energyThresholdEE),
energyThresholdEB = cms.untracked.double(energyThresholdEB)
),
MEs = cms.untracked.PSet(
TimeMap = cms.untracked.PSet(
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT timing %(sm)s'),
kind = cms.untracked.string('TProfile2D'),
zaxis = cms.untracked.PSet(
high = cms.untracked.double(timeWindow),
low = cms.untracked.double(-timeWindow),
title = cms.untracked.string('time (ns)')
),
otype = cms.untracked.string('SM'),
btype = cms.untracked.string('Crystal'),
description = cms.untracked.string('2D distribution of the mean rec hit timing. Only hits with GOOD or OUT_OF_TIME reconstruction flags and energy above threshold are used. Hits with |t| > ' + str(timeWindow) + ' ns are discarded. The energy thresholds are ' + ('%f and %f' % (energyThresholdEB, energyThresholdEE)) + ' for EB and EE respectively.')
),
TimeMapByLS = cms.untracked.PSet(
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT timing by LS %(sm)s'),
kind = cms.untracked.string('TProfile2D'),
zaxis = cms.untracked.PSet(
high = cms.untracked.double(timeWindow),
low = cms.untracked.double(-timeWindow),
title = cms.untracked.string('time (ns)')
),
otype = cms.untracked.string('SM'),
btype = cms.untracked.string('Crystal'),
description = cms.untracked.string('2D distribution of the mean rec hit timing. Only hits with GOOD or OUT_OF_TIME reconstruction flags and energy above threshold are used. Hits with |t| > ' + str(timeWindow) + ' ns are discarded. The energy thresholds are ' + ('%f and %f' % (energyThresholdEB, energyThresholdEE)) + ' for EB and EE respectively.')
),
TimeAll = cms.untracked.PSet(
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT timing 1D summary%(suffix)s'),
kind = cms.untracked.string('TH1F'),
otype = cms.untracked.string('Ecal3P'),
xaxis = cms.untracked.PSet(
high = cms.untracked.double(timeWindow),
nbins = cms.untracked.int32(100),
low = cms.untracked.double(-timeWindow),
title = cms.untracked.string('time (ns)')
),
btype = cms.untracked.string('User'),
description = cms.untracked.string('Distribution of the mean rec hit timing. Only hits with GOOD or OUT_OF_TIME reconstruction flags and energy above threshold are used. The energy thresholds are ' + ('%f and %f' % (energyThresholdEB, energyThresholdEE)) + ' for EB and EE respectively.')
),
TimeAllMap = cms.untracked.PSet(
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT timing map%(suffix)s'),
kind = cms.untracked.string('TProfile2D'),
zaxis = cms.untracked.PSet(
high = cms.untracked.double(summaryTimeWindow),
low = cms.untracked.double(-summaryTimeWindow),
title = cms.untracked.string('time (ns)')
),
otype = cms.untracked.string('Ecal3P'),
btype = cms.untracked.string('SuperCrystal'),
description = cms.untracked.string('2D distribution of the mean rec hit timing. Only hits with GOOD or OUT_OF_TIME reconstruction flags and energy above threshold are used. Hits with |t| > ' + str(summaryTimeWindow) + ' ns are discarded. The energy thresholds are ' + ('%f and %f' % (energyThresholdEB, energyThresholdEE)) + ' for EB and EE respectively.')
),
TimeAmpAll = cms.untracked.PSet(
kind = cms.untracked.string('TH2F'),
yaxis = cms.untracked.PSet(
high = cms.untracked.double(50.0),
nbins = cms.untracked.int32(200),
low = cms.untracked.double(-50.0),
title = cms.untracked.string('time (ns)')
),
otype = cms.untracked.string('Ecal3P'),
xaxis = cms.untracked.PSet(
edges = cms.untracked.vdouble(EaxisEdges),
title = cms.untracked.string('energy (GeV)')
),
btype = cms.untracked.string('User'),
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT timing vs amplitude summary%(suffix)s'),
description = cms.untracked.string('Correlation between hit timing and energy. Only hits with GOOD or OUT_OF_TIME reconstruction flags are used.')
),
TimeAmp = cms.untracked.PSet(
kind = cms.untracked.string('TH2F'),
yaxis = cms.untracked.PSet(
high = cms.untracked.double(50.0),
nbins = cms.untracked.int32(200),
low = cms.untracked.double(-50.0),
title = cms.untracked.string('time (ns)')
),
otype = cms.untracked.string('SM'),
xaxis = cms.untracked.PSet(
edges = cms.untracked.vdouble(EaxisEdges),
title = cms.untracked.string('energy (GeV)')
),
btype = cms.untracked.string('User'),
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT timing vs amplitude %(sm)s'),
description = cms.untracked.string('Correlation between hit timing and energy. Only hits with GOOD or OUT_OF_TIME reconstruction flags are used.')
),
TimingVsBX = cms.untracked.PSet(
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT Timing vs BX%(suffix)s'),
kind = cms.untracked.string('TProfile'),
otype = cms.untracked.string('Ecal3P'),
xaxis = cms.untracked.PSet(
high = cms.untracked.double(16.0),
nbins = cms.untracked.int32(16),
low = cms.untracked.double(0.0),
title = cms.untracked.string('bunch crossing'),
labels = cms.untracked.vstring(bxBins)
),
yaxis = cms.untracked.PSet(
title = cms.untracked.string('Timing (ns)')
),
btype = cms.untracked.string('User'),
description = cms.untracked.string('Average hit timing in the partition as a function of BX number.')
),
TimeAmpBXm = cms.untracked.PSet(
kind = cms.untracked.string('TH2F'),
yaxis = cms.untracked.PSet(
high = cms.untracked.double(100.0),
nbins = cms.untracked.int32(100),
low = cms.untracked.double(0.0),
title = cms.untracked.string('Amplitude BX-1 [ADC]')
),
otype = cms.untracked.string('Ecal3P'),
xaxis = cms.untracked.PSet(
high = cms.untracked.double(1000.0),
nbins = cms.untracked.int32(250),
low = cms.untracked.double(0.0),
title = cms.untracked.string('In-time amplitude [ADC]')
),
btype = cms.untracked.string('User'),
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT in-time vs BX-1 amplitude%(suffix)s'),
description = cms.untracked.string('Correlation between in-time amplitude and BX-1 out-of-time amplitude. Only events with kGood reconstruction flag set, energy > ( ' + ('EB:%f, EE:%f' % (energyThresholdEB*20., energyThresholdEE*5.)) + ' ) GeV, and chi2 < ( ' + ('EB:%f, EE:%f' % (chi2ThresholdEB, chi2ThresholdEE)) + ' ) are used.')
),
TimeAmpBXp = cms.untracked.PSet(
kind = cms.untracked.string('TH2F'),
yaxis = cms.untracked.PSet(
high = cms.untracked.double(100.0),
nbins = cms.untracked.int32(100),
low = cms.untracked.double(0.0),
title = cms.untracked.string('Amplitude BX+1 [ADC]')
),
otype = cms.untracked.string('Ecal3P'),
xaxis = cms.untracked.PSet(
high = cms.untracked.double(1000.0),
nbins = cms.untracked.int32(250),
low = cms.untracked.double(0.0),
title = cms.untracked.string('In-time amplitude [ADC]')
),
btype = cms.untracked.string('User'),
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT in-time vs BX+1 amplitude%(suffix)s'),
description = cms.untracked.string('Correlation between in-time amplitude and BX+1 out-of-time amplitude. Only events with kGood reconstruction flag set, energy > ( ' + ('EB:%f, EE:%f' % (energyThresholdEB*20., energyThresholdEE*5.)) + ' ) GeV, and chi2 < ( ' + ('EB:%f, EE:%f' % (chi2ThresholdEB, chi2ThresholdEE)) + ' ) are used.')
),
Time1D = cms.untracked.PSet(
path = cms.untracked.string('%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT timing 1D %(sm)s'),
kind = cms.untracked.string('TH1F'),
otype = cms.untracked.string('SM'),
xaxis = cms.untracked.PSet(
high = cms.untracked.double(timeWindow),
nbins = cms.untracked.int32(100),
low = cms.untracked.double(-timeWindow),
title = cms.untracked.string('time (ns)')
),
btype = cms.untracked.string('User'),
description = cms.untracked.string('Distribution of the mean rec hit timing. Only hits with GOOD or OUT_OF_TIME reconstruction flags and energy above threshold are used. The energy thresholds are ' + ('%f and %f' % (energyThresholdEB, energyThresholdEE)) + ' for EB and EE respectively.')
),
Chi2 = cms.untracked.PSet(
path = cms.untracked.string("%(subdet)s/%(prefix)sTimingTask/%(prefix)sTMT %(subdetshortsig)s Chi2"),
kind = cms.untracked.string('TH1F'),
otype = cms.untracked.string('Ecal3P'),
btype = cms.untracked.string('User'),
xaxis = cms.untracked.PSet(
high = cms.untracked.double(100.),
low = cms.untracked.double(0.),
nbins = cms.untracked.int32(100)
),
description = cms.untracked.string('Chi2 of the pulse reconstruction.')
)
)
)
| 54.058252 | 368 | 0.584142 | 1,217 | 11,136 | 5.333607 | 0.129006 | 0.264366 | 0.194115 | 0.053151 | 0.852719 | 0.84856 | 0.834694 | 0.834694 | 0.826683 | 0.819288 | 0 | 0.028021 | 0.282148 | 11,136 | 205 | 369 | 54.321951 | 0.783963 | 0 | 0 | 0.606965 | 0 | 0.044776 | 0.268678 | 0.04445 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.004975 | 0 | 0.004975 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
9290d081058e752995edd7bae5e2d7681c755cbd | 103 | py | Python | hunabku/__init__.py | cesarari/HunabKu | 84358f2b93e8937403ab9d421b6dec434d5fcbae | [
"BSD-3-Clause"
] | null | null | null | hunabku/__init__.py | cesarari/HunabKu | 84358f2b93e8937403ab9d421b6dec434d5fcbae | [
"BSD-3-Clause"
] | 389 | 2020-05-24T22:01:59.000Z | 2022-03-20T19:04:56.000Z | hunabku/__init__.py | cesarari/HunabKu | 84358f2b93e8937403ab9d421b6dec434d5fcbae | [
"BSD-3-Clause"
] | 4 | 2020-11-06T21:00:39.000Z | 2021-09-19T15:29:43.000Z | # flake8: noqa
from hunabku import Hunabku
from hunabku import HunabkuBase
from hunabku import _version | 25.75 | 31 | 0.84466 | 14 | 103 | 6.142857 | 0.5 | 0.383721 | 0.593023 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011236 | 0.135922 | 103 | 4 | 32 | 25.75 | 0.955056 | 0.116505 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
92a0f42dbe4a6e5d0815e184359440ee54c58851 | 65 | py | Python | utils.py | jwoos/python_digitrecognizer | 4a06cc7b7ee32aa6c66a391cd6595a2b5fbad38b | [
"MIT"
] | null | null | null | utils.py | jwoos/python_digitrecognizer | 4a06cc7b7ee32aa6c66a391cd6595a2b5fbad38b | [
"MIT"
] | 8 | 2019-01-19T19:20:13.000Z | 2019-03-27T01:37:08.000Z | utils.py | jwoos/python_digitrecognizer | 4a06cc7b7ee32aa6c66a391cd6595a2b5fbad38b | [
"MIT"
] | null | null | null | import numpy as np
def zeros(*args):
return np.zeros(args)
| 10.833333 | 25 | 0.676923 | 11 | 65 | 4 | 0.727273 | 0.409091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.215385 | 65 | 5 | 26 | 13 | 0.862745 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | true | 0 | 0.333333 | 0.333333 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 7 |
92a125348140b7474fcbd0c22e76920929edd91f | 131 | py | Python | app/aicos_wcm/__init__.py | muhiza/digital.cooperative | f57a749e10796b6e00920b21809ab56b9274d944 | [
"Unlicense"
] | null | null | null | app/aicos_wcm/__init__.py | muhiza/digital.cooperative | f57a749e10796b6e00920b21809ab56b9274d944 | [
"Unlicense"
] | null | null | null | app/aicos_wcm/__init__.py | muhiza/digital.cooperative | f57a749e10796b6e00920b21809ab56b9274d944 | [
"Unlicense"
] | null | null | null | from flask import Flask, Blueprint
aicos_wcm = Blueprint('aicos_wcm', __name__, template_folder="templates")
from .views import * | 26.2 | 73 | 0.78626 | 17 | 131 | 5.647059 | 0.647059 | 0.291667 | 0.354167 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114504 | 131 | 5 | 74 | 26.2 | 0.827586 | 0 | 0 | 0 | 0 | 0 | 0.136364 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0.666667 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 7 |
2bb8d342adc70937ba0b7daeeb019067ae8c3d44 | 15,575 | bzl | Python | 3rdparty/target_file.bzl | kouky/javalin-kotlin-bazel-boilerplate | 2dff848e1011a07aa7d1c74c495ccd7f672f158b | [
"MIT"
] | null | null | null | 3rdparty/target_file.bzl | kouky/javalin-kotlin-bazel-boilerplate | 2dff848e1011a07aa7d1c74c495ccd7f672f158b | [
"MIT"
] | null | null | null | 3rdparty/target_file.bzl | kouky/javalin-kotlin-bazel-boilerplate | 2dff848e1011a07aa7d1c74c495ccd7f672f158b | [
"MIT"
] | null | null | null | # Do not edit. bazel-deps autogenerates this file from.
_JAVA_LIBRARY_TEMPLATE = """
java_library(
name = "{name}",
exports = [
{exports}
],
runtime_deps = [
{runtime_deps}
],
visibility = [
"{visibility}"
]
)\n"""
_SCALA_IMPORT_TEMPLATE = """
scala_import(
name = "{name}",
exports = [
{exports}
],
jars = [
{jars}
],
runtime_deps = [
{runtime_deps}
],
visibility = [
"{visibility}"
]
)
"""
_SCALA_LIBRARY_TEMPLATE = """
scala_library(
name = "{name}",
exports = [
{exports}
],
runtime_deps = [
{runtime_deps}
],
visibility = [
"{visibility}"
]
)
"""
def _build_external_workspace_from_opts_impl(ctx):
build_header = ctx.attr.build_header
separator = ctx.attr.separator
target_configs = ctx.attr.target_configs
result_dict = {}
for key, cfg in target_configs.items():
build_file_to_target_name = key.split(":")
build_file = build_file_to_target_name[0]
target_name = build_file_to_target_name[1]
if build_file not in result_dict:
result_dict[build_file] = []
result_dict[build_file].append(cfg)
for key, file_entries in result_dict.items():
build_file_contents = build_header + '\n\n'
for build_target in file_entries:
entry_map = {}
for entry in build_target:
elements = entry.split(separator)
build_entry_key = elements[0]
if elements[1] == "L":
entry_map[build_entry_key] = [e for e in elements[2::] if len(e) > 0]
elif elements[1] == "B":
entry_map[build_entry_key] = (elements[2] == "true" or elements[2] == "True")
else:
entry_map[build_entry_key] = elements[2]
exports_str = ""
for e in entry_map.get("exports", []):
exports_str += "\"" + e + "\",\n"
jars_str = ""
for e in entry_map.get("jars", []):
jars_str += "\"" + e + "\",\n"
runtime_deps_str = ""
for e in entry_map.get("runtimeDeps", []):
runtime_deps_str += "\"" + e + "\",\n"
name = entry_map["name"].split(":")[1]
if entry_map["lang"] == "java":
build_file_contents += _JAVA_LIBRARY_TEMPLATE.format(name = name, exports=exports_str, runtime_deps=runtime_deps_str, visibility=entry_map["visibility"])
elif entry_map["lang"].startswith("scala") and entry_map["kind"] == "import":
build_file_contents += _SCALA_IMPORT_TEMPLATE.format(name = name, exports=exports_str, jars=jars_str, runtime_deps=runtime_deps_str, visibility=entry_map["visibility"])
elif entry_map["lang"].startswith("scala") and entry_map["kind"] == "library":
build_file_contents += _SCALA_LIBRARY_TEMPLATE.format(name = name, exports=exports_str, runtime_deps=runtime_deps_str, visibility=entry_map["visibility"])
else:
print(entry_map)
ctx.file(ctx.path(key + "/BUILD"), build_file_contents, False)
return None
build_external_workspace_from_opts = repository_rule(
attrs = {
"target_configs": attr.string_list_dict(mandatory = True),
"separator": attr.string(mandatory = True),
"build_header": attr.string(mandatory = True),
},
implementation = _build_external_workspace_from_opts_impl
)
def build_header():
return """"""
def list_target_data_separator():
return "|||"
def list_target_data():
return {
"3rdparty/jvm/io/javalin:javalin": ["lang||||||java","name||||||//3rdparty/jvm/io/javalin:javalin","visibility||||||//visibility:public","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//external:jar/io/javalin/javalin|||//3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib_jdk8|||//3rdparty/jvm/org/eclipse/jetty:jetty_server|||//3rdparty/jvm/org/eclipse/jetty/websocket:websocket_server|||//3rdparty/jvm/org/eclipse/jetty:jetty_webapp|||//3rdparty/jvm/org/slf4j:slf4j_api","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/javax/servlet:javax_servlet_api": ["lang||||||java","name||||||//3rdparty/jvm/javax/servlet:javax_servlet_api","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//external:jar/javax/servlet/javax_servlet_api","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty:jetty_client": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty:jetty_client","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/eclipse/jetty:jetty_http|||//3rdparty/jvm/org/eclipse/jetty:jetty_io|||//external:jar/org/eclipse/jetty/jetty_client","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty:jetty_http": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty:jetty_http","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/eclipse/jetty:jetty_io|||//3rdparty/jvm/org/eclipse/jetty:jetty_util|||//external:jar/org/eclipse/jetty/jetty_http","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty:jetty_io": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty:jetty_io","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/eclipse/jetty:jetty_util|||//external:jar/org/eclipse/jetty/jetty_io","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty:jetty_security": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty:jetty_security","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/eclipse/jetty:jetty_server|||//external:jar/org/eclipse/jetty/jetty_security","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty:jetty_server": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty:jetty_server","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/eclipse/jetty:jetty_http|||//3rdparty/jvm/javax/servlet:javax_servlet_api|||//3rdparty/jvm/org/eclipse/jetty:jetty_io|||//external:jar/org/eclipse/jetty/jetty_server","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty:jetty_servlet": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty:jetty_servlet","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/eclipse/jetty:jetty_security|||//external:jar/org/eclipse/jetty/jetty_servlet","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty:jetty_util": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty:jetty_util","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//external:jar/org/eclipse/jetty/jetty_util","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty:jetty_webapp": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty:jetty_webapp","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/eclipse/jetty:jetty_xml|||//3rdparty/jvm/org/eclipse/jetty:jetty_servlet|||//external:jar/org/eclipse/jetty/jetty_webapp","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty:jetty_xml": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty:jetty_xml","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/eclipse/jetty:jetty_util|||//external:jar/org/eclipse/jetty/jetty_xml","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty/websocket:websocket_api": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty/websocket:websocket_api","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//external:jar/org/eclipse/jetty/websocket/websocket_api","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty/websocket:websocket_client": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty/websocket:websocket_client","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/eclipse/jetty:jetty_io|||//external:jar/org/eclipse/jetty/websocket/websocket_client|||//3rdparty/jvm/org/eclipse/jetty:jetty_util|||//3rdparty/jvm/org/eclipse/jetty/websocket:websocket_common|||//3rdparty/jvm/org/eclipse/jetty:jetty_client|||//3rdparty/jvm/org/eclipse/jetty:jetty_xml","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty/websocket:websocket_common": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty/websocket:websocket_common","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/eclipse/jetty:jetty_io|||//3rdparty/jvm/org/eclipse/jetty/websocket:websocket_api|||//3rdparty/jvm/org/eclipse/jetty:jetty_util|||//external:jar/org/eclipse/jetty/websocket/websocket_common","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty/websocket:websocket_server": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty/websocket:websocket_server","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/eclipse/jetty:jetty_http|||//3rdparty/jvm/org/eclipse/jetty/websocket:websocket_servlet|||//3rdparty/jvm/org/eclipse/jetty/websocket:websocket_common|||//3rdparty/jvm/org/eclipse/jetty/websocket:websocket_client|||//external:jar/org/eclipse/jetty/websocket/websocket_server|||//3rdparty/jvm/org/eclipse/jetty:jetty_servlet","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/eclipse/jetty/websocket:websocket_servlet": ["lang||||||java","name||||||//3rdparty/jvm/org/eclipse/jetty/websocket:websocket_servlet","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/eclipse/jetty/websocket:websocket_api|||//3rdparty/jvm/javax/servlet:javax_servlet_api|||//external:jar/org/eclipse/jetty/websocket/websocket_servlet","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/jetbrains:annotations": ["lang||||||java","name||||||//3rdparty/jvm/org/jetbrains:annotations","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//external:jar/org/jetbrains/annotations","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib": ["lang||||||java","name||||||//3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib_common|||//3rdparty/jvm/org/jetbrains:annotations|||//external:jar/org/jetbrains/kotlin/kotlin_stdlib","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib_common": ["lang||||||java","name||||||//3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib_common","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//external:jar/org/jetbrains/kotlin/kotlin_stdlib_common","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib_jdk7": ["lang||||||java","name||||||//3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib_jdk7","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib|||//external:jar/org/jetbrains/kotlin/kotlin_stdlib_jdk7","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib_jdk8": ["lang||||||java","name||||||//3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib_jdk8","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib|||//3rdparty/jvm/org/jetbrains/kotlin:kotlin_stdlib_jdk7|||//external:jar/org/jetbrains/kotlin/kotlin_stdlib_jdk8","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/slf4j:slf4j_api": ["lang||||||java","name||||||//3rdparty/jvm/org/slf4j:slf4j_api","visibility||||||//3rdparty/jvm:__subpackages__","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//external:jar/org/slf4j/slf4j_api","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"],
"3rdparty/jvm/org/slf4j:slf4j_simple": ["lang||||||java","name||||||//3rdparty/jvm/org/slf4j:slf4j_simple","visibility||||||//visibility:public","kind||||||library","deps|||L|||","jars|||L|||","sources|||L|||","exports|||L|||//3rdparty/jvm/org/slf4j:slf4j_api|||//external:jar/org/slf4j/slf4j_simple","runtimeDeps|||L|||","processorClasses|||L|||","generatesApi|||B|||false","licenses|||L|||","generateNeverlink|||B|||false"]
}
def build_external_workspace(name):
return build_external_workspace_from_opts(name = name, target_configs = list_target_data(), separator = list_target_data_separator(), build_header = build_header())
| 102.467105 | 748 | 0.668058 | 1,875 | 15,575 | 5.3584 | 0.061333 | 0.116055 | 0.110083 | 0.11914 | 0.87658 | 0.837165 | 0.812879 | 0.735443 | 0.709665 | 0.667363 | 0 | 0.009637 | 0.06061 | 15,575 | 151 | 749 | 103.145695 | 0.677056 | 0.003403 | 0 | 0.248062 | 1 | 0.131783 | 0.744442 | 0.548231 | 0 | 0 | 0 | 0 | 0 | 1 | 0.03876 | false | 0 | 0.031008 | 0.031008 | 0.108527 | 0.007752 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 |
2bd61265cb42d33d673ee01386e243d1131e4dce | 14,621 | py | Python | Modules/punishments.py | Syslog777/mr-script-bot | 280625c825482d604c56ed7be1088e030dbe150d | [
"MIT"
] | null | null | null | Modules/punishments.py | Syslog777/mr-script-bot | 280625c825482d604c56ed7be1088e030dbe150d | [
"MIT"
] | null | null | null | Modules/punishments.py | Syslog777/mr-script-bot | 280625c825482d604c56ed7be1088e030dbe150d | [
"MIT"
] | null | null | null | from Modules import functions, data
# size of punishments.py needs to be reduced, a lot is repeated
async def mute(message):
# get arguments, stop function if none are found
arguments = await functions.get_arguments(message)
if not arguments:
return
failure_count = 0
targets = []
reason = "No reason provided."
length = "∞"
# check for targets and add to list
for argument in arguments:
if argument.startswith("<@"):
targets.append(message.mentions[len(targets)])
# if not target, update length if found and set reason
else:
if argument.isdigit():
length = argument
break
reason = " ".join(arguments[len(targets)+1:]) or reason
# iterate through targets, ignore user if moderator
for target in targets:
try:
await functions.setup_data(target)
for role in target.roles:
if role.name == "Moderator":
raise Exception("user is moderator")
# increase user's mute count, set length if not inf and dm user
await functions.increase_count(target, "mute", 1)
await functions.set_punish_time(target, "mute", length, 60)
await functions.send_embed(
target, "ScriptersCF",
f"You have been **muted** in ScriptersCF for **{length} minutes** for the following reason: ```{reason}```"
)
# give user muted role
role = message.guild.get_role(data.muted)
await target.add_roles(role)
# otherwise, increase failure count to warn moderator
except:
failure_count += 1
# log kicked targets + reason in logs channel
await functions.send_embed(
message.guild.get_channel(data.logs_channel),
"Mute",
f"""**Moderator:** <@{str(message.author.id)}>
**Length:** """ + str(length) + """ minutes
**Targets:** """ + ", ".join([f"<@{target.id}>" for target in targets]) + """
**Reason:** """ + reason
)
# tell user whether successful or not
if failure_count == 0:
await message.add_reaction("👍")
else:
await functions.send_error(message.channel, f"{str(failure_count)} user was not muted.")
async def kick(message):
# get arguments, stop function if none are found
arguments = await functions.get_arguments(message)
if not arguments:
return
failure_count = 0
targets = []
reason = "No reason provided."
# check for targets and add to list
for argument in arguments:
if argument.startswith("<@"):
targets.append(message.mentions[len(targets)])
# if not target, update reason and stop iterating
else:
reason = " ".join(arguments[len(targets):])
break
# iterate through targets, ignore user if moderator
for target in targets:
try:
await functions.setup_data(target)
for role in target.roles:
if role.name == "Moderator":
raise Exception("user is moderator")
# increase user's kick count, dm user and kick
await functions.increase_count(target, "kick", 1)
await functions.send_embed(
target,
"ScriptersCF",
f"You have been **kicked** from ScriptersCF for the following reason: ```{reason}```"
)
await target.kick(reason = reason)
except:
failure_count += 1
# log kicked targets + reason in logs channel
await functions.send_embed(
message.guild.get_channel(data.logs_channel),
"Kick",
f"""**Moderator:** <@{str(message.author.id)}>
**Targets:** """ + ", ".join([f"<@{target.id}>" for target in targets]) + """
**Reason:** """ + reason
)
# tell user whether successful or not
if failure_count == 0:
await message.add_reaction("👍")
else:
await functions.send_error(message.channel, f"{str(failure_count)} user was not kicked.")
async def ban(message):
# get arguments, stop function if none are found
arguments = await functions.get_arguments(message)
if not arguments:
return
failure_count = 0
targets = []
reason = "No reason provided."
# check for targets and add to list
for argument in arguments:
if argument.startswith("<@"):
targets.append(message.mentions[len(targets)])
# if not target, update reason and stop iterating
else:
reason = " ".join(arguments[len(targets):])
break
# iterate through targets, ignore user if moderator
for target in targets:
try:
await functions.setup_data(target)
for role in target.roles:
if role.name == "Moderator":
raise Exception("user is moderator")
# increase user's ban count, dm user and ban
await functions.increase_count(target, "ban", 1)
await functions.send_embed(
target,
"ScriptersCF",
f"You have been **banned** from ScriptersCF for the following reason: ```{reason}```"
+ "If you feel you have been banned by mistake, please appeal [here](https://forms.gle/Rzd4QvLJYyo3BkQg6)."
)
await target.ban(reason = reason)
except:
failure_count += 1
# log banned targets + reason in logs channel
await functions.send_embed(
message.guild.get_channel(data.logs_channel),
"Ban",
f"""**Moderator:** <@{str(message.author.id)}>
**Targets:** """ + ", ".join([f"<@{target.id}>" for target in targets]) + """
**Reason:** """ + reason
)
# tell user whether successful or not
if failure_count == 0:
await message.add_reaction("👍")
else:
await functions.send_error(message.channel, f"{str(failure_count)} user was not banned.")
async def shban(message):
# get arguments, stop function if none are found
arguments = await functions.get_arguments(message)
if not arguments:
return
failure_count = 0
targets = []
reason = "No reason provided."
length = "∞"
# check for targets and add to list
for argument in arguments:
if argument.startswith("<@"):
targets.append(message.mentions[len(targets)])
# if not target, update length if found and set reason
else:
if argument.isdigit():
length = argument
break
reason = " ".join(arguments[len(targets)+1:]) or reason
# iterate through targets, ignore user if moderator
for target in targets:
try:
await functions.setup_data(target)
for role in target.roles:
if role.name == "Moderator":
raise Exception("user is moderator")
# increase user's shban count, set length if not inf and dm user
await functions.increase_count(target, "shban", 1)
await functions.set_punish_time(target, "shban", length, 86400)
await functions.send_embed(
target, "ScriptersCF",
f"You have been **banned from selling & hiring** in ScriptersCF for **{length} days** for the following reason: ```{reason}```"
)
# give user shban role
role = message.guild.get_role(data.shban)
await target.add_roles(role)
# otherwise, increase failure count to warn moderator
except:
failure_count += 1
# log kicked targets + reason in logs channel
await functions.send_embed(
message.guild.get_channel(data.logs_channel),
"S&H Ban",
f"""**Moderator:** <@{str(message.author.id)}>
**Length:** """ + str(length) + """ days
**Targets:** """ + ", ".join([f"<@{target.id}>" for target in targets]) + """
**Reason:** """ + reason
)
# tell user whether successful or not
if failure_count == 0:
await message.add_reaction("👍")
else:
await functions.send_error(message.channel, f"{str(failure_count)} user was not banned from selling & hiring.")
async def aban(message):
# get arguments, stop function if none are found
arguments = await functions.get_arguments(message)
if not arguments:
return
failure_count = 0
targets = []
reason = "No reason provided."
length = "∞"
# check for targets and add to list
for argument in arguments:
if argument.startswith("<@"):
targets.append(message.mentions[len(targets)])
# if not target, update length if found and set reason
else:
if argument.isdigit():
length = argument
break
reason = " ".join(arguments[len(targets)+1:]) or reason
# iterate through targets, ignore user if moderator
for target in targets:
try:
await functions.setup_data(target)
for role in target.roles:
if role.name == "Moderator":
raise Exception("user is moderator")
# increase user's aban count, set length if not inf and dm user
await functions.increase_count(target, "aban", 1)
await functions.set_punish_time(target, "aban", length, 86400)
await functions.send_embed(
target, "ScriptersCF",
f"You have been **banned from academics channels** in ScriptersCF for **{length} days** for the following reason: ```{reason}```"
)
# give user aban role
role = message.guild.get_role(data.aban)
await target.add_roles(role)
# otherwise, increase failure count to warn moderator
except:
failure_count += 1
# log kicked targets + reason in logs channel
await functions.send_embed(
message.guild.get_channel(data.logs_channel),
"Academics Ban",
f"""**Moderator:** <@{str(message.author.id)}>
**Length:** """ + str(length) + """ days
**Targets:** """ + ", ".join([f"<@{target.id}>" for target in targets]) + """
**Reason:** """ + reason
)
# tell user whether successful or not
if failure_count == 0:
await message.add_reaction("👍")
else:
await functions.send_error(message.channel, f"{str(failure_count)} user was not banned from Academics.")
async def unmute(message):
# get arguments, stop function if none are found
arguments = await functions.get_arguments(message)
if not arguments:
return
failure_count = 0
targets = []
# check for targets and add to list
for argument in arguments:
if argument.startswith("<@"):
targets.append(message.mentions[len(targets)])
# iterate through targets, send direct messages, increase data and mute
for target in targets:
try:
await functions.setup_data(target)
await functions.send_embed(
target,
"ScriptersCF",
f"You have been **unmuted** in ScriptersCF."
)
role = message.guild.get_role(data.muted)
await target.remove_roles(role)
except:
failure_count += 1
# log kicked targets + reason in logs channel
await functions.send_embed(
message.guild.get_channel(data.logs_channel),
"Unmute",
f"""**Moderator:** <@{str(message.author.id)}>
**Targets:** """ + ", ".join([f"<@{target.id}>" for target in targets])
)
# tell user whether successful or not
if failure_count == 0:
await message.add_reaction("👍")
else:
await functions.send_error(message.channel, f"{str(failure_count)} user was not unmuted.")
async def report(message):
# get arguments, stop function if none are found
arguments = await functions.get_arguments(message)
if not arguments:
return
failure_count = 0
self_report = False
targets = []
reason = "No reason provided."
# check for targets and add to list
for argument in arguments:
if argument.startswith("<@"):
targets.append(message.mentions[len(targets)])
# if not target, update reason and stop iterating
else:
reason = " ".join(arguments[len(targets):])
break
# iterate through targets, ignore user if moderator
for target in targets:
try:
await functions.setup_data(target)
for role in target.roles:
if role.name == "Moderator":
raise Exception("user is moderator")
if target.id == message.author.id:
raise Exception("self report")
except:
failure_count += 1
# log kicked targets + reason in logs channel
if failure_count == 0:
await functions.send_embed(
message.guild.get_channel(data.logs_channel),
"Report",
f"""**Plaintiff:** <@{str(message.author.id)}>
**Targets:** """ + ", ".join([f"<@{target.id}>" for target in targets]) + """
**Reason:** """ + reason
)
else:
await functions.send_embed(
message.guild.get_channel(data.logs_channel),
"Attempted Report",
f"""**Plaintiff:** <@{str(message.author.id)}>
**Targets:** """ + ", ".join([f"<@{target.id}>" for target in targets]) + """
**Reason:** """ + reason
)
# tell user whether successful or not
if failure_count == 0 and not self_report:
await message.add_reaction("👍")
else:
await functions.send_error(message.channel, f"{str(failure_count)} user was not reported.") | 35.574209 | 146 | 0.557623 | 1,599 | 14,621 | 5.037523 | 0.090056 | 0.074736 | 0.046927 | 0.03352 | 0.90838 | 0.898324 | 0.898324 | 0.857107 | 0.857107 | 0.842458 | 0 | 0.004636 | 0.33616 | 14,621 | 411 | 147 | 35.574209 | 0.824232 | 0.161001 | 0 | 0.780488 | 0 | 0.013937 | 0.198323 | 0.018299 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.003484 | 0 | 0.027875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
2bd6695d5560e31473818e6c03792967c0583a3c | 5,001 | py | Python | tests/test_bbtools.py | OLC-LOC-Bioinformatics/genewrappers | c0e2c0112e6ad71941bbf188d60cf05f68750c26 | [
"MIT"
] | null | null | null | tests/test_bbtools.py | OLC-LOC-Bioinformatics/genewrappers | c0e2c0112e6ad71941bbf188d60cf05f68750c26 | [
"MIT"
] | null | null | null | tests/test_bbtools.py | OLC-LOC-Bioinformatics/genewrappers | c0e2c0112e6ad71941bbf188d60cf05f68750c26 | [
"MIT"
] | null | null | null | from genewrappers.biotools import bbtools
import pytest
import os
def test_bbmap_command_paired():
out, err, cmd = bbtools.bbmap(reference='tests/dummy_fasta/test.fasta',
forward_in='tests/dummy_fastq/test_R1.fastq',
out_bam='tests/out.bam', returncmd=True)
assert cmd == 'bbmap.sh ref=tests/dummy_fasta/test.fasta in=tests/dummy_fastq/test_R1.fastq' \
' in2=tests/dummy_fastq/test_R2.fastq out=tests/out.bam nodisk'
os.remove('tests/out.bam')
def test_bbmap_command_single():
out, err, cmd = bbtools.bbmap(reference='tests/dummy_fasta/test.fasta',
forward_in='tests/dummy_fastq/single.fastq',
out_bam='tests/out.bam', returncmd=True)
assert cmd == 'bbmap.sh ref=tests/dummy_fasta/test.fasta in=tests/dummy_fastq/single.fastq ' \
'out=tests/out.bam nodisk'
os.remove('tests/out.bam')
def test_bbduk_bait_command_paired():
out, err, cmd = bbtools.bbduk_bait(forward_in='tests/dummy_fastq/test_R1.fastq',
forward_out='tests/out_R1.fastq',
reference='tests/dummy_fasta/test.fasta',
returncmd=True)
assert cmd == 'bbduk.sh in=tests/dummy_fastq/test_R1.fastq ' \
'in2=tests/dummy_fastq/test_R2.fastq outm=tests/out_R1.fastq outm2=tests/out_R2.fastq' \
' ref=tests/dummy_fasta/test.fasta'
os.remove('tests/out_R1.fastq')
os.remove('tests/out_R2.fastq')
def test_bbduk_bait_command_single():
out, err, cmd = bbtools.bbduk_bait(forward_in='tests/dummy_fastq/single.fastq',
forward_out='tests/out.fastq',
reference='tests/dummy_fasta/test.fasta',
returncmd=True)
assert cmd == 'bbduk.sh in=tests/dummy_fastq/single.fastq ' \
'outm=tests/out.fastq' \
' ref=tests/dummy_fasta/test.fasta'
os.remove('tests/out.fastq')
def test_bbduk_filter_command_paired():
out, err, cmd = bbtools.bbduk_filter(forward_in='tests/dummy_fastq/test_R1.fastq',
forward_out='tests/out_R1.fastq',
reference='tests/dummy_fasta/test.fasta',
returncmd=True)
assert cmd == 'bbduk.sh in=tests/dummy_fastq/test_R1.fastq ' \
'in2=tests/dummy_fastq/test_R2.fastq out=tests/out_R1.fastq out2=tests/out_R2.fastq' \
' ref=tests/dummy_fasta/test.fasta'
os.remove('tests/out_R1.fastq')
os.remove('tests/out_R2.fastq')
def test_bbduk_filter_command_single():
out, err, cmd = bbtools.bbduk_filter(forward_in='tests/dummy_fastq/single.fastq',
forward_out='tests/out.fastq',
reference='tests/dummy_fasta/test.fasta',
returncmd=True)
assert cmd == 'bbduk.sh in=tests/dummy_fastq/single.fastq ' \
'out=tests/out.fastq' \
' ref=tests/dummy_fasta/test.fasta'
os.remove('tests/out.fastq')
def test_bbmap_command_paired_kwargs():
out, err, cmd = bbtools.bbmap(reference='tests/dummy_fasta/test.fasta',
forward_in='tests/dummy_fastq/test_R1.fastq',
out_bam='tests/out.bam', returncmd=True, threads='3', ordered='t')
assert 'bbmap.sh ref=tests/dummy_fasta/test.fasta in=tests/dummy_fastq/test_R1.fastq' \
' in2=tests/dummy_fastq/test_R2.fastq out=tests/out.bam nodisk' in cmd and 'ordered=t' in cmd and \
'threads=3' in cmd
os.remove('tests/out.bam')
def test_bbduk_filter_exception():
with pytest.raises(ValueError):
bbtools.bbduk_filter(forward_in='tests/dummy_fastq/test_R1.fastq',
forward_out='tests/out_aa.fastq',
reference='tests/dummy_fasta/test.fasta',
returncmd=True)
def test_bbmerge_call():
out, err, cmd = bbtools.bbmerge(forward_in='tests/dummy_fastq/test_R1.fastq',
merged_reads='tests/merged.fastq', returncmd=True)
assert cmd == 'bbmerge.sh in=tests/dummy_fastq/test_R1.fastq in2=tests/dummy_fastq/test_R2.fastq ' \
'out=tests/merged.fastq '
os.remove('tests/merged.fastq')
def test_bbmerge_with_kwargs():
out, err, cmd = bbtools.bbmerge(forward_in='tests/dummy_fastq/test_R1.fastq',
merged_reads='tests/merged.fastq', returncmd=True, threads=1)
assert cmd == 'bbmerge.sh in=tests/dummy_fastq/test_R1.fastq in2=tests/dummy_fastq/test_R2.fastq ' \
'out=tests/merged.fastq threads=1'
os.remove('tests/merged.fastq')
| 49.029412 | 110 | 0.591482 | 626 | 5,001 | 4.519169 | 0.089457 | 0.141393 | 0.132556 | 0.114175 | 0.912337 | 0.875221 | 0.860021 | 0.839519 | 0.826794 | 0.805585 | 0 | 0.011569 | 0.291342 | 5,001 | 101 | 111 | 49.514851 | 0.786682 | 0 | 0 | 0.54321 | 0 | 0.08642 | 0.39832 | 0.280744 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.123457 | true | 0 | 0.037037 | 0 | 0.160494 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
2bf3455e7decc6da429903777924d99eee4c2acc | 982 | py | Python | Sentiment Classifier/CONFIG.py | prakharrathi25/Sentiment-Extraction-using-Bert | 89d50e57f6e73812930654ec636f1219e7ecb334 | [
"MIT"
] | 3 | 2020-12-12T07:40:47.000Z | 2021-11-28T17:08:38.000Z | Sentiment Classifier/CONFIG.py | prakharrathi25/Sentiment-Extraction-using-Bert | 89d50e57f6e73812930654ec636f1219e7ecb334 | [
"MIT"
] | 4 | 2021-06-08T21:50:32.000Z | 2022-03-12T00:36:47.000Z | Sentiment Classifier/CONFIG.py | prakharrathi25/Sentiment-Extraction-using-Bert | 89d50e57f6e73812930654ec636f1219e7ecb334 | [
"MIT"
] | 1 | 2020-09-30T19:42:31.000Z | 2020-09-30T19:42:31.000Z | <<<<<<< HEAD
import transformers
MAX_LEN = 100
TRAIN_BATCH_SIZE = 16
VALID_BATCH_SIZE = 10
EPOCHS = 5
BERT_PATH = 'bert-base-uncased'
MODEL_PATH = 'model.bin'
TRAINING_FILE = 'C:/Users/Arpan/Downloads/Education/Project/Twitter Sentiment Classification/Data/train.csv'
TESTING_FILE = 'C:/Users/Arpan/Downloads/Education/Project/Twitter Sentiment Classification/Data/test.csv'
TOKENIZER = transformers.BertTokenizer.from_pretrained(BERT_PATH,do_lower_case = True)
=======
import transformers
MAX_LEN = 100
TRAIN_BATCH_SIZE = 16
VALID_BATCH_SIZE = 10
EPOCHS = 5
BERT_PATH = 'bert-base-uncased'
MODEL_PATH = 'polarity_model.bin'
TRAINING_FILE = 'C:/Users/Arpan/Downloads/Education/Project/Twitter Sentiment Classification/Data/train.csv'
TESTING_FILE = 'C:/Users/Arpan/Downloads/Education/Project/Twitter Sentiment Classification/Data/test.csv'
TOKENIZER = transformers.BertTokenizer.from_pretrained(BERT_PATH,do_lower_case = True)
>>>>>>> 234f14c... Added app.py + final model
| 37.769231 | 108 | 0.790224 | 134 | 982 | 5.589552 | 0.365672 | 0.048064 | 0.053405 | 0.080107 | 0.947931 | 0.947931 | 0.947931 | 0.947931 | 0.947931 | 0.947931 | 0 | 0.02349 | 0.089613 | 982 | 25 | 109 | 39.28 | 0.814318 | 0 | 0 | 0.782609 | 0 | 0.173913 | 0.42668 | 0.319756 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.086957 | null | null | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
a660e548152987af1bf7d24c7ff0cfd6e466f82c | 24,436 | py | Python | slickwiki/templates.py | JasonFruit/slickwiki | b2b163240314e67e6a161123b082c7bc61b8ca4f | [
"MIT"
] | null | null | null | slickwiki/templates.py | JasonFruit/slickwiki | b2b163240314e67e6a161123b082c7bc61b8ca4f | [
"MIT"
] | null | null | null | slickwiki/templates.py | JasonFruit/slickwiki | b2b163240314e67e6a161123b082c7bc61b8ca4f | [
"MIT"
] | null | null | null | templates = {
"css": """
body {
margin: 40px auto;
max-width: 650px;
line-height: 1.6;
font-size: 18px;
color: #444;
padding: 0 10px
}
h1,h2,h3 {
line-height: 1.2
}
""",
"wrapper": """<html>
<head>
<link rel="stylesheet" href="/css" />
<title>{{title}}</title></head>
<body>
{{{content}}}
<hr />
<a href="/">(home)</a> ---
<a href="/{{path}}?edit=1">Edit page</a>
</body>
</html>
""",
"not_found_msg": """<html>
<head><title>Not Found</title></head>
<body>
<h1>Creating page...</h1>
<p>You are currently creating the page {{path}}. When you
are finished, <a href="{{path}}">click here</a> to load
the page.</p>
</body>
</html>""",
"editing_msg": """<html>
<head><title>Editing page</title></head>
<body>
<h1>Editing page...</h1>
<p>You are currently editing the page '{{path}}'. When you
are finished, <a href="{{path}}">click here</a> to load
the page.</p>
</body>
</html>"""}
template_files = {
"css": "css",
"wrapper": "wrapper.html",
"not_found_msg": "not_found_msg.html",
"editing_msg": "editing_msg.html"
}
init_index = """SlickWiki Personal Wiki
======================================================================
This personal wiki allows you to write in Markdown in your favorite
editor, organizing the pages as you like. It is simple to use and
easy to configure.
You have already initialized a wiki and got it running; what else can
you do?
- [Edit this page](/index?edit=1)
- Create new pages
- Add a link to a new page
- Follow the link to add content
- View a [rundown of markdown](https://daringfireball.net/projects/markdown/syntax)
- View the [configuration guide](/slickwiki_config_guide)
I hope you enjoy SlickWiki!
"""
default_config = r"""{
"initPageText": "",
"portNumber": 8080,
"editorCommand": "x-terminal-emulator -e sensible-editor \"{{path}}\""
}
"""
favicon = """000001000100c8c8020001000100f02b00001600000028000000c8000000900100000100010000000000000000000000000000000000000000000000000000000000ffffff00ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffc07fffffffffff000000ffffffffffffffffffffffffffff01ffffff803fffffffffff000000fffffffffffffffffffffffffffc00ffffff001fffffffffff000000fffffffffffffffffffffffffff8007ffffe001fffffffffff000000fffffffffffffffffffffffffff0003ffffe001fffffffffff000000fffffffffffffffffffffffffff0001ffffc001fffffffffff000000fffffffffffffffffffffffffff0000ffffc001fffffffffff000000fffffffffffffffffffffffffff0000ffff8001fffffffffff000000ffffffffffffffffe03ffffffff0000ffff0000fffffffffff000000ffffffffffffffffc01fffffffe00007ffe0000fffffffffff000000ffffffffffffffff800fffffffe00003ffe00007ffffffffff000000ffffc07fffffffff800fffffffe00003ffc00007ffffffffff000000ffff803fffffffff800fffffffe00003ffc00003ffffffffff000000ffff001fffffffff800fffffffc00003ffc00003ffffffffff000000ffff001fffffffff800fffffff800003ff800003ffffffffff000000ffff001fffffffff800fffffff800003ff800003ffffffffff000000ffff001fffffffff800fffffff800003ff000003ffffffffff000000ffff001fffffffffc01fffffff000003fe000003ffffffffff000000ffff001fffffffffe03ffffffe000003fc000001ffffffffff000000ffff001ffffffffffffffffffe000003f8000000ffffffffff000000ffff803ffffffffffffffffffe000003f0000000ffffffffff000000ffffc07ffffffffffffffffffe000003e0000000ffffffffff000000fffffffffffffffffffffffffc000003c00000007fffffffff000000fffffffffffffffffffffffffc000003c00000007fffffffff000000fffffffffffffffffffffffff8002003c00030007fffffffff000000fffffffffffffffffffffffff0002003800078007fffffffff000000fffffffffffffffffffffffff00020038000f8003fffffffff000000ffffffffffffffffffffffffe00020018001f8003fffffffff000000ffffffffffffffffffffffffe00060010003fc001fffffffff000000ffffffffffffffffffffffffc00060010007fc001fffffffff000000ffffffffffffffffffffffffc000e0000007fc001fffffffff000000ffffffffffffffffffffffff8001e000000ffc000fffffffff000000ffffffffffffffffffffffff0001e000000ffe0007ffffffff000000fffffffffffffffffffffffe0003f000000ffe0003ffffffff000000fffffffffffffffffffffffc0003f000001fff0003ffffffff000000fffffffffffffffffffffffc0007f000001fff0003ffffffff000000fffffffffffffffffffffff80007f800003fff0001ffffffff000000fffffffffffffffffffffff0000ff800003fff8001ffffffff000000ffffffffffffffffffffffe0001ff800007fff8001ffffffff000000ffffffffffffffffffffffe0003ffc00007fffc001ffffffff000000ffffffffffffffffffffffc0007ffc00007fffe001ffffffff000000ffffffffffffffffffffffc0007ffc0000ffffe000ffffffff000000ffffffffffffffffffffff8000fffe0000fffff000ffffffff000000ffffffffffffffffffffff8001ffff0000fffff000ffffffff000000ffffffffffffffffffffff8003ffff8000fffff000ffffffff000000ffffffffffffffffffffff8003ffff8001fffff000ffffffff000000ffffffffffffffffffffff8007ffff8001fffff000ffffffff000000ffffffffffffffffffffff8007ffff8001fffff800ffffffff000000ffffffffffffffffffffff800fffff8001fffff800ffffffff000000ffffffffffffffffffffff800fffffc001fffff8007fffffff000000ffffffffffffffffffffff800fffffe003fffff8007fffffff000000ffffffffffffffffffffff800ffffff007fffff8007fffffff000000ffffffffffffffffffffff000ffffff80ffffff8007fffffff000000ffffffffff01fffffffffe000ffffffffffffff8007fffffff000000fffffffffe00fffffffffe000ffffffffffffff8007fffffff000000fffffffffc007ffffffffe000ffffffffffffffc007fffffff000000fffffffffc007ffffffffe000ffffffffffffffc007fffffff000000fffffffffc007ffffffffe000ffffffffffffffc007fffffff000000fffffffffc007ffffffffe001ffffffffffffffc007fffffff000000fffffffffc007ffffffffe003ffffffffffffffc007fffffff000000fffffffffc007ffffffffe003ffffffffffffffc007fffffff000000fffffffffc007ffffffffe003ffffffffffffffc007fffffff000000fffffffffe00fffffffffe003ffffffffffffffc007fffffff000000ffffffffff01fffffffffe003ffffffffffffffc007fffffff000000fffffffffffffffffffffe003ffffffffffffffc007fffffff000000fffffffffffffffffffffe003ffffffffffffffc007fffffff000000fffffffffffffffffffffe003ffffffffffffffc007fffffff000000fffffffffffffffffffffe003ffffffffffffffc007fffffff000000fffffffffffffffffffffe003ffffffffffffffc007fffffff000000fffffffffffffffffffffe003ffffffffffffffc007fffffff000000fffffffffffffffffffffe003ffffffffffffffc007fffffff000000fffffffffffffffffffffe003ffffffffffffffc007fffffff000000ffffffffffffffffffffff007ffffffffffffffc007fffffff000000ffffffffffffffffffffff80fffffffffffffffc007fffffff000000fffffffffffffffffffffffffffffffffffffffc007fffffff000000fffffffffffffffffffffffffffffffffffffffc007fffffff000000fffffffffffffffffffffffffffffffffffffffe00ffffffff000000ffffffffffffffffffffffffffffffffffffffff01ffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000fffffffffc00001fffffffffffffffffffffffffffffffffff000000fffffffff8000007ffffffffffffffffffffffffffffffffff000000fffffffff00000003fffffffffffffffffffffffffffffffff000000fffffffff00000001fffffffffffffffffffffffffffffffff000000ffffffffe000000001ffffffffffffffffffffffffffffffff000000ffffffffc000000000ffffffffffffffffffffffffffffffff000000ffffffff80000000007fffffffffffffffffffffffffffffff000000ffffffff00000000003fffffffffffffffffffffffffffffff000000ffffffff00000000001fffffffffffffffffffffffffffffff000000ffffffff00000000000fffffffffffffffffffffffffffffff000000fffffffe000000000007ffffffffffffffffffffffffffffff000000fffffffc0007f8000007ffffffffffffffffffffffffffffff000000fffffff8000ffe000007ffffffffffffffffffffffffffffff000000fffffff8001ffff00007ffffffffffffffffffffffffffffff000000fffffff0001ffff80007ffffffffffffffffffffffffffffff000000ffffffe0001fffff8007ffffffffffffffffffffffffffffff000000ffffffc0001fffffc007ffffffffffffffffffffffffffffff000000ffffffc0003fffffc007ffffffffffffffffffffffffffffff000000ffffff80007fffffc007ffffffffffffffffffffffffffffff000000ffffff0000ffffffc007ffffffffffffffffffffffffffffff000000ffffff0000ffffffc007ffffffffffffffffffffffffffffff000000ffffff0001ffffffc007ffffffffffffffffffffffffffffff000000ffffff0003ffffffc007ffffffffffffffffffffffffffffff000000ffffff0007ffffffc007ffffffffffffffffffffffffffffff000000ffffff0007ffffffc007ffffffffffffffffffffffffffffff000000ffffff000fffffffc007ffffffffffffffffffffffffffffff000000ffffff801fffffffc007ffffffffffffffffffffffffffffff000000ffffffc03fffffffc007ffffffffffffffffffffffffffffff000000ffffffffffffffffc007ffffffffffffffffffffffffffffff000000ffffffffffffffffc007ffffffffffffffffffffffffffffff000000ffffffffffffffffc007ffffffffffffffffffffffffffffff000000ffffffffffffffffc007fffffffffffffffffff80fffffffff000000ffffffffffffffffc007fffffe03fffffffffff007ffffffff000000ffffffffffffffffc007fffffc01ffffffffffe003ffffffff000000ffffffffffffffffc007fffff800ffffffffffe003ffffffff000000ffffffffffffffffc007fffff800ffffffffffe003ffffffff000000ffffffffffffffffc007fffff800ffffffffffe003ffffffff000000ffffffffffffffffc007fffff800ffffffffffe003ffffffff000000ffffffffffffffff8007fffff800ffffffffffe003ffffffff000000fffffffffe0003ff8007fffff800ffffffffffe003ffffffff000000fffffffff00001ff8007fffff800fffffffffff007ffffffff000000ffffffffe000003f0007fffffc01fffffffffff80fffffffff000000ffffffffc00000000007fffffe03ffffffffffffffffffffff000000ffffffff800000000007ffffffffffffffffffffffffffffff000000fffffffe000000000007ffffffffffffffffffffffffffffff000000fffffffc00000000000fffffffffffffffffffffffffffffff000000fffffff800000000000fffffffffffffffffffffffffffffff000000ffffffe000000000000fffffffffffffffffffffffffffffff000000ffffffc000000000001fffffffffffffffffffffffffffffff000000ffffff8000000000003fffffffffffffffffffffffffffffff000000ffffff8000030000007fffffffffffffffffffffffffffffff000000ffffff80001f800000ffffffffffffffffffffffffffffffff000000ffffff00003ff00003ffffffffffffffffffffffffffffffff000000ffffff0000ffffffffffffffffffffffffffffffffffffffff000000fffffe0001ffffffffffffffffffffffffffffffffffffffff000000fffffe0003ffffffffffffffffffffffffffffffffffffffff000000fffffe0007ffffffffffffffffffffffffffffffffffffffff000000fffffe000fffffffffffffffffffffffffffffffffffffffff000000fffffe001fffffffffffffffffffffffffffffffffffffffff000000fffffe001fffffffffffffffffffffffffffffffffffffffff000000fffffe003fffffffffffffffffffffffffffffffffffffffff000000fffffe003fffffffffffffffffffffffffffffffffffffffff000000fffffe003fffffffffffffffffffffffffffffffffffffffff000000fffffe003fffffffffffffffffffffffffffffffffffffffff000000fffffe003fffffffffffffffffffffffffffffffffffffffff000000fffffe003fffffffffffffffffffffffffffffffffffffffff000000fffffe003fffffffffffffffffffffffffffffffffffffffff000000fffffe003fffffffffffffffffffffffffffffffffffffffff000000fffffe003fffffffffffffffffffffffffffffffffffffffff000000fffffe003fffffffffffffffffffffffffffffffffffffffff000000fffffe003fffffffffffffffffffffffffffffffffffffffff000000fffffe001fffffffffffffffffffffffffffffffffffffffff000000fffffe001fffffffffffffffffffffffffffffffffffffffff000000fffffe000fffffffffffffffffffffffffffffffffffffffff000000fffffe0007fffffff01fffffffffffffffffffffffffffffff000000fffffe0007ffffffe00ffffffffffffe03ffffffffffffffff000000fffffe0003ffffff8007fffffffffffc01ffffffffffffffff000000ffffff0001ffffff0007fffffffffff800ffffffffffffffff000000ffffff0000fffffe0007fffffffffff800ffffffffffffffff000000ffffff00007ffff80007fffffffffff800ffffffffffffffff000000ffffff80003ffff00007fffffffffff800ffffffffffffffff000000ffffffc0001fff000007fffffffffff800ffffffffffffffff000000ffffffc0000ffc000007fffffffffff800ffffffffffffffff000000ffffffe00007f000000ffffffffffff800ffffffffffffffff000000fffffff000000000000ffffffffffffc01ffffffffffffffff000000fffffff800000000001ffffffffffffe03ffffffffffffffff000000fffffffc00000000003fffffffffffffffffffffffffffffff000000fffffffe0000000000ffffffffffffffffffffffffffffffff000000ffffffff0000000001ffffffffffffffffffffffffffffffff000000ffffffff8000000003ffffffffffffffffffffffffffffffff000000ffffffffc00000001fffffffffffffffffffffffffffffffff000000ffffffffe00000003fffffffffffffffffffffffffffffffff000000fffffffff8000001ffffffffffffffffffffffffffffffffff000000fffffffffc000007ffffffffffffffffffffffffffffffffff000000fffffffffe00003fffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"""
| 294.409639 | 22,556 | 0.96943 | 264 | 24,436 | 89.67803 | 0.462121 | 0.000845 | 0.001647 | 0.001267 | 0.007772 | 0.007772 | 0.005913 | 0.005913 | 0.005913 | 0.005913 | 0 | 0.586408 | 0.013014 | 24,436 | 82 | 22,557 | 298 | 0.395223 | 0 | 0 | 0.194444 | 0 | 0 | 0.991324 | 0.930676 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
a6808090cd71b53568e299ad31800517d03b49a8 | 182 | py | Python | toby20-day3/code for character.py | toby20-meet/meet2018y1lab3 | 4e86a9010327f6ce36c52ee5786b02a0fb4e4b4e | [
"MIT"
] | null | null | null | toby20-day3/code for character.py | toby20-meet/meet2018y1lab3 | 4e86a9010327f6ce36c52ee5786b02a0fb4e4b4e | [
"MIT"
] | null | null | null | toby20-day3/code for character.py | toby20-meet/meet2018y1lab3 | 4e86a9010327f6ce36c52ee5786b02a0fb4e4b4e | [
"MIT"
] | null | null | null | print("Instructor Alex asks, \"what are you learning today?\" \n The students replied, 'We are learning how to print!' \n We can type print(\"\\\Day1\\\\\") to print out \\Day1\\.")
| 91 | 181 | 0.664835 | 29 | 182 | 4.172414 | 0.689655 | 0.115702 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012903 | 0.148352 | 182 | 1 | 182 | 182 | 0.767742 | 0 | 0 | 0 | 0 | 1 | 0.697802 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 7 |
5b63b6563d7cf14571e5378d6123cddaaa507be7 | 2,892 | py | Python | rest-apis/format.py | fishermano/QShield | 745da3870240e0cab6ab75deebd128eb08b45bac | [
"Apache-2.0"
] | 2 | 2021-09-17T11:04:01.000Z | 2021-09-17T11:04:03.000Z | rest-apis/format.py | fishermano/qshield | 745da3870240e0cab6ab75deebd128eb08b45bac | [
"Apache-2.0"
] | null | null | null | rest-apis/format.py | fishermano/qshield | 745da3870240e0cab6ab75deebd128eb08b45bac | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'CYX'
############################################################################################
# format for data results
#
# code: 200(ok); 204(not found); 401(unauthorized); 500(error);
# ok: true(has results); false(no results);
# msg: information about the status
# needLogin: true(need authorization); false(not need authorization);
# p: current page
# pcount: data count per page
# data: data entity
############################################################################################
def data_res_format(*, code = 200, msg = '', data = None):
return {
'code': code,
'msg': msg,
'data': data
}
############################################################################################
# format for data items number
#
# code: 200(ok); 204(not found); 401(unauthorized); 500(error);
# ok: true(has results); false(no results);
# msg: information about the status
# needLogin: true(need authorization); false(not need authorization);
# totalDataCount: the total data count of the results
############################################################################################
def items_num_format(*, code = 200, ok = True, msg = '', need_login = False, total_data_count = 0):
return {
'code': code,
'ok': ok,
'msg': msg,
'needLogin': need_login,
'totalDataCount': total_data_count
}
############################################################################################
# repo format for data items number
#
# code: 200(ok); 204(not found); 401(unauthorized); 500(error);
# ok: true(has results); false(no results);
# msg: information about the status
# needLogin: true(need authorization); false(not need authorization);
# totalDataCount: the total data count of the results
############################################################################################
def repo_items_num_format(*, code = 200, ok = True, msg = '', need_login = False, total_data_count = {}):
return {
'code': code,
'ok': ok,
'msg': msg,
'needLogin': need_login,
'totalDataCount': total_data_count
}
############################################################################################
# repo format for data results
#
# code: 200(ok); 204(not found); 401(unauthorized); 500(error);
# ok: true(has results); false(no results);
# msg: information about the status
# needLogin: true(need authorization); false(not need authorization);
# p: current page
# pcount: data count per page
# data: data entity
############################################################################################
def repo_data_res_format(*, code = 200, ok = True, msg = '', need_login = False, p = 0, pcount = 0, data = None):
return {
'code': code,
'ok': ok,
'msg': msg,
'needLogin': need_login,
'p': p,
'pcount': pcount,
'data': data
}
| 34.023529 | 113 | 0.492739 | 298 | 2,892 | 4.687919 | 0.184564 | 0.040086 | 0.045097 | 0.034359 | 0.934145 | 0.893343 | 0.893343 | 0.893343 | 0.893343 | 0.867573 | 0 | 0.02621 | 0.142462 | 2,892 | 84 | 114 | 34.428571 | 0.537097 | 0.432227 | 0 | 0.666667 | 0 | 0 | 0.122706 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.121212 | false | 0 | 0 | 0.121212 | 0.242424 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 7 |
5bea87f521e6868e06b979f7a9698c9bfa321b29 | 5,617 | py | Python | LOL.py | mphor/random-league-team | d5755dc1a0a064855ac0e141ae1da8af1d1eadeb | [
"MIT"
] | 1 | 2017-04-21T23:17:42.000Z | 2017-04-21T23:17:42.000Z | LOL.py | mphor/random-league-team | d5755dc1a0a064855ac0e141ae1da8af1d1eadeb | [
"MIT"
] | null | null | null | LOL.py | mphor/random-league-team | d5755dc1a0a064855ac0e141ae1da8af1d1eadeb | [
"MIT"
] | null | null | null | import random
alll = input("All: 0 = Random 1 = Assasin 2 = Fighter 3 = Mage 4 = Marksman 5 = Support 6 = Tank 7 = Options: ")
if alll==0:
print('TOP:' + random.choice(list(open('lol_char.txt'))))
print('MID:' + random.choice(list(open('lol_char.txt'))))
print('ADC:' + random.choice(list(open('lol_char.txt'))))
print('SUP:' + random.choice(list(open('lol_char.txt'))))
print('JG:' + random.choice(list(open('lol_char.txt'))))
elif alll==1:
print('TOP:' + random.choice(list(open('Ass.txt'))))
print('MID:' + random.choice(list(open('Ass.txt'))))
print('ADC:' + random.choice(list(open('Ass.txt'))))
print('SUP:' + random.choice(list(open('Ass.txt'))))
print('JG:' + random.choice(list(open('Ass.txt'))))
elif alll==2:
print('TOP:' + random.choice(list(open('Fight.txt'))))
print('MID:' + random.choice(list(open('Fight.txt'))))
print('ADC:' + random.choice(list(open('Fight.txt'))))
print('SUP:' + random.choice(list(open('Fight.txt'))))
print('JG:' + random.choice(list(open('Fight.txt'))))
elif alll==3:
print('TOP:' + random.choice(list(open('Mage.txt'))))
print('MID:' + random.choice(list(open('Mage.txt'))))
print('ADC:' + random.choice(list(open('Mage.txt'))))
print('SUP:' + random.choice(list(open('Mage.txt'))))
print('JG:' + random.choice(list(open('Mage.txt'))))
elif alll==4:
print('TOP:' + random.choice(list(open('Marks.txt'))))
print('MID:' + random.choice(list(open('Marks.txt'))))
print('ADC:' + random.choice(list(open('Marks.txt'))))
print('SUP:' + random.choice(list(open('Marks.txt'))))
print('JG:' + random.choice(list(open('Marks.txt'))))
elif alll==5:
print('TOP:' + random.choice(list(open('Sup.txt'))))
print('MID:' + random.choice(list(open('Sup.txt'))))
print('ADC:' + random.choice(list(open('Sup.txt'))))
print('SUP:' + random.choice(list(open('Sup.txt'))))
print('JG:' + random.choice(list(open('Sup.txt'))))
elif alll==6:
print('TOP:' + random.choice(list(open('Tank.txt'))))
print('MID:' + random.choice(list(open('Tank.txt'))))
print('ADC:' + random.choice(list(open('Tank.txt'))))
print('SUP:' + random.choice(list(open('Tank.txt'))))
print('JG:' + random.choice(list(open('Tank.txt'))))
elif alll==7:
top = input("TOP: 0 = Random 1 = Assasin 2 = Fighter 3 = Mage 4 = Marksman 5 = Support 6 = Tank: ")
if top==0:
toop=('TOP:' + random.choice(list(open('lol_char.txt'))))
elif top==1:
toop=('TOP:' + random.choice(list(open('Ass.txt'))))
elif top==2:
toop=('TOP:' + random.choice(list(open('Fight.txt'))))
elif top==3:
toop=('TOP:' + random.choice(list(open('Mage.txt'))))
elif top==4:
toop=('TOP:' + random.choice(list(open('Marks.txt'))))
elif top==5:
toop=('TOP:' + random.choice(list(open('Sup.txt'))))
elif top==6:
toop=('TOP:' + random.choice(list(open('Tank.txt'))))
mid = input("MID: 0 = Random 1 = Assasin 2 = Fighter 3 = Mage 4 = Marksman 5 = Support 6 = Tank: ")
if mid==0:
miid=('MID:' + random.choice(list(open('lol_char.txt'))))
elif mid==1:
miid=('MID:' + random.choice(list(open('Ass.txt'))))
elif mid==2:
miid=('MID:' + random.choice(list(open('Fight.txt'))))
elif mid==3:
miid=('MID:' + random.choice(list(open('Mage.txt'))))
elif mid==4:
miid=('MID:' + random.choice(list(open('Marks.txt'))))
elif mid==5:
miid=('MID:' + random.choice(list(open('Sup.txt'))))
elif mid==6:
miid=('TOP:' + random.choice(list(open('Tank.txt'))))
adc = input("ADC: 0 = Random 1 = Assasin 2 = Fighter 3 = Mage 4 = Marksman 5 = Support 6 = Tank: ")
if adc==0:
adcc=('ADC:' + random.choice(list(open('lol_char.txt'))))
elif adc==1:
adcc=('ADC:' + random.choice(list(open('Ass.txt'))))
elif adc==2:
adcc=('ADC:' + random.choice(list(open('Fight.txt'))))
elif adc==3:
adcc=('ADC:' + random.choice(list(open('Mage.txt'))))
elif adc==4:
adcc=('ADC:' + random.choice(list(open('Marks.txt'))))
elif adc==5:
adcc=('ADC:' + random.choice(list(open('Sup.txt'))))
elif adc==6:
adcc=('ADC:' + random.choice(list(open('Tank.txt'))))
sup = input("SUP: 0 = Random 1 = Assasin 2 = Fighter 3 = Mage 4 = Marksman 5 = Support 6 = Tank: ")
if sup==0:
supp=('SUP:' + random.choice(list(open('lol_char.txt'))))
elif sup==1:
supp=('SUP:' + random.choice(list(open('Ass.txt'))))
elif sup==2:
supp=('SUP:' + random.choice(list(open('Fight.txt'))))
elif sup==3:
supp=('SUP:' + random.choice(list(open('Mage.txt'))))
elif sup==4:
supp=('SUP:' + random.choice(list(open('Marks.txt'))))
elif sup==5:
supp=('SUP:' + random.choice(list(open('Sup.txt'))))
elif sup==6:
supp=('TOP:' + random.choice(list(open('Tank.txt'))))
jg = input("JG: 0 = Random 1 = Assasin 2 = Fighter 3 = Mage 4 = Marksman 5 = Support 6 = Tank: ")
if jg==0:
jgg=('JG:' + random.choice(list(open('lol_char.txt'))))
elif jg==1:
jgg=('JG:' + random.choice(list(open('Ass.txt'))))
elif jg==2:
jgg=('JG:' + random.choice(list(open('Fight.txt'))))
elif jg==3:
jgg=('JG:' + random.choice(list(open('Mage.txt'))))
elif jg==4:
jgg=('JG:' + random.choice(list(open('Marks.txt'))))
elif jg==5:
jgg=('JG:' + random.choice(list(open('Sup.txt'))))
elif jg==6:
jgg=('JG:' + random.choice(list(open('Tank.txt'))))
print toop
print miid
print adcc
print supp
print jgg
| 42.55303 | 112 | 0.568987 | 815 | 5,617 | 3.909202 | 0.051534 | 0.263653 | 0.351538 | 0.439422 | 0.902385 | 0.902385 | 0.852166 | 0.31764 | 0.1199 | 0.097301 | 0 | 0.018839 | 0.187289 | 5,617 | 131 | 113 | 42.877863 | 0.67908 | 0 | 0 | 0 | 0 | 0.048 | 0.245948 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.008 | null | null | 0.32 | 0 | 0 | 0 | null | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
753400eb5650c166accd78449c945f987ee35acc | 156 | py | Python | icevision/models/mmdet/models/deformable_detr/backbones/__init__.py | matt-deboer/icevision | bf886e558cc0c5ba5c84559514b8330c64d72f8d | [
"Apache-2.0"
] | null | null | null | icevision/models/mmdet/models/deformable_detr/backbones/__init__.py | matt-deboer/icevision | bf886e558cc0c5ba5c84559514b8330c64d72f8d | [
"Apache-2.0"
] | null | null | null | icevision/models/mmdet/models/deformable_detr/backbones/__init__.py | matt-deboer/icevision | bf886e558cc0c5ba5c84559514b8330c64d72f8d | [
"Apache-2.0"
] | null | null | null | from icevision.models.mmdet.models.deformable_detr.backbones.resnet_fpn import *
from icevision.models.mmdet.models.deformable_detr.backbones.swin import *
| 52 | 80 | 0.858974 | 21 | 156 | 6.238095 | 0.52381 | 0.198473 | 0.290076 | 0.366412 | 0.80916 | 0.80916 | 0.80916 | 0.80916 | 0 | 0 | 0 | 0 | 0.051282 | 156 | 2 | 81 | 78 | 0.885135 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 10 |
753746feae681dcb7b8be40c6e0a1447cd46568a | 47,622 | py | Python | audit/functions.py | ksator/arista_eos_aud | 30066a82ec99b9ccaf1141c632f8cce59a4af925 | [
"Apache-2.0"
] | null | null | null | audit/functions.py | ksator/arista_eos_aud | 30066a82ec99b9ccaf1141c632f8cce59a4af925 | [
"Apache-2.0"
] | null | null | null | audit/functions.py | ksator/arista_eos_aud | 30066a82ec99b9ccaf1141c632f8cce59a4af925 | [
"Apache-2.0"
] | 1 | 2021-02-21T03:12:39.000Z | 2021-02-21T03:12:39.000Z | import datetime
import os
import json
def device_directories (device, root_dir):
"""Create directories for the device
Create the directories root_dir/device, root_dirdevice/eos_commands, root_dir/device/eos_commands/json, root_dir/device/eos_commands/text, root_dir/device/reports, root_dir/device/reports/main, root_dir/device/reports/failures_only.
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
name of the the directories for the device.
"""
cwd = os.getcwd()
output_directory = os.path.dirname(cwd + "/" + root_dir + "/")
device_directory = output_directory + '/' + device
eos_commands_directory = device_directory + '/' + "eos_commands"
json_directory = eos_commands_directory + '/' + "json"
text_directory = eos_commands_directory + '/' + "text"
reports_directory = device_directory + '/' + "reports"
main_reports_directory = reports_directory + '/' + "main"
failures_only_reports_directory = reports_directory + '/' + "failures_only"
for directory in [output_directory, device_directory, eos_commands_directory, json_directory, text_directory, reports_directory, main_reports_directory, failures_only_reports_directory]:
if not os.path.exists(directory):
os.makedirs(directory)
result = device_directory, eos_commands_directory, json_directory, text_directory, reports_directory, main_reports_directory, failures_only_reports_directory
return result
def str_to_function (audit_str_list):
"""map a list of string into a list of functions
Parameters
----------
audit_str_list : list
list of string
Returns
-------
list
list of functions
"""
map = {'print_hostname': print_hostname, 'print_version': print_version, 'check_inventory': check_inventory, 'check_power': check_power, 'check_cooling': check_cooling, 'check_temperature': check_temperature, 'check_temperature_transceivers': check_temperature_transceivers, 'check_reload_cause_history': check_reload_cause_history, 'check_reload_cause_full': check_reload_cause_full, 'print_lldp': print_lldp, 'check_bgp': check_bgp, 'check_mlag': check_mlag}
audit_func_list = []
for item in audit_str_list :
audit_func_list.append(map[item])
return audit_func_list
def init (device, root_dir):
"""Generates files with the device IP address or hostname.
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
name of the two generated files.
"""
directories = device_directories(device, root_dir)
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
main_report = open(main_reports_directory + '/init.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/init.txt', 'w')
for item in [main_report, failures_only_report]:
item.write ('-'*13 + ' Report for device ' + device + ' ' + '-'*13 + "\n"*2)
item.close()
result = main_report.name, failures_only_report.name
return result
def print_hostname (device, root_dir):
"""Generates files with the device hostname and fqdn.
Required EOS command: show hostname | json
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
name of the two generated files.
"""
directories = device_directories(device, root_dir)
json_directory = directories[2]
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
command = "show hostname"
main_report = open(main_reports_directory + '/print_hostname.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/print_hostname.txt', 'w')
for item in [main_report, failures_only_report]:
item.write('*'*10 + " Device hostname " + '*'*10 + "\n"*2)
item.write('Description: include the device hostname and fqdn\n')
item.write("Required EOS command: " + command + ' | json\n')
item.write("Test failure conditions: This is a report without any test so there is no failure/passing condition\n\n")
f = open(json_directory + '/' + command + '.json', 'r')
data = f.read()
f.close()
data_json = json.loads(data)
hostname = data_json['hostname']
fqdn = data_json['fqdn']
for item in [main_report, failures_only_report]:
item.write('Hostname: ' + hostname + '\n')
item.write('FQDN: ' + fqdn + '\n')
item.write('\n')
item.close()
result = main_report.name, failures_only_report.name
return result
def print_version (device, root_dir):
"""Generates files with some details regarding the device (HW model, SN, SW release, uptime).
Required EOS command: show version | json
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
name of the two generated files.
"""
directories = device_directories(device, root_dir)
json_directory = directories[2]
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
command = "show version"
main_report = open(main_reports_directory + '/print_version.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/print_version.txt', 'w')
for item in [main_report, failures_only_report]:
item.write('*'*10 + " Device details " + '*'*10 + "\n"*2)
item.write('Description: include some details regarding the device (HW model, SN, SW release, uptime)\n')
item.write("Required EOS command: " + command + ' | json\n')
item.write("Test failure conditions: This is a report without any test so there is no failure/passing condition\n\n")
f = open(json_directory + '/' + command + '.json', 'r')
data = f.read()
f.close()
data_json = json.loads(data)
modelName = data_json['modelName']
version = data_json['version']
uptime_seconds = data_json["uptime"]
uptime = str(datetime.timedelta(seconds = int(uptime_seconds)))
serialNumber = data_json["serialNumber"]
for item in [main_report, failures_only_report]:
item.write('Model: ' + modelName + '\n')
item.write('Serial number: ' + serialNumber + '\n')
item.write('Version: ' + version + '\n')
item.write('Uptime: ' + uptime + '\n')
item.write('\n')
item.close()
result = main_report.name, failures_only_report.name
return result
def check_inventory (device, root_dir):
"""Check the hardware inventory and generates files with the tests result.
Required EOS command: show version | json
Test failure conditions: A transceiver test fails if its manufacturer is neither "Arista Networks" nor "Arastra, Inc". A power supply test fails if a power supply slot has no power supply unit inserted.
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
The name of the main report file and the name of the failures_only report file.
"""
directories = device_directories(device, root_dir)
json_directory = directories[2]
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
command = "show inventory"
main_report = open(main_reports_directory + '/check_inventory.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/check_inventory.txt', 'w')
for item in [main_report, failures_only_report]:
item.write('*'*10 + " Device inventory " + '*'*10 + "\n"*2)
item.write('Description: include tests report about the hardware inventory\n')
item.write("Required EOS command: " + command + ' | json\n')
item.write('Test failure conditions: A test fails if the manufacturer of a transceiver is neither "Arista Networks" nor "Arastra, Inc", or if a power supply slot has no power supply unit inserted\n\n')
f = open(json_directory + '/' + command + '.json', 'r')
data = f.read()
f.close()
data_json = json.loads(data)
description = data_json['systemInformation']['description']
for item in [main_report, failures_only_report]:
item.write('Device description: ' + description + '\n')
item.write('\n')
for item in [main_report, failures_only_report]:
item.write('Power Supplies: \n')
at_least_one_test_in_the_loop_failed = False
for ps in data_json['powerSupplySlots']:
slot = str(ps)
name = data_json['powerSupplySlots'][ps]['name']
serialNum = data_json['powerSupplySlots'][ps]['serialNum']
if name == 'Not Inserted':
result = 'FAIL'
at_least_one_test_in_the_loop_failed = True
else:
result = 'PASS'
message = 'Slot: ' + slot + ' *** Model: ' + name + ' *** SN: ' + serialNum + ' *** Result: ' + result + '\n'
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if at_least_one_test_in_the_loop_failed == True:
failures_only_report.write("The other tests succesfully passed\n")
if at_least_one_test_in_the_loop_failed == False:
failures_only_report.write("All tests successfully passed\n")
for item in [main_report, failures_only_report]:
item.write('\n')
item.write('Fan modules: \n')
for fan_module in data_json['fanTraySlots']:
slot = str(fan_module)
name = data_json['fanTraySlots'][fan_module]['name']
main_report.write('Module: ' + slot + ' *** Model: ' + name + '\n')
failures_only_report.write("The script doesnt run tests about the Fans modules ...\n")
for item in [main_report, failures_only_report]:
item.write('\n')
item.write('Transceivers: \n')
at_least_one_test_in_the_loop_failed = False
for transceiver in sorted(data_json["xcvrSlots"]):
transceiver = str(transceiver)
mfgName = data_json['xcvrSlots'][transceiver]['mfgName']
serialNum = data_json['xcvrSlots'][transceiver]['serialNum']
modelName = data_json['xcvrSlots'][transceiver]['modelName']
if (mfgName == 'Arista Networks') or (mfgName == 'Arastra, Inc'):
result = 'PASS'
elif mfgName == 'Not Present':
result = 'PASS'
else:
result = 'FAIL'
at_least_one_test_in_the_loop_failed = True
if mfgName != "Not Present":
message = "Port: " + transceiver + ' *** Manufacturer: ' + mfgName + ' *** Model: ' + modelName + ' *** SN: ' + serialNum + ' *** Result: ' + result + "\n"
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if at_least_one_test_in_the_loop_failed == True:
failures_only_report.write("The other tests succesfully passed\n")
if at_least_one_test_in_the_loop_failed == False:
failures_only_report.write("All tests successfully passed\n")
for item in [main_report, failures_only_report]:
item.write('\n')
item.close()
result = main_report.name, failures_only_report.name
return result
def check_power (device, root_dir):
"""Check the power status and generates files with the tests result.
Required EOS command: show system environment power | json
Test failure conditions: A test fails if the status of a power supply is not ok.
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
The name of the main report file and the name of the failures_only report file.
"""
directories = device_directories(device, root_dir)
json_directory = directories[2]
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
command = "show system environment power"
main_report = open(main_reports_directory + '/check_power.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/check_power.txt', 'w')
for item in [main_report, failures_only_report]:
item.write('*'*10 + " Power supplies status " + '*'*10 + "\n"*2)
item.write('Description: include tests report about the power status\n')
item.write("Required EOS command: " + command + ' | json\n')
item.write("Test failure conditions: A test fails if the status of a power supply is not ok\n\n")
f = open(json_directory + '/' + command + '.json', 'r')
data = f.read()
f.close()
data_json = json.loads(data)
at_least_one_test_in_the_loop_failed = False
for powersupply in data_json['powerSupplies']:
state = data_json['powerSupplies'][powersupply]['state']
if state == 'ok':
result = 'PASS'
else:
result = 'FAIL'
at_least_one_test_in_the_loop_failed = True
message = "Power supply: " + powersupply + ' *** Status: ' + state + ' *** Result: ' + result + "\n"
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if at_least_one_test_in_the_loop_failed == True:
failures_only_report.write("The other tests succesfully passed\n")
if at_least_one_test_in_the_loop_failed == False:
failures_only_report.write("All tests successfully passed\n")
for item in [main_report, failures_only_report]:
item.write('\n')
item.close()
result = main_report.name, failures_only_report.name
return result
def check_cooling (device, root_dir):
"""Check the cooling status and generates files with the tests result.
Required EOS command: show system environment cooling | json
Test failure conditions: A test fails if the status of a fan is not ok.
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
The name of the main report file and the name of the failures_only report file.
"""
directories = device_directories(device, root_dir)
json_directory = directories[2]
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
command = "show system environment cooling"
main_report = open(main_reports_directory + '/check_cooling.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/check_cooling.txt', 'w')
for item in [main_report, failures_only_report]:
item.write('*'*10 + " Cooling status " + '*'*10 + "\n"*2)
item.write('Description: include tests report about the cooling status\n')
item.write("Required EOS command: " + command + ' | json\n')
item.write("Test failure conditions: A test fails if the status of a fan is not ok\n\n")
f = open(json_directory + '/' + command + '.json', 'r')
data = f.read()
f.close()
data_json = json.loads(data)
for item in [main_report, failures_only_report]:
item.write('Power supplies: \n')
at_least_one_test_in_the_loop_failed = False
for ps in data_json['powerSupplySlots']:
for fan in ps['fans']:
status = fan['status']
label = fan['label']
if status == 'ok':
result = 'PASS'
else:
result = 'FAIL'
at_least_one_test_in_the_loop_failed = True
message = "Fan: " + label + ' *** Status: ' + status + ' *** Result: ' + result + "\n"
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if at_least_one_test_in_the_loop_failed == True:
failures_only_report.write("The other tests succesfully passed\n")
if at_least_one_test_in_the_loop_failed == False:
failures_only_report.write("All tests successfully passed\n")
for item in [main_report, failures_only_report]:
item.write('\nFan modules: \n')
at_least_one_test_in_the_loop_failed = False
for fantrayslot in data_json['fanTraySlots']:
for fan in fantrayslot['fans']:
status = fan['status']
label = fan['label']
if status == 'ok':
result = 'PASS'
else:
result = 'FAIL'
at_least_one_test_in_the_loop_failed = True
message = "Fan: " + label + ' *** Status: ' + status + ' *** Result: ' + result + "\n"
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if at_least_one_test_in_the_loop_failed == True:
failures_only_report.write("The other tests succesfully passed\n")
if at_least_one_test_in_the_loop_failed == False:
failures_only_report.write("All tests successfully passed\n")
for item in [main_report, failures_only_report]:
item.write('\n')
item.close()
result = main_report.name, failures_only_report.name
return result
def check_temperature (device, root_dir):
"""Check the temperature status and generates files with the tests result.
Required EOS command: show system environment temperature | json
Test failure conditions: A sensor test fails if a sensor HW status is not OK or if a sensor alert count is > 0 or if a sensor is currently in alert state. The system temperature test fails if the system status is not OK.
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
The name of the main report file and the name of the failures_only report file.
"""
directories = device_directories(device, root_dir)
json_directory = directories[2]
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
command = "show system environment temperature"
main_report = open(main_reports_directory + '/check_temperature.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/check_temperature.txt', 'w')
for item in [main_report, failures_only_report]:
item.write('*'*10 + " Temperature status " + '*'*10 + "\n"*2)
item.write('Description: include tests report about the temperature status\n')
item.write("Required EOS command: " + command + ' | json\n')
item.write("Test failure conditions: A test fails if a sensor HW status is not OK or if a sensor alert count is > 0 or if a sensor is currently in alert state. The system temperature test fails if the system status is not OK\n\n")
f = open(json_directory + '/' + command + '.json', 'r')
data = f.read()
f.close()
data_json = json.loads(data)
systemStatus = json.loads(data)['systemStatus']
if systemStatus != 'temperatureOk':
result = 'FAIL'
else:
result = 'PASS'
systemStatus = 'ok'
for item in [main_report, failures_only_report]:
item.write("System temperature: \n")
message = "Status: " + systemStatus + ' *** Result: ' + result + '\n'
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if result == 'PASS':
failures_only_report.write("All tests successfully passed\n")
for item in [main_report, failures_only_report]:
item.write("\nSensors: \n" )
at_least_one_test_in_the_loop_failed = False
for sensor in data_json["tempSensors"]:
hwStatus = sensor['hwStatus']
alertCount = sensor['alertCount']
description = sensor['description']
name = sensor['name']
maxTemperature = sensor['maxTemperature']
inAlertState = sensor['inAlertState']
maxTemperatureLastChange_epoch = sensor['maxTemperatureLastChange']
maxTemperatureLastChange = datetime.datetime.fromtimestamp(maxTemperatureLastChange_epoch).strftime("%d %b %Y %H:%M:%S")
if hwStatus != 'ok' or alertCount!= 0 or str(inAlertState) != "False":
result = 'FAIL'
at_least_one_test_in_the_loop_failed = True
else:
result = 'PASS'
message = "Sensor: " + name + ' *** Description: ' + description + ' *** HW status: ' + hwStatus + ' *** Alert count: ' + str(alertCount) + ' *** In alert state: ' + str(inAlertState) + ' *** Max temperature (C): ' + str(int(maxTemperature)) + ' *** Max temperature last change: ' + maxTemperatureLastChange + ' *** Result: ' + result + "\n"
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if at_least_one_test_in_the_loop_failed == True:
failures_only_report.write("The other tests succesfully passed\n")
if at_least_one_test_in_the_loop_failed == False:
failures_only_report.write("All tests successfully passed\n")
for item in [main_report, failures_only_report]:
item.write("\nCard Slot: \n" )
at_least_one_test_in_the_loop_failed = False
for card in data_json["cardSlots"]:
entPhysicalClass = card['entPhysicalClass']
relPos = card['relPos']
for sensor in card["tempSensors"]:
hwStatus = sensor['hwStatus']
alertCount = sensor['alertCount']
description = sensor['description']
name = sensor['name']
maxTemperature = sensor['maxTemperature']
inAlertState = sensor['inAlertState']
maxTemperatureLastChange_epoch = sensor['maxTemperatureLastChange']
maxTemperatureLastChange = datetime.datetime.fromtimestamp(maxTemperatureLastChange_epoch).strftime("%d %b %Y %H:%M:%S")
if hwStatus != 'ok' or alertCount!= 0 or str(inAlertState) != "False":
result = 'FAIL'
at_least_one_test_in_the_loop_failed = True
else:
result = 'PASS'
message = "Sensor: " + name + ' *** Description: ' + description + ' *** Card type: ' + entPhysicalClass + ' *** Card position: ' + relPos + ' *** HW status: ' + hwStatus + ' *** Alert count: ' + str(alertCount) + ' *** In alert state: ' + str(inAlertState) + ' *** Max temperature (C): ' + str(int(maxTemperature)) + ' *** Max temperature last change: ' + maxTemperatureLastChange + ' *** Result: ' + result + "\n"
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if at_least_one_test_in_the_loop_failed == True:
failures_only_report.write("The other tests succesfully passed\n")
if at_least_one_test_in_the_loop_failed == False:
failures_only_report.write("All tests successfully passed\n")
for item in [main_report, failures_only_report]:
item.write('\n')
item.write("Power Supplies: \n" )
at_least_one_test_in_the_loop_failed = False
for item in data_json["powerSupplySlots"]:
for sensor in item["tempSensors"]:
hwStatus = sensor['hwStatus']
alertCount = sensor['alertCount']
description = sensor['description']
name = sensor['name']
maxTemperature = sensor['maxTemperature']
inAlertState = sensor['inAlertState']
maxTemperatureLastChange_epoch = sensor['maxTemperatureLastChange']
maxTemperatureLastChange = datetime.datetime.fromtimestamp(maxTemperatureLastChange_epoch).strftime("%d %b %Y %H:%M:%S")
if hwStatus != 'ok' or alertCount!= 0 or str(inAlertState) != "False":
result = 'FAIL'
at_least_one_test_in_the_loop_failed = True
else:
result = 'PASS'
message = "Sensor: " + name + ' *** Description: ' + description + ' *** HW status: ' + hwStatus + ' *** Alert count: ' + str(alertCount) + ' *** In alert state: ' + str(inAlertState) + ' *** Max temperature (C): ' + str(int(maxTemperature)) + ' *** Max temperature last change: ' + maxTemperatureLastChange + ' *** Result: ' + result + "\n"
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if at_least_one_test_in_the_loop_failed == True:
failures_only_report.write("The other tests succesfully passed\n")
if at_least_one_test_in_the_loop_failed == False:
failures_only_report.write("All tests successfully passed\n")
for item in [main_report, failures_only_report]:
item.write('\n')
item.close()
result = main_report.name, failures_only_report.name
return result
def check_temperature_transceivers (device, root_dir):
"""Check the transceivers temperature status and generates files with the tests result.
Required EOS command: show system environment temperature transceiver | json
Test failure conditions: A test fails if a sensor HW status is not OK or if a sensor alert count is > 0 or if a sensor is currently in alert state.
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
The name of the main report file and the name of the failures_only report file.
"""
directories = device_directories(device, root_dir)
json_directory = directories[2]
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
command = "show system environment temperature transceiver"
main_report = open(main_reports_directory + '/check_temperature_transceivers.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/check_temperature_transceivers.txt', 'w')
for item in [main_report, failures_only_report]:
item.write('*'*10 + " transceivers temperature status " + '*'*10 + "\n"*2)
item.write('Description: include tests report about the transceivers temperature status\n')
item.write("Required EOS command: " + command + ' | json\n')
item.write("Test failure conditions: A test fails if a sensor HW status is not OK or if a sensor alert count is > 0 or if a sensor is currently in alert state\n\n")
f = open(json_directory + '/' + command + '.json', 'r')
data = f.read()
f.close()
data_json = json.loads(data)
at_least_one_test_in_the_loop_failed = False
for sensor in data_json["tempSensors"]:
hwStatus = sensor['hwStatus']
alertCount = sensor['alertCount']
description = sensor['description']
maxTemperature = sensor['maxTemperature']
inAlertState = sensor['inAlertState']
maxTemperatureLastChange_epoch = sensor['maxTemperatureLastChange']
maxTemperatureLastChange = datetime.datetime.fromtimestamp(maxTemperatureLastChange_epoch).strftime("%d %b %Y %H:%M:%S")
if hwStatus != 'ok' or alertCount!= 0 or str(inAlertState) != "False":
result = 'FAIL'
at_least_one_test_in_the_loop_failed = True
else:
result = 'PASS'
message = 'Description: ' + description + ' *** HW status: ' + hwStatus + ' *** Alert count: ' + str(alertCount) + ' *** In alert state: ' + str(inAlertState) + ' *** Max temperature (C): ' + str(int(maxTemperature)) + ' *** Max temperature last change: ' + maxTemperatureLastChange + ' *** Result: ' + result + "\n"
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if at_least_one_test_in_the_loop_failed == True:
failures_only_report.write("The other tests succesfully passed\n")
if at_least_one_test_in_the_loop_failed == False:
failures_only_report.write("All tests successfully passed\n")
at_least_one_test_in_the_loop_failed = False
for card in data_json["cardSlots"]:
if card['entPhysicalClass'] == "Linecard":
for sensor in card["tempSensors"]:
hwStatus = sensor['hwStatus']
alertCount = sensor['alertCount']
description = sensor['description']
maxTemperature = sensor['maxTemperature']
inAlertState = sensor['inAlertState']
maxTemperatureLastChange_epoch = sensor['maxTemperatureLastChange']
maxTemperatureLastChange = datetime.datetime.fromtimestamp(maxTemperatureLastChange_epoch).strftime("%d %b %Y %H:%M:%S")
if hwStatus != 'ok' or alertCount!= 0 or str(inAlertState) != "False":
result = 'FAIL'
at_least_one_test_in_the_loop_failed = True
else:
result = 'PASS'
message = 'Description: ' + description + ' *** HW status: ' + hwStatus + ' *** Alert count: ' + str(alertCount) + ' *** In alert state: ' + str(inAlertState) + ' *** Max temperature (C): ' + str(int(maxTemperature)) + ' *** Max temperature last change: ' + maxTemperatureLastChange + ' *** Result: ' + result + "\n"
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
for item in [main_report, failures_only_report]:
item.write('\n')
item.close()
result = main_report.name, failures_only_report.name
return result
def check_reload_cause_history (device, root_dir):
"""Check the cause for the last 10 reload and generates files with the tests result.
Required EOS command: show reload cause history | json
Test failure conditions: A test fails if a device reload was not requested by user.
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
The name of the main report file and the name of the failures_only report file.
"""
directories = device_directories(device, root_dir)
json_directory = directories[2]
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
command = "show reload cause history"
main_report = open(main_reports_directory + '/check_reload_cause_history.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/check_reload_cause_history.txt', 'w')
for item in [main_report, failures_only_report]:
item.write('*'*10 + " Reload cause history " + '*'*10 + "\n"*2)
item.write('Description: include tests report about the cause for the last 10 reload\n')
item.write("Required EOS command: " + command + ' | json\n')
item.write("Test failure conditions: A test fails if the device reload was not requested by user\n\n")
f = open(json_directory + '/' + command + '.json', 'r')
data = f.read()
f.close()
data_json = json.loads(data)
at_least_one_test_in_the_loop_failed = False
for reboot_id in range(0,10):
reboot_id = str(reboot_id)
if reboot_id in data_json["resetHistory"]:
for reboot in data_json["resetHistory"][reboot_id]:
description = data_json["resetHistory"][reboot_id][reboot][0]['description']
timestamp_epoch = data_json["resetHistory"][reboot_id][reboot][0]['timestamp']
timestamp = datetime.datetime.fromtimestamp(timestamp_epoch).strftime("%d %b %Y %H:%M:%S")
if description != "Reload requested by the user.":
result = "FAIL"
at_least_one_test_in_the_loop_failed = True
else:
result = "PASS"
message = "Time: " + timestamp + " *** Reason: " + description + " *** Result: " + result + '\n'
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if at_least_one_test_in_the_loop_failed == True:
failures_only_report.write("The other tests succesfully passed\n")
if at_least_one_test_in_the_loop_failed == False:
failures_only_report.write("All tests successfully passed\n")
for item in [main_report, failures_only_report]:
item.write('\n')
item.close()
result = main_report.name, failures_only_report.name
return result
def check_reload_cause_full (device, root_dir):
"""Check the cause for the most recent reload and generates files with the tests result.
Required EOS command: show reload cause full | json
Test failure conditions: The test fails if the device reload was not requested by user.
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
The name of the main report file and the name of the failures_only report file.
"""
directories = device_directories(device, root_dir)
json_directory = directories[2]
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
command = "show reload cause full"
main_report = open(main_reports_directory + '/check_reload_cause_full.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/check_reload_cause_full.txt', 'w')
for item in [main_report, failures_only_report]:
item.write('*'*10 + " Reload cause full " + '*'*10 + "\n"*2)
item.write('Description: include tests report about the cause of the most recent reload\n')
item.write("Required EOS command: " + command + ' | json\n')
item.write("Test failure conditions: The test fails if the device reload was not requested by user\n\n")
f = open(json_directory + '/' + command + '.json', 'r')
data = f.read()
f.close()
data_json = json.loads(data)
at_least_one_test_in_the_loop_failed = False
for item in data_json["resetCauses"]:
description = item['description']
timestamp_epoch = item['timestamp']
timestamp = datetime.datetime.fromtimestamp(timestamp_epoch).strftime("%d %b %Y %H:%M:%S")
if description != "Reload requested by the user.":
result = "FAIL"
at_least_one_test_in_the_loop_failed = True
else:
result = "PASS"
message = "Time: " + timestamp + " *** Reason: " + description + " *** Result: " + result + '\n'
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if at_least_one_test_in_the_loop_failed == True:
failures_only_report.write("The other tests succesfully passed\n")
if at_least_one_test_in_the_loop_failed == False:
failures_only_report.write("All tests successfully passed\n")
for item in [main_report, failures_only_report]:
item.write('\n')
item.close()
result = main_report.name, failures_only_report.name
return result
def print_lldp (device, root_dir):
"""Generates files with the LLDP topology.
Required EOS command: show lldp neighbors | json
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
name of the two generated files.
"""
directories = device_directories(device, root_dir)
json_directory = directories[2]
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
command = "show lldp neighbors"
main_report = open(main_reports_directory + '/print_lldp.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/print_lldp.txt', 'w')
for item in [main_report, failures_only_report]:
item.write('*'*10 + " LLDP topology " + '*'*10 + "\n"*2)
item.write('Description: include the lldp topology\n')
item.write("Required EOS command: " + command + ' | json\n')
item.write("Test failure conditions: This is a report without any test so there is no failure/passing condition\n\n")
f = open(json_directory + '/' + command + '.json', 'r')
data = f.read()
f.close()
data_json = json.loads(data)
for item in data_json['lldpNeighbors']:
neighborDevice = item['neighborDevice']
neighborPort = item['neighborPort']
port = item['port']
for f in [main_report, failures_only_report]:
f.write("Interface: " + port + ' *** LLDP neighbor: ' + neighborDevice + " *** LLDP remote port: " + neighborPort + "\n")
for f in [main_report, failures_only_report]:
f.write('\n')
f.close()
result = main_report.name, failures_only_report.name
return result
def check_bgp (device, root_dir):
"""Check BGP status for all configured vrf and generates files with the tests result.
Required EOS command: show ip bgp summary vrf all | json
Test failure conditions: A test fails if a BGP session is not established.
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
The name of the main report file and the name of the failures_only report file.
"""
directories = device_directories(device, root_dir)
json_directory = directories[2]
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
command = "show ip bgp summary vrf all"
main_report = open(main_reports_directory + '/check_bgp.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/check_bgp.txt', 'w')
for item in [main_report, failures_only_report]:
item.write('*'*10 + " BGP sessions state " + '*'*10 + "\n"*2)
item.write('Description: include tests report about the bgp status for all configured vrf\n')
item.write("Required EOS command: " + command + ' | json\n')
item.write("Test failure conditions: A test fails if a BGP session is not established\n\n")
f = open(json_directory + '/' + command + '.json', 'r')
data = f.read()
f.close()
data_json = json.loads(data)
for vrf in data_json['vrfs']:
vrf = vrf
for item in [main_report, failures_only_report]:
item.write("vrf: " + vrf + "\n")
at_least_one_test_in_the_loop_failed = False
for peer in data_json['vrfs'][vrf]['peers']:
peer = peer
asn = data_json['vrfs'][vrf]['peers'][peer]['asn']
peerState = data_json['vrfs'][vrf]['peers'][peer]['peerState']
upDownTime = datetime.datetime.fromtimestamp(data_json['vrfs'][vrf]['peers'][peer]['upDownTime']).strftime("%d %b %Y %H:%M:%S")
if peerState != 'Established':
result = 'FAIL'
at_least_one_test_in_the_loop_failed = True
else:
result = 'PASS'
message = "Peer: " + peer + " *** ASN: " + asn + " *** State: " + peerState + " *** Up/Down: " + upDownTime + " *** Result: " + result + "\n"
main_report.write(message)
if result == 'FAIL':
failures_only_report.write(message)
if at_least_one_test_in_the_loop_failed == True:
failures_only_report.write("The other tests succesfully passed\n")
if at_least_one_test_in_the_loop_failed == False:
failures_only_report.write("All tests successfully passed\n")
for item in [main_report, failures_only_report]:
item.write('\n')
for item in [main_report, failures_only_report]:
item.write('\n')
item.close()
result = main_report.name, failures_only_report.name
return result
def check_mlag (device, root_dir):
"""Check MLAG state and generates files with the tests result.
Required EOS command: show mlag detail | json
Test failure conditions: The test fails if the MLAG state is active and the negotiation status is not connected.
Parameters
----------
device : str
Device IP address or hostname.
root_dir: str
Root directory for all the outputs.
Returns
-------
tuple
The name of the main report file and the name of the failures_only report file.
"""
directories = device_directories(device, root_dir)
json_directory = directories[2]
main_reports_directory = directories[5]
failures_only_reports_directory = directories[6]
command = "show mlag detail"
main_report = open(main_reports_directory + '/check_mlag.txt', 'w')
failures_only_report = open(failures_only_reports_directory + '/check_mlag.txt', 'w')
for item in [main_report, failures_only_report]:
item.write('*'*10 + " MLAG state " + '*'*10 + "\n"*2)
item.write('Description: include tests report about the mlag status\n')
item.write("Required EOS command: " + command + ' | json\n')
item.write("Test failure conditions: The test fails if the MLAG state is active and the negotiation status is not connected\n\n")
f = open(json_directory + '/' + command + '.json', 'r')
data = f.read()
f.close()
data_json = json.loads(data)
state = data_json["state"]
if state == "active":
negStatus = data_json["negStatus"]
configSanity = data_json["configSanity"]
peerAddress = data_json["peerAddress"]
if negStatus != 'connected':
result = 'FAIL'
elif negStatus == 'connected':
result = 'PASS'
if result == 'FAIL':
for item in [main_report, failures_only_report]:
item.write("Peer: " + peerAddress + "\n")
item.write("State: " + state + "\n")
item.write("Negotiation Status: " + negStatus + "\n")
item.write("Config Sanity: " + configSanity + "\n")
item.write("\nTest result: " + result + "\n")
elif result == 'PASS':
main_report.write("Peer: " + peerAddress + "\n")
main_report.write("State: " + state + "\n")
main_report.write("Negotiation Status: " + negStatus + "\n")
main_report.write("Config Sanity: " + configSanity + "\n")
main_report.write("\nTest result: " + result + "\n")
failures_only_report.write("All tests successfully passed\n")
elif state == "disabled":
for item in [main_report, failures_only_report]:
item.write("MLAG is " + state + "\n")
for item in [main_report, failures_only_report]:
item.write('\n')
item.close()
result = main_report.name, failures_only_report.name
return result
def generate_main_report(dev, topic, root_dir):
"""Generate the main report for a device
Parameters
----------
dev : str
Device IP address or hostname.
topic : list
The list of functions to use to generate the device report
root_dir: str
Root directory for all the outputs.
"""
directories = device_directories(dev, root_dir)
reports_directory = directories[4]
outfile = open(reports_directory + "/main.txt", "w")
infile = open(init(dev, root_dir)[0], "r")
for line in infile:
outfile.write(line)
infile.close()
for item in topic:
infile = open(item(dev, root_dir)[0], "r")
for line in infile:
outfile.write(line)
infile.close()
outfile.close()
def generate_failures_only_report(dev, topic, root_dir):
"""Generate the failure_only report for a device
Parameters
----------
dev : str
Device IP address or hostname.
topic : list
The list of functions to use to generate the device report
root_dir: str
Root directory for all the outputs.
"""
directories = device_directories(dev, root_dir)
reports_directory = directories[4]
outfile = open(reports_directory + "/failures_only.txt", "w")
infile = open(init(dev, root_dir)[1], "r")
for line in infile:
outfile.write(line)
infile.close()
for item in topic:
infile = open(item(dev, root_dir)[1], "r")
for line in infile:
outfile.write(line)
infile.close()
outfile.close()
def assemble_main_reports(devices, topic, root_dir):
"""Assembles the generated main report of each device into one report for all devices
Parameters
----------
devices : list
List of devices IP addresses or hostnames.
topic : list
The list of functions to use to generate the device report
root_dir: str
Root directory for all the outputs.
"""
audit_str_list = []
for item in topic:
audit_str_list.append(item.__name__)
network_report = open(root_dir + "/main.txt", "w")
network_report.write('Report generated using Python the ' + str(datetime.datetime.now().strftime("%d %b %Y at %H:%M:%S")) + "\n"*2)
network_report.write ('The list of devices audited is: ' + str(devices) + '\n')
network_report.write ('The list of topics audited is: ' + str(audit_str_list) + '\n'*2)
network_report.write('The file main.txt shows the details for all the tests.\n')
network_report.write("The file failures_only.txt shows only the tests that failed." + "\n"*2)
for device in devices:
directories = device_directories(device, root_dir)
reports_directory = directories[4]
device_report = open(reports_directory + "/main.txt", "r")
for line in device_report:
network_report.write(line)
device_report.close()
def assemble_failures_only_reports(devices, topic, root_dir):
"""Assembles the generated failures_only report of each device into one report for all devices
Parameters
----------
devices : list
List of devices IP addresses or hostnames.
topic : list
The list of functions to use to generate the device report
root_dir: str
Root directory for all the outputs.
"""
audit_str_list = []
for item in topic:
audit_str_list.append(item.__name__)
network_report_failures_only = open(root_dir + "/failures_only.txt", "w")
network_report_failures_only.write('Report generated using Python the ' + str(datetime.datetime.now().strftime("%d %b %Y at %H:%M:%S")) + "\n"*2)
network_report_failures_only.write ('The list of devices audited is: ' + str(devices) + '\n')
network_report_failures_only.write ('The list of topics audited is: ' + str(audit_str_list) + '\n'*2)
network_report_failures_only.write('The file failures_only.txt shows only the tests that failed.\n')
network_report_failures_only.write("The file main.txt shows the details for all the tests." + "\n"*2)
for device in devices:
directories = device_directories(device, root_dir)
reports_directory = directories[4]
device_report = open(reports_directory + "/failures_only.txt", "r")
for line in device_report:
network_report_failures_only.write(line)
device_report.close()
| 46.324903 | 465 | 0.646466 | 5,892 | 47,622 | 5.020706 | 0.050577 | 0.065716 | 0.0718 | 0.023663 | 0.857109 | 0.829829 | 0.816409 | 0.791123 | 0.77368 | 0.764215 | 0 | 0.003738 | 0.241674 | 47,622 | 1,027 | 466 | 46.37001 | 0.815413 | 0.151002 | 0 | 0.666203 | 0 | 0.011127 | 0.224094 | 0.010933 | 0 | 0 | 0 | 0 | 0 | 1 | 0.026426 | false | 0.065369 | 0.004172 | 0 | 0.05146 | 0.013908 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 7 |
753b79dfd93f1b1b5f157b919140ee5a2ddad959 | 54,645 | py | Python | test/test_table.py | carryLabs/carrydb | f66a8cb93decf65e2e1ad8ddb487ab437275a1c3 | [
"BSD-3-Clause"
] | 5 | 2017-06-19T02:03:11.000Z | 2019-05-13T06:27:57.000Z | test/test_table.py | carryLabs/carrydb | f66a8cb93decf65e2e1ad8ddb487ab437275a1c3 | [
"BSD-3-Clause"
] | null | null | null | test/test_table.py | carryLabs/carrydb | f66a8cb93decf65e2e1ad8ddb487ab437275a1c3 | [
"BSD-3-Clause"
] | 5 | 2017-06-14T08:06:46.000Z | 2019-05-13T06:28:28.000Z | #!/usr/bin/env python
#coding=utf8
import redis
import sys
import json
import unittest
import time
import copy
class TestTableMethods(unittest.TestCase):
#index num:3
data0 = {"fid":"","zone":"01","filename":"zone", "phone":[0, 1, 2, 3, 4, 5], "tags":[1, 2],
"time":20150101, "fsize":11111,"category" : "PIC", "fsha1" : "1e8de28172866b3907d0604a343d3817eed6294f",
"ext" : {"longitude" : "0.0", "duration" : "0", "captureTimeStamp" : "1484898189000"},
"ctime":1488969564, "utime": "1"}
#index num:4
data1 = {"fid":"00001","zone":"01","filename":"file1.jpg", "phone":["1","2","3", "4", "5"], "tags":[1, 2, 3],
"time":20150101, "fsize":11111,"category" : "PIC", "fsha1" : "1636bfdb903f85bb54431c8dd3b3d3721ec96817",
"ext" : {"longitude" : "0.0", "duration" : "0","captureTimeStamp" : "1484898030000"},
"ctime":1488969565, "utime": "2"}
#index num:3
data2 = {"fid":"00002","zone":"01","filename":"file2.jpg", "phone":[2, 3, 4, 5], "tags":[1, 2],
"time":20150101, "fsize":11111,"category" : "REC", "fsha1" : "0d3440f9db0e141a742ea0a598306f2944496016",
"ext" : { "utcTimestamp" : "1480996895", "width" : "3264","captureTimeStamp" : "1485076858919"},
"ctime":1488969566, "utime": "3"}
#index num:3
data3 = {"fid":"00003","zone":"02","filename":"file3.jpg", "phone":[3, 4, 5], "tags":["tiankong", "dadi3"],
"time":20150101, "fsize":11111,"category" : "REC", "fsha1" : "6019f33fdadd1876e204d356df63ec589588632a",
"ext" : { "utcTimestamp" : "1484825452", "width" : "1080", "addressJson" : "", "captureTimeStamp" : "1485138399899"},
"ctime":1488969567, "utime": "4"}
#index num:3
data4 = {"fid":"00004","zone":"02","filename":"file4.jpg", "phone":[4, 5], "tags":["tiankong", "dadi4"],
"time":20150101, "fsize":11111,"category" : "REC", "fsha1" : "05afefa48f5b0436ce2e1a547512127df9e44d8e",
"ext" : {"utcTimestamp" : "1484898030", "width" : "1088", "captureTimeStamp" : "1485136093378"},
"ctime":1488969568, "utime": "5"}
#index num:3
data5 = {"fid":"00005","zone":"02","filename":"file5.jpg", "phone":[5], "tags":["tiankong", "dadi5"],
"time":20150101, "fsize":11111,"category" : "REC", "fsha1" : "4c542076e57d1834a3ffe5d8af3869b54f3fd667",
"ext" : { "utcTimestamp" : "1485136093", "width" : "1080", "captureTimeStamp" : "1486707875000"},
"ctime":1488969569, "utime": "6"}
data01 = {"fid":"","zone":"01","filename":"zone", "phone":[0, 1, 2, 3, 4, 5], "tags":[1, 2],
"time":20150101, "fsize":11111,"category" : "PIC", "fsha1" : "fsha0",
"longitude" : "0.0", "duration" : "0", "width":"1080", "captureTimeStamp" : "1484898189000"}
#index num:4
data11 = {"fid":"00001","zone":"01","filename":"file1.jpg", "phone":["1","2","3", "4", "5"], "tags":[1, 2, 3],
"time":20150101, "fsize":11111,"category" : "PIC", "fsha1" : "fsha1",
"longitude" : "0.0", "duration" : "0", "width":"1088", "captureTimeStamp" : "1484898030000"}
#index num:3
data21 = {"fid":"00002","zone":"01","filename":"file2.jpg", "phone":[2, 3, 4, 5], "tags":[1, 2],
"time":20150101, "fsize":11111,"category" : "REC", "fsha1" : "fsha2",
"utcTimestamp" : "1480996895", "width" : "1080","captureTimeStamp" : "1485076858919"}
#index num:3
data31 = {"fid":"00003","zone":"02","filename":"file3.jpg", "phone":[3, 4, 5], "tags":["tiankong", "dadi3"],
"time":20150101, "fsize":11111,"category" : "REC", "fsha1" : "fsha3",
"utcTimestamp" : "1484825452", "width" : "1080", "addressJson" : "", "captureTimeStamp" : "1485138399899"}
#index num:3
data41 = {"fid":"00004","zone":"02","filename":"file4.jpg", "phone":[4, 5], "tags":["tiankong", "dadi4"],
"time":20150101, "fsize":11111,"category" : "REC", "fsha1" : "fsha0",
"utcTimestamp" : "1484898030", "width" : "1088", "captureTimeStamp" : "1485136093378"}
#index num:3
data51 = {"fid":"00005","zone":"02","filename":"file5.jpg", "phone":[5], "tags":["tiankong", "dadi5"],
"time":20150101, "fsize":11111,"category" : "REC", "fsha1" : "fsha1",
"utcTimestamp" : "1485136093", "width" : "1080", "captureTimeStamp" : "1486707875000"}
master = redis.StrictRedis(host="127.0.0.1", port=8888)
slave = redis.StrictRedis(host="127.0.0.1", port=8889)
#master = redis.StrictRedis(host="10.58.89.236", port=38888)
servers = []
servers.append(master)#主
servers.append(slave) #从
def setUp(self):
#每个测试函数都会进来一次
pass
def createUnionKeyTable(self, list):
self.master.cltp_create("photo_user_1234567",
'''{"primary":[{"name":"zone"},{"name":"fid"}],
"index":[{"name":"time"},{"name":"tags"}],"stat":["fsize"]}''')
self.initServerData(list)
def createUniqueTable(self, list):
self.master.cltp_create("photo_user_1234567",
'''{"primary":[{"name":"fid"}],
"index":[{"name":"time"},{"name":"tags"}, {"name":"fsha1","type":"unique"}],"stat":["fsize"]}''')
self.initServerData(list)
def createNormalTable(self, list):
self.master.cltp_create("photo_user_1234567",
'''{"primary":[{"name":"fid"}],
"index":[{"name":"time"},{"name":"tags"}],"stat":["fsize"]}''')
self.initServerData(list)
def initServerData(self, list):
for i in range(len(list)):
self.assertEqual(self.master.cltp_insert("photo_user_1234567", json.dumps(list[i])),1)
def copyData(self):
list = []
list.append(copy.deepcopy(self.data0))
list.append(copy.deepcopy(self.data1))
list.append(copy.deepcopy(self.data2))
list.append(copy.deepcopy(self.data3))
list.append(copy.deepcopy(self.data4))
list.append(copy.deepcopy(self.data5))
return list
def copyUniqueData(self):
list = []
list.append(copy.deepcopy(self.data01))
list.append(copy.deepcopy(self.data11))
list.append(copy.deepcopy(self.data21))
list.append(copy.deepcopy(self.data31))
list.append(copy.deepcopy(self.data41))
list.append(copy.deepcopy(self.data51))
return list
def dropTable(self):
try:
self.master.cltp_drop("photo_user_1234567")
except Exception, exception:
self.assertEqual(str(exception),'Collection not found')
def cmpGet(self, src, dst):
if dst == None:
self.assertEqual(src, dst)
else:
self.assertDictEqual(json.loads(src), dst)
def cmpFind(self, src, dst):
self.assertEqual(len(src), len(dst))
for i in range(len(src)):
idx = i
self.cmpDict(json.loads(src[idx]), dst[idx])
def cmpStat(self, src, dst):
self.assertDictEqual(json.loads(src), dst)
def cmpDict(self, src_data, dst_data):
if isinstance(src_data,dict):
assert len(src_data) == len(dst_data), "dict len: '{}' != '{}'".format(src_data, dst_data)
for key in src_data:
assert dst_data.has_key(key)
self.cmpDict(src_data[key], dst_data[key])
elif isinstance(src_data,list):
assert len(src_data) == len(dst_data), "list len: '{}' != '{}'".format(src_data, dst_data)
for src_list, dst_list in zip(sorted(src_data), sorted(dst_data)):
self.cmpDict(src_list, dst_list)
else:
assert src_data == dst_data,"value '{}' != '{}'".format(src_data, dst_data)
def print_list(self, list):
for i in range(len(list)):
print list[i]
def print_slave_no(self, id):
if id == 0:
print "master cmd test success"
else:
print "slave cmd test success"
def sum_data_fsize(self, data):
sum = 0
for d in data:
sum += d["fsize"]
return sum
def test_find_data(self):
print "\n--------------------------------test_find_data start--------------------------------"
self.dropTable()
datas = self.copyData()
self.createUnionKeyTable(datas)
time.sleep(1)
for server in self.servers:
#主键查找
self.cmpFind(server.cltp_find("photo_user_1234567", '{"fid":"00001", "zone":"01"}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"fid":"00003", "zone":"qianzhui"}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"fid":"00003", "zone":"02"}'), [datas[3]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
#索引查找 正序,倒序
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}'), [datas[0],datas[1],datas[2]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong", "zone":"02"}', '{"order":-1}'), [datas[5], datas[4], datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
#普通查找
self.cmpFind(server.cltp_find("photo_user_1234567", '{"fid":"00001"}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"zone":"01", "filename":"file2.jpg"}', '{"order":-1}'), [datas[2]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"zone":"01"}', '{"order":-1}'), [datas[2], datas[1], datas[0]])
#find query index
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$in":[1,3]}}', '{"order":-1}'), [datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$in":[0,3]}}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$in":[0,4]}}', '{"order":-1}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1,3]}}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1,4]}}', '{"order":-1}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"phone":{"$in":["1","10"]}}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"phone":{"$in":[0,10]}}', '{"order":-1}'), [datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"phone":{"$in":[10,11]}}', '{"order":-1}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"phone":{"$all":["1","2"]}}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"phone":{"$all":["10","11"]}}', '{"order":-1}'), [])
#覆盖datas[5]
data51 = {"fid":"00005","zone":"02","filename":"file51.jpg", "tags":["tiankong", "dadi51"], "time":20150101, "fsize":11111}
datas[5]["filename"] = 'file51.jpg'
datas[5]["tags"] = ["tiankong", "dadi51"]
datas[5]["time"] = 20150101
datas[5]["fsize"] = 11111
self.assertEqual(self.master.cltp_upsert("photo_user_1234567", json.dumps(data51)),1)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"dadi51"}'), [datas[5]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"dadi5"}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong"}', '{"order":-1}'), [datas[5], datas[4], datas[3]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
print "--------------------------------test_find_data success------------------------------\n"
def test_update_primary_set(self):
print "\n--------------------------------test_update_query_primary_set start-----------------"
self.dropTable()
datas = self.copyData()
self.createUnionKeyTable(datas)
#update normal field
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"", "zone":"01"}',
'{"$set":{"filename":"IMG_0820.JPG", "category":"MOV"}}'),1)
datas[0]["filename"] = "IMG_0820.JPG"
datas[0]["category"] = "MOV"
#根据主键更新主键
#要更新的主键存在
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00001", "zone":"01"}',
'{"$set":{"fid":"00005", "zone":"02", "category":"MOV", "filename":"file5.png"}}'),1)
datas[1]["fid"] = "00005"
datas[1]["zone"] = "02"
datas[1]["category"] = "MOV"
datas[1]["filename"] = "file5.png"
#要更新的主键不存在
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00002", "zone":"01"}',
'{"$set":{"fid":"00006", "zone":"03", "category":"MOV", "filename":"file6.png"}}'),1)
datas[2]["fid"] = "00006"
datas[2]["zone"] = "03"
datas[2]["category"] = "MOV"
datas[2]["filename"] = "file6.png"
time.sleep(1)
for server in self.servers:
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"", "zone":"01"}'), datas[0])
#fid更改了 找不到原先的
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00001", "zone":"01"}'), None)
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00005", "zone":"02"}'), datas[1])
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00002", "zone":"01"}'), None)
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00006", "zone":"03"}'), datas[2])
#索引需要保持
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":-1}'), [datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1, 2]}}', '{"order":-1}'), [datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1, 2, 3]}}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[2], datas[1], datas[4], datas[3], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[2], datas[1], datas[4], datas[3], datas[0]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 55555, '_refcount': 5})
#根据主键更新索引
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00004", "zone":"02"}',
'{"$set":{"tags":["tiankong4", "dadi"], "fsha1":"datas[4]"}}'),1)
datas[4]["tags"] = ["tiankong4","dadi"]
datas[4]["fsha1"] = "datas[4]"
#根据主键更新索引与主键(覆盖其他主键) datas[3]->datas[2]
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00003", "zone":"02"}',
'{"$set":{"tags":["tiankong3", "dadi"], "fsha1":"datas[3]", "fid":"00006", "zone":"03"}}'), 1)
datas[3]["tags"] = ["tiankong3", "dadi"]
datas[3]["fsha1"] = "datas[3]"
datas[3]["fid"] = "00006"
datas[3]["zone"] = "03"
#根据主键更新索引与主键(新建一个主键)
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"", "zone":"01"}',
'{"$set":{"tags":[4, 5, 6], "fid":"", "zone":"04"}}'), 1)
datas[0]["zone"] = "04"
datas[0]["tags"] = [4,5,6]
time.sleep(1)
for server in self.servers:
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"", "zone":"01"}'), None)
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"", "zone":"04"}'), datas[0])
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00003", "zone":"02"}'), None)
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00006", "zone":"03"}'), datas[3])
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00004", "zone":"02"}'), datas[4])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong"}', '{"order":-1}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong3"}', '{"order":-1}'), [datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong4"}', '{"order":-1}'), [datas[4]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"dadi"}', '{"order":-1}'), [datas[3], datas[4]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"zone":"02"}', '{"order":-1}'), [datas[1], datas[4]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 44444, '_refcount': 4})
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[0], datas[3], datas[1], datas[4]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$in":[1,2]}}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":4}', '{"order":-1}'), [datas[0]])
#update index
print "--------------------------------test_update_query_primary_set success---------------\n"
def test_update_incrby(self):
print "\n--------------------------------test_update_incrby start-------------------"
self.dropTable()
datas = self.copyData()
self.createUnionKeyTable(datas)
print "\n--------------------------------test_update_incrby success-------------------"
#根据索引更新普通字段
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":1}',
'{"$incrby":{"fsize":11111}}', '{"multi":true}'),3)
datas[0]["fsize"] += 11111
datas[1]["fsize"] += 11111
datas[2]["fsize"] += 11111
fsize_sum = self.sum_data_fsize(datas)
time.sleep(1)
for server in self.servers:
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"", "zone":"01"}'), datas[0])
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00001", "zone":"01"}'), datas[1])
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00002", "zone":"01"}'), datas[2])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': fsize_sum, '_refcount': len(datas)})
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00003"}',
'{"$incrby":{"fsize":-11111}, "test_incr": -100}', '{"multi":true}'),1)
datas[3]["fsize"] -= 11111
datas[3]["test_incr"] = -100
fsize_sum = self.sum_data_fsize(datas)
time.sleep(1)
for server in self.servers:
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00003", "zone":"02"}'), datas[3])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': fsize_sum, '_refcount': len(datas)})
def test_update_index_set(self):
print "\n--------------------------------test_update_query_index_set start-------------------"
self.dropTable()
datas = self.copyData()
self.createUnionKeyTable(datas)
#根据索引更新普通字段
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":1}',
'{"$set":{"filename":"mov.png"}}', '{"multi":true}'),3)
datas[0]["filename"] = "mov.png"
datas[1]["filename"] = "mov.png"
datas[2]["filename"] = "mov.png"
#根据索引更新主键 不能更新所有主键
try:
self.master.cltp_update("photo_user_1234567", '{"tags":1}', '{"$set":{"fid":"", "zone":"qianzhui"}}')
except Exception, exception:
self.assertEqual(str(exception),'Primary update faild')
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":1}',
'{"$set":{"zone":"03", "category":"MOV"}}', '{"multi":true}'), 3)
datas[0]["zone"] = "03"
datas[1]["zone"] = "03"
datas[2]["zone"] = "03"
datas[0]["category"] = "MOV"
datas[1]["category"] = "MOV"
datas[2]["category"] = "MOV"
time.sleep(1)
for server in self.servers:
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"", "zone":"01"}'), None)
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00001", "zone":"01"}'), None)
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00002", "zone":"01"}'), None)
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"", "zone":"03"}'), datas[0])
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00001", "zone":"03"}'), datas[1])
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"00002", "zone":"03"}'), datas[2])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"category":"MOV"}', '{"order":-1}'), [datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1,2]}}', '{"order":-1}'), [datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[2], datas[1], datas[0], datas[5], datas[4], datas[3]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
#根据索引更新索引
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":1}',
'{"$set":{"tags":[3,4,5], "zone":"04"}}', '{"multi":true}'), 3)
datas[0]["zone"] = "04"
datas[1]["zone"] = "04"
datas[2]["zone"] = "04"
datas[0]["tags"] = [3,4,5]
datas[1]["tags"] = [3,4,5]
datas[2]["tags"] = [3,4,5]
time.sleep(1)
for server in self.servers:
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"", "zone":"03"}'), None)
self.cmpGet(server.cltp_get("photo_user_1234567", '{"fid":"", "zone":"04"}'), datas[0])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":2}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":3}', '{"order":-1}'), [datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[3,4,5]}}', '{"order":-1}'), [datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[2], datas[1], datas[0], datas[5],datas[4],datas[3]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
print "--------------------------------test_update_query_index_set success-----------------\n"
def test_update_unset(self):
print "\n--------------------------------test_update_unset start-----------------------------"
self.dropTable()
datas = self.copyData()
self.createUnionKeyTable(datas)
#根据主键删除普通字段
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"", "zone":"01"}',
'{"$unset":{"category":1, "fsha1":1}}'), 1)
del datas[0]["category"]
del datas[0]["fsha1"]
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"category":"PIC"}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"filename":"zone"}'), [datas[0]])
#根据主键删除索引字段
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00003", "zone":"02"}',
'{"$unset":{"tags":1}}'), 1)
del datas[3]["tags"]
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong"}', '{"order":-1}'), [datas[5], datas[4]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"dadi3"}', '{"order":-1}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[5], datas[4], datas[3], datas[2], datas[1],datas[0]])
#根据索引删除普通字段与设置索引
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":"tiankong"}',
'{"$unset":{"filename":1}, "$set":{"time":20150102}}', '{"multi":true}'), 2)
del datas[4]["filename"]
del datas[5]["filename"]
datas[4]["time"] = 20150102
datas[5]["time"] = 20150102
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong"}', '{"order":-1}'), [datas[5], datas[4]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"dadi4"}', '{"order":-1}'), [datas[4]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"dadi5"}', '{"order":-1}'), [datas[5]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'), [datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150102}', '{"order":-1}'), [datas[5], datas[4]])
print "--------------------------------test_update_unset success---------------------------\n"
def test_update_pull(self):
print "\n--------------------------------test_update_pull start------------------------------"
self.dropTable()
datas = self.copyData()
self.createUnionKeyTable(datas)
#根据主键更新普通数组 $in
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"", "zone":"01"}',
'{"$pull":{"phone":{"$in":[0,1,10]}}}'), 1)
datas[0]["phone"].remove(0)
datas[0]["phone"].remove(1)
#根据主键删除index数组 $all
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00001", "zone":"01"}',
'{"$pull":{"tags":{"$all":[1,2]}}}'), 1)
datas[1]["tags"].remove(2)
datas[1]["tags"].remove(1)
#根据主键删除index数组 $in
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00002", "zone":"01"}',
'{"$pull":{"tags":{"$in":[1,10]}}}'), 1)
datas[2]["tags"].remove(1)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":-1}'), [datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":2}', '{"order":-1}'), [datas[2], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1, 2]}}', '{"order":-1}'), [datas[0]])
#根据索引删除普通数组 $in
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":"tiankong"}',
'{"$pull":{"phone":{"$in":[5, 6]}}}', '{"multi":true}'), 3)
datas[3]["phone"].remove(5)
datas[4]["phone"].remove(5)
datas[5]["phone"].remove(5)
#根据索引删除普通数组 $in 应该是返回0才较对
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":"tiankong"}',
'{"$pull":{"phone":{"$all":[4, 5]}}}', '{"multi":true}'), 3)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong"}', '{"order":-1}'), [datas[5], datas[4], datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":["tiankong", "dadi4"]}}', '{"order":-1}'), [datas[4]])
#根据索引删除索引数组 $all 应该返回1才对
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":"tiankong"}',
'{"$pull":{"tags":{"$all":["tiankong", "dadi4"]}}}', '{"multi":true}'), 3)
datas[4]["tags"].remove("tiankong")
datas[4]["tags"].remove("dadi4")
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong"}', '{"order":-1}'), [datas[5], datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":3}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"dadi5"}', '{"order":-1}'), [datas[5]])
#根据索引删除索引数组 $in
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"time":20150101}',
'{"$pull":{"tags":{"$in":["tiankong", 3, "dadi5"]}}}', '{"multi":true, "cursor":0, "limit":1}'),1)
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"time":20150101}',
'{"$pull":{"tags":{"$in":["tiankong", 3, "dadi5"]}}}', '{"multi":true}'), 6)
datas[1]["tags"].remove(3)
datas[3]["tags"].remove("tiankong")
datas[5]["tags"].remove("tiankong")
datas[5]["tags"].remove("dadi5")
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong"}', '{"order":-1}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"3"}', '{"order":-1}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"datas[5]"}', '{"order":-1}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1, "limit":2, "cursor":1}'), [datas[4], datas[3]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
# #根据索引删除索引数组 $in
print "--------------------------------test_update_pull success----------------------------"
def test_update_pullall(self):
print "\n--------------------------------test_update_pullAll start---------------------------"
self.dropTable()
datas = self.copyData()
self.createUnionKeyTable(datas)
#根据主键删除普通数组
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"", "zone":"01"}',
'{"$pullAll":{"phone":[1,2,3]}}', '{"multi":true}'), 1)
datas[0]["phone"].remove(1)
datas[0]["phone"].remove(2)
datas[0]["phone"].remove(3)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":-1}'), [datas[2], datas[1], datas[0]])
#根据主键删除普通数组
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00001", "zone":"01"}',
'{"$pullAll":{"tags":[1,2,3]}}', '{"multi":true}'), 1)
datas[1]["tags"].remove(1)
datas[1]["tags"].remove(2)
datas[1]["tags"].remove(3)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":-1}'), [datas[2], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":2}', '{"order":-1}'), [datas[2], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1,2]}}', '{"order":-1}'), [datas[2], datas[0]])
#根据索引删除普通数组
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":"tiankong"}',
'{"$pullAll":{"phone":[4, 5]}}', '{"multi":true}'), 3)
datas[3]["phone"].remove(4)
datas[3]["phone"].remove(5)
datas[4]["phone"].remove(4)
datas[4]["phone"].remove(5)
datas[5]["phone"].remove(5)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong"}', '{"order":-1}'), [datas[5], datas[4], datas[3]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
#根据索引删除索引数组
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":"tiankong"}',
'{"$pullAll":{"tags":["tiankong"]}}', '{"multi":true}'), 3)
datas[3]["tags"].remove("tiankong")
datas[4]["tags"].remove("tiankong")
datas[5]["tags"].remove("tiankong")
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong"}', '{"order":-1}'), [])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"dadi3"}', '{"order":-1}'), [datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"dadi4"}', '{"order":-1}'), [datas[4]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"dadi5"}', '{"order":-1}'), [datas[5]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
print "--------------------------------test_update_pullAll success-------------------------\n"
def test_update_push(self):
print "\n--------------------------------test_update_push start------------------------------"
self.dropTable()
datas = self.copyData()
self.createUnionKeyTable(datas)
#根据主键添加普通数组
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"", "zone":"01"}',
'{"$push":{"phone":[1,2,3]}}', '{"multi":true}'), 1)
datas[0]["phone"].append(1)
datas[0]["phone"].append(2)
datas[0]["phone"].append(3)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"fid":""}', '{"order":-1}'), [datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'),
[datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
#根据主键添加索引数组
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00001", "zone":"01"}',
'{"$push":{"tags":[3, 4, 5]}}', '{"multi":true}'), 1)
datas[1]["tags"].append(3)
datas[1]["tags"].append(4)
datas[1]["tags"].append(5)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1,2, 3, 4, 5]}}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[3,4, 5]}}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
#根据索引添加普通数组
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":"tiankong"}',
'{"$push":{"phone":[3,4,5]}}', '{"multi":true}'), 3)
datas[3]["phone"].append(3)
datas[3]["phone"].append(4)
datas[3]["phone"].append(5)
datas[4]["phone"].append(3)
datas[4]["phone"].append(4)
datas[4]["phone"].append(5)
datas[5]["phone"].append(3)
datas[5]["phone"].append(4)
datas[5]["phone"].append(5)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
#根据索引添加索引数组
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":"tiankong"}',
'{"$push":{"tags":[3,4,5]}}', '{"multi":true}'), 3)
datas[3]["tags"].append(3)
datas[3]["tags"].append(4)
datas[3]["tags"].append(5)
datas[4]["tags"].append(3)
datas[4]["tags"].append(4)
datas[4]["tags"].append(5)
datas[5]["tags"].append(3)
datas[5]["tags"].append(4)
datas[5]["tags"].append(5)
time.sleep(3)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":3}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":4}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":5}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1,2,3,4,5]}}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong"}', '{"order":-1}'), [datas[5], datas[4], datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$in":["tiankong", 3]}}', '{"order":-1}'),[datas[5], datas[4], datas[3], datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
print "--------------------------------test_update_push success----------------------------\n"
def test_update_addToSet(self):
print "\n--------------------------------test_update_addToSet start--------------------------"
self.dropTable()
datas = self.copyData()
self.createUnionKeyTable(datas)
#根据主键添加普通数组
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"", "zone":"01"}',
'{"$addToSet":{"phone":[1,2,3]}}', '{"multi":true}'), 1)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"fid":""}', '{"order":-1}'), [datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'),
[datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
#根据主键添加索引数组
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00001", "zone":"01"}',
'{"$addToSet":{"tags":[3, 4, 5]}}', '{"multi":true}'), 1)
datas[1]["tags"].append(4)
datas[1]["tags"].append(5)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1,2, 3, 4, 5]}}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[3,4, 5]}}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
#根据索引添加普通数组
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":"tiankong"}',
'{"$addToSet":{"phone":[3,4,5]}}', '{"multi":true}'), 3)
datas[4]["phone"].append(3)
datas[5]["phone"].append(3)
datas[5]["phone"].append(4)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
#根据索引添加索引数组
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":"tiankong"}',
'{"$addToSet":{"tags":["tiankong",4,5]}}', '{"multi":true}'), 3)
datas[3]["tags"].append(4)
datas[3]["tags"].append(5)
datas[4]["tags"].append(4)
datas[4]["tags"].append(5)
datas[5]["tags"].append(4)
datas[5]["tags"].append(5)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":3}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":4}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":5}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1,2,3,4,5]}}', '{"order":-1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong"}', '{"order":-1}'), [datas[5], datas[4], datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$in":["tiankong", 3]}}', '{"order":-1}'),
[datas[5], datas[4], datas[3], datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":["tiankong", 4]}}', '{"order":-1}'),
[datas[5], datas[4], datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 66666, '_refcount': 6})
print "--------------------------------test_update_addToSet success------------------------\n"
def test_clear(self):
print "\n--------------------------------test_clear start------------------------------------"
self.dropTable()
datas = self.copyData()
self.createUniqueTable(datas)
self.assertEqual(self.master.cltp_clear("photo_user_1234567"),1)
time.sleep(1)
for server in self.servers:
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 0, '_refcount': 0})
print "--------------------------------test_clear success----------------------------------\n"
def test_upsert(self):
print "\n--------------------------------test_upsert start-----------------------------------"
self.dropTable()
datas = self.copyUniqueData()
self.createUniqueTable(datas[:4])
time.sleep(1)
try:
self.assertEqual(self.master.cltp_upsert("photo_user_1234567", json.dumps(datas[4])),1)
self.assertEqual(1,0)#到这出错
except Exception, exception:
self.assertEqual(str(exception),'Unique index conflict')
datas[4]['fsha1'] = 'fsha4'
self.assertEqual(self.master.cltp_upsert("photo_user_1234567", json.dumps(datas[4])),1)
self.assertEqual(self.master.cltp_upsert("photo_user_1234567", json.dumps(datas[4])),0)
time.sleep(1)
for server in self.servers:
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 55555, '_refcount': 5})
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong", "zone":"02"}', '{"order":-1}'), [datas[4], datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[4], datas[3], datas[2], datas[1], datas[0]])
print "--------------------------------test_upsert success---------------------------------\n"
def test_uinque_index(self):
print "\n--------------------------------test_unique_index start-----------------------------"
self.dropTable()
datas = self.copyUniqueData()
self.createUniqueTable(datas[:4])
#唯一索引冲突,不能写入
try:
self.assertEqual(self.master.cltp_insert("photo_user_1234567", json.dumps(datas[4])),1)
self.assertEqual(1,0)#到这出错
except Exception, exception:
self.assertEqual(str(exception),'Unique index conflict')
datas[4]['fsha1'] = 'fsha4'
self.assertEqual(self.master.cltp_insert("photo_user_1234567", json.dumps(datas[4])),1)
self.assertEqual(self.master.cltp_insert("photo_user_1234567", json.dumps(datas[4])),0)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong", "zone":"02"}', '{"order":-1}'), [datas[4], datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[4], datas[3], datas[2], datas[1], datas[0]])
try:
self.assertEqual(self.master.cltp_insert("photo_user_1234567", json.dumps(datas[5])),1)
self.assertEqual(1,0)#到这出错
except Exception, exception:
self.assertEqual(str(exception),'Unique index conflict')
datas[5]['fsha1'] = 'fsha5'
self.assertEqual(self.master.cltp_insert("photo_user_1234567", json.dumps(datas[5])),1)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong", "zone":"02"}', '{"order":-1}'), [datas[5], datas[4], datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[5], datas[4], datas[3], datas[2], datas[1], datas[0]])
print "--------------------------------test_unique_index success---------------------------\n"
def test_update_unique_index(self):
print "\n--------------------------------test_update_unique_index start----------------------"
self.dropTable()
datas = self.copyUniqueData()
self.createUniqueTable(datas[:4])
#唯一索引冲突,不能写入
try:
self.assertEqual(self.master.cltp_insert("photo_user_1234567", json.dumps(datas[4])),1)
self.assertEqual(1,0)#到这出错
except Exception, exception:
self.assertEqual(str(exception),'Unique index conflict')
#删除了唯一索引字段就能写入了
del datas[0]['fsha1']
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":""}', '{"$unset":{"fsha1":1}}'), 1)
self.assertEqual(self.master.cltp_insert("photo_user_1234567", json.dumps(datas[4])),1)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'),
[datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[4], datas[3], datas[2], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1,2]}}', '{"order":-1}'),
[datas[2], datas[1], datas[0]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 55555, '_refcount': 5})
try:
#更新主键并更新唯一索引时,可以更新到原主键的唯一索引,也可以更新到新主键的唯一索引
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00004"}', '{"$set":{"fid":"00005","fsha1":"fsha2"}}'), 1)
self.assertEqual(1,0)#到这出错
except Exception, exception:
self.assertEqual(str(exception),'Unique index conflict')
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":"00004"}', '{"$set":{"fid":"00002","fsha1":"fsha2"}}'), 1)
datas[4]['fsha1'] = 'fsha2'
datas[4]['fid'] = '00002'
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), [datas[3], datas[4], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":-1}'),
[datas[3], datas[4], datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$all":[1,2]}}', '{"order":-1}'),
[datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$in":["tiankong"]}}', '{"order":-1}'),
[datas[3], datas[4]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":{"$in":["dadi4"]}}', '{"order":-1}'),
[datas[4]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"fsha1":"fsha2"}', '{"order":-1}'),
[datas[4]])
self.cmpStat(server.cltp_stat("photo_user_1234567"), {'fsize': 44444, '_refcount': 4})
try:
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":""}', '{"$set":{"fsha1":"fsha2"}}'), 1)
self.assertEqual(1,0)#到这出错
except Exception, exception:
self.assertEqual(str(exception),'Unique index conflict')
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":""}', '{"$set":{"fsha1":"fsha0"}}'), 1)
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"fid":""}', '{"$set":{"fsha1":"fsha0"}}'), 1)
try:
self.assertEqual(self.master.cltp_update("photo_user_1234567",
'{"tags":"tiankong"}', '{"$set":{"fsha1":"fsha3"}}','{"multi":true}'), 0)
self.assertEqual(1,0)#到这出错
except Exception, exception:
self.assertEqual(str(exception),'Unique index conflict')
print "--------------------------------test_update_unique_index success--------------------\n"
def test_start_end(self):
print "\n--------------------------------test_start_end start----------------------"
self.dropTable()
datas = self.copyUniqueData()
self.createNormalTable(datas)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":1, "end":"00004"}'), datas[:5])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":1, "start":"","end":"00004"}'), datas[1:5])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":1, "start":"0000","end":"00004"}'), datas[1:5])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":1, "start":"00001","end":"00004"}'), datas[2:5])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":1, "start":"00001","end":""}'), datas[2:])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":1, "start":"00001"}'), datas[2:])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1, "end":"00004"}'), [datas[5], datas[4]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1, "start":"00005", "end":"00003"}'), [datas[4], datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1, "start":"00005"}'), datas[4::-1])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1}'), datas[::-1])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1, "end":""}'), datas[::-1])
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":-1, "start":"", "end":""}'), datas[::-1])
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":1,"start":"", "end":""}'), datas[1:3])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":1,"start":"", "end":"00001"}'), datas[1:2])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":1, "end":""}'), datas[:3])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":1}'), datas[:3])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":1, "start":"0000", "limit":1}'), datas[1:2])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":1, "start":"0000", "cursor":1}'), datas[2:3])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":-1,"start":"", "end":""}'), [datas[2], datas[1],datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":-1,"start":"00002", "end":""}'), [datas[1],datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":-1,"start":"00002", "end":"00001"}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":-1,"start":"00001", "end":"00001"}'), [])
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":1}', '{"$pull":{"tags":2}}',
'{"order":1,"start":"", "end":"", "multi":true}'), 2)
datas[1]["tags"].remove(2)
datas[2]["tags"].remove(2)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":1, "end":""}'), datas[:3])
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":1}', '{"$pull":{"tags":1}}',
'{"order":1,"start":"", "end":"", "multi":true, "cursor":1}'), 1)
datas[2]["tags"].remove(1)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":2}', '{"order":1, "end":""}'), [datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":1, "end":""}'), datas[:2])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":-1, "end":""}'), [datas[1],datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong", "width":"1080"}',
'{"order":-1,"start":"","end":""}'), [datas[5],datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong","width":"1080"}',
'{"order":-1, "start":"","end":"","cursor":1}'), [datas[3]])
self.assertEqual(self.master.cltp_remove("photo_user_1234567", '{"tags":"tiankong","width":"1080"}',
'{"order":-1,"start":"", "end":"", "multi":true, "cursor":1}'), 1)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong","width":"1080"}',
'{"order":-1, "start":"","end":""}'), [datas[5]])
self.assertEqual(self.master.cltp_insert("photo_user_1234567", json.dumps(datas[3])),1)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong","width":"1080"}',
'{"order":-1, "start":"","end":""}'), [datas[5],datas[3]])
self.assertEqual(self.master.cltp_remove("photo_user_1234567", '{"tags":"tiankong","width":"1080"}',
'{"order":-1,"start":"", "end":"", "multi":true, "cursor":2}'), 0)
self.assertEqual(self.master.cltp_remove("photo_user_1234567", '{"tags":"tiankong","width":"1080"}',
'{"order":-1,"start":"00005", "end":"", "multi":true}'), 1)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong","width":"1080"}',
'{"order":-1, "start":"","end":""}'), [datas[5]])
print "--------------------------------test_start_end end------------------------\n"
def test_cursor(self):
print "\n--------------------------------test_cursor start----------------------"
self.dropTable()
datas = self.copyUniqueData()
self.createNormalTable(datas)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{}', '{"order":1, "cursor":2}'), datas[2:])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1,"width":"1080"}', '{"order":1, "cursor":1}'), [datas[2]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1,"width":"1080"}', '{"order":-1, "cursor":1}'), [datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":-1, "cursor":1}'), [datas[1], datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":-1, "cursor":1,"limit":1}'), [datas[1]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}', '{"order":-1, "cursor":2,"limit":1}'), [datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":"tiankong","width":"1080"}',
'{"order":-1, "cursor":1,"limit":1}'), [datas[3]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"width":"1080"}',
'{"order":-1, "cursor":2,"limit":3}'), [datas[2],datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"width":"1080"}',
'{"order":-1, "limit":3}'), [datas[5], datas[3], datas[2]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"width":"1080"}',
'{"order":-1,"cursor":1, "limit":3}'), [datas[3], datas[2],datas[0]])
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"tags":1,"width":"1080"}', '{"$pull":{"tags":1}}',
'{"order":1, "cursor":1}'), 1)
datas[2]["tags"].remove(1)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}',
'{"order":-1, "cursor":1}'), [datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"time":20150101}', '{"order":1}'), datas)
self.assertEqual(self.master.cltp_update("photo_user_1234567", '{"width":"1080"}', '{"$addToSet":{"tags":[1]}}',
'{"order":-1, "cursor":1,"limit":2,"multi":true}'), 2)
datas[3]["tags"].append(1)
datas[2]["tags"].append(1)
time.sleep(1)
for server in self.servers:
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1}',
'{"order":-1, "cursor":1}'), [datas[2],datas[1],datas[0]])
self.cmpFind(server.cltp_find("photo_user_1234567", '{"tags":1,"width":"1080"}',
'{"order":-1, "cursor":1}'), [datas[2],datas[0]])
print "--------------------------------test_cursor end------------------------\n"
# def test_94_recreate(self):
# print "\n--------------------------------test_recreate start-----------------------------------"
# self.master.cltp_drop("photo_user_1234567")
# datas = self.copyUniqueData()
# time.sleep(1)
# print "--------------------------------test_recreate success---------------------------------\n"
if __name__ == '__main__':
unittest.main()
| 50.597222 | 148 | 0.600018 | 7,186 | 54,645 | 4.419705 | 0.040774 | 0.080762 | 0.143577 | 0.113728 | 0.853841 | 0.81971 | 0.79852 | 0.768136 | 0.758816 | 0.742254 | 0 | 0.103797 | 0.114064 | 54,645 | 1,079 | 149 | 50.644115 | 0.552239 | 0.021393 | 0 | 0.510303 | 0 | 0.003636 | 0.387937 | 0.106135 | 0 | 0 | 0 | 0 | 0.104242 | 0 | null | null | 0.001212 | 0.007273 | null | null | 0.042424 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
7559ea0d4c604443ef4027c728e575737ad06982 | 5,495 | py | Python | app/bin/dltk/core/environment/test_environment.py | splunk/deep-learning-toolkit | 84f9c978d9859a96f6ba566737a5c7102738d13c | [
"Apache-2.0"
] | 11 | 2020-10-13T05:27:59.000Z | 2021-09-23T02:56:32.000Z | app/bin/dltk/core/environment/test_environment.py | splunk/deep-learning-toolkit | 84f9c978d9859a96f6ba566737a5c7102738d13c | [
"Apache-2.0"
] | 48 | 2020-10-15T09:53:36.000Z | 2021-07-05T15:33:24.000Z | app/bin/dltk/core/environment/test_environment.py | splunk/deep-learning-toolkit | 84f9c978d9859a96f6ba566737a5c7102738d13c | [
"Apache-2.0"
] | 4 | 2020-12-04T08:51:35.000Z | 2022-03-27T09:42:20.000Z | import unittest
from dltk.test import *
__all__ = [
"CreateEnvironmentTest",
"DeleteEnvironmentTest",
"ListEnvironmentTestCase",
"EnvironmentParamsTest",
]
@skip_if_required()
class CreateEnvironmentTest(unittest.TestCase):
def runTest(self):
dltk_environment.create(
self.__class__.__name__,
"kubernetes",
delete_if_already_exists=True,
)
@classmethod
def tearDownClass(cls):
dltk_environment.delete(
cls.__name__,
)
@skip_if_required()
class ListEnvironmentTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
dltk_environment.create(
cls.__name__,
"kubernetes",
delete_if_already_exists=True,
)
def runTest(self):
name = self.__class__.__name__
environments = dltk_environment.get_all()
found = False
for e in environments:
if e["name"] == name:
found = True
self.assertTrue(found, "could not find environment %s in %s" % (
name,
environments,
))
@classmethod
def tearDownClass(cls):
dltk_environment.delete(
cls.__name__,
)
@skip_if_required()
class DeleteEnvironmentTest(unittest.TestCase):
def runTest(self):
dltk_environment.create(
self.__class__.__name__,
"kubernetes",
delete_if_already_exists=True,
)
environments = dltk_environment.get_all()
found = False
for e in environments:
if e["name"] == self.__class__.__name__:
found = True
self.assertTrue(found, "could not find environment %s in %s" % (
self.__class__.__name__,
environments,
))
dltk_environment.delete(
self.__class__.__name__,
)
environments = dltk_environment.get_all()
found = False
for e in environments:
if e["name"] == self.__class__.__name__:
found = True
self.assertFalse(found, "found environment %s in %s" % (
self.__class__.__name__,
environments,
))
@classmethod
def tearDownClass(cls):
dltk_environment.delete(
cls.__name__,
skip_if_not_exists=True,
)
@skip_if_required()
class EnvironmentParamsTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
dltk_environment.create(
cls.__name__,
"kubernetes",
delete_if_already_exists=True,
)
def runTest(self):
ingress_mode_param = dltk_environment.get_environment_param(
"ingress_mode",
connector_name="kubernetes"
)
self.assertIsNotNone(ingress_mode_param)
self.assertEqual(ingress_mode_param["name"], "ingress_mode")
self.assertEqual(ingress_mode_param["default"], "node-port")
self.assertEqual(ingress_mode_param["value"], None)
aws_region_name_param = dltk_environment.get_environment_param(
"aws_region_name",
connector_name="kubernetes"
)
self.assertIsNotNone(ingress_mode_param)
self.assertEqual(aws_region_name_param["name"], "aws_region_name")
self.assertEqual(aws_region_name_param["default"], None)
self.assertEqual(aws_region_name_param["value"], None)
ingress_mode_param = dltk_environment.get_environment_param(
"ingress_mode",
environment_name=self.__class__.__name__
)
self.assertIsNotNone(ingress_mode_param)
self.assertEqual(ingress_mode_param["name"], "ingress_mode")
self.assertEqual(ingress_mode_param["default"], "node-port")
self.assertEqual(ingress_mode_param["value"], None)
aws_region_name_param = dltk_environment.get_environment_param(
"aws_region_name",
environment_name=self.__class__.__name__
)
self.assertIsNotNone(ingress_mode_param)
self.assertEqual(aws_region_name_param["name"], "aws_region_name")
self.assertEqual(aws_region_name_param["default"], None)
self.assertEqual(aws_region_name_param["value"], None)
dltk_environment.set_environment_params(
params={
"ingress_mode": "1",
"aws_region_name": "2",
},
environment_name=self.__class__.__name__
)
ingress_mode_param = dltk_environment.get_environment_param(
"ingress_mode",
environment_name=self.__class__.__name__
)
self.assertIsNotNone(ingress_mode_param)
self.assertEqual(ingress_mode_param["name"], "ingress_mode")
self.assertEqual(ingress_mode_param["default"], "node-port")
self.assertEqual(ingress_mode_param["value"], "1")
aws_region_name_param = dltk_environment.get_environment_param(
"aws_region_name",
environment_name=self.__class__.__name__
)
self.assertIsNotNone(ingress_mode_param)
self.assertEqual(aws_region_name_param["name"], "aws_region_name")
self.assertEqual(aws_region_name_param["default"], None)
self.assertEqual(aws_region_name_param["value"], "2")
@classmethod
def tearDownClass(cls):
dltk_environment.delete(
cls.__name__,
skip_if_not_exists=True,
)
| 30.359116 | 74 | 0.624932 | 541 | 5,495 | 5.804067 | 0.110906 | 0.08758 | 0.078662 | 0.06879 | 0.890127 | 0.88121 | 0.876433 | 0.876433 | 0.860828 | 0.860828 | 0 | 0.001013 | 0.281529 | 5,495 | 180 | 75 | 30.527778 | 0.794326 | 0 | 0 | 0.743421 | 0 | 0 | 0.103731 | 0.015651 | 0 | 0 | 0 | 0 | 0.177632 | 1 | 0.065789 | false | 0 | 0.013158 | 0 | 0.105263 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
755a58381794e44d61f88ef5209cee902299fe5f | 370 | py | Python | tests/test_parse_csl.py | voglster/sparkles | 82a7d6f78bc3bd69e76d02e6a0b69f19f449304f | [
"MIT"
] | 1 | 2020-12-04T02:06:49.000Z | 2020-12-04T02:06:49.000Z | tests/test_parse_csl.py | voglster/sparkles | 82a7d6f78bc3bd69e76d02e6a0b69f19f449304f | [
"MIT"
] | null | null | null | tests/test_parse_csl.py | voglster/sparkles | 82a7d6f78bc3bd69e76d02e6a0b69f19f449304f | [
"MIT"
] | 1 | 2020-12-04T02:56:00.000Z | 2020-12-04T02:56:00.000Z | from sparkles import parse_csl
def test_single_item():
assert parse_csl("test") == ["test"]
def test_no_items():
assert parse_csl("") == []
def test_2_items():
assert parse_csl("bob,villa") == ["bob", "villa"]
def test_lowercase():
assert parse_csl("Bob") == ["bob"]
def test_no_lowercase():
assert parse_csl("Bob", lower=False) == ["Bob"]
| 16.818182 | 53 | 0.635135 | 51 | 370 | 4.313725 | 0.352941 | 0.218182 | 0.318182 | 0.231818 | 0.236364 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003289 | 0.178378 | 370 | 21 | 54 | 17.619048 | 0.720395 | 0 | 0 | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | 0 | 0.454545 | 1 | 0.454545 | true | 0 | 0.090909 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 7 |
f382bb1a3a90d000acd7c6e87da5833486b1cf66 | 10,207 | py | Python | src/annalist_root/annalist/tests/test_closurecache.py | gklyne/annalist | 82e7ef2d56a400325e7618fa9e590072ee8a71d3 | [
"MIT"
] | 18 | 2015-02-20T23:09:13.000Z | 2020-11-13T06:06:43.000Z | src/annalist_root/annalist/tests/test_closurecache.py | gklyne/annalist | 82e7ef2d56a400325e7618fa9e590072ee8a71d3 | [
"MIT"
] | 30 | 2015-01-03T09:56:28.000Z | 2021-06-10T20:58:55.000Z | src/annalist_root/annalist/tests/test_closurecache.py | gklyne/annalist | 82e7ef2d56a400325e7618fa9e590072ee8a71d3 | [
"MIT"
] | 5 | 2015-02-02T09:01:23.000Z | 2018-06-14T20:05:28.000Z | from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
"""
Tests for closure cache class.
"""
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2017, G. Klyne"
__license__ = "MIT (http://opensource.org/licenses/MIT)"
import os
import unittest
import logging
log = logging.getLogger(__name__)
from django.conf import settings
from annalist.models.site import Site
from annalist.models.collection import Collection
from annalist.models.closurecache import ClosureCache, Closure_Error
from .AnnalistTestCase import AnnalistTestCase
from .tests import (
TestHost, TestHostUri, TestBasePath, TestBaseUri, TestBaseDir
)
# -----------------------------------------------------------------------------
#
# ClosureCache tests
#
# -----------------------------------------------------------------------------
class ClosureCacheTest(AnnalistTestCase):
"""
Tests for transitive closure calculations in ClosureCache class.
"""
def setUp(self):
self.testsite = Site(TestBaseUri, TestBaseDir)
self.testcoll = Collection(self.testsite, "testcoll")
self.closurecache = ClosureCache(self.testcoll.get_id(), "test:rel")
return
def tearDown(self):
return
def test_empty_closure(self):
self.assertEqual(self.closurecache.get_collection_id(), "testcoll")
self.assertEqual(self.closurecache.get_relation_uri(), "test:rel")
self.assertEqual(self.closurecache.get_values(), set())
self.assertEqual(self.closurecache.fwd_closure("val1"), set())
self.assertEqual(self.closurecache.rev_closure("val2"), set())
return
def test_singleton_closure(self):
self.assertTrue(self.closurecache.add_rel("val1", "val2"))
self.assertEqual(self.closurecache.get_values(), {"val1", "val2"})
self.assertEqual(self.closurecache.fwd_closure("val1"), {"val2"})
self.assertEqual(self.closurecache.rev_closure("val2"), {"val1"})
return
def test_empty_closure_2(self):
self.assertTrue(self.closurecache.add_rel("val1", "val2"))
self.assertFalse(self.closurecache.add_rel("val1", "val2"))
self.closurecache.add_rel("val1", "val2")
self.closurecache.remove_val("val1")
self.assertEqual(self.closurecache.get_values(), set())
self.assertEqual(self.closurecache.fwd_closure("val1"), set())
self.assertEqual(self.closurecache.rev_closure("val2"), set())
return
def test_empty_closure_3(self):
self.assertTrue(self.closurecache.add_rel("val1", "val2"))
self.assertFalse(self.closurecache.add_rel("val1", "val2"))
self.assertTrue(self.closurecache.remove_val("val2"))
self.assertFalse(self.closurecache.remove_val("val2"))
self.assertEqual(self.closurecache.get_values(), set())
self.assertEqual(self.closurecache.fwd_closure("val1"), set())
self.assertEqual(self.closurecache.rev_closure("val2"), set())
return
def test_simple_transitive_closure(self):
self.assertTrue(self.closurecache.add_rel("val1", "val2"))
self.assertTrue(self.closurecache.add_rel("val2", "val3"))
self.assertEqual(self.closurecache.get_values(), {"val1", "val2", "val3"})
self.assertEqual(self.closurecache.fwd_closure("val1"), {"val2", "val3"})
self.assertEqual(self.closurecache.fwd_closure("val2"), {"val3"})
self.assertEqual(self.closurecache.fwd_closure("val3"), set())
self.assertEqual(self.closurecache.rev_closure("val1"), set())
self.assertEqual(self.closurecache.rev_closure("val2"), {"val1"})
self.assertEqual(self.closurecache.rev_closure("val3"), {"val1", "val2"})
return
def test_extended_transitive_closure(self):
self.assertTrue(self.closurecache.add_rel("val1", "val2"))
self.assertTrue(self.closurecache.add_rel("val2", "val3"))
self.assertTrue(self.closurecache.add_rel("val3", "val4"))
self.assertTrue(self.closurecache.add_rel("val3", "val5"))
self.assertEqual(self.closurecache.get_values(), {"val1", "val2", "val3", "val4", "val5"})
self.assertEqual(self.closurecache.fwd_closure("val1"), {"val2", "val3", "val4", "val5"})
self.assertEqual(self.closurecache.fwd_closure("val2"), {"val3", "val4", "val5"})
self.assertEqual(self.closurecache.fwd_closure("val3"), {"val4", "val5"})
self.assertEqual(self.closurecache.fwd_closure("val4"), set())
self.assertEqual(self.closurecache.fwd_closure("val5"), set())
self.assertEqual(self.closurecache.rev_closure("val1"), set())
self.assertEqual(self.closurecache.rev_closure("val2"), {"val1"})
self.assertEqual(self.closurecache.rev_closure("val3"), {"val1", "val2"})
self.assertEqual(self.closurecache.rev_closure("val4"), {"val1", "val2", "val3"})
self.assertEqual(self.closurecache.rev_closure("val5"), {"val1", "val2", "val3"})
return
def test_multipath_transitive_closure(self):
self.assertTrue(self.closurecache.add_rel("val1", "val2"))
self.assertTrue(self.closurecache.add_rel("val2", "val3"))
self.assertTrue(self.closurecache.add_rel("val2", "val4"))
self.assertTrue(self.closurecache.add_rel("val3", "val5"))
self.assertTrue(self.closurecache.add_rel("val4", "val5"))
self.assertEqual(self.closurecache.get_values(), {"val1", "val2", "val3", "val4", "val5"})
self.assertEqual(self.closurecache.fwd_closure("val1"), {"val2", "val3", "val4", "val5"})
self.assertEqual(self.closurecache.fwd_closure("val2"), {"val3", "val4", "val5"})
self.assertEqual(self.closurecache.fwd_closure("val3"), {"val5"})
self.assertEqual(self.closurecache.fwd_closure("val4"), {"val5"})
self.assertEqual(self.closurecache.fwd_closure("val5"), set())
self.assertEqual(self.closurecache.rev_closure("val1"), set())
self.assertEqual(self.closurecache.rev_closure("val2"), {"val1"})
self.assertEqual(self.closurecache.rev_closure("val3"), {"val1", "val2"})
self.assertEqual(self.closurecache.rev_closure("val4"), {"val1", "val2"})
self.assertEqual(self.closurecache.rev_closure("val5"), {"val1", "val2", "val3", "val4"})
return
def test_multipath_closure_remove_path(self):
self.assertTrue(self.closurecache.add_rel("val1", "val2"))
self.assertTrue(self.closurecache.add_rel("val2", "val3"))
self.assertTrue(self.closurecache.add_rel("val2", "val4"))
self.assertTrue(self.closurecache.add_rel("val3", "val5"))
self.assertTrue(self.closurecache.add_rel("val4", "val5"))
self.assertTrue(self.closurecache.remove_val("val4"))
self.assertFalse(self.closurecache.remove_val("val4"))
self.assertEqual(self.closurecache.get_values(), {"val1", "val2", "val3", "val5"})
self.assertEqual(self.closurecache.fwd_closure("val1"), {"val2", "val3", "val5"})
self.assertEqual(self.closurecache.fwd_closure("val2"), {"val3", "val5"})
self.assertEqual(self.closurecache.fwd_closure("val3"), {"val5"})
self.assertEqual(self.closurecache.fwd_closure("val4"), set())
self.assertEqual(self.closurecache.fwd_closure("val5"), set())
self.assertEqual(self.closurecache.rev_closure("val1"), set())
self.assertEqual(self.closurecache.rev_closure("val2"), {"val1"})
self.assertEqual(self.closurecache.rev_closure("val3"), {"val1", "val2"})
self.assertEqual(self.closurecache.rev_closure("val4"), set())
self.assertEqual(self.closurecache.rev_closure("val5"), {"val1", "val2", "val3"})
return
def test_multipath_closure_remove_nexus(self):
self.assertTrue(self.closurecache.add_rel("val1", "val2"))
self.assertTrue(self.closurecache.add_rel("val2", "val3"))
self.assertTrue(self.closurecache.add_rel("val2", "val4"))
self.assertTrue(self.closurecache.add_rel("val3", "val5"))
self.assertTrue(self.closurecache.add_rel("val4", "val5"))
self.assertTrue(self.closurecache.remove_val("val2"))
self.assertFalse(self.closurecache.remove_val("val2"))
self.assertEqual(self.closurecache.get_values(), {"val3", "val4", "val5"})
self.assertEqual(self.closurecache.fwd_closure("val1"), set())
self.assertEqual(self.closurecache.fwd_closure("val2"), set())
self.assertEqual(self.closurecache.fwd_closure("val3"), {"val5"})
self.assertEqual(self.closurecache.fwd_closure("val4"), {"val5"})
self.assertEqual(self.closurecache.fwd_closure("val5"), set())
self.assertEqual(self.closurecache.rev_closure("val1"), set())
self.assertEqual(self.closurecache.rev_closure("val2"), set())
self.assertEqual(self.closurecache.rev_closure("val3"), set())
self.assertEqual(self.closurecache.rev_closure("val4"), set())
self.assertEqual(self.closurecache.rev_closure("val5"), {"val3", "val4"})
return
def test_reflexive_relation(self):
self.assertTrue(self.closurecache.add_rel("val1", "val2"))
with self.assertRaises(Closure_Error):
self.closurecache.add_rel("val1", "val1")
with self.assertRaises(Closure_Error):
self.closurecache.add_rel("val2", "val2")
self.assertEqual(self.closurecache.get_values(), {"val1", "val2"})
return
def test_recursive_relation(self):
self.assertTrue(self.closurecache.add_rel("val1", "val2"))
self.assertTrue(self.closurecache.add_rel("val2", "val3"))
self.assertTrue(self.closurecache.add_rel("val3", "val4"))
self.assertTrue(self.closurecache.add_rel("val3", "val5"))
with self.assertRaises(Closure_Error):
self.closurecache.add_rel("val5", "val1")
with self.assertRaises(Closure_Error):
self.closurecache.add_rel("val3", "val2")
self.assertEqual(self.closurecache.get_values(), {"val1", "val2", "val3", "val4", "val5"})
return
# End.
| 51.812183 | 105 | 0.660233 | 1,122 | 10,207 | 5.849376 | 0.08467 | 0.270608 | 0.193966 | 0.316471 | 0.859668 | 0.829651 | 0.815024 | 0.806643 | 0.778912 | 0.71385 | 0 | 0.026739 | 0.164593 | 10,207 | 196 | 106 | 52.076531 | 0.742934 | 0.024591 | 0 | 0.627329 | 0 | 0 | 0.10195 | 0 | 0 | 0 | 0 | 0 | 0.670807 | 1 | 0.080745 | false | 0 | 0.068323 | 0.006211 | 0.236025 | 0.006211 | 0 | 0 | 0 | null | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 |
f3a56092846f7af60a04e12fbcf26b11f562ecd4 | 8,903 | py | Python | tests/test_depsgraph.py | JanWielemaker/depslint | 816b3ec558b599a75b255e4ec66e142116a91469 | [
"Apache-2.0"
] | 7 | 2018-04-10T16:09:42.000Z | 2021-08-19T13:27:10.000Z | tests/test_depsgraph.py | JanWielemaker/depslint | 816b3ec558b599a75b255e4ec66e142116a91469 | [
"Apache-2.0"
] | 1 | 2018-11-12T17:13:18.000Z | 2018-11-12T17:30:12.000Z | tests/test_depsgraph.py | JanWielemaker/depslint | 816b3ec558b599a75b255e4ec66e142116a91469 | [
"Apache-2.0"
] | 1 | 2018-11-12T16:16:50.000Z | 2018-11-12T16:16:50.000Z | #!/usr/bin/python
#
# Copyright 2013 Maxim Kalaev
#
# 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 unittest
import depslint
from depslint import BuildRule as BR
# Silence all output
depslint._verbose = -1
def e2t(edges):
"""Edges to targets"""
return depslint.sets_union(e.provides for e in edges)
class DepsGraphTestBasics(unittest.TestCase):
build_rules = [
BR(['outA'], ['A1', 'A2'], order_only_deps=['unused1']),
BR(['outB'], ['B1', 'AB'], order_only_deps=['unused2']),
BR(['A2'], ['AB']),
]
def setUp(self):
self.g = depslint.Graph(self.build_rules, [], is_clean_build_graph = False)
def testBuild(self):
g = self.g
self.assertItemsEqual(g.target2edge.keys(), ["outA", "outB", "A2"])
self.assertItemsEqual(g.source2edges.keys(), ["A1", "A2", "B1", "AB"])
self.assertItemsEqual(g.duplicate_target_rules, [])
def testTopTargets(self):
g = self.g
self.assertItemsEqual(g.top_targets, ["outA", "outB"])
def testRanks(self):
g = self.g
self.assertItemsEqual(g.targets_by_ranks.keys(), [0, 1, 2])
self.assertItemsEqual(g.targets_by_ranks[0], ["A1", "B1", "AB"])
self.assertItemsEqual(g.targets_by_ranks[1], ["A2", "outB"])
self.assertItemsEqual(g.targets_by_ranks[2], ["outA"])
def testIsStatic(self):
g = self.g
self.assertTrue(g.is_static_target('A1'))
self.assertTrue(g.is_static_target('B1'))
self.assertTrue(g.is_static_target('AB'))
self.assertFalse(g.is_static_target('A2'))
self.assertFalse(g.is_static_target('outA'))
self.assertFalse(g.is_static_target('outB'))
def testGetPathToTop(self):
g = self.g
self.assertEqual(g.get_any_path_to_top('A1'), ['outA'])
self.assertEqual(g.get_any_path_to_top('A2'), ['outA'])
self.assertEqual(g.get_any_path_to_top('B1'), ['outB'])
self.assertIn(g.get_any_path_to_top('AB'), (['outB'], ['A2','outA']))
def testDepsClosure(self):
g = self.g
self.assertItemsEqual(g.get_deps_closure('AB'), [])
self.assertItemsEqual(g.get_deps_closure('A1'), [])
self.assertItemsEqual(g.get_deps_closure('B1'), [])
self.assertItemsEqual(g.get_deps_closure('A2'), ["AB"])
self.assertItemsEqual(g.get_deps_closure('outA'), ["A1", "A2", "AB"])
self.assertItemsEqual(g.get_deps_closure('outB'), ["B1", "AB"])
def testProductsClosures(self):
g = self.g
self.assertItemsEqual(e2t(g.get_product_rules_closure('A1')), ['outA'])
self.assertItemsEqual(e2t(g.get_product_rules_closure('A2')), ['outA'])
self.assertItemsEqual(e2t(g.get_product_rules_closure('B1')), ['outB'])
self.assertItemsEqual(e2t(g.get_product_rules_closure('AB')), ['outB', 'A2', 'outA'])
class DepsGraphTestWanted(unittest.TestCase):
build_rules = [
BR(['outA'], ['A1', 'A2']),
BR(['outB'], ['B1', 'AB']),
BR(['A2'], ['AB']),
]
def setUp(self):
self.g = depslint.Graph(self.build_rules, targets_wanted=['outA'], is_clean_build_graph = False)
def testBuild(self):
g = self.g
self.assertItemsEqual(g.target2edge.keys(), ["outA", "outB", "A2"])
self.assertItemsEqual(g.source2edges.keys(), ["A1", "A2", "B1", "AB"])
self.assertItemsEqual(g.duplicate_target_rules, [])
def testTopTargets(self):
g = self.g
self.assertItemsEqual(g.top_targets, ["outA"])
def testRanks(self):
g = self.g
self.assertItemsEqual(g.targets_by_ranks.keys(), [0, 1, 2])
self.assertItemsEqual(g.targets_by_ranks[0], ["A1", "AB"])
self.assertItemsEqual(g.targets_by_ranks[1], ["A2"])
self.assertItemsEqual(g.targets_by_ranks[2], ["outA"])
def testIsStatic(self):
g = self.g
self.assertTrue(g.is_static_target('A1'))
self.assertTrue(g.is_static_target('AB'))
self.assertFalse(g.is_static_target('A2'))
self.assertFalse(g.is_static_target('outA'))
# Not wanted
self.assertFalse(g.is_static_target('outB')) # Not static & not wanted
self.assertFalse(g.is_static_target('B1')) # Static, not wanted
def testGetPathToTop(self):
g = self.g
self.assertEqual(g.get_any_path_to_top('A1'), ['outA'])
self.assertEqual(g.get_any_path_to_top('A2'), ['outA'])
self.assertEqual(g.get_any_path_to_top('AB'), ['A2', 'outA'])
# Not wanted
with self.assertRaises(Exception):
g.get_any_path_to_top('B1')
def testDepsClosure(self):
g = self.g
self.assertItemsEqual(g.get_deps_closure('AB'), [])
self.assertItemsEqual(g.get_deps_closure('A1'), [])
self.assertItemsEqual(g.get_deps_closure('A2'), ["AB"])
self.assertItemsEqual(g.get_deps_closure('outA'), ["A1", "A2", "AB"])
# Not wanted
with self.assertRaises(Exception):
g.get_deps_closure('outB')
with self.assertRaises(Exception):
g.get_deps_closure('B1')
def testProductsClosures(self):
g = self.g
self.assertItemsEqual(e2t(g.get_product_rules_closure('A1')), ['outA'])
self.assertItemsEqual(e2t(g.get_product_rules_closure('A2')), ['outA'])
self.assertItemsEqual(e2t(g.get_product_rules_closure('AB')), ['A2', 'outA'])
# Not wanted
with self.assertRaises(Exception):
g.get_product_rules_closure('B1')
class DepsGraphWithPhony(unittest.TestCase):
build_rules = [
BR(['outA'], ['A1', 'A2']),
BR(['A1'], [], rule_name="phony"),
BR(['A2'], ['AB']),
BR(['AB'], [], rule_name="phony"),
BR(['aliasA2'], ['A2'], rule_name="phony"),
]
def setUp(self):
self.g = depslint.Graph(self.build_rules, targets_wanted=[], is_clean_build_graph = False)
def testBuild(self):
g = self.g
self.assertItemsEqual(g.target2edge.keys(), ["outA", "aliasA2", "A2", "A1", "AB"])
self.assertItemsEqual(g.source2edges.keys(), ["A1", "A2", "AB"])
self.assertItemsEqual(g.duplicate_target_rules, [])
def testTopTargets(self):
g = self.g
self.assertItemsEqual(g.top_targets, ["outA", "aliasA2"])
def testRanks(self):
g = self.g
self.assertItemsEqual(g.targets_by_ranks.keys(), [0, 1, 2])
self.assertItemsEqual(g.targets_by_ranks[0], ["A1", "AB"])
self.assertItemsEqual(g.targets_by_ranks[1], ["A2", "aliasA2"])
self.assertItemsEqual(g.targets_by_ranks[2], ["outA"])
def testIsStatic(self):
g = self.g
self.assertTrue(g.is_static_target('A1'))
self.assertTrue(g.is_static_target('AB'))
self.assertFalse(g.is_static_target('A2'))
self.assertFalse(g.is_static_target('outA'))
self.assertFalse(g.is_static_target('aliasA2'))
def testResolvePhony(self):
g = self.g
self.assertItemsEqual(g.resolve_phony(['A1']), ['A1'])
self.assertItemsEqual(g.resolve_phony(['aliasA2', 'A1']), ['A2', 'A1'])
self.assertItemsEqual(g.resolve_phony(['aliasA2', 'A1']), ['A2', 'A1'])
def testGetPathToTop(self):
g = self.g
self.assertIn(g.get_any_path_to_top('A1'), (['outA'],))
self.assertIn(g.get_any_path_to_top('A2'), (['outA'],['aliasA2']))
self.assertIn(g.get_any_path_to_top('AB'), (['A2', 'outA'], ['A2', 'aliasA2']))
self.assertEqual(g.get_any_path_to_top('outA'), [])
self.assertEqual(g.get_any_path_to_top('aliasA2'), [])
def testDepsClosure(self):
g = self.g
self.assertItemsEqual(g.get_deps_closure('AB'), [])
self.assertItemsEqual(g.get_deps_closure('A1'), [])
self.assertItemsEqual(g.get_deps_closure('A2'), ['AB'])
self.assertItemsEqual(g.get_deps_closure('outA'), ['A1', 'A2', 'AB'])
self.assertItemsEqual(g.get_deps_closure('aliasA2'), ['A2', 'AB'])
def testProductsClosures(self):
g = self.g
self.assertItemsEqual(e2t(g.get_product_rules_closure('A1')), ['outA'])
self.assertItemsEqual(e2t(g.get_product_rules_closure('A2')), ['outA', 'aliasA2'])
self.assertItemsEqual(e2t(g.get_product_rules_closure('AB')), ['A2', 'outA', 'aliasA2'])
class DepsGraphMultipleOutputs(unittest.TestCase):
# TODO: highly relevant to trace graphs
pass
| 40.468182 | 104 | 0.628103 | 1,137 | 8,903 | 4.729112 | 0.131926 | 0.193416 | 0.073647 | 0.040915 | 0.805654 | 0.79933 | 0.795053 | 0.771806 | 0.718988 | 0.664869 | 0 | 0.020485 | 0.199483 | 8,903 | 219 | 105 | 40.652968 | 0.733969 | 0.081658 | 0 | 0.646707 | 0 | 0 | 0.06971 | 0 | 0 | 0 | 0 | 0.004566 | 0.508982 | 1 | 0.155689 | false | 0.005988 | 0.017964 | 0 | 0.221557 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
45efef69653dfc21df768b74fee0f6c2f00a32ae | 53,457 | py | Python | tests/auth_test.py | Anti-Counter021/Anti-YouTube-back-end | eca9b26b4a1feb7e516c0164e86c5d6444af8db5 | [
"MIT"
] | null | null | null | tests/auth_test.py | Anti-Counter021/Anti-YouTube-back-end | eca9b26b4a1feb7e516c0164e86c5d6444af8db5 | [
"MIT"
] | null | null | null | tests/auth_test.py | Anti-Counter021/Anti-YouTube-back-end | eca9b26b4a1feb7e516c0164e86c5d6444af8db5 | [
"MIT"
] | null | null | null | import os
import shutil
from unittest import TestCase
import jwt
from fastapi import HTTPException, UploadFile
from fastapi.testclient import TestClient
from pyotp import TOTP
from sqlalchemy import update
from app.app import app
from app.auth.api import (
register,
activate,
login,
refresh,
follow,
unfollow,
create_reset_password,
verify_password_reset,
get_username,
get_data,
change_data,
upload_avatar,
subscriptions,
change_password,
two_auth,
toggle_2step_auth,
)
from app.auth.crud import user_crud, verification_crud
from app.auth.permission import is_authenticated, is_active, is_superuser
from app.auth.schemas import (
RegisterUser,
VerificationUUID,
RefreshToken,
Password,
ChangeUserDataResponse,
ChangeUserData,
ChangePassword,
)
from app.auth.security import verify_password
from app.auth.tokens import ALGORITHM, create_password_reset_token, create_token
from app.config import API_V1_URL, SECRET_KEY, MEDIA_ROOT
from app.db import engine, AsyncSession
from tests import create_all, drop_all, async_loop
class AuthTestCase(TestCase):
def setUp(self) -> None:
self.session = AsyncSession(engine)
self.client = TestClient(app)
self.data = {
'password': 'test1234',
'confirm_password': 'test1234',
'username': 'test',
'email': 'test@example.com',
'about': 'string',
'send_message': True
}
self.video_data = {
'title': 'Anti-YouTube',
'description': 'Hello world!',
'category_id': 1,
}
self.url = API_V1_URL + '/auth'
async_loop(create_all())
os.makedirs(MEDIA_ROOT)
def tearDown(self) -> None:
async_loop(self.session.close())
async_loop(drop_all())
shutil.rmtree(MEDIA_ROOT)
def test_change_password(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
self.assertEqual(verify_password('test1234', async_loop(user_crud.get(self.session, id=1)).password), True)
user = async_loop(user_crud.get(self.session, id=1))
response = async_loop(
change_password(
ChangePassword(password='test12345', confirm_password='test12345', old_password='test1234'),
user,
)
)
async_loop(self.session.commit())
self.assertEqual(response, {'msg': 'Password has been changed'})
self.assertEqual(verify_password('test1234', async_loop(user_crud.get(self.session, id=1)).password), False)
self.assertEqual(verify_password('test12345', async_loop(user_crud.get(self.session, id=1)).password), True)
with self.assertRaises(ValueError) as error:
async_loop(
change_password(
ChangePassword(password='test12345', confirm_password='test12345', old_password='test12345'),
user,
)
)
with self.assertRaises(HTTPException) as error:
async_loop(
change_password(
ChangePassword(password='test12345', confirm_password='test12345', old_password='test'),
user,
)
)
def test_change_password_request(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
self.assertEqual(verify_password('test1234', async_loop(user_crud.get(self.session, id=1)).password), True)
response = self.client.put(
self.url + '/change-password', headers=headers, json={
'old_password': 'test1234',
'password': 'test12345',
'confirm_password': 'test12345',
},
)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), {'msg': 'Password has been changed'})
self.assertEqual(verify_password('test1234', async_loop(user_crud.get(self.session, id=1)).password), False)
self.assertEqual(verify_password('test12345', async_loop(user_crud.get(self.session, id=1)).password), True)
response = self.client.put(
self.url + '/change-password', headers=headers, json={
'old_password': 'test12345',
'password': 'test12345',
'confirm_password': 'test12345',
},
)
self.assertEqual(response.status_code, 422)
self.assertEqual(response.json()['detail'][0]['msg'], 'Old password and new password match')
response = self.client.put(
self.url + '/change-password', headers=headers, json={
'old_password': 'test',
'password': 'test12345',
'confirm_password': 'test12345',
},
)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json()['detail'], 'Old password mismatch')
def test_subscriptions(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
self.client.post(self.url + '/register', json={**self.data, 'username': 'test2', 'email': 'test2@example.com'})
self.client.post(self.url + '/register', json={**self.data, 'username': 'test3', 'email': 'test3@example.com'})
verification = async_loop(verification_crud.get(self.session, user_id=2)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
user_1 = async_loop(user_crud.get(self.session, id=1))
response = async_loop(subscriptions(user_1))
self.assertEqual(response, [])
async_loop(self.session.execute(update(user_crud.model).filter_by(id=1).values(is_superuser=True)))
async_loop(self.session.commit())
self.client.post(API_V1_URL + '/categories/', json={'name': 'FastAPI'}, headers=headers)
tokens = self.client.post(self.url + '/login', data={'username': 'test2', 'password': 'test1234'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
with open('tests/image.png', 'rb') as preview:
with open('tests/test.mp4', 'rb') as video:
self.client.post(
API_V1_URL + '/videos/',
headers=headers,
data=self.video_data,
files={
'preview_file': ('image.png', preview, 'image/png'),
'video_file': ('test.mp4', video, 'video/mp4'),
}
)
self.client.post(self.url + '/follow?to_id=3', headers=headers)
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
self.client.post(self.url + '/follow?to_id=2', headers=headers)
self.client.post(self.url + '/follow?to_id=3', headers=headers)
response = async_loop(subscriptions(async_loop(user_crud.get(self.session, id=1))))
self.assertEqual(len(response), 2)
self.assertEqual(response[0]['user']['id'], 3)
self.assertEqual(len(response[0]['videos']), 0)
self.assertEqual(response[1]['user']['id'], 2)
self.assertEqual(len(response[1]['videos']), 1)
user_2 = async_loop(user_crud.get(self.session, id=2))
response = async_loop(subscriptions(user_2))
self.assertEqual(len(response), 1)
self.assertEqual(response[0]['user']['id'], 3)
self.assertEqual(len(response[0]['videos']), 0)
def test_subscriptions_request(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
self.client.post(self.url + '/register', json={**self.data, 'username': 'test2', 'email': 'test2@example.com'})
self.client.post(self.url + '/register', json={**self.data, 'username': 'test3', 'email': 'test3@example.com'})
verification = async_loop(verification_crud.get(self.session, user_id=2)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
response = self.client.get(self.url + '/followed', headers=headers)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), [])
async_loop(self.session.execute(update(user_crud.model).filter_by(id=1).values(is_superuser=True)))
async_loop(self.session.commit())
self.client.post(API_V1_URL + '/categories/', json={'name': 'FastAPI'}, headers=headers)
tokens = self.client.post(self.url + '/login', data={'username': 'test2', 'password': 'test1234'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
with open('tests/image.png', 'rb') as preview:
with open('tests/test.mp4', 'rb') as video:
self.client.post(
API_V1_URL + '/videos/',
headers=headers,
data=self.video_data,
files={
'preview_file': ('image.png', preview, 'image/png'),
'video_file': ('test.mp4', video, 'video/mp4'),
}
)
self.client.post(self.url + '/follow?to_id=3', headers=headers)
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
self.client.post(self.url + '/follow?to_id=2', headers=headers)
self.client.post(self.url + '/follow?to_id=3', headers=headers)
response = self.client.get(self.url + '/followed', headers=headers)
self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.json()), 2)
self.assertEqual(response.json()[0]['user']['id'], 3)
self.assertEqual(len(response.json()[0]['videos']), 0)
self.assertEqual(response.json()[1]['user']['id'], 2)
self.assertEqual(len(response.json()[1]['videos']), 1)
tokens = self.client.post(self.url + '/login', data={'username': 'test2', 'password': 'test1234'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
response = self.client.get(self.url + '/followed', headers=headers)
self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.json()), 1)
self.assertEqual(response.json()[0]['user']['id'], 3)
self.assertEqual(len(response.json()[0]['videos']), 0)
def test_channel(self):
# Get channel
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
async_loop(self.session.execute(update(user_crud.model).filter_by(id=1).values(is_superuser=True)))
async_loop(self.session.commit())
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
self.client.post(API_V1_URL + '/categories/', json={'name': 'FastAPI'}, headers=headers)
self.client.post(self.url + '/register', json={**self.data, 'username': 'test2', 'email': 'test2@example.com'})
verification = async_loop(verification_crud.get(self.session, user_id=2)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
tokens = self.client.post(self.url + '/login', data={'username': 'test2', 'password': 'test1234'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
response = self.client.get(self.url + '/channel?pk=2')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json()['id'], 2)
self.assertEqual(response.json()['count_videos'], 0)
self.assertEqual(response.json()['views'], 0)
with open('tests/image.png', 'rb') as preview:
with open('tests/test.mp4', 'rb') as video:
self.client.post(
API_V1_URL + '/videos/',
headers=headers,
data=self.video_data,
files={
'preview_file': ('image.png', preview, 'image/png'),
'video_file': ('test.mp4', video, 'video/mp4'),
}
)
response = self.client.get(self.url + '/channel?pk=2')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json()['id'], 2)
self.assertEqual(response.json()['count_videos'], 1)
self.assertEqual(response.json()['views'], 0)
self.assertEqual(response.json()['is_following'], None)
self.client.post(API_V1_URL + '/videos/add-to-history?pk=1', headers=headers)
response = self.client.get(self.url + '/channel?pk=2')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json()['id'], 2)
self.assertEqual(response.json()['count_videos'], 1)
self.assertEqual(response.json()['views'], 1)
self.assertEqual(response.json()['is_following'], None)
with open('tests/image.png', 'rb') as preview:
with open('tests/test.mp4', 'rb') as video:
self.client.post(
API_V1_URL + '/videos/',
headers=headers,
data=self.video_data,
files={
'preview_file': ('image.png', preview, 'image/png'),
'video_file': ('test.mp4', video, 'video/mp4'),
}
)
response = self.client.get(self.url + '/channel?pk=2')
self.assertEqual(response.json()['count_videos'], 2)
# Self
response = self.client.get(self.url + '/channel?pk=2', headers=headers)
self.assertEqual(response.json()['is_following'], 3)
# Unfollow
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
response = self.client.get(self.url + '/channel?pk=2', headers=headers)
self.assertEqual(response.json()['is_following'], 0)
# Follow
self.client.post(self.url + '/follow?to_id=2', headers=headers)
response = self.client.get(self.url + '/channel?pk=2', headers=headers)
self.assertEqual(response.json()['is_following'], 1)
self.client.post(API_V1_URL + '/videos/add-to-history?pk=1', headers=headers)
self.client.post(API_V1_URL + '/videos/add-to-history?pk=1', headers=headers)
response = self.client.get(self.url + '/channel?pk=2')
self.assertEqual(response.json()['views'], 3)
response = self.client.get(self.url + '/channel?pk=143')
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'User not found'})
self.client.post(self.url + '/register', json={**self.data, 'username': 'test3', 'email': 'test3@example.com'})
response = self.client.get(self.url + '/channel?pk=3')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json()['views'], 0)
self.assertEqual(response.json()['count_videos'], 0)
# Get videos
response = self.client.get(self.url + '/channel/videos/3')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), [])
response = self.client.get(self.url + '/channel/videos/2')
self.assertEqual(response.json()[0]['id'], 2)
self.assertEqual(response.json()[1]['id'], 1)
self.assertEqual(len(response.json()), 2)
self.assertEqual(response.json()[0]['user']['username'], 'test2')
self.assertEqual(response.json()[1]['user']['username'], 'test2')
response = self.client.get(self.url + '/channel/videos/143')
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'User not found'})
def test_upload_avatar_requests(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
user = async_loop(user_crud.get(self.session, id=1))
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
self.assertEqual(os.path.exists(user.avatar), False)
with open('tests/image.png', 'rb') as f:
response = self.client.post(
self.url + '/avatar', headers=headers, files={'avatar': ('image.png', f, 'image/png')}
)
self.assertEqual(response.status_code, 200)
self.assertNotEqual(response.json()['avatar'], user.avatar)
self.assertEqual(os.path.exists(response.json()['avatar']), True)
with open('tests/image.png', 'rb') as f:
response_2 = self.client.post(
self.url + '/avatar', headers=headers, files={'avatar': ('image.png', f, 'image/png')}
)
self.assertEqual(response_2.status_code, 200)
self.assertEqual(os.path.exists(response.json()['avatar']), False)
self.assertEqual(os.path.exists(response_2.json()['avatar']), True)
with open('tests/image.gif', 'rb') as f:
response = self.client.post(
self.url + '/avatar', headers=headers, files={'avatar': ('image.gif', f, 'image/gif')}
)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'Avatar only format in jpeg or png'})
self.assertEqual(os.path.exists(response_2.json()['avatar']), True)
def test_upload_image(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
user = async_loop(user_crud.get(self.session, id=1))
self.assertEqual(os.path.exists(user.avatar), False)
with open('tests/image.png', 'rb') as f:
response = async_loop(upload_avatar(UploadFile(f.name, f, content_type='image/png'), user))
self.assertNotEqual(response['avatar'], user.avatar)
self.assertEqual(os.path.exists(response['avatar']), True)
async_loop(self.session.commit())
with open('tests/image.png', 'rb') as f:
user = async_loop(user_crud.get(self.session, id=1))
response_2 = async_loop(upload_avatar(UploadFile(f.name, f, content_type='image/png'), user))
self.assertNotEqual(response_2['avatar'], user.avatar)
self.assertNotEqual(response_2['avatar'], response['avatar'])
self.assertEqual(os.path.exists(response_2['avatar']), True)
self.assertEqual(os.path.exists(response['avatar']), False)
with self.assertRaises(HTTPException) as error:
with open('tests/image.gif', 'rb') as f:
async_loop(upload_avatar(UploadFile(f.name, f, content_type='image/gif'), user))
def test_reset_password_request(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
# Create reset password
response = self.client.get(self.url + f'/request-password-reset?email={self.data["email"]}')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), {'msg': 'Email send'})
response = self.client.get(self.url + f'/request-password-reset?email=test@example.ru')
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'User not found'})
# Verify reset password
token = create_password_reset_token(self.data['email'])
response = self.client.post(
self.url + f'/password-reset?token={token}',
json={'password': 'test123456', 'confirm_password': 'test123456'}
)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), {'msg': 'Password has been reset'})
tokens = self.client.post(
self.url + '/login', data={'username': 'test', 'password': 'test123456'}
).json()
response = self.client.post(
self.url + f'/password-reset?token={tokens["access_token"]}',
json={'password': 'test123456', 'confirm_password': 'test123456'}
)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'Reset token not found'})
response = self.client.post(
self.url + f'/password-reset?token={tokens["refresh_token"]}',
json={'password': 'test123456', 'confirm_password': 'test123456'}
)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'Reset token not found'})
otp = async_loop(user_crud.get(self.session, id=1)).otp_secret
self.client.get(
self.url + '/2-auth-toggle', headers={'Authorization': f'Bearer {tokens["access_token"]}'}
)
response = self.client.post(
self.url + f'/password-reset?token={token}',
json={'password': 'test123456', 'confirm_password': 'test123456'}
)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), {'msg': 'Password has been reset'})
async_loop(self.session.commit())
self.assertNotEqual(async_loop(user_crud.get(self.session, id=1)).otp_secret, otp)
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).two_auth, False)
async_loop(user_crud.remove(self.session, id=1))
async_loop(self.session.commit())
response = self.client.post(
self.url + f'/password-reset?token={token}',
json={'password': 'test123456', 'confirm_password': 'test123456'}
)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'User not found'})
def test_reset_password(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
# Create reset password
response = async_loop(create_reset_password(self.data["email"]))
self.assertEqual(response, {'msg': 'Email send'})
with self.assertRaises(HTTPException) as error:
async_loop(create_reset_password('test@example.ru'))
# Verify reset password
token = create_password_reset_token(self.data['email'])
response = async_loop(
verify_password_reset(token, Password(password='test123456', confirm_password='test123456'))
)
self.assertEqual(response, {'msg': 'Password has been reset'})
tokens = self.client.post(
self.url + '/login', data={'username': 'test', 'password': 'test123456'}
).json()
with self.assertRaises(HTTPException) as error:
async_loop(
verify_password_reset(
tokens['access_token'], Password(password='test123456', confirm_password='test123456')
)
)
with self.assertRaises(HTTPException) as error:
async_loop(
verify_password_reset(
tokens['refresh_token'], Password(password='test123456', confirm_password='test123456')
)
)
otp = async_loop(user_crud.get(self.session, id=1)).otp_secret
self.client.get(
self.url + '/2-auth-toggle', headers={'Authorization': f'Bearer {tokens["access_token"]}'}
)
response = async_loop(
verify_password_reset(token, Password(password='test123456', confirm_password='test123456'))
)
self.assertEqual(response, {'msg': 'Password has been reset'})
async_loop(self.session.commit())
self.assertNotEqual(async_loop(user_crud.get(self.session, id=1)).otp_secret, otp)
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).two_auth, False)
async_loop(user_crud.remove(self.session, id=1))
async_loop(self.session.commit())
with self.assertRaises(HTTPException) as error:
async_loop(
verify_password_reset(token, Password(password='test123456', confirm_password='test123456'))
)
def test_following_request(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
self.client.post(self.url + '/register', json={**self.data, 'username': 'test2', 'email': 'test2@example.com'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
user_1 = async_loop(user_crud.get(self.session, id=1))
user_2 = async_loop(user_crud.get(self.session, id=2))
self.assertEqual(async_loop(user_1.is_following(self.session, user_2)), False)
# Follow
response = self.client.post(self.url + '/follow?to_id=2', headers=headers)
self.assertEqual(response.json(), {'msg': 'You follow to user'})
self.assertEqual(response.status_code, 200)
self.assertEqual(async_loop(user_1.is_following(self.session, user_2)), True)
response = self.client.post(self.url + '/follow?to_id=2', headers=headers)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'You are already followed'})
self.assertEqual(async_loop(user_1.is_following(self.session, user_2)), True)
response = self.client.post(self.url + '/follow?to_id=1', headers=headers)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'You not follow to self'})
response = self.client.post(self.url + '/follow?to_id=4', headers=headers)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'Follow to user not found'})
# Unfollow
self.assertEqual(async_loop(user_1.is_following(self.session, user_2)), True)
response = self.client.post(self.url + '/unfollow?to_id=2', headers=headers)
self.assertEqual(response.json(), {'msg': 'You unfollow to user'})
self.assertEqual(response.status_code, 200)
self.assertEqual(async_loop(user_1.is_following(self.session, user_2)), False)
response = self.client.post(self.url + '/unfollow?to_id=2', headers=headers)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'You are already unfollowed'})
self.assertEqual(async_loop(user_1.is_following(self.session, user_2)), False)
response = self.client.post(self.url + '/unfollow?to_id=1', headers=headers)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'You not unfollow to self'})
response = self.client.post(self.url + '/unfollow?to_id=4', headers=headers)
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'Unfollow to user not found'})
def test_following(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
self.client.post(self.url + '/register', json={**self.data, 'username': 'test2', 'email': 'test2@example.com'})
user_1 = async_loop(user_crud.get(self.session, id=1))
user_2 = async_loop(user_crud.get(self.session, id=2))
self.assertEqual(async_loop(user_1.is_following(self.session, user_2)), False)
# Follow
response = async_loop(follow(user_2.id, user_1))
self.assertEqual(response, {'msg': 'You follow to user'})
self.assertEqual(async_loop(user_1.is_following(self.session, user_2)), True)
with self.assertRaises(HTTPException) as error:
async_loop(follow(user_2.id, user_1))
with self.assertRaises(HTTPException) as error:
async_loop(follow(user_1.id, user_1))
with self.assertRaises(HTTPException) as error:
async_loop(follow(4, user_1))
# Unfollow
self.assertEqual(async_loop(user_1.is_following(self.session, user_2)), True)
response = async_loop(unfollow(user_2.id, user_1))
self.assertEqual(response, {'msg': 'You unfollow to user'})
self.assertEqual(async_loop(user_1.is_following(self.session, user_2)), False)
with self.assertRaises(HTTPException) as error:
async_loop(unfollow(user_2.id, user_1))
with self.assertRaises(HTTPException) as error:
async_loop(unfollow(user_1.id, user_1))
with self.assertRaises(HTTPException) as error:
async_loop(unfollow(4, user_1))
def test_permission(self):
with self.assertRaises(HTTPException) as error:
async_loop(is_authenticated('test'))
self.client.post(self.url + '/register', json=self.data)
tokens = create_token(1, 'test')
response = async_loop(is_authenticated(tokens['access_token']))
self.assertEqual(response.id, 1)
with self.assertRaises(HTTPException) as error:
async_loop(is_authenticated(tokens['refresh_token']))
with self.assertRaises(HTTPException) as error:
token = create_password_reset_token(self.data['email'])
async_loop(is_authenticated(token))
with self.assertRaises(HTTPException) as error:
async_loop(is_active(async_loop(is_authenticated(tokens['access_token']))))
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
response = async_loop(is_active(async_loop(is_authenticated(tokens['access_token']))))
self.assertEqual(response.id, 1)
with self.assertRaises(HTTPException) as error:
async_loop(is_superuser(async_loop(is_active(async_loop(is_authenticated(tokens['access_token']))))))
async_loop(self.session.execute(update(user_crud.model).filter_by(id=1).values(is_superuser=True)))
async_loop(self.session.commit())
response = async_loop(
is_superuser(async_loop(is_active(async_loop(is_authenticated(tokens['access_token'])))))
)
self.assertEqual(response.id, 1)
with self.assertRaises(HTTPException) as error:
async_loop(user_crud.remove(self.session, id=1))
async_loop(self.session.commit())
async_loop(is_authenticated(tokens['access_token']))
def test_register_request(self):
self.assertEqual(async_loop(user_crud.exists(self.session, id=1)), False)
self.assertEqual(len(async_loop(user_crud.all(self.session))), 0)
self.assertEqual(len(async_loop(verification_crud.all(self.session))), 0)
self.assertEqual(async_loop(verification_crud.exists(self.session, id=1)), False)
response = self.client.post(self.url + '/register', json=self.data)
self.assertEqual(async_loop(user_crud.exists(self.session, id=1)), True)
self.assertEqual(len(async_loop(user_crud.all(self.session))), 1)
self.assertEqual(len(async_loop(verification_crud.all(self.session))), 1)
self.assertEqual(async_loop(verification_crud.exists(self.session, id=1)), True)
self.assertEqual(response.json(), {'msg': 'Send email for activate account'})
self.assertEqual(response.status_code, 201)
response = self.client.post(self.url + '/register', json=self.data)
self.assertEqual(response.json(), {'detail': 'Username exist'})
self.assertEqual(len(async_loop(user_crud.all(self.session))), 1)
self.assertEqual(response.status_code, 400)
response = self.client.post(self.url + '/register', json={**self.data, 'username': 'test2'})
self.assertEqual(response.json(), {'detail': 'Email exist'})
self.assertEqual(len(async_loop(user_crud.all(self.session))), 1)
self.assertEqual(response.status_code, 400)
response = self.client.post(self.url + '/register', json={**self.data, 'username': 'test2', 'email': 'test'})
self.assertEqual(response.json()['detail'][0]['msg'], 'value is not a valid email address')
self.assertEqual(len(async_loop(user_crud.all(self.session))), 1)
self.assertEqual(response.status_code, 422)
response = self.client.post(
self.url + '/register', json={
**self.data, 'username': 'test2', 'email': 'test@test.com', 'password': 'test'
}
)
self.assertEqual(response.json()['detail'][0]['msg'], 'Min length password is 8 chars')
self.assertEqual(len(async_loop(user_crud.all(self.session))), 1)
self.assertEqual(response.status_code, 422)
response = self.client.post(
self.url + '/register', json={
**self.data, 'username': 'test2', 'email': 'test@test.com', 'confirm_password': 'test'
}
)
self.assertEqual(response.json()['detail'][0]['msg'], 'Passwords do not match')
self.assertEqual(len(async_loop(user_crud.all(self.session))), 1)
self.assertEqual(response.status_code, 422)
def test_register(self):
self.assertEqual(async_loop(user_crud.exists(self.session, id=1)), False)
self.assertEqual(len(async_loop(user_crud.all(self.session))), 0)
self.assertEqual(len(async_loop(verification_crud.all(self.session))), 0)
self.assertEqual(async_loop(verification_crud.exists(self.session, id=1)), False)
response = async_loop(register(RegisterUser(**self.data)))
self.assertEqual(async_loop(user_crud.exists(self.session, id=1)), True)
self.assertEqual(len(async_loop(user_crud.all(self.session))), 1)
self.assertEqual(len(async_loop(verification_crud.all(self.session))), 1)
self.assertEqual(async_loop(verification_crud.exists(self.session, id=1)), True)
self.assertEqual(response, {'msg': 'Send email for activate account'})
with self.assertRaises(HTTPException) as error:
async_loop(register(RegisterUser(**self.data)))
with self.assertRaises(HTTPException) as error:
async_loop(register(RegisterUser(**{**self.data, 'username': 'test2'})))
with self.assertRaises(ValueError) as error:
async_loop(register(RegisterUser(**{**self.data, 'username': 'test2', 'email': 'test'})))
with self.assertRaises(ValueError) as error:
async_loop(
register(
RegisterUser(**{**self.data, 'username': 'test2', 'email': 'test@test.com', 'password': 'test'})
)
)
with self.assertRaises(ValueError) as error:
async_loop(
register(
RegisterUser(
**{**self.data, 'username': 'test2', 'email': 'test@test.com', 'confirm_password': 'test'}
)
)
)
def test_activate_request(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.assertEqual(len(async_loop(verification_crud.all(self.session))), 1)
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).__dict__['is_active'], False)
response = self.client.post(self.url + '/activate', json={'uuid': 'uuid'})
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'Verification not found'})
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).__dict__['is_active'], False)
self.assertEqual(len(async_loop(verification_crud.all(self.session))), 1)
response = self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), {'msg': 'Account has been is activated'})
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).__dict__['is_active'], True)
self.assertEqual(len(async_loop(verification_crud.all(self.session))), 0)
response = self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'Verification not found'})
def test_activate(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.assertEqual(len(async_loop(verification_crud.all(self.session))), 1)
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).__dict__['is_active'], False)
with self.assertRaises(HTTPException) as error:
async_loop(activate(VerificationUUID(uuid='uuid')))
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).__dict__['is_active'], False)
self.assertEqual(len(async_loop(verification_crud.all(self.session))), 1)
response = async_loop(activate(VerificationUUID(uuid=verification['uuid'])))
self.assertEqual(response, {'msg': 'Account has been is activated'})
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).__dict__['is_active'], True)
self.assertEqual(len(async_loop(verification_crud.all(self.session))), 0)
def test_login_request(self):
self.client.post(self.url + '/register', json=self.data)
response = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
self.assertEqual(response.status_code, 403)
self.assertEqual(response.json(), {'detail': 'You not activated'})
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
self.assertEqual(tokens.status_code, 200)
self.assertEqual(tokens.json()['token_type'], 'bearer')
self.assertEqual(tokens.json()['user_id'], 1)
self.assertEqual('access_token' and 'refresh_token' in tokens.json(), True)
self.assertEqual(
jwt.decode(tokens.json()['access_token'], SECRET_KEY, algorithms=[ALGORITHM])['user_id'], 1
)
self.assertEqual(
jwt.decode(tokens.json()['refresh_token'], SECRET_KEY, algorithms=[ALGORITHM])['username'], 'test'
)
response = self.client.post(self.url + '/login', data={'username': 'admin', 'password': 'test1234'})
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'User not found'})
response = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test'})
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'Password mismatch'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).two_auth, False)
response = self.client.get(self.url + '/2-auth-toggle', headers=headers)
self.assertEqual(response.status_code, 200)
self.assertEqual('otpauth://totp/Anti-YouTube:test?secret=' in response.json()['msg'], True)
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).two_auth, True)
response = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
self.assertEqual(response.status_code, 403)
self.assertEqual(response.json(), {'detail': 'You have 2-step auth'})
user = async_loop(user_crud.get(self.session, id=1))
response = self.client.post(
self.url + '/2-auth',
data={'username': 'test', 'password': 'test1234', 'code': TOTP(user.otp_secret).now()},
)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json()['token_type'], 'bearer')
self.assertEqual(response.json()['user_id'], 1)
self.assertEqual('access_token' and 'refresh_token' in response.json(), True)
self.assertEqual(
jwt.decode(response.json()['access_token'], SECRET_KEY, algorithms=[ALGORITHM])['user_id'], 1
)
self.assertEqual(
jwt.decode(response.json()['refresh_token'], SECRET_KEY, algorithms=[ALGORITHM])['username'], 'test'
)
response = self.client.post(
self.url + '/2-auth',
data={'username': 'test', 'password': 'test1234', 'code': 'test'},
)
self.assertEqual(response.status_code, 403)
self.assertEqual(response.json(), {'detail': 'Bad code'})
response = self.client.get(self.url + '/2-auth-toggle', headers=headers)
self.assertEqual(response.status_code, 200)
self.assertEqual('otpauth://totp/Anti-YouTube:test?secret=' in response.json()['msg'], False)
self.assertEqual(response.json(), {'msg': 'You off 2-step auth'})
async_loop(self.session.commit())
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).two_auth, False)
response = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
self.assertEqual(response.status_code, 200)
response = self.client.post(
self.url + '/2-auth',
data={'username': 'test', 'password': 'test1234', 'code': TOTP(user.otp_secret).now()},
)
self.assertEqual(response.status_code, 403)
self.assertEqual(response.json(), {'detail': 'You don\'t have 2-step auth'})
def test_login(self):
self.client.post(self.url + '/register', json=self.data)
with self.assertRaises(HTTPException) as error:
async_loop(login(username='test', password='test1234'))
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
tokens = async_loop(login(username='test', password='test1234'))
self.assertEqual(tokens['token_type'], 'bearer')
self.assertEqual(tokens['user_id'], 1)
self.assertEqual('access_token' and 'refresh_token' in tokens, True)
self.assertEqual(
jwt.decode(tokens['access_token'], SECRET_KEY, algorithms=[ALGORITHM])['user_id'], 1
)
self.assertEqual(
jwt.decode(tokens['refresh_token'], SECRET_KEY, algorithms=[ALGORITHM])['username'], 'test'
)
with self.assertRaises(HTTPException) as error:
async_loop(login(username='admin', password='test1234'))
with self.assertRaises(HTTPException) as error:
async_loop(login(username='test', password='test'))
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).two_auth, False)
response = async_loop(toggle_2step_auth(async_loop(user_crud.get(self.session, id=1))))
self.assertEqual('otpauth://totp/Anti-YouTube:test?secret=' in response['msg'], True)
async_loop(self.session.commit())
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).two_auth, True)
with self.assertRaises(HTTPException) as error:
async_loop(login(**{'username': 'test', 'password': 'test1234'}))
user = async_loop(user_crud.get(self.session, id=1))
response = async_loop(
two_auth(**{'username': 'test', 'password': 'test1234', 'code': TOTP(user.otp_secret).now()})
)
self.assertEqual(response['token_type'], 'bearer')
self.assertEqual(response['user_id'], 1)
self.assertEqual('access_token' and 'refresh_token' in response, True)
self.assertEqual(
jwt.decode(response['access_token'], SECRET_KEY, algorithms=[ALGORITHM])['user_id'], 1
)
self.assertEqual(
jwt.decode(response['refresh_token'], SECRET_KEY, algorithms=[ALGORITHM])['username'], 'test'
)
with self.assertRaises(HTTPException) as error:
async_loop(two_auth(**{'username': 'test', 'password': 'test1234', 'code': 'test'}))
response = async_loop(toggle_2step_auth(async_loop(user_crud.get(self.session, id=1))))
self.assertEqual('otpauth://totp/Anti-YouTube:test?secret=' in response['msg'], False)
self.assertEqual(response, {'msg': 'You off 2-step auth'})
async_loop(self.session.commit())
self.assertEqual(async_loop(user_crud.get(self.session, id=1)).two_auth, False)
response = async_loop(login(**{'username': 'test', 'password': 'test1234'}))
self.assertEqual('access_token' in response.keys(), True)
with self.assertRaises(HTTPException) as error:
async_loop(two_auth(**{'username': 'test', 'password': 'test1234', 'code': TOTP(user.otp_secret).now()}))
def test_refresh_token_request(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
response = self.client.post(self.url + '/refresh', json={'refresh_token': tokens.json()['refresh_token']})
self.assertEqual('access_token' in response.json(), True)
self.assertEqual(response.status_code, 200)
self.assertEqual(
jwt.decode(response.json()['access_token'], SECRET_KEY, algorithms=[ALGORITHM])['user_id'], 1
)
response = self.client.post(self.url + '/refresh', json={'refresh_token': 'token'})
self.assertEqual(response.json(), {'detail': 'Token lifetime ended'})
self.assertEqual(response.status_code, 401)
response = self.client.post(self.url + '/refresh', json={'refresh_token': tokens.json()['access_token']})
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'Refresh token not found'})
async_loop(user_crud.remove(self.session, id=1))
async_loop(self.session.commit())
response = self.client.post(self.url + '/refresh', json={'refresh_token': tokens.json()['refresh_token']})
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'User not found'})
def test_refresh_token(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1)).__dict__
self.client.post(self.url + '/activate', json={'uuid': verification['uuid']})
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
response = async_loop(refresh(RefreshToken(refresh_token=tokens.json()['refresh_token'])))
self.assertEqual('access_token' in response, True)
self.assertEqual(
jwt.decode(response['access_token'], SECRET_KEY, algorithms=[ALGORITHM])['user_id'], 1
)
with self.assertRaises(HTTPException) as error:
async_loop(refresh(RefreshToken(refresh_token='token')))
with self.assertRaises(HTTPException) as error:
async_loop(refresh(RefreshToken(refresh_token=tokens.json()['access_token'])))
async_loop(user_crud.remove(self.session, id=1))
async_loop(self.session.commit())
with self.assertRaises(HTTPException) as error:
async_loop(refresh(RefreshToken(refresh_token=tokens.json()['refresh_token'])))
def test_get_username_request(self):
self.client.post(self.url + '/register', json=self.data)
response = self.client.post(self.url + f'/username?email={self.data["email"]}')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), {'msg': 'Email send'})
response = self.client.post(self.url + f'/username?email=test2@example.com')
self.assertEqual(response.status_code, 400)
self.assertEqual(response.json(), {'detail': 'User not found'})
def test_get_username(self):
self.client.post(self.url + '/register', json=self.data)
response = async_loop(get_username(self.data['email']))
self.assertEqual(response, {'msg': 'Email send'})
with self.assertRaises(HTTPException) as error:
async_loop(get_username('test2@example.com'))
def test_change_data_request(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1))
self.client.post(self.url + '/activate', json={'uuid': verification.uuid})
tokens = self.client.post(self.url + '/login', data={'username': 'test', 'password': 'test1234'})
headers = {'Authorization': f'Bearer {tokens.json()["access_token"]}'}
# Get data
response = self.client.get(self.url + '/change-data', headers=headers)
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), ChangeUserDataResponse(**self.data, avatar='', two_auth=False))
# Put data
response = self.client.put(self.url + '/change-data', headers=headers, json={
'send_message': False, 'about': 'test',
})
self.assertFalse(response.json()['send_message'])
self.assertEqual(response.json()['about'], 'test')
self.assertEqual(response.status_code, 200)
self.assertEqual(
response.json(),
ChangeUserDataResponse(**{**self.data, 'send_message': False, 'about': 'test'}, avatar='', two_auth=False)
)
def test_change_data(self):
self.client.post(self.url + '/register', json=self.data)
verification = async_loop(verification_crud.get(self.session, user_id=1))
self.client.post(self.url + '/activate', json={'uuid': verification.uuid})
user = async_loop(user_crud.get(self.session, id=1))
# Get data
response = async_loop(get_data(user))
self.assertEqual(response, user.__dict__)
# Put data
response = async_loop(change_data(ChangeUserData(send_message=False, about='test'), user))
async_loop(self.session.commit())
self.assertFalse(response['send_message'])
self.assertEqual(response['about'], 'test')
user = async_loop(user_crud.get(self.session, id=1))
self.assertEqual(response['send_message'], user.send_message)
self.assertEqual(response['about'], user.about)
| 47.686887 | 119 | 0.634042 | 6,322 | 53,457 | 5.217653 | 0.036065 | 0.117323 | 0.108076 | 0.063845 | 0.921967 | 0.902504 | 0.875765 | 0.855424 | 0.835324 | 0.816316 | 0 | 0.020825 | 0.208616 | 53,457 | 1,120 | 120 | 47.729464 | 0.758894 | 0.003723 | 0 | 0.604839 | 0 | 0.003456 | 0.160312 | 0.020624 | 0 | 0 | 0 | 0 | 0.346774 | 1 | 0.029954 | false | 0.130184 | 0.020737 | 0 | 0.051843 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 7 |
3416d3e199b66abb7c5ac61770bd353cd3c64cbc | 171 | py | Python | ofcourse/cli/util.py | liam-middlebrook/ofCourse | e93dc1b7fa825ad130a2b2a6eb8b5048e2c4005d | [
"Apache-2.0"
] | null | null | null | ofcourse/cli/util.py | liam-middlebrook/ofCourse | e93dc1b7fa825ad130a2b2a6eb8b5048e2c4005d | [
"Apache-2.0"
] | null | null | null | ofcourse/cli/util.py | liam-middlebrook/ofCourse | e93dc1b7fa825ad130a2b2a6eb8b5048e2c4005d | [
"Apache-2.0"
] | null | null | null | import datetime
def season():
if datetime.date.today().month > 6:
return "fall"
return "spring"
def year():
return str(datetime.date.today().year)
| 14.25 | 42 | 0.625731 | 22 | 171 | 4.863636 | 0.636364 | 0.224299 | 0.317757 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007634 | 0.233918 | 171 | 11 | 43 | 15.545455 | 0.80916 | 0 | 0 | 0 | 0 | 0 | 0.05848 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | true | 0 | 0.142857 | 0.142857 | 0.857143 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 7 |
343546edb9474eaa00bf7c4e558b4842668e5d15 | 68,570 | py | Python | benchmarks/SimResults/_bigLittle_hrrs_spec_tugberk_mylocality/cmp_gromacs/power.py | TugberkArkose/MLScheduler | e493b6cbf7b9d29a2c9300d7dd6f0c2f102e4061 | [
"Unlicense"
] | null | null | null | benchmarks/SimResults/_bigLittle_hrrs_spec_tugberk_mylocality/cmp_gromacs/power.py | TugberkArkose/MLScheduler | e493b6cbf7b9d29a2c9300d7dd6f0c2f102e4061 | [
"Unlicense"
] | null | null | null | benchmarks/SimResults/_bigLittle_hrrs_spec_tugberk_mylocality/cmp_gromacs/power.py | TugberkArkose/MLScheduler | e493b6cbf7b9d29a2c9300d7dd6f0c2f102e4061 | [
"Unlicense"
] | null | null | null | power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate Leakage': 0.00662954,
'Peak Dynamic': 0.0,
'Runtime Dynamic': 0.0,
'Subthreshold Leakage': 0.0691322,
'Subthreshold Leakage with power gating': 0.0259246},
'Core': [{'Area': 32.6082,
'Execution Unit/Area': 8.2042,
'Execution Unit/Complex ALUs/Area': 0.235435,
'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646,
'Execution Unit/Complex ALUs/Peak Dynamic': 0.291078,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.431314,
'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111,
'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163,
'Execution Unit/Floating Point Units/Area': 4.6585,
'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156,
'Execution Unit/Floating Point Units/Peak Dynamic': 1.67366,
'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033,
'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829,
'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061,
'Execution Unit/Gate Leakage': 0.122718,
'Execution Unit/Instruction Scheduler/Area': 2.17927,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.328073,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.00115349,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.20978,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.715075,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.017004,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00962066,
'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00730101,
'Execution Unit/Instruction Scheduler/Instruction Window/Area': 1.00996,
'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00529112,
'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 2.07911,
'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 1.23825,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0800117,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0455351,
'Execution Unit/Instruction Scheduler/Peak Dynamic': 4.84781,
'Execution Unit/Instruction Scheduler/ROB/Area': 0.841232,
'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.000856399,
'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.55892,
'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.710172,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.0178624,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00897339,
'Execution Unit/Instruction Scheduler/Runtime Dynamic': 2.6635,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.114878,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.0641291,
'Execution Unit/Integer ALUs/Area': 0.47087,
'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291,
'Execution Unit/Integer ALUs/Peak Dynamic': 0.450228,
'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344,
'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222,
'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833,
'Execution Unit/Peak Dynamic': 8.7186,
'Execution Unit/Register Files/Area': 0.570804,
'Execution Unit/Register Files/Floating Point RF/Area': 0.208131,
'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788,
'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.31619,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.025922,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968,
'Execution Unit/Register Files/Gate Leakage': 0.000622708,
'Execution Unit/Register Files/Integer RF/Area': 0.362673,
'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992,
'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.292287,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.191709,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675,
'Execution Unit/Register Files/Peak Dynamic': 0.608477,
'Execution Unit/Register Files/Runtime Dynamic': 0.217631,
'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387,
'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643,
'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0442632,
'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00607074,
'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.786029,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 1.76319,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.0920413,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0345155,
'Execution Unit/Runtime Dynamic': 5.48101,
'Execution Unit/Subthreshold Leakage': 1.83518,
'Execution Unit/Subthreshold Leakage with power gating': 0.709678,
'Gate Leakage': 0.372997,
'Instruction Fetch Unit/Area': 5.86007,
'Instruction Fetch Unit/Branch Predictor/Area': 0.138516,
'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.00130213,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.00130213,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.00114,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.00044451,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045,
'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838,
'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732,
'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05,
'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602,
'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.00275392,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733,
'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00649818,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282,
'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954,
'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758,
'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867,
'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.0122758,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357,
'Instruction Fetch Unit/Gate Leakage': 0.0590479,
'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323,
'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05,
'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827,
'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.184295,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682,
'Instruction Fetch Unit/Instruction Cache/Area': 3.14635,
'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931,
'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 6.43323,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.38654,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386,
'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799,
'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493,
'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404,
'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.625949,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104,
'Instruction Fetch Unit/Peak Dynamic': 8.96874,
'Instruction Fetch Unit/Runtime Dynamic': 1.21556,
'Instruction Fetch Unit/Subthreshold Leakage': 0.932587,
'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.408542,
'L2/Area': 4.53318,
'L2/Gate Leakage': 0.015464,
'L2/Peak Dynamic': 0.0727007,
'L2/Runtime Dynamic': 0.0141468,
'L2/Subthreshold Leakage': 0.834142,
'L2/Subthreshold Leakage with power gating': 0.401066,
'Load Store Unit/Area': 8.80969,
'Load Store Unit/Data Cache/Area': 6.84535,
'Load Store Unit/Data Cache/Gate Leakage': 0.0279261,
'Load Store Unit/Data Cache/Peak Dynamic': 6.35652,
'Load Store Unit/Data Cache/Runtime Dynamic': 2.46267,
'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675,
'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085,
'Load Store Unit/Gate Leakage': 0.0351387,
'Load Store Unit/LoadQ/Area': 0.0836782,
'Load Store Unit/LoadQ/Gate Leakage': 0.00059896,
'Load Store Unit/LoadQ/Peak Dynamic': 0.165625,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.165625,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 7.14182,
'Load Store Unit/Runtime Dynamic': 3.4451,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.408402,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.816805,
'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621,
'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004,
'Load Store Unit/Subthreshold Leakage': 0.591622,
'Load Store Unit/Subthreshold Leakage with power gating': 0.283406,
'Memory Management Unit/Area': 0.434579,
'Memory Management Unit/Dtlb/Area': 0.0879726,
'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729,
'Memory Management Unit/Dtlb/Peak Dynamic': 0.144943,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.146029,
'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699,
'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485,
'Memory Management Unit/Gate Leakage': 0.00813591,
'Memory Management Unit/Itlb/Area': 0.301552,
'Memory Management Unit/Itlb/Gate Leakage': 0.00393464,
'Memory Management Unit/Itlb/Peak Dynamic': 0.399995,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0633863,
'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758,
'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842,
'Memory Management Unit/Peak Dynamic': 0.809073,
'Memory Management Unit/Runtime Dynamic': 0.209415,
'Memory Management Unit/Subthreshold Leakage': 0.0769113,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0399462,
'Peak Dynamic': 30.2726,
'Renaming Unit/Area': 0.369768,
'Renaming Unit/FP Front End RAT/Area': 0.168486,
'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00489731,
'Renaming Unit/FP Front End RAT/Peak Dynamic': 3.33511,
'Renaming Unit/FP Front End RAT/Runtime Dynamic': 1.10311,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0437281,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.024925,
'Renaming Unit/Free List/Area': 0.0414755,
'Renaming Unit/Free List/Gate Leakage': 4.15911e-05,
'Renaming Unit/Free List/Peak Dynamic': 0.0401324,
'Renaming Unit/Free List/Runtime Dynamic': 0.0498391,
'Renaming Unit/Free List/Subthreshold Leakage': 0.000670426,
'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000377987,
'Renaming Unit/Gate Leakage': 0.00863632,
'Renaming Unit/Int Front End RAT/Area': 0.114751,
'Renaming Unit/Int Front End RAT/Gate Leakage': 0.00038343,
'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.86945,
'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.35195,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00611897,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00348781,
'Renaming Unit/Peak Dynamic': 4.56169,
'Renaming Unit/Runtime Dynamic': 1.5049,
'Renaming Unit/Subthreshold Leakage': 0.070483,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0362779,
'Runtime Dynamic': 11.8701,
'Subthreshold Leakage': 6.21877,
'Subthreshold Leakage with power gating': 2.58311},
{'Area': 32.0201,
'Execution Unit/Area': 7.68434,
'Execution Unit/Complex ALUs/Area': 0.235435,
'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646,
'Execution Unit/Complex ALUs/Peak Dynamic': 0.150927,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.321233,
'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111,
'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163,
'Execution Unit/Floating Point Units/Area': 4.6585,
'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156,
'Execution Unit/Floating Point Units/Peak Dynamic': 0.870229,
'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033,
'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829,
'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061,
'Execution Unit/Gate Leakage': 0.120359,
'Execution Unit/Instruction Scheduler/Area': 1.66526,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.275653,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.000977433,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.04181,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.313652,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.0143453,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00810519,
'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00568913,
'Execution Unit/Instruction Scheduler/Instruction Window/Area': 0.805223,
'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00414562,
'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 1.6763,
'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.505908,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0625755,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0355964,
'Execution Unit/Instruction Scheduler/Peak Dynamic': 3.82262,
'Execution Unit/Instruction Scheduler/ROB/Area': 0.584388,
'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.00056608,
'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.10451,
'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.255366,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.00906853,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00364446,
'Execution Unit/Instruction Scheduler/Runtime Dynamic': 1.07493,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.0859892,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.047346,
'Execution Unit/Integer ALUs/Area': 0.47087,
'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291,
'Execution Unit/Integer ALUs/Peak Dynamic': 0.225308,
'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344,
'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222,
'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833,
'Execution Unit/Peak Dynamic': 5.76559,
'Execution Unit/Register Files/Area': 0.570804,
'Execution Unit/Register Files/Floating Point RF/Area': 0.208131,
'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788,
'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.164405,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.013156,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968,
'Execution Unit/Register Files/Gate Leakage': 0.000622708,
'Execution Unit/Register Files/Integer RF/Area': 0.362673,
'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992,
'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.149396,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0972964,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675,
'Execution Unit/Register Files/Peak Dynamic': 0.3138,
'Execution Unit/Register Files/Runtime Dynamic': 0.110452,
'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387,
'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643,
'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0390912,
'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00537402,
'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.352475,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.793722,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.081478,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0305543,
'Execution Unit/Runtime Dynamic': 2.70571,
'Execution Unit/Subthreshold Leakage': 1.79543,
'Execution Unit/Subthreshold Leakage with power gating': 0.688821,
'Gate Leakage': 0.368936,
'Instruction Fetch Unit/Area': 5.85939,
'Instruction Fetch Unit/Branch Predictor/Area': 0.138516,
'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.000548185,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.000548185,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.00048047,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.00018764,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045,
'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838,
'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732,
'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05,
'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602,
'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.00139767,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733,
'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00297451,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282,
'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954,
'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758,
'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867,
'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.0051487,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357,
'Instruction Fetch Unit/Gate Leakage': 0.0589979,
'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323,
'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05,
'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827,
'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0935335,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682,
'Instruction Fetch Unit/Instruction Cache/Area': 3.14635,
'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931,
'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 5.94953,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.192212,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386,
'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799,
'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493,
'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404,
'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.317682,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104,
'Instruction Fetch Unit/Peak Dynamic': 8.45679,
'Instruction Fetch Unit/Runtime Dynamic': 0.61155,
'Instruction Fetch Unit/Subthreshold Leakage': 0.932286,
'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.40843,
'L2/Area': 4.53318,
'L2/Gate Leakage': 0.015464,
'L2/Peak Dynamic': 0.0326224,
'L2/Runtime Dynamic': 0.00640753,
'L2/Subthreshold Leakage': 0.834142,
'L2/Subthreshold Leakage with power gating': 0.401066,
'Load Store Unit/Area': 8.80901,
'Load Store Unit/Data Cache/Area': 6.84535,
'Load Store Unit/Data Cache/Gate Leakage': 0.0279261,
'Load Store Unit/Data Cache/Peak Dynamic': 3.87736,
'Load Store Unit/Data Cache/Runtime Dynamic': 1.26968,
'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675,
'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085,
'Load Store Unit/Gate Leakage': 0.0350888,
'Load Store Unit/LoadQ/Area': 0.0836782,
'Load Store Unit/LoadQ/Gate Leakage': 0.00059896,
'Load Store Unit/LoadQ/Peak Dynamic': 0.085418,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0854179,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 4.28072,
'Load Store Unit/Runtime Dynamic': 1.77635,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.210626,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.421252,
'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621,
'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004,
'Load Store Unit/Subthreshold Leakage': 0.591321,
'Load Store Unit/Subthreshold Leakage with power gating': 0.283293,
'Memory Management Unit/Area': 0.4339,
'Memory Management Unit/Dtlb/Area': 0.0879726,
'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729,
'Memory Management Unit/Dtlb/Peak Dynamic': 0.0747519,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0752388,
'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699,
'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485,
'Memory Management Unit/Gate Leakage': 0.00808595,
'Memory Management Unit/Itlb/Area': 0.301552,
'Memory Management Unit/Itlb/Gate Leakage': 0.00393464,
'Memory Management Unit/Itlb/Peak Dynamic': 0.36992,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0315189,
'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758,
'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842,
'Memory Management Unit/Peak Dynamic': 0.654439,
'Memory Management Unit/Runtime Dynamic': 0.106758,
'Memory Management Unit/Subthreshold Leakage': 0.0766103,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333,
'Peak Dynamic': 22.7796,
'Renaming Unit/Area': 0.303608,
'Renaming Unit/FP Front End RAT/Area': 0.131045,
'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00351123,
'Renaming Unit/FP Front End RAT/Peak Dynamic': 2.51468,
'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.432475,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0308571,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.0175885,
'Renaming Unit/Free List/Area': 0.0340654,
'Renaming Unit/Free List/Gate Leakage': 2.5481e-05,
'Renaming Unit/Free List/Peak Dynamic': 0.0306032,
'Renaming Unit/Free List/Runtime Dynamic': 0.0194142,
'Renaming Unit/Free List/Subthreshold Leakage': 0.000370144,
'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000201064,
'Renaming Unit/Gate Leakage': 0.00708398,
'Renaming Unit/Int Front End RAT/Area': 0.0941223,
'Renaming Unit/Int Front End RAT/Gate Leakage': 0.000283242,
'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.731965,
'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.151888,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00435488,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.603777,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 5.81056,
'Subthreshold Leakage': 6.16288,
'Subthreshold Leakage with power gating': 2.55328},
{'Area': 32.0201,
'Execution Unit/Area': 7.68434,
'Execution Unit/Complex ALUs/Area': 0.235435,
'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646,
'Execution Unit/Complex ALUs/Peak Dynamic': 0.151717,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.321854,
'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111,
'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163,
'Execution Unit/Floating Point Units/Area': 4.6585,
'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156,
'Execution Unit/Floating Point Units/Peak Dynamic': 0.869986,
'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033,
'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829,
'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061,
'Execution Unit/Gate Leakage': 0.120359,
'Execution Unit/Instruction Scheduler/Area': 1.66526,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.275653,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.000977433,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.04181,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.312257,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.0143453,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00810519,
'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00568913,
'Execution Unit/Instruction Scheduler/Instruction Window/Area': 0.805223,
'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00414562,
'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 1.6763,
'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.503659,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0625755,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0355964,
'Execution Unit/Instruction Scheduler/Peak Dynamic': 3.82262,
'Execution Unit/Instruction Scheduler/ROB/Area': 0.584388,
'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.00056608,
'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.10451,
'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.25423,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.00906853,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00364446,
'Execution Unit/Instruction Scheduler/Runtime Dynamic': 1.07015,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.0859892,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.047346,
'Execution Unit/Integer ALUs/Area': 0.47087,
'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291,
'Execution Unit/Integer ALUs/Peak Dynamic': 0.223751,
'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344,
'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222,
'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833,
'Execution Unit/Peak Dynamic': 5.76469,
'Execution Unit/Register Files/Area': 0.570804,
'Execution Unit/Register Files/Floating Point RF/Area': 0.208131,
'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788,
'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.164359,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.0130975,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968,
'Execution Unit/Register Files/Gate Leakage': 0.000622708,
'Execution Unit/Register Files/Integer RF/Area': 0.362673,
'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992,
'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.149452,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0968638,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675,
'Execution Unit/Register Files/Peak Dynamic': 0.313811,
'Execution Unit/Register Files/Runtime Dynamic': 0.109961,
'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387,
'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643,
'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0390912,
'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00537402,
'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.352791,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.792641,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.081478,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0305543,
'Execution Unit/Runtime Dynamic': 2.69998,
'Execution Unit/Subthreshold Leakage': 1.79543,
'Execution Unit/Subthreshold Leakage with power gating': 0.688821,
'Gate Leakage': 0.368936,
'Instruction Fetch Unit/Area': 5.85939,
'Instruction Fetch Unit/Branch Predictor/Area': 0.138516,
'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.000529271,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.000529271,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.000463597,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.00018089,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045,
'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838,
'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732,
'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05,
'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602,
'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.00139146,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733,
'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.0029136,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282,
'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954,
'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758,
'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867,
'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.00498161,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357,
'Instruction Fetch Unit/Gate Leakage': 0.0589979,
'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323,
'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05,
'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827,
'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0931176,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682,
'Instruction Fetch Unit/Instruction Cache/Area': 3.14635,
'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931,
'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 5.92308,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.190416,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386,
'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799,
'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493,
'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404,
'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.316269,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104,
'Instruction Fetch Unit/Peak Dynamic': 8.42906,
'Instruction Fetch Unit/Runtime Dynamic': 0.607699,
'Instruction Fetch Unit/Subthreshold Leakage': 0.932286,
'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.40843,
'L2/Area': 4.53318,
'L2/Gate Leakage': 0.015464,
'L2/Peak Dynamic': 0.0317369,
'L2/Runtime Dynamic': 0.00619493,
'L2/Subthreshold Leakage': 0.834142,
'L2/Subthreshold Leakage with power gating': 0.401066,
'Load Store Unit/Area': 8.80901,
'Load Store Unit/Data Cache/Area': 6.84535,
'Load Store Unit/Data Cache/Gate Leakage': 0.0279261,
'Load Store Unit/Data Cache/Peak Dynamic': 3.81598,
'Load Store Unit/Data Cache/Runtime Dynamic': 1.24032,
'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675,
'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085,
'Load Store Unit/Gate Leakage': 0.0350888,
'Load Store Unit/LoadQ/Area': 0.0836782,
'Load Store Unit/LoadQ/Gate Leakage': 0.00059896,
'Load Store Unit/LoadQ/Peak Dynamic': 0.0834322,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0834321,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 4.20996,
'Load Store Unit/Runtime Dynamic': 1.73521,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.205729,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.411459,
'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621,
'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004,
'Load Store Unit/Subthreshold Leakage': 0.591321,
'Load Store Unit/Subthreshold Leakage with power gating': 0.283293,
'Memory Management Unit/Area': 0.4339,
'Memory Management Unit/Dtlb/Area': 0.0879726,
'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729,
'Memory Management Unit/Dtlb/Peak Dynamic': 0.0730141,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0734877,
'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699,
'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485,
'Memory Management Unit/Gate Leakage': 0.00808595,
'Memory Management Unit/Itlb/Area': 0.301552,
'Memory Management Unit/Itlb/Gate Leakage': 0.00393464,
'Memory Management Unit/Itlb/Peak Dynamic': 0.368275,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0312243,
'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758,
'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842,
'Memory Management Unit/Peak Dynamic': 0.64981,
'Memory Management Unit/Runtime Dynamic': 0.104712,
'Memory Management Unit/Subthreshold Leakage': 0.0766103,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333,
'Peak Dynamic': 22.6747,
'Renaming Unit/Area': 0.303608,
'Renaming Unit/FP Front End RAT/Area': 0.131045,
'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00351123,
'Renaming Unit/FP Front End RAT/Peak Dynamic': 2.51468,
'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.432353,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0308571,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.0175885,
'Renaming Unit/Free List/Area': 0.0340654,
'Renaming Unit/Free List/Gate Leakage': 2.5481e-05,
'Renaming Unit/Free List/Peak Dynamic': 0.0306032,
'Renaming Unit/Free List/Runtime Dynamic': 0.0193498,
'Renaming Unit/Free List/Subthreshold Leakage': 0.000370144,
'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000201064,
'Renaming Unit/Gate Leakage': 0.00708398,
'Renaming Unit/Int Front End RAT/Area': 0.0941223,
'Renaming Unit/Int Front End RAT/Gate Leakage': 0.000283242,
'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.731965,
'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.151184,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00435488,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.602887,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 5.75668,
'Subthreshold Leakage': 6.16288,
'Subthreshold Leakage with power gating': 2.55328},
{'Area': 32.0201,
'Execution Unit/Area': 7.68434,
'Execution Unit/Complex ALUs/Area': 0.235435,
'Execution Unit/Complex ALUs/Gate Leakage': 0.0132646,
'Execution Unit/Complex ALUs/Peak Dynamic': 0.155175,
'Execution Unit/Complex ALUs/Runtime Dynamic': 0.32457,
'Execution Unit/Complex ALUs/Subthreshold Leakage': 0.20111,
'Execution Unit/Complex ALUs/Subthreshold Leakage with power gating': 0.0754163,
'Execution Unit/Floating Point Units/Area': 4.6585,
'Execution Unit/Floating Point Units/Gate Leakage': 0.0656156,
'Execution Unit/Floating Point Units/Peak Dynamic': 0.893862,
'Execution Unit/Floating Point Units/Runtime Dynamic': 0.304033,
'Execution Unit/Floating Point Units/Subthreshold Leakage': 0.994829,
'Execution Unit/Floating Point Units/Subthreshold Leakage with power gating': 0.373061,
'Execution Unit/Gate Leakage': 0.120359,
'Execution Unit/Instruction Scheduler/Area': 1.66526,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Area': 0.275653,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Gate Leakage': 0.000977433,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Peak Dynamic': 1.04181,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Runtime Dynamic': 0.321458,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage': 0.0143453,
'Execution Unit/Instruction Scheduler/FP Instruction Window/Subthreshold Leakage with power gating': 0.00810519,
'Execution Unit/Instruction Scheduler/Gate Leakage': 0.00568913,
'Execution Unit/Instruction Scheduler/Instruction Window/Area': 0.805223,
'Execution Unit/Instruction Scheduler/Instruction Window/Gate Leakage': 0.00414562,
'Execution Unit/Instruction Scheduler/Instruction Window/Peak Dynamic': 1.6763,
'Execution Unit/Instruction Scheduler/Instruction Window/Runtime Dynamic': 0.5185,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage': 0.0625755,
'Execution Unit/Instruction Scheduler/Instruction Window/Subthreshold Leakage with power gating': 0.0355964,
'Execution Unit/Instruction Scheduler/Peak Dynamic': 3.82262,
'Execution Unit/Instruction Scheduler/ROB/Area': 0.584388,
'Execution Unit/Instruction Scheduler/ROB/Gate Leakage': 0.00056608,
'Execution Unit/Instruction Scheduler/ROB/Peak Dynamic': 1.10451,
'Execution Unit/Instruction Scheduler/ROB/Runtime Dynamic': 0.261722,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage': 0.00906853,
'Execution Unit/Instruction Scheduler/ROB/Subthreshold Leakage with power gating': 0.00364446,
'Execution Unit/Instruction Scheduler/Runtime Dynamic': 1.10168,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage': 0.0859892,
'Execution Unit/Instruction Scheduler/Subthreshold Leakage with power gating': 0.047346,
'Execution Unit/Integer ALUs/Area': 0.47087,
'Execution Unit/Integer ALUs/Gate Leakage': 0.0265291,
'Execution Unit/Integer ALUs/Peak Dynamic': 0.230615,
'Execution Unit/Integer ALUs/Runtime Dynamic': 0.101344,
'Execution Unit/Integer ALUs/Subthreshold Leakage': 0.40222,
'Execution Unit/Integer ALUs/Subthreshold Leakage with power gating': 0.150833,
'Execution Unit/Peak Dynamic': 5.81722,
'Execution Unit/Register Files/Area': 0.570804,
'Execution Unit/Register Files/Floating Point RF/Area': 0.208131,
'Execution Unit/Register Files/Floating Point RF/Gate Leakage': 0.000232788,
'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.16887,
'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.0134834,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage': 0.00399698,
'Execution Unit/Register Files/Floating Point RF/Subthreshold Leakage with power gating': 0.00176968,
'Execution Unit/Register Files/Gate Leakage': 0.000622708,
'Execution Unit/Register Files/Integer RF/Area': 0.362673,
'Execution Unit/Register Files/Integer RF/Gate Leakage': 0.00038992,
'Execution Unit/Register Files/Integer RF/Peak Dynamic': 0.153325,
'Execution Unit/Register Files/Integer RF/Runtime Dynamic': 0.0997181,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage': 0.00614175,
'Execution Unit/Register Files/Integer RF/Subthreshold Leakage with power gating': 0.00246675,
'Execution Unit/Register Files/Peak Dynamic': 0.322195,
'Execution Unit/Register Files/Runtime Dynamic': 0.113201,
'Execution Unit/Register Files/Subthreshold Leakage': 0.0101387,
'Execution Unit/Register Files/Subthreshold Leakage with power gating': 0.00423643,
'Execution Unit/Results Broadcast Bus/Area Overhead': 0.0390912,
'Execution Unit/Results Broadcast Bus/Gate Leakage': 0.00537402,
'Execution Unit/Results Broadcast Bus/Peak Dynamic': 0.361816,
'Execution Unit/Results Broadcast Bus/Runtime Dynamic': 0.813602,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage': 0.081478,
'Execution Unit/Results Broadcast Bus/Subthreshold Leakage with power gating': 0.0305543,
'Execution Unit/Runtime Dynamic': 2.75843,
'Execution Unit/Subthreshold Leakage': 1.79543,
'Execution Unit/Subthreshold Leakage with power gating': 0.688821,
'Gate Leakage': 0.368936,
'Instruction Fetch Unit/Area': 5.85939,
'Instruction Fetch Unit/Branch Predictor/Area': 0.138516,
'Instruction Fetch Unit/Branch Predictor/Chooser/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Chooser/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Chooser/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Chooser/Runtime Dynamic': 0.000563487,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Chooser/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/Gate Leakage': 0.000757657,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Area': 0.0435221,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Gate Leakage': 0.000278362,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Peak Dynamic': 0.0168831,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Runtime Dynamic': 0.000563487,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage': 0.00759719,
'Instruction Fetch Unit/Branch Predictor/Global Predictor/Subthreshold Leakage with power gating': 0.0039236,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Area': 0.0257064,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Gate Leakage': 0.000154548,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Peak Dynamic': 0.0142575,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Runtime Dynamic': 0.000494126,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage': 0.00384344,
'Instruction Fetch Unit/Branch Predictor/L1_Local Predictor/Subthreshold Leakage with power gating': 0.00198631,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Area': 0.0151917,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Gate Leakage': 8.00196e-05,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Peak Dynamic': 0.00527447,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Runtime Dynamic': 0.000193105,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage': 0.00181347,
'Instruction Fetch Unit/Branch Predictor/L2_Local Predictor/Subthreshold Leakage with power gating': 0.000957045,
'Instruction Fetch Unit/Branch Predictor/Peak Dynamic': 0.0597838,
'Instruction Fetch Unit/Branch Predictor/RAS/Area': 0.0105732,
'Instruction Fetch Unit/Branch Predictor/RAS/Gate Leakage': 4.63858e-05,
'Instruction Fetch Unit/Branch Predictor/RAS/Peak Dynamic': 0.0117602,
'Instruction Fetch Unit/Branch Predictor/RAS/Runtime Dynamic': 0.00143246,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage': 0.000932505,
'Instruction Fetch Unit/Branch Predictor/RAS/Subthreshold Leakage with power gating': 0.000494733,
'Instruction Fetch Unit/Branch Predictor/Runtime Dynamic': 0.00305356,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage': 0.0199703,
'Instruction Fetch Unit/Branch Predictor/Subthreshold Leakage with power gating': 0.0103282,
'Instruction Fetch Unit/Branch Target Buffer/Area': 0.64954,
'Instruction Fetch Unit/Branch Target Buffer/Gate Leakage': 0.00272758,
'Instruction Fetch Unit/Branch Target Buffer/Peak Dynamic': 0.177867,
'Instruction Fetch Unit/Branch Target Buffer/Runtime Dynamic': 0.00528369,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage': 0.0811682,
'Instruction Fetch Unit/Branch Target Buffer/Subthreshold Leakage with power gating': 0.0435357,
'Instruction Fetch Unit/Gate Leakage': 0.0589979,
'Instruction Fetch Unit/Instruction Buffer/Area': 0.0226323,
'Instruction Fetch Unit/Instruction Buffer/Gate Leakage': 6.83558e-05,
'Instruction Fetch Unit/Instruction Buffer/Peak Dynamic': 0.606827,
'Instruction Fetch Unit/Instruction Buffer/Runtime Dynamic': 0.0958615,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage': 0.00151885,
'Instruction Fetch Unit/Instruction Buffer/Subthreshold Leakage with power gating': 0.000701682,
'Instruction Fetch Unit/Instruction Cache/Area': 3.14635,
'Instruction Fetch Unit/Instruction Cache/Gate Leakage': 0.029931,
'Instruction Fetch Unit/Instruction Cache/Peak Dynamic': 6.09762,
'Instruction Fetch Unit/Instruction Cache/Runtime Dynamic': 0.196647,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage': 0.367022,
'Instruction Fetch Unit/Instruction Cache/Subthreshold Leakage with power gating': 0.180386,
'Instruction Fetch Unit/Instruction Decoder/Area': 1.85799,
'Instruction Fetch Unit/Instruction Decoder/Gate Leakage': 0.0222493,
'Instruction Fetch Unit/Instruction Decoder/Peak Dynamic': 1.37404,
'Instruction Fetch Unit/Instruction Decoder/Runtime Dynamic': 0.325589,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage': 0.442943,
'Instruction Fetch Unit/Instruction Decoder/Subthreshold Leakage with power gating': 0.166104,
'Instruction Fetch Unit/Peak Dynamic': 8.61206,
'Instruction Fetch Unit/Runtime Dynamic': 0.626434,
'Instruction Fetch Unit/Subthreshold Leakage': 0.932286,
'Instruction Fetch Unit/Subthreshold Leakage with power gating': 0.40843,
'L2/Area': 4.53318,
'L2/Gate Leakage': 0.015464,
'L2/Peak Dynamic': 0.0335996,
'L2/Runtime Dynamic': 0.00658946,
'L2/Subthreshold Leakage': 0.834142,
'L2/Subthreshold Leakage with power gating': 0.401066,
'Load Store Unit/Area': 8.80901,
'Load Store Unit/Data Cache/Area': 6.84535,
'Load Store Unit/Data Cache/Gate Leakage': 0.0279261,
'Load Store Unit/Data Cache/Peak Dynamic': 3.92186,
'Load Store Unit/Data Cache/Runtime Dynamic': 1.29109,
'Load Store Unit/Data Cache/Subthreshold Leakage': 0.527675,
'Load Store Unit/Data Cache/Subthreshold Leakage with power gating': 0.25085,
'Load Store Unit/Gate Leakage': 0.0350888,
'Load Store Unit/LoadQ/Area': 0.0836782,
'Load Store Unit/LoadQ/Gate Leakage': 0.00059896,
'Load Store Unit/LoadQ/Peak Dynamic': 0.0868578,
'Load Store Unit/LoadQ/Runtime Dynamic': 0.0868578,
'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961,
'Load Store Unit/LoadQ/Subthreshold Leakage with power gating': 0.00536918,
'Load Store Unit/Peak Dynamic': 4.33202,
'Load Store Unit/Runtime Dynamic': 1.8063,
'Load Store Unit/StoreQ/Area': 0.322079,
'Load Store Unit/StoreQ/Gate Leakage': 0.00329971,
'Load Store Unit/StoreQ/Peak Dynamic': 0.214177,
'Load Store Unit/StoreQ/Runtime Dynamic': 0.428353,
'Load Store Unit/StoreQ/Subthreshold Leakage': 0.0345621,
'Load Store Unit/StoreQ/Subthreshold Leakage with power gating': 0.0197004,
'Load Store Unit/Subthreshold Leakage': 0.591321,
'Load Store Unit/Subthreshold Leakage with power gating': 0.283293,
'Memory Management Unit/Area': 0.4339,
'Memory Management Unit/Dtlb/Area': 0.0879726,
'Memory Management Unit/Dtlb/Gate Leakage': 0.00088729,
'Memory Management Unit/Dtlb/Peak Dynamic': 0.076012,
'Memory Management Unit/Dtlb/Runtime Dynamic': 0.0765135,
'Memory Management Unit/Dtlb/Subthreshold Leakage': 0.0155699,
'Memory Management Unit/Dtlb/Subthreshold Leakage with power gating': 0.00887485,
'Memory Management Unit/Gate Leakage': 0.00808595,
'Memory Management Unit/Itlb/Area': 0.301552,
'Memory Management Unit/Itlb/Gate Leakage': 0.00393464,
'Memory Management Unit/Itlb/Peak Dynamic': 0.379127,
'Memory Management Unit/Itlb/Runtime Dynamic': 0.0322462,
'Memory Management Unit/Itlb/Subthreshold Leakage': 0.0413758,
'Memory Management Unit/Itlb/Subthreshold Leakage with power gating': 0.0235842,
'Memory Management Unit/Peak Dynamic': 0.665811,
'Memory Management Unit/Runtime Dynamic': 0.10876,
'Memory Management Unit/Subthreshold Leakage': 0.0766103,
'Memory Management Unit/Subthreshold Leakage with power gating': 0.0398333,
'Peak Dynamic': 23.0502,
'Renaming Unit/Area': 0.303608,
'Renaming Unit/FP Front End RAT/Area': 0.131045,
'Renaming Unit/FP Front End RAT/Gate Leakage': 0.00351123,
'Renaming Unit/FP Front End RAT/Peak Dynamic': 2.51468,
'Renaming Unit/FP Front End RAT/Runtime Dynamic': 0.444218,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage': 0.0308571,
'Renaming Unit/FP Front End RAT/Subthreshold Leakage with power gating': 0.0175885,
'Renaming Unit/Free List/Area': 0.0340654,
'Renaming Unit/Free List/Gate Leakage': 2.5481e-05,
'Renaming Unit/Free List/Peak Dynamic': 0.0306032,
'Renaming Unit/Free List/Runtime Dynamic': 0.0199094,
'Renaming Unit/Free List/Subthreshold Leakage': 0.000370144,
'Renaming Unit/Free List/Subthreshold Leakage with power gating': 0.000201064,
'Renaming Unit/Gate Leakage': 0.00708398,
'Renaming Unit/Int Front End RAT/Area': 0.0941223,
'Renaming Unit/Int Front End RAT/Gate Leakage': 0.000283242,
'Renaming Unit/Int Front End RAT/Peak Dynamic': 0.731965,
'Renaming Unit/Int Front End RAT/Runtime Dynamic': 0.155631,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage': 0.00435488,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.619758,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': 5.92627,
'Subthreshold Leakage': 6.16288,
'Subthreshold Leakage with power gating': 2.55328}],
'DRAM': {'Area': 0,
'Gate Leakage': 0,
'Peak Dynamic': 0.5042635894868011,
'Runtime Dynamic': 0.5042635894868011,
'Subthreshold Leakage': 4.252,
'Subthreshold Leakage with power gating': 4.252},
'L3': [{'Area': 61.9075,
'Gate Leakage': 0.0484137,
'Peak Dynamic': 0.0744295,
'Runtime Dynamic': 0.0404565,
'Subthreshold Leakage': 6.80085,
'Subthreshold Leakage with power gating': 3.32364}],
'Processor': {'Area': 191.908,
'Gate Leakage': 1.53485,
'Peak Dynamic': 98.8516,
'Peak Power': 131.964,
'Runtime Dynamic': 29.4041,
'Subthreshold Leakage': 31.5774,
'Subthreshold Leakage with power gating': 13.9484,
'Total Cores/Area': 128.669,
'Total Cores/Gate Leakage': 1.4798,
'Total Cores/Peak Dynamic': 98.7772,
'Total Cores/Runtime Dynamic': 29.3636,
'Total Cores/Subthreshold Leakage': 24.7074,
'Total Cores/Subthreshold Leakage with power gating': 10.2429,
'Total L3s/Area': 61.9075,
'Total L3s/Gate Leakage': 0.0484137,
'Total L3s/Peak Dynamic': 0.0744295,
'Total L3s/Runtime Dynamic': 0.0404565,
'Total L3s/Subthreshold Leakage': 6.80085,
'Total L3s/Subthreshold Leakage with power gating': 3.32364,
'Total Leakage': 33.1122,
'Total NoCs/Area': 1.33155,
'Total NoCs/Gate Leakage': 0.00662954,
'Total NoCs/Peak Dynamic': 0.0,
'Total NoCs/Runtime Dynamic': 0.0,
'Total NoCs/Subthreshold Leakage': 0.0691322,
'Total NoCs/Subthreshold Leakage with power gating': 0.0259246}} | 75.021882 | 124 | 0.681902 | 8,082 | 68,570 | 5.77951 | 0.067805 | 0.123657 | 0.113038 | 0.093513 | 0.939563 | 0.931535 | 0.918882 | 0.887091 | 0.861636 | 0.843181 | 0 | 0.131311 | 0.224457 | 68,570 | 914 | 125 | 75.021882 | 0.747043 | 0 | 0 | 0.642232 | 0 | 0 | 0.657785 | 0.048125 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
344e036ca4e88366fca879c16091372b63c5028c | 344 | py | Python | src/iotanbo_py_utils/platform.py | iotanbo/iotanbo_py_utils | 96a2728e051b5e5ee601459b4c449b5495768ba8 | [
"MIT"
] | null | null | null | src/iotanbo_py_utils/platform.py | iotanbo/iotanbo_py_utils | 96a2728e051b5e5ee601459b4c449b5495768ba8 | [
"MIT"
] | 14 | 2021-06-07T17:36:02.000Z | 2021-06-07T18:02:37.000Z | src/iotanbo_py_utils/platform.py | iotanbo/iotanbo_py_utils | 96a2728e051b5e5ee601459b4c449b5495768ba8 | [
"MIT"
] | null | null | null | """Platform utilities."""
import sys
def is_linux() -> bool: # pragma: no cover
return sys.platform == "linux" # pragma: no cover
def is_macos() -> bool: # pragma: no cover
return sys.platform == "darwin" # pragma: no cover
def is_windows() -> bool: # pragma: no cover
return sys.platform == "win32" # pragma: no cover
| 21.5 | 55 | 0.633721 | 46 | 344 | 4.673913 | 0.347826 | 0.223256 | 0.362791 | 0.237209 | 0.64186 | 0.474419 | 0.474419 | 0 | 0 | 0 | 0 | 0.007491 | 0.223837 | 344 | 15 | 56 | 22.933333 | 0.797753 | 0.354651 | 0 | 0 | 0 | 0 | 0.075829 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.428571 | true | 0 | 0.142857 | 0.428571 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 7 |
345b944851038e8db3c2fcd41f531dd354ef4355 | 168 | py | Python | urlclustering/__init__.py | PerimeterX/urlclustering | c3937895c10b3c8af46ad4e697723981105d0a2b | [
"MIT"
] | 59 | 2015-11-27T09:18:38.000Z | 2022-02-14T19:28:08.000Z | urlclustering/__init__.py | PerimeterX/urlclustering | c3937895c10b3c8af46ad4e697723981105d0a2b | [
"MIT"
] | 8 | 2015-10-05T13:49:08.000Z | 2021-07-20T13:11:45.000Z | urlclustering/__init__.py | PerimeterX/urlclustering | c3937895c10b3c8af46ad4e697723981105d0a2b | [
"MIT"
] | 27 | 2015-11-27T09:19:12.000Z | 2021-04-04T14:37:13.000Z | from __future__ import absolute_import
from .urlclusterer import cluster_urls
def cluster(urls, min_cluster_size=10):
return cluster_urls(urls, min_cluster_size)
| 24 | 47 | 0.827381 | 24 | 168 | 5.333333 | 0.5 | 0.257813 | 0.21875 | 0.28125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013514 | 0.119048 | 168 | 6 | 48 | 28 | 0.851351 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.5 | 0.25 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 9 |
1b08ee546ca00cf0ba10e614d0e5162598644e0a | 185 | py | Python | TIme_Series_Analysis/app/models.py | fangyiyu/Bitcoin__Prediction_Django | 4aba922f90b46a0ecde05d5941435fc2ae4fdfbb | [
"MIT"
] | 2 | 2021-04-17T20:50:35.000Z | 2021-06-06T15:25:21.000Z | TIme_Series_Analysis/app/models.py | fangyiyu/Time_Series_Analysis | 4aba922f90b46a0ecde05d5941435fc2ae4fdfbb | [
"MIT"
] | null | null | null | TIme_Series_Analysis/app/models.py | fangyiyu/Time_Series_Analysis | 4aba922f90b46a0ecde05d5941435fc2ae4fdfbb | [
"MIT"
] | null | null | null | # from django.contrib.auth.models import AbstractUser
from django.db import models
from django.contrib import admin
# Create your models here.
# class User(AbstractUser):
# pass
| 18.5 | 53 | 0.767568 | 25 | 185 | 5.68 | 0.6 | 0.211268 | 0.239437 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162162 | 185 | 9 | 54 | 20.555556 | 0.916129 | 0.6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
1b15c11716312a8303a924d8f89ecbfd6acdf715 | 149 | py | Python | sciencebeam_gym/pdf/__init__.py | elifesciences/sciencebeam-gym | 3ad654e08775e0c0cdd256753e14093bb5a42d44 | [
"MIT"
] | 25 | 2017-07-25T12:44:55.000Z | 2020-09-30T22:16:50.000Z | sciencebeam_gym/pdf/__init__.py | elifesciences/sciencebeam-gym | 3ad654e08775e0c0cdd256753e14093bb5a42d44 | [
"MIT"
] | 192 | 2017-11-29T08:57:03.000Z | 2022-03-29T18:44:41.000Z | sciencebeam_gym/pdf/__init__.py | elifesciences/sciencebeam-gym | 3ad654e08775e0c0cdd256753e14093bb5a42d44 | [
"MIT"
] | 6 | 2019-02-01T18:49:33.000Z | 2020-07-26T08:18:46.000Z | from sciencebeam_gym.pdf.pdf_to_lxml_wrapper import PdfToLxmlWrapper # noqa: F401
from sciencebeam_gym.pdf.pdf_to_png import PdfToPng # noqa: F401
| 49.666667 | 82 | 0.838926 | 23 | 149 | 5.130435 | 0.565217 | 0.254237 | 0.305085 | 0.355932 | 0.440678 | 0.440678 | 0 | 0 | 0 | 0 | 0 | 0.045113 | 0.107383 | 149 | 2 | 83 | 74.5 | 0.842105 | 0.14094 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 8 |
1b5a12319895dc8c58e02ce44b261156018dcff6 | 9,530 | py | Python | tests/test_graph_api.py | tpoisonooo/ppq | cba525dd0e8abe9743e02a013fcf22fb320ae07d | [
"Apache-2.0"
] | null | null | null | tests/test_graph_api.py | tpoisonooo/ppq | cba525dd0e8abe9743e02a013fcf22fb320ae07d | [
"Apache-2.0"
] | null | null | null | tests/test_graph_api.py | tpoisonooo/ppq | cba525dd0e8abe9743e02a013fcf22fb320ae07d | [
"Apache-2.0"
] | null | null | null | from ppq import *
from ppq.IR.morph import GraphFormatter
from ppq.api.interface import export_ppq_graph
# TEST CASE 1
graph = BaseGraph(name='Graph', built_from=NetworkFramework.ONNX)
graph.append_operation(operation=Operation(name='op1', op_type='Conv', attributes={}))
graph.append_operation(operation=Operation(name='op2', op_type='Conv', attributes={}))
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op1'],
downstream_op=graph.operations['op2'])
processer = SearchableGraph(graph)
paths = processer.path_matching(
sp_expr=lambda x: x.type == 'Conv',
rp_expr=lambda x, y: False,
ep_expr=lambda x: x.type == 'Conv',
direction='down')
assert len(paths) == 1
path = paths[0]
assert path[0].name == 'op1'
assert path[1].name == 'op2'
assert path[-1].name == 'op2'
export_ppq_graph(graph=graph, platform=TargetPlatform.ONNX, graph_save_to='graph')
# TEST CASE 2
graph = BaseGraph(name='Graph', built_from=NetworkFramework.ONNX)
graph.append_operation(operation=Operation(name='op1', op_type='Conv', attributes={}))
graph.append_operation(operation=Operation(name='op2', op_type='Add', attributes={}))
graph.append_operation(operation=Operation(name='op3', op_type='Relu', attributes={}))
graph.append_operation(operation=Operation(name='op4', op_type='Sigmoid', attributes={}))
graph.append_operation(operation=Operation(name='op5', op_type='Add', attributes={}))
graph.append_operation(operation=Operation(name='op6', op_type='Relu', attributes={}))
graph.append_operation(operation=Operation(name='op7', op_type='Sigmoid', attributes={}))
graph.append_operation(operation=Operation(name='op8', op_type='Conv', attributes={}))
graph.append_operation(operation=Operation(name='op9', op_type='Conv', attributes={}))
graph.append_operation(operation=Operation(name='op10', op_type='Conv', attributes={}))
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op1'],
downstream_op=graph.operations['op2'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op8'],
downstream_op=graph.operations['op2'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op2'],
downstream_op=graph.operations['op3'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op3'],
downstream_op=graph.operations['op4'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op9'],
downstream_op=graph.operations['op5'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op10'],
downstream_op=graph.operations['op5'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op5'],
downstream_op=graph.operations['op6'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op6'],
downstream_op=graph.operations['op7'])
processer = SearchableGraph(graph)
paths = processer.path_matching(
sp_expr=lambda x: x.type == 'Conv',
rp_expr=lambda x, y: True,
ep_expr=lambda x: x.type == 'Sigmoid',
direction='down')
assert len(paths) == 4
path = paths[0]
assert path[0].type == 'Conv'
assert path[1].type == 'Add'
assert path[-1].type == 'Sigmoid'
paths = processer.path_matching(
sp_expr=lambda x: x.type == 'Conv',
rp_expr=lambda x, y: True,
ep_expr=lambda x: x.type == 'Relu',
direction='down')
assert len(paths) == 4
path = paths[0]
assert path[0].type == 'Conv'
assert path[1].type == 'Add'
assert path[-1].type == 'Relu'
paths = processer.path_matching(
sp_expr=lambda x: x.type == 'Conv',
rp_expr=lambda x, y: False,
ep_expr=lambda x: x.type == 'Relu',
direction='down')
assert len(paths) == 0
graph.remove_operation(graph.operations['op1'])
paths = processer.path_matching(
sp_expr=lambda x: x.type == 'Conv',
rp_expr=lambda x, y: True,
ep_expr=lambda x: x.type == 'Sigmoid',
direction='down')
assert len(paths) == 3
path = paths[0]
assert path[0].type == 'Conv'
assert path[1].type == 'Add'
assert path[-1].type == 'Sigmoid'
opset = processer.opset_matching(
sp_expr=lambda x: x.type == 'Conv',
rp_expr=lambda x, y: True,
ep_expr=lambda x: x.type == 'Sigmoid',
direction='down')
assert len(opset) == 9
graph.remove_operation(graph.operations['op2'])
graph.remove_operation(graph.operations['op3'])
graph.remove_operation(graph.operations['op4'])
opset = processer.opset_matching(
sp_expr=lambda x: x.type == 'Conv',
rp_expr=lambda x, y: True,
ep_expr=lambda x: x.type == 'Sigmoid',
direction='down')
assert len(opset) == 5
processer = GraphFormatter(graph)
processer.delete_isolated()
assert len(graph.operations) == 0
export_ppq_graph(graph=graph, platform=TargetPlatform.ONNX, graph_save_to='graph')
# TEST CASE 3
graph = BaseGraph(name='Graph', built_from=NetworkFramework.ONNX)
graph.append_operation(operation=Operation(name='op1', op_type='Conv', attributes={}))
graph.append_operation(operation=Operation(name='op2', op_type='Add', attributes={}))
graph.append_operation(operation=Operation(name='op3', op_type='Relu', attributes={}))
graph.append_operation(operation=Operation(name='op4', op_type='Sigmoid', attributes={}))
graph.append_operation(operation=Operation(name='op5', op_type='Add', attributes={}))
graph.append_operation(operation=Operation(name='op6', op_type='Relu', attributes={}))
graph.append_operation(operation=Operation(name='op7', op_type='Sigmoid', attributes={}))
graph.append_operation(operation=Operation(name='op8', op_type='Conv', attributes={}))
graph.append_operation(operation=Operation(name='op9', op_type='Conv', attributes={}))
graph.append_operation(operation=Operation(name='op10', op_type='Conv', attributes={}))
graph.append_operation(operation=Operation(name='op11', op_type='Conv', attributes={}))
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op1'],
downstream_op=graph.operations['op2'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op8'],
downstream_op=graph.operations['op2'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op2'],
downstream_op=graph.operations['op3'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op3'],
downstream_op=graph.operations['op4'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op9'],
downstream_op=graph.operations['op5'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op10'],
downstream_op=graph.operations['op5'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op5'],
downstream_op=graph.operations['op6'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op6'],
downstream_op=graph.operations['op7'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op6'],
downstream_op=graph.operations['op7'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op11'],
downstream_op=graph.operations['op1'])
graph.create_link_with_op(variable=graph.create_variable(),
upstream_op=graph.operations['op11'],
downstream_op=graph.operations['op10'])
processer = GraphFormatter(graph)
graph.mark_variable_as_graph_output(var=graph.operations['op6'].outputs[0])
processer.truncate_on_var(graph.operations['op1'].outputs[0], mark_as_output=True)
processer.delete_isolated()
assert len(graph.outputs) == 2
assert len(graph.operations) == 6
for var in graph.variables.copy():
graph.insert_op_on_var(graph.create_operation(op_type='Test_1', attributes={}), var=var)
for var in graph.variables.copy():
graph.insert_op_on_var(graph.create_operation(op_type='Test_2', attributes={}), var=var)
export_ppq_graph(graph=graph, platform=TargetPlatform.ONNX, graph_save_to='graph')
processer = SearchableGraph(graph)
paths = processer.path_matching(
sp_expr=lambda x: x.type == 'Test_1',
rp_expr=lambda x, y: True,
ep_expr=lambda x: x.type == 'Test_2',
direction='down')
assert len(paths) == 8
paths = processer.path_matching(
sp_expr=lambda x: x.type == 'Test_1',
rp_expr=lambda x, y: True,
ep_expr=lambda x: x.type == 'Test_2',
direction='up')
assert len(paths) == 8 | 47.412935 | 92 | 0.671039 | 1,192 | 9,530 | 5.15604 | 0.077181 | 0.117149 | 0.110641 | 0.108526 | 0.933127 | 0.897169 | 0.881061 | 0.881061 | 0.881061 | 0.881061 | 0 | 0.01529 | 0.183316 | 9,530 | 201 | 93 | 47.412935 | 0.77438 | 0.003673 | 0 | 0.840659 | 0 | 0 | 0.055942 | 0 | 0 | 0 | 0 | 0 | 0.131868 | 1 | 0 | false | 0 | 0.016484 | 0 | 0.016484 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
944ef3bf1904300e7a094cd2726025e672bdfb4e | 17,518 | py | Python | tests/fixtures/forms.py | rmorison/slack_forms | 4f8bfae889941643d43a6564a5d74e52018d7ee8 | [
"ISC"
] | null | null | null | tests/fixtures/forms.py | rmorison/slack_forms | 4f8bfae889941643d43a6564a5d74e52018d7ee8 | [
"ISC"
] | null | null | null | tests/fixtures/forms.py | rmorison/slack_forms | 4f8bfae889941643d43a6564a5d74e52018d7ee8 | [
"ISC"
] | 2 | 2021-09-21T15:20:52.000Z | 2021-09-21T17:39:14.000Z | import pytest # type: ignore
from typing import Type, Any, Dict
from slack_forms import forms
from .fields import test_fields
@pytest.fixture
def test_form_class(test_fields) -> Type[forms.Form]:
class TestForm(forms.Form):
button = test_fields["button"]
text = test_fields["text"]
checkbox = test_fields["checkbox"]
radio_button = test_fields["radio_button"]
multi_select = test_fields["multi_select"]
return TestForm
@pytest.fixture
def test_form_view_data() -> Dict[str, Any]:
"""Captured from TestForm run"""
return {
"id": "V02GHRFSNDP",
"team_id": "T025D39CRFF",
"type": "modal",
"blocks": [
{
"type": "actions",
"block_id": "hxF=e",
"elements": [
{
"type": "button",
"action_id": "button-action",
"text": {
"type": "plain_text",
"text": "My Button",
"emoji": True,
},
}
],
},
{
"type": "input",
"block_id": "text",
"label": {"type": "plain_text", "text": "My Text", "emoji": True},
"optional": False,
"dispatch_action": False,
"element": {
"type": "plain_text_input",
"action_id": "text-action",
"placeholder": {
"type": "plain_text",
"text": "Enter text",
"emoji": True,
},
"multiline": False,
"dispatch_action_config": {
"trigger_actions_on": ["on_enter_pressed"]
},
},
},
{
"type": "input",
"block_id": "checkbox",
"label": {"type": "plain_text", "text": "My Checkbox", "emoji": True},
"optional": False,
"dispatch_action": False,
"element": {
"type": "checkboxes",
"action_id": "checkbox-action",
"options": [
{
"text": {
"type": "plain_text",
"text": "check 1",
"emoji": True,
},
"value": "check 1",
},
{
"text": {
"type": "plain_text",
"text": "check 2",
"emoji": True,
},
"value": "check 2",
},
],
},
},
{
"type": "input",
"block_id": "radio-button",
"label": {
"type": "plain_text",
"text": "My RadioButton",
"emoji": True,
},
"optional": False,
"dispatch_action": False,
"element": {
"type": "radio_buttons",
"action_id": "radio-button-action",
"options": [
{
"text": {
"type": "plain_text",
"text": "radio 1",
"emoji": True,
},
"value": "radio 1",
},
{
"text": {
"type": "plain_text",
"text": "radio 2",
"emoji": True,
},
"value": "radio 2",
},
],
},
},
{
"type": "input",
"block_id": "multi-select",
"label": {
"type": "plain_text",
"text": "My MultiSelect",
"emoji": True,
},
"optional": False,
"dispatch_action": False,
"element": {
"type": "multi_static_select",
"action_id": "multi-select-action",
"placeholder": {
"type": "plain_text",
"text": "Select items",
"emoji": True,
},
"options": [
{
"text": {
"type": "plain_text",
"text": "multi 1",
"emoji": True,
},
"value": "multi 1",
},
{
"text": {
"type": "plain_text",
"text": "multi 2",
"emoji": True,
},
"value": "multi 2",
},
],
},
},
],
"private_metadata": "",
"callback_id": "7c6edd55-771b-45dc-ac67-73431b69d032",
"state": {
"values": {
"text": {
"text-action": {"type": "plain_text_input", "value": "some text"}
},
"checkbox": {
"checkbox-action": {
"type": "checkboxes",
"selected_options": [
{
"text": {
"type": "plain_text",
"text": "check " "1",
"emoji": True,
},
"value": "check " "1",
}
],
}
},
"radio-button": {
"radio-button-action": {
"type": "radio_buttons",
"selected_option": {
"text": {
"type": "plain_text",
"text": "radio " "1",
"emoji": True,
},
"value": "radio " "1",
},
}
},
"multi-select": {
"multi-select-action": {
"type": "multi_static_select",
"selected_options": [
{
"text": {
"type": "plain_text",
"text": "multi " "1",
"emoji": True,
},
"value": "multi " "1",
}
],
}
},
}
},
"hash": "1632964086.MNKl1Hdu",
"title": {"type": "plain_text", "text": "Test", "emoji": True},
"clear_on_close": False,
"notify_on_close": False,
"close": {"type": "plain_text", "text": "Cancel", "emoji": True},
"submit": {"type": "plain_text", "text": "Submit", "emoji": True},
"previous_view_id": None,
"root_view_id": "V02GHRFSNDP",
"app_id": "A0275CT13NU",
"external_id": "",
"app_installed_team_id": "T025D39CRFF",
"bot_id": "B026UCJGQ01",
}
@pytest.fixture
def test_form_body_data() -> Dict[str, Any]:
return {
"type": "view_submission",
"team": {"id": "T025D39CRFF", "domain": "aspirationeng-yvu5018"},
"user": {
"id": "U025NA0DH6G",
"username": "rmorison",
"name": "rmorison",
"team_id": "T025D39CRFF",
},
"api_app_id": "A0275CT13NU",
"token": "Uc9rD8v3dUGtSQroDfYQ18Z7",
"trigger_id": "2549248017059.2183111433525.63a83adba6d7d2a75c1c0a4645b7f852",
"view": {
"id": "V02GHRFSNDP",
"team_id": "T025D39CRFF",
"type": "modal",
"blocks": [
{
"type": "actions",
"block_id": "hxF=e",
"elements": [
{
"type": "button",
"action_id": "button-action",
"text": {
"type": "plain_text",
"text": "My Button",
"emoji": True,
},
}
],
},
{
"type": "input",
"block_id": "text",
"label": {"type": "plain_text", "text": "My Text", "emoji": True},
"optional": False,
"dispatch_action": False,
"element": {
"type": "plain_text_input",
"action_id": "text-action",
"placeholder": {
"type": "plain_text",
"text": "Enter text",
"emoji": True,
},
"multiline": False,
"dispatch_action_config": {
"trigger_actions_on": ["on_enter_pressed"]
},
},
},
{
"type": "input",
"block_id": "checkbox",
"label": {
"type": "plain_text",
"text": "My Checkbox",
"emoji": True,
},
"optional": False,
"dispatch_action": False,
"element": {
"type": "checkboxes",
"action_id": "checkbox-action",
"options": [
{
"text": {
"type": "plain_text",
"text": "check 1",
"emoji": True,
},
"value": "check 1",
},
{
"text": {
"type": "plain_text",
"text": "check 2",
"emoji": True,
},
"value": "check 2",
},
],
},
},
{
"type": "input",
"block_id": "radio-button",
"label": {
"type": "plain_text",
"text": "My RadioButton",
"emoji": True,
},
"optional": False,
"dispatch_action": False,
"element": {
"type": "radio_buttons",
"action_id": "radio-button-action",
"options": [
{
"text": {
"type": "plain_text",
"text": "radio 1",
"emoji": True,
},
"value": "radio 1",
},
{
"text": {
"type": "plain_text",
"text": "radio 2",
"emoji": True,
},
"value": "radio 2",
},
],
},
},
{
"type": "input",
"block_id": "multi-select",
"label": {
"type": "plain_text",
"text": "My MultiSelect",
"emoji": True,
},
"optional": False,
"dispatch_action": False,
"element": {
"type": "multi_static_select",
"action_id": "multi-select-action",
"placeholder": {
"type": "plain_text",
"text": "Select items",
"emoji": True,
},
"options": [
{
"text": {
"type": "plain_text",
"text": "multi 1",
"emoji": True,
},
"value": "multi 1",
},
{
"text": {
"type": "plain_text",
"text": "multi 2",
"emoji": True,
},
"value": "multi 2",
},
],
},
},
],
"private_metadata": "",
"callback_id": "7c6edd55-771b-45dc-ac67-73431b69d032",
"state": {
"values": {
"text": {
"text-action": {
"type": "plain_text_input",
"value": "some text",
}
},
"checkbox": {
"checkbox-action": {
"type": "checkboxes",
"selected_options": [
{
"text": {
"type": "plain_text",
"text": "check " "1",
"emoji": True,
},
"value": "check " "1",
}
],
}
},
"radio-button": {
"radio-button-action": {
"type": "radio_buttons",
"selected_option": {
"text": {
"type": "plain_text",
"text": "radio " "1",
"emoji": True,
},
"value": "radio " "1",
},
}
},
"multi-select": {
"multi-select-action": {
"type": "multi_static_select",
"selected_options": [
{
"text": {
"type": "plain_text",
"text": "multi " "1",
"emoji": True,
},
"value": "multi " "1",
}
],
}
},
}
},
"hash": "1632964086.MNKl1Hdu",
"title": {"type": "plain_text", "text": "Test", "emoji": True},
"clear_on_close": False,
"notify_on_close": False,
"close": {"type": "plain_text", "text": "Cancel", "emoji": True},
"submit": {"type": "plain_text", "text": "Submit", "emoji": True},
"previous_view_id": None,
"root_view_id": "V02GHRFSNDP",
"app_id": "A0275CT13NU",
"external_id": "",
"app_installed_team_id": "T025D39CRFF",
"bot_id": "B026UCJGQ01",
},
"response_urls": [],
"is_enterprise_install": False,
"enterprise": None,
}
| 37.917749 | 86 | 0.266526 | 902 | 17,518 | 4.992239 | 0.134146 | 0.083944 | 0.121253 | 0.14346 | 0.854097 | 0.838108 | 0.838108 | 0.838108 | 0.838108 | 0.838108 | 0 | 0.033596 | 0.615995 | 17,518 | 461 | 87 | 38 | 0.635796 | 0.002283 | 0 | 0.663717 | 0 | 0 | 0.233288 | 0.016255 | 0 | 0 | 0 | 0 | 0 | 1 | 0.006637 | false | 0 | 0.00885 | 0.002212 | 0.035398 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
9455bc8c918b04674b97ba28620f530b9b9cff9e | 4,284 | py | Python | tests/annotation/test_motion_annotation.py | saltastroops/imephu | 0c302a73d01fe3ad018e7adf4b91e0beaecc6709 | [
"MIT"
] | null | null | null | tests/annotation/test_motion_annotation.py | saltastroops/imephu | 0c302a73d01fe3ad018e7adf4b91e0beaecc6709 | [
"MIT"
] | 3 | 2022-02-02T20:51:05.000Z | 2022-02-03T21:13:27.000Z | tests/annotation/test_motion_annotation.py | saltastroops/imephu | 0c302a73d01fe3ad018e7adf4b91e0beaecc6709 | [
"MIT"
] | null | null | null | from datetime import datetime, timedelta, timezone
import pytest
from astropy import units as u
from astropy.coordinates import SkyCoord
from imephu.annotation.motion import motion_annotation
from imephu.finder_chart import FinderChart
from imephu.geometry import rotate
from imephu.utils import Ephemeris, MagnitudeRange
@pytest.mark.parametrize(
"angle",
[
0 * u.deg,
45 * u.deg,
90 * u.deg,
135 * u.deg,
180 * u.deg,
225 * u.deg,
270 * u.deg,
315 * u.deg,
],
)
def test_large_motion_annotation(angle, fits_file, fits_center, check_finder, legend):
"""Test the annotation for large motions."""
finder_chart = FinderChart(fits_file)
initial_position = rotate(
v=SkyCoord(ra="00h40m10s", dec="-60d00m00s"),
pivot=fits_center,
angle=angle,
wcs=finder_chart.wcs,
)
initial_ephemeris = Ephemeris(
epoch=datetime(2022, 2, 5, 22, 0, 0, 0, tzinfo=timezone.utc),
position=initial_position,
magnitude_range=MagnitudeRange(
min_magnitude=18, max_magnitude=18, bandpass="V"
),
)
middle_ephemeris = Ephemeris(
epoch=datetime(2022, 2, 6, 0, 0, 0, 0, tzinfo=timezone.utc),
position=fits_center,
magnitude_range=MagnitudeRange(
min_magnitude=18, max_magnitude=18, bandpass="V"
),
)
final_position = rotate(
v=SkyCoord(ra="00h39m50s", dec="-60d00m00s"),
pivot=fits_center,
angle=angle,
wcs=finder_chart.wcs,
)
sast = timezone(timedelta(hours=2), "SAST")
# note the different timezone for the final ephemeris
final_ephemeris = Ephemeris(
epoch=datetime(2022, 2, 6, 4, 0, 0, 0, tzinfo=sast),
position=final_position,
magnitude_range=MagnitudeRange(
min_magnitude=18, max_magnitude=18, bandpass="V"
),
)
# ephemerides need not be sorted by epoch
ephemerides = [middle_ephemeris, initial_ephemeris, final_ephemeris]
motion_annotation_ = motion_annotation(
ephemerides=ephemerides, wcs=finder_chart.wcs
)
finder_chart.add_annotation(motion_annotation_)
finder_chart.add_annotation(legend(f"Angle: {angle}", finder_chart.wcs))
check_finder(finder_chart)
@pytest.mark.parametrize(
"angle",
[
0 * u.deg,
45 * u.deg,
90 * u.deg,
135 * u.deg,
180 * u.deg,
225 * u.deg,
270 * u.deg,
315 * u.deg,
],
)
def test_small_motion_annotation(angle, fits_file, fits_center, check_finder, legend):
"""Test the annotation for small motions."""
finder_chart = FinderChart(fits_file)
initial_position = rotate(
v=SkyCoord(ra="00h40m00.5s", dec="-60d00m00s"),
pivot=fits_center,
angle=angle,
wcs=finder_chart.wcs,
)
initial_ephemeris = Ephemeris(
epoch=datetime(2022, 2, 5, 22, 0, 0, 0, tzinfo=timezone.utc),
position=initial_position,
magnitude_range=MagnitudeRange(
min_magnitude=18, max_magnitude=18, bandpass="V"
),
)
middle_ephemeris = Ephemeris(
epoch=datetime(2022, 2, 6, 0, 0, 0, 0, tzinfo=timezone.utc),
position=fits_center,
magnitude_range=MagnitudeRange(
min_magnitude=18, max_magnitude=18, bandpass="V"
),
)
final_position = rotate(
v=SkyCoord(ra="00h39m59.5s", dec="-60d00m00s"),
pivot=fits_center,
angle=angle,
wcs=finder_chart.wcs,
)
sast = timezone(timedelta(hours=2), "SAST")
# note the different timezone for the final ephemeris
final_ephemeris = Ephemeris(
epoch=datetime(2022, 2, 6, 4, 0, 0, 0, tzinfo=sast),
position=final_position,
magnitude_range=MagnitudeRange(
min_magnitude=18, max_magnitude=18, bandpass="V"
),
)
# ephemerides need not be sorted by epoch
ephemerides = [middle_ephemeris, initial_ephemeris, final_ephemeris]
motion_annotation_ = motion_annotation(
ephemerides=ephemerides, wcs=finder_chart.wcs
)
finder_chart.add_annotation(motion_annotation_)
finder_chart.add_annotation(legend(f"Angle: {angle}", finder_chart.wcs))
check_finder(finder_chart)
| 31.733333 | 86 | 0.64239 | 511 | 4,284 | 5.205479 | 0.174168 | 0.070301 | 0.042105 | 0.038346 | 0.87594 | 0.87594 | 0.87594 | 0.87594 | 0.87594 | 0.87594 | 0 | 0.055504 | 0.251401 | 4,284 | 134 | 87 | 31.970149 | 0.773932 | 0.061158 | 0 | 0.75 | 0 | 0 | 0.032934 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.016667 | false | 0.05 | 0.066667 | 0 | 0.083333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
946845ca820b55d197d9ca53af605b4d4b12c6d7 | 76 | py | Python | newProject/hello.py | yangfangg/mycode | aca3771193e53366183b6b11497c2a3b4249f4b2 | [
"MIT"
] | 1 | 2019-08-13T09:55:58.000Z | 2019-08-13T09:55:58.000Z | newProject/hello.py | yangfangg/mycode | aca3771193e53366183b6b11497c2a3b4249f4b2 | [
"MIT"
] | null | null | null | newProject/hello.py | yangfangg/mycode | aca3771193e53366183b6b11497c2a3b4249f4b2 | [
"MIT"
] | null | null | null | print("hello")
num = 33
num = 33
num = 33
num = 33
num = 33
num = 33
| 5.066667 | 14 | 0.526316 | 14 | 76 | 2.857143 | 0.285714 | 0.75 | 1 | 1.25 | 0.75 | 0.75 | 0.75 | 0.75 | 0.75 | 0.75 | 0 | 0.24 | 0.342105 | 76 | 14 | 15 | 5.428571 | 0.56 | 0 | 0 | 0.857143 | 0 | 0 | 0.071429 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 |
846caae961cb42d13e41a66ca2bf2294b90d0da5 | 173 | py | Python | 19. Modules/converter.py | VasuGoel/python-personal-notes | 752c84533677e30e2abdaaf288ed7cf43220bd42 | [
"MIT"
] | 1 | 2019-09-04T12:08:29.000Z | 2019-09-04T12:08:29.000Z | 19. Modules/converter.py | VasuGoel/python-personal-notes | 752c84533677e30e2abdaaf288ed7cf43220bd42 | [
"MIT"
] | null | null | null | 19. Modules/converter.py | VasuGoel/python-personal-notes | 752c84533677e30e2abdaaf288ed7cf43220bd42 | [
"MIT"
] | 2 | 2019-09-04T12:08:30.000Z | 2020-10-13T16:18:58.000Z | # Module containing all necessary weight converter functions
def kg_to_lbs(weight):
return float(weight / 0.45)
def lbs_to_kg(weight):
return float(weight * 0.45)
| 21.625 | 60 | 0.739884 | 27 | 173 | 4.592593 | 0.555556 | 0.193548 | 0.274194 | 0.370968 | 0.419355 | 0.419355 | 0 | 0 | 0 | 0 | 0 | 0.041958 | 0.17341 | 173 | 7 | 61 | 24.714286 | 0.825175 | 0.33526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 1 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 7 |
04a0056cb7d470ada5e25763deb54bf78956c51c | 5,521 | py | Python | finetune_stage2/pointnet.py | wangkangkan/LearningDenseCorrespondences | 724eb9521de1abeda551ede6d93cbecaba90efbd | [
"MIT"
] | null | null | null | finetune_stage2/pointnet.py | wangkangkan/LearningDenseCorrespondences | 724eb9521de1abeda551ede6d93cbecaba90efbd | [
"MIT"
] | null | null | null | finetune_stage2/pointnet.py | wangkangkan/LearningDenseCorrespondences | 724eb9521de1abeda551ede6d93cbecaba90efbd | [
"MIT"
] | null | null | null | import tensorflow as tf
import tf_util
def pointnet_feature(point_cloud, is_training, bn_decay=None):
""" Classification PointNet, input is BxNx3, output Bx40 """
batch_size = point_cloud.get_shape()[0].value
num_point = point_cloud.get_shape()[1].value
input_image = tf.expand_dims(point_cloud, -1) # input_image BxNx3x1
with tf.variable_scope("pointnet") as scope:
# Point functions (MLP implemented as conv2d)
net = tf_util.conv2d(input_image, 64, [1,3],
padding='VALID', stride=[1,1],
bn=True, is_training=is_training,
scope='conv1', bn_decay=bn_decay)
net1 = net
# net = tf_util.conv2d(net, 64, [1,1],
# padding='VALID', stride=[1,1],
# bn=True, is_training=is_training,
# scope='conv2', bn_decay=bn_decay)
# net2 = net
# net = tf_util.conv2d(net, 64, [1,1],
# padding='VALID', stride=[1,1],
# bn=True, is_training=is_training,
# scope='conv3', bn_decay=bn_decay)
net3 = net
net = tf_util.conv2d(net, 128, [1,1],
padding='VALID', stride=[1,1],
bn=True, is_training=is_training,
scope='conv4', bn_decay=bn_decay)
net4 = net
net = tf_util.conv2d(net, 1024, [1,1],
padding='VALID', stride=[1,1],
bn=True, is_training=is_training,
scope='conv5', bn_decay=bn_decay)
net5 = net
# Symmetric function: max pooling
net = tf_util.max_pool2d(net, [num_point,1],
padding='VALID', scope='maxpool')
net6 = net
# MLP on global point cloud vector
net = tf.reshape(net, [batch_size, -1])
# net = tf_util.fully_connected(net, 1024, bn=True, is_training=is_training,
# scope='fc1', bn_decay=bn_decay)
# net7 = net
# net = tf_util.fully_connected(net, 2048, bn=True, is_training=is_training,
# scope='fc2', bn_decay=bn_decay)
# net = tf_util.dropout(net, keep_prob=0.7, is_training=is_training,
# scope='dp1')
#net = tf_util.fully_connected(net, 40, activation_fn=None, scope='fc3')
#net = tf.nn.sigmoid(net, name="sigmoid")
variables = tf.contrib.framework.get_variables(scope)
# # print(variables)
# for val in variables:
# print(val)
# exit()
return net, variables
def ournetwork(point_cloud, is_training, reuse, bn_decay=None):
""" Classification PointNet, input is BxNx3, output Bx40 """
batch_size = point_cloud.get_shape()[0].value
num_point = point_cloud.get_shape()[1].value
input_image = tf.expand_dims(point_cloud, -1) # input_image BxNx3x1
with tf.variable_scope("pointnet", reuse=reuse) as scope:
# Point functions (MLP implemented as conv2d)
net = tf_util.conv2d(input_image, 64, [1, 3],
padding='VALID', stride=[1, 1],
bn=True, is_training=is_training,
scope='conv1', bn_decay=bn_decay)
net1 = net
# net = tf_util.conv2d(net, 64, [1,1],
# padding='VALID', stride=[1,1],
# bn=True, is_training=is_training,
# scope='conv2', bn_decay=bn_decay)
# net2 = net
# net = tf_util.conv2d(net, 64, [1,1],
# padding='VALID', stride=[1,1],
# bn=True, is_training=is_training,
# scope='conv3', bn_decay=bn_decay)
net3 = net
net = tf_util.conv2d(net, 128, [1, 1],
padding='VALID', stride=[1, 1],
bn=True, is_training=is_training,
scope='conv4', bn_decay=bn_decay)
net4 = net
net = tf_util.conv2d(net, 1024, [1, 1],
padding='VALID', stride=[1, 1],
bn=True, is_training=is_training,
scope='conv5', bn_decay=bn_decay)
net5 = net
# Symmetric function: max pooling
net = tf_util.max_pool2d(net, [num_point, 1],
padding='VALID', scope='maxpool')
net6 = net
# MLP on global point cloud vector
net = tf.reshape(net, [batch_size, -1])
net = tf_util.fully_connected(net, 1024, bn=True, is_training=is_training,
scope='fc1', bn_decay=bn_decay)
net7 = net
net = tf_util.fully_connected(net, 2048, bn=True, is_training=is_training,
scope='fc2', bn_decay=bn_decay)
net = tf_util.dropout(net, keep_prob=0.7, is_training=is_training,
scope='dp1')
net = tf_util.fully_connected(net, 85, activation_fn=None, scope='fc3')
# net = tf.nn.sigmoid(net, name="sigmoid")
variables = tf.contrib.framework.get_variables(scope)
# # print(variables)
# for val in variables:
# print(val)
# exit()
return net, variables
| 46.788136 | 84 | 0.512226 | 645 | 5,521 | 4.182946 | 0.153488 | 0.126019 | 0.066716 | 0.118606 | 0.954781 | 0.954781 | 0.954781 | 0.954781 | 0.954781 | 0.954781 | 0 | 0.045074 | 0.373121 | 5,521 | 117 | 85 | 47.188034 | 0.73447 | 0.334541 | 0 | 0.78125 | 0 | 0 | 0.030982 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.03125 | false | 0 | 0.03125 | 0 | 0.09375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
b6ca141053945eeea97055d6a2a7d26905506da1 | 2,713 | py | Python | ucb_cs61A/projects/hog/tests/04.py | tavaresdong/courses-notes | 7fb89103bca679f5ef9b14cbc777152daac1402e | [
"MIT"
] | null | null | null | ucb_cs61A/projects/hog/tests/04.py | tavaresdong/courses-notes | 7fb89103bca679f5ef9b14cbc777152daac1402e | [
"MIT"
] | 1 | 2017-07-31T08:15:26.000Z | 2017-07-31T08:15:26.000Z | ucb_cs61A/projects/hog/tests/04.py | tavaresdong/courses-notes | 7fb89103bca679f5ef9b14cbc777152daac1402e | [
"MIT"
] | 1 | 2019-10-06T16:52:31.000Z | 2019-10-06T16:52:31.000Z | test = {
'name': 'Question 4',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> is_swap(19, 91)
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(20, 40)
False
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(41, 14)
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(13, 32)
False
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(23, 42)
False
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(55, 55)
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(114, 41) # We check the last two digits
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(41, 114) # We check the last two digits
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(2, 20) # 2 can be interpreted as 02
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(20, 2) # 2 can be interpreted as 02
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(13, 47)
False
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(67,76)
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(107, 70)
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(81, 118)
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> is_swap(71, 107)
False
""",
'hidden': False,
'locked': False
}
],
'scored': True,
'setup': r"""
>>> from hog import *
""",
'teardown': '',
'type': 'doctest'
}
]
} | 19.948529 | 61 | 0.298194 | 207 | 2,713 | 3.835749 | 0.270531 | 0.094458 | 0.132242 | 0.207809 | 0.81738 | 0.783375 | 0.783375 | 0.783375 | 0.783375 | 0.400504 | 0 | 0.056484 | 0.536675 | 2,713 | 136 | 62 | 19.948529 | 0.575179 | 0 | 0 | 0.558824 | 0 | 0 | 0.480103 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.007353 | 0 | 0.007353 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
b6cdca7156a3724dbe3216d7e728be4c9f4ca93c | 96 | py | Python | rpcplugin/__init__.py | rpcplugin/python | 780538366c66624ed89e93647586326bc06b43d6 | [
"MIT"
] | null | null | null | rpcplugin/__init__.py | rpcplugin/python | 780538366c66624ed89e93647586326bc06b43d6 | [
"MIT"
] | null | null | null | rpcplugin/__init__.py | rpcplugin/python | 780538366c66624ed89e93647586326bc06b43d6 | [
"MIT"
] | null | null | null | from rpcplugin.handshake import *
from rpcplugin.client import *
from rpcplugin.server import *
| 24 | 33 | 0.8125 | 12 | 96 | 6.5 | 0.5 | 0.5 | 0.487179 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 96 | 3 | 34 | 32 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
b6d6f43943ef4215bdfcb13dc206209e18c2c864 | 49,168 | py | Python | mediaMicroservices/gen-py/media_service/UserService.py | rodrigo-bruno/DeathStarBench | c9ce09aaf7c1298a7c88efacd1010a71db0fa59d | [
"Apache-2.0"
] | 364 | 2019-04-28T01:45:37.000Z | 2022-03-31T15:08:03.000Z | mediaMicroservices/gen-py/media_service/UserService.py | rodrigo-bruno/DeathStarBench | c9ce09aaf7c1298a7c88efacd1010a71db0fa59d | [
"Apache-2.0"
] | 111 | 2019-04-15T11:08:49.000Z | 2022-03-31T17:39:16.000Z | mediaMicroservices/gen-py/media_service/UserService.py | rodrigo-bruno/DeathStarBench | c9ce09aaf7c1298a7c88efacd1010a71db0fa59d | [
"Apache-2.0"
] | 229 | 2019-05-14T08:55:57.000Z | 2022-03-31T03:14:55.000Z | #
# Autogenerated by Thrift Compiler (0.12.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive import fix_spec
import sys
import logging
from .ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
all_structs = []
class Iface(object):
def RegisterUser(self, req_id, first_name, last_name, username, password, carrier):
"""
Parameters:
- req_id
- first_name
- last_name
- username
- password
- carrier
"""
pass
def RegisterUserWithId(self, req_id, first_name, last_name, username, password, user_id, carrier):
"""
Parameters:
- req_id
- first_name
- last_name
- username
- password
- user_id
- carrier
"""
pass
def Login(self, req_id, username, password, carrier):
"""
Parameters:
- req_id
- username
- password
- carrier
"""
pass
def UploadUserWithUserId(self, req_id, user_id, carrier):
"""
Parameters:
- req_id
- user_id
- carrier
"""
pass
def UploadUserWithUsername(self, req_id, username, carrier):
"""
Parameters:
- req_id
- username
- carrier
"""
pass
class Client(Iface):
def __init__(self, iprot, oprot=None):
self._iprot = self._oprot = iprot
if oprot is not None:
self._oprot = oprot
self._seqid = 0
def RegisterUser(self, req_id, first_name, last_name, username, password, carrier):
"""
Parameters:
- req_id
- first_name
- last_name
- username
- password
- carrier
"""
self.send_RegisterUser(req_id, first_name, last_name, username, password, carrier)
self.recv_RegisterUser()
def send_RegisterUser(self, req_id, first_name, last_name, username, password, carrier):
self._oprot.writeMessageBegin('RegisterUser', TMessageType.CALL, self._seqid)
args = RegisterUser_args()
args.req_id = req_id
args.first_name = first_name
args.last_name = last_name
args.username = username
args.password = password
args.carrier = carrier
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_RegisterUser(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = RegisterUser_result()
result.read(iprot)
iprot.readMessageEnd()
if result.se is not None:
raise result.se
return
def RegisterUserWithId(self, req_id, first_name, last_name, username, password, user_id, carrier):
"""
Parameters:
- req_id
- first_name
- last_name
- username
- password
- user_id
- carrier
"""
self.send_RegisterUserWithId(req_id, first_name, last_name, username, password, user_id, carrier)
self.recv_RegisterUserWithId()
def send_RegisterUserWithId(self, req_id, first_name, last_name, username, password, user_id, carrier):
self._oprot.writeMessageBegin('RegisterUserWithId', TMessageType.CALL, self._seqid)
args = RegisterUserWithId_args()
args.req_id = req_id
args.first_name = first_name
args.last_name = last_name
args.username = username
args.password = password
args.user_id = user_id
args.carrier = carrier
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_RegisterUserWithId(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = RegisterUserWithId_result()
result.read(iprot)
iprot.readMessageEnd()
if result.se is not None:
raise result.se
return
def Login(self, req_id, username, password, carrier):
"""
Parameters:
- req_id
- username
- password
- carrier
"""
self.send_Login(req_id, username, password, carrier)
return self.recv_Login()
def send_Login(self, req_id, username, password, carrier):
self._oprot.writeMessageBegin('Login', TMessageType.CALL, self._seqid)
args = Login_args()
args.req_id = req_id
args.username = username
args.password = password
args.carrier = carrier
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_Login(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = Login_result()
result.read(iprot)
iprot.readMessageEnd()
if result.success is not None:
return result.success
if result.se is not None:
raise result.se
raise TApplicationException(TApplicationException.MISSING_RESULT, "Login failed: unknown result")
def UploadUserWithUserId(self, req_id, user_id, carrier):
"""
Parameters:
- req_id
- user_id
- carrier
"""
self.send_UploadUserWithUserId(req_id, user_id, carrier)
self.recv_UploadUserWithUserId()
def send_UploadUserWithUserId(self, req_id, user_id, carrier):
self._oprot.writeMessageBegin('UploadUserWithUserId', TMessageType.CALL, self._seqid)
args = UploadUserWithUserId_args()
args.req_id = req_id
args.user_id = user_id
args.carrier = carrier
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_UploadUserWithUserId(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = UploadUserWithUserId_result()
result.read(iprot)
iprot.readMessageEnd()
if result.se is not None:
raise result.se
return
def UploadUserWithUsername(self, req_id, username, carrier):
"""
Parameters:
- req_id
- username
- carrier
"""
self.send_UploadUserWithUsername(req_id, username, carrier)
self.recv_UploadUserWithUsername()
def send_UploadUserWithUsername(self, req_id, username, carrier):
self._oprot.writeMessageBegin('UploadUserWithUsername', TMessageType.CALL, self._seqid)
args = UploadUserWithUsername_args()
args.req_id = req_id
args.username = username
args.carrier = carrier
args.write(self._oprot)
self._oprot.writeMessageEnd()
self._oprot.trans.flush()
def recv_UploadUserWithUsername(self):
iprot = self._iprot
(fname, mtype, rseqid) = iprot.readMessageBegin()
if mtype == TMessageType.EXCEPTION:
x = TApplicationException()
x.read(iprot)
iprot.readMessageEnd()
raise x
result = UploadUserWithUsername_result()
result.read(iprot)
iprot.readMessageEnd()
if result.se is not None:
raise result.se
return
class Processor(Iface, TProcessor):
def __init__(self, handler):
self._handler = handler
self._processMap = {}
self._processMap["RegisterUser"] = Processor.process_RegisterUser
self._processMap["RegisterUserWithId"] = Processor.process_RegisterUserWithId
self._processMap["Login"] = Processor.process_Login
self._processMap["UploadUserWithUserId"] = Processor.process_UploadUserWithUserId
self._processMap["UploadUserWithUsername"] = Processor.process_UploadUserWithUsername
def process(self, iprot, oprot):
(name, type, seqid) = iprot.readMessageBegin()
if name not in self._processMap:
iprot.skip(TType.STRUCT)
iprot.readMessageEnd()
x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
x.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
return
else:
self._processMap[name](self, seqid, iprot, oprot)
return True
def process_RegisterUser(self, seqid, iprot, oprot):
args = RegisterUser_args()
args.read(iprot)
iprot.readMessageEnd()
result = RegisterUser_result()
try:
self._handler.RegisterUser(args.req_id, args.first_name, args.last_name, args.username, args.password, args.carrier)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except ServiceException as se:
msg_type = TMessageType.REPLY
result.se = se
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("RegisterUser", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_RegisterUserWithId(self, seqid, iprot, oprot):
args = RegisterUserWithId_args()
args.read(iprot)
iprot.readMessageEnd()
result = RegisterUserWithId_result()
try:
self._handler.RegisterUserWithId(args.req_id, args.first_name, args.last_name, args.username, args.password, args.user_id, args.carrier)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except ServiceException as se:
msg_type = TMessageType.REPLY
result.se = se
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("RegisterUserWithId", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_Login(self, seqid, iprot, oprot):
args = Login_args()
args.read(iprot)
iprot.readMessageEnd()
result = Login_result()
try:
result.success = self._handler.Login(args.req_id, args.username, args.password, args.carrier)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except ServiceException as se:
msg_type = TMessageType.REPLY
result.se = se
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("Login", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_UploadUserWithUserId(self, seqid, iprot, oprot):
args = UploadUserWithUserId_args()
args.read(iprot)
iprot.readMessageEnd()
result = UploadUserWithUserId_result()
try:
self._handler.UploadUserWithUserId(args.req_id, args.user_id, args.carrier)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except ServiceException as se:
msg_type = TMessageType.REPLY
result.se = se
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("UploadUserWithUserId", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
def process_UploadUserWithUsername(self, seqid, iprot, oprot):
args = UploadUserWithUsername_args()
args.read(iprot)
iprot.readMessageEnd()
result = UploadUserWithUsername_result()
try:
self._handler.UploadUserWithUsername(args.req_id, args.username, args.carrier)
msg_type = TMessageType.REPLY
except TTransport.TTransportException:
raise
except ServiceException as se:
msg_type = TMessageType.REPLY
result.se = se
except TApplicationException as ex:
logging.exception('TApplication exception in handler')
msg_type = TMessageType.EXCEPTION
result = ex
except Exception:
logging.exception('Unexpected exception in handler')
msg_type = TMessageType.EXCEPTION
result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
oprot.writeMessageBegin("UploadUserWithUsername", msg_type, seqid)
result.write(oprot)
oprot.writeMessageEnd()
oprot.trans.flush()
# HELPER FUNCTIONS AND STRUCTURES
class RegisterUser_args(object):
"""
Attributes:
- req_id
- first_name
- last_name
- username
- password
- carrier
"""
def __init__(self, req_id=None, first_name=None, last_name=None, username=None, password=None, carrier=None,):
self.req_id = req_id
self.first_name = first_name
self.last_name = last_name
self.username = username
self.password = password
self.carrier = carrier
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I64:
self.req_id = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.first_name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.last_name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.username = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.STRING:
self.password = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.MAP:
self.carrier = {}
(_ktype88, _vtype89, _size87) = iprot.readMapBegin()
for _i91 in range(_size87):
_key92 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
_val93 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.carrier[_key92] = _val93
iprot.readMapEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('RegisterUser_args')
if self.req_id is not None:
oprot.writeFieldBegin('req_id', TType.I64, 1)
oprot.writeI64(self.req_id)
oprot.writeFieldEnd()
if self.first_name is not None:
oprot.writeFieldBegin('first_name', TType.STRING, 2)
oprot.writeString(self.first_name.encode('utf-8') if sys.version_info[0] == 2 else self.first_name)
oprot.writeFieldEnd()
if self.last_name is not None:
oprot.writeFieldBegin('last_name', TType.STRING, 3)
oprot.writeString(self.last_name.encode('utf-8') if sys.version_info[0] == 2 else self.last_name)
oprot.writeFieldEnd()
if self.username is not None:
oprot.writeFieldBegin('username', TType.STRING, 4)
oprot.writeString(self.username.encode('utf-8') if sys.version_info[0] == 2 else self.username)
oprot.writeFieldEnd()
if self.password is not None:
oprot.writeFieldBegin('password', TType.STRING, 5)
oprot.writeString(self.password.encode('utf-8') if sys.version_info[0] == 2 else self.password)
oprot.writeFieldEnd()
if self.carrier is not None:
oprot.writeFieldBegin('carrier', TType.MAP, 6)
oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.carrier))
for kiter94, viter95 in self.carrier.items():
oprot.writeString(kiter94.encode('utf-8') if sys.version_info[0] == 2 else kiter94)
oprot.writeString(viter95.encode('utf-8') if sys.version_info[0] == 2 else viter95)
oprot.writeMapEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(RegisterUser_args)
RegisterUser_args.thrift_spec = (
None, # 0
(1, TType.I64, 'req_id', None, None, ), # 1
(2, TType.STRING, 'first_name', 'UTF8', None, ), # 2
(3, TType.STRING, 'last_name', 'UTF8', None, ), # 3
(4, TType.STRING, 'username', 'UTF8', None, ), # 4
(5, TType.STRING, 'password', 'UTF8', None, ), # 5
(6, TType.MAP, 'carrier', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 6
)
class RegisterUser_result(object):
"""
Attributes:
- se
"""
def __init__(self, se=None,):
self.se = se
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.se = ServiceException()
self.se.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('RegisterUser_result')
if self.se is not None:
oprot.writeFieldBegin('se', TType.STRUCT, 1)
self.se.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(RegisterUser_result)
RegisterUser_result.thrift_spec = (
None, # 0
(1, TType.STRUCT, 'se', [ServiceException, None], None, ), # 1
)
class RegisterUserWithId_args(object):
"""
Attributes:
- req_id
- first_name
- last_name
- username
- password
- user_id
- carrier
"""
def __init__(self, req_id=None, first_name=None, last_name=None, username=None, password=None, user_id=None, carrier=None,):
self.req_id = req_id
self.first_name = first_name
self.last_name = last_name
self.username = username
self.password = password
self.user_id = user_id
self.carrier = carrier
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I64:
self.req_id = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.first_name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.last_name = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.STRING:
self.username = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 5:
if ftype == TType.STRING:
self.password = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 6:
if ftype == TType.I64:
self.user_id = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 7:
if ftype == TType.MAP:
self.carrier = {}
(_ktype97, _vtype98, _size96) = iprot.readMapBegin()
for _i100 in range(_size96):
_key101 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
_val102 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.carrier[_key101] = _val102
iprot.readMapEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('RegisterUserWithId_args')
if self.req_id is not None:
oprot.writeFieldBegin('req_id', TType.I64, 1)
oprot.writeI64(self.req_id)
oprot.writeFieldEnd()
if self.first_name is not None:
oprot.writeFieldBegin('first_name', TType.STRING, 2)
oprot.writeString(self.first_name.encode('utf-8') if sys.version_info[0] == 2 else self.first_name)
oprot.writeFieldEnd()
if self.last_name is not None:
oprot.writeFieldBegin('last_name', TType.STRING, 3)
oprot.writeString(self.last_name.encode('utf-8') if sys.version_info[0] == 2 else self.last_name)
oprot.writeFieldEnd()
if self.username is not None:
oprot.writeFieldBegin('username', TType.STRING, 4)
oprot.writeString(self.username.encode('utf-8') if sys.version_info[0] == 2 else self.username)
oprot.writeFieldEnd()
if self.password is not None:
oprot.writeFieldBegin('password', TType.STRING, 5)
oprot.writeString(self.password.encode('utf-8') if sys.version_info[0] == 2 else self.password)
oprot.writeFieldEnd()
if self.user_id is not None:
oprot.writeFieldBegin('user_id', TType.I64, 6)
oprot.writeI64(self.user_id)
oprot.writeFieldEnd()
if self.carrier is not None:
oprot.writeFieldBegin('carrier', TType.MAP, 7)
oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.carrier))
for kiter103, viter104 in self.carrier.items():
oprot.writeString(kiter103.encode('utf-8') if sys.version_info[0] == 2 else kiter103)
oprot.writeString(viter104.encode('utf-8') if sys.version_info[0] == 2 else viter104)
oprot.writeMapEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(RegisterUserWithId_args)
RegisterUserWithId_args.thrift_spec = (
None, # 0
(1, TType.I64, 'req_id', None, None, ), # 1
(2, TType.STRING, 'first_name', 'UTF8', None, ), # 2
(3, TType.STRING, 'last_name', 'UTF8', None, ), # 3
(4, TType.STRING, 'username', 'UTF8', None, ), # 4
(5, TType.STRING, 'password', 'UTF8', None, ), # 5
(6, TType.I64, 'user_id', None, None, ), # 6
(7, TType.MAP, 'carrier', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 7
)
class RegisterUserWithId_result(object):
"""
Attributes:
- se
"""
def __init__(self, se=None,):
self.se = se
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.se = ServiceException()
self.se.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('RegisterUserWithId_result')
if self.se is not None:
oprot.writeFieldBegin('se', TType.STRUCT, 1)
self.se.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(RegisterUserWithId_result)
RegisterUserWithId_result.thrift_spec = (
None, # 0
(1, TType.STRUCT, 'se', [ServiceException, None], None, ), # 1
)
class Login_args(object):
"""
Attributes:
- req_id
- username
- password
- carrier
"""
def __init__(self, req_id=None, username=None, password=None, carrier=None,):
self.req_id = req_id
self.username = username
self.password = password
self.carrier = carrier
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I64:
self.req_id = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.username = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.STRING:
self.password = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 4:
if ftype == TType.MAP:
self.carrier = {}
(_ktype106, _vtype107, _size105) = iprot.readMapBegin()
for _i109 in range(_size105):
_key110 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
_val111 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.carrier[_key110] = _val111
iprot.readMapEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('Login_args')
if self.req_id is not None:
oprot.writeFieldBegin('req_id', TType.I64, 1)
oprot.writeI64(self.req_id)
oprot.writeFieldEnd()
if self.username is not None:
oprot.writeFieldBegin('username', TType.STRING, 2)
oprot.writeString(self.username.encode('utf-8') if sys.version_info[0] == 2 else self.username)
oprot.writeFieldEnd()
if self.password is not None:
oprot.writeFieldBegin('password', TType.STRING, 3)
oprot.writeString(self.password.encode('utf-8') if sys.version_info[0] == 2 else self.password)
oprot.writeFieldEnd()
if self.carrier is not None:
oprot.writeFieldBegin('carrier', TType.MAP, 4)
oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.carrier))
for kiter112, viter113 in self.carrier.items():
oprot.writeString(kiter112.encode('utf-8') if sys.version_info[0] == 2 else kiter112)
oprot.writeString(viter113.encode('utf-8') if sys.version_info[0] == 2 else viter113)
oprot.writeMapEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(Login_args)
Login_args.thrift_spec = (
None, # 0
(1, TType.I64, 'req_id', None, None, ), # 1
(2, TType.STRING, 'username', 'UTF8', None, ), # 2
(3, TType.STRING, 'password', 'UTF8', None, ), # 3
(4, TType.MAP, 'carrier', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 4
)
class Login_result(object):
"""
Attributes:
- success
- se
"""
def __init__(self, success=None, se=None,):
self.success = success
self.se = se
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 0:
if ftype == TType.STRING:
self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 1:
if ftype == TType.STRUCT:
self.se = ServiceException()
self.se.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('Login_result')
if self.success is not None:
oprot.writeFieldBegin('success', TType.STRING, 0)
oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success)
oprot.writeFieldEnd()
if self.se is not None:
oprot.writeFieldBegin('se', TType.STRUCT, 1)
self.se.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(Login_result)
Login_result.thrift_spec = (
(0, TType.STRING, 'success', 'UTF8', None, ), # 0
(1, TType.STRUCT, 'se', [ServiceException, None], None, ), # 1
)
class UploadUserWithUserId_args(object):
"""
Attributes:
- req_id
- user_id
- carrier
"""
def __init__(self, req_id=None, user_id=None, carrier=None,):
self.req_id = req_id
self.user_id = user_id
self.carrier = carrier
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I64:
self.req_id = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.I64:
self.user_id = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.MAP:
self.carrier = {}
(_ktype115, _vtype116, _size114) = iprot.readMapBegin()
for _i118 in range(_size114):
_key119 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
_val120 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.carrier[_key119] = _val120
iprot.readMapEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('UploadUserWithUserId_args')
if self.req_id is not None:
oprot.writeFieldBegin('req_id', TType.I64, 1)
oprot.writeI64(self.req_id)
oprot.writeFieldEnd()
if self.user_id is not None:
oprot.writeFieldBegin('user_id', TType.I64, 2)
oprot.writeI64(self.user_id)
oprot.writeFieldEnd()
if self.carrier is not None:
oprot.writeFieldBegin('carrier', TType.MAP, 3)
oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.carrier))
for kiter121, viter122 in self.carrier.items():
oprot.writeString(kiter121.encode('utf-8') if sys.version_info[0] == 2 else kiter121)
oprot.writeString(viter122.encode('utf-8') if sys.version_info[0] == 2 else viter122)
oprot.writeMapEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(UploadUserWithUserId_args)
UploadUserWithUserId_args.thrift_spec = (
None, # 0
(1, TType.I64, 'req_id', None, None, ), # 1
(2, TType.I64, 'user_id', None, None, ), # 2
(3, TType.MAP, 'carrier', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 3
)
class UploadUserWithUserId_result(object):
"""
Attributes:
- se
"""
def __init__(self, se=None,):
self.se = se
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.se = ServiceException()
self.se.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('UploadUserWithUserId_result')
if self.se is not None:
oprot.writeFieldBegin('se', TType.STRUCT, 1)
self.se.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(UploadUserWithUserId_result)
UploadUserWithUserId_result.thrift_spec = (
None, # 0
(1, TType.STRUCT, 'se', [ServiceException, None], None, ), # 1
)
class UploadUserWithUsername_args(object):
"""
Attributes:
- req_id
- username
- carrier
"""
def __init__(self, req_id=None, username=None, carrier=None,):
self.req_id = req_id
self.username = username
self.carrier = carrier
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.I64:
self.req_id = iprot.readI64()
else:
iprot.skip(ftype)
elif fid == 2:
if ftype == TType.STRING:
self.username = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
else:
iprot.skip(ftype)
elif fid == 3:
if ftype == TType.MAP:
self.carrier = {}
(_ktype124, _vtype125, _size123) = iprot.readMapBegin()
for _i127 in range(_size123):
_key128 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
_val129 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
self.carrier[_key128] = _val129
iprot.readMapEnd()
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('UploadUserWithUsername_args')
if self.req_id is not None:
oprot.writeFieldBegin('req_id', TType.I64, 1)
oprot.writeI64(self.req_id)
oprot.writeFieldEnd()
if self.username is not None:
oprot.writeFieldBegin('username', TType.STRING, 2)
oprot.writeString(self.username.encode('utf-8') if sys.version_info[0] == 2 else self.username)
oprot.writeFieldEnd()
if self.carrier is not None:
oprot.writeFieldBegin('carrier', TType.MAP, 3)
oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.carrier))
for kiter130, viter131 in self.carrier.items():
oprot.writeString(kiter130.encode('utf-8') if sys.version_info[0] == 2 else kiter130)
oprot.writeString(viter131.encode('utf-8') if sys.version_info[0] == 2 else viter131)
oprot.writeMapEnd()
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(UploadUserWithUsername_args)
UploadUserWithUsername_args.thrift_spec = (
None, # 0
(1, TType.I64, 'req_id', None, None, ), # 1
(2, TType.STRING, 'username', 'UTF8', None, ), # 2
(3, TType.MAP, 'carrier', (TType.STRING, 'UTF8', TType.STRING, 'UTF8', False), None, ), # 3
)
class UploadUserWithUsername_result(object):
"""
Attributes:
- se
"""
def __init__(self, se=None,):
self.se = se
def read(self, iprot):
if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
return
iprot.readStructBegin()
while True:
(fname, ftype, fid) = iprot.readFieldBegin()
if ftype == TType.STOP:
break
if fid == 1:
if ftype == TType.STRUCT:
self.se = ServiceException()
self.se.read(iprot)
else:
iprot.skip(ftype)
else:
iprot.skip(ftype)
iprot.readFieldEnd()
iprot.readStructEnd()
def write(self, oprot):
if oprot._fast_encode is not None and self.thrift_spec is not None:
oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
return
oprot.writeStructBegin('UploadUserWithUsername_result')
if self.se is not None:
oprot.writeFieldBegin('se', TType.STRUCT, 1)
self.se.write(oprot)
oprot.writeFieldEnd()
oprot.writeFieldStop()
oprot.writeStructEnd()
def validate(self):
return
def __repr__(self):
L = ['%s=%r' % (key, value)
for key, value in self.__dict__.items()]
return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
def __ne__(self, other):
return not (self == other)
all_structs.append(UploadUserWithUsername_result)
UploadUserWithUsername_result.thrift_spec = (
None, # 0
(1, TType.STRUCT, 'se', [ServiceException, None], None, ), # 1
)
fix_spec(all_structs)
del all_structs
| 36.474777 | 148 | 0.582106 | 5,287 | 49,168 | 5.206544 | 0.042557 | 0.016348 | 0.024848 | 0.014386 | 0.863516 | 0.846841 | 0.827914 | 0.815127 | 0.813383 | 0.808479 | 0 | 0.016556 | 0.312053 | 49,168 | 1,347 | 149 | 36.501856 | 0.797251 | 0.026664 | 0 | 0.813155 | 1 | 0 | 0.036227 | 0.004731 | 0 | 0 | 0 | 0 | 0 | 1 | 0.093422 | false | 0.041945 | 0.007626 | 0.028599 | 0.178265 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
b6e1f7a036fc08b58374e8a11b3b176db6599243 | 4,727 | py | Python | applications/migrations/0011_update_required_fields.py | City-of-Helsinki/berth-reservations | a3b1a8c2176f132505527acdf6da3a62199401db | [
"MIT"
] | 3 | 2020-10-13T07:58:48.000Z | 2020-12-22T09:41:50.000Z | applications/migrations/0011_update_required_fields.py | City-of-Helsinki/berth-reservations | a3b1a8c2176f132505527acdf6da3a62199401db | [
"MIT"
] | 422 | 2018-10-25T10:57:05.000Z | 2022-03-30T05:47:14.000Z | applications/migrations/0011_update_required_fields.py | City-of-Helsinki/berth-reservations | a3b1a8c2176f132505527acdf6da3a62199401db | [
"MIT"
] | 1 | 2020-04-03T07:38:03.000Z | 2020-04-03T07:38:03.000Z | # Generated by Django 2.2 on 2019-05-16 10:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("applications", "0010_set_defaults_for_required_fields")]
operations = [
migrations.AlterModelOptions(
name="winterstoragereservation",
options={
"permissions": (
("resend_reservation", "Can resend confirmation for applications"),
)
},
),
migrations.AlterField(
model_name="berthreservation",
name="address",
field=models.CharField(max_length=150, verbose_name="address"),
),
migrations.AlterField(
model_name="berthreservation",
name="boat_length",
field=models.DecimalField(
decimal_places=2, max_digits=5, verbose_name="boat length"
),
),
migrations.AlterField(
model_name="berthreservation",
name="boat_width",
field=models.DecimalField(
decimal_places=2, max_digits=5, verbose_name="boat width"
),
),
migrations.AlterField(
model_name="berthreservation",
name="email",
field=models.EmailField(max_length=254, verbose_name="email address"),
),
migrations.AlterField(
model_name="berthreservation",
name="first_name",
field=models.CharField(max_length=40, verbose_name="first name"),
),
migrations.AlterField(
model_name="berthreservation",
name="last_name",
field=models.CharField(max_length=150, verbose_name="last name"),
),
migrations.AlterField(
model_name="berthreservation",
name="municipality",
field=models.CharField(max_length=64, verbose_name="municipality"),
),
migrations.AlterField(
model_name="berthreservation",
name="phone_number",
field=models.CharField(max_length=64, verbose_name="phone number"),
),
migrations.AlterField(
model_name="berthreservation",
name="zip_code",
field=models.CharField(max_length=64, verbose_name="zip code"),
),
migrations.AlterField(
model_name="winterstoragereservation",
name="address",
field=models.CharField(max_length=150, verbose_name="address"),
),
migrations.AlterField(
model_name="winterstoragereservation",
name="boat_length",
field=models.DecimalField(
decimal_places=2, max_digits=5, verbose_name="boat length"
),
),
migrations.AlterField(
model_name="winterstoragereservation",
name="boat_width",
field=models.DecimalField(
decimal_places=2, max_digits=5, verbose_name="boat width"
),
),
migrations.AlterField(
model_name="winterstoragereservation",
name="email",
field=models.EmailField(max_length=254, verbose_name="email address"),
),
migrations.AlterField(
model_name="winterstoragereservation",
name="first_name",
field=models.CharField(max_length=40, verbose_name="first name"),
),
migrations.AlterField(
model_name="winterstoragereservation",
name="last_name",
field=models.CharField(max_length=150, verbose_name="last name"),
),
migrations.AlterField(
model_name="winterstoragereservation",
name="municipality",
field=models.CharField(max_length=64, verbose_name="municipality"),
),
migrations.AlterField(
model_name="winterstoragereservation",
name="phone_number",
field=models.CharField(max_length=64, verbose_name="phone number"),
),
migrations.AlterField(
model_name="winterstoragereservation",
name="storage_method",
field=models.CharField(
choices=[
("on_trestles", "On trestles"),
("on_trailer", "On a trailer"),
("under_tarp", "Under a tarp"),
],
max_length=60,
verbose_name="Storage method",
),
),
migrations.AlterField(
model_name="winterstoragereservation",
name="zip_code",
field=models.CharField(max_length=64, verbose_name="zip code"),
),
]
| 36.083969 | 87 | 0.565475 | 402 | 4,727 | 6.442786 | 0.181592 | 0.146718 | 0.183398 | 0.212741 | 0.835907 | 0.835907 | 0.72973 | 0.65251 | 0.65251 | 0.65251 | 0 | 0.019515 | 0.327904 | 4,727 | 130 | 88 | 36.361538 | 0.795719 | 0.009097 | 0 | 0.830645 | 1 | 0 | 0.207604 | 0.064289 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.008065 | 0 | 0.032258 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
8e010aa31d683ada29593a29b90ed8bc54b28ffe | 136 | py | Python | cords/selectionstrategies/helpers/__init__.py | krishnatejakk/cords | 5896be67a485283193555c3ca05dd81d967fa15d | [
"MIT"
] | null | null | null | cords/selectionstrategies/helpers/__init__.py | krishnatejakk/cords | 5896be67a485283193555c3ca05dd81d967fa15d | [
"MIT"
] | null | null | null | cords/selectionstrategies/helpers/__init__.py | krishnatejakk/cords | 5896be67a485283193555c3ca05dd81d967fa15d | [
"MIT"
] | null | null | null | from .omp_solvers import OrthogonalMP_REG_Parallel
from .omp_solvers import OrthogonalMP_REG
from .optimalWeights import OptimalWeights
| 34 | 50 | 0.889706 | 17 | 136 | 6.823529 | 0.470588 | 0.12069 | 0.241379 | 0.344828 | 0.603448 | 0.603448 | 0 | 0 | 0 | 0 | 0 | 0 | 0.088235 | 136 | 3 | 51 | 45.333333 | 0.935484 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
8e05fc0c553ce4a2ac0528ed434007ff0ae60396 | 21,609 | py | Python | functions/pyperfbenchmark/bm_unpack_sequence/__main__.py | jjkotni/faas-profiler | 3a7565981d7b6f7a03b1d7595e458ef1ff20e8b9 | [
"MIT"
] | null | null | null | functions/pyperfbenchmark/bm_unpack_sequence/__main__.py | jjkotni/faas-profiler | 3a7565981d7b6f7a03b1d7595e458ef1ff20e8b9 | [
"MIT"
] | null | null | null | functions/pyperfbenchmark/bm_unpack_sequence/__main__.py | jjkotni/faas-profiler | 3a7565981d7b6f7a03b1d7595e458ef1ff20e8b9 | [
"MIT"
] | 1 | 2019-11-21T12:23:41.000Z | 2019-11-21T12:23:41.000Z | """Microbenchmark for Python's sequence unpacking."""
import pyperf
import threading
from six.moves import xrange
def do_unpacking(loops, to_unpack):
range_it = xrange(loops)
t0 = pyperf.perf_counter()
for _ in range_it:
# 400 unpackings
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
a, b, c, d, e, f, g, h, i, j = to_unpack
return pyperf.perf_counter() - t0
def bench_tuple_unpacking(loops):
x = tuple(range(10))
return do_unpacking(loops, x)
def bench_list_unpacking(loops):
x = list(range(10))
return do_unpacking(loops, x)
def bench_all(loops):
dt1 = bench_tuple_unpacking(loops)
dt2 = bench_list_unpacking(loops)
return dt1 + dt2
def add_cmdline_args(cmd, args):
if args.benchmark:
cmd.append(args.benchmark)
def functionWorker (runner, tid):
benchmarks = {"tuple": bench_tuple_unpacking,
"list": bench_list_unpacking}
runner.metadata['description'] = ("Microbenchmark for "
"Python's sequence unpacking.")
runner.argparser.add_argument("benchmark", nargs="?",
choices=sorted(benchmarks))
options = runner.parse_args()
name = 'unpack_sequence'
if options.benchmark:
func = benchmarks[options.benchmark]
name += "_%s" % options.benchmark
else:
func = bench_all
name = name + "_" + str (tid)
runner.bench_time_func(name, func, inner_loops=400)
def main(params):
nloops = ('loops' in params) and int(params['loops']) or 1
workers = ('workers' in params) and int(params['workers']) or 1
runner = pyperf.Runner(add_cmdline_args=add_cmdline_args,loops=nloops)
threads = []
for i in range(workers):
threads.append(threading.Thread(target=functionWorker, args=[runner,i]))
for idx, thread in enumerate(threads):
thread.start()
thread.join()
out = 'Executed '+str(workers)+' threads'
result = {'output': out}
return(result)
if __name__ == '__main__':
main({'workers':2})
| 44.73913 | 84 | 0.41057 | 5,039 | 21,609 | 1.672356 | 0.018059 | 0.380681 | 0.142399 | 0.189866 | 0.877892 | 0.873146 | 0.863415 | 0.863415 | 0.863415 | 0.854397 | 0 | 0.00145 | 0.393447 | 21,609 | 482 | 85 | 44.83195 | 0.641489 | 0.002915 | 0 | 0.889381 | 0 | 0 | 0.007335 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.015487 | false | 0 | 0.006637 | 0 | 0.030973 | 0 | 0 | 0 | 1 | null | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 |
8e1927ea1d893e51bfd49d6bbdf6c9015ccb5843 | 50,180 | py | Python | pyslm/slm.py | leonardojacomussi/PySLM | 94283afa022cd113129b4f42f1745e22ad3730f9 | [
"MIT"
] | 1 | 2021-07-23T17:13:40.000Z | 2021-07-23T17:13:40.000Z | pyslm/slm.py | leonardojacomussi/PySLM | 94283afa022cd113129b4f42f1745e22ad3730f9 | [
"MIT"
] | null | null | null | pyslm/slm.py | leonardojacomussi/PySLM | 94283afa022cd113129b4f42f1745e22ad3730f9 | [
"MIT"
] | 2 | 2021-06-14T10:47:44.000Z | 2021-12-29T16:29:30.000Z | from PyQt5 import QtCore, QtGui, QtWidgets
from typing import Callable, Tuple
import threading as thd
import numpy as np
import platform
import datetime
import pyslm
import time
import sys
import os
path_icons = os.path.join(os.path.dirname(os.path.realpath(pyslm.__file__)), 'Icons')
if sys.platform == 'win32' or sys.platform == 'win64':
import ctypes
myappid = u'PySLM.version.0.2'
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
else:
pass
class setSLM(QtWidgets.QMainWindow, pyslm.guiSLM):
def __init__(self, parent=None):
super(setSLM, self).__init__(parent)
self.setupUi(self)
self.btnNewproject.clicked.connect(self.btnNewproject_Action)
self.btnSetup.clicked.connect(self.btnSetup_Action)
self.btnCalibrate.clicked.connect(self.btnCalibrate_Action)
self.btnInfo.clicked.connect(self.btnInfo_Action)
self.btnQuit.clicked.connect(self.btnQuit_Action)
self.btnPlay.clicked.connect(self.btnPlay_Action)
self.btnStop.clicked.connect(self.btnStop_Action)
self.btnDelete.clicked.connect(self.btnDelete_Action)
self.btnSave.clicked.connect(self.btnSave_Action)
self.parameters = pyslm.parameters.load()
self.parameters['version'] = 'AdvFreqAnalyzer'
pyslm.parameters.update(self.parameters)
self.parameters = pyslm.parameters.load()
self.timeStamp = {}
self.set_standby()
self.isOpenWindow = True
self.gettingDataTime = thd.Thread(target=self.datatime)
self.gettingDataTime.start()
self._setStringsGUI()
self.show()
def set_standby(self) -> Callable:
try:
self.btnPlay.setEnabled(True)
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Play.ico")))
self.btnStop.setEnabled(False)
self.btnStop.setIcon(QtGui.QIcon(os.path.join(path_icons, "Stop_noclick.ico")))
self.btnNewproject.setEnabled(True)
self.btnNewproject.setIcon(QtGui.QIcon(os.path.join(path_icons, "NewProject.ico")))
self.btnSetup.setEnabled(True)
self.btnSetup.setIcon(QtGui.QIcon(os.path.join(path_icons, "Setup.ico")))
self.btnCalibrate.setEnabled(True)
self.btnCalibrate.setIcon(QtGui.QIcon(os.path.join(path_icons, "Calibrate.ico")))
self.btnInfo.setEnabled(True)
self.btnInfo.setIcon(QtGui.QIcon(os.path.join(path_icons, "info.ico")))
self.btnSave.setEnabled(False)
self.btnSave.setIcon(QtGui.QIcon(os.path.join(path_icons, "Save_noclick.ico")))
self.btnDelete.setEnabled(False)
self.btnDelete.setIcon(QtGui.QIcon(os.path.join(path_icons, "Delete_noclick.ico")))
self.manager = pyslm.StreamManager(
version = 'AdvFreqAnalyzer',
path = os.path.join(
self.parameters['pathProject'],
self.parameters['currentProject']
),
device = self.parameters['device'],
fs = self.parameters['fs'],
inCh = self.parameters['inCh'],
outCh = self.parameters['outCh'],
tau = self.parameters['tau'],
fstart = self.parameters['fstart'],
fend = self.parameters['fend'],
b = self.parameters['b'],
fweighting = self.parameters['fweighting'],
duration = self.parameters['duration'],
excitTime = self.parameters['excitTime'],
scapeTime = self.parameters['scapeTime'],
decayTime = self.parameters['decayTime'],
template = 'stand-by',
method = self.parameters['method'],
numDecay = self.parameters['numDecay'],
TLevel = self.parameters['TLevel'],
fCalib = self.parameters['fCalib'],
pCalib = self.parameters['pCalib'],
calibFactor = self.parameters['calibFactor'],
micCorr = self.parameters['micCorr'],
applyMicCorr = False,
adcCorr = self.parameters['adcCorr'],
applyAdcCorr = False,
saveRawData = False
)
self.manager.play()
self.manager.realtime_data.connect(self.update_standby)
self.ax = self.measurementViewer.getAxis('bottom')
except Exception as E:
print("setSLM.set_standby(): ", E, "\n")
return
@QtCore.pyqtSlot(dict)
def update_standby(self, results: dict) -> Callable:
try:
Lp_global = results['Lp_global']
Lp_bands = results['Lp_bands']
strBands = results['strBands']
x_axis = results['x_axis']
self.ax.setTicks([strBands])
self.value_Leq.setText(str(Lp_global))
self.plotBar.setOpts(
x = x_axis,
height = Lp_bands,
width = 0.6,
brush = (120, 145, 255)
)
except Exception as E:
print("setSLM.update_standby(): ", E, "\n")
return
def stop_strem(self) -> Callable:
try:
self.manager.stop()
except Exception as E:
print("setSLM.stop_strem(): ", E, "\n")
return
def set_frequencyAnalyzer(self) -> Callable:
try:
self.manager = pyslm.StreamManager(
version = 'AdvFreqAnalyzer',
path = os.path.join(
self.parameters['pathProject'],
self.parameters['currentProject']
),
device = self.parameters['device'],
fs = self.parameters['fs'],
inCh = self.parameters['inCh'],
outCh = self.parameters['outCh'],
tau = self.parameters['tau'],
fstart = self.parameters['fstart'],
fend = self.parameters['fend'],
b = self.parameters['b'],
fweighting = self.parameters['fweighting'],
duration = self.parameters['duration'],
excitTime = self.parameters['excitTime'],
scapeTime = self.parameters['scapeTime'],
decayTime = self.parameters['decayTime'],
template = self.parameters['template'],
method = self.parameters['method'],
numDecay = self.parameters['numDecay'],
TLevel = self.parameters['TLevel'],
fCalib = self.parameters['fCalib'],
pCalib = self.parameters['pCalib'],
calibFactor = self.parameters['calibFactor'],
micCorr = self.parameters['micCorr'],
applyMicCorr = self.parameters['applyMicCorr'],
adcCorr = self.parameters['adcCorr'],
applyAdcCorr = self.parameters['applyAdcCorr'],
saveRawData = self.parameters['saveRawData']
)
self.manager.play()
now = datetime.datetime.now()
self.timeStamp['play'] = now.strftime("%d/%m/%Y - %H:%M:%S")
self.manager.realtime_data.connect(self.update_frequencyAnalyzer)
self.manager.fullresults_data.connect(self.full_frequencyAnalyzer)
self.manager.callstop.connect(self.callOverlay)
self.ax = self.measurementViewer.getAxis('bottom')
except Exception as E:
print("setSLM.set_frequencyAnalyzer(): ", E, "\n")
return
@QtCore.pyqtSlot()
def callOverlay(self) -> Callable:
try:
now = datetime.datetime.now()
self.timeStamp['stop'] = now.strftime("%d/%m/%Y - %H:%M:%S")
self.overlay = pyslm.Overlay(self.centralWidget())
self.overlay.hide()
self.overlay.setMinimumSize(QtCore.QSize(800,430))
# self.overlay.resize(800, 430)
self.overlay.show()
except Exception as E:
print("setSLM.callOverlay(): ", E, "\n")
return
@QtCore.pyqtSlot(dict)
def update_frequencyAnalyzer(self, results: dict) -> Callable:
try:
Lp_global = results['Lp_global']
Lp_bands = results['Lp_bands']
strBands = results['strBands']
x_axis = results['x_axis']
countdown = int(self.manager.duration - self.manager.framesRead/self.manager.fs)
if countdown > 0:
self.lbl_Durationinfo.setText(self.seconds2HMS(countdown))
self.ax.setTicks([strBands])
self.value_Leq.setText(str(Lp_global))
self.plotBar.setOpts(
x = x_axis,
height = Lp_bands,
width = 0.6,
brush = (120, 145, 255)
)
except Exception as E:
print("setSLM.update_frequencyAnalyzer(): ", E, "\n")
return
@QtCore.pyqtSlot(dict)
def full_frequencyAnalyzer(self, results: dict) -> Callable:
try:
self.results = results
if self.parameters['tau'] == 0.035:
tweighting = 'I'
elif self.parameters['tau'] == 0.125:
tweighting = 'F'
else:
tweighting = 'S'
_translate = QtCore.QCoreApplication.translate
self.lbl_Leq.setText(_translate("gui_SLM",
"<html><head/><body><p>L<span style=\" vertical-align:sub;\">"+\
self.parameters['fweighting']+"eq,"+tweighting+"</span></p></body></html>"))
self.overlay.close_overlay = True
self.lbl_Durationinfo.setText('00:00:00')
Leq_global = results['Leq_global']
Leq_bands = results['Leq_bands']
Lmax = results['Lmax']
Lmin = results['Lmin']
LAE = results['SEL']
Lpeak = results['Lpeak']
L10 = results['L10']
L90 = results['L90']
# print('\n\n\nL50: ', results['L50'])
strBands = self.manager.parallelProcess.strBands
x_axis = self.manager.parallelProcess.x_axis
self.ax.setTicks([strBands])
self.plotBar.setOpts(x=x_axis, height=Leq_bands, width=0.6,brush=(120, 145, 255))
# Set values of parameters
self.value_Leq.setText(str(Leq_global))
self.value_Lmax.setText(str(Lmax))
self.value_Lmin.setText(str(Lmin))
self.value_Lpeak.setText(str(Lpeak))
self.value_LAE.setText(str(LAE))
self.value_L10.setText(str(L10))
self.value_L90.setText(str(L90))
# Set buttons
self.btnSave.setEnabled(True)
self.btnSave.setIcon(QtGui.QIcon(os.path.join(path_icons, "Save.ico")))
self.btnDelete.setEnabled(True)
self.btnDelete.setIcon(QtGui.QIcon(os.path.join(path_icons, "Delete.ico")))
self.btnPlay.setEnabled(False)
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Play_noclick.ico")))
self.btnStop.setEnabled(False)
self.btnStop.setIcon(QtGui.QIcon(os.path.join(path_icons, "Stop_noclick.ico")))
self.btnNewproject.setEnabled(False)
self.btnNewproject.setIcon(QtGui.QIcon(os.path.join(path_icons, "NewProject_noclick.ico")))
self.btnSetup.setEnabled(False)
self.btnSetup.setIcon(QtGui.QIcon(os.path.join(path_icons, "Setup_noclick.ico")))
self.btnCalibrate.setEnabled(False)
self.btnCalibrate.setIcon(QtGui.QIcon(os.path.join(path_icons, "Calibrate_noclick.ico")))
self.btnInfo.setEnabled(False)
self.btnInfo.setIcon(QtGui.QIcon(os.path.join(path_icons, "info_noclick.ico")))
except Exception as E:
print("setSLM.full_frequencyAnalyzer(): ", E, "\n")
return
def set_reverberationTime(self) -> Callable:
try:
self.manager = pyslm.StreamManager(
version = 'AdvFreqAnalyzer',
path = os.path.join(
self.parameters['pathProject'],
self.parameters['currentProject']
),
device = self.parameters['device'],
fs = self.parameters['fs'],
inCh = self.parameters['inCh'],
outCh = self.parameters['outCh'],
tau = self.parameters['tau'],
fstart = self.parameters['fstart'],
fend = self.parameters['fend'],
b = self.parameters['b'],
fweighting = self.parameters['fweighting'],
duration = self.parameters['duration'],
excitTime = self.parameters['excitTime'],
scapeTime = self.parameters['scapeTime'],
decayTime = self.parameters['decayTime'],
template = self.parameters['template'],
method = self.parameters['method'],
numDecay = self.parameters['numDecay'],
TLevel = self.parameters['TLevel'],
fCalib = self.parameters['fCalib'],
pCalib = self.parameters['pCalib'],
calibFactor = self.parameters['calibFactor'],
micCorr = self.parameters['micCorr'],
applyMicCorr = self.parameters['applyMicCorr'],
adcCorr = self.parameters['adcCorr'],
applyAdcCorr = self.parameters['applyAdcCorr'],
saveRawData = self.parameters['saveRawData']
)
self.tauConter = self.manager.tau
self.manager.play()
now = datetime.datetime.now()
self.timeStamp['play'] = now.strftime("%d/%m/%Y - %H:%M:%S")
self.manager.realtime_data.connect(self.update_reverberationTime)
self.manager.fullresults_data.connect(self.full_reverberationTime)
self.manager.callstop.connect(self.callOverlay)
self.ax = self.measurementViewer.getAxis('bottom')
except Exception as E:
print("setSLM.set_reverberationTime(): ", E, "\n")
return
@QtCore.pyqtSlot(dict)
def update_reverberationTime(self, results: dict) -> Callable:
try:
Lp_global = results['Lp_global']
Lp_bands = results['Lp_bands']
strBands = results['strBands']
x_axis = results['x_axis']
self.tauConter += self.manager.tau
countdown = int((self.manager.numSamples * self.manager.numDecay)/self.manager.fs - self.tauConter)
if countdown > 0:
self.lbl_Durationinfo.setText(self.seconds2HMS(countdown))
self.ax.setTicks([strBands])
self.value_Leq.setText(str(Lp_global))
self.plotBar.setOpts(
x = x_axis,
height = Lp_bands,
width = 0.6,
brush = (120, 145, 255)
)
except Exception as E:
print("setSLM.update_reverberationTime(): ", E, "\n")
return
@QtCore.pyqtSlot(dict)
def full_reverberationTime(self, results: dict) -> Callable:
try:
self.results = results
_translate = QtCore.QCoreApplication.translate
id500 = np.where(results['freq'] == 500)[0][0]
self.overlay.close_overlay = True
self.lbl_Durationinfo.setText('00:00:00')
EDT = results['EDT']
RT15 = results['RT15']
RT20 = results['RT20']
RT30 = results['RT30']
D50 = results['D50']
D80 = results['D80']
# C50 = results['C50']
C80 = results['C80']
strBands = self.manager.parallelProcess.strBands
x_axis = self.manager.parallelProcess.x_axis
self.ax.setTicks([strBands])
self.measurementViewer.setLabel('left', "T20 s")
self.measurementViewer.setYRange(np.asarray(RT20).min() - 2, np.asarray(RT20).max() + 2)
self.plotBar.setOpts(x=x_axis, height=RT20, width=0.6,brush=(120, 145, 255))
# Set values of parameters
self.lbl_Leq.setText(_translate("gui_SLM",
"<html><head/><body><p>T20<span style=\" vertical-align:sub;\">500Hz</span></p></body></html>"))
self.unity_Leq.setText(_translate("gui_SLM", "s"))
self.value_Leq.setText(str(RT20[id500]))
self.lbl_Lmax.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">EDT</span><span style=\" font-size:14pt; vertical-align:sub;\">500Hz</span></p></body></html>"))
self.unity_Lmax.setText(_translate("gui_SLM", "s"))
self.value_Lmax.setText(str(EDT[id500]))
self.lbl_Lmin.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">T15</span><span style=\" font-size:14pt; vertical-align:sub;\">500Hz</span></p></body></html>"))
self.unity_Lmin.setText(_translate("gui_SLM","s"))
self.value_Lmin.setText(str(RT15[id500]))
self.lbl_Lpeak.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">T30</span><span style=\" font-size:14pt; vertical-align:sub;\">500Hz</span></p></body></html>"))
self.unity_Lpeak.setText(_translate("gui_SLM", "s"))
self.value_Lpeak.setText(str(RT30[id500]))
self.lbl_LAE.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">D50</span><span style=\" font-size:14pt; vertical-align:sub;\">500Hz</span></p></body></html>"))
self.unity_LAE.setText(_translate("gui_SLM", "%"))
self.value_LAE.setText(str(D50[id500]))
self.lbl_L10.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">D80</span><span style=\" font-size:14pt; vertical-align:sub;\">500Hz</span></p></body></html>"))
self.unity_L10.setText(_translate("gui_SLM", "%"))
self.value_L10.setText(str(D80[id500]))
self.lbl_L90.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">C80</span><span style=\" font-size:14pt; vertical-align:sub;\">500Hz</span></p></body></html>"))
self.unity_L90.setText(_translate("gui_SLM", "dB"))
self.value_L90.setText(str(C80[id500]))
# Set buttons
self.btnSave.setEnabled(True)
self.btnSave.setIcon(QtGui.QIcon(os.path.join(path_icons, "Save.ico")))
self.btnDelete.setEnabled(True)
self.btnDelete.setIcon(QtGui.QIcon(os.path.join(path_icons, "Delete.ico")))
self.btnPlay.setEnabled(False)
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Play_noclick.ico")))
self.btnStop.setEnabled(False)
self.btnStop.setIcon(QtGui.QIcon(os.path.join(path_icons, "Stop_noclick.ico")))
self.btnNewproject.setEnabled(False)
self.btnNewproject.setIcon(QtGui.QIcon(os.path.join(path_icons, "NewProject_noclick.ico")))
self.btnSetup.setEnabled(False)
self.btnSetup.setIcon(QtGui.QIcon(os.path.join(path_icons, "Setup_noclick.ico")))
self.btnCalibrate.setEnabled(False)
self.btnCalibrate.setIcon(QtGui.QIcon(os.path.join(path_icons, "Calibrate_noclick.ico")))
self.btnInfo.setEnabled(False)
self.btnInfo.setIcon(QtGui.QIcon(os.path.join(path_icons, "info_noclick.ico")))
except Exception as E:
print("setSLM.full_reverberationTime(): ", E, "\n")
return
def datatime(self) -> Callable:
try:
while self.isOpenWindow:
self.now = datetime.datetime.now()
self.lblDateinfo.setText(self.now.strftime("%d/%m/%Y - %H:%M:%S"))
time.sleep(1)
else:
pass
except Exception as E:
print("setSLM.datatime(): ", E, "\n")
return
def btnPlay_Action(self):
try:
if self.manager.template != 'stand-by':
self.manager.pause()
if self.manager.isPaused.is_set():
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Pause_click.ico")))
else:
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Play_click.ico")))
else:
self.stop_strem()
if self.parameters['template'] == 'frequencyAnalyzer':
self.set_frequencyAnalyzer()
elif self.parameters['template'] == 'reverberationTime':
self.set_reverberationTime()
else:
self.set_standby()
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Play_click.ico")))
self.btnStop.setEnabled(True)
self.btnStop.setIcon(QtGui.QIcon(os.path.join(path_icons, "Stop.ico")))
self.btnNewproject.setEnabled(False)
self.btnNewproject.setIcon(QtGui.QIcon(os.path.join(path_icons, "NewProject_noclick.ico")))
self.btnSetup.setEnabled(False)
self.btnSetup.setIcon(QtGui.QIcon(os.path.join(path_icons, "Setup_noclick.ico")))
self.btnCalibrate.setEnabled(False)
self.btnCalibrate.setIcon(QtGui.QIcon(os.path.join(path_icons, "Calibrate_noclick.ico")))
self.btnInfo.setEnabled(False)
self.btnInfo.setIcon(QtGui.QIcon(os.path.join(path_icons, "info_noclick.ico")))
self.btnSave.setEnabled(False)
self.btnSave.setIcon(QtGui.QIcon(os.path.join(path_icons, "Save_noclick.ico")))
self.btnDelete.setEnabled(False)
self.btnDelete.setIcon(QtGui.QIcon(os.path.join(path_icons, "Delete_noclick.ico")))
except Exception as E:
print("setSLM.btnPlay_Action(): ", E, "\n")
return
def btnStop_Action(self) -> Callable:
try:
self.stop_strem()
self.btnStop.setIcon(QtGui.QIcon(os.path.join(path_icons, "Stop_click.ico")))
self.btnPlay.setEnabled(False)
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Play_noclick.ico")))
self.btnSave.setEnabled(True)
self.btnSave.setIcon(QtGui.QIcon(os.path.join(path_icons, "Save.ico")))
self.btnDelete.setEnabled(True)
self.btnDelete.setIcon(QtGui.QIcon(os.path.join(path_icons, "Delete.ico")))
except Exception as E:
print("setSLM.btnStop_Action(): ", E, "\n")
return
def btnSave_Action(self) -> Callable:
try:
self.btnSave.setIcon(QtGui.QIcon(os.path.join(path_icons, "Save_click.ico")))
pyslm.save(
params = self.parameters,
results = self.results,
timestamp = self.timeStamp,
file_name = self.file_name
)
if self.parameters['saveRawData']:
os.remove(self.file_name)
self._setStringsGUI()
self.set_standby()
except Exception as E:
print("setSLM.btnSave_Action(): ", E, "\n")
return
def btnDelete_Action(self) -> Callable:
try:
self.btnDelete.setIcon(QtGui.QIcon(os.path.join(path_icons, "Delete_click.ico")))
if self.parameters['saveRawData']:
os.remove(self.manager.recorderRawData.fname)
else:
if self.manager.template == 'reverberationTime':
print('Implement save function in Excel.')
else:
print('Implement save function in Excel.')
self._setStringsGUI()
self.set_standby()
except Exception as E:
print("setSLM.btnDelete_Action(): ", E, "\n")
return
def btnNewproject_Action(self) -> Callable:
try:
self.btnNewproject.setIcon(QtGui.QIcon(os.path.join(path_icons, "NewProject_click.ico")))
self.stop_strem()
dlgNewProject = pyslm.setSetup()
dlgNewProject.tabSettings.setCurrentWidget(dlgNewProject.tabSettings.findChild(QtWidgets.QWidget, 'Projects'))
dlgNewProject.exec_()
if not dlgNewProject.isActiveWindow():
self.parameters = pyslm.parameters.load()
self._setStringsGUI()
self.set_standby()
except Exception as E:
print("setSLM.btnNewproject_Action(): ", E, "\n")
return
def btnSetup_Action(self) -> Callable:
try:
self.btnSetup.setIcon(QtGui.QIcon(os.path.join(path_icons, "Setup_click.ico")))
self.stop_strem()
dlgSetup = pyslm.setSetup()
dlgSetup.tabSettings.setCurrentWidget(dlgSetup.tabSettings.findChild(QtWidgets.QWidget, 'Measurement'))
dlgSetup.exec_()
if not dlgSetup.isActiveWindow():
self.parameters = pyslm.parameters.load()
self._setStringsGUI()
self.set_standby()
except Exception as E:
print("setSLM.btnSetup_Action(): ", E, "\n")
return
def btnCalibrate_Action(self) -> Callable:
try:
self.btnCalibrate.setIcon(QtGui.QIcon(os.path.join(path_icons, "Calibrate_click.ico")))
self.stop_strem()
dlgCalib = pyslm.setSetup()
dlgCalib.tabSettings.setCurrentWidget(dlgCalib.tabSettings.findChild(QtWidgets.QWidget, 'Calibration'))
dlgCalib.exec_()
dlgCalib.setMinimumSize(QtCore.QSize(800,430))
dlgCalib.setMaximumWidth(800)
dlgCalib.setMinimumHeight(430)
if not dlgCalib.isActiveWindow():
self.parameters = pyslm.parameters.load()
self._setStringsGUI()
self.set_standby()
except Exception as E:
print("setSLM.btnCalibrate_Action(): ", E, "\n")
return
def btnInfo_Action(self) -> Callable:
try:
self.btnInfo.setIcon(QtGui.QIcon(os.path.join(path_icons, "info_click.ico")))
self.stop_strem()
dlgAbout = pyslm.setSetup()
dlgAbout.tabSettings.setCurrentWidget(dlgAbout.tabSettings.findChild(QtWidgets.QWidget, 'About'))
dlgAbout.exec_()
if not dlgAbout.isActiveWindow():
self.parameters = pyslm.parameters.load()
self._setStringsGUI()
self.set_standby()
except Exception as E:
print("setSLM.btnInfo_Action(): ", E, "\n")
return
def btnQuit_Action(self) -> Callable:
try:
self.stop_strem()
self.isOpenWindow = False
self.gettingDataTime.join()
self.gettingDataTime._stop()
self.gettingDataTime._delete()
self.close()
except Exception as E:
print("setSLM.btnQuit_Action(): ", E, "\n")
return
def _counterFile(self) -> Tuple[str, str]:
try:
today = datetime.datetime.now()
today = today.strftime("%d-%m-%Y")
path = os.path.join(self.parameters['pathProject'], self.parameters['currentProject'])
if platform.system().lower() == 'windows':
bar = '\\'
else:
bar = '/'
if self.parameters['template'] == 'frequencyAnalyzer':
name_date = '{} SPL measurement '.format(today)
else:
name_date = '{} RT measurement '.format(today)
if not os.path.isdir(path):
os.mkdir(path)
fname = path + bar + name_date + '001.xlsx'
count = 2
if os.path.isfile(fname):
new_name = fname
while os.path.isfile(new_name):
new_name = new_name.replace('.xlsx', '')
new_name = new_name[:-3] + '%03i.xlsx' % count
count += 1
else:
new_name = fname
new_name = new_name.replace('.xlsx', '')
name = new_name[:-3]
count = int(new_name[-3:])
except Exception as E:
print("setSLM._counterFile(): ", E, "\n")
return str(count), "%s(raw data) %03i.h5"%(name, count)
def seconds2HMS(self, seconds: int) -> str:
try:
M, S = divmod(seconds, 60)
H, M = divmod(M, 60)
except Exception as E:
print("setSLM.seconds2HMS(): ", E, "\n")
return "%02d:%02d:%02d" % (H, M, S)
def _setStringsGUI(self) -> Callable:
try:
fweighting = self.parameters['fweighting']
if self.parameters['tau'] == 0.035:
tweighting = 'I'
elif self.parameters['tau'] == 0.125:
tweighting = 'F'
else:
tweighting = 'S'
if self.parameters['template'] == 'frequencyAnalyzer':
template = 'Adv. Frequency Analyzer'
duration = self.parameters['duration']
else:
template = 'Reverberation time'
duration = (self.parameters['excitTime'] +\
self.parameters['scapeTime'] +\
self.parameters['decayTime']) *\
self.parameters['numDecay']
duration = self.seconds2HMS(duration)
projectName = self.parameters['currentProject']
counter, self.file_name = self._counterFile()
self.measurementViewer.setLabel('left', "SPL dB")
self.measurementViewer.setYRange(-10,115)
_translate = QtCore.QCoreApplication.translate
self.lbl_Durationinfo.setText(_translate("gui_SLM", duration))
self.lbl_Projectinfo.setText(_translate("gui_SLM",
"<html><head/><body><p align=\"center\">"+projectName+" - Measurement " + counter + "</p></body></html>"))
self.lblDateinfo.setText(_translate("gui_SLM", "DD/MM/AA - Hr:Min:Sec"))
self.lblTemplateInfo.setText(_translate("gui_SLM",
"<html><head/><body><p align=\"center\">"+template+"</p></body></html>"))
self.lbl_L90.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">L</span><span style=\" font-size:14pt; vertical-align:sub;\">90</span></p></body></html>"))
self.lbl_Lmin.setText(_translate("gui_SLM", "<html><head/><body><p><span style=\" font-size:14pt;\">L</span><span style=\" font-size:14pt; vertical-align:sub;\">"+fweighting+"min,"+tweighting+"</span></p></body></html>"))
self.unity_L10.setText(_translate("gui_SLM", " dB"))
self.value_Lmax.setText(_translate("gui_SLM", "--.--"))
self.unity_L90.setText(_translate("gui_SLM", " dB"))
self.value_LAE.setText(_translate("gui_SLM", "--.--"))
self.value_Leq.setText(_translate("gui_SLM", "--.--"))
self.unity_Lpeak.setText(_translate("gui_SLM", " dB"))
self.lbl_Lpeak.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">L</span><span style=\" font-size:14pt; vertical-align:sub;\">Cpeak</span></p></body></html>"))
self.lbl_Leq.setText(_translate("gui_SLM",
"<html><head/><body><p>L<span style=\" vertical-align:sub;\">"+fweighting+","+tweighting+"</span></p></body></html>"))
self.value_L90.setText(_translate("gui_SLM", "--.--"))
self.value_Lpeak.setText(_translate("gui_SLM", "--.--"))
self.unity_LAE.setText(_translate("gui_SLM", " dB"))
self.unity_Leq.setText(_translate("gui_SLM", "dB"))
self.lbl_Lmax.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">L</span><span style=\" font-size:14pt; vertical-align:sub;\">"+fweighting+"max,"+tweighting+"</span></p></body></html>"))
self.lbl_L10.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">L</span><span style=\" font-size:14pt; vertical-align:sub;\">10</span></p></body></html>"))
self.value_Lmin.setText(_translate("gui_SLM", "--.--"))
self.lbl_LAE.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">L</span><span style=\" font-size:14pt; vertical-align:sub;\">AE</span></p></body></html>"))
self.value_L10.setText(_translate("gui_SLM", "--.--"))
self.unity_Lmin.setText(_translate("gui_SLM", " dB"))
self.unity_Lmax.setText(_translate("gui_SLM", " dB"))
except Exception as E:
print("setSLM._setStringsGUI(): ", E, "\n")
return
class setSLM2(QtWidgets.QMainWindow, pyslm.guiSLM2):
def __init__(self, parent=None):
super(setSLM2, self).__init__(parent)
self.setupUi(self)
self.timeStamp = {}
self.btnSetup.clicked.connect(self.btnSetup_Action)
self.btnQuit.clicked.connect(self.btnQuit_Action)
self.btnPlay.clicked.connect(self.btnPlay_Action)
self.btnStop.clicked.connect(self.btnStop_Action)
self.btnDelete.clicked.connect(self.btnDelete_Action)
self.btnSave.clicked.connect(self.btnSave_Action)
self.parameters = pyslm.parameters.load()
self.parameters['version'] = 'DataLogger'
self.parameters['template'] = 'spl'
pyslm.parameters.update(self.parameters)
self.parameters = pyslm.parameters.load()
self.set_standby()
self.isOpenWindow = True
self._setStringsGUI()
self.show()
def set_standby(self) -> Callable:
try:
self.btnPlay.setEnabled(True)
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Play.ico")))
self.btnStop.setEnabled(False)
self.btnStop.setIcon(QtGui.QIcon(os.path.join(path_icons, "Stop_noclick.ico")))
self.btnSetup.setEnabled(True)
self.btnSetup.setIcon(QtGui.QIcon(os.path.join(path_icons, "Setup.ico")))
self.btnSave.setEnabled(False)
self.btnSave.setIcon(QtGui.QIcon(os.path.join(path_icons, "Save_noclick.ico")))
self.btnDelete.setEnabled(False)
self.btnDelete.setIcon(QtGui.QIcon(os.path.join(path_icons, "Delete_noclick.ico")))
self.manager = pyslm.StreamManager(
version = 'DataLogger',
path = os.path.join(self.parameters['pathProject'], self.parameters['currentProject']),
device = self.parameters['device'],
fs = self.parameters['fs'],
inCh = self.parameters['inCh'],
tau = self.parameters['tau'],
fweighting = self.parameters['fweighting'],
duration = self.parameters['duration'],
template = 'stand-by',
fCalib = self.parameters['fCalib'],
pCalib = self.parameters['pCalib'],
calibFactor = self.parameters['calibFactor'],
micCorr = self.parameters['micCorr'],
applyMicCorr = False,
adcCorr = self.parameters['adcCorr'],
applyAdcCorr = False,
saveRawData = False
)
self.manager.play()
self.manager.realtime_data.connect(self.update_standby)
except Exception as E:
print("setSLM2.set_standby(): ", E, "\n")
return
@QtCore.pyqtSlot(dict)
def update_standby(self, results: dict) -> Callable:
try:
Lp_global = results['Lp_global']
self.value_Leq.setText(str(Lp_global))
except Exception as E:
print("setSLM2.update_standby(): ", E, "\n")
return
def stop_strem(self) -> Callable:
try:
self.manager.stop()
except Exception as E:
print("setSLM2.stop_strem(): ", E, "\n")
return
def set_spl(self) -> Callable:
try:
self.manager = pyslm.StreamManager(
version = 'DataLogger',
path = os.path.join(
self.parameters['pathProject'],
self.parameters['currentProject']
),
device = self.parameters['device'],
fs = self.parameters['fs'],
inCh = self.parameters['inCh'],
tau = self.parameters['tau'],
fweighting = self.parameters['fweighting'],
duration = self.parameters['duration'],
template = self.parameters['template'],
fCalib = self.parameters['fCalib'],
pCalib = self.parameters['pCalib'],
calibFactor = self.parameters['calibFactor'],
micCorr = self.parameters['micCorr'],
applyMicCorr = self.parameters['applyMicCorr'],
adcCorr = self.parameters['adcCorr'],
applyAdcCorr = self.parameters['applyAdcCorr'],
saveRawData = self.parameters['saveRawData']
)
self.manager.play()
now = datetime.datetime.now()
self.timeStamp['play'] = now.strftime("%d/%m/%Y - %H:%M:%S")
self.manager.realtime_data.connect(self.update_spl)
self.manager.fullresults_data.connect(self.full_spl)
self.manager.callstop.connect(self.callOverlay)
except Exception as E:
print("setSLM2.set_spl(): ", E, "\n")
return
@QtCore.pyqtSlot()
def callOverlay(self) -> Callable:
try:
now = datetime.datetime.now()
self.timeStamp['stop'] = now.strftime("%d/%m/%Y - %H:%M:%S")
self.overlay = pyslm.Overlay(self.centralWidget())
self.overlay.hide()
self.overlay.setMinimumSize(QtCore.QSize(480,410))
# self.overlay.resize(800, 430)
self.overlay.show()
except Exception as E:
print("setSLM2.callOverlay(): ", E, "\n")
return
@QtCore.pyqtSlot(dict)
def update_spl(self, results: dict) -> Callable:
try:
Lp_global = results['Lp_global']
countdown = int(self.manager.duration - self.manager.framesRead/self.manager.fs)
if countdown > 0:
self.lbl_Durationinfo.setText(self.seconds2HMS(countdown))
self.value_Leq.setText(str(Lp_global))
except Exception as E:
print("setSLM2.update_spl(): ", E, "\n")
return
@QtCore.pyqtSlot(dict)
def full_spl(self, results: dict) -> Callable:
try:
self.results = results
if self.parameters['tau'] == 0.035:
tweighting = 'I'
elif self.parameters['tau'] == 0.125:
tweighting = 'F'
else:
tweighting = 'S'
_translate = QtCore.QCoreApplication.translate
self.lbl_Leq.setText(_translate("gui_SLM",
"<html><head/><body><p>L<span style=\" vertical-align:sub;\">"+\
self.parameters['fweighting']+"eq,"+tweighting+"</span></p></body></html>"))
self.overlay.close_overlay = True
self.lbl_Durationinfo.setText('00:00:00')
Leq_global = results['Leq_global']
Lmax = results['Lmax']
Lmin = results['Lmin']
LAE = results['SEL']
Lpeak = results['Lpeak']
L10 = results['L10']
L90 = results['L90']
# print('\n\n\nL50: ', results['L50'])
# Set values of parameters
self.value_Leq.setText(str(Leq_global))
self.value_Lmax.setText(str(Lmax))
self.value_Lmin.setText(str(Lmin))
self.value_Lpeak.setText(str(Lpeak))
self.value_LAE.setText(str(LAE))
self.value_L10.setText(str(L10))
self.value_L90.setText(str(L90))
# Set buttons
self.btnSave.setEnabled(True)
self.btnSave.setIcon(QtGui.QIcon(os.path.join(path_icons, "Save.ico")))
self.btnDelete.setEnabled(True)
self.btnDelete.setIcon(QtGui.QIcon(os.path.join(path_icons, "Delete.ico")))
self.btnPlay.setEnabled(False)
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Play_noclick.ico")))
self.btnStop.setEnabled(False)
self.btnStop.setIcon(QtGui.QIcon(os.path.join(path_icons, "Stop_noclick.ico")))
self.btnSetup.setEnabled(False)
self.btnSetup.setIcon(QtGui.QIcon(os.path.join(path_icons, "Setup_noclick.ico")))
except Exception as E:
print("setSLM2.full_spl(): ", E, "\n")
return
def btnPlay_Action(self) -> Callable:
try:
if self.manager.template != 'stand-by':
self.manager.pause()
if self.manager.isPaused.is_set():
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Pause_click.ico")))
else:
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Play_click.ico")))
else:
self.stop_strem()
if self.parameters['template'] == 'spl':
self.set_spl()
else:
self.set_standby()
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Play_click.ico")))
self.btnStop.setEnabled(True)
self.btnStop.setIcon(QtGui.QIcon(os.path.join(path_icons, "Stop.ico")))
self.btnSetup.setEnabled(False)
self.btnSetup.setIcon(QtGui.QIcon(os.path.join(path_icons, "Setup_noclick.ico")))
self.btnSave.setEnabled(False)
self.btnSave.setIcon(QtGui.QIcon(os.path.join(path_icons, "Save_noclick.ico")))
self.btnDelete.setEnabled(False)
self.btnDelete.setIcon(QtGui.QIcon(os.path.join(path_icons, "Delete_noclick.ico")))
except Exception as E:
print("setSLM2.btnPlay_Action(): ", E, "\n")
return
def btnStop_Action(self) -> Callable:
try:
self.stop_strem()
self.btnStop.setIcon(QtGui.QIcon(os.path.join(path_icons, "Stop_click.ico")))
self.btnPlay.setEnabled(False)
self.btnPlay.setIcon(QtGui.QIcon(os.path.join(path_icons, "Play_noclick.ico")))
self.btnSave.setEnabled(True)
self.btnSave.setIcon(QtGui.QIcon(os.path.join(path_icons, "Save.ico")))
self.btnDelete.setEnabled(True)
self.btnDelete.setIcon(QtGui.QIcon(os.path.join(path_icons, "Delete.ico")))
except Exception as E:
print("setSLM2.btnStop_Action(): ", E, "\n")
return
def btnSave_Action(self) -> Callable:
try:
self.btnSave.setIcon(QtGui.QIcon(os.path.join(path_icons, "Save_click.ico")))
pyslm.save(params=self.parameters, results=self.results, timestamp=self.timeStamp, file_name=self.file_name)
if self.parameters['saveRawData']:
os.remove(self.file_name)
self._setStringsGUI()
self.set_standby()
except Exception as E:
print("setSLM2.btnSave_Action(): ", E, "\n")
return
def btnDelete_Action(self) -> Callable:
try:
self.btnDelete.setIcon(QtGui.QIcon(os.path.join(path_icons, "Delete_click.ico")))
if self.parameters['saveRawData']:
os.remove(self.manager.recorderRawData.fname)
self._setStringsGUI()
self.set_standby()
except Exception as E:
print("setSLM2.btnDelete_Action(): ", E, "\n")
return
def btnSetup_Action(self) -> Callable:
try:
self.btnSetup.setIcon(QtGui.QIcon(os.path.join(path_icons, "Setup_click.ico")))
self.stop_strem()
dlgSetup = pyslm.setSetup2()
dlgSetup.tabSettings.setCurrentWidget(dlgSetup.tabSettings.findChild(QtWidgets.QWidget, 'Measurement'))
dlgSetup.exec_()
if not dlgSetup.isActiveWindow():
self.parameters = pyslm.parameters.load()
self._setStringsGUI()
self.set_standby()
except Exception as E:
print("setSLM2.btnSetup_Action(): ", E, "\n")
return
def btnQuit_Action(self) -> Callable:
try:
self.stop_strem()
self.isOpenWindow = False
self.close()
except Exception as E:
print("setSLM2.btnQuit_Action(): ", E, "\n")
return
def _counterFile(self) -> Tuple[str, str]:
try:
today = datetime.datetime.now()
today = today.strftime("%d-%m-%Y")
path = os.path.join(self.parameters['pathProject'], self.parameters['currentProject'])
if platform.system().lower() == 'windows':
bar = '\\'
else:
bar = '/'
name_date = '{} SPL measurement '.format(today)
if not os.path.isdir(path):
os.mkdir(path)
fname = path + bar + name_date + '001.xlsx'
count = 2
if os.path.isfile(fname):
new_name = fname
while os.path.isfile(new_name):
new_name = new_name.replace('.xlsx', '')
new_name = new_name[:-3] + '%03i.xlsx' % count
count += 1
else:
new_name = fname
new_name = new_name.replace('.xlsx', '')
name = new_name[:-3]
count = int(new_name[-3:])
except Exception as E:
print("setSLM2._counterFile(): ", E, "\n")
return str(count), "%s(raw data) %03i.h5"%(name, count)
def seconds2HMS(self, seconds: int) -> str:
try:
M, S = divmod(seconds, 60)
H, M = divmod(M, 60)
except Exception as E:
print("setSLM2.seconds2HMS(): ", E, "\n")
return "%02d:%02d:%02d" % (H, M, S)
def _setStringsGUI(self) -> Callable:
try:
fweighting = self.parameters['fweighting']
if self.parameters['tau'] == 0.035:
tweighting = 'I'
elif self.parameters['tau'] == 0.125:
tweighting = 'F'
else:
tweighting = 'S'
duration = self.seconds2HMS(self.parameters['duration'])
projectName = self.parameters['currentProject']
counter, self.file_name = self._counterFile()
_translate = QtCore.QCoreApplication.translate
self.lbl_Durationinfo.setText(_translate("gui_SLM", duration))
self.lbl_Projectinfo.setText(_translate("gui_SLM",
"<html><head/><body><p align=\"center\">"+projectName+" - Measurement " + counter + "</p></body></html>"))
self.lbl_L90.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">L</span><span style=\" font-size:14pt; vertical-align:sub;\">90</span></p></body></html>"))
self.lbl_Lmin.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">L</span><span style=\" font-size:14pt; vertical-align:sub;\">"+fweighting+"min,"+tweighting+"</span></p></body></html>"))
self.unity_L10.setText(_translate("gui_SLM"," dB"))
self.value_Lmax.setText(_translate("gui_SLM", "--.--"))
self.unity_L90.setText(_translate("gui_SLM", " dB"))
self.value_LAE.setText(_translate("gui_SLM", "--.--"))
self.value_Leq.setText(_translate("gui_SLM", "--.--"))
self.unity_Lpeak.setText(_translate("gui_SLM", " dB"))
self.lbl_Lpeak.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">L</span><span style=\" font-size:14pt; vertical-align:sub;\">Cpeak</span></p></body></html>"))
self.lbl_Leq.setText(_translate("gui_SLM",
"<html><head/><body><p>L<span style=\" vertical-align:sub;\">"+fweighting+","+tweighting+"</span></p></body></html>"))
self.value_L90.setText(_translate("gui_SLM", "--.--"))
self.value_Lpeak.setText(_translate("gui_SLM", "--.--"))
self.unity_LAE.setText(_translate("gui_SLM", " dB"))
self.unity_Leq.setText(_translate("gui_SLM", "dB"))
self.lbl_Lmax.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">L</span><span style=\" font-size:14pt; vertical-align:sub;\">"+fweighting+"max,"+tweighting+"</span></p></body></html>"))
self.lbl_L10.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">L</span><span style=\" font-size:14pt; vertical-align:sub;\">10</span></p></body></html>"))
self.value_Lmin.setText(_translate("gui_SLM", "--.--"))
self.lbl_LAE.setText(_translate("gui_SLM",
"<html><head/><body><p><span style=\" font-size:14pt;\">L</span><span style=\" font-size:14pt; vertical-align:sub;\">AE</span></p></body></html>"))
self.value_L10.setText(_translate("gui_SLM", "--.--"))
self.unity_Lmin.setText(_translate("gui_SLM", " dB"))
self.unity_Lmax.setText(_translate("gui_SLM", " dB"))
except Exception as E:
print("setSLM2._setStringsGUI(): ", E, "\n")
return
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
start = pyslm.setSLM()
app.exec_() | 46.67907 | 233 | 0.565405 | 5,279 | 50,180 | 5.259329 | 0.065164 | 0.078663 | 0.027374 | 0.046535 | 0.896953 | 0.880061 | 0.862016 | 0.835759 | 0.822144 | 0.81883 | 0 | 0.014111 | 0.291072 | 50,180 | 1,075 | 234 | 46.67907 | 0.766346 | 0.005281 | 0 | 0.795107 | 0 | 0 | 0.137544 | 0.047251 | 0 | 0 | 0 | 0 | 0 | 1 | 0.041794 | false | 0.002039 | 0.011213 | 0 | 0.094801 | 0.041794 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
8e1bd2f6b27e2d1f280b3189f60c98653324310d | 291 | py | Python | lib/bisect.py | jplevyak/pyc | 9f4bc49be78ba29427841460945ce63826fcd857 | [
"BSD-3-Clause"
] | 3 | 2019-08-21T22:01:35.000Z | 2021-07-25T00:21:28.000Z | lib/bisect.py | jplevyak/pyc | 9f4bc49be78ba29427841460945ce63826fcd857 | [
"BSD-3-Clause"
] | null | null | null | lib/bisect.py | jplevyak/pyc | 9f4bc49be78ba29427841460945ce63826fcd857 | [
"BSD-3-Clause"
] | null | null | null | def insort_right(a, x, lo=0, hi=0):
a.append(x)
def insort_left(a, x, lo=0, hi=0):
a.append(x)
def insort(a, x, lo=0, hi=0):
a.append(x)
def bisect_right(a, x, lo=0, hi=0):
return 1
def bisect_left(a, x, lo=0, hi=0):
return 1
def bisect(a, x, lo=0, hi=0):
return 1
| 19.4 | 35 | 0.580756 | 67 | 291 | 2.462687 | 0.19403 | 0.072727 | 0.145455 | 0.181818 | 0.909091 | 0.909091 | 0.909091 | 0.8 | 0.709091 | 0.709091 | 0 | 0.066372 | 0.223368 | 291 | 14 | 36 | 20.785714 | 0.663717 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.25 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 9 |
8e30e751fd9e783dffae7030f816a44e1c4b5349 | 5,650 | py | Python | pyalgs/data_structures/commons/priority_queue.py | vertexproject/pyalgs | 11b9ea37afc9e9f9e38ffacc42b53f9cd96f5f83 | [
"BSD-3-Clause"
] | 12 | 2017-05-01T10:31:42.000Z | 2021-06-23T14:03:28.000Z | pyalgs/data_structures/commons/priority_queue.py | vertexproject/pyalgs | 11b9ea37afc9e9f9e38ffacc42b53f9cd96f5f83 | [
"BSD-3-Clause"
] | 2 | 2018-08-01T10:09:09.000Z | 2020-07-16T11:41:46.000Z | pyalgs/data_structures/commons/priority_queue.py | vertexproject/pyalgs | 11b9ea37afc9e9f9e38ffacc42b53f9cd96f5f83 | [
"BSD-3-Clause"
] | 6 | 2017-06-04T01:41:14.000Z | 2021-01-19T05:05:44.000Z | from pyalgs.algorithms.commons.util import less, exchange, greater
class MinPQ(object):
pq = None
N = 0
def __init__(self, capacity=None):
if capacity is None:
capacity = 10
self.pq = [0] * capacity
def enqueue(self, key):
self.N += 1
if self.N == len(self.pq):
self.resize(len(self.pq) * 2)
self.pq[self.N] = key
self.swim(self.N)
def swim(self, k):
while k > 1:
parent = k // 2
if less(self.pq[k], self.pq[parent]):
exchange(self.pq, k, parent)
k = parent
else:
break
def del_min(self):
if self.is_empty():
return None
key = self.pq[1]
exchange(self.pq, 1, self.N)
self.N -= 1
if self.N == len(self.pq) // 4:
self.resize(len(self.pq) // 2)
self.sink(self.pq, 1, self.N)
return key
@staticmethod
def sink(tmp, k, n):
while k * 2 <= n:
child = k * 2
if child < n and less(tmp[child + 1], tmp[child]):
child = child + 1
if less(tmp[child], tmp[k]):
exchange(tmp, child, k)
k = child
else:
break
def resize(self, new_size):
tmp = [0] * new_size
for k in range(min(new_size, len(self.pq))):
tmp[k] = self.pq[k]
self.pq = tmp
def is_empty(self):
return self.N == 0
def size(self):
return self.N
def iterate(self):
tmp = [0] * (self.N + 1)
for k in range(self.N + 1):
tmp[k] = self.pq[k]
n = self.N
while n >= 1:
key = tmp[1]
exchange(tmp, 1, n)
n -= 1
self.sink(tmp, 1, n)
yield key
@staticmethod
def create():
return MinPQ()
class MaxPQ(object):
pq = None
N = 0
def __init__(self, capacity=None):
if capacity is None:
capacity = 10
self.pq = [0] * capacity
def enqueue(self, key):
if self.N == len(self.pq):
self.resize(len(self.pq) * 2)
self.N += 1
self.pq[self.N] = key
self.swim(self.N)
def swim(self, k):
while k > 1:
parent = k // 2
if greater(self.pq[k], self.pq[parent]):
exchange(self.pq, k, parent)
k = parent
else:
break
def del_max(self):
if self.is_empty():
return None
key = self.pq[1]
exchange(self.pq, 1, self.N)
self.N -= 1
if self.N == len(self.pq) // 4:
self.resize(len(self.pq) // 2)
self.sink(self.pq, 1, self.N)
return key
@staticmethod
def sink(tmp, k, n):
while k * 2 <= n:
child = k * 2
if child < n and greater(tmp[child + 1], tmp[child]):
child = child + 1
if greater(tmp[child], tmp[k]):
exchange(tmp, child, k)
k = child
else:
break
def resize(self, new_size):
tmp = [0] * new_size
for k in range(min(new_size, len(self.pq))):
tmp[k] = self.pq[k]
self.pq = tmp
def is_empty(self):
return self.N == 0
def size(self):
return self.N
def iterate(self):
tmp = [0] * (self.N + 1)
for k in range(self.N + 1):
tmp[k] = self.pq[k]
n = self.N
while n >= 1:
key = tmp[1]
exchange(tmp, 1, n)
n -= 1
self.sink(tmp, 1, n)
yield key
@staticmethod
def create():
return MaxPQ()
class IndexMinPQ(object):
keys = None
pq = None
qp = None
N = 0
def __init__(self, size):
self.keys = [None] * (size+1)
self.pq = [0] * (size+1)
self.qp = [0] * (size+1)
def insert(self, index, key):
self.keys[index] = key
self.N += 1
self.pq[self.N] = index
self.qp[index] = self.N
self.swim(self.N)
def decrease_key(self, index, key):
self.keys[index] = key
k = self.qp[index]
self.swim(k)
def contains_index(self, index):
return self.keys[index] is not None
def swim(self, k):
while k > 1:
parent = k // 2
if less(self.keys[self.pq[k]], self.keys[self.pq[parent]]):
exchange(self.pq, k, parent)
self.qp[self.pq[k]] = k
self.qp[self.pq[parent]] = parent
k = parent
else:
break
def get(self, index):
return self.keys[index]
def min_key(self):
return self.keys[self.pq[1]]
def del_min(self):
index = self.pq[1]
exchange(self.pq, 1, self.N)
self.qp[self.pq[1]] = 1
self.qp[self.pq[self.N]] = self.N
self.N -= 1
self.sink(1)
return index
def sink(self, k):
while 2 * k <= self.N:
child = 2 * k
if child < self.N and less(self.keys[self.pq[child]], self.keys[self.pq[child+1]]):
child = child+1
if less(self.keys[self.pq[child]], self.keys[self.pq[k]]):
exchange(self.pq, k, child)
self.qp[self.pq[k]] = k
self.qp[self.pq[child]] = child
k = child
else:
break
def is_empty(self):
return self.N == 0
def size(self):
return self.N
| 23.443983 | 95 | 0.456283 | 770 | 5,650 | 3.31039 | 0.083117 | 0.120047 | 0.038446 | 0.038446 | 0.812083 | 0.786975 | 0.743821 | 0.714398 | 0.701452 | 0.675559 | 0 | 0.023214 | 0.41292 | 5,650 | 240 | 96 | 23.541667 | 0.745252 | 0 | 0 | 0.763158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.163158 | false | 0 | 0.005263 | 0.057895 | 0.310526 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
f3eb844d4ad5b9dd540310b79ad24274396db218 | 128 | py | Python | src/swimport/tests/01_import_with_special_rule/usage.py | talos-gis/swimport | e8f0fcf02b0c9751b199f750f1f8bc57c8ff54b3 | [
"MIT"
] | 1 | 2019-03-07T20:43:42.000Z | 2019-03-07T20:43:42.000Z | src/swimport/tests/01_import_with_special_rule/usage.py | talos-gis/swimport | e8f0fcf02b0c9751b199f750f1f8bc57c8ff54b3 | [
"MIT"
] | null | null | null | src/swimport/tests/01_import_with_special_rule/usage.py | talos-gis/swimport | e8f0fcf02b0c9751b199f750f1f8bc57c8ff54b3 | [
"MIT"
] | null | null | null | import example
from swimport.tests.resources import assert_eq
assert_eq(example.getDozen(), 12)
assert_eq(example.inc(15), 16)
| 21.333333 | 46 | 0.804688 | 20 | 128 | 5 | 0.65 | 0.24 | 0.3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051282 | 0.085938 | 128 | 5 | 47 | 25.6 | 0.803419 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 7 |
6d4373046061c651743796692bcfbe8242fd08f9 | 69 | py | Python | wildfirepy/io/__init__.py | Lashuk1729/wildfirepy | 085a1b90e64e4875aa6e9e7fc882902acff97775 | [
"MIT"
] | 21 | 2020-05-03T11:29:49.000Z | 2021-08-18T15:51:29.000Z | wildfirepy/io/__init__.py | lisa761/wildfirepy | 9f54e87adf7d7ff3738f1a13303d4073dd82fbc1 | [
"MIT"
] | 60 | 2020-05-01T22:35:09.000Z | 2020-12-07T08:48:59.000Z | wildfirepy/io/__init__.py | lisa761/wildfirepy | 9f54e87adf7d7ff3738f1a13303d4073dd82fbc1 | [
"MIT"
] | 24 | 2020-05-02T02:01:56.000Z | 2021-01-05T18:03:19.000Z | from wildfirepy.io.hdf import *
from wildfirepy.io.viirs1km import *
| 23 | 36 | 0.797101 | 10 | 69 | 5.5 | 0.6 | 0.509091 | 0.581818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.016393 | 0.115942 | 69 | 2 | 37 | 34.5 | 0.885246 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
ede659d36cd157535602e698a581f72110c29567 | 396,780 | py | Python | common2/imp/DSR_ROBOT2.py | Pandinosaurus/doosan-robot2 | 71f5abee2694d5f3ef7415d3d72285837b3cd066 | [
"Apache-2.0",
"BSD-3-Clause"
] | 33 | 2020-11-02T09:59:07.000Z | 2022-03-27T14:27:55.000Z | common2/imp/DSR_ROBOT2.py | Pandinosaurus/doosan-robot2 | 71f5abee2694d5f3ef7415d3d72285837b3cd066 | [
"Apache-2.0",
"BSD-3-Clause"
] | 18 | 2020-11-16T06:15:16.000Z | 2022-02-16T10:10:57.000Z | common2/imp/DSR_ROBOT2.py | Pandinosaurus/doosan-robot2 | 71f5abee2694d5f3ef7415d3d72285837b3cd066 | [
"Apache-2.0",
"BSD-3-Clause"
] | 20 | 2020-11-02T09:59:31.000Z | 2022-03-27T14:40:42.000Z | #-*- coding: utf-8 -*-
# ##
# @mainpage
# @file DSR_ROBOT2.py
# @brief Doosan Robotics ROS2 service I/F module
# @author kabdol2<kabkyoum.kim@doosan.com>
# @version 0.10
# @Last update date 2021-02-05
# @details
#
# history
# -
#
__ROS2__ = True
import rclpy
import os
import threading, time
from std_msgs.msg import String,Int32,Int32MultiArray,Float32,Float64,Float32MultiArray,Float64MultiArray,MultiArrayLayout,MultiArrayDimension
import sys
sys.dont_write_bytecode = True
#import numpy as np
from DRFC import *
from DR_common2 import *
from dsr_msgs2.msg import *
from dsr_msgs2.srv import *
#-----------------------------------------------------------------------------------
import DR_init
g_node = None
g_node = DR_init.__dsr__node
_robot_id = DR_init.__dsr__id
_robot_model = DR_init.__dsr__model
_srv_name_prefix = '' #'/' + _robot_id + _robot_model #ROS2
_topic_name_prefix = _srv_name_prefix
print("_robot_id ={0}".format(_robot_id))
print("_robot_model ={0}".format(_robot_model))
print("_srv_name_prefix ={0}".format(_srv_name_prefix))
print("_topic_name_prefix ={0}".format(_topic_name_prefix))
#-----------------------------------------------------------------------------------
############### connect to dsr_control2 (ros2 service) #######################################################################
# system Operations
_ros2_set_robot_mode = g_node.create_client(SetRobotMode, _srv_name_prefix +"system/set_robot_mode")
_ros2_get_robot_mode = g_node.create_client(GetRobotMode, _srv_name_prefix +"system/get_robot_mode")
_ros2_set_robot_system = g_node.create_client(SetRobotSystem, _srv_name_prefix +"system/set_robot_system")
_ros2_get_robot_system = g_node.create_client(GetRobotSystem, _srv_name_prefix +"system/get_robot_system")
_ros2_get_robot_state = g_node.create_client(GetRobotState, _srv_name_prefix +"system/get_robot_state")
_ros2_set_robot_speed_mode = g_node.create_client(SetRobotSpeedMode, _srv_name_prefix +"system/set_robot_speed_mode")
_ros2_get_robot_speed_mode = g_node.create_client(GetRobotSpeedMode, _srv_name_prefix +"system/get_robot_speed_mode")
_ros2_set_safe_stop_reset_type = g_node.create_client(SetSafeStopResetType, _srv_name_prefix +"system/set_safe_stop_reset_type")
_ros2_get_last_alarm = g_node.create_client(GetLastAlarm, _srv_name_prefix +"system/get_last_alarm")
_ros2_get_current_pose = g_node.create_client(GetCurrentPose, _srv_name_prefix +"system/get_current_pose")
# motion Operations
_ros2_movej = g_node.create_client(MoveJoint, _srv_name_prefix +"motion/move_joint")
_ros2_movel = g_node.create_client(MoveLine, _srv_name_prefix +"motion/move_line")
_ros2_movejx = g_node.create_client(MoveJointx, _srv_name_prefix +"motion/move_jointx")
_ros2_movec = g_node.create_client(MoveCircle, _srv_name_prefix +"motion/move_circle")
_ros2_movesj = g_node.create_client(MoveSplineJoint, _srv_name_prefix +"motion/move_spline_joint")
_ros2_movesx = g_node.create_client(MoveSplineTask, _srv_name_prefix +"motion/move_spline_task")
_ros2_moveb = g_node.create_client(MoveBlending, _srv_name_prefix +"motion/move_blending")
_ros2_move_spiral = g_node.create_client(MoveSpiral, _srv_name_prefix +"motion/move_spiral")
_ros2_move_periodic = g_node.create_client(MovePeriodic, _srv_name_prefix +"motion/move_periodic")
_ros2_move_wait = g_node.create_client(MoveWait, _srv_name_prefix +"motion/move_wait")
_ros2_jog = g_node.create_client(Jog, _srv_name_prefix +"motion/jog")
_ros2_jog_multi = g_node.create_client(JogMulti, _srv_name_prefix +"motion/jog_multi")
_ros2_trans = g_node.create_client(Trans, _srv_name_prefix +"motion/trans")
_ros2_fkin = g_node.create_client(Fkin, _srv_name_prefix +"motion/fkin")
_ros2_ikin = g_node.create_client(Ikin, _srv_name_prefix +"motion/ikin")
_ros2_set_ref_coord = g_node.create_client(SetRefCoord, _srv_name_prefix +"motion/set_ref_coord")
_ros2_move_home = g_node.create_client(MoveHome, _srv_name_prefix +"motion/move_home")
_ros2_check_motion = g_node.create_client(CheckMotion, _srv_name_prefix +"motion/check_motion")
_ros2_change_operation_speed = g_node.create_client(ChangeOperationSpeed, _srv_name_prefix +"motion/change_operation_speed")
_ros2_enable_alter_motion = g_node.create_client(EnableAlterMotion, _srv_name_prefix +"motion/enable_alter_motion")
_ros2_alter_motion = g_node.create_client(AlterMotion, _srv_name_prefix +"motion/alter_motion")
_ros2_disable_alter_motion = g_node.create_client(DisableAlterMotion, _srv_name_prefix +"motion/disable_alter_motion")
_ros2_set_singularity_handling = g_node.create_client(SetSingularityHandling,_srv_name_prefix +"motion/set_singularity_handling")
# Auxiliary Control Operations
_ros2_get_control_mode = g_node.create_client(GetControlMode, _srv_name_prefix +"aux_control/get_control_mode")
_ros2_get_control_space = g_node.create_client(GetControlSpace, _srv_name_prefix +"aux_control/get_control_space")
_ros2_get_current_posj = g_node.create_client(GetCurrentPosj, _srv_name_prefix +"aux_control/get_current_posj")
_ros2_get_current_velj = g_node.create_client(GetCurrentVelj, _srv_name_prefix +"aux_control/get_current_velj")
_ros2_get_desired_posj = g_node.create_client(GetDesiredPosj, _srv_name_prefix +"aux_control/get_desired_posj")
_ros2_get_desired_velj = g_node.create_client(GetDesiredVelj, _srv_name_prefix +"aux_control/get_desired_velj")
_ros2_get_current_posx = g_node.create_client(GetCurrentPosx, _srv_name_prefix +"aux_control/get_current_posx")
_ros2_get_current_velx = g_node.create_client(GetCurrentVelx, _srv_name_prefix +"aux_control/get_current_velx")
_ros2_get_desired_posx = g_node.create_client(GetDesiredPosx, _srv_name_prefix +"aux_control/get_desired_posx")
_ros2_get_desired_velx = g_node.create_client(GetDesiredVelx, _srv_name_prefix +"aux_control/get_desired_velx")
_ros2_get_current_tool_flange_posx = g_node.create_client(GetCurrentToolFlangePosx, _srv_name_prefix +"aux_control/get_current_tool_flange_posx")
_ros2_get_current_solution_space = g_node.create_client(GetCurrentSolutionSpace, _srv_name_prefix +"aux_control/get_current_solution_space")
_ros2_get_current_rotm = g_node.create_client(GetCurrentRotm, _srv_name_prefix +"aux_control/get_current_rotm")
_ros2_get_joint_torque = g_node.create_client(GetJointTorque, _srv_name_prefix +"aux_control/get_joint_torque")
_ros2_get_external_torque = g_node.create_client(GetExternalTorque, _srv_name_prefix +"aux_control/get_external_torque")
_ros2_get_tool_force = g_node.create_client(GetToolForce, _srv_name_prefix +"aux_control/get_tool_force")
_ros2_get_solution_space = g_node.create_client(GetSolutionSpace, _srv_name_prefix +"aux_control/get_solution_space")
_ros2_get_orientation_error = g_node.create_client(GetOrientationError, _srv_name_prefix +"aux_control/get_orientation_error")
# Force/Stiffness Control & others Operations
_ros2_get_workpiece_weight = g_node.create_client(GetWorkpieceWeight, _srv_name_prefix +"force/get_workpiece_weight")
_ros2_reset_workpiece_weight = g_node.create_client(ResetWorkpieceWeight, _srv_name_prefix +"force/reset_workpiece_weight")
_ros2_parallel_axis1 = g_node.create_client(ParallelAxis1, _srv_name_prefix +"force/parallel_axis1")
_ros2_parallel_axis2 = g_node.create_client(ParallelAxis2, _srv_name_prefix +"force/parallel_axis2")
_ros2_align_axis1 = g_node.create_client(AlignAxis1, _srv_name_prefix +"force/align_axis1")
_ros2_align_axis2 = g_node.create_client(AlignAxis2, _srv_name_prefix +"force/align_axis2")
_ros2_is_done_bolt_tightening = g_node.create_client(IsDoneBoltTightening, _srv_name_prefix +"force/is_done_bolt_tightening")
_ros2_release_compliance_ctrl = g_node.create_client(ReleaseComplianceCtrl, _srv_name_prefix +"force/release_compliance_ctrl")
_ros2_task_compliance_ctrl = g_node.create_client(TaskComplianceCtrl, _srv_name_prefix +"force/task_compliance_ctrl")
_ros2_set_stiffnessx = g_node.create_client(SetStiffnessx, _srv_name_prefix +"force/set_stiffnessx")
_ros2_calc_coord = g_node.create_client(CalcCoord, _srv_name_prefix +"force/calc_coord")
_ros2_set_user_cart_coord1 = g_node.create_client(SetUserCartCoord1, _srv_name_prefix +"force/set_user_cart_coord1")
_ros2_set_user_cart_coord2 = g_node.create_client(SetUserCartCoord2, _srv_name_prefix +"force/set_user_cart_coord2")
_ros2_set_user_cart_coord3 = g_node.create_client(SetUserCartCoord3, _srv_name_prefix +"force/set_user_cart_coord3")
_ros2_overwrite_user_cart_coord = g_node.create_client(OverwriteUserCartCoord, _srv_name_prefix +"force/overwrite_user_cart_coord")
_ros2_get_user_cart_coord = g_node.create_client(GetUserCartCoord, _srv_name_prefix +"force/get_user_cart_coord")
_ros2_set_desired_force = g_node.create_client(SetDesiredForce, _srv_name_prefix +"force/set_desired_force")
_ros2_release_force = g_node.create_client(ReleaseForce, _srv_name_prefix +"force/release_force")
_ros2_check_position_condition = g_node.create_client(CheckPositionCondition, _srv_name_prefix +"force/check_position_condition")
_ros2_check_force_condition = g_node.create_client(CheckForceCondition, _srv_name_prefix +"force/check_force_condition")
_ros2_check_orientation_condition1= g_node.create_client(CheckOrientationCondition1, _srv_name_prefix +"force/check_orientation_condition1")
_ros2_check_orientation_condition2= g_node.create_client(CheckOrientationCondition2, _srv_name_prefix +"force/check_orientation_condition2")
_ros2_coord_transform = g_node.create_client(CoordTransform, _srv_name_prefix +"force/coord_transform")
# GPIO Operations
_ros2_set_digital_output = g_node.create_client(SetCtrlBoxDigitalOutput, _srv_name_prefix +"io/set_ctrl_box_digital_output")
_ros2_get_digital_input = g_node.create_client(GetCtrlBoxDigitalInput, _srv_name_prefix +"io/get_ctrl_box_digital_input")
_ros2_set_tool_digital_output = g_node.create_client(SetToolDigitalOutput, _srv_name_prefix +"io/set_tool_digital_output")
_ros2_get_tool_digital_input = g_node.create_client(GetToolDigitalInput, _srv_name_prefix +"io/get_tool_digital_input")
_ros2_set_analog_output = g_node.create_client(SetCtrlBoxAnalogOutput, _srv_name_prefix +"io/set_ctrl_box_analog_output")
_ros2_get_analog_input = g_node.create_client(GetCtrlBoxAnalogInput, _srv_name_prefix +"io/get_ctrl_box_analog_input")
_ros2_set_mode_analog_output = g_node.create_client(SetCtrlBoxAnalogOutputType, _srv_name_prefix +"io/set_ctrl_box_analog_output_type")
_ros2_set_mode_analog_input = g_node.create_client(SetCtrlBoxAnalogInputType, _srv_name_prefix +"io/set_ctrl_box_analog_input_type")
_ros2_get_digital_output = g_node.create_client(GetCtrlBoxDigitalOutput, _srv_name_prefix +"io/get_ctrl_box_digital_output")
_ros2_get_tool_digital_output = g_node.create_client(GetToolDigitalOutput, _srv_name_prefix +"io/get_tool_digital_output")
# Modbus Operations,
_ros2_set_modbus_output = g_node.create_client(SetModbusOutput, _srv_name_prefix +"modbus/set_modbus_output")
_ros2_get_modbus_input = g_node.create_client(GetModbusInput, _srv_name_prefix +"modbus/get_modbus_input")
_ros2_add_modbus_signal = g_node.create_client(ConfigCreateModbus, _srv_name_prefix +"modbus/config_create_modbus")
_ros2_del_modbus_signal = g_node.create_client(ConfigDeleteModbus, _srv_name_prefix +"modbus/config_delete_modbus")
# TCP Operations,
_ros2_set_current_tcp = g_node.create_client(SetCurrentTcp, _srv_name_prefix +"tcp/set_current_tcp")
_ros2_get_current_tcp = g_node.create_client(GetCurrentTcp, _srv_name_prefix +"tcp/get_current_tcp")
_ros2_config_create_tcp = g_node.create_client(ConfigCreateTcp, _srv_name_prefix +"tcp/config_create_tcp")
_ros2_config_delete_tcp = g_node.create_client(ConfigDeleteTcp, _srv_name_prefix +"tcp/config_delete_tcp")
# Tool Operations,
_ros2_set_current_tool = g_node.create_client(SetCurrentTool, _srv_name_prefix +"tool/set_current_tool")
_ros2_get_current_tool = g_node.create_client(GetCurrentTool, _srv_name_prefix +"tool/get_current_tool")
_ros2_config_create_tool = g_node.create_client(ConfigCreateTool, _srv_name_prefix +"tool/config_create_tool")
_ros2_config_delete_tool = g_node.create_client(ConfigDeleteTool, _srv_name_prefix +"tool/config_delete_tool")
_ros2_set_tool_shape = g_node.create_client(SetToolShape, _srv_name_prefix +"tool/set_tool_shape")
# DRL Operations,
_ros2_drl_pause = g_node.create_client(DrlPause, _srv_name_prefix +"drl/drl_pause")
_ros2_drl_resume = g_node.create_client(DrlResume, _srv_name_prefix +"drl/drl_resume")
_ros2_drl_start = g_node.create_client(DrlStart, _srv_name_prefix +"drl/drl_start")
_ros2_drl_stop = g_node.create_client(DrlStop, _srv_name_prefix +"drl/drl_stop")
_ros2_get_drl_state = g_node.create_client(GetDrlState, _srv_name_prefix +"drl/get_drl_state")
########################################################################################################################################
# point count
POINT_COUNT = 6
# solution space
DR_SOL_MIN = 0
DR_SOL_MAX = 7
# posb seg_type
DR_LINE = 0
DR_CIRCLE = 1
# move reference
DR_BASE = 0
DR_TOOL = 1
DR_WORLD = 2
DR_TC_USER_MIN = 101
DR_TC_USER_MAX = 200
# move mod
DR_MV_MOD_ABS = 0
DR_MV_MOD_REL = 1
# move reaction
DR_MV_RA_NONE = 0
DR_MV_RA_DUPLICATE = 0
DR_MV_RA_OVERRIDE = 1
# move command type
DR_MV_COMMAND_NORM = 0
# movesx velocity
DR_MVS_VEL_NONE = 0
DR_MVS_VEL_CONST = 1
# motion state
DR_STATE_IDLE = 0
DR_STATE_INIT = 1
DR_STATE_BUSY = 2
DR_STATE_BLEND = 3
DR_STATE_ACC = 4
DR_STATE_CRZ = 5
DR_STATE_DEC = 6
# axis
DR_AXIS_X = 0
DR_AXIS_Y = 1
DR_AXIS_Z = 2
DR_AXIS_A = 10
DR_AXIS_B = 11
DR_AXIS_C = 12
# collision sensitivity
DR_COLSENS_DEFAULT = 20
DR_COLSENS_MIN = 1 #10 2017/11/08 변경
DR_COLSENS_MAX = 300 #100 2017/11/08 변경
# speed
DR_OP_SPEED_MIN = 1
DR_OP_SPEED_MAX = 100
# stop
DR_QSTOP_STO = 0
DR_QSTOP = 1
DR_SSTOP = 2
DR_HOLD = 3
DR_STOP_FIRST = DR_QSTOP_STO
DR_STOP_LAST = DR_HOLD
# condition
DR_COND_NONE = -10000
# digital I/O
DR_DIO_MIN_INDEX = 1
DR_DIO_MAX_INDEX = 16 #8 16개로 확장됨 2017/08/18
# tool digital I/O
DR_TDIO_MIN_INDEX = 1
DR_TDIO_MAX_INDEX = 6
# I/O value
ON = 1
OFF = 0
# Analog I/O mode
DR_ANALOG_CURRENT = 0
DR_ANALOG_VOLTAGE = 1
# modbus type
DR_MODBUS_DIG_INPUT = 0
DR_MODBUS_DIG_OUTPUT = 1
DR_MODBUS_REG_INPUT = 2
DR_MODBUS_REG_OUTPUT = 3
DR_DISCRETE_INPUT = DR_MODBUS_DIG_INPUT
DR_COIL = DR_MODBUS_DIG_OUTPUT
DR_INPUT_REGISTER = DR_MODBUS_REG_INPUT
DR_HOLDING_REGISTER = DR_MODBUS_REG_OUTPUT
DR_MODBUS_ACCESS_MAX = 32
DR_MAX_MODBUS_NAME_SIZE = 32
# tp_popup pm_type
DR_PM_MESSAGE = 0
DR_PM_WARNING = 1
DR_PM_ALARM = 2
DR_TP_POPUP_BUTTON_TYPE_STOP_RESUME = 0 # add 2019/04/01
DR_TP_POPUP_BUTTON_TYPE_STOP = 1 # add 2019/04/01
# tp_get_user_input type
DR_VAR_INT = 0
DR_VAR_FLOAT = 1
DR_VAR_STR = 2
DR_VAR_BOOL = 3 # add 2020/01/29
# len
DR_VELJ_DT_LEN = 6
DR_ACCJ_DT_LEN = 6
DR_VELX_DT_LEN = 2
DR_ACCX_DT_LEN = 2
DR_ANGLE_DT_LEN = 2
DR_COG_DT_LEN = 3
DR_WEIGHT_DT_LEN = 3
DR_VECTOR_DT_LEN = 3
DR_ST_DT_LEN = 6
DR_FD_DT_LEN = 6
DR_DIR_DT_LEN = 6
DR_INERTIA_DT_LEN = 6
DR_VECTOR_U1_LEN = 3
DR_VECTOR_V1_LEN = 3
# set_singular_handling mode
DR_AVOID = 0
DR_TASK_STOP = 1
DR_VAR_VEL = 2 #add 2019/04/01
# object container type
DR_FIFO = 0
DR_LIFO = 1
# set_desired_force mod
DR_FC_MOD_ABS = 0
DR_FC_MOD_REL = 1
# global variable type
DR_GLOBAL_VAR_TYPE_BOOL = 0
DR_GLOBAL_VAR_TYPE_INT = 1
DR_GLOBAL_VAR_TYPE_FLOAT = 2
DR_GLOBAL_VAR_TYPE_STR = 3
DR_GLOBAL_VAR_TYPE_POSJ = 4
DR_GLOBAL_VAR_TYPE_POSX = 5
DR_GLOBAL_VAR_TYPE_UNKNOWN= 6
# Industrial Ethernet(EtherNet/IP, PROFINET) Slave address
DR_IE_SLAVE_GPR_ADDR_START = 0
DR_IE_SLAVE_GPR_ADDR_END =23
DR_IE_SLAVE_GPR_ADDR_END_BIT =63
# 경로 수정 기능
DR_DPOS = 0
DR_DVEL = 1
# Homing 기능
DR_HOME_TARGET_MECHANIC = 0
DR_HOME_TARGET_USER = 1
# movec ori 옵션
DR_MV_ORI_TEACH = 0 #교시자세
DR_MV_ORI_FIXED = 1 #고정자세
DR_MV_ORI_RADIAL = 2 #원주구속자세
# app_type
DR_MV_APP_NONE = 0
DR_MV_APP_WELD = 1
# =============================================================================================
# global variable
DR_CONFIG_PRT_EXT_RESULT = False
DR_CONFIG_PRT_RESULT = False
_g_blend_state = False
_g_blend_radius = 0.0
_g_velj = [0.0] * DR_VELJ_DT_LEN
_g_accj = [0.0] * DR_ACCJ_DT_LEN
_g_velx = [0.0] * DR_VELX_DT_LEN
_g_velx[0]= 0.0
_g_velx[1]= DR_COND_NONE
_g_accx = [0.0] * DR_ACCX_DT_LEN
_g_accx[0]= 0.0
_g_accx[1]= DR_COND_NONE
_g_coord = DR_BASE
_g_drl_result_th = None
#_g_tp_lock = threading.Lock() # only 1 execution allowed with TP
_g_test_cnt =0
_g_test_max =0
_g_analog_output_mode_ch1 = -1
_g_analog_output_mode_ch2 = -1
#DR_SUB_PROGRAM_LIST = dict() #서브 프로그램 저장 리스트
########################################################################################################################################
def wait(second):
time.sleep(second)
def print_ext_result(str):
if DR_CONFIG_PRT_EXT_RESULT:
# print("[{0}] / {1}".format(strftime("%Y-%m-%d %H:%M:%S", gmtime()), str))
print("__{0}".format(str))
def print_result(str):
if DR_CONFIG_PRT_RESULT:
# print("[{0}] / {1}".format(strftime("%Y-%m-%d %H:%M:%S", gmtime()), str))
print("__{0}".format(str))
def _check_valid_vel_acc_joint(vel, acc, time):
if float(time) == 0.0:
for item in vel:
if float(item) != 0.0:
break
else:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v (0.0, when time = 0.0)", True)
for item in acc:
if float(item) != 0.0:
break
else:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a (0.0, when time = 0.0)", True)
return
def _check_valid_vel_acc_task(vel, acc, time):
if float(time) == 0.0:
if vel[0] <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel1, v1 (0.0, when time = 0.0)", True)
else:
if (vel[1]!=DR_COND_NONE) and (vel[1]<=0):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel2, v2 (0.0, when time = 0.0)", True)
if acc[0] <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc1, a1 (0.0, when time = 0.0)", True)
else:
if (acc[1]!=DR_COND_NONE) and (acc[1]<=0):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc2, a2 (0.0, when time = 0.0)", True)
return
def set_velj(vel):
vel_list = None
# vel
if type(vel) == int or type(vel) == float:
if vel <= 0:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel")
vel_list = [vel] * DR_VELJ_DT_LEN
elif type(vel) == list and len(vel) == POINT_COUNT:
vel_list = vel
if is_number(vel_list) != True:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel")
for item in vel:
if item <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel")
# set global velj
global _g_velj
_g_velj = vel_list
print_result("0 = set_velj(vel:{0})".format(dr_form(vel)))
return 0
def set_accj(acc):
acc_list = None
# acc
if type(acc) == int or type(acc) == float:
acc_list = [acc] * DR_ACCJ_DT_LEN
if acc <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc")
elif type(acc) == list and len(acc) == POINT_COUNT:
acc_list = acc
if is_number(acc_list) != True:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc")
for item in acc:
if item <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc")
# set global velj
global _g_accj
_g_accj = acc_list
print_result("0 = set_accj(acc:{0})".format(dr_form(acc)))
return 0
def set_velx(vel1, vel2=DR_COND_NONE):
#print("vel1={0}, vel2={1}".format(vel1, vel2))
# vel1
if type(vel1) != int and type(vel1) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel1")
if vel1 <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel1")
# vel2
if type(vel2) != int and type(vel2) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel2")
if vel2 != DR_COND_NONE:
if vel2 <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel2")
# set global velx
global _g_velx
_g_velx = [vel1, vel2]
print_result("0 = set_velx(vel1:{0}, vel2:{1})".format(dr_form(vel1), dr_form(vel2)))
return 0
def set_accx(acc1, acc2=DR_COND_NONE):
#print("acc1={0}, acc2={1}".format(acc1, acc2))
# acc1
if type(acc1) != int and type(acc1) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc1")
if acc1 <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc1")
# acc2
if type(acc2) != int and type(acc2) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc2")
if acc2 != DR_COND_NONE:
if acc2 <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc2")
# set global accx
global _g_accx
_g_accx = [acc1, acc2]
print_result("0 = set_accx(acc1:{0}, acc2:{1})".format(dr_form(acc1), dr_form(acc2)))
return 0
# convert : list -> Float64MultiArray
def _ros_listToFloat64MultiArray(list_src):
_res = []
for i in list_src:
item = Float64MultiArray()
if __ROS2__:
item.data = [float(x) for x in i]
else:
item.data = i
_res.append(item)
#print(_res)
#print(len(_res))
return _res
# convert : Float64MultiArray -> list
def _ros_Float64MultiArrayTolist(multi_arr_f64):
_res = []
for i in range( len(multi_arr_f64) ):
_res.append( list(multi_arr_f64[i].data) )
#print(_res)
#print(len(_res))
return _res
##### SYSTEM ##############################################################################################################################
def set_robot_mode(robot_mode):
if type(robot_mode) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : robot_mode")
# ROS2 service call
if __ROS2__:
#srv = _ros_set_robot_mode(robot_mode)
req = SetRobotMode.Request()
req.robot_mode = robot_mode
#ret = 0 if (srv.success == True) else -1
future = _ros2_set_robot_mode.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_robot_mode Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_robot_mode():
# ROS2 service call
if __ROS2__:
req = GetRobotMode.Request()
#ret = 0 if (srv.success == True) else -1
future = _ros2_get_robot_mode.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_robot_mode Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.robot_mode
return ret
def set_robot_system(robot_system):
if type(robot_system) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : robot_system")
# ROS2 service call
if __ROS2__:
req = SetRobotSystem.Request()
req.robot_system = robot_system
future = _ros2_set_robot_system.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_robot_system Service call failed %r' % (e,))
else:
if result == None:
ret = -1
g_node.get_logger().info('set_robot_system Service call failed')
else:
ret = 0 if (result.success == True) else -1
return ret
def get_robot_system():
# ROS2 service call
if __ROS2__:
req = GetRobotSystem.Request()
future = _ros2_get_robot_system.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_robot_system Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.robot_system
return ret
def get_robot_state():
# ROS2 service call
if __ROS2__:
req = GetRobotState.Request()
future = _ros2_get_robot_state.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_robot_state Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.robot_state
return ret
def set_robot_speed_mode(speed_mode):
if type(speed_mode) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : speed_mode")
# ROS2 service call
if __ROS2__:
req = SetRobotSpeedMode.Request()
req.speed_mode = speed_mode
future = _ros2_set_robot_speed_mode.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_robot_speed_mode Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_robot_speed_mode():
# ROS2 service call
if __ROS2__:
req = GetRobotSpeedMode.Request()
future = _ros2_get_robot_speed_mode.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_robot_speed_mode Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.speed_mode
return ret
def set_safe_stop_reset_type(reset_type):
if type(reset_type) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : reset_type")
# ROS2 service call
if __ROS2__:
req = SetSafeStopResetType.Request()
req.reset_type = reset_type
future = _ros2_set_safe_stop_reset_type.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_safe_stop_reset_type Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_current_pose(space_type):
if type(space_type) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : space_type")
if __ROS2__:
req = GetCurrentPose.Request()
req.space_type = space_type
future = _ros2_get_current_pose.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_pose Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.pos
return ret
def get_current_solution_space():
# ROS2 service call
if __ROS2__:
req = GetCurrentSolutionSpace.Request()
future = _ros2_get_current_solution_space.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_solution_space Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.sol_space
return ret
def get_last_alarm():
#ROS2 service call
if __ROS2__:
req = GetLastAlarm.Request()
future = _ros2_get_last_alarm.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_last_alarm Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.log_alarm
return ret
##### Auxiliary Control ##############################################################################################################################
def get_control_mode():
if __ROS2__:
req = GetControlMode.Request()
future = _ros2_get_control_mode.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_control_mode Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.control_mode
return ret
def get_control_space():
if __ROS2__:
req = GetControlSpace.Request()
future = _ros2_get_control_space.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_control_space Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.space
return ret
def get_current_posj():
if __ROS2__:
req = GetCurrentPosj.Request()
future = _ros2_get_current_posj.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_posj Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
pos = list(result.pos) # Convert tuple to list
# set posj
cur_pos = posj(pos)
ret = cur_pos
return ret
def get_current_velj():
if __ROS2__:
req = GetCurrentVelj.Request()
future = _ros2_get_current_velj.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_velj Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = list(result.joint_speed) # Convert tuple to list
return ret
def get_desired_posj():
if __ROS2__:
req = GetDesiredPosj.Request()
future = _ros2_get_desired_posj.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_desired_posj Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
pos = list(result.pos) # Convert tuple to list
ret = posj(pos)
return ret
def get_desired_velj():
if __ROS2__:
req = GetDesiredVelj.Request()
future = _ros2_get_desired_velj.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_desired_velj Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = list(result.joint_vel) # Convert tuple to list
return ret
def get_current_posx(ref=None):
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref != DR_BASE and _ref != DR_WORLD and (_ref < DR_TC_USER_MIN or _ref > DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = GetCurrentPosx.Request()
req.ref = _ref
future = _ros2_get_current_posx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_posx Service call failed %r' % (e,))
else:
if result == None:
return None, None
else:
posx_info = _ros_Float64MultiArrayTolist(result.task_pos_info) # Convert Float64MultiArray to list
pos = []
for i in range(POINT_COUNT):
pos.append(posx_info[0][i])
sol = int(round( posx_info[0][6] ))
conv_posx = posx(pos)
return conv_posx, sol
return 0
def get_current_tool_flange_posx(ref=None):
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = GetCurrentToolFlangePosx.Request()
req.ref = _ref
future = _ros2_get_current_tool_flange_posx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_tool_flange_posx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.pos
pos = list(result.pos) # Convert tuple to list
# set posx type
ret = posx(pos)
return ret
def get_current_velx(ref=None):
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = GetCurrentVelx.Request()
req.ref = _ref
future = _ros2_get_current_velx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_velx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.vel
return ret
def get_desired_posx(ref=None):
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref != DR_BASE and _ref != DR_TOOL and _ref != DR_WORLD and (_ref < DR_TC_USER_MIN or _ref > DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = GetDesiredPosx.Request()
req.ref = _ref
future = _ros2_get_desired_posx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_desired_posx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
pos = list(result.pos) # Convert tuple to list
conv_posx = posx(pos)
ret = conv_posx
return ret
def get_desired_velx(ref=None):
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = GetDesiredVelx.Request()
req.ref = _ref
future = _ros2_get_desired_velx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_desired_velx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = list(result.vel) # Convert tuple to list
return ret
def get_current_solution_space():
if __ROS2__:
req = GetCurrentSolutionSpace.Request()
future = _ros2_get_current_solution_space.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_solution_space Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.sol_space
return ret
def get_current_rotm(ref=None):
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = GetCurrentRotm.Request()
req.ref = _ref
future = _ros2_get_current_rotm.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_rotm Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = _ros_Float64MultiArrayTolist(result.rot_matrix) # Convert Float64MultiArray to list
return ret
def get_joint_torque():
if __ROS2__:
req = GetJointTorque.Request()
future = _ros2_get_joint_torque.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_joint_torque Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = list(result.jts) # Convert tuple to list
return ret
def get_external_torque():
if __ROS2__:
req = GetExternalTorque.Request()
future = _ros2_get_external_torque.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_external_torque Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = list(result.ext_torque) # Convert tuple to list
return ret
def get_tool_force(ref=None):
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = GetToolForce.Request()
req.ref = _ref
future = _ros2_get_tool_force.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_tool_force Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = list(result.tool_force) # Convert tuple to list
return ret
def get_solution_space(pos):
_pos = get_posj(pos)
if __ROS2__:
req = GetSolutionSpace.Request()
req.pos = [float(x) for x in _pos]
future = _ros2_get_solution_space.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_solution_space Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.sol_space
return ret
def get_orientation_error(xd, xc, axis):
# xd, xc
_xd = get_posx(xd)
_xc = get_posx(xc)
# axis
if type(axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if (axis != DR_AXIS_X and axis != DR_AXIS_Y and axis != DR_AXIS_Z and \
axis != DR_AXIS_A and axis != DR_AXIS_B and axis != DR_AXIS_C):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(axis))
if __ROS2__:
req = GetOrientationError.Request()
req.xd = [float(x) for x in _xd]
req.xc = [float(x) for x in _xc]
req.axis = axis
future = _ros2_get_orientation_error.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_orientation_error Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.ori_error
return ret
##### MOTION ##############################################################################################################################
def trans(pos, delta, ref=None, ref_out=DR_BASE):
# pos, delta
_pos = get_posx(pos)
_delta = get_posx(delta)
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref != DR_BASE and _ref != DR_TOOL and _ref != DR_WORLD and (_ref < DR_TC_USER_MIN or _ref > DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# check ref_out
if type(ref_out) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref_out")
if ref_out != DR_BASE and ref_out != DR_WORLD and (ref_out < DR_TC_USER_MIN or ref_out > DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref_out({0})".format(ref_out))
# ROS service call
if __ROS2__:
req = Trans.Request()
req.pos = [float(x) for x in _pos]
req.delta = [float(x) for x in _delta]
req.ref = _ref
req.ref_out = ref_out
future = _ros2_trans.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('trans Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.trans_pos
return ret
def fkin(pos, ref=None):
_pos = get_posj(pos)
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# ROS service call
if __ROS2__:
req = Fkin.Request()
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = _ros2_fkin.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('fkin Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.conv_posx
return ret
def ikin(pos, sol_space, ref=None):
_pos = get_posx(pos)
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# sol_space
if type(sol_space) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : sol_space")
if sol_space < DR_SOL_MIN or sol_space > DR_SOL_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : sol_space({0})".format(sol_space))
# ROS service call
if __ROS2__:
req = Ikin.Request()
req.pos = [float(x) for x in _pos]
req.sol_space = sol_space
req.ref = _ref
future = _ros2_ikin.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('ikin Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.conv_posj
return ret
def set_ref_coord(coord):
# coord
if type(coord) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : coord")
if coord != DR_BASE and coord != DR_TOOL and coord != DR_WORLD and not (DR_TC_USER_MIN <= coord <= DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : coord({0})".format(coord))
# ROS service call
if __ROS2__:
req = SetRefCoord.Request()
req.coord = coord
future = _ros2_set_ref_coord.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_ref_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
# set global accx
global _g_coord
_g_coord = coord
#print_result("{0} = set_ref_coord(coord:{1})".format(ret, coord))
return ret
def movej(pos, vel=None, acc=None, time=None, radius=None, mod= DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None):
ret = _movej(pos, vel, acc, time, radius, mod, ra, v, a, t, r, _async=0)
return ret
def amovej(pos, vel=None, acc=None, time=None, radius=None, mod= DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None):
ret = _movej(pos, vel, acc, time, radius, mod, ra, v, a, t, r, _async=1)
return ret
def _movej(pos, vel=None, acc=None, time=None, radius=None, mod= DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None, _async=0):
# _pos
_pos = get_posj(pos)
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = _g_velj
else:
if type(temp) == int or type(temp) == float:
_vel = [temp] * DR_VELJ_DT_LEN
elif type(temp) == list and len(temp) == DR_VELJ_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = _g_accj
else:
if type(temp) == int or type(temp) == float:
_acc = [temp] * DR_ACCJ_DT_LEN
elif type(temp) == list and len(temp) == DR_ACCJ_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_joint(_vel, _acc, _time)
# _radius
_radius = get_param(radius, r)
if _radius == None:
global _g_blend_state
if _g_blend_state == True:
_radius = _g_blend_radius
else:
_radius = 0.0
if type(_radius) != int and type(_radius) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : radius, r")
if _radius< 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : radius, r")
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# ra
if type(ra) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ra")
if ra != DR_MV_RA_OVERRIDE and ra != DR_MV_RA_DUPLICATE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ra")
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
#SSS srv = _ros_movej(_pos, _vel[0], _acc[0], _time, mod, _radius, ra, _async)
req = MoveJoint.Request()
#for i in range(6):
# req.pos[i] = pos[i]
req.pos = [float(x) for x in _pos]
req.vel = float(_vel[0])
req.acc = float(_acc[0])
req.time = float(_time)
req.mode = int(mod)
req.radius = float(_radius)
req.blend_type = int(ra)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = _ros2_movej.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('movej Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_movej(_pos, _vel, _acc, _time, _radius, mod, ra, _async)
return ret
def movejx(pos, vel=None, acc=None, time=None, radius=None, ref=None, mod= DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, sol=0, v=None, a=None, t=None, r=None):
ret = _movejx(pos, vel, acc, time, radius, ref, mod, ra, sol, v, a, t, r, _async=0)
return ret
def amovejx(pos, vel=None, acc=None, time=None, radius=None, ref=None, mod= DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, sol=0, v=None, a=None, t=None, r=None):
ret = _movejx(pos, vel, acc, time, radius, ref, mod, ra, sol, v, a, t, r, _async=1)
return ret
def _movejx(pos, vel=None, acc=None, time=None, radius=None, ref=None, mod= DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, sol=0, v=None, a=None, t=None, r=None, _async=0):
# _pos
_pos = get_posx(pos)
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = _g_velj
else:
if type(temp) == int or type(temp) == float:
_vel = [temp] * DR_VELJ_DT_LEN
elif type(temp) == list and len(temp) == DR_VELJ_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = _g_accj
else:
if type(temp) == int or type(temp) == float:
_acc = [temp] * DR_ACCJ_DT_LEN
elif type(temp) == list and len(temp) == DR_ACCJ_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_joint(_vel, _acc, _time)
# _radius
_radius = get_param(radius, r)
if _radius == None:
global _g_blend_state
if _g_blend_state == True:
_radius = _g_blend_radius
else:
_radius = 0.0
if type(_radius) != int and type(_radius) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : radius, r")
if _radius < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : radius, r")
# _ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# ra
if type(ra) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type, ra")
if ra != DR_MV_RA_OVERRIDE and ra != DR_MV_RA_DUPLICATE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ra")
# sol
if type(sol) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : sol")
if sol < DR_SOL_MIN or sol > DR_SOL_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : sol")
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
#srv = _ros_movejx(_pos, _vel[0], _acc[0], _time, mod, _ref, _radius, ra, sol, _async)
req = MoveJointx.Request()
req.pos = [float(x) for x in _pos]
req.vel = float(_vel[0])
req.acc = float(_acc[0])
req.time = float(_time)
req.mode = int(mod)
req.ref = int(_ref)
req.radius = float(_radius)
req.blend_type = int(ra)
req.sol = int(sol)
req.sync_type = int(_async)
#ret = srv.success
#ret = 0 if (srv.success == True) else -1
future = _ros2_movejx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('movejx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_movejx(_pos, _vel, _acc, _time, _radius, _ref, mod, ra, sol, _async)
print_ext_result("{0} = PythonMgr.py_movejx(pos:{1}, vel:{2}, acc:{3}, time:{4}, radius:{5}, ref{6}, mod{7}, ra:{8}, sol:{9}, async:{10})" \
.format(ret, _pos, dr_form(_vel), dr_form(_acc), _time, _radius, _ref, mod, ra, sol, _async))
return ret
def movel(pos, vel=None, acc=None, time=None, radius=None, ref=None, mod=DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None):
ret = _movel(pos, vel, acc, time, radius, ref, mod, ra, v, a, t, r, _async=0)
return ret
def amovel(pos, vel=None, acc=None, time=None, radius=None, ref=None, mod=DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None):
ret = _movel(pos, vel, acc, time, radius, ref, mod, ra, v, a, t, r, _async=1)
return ret
def _movel(pos, vel=None, acc=None, time=None, radius=None, ref=None, mod=DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None, _async=0):
# _pos
_pos = get_normal_pos(pos, def_type=posx)
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = _g_velx
else:
if type(temp) == int or type(temp) == float:
#_vel = [temp] * DR_VELX_DT_LEN
_vel = [0] * DR_VELX_DT_LEN
_vel[0] = temp
_vel[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_VELX_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
#print("_vel[0]={0}, _vel[1]={1}".format(_vel[0],_vel[1]))
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = _g_accx
else:
if type(temp) == int or type(temp) == float:
#_acc = [temp] * DR_ACCX_DT_LEN
_acc = [0] * DR_ACCX_DT_LEN
_acc[0] = temp
_acc[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_ACCX_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
#print("_acc[0]={0}, _acc[1]={1}".format(_acc[0],_acc[1]))
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_task(_vel, _acc, _time)
# _radius
_radius = get_param(radius, r)
if _radius == None:
global _g_blend_state
if _g_blend_state == True:
_radius = _g_blend_radius
else:
_radius = 0.0
if type(_radius) != int and type(_radius) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : radius, r")
if _radius < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : radius, r")
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# ra
if type(ra) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ra")
if ra != DR_MV_RA_OVERRIDE and ra != DR_MV_RA_DUPLICATE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ra")
# qcommand
if type(_pos) == posx:
qcommand = 0
else:
qcommand = 1
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
req = MoveLine.Request()
req.pos = [float(x) for x in _pos]
req.vel = [float(x) for x in _vel]
req.acc = [float(x) for x in _acc]
req.time = float(_time)
req.radius = float(_radius)
req.ref = int(_ref)
req.mode = int(mod)
req.blend_type = int(ra)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = _ros2_movel.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('movel Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_movel(_pos, _vel, _acc, _time, _radius, _ref, mod, ra, qcommand, _async)
print_ext_result("{0} = PythonMgr.py_movel(pos:{1}, vel:{2}, acc:{3}, time:{4}, radius:{5}, ref:{6}, mod:{7}, ra:{8}, qcommand:{9}, async:{10})" \
.format(ret, _pos, dr_form(_vel), dr_form(_acc), _time, _radius, _ref, mod, ra, qcommand, _async))
return ret
def movec(pos1, pos2, vel=None, acc=None, time=None, radius=None, ref=None, mod= DR_MV_MOD_ABS, angle=None, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None, an=None):
ret = _movec(pos1, pos2, vel, acc, time, radius, ref, mod, angle, ra, v, a, t, r, an, _async=0)
return ret
def amovec(pos1, pos2, vel=None, acc=None, time=None, radius=None, ref=None, mod= DR_MV_MOD_ABS, angle=None, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None, an=None):
ret = _movec(pos1, pos2, vel, acc, time, radius, ref, mod, angle, ra, v, a, t, r, an, _async=1)
return ret
def _movec(pos1, pos2, vel=None, acc=None, time=None, radius=None, ref=None, mod= DR_MV_MOD_ABS, angle=None, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None, an=None, _async=0):
# _pos1, _pos2
_pos1 = get_normal_pos(pos1, def_type=posx)
_pos2 = get_normal_pos(pos2, def_type=posx)
if type(_pos1) != type(_pos2):
raise DR_Error(DR_ERROR_TYPE, "Invalid type : pos1, ps2")
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = _g_velx
else:
if type(temp) == int or type(temp) == float:
#_vel = [temp] * DR_VELX_DT_LEN #<����> ���� �� �ΰ� ����
_vel = [0] * DR_VELX_DT_LEN #<����> _vel[0]=temp, _vel[1]= DR_COND_NONE
_vel[0] = temp
_vel[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_VELX_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = _g_accx
else:
if type(temp) == int or type(temp) == float:
#_acc = [temp] * DR_ACCX_DT_LEN #<����> ���� �� �ΰ� ����
_acc = [0] * DR_ACCX_DT_LEN #<����> _acc[0]=temp, _acc[1]= DR_COND_NONE
_acc[0] = temp
_acc[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_ACCX_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_task(_vel, _acc, _time)
# _radius
_radius = get_param(radius, r)
if _radius == None:
global _g_blend_state
if _g_blend_state == True:
_radius = _g_blend_radius
else:
_radius = 0.0
if type(_radius) != int and type(_radius) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : radius, r")
if _radius < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : radius, r")
# _ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# _angle
temp = get_param(angle, an)
if temp == None:
_angle = [0, 0]
else:
if type(temp) == int or type(temp) == float:
_angle = [temp, 0]
elif type(temp) == list and len(temp) == DR_ANGLE_DT_LEN:
_angle = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : angle, an")
if is_number(_angle) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : angle, an")
for item in _angle:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : angle, an")
# ra
if type(ra) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ra")
if ra != DR_MV_RA_OVERRIDE and ra != DR_MV_RA_DUPLICATE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ra")
# qcommand
if type(_pos1) == posx:
qcommand = 0
else:
qcommand = 1
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
# make multi pos
_circle_pos = _ros_listToFloat64MultiArray([_pos1, _pos2])
#_circle_pos = _ros_listToFloat64MultiArray([ [float(x) for x in _pos1], [float(x) for x in _pos2] ])
#print(_circle_pos)
#srv = _ros_movec(_circle_pos, _vel, _acc, _time, mod, _ref, _angle[0], _angle[1], _radius, ra, _async)
req = MoveCircle.Request()
req.pos = _circle_pos #??? 검증필요!
req.vel = [float(x) for x in _vel]
req.acc = [float(x) for x in _acc]
req.time = float(_time)
req.radius = float(_radius)
req.ref = int(_ref)
req.mode = int(mod)
req.angle1 = float(_angle[0])
req.angle2 = float(_angle[1])
req.blend_type = int(ra)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = _ros2_movec.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('movec Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_movec(_pos1, _pos2, _vel, _acc, _time, _radius, _ref, mod, _angle, ra, qcommand, _async)
print_ext_result("{0} = PythonMgr.py_movec(pos1:{1}, pos2:{2}, vel:{3}, acc:{4}, time:{5}, radius:{6}, ref:{7}, mod:{8}, angle:{9}, ra:{10}, qcommand:{11}, async:{12})" \
.format(ret, _pos1, _pos2, dr_form(_vel), dr_form(_acc), _time, _radius, _ref, mod, dr_form(_angle), ra, qcommand, _async))
return ret
def movesj(pos_list, vel=None, acc=None, time=None, mod= DR_MV_MOD_ABS, v=None, a=None, t=None):
ret = _movesj(pos_list, vel, acc, time, mod, v, a, t, _async=0)
return ret
def amovesj(pos_list, vel=None, acc=None, time=None, mod= DR_MV_MOD_ABS, v=None, a=None, t=None):
ret = _movesj(pos_list, vel, acc, time, mod, v, a, t, _async=1)
return ret
def _movesj(pos_list, vel=None, acc=None, time=None, mod= DR_MV_MOD_ABS, v=None, a=None, t=None, _async=0):
# pos_list
if type(pos_list) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : pos_list")
for item in pos_list:
if type(item) != posj:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : pos_list [item]")
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = _g_velj
else:
if type(temp) == int or type(temp) == float:
_vel = [temp] * DR_VELJ_DT_LEN
elif type(temp) == list and len(temp) == DR_VELJ_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = _g_accj
else:
if type(temp) == int or type(temp) == float:
_acc = [temp] * DR_ACCJ_DT_LEN
elif type(temp) == list and len(temp) == DR_ACCJ_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_joint(_vel, _acc, _time)
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
# make multi pos
_spline_posj = _ros_listToFloat64MultiArray(pos_list)
#srv = _ros_movesj(_spline_posj, len(_spline_posj), _vel, _acc, _time, mod, _async)
req = MoveSplineJoint.Request()
req.pos = _spline_posj #??? 검증필요!
req.pos_cnt = len(_spline_posj)
req.vel = [float(x) for x in _vel]
req.acc = [float(x) for x in _acc]
req.time = float(_time)
req.mode = int(mod)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = _ros2_movesj.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('movesj Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_movesj(pos_list, _vel, _acc, _time, mod, _async)
print_ext_result("{0} = PythonMgr.py_movesj(pos_list:{1}, vel:{2}, acc:{3}, time:{4}, mod:{5} async:{6})" \
.format(ret, dr_form(pos_list), dr_form(_vel), dr_form(_acc), _time, mod, _async))
return ret
def movesx(pos_list, vel=None, acc=None, time=None, ref=None, mod= DR_MV_MOD_ABS, vel_opt=DR_MVS_VEL_NONE, v=None, a=None, t=None):
ret = _movesx(pos_list, vel, acc, time, ref, mod, vel_opt, v, a, t, _async=0)
return ret
def amovesx(pos_list, vel=None, acc=None, time=None, ref=None, mod= DR_MV_MOD_ABS, vel_opt=DR_MVS_VEL_NONE, v=None, a=None, t=None):
ret = _movesx(pos_list, vel, acc, time, ref, mod, vel_opt, v, a, t, _async=1)
return ret
def _movesx(pos_list, vel=None, acc=None, time=None, ref=None, mod= DR_MV_MOD_ABS, vel_opt=DR_MVS_VEL_NONE, v=None, a=None, t=None, _async=0):
# pos_list
if type(pos_list) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : pos_list")
for item in pos_list:
if type(item) != posx:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : pos_list [item]")
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = _g_velx
else:
if type(temp) == int or type(temp) == float:
#_vel = [temp] * DR_VELX_DT_LEN #<����> ���� �� �ΰ� ����
_vel = [0] * DR_VELX_DT_LEN #<����> _vel[0]=temp, _vel[1]= DR_COND_NONE
_vel[0] = temp
_vel[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_VELX_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = _g_accx
else:
if type(temp) == int or type(temp) == float:
#_acc = [temp] * DR_ACCX_DT_LEN #<����> ���� �� �ΰ� ����
_acc = [0] * DR_ACCX_DT_LEN #<����> _acc[0]=temp, _acc[1]= DR_COND_NONE
_acc[0] = temp
_acc[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_ACCX_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_task(_vel, _acc, _time)
# _ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# vel_opt
if type(vel_opt) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel_opt")
if vel_opt != DR_MVS_VEL_NONE and vel_opt != DR_MVS_VEL_CONST:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel_opt")
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
# make multi pos
_spline_posx = _ros_listToFloat64MultiArray(pos_list)
#srv = _ros_movesx(_spline_posx, len(_spline_posx), _vel, _acc, _time, mod, _ref, vel_opt, _async)
req = MoveSplineTask.Request()
req.pos = _spline_posx #??? 검증필요!
req.pos_cnt = len(_spline_posx)
req.vel = [float(x) for x in _vel]
req.acc = [float(x) for x in _acc]
req.time = float(_time)
req.ref = int(_ref)
req.mode = int(mod)
req.opt = int(vel_opt)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = _ros2_movesx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('movesx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_movesx(pos_list, _vel, _acc, _time, _ref, mod, vel_opt, _async)
print_ext_result("{0} = PythonMgr.py_movesx(pos_list:{1}, vel:{2}, acc:{3}, time:{4}, ref:{5}, mod:{6}, vel_opt:{7}, async:{8})" \
.format(ret, dr_form(pos_list), dr_form(_vel), dr_form(_acc), _time, _ref, mod, vel_opt, _async))
return ret
def moveb(seg_list, vel=None, acc=None, ref=None, time=None, mod=DR_MV_MOD_ABS, v=None, a=None, t=None):
ret = _moveb(seg_list, vel, acc, ref, time, mod, v, a, t, _async=0)
return ret
def amoveb(seg_list, vel=None, acc=None, ref=None, time=None, mod=DR_MV_MOD_ABS, v=None, a=None, t=None):
ret = _moveb(seg_list, vel, acc, ref, time, mod, v, a, t, _async=1)
return ret
def _moveb(seg_list, vel=None, acc=None, ref=None, time=None, mod=DR_MV_MOD_ABS, v=None, a=None, t=None, _async=0):
# seg_list
if type(seg_list) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : seg_list")
if len(seg_list) == 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : seg_list")
_seg_list = []
if __ROS2__:
for seg in seg_list:
_seg_list.append(seg.to_list())
else:
for seg in seg_list:
if type(seg) != posb:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : seg_list(item)")
else:
_seg_list.append(seg.to_list())
if __ROS2__:
print(len(_seg_list))
_ros_seg_list = []
_tmp_list = []
for s in range(0, len(_seg_list)):
#print(s)
for elemnt in range(0, len(_seg_list[s])):
if _seg_list[s][elemnt] == None:
_seg_list[s][elemnt] = [0.0]*POINT_COUNT
# make [pos1] + [pos2] + [type] + [radius]
_tmp_list = _seg_list[s][1] + _seg_list[s][2] + [_seg_list[s][0]] + [_seg_list[s][3]]
_ros_seg_list.append(_tmp_list)
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = _g_velx
else:
if type(temp) == int or type(temp) == float:
#_vel = [temp] * DR_VELX_DT_LEN #<����> ���� �� �ΰ� ����
_vel = [0] * DR_VELX_DT_LEN #<����> _vel[0]=temp, _vel[1]= DR_COND_NONE
_vel[0] = temp
_vel[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_VELX_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = _g_accx
else:
if type(temp) == int or type(temp) == float:
#_acc = [temp] * DR_ACCX_DT_LEN #<����> ���� �� �ΰ� ����
_acc = [0] * DR_ACCX_DT_LEN #<����> _acc[0]=temp, _acc[1]= DR_COND_NONE
_acc[0] = temp
_acc[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_ACCX_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_task(_vel, _acc, _time)
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# _async
if 1 == _async:
_radius = 0
# ROS Service call
if __ROS2__:
seg = _ros_listToFloat64MultiArray(_ros_seg_list)
#srv = _ros_moveb(seg, len(_ros_seg_list), _vel, _acc, _time, mod, _ref, _async)
req = MoveBlending.Request()
req.segment = seg #??? 검증필요!
req.pos_cnt = len(_ros_seg_list)
req.vel = [float(x) for x in _vel]
req.acc = [float(x) for x in _acc]
req.time = float(_time)
req.ref = int(_ref)
req.mode = int(mod)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = _ros2_moveb.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('moveb Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_moveb(_seg_list, _vel, _acc, _time, _ref, mod, _async)
print_ext_result("{0} = PythonMgr.py_moveb(seg_list:{1}, vel:{2}, acc:{3}, time:{4}, ref:{5}, mod:{6}, async:{7})" \
.format(ret, dr_form(_seg_list), dr_form(_vel), dr_form(_acc), _time, _ref, mod, _async))
return ret
def move_spiral(rev=10, rmax=10, lmax=0, vel=None, acc=None, time=None, axis=DR_AXIS_Z, ref=DR_TOOL, v=None, a=None, t=None):
ret = _move_spiral(rev, rmax, lmax, vel, acc, time, axis, ref, v, a, t, _async=0)
return ret
def amove_spiral(rev=10, rmax=10, lmax=0, vel=None, acc=None, time=None, axis=DR_AXIS_Z, ref=DR_TOOL, v=None, a=None, t=None):
ret = _move_spiral(rev, rmax, lmax, vel, acc, time, axis, ref, v, a, t, _async=1)
return ret
def _move_spiral(rev=10, rmax=10, lmax=0, vel=None, acc=None, time=None, axis=DR_AXIS_Z, ref=DR_TOOL, v=None, a=None, t=None, _async=0):
# rev
if type(rev) != int and type(rev) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : rev")
if rev <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : rev (Ranges: rev > 0)")
# rmax
if type(rmax) != int and type(rmax) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : rmax")
if rmax <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: rmax (Ranges: rmax > 0)")
# lmax
if type(lmax) != int and type(lmax) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : lmax")
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = _g_velx
else:
if type(temp) == int or type(temp) == float:
_vel = [temp] * DR_VELX_DT_LEN
elif type(temp) == list and len(temp) == DR_VELX_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = _g_accx
else:
if type(temp) == int or type(temp) == float:
_acc = [temp] * DR_ACCX_DT_LEN
elif type(temp) == list and len(temp) == DR_ACCX_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_joint(_vel, _acc, _time)
# axis
if type(axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if axis != DR_AXIS_X and axis != DR_AXIS_Y and axis != DR_AXIS_Z:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis")
# ref
if type(ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if ref != DR_BASE and ref != DR_TOOL and (ref < DR_TC_USER_MIN or ref > DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
#srv = _ros_move_spiral(rev, rmax, lmax, _vel, _acc, _time, axis, ref, _async)
req = MoveSpiral.Request()
req.revolution = float(rev)
req.max_radius = float(rmax)
req.max_length = float(lmax)
req.vel = [float(x) for x in _vel]
req.acc = [float(x) for x in _acc]
req.time = float(_time)
req.task_axis = int(axis)
req.ref = int(ref)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = _ros2_move_spiral.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('move_spiral Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_move_spiral(rev, rmax, lmax, _vel, _acc, _time, axis, ref, _async)
print_ext_result("{0} = PythonMgr.py_move_spiral(rev:{1}, rmax:{2}, lmax:{3}, vel:{4}, acc:{5}, time:{6}, axis:{7}, ref:{8}, async:{9})" \
.format(ret, dr_form(rev), dr_form(rmax), dr_form(lmax), dr_form(_vel), dr_form(_acc), _time, axis, ref, _async))
return ret
def move_periodic(amp, period, atime=None, repeat=None, ref=DR_TOOL):
ret = _move_periodic(amp, period, atime, repeat, ref, _async=0)
return ret
def amove_periodic(amp, period, atime=None, repeat=None, ref=DR_TOOL):
ret = _move_periodic(amp, period, atime, repeat, ref, _async=1)
return ret
def _move_periodic(amp, period, atime=None, repeat=None, ref=DR_TOOL, _async=0):
_amp = [POINT_COUNT]
_period = [POINT_COUNT]
_atime =0.0
_repeat =0.0
_ref=0
# amp : float[6]
if type(amp) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : amp")
if len(amp) != POINT_COUNT:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : amp")
_amp =amp
# period : float or float[6]
if (type(period) != int) and (type(period) != float) and (type(period) != list):
raise DR_Error(DR_ERROR_TYPE, "Invalid type : period")
if (type(period) == int) or (type(period) == float):
_period = [period] * POINT_COUNT
else: #list �� ���
if len(period) != POINT_COUNT:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : period")
_period = period
# atime
if atime == None:
_atime = 0.0
else:
if (type(atime) != int) and (type(atime) != float):
raise DR_Error(DR_ERROR_TYPE, "Invalid type : atime")
if atime < 0.0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : atime")
_atime = atime
# repeat
if repeat == None:
_repeat = 1
else:
if (type(repeat) != int) and (type(repeat) != float):
raise DR_Error(DR_ERROR_TYPE, "Invalid type : repeat")
if repeat < 0.0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : repeat")
_repeat = repeat
# ref
if ref == None:
#_ref = _g_coord
_ref = DR_TOOL
else:
if type(ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if ref < DR_BASE or ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
_ref = ref
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
#srv = _ros_move_periodic(_amp, _period, _atime, _repeat, _ref, _async)
req = MovePeriodic.Request()
req.amp = [float(x) for x in _amp]
req.periodic = [float(x) for x in _period]
req.acc = float(_atime)
req.repeat = int(_repeat)
req.ref = int(_ref)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = _ros2_move_periodic.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('move_periodic Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_move_periodic(_amp, _period, _atime, _repeat, _ref, _async)
print_ext_result("{0} = PythonMgr.move_periodic(amp:{1}, period:{2}, atime:{3}, repeat{4}, ref:{5}, async:{6})" \
.format(ret, dr_form(_amp), dr_form(_period), _atime, _repeat, _ref, _async))
return ret
def move_home(target=None):
# target
if target == None:
_target = DR_HOME_TARGET_MECHANIC
else:
_target = target
if __ROS2__:
req = MoveHome.Request()
req.target = _target
future = _ros2_move_home.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('move_home Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def mwait(time=0):
ret = _move_wait(time)
return ret
def _move_wait(time):
if type(time) != int and type(time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time")
if time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time")
# ROS service call
if __ROS2__:
req = MoveWait.Request() #ROS 에서는 time 인자를 사용하지 않음.
future = _ros2_move_wait.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('mwait Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def check_motion():
if __ROS2__:
req = CheckMotion.Request()
future = _ros2_check_motion.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('check_motion Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.status
return ret
def change_operation_speed(speed):
if type(speed) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : speed")
if speed < DR_OP_SPEED_MIN or speed > DR_OP_SPEED_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : speed({0})".format(speed))
if __ROS2__:
req = ChangeOperationSpeed.Request()
req.speed = speed
future = _ros2_change_operation_speed.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('change_operation_speed Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def enable_alter_motion(n, mode, ref=None, limit_dPOS=None, limit_dPOS_per=None):
# n
if type(n) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : n")
if n < 0:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : (n>=0)")
_n = n #*20
# mode
if mode < DR_DPOS or mode > DR_DVEL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mode({0})".format(mode))
_mode = mode
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref != DR_BASE and _ref != DR_TOOL and _ref != DR_WORLD and (_ref < DR_TC_USER_MIN or _ref > DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if(None==limit_dPOS):
_limit_dPOS = [DR_COND_NONE, DR_COND_NONE]
else:
_limit_dPOS = limit_dPOS
if(None==limit_dPOS_per):
_limit_dPOS_per = [DR_COND_NONE, DR_COND_NONE]
else:
_limit_dPOS_per = limit_dPOS_per
if __ROS2__:
req = EnableAlterMotion.Request()
req.n = _n
req.mode = _mode
req.ref = _ref
req.limit_dpos = [float(x) for x in _limit_dPOS]
req.limit_dpos_per = [float(x) for x in _limit_dPOS_per]
future = _ros2_enable_alter_motion.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('enable_alter_motion Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def alter_motion(dposx):
# _dposx
if (type(dposx) == posx):
raise DR_Error(DR_ERROR_TYPE, "Invalid type : dposx")
_dposx = get_normal_pos(dposx, def_type=posx)
if __ROS2__:
req = AlterMotion.Request()
req.pos = [float(x) for x in _dposx]
future = _ros2_alter_motion.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('alter_motion Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def disable_alter_motion():
if __ROS2__:
req = DisableAlterMotion.Request()
future = _ros2_disable_alter_motion.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('disable_alter_motion Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_singular_handling(mode = DR_AVOID):
if type(mode) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mode")
if mode < DR_AVOID or mode > DR_VAR_VEL: #DR_TASK_STOP
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mode({0})".format(mode))
if __ROS2__:
req = SetSingularityHandling.Request()
req.mode = mode
future = _ros2_set_singularity_handling.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_singular_handling Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_singularity_handling(mode = DR_AVOID):
ret = set_singular_handling(mode)
return ret
def jog(jog_axis, ref=0, speed=0):
if type(jog_axis) != int and type(jog_axis) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : jog_axis")
if type(ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if type(speed) != int and type(speed) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : speed")
# ROS service call
if __ROS2__:
req = Jog.Request()
req.jog_axis = jog_axis
req.move_reference = ref
req.speed = float(speed)
future = _ros2_jog.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('jog Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def jog_multi(jog_axis_list, ref=0, speed=0):
if type(jog_axis_list) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : jog_axis_list")
if type(ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if type(speed) != int and type(speed) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : speed")
# ROS service call
if __ROS2__:
req = JogMulti.Request()
req.jog_axis = [float(x) for x in jog_axis_list]
req.move_reference = ref
req.speed = float(speed)
future = _ros2_jog_multi.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('jog_multi Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
##### force/stiffness Control #########################################################################################################################
def get_workpiece_weight():
print("================================> get_workpiece_weight()")
if __ROS2__:
req = GetWorkpieceWeight.Request()
future = _ros2_get_workpiece_weight.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_workpiece_weight Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.weight
return ret
def reset_workpiece_weight():
if __ROS2__:
req = ResetWorkpieceWeight.Request()
future = _ros2_reset_workpiece_weight.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('reset_workpiece_weight Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def parallel_axis(*args, **kargs):
len_args = len(args)
len_kargs = len(kargs)
_nType = 0
# check kargs.key
for key in kargs.keys():
if key != "x1" and key != "x2" and key != "x3" and key != "vect" and key != "axis" and key != "ref":
raise DR_Error(DR_ERROR_TYPE, "Invalid type : x1, x2, x3, vect, axis, ref")
# get kargs
_x1 = get_kargs(kargs, "x1")
_x2 = get_kargs(kargs, "x2")
_x3 = get_kargs(kargs, "x3")
_vect = get_kargs(kargs, "vect")
_axis = get_kargs(kargs, "axis")
_ref = get_kargs(kargs, "ref")
# check parameter combination
if len_args == 0:
if len_kargs == 2:
if _vect == None or _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_kargs == 3:
_nType = 3
if _vect == None or _axis == None or _ref == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_kargs == 4:
if _x1 == None or _x2 == None or _x3 == None or _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_kargs == 5:
_nType = 2
if _x1 == None or _x2 == None or _x3 == None or _axis == None or _ref == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 1:
if len_kargs != 1:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_vect = args[0]
if _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 2:
if len_kargs == 1: # +ref
_nType = 3
_vect = args[0]
_axis = args[1]
else:
if len_kargs != 0:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_vect = args[0]
_axis = args[1]
elif len_args == 3:
if len_kargs == 0: # +ref
_nType = 3
_vect = args[0]
_axis = args[1]
_ref = args[2]
else:
if len_kargs != 1:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
if _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 4:
if len_kargs == 1: # + ref
_nType = 2
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_axis = args[3]
else:
if len_kargs != 0:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_axis = args[3]
elif len_args == 5:
if len_kargs == 0: # + ref
_nType = 2
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_axis = args[3]
_ref = args[4]
else:
if len_kargs != 0:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_axis = args[3]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
# check parameter type, value
if _x1 != None:
_x1 = get_posx(_x1)
_x2 = get_posx(_x2)
_x3 = get_posx(_x3)
else:
if type(_vect) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vect")
if len(_vect) != DR_VECTOR_DT_LEN:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vect({0})".format(_vect))
if type(_axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if _axis != DR_AXIS_X and _axis != DR_AXIS_Y and _axis != DR_AXIS_Z:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(_axis))
if _nType == 2: # with ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = ParallelAxis1.Request()
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.axis = _axis
req.ref = _ref
future = _ros2_parallel_axis1.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('parallel_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
elif _nType == 3: # with ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = ParallelAxis2.Request()
req.vect = [float(x) for x in _vect]
req.axis = _axis
req.ref = _ref
future = _ros2_parallel_axis2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('parallel_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else: # 기존
_ref = DR_BASE
if _x1 != None:
if __ROS2__:
req = ParallelAxis1.Request()
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.axis = _axis
req.ref = _ref
future = _ros2_parallel_axis1.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('parallel_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
if __ROS2__:
req = ParallelAxis2.Request()
req._vect = vect
req._axis = axis
req.ref = _ref
future = _ros2_parallel_axis2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('parallel_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def align_axis(*args, **kargs):
len_args = len(args)
len_kargs = len(kargs)
_nType = 0
# check kargs.key
for key in kargs.keys():
if key != "x1" and key != "x2" and key != "x3" and key != "vect" and key != "pos" and key != "axis" and key != "ref":
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
# get kargs
_x1 = get_kargs(kargs, "x1")
_x2 = get_kargs(kargs, "x2")
_x3 = get_kargs(kargs, "x3")
_vect = get_kargs(kargs, "vect")
_pos = get_kargs(kargs, "pos")
_axis = get_kargs(kargs, "axis")
_ref = get_kargs(kargs, "ref")
# check parameter combination
if len_args == 0:
if len_kargs == 3:
if _vect == None or _pos == None or _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_kargs == 5:
if _x1 == None or _x2 == None or _x3 == None or _pos == None or _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_kargs == 6:
_nType = 2
if _x1 == None or _x2 == None or _x3 == None or _pos == None or _axis == None or _ref == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_kargs == 4:
_nType = 3
if _vect == None or _pos == None or _axis == None or _ref == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 1:
if len_kargs != 2:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_vect = args[0]
if _pos == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
if _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 2:
if len_kargs != 1:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_vect = args[0]
_pos = args[1]
if _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 3:
if len_kargs == 0:
_vect = args[0]
_pos = args[1]
_axis = args[2]
elif len_kargs == 1:
_nType = 3
_vect = args[0]
_pos = args[1]
_axis = args[2]
elif len_kargs == 2:
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
if _pos == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
if _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 4:
if len_kargs == 0:
_nType = 3
_vect = args[0]
_pos = args[1]
_axis = args[2]
_ref = args[3]
else:
if len_kargs != 1:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos = args[3]
if _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 5:
if len_kargs == 0:
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos = args[3]
_axis = args[4]
elif len_kargs == 1: # + ref
_nType = 2
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos = args[3]
_axis = args[4]
elif len_args == 6:
if len_kargs != 0:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 2
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos = args[3]
_axis = args[4]
_ref = args[5]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
# check parameter type, value
if _x1 != None:
_x1 = get_posx(_x1)
_x2 = get_posx(_x2)
_x3 = get_posx(_x3)
else:
if type(_vect) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vect")
if len(_vect) != DR_VECTOR_DT_LEN:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vect({0})".format(_vect))
norm_pos = get_posx(_pos)
if type(_axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if _axis != DR_AXIS_X and _axis != DR_AXIS_Y and _axis != DR_AXIS_Z:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(_axis))
if _nType == 2: # with ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = AlignAxis1.Request()
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.pos = [float(x) for x in norm_pos]
req.axis = _axis
req.ref = _ref
future = _ros2_align_axis1.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('align_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
elif _nType == 3: # with ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = AlignAxis2.Request()
req.vect = [float(x) for x in _vect]
req.pos = [float(x) for x in norm_pos]
req.axis = _axis
req.ref = _ref
future = _ros2_align_axis2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('align_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else: # 기존
_ref = DR_BASE
if _x1 != None:
if __ROS2__:
req = AlignAxis1.Request()
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.pos = [float(x) for x in norm_pos]
req.axis = _axis
req.ref = _ref
future = _ros2_align_axis1.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('align_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
if __ROS2__:
req = AlignAxis2.Request()
req.vect = [float(x) for x in _vect]
req.pos = [float(x) for x in norm_pos]
req.axis = _axis
req.ref = _ref
future = _ros2_align_axis2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('align_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def is_done_bolt_tightening(m=0, timeout=0, axis=None):
# m
if type(m) != int and type(m) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : m")
# timeout
if type(timeout) != int and type(timeout) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : timeout")
if timeout < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : timeout({0})".format(timeout))
# axis
if type(axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if axis != DR_AXIS_X and axis != DR_AXIS_Y and axis != DR_AXIS_Z:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(axis))
if __ROS2__:
req = IsDoneBoltTightening.Request()
req.m = float(m)
req.timeout = float(timeout)
req.axis = axis
future = _ros2_is_done_bolt_tightening.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('is_done_bolt_tightening Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def release_compliance_ctrl():
if __ROS2__:
req = ReleaseComplianceCtrl.Request()
future = _ros2_release_compliance_ctrl.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('release_compliance_ctrl Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def task_compliance_ctrl(stx=[3000, 3000, 3000, 200, 200, 200], time=0):
# st
if type(stx) != list or len(stx) != 6:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : stx")
if is_number(stx) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : stx({0})".format(stx))
# _ref
_ref = _g_coord
# time
if type(time) != int and type(time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time")
if time != -1 and time < 0: # -1 : motion default
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time({0})".format(time))
if time > 1:
_time = 1
else:
_time = time
if __ROS2__:
req = TaskComplianceCtrl.Request()
req.stx = [float(x) for x in stx]
req.ref = _ref
req.time = float(_time)
future = _ros2_task_compliance_ctrl.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('task_compliance_ctrl Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_stiffnessx(stx=[500, 500, 500, 100, 100, 100], time=0):
# st
if type(stx) != list or len(stx) != 6:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : stx")
if is_number(stx) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : stx({0})".format(stx))
# _ref
_ref = _g_coord
# time
if type(time) != int and type(time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time")
if time != -1 and time < 0: # -1 : motion default
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time({0})".format(time))
if time > 1:
_time = 1
else:
_time = time
if __ROS2__:
req = SetStiffnessx.Request()
req.stx = [float(x) for x in stx]
req.ref = _ref
req.time = float(_time)
future = _ros2_set_stiffnessx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_stiffnessx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def calc_coord(*args, **kargs):
#arg(x1, ref, mod) arg =0 , kargs =3 _nType=1
#arg(x1, x2, ref, mod) arg =0 , kargs =4 _nType=2
#arg(x1, x2, x3, ref, mod) arg =0 , kargs =5 _nType=3
#arg(x1, x2, x3, x4, ref, mod) arg =0 , kargs =6 _nType=4
#arg(?, ref, mod) arg =1 , kargs =2 _nType=1
#arg(?, ?, ref, mod) arg =2 , kargs =2 _nType=2
#arg(?, ?, ?, ref, mod) arg =3 , kargs =2 _nType=3
#arg(?, ?, ?, ?, ref, mod) arg =4 , kargs =2 _nType=4
#arg(?, ?, ?) arg =3 , kargs =0 _nType=1
#arg(?, ?, ?, ?) arg =4 , kargs =0 _nType=2
#arg(?, ?, ?, ?, ?) arg =5 , kargs =0 _nType=3
#arg(?, ?, ?, ?, ?, ?) arg =6 , kargs =0 _nType=4
len_args = len(args)
len_kargs = len(kargs)
_cnt_pos = 0
# check kargs.key
for key in kargs.keys():
if key != "x1" and key != "x2" and key != "x3" and key != "x4" and key != "ref" and key != "mod":
raise DR_Error(DR_ERROR_TYPE, "Invalid type : x1, x2, x3, x4, ref, mod")
# get kargs
_x1 = get_kargs(kargs, "x1")
_x2 = get_kargs(kargs, "x2")
_x3 = get_kargs(kargs, "x3")
_x4 = get_kargs(kargs, "x4")
_ref = get_kargs(kargs, "ref")
_mod = get_kargs(kargs, "mod")
if(_x1 == None):
_x1 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
if(_x2 == None):
_x2 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
if(_x3 == None):
_x3 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
if(_x4 == None):
_x4 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
if len_args == 0 and len_kargs ==3:
_cnt_pos = 1
print("x1={}, ref={}, mod={}".format(_x1, _ref, _mod))
elif len_args == 0 and len_kargs ==4:
_cnt_pos = 2
print("x1={}, x2={}, ref={}, mod={}".format(_x1, _x2, _ref, _mod))
elif len_args == 0 and len_kargs ==5:
_cnt_pos = 3
print("x1={}, x2={}, x3={}, ref={}, mod={}".format(_x1, _x2, _x3, _ref, _mod))
elif len_args == 0 and len_kargs ==6:
_cnt_pos = 4
print("x1={}, x2={}, x3={}, x4={}, ref={}, mod={}".format(_x1, _x2, _x3, _x4, _ref, _mod))
elif len_args == 1 and len_kargs ==2:
_cnt_pos = 1
_x1 = args[0]
print("x1={}, ref={}, mod={}".format(_x1, _ref, _mod))
elif len_args == 2 and len_kargs ==2:
_cnt_pos = 2
_x1 = args[0]
_x2 = args[1]
print("x1={}, x2={}, ref={}, mod={}".format(_x1, _x2, _ref, _mod))
elif len_args == 3 and len_kargs ==2:
_cnt_pos = 3
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
print("x1={}, x2={}, x3={}, ref={}, mod={}".format(_x1, _x2, _x3, _ref, _mod))
elif len_args == 4 and len_kargs ==2:
_cnt_pos = 4
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_x4 = args[3]
print("x1={}, x2={}, x3={}, x4={}, ref={}, mod={}".format(_x1, _x2, _x3, _x4, _ref, _mod))
elif len_args == 3 and len_kargs ==0:
_cnt_pos = 1
_x1 = args[0]
_ref =args[1]
_mod =args[2]
print("x1={}, ref={}, mod={}".format(_x1, _ref, _mod))
elif len_args == 4 and len_kargs ==0:
_cnt_pos = 2
_x1 = args[0]
_x2 = args[1]
_ref =args[2]
_mod =args[3]
print("x1={}, x2={}, ref={}, mod={}".format(_x1, _x2, _ref, _mod))
elif len_args == 5 and len_kargs ==0:
_cnt_pos = 3
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_ref =args[3]
_mod =args[4]
print("x1={}, x2={}, x3={}, ref={}, mod={}".format(_x1, _x2, _x3, _ref, _mod))
elif len_args == 6 and len_kargs ==0:
_cnt_pos = 4
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_x4 = args[3]
_ref =args[4]
_mod =args[5]
print("x1={}, x2={}, x3={}, x4={}, ref={}, mod={}".format(_x1, _x2, _x3, _x4, _ref, _mod))
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid arguments")
print("FINAL : x1={}, x2={}, x3={}, x4={}, ref={}, mod={}".format(_x1, _x2, _x3, _x4, _ref, _mod))
# check parameter type, value
if _x1 != None:
_x1 = get_posx(_x1)
if _x2 != None:
_x2 = get_posx(_x2)
if _x3 != None:
_x3 = get_posx(_x3)
if _x4 != None:
_x4 = get_posx(_x4)
if _ref !=None:
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if _mod != None:
if _mod != 0 and _mod != 1:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod({0})".format(_mod))
if __ROS2__:
req = CalcCoord.Request()
req.input_pos_cnt = _cnt_pos
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.x4 = [float(x) for x in _x4]
req.ref = _ref
req.mod = _mod
future = _ros2_calc_coord.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('calc_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
pos = list(result.conv_posx) # Convert tuple to list
conv_posx = posx(pos)
ret = pos
return ret
def set_user_cart_coord(*args, **kargs):
len_args = len(args)
len_kargs = len(kargs)
_nType =0
# check kargs.key
for key in kargs.keys():
if key != "x1" and key != "x2" and key != "x3" and key != "pos" and key != "u1" and key != "v1" and key != "v1" and key != "ref":
raise DR_Error(DR_ERROR_TYPE, "Invalid type : x1, x2, x3, pos, u1, v1, ref")
# get kargs
_x1 = get_kargs(kargs, "x1")
_x2 = get_kargs(kargs, "x2")
_x3 = get_kargs(kargs, "x3")
_pos= get_kargs(kargs, "pos")
_u1 = get_kargs(kargs, "u1")
_v1 = get_kargs(kargs, "v1")
_ref = get_kargs(kargs, "ref")
# check parameter combination
#set_user_cart_coord(x1=?, x2=?, x3=?, pos=?) arg =0 , kargs =4 _nType=0
#set_user_cart_coord(u1=?, v1=?, pos=?) arg =0 , kargs =3 * _nType=1
#set_user_cart_coord(x1=?, x2=?, x3=?) arg =0 , kargs =3 * _nType=2
#set_user_cart_coord(x1=?, x2=?, x3=?, ?) arg =1 , kargs =3 _nType=0
#set_user_cart_coord(u1=?, v1=?, ?) arg =1 , kargs =2 _nType=1
#set_user_cart_coord(?, ?, pos=?) arg =2 , kargs =1 _nType=1
#set_user_cart_coord(?, ?, ?, pos=?) arg =3 , kargs =1 _nType=0
#set_user_cart_coord(?, ?, ?) arg =3 , kargs =0 * _nType=1
#set_user_cart_coord(?, ?, ?) arg =3 , kargs =0 * _nType=2
#set_user_cart_coord(?, ?, ?, ?) arg =4 , kargs =0 _nType=0
#----- 신규 추가 명령 2019/11/27 ----------------------------------------------------------------------------------------------------------------
#set_user_cart_coord(pos=?, ref=?) arg =0 , kargs =2 _nType=5
#set_user_cart_coord(pos=?, ?) arg =1 , kargs =1 * _nType=5 #python syntax error : positional argument follows keyword argument
#set_user_cart_coord(?, ref=?) arg =1 , kargs =1 * _nType=5
#set_user_cart_coord(?, ?) arg =2 , kargs =0 _nType=5
#------------------------------------------------------------------------------------------------------------------------------------------------
if len_args == 0 and len_kargs ==2:
print("new commnad len_args == 0 and len_kargs ==2")
#_pos
#_ref
print("_pos={},_ref={}".format(_pos, _ref))
_nType = 5
elif len_args == 1 and len_kargs ==1:
print("new commnad len_args == 1 and len_kargs ==1")
_pos = args[0]
#_ref
print("_pos={},_ref={}".format(_pos, _ref))
_nType = 5
elif len_args == 2 and len_kargs ==0:
print("new commnad len_args == 2 and len_kargs ==0")
_pos = args[0]
_ref = args[1]
print("_pos={},_ref={}".format(_pos, _ref))
_nType = 5
else:
if len_args == 0:
if len_kargs == 5:
if _x1 == None or _x2 == None or _x3 == None or _pos == None or _ref == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 3
elif len_kargs == 4:
if _ref != None:
_nType = 4
else:
if _x1 == None or _x2 == None or _x3 == None or _pos == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 0
elif len_kargs == 3:
if _u1 != None:
if _v1 == None or _pos == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 1
elif _x1 != None:
if _x2 == None or _x3 == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 2
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 1:
if len_kargs == 3:
if _x1 == None or _x2 == None or _x3 == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 0
_pos= args[0]
elif len_kargs == 2:
if _u1 == None or _v1 == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 1
_pos= args[0]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 2:
if len_kargs == 1:
if _pos != None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
_nType = 1
_u1 = args[0]
_v1 = args[1]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 3:
if len_kargs == 1:
if _ref != None:
_nType = 4
_u1 = args[0]
_v1 = args[1]
_pos = args[2]
else:
if _pos != None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
_nType = 0
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
elif len_kargs == 0:
if len(args[0]) == 3:
_nType = 1
_u1 = args[0]
_v1 = args[1]
_pos= args[2]
elif len(args[0]) == 6:
_nType = 2
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 4:
if len_kargs == 0:
_nType = 0
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos= args[3]
elif len_kargs == 1:
_nType = 3
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos= args[3]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 5:
if len_kargs == 0:
_nType = 0
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos= args[3]
_ref= args[4]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
# check parameter type, value
if _x1 != None:
_x1 = get_posx(_x1)
if _x2 != None:
_x2 = get_posx(_x2)
if _x3 != None:
_x3 = get_posx(_x3)
if _pos != None:
_pos = get_posx(_pos)
if _u1 !=None:
if type(_u1) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : u1")
if len(_u1) != DR_VECTOR_U1_LEN:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : u1({0})".format(_u1))
if _v1 !=None:
if type(_v1) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : v1")
if len(_v1) != DR_VECTOR_V1_LEN:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : v1({0})".format(_v1))
if _nType == 0:
_ref = DR_BASE
if __ROS2__:
req = SetUserCartCoord2.Request()
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = _ros2_set_user_cart_coord2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.id
elif _nType == 1:
_ref = DR_BASE
if __ROS2__:
req = SetUserCartCoord3.Request()
req.u1 = [float(x) for x in _u1]
req.v1 = [float(x) for x in _v1]
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = _ros2_set_user_cart_coord3.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.id
elif _nType == 2: #현재 미사용
#_ref = DR_BASE
#if __:
# req = set_user_cart_coord?(_x1, _x2, _x3, _ref)
# ret = srv.id
#else:
# ret = PythonMgr.py_set_user_cart_coord_ex2(_x1, _x2, _x3, _ref)
# #print_ext_result("{0} = PythonMgr.py_set_user_cart_coord_ex2(x1:{1}, x2:{2}, x3:{3}, ref:{4})".format(ret, _x1, _x2, _x3, _ref))
pass
elif _nType == 3: # with ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = SetUserCartCoord2.Request()
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = _ros2_set_user_cart_coord2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.id
elif _nType == 4: # with ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = SetUserCartCoord3.Request()
req.u1 = [float(x) for x in _u1]
req.v1 = [float(x) for x in _v1]
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = _ros2_set_user_cart_coord3.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.id
elif _nType == 5: # (pos, ref) 20191127 신규 추가
#print("new command !!!!!!!!!!!!!!!!")
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = SetUserCartCoord1.Request()
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = _ros2_set_user_cart_coord1.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.id
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
return ret
def overwrite_user_cart_coord(id, pos, ref=None, gol=None):
# id
_id = id
# pos
_pos = get_posx(pos)
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# gol : #1 RCT 요청에 의하여 gol 무조건 0으로 변경 2019/12/09
#if gol == None:
# _gol = 0
#else:
# _gol = gol
# if _gol != 0 and _gol != 1:
# raise DR_Error(DR_ERROR_VALUE, "Invalid value : gol")
_gol = 0
if __ROS2__:
#req = overwrite_user_cart_coord(_id, _pos, _ref, _gol)
req = OverwriteUserCartCoord.Request()
req.id = _id
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = _ros2_overwrite_user_cart_coord.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('overwrite_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.id
return ret
def get_user_cart_coord(id):
print("==============================> get_user_cart_coord(id)")
if __ROS2__:
req = GetUserCartCoord.Request()
req.id = id
future = _ros2_get_user_cart_coord.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1, -1
else:
pos = list(result.conv_posx) # Convert tuple to list
ref = result.ref
conv_posx = posx(pos)
print("==============================> get_user_cart_coord(id) 555 conv_posx={}, ref={}".format(conv_posx, ref))
return conv_posx, ref
return 0
def set_desired_force(fd=[0, 0, 0, 0, 0, 0], dir=[0, 0, 0, 0, 0, 0], time=0, mod=DR_FC_MOD_ABS):
# df
if type(fd) != list or len(fd) != 6:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : fd")
if is_number(fd) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : fd({0})".format(fd))
# dir
if type(dir) != list or len(dir) != 6:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : dir")
if is_number(dir) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : dir({0})".format(dir))
# _ref
_ref = _g_coord
# time
if type(time) != int and type(time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time")
if time != -1 and time < 0: # -1 : motion default
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time({0})".format(time))
if time > 1:
_time = 1
else:
_time = time
# _mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
_mod = mod
if __ROS2__:
req = SetDesiredForce.Request()
req.fd = [float(x) for x in fd]
req.dir = dir
req.ref = _ref
req.time = float(_time)
req.mod = _mod
future = _ros2_set_desired_force.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_desired_force Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def release_force(time=0):
if type(time) != int and type(time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time")
if time != -1 and time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time({0})".format(time))
if time > 1:
_time = 1
else:
_time = time
if __ROS2__:
req = ReleaseForce.Request()
req.time = float(_time)
future = _ros2_release_force.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('release_force Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
#def check_position_condition(axis, min=DR_COND_NONE, max=DR_COND_NONE, ref=None):
def check_position_condition(axis, min=DR_COND_NONE, max=DR_COND_NONE, ref=None, mod= DR_MV_MOD_ABS, pos=None):
# axis
if type(axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if (axis != DR_AXIS_X and axis != DR_AXIS_Y and axis != DR_AXIS_Z):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(axis))
# min
if type(min) != int and type(min) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : min")
# max
if type(max) != int and type(max) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : max")
if min == DR_COND_NONE and max == DR_COND_NONE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min({0}), max({1})".format(min,max))
# min < max check
if min != DR_COND_NONE and max != DR_COND_NONE: #min, max 값이 둘다 설정된 경우에만 검사 실시 2017/08/23
if min > max:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min({0}), max({1})".format(min,max))
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod({0})".format(mod))
# _pos : DR_MV_MOD_REL 인 경우에는 반드시 pos 가 필요하고, otherwise 불필요
if(mod == DR_MV_MOD_REL):
if(pos==None):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : need to pos")
else:
_pos = get_normal_pos(pos, def_type=posx)
else:
if(pos!=None):
_pos = get_normal_pos(pos, def_type=posx)
else:
pos=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
_pos = get_normal_pos(pos, def_type=posx)
# check axis
if (axis == DR_AXIS_A or axis == DR_AXIS_B or axis == DR_AXIS_C):
_ref = DR_TOOL
if __ROS2__:
req = CheckPositionCondition.Request()
req.axis = axis
req.min = float(min)
req.max = float(max)
req.ref = _ref
req.mode = mod
req.pos = [float(x) for x in _pos]
future = _ros2_check_position_condition.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('check_position_condition Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def check_force_condition(axis, min=DR_COND_NONE, max=DR_COND_NONE, ref=None):
# axis
if type(axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if (axis != DR_AXIS_X and axis != DR_AXIS_Y and axis != DR_AXIS_Z and \
axis != DR_AXIS_A and axis != DR_AXIS_B and axis != DR_AXIS_C):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(axis))
# min
if type(min) != int and type(min) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : min")
# max
if type(max) != int and type(max) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : max")
if min == DR_COND_NONE and max == DR_COND_NONE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min({0}), max({1})".format(min, max))
# min check : min 설정되어 있는데 0보다 작은 경우 에러 처리 2017/12/07
if min != DR_COND_NONE:
if min < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min (Ranges: min({0}) >= 0)".format(min))
# max check : max 설정되어 있는데 0보다 작은 경우 에러 처리 2017/12/07
if max != DR_COND_NONE:
if max < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: max (Ranges: max({0}) >= 0)".format(max))
# min < max check
if min != DR_COND_NONE and max != DR_COND_NONE: #min, max 값이 둘다 설정된 경우에만 검사 실시 2017/08/23
if min > max:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min({0}), max({1})".format(min, max))
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# check axis
if (axis == DR_AXIS_A or axis == DR_AXIS_B or axis == DR_AXIS_C):
_ref = DR_TOOL
if __ROS2__:
req = CheckForceCondition.Request()
req.axis = axis
req.min = float(min)
req.max = float(max)
req.ref = _ref
future = _ros2_check_force_condition.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('check_force_condition Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def check_orientation_condition(axis, min=None, max=None, ref=None, mod = None, pos=None):
_cmd_type = 0
# axis
if type(axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if (axis != DR_AXIS_A and axis != DR_AXIS_B and axis != DR_AXIS_C):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(axis))
# min, max check type
if(min != None):
if type(min) == posx:
_cmd_type = 0
elif type(min) == posj:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : min is not posj")
elif type(min) == list and len(min) == POINT_COUNT:
_cmd_type = 0
elif type(min) == int or type(min) == float:
_cmd_type = 1
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : min")
if(max != None):
if type(max) == posx:
_cmd_type = 0
elif type(max) == posj:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : max is not posj")
elif type(max) == list and len(max) == POINT_COUNT:
_cmd_type = 0
elif type(max) == int or type(max) == float:
_cmd_type = 1
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : max")
if _cmd_type == 0:
# _pos_min
if(min != None):
_pos_min = get_normal_pos(min, def_type=posx)
else:
_pos_min = [DR_COND_NONE]*POINT_COUNT
# _pos_max
if(max != None):
_pos_max = get_normal_pos(max, def_type=posx)
else:
_pos_max = [DR_COND_NONE]*POINT_COUNT
# _ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# mod
if mod == None:
mod = DR_MV_MOD_ABS
else:
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod is not integer")
if mod != DR_MV_MOD_ABS:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod({0}) is not DR_MV_MOD_ABS".format(mod))
print("_cmd_type={0}, axis:{1}, min:{2}, max:{3}, ref:{4}, mod:{5}".format(_cmd_type, axis, _pos_min, _pos_max, _ref, mod) )
elif _cmd_type == 1:
# min
if min == None:
min = DR_COND_NONE
else:
if type(min) != int and type(min) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : min")
# max
if max == None:
max = DR_COND_NONE
else:
if type(max) != int and type(max) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : max")
if min == DR_COND_NONE and max == DR_COND_NONE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min({0}), max({1})".format(min, max))
# min < max check
if min != DR_COND_NONE and max != DR_COND_NONE: #min, max 값이 둘다 설정된 경우에만 검사 실시 2017/08/23
if min > max:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min({0}), max({1})".format(min, max))
# _ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# mod
if mod == None:
mod = DR_MV_MOD_REL
else:
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod is not integer")
if mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod({0}) is not DR_MV_MOD_REL".format(mod))
# _pos
if(pos==None):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : need to pos")
else:
_pos = get_normal_pos(pos, def_type=posx)
#print("_cmd_type={0}, axis:{1}, min:{2}, max:{3}, ref:{4}, mod:{5}, pos:{6}".format(_cmd_type, axis, min, max, _ref, mod, _pos) )
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid arguments")
if _cmd_type == 0:
if __ROS2__:
req = CheckOrientationCondition1.Request()
req.axis = axis
req.min = [float(x) for x in _pos_min]
req.max = [float(x) for x in _pos_max]
req.ref = _ref
req.mode = mod
future = _ros2_check_orientation_condition1.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('check_orientation_condition Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
if __ROS2__:
req = CheckOrientationCondition2.Request()
req.axis = axis
req.min = float(min)
req.max = float(max)
req.ref = _ref
req.mode = mod
req.pos = [float(x) for x in _pos]
future = _ros2_check_orientation_condition2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('check_orientation_condition Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def coord_transform(pose_in, ref_in=DR_BASE, ref_out=None):
# _pos
_pos = get_normal_pos(pose_in, def_type=posx)
# ref_in
if type(ref_in) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref_in")
# ref_out
if type(ref_out) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref_out")
if __ROS2__:
req = CoordTransform.Request()
req.pos_in = [float(x) for x in _pos]
req.ref_in = ref_in
req.ref_out = ref_out
future = _ros2_coord_transform.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('coord_transform Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
pos = list(result.conv_posx) # Convert tuple to list
trans_posx = posx(pos)
ret = trans_posx
return ret
##### I/O #########################################################################################################################
def get_digital_input(index):
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if index < DR_DIO_MIN_INDEX or index > DR_DIO_MAX_INDEX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
if __ROS2__:
req = GetCtrlBoxDigitalInput.Request()
req.index = index
future = _ros2_get_digital_input.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_digital_input Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.value
return ret
def get_analog_input(ch):
if type(ch) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ch")
if ch < 1 or ch > 2:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ch")
if __ROS2__:
req = GetCtrlBoxAnalogInput.Request()
req.channel = ch
future = _ros2_get_analog_input.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_analog_input Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.value
return ret
def get_tool_digital_input(index):
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if index < DR_TDIO_MIN_INDEX or index > DR_TDIO_MAX_INDEX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
if __ROS2__:
req = GetToolDigitalInput.Request()
req.index = index
future = _ros2_get_tool_digital_input.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_tool_digital_input Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.value
return ret
def set_digital_output(index, val=None):
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if val != None:
if type(val) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : val")
if index < DR_DIO_MIN_INDEX or index > DR_DIO_MAX_INDEX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
if val != ON and val != OFF:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
else: # # val ���ڰ� ������ simple style
if (index < (-DR_DIO_MAX_INDEX)) or (index > DR_DIO_MAX_INDEX) or (index==0): # -16~+16
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
else:
if index < 0:
index = index*(-1)
val = OFF
else:
index = index
val = ON
if __ROS2__:
req = SetCtrlBoxDigitalOutput.Request()
req.index = index
req.value = val
future = _ros2_set_digital_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_digital_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_digital_output(index):
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if index < DR_DIO_MIN_INDEX or index > DR_DIO_MAX_INDEX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
if __ROS2__:
req = GetCtrlBoxDigitalOutput.Request()
req.index = index
future = _ros2_get_digital_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_digital_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.value
return ret
def set_analog_output(ch, val):
global _g_analog_output_mode_ch1
global _g_analog_output_mode_ch2
if type(ch) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ch")
if type(val) != int and type(val) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : val")
if ch < 1 or ch > 2:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ch")
#if val < 0 or val > 20.0:
# raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
if ch == 1:
if _g_analog_output_mode_ch1 == DR_ANALOG_CURRENT:
if val < 4 or val > 20.0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
elif _g_analog_output_mode_ch1 == DR_ANALOG_VOLTAGE:
if val < 0 or val > 10.0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
else:
raise DR_Error(DR_ERROR_VALUE, "Analog output mode(ch1) is not set")
if ch == 2:
if _g_analog_output_mode_ch2 == DR_ANALOG_CURRENT:
if val < 4 or val > 20.0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
elif _g_analog_output_mode_ch2 == DR_ANALOG_VOLTAGE:
if val < 0 or val > 10.0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
else:
raise DR_Error(DR_ERROR_VALUE, "Analog output mode(ch2) is not set")
if __ROS2__:
req = SetCtrlBoxAnalogOutput.Request()
req.channel = ch
req.value = float(val)
future = _ros2_set_analog_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_analog_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_mode_analog_output(ch, mod):
global _g_analog_output_mode_ch1
global _g_analog_output_mode_ch2
if type(ch) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ch")
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if ch < 1 or ch > 2:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ch")
if mod != DR_ANALOG_CURRENT and mod !=DR_ANALOG_VOLTAGE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
if ch == 1:
_g_analog_output_mode_ch1 = mod
if ch == 2:
_g_analog_output_mode_ch2 = mod
if __ROS2__:
req = SetCtrlBoxAnalogOutputType.Request()
req.channel = ch
req.mode = mod
future = _ros2_set_mode_analog_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_mode_analog_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_mode_analog_input(ch, mod):
if type(ch) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ch")
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if ch < 1 or ch > 2:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ch")
if mod != DR_ANALOG_CURRENT and mod !=DR_ANALOG_VOLTAGE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
if __ROS2__:
req = SetCtrlBoxAnalogInputType.Request()
req.channel = ch
req.mode = mod
future = _ros2_set_mode_analog_input.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_mode_analog_input Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_tool_digital_output(index, val=None):
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if val != None:
if type(val) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : val")
if index < DR_TDIO_MIN_INDEX or index > DR_TDIO_MAX_INDEX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
if val != ON and val != OFF:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
else: # val ���ڰ� ������ simple style
if (index < (-DR_TDIO_MAX_INDEX)) or (index > DR_TDIO_MAX_INDEX) or (index==0): # -6~+6
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
else:
if index < 0:
index = index*(-1)
val = OFF
else:
index = index
val = ON
if __ROS2__:
req = SetToolDigitalOutput.Request()
req.index = index
req.value = val
future = _ros2_set_tool_digital_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_tool_digital_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_tool_digital_output(index):
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if index < DR_TDIO_MIN_INDEX or index > DR_TDIO_MAX_INDEX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
if __ROS2__:
req = GetToolDigitalOutput.Request()
req.index = index
future = _ros2_get_tool_digital_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_tool_digital_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.value
return ret
##### Modbus #########################################################################################################################
def add_modbus_signal(ip, port, name, reg_type, index, value=0, slaveid=255):
# ip
if type(ip) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ip")
#try:
# ipaddress.ip_address(ip)
#except:
# raise DR_Error(DR_ERROR_VALUE, "Invalid value : ip")
# port
if type(port) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : port")
if port <= 0 or port > 65535:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : port (Ranges: 1 ~ 65535)")
# name
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# reg_type
if type(reg_type) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : reg_type")
if reg_type != DR_MODBUS_DIG_INPUT and reg_type != DR_MODBUS_DIG_OUTPUT and reg_type != DR_MODBUS_REG_INPUT and reg_type != DR_MODBUS_REG_OUTPUT:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : reg_type (Ranges : 0 ~ 3")
# index
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if index < 0 or index > 65535:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index (Ranges: 0 ~ 65535)")
# value
if type(value) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : value")
if value < 0 or value > 65535:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : value (Ranges: 0 ~ 65535)")
# check value
if reg_type == DR_MODBUS_DIG_OUTPUT or reg_type == DR_MODBUS_REG_OUTPUT:
_value = value
else:
_value = 0
# slaveid
if type(slaveid) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : slaveid")
if slaveid < 0 or slaveid > 255:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : slaveid (Ranges: 0 or 1~247 or 255)")
elif slaveid > 247 and slaveid < 255:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : slaveid (Ranges: 0 or 1~247 or 255)")
# ROS service call
if __ROS2__:
req = ConfigCreateModbus.Request()
req.name = name
req.ip = ip
req.port = port
req.reg_type = reg_type
req.index = index
req.value = _value
req.slave_id = slaveid
future = _ros2_add_modbus_signal.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('add_modbus_signal Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def del_modbus_signal(name):
# name
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# ROS service call
if __ROS2__:
req = ConfigDeleteModbus.Request()
req.name = name
future = _ros2_del_modbus_signal.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('del_modbus_signal Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_modbus_output(iobus, val):
if type(iobus) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : iobus")
if type(val) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : val")
# not check value (register : 2byte...)
# if val != ON and val != OFF:
# raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
# ROS service call
if __ROS2__:
req = SetModbusOutput.Request()
req.name = iobus
req.value = val
future = _ros2_set_modbus_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_modbus_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_modbus_input(iobus):
if type(iobus) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : iobus")
# ROS service call
if __ROS2__:
req = GetModbusInput.Request()
req.name = iobus
future = _ros2_get_modbus_input.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_modbus_input Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.value
return ret
##### TCP/TOOL #########################################################################################################################
def set_tcp(name):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# not check value (register : 2byte...)
# if val != ON and val != OFF:
# raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
# ROS service call
if __ROS2__:
req = SetCurrentTcp.Request()
req.name = name
future = _ros2_set_current_tcp.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_tcp Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_tcp():
# ROS service call
if __ROS2__:
req = GetCurrentTcp.Request()
future = _ros2_get_current_tcp.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_tcp Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.info
return ret
def set_tool(name):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# not check value (register : 2byte...)
# if val != ON and val != OFF:
# raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
# ROS service call
if __ROS2__:
req = SetCurrentTool.Request()
req.name = name
future = _ros2_set_current_tool.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_tool Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_tool():
# ROS service call
if __ROS2__:
req = GetCurrentTool.Request()
future = _ros2_get_current_tool.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_tool Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.info
return ret
def set_tool_shape(name):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
if __ROS2__:
req = SetToolShape.Request()
req.name = name
future = _ros2_set_tool_shape.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_tool_shape Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def add_tcp(name, pos):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# ROS service call
if __ROS2__:
req = ConfigCreateTcp.Request()
req.name = name
req.pos = [float(x) for x in pos]
future = _ros2_config_create_tcp.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('add_tcp Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def del_tcp(name):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# ROS service call
if __ROS2__:
req = ConfigDeleteTcp.Request()
req.name = name
future = _ros2_config_delete_tcp.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('del_tcp Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def add_tool(name, weight, cog, inertia):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# ROS service call
if __ROS2__:
req = ConfigCreateTool.Request()
req.name = name
req.weight = float(weight)
req.cog = [float(x) for x in cog]
req.inertia = [float(x) for x in inertia]
future = _ros2_config_create_tool.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('add_tool Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def del_tool(name):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# ROS service call
if __ROS2__:
req = ConfigDeleteTool.Request()
req.name = name
future = _ros2_config_delete_tool.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('del_tool Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
##### DRL #########################################################################################################################
def drl_script_run(robotSystem, code):
if type(code) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# ROS service call
if __ROS2__:
req = DrlStart.Request()
req.robot_system = robotSystem
req.code = code
future = _ros2_drl_start.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('drl_script_run Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def drl_script_stop(stop_mode):
if type(stop_mode) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : stop_mode")
print("drl_script_stop")
# ROS service call
if __ROS2__:
req = DrlStop.Request()
req.stop_mode = stop_mode
future = _ros2_drl_stop.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('drl_script_stop Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def drl_script_pause():
# ROS service call
if __ROS2__:
req = DrlPause.Request()
future = _ros2_drl_pause.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('drl_script_pause Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def drl_script_resume():
# ROS service call
if __ROS2__:
req = DrlResume.Request()
future = _ros2_drl_resume.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('drl_script_resume Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_drl_state():
# ROS service call
if __ROS2__:
req = GetDrlState.Request()
future = _ros2_get_drl_state.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_drl_state Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.drl_state
return ret
########################################################################################################################################
########################################################################################################################################
########################################################################################################################################
class CDsrRobot:
def __init__(self, robot_id='dsr01', robot_model='m1013'):
global g_node
self._robot_id = robot_id
self._robot_model = robot_model
print("CDsrRobot(): self._robot_id = %s, self._robot_model = %s" %(self._robot_id, self._robot_model))
self._srv_name_prefix = '' #'/' + self._robot_id + self._robot_model #ROS2
############### connect to dsr_control2 (ros service) #######################################################################
#rospy.wait_for_service(self._srv_name_prefix +"/motion/move_joint")
# system Operations
self._ros2_set_robot_mode = g_node.create_client(SetRobotMode, self._srv_name_prefix +"/system/set_robot_mode") ; self.req_SetRobotMode = SetRobotMode.Request()
self._ros2_get_robot_mode = g_node.create_client(GetRobotMode, self._srv_name_prefix +"/system/get_robot_mode") ; self.req_GetRobotMode = GetRobotMode.Request()
self._ros2_set_robot_system = g_node.create_client(SetRobotSystem, self._srv_name_prefix +"/system/set_robot_system") ; self.req_SetRobotSystem = SetRobotSystem.Request()
self._ros2_get_robot_system = g_node.create_client(GetRobotSystem, self._srv_name_prefix +"/system/get_robot_system") ; self.req_GetRobotSystem = GetRobotSystem.Request()
self._ros2_get_robot_state = g_node.create_client(GetRobotState, self._srv_name_prefix +"/system/get_robot_state") ; self.req_GetRobotState = GetRobotState.Request()
self._ros2_set_robot_speed_mode = g_node.create_client(SetRobotSpeedMode, self._srv_name_prefix +"/system/set_robot_speed_mode") ; self.req_SetRobotSpeedMode = SetRobotSpeedMode.Request()
self._ros2_get_robot_speed_mode = g_node.create_client(GetRobotSpeedMode, self._srv_name_prefix +"/system/get_robot_speed_mode") ; self.req_GetRobotSpeedMode = GetRobotSpeedMode.Request()
self._ros2_set_safe_stop_reset_type = g_node.create_client(SetSafeStopResetType, self._srv_name_prefix +"/system/set_safe_stop_reset_type") ; self.req_SetSafeStopResetType = SetSafeStopResetType.Request()
self._ros2_get_last_alarm = g_node.create_client(GetLastAlarm, self._srv_name_prefix +"/system/get_last_alarm") ; self.req_GetLastAlarm = GetLastAlarm.Request()
self._ros2_get_current_pose = g_node.create_client(GetCurrentPose, self._srv_name_prefix +"/system/get_current_pose") ; self.req_GetCurrentPose = GetCurrentPose.Request()
# motion Operations
self._ros2_movej = g_node.create_client(MoveJoint, self._srv_name_prefix +"/motion/move_joint") ; self.req_MoveJoint = MoveJoint.Request()
self._ros2_movel = g_node.create_client(MoveLine, self._srv_name_prefix +"/motion/move_line") ; self.req_MoveLine = MoveLine.Request()
self._ros2_movejx = g_node.create_client(MoveJointx, self._srv_name_prefix +"/motion/move_jointx") ; self.req_MoveJointx = MoveJointx.Request()
self._ros2_movec = g_node.create_client(MoveCircle, self._srv_name_prefix +"/motion/move_circle") ; self.req_MoveCircle = MoveCircle.Request()
self._ros2_movesj = g_node.create_client(MoveSplineJoint, self._srv_name_prefix +"/motion/move_spline_joint") ; self.req_MoveSplineJoint = MoveSplineJoint.Request()
self._ros2_movesx = g_node.create_client(MoveSplineTask, self._srv_name_prefix +"/motion/move_spline_task") ; self.req_MoveSplineTask = MoveSplineTask.Request()
self._ros2_moveb = g_node.create_client(MoveBlending, self._srv_name_prefix +"/motion/move_blending") ; self.req_MoveBlending = MoveBlending.Request()
self._ros2_move_spiral = g_node.create_client(MoveSpiral, self._srv_name_prefix +"/motion/move_spiral") ; self.req_MoveSpiral = MoveSpiral.Request()
self._ros2_move_periodic = g_node.create_client(MovePeriodic, self._srv_name_prefix +"/motion/move_periodic") ; self.req_MovePeriodic = MovePeriodic.Request()
self._ros2_move_wait = g_node.create_client(MoveWait, self._srv_name_prefix +"/motion/move_wait") ; self.req_MoveWait = MoveWait.Request()
self._ros2_jog = g_node.create_client(Jog, self._srv_name_prefix +"/motion/jog") ; self.req_Jog = Jog.Request()
self._ros2_jog_multi = g_node.create_client(JogMulti, self._srv_name_prefix +"/motion/jog_multi") ; self.req_JogMulti = JogMulti.Request()
self._ros2_trans = g_node.create_client(Trans, self._srv_name_prefix +"/motion/trans") ; self.req_Trans = Trans.Request()
self._ros2_fkin = g_node.create_client(Fkin, self._srv_name_prefix +"/motion/fkin") ; self.req_Fkin = Fkin.Request()
self._ros2_ikin = g_node.create_client(Ikin, self._srv_name_prefix +"/motion/ikin") ; self.req_Ikin = Ikin.Request()
self._ros2_set_ref_coord = g_node.create_client(SetRefCoord, self._srv_name_prefix +"/motion/set_ref_coord") ; self.req_SetRefCoord = SetRefCoord.Request()
self._ros2_move_home = g_node.create_client(MoveHome, self._srv_name_prefix +"/motion/move_home") ; self.req_MoveHome = MoveHome.Request()
self._ros2_check_motion = g_node.create_client(CheckMotion, self._srv_name_prefix +"/motion/check_motion") ; self.req_CheckMotion = CheckMotion.Request()
self._ros2_change_operation_speed = g_node.create_client(ChangeOperationSpeed, self._srv_name_prefix +"/motion/change_operation_speed") ; self.req_ChangeOperationSpeed = ChangeOperationSpeed.Request()
self._ros2_enable_alter_motion = g_node.create_client(EnableAlterMotion, self._srv_name_prefix +"/motion/enable_alter_motion") ; self.req_EnableAlterMotion = EnableAlterMotion.Request()
self._ros2_alter_motion = g_node.create_client(AlterMotion, self._srv_name_prefix +"/motion/alter_motion") ; self.req_AlterMotion = AlterMotion.Request()
self._ros2_disable_alter_motion = g_node.create_client(DisableAlterMotion, self._srv_name_prefix +"/motion/disable_alter_motion") ; self.req_DisableAlterMotion = DisableAlterMotion.Request()
self._ros2_set_singularity_handling = g_node.create_client(SetSingularityHandling, self._srv_name_prefix +"/motion/set_singularity_handling") ; self.req_SetSingularityHandling = SetSingularityHandling.Request()
# Auxiliary Control Operations
self._ros2_get_control_mode = g_node.create_client(GetControlMode, self._srv_name_prefix +"/aux_control/get_control_mode") ; self.req_GetControlMode = GetControlMode.Request()
self._ros2_get_control_space = g_node.create_client(GetControlSpace, self._srv_name_prefix +"/aux_control/get_control_space") ; self.req_GetControlSpace = GetControlSpace.Request()
self._ros2_get_current_posj = g_node.create_client(GetCurrentPosj, self._srv_name_prefix +"/aux_control/get_current_posj") ; self.req_GetCurrentPosj = GetCurrentPosj.Request()
self._ros2_get_current_velj = g_node.create_client(GetCurrentVelj, self._srv_name_prefix +"/aux_control/get_current_velj") ; self.req_GetCurrentVelj = GetCurrentVelj.Request()
self._ros2_get_desired_posj = g_node.create_client(GetDesiredPosj, self._srv_name_prefix +"/aux_control/get_desired_posj") ; self.req_GetDesiredPosj = GetDesiredPosj.Request()
self._ros2_get_desired_velj = g_node.create_client(GetDesiredVelj, self._srv_name_prefix +"/aux_control/get_desired_velj") ; self.req_GetDesiredVelj = GetDesiredVelj.Request()
self._ros2_get_current_posx = g_node.create_client(GetCurrentPosx, self._srv_name_prefix +"/aux_control/get_current_posx") ; self.req_GetCurrentPosx = GetCurrentPosx.Request()
self._ros2_get_current_velx = g_node.create_client(GetCurrentVelx, self._srv_name_prefix +"/aux_control/get_current_velx") ; self.req_GetCurrentVelx = GetCurrentVelx.Request()
self._ros2_get_desired_posx = g_node.create_client(GetDesiredPosx, self._srv_name_prefix +"/aux_control/get_desired_posx") ; self.req_GetDesiredPosx = GetDesiredPosx.Request()
self._ros2_get_desired_velx = g_node.create_client(GetDesiredVelx, self._srv_name_prefix +"/aux_control/get_desired_velx") ; self.req_GetDesiredVelx = GetDesiredVelx.Request()
self._ros2_get_current_tool_flange_posx = g_node.create_client(GetCurrentToolFlangePosx, self._srv_name_prefix +"/aux_control/get_current_tool_flange_posx") ; self.req_GetCurrentToolFlangePosx = GetCurrentToolFlangePosx.Request()
self._ros2_get_current_solution_space = g_node.create_client(GetCurrentSolutionSpace, self._srv_name_prefix +"/aux_control/get_current_solution_space") ; self.req_GetCurrentSolutionSpace = GetCurrentSolutionSpace.Request()
self._ros2_get_current_rotm = g_node.create_client(GetCurrentRotm, self._srv_name_prefix +"/aux_control/get_current_rotm") ; self.req_GetCurrentRotm = GetCurrentRotm.Request()
self._ros2_get_joint_torque = g_node.create_client(GetJointTorque, self._srv_name_prefix +"/aux_control/get_joint_torque") ; self.req_GetJointTorque = GetJointTorque.Request()
self._ros2_get_external_torque = g_node.create_client(GetExternalTorque, self._srv_name_prefix +"/aux_control/get_external_torque") ; self.req_GetExternalTorque = GetExternalTorque.Request()
self._ros2_get_tool_force = g_node.create_client(GetToolForce, self._srv_name_prefix +"/aux_control/get_tool_force") ; self.req_GetToolForce = GetToolForce.Request()
self._ros2_get_solution_space = g_node.create_client(GetSolutionSpace, self._srv_name_prefix +"/aux_control/get_solution_space") ; self.req_GetSolutionSpace = GetSolutionSpace.Request()
self._ros2_get_orientation_error = g_node.create_client(GetOrientationError, self._srv_name_prefix +"/aux_control/get_orientation_error") ; self.req_GetOrientationError = GetOrientationError.Request()
# Force/Stiffness Control & others Operations
self._ros2_get_workpiece_weight = g_node.create_client(GetWorkpieceWeight, self._srv_name_prefix +"/force/get_workpiece_weight") ; self.req_GetWorkpieceWeight = GetWorkpieceWeight.Request()
self._ros2_reset_workpiece_weight = g_node.create_client(ResetWorkpieceWeight, self._srv_name_prefix +"/force/reset_workpiece_weight") ; self.req_ResetWorkpieceWeight = ResetWorkpieceWeight.Request()
self._ros2_parallel_axis1 = g_node.create_client(ParallelAxis1, self._srv_name_prefix +"/force/parallel_axis1") ; self.req_ParallelAxis1 = ParallelAxis1.Request()
self._ros2_parallel_axis2 = g_node.create_client(ParallelAxis2, self._srv_name_prefix +"/force/parallel_axis2") ; self.req_ParallelAxis2 = ParallelAxis2.Request()
self._ros2_align_axis1 = g_node.create_client(AlignAxis1, self._srv_name_prefix +"/force/align_axis1") ; self.req_AlignAxis1 = AlignAxis1.Request()
self._ros2_align_axis2 = g_node.create_client(AlignAxis2, self._srv_name_prefix +"/force/align_axis2") ; self.req_AlignAxis2 = AlignAxis2.Request()
self._ros2_is_done_bolt_tightening = g_node.create_client(IsDoneBoltTightening, self._srv_name_prefix +"/force/is_done_bolt_tightening") ; self.req_IsDoneBoltTightening = IsDoneBoltTightening.Request()
self._ros2_release_compliance_ctrl = g_node.create_client(ReleaseComplianceCtrl, self._srv_name_prefix +"/force/release_compliance_ctrl") ; self.req_ReleaseComplianceCtrl = ReleaseComplianceCtrl.Request()
self._ros2_task_compliance_ctrl = g_node.create_client(TaskComplianceCtrl, self._srv_name_prefix +"/force/task_compliance_ctrl") ; self.req_TaskComplianceCtrl = TaskComplianceCtrl.Request()
self._ros2_set_stiffnessx = g_node.create_client(SetStiffnessx, self._srv_name_prefix +"/force/set_stiffnessx") ; self.req_SetStiffnessx = SetStiffnessx.Request()
self._ros2_calc_coord = g_node.create_client(CalcCoord, self._srv_name_prefix +"/force/calc_coord") ; self.req_CalcCoord = CalcCoord.Request()
self._ros2_set_user_cart_coord1 = g_node.create_client(SetUserCartCoord1, self._srv_name_prefix +"/force/set_user_cart_coord1") ; self.req_SetUserCartCoord1 = SetUserCartCoord1.Request()
self._ros2_set_user_cart_coord2 = g_node.create_client(SetUserCartCoord2, self._srv_name_prefix +"/force/set_user_cart_coord2") ; self.req_SetUserCartCoord2 = SetUserCartCoord2.Request()
self._ros2_set_user_cart_coord3 = g_node.create_client(SetUserCartCoord3, self._srv_name_prefix +"/force/set_user_cart_coord3") ; self.req_SetUserCartCoord3 = SetUserCartCoord3.Request()
self._ros2_overwrite_user_cart_coord = g_node.create_client(OverwriteUserCartCoord, self._srv_name_prefix +"/force/overwrite_user_cart_coord") ; self.req_OverwriteUserCartCoord = OverwriteUserCartCoord.Request()
self._ros2_get_user_cart_coord = g_node.create_client(GetUserCartCoord, self._srv_name_prefix +"/force/get_user_cart_coord") ; self.req_GetUserCartCoord = GetUserCartCoord.Request()
self._ros2_set_desired_force = g_node.create_client(SetDesiredForce, self._srv_name_prefix +"/force/set_desired_force") ; self.req_SetDesiredForce = SetDesiredForce.Request()
self._ros2_release_force = g_node.create_client(ReleaseForce, self._srv_name_prefix +"/force/release_force") ; self.req_ReleaseForce = ReleaseForce.Request()
self._ros2_check_position_condition = g_node.create_client(CheckPositionCondition, self._srv_name_prefix +"/force/check_position_condition") ; self.req_CheckPositionCondition = CheckPositionCondition.Request()
self._ros2_check_force_condition = g_node.create_client(CheckForceCondition, self._srv_name_prefix +"/force/check_force_condition") ; self.req_CheckForceCondition = CheckForceCondition.Request()
self._ros2_check_orientation_condition1= g_node.create_client(CheckOrientationCondition1, self._srv_name_prefix +"/force/check_orientation_condition1") ; self.req_CheckOrientationCondition1 = CheckOrientationCondition1.Request()
self._ros2_check_orientation_condition2= g_node.create_client(CheckOrientationCondition2, self._srv_name_prefix +"/force/check_orientation_condition2") ; self.req_CheckOrientationCondition2 = CheckOrientationCondition2.Request()
self._ros2_coord_transform = g_node.create_client(CoordTransform, self._srv_name_prefix +"/force/coord_transform") ; self.req_CoordTransform = CoordTransform.Request()
# GPIO Operations
self._ros2_set_digital_output = g_node.create_client(SetCtrlBoxDigitalOutput, self._srv_name_prefix +"io/set_ctrl_box_digital_output") ; self.req_SetCtrlBoxDigitalOutput = SetCtrlBoxDigitalOutput.Request()
self._ros2_get_digital_input = g_node.create_client(GetCtrlBoxDigitalInput, self._srv_name_prefix +"io/get_ctrl_box_digital_input") ; self.req_GetCtrlBoxDigitalInput = GetCtrlBoxDigitalInput.Request()
self._ros2_set_tool_digital_output = g_node.create_client(SetToolDigitalOutput, self._srv_name_prefix +"io/set_tool_digital_output") ; self.req_SetToolDigitalOutput= SetToolDigitalOutput.Request()
self._ros2_get_tool_digital_input = g_node.create_client(GetToolDigitalInput, self._srv_name_prefix +"io/get_tool_digital_input") ; self.req_GetToolDigitalInput = GetToolDigitalInput.Request()
self._ros2_set_analog_output = g_node.create_client(SetCtrlBoxAnalogOutput, self._srv_name_prefix +"io/set_ctrl_box_analog_output") ; self.req_SetCtrlBoxAnalogOutput = SetCtrlBoxAnalogOutput.Request()
self._ros2_get_analog_input = g_node.create_client(GetCtrlBoxAnalogInput, self._srv_name_prefix +"io/get_ctrl_box_analog_input") ; self.req_GetCtrlBoxAnalogInput = GetCtrlBoxAnalogInput.Request()
self._ros2_set_mode_analog_output = g_node.create_client(SetCtrlBoxAnalogOutputType, self._srv_name_prefix +"io/set_ctrl_box_analog_output_type") ; self.req_SetCtrlBoxAnalogOutputType = SetCtrlBoxAnalogOutputType.Request()
self._ros2_set_mode_analog_input = g_node.create_client(SetCtrlBoxAnalogInputType, self._srv_name_prefix +"io/set_ctrl_box_analog_input_type") ; self.req_SetCtrlBoxAnalogInputType = SetCtrlBoxAnalogInputType.Request()
self._ros2_get_digital_output = g_node.create_client(GetCtrlBoxDigitalOutput, self._srv_name_prefix +"io/get_ctrl_box_digital_output") ; self.req_GetCtrlBoxDigitalOutput = GetCtrlBoxDigitalOutput.Request()
self._ros2_get_tool_digital_output = g_node.create_client(GetToolDigitalOutput, self._srv_name_prefix +"io/get_tool_digital_output") ; self.req_GetToolDigitalOutput = GetToolDigitalOutput.Request()
# Modbus Operations,
self._ros2_set_modbus_output = g_node.create_client(SetModbusOutput, self._srv_name_prefix +"/modbus/set_modbus_output") ; self.req_SetModbusOutput = SetModbusOutput.Request()
self._ros2_get_modbus_input = g_node.create_client(GetModbusInput, self._srv_name_prefix +"/modbus/get_modbus_input") ; self.req_GetModbusInput = GetModbusInput.Request()
self._ros2_add_modbus_signal = g_node.create_client(ConfigCreateModbus, self._srv_name_prefix +"/modbus/config_create_modbus") ; self.req_ConfigCreateModbus = ConfigCreateModbus.Request()
self._ros2_del_modbus_signal = g_node.create_client(ConfigDeleteModbus, self._srv_name_prefix +"/modbus/config_delete_modbus") ; self.req_ConfigDeleteModbus = ConfigDeleteModbus.Request()
# TCP Operations,
self._ros2_set_current_tcp = g_node.create_client(SetCurrentTcp, self._srv_name_prefix +"/tcp/set_current_tcp") ; self.req_SetCurrentTcp = SetCurrentTcp.Request()
self._ros2_get_current_tcp = g_node.create_client(GetCurrentTcp, self._srv_name_prefix +"/tcp/get_current_tcp") ; self.req_GetCurrentTcp = GetCurrentTcp.Request()
self._ros2_config_create_tcp = g_node.create_client(ConfigCreateTcp, self._srv_name_prefix +"/tcp/config_create_tcp") ; self.req_ConfigCreateTcp = ConfigCreateTcp.Request()
self._ros2_config_delete_tcp = g_node.create_client(ConfigDeleteTcp, self._srv_name_prefix +"/tcp/config_delete_tcp") ; self.req_ConfigDeleteTcp = ConfigDeleteTcp.Request()
# Tool Operations,
self._ros2_set_current_tool = g_node.create_client(SetCurrentTool, self._srv_name_prefix +"/tool/set_current_tool") ; self.req_SetCurrentTool = SetCurrentTool.Request()
self._ros2_get_current_tool = g_node.create_client(GetCurrentTool, self._srv_name_prefix +"/tool/get_current_tool") ; self.req_GetCurrentTool = GetCurrentTool.Request()
self._ros2_config_create_tool = g_node.create_client(ConfigCreateTool, self._srv_name_prefix +"/tool/config_create_tool") ; self.req_ConfigCreateTool = ConfigCreateTool.Request()
self._ros2_config_delete_tool = g_node.create_client(ConfigDeleteTool, self._srv_name_prefix +"/tool/config_delete_tool") ; self.req_ConfigDeleteTool = ConfigDeleteTool.Request()
self._ros2_set_tool_shape = g_node.create_client(SetToolShape, self._srv_name_prefix +"/tool/set_tool_shape") ; self.req_SetToolShape = SetToolShape.Request()
# DRL Operations,
self._ros2_drl_pause = g_node.create_client(DrlPause, self._srv_name_prefix +"/drl/drl_pause") ; self.req_DrlPause = DrlPause.Request()
self._ros2_drl_resume = g_node.create_client(DrlResume, self._srv_name_prefix +"/drl/drl_resume") ; self.req_DrlResume = DrlResume.Request()
self._ros2_drl_start = g_node.create_client(DrlStart, self._srv_name_prefix +"/drl/drl_start") ; self.req_DrlStart = DrlStart.Request()
self._ros2_drl_stop = g_node.create_client(DrlStop, self._srv_name_prefix +"/drl/drl_stop") ; self.req_DrlStop = DrlStop.Request()
self._ros2_get_drl_state = g_node.create_client(GetDrlState, self._srv_name_prefix +"/drl/get_drl_state") ; self.req_GetDrlState = GetDrlState.Request()
########################################################################################################################################
self._g_blend_state = False
self._g_blend_radius = 0.0
self._g_velj = [0.0] * DR_VELJ_DT_LEN
self._g_accj = [0.0] * DR_ACCJ_DT_LEN
self._g_velx = [0.0] * DR_VELX_DT_LEN
self._g_velx[0]= 0.0
self._g_velx[1]= DR_COND_NONE
self._g_accx = [0.0] * DR_ACCX_DT_LEN
self._g_accx[0]= 0.0
self._g_accx[1]= DR_COND_NONE
self._g_coord = DR_BASE
self._g_analog_output_mode_ch1 = -1
self._g_analog_output_mode_ch2 = -1
##### SYSTEM ##############################################################################################################################
def set_robot_mode(self, robot_mode):
if type(robot_mode) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : robot_mode")
# ROS service call
if __ROS2__:
#srv = self._ros_set_robot_mode(robot_mode)
req = self.req_SetRobotMode
req.robot_mode = robot_mode
#ret = 0 if (srv.success == True) else -1
future = self._ros2_set_robot_mode.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_robot_mode Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_robot_mode(self):
# ROS2 service call
if __ROS2__:
req = self.req_GetRobotMode
#ret = 0 if (srv.success == True) else -1
future = self._ros2_get_robot_mode.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_robot_mode Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.robot_mode
return ret
def set_robot_system(self, robot_system):
if type(robot_system) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : robot_system")
# ROS2 service call
if __ROS2__:
req = self.req_SetRobotSystem
req.robot_system = robot_system
future = self._ros2_set_robot_system.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_robot_system Service call failed %r' % (e,))
else:
if result == None:
ret = -1
g_node.get_logger().info('set_robot_system Service call failed')
else:
ret = 0 if (result.success == True) else -1
return ret
def get_robot_system(self):
# ROS2 service call
if __ROS2__:
req = self.req_GetRobotSystem
future = self._ros2_get_robot_system.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_robot_system Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.robot_system
return ret
def get_robot_state(self):
# ROS2 service call
if __ROS2__:
req = self.req_GetRobotState
future = self._ros2_get_robot_state.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_robot_state Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.robot_state
return ret
def set_robot_speed_mode(self, speed_mode):
if type(speed_mode) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : speed_mode")
# ROS2 service call
if __ROS2__:
req = self.req_SetRobotSpeedMode
req.speed_mode = speed_mode
future = self._ros2_set_robot_speed_mode.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_robot_speed_mode Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_robot_speed_mode(self):
# ROS2 service call
if __ROS2__:
req = self.req_GetRobotSpeedMode
future = self._ros2_get_robot_speed_mode.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_robot_speed_mode Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.speed_mode
return ret
def set_safe_stop_reset_type(self, reset_type):
if type(reset_type) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : reset_type")
# ROS2 service call
if __ROS2__:
req = self.req_SetSafeStopResetType
req.reset_type = reset_type
future = self._ros2_set_safe_stop_reset_type.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_safe_stop_reset_type Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_current_pose(self, space_type):
if type(space_type) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : space_type")
if __ROS2__:
req = self.req_GetCurrentPose
req.space_type = space_type
future = self._ros2_get_current_pose.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_pose Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.pos
return ret
def get_current_solution_space(self):
# ROS2 service call
if __ROS2__:
req = self.req_GetCurrentSolutionSpace
future = self._ros2_get_current_solution_space.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_solution_space Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.sol_space
return ret
def get_last_alarm(self):
#ROS2 service call
if __ROS2__:
req = self.req_GetLastAlarm
future = self._ros2_get_last_alarm.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_last_alarm Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.log_alarm
return ret
##### Auxiliary Control ##############################################################################################################################
def get_control_mode(self):
if __ROS2__:
req = self.req_GetControlMode
future = self._ros2_get_control_mode.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_control_mode Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.control_mode
return ret
def get_control_space(self):
if __ROS2__:
req = self.req_GetControlSpace
future = self._ros2_get_control_space.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_control_space Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.space
return ret
def get_current_posj(self):
if __ROS2__:
req = self.req_GetCurrentPosj
future = self._ros2_get_current_posj.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_posj Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
pos = list(result.pos) # Convert tuple to list
# set posj
cur_pos = posj(pos)
ret = cur_pos
return ret
def get_current_velj(self):
if __ROS2__:
req = self.req_GetCurrentVelj
future = self._ros2_get_current_velj.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_velj Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = list(result.joint_speed) # Convert tuple to list
return ret
def get_desired_posj(self):
if __ROS2__:
req = self.req_GetDesiredPosj
future = self._ros2_get_desired_posj.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_desired_posj Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
pos = list(result.pos) # Convert tuple to list
ret = posj(pos)
return ret
def get_desired_velj(self):
if __ROS2__:
req = self.req_GetDesiredVelj
future = self._ros2_get_desired_velj.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_desired_velj Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = list(result.joint_vel) # Convert tuple to list
return ret
def get_current_posx(self, ref=None):
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref != DR_BASE and _ref != DR_WORLD and (_ref < DR_TC_USER_MIN or _ref > DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_GetCurrentPosx
req.ref = _ref
future = self._ros2_get_current_posx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_posx Service call failed %r' % (e,))
else:
if result == None:
return None, None
else:
posx_info = _ros_Float64MultiArrayTolist(result.task_pos_info) # Convert Float64MultiArray to list
pos = []
for i in range(POINT_COUNT):
pos.append(posx_info[0][i])
sol = int(round( posx_info[0][6] ))
conv_posx = posx(pos)
return conv_posx, sol
return 0
def get_current_tool_flange_posx(self, ref=None):
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_GetCurrentToolFlangePosx
req.ref = _ref
future = self._ros2_get_current_tool_flange_posx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_tool_flange_posx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.pos
pos = list(result.pos) # Convert tuple to list
# set posx type
ret = posx(pos)
return ret
def get_current_velx(self, ref=None):
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_GetCurrentVelx
req.ref = _ref
future = self._ros2_get_current_velx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_velx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.vel
return ret
def get_desired_posx(self, ref=None):
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref != DR_BASE and _ref != DR_TOOL and _ref != DR_WORLD and (_ref < DR_TC_USER_MIN or _ref > DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_GetDesiredPosx
req.ref = _ref
future = self._ros2_get_desired_posx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_desired_posx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
pos = list(result.pos) # Convert tuple to list
conv_posx = posx(pos)
ret = conv_posx
return ret
def get_desired_velx(self, ref=None):
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_GetDesiredVelx
req.ref = _ref
future = self._ros2_get_desired_velx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_desired_velx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = list(result.vel) # Convert tuple to list
return ret
def get_current_solution_space(self):
if __ROS2__:
req = self.req_GetCurrentSolutionSpace
future = self._ros2_get_current_solution_space.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_solution_space Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.sol_space
return ret
def get_current_rotm(self, ref=None):
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_GetCurrentRotm
req.ref = _ref
future = self._ros2_get_current_rotm.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_current_rotm Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = _ros_Float64MultiArrayTolist(result.rot_matrix) # Convert Float64MultiArray to list
return ret
def get_joint_torque(self):
if __ROS2__:
req = self.req_GetJointTorque
future = self._ros2_get_joint_torque.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_joint_torque Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = list(result.jts) # Convert tuple to list
return ret
def get_external_torque(self):
if __ROS2__:
req = self.req_GetExternalTorque
future = self._ros2_get_external_torque.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_external_torque Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = list(result.ext_torque) # Convert tuple to list
return ret
def get_tool_force(self, ref=None):
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_GetToolForce
req.ref = _ref
future = self._ros2_get_tool_force.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_tool_force Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = list(result.tool_force) # Convert tuple to list
return ret
def get_solution_space(self, pos):
_pos = get_posj(pos)
if __ROS2__:
req = self.req_GetSolutionSpace
req.pos = [float(x) for x in _pos]
future = self._ros2_get_solution_space.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_solution_space Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.sol_space
return ret
def get_orientation_error(self, xd, xc, axis):
# xd, xc
_xd = get_posx(xd)
_xc = get_posx(xc)
# axis
if type(axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if (axis != DR_AXIS_X and axis != DR_AXIS_Y and axis != DR_AXIS_Z and \
axis != DR_AXIS_A and axis != DR_AXIS_B and axis != DR_AXIS_C):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(axis))
if __ROS2__:
req = self.req_GetOrientationError
req.xd = [float(x) for x in _xd]
req.xc = [float(x) for x in _xc]
req.axis = axis
future = self._ros2_get_orientation_error.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_orientation_error Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.ori_error
return ret
##### MOTION ##############################################################################################################################
def trans(self, pos, delta, ref=None, ref_out=DR_BASE):
# pos, delta
_pos = get_posx(pos)
_delta = get_posx(delta)
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref != DR_BASE and _ref != DR_TOOL and _ref != DR_WORLD and (_ref < DR_TC_USER_MIN or _ref > DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# check ref_out
if type(ref_out) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref_out")
if ref_out != DR_BASE and ref_out != DR_WORLD and (ref_out < DR_TC_USER_MIN or ref_out > DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref_out({0})".format(ref_out))
# ROS service call
if __ROS2__:
req = self.req_Trans
req.pos = [float(x) for x in _pos]
req.delta = [float(x) for x in _delta]
req.ref = _ref
req.ref_out = ref_out
future = self._ros2_trans.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('trans Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.trans_pos
return ret
def fkin(self, pos, ref=None):
_pos = get_posj(pos)
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# ROS service call
if __ROS2__:
req = self.req_Fkin
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = self._ros2_fkin.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('fkin Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.conv_posx
return ret
def ikin(self, pos, sol_space, ref=None):
_pos = get_posx(pos)
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# sol_space
if type(sol_space) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : sol_space")
if sol_space < DR_SOL_MIN or sol_space > DR_SOL_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : sol_space({0})".format(sol_space))
# ROS service call
if __ROS2__:
req = self.req_Ikin
req.pos = [float(x) for x in _pos]
req.sol_space = sol_space
req.ref = _ref
future = self._ros2_ikin.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('ikin Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.conv_posj
return ret
def set_ref_coord(self, coord):
# coord
if type(coord) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : coord")
if coord != DR_BASE and coord != DR_TOOL and coord != DR_WORLD and not (DR_TC_USER_MIN <= coord <= DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : coord({0})".format(coord))
# ROS service call
if __ROS2__:
req = self.req_SetRefCoord
req.coord = coord
future = self._ros2_set_ref_coord.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_ref_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
# set global accx
global _g_coord
_g_coord = coord
#print_result("{0} = set_ref_coord(coord:{1})".format(ret, coord))
return ret
def movej(self, pos, vel=None, acc=None, time=None, radius=None, mod= DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None):
ret = self._movej(pos, vel, acc, time, radius, mod, ra, v, a, t, r, _async=0)
return ret
def amovej(self, pos, vel=None, acc=None, time=None, radius=None, mod= DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None):
ret = self._movej(pos, vel, acc, time, radius, mod, ra, v, a, t, r, _async=1)
return ret
def _movej(self, pos, vel=None, acc=None, time=None, radius=None, mod= DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None, _async=0):
# _pos
_pos = get_posj(pos)
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = self._g_velj
else:
if type(temp) == int or type(temp) == float:
_vel = [temp] * DR_VELJ_DT_LEN
elif type(temp) == list and len(temp) == DR_VELJ_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = self._g_accj
else:
if type(temp) == int or type(temp) == float:
_acc = [temp] * DR_ACCJ_DT_LEN
elif type(temp) == list and len(temp) == DR_ACCJ_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_joint(_vel, _acc, _time)
# _radius
_radius = get_param(radius, r)
if _radius == None:
#for ros global _g_blend_state
if self._g_blend_state == True:
_radius = self._g_blend_radius
else:
_radius = 0.0
if type(_radius) != int and type(_radius) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : radius, r")
if _radius< 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : radius, r")
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# ra
if type(ra) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ra")
if ra != DR_MV_RA_OVERRIDE and ra != DR_MV_RA_DUPLICATE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ra")
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
#SSS srv = self._ros_movej(_pos, _vel[0], _acc[0], _time, mod, _radius, ra, _async)
req = self.req_MoveJoint
#for i in range(6):
# req.pos[i] = pos[i]
req.pos = [float(x) for x in _pos]
req.vel = float(_vel[0])
req.acc = float(_acc[0])
req.time = float(_time)
req.mode = int(mod)
req.radius = float(_radius)
req.blend_type = int(ra)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = self._ros2_movej.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('movej Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_movej(_pos, _vel, _acc, _time, _radius, mod, ra, _async)
return ret
def movejx(self, pos, vel=None, acc=None, time=None, radius=None, ref=None, mod= DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, sol=0, v=None, a=None, t=None, r=None):
ret = _movejx(pos, vel, acc, time, radius, ref, mod, ra, sol, v, a, t, r, _async=0)
return ret
def amovejx(self, pos, vel=None, acc=None, time=None, radius=None, ref=None, mod= DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, sol=0, v=None, a=None, t=None, r=None):
ret = _movejx(pos, vel, acc, time, radius, ref, mod, ra, sol, v, a, t, r, _async=1)
return ret
def _movejx(self, pos, vel=None, acc=None, time=None, radius=None, ref=None, mod= DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, sol=0, v=None, a=None, t=None, r=None, _async=0):
# _pos
_pos = get_posx(pos)
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = self._g_velj
else:
if type(temp) == int or type(temp) == float:
_vel = [temp] * DR_VELJ_DT_LEN
elif type(temp) == list and len(temp) == DR_VELJ_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = self._g_accj
else:
if type(temp) == int or type(temp) == float:
_acc = [temp] * DR_ACCJ_DT_LEN
elif type(temp) == list and len(temp) == DR_ACCJ_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_joint(_vel, _acc, _time)
# _radius
_radius = get_param(radius, r)
if _radius == None:
if self._g_blend_state == True:
_radius = self._g_blend_radius
else:
_radius = 0.0
if type(_radius) != int and type(_radius) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : radius, r")
if _radius < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : radius, r")
# _ref
if ref == None:
_ref = self._g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# ra
if type(ra) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type, ra")
if ra != DR_MV_RA_OVERRIDE and ra != DR_MV_RA_DUPLICATE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ra")
# sol
if type(sol) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : sol")
if sol < DR_SOL_MIN or sol > DR_SOL_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : sol")
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
#srv = _ros_movejx(_pos, _vel[0], _acc[0], _time, mod, _ref, _radius, ra, sol, _async)
req = self.req_MoveJointx
req.pos = [float(x) for x in _pos]
req.vel = float(_vel[0])
req.acc = float(_acc[0])
req.time = float(_time)
req.mode = int(mod)
req.ref = int(_ref)
req.radius = float(_radius)
req.blend_type = int(ra)
req.sol = int(sol)
req.sync_type = int(_async)
#ret = srv.success
#ret = 0 if (srv.success == True) else -1
future = self._ros2_movejx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('movejx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_movejx(_pos, _vel, _acc, _time, _radius, _ref, mod, ra, sol, _async)
print_ext_result("{0} = PythonMgr.py_movejx(pos:{1}, vel:{2}, acc:{3}, time:{4}, radius:{5}, ref{6}, mod{7}, ra:{8}, sol:{9}, async:{10})" \
.format(ret, _pos, dr_form(_vel), dr_form(_acc), _time, _radius, _ref, mod, ra, sol, _async))
return ret
def movel(self, pos, vel=None, acc=None, time=None, radius=None, ref=None, mod=DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None):
ret = _movel(pos, vel, acc, time, radius, ref, mod, ra, v, a, t, r, _async=0)
return ret
def amovel(self, pos, vel=None, acc=None, time=None, radius=None, ref=None, mod=DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None):
ret = _movel(pos, vel, acc, time, radius, ref, mod, ra, v, a, t, r, _async=1)
return ret
def _movel(self, pos, vel=None, acc=None, time=None, radius=None, ref=None, mod=DR_MV_MOD_ABS, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None, _async=0):
# _pos
_pos = get_normal_pos(pos, def_type=posx)
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = self._g_velx
else:
if type(temp) == int or type(temp) == float:
#_vel = [temp] * DR_VELX_DT_LEN
_vel = [0] * DR_VELX_DT_LEN
_vel[0] = temp
_vel[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_VELX_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
#print("_vel[0]={0}, _vel[1]={1}".format(_vel[0],_vel[1]))
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = self._g_accx
else:
if type(temp) == int or type(temp) == float:
#_acc = [temp] * DR_ACCX_DT_LEN
_acc = [0] * DR_ACCX_DT_LEN
_acc[0] = temp
_acc[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_ACCX_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
#print("_acc[0]={0}, _acc[1]={1}".format(_acc[0],_acc[1]))
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_task(_vel, _acc, _time)
# _radius
_radius = get_param(radius, r)
if _radius == None:
if self._g_blend_state == True:
_radius = self._g_blend_radius
else:
_radius = 0.0
if type(_radius) != int and type(_radius) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : radius, r")
if _radius < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : radius, r")
# ref
if ref == None:
_ref = self._g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# ra
if type(ra) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ra")
if ra != DR_MV_RA_OVERRIDE and ra != DR_MV_RA_DUPLICATE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ra")
# qcommand
if type(_pos) == posx:
qcommand = 0
else:
qcommand = 1
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
req = self.req_MoveLine
req.pos = [float(x) for x in _pos]
req.vel = [float(x) for x in _vel]
req.acc = [float(x) for x in _acc]
req.time = float(_time)
req.radius = float(_radius)
req.ref = int(_ref)
req.mode = int(mod)
req.blend_type = int(ra)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = self._ros2_movel.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('movel Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_movel(_pos, _vel, _acc, _time, _radius, _ref, mod, ra, qcommand, _async)
print_ext_result("{0} = PythonMgr.py_movel(pos:{1}, vel:{2}, acc:{3}, time:{4}, radius:{5}, ref:{6}, mod:{7}, ra:{8}, qcommand:{9}, async:{10})" \
.format(ret, _pos, dr_form(_vel), dr_form(_acc), _time, _radius, _ref, mod, ra, qcommand, _async))
return ret
def movec(self, pos1, pos2, vel=None, acc=None, time=None, radius=None, ref=None, mod= DR_MV_MOD_ABS, angle=None, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None, an=None):
ret = _movec(pos1, pos2, vel, acc, time, radius, ref, mod, angle, ra, v, a, t, r, an, _async=0)
return ret
def amovec(self, pos1, pos2, vel=None, acc=None, time=None, radius=None, ref=None, mod= DR_MV_MOD_ABS, angle=None, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None, an=None):
ret = _movec(pos1, pos2, vel, acc, time, radius, ref, mod, angle, ra, v, a, t, r, an, _async=1)
return ret
def _movec(self, pos1, pos2, vel=None, acc=None, time=None, radius=None, ref=None, mod= DR_MV_MOD_ABS, angle=None, ra=DR_MV_RA_DUPLICATE, v=None, a=None, t=None, r=None, an=None, _async=0):
# _pos1, _pos2
_pos1 = get_normal_pos(pos1, def_type=posx)
_pos2 = get_normal_pos(pos2, def_type=posx)
if type(_pos1) != type(_pos2):
raise DR_Error(DR_ERROR_TYPE, "Invalid type : pos1, ps2")
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = self._g_velx
else:
if type(temp) == int or type(temp) == float:
#_vel = [temp] * DR_VELX_DT_LEN #<����> ���� �� �ΰ� ����
_vel = [0] * DR_VELX_DT_LEN #<����> _vel[0]=temp, _vel[1]= DR_COND_NONE
_vel[0] = temp
_vel[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_VELX_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = self._g_accx
else:
if type(temp) == int or type(temp) == float:
#_acc = [temp] * DR_ACCX_DT_LEN #<����> ���� �� �ΰ� ����
_acc = [0] * DR_ACCX_DT_LEN #<����> _acc[0]=temp, _acc[1]= DR_COND_NONE
_acc[0] = temp
_acc[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_ACCX_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_task(_vel, _acc, _time)
# _radius
_radius = get_param(radius, r)
if _radius == None:
if self._g_blend_state == True:
_radius = self._g_blend_radius
else:
_radius = 0.0
if type(_radius) != int and type(_radius) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : radius, r")
if _radius < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : radius, r")
# _ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# _angle
temp = get_param(angle, an)
if temp == None:
_angle = [0, 0]
else:
if type(temp) == int or type(temp) == float:
_angle = [temp, 0]
elif type(temp) == list and len(temp) == DR_ANGLE_DT_LEN:
_angle = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : angle, an")
if is_number(_angle) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : angle, an")
for item in _angle:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : angle, an")
# ra
if type(ra) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ra")
if ra != DR_MV_RA_OVERRIDE and ra != DR_MV_RA_DUPLICATE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ra")
# qcommand
if type(_pos1) == posx:
qcommand = 0
else:
qcommand = 1
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
# make multi pos
_circle_pos = _ros_listToFloat64MultiArray([_pos1, _pos2])
#_circle_pos = _ros_listToFloat64MultiArray([ [float(x) for x in _pos1], [float(x) for x in _pos2] ])
#print(_circle_pos)
#srv = _ros_movec(_circle_pos, _vel, _acc, _time, mod, _ref, _angle[0], _angle[1], _radius, ra, _async)
req = self.req_MoveCircle
req.pos = _circle_pos #??? 검증필요!
req.vel = [float(x) for x in _vel]
req.acc = [float(x) for x in _acc]
req.time = float(_time)
req.radius = float(_radius)
req.ref = int(_ref)
req.mode = int(mod)
req.angle1 = float(_angle[0])
req.angle2 = float(_angle[1])
req.blend_type = int(ra)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = self._ros2_movec.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('movec Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_movec(_pos1, _pos2, _vel, _acc, _time, _radius, _ref, mod, _angle, ra, qcommand, _async)
print_ext_result("{0} = PythonMgr.py_movec(pos1:{1}, pos2:{2}, vel:{3}, acc:{4}, time:{5}, radius:{6}, ref:{7}, mod:{8}, angle:{9}, ra:{10}, qcommand:{11}, async:{12})" \
.format(ret, _pos1, _pos2, dr_form(_vel), dr_form(_acc), _time, _radius, _ref, mod, dr_form(_angle), ra, qcommand, _async))
return ret
def movesj(self, pos_list, vel=None, acc=None, time=None, mod= DR_MV_MOD_ABS, v=None, a=None, t=None):
ret = _movesj(pos_list, vel, acc, time, mod, v, a, t, _async=0)
return ret
def amovesj(self, pos_list, vel=None, acc=None, time=None, mod= DR_MV_MOD_ABS, v=None, a=None, t=None):
ret = _movesj(pos_list, vel, acc, time, mod, v, a, t, _async=1)
return ret
def _movesj(self, pos_list, vel=None, acc=None, time=None, mod= DR_MV_MOD_ABS, v=None, a=None, t=None, _async=0):
# pos_list
if type(pos_list) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : pos_list")
for item in pos_list:
if type(item) != posj:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : pos_list [item]")
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = self._g_velj
else:
if type(temp) == int or type(temp) == float:
_vel = [temp] * DR_VELJ_DT_LEN
elif type(temp) == list and len(temp) == DR_VELJ_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = self._g_accj
else:
if type(temp) == int or type(temp) == float:
_acc = [temp] * DR_ACCJ_DT_LEN
elif type(temp) == list and len(temp) == DR_ACCJ_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_joint(_vel, _acc, _time)
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
# make multi pos
_spline_posj = _ros_listToFloat64MultiArray(pos_list)
#srv = _ros_movesj(_spline_posj, len(_spline_posj), _vel, _acc, _time, mod, _async)
req = self.req_MoveSplineJoint
req.pos = _spline_posj #??? 검증필요!
req.pos_cnt = len(_spline_posj)
if type(_vel) == list:
_vel = float(_vel[0])
if type(_acc) == list:
_acc = float(_acc[0])
req.vel = _vel #[float(x) for x in _vel]
req.acc = _acc #[float(x) for x in _acc]
req.time = float(_time)
req.mode = int(mod)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = self._ros2_movesj.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('movesj Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_movesj(pos_list, _vel, _acc, _time, mod, _async)
print_ext_result("{0} = PythonMgr.py_movesj(pos_list:{1}, vel:{2}, acc:{3}, time:{4}, mod:{5} async:{6})" \
.format(ret, dr_form(pos_list), dr_form(_vel), dr_form(_acc), _time, mod, _async))
return ret
def movesx(self, pos_list, vel=None, acc=None, time=None, ref=None, mod= DR_MV_MOD_ABS, vel_opt=DR_MVS_VEL_NONE, v=None, a=None, t=None):
ret = _movesx(pos_list, vel, acc, time, ref, mod, vel_opt, v, a, t, _async=0)
return ret
def amovesx(self, pos_list, vel=None, acc=None, time=None, ref=None, mod= DR_MV_MOD_ABS, vel_opt=DR_MVS_VEL_NONE, v=None, a=None, t=None):
ret = _movesx(pos_list, vel, acc, time, ref, mod, vel_opt, v, a, t, _async=1)
return ret
def _movesx(self, pos_list, vel=None, acc=None, time=None, ref=None, mod= DR_MV_MOD_ABS, vel_opt=DR_MVS_VEL_NONE, v=None, a=None, t=None, _async=0):
# pos_list
if type(pos_list) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : pos_list")
for item in pos_list:
if type(item) != posx:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : pos_list [item]")
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = self._g_velx
else:
if type(temp) == int or type(temp) == float:
#_vel = [temp] * DR_VELX_DT_LEN #<����> ���� �� �ΰ� ����
_vel = [0] * DR_VELX_DT_LEN #<����> _vel[0]=temp, _vel[1]= DR_COND_NONE
_vel[0] = temp
_vel[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_VELX_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = self._g_accx
else:
if type(temp) == int or type(temp) == float:
#_acc = [temp] * DR_ACCX_DT_LEN #<����> ���� �� �ΰ� ����
_acc = [0] * DR_ACCX_DT_LEN #<����> _acc[0]=temp, _acc[1]= DR_COND_NONE
_acc[0] = temp
_acc[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_ACCX_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_task(_vel, _acc, _time)
# _ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# vel_opt
if type(vel_opt) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel_opt")
if vel_opt != DR_MVS_VEL_NONE and vel_opt != DR_MVS_VEL_CONST:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel_opt")
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
# make multi pos
_spline_posx = _ros_listToFloat64MultiArray(pos_list)
#srv = _ros_movesx(_spline_posx, len(_spline_posx), _vel, _acc, _time, mod, _ref, vel_opt, _async)
req = self.req_MoveSplineTask
req.pos = _spline_posx #??? 검증필요!
req.pos_cnt = len(_spline_posx)
req.vel = [float(x) for x in _vel]
req.acc = [float(x) for x in _acc]
req.time = float(_time)
req.ref = int(_ref)
req.mode = int(mod)
req.opt = int(vel_opt)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = self._ros2_movesx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('movesx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_movesx(pos_list, _vel, _acc, _time, _ref, mod, vel_opt, _async)
print_ext_result("{0} = PythonMgr.py_movesx(pos_list:{1}, vel:{2}, acc:{3}, time:{4}, ref:{5}, mod:{6}, vel_opt:{7}, async:{8})" \
.format(ret, dr_form(pos_list), dr_form(_vel), dr_form(_acc), _time, _ref, mod, vel_opt, _async))
return ret
def moveb(self, seg_list, vel=None, acc=None, ref=None, time=None, mod=DR_MV_MOD_ABS, v=None, a=None, t=None):
ret = _moveb(seg_list, vel, acc, ref, time, mod, v, a, t, _async=0)
return ret
def amoveb(self, seg_list, vel=None, acc=None, ref=None, time=None, mod=DR_MV_MOD_ABS, v=None, a=None, t=None):
ret = _moveb(seg_list, vel, acc, ref, time, mod, v, a, t, _async=1)
return ret
def _moveb(self, seg_list, vel=None, acc=None, ref=None, time=None, mod=DR_MV_MOD_ABS, v=None, a=None, t=None, _async=0):
# seg_list
if type(seg_list) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : seg_list")
if len(seg_list) == 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : seg_list")
_seg_list = []
if __ROS2__:
for seg in seg_list:
_seg_list.append(seg.to_list())
else:
for seg in seg_list:
if type(seg) != posb:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : seg_list(item)")
else:
_seg_list.append(seg.to_list())
if __ROS2__:
print(len(_seg_list))
_ros_seg_list = []
_tmp_list = []
for s in range(0, len(_seg_list)):
#print(s)
for elemnt in range(0, len(_seg_list[s])):
if _seg_list[s][elemnt] == None:
_seg_list[s][elemnt] = [0.0]*POINT_COUNT
# make [pos1] + [pos2] + [type] + [radius]
_tmp_list = _seg_list[s][1] + _seg_list[s][2] + [_seg_list[s][0]] + [_seg_list[s][3]]
_ros_seg_list.append(_tmp_list)
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = self._g_velx
else:
if type(temp) == int or type(temp) == float:
#_vel = [temp] * DR_VELX_DT_LEN #<����> ���� �� �ΰ� ����
_vel = [0] * DR_VELX_DT_LEN #<����> _vel[0]=temp, _vel[1]= DR_COND_NONE
_vel[0] = temp
_vel[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_VELX_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = self._g_accx
else:
if type(temp) == int or type(temp) == float:
#_acc = [temp] * DR_ACCX_DT_LEN #<����> ���� �� �ΰ� ����
_acc = [0] * DR_ACCX_DT_LEN #<����> _acc[0]=temp, _acc[1]= DR_COND_NONE
_acc[0] = temp
_acc[1] = DR_COND_NONE
elif type(temp) == list and len(temp) == DR_ACCX_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
#if item < 0:
if (item < 0) and (item != DR_COND_NONE):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_task(_vel, _acc, _time)
# ref
if ref == None:
_ref = self._g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
# _async
if 1 == _async:
_radius = 0
# ROS Service call
if __ROS2__:
seg = _ros_listToFloat64MultiArray(_ros_seg_list)
#srv = _ros_moveb(seg, len(_ros_seg_list), _vel, _acc, _time, mod, _ref, _async)
req = self.req_MoveBlending
req.segment = seg #??? 검증필요!
req.pos_cnt = len(_ros_seg_list)
req.vel = [float(x) for x in _vel]
req.acc = [float(x) for x in _acc]
req.time = float(_time)
req.ref = int(_ref)
req.mode = int(mod)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = self._ros2_moveb.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('moveb Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_moveb(_seg_list, _vel, _acc, _time, _ref, mod, _async)
print_ext_result("{0} = PythonMgr.py_moveb(seg_list:{1}, vel:{2}, acc:{3}, time:{4}, ref:{5}, mod:{6}, async:{7})" \
.format(ret, dr_form(_seg_list), dr_form(_vel), dr_form(_acc), _time, _ref, mod, _async))
return ret
def move_spiral(self, rev=10, rmax=10, lmax=0, vel=None, acc=None, time=None, axis=DR_AXIS_Z, ref=DR_TOOL, v=None, a=None, t=None):
ret = _move_spiral(rev, rmax, lmax, vel, acc, time, axis, ref, v, a, t, _async=0)
return ret
def amove_spiral(self, rev=10, rmax=10, lmax=0, vel=None, acc=None, time=None, axis=DR_AXIS_Z, ref=DR_TOOL, v=None, a=None, t=None):
ret = _move_spiral(rev, rmax, lmax, vel, acc, time, axis, ref, v, a, t, _async=1)
return ret
def _move_spiral(self, rev=10, rmax=10, lmax=0, vel=None, acc=None, time=None, axis=DR_AXIS_Z, ref=DR_TOOL, v=None, a=None, t=None, _async=0):
# rev
if type(rev) != int and type(rev) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : rev")
if rev <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : rev (Ranges: rev > 0)")
# rmax
if type(rmax) != int and type(rmax) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : rmax")
if rmax <= 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: rmax (Ranges: rmax > 0)")
# lmax
if type(lmax) != int and type(lmax) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : lmax")
# _vel
temp = get_param(vel, v)
if temp == None:
_vel = self._g_velx
else:
if type(temp) == int or type(temp) == float:
_vel = [temp] * DR_VELX_DT_LEN
elif type(temp) == list and len(temp) == DR_VELX_DT_LEN:
_vel = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vel, v")
if is_number(_vel) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
for item in _vel:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vel, v")
# _acc
temp = get_param(acc, a)
if temp == None:
_acc = self._g_accx
else:
if type(temp) == int or type(temp) == float:
_acc = [temp] * DR_ACCX_DT_LEN
elif type(temp) == list and len(temp) == DR_ACCX_DT_LEN:
_acc = temp
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : acc, a")
if is_number(_acc) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
for item in _acc:
if item < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : acc, a")
# _time
_time = get_param(time, t)
if _time == None:
_time = 0.0
if type(_time) != int and type(_time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time, t")
if _time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time, t")
# check vel, acc, time
#_check_valid_vel_acc(_vel, _acc, _time)
_check_valid_vel_acc_joint(_vel, _acc, _time)
# axis
if type(axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if axis != DR_AXIS_X and axis != DR_AXIS_Y and axis != DR_AXIS_Z:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis")
# ref
if type(ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if ref != DR_BASE and ref != DR_TOOL and (ref < DR_TC_USER_MIN or ref > DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
#srv = _ros_move_spiral(rev, rmax, lmax, _vel, _acc, _time, axis, ref, _async)
req = self.req_MoveSpiral
req.revolution = float(rev)
req.max_radius = float(rmax)
req.max_length = float(lmax)
req.vel = [float(x) for x in _vel]
req.acc = [float(x) for x in _acc]
req.time = float(_time)
req.task_axis = int(axis)
req.ref = int(ref)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = self._ros2_move_spiral.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('move_spiral Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_move_spiral(rev, rmax, lmax, _vel, _acc, _time, axis, ref, _async)
print_ext_result("{0} = PythonMgr.py_move_spiral(rev:{1}, rmax:{2}, lmax:{3}, vel:{4}, acc:{5}, time:{6}, axis:{7}, ref:{8}, async:{9})" \
.format(ret, dr_form(rev), dr_form(rmax), dr_form(lmax), dr_form(_vel), dr_form(_acc), _time, axis, ref, _async))
return ret
def move_periodic(self, amp, period, atime=None, repeat=None, ref=DR_TOOL):
ret = _move_periodic(amp, period, atime, repeat, ref, _async=0)
return ret
def amove_periodic(self, amp, period, atime=None, repeat=None, ref=DR_TOOL):
ret = _move_periodic(amp, period, atime, repeat, ref, _async=1)
return ret
def _move_periodic(self, amp, period, atime=None, repeat=None, ref=DR_TOOL, _async=0):
_amp = [POINT_COUNT]
_period = [POINT_COUNT]
_atime =0.0
_repeat =0.0
_ref=0
# amp : float[6]
if type(amp) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : amp")
if len(amp) != POINT_COUNT:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : amp")
_amp =amp
# period : float or float[6]
if (type(period) != int) and (type(period) != float) and (type(period) != list):
raise DR_Error(DR_ERROR_TYPE, "Invalid type : period")
if (type(period) == int) or (type(period) == float):
_period = [period] * POINT_COUNT
else: #list �� ���
if len(period) != POINT_COUNT:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : period")
_period = period
# atime
if atime == None:
_atime = 0.0
else:
if (type(atime) != int) and (type(atime) != float):
raise DR_Error(DR_ERROR_TYPE, "Invalid type : atime")
if atime < 0.0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : atime")
_atime = atime
# repeat
if repeat == None:
_repeat = 1
else:
if (type(repeat) != int) and (type(repeat) != float):
raise DR_Error(DR_ERROR_TYPE, "Invalid type : repeat")
if repeat < 0.0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : repeat")
_repeat = repeat
# ref
if ref == None:
#_ref = _g_coord
_ref = DR_TOOL
else:
if type(ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if ref < DR_BASE or ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref")
_ref = ref
# _async
if 1 == _async:
_radius = 0
# ROS service call
if __ROS2__:
#srv = _ros_move_periodic(_amp, _period, _atime, _repeat, _ref, _async)
req = self.req_MovePeriodic
req.amp = [float(x) for x in _amp]
req.periodic = [float(x) for x in _period]
req.acc = float(_atime)
req.repeat = int(_repeat)
req.ref = int(_ref)
req.sync_type = int(_async)
#RRR ret = 0 if (srv.success == True) else -1
future = self._ros2_move_periodic.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('move_periodic Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
ret = PythonMgr.py_move_periodic(_amp, _period, _atime, _repeat, _ref, _async)
print_ext_result("{0} = PythonMgr.move_periodic(amp:{1}, period:{2}, atime:{3}, repeat{4}, ref:{5}, async:{6})" \
.format(ret, dr_form(_amp), dr_form(_period), _atime, _repeat, _ref, _async))
return ret
def move_home(self, target=None):
# target
if target == None:
_target = DR_HOME_TARGET_MECHANIC
else:
_target = target
if __ROS2__:
req = self.req_MoveHome
req.target = _target
future = self._ros2_move_home.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('move_home Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return 0
def mwait(self, time=0):
ret = _move_wait(time)
return ret
def _move_wait(self, time):
if type(time) != int and type(time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time")
if time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time")
# ROS service call
if __ROS2__:
req = self.req_MoveWait #ROS 에서는 time 인자를 사용하지 않음.
future = self._ros2_move_wait.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('mwait Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def check_motion(self):
if __ROS2__:
req = self.req_CheckMotion
future = self._ros2_check_motion.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('check_motion Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.status
return ret
def change_operation_speed(self, speed):
if type(speed) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : speed")
if speed < DR_OP_SPEED_MIN or speed > DR_OP_SPEED_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : speed({0})".format(speed))
if __ROS2__:
req = self.req_ChangeOperationSpeed
req.speed = speed
future = self._ros2_change_operation_speed.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('change_operation_speed Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def enable_alter_motion(self, n, mode, ref=None, limit_dPOS=None, limit_dPOS_per=None):
# n
if type(n) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : n")
if n < 0:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : (n>=0)")
_n = n #*20
# mode
if mode < DR_DPOS or mode > DR_DVEL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mode({0})".format(mode))
_mode = mode
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref != DR_BASE and _ref != DR_TOOL and _ref != DR_WORLD and (_ref < DR_TC_USER_MIN or _ref > DR_TC_USER_MAX):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if(None==limit_dPOS):
_limit_dPOS = [DR_COND_NONE, DR_COND_NONE]
else:
_limit_dPOS = limit_dPOS
if(None==limit_dPOS_per):
_limit_dPOS_per = [DR_COND_NONE, DR_COND_NONE]
else:
_limit_dPOS_per = limit_dPOS_per
if __ROS2__:
req = self.req_EnableAlterMotion
req.n = _n
req.mode = _mode
req.ref = _ref
req.limit_dpos = [float(x) for x in _limit_dPOS]
req.limit_dpos_per = [float(x) for x in _limit_dPOS_per]
future = self._ros2_enable_alter_motion.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('enable_alter_motion Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def alter_motion(self, dposx):
# _dposx
if (type(dposx) == posx):
raise DR_Error(DR_ERROR_TYPE, "Invalid type : dposx")
_dposx = get_normal_pos(dposx, def_type=posx)
if __ROS2__:
req = self.req_AlterMotion
req.pos = [float(x) for x in _dposx]
future = self._ros2_alter_motion.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('alter_motion Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def disable_alter_motion(self):
if __ROS2__:
req = self.req_DisableAlterMotion
future = self._ros2_disable_alter_motion.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('disable_alter_motion Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_singular_handling(self, mode = DR_AVOID):
if type(mode) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mode")
if mode < DR_AVOID or mode > DR_VAR_VEL: #DR_TASK_STOP
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mode({0})".format(mode))
if __ROS2__:
req = self.req_SetSingularityHandling
req.mode = mode
future = self._ros2_set_singularity_handling.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_singular_handling Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_singularity_handling(self, mode = DR_AVOID):
ret = set_singular_handling(mode)
return ret
def jog(self, jog_axis, ref=0, speed=0):
if type(jog_axis) != int and type(jog_axis) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : jog_axis")
if type(ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if type(speed) != int and type(speed) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : speed")
# ROS service call
if __ROS2__:
req = self.req_Jog
req.jog_axis = jog_axis
req.move_reference = ref
req.speed = float(speed)
future = self._ros2_jog.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('jog Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def jog_multi(self, jog_axis_list, ref=0, speed=0):
if type(jog_axis_list) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : jog_axis_list")
if type(ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if type(speed) != int and type(speed) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : speed")
# ROS service call
if __ROS2__:
req = self.req_JogMulti
req.jog_axis = [float(x) for x in jog_axis_list]
req.move_reference = ref
req.speed = float(speed)
future = self._ros2_jog_multi.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('jog_multi Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
##### force/stiffness Control #########################################################################################################################
def get_workpiece_weight(self):
print("================================> get_workpiece_weight()")
if __ROS2__:
req = self.req_GetWorkpieceWeight
future = self._ros2_get_workpiece_weight.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_workpiece_weight Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.weight
return ret
def reset_workpiece_weight(self):
if __ROS2__:
req = self.req_ResetWorkpieceWeight
future = self._ros2_reset_workpiece_weight.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('reset_workpiece_weight Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def parallel_axis(self, *args, **kargs):
len_args = len(args)
len_kargs = len(kargs)
_nType = 0
# check kargs.key
for key in kargs.keys():
if key != "x1" and key != "x2" and key != "x3" and key != "vect" and key != "axis" and key != "ref":
raise DR_Error(DR_ERROR_TYPE, "Invalid type : x1, x2, x3, vect, axis, ref")
# get kargs
_x1 = get_kargs(kargs, "x1")
_x2 = get_kargs(kargs, "x2")
_x3 = get_kargs(kargs, "x3")
_vect = get_kargs(kargs, "vect")
_axis = get_kargs(kargs, "axis")
_ref = get_kargs(kargs, "ref")
# check parameter combination
if len_args == 0:
if len_kargs == 2:
if _vect == None or _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_kargs == 3:
_nType = 3
if _vect == None or _axis == None or _ref == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_kargs == 4:
if _x1 == None or _x2 == None or _x3 == None or _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_kargs == 5:
_nType = 2
if _x1 == None or _x2 == None or _x3 == None or _axis == None or _ref == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 1:
if len_kargs != 1:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_vect = args[0]
if _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 2:
if len_kargs == 1: # +ref
_nType = 3
_vect = args[0]
_axis = args[1]
else:
if len_kargs != 0:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_vect = args[0]
_axis = args[1]
elif len_args == 3:
if len_kargs == 0: # +ref
_nType = 3
_vect = args[0]
_axis = args[1]
_ref = args[2]
else:
if len_kargs != 1:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
if _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 4:
if len_kargs == 1: # + ref
_nType = 2
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_axis = args[3]
else:
if len_kargs != 0:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_axis = args[3]
elif len_args == 5:
if len_kargs == 0: # + ref
_nType = 2
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_axis = args[3]
_ref = args[4]
else:
if len_kargs != 0:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_axis = args[3]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
# check parameter type, value
if _x1 != None:
_x1 = get_posx(_x1)
_x2 = get_posx(_x2)
_x3 = get_posx(_x3)
else:
if type(_vect) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vect")
if len(_vect) != DR_VECTOR_DT_LEN:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vect({0})".format(_vect))
if type(_axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if _axis != DR_AXIS_X and _axis != DR_AXIS_Y and _axis != DR_AXIS_Z:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(_axis))
if _nType == 2: # with ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_ParallelAxis1
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.axis = _axis
req.ref = _ref
future = self._ros2_parallel_axis1.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('parallel_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
elif _nType == 3: # with ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_ParallelAxis2
req.vect = [float(x) for x in _vect]
req.axis = _axis
req.ref = _ref
future = self._ros2_parallel_axis2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('parallel_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else: # 기존
_ref = DR_BASE
if _x1 != None:
if __ROS2__:
req = self.req_ParallelAxis1
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.axis = _axis
req.ref = _ref
future = self._ros2_parallel_axis1.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('parallel_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
if __ROS2__:
req = ParallelAxis2.Request()
req._vect = vect
req._axis = axis
req.ref = _ref
future = self._ros2_parallel_axis2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('parallel_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def align_axis(self, *args, **kargs):
len_args = len(args)
len_kargs = len(kargs)
_nType = 0
# check kargs.key
for key in kargs.keys():
if key != "x1" and key != "x2" and key != "x3" and key != "vect" and key != "pos" and key != "axis" and key != "ref":
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
# get kargs
_x1 = get_kargs(kargs, "x1")
_x2 = get_kargs(kargs, "x2")
_x3 = get_kargs(kargs, "x3")
_vect = get_kargs(kargs, "vect")
_pos = get_kargs(kargs, "pos")
_axis = get_kargs(kargs, "axis")
_ref = get_kargs(kargs, "ref")
# check parameter combination
if len_args == 0:
if len_kargs == 3:
if _vect == None or _pos == None or _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_kargs == 5:
if _x1 == None or _x2 == None or _x3 == None or _pos == None or _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_kargs == 6:
_nType = 2
if _x1 == None or _x2 == None or _x3 == None or _pos == None or _axis == None or _ref == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_kargs == 4:
_nType = 3
if _vect == None or _pos == None or _axis == None or _ref == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 1:
if len_kargs != 2:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_vect = args[0]
if _pos == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
if _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 2:
if len_kargs != 1:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_vect = args[0]
_pos = args[1]
if _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 3:
if len_kargs == 0:
_vect = args[0]
_pos = args[1]
_axis = args[2]
elif len_kargs == 1:
_nType = 3
_vect = args[0]
_pos = args[1]
_axis = args[2]
elif len_kargs == 2:
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
if _pos == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
if _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 4:
if len_kargs == 0:
_nType = 3
_vect = args[0]
_pos = args[1]
_axis = args[2]
_ref = args[3]
else:
if len_kargs != 1:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos = args[3]
if _axis == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 5:
if len_kargs == 0:
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos = args[3]
_axis = args[4]
elif len_kargs == 1: # + ref
_nType = 2
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos = args[3]
_axis = args[4]
elif len_args == 6:
if len_kargs != 0:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 2
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos = args[3]
_axis = args[4]
_ref = args[5]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
# check parameter type, value
if _x1 != None:
_x1 = get_posx(_x1)
_x2 = get_posx(_x2)
_x3 = get_posx(_x3)
else:
if type(_vect) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : vect")
if len(_vect) != DR_VECTOR_DT_LEN:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : vect({0})".format(_vect))
norm_pos = get_posx(_pos)
if type(_axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if _axis != DR_AXIS_X and _axis != DR_AXIS_Y and _axis != DR_AXIS_Z:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(_axis))
if _nType == 2: # with ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_AlignAxis1
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.pos = [float(x) for x in norm_pos]
req.axis = _axis
req.ref = _ref
future = self._ros2_align_axis1.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('align_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
elif _nType == 3: # with ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_AlignAxis2
req.vect = [float(x) for x in _vect]
req.pos = [float(x) for x in norm_pos]
req.axis = _axis
req.ref = _ref
future = self._ros2_align_axis2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('align_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else: # 기존
_ref = DR_BASE
if _x1 != None:
if __ROS2__:
req = self.req_AlignAxis1
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.pos = [float(x) for x in norm_pos]
req.axis = _axis
req.ref = _ref
future = self._ros2_align_axis1.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('align_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
if __ROS2__:
req = self.req_AlignAxis2
req.vect = [float(x) for x in _vect]
req.pos = [float(x) for x in norm_pos]
req.axis = _axis
req.ref = _ref
future = _ros2_align_axis2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('align_axis Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def is_done_bolt_tightening(self, m=0, timeout=0, axis=None):
# m
if type(m) != int and type(m) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : m")
# timeout
if type(timeout) != int and type(timeout) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : timeout")
if timeout < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : timeout({0})".format(timeout))
# axis
if type(axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if axis != DR_AXIS_X and axis != DR_AXIS_Y and axis != DR_AXIS_Z:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(axis))
if __ROS2__:
req = self.req_IsDoneBoltTightening
req.m = float(m)
req.timeout = float(timeout)
req.axis = axis
future = self._ros2_is_done_bolt_tightening.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('is_done_bolt_tightening Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def release_compliance_ctrl(self):
if __ROS2__:
req = self.req_ReleaseComplianceCtrl
future = self._ros2_release_compliance_ctrl.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('release_compliance_ctrl Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def task_compliance_ctrl(self, stx=[3000, 3000, 3000, 200, 200, 200], time=0):
# st
if type(stx) != list or len(stx) != 6:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : stx")
if is_number(stx) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : stx({0})".format(stx))
# _ref
_ref = _g_coord
# time
if type(time) != int and type(time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time")
if time != -1 and time < 0: # -1 : motion default
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time({0})".format(time))
if time > 1:
_time = 1
else:
_time = time
if __ROS2__:
req = self.req_TaskComplianceCtrl
req.stx = [float(x) for x in stx]
req.ref = _ref
req.time = float(_time)
future = self._ros2_task_compliance_ctrl.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('task_compliance_ctrl Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_stiffnessx(self, stx=[500, 500, 500, 100, 100, 100], time=0):
# st
if type(stx) != list or len(stx) != 6:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : stx")
if is_number(stx) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : stx({0})".format(stx))
# _ref
_ref = _g_coord
# time
if type(time) != int and type(time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time")
if time != -1 and time < 0: # -1 : motion default
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time({0})".format(time))
if time > 1:
_time = 1
else:
_time = time
if __ROS2__:
req = self.req_SetStiffnessx
req.stx = [float(x) for x in stx]
req.ref = _ref
req.time = float(_time)
future = self._ros2_set_stiffnessx.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_stiffnessx Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def calc_coord(self, *args, **kargs):
#arg(x1, ref, mod) arg =0 , kargs =3 _nType=1
#arg(x1, x2, ref, mod) arg =0 , kargs =4 _nType=2
#arg(x1, x2, x3, ref, mod) arg =0 , kargs =5 _nType=3
#arg(x1, x2, x3, x4, ref, mod) arg =0 , kargs =6 _nType=4
#arg(?, ref, mod) arg =1 , kargs =2 _nType=1
#arg(?, ?, ref, mod) arg =2 , kargs =2 _nType=2
#arg(?, ?, ?, ref, mod) arg =3 , kargs =2 _nType=3
#arg(?, ?, ?, ?, ref, mod) arg =4 , kargs =2 _nType=4
#arg(?, ?, ?) arg =3 , kargs =0 _nType=1
#arg(?, ?, ?, ?) arg =4 , kargs =0 _nType=2
#arg(?, ?, ?, ?, ?) arg =5 , kargs =0 _nType=3
#arg(?, ?, ?, ?, ?, ?) arg =6 , kargs =0 _nType=4
len_args = len(args)
len_kargs = len(kargs)
_cnt_pos = 0
# check kargs.key
for key in kargs.keys():
if key != "x1" and key != "x2" and key != "x3" and key != "x4" and key != "ref" and key != "mod":
raise DR_Error(DR_ERROR_TYPE, "Invalid type : x1, x2, x3, x4, ref, mod")
# get kargs
_x1 = get_kargs(kargs, "x1")
_x2 = get_kargs(kargs, "x2")
_x3 = get_kargs(kargs, "x3")
_x4 = get_kargs(kargs, "x4")
_ref = get_kargs(kargs, "ref")
_mod = get_kargs(kargs, "mod")
if(_x1 == None):
_x1 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
if(_x2 == None):
_x2 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
if(_x3 == None):
_x3 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
if(_x4 == None):
_x4 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
if len_args == 0 and len_kargs ==3:
_cnt_pos = 1
print("x1={}, ref={}, mod={}".format(_x1, _ref, _mod))
elif len_args == 0 and len_kargs ==4:
_cnt_pos = 2
print("x1={}, x2={}, ref={}, mod={}".format(_x1, _x2, _ref, _mod))
elif len_args == 0 and len_kargs ==5:
_cnt_pos = 3
print("x1={}, x2={}, x3={}, ref={}, mod={}".format(_x1, _x2, _x3, _ref, _mod))
elif len_args == 0 and len_kargs ==6:
_cnt_pos = 4
print("x1={}, x2={}, x3={}, x4={}, ref={}, mod={}".format(_x1, _x2, _x3, _x4, _ref, _mod))
elif len_args == 1 and len_kargs ==2:
_cnt_pos = 1
_x1 = args[0]
print("x1={}, ref={}, mod={}".format(_x1, _ref, _mod))
elif len_args == 2 and len_kargs ==2:
_cnt_pos = 2
_x1 = args[0]
_x2 = args[1]
print("x1={}, x2={}, ref={}, mod={}".format(_x1, _x2, _ref, _mod))
elif len_args == 3 and len_kargs ==2:
_cnt_pos = 3
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
print("x1={}, x2={}, x3={}, ref={}, mod={}".format(_x1, _x2, _x3, _ref, _mod))
elif len_args == 4 and len_kargs ==2:
_cnt_pos = 4
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_x4 = args[3]
print("x1={}, x2={}, x3={}, x4={}, ref={}, mod={}".format(_x1, _x2, _x3, _x4, _ref, _mod))
elif len_args == 3 and len_kargs ==0:
_cnt_pos = 1
_x1 = args[0]
_ref =args[1]
_mod =args[2]
print("x1={}, ref={}, mod={}".format(_x1, _ref, _mod))
elif len_args == 4 and len_kargs ==0:
_cnt_pos = 2
_x1 = args[0]
_x2 = args[1]
_ref =args[2]
_mod =args[3]
print("x1={}, x2={}, ref={}, mod={}".format(_x1, _x2, _ref, _mod))
elif len_args == 5 and len_kargs ==0:
_cnt_pos = 3
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_ref =args[3]
_mod =args[4]
print("x1={}, x2={}, x3={}, ref={}, mod={}".format(_x1, _x2, _x3, _ref, _mod))
elif len_args == 6 and len_kargs ==0:
_cnt_pos = 4
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_x4 = args[3]
_ref =args[4]
_mod =args[5]
print("x1={}, x2={}, x3={}, x4={}, ref={}, mod={}".format(_x1, _x2, _x3, _x4, _ref, _mod))
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid arguments")
print("FINAL : x1={}, x2={}, x3={}, x4={}, ref={}, mod={}".format(_x1, _x2, _x3, _x4, _ref, _mod))
# check parameter type, value
if _x1 != None:
_x1 = get_posx(_x1)
if _x2 != None:
_x2 = get_posx(_x2)
if _x3 != None:
_x3 = get_posx(_x3)
if _x4 != None:
_x4 = get_posx(_x4)
if _ref !=None:
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if _mod != None:
if _mod != 0 and _mod != 1:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod({0})".format(_mod))
if __ROS2__:
req = self.req_CalcCoord
req.input_pos_cnt = _cnt_pos
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.x4 = [float(x) for x in _x4]
req.ref = _ref
req.mod = _mod
future = self._ros2_calc_coord.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('calc_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
pos = list(result.conv_posx) # Convert tuple to list
conv_posx = posx(pos)
ret = pos
return ret
def set_user_cart_coord(self, *args, **kargs):
len_args = len(args)
len_kargs = len(kargs)
_nType =0
# check kargs.key
for key in kargs.keys():
if key != "x1" and key != "x2" and key != "x3" and key != "pos" and key != "u1" and key != "v1" and key != "v1" and key != "ref":
raise DR_Error(DR_ERROR_TYPE, "Invalid type : x1, x2, x3, pos, u1, v1, ref")
# get kargs
_x1 = get_kargs(kargs, "x1")
_x2 = get_kargs(kargs, "x2")
_x3 = get_kargs(kargs, "x3")
_pos= get_kargs(kargs, "pos")
_u1 = get_kargs(kargs, "u1")
_v1 = get_kargs(kargs, "v1")
_ref = get_kargs(kargs, "ref")
# check parameter combination
#set_user_cart_coord(x1=?, x2=?, x3=?, pos=?) arg =0 , kargs =4 _nType=0
#set_user_cart_coord(u1=?, v1=?, pos=?) arg =0 , kargs =3 * _nType=1
#set_user_cart_coord(x1=?, x2=?, x3=?) arg =0 , kargs =3 * _nType=2
#set_user_cart_coord(x1=?, x2=?, x3=?, ?) arg =1 , kargs =3 _nType=0
#set_user_cart_coord(u1=?, v1=?, ?) arg =1 , kargs =2 _nType=1
#set_user_cart_coord(?, ?, pos=?) arg =2 , kargs =1 _nType=1
#set_user_cart_coord(?, ?, ?, pos=?) arg =3 , kargs =1 _nType=0
#set_user_cart_coord(?, ?, ?) arg =3 , kargs =0 * _nType=1
#set_user_cart_coord(?, ?, ?) arg =3 , kargs =0 * _nType=2
#set_user_cart_coord(?, ?, ?, ?) arg =4 , kargs =0 _nType=0
#----- 신규 추가 명령 2019/11/27 ----------------------------------------------------------------------------------------------------------------
#set_user_cart_coord(pos=?, ref=?) arg =0 , kargs =2 _nType=5
#set_user_cart_coord(pos=?, ?) arg =1 , kargs =1 * _nType=5 #python syntax error : positional argument follows keyword argument
#set_user_cart_coord(?, ref=?) arg =1 , kargs =1 * _nType=5
#set_user_cart_coord(?, ?) arg =2 , kargs =0 _nType=5
#------------------------------------------------------------------------------------------------------------------------------------------------
if len_args == 0 and len_kargs ==2:
print("new commnad len_args == 0 and len_kargs ==2")
#_pos
#_ref
print("_pos={},_ref={}".format(_pos, _ref))
_nType = 5
elif len_args == 1 and len_kargs ==1:
print("new commnad len_args == 1 and len_kargs ==1")
_pos = args[0]
#_ref
print("_pos={},_ref={}".format(_pos, _ref))
_nType = 5
elif len_args == 2 and len_kargs ==0:
print("new commnad len_args == 2 and len_kargs ==0")
_pos = args[0]
_ref = args[1]
print("_pos={},_ref={}".format(_pos, _ref))
_nType = 5
else:
if len_args == 0:
if len_kargs == 5:
if _x1 == None or _x2 == None or _x3 == None or _pos == None or _ref == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 3
elif len_kargs == 4:
if _ref != None:
_nType = 4
else:
if _x1 == None or _x2 == None or _x3 == None or _pos == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 0
elif len_kargs == 3:
if _u1 != None:
if _v1 == None or _pos == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 1
elif _x1 != None:
if _x2 == None or _x3 == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 2
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 1:
if len_kargs == 3:
if _x1 == None or _x2 == None or _x3 == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 0
_pos= args[0]
elif len_kargs == 2:
if _u1 == None or _v1 == None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
_nType = 1
_pos= args[0]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 2:
if len_kargs == 1:
if _pos != None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
_nType = 1
_u1 = args[0]
_v1 = args[1]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 3:
if len_kargs == 1:
if _ref != None:
_nType = 4
_u1 = args[0]
_v1 = args[1]
_pos = args[2]
else:
if _pos != None:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
_nType = 0
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
elif len_kargs == 0:
if len(args[0]) == 3:
_nType = 1
_u1 = args[0]
_v1 = args[1]
_pos= args[2]
elif len(args[0]) == 6:
_nType = 2
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 4:
if len_kargs == 0:
_nType = 0
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos= args[3]
elif len_kargs == 1:
_nType = 3
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos= args[3]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
elif len_args == 5:
if len_kargs == 0:
_nType = 0
_x1 = args[0]
_x2 = args[1]
_x3 = args[2]
_pos= args[3]
_ref= args[4]
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
# check parameter type, value
if _x1 != None:
_x1 = get_posx(_x1)
if _x2 != None:
_x2 = get_posx(_x2)
if _x3 != None:
_x3 = get_posx(_x3)
if _pos != None:
_pos = get_posx(_pos)
if _u1 !=None:
if type(_u1) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : u1")
if len(_u1) != DR_VECTOR_U1_LEN:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : u1({0})".format(_u1))
if _v1 !=None:
if type(_v1) != list:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : v1")
if len(_v1) != DR_VECTOR_V1_LEN:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : v1({0})".format(_v1))
if _nType == 0:
_ref = DR_BASE
if __ROS2__:
req = self.req_SetUserCartCoord2
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = self._ros2_set_user_cart_coord2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.id
elif _nType == 1:
_ref = DR_BASE
if __ROS2__:
req = SetUserCartCoord3.Request()
req.u1 = [float(x) for x in _u1]
req.v1 = [float(x) for x in _v1]
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = self._ros2_set_user_cart_coord3.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.id
elif _nType == 2: #현재 미사용
#_ref = DR_BASE
#if __:
# req = set_user_cart_coord?(_x1, _x2, _x3, _ref)
# ret = srv.id
#else:
# ret = PythonMgr.py_set_user_cart_coord_ex2(_x1, _x2, _x3, _ref)
# #print_ext_result("{0} = PythonMgr.py_set_user_cart_coord_ex2(x1:{1}, x2:{2}, x3:{3}, ref:{4})".format(ret, _x1, _x2, _x3, _ref))
pass
elif _nType == 3: # with ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_SetUserCartCoord2
req.x1 = [float(x) for x in _x1]
req.x2 = [float(x) for x in _x2]
req.x3 = [float(x) for x in _x3]
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = self._ros2_set_user_cart_coord2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.id
elif _nType == 4: # with ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = SetUserCartCoord3.Request()
req.u1 = [float(x) for x in _u1]
req.v1 = [float(x) for x in _v1]
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = self._ros2_set_user_cart_coord3.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.id
elif _nType == 5: # (pos, ref) 20191127 신규 추가
#print("new command !!!!!!!!!!!!!!!!")
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
if __ROS2__:
req = self.req_SetUserCartCoord1
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = self._ros2_set_user_cart_coord1.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.id
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid argument list")
return ret
def overwrite_user_cart_coord(self, id, pos, ref=None, gol=None):
# id
_id = id
# pos
_pos = get_posx(pos)
# ref
if ref == None:
_ref = DR_BASE
else:
_ref = ref
if _ref != DR_BASE and _ref != DR_WORLD:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# gol : #1 RCT 요청에 의하여 gol 무조건 0으로 변경 2019/12/09
#if gol == None:
# _gol = 0
#else:
# _gol = gol
# if _gol != 0 and _gol != 1:
# raise DR_Error(DR_ERROR_VALUE, "Invalid value : gol")
_gol = 0
if __ROS2__:
#req = overwrite_user_cart_coord(_id, _pos, _ref, _gol)
req = self.req_OverwriteUserCartCoord
req.id = _id
req.pos = [float(x) for x in _pos]
req.ref = _ref
future = self._ros2_overwrite_user_cart_coord.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('overwrite_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.id
return ret
def get_user_cart_coord(self, id):
print("==============================> get_user_cart_coord(id)")
if __ROS2__:
req = self.req_GetUserCartCoord
req.id = id
future = self._ros2_get_user_cart_coord.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_user_cart_coord Service call failed %r' % (e,))
else:
if result == None:
ret = -1, -1
else:
pos = list(result.conv_posx) # Convert tuple to list
ref = result.ref
conv_posx = posx(pos)
print("==============================> get_user_cart_coord(id) 555 conv_posx={}, ref={}".format(conv_posx, ref))
return conv_posx, ref
return 0
def set_desired_force(self, fd=[0, 0, 0, 0, 0, 0], dir=[0, 0, 0, 0, 0, 0], time=0, mod=DR_FC_MOD_ABS):
# df
if type(fd) != list or len(fd) != 6:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : fd")
if is_number(fd) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : fd({0})".format(fd))
# dir
if type(dir) != list or len(dir) != 6:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : dir")
if is_number(dir) != True:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : dir({0})".format(dir))
# _ref
_ref = _g_coord
# time
if type(time) != int and type(time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time")
if time != -1 and time < 0: # -1 : motion default
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time({0})".format(time))
if time > 1:
_time = 1
else:
_time = time
# _mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
_mod = mod
if __ROS2__:
req = self.req_SetDesiredForce
req.fd = [float(x) for x in fd]
req.dir = dir
req.ref = _ref
req.time = float(_time)
req.mod = _mod
future = self._ros2_set_desired_force.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_desired_force Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def release_force(self, time=0):
if type(time) != int and type(time) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : time")
if time != -1 and time < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : time({0})".format(time))
if time > 1:
_time = 1
else:
_time = time
if __ROS2__:
req = self.req_ReleaseForce
req.time = float(_time)
future = self._ros2_release_force.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('release_force Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
#def check_position_condition(axis, min=DR_COND_NONE, max=DR_COND_NONE, ref=None):
def check_position_condition(self, axis, min=DR_COND_NONE, max=DR_COND_NONE, ref=None, mod= DR_MV_MOD_ABS, pos=None):
# axis
if type(axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if (axis != DR_AXIS_X and axis != DR_AXIS_Y and axis != DR_AXIS_Z):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(axis))
# min
if type(min) != int and type(min) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : min")
# max
if type(max) != int and type(max) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : max")
if min == DR_COND_NONE and max == DR_COND_NONE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min({0}), max({1})".format(min,max))
# min < max check
if min != DR_COND_NONE and max != DR_COND_NONE: #min, max 값이 둘다 설정된 경우에만 검사 실시 2017/08/23
if min > max:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min({0}), max({1})".format(min,max))
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# mod
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if mod != DR_MV_MOD_ABS and mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod({0})".format(mod))
# _pos : DR_MV_MOD_REL 인 경우에는 반드시 pos 가 필요하고, otherwise 불필요
if(mod == DR_MV_MOD_REL):
if(pos==None):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : need to pos")
else:
_pos = get_normal_pos(pos, def_type=posx)
else:
if(pos!=None):
_pos = get_normal_pos(pos, def_type=posx)
else:
pos=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
_pos = get_normal_pos(pos, def_type=posx)
# check axis
if (axis == DR_AXIS_A or axis == DR_AXIS_B or axis == DR_AXIS_C):
_ref = DR_TOOL
if __ROS2__:
req = self.req_CheckPositionCondition
req.axis = axis
req.min = float(min)
req.max = float(max)
req.ref = _ref
req.mode = mod
req.pos = [float(x) for x in _pos]
future = self._ros2_check_position_condition.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('check_position_condition Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def check_force_condition(self, axis, min=DR_COND_NONE, max=DR_COND_NONE, ref=None):
# axis
if type(axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if (axis != DR_AXIS_X and axis != DR_AXIS_Y and axis != DR_AXIS_Z and \
axis != DR_AXIS_A and axis != DR_AXIS_B and axis != DR_AXIS_C):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(axis))
# min
if type(min) != int and type(min) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : min")
# max
if type(max) != int and type(max) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : max")
if min == DR_COND_NONE and max == DR_COND_NONE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min({0}), max({1})".format(min, max))
# min check : min 설정되어 있는데 0보다 작은 경우 에러 처리 2017/12/07
if min != DR_COND_NONE:
if min < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min (Ranges: min({0}) >= 0)".format(min))
# max check : max 설정되어 있는데 0보다 작은 경우 에러 처리 2017/12/07
if max != DR_COND_NONE:
if max < 0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: max (Ranges: max({0}) >= 0)".format(max))
# min < max check
if min != DR_COND_NONE and max != DR_COND_NONE: #min, max 값이 둘다 설정된 경우에만 검사 실시 2017/08/23
if min > max:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min({0}), max({1})".format(min, max))
# ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# check axis
if (axis == DR_AXIS_A or axis == DR_AXIS_B or axis == DR_AXIS_C):
_ref = DR_TOOL
if __ROS2__:
req = self.req_CheckForceCondition
req.axis = axis
req.min = float(min)
req.max = float(max)
req.ref = _ref
future = self._ros2_check_force_condition.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('check_force_condition Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def check_orientation_condition(self, axis, min=None, max=None, ref=None, mod = None, pos=None):
_cmd_type = 0
# axis
if type(axis) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : axis")
if (axis != DR_AXIS_A and axis != DR_AXIS_B and axis != DR_AXIS_C):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : axis({0})".format(axis))
# min, max check type
if(min != None):
if type(min) == posx:
_cmd_type = 0
elif type(min) == posj:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : min is not posj")
elif type(min) == list and len(min) == POINT_COUNT:
_cmd_type = 0
elif type(min) == int or type(min) == float:
_cmd_type = 1
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : min")
if(max != None):
if type(max) == posx:
_cmd_type = 0
elif type(max) == posj:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : max is not posj")
elif type(max) == list and len(max) == POINT_COUNT:
_cmd_type = 0
elif type(max) == int or type(max) == float:
_cmd_type = 1
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : max")
if _cmd_type == 0:
# _pos_min
if(min != None):
_pos_min = get_normal_pos(min, def_type=posx)
else:
_pos_min = [DR_COND_NONE]*POINT_COUNT
# _pos_max
if(max != None):
_pos_max = get_normal_pos(max, def_type=posx)
else:
_pos_max = [DR_COND_NONE]*POINT_COUNT
# _ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# mod
if mod == None:
mod = DR_MV_MOD_ABS
else:
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod is not integer")
if mod != DR_MV_MOD_ABS:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod({0}) is not DR_MV_MOD_ABS".format(mod))
print("_cmd_type={0}, axis:{1}, min:{2}, max:{3}, ref:{4}, mod:{5}".format(_cmd_type, axis, _pos_min, _pos_max, _ref, mod) )
elif _cmd_type == 1:
# min
if min == None:
min = DR_COND_NONE
else:
if type(min) != int and type(min) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : min")
# max
if max == None:
max = DR_COND_NONE
else:
if type(max) != int and type(max) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : max")
if min == DR_COND_NONE and max == DR_COND_NONE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min({0}), max({1})".format(min, max))
# min < max check
if min != DR_COND_NONE and max != DR_COND_NONE: #min, max 값이 둘다 설정된 경우에만 검사 실시 2017/08/23
if min > max:
raise DR_Error(DR_ERROR_VALUE, "Invalid value: min({0}), max({1})".format(min, max))
# _ref
if ref == None:
_ref = _g_coord
else:
_ref = ref
# check ref
if type(_ref) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref")
if _ref < DR_BASE or _ref > DR_TC_USER_MAX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ref({0})".format(_ref))
# mod
if mod == None:
mod = DR_MV_MOD_REL
else:
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod is not integer")
if mod != DR_MV_MOD_REL:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod({0}) is not DR_MV_MOD_REL".format(mod))
# _pos
if(pos==None):
raise DR_Error(DR_ERROR_VALUE, "Invalid value : need to pos")
else:
_pos = get_normal_pos(pos, def_type=posx)
#print("_cmd_type={0}, axis:{1}, min:{2}, max:{3}, ref:{4}, mod:{5}, pos:{6}".format(_cmd_type, axis, min, max, _ref, mod, _pos) )
else:
raise DR_Error(DR_ERROR_TYPE, "Invalid arguments")
if _cmd_type == 0:
if __ROS2__:
req = self.req_CheckOrientationCondition1
req.axis = axis
req.min = [float(x) for x in _pos_min]
req.max = [float(x) for x in _pos_max]
req.ref = _ref
req.mode = mod
future = self._ros2_check_orientation_condition1.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('check_orientation_condition Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
else:
if __ROS2__:
req = self.CheckOrientationCondition2
req.axis = axis
req.min = float(min)
req.max = float(max)
req.ref = _ref
req.mode = mod
req.pos = [float(x) for x in _pos]
future = self._ros2_check_orientation_condition2.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('check_orientation_condition Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def coord_transform(self, pose_in, ref_in=DR_BASE, ref_out=None):
# _pos
_pos = get_normal_pos(pose_in, def_type=posx)
# ref_in
if type(ref_in) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref_in")
# ref_out
if type(ref_out) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ref_out")
if __ROS2__:
req = self.req_CoordTransform
req.pos_in = [float(x) for x in _pos]
req.ref_in = ref_in
req.ref_out = ref_out
future = self._ros2_coord_transform.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('coord_transform Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
pos = list(result.conv_posx) # Convert tuple to list
trans_posx = posx(pos)
ret = trans_posx
return ret
##### I/O #########################################################################################################################
def get_digital_input(self, index):
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if index < DR_DIO_MIN_INDEX or index > DR_DIO_MAX_INDEX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
if __ROS2__:
req = self.req_GetCtrlBoxDigitalInput
req.index = index
future = self._ros2_get_digital_input.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_digital_input Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.value
return ret
def get_analog_input(self, ch):
if type(ch) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ch")
if ch < 1 or ch > 2:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ch")
if __ROS2__:
req = self.req_GetCtrlBoxAnalogInput
req.channel = ch
future = self._ros2_get_analog_input.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_analog_input Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.value
return ret
def get_tool_digital_input(self, index):
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if index < DR_TDIO_MIN_INDEX or index > DR_TDIO_MAX_INDEX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
if __ROS2__:
req = self.req_GetToolDigitalInput
req.index = index
future = self._ros2_get_tool_digital_input.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_tool_digital_input Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.value
return ret
def set_digital_output(self, index, val=None):
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if val != None:
if type(val) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : val")
if index < DR_DIO_MIN_INDEX or index > DR_DIO_MAX_INDEX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
if val != ON and val != OFF:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
else: # # val ���ڰ� ������ simple style
if (index < (-DR_DIO_MAX_INDEX)) or (index > DR_DIO_MAX_INDEX) or (index==0): # -16~+16
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
else:
if index < 0:
index = index*(-1)
val = OFF
else:
index = index
val = ON
if __ROS2__:
req = self.req_SetCtrlBoxDigitalOutput
req.index = index
req.value = val
future = self._ros2_set_digital_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_digital_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_digital_output(self, index):
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if index < DR_DIO_MIN_INDEX or index > DR_DIO_MAX_INDEX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
if __ROS2__:
req = self.req_GetCtrlBoxDigitalOutput
req.index = index
future = self._ros2_get_digital_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_digital_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.value
return ret
def set_analog_output(self, ch, val):
global _g_analog_output_mode_ch1
global _g_analog_output_mode_ch2
if type(ch) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ch")
if type(val) != int and type(val) != float:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : val")
if ch < 1 or ch > 2:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ch")
#if val < 0 or val > 20.0:
# raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
if ch == 1:
if _g_analog_output_mode_ch1 == DR_ANALOG_CURRENT:
if val < 4 or val > 20.0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
elif _g_analog_output_mode_ch1 == DR_ANALOG_VOLTAGE:
if val < 0 or val > 10.0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
else:
raise DR_Error(DR_ERROR_VALUE, "Analog output mode(ch1) is not set")
if ch == 2:
if _g_analog_output_mode_ch2 == DR_ANALOG_CURRENT:
if val < 4 or val > 20.0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
elif _g_analog_output_mode_ch2 == DR_ANALOG_VOLTAGE:
if val < 0 or val > 10.0:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
else:
raise DR_Error(DR_ERROR_VALUE, "Analog output mode(ch2) is not set")
if __ROS2__:
req = self.req_SetCtrlBoxAnalogOutput
req.channel = ch
req.value = float(val)
future = self._ros2_set_analog_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_analog_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_mode_analog_output(self, ch, mod):
global _g_analog_output_mode_ch1
global _g_analog_output_mode_ch2
if type(ch) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ch")
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if ch < 1 or ch > 2:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ch")
if mod != DR_ANALOG_CURRENT and mod !=DR_ANALOG_VOLTAGE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
if ch == 1:
_g_analog_output_mode_ch1 = mod
if ch == 2:
_g_analog_output_mode_ch2 = mod
if __ROS2__:
req = self.req_SetCtrlBoxAnalogOutputType
req.channel = ch
req.mode = mod
future = self._ros2_set_mode_analog_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_mode_analog_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_mode_analog_input(self, ch, mod):
if type(ch) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ch")
if type(mod) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : mod")
if ch < 1 or ch > 2:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : ch")
if mod != DR_ANALOG_CURRENT and mod !=DR_ANALOG_VOLTAGE:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : mod")
if __ROS2__:
req = self.req_SetCtrlBoxAnalogInputType
req.channel = ch
req.mode = mod
future = self._ros2_set_mode_analog_input.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_mode_analog_input Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_tool_digital_output(self, index, val=None):
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if val != None:
if type(val) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : val")
if index < DR_TDIO_MIN_INDEX or index > DR_TDIO_MAX_INDEX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
if val != ON and val != OFF:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
else: # val ���ڰ� ������ simple style
if (index < (-DR_TDIO_MAX_INDEX)) or (index > DR_TDIO_MAX_INDEX) or (index==0): # -6~+6
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
else:
if index < 0:
index = index*(-1)
val = OFF
else:
index = index
val = ON
if __ROS2__:
req = self.req_SetToolDigitalOutput
req.index = index
req.value = val
future = self._ros2_set_tool_digital_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_tool_digital_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_tool_digital_output(self, index):
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if index < DR_TDIO_MIN_INDEX or index > DR_TDIO_MAX_INDEX:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index")
if __ROS2__:
req = self.req_GetToolDigitalOutput
req.index = index
future = self._ros2_get_tool_digital_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_tool_digital_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.value
return ret
##### Modbus #########################################################################################################################
def add_modbus_signal(self, ip, port, name, reg_type, index, value=0, slaveid=255):
# ip
if type(ip) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : ip")
#try:
# ipaddress.ip_address(ip)
#except:
# raise DR_Error(DR_ERROR_VALUE, "Invalid value : ip")
# port
if type(port) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : port")
if port <= 0 or port > 65535:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : port (Ranges: 1 ~ 65535)")
# name
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# reg_type
if type(reg_type) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : reg_type")
if reg_type != DR_MODBUS_DIG_INPUT and reg_type != DR_MODBUS_DIG_OUTPUT and reg_type != DR_MODBUS_REG_INPUT and reg_type != DR_MODBUS_REG_OUTPUT:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : reg_type (Ranges : 0 ~ 3")
# index
if type(index) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : index")
if index < 0 or index > 65535:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : index (Ranges: 0 ~ 65535)")
# value
if type(value) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : value")
if value < 0 or value > 65535:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : value (Ranges: 0 ~ 65535)")
# check value
if reg_type == DR_MODBUS_DIG_OUTPUT or reg_type == DR_MODBUS_REG_OUTPUT:
_value = value
else:
_value = 0
# slaveid
if type(slaveid) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : slaveid")
if slaveid < 0 or slaveid > 255:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : slaveid (Ranges: 0 or 1~247 or 255)")
elif slaveid > 247 and slaveid < 255:
raise DR_Error(DR_ERROR_VALUE, "Invalid value : slaveid (Ranges: 0 or 1~247 or 255)")
# ROS service call
if __ROS2__:
req = self.req_ConfigCreateModbus
req.name = name
req.ip = ip
req.port = port
req.reg_type = reg_type
req.index = index
req.value = _value
req.slave_id = slaveid
future = self._ros2_add_modbus_signal.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('add_modbus_signal Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def del_modbus_signal(self, name):
# name
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# ROS service call
if __ROS2__:
req = self.req_ConfigDeleteModbus
req.name = name
future = self._ros2_del_modbus_signal.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('del_modbus_signal Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def set_modbus_output(self, iobus, val):
if type(iobus) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : iobus")
if type(val) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : val")
# not check value (register : 2byte...)
# if val != ON and val != OFF:
# raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
# ROS service call
if __ROS2__:
req = self.req_SetModbusOutput
req.name = iobus
req.value = val
future = self._ros2_set_modbus_output.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_modbus_output Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_modbus_input(self, iobus):
if type(iobus) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : iobus")
# ROS service call
if __ROS2__:
req = self.req_GetModbusInput
req.name = iobus
future = self._ros2_get_modbus_input.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_modbus_input Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.value
return ret
##### TCP/TOOL #########################################################################################################################
def set_tcp(self, name):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# not check value (register : 2byte...)
# if val != ON and val != OFF:
# raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
# ROS service call
if __ROS2__:
req = self.req_SetCurrentTcp
req.name = name
future = self._ros2_set_current_tcp.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_tcp Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_tcp(self):
# ROS service call
if __ROS2__:
req = self.req_GetCurrentTcp
future = self._ros2_get_current_tcp.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_tcp Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.info
return ret
def set_tool(self, name):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# not check value (register : 2byte...)
# if val != ON and val != OFF:
# raise DR_Error(DR_ERROR_VALUE, "Invalid value : val")
# ROS service call
if __ROS2__:
req = self.req_SetCurrentTool
req.name = name
future = self._ros2_set_current_tool.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_tool Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_tool(self):
# ROS service call
if __ROS2__:
req = self.req_GetCurrentTool
future = self._ros2_get_current_tool.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_tool Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.info
return ret
def set_tool_shape(self, name):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
if __ROS2__:
req = self.req_SetToolShape
req.name = name
future = self._ros2_set_tool_shape.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('set_tool_shape Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def add_tcp(self, name, pos):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# ROS service call
if __ROS2__:
req = self.req_ConfigCreateTcp
req.name = name
req.pos = [float(x) for x in pos]
future = self._ros2_config_create_tcp.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('add_tcp Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def del_tcp(self, name):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# ROS service call
if __ROS2__:
req = self.req_ConfigDeleteTcp
req.name = name
future = self._ros2_config_delete_tcp.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('del_tcp Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def add_tool(self, name, weight, cog, inertia):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# ROS service call
if __ROS2__:
req = self.req_ConfigCreateTool
req.name = name
req.weight = float(weight)
req.cog = [float(x) for x in cog]
req.inertia = [float(x) for x in inertia]
future = self._ros2_config_create_tool.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('add_tool Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def del_tool(self, name):
if type(name) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# ROS service call
if __ROS2__:
req = self.req_ConfigDeleteTool
req.name = name
future = self._ros2_config_delete_tool.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('del_tool Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
##### DRL #########################################################################################################################
def drl_script_run(self, robotSystem, code):
if type(code) != str:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : name")
# ROS service call
if __ROS2__:
req = self.req_DrlStart
req.robot_system = robotSystem
req.code = code
future = self._ros2_drl_start.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('drl_script_run Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def drl_script_stop(self, stop_mode):
if type(stop_mode) != int:
raise DR_Error(DR_ERROR_TYPE, "Invalid type : stop_mode")
print("drl_script_stop")
# ROS service call
if __ROS2__:
req = self.req_DrlStop
req.stop_mode = stop_mode
future = self._ros2_drl_stop.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('drl_script_stop Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def drl_script_pause(self):
# ROS service call
if __ROS2__:
req = self.req_DrlPause
future = self._ros2_drl_pause.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('drl_script_pause Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def drl_script_resume(self):
# ROS service call
if __ROS2__:
req = self.req_DrlResume
future = self._ros2_drl_resume.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('drl_script_resume Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = 0 if (result.success == True) else -1
return ret
def get_drl_state(self):
# ROS service call
if __ROS2__:
req = self.req_GetDrlState
future = self._ros2_get_drl_state.call_async(req)
rclpy.spin_until_future_complete(g_node, future)
try:
result = future.result()
except Exception as e:
g_node.get_logger().info('get_drl_state Service call failed %r' % (e,))
else:
if result == None:
ret = -1
else:
ret = result.drl_state
return ret
| 37.659453 | 242 | 0.519215 | 48,719 | 396,780 | 3.90868 | 0.014348 | 0.058815 | 0.050413 | 0.058815 | 0.934537 | 0.925011 | 0.910575 | 0.888939 | 0.863995 | 0.826133 | 0.000731 | 0.019395 | 0.373282 | 396,780 | 10,535 | 243 | 37.663028 | 0.745224 | 0.054771 | 0 | 0.862607 | 0 | 0.002303 | 0.097169 | 0.015916 | 0 | 0 | 0 | 0 | 0 | 1 | 0.031726 | false | 0.000256 | 0.001279 | 0 | 0.065114 | 0.010106 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
61012f6de312b02041170c20608792fe3e75127d | 6,010 | py | Python | tests/test_trackball.py | hawkaa/trimesh | f4c152208dd197443162f1e2ddf8fbd226bdafb1 | [
"MIT"
] | 1,882 | 2015-04-21T06:51:06.000Z | 2022-03-31T03:16:12.000Z | tests/test_trackball.py | hawkaa/trimesh | f4c152208dd197443162f1e2ddf8fbd226bdafb1 | [
"MIT"
] | 1,400 | 2016-01-22T14:05:04.000Z | 2022-03-31T19:13:55.000Z | tests/test_trackball.py | hawkaa/trimesh | f4c152208dd197443162f1e2ddf8fbd226bdafb1 | [
"MIT"
] | 465 | 2015-05-29T21:27:38.000Z | 2022-03-31T17:45:46.000Z | try:
from . import generic as g
except BaseException:
import generic as g
from trimesh.viewer.trackball import Trackball
class TrackballTest(g.unittest.TestCase):
def test_resize(self):
trackball = Trackball(
pose=g.np.eye(4),
size=(640, 480),
scale=1.0,
target=g.np.array([0, 0, 0])
)
trackball.down((320, 240))
trackball.drag((321, 240))
pose1 = trackball.pose
trackball.drag((320, 240))
trackball.resize((1280, 960))
trackball.down((640, 480))
trackball.drag((642, 480))
pose2 = trackball.pose
g.np.testing.assert_allclose(pose1, pose2)
def test_drag_rotate(self):
trackball = Trackball(
pose=g.np.eye(4),
size=(640, 480),
scale=1.0,
target=g.np.array([0, 0, 0])
)
# rotates around y-axis
trackball.set_state(Trackball.STATE_ROTATE)
trackball.down((320, 240))
trackball.drag((321, 240))
assert trackball.pose[0, 0] < 1
assert trackball.pose[0, 1] == 0
assert trackball.pose[0, 2] < 0
assert trackball.pose[1, 0] == 0
assert trackball.pose[1, 1] == 1
assert trackball.pose[1, 2] == 0
assert trackball.pose[2, 0] > 0
assert trackball.pose[2, 1] == 0
assert trackball.pose[2, 2] < 1
g.np.testing.assert_allclose(trackball.pose[:, 3], [0, 0, 0, 1])
g.np.testing.assert_allclose(trackball.pose[3, :], [0, 0, 0, 1])
# rotate back
trackball.drag((320, 240))
g.np.testing.assert_allclose(trackball.pose, g.np.eye(4))
# rotate around x-axis
trackball.drag((320, 241))
assert trackball.pose[0, 0] == 1
assert trackball.pose[0, 1] == 0
assert trackball.pose[0, 2] == 0
assert trackball.pose[1, 0] == 0
assert trackball.pose[1, 1] < 1
assert trackball.pose[1, 2] < 0
assert trackball.pose[2, 0] == 0
assert trackball.pose[2, 1] > 0
assert trackball.pose[2, 2] < 1
g.np.testing.assert_allclose(trackball.pose[:, 3], [0, 0, 0, 1])
g.np.testing.assert_allclose(trackball.pose[3, :], [0, 0, 0, 1])
# rotate back
trackball.drag((320, 240))
g.np.testing.assert_allclose(trackball.pose, g.np.eye(4))
def test_drag_roll(self):
trackball = Trackball(
pose=g.np.eye(4),
size=(640, 480),
scale=1.0,
target=g.np.array([0, 0, 0])
)
# rotates around z-axis
trackball.set_state(Trackball.STATE_ROLL)
trackball.down((321, 241))
trackball.drag((320, 241))
assert trackball.pose[0, 0] < 1
assert trackball.pose[0, 1] > 0
assert trackball.pose[0, 2] == 0
assert trackball.pose[1, 0] < 0
assert trackball.pose[1, 1] < 1
assert trackball.pose[1, 2] == 0
assert trackball.pose[2, 0] == 0
assert trackball.pose[2, 1] == 0
assert trackball.pose[2, 2] == 1
g.np.testing.assert_allclose(trackball.pose[:, 3], [0, 0, 0, 1])
g.np.testing.assert_allclose(trackball.pose[3, :], [0, 0, 0, 1])
# rotate back
trackball.drag((321, 241))
g.np.testing.assert_allclose(trackball.pose, g.np.eye(4))
def test_drag_pan(self):
trackball = Trackball(
pose=g.np.eye(4),
size=(640, 480),
scale=1.0,
target=g.np.array([0, 0, 0])
)
# translate to x
trackball.set_state(Trackball.STATE_PAN)
trackball.down((321, 241))
trackball.drag((320, 241))
g.np.testing.assert_allclose(trackball.pose[:3, :3], g.np.eye(3))
assert trackball.pose[0, 3] != 0
assert trackball.pose[1, 3] == 0
assert trackball.pose[2, 3] == 0
def test_drag_zoom(self):
pose = g.trimesh.transformations.translation_matrix([0, 0, 1])
trackball = Trackball(
pose=pose,
size=(640, 480),
scale=1.0,
target=g.np.array([0, 0, 0])
)
# translate to x
trackball.set_state(Trackball.STATE_ZOOM)
trackball.down((320, 240))
trackball.drag((320, 241))
g.np.testing.assert_allclose(trackball.pose[:3, :3], g.np.eye(3))
assert trackball.pose[3, 0] == 0
assert trackball.pose[3, 1] == 0
assert trackball.pose[3, 2] < 1
g.np.testing.assert_allclose(trackball.pose[3, :], [0, 0, 0, 1])
def test_scroll(self):
pose = g.trimesh.transformations.translation_matrix([0, 0, 1])
trackball = Trackball(
pose=pose,
size=(640, 480),
scale=1.0,
target=g.np.array([0, 0, 0])
)
g.np.testing.assert_allclose(trackball.pose[:3, :3], g.np.eye(3))
g.np.testing.assert_allclose(trackball.pose[:3, 3], [0, 0, 1])
trackball.scroll(1)
g.np.testing.assert_allclose(trackball.pose[:3, :3], g.np.eye(3))
g.np.testing.assert_allclose(trackball.pose[:3, 3], [0, 0, 0.9])
def test_rotate(self):
trackball = Trackball(
pose=g.np.eye(4),
size=(640, 480),
scale=1.0,
target=g.np.array([0, 0, 0])
)
# rotates around y-axis
trackball.rotate(g.np.deg2rad(1))
assert trackball.pose[0, 0] < 1
assert trackball.pose[0, 1] == 0
assert trackball.pose[0, 2] > 0
assert trackball.pose[1, 0] == 0
assert trackball.pose[1, 1] == 1
assert trackball.pose[1, 2] == 0
assert trackball.pose[2, 0] < 0
assert trackball.pose[2, 1] == 0
assert trackball.pose[2, 2] < 1
g.np.testing.assert_allclose(trackball.pose[:, 3], [0, 0, 0, 1])
g.np.testing.assert_allclose(trackball.pose[3, :], [0, 0, 0, 1])
if __name__ == '__main__':
g.trimesh.util.attach_to_log()
g.unittest.main()
| 34.54023 | 73 | 0.551248 | 835 | 6,010 | 3.907784 | 0.088623 | 0.2749 | 0.24456 | 0.171621 | 0.863316 | 0.828379 | 0.805087 | 0.805087 | 0.769231 | 0.768924 | 0 | 0.095114 | 0.298503 | 6,010 | 173 | 74 | 34.739884 | 0.678843 | 0.025291 | 0 | 0.632653 | 0 | 0 | 0.001368 | 0 | 0 | 0 | 0 | 0 | 0.414966 | 1 | 0.047619 | false | 0 | 0.020408 | 0 | 0.07483 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 |
61247a188f29d09963166ba2fb862d93f6a8704f | 6,647 | py | Python | scripts/modules/loss.py | andrrizzi/tfep-revisited-2021 | 9a9aff61286be3111c4e70136620d0e3aac31318 | [
"MIT"
] | 7 | 2021-07-22T00:53:37.000Z | 2022-03-11T07:29:36.000Z | scripts/modules/loss.py | andrrizzi/tfep-revisited-2021 | 9a9aff61286be3111c4e70136620d0e3aac31318 | [
"MIT"
] | 2 | 2021-08-24T07:54:55.000Z | 2021-09-14T08:51:55.000Z | scripts/modules/loss.py | andrrizzi/tfep-revisited-2021 | 9a9aff61286be3111c4e70136620d0e3aac31318 | [
"MIT"
] | 1 | 2021-07-22T00:53:56.000Z | 2021-07-22T00:53:56.000Z | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Loss functions to train PyTorch normalizing flows for reweighting.
"""
# =============================================================================
# GLOBAL IMPORTS
# =============================================================================
import numpy as np
from scipy.special import logsumexp
import torch
# =============================================================================
# LOSS FUNCTIONS
# =============================================================================
class KLDivLoss(torch.nn.Module):
"""A loss function whose minimum corresponds to that of the KL divergence D[p_1||p_2].
The loss function assumes the sampling is done in the p_1 distribution.
If the samples are mapped through a bijection, the log absolute Jacobian
determinant of the transformation must be passed as well.
The loss function differs from the actual KL divergence by a constant
additive term log(Z_2/Z_1).
Parameters
----------
kT : float
The thermodynamic temperature of both ensembles in the units of
energy that are passed to the loss function.
"""
def __init__(self, kT):
super().__init__()
self._kT = kT
def forward(self, potentials1, potentials2, log_det_J=None):
"""Compute the loss.
Parameters
----------
potentials1 : torch.Tensor
The potential energy of the samples collected from distribution
p_1 and evaluated using the potential of p_1. The shape is
``(batch_size)``.
potentials2 : torch.Tensor
The potential energy of the samples collected from distribution
p_1 and evaluated using the potential of p_2. The shape is
``(batch_size)``.
log_det_J : torch.Tensor, optional
The logarithm of the absolute value of the determinant of the
Jacobian of the bijection mapping the samples. The shape is
``(batch_size)``.
"""
reduced_work = self._compute_reduced_work(potentials1, potentials2, log_det_J)
return torch.mean(reduced_work)
def _compute_reduced_work(self, potentials1, potentials2, log_det_J):
reduced_work = (potentials2 - potentials1) / self._kT
if log_det_J is not None:
reduced_work -= log_det_J
return reduced_work
class BoltzmannKLDivLoss(KLDivLoss):
"""A loss function whose minimum corresponds to that of the KL divergence D[p_1||p_2].
The loss function assumes the sampling is done in the p_1 distribution.
If the sampling is done with metadynamics, it is necessary to pass the
normalized bias to the loss function so that the average is appropriately
weighted. If the samples are mapped through a bijection, the log absolute
Jacobian determinant of the transformation must be passed as well.
The loss function differs from the actual KL divergence by a constant
additive log(Z_2/Z_1).
Parameters
----------
kT : float
The thermodynamic temperature of both ensembles in the units of
energy that are passed to the loss function.
"""
def forward(self, potentials1, potentials2, log_det_J=None, metad_rbias=None):
"""Compute the loss.
Parameters
----------
potentials1 : torch.Tensor
The potential energy of the samples collected from distribution
p_1 (or p_V if metadynamics is used) and evaluated using the
potential of p_1. The shape is ``(batch_size)``.
potentials2 : torch.Tensor
The potential energy of the samples collected from distribution
p_1 and evaluated using the potential of p_2. The shape is
``(batch_size)``.
log_det_J : torch.Tensor, optional
The logarithm of the absolute value of the determinant of the
Jacobian of the bijection mapping the samples. The shape is
``(batch_size)``.
metad_rbias : torch.Tensor, optional
The metadynamics bias normalized by c(t) that is used to
reweighting metadynamics samples to Boltzmann. The shape is
``(batch_size)``.
"""
reduced_work = self._compute_reduced_work(potentials1, potentials2, log_det_J)
if metad_rbias is not None:
weights = torch.nn.functional.softmax(metad_rbias / self._kT)
return torch.sum(weights * reduced_work)
return torch.mean(reduced_work)
class MetaDKLDivLoss(KLDivLoss):
"""A loss function whose minimum corresponds to that of the KL divergence D[p_V||p_2].
The loss function assumes the sampling is done in the metadynamics
ensemble from a distribution p_1. If the samples are mapped through
a bijection, the log absolute Jacobian determinant of the transformation
must be passed as well.
The loss function differs from the actual KL divergence by an additive
log(Z_2/Z_1) factor.
Parameters
----------
kT : float
The thermodynamic temperature of both ensembles in the units of
energy that are passed to the loss function.
"""
def forward(self, potentials1, potentials2, log_det_J=None, metad_rbias=None):
"""Compute the loss.
Parameters
----------
potentials1 : torch.Tensor
The potential energy of the samples collected from biased
distribution p_V and evaluated using the potential of p_1.
The shape is ``(batch_size)``.
potentials2 : torch.Tensor
The potential energy of the samples collected from distribution
p_V and evaluated using the potential of p_2. The shape is
``(batch_size)``.
log_det_J : torch.Tensor, optional
The logarithm of the absolute value of the determinant of the
Jacobian of the bijection mapping the samples. The shape is
``(batch_size)``.
metad_rbias : torch.Tensor, optional
The metadynamics bias normalized by c(t) that is used to
reweighting metadynamics samples to Boltzmann. The shape is
``(batch_size)``. This is not affected by the parameters
and can be left out for optimization purposes.
"""
if metad_rbias is not None:
potentials1 = potentials1 + metad_rbias
return super().forward(potentials1, potentials2, log_det_J)
| 38.201149 | 90 | 0.615767 | 822 | 6,647 | 4.858881 | 0.176399 | 0.030045 | 0.021032 | 0.041312 | 0.804206 | 0.783926 | 0.761392 | 0.761392 | 0.761392 | 0.750626 | 0 | 0.009707 | 0.256055 | 6,647 | 173 | 91 | 38.421965 | 0.797978 | 0.699714 | 0 | 0.296296 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.185185 | false | 0 | 0.111111 | 0 | 0.592593 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 7 |
b6439981b763a87ceba32af04600889c1d4752af | 6,681 | py | Python | src/outdoor_bot/srv/_setPose_service.py | dan-git/outdoor_bot | 81bf75e26449f8e4b6a38f4049ca4d4cda7b8c04 | [
"BSD-2-Clause"
] | null | null | null | src/outdoor_bot/srv/_setPose_service.py | dan-git/outdoor_bot | 81bf75e26449f8e4b6a38f4049ca4d4cda7b8c04 | [
"BSD-2-Clause"
] | null | null | null | src/outdoor_bot/srv/_setPose_service.py | dan-git/outdoor_bot | 81bf75e26449f8e4b6a38f4049ca4d4cda7b8c04 | [
"BSD-2-Clause"
] | null | null | null | """autogenerated by genpy from outdoor_bot/setPose_serviceRequest.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class setPose_serviceRequest(genpy.Message):
_md5sum = "111c8ccb6eb03e460ba85f87f939c7ae"
_type = "outdoor_bot/setPose_serviceRequest"
_has_header = False #flag to mark the presence of a Header object
_full_text = """bool setHome
float32 x
float32 y
float32 yaw
"""
__slots__ = ['setHome','x','y','yaw']
_slot_types = ['bool','float32','float32','float32']
def __init__(self, *args, **kwds):
"""
Constructor. Any message fields that are implicitly/explicitly
set to None will be assigned a default value. The recommend
use is keyword arguments as this is more robust to future message
changes. You cannot mix in-order arguments and keyword arguments.
The available fields are:
setHome,x,y,yaw
:param args: complete set of field values, in .msg order
:param kwds: use keyword arguments corresponding to message field names
to set specific fields.
"""
if args or kwds:
super(setPose_serviceRequest, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.setHome is None:
self.setHome = False
if self.x is None:
self.x = 0.
if self.y is None:
self.y = 0.
if self.yaw is None:
self.yaw = 0.
else:
self.setHome = False
self.x = 0.
self.y = 0.
self.yaw = 0.
def _get_types(self):
"""
internal API method
"""
return self._slot_types
def serialize(self, buff):
"""
serialize message into buffer
:param buff: buffer, ``StringIO``
"""
try:
_x = self
buff.write(_struct_B3f.pack(_x.setHome, _x.x, _x.y, _x.yaw))
except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
def deserialize(self, str):
"""
unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str``
"""
try:
end = 0
_x = self
start = end
end += 13
(_x.setHome, _x.x, _x.y, _x.yaw,) = _struct_B3f.unpack(str[start:end])
self.setHome = bool(self.setHome)
return self
except struct.error as e:
raise genpy.DeserializationError(e) #most likely buffer underfill
def serialize_numpy(self, buff, numpy):
"""
serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module
"""
try:
_x = self
buff.write(_struct_B3f.pack(_x.setHome, _x.x, _x.y, _x.yaw))
except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
def deserialize_numpy(self, str, numpy):
"""
unpack serialized message in str into this message instance using numpy for array types
:param str: byte array of serialized message, ``str``
:param numpy: numpy python module
"""
try:
end = 0
_x = self
start = end
end += 13
(_x.setHome, _x.x, _x.y, _x.yaw,) = _struct_B3f.unpack(str[start:end])
self.setHome = bool(self.setHome)
return self
except struct.error as e:
raise genpy.DeserializationError(e) #most likely buffer underfill
_struct_I = genpy.struct_I
_struct_B3f = struct.Struct("<B3f")
"""autogenerated by genpy from outdoor_bot/setPose_serviceResponse.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class setPose_serviceResponse(genpy.Message):
_md5sum = "d41d8cd98f00b204e9800998ecf8427e"
_type = "outdoor_bot/setPose_serviceResponse"
_has_header = False #flag to mark the presence of a Header object
_full_text = """
"""
__slots__ = []
_slot_types = []
def __init__(self, *args, **kwds):
"""
Constructor. Any message fields that are implicitly/explicitly
set to None will be assigned a default value. The recommend
use is keyword arguments as this is more robust to future message
changes. You cannot mix in-order arguments and keyword arguments.
The available fields are:
:param args: complete set of field values, in .msg order
:param kwds: use keyword arguments corresponding to message field names
to set specific fields.
"""
if args or kwds:
super(setPose_serviceResponse, self).__init__(*args, **kwds)
def _get_types(self):
"""
internal API method
"""
return self._slot_types
def serialize(self, buff):
"""
serialize message into buffer
:param buff: buffer, ``StringIO``
"""
try:
pass
except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
def deserialize(self, str):
"""
unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str``
"""
try:
end = 0
return self
except struct.error as e:
raise genpy.DeserializationError(e) #most likely buffer underfill
def serialize_numpy(self, buff, numpy):
"""
serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module
"""
try:
pass
except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
def deserialize_numpy(self, str, numpy):
"""
unpack serialized message in str into this message instance using numpy for array types
:param str: byte array of serialized message, ``str``
:param numpy: numpy python module
"""
try:
end = 0
return self
except struct.error as e:
raise genpy.DeserializationError(e) #most likely buffer underfill
_struct_I = genpy.struct_I
class setPose_service(object):
_type = 'outdoor_bot/setPose_service'
_md5sum = '111c8ccb6eb03e460ba85f87f939c7ae'
_request_class = setPose_serviceRequest
_response_class = setPose_serviceResponse
| 32.120192 | 123 | 0.664421 | 909 | 6,681 | 4.734873 | 0.165017 | 0.030669 | 0.031599 | 0.035316 | 0.818309 | 0.818309 | 0.818309 | 0.799257 | 0.799257 | 0.799257 | 0 | 0.021605 | 0.224068 | 6,681 | 207 | 124 | 32.275362 | 0.808642 | 0.335129 | 0 | 0.754386 | 1 | 0 | 0.120711 | 0.047396 | 0 | 0 | 0.004937 | 0 | 0 | 1 | 0.105263 | false | 0.017544 | 0.052632 | 0 | 0.377193 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
b65add542b20e8e416f032eb3534542180f63689 | 83 | py | Python | structural/proxy/logic/__init__.py | Kozak24/Patterns | 351d5c11f7c64ce5d58db37b6715fc8f7d31945a | [
"MIT"
] | null | null | null | structural/proxy/logic/__init__.py | Kozak24/Patterns | 351d5c11f7c64ce5d58db37b6715fc8f7d31945a | [
"MIT"
] | null | null | null | structural/proxy/logic/__init__.py | Kozak24/Patterns | 351d5c11f7c64ce5d58db37b6715fc8f7d31945a | [
"MIT"
] | null | null | null | from .admin_panel import AdminPanel
from .admin_panel_proxy import AdminPanelProxy
| 27.666667 | 46 | 0.879518 | 11 | 83 | 6.363636 | 0.636364 | 0.257143 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096386 | 83 | 2 | 47 | 41.5 | 0.933333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 7 |
b6820d8a0b2fa0588d0fc268d96befeac109d51b | 60,434 | py | Python | python/ned_client/apis/organizations_api.py | PLOS/ned-client | df6a58ac59c0c4730ee74de67d24a56319f2cbae | [
"MIT"
] | 1 | 2018-10-30T20:51:31.000Z | 2018-10-30T20:51:31.000Z | python/ned_client/apis/organizations_api.py | PLOS/ned-client | df6a58ac59c0c4730ee74de67d24a56319f2cbae | [
"MIT"
] | 5 | 2020-03-04T23:26:59.000Z | 2021-01-20T23:52:43.000Z | python/ned_client/apis/organizations_api.py | PLOS/ned-client | df6a58ac59c0c4730ee74de67d24a56319f2cbae | [
"MIT"
] | 1 | 2017-02-10T00:30:10.000Z | 2017-02-10T00:30:10.000Z | # coding: utf-8
"""
OrganizationsApi.py
Copyright 2015 SmartBear Software
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 __future__ import absolute_import
import sys
import os
# python 2 and python 3 compatibility library
from six import iteritems
from ..configuration import Configuration
from ..api_client import ApiClient
class OrganizationsApi(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
config = Configuration()
if api_client:
self.api_client = api_client
else:
if not config.api_client:
config.api_client = ApiClient()
self.api_client = config.api_client
def find_organizations(self, **kwargs):
"""
Find organizations matching specified attribute.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.find_organizations(callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str attribute:
:param str value:
:return: list[OrganizationComposite]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['attribute', 'value']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method find_organizations" % key
)
params[key] = val
del params['kwargs']
resource_path = '/organizations'.replace('{format}', 'json')
method = 'GET'
path_params = {}
query_params = {}
if 'attribute' in params:
query_params['attribute'] = params['attribute']
if 'value' in params:
query_params['value'] = params['value']
header_params = {}
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='list[OrganizationComposite]',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def create_organization(self, **kwargs):
"""
Create organization
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.create_organization(callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param OrganizationComposite body:
:param str authorization:
:return: OrganizationComposite
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body', 'authorization']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_organization" % key
)
params[key] = val
del params['kwargs']
resource_path = '/organizations'.replace('{format}', 'json')
method = 'POST'
path_params = {}
query_params = {}
header_params = {}
if 'authorization' in params:
header_params['Authorization'] = params['authorization']
form_params = {}
files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='OrganizationComposite',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def read_organization(self, ned_id, **kwargs):
"""
Read organization by Ned ID
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.read_organization(ned_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:return: OrganizationComposite
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method read_organization" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `read_organization`")
resource_path = '/organizations/{nedId}'.replace('{format}', 'json')
method = 'GET'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
query_params = {}
header_params = {}
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='OrganizationComposite',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def get_addresses(self, ned_id, **kwargs):
"""
List addresses
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_addresses(ned_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:return: list[Address]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_addresses" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `get_addresses`")
resource_path = '/organizations/{nedId}/addresses'.replace('{format}', 'json')
method = 'GET'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
query_params = {}
header_params = {}
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='list[Address]',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def create_address(self, ned_id, **kwargs):
"""
Create address
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.create_address(ned_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:param Address body:
:param str authorization:
:return: Address
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id', 'body', 'authorization']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_address" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `create_address`")
resource_path = '/organizations/{nedId}/addresses'.replace('{format}', 'json')
method = 'POST'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
query_params = {}
header_params = {}
if 'authorization' in params:
header_params['Authorization'] = params['authorization']
form_params = {}
files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='Address',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def get_address(self, ned_id, address_id, **kwargs):
"""
Read address
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_address(ned_id, address_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:param int address_id: (required)
:return: Address
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id', 'address_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_address" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `get_address`")
# verify the required parameter 'address_id' is set
if ('address_id' not in params) or (params['address_id'] is None):
raise ValueError("Missing the required parameter `address_id` when calling `get_address`")
resource_path = '/organizations/{nedId}/addresses/{addressId}'.replace('{format}', 'json')
method = 'GET'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
if 'address_id' in params:
path_params['addressId'] = params['address_id']
query_params = {}
header_params = {}
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='Address',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def update_address(self, ned_id, address_id, **kwargs):
"""
Update address
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.update_address(ned_id, address_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:param int address_id: (required)
:param Address body:
:param str authorization:
:return: Address
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id', 'address_id', 'body', 'authorization']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_address" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `update_address`")
# verify the required parameter 'address_id' is set
if ('address_id' not in params) or (params['address_id'] is None):
raise ValueError("Missing the required parameter `address_id` when calling `update_address`")
resource_path = '/organizations/{nedId}/addresses/{addressId}'.replace('{format}', 'json')
method = 'PUT'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
if 'address_id' in params:
path_params['addressId'] = params['address_id']
query_params = {}
header_params = {}
if 'authorization' in params:
header_params['Authorization'] = params['authorization']
form_params = {}
files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='Address',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def delete_address(self, ned_id, address_id, **kwargs):
"""
Delete address
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.delete_address(ned_id, address_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:param int address_id: (required)
:param str authorization:
:return: list[Address]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id', 'address_id', 'authorization']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_address" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `delete_address`")
# verify the required parameter 'address_id' is set
if ('address_id' not in params) or (params['address_id'] is None):
raise ValueError("Missing the required parameter `address_id` when calling `delete_address`")
resource_path = '/organizations/{nedId}/addresses/{addressId}'.replace('{format}', 'json')
method = 'DELETE'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
if 'address_id' in params:
path_params['addressId'] = params['address_id']
query_params = {}
header_params = {}
if 'authorization' in params:
header_params['Authorization'] = params['authorization']
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='list[Address]',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def get_emails(self, ned_id, **kwargs):
"""
List emails
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_emails(ned_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:return: list[Email]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_emails" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `get_emails`")
resource_path = '/organizations/{nedId}/emails'.replace('{format}', 'json')
method = 'GET'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
query_params = {}
header_params = {}
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='list[Email]',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def create_email(self, ned_id, **kwargs):
"""
Create email
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.create_email(ned_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:param Email body:
:param str authorization:
:return: Email
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id', 'body', 'authorization']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `create_email`")
resource_path = '/organizations/{nedId}/emails'.replace('{format}', 'json')
method = 'POST'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
query_params = {}
header_params = {}
if 'authorization' in params:
header_params['Authorization'] = params['authorization']
form_params = {}
files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='Email',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def get_email(self, ned_id, email_id, **kwargs):
"""
Read email
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_email(ned_id, email_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:param int email_id: (required)
:return: Email
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id', 'email_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `get_email`")
# verify the required parameter 'email_id' is set
if ('email_id' not in params) or (params['email_id'] is None):
raise ValueError("Missing the required parameter `email_id` when calling `get_email`")
resource_path = '/organizations/{nedId}/emails/{emailId}'.replace('{format}', 'json')
method = 'GET'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
if 'email_id' in params:
path_params['emailId'] = params['email_id']
query_params = {}
header_params = {}
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='Email',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def update_email(self, ned_id, email_id, **kwargs):
"""
Update email
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.update_email(ned_id, email_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:param int email_id: (required)
:param Email body:
:param str authorization:
:return: Email
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id', 'email_id', 'body', 'authorization']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `update_email`")
# verify the required parameter 'email_id' is set
if ('email_id' not in params) or (params['email_id'] is None):
raise ValueError("Missing the required parameter `email_id` when calling `update_email`")
resource_path = '/organizations/{nedId}/emails/{emailId}'.replace('{format}', 'json')
method = 'PUT'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
if 'email_id' in params:
path_params['emailId'] = params['email_id']
query_params = {}
header_params = {}
if 'authorization' in params:
header_params['Authorization'] = params['authorization']
form_params = {}
files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='Email',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def delete_email(self, ned_id, email_id, **kwargs):
"""
Delete email
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.delete_email(ned_id, email_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:param int email_id: (required)
:param str authorization:
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id', 'email_id', 'authorization']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `delete_email`")
# verify the required parameter 'email_id' is set
if ('email_id' not in params) or (params['email_id'] is None):
raise ValueError("Missing the required parameter `email_id` when calling `delete_email`")
resource_path = '/organizations/{nedId}/emails/{emailId}'.replace('{format}', 'json')
method = 'DELETE'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
if 'email_id' in params:
path_params['emailId'] = params['email_id']
query_params = {}
header_params = {}
if 'authorization' in params:
header_params['Authorization'] = params['authorization']
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type=None,
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def get_phonenumbers(self, ned_id, **kwargs):
"""
List phone numbers
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_phonenumbers(ned_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:return: list[Phonenumber]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_phonenumbers" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `get_phonenumbers`")
resource_path = '/organizations/{nedId}/phonenumbers'.replace('{format}', 'json')
method = 'GET'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
query_params = {}
header_params = {}
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='list[Phonenumber]',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def get_uids(self, ned_id, **kwargs):
"""
List UIDs
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_uids(ned_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:return: list[Uniqueidentifier]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_uids" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `get_uids`")
resource_path = '/organizations/{nedId}/uids'.replace('{format}', 'json')
method = 'GET'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
query_params = {}
header_params = {}
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='list[Uniqueidentifier]',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def create_uid(self, ned_id, **kwargs):
"""
Create UID
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.create_uid(ned_id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:param Uniqueidentifier body:
:param str authorization:
:return: Uniqueidentifier
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id', 'body', 'authorization']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_uid" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `create_uid`")
resource_path = '/organizations/{nedId}/uids'.replace('{format}', 'json')
method = 'POST'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
query_params = {}
header_params = {}
if 'authorization' in params:
header_params['Authorization'] = params['authorization']
form_params = {}
files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='Uniqueidentifier',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def get_uid(self, ned_id, id, **kwargs):
"""
Read uid
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.get_uid(ned_id, id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:param int id: (required)
:return: Uniqueidentifier
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id', 'id']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_uid" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `get_uid`")
# verify the required parameter 'id' is set
if ('id' not in params) or (params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `get_uid`")
resource_path = '/organizations/{nedId}/uids/{id}'.replace('{format}', 'json')
method = 'GET'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
if 'id' in params:
path_params['id'] = params['id']
query_params = {}
header_params = {}
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='Uniqueidentifier',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def update_uid(self, ned_id, id, **kwargs):
"""
Update UID
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.update_uid(ned_id, id, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param int ned_id: (required)
:param int id: (required)
:param str authorization:
:param Uniqueidentifier body:
:return: Uniqueidentifier
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['ned_id', 'id', 'authorization', 'body']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_uid" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'ned_id' is set
if ('ned_id' not in params) or (params['ned_id'] is None):
raise ValueError("Missing the required parameter `ned_id` when calling `update_uid`")
# verify the required parameter 'id' is set
if ('id' not in params) or (params['id'] is None):
raise ValueError("Missing the required parameter `id` when calling `update_uid`")
resource_path = '/organizations/{nedId}/uids/{id}'.replace('{format}', 'json')
method = 'PUT'
path_params = {}
if 'ned_id' in params:
path_params['nedId'] = params['ned_id']
if 'id' in params:
path_params['id'] = params['id']
query_params = {}
header_params = {}
if 'authorization' in params:
header_params['Authorization'] = params['authorization']
form_params = {}
files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='Uniqueidentifier',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
def read_organization_by_uid(self, uid_type, uid_value, **kwargs):
"""
Read organization by UID
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.read_organization_by_uid(uid_type, uid_value, callback=callback_function)
:param callback function: The callback function
for asynchronous request. (optional)
:param str uid_type: (required)
:param str uid_value: (required)
:return: OrganizationComposite
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['uid_type', 'uid_value']
all_params.append('callback')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method read_organization_by_uid" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'uid_type' is set
if ('uid_type' not in params) or (params['uid_type'] is None):
raise ValueError("Missing the required parameter `uid_type` when calling `read_organization_by_uid`")
# verify the required parameter 'uid_value' is set
if ('uid_value' not in params) or (params['uid_value'] is None):
raise ValueError("Missing the required parameter `uid_value` when calling `read_organization_by_uid`")
resource_path = '/organizations/{uidType}/{uidValue}'.replace('{format}', 'json')
method = 'GET'
path_params = {}
if 'uid_type' in params:
path_params['uidType'] = params['uid_type']
if 'uid_value' in params:
path_params['uidValue'] = params['uid_value']
query_params = {}
header_params = {}
form_params = {}
files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
if not header_params['Accept']:
del header_params['Accept']
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.\
select_header_content_type([])
# Authentication setting
auth_settings = []
response = self.api_client.call_api(resource_path, method,
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=files,
response_type='OrganizationComposite',
auth_settings=auth_settings,
callback=params.get('callback'))
return response
| 36.760341 | 114 | 0.524672 | 5,820 | 60,434 | 5.265979 | 0.035911 | 0.026266 | 0.02545 | 0.023558 | 0.936244 | 0.924922 | 0.918363 | 0.911805 | 0.910174 | 0.899732 | 0 | 0.000298 | 0.388291 | 60,434 | 1,643 | 115 | 36.782715 | 0.828744 | 0.243572 | 0 | 0.855188 | 0 | 0 | 0.166713 | 0.017953 | 0 | 0 | 0 | 0 | 0 | 1 | 0.022805 | false | 0 | 0.006842 | 0 | 0.052452 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
b6994c17170f9ef3c9b5a3c937a714b433767a49 | 20,543 | py | Python | sdk/python/pulumi_azure/servicebus/namespace_disaster_recovery_config.py | henriktao/pulumi-azure | f1cbcf100b42b916da36d8fe28be3a159abaf022 | [
"ECL-2.0",
"Apache-2.0"
] | 109 | 2018-06-18T00:19:44.000Z | 2022-02-20T05:32:57.000Z | sdk/python/pulumi_azure/servicebus/namespace_disaster_recovery_config.py | henriktao/pulumi-azure | f1cbcf100b42b916da36d8fe28be3a159abaf022 | [
"ECL-2.0",
"Apache-2.0"
] | 663 | 2018-06-18T21:08:46.000Z | 2022-03-31T20:10:11.000Z | sdk/python/pulumi_azure/servicebus/namespace_disaster_recovery_config.py | henriktao/pulumi-azure | f1cbcf100b42b916da36d8fe28be3a159abaf022 | [
"ECL-2.0",
"Apache-2.0"
] | 41 | 2018-07-19T22:37:38.000Z | 2022-03-14T10:56:26.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
__all__ = ['NamespaceDisasterRecoveryConfigArgs', 'NamespaceDisasterRecoveryConfig']
@pulumi.input_type
class NamespaceDisasterRecoveryConfigArgs:
def __init__(__self__, *,
partner_namespace_id: pulumi.Input[str],
primary_namespace_id: pulumi.Input[str],
name: Optional[pulumi.Input[str]] = None):
"""
The set of arguments for constructing a NamespaceDisasterRecoveryConfig resource.
:param pulumi.Input[str] partner_namespace_id: The ID of the Service Bus Namespace to replicate to.
:param pulumi.Input[str] primary_namespace_id: The ID of the primary Service Bus Namespace to replicate. Changing this forces a new resource to be created.
:param pulumi.Input[str] name: Specifies the name of the Disaster Recovery Config. This is the alias DNS name that will be created. Changing this forces a new resource to be created.
"""
pulumi.set(__self__, "partner_namespace_id", partner_namespace_id)
pulumi.set(__self__, "primary_namespace_id", primary_namespace_id)
if name is not None:
pulumi.set(__self__, "name", name)
@property
@pulumi.getter(name="partnerNamespaceId")
def partner_namespace_id(self) -> pulumi.Input[str]:
"""
The ID of the Service Bus Namespace to replicate to.
"""
return pulumi.get(self, "partner_namespace_id")
@partner_namespace_id.setter
def partner_namespace_id(self, value: pulumi.Input[str]):
pulumi.set(self, "partner_namespace_id", value)
@property
@pulumi.getter(name="primaryNamespaceId")
def primary_namespace_id(self) -> pulumi.Input[str]:
"""
The ID of the primary Service Bus Namespace to replicate. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "primary_namespace_id")
@primary_namespace_id.setter
def primary_namespace_id(self, value: pulumi.Input[str]):
pulumi.set(self, "primary_namespace_id", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Specifies the name of the Disaster Recovery Config. This is the alias DNS name that will be created. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@pulumi.input_type
class _NamespaceDisasterRecoveryConfigState:
def __init__(__self__, *,
default_primary_key: Optional[pulumi.Input[str]] = None,
default_secondary_key: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
partner_namespace_id: Optional[pulumi.Input[str]] = None,
primary_connection_string_alias: Optional[pulumi.Input[str]] = None,
primary_namespace_id: Optional[pulumi.Input[str]] = None,
secondary_connection_string_alias: Optional[pulumi.Input[str]] = None):
"""
Input properties used for looking up and filtering NamespaceDisasterRecoveryConfig resources.
:param pulumi.Input[str] default_primary_key: The primary access key for the authorization rule `RootManageSharedAccessKey`.
:param pulumi.Input[str] default_secondary_key: The secondary access key for the authorization rule `RootManageSharedAccessKey`.
:param pulumi.Input[str] name: Specifies the name of the Disaster Recovery Config. This is the alias DNS name that will be created. Changing this forces a new resource to be created.
:param pulumi.Input[str] partner_namespace_id: The ID of the Service Bus Namespace to replicate to.
:param pulumi.Input[str] primary_connection_string_alias: The alias Primary Connection String for the ServiceBus Namespace.
:param pulumi.Input[str] primary_namespace_id: The ID of the primary Service Bus Namespace to replicate. Changing this forces a new resource to be created.
:param pulumi.Input[str] secondary_connection_string_alias: The alias Secondary Connection String for the ServiceBus Namespace
"""
if default_primary_key is not None:
pulumi.set(__self__, "default_primary_key", default_primary_key)
if default_secondary_key is not None:
pulumi.set(__self__, "default_secondary_key", default_secondary_key)
if name is not None:
pulumi.set(__self__, "name", name)
if partner_namespace_id is not None:
pulumi.set(__self__, "partner_namespace_id", partner_namespace_id)
if primary_connection_string_alias is not None:
pulumi.set(__self__, "primary_connection_string_alias", primary_connection_string_alias)
if primary_namespace_id is not None:
pulumi.set(__self__, "primary_namespace_id", primary_namespace_id)
if secondary_connection_string_alias is not None:
pulumi.set(__self__, "secondary_connection_string_alias", secondary_connection_string_alias)
@property
@pulumi.getter(name="defaultPrimaryKey")
def default_primary_key(self) -> Optional[pulumi.Input[str]]:
"""
The primary access key for the authorization rule `RootManageSharedAccessKey`.
"""
return pulumi.get(self, "default_primary_key")
@default_primary_key.setter
def default_primary_key(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "default_primary_key", value)
@property
@pulumi.getter(name="defaultSecondaryKey")
def default_secondary_key(self) -> Optional[pulumi.Input[str]]:
"""
The secondary access key for the authorization rule `RootManageSharedAccessKey`.
"""
return pulumi.get(self, "default_secondary_key")
@default_secondary_key.setter
def default_secondary_key(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "default_secondary_key", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
Specifies the name of the Disaster Recovery Config. This is the alias DNS name that will be created. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="partnerNamespaceId")
def partner_namespace_id(self) -> Optional[pulumi.Input[str]]:
"""
The ID of the Service Bus Namespace to replicate to.
"""
return pulumi.get(self, "partner_namespace_id")
@partner_namespace_id.setter
def partner_namespace_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "partner_namespace_id", value)
@property
@pulumi.getter(name="primaryConnectionStringAlias")
def primary_connection_string_alias(self) -> Optional[pulumi.Input[str]]:
"""
The alias Primary Connection String for the ServiceBus Namespace.
"""
return pulumi.get(self, "primary_connection_string_alias")
@primary_connection_string_alias.setter
def primary_connection_string_alias(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "primary_connection_string_alias", value)
@property
@pulumi.getter(name="primaryNamespaceId")
def primary_namespace_id(self) -> Optional[pulumi.Input[str]]:
"""
The ID of the primary Service Bus Namespace to replicate. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "primary_namespace_id")
@primary_namespace_id.setter
def primary_namespace_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "primary_namespace_id", value)
@property
@pulumi.getter(name="secondaryConnectionStringAlias")
def secondary_connection_string_alias(self) -> Optional[pulumi.Input[str]]:
"""
The alias Secondary Connection String for the ServiceBus Namespace
"""
return pulumi.get(self, "secondary_connection_string_alias")
@secondary_connection_string_alias.setter
def secondary_connection_string_alias(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "secondary_connection_string_alias", value)
class NamespaceDisasterRecoveryConfig(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
name: Optional[pulumi.Input[str]] = None,
partner_namespace_id: Optional[pulumi.Input[str]] = None,
primary_namespace_id: Optional[pulumi.Input[str]] = None,
__props__=None):
"""
Manages a Disaster Recovery Config for a Service Bus Namespace.
> **NOTE:** Disaster Recovery Config is a Premium Sku only capability.
## Example Usage
```python
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
primary = azure.servicebus.Namespace("primary",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
sku="Premium",
capacity=1)
secondary = azure.servicebus.Namespace("secondary",
location="West US",
resource_group_name=example_resource_group.name,
sku="Premium",
capacity=1)
example_namespace_disaster_recovery_config = azure.servicebus.NamespaceDisasterRecoveryConfig("exampleNamespaceDisasterRecoveryConfig",
primary_namespace_id=primary.id,
partner_namespace_id=secondary.id)
```
## Import
Service Bus DR configs can be imported using the `resource id`, e.g.
```sh
$ pulumi import azure:servicebus/namespaceDisasterRecoveryConfig:NamespaceDisasterRecoveryConfig config1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ServiceBus/namespaces/namespace1/disasterRecoveryConfigs/config1
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] name: Specifies the name of the Disaster Recovery Config. This is the alias DNS name that will be created. Changing this forces a new resource to be created.
:param pulumi.Input[str] partner_namespace_id: The ID of the Service Bus Namespace to replicate to.
:param pulumi.Input[str] primary_namespace_id: The ID of the primary Service Bus Namespace to replicate. Changing this forces a new resource to be created.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: NamespaceDisasterRecoveryConfigArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
Manages a Disaster Recovery Config for a Service Bus Namespace.
> **NOTE:** Disaster Recovery Config is a Premium Sku only capability.
## Example Usage
```python
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
primary = azure.servicebus.Namespace("primary",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
sku="Premium",
capacity=1)
secondary = azure.servicebus.Namespace("secondary",
location="West US",
resource_group_name=example_resource_group.name,
sku="Premium",
capacity=1)
example_namespace_disaster_recovery_config = azure.servicebus.NamespaceDisasterRecoveryConfig("exampleNamespaceDisasterRecoveryConfig",
primary_namespace_id=primary.id,
partner_namespace_id=secondary.id)
```
## Import
Service Bus DR configs can be imported using the `resource id`, e.g.
```sh
$ pulumi import azure:servicebus/namespaceDisasterRecoveryConfig:NamespaceDisasterRecoveryConfig config1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ServiceBus/namespaces/namespace1/disasterRecoveryConfigs/config1
```
:param str resource_name: The name of the resource.
:param NamespaceDisasterRecoveryConfigArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(NamespaceDisasterRecoveryConfigArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
name: Optional[pulumi.Input[str]] = None,
partner_namespace_id: Optional[pulumi.Input[str]] = None,
primary_namespace_id: Optional[pulumi.Input[str]] = None,
__props__=None):
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = NamespaceDisasterRecoveryConfigArgs.__new__(NamespaceDisasterRecoveryConfigArgs)
__props__.__dict__["name"] = name
if partner_namespace_id is None and not opts.urn:
raise TypeError("Missing required property 'partner_namespace_id'")
__props__.__dict__["partner_namespace_id"] = partner_namespace_id
if primary_namespace_id is None and not opts.urn:
raise TypeError("Missing required property 'primary_namespace_id'")
__props__.__dict__["primary_namespace_id"] = primary_namespace_id
__props__.__dict__["default_primary_key"] = None
__props__.__dict__["default_secondary_key"] = None
__props__.__dict__["primary_connection_string_alias"] = None
__props__.__dict__["secondary_connection_string_alias"] = None
super(NamespaceDisasterRecoveryConfig, __self__).__init__(
'azure:servicebus/namespaceDisasterRecoveryConfig:NamespaceDisasterRecoveryConfig',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
default_primary_key: Optional[pulumi.Input[str]] = None,
default_secondary_key: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
partner_namespace_id: Optional[pulumi.Input[str]] = None,
primary_connection_string_alias: Optional[pulumi.Input[str]] = None,
primary_namespace_id: Optional[pulumi.Input[str]] = None,
secondary_connection_string_alias: Optional[pulumi.Input[str]] = None) -> 'NamespaceDisasterRecoveryConfig':
"""
Get an existing NamespaceDisasterRecoveryConfig resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] default_primary_key: The primary access key for the authorization rule `RootManageSharedAccessKey`.
:param pulumi.Input[str] default_secondary_key: The secondary access key for the authorization rule `RootManageSharedAccessKey`.
:param pulumi.Input[str] name: Specifies the name of the Disaster Recovery Config. This is the alias DNS name that will be created. Changing this forces a new resource to be created.
:param pulumi.Input[str] partner_namespace_id: The ID of the Service Bus Namespace to replicate to.
:param pulumi.Input[str] primary_connection_string_alias: The alias Primary Connection String for the ServiceBus Namespace.
:param pulumi.Input[str] primary_namespace_id: The ID of the primary Service Bus Namespace to replicate. Changing this forces a new resource to be created.
:param pulumi.Input[str] secondary_connection_string_alias: The alias Secondary Connection String for the ServiceBus Namespace
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _NamespaceDisasterRecoveryConfigState.__new__(_NamespaceDisasterRecoveryConfigState)
__props__.__dict__["default_primary_key"] = default_primary_key
__props__.__dict__["default_secondary_key"] = default_secondary_key
__props__.__dict__["name"] = name
__props__.__dict__["partner_namespace_id"] = partner_namespace_id
__props__.__dict__["primary_connection_string_alias"] = primary_connection_string_alias
__props__.__dict__["primary_namespace_id"] = primary_namespace_id
__props__.__dict__["secondary_connection_string_alias"] = secondary_connection_string_alias
return NamespaceDisasterRecoveryConfig(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter(name="defaultPrimaryKey")
def default_primary_key(self) -> pulumi.Output[str]:
"""
The primary access key for the authorization rule `RootManageSharedAccessKey`.
"""
return pulumi.get(self, "default_primary_key")
@property
@pulumi.getter(name="defaultSecondaryKey")
def default_secondary_key(self) -> pulumi.Output[str]:
"""
The secondary access key for the authorization rule `RootManageSharedAccessKey`.
"""
return pulumi.get(self, "default_secondary_key")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
Specifies the name of the Disaster Recovery Config. This is the alias DNS name that will be created. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "name")
@property
@pulumi.getter(name="partnerNamespaceId")
def partner_namespace_id(self) -> pulumi.Output[str]:
"""
The ID of the Service Bus Namespace to replicate to.
"""
return pulumi.get(self, "partner_namespace_id")
@property
@pulumi.getter(name="primaryConnectionStringAlias")
def primary_connection_string_alias(self) -> pulumi.Output[str]:
"""
The alias Primary Connection String for the ServiceBus Namespace.
"""
return pulumi.get(self, "primary_connection_string_alias")
@property
@pulumi.getter(name="primaryNamespaceId")
def primary_namespace_id(self) -> pulumi.Output[str]:
"""
The ID of the primary Service Bus Namespace to replicate. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "primary_namespace_id")
@property
@pulumi.getter(name="secondaryConnectionStringAlias")
def secondary_connection_string_alias(self) -> pulumi.Output[str]:
"""
The alias Secondary Connection String for the ServiceBus Namespace
"""
return pulumi.get(self, "secondary_connection_string_alias")
| 48.911905 | 272 | 0.694008 | 2,330 | 20,543 | 5.845494 | 0.08412 | 0.054919 | 0.066814 | 0.059765 | 0.846843 | 0.822394 | 0.796109 | 0.774963 | 0.747137 | 0.71909 | 0 | 0.004822 | 0.222704 | 20,543 | 419 | 273 | 49.02864 | 0.848134 | 0.379643 | 0 | 0.546729 | 1 | 0 | 0.150491 | 0.073005 | 0 | 0 | 0 | 0 | 0 | 1 | 0.158879 | false | 0.004673 | 0.023364 | 0 | 0.280374 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
b6aaa09da8f3ad1e32bd06d04653d66ce38d729e | 4,776 | py | Python | des_process/test_products.py | linea-it/des-process | 125d23d140825ee8987bf9fc46b0e5d2720abe32 | [
"Apache-2.0"
] | null | null | null | des_process/test_products.py | linea-it/des-process | 125d23d140825ee8987bf9fc46b0e5d2720abe32 | [
"Apache-2.0"
] | 2 | 2020-06-08T15:22:52.000Z | 2020-06-08T15:24:27.000Z | des_process/test_products.py | linea-it/des-process | 125d23d140825ee8987bf9fc46b0e5d2720abe32 | [
"Apache-2.0"
] | null | null | null | import unittest
import snapshottest
import requests
from des_process import product
class TestProducts(snapshottest.TestCase):
def setUp(self):
self.url = "http://scienceportal-dev.linea.gov.br/api/graphql"
def test_all(self):
query = """{
productsList(first: 5) {
edges {
node {
productId
processId
fileId
jobId
tableId
classId
flagRemoved
displayName
version
selectedName
table {
tableId
tableName
schemaName
}
}
}
}
}"""
response = requests.post(self.url, json={ 'query': query })
self.assertMatchSnapshot(response.json()['data'])
def test_by_id(self):
query = """{
productByProductId(productId: 310867) {
productId
processId
fileId
jobId
tableId
classId
flagRemoved
displayName
version
selectedName
table {
tableId
tableName
schemaName
}
}
}"""
response = requests.post(self.url, json={ 'query': query })
self.assertMatchSnapshot(response.json()['data'])
def test_by_process_id(self):
query = """{
productsByProcessId(processId: 10034331) {
productId
processId
fileId
jobId
tableId
classId
flagRemoved
displayName
version
selectedName
table {
tableId
tableName
schemaName
}
}
}"""
response = requests.post(self.url, json={ 'query': query })
self.assertMatchSnapshot(response.json()['data'])
def test_by_name(self):
query = """{
productsList(displayName: "ExpTime Sum 51") {
edges {
node {
productId
processId
fileId
jobId
tableId
classId
flagRemoved
displayName
version
selectedName
table {
tableId
tableName
schemaName
}
}
}
}
}"""
response = requests.post(self.url, json={ 'query': query })
self.assertMatchSnapshot(response.json()['data'])
def test_by_tag_id(self):
query = """{
productsList(first: 5, tagId: 4) {
edges {
node {
productId
processId
fileId
jobId
tableId
classId
flagRemoved
displayName
version
selectedName
table {
tableId
tableName
schemaName
}
}
}
}
}"""
response = requests.post(self.url, json={ 'query': query })
self.assertMatchSnapshot(response.json()['data'])
def test_field_id(self):
query = """{
productsList(first: 5, fieldId: 50) {
edges {
node {
productId
processId
fileId
jobId
tableId
classId
flagRemoved
displayName
version
selectedName
table {
tableId
tableName
schemaName
}
}
}
}
}"""
response = requests.post(self.url, json={ 'query': query })
self.assertMatchSnapshot(response.json()['data'])
def test_type_id(self):
query = """{
productsList(first: 5, typeId: 24) {
edges {
node {
productId
processId
fileId
jobId
tableId
classId
flagRemoved
displayName
version
selectedName
table {
tableId
tableName
schemaName
}
}
}
}
}"""
response = requests.post(self.url, json={ 'query': query })
self.assertMatchSnapshot(response.json()['data'])
def test_class_id(self):
query = """{
productsList(first: 5, classId: 128) {
edges {
node {
productId
processId
fileId
jobId
tableId
classId
flagRemoved
displayName
version
selectedName
table {
tableId
tableName
schemaName
}
}
}
}
}"""
response = requests.post(self.url, json={ 'query': query })
self.assertMatchSnapshot(response.json()['data']) | 20.765217 | 66 | 0.462102 | 339 | 4,776 | 6.457227 | 0.20354 | 0.02878 | 0.087711 | 0.105984 | 0.828689 | 0.816355 | 0.763362 | 0.763362 | 0.763362 | 0.763362 | 0 | 0.011201 | 0.457915 | 4,776 | 230 | 67 | 20.765217 | 0.834299 | 0 | 0 | 0.753623 | 0 | 0 | 0.702114 | 0.017584 | 0 | 0 | 0 | 0 | 0.038647 | 1 | 0.043478 | false | 0 | 0.019324 | 0 | 0.067633 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
1e15209223089af1b08fe69fb550205c16d9fddb | 7,456 | py | Python | src/data_util/voc_keys.py | xiaohujecky/Attention-OCR | 7b159b6c5ba954829a36e7717152d6dfd4c369a8 | [
"MIT"
] | null | null | null | src/data_util/voc_keys.py | xiaohujecky/Attention-OCR | 7b159b6c5ba954829a36e7717152d6dfd4c369a8 | [
"MIT"
] | null | null | null | src/data_util/voc_keys.py | xiaohujecky/Attention-OCR | 7b159b6c5ba954829a36e7717152d6dfd4c369a8 | [
"MIT"
] | null | null | null | #coding:UTF-8
# character size : 7396
alphabet = u"""0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!"#$%&'()*+,-./:;<=>?@[\]^_`~赵钱孙李周吴郑王冯陈褚卫蒋沉韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻柏水窦章云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁柳酆鲍史唐费廉岑薛雷贺倪汤滕殷罗毕郝邬安常乐于时傅皮卞齐康伍余元卜顾孟平黄和穆萧尹姚邵湛汪祁毛禹狄米贝明臧计伏成戴谈宋茅厐熊纪舒屈项祝董梁杜阮蓝闵席季麻强贾路娄危江童颜郭梅盛林刁钟徐邱骆高夏蔡田樊胡凌霍虞万支柯昝管卢莫经房裘缪干解应宗丁宣贲邓郁单杭洪包诸左石崔吉钮龚程嵇邢滑裴陆荣翁荀羊惠甄曲家封芮羿储靳汲邴糜松井段富巫乌焦巴弓牧隗山谷车侯虙蓬全郗班仰秋仲伊宫宁仇栾暴甘钭厉戎祖武符刘景詹束龙叶幸司韶郜黎蓟薄印宿白怀蒲邰从鄂索咸籍赖卓蔺屠蒙池乔阴胥能苍双闻莘党翟谭贡劳逄姬申扶堵冉宰郦雍却璩桑桂濮牛寿通边扈燕冀郏浦尚农温别庄晏柴瞿阎充慕连茹习宦艾鱼容向古易慎戈廖庾终暨居衡步都耿满弘匡国文寇广禄阙东欧殳沃利蔚越夔隆师巩厍聂晁勾敖融冷訾辛阚那简饶空曾毋沙乜养鞠须丰巢关蒯相查后荆红游竺权逯盖益桓公俟上官阳人赫皇甫尉迟澹台冶政淳太叔轩辕令狐离宇长鲜闾丘徒丌仉督子颛端木西漆雕正壤驷良拓跋夹父晋楚法汝鄢涂钦百里南门呼延归海舌微生岳帅缑亢况有琴商牟佘佴伯赏墨哈谯笪年爱佟第五言福姓啊阿埃挨哎唉哀皑癌蔼矮碍隘鞍氨俺按暗岸胺案肮昂盎凹熬翱袄傲奥懊澳芭捌扒叭吧笆八疤拔靶把耙坝霸罢爸摆佰败拜稗斑搬扳般颁板版扮拌伴瓣半办绊邦帮梆榜膀绑棒磅蚌镑傍谤苞胞褒剥雹保堡饱宝抱报豹爆杯碑悲卑北辈背钡倍狈备惫焙被奔苯本笨崩绷甭泵蹦迸逼鼻比鄙笔彼碧蓖蔽毙毖币庇痹闭敝弊必辟壁臂避陛鞭编贬扁便变辨辩辫遍标彪膘表鳖憋瘪彬斌濒滨宾摈兵冰柄丙秉饼炳病并玻菠播拨钵波博勃搏铂箔帛舶脖膊渤泊驳捕哺补埠不布簿部怖擦猜裁材才财睬踩采彩菜餐参蚕残惭惨灿舱仓沧藏操糙槽草厕策侧册测层蹭插叉茬茶碴搽察岔差诧拆豺搀掺蝉馋谗缠铲产阐颤猖场尝偿肠厂敞畅唱倡超抄钞朝嘲潮吵炒扯撤掣彻澈郴臣辰尘晨忱趁衬撑称城橙呈乘惩澄诚承逞骋秤吃痴持匙弛驰耻齿侈尺赤翅斥炽冲虫崇宠抽酬畴踌稠愁筹绸瞅丑臭初出橱厨躇锄雏滁除础矗搐触处揣川穿椽传船喘串疮窗幢床闯创吹炊捶锤垂春椿醇唇纯蠢戳绰疵茨磁雌辞慈瓷词此刺赐次聪葱囱匆丛凑粗醋簇促蹿篡窜摧催脆瘁粹淬翠村存寸磋撮搓措挫错搭达答瘩打大呆歹傣带殆代贷袋待逮怠耽担丹郸掸胆旦氮但惮淡诞弹蛋当挡荡档刀捣蹈倒岛祷导到稻悼道盗德得的蹬灯登等瞪凳堤低滴迪敌笛涤嫡抵底地蒂帝弟递缔颠掂滇碘点典靛垫电佃甸店惦奠淀殿碉叼凋掉吊钓调跌爹碟蝶迭谍叠盯叮钉顶鼎锭定订丢冬懂动栋侗恫冻洞兜抖斗陡豆逗痘毒犊独读睹赌镀肚度渡妒短锻断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆多夺垛躲朵跺舵剁惰堕蛾峨鹅俄额讹娥恶厄扼遏饿恩而儿耳尔饵洱二贰发罚筏伐乏阀珐藩帆番翻矾钒繁凡烦反返贩犯饭泛坊芳肪防妨仿访纺放菲非啡飞肥匪诽吠肺废沸芬酚吩氛分纷坟焚汾粉奋份忿愤粪枫蜂峰锋风疯烽逢缝讽奉佛否夫敷肤孵拂辐幅氟俘服浮涪袱弗抚辅俯釜斧脯腑府腐赴副覆赋复付阜腹负讣附妇缚咐噶嘎该改概钙溉杆柑竿肝赶感秆敢赣冈刚钢缸肛纲岗港杠篙皋膏羔糕搞镐稿告哥歌搁鸽胳疙割革格蛤阁隔铬个各给根跟耕更庚羹埂梗工攻功恭供躬汞拱共钩沟苟狗垢构购够辜菇咕箍估沽孤姑鼓蛊骨股故固雇刮瓜剐寡挂褂乖拐怪棺冠观馆罐惯灌贯光逛瑰规圭硅龟闺轨鬼诡癸柜跪贵刽辊滚棍锅果裹过骸孩氦亥害骇酣憨邯含涵寒函喊罕翰撼捍旱憾悍焊汗汉夯航壕嚎豪毫好耗号浩呵喝荷菏核禾合盒貉阂河涸褐鹤嘿黑痕很狠恨哼亨横恒轰哄烘虹鸿宏喉猴吼厚候乎忽瑚壶葫蝴糊湖弧虎唬护互沪户哗猾画划化话槐徊淮坏欢环还缓换患唤痪豢焕涣幻荒慌磺蝗簧凰惶煌晃幌恍谎灰挥辉徽恢蛔回毁悔慧卉晦贿秽会烩汇讳诲绘荤昏婚魂浑混豁活伙火获或惑货祸击圾基机畸稽积箕肌饥迹激讥鸡绩缉极棘辑集及急疾即嫉级挤几脊己技伎祭剂悸济寄寂记既忌际妓继嘉枷佳加荚颊甲钾假稼价架驾嫁歼监坚尖笺间煎兼肩艰奸缄茧检柬碱硷拣捡俭剪减荐槛鉴践贱见键箭件健舰剑饯渐溅涧建僵将浆疆桨奖讲匠酱降蕉椒礁胶交郊浇骄娇嚼搅铰矫侥脚狡角饺缴绞剿教酵轿较叫窖揭接皆秸街阶截劫节桔杰捷睫竭洁结姐戒藉芥界借介疥诫届巾筋斤今津襟紧锦仅谨进禁近烬浸尽劲兢茎睛晶鲸京惊精粳警颈静境敬镜径痉靖竟竞净炯窘揪究纠玖韭久灸九酒厩救旧臼舅咎就疚拘狙疽驹菊局咀矩举沮聚拒据巨具距踞锯俱句惧炬剧捐鹃娟倦眷卷绢撅攫抉掘倔爵觉决诀绝均菌钧军君峻俊竣浚郡骏喀咖卡咯开揩楷凯慨刊堪勘坎砍看慷糠扛抗炕考拷烤靠坷苛棵磕颗科壳咳可渴克刻客课肯啃垦恳坑吭恐控抠口扣枯哭窟苦酷库裤夸垮挎跨胯块筷侩快宽款筐狂框矿眶旷亏盔岿窥葵奎魁傀馈愧溃坤昆捆困括扩廓阔垃拉喇蜡腊辣啦莱来婪栏拦篮阑兰澜谰揽览懒缆烂滥琅榔狼廊朗浪捞牢老佬姥酪烙涝勒镭蕾磊累儡垒擂肋类泪棱楞厘梨犁篱狸漓理鲤礼莉荔吏栗丽励砾历傈例俐痢立粒沥隶力璃哩俩联莲镰怜涟帘敛脸链恋炼练粮凉粱两辆量晾亮谅撩聊僚疗燎寥辽潦了撂镣料列裂烈劣猎琳磷霖临邻鳞淋凛赁吝拎玲菱零龄铃伶羚灵陵岭领另溜琉榴硫馏留瘤流六聋咙笼窿垄拢陇楼搂篓漏陋芦颅庐炉掳卤虏麓碌露赂鹿潞录戮驴铝侣旅履屡缕虑氯律率滤绿峦挛孪滦卵乱掠略抡轮伦仑沦纶论萝螺逻锣箩骡裸落洛络妈玛码蚂骂嘛吗埋买麦卖迈脉瞒馒蛮蔓曼慢漫谩芒茫盲氓忙莽猫锚矛铆卯茂冒帽貌贸么玫枚酶霉煤没眉媒镁每美昧寐妹媚闷们萌檬盟锰猛梦眯醚靡迷谜弥秘觅泌蜜密幂棉眠绵冕免勉娩缅面描瞄藐秒渺庙妙蔑灭民抿皿敏悯闽螟鸣铭名命谬摸摹蘑模膜磨摩魔抹末默沫漠寞陌谋某拇牡亩姆母墓暮幕募目睦拿哪呐钠娜纳氖乃奶耐奈男难囊挠脑恼闹淖呢馁内嫩妮霓泥尼拟你匿腻逆溺蔫拈碾撵捻念娘酿鸟尿捏孽啮镊镍涅您柠狞凝拧泞扭纽脓浓弄奴努怒女暖虐疟挪懦糯诺哦鸥殴藕呕偶沤啪趴爬帕怕琶拍排牌徘湃派攀盘磐盼畔判叛乓庞旁耪胖抛咆刨炮袍跑泡呸胚培赔陪配佩沛喷盆砰抨烹澎棚硼篷膨朋鹏捧碰坯砒霹批披劈琵毗啤脾疲匹痞僻屁譬篇偏片骗飘漂瓢票撇瞥拼频贫品聘乒坪苹萍凭瓶评屏坡泼颇婆破魄迫粕剖扑铺仆莆葡菩埔朴圃普谱曝瀑期欺栖妻七凄柒沏其棋奇歧畦崎脐旗祈骑起岂乞企启契砌器气迄弃汽泣讫掐恰洽牵扦钎铅千迁签仟谦乾黔钳前潜遣浅谴堑嵌欠歉枪呛腔羌墙蔷抢橇锹敲悄桥瞧侨巧鞘撬翘峭俏窍切茄且怯窃侵亲勤芹擒禽寝沁青轻氢倾卿清擎晴氰情顷请庆琼穷球求囚酋泅趋区蛆躯驱渠取娶龋趣去圈颧醛泉痊拳犬券劝缺炔瘸鹊榷确雀裙群然燃染瓤攘嚷让扰绕惹热壬仁忍韧认刃妊纫扔仍日茸蓉熔溶绒冗揉柔肉蠕儒孺如辱乳入褥软蕊瑞锐闰润若弱撒洒萨腮鳃塞赛三叁伞散嗓丧搔骚扫嫂瑟色涩森僧莎砂杀刹纱傻啥煞筛晒珊苫杉删煽衫闪陕擅赡膳善汕扇缮墒伤晌裳梢捎稍烧芍勺少哨绍奢赊蛇舍赦摄射慑涉社设砷呻伸身深娠绅神沈审婶甚肾渗声甥牲升绳省剩胜圣失狮湿诗尸虱十拾什食蚀实识矢使屎驶始式示士世柿事拭誓逝势是嗜噬适仕侍释饰氏市恃室视试收手首守授售受瘦兽蔬枢梳殊抒输淑疏书赎孰熟薯暑曙署蜀黍鼠属术述树戍竖墅庶数漱恕刷耍摔衰甩栓拴霜爽谁睡税吮瞬顺舜说硕朔烁斯撕嘶思私丝死肆寺嗣四伺似饲巳耸怂颂送讼诵搜艘擞嗽酥俗素速粟僳塑溯诉肃酸蒜算虽隋随绥髓碎岁穗遂隧祟损笋蓑梭唆缩琐锁所塌他它她塔獭挞蹋踏胎苔抬泰酞态汰坍摊贪瘫滩坛檀痰潭坦毯袒碳探叹炭塘搪堂棠膛糖倘躺淌趟烫掏涛滔绦萄桃逃淘讨套特藤腾疼誊梯剔踢锑提题蹄啼体替嚏惕涕剃屉天添填甜恬舔腆挑条迢眺跳贴铁帖厅听烃汀廷停亭庭挺艇桐酮瞳同铜彤桶捅筒统痛偷投头透凸秃突图途土吐兔湍团推颓腿蜕褪退吞屯臀拖托脱鸵陀驮驼椭妥唾挖哇蛙洼娃瓦袜歪外豌弯湾玩顽丸烷完碗挽晚皖惋宛婉腕亡枉网往旺望忘妄威巍违桅围唯惟为潍维苇萎委伟伪尾纬未味畏胃喂位渭谓慰瘟蚊纹吻稳紊问嗡瓮挝蜗涡窝我斡卧握呜钨污诬屋无芜梧吾捂午舞侮坞戊雾晤物勿务悟误昔熙析硒矽晰嘻吸锡牺稀息希悉膝夕惜熄烯溪汐犀檄袭媳喜铣洗系隙戏细瞎虾匣霞辖暇峡侠狭下厦吓掀锨先仙纤贤衔舷闲涎弦嫌显险现献县腺馅羡宪陷限线厢镶香箱襄湘乡翔祥详想响享巷橡像象硝霄削哮嚣销消宵淆晓小孝校肖啸笑效楔些歇蝎鞋协挟携邪斜胁谐写械卸蟹懈泄泻屑薪芯锌欣新忻心信衅星腥猩惺兴刑型形行醒杏性兄凶胸匈汹雄休修羞朽嗅锈秀袖绣墟戌需虚嘘蓄酗叙旭序畜恤絮婿绪续喧悬旋玄选癣眩绚靴学穴雪血勋熏循旬询寻驯巡殉汛训讯逊迅压押鸦鸭呀丫芽牙蚜崖衙涯雅哑亚讶焉咽阉烟淹盐研蜒岩炎沿奄掩眼衍演艳堰厌砚雁唁彦焰宴谚验殃央鸯秧扬佯疡洋氧痒样漾邀腰妖瑶摇尧遥窑谣咬舀药要耀椰噎耶爷野也页掖业曳腋夜液一壹医揖铱依衣颐夷遗移仪胰疑沂宜姨彝椅蚁倚已乙矣以艺抑邑屹亿役臆逸肄疫亦裔意毅忆义溢诣议谊译异翼翌绎茵荫因音姻吟银淫寅饮引隐英樱婴鹰缨莹萤营荧蝇迎赢盈影颖硬映哟拥佣臃痈庸踊蛹咏泳涌永恿勇用幽优悠忧由邮铀犹油酉友右佑釉诱又幼迂淤盂榆愚舆逾愉渝渔隅予娱雨与屿语羽玉域芋吁遇峪御愈欲狱育誉浴寓裕预豫驭鸳渊冤垣原援园员圆猿源缘远苑愿怨院曰约跃钥粤月悦阅耘郧匀陨允运蕴酝晕韵孕匝砸杂栽哉灾载再在咱攒暂赞赃脏葬遭糟凿藻枣早澡蚤躁噪造皂灶燥责择则泽贼怎增憎赠扎喳渣札轧铡闸眨栅榨咋乍炸诈摘斋宅窄债寨瞻毡粘沾盏斩辗崭展蘸栈占战站绽樟彰漳掌涨杖丈帐账仗胀瘴障招昭找沼照罩兆肇召遮折哲蛰辙者锗蔗这浙珍斟真砧臻贞针侦枕疹诊震振镇阵蒸挣睁征狰争怔整拯帧症证芝枝吱蜘知肢脂汁之织职直植殖执值侄址指止趾只旨纸志挚掷至致置帜峙制智秩稚质炙痔滞治窒中盅忠衷种肿重众舟州洲诌粥轴肘帚咒皱宙昼骤珠株蛛猪诛逐竹烛煮拄瞩嘱主著柱助蛀贮铸筑住注驻抓爪拽专砖转撰赚篆桩装妆撞壮状椎锥追赘坠缀谆准捉拙桌琢茁酌啄着灼浊兹咨资姿滋淄孜紫仔籽滓自渍字鬃棕踪综总纵走奏揍租足卒族诅阻组钻纂嘴醉最罪尊遵昨佐柞做作坐座亍兀丐廿卅丕亘丞鬲孬噩丨禺丿匕乇夭爻卮氐囟胤馗毓睾鼗丶亟鼐乩亓芈孛啬嘏仄厝厣厥厮靥赝匚叵匦匮匾赜卦卣刂刈刎刭刳刿剀剌剞剡剜剽劂劁劐劓冂罔亻仃仂仨仡仫仞伛仳伢佤仵伥伧伉伫佞佧攸佚佝佗伲伽佶侑侉侃侏佾佻侪佼侬侔俦俨俪俅俚俣俜俑俸倩偌俳倬倏倮倭俾倜倌倥倨偾偃偕偈偎偬偻傥傧傩傺僖儆僭僬僦僮儇儋仝氽佥俎龠汆籴兮巽黉馘冁勹匍訇匐凫夙兕亠兖亳衮袤亵脔裒禀嬴蠃羸冫冱冽冼凇冖冢冥讠讦讧讪讴讵讷诂诃诋诏诎诒诓诔诖诘诙诜诟诠诤诨诩诮诰诳诶诹诼诿谀谂谄谇谌谏谑谒谔谕谖谙谛谘谝谟谠谡谥谧谪谫谮谲谳谵谶卩卺阝阢阡阱阪阽阼陂陉陔陟陧陬陲陴隈隍隰邗邛邝邙邡邳邶邺邸郅邾郐郄郇郓郢郛郫郯郾鄄鄞鄣鄱鄯鄹酃刍奂劢劬劭劾哿勐勖勰叟燮矍廴凵凼鬯厶弁畚巯坌垩垡塾墼壅壑圩圬圪圳圹圮圯坜圻坂坩垅坫垆坼坻坨坭坶坳垭垤垌垲埏垧垴垓垠埕埘埚埙埒垸埴埯埸埤埝堋堍埽埭堀堞堙塄堠塥塬墁墉墚墀馨鼙懿艹艽艿芏芊芨芄芎芑芗芙芫芸芾芰苈苊苣芘芷苋苌苁芩芴芡芪芟苄苎芤苡茉苷苤茏茇苜苴苒苘茌苻苓茑茚茆茔茕苠苕茜荑荛荜茈莒茼茴茱莛荞茯荏荇荃荟茗荠茭茺茳荦荥荨茛荩荬荪荭荮莰荸莳莴莠莪莓莜莅荼莶莩荽莸荻莞莨莺莼菁萁菥菘堇萘萋菝菽菖萜萸萑萆菔菟萏萃菸菹菪菅菀萦菰菡葜葑葚葙葳蒇蒈葺蒉葸萼葆葩葶蒌蒎萱葭蓁蓍蓐蓦蒽蓓蓊蒿蒺蓠蒡蒹蒴蒗蓥蓣蔌甍蔸蓰蔹蔟蕖蔻蓿蓼蕙蕈蕨蕤蕞蕺瞢蕃蕲蕻薤薨薇薏蕹薮薜薅薹薷薰藓藁藜藿蘧蘅蘩蘖蘼廾弈夼奁耷奕奘匏尢尥尬尴扌扪抟抻拊拚拗拮挢拶挹捋捃掭揶捱捺掎掴捭掬掊捩掮掼揲揸揠揿揄揞揎摒揆掾摅摁搋搛搠搌搦搡摞撄摭撖摺撷撸撙撺擀擐擗擤擢攉攥攮弋忒甙弑卟叱叽叩叨叻吒吖吆呋呒呓呔呖呃吡呗呙吣吲咂咔呷呱呤咚咛咄呶呦咝哐咭哂咴哒咧咦哓哔呲咣哕咻咿哌哙哚哜咩咪咤哝哏哞唛哧唠哽唔哳唢唣唏唑唧唪啧喏喵啉啭啁啕唿啐唼唷啖啵啶啷唳唰啜喋嗒喃喱喹喈喁喟啾嗖喑啻嗟喽喾喔喙嗪嗷嗉嘟嗑嗫嗬嗔嗦嗝嗄嗯嗥嗲嗳嗌嗍嗨嗵嗤辔嘞嘈嘌嘁嘤嘣嗾嘀嘧嘭噘嘹噗嘬噍噢噙噜噌噔嚆噤噱噫噻噼嚅嚓嚯囔囗囝囡囵囫囹囿圄圊圉圜帏帙帔帑帱帻帼帷幄幔幛幞幡岌屺岍岐岖岈岘岙岚岜岵岢岽岬岫岱岣峁岷峄峒峤峋峥崂崃崧崦崮崤崞崆崛嵘崾崴崽嵬嵛嵯嵝嵫嵋嵊嵩嵴嶂嶙嶝豳嶷巅彳彷徂徇徉後徕徙徜徨徭徵徼衢彡犭犰犴犷犸狃狁狎狍狒狨狯狩狲狴狷猁狳猃狺狻猗猓猡猊猞猝猕猢猹猥猬猸猱獐獍獗獠獬獯獾舛夥飧夤夂饣饧饨饩饪饫饬饴饷饽馀馄馇馊馍馐馑馓馔馕庀庑庋庖庥庠庹庵庳赓廒廑廛廨廪膺忄忉忖忏怃忮怄忡忤忾怅怆忪忭忸怙怵怦怛怏怍怩怫怊怿怡恸恹恻恺恂恪恽悖悚悭悝悃悒悌悛惬悻悱惝惘惆惚悴愠愦愕愣惴愀愎愫慊慵憬憔憧憷懔懵忝隳闩闫闱闳闶闼阃阄阆阈阊阋阌阍阏阒阕阖阗丬爿戕氵汔汜汊沣沅沐沔沌汨汩汴汶沆沩泐泔沭泷泸泱泗沲泠泖泺泫泮沱泓泯泾洹洧洌浃浈洇洄洙洎洫浍洮洵洚浏浒浔洳涑浯涞涠浞涓涔浜浠浼浣渚淇淅淞渎涿淠渑淦淝淙渖涫渌涮渫湮湎湫溲湟溆湓湔渲渥湄滟溱溘滠漭滢溥溧溽溻溷滗溴滏溏滂溟潢潆潇漤漕滹漯漶潋潴漪漉漩澉澍澌潸潲潼潺濑濉澧澶濂濡濞濠濯瀚瀣瀛瀹瀵灏灞宀宄宕宓宥宸甯骞搴寤寮褰寰蹇謇辶迓迕迥迮迤迩迦迳迨逅逋逦逑逍逖逡逵逶逭遄遑遒遐遨遘遢遛暹遴遽邂邈邃邋彐彗彖彘尻咫屐屙孱屣屦羼弪弩弭艴弼鬻屮妁妃妍妩妪妣妗姊妫妞妤姒妲妯姗妾娅娆姝娈姣姘姹娌娉娲娴娑娣娓婀婧婊婕娼婢婵胬媪媛婷婺媾嫫媲嫒嫔媸嫠嫣嫱嫖嫦嫘嫜嬉嬗嬖嬲嬷孀尕尜孚孥孳孑孓孢驵驸驺驿驽骀骁骅骈骊骐骒骓骖骘骛骜骝骟骠骢骣骥骧纟纡纣纥纨纩纭纰纾绀绁绂绉绋绌绐绔绗绛绠绡绨绫绮绯绱绲缍绶绺绻绾缁缂缃缇缈缋缌缏缒缗缙缜缛缟缡缢缣缤缥缦缧缫缬缭缯缰缱缲缳缵幺畿巛甾邕玎玑玮玢玟珏珂珑玷玳珀珉珈珥珙顼琊珩珧珞玺珲琏琪瑛琦琥琨琰琮琬琛琚瑁瑜瑗瑕瑙瑷瑭瑾璜璎璀璁璇璋璞璨璐璧瓒璺韪韫韬杌杓杞杈杩枥枇杪杳枘枧杵枨枞枭枋杷杼柰栉柘栊柩枰栌柙枵柚枳柝栀柃枸柢栎柁柽栲栳桠桡桎桢桄桤梃栝桕桦桁桧桀桊桉栩梵梏桴桷梓桫棂楮棼椟椠棹椤棰椋椁楗棣椐楱椹楠楂楝榄楫榀榘楸椴槌榇榈槎榉楦楣楹榛榧榻榫榭槔榱槁槊槟榕槠榍槿樯槭樗樘橥槲橄樾檠橐橛樵檎橹樽樨橘橼檑檐檩檗檫猷獒殁殂殇殄殒殓殍殚殛殡殪轫轭轱轲轳轵轶轸轷轹轺轼轾辁辂辄辇辋辍辎辏辘辚軎戋戗戛戟戢戡戥戤戬瓯瓴瓿甏甑甓攴旮旯旰昊昙杲昃昕昀炅曷昴昱昶昵耆晟晔晖晡晗晷暄暌暧暝暾曛曜曦曩贳贶贻贽赀赅赆赈赉赇赍赕赙觇觊觋觌觎觏觐觑牮犟牝牦牯牾牿犄犋犍犏犒挈挲掰搿擘耄毪毳毽毵毹氅氇氆氍氕氘氙氚氡氩氤氪氲攵敕敫牍牒牖爰虢刖肟肜肓肼朊肽肱肫肭肴肷胧胨胩胪胛胂胄胙胍胗朐胝胫胱胴胭脍脎胲胼朕脒豚脶脞脬脘脲腈腌腓腴腙腚腱腠腩腼腽腭腧塍媵膈膂膑膣膪臌朦臊膻臁膦欤欷欹歃歆歙飑飒飓飕飙飚彀毂觳斐齑斓於旆旄旃旌旎旒旖炀炜炖炝炻烀炷炫炱烨烊焐焓焖焯焱煳煜煨煅煲煊煸煺熘熳熵熨熠燠燔燧燹爝爨灬焘煦熹戾戽扃扉礻祀祆祉祛祜祓祚祢祗祠祯祧祺禅禊禚禧禳忑忐怼恝恚恧恁恙恣悫愆愍慝憩憝懋懑戆肀聿沓泶淼矶矸砀砉砗砘砑斫砭砜砝砹砺砻砟砼砥砬砣砩硎硭硖硗砦硐硇硌硪碛碓碚碇碜碡碣碲碹碥磔磙磉磬磲礅磴礓礤礞礴龛黹黻黼盱眄眍盹眇眈眚眢眙眭眦眵眸睐睑睇睃睚睨睢睥睿瞍睽瞀瞌瞑瞟瞠瞰瞵瞽町畀畎畋畈畛畲畹疃罘罡罟詈罨罴罱罹羁罾盍盥蠲钅钆钇钋钊钌钍钏钐钔钗钕钚钛钜钣钤钫钪钬钯钰钲钴钶钷钸钹钺钼钽钿铄铈铉铊铋铌铍铎铐铑铒铕铖铗铙铘铛铞铟铠铢铤铥铧铨铪铩铫铮铯铳铴铵铷铹铼铽铿锃锂锆锇锉锊锍锎锏锒锓锔锕锖锘锛锝锞锟锢锪锫锩锬锱锲锴锶锷锸锼锾锿镂锵镄镅镆镉镌镎镏镒镓镔镖镗镘镙镛镞镟镝镡镢镤镥镦镧镨镩镪镫镬镯镱镲镳锺矧矬雉秕秭秣秫稆稃稂稞稔稹稷穑黏馥穰皈皎皓皙皤瓞瓠甬鸠鸢鸨鸩鸪鸫鸬鸲鸱鸶鸸鸷鸹鸺鸾鹁鹂鹄鹆鹇鹈鹉鹋鹌鹎鹑鹕鹗鹚鹛鹜鹞鹣鹦鹧鹨鹩鹪鹫鹬鹱鹭鹳疒疔疖疠疝疬疣疳疴疸痄疱疰痃痂痖痍痣痨痦痤痫痧瘃痱痼痿瘐瘀瘅瘌瘗瘊瘥瘘瘕瘙瘛瘼瘢瘠癀瘭瘰瘿瘵癃瘾瘳癍癞癔癜癖癫癯翊竦穸穹窀窆窈窕窠窬窨窭窳衤衩衲衽衿袂袢裆袷袼裉裢裎裣裥裱裼裨裾裰褡褙褓褛褊褴褫褶襁襦襻疋皲皴矜耒耔耖耜耠耢耥耦耧耩耨耱耋耵聃聆聍聒聩聱覃顸颀颃颉颌颍颏颔颚颞颟颡颢颥颦虍虔虬虮虿虺虼虻蚨蚍蚋蚬蚝蚧蚣蚪蚓蚩蚶蛄蚵蛎蚰蚺蚱蚯蛉蛏蚴蛩蛱蛲蛭蛳蛐蜓蛞蛴蛟蛘蛑蜃蜇蛸蜈蜊蜍蜉蜣蜻蜞蜥蜮蜚蜾蝈蜴蜱蜩蜷蜿螂蜢蝽蝾蝻蝠蝰蝌蝮螋蝓蝣蝼蝤蝙蝥螓螯螨蟒蟆螈螅螭螗螃螫蟥螬螵螳蟋蟓螽蟑蟀蟊蟛蟪蟠蟮蠖蠓蟾蠊蠛蠡蠹蠼缶罂罄罅舐竽笈笃笄笕笊笫笏筇笸笙笮笱笠笥笤笳笾笞筘筚筅筵筌筝筠筮筻筢筲筱箐箦箧箸箬箝箨箅箪箜箢箫箴篑篁篌篝篚篥篦篪簌篾篼簏簖簋簟簪簦簸籁籀臾舁舂舄臬衄舡舢舣舭舯舨舫舸舻舳舴舾艄艉艋艏艚艟艨衾袅袈裟襞羝羟羧羯羰羲籼敉粑粝粜粞粢粲粼粽糁糇糌糍糈糅糗糨艮翎翕翥翡翦翩翮翳糸絷綦綮繇纛麸麴赳趄趔趑趱赧赭豇豉酊酐酎酏酤酢酡酰酩酯酽酾酲酴酹醌醅醐醍醑醢醣醪醭醮醯醵醴醺豕鹾趸跫踅蹙蹩趵趿趼趺跄跖跗跚跞跎跏跛跆跬跷跸跣跹跻跤踉跽踔踝踟踬踮踣踯踺蹀踹踵踽踱蹉蹁蹂蹑蹒蹊蹰蹶蹼蹯蹴躅躏躔躐躜躞豸貂貊貅貘貔斛觖觞觚觜觥觫觯謦靓雩雳雯霆霁霈霏霎霪霭霰霾龀龃龅龆龇龈龉龊龌黾鼋鼍隹隼隽雎雒雠銎銮鋈錾鍪鏊鎏鐾鑫鱿鲂鲅鲆鲇鲈稣鲋鲎鲐鲑鲒鲔鲕鲚鲛鲞鲟鲠鲡鲢鲣鲥鲦鲧鲨鲩鲫鲭鲮鲰鲱鲲鲳鲴鲵鲶鲷鲺鲻鲼鲽鳄鳅鳆鳇鳊鳋鳌鳍鳎鳏鳐鳓鳔鳕鳗鳘鳙鳜鳝鳟鳢靼鞅鞑鞒鞔鞯鞫鞣鞲鞴骱骰骷鹘骶骺骼髁髀髅髂髋髌髑魅魃魇魉魈魍魑飨餍餮饕饔髟髡髦髯髫髻髭髹鬈鬏鬓鬟鬣麽麾縻麂麇麈麋麒鏖麝麟黛黜黝黠黟黢黩黧黥黪黯鼢鼬鼯鼹鼷鼽鼾齄,”!¢|〓、¥※》‖〒ˇ÷〃′?〈〖々£〔〉〗±§’}〇〆】‰“『。』‘【×〕ˉ°《」{「墊藍鋆啟喆姮偲彧淯澔玥鈺珮珺璠祎赟·煚竑忞漍珽锜翀垚譞镕梽洸湉夲璟浬琎曈録劼祐衎瀞犇昇錡聖韡傑燊燚珣昉昪旻璘渟佀虓佈赪焜堃徳贇埼珅芃儀镠歅瑄塱玠玙祤旸嫚崑甦佺義弢晢珷睎嫄瑀烜婼姁冮淏埌曌雲號熤凃暘亞塽佔埜鏝屾崟玏叡昳誌妘禕楒橦洺溍炆俤畯皞盉礽砫潏葉蒞蓋來崚頔飏鹍龍茝樑晞畇卲卻岡喨峣珦烔沄沚洨浕µ鍠燏溦竾钖埈凎荁炘勣皝浛堯瑢悰杙泂汋濛炤畄磾崐勍燿鮚壵宬昫樂烺玚璿稜謂瀅甡矞煇棪焌菾氣師琤瀓瑨莙焮琇紹繡翾慜憶敵昺玞炟竤榃鐢玘頓湣玓岠钘≡龑盡璪瑊禛鉨沨暎壘愽燡廚俍倓倖傕緒暉堉骙婳嫆訸粦岄骕愷暐媖栘垵浡驩苾湑燨瑒瑋琀瓅畑潈脩翃苧莯嬛焻鐘铚唅颋骉嬿楊鍫奡傢昞翯羕蘇菎锳黇溵湧玭蘿昋褕禎劍堣瀜祾鰑鏐駸菂倫鹮浥芓聲倢勲滉秾娻櫆鋡垟東棐櫪權澤炏璊曚秈菓鍌汭個荘榅沇涴濶嶶翛淩鍚铦騑鎔袆陽霂劻煖槮峯蒨珌爔椻嵚飛稅朓熎岺逹琹鈇醄婻係湲璆坵骎幹藥媗縫煬睆沴泆凱讃湦珝珵瑱碩翚茀襜書塵珪苳豈倞瑸癿漢竜爃鈊禇禤烐塨瞭婞維繩缐棁禔溁△啓褀滈銘肸膠時鎧芶櫑枓贠鍈笭蘋珹暟崙補襪暻乂儁湜栢鏸鑲蕗梹釗驎貫瑧鮶琭皜涢墺濟琸澐遆遹億晧珃旿僅郤孖粔傜诇瑩鈜詢嶒閤陞處鉫棽晅崯斅櫶鄅鹒跇硙鋮槙劦镈泟浤汧莟樋暋鵝偆烝騟柖栿莀瀟騉"""
| 1,491.2 | 7,416 | 0.987124 | 35 | 7,456 | 211.028571 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002015 | 0.001475 | 7,456 | 4 | 7,417 | 1,864 | 0.9863 | 0.00456 | 0 | 0 | 0 | 1 | 0.997035 | 0.997035 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
1e39669805cd86d6a7c29a1f312a544e7b8f11e1 | 7,518 | py | Python | tests/test_transform_upgrade_1_0_to_1_1.py | aguilerapy/kingfisher-process | 0c588076a47ecef99b195bb546903ed8125bf06a | [
"BSD-3-Clause"
] | null | null | null | tests/test_transform_upgrade_1_0_to_1_1.py | aguilerapy/kingfisher-process | 0c588076a47ecef99b195bb546903ed8125bf06a | [
"BSD-3-Clause"
] | 1 | 2019-04-22T21:17:07.000Z | 2019-04-22T21:17:07.000Z | tests/test_transform_upgrade_1_0_to_1_1.py | aguilerapy/kingfisher-process | 0c588076a47ecef99b195bb546903ed8125bf06a | [
"BSD-3-Clause"
] | null | null | null | from tests.base import BaseDataBaseTest
import datetime
import sqlalchemy as sa
from ocdskingfisherprocess.store import Store
from ocdskingfisherprocess.transform.upgrade_1_0_to_1_1 import Upgrade10To11Transform
from ocdskingfisherprocess.transform import TRANSFORM_TYPE_UPGRADE_1_0_TO_1_1
import os
class TestTransformUpgrade10To11(BaseDataBaseTest):
def test_record_1(self):
# Make source collection
source_collection_id = self.database.get_or_create_collection_id("test", datetime.datetime.now(), False)
source_collection = self.database.get_collection(source_collection_id)
# Load some data
store = Store(self.config, self.database)
store.set_collection(source_collection)
json_filename = os.path.join(os.path.dirname(
os.path.realpath(__file__)), 'data', 'sample_1_0_record.json'
)
store.store_file_from_local("test.json", "http://example.com", "record_package", "utf-8", json_filename)
# Make destination collection
destination_collection_id = self.database.get_or_create_collection_id(
source_collection.source_id,
source_collection.data_version,
source_collection.sample,
transform_from_collection_id=source_collection_id,
transform_type=TRANSFORM_TYPE_UPGRADE_1_0_TO_1_1)
destination_collection = self.database.get_collection(destination_collection_id)
# transform!
transform = Upgrade10To11Transform(self.config, self.database, destination_collection)
transform.process()
# check
with self.database.get_engine().begin() as connection:
s = sa.sql.select([self.database.record_table])
result = connection.execute(s)
assert 2 == result.rowcount
s = sa.sql.select([self.database.release_table])
result = connection.execute(s)
assert 0 == result.rowcount
s = sa.sql.select([self.database.transform_upgrade_1_0_to_1_1_status_record_table])
result = connection.execute(s)
assert 1 == result.rowcount
s = sa.sql.select([self.database.transform_upgrade_1_0_to_1_1_status_release_table])
result = connection.execute(s)
assert 0 == result.rowcount
# transform again! This should be fine
transform = Upgrade10To11Transform(self.config, self.database, destination_collection)
transform.process()
# check
with self.database.get_engine().begin() as connection:
s = sa.sql.select([self.database.record_table])
result = connection.execute(s)
assert 2 == result.rowcount
s = sa.sql.select([self.database.release_table])
result = connection.execute(s)
assert 0 == result.rowcount
s = sa.sql.select([self.database.transform_upgrade_1_0_to_1_1_status_record_table])
result = connection.execute(s)
assert 1 == result.rowcount
s = sa.sql.select([self.database.transform_upgrade_1_0_to_1_1_status_release_table])
result = connection.execute(s)
assert 0 == result.rowcount
# destination collection will not be closed (because source is still open!)
destination_collection = self.database.get_collection(destination_collection_id)
assert destination_collection.store_end_at == None # noqa
# Mark source collection as finished
self.database.mark_collection_store_done(source_collection_id)
# transform again! This should be fine
transform = Upgrade10To11Transform(self.config, self.database, destination_collection)
transform.process()
# destination collection should be closed
destination_collection = self.database.get_collection(destination_collection_id)
assert destination_collection.store_end_at != None # noqa
def test_release_1(self):
# Make source collection
source_collection_id = self.database.get_or_create_collection_id("test", datetime.datetime.now(), False)
source_collection = self.database.get_collection(source_collection_id)
# Load some data
store = Store(self.config, self.database)
store.set_collection(source_collection)
json_filename = os.path.join(os.path.dirname(
os.path.realpath(__file__)), 'data', 'sample_1_0_releases.json'
)
store.store_file_from_local("test.json", "http://example.com", "release_package", "utf-8", json_filename)
# Make destination collection
destination_collection_id = self.database.get_or_create_collection_id(
source_collection.source_id,
source_collection.data_version,
source_collection.sample,
transform_from_collection_id=source_collection_id,
transform_type=TRANSFORM_TYPE_UPGRADE_1_0_TO_1_1)
destination_collection = self.database.get_collection(destination_collection_id)
# transform!
transform = Upgrade10To11Transform(self.config, self.database, destination_collection)
transform.process()
# check
with self.database.get_engine().begin() as connection:
s = sa.sql.select([self.database.release_table])
result = connection.execute(s)
assert 4 == result.rowcount
s = sa.sql.select([self.database.record_table])
result = connection.execute(s)
assert 0 == result.rowcount
s = sa.sql.select([self.database.transform_upgrade_1_0_to_1_1_status_record_table])
result = connection.execute(s)
assert 0 == result.rowcount
s = sa.sql.select([self.database.transform_upgrade_1_0_to_1_1_status_release_table])
result = connection.execute(s)
assert 2 == result.rowcount
# transform again! This should be fine
transform = Upgrade10To11Transform(self.config, self.database, destination_collection)
transform.process()
# check
with self.database.get_engine().begin() as connection:
s = sa.sql.select([self.database.release_table])
result = connection.execute(s)
assert 4 == result.rowcount
s = sa.sql.select([self.database.record_table])
result = connection.execute(s)
assert 0 == result.rowcount
s = sa.sql.select([self.database.transform_upgrade_1_0_to_1_1_status_record_table])
result = connection.execute(s)
assert 0 == result.rowcount
s = sa.sql.select([self.database.transform_upgrade_1_0_to_1_1_status_release_table])
result = connection.execute(s)
assert 2 == result.rowcount
# destination collection will not be closed (because source is still open!)
destination_collection = self.database.get_collection(destination_collection_id)
assert destination_collection.store_end_at == None # noqa
# Mark source collection as finished
self.database.mark_collection_store_done(source_collection_id)
# transform!
transform = Upgrade10To11Transform(self.config, self.database, destination_collection)
transform.process()
# destination collection should be closed
destination_collection = self.database.get_collection(destination_collection_id)
assert destination_collection.store_end_at != None # noqa
| 43.456647 | 113 | 0.685422 | 869 | 7,518 | 5.642117 | 0.109321 | 0.102794 | 0.04895 | 0.03916 | 0.938813 | 0.938813 | 0.938813 | 0.931878 | 0.926576 | 0.926576 | 0 | 0.018034 | 0.232908 | 7,518 | 172 | 114 | 43.709302 | 0.832148 | 0.08207 | 0 | 0.859649 | 0 | 0 | 0.022549 | 0.006692 | 0 | 0 | 0 | 0 | 0.175439 | 1 | 0.017544 | false | 0 | 0.061404 | 0 | 0.087719 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
1e5395af9d44827a9309aa957859301c4fbec3d2 | 113,312 | py | Python | tests/test_post_download_processing.py | jacopoabbate/datavault-api-python-client | 70c3113b56db77de3835b4210dd7bffb22b34c9f | [
"MIT"
] | null | null | null | tests/test_post_download_processing.py | jacopoabbate/datavault-api-python-client | 70c3113b56db77de3835b4210dd7bffb22b34c9f | [
"MIT"
] | null | null | null | tests/test_post_download_processing.py | jacopoabbate/datavault-api-python-client | 70c3113b56db77de3835b4210dd7bffb22b34c9f | [
"MIT"
] | null | null | null | import datetime
import os
import pathlib
from datavault_api_client import post_download_processing as pdp
from datavault_api_client.data_structures import (
ConcurrentDownloadManifest,
DownloadDetails,
PartitionDownloadDetails,
)
class TestGetNonPartitionedFiles:
def test_identification_of_non_partitioned_files(
self,
mocked_whole_files_download_details_single_source_single_day,
):
# Setup
# Exercise
non_partitioned_files = pdp.get_non_partitioned_files(
mocked_whole_files_download_details_single_source_single_day,
)
# Verify
expected_files = [
DownloadDetails(
file_name="COREREF_945_20200722.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/07/22/S945/CORE/"
"20200722-S945_CORE_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"Data/2020/07/22/S945/CORE", "COREREF_945_20200722.txt.bz2"
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=7, day=22),
size=17734,
md5sum="3548e03c8833b0e2133c80ac3b1dcdac",
is_partitioned=False,
),
DownloadDetails(
file_name="CROSSREF_945_20200722.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/07/22/S945/CROSS/"
"20200722-S945_CROSS_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"Data/2020/07/22/S945/CROSS", "CROSSREF_945_20200722.txt.bz2"
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=7, day=22),
size=32822,
md5sum="936c0515dcbc27d2e2fc3ebdcf5f883a",
is_partitioned=False,
),
]
assert non_partitioned_files == expected_files
# Cleanup - none
def test_scenario_without_non_partitioned_files(
self,
mocked_whole_files_download_details_single_source_single_day,
):
# Setup
files_to_filter = [
file for file in mocked_whole_files_download_details_single_source_single_day
if file.is_partitioned is True
]
# Exercise
non_partitioned_files = pdp.get_non_partitioned_files(files_to_filter)
# Verify
assert non_partitioned_files == []
# Cleanup - none
class TestGetPartitionedFiles:
def test_identification_of_partitioned_files(
self,
mocked_whole_files_download_details_single_source_single_day,
):
# Setup
# Exercise
partitioned_files = pdp.get_partitioned_files(
mocked_whole_files_download_details_single_source_single_day,
)
# Verify
expected_files = [
DownloadDetails(
file_name="WATCHLIST_945_20200722.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/07/22/S945/"
"WATCHLIST/20200722-S945_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"Data/2020/07/22/S945/WATCHLIST", "WATCHLIST_945_20200722.txt.bz2"
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=7, day=22),
size=61663360,
md5sum="78571e930fb12fcfb2fb70feb07c7bcf",
is_partitioned=True,
),
]
assert partitioned_files == expected_files
# Cleanup - none
def test_scenario_with_no_partitioned_files(
self,
mocked_whole_files_download_details_single_source_single_day,
):
# Setup
files_to_filter = [
file for file in mocked_whole_files_download_details_single_source_single_day
if file.is_partitioned is False
]
# Exercise
partitioned_files = pdp.get_partitioned_files(files_to_filter)
# Verify
assert partitioned_files == []
# Cleanup - none
class TestGetPartitionsDownloadDetails:
def test_identification_of_partition_details(
self,
mocked_partitions_download_details_single_source_single_day,
):
# Setup
partitions = mocked_partitions_download_details_single_source_single_day
# Exercise
computed_partitions_download_details = pdp.get_partitions_download_details(
partitions,
)
# Verify
assert computed_partitions_download_details == partitions
# Cleanup - none
def test_identification_of_name_specific_partition_download_details(
self,
mocked_partitions_download_details_multiple_sources_single_day,
):
# Setup
parent_file_name = 'WATCHLIST_367_20200721.txt.bz2'
partitions = mocked_partitions_download_details_multiple_sources_single_day
# Exercise
computed_list_of_name_specific_partitions = pdp.get_partitions_download_details(
partitions,
parent_file_name,
)
# Verify
expected_names_of_specific_partitions = [
item for item in partitions
if item.parent_file_name == parent_file_name
]
assert computed_list_of_name_specific_partitions == expected_names_of_specific_partitions
# Cleanup - none
class TestGetListOfDownloadedPartitions:
def test_retrieval_of_downloaded_partitions(self, simulated_downloaded_partitions):
# Setup
# Exercise
computed_list_of_downloaded_partitions = pdp.get_downloaded_partitions(
simulated_downloaded_partitions,
)
# Verify
path_to_tmp_dir = simulated_downloaded_partitions
expected_list_of_downloaded_partitions = [
path_to_tmp_dir / 'WATCHLIST_367_20200721_1.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_2.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_3.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_4.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_5.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_6.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_7.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_8.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_9.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_10.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_11.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_12.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_13.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_14.txt',
path_to_tmp_dir / 'WATCHLIST_367_20200721_15.txt']
assert computed_list_of_downloaded_partitions == expected_list_of_downloaded_partitions
# Cleanup - none
def test_empty_directory_scenario(self):
# Setup
directory = pathlib.Path(__file__).resolve().parent.joinpath(
"static_data", "Temp"
)
directory.mkdir(exist_ok=True)
# Exercise
downloaded_partitions = pdp.get_downloaded_partitions(directory)
# Verify
assert downloaded_partitions == []
# Cleanup
directory.rmdir()
class TestGetFileSpecificMissingPartitions:
def test_identification_of_missing_partitions(
self,
mocked_partitions_download_details_multiple_sources_single_day,
):
# Setup
base_path = pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S367', 'WATCHLIST',
)
base_path.mkdir(exist_ok=True, parents=True)
downloaded_partition_file_names = [
'WATCHLIST_367_20200721_1.txt',
'WATCHLIST_367_20200721_2.txt',
'WATCHLIST_367_20200721_3.txt',
'WATCHLIST_367_20200721_4.txt',
'WATCHLIST_367_20200721_5.txt',
'WATCHLIST_367_20200721_6.txt',
'WATCHLIST_367_20200721_7.txt',
'WATCHLIST_367_20200721_8.txt',
'WATCHLIST_367_20200721_9.txt',
'WATCHLIST_367_20200721_10.txt',
'WATCHLIST_367_20200721_11.txt',
'WATCHLIST_367_20200721_12.txt',
'WATCHLIST_367_20200721_13.txt',
'WATCHLIST_367_20200721_14.txt',
]
for file in downloaded_partition_file_names:
path_to_downloaded_partition = base_path / file
path_to_downloaded_partition.touch()
file_specific_download_details = DownloadDetails(
file_name='WATCHLIST_367_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S367/'
'WATCHLIST/20200721-S367_WATCHLIST_username_0_0'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S367', 'WATCHLIST', 'WATCHLIST_367_20200721.txt.bz2',
),
source_id=367,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=82451354,
md5sum='62df718ef5eb5f9f1ea3f6ea1f826c30',
is_partitioned=True,
)
# Exercise
computed_missing_partitions = pdp.get_file_specific_missing_partitions(
file_specific_download_details,
mocked_partitions_download_details_multiple_sources_single_day,
)
# Verify
expected_missing_partitions = [
PartitionDownloadDetails(
parent_file_name='WATCHLIST_367_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/'
'S367/WATCHLIST/20200721-S367_WATCHLIST_username_0_0'
'?start=73400321&end=78643200'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S367', 'WATCHLIST',
'WATCHLIST_367_20200721_15.txt',
),
partition_index=15,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_367_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/'
'S367/WATCHLIST/20200721-S367_WATCHLIST_username_0_0'
'?start=78643201&end=82451354'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21',
'S367', 'WATCHLIST', 'WATCHLIST_367_20200721_16.txt',
),
partition_index=16,
)
]
assert computed_missing_partitions == expected_missing_partitions
# Cleanup
# First, remove all the created files
for file in list(base_path.glob('**/*.txt')):
file.unlink()
# Then remove all the created folders iteratively:
directory_root = pathlib.Path(__file__).resolve().parent / 'Data'
for directory in list(directory_root.glob('**/'))[::-1]:
directory.rmdir()
def test_no_missing_partition_scenario(
self,
mocked_partitions_download_details_multiple_sources_single_day,
):
# Setup
base_path = pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S367', 'WATCHLIST',
)
base_path.mkdir(exist_ok=True, parents=True)
downloaded_partition_file_names = [
'WATCHLIST_367_20200721_1.txt',
'WATCHLIST_367_20200721_2.txt',
'WATCHLIST_367_20200721_3.txt',
'WATCHLIST_367_20200721_4.txt',
'WATCHLIST_367_20200721_5.txt',
'WATCHLIST_367_20200721_6.txt',
'WATCHLIST_367_20200721_7.txt',
'WATCHLIST_367_20200721_8.txt',
'WATCHLIST_367_20200721_9.txt',
'WATCHLIST_367_20200721_10.txt',
'WATCHLIST_367_20200721_11.txt',
'WATCHLIST_367_20200721_12.txt',
'WATCHLIST_367_20200721_13.txt',
'WATCHLIST_367_20200721_14.txt',
'WATCHLIST_367_20200721_15.txt',
'WATCHLIST_367_20200721_16.txt',
]
for file in downloaded_partition_file_names:
path_to_downloaded_partition = base_path / file
path_to_downloaded_partition.touch()
file_specific_download_details = DownloadDetails(
file_name='WATCHLIST_367_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S367/'
'WATCHLIST/20200721-S367_WATCHLIST_username_0_0'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S367', 'WATCHLIST', 'WATCHLIST_367_20200721.txt.bz2',
),
source_id=367,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=82451354,
md5sum='62df718ef5eb5f9f1ea3f6ea1f826c30',
is_partitioned=True,
)
# Exercise
computed_missing_partitions = pdp.get_file_specific_missing_partitions(
file_specific_download_details,
mocked_partitions_download_details_multiple_sources_single_day,
)
# Verify
assert computed_missing_partitions == []
# Cleanup
# First, remove all the created files
for file in list(base_path.glob('**/*.txt')):
file.unlink()
# Then remove all the created folders iteratively:
directory_root = pathlib.Path(__file__).resolve().parent / 'Data'
for directory in list(directory_root.glob('**/'))[::-1]:
directory.rmdir()
class TestGetAllMissingPartitions:
def test_identification_of_missing_partitions(
self,
mocked_partitions_download_details_multiple_sources_single_day,
mocked_download_details_multiple_sources_single_day
):
# Setup
base_path = pathlib.Path(__file__).resolve().parent.joinpath(
"Data", "2020", "07", "21",
)
downloaded_instruments_directories = [
base_path / 'S207' / 'CROSS',
base_path / 'S207' / 'WATCHLIST',
base_path / 'S367' / 'WATCHLIST',
]
for directory in downloaded_instruments_directories:
directory.mkdir(parents=True, exist_ok=True)
list_of_downloaded_partitions = [
base_path / 'S207' / 'CROSS' / 'CROSSREF_207_20200721_1.txt',
base_path / 'S207' / 'CROSS' / 'CROSSREF_207_20200721_2.txt',
base_path / 'S207' / 'CROSS' / 'CROSSREF_207_20200721_3.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_2.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_3.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_4.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_5.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_6.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_7.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_8.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_9.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_10.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_12.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_13.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_14.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_1.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_2.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_3.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_4.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_5.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_6.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_7.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_8.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_9.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_10.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_11.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_12.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_13.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_14.txt',
]
for partition_path in list_of_downloaded_partitions:
partition_path.touch()
# Exercise
missing_partitions = pdp.get_all_missing_partitions(
mocked_download_details_multiple_sources_single_day,
mocked_partitions_download_details_multiple_sources_single_day,
)
missing_partitions.sort(key=lambda x: x.parent_file_name)
# Verify
expected_missing_partitions = [
PartitionDownloadDetails(
parent_file_name='WATCHLIST_207_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S207/'
'WATCHLIST/20200721-S207_WATCHLIST_username_0_0?start=0&end=5242880'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S207', 'WATCHLIST', 'WATCHLIST_207_20200721_1.txt',
),
partition_index=1,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_207_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S207/'
'WATCHLIST/20200721-S207_WATCHLIST_username_0_0?start=52428801&end=57671680'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S207', 'WATCHLIST',
'WATCHLIST_207_20200721_11.txt',
),
partition_index=11,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_367_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/'
'S367/WATCHLIST/20200721-S367_WATCHLIST_username_0_0'
'?start=73400321&end=78643200'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S367', 'WATCHLIST',
'WATCHLIST_367_20200721_15.txt',
),
partition_index=15,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_367_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/'
'S367/WATCHLIST/20200721-S367_WATCHLIST_username_0_0'
'?start=78643201&end=82451354'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S367', 'WATCHLIST',
'WATCHLIST_367_20200721_16.txt',
),
partition_index=16,
)
]
assert missing_partitions == expected_missing_partitions
# Cleanup
# First, remove all the created files
for file in list(base_path.glob('**/*.txt')):
file.unlink()
# Then remove all the created folders iteratively:
directory_root = pathlib.Path(__file__).resolve().parent / 'Data'
for directory in list(directory_root.glob('**/'))[::-1]:
directory.rmdir()
def test_scenario_of_one_file_only_with_missing_partitions(
self,
mocked_partitions_download_details_multiple_sources_single_day,
mocked_download_details_multiple_sources_single_day
):
# Setup
base_path = pathlib.Path(__file__).resolve().parent.joinpath(
"Data", "2020", "07", "21",
)
downloaded_instruments_directories = [
base_path / 'S207' / 'CROSS',
base_path / 'S207' / 'WATCHLIST',
base_path / 'S367' / 'WATCHLIST',
]
for directory in downloaded_instruments_directories:
directory.mkdir(parents=True, exist_ok=True)
list_of_downloaded_partitions = [
base_path / 'S207' / 'CROSS' / 'CROSSREF_207_20200721_1.txt',
base_path / 'S207' / 'CROSS' / 'CROSSREF_207_20200721_2.txt',
base_path / 'S207' / 'CROSS' / 'CROSSREF_207_20200721_3.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_1.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_2.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_3.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_4.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_5.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_6.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_7.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_8.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_9.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_10.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_11.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_12.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_13.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_14.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_1.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_2.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_3.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_4.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_5.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_6.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_7.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_8.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_9.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_10.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_11.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_12.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_13.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_14.txt',
]
for partition_path in list_of_downloaded_partitions:
partition_path.touch()
# Exercise
missing_partitions = pdp.get_all_missing_partitions(
mocked_download_details_multiple_sources_single_day,
mocked_partitions_download_details_multiple_sources_single_day,
)
# Verify
expected_missing_partitions = [
PartitionDownloadDetails(
parent_file_name='WATCHLIST_367_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/'
'S367/WATCHLIST/20200721-S367_WATCHLIST_username_0_0'
'?start=73400321&end=78643200'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S367', 'WATCHLIST',
'WATCHLIST_367_20200721_15.txt',
),
partition_index=15,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_367_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/'
'S367/WATCHLIST/20200721-S367_WATCHLIST_username_0_0'
'?start=78643201&end=82451354'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S367', 'WATCHLIST',
'WATCHLIST_367_20200721_16.txt',
),
partition_index=16,
)
]
assert missing_partitions == expected_missing_partitions
# Cleanup
# First, remove all the created files
for file in list(base_path.glob('**/*.txt')):
file.unlink()
# Then remove all the created folders iteratively:
directory_root = pathlib.Path(__file__).resolve().parent / 'Data'
for directory in list(directory_root.glob('**/'))[::-1]:
directory.rmdir()
def test_scenario_of_no_missing_partitions(
self,
mocked_partitions_download_details_multiple_sources_single_day,
mocked_download_details_multiple_sources_single_day
):
# Setup
base_path = pathlib.Path(__file__).resolve().parent.joinpath(
"Data", "2020", "07", "21",
)
downloaded_instruments_directories = [
base_path / 'S207' / 'CROSS',
base_path / 'S207' / 'WATCHLIST',
base_path / 'S367' / 'WATCHLIST',
]
for directory in downloaded_instruments_directories:
directory.mkdir(parents=True, exist_ok=True)
list_of_downloaded_partitions = [
base_path / 'S207' / 'CROSS' / 'CROSSREF_207_20200721_1.txt',
base_path / 'S207' / 'CROSS' / 'CROSSREF_207_20200721_2.txt',
base_path / 'S207' / 'CROSS' / 'CROSSREF_207_20200721_3.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_1.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_2.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_3.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_4.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_5.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_6.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_7.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_8.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_9.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_10.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_11.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_12.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_13.txt',
base_path / 'S207' / 'WATCHLIST' / 'WATCHLIST_207_20200721_14.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_1.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_2.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_3.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_4.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_5.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_6.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_7.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_8.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_9.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_10.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_11.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_12.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_13.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_14.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_15.txt',
base_path / 'S367' / 'WATCHLIST' / 'WATCHLIST_367_20200721_16.txt',
]
for partition_path in list_of_downloaded_partitions:
partition_path.touch()
# Exercise
missing_partitions = pdp.get_all_missing_partitions(
mocked_download_details_multiple_sources_single_day,
mocked_partitions_download_details_multiple_sources_single_day,
)
# Verify
assert missing_partitions == []
# Cleanup
# First, remove all the created files
for file in list(base_path.glob('**/*.txt')):
file.unlink()
# Then remove all the created folders iteratively:
directory_root = pathlib.Path(__file__).resolve().parent / 'Data'
for directory in list(directory_root.glob('**/'))[::-1]:
directory.rmdir()
class TestGetFilesWithMissingPartitions:
def test_identification_of_files_with_missing_partitions(
self,
# mocked_list_of_whole_files_and_partitions_download_details_multiple_sources_single_day,
mocked_download_details_multiple_sources_single_day
):
# Setup
missing_partitions = [
PartitionDownloadDetails(
parent_file_name='WATCHLIST_207_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S207/'
'WATCHLIST/20200721-S207_WATCHLIST_username_0_0?start=52428801&end=57671680'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S207', 'WATCHLIST',
'WATCHLIST_207_20200721_11.txt',
),
partition_index=11,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_367_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/'
'S367/WATCHLIST/20200721-S367_WATCHLIST_username_0_0'
'?start=73400321&end=78643200'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S367', 'WATCHLIST',
'WATCHLIST_367_20200721_15.txt',
),
partition_index=15,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_367_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/'
'S367/WATCHLIST/20200721-S367_WATCHLIST_username_0_0'
'?start=78643201&end=82451354'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S367', 'WATCHLIST',
'WATCHLIST_367_20200721_16.txt',
),
partition_index=16,
)
]
# Exercise
files_with_missing_partitions = pdp.get_files_with_missing_partitions(
mocked_download_details_multiple_sources_single_day,
missing_partitions,
)
# Verify
expected_files_with_missing_partitions = [
DownloadDetails(
file_name='WATCHLIST_207_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S207/'
'WATCHLIST/20200721-S207_WATCHLIST_username_0_0'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S207', 'WATCHLIST',
'WATCHLIST_207_20200721.txt.bz2',
),
source_id=207,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=72293374,
md5sum='36e444a8362e7db52af50ee0f8dc0d2e',
is_partitioned=True),
DownloadDetails(
file_name='WATCHLIST_367_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S367/'
'WATCHLIST/20200721-S367_WATCHLIST_username_0_0'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S367', 'WATCHLIST',
'WATCHLIST_367_20200721.txt.bz2'
),
source_id=367,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=82451354,
md5sum='62df718ef5eb5f9f1ea3f6ea1f826c30',
is_partitioned=True),
]
assert files_with_missing_partitions == expected_files_with_missing_partitions
# Cleanup - none
def test_scenario_of_single_file_with_missing_partitions(
self,
mocked_download_details_multiple_sources_single_day
):
# Setup
missing_partitions = [
PartitionDownloadDetails(
parent_file_name='WATCHLIST_207_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S207/'
'WATCHLIST/20200721-S207_WATCHLIST_username_0_0?start=52428801&end=57671680'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S207', 'WATCHLIST',
'WATCHLIST_207_20200721_11.txt',
),
partition_index=11,
),
]
# Exercise
files_with_missing_partitions = pdp.get_files_with_missing_partitions(
mocked_download_details_multiple_sources_single_day,
missing_partitions,
)
# Verify
expected_files_with_missing_partitions = [
DownloadDetails(
file_name='WATCHLIST_207_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S207/'
'WATCHLIST/20200721-S207_WATCHLIST_username_0_0'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S207', 'WATCHLIST',
'WATCHLIST_207_20200721.txt.bz2',
),
source_id=207,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=72293374,
md5sum='36e444a8362e7db52af50ee0f8dc0d2e',
is_partitioned=True),
]
assert files_with_missing_partitions == expected_files_with_missing_partitions
# Cleanup - none
def test_scenario_of_no_missing_partitions(
self,
mocked_download_details_multiple_sources_single_day
):
# Setup
missing_partitions = []
# Exercise
files_with_missing_partitions = pdp.get_files_with_missing_partitions(
mocked_download_details_multiple_sources_single_day,
missing_partitions,
)
# Verify
assert files_with_missing_partitions == []
# Cleanup - none
class TestGetFilesReadyForConcatenation:
def test_identification_of_files_ready_for_concatenation(
self,
mocked_download_details_multiple_sources_single_day,
):
# Setup
whole_files_download_details = mocked_download_details_multiple_sources_single_day
files_with_missing_partitions = [
DownloadDetails(
file_name="WATCHLIST_207_20200721.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S207/"
"WATCHLIST/20200721-S207_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"Data", "2020", "07", "21", "S207", "WATCHLIST",
"WATCHLIST_207_20200721.txt.bz2",
),
source_id=207,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=72293374,
md5sum="36e444a8362e7db52af50ee0f8dc0d2e",
is_partitioned=True,
)
]
# Exercise
files_ready_for_concatenation = (
pdp.get_files_ready_for_concatenation(
whole_files_download_details,
files_with_missing_partitions,
)
)
files_ready_for_concatenation.sort(key=lambda x: x.file_name)
# Verify
expected_files_to_concatenate = [
'CROSSREF_207_20200721.txt.bz2',
'WATCHLIST_367_20200721.txt.bz2',
]
expected_files_ready_for_concatenation = [
item for item in whole_files_download_details
if item.file_name in expected_files_to_concatenate
]
assert files_ready_for_concatenation == expected_files_ready_for_concatenation
# Cleanup - none
def test_no_file_ready_for_concatenation_scenario(
self,
mocked_download_details_multiple_sources_single_day,
):
# Setup
whole_files_download_details = mocked_download_details_multiple_sources_single_day
files_with_missing_partitions = mocked_download_details_multiple_sources_single_day
# Exercise
files_ready_for_concatenation = (
pdp.get_files_ready_for_concatenation(
whole_files_download_details,
files_with_missing_partitions,
)
)
# Verify
assert files_ready_for_concatenation == []
# Cleanup - none
class TestConcatenatePartitions:
def test_concatenation_of_files(self):
# Setup
base_path = pathlib.Path(__file__).resolve().parent.joinpath(
'Temp', '2020', '07', '21', 'CROSS',
)
base_path.mkdir(parents=True, exist_ok=True)
file_names = [
'CROSSREF_207_20200721_1.txt',
'CROSSREF_207_20200721_2.txt',
'CROSSREF_207_20200721_3.txt',
]
concatenated_content = b''
for file_name in file_names:
fpath = base_path / file_name
with fpath.open('wb') as outfile:
random_byte_content = os.urandom(500)
concatenated_content += random_byte_content
outfile.write(random_byte_content)
path_to_output_file = base_path / 'CROSSREF_207_20200721.txt.bz2'
# Execute
concatenated_file = pdp.concatenate_partitions(
path_to_output_file)
# Verify
assert concatenated_file == path_to_output_file.as_posix()
with path_to_output_file.open('rb') as infile:
file_content = infile.read()
assert file_content == concatenated_content
# Cleanup
# First, remove all the created files
for file in list(base_path.glob('**/*.bz2')):
file.unlink()
# Then remove all the created folders iteratively:
directory_root = pathlib.Path(__file__).resolve().parent / 'Temp'
for directory in list(directory_root.glob('**/'))[::-1]:
directory.rmdir()
class TestConcatenateEachFilePartitions:
def test_concatenation_of_all_partitions(self):
# Setup
base_path = pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S207',
)
base_path.mkdir(parents=True, exist_ok=True)
files_to_concatenate = [
DownloadDetails(
file_name='CROSSREF_207_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S207/'
'CROSS/20200721-S207_CROSS_ALL_0_0'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S207', 'CROSS',
'CROSSREF_207_20200721.txt.bz2',
),
source_id=207,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=14690557,
md5sum='f2683cd87a7b29f3b8776373d56a8456',
is_partitioned=True,
),
DownloadDetails(
file_name='WATCHLIST_207_20200721.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S207/'
'WATCHLIST/20200721-S207_WATCHLIST_username_0_0'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S207', 'WATCHLIST',
'WATCHLIST_207_20200721.txt.bz2',
),
source_id=207,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=72293374,
md5sum='36e444a8362e7db52af50ee0f8dc0d2e',
is_partitioned=True,
)
]
partitions = {
'CROSSREF_207_20200721.txt.bz2': [
'CROSSREF_207_20200721_1.txt',
'CROSSREF_207_20200721_2.txt',
'CROSSREF_207_20200721_3.txt',
],
'WATCHLIST_207_20200721.txt.bz2': [
'WATCHLIST_207_20200721_1.txt',
'WATCHLIST_207_20200721_2.txt',
'WATCHLIST_207_20200721_3.txt',
'WATCHLIST_207_20200721_4.txt',
'WATCHLIST_207_20200721_5.txt',
'WATCHLIST_207_20200721_6.txt',
'WATCHLIST_207_20200721_7.txt',
'WATCHLIST_207_20200721_8.txt',
'WATCHLIST_207_20200721_9.txt',
'WATCHLIST_207_20200721_10.txt',
'WATCHLIST_207_20200721_11.txt',
'WATCHLIST_207_20200721_12.txt',
'WATCHLIST_207_20200721_13.txt',
'WATCHLIST_207_20200721_14.txt',
],
}
crossref_concatenated_content = b''
path_to_crossref_files_directory = base_path / 'CROSS'
path_to_crossref_files_directory.mkdir(parents=True, exist_ok=True)
for crossref_partition in partitions['CROSSREF_207_20200721.txt.bz2']:
fpath = base_path / 'CROSS' / crossref_partition
with fpath.open('wb') as outfile:
random_byte_content = os.urandom(500)
crossref_concatenated_content += random_byte_content
outfile.write(random_byte_content)
watchlist_concatenated_content = b''
path_to_watchlist_files_directory = base_path / 'WATCHLIST'
path_to_watchlist_files_directory.mkdir(parents=True, exist_ok=True)
for watchlist_partition in partitions['WATCHLIST_207_20200721.txt.bz2']:
fpath = base_path / 'WATCHLIST' / watchlist_partition
with fpath.open('wb') as outfile:
random_byte_content = os.urandom(500)
watchlist_concatenated_content += random_byte_content
outfile.write(random_byte_content)
# Exercise
files_to_test = pdp.concatenate_each_file_partitions(files_to_concatenate)
# Verify
path_to_crossref_file = pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S207', 'CROSS', 'CROSSREF_207_20200721.txt.bz2',
)
with path_to_crossref_file.open('rb') as infile:
crossref_file_content = infile.read()
assert crossref_file_content == crossref_concatenated_content
path_to_watchlist_file = pathlib.Path(__file__).resolve().parent.joinpath(
'Data', '2020', '07', '21', 'S207', 'WATCHLIST',
'WATCHLIST_207_20200721.txt.bz2',
)
with path_to_watchlist_file.open('rb') as infile:
watchlist_file_content = infile.read()
assert watchlist_file_content == watchlist_concatenated_content
assert files_to_test == files_to_concatenate
# Cleanup
# First, remove all the created files
for file in list(base_path.glob('**/*.bz2')):
file.unlink()
# Then remove all the created folders iteratively:
directory_root = pathlib.Path(__file__).resolve().parent / 'Data'
for directory in list(directory_root.glob('**/'))[::-1]:
directory.rmdir()
class TestFilterFilesReadyForIntegrityTest:
def test_no_file_with_missing_partitions_scenario(
self,
mocked_download_details_multiple_sources_single_day,
):
# Setup
whole_files_download_manifest = mocked_download_details_multiple_sources_single_day
files_with_missing_partitions = []
# Exercise
files_ready_for_integrity_test = pdp.get_files_ready_for_integrity_test(
files_with_missing_partitions,
whole_files_download_manifest,
)
# Verify
assert (
files_ready_for_integrity_test.sort(key=lambda x: x.file_name) ==
whole_files_download_manifest.sort(key=lambda x: x.file_name)
)
# Cleanup - none
def test_files_with_missing_partitions_scenario(
self,
mocked_download_details_multiple_sources_single_day,
):
# Setup
whole_files_download_manifest = mocked_download_details_multiple_sources_single_day
files_with_missing_partitions = [
DownloadDetails(
file_name="WATCHLIST_207_20200721.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S207/"
"WATCHLIST/20200721-S207_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"Data/2020/07/21/S207/WATCHLIST", "WATCHLIST_207_20200721.txt.bz2"
),
source_id=207,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=72293374,
md5sum="36e444a8362e7db52af50ee0f8dc0d2e",
is_partitioned=True,
),
DownloadDetails(
file_name="WATCHLIST_367_20200721.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S367/"
"WATCHLIST/20200721-S367_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"Data/2020/07/21/S367/WATCHLIST", "WATCHLIST_367_20200721.txt.bz2"
),
source_id=367,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=82451354,
md5sum="62df718ef5eb5f9f1ea3f6ea1f826c30",
is_partitioned=True,
),
]
files_ready_for_integrity_test = pdp.get_files_ready_for_integrity_test(
files_with_missing_partitions,
whole_files_download_manifest,
)
# Verify
expected_files = [
DownloadDetails(
file_name="COREREF_207_20200721.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/"
"S207/CORE/20200721-S207_CORE_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"Data/2020/07/21/S207/CORE", "COREREF_207_20200721.txt.bz2"
),
source_id=207,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=4590454,
md5sum="c1a079841f84676e91b5021afd3f5272",
is_partitioned=False,
),
DownloadDetails(
file_name="COREREF_367_20200721.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/"
"S367/CORE/20200721-S367_CORE_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"Data/2020/07/21/S367/CORE", "COREREF_367_20200721.txt.bz2"
),
source_id=367,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=706586,
md5sum="e28385e918aa71720235232c9a895b64",
is_partitioned=False,
),
DownloadDetails(
file_name="CROSSREF_207_20200721.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S207/CROSS/"
"20200721-S207_CROSS_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"Data/2020/07/21/S207/CROSS", "CROSSREF_207_20200721.txt.bz2"
),
source_id=207,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=14690557,
md5sum="f2683cd87a7b29f3b8776373d56a8456",
is_partitioned=True,
),
DownloadDetails(
file_name="CROSSREF_367_20200721.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/07/21/S367/CROSS/"
"20200721-S367_CROSS_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"Data/2020/07/21/S367/CROSS", "CROSSREF_367_20200721.txt.bz2"
),
source_id=367,
reference_date=datetime.datetime(year=2020, month=7, day=21),
size=879897,
md5sum="fdb7592c8806a28f59c4d4da1e934c43",
is_partitioned=False,
),
]
assert (
files_ready_for_integrity_test.sort(key=lambda x: x.file_name) ==
expected_files.sort(key=lambda x: x.file_name)
)
# Cleanup - none
class TestPreConcatenationProcessing:
def test_scenario_1(
self,
mocked_concurrent_download_manifest,
):
"""Tests the pre_concatenation_processing function.
Testing scenario:
- Whole file correctly downloaded,
- COREREF file correctly downloaded (all partitions are downloaded)
- WATCHLIST file missing two partitions
Expected output:
A ConcurrentDownloadManifest with the whole_files_reference field consisting
only of the WATCHLIST file and the concurrent_download_manifest field
consisting of a list with the download details of the two missing partitions.
"""
# Setup
partitions_to_create = [
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_1.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_2.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_3.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_4.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_5.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_1.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_2.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_3.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_4.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_5.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_6.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_7.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_8.txt"
),
]
for partition_path in partitions_to_create:
partition_path.touch()
# Exercise
failed_downloads = pdp.pre_concatenation_processing(
mocked_concurrent_download_manifest,
)
# Verify
expected_failed_downloads = ConcurrentDownloadManifest(
files_reference_data=[
DownloadDetails(
file_name="WATCHLIST_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"WATCHLIST/20201218-S945_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/WATCHLIST/WATCHLIST_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=51648457,
md5sum="11c5253a7cd1743aea93ec5124fd974d",
is_partitioned=True,
),
],
whole_files_to_download=[],
partitions_to_download=[
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=41943041&end=47185920'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_9.txt"
),
partition_index=9,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=47185921&end=51648457'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_10.txt"
),
partition_index=10,
)
]
)
assert failed_downloads == expected_failed_downloads
# Cleanup - none
for partition in partitions_to_create:
partition.unlink()
def test_scenario_2(
self,
mocked_concurrent_download_manifest,
):
"""Tests the pre_concatenation_processing function.
Testing scenario:
- Whole file correctly downloaded,
- COREREF file correctly downloaded (all partitions are downloaded)
- WATCHLIST file correctly downloaded
Expected output:
A ConcurrentDownloadManifest with the whole_files_reference field consisting
of an empty list and the concurrent_download_manifest field consisting of an
empty list as well.
"""
# Setup
partitions_to_create = [
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_1.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_2.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_3.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_4.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_5.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_1.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_2.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_3.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_4.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_5.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_6.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_7.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_8.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_9.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_10.txt"
),
]
for partition_path in partitions_to_create:
partition_path.touch()
# Exercise
failed_downloads = pdp.pre_concatenation_processing(
mocked_concurrent_download_manifest,
)
# Verify
expected_failed_downloads = ConcurrentDownloadManifest(
files_reference_data=[],
whole_files_to_download=[],
partitions_to_download=[],
)
assert failed_downloads == expected_failed_downloads
# Cleanup - none
for partition in partitions_to_create:
partition.unlink()
def test_scenario_3(
self,
mocked_concurrent_download_manifest,
):
"""Tests the pre_concatenation_processing function.
Testing scenario:
- Whole file correctly downloaded,
- COREREF file missing a partition
- WATCHLIST file missing a partition
Expected output:
A ConcurrentDownloadManifest with the whole_files_reference field consisting
of an empty list and the concurrent_download_manifest field consisting of an
empty list as well.
"""
# Setup
partitions_to_create = [
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_1.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_2.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_3.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_5.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_1.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_2.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_3.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_4.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_5.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_6.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_7.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_8.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_10.txt"
),
]
for partition_path in partitions_to_create:
partition_path.touch()
# Exercise
failed_downloads = pdp.pre_concatenation_processing(
mocked_concurrent_download_manifest,
)
# Verify
expected_failed_downloads = ConcurrentDownloadManifest(
files_reference_data=[
DownloadDetails(
file_name="COREREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/"
"20201218-S945_CORE_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CORE/COREREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=24326963,
md5sum="8fc8fa1402e23f2d552899525b808514",
is_partitioned=True,
),
DownloadDetails(
file_name="WATCHLIST_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"WATCHLIST/20201218-S945_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/WATCHLIST/WATCHLIST_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=51648457,
md5sum="11c5253a7cd1743aea93ec5124fd974d",
is_partitioned=True,
),
],
whole_files_to_download=[],
partitions_to_download=[
PartitionDownloadDetails(
parent_file_name='COREREF_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/'
'20201218-S945_CORE_ALL_0_0?start=15728641&end=20971520'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/"
"COREREF_945_20201218_4.txt"
),
partition_index=4,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=41943041&end=47185920'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_9.txt"
),
partition_index=9,
),
]
)
assert (failed_downloads.files_reference_data.sort(key=lambda x: x.file_name)
== expected_failed_downloads.files_reference_data.sort(key=lambda x: x.file_name))
assert (
failed_downloads.partitions_to_download.sort(key=lambda x: x.parent_file_name)
== expected_failed_downloads.partitions_to_download.sort(
key=lambda x: x.parent_file_name)
)
# Cleanup - none
for partition in partitions_to_create:
partition.unlink()
def test_scenario_4(
self,
mocked_concurrent_download_manifest,
):
"""Tests the pre_concatenation_processing function.
Testing scenario:
- CROSSREF file incorrectly downloaded,
- COREREF file correctly downloaded (all partitions are downloaded)
- WATCHLIST file correctly downloaded
Expected output:
A ConcurrentDownloadManifest with the whole_files_reference field consisting
of an empty list and the concurrent_download_manifest field consisting of an
empty list as well.
"""
# Setup
partitions_to_create = [
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_1.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_2.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_3.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_4.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/COREREF_945_20201218_5.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_1.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_2.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_3.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_4.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_5.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_6.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_7.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_8.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_9.txt"
),
pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_10.txt"
),
]
for partition_path in partitions_to_create:
partition_path.touch()
crossref_file_path = pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CROSS/CROSSREF_945_20201218.txt.bz2",
)
crossref_destination = pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/CROSSREF_945_20201218.txt.bz2"
)
if not crossref_destination.exists():
crossref_file_path.replace(crossref_destination)
crossref_file_path.touch()
# Exercise
failed_downloads = pdp.pre_concatenation_processing(
mocked_concurrent_download_manifest,
)
# Verify
expected_failed_downloads = ConcurrentDownloadManifest(
files_reference_data=[
DownloadDetails(
file_name="CROSSREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"CROSS/20201218-S945_CROSS_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CROSS/CROSSREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=35150,
md5sum="13da7cea9a7337cd71fd9aea4f909bc6",
is_partitioned=False,
),
],
whole_files_to_download=[
DownloadDetails(
file_name="CROSSREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"CROSS/20201218-S945_CROSS_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CROSS/CROSSREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=35150,
md5sum="13da7cea9a7337cd71fd9aea4f909bc6",
is_partitioned=False,
),
],
partitions_to_download=[],
)
assert failed_downloads == expected_failed_downloads
# Cleanup - none
for partition in partitions_to_create:
partition.unlink()
crossref_file_path.unlink()
if not crossref_file_path.exists():
crossref_destination.replace(crossref_file_path)
class TestConcatenationProcessing:
def test_concatenation_processing_no_missing_partition_files_scenario(
self,
mocked_concurrent_download_manifest,
):
# Setup
failed_download_manifest = ConcurrentDownloadManifest(
files_reference_data=[
DownloadDetails(
file_name="CROSSREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"CROSS/20201218-S945_CROSS_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CROSS/CROSSREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=35150,
md5sum="13da7cea9a7337cd71fd9aea4f909bc6",
is_partitioned=False,
),
],
whole_files_to_download=[
DownloadDetails(
file_name="CROSSREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"CROSS/20201218-S945_CROSS_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CROSS/CROSSREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=35150,
md5sum="13da7cea9a7337cd71fd9aea4f909bc6",
is_partitioned=False,
),
],
partitions_to_download=[]
)
# Exercise
concatenated_files = pdp.concatenation_processing(
mocked_concurrent_download_manifest,
failed_download_manifest,
)
# Verify
expected_concatenated_files = [
DownloadDetails(
file_name="COREREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/"
"20201218-S945_CORE_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CORE/COREREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=24326963,
md5sum="8fc8fa1402e23f2d552899525b808514",
is_partitioned=True,
),
DownloadDetails(
file_name="WATCHLIST_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/WATCHLIST"
"/20201218-S945_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/WATCHLIST/WATCHLIST_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=51648457,
md5sum="11c5253a7cd1743aea93ec5124fd974d",
is_partitioned=True,
),
]
assert (
concatenated_files.sort(key=lambda x: x.file_name) ==
expected_concatenated_files.sort(key=lambda x: x.file_name)
)
# Cleanup - none
def test_concatenation_processing_one_missing_partition_files_scenario(
self,
mocked_concurrent_download_manifest,
):
# Setup
failed_download_manifest = ConcurrentDownloadManifest(
files_reference_data=[
DownloadDetails(
file_name="WATCHLIST_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"WATCHLIST/20201218-S945_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/WATCHLIST/WATCHLIST_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=51648457,
md5sum="11c5253a7cd1743aea93ec5124fd974d",
is_partitioned=True,
),
],
whole_files_to_download=[],
partitions_to_download=[
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=41943041&end=47185920'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_9.txt"
),
partition_index=9,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=47185921&end=51648457'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_10.txt"
),
partition_index=10,
),
]
)
# Exercise
concatenated_files = pdp.concatenation_processing(
mocked_concurrent_download_manifest,
failed_download_manifest,
)
# Verify
expected_concatenated_files = [
DownloadDetails(
file_name="COREREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/"
"20201218-S945_CORE_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CORE/COREREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=24326963,
md5sum="8fc8fa1402e23f2d552899525b808514",
is_partitioned=True,
),
]
assert concatenated_files == expected_concatenated_files
# Cleanup - none
def test_concatenation_processing_with_no_file_to_concatenate(
self,
mocked_concurrent_download_manifest,
):
# Setup
failed_download_manifest = ConcurrentDownloadManifest(
files_reference_data=[
DownloadDetails(
file_name="COREREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/"
"20201218-S945_CORE_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CORE/COREREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=24326963,
md5sum="8fc8fa1402e23f2d552899525b808514",
is_partitioned=True,
),
DownloadDetails(
file_name="WATCHLIST_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"WATCHLIST/20201218-S945_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/WATCHLIST/WATCHLIST_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=51648457,
md5sum="11c5253a7cd1743aea93ec5124fd974d",
is_partitioned=True,
),
],
whole_files_to_download=[],
partitions_to_download=[
PartitionDownloadDetails(
parent_file_name='COREREF_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/'
'20201218-S945_CORE_ALL_0_0?start=15728641&end=20971520'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/"
"COREREF_945_20201218_4.txt"
),
partition_index=4,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=41943041&end=47185920'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_9.txt"
),
partition_index=9,
),
]
)
# Exercise
concatenated_files = pdp.concatenation_processing(
mocked_concurrent_download_manifest,
failed_download_manifest,
)
# Verify
expected_concatenated_files = []
assert concatenated_files == expected_concatenated_files
# Cleanup - none
class TestUpdateFailedDownloadManifest:
def test_update_of_download_manifest_with_no_failed_downloads(
self,
mocked_concurrent_download_manifest,
):
# Setup
initial_download_manifest = mocked_concurrent_download_manifest
failed_files = []
failed_download_manifest = ConcurrentDownloadManifest(
files_reference_data=[],
whole_files_to_download=[],
partitions_to_download=[],
)
# Exercise
updated_download_manifest = pdp.update_failed_download_manifest(
failed_download_manifest,
initial_download_manifest,
failed_files
)
# Verify
expected_download_manifest = ConcurrentDownloadManifest(
files_reference_data=[],
whole_files_to_download=[],
partitions_to_download=[],
)
assert updated_download_manifest == expected_download_manifest
# Cleanup - none
def test_update_of_download_manifest_scenario_2(
self,
mocked_concurrent_download_manifest,
):
"""Tests the update_failed_download_manifest function.
Testing scenario:
- In the pre-concatenation phase no whole files failed the integrity test and
no file was found to be missing any partition (hence the failed_download_manifest
ConcurrentDownloadManifest named-tuple consists of two empty lists).
- In the post-concatenation phase, WATCHLIST_945_20201218 file fails the
integrity test.
Expected output:
A ConcurrentDownloadManifest with the whole_files_reference field consisting
of the DownloadDetails named-tuple for the WATCHLIST_945_20201218 file, and
the concurrent_download_manifest filed consisting of PartitionDownloadDetails
named-tuples, one for each of the partitions the WATCHLIST_945_20201218 file
was originally split into.
"""
# Setup
failed_downloads_manifest = ConcurrentDownloadManifest(
files_reference_data=[],
whole_files_to_download=[],
partitions_to_download=[],
)
initial_download_manifest = mocked_concurrent_download_manifest
integrity_test_failing_files = [
DownloadDetails(
file_name="WATCHLIST_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"WATCHLIST/20201218-S945_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/WATCHLIST/WATCHLIST_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=51648457,
md5sum="11c5253a7cd1743aea93ec5124fd974d",
is_partitioned=True,
),
]
# Exercise
updated_download_manifest = pdp.update_failed_download_manifest(
failed_downloads_manifest,
initial_download_manifest,
integrity_test_failing_files,
)
# Verify
expected_download_manifest = ConcurrentDownloadManifest(
files_reference_data=[
DownloadDetails(
file_name="WATCHLIST_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"WATCHLIST/20201218-S945_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/WATCHLIST/WATCHLIST_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=51648457,
md5sum="11c5253a7cd1743aea93ec5124fd974d",
is_partitioned=True,
),
],
whole_files_to_download=[],
partitions_to_download=[
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=0&end=5242880'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_1.txt"
),
partition_index=1,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=5242881&end=10485760'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_2.txt"),
partition_index=2,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=10485761&end=15728640'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_3.txt"
),
partition_index=3,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=15728641&end=20971520'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_4.txt"
),
partition_index=4,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=20971521&end=26214400'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_5.txt"
),
partition_index=5,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=26214401&end=31457280'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_6.txt"
),
partition_index=6,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=31457281&end=36700160'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_7.txt"
),
partition_index=7,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=36700161&end=41943040'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_8.txt"
),
partition_index=8,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=41943041&end=47185920'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_9.txt"
),
partition_index=9,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=47185921&end=51648457'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_10.txt"
),
partition_index=10,
),
],
)
assert updated_download_manifest == expected_download_manifest
# Cleanup - none
def test_update_of_download_manifest_scenario_3(
self,
mocked_concurrent_download_manifest,
):
"""Tests the update_failed_download_manifest function.
Testing scenario:
- In the pre-concatenation phase, CROSSREF_945_20201218 failed the data
integrity test and the WATCHLIST_945_20201218 file had a missing partition (
hence the failed_download_manifest ConcurrentDownloadManifest named-tuple
consists of the whole_file_reference field that is a list of the DownloadDetails
tuples of the two files mentioned above, while the concurrent_download_manifest
filed is a list containing the missing partition of the WATCHLIST file plus the
DownloadDetails of the CROSSREF file).
- In the post-concatenation phase, COREREF_945_20201218 file fails the
integrity test.
Expected output:
A ConcurrentDownloadManifest with the whole_files_reference field consisting
of the DownloadDetails named-tuple for the CROSSREF, COREREF and WATCHLIST
files, and the concurrent_download_manifest filed consisting of all the
PartitionDownloadDetails named-tuples of the COREREF file, a
PartitionDownloadDetails of the missing partition of the WATCHLIST file, and
the DownloadDetails named-tuple of the CROSSREF file.
"""
# Setup
initial_download_manifest = mocked_concurrent_download_manifest
integrity_test_failing_files = [
DownloadDetails(
file_name="COREREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/"
"20201218-S945_CORE_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CORE/COREREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=24326963,
md5sum="8fc8fa1402e23f2d552899525b808514",
is_partitioned=True,
),
]
failed_downloads_manifest = ConcurrentDownloadManifest(
files_reference_data=[
DownloadDetails(
file_name="CROSSREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"CROSS/20201218-S945_CROSS_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CROSS/CROSSREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=35150,
md5sum="13da7cea9a7337cd71fd9aea4f909bc6",
is_partitioned=False,
),
DownloadDetails(
file_name="WATCHLIST_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"WATCHLIST/20201218-S945_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/WATCHLIST/WATCHLIST_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=51648457,
md5sum="11c5253a7cd1743aea93ec5124fd974d",
is_partitioned=True,
),
],
whole_files_to_download=[
DownloadDetails(
file_name="CROSSREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"CROSS/20201218-S945_CROSS_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CROSS/CROSSREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=35150,
md5sum="13da7cea9a7337cd71fd9aea4f909bc6",
is_partitioned=False,
),
],
partitions_to_download=[
DownloadDetails(
file_name="CROSSREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"CROSS/20201218-S945_CROSS_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CROSS/CROSSREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=35150,
md5sum="13da7cea9a7337cd71fd9aea4f909bc6",
is_partitioned=False,
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=47185921&end=51648457'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_10.txt"
),
partition_index=10,
),
],
)
# Exercise
updated_download_manifest = pdp.update_failed_download_manifest(
failed_downloads_manifest,
initial_download_manifest,
integrity_test_failing_files,
)
# Verify
expected_download_manifest = ConcurrentDownloadManifest(
files_reference_data=[
DownloadDetails(
file_name="CROSSREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"CROSS/20201218-S945_CROSS_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CROSS/CROSSREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=35150,
md5sum="13da7cea9a7337cd71fd9aea4f909bc6",
is_partitioned=False,
),
DownloadDetails(
file_name="WATCHLIST_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"WATCHLIST/20201218-S945_WATCHLIST_username_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/WATCHLIST/WATCHLIST_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=51648457,
md5sum="11c5253a7cd1743aea93ec5124fd974d",
is_partitioned=True,
),
DownloadDetails(
file_name="COREREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/"
"20201218-S945_CORE_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CORE/COREREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=24326963,
md5sum="8fc8fa1402e23f2d552899525b808514",
is_partitioned=True,
),
],
whole_files_to_download=[
DownloadDetails(
file_name="CROSSREF_945_20201218.txt.bz2",
download_url=(
"https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/"
"CROSS/20201218-S945_CROSS_ALL_0_0"
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1",
"2020/12/18/CROSS/CROSSREF_945_20201218.txt.bz2",
),
source_id=945,
reference_date=datetime.datetime(year=2020, month=12, day=18),
size=35150,
md5sum="13da7cea9a7337cd71fd9aea4f909bc6",
is_partitioned=False,
),
],
partitions_to_download=[
DownloadDetails(
file_name='CROSSREF_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'CROSS/20201218-S945_CROSS_ALL_0_0'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CROSS/"
"CROSSREF_945_20201218.txt.bz2"
),
source_id=945,
reference_date=datetime.datetime(2020, 12, 18, 0, 0),
size=35150,
md5sum='13da7cea9a7337cd71fd9aea4f909bc6',
is_partitioned=False
),
PartitionDownloadDetails(
parent_file_name='WATCHLIST_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/'
'WATCHLIST/20201218-S945_WATCHLIST_username_0_0?start=47185921&end=51648457'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/WATCHLIST/"
"WATCHLIST_945_20201218_10.txt"
),
partition_index=10,
),
PartitionDownloadDetails(
parent_file_name='COREREF_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/'
'20201218-S945_CORE_ALL_0_0?start=0&end=5242880'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/"
"COREREF_945_20201218_1.txt"
),
partition_index=1,
),
PartitionDownloadDetails(
parent_file_name='COREREF_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/'
'20201218-S945_CORE_ALL_0_0?start=5242881&end=10485760'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/"
"COREREF_945_20201218_2.txt"
),
partition_index=2,
),
PartitionDownloadDetails(
parent_file_name='COREREF_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/'
'20201218-S945_CORE_ALL_0_0?start=10485761&end=15728640'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/"
"COREREF_945_20201218_3.txt"
),
partition_index=3,
),
PartitionDownloadDetails(
parent_file_name='COREREF_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/'
'20201218-S945_CORE_ALL_0_0?start=15728641&end=20971520'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/"
"COREREF_945_20201218_4.txt"
),
partition_index=4,
),
PartitionDownloadDetails(
parent_file_name='COREREF_945_20201218.txt.bz2',
download_url=(
'https://api.icedatavault.icedataservices.com/v2/data/2020/12/18/S945/CORE/'
'20201218-S945_CORE_ALL_0_0?start=20971521&end=24326963'
),
file_path=pathlib.Path(__file__).resolve().parent.joinpath(
"static_data/post_processing_scenario_1/2020/12/18/CORE/"
"COREREF_945_20201218_5.txt"
),
partition_index=5,
),
],
)
assert updated_download_manifest == expected_download_manifest
# Cleanup - none
| 46.553821 | 100 | 0.575146 | 10,917 | 113,312 | 5.566548 | 0.026839 | 0.050946 | 0.0208 | 0.055751 | 0.935725 | 0.91198 | 0.900197 | 0.888843 | 0.867533 | 0.860375 | 0 | 0.140821 | 0.33376 | 113,312 | 2,433 | 101 | 46.572955 | 0.664154 | 0.048203 | 0 | 0.818909 | 0 | 0.032455 | 0.284694 | 0.213784 | 0 | 0 | 0 | 0 | 0.016933 | 1 | 0.015052 | false | 0 | 0.002352 | 0 | 0.023989 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
1ebe5a9a3f142103e089aacaa5a7cdf43e7415e8 | 1,417 | py | Python | blog/serializers.py | mohamadhos78/blogpy | 56c69ffec66b2e2aef48ff82beec3b1722ce6457 | [
"MIT"
] | 49 | 2020-04-06T23:26:14.000Z | 2022-03-22T23:21:27.000Z | blog/serializers.py | mrAlirj/Blogpy | 56c69ffec66b2e2aef48ff82beec3b1722ce6457 | [
"MIT"
] | 4 | 2021-04-08T21:19:57.000Z | 2022-02-10T12:05:57.000Z | blog/serializers.py | mrAlirj/Blogpy | 56c69ffec66b2e2aef48ff82beec3b1722ce6457 | [
"MIT"
] | 36 | 2020-04-26T17:12:16.000Z | 2022-02-11T07:29:30.000Z | from rest_framework import serializers
class SingleArticleSerializer(serializers.Serializer):
title = serializers.CharField(required=True, allow_null=False, allow_blank=False, max_length=128)
cover = serializers.CharField(required=True, allow_null=False, allow_blank=False, max_length=256)
content = serializers.CharField(required=True, allow_null=False, allow_blank=False, max_length=2048)
created_at = serializers.DateTimeField(required=True, allow_null=False)
class SubmitArticleSerializer(serializers.Serializer):
title = serializers.CharField(required=True, allow_null=False, allow_blank=False, max_length=128)
cover = serializers.FileField(required=True, allow_null=False, allow_empty_file=False)
content = serializers.CharField(required=True, allow_null=False, allow_blank=False, max_length=2048)
category_id = serializers.IntegerField(required=True, allow_null=False)
author_id = serializers.IntegerField(required=True, allow_null=False)
promote = serializers.BooleanField(required=True, allow_null=False)
class UpdateArticleCoverSerializer(serializers.Serializer):
article_id = serializers.IntegerField(required=True, allow_null=False)
cover = serializers.FileField(required=True, allow_null=False, allow_empty_file=False)
class DeleteArticleSerializer(serializers.Serializer):
article_id = serializers.IntegerField(required=True, allow_null=False) | 54.5 | 104 | 0.812279 | 168 | 1,417 | 6.654762 | 0.232143 | 0.139535 | 0.197674 | 0.244186 | 0.802326 | 0.802326 | 0.746869 | 0.746869 | 0.655635 | 0.655635 | 0 | 0.013261 | 0.095272 | 1,417 | 26 | 105 | 54.5 | 0.858814 | 0 | 0 | 0.444444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.055556 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 8 |
1ee140141e8d4a501f2537fdbc1a077a43200964 | 1,929 | py | Python | main.py | Lilweavs/PathFinding | 56266ab6958473449852b9b47784daded797430d | [
"MIT"
] | null | null | null | main.py | Lilweavs/PathFinding | 56266ab6958473449852b9b47784daded797430d | [
"MIT"
] | null | null | null | main.py | Lilweavs/PathFinding | 56266ab6958473449852b9b47784daded797430d | [
"MIT"
] | null | null | null | from src.GUI import PathGUI
from src.PathFindingAlgorithms import BFS, Dijkstra, Astar
import matplotlib.pyplot as plt
Map=[
[0, 0, 0, 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, 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, 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, 1, 1, 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, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 0, 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, 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, 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, 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, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 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, 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, 0, 0, 0]]
# Map = [[0]*30]*18
Map = [[0]*30]*20
"""
Things to do
-> Implement Dijkstra's algorithm
-> Implement A* algorithm
-> Add radio buttons to select which algorithm to use
"""
if __name__ == "__main__":
vis = PathGUI(Map, pathFinderType='Dij')
# n = Astar(Map, (0, 0), (9, 9))
# path = n.solve()
# print(path)
plt.show() | 41.934783 | 96 | 0.390876 | 517 | 1,929 | 1.44294 | 0.085106 | 0.97319 | 1.343164 | 1.640751 | 0.603217 | 0.603217 | 0.603217 | 0.603217 | 0.603217 | 0.603217 | 0 | 0.355556 | 0.323484 | 1,929 | 46 | 97 | 41.934783 | 0.216092 | 0.039917 | 0 | 0.521739 | 0 | 0 | 0.006425 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.130435 | 0 | 0.130435 | 0 | 0 | 0 | 1 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
9492aa6d837c988885ad93fecd259e36d980699a | 17,739 | py | Python | data/__init__.py | mengyuxin520/PGGAN | 0cf1e46c8b935893066c0314c07049ee9a9b5ef5 | [
"BSD-3-Clause"
] | null | null | null | data/__init__.py | mengyuxin520/PGGAN | 0cf1e46c8b935893066c0314c07049ee9a9b5ef5 | [
"BSD-3-Clause"
] | 1 | 2022-02-10T09:06:32.000Z | 2022-03-22T07:45:55.000Z | data/__init__.py | mengyuxin520/PGGAN | 0cf1e46c8b935893066c0314c07049ee9a9b5ef5 | [
"BSD-3-Clause"
] | null | null | null | """This package includes all the modules related to data loading and preprocessing
To add a custom dataset class called 'dummy', you need to add a file called 'dummy_dataset.py' and define a subclass 'DummyDataset' inherited from BaseDataset.
You need to implement four functions:
-- <__init__>: initialize the class, first call BaseDataset.__init__(self, opt).
-- <__len__>: return the size of dataset.
-- <__getitem__>: get a data point from data loader.
-- <modify_commandline_options>: (optionally) add dataset-specific options and set default options.
Now you can use the dataset class by specifying flag '--dataset_mode dummy'.
See our template dataset class 'template_dataset.py' for more details.
"""
import importlib
import torch.utils.data
from data.base_dataset import BaseDataset
def find_dataset_using_name(dataset_name):
"""Import the module "data/[dataset_name]_dataset.py".
In the file, the class called DatasetNameDataset() will
be instantiated. It has to be a subclass of BaseDataset,
and it is case-insensitive.
"""
dataset_filename = "data." + dataset_name + "_dataset"
datasetlib = importlib.import_module(dataset_filename)
dataset = None
target_dataset_name = dataset_name.replace('_', '') + 'dataset'
for name, cls in datasetlib.__dict__.items():
if name.lower() == target_dataset_name.lower() \
and issubclass(cls, BaseDataset):
dataset = cls
if dataset is None:
raise NotImplementedError("In %s.py, there should be a subclass of BaseDataset with class name that matches %s in lowercase." % (dataset_filename, target_dataset_name))
return dataset
def get_option_setter(dataset_name):
"""Return the static method <modify_commandline_options> of the dataset class."""
dataset_class = find_dataset_using_name(dataset_name)
return dataset_class.modify_commandline_options
def create_dataset(opt,count):
"""Create a dataset given the option.
This function wraps the class CustomDatasetDataLoader.
This is the main interface between this package and 'train.py'/'test.py'
Example:
>>> from data import create_dataset
>>> dataset = create_dataset(opt)
"""
if count ==1:
data_loader = CustomDatasetDataLoader1(opt)
elif count ==2:
data_loader = CustomDatasetDataLoader2(opt)
elif count ==3:
data_loader = CustomDatasetDataLoader3(opt)
elif count ==4:
data_loader = CustomDatasetDataLoader4(opt)
elif count ==5:
data_loader = CustomDatasetDataLoader5(opt)
elif count ==6:
data_loader = CustomDatasetDataLoader6(opt)
elif count ==7:
data_loader = CustomDatasetDataLoader7(opt)
elif count ==8:
data_loader = CustomDatasetDataLoader8(opt)
elif count ==9:
data_loader = CustomDatasetDataLoader9(opt)
elif count ==10:
data_loader = CustomDatasetDataLoader10(opt)
dataset = data_loader.load_data()
return dataset
def create_dataset_test(opt):
"""Create a dataset given the option.
This function wraps the class CustomDatasetDataLoader.
This is the main interface between this package and 'train.py'/'test.py'
Example:
>>> from data import create_dataset
>>> dataset = create_dataset(opt)
"""
data_loader = CustomDatasetDataLoader_test(opt)
dataset = data_loader.load_data()
return dataset
def create_dataset1(opt):
"""Create a dataset given the option.
This function wraps the class CustomDatasetDataLoader.
This is the main interface between this package and 'train.py'/'test.py'
Example:
>>> from data import create_dataset
>>> dataset = create_dataset(opt)
"""
data_loader = CustomDatasetDataLoader(opt)
dataset = data_loader.load_data()
return dataset
class CustomDatasetDataLoader_test():
"""Wrapper class of Dataset class that performs multi-threaded data loading"""
def __init__(self, opt):
"""Initialize this class
Step 1: create a dataset instance given the name [dataset_mode]
Step 2: create a multi-threaded data loader.
"""
self.opt = opt
dataset_class = find_dataset_using_name(opt.dataset_mode_test)
self.dataset = dataset_class(opt)
print("dataset [%s] was created" % type(self.dataset).__name__)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batch_size,
shuffle=not opt.serial_batches,
num_workers=int(opt.num_threads))
def load_data(self):
return self
def __len__(self):
"""Return the number of data in the dataset"""
return min(len(self.dataset), self.opt.max_dataset_size)
def __iter__(self):
"""Return a batch of data"""
for i, data in enumerate(self.dataloader):
if i * self.opt.batch_size >= self.opt.max_dataset_size:
break
yield data
class CustomDatasetDataLoader():
"""Wrapper class of Dataset class that performs multi-threaded data loading"""
def __init__(self, opt):
"""Initialize this class
Step 1: create a dataset instance given the name [dataset_mode]
Step 2: create a multi-threaded data loader.
"""
self.opt = opt
dataset_class = find_dataset_using_name(opt.dataset_mode)
self.dataset = dataset_class(opt)
print("dataset [%s] was created" % type(self.dataset).__name__)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batch_size,
shuffle=not opt.serial_batches,
num_workers=int(opt.num_threads))
def load_data(self):
return self
def __len__(self):
"""Return the number of data in the dataset"""
return min(len(self.dataset), self.opt.max_dataset_size)
def __iter__(self):
"""Return a batch of data"""
for i, data in enumerate(self.dataloader):
if i * self.opt.batch_size >= self.opt.max_dataset_size:
break
yield data
class CustomDatasetDataLoader1():
"""Wrapper class of Dataset class that performs multi-threaded data loading"""
def __init__(self, opt):
"""Initialize this class
Step 1: create a dataset instance given the name [dataset_mode]
Step 2: create a multi-threaded data loader.
"""
self.opt = opt
dataset_class = find_dataset_using_name(opt.dataset_mode1)
self.dataset = dataset_class(opt)
print("dataset [%s] was created" % type(self.dataset).__name__)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batch_size,
shuffle=not opt.serial_batches,
num_workers=int(opt.num_threads))
def load_data(self):
return self
def __len__(self):
"""Return the number of data in the dataset"""
return min(len(self.dataset), self.opt.max_dataset_size)
def __iter__(self):
"""Return a batch of data"""
for i, data in enumerate(self.dataloader):
if i * self.opt.batch_size >= self.opt.max_dataset_size:
break
yield data
class CustomDatasetDataLoader2():
"""Wrapper class of Dataset class that performs multi-threaded data loading"""
def __init__(self, opt):
"""Initialize this class
Step 1: create a dataset instance given the name [dataset_mode]
Step 2: create a multi-threaded data loader.
"""
self.opt = opt
dataset_class = find_dataset_using_name(opt.dataset_mode2)
self.dataset = dataset_class(opt)
print("dataset [%s] was created" % type(self.dataset).__name__)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batch_size,
shuffle=not opt.serial_batches,
num_workers=int(opt.num_threads))
def load_data(self):
return self
def __len__(self):
"""Return the number of data in the dataset"""
return min(len(self.dataset), self.opt.max_dataset_size)
def __iter__(self):
"""Return a batch of data"""
for i, data in enumerate(self.dataloader):
if i * self.opt.batch_size >= self.opt.max_dataset_size:
break
yield data
class CustomDatasetDataLoader3():
"""Wrapper class of Dataset class that performs multi-threaded data loading"""
def __init__(self, opt):
"""Initialize this class
Step 1: create a dataset instance given the name [dataset_mode]
Step 2: create a multi-threaded data loader.
"""
self.opt = opt
dataset_class = find_dataset_using_name(opt.dataset_mode3)
self.dataset = dataset_class(opt)
print("dataset [%s] was created" % type(self.dataset).__name__)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batch_size,
shuffle=not opt.serial_batches,
num_workers=int(opt.num_threads))
def load_data(self):
return self
def __len__(self):
"""Return the number of data in the dataset"""
return min(len(self.dataset), self.opt.max_dataset_size)
def __iter__(self):
"""Return a batch of data"""
for i, data in enumerate(self.dataloader):
if i * self.opt.batch_size >= self.opt.max_dataset_size:
break
yield data
class CustomDatasetDataLoader4():
"""Wrapper class of Dataset class that performs multi-threaded data loading"""
def __init__(self, opt):
"""Initialize this class
Step 1: create a dataset instance given the name [dataset_mode]
Step 2: create a multi-threaded data loader.
"""
self.opt = opt
dataset_class = find_dataset_using_name(opt.dataset_mode4)
self.dataset = dataset_class(opt)
print("dataset [%s] was created" % type(self.dataset).__name__)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batch_size,
shuffle=not opt.serial_batches,
num_workers=int(opt.num_threads))
def load_data(self):
return self
def __len__(self):
"""Return the number of data in the dataset"""
return min(len(self.dataset), self.opt.max_dataset_size)
def __iter__(self):
"""Return a batch of data"""
for i, data in enumerate(self.dataloader):
if i * self.opt.batch_size >= self.opt.max_dataset_size:
break
yield data
class CustomDatasetDataLoader5():
"""Wrapper class of Dataset class that performs multi-threaded data loading"""
def __init__(self, opt):
"""Initialize this class
Step 1: create a dataset instance given the name [dataset_mode]
Step 2: create a multi-threaded data loader.
"""
self.opt = opt
dataset_class = find_dataset_using_name(opt.dataset_mode5)
self.dataset = dataset_class(opt)
print("dataset [%s] was created" % type(self.dataset).__name__)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batch_size,
shuffle=not opt.serial_batches,
num_workers=int(opt.num_threads))
def load_data(self):
return self
def __len__(self):
"""Return the number of data in the dataset"""
return min(len(self.dataset), self.opt.max_dataset_size)
def __iter__(self):
"""Return a batch of data"""
for i, data in enumerate(self.dataloader):
if i * self.opt.batch_size >= self.opt.max_dataset_size:
break
yield data
class CustomDatasetDataLoader6():
"""Wrapper class of Dataset class that performs multi-threaded data loading"""
def __init__(self, opt):
"""Initialize this class
Step 1: create a dataset instance given the name [dataset_mode]
Step 2: create a multi-threaded data loader.
"""
self.opt = opt
dataset_class = find_dataset_using_name(opt.dataset_mode6)
self.dataset = dataset_class(opt)
print("dataset [%s] was created" % type(self.dataset).__name__)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batch_size,
shuffle=not opt.serial_batches,
num_workers=int(opt.num_threads))
def load_data(self):
return self
def __len__(self):
"""Return the number of data in the dataset"""
return min(len(self.dataset), self.opt.max_dataset_size)
def __iter__(self):
"""Return a batch of data"""
for i, data in enumerate(self.dataloader):
if i * self.opt.batch_size >= self.opt.max_dataset_size:
break
yield data
class CustomDatasetDataLoader7():
"""Wrapper class of Dataset class that performs multi-threaded data loading"""
def __init__(self, opt):
"""Initialize this class
Step 1: create a dataset instance given the name [dataset_mode]
Step 2: create a multi-threaded data loader.
"""
self.opt = opt
dataset_class = find_dataset_using_name(opt.dataset_mode7)
self.dataset = dataset_class(opt)
print("dataset [%s] was created" % type(self.dataset).__name__)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batch_size,
shuffle=not opt.serial_batches,
num_workers=int(opt.num_threads))
def load_data(self):
return self
def __len__(self):
"""Return the number of data in the dataset"""
return min(len(self.dataset), self.opt.max_dataset_size)
def __iter__(self):
"""Return a batch of data"""
for i, data in enumerate(self.dataloader):
if i * self.opt.batch_size >= self.opt.max_dataset_size:
break
yield data
class CustomDatasetDataLoader8():
"""Wrapper class of Dataset class that performs multi-threaded data loading"""
def __init__(self, opt):
"""Initialize this class
Step 1: create a dataset instance given the name [dataset_mode]
Step 2: create a multi-threaded data loader.
"""
self.opt = opt
dataset_class = find_dataset_using_name(opt.dataset_mode8)
self.dataset = dataset_class(opt)
print("dataset [%s] was created" % type(self.dataset).__name__)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batch_size,
shuffle=not opt.serial_batches,
num_workers=int(opt.num_threads))
def load_data(self):
return self
def __len__(self):
"""Return the number of data in the dataset"""
return min(len(self.dataset), self.opt.max_dataset_size)
def __iter__(self):
"""Return a batch of data"""
for i, data in enumerate(self.dataloader):
if i * self.opt.batch_size >= self.opt.max_dataset_size:
break
yield data
class CustomDatasetDataLoader9():
"""Wrapper class of Dataset class that performs multi-threaded data loading"""
def __init__(self, opt):
"""Initialize this class
Step 1: create a dataset instance given the name [dataset_mode]
Step 2: create a multi-threaded data loader.
"""
self.opt = opt
dataset_class = find_dataset_using_name(opt.dataset_mode9)
self.dataset = dataset_class(opt)
print("dataset [%s] was created" % type(self.dataset).__name__)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batch_size,
shuffle=not opt.serial_batches,
num_workers=int(opt.num_threads))
def load_data(self):
return self
def __len__(self):
"""Return the number of data in the dataset"""
return min(len(self.dataset), self.opt.max_dataset_size)
def __iter__(self):
"""Return a batch of data"""
for i, data in enumerate(self.dataloader):
if i * self.opt.batch_size >= self.opt.max_dataset_size:
break
yield data
class CustomDatasetDataLoader10():
"""Wrapper class of Dataset class that performs multi-threaded data loading"""
def __init__(self, opt):
"""Initialize this class
Step 1: create a dataset instance given the name [dataset_mode]
Step 2: create a multi-threaded data loader.
"""
self.opt = opt
dataset_class = find_dataset_using_name(opt.dataset_mode10)
self.dataset = dataset_class(opt)
print("dataset [%s] was created" % type(self.dataset).__name__)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batch_size,
shuffle=not opt.serial_batches,
num_workers=int(opt.num_threads))
def load_data(self):
return self
def __len__(self):
"""Return the number of data in the dataset"""
return min(len(self.dataset), self.opt.max_dataset_size)
def __iter__(self):
"""Return a batch of data"""
for i, data in enumerate(self.dataloader):
if i * self.opt.batch_size >= self.opt.max_dataset_size:
break
yield data
| 35.692153 | 176 | 0.640791 | 2,218 | 17,739 | 4.900361 | 0.082507 | 0.039286 | 0.037538 | 0.037538 | 0.806422 | 0.802006 | 0.795197 | 0.795197 | 0.791425 | 0.791425 | 0 | 0.005309 | 0.267377 | 17,739 | 496 | 177 | 35.764113 | 0.831025 | 0.28474 | 0 | 0.771626 | 0 | 0.00346 | 0.033769 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.183391 | false | 0 | 0.013841 | 0.041522 | 0.3391 | 0.041522 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
94d796c10364f40220596efaa36f853c203fdaef | 38,767 | py | Python | tensorflow_data_validation/statistics/generators/basic_stats_generator_test.py | brills/data-validation | 4f8a5d12b3d5db7383ae53d5fe184af1d781449a | [
"Apache-2.0"
] | null | null | null | tensorflow_data_validation/statistics/generators/basic_stats_generator_test.py | brills/data-validation | 4f8a5d12b3d5db7383ae53d5fe184af1d781449a | [
"Apache-2.0"
] | null | null | null | tensorflow_data_validation/statistics/generators/basic_stats_generator_test.py | brills/data-validation | 4f8a5d12b3d5db7383ae53d5fe184af1d781449a | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for basic statistics generator.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import absltest
import numpy as np
import pyarrow as pa
from tensorflow_data_validation.statistics.generators import basic_stats_generator
from tensorflow_data_validation.utils import test_util
from google.protobuf import text_format
from tensorflow_metadata.proto.v0 import schema_pb2
from tensorflow_metadata.proto.v0 import statistics_pb2
class BasicStatsGeneratorTest(test_util.CombinerStatsGeneratorTest):
def test_basic_stats_generator_single_feature(self):
# input with two batches: first batch has two examples and second batch
# has a single example.
b1 = pa.Table.from_arrays([pa.array([[1.0, 2.0], [3.0, 4.0, 5.0]])], ['a'])
b2 = pa.Table.from_arrays([pa.array([[1.0]])], ['a'])
batches = [b1, b2]
expected_result = {
'a': text_format.Parse(
"""
name: 'a'
type: FLOAT
num_stats {
common_stats {
num_non_missing: 3
min_num_values: 1
max_num_values: 3
avg_num_values: 2.0
tot_num_values: 6
num_values_histogram {
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 0.75
}
buckets {
low_value: 1.0
high_value: 2.0
sample_count: 0.75
}
buckets {
low_value: 2.0
high_value: 3.0
sample_count: 0.75
}
buckets {
low_value: 3.0
high_value: 3.0
sample_count: 0.75
}
type: QUANTILES
}
}
mean: 2.66666666
std_dev: 1.49071198
num_zeros: 0
min: 1.0
max: 5.0
median: 3.0
histograms {
buckets {
low_value: 1.0
high_value: 2.3333333
sample_count: 2.9866667
}
buckets {
low_value: 2.3333333
high_value: 3.6666667
sample_count: 1.0066667
}
buckets {
low_value: 3.6666667
high_value: 5.0
sample_count: 2.0066667
}
type: STANDARD
}
histograms {
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 1.5
}
buckets {
low_value: 1.0
high_value: 3.0
sample_count: 1.5
}
buckets {
low_value: 3.0
high_value: 4.0
sample_count: 1.5
}
buckets {
low_value: 4.0
high_value: 5.0
sample_count: 1.5
}
type: QUANTILES
}
}
""", statistics_pb2.FeatureNameStatistics())}
generator = basic_stats_generator.BasicStatsGenerator(
num_values_histogram_buckets=4, num_histogram_buckets=3,
num_quantiles_histogram_buckets=4)
self.assertCombinerOutputEqual(batches, generator, expected_result)
def test_basic_stats_generator_no_runtime_warnings_close_to_max_int(self):
# input has batches with values that are slightly smaller than the maximum
# integer value.
less_than_max_int_value = np.iinfo(np.int64).max - 1
batches = (
[pa.Table.from_arrays([pa.array([[less_than_max_int_value]])], ['a'])] *
2)
generator = basic_stats_generator.BasicStatsGenerator()
with np.testing.assert_no_warnings():
accumulators = [
generator.add_input(generator.create_accumulator(), batch)
for batch in batches
]
generator.merge_accumulators(accumulators)
def test_basic_stats_generator_handle_null_column(self):
# Feature 'a' covers null coming before non-null.
# Feature 'b' covers null coming after non-null.
b1 = pa.Table.from_arrays([
pa.array([None, None, None], type=pa.null()),
pa.array([[1.0, 2.0, 3.0], [4.0], [5.0]]),
], ['a', 'b'])
b2 = pa.Table.from_arrays([
pa.array([[1, 2], None], type=pa.list_(pa.int64())),
pa.array([None, None], type=pa.null()),
], ['a', 'b'])
batches = [b1, b2]
expected_result = {
'a': text_format.Parse(
"""
name: "a"
num_stats {
common_stats {
num_non_missing: 1
min_num_values: 2
max_num_values: 2
avg_num_values: 2.0
num_values_histogram {
buckets {
low_value: 2.0
high_value: 2.0
sample_count: 0.25
}
buckets {
low_value: 2.0
high_value: 2.0
sample_count: 0.25
}
buckets {
low_value: 2.0
high_value: 2.0
sample_count: 0.25
}
buckets {
low_value: 2.0
high_value: 2.0
sample_count: 0.25
}
type: QUANTILES
}
tot_num_values: 2
}
mean: 1.5
std_dev: 0.5
min: 1.0
median: 2.0
max: 2.0
histograms {
buckets {
low_value: 1.0
high_value: 1.3333333
sample_count: 0.9955556
}
buckets {
low_value: 1.3333333
high_value: 1.6666667
sample_count: 0.0022222
}
buckets {
low_value: 1.6666667
high_value: 2.0
sample_count: 1.0022222
}
}
histograms {
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 0.5
}
buckets {
low_value: 1.0
high_value: 2.0
sample_count: 0.5
}
buckets {
low_value: 2.0
high_value: 2.0
sample_count: 0.5
}
buckets {
low_value: 2.0
high_value: 2.0
sample_count: 0.5
}
type: QUANTILES
}
}
""", statistics_pb2.FeatureNameStatistics()),
'b': text_format.Parse(
"""
name: "b"
type: FLOAT
num_stats {
common_stats {
num_non_missing: 3
min_num_values: 1
max_num_values: 3
avg_num_values: 1.66666698456
num_values_histogram {
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 0.75
}
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 0.75
}
buckets {
low_value: 1.0
high_value: 3.0
sample_count: 0.75
}
buckets {
low_value: 3.0
high_value: 3.0
sample_count: 0.75
}
type: QUANTILES
}
tot_num_values: 5
}
mean: 3.0
std_dev: 1.4142136
min: 1.0
median: 3.0
max: 5.0
histograms {
buckets {
low_value: 1.0
high_value: 2.3333333
sample_count: 1.9888889
}
buckets {
low_value: 2.3333333
high_value: 3.6666667
sample_count: 1.0055556
}
buckets {
low_value: 3.6666667
high_value: 5.0
sample_count: 2.0055556
}
}
histograms {
buckets {
low_value: 1.0
high_value: 2.0
sample_count: 1.25
}
buckets {
low_value: 2.0
high_value: 3.0
sample_count: 1.25
}
buckets {
low_value: 3.0
high_value: 4.0
sample_count: 1.25
}
buckets {
low_value: 4.0
high_value: 5.0
sample_count: 1.25
}
type: QUANTILES
}
}
""", statistics_pb2.FeatureNameStatistics()),
}
generator = basic_stats_generator.BasicStatsGenerator(
num_values_histogram_buckets=4,
num_histogram_buckets=3,
num_quantiles_histogram_buckets=4)
self.assertCombinerOutputEqual(batches, generator, expected_result)
def test_basic_stats_generator_with_weight_feature(self):
# input with two batches: first batch has two examples and second batch
# has a single example.
b1 = pa.Table.from_arrays([pa.array([[1.0, 2.0], [3.0, 4.0, 5.0]]),
pa.array([[1, 2], [3, 4, 5]]),
pa.array([[1.0], [2.0]])], ['a', 'b', 'w'])
b2 = pa.Table.from_arrays([pa.array([[1.0, np.NaN, np.NaN, np.NaN], None]),
pa.array([[1], None]),
pa.array([[3.0], [2.0]])], ['a', 'b', 'w'])
batches = [b1, b2]
expected_result = {
'a': text_format.Parse(
"""
name: 'a'
type: FLOAT
num_stats {
common_stats {
num_non_missing: 3
min_num_values: 2
max_num_values: 4
avg_num_values: 3.0
tot_num_values: 9
num_values_histogram {
buckets {
low_value: 2.0
high_value: 2.0
sample_count: 0.75
}
buckets {
low_value: 2.0
high_value: 3.0
sample_count: 0.75
}
buckets {
low_value: 3.0
high_value: 4.0
sample_count: 0.75
}
buckets {
low_value: 4.0
high_value: 4.0
sample_count: 0.75
}
type: QUANTILES
}
weighted_common_stats {
num_non_missing: 6.0
avg_num_values: 3.33333333
tot_num_values: 20.0
}
}
mean: 2.66666666
std_dev: 1.49071198
num_zeros: 0
min: 1.0
max: 5.0
median: 3.0
histograms {
num_nan: 3
buckets {
low_value: 1.0
high_value: 2.3333333
sample_count: 2.9866667
}
buckets {
low_value: 2.3333333
high_value: 3.6666667
sample_count: 1.0066667
}
buckets {
low_value: 3.6666667
high_value: 5.0
sample_count: 2.0066667
}
type: STANDARD
}
histograms {
num_nan: 3
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 1.5
}
buckets {
low_value: 1.0
high_value: 3.0
sample_count: 1.5
}
buckets {
low_value: 3.0
high_value: 4.0
sample_count: 1.5
}
buckets {
low_value: 4.0
high_value: 5.0
sample_count: 1.5
}
type: QUANTILES
}
weighted_numeric_stats {
mean: 2.7272727
std_dev: 1.5427784
median: 3.0
histograms {
num_nan: 3
buckets {
low_value: 1.0
high_value: 2.3333333
sample_count: 4.9988889
}
buckets {
low_value: 2.3333333
high_value: 3.6666667
sample_count: 1.9922222
}
buckets {
low_value: 3.6666667
high_value: 5.0
sample_count: 4.0088889
}
}
histograms {
num_nan: 3
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 2.75
}
buckets {
low_value: 1.0
high_value: 3.0
sample_count: 2.75
}
buckets {
low_value: 3.0
high_value: 4.0
sample_count: 2.75
}
buckets {
low_value: 4.0
high_value: 5.0
sample_count: 2.75
}
type: QUANTILES
}
}
}
""", statistics_pb2.FeatureNameStatistics()),
'b': text_format.Parse(
"""
name: 'b'
type: INT
num_stats {
common_stats {
num_non_missing: 3
min_num_values: 1
max_num_values: 3
avg_num_values: 2.0
tot_num_values: 6
num_values_histogram {
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 0.75
}
buckets {
low_value: 1.0
high_value: 2.0
sample_count: 0.75
}
buckets {
low_value: 2.0
high_value: 3.0
sample_count: 0.75
}
buckets {
low_value: 3.0
high_value: 3.0
sample_count: 0.75
}
type: QUANTILES
}
weighted_common_stats {
num_non_missing: 6.0
avg_num_values: 1.83333333
tot_num_values: 11.0
}
}
mean: 2.66666666
std_dev: 1.49071198
num_zeros: 0
min: 1.0
max: 5.0
median: 3.0
histograms {
buckets {
low_value: 1.0
high_value: 2.3333333
sample_count: 2.9866667
}
buckets {
low_value: 2.3333333
high_value: 3.6666667
sample_count: 1.0066667
}
buckets {
low_value: 3.6666667
high_value: 5.0
sample_count: 2.0066667
}
type: STANDARD
}
histograms {
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 1.5
}
buckets {
low_value: 1.0
high_value: 3.0
sample_count: 1.5
}
buckets {
low_value: 3.0
high_value: 4.0
sample_count: 1.5
}
buckets {
low_value: 4.0
high_value: 5.0
sample_count: 1.5
}
type: QUANTILES
}
weighted_numeric_stats {
mean: 2.7272727
std_dev: 1.5427784
median: 3.0
histograms {
buckets {
low_value: 1.0
high_value: 2.3333333
sample_count: 4.9988889
}
buckets {
low_value: 2.3333333
high_value: 3.6666667
sample_count: 1.9922222
}
buckets {
low_value: 3.6666667
high_value: 5.0
sample_count: 4.0088889
}
}
histograms {
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 2.75
}
buckets {
low_value: 1.0
high_value: 3.0
sample_count: 2.75
}
buckets {
low_value: 3.0
high_value: 4.0
sample_count: 2.75
}
buckets {
low_value: 4.0
high_value: 5.0
sample_count: 2.75
}
type: QUANTILES
}
}
}
""", statistics_pb2.FeatureNameStatistics())}
generator = basic_stats_generator.BasicStatsGenerator(
weight_feature='w',
num_values_histogram_buckets=4, num_histogram_buckets=3,
num_quantiles_histogram_buckets=4)
self.assertCombinerOutputEqual(batches, generator, expected_result)
def test_basic_stats_generator_with_entire_feature_value_list_missing(self):
# input with two batches: first batch has three examples and second batch
# has two examples.
b1 = pa.Table.from_arrays([
pa.array([[1.0, 2.0], None, [3.0, 4.0, 5.0]]),
pa.array([['x', 'y', 'z', 'w'], None, ['qwe', 'abc']]),
], ['a', 'b'])
b2 = pa.Table.from_arrays(
[pa.array([[1.0], None]),
pa.array([None, ['qwe']])], ['a', 'b'])
batches = [b1, b2]
expected_result = {
'a': text_format.Parse(
"""
name: 'a'
type: FLOAT
num_stats {
common_stats {
num_non_missing: 3
min_num_values: 1
max_num_values: 3
avg_num_values: 2.0
tot_num_values: 6
num_values_histogram {
buckets {
low_value: 1.0
high_value: 2.0
sample_count: 1.0
}
buckets {
low_value: 2.0
high_value: 3.0
sample_count: 1.0
}
buckets {
low_value: 3.0
high_value: 3.0
sample_count: 1.0
}
type: QUANTILES
}
}
mean: 2.66666666
std_dev: 1.49071198
num_zeros: 0
min: 1.0
max: 5.0
median: 3.0
histograms {
buckets {
low_value: 1.0
high_value: 2.3333333
sample_count: 2.9866667
}
buckets {
low_value: 2.3333333
high_value: 3.6666667
sample_count: 1.0066667
}
buckets {
low_value: 3.6666667
high_value: 5.0
sample_count: 2.0066667
}
type: STANDARD
}
histograms {
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 1.5
}
buckets {
low_value: 1.0
high_value: 3.0
sample_count: 1.5
}
buckets {
low_value: 3.0
high_value: 4.0
sample_count: 1.5
}
buckets {
low_value: 4.0
high_value: 5.0
sample_count: 1.5
}
type: QUANTILES
}
}
""", statistics_pb2.FeatureNameStatistics()),
'b': text_format.Parse(
"""
name: 'b'
type: STRING
string_stats {
common_stats {
num_non_missing: 3
min_num_values: 1
max_num_values: 4
avg_num_values: 2.33333333
tot_num_values: 7
num_values_histogram {
buckets {
low_value: 1.0
high_value: 2.0
sample_count: 1.0
}
buckets {
low_value: 2.0
high_value: 4.0
sample_count: 1.0
}
buckets {
low_value: 4.0
high_value: 4.0
sample_count: 1.0
}
type: QUANTILES
}
}
avg_length: 1.85714285
}
""", statistics_pb2.FeatureNameStatistics())}
generator = basic_stats_generator.BasicStatsGenerator(
num_values_histogram_buckets=3, num_histogram_buckets=3,
num_quantiles_histogram_buckets=4)
self.assertCombinerOutputEqual(batches, generator, expected_result)
def test_basic_stats_generator_with_individual_feature_value_missing(self):
# input with two batches: first batch has two examples and second batch
# has a single example.
b1 = pa.Table.from_arrays([pa.array([[1.0, 2.0], [3.0, 4.0, np.NaN, 5.0]])],
['a'])
b2 = pa.Table.from_arrays([pa.array([[np.NaN, 1.0]])], ['a'])
batches = [b1, b2]
expected_result = {
'a': text_format.Parse(
"""
name: 'a'
type: FLOAT
num_stats {
common_stats {
num_non_missing: 3
min_num_values: 2
max_num_values: 4
avg_num_values: 2.66666666
tot_num_values: 8
num_values_histogram {
buckets {
low_value: 2.0
high_value: 2.0
sample_count: 1.0
}
buckets {
low_value: 2.0
high_value: 4.0
sample_count: 1.0
}
buckets {
low_value: 4.0
high_value: 4.0
sample_count: 1.0
}
type: QUANTILES
}
}
mean: 2.66666666
std_dev: 1.49071198
num_zeros: 0
min: 1.0
max: 5.0
median: 3.0
histograms {
num_nan: 2
buckets {
low_value: 1.0
high_value: 2.3333333
sample_count: 2.9866667
}
buckets {
low_value: 2.3333333
high_value: 3.6666667
sample_count: 1.0066667
}
buckets {
low_value: 3.6666667
high_value: 5.0
sample_count: 2.0066667
}
type: STANDARD
}
histograms {
num_nan: 2
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 1.5
}
buckets {
low_value: 1.0
high_value: 3.0
sample_count: 1.5
}
buckets {
low_value: 3.0
high_value: 4.0
sample_count: 1.5
}
buckets {
low_value: 4.0
high_value: 5.0
sample_count: 1.5
}
type: QUANTILES
}
}
""", statistics_pb2.FeatureNameStatistics())}
generator = basic_stats_generator.BasicStatsGenerator(
num_values_histogram_buckets=3, num_histogram_buckets=3,
num_quantiles_histogram_buckets=4)
self.assertCombinerOutputEqual(batches, generator, expected_result)
def test_basic_stats_generator_with_multiple_features(self):
b1 = pa.Table.from_arrays([
pa.array([[1.0, 2.0], [3.0, 4.0, 5.0]]),
pa.array([[b'x', b'y', b'z', b'w'], [b'qwe', b'abc']]),
pa.array([
np.linspace(1, 1000, 1000, dtype=np.int32),
np.linspace(1001, 2000, 1000, dtype=np.int32)
]),
], ['a', 'b', 'c'])
b2 = pa.Table.from_arrays([
pa.array([[1.0]]),
pa.array([[b'ab']]),
pa.array([np.linspace(2001, 3000, 1000, dtype=np.int32)]),
], ['a', 'b', 'c'])
batches = [b1, b2]
expected_result = {
'a': text_format.Parse(
"""
name: 'a'
type: FLOAT
num_stats {
common_stats {
num_non_missing: 3
min_num_values: 1
max_num_values: 3
avg_num_values: 2.0
tot_num_values: 6
num_values_histogram {
buckets {
low_value: 1.0
high_value: 2.0
sample_count: 1.0
}
buckets {
low_value: 2.0
high_value: 3.0
sample_count: 1.0
}
buckets {
low_value: 3.0
high_value: 3.0
sample_count: 1.0
}
type: QUANTILES
}
}
mean: 2.66666666
std_dev: 1.49071198
num_zeros: 0
min: 1.0
max: 5.0
median: 3.0
histograms {
buckets {
low_value: 1.0
high_value: 2.3333333
sample_count: 2.9866667
}
buckets {
low_value: 2.3333333
high_value: 3.6666667
sample_count: 1.0066667
}
buckets {
low_value: 3.6666667
high_value: 5.0
sample_count: 2.0066667
}
type: STANDARD
}
histograms {
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 1.5
}
buckets {
low_value: 1.0
high_value: 3.0
sample_count: 1.5
}
buckets {
low_value: 3.0
high_value: 4.0
sample_count: 1.5
}
buckets {
low_value: 4.0
high_value: 5.0
sample_count: 1.5
}
type: QUANTILES
}
}
""", statistics_pb2.FeatureNameStatistics()),
'b': text_format.Parse(
"""
name: 'b'
type: STRING
string_stats {
common_stats {
num_non_missing: 3
min_num_values: 1
max_num_values: 4
avg_num_values: 2.33333333
tot_num_values: 7
num_values_histogram {
buckets {
low_value: 1.0
high_value: 2.0
sample_count: 1.0
}
buckets {
low_value: 2.0
high_value: 4.0
sample_count: 1.0
}
buckets {
low_value: 4.0
high_value: 4.0
sample_count: 1.0
}
type: QUANTILES
}
}
avg_length: 1.71428571
}
""", statistics_pb2.FeatureNameStatistics()),
'c': text_format.Parse(
"""
name: 'c'
type: INT
num_stats {
common_stats {
num_non_missing: 3
min_num_values: 1000
max_num_values: 1000
avg_num_values: 1000.0
tot_num_values: 3000
num_values_histogram {
buckets {
low_value: 1000.0
high_value: 1000.0
sample_count: 1.0
}
buckets {
low_value: 1000.0
high_value: 1000.0
sample_count: 1.0
}
buckets {
low_value: 1000.0
high_value: 1000.0
sample_count: 1.0
}
type: QUANTILES
}
}
mean: 1500.5
std_dev: 866.025355672
min: 1.0
max: 3000.0
median: 1501.0
histograms {
buckets {
low_value: 1.0
high_value: 1000.66666667
sample_count: 999.666666667
}
buckets {
low_value: 1000.66666667
high_value: 2000.33333333
sample_count: 999.666666667
}
buckets {
low_value: 2000.33333333
high_value: 3000.0
sample_count: 1000.66666667
}
type: STANDARD
}
histograms {
buckets {
low_value: 1.0
high_value: 751.0
sample_count: 750.0
}
buckets {
low_value: 751.0
high_value: 1501.0
sample_count: 750.0
}
buckets {
low_value: 1501.0
high_value: 2251.0
sample_count: 750.0
}
buckets {
low_value: 2251.0
high_value: 3000.0
sample_count: 750.0
}
type: QUANTILES
}
}
""", statistics_pb2.FeatureNameStatistics())}
generator = basic_stats_generator.BasicStatsGenerator(
num_values_histogram_buckets=3, num_histogram_buckets=3,
num_quantiles_histogram_buckets=4, epsilon=0.001)
self.assertCombinerOutputEqual(batches, generator, expected_result)
def test_basic_stats_generator_categorical_feature(self):
batches = [
pa.Table.from_arrays([pa.array([[1, 5, 10], [0]])], ['c']),
pa.Table.from_arrays([pa.array([[1, 1, 1, 5, 15], [-1]])], ['c']),
]
expected_result = {
'c': text_format.Parse(
"""
name: "c"
string_stats {
common_stats {
num_non_missing: 4
min_num_values: 1
max_num_values: 5
avg_num_values: 2.5
num_values_histogram {
buckets {
low_value: 1.0
high_value: 1.0
sample_count: 1.3333333
}
buckets {
low_value: 1.0
high_value: 3.0
sample_count: 1.3333333
}
buckets {
low_value: 3.0
high_value: 5.0
sample_count: 1.3333333
}
type: QUANTILES
}
tot_num_values: 10
}
avg_length: 1.29999995232
}
""", statistics_pb2.FeatureNameStatistics())}
schema = text_format.Parse(
"""
feature {
name: "c"
type: INT
int_domain {
is_categorical: true
}
}
""", schema_pb2.Schema())
generator = basic_stats_generator.BasicStatsGenerator(
schema=schema,
num_values_histogram_buckets=3, num_histogram_buckets=3,
num_quantiles_histogram_buckets=4)
self.assertCombinerOutputEqual(batches, generator, expected_result)
def test_basic_stats_generator_empty_batch(self):
batches = [
pa.Table.from_arrays([pa.array([], type=pa.list_(pa.binary()))], ['a'])]
expected_result = {
'a': text_format.Parse(
"""
name: 'a'
type: STRING
string_stats {
common_stats {
num_non_missing: 0
tot_num_values: 0
}
}
""", statistics_pb2.FeatureNameStatistics())}
generator = basic_stats_generator.BasicStatsGenerator()
self.assertCombinerOutputEqual(batches, generator, expected_result)
def test_basic_stats_generator_no_value_in_batch(self):
batches = [
pa.Table.from_arrays([
pa.array([[], [], []], type=pa.list_(pa.int64()))], ['a'])]
expected_result = {
'a': text_format.Parse(
"""
name: "a"
num_stats {
common_stats {
num_non_missing: 3
num_values_histogram {
buckets {
sample_count: 0.3
}
buckets {
sample_count: 0.3
}
buckets {
sample_count: 0.3
}
buckets {
sample_count: 0.3
}
buckets {
sample_count: 0.3
}
buckets {
sample_count: 0.3
}
buckets {
sample_count: 0.3
}
buckets {
sample_count: 0.3
}
buckets {
sample_count: 0.3
}
buckets {
sample_count: 0.3
}
type: QUANTILES
}
}
}""", statistics_pb2.FeatureNameStatistics())}
generator = basic_stats_generator.BasicStatsGenerator()
self.assertCombinerOutputEqual(batches, generator, expected_result)
def test_basic_stats_generator_column_not_list(self):
batches = [pa.Table.from_arrays([pa.array([1, 2, 3])], ['a'])]
generator = basic_stats_generator.BasicStatsGenerator()
with self.assertRaisesRegexp(TypeError,
'Expected feature column to be a List'):
self.assertCombinerOutputEqual(batches, generator, None)
def test_basic_stats_generator_invalid_value_numpy_dtype(self):
batches = [pa.Table.from_arrays(
[pa.array([[]], type=pa.list_(pa.date32()))], ['a'])]
generator = basic_stats_generator.BasicStatsGenerator()
with self.assertRaisesRegexp(
TypeError, 'Feature a has unsupported arrow type'):
self.assertCombinerOutputEqual(batches, generator, None)
def test_basic_stats_generator_feature_with_different_types(self):
batches = [
pa.Table.from_arrays([pa.array([[1.0, 2.0], [3.0, 4.0, 5.0]])], ['a']),
pa.Table.from_arrays([pa.array([[1]])], ['a']),
]
generator = basic_stats_generator.BasicStatsGenerator()
with self.assertRaisesRegexp(TypeError, 'Cannot determine the type'):
self.assertCombinerOutputEqual(batches, generator, None)
if __name__ == '__main__':
absltest.main()
| 32.198505 | 82 | 0.408698 | 3,586 | 38,767 | 4.172058 | 0.076687 | 0.094111 | 0.118308 | 0.043446 | 0.831362 | 0.81044 | 0.789854 | 0.767796 | 0.755297 | 0.731235 | 0 | 0.105801 | 0.517992 | 38,767 | 1,203 | 83 | 32.22527 | 0.694852 | 0.029303 | 0 | 0.508108 | 0 | 0 | 0.020213 | 0 | 0 | 0 | 0 | 0 | 0.086486 | 1 | 0.07027 | false | 0 | 0.059459 | 0 | 0.135135 | 0.005405 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
94ddcd30304737bbb7e951d4ccf9d51f4f7607f8 | 12,651 | py | Python | huxley/api/tests/test_rubric.py | srisainachuri/huxley | 7166a1423e49b506d6d5f142c748eac4e5d2314c | [
"BSD-3-Clause"
] | 18 | 2015-07-12T00:55:51.000Z | 2021-12-13T15:41:06.000Z | huxley/api/tests/test_rubric.py | srisainachuri/huxley | 7166a1423e49b506d6d5f142c748eac4e5d2314c | [
"BSD-3-Clause"
] | 288 | 2015-01-13T23:05:09.000Z | 2022-03-25T17:35:36.000Z | huxley/api/tests/test_rubric.py | srisainachuri/huxley | 7166a1423e49b506d6d5f142c748eac4e5d2314c | [
"BSD-3-Clause"
] | 47 | 2015-05-12T15:39:57.000Z | 2022-03-30T09:12:48.000Z | # Copyright (c) 2011-2017 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
from django.core.exceptions import ValidationError
from huxley.accounts.models import User
from huxley.api import tests
from huxley.api.tests import auto
from huxley.utils.test import models
class RubricDetailGetTestCase(auto.RetrieveAPIAutoTestCase):
url_name = 'api:rubric_detail'
@classmethod
def get_test_object(cls):
return models.new_rubric()
def test_anonymous_user(self):
self.do_test()
def test_advisor(self):
user = models.new_user()
self.as_user(user).do_test()
def test_chair(self):
chair1 = models.new_user(user_type=User.TYPE_CHAIR)
self.as_user(chair1).do_test()
c = models.new_committee(rubric_id=self.object.id)
chair2 = models.new_user(user_type=User.TYPE_CHAIR, committee=c)
self.as_user(chair2).do_test()
def test_delegate(self):
delegate_user = models.new_user(user_type=User.TYPE_DELEGATE)
self.as_user(delegate_user).do_test()
def test_superuser(self):
self.as_superuser().do_test()
class RubricPutTestCase(tests.UpdateAPITestCase):
url_name = 'api:rubric_detail'
params = {
'grade_category_1': 'Overall Quality',
'grade_value_1': 5,
}
def setUp(self):
self.advisor = models.new_user(username='advisor', password='advisor')
self.chair = models.new_user(
username='chair', password='chair', user_type=User.TYPE_CHAIR)
self.delegate_user = models.new_user(
username='delegate',
password='delegate',
user_type=User.TYPE_DELEGATE)
self.delegate_user_2 = models.new_user(
username='delegate_2',
password='delegate',
user_type=User.TYPE_DELEGATE)
self.school = models.new_school(user=self.advisor)
self.registration = models.new_registration(school=self.school)
self.rubric = models.new_rubric()
self.committee = models.new_committee(
user=self.chair, rubric=self.rubric)
self.paper = models.new_position_paper()
self.assignment = models.new_assignment(
registration=self.registration,
committee=self.committee,
paper=self.paper)
self.delegate = models.new_delegate(
user=self.delegate_user,
assignment=self.assignment,
school=self.school)
def test_anonymous_user(self):
'''Unauthenticated users shouldn't be able to update rubrics.'''
response = self.get_response(self.rubric.id, params=self.params)
self.assertNotAuthenticated(response)
def test_advisor(self):
'''Advisors shouldn't be able to update rubrics.'''
self.client.login(username='advisor', password='advisor')
response = self.get_response(self.rubric.id, params=self.params)
self.assertPermissionDenied(response)
def test_chair(self):
'''It should return correct data.'''
self.client.login(username='chair', password='chair')
response = self.get_response(self.rubric.id, params=self.params)
self.assertEqual(response.data, {
"id": self.paper.id,
"grade_category_1": self.params['grade_category_1'],
"grade_value_1": self.params['grade_value_1'],
"grade_category_2": self.rubric.grade_category_2,
"grade_value_2": self.rubric.grade_value_2,
"grade_category_3": self.rubric.grade_category_3,
"grade_value_3": self.rubric.grade_value_3,
"grade_category_4": self.rubric.grade_category_4,
"grade_value_4": self.rubric.grade_value_4,
"grade_category_5": self.rubric.grade_category_5,
"grade_value_5": self.rubric.grade_value_5,
"grade_t2_category_1": self.rubric.grade_t2_category_2,
"grade_t2_value_1": self.rubric.grade_t2_value_2,
"grade_t2_category_2": self.rubric.grade_category_2,
"grade_t2_value_2": self.rubric.grade_value_2,
"grade_t2_category_3": self.rubric.grade_category_3,
"grade_t2_value_3": self.rubric.grade_value_3,
"grade_t2_category_4": self.rubric.grade_category_4,
"grade_t2_value_4": self.rubric.grade_value_4,
"grade_t2_category_5": self.rubric.grade_category_5,
"grade_t2_value_5": self.rubric.grade_value_5,
"use_topic_2": self.rubric.use_topic_2,
"topic_one": self.rubric.topic_one,
"topic_two": self.rubric.topic_two,
})
def test_delegate(self):
'''Delegates should be unable to update rubrics.'''
self.client.login(username='delegate', password='delegate')
response = self.get_response(self.rubric.id, params=self.params)
self.assertPermissionDenied(response)
self.client.login(username='delegate_2', password='delegate')
response = self.get_response(self.rubric.id, params=self.params)
self.assertPermissionDenied(response)
def test_superuser(self):
'''It should return correct data.'''
superuser = models.new_superuser(username='s_user', password='s_user')
self.client.login(username='s_user', password='s_user')
response = self.get_response(self.rubric.id, params=self.params)
self.assertEqual(response.data, {
"id": self.paper.id,
"grade_category_1": self.params['grade_category_1'],
"grade_value_1": self.params['grade_value_1'],
"grade_category_2": self.rubric.grade_category_2,
"grade_value_2": self.rubric.grade_value_2,
"grade_category_3": self.rubric.grade_category_3,
"grade_value_3": self.rubric.grade_value_3,
"grade_category_4": self.rubric.grade_category_4,
"grade_value_4": self.rubric.grade_value_4,
"grade_category_5": self.rubric.grade_category_5,
"grade_value_5": self.rubric.grade_value_5,
"grade_t2_category_1": self.rubric.grade_t2_category_2,
"grade_t2_value_1": self.rubric.grade_t2_value_2,
"grade_t2_category_2": self.rubric.grade_category_2,
"grade_t2_value_2": self.rubric.grade_value_2,
"grade_t2_category_3": self.rubric.grade_category_3,
"grade_t2_value_3": self.rubric.grade_value_3,
"grade_t2_category_4": self.rubric.grade_category_4,
"grade_t2_value_4": self.rubric.grade_value_4,
"grade_t2_category_5": self.rubric.grade_category_5,
"grade_t2_value_5": self.rubric.grade_value_5,
"use_topic_2": self.rubric.use_topic_2,
"topic_one": self.rubric.topic_one,
"topic_two": self.rubric.topic_two,
})
class RubricDetailPatchTestCase(tests.PartialUpdateAPITestCase):
url_name = 'api:rubric_detail'
params = {
'grade_category_1': 'Overall Quality',
'grade_value_1': 5,
}
def setUp(self):
self.advisor = models.new_user(username='advisor', password='advisor')
self.chair = models.new_user(
username='chair', password='chair', user_type=User.TYPE_CHAIR)
self.delegate_user = models.new_user(
username='delegate',
password='delegate',
user_type=User.TYPE_DELEGATE)
self.delegate_user_2 = models.new_user(
username='delegate_2',
password='delegate',
user_type=User.TYPE_DELEGATE)
self.school = models.new_school(user=self.advisor)
self.registration = models.new_registration(school=self.school)
self.rubric = models.new_rubric()
self.committee = models.new_committee(
user=self.chair, rubric=self.rubric)
self.paper = models.new_position_paper()
self.assignment = models.new_assignment(
registration=self.registration,
committee=self.committee,
paper=self.paper)
self.delegate = models.new_delegate(
user=self.delegate_user,
assignment=self.assignment,
school=self.school)
def test_anonymous_user(self):
'''Unauthenticated users shouldn't be able to update rubrics.'''
response = self.get_response(self.rubric.id, params=self.params)
self.assertNotAuthenticated(response)
def test_advisor(self):
'''Advisors shouldn't be able to update rubrics.'''
self.client.login(username='advisor', password='advisor')
response = self.get_response(self.rubric.id, params=self.params)
self.assertPermissionDenied(response)
def test_chair(self):
'''It should return correct data.'''
self.client.login(username='chair', password='chair')
response = self.get_response(self.rubric.id, params=self.params)
self.assertEqual(response.data, {
"id": self.paper.id,
"grade_category_1": self.params['grade_category_1'],
"grade_value_1": self.params['grade_value_1'],
"grade_category_2": self.rubric.grade_category_2,
"grade_value_2": self.rubric.grade_value_2,
"grade_category_3": self.rubric.grade_category_3,
"grade_value_3": self.rubric.grade_value_3,
"grade_category_4": self.rubric.grade_category_4,
"grade_value_4": self.rubric.grade_value_4,
"grade_category_5": self.rubric.grade_category_5,
"grade_value_5": self.rubric.grade_value_5,
"grade_t2_category_1": self.rubric.grade_t2_category_2,
"grade_t2_value_1": self.rubric.grade_t2_value_2,
"grade_t2_category_2": self.rubric.grade_category_2,
"grade_t2_value_2": self.rubric.grade_value_2,
"grade_t2_category_3": self.rubric.grade_category_3,
"grade_t2_value_3": self.rubric.grade_value_3,
"grade_t2_category_4": self.rubric.grade_category_4,
"grade_t2_value_4": self.rubric.grade_value_4,
"grade_t2_category_5": self.rubric.grade_category_5,
"grade_t2_value_5": self.rubric.grade_value_5,
"use_topic_2": self.rubric.use_topic_2,
"topic_one": self.rubric.topic_one,
"topic_two": self.rubric.topic_two,
})
def test_delegate(self):
'''Delegates should be unable to update rubrics.'''
self.client.login(username='delegate', password='delegate')
response = self.get_response(self.rubric.id, params=self.params)
self.assertPermissionDenied(response)
self.client.login(username='delegate_2', password='delegate')
response = self.get_response(self.rubric.id, params=self.params)
self.assertPermissionDenied(response)
def test_superuser(self):
'''It should return correct data.'''
superuser = models.new_superuser(username='s_user', password='s_user')
self.client.login(username='s_user', password='s_user')
response = self.get_response(self.rubric.id, params=self.params)
self.assertEqual(response.data, {
"id": self.paper.id,
"grade_category_1": self.params['grade_category_1'],
"grade_value_1": self.params['grade_value_1'],
"grade_category_2": self.rubric.grade_category_2,
"grade_value_2": self.rubric.grade_value_2,
"grade_category_3": self.rubric.grade_category_3,
"grade_value_3": self.rubric.grade_value_3,
"grade_category_4": self.rubric.grade_category_4,
"grade_value_4": self.rubric.grade_value_4,
"grade_category_5": self.rubric.grade_category_5,
"grade_value_5": self.rubric.grade_value_5,
"grade_t2_category_1": self.rubric.grade_t2_category_2,
"grade_t2_value_1": self.rubric.grade_t2_value_2,
"grade_t2_category_2": self.rubric.grade_category_2,
"grade_t2_value_2": self.rubric.grade_value_2,
"grade_t2_category_3": self.rubric.grade_category_3,
"grade_t2_value_3": self.rubric.grade_value_3,
"grade_t2_category_4": self.rubric.grade_category_4,
"grade_t2_value_4": self.rubric.grade_value_4,
"grade_t2_category_5": self.rubric.grade_category_5,
"grade_t2_value_5": self.rubric.grade_value_5,
"use_topic_2": self.rubric.use_topic_2,
"topic_one": self.rubric.topic_one,
"topic_two": self.rubric.topic_two,
})
| 45.67148 | 78 | 0.659474 | 1,607 | 12,651 | 4.861854 | 0.071562 | 0.127992 | 0.138231 | 0.094202 | 0.90887 | 0.89863 | 0.894535 | 0.890823 | 0.88212 | 0.88212 | 0 | 0.024656 | 0.230575 | 12,651 | 276 | 79 | 45.836957 | 0.777995 | 0.045056 | 0 | 0.898305 | 0 | 0 | 0.161194 | 0 | 0 | 0 | 0 | 0 | 0.050847 | 1 | 0.076271 | false | 0.084746 | 0.021186 | 0.004237 | 0.135593 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 8 |
a20aecbb26adb3304e6f8f5c8db5c80737d73800 | 1,837 | py | Python | OSESMO/OSESMO Python/Import_PGE_Time_Constraint_Binary_Data.py | nickolasclarke/dataJungle | 1b388ecd7d56c770ea7d56c1c6757d39132f2c68 | [
"MIT"
] | 1 | 2019-11-19T22:32:36.000Z | 2019-11-19T22:32:36.000Z | OSESMO/OSESMO Python/Import_PGE_Time_Constraint_Binary_Data.py | nickolasclarke/dataJungle | 1b388ecd7d56c770ea7d56c1c6757d39132f2c68 | [
"MIT"
] | 9 | 2019-12-04T06:19:21.000Z | 2019-12-16T05:05:51.000Z | OSESMO/OSESMO Python/Import_PGE_Time_Constraint_Binary_Data.py | nickolasclarke/dataJungle | 1b388ecd7d56c770ea7d56c1c6757d39132f2c68 | [
"MIT"
] | 2 | 2019-11-19T22:32:29.000Z | 2019-11-19T22:32:46.000Z | def Import_PGE_Time_Constraint_Binary_Data(Input_Output_Data_Directory_Location=None, OSESMO_Git_Repo_Directory=None, delta_t=None):
# Load Python Packages
import os
import numpy as np
# Set Directory to Box Sync Folder
os.chdir(Input_Output_Data_Directory_Location)
if delta_t == (5 / 60):
PGE_Charge_Hour_Binary_Data = np.genfromtxt(
'Emissions Data/PG&E-Proposed Charge-Discharge Constraint/2017/5-Minute Data/Vector Format/2017_PGE_Charge_Hour_Flag_Vector.csv', delimiter=',')
PGE_No_Charge_Hour_Binary_Data = np.genfromtxt(
'Emissions Data/PG&E-Proposed Charge-Discharge Constraint/2017/5-Minute Data/Vector Format/2017_PGE_No_Charge_Hour_Flag_Vector.csv', delimiter=',')
PGE_Discharge_Hour_Binary_Data = np.genfromtxt(
'Emissions Data/PG&E-Proposed Charge-Discharge Constraint/2017/5-Minute Data/Vector Format/2017_PGE_Discharge_Hour_Flag_Vector.csv', delimiter=',')
elif delta_t == (15 / 60):
PGE_Charge_Hour_Binary_Data = np.genfromtxt(
'Emissions Data/PG&E-Proposed Charge-Discharge Constraint/2017/15-Minute Data/Vector Format/2017_PGE_Charge_Hour_Flag_Vector.csv', delimiter=',')
PGE_No_Charge_Hour_Binary_Data = np.genfromtxt(
'Emissions Data/PG&E-Proposed Charge-Discharge Constraint/2017/15-Minute Data/Vector Format/2017_PGE_No_Charge_Hour_Flag_Vector.csv', delimiter=',')
PGE_Discharge_Hour_Binary_Data = np.genfromtxt(
'Emissions Data/PG&E-Proposed Charge-Discharge Constraint/2017/15-Minute Data/Vector Format/2017_PGE_Discharge_Hour_Flag_Vector.csv', delimiter=',')
# Return to OSESMO Git Repository Directory
os.chdir(OSESMO_Git_Repo_Directory)
return PGE_Charge_Hour_Binary_Data, PGE_No_Charge_Hour_Binary_Data, PGE_Discharge_Hour_Binary_Data | 49.648649 | 160 | 0.762657 | 260 | 1,837 | 5.030769 | 0.203846 | 0.076453 | 0.09633 | 0.091743 | 0.81422 | 0.727829 | 0.708716 | 0.708716 | 0.708716 | 0.708716 | 0 | 0.041078 | 0.151878 | 1,837 | 37 | 161 | 49.648649 | 0.79846 | 0.051715 | 0 | 0.3 | 0 | 0.3 | 0.446809 | 0.239793 | 0 | 0 | 0 | 0 | 0 | 1 | 0.05 | false | 0 | 0.15 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
bf6563e0ee7d76dd6b83d8297eaf85c41151d7f4 | 161,235 | py | Python | lang/python/github/com/metaprov/modelaapi/pkg/apis/inference/v1alpha1/generated_pb2.py | metaprov/modeldapi | ee05693832051dcd990ee4f061715d7ae0787340 | [
"Apache-2.0"
] | null | null | null | lang/python/github/com/metaprov/modelaapi/pkg/apis/inference/v1alpha1/generated_pb2.py | metaprov/modeldapi | ee05693832051dcd990ee4f061715d7ae0787340 | [
"Apache-2.0"
] | null | null | null | lang/python/github/com/metaprov/modelaapi/pkg/apis/inference/v1alpha1/generated_pb2.py | metaprov/modeldapi | ee05693832051dcd990ee4f061715d7ae0787340 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: github.com/metaprov/modelaapi/pkg/apis/inference/v1alpha1/generated.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from github.com.metaprov.modelaapi.pkg.apis.catalog.v1alpha1 import generated_pb2 as github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_catalog_dot_v1alpha1_dot_generated__pb2
from github.com.metaprov.modelaapi.pkg.apis.data.v1alpha1 import generated_pb2 as github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_data_dot_v1alpha1_dot_generated__pb2
from github.com.metaprov.modelaapi.pkg.apis.training.v1alpha1 import generated_pb2 as github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_training_dot_v1alpha1_dot_generated__pb2
from k8s.io.api.core.v1 import generated_pb2 as k8s_dot_io_dot_api_dot_core_dot_v1_dot_generated__pb2
from k8s.io.apimachinery.pkg.apis.meta.v1 import generated_pb2 as k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2
from k8s.io.apimachinery.pkg.runtime import generated_pb2 as k8s_dot_io_dot_apimachinery_dot_pkg_dot_runtime_dot_generated__pb2
from k8s.io.apimachinery.pkg.runtime.schema import generated_pb2 as k8s_dot_io_dot_apimachinery_dot_pkg_dot_runtime_dot_schema_dot_generated__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='github.com/metaprov/modelaapi/pkg/apis/inference/v1alpha1/generated.proto',
package='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1',
syntax='proto2',
serialized_options=b'Z9github.com/metaprov/modelaapi/pkg/apis/inference/v1alpha1',
create_key=_descriptor._internal_create_key,
serialized_pb=b'\nIgithub.com/metaprov/modelaapi/pkg/apis/inference/v1alpha1/generated.proto\x12\x39github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1\x1aGgithub.com/metaprov/modelaapi/pkg/apis/catalog/v1alpha1/generated.proto\x1a\x44github.com/metaprov/modelaapi/pkg/apis/data/v1alpha1/generated.proto\x1aHgithub.com/metaprov/modelaapi/pkg/apis/training/v1alpha1/generated.proto\x1a\"k8s.io/api/core/v1/generated.proto\x1a\x34k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto\x1a/k8s.io/apimachinery/pkg/runtime/generated.proto\x1a\x36k8s.io/apimachinery/pkg/runtime/schema/generated.proto\"(\n\x07\x41ppSpec\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x0c\n\x04port\x18\x02 \x01(\x05\"\x1c\n\tAppStatus\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\"~\n\x0b\x41utoScaling\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x13\n\x0bminReplicas\x18\x02 \x01(\x05\x12\x13\n\x0bmaxReplicas\x18\x03 \x01(\x05\x12\x19\n\x11\x63puAvgUtilization\x18\x04 \x01(\x05\x12\x19\n\x11memAvgUtilization\x18\x05 \x01(\x05\"\x92\x02\n\x0e\x43ronPrediction\x12\x42\n\x08metadata\x18\x01 \x01(\x0b\x32\x30.k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta\x12[\n\x04spec\x18\x02 \x01(\x0b\x32M.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionSpec\x12_\n\x06status\x18\x03 \x01(\x0b\x32O.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionStatus\"\xa0\x01\n\x17\x43ronPredictionCondition\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0e\n\x06status\x18\x02 \x01(\t\x12\x46\n\x12lastTransitionTime\x18\x03 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12\x0e\n\x06reason\x18\x04 \x01(\t\x12\x0f\n\x07message\x18\x05 \x01(\t\"\xb0\x01\n\x12\x43ronPredictionList\x12@\n\x08metadata\x18\x01 \x01(\x0b\x32..k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta\x12X\n\x05items\x18\x02 \x03(\x0b\x32I.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPrediction\"\xf4\x02\n\x12\x43ronPredictionSpec\x12\x13\n\x0bversionName\x18\x01 \x01(\t\x12\r\n\x05owner\x18\x02 \x01(\t\x12V\n\x08schedule\x18\x03 \x01(\x0b\x32\x44.github.com.metaprov.modelaapi.pkg.apis.catalog.v1alpha1.RunSchedule\x12_\n\x08template\x18\x04 \x01(\x0b\x32M.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionTemplate\x12\x10\n\x08priority\x18\x05 \x01(\t\x12\x0e\n\x06paused\x18\x06 \x01(\x08\x12_\n\x0cnotification\x18\x07 \x01(\x0b\x32I.github.com.metaprov.modelaapi.pkg.apis.catalog.v1alpha1.NotificationSpec\"\x98\x02\n\x14\x43ronPredictionStatus\x12;\n\x07lastRun\x18\x01 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12?\n\x0blastUpdated\x18\x02 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12\x1a\n\x12observedGeneration\x18\x03 \x01(\x03\x12\x66\n\nconditions\x18\x04 \x03(\x0b\x32R.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionCondition\"\xfd\x01\n\x07\x43urtain\x12\x42\n\x08metadata\x18\x01 \x01(\x0b\x32\x30.k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta\x12T\n\x04spec\x18\x02 \x01(\x0b\x32\x46.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainSpec\x12X\n\x06status\x18\x03 \x01(\x0b\x32H.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainStatus\"\x99\x01\n\x10\x43urtainCondition\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0e\n\x06status\x18\x02 \x01(\t\x12\x46\n\x12lastTransitionTime\x18\x03 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12\x0e\n\x06reason\x18\x04 \x01(\t\x12\x0f\n\x07message\x18\x05 \x01(\t\"\xa2\x01\n\x0b\x43urtainList\x12@\n\x08metadata\x18\x01 \x01(\x0b\x32..k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta\x12Q\n\x05items\x18\x02 \x03(\x0b\x32\x42.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Curtain\"\x9c\x01\n\x0b\x43urtainSpec\x12\x13\n\x0b\x64\x65scription\x18\x01 \x01(\t\x12\x13\n\x0bversionName\x18\x02 \x01(\t\x12\x17\n\x0fservingsiteName\x18\x03 \x01(\t\x12\x13\n\x0b\x64\x61tasetName\x18\x04 \x01(\t\x12\x10\n\x08question\x18\x06 \x01(\t\x12\x14\n\x0cnotifierName\x18\x07 \x01(\t\x12\r\n\x05owner\x18\x08 \x01(\t\"\xcd\x01\n\rCurtainStatus\x12\x1a\n\x12observedGeneration\x18\x01 \x01(\x03\x12?\n\x0blastUpdated\x18\x02 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12_\n\nconditions\x18\x03 \x03(\x0b\x32K.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainCondition\"\xaf\x01\n\x13\x43urtainTemplateSpec\x12\x42\n\x08metadata\x18\x01 \x01(\x0b\x32\x30.k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta\x12T\n\x04spec\x18\x02 \x01(\x0b\x32\x46.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainSpec\"|\n\rCustomAppSpec\x12\r\n\x05owner\x18\x01 \x01(\x08\x12\r\n\x05title\x18\x02 \x01(\t\x12M\n\x05pages\x18\x03 \x03(\x0b\x32>.github.com.metaprov.modelaapi.pkg.apis.data.v1alpha1.PageSpec\"\xfd\x01\n\x07\x44\x61taApp\x12\x42\n\x08metadata\x18\x01 \x01(\x0b\x32\x30.k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta\x12T\n\x04spec\x18\x02 \x01(\x0b\x32\x46.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec\x12X\n\x06status\x18\x03 \x01(\x0b\x32H.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppStatus\"\x99\x01\n\x10\x44\x61taAppCondition\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0e\n\x06status\x18\x02 \x01(\t\x12\x46\n\x12lastTransitionTime\x18\x07 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12\x0e\n\x06reason\x18\x04 \x01(\t\x12\x0f\n\x07message\x18\x05 \x01(\t\"\xa2\x01\n\x0b\x44\x61taAppList\x12@\n\x08metadata\x18\x01 \x01(\x0b\x32..k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta\x12Q\n\x05items\x18\x02 \x03(\x0b\x32\x42.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataApp\"\x86\x03\n\x0b\x44\x61taAppSpec\x12\r\n\x05owner\x18\x01 \x01(\t\x12\x13\n\x0bversionName\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x0c\n\x04path\x18\x04 \x01(\t\x12\x11\n\tmodelName\x18\x05 \x01(\t\x12\x10\n\x08replicas\x18\x07 \x01(\x05\x12\x0c\n\x04port\x18\x08 \x01(\x05\x12\x19\n\x11workloadClassName\x18\t \x01(\t\x12\x12\n\naccessType\x18\n \x01(\t\x12\x37\n\nproductRef\x18\x0b \x01(\x0b\x32#.k8s.io.api.core.v1.ObjectReference\x12;\n\x0eservingsiteRef\x18\x0c \x01(\x0b\x32#.k8s.io.api.core.v1.ObjectReference\x12X\n\x06\x63ustom\x18\r \x01(\x0b\x32H.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CustomAppSpec\"\xcd\x01\n\rDataAppStatus\x12\x1a\n\x12observedGeneration\x18\x01 \x01(\x03\x12?\n\x0blastUpdated\x18\x02 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12_\n\nconditions\x18\x03 \x03(\x0b\x32K.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppCondition\"\x94\x02\n\x0c\x46orecastSpec\x12u\n\x0fhierarchyValues\x18\x01 \x03(\x0b\x32\\.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ForecastSpec.HierarchyValuesEntry\x12U\n\x07horizon\x18\x02 \x01(\x0b\x32\x44.github.com.metaprov.modelaapi.pkg.apis.training.v1alpha1.PeriodSpec\x1a\x36\n\x14HierarchyValuesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"\xe1\x01\n\x0bModelRecord\x12\x11\n\tmodelName\x18\x01 \x01(\t\x12\x14\n\x0cmodelVersion\x18\x02 \x01(\t\x12:\n\x06liveAt\x18\x03 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12=\n\tretiredAt\x18\x04 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12\x1a\n\x12\x61vgDailyPrediction\x18\x05 \x01(\x05\x12\x12\n\navgLatency\x18\x06 \x01(\x01\"\xae\x02\n\x0bMonitorSpec\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\x12\x15\n\rsamplePrecent\x18\x02 \x01(\x05\x12V\n\x08schedule\x18\x03 \x01(\x0b\x32\x44.github.com.metaprov.modelaapi.pkg.apis.catalog.v1alpha1.RunSchedule\x12\x14\n\x0cnotifierName\x18\x04 \x01(\t\x12^\n\x0bvalidations\x18\x05 \x03(\x0b\x32I.github.com.metaprov.modelaapi.pkg.apis.training.v1alpha1.ModelValidation\x12\x13\n\x0blogRequests\x18\x06 \x01(\x08\x12\x14\n\x0clogResponses\x18\x07 \x01(\x08\"\xbf\x01\n\rMonitorStatus\x12\x42\n\x0elastPrediction\x18\x01 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12j\n\x11validationResults\x18\x02 \x03(\x0b\x32O.github.com.metaprov.modelaapi.pkg.apis.training.v1alpha1.ModelValidationResult\"=\n\x16OnlineFeaturestoreSpec\x12\x0e\n\x06\x61\x63tive\x18\x01 \x01(\x08\x12\x13\n\x0bserviceName\x18\x02 \x01(\t\"\x86\x02\n\nPrediction\x12\x42\n\x08metadata\x18\x01 \x01(\x0b\x32\x30.k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta\x12W\n\x04spec\x18\x02 \x01(\x0b\x32I.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec\x12[\n\x06status\x18\x03 \x01(\x0b\x32K.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus\":\n\x13PredictionCacheSpec\x12\x0e\n\x06\x61\x63tive\x18\x01 \x01(\x08\x12\x13\n\x0bserviceName\x18\x02 \x01(\t\"\x9c\x01\n\x13PredictionCondition\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0e\n\x06status\x18\x02 \x01(\t\x12\x46\n\x12lastTransitionTime\x18\x03 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12\x0e\n\x06reason\x18\x04 \x01(\t\x12\x0f\n\x07message\x18\x05 \x01(\t\"\xa8\x01\n\x0ePredictionList\x12@\n\x08metadata\x18\x01 \x01(\x0b\x32..k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta\x12T\n\x05items\x18\x02 \x03(\x0b\x32\x45.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Prediction\"\x84\x04\n\x0ePredictionSpec\x12\x13\n\x0bversionName\x18\x01 \x01(\t\x12\x15\n\rpredictorName\x18\x02 \x01(\t\x12\x0f\n\x07labeled\x18\x03 \x01(\x08\x12\x10\n\x08\x66orecast\x18\x04 \x01(\x08\x12\x13\n\x0b\x64\x61tasetName\x18\x05 \x01(\t\x12Q\n\x05input\x18\x06 \x01(\x0b\x32\x42.github.com.metaprov.modelaapi.pkg.apis.data.v1alpha1.DataLocation\x12T\n\x06output\x18\x07 \x01(\x0b\x32\x44.github.com.metaprov.modelaapi.pkg.apis.data.v1alpha1.DataOutputSpec\x12\r\n\x05tests\x18\x08 \x03(\t\x12\r\n\x05owner\x18\t \x01(\t\x12\x19\n\x11workloadClassName\x18\n \x01(\t\x12\x1d\n\x15\x61\x63tiveDeadlineSeconds\x18\x0b \x01(\x03\x12\x10\n\x08priority\x18\x0c \x01(\t\x12\x0f\n\x07\x61\x62orted\x18\r \x01(\x08\x12\x0b\n\x03ttl\x18\x0e \x01(\x05\x12]\n\x0c\x66orecastInfo\x18\x0f \x01(\x0b\x32G.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ForecastSpec\"\xa5\x04\n\x10PredictionStatus\x12=\n\tstartTime\x18\x01 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12;\n\x07\x65ndTime\x18\x02 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12\r\n\x05phase\x18\x03 \x01(\t\x12U\n\x07results\x18\x04 \x03(\x0b\x32\x44.github.com.metaprov.modelaapi.pkg.apis.catalog.v1alpha1.Measurement\x12\x1a\n\x12observedGeneration\x18\x05 \x01(\x03\x12\x0c\n\x04rows\x18\x06 \x01(\x05\x12\x13\n\x0btriggeredBy\x18\x07 \x01(\t\x12K\n\x04logs\x18\x08 \x01(\x0b\x32=.github.com.metaprov.modelaapi.pkg.apis.catalog.v1alpha1.Logs\x12?\n\x0blastUpdated\x18\t \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12\x62\n\nconditions\x18\n \x03(\x0b\x32N.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCondition\"m\n\x12PredictionTemplate\x12W\n\x04spec\x18\x01 \x01(\x0b\x32I.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec\"\x83\x02\n\tPredictor\x12\x42\n\x08metadata\x18\x01 \x01(\x0b\x32\x30.k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta\x12V\n\x04spec\x18\x02 \x01(\x0b\x32H.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec\x12Z\n\x06status\x18\x03 \x01(\x0b\x32J.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus\"$\n\x11PredictorAuthSpec\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08\"\x9b\x01\n\x12PredictorCondition\x12\x0c\n\x04type\x18\x01 \x01(\t\x12\x0e\n\x06status\x18\x02 \x01(\t\x12\x46\n\x12lastTransitionTime\x18\x03 \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12\x0e\n\x06reason\x18\x04 \x01(\t\x12\x0f\n\x07message\x18\x05 \x01(\t\"\xc6\x01\n\x0fPredictorHealth\x12\x0f\n\x07service\x18\x01 \x01(\x08\x12\x11\n\tdataDrift\x18\x02 \x01(\x08\x12\x14\n\x0c\x63onceptDrift\x18\x03 \x01(\x08\x12\x18\n\x10totalPredictions\x18\x04 \x01(\x05\x12\x0b\n\x03\x61vg\x18\x05 \x01(\x05\x12\x18\n\x10totalP95Requests\x18\x06 \x01(\x05\x12\x1a\n\x12medianResponseTime\x18\x07 \x01(\x05\x12\x1c\n\x14lastDailyPredictions\x18\x08 \x03(\x05\"\xa6\x01\n\rPredictorList\x12@\n\x08metadata\x18\x01 \x01(\x0b\x32..k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta\x12S\n\x05items\x18\x02 \x03(\x0b\x32\x44.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Predictor\"\xb4\t\n\rPredictorSpec\x12\x13\n\x0bversionName\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x37\n\nproductRef\x18\x03 \x01(\x0b\x32#.k8s.io.api.core.v1.ObjectReference\x12;\n\x0eservingsiteRef\x18\x04 \x01(\x0b\x32#.k8s.io.api.core.v1.ObjectReference\x12\x31\n\x08template\x18\x05 \x01(\x0b\x32\x1f.k8s.io.api.core.v1.PodTemplate\x12\\\n\x06models\x18\x06 \x03(\x0b\x32L.github.com.metaprov.modelaapi.pkg.apis.catalog.v1alpha1.ModelDeploymentSpec\x12_\n\x0bprogressive\x18\x07 \x01(\x0b\x32J.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ProgressiveSpec\x12\x17\n\x0f\x61rtifactsFolder\x18\x08 \x01(\t\x12\x0c\n\x04port\x18\t \x01(\x05\x12\x0c\n\x04path\x18\n \x01(\t\x12\x12\n\naccessType\x18\x0b \x01(\t\x12\x10\n\x08replicas\x18\x0c \x01(\x05\x12[\n\x0b\x61utoScaling\x18\r \x01(\x0b\x32\x46.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AutoScaling\x12\r\n\x05owner\x18\x0e \x01(\t\x12\x19\n\x11workloadClassName\x18\x0f \x01(\t\x12]\n\x05\x63\x61\x63he\x18\x10 \x01(\x0b\x32N.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCacheSpec\x12`\n\x05store\x18\x11 \x01(\x0b\x32Q.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.OnlineFeaturestoreSpec\x12\x17\n\x0f\x66orewardCurtain\x18\x12 \x01(\t\x12\x17\n\x0f\x62\x61\x63kwardCurtain\x18\x13 \x01(\t\x12\x0c\n\x04type\x18\x14 \x01(\t\x12\x0c\n\x04task\x18\x15 \x01(\t\x12\x1a\n\x12predictionTreshold\x18\x16 \x01(\x01\x12W\n\x07monitor\x18\x17 \x01(\x0b\x32\x46.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorSpec\x12O\n\x03\x61pp\x18\x18 \x01(\x0b\x32\x42.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AppSpec\x12Z\n\x04\x61uth\x18\x19 \x01(\x0b\x32L.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorAuthSpec\"\x80\x07\n\x0fPredictorStatus\x12\x63\n\x0bmodelStatus\x18\x01 \x03(\x0b\x32N.github.com.metaprov.modelaapi.pkg.apis.catalog.v1alpha1.ModelDeploymentStatus\x12M\n\x14monitorLastAttemptAt\x18\x03 \x01(\x0b\x32/.k8s.io.apimachinery.pkg.apis.meta.v1.Timestamp\x12\x18\n\x10monitorLastScore\x18\x04 \x01(\x01\x12\x1a\n\x12monitorLastLatency\x18\x05 \x01(\x01\x12Z\n\x06health\x18\x06 \x01(\x0b\x32J.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorHealth\x12\x1a\n\x12observedGeneration\x18\x07 \x01(\x03\x12W\n\x07history\x18\t \x03(\x0b\x32\x46.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ModelRecord\x12_\n\rmonitorStatus\x18\n \x01(\x0b\x32H.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorStatus\x12?\n\x0blastUpdated\x18\x0b \x01(\x0b\x32*.k8s.io.apimachinery.pkg.apis.meta.v1.Time\x12\x14\n\x0ctargetColumn\x18\x0c \x01(\t\x12\x15\n\rpositiveLabel\x18\r \x01(\t\x12\x15\n\rnegativeLabel\x18\x0e \x01(\t\x12W\n\tappStatus\x18\x0f \x01(\x0b\x32\x44.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AppStatus\x12\x10\n\x08\x65ndPoint\x18\x10 \x01(\t\x12\x61\n\nconditions\x18\x11 \x03(\x0b\x32M.github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorCondition\"R\n\x0fProgressiveSpec\x12\x0e\n\x06warmup\x18\x01 \x01(\x05\x12\x18\n\x10trafficIncrement\x18\x02 \x01(\x05\x12\x15\n\rcanaryMetrics\x18\x03 \x03(\tB;Z9github.com/metaprov/modelaapi/pkg/apis/inference/v1alpha1'
,
dependencies=[github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_catalog_dot_v1alpha1_dot_generated__pb2.DESCRIPTOR,github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_data_dot_v1alpha1_dot_generated__pb2.DESCRIPTOR,github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_training_dot_v1alpha1_dot_generated__pb2.DESCRIPTOR,k8s_dot_io_dot_api_dot_core_dot_v1_dot_generated__pb2.DESCRIPTOR,k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2.DESCRIPTOR,k8s_dot_io_dot_apimachinery_dot_pkg_dot_runtime_dot_generated__pb2.DESCRIPTOR,k8s_dot_io_dot_apimachinery_dot_pkg_dot_runtime_dot_schema_dot_generated__pb2.DESCRIPTOR,])
_APPSPEC = _descriptor.Descriptor(
name='AppSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AppSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='enabled', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AppSpec.enabled', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='port', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AppSpec.port', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=548,
serialized_end=588,
)
_APPSTATUS = _descriptor.Descriptor(
name='AppStatus',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AppStatus',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='enabled', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AppStatus.enabled', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=590,
serialized_end=618,
)
_AUTOSCALING = _descriptor.Descriptor(
name='AutoScaling',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AutoScaling',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='enabled', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AutoScaling.enabled', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='minReplicas', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AutoScaling.minReplicas', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='maxReplicas', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AutoScaling.maxReplicas', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='cpuAvgUtilization', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AutoScaling.cpuAvgUtilization', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='memAvgUtilization', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AutoScaling.memAvgUtilization', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=620,
serialized_end=746,
)
_CRONPREDICTION = _descriptor.Descriptor(
name='CronPrediction',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPrediction',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='metadata', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPrediction.metadata', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='spec', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPrediction.spec', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='status', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPrediction.status', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=749,
serialized_end=1023,
)
_CRONPREDICTIONCONDITION = _descriptor.Descriptor(
name='CronPredictionCondition',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionCondition',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='type', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionCondition.type', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='status', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionCondition.status', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lastTransitionTime', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionCondition.lastTransitionTime', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='reason', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionCondition.reason', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='message', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionCondition.message', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1026,
serialized_end=1186,
)
_CRONPREDICTIONLIST = _descriptor.Descriptor(
name='CronPredictionList',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionList',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='metadata', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionList.metadata', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='items', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionList.items', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1189,
serialized_end=1365,
)
_CRONPREDICTIONSPEC = _descriptor.Descriptor(
name='CronPredictionSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='versionName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionSpec.versionName', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='owner', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionSpec.owner', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='schedule', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionSpec.schedule', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='template', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionSpec.template', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='priority', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionSpec.priority', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='paused', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionSpec.paused', index=5,
number=6, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='notification', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionSpec.notification', index=6,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1368,
serialized_end=1740,
)
_CRONPREDICTIONSTATUS = _descriptor.Descriptor(
name='CronPredictionStatus',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionStatus',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='lastRun', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionStatus.lastRun', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lastUpdated', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionStatus.lastUpdated', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='observedGeneration', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionStatus.observedGeneration', index=2,
number=3, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='conditions', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionStatus.conditions', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1743,
serialized_end=2023,
)
_CURTAIN = _descriptor.Descriptor(
name='Curtain',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Curtain',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='metadata', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Curtain.metadata', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='spec', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Curtain.spec', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='status', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Curtain.status', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2026,
serialized_end=2279,
)
_CURTAINCONDITION = _descriptor.Descriptor(
name='CurtainCondition',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainCondition',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='type', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainCondition.type', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='status', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainCondition.status', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lastTransitionTime', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainCondition.lastTransitionTime', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='reason', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainCondition.reason', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='message', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainCondition.message', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2282,
serialized_end=2435,
)
_CURTAINLIST = _descriptor.Descriptor(
name='CurtainList',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainList',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='metadata', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainList.metadata', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='items', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainList.items', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2438,
serialized_end=2600,
)
_CURTAINSPEC = _descriptor.Descriptor(
name='CurtainSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='description', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainSpec.description', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='versionName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainSpec.versionName', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='servingsiteName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainSpec.servingsiteName', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='datasetName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainSpec.datasetName', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='question', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainSpec.question', index=4,
number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='notifierName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainSpec.notifierName', index=5,
number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='owner', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainSpec.owner', index=6,
number=8, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2603,
serialized_end=2759,
)
_CURTAINSTATUS = _descriptor.Descriptor(
name='CurtainStatus',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainStatus',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='observedGeneration', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainStatus.observedGeneration', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lastUpdated', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainStatus.lastUpdated', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='conditions', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainStatus.conditions', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2762,
serialized_end=2967,
)
_CURTAINTEMPLATESPEC = _descriptor.Descriptor(
name='CurtainTemplateSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainTemplateSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='metadata', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainTemplateSpec.metadata', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='spec', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainTemplateSpec.spec', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2970,
serialized_end=3145,
)
_CUSTOMAPPSPEC = _descriptor.Descriptor(
name='CustomAppSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CustomAppSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='owner', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CustomAppSpec.owner', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='title', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CustomAppSpec.title', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='pages', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CustomAppSpec.pages', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3147,
serialized_end=3271,
)
_DATAAPP = _descriptor.Descriptor(
name='DataApp',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataApp',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='metadata', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataApp.metadata', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='spec', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataApp.spec', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='status', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataApp.status', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3274,
serialized_end=3527,
)
_DATAAPPCONDITION = _descriptor.Descriptor(
name='DataAppCondition',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppCondition',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='type', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppCondition.type', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='status', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppCondition.status', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lastTransitionTime', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppCondition.lastTransitionTime', index=2,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='reason', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppCondition.reason', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='message', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppCondition.message', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3530,
serialized_end=3683,
)
_DATAAPPLIST = _descriptor.Descriptor(
name='DataAppList',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppList',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='metadata', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppList.metadata', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='items', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppList.items', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3686,
serialized_end=3848,
)
_DATAAPPSPEC = _descriptor.Descriptor(
name='DataAppSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='owner', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec.owner', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='versionName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec.versionName', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='description', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec.description', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='path', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec.path', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='modelName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec.modelName', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='replicas', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec.replicas', index=5,
number=7, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='port', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec.port', index=6,
number=8, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='workloadClassName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec.workloadClassName', index=7,
number=9, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='accessType', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec.accessType', index=8,
number=10, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='productRef', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec.productRef', index=9,
number=11, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='servingsiteRef', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec.servingsiteRef', index=10,
number=12, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='custom', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec.custom', index=11,
number=13, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=3851,
serialized_end=4241,
)
_DATAAPPSTATUS = _descriptor.Descriptor(
name='DataAppStatus',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppStatus',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='observedGeneration', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppStatus.observedGeneration', index=0,
number=1, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lastUpdated', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppStatus.lastUpdated', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='conditions', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppStatus.conditions', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4244,
serialized_end=4449,
)
_FORECASTSPEC_HIERARCHYVALUESENTRY = _descriptor.Descriptor(
name='HierarchyValuesEntry',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ForecastSpec.HierarchyValuesEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='key', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ForecastSpec.HierarchyValuesEntry.key', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='value', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ForecastSpec.HierarchyValuesEntry.value', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=b'8\001',
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4674,
serialized_end=4728,
)
_FORECASTSPEC = _descriptor.Descriptor(
name='ForecastSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ForecastSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='hierarchyValues', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ForecastSpec.hierarchyValues', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='horizon', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ForecastSpec.horizon', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[_FORECASTSPEC_HIERARCHYVALUESENTRY, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4452,
serialized_end=4728,
)
_MODELRECORD = _descriptor.Descriptor(
name='ModelRecord',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ModelRecord',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='modelName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ModelRecord.modelName', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='modelVersion', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ModelRecord.modelVersion', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='liveAt', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ModelRecord.liveAt', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='retiredAt', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ModelRecord.retiredAt', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='avgDailyPrediction', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ModelRecord.avgDailyPrediction', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='avgLatency', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ModelRecord.avgLatency', index=5,
number=6, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4731,
serialized_end=4956,
)
_MONITORSPEC = _descriptor.Descriptor(
name='MonitorSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='enabled', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorSpec.enabled', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='samplePrecent', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorSpec.samplePrecent', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='schedule', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorSpec.schedule', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='notifierName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorSpec.notifierName', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='validations', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorSpec.validations', index=4,
number=5, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='logRequests', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorSpec.logRequests', index=5,
number=6, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='logResponses', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorSpec.logResponses', index=6,
number=7, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=4959,
serialized_end=5261,
)
_MONITORSTATUS = _descriptor.Descriptor(
name='MonitorStatus',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorStatus',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='lastPrediction', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorStatus.lastPrediction', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='validationResults', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorStatus.validationResults', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5264,
serialized_end=5455,
)
_ONLINEFEATURESTORESPEC = _descriptor.Descriptor(
name='OnlineFeaturestoreSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.OnlineFeaturestoreSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='active', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.OnlineFeaturestoreSpec.active', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='serviceName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.OnlineFeaturestoreSpec.serviceName', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5457,
serialized_end=5518,
)
_PREDICTION = _descriptor.Descriptor(
name='Prediction',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Prediction',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='metadata', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Prediction.metadata', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='spec', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Prediction.spec', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='status', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Prediction.status', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5521,
serialized_end=5783,
)
_PREDICTIONCACHESPEC = _descriptor.Descriptor(
name='PredictionCacheSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCacheSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='active', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCacheSpec.active', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='serviceName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCacheSpec.serviceName', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5785,
serialized_end=5843,
)
_PREDICTIONCONDITION = _descriptor.Descriptor(
name='PredictionCondition',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCondition',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='type', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCondition.type', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='status', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCondition.status', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lastTransitionTime', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCondition.lastTransitionTime', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='reason', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCondition.reason', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='message', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCondition.message', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=5846,
serialized_end=6002,
)
_PREDICTIONLIST = _descriptor.Descriptor(
name='PredictionList',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionList',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='metadata', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionList.metadata', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='items', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionList.items', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6005,
serialized_end=6173,
)
_PREDICTIONSPEC = _descriptor.Descriptor(
name='PredictionSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='versionName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.versionName', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='predictorName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.predictorName', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='labeled', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.labeled', index=2,
number=3, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='forecast', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.forecast', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='datasetName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.datasetName', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='input', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.input', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='output', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.output', index=6,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='tests', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.tests', index=7,
number=8, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='owner', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.owner', index=8,
number=9, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='workloadClassName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.workloadClassName', index=9,
number=10, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='activeDeadlineSeconds', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.activeDeadlineSeconds', index=10,
number=11, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='priority', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.priority', index=11,
number=12, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='aborted', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.aborted', index=12,
number=13, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='ttl', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.ttl', index=13,
number=14, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='forecastInfo', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec.forecastInfo', index=14,
number=15, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6176,
serialized_end=6692,
)
_PREDICTIONSTATUS = _descriptor.Descriptor(
name='PredictionStatus',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='startTime', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus.startTime', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='endTime', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus.endTime', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='phase', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus.phase', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='results', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus.results', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='observedGeneration', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus.observedGeneration', index=4,
number=5, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='rows', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus.rows', index=5,
number=6, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='triggeredBy', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus.triggeredBy', index=6,
number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='logs', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus.logs', index=7,
number=8, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lastUpdated', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus.lastUpdated', index=8,
number=9, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='conditions', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus.conditions', index=9,
number=10, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=6695,
serialized_end=7244,
)
_PREDICTIONTEMPLATE = _descriptor.Descriptor(
name='PredictionTemplate',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionTemplate',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='spec', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionTemplate.spec', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7246,
serialized_end=7355,
)
_PREDICTOR = _descriptor.Descriptor(
name='Predictor',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Predictor',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='metadata', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Predictor.metadata', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='spec', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Predictor.spec', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='status', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Predictor.status', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7358,
serialized_end=7617,
)
_PREDICTORAUTHSPEC = _descriptor.Descriptor(
name='PredictorAuthSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorAuthSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='enabled', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorAuthSpec.enabled', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7619,
serialized_end=7655,
)
_PREDICTORCONDITION = _descriptor.Descriptor(
name='PredictorCondition',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorCondition',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='type', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorCondition.type', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='status', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorCondition.status', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lastTransitionTime', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorCondition.lastTransitionTime', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='reason', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorCondition.reason', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='message', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorCondition.message', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7658,
serialized_end=7813,
)
_PREDICTORHEALTH = _descriptor.Descriptor(
name='PredictorHealth',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorHealth',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='service', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorHealth.service', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='dataDrift', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorHealth.dataDrift', index=1,
number=2, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='conceptDrift', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorHealth.conceptDrift', index=2,
number=3, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='totalPredictions', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorHealth.totalPredictions', index=3,
number=4, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='avg', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorHealth.avg', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='totalP95Requests', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorHealth.totalP95Requests', index=5,
number=6, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='medianResponseTime', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorHealth.medianResponseTime', index=6,
number=7, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lastDailyPredictions', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorHealth.lastDailyPredictions', index=7,
number=8, type=5, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=7816,
serialized_end=8014,
)
_PREDICTORLIST = _descriptor.Descriptor(
name='PredictorList',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorList',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='metadata', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorList.metadata', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='items', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorList.items', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=8017,
serialized_end=8183,
)
_PREDICTORSPEC = _descriptor.Descriptor(
name='PredictorSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='versionName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.versionName', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='description', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.description', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='productRef', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.productRef', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='servingsiteRef', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.servingsiteRef', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='template', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.template', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='models', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.models', index=5,
number=6, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='progressive', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.progressive', index=6,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='artifactsFolder', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.artifactsFolder', index=7,
number=8, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='port', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.port', index=8,
number=9, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='path', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.path', index=9,
number=10, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='accessType', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.accessType', index=10,
number=11, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='replicas', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.replicas', index=11,
number=12, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='autoScaling', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.autoScaling', index=12,
number=13, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='owner', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.owner', index=13,
number=14, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='workloadClassName', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.workloadClassName', index=14,
number=15, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='cache', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.cache', index=15,
number=16, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='store', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.store', index=16,
number=17, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='forewardCurtain', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.forewardCurtain', index=17,
number=18, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='backwardCurtain', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.backwardCurtain', index=18,
number=19, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='type', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.type', index=19,
number=20, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='task', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.task', index=20,
number=21, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='predictionTreshold', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.predictionTreshold', index=21,
number=22, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='monitor', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.monitor', index=22,
number=23, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='app', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.app', index=23,
number=24, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='auth', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec.auth', index=24,
number=25, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=8186,
serialized_end=9390,
)
_PREDICTORSTATUS = _descriptor.Descriptor(
name='PredictorStatus',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='modelStatus', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.modelStatus', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='monitorLastAttemptAt', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.monitorLastAttemptAt', index=1,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='monitorLastScore', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.monitorLastScore', index=2,
number=4, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='monitorLastLatency', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.monitorLastLatency', index=3,
number=5, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='health', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.health', index=4,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='observedGeneration', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.observedGeneration', index=5,
number=7, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='history', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.history', index=6,
number=9, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='monitorStatus', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.monitorStatus', index=7,
number=10, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='lastUpdated', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.lastUpdated', index=8,
number=11, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='targetColumn', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.targetColumn', index=9,
number=12, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='positiveLabel', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.positiveLabel', index=10,
number=13, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='negativeLabel', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.negativeLabel', index=11,
number=14, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='appStatus', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.appStatus', index=12,
number=15, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='endPoint', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.endPoint', index=13,
number=16, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='conditions', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus.conditions', index=14,
number=17, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=9393,
serialized_end=10289,
)
_PROGRESSIVESPEC = _descriptor.Descriptor(
name='ProgressiveSpec',
full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ProgressiveSpec',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='warmup', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ProgressiveSpec.warmup', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='trafficIncrement', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ProgressiveSpec.trafficIncrement', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='canaryMetrics', full_name='github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ProgressiveSpec.canaryMetrics', index=2,
number=3, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=10291,
serialized_end=10373,
)
_CRONPREDICTION.fields_by_name['metadata'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._OBJECTMETA
_CRONPREDICTION.fields_by_name['spec'].message_type = _CRONPREDICTIONSPEC
_CRONPREDICTION.fields_by_name['status'].message_type = _CRONPREDICTIONSTATUS
_CRONPREDICTIONCONDITION.fields_by_name['lastTransitionTime'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_CRONPREDICTIONLIST.fields_by_name['metadata'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._LISTMETA
_CRONPREDICTIONLIST.fields_by_name['items'].message_type = _CRONPREDICTION
_CRONPREDICTIONSPEC.fields_by_name['schedule'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_catalog_dot_v1alpha1_dot_generated__pb2._RUNSCHEDULE
_CRONPREDICTIONSPEC.fields_by_name['template'].message_type = _PREDICTIONTEMPLATE
_CRONPREDICTIONSPEC.fields_by_name['notification'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_catalog_dot_v1alpha1_dot_generated__pb2._NOTIFICATIONSPEC
_CRONPREDICTIONSTATUS.fields_by_name['lastRun'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_CRONPREDICTIONSTATUS.fields_by_name['lastUpdated'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_CRONPREDICTIONSTATUS.fields_by_name['conditions'].message_type = _CRONPREDICTIONCONDITION
_CURTAIN.fields_by_name['metadata'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._OBJECTMETA
_CURTAIN.fields_by_name['spec'].message_type = _CURTAINSPEC
_CURTAIN.fields_by_name['status'].message_type = _CURTAINSTATUS
_CURTAINCONDITION.fields_by_name['lastTransitionTime'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_CURTAINLIST.fields_by_name['metadata'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._LISTMETA
_CURTAINLIST.fields_by_name['items'].message_type = _CURTAIN
_CURTAINSTATUS.fields_by_name['lastUpdated'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_CURTAINSTATUS.fields_by_name['conditions'].message_type = _CURTAINCONDITION
_CURTAINTEMPLATESPEC.fields_by_name['metadata'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._OBJECTMETA
_CURTAINTEMPLATESPEC.fields_by_name['spec'].message_type = _CURTAINSPEC
_CUSTOMAPPSPEC.fields_by_name['pages'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_data_dot_v1alpha1_dot_generated__pb2._PAGESPEC
_DATAAPP.fields_by_name['metadata'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._OBJECTMETA
_DATAAPP.fields_by_name['spec'].message_type = _DATAAPPSPEC
_DATAAPP.fields_by_name['status'].message_type = _DATAAPPSTATUS
_DATAAPPCONDITION.fields_by_name['lastTransitionTime'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_DATAAPPLIST.fields_by_name['metadata'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._LISTMETA
_DATAAPPLIST.fields_by_name['items'].message_type = _DATAAPP
_DATAAPPSPEC.fields_by_name['productRef'].message_type = k8s_dot_io_dot_api_dot_core_dot_v1_dot_generated__pb2._OBJECTREFERENCE
_DATAAPPSPEC.fields_by_name['servingsiteRef'].message_type = k8s_dot_io_dot_api_dot_core_dot_v1_dot_generated__pb2._OBJECTREFERENCE
_DATAAPPSPEC.fields_by_name['custom'].message_type = _CUSTOMAPPSPEC
_DATAAPPSTATUS.fields_by_name['lastUpdated'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_DATAAPPSTATUS.fields_by_name['conditions'].message_type = _DATAAPPCONDITION
_FORECASTSPEC_HIERARCHYVALUESENTRY.containing_type = _FORECASTSPEC
_FORECASTSPEC.fields_by_name['hierarchyValues'].message_type = _FORECASTSPEC_HIERARCHYVALUESENTRY
_FORECASTSPEC.fields_by_name['horizon'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_training_dot_v1alpha1_dot_generated__pb2._PERIODSPEC
_MODELRECORD.fields_by_name['liveAt'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_MODELRECORD.fields_by_name['retiredAt'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_MONITORSPEC.fields_by_name['schedule'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_catalog_dot_v1alpha1_dot_generated__pb2._RUNSCHEDULE
_MONITORSPEC.fields_by_name['validations'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_training_dot_v1alpha1_dot_generated__pb2._MODELVALIDATION
_MONITORSTATUS.fields_by_name['lastPrediction'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_MONITORSTATUS.fields_by_name['validationResults'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_training_dot_v1alpha1_dot_generated__pb2._MODELVALIDATIONRESULT
_PREDICTION.fields_by_name['metadata'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._OBJECTMETA
_PREDICTION.fields_by_name['spec'].message_type = _PREDICTIONSPEC
_PREDICTION.fields_by_name['status'].message_type = _PREDICTIONSTATUS
_PREDICTIONCONDITION.fields_by_name['lastTransitionTime'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_PREDICTIONLIST.fields_by_name['metadata'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._LISTMETA
_PREDICTIONLIST.fields_by_name['items'].message_type = _PREDICTION
_PREDICTIONSPEC.fields_by_name['input'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_data_dot_v1alpha1_dot_generated__pb2._DATALOCATION
_PREDICTIONSPEC.fields_by_name['output'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_data_dot_v1alpha1_dot_generated__pb2._DATAOUTPUTSPEC
_PREDICTIONSPEC.fields_by_name['forecastInfo'].message_type = _FORECASTSPEC
_PREDICTIONSTATUS.fields_by_name['startTime'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_PREDICTIONSTATUS.fields_by_name['endTime'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_PREDICTIONSTATUS.fields_by_name['results'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_catalog_dot_v1alpha1_dot_generated__pb2._MEASUREMENT
_PREDICTIONSTATUS.fields_by_name['logs'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_catalog_dot_v1alpha1_dot_generated__pb2._LOGS
_PREDICTIONSTATUS.fields_by_name['lastUpdated'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_PREDICTIONSTATUS.fields_by_name['conditions'].message_type = _PREDICTIONCONDITION
_PREDICTIONTEMPLATE.fields_by_name['spec'].message_type = _PREDICTIONSPEC
_PREDICTOR.fields_by_name['metadata'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._OBJECTMETA
_PREDICTOR.fields_by_name['spec'].message_type = _PREDICTORSPEC
_PREDICTOR.fields_by_name['status'].message_type = _PREDICTORSTATUS
_PREDICTORCONDITION.fields_by_name['lastTransitionTime'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_PREDICTORLIST.fields_by_name['metadata'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._LISTMETA
_PREDICTORLIST.fields_by_name['items'].message_type = _PREDICTOR
_PREDICTORSPEC.fields_by_name['productRef'].message_type = k8s_dot_io_dot_api_dot_core_dot_v1_dot_generated__pb2._OBJECTREFERENCE
_PREDICTORSPEC.fields_by_name['servingsiteRef'].message_type = k8s_dot_io_dot_api_dot_core_dot_v1_dot_generated__pb2._OBJECTREFERENCE
_PREDICTORSPEC.fields_by_name['template'].message_type = k8s_dot_io_dot_api_dot_core_dot_v1_dot_generated__pb2._PODTEMPLATE
_PREDICTORSPEC.fields_by_name['models'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_catalog_dot_v1alpha1_dot_generated__pb2._MODELDEPLOYMENTSPEC
_PREDICTORSPEC.fields_by_name['progressive'].message_type = _PROGRESSIVESPEC
_PREDICTORSPEC.fields_by_name['autoScaling'].message_type = _AUTOSCALING
_PREDICTORSPEC.fields_by_name['cache'].message_type = _PREDICTIONCACHESPEC
_PREDICTORSPEC.fields_by_name['store'].message_type = _ONLINEFEATURESTORESPEC
_PREDICTORSPEC.fields_by_name['monitor'].message_type = _MONITORSPEC
_PREDICTORSPEC.fields_by_name['app'].message_type = _APPSPEC
_PREDICTORSPEC.fields_by_name['auth'].message_type = _PREDICTORAUTHSPEC
_PREDICTORSTATUS.fields_by_name['modelStatus'].message_type = github_dot_com_dot_metaprov_dot_modelaapi_dot_pkg_dot_apis_dot_catalog_dot_v1alpha1_dot_generated__pb2._MODELDEPLOYMENTSTATUS
_PREDICTORSTATUS.fields_by_name['monitorLastAttemptAt'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIMESTAMP
_PREDICTORSTATUS.fields_by_name['health'].message_type = _PREDICTORHEALTH
_PREDICTORSTATUS.fields_by_name['history'].message_type = _MODELRECORD
_PREDICTORSTATUS.fields_by_name['monitorStatus'].message_type = _MONITORSTATUS
_PREDICTORSTATUS.fields_by_name['lastUpdated'].message_type = k8s_dot_io_dot_apimachinery_dot_pkg_dot_apis_dot_meta_dot_v1_dot_generated__pb2._TIME
_PREDICTORSTATUS.fields_by_name['appStatus'].message_type = _APPSTATUS
_PREDICTORSTATUS.fields_by_name['conditions'].message_type = _PREDICTORCONDITION
DESCRIPTOR.message_types_by_name['AppSpec'] = _APPSPEC
DESCRIPTOR.message_types_by_name['AppStatus'] = _APPSTATUS
DESCRIPTOR.message_types_by_name['AutoScaling'] = _AUTOSCALING
DESCRIPTOR.message_types_by_name['CronPrediction'] = _CRONPREDICTION
DESCRIPTOR.message_types_by_name['CronPredictionCondition'] = _CRONPREDICTIONCONDITION
DESCRIPTOR.message_types_by_name['CronPredictionList'] = _CRONPREDICTIONLIST
DESCRIPTOR.message_types_by_name['CronPredictionSpec'] = _CRONPREDICTIONSPEC
DESCRIPTOR.message_types_by_name['CronPredictionStatus'] = _CRONPREDICTIONSTATUS
DESCRIPTOR.message_types_by_name['Curtain'] = _CURTAIN
DESCRIPTOR.message_types_by_name['CurtainCondition'] = _CURTAINCONDITION
DESCRIPTOR.message_types_by_name['CurtainList'] = _CURTAINLIST
DESCRIPTOR.message_types_by_name['CurtainSpec'] = _CURTAINSPEC
DESCRIPTOR.message_types_by_name['CurtainStatus'] = _CURTAINSTATUS
DESCRIPTOR.message_types_by_name['CurtainTemplateSpec'] = _CURTAINTEMPLATESPEC
DESCRIPTOR.message_types_by_name['CustomAppSpec'] = _CUSTOMAPPSPEC
DESCRIPTOR.message_types_by_name['DataApp'] = _DATAAPP
DESCRIPTOR.message_types_by_name['DataAppCondition'] = _DATAAPPCONDITION
DESCRIPTOR.message_types_by_name['DataAppList'] = _DATAAPPLIST
DESCRIPTOR.message_types_by_name['DataAppSpec'] = _DATAAPPSPEC
DESCRIPTOR.message_types_by_name['DataAppStatus'] = _DATAAPPSTATUS
DESCRIPTOR.message_types_by_name['ForecastSpec'] = _FORECASTSPEC
DESCRIPTOR.message_types_by_name['ModelRecord'] = _MODELRECORD
DESCRIPTOR.message_types_by_name['MonitorSpec'] = _MONITORSPEC
DESCRIPTOR.message_types_by_name['MonitorStatus'] = _MONITORSTATUS
DESCRIPTOR.message_types_by_name['OnlineFeaturestoreSpec'] = _ONLINEFEATURESTORESPEC
DESCRIPTOR.message_types_by_name['Prediction'] = _PREDICTION
DESCRIPTOR.message_types_by_name['PredictionCacheSpec'] = _PREDICTIONCACHESPEC
DESCRIPTOR.message_types_by_name['PredictionCondition'] = _PREDICTIONCONDITION
DESCRIPTOR.message_types_by_name['PredictionList'] = _PREDICTIONLIST
DESCRIPTOR.message_types_by_name['PredictionSpec'] = _PREDICTIONSPEC
DESCRIPTOR.message_types_by_name['PredictionStatus'] = _PREDICTIONSTATUS
DESCRIPTOR.message_types_by_name['PredictionTemplate'] = _PREDICTIONTEMPLATE
DESCRIPTOR.message_types_by_name['Predictor'] = _PREDICTOR
DESCRIPTOR.message_types_by_name['PredictorAuthSpec'] = _PREDICTORAUTHSPEC
DESCRIPTOR.message_types_by_name['PredictorCondition'] = _PREDICTORCONDITION
DESCRIPTOR.message_types_by_name['PredictorHealth'] = _PREDICTORHEALTH
DESCRIPTOR.message_types_by_name['PredictorList'] = _PREDICTORLIST
DESCRIPTOR.message_types_by_name['PredictorSpec'] = _PREDICTORSPEC
DESCRIPTOR.message_types_by_name['PredictorStatus'] = _PREDICTORSTATUS
DESCRIPTOR.message_types_by_name['ProgressiveSpec'] = _PROGRESSIVESPEC
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
AppSpec = _reflection.GeneratedProtocolMessageType('AppSpec', (_message.Message,), {
'DESCRIPTOR' : _APPSPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AppSpec)
})
_sym_db.RegisterMessage(AppSpec)
AppStatus = _reflection.GeneratedProtocolMessageType('AppStatus', (_message.Message,), {
'DESCRIPTOR' : _APPSTATUS,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AppStatus)
})
_sym_db.RegisterMessage(AppStatus)
AutoScaling = _reflection.GeneratedProtocolMessageType('AutoScaling', (_message.Message,), {
'DESCRIPTOR' : _AUTOSCALING,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.AutoScaling)
})
_sym_db.RegisterMessage(AutoScaling)
CronPrediction = _reflection.GeneratedProtocolMessageType('CronPrediction', (_message.Message,), {
'DESCRIPTOR' : _CRONPREDICTION,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPrediction)
})
_sym_db.RegisterMessage(CronPrediction)
CronPredictionCondition = _reflection.GeneratedProtocolMessageType('CronPredictionCondition', (_message.Message,), {
'DESCRIPTOR' : _CRONPREDICTIONCONDITION,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionCondition)
})
_sym_db.RegisterMessage(CronPredictionCondition)
CronPredictionList = _reflection.GeneratedProtocolMessageType('CronPredictionList', (_message.Message,), {
'DESCRIPTOR' : _CRONPREDICTIONLIST,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionList)
})
_sym_db.RegisterMessage(CronPredictionList)
CronPredictionSpec = _reflection.GeneratedProtocolMessageType('CronPredictionSpec', (_message.Message,), {
'DESCRIPTOR' : _CRONPREDICTIONSPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionSpec)
})
_sym_db.RegisterMessage(CronPredictionSpec)
CronPredictionStatus = _reflection.GeneratedProtocolMessageType('CronPredictionStatus', (_message.Message,), {
'DESCRIPTOR' : _CRONPREDICTIONSTATUS,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CronPredictionStatus)
})
_sym_db.RegisterMessage(CronPredictionStatus)
Curtain = _reflection.GeneratedProtocolMessageType('Curtain', (_message.Message,), {
'DESCRIPTOR' : _CURTAIN,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Curtain)
})
_sym_db.RegisterMessage(Curtain)
CurtainCondition = _reflection.GeneratedProtocolMessageType('CurtainCondition', (_message.Message,), {
'DESCRIPTOR' : _CURTAINCONDITION,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainCondition)
})
_sym_db.RegisterMessage(CurtainCondition)
CurtainList = _reflection.GeneratedProtocolMessageType('CurtainList', (_message.Message,), {
'DESCRIPTOR' : _CURTAINLIST,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainList)
})
_sym_db.RegisterMessage(CurtainList)
CurtainSpec = _reflection.GeneratedProtocolMessageType('CurtainSpec', (_message.Message,), {
'DESCRIPTOR' : _CURTAINSPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainSpec)
})
_sym_db.RegisterMessage(CurtainSpec)
CurtainStatus = _reflection.GeneratedProtocolMessageType('CurtainStatus', (_message.Message,), {
'DESCRIPTOR' : _CURTAINSTATUS,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainStatus)
})
_sym_db.RegisterMessage(CurtainStatus)
CurtainTemplateSpec = _reflection.GeneratedProtocolMessageType('CurtainTemplateSpec', (_message.Message,), {
'DESCRIPTOR' : _CURTAINTEMPLATESPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CurtainTemplateSpec)
})
_sym_db.RegisterMessage(CurtainTemplateSpec)
CustomAppSpec = _reflection.GeneratedProtocolMessageType('CustomAppSpec', (_message.Message,), {
'DESCRIPTOR' : _CUSTOMAPPSPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.CustomAppSpec)
})
_sym_db.RegisterMessage(CustomAppSpec)
DataApp = _reflection.GeneratedProtocolMessageType('DataApp', (_message.Message,), {
'DESCRIPTOR' : _DATAAPP,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataApp)
})
_sym_db.RegisterMessage(DataApp)
DataAppCondition = _reflection.GeneratedProtocolMessageType('DataAppCondition', (_message.Message,), {
'DESCRIPTOR' : _DATAAPPCONDITION,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppCondition)
})
_sym_db.RegisterMessage(DataAppCondition)
DataAppList = _reflection.GeneratedProtocolMessageType('DataAppList', (_message.Message,), {
'DESCRIPTOR' : _DATAAPPLIST,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppList)
})
_sym_db.RegisterMessage(DataAppList)
DataAppSpec = _reflection.GeneratedProtocolMessageType('DataAppSpec', (_message.Message,), {
'DESCRIPTOR' : _DATAAPPSPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppSpec)
})
_sym_db.RegisterMessage(DataAppSpec)
DataAppStatus = _reflection.GeneratedProtocolMessageType('DataAppStatus', (_message.Message,), {
'DESCRIPTOR' : _DATAAPPSTATUS,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.DataAppStatus)
})
_sym_db.RegisterMessage(DataAppStatus)
ForecastSpec = _reflection.GeneratedProtocolMessageType('ForecastSpec', (_message.Message,), {
'HierarchyValuesEntry' : _reflection.GeneratedProtocolMessageType('HierarchyValuesEntry', (_message.Message,), {
'DESCRIPTOR' : _FORECASTSPEC_HIERARCHYVALUESENTRY,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ForecastSpec.HierarchyValuesEntry)
})
,
'DESCRIPTOR' : _FORECASTSPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ForecastSpec)
})
_sym_db.RegisterMessage(ForecastSpec)
_sym_db.RegisterMessage(ForecastSpec.HierarchyValuesEntry)
ModelRecord = _reflection.GeneratedProtocolMessageType('ModelRecord', (_message.Message,), {
'DESCRIPTOR' : _MODELRECORD,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ModelRecord)
})
_sym_db.RegisterMessage(ModelRecord)
MonitorSpec = _reflection.GeneratedProtocolMessageType('MonitorSpec', (_message.Message,), {
'DESCRIPTOR' : _MONITORSPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorSpec)
})
_sym_db.RegisterMessage(MonitorSpec)
MonitorStatus = _reflection.GeneratedProtocolMessageType('MonitorStatus', (_message.Message,), {
'DESCRIPTOR' : _MONITORSTATUS,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.MonitorStatus)
})
_sym_db.RegisterMessage(MonitorStatus)
OnlineFeaturestoreSpec = _reflection.GeneratedProtocolMessageType('OnlineFeaturestoreSpec', (_message.Message,), {
'DESCRIPTOR' : _ONLINEFEATURESTORESPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.OnlineFeaturestoreSpec)
})
_sym_db.RegisterMessage(OnlineFeaturestoreSpec)
Prediction = _reflection.GeneratedProtocolMessageType('Prediction', (_message.Message,), {
'DESCRIPTOR' : _PREDICTION,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Prediction)
})
_sym_db.RegisterMessage(Prediction)
PredictionCacheSpec = _reflection.GeneratedProtocolMessageType('PredictionCacheSpec', (_message.Message,), {
'DESCRIPTOR' : _PREDICTIONCACHESPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCacheSpec)
})
_sym_db.RegisterMessage(PredictionCacheSpec)
PredictionCondition = _reflection.GeneratedProtocolMessageType('PredictionCondition', (_message.Message,), {
'DESCRIPTOR' : _PREDICTIONCONDITION,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionCondition)
})
_sym_db.RegisterMessage(PredictionCondition)
PredictionList = _reflection.GeneratedProtocolMessageType('PredictionList', (_message.Message,), {
'DESCRIPTOR' : _PREDICTIONLIST,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionList)
})
_sym_db.RegisterMessage(PredictionList)
PredictionSpec = _reflection.GeneratedProtocolMessageType('PredictionSpec', (_message.Message,), {
'DESCRIPTOR' : _PREDICTIONSPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionSpec)
})
_sym_db.RegisterMessage(PredictionSpec)
PredictionStatus = _reflection.GeneratedProtocolMessageType('PredictionStatus', (_message.Message,), {
'DESCRIPTOR' : _PREDICTIONSTATUS,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionStatus)
})
_sym_db.RegisterMessage(PredictionStatus)
PredictionTemplate = _reflection.GeneratedProtocolMessageType('PredictionTemplate', (_message.Message,), {
'DESCRIPTOR' : _PREDICTIONTEMPLATE,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictionTemplate)
})
_sym_db.RegisterMessage(PredictionTemplate)
Predictor = _reflection.GeneratedProtocolMessageType('Predictor', (_message.Message,), {
'DESCRIPTOR' : _PREDICTOR,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.Predictor)
})
_sym_db.RegisterMessage(Predictor)
PredictorAuthSpec = _reflection.GeneratedProtocolMessageType('PredictorAuthSpec', (_message.Message,), {
'DESCRIPTOR' : _PREDICTORAUTHSPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorAuthSpec)
})
_sym_db.RegisterMessage(PredictorAuthSpec)
PredictorCondition = _reflection.GeneratedProtocolMessageType('PredictorCondition', (_message.Message,), {
'DESCRIPTOR' : _PREDICTORCONDITION,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorCondition)
})
_sym_db.RegisterMessage(PredictorCondition)
PredictorHealth = _reflection.GeneratedProtocolMessageType('PredictorHealth', (_message.Message,), {
'DESCRIPTOR' : _PREDICTORHEALTH,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorHealth)
})
_sym_db.RegisterMessage(PredictorHealth)
PredictorList = _reflection.GeneratedProtocolMessageType('PredictorList', (_message.Message,), {
'DESCRIPTOR' : _PREDICTORLIST,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorList)
})
_sym_db.RegisterMessage(PredictorList)
PredictorSpec = _reflection.GeneratedProtocolMessageType('PredictorSpec', (_message.Message,), {
'DESCRIPTOR' : _PREDICTORSPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorSpec)
})
_sym_db.RegisterMessage(PredictorSpec)
PredictorStatus = _reflection.GeneratedProtocolMessageType('PredictorStatus', (_message.Message,), {
'DESCRIPTOR' : _PREDICTORSTATUS,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.PredictorStatus)
})
_sym_db.RegisterMessage(PredictorStatus)
ProgressiveSpec = _reflection.GeneratedProtocolMessageType('ProgressiveSpec', (_message.Message,), {
'DESCRIPTOR' : _PROGRESSIVESPEC,
'__module__' : 'github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.generated_pb2'
# @@protoc_insertion_point(class_scope:github.com.metaprov.modelaapi.pkg.apis.inference.v1alpha1.ProgressiveSpec)
})
_sym_db.RegisterMessage(ProgressiveSpec)
DESCRIPTOR._options = None
_FORECASTSPEC_HIERARCHYVALUESENTRY._options = None
# @@protoc_insertion_point(module_scope)
| 56.042753 | 15,373 | 0.777914 | 20,630 | 161,235 | 5.780562 | 0.030053 | 0.043001 | 0.063889 | 0.074447 | 0.845027 | 0.824222 | 0.81743 | 0.810453 | 0.805707 | 0.790085 | 0 | 0.038234 | 0.10133 | 161,235 | 2,876 | 15,374 | 56.062239 | 0.784785 | 0.030006 | 0 | 0.717835 | 1 | 0.001112 | 0.279195 | 0.242245 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.004079 | 0 | 0.004079 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 |
bf656b1b7e1f0edd2a8fa456d4c0c6fb41c3b935 | 3,437 | py | Python | tests/test_theis.py | Huite/ttim | 6511a2a770bf1ba912518d8dc8716a865102e7da | [
"MIT"
] | 15 | 2015-08-24T17:28:37.000Z | 2021-12-21T19:52:56.000Z | tests/test_theis.py | Huite/ttim | 6511a2a770bf1ba912518d8dc8716a865102e7da | [
"MIT"
] | 26 | 2016-02-09T13:23:56.000Z | 2022-02-24T08:06:54.000Z | tests/test_theis.py | Huite/ttim | 6511a2a770bf1ba912518d8dc8716a865102e7da | [
"MIT"
] | 23 | 2015-09-26T09:18:08.000Z | 2021-11-15T19:51:50.000Z | import numpy as np
from scipy.special import exp1
from ttim import *
def theis(r, t, T, S, Q):
u = r ** 2 * S / (4 * T * t)
h = -Q / (4 * np.pi * T) * exp1(u)
return h
def theisQr(r, t, T, S, Q):
u = r ** 2 * S / (4 * T * t)
Qr = -Q / (2 * np.pi) * np.exp(-u) / r
return Qr
T = 500
S = 1e-3
t = np.logspace(-4, 1, 10)
r = 30
Q = 788
h1 = theis(r, t, T, S, Q)
ml = ModelMaq(kaq=50, z=[10, 0], Saq=S / 10, tmin=1e-4, tmax=10)
w = Well(ml, 0, 0, rw=0.3, tsandQ=[(0, Q)])
ml.solve()
h2 = ml.head(r, 0, t)[0]
assert np.allclose(h1, h2, atol=1e-4), "h1 and h2 not all close Theis well 1"
# turn Theis off
t = np.logspace(-1, 1, 10)
h1 = theis(r, t, T, S, Q)
h1[t > 5] -= theis(r, t[t > 5] - 5, T, S, Q)
ml = ModelMaq(kaq=50, z=[10, 0], Saq=S / 10, tmin=1e-4, tmax=10)
w = Well(ml, 0, 0, rw=0.3, tsandQ=[(0, Q), (5, 0)])
ml.solve()
h2 = ml.head(r, 0, t)[0]
assert np.allclose(h1, h2, atol=1e-4), "h1 and h2 not all close Theis well 2"
# test nan values for Theis well 1
t = np.array([0.08, 0.09, 0.1, 1, 5, 9])
h1 = theis(r, t, T, S, Q)
tmin = 0.1
ml = ModelMaq(kaq=50, z=[10, 0], Saq=S / 10, tmin=tmin, tmax=10)
w = Well(ml, 0, 0, rw=0.3, tsandQ=[(0, Q)])
ml.solve()
h2 = ml.head(r, 0, t)[0]
a = np.isnan(h2)
b = t < tmin
assert np.all(a == b), "nans not in the right spot for tmin"
assert np.allclose(h1[~b], h2[~b], atol=1e-4)
# test nan values for Theis well 2
t = np.array([0.08, 0.09, 0.1, 1, 5, 5.03, 9])
h1 = theis(r, t, T, S, Q)
h1[t > 5] -= theis(r, t[t > 5] - 5, T, S, Q)
tmin = 0.1
ml = ModelMaq(kaq=50, z=[10, 0], Saq=S / 10, tmin=tmin, tmax=10)
w = Well(ml, 0, 0, rw=0.3, tsandQ=[(0, Q), (5, 0)])
ml.solve()
h2 = ml.head(r, 0, t)[0]
a = np.isnan(h2)
b = (t < tmin) | ((t > 5) & (t < 5.1))
assert np.all(a == b), "nans not in the right spot for tmin"
assert np.allclose(h1[~b], h2[~b], atol=1e-4)
### test for Qr ########################
Qr1 = theisQr(r, t, T, S, Q)
ml = ModelMaq(kaq=50, z=[10, 0], Saq=S / 10, tmin=1e-4, tmax=10)
w = Well(ml, 0, 0, rw=0.3, tsandQ=[(0, Q)])
ml.solve()
Qr2 = ml.disvec(r, 0, t)[0][0]
assert np.allclose(Qr1, Qr2, atol=1e-4), \
"Qr1 and Qr2 not all close Theis well 1"
# turn Theis off
t = np.logspace(-1, 1, 10)
Qr1 = theisQr(r, t, T, S, Q)
Qr1[t > 5] -= theisQr(r, t[t > 5] - 5, T, S, Q)
ml = ModelMaq(kaq=50, z=[10, 0], Saq=S / 10, tmin=1e-4, tmax=10)
w = Well(ml, 0, 0, rw=0.3, tsandQ=[(0, Q), (5, 0)])
ml.solve()
Qr2 = ml.disvec(r, 0, t)[0][0]
assert np.allclose(Qr1, Qr2, atol=1e-4), \
"Qr1 and Qr2 not all close Theis well 2"
# test nan values for Theis well 1
t = np.array([0.08, 0.09, 0.1, 1, 5, 9])
Qr1 = theisQr(r, t, T, S, Q)
tmin = 0.1
ml = ModelMaq(kaq=50, z=[10, 0], Saq=S / 10, tmin=tmin, tmax=10)
w = Well(ml, 0, 0, rw=0.3, tsandQ=[(0, Q)])
ml.solve()
Qr2 = ml.disvec(r, 0, t)[0][0]
a = np.isnan(Qr2)
b = t < tmin
assert np.all(a == b), "nans not in the right spot for tmin"
assert np.allclose(Qr1[~b], Qr2[~b], atol=1e-4)
# test nan values for Theis well 2
t = np.array([0.08, 0.09, 0.1, 1, 5, 5.03, 9])
Qr1 = theisQr(r, t, T, S, Q)
Qr1[t > 5] -= theisQr(r, t[t > 5] - 5, T, S, Q)
tmin = 0.1
ml = ModelMaq(kaq=50, z=[10, 0], Saq=S / 10, tmin=tmin, tmax=10)
w = Well(ml, 0, 0, rw=0.3, tsandQ=[(0, Q), (5, 0)])
ml.solve()
Qr2 = ml.disvec(r, 0, t)[0][0]
a = np.isnan(h2)
b = (t < tmin) | ((t > 5) & (t < 5.1))
assert np.all(a == b), "nans not in the right spot for tmin"
assert np.allclose(Qr1[~b], Qr2[~b], atol=1e-4)
| 24.905797 | 77 | 0.542333 | 779 | 3,437 | 2.392811 | 0.101412 | 0.017167 | 0.022532 | 0.021459 | 0.92382 | 0.92382 | 0.917382 | 0.908262 | 0.899142 | 0.899142 | 0 | 0.120518 | 0.212976 | 3,437 | 137 | 78 | 25.087591 | 0.568577 | 0.050626 | 0 | 0.793478 | 0 | 0 | 0.089219 | 0 | 0 | 0 | 0 | 0 | 0.130435 | 1 | 0.021739 | false | 0 | 0.032609 | 0 | 0.076087 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
44fd0e87869ab36382e62322b2300341ec7bfe53 | 15,429 | py | Python | roots/root2neuron.py | Kubasinska/Roots | fc8915d6d043b527c622e3c78d3c658ffdd23cab | [
"MIT"
] | 2 | 2020-08-25T03:09:45.000Z | 2020-12-09T20:38:49.000Z | roots/root2neuron.py | Kubasinska/Roots | fc8915d6d043b527c622e3c78d3c658ffdd23cab | [
"MIT"
] | 2 | 2020-11-24T13:13:37.000Z | 2021-03-17T19:45:52.000Z | roots/root2neuron.py | Kubasinska/Roots | fc8915d6d043b527c622e3c78d3c658ffdd23cab | [
"MIT"
] | 2 | 2020-07-17T05:25:19.000Z | 2020-11-24T12:35:57.000Z | import os
class Root2Hoc():
"""
This class is designed to take an existing morphology and write the topology and morphology to a .hoc file that can be used to run NEURON simulations using existing models.
```
hoc_writer = Root2Hoc()
hoc_writer.primarytest()
arbor = hoc_writer.test_arbor()
print(arbor)
hoc_writer.arbor_to_nrn(arbor)
```
"""
def __init__(self):
pass
def strip_diameters_for_comparison(self,li):
if any(isinstance(i, list) for i in li):
newli = []
if any(isinstance(i, list) for i in li[0]):
for section in li:
newli.append([point[:3] for point in section])
return(newli)
else:
return([point[:3] for point in li])
else:
return(li[:3])
def lookup_section_by_point(self,arbor,point,home_branch):
sec_index = 0
for branch in arbor.keys():
if branch == home_branch:
continue
for section in arbor[branch]:
if self.strip_diameters_for_comparison(point) in self.strip_diameters_for_comparison(section):
return(sec_index,self.strip_diameters_for_comparison(section).index(self.strip_diameters_for_comparison(point))/float(len(section)-1))
else:
sec_index+=1
return(None,None)
def count_sections(self,arbor):
sec_count = 0
for branch in arbor.keys():
for section in arbor[branch]:
sec_count+=1
return(sec_count)
def build_section_indices(self,arbor):
"""
builds a dictionary of indices that match the arbor sections and is used to label sections while building the connections/topology
"""
section_indices = {}
sec_ind = 0
for branch in arbor.keys():
section_indices[branch] = []
for section in arbor[branch]:
section_indices[branch].append(sec_ind)
sec_ind+=1
return(section_indices)
def build_topology_list(self,arbor):
section_indices = self.build_section_indices(arbor)
connections = []
for branch in arbor.keys():
if branch != 0:
ind,position = self.lookup_section_by_point(arbor,arbor[branch][0][0],branch)
if ind==None:
raise(ValueError)
connections.append(([ind,int(position)],[section_indices[branch][0],0]))
for section in arbor[branch][:-1]:
connections.append(([section_indices[branch][arbor[branch].index(section)],1],[section_indices[branch][arbor[branch].index(section)]+1,0]))
return(connections)
def arbor_to_nrn_topology(self,arbor):
topo_list = self.build_topology_list(arbor)
number_of_sections = self.count_sections(arbor)
topo_func = '//Building axon topology\n\n'
topo_func+= f'create sectionList[{number_of_sections}]'
for connection in topo_list:
topo_func+=f'\nconnect sectionList[{connection[1][0]}]({connection[1][1]}), sectionList[{connection[0][0]}]({connection[0][1]})'
return(topo_func+'\n')
def nrn_build_section(self,section_index,section_points):
nrn_command=f'sectionList[{section_index}]'+'{\n'
for point in section_points:
if len(point) < 4:
nrn_command+=f'\tpt3dadd({point[0]},{point[1]},{point[2]},1)\n'
else:
nrn_command+=f'\tpt3dadd({point[0]},{point[1]},{point[2]},{point[3]})\n'
return(nrn_command+'}\n')
def arbor_to_nrn_morphology(self,arbor):
"""
//Set up axon geometry
//MAIN AXON
node[0]{
pt3dadd(-10338,2909.5,-316.24,nodeD)
pt3dadd(-10338.3947,2910.3684,-315.94,nodeD)
}
"""
morpho_func='\n//Set up axon geometry\n\n//MAIN AXON\n\n'
section_index = 0
for branch in arbor.keys():
for section in arbor[branch]:
morpho_func+=self.nrn_build_section(section_index,section)
section_index+=1
return(morpho_func)
def arbor_to_nrn(self,arbor,labels,target=os.getcwd()+'/testmorphology.hoc'):
topology_function = self.arbor_to_nrn_topology(arbor)
morphology_function = self.arbor_to_nrn_morphology(arbor)
with open(target,'w') as f:
f.write(topology_function+'\n\n'+morphology_function+'\n\n')
return(topology_function+'\n\n'+morphology_function+'\n\n')
def test_arbor(self):
arbor = {}
arbor[0] = [[[0,0,0,1],[1,0,0,1],[2,0,0,1]],[[2,0,0,1],[3,0,0,1],[4,0,0,1]],[[4,0,0,1],[5,0,0,1],[6,0,0,1]]]
arbor[1] = [[[2,0,0,1],[2,1,0,1],[2,2,0,1]],[[2,2,0,1],[2,3,0,1],[2,4,0,1]]]
arbor[2] = [[[4,0,0,1],[4,0,1,1],[4,0,2,1]],[[4,0,2,1],[4,0,3,1],[4,0,4,1]]]
return(arbor)
def primarytest(self):
arbor = self.test_arbor()
if self.lookup_section_by_point(arbor,[3,0,0,1])[0] == 1:
print('lookup_section_by_point() --passed')
else:
print('lookup_section_by_point() --failed')
if self.count_sections(arbor) == 7:
print('count_sections() --passed')
else:
print('count_sections() --failed')
if self.build_topology_list(arbor) == [([0, 1], [1, 0]), ([1, 1], [2, 0]), ([0, 1], [3, 0]), ([3, 1], [4, 0]), ([1, 1], [5, 0]), ([5, 1], [6, 0])]:
print('build_section_list() --passed\nbuild_section_indices() --passed')
else:
print('build_section_list() --failed\nbuild_section_indices() --failed')
if self.arbor_to_nrn_topology(arbor) == '//Building axon topology\n\ncreate sectionList[7]\nconnect sectionList[0](1), sectionList[1](0)\nconnect sectionList[1](1), sectionList[2](0)\nconnect sectionList[0](1), sectionList[3](0)\nconnect sectionList[3](1), sectionList[4](0)\nconnect sectionList[1](1), sectionList[5](0)\nconnect sectionList[5](1), sectionList[6](0)\n':
print('arbor_to_nrn_topology() --passed')
else:
print('arbor_to_nrn_topology() --failed')
if self.nrn_build_section(0,arbor[0][0]) =='sectionList[0]{\n\tpt3dadd(0,0,0,1)\n\tpt3dadd(1,0,0,1)\n\tpt3dadd(2,0,0,1)\n}\n':
print('nrn_build_section() --passed')
else:
print('nrn_build_section() --failed')
if self.arbor_to_nrn_morphology(arbor) =='\n//Set up axon geometry\n\n//MAIN AXON\n\nsectionList[0]{\n\tpt3dadd(0,0,0,1)\n\tpt3dadd(1,0,0,1)\n\tpt3dadd(2,0,0,1)\n}\nsectionList[1]{\n\tpt3dadd(2,0,0,1)\n\tpt3dadd(3,0,0,1)\n\tpt3dadd(4,0,0,1)\n}\nsectionList[2]{\n\tpt3dadd(4,0,0,1)\n\tpt3dadd(5,0,0,1)\n\tpt3dadd(6,0,0,1)\n}\nsectionList[3]{\n\tpt3dadd(2,0,0,1)\n\tpt3dadd(2,1,0,1)\n\tpt3dadd(2,2,0,1)\n}\nsectionList[4]{\n\tpt3dadd(2,2,0,1)\n\tpt3dadd(2,3,0,1)\n\tpt3dadd(2,4,0,1)\n}\nsectionList[5]{\n\tpt3dadd(4,0,0,1)\n\tpt3dadd(4,0,1,1)\n\tpt3dadd(4,0,2,1)\n}\nsectionList[6]{\n\tpt3dadd(4,0,2,1)\n\tpt3dadd(4,0,3,1)\n\tpt3dadd(4,0,4,1)\n}\n':
print('arbor_to_nrn_morphology() --passed')
else:
print('arbor_to_nrn_morphology() --failed')
if self.arbor_to_nrn(arbor) == '//Building axon topology\n\ncreate sectionList[7]\nconnect sectionList[0](1), sectionList[1](0)\nconnect sectionList[1](1), sectionList[2](0)\nconnect sectionList[0](1), sectionList[3](0)\nconnect sectionList[3](1), sectionList[4](0)\nconnect sectionList[1](1), sectionList[5](0)\nconnect sectionList[5](1), sectionList[6](0)\n\n\n\n//Set up axon geometry\n\n//MAIN AXON\n\nsectionList[0]{\n\tpt3dadd(0,0,0,1)\n\tpt3dadd(1,0,0,1)\n\tpt3dadd(2,0,0,1)\n}\nsectionList[1]{\n\tpt3dadd(2,0,0,1)\n\tpt3dadd(3,0,0,1)\n\tpt3dadd(4,0,0,1)\n}\nsectionList[2]{\n\tpt3dadd(4,0,0,1)\n\tpt3dadd(5,0,0,1)\n\tpt3dadd(6,0,0,1)\n}\nsectionList[3]{\n\tpt3dadd(2,0,0,1)\n\tpt3dadd(2,1,0,1)\n\tpt3dadd(2,2,0,1)\n}\nsectionList[4]{\n\tpt3dadd(2,2,0,1)\n\tpt3dadd(2,3,0,1)\n\tpt3dadd(2,4,0,1)\n}\nsectionList[5]{\n\tpt3dadd(4,0,0,1)\n\tpt3dadd(4,0,1,1)\n\tpt3dadd(4,0,2,1)\n}\nsectionList[6]{\n\tpt3dadd(4,0,2,1)\n\tpt3dadd(4,0,3,1)\n\tpt3dadd(4,0,4,1)\n}\n\n\n':
print('arbor_to_nrn() --passed')
else:
print('arbor_to_nrn() --failed')
class Root2Py():
"""
This class is designed to take an existing morphology and write the topology and morphology to a .py file that can be used to run NEURON simulations using existing models.
```
nrn_writer = Root2Py()
nrn_writer.primarytest()
arbor = nrn_writer.test_arbor()
print(arbor)
nrn.arbor_to_nrn(arbor)
```
"""
def __init__(self):
pass
def strip_diameters_for_comparison(self,li):
if any(isinstance(i, list) for i in li):
newli = []
if any(isinstance(i, list) for i in li[0]):
for section in li:
newli.append([point[:3] for point in section])
return(newli)
else:
return([point[:3] for point in li])
else:
return(li[:3])
def lookup_section_by_point(self,arbor,point,home_branch):
sec_index = 0
for branch in arbor.keys():
if branch == home_branch:
continue
for section in arbor[branch]:
if self.strip_diameters_for_comparison(point) in self.strip_diameters_for_comparison(section):
return(sec_index,self.strip_diameters_for_comparison(section).index(self.strip_diameters_for_comparison(point))/float(len(section)-1))
else:
sec_index+=1
return(None,None)
def count_sections(self,arbor):
sec_count = 0
for branch in arbor.keys():
for section in arbor[branch]:
sec_count+=1
return(sec_count)
def build_section_indices(self,arbor):
"""
builds a dictionary of indices that match the arbor sections and is used to label sections while building the connections/topology
"""
section_indices = {}
sec_ind = 0
for branch in arbor.keys():
section_indices[branch] = []
for section in arbor[branch]:
section_indices[branch].append(sec_ind)
sec_ind+=1
return(section_indices)
def build_topology_list(self,arbor):
section_indices = self.build_section_indices(arbor)
connections = []
for branch in arbor.keys():
if branch != 0:
ind,position = self.lookup_section_by_point(arbor,arbor[branch][0][0],branch)
if ind==None:
raise(ValueError)
connections.append(([ind,int(position)],[section_indices[branch][0],0]))
for section in arbor[branch][:-1]:
connections.append(([section_indices[branch][arbor[branch].index(section)],1],[section_indices[branch][arbor[branch].index(section)]+1,0]))
return(connections)
def arbor_to_nrn_topology(self,arbor):
topo_list = self.build_topology_list(arbor)
number_of_sections = self.count_sections(arbor)
topo_func = '#Building axon topology\n\nfrom neuron import h\n\n'
topo_func+= f'sectionList = [h.Section() for i in range({number_of_sections})]'
for connection in topo_list:
topo_func+=f'\nsectionList[{connection[1][0]}].connect(sectionList[{connection[0][0]}]({connection[0][1]}),{connection[1][1]})'
return(topo_func+'\n')
def nrn_build_section(self,section_index,section_points):
nrn_command='\n\n'
for point in section_points:
if len(point) < 4:
nrn_command+=f'h.pt3dadd({point[0]},{point[1]},{point[2]},1,sec=sectionList[{section_index}])\n'
else:
nrn_command+=f'h.pt3dadd({point[0]},{point[1]},{point[2]},{point[3]},sec=sectionList[{section_index}])\n'
return(nrn_command)
def arbor_to_nrn_morphology(self,arbor):
"""
#Set up axon geometry
#MAIN AXON
node[0] = h.Section()
h.pt3dadd(-10338,2909.5,-316.24,nodeD,sec=node[0])
h.pt3dadd(-10338.3947,2910.3684,-315.94,nodeD,sec=node[0])
"""
nrn_morpho_func='\n#Set up axon geometry\n\n#MAIN AXON\n\n'
section_index = 0
for branch in arbor.keys():
for section in arbor[branch]:
nrn_morpho_func+=self.nrn_build_section(section_index,section)
section_index+=1
return(nrn_morpho_func)
def arbor_to_nrn(self,arbor,labels,target=os.getcwd()+'/testmorphology.py'):
topology_function = self.arbor_to_nrn_topology(arbor)
morphology_function = self.arbor_to_nrn_morphology(arbor)
with open(target,'w') as f:
f.write(topology_function+'\n\n'+morphology_function+'\n\n')
return(topology_function+'\n\n'+morphology_function+'\n\n')
def test_arbor(self):
arbor = {}
arbor[0] = [[[0,0,0,1],[1,0,0,1],[2,0,0,1]],[[2,0,0,1],[3,0,0,1],[4,0,0,1]],[[4,0,0,1],[5,0,0,1],[6,0,0,1]]]
arbor[1] = [[[2,0,0,1],[2,1,0,1],[2,2,0,1]],[[2,2,0,1],[2,3,0,1],[2,4,0,1]]]
arbor[2] = [[[4,0,0,1],[4,0,1,1],[4,0,2,1]],[[4,0,2,1],[4,0,3,1],[4,0,4,1]]]
return(arbor)
def primarytest(self):
arbor = self.test_arbor()
if self.lookup_section_by_point(arbor,[3,0,0,1])[0] == 1:
print('lookup_section_by_point() --passed')
else:
print('lookup_section_by_point() --failed')
if self.count_sections(arbor) == 7:
print('count_sections() --passed')
else:
print('count_sections() --failed')
if self.build_topology_list(arbor) == [([0, 1], [1, 0]), ([1, 1], [2, 0]), ([0, 1], [3, 0]), ([3, 1], [4, 0]), ([1, 1], [5, 0]), ([5, 1], [6, 0])]:
print('build_section_list() --passed\nbuild_section_indices() --passed')
else:
print('build_section_list() --failed\nbuild_section_indices() --failed')
if self.arbor_to_nrn_topology(arbor) == '//Building axon topology\n\ncreate sectionList[7]\nconnect sectionList[0](1), sectionList[1](0)\nconnect sectionList[1](1), sectionList[2](0)\nconnect sectionList[0](1), sectionList[3](0)\nconnect sectionList[3](1), sectionList[4](0)\nconnect sectionList[1](1), sectionList[5](0)\nconnect sectionList[5](1), sectionList[6](0)\n':
print('arbor_to_nrn_topology() --passed')
else:
print('arbor_to_nrn_topology() --failed')
if self.nrn_build_section(0,arbor[0][0]) =='sectionList[0]{\n\tpt3dadd(0,0,0,1)\n\tpt3dadd(1,0,0,1)\n\tpt3dadd(2,0,0,1)\n}\n':
print('nrn_build_section() --passed')
else:
print('nrn_build_section() --failed')
if self.arbor_to_nrn_morphology(arbor) =='\n//Set up axon geometry\n\n//MAIN AXON\n\nsectionList[0]{\n\tpt3dadd(0,0,0,1)\n\tpt3dadd(1,0,0,1)\n\tpt3dadd(2,0,0,1)\n}\nsectionList[1]{\n\tpt3dadd(2,0,0,1)\n\tpt3dadd(3,0,0,1)\n\tpt3dadd(4,0,0,1)\n}\nsectionList[2]{\n\tpt3dadd(4,0,0,1)\n\tpt3dadd(5,0,0,1)\n\tpt3dadd(6,0,0,1)\n}\nsectionList[3]{\n\tpt3dadd(2,0,0,1)\n\tpt3dadd(2,1,0,1)\n\tpt3dadd(2,2,0,1)\n}\nsectionList[4]{\n\tpt3dadd(2,2,0,1)\n\tpt3dadd(2,3,0,1)\n\tpt3dadd(2,4,0,1)\n}\nsectionList[5]{\n\tpt3dadd(4,0,0,1)\n\tpt3dadd(4,0,1,1)\n\tpt3dadd(4,0,2,1)\n}\nsectionList[6]{\n\tpt3dadd(4,0,2,1)\n\tpt3dadd(4,0,3,1)\n\tpt3dadd(4,0,4,1)\n}\n':
print('arbor_to_nrn_morphology() --passed')
else:
print('arbor_to_nrn_morphology() --failed')
if self.arbor_to_nrn(arbor) == '//Building axon topology\n\ncreate sectionList[7]\nconnect sectionList[0](1), sectionList[1](0)\nconnect sectionList[1](1), sectionList[2](0)\nconnect sectionList[0](1), sectionList[3](0)\nconnect sectionList[3](1), sectionList[4](0)\nconnect sectionList[1](1), sectionList[5](0)\nconnect sectionList[5](1), sectionList[6](0)\n\n\n\n//Set up axon geometry\n\n//MAIN AXON\n\nsectionList[0]{\n\tpt3dadd(0,0,0,1)\n\tpt3dadd(1,0,0,1)\n\tpt3dadd(2,0,0,1)\n}\nsectionList[1]{\n\tpt3dadd(2,0,0,1)\n\tpt3dadd(3,0,0,1)\n\tpt3dadd(4,0,0,1)\n}\nsectionList[2]{\n\tpt3dadd(4,0,0,1)\n\tpt3dadd(5,0,0,1)\n\tpt3dadd(6,0,0,1)\n}\nsectionList[3]{\n\tpt3dadd(2,0,0,1)\n\tpt3dadd(2,1,0,1)\n\tpt3dadd(2,2,0,1)\n}\nsectionList[4]{\n\tpt3dadd(2,2,0,1)\n\tpt3dadd(2,3,0,1)\n\tpt3dadd(2,4,0,1)\n}\nsectionList[5]{\n\tpt3dadd(4,0,0,1)\n\tpt3dadd(4,0,1,1)\n\tpt3dadd(4,0,2,1)\n}\nsectionList[6]{\n\tpt3dadd(4,0,2,1)\n\tpt3dadd(4,0,3,1)\n\tpt3dadd(4,0,4,1)\n}\n\n\n':
print('arbor_to_nrn() --passed')
else:
print('arbor_to_nrn() --failed')
| 39.460358 | 975 | 0.655908 | 2,610 | 15,429 | 3.751341 | 0.054023 | 0.026555 | 0.023287 | 0.020427 | 0.960372 | 0.946686 | 0.946686 | 0.933919 | 0.925748 | 0.925748 | 0 | 0.075011 | 0.144598 | 15,429 | 390 | 976 | 39.561538 | 0.666843 | 0.075896 | 0 | 0.894515 | 0 | 0.050633 | 0.417012 | 0.29928 | 0 | 0 | 0 | 0 | 0 | 1 | 0.101266 | false | 0.067511 | 0.008439 | 0 | 0.118143 | 0.118143 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 8 |
78999342d751698a722c70c0a4da1b093655480c | 11,951 | py | Python | api/orders_api.py | NikolayXHD/tinkoff-api-python | 4a4b71f7af1d752b8566299c058b712b513fa92f | [
"MIT"
] | null | null | null | api/orders_api.py | NikolayXHD/tinkoff-api-python | 4a4b71f7af1d752b8566299c058b712b513fa92f | [
"MIT"
] | null | null | null | api/orders_api.py | NikolayXHD/tinkoff-api-python | 4a4b71f7af1d752b8566299c058b712b513fa92f | [
"MIT"
] | null | null | null | from __future__ import annotations
from ..api_client import ApiClient
from .. import models
class OrdersApi(object):
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def orders_cancel_post(self, order_id, **kwargs):
"""Отмена заявки
:param str order_id: ID заявки (required)
:param str broker_account_id: Номер счета (по умолчанию - Тинькофф)
:rtype: None
"""
kwargs['_return_http_data_only'] = True
return self.orders_cancel_post_with_http_info(order_id, **kwargs)
def orders_cancel_post_with_http_info(self, order_id, **kwargs):
"""Отмена заявки
:param str order_id: ID заявки (required)
:param str broker_account_id: Номер счета (по умолчанию - Тинькофф)
:rtype: None
"""
all_params = ['order_id', 'broker_account_id']
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in params['kwargs'].items():
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
' to method orders_cancel_post' % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'order_id' is set
if 'order_id' not in params or params['order_id'] is None:
raise ValueError(
'Missing the required parameter `order_id` when calling '
'`orders_cancel_post`'
)
collection_formats = {}
path_params = {}
query_params = []
if 'order_id' in params:
query_params.append(('orderId', params['order_id']))
if 'broker_account_id' in params:
query_params.append(
('brokerAccountId', params['broker_account_id'])
)
header_params = {}
form_params = []
local_var_files = {}
body_params = None
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']
)
auth_settings = ['sso_auth']
return self.api_client.call_api(
'/orders/cancel',
'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Empty',
auth_settings=auth_settings,
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats,
)
def orders_get(self, **kwargs):
"""Получение списка активных заявок
:param str broker_account_id: Номер счета (по умолчанию - Тинькофф)
:rtype: models.OrdersResponse
"""
kwargs['_return_http_data_only'] = True
return self.orders_get_with_http_info(**kwargs)
def orders_get_with_http_info(self, **kwargs):
"""Получение списка активных заявок
:param str broker_account_id: Номер счета (по умолчанию - Тинькофф)
:rtype: models.OrdersResponse
"""
all_params = ['broker_account_id']
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in params['kwargs'].items():
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
' to method orders_get' % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
if 'broker_account_id' in params:
query_params.append(
('brokerAccountId', params['broker_account_id'])
)
header_params = {}
form_params = []
local_var_files = {}
body_params = None
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']
)
auth_settings = ['sso_auth']
return self.api_client.call_api(
'/orders',
'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='OrdersResponse',
auth_settings=auth_settings,
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats,
)
def orders_limit_order_post(self, body, figi, **kwargs):
"""Создание лимитной заявки
:param models.LimitOrderRequest body: (required)
:param str figi: FIGI инструмента (required)
:param str broker_account_id: Номер счета (по умолчанию - Тинькофф)
:rtype: models.LimitOrderResponse
"""
kwargs['_return_http_data_only'] = True
return self.orders_limit_order_post_with_http_info(
body, figi, **kwargs
)
def orders_limit_order_post_with_http_info(self, body, figi, **kwargs):
"""Создание лимитной заявки
:param models.LimitOrderRequest body: (required)
:param str figi: FIGI инструмента (required)
:param str broker_account_id: Номер счета (по умолчанию - Тинькофф)
:rtype: models.LimitOrderResponse
"""
all_params = ['body', 'figi', 'broker_account_id']
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in params['kwargs'].items():
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
' to method orders_limit_order_post' % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if 'body' not in params or params['body'] is None:
raise ValueError(
'Missing the required parameter `body` when calling '
'`orders_limit_order_post`'
)
# verify the required parameter 'figi' is set
if 'figi' not in params or params['figi'] is None:
raise ValueError(
'Missing the required parameter `figi` when calling '
'`orders_limit_order_post`'
)
collection_formats = {}
path_params = {}
query_params = []
if 'figi' in params:
query_params.append(('figi', params['figi']))
if 'broker_account_id' in params:
query_params.append(
('brokerAccountId', params['broker_account_id'])
)
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']
)
# HTTP header `Content-Type`
header_params[
'Content-Type'
] = self.api_client.select_header_content_type(['application/json'])
auth_settings = ['sso_auth']
return self.api_client.call_api(
'/orders/limit-order',
'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='LimitOrderResponse',
auth_settings=auth_settings,
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats,
)
def orders_market_order_post(self, body, figi, **kwargs):
"""Создание рыночной заявки
:param models.MarketOrderRequest body: (required)
:param str figi: FIGI инструмента (required)
:param str broker_account_id:
Уникальный идентификатор счета (по умолчанию - Тинькофф)
:rtype: models.MarketOrderResponse
"""
kwargs['_return_http_data_only'] = True
return self.orders_market_order_post_with_http_info(
body, figi, **kwargs
)
def orders_market_order_post_with_http_info(self, body, figi, **kwargs):
"""Создание рыночной заявки
:param models.MarketOrderRequest body: (required)
:param str figi: FIGI инструмента (required)
:param str broker_account_id:
Уникальный идентификатор счета (по умолчанию - Тинькофф)
:rtype: models.MarketOrderResponse
"""
all_params = ['body', 'figi', 'broker_account_id']
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in params['kwargs'].items():
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
' to method orders_market_order_post' % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if 'body' not in params or params['body'] is None:
raise ValueError(
'Missing the required parameter `body` when calling '
'`orders_market_order_post`'
)
# verify the required parameter 'figi' is set
if 'figi' not in params or params['figi'] is None:
raise ValueError(
'Missing the required parameter `figi` when calling '
'`orders_market_order_post`'
)
collection_formats = {}
path_params = {}
query_params = []
if 'figi' in params:
query_params.append(('figi', params['figi']))
if 'broker_account_id' in params:
query_params.append(
('brokerAccountId', params['broker_account_id'])
)
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']
)
# HTTP header `Content-Type`
header_params[
'Content-Type'
] = self.api_client.select_header_content_type(['application/json'])
auth_settings = ['sso_auth']
return self.api_client.call_api(
'/orders/market-order',
'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='MarketOrderResponse',
auth_settings=auth_settings,
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats,
)
| 33.382682 | 76 | 0.584721 | 1,252 | 11,951 | 5.25639 | 0.095048 | 0.039508 | 0.045586 | 0.043762 | 0.937851 | 0.925695 | 0.910652 | 0.894241 | 0.880261 | 0.853518 | 0 | 0 | 0.322735 | 11,951 | 357 | 77 | 33.47619 | 0.813071 | 0.146264 | 0 | 0.742857 | 0 | 0 | 0.19574 | 0.041886 | 0 | 0 | 0 | 0 | 0 | 1 | 0.036735 | false | 0 | 0.012245 | 0 | 0.085714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
78d0bdc2f767115ed6120eca12c4b3fff8ba1ad0 | 124 | py | Python | main/views/getting_started.py | uktrade/contractor-approval | 316ba7b2321f5aeea6dc83dcdaaadda887275f4d | [
"MIT"
] | null | null | null | main/views/getting_started.py | uktrade/contractor-approval | 316ba7b2321f5aeea6dc83dcdaaadda887275f4d | [
"MIT"
] | 1 | 2022-02-18T09:17:41.000Z | 2022-02-18T09:17:41.000Z | main/views/getting_started.py | uktrade/resourcing-approval | 316ba7b2321f5aeea6dc83dcdaaadda887275f4d | [
"MIT"
] | null | null | null | from django.shortcuts import render
def getting_started(request):
return render(request, "main/getting_started.html")
| 20.666667 | 55 | 0.790323 | 16 | 124 | 6 | 0.75 | 0.291667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.120968 | 124 | 5 | 56 | 24.8 | 0.880734 | 0 | 0 | 0 | 0 | 0 | 0.201613 | 0.201613 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0.333333 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 7 |
156a42c137d5dd06ad9d98589c35dcd62679ae73 | 7,944 | py | Python | cfgov/v1/migrations/0031_add_social_media_customization.py | cyVR/aur | 269dad2e659f7366e6eea037110d38ab41e3ad53 | [
"CC0-1.0"
] | null | null | null | cfgov/v1/migrations/0031_add_social_media_customization.py | cyVR/aur | 269dad2e659f7366e6eea037110d38ab41e3ad53 | [
"CC0-1.0"
] | null | null | null | cfgov/v1/migrations/0031_add_social_media_customization.py | cyVR/aur | 269dad2e659f7366e6eea037110d38ab41e3ad53 | [
"CC0-1.0"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import wagtail.wagtailcore.blocks
import wagtail.wagtailcore.fields
import wagtail.wagtailsnippets.blocks
from django.db import migrations, models
import v1.models.snippets
class Migration(migrations.Migration):
dependencies = [
('v1', '0030_adjust_feedback_default_text'),
]
operations = [
migrations.AlterField(
model_name='cfgovpage',
name='sidefoot',
field=wagtail.wagtailcore.fields.StreamField([(b'call_to_action', wagtail.wagtailcore.blocks.StructBlock([(b'slug_text', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'paragraph_text', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), (b'button', wagtail.wagtailcore.blocks.StructBlock([(b'text', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'url', wagtail.wagtailcore.blocks.CharBlock(default=b'/', required=False))]))])), (b'related_links', wagtail.wagtailcore.blocks.StructBlock([(b'heading', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'paragraph', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), (b'links', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailcore.blocks.StructBlock([(b'text', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'url', wagtail.wagtailcore.blocks.CharBlock(default=b'/', required=False))])))])), (b'related_posts', wagtail.wagtailcore.blocks.StructBlock([(b'limit', wagtail.wagtailcore.blocks.CharBlock(default=b'3', label=b'Limit')), (b'show_heading', wagtail.wagtailcore.blocks.BooleanBlock(help_text=b'This toggles the heading and icon for the related types.', default=True, required=False, label=b'Show Heading and Icon?')), (b'header_title', wagtail.wagtailcore.blocks.CharBlock(default=b'Further reading', label=b'Slug Title')), (b'relate_posts', wagtail.wagtailcore.blocks.BooleanBlock(default=True, required=False, editable=False, label=b'Blog Posts')), (b'relate_newsroom', wagtail.wagtailcore.blocks.BooleanBlock(default=True, required=False, editable=False, label=b'Newsroom')), (b'relate_events', wagtail.wagtailcore.blocks.BooleanBlock(default=True, required=False, label=b'Events')), (b'specific_categories', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailcore.blocks.ChoiceBlock(required=False, choices=[(b'Blog', ((b'At the CFPB', b'At the CFPB'), (b'Policy & Compliance', b'Policy & Compliance'), (b'Data, Research & Reports', b'Data, research & reports'), (b'Info for Consumers', b'Info for consumers'))), (b'Newsroom', ((b'Op-Ed', b'Op-Ed'), (b'Press Release', b'Press Release'), (b'Speech', b'Speech'), (b'Testimony', b'Testimony')))]), required=False))])), (b'related_metadata', wagtail.wagtailcore.blocks.StructBlock([(b'slug', wagtail.wagtailcore.blocks.CharBlock(max_length=100)), (b'content', wagtail.wagtailcore.blocks.StreamBlock([(b'text', wagtail.wagtailcore.blocks.StructBlock([(b'heading', wagtail.wagtailcore.blocks.CharBlock(max_length=100)), (b'blob', wagtail.wagtailcore.blocks.RichTextBlock())], icon=b'pilcrow')), (b'list', wagtail.wagtailcore.blocks.StructBlock([(b'heading', wagtail.wagtailcore.blocks.CharBlock(max_length=100)), (b'links', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailcore.blocks.StructBlock([(b'text', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'url', wagtail.wagtailcore.blocks.CharBlock(default=b'/', required=False))])))], icon=b'list-ul')), (b'date', wagtail.wagtailcore.blocks.StructBlock([(b'heading', wagtail.wagtailcore.blocks.CharBlock(max_length=100)), (b'date', wagtail.wagtailcore.blocks.DateBlock(required=False))], icon=b'date')), (b'topics', wagtail.wagtailcore.blocks.StructBlock([(b'heading', wagtail.wagtailcore.blocks.CharBlock(default=b'Topics', max_length=100)), (b'show_topics', wagtail.wagtailcore.blocks.BooleanBlock(default=True, required=False))], icon=b'tag'))])), (b'half_width', wagtail.wagtailcore.blocks.BooleanBlock(default=False, required=False))])), (b'email_signup', wagtail.wagtailcore.blocks.StructBlock([(b'heading', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'text', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'gd_code', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'form_field', wagtail.wagtailcore.blocks.ListBlock(wagtail.wagtailcore.blocks.StructBlock([(b'btn_text', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'required', wagtail.wagtailcore.blocks.BooleanBlock(required=False)), (b'info', wagtail.wagtailcore.blocks.RichTextBlock(required=False, label=b'Disclaimer')), (b'label', wagtail.wagtailcore.blocks.CharBlock(required=True)), (b'type', wagtail.wagtailcore.blocks.ChoiceBlock(required=False, choices=[(b'text', b'Text'), (b'checkbox', b'Checkbox'), (b'email', b'Email'), (b'number', b'Number'), (b'url', b'URL'), (b'radio', b'Radio')])), (b'placeholder', wagtail.wagtailcore.blocks.CharBlock(required=False))]), required=False, icon=b'mail'))])), (b'contact', wagtail.wagtailcore.blocks.StructBlock([(b'header', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'body', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), (b'contact', wagtail.wagtailsnippets.blocks.SnippetChooserBlock(v1.models.snippets.Contact))])), (b'sidebar_contact', wagtail.wagtailcore.blocks.StructBlock([(b'header', wagtail.wagtailcore.blocks.CharBlock(required=False)), (b'body', wagtail.wagtailcore.blocks.RichTextBlock(required=False)), (b'contact', wagtail.wagtailsnippets.blocks.SnippetChooserBlock(v1.models.snippets.Contact))])), (b'rss_feed', wagtail.wagtailcore.blocks.ChoiceBlock(choices=[(b'blog_feed', b'Blog Feed'), (b'newsroom_feed', b'Newsroom Feed')])), (b'social_media', wagtail.wagtailcore.blocks.StructBlock([(b'is_share_view', wagtail.wagtailcore.blocks.BooleanBlock(help_text=b'If unchecked, social media icons will link users to official CFPB accounts. Do not fill in any further fields.', default=True, required=False, label=b'Desired action: share this page')), (b'blurb', wagtail.wagtailcore.blocks.CharBlock(help_text=b'Sets the tweet text, email subject line, and LinkedIn post text.', default=b"Look what I found on the CFPB's site!", required=False)), (b'twitter_text', wagtail.wagtailcore.blocks.CharBlock(help_text=b'(Optional) Custom text for Twitter shares. If blank, will default to value of blurb field above.', max_length=100, required=False)), (b'twitter_related', wagtail.wagtailcore.blocks.CharBlock(help_text=b'(Optional) A comma-separated list of accounts related to the content of the shared URL. Do not enter the @ symbol. If blank, it will default to just "cfpb".', required=False)), (b'twitter_hashtags', wagtail.wagtailcore.blocks.CharBlock(help_text=b'(Optional) A comma-separated list of hashtags to be appended to default tweet text.', required=False)), (b'twitter_lang', wagtail.wagtailcore.blocks.CharBlock(help_text=b'(Optional) Loads text components in the specified language, if other than English. E.g., use "es" for Spanish. See https://dev.twitter.com/web/overview/languages for a list of supported language codes.', required=False)), (b'email_title', wagtail.wagtailcore.blocks.CharBlock(help_text=b'(Optional) Custom subject for email shares. If blank, will default to value of blurb field above.', required=False)), (b'email_text', wagtail.wagtailcore.blocks.CharBlock(help_text=b'(Optional) Custom text for email shares. If blank, will default to "Check out this page from the CFPB".', required=False)), (b'email_signature', wagtail.wagtailcore.blocks.CharBlock(help_text=b'(Optional) Adds a custom signature line to email shares. ', required=False)), (b'linkedin_title', wagtail.wagtailcore.blocks.CharBlock(help_text=b'(Optional) Custom title for LinkedIn shares. If blank, will default to value of blurb field above.', required=False)), (b'linkedin_text', wagtail.wagtailcore.blocks.CharBlock(help_text=b'(Optional) Custom text for LinkedIn shares.', required=False))]))], blank=True),
),
]
| 317.76 | 7,449 | 0.768127 | 1,060 | 7,944 | 5.69717 | 0.198113 | 0.223547 | 0.290114 | 0.180328 | 0.643981 | 0.596622 | 0.541646 | 0.489816 | 0.400894 | 0.381023 | 0 | 0.00378 | 0.067598 | 7,944 | 24 | 7,450 | 331 | 0.81153 | 0.002644 | 0 | 0 | 0 | 0.411765 | 0.295543 | 0.004166 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.352941 | 0 | 0.529412 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 8 |
ec92c0229166c60fbfc184906f1ec0f8de72b33a | 6,409 | py | Python | PatentBot/intent/Loki_IPC_Number.py | Chenct-jonathan/LokiHub | 7193589151e88f4e66aee6457926e565d0023fa1 | [
"MIT"
] | 17 | 2020-11-25T07:40:18.000Z | 2022-03-07T03:29:18.000Z | PatentBot/intent/Loki_IPC_Number.py | Chenct-jonathan/LokiHub | 7193589151e88f4e66aee6457926e565d0023fa1 | [
"MIT"
] | 8 | 2020-12-18T13:23:59.000Z | 2021-10-03T21:41:50.000Z | PatentBot/intent/Loki_IPC_Number.py | Chenct-jonathan/LokiHub | 7193589151e88f4e66aee6457926e565d0023fa1 | [
"MIT"
] | 43 | 2020-12-02T09:03:57.000Z | 2021-12-23T03:30:25.000Z | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
Loki module for IPC_Number
Input:
inputSTR str,
utterance str,
args str[],
resultDICT dict
Output:
resultDICT dict
"""
DEBUG_IPC_Number = True
userDefinedDICT = {"D": ["設計", "d"], "I": ["發明", "i"], "M": ["新型", "m"], "G06Q_020_24": ["信用方案", "信用", "後付", "pay after", "24"], "G06Q_020_26": ["轉帳方案", "轉帳", "現付", "pay now", "26"], "G06Q_020_28": ["預付方案", "預付", "pay before", "28"]}
# 將符合句型的參數列表印出。這是 debug 或是開發用的。
def debugInfo(inputSTR, utterance):
if DEBUG_IPC_Number:
print("[IPC_Number] {} ===> {}".format(inputSTR, utterance))
def getResult(inputSTR, utterance, args, resultDICT):
debugInfo(inputSTR, utterance)
if utterance == "G06Q-020[24]":
if args[0] in userDefinedDICT["G06Q_020_24"]:
resultDICT["IPC_Number"] = "G06Q_020_24"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[0] in userDefinedDICT["G06Q_020_26"]:
resultDICT["IPC_Number"] = "G06Q_020_26"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[0] in userDefinedDICT["G06Q_020_28"]:
resultDICT["IPC_Number"] = "G06Q_020_28"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
else:
pass
if utterance == "[24]":
if args[0] in userDefinedDICT["G06Q_020_24"]:
resultDICT["IPC_Number"] = "G06Q_020_24"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[0] in userDefinedDICT["G06Q_020_26"]:
resultDICT["IPC_Number"] = "G06Q_020_26"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[0] in userDefinedDICT["G06Q_020_28"]:
resultDICT["IPC_Number"] = "G06Q_020_28"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
else:
pass
if utterance == "[可以]找到[預付]的嗎":
if args[1] in userDefinedDICT["G06Q_020_24"]:
resultDICT["IPC_Number"]= "G06Q_020_24"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[1] in userDefinedDICT["G06Q_020_26"]:
resultDICT["IPC_Number"] = "G06Q_020_26"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[1] in userDefinedDICT["G06Q_020_28"]:
resultDICT["IPC_Number"] = "G06Q_020_28"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
else:
pass
if utterance == "[後付]的有哪些專利":
if args[0] in userDefinedDICT["G06Q_020_24"]:
resultDICT["IPC_Number"] = "G06Q_020_24"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[0] in userDefinedDICT["G06Q_020_26"]:
resultDICT["IPC_Number"] = "G06Q_020_26"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[0] in userDefinedDICT["G06Q_020_28"]:
resultDICT["IPC_Number"] = "G06Q_020_28"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
else:
pass
if utterance == "[我]想要比對跟[轉帳][相關]的專利":
if args[1] in userDefinedDICT["G06Q_020_24"]:
resultDICT["IPC_Number"]= "G06Q_020_24"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[1] in userDefinedDICT["G06Q_020_26"]:
resultDICT["IPC_Number"] = "G06Q_020_26"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[1] in userDefinedDICT["G06Q_020_28"]:
resultDICT["IPC_Number"] = "G06Q_020_28"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
else:
pass
if utterance == "[我]要找[預付]的":
if args[1] in userDefinedDICT["G06Q_020_24"]:
resultDICT["IPC_Number"]= "G06Q_020_24"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[1] in userDefinedDICT["G06Q_020_26"]:
resultDICT["IPC_Number"] = "G06Q_020_26"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[1] in userDefinedDICT["G06Q_020_28"]:
resultDICT["IPC_Number"] = "G06Q_020_28"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
else:
pass
if utterance == "[轉帳]的有嗎":
if args[0] in userDefinedDICT["G06Q_020_24"]:
resultDICT["IPC_Number"] = "G06Q_020_24"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[0] in userDefinedDICT["G06Q_020_26"]:
resultDICT["IPC_Number"] = "G06Q_020_26"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[0] in userDefinedDICT["G06Q_020_28"]:
resultDICT["IPC_Number"] = "G06Q_020_28"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
else:
pass
if utterance == "查[現付]的[相關]專利":
if args[0] in userDefinedDICT["G06Q_020_24"]:
resultDICT["IPC_Number"] = "G06Q_020_24"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[0] in userDefinedDICT["G06Q_020_26"]:
resultDICT["IPC_Number"] = "G06Q_020_26"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[0] in userDefinedDICT["G06Q_020_28"]:
resultDICT["IPC_Number"] = "G06Q_020_28"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
else:
pass
if utterance == "跟[預付]系統有關的是誰":
if args[0] in userDefinedDICT["G06Q_020_24"]:
resultDICT["IPC_Number"] = "G06Q_020_24"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[0] in userDefinedDICT["G06Q_020_26"]:
resultDICT["IPC_Number"] = "G06Q_020_26"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
elif args[0] in userDefinedDICT["G06Q_020_28"]:
resultDICT["IPC_Number"] = "G06Q_020_28"
resultDICT["msg"] = "您想找什麼類別? (設計、發明、新型)"
else:
pass
if utterance == "[我]想比對[轉帳]類別[下]跟[發明][相關]的專利":
confusion = []
for a in args[1:4]:
if a in userDefinedDICT["G06Q_020_24"]:
confusion.append("G06Q_020_24")
if a in userDefinedDICT["G06Q_020_26"]:
confusion.append("G06Q_020_26")
if a in userDefinedDICT["G06Q_020_28"]:
confusion.append("G06Q_020_28")
if len(confusion) > 1:
resultDICT["msg"] = "很抱歉,我不太清楚。請您再說明一次想比對哪個領域的專利文本,謝謝!"
elif len(confusion) == 1:
resultDICT["IPC_Number"] = confusion[0]
else:
pass
return resultDICT | 40.05625 | 233 | 0.551724 | 773 | 6,409 | 4.3674 | 0.117723 | 0.132701 | 0.186611 | 0.21327 | 0.784953 | 0.783175 | 0.759182 | 0.759182 | 0.759182 | 0.759182 | 0 | 0.10755 | 0.289125 | 6,409 | 160 | 234 | 40.05625 | 0.63345 | 0.036355 | 0 | 0.770992 | 0 | 0 | 0.29617 | 0.00978 | 0 | 0 | 0 | 0 | 0 | 1 | 0.015267 | false | 0.076336 | 0 | 0 | 0.022901 | 0.007634 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 9 |
eca9507c2e738bf2a10143bd77f585c3ea0ae64a | 12,703 | py | Python | python/simulation.py | somewhatdistracted/bipedal-AML | ad18570f315fd0b62747630e2e35c7ea42a97e21 | [
"MIT"
] | 1 | 2019-07-10T23:42:18.000Z | 2019-07-10T23:42:18.000Z | python/simulation.py | somewhatdistracted/bipedal-AML | ad18570f315fd0b62747630e2e35c7ea42a97e21 | [
"MIT"
] | null | null | null | python/simulation.py | somewhatdistracted/bipedal-AML | ad18570f315fd0b62747630e2e35c7ea42a97e21 | [
"MIT"
] | 1 | 2019-08-21T15:29:12.000Z | 2019-08-21T15:29:12.000Z | try:
import vrep
import time
import tensorflow as tf
import pandas as pd
import model_iterator
import math
import operator
except:
print ('--------------------------------------------------------------')
print ('"vrep.py" could not be imported. This means very probably that')
print ('either "vrep.py" or the remoteApi library could not be found.')
print ('Make sure both are in the same folder as this file,')
print ('or appropriately adjust the file "vrep.py"')
print ('--------------------------------------------------------------')
print ('')
def run_sim(model, clientID):
vrep.simxStartSimulation(clientID,vrep.simx_opmode_oneshot_wait) # start simulation
previousPosition = [-2.71879,-1.90075,36.263,1.35473,0.780061,-35.7055,-0.225083,-3.02226,1.82057,0.258116,-2.12325,1.061]
#RhipX,RhipY,RhipZ,LhipX,LhipY,LhipZ,RKneeZ,LKneeZ,RAnkleX,RAnkleZ,LAnkleX,LAnkleZ
legJoints = [0,0,0,0,0,0,0,0,0,0,0,0]
legJointInv = [1,1,1,-1,-1,1,1,1,1,1,-1,1]
hipJointInv = [1,1,1,1,1,-1,1,1,1,1,1,1]
returnCode01, legJoints[0] = vrep.simxGetObjectHandle(clientID, "rightLegJoint0", vrep.simx_opmode_blocking)
returnCode02, legJoints[1] = vrep.simxGetObjectHandle(clientID, "rightLegJoint1", vrep.simx_opmode_blocking)
returnCode03, legJoints[2] = vrep.simxGetObjectHandle(clientID, "rightLegJoint2", vrep.simx_opmode_blocking)
returnCode04, legJoints[6] = vrep.simxGetObjectHandle(clientID, "rightLegJoint3", vrep.simx_opmode_blocking)
returnCode05, legJoints[8] = vrep.simxGetObjectHandle(clientID, "rightLegJoint5", vrep.simx_opmode_blocking)
returnCode06, legJoints[9] = vrep.simxGetObjectHandle(clientID, "rightLegJoint4", vrep.simx_opmode_blocking)
returnCode07, legJoints[3] = vrep.simxGetObjectHandle(clientID, "leftLegJoint0", vrep.simx_opmode_blocking)
returnCode08, legJoints[4] = vrep.simxGetObjectHandle(clientID, "leftLegJoint1", vrep.simx_opmode_blocking)
returnCode09, legJoints[5] = vrep.simxGetObjectHandle(clientID, "leftLegJoint2", vrep.simx_opmode_blocking)
returnCode010, legJoints[7] = vrep.simxGetObjectHandle(clientID, "leftLegJoint3", vrep.simx_opmode_blocking)
returnCode011, legJoints[10] = vrep.simxGetObjectHandle(clientID, "leftLegJoint5", vrep.simx_opmode_blocking)
returnCode012, legJoints[11] = vrep.simxGetObjectHandle(clientID, "leftLegJoint4", vrep.simx_opmode_blocking)
returnCode013, head = vrep.simxGetObjectHandle(clientID, "Asti", vrep.simx_opmode_blocking)
returnCode013, r_foot = vrep.simxGetObjectHandle(clientID, "rightFoot", vrep.simx_opmode_blocking)
returnCode013, l_foot = vrep.simxGetObjectHandle(clientID, "leftFoot", vrep.simx_opmode_blocking)
#RhipX,RhipY,RhipZ,LhipX,LhipY,LhipZ,RKneeZ,LKneeZ,RAnkleX,RAnkleZ,LAnkleX,LAnkleZ
legPositions = [0,0,0,0,0,0,0,0,0,0,0,0]
headLocation = [1,1,1];
begin_r = [0,0,0]
begin_l = [0,0,0]
end_r = [0,0,0]
end_r = [0,0,0]
for i in range(12):
returnCode, legPositions[i] = vrep.simxGetJointPosition(clientID, legJoints[i], vrep.simx_opmode_streaming)
returncode, headLocation = vrep.simxGetObjectPosition(clientID, head, -1, vrep.simx_opmode_streaming)
returnCode, begin_r = vrep.simxGetObjectPosition(clientID, r_foot, -1, vrep.simx_opmode_streaming)
returnCode, begin_l = vrep.simxGetObjectPosition(clientID, l_foot, -1, vrep.simx_opmode_streaming)
start_time = int(round(time.time()))
while vrep.simxGetConnectionId(clientID) != -1 and ((headLocation[2] > 0.0 or headLocation[2] == 0.0) and ((int(round(time.time())) - start_time) < 100)):
for i in range(12):
returnCode, legPositions[i] = vrep.simxGetJointPosition(clientID, legJoints[i], vrep.simx_opmode_buffer)
# do something to the joints dummy right now
#remember to convert to radians and back
degreeLegPositions = [0,0,0,0,0,0,0,0,0,0,0,0]
for i in range(len(legPositions)):
degreeLegPositions[i] = legPositions[i] * legJointInv[i] * 180 / math.pi
inputData = []
for element in degreeLegPositions:
inputData.append(element)
newJointPositions = model_iterator.runModel(model,[tuple(inputData)])
newJointPositions = newJointPositions[0]
for i in range(len(newJointPositions)):
newJointPositions[i] = newJointPositions[i] * math.pi / 180
vrep.simxPauseCommunication(clientID,1)
for i in range(12):
vrep.simxSetJointTargetPosition(clientID,legJoints[i],newJointPositions[i] * legJointInv[i] * hipJointInv[i],vrep.simx_opmode_oneshot)
vrep.simxPauseCommunication(clientID,0)
time.sleep(0.001)
returncode, headLocation = vrep.simxGetObjectPosition(clientID, head, -1, vrep.simx_opmode_buffer)
returnCode, end_r = vrep.simxGetObjectPosition(clientID, r_foot, -1, vrep.simx_opmode_buffer)
returnCode, end_l = vrep.simxGetObjectPosition(clientID, l_foot, -1, vrep.simx_opmode_buffer)
distanceTraveled = (((end_r[1] + end_l[1])/2) - ((begin_r[1] + begin_l[1])/2))
vrep.simxStopSimulation(clientID,vrep.simx_opmode_oneshot_wait)
time.sleep(0.25)
return distanceTraveled
def run_sim_direction(model, clientID):
vrep.simxStartSimulation(clientID,vrep.simx_opmode_oneshot_wait) # start simulation
previousPosition = [-2.71879,-1.90075,36.263,1.35473,0.780061,-35.7055,-0.225083,-3.02226,1.82057,0.258116,-2.12325,1.061]
#RhipX,RhipY,RhipZ,LhipX,LhipY,LhipZ,RKneeZ,LKneeZ,RAnkleX,RAnkleZ,LAnkleX,LAnkleZ
legJoints = [0,0,0,0,0,0,0,0,0,0,0,0]
legJointInv = [1,1,1,-1,-1,1,1,1,1,1,-1,1]
returnCode01, legJoints[0] = vrep.simxGetObjectHandle(clientID, "rightLegJoint0", vrep.simx_opmode_blocking)
returnCode02, legJoints[1] = vrep.simxGetObjectHandle(clientID, "rightLegJoint1", vrep.simx_opmode_blocking)
returnCode03, legJoints[2] = vrep.simxGetObjectHandle(clientID, "rightLegJoint2", vrep.simx_opmode_blocking)
returnCode04, legJoints[6] = vrep.simxGetObjectHandle(clientID, "rightLegJoint3", vrep.simx_opmode_blocking)
returnCode05, legJoints[8] = vrep.simxGetObjectHandle(clientID, "rightLegJoint5", vrep.simx_opmode_blocking)
returnCode06, legJoints[9] = vrep.simxGetObjectHandle(clientID, "rightLegJoint4", vrep.simx_opmode_blocking)
returnCode07, legJoints[3] = vrep.simxGetObjectHandle(clientID, "leftLegJoint0", vrep.simx_opmode_blocking)
returnCode08, legJoints[4] = vrep.simxGetObjectHandle(clientID, "leftLegJoint1", vrep.simx_opmode_blocking)
returnCode09, legJoints[5] = vrep.simxGetObjectHandle(clientID, "leftLegJoint2", vrep.simx_opmode_blocking)
returnCode010, legJoints[7] = vrep.simxGetObjectHandle(clientID, "leftLegJoint3", vrep.simx_opmode_blocking)
returnCode011, legJoints[10] = vrep.simxGetObjectHandle(clientID, "leftLegJoint5", vrep.simx_opmode_blocking)
returnCode012, legJoints[11] = vrep.simxGetObjectHandle(clientID, "leftLegJoint4", vrep.simx_opmode_blocking)
returnCode013, head = vrep.simxGetObjectHandle(clientID, "Asti", vrep.simx_opmode_blocking)
returnCode013, r_foot = vrep.simxGetObjectHandle(clientID, "rightFoot", vrep.simx_opmode_blocking)
returnCode013, l_foot = vrep.simxGetObjectHandle(clientID, "leftFoot", vrep.simx_opmode_blocking)
#RhipX,RhipY,RhipZ,LhipX,LhipY,LhipZ,RKneeZ,LKneeZ,RAnkleX,RAnkleZ,LAnkleX,LAnkleZ
legPositions = [0,0,0,0,0,0,0,0,0,0,0,0]
headLocation = [1,1,1];
begin_r = [0,0,0]
begin_l = [0,0,0]
end_r = [0,0,0]
end_r = [0,0,0]
for i in range(12):
returnCode, legPositions[i] = vrep.simxGetJointPosition(clientID, legJoints[i], vrep.simx_opmode_streaming)
returncode, headLocation = vrep.simxGetObjectPosition(clientID, head, -1, vrep.simx_opmode_streaming)
returnCode, begin_r = vrep.simxGetObjectPosition(clientID, r_foot, -1, vrep.simx_opmode_streaming)
returnCode, begin_l = vrep.simxGetObjectPosition(clientID, l_foot, -1, vrep.simx_opmode_streaming)
start_time = int(round(time.time()))
while vrep.simxGetConnectionId(clientID) != -1 and ((headLocation[2] > 0.5 or headLocation[2] == 0.0) and ((int(round(time.time())) - start_time) < 5)):
for i in range(12):
returnCode, legPositions[i] = vrep.simxGetJointPosition(clientID, legJoints[i], vrep.simx_opmode_buffer)
# do something to the joints dummy right now
#remember to convert to radians and back
degreeLegPositions = [0,0,0,0,0,0,0,0,0,0,0,0]
for i in range(len(legPositions)):
degreeLegPositions[i] = legPositions[i] * legJointInv[i] * 180 / math.pi
inputData = []
for element in degreeLegPositions:
inputData.append(element)
for element in previousPosition:
inputData.append(element)
previousPosition = degreeLegPositions
newJointPositions = model_iterator.runModel(model,[tuple(inputData)])
newJointPositions = newJointPositions[0]
for i in range(len(newJointPositions)):
newJointPositions[i] = newJointPositions[i] * math.pi / 180
vrep.simxPauseCommunication(clientID,1)
for i in range(12):
vrep.simxSetJointTargetPosition(clientID,legJoints[i],newJointPositions[i] * legJointInv[i],vrep.simx_opmode_oneshot)
vrep.simxPauseCommunication(clientID,0)
time.sleep(0.01)
returncode, headLocation = vrep.simxGetObjectPosition(clientID, head, -1, vrep.simx_opmode_buffer)
returnCode, end_r = vrep.simxGetObjectPosition(clientID, r_foot, -1, vrep.simx_opmode_buffer)
returnCode, end_l = vrep.simxGetObjectPosition(clientID, l_foot, -1, vrep.simx_opmode_buffer)
distanceTraveled = (((end_r[1] + end_l[1])/2) - ((begin_r[1] + begin_l[1])/2))
vrep.simxStopSimulation(clientID,vrep.simx_opmode_oneshot_wait)
time.sleep(0.25)
return distanceTraveled
def run_sim_data(subject, clientID):
vrep.simxStartSimulation(clientID,vrep.simx_opmode_oneshot_wait) # start
#RhipX,RhipY,RhipZ,LhipX,LhipY,LhipZ,RKneeZ,LKneeZ,RAnkleX,RAnkleZ,LAnkleX,LAnkleZ
legJoints = [0,0,0,0,0,0,0,0,0,0,0,0]
#RhipX,RhipY,RhipZ,LhipX,LhipY,LhipZ,RKneeZ,LKneeZ,RAnkleX,RAnkleZ,LAnkleX,LAnkleZ
legPositions = [0,0,0,0,0,0,0,0,0,0,0,0]
legJointInv = [1,1,1,-1,-1,1,1,1,1,1,-1,1]
hipJointInv = [1,1,1,1,1,1,1,1,1,1,1,1]
returnCode01, legJoints[0] = vrep.simxGetObjectHandle(clientID, "rightLegJoint0", vrep.simx_opmode_blocking)
returnCode02, legJoints[1] = vrep.simxGetObjectHandle(clientID, "rightLegJoint1", vrep.simx_opmode_blocking)
returnCode03, legJoints[2] = vrep.simxGetObjectHandle(clientID, "rightLegJoint2", vrep.simx_opmode_blocking)
returnCode04, legJoints[6] = vrep.simxGetObjectHandle(clientID, "rightLegJoint3", vrep.simx_opmode_blocking)
returnCode05, legJoints[8] = vrep.simxGetObjectHandle(clientID, "rightLegJoint5", vrep.simx_opmode_blocking)
returnCode06, legJoints[9] = vrep.simxGetObjectHandle(clientID, "rightLegJoint4", vrep.simx_opmode_blocking)
returnCode07, legJoints[3] = vrep.simxGetObjectHandle(clientID, "leftLegJoint0", vrep.simx_opmode_blocking)
returnCode08, legJoints[4] = vrep.simxGetObjectHandle(clientID, "leftLegJoint1", vrep.simx_opmode_blocking)
returnCode09, legJoints[5] = vrep.simxGetObjectHandle(clientID, "leftLegJoint2", vrep.simx_opmode_blocking)
returnCode010, legJoints[7] = vrep.simxGetObjectHandle(clientID, "leftLegJoint3", vrep.simx_opmode_blocking)
returnCode011, legJoints[10] = vrep.simxGetObjectHandle(clientID, "leftLegJoint5", vrep.simx_opmode_blocking)
returnCode012, legJoints[11] = vrep.simxGetObjectHandle(clientID, "leftLegJoint4", vrep.simx_opmode_blocking)
returnCode013, head = vrep.simxGetObjectHandle(clientID, "Asti", vrep.simx_opmode_blocking)
headLocation = [1,1,1];
returncode, headLocation = vrep.simxGetObjectPosition(clientID, head, -1, vrep.simx_opmode_streaming)
for i in range(12):
returnCode, legPositions[i] = vrep.simxGetJointPosition(clientID, legJoints[i], vrep.simx_opmode_streaming)
#RhipX,RhipY,RhipZ,LhipX,LhipY,LhipZ,RKneeZ,LKneeZ,RAnkleX,RAnkleZ,LAnkleX,LAnkleZ
start_time = int(round(time.time()))
while vrep.simxGetConnectionId(clientID) != -1 and ((headLocation[2] > 0.3 or headLocation[2] == 0.0) and ((int(round(time.time())) - start_time) < 100)):
for j in range(((subject * 101)),((subject * 101) + 202)):
for i in range(12):
returnCode, legPositions[i] = vrep.simxGetJointPosition(clientID, legJoints[i], vrep.simx_opmode_buffer)
joint_data = model_iterator.getActual(j)
newJointPositions = [0,0,0,0,0,0,0,0,0,0,0,0]
for i in range(len(newJointPositions)):
joint_data[i] = joint_data[i] * math.pi / 180
newJointPositions[i] = joint_data[i] * legJointInv[i] * hipJointInv[i]
print(j)
print(newJointPositions)
print()
vrep.simxPauseCommunication(clientID,1)
for i in range(12):
vrep.simxSetJointTargetPosition(clientID,legJoints[i],newJointPositions[i],vrep.simx_opmode_oneshot)
vrep.simxPauseCommunication(clientID,0)
time.sleep(0.01)
vrep.simxStopSimulation(clientID,vrep.simx_opmode_oneshot_wait)
time.sleep(0.25)
return | 51.42915 | 155 | 0.75675 | 1,636 | 12,703 | 5.751834 | 0.113081 | 0.025292 | 0.031243 | 0.034431 | 0.934325 | 0.930499 | 0.930499 | 0.928693 | 0.928693 | 0.928693 | 0 | 0.056844 | 0.103991 | 12,703 | 247 | 156 | 51.42915 | 0.7699 | 0.060694 | 0 | 0.792135 | 0 | 0 | 0.073167 | 0.010404 | 0 | 0 | 0 | 0 | 0 | 1 | 0.016854 | false | 0 | 0.044944 | 0 | 0.078652 | 0.05618 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
ecbaff72316243dcc46d100cb8345e3ca8be7c03 | 116 | py | Python | RetinaNet/model/__init__.py | sun1638650145/RetinaNet | 357edda03cdc1f976764b6ed4fcad6e639646142 | [
"Apache-2.0"
] | 2 | 2021-09-23T09:32:19.000Z | 2022-02-16T06:59:03.000Z | RetinaNet/model/__init__.py | sun1638650145/RetinaNet | 357edda03cdc1f976764b6ed4fcad6e639646142 | [
"Apache-2.0"
] | null | null | null | RetinaNet/model/__init__.py | sun1638650145/RetinaNet | 357edda03cdc1f976764b6ed4fcad6e639646142 | [
"Apache-2.0"
] | null | null | null | from RetinaNet.model.retina_net import create_inference_model
from RetinaNet.model.retina_net import RetinaNetModel
| 38.666667 | 61 | 0.896552 | 16 | 116 | 6.25 | 0.5625 | 0.26 | 0.36 | 0.48 | 0.66 | 0.66 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068966 | 116 | 2 | 62 | 58 | 0.925926 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 8 |
eccff8c2c3c01e9c60e4bb2ac4bb44d13d901ab3 | 5,831 | py | Python | easygraph/functions/drawing/plot.py | coreturn/Easy-Graph | ee46d84250c4d4cf22271ca13449b15fad88ad7b | [
"BSD-3-Clause"
] | 41 | 2020-09-26T13:44:07.000Z | 2022-03-19T08:57:45.000Z | easygraph/functions/drawing/plot.py | coreturn/Easy-Graph | ee46d84250c4d4cf22271ca13449b15fad88ad7b | [
"BSD-3-Clause"
] | 14 | 2020-09-26T03:29:08.000Z | 2022-03-29T02:47:17.000Z | easygraph/functions/drawing/plot.py | coreturn/Easy-Graph | ee46d84250c4d4cf22271ca13449b15fad88ad7b | [
"BSD-3-Clause"
] | 8 | 2020-09-27T08:10:56.000Z | 2022-03-29T08:48:16.000Z | import numpy as np
from matplotlib import pyplot as plt
import matplotlib
import statsmodels.api as sm
import easygraph as eg
__all__=[
"plot_Followers",
"plot_Connected_Communities",
"plot_Betweenness_Centrality",
"plot_Neighborhood_Followers"
]
# Number of Followers
def plot_Followers(G,SHS):
"""
Returns the CDF curves of "Number of Followers" of SH spanners and ordinary users in graph G.
Parameters
----------
G : graph
A easygraph graph.
SHS : list
The SH Spanners in graph G.
Returns
-------
plt : CDF curves
the CDF curves of "Number of Followers" of SH spanners and ordinary users in graph G.
"""
OU=[]
for i in G:
if i not in SHS:
OU.append(i)
degree=G.degree()
sample1=[]
sample2=[]
for i in degree.keys():
if i in OU:
sample1.append(degree[i])
elif i in SHS:
sample2.append(degree[i])
X1=np.linspace(min(sample1), max(sample1))
ecdf = sm.distributions.ECDF(sample1)
Y1=ecdf(X1)
X2=np.linspace(min(sample2), max(sample2))
ecdf = sm.distributions.ECDF(sample2)
Y2=ecdf(X2)
plt.plot(X1,Y1,'b--',label='Ordinary User')
plt.plot(X2,Y2,'r',label='SH Spanner')
plt.title('Number of Followers')
plt.xlabel('Number of Followers')
plt.ylabel('Cumulative Distribution Function')
plt.legend(loc='lower right')
plt.show()
# Number of Connected Communities
def plot_Connected_Communities(G,SHS):
"""
Returns the CDF curves of "Number of Connected Communities" of SH spanners and ordinary users in graph G.
Parameters
----------
G : graph
A easygraph graph.
SHS : list
The SH Spanners in graph G.
Returns
-------
plt : CDF curves
the CDF curves of "Number of Connected Communities" of SH spanners and ordinary users in graph G.
"""
OU=[]
for i in G:
if i not in SHS:
OU.append(i)
sample1=[]
sample2=[]
cmts=eg.LPA(G)
for i in OU:
s=set()
neighbors=G.neighbors(node=i)
for j in neighbors:
for k in cmts:
if j in cmts[k]:
s.add(k)
sample1.append(len(s))
for i in SHS:
s=set()
neighbors=G.neighbors(node=i)
for j in neighbors:
for k in cmts:
if j in cmts[k]:
s.add(k)
sample2.append(len(s))
print(len(cmts))
print(sample1)
print(sample2)
X1=np.linspace(min(sample1), max(sample1))
ecdf = sm.distributions.ECDF(sample1)
Y1=ecdf(X1)
X2=np.linspace(min(sample2), max(sample2))
ecdf = sm.distributions.ECDF(sample2)
Y2=ecdf(X2)
plt.plot(X1,Y1,'b--',label='Ordinary User')
plt.plot(X2,Y2,'r',label='SH Spanner')
plt.title('Number of Connected Communities')
plt.xlabel('Number of Connected Communities')
plt.ylabel('Cumulative Distribution Function')
plt.legend(loc='lower right')
plt.show()
# Betweenness Centrality
def plot_Betweenness_Centrality(G,SHS):
"""
Returns the CDF curves of "Betweenness Centralitys" of SH spanners and ordinary users in graph G.
Parameters
----------
G : graph
A easygraph graph.
SHS : list
The SH Spanners in graph G.
Returns
-------
plt : CDF curves
the CDF curves of "Betweenness Centrality" of SH spanners and ordinary users in graph G.
"""
OU=[]
for i in G:
if i not in SHS:
OU.append(i)
bc=eg.betweenness_centrality(G)
sample1=[]
sample2=[]
for i in bc.keys():
if i in OU:
sample1.append(bc[i])
elif i in SHS:
sample2.append(bc[i])
X1=np.linspace(min(sample1), max(sample1))
ecdf = sm.distributions.ECDF(sample1)
Y1=ecdf(X1)
X2=np.linspace(min(sample2), max(sample2))
ecdf = sm.distributions.ECDF(sample2)
Y2=ecdf(X2)
plt.plot(X1,Y1,'b--',label='Ordinary User')
plt.plot(X2,Y2,'r',label='SH Spanner')
plt.title('Betweenness Centrality')
plt.xlabel('Betweenness Centrality')
plt.ylabel('Cumulative Distribution Function')
plt.legend(loc='lower right')
plt.show()
# Arg. Number of Followers of the Neighborhood Users
def plot_Neighborhood_Followers(G,SHS):
"""
Returns the CDF curves of "Arg. Number of Followers of the Neighborhood Users" of SH spanners and ordinary users in graph G.
Parameters
----------
G : graph
A easygraph graph.
SHS : list
The SH Spanners in graph G.
Returns
-------
plt : CDF curves
the CDF curves of "Arg. Number of Followers of the Neighborhood Users
" of SH spanners and ordinary users in graph G.
"""
OU=[]
for i in G:
if i not in SHS:
OU.append(i)
sample1=[]
sample2=[]
degree=G.degree()
for i in OU:
num=0
sum=0
for neighbor in G.neighbors(node=i):
num=num+1
sum=sum+degree[neighbor]
sample1.append(sum/num)
for i in SHS:
num=0
sum=0
for neighbor in G.neighbors(node=i):
num=num+1
sum=sum+degree[neighbor]
sample2.append(sum/num)
X1=np.linspace(min(sample1), max(sample1))
ecdf = sm.distributions.ECDF(sample1)
Y1=ecdf(X1)
X2=np.linspace(min(sample2), max(sample2))
ecdf = sm.distributions.ECDF(sample2)
Y2=ecdf(X2)
plt.plot(X1,Y1,'b--',label='Ordinary User')
plt.plot(X2,Y2,'r',label='SH Spanner')
plt.title('Arg. Number of Followers of the Neighborhood Users')
plt.xlabel('Arg. Number of Followers of the Neighborhood Users')
plt.ylabel('Cumulative Distribution Function')
plt.legend(loc='lower right')
plt.show()
| 27.375587 | 128 | 0.600583 | 807 | 5,831 | 4.315985 | 0.11772 | 0.034453 | 0.027562 | 0.032156 | 0.802182 | 0.769739 | 0.769739 | 0.734999 | 0.714614 | 0.683319 | 0 | 0.020962 | 0.280055 | 5,831 | 213 | 129 | 27.375587 | 0.808718 | 0.25656 | 0 | 0.724638 | 0 | 0 | 0.150438 | 0.019474 | 0 | 0 | 0 | 0 | 0 | 1 | 0.028986 | false | 0 | 0.036232 | 0 | 0.065217 | 0.021739 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 |
01a923682c1429fb44ef7971c3973b21a2e7a56f | 61,298 | py | Python | chessa.py | sudhirdevapalan/chess | 2ed7a4d40e7cf86774499f0deb76564657aebe0e | [
"MIT"
] | null | null | null | chessa.py | sudhirdevapalan/chess | 2ed7a4d40e7cf86774499f0deb76564657aebe0e | [
"MIT"
] | null | null | null | chessa.py | sudhirdevapalan/chess | 2ed7a4d40e7cf86774499f0deb76564657aebe0e | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import random
import datetime
import sys
import Tkinter
from Tkinter import *
import tkMessageBox
from PIL import Image,ImageTk
import PIL
import time
#import pdb;pdb.set_trace()
global draw,promo
global b,gx,gy,gv
b=[]
draw=0
promo=0
class board:
occupied=[0,'w','b']
rank=['pawn','bishop','knight','rook','queen','king']
init=[0,1]
enpass=[0,1]
value=0
attacker=0
defense=0
attack=0
#global b
def init(self,i,j):
if i==6:
self.rank='pawn'
self.occupied='w'
self.init=1
self.enpass=0
self.value=1
self.attacker=0
self.defense=0
self.attack=0
b[i][j].configure(image=wpawn)
elif i==1:
self.rank='pawn'
self.occupied='b'
self.init=1
self.enpass=0
self.value=1
self.attacker=0
self.defense=0
self.attack=0
b[i][j].configure(image=bpawn)
elif i==7 and (j==0 or j==7):
self.rank='rook'
self.occupied='w'
self.init=1
self.enpass=0
self.value=8
self.attacker=0
self.defense=0
self.attack=0
b[i][j].configure(image=wrook)
elif i==0 and (j==0 or j==7):
self.rank='rook'
self.occupied='b'
self.init=1
self.enpass=0
self.value=8
self.attacker=0
self.defense=0
self.attack=0
b[i][j].configure(image=brook)
elif i==7 and (j==1 or j==6):
self.rank='knight'
self.occupied='w'
self.init=1
self.enpass=0
self.value=4
self.attacker=0
self.defense=0
self.attack=0
b[i][j].configure(image=wknight)
elif i==0 and (j==1 or j==6):
self.rank='knight'
self.occupied='b'
self.init=1
self.enpass=0
self.value=4
self.attacker=0
self.defense=0
self.attack=0
b[i][j].configure(image=bknight)
elif i==7 and (j==2 or j==5):
self.rank='bishop'
self.occupied='w'
self.init=1
self.enpass=0
self.value=2
self.attacker=0
self.defense=0
self.attack=0
b[i][j].configure(image=wbishop)
elif i==0 and (j==2 or j==5):
self.rank='bishop'
self.occupied='b'
self.init=1
self.enpass=0
self.value=2
self.attacker=0
self.defense=0
self.attack=0
b[i][j].configure(image=bbishop)
elif i==7 and j==3:
self.rank='queen'
self.occupied='w'
self.init=1
self.enpass=0
self.value=16
self.attacker=0
self.defense=0
self.attack=0
b[i][j].configure(image=wqueen)
elif i==0 and j==3:
self.rank='queen'
self.occupied='b'
self.init==1
self.enpass=0
self.value=16
self.attacker=0
self.defense=0
self.attack=0
b[i][j].configure(image=bqueen)
elif i==7 and j==4:
self.rank='king'
self.occupied='w'
self.init=1
self.enpass=0
self.value=32
self.attacker=0
self.defense=0
self.attack=0
b[i][j].configure(image=wking)
elif i==0 and j==4:
self.rank='king'
self.occupied='b'
self.init=1
self.enpass=0
self.value=32
self.attacker=0
self.defense=0
self.attack=0
b[i][j].configure(image=bking)
else:
self.rank=''
self.occupied=0
self.init=''
self.enpass=''
self.attacker=0
self.defense=0
self.value=0
self.attack=0
def score(self,i,j): #Generate the variables needed to make decision, Provide multi dim array for gx and gy
if self.occupied==0:
self.value=0
elif self.rank=='pawn':
self.value=1
elif self.rank=='bishop':
self.value=2
elif self.rank=='knight':
self.value=3
elif self.rank=='rook':
self.value=4
elif self.rank=='queen':
self.value=5
elif self.rank=='king':
self.value=6
if self.occupied=='b':
self.attacker=box[i][j].assess(i,j,'b','w')
self.defence=box[i][j].assess(i,j,'b','b')
#self.attackf=box[i][j].attack(i,j,'b','w')
elif self.occupied=='w':
self.attacker=box[i][j].assess(i,j,'w','b')
self.defence=box[i][j].assess(i,j,'w','w')
#self.attackf=box[i][j].attack(i,j,'w','b')
else:
pass
def disp1(self,i,j): #Not used
if i==0 and j==0:
sys.stdout.write(" 0 1 2 3 4 5 6 7")
if j==0:
sys.stdout.write("\n------------------------------------------------------------------------\n")
sys.stdout.write(str(i))
if self.occupied=='w':
sys.stdout.write("|")
if self.rank=='pawn':
sys.stdout.write(" w-pawn ")
elif self.rank=='rook':
sys.stdout.write(" w-rook ")
elif self.rank=='knight':
sys.stdout.write("w-knight")
elif self.rank=='bishop':
sys.stdout.write("w-bishop")
elif self.rank=='queen':
sys.stdout.write("w-queen ")
elif self.rank=='king':
sys.stdout.write(" w-king ")
elif self.occupied=='b':
sys.stdout.write("|")
if self.rank=='pawn':
sys.stdout.write(" b-pawn ")
elif self.rank=='rook':
sys.stdout.write(" b-rook ")
elif self.rank=='knight':
sys.stdout.write("b-knight")
elif self.rank=='bishop':
sys.stdout.write("b-bishop")
elif self.rank=='queen':
sys.stdout.write("b-queen ")
elif self.rank=='king':
sys.stdout.write(" b-king ")
else:
sys.stdout.write("| ")
if j==7:
sys.stdout.write("|")
if i==7 and j==7:
sys.stdout.write("\n------------------------------------------------------------------------")
print("\n")
def confirm(self,x1,y1,x2,y2,player): #Check if move is valid, if so complete the coin move
global b,spin,px,py,bb,draw,promo
#print "here",player
temp_occ=self.occupied
temp_rank=self.rank
temp_init=self.init
prev_init=box[x1][y1].init
prev_enpass=self.enpass
self.init=0
self.occupied=player
self.enpass=box[x1][y1].enpass
self.rank=box[x1][y1].rank
box[x1][y1].occupied=0
box[x1][y1].rank=''
box[x1][y1].init=0
box[x1][y1].enpass=0
#print "solution ",king_locate(player)
if king_locate(player)==1:
#print "Cannot move there(Your king will be exposed)"
tkMessageBox.showinfo("Alert","Your king is in danger!")
box[x1][y1].occupied=player
box[x1][y1].rank=self.rank
box[x1][y1].init=prev_init
self.occupied=temp_occ
self.rank=temp_rank
self.init=temp_init
self.enpass=0
return 0
else:
name=box[x2][y2].occupied+box[x2][y2].rank+".png"
#print name
photo1 = Image.open(name)
photo=ImageTk.PhotoImage(photo1)
b[x2][y2].config(image=photo)
b[x2][y2].image=photo
b[x1][y1].config(image=blank)
b[x1][y1].image=blank
if self.rank=='pawn' and (x2==0 or x2==7):
promo=1
px=x2
py=y2
spin=Spinbox(c,values=('queen','knight','rook','bishop'), state="readonly", width=10)
spin.grid(row=8,column=0)
bb=Button(c,text="Promote",command=accept)
bb.grid(row=8,column=1)
for i in range(8):
for j in range(8):
box[i][j].score(i,j) #Assessing the game
if box[i][j].enpass==2: #enpass tracking
box[i][j].enpass=1
elif box[i][j].enpass==1:
box[i][j].enpass=0
else:
box[i][j].enpass=0
stale=0
if player=='w': #Check for stalemate scenario
stale=stalemate('b')
else:
stale=stalemate('w')
if stale==0:
#tkMessageBox.showinfo("Game Over!","Stalemate!!")
#time.sleep(1)
#sys.exit(0)
draw=1
return 1
def pawn_moves(self,player,x1,y1,x2,y2): #Validating each coin move
if player=='w':
#print "ththytjhytj",x1,y2,box[x1][y2].enpass,box[x1][y2].occupied
if self.init==1:
if (x2==int(x1)-1 or x2==int(x1)-2) and y2==y1 and box[int(x2)][int(y2)].occupied==0:
if x2==int(x1)-2:
self.enpass=2
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
elif (y2==y1+1 or y2==y1-1) and x2==x1-1 and box[int(x2)][int(y2)].occupied=='b':
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
elif y2==y1+1 and x2==x1-1 and box[x1][y2].occupied=='b' and box[x1][y2].rank=='pawn' and box[x1][y2].enpass>0:
box[x1][y2].occupied=0
box[x1][y2].rank=''
box[x1][y2].enpass=0
box[x1][y2].init=0
b[x1][y2].config(image=blank)
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
elif y2==y1-1 and x2==x1-1 and box[x1][y2].occupied=='b' and box[x1][y2].rank=='pawn' and box[x1][y2].enpass>0:
box[x1][y2].occupied=0
box[x1][y2].rank=''
box[x1][y2].enpass=0
box[x1][y2].init=0
b[x1][y2].config(image=blank)
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
else:
return 0
else:
if x2==(int(x1)-1) and y2==y1 and box[int(x2)][int(y2)].occupied==0:
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
elif (y2==(y1+1) or y2==(y1-1)) and x2==(x1-1) and (box[int(x2)][int(y2)].occupied=='b'):
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
elif y2==y1+1 and x2==x1-1 and box[x1][y2].occupied=='b' and box[x1][y2].rank=='pawn' and box[x1][y2].enpass>0:
box[x1][y2].occupied=0
box[x1][y2].rank=''
box[x1][y2].enpass=0
box[x1][y2].init=0
b[x1][y2].config(image=blank)
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
elif y2==y1-1 and x2==x1-1 and box[x1][y2].occupied=='b' and box[x1][y2].rank=='pawn' and box[x1][y2].enpass>0:
box[x1][y2].occupied=0
box[x1][y2].rank=''
box[x1][y2].enpass=0
box[x1][y2].init=0
b[x1][y2].config(image=blank)
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
else:
return 0
else:
if self.init==1:
if (x2==int(x1)+1 or x2==int(x1)+2) and y2==y1 and box[int(x2)][int(y2)].occupied==0:
if x2==int(x1)+2:
self.enpass=2
return box[int(x2)][int(y2)].confirm(x1,y1,x2,y2,player)
return 1
elif (y2==y1+1 or y2==y1-1) and x2==x1+1 and box[int(x2)][int(y2)].occupied=='w':
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
elif y2==y1+1 and x2==x1+1 and box[x1][y2].occupied=='w' and box[x1][y2].rank=='pawn' and box[x1][y2].enpass>0:
box[x1][y2].occupied=0
box[x1][y2].rank=''
box[x1][y2].enpass=0
box[x1][y2].init=0
b[x1][y2].config(image=blank)
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
elif y2==y1-1 and x2==x1+1 and box[x1][y2].occupied=='w' and box[x1][y2].rank=='pawn' and box[x1][y2].enpass>0:
box[x1][y2].occupied=0
box[x1][y2].rank=''
box[x1][y2].enpass=0
box[x1][y2].init=0
b[x1][y2].config(image=blank)
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
else:
return 0
else:
if x2==int(x1)+1 and y2==y1 and box[int(x2)][int(y2)].occupied==0:
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
elif (y2==y1+1 or y2==y1-1) and x2==x1+1 and box[int(x2)][int(y2)].occupied=='w':
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
elif y2==y1+1 and x2==x1+1 and box[x1][y2].occupied=='w' and box[x1][y2].rank=='pawn' and box[x1][y2].enpass>0:
box[x1][y2].occupied=0
box[x1][y2].rank=''
box[x1][y2].enpass=0
box[x1][y2].init=0
b[x1][y2].config(image=blank)
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
elif y2==y1-1 and x2==x1+1 and box[x1][y2].occupied=='w' and box[x1][y2].rank=='pawn' and box[x1][y2].enpass>0:
box[x1][y2].occupied=0
box[x1][y2].rank=''
box[x1][y2].enpass=0
box[x1][y2].init=0
b[x1][y2].config(image=blank)
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
else:
return 0
def bishop_moves(self,player,x1,y1,x2,y2):
if (max(x1,x2)-min(x1,x2))!=(max(y1,y2)-min(y1,y2)):
return 0
else:
for i in range(min(x1,x2)+1,max(x1,x2)):
for j in range(min(y1,y2),max(y1,y2)):
if (max(i,x1)-min(i,x1))==(max(j,y1)-min(j,y1)):
if box[i][j].occupied!=0:
return 0
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
def knight_moves(self,player,x1,y1,x2,y2):
if (x2==x1+2 and y2==y1+1) or (x2==x1+2 and y2==y1-1) or (x2==x1+1 and y2==y1+2) or (x2==x1+1 and y2==y1-2) or (x2==x1-1 and y2==y1+2) or (x2==x1-1 and y2==y1-2) or (x2==x1-2 and y2==y1+1) or (x2==x1-2 and y2==y1-1):
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
else:
return 0
def rook_moves(self,player,x1,y1,x2,y2):
if x1!=x2 and y1!=y2:
return 0
if y1==y2 and x2>x1:
for i in range(x1+1,x2):
if box[i][y1].occupied!=0:
return 0
return box[x2][y2].confirm(x1,y1,x2,y2,player)
#return 1
elif y1==y2 and x2<x1:
for i in range(x2+1,x1):
if box[i][y1].occupied!=0:
return 0
return box[x2][y2].confirm(x1,y1,x2,y2,player)
#return 1
elif x1==x2 and y2>y1:
for j in range(y1+1,y2):
if box[x1][j].occupied!=0:
return 0
return box[x2][y2].confirm(x1,y1,x2,y2,player)
#return 1
elif x1==x2 and y2<y1:
print "y2 ",y2,"y1 ",y1,"x1 ",x1
for j in range(y2+1,y1):
if box[x1][j].occupied!=0:
return 0
return box[x2][y2].confirm(x1,y1,x2,y2,player)
#return 1
def queen_moves(self,player,x1,y1,x2,y2):
if x1==x2 or y1==y2:
if y1==y2 and x2>x1:
for i in range(x1+1,x2):
if box[i][y1].occupied!=0:
return 0
return box[x2][y2].confirm(x1,y1,x2,y2,player)
#return 1
elif y1==y2 and x2<x1:
for i in range(x2+1,x1):
if box[i][y1].occupied!=0:
return 0
return box[x2][y2].confirm(x1,y1,x2,y2,player)
#return 1
elif x1==x2 and y2>y1:
for j in range(y1+1,y2):
if box[x1][j].occupied!=0:
return 0
return box[x2][y2].confirm(x1,y1,x2,y2,player)
#return 1
elif x1==x2 and y2<y1:
#print "y2 ",y2,"y1 ",y1,"x1 ",x1
for j in range(y2+1,y1):
if box[x1][j].occupied!=0:
return 0
return box[x2][y2].confirm(x1,y1,x2,y2,player)
#return 1
elif (max(x1,x2)-min(x1,x2))==(max(y1,y2)-min(y1,y2)):
for i in range(min(x1,x2)+1,max(x1,x2)):
for j in range(min(y1,y2),max(y1,y2)):
if (max(i,x1)-min(i,x1))==(max(j,y1)-min(j,y1)):
if box[i][j].occupied!=0:
return 0
return box[x2][y2].confirm(x1,y1,x2,y2,player)
#return 1
else:
return 0
def king_moves(self,player,x1,y1,x2,y2):
if max(y1,y2)-min(y1,y2)==2 and x1==x2 and king_locate(player)!=1 and box[x1][y1].init==1: #Castling
if box[x1][y1].king_check(x2,y2)==1:
return 0
if y2>y1:
for j in range(y1+1,7):
if box[x1][j].occupied!=0:
return 0
for j in range(y1+1,y2):
print "######",x1,j
if box[x1][y1].king_check(x1,j)==1:
print "oo"
return 0
else:
for j in range(1,y1-1):
if box[x1][j].occupied!=0:
return 0
for j in range(y2,y1):
print "######",x1,j
if box[x1][y1].king_check(x1,j)==1:
print "oo"
return 0
if y2>y1:
print "Hello"
if box[x1][y2+1].rank=='rook':
if box[x1][y2+1].init==1:
box[x2][y2].confirm(x1,y1,x2,y2,player)
box[x2][y2-1].confirm(x1,7,x2,y2-1,player)
return 1
else:
return 0
elif box[x1][y2+2].rank=='rook': #Not needed in normal chess
if box[x1][y2+2].init==1:
box[x2][y2].confirm(x1,y1,x2,y2,player)
box[x2][y2-1].confirm(x1,7,x2,y2-1,player)
return 1
else:
return 0
else:
return 0
else:
print "dvgrg"
if box[x1][y2-1].rank=='rook':
if box[x1][y2-1].init==1:
box[x2][y2].confirm(x1,y1,x2,y2,player)
box[x2][y2+1].confirm(x1,0,x2,y2+1,player)
return 1
else:
return 0
elif box[x1][y2-2].rank=='rook': #Not needed in normal chess
if box[x1][y2-2].init==1:
box[x2][y2].confirm(x1,y1,x2,y2,player)
box[x2][y2+1].confirm(x1,0,x2,y2+1,player)
return 1
else:
return 0
else:
return 0
elif max(x1,x2)-min(x1,x2)>1 or max(y1,y2)-min(y1,y2)>1:
return 0
else:
return box[x2][y2].confirm(x1,y1,x2,y2,player)
return 1
def piece(self,player,x1,y1,x2,y2): #3. Determine which coin has been selected
if self.rank=='pawn':
return self.pawn_moves(player,x1,y1,x2,y2)
elif self.rank=='bishop':
return self.bishop_moves(player,x1,y1,x2,y2)
elif self.rank=='knight':
return self.knight_moves(player,x1,y1,x2,y2)
elif self.rank=='rook':
return self.rook_moves(player,x1,y1,x2,y2)
elif self.rank=='queen':
return self.queen_moves(player,x1,y1,x2,y2)
elif self.rank=='king':
return self.king_moves(player,x1,y1,x2,y2)
def check(self,x,y,player): #First check, If valid coin color is selected
if self.occupied==player:
return 1
else:
#print "Cannot select that ",self.occupied,self.rank
return 0
def validate(self,x1,y1,x2,y2,player): #Second check, If the destination of selected coin is valid
if self.occupied==player:
#print "Cannot place here"
return 0
else:
return box[int(x1)][int(y1)].piece(player,int(x1),int(y1),int(x2),int(y2))
def king_check(self,x,y): #Variables ckx,cky denote the attacking piece location
global ckx,cky
if self.occupied=='w':
try:
if (box[sub(x,1)][sub(y,1)].occupied=='b' and box[sub(x,1)][sub(y,1)].rank=='pawn'):
ckx=sub(x,1)
cky=sub(y,1)
return 1
except:
pass
try:
if (box[sub(x,1)][y+1].occupied=='b' and box[sub(x,1)][y+1].rank=='pawn'):
ckx=sub(x,1)
cky=y+1
return 1
except:
pass
block=0
for i in reversed(range(x)):
if box[i][y].occupied=='b' and (box[i][y].rank=='queen' or box[i][y].rank=='rook') and block==0:
ckx=i
cky=y
return 1
elif box[i][y].occupied=='w':
block=1
elif box[i][y].occupied=='b':
block=1
for j in reversed(range(y)):
if box[x][j].occupied=='b' and (box[x][j].rank=='queen' or box[x][j].rank=='rook') and block==0:
ckx=x
cky=j
return 1
elif box[x][j].occupied=='w':
block=1
elif box[x][j].occupied=='b':
block=1
for i in range(x+1,8):
if box[i][y].occupied=='b' and (box[i][y].rank=='queen' or box[i][y].rank=='rook') and block==0:
ckx=i
cky=y
return 1
elif box[i][y].occupied=='w':
block=1
elif box[i][y].occupied=='b':
block=1
for j in range(y+1,8):
if box[x][j].occupied=='b' and (box[x][j].rank=='queen' or box[x][j].rank=='rook') and block==0:
ckx=x
cky=j
return 1
elif box[x][j].occupied=='w':
block=1
elif box[x][j].occupied=='b':
block=1
block=0
for i in reversed(range(x)):
for j in reversed(range(y)):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied=='b' and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
ckx=i
cky=j
return 1
elif box[i][j].occupied=='w':
block=1
elif box[i][j].occupied=='b':
block=1
block=0
for i in reversed(range(x)):
for j in range(y+1,8):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied=='b' and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
ckx=i
cky=j
return 1
elif box[i][j].occupied=='w':
block=1
elif box[i][j].occupied=='b':
block=1
block=0
for i in range(x+1,8):
for j in reversed(range(y)):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied=='b' and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
ckx=i
cky=j
return 1
elif box[i][j].occupied=='w':
block=1
elif box[i][j].occupied=='b':
block=1
block=0
for i in range(x+1,8):
for j in range(y+1,8):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied=='b' and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
ckx=i
cky=j
return 1
elif box[i][j].occupied=='w':
block=1
elif box[i][j].occupied=='b':
block=1
try:
if (box[x+2][y+1].occupied=='b' and box[x+2][y+1].rank=='knight'):
ckx=x+2
cky=y+1
return 1
except:
pass
try:
if (box[x+2][sub(y,1)].occupied=='b' and box[x+2][sub(y,1)].rank=='knight'):
ckx=x+2
cky=sub(y,1)
return 1
except:
pass
try:
if (box[x+1][y+2].occupied=='b' and box[x+1][y+2].rank=='knight'):
ckx=x+1
cky=y+2
return 1
except:
pass
try:
if (box[x+1][sub(y,2)].occupied=='b' and box[x+1][sub(y,2)].rank=='knight'):
ckx=x+1
cky=sub(y,2)
return 1
except:
pass
try:
if (box[sub(x,1)][y+2].occupied=='b' and box[sub(x,1)][y+2].rank=='knight'):
ckx=sub(x,1)
cky=y+2
return 1
except:
pass
try:
if (box[sub(x,1)][sub(y,2)].occupied=='b' and box[sub(x,1)][sub(y,2)].rank=='knight'):
ckx=sub(x,1)
cky=sub(y,2)
return 1
except:
pass
try:
if (box[sub(x,2)][y+1].occupied=='b' and box[sub(x,2)][y+1].rank=='knight'):
ckx=sub(x,2)
cky=y+1
return 1
except:
pass
try:
if (box[sub(x,2)][sub(y,1)].occupied=='b' and box[sub(x,2)][sub(y,1)].rank=='knight'):
ckx=sub(x,2)
cky=sub(y,1)
return 1
except:
pass
try:
if box[x+1][y].occupied=='b' and box[x+1][y].rank=='king':
return 1
except:
pass
try:
if box[sub(x,1)][y].occupied=='b' and box[sub(x,1)][y].rank=='king':
return 1
except:
pass
try:
if box[x+1][y+1].occupied=='b' and box[x+1][y+1].rank=='king':
return 1
except:
pass
try:
if box[sub(x,1)][y+1].occupied=='b' and box[sub(x,1)][y+1].rank=='king':
return 1
except:
pass
try:
if box[x][y+1].occupied=='b' and box[x][y+1].rank=='king':
return 1
except:
pass
try:
if box[sub(x,1)][sub(y,1)].occupied=='b' and box[sub(x,1)][sub(y,1)].rank=='king':
return 1
except:
pass
try:
if box[x+1][sub(y,1)].occupied=='b' and box[x+1][sub(y,1)].rank=='king':
return 1
except:
pass
try:
if box[x][sub(y,1)].occupied=='b' and box[x][sub(y,1)].rank=='king':
return 1
except:
pass
return 0
else:
try:
if (box[x+1][y+1].occupied=='w' and box[x+1][y+1].rank=='pawn'):
ckx=x+1
cky=y+1
return 1
except:
pass
try:
if (box[x+1][sub(y,1)].occupied=='w' and box[x+1][sub(y,1)].rank=='pawn'):
ckx=x+1
cky=sub(y,1)
return 1
except:
pass
block=0
for i in reversed(range(x)):
if box[i][y].occupied=='w' and (box[i][y].rank=='queen' or box[i][y].rank=='rook') and block==0:
ckx=i
cky=y
return 1
elif box[i][y].occupied=='b':
block=1
elif box[i][y].occupied=='w':
block=1
block=0
for j in reversed(range(y)):
if box[x][j].occupied=='w' and (box[x][j].rank=='queen' or box[x][j].rank=='rook') and block==0:
ckx=x
cky=j
return 1
elif box[x][j].occupied=='b':
block=1
elif box[x][j].occupied=='w':
block=1
block=0
for i in range(x+1,8):
if box[i][y].occupied=='w' and (box[i][y].rank=='queen' or box[i][y].rank=='rook') and block==0:
ckx=i
cky=y
return 1
elif box[i][y].occupied=='b':
block=1
elif box[i][y].occupied=='w':
block=1
block=0
for j in range(y+1,8):
if box[x][j].occupied=='w' and (box[x][j].rank=='queen' or box[x][j].rank=='rook') and block==0:
ckx=x
cky=j
return 1
elif box[x][j].occupied=='b':
block=1
elif box[x][j].occupied=='w':
block=1
block=0
for i in reversed(range(x)):
for j in reversed(range(y)):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied=='w' and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
ckx=i
cky=j
return 1
elif box[i][j].occupied=='b':
block=1
elif box[i][j].occupied=='w':
block=1
block=0
for i in reversed(range(x)):
for j in range(y+1,8):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied=='w' and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
ckx=i
cky=j
return 1
elif box[i][j].occupied=='b':
block=1
elif box[i][j].occupied=='w':
block=1
block=0
for i in range(x+1,8):
for j in reversed(range(y)):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied=='w' and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
ckx=i
cky=j
return 1
elif box[i][j].occupied=='b':
block=1
elif box[i][j].occupied=='w':
block=1
block=0
for i in range(x+1,8):
for j in range(y+1,8):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied=='w' and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
ckx=i
cky=j
return 1
elif box[i][j].occupied=='b':
block=1
elif box[i][j].occupied=='w':
block=1
try:
if (box[x+2][y+1].occupied=='w' and box[x+2][y+1].rank=='knight'):
ckx=x+2
cky=y+1
return 1
except:
pass
try:
if (box[x+2][sub(y,1)].occupied=='w' and box[x+2][sub(y,1)].rank=='knight'):
ckx=x+2
cky=sub(y,1)
return 1
except:
pass
try:
if (box[x+1][y+2].occupied=='w' and box[x+1][y+2].rank=='knight'):
ckx=x+1
cky=y+2
return 1
except:
pass
try:
if (box[x+1][sub(y,2)].occupied=='w' and box[x+1][sub(y,2)].rank=='knight'):
ckx=x+1
cky=sub(y,2)
return 1
except:
pass
try:
if (box[sub(x,1)][y+2].occupied=='w' and box[sub(x,1)][y+2].rank=='knight'):
ckx=sub(x,1)
cky=y+2
return 1
except:
pass
try:
if (box[sub(x,1)][sub(y,2)].occupied=='w' and box[sub(x,1)][sub(y,2)].rank=='knight'):
ckx=sub(x,1)
cky=sub(y,2)
return 1
except:
pass
try:
if (box[sub(x,2)][y+1].occupied=='w' and box[sub(x,2)][y+1].rank=='knight'):
ckx=sub(x,2)
cky=y+1
return 1
except:
pass
try:
if (box[sub(x,2)][sub(y,1)].occupied=='w' and box[sub(x,2)][sub(y,1)].rank=='knight'):
ckx=sub(x,2)
cky=sub(y,1)
return 1
except:
pass
try:
if box[x+1][y].occupied=='w' and box[x+1][y].rank=='king':
return 1
except:
pass
try:
if box[sub(x,1)][y].occupied=='w' and box[sub(x,1)][y].rank=='king':
return 1
except:
pass
try:
if box[x+1][y+1].occupied=='w' and box[x+1][y+1].rank=='king':
return 1
except:
pass
try:
if box[sub(x,1)][y+1].occupied=='w' and box[sub(x,1)][y+1].rank=='king':
return 1
except:
pass
try:
if box[x][y+1].occupied=='w' and box[x][y+1].rank=='king':
return 1
except:
pass
try:
if box[sub(x,1)][sub(y,1)].occupied=='w' and box[sub(x,1)][sub(y,1)].rank=='king':
return 1
except:
pass
try:
if box[x+1][sub(y,1)].occupied=='w' and box[x+1][sub(y,1)].rank=='king':
return 1
except:
pass
try:
if box[x][sub(y,1)].occupied=='w' and box[x][sub(y,1)].rank=='king':
return 1
except:
pass
return 0
def assess(self,x,y,player,opp): #Used to assess the defence and attacker values
val=0
if self.occupied==player:
if player!=opp:
try:
if box[sub(x,1)][sub(y,1)].occupied==opp and box[sub(x,1)][sub(y,1)].rank=='pawn':
val=val+1
except:
pass
try:
if box[sub(x,1)][y+1].occupied==opp and box[sub(x,1)][y+1].rank=='pawn':
val=val+1
except:
pass
else:
try:
if box[x+1][y+1].occupied==opp and box[x+1][y+1].rank=='pawn':
val=val+1
except:
pass
try:
if box[x+1][sub(y,1)].occupied==opp and box[x+1][sub(y,1)].rank=='pawn':
val=val+1
except:
pass
block=0
for i in reversed(range(x)):
if box[i][y].occupied==opp and (box[i][y].rank=='queen' or box[i][y].rank=='rook') and block==0:
val=val+1
block=1
elif box[i][y].occupied==player:
block=1
elif box[i][y].occupied==opp:
block=1
for j in reversed(range(y)):
if box[x][j].occupied==opp and (box[x][j].rank=='queen' or box[x][j].rank=='rook') and block==0:
val=val+1
block=1
elif box[x][j].occupied==player:
block=1
elif box[x][j].occupied==opp:
block=1
for i in range(x+1,8):
if box[i][y].occupied==opp and (box[i][y].rank=='queen' or box[i][y].rank=='rook') and block==0:
val=val+1
block=1
elif box[i][y].occupied==player:
block=1
elif box[i][y].occupied==opp:
block=1
for j in range(y+1,8):
if box[x][j].occupied==opp and (box[x][j].rank=='queen' or box[x][j].rank=='rook') and block==0:
val=val+1
block=1
elif box[x][j].occupied==player:
block=1
elif box[x][j].occupied==opp:
block=1
block=0
for i in reversed(range(x)):
for j in reversed(range(y)):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied==opp and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
val=val+1
block=1
elif box[i][j].occupied==player:
block=1
elif box[i][j].occupied==opp:
block=1
block=0
for i in reversed(range(x)):
for j in range(y+1,8):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied==opp and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
val=val+1
block=1
elif box[i][j].occupied==player:
block=1
elif box[i][j].occupied==opp:
block=1
block=0
for i in range(x+1,8):
for j in reversed(range(y)):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied==opp and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
val=val+1
block=1
elif box[i][j].occupied==player:
block=1
elif box[i][j].occupied==opp:
block=1
block=0
for i in range(x+1,8):
for j in range(y+1,8):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied==opp and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
val=val+1
block=1
elif box[i][j].occupied==player:
block=1
elif box[i][j].occupied==opp:
block=1
try:
if (box[x+2][y+1].occupied==opp and box[x+2][y+1].rank=='knight'):
val=val+1
except:
pass
try:
if (box[x+2][sub(y,1)].occupied==opp and box[x+2][sub(y,1)].rank=='knight'):
val=val+1
except:
pass
try:
if (box[x+1][y+2].occupied==opp and box[x+1][y+2].rank=='knight'):
val=val+1
except:
pass
try:
if (box[x+1][sub(y,2)].occupied==opp and box[x+1][sub(y,2)].rank=='knight'):
val=val+1
except:
pass
try:
if (box[sub(x,1)][y+2].occupied==opp and box[sub(x,1)][y+2].rank=='knight'):
val=val+1
except:
pass
try:
if (box[sub(x,1)][sub(y,2)].occupied==opp and box[sub(x,1)][sub(y,2)].rank=='knight'):
val=val+1
except:
pass
try:
if (box[sub(x,2)][y+1].occupied==opp and box[sub(x,2)][y+1].rank=='knight'):
val=val+1
except:
pass
try:
if (box[sub(x,2)][sub(y,1)].occupied==opp and box[sub(x,2)][sub(y,1)].rank=='knight'):
val=val+1
except:
pass
return val
else:
if player!=opp:
try:
if box[x+1][y+1].occupied==opp and box[x+1][y+1].rank=='pawn':
val=val+1
except:
pass
try:
if box[x+1][sub(y,1)].occupied==opp and box[x+1][sub(y,1)].rank=='pawn':
val=val+1
except:
pass
else:
try:
if box[sub(x,1)][sub(y,1)].occupied==opp and box[sub(x,1)][sub(y,1)].rank=='pawn':
val=val+1
except:
pass
try:
if box[sub(x,1)][y+1].occupied==opp and box[sub(x,1)][y+1].rank=='pawn':
val=val+1
except:
pass
block=0
for i in reversed(range(x)):
if box[i][y].occupied==opp and (box[i][y].rank=='queen' or box[i][y].rank=='rook') and block==0:
val=val+1
block=1
elif box[i][y].occupied==player:
block=1
elif box[i][y].occupied==opp:
block=1
block=0
for j in reversed(range(y)):
if box[x][j].occupied==opp and (box[x][j].rank=='queen' or box[x][j].rank=='rook') and block==0:
val=val+1
block=1
elif box[x][j].occupied==player:
block=1
elif box[x][j].occupied==opp:
block=1
block=0
for i in range(x+1,8):
if box[i][y].occupied==opp and (box[i][y].rank=='queen' or box[i][y].rank=='rook') and block==0:
val=val+1
block=1
elif box[i][y].occupied==player:
block=1
elif box[i][y].occupied==opp:
block=1
block=0
for j in range(y+1,8):
if box[x][j].occupied==opp and (box[x][j].rank=='queen' or box[x][j].rank=='rook') and block==0:
val=val+1
block=1
elif box[x][j].occupied==player:
block=1
elif box[x][j].occupied==opp:
block=1
block=0
for i in reversed(range(x)):
for j in reversed(range(y)):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied==opp and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
val=val+1
block=1
elif box[i][j].occupied==player:
block=1
elif box[i][j].occupied==opp:
block=1
block=0
for i in reversed(range(x)):
for j in range(y+1,8):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied==opp and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
val=val+1
block=1
elif box[i][j].occupied==player:
block=1
elif box[i][j].occupied==opp:
block=1
block=0
for i in range(x+1,8):
for j in reversed(range(y)):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied==opp and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
val=val+1
block=1
elif box[i][j].occupied==player:
block=1
elif box[i][j].occupied==opp:
block=1
block=0
for i in range(x+1,8):
for j in range(y+1,8):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0:
if box[i][j].occupied==opp and (box[i][j].rank=='queen' or box[i][j].rank=='bishop'):
val=val+1
block=1
elif box[i][j].occupied==player:
block=1
elif box[i][j].occupied==opp:
block=1
try:
if (box[x+2][y+1].occupied==opp and box[x+2][y+1].rank=='knight'):
val=val+1
except:
pass
try:
if (box[x+2][sub(y,1)].occupied==opp and box[x+2][sub(y,1)].rank=='knight'):
val=val+1
except:
pass
try:
if (box[x+1][y+2].occupied==opp and box[x+1][y+2].rank=='knight'):
val=val+1
except:
pass
try:
if (box[x+1][sub(y,2)].occupied==opp and box[x+1][sub(y,2)].rank=='knight'):
val=val+1
except:
pass
try:
if (box[sub(x,1)][y+2].occupied==opp and box[sub(x,1)][y+2].rank=='knight'):
val=val+1
except:
pass
try:
if (box[sub(x,1)][sub(y,2)].occupied==opp and box[sub(x,1)][sub(y,2)].rank=='knight'):
val=val+1
except:
pass
try:
if (box[sub(x,2)][y+1].occupied==opp and box[sub(x,2)][y+1].rank=='knight'):
val=val+1
except:
pass
try:
if (box[sub(x,2)][sub(y,1)].occupied==opp and box[sub(x,2)][sub(y,1)].rank=='knight'):
val=val+1
except:
pass
return val
def attackf(self,x,y,player,opp): #Pieces than can be attacked(incomplete)
global gx,gy,gv #gx,gy is used to identify the location of the pieces that can be attacked
val=0
gv1=-101
if player=='w':
try:
if box[sub(x,1)][sub(y,1)].occupied==opp and self.rank=='pawn' and legal_move(x,y,sub(x,1),sub(y,1),player)==1:
val=val+1
if box[sub(x,1)][sub(y,1)].defence==0:
gv1=box[sub(x,1)][sub(y,1)].value
else:
gv1=box[sub(x,1)][sub(y,1)].value-self.value
if gv1>gv:
gx=sub(x,1)
gy=sub(y,1)
gv=gv1
except:
pass
try:
if box[sub(x,1)][y+1].occupied==opp and self.rank=='pawn' and legal_move(x,y,sub(x,1),y+1,player)==1:
val=val+1
if box[sub(x,1)][y+1].defence==0:
gv1=box[sub(x,1)][y+1].value
else:
gv1=box[sub(x,1)][y+1].value-self.value
if gv1>gv:
gx=sub(x,1)
gy=y+1
gv=gv1
except:
pass
elif player=='b':
try:
if box[x+1][y+1].occupied==opp and self.rank=='pawn' and legal_move(x,y,x+1,y+1,player)==1:
val=val+1
if box[x+1][y+1].defence==0:
gv1=box[x+1][y+1].value
else:
gv1=box[x+1][y+1].value-self.value
if gv1>gv:
gx=x+1
gy=y+1
gv=gv1
except:
pass
try:
if box[x+1][sub(y,1)].occupied==opp and self.rank=='pawn' and legal_move(x,y,x+1,sub(y,1),player)==1:
val=val+1
if box[x+1][sub(y,1)].defence==0:
gv1=box[x+1][sub(y,1)].value
else:
gv1=box[x+1][sub(y,1)].value-self.value
if gv1>gv:
gx=x+1
gy=sub(y,1)
gv=gv1
except:
pass
block=0
for i in reversed(range(x)):
if box[i][y].occupied==opp and (self.rank=='queen' or self.rank=='rook') and block==0 and legal_move(x,y,i,y,player)==1:
val=val+1
if box[i][y].defence==0:
gv1=box[i][y].value
else:
gv1=box[i][y].value-self.value
if gv1>gv:
gx=i
gy=y
gv=gv1
block=1
elif box[i][y].occupied==player:
block=1
elif box[i][y].occupied==opp:
block=1
for j in reversed(range(y)):
if box[x][j].occupied==opp and (self.rank=='queen' or self.rank=='rook') and block==0 and legal_move(x,y,x,j,player)==1:
val=val+1
if box[x][j].defence==0:
gv1=box[x][j].value
else:
gv1=box[x][j].value-self.value
if gv1>gv:
gx=x
gy=j
gv=gv1
block=1
elif box[x][j].occupied==player:
block=1
elif box[x][j].occupied==opp:
block=1
for i in range(x+1,8):
if box[i][y].occupied==opp and (self.rank=='queen' or self.rank=='rook') and block==0 and legal_move(x,y,i,y,player)==1:
val=val+1
if box[i][y].defence==0:
gv1=box[i][y].value
else:
gv1=box[i][y].value-self.value
if gv1>gv:
gx=i
gy=y
gv=gv1
block=1
elif box[i][y].occupied==player:
block=1
elif box[i][y].occupied==opp:
block=1
for j in range(y+1,8):
if box[x][j].occupied==opp and (self.rank=='queen' or self.rank=='rook') and block==0 and legal_move(x,y,x,j,player)==1:
val=val+1
if box[x][j].defence==0:
gv1=box[x][j].value
else:
gv1=box[x][j].value-self.value
if gv1>gv:
gx=x
gy=j
gv=gv1
block=1
elif box[x][j].occupied==player:
block=1
elif box[x][j].occupied==opp:
block=1
block=0
for i in reversed(range(x)):
for j in reversed(range(y)):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0 and legal_move(x,y,i,j,player)==1: #Check bishop n queen moves(jumping)
if box[i][j].occupied==opp and (self.rank=='queen' or self.rank=='bishop'):
val=val+1
print "b1"
if box[i][j].defence==0:
gv1=box[i][j].value
else:
gv1=box[i][j].value-self.value
if gv1>gv:
gx=i
gy=j
gv=gv1
block=1
elif box[i][j].occupied==player:
block=1
elif box[i][j].occupied==opp:
block=1
else:
block=1
block=0
for i in reversed(range(x)):
for j in range(y+1,8):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0 and legal_move(x,y,i,j,player)==1:
if box[i][j].occupied==opp and (self.rank=='queen' or self.rank=='bishop'):
val=val+1
print "b2"
if box[i][j].defence==0:
gv1=box[i][j].value
else:
gv1=box[i][j].value-self.value
if gv1>gv:
gx=i
gy=j
gv=gv1
block=1
elif box[i][j].occupied==player:
block=1
elif box[i][j].occupied==opp:
block=1
else:
block=1
block=0
for i in range(x+1,8):
for j in reversed(range(y)):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0 and legal_move(x,y,i,j,player)==1:
if box[i][j].occupied==opp and (self.rank=='queen' or self.rank=='bishop'):
val=val+1
print "b3"
if box[i][j].defence==0:
gv1=box[i][j].value
else:
gv1=box[i][j].value-self.value
if gv1>gv:
gx=i
gy=j
gv=gv1
block=1
elif box[i][j].occupied==player:
block=1
elif box[i][j].occupied==opp:
block=1
else:
block=1
block=0
for i in range(x+1,8):
for j in range(y+1,8):
if (max(x,i)-min(x,i))==(max(y,j)-min(y,j)) and block==0 and legal_move(x,y,i,j,player)==1:
if box[i][j].occupied==opp and (self.rank=='queen' or self.rank=='bishop'):
val=val+1
print "b4"
if box[i][j].defence==0:
gv1=box[i][j].value
else:
gv1=box[i][j].value-self.value
if gv1>gv:
gx=i
gy=j
gv=gv1
block=1
elif box[i][j].occupied==player:
block=1
elif box[i][j].occupied==opp:
block=1
else:
block=1
try:
if (box[x+2][y+1].occupied==opp and self.rank=='knight') and legal_move(x,y,x+2,y+1,player)==1:
val=val+1
if box[x+2][y+1].defence==0:
gv1=box[x+2][y+1].value
else:
gv1=box[x+2][y+1].value-self.value
if gv1>gv:
gx=x+2
gy=y+1
gv=gv1
except:
pass
try:
if (box[x+2][sub(y,1)].occupied==opp and self.rank=='knight') and legal_move(x,y,x+2,sub(y,1),player)==1:
val=val+1
if box[x+2][sub(y,1)].defence==0:
gv1=box[x+2][sub(y,1)].value
else:
gv1=box[x+2][sub(y,1)].value-self.value
if gv1>gv:
gx=x+2
gy=sub(y,1)
gv=gv1
except:
pass
try:
if (box[x+1][y+2].occupied==opp and self.rank=='knight') and legal_move(x,y,x+1,y+2,player)==1:
val=val+1
if box[x+1][y+2].defence==0:
gv1=box[x+1][y+2].value
else:
gv1=box[x+1][y+2].value-self.value
if gv1>gv:
gx=x+1
gy=y+2
gv=gv1
except:
pass
try:
if (box[x+1][sub(y,2)].occupied==opp and self.rank=='knight') and legal_move(x,y,x+1,sub(y,2),player)==1:
val=val+1
if box[x+1][sub(y,2)].defence==0:
gv1=box[x+1][sub(y,2)].value
else:
gv1=box[x+1][sub(y,2)].value-self.value
if gv1>gv:
gx=x+1
gy=sub(y,2)
gv=gv1
except:
pass
try:
if (box[sub(x,1)][y+2].occupied==opp and self.rank=='knight') and legal_move(x,y,sub(x,1),y+2,player)==1:
val=val+1
if box[sub(x,1)][y+2].defence==0:
gv1=box[sub(x,1)][y+2].value
else:
gv1=box[sub(x,1)][y+2].value-self.value
if gv1>gv:
gx=sub(x,1)
gy=y+2
gv=gv1
except:
pass
try:
if (box[sub(x,1)][sub(y,2)].occupied==opp and self.rank=='knight') and legal_move(x,y,sub(x,1),sub(y,2),player)==1:
val=val+1
if box[sub(x,1)][sub(y,2)].defence==0:
gv1=box[sub(x,1)][sub(y,2)].value
else:
gv1=box[sub(x,1)][sub(y,2)].value-self.value
if gv1>gv:
gx=sub(x,1)
gy=sub(x,2)
gv=gv1
except:
pass
try:
if (box[sub(x,2)][y+1].occupied==opp and self.rank=='knight') and legal_move(x,y,sub(x,2),y+1,player)==1:
val=val+1
if box[sub(x,2)][y+1].defence==0:
gv1=box[sub(x,2)][y+1].value
else:
gv1=box[sub(x,2)][y+1].value-self.value
if gv1>gv:
gx=sub(x,2)
gy=y+1
gv=gv1
except:
pass
try:
if (box[sub(x,2)][sub(y,1)].occupied==opp and self.rank=='knight') and legal_move(x,y,sub(x,2),sub(y,1),player)==1:
val=val+1
if box[sub(x,2)][sub(y,1)].defence==0:
gv1=box[sub(x,2)][sub(y,1)].value
else:
gv1=box[sub(x,2)][sub(y,1)].value-self.value
if gv1>gv:
gx=sub(x,2)
gy=sub(x,1)
gv=gv1
except:
pass
return val
'''
def end():
wking=0
bking=0
for i in range(8):
for j in range(8):
if box[i][j].rank=='king':
if box[i][j].occupied=='w':
wking=1
else:
bking=1
if wking==0:
tkMessageBox.showinfo("Game Over","Black wins!!")
sys.exit(0)
return 1
elif bking==0:
tkMessageBox.showinfo("Game Over","White wins!!")
sys.exit(0)
return 1
else:
return 0
'''
def sub(a,b):
if a>=b:
return a-b
else:
return 10
def disp():
for i in range(8):
for j in range(8):
box[i][j].disp1(i,j)
def king_locate(player): #Locate position of king-> return 1 if check
for i in range(8):
for j in range(8):
if box[i][j].rank=='king' and box[i][j].occupied==player:
#print i,j,box[i][j].king_check(i,j)
return box[i][j].king_check(i,j)
def stalemate(player):
for i in range(8):
for j in range(8):
if box[i][j].occupied==player:
if box[i][j].rank=='pawn' and player=='b':
try:
if box[i+1][j].occupied==0:
if legal_move(i,j,i+1,j,player)==1:
return 1
else:
pass
except:
pass
try:
if box[i+1][j+1].occupied=='w':
if legal_move(i,j,i+1,j+1,player)==1:
return 1
else:
pass
except:
pass
try:
if box[i+1][j+1].occupied=='w':
if legal_move(i,j,i+1,sub(j,1),player)==1:
return 1
else:
pass
except:
pass
elif box[i][j].rank=='pawn' and player=='w':
try:
if box[sub(i,1)][j].occupied==0:
if legal_move(i,j,sub(i,1),j,player)==1:
return 1
else:
pass
except:
pass
try:
if box[sub(i,1)][j+1].occupied=='b':
if legal_move(i,j,sub(i,1),j+1,player)==1:
return 1
else:
pass
except:
pass
try:
if box[sub(i,1)][sub(j,1)].occupied=='b':
if legal_move(i,j,sub(i,1),sub(j,1),player)==1:
return 1
else:
pass
except:
pass
elif box[i][j].rank=='rook':
if legal_move(i,j,i,j+1,player)==1:
return 1
else:
pass
if legal_move(i,j,i,sub(j,1),player)==1:
return 1
else:
pass
if legal_move(i,j,i+1,j,player)==1:
return 1
else:
pass
if legal_move(i,j,sub(i,1),j,player)==1:
return 1
else:
pass
elif box[i][j].rank=='bishop':
if legal_move(i,j,i+1,j+1,player)==1:
return 1
else:
pass
if legal_move(i,j,i+1,sub(j,1),player)==1:
return 1
else:
pass
if legal_move(i,j,sub(i,1),j+1,player)==1:
return 1
else:
pass
if legal_move(i,j,sub(i,1),sub(j,1),player)==1:
return 1
else:
pass
elif box[i][j].rank=='queen' or box[i][j].rank=='king':
if legal_move(i,j,i,j+1,player)==1:
return 1
else:
pass
if legal_move(i,j,i,sub(j,1),player)==1:
return 1
else:
pass
if legal_move(i,j,i+1,j,player)==1:
return 1
else:
pass
if legal_move(i,j,sub(i,1),j,player)==1:
return 1
else:
pass
if legal_move(i,j,i+1,j+1,player)==1:
return 1
else:
pass
if legal_move(i,j,i+1,sub(j,1),player)==1:
return 1
else:
pass
if legal_move(i,j,sub(i,1),j+1,player)==1:
return 1
else:
pass
if legal_move(i,j,sub(i,1),sub(j,1),player)==1:
return 1
else:
pass
elif box[i][j].rank=='knight':
if legal_move(i,j,sub(i,2),sub(j,1),player)==1:
return 1
else:
pass
if legal_move(i,j,sub(i,2),j+1,player)==1:
return 1
else:
pass
if legal_move(i,j,sub(i,1),sub(j,2),player)==1:
return 1
else:
pass
if legal_move(i,j,sub(i,1),j+2,player)==1:
return 1
else:
pass
if legal_move(i,j,i+1,sub(j,2),player)==1:
return 1
else:
pass
if legal_move(i,j,i+1,j+2,player)==1:
return 1
else:
pass
if legal_move(i,j,i+2,sub(j,1),player)==1:
return 1
else:
pass
if legal_move(i,j,i+2,j+1,player)==1:
return 1
else:
pass
return 0
def legal_move(i,j,x,y,player): #1 if move is legal
try:
if box[x][y].occupied!=player:
temp_occ=box[x][y].occupied
temp_rank=box[x][y].rank
temp_init=box[x][y].init
temp_enpass=box[x][y].enpass
box[x][y].occupied=box[i][j].occupied
box[x][y].rank=box[i][j].rank
box[x][y].init=box[i][j].init
box[x][y].enpass=box[i][j].enpass
box[i][j].occupied=0
box[i][j].rank=0
box[i][j].init=0
box[i][j].enpass=0
if king_locate(player)==1:
box[i][j].occupied=box[x][y].occupied
box[i][j].rank=box[x][y].rank
box[i][j].init=box[x][y].init
box[i][j].enpass=box[x][y].enpass
box[x][y].occupied=temp_occ
box[x][y].rank=temp_rank
box[x][y].init=temp_init
box[x][y].enpass=temp_enpass
return 0
else:
box[i][j].occupied=box[x][y].occupied
box[i][j].rank=box[x][y].rank
box[i][j].init=box[x][y].init
box[i][j].enpass=box[x][y].enpass
box[x][y].occupied=temp_occ
box[x][y].rank=temp_rank
box[x][y].init=temp_init
box[x][y].enpass=temp_enpass
return 1
except:
return 0
def accept():
global spin,px,py,bb,promo
promo=0
print spin.get(),px,py
box[px][py].rank=spin.get()
if spin.get()=='Queen':
box[px][py].value=16
elif spin.get()=='knight':
box[px][py].value=4
elif spin.get()=='rook':
box[px][py].value=8
elif spin.get()=='bishop':
box[px][py].value=2
spin.grid_forget()
bb.grid_forget()
name=box[px][py].occupied+box[px][py].rank+".png"
#print name
photo1 = Image.open(name)
photo=ImageTk.PhotoImage(photo1)
b[px][py].config(image=photo)
b[px][py].image=photo
def computer(player,opp): #Automation
global gx,gy,gv,ckx,cky #First, see if the king is in check and evade if necessary(not done); Second, see if an important coin is in danger and without support and evade if needed(not done); Third, Attack the enemy coin if it is profitable(success); Else, Make a random move
gv=-101
av=-100
if king_locate(player)==1:
for i in range(8): #Step 1
for j in range(8): #Moving the king
if box[i][j].rank=='king' and box[i][j].occupied==player:
x=i
y=j
try:
if box[x+1][y].occupied!=player and legal_move(x,y,x+1,y,player)==1:
box[x+1][y].confirm(x,y,x+1,y,player)
return
except:
pass
try:
if box[sub(x,1)][y].occupied!=player and legal_move(x,y,sub(x,1),y,player)==1:
box[sub(x,1)][y].confirm(x,y,sub(x,1),y,player)
return
except:
pass
try:
if box[x+1][y+1].occupied!=player and legal_move(x,y,x+1,y+1,player)==1:
print x,y
box[x+1][y+1].confirm(x,y,x+1,y+1,player)
return
except:
pass
try:
if box[sub(x,1)][y+1].occupied!=player and legal_move(x,y,sub(x,1),y+1,player)==1:
box[sub(x,1)][y+1].confirm(x,y,sub(x,1),y+1,player)
return
except:
pass
try:
if box[x][y+1].occupied!=player and legal_move(x,y,x,y+1,player)==1:
box[x][y+1].confirm(x,y,x,y+1,player)
return
except:
pass
try:
if box[sub(x,1)][sub(y,1)].occupied!=player and legal_move(x,y,sub(x,1),sub(y,1),player)==1:
box[sub(x,1)][sub(y,1)].confirm(x,y,sub(x,1),sub(y,1),player)
return
except:
pass
try:
if box[x+1][sub(y,1)].occupied!=player and legal_move(x,y,x+1,sub(y,1),player)==1:
box[x+1][sub(y,1)].confirm(x,y,x+1,sub(y,1),player)
return
except:
pass
try:
if box[x][sub(y,1)].occupied!=player and legal_move(x,y,x,sub(y,1),player)==1:
box[x][sub(y,1)].confirm(x,y,x,sub(y,1),player)
return
except:
pass
'''
if x==ckx: #Saving the king with a blocking coin(Start changes from here)********
for i in range(min(x,ckx)+1,max(x,ckx)):
elif y==cky:
for i in range(min(y,cky)+1,max(y,cky)):
else:
pass
'''
for i in range(8): #Step 3
for j in range(8):
if box[i][j].occupied==player:
att=box[i][j].attackf(i,j,player,opp)
if gv>av:
av=gv #ax,ay-> Destination location
ax=gx #px,py-> The location of coin to be moved
ay=gy
px=i
py=j
print att
if av>=0:
box[ax][ay].confirm(px,py,ax,ay,player)
return
c=Tkinter.Tk()
wpawn1 = Image.open("wpawn.png")
bpawn1=Image.open("bpawn.png")
wrook1=Image.open("wrook.png")
brook1=Image.open("brook.png")
wknight1=Image.open("wknight.png")
bknight1=Image.open("bknight.png")
wbishop1=Image.open("wbishop.png")
bbishop1=Image.open("bbishop.png")
wqueen1=Image.open("wqueen.png")
bqueen1=Image.open("bqueen.png")
wking1=Image.open("wking.png")
bking1=Image.open("bking.png")
blank1=Image.open("blank.png")
'''
wpawn1 = wpawn1.resize((120, 120), PIL.Image.ANTIALIAS)
bpawn1 = bpawn1.resize((80, 80), PIL.Image.ANTIALIAS)
wrook1 = wrook1.resize((100, 100), PIL.Image.ANTIALIAS)
brook1 = brook1.resize((100, 100), PIL.Image.ANTIALIAS)
wknight1 = wknight1.resize((120, 120), PIL.Image.ANTIALIAS)
bknight1 = bknight1.resize((120, 120), PIL.Image.ANTIALIAS)
wbishop1 = wbishop1.resize((100, 100), PIL.Image.ANTIALIAS)
bbishop1 = bbishop1.resize((70, 100), PIL.Image.ANTIALIAS)
wqueen1 = wqueen1.resize((100, 100), PIL.Image.ANTIALIAS)
bqueen1 = bqueen1.resize((80, 100), PIL.Image.ANTIALIAS)
wking1 = wking1.resize((100, 100), PIL.Image.ANTIALIAS)
bking1 = bking1.resize((110, 110), PIL.Image.ANTIALIAS)
blank1 = blank1.resize((100, 100), PIL.Image.ANTIALIAS)
wpawn1.save("wpawn.png")
bpawn1.save("bpawn.png")
wrook1.save("wrook.png")
brook1.save("brook.png")
wknight1.save("wknight.png")
bknight1.save("bknight.png")
wbishop1.save("wbishop.png")
bbishop1.save("bbishop.png")
wqueen1.save("wqueen.png")
bqueen1.save("bqueen.png")
wking1.save("wking.png")
bking1.save("bking.png")
blank1.save("blank.png")
'''
wpawn=ImageTk.PhotoImage(wpawn1)
bpawn=ImageTk.PhotoImage(bpawn1)
wrook=ImageTk.PhotoImage(wrook1)
brook=ImageTk.PhotoImage(brook1)
wknight=ImageTk.PhotoImage(wknight1)
bknight=ImageTk.PhotoImage(bknight1)
wbishop=ImageTk.PhotoImage(wbishop1)
bbishop=ImageTk.PhotoImage(bbishop1)
wqueen=ImageTk.PhotoImage(wqueen1)
bqueen=ImageTk.PhotoImage(bqueen1)
wking=ImageTk.PhotoImage(wking1)
bking=ImageTk.PhotoImage(bking1)
blank=ImageTk.PhotoImage(blank1)
global cx,cy
def mouse(event):
global cx,cy
try:
grid_info = event.widget.grid_info()
cy=int(event.x)
cx=int(event.y)
except:
return
#print "click",cx,cy
c.bind("<Button-1>", mouse)
global turn
turn='w'
def mouse(event):
global turn,cx,cy,draw,promo
if promo==0:
try:
grid_info = event.widget.grid_info()
#print (grid_info["row"],grid_info["column"] )
x1=int(grid_info["row"])
y1=int(grid_info["column"])
t= (c.grid_location(event.x, event.y))
#print c.bbox(box[0][0])
y2=int(t[0])
x2=int(t[1])
yy=int(event.x)
xx=int(event.y)
except:
return
#print "click",cx,cy
#print "drop",xx,yy
#print event.x,event.y
#print xx,yy
if x2<0: #Approximating cursor position
x2=0
if y2<0:
y2=0
while(xx<0):
xx=xx+107
x2=x2-1
while(yy<0):
yy=yy+107
y2=y2-1
x2=x1+x2
y2=y1+y2
if (x2>7) or (y2 >7) or (x2<0) or (y2 <0):
print "Outside box"
else:
#print x1,y1
#print x2,y2
if turn=='w': #Always start with white
#turn='b'
chk=0
val=0
chk=box[int(x1)][int(y1)].check(int(x1),int(y1),'w')
#val=box[int(x2)][int(y2)].validate(int(x1),int(y1),int(x2),int(y2),'w')
if chk==0:
#tkMessageBox.showinfo("Invalid selection","Select the correct coin")
print "Invalid selection. Select the correct coin"
else:
val=box[int(x2)][int(y2)].validate(int(x1),int(y1),int(x2),int(y2),'w') #Player turn(White)
#tkMessageBox.showinfo("Invalid move","Can't move there")
if val==0:
print "Invalid move. Can't move there"
else:
turn='b'
kcheck=0
kcheck=king_locate('b')
if kcheck==1:
tkMessageBox.showinfo("Alert","Check!")
checkmate(x2,y2,'b')
if draw==1 and kcheck!=1:
tkMessageBox.showinfo("Game drawn","Stalemate!")
computer('b','w') #Computer turn(Black)
turn='w'
kcheck=0
print "hello"
kcheck=king_locate('w')
if kcheck==1:
tkMessageBox.showinfo("Alert","Check!")
checkmate(x2,y2,'w')
if draw==1 and kcheck!=1:
tkMessageBox.showinfo("Game drawn","Stalemate!")
else:
print "Some problem"
'''
chk=0
val=0
chk=box[int(x1)][int(y1)].check(int(x1),int(y1),'b')
if chk==0:
#tkMessageBox.showinfo("Invalid selection","Select the correct coin")
print "Invalid selection. Select the correct coin"
else:
val=box[int(x2)][int(y2)].validate(int(x1),int(y1),int(x2),int(y2),'b')
#tkMessageBox.showinfo("Invalid move","Can't move there")
if val==0:
print "Invalid move. Can't move there"
else:
turn='w'
kcheck=0
kcheck=king_locate('w')
if kcheck==1:
tkMessageBox.showinfo("Alert","Check!")
checkmate(x2,y2,'w')
if draw==1 and kcheck!=1:
tkMessageBox.showinfo("Game drawn","Stalemate!")
'''
c.bind("<ButtonRelease-1>", mouse)
def checkmate(x1,y1,player): #Check for checkmate
print "inside"
ck=1
for i in range(8):
for j in range(8):
if box[i][j].rank=='king' and box[i][j].occupied==player:
x2=i
y2=j
if legal_move(x2,y2,x2,y2+1,player)==1: #Check if king can move
ck=0
else:
pass
if legal_move(x2,y2,x2,sub(y2,1),player)==1:
ck=0
else:
pass
if legal_move(x2,y2,x2+1,y2,player)==1:
ck=0
else:
pass
if legal_move(x2,y2,sub(x2,1),y2,player)==1:
ck=0
else:
pass
if legal_move(x2,y2,x2+1,y2+1,player)==1:
ck=0
else:
pass
if legal_move(x2,y2,x2+1,sub(y2,1),player)==1:
ck=0
else:
pass
if legal_move(x2,y2,sub(x2,1),y2+1,player)==1:
ck=0
else:
pass
if legal_move(x2,y2,sub(x2,1),sub(y2,1),player)==1:
ck=0
else:
pass
if box[x1][y1].king_check(x1,y1)==1: #Check if the attacking coin can be captured
ck=0
else:
pass
if box[x1][y1].rank=='knight': #Check if any coin can be brought in the way of the king and the attacker
if box[x1][y1].king_check(x1,y1)==1:
ck=0
else:
pass
elif box[x1][y1].rank=='pawn':
if box[x1][y1].king_check(x1,y1)==1:
ck=0
else:
pass
elif box[x1][y1].rank=='rook' and (max(x1,x2)-min(x1,x2)>1 and max(y1,y2)-min(y1,y2)>1):
if box[x1][y1].king_check(x1,y1)==1:
ck=0
else:
pass
if x1==x2:
for j in range(min(y1,y2),max(y1,y2)):
if box[x1][j].king_check(x1,j)==1:
ck=0
else:
pass
elif y1==y2:
for i in range(min(x1,x2),max(x1,x2)):
if box[i][y1].king_check(i,y1)==1:
ck=0
else:
pass
elif box[x1][y1].rank=='bishop' and (max(x1,x2)-min(x1,x2)>1 and max(y1,y2)-min(y1,y2)>1):
if box[x1][y1].king_check(x1,y1)==1:
ck=0
else:
pass
if x1<x2 and y1<y2:
for i in reversed(range(min(x1,x2),max(x1,x2))):
for j in reversed(range(min(y1,y2),max(y1,y2))):
if (max(x1,i)-min(x1,i))==(max(y1,j)-min(y1,j)):
if box[i][j].king_check(i,j)==1:
ck=0
else:
pass
elif x1<x2 and y1>y2:
for i in reversed(range(min(x1,x2),max(x1,x2))):
for j in range(min(y1+1,y2),max(y1+1,y2)):
if (max(x1,i)-min(x1,i))==(max(y1,j)-min(y1,j)):
if box[i][j].king_check(i,j)==1:
ck=0
else:
pass
elif x1>x2 and y1<y2:
for i in range(min(x1+1,x2),max(x1+1,x2)):
for j in reversed(range(min(y1,y2),max(y1,y2))):
if (max(x1,i)-min(x1,i))==(max(y1,j)-min(y1,j)):
if box[i][j].king_check(i,j)==1:
ck=0
else:
pass
elif x1>x2 and y1>y2:
for i in range(min(x1+1,x2),max(x1+1,x2)):
for j in range(min(y1+1,y2),max(y1+1,y2)):
if (max(x1,i)-min(x1,i))==(max(y1,j)-min(y1,j)):
if box[i][j].king_check(i,j)==1:
ck=0
else:
pass
elif box[x1][y1].rank=='queen' and (max(x1,x2)-min(x1,x2)>1 and max(y1,y2)-min(y1,y2)>1):
if box[x1][y1].king_check(x1,y1)==1:
ck=0
else:
pass
if x1==x2:
for j in range(min(y1,y2),max(y1,y2)):
if box[x1][j].king_check(x1,j)==1:
print "q1"
ck=0
else:
pass
elif y1==y2:
for i in range(min(x1,x2),max(x1,x2)):
if box[i][y1].king_check(i,y1)==1:
print "q2"
ck=0
else:
pass
elif x1<x2 and y1<y2:
for i in reversed(range(min(x1,x2),max(x1,x2))):
for j in reversed(range(min(y1,y2),max(y1,y2))):
if (max(x1,i)-min(x1,i))==(max(y1,j)-min(y1,j)):
if box[i][j].king_check(i,j)==1:
print "q3"
ck=0
else:
pass
elif x1<x2 and y1>y2:
for i in reversed(range(min(x1,x2),max(x1,x2))):
for j in range(min(y1+1,y2),max(y1+1,y2)):
if (max(x1,i)-min(x1,i))==(max(y1,j)-min(y1,j)):
if box[i][j].king_check(i,j)==1:
print "q4"
ck=0
else:
pass
elif x1>x2 and y1<y2:
for i in range(min(x1+1,x2),max(x1+1,x2)):
for j in reversed(range(min(y1,y2),max(y1,y2))):
if (max(x1,i)-min(x1,i))==(max(y1,j)-min(y1,j)):
if box[i][j].king_check(i,j)==1:
print "q5"
ck=0
else:
pass
elif x1>x2 and y1>y2:
for i in range(min(x1+1,x2),max(x1+1,x2)):
for j in range(min(y1+1,y2),max(y1+1,y2)):
if (max(x1,i)-min(x1,i))==(max(y1,j)-min(y1,j)):
if box[i][j].king_check(i,j)==1:
print "q6"
ck=0
else:
pass
if ck==1:
if player=='w':
tkMessageBox.showinfo("Game over!!","Checkmate! Black wins!!!")
else:
tkMessageBox.showinfo("Game over!!","Checkmate! White wins!!!")
for i in range(8):
#global b
b.append([])
for j in range(8):
b[i].append(j)
b[i][j]=Button(c,image=blank,fg="green",bg="black",font=("Times New Roman",12),activebackground="gray",activeforeground="red",width=80,height=80)
if j%2==0 and i%2==0:
b[i][j].config(bg="white")
if j%2!=0 and i%2!=0:
b[i][j].config(bg="white")
b[i][j].grid(row=i, column=j)
box=[]
for i in range(8):
box.append([])
for j in range(8):
box[i].append(board())
for i in range(8):
for j in range(8):
box[i][j].init(i,j)
c.mainloop()
| 26.767686 | 282 | 0.564178 | 11,570 | 61,298 | 2.976491 | 0.029127 | 0.013996 | 0.023811 | 0.027179 | 0.822376 | 0.796678 | 0.779023 | 0.765956 | 0.741042 | 0.718828 | 0 | 0.060448 | 0.223286 | 61,298 | 2,289 | 283 | 26.77938 | 0.662872 | 0.03837 | 0 | 0.775846 | 0 | 0 | 0.038269 | 0.002656 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.089756 | 0.004229 | null | null | 0.012688 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 9 |
01d1c70acd69b0272ce058f9b6d5a5eb80caed6f | 9,731 | py | Python | usaspending_api/awards/migrations/0037_merge_subaward_and_subaward_matview.py | truthiswill/usaspending-api | bd7d915442e2ec94cc830c480ceeffd4479be6c0 | [
"CC0-1.0"
] | null | null | null | usaspending_api/awards/migrations/0037_merge_subaward_and_subaward_matview.py | truthiswill/usaspending-api | bd7d915442e2ec94cc830c480ceeffd4479be6c0 | [
"CC0-1.0"
] | 1 | 2021-11-15T17:54:12.000Z | 2021-11-15T17:54:12.000Z | usaspending_api/awards/migrations/0037_merge_subaward_and_subaward_matview.py | truthiswill/usaspending-api | bd7d915442e2ec94cc830c480ceeffd4479be6c0 | [
"CC0-1.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-08-09 18:04
from __future__ import unicode_literals
import django.contrib.postgres.fields
import django.contrib.postgres.search
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('awards', '0036_auto_20180812_1529'),
]
operations = [
migrations.AddField(
model_name='subaward',
name='award_ts_vector',
field=django.contrib.postgres.search.SearchVectorField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='awarding_subtier_agency_abbreviation',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='awarding_subtier_agency_name',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='awarding_toptier_agency_abbreviation',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='awarding_toptier_agency_name',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='business_categories',
field=django.contrib.postgres.fields.ArrayField(base_field=models.TextField(), default=list, size=None),
),
migrations.AddField(
model_name='subaward',
name='cfda_number',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='cfda_title',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='extent_competed',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='fain',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='fiscal_year',
field=models.IntegerField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='funding_subtier_agency_abbreviation',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='funding_subtier_agency_name',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='funding_toptier_agency_abbreviation',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='funding_toptier_agency_name',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='keyword_ts_vector',
field=django.contrib.postgres.search.SearchVectorField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='last_modified_date',
field=models.DateField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='latest_transaction_id',
field=models.IntegerField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='parent_recipient_unique_id',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='piid',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='pop_city_code',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='pop_congressional_code',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='pop_country_code',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='pop_country_name',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='pop_county_code',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='pop_county_name',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='pop_state_code',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='pop_zip5',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='prime_award_type',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='prime_recipient_name',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='product_or_service_code',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='product_or_service_description',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='pulled_from',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='recipient_location_congressional_code',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='recipient_location_country_code',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='recipient_location_country_name',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='recipient_location_county_code',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='recipient_location_county_name',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='recipient_location_state_code',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='recipient_location_zip5',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='recipient_name',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='recipient_name_ts_vector',
field=django.contrib.postgres.search.SearchVectorField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='recipient_unique_id',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='total_obl_bin',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='type_of_contract_pricing',
field=models.TextField(blank=True, null=True),
),
migrations.AddField(
model_name='subaward',
name='type_set_aside',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='subaward',
name='award_type',
field=models.TextField(db_index=True, default='unknown', help_text='Whether the parent Award is a Procurement or a Grant', verbose_name='Award Type'),
),
migrations.AlterField(
model_name='subaward',
name='broker_award_id',
field=models.IntegerField(db_index=True, default=0, help_text='The ID of the parent award in broker', verbose_name='FSRS Award ID in the Broker'),
),
migrations.AlterField(
model_name='subaward',
name='id',
field=models.AutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='subaward',
name='internal_id',
field=models.TextField(db_index=True, default='', help_text='The internal of the parent award in broker from FSRS', verbose_name='Internal ID of the parent Award'),
),
migrations.AlterModelTable(
name='subaward',
table='subaward',
),
]
| 35.775735 | 176 | 0.573322 | 929 | 9,731 | 5.820237 | 0.142088 | 0.113187 | 0.157204 | 0.194193 | 0.839837 | 0.831885 | 0.787313 | 0.764564 | 0.755872 | 0.755872 | 0 | 0.005541 | 0.313842 | 9,731 | 271 | 177 | 35.907749 | 0.804253 | 0.007091 | 0 | 0.738636 | 1 | 0 | 0.171757 | 0.067916 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.015152 | 0 | 0.026515 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 9 |
01de9b9186f1d42c29a745c349c103c018386e01 | 136 | py | Python | examples/src/dbnd_examples/dbnd_spark/__init__.py | busunkim96/dbnd | 0191fdcd4c4fbd35006f1026d1a55b2abab9097b | [
"Apache-2.0"
] | 224 | 2020-01-02T10:46:37.000Z | 2022-03-02T13:54:08.000Z | examples/src/dbnd_examples/dbnd_spark/__init__.py | busunkim96/dbnd | 0191fdcd4c4fbd35006f1026d1a55b2abab9097b | [
"Apache-2.0"
] | 16 | 2020-03-11T09:37:58.000Z | 2022-01-26T10:22:08.000Z | examples/src/dbnd_examples/dbnd_spark/__init__.py | busunkim96/dbnd | 0191fdcd4c4fbd35006f1026d1a55b2abab9097b | [
"Apache-2.0"
] | 24 | 2020-03-24T13:53:50.000Z | 2022-03-22T11:55:18.000Z | from dbnd_examples.data import dbnd_examples_src_path
def spark_folder(*path):
return dbnd_examples_src_path("dbnd_spark", *path)
| 22.666667 | 54 | 0.808824 | 21 | 136 | 4.809524 | 0.52381 | 0.356436 | 0.29703 | 0.376238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.110294 | 136 | 5 | 55 | 27.2 | 0.834711 | 0 | 0 | 0 | 0 | 0 | 0.073529 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | true | 0 | 0.333333 | 0.333333 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 10 |
01e7cf3ed923884c658cd876547fdc8e0f7ef2da | 3,943 | py | Python | testSchemeParser.py | Martin-H1/TinyComp | 0ce2e568fb829baf90a38dff467a6376e7a031b6 | [
"MIT"
] | null | null | null | testSchemeParser.py | Martin-H1/TinyComp | 0ce2e568fb829baf90a38dff467a6376e7a031b6 | [
"MIT"
] | null | null | null | testSchemeParser.py | Martin-H1/TinyComp | 0ce2e568fb829baf90a38dff467a6376e7a031b6 | [
"MIT"
] | null | null | null | import unittest
from schemeparser import SchemeParser, AbstractSyntaxTree
from tokenizer import Token
class TestSchemeParser(unittest.TestCase):
def test_c_tokenize(self):
tokenList = (
Token(type=Token.COMMENT, value='a comment.'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.KEYWORD, value='define'),
Token(type=Token.IDENTIFIER, value='data'),
Token(type=Token.SEPARATOR, value="'"),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.LITERAL, value='1'),
Token(type=Token.LITERAL, value='2'),
Token(type=Token.LITERAL, value='3'),
Token(type=Token.LITERAL, value='4'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.KEYWORD, value='define'),
Token(type=Token.IDENTIFIER, value='factorial'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.KEYWORD, value='lambda'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.IDENTIFIER, value='n'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.KEYWORD, value='if'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.OPERATOR, value='='),
Token(type=Token.IDENTIFIER, value='n'),
Token(type=Token.LITERAL, value='0'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.LITERAL, value='1'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.OPERATOR, value='*'),
Token(type=Token.IDENTIFIER, value='n'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.IDENTIFIER, value='factorial'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.OPERATOR, value='-'),
Token(type=Token.IDENTIFIER, value='n'),
Token(type=Token.LITERAL, value='1'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.KEYWORD, value='define'),
Token(type=Token.IDENTIFIER, value='hello_world'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.KEYWORD, value='lambda'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.KEYWORD, value='display'),
Token(type=Token.STRING, value='Hello World!'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.KEYWORD, value='define'),
Token(type=Token.IDENTIFIER, value='main'),
Token(type=Token.SEPARATOR, value='('),
Token(type=Token.IDENTIFIER, value='factorial'),
Token(type=Token.LITERAL, value='5'),
Token(type=Token.SEPARATOR, value=')'),
Token(type=Token.SEPARATOR, value=')') )
parser = SchemeParser()
parser.parse(tokenList)
self.processChildren(parser.astRoot, 0)
def processChildren(self, node, level):
print(" " * level + str(node))
children = node.children
ast = children[:1]
while ast != []:
self.processChildren(ast[0], level + 1)
children = children[1:]
ast = children[:1]
if __name__ == '__main__':
unittest.main()
| 45.848837 | 62 | 0.566066 | 406 | 3,943 | 5.470443 | 0.133005 | 0.251238 | 0.390815 | 0.282305 | 0.787933 | 0.753715 | 0.753715 | 0.753715 | 0.753715 | 0.753715 | 0 | 0.004838 | 0.266041 | 3,943 | 85 | 63 | 46.388235 | 0.762612 | 0 | 0 | 0.580247 | 0 | 0 | 0.043368 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.024691 | false | 0 | 0.037037 | 0 | 0.074074 | 0.012346 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
bf28e0bb86eb4e3af8b9822af6561b3f7b02940f | 6,921 | py | Python | tests/test_pangenomevariation.py | iqbal-lab-org/pangenome_variations | 0aa8f5233bb2130b1876a5197f3ffbe7c3830601 | [
"MIT"
] | null | null | null | tests/test_pangenomevariation.py | iqbal-lab-org/pangenome_variations | 0aa8f5233bb2130b1876a5197f3ffbe7c3830601 | [
"MIT"
] | 9 | 2021-03-30T12:28:36.000Z | 2022-01-13T03:28:10.000Z | tests/test_pangenomevariation.py | iqbal-lab-org/pangenome_variations | 0aa8f5233bb2130b1876a5197f3ffbe7c3830601 | [
"MIT"
] | 1 | 2020-11-04T15:13:30.000Z | 2020-11-04T15:13:30.000Z | from unittest import TestCase
from src.PangenomeVariation import PangenomeVariation
from src.Allele import Allele
class TestPangenomeVariation(TestCase):
def test____get_unique_allele_sequences___one_allele(self, *mocks):
pangenome_variation = PangenomeVariation(0, [Allele("genome_1", "chrom_1", 1, "A")])
actual = pangenome_variation.unique_allele_sequences
expected = ["A"]
self.assertListEqual(actual, expected)
def test____get_unique_allele_sequences___two_unique_alleles_with_several_alleles(self, *mocks):
pangenome_variation = PangenomeVariation(0, [Allele("genome_1", "chrom_1", 1, "G"),
Allele("genome_1", "chrom_1", 1, "G"),
Allele("genome_1", "chrom_1", 1, "G"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_1", "chrom_1", 1, "G"),
Allele("genome_1", "chrom_1", 1, "A"), ])
actual = pangenome_variation.unique_allele_sequences
expected = ["A", "G"]
self.assertListEqual(actual, expected)
def test____get_unique_allele_sequences___three_unique_alleles_with_several_alleles(self, *mocks):
pangenome_variation = PangenomeVariation(0, [Allele("genome_1", "chrom_1", 1, "G"),
Allele("genome_1", "chrom_1", 1, "G"),
Allele("genome_1", "chrom_1", 1, "G"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_1", "chrom_1", 1, "G"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_1", "chrom_1", 1, "C"), ])
actual = pangenome_variation.unique_allele_sequences
expected = ["A", "C", "G"]
self.assertListEqual(actual, expected)
def test___is_consistent___two_genomes___single_chrom_and_pos_for_each_genome(self):
pangenome_variation = PangenomeVariation(0, [Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 2, "A"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 2, "A"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 2, "A")])
self.assertTrue(pangenome_variation.is_consistent())
def test___is_consistent___two_genomes___different_chrom_for_genome_1(self):
pangenome_variation = PangenomeVariation(0, [Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 2, "A"),
Allele("genome_1", "chrom_2", 1, "A"),
Allele("genome_2", "chrom_2", 2, "A"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 2, "A")])
self.assertFalse(pangenome_variation.is_consistent())
def test___is_consistent___two_genomes___different_chrom_for_genome_2(self):
pangenome_variation = PangenomeVariation(0, [Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 2, "A"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 2, "A"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_1", 2, "A")])
self.assertFalse(pangenome_variation.is_consistent())
def test___is_consistent___two_genomes___different_pos_for_genome_1(self):
pangenome_variation = PangenomeVariation(0, [Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 2, "A"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 2, "A"),
Allele("genome_1", "chrom_1", 2, "A"),
Allele("genome_2", "chrom_2", 2, "A")])
self.assertFalse(pangenome_variation.is_consistent())
def test___is_consistent___two_genomes___different_pos_for_genome_2(self):
pangenome_variation = PangenomeVariation(0, [Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 1, "A"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 2, "A"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 2, "A")])
self.assertFalse(pangenome_variation.is_consistent())
def test___get_set_of_samples(self):
pangenome_variation = PangenomeVariation(0, [Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 1, "A"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_1", "chrom_2", 2, "A"),
Allele("genome_1", "plasmid", 2, "A"),
Allele("genome_3", "plasmid", 2, "A"),
Allele("genome_2", "chrom_2", 20, "A"),
Allele("genome_1", "chrom_1", 1, "A"),
Allele("genome_2", "chrom_2", 50, "A")])
actual_set_of_samples = pangenome_variation.get_set_of_samples()
actual_number_of_samples = pangenome_variation.get_number_of_samples()
expected_set_of_samples = {"genome_1", "genome_2", "genome_3"}
expected_number_of_samples = 3
self.assertSetEqual(actual_set_of_samples, expected_set_of_samples)
self.assertEqual(actual_number_of_samples, expected_number_of_samples)
| 71.350515 | 102 | 0.457159 | 653 | 6,921 | 4.399694 | 0.085758 | 0.221371 | 0.162896 | 0.206753 | 0.865646 | 0.835016 | 0.796032 | 0.768187 | 0.749391 | 0.749391 | 0 | 0.044166 | 0.424216 | 6,921 | 96 | 103 | 72.09375 | 0.676788 | 0 | 0 | 0.604651 | 0 | 0 | 0.12686 | 0 | 0 | 0 | 0 | 0 | 0.116279 | 1 | 0.104651 | false | 0 | 0.034884 | 0 | 0.151163 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.