content
stringlengths
7
1.05M
# dataset settings dataset_type = 'CUB' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='Resize', size=510), dict(type='RandomCrop', size=384), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='ToTensor', keys=['gt_label']), dict(type='Collect', keys=['img', 'gt_label']) ] test_pipeline = [ dict(type='LoadImageFromFile'), dict(type='Resize', size=510), dict(type='CenterCrop', crop_size=384), dict(type='Normalize', **img_norm_cfg), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']) ] data_root = 'data/CUB_200_2011/' data = dict( samples_per_gpu=8, workers_per_gpu=2, train=dict( type=dataset_type, ann_file=data_root + 'images.txt', image_class_labels_file=data_root + 'image_class_labels.txt', train_test_split_file=data_root + 'train_test_split.txt', data_prefix=data_root + 'images', pipeline=train_pipeline), val=dict( type=dataset_type, ann_file=data_root + 'images.txt', image_class_labels_file=data_root + 'image_class_labels.txt', train_test_split_file=data_root + 'train_test_split.txt', data_prefix=data_root + 'images', test_mode=True, pipeline=test_pipeline), test=dict( type=dataset_type, ann_file=data_root + 'images.txt', image_class_labels_file=data_root + 'image_class_labels.txt', train_test_split_file=data_root + 'train_test_split.txt', data_prefix=data_root + 'images', test_mode=True, pipeline=test_pipeline)) evaluation = dict( interval=1, metric='accuracy', save_best='auto') # save the checkpoint with highest accuracy
# -*- coding: utf-8 -*- class Config: class MongoDB: database = "crawlib2_test"
months = "JanFebMarAprMayJunJulAugSepOctNovDec" n = int(input("Enter month Number: ")) if (n > 0 and n < 13): mE = (3 * n) mA = mE - 3 print(months[mA:mE]) else: print("falsche Zahl")
""" >>> getg() 5 >>> setg(42) >>> getg() 42 """ g = 5 def setg(a): global g g = a def getg(): return g class Test(object): """ >>> global_in_class 9 >>> Test.global_in_class Traceback (most recent call last): AttributeError: type object 'Test' has no attribute 'global_in_class' >>> Test().global_in_class Traceback (most recent call last): AttributeError: 'Test' object has no attribute 'global_in_class' """ global global_in_class global_in_class = 9
#!python with open('pessoas.csv') as arquivo: with open('pessoas.txt', 'w') as saida: for registro in arquivo: pessoa = registro.strip().split(',') print('Nome:{}, Idade:{}'.format(*pessoa), file=saida) if saida.closed: print('Saida OK') if arquivo.closed: print('saida ok')
class ConfigError(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class MercuryUnsupportedService(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class MercuryConnectException(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class MercuriusRequestException(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class MercuriusHTTPException(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs) class MercuriusHeaderException(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, *args, **kwargs)
####################################### graph={} graph["start"]["a"]=6 graph["start"]["b"]=2 graph["a"]={} graph["a"]["fin"]=1 graph["b"]={} graph["b"]["a"]=3 graph["b"]["fin"]=5 graph["fin"]={} ####################################### infinity = float("inf") costs={} costs["a"]=6 costs["b"]=2 costs["fin"]=infinity ####################################### ###### parents={} parents["a"]="start" parents["b"]="start" parents["fin"]=None ####################################### processed = [] node = find_lowest_cost_node(costs) while node is not None: cost = costs[node] neightbors = graph[node] for n in neightbors.key(): new_cost = cost+neightbors[n] if costs[n]> new_cost: costs[n]=new_cost parents[n]=node processed.append(node) node = find_lowest_cost_node(costs) def find_lowest_cost_node(costs): lowest_cost = float("inf") lowest_cost_node=None for node in costs: cost = costs[node] if cost < lowest_cost and node not in processed: lowest_cost = cost lowest_cost_node = node return lowest_cost_node
# Calcula o IMC. print(' ====== Exercicio 43 ====== ') peso = float(input('Digite seu peso em quilos: ')) altura = float(input('digite sua altura em metros: ')) # Calculo do IMC. imc = peso / (altura ** 2) # verificando o IMC e exibindo o indice do usuário. print('\nSeu IMC: {:.1f}'.format(imc)) print('Voce está em ', end = '') if(imc <= 18.5): print('Abaixo do peso') elif(imc < 25): print('Peso ideal') elif(imc <= 30): print('Sobrepeso') elif(imc <= 40): print('Obesidade') else: print('Obesidade Mórbida')
## using the return statement in python ## execute fct and give the respond back def cube(num): ## expectin one num return num*num*num ## allows to return value to the caller print(cube(3)) ## return none result = cube(4) print(result)
def flatten(x): """Flatten a two-dimensional list into one-dimension. Todo: * Support flattening n-dimension list into one-dimension. Args: x (list of list of any): A two-dimension list. Returns: list of any: An one-dimension list. """ return [a for i in x for a in i] def replace_with_phrases(tokens, phrases): """Replace applicable tokens in semantically-ordered tokens with their corresponding phrase. Args: tokens (list of str): A list of semantically-ordered tokens. phrases (list of str): A list of phrases. Returns: list of str: A list of tokens which applicable tokens are replaced with a corresponding phrase. Examples: >>> print(tokens) ['it', 'is', 'straight', 'forward'] >>> print(phrases) ['straight forward'] >>> print(replace_with_phrases(tokens, phrases)) ['it', 'is', 'straight forward'] """ tempTokens = tokens.copy() for phrase in phrases: phraseTokens = phrase.split(' ') isPhrase = False for i in range(len(tempTokens) + 1 - len(phraseTokens)): matches = 0 for key, token in enumerate(phraseTokens): if tempTokens[i + key] == token: matches += 1 if matches == len(phraseTokens): isPhrase = True break if isPhrase: start = tempTokens.index(phraseTokens[0]) end = start + len(phraseTokens) tempTokens[start:end] = [' '.join(phraseTokens)] return tempTokens def append_with_phrases(tokens, phrases): """Append phrases to the tokens. Args: tokens (list of str): A list of tokens. phrases (list of str): A list of phrases. Returns: list of str: A concatinated list of tokens and phrases. """ return tokens + phrases
# Used when we want to process an array of requests through a chain of handlers. Respective handler processes the request depending on the value, and send the request to the successor handler if not handled at that handler. class Handler: def __init__(self, successor): self.successor = successor def handle(self, request): handled = self._handle(request) if not handled: print("-- Refering to successor,", request) self.successor.handle(request) def _handle(self, request): raise NotImplementedError("NotImplementedError") class HandlerOne(Handler): def _handle(self, request): if 0 < request < 10: print("Handled by H-One", request) return True class HandlerTwo(Handler): def _handle(self, request): if request < 25: print("Handled by H-Two", request) return True class DefaultHandler(Handler): def _handle(self, request): print("End of chain", request) return True class Client: def __init__(self): self.handler = HandlerOne(HandlerTwo(DefaultHandler(None))) def delegate(self, requests): for r in requests: self.handler.handle(r) c = Client() requests = [1, 2, 3, 24, 30] c.delegate(requests)
def brac_balance(expr): stack = [] for char in expr: if char in ["(", "{", "["]: stack.append(char) else: if not stack: return False current_char = stack.pop() if current_char == '(': if char != ")": return False if current_char == '{': if char != "}": return False if current_char == '[': if char != "]": return False if stack: return False return True if __name__ == "__main__": expr = input('enter bracs as per your need ') if brac_balance(expr): print("true") else: print('false')
# Stack implementation ''' Stack using python list. Use append to push an item onto the stack and pop to remove an item ''' my_stack = list() my_stack.append(4) my_stack.append(7) my_stack.append(12) my_stack.append(19) print(my_stack) print(my_stack.pop()) # 19 print(my_stack.pop()) # 12 print(my_stack) # [4,7]
class LED_80_64: keySize = 64 T0 = [0x00BB00DD00AA0055, 0x00BA00D100AE0057, 0x00BC00DF00A5005B, 0x00B500D900A7005A, 0x00B100DC00A40052, 0x00B000D000A00050, 0x00B700D200AF005E, 0x00B900D600A20051, 0x00B600DE00AB005C, 0x00BF00D800A9005D, 0x00BD00D300A10059, 0x00B300D700AC0056, 0x00B800DA00A60053, 0x00BE00D400AD005F, 0x00B200DB00A80054, 0x00B400D500A30058, 0x00AB001D00EA0075, 0x00AA001100EE0077, 0x00AC001F00E5007B, 0x00A5001900E7007A, 0x00A1001C00E40072, 0x00A0001000E00070, 0x00A7001200EF007E, 0x00A9001600E20071, 0x00A6001E00EB007C, 0x00AF001800E9007D, 0x00AD001300E10079, 0x00A3001700EC0076, 0x00A8001A00E60073, 0x00AE001400ED007F, 0x00A2001B00E80074, 0x00A4001500E30078, 0x00CB00FD005A00B5, 0x00CA00F1005E00B7, 0x00CC00FF005500BB, 0x00C500F9005700BA, 0x00C100FC005400B2, 0x00C000F0005000B0, 0x00C700F2005F00BE, 0x00C900F6005200B1, 0x00C600FE005B00BC, 0x00CF00F8005900BD, 0x00CD00F3005100B9, 0x00C300F7005C00B6, 0x00C800FA005600B3, 0x00CE00F4005D00BF, 0x00C200FB005800B4, 0x00C400F5005300B8, 0x005B009D007A00A5, 0x005A0091007E00A7, 0x005C009F007500AB, 0x00550099007700AA, 0x0051009C007400A2, 0x00500090007000A0, 0x00570092007F00AE, 0x00590096007200A1, 0x0056009E007B00AC, 0x005F0098007900AD, 0x005D0093007100A9, 0x00530097007C00A6, 0x0058009A007600A3, 0x005E0094007D00AF, 0x0052009B007800A4, 0x00540095007300A8, 0x001B00CD004A0025, 0x001A00C1004E0027, 0x001C00CF0045002B, 0x001500C90047002A, 0x001100CC00440022, 0x001000C000400020, 0x001700C2004F002E, 0x001900C600420021, 0x001600CE004B002C, 0x001F00C80049002D, 0x001D00C300410029, 0x001300C7004C0026, 0x001800CA00460023, 0x001E00C4004D002F, 0x001200CB00480024, 0x001400C500430028, 0x000B000D000A0005, 0x000A0001000E0007, 0x000C000F0005000B, 0x000500090007000A, 0x0001000C00040002, 0x0000000000000000, 0x00070002000F000E, 0x0009000600020001, 0x0006000E000B000C, 0x000F00080009000D, 0x000D000300010009, 0x00030007000C0006, 0x0008000A00060003, 0x000E0004000D000F, 0x0002000B00080004, 0x0004000500030008, 0x007B002D00FA00E5, 0x007A002100FE00E7, 0x007C002F00F500EB, 0x0075002900F700EA, 0x0071002C00F400E2, 0x0070002000F000E0, 0x0077002200FF00EE, 0x0079002600F200E1, 0x0076002E00FB00EC, 0x007F002800F900ED, 0x007D002300F100E9, 0x0073002700FC00E6, 0x0078002A00F600E3, 0x007E002400FD00EF, 0x0072002B00F800E4, 0x0074002500F300E8, 0x009B006D002A0015, 0x009A0061002E0017, 0x009C006F0025001B, 0x009500690027001A, 0x0091006C00240012, 0x0090006000200010, 0x00970062002F001E, 0x0099006600220011, 0x0096006E002B001C, 0x009F00680029001D, 0x009D006300210019, 0x00930067002C0016, 0x0098006A00260013, 0x009E0064002D001F, 0x0092006B00280014, 0x0094006500230018, 0x006B00ED00BA00C5, 0x006A00E100BE00C7, 0x006C00EF00B500CB, 0x006500E900B700CA, 0x006100EC00B400C2, 0x006000E000B000C0, 0x006700E200BF00CE, 0x006900E600B200C1, 0x006600EE00BB00CC, 0x006F00E800B900CD, 0x006D00E300B100C9, 0x006300E700BC00C6, 0x006800EA00B600C3, 0x006E00E400BD00CF, 0x006200EB00B800C4, 0x006400E500B300C8, 0x00FB008D009A00D5, 0x00FA0081009E00D7, 0x00FC008F009500DB, 0x00F50089009700DA, 0x00F1008C009400D2, 0x00F00080009000D0, 0x00F70082009F00DE, 0x00F90086009200D1, 0x00F6008E009B00DC, 0x00FF0088009900DD, 0x00FD0083009100D9, 0x00F30087009C00D6, 0x00F8008A009600D3, 0x00FE0084009D00DF, 0x00F2008B009800D4, 0x00F40085009300D8, 0x00DB003D001A0095, 0x00DA0031001E0097, 0x00DC003F0015009B, 0x00D500390017009A, 0x00D1003C00140092, 0x00D0003000100090, 0x00D70032001F009E, 0x00D9003600120091, 0x00D6003E001B009C, 0x00DF00380019009D, 0x00DD003300110099, 0x00D30037001C0096, 0x00D8003A00160093, 0x00DE0034001D009F, 0x00D2003B00180094, 0x00D4003500130098, 0x003B007D00CA0065, 0x003A007100CE0067, 0x003C007F00C5006B, 0x0035007900C7006A, 0x0031007C00C40062, 0x0030007000C00060, 0x0037007200CF006E, 0x0039007600C20061, 0x0036007E00CB006C, 0x003F007800C9006D, 0x003D007300C10069, 0x0033007700CC0066, 0x0038007A00C60063, 0x003E007400CD006F, 0x0032007B00C80064, 0x0034007500C30068, 0x008B00AD006A0035, 0x008A00A1006E0037, 0x008C00AF0065003B, 0x008500A90067003A, 0x008100AC00640032, 0x008000A000600030, 0x008700A2006F003E, 0x008900A600620031, 0x008600AE006B003C, 0x008F00A80069003D, 0x008D00A300610039, 0x008300A7006C0036, 0x008800AA00660033, 0x008E00A4006D003F, 0x008200AB00680034, 0x008400A500630038, 0x00EB004D00DA00F5, 0x00EA004100DE00F7, 0x00EC004F00D500FB, 0x00E5004900D700FA, 0x00E1004C00D400F2, 0x00E0004000D000F0, 0x00E7004200DF00FE, 0x00E9004600D200F1, 0x00E6004E00DB00FC, 0x00EF004800D900FD, 0x00ED004300D100F9, 0x00E3004700DC00F6, 0x00E8004A00D600F3, 0x00EE004400DD00FF, 0x00E2004B00D800F4, 0x00E4004500D300F8, 0x002B00BD008A0045, 0x002A00B1008E0047, 0x002C00BF0085004B, 0x002500B90087004A, 0x002100BC00840042, 0x002000B000800040, 0x002700B2008F004E, 0x002900B600820041, 0x002600BE008B004C, 0x002F00B80089004D, 0x002D00B300810049, 0x002300B7008C0046, 0x002800BA00860043, 0x002E00B4008D004F, 0x002200BB00880044, 0x002400B500830048, 0x004B005D003A0085, 0x004A0051003E0087, 0x004C005F0035008B, 0x004500590037008A, 0x0041005C00340082, 0x0040005000300080, 0x00470052003F008E, 0x0049005600320081, 0x0046005E003B008C, 0x004F00580039008D, 0x004D005300310089, 0x00430057003C0086, 0x0048005A00360083, 0x004E0054003D008F, 0x0042005B00380084, 0x0044005500330088] T1 = [0xBB00DD00AA005500, 0xBA00D100AE005700, 0xBC00DF00A5005B00, 0xB500D900A7005A00, 0xB100DC00A4005200, 0xB000D000A0005000, 0xB700D200AF005E00, 0xB900D600A2005100, 0xB600DE00AB005C00, 0xBF00D800A9005D00, 0xBD00D300A1005900, 0xB300D700AC005600, 0xB800DA00A6005300, 0xBE00D400AD005F00, 0xB200DB00A8005400, 0xB400D500A3005800, 0xAB001D00EA007500, 0xAA001100EE007700, 0xAC001F00E5007B00, 0xA5001900E7007A00, 0xA1001C00E4007200, 0xA0001000E0007000, 0xA7001200EF007E00, 0xA9001600E2007100, 0xA6001E00EB007C00, 0xAF001800E9007D00, 0xAD001300E1007900, 0xA3001700EC007600, 0xA8001A00E6007300, 0xAE001400ED007F00, 0xA2001B00E8007400, 0xA4001500E3007800, 0xCB00FD005A00B500, 0xCA00F1005E00B700, 0xCC00FF005500BB00, 0xC500F9005700BA00, 0xC100FC005400B200, 0xC000F0005000B000, 0xC700F2005F00BE00, 0xC900F6005200B100, 0xC600FE005B00BC00, 0xCF00F8005900BD00, 0xCD00F3005100B900, 0xC300F7005C00B600, 0xC800FA005600B300, 0xCE00F4005D00BF00, 0xC200FB005800B400, 0xC400F5005300B800, 0x5B009D007A00A500, 0x5A0091007E00A700, 0x5C009F007500AB00, 0x550099007700AA00, 0x51009C007400A200, 0x500090007000A000, 0x570092007F00AE00, 0x590096007200A100, 0x56009E007B00AC00, 0x5F0098007900AD00, 0x5D0093007100A900, 0x530097007C00A600, 0x58009A007600A300, 0x5E0094007D00AF00, 0x52009B007800A400, 0x540095007300A800, 0x1B00CD004A002500, 0x1A00C1004E002700, 0x1C00CF0045002B00, 0x1500C90047002A00, 0x1100CC0044002200, 0x1000C00040002000, 0x1700C2004F002E00, 0x1900C60042002100, 0x1600CE004B002C00, 0x1F00C80049002D00, 0x1D00C30041002900, 0x1300C7004C002600, 0x1800CA0046002300, 0x1E00C4004D002F00, 0x1200CB0048002400, 0x1400C50043002800, 0x0B000D000A000500, 0x0A0001000E000700, 0x0C000F0005000B00, 0x0500090007000A00, 0x01000C0004000200, 0x0000000000000000, 0x070002000F000E00, 0x0900060002000100, 0x06000E000B000C00, 0x0F00080009000D00, 0x0D00030001000900, 0x030007000C000600, 0x08000A0006000300, 0x0E0004000D000F00, 0x02000B0008000400, 0x0400050003000800, 0x7B002D00FA00E500, 0x7A002100FE00E700, 0x7C002F00F500EB00, 0x75002900F700EA00, 0x71002C00F400E200, 0x70002000F000E000, 0x77002200FF00EE00, 0x79002600F200E100, 0x76002E00FB00EC00, 0x7F002800F900ED00, 0x7D002300F100E900, 0x73002700FC00E600, 0x78002A00F600E300, 0x7E002400FD00EF00, 0x72002B00F800E400, 0x74002500F300E800, 0x9B006D002A001500, 0x9A0061002E001700, 0x9C006F0025001B00, 0x9500690027001A00, 0x91006C0024001200, 0x9000600020001000, 0x970062002F001E00, 0x9900660022001100, 0x96006E002B001C00, 0x9F00680029001D00, 0x9D00630021001900, 0x930067002C001600, 0x98006A0026001300, 0x9E0064002D001F00, 0x92006B0028001400, 0x9400650023001800, 0x6B00ED00BA00C500, 0x6A00E100BE00C700, 0x6C00EF00B500CB00, 0x6500E900B700CA00, 0x6100EC00B400C200, 0x6000E000B000C000, 0x6700E200BF00CE00, 0x6900E600B200C100, 0x6600EE00BB00CC00, 0x6F00E800B900CD00, 0x6D00E300B100C900, 0x6300E700BC00C600, 0x6800EA00B600C300, 0x6E00E400BD00CF00, 0x6200EB00B800C400, 0x6400E500B300C800, 0xFB008D009A00D500, 0xFA0081009E00D700, 0xFC008F009500DB00, 0xF50089009700DA00, 0xF1008C009400D200, 0xF00080009000D000, 0xF70082009F00DE00, 0xF90086009200D100, 0xF6008E009B00DC00, 0xFF0088009900DD00, 0xFD0083009100D900, 0xF30087009C00D600, 0xF8008A009600D300, 0xFE0084009D00DF00, 0xF2008B009800D400, 0xF40085009300D800, 0xDB003D001A009500, 0xDA0031001E009700, 0xDC003F0015009B00, 0xD500390017009A00, 0xD1003C0014009200, 0xD000300010009000, 0xD70032001F009E00, 0xD900360012009100, 0xD6003E001B009C00, 0xDF00380019009D00, 0xDD00330011009900, 0xD30037001C009600, 0xD8003A0016009300, 0xDE0034001D009F00, 0xD2003B0018009400, 0xD400350013009800, 0x3B007D00CA006500, 0x3A007100CE006700, 0x3C007F00C5006B00, 0x35007900C7006A00, 0x31007C00C4006200, 0x30007000C0006000, 0x37007200CF006E00, 0x39007600C2006100, 0x36007E00CB006C00, 0x3F007800C9006D00, 0x3D007300C1006900, 0x33007700CC006600, 0x38007A00C6006300, 0x3E007400CD006F00, 0x32007B00C8006400, 0x34007500C3006800, 0x8B00AD006A003500, 0x8A00A1006E003700, 0x8C00AF0065003B00, 0x8500A90067003A00, 0x8100AC0064003200, 0x8000A00060003000, 0x8700A2006F003E00, 0x8900A60062003100, 0x8600AE006B003C00, 0x8F00A80069003D00, 0x8D00A30061003900, 0x8300A7006C003600, 0x8800AA0066003300, 0x8E00A4006D003F00, 0x8200AB0068003400, 0x8400A50063003800, 0xEB004D00DA00F500, 0xEA004100DE00F700, 0xEC004F00D500FB00, 0xE5004900D700FA00, 0xE1004C00D400F200, 0xE0004000D000F000, 0xE7004200DF00FE00, 0xE9004600D200F100, 0xE6004E00DB00FC00, 0xEF004800D900FD00, 0xED004300D100F900, 0xE3004700DC00F600, 0xE8004A00D600F300, 0xEE004400DD00FF00, 0xE2004B00D800F400, 0xE4004500D300F800, 0x2B00BD008A004500, 0x2A00B1008E004700, 0x2C00BF0085004B00, 0x2500B90087004A00, 0x2100BC0084004200, 0x2000B00080004000, 0x2700B2008F004E00, 0x2900B60082004100, 0x2600BE008B004C00, 0x2F00B80089004D00, 0x2D00B30081004900, 0x2300B7008C004600, 0x2800BA0086004300, 0x2E00B4008D004F00, 0x2200BB0088004400, 0x2400B50083004800, 0x4B005D003A008500, 0x4A0051003E008700, 0x4C005F0035008B00, 0x4500590037008A00, 0x41005C0034008200, 0x4000500030008000, 0x470052003F008E00, 0x4900560032008100, 0x46005E003B008C00, 0x4F00580039008D00, 0x4D00530031008900, 0x430057003C008600, 0x48005A0036008300, 0x4E0054003D008F00, 0x42005B0038008400, 0x4400550033008800] T2 = [0xB00B4004E00EC00C, 0xA00B3004D00E500C, 0xC00B2004700E600C, 0x500B8004F00EB00C, 0x100B7004300E900C, 0x000B0004000E000C, 0x700B6004900EA00C, 0x900BA004800ED00C, 0x600B1004A00E300C, 0xF00BB004200EE00C, 0xD00B5004400EF00C, 0x300B9004500E800C, 0x800BD004B00E400C, 0xE00BC004100E700C, 0x200BE004600E100C, 0x400BF004C00E200C, 0xB00A4003E00DC005, 0xA00A3003D00D5005, 0xC00A2003700D6005, 0x500A8003F00DB005, 0x100A7003300D9005, 0x000A0003000D0005, 0x700A6003900DA005, 0x900AA003800DD005, 0x600A1003A00D3005, 0xF00AB003200DE005, 0xD00A5003400DF005, 0x300A9003500D8005, 0x800AD003B00D4005, 0xE00AC003100D7005, 0x200AE003600D1005, 0x400AF003C00D2005, 0xB00C4002E007C006, 0xA00C3002D0075006, 0xC00C200270076006, 0x500C8002F007B006, 0x100C700230079006, 0x000C000200070006, 0x700C60029007A006, 0x900CA0028007D006, 0x600C1002A0073006, 0xF00CB0022007E006, 0xD00C50024007F006, 0x300C900250078006, 0x800CD002B0074006, 0xE00CC00210077006, 0x200CE00260071006, 0x400CF002C0072006, 0xB0054008E00FC00B, 0xA0053008D00F500B, 0xC0052008700F600B, 0x50058008F00FB00B, 0x10057008300F900B, 0x00050008000F000B, 0x70056008900FA00B, 0x9005A008800FD00B, 0x60051008A00F300B, 0xF005B008200FE00B, 0xD0055008400FF00B, 0x30059008500F800B, 0x8005D008B00F400B, 0xE005C008100F700B, 0x2005E008600F100B, 0x4005F008C00F200B, 0xB0014007E003C009, 0xA0013007D0035009, 0xC001200770036009, 0x50018007F003B009, 0x1001700730039009, 0x0001000700030009, 0x700160079003A009, 0x9001A0078003D009, 0x60011007A0033009, 0xF001B0072003E009, 0xD00150074003F009, 0x3001900750038009, 0x8001D007B0034009, 0xE001C00710037009, 0x2001E00760031009, 0x4001F007C0032009, 0xB0004000E000C000, 0xA0003000D0005000, 0xC000200070006000, 0x50008000F000B000, 0x1000700030009000, 0x0000000000000000, 0x700060009000A000, 0x9000A0008000D000, 0x60001000A0003000, 0xF000B0002000E000, 0xD00050004000F000, 0x3000900050008000, 0x8000D000B0004000, 0xE000C00010007000, 0x2000E00060001000, 0x4000F000C0002000, 0xB0074006E009C00A, 0xA0073006D009500A, 0xC00720067009600A, 0x50078006F009B00A, 0x100770063009900A, 0x000700060009000A, 0x700760069009A00A, 0x9007A0068009D00A, 0x60071006A009300A, 0xF007B0062009E00A, 0xD00750064009F00A, 0x300790065009800A, 0x8007D006B009400A, 0xE007C0061009700A, 0x2007E0066009100A, 0x4007F006C009200A, 0xB009400AE008C00D, 0xA009300AD008500D, 0xC009200A7008600D, 0x5009800AF008B00D, 0x1009700A3008900D, 0x0009000A0008000D, 0x7009600A9008A00D, 0x9009A00A8008D00D, 0x6009100AA008300D, 0xF009B00A2008E00D, 0xD009500A4008F00D, 0x3009900A5008800D, 0x8009D00AB008400D, 0xE009C00A1008700D, 0x2009E00A6008100D, 0x4009F00AC008200D, 0xB0064001E00AC003, 0xA0063001D00A5003, 0xC0062001700A6003, 0x50068001F00AB003, 0x10067001300A9003, 0x00060001000A0003, 0x70066001900AA003, 0x9006A001800AD003, 0x60061001A00A3003, 0xF006B001200AE003, 0xD0065001400AF003, 0x30069001500A8003, 0x8006D001B00A4003, 0xE006C001100A7003, 0x2006E001600A1003, 0x4006F001C00A2003, 0xB00F400BE002C00E, 0xA00F300BD002500E, 0xC00F200B7002600E, 0x500F800BF002B00E, 0x100F700B3002900E, 0x000F000B0002000E, 0x700F600B9002A00E, 0x900FA00B8002D00E, 0x600F100BA002300E, 0xF00FB00B2002E00E, 0xD00F500B4002F00E, 0x300F900B5002800E, 0x800FD00BB002400E, 0xE00FC00B1002700E, 0x200FE00B6002100E, 0x400FF00BC002200E, 0xB00D4005E004C00F, 0xA00D3005D004500F, 0xC00D20057004600F, 0x500D8005F004B00F, 0x100D70053004900F, 0x000D00050004000F, 0x700D60059004A00F, 0x900DA0058004D00F, 0x600D1005A004300F, 0xF00DB0052004E00F, 0xD00D50054004F00F, 0x300D90055004800F, 0x800DD005B004400F, 0xE00DC0051004700F, 0x200DE0056004100F, 0x400DF005C004200F, 0xB0034009E005C008, 0xA0033009D0055008, 0xC003200970056008, 0x50038009F005B008, 0x1003700930059008, 0x0003000900050008, 0x700360099005A008, 0x9003A0098005D008, 0x60031009A0053008, 0xF003B0092005E008, 0xD00350094005F008, 0x3003900950058008, 0x8003D009B0054008, 0xE003C00910057008, 0x2003E00960051008, 0x4003F009C0052008, 0xB008400DE00BC004, 0xA008300DD00B5004, 0xC008200D700B6004, 0x5008800DF00BB004, 0x1008700D300B9004, 0x0008000D000B0004, 0x7008600D900BA004, 0x9008A00D800BD004, 0x6008100DA00B3004, 0xF008B00D200BE004, 0xD008500D400BF004, 0x3008900D500B8004, 0x8008D00DB00B4004, 0xE008C00D100B7004, 0x2008E00D600B1004, 0x4008F00DC00B2004, 0xB00E400CE001C007, 0xA00E300CD0015007, 0xC00E200C70016007, 0x500E800CF001B007, 0x100E700C30019007, 0x000E000C00010007, 0x700E600C9001A007, 0x900EA00C8001D007, 0x600E100CA0013007, 0xF00EB00C2001E007, 0xD00E500C4001F007, 0x300E900C50018007, 0x800ED00CB0014007, 0xE00EC00C10017007, 0x200EE00C60011007, 0x400EF00CC0012007, 0xB002400EE006C001, 0xA002300ED0065001, 0xC002200E70066001, 0x5002800EF006B001, 0x1002700E30069001, 0x0002000E00060001, 0x7002600E9006A001, 0x9002A00E8006D001, 0x6002100EA0063001, 0xF002B00E2006E001, 0xD002500E4006F001, 0x3002900E50068001, 0x8002D00EB0064001, 0xE002C00E10067001, 0x2002E00E60061001, 0x4002F00EC0062001, 0xB004400FE00CC002, 0xA004300FD00C5002, 0xC004200F700C6002, 0x5004800FF00CB002, 0x1004700F300C9002, 0x0004000F000C0002, 0x7004600F900CA002, 0x9004A00F800CD002, 0x6004100FA00C3002, 0xF004B00F200CE002, 0xD004500F400CF002, 0x3004900F500C8002, 0x8004D00FB00C4002, 0xE004C00F100C7002, 0x2004E00F600C1002, 0x4004F00FC00C2002] T3 = [0x0BB004400EE00CC0, 0x0BA004300ED00C50, 0x0BC004200E700C60, 0x0B5004800EF00CB0, 0x0B1004700E300C90, 0x0B0004000E000C00, 0x0B7004600E900CA0, 0x0B9004A00E800CD0, 0x0B6004100EA00C30, 0x0BF004B00E200CE0, 0x0BD004500E400CF0, 0x0B3004900E500C80, 0x0B8004D00EB00C40, 0x0BE004C00E100C70, 0x0B2004E00E600C10, 0x0B4004F00EC00C20, 0x0AB003400DE005C0, 0x0AA003300DD00550, 0x0AC003200D700560, 0x0A5003800DF005B0, 0x0A1003700D300590, 0x0A0003000D000500, 0x0A7003600D9005A0, 0x0A9003A00D8005D0, 0x0A6003100DA00530, 0x0AF003B00D2005E0, 0x0AD003500D4005F0, 0x0A3003900D500580, 0x0A8003D00DB00540, 0x0AE003C00D100570, 0x0A2003E00D600510, 0x0A4003F00DC00520, 0x0CB0024007E006C0, 0x0CA0023007D00650, 0x0CC0022007700660, 0x0C50028007F006B0, 0x0C10027007300690, 0x0C00020007000600, 0x0C700260079006A0, 0x0C9002A0078006D0, 0x0C60021007A00630, 0x0CF002B0072006E0, 0x0CD00250074006F0, 0x0C30029007500680, 0x0C8002D007B00640, 0x0CE002C007100670, 0x0C2002E007600610, 0x0C4002F007C00620, 0x05B008400FE00BC0, 0x05A008300FD00B50, 0x05C008200F700B60, 0x055008800FF00BB0, 0x051008700F300B90, 0x050008000F000B00, 0x057008600F900BA0, 0x059008A00F800BD0, 0x056008100FA00B30, 0x05F008B00F200BE0, 0x05D008500F400BF0, 0x053008900F500B80, 0x058008D00FB00B40, 0x05E008C00F100B70, 0x052008E00F600B10, 0x054008F00FC00B20, 0x01B0074003E009C0, 0x01A0073003D00950, 0x01C0072003700960, 0x0150078003F009B0, 0x0110077003300990, 0x0100070003000900, 0x01700760039009A0, 0x019007A0038009D0, 0x0160071003A00930, 0x01F007B0032009E0, 0x01D00750034009F0, 0x0130079003500980, 0x018007D003B00940, 0x01E007C003100970, 0x012007E003600910, 0x014007F003C00920, 0x00B0004000E000C0, 0x00A0003000D00050, 0x00C0002000700060, 0x0050008000F000B0, 0x0010007000300090, 0x0000000000000000, 0x00700060009000A0, 0x009000A0008000D0, 0x0060001000A00030, 0x00F000B0002000E0, 0x00D00050004000F0, 0x0030009000500080, 0x008000D000B00040, 0x00E000C000100070, 0x002000E000600010, 0x004000F000C00020, 0x07B0064009E00AC0, 0x07A0063009D00A50, 0x07C0062009700A60, 0x0750068009F00AB0, 0x0710067009300A90, 0x0700060009000A00, 0x0770066009900AA0, 0x079006A009800AD0, 0x0760061009A00A30, 0x07F006B009200AE0, 0x07D0065009400AF0, 0x0730069009500A80, 0x078006D009B00A40, 0x07E006C009100A70, 0x072006E009600A10, 0x074006F009C00A20, 0x09B00A4008E00DC0, 0x09A00A3008D00D50, 0x09C00A2008700D60, 0x09500A8008F00DB0, 0x09100A7008300D90, 0x09000A0008000D00, 0x09700A6008900DA0, 0x09900AA008800DD0, 0x09600A1008A00D30, 0x09F00AB008200DE0, 0x09D00A5008400DF0, 0x09300A9008500D80, 0x09800AD008B00D40, 0x09E00AC008100D70, 0x09200AE008600D10, 0x09400AF008C00D20, 0x06B001400AE003C0, 0x06A001300AD00350, 0x06C001200A700360, 0x065001800AF003B0, 0x061001700A300390, 0x060001000A000300, 0x067001600A9003A0, 0x069001A00A8003D0, 0x066001100AA00330, 0x06F001B00A2003E0, 0x06D001500A4003F0, 0x063001900A500380, 0x068001D00AB00340, 0x06E001C00A100370, 0x062001E00A600310, 0x064001F00AC00320, 0x0FB00B4002E00EC0, 0x0FA00B3002D00E50, 0x0FC00B2002700E60, 0x0F500B8002F00EB0, 0x0F100B7002300E90, 0x0F000B0002000E00, 0x0F700B6002900EA0, 0x0F900BA002800ED0, 0x0F600B1002A00E30, 0x0FF00BB002200EE0, 0x0FD00B5002400EF0, 0x0F300B9002500E80, 0x0F800BD002B00E40, 0x0FE00BC002100E70, 0x0F200BE002600E10, 0x0F400BF002C00E20, 0x0DB0054004E00FC0, 0x0DA0053004D00F50, 0x0DC0052004700F60, 0x0D50058004F00FB0, 0x0D10057004300F90, 0x0D00050004000F00, 0x0D70056004900FA0, 0x0D9005A004800FD0, 0x0D60051004A00F30, 0x0DF005B004200FE0, 0x0DD0055004400FF0, 0x0D30059004500F80, 0x0D8005D004B00F40, 0x0DE005C004100F70, 0x0D2005E004600F10, 0x0D4005F004C00F20, 0x03B0094005E008C0, 0x03A0093005D00850, 0x03C0092005700860, 0x0350098005F008B0, 0x0310097005300890, 0x0300090005000800, 0x03700960059008A0, 0x039009A0058008D0, 0x0360091005A00830, 0x03F009B0052008E0, 0x03D00950054008F0, 0x0330099005500880, 0x038009D005B00840, 0x03E009C005100870, 0x032009E005600810, 0x034009F005C00820, 0x08B00D400BE004C0, 0x08A00D300BD00450, 0x08C00D200B700460, 0x08500D800BF004B0, 0x08100D700B300490, 0x08000D000B000400, 0x08700D600B9004A0, 0x08900DA00B8004D0, 0x08600D100BA00430, 0x08F00DB00B2004E0, 0x08D00D500B4004F0, 0x08300D900B500480, 0x08800DD00BB00440, 0x08E00DC00B100470, 0x08200DE00B600410, 0x08400DF00BC00420, 0x0EB00C4001E007C0, 0x0EA00C3001D00750, 0x0EC00C2001700760, 0x0E500C8001F007B0, 0x0E100C7001300790, 0x0E000C0001000700, 0x0E700C60019007A0, 0x0E900CA0018007D0, 0x0E600C1001A00730, 0x0EF00CB0012007E0, 0x0ED00C50014007F0, 0x0E300C9001500780, 0x0E800CD001B00740, 0x0EE00CC001100770, 0x0E200CE001600710, 0x0E400CF001C00720, 0x02B00E4006E001C0, 0x02A00E3006D00150, 0x02C00E2006700160, 0x02500E8006F001B0, 0x02100E7006300190, 0x02000E0006000100, 0x02700E60069001A0, 0x02900EA0068001D0, 0x02600E1006A00130, 0x02F00EB0062001E0, 0x02D00E50064001F0, 0x02300E9006500180, 0x02800ED006B00140, 0x02E00EC006100170, 0x02200EE006600110, 0x02400EF006C00120, 0x04B00F400CE002C0, 0x04A00F300CD00250, 0x04C00F200C700260, 0x04500F800CF002B0, 0x04100F700C300290, 0x04000F000C000200, 0x04700F600C9002A0, 0x04900FA00C8002D0, 0x04600F100CA00230, 0x04F00FB00C2002E0, 0x04D00F500C4002F0, 0x04300F900C500280, 0x04800FD00CB00240, 0x04E00FC00C100270, 0x04200FE00C600210, 0x04400FF00CC00220] T4 = [0x880011009900BB00, 0x860014009200BA00, 0x840019009D00BC00, 0x830012009100B500, 0x8E0015009B00B100, 0x800010009000B000, 0x8C0018009400B700, 0x87001B009C00B900, 0x82001D009F00B600, 0x850016009300BF00, 0x8A001C009600BD00, 0x81001F009E00B300, 0x89001E009700B800, 0x8B0013009800BE00, 0x8F001A009500B200, 0x8D0017009A00B400, 0x680041002900AB00, 0x660044002200AA00, 0x640049002D00AC00, 0x630042002100A500, 0x6E0045002B00A100, 0x600040002000A000, 0x6C0048002400A700, 0x67004B002C00A900, 0x62004D002F00A600, 0x650046002300AF00, 0x6A004C002600AD00, 0x61004F002E00A300, 0x69004E002700A800, 0x6B0043002800AE00, 0x6F004A002500A200, 0x6D0047002A00A400, 0x48009100D900CB00, 0x46009400D200CA00, 0x44009900DD00CC00, 0x43009200D100C500, 0x4E009500DB00C100, 0x40009000D000C000, 0x4C009800D400C700, 0x47009B00DC00C900, 0x42009D00DF00C600, 0x45009600D300CF00, 0x4A009C00D600CD00, 0x41009F00DE00C300, 0x49009E00D700C800, 0x4B009300D800CE00, 0x4F009A00D500C200, 0x4D009700DA00C400, 0x3800210019005B00, 0x3600240012005A00, 0x340029001D005C00, 0x3300220011005500, 0x3E0025001B005100, 0x3000200010005000, 0x3C00280014005700, 0x37002B001C005900, 0x32002D001F005600, 0x3500260013005F00, 0x3A002C0016005D00, 0x31002F001E005300, 0x39002E0017005800, 0x3B00230018005E00, 0x3F002A0015005200, 0x3D0027001A005400, 0xE8005100B9001B00, 0xE6005400B2001A00, 0xE4005900BD001C00, 0xE3005200B1001500, 0xEE005500BB001100, 0xE0005000B0001000, 0xEC005800B4001700, 0xE7005B00BC001900, 0xE2005D00BF001600, 0xE5005600B3001F00, 0xEA005C00B6001D00, 0xE1005F00BE001300, 0xE9005E00B7001800, 0xEB005300B8001E00, 0xEF005A00B5001200, 0xED005700BA001400, 0x0800010009000B00, 0x0600040002000A00, 0x040009000D000C00, 0x0300020001000500, 0x0E0005000B000100, 0x0000000000000000, 0x0C00080004000700, 0x07000B000C000900, 0x02000D000F000600, 0x0500060003000F00, 0x0A000C0006000D00, 0x01000F000E000300, 0x09000E0007000800, 0x0B00030008000E00, 0x0F000A0005000200, 0x0D0007000A000400, 0xC800810049007B00, 0xC600840042007A00, 0xC40089004D007C00, 0xC300820041007500, 0xCE0085004B007100, 0xC000800040007000, 0xCC00880044007700, 0xC7008B004C007900, 0xC2008D004F007600, 0xC500860043007F00, 0xCA008C0046007D00, 0xC1008F004E007300, 0xC9008E0047007800, 0xCB00830048007E00, 0xCF008A0045007200, 0xCD0087004A007400, 0x7800B100C9009B00, 0x7600B400C2009A00, 0x7400B900CD009C00, 0x7300B200C1009500, 0x7E00B500CB009100, 0x7000B000C0009000, 0x7C00B800C4009700, 0x7700BB00CC009900, 0x7200BD00CF009600, 0x7500B600C3009F00, 0x7A00BC00C6009D00, 0x7100BF00CE009300, 0x7900BE00C7009800, 0x7B00B300C8009E00, 0x7F00BA00C5009200, 0x7D00B700CA009400, 0x2800D100F9006B00, 0x2600D400F2006A00, 0x2400D900FD006C00, 0x2300D200F1006500, 0x2E00D500FB006100, 0x2000D000F0006000, 0x2C00D800F4006700, 0x2700DB00FC006900, 0x2200DD00FF006600, 0x2500D600F3006F00, 0x2A00DC00F6006D00, 0x2100DF00FE006300, 0x2900DE00F7006800, 0x2B00D300F8006E00, 0x2F00DA00F5006200, 0x2D00D700FA006400, 0x580061003900FB00, 0x560064003200FA00, 0x540069003D00FC00, 0x530062003100F500, 0x5E0065003B00F100, 0x500060003000F000, 0x5C0068003400F700, 0x57006B003C00F900, 0x52006D003F00F600, 0x550066003300FF00, 0x5A006C003600FD00, 0x51006F003E00F300, 0x59006E003700F800, 0x5B0063003800FE00, 0x5F006A003500F200, 0x5D0067003A00F400, 0xA800C1006900DB00, 0xA600C4006200DA00, 0xA400C9006D00DC00, 0xA300C2006100D500, 0xAE00C5006B00D100, 0xA000C0006000D000, 0xAC00C8006400D700, 0xA700CB006C00D900, 0xA200CD006F00D600, 0xA500C6006300DF00, 0xAA00CC006600DD00, 0xA100CF006E00D300, 0xA900CE006700D800, 0xAB00C3006800DE00, 0xAF00CA006500D200, 0xAD00C7006A00D400, 0x1800F100E9003B00, 0x1600F400E2003A00, 0x1400F900ED003C00, 0x1300F200E1003500, 0x1E00F500EB003100, 0x1000F000E0003000, 0x1C00F800E4003700, 0x1700FB00EC003900, 0x1200FD00EF003600, 0x1500F600E3003F00, 0x1A00FC00E6003D00, 0x1100FF00EE003300, 0x1900FE00E7003800, 0x1B00F300E8003E00, 0x1F00FA00E5003200, 0x1D00F700EA003400, 0x9800E10079008B00, 0x9600E40072008A00, 0x9400E9007D008C00, 0x9300E20071008500, 0x9E00E5007B008100, 0x9000E00070008000, 0x9C00E80074008700, 0x9700EB007C008900, 0x9200ED007F008600, 0x9500E60073008F00, 0x9A00EC0076008D00, 0x9100EF007E008300, 0x9900EE0077008800, 0x9B00E30078008E00, 0x9F00EA0075008200, 0x9D00E7007A008400, 0xB80031008900EB00, 0xB60034008200EA00, 0xB40039008D00EC00, 0xB30032008100E500, 0xBE0035008B00E100, 0xB00030008000E000, 0xBC0038008400E700, 0xB7003B008C00E900, 0xB2003D008F00E600, 0xB50036008300EF00, 0xBA003C008600ED00, 0xB1003F008E00E300, 0xB9003E008700E800, 0xBB0033008800EE00, 0xBF003A008500E200, 0xBD0037008A00E400, 0xF800A10059002B00, 0xF600A40052002A00, 0xF400A9005D002C00, 0xF300A20051002500, 0xFE00A5005B002100, 0xF000A00050002000, 0xFC00A80054002700, 0xF700AB005C002900, 0xF200AD005F002600, 0xF500A60053002F00, 0xFA00AC0056002D00, 0xF100AF005E002300, 0xF900AE0057002800, 0xFB00A30058002E00, 0xFF00AA0055002200, 0xFD00A7005A002400, 0xD8007100A9004B00, 0xD6007400A2004A00, 0xD4007900AD004C00, 0xD3007200A1004500, 0xDE007500AB004100, 0xD0007000A0004000, 0xDC007800A4004700, 0xD7007B00AC004900, 0xD2007D00AF004600, 0xD5007600A3004F00, 0xDA007C00A6004D00, 0xD1007F00AE004300, 0xD9007E00A7004800, 0xDB007300A8004E00, 0xDF007A00A5004200, 0xDD007700AA004400] T5 = [0x00880011009900BB, 0x00860014009200BA, 0x00840019009D00BC, 0x00830012009100B5, 0x008E0015009B00B1, 0x00800010009000B0, 0x008C0018009400B7, 0x0087001B009C00B9, 0x0082001D009F00B6, 0x00850016009300BF, 0x008A001C009600BD, 0x0081001F009E00B3, 0x0089001E009700B8, 0x008B0013009800BE, 0x008F001A009500B2, 0x008D0017009A00B4, 0x00680041002900AB, 0x00660044002200AA, 0x00640049002D00AC, 0x00630042002100A5, 0x006E0045002B00A1, 0x00600040002000A0, 0x006C0048002400A7, 0x0067004B002C00A9, 0x0062004D002F00A6, 0x00650046002300AF, 0x006A004C002600AD, 0x0061004F002E00A3, 0x0069004E002700A8, 0x006B0043002800AE, 0x006F004A002500A2, 0x006D0047002A00A4, 0x0048009100D900CB, 0x0046009400D200CA, 0x0044009900DD00CC, 0x0043009200D100C5, 0x004E009500DB00C1, 0x0040009000D000C0, 0x004C009800D400C7, 0x0047009B00DC00C9, 0x0042009D00DF00C6, 0x0045009600D300CF, 0x004A009C00D600CD, 0x0041009F00DE00C3, 0x0049009E00D700C8, 0x004B009300D800CE, 0x004F009A00D500C2, 0x004D009700DA00C4, 0x003800210019005B, 0x003600240012005A, 0x00340029001D005C, 0x0033002200110055, 0x003E0025001B0051, 0x0030002000100050, 0x003C002800140057, 0x0037002B001C0059, 0x0032002D001F0056, 0x003500260013005F, 0x003A002C0016005D, 0x0031002F001E0053, 0x0039002E00170058, 0x003B00230018005E, 0x003F002A00150052, 0x003D0027001A0054, 0x00E8005100B9001B, 0x00E6005400B2001A, 0x00E4005900BD001C, 0x00E3005200B10015, 0x00EE005500BB0011, 0x00E0005000B00010, 0x00EC005800B40017, 0x00E7005B00BC0019, 0x00E2005D00BF0016, 0x00E5005600B3001F, 0x00EA005C00B6001D, 0x00E1005F00BE0013, 0x00E9005E00B70018, 0x00EB005300B8001E, 0x00EF005A00B50012, 0x00ED005700BA0014, 0x000800010009000B, 0x000600040002000A, 0x00040009000D000C, 0x0003000200010005, 0x000E0005000B0001, 0x0000000000000000, 0x000C000800040007, 0x0007000B000C0009, 0x0002000D000F0006, 0x000500060003000F, 0x000A000C0006000D, 0x0001000F000E0003, 0x0009000E00070008, 0x000B00030008000E, 0x000F000A00050002, 0x000D0007000A0004, 0x00C800810049007B, 0x00C600840042007A, 0x00C40089004D007C, 0x00C3008200410075, 0x00CE0085004B0071, 0x00C0008000400070, 0x00CC008800440077, 0x00C7008B004C0079, 0x00C2008D004F0076, 0x00C500860043007F, 0x00CA008C0046007D, 0x00C1008F004E0073, 0x00C9008E00470078, 0x00CB00830048007E, 0x00CF008A00450072, 0x00CD0087004A0074, 0x007800B100C9009B, 0x007600B400C2009A, 0x007400B900CD009C, 0x007300B200C10095, 0x007E00B500CB0091, 0x007000B000C00090, 0x007C00B800C40097, 0x007700BB00CC0099, 0x007200BD00CF0096, 0x007500B600C3009F, 0x007A00BC00C6009D, 0x007100BF00CE0093, 0x007900BE00C70098, 0x007B00B300C8009E, 0x007F00BA00C50092, 0x007D00B700CA0094, 0x002800D100F9006B, 0x002600D400F2006A, 0x002400D900FD006C, 0x002300D200F10065, 0x002E00D500FB0061, 0x002000D000F00060, 0x002C00D800F40067, 0x002700DB00FC0069, 0x002200DD00FF0066, 0x002500D600F3006F, 0x002A00DC00F6006D, 0x002100DF00FE0063, 0x002900DE00F70068, 0x002B00D300F8006E, 0x002F00DA00F50062, 0x002D00D700FA0064, 0x00580061003900FB, 0x00560064003200FA, 0x00540069003D00FC, 0x00530062003100F5, 0x005E0065003B00F1, 0x00500060003000F0, 0x005C0068003400F7, 0x0057006B003C00F9, 0x0052006D003F00F6, 0x00550066003300FF, 0x005A006C003600FD, 0x0051006F003E00F3, 0x0059006E003700F8, 0x005B0063003800FE, 0x005F006A003500F2, 0x005D0067003A00F4, 0x00A800C1006900DB, 0x00A600C4006200DA, 0x00A400C9006D00DC, 0x00A300C2006100D5, 0x00AE00C5006B00D1, 0x00A000C0006000D0, 0x00AC00C8006400D7, 0x00A700CB006C00D9, 0x00A200CD006F00D6, 0x00A500C6006300DF, 0x00AA00CC006600DD, 0x00A100CF006E00D3, 0x00A900CE006700D8, 0x00AB00C3006800DE, 0x00AF00CA006500D2, 0x00AD00C7006A00D4, 0x001800F100E9003B, 0x001600F400E2003A, 0x001400F900ED003C, 0x001300F200E10035, 0x001E00F500EB0031, 0x001000F000E00030, 0x001C00F800E40037, 0x001700FB00EC0039, 0x001200FD00EF0036, 0x001500F600E3003F, 0x001A00FC00E6003D, 0x001100FF00EE0033, 0x001900FE00E70038, 0x001B00F300E8003E, 0x001F00FA00E50032, 0x001D00F700EA0034, 0x009800E10079008B, 0x009600E40072008A, 0x009400E9007D008C, 0x009300E200710085, 0x009E00E5007B0081, 0x009000E000700080, 0x009C00E800740087, 0x009700EB007C0089, 0x009200ED007F0086, 0x009500E60073008F, 0x009A00EC0076008D, 0x009100EF007E0083, 0x009900EE00770088, 0x009B00E30078008E, 0x009F00EA00750082, 0x009D00E7007A0084, 0x00B80031008900EB, 0x00B60034008200EA, 0x00B40039008D00EC, 0x00B30032008100E5, 0x00BE0035008B00E1, 0x00B00030008000E0, 0x00BC0038008400E7, 0x00B7003B008C00E9, 0x00B2003D008F00E6, 0x00B50036008300EF, 0x00BA003C008600ED, 0x00B1003F008E00E3, 0x00B9003E008700E8, 0x00BB0033008800EE, 0x00BF003A008500E2, 0x00BD0037008A00E4, 0x00F800A10059002B, 0x00F600A40052002A, 0x00F400A9005D002C, 0x00F300A200510025, 0x00FE00A5005B0021, 0x00F000A000500020, 0x00FC00A800540027, 0x00F700AB005C0029, 0x00F200AD005F0026, 0x00F500A60053002F, 0x00FA00AC0056002D, 0x00F100AF005E0023, 0x00F900AE00570028, 0x00FB00A30058002E, 0x00FF00AA00550022, 0x00FD00A7005A0024, 0x00D8007100A9004B, 0x00D6007400A2004A, 0x00D4007900AD004C, 0x00D3007200A10045, 0x00DE007500AB0041, 0x00D0007000A00040, 0x00DC007800A40047, 0x00D7007B00AC0049, 0x00D2007D00AF0046, 0x00D5007600A3004F, 0x00DA007C00A6004D, 0x00D1007F00AE0043, 0x00D9007E00A70048, 0x00DB007300A8004E, 0x00DF007A00A50042, 0x00DD007700AA0044] T6 = [0x0DD006600EE00BB0, 0x0D1006B00ED00BA0, 0x0DF006300E700BC0, 0x0D9006C00EF00B50, 0x0DC006D00E300B10, 0x0D0006000E000B00, 0x0D2006500E900B70, 0x0D6006F00E800B90, 0x0DE006800EA00B60, 0x0D8006700E200BF0, 0x0D3006E00E400BD0, 0x0D7006400E500B30, 0x0DA006200EB00B80, 0x0D4006A00E100BE0, 0x0DB006900E600B20, 0x0D5006100EC00B40, 0x01D00B600DE00AB0, 0x01100BB00DD00AA0, 0x01F00B300D700AC0, 0x01900BC00DF00A50, 0x01C00BD00D300A10, 0x01000B000D000A00, 0x01200B500D900A70, 0x01600BF00D800A90, 0x01E00B800DA00A60, 0x01800B700D200AF0, 0x01300BE00D400AD0, 0x01700B400D500A30, 0x01A00B200DB00A80, 0x01400BA00D100AE0, 0x01B00B900D600A20, 0x01500B100DC00A40, 0x0FD0036007E00CB0, 0x0F1003B007D00CA0, 0x0FF0033007700CC0, 0x0F9003C007F00C50, 0x0FC003D007300C10, 0x0F00030007000C00, 0x0F20035007900C70, 0x0F6003F007800C90, 0x0FE0038007A00C60, 0x0F80037007200CF0, 0x0F3003E007400CD0, 0x0F70034007500C30, 0x0FA0032007B00C80, 0x0F4003A007100CE0, 0x0FB0039007600C20, 0x0F50031007C00C40, 0x09D00C600FE005B0, 0x09100CB00FD005A0, 0x09F00C300F7005C0, 0x09900CC00FF00550, 0x09C00CD00F300510, 0x09000C000F000500, 0x09200C500F900570, 0x09600CF00F800590, 0x09E00C800FA00560, 0x09800C700F2005F0, 0x09300CE00F4005D0, 0x09700C400F500530, 0x09A00C200FB00580, 0x09400CA00F1005E0, 0x09B00C900F600520, 0x09500C100FC00540, 0x0CD00D6003E001B0, 0x0C100DB003D001A0, 0x0CF00D30037001C0, 0x0C900DC003F00150, 0x0CC00DD003300110, 0x0C000D0003000100, 0x0C200D5003900170, 0x0C600DF003800190, 0x0CE00D8003A00160, 0x0C800D70032001F0, 0x0C300DE0034001D0, 0x0C700D4003500130, 0x0CA00D2003B00180, 0x0C400DA0031001E0, 0x0CB00D9003600120, 0x0C500D1003C00140, 0x00D0006000E000B0, 0x001000B000D000A0, 0x00F00030007000C0, 0x009000C000F00050, 0x00C000D000300010, 0x0000000000000000, 0x0020005000900070, 0x006000F000800090, 0x00E0008000A00060, 0x00800070002000F0, 0x003000E0004000D0, 0x0070004000500030, 0x00A0002000B00080, 0x004000A0001000E0, 0x00B0009000600020, 0x0050001000C00040, 0x02D0056009E007B0, 0x021005B009D007A0, 0x02F00530097007C0, 0x029005C009F00750, 0x02C005D009300710, 0x0200050009000700, 0x0220055009900770, 0x026005F009800790, 0x02E0058009A00760, 0x02800570092007F0, 0x023005E0094007D0, 0x0270054009500730, 0x02A0052009B00780, 0x024005A0091007E0, 0x02B0059009600720, 0x0250051009C00740, 0x06D00F6008E009B0, 0x06100FB008D009A0, 0x06F00F30087009C0, 0x06900FC008F00950, 0x06C00FD008300910, 0x06000F0008000900, 0x06200F5008900970, 0x06600FF008800990, 0x06E00F8008A00960, 0x06800F70082009F0, 0x06300FE0084009D0, 0x06700F4008500930, 0x06A00F2008B00980, 0x06400FA0081009E0, 0x06B00F9008600920, 0x06500F1008C00940, 0x0ED008600AE006B0, 0x0E1008B00AD006A0, 0x0EF008300A7006C0, 0x0E9008C00AF00650, 0x0EC008D00A300610, 0x0E0008000A000600, 0x0E2008500A900670, 0x0E6008F00A800690, 0x0EE008800AA00660, 0x0E8008700A2006F0, 0x0E3008E00A4006D0, 0x0E7008400A500630, 0x0EA008200AB00680, 0x0E4008A00A1006E0, 0x0EB008900A600620, 0x0E5008100AC00640, 0x08D0076002E00FB0, 0x081007B002D00FA0, 0x08F0073002700FC0, 0x089007C002F00F50, 0x08C007D002300F10, 0x0800070002000F00, 0x0820075002900F70, 0x086007F002800F90, 0x08E0078002A00F60, 0x0880077002200FF0, 0x083007E002400FD0, 0x0870074002500F30, 0x08A0072002B00F80, 0x084007A002100FE0, 0x08B0079002600F20, 0x0850071002C00F40, 0x03D00E6004E00DB0, 0x03100EB004D00DA0, 0x03F00E3004700DC0, 0x03900EC004F00D50, 0x03C00ED004300D10, 0x03000E0004000D00, 0x03200E5004900D70, 0x03600EF004800D90, 0x03E00E8004A00D60, 0x03800E7004200DF0, 0x03300EE004400DD0, 0x03700E4004500D30, 0x03A00E2004B00D80, 0x03400EA004100DE0, 0x03B00E9004600D20, 0x03500E1004C00D40, 0x07D0046005E003B0, 0x071004B005D003A0, 0x07F00430057003C0, 0x079004C005F00350, 0x07C004D005300310, 0x0700040005000300, 0x0720045005900370, 0x076004F005800390, 0x07E0048005A00360, 0x07800470052003F0, 0x073004E0054003D0, 0x0770044005500330, 0x07A0042005B00380, 0x074004A0051003E0, 0x07B0049005600320, 0x0750041005C00340, 0x0AD002600BE008B0, 0x0A1002B00BD008A0, 0x0AF002300B7008C0, 0x0A9002C00BF00850, 0x0AC002D00B300810, 0x0A0002000B000800, 0x0A2002500B900870, 0x0A6002F00B800890, 0x0AE002800BA00860, 0x0A8002700B2008F0, 0x0A3002E00B4008D0, 0x0A7002400B500830, 0x0AA002200BB00880, 0x0A4002A00B1008E0, 0x0AB002900B600820, 0x0A5002100BC00840, 0x04D00A6001E00EB0, 0x04100AB001D00EA0, 0x04F00A3001700EC0, 0x04900AC001F00E50, 0x04C00AD001300E10, 0x04000A0001000E00, 0x04200A5001900E70, 0x04600AF001800E90, 0x04E00A8001A00E60, 0x04800A7001200EF0, 0x04300AE001400ED0, 0x04700A4001500E30, 0x04A00A2001B00E80, 0x04400AA001100EE0, 0x04B00A9001600E20, 0x04500A1001C00E40, 0x0BD0096006E002B0, 0x0B1009B006D002A0, 0x0BF00930067002C0, 0x0B9009C006F00250, 0x0BC009D006300210, 0x0B00090006000200, 0x0B20095006900270, 0x0B6009F006800290, 0x0BE0098006A00260, 0x0B800970062002F0, 0x0B3009E0064002D0, 0x0B70094006500230, 0x0BA0092006B00280, 0x0B4009A0061002E0, 0x0BB0099006600220, 0x0B50091006C00240, 0x05D001600CE004B0, 0x051001B00CD004A0, 0x05F001300C7004C0, 0x059001C00CF00450, 0x05C001D00C300410, 0x050001000C000400, 0x052001500C900470, 0x056001F00C800490, 0x05E001800CA00460, 0x058001700C2004F0, 0x053001E00C4004D0, 0x057001400C500430, 0x05A001200CB00480, 0x054001A00C1004E0, 0x05B001900C600420, 0x055001100CC00440] T7 = [0xD00D6006E00EB00B, 0x100DB006D00EA00B, 0xF00D3006700EC00B, 0x900DC006F00E500B, 0xC00DD006300E100B, 0x000D0006000E000B, 0x200D5006900E700B, 0x600DF006800E900B, 0xE00D8006A00E600B, 0x800D7006200EF00B, 0x300DE006400ED00B, 0x700D4006500E300B, 0xA00D2006B00E800B, 0x400DA006100EE00B, 0xB00D9006600E200B, 0x500D1006C00E400B, 0xD001600BE00DB00A, 0x1001B00BD00DA00A, 0xF001300B700DC00A, 0x9001C00BF00D500A, 0xC001D00B300D100A, 0x0001000B000D000A, 0x2001500B900D700A, 0x6001F00B800D900A, 0xE001800BA00D600A, 0x8001700B200DF00A, 0x3001E00B400DD00A, 0x7001400B500D300A, 0xA001200BB00D800A, 0x4001A00B100DE00A, 0xB001900B600D200A, 0x5001100BC00D400A, 0xD00F6003E007B00C, 0x100FB003D007A00C, 0xF00F30037007C00C, 0x900FC003F007500C, 0xC00FD0033007100C, 0x000F00030007000C, 0x200F50039007700C, 0x600FF0038007900C, 0xE00F8003A007600C, 0x800F70032007F00C, 0x300FE0034007D00C, 0x700F40035007300C, 0xA00F2003B007800C, 0x400FA0031007E00C, 0xB00F90036007200C, 0x500F1003C007400C, 0xD009600CE00FB005, 0x1009B00CD00FA005, 0xF009300C700FC005, 0x9009C00CF00F5005, 0xC009D00C300F1005, 0x0009000C000F0005, 0x2009500C900F7005, 0x6009F00C800F9005, 0xE009800CA00F6005, 0x8009700C200FF005, 0x3009E00C400FD005, 0x7009400C500F3005, 0xA009200CB00F8005, 0x4009A00C100FE005, 0xB009900C600F2005, 0x5009100CC00F4005, 0xD00C600DE003B001, 0x100CB00DD003A001, 0xF00C300D7003C001, 0x900CC00DF0035001, 0xC00CD00D30031001, 0x000C000D00030001, 0x200C500D90037001, 0x600CF00D80039001, 0xE00C800DA0036001, 0x800C700D2003F001, 0x300CE00D4003D001, 0x700C400D50033001, 0xA00C200DB0038001, 0x400CA00D1003E001, 0xB00C900D60032001, 0x500C100DC0034001, 0xD0006000E000B000, 0x1000B000D000A000, 0xF00030007000C000, 0x9000C000F0005000, 0xC000D00030001000, 0x0000000000000000, 0x2000500090007000, 0x6000F00080009000, 0xE0008000A0006000, 0x800070002000F000, 0x3000E0004000D000, 0x7000400050003000, 0xA0002000B0008000, 0x4000A0001000E000, 0xB000900060002000, 0x50001000C0004000, 0xD0026005E009B007, 0x1002B005D009A007, 0xF00230057009C007, 0x9002C005F0095007, 0xC002D00530091007, 0x0002000500090007, 0x2002500590097007, 0x6002F00580099007, 0xE0028005A0096007, 0x800270052009F007, 0x3002E0054009D007, 0x7002400550093007, 0xA0022005B0098007, 0x4002A0051009E007, 0xB002900560092007, 0x50021005C0094007, 0xD006600FE008B009, 0x1006B00FD008A009, 0xF006300F7008C009, 0x9006C00FF0085009, 0xC006D00F30081009, 0x0006000F00080009, 0x2006500F90087009, 0x6006F00F80089009, 0xE006800FA0086009, 0x8006700F2008F009, 0x3006E00F4008D009, 0x7006400F50083009, 0xA006200FB0088009, 0x4006A00F1008E009, 0xB006900F60082009, 0x5006100FC0084009, 0xD00E6008E00AB006, 0x100EB008D00AA006, 0xF00E3008700AC006, 0x900EC008F00A5006, 0xC00ED008300A1006, 0x000E0008000A0006, 0x200E5008900A7006, 0x600EF008800A9006, 0xE00E8008A00A6006, 0x800E7008200AF006, 0x300EE008400AD006, 0x700E4008500A3006, 0xA00E2008B00A8006, 0x400EA008100AE006, 0xB00E9008600A2006, 0x500E1008C00A4006, 0xD0086007E002B00F, 0x1008B007D002A00F, 0xF00830077002C00F, 0x9008C007F002500F, 0xC008D0073002100F, 0x000800070002000F, 0x200850079002700F, 0x6008F0078002900F, 0xE0088007A002600F, 0x800870072002F00F, 0x3008E0074002D00F, 0x700840075002300F, 0xA0082007B002800F, 0x4008A0071002E00F, 0xB00890076002200F, 0x50081007C002400F, 0xD003600EE004B00D, 0x1003B00ED004A00D, 0xF003300E7004C00D, 0x9003C00EF004500D, 0xC003D00E3004100D, 0x0003000E0004000D, 0x2003500E9004700D, 0x6003F00E8004900D, 0xE003800EA004600D, 0x8003700E2004F00D, 0x3003E00E4004D00D, 0x7003400E5004300D, 0xA003200EB004800D, 0x4003A00E1004E00D, 0xB003900E6004200D, 0x5003100EC004400D, 0xD0076004E005B003, 0x1007B004D005A003, 0xF00730047005C003, 0x9007C004F0055003, 0xC007D00430051003, 0x0007000400050003, 0x2007500490057003, 0x6007F00480059003, 0xE0078004A0056003, 0x800770042005F003, 0x3007E0044005D003, 0x7007400450053003, 0xA0072004B0058003, 0x4007A0041005E003, 0xB007900460052003, 0x50071004C0054003, 0xD00A6002E00BB008, 0x100AB002D00BA008, 0xF00A3002700BC008, 0x900AC002F00B5008, 0xC00AD002300B1008, 0x000A0002000B0008, 0x200A5002900B7008, 0x600AF002800B9008, 0xE00A8002A00B6008, 0x800A7002200BF008, 0x300AE002400BD008, 0x700A4002500B3008, 0xA00A2002B00B8008, 0x400AA002100BE008, 0xB00A9002600B2008, 0x500A1002C00B4008, 0xD004600AE001B00E, 0x1004B00AD001A00E, 0xF004300A7001C00E, 0x9004C00AF001500E, 0xC004D00A3001100E, 0x0004000A0001000E, 0x2004500A9001700E, 0x6004F00A8001900E, 0xE004800AA001600E, 0x8004700A2001F00E, 0x3004E00A4001D00E, 0x7004400A5001300E, 0xA004200AB001800E, 0x4004A00A1001E00E, 0xB004900A6001200E, 0x5004100AC001400E, 0xD00B6009E006B002, 0x100BB009D006A002, 0xF00B30097006C002, 0x900BC009F0065002, 0xC00BD00930061002, 0x000B000900060002, 0x200B500990067002, 0x600BF00980069002, 0xE00B8009A0066002, 0x800B70092006F002, 0x300BE0094006D002, 0x700B400950063002, 0xA00B2009B0068002, 0x400BA0091006E002, 0xB00B900960062002, 0x500B1009C0064002, 0xD0056001E00CB004, 0x1005B001D00CA004, 0xF0053001700CC004, 0x9005C001F00C5004, 0xC005D001300C1004, 0x00050001000C0004, 0x20055001900C7004, 0x6005F001800C9004, 0xE0058001A00C6004, 0x80057001200CF004, 0x3005E001400CD004, 0x70054001500C3004, 0xA0052001B00C8004, 0x4005A001100CE004, 0xB0059001600C2004, 0x50051001C00C4004] RCandKeySizeConstLong = [0x0013000200140005, 0x0033000200340005, 0x0073000200740005, 0x0073001200740015, 0x0073003200740035, 0x0063007200640075, 0x0053007200540075, 0x0033007200340075, 0x0073006200740065, 0x0073005200740055, 0x0063003200640035, 0x0043007200440075, 0x0013007200140075, 0x0033006200340065, 0x0073004200740045, 0x0063001200640015, 0x0053003200540035, 0x0023007200240075, 0x0053006200540065, 0x0033005200340055, 0x0063002200640025, 0x0043005200440055, 0x0003003200040035, 0x0003006200040065, 0x0013004200140045, 0x0023000200240005, 0x0053000200540005, 0x0033001200340015, 0x0073002200740025, 0x0063005200640055, 0x0043003200440035, 0x0003007200040075, 0x0013006200140065, 0x0033004200340045, 0x0063000200640005, 0x0053001200540015, 0x0033003200340035, 0x0063006200640065, 0x0053005200540055, 0x0023003200240035, 0x0043006200440065, 0x0013005200140055, 0x0023002200240025, 0x0043004200440045, 0x0003001200040015, 0x0013002200140025, 0x0023004200240045, 0x0043000200440005] @classmethod def byte2ulong(cls, b, offSet): x = 0 for i in range(7, -1, -1): x = (x << 8) ^ b[i + offSet] return x @classmethod def ulong2byte(cls, x): b = [None] * 8 for i in range(0, 8, 1): b[i] = ((x >> i * 8) & 0xFF) return b @classmethod def ulong2byteCopy(cls, x, b, offSet): for i in range(0, 8, 1): b[offSet + i] = ((x >> i * 8) & 0xFF) return @classmethod def AddKey(cls, state, roundKey): return state ^ roundKey @classmethod def AddConstants(cls, state, round): return state ^ cls.RCandKeySizeConstLong[round] @classmethod def SubCellShiftRowAndMixColumns(cls, state): temp = cls.T0[state >> 0 & 0xFF] temp ^= cls.T1[state >> 8 & 0xFF] temp ^= cls.T2[state >> 16 & 0xFF] temp ^= cls.T3[state >> 24 & 0xFF] temp ^= cls.T4[state >> 32 & 0xFF] temp ^= cls.T5[state >> 40 & 0xFF] temp ^= cls.T6[state >> 48 & 0xFF] temp ^= cls.T7[state >> 56 & 0xFF] return temp @classmethod def Step(cls, state, step): for i in range(0, 4, 1): state = cls.AddConstants(state, (step * 4 + i)) state = cls.SubCellShiftRowAndMixColumns(state) return state @classmethod def EncryptOneBlock(cls, state, sk0, sk1): for i in range(0, 12, 2): state = cls.AddKey(state, sk0) state = cls.Step(state, i) state = cls.AddKey(state, sk1) state = cls.Step(state, i+1) state = cls.AddKey(state, sk0) return state @classmethod def Encrypt(cls, plainText, key): cipherText = [None] * len(plainText) sk0 = cls.byte2ulong(key, 0) sk2 = [None] * 8 for i in range(0, 8, 1): sk2[i] = key[(8 + i) % 10] sk1 = cls.byte2ulong(sk2, 0) for i in range(0, len(plainText), 8): state = cls.byte2ulong(plainText, i) state = cls.EncryptOneBlock(state, sk0, sk1) cls.ulong2byteCopy(state, cipherText, i) return cipherText
"""Package metadata""" TITLE = "aiosfstream" DESCRIPTION = "Salesforce Streaming API client for asyncio" KEYWORDS = "salesforce asyncio aiohttp comet cometd bayeux push streaming" URL = "https://github.com/robertmrk/aiosfstream" PROJECT_URLS = { "CI": "https://travis-ci.org/robertmrk/aiosfstream", "Coverage": "https://coveralls.io/github/robertmrk/aiosfstream", "Docs": "http://aiosfstream.readthedocs.io/" } VERSION = "0.5.0" AUTHOR = "Róbert Márki" AUTHOR_EMAIL = "[email protected]"
#!python class BinaryMinHeap(object): """BinaryMinHeap: a partially ordered collection with efficient methods to insert new items in partial order and to access and remove its minimum item. Items are stored in a dynamic array that implicitly represents a complete binary tree with root node at index 0 and last leaf node at index n-1.""" def __init__(self, items=None): """Initialize this heap and insert the given items, if any.""" # Initialize an empty list to store the items self.items = [] if items: for item in items: self.insert(item) def __repr__(self): """Return a string representation of this heap.""" return 'BinaryMinHeap({})'.format(self.items) def is_empty(self): """Return True if this heap is empty, or False otherwise.""" # TODO: Check if empty based on how many items are in the list # ... def size(self): """Return the number of items in this heap.""" return len(self.items) def insert(self, item): """Insert the given item into this heap. TODO: Best case running time: ??? under what conditions? TODO: Worst case running time: ??? under what conditions?""" # Insert the item at the end and bubble up to the root self.items.append(item) if self.size() > 1: self._bubble_up(self._last_index()) def get_min(self): """Return the minimum item at the root of this heap. Best and worst case running time: O(1) because min item is the root.""" if self.size() == 0: raise ValueError('Heap is empty and has no minimum item') assert self.size() > 0 return self.items[0] def delete_min(self): """Remove and return the minimum item at the root of this heap. TODO: Best case running time: ??? under what conditions? TODO: Worst case running time: ??? under what conditions?""" if self.size() == 0: raise ValueError('Heap is empty and has no minimum item') elif self.size() == 1: # Remove and return the only item return self.items.pop() assert self.size() > 1 min_item = self.items[0] # Move the last item to the root and bubble down to the leaves last_item = self.items.pop() self.items[0] = last_item if self.size() > 1: self._bubble_down(0) return min_item def replace_min(self, item): """Remove and return the minimum item at the root of this heap, and insert the given item into this heap. This method is more efficient than calling delete_min and then insert. TODO: Best case running time: ??? under what conditions? TODO: Worst case running time: ??? under what conditions?""" if self.size() == 0: raise ValueError('Heap is empty and has no minimum item') assert self.size() > 0 min_item = self.items[0] # Replace the root and bubble down to the leaves self.items[0] = item if self.size() > 1: self._bubble_down(0) return min_item def _bubble_up(self, index): """Ensure the heap ordering property is true above the given index, swapping out of order items, or until the root node is reached. Best case running time: O(1) if parent item is smaller than this item. Worst case running time: O(log n) if items on path up to root node are out of order. Maximum path length in complete binary tree is log n.""" if index == 0: return # This index is the root node (does not have a parent) if not (0 <= index <= self._last_index()): raise IndexError('Invalid index: {}'.format(index)) # Get the item's value item = self.items[index] # Get the parent's index and value parent_index = self._parent_index(index) parent_item = self.items[parent_index] # TODO: Swap this item with parent item if values are out of order # ... # TODO: Recursively bubble up again if necessary # ... def _bubble_down(self, index): """Ensure the heap ordering property is true below the given index, swapping out of order items, or until a leaf node is reached. Best case running time: O(1) if item is smaller than both child items. Worst case running time: O(log n) if items on path down to a leaf are out of order. Maximum path length in complete binary tree is log n.""" if not (0 <= index <= self._last_index()): raise IndexError('Invalid index: {}'.format(index)) # Get the index of the item's left and right children left_index = self._left_child_index(index) right_index = self._right_child_index(index) if left_index > self._last_index(): return # This index is a leaf node (does not have any children) # Get the item's value item = self.items[index] # TODO: Determine which child item to compare this node's item to child_index = 0 # ... # TODO: Swap this item with a child item if values are out of order child_item = self.items[child_index] # ... # TODO: Recursively bubble down again if necessary # ... def _last_index(self): """Return the last valid index in the underlying array of items.""" return len(self.items) - 1 def _parent_index(self, index): """Return the parent index of the item at the given index.""" if index <= 0: raise IndexError('Heap index {} has no parent index'.format(index)) return (index - 1) >> 1 # Shift right to divide by 2 def _left_child_index(self, index): """Return the left child index of the item at the given index.""" return (index << 1) + 1 # Shift left to multiply by 2 def _right_child_index(self, index): """Return the right child index of the item at the given index.""" return (index << 1) + 2 # Shift left to multiply by 2 def test_binary_min_heap(): # Create a binary min heap of 7 items items = [9, 25, 86, 3, 29, 5, 55] heap = BinaryMinHeap() print('heap: {}'.format(heap)) print('\nInserting items:') for index, item in enumerate(items): heap.insert(item) print('insert({})'.format(item)) print('heap: {}'.format(heap)) print('size: {}'.format(heap.size())) heap_min = heap.get_min() real_min = min(items[: index + 1]) correct = heap_min == real_min print('get_min: {}, correct: {}'.format(heap_min, correct)) print('\nDeleting items:') for item in sorted(items): heap_min = heap.delete_min() print('delete_min: {}'.format(heap_min)) print('heap: {}'.format(heap)) print('size: {}'.format(heap.size())) if __name__ == '__main__': test_binary_min_heap()
def moveZeroes(nums): """ Move all zeros to the end of the given array (nums) with keeping the order of other elements. Do not return anything, modify nums in-place instead. """ # counter = 0 # for i in range(len(nums) - 1): # if nums[counter] == 0: # nums.pop(counter) # nums.append(0) # else: # counter += 1 # return nums """O(n) solution""" last_zero = 0 for i in range(len(nums)): if nums[i] != 0: nums[i], nums[last_zero] = nums[last_zero], nums[i] last_zero += 1 return nums print(moveZeroes([0, 1, 0, 3, 12]))
# https://leetcode.com/problems/jump-game/ class Solution: def canJump(self, nums: list[int]) -> bool: last = 0 for index in range(len(nums)): if index > last: return False last = max(last, index + nums[index]) if last >= len(nums) - 1: return True return True nums = [2, 3, 1, 1, 4] print(Solution().canJump(nums)) nums = [3, 2, 1, 0, 4] print(Solution().canJump(nums))
def calculate(mass): if mass < 6: return 0 return int(mass/3-2) + calculate(int(mass/3-2)) with open("1.txt", "r") as infile: print("First part solution: ", sum([int(int(x)/3)-2 for x in infile.readlines()])) print("Second part solution: ", sum([calculate(int(x)) for x in infile.readlines()]))
# -*- coding: utf-8 -*- """ meraki This file was automatically generated for meraki by APIMATIC v2.0 ( https://apimatic.io ). """ class Type2Enum(object): """Implementation of the 'Type2' enum. Type of the L7 Rule. Must be 'application', 'applicationCategory', 'host', 'port' or 'ipRange' Attributes: APPLICATION: TODO: type description here. APPLICATIONCATEGORY: TODO: type description here. HOST: TODO: type description here. PORT: TODO: type description here. IPRANGE: TODO: type description here. """ APPLICATION = 'application' APPLICATIONCATEGORY = 'applicationCategory' HOST = 'host' PORT = 'port' IPRANGE = 'ipRange'
class Dimension: def __init__(self, x1, y1, x2, y2): self.x1 = x1 self.y1 = y1 self.x2 = x2 self.y2 = y2 @property def width(self): return self.x2 - self.x1 @property def height(self): return self.y2 - self.y1 @property def aspect_ratio(self): if self.height > 0: return self.width / self.height return self.width def wider(self, other_dimension): return self.aspect_ratio > other_dimension.aspect_ratio def __str__(self): return "{} {} {} {}".format(self.x1, self.y1, self.x2, self.y2) class Decider: def __init__(self, np_array): self.upvote = True self.decided = True self.__process__(np_array) def __process__(self, np_array): if len(np_array) < 2: self.decided = False return dimensions = [] def give_me_dimensions(block): min_x = block[0][0][0] min_y = block[0][0][1] max_x = block[0][0][0] max_y = block[0][0][1] for point in block: x = point[0][0] y = point[0][1] if min_x > x: min_x = x elif max_x < x: max_x = x if min_y > y: min_y = y elif max_y < y: max_y = y return Dimension(min_x, min_y, max_x, max_y) self.thumb_area = 0 self.palm_area = 0 i = 0 for i, hull in enumerate(np_array): hull_rectangle = give_me_dimensions(hull) dimensions.append(hull_rectangle) if hull_rectangle.wider(dimensions[self.palm_area]): self.palm_area = i elif dimensions[self.thumb_area].wider(hull_rectangle): self.thumb_area = i if dimensions[self.thumb_area].aspect_ratio < 0.2: print( "Too low aspect ratio {}".format( dimensions[self.thumb_area].aspect_ratio ) ) self.decided = False return upvote_patterns = 0 downvote_patterns = 0 if (dimensions[self.thumb_area].y2 + dimensions[self.thumb_area].y1) / 2 > ( dimensions[self.palm_area].y2 + dimensions[self.palm_area].y1 ) / 2: upvote_patterns += 1 else: downvote_patterns += 1 if dimensions[self.thumb_area].y1 < dimensions[self.palm_area].y1: higher = 0 lower = 0 total = 0 for dimension in dimensions: if dimension not in ( dimensions[self.thumb_area], dimensions[self.palm_area], ): total += 1 if dimensions[self.thumb_area].y2 > dimension.y2: higher += 1 if dimensions[self.thumb_area].y1 < dimension.y1: lower += 1 if higher + lower < total * 1.5: if higher > lower + 1 + total * 0.2: upvote_patterns += 1 elif lower > higher + 1 + total * 0.2: downvote_patterns += 1 if dimensions[self.thumb_area].y2 > dimensions[self.palm_area].y2: downvote_patterns += 1 if dimensions[self.thumb_area].y1 < dimensions[self.palm_area].y1: upvote_patterns += 1 rules_count = 3 if upvote_patterns > rules_count / 2: self.upvote = True elif downvote_patterns > rules_count / 2: self.upvote = False else: self.decided = False def is_upvote(self): return self.upvote def is_decided(self): return self.decided def __thumb_area(self): return self.thumb_area def __palm_area(self): return self.palm_area
with open("../documentation/resource-doc.txt", "r") as DOC_FILE: __doc__ = DOC_FILE.read() def repositionItemInList(__index, __item, __list): __list.remove(__item) __list.insert(__index, __item) return __list def removeItems(__item_list, __list): for item in __item_list: try: __list.remove(item) except ValueError: continue return __list def removeNonePyExtensions(__list): has_py_extension_conditional = {1: (lambda: 0)} invalid_items = [] for item in __list: try: has_py_extension_conditional[(item.split(".")[1] == "py") + 0]() except (KeyError, IndexError): invalid_items.append(item) __list = removeItems(invalid_items, __list) return __list
# SPDX-License-Identifier: Apache-2.0 """ Constants used with this package. For more details about this api, please refer to the documentation at https://github.com/G-Two/subarulink """ COUNTRY_USA = "USA" COUNTRY_CAN = "CAN" MOBILE_API_SERVER = { COUNTRY_USA: "mobileapi.prod.subarucs.com", COUNTRY_CAN: "mobileapi.ca.prod.subarucs.com", } MOBILE_API_VERSION = "/g2v17" MOBILE_APP = { COUNTRY_USA: "com.subaru.telematics.app.remote", COUNTRY_CAN: "ca.subaru.telematics.remote", } WEB_API_SERVER = {COUNTRY_USA: "www.mysubaru.com", COUNTRY_CAN: "www.mysubaru.ca"} WEB_API_LOGIN = "/login" WEB_API_AUTHORIZE_DEVICE = "/profile/updateDeviceEntry.json" WEB_API_NAME_DEVICE = "/profile/addDeviceName.json" # Same API for g1 and g2 API_LOGIN = "/login.json" API_REFRESH_VEHICLES = "/refreshVehicles.json" API_SELECT_VEHICLE = "/selectVehicle.json" API_VALIDATE_SESSION = "/validateSession.json" API_VEHICLE_STATUS = "/vehicleStatus.json" API_AUTHORIZE_DEVICE = "/authenticateDevice.json" API_NAME_DEVICE = "/nameThisDevice.json" # Similar API for g1 and g2 -- controller should replace 'api_gen' with either 'g1' or 'g2' API_LOCK = "/service/api_gen/lock/execute.json" API_LOCK_CANCEL = "/service/api_gen/lock/cancel.json" API_UNLOCK = "/service/api_gen/unlock/execute.json" API_UNLOCK_CANCEL = "/service/api_gen/unlock/cancel.json" API_HORN_LIGHTS = "/service/api_gen/hornLights/execute.json" API_HORN_LIGHTS_CANCEL = "/service/api_gen/hornLights/cancel.json" API_HORN_LIGHTS_STOP = "/service/api_gen/hornLights/stop.json" API_LIGHTS = "/service/api_gen/lightsOnly/execute.json" API_LIGHTS_CANCEL = "/service/api_gen/lightsOnly/cancel.json" API_LIGHTS_STOP = "/service/api_gen/lightsOnly/stop.json" API_CONDITION = "/service/api_gen/condition/execute.json" API_LOCATE = "/service/api_gen/locate/execute.json" API_REMOTE_SVC_STATUS = "/service/api_gen/remoteService/status.json" # Different API for g1 and g2 API_G1_LOCATE_UPDATE = "/service/g1/vehicleLocate/execute.json" API_G1_LOCATE_STATUS = "/service/g1/vehicleLocate/status.json" API_G2_LOCATE_UPDATE = "/service/g2/vehicleStatus/execute.json" API_G2_LOCATE_STATUS = "/service/g2/vehicleStatus/locationStatus.json" # g1-Only API API_G1_HORN_LIGHTS_STATUS = "/service/g1/hornLights/status.json" # g2-Only API API_G2_SEND_POI = "/service/g2/sendPoi/execute.json" API_G2_SPEEDFENCE = "/service/g2/speedFence/execute.json" API_G2_GEOFENCE = "/service/g2/geoFence/execute.json" API_G2_CURFEW = "/service/g2/curfew/execute.json" API_G2_REMOTE_ENGINE_START = "/service/g2/engineStart/execute.json" API_G2_REMOTE_ENGINE_START_CANCEL = "/service/g2/engineStart/cancel.json" API_G2_REMOTE_ENGINE_STOP = "/service/g2/engineStop/execute.json" API_G2_FETCH_CLIMATE_SETTINGS = "/service/g2/remoteEngineStart/fetch.json" API_G2_SAVE_CLIMATE_SETTINGS = "/service/g2/remoteEngineStart/save.json" # EV-Only API API_EV_CHARGE_NOW = "/service/g2/phevChargeNow/execute.json" API_EV_FETCH_CHARGE_SETTINGS = "/service/g2/phevGetTimerSettings/execute.json" API_EV_SAVE_CHARGE_SETTINGS = "/service/g2/phevSendTimerSetting/execute.json" API_EV_DELETE_CHARGE_SCHEDULE = "/service/g2/phevDeleteTimerSetting/execute.json" SERVICE_REQ_ID = "serviceRequestId" # Remote start constants TEMP_F = "climateZoneFrontTemp" TEMP_F_MAX = 85 TEMP_F_MIN = 60 TEMP_C = "climateZoneFrontTempCelsius" TEMP_C_MAX = 30 TEMP_C_MIN = 15 CLIMATE = "climateSettings" CLIMATE_DEFAULT = "climateSettings" RUNTIME = "runTimeMinutes" RUNTIME_DEFAULT = "10" MODE = "climateZoneFrontAirMode" MODE_DEFROST = "WINDOW" MODE_FEET_DEFROST = "FEET_WINDOW" MODE_FACE = "FACE" MODE_FEET = "FEET" MODE_SPLIT = "FEET_FACE_BALANCED" MODE_AUTO = "AUTO" HEAT_SEAT_LEFT = "heatedSeatFrontLeft" HEAT_SEAT_RIGHT = "heatedSeatFrontRight" HEAT_SEAT_HI = "HIGH_HEAT" HEAT_SEAT_MED = "MEDIUM_HEAT" HEAT_SEAT_LOW = "LOW_HEAT" HEAT_SEAT_OFF = "OFF" REAR_DEFROST = "heatedRearWindowActive" REAR_DEFROST_ON = "true" REAR_DEFROST_OFF = "false" FAN_SPEED = "climateZoneFrontAirVolume" FAN_SPEED_LOW = "2" FAN_SPEED_MED = "4" FAN_SPEED_HI = "7" FAN_SPEED_AUTO = "AUTO" RECIRCULATE = "outerAirCirculation" RECIRCULATE_OFF = "outsideAir" RECIRCULATE_ON = "recirculation" REAR_AC = "airConditionOn" REAR_AC_ON = "true" REAR_AC_OFF = "false" START_CONFIG = "startConfiguration" START_CONFIG_DEFAULT_EV = "start_Climate_Control_only_allow_key_in_ignition" START_CONFIG_DEFAULT_RES = "START_ENGINE_ALLOW_KEY_IN_IGNITION" VALID_CLIMATE_OPTIONS = { CLIMATE: [CLIMATE_DEFAULT], TEMP_C: [str(_) for _ in range(TEMP_C_MIN, TEMP_C_MAX + 1)], TEMP_F: [str(_) for _ in range(TEMP_F_MIN, TEMP_F_MAX + 1)], FAN_SPEED: [FAN_SPEED_AUTO, FAN_SPEED_LOW, FAN_SPEED_MED, FAN_SPEED_HI], HEAT_SEAT_LEFT: [HEAT_SEAT_OFF, HEAT_SEAT_LOW, HEAT_SEAT_MED, HEAT_SEAT_HI], HEAT_SEAT_RIGHT: [HEAT_SEAT_OFF, HEAT_SEAT_LOW, HEAT_SEAT_MED, HEAT_SEAT_HI], MODE: [ MODE_DEFROST, MODE_FEET_DEFROST, MODE_FACE, MODE_FEET, MODE_SPLIT, MODE_AUTO, ], RECIRCULATE: [RECIRCULATE_OFF, RECIRCULATE_ON], REAR_AC: [REAR_AC_OFF, REAR_AC_ON], REAR_DEFROST: [REAR_DEFROST_OFF, REAR_DEFROST_ON], START_CONFIG: [START_CONFIG_DEFAULT_EV, START_CONFIG_DEFAULT_RES], RUNTIME: [str(RUNTIME_DEFAULT)], } # Unlock doors constants WHICH_DOOR = "unlockDoorType" ALL_DOORS = "ALL_DOORS_CMD" DRIVERS_DOOR = "FRONT_LEFT_DOOR_CMD" # Location data constants HEADING = "heading" LATITUDE = "latitude" LONGITUDE = "longitude" LOCATION_TIME = "locationTimestamp" SPEED = "speed" BAD_LATITUDE = 90.0 BAD_LONGITUDE = 180.0 # Vehicle status constants AVG_FUEL_CONSUMPTION = "AVG_FUEL_CONSUMPTION" BATTERY_VOLTAGE = "BATTERY_VOLTAGE" DIST_TO_EMPTY = "DISTANCE_TO_EMPTY_FUEL" DOOR_BOOT_POSITION = "DOOR_BOOT_POSITION" DOOR_ENGINE_HOOD_POSITION = "DOOR_ENGINE_HOOD_POSITION" DOOR_FRONT_LEFT_POSITION = "DOOR_FRONT_LEFT_POSITION" DOOR_FRONT_RIGHT_POSITION = "DOOR_FRONT_RIGHT_POSITION" DOOR_REAR_LEFT_POSITION = "DOOR_REAR_LEFT_POSITION" DOOR_REAR_RIGHT_POSITION = "DOOR_REAR_RIGHT_POSITION" EV_CHARGER_STATE_TYPE = "EV_CHARGER_STATE_TYPE" EV_CHARGE_SETTING_AMPERE_TYPE = "EV_CHARGE_SETTING_AMPERE_TYPE" EV_CHARGE_VOLT_TYPE = "EV_CHARGE_VOLT_TYPE" EV_DISTANCE_TO_EMPTY = "EV_DISTANCE_TO_EMPTY" EV_IS_PLUGGED_IN = "EV_IS_PLUGGED_IN" EV_STATE_OF_CHARGE_MODE = "EV_STATE_OF_CHARGE_MODE" EV_STATE_OF_CHARGE_PERCENT = "EV_STATE_OF_CHARGE_PERCENT" EV_TIME_TO_FULLY_CHARGED = "EV_TIME_TO_FULLY_CHARGED" EV_TIME_TO_FULLY_CHARGED_UTC = "EV_TIME_TO_FULLY_CHARGED_UTC" EXTERNAL_TEMP = "EXT_EXTERNAL_TEMP" ODOMETER = "ODOMETER" POSITION_TIMESTAMP = "POSITION_TIMESTAMP" TIMESTAMP = "TIMESTAMP" TIRE_PRESSURE_FL = "TYRE_PRESSURE_FRONT_LEFT" TIRE_PRESSURE_FR = "TYRE_PRESSURE_FRONT_RIGHT" TIRE_PRESSURE_RL = "TYRE_PRESSURE_REAR_LEFT" TIRE_PRESSURE_RR = "TYRE_PRESSURE_REAR_RIGHT" VEHICLE_STATE = "VEHICLE_STATE_TYPE" WINDOW_FRONT_LEFT_STATUS = "WINDOW_FRONT_LEFT_STATUS" WINDOW_FRONT_RIGHT_STATUS = "WINDOW_FRONT_RIGHT_STATUS" WINDOW_REAR_LEFT_STATUS = "WINDOW_REAR_LEFT_STATUS" WINDOW_REAR_RIGHT_STATUS = "WINDOW_REAR_RIGHT_STATUS" CHARGING = "CHARGING" LOCKED_CONNECTED = "LOCKED_CONNECTED" UNLOCKED_CONNECTED = "UNLOCKED_CONNECTED" DOOR_OPEN = "OPEN" DOOR_CLOSED = "CLOSED" WINDOW_OPEN = "OPEN" WINDOW_CLOSED = "CLOSE" IGNITION_ON = "IGNITION_ON" NOT_EQUIPPED = "NOT_EQUIPPED" # vehicleStatus.json keys VS_AVG_FUEL_CONSUMPTION = "avgFuelConsumptionLitersPer100Kilometers" VS_DIST_TO_EMPTY = "distanceToEmptyFuelKilometers" VS_TIMESTAMP = "eventDate" VS_LATITUDE = "latitude" VS_LONGITUDE = "longitude" VS_HEADING = "positionHeadingDegree" VS_ODOMETER = "odometerValueKilometers" VS_VEHICLE_STATE = "vehicleStateType" VS_TIRE_PRESSURE_FL = "tirePressureFrontLeft" VS_TIRE_PRESSURE_FR = "tirePressureFrontRight" VS_TIRE_PRESSURE_RL = "tirePressureRearLeft" VS_TIRE_PRESSURE_RR = "tirePressureRearRight" # Erroneous Values BAD_AVG_FUEL_CONSUMPTION = "16383" BAD_DISTANCE_TO_EMPTY_FUEL = "16383" BAD_EV_TIME_TO_FULLY_CHARGED = "65535" BAD_TIRE_PRESSURE = "32767" BAD_ODOMETER = None BAD_EXTERNAL_TEMP = "-64.0" BAD_SENSOR_VALUES = [ BAD_AVG_FUEL_CONSUMPTION, BAD_DISTANCE_TO_EMPTY_FUEL, BAD_EV_TIME_TO_FULLY_CHARGED, BAD_TIRE_PRESSURE, BAD_ODOMETER, BAD_EXTERNAL_TEMP, ] UNKNOWN = "UNKNOWN" VENTED = "VENTED" BAD_BINARY_SENSOR_VALUES = [UNKNOWN, VENTED, NOT_EQUIPPED] LOCATION_VALID = "location_valid" # Timestamp Formats TIMESTAMP_FMT = "%Y-%m-%dT%H:%M:%S%z" # "2020-04-25T23:35:55+0000" POSITION_TIMESTAMP_FMT = "%Y-%m-%dT%H:%M:%SZ" # "2020-04-25T23:35:55Z" # G2 Error Codes ERROR_SOA_403 = "403-soa-unableToParseResponseBody" ERROR_INVALID_CREDENTIALS = "InvalidCredentials" ERROR_SERVICE_ALREADY_STARTED = "ServiceAlreadyStarted" ERROR_INVALID_ACCOUNT = "invalidAccount" ERROR_PASSWORD_WARNING = "passwordWarning" ERROR_ACCOUNT_LOCKED = "accountLocked" ERROR_NO_VEHICLES = "noVehiclesOnAccount" ERROR_NO_ACCOUNT = "accountNotFound" ERROR_TOO_MANY_ATTEMPTS = "tooManyAttempts" ERROR_VEHICLE_NOT_IN_ACCOUNT = "vehicleNotInAccount" # G1 Error Codes ERROR_G1_NO_SUBSCRIPTION = "SXM40004" ERROR_G1_STOLEN_VEHICLE = "SXM40005" ERROR_G1_INVALID_PIN = "SXM40006" ERROR_G1_SERVICE_ALREADY_STARTED = "SXM40009" ERROR_G1_PIN_LOCKED = "SXM40017" # Controller Vehicle Data Dict Keys VEHICLE_ATTRIBUTES = "attributes" VEHICLE_STATUS = "status" VEHICLE_ID = "id" VEHICLE_NAME = "nickname" VEHICLE_API_GEN = "api_gen" VEHICLE_LOCK = "lock" VEHICLE_LAST_UPDATE = "last_update_time" VEHICLE_LAST_FETCH = "last_fetch_time" VEHICLE_FEATURES = "features" VEHICLE_SUBSCRIPTION_FEATURES = "subscriptionFeatures" VEHICLE_SUBSCRIPTION_STATUS = "subscriptionStatus" FEATURE_PHEV = "PHEV" FEATURE_REMOTE_START = "RES" FEATURE_G1_TELEMATICS = "g1" """Vehicle has 2016-2018 telematics version.""" FEATURE_G2_TELEMATICS = "g2" """Vehicle has 2019+ telematics version.""" FEATURE_REMOTE = "REMOTE" FEATURE_SAFETY = "SAFETY" FEATURE_ACTIVE = "ACTIVE" DEFAULT_UPDATE_INTERVAL = 7200 DEFAULT_FETCH_INTERVAL = 300
# An example with subplots, so an array of axes is returned. axes = df.plot.line(subplots=True) type(axes) # <class 'numpy.ndarray'>
class problem(object): """docstring for problem""" def __init__(self, arg): super(problem, self).__init__() self.arg = arg
class Statistics(): def __init__(self): self.time_cfg_constr = 0 #ok self.time_verify = 0 #ok self.time_smt = 0 #ok self.time_smt_pure = 0 self.time_interp = 0 #ok self.time_interp_pure = 0 #ok self.time_to_lia = 0 #ok self.time_from_lia = 0 #ok self.time_process_lia = 0 self.sizes_interpol = [] #ok self.num_smt = 0 #ok self.num_interp = 0 #ok self.num_interp_failure = 0 #ok self.num_boxing = 0 self.num_boxing_multi_variable = 0 self.giveup_print_unwind = False #ok self.counter_path_id = None self.counter_model = None self.counter_path_pred = None self.bitwidth = None self.theory = None def to_dict(self): return {"time_cfg_constr": self.time_cfg_constr, "time_verify": self.time_verify, "time_smt": self.time_smt, "time_interp": self.time_interp, "time_to_lia": self.time_to_lia, "time_from_lia": self.time_from_lia, "sizes_interpol": self.sizes_interpol, "num_smt": self.num_smt, "num_interp": self.num_interp, "num_interp_failure": self.num_interp_failure, "giveup_print_unwind": self.giveup_print_unwind, "counter_path_id": self.counter_path_id, "counter_model": self.counter_model, "counter_path_pred": self.counter_path_pred, "time_smt_pure": self.time_smt_pure, "time_interp_pure": self.time_interp_pure, "time_process_lia": self.time_process_lia, "bitwidth": self.bitwidth, "theory": self.theory, "num_boxing": self.num_boxing, "num_boxing_multi_variable": self.num_boxing_multi_variable }
class Knapsack01: def rebot(self, w, v, index, c): if c <= 0: return 0 if index == len(w) - 1: return v[index] if c >= w[index] else 0 if c >= w[index]: return max(self.rebot(w, v, index+1, c-w[index])+v[index], self.rebot(w, v, index+1, c)) return self.rebot(w, v, index+1, c) def knapsack01(self, w, v, c): ''' :type w: List[int] :type v: List[int] :type c: int :rtype: int ''' return self.rebot(w, v, 0, c) def knapsack01_1(self, w, v, c): assert len(w) == len(v) n = len(w) if n == 0: return 0 memo = [[0] * (c+1) for _ in range(n)] for i in range(w[-1], c+1): memo[-1][i] = v[-1] for i in range(n-2, -1, -1): for j in range(c+1): memo[i][j] = memo[i+1][j] if j >= w[i]: memo[i][j] = max(memo[i][j], memo[i+1][j-w[i]] + v[i]) # self.print_array(memo) return memo[0][c] # 优化空间复杂度 O(c) def knapsack01_2(self, w, v, c): n = len(w) if n == 0: return 0 memo = [0] * (c+1) for i in range(w[-1], c+1): memo[i] = v[-1] for i in range(n-2, -1, -1): for j in range(c, w[i]-1, -1): memo[j] = max(memo[j], memo[j-w[i]]+v[i]) # print(memo) return memo[c] def print_array(self, arr): for i in range(len(arr)): print(arr[i]) if __name__ == "__main__": w = [1, 2, 3] v = [6, 10, 12] c = 5 print(Knapsack01().knapsack01(w, v, c)) print(Knapsack01().knapsack01_1(w, v, c)) print(Knapsack01().knapsack01_2(w, v, c))
class Gen: def __init__(self, type, sequence, data_object): self.type = type self.sequence = sequence self.data_object = data_object class GenType: CDNA = 'cdna' DNA = 'dna' CDS = 'cds' class DnaType: dna = '.dna.' dna_sm = '.dna_sm.' dna_rm = '.dna_rm.'
def for_G(): """printing capital 'G' using for loop""" for row in range(6): for col in range(5): if col==0 and row not in(0,5) or row==0 and col in(1,2,3) or row==5 and col not in(0,4) or row==3 and col!=1 or col==4 and row in(1,4): print("*",end=" ") else: print(" ",end=" ") print() def while_G(): """printing capital 'G' using while loop""" i=0 while i<6: j=0 while j<6: if j==0 and i not in(0,4,5) or i==0 and j not in(0,4,5) or i==1 and j not in(1,2,3,4,5)or i==2 and j not in(1,2)or i==3 and j not in(1,2,4)or i==4 and j not in(1,2,4) or i==5 and j not in(0,3,4): print("*",end=" ") else: print(" ",end=" ") j+=1 i+=1 print()
_css_basic = """ .card { font-family: arial; font-size: 20px; text-align: center; color: black; background-color: white; } """ _css_cloze = """ .card { font-family: arial; font-size: 20px; text-align: center; color: black; background-color: white; } .cloze { font-weight: bold; color: blue; } .nightMode .cloze { color: lightblue; } """ _css_roam = """ code { border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; border: 1px solid #BCBEC0; padding: 2px; font:12px Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace } .centered-block{ display: inline-block; align: center; text-align: left; marge:auto; } .rm-page-ref-brackets { color: #a7b6c2; } .rm-page-ref-link-color { color: #106ba3; } .rm-page-ref-tag { color: #a7b6c2; } .rm-block-ref { padding: 2px 2px; margin: -2px 0px; display: inline; border-bottom: 0.5px solid #d8e1e8; cursor: alias; } .roam-highlight { background-color: #fef09f; margin: -2px; padding: 2px; } .bp3-button.bp3-small, .bp3-small .bp3-button { min-height: 24px; min-width: 24px; padding: 0 7px; } pre { text-align: left; border-radius: 5px; border: 1px solid #BCBEC0; display: block; padding: 10px; margin: 0 0 10px; font:12px Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace color: #333; background-color: #f5f5f5; } """ ROAM_BASIC = { "modelName": "Roam Basic", "inOrderFields": ["Front", "Back", "Extra", "uid"], "css": _css_basic+_css_roam, "cardTemplates": [ { "Name": "Card 1", "Front": "{{Front}}", "Back": "{{FrontSide}}<hr id=answer>{{Back}}<br><br>{{Extra}}" } ] } ROAM_CLOZE = { "modelName": "Roam Cloze", "inOrderFields": ["Text", "Extra", "uid"], "css": _css_cloze+_css_roam, "cardTemplates": [ { "Name": "Cloze", "Front": "{{cloze:Text}}", "Back": "{{cloze:Text}}<br><br>{{Extra}}" } ] }
# Insert line numbers in_file = open('Resources/02. Line Numbers/Input.txt', 'r').read().split('\n') result = [str(number + 1) + '. ' + item for number, item in enumerate(in_file)][:-1] print(*result, sep = '\n') out_str = '\n'.join(result) open('output/02.txt', 'w').write(out_str)
class Pessoa: # criar seus types personalizados olhos = 2 # atributo default ou de classe def __init__(self, *filhos, nome = None, idade = 35): # atributos de dados self.idade = idade self.nome = nome self.filhos = list(filhos) def cumprimentar(self): return f'Olá, meu nome é {self.nome}' @staticmethod def metodo_estatico(): return 42 #fazer algum cálculo que independa da classe e objeto se nao for no # metodo estatico @classmethod def nome_e_atributos_de_classe(cls): # usado para acessar dados da propria classe return f'{cls} - olhos {cls.olhos}' class Homem(Pessoa): def cumprimentar(self): cumprimentar_da_classe = super().cumprimentar() return f'{cumprimentar_da_classe}. Aperto de mão' # super() vai chamar os elementos da classe pai class Mutante(Pessoa): olhos = 3 #sobrescrita de atributo de dados if __name__ == '__main__': renzo = Mutante(nome='Renzo') # podemos mudar para homem e continuamos a obter o mesmo result, pq homem herdou de pessoa luciano = Homem(renzo, nome = 'Luciano') print(Pessoa.cumprimentar(luciano)) # obrigado a passar o objeto print(id(luciano)) print(luciano.cumprimentar()) # executando passando o próprio obj print(luciano.nome) print(luciano.idade) for filho in luciano.filhos: print(filho.nome) luciano.sobrenome = 'Ramalho' print(luciano.sobrenome) print(luciano.__dict__) print(renzo.__dict__) #mostra os atributos (criados anteriormente e on the fly) del luciano.filhos # remove atributos luciano.olhos = 1 del luciano.olhos print(Pessoa.olhos) # faz sentido porque é um default atributo de classe print(luciano.olhos) print(renzo.olhos) print(id(Pessoa.olhos), id(luciano.olhos), id(renzo.olhos)) # sao iguais print(Pessoa.metodo_estatico(), luciano.metodo_estatico()) # sem o obj dentro(1 arg pq e e estat) ou atraves do obj # se o atributo nao for encontrado no obj, # o python procura na classe(2 arg) print(Pessoa.nome_e_atributos_de_classe(), luciano.nome_e_atributos_de_classe()) # pode ser executado pela classe ou pelo objeto pessoa = Pessoa('Anonimo') print(isinstance(pessoa, Pessoa)) print(isinstance(pessoa, Homem)) print(isinstance(renzo, Homem)) print(isinstance(renzo, Pessoa)) print(renzo.olhos) # quando uma classe nao herda de nenhuma outra, ela herda implicitamente da classe raiz object # e a busca vai pesquisar se há o atributo no object se nao encontrar em nenhuma print(luciano.cumprimentar()) print(renzo.cumprimentar()) ##Obs.: método nada mais é que uma função que pertence a uma classe # portanto, sempre está conectada a um objeto ##Obs2.: podemos criar atributos on the fly para aquele objeto específico(não é boa pratica)
# divisão por dois números numero1 = int(input('Entre com o primeiro número: ')) numero2 = int(input('Entre com o segundo número: ')) resultado = numero1 / numero2 print('O resultado é: ',resultado) input('Pressione ENTER para sair...')
fib = lambda n: n if n <= 2 else fib(n - 1) + fib(n - 2) ''' print(fib(10)) #89 '''
# https://leetcode.com/problems/rotate-array/ class Solution: def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. """ def reverse(s, e): while s < e: nums[s], nums[e] = nums[e], nums[s] s += 1 e -= 1 k %= len(nums) reverse(0, len(nums) - 1) reverse(0, k - 1) reverse(k, len(nums) - 1)
""" Operadores logicos - aula 4 and, or not in e not in """ # (verdadeiro e False) = Falso #comparação1 and comparação #verdadeiro OU Verdadeiro #comp1 or comp2 #Not inverter uma expressão #Comando in muito utilllll nome = 'Pedro' if 'Ped' in nome: #todo: Muito util print('Existe o texto.') else: print('Não existe o texto.') nome1 = 'Pedro' if 'dfg' not in nome1: #todo: Muito UTILLL print('Executei.') else: print('Existe o texto.')
""" PASSENGERS """ numPassengers = 3191 passenger_arriving = ( (5, 8, 7, 5, 1, 0, 3, 5, 8, 3, 0, 0), # 0 (2, 8, 13, 5, 0, 0, 12, 10, 6, 1, 0, 0), # 1 (1, 10, 5, 4, 2, 0, 13, 13, 5, 2, 3, 0), # 2 (5, 11, 16, 2, 3, 0, 8, 0, 6, 3, 4, 0), # 3 (5, 8, 6, 2, 1, 0, 7, 10, 6, 5, 1, 0), # 4 (1, 10, 8, 5, 1, 0, 3, 10, 4, 2, 2, 0), # 5 (6, 8, 4, 5, 2, 0, 6, 6, 4, 4, 2, 0), # 6 (5, 9, 5, 2, 1, 0, 10, 12, 2, 5, 3, 0), # 7 (6, 3, 5, 3, 1, 0, 8, 7, 3, 6, 0, 0), # 8 (5, 7, 5, 5, 2, 0, 6, 6, 5, 4, 2, 0), # 9 (5, 11, 8, 3, 0, 0, 5, 8, 5, 4, 1, 0), # 10 (7, 5, 9, 6, 3, 0, 4, 5, 11, 6, 2, 0), # 11 (6, 7, 11, 2, 1, 0, 7, 6, 14, 8, 1, 0), # 12 (3, 6, 10, 4, 2, 0, 10, 9, 9, 2, 3, 0), # 13 (2, 8, 3, 4, 4, 0, 6, 12, 1, 2, 2, 0), # 14 (4, 12, 10, 7, 1, 0, 5, 16, 9, 7, 1, 0), # 15 (2, 11, 5, 1, 1, 0, 8, 9, 5, 6, 0, 0), # 16 (0, 10, 9, 4, 5, 0, 4, 8, 3, 4, 1, 0), # 17 (2, 7, 6, 3, 3, 0, 5, 12, 7, 6, 5, 0), # 18 (5, 8, 4, 5, 1, 0, 11, 9, 4, 3, 2, 0), # 19 (0, 9, 4, 2, 1, 0, 9, 13, 5, 3, 2, 0), # 20 (2, 8, 7, 2, 3, 0, 3, 11, 9, 2, 4, 0), # 21 (4, 11, 8, 5, 1, 0, 7, 8, 4, 6, 3, 0), # 22 (3, 4, 6, 0, 3, 0, 4, 11, 4, 7, 0, 0), # 23 (6, 14, 9, 3, 1, 0, 5, 5, 9, 6, 5, 0), # 24 (4, 8, 4, 7, 5, 0, 8, 6, 7, 3, 2, 0), # 25 (4, 8, 14, 2, 7, 0, 8, 9, 9, 4, 5, 0), # 26 (3, 5, 9, 8, 1, 0, 10, 6, 7, 5, 3, 0), # 27 (5, 13, 5, 3, 3, 0, 4, 10, 10, 4, 1, 0), # 28 (5, 8, 7, 3, 5, 0, 10, 10, 3, 0, 0, 0), # 29 (1, 10, 3, 3, 4, 0, 10, 10, 3, 7, 3, 0), # 30 (8, 6, 10, 5, 0, 0, 6, 9, 4, 4, 1, 0), # 31 (3, 10, 9, 2, 1, 0, 8, 10, 3, 5, 2, 0), # 32 (4, 9, 5, 1, 3, 0, 3, 7, 6, 6, 2, 0), # 33 (7, 6, 5, 6, 4, 0, 10, 9, 8, 2, 1, 0), # 34 (6, 6, 6, 5, 2, 0, 4, 5, 5, 8, 2, 0), # 35 (3, 15, 7, 4, 4, 0, 7, 8, 10, 5, 4, 0), # 36 (4, 15, 11, 4, 2, 0, 9, 11, 3, 9, 4, 0), # 37 (3, 13, 5, 3, 4, 0, 8, 8, 3, 6, 3, 0), # 38 (2, 5, 8, 1, 0, 0, 5, 7, 3, 8, 5, 0), # 39 (6, 8, 11, 5, 3, 0, 10, 13, 4, 4, 1, 0), # 40 (4, 9, 6, 6, 0, 0, 6, 9, 3, 1, 0, 0), # 41 (2, 10, 8, 3, 4, 0, 10, 7, 5, 1, 0, 0), # 42 (4, 17, 7, 3, 3, 0, 7, 6, 6, 3, 1, 0), # 43 (6, 13, 3, 2, 2, 0, 5, 11, 7, 5, 4, 0), # 44 (3, 11, 6, 2, 2, 0, 3, 5, 5, 3, 2, 0), # 45 (7, 8, 9, 4, 0, 0, 10, 8, 6, 5, 3, 0), # 46 (3, 10, 10, 8, 2, 0, 6, 10, 7, 7, 3, 0), # 47 (4, 10, 5, 8, 1, 0, 6, 9, 8, 6, 2, 0), # 48 (3, 12, 9, 2, 2, 0, 3, 11, 8, 3, 0, 0), # 49 (5, 13, 6, 5, 1, 0, 5, 7, 2, 3, 5, 0), # 50 (4, 9, 7, 5, 2, 0, 4, 9, 6, 5, 4, 0), # 51 (3, 8, 4, 3, 3, 0, 4, 7, 6, 3, 8, 0), # 52 (6, 10, 8, 6, 2, 0, 3, 6, 8, 4, 2, 0), # 53 (0, 11, 11, 5, 4, 0, 8, 8, 6, 5, 8, 0), # 54 (1, 9, 4, 3, 2, 0, 5, 8, 3, 5, 2, 0), # 55 (5, 7, 7, 3, 3, 0, 3, 9, 5, 3, 2, 0), # 56 (4, 7, 10, 6, 5, 0, 6, 12, 5, 5, 3, 0), # 57 (3, 6, 7, 6, 3, 0, 2, 8, 6, 7, 3, 0), # 58 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 59 ) station_arriving_intensity = ( (3.7095121817383676, 9.515044981060607, 11.19193043059126, 8.87078804347826, 10.000240384615385, 6.659510869565219), # 0 (3.7443308140669203, 9.620858238197952, 11.252381752534994, 8.920190141908213, 10.075193108974359, 6.657240994867151), # 1 (3.7787518681104277, 9.725101964085297, 11.31139817195087, 8.968504830917876, 10.148564102564103, 6.654901690821256), # 2 (3.8127461259877085, 9.827663671875001, 11.368936576156813, 9.01569089673913, 10.22028605769231, 6.652493274456523), # 3 (3.8462843698175795, 9.928430874719417, 11.424953852470724, 9.061707125603865, 10.290291666666668, 6.6500160628019325), # 4 (3.879337381718857, 10.027291085770905, 11.479406888210512, 9.106512303743962, 10.358513621794872, 6.647470372886473), # 5 (3.9118759438103607, 10.12413181818182, 11.53225257069409, 9.150065217391306, 10.424884615384617, 6.644856521739131), # 6 (3.943870838210907, 10.218840585104518, 11.58344778723936, 9.19232465277778, 10.489337339743592, 6.64217482638889), # 7 (3.975292847039314, 10.311304899691358, 11.632949425164242, 9.233249396135266, 10.551804487179488, 6.639425603864735), # 8 (4.006112752414399, 10.401412275094698, 11.680714371786634, 9.272798233695653, 10.61221875, 6.636609171195653), # 9 (4.03630133645498, 10.489050224466892, 11.72669951442445, 9.310929951690824, 10.670512820512823, 6.633725845410628), # 10 (4.065829381279876, 10.5741062609603, 11.7708617403956, 9.347603336352659, 10.726619391025642, 6.630775943538648), # 11 (4.094667669007903, 10.656467897727273, 11.813157937017996, 9.382777173913043, 10.780471153846154, 6.627759782608695), # 12 (4.122786981757876, 10.736022647920176, 11.85354499160954, 9.416410250603866, 10.832000801282053, 6.624677679649759), # 13 (4.15015810164862, 10.81265802469136, 11.891979791488144, 9.448461352657004, 10.881141025641025, 6.621529951690821), # 14 (4.1767518107989465, 10.886261541193182, 11.928419223971721, 9.478889266304348, 10.92782451923077, 6.618316915760871), # 15 (4.202538891327675, 10.956720710578002, 11.96282017637818, 9.507652777777778, 10.971983974358976, 6.61503888888889), # 16 (4.227490125353625, 11.023923045998176, 11.995139536025421, 9.53471067330918, 11.013552083333336, 6.611696188103866), # 17 (4.25157629499561, 11.087756060606061, 12.025334190231364, 9.560021739130436, 11.052461538461543, 6.608289130434783), # 18 (4.274768182372451, 11.148107267554012, 12.053361026313912, 9.58354476147343, 11.088645032051284, 6.604818032910629), # 19 (4.297036569602966, 11.204864179994388, 12.079176931590974, 9.60523852657005, 11.122035256410259, 6.601283212560387), # 20 (4.318352238805971, 11.257914311079544, 12.102738793380466, 9.625061820652174, 11.152564903846153, 6.597684986413044), # 21 (4.338685972100283, 11.307145173961842, 12.124003499000287, 9.642973429951692, 11.180166666666667, 6.5940236714975855), # 22 (4.358008551604722, 11.352444281793632, 12.142927935768354, 9.658932140700484, 11.204773237179488, 6.590299584842997), # 23 (4.3762907594381035, 11.393699147727272, 12.159468991002571, 9.672896739130437, 11.226317307692307, 6.586513043478261), # 24 (4.393503377719247, 11.430797284915124, 12.173583552020853, 9.684826011473431, 11.244731570512819, 6.582664364432368), # 25 (4.409617188566969, 11.46362620650954, 12.185228506141103, 9.694678743961353, 11.259948717948719, 6.5787538647343), # 26 (4.424602974100088, 11.492073425662877, 12.194360740681233, 9.702413722826089, 11.271901442307694, 6.574781861413045), # 27 (4.438431516437421, 11.516026455527497, 12.200937142959157, 9.707989734299519, 11.280522435897437, 6.570748671497586), # 28 (4.4510735976977855, 11.535372809255753, 12.204914600292774, 9.711365564613528, 11.285744391025641, 6.566654612016909), # 29 (4.4625, 11.55, 12.20625, 9.7125, 11.287500000000001, 6.562500000000001), # 30 (4.47319183983376, 11.56215031960227, 12.205248928140096, 9.712295118464054, 11.286861125886526, 6.556726763701484), # 31 (4.4836528452685425, 11.574140056818184, 12.202274033816424, 9.711684477124184, 11.28495815602837, 6.547834661835751), # 32 (4.493887715792838, 11.585967720170455, 12.197367798913046, 9.710674080882354, 11.281811569148937, 6.535910757121439), # 33 (4.503901150895141, 11.597631818181819, 12.19057270531401, 9.709269934640524, 11.277441843971632, 6.521042112277196), # 34 (4.513697850063939, 11.609130859374998, 12.181931234903383, 9.707478043300654, 11.27186945921986, 6.503315790021656), # 35 (4.523282512787724, 11.62046335227273, 12.171485869565219, 9.705304411764708, 11.265114893617023, 6.482818853073463), # 36 (4.532659838554988, 11.631627805397729, 12.159279091183576, 9.70275504493464, 11.257198625886524, 6.4596383641512585), # 37 (4.5418345268542195, 11.642622727272729, 12.145353381642513, 9.699835947712419, 11.248141134751775, 6.433861385973679), # 38 (4.5508112771739135, 11.653446626420456, 12.129751222826087, 9.696553125000001, 11.23796289893617, 6.40557498125937), # 39 (4.559594789002558, 11.664098011363638, 12.11251509661836, 9.692912581699348, 11.22668439716312, 6.37486621272697), # 40 (4.568189761828645, 11.674575390625, 12.093687484903382, 9.68892032271242, 11.214326108156028, 6.34182214309512), # 41 (4.576600895140665, 11.684877272727276, 12.07331086956522, 9.684582352941177, 11.2009085106383, 6.3065298350824595), # 42 (4.584832888427111, 11.69500216619318, 12.051427732487923, 9.679904677287583, 11.186452083333334, 6.26907635140763), # 43 (4.592890441176471, 11.704948579545455, 12.028080555555556, 9.674893300653595, 11.17097730496454, 6.229548754789272), # 44 (4.600778252877237, 11.714715021306818, 12.003311820652177, 9.669554227941177, 11.15450465425532, 6.188034107946028), # 45 (4.6085010230179035, 11.724300000000003, 11.97716400966184, 9.663893464052288, 11.137054609929079, 6.144619473596536), # 46 (4.616063451086957, 11.733702024147728, 11.9496796044686, 9.65791701388889, 11.118647650709221, 6.099391914459438), # 47 (4.623470236572891, 11.742919602272728, 11.920901086956523, 9.651630882352942, 11.099304255319149, 6.052438493253375), # 48 (4.630726078964194, 11.751951242897727, 11.890870939009663, 9.645041074346407, 11.079044902482272, 6.003846272696985), # 49 (4.6378356777493615, 11.760795454545454, 11.85963164251208, 9.638153594771243, 11.057890070921987, 5.953702315508913), # 50 (4.6448037324168805, 11.769450745738636, 11.827225679347826, 9.630974448529413, 11.035860239361703, 5.902093684407797), # 51 (4.651634942455243, 11.777915625, 11.793695531400965, 9.623509640522876, 11.012975886524824, 5.849107442112278), # 52 (4.658334007352941, 11.786188600852274, 11.759083680555555, 9.615765175653596, 10.989257491134753, 5.794830651340996), # 53 (4.6649056265984665, 11.79426818181818, 11.723432608695653, 9.60774705882353, 10.964725531914894, 5.739350374812594), # 54 (4.671354499680307, 11.802152876420456, 11.686784797705313, 9.599461294934642, 10.939400487588653, 5.682753675245711), # 55 (4.677685326086957, 11.809841193181818, 11.649182729468599, 9.59091388888889, 10.913302836879433, 5.625127615358988), # 56 (4.683902805306906, 11.817331640625003, 11.610668885869565, 9.582110845588236, 10.886453058510638, 5.566559257871065), # 57 (4.690011636828645, 11.824622727272727, 11.57128574879227, 9.573058169934642, 10.858871631205675, 5.507135665500583), # 58 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59 ) passenger_arriving_acc = ( (5, 8, 7, 5, 1, 0, 3, 5, 8, 3, 0, 0), # 0 (7, 16, 20, 10, 1, 0, 15, 15, 14, 4, 0, 0), # 1 (8, 26, 25, 14, 3, 0, 28, 28, 19, 6, 3, 0), # 2 (13, 37, 41, 16, 6, 0, 36, 28, 25, 9, 7, 0), # 3 (18, 45, 47, 18, 7, 0, 43, 38, 31, 14, 8, 0), # 4 (19, 55, 55, 23, 8, 0, 46, 48, 35, 16, 10, 0), # 5 (25, 63, 59, 28, 10, 0, 52, 54, 39, 20, 12, 0), # 6 (30, 72, 64, 30, 11, 0, 62, 66, 41, 25, 15, 0), # 7 (36, 75, 69, 33, 12, 0, 70, 73, 44, 31, 15, 0), # 8 (41, 82, 74, 38, 14, 0, 76, 79, 49, 35, 17, 0), # 9 (46, 93, 82, 41, 14, 0, 81, 87, 54, 39, 18, 0), # 10 (53, 98, 91, 47, 17, 0, 85, 92, 65, 45, 20, 0), # 11 (59, 105, 102, 49, 18, 0, 92, 98, 79, 53, 21, 0), # 12 (62, 111, 112, 53, 20, 0, 102, 107, 88, 55, 24, 0), # 13 (64, 119, 115, 57, 24, 0, 108, 119, 89, 57, 26, 0), # 14 (68, 131, 125, 64, 25, 0, 113, 135, 98, 64, 27, 0), # 15 (70, 142, 130, 65, 26, 0, 121, 144, 103, 70, 27, 0), # 16 (70, 152, 139, 69, 31, 0, 125, 152, 106, 74, 28, 0), # 17 (72, 159, 145, 72, 34, 0, 130, 164, 113, 80, 33, 0), # 18 (77, 167, 149, 77, 35, 0, 141, 173, 117, 83, 35, 0), # 19 (77, 176, 153, 79, 36, 0, 150, 186, 122, 86, 37, 0), # 20 (79, 184, 160, 81, 39, 0, 153, 197, 131, 88, 41, 0), # 21 (83, 195, 168, 86, 40, 0, 160, 205, 135, 94, 44, 0), # 22 (86, 199, 174, 86, 43, 0, 164, 216, 139, 101, 44, 0), # 23 (92, 213, 183, 89, 44, 0, 169, 221, 148, 107, 49, 0), # 24 (96, 221, 187, 96, 49, 0, 177, 227, 155, 110, 51, 0), # 25 (100, 229, 201, 98, 56, 0, 185, 236, 164, 114, 56, 0), # 26 (103, 234, 210, 106, 57, 0, 195, 242, 171, 119, 59, 0), # 27 (108, 247, 215, 109, 60, 0, 199, 252, 181, 123, 60, 0), # 28 (113, 255, 222, 112, 65, 0, 209, 262, 184, 123, 60, 0), # 29 (114, 265, 225, 115, 69, 0, 219, 272, 187, 130, 63, 0), # 30 (122, 271, 235, 120, 69, 0, 225, 281, 191, 134, 64, 0), # 31 (125, 281, 244, 122, 70, 0, 233, 291, 194, 139, 66, 0), # 32 (129, 290, 249, 123, 73, 0, 236, 298, 200, 145, 68, 0), # 33 (136, 296, 254, 129, 77, 0, 246, 307, 208, 147, 69, 0), # 34 (142, 302, 260, 134, 79, 0, 250, 312, 213, 155, 71, 0), # 35 (145, 317, 267, 138, 83, 0, 257, 320, 223, 160, 75, 0), # 36 (149, 332, 278, 142, 85, 0, 266, 331, 226, 169, 79, 0), # 37 (152, 345, 283, 145, 89, 0, 274, 339, 229, 175, 82, 0), # 38 (154, 350, 291, 146, 89, 0, 279, 346, 232, 183, 87, 0), # 39 (160, 358, 302, 151, 92, 0, 289, 359, 236, 187, 88, 0), # 40 (164, 367, 308, 157, 92, 0, 295, 368, 239, 188, 88, 0), # 41 (166, 377, 316, 160, 96, 0, 305, 375, 244, 189, 88, 0), # 42 (170, 394, 323, 163, 99, 0, 312, 381, 250, 192, 89, 0), # 43 (176, 407, 326, 165, 101, 0, 317, 392, 257, 197, 93, 0), # 44 (179, 418, 332, 167, 103, 0, 320, 397, 262, 200, 95, 0), # 45 (186, 426, 341, 171, 103, 0, 330, 405, 268, 205, 98, 0), # 46 (189, 436, 351, 179, 105, 0, 336, 415, 275, 212, 101, 0), # 47 (193, 446, 356, 187, 106, 0, 342, 424, 283, 218, 103, 0), # 48 (196, 458, 365, 189, 108, 0, 345, 435, 291, 221, 103, 0), # 49 (201, 471, 371, 194, 109, 0, 350, 442, 293, 224, 108, 0), # 50 (205, 480, 378, 199, 111, 0, 354, 451, 299, 229, 112, 0), # 51 (208, 488, 382, 202, 114, 0, 358, 458, 305, 232, 120, 0), # 52 (214, 498, 390, 208, 116, 0, 361, 464, 313, 236, 122, 0), # 53 (214, 509, 401, 213, 120, 0, 369, 472, 319, 241, 130, 0), # 54 (215, 518, 405, 216, 122, 0, 374, 480, 322, 246, 132, 0), # 55 (220, 525, 412, 219, 125, 0, 377, 489, 327, 249, 134, 0), # 56 (224, 532, 422, 225, 130, 0, 383, 501, 332, 254, 137, 0), # 57 (227, 538, 429, 231, 133, 0, 385, 509, 338, 261, 140, 0), # 58 (227, 538, 429, 231, 133, 0, 385, 509, 338, 261, 140, 0), # 59 ) passenger_arriving_rate = ( (3.7095121817383676, 7.612035984848484, 6.715158258354756, 3.5483152173913037, 2.000048076923077, 0.0, 6.659510869565219, 8.000192307692307, 5.322472826086956, 4.476772172236504, 1.903008996212121, 0.0), # 0 (3.7443308140669203, 7.696686590558361, 6.751429051520996, 3.5680760567632848, 2.0150386217948717, 0.0, 6.657240994867151, 8.060154487179487, 5.352114085144928, 4.500952701013997, 1.9241716476395903, 0.0), # 1 (3.7787518681104277, 7.780081571268237, 6.786838903170522, 3.58740193236715, 2.0297128205128203, 0.0, 6.654901690821256, 8.118851282051281, 5.381102898550726, 4.524559268780347, 1.9450203928170593, 0.0), # 2 (3.8127461259877085, 7.8621309375, 6.821361945694087, 3.6062763586956517, 2.044057211538462, 0.0, 6.652493274456523, 8.176228846153847, 5.409414538043478, 4.547574630462725, 1.965532734375, 0.0), # 3 (3.8462843698175795, 7.942744699775533, 6.854972311482434, 3.624682850241546, 2.0580583333333333, 0.0, 6.6500160628019325, 8.232233333333333, 5.437024275362319, 4.569981540988289, 1.9856861749438832, 0.0), # 4 (3.879337381718857, 8.021832868616723, 6.887644132926307, 3.6426049214975844, 2.0717027243589743, 0.0, 6.647470372886473, 8.286810897435897, 5.463907382246377, 4.591762755284204, 2.005458217154181, 0.0), # 5 (3.9118759438103607, 8.099305454545455, 6.919351542416455, 3.660026086956522, 2.084976923076923, 0.0, 6.644856521739131, 8.339907692307692, 5.490039130434783, 4.612901028277636, 2.0248263636363637, 0.0), # 6 (3.943870838210907, 8.175072468083613, 6.950068672343615, 3.6769298611111116, 2.0978674679487184, 0.0, 6.64217482638889, 8.391469871794873, 5.515394791666668, 4.633379114895743, 2.043768117020903, 0.0), # 7 (3.975292847039314, 8.249043919753085, 6.979769655098544, 3.693299758454106, 2.1103608974358976, 0.0, 6.639425603864735, 8.44144358974359, 5.5399496376811594, 4.653179770065696, 2.062260979938271, 0.0), # 8 (4.006112752414399, 8.321129820075758, 7.00842862307198, 3.709119293478261, 2.12244375, 0.0, 6.636609171195653, 8.489775, 5.563678940217391, 4.672285748714653, 2.0802824550189394, 0.0), # 9 (4.03630133645498, 8.391240179573513, 7.03601970865467, 3.724371980676329, 2.134102564102564, 0.0, 6.633725845410628, 8.536410256410257, 5.586557971014494, 4.690679805769779, 2.0978100448933783, 0.0), # 10 (4.065829381279876, 8.459285008768239, 7.06251704423736, 3.739041334541063, 2.145323878205128, 0.0, 6.630775943538648, 8.581295512820512, 5.608562001811595, 4.70834469615824, 2.1148212521920597, 0.0), # 11 (4.094667669007903, 8.525174318181818, 7.087894762210797, 3.7531108695652167, 2.156094230769231, 0.0, 6.627759782608695, 8.624376923076923, 5.6296663043478254, 4.725263174807198, 2.1312935795454546, 0.0), # 12 (4.122786981757876, 8.58881811833614, 7.112126994965724, 3.766564100241546, 2.1664001602564102, 0.0, 6.624677679649759, 8.665600641025641, 5.649846150362319, 4.741417996643816, 2.147204529584035, 0.0), # 13 (4.15015810164862, 8.650126419753088, 7.135187874892886, 3.779384541062801, 2.1762282051282047, 0.0, 6.621529951690821, 8.704912820512819, 5.669076811594202, 4.756791916595257, 2.162531604938272, 0.0), # 14 (4.1767518107989465, 8.709009232954545, 7.157051534383032, 3.7915557065217387, 2.1855649038461538, 0.0, 6.618316915760871, 8.742259615384615, 5.6873335597826085, 4.771367689588688, 2.177252308238636, 0.0), # 15 (4.202538891327675, 8.7653765684624, 7.177692105826908, 3.803061111111111, 2.194396794871795, 0.0, 6.61503888888889, 8.77758717948718, 5.7045916666666665, 4.785128070551272, 2.1913441421156, 0.0), # 16 (4.227490125353625, 8.81913843679854, 7.197083721615253, 3.8138842693236716, 2.202710416666667, 0.0, 6.611696188103866, 8.810841666666668, 5.720826403985508, 4.798055814410168, 2.204784609199635, 0.0), # 17 (4.25157629499561, 8.870204848484848, 7.215200514138818, 3.824008695652174, 2.2104923076923084, 0.0, 6.608289130434783, 8.841969230769234, 5.736013043478262, 4.810133676092545, 2.217551212121212, 0.0), # 18 (4.274768182372451, 8.918485814043208, 7.232016615788346, 3.8334179045893717, 2.2177290064102566, 0.0, 6.604818032910629, 8.870916025641026, 5.750126856884058, 4.8213444105255645, 2.229621453510802, 0.0), # 19 (4.297036569602966, 8.96389134399551, 7.247506158954584, 3.8420954106280196, 2.2244070512820517, 0.0, 6.601283212560387, 8.897628205128207, 5.76314311594203, 4.831670772636389, 2.2409728359988774, 0.0), # 20 (4.318352238805971, 9.006331448863634, 7.261643276028279, 3.8500247282608693, 2.2305129807692303, 0.0, 6.597684986413044, 8.922051923076921, 5.775037092391305, 4.841095517352186, 2.2515828622159084, 0.0), # 21 (4.338685972100283, 9.045716139169473, 7.274402099400172, 3.8571893719806765, 2.2360333333333333, 0.0, 6.5940236714975855, 8.944133333333333, 5.785784057971015, 4.849601399600115, 2.2614290347923682, 0.0), # 22 (4.358008551604722, 9.081955425434906, 7.285756761461012, 3.8635728562801934, 2.2409546474358972, 0.0, 6.590299584842997, 8.963818589743589, 5.79535928442029, 4.857171174307341, 2.2704888563587264, 0.0), # 23 (4.3762907594381035, 9.114959318181818, 7.295681394601543, 3.869158695652174, 2.2452634615384612, 0.0, 6.586513043478261, 8.981053846153845, 5.803738043478262, 4.863787596401028, 2.2787398295454544, 0.0), # 24 (4.393503377719247, 9.1446378279321, 7.304150131212511, 3.8739304045893723, 2.2489463141025636, 0.0, 6.582664364432368, 8.995785256410255, 5.810895606884059, 4.869433420808341, 2.286159456983025, 0.0), # 25 (4.409617188566969, 9.17090096520763, 7.311137103684661, 3.8778714975845405, 2.2519897435897436, 0.0, 6.5787538647343, 9.007958974358974, 5.816807246376811, 4.874091402456441, 2.2927252413019077, 0.0), # 26 (4.424602974100088, 9.193658740530301, 7.31661644440874, 3.880965489130435, 2.2543802884615385, 0.0, 6.574781861413045, 9.017521153846154, 5.821448233695653, 4.877744296272493, 2.2984146851325753, 0.0), # 27 (4.438431516437421, 9.212821164421996, 7.320562285775494, 3.8831958937198072, 2.256104487179487, 0.0, 6.570748671497586, 9.024417948717948, 5.824793840579711, 4.8803748571836625, 2.303205291105499, 0.0), # 28 (4.4510735976977855, 9.228298247404602, 7.322948760175664, 3.884546225845411, 2.257148878205128, 0.0, 6.566654612016909, 9.028595512820512, 5.826819338768117, 4.881965840117109, 2.3070745618511506, 0.0), # 29 (4.4625, 9.24, 7.32375, 3.885, 2.2575000000000003, 0.0, 6.562500000000001, 9.030000000000001, 5.8275, 4.8825, 2.31, 0.0), # 30 (4.47319183983376, 9.249720255681815, 7.323149356884057, 3.884918047385621, 2.257372225177305, 0.0, 6.556726763701484, 9.02948890070922, 5.827377071078432, 4.882099571256038, 2.312430063920454, 0.0), # 31 (4.4836528452685425, 9.259312045454546, 7.3213644202898545, 3.884673790849673, 2.2569916312056737, 0.0, 6.547834661835751, 9.027966524822695, 5.82701068627451, 4.880909613526569, 2.3148280113636366, 0.0), # 32 (4.493887715792838, 9.268774176136363, 7.3184206793478275, 3.8842696323529413, 2.2563623138297872, 0.0, 6.535910757121439, 9.025449255319149, 5.826404448529412, 4.878947119565218, 2.3171935440340907, 0.0), # 33 (4.503901150895141, 9.278105454545454, 7.314343623188405, 3.8837079738562093, 2.2554883687943263, 0.0, 6.521042112277196, 9.021953475177305, 5.825561960784314, 4.876229082125604, 2.3195263636363634, 0.0), # 34 (4.513697850063939, 9.287304687499997, 7.3091587409420296, 3.882991217320261, 2.2543738918439717, 0.0, 6.503315790021656, 9.017495567375887, 5.824486825980392, 4.872772493961353, 2.3218261718749993, 0.0), # 35 (4.523282512787724, 9.296370681818182, 7.302891521739131, 3.8821217647058828, 2.253022978723404, 0.0, 6.482818853073463, 9.012091914893617, 5.823182647058824, 4.868594347826087, 2.3240926704545455, 0.0), # 36 (4.532659838554988, 9.305302244318183, 7.295567454710145, 3.881102017973856, 2.2514397251773044, 0.0, 6.4596383641512585, 9.005758900709218, 5.821653026960784, 4.86371163647343, 2.3263255610795457, 0.0), # 37 (4.5418345268542195, 9.314098181818181, 7.287212028985508, 3.8799343790849674, 2.249628226950355, 0.0, 6.433861385973679, 8.99851290780142, 5.819901568627452, 4.858141352657005, 2.3285245454545453, 0.0), # 38 (4.5508112771739135, 9.322757301136363, 7.277850733695652, 3.87862125, 2.247592579787234, 0.0, 6.40557498125937, 8.990370319148935, 5.817931875, 4.8519004891304345, 2.330689325284091, 0.0), # 39 (4.559594789002558, 9.33127840909091, 7.267509057971015, 3.8771650326797387, 2.245336879432624, 0.0, 6.37486621272697, 8.981347517730496, 5.815747549019608, 4.845006038647344, 2.3328196022727274, 0.0), # 40 (4.568189761828645, 9.3396603125, 7.256212490942029, 3.8755681290849675, 2.2428652216312055, 0.0, 6.34182214309512, 8.971460886524822, 5.813352193627452, 4.837474993961353, 2.334915078125, 0.0), # 41 (4.576600895140665, 9.34790181818182, 7.2439865217391315, 3.8738329411764707, 2.2401817021276598, 0.0, 6.3065298350824595, 8.960726808510639, 5.810749411764706, 4.829324347826088, 2.336975454545455, 0.0), # 42 (4.584832888427111, 9.356001732954544, 7.230856639492753, 3.8719618709150327, 2.2372904166666667, 0.0, 6.26907635140763, 8.949161666666667, 5.80794280637255, 4.820571092995169, 2.339000433238636, 0.0), # 43 (4.592890441176471, 9.363958863636363, 7.216848333333333, 3.8699573202614377, 2.2341954609929076, 0.0, 6.229548754789272, 8.93678184397163, 5.804935980392157, 4.811232222222222, 2.3409897159090907, 0.0), # 44 (4.600778252877237, 9.371772017045453, 7.201987092391306, 3.8678216911764705, 2.230900930851064, 0.0, 6.188034107946028, 8.923603723404256, 5.801732536764706, 4.80132472826087, 2.3429430042613633, 0.0), # 45 (4.6085010230179035, 9.379440000000002, 7.186298405797103, 3.8655573856209147, 2.2274109219858156, 0.0, 6.144619473596536, 8.909643687943262, 5.798336078431372, 4.790865603864735, 2.3448600000000006, 0.0), # 46 (4.616063451086957, 9.386961619318182, 7.16980776268116, 3.8631668055555552, 2.223729530141844, 0.0, 6.099391914459438, 8.894918120567375, 5.794750208333333, 4.77987184178744, 2.3467404048295455, 0.0), # 47 (4.623470236572891, 9.394335681818182, 7.152540652173913, 3.8606523529411763, 2.21986085106383, 0.0, 6.052438493253375, 8.87944340425532, 5.790978529411765, 4.7683604347826085, 2.3485839204545456, 0.0), # 48 (4.630726078964194, 9.401560994318181, 7.134522563405797, 3.8580164297385626, 2.2158089804964543, 0.0, 6.003846272696985, 8.863235921985817, 5.787024644607844, 4.7563483756038645, 2.3503902485795454, 0.0), # 49 (4.6378356777493615, 9.408636363636361, 7.115778985507247, 3.8552614379084966, 2.211578014184397, 0.0, 5.953702315508913, 8.846312056737588, 5.782892156862745, 4.743852657004831, 2.3521590909090904, 0.0), # 50 (4.6448037324168805, 9.415560596590907, 7.096335407608696, 3.852389779411765, 2.2071720478723407, 0.0, 5.902093684407797, 8.828688191489363, 5.778584669117648, 4.73089027173913, 2.353890149147727, 0.0), # 51 (4.651634942455243, 9.4223325, 7.0762173188405795, 3.84940385620915, 2.2025951773049646, 0.0, 5.849107442112278, 8.810380709219858, 5.774105784313726, 4.717478212560386, 2.355583125, 0.0), # 52 (4.658334007352941, 9.428950880681818, 7.055450208333333, 3.8463060702614382, 2.1978514982269504, 0.0, 5.794830651340996, 8.791405992907801, 5.769459105392158, 4.703633472222222, 2.3572377201704544, 0.0), # 53 (4.6649056265984665, 9.435414545454544, 7.034059565217391, 3.843098823529412, 2.192945106382979, 0.0, 5.739350374812594, 8.771780425531915, 5.764648235294119, 4.689373043478261, 2.358853636363636, 0.0), # 54 (4.671354499680307, 9.441722301136364, 7.012070878623187, 3.8397845179738566, 2.1878800975177306, 0.0, 5.682753675245711, 8.751520390070922, 5.759676776960785, 4.674713919082125, 2.360430575284091, 0.0), # 55 (4.677685326086957, 9.447872954545453, 6.989509637681159, 3.8363655555555556, 2.1826605673758865, 0.0, 5.625127615358988, 8.730642269503546, 5.754548333333334, 4.65967309178744, 2.361968238636363, 0.0), # 56 (4.683902805306906, 9.453865312500001, 6.966401331521738, 3.832844338235294, 2.1772906117021273, 0.0, 5.566559257871065, 8.70916244680851, 5.749266507352941, 4.644267554347826, 2.3634663281250003, 0.0), # 57 (4.690011636828645, 9.459698181818181, 6.942771449275362, 3.8292232679738563, 2.1717743262411346, 0.0, 5.507135665500583, 8.687097304964539, 5.743834901960785, 4.628514299516908, 2.3649245454545453, 0.0), # 58 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59 ) passenger_allighting_rate = ( (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 0 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 1 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 2 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 3 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 4 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 5 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 6 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 7 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 8 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 9 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 10 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 11 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 12 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 13 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 14 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 15 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 16 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 17 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 18 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 19 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 20 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 21 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 22 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 23 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 24 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 25 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 26 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 27 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 28 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 29 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 30 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 31 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 32 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 33 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 34 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 35 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 36 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 37 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 38 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 39 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 40 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 41 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 42 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 43 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 44 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 45 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 46 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 47 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 48 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 49 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 50 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 51 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 52 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 53 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 54 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 55 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 56 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 57 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 58 (0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 59 ) """ parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html """ #initial entropy entropy = 258194110137029475889902652135037600173 #index for seed sequence child child_seed_index = ( 1, # 0 17, # 1 )
""" Copyright 2020 Skyscanner Ltd 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. """ class ARN(object): def __init__( self, full, partition=None, service=None, region=None, account_id=None, resource_type=None, resource=None, ): self.full = full self.partition = partition self.service = service self.region = region self.account_id = account_id self.resource_type = resource_type self.resource = resource def to_dict(self): return { "full": self.full, "partition": self.partition, "service": self.service, "region": self.region, "account_id": self.account_id, "resource_type": self.resource_type, "resource": self.resource, } def empty_str_to_none(str_): if str_ == "": return None return str_ def arnparse(arn_str): # https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html if not arn_str.startswith("arn:") or len(arn_str.split(":")) < 4: raise ValueError("Invalid ARN format: {}".format(arn_str)) elements = arn_str.split(":", 5) elements += [""] * (6 - len(elements)) resource = elements[5].split("/")[-1] resource_type = None service = elements[2] if service == "execute-api": service = "apigateway" if service == "iam": resource_type = "/".join(elements[5].split("/")[:-1]) # role type elif service == "sts": res = elements[5].split("/") if len(res) > 1: resource_type = res[0] # assumed-role resource = res[1] # group elif service == "dynamodb": resource_type = elements[5].split("/")[0] # table resource = elements[5].split("/")[1] # table name elif service == "s3": if len(elements[5].split("/")) > 1: resource_type = elements[5].split("/", 1)[1] # objects resource = elements[5].split("/")[0] # bucket name elif service == "kms": resource_type = elements[5].split("/")[0] elif service == "logs": resource_type = elements[5].split(":")[0] resource = ":".join(elements[5].split(":")[1:]) elif service == "apigateway": resource_type, *resource = elements[5].split("/") resource = "/".join(resource) elif "/" in resource: resource_type, resource = resource.split("/", 1) elif ":" in resource: resource_type, resource = resource.split(":", 1) return ARN( full=arn_str, partition=elements[1], service=service, region=empty_str_to_none(elements[3]), account_id=empty_str_to_none(elements[4]), resource_type=resource_type, resource=resource, )
""" Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself. For example, Given "egg", "add", return true. Given "foo", "bar", return false. Given "paper", "title", return true. Note: You may assume both s and t have the same length. """ __author__ = 'Daniel' class Solution: def isIsomorphic(self, s, t): """ :param s: :param t: :rtype: bool """ m = {} mapped = set() # case "ab", "aa" for i in xrange(len(s)): if s[i] not in m and t[i] not in mapped: m[s[i]] = t[i] mapped.add(t[i]) elif s[i] in m and m[s[i]] == t[i]: pass else: return False return True
# Searvice Check Config #### Global DOMAIN = 'TEAM' ### HTTP HTTP_PAGES = [ { 'url':'', 'expected':'index.html', 'tolerance': 0.05 }, ] ### HTTPS HTTPS_PAGES = [ { 'url':'', 'expected':'index.html', 'tolerance': 0.05 }, ] ### DNS DNS_QUERIES = [ { 'type':'A', 'query':'team.local', 'expected':'216.239.32.10' }, ] ### FTP FTP_FILES = [ { 'path':'/testfile.txt', 'checksum':'12345ABCDEF' }, ] ### SMB SMB_FILES = [ { 'sharename':'ftproot', 'path':'/index.html', 'checksum':'83e503650ffd301b55538ea896afbcedea0c79c2' }, ] ### MSSQL MSSQL_QUERIES = [ { 'db': 'employee_data', 'query': 'SELECT SSN FROM dbo.hr_info WHERE LastName LIKE \'Erikson\'', 'response': '122751924' }, ] ### MYSQL MYSQL_QUERIES = [ { 'db': 'mysql', 'query': 'SELECT password FROM user WHERE user=\'root\' AND host=\'localhost\'', 'response': '*9CFBBC772F3F6C106020035386DA5BBBF1249A11' } ] ### SMTP SMTP_ADDRESSES = [ '[email protected]', '[email protected]', ] ### LDAP LDAP_QUERIES = [ { 'dn': '%[email protected]', 'base': 'cn=users,dc=team,dc=vnet', 'filter':'(&(objectClass=*)(cn=Administrator))', 'attributes':['sAMAccountName'], 'expected':{'sAMAccountName': ['Administrator']} }, ] # Services Config SERVICES = [ { 'name':'http', 'subnet_host':'152', 'port':80, 'plugin':'http' }, { 'name':'ssh', 'subnet_host':'152', 'port':22, 'plugin':'ssh' }, { 'name':'dns', 'subnet_host':'152', 'port':53, 'plugin':'dns' }, { 'name':'imap', 'subnet_host':'152', 'port':143, 'plugin':'imap' }, { 'name':'pop', 'subnet_host':'152', 'port':110, 'plugin':'pop' }, { 'name':'smtp', 'subnet_host':'152', 'port':25, 'plugin':'smtp' }, { 'name':'ldap', 'subnet_host':'134', 'port':389, 'plugin':'ldap' }, { 'name':'ftp', 'subnet_host':'152', 'port':21, 'plugin':'ftp' }, { 'name':'mssql', 'subnet_host':'152', 'port':3308, 'plugin':'mssql' }, { 'name':'mysql', 'subnet_host':'152', 'port':3309, 'plugin':'mysql' }, { 'name':'https', 'subnet_host':'152', 'port':443, 'plugin':'https' }, { 'name':'smb', 'subnet_host':'134', 'port':139, 'plugin':'smb' }, ] # Default Credentials Config DEFAULT_CREDS = [ { 'username':'joe', 'password':'toor', 'services':['http', 'ssh', 'dns', 'imap', 'pop', 'smtp', 'ftp', 'mssql', 'mysql', 'https'] }, { 'username':'nic', 'password':'toor', 'services':['http', 'ssh', 'dns', 'imap', 'pop', 'smtp'] }, { 'username':'Administrator', 'password':'P@ssword1', 'services':['ldap', 'smb'] }, ] # Team Config TEAMS = [ { 'name': 'Team 1', 'subnet': '192.168.1.0', 'netmask': '255.255.255.0' }, { 'name': 'Team 2', 'subnet': '192.168.2.0', 'netmask': '255.255.255.0' }, ]
class FakeTwilioMessage(object): status = 'sent' def __init__(self, price, num_segments=1): self.price = price self.num_segments = str(num_segments) def fetch(self): return self class FakeMessageFactory(object): backend_message_id_to_num_segments = {} backend_message_id_to_price = {} @classmethod def add_price_for_message(cls, backend_message_id, price): cls.backend_message_id_to_price[backend_message_id] = price @classmethod def get_price_for_message(cls, backend_message_id): return cls.backend_message_id_to_price.get(backend_message_id) @classmethod def add_num_segments_for_message(cls, backend_message_id, num_segments): cls.backend_message_id_to_num_segments[backend_message_id] = num_segments @classmethod def get_num_segments_for_message(cls, backend_message_id): return cls.backend_message_id_to_num_segments.get(backend_message_id) or 1 @classmethod def get_twilio_message(cls, backend_message_id): return FakeTwilioMessage( cls.get_price_for_message(backend_message_id) * -1, num_segments=cls.get_num_segments_for_message(backend_message_id), ) @classmethod def get_infobip_message(cls, backend_message_id): return { 'messageCount': cls.get_num_segments_for_message(backend_message_id), 'status': { 'name': 'sent' }, 'price': { 'pricePerMessage': cls.get_price_for_message(backend_message_id) } }
class ValueNotRequired(Exception): pass class RaggedListError(Exception): pass
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"AttStats": "att_stats.ipynb", "Attribute": "attribute.ipynb", "Data": "data.ipynb", "DataScrambler": "data_scrambler.ipynb", "configuration": "data_scrambler.ipynb", "EntropyEvaluator": "entropy_evaluator.ipynb", "Instance": "instance.ipynb", "ParseException": "parse_exception.ipynb", "Reading": "reading.ipynb", "ToHMLDemo": "to_HML_demo.ipynb", "Tree": "tree.ipynb", "Condition": "tree.ipynb", "TreeEdge": "tree_edge.ipynb", "TreeEvaluator": "tree_evaluator.ipynb", "BenchmarkResult": "tree_evaluator.ipynb", "Prediction": "tree_evaluator.ipynb", "Stats": "tree_evaluator.ipynb", "TreeNode": "tree_node.ipynb", "UId3": "uId3.ipynb", "UncertainEntropyEvaluator": "uncertain_entropy_evaluator.ipynb", "Value": "value.ipynb"} modules = ["att_stats.py", "attribute.py", "data.py", "data_scrambler.py", "entropy_evaluator.py", "instance.py", "parse_exception.py", "reading.py", "to_hml_demo.py", "tree.py", "tree_edge.py", "tree_evaluator.py", "tree_node.py", "uid3.py", "uncertain_entropy_evaluator.py", "value.py"] doc_url = "https://anetakaczynska.github.io/uid3/" git_url = "https://github.com/anetakaczynska/uid3/tree/master/" def custom_doc_links(name): return None
# -*- coding: utf-8 -*- """ __title__ = '' __author__ = xiongliff __mtime__ = '2019/7/20' """
# fixing the issue in food.py # this is kind of a bug, thats not what we wanted # this can be done by making the class variable an instance variable class Food: def __init__(self, name): self.name = name # instance variable (attr) self.fav_food = [] # class variable fix by making inst var def set_fav_food(self, food: str): self.fav_food.append(food) person_a = Food('jerry') person_a.set_fav_food('rice and pancake') # person_a can access its own fav_food print(person_a.fav_food) person_b = Food('Lee') person_b.set_fav_food('roated groundnut and catchup') print(person_b.fav_food) # when you check the output, you realise that the second instance doesn't modifies # the fav_food variable
''' People module for the Derrida project. It provides basic personography, VIAF lookup, and admin functionality to edit people associated with Derrida's library. ''' default_app_config = 'derrida.people.apps.PeopleConfig'
""" =============== === Purpose === =============== Encodes the hierarchy of US political divisions. This file, together with populations.py, replaces the static data portion of state_info.py. The location names used in this file match FluView names as specified in fluview_locations.py of delphi-epidata. =================== === Explanation === =================== Although intended to be a more or less general-purpose description of the various US geopolitical divisions, for all practical purposes the data in this file corresponds to the FluView perspective of the world. In this perspective, the US is a hierarchy where regions at any given level are composed of smaller regions at a lower level. Notably, it may be possible to subdivide a given region into multiple distinct sets of smaller regions. However, the set of locations in any given subdivision fully covers and spans the region being subdivided. In other words, there are never any gaps. The root of the hierarchy is the national region (shortened to "nat") which represents the entire US, including many of its territories. Each lower layer of the hierarchy consists of smaller regions which combine together to form the national region. The leaves of the hierarchy are called "atoms" and have no further subdivisions -- at least, not from a FluView perspective. These are typically US states, although they also include some state fragments, territories, and cities. By convention, the the middle layers of the hierarchy are collectively called "regions". This includes, for example, the ten HHS regions as one subdivision of national and the nine Census divisions as another. Each of the HHS and Census regions is in turn made up of atoms -- mostly states, with a few exceptions. """ class Locations: """Encodes the hierarchy of US political divisions.""" # atomic regions for FluView data (regions containing only themselves) atom_list = [ # entire states 'ak', 'al', 'ar', 'az', 'ca', 'co', 'ct', 'de', 'fl', 'ga', 'hi', 'ia', 'id', 'il', 'in', 'ks', 'ky', 'la', 'ma', 'md', 'me', 'mi', 'mn', 'mo', 'ms', 'mt', 'nc', 'nd', 'ne', 'nh', 'nj', 'nm', 'nv', 'oh', 'ok', 'or', 'pa', 'ri', 'sc', 'sd', 'tn', 'tx', 'ut', 'va', 'vt', 'wa', 'wi', 'wv', 'wy', # state fragments 'ny_minus_jfk', # territories 'dc', 'pr', 'vi', # cities 'jfk', ] atom_map = {a: [a] for a in atom_list} # national, HHS, and Census regions in terms of atoms nat_list = ['nat'] nat_map = dict(zip(nat_list, [atom_list])) hhs_list = ['hhs%d' % i for i in range(1, 11)] hhs_map = dict(zip(hhs_list, [ ['ct', 'ma', 'me', 'nh', 'ri', 'vt'], ['jfk', 'nj', 'ny_minus_jfk', 'pr', 'vi'], ['dc', 'de', 'md', 'pa', 'va', 'wv'], ['al', 'fl', 'ga', 'ky', 'ms', 'nc', 'sc', 'tn'], ['il', 'in', 'mi', 'mn', 'oh', 'wi'], ['ar', 'la', 'nm', 'ok', 'tx'], ['ia', 'ks', 'mo', 'ne'], ['co', 'mt', 'nd', 'sd', 'ut', 'wy'], ['az', 'ca', 'hi', 'nv'], ['ak', 'id', 'or', 'wa'], ])) cen_list = ['cen%d' % i for i in range(1, 10)] cen_map = dict(zip(cen_list, [ ['ct', 'ma', 'me', 'nh', 'ri', 'vt'], ['jfk', 'nj', 'ny_minus_jfk', 'pa', 'pr', 'vi'], ['il', 'in', 'mi', 'oh', 'wi'], ['ia', 'ks', 'mn', 'mo', 'nd', 'ne', 'sd'], ['dc', 'de', 'fl', 'ga', 'md', 'nc', 'sc', 'va', 'wv'], ['al', 'ky', 'ms', 'tn'], ['ar', 'la', 'ok', 'tx'], ['az', 'co', 'id', 'mt', 'nm', 'nv', 'ut', 'wy'], ['ak', 'ca', 'hi', 'or', 'wa'], ])) # New York state combines the "ny_minus_jfk" fragment with the "jfk" city ny_state_list = ['ny'] ny_state_map = {ny_state_list[0]: ['jfk', 'ny_minus_jfk']} # collections of all known locations region_list = nat_list + hhs_list + cen_list + ny_state_list + atom_list region_map = {} region_map.update(nat_map) region_map.update(hhs_map) region_map.update(cen_map) region_map.update(ny_state_map) region_map.update(atom_map)
def calc_size(digest_size, seed_size, num_rounds, lowmc_k, lowmc_r, lowmc_m, is_unruh): lowmc_n = lowmc_k # bytes required to store one input share input_size = (lowmc_k + 7) >> 3; # bytes required to store one output share output_size = (lowmc_n + 7) >> 3; # number of bits per view per LowMC round view_round_size = lowmc_m * 3; # bytes required to store communicated bits (i.e. views) of one round view_size = (view_round_size * lowmc_r + 7) >> 3; # bytes required to store collapsed challenge collapsed_challenge_size = (num_rounds + 3) >> 2; if is_unruh: unruh_without_input_bytes_size = seed_size + view_size; unruh_with_input_bytes_size = unruh_without_input_bytes_size + input_size; else: unruh_without_input_bytes_size = unruh_with_input_bytes_size = 0; # we can use unruh_without_input_bytes_size here. In call cases where we need # to write more, we do not need to write the input share per_round_size = input_size + view_size + digest_size + 2 * seed_size + unruh_without_input_bytes_size; max_signature_size = collapsed_challenge_size + 32 + num_rounds * per_round_size; print(unruh_without_input_bytes_size, unruh_with_input_bytes_size, max_signature_size) # Picnic with partial Sbox layer calc_size(32, 16, 219, 128, 20, 10, False) calc_size(32, 16, 219, 128, 20, 10, True) calc_size(48, 24, 329, 192, 30, 10, False) calc_size(48, 24, 329, 192, 30, 10, True) calc_size(64, 32, 438, 256, 38, 10, False) calc_size(64, 32, 438, 256, 38, 10, True) # Picnic with full Sbox layer calc_size(32, 16, 219, 129, 4, 43, False) calc_size(48, 24, 329, 192, 4, 64, False) calc_size(64, 32, 438, 255, 4, 85, False)
# -*- coding: utf-8 -*- class dllink: """doubly linked node (that may also be a "head" a list) A Doubly-linked List class. This class simply contains a link of node's. By adding a "head" node (sentinel), deleting a node is extremely fast (see "Introduction to Algorithm"). This class does not keep the length information as it is not necessary for the FM algorithm. This saves memory and run-time to update the length information. Note that this class does not own the list node. They are supplied by the caller in order to better reuse the nodes. """ __slots__ = ('key', 'next', 'prev', 'index') def __init__(self, index=None): """initialization Keyword Arguments: index (type): description (default: {None}) """ self.key = 0 self.next = self.prev = self self.index = index def detach(self): """detach from a list """ assert self.next n = self.next p = self.prev p.next = n n.prev = p def lock(self): """lock the node (and don't append it to any list) """ self.next = None def is_locked(self): """whether the node is locked Returns: bool: description """ return self.next is None def is_empty(self): """whether the list is empty Returns: bool: description """ return self.next == self def clear(self): """clear""" self.next = self.prev = self def appendleft(self, node): """append the node to the front Arguments: node (dllink): description """ node.next = self.next self.next.prev = node self.next = node node.prev = self def append(self, node): """append the node to the back Arguments: node (dllink): description """ node.prev = self.prev self.prev.next = node self.prev = node node.next = self def popleft(self): """pop a node from the front Returns: dllink: description """ res = self.next self.next = res.next self.next.prev = self return res def pop(self): """pop a node from the back Returns: dllink: description """ res = self.prev self.prev = res.prev self.prev.next = self return res def __iter__(self): """iterable Returns: dllink: itself """ cur = self.next while cur != self: yield cur cur = cur.next # class dll_iterator: # """List iterator # Traverse the list from the first item. Usually it is safe # to attach/detach list items during the iterator is active. # """ # def __init__(self, link): # """Initialization # Arguments: # link (dllink): description # """ # self.link = link # self.cur = link.next # def next(self): # """Get the next item # Raises: # StopIteration: description # Returns: # dllink: the next item # """ # if self.cur != self.link: # res = self.cur # self.cur = self.cur.next # return res # else: # raise StopIteration # def __next__(self): # """[summary] # Returns: # dtype: description # """ # return self.next()
"""Internal API endpoint constant library. _______ __ _______ __ __ __ | _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----. |. 1___| _| _ | | | | _ | 1___| _| _| | <| -__| |. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____| |: 1 | |: 1 | |::.. . | CROWDSTRIKE FALCON |::.. . | FalconPy `-------' `-------' OAuth2 API - Customer SDK This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <https://unlicense.org> """ _firewall_policies_endpoints = [ [ "queryCombinedFirewallPolicyMembers", "GET", "/policy/combined/firewall-members/v1", "Search for members of a Firewall Policy in your environment by providing an FQL " "filter and paging details. Returns a set of host details which match the filter criteria", "firewall_policies", [ { "type": "string", "description": "The ID of the Firewall Policy to search for members of", "name": "id", "in": "query" }, { "type": "string", "description": "The filter expression that should be used to limit the results", "name": "filter", "in": "query" }, { "minimum": 0, "type": "integer", "description": "The offset to start retrieving records from", "name": "offset", "in": "query" }, { "maximum": 5000, "minimum": 1, "type": "integer", "description": "The maximum records to return. [1-5000]", "name": "limit", "in": "query" }, { "type": "string", "description": "The property to sort by", "name": "sort", "in": "query" } ] ], [ "queryCombinedFirewallPolicies", "GET", "/policy/combined/firewall/v1", "Search for Firewall Policies in your environment by providing an FQL filter and paging details. " "Returns a set of Firewall Policies which match the filter criteria", "firewall_policies", [ { "type": "string", "description": "The filter expression that should be used to limit the results", "name": "filter", "in": "query" }, { "minimum": 0, "type": "integer", "description": "The offset to start retrieving records from", "name": "offset", "in": "query" }, { "maximum": 5000, "minimum": 1, "type": "integer", "description": "The maximum records to return. [1-5000]", "name": "limit", "in": "query" }, { "enum": [ "created_by.asc", "created_by.desc", "created_timestamp.asc", "created_timestamp.desc", "enabled.asc", "enabled.desc", "modified_by.asc", "modified_by.desc", "modified_timestamp.asc", "modified_timestamp.desc", "name.asc", "name.desc", "platform_name.asc", "platform_name.desc", "precedence.asc", "precedence.desc" ], "type": "string", "description": "The property to sort by", "name": "sort", "in": "query" } ] ], [ "performFirewallPoliciesAction", "POST", "/policy/entities/firewall-actions/v1", "Perform the specified action on the Firewall Policies specified in the request", "firewall_policies", [ { "enum": [ "add-host-group", "disable", "enable", "remove-host-group" ], "type": "string", "description": "The action to perform", "name": "action_name", "in": "query", "required": True }, { "name": "body", "in": "body", "required": True } ] ], [ "setFirewallPoliciesPrecedence", "POST", "/policy/entities/firewall-precedence/v1", "Sets the precedence of Firewall Policies based on the order of IDs specified in the request. " "The first ID specified will have the highest precedence and the last ID specified will have the lowest. " "You must specify all non-Default Policies for a platform when updating precedence", "firewall_policies", [ { "name": "body", "in": "body", "required": True } ] ], [ "getFirewallPolicies", "GET", "/policy/entities/firewall/v1", "Retrieve a set of Firewall Policies by specifying their IDs", "firewall_policies", [ { "type": "array", "items": { "maxLength": 32, "minLength": 32, "type": "string" }, "collectionFormat": "multi", "description": "The IDs of the Firewall Policies to return", "name": "ids", "in": "query", "required": True } ] ], [ "createFirewallPolicies", "POST", "/policy/entities/firewall/v1", "Create Firewall Policies by specifying details about the policy to create", "firewall_policies", [ { "name": "body", "in": "body", "required": True }, { "maxLength": 32, "minLength": 32, "type": "string", "description": "The policy ID to be cloned from", "name": "clone_id", "in": "query" } ] ], [ "updateFirewallPolicies", "PATCH", "/policy/entities/firewall/v1", "Update Firewall Policies by specifying the ID of the policy and details to update", "firewall_policies", [ { "name": "body", "in": "body", "required": True } ] ], [ "deleteFirewallPolicies", "DELETE", "/policy/entities/firewall/v1", "Delete a set of Firewall Policies by specifying their IDs", "firewall_policies", [ { "type": "array", "items": { "maxLength": 32, "minLength": 32, "type": "string" }, "collectionFormat": "multi", "description": "The IDs of the Firewall Policies to delete", "name": "ids", "in": "query", "required": True } ] ], [ "queryFirewallPolicyMembers", "GET", "/policy/queries/firewall-members/v1", "Search for members of a Firewall Policy in your environment by providing an FQL filter and paging details. " "Returns a set of Agent IDs which match the filter criteria", "firewall_policies", [ { "type": "string", "description": "The ID of the Firewall Policy to search for members of", "name": "id", "in": "query" }, { "type": "string", "description": "The filter expression that should be used to limit the results", "name": "filter", "in": "query" }, { "minimum": 0, "type": "integer", "description": "The offset to start retrieving records from", "name": "offset", "in": "query" }, { "maximum": 5000, "minimum": 1, "type": "integer", "description": "The maximum records to return. [1-5000]", "name": "limit", "in": "query" }, { "type": "string", "description": "The property to sort by", "name": "sort", "in": "query" } ] ], [ "queryFirewallPolicies", "GET", "/policy/queries/firewall/v1", "Search for Firewall Policies in your environment by providing an FQL filter and paging details. " "Returns a set of Firewall Policy IDs which match the filter criteria", "firewall_policies", [ { "type": "string", "description": "The filter expression that should be used to limit the results", "name": "filter", "in": "query" }, { "minimum": 0, "type": "integer", "description": "The offset to start retrieving records from", "name": "offset", "in": "query" }, { "maximum": 5000, "minimum": 1, "type": "integer", "description": "The maximum records to return. [1-5000]", "name": "limit", "in": "query" }, { "enum": [ "created_by.asc", "created_by.desc", "created_timestamp.asc", "created_timestamp.desc", "enabled.asc", "enabled.desc", "modified_by.asc", "modified_by.desc", "modified_timestamp.asc", "modified_timestamp.desc", "name.asc", "name.desc", "platform_name.asc", "platform_name.desc", "precedence.asc", "precedence.desc" ], "type": "string", "description": "The property to sort by", "name": "sort", "in": "query" } ] ] ]
def visit_rate_ate(df, test_set=False): if test_set: treatment_visit_rate = df[df.Treatment == 1].Outcome.mean() * 100 control_visit_rate = df[df.Treatment == 0].Outcome.mean() * 100 average_treatment_effect = treatment_visit_rate - control_visit_rate print("Test set visit rate uplift: {:.2f}%".format(average_treatment_effect)) return average_treatment_effect else: mens = df[df.segment == "Mens E-Mail"].visit.mean() * 100 womens = df[df.segment == "Womens E-Mail"].visit.mean() * 100 control = df[df.segment == "No E-Mail"].visit.mean() * 100 print("Men's E-Mail visit rate: {:.2f}%".format(mens)) print("Women's E-Mail visit rate: {:.2f}%".format(womens)) print("Control E-mail visit Rate: {:.2f}%".format(control)) print("---------------------------------") print("Men's visit rate uplift: {:.2f}%".format(mens - control)) print("Women's visit rate uplift: {:.2f}%".format(womens - control)) def conversion_rate_ate(df): mens = df[df.segment == "Mens E-Mail"].conversion.mean() * 100 womens = df[df.segment == "Womens E-Mail"].conversion.mean() * 100 control = df[df.segment == "No E-Mail"].conversion.mean() * 100 print("Men's E-Mail conversion rate: {:.2f}%".format(mens)) print("Women's E-Mail conversion rate: {:.2f}%".format(womens)) print("Control E-mail conversion Rate: {:.2f}%".format(control)) print("---------------------------------") print("Men's conversion rate uplift: {:.2f}%".format(mens - control)) print("Women's conversion rate uplift: {:.2f}%".format(womens - control)) def spending_ate(df): mens = df[df.segment == "Mens E-Mail"].spend.mean() womens = df[df.segment == "Womens E-Mail"].spend.mean() control = df[df.segment == "No E-Mail"].spend.mean() print("Men's E-Mail spending: ${:.2f}".format(mens)) print("Women's E-Mail spending: ${:.2f}".format(womens)) print("Control E-mail spending: ${:.2f}".format(control)) print("---------------------------------") print("Men's spending uplift: ${:.2f}".format(mens - control)) print("Women's spending uplift: ${:.2f}".format(womens - control)) def spend_given_purchase(df): print("Men's average spend given purchase: ${:.2f}".format( df[(df.conversion == 1) & (df.segment == 'Mens E-Mail')].spend.mean())) print("Women's average spend given purchase: ${:.2f}".format( df[(df.conversion == 1) & (df.segment == 'Womens E-Mail')].spend.mean())) print("Control average spend given purchase: ${:.2f}".format( df[(df.conversion == 1) & (df.segment == 'No E-Mail')].spend.mean())) def purchase_given_visit(df): print("Men's purchase rate given visit: {:.2f}%".format(100 * ( len(df[(df.conversion == 1) & (df.segment == 'Mens E-Mail')]) / len( df[(df.visit == 1) & (df.segment == 'Mens E-Mail')])))) print("Women's purchase rate given visit: {:.2f}%".format(100 * ( len(df[(df.conversion == 1) & (df.segment == 'Womens E-Mail')]) / len( df[(df.visit == 1) & (df.segment == 'Womens E-Mail')])))) print("Control purchase rate given visit: {:.2f}%".format(100 * ( len(df[(df.conversion == 1) & (df.segment == 'No E-Mail')]) / len( df[(df.visit == 1) & (df.segment == 'No E-Mail')])))) def visit_rate(df): print("Men's visit rate: {:.2f}%".format( 100 * (len(df[(df.visit == 1) & (df.segment == 'Mens E-Mail')]) / len(df[(df.segment == 'Mens E-Mail')])))) print("Women's visit rate: {:.2f}%".format( 100 * (len(df[(df.visit == 1) & (df.segment == 'Womens E-Mail')]) / len(df[(df.segment == 'Womens E-Mail')])))) print("Control visit rate: {:.2f}%".format( 100 * (len(df[(df.visit == 1) & (df.segment == 'No E-Mail')]) / len(df[(df.segment == 'No E-Mail')])))) def spend_per_head(df): print("Men's mean spend: ${:.2f}".format(df[(df.segment == 'Mens E-Mail')].spend.mean())) print("Women's mean spend: ${:.2f}".format(df[(df.segment == 'Womens E-Mail')].spend.mean())) print("Control mean spend: ${:.2f}".format(df[(df.segment == 'No E-Mail')].spend.mean()))
__all__ = [ 'provider', 'songObj', 'spotifyClient', 'utils' ] #! You should be able to do all you want with just theese three lines #! from spotdl.search.spotifyClient import initialize #! from spotdl.search.songObj import songObj #! from spotdl.search.utils import *
class Registry: def __init__(self, name): self._name = name self._registry_dict = dict() def register(self, name=None, obj=None): if obj is not None: if name is None: name = obj.__name__ return self._register(obj, name) return self._decorate(name) def get(self, name): if name not in self._registry_dict: self._key_not_found(name) return self._registry_dict[name] def _register(self, obj, name): if name in self._registry_dict: raise KeyError("{} is already registered in {}".format(name, self._name)) self._registry_dict[name] = obj def _decorate(self, name=None): def wrap(obj): cls_name = name if cls_name is None: cls_name = obj.__name__ self._register(obj, cls_name) return obj return wrap def _key_not_found(self, name): raise KeyError("{} is unknown type of {} ".format(name, self._name)) @property def registry_dict(self): return self._registry_dict
#!/usr/bin/env python3 """RZFeeser | Alta3 Research learning about for logic""" # create list of dictionaries for farms farms = [{"name": "NE Farm", "agriculture": ["sheep", "cows", "pigs", "chickens", "llamas", "cats"]}, {"name": "W Farm", "agriculture": ["pigs", "chickens", "llamas"]}, {"name": "SE Farm", "agriculture": ["chickens", "carrots", "celery"]}] for farm in farms: print("\n" + farm.get("name"), end = ":\n") for agri in farm.get("agriculture"): print(agri, end = ", ") print("END OF FARM")
def findRoot(x, power, epsilon): """Assumes x and epsilon an int or float, power an int, epsilon > 0 & power >= 1 Returns float y such that y**power is within epsilon of x. If such float does not exist, it returns None""" if x < 0 and power%2 ==0: return None #since negative numbers have no even-powered roots low = min(-1.0,x) high = max(1.0,x) ans = (high + low)/2.0 while abs(ans**power-x) >= epsilon: if ans**power < x: low = ans else: high = ans ans = (high + low)/2.0 return ans def testFindRoot(): epsilon = 0.0001 for x in [-0.25, 0.25, 2, -2, 8, -8]: for power in range(1,4): print('Testing x = ', str(x), ' and power = ', power) result = findRoot(x, power, epsilon) if result == None: print(' No root') else: print(' ', result**power, ' = ', x)
def dobro(n): return n * 2 def metade(n): return n / 2 def aumentar(n): return n + (10 / 100 * n) def diminuir(n): return n - (13 / 100 * n)
g = [ (['p'],[('cat','wff')]), (['q'],[('cat','wff')]), (['r'],[('cat','wff')]), (['s'],[('cat','wff')]), (['t'],[('cat','wff')]), (['not'],[('sel','wff'),('cat','wff')]), (['and'],[('sel','wff'),('sel','wff'),('cat','wff')]), (['or'],[('sel','wff'),('sel','wff'),('cat','wff')]), (['implies'],[('sel','wff'),('sel','wff'),('cat','wff')]) ]
def f(n, c=1): print(c) if c == n: return c f(n, c+1) f(12)
MD_HEADER = """\ # Changelog """ MD_ENTRY = """\ ## {version} [PR #{pr_number}]({pr_url}): {summary} (thanks [{committer}]({committer_url})) """ RST_HEADER = """\ Changelog ========= """ RST_ENTRY = """\ {version} ------------------------------------------------- `PR #{pr_number} <{pr_url}>`__: {summary} (thanks `{committer} <{committer_url}>`__) """ TEMPLATES = {".md": (MD_HEADER, MD_ENTRY), ".rst": (RST_HEADER, RST_ENTRY)} def update(current_changelog, path_extension, version, pr_event): """Update the changelog based on a merged pull request.""" header, entry_template = TEMPLATES[path_extension.lower()] if current_changelog.strip() and not current_changelog.startswith(header): raise ValueError("Changelog has a non-standard header") details = { "version": version, "pr_number": pr_event["number"], "pr_url": pr_event["html_url"], "summary": pr_event["title"], "committer": pr_event["user"]["login"], "committer_url": pr_event["user"]["html_url"], } entry = entry_template.format_map(details) changelog_no_header = current_changelog[len(header) :] changelog = f"{header.strip()}\n\n{entry.strip()}\n\n{changelog_no_header.strip()}" return f"{changelog.strip()}\n" # Guarantee a single trailing newline.
nop = b'\x00\x00' brk = b'\x00\xA0' lde = b'\x63\x07' # Load 0x07 (character 'a') into register V3 skp = b'\xE3\xA1' # Skip next instruction if user is NOT pressing character held in V3 with open("sknpvxtest.bin", 'wb') as f: f.write(lde) # 0x0200 <-- Load the byte 0x07 into register V3 f.write(brk) # 0x0202 <-- Wait here until we receive the go signal (we should get some characters on the mockinput pipe before here) f.write(skp) # 0x0204 <-- Now we should read the input pipe and check it for 'a' f.write(brk) # 0x0206 <-- If it worked, we should skip this breakpoint. f.write(nop) # 0x0208 <-- NOP a few times for good measure... f.write(nop) # 0x020A f.write(brk) # 0x020C <-- Stop here until we check the PC (which should be here, not at 0x0206) and get a character over the pipe. f.write(skp) # 0x020E <-- Now we should read the input pipe and check it for 'a' f.write(brk) # 0x0210 <-- If it worked, we should break here. f.write(brk) # 0x0212 <-- If it didn't work, we will break here... or at one of the following breakpoints. f.write(brk) # 0x0214 f.write(brk) # 0x0216
load("@bazel_skylib//rules:run_binary.bzl", "run_binary") load("@rules_cc//cc:defs.bzl", "cc_library") def rust_cxx_bridge(name, src, deps = []): native.alias( name = "%s/header" % name, actual = src + ".h", ) native.alias( name = "%s/source" % name, actual = src + ".cc", ) run_binary( name = "%s/generated" % name, srcs = [src], outs = [ src + ".h", src + ".cc", ], args = [ "$(location %s)" % src, "-o", "$(location %s.h)" % src, "-o", "$(location %s.cc)" % src, ], tool = "//:codegen", ) cc_library( name = name, srcs = [src + ".cc"], deps = deps + [":%s/include" % name], ) cc_library( name = "%s/include" % name, hdrs = [src + ".h"], )
# Miho Damage Skin success = sm.addDamageSkin(2436044) if success: sm.chat("The Miho Damage Skin has been added to your account's damage skin collection.") sm.consumeItem(2436044)
#!/usr/bin/python3 def lie_bracket(f, g, q): """Take the Lie bracket of two vector fields. [f, g] = (d/dq)f * g - (d/dq)g * f Args: f (sympy.matrix): an N x 1 symbolic vector g (sympy.matrix): an N x 1 symbolic q (sympy.matrix or List): a length N array like object of coordinates to take partial derivates. Returns: [f, g] (sympy.matrix): the Lie bracket of f and g, an N x 1 symbolic vector """ assert f.shape == g.shape, "The f and g vectors must be the same dimension." assert len(f) == len(q), "The vector field must represent all the coordinates." return f.jacobian(q) @ g - g.jacobian(q) @ f
""" 873. Length of Longest Fibonacci Subsequence A sequence X_1, X_2, ..., X_n is fibonacci-like if: n >= 3 X_i + X_{i+1} = X_{i+2} for all i + 2 <= n Given a strictly increasing array A of positive integers forming a sequence, find the length of the longest fibonacci-like subsequence of A. If one does not exist, return 0. (Recall that a subsequence is derived from another sequence A by deleting any number of elements (including none) from A, without changing the order of the remaining elements. For example, [3, 5, 8] is a subsequence of [3, 4, 5, 6, 7, 8].) Example 1: Input: [1,2,3,4,5,6,7,8] Output: 5 Explanation: The longest subsequence that is fibonacci-like: [1,2,3,5,8]. Example 2: Input: [1,3,7,11,12,14,18] Output: 3 Explanation: The longest subsequence that is fibonacci-like: [1,11,12], [3,11,14] or [7,11,18]. Note: 3 <= A.length <= 1000 1 <= A[0] < A[1] < ... < A[A.length - 1] <= 10^9 (The time limit has been reduced by 50% for submissions in Java, C, and C++.) """ class Solution(object): def lenLongestFibSubseq(self, A): s = set(A) n = len(A) result = 0 for i in range(n-1): for j in range(i+1,n): a, b = A[i], A[j] count = 2 while a+b in s: a, b = b, a+b count +=1 result = max(result, count) return result if result >2 else 0
DOCKER_IMAGES = { "cpu": { "tensorflow": "ritazh/azk8sml-tensorflow:latest", }, "gpu": { "tensorflow": "ritazh/azk8sml-tensorflow:latest-gpu", } } DEFAULT_DOCKER_IMAGE = "ritazh/azk8sml-tensorflow:latest" DEFAULT_ARCH = "cpu"
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. Test.Summary = ''' Test remap_stats plugin ''' # Skip if plugins not present. Test.SkipUnless(Condition.PluginExists('remap_stats.so')) Test.SkipIf(Condition.true("Test cannot deterministically wait until the stats appear")) server = Test.MakeOriginServer("server") request_header = { "headers": "GET /argh HTTP/1.1\r\nHost: one\r\n\r\n", "timestamp": "1469733493.993", "body": ""} response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""} server.addResponse("sessionlog.json", request_header, response_header) ts = Test.MakeATSProcess("ts", command="traffic_manager", select_ports=True) ts.Disk.plugin_config.AddLine('remap_stats.so') ts.Disk.remap_config.AddLine( "map http://one http://127.0.0.1:{0}".format(server.Variables.Port) ) ts.Disk.remap_config.AddLine( "map http://two http://127.0.0.1:{0}".format(server.Variables.Port) ) ts.Disk.records_config.update({ 'proxy.config.http.transaction_active_timeout_out': 2, 'proxy.config.http.transaction_no_activity_timeout_out': 2, 'proxy.config.http.connect_attempts_timeout': 2, }) # 0 Test - Curl host One tr = Test.AddTestRun("curl host one") tr.Processes.Default.StartBefore(server) tr.Processes.Default.StartBefore(Test.Processes.ts) tr.Processes.Default.Command = 'curl -o /dev/null -H "Host: one"' + ' http://127.0.0.1:{}/argh'.format(ts.Variables.port) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server # 1 Test - Curl host Two tr = Test.AddTestRun("curl host two") tr.Processes.Default.Command = 'curl -o /dev/null -H "Host: two"' + ' http://127.0.0.1:{}/badpath'.format(ts.Variables.port) tr.Processes.Default.ReturnCode = 0 tr.StillRunningAfter = ts tr.StillRunningAfter = server # 2 Test - Gather output tr = Test.AddTestRun("analyze stats") tr.Processes.Default.Command = r'traffic_ctl metric match \.\*remap_stats\*' tr.Processes.Default.Env = ts.Env tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.TimeOut = 5 tr.DelayStart = 15 tr.TimeOut = 5 tr.Processes.Default.Streams.stdout = Testers.ContainsExpression( "plugin.remap_stats.one.status_2xx 1", "expected 2xx on first remap") tr.Processes.Default.Streams.stdout += Testers.ContainsExpression( "plugin.remap_stats.two.status_4xx 1", "expected 4xx on second remap")
# This file has automatically been generated # biogeme 2.6a [Mon May 14 17:32:05 EDT 2018] # <a href='http://people.epfl.ch/michel.bierlaire'>Michel Bierlaire</a>, <a href='http://transp-or.epfl.ch'>Transport and Mobility Laboratory</a>, <a href='http://www.epfl.ch'>Ecole Polytechnique F&eacute;d&eacute;rale de Lausanne (EPFL)</a> # Mon Jun 4 13:57:03 2018</p> # ASC_CAR = Beta('ASC_CAR',-1.64275,-10,10,0,'Car cte.' ) B_COST = Beta('B_COST',-0.180929,-10,10,0,'Travel cost' ) B_TIME = Beta('B_TIME',-0.0232704,-10,10,0,'Travel time' ) B_RELIB = Beta('B_RELIB',0.0860714,-10,10,0,'Travel reliability' ) ASC_CARRENTAL = Beta('ASC_CARRENTAL',-3.43973,-10,10,0,'Car Rental cte.' ) ASC_BUS = Beta('ASC_BUS',-2.875,-10,10,0,'Bus cte.' ) ASC_PLANE = Beta('ASC_PLANE',-2.36068,-10,10,0,'Plane cte.' ) ASC_TRAIN = Beta('ASC_TRAIN',-2.0106,-10,10,0,'Train cte.' ) ASC_TRH = Beta('ASC_TRH',0,-10,10,1,'TrH cte.' ) ## Code for the sensitivity analysis names = ['ASC_BUS','ASC_CAR','ASC_CARRENTAL','ASC_PLANE','ASC_TRAIN','B_COST','B_RELIB','B_TIME'] values = [[0.0222299,0.00778935,0.00263632,-0.000888164,0.00902636,0.0024049,0.0105436,-4.32583e-05],[0.00778935,0.0199112,0.0178978,0.0215904,0.0071847,-7.05174e-05,0.00508875,0.000675359],[0.00263632,0.0178978,0.0491379,0.0305725,0.003541,-0.00235489,0.00445526,0.000886736],[-0.000888164,0.0215904,0.0305725,0.0530497,0.00189364,-0.0043733,0.00427259,0.0012203],[0.00902636,0.0071847,0.003541,0.00189364,0.0169265,0.00171577,0.00605909,5.53087e-05],[0.0024049,-7.05174e-05,-0.00235489,-0.0043733,0.00171577,0.00113907,-0.000122535,-9.52213e-05],[0.0105436,0.00508875,0.00445526,0.00427259,0.00605909,-0.000122535,0.0223307,-7.38437e-05],[-4.32583e-05,0.000675359,0.000886736,0.0012203,5.53087e-05,-9.52213e-05,-7.38437e-05,3.91556e-05]] vc = bioMatrix(8,names,values) BIOGEME_OBJECT.VARCOVAR = vc
def longest_palindromic_substring_DP(s): S = [[False for i in range(len(s))] for j in range(len(s))] max_palindrome = "" for i in range(len(s))[::-1]: for j in range(i, len(s)): S[i][j] = s[i] == s[j] and (j - i < 3 or S[i+1][j-1]) if S[i][j] and j - i + 1 > len(max_palindrome): max_palindrome = s[i:j+1] return max_palindrome def longest_palindromic_substring_expansion(s): max_palindrome = "" for i in range(len(s) * 2 - 1): if i % 2 == 0: o = 0 ind = i // 2 while ind + o < len(s) and ind - o >= 0: if(s[ind + o] != s[ind - o]): break if ind + o - (ind - o) + 1 > len(max_palindrome): max_palindrome = s[ind-o:ind+o + 1] o += 1 else: o = 0 sind = i // 2 eind = i // 2 + 1 while sind - o >= 0 and eind + o < len(s): if(s[sind - o] != s[eind + o]): break if eind + o - (sind - o) + 1 > len(max_palindrome): max_palindrome = s[sind - o:eind + o + 1] o += 1 return max_palindrome input_string = "abbbacdcaacdca" ans_DP = longest_palindromic_substring_DP(input_string) ans_expansion = longest_palindromic_substring_expansion(input_string) print("DP Solution: {}, Expansion Solution: {}".format(ans_DP, ans_expansion))
class Solution: def nthUglyNumber(self, n): ugly = [1] i2 = i3 = i5 = 0 while len(ugly) < n: while ugly[i2] * 2 <= ugly[-1]: i2 += 1 while ugly[i3] * 3 <= ugly[-1]: i3 += 1 while ugly[i5] * 5 <= ugly[-1]: i5 += 1 ugly.append(min(ugly[i2] * 2, ugly[i3] * 3, ugly[i5] * 5)) return ugly[-1]
def dividableNumberGenerator(limit, number): dividableNumbers = [] for i in range(0, limit, number): dividableNumbers.append(i) return dividableNumbers def sumDividableNumbers(dividableNumbers): sum = 0 for i in range(0, len(dividableNumbers)): sum += dividableNumbers[i] return sum print(sumDividableNumbers(dividableNumberGenerator(10000, 7) + dividableNumberGenerator(10000, 9)))
( ((1,), (), ()), ((2,), (), ()), ((1, 2), (), ()), ((), (0,), ()), ((), (0,), (0,)), ((), (), ()), ((), (), ()), ((), (), ()), ((), (), ()), ((), (0,), (0,)), )
# -*- coding: utf-8 -*- """ Created on Mon Mar 16 19:43:28 2020 @author: Ravi """ def minimumDistance(arr,n): a = set(arr) if len(a) == len(arr): return -1 li = {} for i in range(n): for j in range(n): if arr[i]==arr[j]: if i!=j: if arr[j] not in li: li[arr[j]] = j dist = [] for i in li: x = arr.index(i) res = abs(x - li[i]) dist.append(res) return min(dist) n = int(input()) arr=list(map(int,input().split(" "))) print(minimumDistance(arr,n))
class Solution: def __init__(self, w: List[int]): self.total = sum(w) for i in range(1, len(w)): w[i] += w[i-1] self.w = w def pickIndex(self) -> int: ans = 0 stop = randrange(self.total) l,r = 0, len(self.w)-1 while l <= r: mid = (l+r)//2 if self.w[mid] > stop: ans = mid r = mid-1 else: l = mid+1 return ans # Your Solution object will be instantiated and called as such: # obj = Solution(w) # param_1 = obj.pickIndex()
select_atom ={ 1: "H", 3: "Li", 6: "C", 7: "N", 8: "O", 9: "F", } select_weight ={ 1: 1.00794, 6: 12, 7: 15, 8: 16, 9: 18.998403, }
config = dict({ "LunarLander-v2": { "DQN": { "eff_batch_size" : 128, "eps_decay" : 0.99, "gamma" : 0.99, "tau" : 0.005, "lr" : 0.0005 }, "EnsembleDQN": { "eff_batch_size" : 64, "eps_decay" : 0.99, "gamma" : 0.99, "tau" : 0.005, "lr" : 0.0005 }, "BootstrapDQN":{ "eff_batch_size" : 64, "eps_decay" : 0.99, "gamma" : 0.99, "tau" : 0.005, "lr" : 0.0005, "mask" : "bernoulli", "mask_prob" : 0.9, "prior_scale" : 10 }, "ProbDQN":{ "eff_batch_size" : 256, "eps_decay" : 0.991, "gamma" : 0.99, "tau" : 0.001, "lr" : 0.0005, "loss_att_weight" : 2 }, "IV_EnsembleDQN": { "eff_batch_size" : 64, "eps_decay" : 0.99, "gamma" : 0.99, "tau" : 0.005, "lr" : 0.0005, "dynamic_eps" : True, "minimal_eff_bs" : 48, }, "IV_BootstrapDQN":{ "eff_batch_size" : 64, "eps_decay" : 0.99, "gamma" : 0.99, "tau" : 0.005, "lr" : 0.0005, "dynamic_eps" : True, "mask" : "bernoulli", "mask_prob" : 0.5, "minimal_eff_bs" : 48, "prior_scale" : 0.1 }, "IV_ProbEnsembleDQN":{ "eff_batch_size" : 64, "eps_decay" : 0.99, "gamma" : 0.99, "tau" : 0.005, "lr" : 0.001, "eps" : 10, "loss_att_weight" : 3 }, "IV_ProbDQN":{ "eff_batch_size" : 256, "eps_decay" : 0.991, "gamma" : 0.99, "tau" : 0.001, "lr" : 0.0005, "loss_att_weight" : 2, "dynamic_eps" : True, "minimal_eff_bs" : 208 } }, "MountainCar-v0":{ "DQN":{ "eff_batch_size" : 256, "lr" : 0.001, "eps_decay" : 0.98, "tau" : 0.01 }, "BootstrapDQN":{ "eff_batch_size" : 256, "lr" : 0.001, "eps_decay" : 0.98, "tau" : 0.05, "mask_prob" : 0.5, "prior_scale" : 10 }, "SunriseDQN":{ "eff_batch_size" : 256, "lr" : 0.001, "eps_decay" : 0.98, "tau" : 0.05, "mask_prob" : 0.5, "prior_scale" : 10, "sunrise_temp" : 50 }, "IV_DQN":{ "eff_batch_size" : 256, "lr" : 0.001, "eps_decay" : 0.98, "tau" : 0.05, "mask_prob" : 0.5, "prior_scale" : 10, "eps" : 1000 }, "IV_ProbEnsembleDQN":{ "eff_batch_size" : 256, "lr" : 0.001, "eps_decay" : 0.98, "tau" : 0.05, "mask_prob" : 0.5, "prior_scale" : 10, "eps" : 1000 }, }, "gym_cheetah":{ "EnsembleSAC":{ "eff_batch_size" : 1024, "mask_prob" : 0.9, "ucb_lambda" : 0 }, "IV_EnsembleSAC":{ "eff_batch_size" : 1024, "mask_prob" : 0.9, "ucb_lambda" : 10, "minimal_eff_bs_ratio" : 0.99, "dynamic_eps" : True }, "IV_ProbEnsembleSAC":{ "eff_batch_size" : 1024, "mask_prob" : 1, "ucb_lambda" : 0, "minimal_eff_bs_ratio" : 0.99, "dynamic_eps" : True, "loss_att_weight" : 2 }, "IV_SAC":{ "eff_batch_size" : 1024, "mask_prob" : 1, "ucb_lambda" : 0, "minimal_eff_bs_ratio" : 0.99, "dynamic_eps" : True, "loss_att_weight" : 2 }, "IV_ProbSAC":{ "loss_att_weight" : 5, "minimal_eff_bs_ratio" : 0.5 } }, "gym_walker2d":{ "EnsembleSAC":{ "eff_batch_size" : 512, "mask_prob" : 1, "ucb_lambda" : 1 }, "IV_EnsembleSAC":{ "eff_batch_size" : 1024, "mask_prob" : 0.9, "ucb_lambda" : 10, "minimal_eff_bs_ratio" : 0.8, "dynamic_eps" : True }, "IV_ProbEnsembleSAC":{ "eff_batch_size" : 1024, "mask_prob" : 0.9, "ucb_lambda" : 10, "minimal_eff_bs_ratio" : 0.8, "dynamic_eps" : True, "loss_att_weight" : 5 }, "IV_SAC":{ "eff_batch_size" : 1024, "mask_prob" : 0.9, "ucb_lambda" : 10, "minimal_eff_bs_ratio" : 0.8, "dynamic_eps" : True, "loss_att_weight" : 5 }, }, "gym_hopper":{ "EnsembleSAC":{ "eff_batch_size" : 512, "mask_prob" : 1, "ucb_lambda" : 10 }, "IV_ProbEnsembleSAC":{ "eff_batch_size" : 1024, "mask_prob" : 0.7, "ucb_lambda" : 10, "minimal_eff_bs_ratio" : 0.8, "dynamic_eps" : True, "loss_att_weight" : 10 }, "IV_SAC":{ "eff_batch_size" : 1024, "mask_prob" : 0.7, "ucb_lambda" : 10, "minimal_eff_bs_ratio" : 0.8, "dynamic_eps" : True, "loss_att_weight" : 10 }, }, "gym_ant":{ "EnsembleSAC":{ "eff_batch_size" : 512, "mask_prob" : 0.9, "ucb_lambda" : 10 }, "IV_ProbEnsembleSAC":{ "eff_batch_size" : 1024, "mask_prob" : 1, "ucb_lambda" : 1, "minimal_eff_bs_ratio" : 0.9, "dynamic_eps" : True, "loss_att_weight" : 5 }, "IV_SAC":{ "eff_batch_size" : 1024, "mask_prob" : 1, "ucb_lambda" : 1, "minimal_eff_bs_ratio" : 0.9, "dynamic_eps" : True, "loss_att_weight" : 5 }, }, "cartpole":{ "BootstrapDQN":{ "batch_size" : 128, "mask_prob" : 5 }, "IV_BootstrapDQN":{ "batch_size" : 128, "mask_prob" : 0.5, "minimal_eff_bs_ratio" : 0.99 }, "IV_ProbEnsembleDQN":{ "batch_size" : 128, "mask_prob" : 0.5, "minimal_eff_bs_ratio" : 0.99, "loss_att_weight" : 10 }, "IV_BootstrapDQN":{ "batch_size" : 128, "mask_prob" : 0.5, "minimal_eff_bs_ratio" : 0.99, }, "IV_ProbDQN": { "loss_att_weight" : 0.1, "minimal_eff_bs_ratio" : 0.7 }, "ProbEnsembleDQN":{ "batch_size" : 128, "loss_att_weight" : 10, "mask_prob" : 0.5 } } })
season = str(input()) gender = str(input()) people = int(input()) time = int(input()) winter = False spring = False summer = False girls = False boys = False mixed = False tax = 0 sport = str() total_price = 0 discount = 0 if season == "Winter": winter = True elif season == "Spring": spring = True elif season == "Summer": summer = True if gender == "boys": boys = True elif gender == "girls": girls = True elif gender == "mixed": mixed = True if people >= 50: discount = 0.50 elif 20 <= people < 50: discount = 0.85 elif 10 <= people < 20: discount = 0.95 else: discount = 1 if winter: if boys or girls: tax = 9.60 total_price = people * tax if boys: sport = "Judo" if girls: sport = "Gymnastics" elif mixed: tax = 10 total_price = people * tax sport = "Ski" elif spring: if boys or girls: tax = 7.20 total_price = people * tax if boys: sport = "Tennis" if girls: sport = "Athletics" elif mixed: tax = 9.50 total_price = people * tax sport = "Cycling" elif summer: if boys or girls: tax = 15 total_price = people * tax if boys: sport = "Football" if girls: sport = "Volleyball" elif mixed: tax = 20 total_price = people * tax sport = "Swimming" print(f"{sport} {(total_price * time) * discount:.2f} lv. ")
work_hours = [('Abby',100),('Billy',400),('Cassie',800)] def employee_check(work_hours): current_max = 0 # Set some empty value before the loop employee_of_month = '' for employee,hours in work_hours: if hours > current_max: current_max = hours employee_of_month = employee else: pass # Notice the indentation here return (employee_of_month,current_max) print(employee_check(work_hours))
def row_sum_odd_numbers(n): row_first_odd = int(0.5*(n-1)*n) odd_list = range(1, (row_first_odd+n)*2, 2) odd_row = odd_list[row_first_odd:] return sum(odd_row) # Example: # 1 # 3 5 # 7 9 11 # 13 15 17 19 # 21 23 25 27 29 # row_sum_odd_numbers(1); # 1 # row_sum_odd_numbers(2); # 3 + 5 = 8 # print row_sum_odd_numbers(1) # print row_sum_odd_numbers(2) # print row_sum_odd_numbers(3) # print row_sum_odd_numbers(4)
""" Tuples. Immutable lists i.e. contents cannot be changed. These are ordered so indexes and duplicates are allowed. tuples vs lists fixed length vs variable length tuples () lists [] tuples - immutable tuples - mutable """ my_tuple = () print(f"Type is : {type(my_tuple)}") # Single element in a tuple needs a trick; a trailing comma my_tuple = (9) print(f"Contents: {my_tuple}") print(f"Type is : {type(my_tuple)}") my_tuple = (9,) print(f"Contents: {my_tuple}") print(f"Type is : {type(my_tuple)}") # Access element my_tuple = (1, 2, 3, 4, 5) # 1st element print(f"First element: {my_tuple[0]}") # 2nd element print(f"Second element: {my_tuple[1]}") # Last element print(f"Last element: {my_tuple[-1]}") # 2nd to last element print(f"Second to last element: {my_tuple[-2]}") # Tuple assignment is interesting - assign a tuple of variables to a tuple of values & map them # Sometimes called tuples packing and unpacking. Both tuples need the same number of elements or else there will be a value error tuple1 = ("Cisco", "2600", "12.4") # Assign variables to tuple1 (vendor, model, ios) = tuple1 print(f"Vendor: {vendor}\n") print(f"Model: {model}\n") print(f"IOS: {ios}") # Assign variables in one tuple to values in another in one statement (a, b, c) = (10, 20, 30) print(f"a: {a}") print(f"b: {b}") print(f"c: {c}") # Find out what methods/functions are available a = () b = [] print(f"Type of a: {type(a)}") print(f"Type of b: {type(b)}") print(f"Methods/functions available to a: {dir(a)}") print(f"Methods/functions available to b: {dir(b)}") # Find out the number of elements inside a tuple tuple2 = (1, 2, 3, 4) print(f"Length of tuple2: {len(tuple2)}") # Lowest and greatest value in a tuple print(f"Lowest value in tuple2: {min(tuple2)}") print(f"Highest value in tuple2: {max(tuple2)}") # Concatinate and multiply tuple print(f"Concatinate tuples: {tuple2 + (5, 6, 7)}") print(f"Multiply tuples: {tuple2 * 2}") # Slicing is also possible with tuples print(f"1st 2 elements inside the tuple: {tuple2[0:2]}") print(f"[:2] returns the same: {tuple2[:2]}") print(f"Slice from element 1 to the end of the tuple: {tuple2[1:]}") print(f"Entire tuple: {tuple2[:]}") print(f"Without the last 2 elements in the tuple: {tuple2[:-2]}") print(f"Without the first 2 elements in the tuple: {tuple2[-2:]}") print(f"Insert a step in the slice to show in reverse order: {tuple2[::-1]}") # Check if an element is a member of a tuple or not print(f"Is 3 in tuple2: {3 in tuple2}") print(f"Is 3 not in tuple2: {3 not in tuple2}") print(f"Is 5 in tuple2: {5 in tuple2}") # To delete the entire tuple del tuple2 # This will throw an error if you try to print the tuple as it not defined anymore
# -*- coding: utf-8 -*- # Scrapy settings for Downloader project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/en/latest/topics/settings.html # BOT_NAME = 'CNSpider' SPIDER_MODULES = ['CNSpider.spiders'] NEWSPIDER_MODULE = 'CNSpider.spiders' RANDOMIZE_DOWNLOAD_DELAY = True #DOWNLOAD_DELAY = 1 COOKIES_ENABLED = False RETRY_ENABLED = False DOWNLOADER_MIDDLEWARES = { 'scrapy.contrib.downloadermiddleware.useragent.UserAgentMiddleware' : None, 'CNSpider.rotate_useragent.RotateUserAgentMiddleware' :400 } SPIDER_MIDDLEWARES = { 'scrapy.contrib.spidermiddleware.offsite.OffsiteMiddleware': 500, }
# # Copyright (c) 2019 MagicStack Inc. # All rights reserved. # # See LICENSE for details. ## GET_USER = """ SELECT User { id, name, image, latest_reviews := ( WITH UserReviews := User.<author[IS Review] SELECT UserReviews { id, body, rating, movie: { id, image, title, avg_rating } } ORDER BY .creation_time DESC LIMIT 10 ) } FILTER .id = <uuid>$id """ GET_MOVIE = """ SELECT Movie { id, image, title, year, description, avg_rating, directors: { id, full_name, image, } ORDER BY @list_order EMPTY LAST THEN .last_name, cast: { id, full_name, image, } ORDER BY @list_order EMPTY LAST THEN .last_name, reviews := ( SELECT Movie.<movie[IS Review] { id, body, rating, author: { id, name, image, } } ORDER BY .creation_time DESC ), } FILTER .id = <uuid>$id """ GET_PERSON = """ SELECT Person { id, full_name, image, bio, acted_in := ( WITH M := Person.<cast[IS Movie] SELECT M { id, image, title, year, avg_rating } ORDER BY .year ASC THEN .title ASC ), directed := ( WITH M := Person.<directors[IS Movie] SELECT M { id, image, title, year, avg_rating } ORDER BY .year ASC THEN .title ASC ), } FILTER .id = <uuid>$id """ UPDATE_MOVIE = """ SELECT ( UPDATE Movie FILTER .id = <uuid>$id SET { title := .title ++ '---' ++ <str>$suffix } ) { id, title } """ INSERT_USER = """ SELECT ( INSERT User { name := <str>$name, image := <str>$image, } ) { id, name, image, } """ INSERT_MOVIE = """ SELECT ( INSERT Movie { title := <str>$title, image := <str>$image, description := <str>$description, year := <int64>$year, directors := ( SELECT Person FILTER .id = (<uuid>$d_id) ), cast := ( SELECT Person FILTER .id IN array_unpack(<array<uuid>>$cast) ), } ) { id, title, image, description, year, directors: { id, full_name, image, } ORDER BY .last_name, cast: { id, full_name, image, } ORDER BY .last_name, } """ INSERT_MOVIE_PLUS = """ SELECT ( INSERT Movie { title := <str>$title, image := <str>$image, description := <str>$description, year := <int64>$year, directors := ( INSERT Person { first_name := <str>$dfn, last_name := <str>$dln, image := <str>$dimg, } ), cast := {( INSERT Person { first_name := <str>$cfn0, last_name := <str>$cln0, image := <str>$cimg0, } ), ( INSERT Person { first_name := <str>$cfn1, last_name := <str>$cln1, image := <str>$cimg1, } )}, } ) { id, title, image, description, year, directors: { id, full_name, image, } ORDER BY .last_name, cast: { id, full_name, image, } ORDER BY .last_name, } """
sequence = [1] n = 0 while n < 40: sequence.append(sequence[n] + sequence[n-1]) n += 1 print('The Fibonacci sequence, up to the 30th term, is \n' + str(sequence) + '.') pisano = input("Please pick a number. ") psequence = [] for item in sequence: psequence.append(item % pisano) print(psequence) # for item in sequence: # if item%pisano != 0: # psequence.append(item%pisano) # else: # print('The Pisano period of ' + str(pisano) + ' for the Fibonacci sequence is ' + str(psequence) + '.') # break
class OperationHolderMixin: def __and__(self, other): return OperandHolder(AND, self, other) def __or__(self, other): return OperandHolder(OR, self, other) def __rand__(self, other): return OperandHolder(AND, other, self) def __ror__(self, other): return OperandHolder(OR, other, self) def __invert__(self): return SingleOperandHolder(NOT, self) class SingleOperandHolder(OperationHolderMixin): def __init__(self, operator_class, op1_class): self.operator_class = operator_class self.op1_class = op1_class def __call__(self, *args, **kwargs): op1 = self.op1_class(*args, **kwargs) return self.operator_class(op1) class OperandHolder(OperationHolderMixin): def __init__(self, operator_class, op1_class, op2_class): self.operator_class = operator_class self.op1_class = op1_class self.op2_class = op2_class def __call__(self, *args, **kwargs): op1 = self.op1_class(*args, **kwargs) op2 = self.op2_class(*args, **kwargs) return self.operator_class(op1, op2) class AND: def __init__(self, op1, op2): self.op1 = op1 self.op2 = op2 def has_permission(self, context): return ( self.op1.has_permission(context) and self.op2.has_permission(context) ) def has_object_permission(self, context, obj): return ( self.op1.has_object_permission(context, obj) and self.op2.has_object_permission(context, obj) ) class OR: def __init__(self, op1, op2): self.op1 = op1 self.op2 = op2 def has_permission(self, context): return ( self.op1.has_permission(context) or self.op2.has_permission(context) ) def has_object_permission(self, context, obj): return ( self.op1.has_object_permission(context, obj) or self.op2.has_object_permission(context, obj) ) class NOT: def __init__(self, op1): self.op1 = op1 def has_permission(self, context): return not self.op1.has_permission(context) def has_object_permission(self, context, obj): return not self.op1.has_object_permission(context, obj) class BasePermissionMetaclass(OperationHolderMixin, type): pass
class InvalidBackend(Exception): pass class NodeDoesNotExist(Exception): pass class PersistenceError(Exception): pass
# -*- coding: utf-8 -*- class WebsocketError: CodeInvalidSession = 9001 CodeConnCloseErr = 9005 class AuthenticationFailedError(RuntimeError): def __init__(self, msg): self.msgs = msg def __str__(self): return self.msgs class NotFoundError(RuntimeError): def __init__(self, msg): self.msgs = msg def __str__(self): return self.msgs class MethodNotAllowedError(RuntimeError): def __init__(self, msg): self.msgs = msg def __str__(self): return self.msgs class SequenceNumberError(RuntimeError): def __init__(self, msg): self.msgs = msg def __str__(self): return self.msgs class ServerError(RuntimeError): def __init__(self, msg): self.msgs = msg def __str__(self): return self.msgs
# Problem: https://www.hackerrank.com/challenges/repeated-string/problem # Score: 20 def repeated_string(s, n): return n // len(s) * s.count('a') + s[0: n % len(s)].count('a') s = input() n = int(input()) print(repeated_string(s, n))
num1 = int(input()) num2 = int(input()) if num1>=num2: print(num1) else: print(num2)
class EnergyAnalysisSurface(Element, IDisposable): """ Analytical surface. The collection of analytic openings belonging to this analytical parent surface """ def Dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def GetAdjacentAnalyticalSpace(self): """ GetAdjacentAnalyticalSpace(self: EnergyAnalysisSurface) -> EnergyAnalysisSpace Gets the secondary adjacent analytical space this surface is associated with. Returns: The secondary analytical space. """ pass def GetAnalyticalOpenings(self): """ GetAnalyticalOpenings(self: EnergyAnalysisSurface) -> IList[EnergyAnalysisOpening] Returns the analytical openings of the analytical surface. Returns: The collection of analytical openings. """ pass def GetAnalyticalSpace(self): """ GetAnalyticalSpace(self: EnergyAnalysisSurface) -> EnergyAnalysisSpace Gets the primary analytical space this surface is associated with. Returns: The primary analytical space. """ pass def getBoundingBox(self, *args): """ getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """ pass def GetPolyloop(self): """ GetPolyloop(self: EnergyAnalysisSurface) -> Polyloop Gets the planar polygon describing the opening geometry. Returns: The planar polygon describing the opening geometry. """ pass def ReleaseUnmanagedResources(self, *args): """ ReleaseUnmanagedResources(self: Element,disposing: bool) """ pass def setElementType(self, *args): """ setElementType(self: Element,type: ElementType,incompatibleExceptionMessage: str) """ pass def __enter__(self, *args): """ __enter__(self: IDisposable) -> object """ pass def __exit__(self, *args): """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass Azimuth = property(lambda self: object(), lambda self, v: None, lambda self: None) """The azimuth angle for this surface. Get: Azimuth(self: EnergyAnalysisSurface) -> float """ CADLinkUniqueId = property( lambda self: object(), lambda self, v: None, lambda self: None ) """The unique id of the originating CAD object's link (linked document) associated with this surface. Get: CADLinkUniqueId(self: EnergyAnalysisSurface) -> str """ CADObjectUniqueId = property( lambda self: object(), lambda self, v: None, lambda self: None ) """The unique id of the originating CAD object (model element) associated with this surface. Get: CADObjectUniqueId(self: EnergyAnalysisSurface) -> str """ Corner = property(lambda self: object(), lambda self, v: None, lambda self: None) """The lower-left coordinate for the analytical rectangular geometry viewed from outside. Get: Corner(self: EnergyAnalysisSurface) -> XYZ """ Height = property(lambda self: object(), lambda self, v: None, lambda self: None) """The height of the analytical rectangular geometry. Get: Height(self: EnergyAnalysisSurface) -> float """ Normal = property(lambda self: object(), lambda self, v: None, lambda self: None) """The outward normal for this surface. Get: Normal(self: EnergyAnalysisSurface) -> XYZ """ OriginatingElementDescription = property( lambda self: object(), lambda self, v: None, lambda self: None ) """The description for the originating Revit element. Get: OriginatingElementDescription(self: EnergyAnalysisSurface) -> str """ SurfaceId = property(lambda self: object(), lambda self, v: None, lambda self: None) """The unique identifier for the surface. Get: SurfaceId(self: EnergyAnalysisSurface) -> str """ SurfaceName = property( lambda self: object(), lambda self, v: None, lambda self: None ) """The unique name identifier for this surface. Get: SurfaceName(self: EnergyAnalysisSurface) -> str """ SurfaceType = property( lambda self: object(), lambda self, v: None, lambda self: None ) """The analytical surface type. Get: SurfaceType(self: EnergyAnalysisSurface) -> EnergyAnalysisSurfaceType """ Tilt = property(lambda self: object(), lambda self, v: None, lambda self: None) """The tilt angle for this surface. Get: Tilt(self: EnergyAnalysisSurface) -> float """ Type = property(lambda self: object(), lambda self, v: None, lambda self: None) """The gbXML surface type attribute. Get: Type(self: EnergyAnalysisSurface) -> gbXMLSurfaceType """ Width = property(lambda self: object(), lambda self, v: None, lambda self: None) """The width of the analytical rectangular geometry. Get: Width(self: EnergyAnalysisSurface) -> float """
__doc__ = """An object oriented solution to the problem.""" class Person: def __init__(self, name): self.name = name def __repr__(self): return self.name def __str__(self): return self.name class FamilyMember(Person): def __init__(self, name): self.name = name def is_attendee_a_family_member(attendee): return isinstance(attendee, FamilyMember) def get_solution(attendees, family_members): # head is always an attendee attendees_who_are_family_members = [family_members[0]] attendees_who_are_guests = [] for attendee in attendees: if is_attendee_a_family_member(attendee): attendees_who_are_family_members.append(attendee) else: attendees_who_are_guests.append(attendee) # family members who are not attendees family_members_who_are_not_attendees = [] for member in family_members: # the below if condition is a bit complicated and # relies again on family members' names being unique # check if the "name" of the family member is present in the "names" of the attendees who are family members # hence the "member.name" and "x.name" in the below line if member.name not in [x.name for x in attendees_who_are_family_members]: family_members_who_are_not_attendees.append(member) return ( attendees_who_are_family_members, family_members_who_are_not_attendees, attendees_who_are_guests, ) if __name__ == "__main__": # # Example 1: # family_members = [ # "head", # "member 1", # "member 2", # "member 3", # "member 4", # "member 5", # ] # attendees = ["member 1", "guest 1", "member 2", "member 5", "guest 5"] # # here the family members and attendees are still "STRING" objects. # # let's change that with relevant object type # family_members = [FamilyMember(x) for x in family_members] # # print(family_members) # # print([x.name for x in family_members]) # attendees = [ # FamilyMember("member 1"), # Person("guest 1"), # FamilyMember("member 2"), # FamilyMember("member 5"), # Person("guest 5"), # ] # # print(attendees) # # print([(type(x).__name__, x.name) for x in attendees]) # Example 2" family_members = ["Judy", "Jack", "Jessy", "David", "Gloria"] attendees = [ "Jack", "David", "Judy", ] family_members = [FamilyMember(x) for x in family_members] # this part is somewhat ugly, have to manually create the "types" from names here attendees = [FamilyMember("Jack"), FamilyMember("David"), Person("Judy")] a, b, c = get_solution(attendees, family_members) print("i", a) print("ii", b) print("iii", c)
# -- Project information ----------------------------------------------------- project = 'LUNA' copyright = '2020 Great Scott Gadgets' author = 'Katherine J. Temkin' # -- General configuration --------------------------------------------------- master_doc = 'index' extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.napoleon' ] templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # -- Options for HTML output ------------------------------------------------- html_theme = 'sphinx_rtd_theme' html_static_path = ['_static'] html_css_files = ['status.css'] # -- Options for automatic documentation ------------------------------------- # Skip documenting Tests. def autodoc_skip_member_handler(app, what, name, obj, skip, options): return \ name.endswith("Test") or \ name.startswith('_') or \ (name == "elaborate") def setup(app): app.connect('autodoc-skip-member', autodoc_skip_member_handler)
def sample_single_dim(action_space_list_each, is_act_continuous): each = [] if is_act_continuous: each = action_space_list_each.sample() else: if action_space_list_each.__class__.__name__ == "Discrete": each = [0] * action_space_list_each.n idx = action_space_list_each.sample() each[idx] = 1 elif action_space_list_each.__class__.__name__ == "MultiDiscreteParticle": each = [] nvec = action_space_list_each.high - action_space_list_each.low + 1 sample_indexes = action_space_list_each.sample() for i in range(len(nvec)): dim = nvec[i] new_action = [0] * dim index = sample_indexes[i] new_action[index] = 1 each.extend(new_action) return each def sample(action_space_list_each, is_act_continuous): player = [] if is_act_continuous: for j in range(len(action_space_list_each)): each = action_space_list_each[j].sample() player.append(each) else: player = [] for j in range(len(action_space_list_each)): # each = [0] * action_space_list_each[j] # idx = np.random.randint(action_space_list_each[j]) if action_space_list_each[j].__class__.__name__ == "Discrete": each = [0] * action_space_list_each[j].n idx = action_space_list_each[j].sample() each[idx] = 1 player.append(each) elif action_space_list_each[j].__class__.__name__ == "MultiDiscreteParticle": each = [] nvec = action_space_list_each[j].high sample_indexes = action_space_list_each[j].sample() for i in range(len(nvec)): dim = nvec[i] + 1 new_action = [0] * dim index = sample_indexes[i] new_action[index] = 1 each.extend(new_action) player.append(each) return player
class Solution(object): def match_note_to_magazine(self, ransom_note, magazine): if ransom_note is None or magazine is None: raise TypeError('ransom_note or magazine cannot be None') seen_chars = {} for char in magazine: if char in seen_chars: seen_chars[char] += 1 else: seen_chars[char] = 1 for char in ransom_note: try: seen_chars[char] -= 1 except KeyError: return False if seen_chars[char] < 0: return False return True
def on_message_deleted(msg, server): return "Deleted: {}".format(msg["previous_message"]["text"]) def on_message_changed(msg, server): text = msg.get("message", {"text": ""}).get("text", "") if text.startswith("!echo"): return "Changed: {}".format(text) def on_message(msg, server): if msg["text"].startswith("!echo"): return msg.get("text", "") def on_channel_join(msg, server): return "saw user {} join".format(msg['user'])
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "/home/hunter/github_projects/ROS/catkin_ws/src/my_package/msg/Num.msg" services_str = "/home/hunter/github_projects/ROS/catkin_ws/src/my_package/srv/AddTwoInts.srv" pkg_name = "my_package" dependencies_str = "std_msgs" langs = "gencpp;geneus;genlisp;gennodejs;genpy" dep_include_paths_str = "my_package;/home/hunter/github_projects/ROS/catkin_ws/src/my_package/msg;std_msgs;/opt/ros/kinetic/share/std_msgs/cmake/../msg" PYTHON_EXECUTABLE = "/usr/bin/python" package_has_static_sources = '' == 'TRUE' genmsg_check_deps_script = "/opt/ros/kinetic/share/genmsg/cmake/../../../lib/genmsg/genmsg_check_deps.py"
class FunctionDifferentialRegistry(dict): def __setitem__(self, k, v): if not callable(k): raise ValueError("key must be callable") if not callable(v): raise ValueError("value must be callable") super().__setitem__(k, v) global_registry = FunctionDifferentialRegistry() def diff(grad_f): def inner(f, registry=None): register_diff(f, grad_f, registry=registry) return f return inner def register_diff(f, grad_f, registry=None): if registry is None: registry = global_registry registry[f] = grad_f
""" The dependencies for running the gen_rust_project binary. """ load("//util/import/raze:crates.bzl", "rules_rust_util_import_fetch_remote_crates") def import_deps(): rules_rust_util_import_fetch_remote_crates() # For legacy support gen_rust_project_dependencies = import_deps
version = "1.0" def sayhi(): print("Hi,this is mymodule speaking.") def judge_1(): a = int(input("input a")) c = int(input("input c")) if a > c: print("椭圆") if a == c: print("抛物线") if a < c: print("双曲线")
def timeconverter(days): years = days // 365 days = days % 365 months = days // 30 days = days % 30 print(f"{years} years, {months} months and {days} days") days = input("Enter number of days: ") days = int(days) timeconverter(days)
print("hello world") print("my name is mark zed bruyg") print("555") karachi_city = ["gulshan", "johar", "malir", "defence", "liyari"] print(karachi_city[2]) names_of_student = ["maaz", "musab", "usman", "shuraim", "sudais", "ausaf"] print(names_of_student) age = 12 amount_to_increment = 3 age += amount_to_increment print(age)
# (raw name, table column) COLS=[ ('cxid', 'cxid'), ('dts', 'dts'), ('Existing Meter Number', 'old_meter_number'), ('Existing Meter Reading', 'old_meter_reading'), ('New Meter Number', 'new_meter_number'), ('New Meter Reading', 'new_meter_reading'), ('Geo Tag', 'geo_tag'), ('GPS', 'gps'), ('SRV Man Initials', 'initials'), ('Meter Site Insp.', 'insp_state'), ('Meter Site Insp. Notes', 'insp_notes'), # ('SO No', 'sono'), # ('Map No', 'mapno'), ('Photo1', 'photo1'), ('Photo2', 'photo2'), ('Photo3', 'photo3') ] DATA_FIELDS=[ 'cxid', 'old_meter_number', 'old_meter_reading', 'new_meter_number', 'new_meter_reading', 'dts' ] LOC_FIELDS=[ 'id', 'gps_x', 'gps_y', 'geo_tag' ] PHOTO_FIELDS=[ 'id', 'photo1', 'photo2', 'photo3' ] SITE_INSP_FIELDS=[ 'id', 'initials', 'insp_state', 'insp_notes' ] class RF_Changeout(): @staticmethod def from_row(row): self = RF_Changeout() for key, col in COLS: if key in row: setattr(self, col, row[key]) self.fix_gps() return self def __getitem__(self, key): return getattr(self, key, None) def __setitem__(self, key, value): return setattr(self, key, value) def fix_gps(self): gps = getattr(self, 'gps', None) if gps and not 'None' in gps: u, v = gps.replace(' ', '').split(',') if u and v: self.gps_y = float(u) # Latitude self.gps_x = float(v) # Longitude del self.gps def get_data(self): result=list() for field in DATA_FIELDS: result.append(self[field]) return result def get_loc(self): result=list() for field in LOC_FIELDS: result.append(self[field]) return result def get_photos(self): result=list() for field in PHOTO_FIELDS: result.append(self[field]) return result def get_site_insp(self): result=list() for field in SITE_INSP_FIELDS: result.append(self[field]) return result def collect_rows(row, data): oid = row['order_id'] key = row['data_point'] val = row['value'] if not oid in data: data[oid] = dict() data[oid]['dts'] = row['dts'] data[oid][key] = val