content
stringlengths
7
1.05M
'''Crie as classes necessárias para um sistema de gerenciamento de uma biblioteca. Os bibliotecários deverão preencher o sistema com o título do livro, os autores, o ano, a editora, a edição e o volume. A biblioteca também terá um sistema de pesquisa (outro software), portanto será necessário conseguir acessar os atributos típicos de pesquisa (nome, autor, …).''' class Livro(): def __init__(self, titulo: str, autores: str, ano: str, editora: str, edicao=1, volume=1): self.__titulo = titulo self.__autores = autores self.__ano = ano self.__editora = editora self.__edicao = edicao self.__volume = volume @property def titulo(self): return self.__titulo @property def autores(self): return self.__autores @property def ano(self): return self.__ano @property def editora(self): return self.__editora @property def edicao(self): return self.__edicao @property def volume(self): return self.__volume class Biblioteca(): def __init__(self, livros: list): self.__livros = livros @property def livros(self): return self.__livros def adicionar_livro(self, livro: Livro): self.livros.append(livro) def exibir_livros(self): c = 0 for livro in self.livros: c += 1 print(f'{c}. {livro.titulo} ({livro.ano}), por {livro.autores}, editora {livro.editora}, ed. {livro.edicao}, vol. {livro.volume}') def main(): livro1 = Livro('Admirável mundo novo', 'Aldous Huxley', '1932', 'Biblioteca Azul') livro2 = Livro('Morte na Mesopotâmia', 'Agatha Christie', '1936', 'Arqueiro', '19') livro3 = Livro('Life, the Universe and Everything', 'Douglas Adams', '1982', 'Del Rey', '1', '3') livro4 = Livro('Cidades de Papel', 'John Green', '2008', 'Intrinseca') Biblioteca1 = Biblioteca([livro1, livro2, livro3]) Biblioteca1.adicionar_livro(livro4) Biblioteca1.exibir_livros() main()
""" Given an n-ary tree, return the postorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples). Follow up: Recursive solution is trivial, could you do it iteratively? Example 1: https://assets.leetcode.com/uploads/2018/10/12/narytreeexample.png Input: root = [1,null,3,2,4,null,5,6] Output: [5,6,3,2,4,1] Example 2: https://assets.leetcode.com/uploads/2019/11/08/sample_4_964.png Input: root = [1,null,2,3,4,5,null,null,6,7,null,8,null,9,10,null,null,11,null,12,null,13,null,null,14] Output: [2,6,14,11,7,3,12,8,4,13,9,10,5,1] Constraints: The height of the n-ary tree is less than or equal to 1000 The total number of nodes is between [0, 10^4] """ # class Node: # """Definition for a Node.""" # def __init__(self, val=None, children=None): # self.val = val # self.children = children class Solution: def __init__(self): self.post_lst = [] def postorder(self, root): """recursion""" if root: for leaf in root.children: self.postorder(leaf) self.post_lst.append(root.val) return self.post_lst def postorder2(self, root): """iteration""" if not root: return [] res = [] stack = [root] while stack: node = stack.pop() res.append(node.val) stack.extend(node.children) return res[::-1]
class TableViewUIUtils(object): """ This utility class contains members that involve the Revit UI and operate on schedule views or MEP electrical panel schedules. """ @staticmethod def TestCellAndPromptToEditTypeParameter(tableView,sectionType,row,column): """ TestCellAndPromptToEditTypeParameter(tableView: TableView,sectionType: SectionType,row: int,column: int) -> bool Prompts the end-user to control whether a type parameter contained in the specified table cell should be allowed edited. tableView: The table view. sectionType: The section the row lies in. row: The row index in the section. column: The column index in the section. Returns: Returns true if editing the cell is allowed; otherwise false. """ pass __all__=[ 'TestCellAndPromptToEditTypeParameter', ]
# Q5. Write a program to implement OOPs concepts in python i.e. inheritance etc. class Person: def __init__(self, name, age, address): # constructor self.name = name self.age = age self.address = address def set_data(self, name, age, address): self.name = name self.age = age self.address = address def get_data(self): print('Name : ', self.name) print('Age : ', self.age) print('Address : ', self.address) def get_name(self): return self.name def get_age(self): return self.age def get_address(self): return self.address class Student(Person): def __init__(self, name, age, address, rollno, course, marksObtained, maximumMarks): # constructor super().__init__(name, age, address) self.rollno = rollno self.course = course self.marksObtained = marksObtained self.maximumMarks = maximumMarks def set_data(self, rollno, course, marksObtained, maximumMarks): self.rollno = rollno self.course = course self.marksObtained = marksObtained self.maximumMarks = maximumMarks def get_data(self): print('Name : ', super().get_name()) print('Age : ', super().get_age()) print('Address : ', super().get_address()) print('Rollno : ', self.rollno) print('Course : ', self.course) print('Marks Obtained : ', self.marksObtained) print('Maximum Marks : ', self.maximumMarks) print('Percentage : ', '{:.2f}'.format(self.get_percentage()), '%') def get_rollno(self): return self.rollno def get_course(self): return self.course def get_marksObtained(self): return self.marksObtained def maximumMarks(self): return self.maximumMarks def get_percentage(self): return marksObtained / maximumMarks * 100 print('PERSON DETAILS : ') name = input('Enter Name of Person : ') age = int(input('Enter Age of ' + name + ' : ')) address = input('Enter Address of ' + name +' : ') p1 = Person(name, age, address) # Object of Person Class print('\nSTUDENT DETAILS : ') name = input('Enter Name of Student: ') age = int(input('Enter Age of Student : ')) address = input('Enter Address of Student: ') rollno = input('Enter Rollno of Student : ') course = input('Enter Course of Student : ') marksObtained = float(input('Enter Marks Obtained of Student : ')) maximumMarks = float(input('Enter Maximum Marks of Student : ')) s1 = Student(name, age, address, rollno, course, marksObtained, maximumMarks) # Printing Person Details print("\n\nPerson Details are as :") p1.get_data(); #Printing Student Detatils print("\n\nStudent Details are as :") s1.get_data();
# Aprimore o desafio anterior, mostrando no final: # A) A soma de todos os valores pares digitados. # B) A soma dos valores da terceira coluna. # C) O maior valor da segunda linha. matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] somaPar = 0 somaCol = 0 for l in range(0, 3): for c in range(0, 3): matriz[l][c] = int(input(f'Digite um valor para [{l}, {c}]: ')) if matriz[l][c] % 2 == 0: somaPar = somaPar + matriz[l][c] print('-=' * 30) for l in range(0, 3): somaCol = somaCol + matriz[l][2] for c in range(0, 3): print(f'[ {matriz[l][c]:^5} ]', end='') print() print('-=' * 30) print(f'A soma dos valores pares é: {somaPar}.') print(f'A soma dos valores da terceira coluna é: {somaCol}.') print(f'O maior valor da segunda linha é : {max(matriz[1])}.')
class PolarPoint(): def __init__(self, angle, radius): self.angle = angle self.radius = radius
def mu(i, lo=0, hi=None): hi = hi or len(i.has) return sum([i.x(i.has[j]) for j in range(lo, hi)]) / (hi - lo) class Some(o): "Collect some examples, not all." hi = 256 # max number of items to collect def __init__(i, pos=0, txt=" ", inits=[]): i.pos, i.txt, i.n, i._all, i.sorted = pos, txt, 0, [], False i.w = -1 if txt[0] == Tab.less else 1 i.nump = txt[0] in Tab.nums [i.add(x) for x in inits] def add(i, x): if x != Tab.skip: if len(i._all) < Some.hi: i.update(i._all.append(x)) elif random() < Some.hi / i.n: i.update(i.replace(x)) return x def update(i, ignore): i.sorted = False i.n += 1 def replace(i, x): i._all[int(len(i._all) * random())] = x def all(i): if not i.sorted: i._all = sorted(i._all) i.sorted = True return i._all def per(i, p=None, lo=None, hi=None): return per(i.all(), p, lo, hi) def sd(i, lo=None, hi=None): return sd(i.all(), lo, hi) def nmusd(i): return len(i._all), i.per(), i.sd() def same(i, j): xn, xmu, xsd = i.nmusd() yn, ymu, ysd = j.nmusd() return Ttest(xn, xmu, xsd, yn, ymu, ysd) class Ttest(o): small = 0.38 # medium = 1 d = {} d[95] = [[3, 3.182], [6, 2.447], [12, 2.179], [24, 2.064], [48, 2.011], [96, 1.985]] d[99] = [[3, 5.841], [6, 3.707], [12, 3.055], [24, 2.797], [48, 2.682], [96, 2.625]] def __init__(i, *lst, conf=95): xy = Ttest.d[conf] i.result = i.hedges(Ttest.small, *lst) and i.ttest(xy, *lst) def hedges(i, threshold, xn, xmu, xsd, yn, ymu, ysd): # from https://goo.gl/w62iIL nom = (xn - 1) * xsd ** 2 + (yn - 1) * ysd ** 2 denom = (xn - 1) + (yn - 1) sp = (nom / denom)**0.5 g = abs(xmu - ymu) / sp c = 1 - 3.0 / (4 * (xn + yn - 2) - 1) return g * c > threshold def ttest(i, xy, xn, xmu, xsd, yn, ymu, ysd, conf=95): # debugged using https://goo.gl/CRl1Bz t = (xmu - ymu) / max(10 ** -64, xsd**2 / xn + ysd**2 / yn)**0.5 a = xsd ** 2 / xn b = ysd ** 2 / yn df = (a + b)**2 / (10 ** -64 + a**2 / (xn - 1) + b**2 / (yn - 1)) c = i.critical(xy, int(df + 0.5)) return abs(t) > c def critical(i, xy, df): x1, y1 = xy[0] if df < x1: return y1 for x2, y2 in xy[1:]: if x1 <= df < x2: return y1 + (y2 - y1) * (df - x1) / (x2 - x1) x1, y1 = x2, y2 return y2
''' Truth tables for logical expressions. Define predicates and/2, or/2, nand/2, nor/2, xor/2, impl/2 and equ/2 (for logical equivalence) which succeed or fail according to the result of their respective operations; e.g. and(A,B) will succeed, if and only if both A and B succeed. Note that A and B can be Prolog goals (not only the constants true and fail). A logical expression in two variables can then be written in prefix notation, as in the following example: and(or(A,B),nand(A,B)). Now, write a predicate table/3 which prints the truth table of a given logical expression in two variables. Example: * table(A,B,and(A,or(A,B))). true true true true fail true fail true fail fail fail fail ''' # predicate funtion return true if any one is true or both A and B are true, oterwise return false def predicateOr(A, B): if A or B: return True else: return False # predicate function returns true if both A and B are False or one of them is False def predicateNand(A, B): if not(A and B): return True else: return False # predicate function return true only if both A and B are true,otherwise returns false def predicateAnd(A, B): if A and B: return True else: return False # for two input A and B inputs to predicate functions are A = [True, True, False, False] B = [True, False, True, False] print('Result for: and(A,or(A,B))') # finding output of given expression with all possible values of A and B for i in range(len(A)): print(f"{A[i]}\t{B[i]}\t{predicateAnd(A[i],predicateOr(A[i],B[i]))}") print('\nResult for: and( or (A, B), nand(A, B))') for i in range(len(A)): output = predicateAnd(predicateOr(A[i], B[i]), predicateNand(A[i], B[i])) print(f"{A[i]}\t{B[i]}\t{output}")
p=float(input('\033[32mqual o preço do produto ? R$\033[m')) d=(p*5)/100 v=p-d print('\033[34mO desconto em 5 porcento do produto será de \033[31mR${}\033[34m'.format(d)) print('O valor do produto com 5 porcento de desconto é de \033[31mR${}'.format(v))
''' *000*000* 0*00*00*0 00*0*0*00 000***000 Utkarsh ''' l=int(input()) b=int(input()) print("With for\n") for i in range(1,b+1): for j in range(1,l+1): if j==(l+1)//2 or j==i or j==(l+1)-i: print('*',end='') else: print('0',end='') print() i=1 j=1 print("\nWith while\n") while i<=b: while j<=l: if j==(l+1)//2 or j==i or j==(l+1)-i: print('*',end='') else: print('0',end='') j+=1 j=1 print() i+=1
# automatically generated by the FlatBuffers compiler, do not modify # namespace: flat class SeriesLengthOption(object): Unlimited = 0 Three_Games = 1 Five_Games = 2 Seven_Games = 3
"""69. Sqrt(x) https://leetcode.com/problems/sqrtx/ Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative integer. Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned. Example 1: Input: 4 Output: 2 Example 2: Input: 8 Output: 2 Explanation: The square root of 8 is 2.82842..., and since the decimal part is truncated, 2 is returned. """ class Solution: def my_sqrt(self, x: int) -> int: """ It takes much time. """ if x == 0: return 0 if x == 1: return 1 for i in range(1, x): temp = x // i square = temp ** 2 if square == x: return temp elif square < x: return temp def my_sqrt_1(self, x: int) -> int: def divide(l: int, r: int) -> int: if l ** 2 == x: return l if r ** 2 == x: return r if r - l == 1: return l temp = (l + r) // 2 square = temp ** 2 if square < x: return divide(temp, r) if square > x: return divide(l, temp) else: return temp return divide(0, x)
# coding: utf-8 __author__ = 'tack' class Position(object): ''' position ''' def __init__(self, code, num, price, commission, date): ''' Args: code: stock code price: cost price commission: commission num: num date: date ''' self.code = code self.num = num self.date = date self.commission = commission self.cost = price * self.num + commission self.cost_price = self.cost / self.num self.market_price = price def add(self, position): ''' buy some ''' if position is None: raise Exception('position is none') if position.code != self.code: raise Exception('add op can not apply on different stocks') self.cost += position.cost self.num += position.num self.cost_price = self.cost / self.num self.market_price = position.market_price return True, 'buy' def sub(self, sell_position=None): ''' sell some ''' if sell_position is None: raise Exception('position is none') if sell_position.code != self.code: raise Exception('sub op can not apply on different stocks') if sell_position.num <= self.num: self.cost -= sell_position.get_market_value() # total cost - market value self.num -= sell_position.num self.update(market_price=sell_position.market_price) if self.num == 0: self.cost_price = 0. return True, 'sell' self.cost_price = self.cost / self.num return True, 'sell' else: return False, 'no enough stocks to sell' def update(self, market_price=None): ''' update market price ''' self.market_price = market_price def get_cost_value(self): ''' value ''' # return self.cost_price * self.num return self.cost def get_market_value(self, market_price=None): ''' get market value of the position ''' if market_price is not None: self.market_price = market_price if self.market_price is None: raise Exception('you need to update market price.') return self.market_price * self.num def get_profit(self): ''' paper loss, paper gain ''' return self.get_market_value() - self.cost def get_profit_ratio(self): return (self.get_market_value() - self.cost) / self.cost * 100 def __repr__(self): return 'code=%s,cost=%f,cost_price=%f, market_price=%f,num=%d,value=%f,profit=%f,date=%s' % (self.code, self.cost, self.cost_price,self.market_price, self.num, self.get_market_value(), self.get_profit(), self.date) def get(self): return (self.code, self.num, self.cost_price, self.date) class PosstionHistory(object): ''' history of position ''' def __init__(self): self.phs = {} def update(self, position): ''' when the market close, update positions :param position: :return: ''' if position.code in self.phs: self.phs[position.code].append(position) else: self.phs[position.code] = [position] def get_history(self, code): return self.phs.get(code, None)
#08 - Crie um programa que leia nome, ano de nascimento e carteira de trabalho e cadastre-os (com idade) em um dicionário. Se por acaso a CTPS for diferente de 0, o dicionário receberá também o ano de contratação e o salário. Calcule e acrescente , além da idade, com quantos anos a pessoa vai se aposentar. Considere que o trabalhador deve contribuir por 35 anos para se aposentar. ano = 2021 # ano atual que estamos dados = dict() # dicionário com os dados do usuário dados['Nome'] = input('Nome: ') # chave 'Nome' recebe valor dados['Idade'] = 2021 - int(input('Ano de nascimento: ')) # chave 'Idade' recebe ano de nascimento dados['CTPS'] = int(input('Carteira de trabalho: ')) # chave 'CTPS' recebe carteira de trabalho if dados['CTPS'] != 0: # se a carteira de trabalho for diferente de ZERO: dados['anoContratacao'] = int(input('Ano de contratação: ')) # o programa vai pedir ano de contratação e adicionar à chave 'anoContratacao' dados['Salário'] = int(input('Salário: ')) # o programa vai pedir salario e adicionar à chave 'Salário' aposentadoria = (dados['anoContratacao'] + 35) - 1998 # cria uma variável que recebe com quantos anos a pessoa vai se aposentar. Para isso, soma o ano de contratação + 35 anos de serviço - ano de nascimento print(f'Você irá se aposentar com {aposentadoria} anos.') else: print('Não sei quando você vai se aposentar...')
with open("p022_names.txt","r") as names: names = names.read().replace("\"","").split(",") names.sort() Sum = 0 length = len(names) for position in range(length): alphavalue=0 for j in names[position]: alphavalue += (ord(j)-64) Sum += (alphavalue * (position+1)) print(Sum)
config = { 'population_size' : 100, 'mutation_probability' : .1, 'crossover_rate' : .9, # maximum simulation runs before finishing 'max_runs' : 100, # maximum timesteps per simulation 'max_timesteps' : 150, # smoothness value of the line in [0, 1] 'line_smoothness' : .4, # Bound for our gain parameters (p, i, d) 'max_gain_value' : 3, # when set to 1, we create a new map this run. When set to 0, loads a new map 'new_map' : True, 'runs_per_screenshot' : 10, 'data_directory' : '/home/monk/genetic_pid_data', 'map_filename' : 'map.csv' }
expected_output = { 'mstp': { 'blocked-ports': { 'mst_instances': { '0': { 'mst_id': '0', 'interfaces': { 'GigabitEthernet0/0/4/4': { 'name': 'GigabitEthernet0/0/4/4', 'cost': 200000, 'role': 'ALT', 'port_priority': 128, 'port_num': 196, 'port_state': 'BLK', 'designated_bridge_priority': 4097, 'designated_bridge_address': '0004.9bff.8078', 'designated_port_priority': 128, 'designated_port_num': 195, }, }, }, }, }, }, }
class Solution: def containsNearbyAlmostDuplicate(self, nums: List[int], k: int, t: int) -> bool: tup = [(ind, i) for ind, i in enumerate(nums)] tup.sort(key=lambda x: x[1]) for i in range(len(tup)): for j in range(i+1, len(tup)): if abs(tup[i][1]-tup[j][1])>t: break if abs(tup[i][0]-tup[j][0])<=k: return True return False
del_items(0x80139F2C) SetType(0x80139F2C, "void PresOnlyTestRoutine__Fv()") del_items(0x80139F54) SetType(0x80139F54, "void FeInitBuffer__Fv()") del_items(0x80139F7C) SetType(0x80139F7C, "void FeAddEntry__Fii8TXT_JUSTUsP7FeTableP5CFont(int X, int Y, enum TXT_JUST Just, unsigned short Str, struct FeTable *MenuPtr, struct CFont *Font)") del_items(0x80139FF0) SetType(0x80139FF0, "void FeAddTable__FP11FeMenuTablei(struct FeMenuTable *Table, int Count)") del_items(0x8013A06C) SetType(0x8013A06C, "void FeAddNameTable__FPUci(unsigned char *Table, int Count)") del_items(0x8013A19C) SetType(0x8013A19C, "void FeDrawBuffer__Fv()") del_items(0x8013A5B0) SetType(0x8013A5B0, "void FeNewMenu__FP7FeTable(struct FeTable *Menu)") del_items(0x8013A630) SetType(0x8013A630, "void FePrevMenu__Fv()") del_items(0x8013A6DC) SetType(0x8013A6DC, "void FeSelUp__Fi(int No)") del_items(0x8013A7C4) SetType(0x8013A7C4, "void FeSelDown__Fi(int No)") del_items(0x8013A8A8) SetType(0x8013A8A8, "int FeGetCursor__Fv()") del_items(0x8013A8BC) SetType(0x8013A8BC, "void FeSelect__Fv()") del_items(0x8013A900) SetType(0x8013A900, "void FeMainKeyCtrl__FP7CScreen(struct CScreen *FeScreen)") del_items(0x8013AA98) SetType(0x8013AA98, "void InitDummyMenu__Fv()") del_items(0x8013AAA0) SetType(0x8013AAA0, "void InitFrontEnd__FP9FE_CREATE(struct FE_CREATE *CreateStruct)") del_items(0x8013AB60) SetType(0x8013AB60, "void FeInitMainMenu__Fv()") del_items(0x8013ABBC) SetType(0x8013ABBC, "void FeInitNewGameMenu__Fv()") del_items(0x8013AC0C) SetType(0x8013AC0C, "void FeNewGameMenuCtrl__Fv()") del_items(0x8013AD40) SetType(0x8013AD40, "void FeInitPlayer1ClassMenu__Fv()") del_items(0x8013ADB4) SetType(0x8013ADB4, "void FeInitPlayer2ClassMenu__Fv()") del_items(0x8013AE28) SetType(0x8013AE28, "void FePlayerClassMenuCtrl__Fv()") del_items(0x8013AE70) SetType(0x8013AE70, "void FeDrawChrClass__Fv()") del_items(0x8013B30C) SetType(0x8013B30C, "void FeInitNewP1NameMenu__Fv()") del_items(0x8013B354) SetType(0x8013B354, "void FeInitNewP2NameMenu__Fv()") del_items(0x8013B39C) SetType(0x8013B39C, "void FeNewNameMenuCtrl__Fv()") del_items(0x8013B92C) SetType(0x8013B92C, "void FeCopyPlayerInfoForReturn__Fv()") del_items(0x8013B9FC) SetType(0x8013B9FC, "void FeEnterGame__Fv()") del_items(0x8013BA24) SetType(0x8013BA24, "void FeInitLoadMemcardSelect__Fv()") del_items(0x8013BA8C) SetType(0x8013BA8C, "void FeInitLoadChar1Menu__Fv()") del_items(0x8013BAF8) SetType(0x8013BAF8, "void FeInitLoadChar2Menu__Fv()") del_items(0x8013BB64) SetType(0x8013BB64, "void FeInitDifficultyMenu__Fv()") del_items(0x8013BBAC) SetType(0x8013BBAC, "void FeDifficultyMenuCtrl__Fv()") del_items(0x8013BC64) SetType(0x8013BC64, "void FeInitBackgroundMenu__Fv()") del_items(0x8013BCAC) SetType(0x8013BCAC, "void FeInitBook1Menu__Fv()") del_items(0x8013BCF8) SetType(0x8013BCF8, "void FeInitBook2Menu__Fv()") del_items(0x8013BD44) SetType(0x8013BD44, "void FeBackBookMenuCtrl__Fv()") del_items(0x8013BF40) SetType(0x8013BF40, "void PlayDemo__Fv()") del_items(0x8013BF54) SetType(0x8013BF54, "void FadeFEOut__Fv()") del_items(0x8013C018) SetType(0x8013C018, "void DrawBackTSK__FP4TASK(struct TASK *T)") del_items(0x8013C110) SetType(0x8013C110, "void FrontEndTask__FP4TASK(struct TASK *T)") del_items(0x8013C488) SetType(0x8013C488, "void McMainCharKeyCtrl__Fv()") del_items(0x8013C890) SetType(0x8013C890, "void DrawFeTwinkle__Fii(int SelX, int SelY)") del_items(0x8013C950) SetType(0x8013C950, "void ___6Dialog(struct Dialog *this, int __in_chrg)") del_items(0x8013C978) SetType(0x8013C978, "struct Dialog *__6Dialog(struct Dialog *this)") del_items(0x8013C9D4) SetType(0x8013C9D4, "void ___7CScreen(struct CScreen *this, int __in_chrg)") del_items(0x8013C9F4) SetType(0x8013C9F4, "unsigned char CheckActive__4CPad(struct CPad *this)") del_items(0x8013D5A4) SetType(0x8013D5A4, "void InitCredits__Fv()") del_items(0x8013D5E0) SetType(0x8013D5E0, "int PrintCredits__FPciiiii(char *Str, int Y, int CharFade, int RFlag, int GFlag, int BFlag)") del_items(0x8013DE04) SetType(0x8013DE04, "void DrawCreditsTitle__Fiiiii(int TitleNo, int TitleFade, int TitleMode, int NextTitleNo, int Y)") del_items(0x8013DED0) SetType(0x8013DED0, "void DrawCreditsSubTitle__Fiiiii(int SubTitleNo, int SubTitleFade, int SubTitleMode, int NextSubTitleNo, int Y)") del_items(0x8013DFAC) SetType(0x8013DFAC, "void DoCredits__Fv()") del_items(0x8013E230) SetType(0x8013E230, "void PRIM_GetPrim__FPP8POLY_FT4(struct POLY_FT4 **Prim)") del_items(0x8013E2AC) SetType(0x8013E2AC, "int GetCharHeight__5CFontc(struct CFont *this, char ch)") del_items(0x8013E2EC) SetType(0x8013E2EC, "int GetCharWidth__5CFontc(struct CFont *this, char ch)") del_items(0x8013E344) SetType(0x8013E344, "void ___7CScreen_addr_8013E344(struct CScreen *this, int __in_chrg)") del_items(0x8013E364) SetType(0x8013E364, "struct FRAME_HDR *GetFr__7TextDati(struct TextDat *this, int FrNum)") del_items(0x80142920) SetType(0x80142920, "void endian_swap__FPUci(unsigned char *b, int byts)") del_items(0x80142954) SetType(0x80142954, "unsigned short to_sjis__Fc(char asc)") del_items(0x801429D4) SetType(0x801429D4, "char to_ascii__FUs(unsigned short sjis)") del_items(0x80142A54) SetType(0x80142A54, "void ascii_to_sjis__FPcPUs(char *asc, unsigned short *sjis)") del_items(0x80142AD8) SetType(0x80142AD8, "void sjis_to_ascii__FPUsPc(unsigned short *sjis, char *asc)") del_items(0x80142B50) SetType(0x80142B50, "void read_card_directory__Fi(int card_number)") del_items(0x80142D5C) SetType(0x80142D5C, "int test_card_format__Fi(int card_number)") del_items(0x80142E4C) SetType(0x80142E4C, "int checksum_data__FPci(char *buf, int size)") del_items(0x80142E88) SetType(0x80142E88, "int delete_card_file__Fii(int card_number, int file)") del_items(0x80142F80) SetType(0x80142F80, "int read_card_file__FiiiPc(int card_number, int file, int id, char *buf)") del_items(0x80143144) SetType(0x80143144, "int format_card__Fi(int card_number)") del_items(0x80143208) SetType(0x80143208, "int write_card_file__FiiPcT2PUcPUsiT4(int card_number, int id, char *name, char *title, unsigned char *icon, unsigned short *clut, int size, unsigned char *buf)") del_items(0x80143560) SetType(0x80143560, "void new_card__Fi(int card_number)") del_items(0x801435F4) SetType(0x801435F4, "void service_card__Fi(int card_number)") del_items(0x8015D834) SetType(0x8015D834, "int GetFileNumber__FiPc(int side, char *file_name)") del_items(0x8015D8F4) SetType(0x8015D8F4, "int DoSaveOptions__Fv()") del_items(0x8015D948) SetType(0x8015D948, "int DoSaveCharacter__FPc(char *savefilename)") del_items(0x8015DA18) SetType(0x8015DA18, "int DoSaveGame__Fv()") del_items(0x8015DAD8) SetType(0x8015DAD8, "void DoLoadGame__Fv()") del_items(0x8015DB68) SetType(0x8015DB68, "int DoFrontEndLoadCharacter__FPc(char *loadfilenameptr)") del_items(0x8015DBC4) SetType(0x8015DBC4, "void McInitLoadCard1Menu__Fv()") del_items(0x8015DC10) SetType(0x8015DC10, "void McInitLoadCard2Menu__Fv()") del_items(0x8015DC5C) SetType(0x8015DC5C, "void ChooseCardLoad__Fv()") del_items(0x8015DD10) SetType(0x8015DD10, "void McInitLoadCharMenu__Fv()") del_items(0x8015DD38) SetType(0x8015DD38, "void McInitLoadGameMenu__Fv()") del_items(0x8015DD94) SetType(0x8015DD94, "void McMainKeyCtrl__Fv()") del_items(0x8015DED0) SetType(0x8015DED0, "void ShowAlertBox__Fv()") del_items(0x8015E0A4) SetType(0x8015E0A4, "void ShowCardActionText__FPc(char *Text)") del_items(0x8015E1E8) SetType(0x8015E1E8, "bool GetLoadStatusMessage__FPc(char *file_name)") del_items(0x8015E28C) SetType(0x8015E28C, "bool GetSaveStatusMessage__FiPc(int fileblocks, char *file_name)") del_items(0x8015E364) SetType(0x8015E364, "void ShowGameFiles__FPciiG4RECT(char *filename, int saveflag, int Spacing, struct RECT ORect)") del_items(0x8015E4CC) SetType(0x8015E4CC, "void SetRGB__6DialogUcUcUc(struct Dialog *this, unsigned char R, unsigned char G, unsigned char B)") del_items(0x8015E4EC) SetType(0x8015E4EC, "void SetBack__6Dialogi(struct Dialog *this, int Type)") del_items(0x8015E4F4) SetType(0x8015E4F4, "void SetBorder__6Dialogi(struct Dialog *this, int Type)") del_items(0x8015E4FC) SetType(0x8015E4FC, "int SetOTpos__6Dialogi(struct Dialog *this, int OT)") del_items(0x8015E508) SetType(0x8015E508, "void ___6Dialog_addr_8015E508(struct Dialog *this, int __in_chrg)") del_items(0x8015E530) SetType(0x8015E530, "struct Dialog *__6Dialog_addr_8015E530(struct Dialog *this)") del_items(0x8015E58C) SetType(0x8015E58C, "int ILoad__Fv()") del_items(0x8015E5E0) SetType(0x8015E5E0, "void LoadQuest__Fi(int i)") del_items(0x8015E6A8) SetType(0x8015E6A8, "void ISave__Fi(int v)") del_items(0x8015E708) SetType(0x8015E708, "void SaveQuest__Fi(int i)") del_items(0x8015E7D4) SetType(0x8015E7D4, "int PSX_GM_SaveGame__FiPcT1(int card_number, char *name, char *title)") del_items(0x8015EA74) SetType(0x8015EA74, "int PSX_GM_LoadGame__FUcii(unsigned char firstflag, int card_number, int file)") del_items(0x8015ED60) SetType(0x8015ED60, "int PSX_CH_LoadGame__Fii(int card_number, int file)") del_items(0x8015EEC4) SetType(0x8015EEC4, "int PSX_CH_SaveGame__FiPcT1(int card_number, char *name, char *title)") del_items(0x8015F044) SetType(0x8015F044, "void RestorePads__Fv()") del_items(0x8015F104) SetType(0x8015F104, "void StorePads__Fv()") del_items(0x8015F1C0) SetType(0x8015F1C0, "void GetIcon__Fv()") del_items(0x8015F1FC) SetType(0x8015F1FC, "int PSX_OPT_LoadGame__Fiib(int card_number, int file, bool KillHandler)") del_items(0x8015F260) SetType(0x8015F260, "int PSX_OPT_SaveGame__FiPc(int card_number, char *filename)") del_items(0x8015F2F8) SetType(0x8015F2F8, "void LoadOptions__Fv()") del_items(0x8015F368) SetType(0x8015F368, "void SaveOptions__Fv()")
# -*- coding: utf-8 -*- # Create and print a dictionary: thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 } print(thisdict) # Duplicate values will overwrite existing values: thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964, "year": 2020 } print(thisdict) # String, int, boolean, and list data types: thisdict = { "brand": "Ford", "electric": False, "year": 1964, "colors": ["red", "white", "blue"] } # Nested way child1 = { "name" : "Emil", "year" : 2004 } child2 = { "name" : "Tobias", "year" : 2007 } child3 = { "name" : "Linus", "year" : 2011 } myfamily = { "child1" : child1, "child2" : child2, "child3" : child3 } print(myfamily)
''' e. and use all methods ''' ''' also try different exception like java file,array,string,numberformat ''' ''' user define exception ''' try: raise Exception('spam,','eggs') except Exception as inst: print("Type of instance : ",type(inst)) # the exception instance print("Arguments of instance : ",inst.args) # arguments stored in .args print("Instance print : ",inst) # __str__ allows args to be printed directly,but may be overridden in exception subclasses a,b = inst.args # unpack args print("a : ",a) print("b : ",b)
def is_palindrome_number(number): return number == int(str(number)[::-1]) def infinite_sequence(): num = 0 while True: yield num num += 1 for number in infinite_sequence(): if is_palindrome_number(number): print(number) def countdown_from(number): print(f"Starting to count from {number}!") while number > 0: yield number number -= 1 print("Done!") def increment(start, stop): yield from range(start, stop) if __name__ == "__main__": countdown = countdown_from(number=10) for count in countdown: print(count) incremental = increment(start=1, stop=10) for inc in incremental: print(inc)
TEST_ROOT_TABLES = { "tenders": ["/tender"], "awards": ["/awards"], "contracts": ["/contracts"], "planning": ["/planning"], "parties": ["/parties"], } TEST_COMBINED_TABLES = { "documents": [ "/planning/documents", "/tender/documents", "/awards/documents", "/contracts/documents", "/contracts/implementation/documents", ], "milestones": [ "/planning/milestones", "/tender/milestones", "/contracts/milestones", "/contracts/implementation/milestones", ], "amendments": [ "/planning/amendments", "/tender/amendments", "/awards/amendments", "/contracts/amendments", "/contracts/implementation/amendments", ], } tenders_columns = [ "/tender/id", "/tender/title", "/tender/description", "/tender/status", "/tender/procurementMethod", "/tender/procurementMethodDetails", "/tender/procurementMethodRationale", "/tender/mainProcurementCategory", "/tender/additionalProcurementCategories", "/tender/awardCriteria", "/tender/awardCriteriaDetails", "/tender/submissionMethodDetails", "/tender/submissionMethod", "/tender/hasEnquiries", "/tender/eligibilityCriteria", "/tender/numberOfTenderers", "/tender/contractPeriod/startDate", "/tender/contractPeriod/endDate", "/tender/contractPeriod/maxExtentDate", "/tender/contractPeriod/durationInDays", "/tender/awardPeriod/startDate", "/tender/awardPeriod/endDate", "/tender/awardPeriod/maxExtentDate", "/tender/awardPeriod/durationInDays", "/tender/enquiryPeriod/startDate", "/tender/enquiryPeriod/endDate", "/tender/enquiryPeriod/maxExtentDate", "/tender/enquiryPeriod/durationInDays", "/tender/tenderPeriod/startDate", "/tender/tenderPeriod/endDate", "/tender/tenderPeriod/maxExtentDate", "/tender/tenderPeriod/durationInDays", "/tender/minValue/amount", "/tender/minValue/currency", "/tender/value/amount", "/tender/value/currency", "/tender/procuringEntity/name", "/tender/procuringEntity/id", ] tenders_arrays = [ "/tender/items", "/tender/tenderers", "/tender/items/additionalClassifications", ] tenders_combined_columns = [ "/tender/id", "/tender/title", "/tender/description", "/tender/status", "/tender/procurementMethod", "/tender/procurementMethodDetails", "/tender/procurementMethodRationale", "/tender/mainProcurementCategory", "/tender/additionalProcurementCategories", "/tender/awardCriteria", "/tender/awardCriteriaDetails", "/tender/submissionMethod", "/tender/submissionMethodDetails", "/tender/hasEnquiries", "/tender/eligibilityCriteria", "/tender/numberOfTenderers", "/tender/tenderers/0/name", "/tender/tenderers/0/id", "/tender/contractPeriod/startDate", "/tender/contractPeriod/endDate", "/tender/contractPeriod/maxExtentDate", "/tender/contractPeriod/durationInDays", "/tender/awardPeriod/startDate", "/tender/awardPeriod/endDate", "/tender/awardPeriod/maxExtentDate", "/tender/awardPeriod/durationInDays", "/tender/enquiryPeriod/startDate", "/tender/enquiryPeriod/endDate", "/tender/enquiryPeriod/maxExtentDate", "/tender/enquiryPeriod/durationInDays", "/tender/tenderPeriod/startDate", "/tender/tenderPeriod/endDate", "/tender/tenderPeriod/maxExtentDate", "/tender/tenderPeriod/durationInDays", "/tender/minValue/amount", "/tender/minValue/currency", "/tender/value/amount", "/tender/value/currency", "/tender/items/0/id", "/tender/items/0/description", "/tender/items/0/quantity", "/tender/items/0/unit/scheme", "/tender/items/0/unit/id", "/tender/items/0/unit/name", "/tender/items/0/unit/uri", "/tender/items/0/unit/value/amount", "/tender/items/0/unit/value/currency", "/tender/items/0/additionalClassifications/0/scheme", "/tender/items/0/additionalClassifications/0/id", "/tender/items/0/additionalClassifications/0/description", "/tender/items/0/additionalClassifications/0/uri", "/tender/items/0/classification/scheme", "/tender/items/0/classification/id", "/tender/items/0/classification/description", "/tender/items/0/classification/uri", "/tender/procuringEntity/name", "/tender/procuringEntity/id", ] awards_columns = [ "/awards/id", "/awards/title", "/awards/description", "/awards/status", "/awards/date", "/awards/contractPeriod/startDate", "/awards/contractPeriod/endDate", "/awards/contractPeriod/maxExtentDate", "/awards/contractPeriod/durationInDays", "/awards/value/amount", "/awards/value/currency", ] awards_combined_columns = [ "/awards/id", "/awards/title", "/awards/description", "/awards/status", "/awards/date", "/awards/contractPeriod/startDate", "/awards/contractPeriod/endDate", "/awards/contractPeriod/maxExtentDate", "/awards/contractPeriod/durationInDays", "/awards/items/0/id", "/awards/items/0/description", "/awards/items/0/quantity", "/awards/items/0/unit/scheme", "/awards/items/0/unit/id", "/awards/items/0/unit/name", "/awards/items/0/unit/uri", "/awards/items/0/unit/value/amount", "/awards/items/0/unit/value/currency", "/awards/items/0/additionalClassifications/0/scheme", "/awards/items/0/additionalClassifications/0/id", "/awards/items/0/additionalClassifications/0/description", "/awards/items/0/additionalClassifications/0/uri", "/awards/items/0/classification/scheme", "/awards/items/0/classification/id", "/awards/items/0/classification/description", "/awards/items/0/classification/uri", "/awards/suppliers/0/name", "/awards/suppliers/0/id", "/awards/value/amount", "/awards/value/currency", ] awards_arrays = [ "/awards/suppliers", "/awards/items", "/awards/items/additionalClassifications", ] contracts_columns = [ "/contracts/id", "/contracts/awardID", "/contracts/title", "/contracts/description", "/contracts/status", "/contracts/dateSigned", "/contracts/value/amount", "/contracts/value/currency", "/contracts/period/startDate", "/contracts/period/endDate", "/contracts/period/maxExtentDate", "/contracts/period/durationInDays", ] contracts_arrays = [ "/contracts/items", "/contracts/relatedProcesses", "/contracts/implementation/transactions", "/contracts/items/additionalClassifications", ] contracts_combined_columns = [ "/contracts/id", "/contracts/awardID", "/contracts/title", "/contracts/description", "/contracts/status", "/contracts/dateSigned", "/contracts/relatedProcesses/0/id", "/contracts/relatedProcesses/0/relationship", "/contracts/relatedProcesses/0/title", "/contracts/relatedProcesses/0/scheme", "/contracts/relatedProcesses/0/identifier", "/contracts/relatedProcesses/0/uri", "/contracts/implementation/transactions/0/id", "/contracts/implementation/transactions/0/source", "/contracts/implementation/transactions/0/date", "/contracts/implementation/transactions/0/uri", "/contracts/implementation/transactions/0/payee/name", "/contracts/implementation/transactions/0/payee/id", "/contracts/implementation/transactions/0/payer/name", "/contracts/implementation/transactions/0/payer/id", "/contracts/implementation/transactions/0/value/amount", "/contracts/implementation/transactions/0/value/currency", "/contracts/items/0/id", "/contracts/items/0/description", "/contracts/items/0/quantity", "/contracts/items/0/unit/scheme", "/contracts/items/0/unit/id", "/contracts/items/0/unit/name", "/contracts/items/0/unit/uri", "/contracts/items/0/unit/value/amount", "/contracts/items/0/unit/value/currency", "/contracts/items/0/additionalClassifications/0/scheme", "/contracts/items/0/additionalClassifications/0/id", "/contracts/items/0/additionalClassifications/0/description", "/contracts/items/0/additionalClassifications/0/uri", "/contracts/items/0/classification/scheme", "/contracts/items/0/classification/id", "/contracts/items/0/classification/description", "/contracts/items/0/classification/uri", "/contracts/value/amount", "/contracts/value/currency", "/contracts/period/startDate", "/contracts/period/endDate", "/contracts/period/maxExtentDate", "/contracts/period/durationInDays", ] planning_columns = [ "/planning/rationale", "/planning/budget/id", "/planning/budget/description", "/planning/budget/project", "/planning/budget/projectID", "/planning/budget/uri", "/planning/budget/amount/amount", "/planning/budget/amount/currency", ] planning_combined_columns = [ "/planning/rationale", "/planning/budget/id", "/planning/budget/description", "/planning/budget/project", "/planning/budget/projectID", "/planning/budget/uri", "/planning/budget/amount/amount", "/planning/budget/amount/currency", ] planning_arrays = [] parties_arrays = ["/parties/additionalIdentifiers"] parties_columns = [ "/parties/name", "/parties/id", "/parties/roles", "/parties/contactPoint/name", "/parties/contactPoint/email", "/parties/contactPoint/telephone", "/parties/contactPoint/faxNumber", "/parties/contactPoint/url", "/parties/address/streetAddress", "/parties/address/locality", "/parties/address/region", "/parties/address/postalCode", "/parties/address/countryName", "/parties/identifier/scheme", "/parties/identifier/id", "/parties/identifier/legalName", "/parties/identifier/uri", ] parties_combined_columns = [ "/parties/name", "/parties/id", "/parties/roles", "/parties/roles", "/parties/contactPoint/name", "/parties/contactPoint/email", "/parties/contactPoint/telephone", "/parties/contactPoint/faxNumber", "/parties/contactPoint/url", "/parties/address/streetAddress", "/parties/address/locality", "/parties/address/region", "/parties/address/postalCode", "/parties/address/countryName", "/parties/additionalIdentifiers/0/scheme", "/parties/additionalIdentifiers/0/id", "/parties/additionalIdentifiers/0/legalName", "/parties/additionalIdentifiers/0/uri", "/parties/identifier/scheme", "/parties/identifier/id", "/parties/identifier/legalName", "/parties/identifier/uri", ]
"""Diagnose audio and other input data for ML pipelines >>> print('hello') hello """
def pattern_nineteen(steps): ''' Pattern nineteen 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24 30 36 42 48 54 60 7 14 21 28 35 42 49 56 63 70 8 16 24 32 40 48 56 64 72 80 9 18 27 36 45 54 63 72 81 90 10 20 30 40 50 60 70 80 90 100 ''' for i in range(1, steps + 1): num_list = [] for j in range(1, steps + 1): num_list.append(str(i * j).ljust(4)) # Change 3 to different value if i * j is more than 3 digits print(' '.join(num_list)) if __name__ == '__main__': try: pattern_nineteen(10) except NameError: print('Integer was expected')
n1 = float(input('qual a primeira nota? ')) n2 = float(input('qual a segunda nota? ')) soma = n1 + n2 media = (n1 + n2) / 2 print('a soma das notas foi {:.2f}, e a sua media foi de {:.2f}'.format(soma, media))
''' 02 - Creating dummy variables As Andy discussed in the video, scikit-learn does not accept non-numerical features. You saw in the previous exercise that the 'Region' feature contains very useful information that can predict life expectancy. For example: Sub-Saharan Africa has a lower life expectancy compared to Europe and Central Asia. Therefore, if you are trying to predict life expectancy, it would be preferable to retain the 'Region' feature. To do this, you need to binarize it by creating dummy variables, which is what you will do in this exercise. INSTRUCTIONS - Use the pandas get_dummies() function to create dummy variables from the df DataFrame. Store the result as df_region. - Print the columns of df_region. This has been done for you. - Use the get_dummies() function again, this time specifying drop_first=True to drop the unneeded dummy variable (in this case, 'Region_America'). - Hit 'Submit Answer to print the new columns of df_region and take note of how one column was dropped! ''' # Create dummy variables: df_region df_region = pd.get_dummies(df) # Print the columns of df_region print(df_region.columns) # Create dummy variables with drop_first=True: df_region df_region = pd.get_dummies(df, drop_first=True) # Print the new columns of df_region print(df_region.columns) ''' Index(['population', 'fertility', 'HIV', 'CO2', 'BMI_male', 'GDP', 'BMI_female', 'life', 'child_mortality', 'Region_America', 'Region_East Asia & Pacific', 'Region_Europe & Central Asia', 'Region_Middle East & North Africa', 'Region_South Asia', 'Region_Sub-Saharan Africa'], dtype='object') Index(['population', 'fertility', 'HIV', 'CO2', 'BMI_male', 'GDP', 'BMI_female', 'life', 'child_mortality', 'Region_East Asia & Pacific', 'Region_Europe & Central Asia', 'Region_Middle East & North Africa', 'Region_South Asia', 'Region_Sub-Saharan Africa'], dtype='object') '''
# Given three colinear points p, q, r, the function checks if # point q lies on line segment 'pr' def onSegment(p, q, r): if ( (q.position[0] <= max(p.position[0], r.position[0])) and (q.position[0] >= min(p.position[0], r.position[0])) and (q.position[1] <= max(p.position[1], r.position[1])) and (q.position[1] >= min(p.position[1], r.position[1]))): return True return False def orientation(p, q, r): # to find the orientation of an ordered triplet (p,q,r) # function returns the following values: # 0 : Colinear points # 1 : Clockwise points # 2 : Counterclockwise # See https://www.geeksforgeeks.org/orientation-3-ordered-points/amp/ # for details of below formula. val = (float(q.position[1] - p.position[1]) * (r.position[0] - q.position[0])) - (float(q.position[0] - p.position[0]) * (r.position[1] - q.position[1])) if (val > 0): # Clockwise orientation return 1 elif (val < 0): # Counterclockwise orientation return 2 else: # Colinear orientation return 0 # The main function that returns true if # the line segment 'p1q1' and 'p2q2' intersect. def doIntersect(p1,q1,p2,q2): if (p1.position == p2.position or p1.position == q2.position or q1.position == p2.position or q1.position == q2.position): return False # Find the 4 orientations required for # the general and special cases o1 = orientation(p1, q1, p2) o2 = orientation(p1, q1, q2) o3 = orientation(p2, q2, p1) o4 = orientation(p2, q2, q1) # General case if ((o1 != o2) and (o3 != o4)): return True # Special Cases # p1 , q1 and p2 are colinear and p2 lies on segment p1q1 if ((o1 == 0) and onSegment(p1, p2, q1)): return True # p1 , q1 and q2 are colinear and q2 lies on segment p1q1 if ((o2 == 0) and onSegment(p1, q2, q1)): return True # p2 , q2 and p1 are colinear and p1 lies on segment p2q2 if ((o3 == 0) and onSegment(p2, p1, q2)): return True # p2 , q2 and q1 are colinear and q1 lies on segment p2q2 if ((o4 == 0) and onSegment(p2, q1, q2)): return True # If none of the cases return False # # Driver program to test above functions: # p1 = Point(1, 1) # q1 = Point(10, 1) # p2 = Point(1, 2) # q2 = Point(10, 2) # if doIntersect(p1, q1, p2, q2): # print("Yes") # else: # print("No") # p1 = Point(10, 0) # q1 = Point(0, 10) # p2 = Point(0, 0) # q2 = Point(10,10) # if doIntersect(p1, q1, p2, q2): # print("Yes") # else: # print("No") # p1 = Point(-5,-5) # q1 = Point(0, 0) # p2 = Point(1, 1) # q2 = Point(10, 10) # if doIntersect(p1, q1, p2, q2): # print("Yes") # else: # print("No")
class SystemCallFault(Exception): def __init__(self): pass def __str__(self): return 'System not give expect response.' class NecessaryLibraryNotFound(Exception): def __init__(self,value = '?'): self.value = value def __str__(self): return 'Necessary library \'%s\' not found.'%self.value
string = "Character" print(string[2]) # string[2] = 'A' not change it # string.replace('a','A') we can replace it but it cannot change the our string variables. new_string = string.replace('a','A') print(new_string)
## CvAltRoot ## ## Tells BUG where to locate its files when it cannot find them normally. ## This is common when using the /AltRoot Civ4 feature or sometimes on ## non-English operating systems and Windows Vista. ## ## HOW TO USE ## ## 1. Change the text in the quotes below to match the full path to the ## "Beyond the Sword" folder that contains the CivilizationIV.ini file. ## Make sure to use forward slashes (/), even for Windows paths. ## ## Windows XP: "C:/Documents and Settings/[UserName]/My Documents/My Games/Beyond the Sword" ## ## Windows Vista: "C:/Users/[UserName]/Documents/My Games/Beyond the Sword" ## ## MacOS: "/home/[UserName]/Documents/Beyond the Sword" ## ## 2. Copy this file to the "Python" folder. ## When BUG is installed as a mod, the folder is "Assets/Python". ## When BUG is installed normally, the folder is "CustomAssets/Python". ## ## Copyright (c) 2008 The BUG Mod. ## ## Author: EmperorFool rootDir = "C:/Documents and Settings/[UserName]/My Documents/My Games/Beyond the Sword"
####################################################################### # Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) # # Permission given to modify the code as long as you keep this # # declaration at the top # ####################################################################### class Config: q_target = 0 expected_sarsa_target = 1 def __init__(self): self.task_fn = None self.optimizer_fn = None self.actor_optimizer_fn = None self.critic_optimizer_fn = None self.network_fn = None self.actor_network_fn = None self.critic_network_fn = None self.policy_fn = None self.replay_fn = None self.random_process_fn = None self.discount = 0.99 self.target_network_update_freq = 0 self.max_episode_length = 0 self.exploration_steps = 0 self.logger = None self.history_length = 1 self.test_interval = 100 self.test_repetitions = 50 self.double_q = False self.tag = 'vanilla' self.num_workers = 1 self.worker = None self.update_interval = 1 self.gradient_clip = 40 self.entropy_weight = 0.01 self.use_gae = True self.gae_tau = 1.0 self.noise_decay_interval = 0 self.target_network_mix = 0.001 self.action_shift_fn = lambda a: a self.reward_shift_fn = lambda r: r self.reward_weight = 1 self.hybrid_reward = False self.target_type = self.q_target self.episode_limit = 0 self.min_memory_size = 200 self.master_fn = None self.master_optimizer_fn = None self.num_heads = 10 self.min_epsilon = 0 self.save_interval = 0 self.max_steps = 0 self.success_threshold = float('inf') self.render_episode_freq = 0 self.rollout_length = None self.value_loss_weight = 1.0 self.iteration_log_interval = 30 self.categorical_v_min = -10 self.categorical_v_max = 10 self.categorical_n_atoms = 51
# question 1 A = 3 B = 3 C = (-5) X = 8.8 Y = 3.5 Z = (-5.2) print(A % C) print(A * B / C) print((A * C) % C) print(X / Y) print(X / (X + Y)) print(int(X) % int(Y)) # question 2 A = float(input("the number you want to round off:")) print(round(A)) # question 3 A = float(input("length in CM:")) B = float(input("length in CM:")) C = (A / (12 * 5 / 2)) D = (B * 5 / 2) print(C, D) # question 4 A = int(input("enter the radius:")) print(4 / 3 * 3.14 * A * A * A) # question 5 F = float(input("enter the Teamprature in Celsius:")) C = (F * 9 / 5) + 32 print(C) # question 6 L = float(input("enter the lenght of rectangle:")) B = float(input("enter the width of rectangle:")) P = 2 * (L + B) print(P) # question 7 A = float(input("enter the first number")) B = float(input("enter the second number:")) C = float(input("enter the third number:")) M = float((A + B + C) / 2) print(M) ''' A=str(input("enter the pattern:")) print(A[0]) print((A[0]+A[1])*2) print((A[0]+A[1]+A[2])*2) ''' A = int(input("enter a integer")) B = int(input("enter a integer")) c = A + B - A % B print(c) AGE = int(input("enter you age")) if 15 <= AGE < 46: print("you are eligible ti ride roller coaster") else: print("you are eligible ti ride roller coaster") A = int(input("enter the number")) if (A % 5 == 0) and (A % 7 == 0): print("its divisible by 7 and 5") else: print("ts not divisible by 7 and 5") # vowels problem in school name = input("enter your name :") vowels = ["a", "e", "i", "o", "u"] if name[0] in vowels: print("name starts with vowels") else: print("name does not starts with vowels")
# coding=utf-8 setThrowException(True) class Nautilus: REMOTE = 0 LOCAL = 1 _tab = None _dirs = {} def __init__(self): self._dirs = {self.LOCAL: [], self.REMOTE: []} self._startNautilus() self._initWebdav() sleep(1) self._initLocal() def _startNautilus(self): openApp("/usr/bin/nautilus") wait(Pattern("1265282313623.png").similar(0.70).firstN(1)) def _initWebdav(self): click("1265202229746.png") click("1265202325039.png") click("1265202559414.png") click("1265278752490.png") type("1265278810480.png", "webdav") type(Pattern("1266393612873.png").similar(0.80).firstN(1), "secure_collection") type("1266320552496.png", "some") click("1265279597052.png") setThrowException(False) pwField = wait(Pattern("1266321197328.png").similar(0.70).firstN(1), 6000) # Nautilus stores password until user logs out if len(pwField) != 0: type(pwField.inside().find("1266321225325.png"), "thing") checkBoxes = find(Pattern("1266321321797.png").similar(0.70).firstN(1)) click(checkBoxes.inside().find(Pattern("1266321357040.png").similar(0.70).firstN(1))) click(Pattern("1266321387258.png").similar(0.70).firstN(1)) setThrowException(True) self._tab = self.REMOTE self._dirs[self.REMOTE].append("/") self._dirs[self.REMOTE].append("secure_collection") def _initLocal(self): type("t", KEY_CTRL) sleep(1) self._tab = self.LOCAL click("1265313336023.png") self._dirs[self.LOCAL].append("/") self.openLocal("1265314310481.png", "down") def switchRemote(self): if (self._tab == self.LOCAL): type(Key.PAGE_UP, KEY_CTRL) self._tab = self.REMOTE sleep(0.4) def switchLocal(self): if (self._tab == self.REMOTE): type(Key.PAGE_DOWN, KEY_CTRL) self._tab = self.LOCAL sleep(0.4) def openLocal(self, dirImg, dirName): self.switchLocal() self._open(dirImg, dirName) def _open(self, dirImg, dirName): doubleClick(dirImg) self._dirs[self._tab].append(dirName) def openRemote(self, dirImg, dirName): self.switchRemote() self._open(dirImg, dirName) def upRemote(self, dirName=None): self.switchRemote() sleep(1) self.goUp(dirName) def upLocal(self, dirName=None): self.switchLocal() sleep(1) self.goUp(dirName) def goUp(self, dirName): if dirName == None: click(Pattern("1266259183958.png").similar(0.90).firstN(1)) self._dirs[self._tab].pop() return while self._dirs[self._tab][-1] != dirName: click(Pattern("1266259183958.png").similar(0.90).firstN(1)) self._dirs[self._tab].pop() def copy(self): type("c", KEY_CTRL) def paste(self): type("v", KEY_CTRL) def rename(self, fileImg, newName, newFileImg): click(fileImg) sleep(0.2) type(Key.F2) sleep(0.5) type("a", KEY_CTRL) sleep(0.2) paste(newName) sleep(0.1) type(Key.ENTER) wait(newFileImg) class NautilusWebdavTest: _nautilus = None def __init__(self, nautilus): self._nautilus = nautilus def run(self): # secure_collection opened initially # self.testInitial() self.testListCollection() self.testDownloadSingle() self.testListSubdir() self.testDownloadMultiple() self.testCreateNewdir() self.testListNewdir() self.testUploadSingle() self.testCreateNewsubdir() self.testListNewsubdir() self.testUploadSingleOverwrite() self.testDeleteNewdir() self.testUploadNew() self.testDownloadUploaded() self.testRenameFiles() self.testCopyFilesRemote() self.testRenameCollection() def testInitial(self): self._nautilus.switchRemote() find(Pattern("1265793342336.png").similar(0.70).firstN(1)) def testListCollection(self): # secure_collection opened on init # self._nautilus.openRemote("1265279909203.png", "collection") self._nautilus.switchRemote() find(Pattern("1265793562509.png").similar(0.70).firstN(1)) def testDownloadSingle(self): self._nautilus.switchRemote() click(Pattern("1265314613379.png").similar(0.95).firstN(1)) self._nautilus.copy() self._nautilus.switchLocal() sleep(1) self._nautilus.paste() sleep(1) find(Pattern("1266397437910.png").similar(0.80).firstN(1)) def testListSubdir(self): self._nautilus.openRemote("1265315881723.png", "subdir") find("1265315899109.png") def testDownloadMultiple(self): self._nautilus.switchRemote() click(Pattern("1265795508414.png").similar(0.70).firstN(1)) type(Key.DOWN, KEY_SHIFT) self._nautilus.copy() sleep(1) self._nautilus.switchLocal() sleep(1) self._nautilus.paste() sleep(1) find(Pattern("1265822372031.png").similar(0.90).firstN(1)) def testCreateNewdir(self): self._nautilus.switchRemote() type("n", KEY_CTRL | KEY_SHIFT) sleep(1) type("newdir") type("\n") find(Pattern("1266256110323.png").similar(0.90).firstN(1)) def testListNewdir(self): self._nautilus.openRemote("1266256707500.png", "newdir") find(Pattern("1266256773322.png").similar(0.90).firstN(1)) def testUploadSingle(self): self._nautilus.switchLocal() click(Pattern("1266256870724.png").similar(0.90).firstN(1)) self._nautilus.copy() self._nautilus.switchRemote() self._nautilus.paste() find(Pattern("1266256969255.png").similar(0.90).firstN(1)) def testCreateNewsubdir(self): self._nautilus.switchRemote() type("n", KEY_CTRL | KEY_SHIFT) sleep(1) type("newsubdir") type("\n") find(Pattern("1266257989662.png").similar(0.90).firstN(1)) def testListNewsubdir(self): self._nautilus.openRemote("1266256707500.png", "newdir") find(Pattern("1266258293601.png").similar(0.90).firstN(1)) def testUploadSingleOverwrite(self): self._nautilus.switchLocal() click(Pattern("1266257097775.png").similar(0.90).firstN(1)) self._nautilus.copy() self._nautilus.switchRemote() self._nautilus.paste() find(Pattern("1266258371198.png").similar(0.78).firstN(1)) self._nautilus.switchLocal() click(Pattern("1266257097775.png").similar(0.90).firstN(1)) self._nautilus.copy() self._nautilus.switchRemote() self._nautilus.paste() wait(Pattern("1266397752968.png").similar(0.80).firstN(1)) dialog = find(Pattern("1266397783288.png").similar(0.80).firstN(1)) click(dialog.inside().find(Pattern("1266257459272.png").similar(0.90).firstN(1))) find(Pattern("1266258834123.png").similar(0.90).firstN(1)) def testDeleteNewdir(self): self._nautilus.upRemote("secure_collection") click(Pattern("1266259247619.png").similar(0.90).firstN(1)) type(Key.DELETE) wait(Pattern("1266259486059.png").similar(0.55).firstN(1)) dialog = find(Pattern("1266259486059.png").similar(0.55).firstN(1)) click(dialog.inside().find(Pattern("1266259533961.png").similar(0.90).firstN(1))) sleep(1) find(Pattern("1266398284223.png").similar(0.80).firstN(1)) def testUploadNew(self): self._nautilus.upLocal("/") self._nautilus.openLocal(Pattern("1266259890975.png").similar(0.90).firstN(1), "up") type("a", KEY_CTRL) sleep(0.5) self._nautilus.copy() self._nautilus.switchRemote() sleep(1) self._nautilus.paste() find(Pattern("1266398512093.png").similar(0.70).firstN(1)) find(Pattern("1266398764125.png").similar(0.80).firstN(1)) def testDownloadUploaded(self): self._nautilus.switchRemote() # downloading dirs is broken in Nautilus click(Pattern("1266269427884.png").similar(0.90).firstN(1)) type(Key.DOWN, KEY_SHIFT) type(Key.DOWN, KEY_SHIFT) type(Key.DOWN, KEY_SHIFT) self._nautilus.copy() self._nautilus.upLocal("/") self._nautilus.openLocal("1265314310481.png", "down") self._nautilus.paste() def testRenameFiles(self): self._nautilus.switchRemote() self._nautilus.rename("1266270237742.png", u"put_test_renamed.xml", Pattern("1266270332525.png").similar(0.90).firstN(1)) self._nautilus.rename("1266270356862.png", u"put_test_utf8_\u00f6\u00e4\u00fc\u00df.txt", Pattern("1266274332854.png").similar(0.80).firstN(1)) self._nautilus.rename(Pattern("1266270558156.png").similar(0.90).firstN(1), u"put_non_utf8_test.txt", Pattern("1266270602424.png").similar(0.90).firstN(1)) def testCopyFilesRemote(self): self._nautilus.switchRemote() click(Pattern("1266274684143.png").similar(0.80).firstN(1)) # invert selection type("i", KEY_CTRL | KEY_SHIFT) sleep(1) self._nautilus.copy() self._nautilus.openRemote(Pattern("1266274684143.png").similar(0.80).firstN(1), "collection") sleep(1) self._nautilus.paste() wait(Pattern("1266311546228.png").similar(0.70).firstN(1)) find(Pattern("1266311574320.png").similar(0.70).firstN(1)) find(Pattern("1266311712385.png").similar(0.70).firstN(1)) def testRenameCollection(self): self._nautilus.upRemote() self._nautilus.rename(Pattern("1266310197088.png").similar(0.90).firstN(1), "renamed_collection", Pattern("1266310220931.png").similar(0.90).firstN(1)) nautilus = Nautilus() test = NautilusWebdavTest(nautilus) test.run()
def policy_threshold(threshold, belief, loc): """ chooses whether to switch side based on whether the belief on the current site drops below the threshold Args: threshold (float): the threshold of belief on the current site, when the belief is lower than the threshold, switch side belief (numpy array of float, 2-dimensional): the belief on the two sites at a certain time loc (int) : the location of the agent at a certain time -1 for left side, 1 for right side Returns: act (string): "stay" or "switch" """ # Write the if statement if belief[(loc + 1) // 2] <= threshold: # action below threshold act = "switch" else: # action above threshold act = "stay" return act test_policy_threshold()
print((2**64).to_bytes(9, "little",signed=False)) #signed shall be False by default print((2**64).to_bytes(9, "little")) # test min/max signed value for i in [10]: v = 2**(i*8 - 1) - 1 print(v) vbytes = v.to_bytes(i, "little") print(vbytes) print(int.from_bytes(vbytes,"little")) v = - (2**(i*8 - 1)) print(v) vbytes = v.to_bytes(i, "little",signed=True) print(vbytes) print(int.from_bytes(vbytes,"little",signed=True)) # negative number should raise an error if signed=False try: (- (2**64)).to_bytes(9, "little",signed=False) except OverflowError: print("OverflowError")
'''Crie um programa onde o usuário possa digitar vários valores numéricos e cadastre-os em uma lista. Caso o número já exista lá dentro, ele não será adicionado. No final, serão exibidos todos os valores únicos digitados, em ordem crescente.''' lista = [] print('\033[1;33m-=\033[m' * 20) while True: n1 = int(input('\033[34mDigite um valor:\033[m ')) if n1 not in lista: lista.append(n1) print('\033[32mValor adicionado com sucesso...\033[m') elif n1 in lista: print('\033[31mValor duplicado! Não vou adicionar...\033[m') sair = ' ' while sair not in 'SN': continuar = str(input('\033[37mContinuar [S/N]:\033[m ')).strip().upper()[0] sair = continuar if sair in 'N': break print('\033[1;33m-=\033[m' * 20) print('\033[1;33m-=\033[m' * 20) print(f'\033[35mVocê digitou os valores {sorted(lista)}\033[m') print('\033[1;33m-=\033[m' * 20) print('\033[1;32mFIM\033[m')
x = int(input('Podaj pierwsza liczbe calkowita: ')) y = int(input('Podaj druga liczbe calkowita: ')) print() print(x%y) print(y%x) print() print(x//y) print(y//x)
SEAL_CHECKER = 9300535 SEAL_OF_TIME_1 = 2159363 SEAL_OF_TIME_2 = 2159364 SEAL_OF_TIME_3 = 2159365 SEAL_OF_TIME_4 = 2159366 sm.giveSkill(20041222) sm.setFuncKeyByScript(True, 20041222, 42) sm.spawnMob(SEAL_CHECKER, 550, -298, False) sm.spawnMob(SEAL_CHECKER, 107, -508, False) sm.spawnMob(SEAL_CHECKER, -195, -508, False) sm.spawnMob(SEAL_CHECKER, -625, -298, False) sm.spawnNpc(SEAL_OF_TIME_1, 550, -310) sm.showNpcSpecialActionByTemplateId(SEAL_OF_TIME_1, "summon", 0) sm.spawnNpc(SEAL_OF_TIME_2, 107, -520) sm.showNpcSpecialActionByTemplateId(SEAL_OF_TIME_2, "summon", 0) sm.spawnNpc(SEAL_OF_TIME_3, -195, -520) sm.showNpcSpecialActionByTemplateId(SEAL_OF_TIME_3, "summon", 0) sm.spawnNpc(SEAL_OF_TIME_4, -625, -310) sm.showNpcSpecialActionByTemplateId(SEAL_OF_TIME_4, "summon", 0) sm.showFieldEffect("lightning/screenMsg/4") sm.removeEscapeButton() sm.flipDialoguePlayerAsSpeaker() sm.sendNext("Time is frozen. I must activate the seals before the Black Mage notices.") sm.sendSay("I must reach the light on the platform to the right. I can #b<Flash Blink>#k there if I press #r[Shift]#k.") sm.showFieldEffect("lightning/screenMsg/5")
"""testpackagepypi - test""" __version__ = '0.1.0' __author__ = 'Dominik Haitz <dominik.haitz at ...>' __all__ = []
description = 'minimal NICOS startup setup' group = 'lowlevel' sysconfig = dict( cache = 'tofhw.toftof.frm2:14869', )
class BaseStrategy(object): def get_next_move(self, board): raise NotImplementedError class MoveFirst(BaseStrategy): pass
"""Code generated by gazelle. DO NOT EDIT.""" load("@bazel_gazelle//:deps.bzl", "go_repository") def go_dependencies(): """go_dependencies.""" go_repository( name = "co_honnef_go_tools", importpath = "honnef.co/go/tools", sum = "h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=", version = "v0.0.1-2020.1.4", ) go_repository( name = "com_github_alecthomas_template", importpath = "github.com/alecthomas/template", sum = "h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=", version = "v0.0.0-20190718012654-fb15b899a751", ) go_repository( name = "com_github_alecthomas_units", importpath = "github.com/alecthomas/units", sum = "h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E=", version = "v0.0.0-20190924025748-f65c72e2690d", ) go_repository( name = "com_github_antihax_optional", importpath = "github.com/antihax/optional", sum = "h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=", version = "v1.0.0", ) go_repository( name = "com_github_benbjohnson_clock", importpath = "github.com/benbjohnson/clock", sum = "h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=", version = "v1.1.0", ) go_repository( name = "com_github_beorn7_perks", importpath = "github.com/beorn7/perks", sum = "h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=", version = "v1.0.1", ) go_repository( name = "com_github_burntsushi_toml", importpath = "github.com/BurntSushi/toml", sum = "h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=", version = "v0.3.1", ) go_repository( name = "com_github_burntsushi_xgb", importpath = "github.com/BurntSushi/xgb", sum = "h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=", version = "v0.0.0-20160522181843-27f122750802", ) go_repository( name = "com_github_census_instrumentation_opencensus_proto", importpath = "github.com/census-instrumentation/opencensus-proto", sum = "h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk=", version = "v0.2.1", ) go_repository( name = "com_github_cespare_xxhash", importpath = "github.com/cespare/xxhash", sum = "h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=", version = "v1.1.0", ) go_repository( name = "com_github_cespare_xxhash_v2", importpath = "github.com/cespare/xxhash/v2", sum = "h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=", version = "v2.1.2", ) go_repository( name = "com_github_chzyer_logex", importpath = "github.com/chzyer/logex", sum = "h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=", version = "v1.1.10", ) go_repository( name = "com_github_chzyer_readline", importpath = "github.com/chzyer/readline", sum = "h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=", version = "v0.0.0-20180603132655-2972be24d48e", ) go_repository( name = "com_github_chzyer_test", importpath = "github.com/chzyer/test", sum = "h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=", version = "v0.0.0-20180213035817-a1ea475d72b1", ) go_repository( name = "com_github_client9_misspell", importpath = "github.com/client9/misspell", sum = "h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=", version = "v0.3.4", ) go_repository( name = "com_github_cncf_udpa_go", importpath = "github.com/cncf/udpa/go", sum = "h1:hzAQntlaYRkVSFEfj9OTWlVV1H155FMD8BTKktLv0QI=", version = "v0.0.0-20210930031921-04548b0d99d4", ) go_repository( name = "com_github_cncf_xds_go", importpath = "github.com/cncf/xds/go", sum = "h1:zH8ljVhhq7yC0MIeUL/IviMtY8hx2mK8cN9wEYb8ggw=", version = "v0.0.0-20211011173535-cb28da3451f1", ) go_repository( name = "com_github_davecgh_go_spew", importpath = "github.com/davecgh/go-spew", sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=", version = "v1.1.1", ) go_repository( name = "com_github_envoyproxy_go_control_plane", importpath = "github.com/envoyproxy/go-control-plane", sum = "h1:fP+fF0up6oPY49OrjPrhIJ8yQfdIM85NXMLkMg1EXVs=", version = "v0.9.10-0.20210907150352-cf90f659a021", ) go_repository( name = "com_github_envoyproxy_protoc_gen_validate", importpath = "github.com/envoyproxy/protoc-gen-validate", sum = "h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=", version = "v0.1.0", ) go_repository( name = "com_github_felixge_httpsnoop", importpath = "github.com/felixge/httpsnoop", sum = "h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o=", version = "v1.0.2", ) go_repository( name = "com_github_ghodss_yaml", importpath = "github.com/ghodss/yaml", sum = "h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=", version = "v1.0.0", ) go_repository( name = "com_github_go_gl_glfw", importpath = "github.com/go-gl/glfw", sum = "h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0=", version = "v0.0.0-20190409004039-e6da0acd62b1", ) go_repository( name = "com_github_go_gl_glfw_v3_3_glfw", importpath = "github.com/go-gl/glfw/v3.3/glfw", sum = "h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I=", version = "v0.0.0-20200222043503-6f7a984d4dc4", ) go_repository( name = "com_github_go_kit_kit", importpath = "github.com/go-kit/kit", sum = "h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk=", version = "v0.9.0", ) go_repository( name = "com_github_go_kit_log", importpath = "github.com/go-kit/log", sum = "h1:DGJh0Sm43HbOeYDNnVZFl8BvcYVvjD5bqYJvp0REbwQ=", version = "v0.1.0", ) go_repository( name = "com_github_go_logfmt_logfmt", importpath = "github.com/go-logfmt/logfmt", sum = "h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4=", version = "v0.5.0", ) go_repository( name = "com_github_go_logr_logr", importpath = "github.com/go-logr/logr", sum = "h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs=", version = "v1.2.2", ) go_repository( name = "com_github_go_logr_stdr", importpath = "github.com/go-logr/stdr", sum = "h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=", version = "v1.2.2", ) go_repository( name = "com_github_go_stack_stack", importpath = "github.com/go-stack/stack", sum = "h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=", version = "v1.8.0", ) go_repository( name = "com_github_gogo_protobuf", importpath = "github.com/gogo/protobuf", sum = "h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=", version = "v1.3.2", ) go_repository( name = "com_github_golang_glog", importpath = "github.com/golang/glog", sum = "h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ=", version = "v1.0.0", ) go_repository( name = "com_github_golang_groupcache", importpath = "github.com/golang/groupcache", sum = "h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=", version = "v0.0.0-20200121045136-8c9f03a8e57e", ) go_repository( name = "com_github_golang_mock", importpath = "github.com/golang/mock", sum = "h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=", version = "v1.6.0", ) go_repository( name = "com_github_golang_protobuf", importpath = "github.com/golang/protobuf", sum = "h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=", version = "v1.5.2", ) go_repository( name = "com_github_golang_snappy", importpath = "github.com/golang/snappy", sum = "h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA=", version = "v0.0.3", ) go_repository( name = "com_github_google_btree", importpath = "github.com/google/btree", sum = "h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=", version = "v1.0.0", ) go_repository( name = "com_github_google_go_cmp", importpath = "github.com/google/go-cmp", sum = "h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=", version = "v0.5.6", ) go_repository( name = "com_github_google_gofuzz", importpath = "github.com/google/gofuzz", sum = "h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=", version = "v1.0.0", ) go_repository( name = "com_github_google_martian", importpath = "github.com/google/martian", sum = "h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=", version = "v2.1.0+incompatible", ) go_repository( name = "com_github_google_martian_v3", importpath = "github.com/google/martian/v3", sum = "h1:d8MncMlErDFTwQGBK1xhv026j9kqhvw1Qv9IbWT1VLQ=", version = "v3.2.1", ) go_repository( name = "com_github_google_pprof", importpath = "github.com/google/pprof", sum = "h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=", version = "v0.0.0-20210720184732-4bb14d4b1be1", ) go_repository( name = "com_github_google_renameio", importpath = "github.com/google/renameio", sum = "h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA=", version = "v0.1.0", ) go_repository( name = "com_github_google_uuid", importpath = "github.com/google/uuid", sum = "h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=", version = "v1.1.2", ) go_repository( name = "com_github_googleapis_gax_go_v2", importpath = "github.com/googleapis/gax-go/v2", sum = "h1:dp3bWCh+PPO1zjRRiCSczJav13sBvG4UhNyVTa1KqdU=", version = "v2.1.1", ) go_repository( name = "com_github_grpc_ecosystem_go_grpc_middleware", importpath = "github.com/grpc-ecosystem/go-grpc-middleware", sum = "h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw=", version = "v1.3.0", ) go_repository( name = "com_github_grpc_ecosystem_go_grpc_prometheus", importpath = "github.com/grpc-ecosystem/go-grpc-prometheus", sum = "h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=", version = "v1.2.0", ) go_repository( name = "com_github_grpc_ecosystem_grpc_gateway", importpath = "github.com/grpc-ecosystem/grpc-gateway", sum = "h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=", version = "v1.16.0", ) go_repository( name = "com_github_grpc_ecosystem_grpc_gateway_v2", importpath = "github.com/grpc-ecosystem/grpc-gateway/v2", sum = "h1:I/pwhnUln5wbMnTyRbzswA0/JxpK8sZj0aUfI3TV1So=", version = "v2.7.2", ) go_repository( name = "com_github_hashicorp_golang_lru", importpath = "github.com/hashicorp/golang-lru", sum = "h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=", version = "v0.5.1", ) go_repository( name = "com_github_ianlancetaylor_demangle", importpath = "github.com/ianlancetaylor/demangle", sum = "h1:mV02weKRL81bEnm8A0HT1/CAelMQDBuQIfLw8n+d6xI=", version = "v0.0.0-20200824232613-28f6c0f3b639", ) go_repository( name = "com_github_jpillora_backoff", importpath = "github.com/jpillora/backoff", sum = "h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=", version = "v1.0.0", ) go_repository( name = "com_github_json_iterator_go", importpath = "github.com/json-iterator/go", sum = "h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ=", version = "v1.1.11", ) go_repository( name = "com_github_jstemmer_go_junit_report", importpath = "github.com/jstemmer/go-junit-report", sum = "h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=", version = "v0.9.1", ) go_repository( name = "com_github_julienschmidt_httprouter", importpath = "github.com/julienschmidt/httprouter", sum = "h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=", version = "v1.3.0", ) go_repository( name = "com_github_kisielk_errcheck", importpath = "github.com/kisielk/errcheck", sum = "h1:e8esj/e4R+SAOwFwN+n3zr0nYeCyeweozKfO23MvHzY=", version = "v1.5.0", ) go_repository( name = "com_github_kisielk_gotool", importpath = "github.com/kisielk/gotool", sum = "h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=", version = "v1.0.0", ) go_repository( name = "com_github_konsorten_go_windows_terminal_sequences", importpath = "github.com/konsorten/go-windows-terminal-sequences", sum = "h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=", version = "v1.0.3", ) go_repository( name = "com_github_kr_logfmt", importpath = "github.com/kr/logfmt", sum = "h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=", version = "v0.0.0-20140226030751-b84e30acd515", ) go_repository( name = "com_github_kr_pretty", importpath = "github.com/kr/pretty", sum = "h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=", version = "v0.1.0", ) go_repository( name = "com_github_kr_pty", importpath = "github.com/kr/pty", sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=", version = "v1.1.1", ) go_repository( name = "com_github_kr_text", importpath = "github.com/kr/text", sum = "h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=", version = "v0.1.0", ) go_repository( name = "com_github_matttproud_golang_protobuf_extensions", importpath = "github.com/matttproud/golang_protobuf_extensions", sum = "h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=", version = "v1.0.1", ) go_repository( name = "com_github_modern_go_concurrent", importpath = "github.com/modern-go/concurrent", sum = "h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=", version = "v0.0.0-20180306012644-bacd9c7ef1dd", ) go_repository( name = "com_github_modern_go_reflect2", importpath = "github.com/modern-go/reflect2", sum = "h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=", version = "v1.0.1", ) go_repository( name = "com_github_mwitkow_go_conntrack", importpath = "github.com/mwitkow/go-conntrack", sum = "h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=", version = "v0.0.0-20190716064945-2f068394615f", ) go_repository( name = "com_github_oneofone_xxhash", importpath = "github.com/OneOfOne/xxhash", sum = "h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=", version = "v1.2.2", ) go_repository( name = "com_github_opentracing_opentracing_go", importpath = "github.com/opentracing/opentracing-go", sum = "h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=", version = "v1.1.0", ) go_repository( name = "com_github_pkg_errors", importpath = "github.com/pkg/errors", sum = "h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=", version = "v0.9.1", ) go_repository( name = "com_github_pmezard_go_difflib", importpath = "github.com/pmezard/go-difflib", sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", version = "v1.0.0", ) go_repository( name = "com_github_prometheus_client_golang", importpath = "github.com/prometheus/client_golang", sum = "h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ=", version = "v1.11.0", ) go_repository( name = "com_github_prometheus_client_model", importpath = "github.com/prometheus/client_model", sum = "h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=", version = "v0.2.0", ) go_repository( name = "com_github_prometheus_common", importpath = "github.com/prometheus/common", sum = "h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4=", version = "v0.32.1", ) go_repository( name = "com_github_prometheus_procfs", importpath = "github.com/prometheus/procfs", sum = "h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=", version = "v0.7.3", ) go_repository( name = "com_github_rogpeppe_fastuuid", importpath = "github.com/rogpeppe/fastuuid", sum = "h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s=", version = "v1.2.0", ) go_repository( name = "com_github_rogpeppe_go_internal", importpath = "github.com/rogpeppe/go-internal", sum = "h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=", version = "v1.3.0", ) go_repository( name = "com_github_sirupsen_logrus", importpath = "github.com/sirupsen/logrus", sum = "h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=", version = "v1.6.0", ) go_repository( name = "com_github_spaolacci_murmur3", importpath = "github.com/spaolacci/murmur3", sum = "h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=", version = "v0.0.0-20180118202830-f09979ecbc72", ) go_repository( name = "com_github_stretchr_objx", importpath = "github.com/stretchr/objx", sum = "h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=", version = "v0.1.1", ) go_repository( name = "com_github_stretchr_testify", importpath = "github.com/stretchr/testify", sum = "h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=", version = "v1.7.0", ) go_repository( name = "com_github_yuin_goldmark", importpath = "github.com/yuin/goldmark", sum = "h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs=", version = "v1.3.5", ) go_repository( name = "com_google_cloud_go", importpath = "cloud.google.com/go", sum = "h1:y/cM2iqGgGi5D5DQZl6D9STN/3dR/Vx5Mp8s752oJTY=", version = "v0.99.0", ) go_repository( name = "com_google_cloud_go_bigquery", importpath = "cloud.google.com/go/bigquery", sum = "h1:PQcPefKFdaIzjQFbiyOgAqyx8q5djaE7x9Sqe712DPA=", version = "v1.8.0", ) go_repository( name = "com_google_cloud_go_datastore", importpath = "cloud.google.com/go/datastore", sum = "h1:/May9ojXjRkPBNVrq+oWLqmWCkr4OU5uRY29bu0mRyQ=", version = "v1.1.0", ) go_repository( name = "com_google_cloud_go_pubsub", importpath = "cloud.google.com/go/pubsub", sum = "h1:ukjixP1wl0LpnZ6LWtZJ0mX5tBmjp1f8Sqer8Z2OMUU=", version = "v1.3.1", ) go_repository( name = "com_google_cloud_go_storage", importpath = "cloud.google.com/go/storage", sum = "h1:STgFzyU5/8miMl0//zKh2aQeTyeaUH3WN9bSUiJ09bA=", version = "v1.10.0", ) go_repository( name = "com_shuralyov_dmitri_gpu_mtl", importpath = "dmitri.shuralyov.com/gpu/mtl", sum = "h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY=", version = "v0.0.0-20190408044501-666a987793e9", ) go_repository( name = "in_gopkg_alecthomas_kingpin_v2", importpath = "gopkg.in/alecthomas/kingpin.v2", sum = "h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=", version = "v2.2.6", ) go_repository( name = "in_gopkg_check_v1", importpath = "gopkg.in/check.v1", sum = "h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=", version = "v1.0.0-20190902080502-41f04d3bba15", ) go_repository( name = "in_gopkg_errgo_v2", importpath = "gopkg.in/errgo.v2", sum = "h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=", version = "v2.1.0", ) go_repository( name = "in_gopkg_yaml_v2", importpath = "gopkg.in/yaml.v2", sum = "h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=", version = "v2.4.0", ) go_repository( name = "in_gopkg_yaml_v3", importpath = "gopkg.in/yaml.v3", sum = "h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=", version = "v3.0.0-20210107192922-496545a6307b", ) go_repository( name = "io_k8s_sigs_yaml", importpath = "sigs.k8s.io/yaml", sum = "h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=", version = "v1.3.0", ) go_repository( name = "io_opencensus_go", importpath = "go.opencensus.io", sum = "h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=", version = "v0.23.0", ) go_repository( name = "io_opentelemetry_go_contrib_instrumentation_google_golang_org_grpc_otelgrpc", importpath = "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc", sum = "h1:Ky1MObd188aGbgb5OgNnwGuEEwI9MVIcc7rBW6zk5Ak=", version = "v0.28.0", ) go_repository( name = "io_opentelemetry_go_contrib_instrumentation_net_http_otelhttp", importpath = "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp", sum = "h1:hpEoMBvKLC6CqFZogJypr9IHwwSNF3ayEkNzD502QAM=", version = "v0.28.0", ) go_repository( name = "io_opentelemetry_go_otel", importpath = "go.opentelemetry.io/otel", sum = "h1:APxLf0eiBwLl+SOXiJJCVYzA1OOJNyAoV8C5RNRyy7Y=", version = "v1.3.0", ) go_repository( name = "io_opentelemetry_go_otel_exporters_jaeger", importpath = "go.opentelemetry.io/otel/exporters/jaeger", sum = "h1:HfydzioALdtcB26H5WHc4K47iTETJCdloL7VN579/L0=", version = "v1.3.0", ) go_repository( name = "io_opentelemetry_go_otel_internal_metric", importpath = "go.opentelemetry.io/otel/internal/metric", sum = "h1:dlrvawyd/A+X8Jp0EBT4wWEe4k5avYaXsXrBr4dbfnY=", version = "v0.26.0", ) go_repository( name = "io_opentelemetry_go_otel_metric", importpath = "go.opentelemetry.io/otel/metric", sum = "h1:VaPYBTvA13h/FsiWfxa3yZnZEm15BhStD8JZQSA773M=", version = "v0.26.0", ) go_repository( name = "io_opentelemetry_go_otel_sdk", importpath = "go.opentelemetry.io/otel/sdk", sum = "h1:3278edCoH89MEJ0Ky8WQXVmDQv3FX4ZJ3Pp+9fJreAI=", version = "v1.3.0", ) go_repository( name = "io_opentelemetry_go_otel_trace", importpath = "go.opentelemetry.io/otel/trace", sum = "h1:doy8Hzb1RJ+I3yFhtDmwNc7tIyw1tNMOIsyPzp1NOGY=", version = "v1.3.0", ) go_repository( name = "io_opentelemetry_go_proto_otlp", importpath = "go.opentelemetry.io/proto/otlp", sum = "h1:rwOQPCuKAKmwGKq2aVNnYIibI6wnV7EvzgfTCzcdGg8=", version = "v0.7.0", ) go_repository( name = "io_rsc_binaryregexp", importpath = "rsc.io/binaryregexp", sum = "h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE=", version = "v0.2.0", ) go_repository( name = "io_rsc_quote_v3", importpath = "rsc.io/quote/v3", sum = "h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY=", version = "v3.1.0", ) go_repository( name = "io_rsc_sampler", importpath = "rsc.io/sampler", sum = "h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=", version = "v1.3.0", ) go_repository( name = "org_golang_google_api", importpath = "google.golang.org/api", sum = "h1:TXXKS1slM3b2bZNJwD5DV/Tp6/M2cLzLOLh9PjDhrw8=", version = "v0.61.0", ) go_repository( name = "org_golang_google_appengine", importpath = "google.golang.org/appengine", sum = "h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=", version = "v1.6.7", ) go_repository( name = "org_golang_google_genproto", importpath = "google.golang.org/genproto", sum = "h1:c5afAQ+F8m49fzDEIKvD7o/D350YjVseBMjtoKL1xsg=", version = "v0.0.0-20211221195035-429b39de9b1c", ) go_repository( name = "org_golang_google_grpc", importpath = "google.golang.org/grpc", sum = "h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM=", version = "v1.43.0", ) go_repository( name = "org_golang_google_grpc_cmd_protoc_gen_go_grpc", importpath = "google.golang.org/grpc/cmd/protoc-gen-go-grpc", sum = "h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE=", version = "v1.1.0", ) go_repository( name = "org_golang_google_protobuf", importpath = "google.golang.org/protobuf", sum = "h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=", version = "v1.27.1", ) go_repository( name = "org_golang_x_crypto", importpath = "golang.org/x/crypto", sum = "h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=", version = "v0.0.0-20200622213623-75b288015ac9", ) go_repository( name = "org_golang_x_exp", importpath = "golang.org/x/exp", sum = "h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y=", version = "v0.0.0-20200224162631-6cc2880d07d6", ) go_repository( name = "org_golang_x_image", importpath = "golang.org/x/image", sum = "h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=", version = "v0.0.0-20190802002840-cff245a6509b", ) go_repository( name = "org_golang_x_lint", importpath = "golang.org/x/lint", sum = "h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug=", version = "v0.0.0-20210508222113-6edffad5e616", ) go_repository( name = "org_golang_x_mobile", importpath = "golang.org/x/mobile", sum = "h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs=", version = "v0.0.0-20190719004257-d2bd2a29d028", ) go_repository( name = "org_golang_x_mod", importpath = "golang.org/x/mod", sum = "h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=", version = "v0.4.2", ) go_repository( name = "org_golang_x_net", importpath = "golang.org/x/net", sum = "h1:hEYJvxw1lSnWIl8X9ofsYMklzaDs90JI2az5YMd4fPM=", version = "v0.0.0-20211216030914-fe4d6282115f", ) go_repository( name = "org_golang_x_oauth2", importpath = "golang.org/x/oauth2", sum = "h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg=", version = "v0.0.0-20211104180415-d3ed0bb246c8", ) go_repository( name = "org_golang_x_sync", importpath = "golang.org/x/sync", sum = "h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=", version = "v0.0.0-20210220032951-036812b2e83c", ) go_repository( name = "org_golang_x_sys", importpath = "golang.org/x/sys", sum = "h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=", version = "v0.0.0-20211216021012-1d35b9e2eb4e", ) go_repository( name = "org_golang_x_term", importpath = "golang.org/x/term", sum = "h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=", version = "v0.0.0-20201126162022-7de9c90e9dd1", ) go_repository( name = "org_golang_x_text", importpath = "golang.org/x/text", sum = "h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=", version = "v0.3.7", ) go_repository( name = "org_golang_x_time", importpath = "golang.org/x/time", sum = "h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=", version = "v0.0.0-20191024005414-555d28b269f0", ) go_repository( name = "org_golang_x_tools", importpath = "golang.org/x/tools", sum = "h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=", version = "v0.1.5", ) go_repository( name = "org_golang_x_xerrors", importpath = "golang.org/x/xerrors", sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=", version = "v0.0.0-20200804184101-5ec99f83aff1", ) go_repository( name = "org_uber_go_atomic", importpath = "go.uber.org/atomic", sum = "h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=", version = "v1.9.0", ) go_repository( name = "org_uber_go_goleak", importpath = "go.uber.org/goleak", sum = "h1:sHOAIxRGBp443oHZIPB+HsUGaksVCXVQENPxwTfQdH4=", version = "v1.1.11-0.20210813005559-691160354723", ) go_repository( name = "org_uber_go_multierr", importpath = "go.uber.org/multierr", sum = "h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec=", version = "v1.7.0", ) go_repository( name = "org_uber_go_zap", importpath = "go.uber.org/zap", sum = "h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI=", version = "v1.19.1", )
""" The `~certbot_dns_rrpproxy.dns_rrpproxy` plugin automates the process of completing a ``dns-01`` challenge (`~acme.challenges.DNS01`) by creating, and subsequently removing, TXT records using the RRPproxy API. Named Arguments --------------- ======================================== ===================================== ``--dns-rrpproxy-credentials`` RRPproxy account credentials in INI format. (Required) ``--dns-rrpproxy-propagation-seconds`` The number of seconds to wait for DNS to propagate before asking the ACME server to verify the DNS record. (Default: 120) ``--dns-rrpproxy-staging`` Whether this is a test run (OTE). ======================================== ===================================== Credentials ----------- Use of this plugin requires a configuration file containing the login credentials with the required permissions to update DNS zones. .. code-block:: ini :name: credentials.ini :caption: Example credentials file: certbot_dns_rrpproxy:dns_rrpproxy_s_login = user certbot_dns_rrpproxy:dns_rrpproxy_s_pw = password The path to this file can be provided interactively or using the ``--dns-rrpproxy-credentials`` command-line argument. Certbot records the path to this file for use during renewal, but does not store the file's contents. .. caution:: Users who can read this file can use these credentials to issue arbitrary API calls on your behalf. Users who can cause Certbot to run using these credentials can complete a ``dns-01`` challenge to acquire new certificates or revoke existing certificates for associated domains, even if those domains aren't being managed by this server. Certbot will emit a warning if it detects that the credentials file can be accessed by other users on your system. The warning reads "Unsafe permissions on credentials configuration file", followed by the path to the credentials file. This warning will be emitted each time Certbot uses the credentials file, including for renewal, and cannot be silenced except by addressing the issue (e.g., by using a command like ``chmod 600`` to restrict access to the file). Examples -------- .. code-block:: bash :caption: To acquire a certificate for ``example.com`` certbot certonly \\ --authenticator certbot-dns-rrpproxy:dns-rrpproxy \\ --certbot-dns-rrpproxy:dns-rrpproxy-credentials ~/.secrets/certbot/rrpproxy.ini \\ -d example.com .. code-block:: bash :caption: To acquire a single certificate for both ``example.com`` and ``www.example.com`` certbot certonly \\ --authenticator certbot-dns-rrpproxy:dns-rrpproxy \\ --certbot-dns-rrpproxy:dns-rrpproxy-credentials ~/.secrets/certbot/rrpproxy.ini \\ -d example.com \\ -d www.example.com .. code-block:: bash :caption: To acquire a certificate for ``example.com``, waiting 120 seconds for DNS propagation certbot certonly \\ --authenticator certbot-dns-rrpproxy:dns-rrpproxy \\ --certbot-dns-rrpproxy:dns-rrpproxy-credentials ~/.secrets/certbot/rrpproxy.ini \\ --certbot-dns-rrpproxy:dns-rrpproxy-propagation-seconds 120 \\ -d example.com .. code-block:: bash :caption: To acquire a certificate for ``*.example.com`` and ``example.com`` in a staging request certbot certonly \\ --authenticator certbot-dns-rrpproxy:dns-rrpproxy \\ --certbot-dns-rrpproxy:dns-rrpproxy-credentials ~/.secrets/certbot/rrpproxy.ini \\ --certbot-dns-rrpproxy:dns-rrpproxy-staging \\ -d *.example.com \\ -d example.com """
print('\033[31mOlá, Mundo!') print('\033[31;43mOlá, Mundo!') print('\033[1;31;43mOlá, Mundo!') print('\033[1;31;43mOlá, Mundo!\033[m') print('\033[4;30;45mOlá, Mundo!\033[m') print('\033[30mOlá, Mundo!\033[m') print('\033[37mOlá, Mundo!\033[m') print('\033[7;30mOlá, Mundo!\033[m') print('\033[0;33;44mOlá, Mundo!\033[m') print('\033[7;33;44mOlá, Mundo!\033[m') a = 3 b = 5 print(f'Os valores são {a} e {b}') print(f'Os valores são \033[32m{a} e \033[31m{b}\033[m') print(f'Os valores são \033[32m{a}\033[m e \033[31m{b}\033[m!!!') print(f'Os valores são \033[32;44m{a}\033[m e \033[31;44m{b}\033[m!!!') nome = 'Guanabara' print('Olá, Muito prazer em te conhecer, {}{}{}!!!'.format('\033[4;34m', nome, '\033[m')) #Dicionário cores = {'limpar':'\033[m', 'azul':'\033[34m', 'amarelo':'\033[33m', 'pretoebranco':'\033[7;30m'} print('Olá, Muito prazer em te conhecer, {}{}{}!!!'.format(cores['pretoebranco'], nome, cores['limpar']))
VERSION = "1.0.0-beta.15" LANGUAGE = "python" PROJECT = "versionhelper" _p = "versionhelper.libvh." API = {_p + "version_helper" : {"arguments" : ("filename str", ), "keywords" : {"directory" : "directory str", "version" : "str", "prerelease" : "str", "build_metadata" : "str", "db" : "filename str", "checker" : "filename str", "source_types" : "iterable of str", "no_invariant_check" : "bool", "dry_run" : "bool", "silent" : "bool"}, "returns" : None, "exceptions" : ("ValueError", "Missing_Api_Function", "Mismatched_Api_Argument", "Missing_Api_Info"), "side_effects" : ("Modifies api VERSION", "Modifies database", "Overwrites apichangelog.txt")}, _p + "parse_version" : {"arguments" : ("version str", ), "returns" : ("str", "str", "str", "str", "str")} }
#Build a Bus/Air/Rail Booking System where the user can choose a source and destination from the list given and enter the information passenger wise, depending on the distance cost shall be computed. #Bus,Rail and Air systems will have different fares for different classes.You should be able to think of the system as how would he/she use it as a user. mode=input("Hello! Welcome to the automated ticket system. Please enter a method how you would like to travel (Bus, Air or Rail): ").lower() transport = {"bus":500,"air":4000,"rail":1500} cost = 0 place = {"mumbai":1000,"hydrabad":900,"chennai":1200,"bangalore":950} if mode=="bus" or mode=="air" or mode=="rail": print(f"You chose to travel by {mode.title()}") start=input(f"\n\nPlease select starting point from the following list:\nDelhi\nMumbai\nHydrabad\nChennai\nBangalore\nStaring Point: ").lower() cost+=transport[mode] if start=="mumbai" or start=="hydrabad" or start=="chennai" or start=="bangalore": print(f"You have set your starting point to {start.title()}") else: print("Please enter a valid starting point") destination=input(f"\nPlease select a destination from the following list\n(Please note that your destination can not be the same as your start point):\nDelhi\nMumbai\nHydrabad\nChennai\nBangalore\nDestination: ").lower() if destination==start: print("Your destination can not be the same as your starting point") elif destination=="delhi" or destination=="mumbai" or destination=="hydrabad" or destination=="chennai" or destination=="bangalore": print(f"You have set your destination to {destination}") cost+= place[destination] print(f"\n\nYou chose to travel by {mode}. From {start} to {destination} in {cost} rupees. Have a safe trip!") else: print("Please enter a valid destination") else: print("Please enter a valid mode of transport")
print(f'\033[33m{"—"*30:^30}\033[m') print(f'\033[36m{"EXERCÍCIO Nº 52":^30}\033[m') print(f'\033[33m{"—"*30:^30}\033[m') n = int(input('Digite um número: ')) for x in range(2, n + 1): if x == n: print('Primo') break if n % x == 0: print('não é primo') break
''' Author: Shuailin Chen Created Date: 2021-08-17 Last Modified: 2021-08-17 content: ''' _base_= [ '../_base_/models/bit_pos_s4_dd8.py', '../_base_/datasets/s2looking.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py' ] data = dict( samples_per_gpu=8, workers_per_gpu=8, ) evaluation = dict(metric=['mFscore', 'mFscoreCD'])
#need prompt for pet type #build pet dictionary #give toys, feed pet, let game loop, while printing menu pet = {"name":"", "type": "", "age": 0, "hunger": 0, "playfulness" : 0, "toys": []} pettoys = {"cat": ["String", "Cardboard Box", "Scratching Post"], "dog": ["Frisbee","Tennis Ball", "Stick"], "fish": ["Undersea Castle", "Buried Treasure", "Coral"]} def quitsim(): print("That's the end of the game! Thank you for playing the pet simulator!") def feedpet(): newHunger = pet["hunger"] - 10 if newHunger < 0: newHunger = 0 pet["hunger"] = newHunger print("Fed pet, their hunger is getting out of control") def gettoy(): toyChoices = pettoys[pet["type"]] toyNum = -1 while toyNum < 0 or toyNum >= len(pettoys): print("Here are your toy choices: ") for i in range(len(toyChoices)): print(str(i) + ": " + toyChoices[i]) toyNum = int(input("Please input your choice of pet toy: ")) chosenToy = toyChoices[toyNum] pet["toys"].append(chosenToy) print("Nice! You chose: " + chosenToy + " for " + pet["name"] + ". Great pick!") def playtoys(): print("Yay! Let's play with our toys.") pet["playfulness"] += 10 def virtpet (pettoys): pettype = "" petops = list(pettoys.keys()) while pettype not in petops: print("Please input pet you would like to have:") for option in petops: print(option) pettype = input("Please select from one of these pets: ") pet["type"] = pettype pet["name"] = input("What would you like to name your " + pet["type"] + "? ") #this initializes the pet game #then it should ask you to choose and name your pet if its working correctly #Not only write a while loop but lets the user quit by hitting the q key def printmenu(menuops): print() print("Here are your options: ") print("----------") for key in menuops: print(key + ":\t" + menuops[key]["text"]) print() #bug fix, not only was feedpet and quitsim not defined but once I defined it I could not get printmenu to show, just getting a long string of letters and numbers def printstats(): print() print("Your " + pet["type"] + " named " + pet["name"] + " had a great time playing with you!") print(pet["name"] + " is " + str(pet["age"]) + " days old") print(pet["name"] + " is currently at a hunger level of " + str(pet["hunger"]) + " out of 100!") print("You have " + str(len(pet["toys"])) + " toys! They are: ") for toy in pet["toys"]: print(toy) print() #added stats, pushed pass earlier error, will work on that later once I find a solution def main(): virtpet(pettoys) menuops = {"Q": { "function": quitsim, "text": "Quit the game"}, "F": { "function": feedpet, "text": "Feed " + pet["name"] + "!"}, "G": { "function": gettoy, "text": "Get a toy for " + pet["name"] + "!"}, "P": { "function": playtoys, "text": "Play with " + pet["name"] + " and your toys!"} } keepplaying = True while keepplaying: menuselect = "" menuopskeys = list(menuops.keys()) while menuselect not in menuopskeys: printmenu(menuops) menuselect = input("Which of thesee menu options would you like to use? ").upper() print() if menuselect == "Q": keepplaying = False pet["hunger"] += 3 pet["age"] += 1 menuops[menuselect]["function"]() printstats() main()
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def middleNode(self, head): """ :type head: ListNode :rtype: ListNode """ val_list = [head.val] node = head node_count = 1 while node.next: node = node.next val_list.append(node.val) node_count += 1 return val_list[int(node_count / 2):]
RAWDATA_DIR = '/staging/as/skchoudh/rna-seq-datasets/single/gallus_gallus/SRP007412' OUT_DIR = '/staging/as/skchoudh/rna-seq-output/gallus_gallus/SRP007412' CDNA_FA_GZ = '/home/cmb-panasas2/skchoudh/genomes/gallus_gallus/cdna/Gallus_gallus.Gallus_gallus-5.0.cdna.all.fa.gz' CDNA_IDX = '/home/cmb-panasas2/skchoudh/genomes/gallus_gallus/cdna/Gallus_gallus.Gallus_gallus-5.0.cdna.all.kallisto.index'
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- TIME_WINDOW = u"Microsoft.TimeWindow" PERCENTAGE = u"Microsoft.Percentage" TARGETING = u"Microsoft.Targeting"
def check_rewrite_data(data, data_path): with open(data_path, 'w') as output_data: first_is_name = False need_line = False seq_num = 0 for x in data: x = x.strip() if not x: continue if x[0] == '>': x = adapt_PEPformat(x) # for PEPred-Suite software seq_num += 1 if need_line: return False, 'Sorry, sequence ' + str(seq_num - 1) + ' is empty, please check it!' need_line = True first_is_name = True else: if not first_is_name: seq_num += 1 return False, 'Sorry, the name of sequence ' + str(seq_num) + ' is wrong, please check it!' if not is_protein_seq(x): return False, 'Sorry, sequence ' + str(seq_num) + ' contains wrong alphabet, please check it!' if not need_line: seq_num += 1 return False, 'Sorry, the name of sequence ' + str(seq_num) + ' is wrong, please check it!' need_line = False output_data.write(x + '\n') if need_line: return False, 'Sorry, sequence ' + str(seq_num) + ' is empty, please check it!' return True, '' def adapt_PEPformat(x): """ PEPred-Suite jar input format :param x: id that starts with '>' :return: id that starts with '>' and ends with '|0' """ if '|' not in x: x = x + '|0' return x def is_protein_seq(seq): nchar = ['A', 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H', 'I', 'L', 'K', 'M', 'F', 'P', 'S', 'T', 'W', 'Y', 'V'] for x in seq: if x not in nchar: return False return True
n, min_val, max_val = int(input('n=')), int(input('minimum=')), int(input('maximum=')) c = i = 0 while True: i, sq = i+1, i**n if sq in range(min_val, max_val+1): c += 1 if sq > max_val: break print(f'{c} values raised to the power {n} lie in the range {min_val}, {max_val}')
_base_ = [ '../_base_/models/fpn_r50.py', '../_base_/datasets/FoodSeg103.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_80k.py' ] model = dict(pretrained='./pretrained_model/R50_ReLeM.pth', backbone=dict(type='ResNet'), decode_head=dict(num_classes=104)) optimizer_config = dict() runner = dict(type='IterBasedRunner', max_iters=80000) checkpoint_config = dict(by_epoch=False, interval=4000) evaluation = dict(interval=4000, metric='mIoU')
def me(**kwargs): for key, value in kwargs.items(): print("{0}=={1}". format(key, value)) me(name="Rahim", ID=18) me(name="Ariful", age=109) me(age=10)
class Query: """ Class representing a single query to be executed on the database. """ def __init__(self): self.__select = "*" self.__from = None self.__where = None self.__group_by = None self.__having = None self.__order_by = None self.__limit = None def select(self, value: str): self.__select = value def from_(self, value: str): self.__from = value def where(self, value: str): self.__where = value def group_by(self, value: str): self.__group_by = value def having(self, value: str): self.__having = value def order_by(self, value: str): self.__order_by = value def limit(self, value: int): self.__limit = value def validate(self): if not self.__select: raise QueryException("The SELECT clause must be present in order to execute the query.") if not self.__from: if self.__where: raise QueryException("The FROM clause must be present in order to have a WHERE clause.") if self.__group_by: raise QueryException("The FROM clause must be present in order to have a GROUP BY clause.") if self.__order_by: raise QueryException("The FROM clause must be present in order to have a ORDER BY clause.") if self.__having: if not self.__group_by: raise QueryException("The GROUP BY clause must be present in order to have a HAVING clause.") def __repr__(self): current_value = "select "+self.__select if self.__from: current_value += " from "+self.__from if self.__where: current_value += " where "+self.__where if self.__group_by: current_value += " group by "+self.__group_by if self.__having: current_value += " having "+self.__having if self.__order_by: current_value += " order by "+self.__order_by if self.__limit: current_value += " limit "+str(self.__limit) return current_value def __str__(self): return self.__repr__() class QueryBuilder: def __init__(self): self.__current_query = Query() def select(self, value): self.__current_query.select(value) return self def from_(self, value): self.__current_query.from_(value) return self def where(self, value): self.__current_query.where(value) return self def group_by(self, value): self.__current_query.group_by(value) return self def having(self, value): self.__current_query.having(value) return self def order_by(self, value): self.__current_query.order_by(value) return self def limit(self, value): self.__current_query.limit(value) return self def execute(self): self.__current_query.validate() # TODO complete execution code pass def __repr__(self): return self.__current_query.__repr__() def __str__(self): return self.__current_query.__str__() class QueryException(Exception): pass
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Adekunle Oliver Adebajo\n", "### 20120612016\n", "### adekunle.adebajo@pau.edu.ng\n", "### the following codes consist of class exercises involving problem solving" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "26\n", "7\n" ] } ], "source": [ "def difference(n):\n", " if n <= 17:\n", " return 17 - n\n", " else:\n", " return (n - 17) * 2 \n", "\n", "print(difference(30))\n", "print(difference(10))\n", "\n" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "12\n", "45\n" ] } ], "source": [ "def sum_thrice(x, y, z):\n", " \n", " sum = x + y + z\n", " \n", " if x == y == z:\n", " sum = sum * 3\n", " return sum\n", " \n", "print(sum_thrice(3, 4, 5))\n", "print(sum_thrice(5, 5, 5))" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "True\n", "False\n", "True\n" ] } ], "source": [ "def test_number5(x, y):\n", " if x == y or abs(x-y) == 5 or (x+y) == 5:\n", " return True\n", " else:\n", " return False\n", "\n", "print(test_number5(10, 5))\n", "print(test_number5(3, 4))\n", "print(test_number5(2, 3))\n" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "ename": "SyntaxError", "evalue": "invalid syntax (<ipython-input-22-30a5df4de358>, line 1)", "output_type": "error", "traceback": [ "\u001b[1;36m File \u001b[1;32m\"<ipython-input-22-30a5df4de358>\"\u001b[1;36m, line \u001b[1;32m1\u001b[0m\n\u001b[1;33m if (a > c)\u001b[0m\n\u001b[1;37m ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n" ] } ], "source": [ "if (a > c)\n", " swap(a, c);\n", "\n", "if (a > b)\n", " swap(a, b);\n", "\n", "//Now the smallest element is the 1st one. Just check the 2nd and 3rd\n", "\n", "if (b > c)\n", " swap(b, c);\n", " (a, b, c) == (2, 5, 1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def sum_of_cubes(n):\n", " n = 5\n", " total = 0\n", " while n > 0:\n", " total += n * n * n\n", " n = 5\n", " return total\n", "print(\"Sum of cubes: \",sum_of_cubes(3))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }
#!/usr/bin/env python # coding=utf-8 # author: zengyuetian # 此代码仅供学习与交流,请勿用于商业用途。 # 小区信息的数据结构 class XiaoQu(object): def __init__(self, district, area, name, price, on_sale): self.district = district self.area = area self.price = price self.name = name self.on_sale = on_sale def text(self): return self.district + "," + \ self.area + "," + \ self.name + "," + \ self.price + "," + \ self.on_sale
def trapes_areal(sideEn=float, sideTo=float, høyde=float): """ Returnerer arealet til et trapes """ return ( ( sideEn+sideTo ) * høyde ) / 2 def trapes(funksjon, start=float, slutt=float, antall=int): ''' Returnerer arealet under grafen ved å bruke trapeser. ( Numerisk Integrasjon med trapeser ) ''' bredde = ( slutt - start ) / antall A = 0 for i in range(0, antall): A += abs(trapes_areal( funksjon( start + bredde * i ), funksjon( start + bredde * (i+1) ), bredde )) return A
# Standard tuning of each string GUITAR_STAFF: dict = {0: 'E', 1: 'A', 2: 'D', 3: 'G', 4: 'B', 5: 'E'} UKULELE_STAFF: dict = {0: 'G', 1: 'C', 2: 'E', 3: 'A'} # Number of strings GUITAR_STRING = 6 UKULELE_STRING = 4 # MIDI metadata TIME_SIGNATURE = 'time_signature' NOTE_ON = 'note_on' NOTE_OFF = 'note_off' HALF_NOTE = 'half' WHOLE_NOTE = 'whole' QUARTER_NOTE = 'quarter' EIGHTH_NOTE = 'eighth' SIXTEENTH_NOTE = 'sixteenth' # Note type to note name mappings NUM_TO_NOTES = {1: WHOLE_NOTE, 2: HALF_NOTE, 4: QUARTER_NOTE, 8: EIGHTH_NOTE, 16: SIXTEENTH_NOTE} # Notes on all strings and fret of a guitar # This is unused. Can remove FRET_NOTES = \ [['F4', 'F#4', 'G4', 'Ab4', 'A4', 'Bb4', 'B4', 'C5', 'C#5', 'D5', 'Eb5', 'E5', 'F5', 'F#5', 'G5', 'Ab5', 'A5', 'Bb5', 'B5', 'C6', 'C#6', 'D6'], # E ['C4', 'C#4', 'D4', 'Eb4', 'E4', 'F4', 'F#4', 'G4', 'Ab4', 'A4', 'Bb4', 'B4', 'C5', 'C#5', 'D5', 'Eb5', 'E5', 'F5', 'F#5', 'G5', 'Ab5', 'A5'], # B ['Ab3', 'A3', 'Bb3', 'B3', 'C4', 'C#4', 'D4', 'Eb4', 'E4', 'F4', 'F#4', 'G4', 'Ab4', 'A4', 'Bb4', 'B4', 'C5', 'C#5', 'D5', 'Eb5', 'E5', 'F5'], # G ['Eb3', 'E3', 'F3', 'F#3', 'G3', 'Ab3', 'A3', 'Bb3', 'B3', 'C4', 'C#4', 'D4', 'Eb4', 'E4', 'F4', 'F#4', 'G4', 'Ab4', 'A4', 'Bb4', 'B4', 'C5'], # D ['Bb2', 'B2', 'C3', 'C#3', 'D3', 'Eb3', 'E3', 'F3', 'F#3', 'G3', 'Ab3', 'A3', 'Bb3', 'B3', 'C4', 'C#4', 'D4', 'Eb4', 'E4', 'F4', 'F#4', 'G4'], # A ['F2', 'F#2', 'G2', 'Ab2', 'A2', 'Bb2', 'B2', 'C3', 'C#3', 'D3', 'Eb3', 'E3', 'F3', 'F#3', 'G3', 'Ab3', 'A3', 'Bb3', 'B3', 'C4', 'C#4', 'D4']] # E # 3 5 7 9 12 15 17 19 21 TRACK_ERROR_MESSAGE = 'No track with string instrument found' # MIDI value to notes mapping MIDI_TO_NOTES = { 0: [''], 1: [''], 10: [''], 100: ['E7'], 101: ['F7'], 102: ['F#7', 'Gb7'], 103: ['G7'], 104: ['G#7', 'Ab7'], 105: ['A7'], 106: ['A#7', 'Bb7'], 107: ['B7'], 108: ['C8'], 109: ['C#8', 'Db8'], 11: [''], 110: ['D8'], 111: ['D#8', 'Eb8'], 112: ['E8'], 113: ['F8'], 114: ['F#8', 'Gb8'], 115: ['G8'], 116: ['G#8', 'Ab8'], 117: ['A8'], 118: ['A#8', 'Bb8'], 119: ['B8'], 12: [''], 120: ['C9'], 121: ['C#9', 'Db9'], 122: ['D9'], 123: ['D#9', 'Eb9'], 124: ['E9'], 125: ['F9'], 126: ['F#9', 'Gb9'], 127: ['G9'], 13: [''], 14: [''], 15: [''], 16: [''], 17: [''], 18: [''], 19: [''], 2: [''], 20: [''], 21: ['A0'], 22: ['A#0', 'Bb0'], 23: ['B0'], 24: ['C1'], 25: ['C#1', 'Db1'], 26: ['D1'], 27: ['D#1', 'Eb1'], 28: ['E1'], 29: ['F1'], 3: [''], 30: ['F#1', 'Gb1'], 31: ['G1'], 32: ['G#1', 'Ab1'], 33: ['A1'], 34: ['A#1', 'Bb1'], 35: ['B1'], 36: ['C2'], 37: ['C#2', 'Db2'], 38: ['D2'], 39: ['D#2', 'Eb2'], 4: [''], 40: ['E2'], 41: ['F2'], 42: ['F#2', 'Gb2'], 43: ['G2'], 44: ['G#2', 'Ab2'], 45: ['A2'], 46: ['A#2', 'Bb2'], 47: ['B2'], 48: ['C3'], 49: ['C#3', 'Db3'], 5: [''], 50: ['D3'], 51: ['D#3', 'Eb3'], 52: ['E3'], 53: ['F3'], 54: ['F#3', 'Gb3'], 55: ['G3'], 56: ['G#3', 'Ab3'], 57: ['A3'], 58: ['A#3', 'Bb3'], 59: ['B3'], 6: [''], 60: ['C4'], 61: ['C#4', 'Db4'], 62: ['D4'], 63: ['D#4', 'Eb4'], 64: ['E4'], 65: ['F4'], 66: ['F#4', 'Gb4'], 67: ['G4'], 68: ['G#4', 'Ab4'], 69: ['A4'], 7: [''], 70: ['A#4', 'Bb4'], 71: ['B4'], 72: ['C5'], 73: ['C#5', 'Db5'], 74: ['D5'], 75: ['D#5', 'Eb5'], 76: ['E5'], 77: ['F5'], 78: ['F#5', 'Gb5'], 79: ['G5'], 8: [''], 80: ['G#5', 'Ab5'], 81: ['A5'], 82: ['A#5', 'Bb5'], 83: ['B5'], 84: ['C6'], 85: ['C#6', 'Db6'], 86: ['D6'], 87: ['D#6', 'Eb6'], 88: ['E6'], 89: ['F6'], 9: [''], 90: ['F#6', 'Gb6'], 91: ['G6'], 92: ['G#6', 'Ab6'], 93: ['A6'], 94: ['A#6', 'Bb6'], 95: ['B6'], 96: ['C7'], 97: ['C#7', 'Db7'], 98: ['D7'], 99: ['D#7', 'Eb7'] } # Note to string and fret mappings NOTE_TO_STRING = \ {'F4': {1: 1, 2: 6, 3: 10, 4: 15, 5: 20, 6: ''}, 'F#4': {1: 2, 2: 7, 3: 11, 4: 16, 5: 21, 6: ''}, 'G4': {1: 3, 2: 8, 3: 12, 4: 17, 5: 22, 6: ''}, 'Ab4': {1: 4, 2: 9, 3: 13, 4: 18, 5: '', 6: ''}, 'G#4': {1: 4, 2: 9, 3: 13, 4: 18, 5: '', 6: ''}, 'A4': {1: 5, 2: 10, 3: 14, 4: 19, 5: '', 6: ''}, 'Bb4': {1: 6, 2: 11, 3: 15, 4: 20, 5: '', 6: ''}, 'A#4': {1: 6, 2: 11, 3: 15, 4: 20, 5: '', 6: ''}, 'B4': {1: 7, 2: 12, 3: 16, 4: 21, 5: '', 6: ''}, 'C5': {1: 8, 2: 13, 3: 17, 4: 22, 5: '', 6: ''}, 'C#5': {1: 9, 2: 14, 3: 18, 4: '', 5: '', 6: ''}, 'D5': {1: 10, 2: 15, 3: 19, 4: '', 5: '', 6: ''}, 'Eb5': {1: 11, 2: 16, 3: 20, 4: '', 5: '', 6: ''}, 'D#5': {1: 11, 2: 16, 3: 20, 4: '', 5: '', 6: ''}, 'E5': {1: 12, 2: 17, 3: 21, 4: '', 5: '', 6: ''}, 'F5': {1: 13, 2: 18, 3: 22, 4: '', 5: '', 6: ''}, 'F#5': {1: 14, 2: 19, 3: '', 4: '', 5: '', 6: ''}, 'G5': {1: 15, 2: 20, 3: '', 4: '', 5: '', 6: ''}, 'Ab5': {1: 16, 2: 21, 3: '', 4: '', 5: '', 6: ''}, 'G#5': {1: 16, 2: 21, 3: '', 4: '', 5: '', 6: ''}, 'A5': {1: 17, 2: 22, 3: '', 4: '', 5: '', 6: ''}, 'Bb5': {1: 18, 2: '', 3: '', 4: '', 5: '', 6: ''}, 'A#5': {1: 18, 2: '', 3: '', 4: '', 5: '', 6: ''}, 'B5': {1: 19, 2: '', 3: '', 4: '', 5: '', 6: ''}, 'C6': {1: 20, 2: '', 3: '', 4: '', 5: '', 6: ''}, 'C#6': {1: 21, 2: '', 3: '', 4: '', 5: '', 6: ''}, 'D6': {1: 22, 2: '', 3: '', 4: '', 5: '', 6: ''}, 'C4': {1: '', 2: 1, 3: 5, 4: 10, 5: 15, 6: 20}, 'C#4': {1: '', 2: 2, 3: 6, 4: 11, 5: 16, 6: 21}, 'D4': {1: '', 2: 3, 3: 7, 4: 12, 5: 17, 6: 22}, 'Eb4': {1: '', 2: 4, 3: 8, 4: 13, 5: 18, 6: ''}, 'D#4': {1: '', 2: 4, 3: 8, 4: 13, 5: 18, 6: ''}, 'E4': {1: '', 2: 5, 3: 9, 4: 14, 5: 19, 6: ''}, 'Ab3': {1: '', 2: '', 3: 1, 4: 6, 5: 11, 6: 16}, 'G#3': {1: '', 2: '', 3: 1, 4: 6, 5: 11, 6: 16}, 'A3': {1: '', 2: '', 3: 2, 4: 7, 5: 12, 6: 17}, 'Bb3': {1: '', 2: '', 3: 3, 4: 8, 5: 13, 6: 18}, 'A#3': {1: '', 2: '', 3: 3, 4: 8, 5: 13, 6: 18}, 'B3': {1: '', 2: '', 3: 4, 4: 9, 5: 14, 6: 19}, 'Eb3': {1: '', 2: '', 3: '', 4: 1, 5: 6, 6: 11}, 'D#3': {1: '', 2: '', 3: '', 4: 1, 5: 6, 6: 11}, 'E3': {1: '', 2: '', 3: '', 4: 2, 5: 7, 6: 12}, 'F3': {1: '', 2: '', 3: '', 4: 3, 5: 8, 6: 13}, 'F#3': {1: '', 2: '', 3: '', 4: 4, 5: 9, 6: 14}, 'G3': {1: '', 2: '', 3: '', 4: 5, 5: 10, 6: 15}, 'Bb2': {1: '', 2: '', 3: '', 4: '', 5: 1, 6: 6}, 'A#2': {1: '', 2: '', 3: '', 4: '', 5: 1, 6: 6}, 'B2': {1: '', 2: '', 3: '', 4: '', 5: 2, 6: 7}, 'C3': {1: '', 2: '', 3: '', 4: '', 5: 3, 6: 8}, 'C#3': {1: '', 2: '', 3: '', 4: '', 5: 4, 6: 9}, 'D3': {1: '', 2: '', 3: '', 4: '', 5: 5, 6: 10}, 'F2': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 1}, 'F#2': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 2}, 'G2': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 3}, 'Ab2': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 4}, 'G#2': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 4}, 'A2': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 5}, 'B1': {1: '', 2: '', 3: '', 4: '', 5: '', 6: 5}} # Max length of tablature in CLI mode MAX_RENDER_COLUMNS = 70 TAB_LINE_CHAR = '-' FILLER_TEXT = """ ******************************** * NEXT TAB * ******************************** """ # Common scale an steps mappings SCALE = { 'major': [2, 2, 1, 2, 2, 2, 1], 'ionian': [2, 2, 1, 2, 2, 2, 1], 'dorian': [2, 1, 2, 2, 2, 1, 2], 'phrygian': [1, 2, 2, 2, 1, 2, 2], 'lydian': [2, 2, 2, 1, 2, 2, 1], 'mixolydian': [2, 2, 1, 2, 2, 1, 2], 'locrian': [1, 2, 2, 1, 2, 2, 2], 'minor': [2, 1, 2, 2, 1, 2, 2], 'aeolian': [2, 1, 2, 2, 1, 2, 2], 'jazz_minor': [2, 1, 2, 2, 2, 2, 1], } MAJOR = 'major' IONIAN = 'ionian' DORIAN = 'dorian' PHRYGIAN = 'phrygian' LYDIAN = 'lydian' LOCRIAN = 'locrian' MINOR = 'minor' AEOLIAN = 'aeolian' JAZZ_MINOR = 'jazz_minor'
#divide 2 numbers x = int(input("Enter first number :")) y = int(input("Enter second number :")) answer = int(x/y) remainder = x % y print("{} divided by {} is {} with a remainder of {}".format(x,y,answer,remainder))
def return_true(): return True if __name__ == "__main__": print("shipit")
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: the root node @param L: an integer @param R: an integer @return: the sum """ def rangeSumBST(self, root, L, R): # write your code here. if root is None: return 0 if root.val < L: return self.rangeSumBST(root.right, L, R) elif root.val > R: return self.rangeSumBST(root.left, L, R) else: return root.val + self.rangeSumBST(root.left, L, R) + self.rangeSumBST(root.right, L, R)
''' Crie um programa que leia vários números inteiros pelo teclado. No final da execução, mostre a média entre todos os valores e qual foi o maior e o menor valores lidos. O programa deve perguntar ao usuário se ele quer ou não continuar a digitar valores. ''' continuar = 'S' acumulador = 0 contador = 0 numero = 0 media = 0 maior = 0 menor = 9*100 while continuar == 'S': numero = int(input('n: ')) acumulador += numero contador += 1 media = acumulador/contador if numero > maior: maior = numero if numero < menor: menor = numero continuar = input('Deseja continuar? [S/N]: ').upper() media = acumulador/contador print('média: ', media) print('maior: ', maior) print('menor: ', menor)
#!python3.6 #encoding: utf-8 # https://teratail.com/questions/52151 class Deco: def __init__(self): self.value = 'value' def deco(func): def wrapper(self, *args, **kwargs): print('----- start -----') print('self.value =', self.value) # AttributeError: 'C' object has no attribute 'value' ret = func(self, *args, **kwargs) print('----- end -----') return ret return wrapper class C: @Deco.deco def test(self, *args, **kwargs): for a in args: print(a) for k,v in kwargs.items(): print(k, v) return 'RETURN' print(C().test(1, 'a', key1='value1'))
expected_output = { "Mgmt-intf": { "address_family": { "ipv4 unicast": { "flags": "0x0", "table_id": "0x1", "vrf_label": {"allocation_mode": "per-prefix"}, } }, "cli_format": "New", "flags": "0x1808", "interface": {"GigabitEthernet1": {"vrf": "Mgmt-intf"}}, "interfaces": ["GigabitEthernet1"], "support_af": "multiple address-families", "vrf_id": 1, }, "VRF1": { "address_family": { "ipv4 unicast": { "flags": "0x0", "table_id": "0x2", "vrf_label": { "allocation_mode": "per-prefix", "distribution_protocol": "LDP", }, } }, "cli_format": "New", "flags": "0x180C", "interface": { "GigabitEthernet2.390": {"vrf": "VRF1"}, "GigabitEthernet2.410": {"vrf": "VRF1"}, "GigabitEthernet2.415": {"vrf": "VRF1"}, "GigabitEthernet2.420": {"vrf": "VRF1"}, "GigabitEthernet3.390": {"vrf": "VRF1"}, "GigabitEthernet3.410": {"vrf": "VRF1"}, "GigabitEthernet3.415": {"vrf": "VRF1"}, "GigabitEthernet3.420": {"vrf": "VRF1"}, "Loopback300": {"vrf": "VRF1"}, "Tunnel1": {"vrf": "VRF1"}, "Tunnel3": {"vrf": "VRF1"}, "Tunnel4": {"vrf": "VRF1"}, "Tunnel6": {"vrf": "VRF1"}, "Tunnel8": {"vrf": "VRF1"}, }, "interfaces": [ "Tunnel1", "Loopback300", "GigabitEthernet2.390", "GigabitEthernet2.410", "GigabitEthernet2.415", "GigabitEthernet2.420", "GigabitEthernet3.390", "GigabitEthernet3.410", "GigabitEthernet3.415", "GigabitEthernet3.420", "Tunnel3", "Tunnel4", "Tunnel6", "Tunnel8", ], "route_distinguisher": "65000:1", "support_af": "multiple address-families", "vrf_id": 2, }, }
#MenuTitle: Control Characters # -*- coding: utf-8 -*- __doc__=""" Creates a new tab with selected glyphs between control characters. """ Font = Glyphs.font tab = '' # supports latin, greek and cyrillic uppercase = ["A", "Aacute", "Abreve", "Abreveacute", "Abrevedotbelow", "Abrevegrave", "Abrevehookabove", "Abrevetilde", "Acaron", "Acircumflex", "Acircumflexacute", "Acircumflexdotbelow", "Acircumflexgrave", "Acircumflexhookabove", "Acircumflextilde", "Adieresis", "Adieresismacron", "Adotbelow", "Agrave", "Ahookabove", "Alpha-latin", "Amacron", "Aogonek", "Aring", "Atilde", "AE", "AEacute", "AEmacron", "B", "Bdotbelow", "Bhook", "Bstroke", "C", "Cacute", "Ccaron", "Ccedilla", "Ccircumflex", "Cdotaccent", "Chook", "D", "DZ", "DZcaron", "Eth", "Dcaron", "Dcircumflexbelow", "Dcroat", "Ddotbelow", "Dhook", "Dmacronbelow", "Dtail", "Dz", "Dzcaron", "E", "Eacute", "Ebreve", "Ecaron", "Ecedilla", "Ecircumflex", "Ecircumflexacute", "Ecircumflexdotbelow", "Ecircumflexgrave", "Ecircumflexhookabove", "Ecircumflextilde", "Edieresis", "Edotaccent", "Edotbelow", "Egrave", "Ehookabove", "Emacron", "Eogonek", "Eopen", "Ereversed", "Esh", "Etilde", "Ezh", "Ezhcaron", "F", "Fhook", "G", "Gbreve", "Gcaron", "Gcircumflex", "Gcommaaccent", "Gdotaccent", "Ghook", "Gmacron", "Gstroke", "H", "Hbar", "Hbrevebelow", "Hcircumflex", "Hdotbelow", "Hhook", "Hturned", "I", "IJ", "Iacute", "Ibreve", "Icaron", "Icircumflex", "Idieresis", "Idieresisacute", "Idotaccent", "Idotbelow", "Igrave", "Ihookabove", "Imacron", "Iogonek", "Iota-latin", "Istroke", "Itilde", "J", "Jacute", "Jcircumflex", "K", "Kcaron", "Kcommaaccent", "Khook", "Kmacronbelow", "L", "Lacute", "Lcaron", "Lcircumflexbelow", "Lcommaaccent", "Ldot", "Ldotbelow", "Ldotbelowmacron", "Lmacronbelow", "Lslash", "M", "Macute", "Mdotaccent", "Mdotbelow", "N", "Nacute", "Ncaron", "Ncircumflexbelow", "Ncommaaccent", "Ndotaccent", "Ndotbelow", "Nhookleft", "Nmacronbelow", "Ntilde", "Eng", "O", "Oacute", "Obreve", "Ocaron", "Ocircumflex", "Ocircumflexacute", "Ocircumflexdotbelow", "Ocircumflexgrave", "Ocircumflexhookabove", "Ocircumflextilde", "Odieresis", "Odieresismacron", "Odotbelow", "Ograve", "Ohookabove", "Ohorn", "Ohornacute", "Ohorndotbelow", "Ohorngrave", "Ohornhookabove", "Ohorntilde", "Ohungarumlaut", "Omacron", "Omacronacute", "Omacrongrave", "Oogonek", "Oopen", "Oslash", "Oslashacute", "Otilde", "Otildeacute", "OE", "P", "Phook", "Thorn", "Q", "R", "Racute", "Rcaron", "Rcommaaccent", "Rdotbelowmacron", "Rmacronbelow", "Rstroke", "Rtail", "S", "Sacute", "Saltillo", "Scaron", "Scedilla", "Scircumflex", "Scommaaccent", "Sdotbelow", "Germandbls", "Schwa", "T", "Tbar", "Tcaron", "Tcedilla", "Tcircumflexbelow", "Tcommaaccent", "Tdotbelow", "Thook", "Tmacronbelow", "Tretroflexhook", "U", "Uacute", "Ubar", "Ubreve", "Ucaron", "Ucircumflex", "Udieresis", "Udieresisacute", "Udieresiscaron", "Udieresisgrave", "Udieresismacron", "Udotbelow", "Ugrave", "Uhookabove", "Uhorn", "Uhornacute", "Uhorndotbelow", "Uhorngrave", "Uhornhookabove", "Uhorntilde", "Uhungarumlaut", "Umacron", "Uogonek", "Upsilon-latin", "Uring", "Utilde", "V", "Gamma-latin", "Vhook", "Vturned", "W", "Wacute", "Wcircumflex", "Wdieresis", "Wgrave", "Whook", "X", "Y", "Yacute", "Ycircumflex", "Ydieresis", "Ydotaccent", "Ydotbelow", "Ygrave", "Yhook", "Yhookabove", "Ymacron", "Ytilde", "Z", "Zacute", "Zcaron", "Zdotaccent", "Zdotbelow", "Zmacronbelow", "Lcommaaccent.loclMAH", "Ncommaaccent.loclMAH", "A-cy", "Be-cy", "Ve-cy", "Ge-cy", "Gje-cy", "Geupturn-cy", "Gedescender-cy", "Gestroke-cy", "Gemiddlehook-cy", "De-cy", "Ie-cy", "Iegrave-cy", "Io-cy", "Zhe-cy", "Ze-cy", "Ii-cy", "Iishort-cy", "Iigrave-cy", "Ka-cy", "Kje-cy", "El-cy", "Em-cy", "En-cy", "O-cy", "Pe-cy", "Er-cy", "Es-cy", "Te-cy", "U-cy", "Ushort-cy", "Ef-cy", "Ha-cy", "Che-cy", "Tse-cy", "Sha-cy", "Shcha-cy", "Dzhe-cy", "Softsign-cy", "Yeru-cy", "Hardsign-cy", "Lje-cy", "Nje-cy", "Dze-cy", "E-cy", "Ereversed-cy", "I-cy", "Yi-cy", "Je-cy", "Tshe-cy", "Yu-cy", "Ya-cy", "Dje-cy", "Yat-cy", "Yusbig-cy", "Fita-cy", "Izhitsa-cy", "Zhedescender-cy", "Zedescender-cy", "Kadescender-cy", "Kaverticalstroke-cy", "Kastroke-cy", "Kabashkir-cy", "Endescender-cy", "EnGe-cy", "Pemiddlehook-cy", "Pedescender-cy", "Haabkhasian-cy", "Esdescender-cy", "Tedescender-cy", "Ustraight-cy", "Ustraightstroke-cy", "Hadescender-cy", "Tetse-cy", "Chedescender-cy", "Cheverticalstroke-cy", "Shha-cy", "Shhadescender-cy", "Cheabkhasian-cy", "Chedescenderabkhasian-cy", "Palochka-cy", "Zhebreve-cy", "Kahook-cy", "Eltail-cy", "Enhook-cy", "Entail-cy", "Chekhakassian-cy", "Emtail-cy", "Abreve-cy", "Adieresis-cy", "Aie-cy", "Iebreve-cy", "Schwa-cy", "Schwadieresis-cy", "Zhedieresis-cy", "Zedieresis-cy", "Dzeabkhasian-cy", "Imacron-cy", "Idieresis-cy", "Odieresis-cy", "Obarred-cy", "Obarreddieresis-cy", "Edieresis-cy", "Umacron-cy", "Udieresis-cy", "Uhungarumlaut-cy", "Chedieresis-cy", "Yerudieresis-cy", "Hahook-cy", "Reversedze-cy", "Elhook-cy", "We-cy", "De-cy.loclBGR", "El-cy.loclBGR", "Ef-cy.loclBGR", "Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda", "Mu", "Nu", "Xi", "Omicron", "Pi", "Rho", "Sigma", "Tau", "Upsilon", "Phi", "Chi", "Psi", "Omega", "Alphatonos", "Epsilontonos", "Etatonos", "Iotatonos", "Omicrontonos", "Upsilontonos", "Omegatonos", "Iotadieresis", "Upsilondieresis", "Heta", "Archaicsampi", "Pamphyliandigamma", "KoppaArchaic", "Stigma", "Digamma", "Koppa", "Sampi", "KaiSymbol", "Sho", "San", "Alphapsili", "Alphadasia", "Alphapsilivaria", "Alphadasiavaria", "Alphapsilioxia", "Alphadasiaoxia", "Alphapsiliperispomeni", "Alphadasiaperispomeni", "Alphavaria", "Alphaoxia", "Alphavrachy", "Alphamacron", "Alphaprosgegrammeni", "Alphapsiliprosgegrammeni", "Alphadasiaprosgegrammeni", "Alphapsilivariaprosgegrammeni", "Alphadasiavariaprosgegrammeni", "Alphapsilioxiaprosgegrammeni", "Alphadasiaoxiaprosgegrammeni", "Alphapsiliperispomeniprosgegrammeni", "Alphadasiaperispomeniprosgegrammeni", "Epsilonpsili", "Epsilondasia", "Epsilonpsilivaria", "Epsilondasiavaria", "Epsilonpsilioxia", "Epsilondasiaoxia", "Epsilonvaria", "Epsilonoxia", "Etapsili", "Etadasia", "Etapsilivaria", "Etadasiavaria", "Etapsilioxia", "Etadasiaoxia", "Etapsiliperispomeni", "Etadasiaperispomeni", "Etavaria", "Etaoxia", "Etaprosgegrammeni", "Etapsiliprosgegrammeni", "Etadasiaprosgegrammeni", "Etapsilivariaprosgegrammeni", "Etadasiavariaprosgegrammeni", "Etapsilioxiaprosgegrammeni", "Etadasiaoxiaprosgegrammeni", "Etapsiliperispomeniprosgegrammeni", "Etadasiaperispomeniprosgegrammeni", "Iotapsili", "Iotadasia", "Iotapsilivaria", "Iotadasiavaria", "Iotapsilioxia", "Iotadasiaoxia", "Iotapsiliperispomeni", "Iotadasiaperispomeni", "Iotavaria", "Iotaoxia", "Iotavrachy", "Iotamacron", "Omicronpsili", "Omicrondasia", "Omicronpsilivaria", "Omicrondasiavaria", "Omicronpsilioxia", "Omicrondasiaoxia", "Omicronvaria", "Omicronoxia", "Rhodasia", "Upsilondasia", "Upsilondasiavaria", "Upsilondasiaoxia", "Upsilondasiaperispomeni", "Upsilonvaria", "Upsilonoxia", "Upsilonvrachy", "Upsilonmacron", "Omegapsili", "Omegadasia", "Omegapsilivaria", "Omegadasiavaria", "Omegapsilioxia", "Omegadasiaoxia", "Omegapsiliperispomeni", "Omegadasiaperispomeni", "Omegavaria", "Omegaoxia", "Omegaprosgegrammeni", "Omegapsiliprosgegrammeni", "Omegadasiaprosgegrammeni", "Omegapsilivariaprosgegrammeni", "Omegadasiavariaprosgegrammeni", "Omegapsilioxiaprosgegrammeni", "Omegadasiaoxiaprosgegrammeni", "Omegapsiliperispomeniprosgegrammeni", "Omegadasiaperispomeniprosgegrammeni", "Alfa-coptic", "Vida-coptic", "Gamma-coptic", "Dalda-coptic", "Eie-coptic", "Sou-coptic", "Zata-coptic", "Hate-coptic", "Thethe-coptic", "Iauda-coptic", "Kapa-coptic", "Laula-coptic", "Mi-coptic", "Ni-coptic", "Ksi-coptic", "O-coptic", "Pi-coptic", "Ro-coptic", "Sima-coptic", "Tau-coptic", "Ua-coptic", "Fi-coptic", "Khi-coptic", "Psi-coptic", "Oou-coptic", "Cryptogrammiceie-coptic", "dialectPkapa-coptic", "dialectPni-coptic", "Cryptogrammicni-coptic", "OouOld-coptic", "Sampi-coptic", "Shei-coptic", "SheiOld-coptic", "EshOld-coptic", "Fei-coptic", "Khei-coptic", "KheiAkhmimic-coptic", "Hori-coptic", "HoriDialectP-coptic", "HoriOld-coptic", "HaOld-coptic", "HaLshaped-coptic", "HeiOld-coptic", "HatOld-coptic", "Gangia-coptic", "GangiaOld-coptic", "Shima-coptic", "DjaOld-coptic", "ShimaOld-coptic", "Shima-nubian", "Dei-coptic", "AlefDialectP-coptic", "AinOld-coptic", "Ngi-nubian", "Nyi-nubian", "Wau-nubian"] lowercase = ["Bsmall", "Gsmall", "Gsmallhook", "Hsmall", "Ismall", "Lsmall", "Nsmall", "OEsmall", "Rsmall", "Rsmallinverted", "Ysmall", "a", "aacute", "abreve", "abreveacute", "abrevedotbelow", "abrevegrave", "abrevehookabove", "abrevetilde", "acaron", "acircumflex", "acircumflexacute", "acircumflexdotbelow", "acircumflexgrave", "acircumflexhookabove", "acircumflextilde", "adieresis", "adieresismacron", "adotbelow", "agrave", "ahookabove", "alpha-latin", "alphaturned-latin", "amacron", "aogonek", "aring", "atilde", "aturned", "ae", "aeacute", "aemacron", "b", "bdotbelow", "bhook", "bidentalpercussive", "bilabialclick", "bilabialpercussive", "bmiddletilde", "c", "cacute", "ccaron", "ccedilla", "ccircumflex", "ccurl", "cdotaccent", "chi-latin", "chook", "d", "eth", "dcaron", "dcircumflexbelow", "dcroat", "ddotbelow", "dezh", "dhook", "dmacronbelow", "dmiddletilde", "dtail", "dz", "dzaltone", "dzcaron", "dzcurl", "e", "eacute", "ebreve", "ecaron", "ecedilla", "ecircumflex", "ecircumflexacute", "ecircumflexdotbelow", "ecircumflexgrave", "ecircumflexhookabove", "ecircumflextilde", "edieresis", "edotaccent", "edotbelow", "egrave", "ehookabove", "emacron", "eogonek", "eopen", "eopenreversed", "eopenreversedclosed", "eopenreversedhook", "ereversed", "esh", "etilde", "eturned", "schwa", "schwahook", "ezh", "ezhcaron", "f", "fengdigraph", "fmiddletilde", "g", "gamma-latin", "gbreve", "gcaron", "gcircumflex", "gcommaaccent", "gdotaccent", "ghook", "glottalstop", "glottalstopreversed", "glottalstopsmall", "glottalstopstroke", "glottalstopstrokereversed", "gmacron", "gsingle", "gstroke", "h", "hbar", "hbrevebelow", "hcircumflex", "hdotbelow", "henghook", "hhook", "hmacronbelow", "hturned", "i", "idotless", "iacute", "ibreve", "icaron", "icircumflex", "idieresis", "idieresisacute", "idotaccent", "idotbelow", "igrave", "ihookabove", "ij", "imacron", "iogonek", "iota-latin", "istroke", "itilde", "j", "jdotless", "jacute", "jcircumflex", "jcrossedtail", "jdotlessstroke", "jdotlessstrokehook", "k", "kcaron", "kcommaaccent", "kgreenlandic", "khook", "kmacronbelow", "kturned", "l", "lacute", "lbelt", "lcaron", "lcircumflexbelow", "lcommaaccent", "ldot", "ldotbelow", "ldotbelowmacron", "lezh", "lhookretroflex", "lmacronbelow", "lmiddletilde", "lsdigraph", "lslash", "lzdigraph", "m", "macute", "mdotaccent", "mdotbelow", "mhook", "mlonglegturned", "mmiddletilde", "mturned", "n", "nacute", "ncaron", "ncircumflexbelow", "ncommaaccent", "ndotaccent", "ndotbelow", "nhookleft", "nhookretroflex", "nmacronbelow", "nmiddletilde", "ntilde", "eng", "o", "oacute", "obarred", "obreve", "ocaron", "ocircumflex", "ocircumflexacute", "ocircumflexdotbelow", "ocircumflexgrave", "ocircumflexhookabove", "ocircumflextilde", "odieresis", "odieresismacron", "odotbelow", "ograve", "ohookabove", "ohorn", "ohornacute", "ohorndotbelow", "ohorngrave", "ohornhookabove", "ohorntilde", "ohungarumlaut", "omacron", "omacronacute", "omacrongrave", "oogonek", "oopen", "oslash", "oslashacute", "otilde", "otildeacute", "oe", "p", "phi-latin", "phook", "thorn", "pmiddletilde", "q", "qhook", "qhooktail", "r", "racute", "ramshorn", "rcaron", "rcommaaccent", "rdotbelowmacron", "rfishhook", "rfishhookmiddletilde", "rhookturned", "rlonglegturned", "rmacronbelow", "rmiddletilde", "rtail", "rturned", "s", "sacute", "saltillo", "scaron", "scedilla", "scircumflex", "scommaaccent", "sdotbelow", "germandbls", "shook", "smiddletilde", "longs", "t", "tbar", "tcaron", "tccurl", "tcedilla", "tcircumflexbelow", "tcommaaccent", "tdieresis", "tdotbelow", "tesh", "thook", "tmacronbelow", "tmiddletilde", "tretroflexhook", "ts", "u", "uacute", "ubar", "ubreve", "ucaron", "ucircumflex", "udieresis", "udieresisacute", "udieresiscaron", "udieresisgrave", "udieresismacron", "udotbelow", "ugrave", "uhookabove", "uhorn", "uhornacute", "uhorndotbelow", "uhorngrave", "uhornhookabove", "uhorntilde", "uhungarumlaut", "umacron", "uogonek", "upsilon-latin", "uring", "utilde", "v", "vhook", "vturned", "w", "wacute", "wcircumflex", "wdieresis", "wgrave", "whook", "wturned", "x", "y", "yacute", "ycircumflex", "ydieresis", "ydotaccent", "ydotbelow", "ygrave", "yhook", "yhookabove", "ymacron", "ytilde", "yturned", "z", "zacute", "zcaron", "zcurl", "zdotaccent", "zdotbelow", "zmacronbelow", "zmiddletilde", "zretroflexhook", "lcommaaccent.loclMAH", "ncommaaccent.loclMAH", "a.ordn", "b.ordn", "c.ordn", "d.ordn", "e.ordn", "f.ordn", "g.ordn", "h.ordn", "i.ordn", "j.ordn", "k.ordn", "l.ordn", "m.ordn", "n.ordn", "o.ordn", "p.ordn", "q.ordn", "r.ordn", "s.ordn", "t.ordn", "u.ordn", "v.ordn", "w.ordn", "x.ordn", "y.ordn", "z.ordn", "fi", "fl", "f_b.liga", "f_f.liga", "f_f_b.liga", "f_f_h.liga", "f_f_i.liga", "f_f_idieresis.liga", "f_f_j.liga", "f_f_k.liga", "f_f_l.liga", "f_h.liga", "f_j.liga", "f_k.liga", "a-cy", "be-cy", "ve-cy", "ge-cy", "gje-cy", "geupturn-cy", "gedescender-cy", "gestroke-cy", "gemiddlehook-cy", "de-cy", "ie-cy", "iegrave-cy", "io-cy", "zhe-cy", "ze-cy", "ii-cy", "iishort-cy", "iigrave-cy", "ka-cy", "kje-cy", "el-cy", "em-cy", "en-cy", "o-cy", "pe-cy", "er-cy", "es-cy", "te-cy", "u-cy", "ushort-cy", "ef-cy", "ha-cy", "che-cy", "tse-cy", "sha-cy", "shcha-cy", "dzhe-cy", "softsign-cy", "yeru-cy", "hardsign-cy", "lje-cy", "nje-cy", "dze-cy", "e-cy", "ereversed-cy", "i-cy", "yi-cy", "je-cy", "tshe-cy", "yu-cy", "ya-cy", "dje-cy", "yat-cy", "yusbig-cy", "fita-cy", "izhitsa-cy", "zhedescender-cy", "zedescender-cy", "kadescender-cy", "kaverticalstroke-cy", "kastroke-cy", "kabashkir-cy", "endescender-cy", "enge-cy", "pedescender-cy", "pemiddlehook-cy", "haabkhasian-cy", "esdescender-cy", "tedescender-cy", "ustraight-cy", "ustraightstroke-cy", "hadescender-cy", "tetse-cy", "chedescender-cy", "cheverticalstroke-cy", "shha-cy", "shhadescender-cy", "cheabkhasian-cy", "chedescenderabkhasian-cy", "palochka-cy", "zhebreve-cy", "kahook-cy", "eltail-cy", "enhook-cy", "entail-cy", "chekhakassian-cy", "emtail-cy", "abreve-cy", "adieresis-cy", "aie-cy", "iebreve-cy", "schwa-cy", "schwadieresis-cy", "zhedieresis-cy", "zedieresis-cy", "dzeabkhasian-cy", "imacron-cy", "idieresis-cy", "odieresis-cy", "obarred-cy", "obarreddieresis-cy", "edieresis-cy", "umacron-cy", "udieresis-cy", "uhungarumlaut-cy", "chedieresis-cy", "yerudieresis-cy", "hahook-cy", "reversedze-cy", "elhook-cy", "we-cy", "ve-cy.loclBGR", "ge-cy.loclBGR", "de-cy.loclBGR", "zhe-cy.loclBGR", "ze-cy.loclBGR", "ii-cy.loclBGR", "iishort-cy.loclBGR", "iigrave-cy.loclBGR", "ka-cy.loclBGR", "el-cy.loclBGR", "pe-cy.loclBGR", "te-cy.loclBGR", "tse-cy.loclBGR", "sha-cy.loclBGR", "shcha-cy.loclBGR", "softsign-cy.loclBGR", "hardsign-cy.loclBGR", "yu-cy.loclBGR", "be-cy.loclSRB", "ge-cy.loclSRB", "de-cy.loclSRB", "pe-cy.loclSRB", "te-cy.loclSRB", "sha-cy.loclSRB", "alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta", "iota", "kappa", "lambda", "mu", "nu", "xi", "omicron", "pi", "rho", "sigmafinal", "sigma", "tau", "upsilon", "phi", "chi", "psi", "omega", "iotatonos", "iotadieresis", "iotadieresistonos", "upsilontonos", "upsilondieresis", "upsilondieresistonos", "omicrontonos", "omegatonos", "alphatonos", "epsilontonos", "etatonos", "heta", "archaicsampi", "pamphyliandigamma", "koppaArchaic", "stigma", "digamma", "koppa", "sampi", "kaiSymbol", "sho", "san", "alphapsili", "alphadasia", "alphapsilivaria", "alphadasiavaria", "alphapsilioxia", "alphadasiaoxia", "alphapsiliperispomeni", "alphadasiaperispomeni", "alphavaria", "alphaoxia", "alphaperispomeni", "alphavrachy", "alphamacron", "alphaypogegrammeni", "alphavariaypogegrammeni", "alphaoxiaypogegrammeni", "alphapsiliypogegrammeni", "alphadasiaypogegrammeni", "alphapsilivariaypogegrammeni", "alphadasiavariaypogegrammeni", "alphapsilioxiaypogegrammeni", "alphadasiaoxiaypogegrammeni", "alphapsiliperispomeniypogegrammeni", "alphadasiaperispomeniypogegrammeni", "alphaperispomeniypogegrammeni", "epsilonpsili", "epsilondasia", "epsilonpsilivaria", "epsilondasiavaria", "epsilonpsilioxia", "epsilondasiaoxia", "epsilonvaria", "epsilonoxia", "etapsili", "etadasia", "etapsilivaria", "etadasiavaria", "etapsilioxia", "etadasiaoxia", "etapsiliperispomeni", "etadasiaperispomeni", "etavaria", "etaoxia", "etaperispomeni", "etaypogegrammeni", "etavariaypogegrammeni", "etaoxiaypogegrammeni", "etapsiliypogegrammeni", "etadasiaypogegrammeni", "etapsilivariaypogegrammeni", "etadasiavariaypogegrammeni", "etapsilioxiaypogegrammeni", "etadasiaoxiaypogegrammeni", "etapsiliperispomeniypogegrammeni", "etadasiaperispomeniypogegrammeni", "etaperispomeniypogegrammeni", "iotapsili", "iotadasia", "iotapsilivaria", "iotadasiavaria", "iotapsilioxia", "iotadasiaoxia", "iotapsiliperispomeni", "iotadasiaperispomeni", "iotavaria", "iotaoxia", "iotaperispomeni", "iotavrachy", "iotamacron", "iotadialytikavaria", "iotadialytikaoxia", "iotadialytikaperispomeni", "omicronpsili", "omicrondasia", "omicronpsilivaria", "omicrondasiavaria", "omicronpsilioxia", "omicrondasiaoxia", "omicronvaria", "omicronoxia", "rhopsili", "rhodasia", "upsilonpsili", "upsilondasia", "upsilonpsilivaria", "upsilondasiavaria", "upsilonpsilioxia", "upsilondasiaoxia", "upsilonpsiliperispomeni", "upsilondasiaperispomeni", "upsilonvaria", "upsilonoxia", "upsilonperispomeni", "upsilonvrachy", "upsilonmacron", "upsilondialytikavaria", "upsilondialytikaoxia", "upsilondialytikaperispomeni", "omegapsili", "omegadasia", "omegapsilivaria", "omegadasiavaria", "omegapsilioxia", "omegadasiaoxia", "omegapsiliperispomeni", "omegadasiaperispomeni", "omegavaria", "omegaoxia", "omegaperispomeni", "omegaypogegrammeni", "omegavariaypogegrammeni", "omegaoxiaypogegrammeni", "omegapsiliypogegrammeni", "omegadasiaypogegrammeni", "omegapsilivariaypogegrammeni", "omegadasiavariaypogegrammeni", "omegapsilioxiaypogegrammeni", "omegadasiaoxiaypogegrammeni", "omegapsiliperispomeniypogegrammeni", "omegadasiaperispomeniypogegrammeni", "omegaperispomeniypogegrammeni", "alfa-coptic", "vida-coptic", "gamma-coptic", "dalda-coptic", "eie-coptic", "sou-coptic", "zata-coptic", "hate-coptic", "thethe-coptic", "iauda-coptic", "kapa-coptic", "laula-coptic", "mi-coptic", "ni-coptic", "ksi-coptic", "o-coptic", "pi-coptic", "ro-coptic", "sima-coptic", "tau-coptic", "ua-coptic", "fi-coptic", "khi-coptic", "psi-coptic", "oou-coptic", "cryptogrammiceie-coptic", "dialectpkapa-coptic", "dialectpni-coptic", "cryptogrammicni-coptic", "oouOld-coptic", "sampi-coptic", "shei-coptic", "sheiCrossed-coptic", "sheiCrossed-coptic", "sheiOld-coptic", "eshOld-coptic", "fei-coptic", "khei-coptic", "kheiAkhmimic-coptic", "hori-coptic", "horiDialectP-coptic", "horiOld-coptic", "haOld-coptic", "haLshaped-coptic", "heiOld-coptic", "hatOld-coptic", "gangia-coptic", "gangiaOld-coptic", "shima-coptic", "djaOld-coptic", "shimaOld-coptic", "shima-nubian", "dei-coptic", "alefDialectP-coptic", "ainOld-coptic", "ngi-nubian", "nyi-nubian", "wau-nubian", "prosgegrammeni"] number = ["onehalf-coptic", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "zero.zero", "eight.osf", "five.osf", "four.osf", "zero.lf", "one.lf", "two.lf", "three.lf", "four.lf", "five.lf", "six.lf", "seven.lf", "eight.lf", "nine.lf", "nine.osf", "one.osf", "seven.osf", "six.osf", "three.osf", "two.osf", "zero.osf", "zero.osf.zero", "zero.subs", "one.subs", "two.subs", "three.subs", "four.subs", "five.subs", "six.subs", "seven.subs", "eight.subs", "nine.subs", "zero.dnom", "one.dnom", "two.dnom", "three.dnom", "four.dnom", "five.dnom", "six.dnom", "seven.dnom", "eight.dnom", "nine.dnom", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "zero.numr", "one.numr", "two.numr", "three.numr", "four.numr", "five.numr", "six.numr", "seven.numr", "eight.numr", "nine.numr", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "fraction", "onehalf", "onethird", "twothirds", "onequarter", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths"] separator = ["space-han", "mediumspace-math", "CR", "lefttorightmark", "righttoleftmark", "zerowidthjoiner", "zerowidthnonjoiner", ".null", "emquad", "emspace", "enquad", "enspace", "figurespace", "fourperemspace", "hairspace", "narrownbspace", "punctuationspace", "sixperemspace", "space", "nbspace", "thinspace", "threeperemspace", "zerowidthspace", ".notdef"] punctuation = ["anoteleia", "questiongreek", "fullstop-nubian", "directquestion-nubian", "indirectquestion-nubian", "versedivider-nubian", "fullstop-coptic", "morphologicaldivider-coptic", "dblverticalbar", "undertie", "hyphen", "softhyphen", "endash", "emdash", "underscore", "hyphen.case", "emdash.case", "endash.case", "parenleftinferior", "parenrightinferior", "parenleft", "parenright", "braceleft", "braceright", "bracketleft", "bracketright", "braceleft.case", "braceright.case", "bracketleft.case", "bracketright.case", "parenleft.case", "parenright.case", "parenleft.subs", "parenright.subs", "parenleft.sups", "parenright.sups", "parenleft.tf", "parenright.tf", "braceleft.tf", "braceright.tf", "bracketleft.tf", "bracketright.tf", "quotesinglbase", "quotedblbase", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "guillemetleft", "guillemetright", "guilsinglleft", "guilsinglright", "quotedbl", "quotesingle", "guillemetleft.case", "guillemetright.case", "guilsinglleft.case", "guilsinglright.case", "quotedbl.tf", "quotesingle.tf", "period", "comma", "colon", "semicolon", "ellipsis", "exclam", "exclamdown", "question", "questiondown", "periodcentered", "bullet", "asterisk", "numbersign", "slash", "backslash", "exclamdown.case", "periodcentered.loclCAT", "periodcentered.case", "questiondown.case", "period.subs", "comma.subs", "period.sups", "comma.sups", "period.tf", "comma.tf", "colon.tf", "semicolon.tf", "periodcentered.loclCAT.case"] symbol = ["numero_s", "gammamod-latin", "florin", "numeral-greek", "lowernumeral-greek", "kai-coptic", "miro-coptic", "piro-coptic", "stauros-coptic", "tauro-coptic", "khiro-coptic", "shimasima-coptic", "baht", "diamondBlackSuit", "heavyBlackHeart", "published", "brokenbar", "numero", "lowringmod", "rhotichookmod", "tonebarextrahighmod", "tonebarextralowmod", "tonebarhighmod", "tonebarlowmod", "tonebarmidmod", "unaspiratedmod", "voicingmod", "bitcoin", "cent", "colonsign", "currency", "dollar", "dong", "euro", "kip", "lira", "liraTurkish", "ruble", "rupeeIndian", "sheqel", "sterling", "tugrik", "won", "yen", "divisionslash", "plus", "minus", "multiply", "divide", "equal", "notequal", "greater", "less", "greaterequal", "lessequal", "plusminus", "approxequal", "asciitilde", "logicalnot", "asciicircum", "emptyset", "infinity", "integral", "increment", "product", "summation", "radical", "micro", "partialdiff", "percent", "perthousand", "plus.subs", "minus.subs", "equal.subs", "plus.sups", "minus.sups", "equal.sups", "upArrow", "northEastArrow", "rightArrow", "southEastArrow", "downArrow", "southWestArrow", "leftArrow", "northWestArrow", "leftRightArrow", "upDownArrow", "blackCircle", "dottedCircle", "blackDiamond", "lozenge", "blackSquare", "upBlackTriangle", "rightBlackTriangle", "downBlackTriangle", "leftBlackTriangle", "rightBlackPointer", "leftBlackPointer", "at", "ampersand", "paragraph", "section", "copyright", "registered", "trademark", "degree", "bar", "dagger", "daggerdbl", "degree.tf"] tabular = ["eight.tf", "eight.tosf", "five.tf", "five.tosf", "four.tf", "four.tosf", "nine.tf", "nine.tosf", "one.tf", "one.tosf", "seven.tf", "seven.tosf", "six.tf", "six.tosf", "three.tf", "three.tosf", "two.tf", "two.tosf", "zero.tf", "zero.tosf", "zero.tf.zero", "zero.tosf.zero", "parenleft.tf", "parenright.tf", "braceleft.tf", "braceright.tf", "bracketleft.tf", "bracketright.tf", "quotedbl.tf", "quotesingle.tf", "period.tf", "comma.tf", "colon.tf", "semicolon.tf", "degree.tf"] for glyph in Font.selection: if glyph.name in uppercase: tab += "/H/H/%s/H/O/%s/O/O\n" % (glyph.name, glyph.name) elif glyph.name in lowercase: tab += "/n/n/%s/n/o/%s/o/o\n" % (glyph.name, glyph.name) elif glyph.name in number: tab += "/zero/zero/%s/zero/eight/%s/eight/eight\n" % (glyph.name, glyph.name) elif glyph.name in separator: tab += "/H/H/%s/H/O/%s/O/n/%s/n/o/%s/o/o\n" % (glyph.name, glyph.name, glyph.name, glyph.name) elif glyph.name in punctuation: tab += "/H/H/%s/H/O/%s/O/n/%s/n/o/%s/o/o\n" % (glyph.name, glyph.name, glyph.name, glyph.name) elif glyph.name in symbol: tab += "/H/H/%s/H/O/%s/O/O\n" % (glyph.name, glyph.name) elif glyph.name in tabular: tab += "/zero/zero/%s/zero/eight/%s/eight/eight\n" % (glyph.name, glyph.name) else: tab += "/.notdef/%s/.notdef\n" % (glyph.name) # open new tab with text Font.newTab(tab)
# # Collective Knowledge (indexing through ElasticSearch) # # See CK LICENSE.txt for licensing details # See CK COPYRIGHT.txt for copyright details # # Developer: Grigori Fursin # cfg = {} # Will be updated by CK (meta description of this module) work = {} # Will be updated by CK (temporal data) ck = None # Will be updated by CK (initialized CK kernel) # Local settings ############################################################################## # Initialize module def init(i): """ Input: {} Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ return {'return': 0} ############################################################################## # turn indexing on def on(i): """ Input: {} Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ o = i.get('out', '') i['status'] = 'yes' r = status(i) if r['return'] > 0: return r if o == 'con': ck.out('Indexing is on') return {'return': 0} ############################################################################## # turn indexing off def off(i): """ Input: {} Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ o = i.get('out', '') i['status'] = 'no' r = status(i) if r['return'] > 0: return r if o == 'con': ck.out('Indexing is off') return {'return': 0} ############################################################################## # show indexing status def show(i): """ Input: {} Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ o = i.get('out', '') i['status'] = '' r = status(i) if r['return'] > 0: return r s = r['status'] if s == 'yes': sx = 'on' else: sx = 'off' if o == 'con': ck.out('Indexing status: '+sx) return {'return': 0} ############################################################################## # check indexing status def status(i): """ Input: { status - if 'yes', turn it on if 'no', turn it off if '', return status } Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 status } """ # Get current configuration cfg = {} r = ck.access({'action': 'load', 'repo_uoa': ck.cfg['repo_name_default'], 'module_uoa': ck.cfg['subdir_kernel'], 'data_uoa': ck.cfg['subdir_kernel_default']}) if r['return'] == 0: cfg.update(r['dict']) r = ck.access({'action': 'load', 'repo_uoa': ck.cfg['repo_name_local'], 'module_uoa': ck.cfg['subdir_kernel'], 'data_uoa': ck.cfg['subdir_kernel_default']}) if r['return'] > 0: if r['return'] != 16: return r ck.out('') ck.out('We strongly suggest you to setup local repository first!') return {'return': 0} cfg.update(r['dict']) # Turn on indexing st = i.get('status', '') s = cfg.get('use_indexing', ck.cfg.get('use_indexing', '')) if st != '': cfg['use_indexing'] = st s = st r = ck.access({'action': 'update', 'repo_uoa': ck.cfg['repo_name_local'], 'module_uoa': ck.cfg['subdir_kernel'], 'data_uoa': ck.cfg['subdir_kernel_default'], 'dict': cfg, 'substitute': 'yes', 'ignore_update': 'yes', 'skip_indexing': 'yes'}) if r['return'] > 0: return r return {'return': 0, 'status': s} ############################################################################## # check indexing status def test(i): """ Input: { } Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ o = i.get('out', '') r = ck.access_index_server({'request': 'TEST', 'dict': {}}) if r['return'] > 0: return r dd = r['dict'] status = dd.get('status', 0) if status != 200: return {'return': 1, 'error': 'returned status is not 200'} version = dd.get('version', {}).get('number', '') if o == 'con': ck.out('Indexing server is working (version = '+version+')') return r ############################################################################## # clean whole index def clean(i): """ Input: { (force) - if 'yes', force cleaning } Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 } """ o = i.get('out', '') to_delete = True if o == 'con' and i.get('force', '') != 'yes': r = ck.inp({'text': 'Are you sure to clean the whole index (y/N): '}) c = r['string'].lower() if c != 'y' and c != 'yes': to_delete = False if to_delete: r = ck.access_index_server( {'request': 'DELETE', 'path': '/_all', 'dict': {}}) if r['return'] > 0: return r dd = r['dict'] status = dd.get('status', 0) err = dd.get('error', '') if err != '': r = {'return': 1, 'error': err} return r
class Solution: def longestDupSubstring(self, s: str) -> str: kMod = int(1e9) + 7 bestStart = -1 l = 1 r = len(s) def val(c: str) -> int: return ord(c) - ord('a') # k := length of hashed substring def getStart(k: int) -> Optional[int]: maxPow = pow(26, k - 1, kMod) hashedToStart = defaultdict(list) h = 0 # compute hash value of s[:k] for i in range(k): h = (h * 26 + val(s[i])) % kMod hashedToStart[h].append(0) # compute rolling hash by Rabin Karp for i in range(k, len(s)): startIndex = i - k + 1 h = (h - maxPow * val(s[i - k])) % kMod h = (h * 26 + val(s[i])) % kMod if h in hashedToStart: currSub = s[startIndex:startIndex + k] for start in hashedToStart[h]: if s[start:start + k] == currSub: return startIndex hashedToStart[h].append(startIndex) while l < r: m = (l + r) // 2 start: Optional[int] = getStart(m) if start: bestStart = start l = m + 1 else: r = m if bestStart == -1: return '' if getStart(l): return s[bestStart:bestStart + l] return s[bestStart:bestStart + l - 1]
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = "rightASSIGNrightNOTnonassocLESSEQ<=left+-left*/rightISVOIDleft~left@left.ASSIGN CASE CLASS COMMENT ELSE ESAC FALSE FI ID IF IN INHERITS INT ISVOID LESSEQ LET LOOP NEW NOT OF POOL RET STRING THEN TRUE TYPE WHILEprogram : class_listclass_list : class ';' class_list\n | class ';'class : CLASS TYPE INHERITS TYPE '{' feature_list '}'\n | CLASS TYPE '{' feature_list '}'feature_list : attribute ';' feature_list\n | method ';' feature_list\n | emptyattribute : ID ':' TYPE ASSIGN expression\n | ID ':' TYPE method : ID '(' params_list ')' ':' TYPE '{' expression '}'params_list : param ',' params_list\n | paramparams_list : emptyparam : ID ':' TYPEexpression_list : expression ';' expression_list\n | expression ';' expression : ID ASSIGN expressionexpression : IF expression THEN expression ELSE expression FIexpression : WHILE expression LOOP expression POOLexpression : '{' expression_list '}'expression : LET let_list IN expressionlet_list : let_single ',' let_list\n | let_singlelet_single : ID ':' TYPE ASSIGN expression\n | ID ':' TYPEexpression : CASE expression OF case_list ESACcase_list : case_single case_list\n | case_singlecase_single : ID ':' TYPE RET expression ';'expression : expression '@' TYPE '.' ID '(' args_list ')'\n | expression '.' ID '(' args_list ')'\n | ID '(' args_list ')'args_list : expression ',' args_list\n | expressionargs_list : emptyexpression : NEW TYPEexpression : ISVOID expressionexpression : NOT expressionexpression : '~' expressionexpression : expression '+' expressionexpression : expression '-' expressionexpression : expression '/' expressionexpression : expression '*' expressionexpression : expression '<' expressionexpression : expression LESSEQ expressionexpression : expression '=' expressionexpression : '(' expression ')'expression : STRINGexpression : IDexpression : TRUEexpression : FALSEexpression : INTempty : " _lr_action_items = {'CLASS':([0,5,],[4,4,]),'$end':([1,2,5,7,],[0,-1,-3,-2,]),';':([3,12,13,17,25,30,35,36,47,48,49,50,68,74,75,76,77,79,85,86,87,88,89,90,91,94,100,102,109,120,122,125,127,132,134,135,],[5,18,19,-5,-10,-4,-50,-9,-49,-51,-52,-53,95,-37,-38,-39,-40,-18,-41,-42,-43,-44,-45,-46,-47,-21,-48,-33,-22,-20,-27,-11,-32,-19,-31,136,]),'TYPE':([4,8,20,32,43,52,56,98,124,],[6,10,25,51,74,78,83,111,130,]),'INHERITS':([6,],[8,]),'{':([6,10,31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,78,92,93,95,96,101,103,105,119,121,126,133,],[9,16,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,101,39,39,39,39,39,39,39,39,39,39,39,]),'ID':([9,16,18,19,21,31,34,37,38,39,40,41,42,44,45,46,54,55,57,58,59,60,61,62,63,64,92,93,95,96,97,99,101,103,104,105,113,119,121,126,133,136,],[15,15,15,15,26,35,26,35,35,35,71,35,35,35,35,35,35,35,84,35,35,35,35,35,35,35,35,35,35,35,71,114,35,35,117,35,114,35,35,35,35,-30,]),'}':([9,11,14,16,18,19,22,23,24,35,47,48,49,50,67,74,75,76,77,79,85,86,87,88,89,90,91,94,95,100,102,108,109,115,120,122,127,132,134,],[-54,17,-8,-54,-54,-54,30,-6,-7,-50,-49,-51,-52,-53,94,-37,-38,-39,-40,-18,-41,-42,-43,-44,-45,-46,-47,-21,-17,-48,-33,-16,-22,125,-20,-27,-32,-19,-31,]),':':([15,26,33,71,114,],[20,32,52,98,124,]),'(':([15,31,35,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,84,92,93,95,96,101,103,105,117,119,121,126,133,],[21,42,55,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,105,42,42,42,42,42,42,42,126,42,42,42,42,]),')':([21,27,28,29,34,35,47,48,49,50,51,53,55,73,74,75,76,77,79,80,81,82,85,86,87,88,89,90,91,94,100,102,103,105,109,116,118,120,122,126,127,131,132,134,],[-54,33,-13,-14,-54,-50,-49,-51,-52,-53,-15,-12,-54,100,-37,-38,-39,-40,-18,102,-35,-36,-41,-42,-43,-44,-45,-46,-47,-21,-48,-33,-54,-54,-22,-34,127,-20,-27,-54,-32,134,-19,-31,]),'ASSIGN':([25,35,111,],[31,54,121,]),',':([28,35,47,48,49,50,51,70,74,75,76,77,79,81,85,86,87,88,89,90,91,94,100,102,109,111,120,122,127,129,132,134,],[34,-50,-49,-51,-52,-53,-15,97,-37,-38,-39,-40,-18,103,-41,-42,-43,-44,-45,-46,-47,-21,-48,-33,-22,-26,-20,-27,-32,-25,-19,-31,]),'IF':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,]),'WHILE':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,]),'LET':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,]),'CASE':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,]),'NEW':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,]),'ISVOID':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'NOT':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'~':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,]),'STRING':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,]),'TRUE':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,]),'FALSE':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,]),'INT':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,]),'@':([35,36,47,48,49,50,65,66,68,72,73,74,75,76,77,79,81,85,86,87,88,89,90,91,94,100,102,106,107,109,115,120,122,127,128,129,132,134,135,],[-50,56,-49,-51,-52,-53,56,56,56,56,56,-37,56,56,56,56,56,56,56,56,56,56,56,56,-21,-48,-33,56,56,56,56,-20,-27,-32,56,56,-19,-31,56,]),'.':([35,36,47,48,49,50,65,66,68,72,73,74,75,76,77,79,81,83,85,86,87,88,89,90,91,94,100,102,106,107,109,115,120,122,127,128,129,132,134,135,],[-50,57,-49,-51,-52,-53,57,57,57,57,57,-37,57,57,57,57,57,104,57,57,57,57,57,57,57,-21,-48,-33,57,57,57,57,-20,-27,-32,57,57,-19,-31,57,]),'+':([35,36,47,48,49,50,65,66,68,72,73,74,75,76,77,79,81,85,86,87,88,89,90,91,94,100,102,106,107,109,115,120,122,127,128,129,132,134,135,],[-50,58,-49,-51,-52,-53,58,58,58,58,58,-37,-38,58,-40,58,58,-41,-42,-43,-44,58,58,58,-21,-48,-33,58,58,58,58,-20,-27,-32,58,58,-19,-31,58,]),'-':([35,36,47,48,49,50,65,66,68,72,73,74,75,76,77,79,81,85,86,87,88,89,90,91,94,100,102,106,107,109,115,120,122,127,128,129,132,134,135,],[-50,59,-49,-51,-52,-53,59,59,59,59,59,-37,-38,59,-40,59,59,-41,-42,-43,-44,59,59,59,-21,-48,-33,59,59,59,59,-20,-27,-32,59,59,-19,-31,59,]),'/':([35,36,47,48,49,50,65,66,68,72,73,74,75,76,77,79,81,85,86,87,88,89,90,91,94,100,102,106,107,109,115,120,122,127,128,129,132,134,135,],[-50,60,-49,-51,-52,-53,60,60,60,60,60,-37,-38,60,-40,60,60,60,60,-43,-44,60,60,60,-21,-48,-33,60,60,60,60,-20,-27,-32,60,60,-19,-31,60,]),'*':([35,36,47,48,49,50,65,66,68,72,73,74,75,76,77,79,81,85,86,87,88,89,90,91,94,100,102,106,107,109,115,120,122,127,128,129,132,134,135,],[-50,61,-49,-51,-52,-53,61,61,61,61,61,-37,-38,61,-40,61,61,61,61,-43,-44,61,61,61,-21,-48,-33,61,61,61,61,-20,-27,-32,61,61,-19,-31,61,]),'<':([35,36,47,48,49,50,65,66,68,72,73,74,75,76,77,79,81,85,86,87,88,89,90,91,94,100,102,106,107,109,115,120,122,127,128,129,132,134,135,],[-50,62,-49,-51,-52,-53,62,62,62,62,62,-37,-38,62,-40,62,62,-41,-42,-43,-44,None,None,None,-21,-48,-33,62,62,62,62,-20,-27,-32,62,62,-19,-31,62,]),'LESSEQ':([35,36,47,48,49,50,65,66,68,72,73,74,75,76,77,79,81,85,86,87,88,89,90,91,94,100,102,106,107,109,115,120,122,127,128,129,132,134,135,],[-50,63,-49,-51,-52,-53,63,63,63,63,63,-37,-38,63,-40,63,63,-41,-42,-43,-44,None,None,None,-21,-48,-33,63,63,63,63,-20,-27,-32,63,63,-19,-31,63,]),'=':([35,36,47,48,49,50,65,66,68,72,73,74,75,76,77,79,81,85,86,87,88,89,90,91,94,100,102,106,107,109,115,120,122,127,128,129,132,134,135,],[-50,64,-49,-51,-52,-53,64,64,64,64,64,-37,-38,64,-40,64,64,-41,-42,-43,-44,None,None,None,-21,-48,-33,64,64,64,64,-20,-27,-32,64,64,-19,-31,64,]),'THEN':([35,47,48,49,50,65,74,75,76,77,79,85,86,87,88,89,90,91,94,100,102,109,120,122,127,132,134,],[-50,-49,-51,-52,-53,92,-37,-38,-39,-40,-18,-41,-42,-43,-44,-45,-46,-47,-21,-48,-33,-22,-20,-27,-32,-19,-31,]),'LOOP':([35,47,48,49,50,66,74,75,76,77,79,85,86,87,88,89,90,91,94,100,102,109,120,122,127,132,134,],[-50,-49,-51,-52,-53,93,-37,-38,-39,-40,-18,-41,-42,-43,-44,-45,-46,-47,-21,-48,-33,-22,-20,-27,-32,-19,-31,]),'OF':([35,47,48,49,50,72,74,75,76,77,79,85,86,87,88,89,90,91,94,100,102,109,120,122,127,132,134,],[-50,-49,-51,-52,-53,99,-37,-38,-39,-40,-18,-41,-42,-43,-44,-45,-46,-47,-21,-48,-33,-22,-20,-27,-32,-19,-31,]),'ELSE':([35,47,48,49,50,74,75,76,77,79,85,86,87,88,89,90,91,94,100,102,106,109,120,122,127,132,134,],[-50,-49,-51,-52,-53,-37,-38,-39,-40,-18,-41,-42,-43,-44,-45,-46,-47,-21,-48,-33,119,-22,-20,-27,-32,-19,-31,]),'POOL':([35,47,48,49,50,74,75,76,77,79,85,86,87,88,89,90,91,94,100,102,107,109,120,122,127,132,134,],[-50,-49,-51,-52,-53,-37,-38,-39,-40,-18,-41,-42,-43,-44,-45,-46,-47,-21,-48,-33,120,-22,-20,-27,-32,-19,-31,]),'FI':([35,47,48,49,50,74,75,76,77,79,85,86,87,88,89,90,91,94,100,102,109,120,122,127,128,132,134,],[-50,-49,-51,-52,-53,-37,-38,-39,-40,-18,-41,-42,-43,-44,-45,-46,-47,-21,-48,-33,-22,-20,-27,-32,132,-19,-31,]),'IN':([35,47,48,49,50,69,70,74,75,76,77,79,85,86,87,88,89,90,91,94,100,102,109,110,111,120,122,127,129,132,134,],[-50,-49,-51,-52,-53,96,-24,-37,-38,-39,-40,-18,-41,-42,-43,-44,-45,-46,-47,-21,-48,-33,-22,-23,-26,-20,-27,-32,-25,-19,-31,]),'ESAC':([112,113,123,136,],[122,-29,-28,-30,]),'RET':([130,],[133,]),} _lr_action = {} for _k, _v in _lr_action_items.items(): for _x,_y in zip(_v[0],_v[1]): if not _x in _lr_action: _lr_action[_x] = {} _lr_action[_x][_k] = _y del _lr_action_items _lr_goto_items = {'program':([0,],[1,]),'class_list':([0,5,],[2,7,]),'class':([0,5,],[3,3,]),'feature_list':([9,16,18,19,],[11,22,23,24,]),'attribute':([9,16,18,19,],[12,12,12,12,]),'method':([9,16,18,19,],[13,13,13,13,]),'empty':([9,16,18,19,21,34,55,103,105,126,],[14,14,14,14,29,29,82,82,82,82,]),'params_list':([21,34,],[27,53,]),'param':([21,34,],[28,28,]),'expression':([31,37,38,39,41,42,44,45,46,54,55,58,59,60,61,62,63,64,92,93,95,96,101,103,105,119,121,126,133,],[36,65,66,68,72,73,75,76,77,79,81,85,86,87,88,89,90,91,106,107,68,109,115,81,81,128,129,81,135,]),'expression_list':([39,95,],[67,108,]),'let_list':([40,97,],[69,110,]),'let_single':([40,97,],[70,70,]),'args_list':([55,103,105,126,],[80,116,118,131,]),'case_list':([99,113,],[112,123,]),'case_single':([99,113,],[113,113,]),} _lr_goto = {} for _k, _v in _lr_goto_items.items(): for _x, _y in zip(_v[0], _v[1]): if not _x in _lr_goto: _lr_goto[_x] = {} _lr_goto[_x][_k] = _y del _lr_goto_items _lr_productions = [ ("S' -> program","S'",1,None,None,None), ('program -> class_list','program',1,'p_program','parsing_rules.py',13), ('class_list -> class ; class_list','class_list',3,'p_class_list','parsing_rules.py',18), ('class_list -> class ;','class_list',2,'p_class_list','parsing_rules.py',19), ('class -> CLASS TYPE INHERITS TYPE { feature_list }','class',7,'p_class','parsing_rules.py',27), ('class -> CLASS TYPE { feature_list }','class',5,'p_class','parsing_rules.py',28), ('feature_list -> attribute ; feature_list','feature_list',3,'p_feature_list','parsing_rules.py',39), ('feature_list -> method ; feature_list','feature_list',3,'p_feature_list','parsing_rules.py',40), ('feature_list -> empty','feature_list',1,'p_feature_list','parsing_rules.py',41), ('attribute -> ID : TYPE ASSIGN expression','attribute',5,'p_attribute','parsing_rules.py',49), ('attribute -> ID : TYPE','attribute',3,'p_attribute','parsing_rules.py',50), ('method -> ID ( params_list ) : TYPE { expression }','method',9,'p_method','parsing_rules.py',60), ('params_list -> param , params_list','params_list',3,'p_params_list','parsing_rules.py',66), ('params_list -> param','params_list',1,'p_params_list','parsing_rules.py',67), ('params_list -> empty','params_list',1,'p_params_list_empty','parsing_rules.py',74), ('param -> ID : TYPE','param',3,'p_param','parsing_rules.py',79), ('expression_list -> expression ; expression_list','expression_list',3,'p_expression_list','parsing_rules.py',86), ('expression_list -> expression ;','expression_list',2,'p_expression_list','parsing_rules.py',87), ('expression -> ID ASSIGN expression','expression',3,'p_expression_assigment','parsing_rules.py',95), ('expression -> IF expression THEN expression ELSE expression FI','expression',7,'p_expression_if_then_else','parsing_rules.py',102), ('expression -> WHILE expression LOOP expression POOL','expression',5,'p_expression_while','parsing_rules.py',109), ('expression -> { expression_list }','expression',3,'p_expression_block','parsing_rules.py',116), ('expression -> LET let_list IN expression','expression',4,'p_expression_let_in','parsing_rules.py',123), ('let_list -> let_single , let_list','let_list',3,'p_let_list','parsing_rules.py',130), ('let_list -> let_single','let_list',1,'p_let_list','parsing_rules.py',131), ('let_single -> ID : TYPE ASSIGN expression','let_single',5,'p_let_single','parsing_rules.py',139), ('let_single -> ID : TYPE','let_single',3,'p_let_single','parsing_rules.py',140), ('expression -> CASE expression OF case_list ESAC','expression',5,'p_expression_case','parsing_rules.py',150), ('case_list -> case_single case_list','case_list',2,'p_case_list','parsing_rules.py',157), ('case_list -> case_single','case_list',1,'p_case_list','parsing_rules.py',158), ('case_single -> ID : TYPE RET expression ;','case_single',6,'p_case_single','parsing_rules.py',166), ('expression -> expression @ TYPE . ID ( args_list )','expression',8,'p_expression_dispatch','parsing_rules.py',174), ('expression -> expression . ID ( args_list )','expression',6,'p_expression_dispatch','parsing_rules.py',175), ('expression -> ID ( args_list )','expression',4,'p_expression_dispatch','parsing_rules.py',176), ('args_list -> expression , args_list','args_list',3,'p_args_list','parsing_rules.py',192), ('args_list -> expression','args_list',1,'p_args_list','parsing_rules.py',193), ('args_list -> empty','args_list',1,'p_args_list_empty','parsing_rules.py',201), ('expression -> NEW TYPE','expression',2,'p_expression_instatiate','parsing_rules.py',205), ('expression -> ISVOID expression','expression',2,'p_expression_isvoid','parsing_rules.py',212), ('expression -> NOT expression','expression',2,'p_expression_not','parsing_rules.py',218), ('expression -> ~ expression','expression',2,'p_expression_complement','parsing_rules.py',225), ('expression -> expression + expression','expression',3,'p_expression_plus','parsing_rules.py',232), ('expression -> expression - expression','expression',3,'p_expression_minus','parsing_rules.py',239), ('expression -> expression / expression','expression',3,'p_expression_div','parsing_rules.py',246), ('expression -> expression * expression','expression',3,'p_expression_star','parsing_rules.py',252), ('expression -> expression < expression','expression',3,'p_expression_less','parsing_rules.py',258), ('expression -> expression LESSEQ expression','expression',3,'p_expression_lesseq','parsing_rules.py',264), ('expression -> expression = expression','expression',3,'p_expression_equals','parsing_rules.py',270), ('expression -> ( expression )','expression',3,'p_expression_parentheses','parsing_rules.py',276), ('expression -> STRING','expression',1,'p_expression_string','parsing_rules.py',283), ('expression -> ID','expression',1,'p_expression_variable','parsing_rules.py',290), ('expression -> TRUE','expression',1,'p_expression_true','parsing_rules.py',297), ('expression -> FALSE','expression',1,'p_expression_false','parsing_rules.py',304), ('expression -> INT','expression',1,'p_expression_int','parsing_rules.py',311), ('empty -> <empty>','empty',0,'p_empty','parsing_rules.py',318), ]
class Truss(Element,IDisposable): """ Represents all kinds of Trusses. """ def AttachChord(self,attachToElement,location,forceRemoveSketch): """ AttachChord(self: Truss,attachToElement: Element,location: TrussChordLocation,forceRemoveSketch: bool) Attach a truss's specific chord to a specified element,the element should be a roof or floor. attachToElement: The element to which the truss's chord will attach. The element should be a roof or floor. location: The chord need to be attached. forceRemoveSketch: Whether to detach the original sketch if there is one. """ pass @staticmethod def Create(document,trussTypeId,sketchPlaneId,curve): """ Create(document: Document,trussTypeId: ElementId,sketchPlaneId: ElementId,curve: Curve) -> Truss Creates a new Truss. document: The document in which the new Truss is created. trussTypeId: Element id of the truss type. sketchPlaneId: Element id of a SketchPlane. curve: The curve of the truss element. It must be a line,must not be a vertical line,and must be within the sketch plane. """ pass def DetachChord(self,location): """ DetachChord(self: Truss,location: TrussChordLocation) Detach a truss's specific chord from the element to which it is attached. location: The chord. """ pass def Dispose(self): """ Dispose(self: Element,A_0: bool) """ pass @staticmethod def DropTruss(truss): """ DropTruss(truss: Truss) Drop truss Family,it will disassociate all members from the truss and delete the truss. truss: The truss to be dropped. """ pass def getBoundingBox(self,*args): """ getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """ pass def GetTrussMemberInfo(self,elemId): """ GetTrussMemberInfo(self: Truss,elemId: ElementId) -> TrussMemberInfo Query if a given element is a member of a truss,its lock status and its usage, etc. elemId: The querying element. Returns: A struct TrussMemberInfo that contains the querying element's host truss, whether to lock to the truss,usage type,etc. """ pass def ReleaseUnmanagedResources(self,*args): """ ReleaseUnmanagedResources(self: Element,disposing: bool) """ pass def RemoveProfile(self): """ RemoveProfile(self: Truss) Remove the profile of a truss. """ pass def setElementType(self,*args): """ setElementType(self: Element,type: ElementType,incompatibleExceptionMessage: str) """ pass def SetProfile(self,topChords,bottomChords): """ SetProfile(self: Truss,topChords: CurveArray,bottomChords: CurveArray) Add or modify the profile of a truss. topChords: The curves serving as top chords of the truss. bottomChords: The curves serving as bottom chords of the truss. """ pass def TogglePinMember(self,elemId): """ TogglePinMember(self: Truss,elemId: ElementId) Pin/Unpin a truss member. elemId: The member element is going to pin/unpin. """ 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 Curves=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get all the truss curves. Get: Curves(self: Truss) -> CurveArray """ Members=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get all the members of truss. Get: Members(self: Truss) -> ICollection[ElementId] """ TrussType=property(lambda self: object(),lambda self,v: None,lambda self: None) """Retrieve/set an object that represents the type of the truss. Get: TrussType(self: Truss) -> TrussType Set: TrussType(self: Truss)=value """
# This is a simple example script for FL # It should represent a webshop, or at least part of it cart = {} def addToCart(product): if(product not in cart.keys()): cart[str(product)] = 1 else: cart[str(product)] = cart[(str(product))] + 2 # bug -> should be 1 def removeFromCart(product): if(product in cart.keys()): if(cart[str(product)] > 1): cart[str(product)] = cart[str(product)] - 1 elif(cart[str(product)] == 1): del cart[str(product)] else: print("Something's fishy") def printProductsInCart(): print("Your cart: ") for product_name in cart.keys(): product_count = cart[str(product_name)] #print("* " + str(product_name) + ": " + str(product_count)) def getProductCount(product): if(product not in cart.keys()): return 0 else: return cart[str(product)] """ # We need # 4 apples # 1 orange juice # cheeser mum # U for i in range(1,4): addToCart("apple") removeFromCart("apple") addToCart("OJ") addToCart("cheese") addToCart("Ur mum") printProductsInCart() """
# 796. 旋转字符串 # # 20200728 # huao # 这个好像和前面某个题一样的... # 遍历,判断一下就好了 class Solution: def rotateString(self, A: str, B: str) -> bool: if A == '' and B == '': return True lenA = len(A) lenB = len(B) if lenA != lenB: return False for i in range(lenA): if A[:i] == B[lenA-i:] and A[i:] == B[:lenA-i]: return True return False
# 547.朋友圈(Medium) # 班上有 N 名学生。其中有些人是朋友,有些则不是。 # 他们的友谊具有是传递性。如果已知 A 是 B 的朋友,B 是 C 的朋友, # 那么我们可以认为 A 也是 C 的朋友。所谓的朋友圈,是指所有朋友的集合。 # 给定一个 N * N 的矩阵 M,表示班级中学生之间的朋友关系。 # 如果M[i][j] = 1,表示已知第 i 个和 j 个学生互为朋友关系,否则为不知道。 # 你必须输出所有学生中的已知的朋友圈总数。 # 示例 1: # 输入: # [[1,1,0], # [1,1,0], # [0,0,1]] # 输出: 2 # 说明:已知学生0和学生1互为朋友,他们在一个朋友圈。 # 第2个学生自己在一个朋友圈。所以返回2。 # 注意: # N 在[1,200]的范围内。 # 对于所有学生,有M[i][i] = 1。 # 如果有M[i][j] = 1,则有M[j][i] = 1。 class Solution(object): def findCircleNum(self, M): """ :type M: List[List[int]] :rtype: int """ n = len(M) circelNum = 0 visited = [0]*n def dfs(visited,i): for j in range(0,n): if M[i][j] == 1 and visited[j] == 0: visited[j] = 1 dfs(visited,j) for i in range(0,n): if visited[i] == 0: dfs(visited,i) circelNum+=1 return circelNum def findCircleNum_1(self, M): """ :type M: List[List[int]] :rtype: int """ if M == None or len(M) == 0: return 0 stack = [] n = len(M) circelNum = 0 visited = [0]*n for i in range(0,n): if visited[i] == 0: for j in range(0,n): if M[i][j] == 1 and visited[j] == 0: visited[j] = 1 stack.append(j) while len(stack) != 0: x = stack.pop() for k in range(0,n): if M[x][k] == 1 and visited[k] == 0: visited[k] = 1 stack.append(k) circelNum+=1 return circelNum if __name__ == '__main__': M = [[1,0,0,1], [0,1,1,0], [0,1,1,1], [1,0,1,1]] sl = Solution() res = sl.findCircleNum_1(M) print(res)
# # PySNMP MIB module EXTRAHOP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXTRAHOP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:53:00 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint") ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup") Integer32, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, IpAddress, Counter64, enterprises, MibIdentifier, NotificationType, Gauge32, Unsigned32, TimeTicks, ObjectIdentity, ModuleIdentity, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "IpAddress", "Counter64", "enterprises", "MibIdentifier", "NotificationType", "Gauge32", "Unsigned32", "TimeTicks", "ObjectIdentity", "ModuleIdentity", "Counter32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") extrahop = ModuleIdentity((1, 3, 6, 1, 4, 1, 32015)) extrahop.setRevisions(('2015-05-08 00:00',)) if mibBuilder.loadTexts: extrahop.setLastUpdated('201505080000Z') if mibBuilder.loadTexts: extrahop.setOrganization('ExtraHop Networks') extrahopInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 32015, 0)) extrahopInfoVersionString = MibScalar((1, 3, 6, 1, 4, 1, 32015, 0, 0), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopInfoVersionString.setStatus('current') extrahopInfoVersionMajor = MibScalar((1, 3, 6, 1, 4, 1, 32015, 0, 1), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopInfoVersionMajor.setStatus('current') extrahopInfoVersionMinor = MibScalar((1, 3, 6, 1, 4, 1, 32015, 0, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopInfoVersionMinor.setStatus('current') extrahopInfoVersionBranchRelease = MibScalar((1, 3, 6, 1, 4, 1, 32015, 0, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopInfoVersionBranchRelease.setStatus('current') extrahopInfoVersionRevision = MibScalar((1, 3, 6, 1, 4, 1, 32015, 0, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopInfoVersionRevision.setStatus('current') extrahopAlert = MibIdentifier((1, 3, 6, 1, 4, 1, 32015, 1)) extrahopTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 32015, 2)) extrahopObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 32015, 4)) extrahopObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 32015, 4, 1)).setObjects(("EXTRAHOP-MIB", "extrahopAlertName"), ("EXTRAHOP-MIB", "extrahopAlertComment"), ("EXTRAHOP-MIB", "extrahopAlertObjectType"), ("EXTRAHOP-MIB", "extrahopAlertObjectName"), ("EXTRAHOP-MIB", "extrahopAlertExpr"), ("EXTRAHOP-MIB", "extrahopAlertValue"), ("EXTRAHOP-MIB", "extrahopAlertTime"), ("EXTRAHOP-MIB", "extrahopAlertObjectId"), ("EXTRAHOP-MIB", "extrahopAlertObjectStrId"), ("EXTRAHOP-MIB", "extrahopAlertObjectMACAddr"), ("EXTRAHOP-MIB", "extrahopAlertObjectIPAddr"), ("EXTRAHOP-MIB", "extrahopAlertObjectTags"), ("EXTRAHOP-MIB", "extrahopAlertObjectURL"), ("EXTRAHOP-MIB", "extrahopAlertStatName"), ("EXTRAHOP-MIB", "extrahopAlertStatFieldName"), ("EXTRAHOP-MIB", "extrahopAlertSeverity"), ("EXTRAHOP-MIB", "extrahopStatsPktsSinceBoot"), ("EXTRAHOP-MIB", "extrahopStatsBytesSinceBoot"), ("EXTRAHOP-MIB", "extrahopStorageAlertRole"), ("EXTRAHOP-MIB", "extrahopStorageAlertDevice"), ("EXTRAHOP-MIB", "extrahopStorageAlertStatus"), ("EXTRAHOP-MIB", "extrahopStorageAlertDetails"), ("EXTRAHOP-MIB", "extrahopStorageAlertSeverity"), ("EXTRAHOP-MIB", "extrahopStorageAlertMachine")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): extrahopObjectGroup = extrahopObjectGroup.setStatus('current') extrahopNotificationGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 32015, 4, 2)).setObjects(("EXTRAHOP-MIB", "extrahopAlertTrap"), ("EXTRAHOP-MIB", "extrahopStorageAlertTrap")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): extrahopNotificationGroup = extrahopNotificationGroup.setStatus('current') extrahopAlertTrap = NotificationType((1, 3, 6, 1, 4, 1, 32015, 2, 1)).setObjects(("EXTRAHOP-MIB", "extrahopAlertName"), ("EXTRAHOP-MIB", "extrahopAlertComment"), ("EXTRAHOP-MIB", "extrahopAlertObjectType"), ("EXTRAHOP-MIB", "extrahopAlertObjectName"), ("EXTRAHOP-MIB", "extrahopAlertExpr"), ("EXTRAHOP-MIB", "extrahopAlertValue"), ("EXTRAHOP-MIB", "extrahopAlertTime"), ("EXTRAHOP-MIB", "extrahopAlertObjectId"), ("EXTRAHOP-MIB", "extrahopAlertObjectStrId"), ("EXTRAHOP-MIB", "extrahopAlertObjectMACAddr"), ("EXTRAHOP-MIB", "extrahopAlertObjectIPAddr"), ("EXTRAHOP-MIB", "extrahopAlertObjectTags"), ("EXTRAHOP-MIB", "extrahopAlertObjectURL"), ("EXTRAHOP-MIB", "extrahopAlertStatName"), ("EXTRAHOP-MIB", "extrahopAlertStatFieldName"), ("EXTRAHOP-MIB", "extrahopAlertSeverity")) if mibBuilder.loadTexts: extrahopAlertTrap.setStatus('current') extrahopAlertName = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertName.setStatus('current') extrahopAlertComment = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertComment.setStatus('current') extrahopAlertObjectType = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertObjectType.setStatus('current') extrahopAlertObjectName = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertObjectName.setStatus('current') extrahopAlertExpr = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertExpr.setStatus('current') extrahopAlertValue = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertValue.setStatus('current') extrahopAlertTime = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertTime.setStatus('current') extrahopAlertObjectId = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertObjectId.setStatus('current') extrahopAlertObjectStrId = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 9), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertObjectStrId.setStatus('current') extrahopAlertObjectMACAddr = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertObjectMACAddr.setStatus('current') extrahopAlertObjectIPAddr = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 11), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertObjectIPAddr.setStatus('current') extrahopAlertObjectTags = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 12), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertObjectTags.setStatus('current') extrahopAlertObjectURL = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 13), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertObjectURL.setStatus('current') extrahopAlertStatName = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 14), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertStatName.setStatus('current') extrahopAlertStatFieldName = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 15), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertStatFieldName.setStatus('current') extrahopAlertSeverity = MibScalar((1, 3, 6, 1, 4, 1, 32015, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("emergency", 0), ("alert", 1), ("critical", 2), ("error", 3), ("warning", 4), ("notice", 5), ("info", 6), ("debug", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopAlertSeverity.setStatus('current') extrahopStats = MibIdentifier((1, 3, 6, 1, 4, 1, 32015, 3)) extrahopStatsPktsSinceBoot = MibScalar((1, 3, 6, 1, 4, 1, 32015, 3, 1), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopStatsPktsSinceBoot.setStatus('current') extrahopStatsBytesSinceBoot = MibScalar((1, 3, 6, 1, 4, 1, 32015, 3, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopStatsBytesSinceBoot.setStatus('current') extrahopStorageAlert = MibIdentifier((1, 3, 6, 1, 4, 1, 32015, 5)) extrahopStorageAlertTrap = NotificationType((1, 3, 6, 1, 4, 1, 32015, 2, 2)).setObjects(("EXTRAHOP-MIB", "extrahopStorageAlertRole"), ("EXTRAHOP-MIB", "extrahopStorageAlertDevice"), ("EXTRAHOP-MIB", "extrahopStorageAlertStatus"), ("EXTRAHOP-MIB", "extrahopStorageAlertDetails"), ("EXTRAHOP-MIB", "extrahopStorageAlertSeverity"), ("EXTRAHOP-MIB", "extrahopStorageAlertMachine")) if mibBuilder.loadTexts: extrahopStorageAlertTrap.setStatus('current') extrahopStorageAlertRole = MibScalar((1, 3, 6, 1, 4, 1, 32015, 5, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopStorageAlertRole.setStatus('current') extrahopStorageAlertDevice = MibScalar((1, 3, 6, 1, 4, 1, 32015, 5, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopStorageAlertDevice.setStatus('current') extrahopStorageAlertStatus = MibScalar((1, 3, 6, 1, 4, 1, 32015, 5, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopStorageAlertStatus.setStatus('current') extrahopStorageAlertDetails = MibScalar((1, 3, 6, 1, 4, 1, 32015, 5, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopStorageAlertDetails.setStatus('current') extrahopStorageAlertSeverity = MibScalar((1, 3, 6, 1, 4, 1, 32015, 5, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("emergency", 0), ("alert", 1), ("critical", 2), ("error", 3), ("warning", 4), ("notice", 5), ("info", 6), ("debug", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopStorageAlertSeverity.setStatus('current') extrahopStorageAlertMachine = MibScalar((1, 3, 6, 1, 4, 1, 32015, 5, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: extrahopStorageAlertMachine.setStatus('current') mibBuilder.exportSymbols("EXTRAHOP-MIB", extrahop=extrahop, extrahopAlertComment=extrahopAlertComment, extrahopAlertExpr=extrahopAlertExpr, extrahopStorageAlertDevice=extrahopStorageAlertDevice, extrahopStatsBytesSinceBoot=extrahopStatsBytesSinceBoot, extrahopAlertObjectTags=extrahopAlertObjectTags, extrahopAlert=extrahopAlert, extrahopStorageAlertStatus=extrahopStorageAlertStatus, extrahopAlertStatFieldName=extrahopAlertStatFieldName, extrahopStorageAlertMachine=extrahopStorageAlertMachine, extrahopStorageAlertTrap=extrahopStorageAlertTrap, extrahopAlertStatName=extrahopAlertStatName, extrahopStats=extrahopStats, extrahopStorageAlertRole=extrahopStorageAlertRole, extrahopStorageAlertDetails=extrahopStorageAlertDetails, extrahopObjectGroup=extrahopObjectGroup, extrahopInfoVersionRevision=extrahopInfoVersionRevision, extrahopAlertSeverity=extrahopAlertSeverity, extrahopAlertObjectStrId=extrahopAlertObjectStrId, extrahopTraps=extrahopTraps, extrahopStatsPktsSinceBoot=extrahopStatsPktsSinceBoot, PYSNMP_MODULE_ID=extrahop, extrahopAlertTime=extrahopAlertTime, extrahopInfoVersionString=extrahopInfoVersionString, extrahopObjects=extrahopObjects, extrahopAlertObjectName=extrahopAlertObjectName, extrahopAlertObjectURL=extrahopAlertObjectURL, extrahopNotificationGroup=extrahopNotificationGroup, extrahopAlertObjectId=extrahopAlertObjectId, extrahopAlertObjectIPAddr=extrahopAlertObjectIPAddr, extrahopInfoVersionMinor=extrahopInfoVersionMinor, extrahopStorageAlert=extrahopStorageAlert, extrahopAlertValue=extrahopAlertValue, extrahopAlertTrap=extrahopAlertTrap, extrahopInfo=extrahopInfo, extrahopInfoVersionMajor=extrahopInfoVersionMajor, extrahopAlertObjectType=extrahopAlertObjectType, extrahopStorageAlertSeverity=extrahopStorageAlertSeverity, extrahopAlertName=extrahopAlertName, extrahopInfoVersionBranchRelease=extrahopInfoVersionBranchRelease, extrahopAlertObjectMACAddr=extrahopAlertObjectMACAddr)
# -*- encoding: utf-8 -*- """Common exceptions for the inventory manager. """ class ExistingMACAddress(Exception): code = 409 message = u'A server with the MAC address %(address)s already exists.' def __init__(self, address, message=None, **kwargs): """ :param address: The conflicting MAC address. :param message: The exception message. Optional """ if not message: # Construct the default message. message = self.message % address super(ExistingMACAddress, self).__init__(message) class ExistingServerName(Exception): code = 409 message = u'A server using the name %(name)s already exists.' def __init__(self, name, message=None, **kwargs): """ :param name: :param message: :param kwargs: """ if not message: message = self.message % name super(ExistingServerName, self).__init__(message) class ExistingServer(Exception): code = 409 message = u'This server already exists.' def __init__(self): super(ExistingServer, self).__init__() class ServerNotFound(Exception): code = 404 message = u'The server %(identifier)s was not found.' def __init__(self, message=None, **kwargs): """ :param message: An overridden exception message. :param uuid: The server's uuid :param name: The server's name """ if not message: if kwargs.get('name'): message = self.message % kwargs['name'] elif kwargs.get('uuid'): message = self.message % kwargs['uuid'] else: message = u'The server was not found.' super(ServerNotFound, self).__init__(message) class ServerReserved(Exception): message = ('The server %(uuid) has an existing reservation, please remove' ' the reservation and retry.') def __init__(self, message=None, **kwargs): """ :param message: :param server_uuid: """ if not message: uuid = kwargs.get('server_uuid') if not uuid: message = ('The server has an existing reservation, please' ' remove and retry the operation.') else: message = self.message % uuid super(ServerReserved, self).__init__(message) class ServerNotReserved(Exception): message = 'The server %(server_uuid)s does not have a reservation.' def __init__(self, message=None, **kwargs): if not message: uuid = kwargs.get('server_uuid') if not uuid: message = 'The server does not have an existing reservation.' else: message = self.message % uuid super(ServerNotReserved, self).__init__(message) class ServerNotDeployed(Exception): message = 'The server %(uuid)s is not in a deployed state.' def __init__(self, message=None, **kwargs): """ :param message: A custom message. :param uuid: The server's uuid """ if not message: uuid = kwargs.get('uuid') if not uuid: message = 'The server is not in a deployed state.' else: message = self.message % uuid super(ServerNotDeployed, self).__init__(message)
#necesitamos dividir nuestro data set #necesitamos el punto pivotal #recursivamente ordenar cada mitad de mi array def partition(arr, low, high):#creamos la particion del array i = (low-1) # i va a tomar el valor del indice mas bajo low-1 pivot = arr[high] #valor medio de los datos, que separa los datos altos y bajos | dividimos el data set for j in range(low,high): #recorrer todo el rango de indices de low a high if arr[j] <= pivot: #de un lado se ponen todos los valores menores al pivot i = i+1 arr[i], arr[j] = arr[j], arr[i] arr[i+1], arr[high] = arr[high], arr[i+1] #de otro lado se ponen los valores mayores al pivot return (i+1) def quickSort(arr, low, high):#creamos la funcion del quick sort if low < high: pi = partition(arr, low, high) #llamamos a la funcion partition quickSort(arr, low, pi-1) #recursivamente usamos quicksort del low a la mitad(pi-1) quickSort(arr, pi+1, high) #recursivamente usamos quicksort en la otra mitad del (pi+1) al high arr = [1991, 1990, 10, 5, 6, 0, 1, -10] n = len (arr) #len nos da el tamaño del arreglo n=8 quickSort(arr, 0, n-1) #ejecutamos quickSort (arr, 0, 7) print("Array Ordenado:") #imprimimos el arreglo for i in range (n): print("%d" %arr[i])
# ============================================================================== # ARSC (A Relatively Simple Computer) License # ============================================================================== # # ARSC is distributed under the following BSD-style license: # # Copyright (c) 2016-2017 Dzanan Bajgoric # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright notice, this # list of conditions and the following disclaimer in the documentation and/or other # materials provided with the distribution. # # 3. The name of the author may not be used to endorse or promote products derived from # this product without specific prior written permission from the author. # # 4. Products derived from this product may not be called "ARSC" nor may "ARSC" appear # in their names without specific prior written permission from the author. # # THIS PRODUCT IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS PRODUCT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # # PART OF THE ARSC ASSEMBLER # # Provides the traditional symbol table functionality class SymbolTable: def __init__(self): self.symbols = dict() def add_entry(self, symbol, addr): if symbol in self.symbols: raise KeyError('Symbol "%s" already exists' % symbol) try: self.symbols[symbol] = int(addr) except ValueError: raise ValueError('Address "%s" must be an integer' % addr) def contains(self, symbol): return (symbol in self.symbols) def get_address(self, symbol): if symbol not in self.symbols: raise KeyError('Symbol "%s" not in the symbol table' % symbol) return self.symbols[symbol] def __str__(self): pretty_str = '{\n' for key in sorted(self.symbols, key=self.symbols.get): pretty_str += '\t%s: %s\n' % (key, self.symbols[key]) pretty_str += '}' return pretty_str
def SymbolToFromAtomicNumber(ATOM): atoms = [ [1,"H"],[2,"He"],[3,"Li"],[4,"Be"],[5,"B"],[6,"C"],[7,"N"],[8,"O"],[9,"F"],[10,"Ne"], \ [11,"Na"],[12,"Mg"],[13,"Al"],[14,"Si"],[15,"P"],[16,"S"],[17,"Cl"],[18,"Ar"],[19,"K"],[20,"Ca"], \ [21,"Sc"],[22,"Ti"],[23,"V"],[24,"Cr"],[25,"Mn"],[26,"Fe"],[27,"Co"],[28,"Ni"],[29,"Cu"],[30,"Zn"], \ [31,"Ga"],[32,"Ge"],[33,"As"],[34,"Se"],[35,"Br"],[36,"Kr"],[37,"Rb"],[38,"Sr"],[39,"Y"],[40,"Zr"], \ [41,"Nb"],[42,"Mo"],[43,"Tc"],[44,"Ru"],[45,"Rh"],[46,"Pd"],[47,"Ag"],[48,"Cd"],[49,"In"],[50,"Sn"], \ [51,"Sb"],[52,"Te"],[53,"I"],[54,"Xe"],[55,"Cs"],[56,"Ba"],[57,"La"],[58,"Ce"],[59,"Pr"],[60,"Nd"], \ [61,"Pm"],[62,"Sm"],[63,"Eu"],[64,"Gd"],[65,"Tb"],[66,"Dy"],[67,"Ho"],[68,"Er"],[69,"Tm"],[70,"Yb"], \ [71,"Lu"],[72,"Hf"],[73,"Ta"],[74,"W"],[75,"Re"],[76,"Os"],[77,"Ir"],[78,"Pt"],[79,"Au"],[80,"Hg"], \ [81,"Tl"],[82,"Pb"],[83,"Bi"],[84,"Po"],[85,"At"],[86,"Rn"],[87,"Fr"],[88,"Ra"],[89,"Ac"],[90,"Th"], \ [91,"Pa"],[92,"U"],[93,"Np"],[94,"Pu"],[95,"Am"],[96,"Cm"],[97,"Bk"],[98,"Cf"],[99,"Es"],[100,"Fm"], \ [101,"Md"],[102,"No"],[103,"Lr"],[104,"Rf"],[105,"Db"],[106,"Sg"],[107,"Bh"] ] if isinstance(ATOM,int): for a in atoms: if a[0] == ATOM: return a[1] for a in atoms: if a[1] == ATOM: return int(a[0]) raise Exception("Why are you here?")
#!/usr/bin/python3 list = ["Binwalk","bulk-extractor","Capstone","chntpw","Cuckoo", "dc3dd","ddrescue","DFF","diStorm3","Dumpzilla","extundelete", "Foremost","Galleta","Guymager","iPhone Backup Analyzer","p0f", "pdf-parser","pdfid","pdgmail","peepdf","RegRipper","Volatility","Xplico"]
def solution(items): """ map(int, input.split()) Получить массив сумм двух чисел через 1 >>> solution([1, 2, 3, 4, 7, 2, 1, 1]) [5, 9] """ return list(map(sum, zip(items[1::3], items[2::3]))) """ slice, zip, map, list """
""" DNS Record Types """ # https://en.wikipedia.org/wiki/List_of_DNS_record_types DNS_RECORD_TYPES = { 1: "A", 28: "AAAA", 18: "AFSDB", 42: "APL", 257: "CAA", 60: "CDNSKEY", 59: "CDS", 37: "CERT", 5: "CNAME", 62: "CSYNC", 49: "DHCID", 32769: "DLV", 39: "DNAME", 48: "DNSKEY", 43: "DS", 55: "HIP", 45: "IPSECKEY", 25: "KEY", 36: "KX", 29: "LOC", 15: "MX", 35: "NAPTR", 2: "NS", 47: "NSEC", 50: "NSEC3", 51: "NSEC3PARAM", 61: "OPENPGPKEY", 12: "PTR", 46: "RRSIG", 17: "RP", 24: "SIG", 53: "SMIMEA", 6: "SOA", 33: "SRV", 44: "SSHFP", 32768: "TA", 249: "TKEY", 52: "TLSA", 250: "TSIG", 16: "TXT", 256: "URI", 255: "*", 252: "AXFR", 251: "IXFR", 41: "OPT", # Obsolete record types 3: "MD", 4: "MF", 254: "MAILA", 7: "MB", 8: "MG", 9: "MR", 14: "MINFO", 253: "MAILB", 11: "WKS", #32: "NB", # now assigned to NIMLOC #33: "NBTSTAT", # now assigned to SRV 10: "NULL", 38: "A6", 13: "HINFO", 19: "X25", 20: "ISDN", 21: "RT", 22: "NSAP", 23: "NSAP-PTR", 26: "PX", 31: "EID", 32: "NIMLOC", # duplicate id: NB 34: "ATMA", 40: "SINK", 27: "GPOS", 100: "UINFO", 101: "UID", 102: "GID", 103: "UNSPEC", 99: "SPF", 56: "NINFO", 57: "RKEY", 58: "TALINK", 104: "NID", 105: "L32", 106: "L64", 107: "LP", 108: "EUI48", 109: "EUI64", 259: "DOA", }
##################################################################################### # 整个基于双指针的算法的解题逻辑是,记录下历史上拥有最大重复字母且其余字母之和不大于k的区间 # 当然记录这个区间的方式只是记录了那个最大重复字母的数量,毕竟原题不需要我们提供两个端点 # 而且在找到答案要求的最大后,即便再往后移动,如果不能找到重复字母更大的区间,即maxnum不增加 # right - left + 1 - maxnum会一直大于k,left会一直伴随right同时加1,因此区间大小不变 # 最后根据题目要求,返回替换后的最长子串长度,也就是当前区间的长度 ##################################################################################### class Solution: def characterReplacement(self, s: str, k: int) -> int: # 左右双指针 + 记录历史上某个区间里出现次数最大的字母的数量 left = right = maxnum = 0 # 记录当前区间,26个字母各自的个数, 初始化为0 letters = [0]*26 # 字符串总长度 length = len(s) for per in s: # 当前字母id,ord函数返回对应的 ASCII 数值 id_ = ord(per) - ord("A") # 当前字母个数+1 letters[id_] += 1 # 更新历史最大 maxnum = max(maxnum, letters[id_]) # 如果当前区间长度 - 历史单个字母最大数量 > k,只能left往右移1个 if right - left + 1 - maxnum > k: # left对应字母数量 -1 letters[ord(s[left]) - ord("A")] -= 1 left += 1 right += 1 return right - left
# # PySNMP MIB module CISCOSB-STACK-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCOSB-STACK-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:23:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection") MacAddress, = mibBuilder.importSymbols("BRIDGE-MIB", "MacAddress") switch001, = mibBuilder.importSymbols("CISCOSB-MIB", "switch001") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Counter32, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Gauge32, Counter64, MibIdentifier, TimeTicks, ModuleIdentity, ObjectIdentity, Unsigned32, NotificationType, iso, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Gauge32", "Counter64", "MibIdentifier", "TimeTicks", "ModuleIdentity", "ObjectIdentity", "Unsigned32", "NotificationType", "iso", "Integer32") TruthValue, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "DisplayString", "TextualConvention") rlStack = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107)) rlStack.setRevisions(('2005-04-14 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: rlStack.setRevisionsDescriptions(('Initial revision.',)) if mibBuilder.loadTexts: rlStack.setLastUpdated('200504140000Z') if mibBuilder.loadTexts: rlStack.setOrganization('Cisco Small Business') if mibBuilder.loadTexts: rlStack.setContactInfo('Postal: 170 West Tasman Drive San Jose , CA 95134-1706 USA Website: Cisco Small Business Home http://www.cisco.com/smb>;, Cisco Small Business Support Community <http://www.cisco.com/go/smallbizsupport>') if mibBuilder.loadTexts: rlStack.setDescription('The private MIB module definition for stack.') class StackMode(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5)) namedValues = NamedValues(("standalone", 1), ("native", 2), ("basic-hybrid", 3), ("advanced-hybrid", 4), ("advanced-hybrid-XG", 5)) class PortsPair(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5)) namedValues = NamedValues(("pair-s1s2", 1), ("pair-s3s4", 2), ("pair-s1s25G", 3), ("pair-s1s2Xg", 4), ("pair-lionXg", 5)) class HybridStackPortSpeed(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5)) namedValues = NamedValues(("port-speed-1G", 1), ("port-speed-5G", 2), ("port-speed-10G", 3), ("port-speed-auto", 4), ("port-speed-down", 5)) class HybridStackDeviceMode(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("mode-L2", 1), ("mode-L3", 2)) rlStackActiveUnitIdTable = MibTable((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 1), ) if mibBuilder.loadTexts: rlStackActiveUnitIdTable.setStatus('current') if mibBuilder.loadTexts: rlStackActiveUnitIdTable.setDescription(' The table listing the active unit id of the requested unit.') rlStackActiveUnitIdEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 1, 1), ).setIndexNames((0, "CISCOSB-STACK-MIB", "rlStackCurrentUnitId")) if mibBuilder.loadTexts: rlStackActiveUnitIdEntry.setStatus('current') if mibBuilder.loadTexts: rlStackActiveUnitIdEntry.setDescription(' An entry in the rlStackActiveUnitIdTable.') rlStackCurrentUnitId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 1, 1, 1), Integer32()) if mibBuilder.loadTexts: rlStackCurrentUnitId.setStatus('current') if mibBuilder.loadTexts: rlStackCurrentUnitId.setDescription('The unit number device, which is the active unit id') rlStackActiveUnitIdAfterReset = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlStackActiveUnitIdAfterReset.setStatus('current') if mibBuilder.loadTexts: rlStackActiveUnitIdAfterReset.setDescription('Indicates the unit id that will be after reset.') rlStackUnitModeAfterReset = MibScalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("standalone", 1), ("stack", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlStackUnitModeAfterReset.setStatus('current') if mibBuilder.loadTexts: rlStackUnitModeAfterReset.setDescription('set unit type that will be after reset, standalone or stack.') rlStackUnitMode = MibScalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("standalone", 1), ("stack", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: rlStackUnitMode.setStatus('current') if mibBuilder.loadTexts: rlStackUnitMode.setDescription('show unit type standalone or stack.') rlStackUnitMacAddressAfterReset = MibScalar((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 4), MacAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlStackUnitMacAddressAfterReset.setReference('IEEE 802.1D-1990: Sections 6.4.1.1.3 and 3.12.5') if mibBuilder.loadTexts: rlStackUnitMacAddressAfterReset.setStatus('current') if mibBuilder.loadTexts: rlStackUnitMacAddressAfterReset.setDescription('The MAC address used by this bridge after rest.') rlStackHybridTable = MibTable((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5), ) if mibBuilder.loadTexts: rlStackHybridTable.setStatus('current') if mibBuilder.loadTexts: rlStackHybridTable.setDescription(' The table listing information required for hybrid stack.') rlStackHybridEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1), ).setIndexNames((0, "CISCOSB-STACK-MIB", "rlStackHybridUnitId")) if mibBuilder.loadTexts: rlStackHybridEntry.setStatus('current') if mibBuilder.loadTexts: rlStackHybridEntry.setDescription(' An entry in the rlStackActiveUnitIdTable.') rlStackHybridUnitId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))) if mibBuilder.loadTexts: rlStackHybridUnitId.setStatus('current') if mibBuilder.loadTexts: rlStackHybridUnitId.setDescription('The unit number device, which is the active unit id') rlStackHybridStackMode = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 2), StackMode()).setMaxAccess("readonly") if mibBuilder.loadTexts: rlStackHybridStackMode.setStatus('current') if mibBuilder.loadTexts: rlStackHybridStackMode.setDescription('Indicates the unit stack mode.') rlStackHybridPortsPair = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 3), PortsPair()).setMaxAccess("readonly") if mibBuilder.loadTexts: rlStackHybridPortsPair.setStatus('current') if mibBuilder.loadTexts: rlStackHybridPortsPair.setDescription('Indicates the PortsPair.') rlStackHybridPortNo1speed = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 4), HybridStackPortSpeed()).setMaxAccess("readonly") if mibBuilder.loadTexts: rlStackHybridPortNo1speed.setStatus('current') if mibBuilder.loadTexts: rlStackHybridPortNo1speed.setDescription('Indicates the rlStackHybridPortNo1speed.') rlStackHybridPortNo2speed = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 5), HybridStackPortSpeed()).setMaxAccess("readonly") if mibBuilder.loadTexts: rlStackHybridPortNo2speed.setStatus('current') if mibBuilder.loadTexts: rlStackHybridPortNo2speed.setDescription('Indicates the rlStackHybridPortNo2speed.') rlStackHybridUnitIdAfterReset = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 8))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlStackHybridUnitIdAfterReset.setStatus('current') if mibBuilder.loadTexts: rlStackHybridUnitIdAfterReset.setDescription('Indicates the unit id that will be after reset.') rlStackHybridStackModeAfterReset = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 7), StackMode()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlStackHybridStackModeAfterReset.setStatus('current') if mibBuilder.loadTexts: rlStackHybridStackModeAfterReset.setDescription('Indicates the unit stack mode that will be after reset.') rlStackHybridPortsPairAfterReset = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 8), PortsPair()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlStackHybridPortsPairAfterReset.setStatus('current') if mibBuilder.loadTexts: rlStackHybridPortsPairAfterReset.setDescription('Indicates the PortsPair that will be after reset.') rlStackHybridPortNo1speedAfterReset = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 9), HybridStackPortSpeed()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlStackHybridPortNo1speedAfterReset.setStatus('current') if mibBuilder.loadTexts: rlStackHybridPortNo1speedAfterReset.setDescription('Indicates the HybridStackPortSpeed that will be after reset.') rlStackHybridPortNo2speedAfterReset = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 10), HybridStackPortSpeed()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlStackHybridPortNo2speedAfterReset.setStatus('current') if mibBuilder.loadTexts: rlStackHybridPortNo2speedAfterReset.setDescription('Indicates the HybridStackPortSpeed that will be after reset.') rlStackHybridDeleteStartupAfterReset = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 11), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: rlStackHybridDeleteStartupAfterReset.setStatus('current') if mibBuilder.loadTexts: rlStackHybridDeleteStartupAfterReset.setDescription('Indicates whether the startup configuration is deleted after reset.') rlStackHybridDeviceModeAfterReset = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 12), HybridStackDeviceMode()).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlStackHybridDeviceModeAfterReset.setStatus('current') if mibBuilder.loadTexts: rlStackHybridDeviceModeAfterReset.setDescription('Indicates Device mode (Layer2 or Layer3) after reset.') rlStackHybridXgPortNo1Num = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: rlStackHybridXgPortNo1Num.setStatus('current') if mibBuilder.loadTexts: rlStackHybridXgPortNo1Num.setDescription('Indicates the 1st stack cascade active port number.') rlStackHybridXgPortNo1NumAfterReset = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlStackHybridXgPortNo1NumAfterReset.setStatus('current') if mibBuilder.loadTexts: rlStackHybridXgPortNo1NumAfterReset.setDescription('Indicates the 1st stack cascade port number that will be after reset.') rlStackHybridXgPortNo2Num = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readonly") if mibBuilder.loadTexts: rlStackHybridXgPortNo2Num.setStatus('current') if mibBuilder.loadTexts: rlStackHybridXgPortNo2Num.setDescription('Indicates the 2nd stack cascade active port number.') rlStackHybridXgPortNo2NumAfterReset = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 6, 1, 101, 107, 5, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rlStackHybridXgPortNo2NumAfterReset.setStatus('current') if mibBuilder.loadTexts: rlStackHybridXgPortNo2NumAfterReset.setDescription('Indicates the 2nd stack cascade port number that will be after reset.') mibBuilder.exportSymbols("CISCOSB-STACK-MIB", rlStackHybridPortNo1speed=rlStackHybridPortNo1speed, rlStackUnitMode=rlStackUnitMode, rlStackHybridStackModeAfterReset=rlStackHybridStackModeAfterReset, rlStackActiveUnitIdTable=rlStackActiveUnitIdTable, rlStackHybridPortNo1speedAfterReset=rlStackHybridPortNo1speedAfterReset, rlStackHybridDeviceModeAfterReset=rlStackHybridDeviceModeAfterReset, rlStack=rlStack, PortsPair=PortsPair, rlStackHybridPortNo2speed=rlStackHybridPortNo2speed, rlStackHybridXgPortNo1NumAfterReset=rlStackHybridXgPortNo1NumAfterReset, rlStackActiveUnitIdAfterReset=rlStackActiveUnitIdAfterReset, rlStackHybridTable=rlStackHybridTable, rlStackHybridUnitId=rlStackHybridUnitId, rlStackHybridPortsPairAfterReset=rlStackHybridPortsPairAfterReset, rlStackHybridEntry=rlStackHybridEntry, rlStackHybridXgPortNo2NumAfterReset=rlStackHybridXgPortNo2NumAfterReset, rlStackHybridStackMode=rlStackHybridStackMode, rlStackHybridPortNo2speedAfterReset=rlStackHybridPortNo2speedAfterReset, HybridStackDeviceMode=HybridStackDeviceMode, rlStackUnitModeAfterReset=rlStackUnitModeAfterReset, PYSNMP_MODULE_ID=rlStack, HybridStackPortSpeed=HybridStackPortSpeed, rlStackHybridDeleteStartupAfterReset=rlStackHybridDeleteStartupAfterReset, rlStackHybridXgPortNo2Num=rlStackHybridXgPortNo2Num, rlStackCurrentUnitId=rlStackCurrentUnitId, rlStackActiveUnitIdEntry=rlStackActiveUnitIdEntry, rlStackHybridPortsPair=rlStackHybridPortsPair, rlStackHybridXgPortNo1Num=rlStackHybridXgPortNo1Num, rlStackHybridUnitIdAfterReset=rlStackHybridUnitIdAfterReset, rlStackUnitMacAddressAfterReset=rlStackUnitMacAddressAfterReset, StackMode=StackMode)
def config_fgsm(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y' fgsm_params = {yname: adv_ys, 'eps': 0.3, 'clip_min': 0., 'clip_max': 1.} return fgsm_params def config_bim(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y' bim_params = {yname: adv_ys, 'eps': 0.3, 'eps_iter': 0.01, 'nb_iter': 100, 'clip_min': 0., 'clip_max': 1.} return bim_params def config_mim(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y' mim_params = {yname: adv_ys, 'eps': 0.1, 'eps_iter': 0.01, 'nb_iter': 100, 'decay_factor': 0.7, 'clip_min': 0., 'clip_max': 1.} return mim_params def config_jsma(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y' jsma_params = {yname: adv_ys, 'theta': 1., 'gamma': 0.1, 'clip_min': 0., 'clip_max': 1.} return jsma_params def config_vat(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y' vat_params = {yname: adv_ys, 'eps': 2.0, 'xi': 1e-6, 'num_iterations': 10, 'clip_min': 0., 'clip_max': 1.} return vat_params def config_cw(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y' cw_params = {yname: adv_ys, 'max_iterations': 10000, 'binary_search_steps': 9, 'abort_early': True, 'confidence': 0., 'learning_rate': 1e-2, 'initial_const': 1e-3, 'clip_min': 0., 'clip_max': 1.} return cw_params def config_elastic(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y' elastic_params = {yname: adv_ys, 'beta': 1e-3, 'confidence': 0., 'learning_rate': 1e-2, 'binary_search_steps': 9, 'max_iterations': 1000, 'abort_early': False, 'initial_const': 1e-3, 'clip_min': 0., 'clip_max': 1.} return elastic_params def config_deepfool(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y' deepfool_params = {yname: adv_ys, 'nb_candidate': 10, 'overshoot': 0.02, 'max_iter': 50, 'clip_min': 0., 'clip_max': 1.} return deepfool_params def config_madry(targeted, adv_ys): if targeted: yname = 'y_target' else: yname = 'y' madry_params = {yname: adv_ys, 'eps': 0.3, 'eps_iter': 0.01, 'nb_iter': 40, 'clip_min': 0., 'clip_max': 1., 'rand_init': False} return madry_params
n = int(input()) for i in range(1,n+1): if ((n % i) == 0): print(i,end=" ")
_base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py' ] # model setting model = dict( backbone=dict( init_cfg=None ), roi_head=dict( bbox_head=dict( num_classes=1 ) ) ) # data sets setting dataset_type = 'CocoDataset' classes = ('target',) data_root = '../data/rockets/' img_norm_cfg = dict( mean=[96, 96, 96], std=[18.5, 18.5, 18.5] ) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', img_scale=(1333, 800), keep_ratio=True), dict(type='RandomFlip', flip_ratio=0.5), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']), ] test_pipeline = [ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(1333, 800), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']), ]) ] data = dict( samples_per_gpu=1, workers_per_gpu=1, train=dict( type=dataset_type, ann_file=data_root + 'train_2022.json', img_prefix=data_root + 'train_2022/', pipeline=train_pipeline, classes=classes ), val=dict( type=dataset_type, ann_file=data_root + 'train_2022.json', img_prefix=data_root + 'train_2022/', pipeline=test_pipeline, classes=classes ), test=dict( type=dataset_type, ann_file=data_root + 'train_2022.json', img_prefix=data_root + 'train_2022/', pipeline=test_pipeline, classes=classes ) ) # schedule setting optimizer = dict(lr=0.01) lr_config = dict(step=[16, 22]) runner = dict(max_epochs=24) evaluation = dict(interval=1, metric='bbox') # default runtime setting checkpoint_config = dict(interval=5) log_config = dict(interval=100) load_from = None work_dir = '../workdirs/faster_rcnn_r50_fpn_2x_rockets'
# 24. Swap Nodes in Pairs # Runtime: 24 ms, faster than 96.60% of Python3 online submissions for Swap Nodes in Pairs. # Memory Usage: 14 MB, less than 92.32% of Python3 online submissions for Swap Nodes in Pairs. # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: # Recursive Approach def swapPairs(self, head: ListNode) -> ListNode: if head is None or head.next is None: return head else: head.val, head.next.val = head.next.val, head.val self.swapPairs(head.next.next) return head
''' Created on 11 Apr 2020 @author: dkr85djo ''' class md: MAXCARDS = 106 class MDColourSet: def __init__(self, value, names, hexcolour=b'#000000'): self.value = value self.names = names self.hexcolour = hexcolour def size(self): return len(self.names) class MDCard: # ABSTRACT def __init__(self, value, titleid, cardid=0, ctype=0): self.value = value # monetary value: may be index or literal (direct) self.title = titleid # descriptive text: index self.cardid = cardid # explicit index, direct, implicit, set by drawpile generator self.cardtype = ctype # card type: implicit, set by derived constructors class MDMoneyCard(MDCard): def __init__(self, value, titleid, inctype=4, colourset=None): MDCard.__init__(self, value, titleid, ctype=inctype) self.cardtype = inctype self.colourset = colourset class MDPropertyCard(MDCard): def __init__(self, value, titleid, colourset=None, inctype=0): MDCard.__init__(self, value, titleid, ctype=inctype) self.colourset = colourset # if non wild card, 1 element self.cardtype = inctype + min(len(colourset) - 1, 1) # targetall = True => whichtarget=all # targetall = False => whichtarget=$var (one of which is 'self') class MDActionCard(MDCard): def __init__(self, value, titleid, colourset=None, targetall=False, inctype=2): MDCard.__init__(self, value, titleid, ctype=inctype) self.targetall = targetall self.colourset = colourset self.cardtype = inctype + min(len(colourset) - 1, 1) class MDCardCollection: def __init__(self, ownerid, ispublic=False): self.ownerid = ownerid self.ispublic = ispublic self.cards = [] def generate(self, cardset): for i in range(len(cardset)): newcardobject = cardset[i] newcardobject.cardid = i # need to generate cardid here self.cards.append(newcardobject) # we are agnostic to the type of card def length(self): # FIXME: We should just use len() return (len(self.cards)) def remove(self, index): return self.cards.pop(index) def add(self, cardobject): self.cards.append(cardobject)
class Stack: Top = -1 def __init__(self,size): self.stack = [0 for i in range(size)] def push(self, value): if (Stack.Top!=len(self.stack)-1): Stack.Top += 1 self.stack[Stack.Top] = value else: print("Overflow: Stack is Full") def pop(self): if (Stack.Top == -1): print("Underflow: Stack is Empty") else: Stack.Top -= 1 def peek(self): if (Stack.Top == -1): print("Underflow: Stack is Empty") else: return (self.stack[Stack.Top]) def traverse(self): if (Stack.Top == -1): print("Underflow: Stack is Empty") else: for i in range(Stack.Top,-1,-1): print(self.stack[i], end = " ") def is_Full(self): if (Stack.Top == len(self.stack)-1): return True else: return False def is_Empty(self): if (Stack.Top == -1): return True else: return False # Driver Code data = Stack(5) data.traverse() data.push(5) data.push(36) data.push(43) data.traverse() data.push(33) data.traverse() print(data.peek()) data.pop() data.traverse() print(data.is_Empty()) print(data.is_Full())
BASIC_PLUGINS = [ { "name": "kubejobs", "source": "", "component": "manager", "plugin_source": "", "module": "kubejobs" }, { "name": "kubejobs", "source": "", "component": "controller", "plugin_source": "", "module": "kubejobs" }, { "name": "kubejobs", "source": "", "component": "monitor", "plugin_source": "", "module": "kubejobs" }, { "name": "k8s-grafana", "source": "", "component": "visualizer", "plugin_source": "", "module": "k8s-grafana" }, ] def check_basic_plugins(db): ''' This function checks if the basic plugins (kubejobs) are registered into the database. ''' installed_plugins = db.get_all() for basic in BASIC_PLUGINS: name = basic.get('name') source = basic.get('source') component = basic.get('component') plugin_source = basic.get('plugin_source') module = basic.get('module') is_installed = False for installed in installed_plugins: if installed.name == name and \ installed.component == component: is_installed = True if not is_installed: db.put(plugin_name=name, source=source, plugin_source=plugin_source, component=component, plugin_module=module)
a = (2, 5, 4) b = (5, 8, 1, 2) c = a + b print(c) print(len(c)) print(c.count(5))# Quantas vezes aparece o '5' dentro de 'c' print(c.index(8)) #Em que posição está o valor '8' pessoa = ('Gustavo', 39, 'M', 99.88) print(pessoa) del (pessoa) #Apaga a tupla 'pessoa' print(pessoa)
""" TIMEFLIESBAR PROGRESS_BAR FUNCTION """ # Contact. # ovgpcomms@outlook.com # ---------------------------------------------------------------------------# # Pass-trough variables. tm: int """ total_minutes from tfb_calculus. """ gm: int """ gone_minutes from tfb_calculus. """ # Regular variables. percent_decimals: int """ Decimals to show on percentages. """ bar_length: int """ Bar length. """ bar_fill: str """ Character for filled bar. """ not_fill: str """ Character for not filled bar. """ percent_right: int """ Percentage of year gone. """ percent_left: int """ Percentage of year left. """ filled_length: int """ Length for filled bar. """ not_filled_length: int """ Length for not filled bar. """ bar: str """ Progress bar representation. """ progressbar: str """ Progress bar printing. """ # ---------------------------------------------------------------------------# # Obtain gone progressbar. def progress_bar(tm, gm, percent_decimals = 2, bar_length=12, bar_fill = "░", not_fill = "▓"): percent_right = ("{0:." + str(percent_decimals) + "f}").format(100 - (100 * (gm / int(tm)))) percent_left = ("{0:." + str(percent_decimals) + "f}").format(100 * (gm / int(tm))) filled_length = int(bar_length * gm // tm) not_filled_length = int(bar_length - filled_length) bar = bar_fill * filled_length + not_fill * not_filled_length progressbar = f"{percent_left}% Gone {bar} Left {percent_right}%" return progressbar
#!usr/bin/python # -*- coding:utf8 -*- """ 翻转字符数组 https://leetcode.com/problems/reverse-string/ s是一个字符串列表 1. s.reverse """ class Solution: def reverseString(self, s): """ Do not return anything, modify s in-place instead. """ beg = 0 end = len(s) - 1 while beg < end: s[beg], s[end] = s[end], s[beg] beg += 1 end -= 1
refTable = [{'desc': 'Freedom of Movement', 'templates': ['free'], 'weight': 1.0}, {'desc': 'Visa not Required', 'templates': ['yes', 'yes '], 'weight': 0.9}, {'desc': 'Visa on Arrival', 'templates': ['Optional', 'yes-no'], 'weight': 0.7}, {'desc': 'Electronic Visa', 'templates': ['yes2'], 'weight': 0.5}, {'desc': 'Visa is required', 'templates': ['no', 'no ', 'n/a'], 'weight': 0.4}, {'desc': 'Travel not Allowed', 'templates': ['black', 'BLACK'], 'weight': 0.0}]
class Solution: def romanToInt(self, s: str) -> int: romanNumberAsc = ['I', 'V', 'X', 'L', 'C', 'D', 'M']; numberMapForRoman = [1, 5, 10, 50, 100, 500, 1000]; lenOfRomanNumber = len(s); integer = 0; # 从前往后遍历,如果当前字符大于或等于后面的字符,则累加,否则则减去当前字符 for i in range(lenOfRomanNumber): romanNumeral = s[i]; isLastNumber = i == lenOfRomanNumber - 1; indexOfRoman = romanNumberAsc.index(romanNumeral); valueOfRoman = numberMapForRoman[indexOfRoman]; if isLastNumber: integer += valueOfRoman; break; nextRoman = s[i + 1]; indexOfNextRoman = romanNumberAsc.index(nextRoman); nextIsBigger = indexOfNextRoman > indexOfRoman; if nextIsBigger: integer -= valueOfRoman; else: integer += valueOfRoman; return integer; def main(): testCases = [ 'I', 'III', 'IV', 'V', 'VI', 'IX', 'XXVII', 'MMDCLXVI' ]; expects = [ 1, 3, 4, 5, 6, 9, 27, 2666 ]; so = Solution(); for case in testCases: isPass = so.romanToInt(case) == expects[testCases.index(case)]; print(isPass); if __name__ == "__main__": main(); """ 没啥好说的,规律很容易找到,如前文的唯一一条注释所说, 算法复杂度是O(N*个位数)级别的。 唯一需要注意的就是如何存储罗马数字和阿拉伯数字的对应关系: - 我使用的是两个对应的数组,因为数组中元素有限,所以查找不是很费时,但有更好的方式 - 使用哈希表(字典),存储罗马数字和阿拉伯数字的对应关系,取值的算法复杂度是O(1),肯定要更快些,并且存为一个字典,肯定比存两个数组要可维护的多。 """
# builtins stub used in boolean-related test cases. class object: def __init__(self) -> None: pass class type: pass class bool: pass class int: pass
"""Information regarding crosstool-supported architectures.""" # Copyright 2017 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # List of architectures supported by osx crosstool. OSX_TOOLS_NON_DEVICE_ARCHS = [ "darwin_x86_64", "darwin_arm64", "darwin_arm64e", "ios_i386", "ios_x86_64", "watchos_i386", "watchos_x86_64", "tvos_x86_64", ] OSX_TOOLS_ARCHS = [ "ios_armv7", "ios_arm64", "ios_arm64e", "watchos_armv7k", "watchos_arm64_32", "tvos_arm64", ] + OSX_TOOLS_NON_DEVICE_ARCHS