content
stringlengths
7
1.05M
### Left and Right product lists ### class Solution1: def productExceptSelf(self, nums: List[int]) -> List[int]: l = 1 r = 1 length = len(nums) ans = [1]*length for i in range( 0, length ): ans[i] *=l ans[length -i-1] *= r l *= nums[i] r *= nums[length-i-1] return ans
print("welcome to calculator \n") a=int(input("enter first value")) b=int(input("enter seconde value")) print("which operation you want two perform \n add sub mul div") c=input() if c=="add": d=a+b print(d) if c=="sub": d=a-b print(d) if c=="mul": d=a*b print(d) if c=="div": d=a/b print(d)
#!/usr/bin/env python3 print('hello world') print('hello', 'world') ## use "sep" parameter to change output print('hello', 'world', sep = '_')
people=30 cars=40 trucks=15 if cars>people: print("We should take the cars") elif cars<people: print("We should not take the cars") else: print("We can't decide") if trucks>cars: print("That's too many trucks") elif trucks<cars: print("Maybe we could take the trucks") else: print("We still can't decide") if people >trucks: print("Alright,let's just take the trucks") else: print("Fine,let's stay home then")
''' Description Given a continuous stream of data, write a function that returns the first unique number (including the last number) when the terminating number arrives. If the terminating number is not found, return -1. Example Example1 Input: [1, 2, 2, 1, 3, 4, 4, 5, 6] 5 Output: 3 Example2 Input: [1, 2, 2, 1, 3, 4, 4, 5, 6] 7 Output: -1 Example3 Input: [1, 2, 2, 1, 3, 4] 3 Output: 3 ''' class Solution: """ @param nums: a continuous stream of numbers @param number: a number @return: returns the first unique number """ def firstUniqueNumber(self, nums, number): # Write your code here onedict = {} flag = False for i, x in enumerate(nums): if x not in onedict: onedict[x] = [1, i] else: onedict[x][0] += 1 if number == x: flag = True break if flag == True: oncelist = [] for key in onedict: if onedict[key][0] == 1: oncelist.append([key, onedict[key][1]]) x = 2e30 returnkey = None for one in oncelist: if one[1] < x: x = one[1] returnkey = one[0] return returnkey else: return -1
def armsinside(): i01.rightArm.rotate.attach() i01.rightArm.rotate.moveTo(0) sleep(7) i01.rightArm.rotate.detach()
Byte = { 'LF': '\x0A', 'NULL': '\x00' } class Frame: def __init__(self, command, headers, body): self.command = command self.headers = headers self.body = '' if body is None else body def __str__(self): lines = [self.command] skipContentLength = 'content-length' in self.headers if skipContentLength: del self.headers['content-length'] for name in self.headers: value = self.headers[name] lines.append("" + name + ":" + value) if self.body is not None and not skipContentLength: lines.append("content-length:" + str(len(self.body))) lines.append(Byte['LF'] + self.body) return Byte['LF'].join(lines) @staticmethod def unmarshall_single(data): lines = data.split(Byte['LF']) command = lines[0].strip() headers = {} # get all headers i = 1 while lines[i] != '': # get key, value from raw header (key, value) = lines[i].split(':') headers[key] = value i += 1 # set body to None if there is no body body = None if lines[i + 1] == Byte['NULL'] else lines[i + 1][:-1] return Frame(command, headers, body) @staticmethod def marshall(command, headers, body): return str(Frame(command, headers, body)) + Byte['NULL']
"""文字列基礎 文字関連の判定メソッド ASCII文字であるかを判定する isascii [説明ページ] https://tech.nkhn37.net/python-isxxxxx/#ASCII_isascii """ print('=== isascii ===') print('abcdefgh'.isascii()) print('あいうえお'.isascii())
fin = open('input_24.txt') def getdir(text): while text: direction = text[:2] if direction in ['nw','ne','sw','se']: text = text[2:] yield direction else: text = text[1:] yield direction[0] ftiles = set() # (row,column) # row, column moves = {'nw':(-1,-1),'w':(0,-2),'sw':(1,-1),'se':(1,1),'e':(0,2),'ne':(-1,1)} for line in fin: line = line.strip() r = c = 0 for dir_ in getdir(line): r += moves[dir_][0] c += moves[dir_][1] if (r,c) in ftiles: ftiles.remove((r,c)) else: ftiles.add((r,c)) fin.close() print("Black tiles:",len(ftiles)) dirs = ((-1,-1),(0,-2),(1,-1),(1,1),(0,2),(-1,1)) def neighbors_of(tile): global ftiles global dirs ncount = 0 for dir_ in dirs: r,c = (tile[0]+dir_[0],tile[1]+dir_[1]) if (r,c) in ftiles: ncount += 1 return ncount def tick(): global ftiles global dirs newtiles = set() for tile in ftiles: # check on survival if neighbors_of(tile) in [1,2]: newtiles.add(tile) # check all *its* neighbors for new flips for dir_ in dirs: r,c = (tile[0]+dir_[0],tile[1]+dir_[1]) if neighbors_of((r,c)) == 2: newtiles.add((r,c)) ftiles = newtiles tickcount = 100 print("Start with:",len(ftiles)) while tickcount: tickcount -= 1 tick() print(len(ftiles))
""" Module to convert unit of area from one system of units to another """ # Units of length TYPES = { 'km2': { 'name_en': 'Square Kilometers', 'name_es': 'Kilómetros cuadrados', 'abbreviation': 'km²', 'value': 'km2', 'to_m2': 1000000 }, 'm2': { 'name_en': 'Square Meters', 'name_es': 'Metros cuadrados', 'abbreviation': 'm²', 'value': 'm2', 'to_m2': 1 }, 'mi2': { 'name_en': 'Square Miles', 'name_es': 'Millas cuadradas', 'abbreviation': 'mi²', 'value': 'mi2', 'to_m2': 2590000 }, 'yd2': { 'name_en': 'Square Yards', 'name_es': 'Yardas cuadradas', 'abbreviation': 'yd²', 'value': 'yd2', 'to_m2': 0.83613119866071 }, 'ft2': { 'name_en': 'Square Feet', 'name_es': 'Pies cuadrados', 'abbreviation': 'ft²', 'value': 'ft2', 'to_m2': 0.09290346651785666432 }, 'in2': { 'name_en': 'Square Inches', 'name_es': 'Pulgadas cuadradas', 'abbreviation': 'in²', 'value': 'in2', 'to_m2': 0.00064516296192956010865 }, 'ha': { 'name_en': 'Hectares', 'name_es': 'Hectáreas', 'abbreviation': 'ha', 'value': 'ha', 'to_m2': 10000 }, 'ac': { 'name_en': 'Acres', 'name_es': 'Acres', 'abbreviation': 'ac', 'value': 'ac', 'to_m2': 4046.8750015178361537 }, } def __get_unit_of_length_by_key(key: str) -> dict: return TYPES.get(key) def convert(from_unit_type: str = None, to_unit_type: str = None, value: float = 0) -> float: from_unit = __get_unit_of_length_by_key(from_unit_type) to_unit = __get_unit_of_length_by_key(to_unit_type) # Always transform to square meters to_m2 = value * from_unit['to_m2'] # Convert to_unit_type result = to_m2 / to_unit['to_m2'] # text = f'{value} {from_unit["abbreviation"]} are {result:.10f} {to_unit["abbreviation"]}' # print(text) return result def get_units_of_length(lang: str = 'en') -> list: """ Lists available units of length Args: lang (str, optional): iso code of language for list units of area . Defaults to 'en'. options: "es" | "en" Returns: list: A list with dictionaries units of area """ units_of_length = [] for unit in TYPES: unit_type = __get_unit_of_length_by_key(unit) del unit_type['to_m2'] if lang == 'es': del unit_type['name_en'] name = unit_type['name_es'] del unit_type['name_es'] unit_type['name'] = name else: del unit_type['name_es'] name = unit_type['name_en'] del unit_type['name_en'] unit_type['name'] = name units_of_length.append(unit_type) return units_of_length
# automatically generated by the FlatBuffers compiler, do not modify # namespace: quantra class FlowType(object): Interest = 0 PastInterest = 1 Notional = 2
#!/usr/bin/env python3 list1 = ['cisco-nxos', 'arista_eos', 'cisco-ios'] print(list1) print(list1[1]) list1.extend(['juniper']) print(list1) list1.append(['10.1.0.1','10.2.0.1','10.3.0.1']) print(list1) print("4th element in list1 is ".format(list1[4])) print(list1[4][0])
#Listas # (Tuplas) --> São imutavéis # [Listas] --> Podem ser mutavéis # {Dicionário} num = [2, 5, 9, 1] print(num) num[2] = 3 print(num) num.append(7) print(num) num.sort() print(num) num.sort(reverse=True) print(num) print(len(num)) num.insert(2,0) print(num) #Elimina o último item da lista num.pop() print(num) num.pop(2) print(num) num.remove(2) print(num) if 4 in num: num.remove(4) else: print('Não achei o número 4') print(num) print('-' * 50) print(f'{"Valores":^50}') print('-' * 50) valores = list() valores.append(5) valores.append(9) valores.append(4) for v in valores: print(v) for c, v in enumerate(valores): print(f'Na posição {c} encontrei o valor {v}') print('Cheguei ao fim da lista') lista = list() for cont in range(0,5): lista.append(int(input('Digite um valor: '))) for c, cont in enumerate(lista): print(f'Na posição {c} encontrei o valor {cont}') print('-' * 30) a = [2,3,4,7] b = a[:] #Copia todos os elementos de A na B b[2] = 8 print(f'Lista A: {a}') print(f'Lista B: {b}')
if __name__ == '__main__': print("TESTOUTPUT")
class Solution(object): def binaryTreePaths(self, root): if not root: return [] arrow = '->' ans = [] stack = [] stack.append((root, '')) while stack: node, path = stack.pop() path += arrow+str(node.val) if path else str(node.val) #add arrow except beginnings if not node.left and not node.right: ans.append(path) #if isLeaf, append path. if node.left: stack.append((node.left, path)) if node.right: stack.append((node.right, path)) return ans """ Time: O(N) Space: O(N) Standard BFS. """ class Solution(object): def binaryTreePaths(self, root): q = collections.deque([(root, '')]) ans = [] while q: node, path = q.popleft() path = (path+'->'+str(node.val)) if path else str(node.val) if node.left: q.append((node.left, path)) if node.right: q.append((node.right, path)) if not node.left and not node.right: ans.append(path) return ans
def insert_user_list(): keys = ['_id', 'name', 'is_zero_user', 'gender', 'location', 'business', 'education', 'motto', 'answer_num', 'collection_num', 'followed_column_num', 'followed_topic_num', 'followee_num', 'follower_num', 'post_num', 'question_num', 'thank_num', 'upvote_num', 'photo_url', 'weibo_url'] out_db = MongoClient().zhihu_network.users for line in open('./user_info.data'): line = line.strip().split('\t') assert (len(keys) == len(line)) user = dict(zip(keys, line)) for key in user: if key.endswith('_num'): user[key] = int(user[key]) out_db.insert(user)
# automatically generated by the FlatBuffers compiler, do not modify # namespace: DeepSeaSceneLighting class LightUnion(object): NONE = 0 DirectionalLight = 1 PointLight = 2 SpotLight = 3
def ciagCyfr(x): lista = [] for i in range(x): if i%2 == 0: i = i+1 lista.append(i) else: i = (i+1)*(-1) lista.append(i) print(lista)
""" Largest Element in Array: Given an array find the largest element in the array """ """Solution: """ def largest_element(a) -> int: le = 0 for i in a: if i > le: le = i return le def main(): arr_input = [40, 100, 8, 50] a = largest_element(arr_input) print(a) # Using the special variable # __name__ if __name__ == "__main__": main()
def bubbleSort(l, n): for i in range(n): for j in range(n-1-i): if l[j][0] > l[j+1][0]: l[j], l[j+1] = l[j+1], l[j] return l[:] def selectionSort(l, n): for i in range(n): minj = i for j in range(i+1, n): if l[j][0] < l[minj][0]: minj = j l[i], l[minj] = l[minj], l[i] return l[:] n = int(input()) l = [] for c in input().split(): l.append((int(c[1]), c[0])) bl = ' '.join([k + str(n) for n, k in bubbleSort(l[:], n)]) sl = ' '.join([k + str(n) for n, k in selectionSort(l[:], n)]) print(bl) print('Stable') print(sl) print('Stable' if sl == bl else 'Not stable')
""" if statements Logické operátory: == != < > <= >= """ numA = int(input("Zadej celé číslo A: ")) numB = int(input("Zadej celé číslo B: ")) # if statement if numA > numB: print(f"{numA} > {numB}.") # if else statement if numA > numB: print(f"{numA} > {numB}.") else: print(f"{numA} <= {numB}.") # if elif else statement if numA > numB: print(f"{numA} je větší než {numB}.") elif numA < numB: print(f"{numA} je menší než {numB}.") else: print(f"{numA} je rovno {numB}.") # if else statement jako ternární operátor print(f"{numA} > {numB}.") if numA > numB else print(f"{numA} <= {numB}.") print(f"{numA} > {numB}") if numA > numB else print(f"{numA} = {numB}.") if numA == numB else print(f"{numA} < {numB}") # příklady užití "and or not in" v if statementu presents = ["Smartphone", "Barbie", "Nintendo", "Tracksuit", "Slippers"] # list if "Smartphone" or "iPad" in presents: print("I'm sooo happy!") if not "Tracksuit" and "Socks" in presents: print("I'm sooo happy too!") else: print('I hate Christmas!') # implementace case statementu v Pythonu def getMonth(monthNum): months = { 1: "leden", 2: "únor", 3: "březen", 4: "duben", 5: "květen", 6: "červen", 7: "červenec", 8: "srpen", 9: "září", 10: "říjen", 11: "listoped", 12: "prosinec" } return months.get(monthNum, "chybné číslo měsíce") month = int(input("Zadej číslo měsíce od 1 do 12: ")) print(f"Měsíc číslo {month}: ", getMonth(month))
# Version of the migration tool VERSION = "0.6" LOG_DIR="/var/log" LOG_FILE_PATH="%s/filerobot-migrate.log" % LOG_DIR UPLOADED_UUIDS_PATH="%s/filerobot-migrate-uploaded-uuids.log" % LOG_DIR LOG_FAILED_PATH="%s/filerobot-migrate-failed" % LOG_DIR LOG_RETRY_FAILED_PATH="%s/filerobot-migrate-retry-failed.log" % LOG_DIR DEFAULT_INPUT_FILE="input.tsv"
md_icons = { 'md-3d-rotation': u"\uf000", 'md-accessibility': u"\uf001", 'md-account-balance': u"\uf002", 'md-account-balance-wallet': u"\uf003", 'md-account-box': u"\uf004", 'md-account-child': u"\uf005", 'md-account-circle': u"\uf006", 'md-add-shopping-cart': u"\uf007", 'md-alarm': u"\uf008", 'md-alarm-add': u"\uf009", 'md-alarm-off': u"\uf00a", 'md-alarm-on': u"\uf00b", 'md-android': u"\uf00c", 'md-announcement': u"\uf00d", 'md-aspect-ratio': u"\uf00e", 'md-assessment': u"\uf00f", 'md-assignment': u"\uf010", 'md-assignment-ind': u"\uf011", 'md-assignment-late': u"\uf012", 'md-assignment-return': u"\uf013", 'md-assignment-returned': u"\uf014", 'md-assignment-turned-in': u"\uf015", 'md-autorenew': u"\uf016", 'md-backup': u"\uf017", 'md-book': u"\uf018", 'md-bookmark': u"\uf019", 'md-bookmark-outline': u"\uf01a", 'md-bug-report': u"\uf01b", 'md-cached': u"\uf01c", 'md-class': u"\uf01d", 'md-credit-card': u"\uf01e", 'md-dashboard': u"\uf01f", 'md-delete': u"\uf020", 'md-description': u"\uf021", 'md-dns': u"\uf022", 'md-done': u"\uf023", 'md-done-all': u"\uf024", 'md-event': u"\uf025", 'md-exit-to-app': u"\uf026", 'md-explore': u"\uf027", 'md-extension': u"\uf028", 'md-face-unlock': u"\uf029", 'md-favorite': u"\uf02a", 'md-favorite-outline': u"\uf02b", 'md-find-in-page': u"\uf02c", 'md-find-replace': u"\uf02d", 'md-flip-to-back': u"\uf02e", 'md-flip-to-front': u"\uf02f", 'md-get-app': u"\uf030", 'md-grade': u"\uf031", 'md-group-work': u"\uf032", 'md-help': u"\uf033", 'md-highlight-remove': u"\uf034", 'md-history': u"\uf035", 'md-home': u"\uf036", 'md-https': u"\uf037", 'md-info': u"\uf038", 'md-info-outline': u"\uf039", 'md-input': u"\uf03a", 'md-invert-colors': u"\uf03b", 'md-label': u"\uf03c", 'md-label-outline': u"\uf03d", 'md-language': u"\uf03e", 'md-launch': u"\uf03f", 'md-list': u"\uf040", 'md-lock': u"\uf041", 'md-lock-open': u"\uf042", 'md-lock-outline': u"\uf043", 'md-loyalty': u"\uf044", 'md-markunread-mailbox': u"\uf045", 'md-note-add': u"\uf046", 'md-open-in-browser': u"\uf047", 'md-open-in-new': u"\uf048", 'md-open-with': u"\uf049", 'md-pageview': u"\uf04a", 'md-payment': u"\uf04b", 'md-perm-camera-mic': u"\uf04c", 'md-perm-contact-cal': u"\uf04d", 'md-perm-data-setting': u"\uf04e", 'md-perm-device-info': u"\uf04f", 'md-perm-identity': u"\uf050", 'md-perm-media': u"\uf051", 'md-perm-phone-msg': u"\uf052", 'md-perm-scan-wifi': u"\uf053", 'md-picture-in-picture': u"\uf054", 'md-polymer': u"\uf055", 'md-print': u"\uf056", 'md-query-builder': u"\uf057", 'md-question-answer': u"\uf058", 'md-receipt': u"\uf059", 'md-redeem': u"\uf05a", 'md-report-problem': u"\uf05b", 'md-restore': u"\uf05c", 'md-room': u"\uf05d", 'md-schedule': u"\uf05e", 'md-search': u"\uf05f", 'md-settings': u"\uf060", 'md-settings-applications': u"\uf061", 'md-settings-backup-restore': u"\uf062", 'md-settings-bluetooth': u"\uf063", 'md-settings-cell': u"\uf064", 'md-settings-display': u"\uf065", 'md-settings-ethernet': u"\uf066", 'md-settings-input-antenna': u"\uf067", 'md-settings-input-component': u"\uf068", 'md-settings-input-composite': u"\uf069", 'md-settings-input-hdmi': u"\uf06a", 'md-settings-input-svideo': u"\uf06b", 'md-settings-overscan': u"\uf06c", 'md-settings-phone': u"\uf06d", 'md-settings-power': u"\uf06e", 'md-settings-remote': u"\uf06f", 'md-settings-voice': u"\uf070", 'md-shop': u"\uf071", 'md-shopping-basket': u"\uf072", 'md-shopping-cart': u"\uf073", 'md-shop-two': u"\uf074", 'md-speaker-notes': u"\uf075", 'md-spellcheck': u"\uf076", 'md-star-rate': u"\uf077", 'md-stars': u"\uf078", 'md-store': u"\uf079", 'md-subject': u"\uf07a", 'md-swap-horiz': u"\uf07b", 'md-swap-vert': u"\uf07c", 'md-swap-vert-circle': u"\uf07d", 'md-system-update-tv': u"\uf07e", 'md-tab': u"\uf07f", 'md-tab-unselected': u"\uf080", 'md-theaters': u"\uf081", 'md-thumb-down': u"\uf082", 'md-thumbs-up-down': u"\uf083", 'md-thumb-up': u"\uf084", 'md-toc': u"\uf085", 'md-today': u"\uf086", 'md-track-changes': u"\uf087", 'md-translate': u"\uf088", 'md-trending-down': u"\uf089", 'md-trending-neutral': u"\uf08a", 'md-trending-up': u"\uf08b", 'md-turned-in': u"\uf08c", 'md-turned-in-not': u"\uf08d", 'md-verified-user': u"\uf08e", 'md-view-agenda': u"\uf08f", 'md-view-array': u"\uf090", 'md-view-carousel': u"\uf091", 'md-view-column': u"\uf092", 'md-view-day': u"\uf093", 'md-view-headline': u"\uf094", 'md-view-list': u"\uf095", 'md-view-module': u"\uf096", 'md-view-quilt': u"\uf097", 'md-view-stream': u"\uf098", 'md-view-week': u"\uf099", 'md-visibility': u"\uf09a", 'md-visibility-off': u"\uf09b", 'md-wallet-giftcard': u"\uf09c", 'md-wallet-membership': u"\uf09d", 'md-wallet-travel': u"\uf09e", 'md-work': u"\uf09f", 'md-error': u"\uf0a0", 'md-warning': u"\uf0a1", 'md-album': u"\uf0a2", 'md-av-timer': u"\uf0a3", 'md-closed-caption': u"\uf0a4", 'md-equalizer': u"\uf0a5", 'md-explicit': u"\uf0a6", 'md-fast-forward': u"\uf0a7", 'md-fast-rewind': u"\uf0a8", 'md-games': u"\uf0a9", 'md-hearing': u"\uf0aa", 'md-high-quality': u"\uf0ab", 'md-loop': u"\uf0ac", 'md-mic': u"\uf0ad", 'md-mic-none': u"\uf0ae", 'md-mic-off': u"\uf0af", 'md-movie': u"\uf0b0", 'md-my-library-add': u"\uf0b1", 'md-my-library-books': u"\uf0b2", 'md-my-library-music': u"\uf0b3", 'md-new-releases': u"\uf0b4", 'md-not-interested': u"\uf0b5", 'md-pause': u"\uf0b6", 'md-pause-circle-fill': u"\uf0b7", 'md-pause-circle-outline': u"\uf0b8", 'md-play-arrow': u"\uf0b9", 'md-play-circle-fill': u"\uf0ba", 'md-play-circle-outline': u"\uf0bb", 'md-playlist-add': u"\uf0bc", 'md-play-shopping-bag': u"\uf0bd", 'md-queue': u"\uf0be", 'md-queue-music': u"\uf0bf", 'md-radio': u"\uf0c0", 'md-recent-actors': u"\uf0c1", 'md-repeat': u"\uf0c2", 'md-repeat-one': u"\uf0c3", 'md-replay': u"\uf0c4", 'md-shuffle': u"\uf0c5", 'md-skip-next': u"\uf0c6", 'md-skip-previous': u"\uf0c7", 'md-snooze': u"\uf0c8", 'md-stop': u"\uf0c9", 'md-subtitles': u"\uf0ca", 'md-surround-sound': u"\uf0cb", 'md-videocam': u"\uf0cc", 'md-videocam-off': u"\uf0cd", 'md-video-collection': u"\uf0ce", 'md-volume-down': u"\uf0cf", 'md-volume-mute': u"\uf0d0", 'md-volume-off': u"\uf0d1", 'md-volume-up': u"\uf0d2", 'md-web': u"\uf0d3", 'md-business': u"\uf0d4", 'md-call': u"\uf0d5", 'md-call-end': u"\uf0d6", 'md-call-made': u"\uf0d7", 'md-call-merge': u"\uf0d8", 'md-call-missed': u"\uf0d9", 'md-call-received': u"\uf0da", 'md-call-split': u"\uf0db", 'md-chat': u"\uf0dc", 'md-clear-all': u"\uf0dd", 'md-comment': u"\uf0de", 'md-contacts': u"\uf0df", 'md-dialer-sip': u"\uf0e0", 'md-dialpad': u"\uf0e1", 'md-dnd-on': u"\uf0e2", 'md-email': u"\uf0e3", 'md-forum': u"\uf0e4", 'md-import-export': u"\uf0e5", 'md-invert-colors-off': u"\uf0e6", 'md-invert-colors-on': u"\uf0e7", 'md-live-help': u"\uf0e8", 'md-location-off': u"\uf0e9", 'md-location-on': u"\uf0ea", 'md-message': u"\uf0eb", 'md-messenger': u"\uf0ec", 'md-no-sim': u"\uf0ed", 'md-phone': u"\uf0ee", 'md-portable-wifi-off': u"\uf0ef", 'md-quick-contacts-dialer': u"\uf0f0", 'md-quick-contacts-mail': u"\uf0f1", 'md-ring-volume': u"\uf0f2", 'md-stay-current-landscape': u"\uf0f3", 'md-stay-current-portrait': u"\uf0f4", 'md-stay-primary-landscape': u"\uf0f5", 'md-stay-primary-portrait': u"\uf0f6", 'md-swap-calls': u"\uf0f7", 'md-textsms': u"\uf0f8", 'md-voicemail': u"\uf0f9", 'md-vpn-key': u"\uf0fa", 'md-add': u"\uf0fb", 'md-add-box': u"\uf0fc", 'md-add-circle': u"\uf0fd", 'md-add-circle-outline': u"\uf0fe", 'md-archive': u"\uf0ff", 'md-backspace': u"\uf100", 'md-block': u"\uf101", 'md-clear': u"\uf102", 'md-content-copy': u"\uf103", 'md-content-cut': u"\uf104", 'md-content-paste': u"\uf105", 'md-create': u"\uf106", 'md-drafts': u"\uf107", 'md-filter-list': u"\uf108", 'md-flag': u"\uf109", 'md-forward': u"\uf10a", 'md-gesture': u"\uf10b", 'md-inbox': u"\uf10c", 'md-link': u"\uf10d", 'md-mail': u"\uf10e", 'md-markunread': u"\uf10f", 'md-redo': u"\uf110", 'md-remove': u"\uf111", 'md-remove-circle': u"\uf112", 'md-remove-circle-outline': u"\uf113", 'md-reply': u"\uf114", 'md-reply-all': u"\uf115", 'md-report': u"\uf116", 'md-save': u"\uf117", 'md-select-all': u"\uf118", 'md-send': u"\uf119", 'md-sort': u"\uf11a", 'md-text-format': u"\uf11b", 'md-undo': u"\uf11c", 'md-access-alarm': u"\uf11d", 'md-access-alarms': u"\uf11e", 'md-access-time': u"\uf11f", 'md-add-alarm': u"\uf120", 'md-airplanemode-off': u"\uf121", 'md-airplanemode-on': u"\uf122", 'md-battery-20': u"\uf123", 'md-battery-30': u"\uf124", 'md-battery-50': u"\uf125", 'md-battery-60': u"\uf126", 'md-battery-80': u"\uf127", 'md-battery-90': u"\uf128", 'md-battery-alert': u"\uf129", 'md-battery-charging-20': u"\uf12a", 'md-battery-charging-30': u"\uf12b", 'md-battery-charging-50': u"\uf12c", 'md-battery-charging-60': u"\uf12d", 'md-battery-charging-80': u"\uf12e", 'md-battery-charging-90': u"\uf12f", 'md-battery-charging-full': u"\uf130", 'md-battery-full': u"\uf131", 'md-battery-std': u"\uf132", 'md-battery-unknown': u"\uf133", 'md-bluetooth': u"\uf134", 'md-bluetooth-connected': u"\uf135", 'md-bluetooth-disabled': u"\uf136", 'md-bluetooth-searching': u"\uf137", 'md-brightness-auto': u"\uf138", 'md-brightness-high': u"\uf139", 'md-brightness-low': u"\uf13a", 'md-brightness-medium': u"\uf13b", 'md-data-usage': u"\uf13c", 'md-developer-mode': u"\uf13d", 'md-devices': u"\uf13e", 'md-dvr': u"\uf13f", 'md-gps-fixed': u"\uf140", 'md-gps-not-fixed': u"\uf141", 'md-gps-off': u"\uf142", 'md-location-disabled': u"\uf143", 'md-location-searching': u"\uf144", 'md-multitrack-audio': u"\uf145", 'md-network-cell': u"\uf146", 'md-network-wifi': u"\uf147", 'md-nfc': u"\uf148", 'md-now-wallpaper': u"\uf149", 'md-now-widgets': u"\uf14a", 'md-screen-lock-landscape': u"\uf14b", 'md-screen-lock-portrait': u"\uf14c", 'md-screen-lock-rotation': u"\uf14d", 'md-screen-rotation': u"\uf14e", 'md-sd-storage': u"\uf14f", 'md-settings-system-daydream': u"\uf150", 'md-signal-cellular-0-bar': u"\uf151", 'md-signal-cellular-1-bar': u"\uf152", 'md-signal-cellular-2-bar': u"\uf153", 'md-signal-cellular-3-bar': u"\uf154", 'md-signal-cellular-4-bar': u"\uf155", 'md-signal-cellular-connected-no-internet-0-bar': u"\uf156", 'md-signal-cellular-connected-no-internet-1-bar': u"\uf157", 'md-signal-cellular-connected-no-internet-2-bar': u"\uf158", 'md-signal-cellular-connected-no-internet-3-bar': u"\uf159", 'md-signal-cellular-connected-no-internet-4-bar': u"\uf15a", 'md-signal-cellular-no-sim': u"\uf15b", 'md-signal-cellular-null': u"\uf15c", 'md-signal-cellular-off': u"\uf15d", 'md-signal-wifi-0-bar': u"\uf15e", 'md-signal-wifi-1-bar': u"\uf15f", 'md-signal-wifi-2-bar': u"\uf160", 'md-signal-wifi-3-bar': u"\uf161", 'md-signal-wifi-4-bar': u"\uf162", 'md-signal-wifi-off': u"\uf163", 'md-storage': u"\uf164", 'md-usb': u"\uf165", 'md-wifi-lock': u"\uf166", 'md-wifi-tethering': u"\uf167", 'md-attach-file': u"\uf168", 'md-attach-money': u"\uf169", 'md-border-all': u"\uf16a", 'md-border-bottom': u"\uf16b", 'md-border-clear': u"\uf16c", 'md-border-color': u"\uf16d", 'md-border-horizontal': u"\uf16e", 'md-border-inner': u"\uf16f", 'md-border-left': u"\uf170", 'md-border-outer': u"\uf171", 'md-border-right': u"\uf172", 'md-border-style': u"\uf173", 'md-border-top': u"\uf174", 'md-border-vertical': u"\uf175", 'md-format-align-center': u"\uf176", 'md-format-align-justify': u"\uf177", 'md-format-align-left': u"\uf178", 'md-format-align-right': u"\uf179", 'md-format-bold': u"\uf17a", 'md-format-clear': u"\uf17b", 'md-format-color-fill': u"\uf17c", 'md-format-color-reset': u"\uf17d", 'md-format-color-text': u"\uf17e", 'md-format-indent-decrease': u"\uf17f", 'md-format-indent-increase': u"\uf180", 'md-format-italic': u"\uf181", 'md-format-line-spacing': u"\uf182", 'md-format-list-bulleted': u"\uf183", 'md-format-list-numbered': u"\uf184", 'md-format-paint': u"\uf185", 'md-format-quote': u"\uf186", 'md-format-size': u"\uf187", 'md-format-strikethrough': u"\uf188", 'md-format-textdirection-l-to-r': u"\uf189", 'md-format-textdirection-r-to-l': u"\uf18a", 'md-format-underline': u"\uf18b", 'md-functions': u"\uf18c", 'md-insert-chart': u"\uf18d", 'md-insert-comment': u"\uf18e", 'md-insert-drive-file': u"\uf18f", 'md-insert-emoticon': u"\uf190", 'md-insert-invitation': u"\uf191", 'md-insert-link': u"\uf192", 'md-insert-photo': u"\uf193", 'md-merge-type': u"\uf194", 'md-mode-comment': u"\uf195", 'md-mode-edit': u"\uf196", 'md-publish': u"\uf197", 'md-vertical-align-bottom': u"\uf198", 'md-vertical-align-center': u"\uf199", 'md-vertical-align-top': u"\uf19a", 'md-wrap-text': u"\uf19b", 'md-attachment': u"\uf19c", 'md-cloud': u"\uf19d", 'md-cloud-circle': u"\uf19e", 'md-cloud-done': u"\uf19f", 'md-cloud-download': u"\uf1a0", 'md-cloud-off': u"\uf1a1", 'md-cloud-queue': u"\uf1a2", 'md-cloud-upload': u"\uf1a3", 'md-file-download': u"\uf1a4", 'md-file-upload': u"\uf1a5", 'md-folder': u"\uf1a6", 'md-folder-open': u"\uf1a7", 'md-folder-shared': u"\uf1a8", 'md-cast': u"\uf1a9", 'md-cast-connected': u"\uf1aa", 'md-computer': u"\uf1ab", 'md-desktop-mac': u"\uf1ac", 'md-desktop-windows': u"\uf1ad", 'md-dock': u"\uf1ae", 'md-gamepad': u"\uf1af", 'md-headset': u"\uf1b0", 'md-headset-mic': u"\uf1b1", 'md-keyboard': u"\uf1b2", 'md-keyboard-alt': u"\uf1b3", 'md-keyboard-arrow-down': u"\uf1b4", 'md-keyboard-arrow-left': u"\uf1b5", 'md-keyboard-arrow-right': u"\uf1b6", 'md-keyboard-arrow-up': u"\uf1b7", 'md-keyboard-backspace': u"\uf1b8", 'md-keyboard-capslock': u"\uf1b9", 'md-keyboard-control': u"\uf1ba", 'md-keyboard-hide': u"\uf1bb", 'md-keyboard-return': u"\uf1bc", 'md-keyboard-tab': u"\uf1bd", 'md-keyboard-voice': u"\uf1be", 'md-laptop': u"\uf1bf", 'md-laptop-chromebook': u"\uf1c0", 'md-laptop-mac': u"\uf1c1", 'md-laptop-windows': u"\uf1c2", 'md-memory': u"\uf1c3", 'md-mouse': u"\uf1c4", 'md-phone-android': u"\uf1c5", 'md-phone-iphone': u"\uf1c6", 'md-phonelink': u"\uf1c7", 'md-phonelink-off': u"\uf1c8", 'md-security': u"\uf1c9", 'md-sim-card': u"\uf1ca", 'md-smartphone': u"\uf1cb", 'md-speaker': u"\uf1cc", 'md-tablet': u"\uf1cd", 'md-tablet-android': u"\uf1ce", 'md-tablet-mac': u"\uf1cf", 'md-tv': u"\uf1d0", 'md-watch': u"\uf1d1", 'md-add-to-photos': u"\uf1d2", 'md-adjust': u"\uf1d3", 'md-assistant-photo': u"\uf1d4", 'md-audiotrack': u"\uf1d5", 'md-blur-circular': u"\uf1d6", 'md-blur-linear': u"\uf1d7", 'md-blur-off': u"\uf1d8", 'md-blur-on': u"\uf1d9", 'md-brightness-1': u"\uf1da", 'md-brightness-2': u"\uf1db", 'md-brightness-3': u"\uf1dc", 'md-brightness-4': u"\uf1dd", 'md-brightness-5': u"\uf1de", 'md-brightness-6': u"\uf1df", 'md-brightness-7': u"\uf1e0", 'md-brush': u"\uf1e1", 'md-camera': u"\uf1e2", 'md-camera-alt': u"\uf1e3", 'md-camera-front': u"\uf1e4", 'md-camera-rear': u"\uf1e5", 'md-camera-roll': u"\uf1e6", 'md-center-focus-strong': u"\uf1e7", 'md-center-focus-weak': u"\uf1e8", 'md-collections': u"\uf1e9", 'md-colorize': u"\uf1ea", 'md-color-lens': u"\uf1eb", 'md-compare': u"\uf1ec", 'md-control-point': u"\uf1ed", 'md-control-point-duplicate': u"\uf1ee", 'md-crop': u"\uf1ef", 'md-crop-3-2': u"\uf1f0", 'md-crop-5-4': u"\uf1f1", 'md-crop-7-5': u"\uf1f2", 'md-crop-16-9': u"\uf1f3", 'md-crop-din': u"\uf1f4", 'md-crop-free': u"\uf1f5", 'md-crop-landscape': u"\uf1f6", 'md-crop-original': u"\uf1f7", 'md-crop-portrait': u"\uf1f8", 'md-crop-square': u"\uf1f9", 'md-dehaze': u"\uf1fa", 'md-details': u"\uf1fb", 'md-edit': u"\uf1fc", 'md-exposure': u"\uf1fd", 'md-exposure-minus-1': u"\uf1fe", 'md-exposure-minus-2': u"\uf1ff", 'md-exposure-zero': u"\uf200", 'md-exposure-plus-1': u"\uf201", 'md-exposure-plus-2': u"\uf202", 'md-filter': u"\uf203", 'md-filter-1': u"\uf204", 'md-filter-2': u"\uf205", 'md-filter-3': u"\uf206", 'md-filter-4': u"\uf207", 'md-filter-5': u"\uf208", 'md-filter-6': u"\uf209", 'md-filter-7': u"\uf20a", 'md-filter-8': u"\uf20b", 'md-filter-9': u"\uf20c", 'md-filter-9-plus': u"\uf20d", 'md-filter-b-and-w': u"\uf20e", 'md-filter-center-focus': u"\uf20f", 'md-filter-drama': u"\uf210", 'md-filter-frames': u"\uf211", 'md-filter-hdr': u"\uf212", 'md-filter-none': u"\uf213", 'md-filter-tilt-shift': u"\uf214", 'md-filter-vintage': u"\uf215", 'md-flare': u"\uf216", 'md-flash-auto': u"\uf217", 'md-flash-off': u"\uf218", 'md-flash-on': u"\uf219", 'md-flip': u"\uf21a", 'md-gradient': u"\uf21b", 'md-grain': u"\uf21c", 'md-grid-off': u"\uf21d", 'md-grid-on': u"\uf21e", 'md-hdr-off': u"\uf21f", 'md-hdr-on': u"\uf220", 'md-hdr-strong': u"\uf221", 'md-hdr-weak': u"\uf222", 'md-healing': u"\uf223", 'md-image': u"\uf224", 'md-image-aspect-ratio': u"\uf225", 'md-iso': u"\uf226", 'md-landscape': u"\uf227", 'md-leak-add': u"\uf228", 'md-leak-remove': u"\uf229", 'md-lens': u"\uf22a", 'md-looks': u"\uf22b", 'md-looks-1': u"\uf22c", 'md-looks-2': u"\uf22d", 'md-looks-3': u"\uf22e", 'md-looks-4': u"\uf22f", 'md-looks-5': u"\uf230", 'md-looks-6': u"\uf231", 'md-loupe': u"\uf232", 'md-movie-creation': u"\uf233", 'md-nature': u"\uf234", 'md-nature-people': u"\uf235", 'md-navigate-before': u"\uf236", 'md-navigate-next': u"\uf237", 'md-palette': u"\uf238", 'md-panorama': u"\uf239", 'md-panorama-fisheye': u"\uf23a", 'md-panorama-horizontal': u"\uf23b", 'md-panorama-vertical': u"\uf23c", 'md-panorama-wide-angle': u"\uf23d", 'md-photo': u"\uf23e", 'md-photo-album': u"\uf23f", 'md-photo-camera': u"\uf240", 'md-photo-library': u"\uf241", 'md-portrait': u"\uf242", 'md-remove-red-eye': u"\uf243", 'md-rotate-left': u"\uf244", 'md-rotate-right': u"\uf245", 'md-slideshow': u"\uf246", 'md-straighten': u"\uf247", 'md-style': u"\uf248", 'md-switch-camera': u"\uf249", 'md-switch-video': u"\uf24a", 'md-tag-faces': u"\uf24b", 'md-texture': u"\uf24c", 'md-timelapse': u"\uf24d", 'md-timer': u"\uf24e", 'md-timer-3': u"\uf24f", 'md-timer-10': u"\uf250", 'md-timer-auto': u"\uf251", 'md-timer-off': u"\uf252", 'md-tonality': u"\uf253", 'md-transform': u"\uf254", 'md-tune': u"\uf255", 'md-wb-auto': u"\uf256", 'md-wb-cloudy': u"\uf257", 'md-wb-incandescent': u"\uf258", 'md-wb-irradescent': u"\uf259", 'md-wb-sunny': u"\uf25a", 'md-beenhere': u"\uf25b", 'md-directions': u"\uf25c", 'md-directions-bike': u"\uf25d", 'md-directions-bus': u"\uf25e", 'md-directions-car': u"\uf25f", 'md-directions-ferry': u"\uf260", 'md-directions-subway': u"\uf261", 'md-directions-train': u"\uf262", 'md-directions-transit': u"\uf263", 'md-directions-walk': u"\uf264", 'md-flight': u"\uf265", 'md-hotel': u"\uf266", 'md-layers': u"\uf267", 'md-layers-clear': u"\uf268", 'md-local-airport': u"\uf269", 'md-local-atm': u"\uf26a", 'md-local-attraction': u"\uf26b", 'md-local-bar': u"\uf26c", 'md-local-cafe': u"\uf26d", 'md-local-car-wash': u"\uf26e", 'md-local-convenience-store': u"\uf26f", 'md-local-drink': u"\uf270", 'md-local-florist': u"\uf271", 'md-local-gas-station': u"\uf272", 'md-local-grocery-store': u"\uf273", 'md-local-hospital': u"\uf274", 'md-local-hotel': u"\uf275", 'md-local-laundry-service': u"\uf276", 'md-local-library': u"\uf277", 'md-local-mall': u"\uf278", 'md-local-movies': u"\uf279", 'md-local-offer': u"\uf27a", 'md-local-parking': u"\uf27b", 'md-local-pharmacy': u"\uf27c", 'md-local-phone': u"\uf27d", 'md-local-pizza': u"\uf27e", 'md-local-play': u"\uf27f", 'md-local-post-office': u"\uf280", 'md-local-print-shop': u"\uf281", 'md-local-restaurant': u"\uf282", 'md-local-see': u"\uf283", 'md-local-shipping': u"\uf284", 'md-local-taxi': u"\uf285", 'md-location-history': u"\uf286", 'md-map': u"\uf287", 'md-my-location': u"\uf288", 'md-navigation': u"\uf289", 'md-pin-drop': u"\uf28a", 'md-place': u"\uf28b", 'md-rate-review': u"\uf28c", 'md-restaurant-menu': u"\uf28d", 'md-satellite': u"\uf28e", 'md-store-mall-directory': u"\uf28f", 'md-terrain': u"\uf290", 'md-traffic': u"\uf291", 'md-apps': u"\uf292", 'md-cancel': u"\uf293", 'md-arrow-drop-down-circle': u"\uf294", 'md-arrow-drop-down': u"\uf295", 'md-arrow-drop-up': u"\uf296", 'md-arrow-back': u"\uf297", 'md-arrow-forward': u"\uf298", 'md-check': u"\uf299", 'md-close': u"\uf29a", 'md-chevron-left': u"\uf29b", 'md-chevron-right': u"\uf29c", 'md-expand-less': u"\uf29d", 'md-expand-more': u"\uf29e", 'md-fullscreen': u"\uf29f", 'md-fullscreen-exit': u"\uf2a0", 'md-menu': u"\uf2a1", 'md-more-horiz': u"\uf2a2", 'md-more-vert': u"\uf2a3", 'md-refresh': u"\uf2a4", 'md-unfold-less': u"\uf2a5", 'md-unfold-more': u"\uf2a6", 'md-adb': u"\uf2a7", 'md-bluetooth-audio': u"\uf2a8", 'md-disc-full': u"\uf2a9", 'md-dnd-forwardslash': u"\uf2aa", 'md-do-not-disturb': u"\uf2ab", 'md-drive-eta': u"\uf2ac", 'md-event-available': u"\uf2ad", 'md-event-busy': u"\uf2ae", 'md-event-note': u"\uf2af", 'md-folder-special': u"\uf2b0", 'md-mms': u"\uf2b1", 'md-more': u"\uf2b2", 'md-network-locked': u"\uf2b3", 'md-phone-bluetooth-speaker': u"\uf2b4", 'md-phone-forwarded': u"\uf2b5", 'md-phone-in-talk': u"\uf2b6", 'md-phone-locked': u"\uf2b7", 'md-phone-missed': u"\uf2b8", 'md-phone-paused': u"\uf2b9", 'md-play-download': u"\uf2ba", 'md-play-install': u"\uf2bb", 'md-sd-card': u"\uf2bc", 'md-sim-card-alert': u"\uf2bd", 'md-sms': u"\uf2be", 'md-sms-failed': u"\uf2bf", 'md-sync': u"\uf2c0", 'md-sync-disabled': u"\uf2c1", 'md-sync-problem': u"\uf2c2", 'md-system-update': u"\uf2c3", 'md-tap-and-play': u"\uf2c4", 'md-time-to-leave': u"\uf2c5", 'md-vibration': u"\uf2c6", 'md-voice-chat': u"\uf2c7", 'md-vpn-lock': u"\uf2c8", 'md-cake': u"\uf2c9", 'md-domain': u"\uf2ca", 'md-location-city': u"\uf2cb", 'md-mood': u"\uf2cc", 'md-notifications-none': u"\uf2cd", 'md-notifications': u"\uf2ce", 'md-notifications-off': u"\uf2cf", 'md-notifications-on': u"\uf2d0", 'md-notifications-paused': u"\uf2d1", 'md-pages': u"\uf2d2", 'md-party-mode': u"\uf2d3", 'md-group': u"\uf2d4", 'md-group-add': u"\uf2d5", 'md-people': u"\uf2d6", 'md-people-outline': u"\uf2d7", 'md-person': u"\uf2d8", 'md-person-add': u"\uf2d9", 'md-person-outline': u"\uf2da", 'md-plus-one': u"\uf2db", 'md-poll': u"\uf2dc", 'md-public': u"\uf2dd", 'md-school': u"\uf2de", 'md-share': u"\uf2df", 'md-whatshot': u"\uf2e0", 'md-check-box': u"\uf2e1", 'md-check-box-outline-blank': u"\uf2e2", 'md-radio-button-off': u"\uf2e3", 'md-radio-button-on': u"\uf2e4", 'md-star': u"\uf2e5", 'md-star-half': u"\uf2e6", 'md-star-outline': u"\uf2e7", }
# Time: O(n) # Space: O(n) class Solution(object): def isPrefixOfWord(self, sentence, searchWord): """ :type sentence: str :type searchWord: str :rtype: int """ def KMP(text, pattern): def getPrefix(pattern): prefix = [-1] * len(pattern) j = -1 for i in range(1, len(pattern)): while j > -1 and pattern[j + 1] != pattern[i]: j = prefix[j] if pattern[j + 1] == pattern[i]: j += 1 prefix[i] = j return prefix prefix = getPrefix(pattern) j = -1 for i in range(len(text)): while j != -1 and pattern[j+1] != text[i]: j = prefix[j] if pattern[j+1] == text[i]: j += 1 if j+1 == len(pattern): return i-j return -1 if sentence.startswith(searchWord): return 1 p = KMP(sentence, ' ' + searchWord) if p == -1: return -1 return 1+sum(sentence[i] == ' ' for i in range(p+1))
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # * RUNTIME SHENG TRANSLATOR - CORE * # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # * Welcome to Runtime Sheng translator. v1.0.0 * # * MIT License, Copyright(c) 2018, Antony Muga * # * All Rights Reserved. * # * Author: Antony Muga * # ---------------------------------------------------------- # * Project's Links: * # * Twitter: https://twitter.com/RuntimeClubKe * # * Runtime Club on LinkedIn * # * Runtime Club on Github * # * RuntimeTranslate project on GitHub * # ---------------------------------------------------------- # * Personal social links: * # * GitHub: https://github.com/antonymuga/ * # * Website: https://antonymuga.github.io * # * LinkedIn: https://www.linkedin.com/in/antony-muga/ * # * Email: https://sites.google.com/view/antonymuga/home * # ---------------------------------------------------------- projectDetails = """ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * RUNTIME SHENG TRANSLATOR * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Welcome to Runtime Sheng translator. v1.0.0 * * MIT License, Copyright(c) 2018, Antony Muga * * All Rights Reserved. * * Author: Antony Muga * ---------------------------------------------------------- * Project's Links: * * TWITTER: https://twitter.com/RuntimeLab * * LINKEDIN: Runtime Lab * * GITHUB: RuntimeLab organization * * GITHUB: Fork RuntimeShengTranslator project * ---------------------------------------------------------- * AUTHOR: ANTONY MUGA * * Personal social links: * * GITHUB: https://github.com/antonymuga/ * * WEBSITE: https://antonymuga.github.io * * LINKEDIN: https://www.linkedin.com/in/antony-muga/ * * CONTACT: https://sites.google.com/view/antonymuga/home* ---------------------------------------------------------- """ signOff = """ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ THANK YOU FOR USING RUNTIME TRANSLATE v1.0.0 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TWITTER: RuntimeLab LINKEDIN: Runtime Lab --------------------------------------------------------------- GITHUB: RuntimeLab organization FORK ON GITHUB & CONTRIBUTE: RuntimeShengTranslator --------------------------------------------------------------- AUTHOR: Antony Muga GITHUB: https://github.com/antonymuga/ LINKEDIN: https://www.linkedin.com/in/antony-muga/ WEBSITE: https://antonymuga.github.io EMAIL: https://sites.google.com/view/antonymuga/home --------------------------------------------------------------- Copyright(c) 2018, Antony Muga, RuntimeLab https://antonymuga.github.io/ --------------------------------------------------------------- """
# # PySNMP MIB module XYPLEX-IPX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYPLEX-IPX-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:40:03 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) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Gauge32, TimeTicks, Counter64, iso, Bits, ModuleIdentity, IpAddress, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, Counter32, ObjectIdentity, enterprises, Unsigned32, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "TimeTicks", "Counter64", "iso", "Bits", "ModuleIdentity", "IpAddress", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "Counter32", "ObjectIdentity", "enterprises", "Unsigned32", "MibIdentifier") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") xyplex = MibIdentifier((1, 3, 6, 1, 4, 1, 33)) ipx = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 15)) ipxSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 15, 1)) ipxIf = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 15, 2)) ipxNetbios = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 15, 3)) ipxRip = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 15, 4)) ipxSap = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 15, 5)) ipxRouting = MibScalar((1, 3, 6, 1, 4, 1, 33, 15, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxRouting.setStatus('mandatory') ipxIfTable = MibTable((1, 3, 6, 1, 4, 1, 33, 15, 2, 1), ) if mibBuilder.loadTexts: ipxIfTable.setStatus('mandatory') ipxIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1), ).setIndexNames((0, "XYPLEX-IPX-MIB", "ipxIfIndex")) if mibBuilder.loadTexts: ipxIfEntry.setStatus('mandatory') ipxIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfIndex.setStatus('mandatory') ipxIfState = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxIfState.setStatus('mandatory') ipxIfNetwork = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxIfNetwork.setStatus('mandatory') ipxIfFrameStyle = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ethernet", 1), ("ieee8022", 2))).clone('ieee8022')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxIfFrameStyle.setStatus('mandatory') ipxIfFramesIn = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfFramesIn.setStatus('mandatory') ipxIfFramesOut = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfFramesOut.setStatus('mandatory') ipxIfErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfErrors.setStatus('mandatory') ipxIfTransitDelay = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxIfTransitDelay.setStatus('mandatory') ipxIfTransitDelayActual = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 9), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfTransitDelayActual.setStatus('mandatory') ipxNetbiosHopLimit = MibScalar((1, 3, 6, 1, 4, 1, 33, 15, 3, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxNetbiosHopLimit.setStatus('mandatory') ipxNetbiosIfTable = MibTable((1, 3, 6, 1, 4, 1, 33, 15, 3, 2), ) if mibBuilder.loadTexts: ipxNetbiosIfTable.setStatus('mandatory') ipxNetbiosIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1), ).setIndexNames((0, "XYPLEX-IPX-MIB", "ipxNetbiosIfIndex")) if mibBuilder.loadTexts: ipxNetbiosIfEntry.setStatus('mandatory') ipxNetbiosIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxNetbiosIfIndex.setStatus('mandatory') ipxIfNetbiosForwarding = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxIfNetbiosForwarding.setStatus('mandatory') ipxIfNetbiosIn = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfNetbiosIn.setStatus('mandatory') ipxIfNetbiosOut = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfNetbiosOut.setStatus('mandatory') ipxRipIfTable = MibTable((1, 3, 6, 1, 4, 1, 33, 15, 4, 1), ) if mibBuilder.loadTexts: ipxRipIfTable.setStatus('mandatory') ipxRipIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1), ).setIndexNames((0, "XYPLEX-IPX-MIB", "ipxRipIfIndex")) if mibBuilder.loadTexts: ipxRipIfEntry.setStatus('mandatory') ipxRipIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxRipIfIndex.setStatus('mandatory') ipxIfRipBcst = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxIfRipBcst.setStatus('mandatory') ipxIfRipBcstDiscardTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 3), Integer32().clone(180)).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxIfRipBcstDiscardTimeout.setStatus('mandatory') ipxIfRipBcstTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 4), Integer32().clone(60)).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxIfRipBcstTimer.setStatus('mandatory') ipxIfRipIn = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfRipIn.setStatus('mandatory') ipxIfRipOut = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfRipOut.setStatus('mandatory') ipxIfRipAgedOut = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfRipAgedOut.setStatus('mandatory') ipxRipTable = MibTable((1, 3, 6, 1, 4, 1, 33, 15, 4, 2), ) if mibBuilder.loadTexts: ipxRipTable.setStatus('mandatory') ipxRipEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1), ).setIndexNames((0, "XYPLEX-IPX-MIB", "ipxRipNetwork")) if mibBuilder.loadTexts: ipxRipEntry.setStatus('mandatory') ipxRipNetwork = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxRipNetwork.setStatus('mandatory') ipxRipRouter = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxRipRouter.setStatus('mandatory') ipxRipInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxRipInterface.setStatus('mandatory') ipxRipHops = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxRipHops.setStatus('mandatory') ipxRipTransTime = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxRipTransTime.setStatus('mandatory') ipxRipAge = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxRipAge.setStatus('mandatory') ipxSapIfTable = MibTable((1, 3, 6, 1, 4, 1, 33, 15, 5, 1), ) if mibBuilder.loadTexts: ipxSapIfTable.setStatus('mandatory') ipxSapIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1), ).setIndexNames((0, "XYPLEX-IPX-MIB", "ipxSapIfIndex")) if mibBuilder.loadTexts: ipxSapIfEntry.setStatus('mandatory') ipxSapIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxSapIfIndex.setStatus('mandatory') ipxIfSapBcst = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxIfSapBcst.setStatus('mandatory') ipxIfSapBcstDiscardTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 3), Integer32().clone(180)).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxIfSapBcstDiscardTimeout.setStatus('mandatory') ipxIfSapBcstTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 4), Integer32().clone(60)).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipxIfSapBcstTimer.setStatus('mandatory') ipxIfSapIn = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfSapIn.setStatus('mandatory') ipxIfSapOut = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfSapOut.setStatus('mandatory') ipxIfSapAgedOut = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxIfSapAgedOut.setStatus('mandatory') ipxSapTable = MibTable((1, 3, 6, 1, 4, 1, 33, 15, 5, 2), ) if mibBuilder.loadTexts: ipxSapTable.setStatus('mandatory') ipxSapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1), ).setIndexNames((0, "XYPLEX-IPX-MIB", "ipxSapName"), (0, "XYPLEX-IPX-MIB", "ipxSapType")) if mibBuilder.loadTexts: ipxSapEntry.setStatus('mandatory') ipxSapName = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(48, 48)).setFixedLength(48)).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxSapName.setStatus('mandatory') ipxSapNetwork = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxSapNetwork.setStatus('mandatory') ipxSapHost = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxSapHost.setStatus('mandatory') ipxSapSocket = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxSapSocket.setStatus('mandatory') ipxSapInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxSapInterface.setStatus('mandatory') ipxSapType = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=NamedValues(("user", 1), ("userGroup", 2), ("printQueue", 3), ("novellFileServer", 4), ("jobServer", 5), ("gateway1", 6), ("printServer", 7), ("archiveQueue", 8), ("archiveServer", 9), ("jobQueue", 10), ("administration", 11)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxSapType.setStatus('mandatory') ipxSapAge = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipxSapAge.setStatus('mandatory') mibBuilder.exportSymbols("XYPLEX-IPX-MIB", ipxNetbiosIfEntry=ipxNetbiosIfEntry, ipxRipIfIndex=ipxRipIfIndex, ipxRipRouter=ipxRipRouter, ipxIfRipBcstTimer=ipxIfRipBcstTimer, ipxRip=ipxRip, ipxIfRipOut=ipxIfRipOut, ipxSap=ipxSap, ipxIfSapAgedOut=ipxIfSapAgedOut, ipxIfRipIn=ipxIfRipIn, ipxIfIndex=ipxIfIndex, ipxRipNetwork=ipxRipNetwork, ipxRipInterface=ipxRipInterface, ipxSapName=ipxSapName, ipxIfFramesOut=ipxIfFramesOut, ipxSystem=ipxSystem, ipxSapIfEntry=ipxSapIfEntry, ipxIfSapBcstTimer=ipxIfSapBcstTimer, ipxSapEntry=ipxSapEntry, ipxSapIfTable=ipxSapIfTable, ipxRipAge=ipxRipAge, ipxIfSapBcstDiscardTimeout=ipxIfSapBcstDiscardTimeout, ipxRipEntry=ipxRipEntry, ipxSapHost=ipxSapHost, ipxIfRipAgedOut=ipxIfRipAgedOut, ipxIfTransitDelayActual=ipxIfTransitDelayActual, ipxIfTable=ipxIfTable, ipxRipTransTime=ipxRipTransTime, ipxNetbios=ipxNetbios, ipxIfSapIn=ipxIfSapIn, ipxSapAge=ipxSapAge, ipxSapInterface=ipxSapInterface, ipxIfState=ipxIfState, ipxRipIfTable=ipxRipIfTable, ipxIfFramesIn=ipxIfFramesIn, ipxNetbiosIfTable=ipxNetbiosIfTable, ipxIfSapBcst=ipxIfSapBcst, ipxNetbiosIfIndex=ipxNetbiosIfIndex, xyplex=xyplex, ipxIfNetbiosForwarding=ipxIfNetbiosForwarding, ipxSapSocket=ipxSapSocket, ipxIfRipBcst=ipxIfRipBcst, ipxRipTable=ipxRipTable, ipxIfErrors=ipxIfErrors, ipxRipIfEntry=ipxRipIfEntry, ipxRipHops=ipxRipHops, ipxIfRipBcstDiscardTimeout=ipxIfRipBcstDiscardTimeout, ipxNetbiosHopLimit=ipxNetbiosHopLimit, ipxSapIfIndex=ipxSapIfIndex, ipxIfFrameStyle=ipxIfFrameStyle, ipxSapNetwork=ipxSapNetwork, ipxRouting=ipxRouting, ipxIfTransitDelay=ipxIfTransitDelay, ipxSapTable=ipxSapTable, ipxIfSapOut=ipxIfSapOut, ipx=ipx, ipxIfNetbiosOut=ipxIfNetbiosOut, ipxSapType=ipxSapType, ipxIf=ipxIf, ipxIfNetwork=ipxIfNetwork, ipxIfEntry=ipxIfEntry, ipxIfNetbiosIn=ipxIfNetbiosIn)
''' ''' def load(config): data = [] with open(config['SimLex-999']['Dataset_File'], 'r') as stream: # skip headers stream.readline() # load data for line in stream: (w1, w2, _, score, _) = [s.strip() for s in line.split('\t', 4)] data.append((w1, w2, float(score))) return data
class Solution: def addBinary(self, a, b): """ :type a: str :type b: str :rtype: str """ sumStr = str(int(a) + int(b)) sumList = [int(sumStr[i]) for i in range(len(sumStr))] for i in range(0, len(sumList) - 1): k = len(sumList) - i - 1 if sumList[k] >= 2: sumList[k] -= 2 sumList[k - 1] += 1 if sumList[0] >= 2: sumList[0] -= 2 sumList.insert(0, 1) res = "" for i in range(len(sumList)): res += str(sumList[i]) return res if __name__ == '__main__': a = input() b = input() print(Solution().addBinary(a, b))
""" Provides Python modules such as; * LiteXXX referenced as submodules. * (Maybe?) pip installable libraries like; - colorterm - hexfile - etc """
class Missed(object): pass class Null: pass class RaiseKeyError: pass class LazyCache(object): """Wraps a Django cache object to provide more features.""" missed = Missed() def __init__(self, cache, default_timeout=None): self.cache = cache self.default_timeout = default_timeout def __getattr__(self, name): return getattr(self, self.cache, name) def __getitem__(self, key): return self.get(key, default=RaiseKeyError) def __delitem__(self, key): self.delete(key) def __setitem__(self, key, value): self.set(key, value) def _prepare_value(self, value): if value is None: value = Null return value def _restore_value(self, key, value): if value is Null: return None if value is RaiseKeyError: raise KeyError('"%s" was not found in the cache.' % key) return value def add(self, key, value, timeout=0, **kwargs): value = self._prepare_value(key, value, timeout) return self.cache.add(key, value, timeout=timeout, **kwargs) def get(self, key, default=None, **kwargs): value = self.cache.get(key, default=default, **kwargs) value = self._restore_value(key, value) return value def get_many(self, keys, **kwargs): data = self.cache.get_many(keys, **kwargs) restored_data = {} for key, value in data.items(): value = self._restore_value(key, value) restored_data[key] = value return restored_data def get_or_miss(self, key, miss=False): """ Returns the cached value, or the "missed" object if it was not found in the cache. Passing in True for the second argument will make it bypass the cache and always return the "missed" object. Example usage: def get_value(refresh_cache=False): key = 'some.key.123' value = cache.get_or_miss(key, refresh_cache) if value is cache.missed: value = generate_new_value() cache.set(key, value) return value """ return miss and self.missed or self.get(key, default=self.missed) def set(self, key, value, timeout=None, **kwargs): if timeout is None: timeout = self.default_timeout value = self._prepare_value(key, value, timeout) return self.cache.set(key, value, timeout=timeout, **kwargs) def set_many(self, data, timeout=None, **kwargs): if timeout is None: timeout = self.default_timeout prepared_data = {} for key, value in data.items(): value = self._prepare_value(key, value, timeout) prepared_data[key] = value self.cache.set_many(prepared_data, timeout=timeout, **kwargs)
def poly_sum(xs, ys): # return the list representing the sum of the polynomials represented by the # lists xs and ys zs = [] l = min(len(xs), len(ys)) for i in range(0, l): zs.append(xs[i] + ys[i]) if len(xs) > len(ys): for i in range(l, len(xs)): zs.append(xs[i]) else: for i in range(l, len(ys)): zs.append(ys[i]) return zs def test(test_case_xs, test_case_ys, expected): actual = poly_sum(test_case_xs, test_case_ys) if actual == expected: print("Passed test for " + str(test_case_xs) + ", " + str(test_case_ys)) else: print("Didn't pass test for " + str(test_case_xs) + ", " + str(test_case_ys)) print("The result was " + str(actual) + " but it should have been " + str(expected)) test([], [], []) test([1, 2], [3, 4], [4, 6]) test([-10, 10, 20], [10, -10, -20], [0, 0, 0]) test([1, 2, 3, 4, 5], [1, 2, 3], [2, 4, 6, 4, 5]) test([1, 2, 3], [1, 2, 3, 4, 5], [2, 4, 6, 4, 5])
class Stack: def __init__(self, data=[]): self.data = data def __repr__(self) -> str: return f"{self.data}" def peek(self): if self.data: return self.data[-1] else: return None def pop(self): return self.data.pop() def push(self, d): self.data.append(d) def isempty(self): if len(self.data) == 0: return True else: return False def merge(base, addition): merged = [] for i, b in enumerate(base): if b == 0: merged.append(0) else: merged.append(b + addition[i]) return merged def max_mat_rect(m): h = len(m) area = 0 for i in range(h): hist = m[i] if i == 0 else merge(m[i], hist) area = max(area, max_rect(hist)) return area def max_rect(bars): stack = Stack() bars.append(0) area = 0 for i, h in enumerate(bars): if stack.isempty() or h > bars[stack.peek()]: stack.push(i) else: while not stack.isempty() and h < bars[stack.peek()]: i0 = stack.pop() width = i - i0 area = max(area, bars[i0] * width) return area print(max_rect([0, 2, 1, 5, 5, 2, 3])) print(max_rect([2, 4, 4])) m = [[0, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 0, 0]] print(max_mat_rect(m))
"""esta clase va a manejar las fracciones""" def validaEntero(funcion): def validar(*args): if len(args) == 2: numero1=args[0] numero2=args[1] numero1=convierteTipo(numero1) numero2=convierteTipo(numero2) return funcion(numero1, numero2) elif len(args) == 3: numero1=args[1] numero2=args[2] numero1=convierteTipo(numero1) numero2=convierteTipo(numero2) return funcion(args[0], numero1, numero2) else: print('Error: numero de argumentos invalido') return False return validar def convierteTipo(variable): if type(variable) == float: try: variable=int(round(variable)) except Exception as e: print('Error: ', e) elif type(variable) == str: try: variable=int(variable) except Exception as e: print('Error: ', e) elif type(variable) == int: pass else: print('Error: los argumentos deben str, float o int') print('variable: ',type(variable)) return False return variable class Fraccion: """esta clase va a manejar las fracciones""" atributoComun='xxx' @validaEntero def __init__(self, numerador, denominador): self.numerador = numerador self.denominador = denominador def __str__(self): return str(self.numerador) + "/" + str(self.denominador) def sumar(self, otraFraccion): if self.denominador == otraFraccion.denominador: nuevoNumerador = self.numerador + otraFraccion.numerador nuevoDenominador = self.denominador else: nuevoDenominador=self.mcm(self.denominador, otraFraccion.denominador) nuevoNumerador=self.numerador*(nuevoDenominador/self.denominador) + otraFraccion.numerador*(nuevoDenominador/otraFraccion.denominador) return Fraccion(nuevoNumerador, nuevoDenominador) def restar(self, otraFraccion): if self.denominador == otraFraccion.denominador: nuevoNumerador = self.numerador - otraFraccion.numerador nuevoDenominador = self.denominador else: nuevoDenominador=self.mcm(self.denominador, otraFraccion.denominador) nuevoNumerador=self.numerador*(nuevoDenominador/self.denominador) - otraFraccion.numerador*(nuevoDenominador/otraFraccion.denominador) return Fraccion(nuevoNumerador, nuevoDenominador) def mcm(self,numero1, numero2): lista1=[] lista2=[] vacia=True for i in range(1,10): lista1.append(numero1*i) lista2.append(numero2*i) lista1.sort() for numero in lista1: if numero in lista2: vacia = False return numero if vacia == True: return numero1*numero2 @validaEntero def MCD(self,numero1, numero2): lista1=[] lista2=[] lista3=[] for i in range(1,numero1+1): if numero1%i==0: lista1.append(i) for i in range(1,numero2+1): if numero2%i==0: lista2.append(i) for numero in lista1: if numero in lista2: lista3.append(numero) return max(lista3) def simplificar(self): MCD=self.MCD(self.numerador, self.denominador) return Fraccion(self.numerador/MCD, self.denominador/MCD) def multiplicar(self, otraFraccion): pass def dividir(self, otraFraccion): pass def carga(): fraccion=input('ingrese la fraccion separada por ,: ') numeros=fraccion.split(',') numerador=numeros[0] denominador=numeros[1] return Fraccion(numerador, denominador) fraccion1=carga() fraccion2=carga() print(fraccion1) print(fraccion2) print(fraccion1.restar(fraccion2)) fraccion3=fraccion1.sumar(fraccion2) print(fraccion3) print(fraccion3.simplificar())
_asmm_version = '1.3.2' _xml_version = '1.0b' _py_version = '3.5.1' _eclipse_version = '4.6.3' _qt_version = '5.9' _report_version = '3.4.0'
a = int(input("a :")) b = int(input("b :")) c = int(input("c :")) delta = (b**2) - (4*a*c) print(delta)
def test_hello_svc_without_param(hello_svc_client): """ Given: hello svc running on cluster And: I have cluster ip address And: I have service port When: I do a get call Then: I should get back 200 Ok And: I should get back string Hi there, !" """ status, response = hello_svc_client.get() assert status == 200 assert response == f"Hi there, !" def test_hello_svc_with_param(hello_svc_client): """ Given: hello svc running on cluster And: I have cluster ip address And: I have service port When: I do a get call with string parameter Then: I should get back 200 Ok And: I should get back string Hi there, <param>!" """ name = "pradeep" status, response = hello_svc_client.get(name=name) assert status == 200 assert response == f"Hi there, {name}!"
class Solution: # Count Consecutive Groups (Top Voted), O(n) time and space def countBinarySubstrings(self, s: str) -> int: s = list(map(len, s.replace('01', '0 1').replace('10', '1 0').split())) return sum(min(a, b) for a, b in zip(s, s[1:])) # Linear Scan (Solution), O(n) time, O(1) space def countBinarySubstrings(self, s: str) -> int: ans, prev, cur = 0, 0, 1 for i in range(1, len(s)): if s[i-1] != s[i]: ans += min(prev, cur) prev, cur = cur, 1 else: cur += 1 return ans + min(prev, cur)
# class FmeRenderer(object): RENDER_MODE_CONSOLE = 1 RENDER_MODE_GRAPH = 2 def __init__(self, render_mode=RENDER_MODE_CONSOLE): self.name = 'apps.fme.FmeRender' self.render_mode = render_mode def render_obs(self, obs): pass
# Set options for certfile, ip, password, and toggle off c.NotebookApp.certfile = '/tmp/mycert.pem' c.NotebookApp.keyfile = '/tmp/mykey.key' # Set ip to '*' to bind on all interfaces (ips) for the public server c.NotebookApp.ip = '*' # It is a good idea to set a known, fixed port for server access c.NotebookApp.port = 8888 c.NotebookApp.open_browser = False
class Solution: def canJump(self, nums: List[int]) -> bool: maxlen = 0 i = 0 while i <= maxlen and i < len(nums): maxlen = max(maxlen, i + nums[i]) i += 1 if maxlen >= len(nums) - 1: return True return False
class MomentumGradientDescent(GradientDescent): def __init__(self, params, lr=0.1, momentum=.9): super(MomentumGradientDescent, self).__init__(params, lr) self.momentum = momentum self.velocities = [torch.zeros_like(param, requires_grad=False) for param in params] def step(self): with torch.no_grad(): for i, (param, velocity) in enumerate(zip(self.params, self.velocities)): velocity = self.momentum * velocity + param.grad param -= self.lr * velocity self.velocities[i] = velocity
self.description = "Install a package with a missing dependency (nodeps)" p = pmpkg("dummy") p.files = ["bin/dummy", "usr/man/man1/dummy.1"] p.depends = ["dep1"] self.addpkg(p) self.args = "-Udd %s" % p.filename() self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_EXIST=dummy") self.addrule("PKG_DEPENDS=dummy|dep1") for f in p.files: self.addrule("FILE_EXIST=%s" % f)
"""Loads the atlas library""" # Sanitize a dependency so that it works correctly from code that includes # Apollo as a submodule. def clean_dep(dep): return str(Label(dep)) # Installed via atlas-dev def repo(): # atlas native.new_local_repository( name = "atlas", build_file = clean_dep("//third_party/atlas:atlas.BUILD"), path = "/usr/include", # /usr/include/$(uname -m)-linux-gnu )
# dictionary fundamentals alien_0 = {'color': 'green', 'points': 5} print(alien_0['color']) print(alien_0['points']) # assigning a dictionary value to a variable new_points = alien_0['points'] print("You just earn " + str(new_points) + " points!") # adding more values to a dictionary # original dict print(alien_0) alien_0['x_position'] = 0 alien_0['y_position'] = 25 # new dict print(alien_0) # starting with an empty dict alien_o = {} alien_o['color'] = 'green' alien_o['points'] = 5 print(alien_o) # modifying values in a dict alien_o = {'color': 'green'} print("The alien is " + alien_o['color'] + ".") alien_o['color'] = 'yellow' print("The alien is now " + alien_o['color'] + ".") # alien update dict alien_o = {'x_position': 0, 'y_position': 25, 'speed': 'medium'} print("Original x-position: " + str(alien_o['x_position'])) # Move the alien to the right. # Determine how far to move the alien based on its current speed. if alien_o['speed'] == 'slow': x_increment = 1 elif alien_o['speed'] == 'medium': x_increment = 2 else: # This is a fast alien. x_increment = 3 # The new position is the old position plus the increment. alien_o['x_position'] = alien_o['x_position'] + x_increment print("New x-position: " + str(alien_o['x_position'])) # removing key value pairs from dict alien_o = {'color': 'green', 'points': 5} print(alien_o) del alien_o['points'] print(alien_o)
# Changes - 7/25/01 - RDS # -Added 'label' item to Menu and MenuItem definitions. # -StaticText.label => StaticText.text # { 'application': { 'type':'Application', 'name':'SourceForgeTracker', 'menubar': { 'type':'MenuBar', 'menus': [ {'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ {'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit\tAlt+X', 'command':'exit'} ] } ] }, 'backgrounds': [ { 'type':'Background', 'name':'bgTracker', 'title':'SourceForge Tracker', 'size':( 400, 500 ), 'components': [ {'type':'StaticLine', 'name':'staticMenuUnderline', 'position':( 0, 0 ), 'size':( 500, -1 ) }, { 'type':'StaticText', 'name':'staticStatus', 'position':( 280, 40 ), 'size':(100, -1), 'text':'', 'alignment':'right' }, { 'type':'Button', 'name':'buttonDownload', 'label':'Update Local Copy', 'position':( 270, 5 ) }, { 'type':'Choice', 'name':'choiceGroups', 'position':( 10, 5 ), 'items':['PyChecker', 'PyCrust', 'Python', 'PythonCard', 'wxPython'], 'stringSelection':'PythonCard' }, { 'type':'Choice', 'name':'choiceCategories', 'position':( 130, 5 ), 'items':['Bug Reports', 'Feature Requests'], 'stringSelection':'Bug Reports'}, { 'type':'StaticText', 'name':'staticTopics', 'position':( 5, 40 ), 'text':'Topics' }, { 'type':'List', 'name':'topicList', 'position':( 0, 55 ), 'size':( 390, 115 ) }, { 'type':'StaticText', 'name':'staticDetail', 'position':( 5, 185 ), 'text':'Details' }, { 'type':'TextArea', 'name':'topicDetail', 'position':( 0, 200 ), 'size':( 390, 250 ), 'editable':0 } ] } ] } }
class NoFreeRobots(Exception): pass class UnavailableRobot(Exception): pass
# Bit Manipulation # Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. # # Example: # # Input: [1,2,1,3,2,5] # Output: [3,5] # Note: # # The order of the result is not important. So in the above example, [5, 3] is also correct. # Your algorithm should run in linear runtime complexity. Could you implement it using only constant space complexity? class Solution(object): def singleNumber(self, nums): """ :type nums: List[int] :rtype: List[int] """ numSet = set() for x in nums: if x not in numSet: numSet.add(x) else: numSet.remove(x) return list(numSet)
expected_output = { "slot": { "1": { "ip_version": { "IPv4": { "route_table": { "default/base": { "prefix": { "1.1.1.1/32": { "next_hop": { "1.1.1.1": { "interface": "loopback0", "is_best": True } } }, "1.1.1.2/32": { "next_hop": { "1.1.1.2": { "interface": "loopback1", "is_best": False } } }, "2.2.2.2/32": { "next_hop": { "fe80::a111:2222:3333:e11": { "interface": "Ethernet1/1", "is_best": False } } }, "3.3.3.2/32": { "next_hop": { "fe80::a111:2222:3333:e11": { "interface": "Ethernet1/1", "is_best": False } } }, "4.4.4.2/32": { "next_hop": { "fe80::a111:2222:3333:e11": { "interface": "Ethernet1/1", "is_best": False } } } } } } } } } } }
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Defines classes related to 2D polygons. """ class Vertex: def __init__(self, coordinates, **kwargs): self.coordinates = coordinates if 'prev' in kwargs: self.set_prev(kwargs['prev']) if 'next' in kwargs: self.set_next(kwargs['next']) def x(self): return self.coordinates[0] def y(self): return self.coordinates[1] def set_next(self, vertex): if type(vertex) != type(self): raise TypeError('Cannot point to a non-Vertex type.') self.next = vertex def next_vertex(self): """Return the next clockwise vertex in its corresponding polygon. """ return self.next def set_prev(self, vertex): if type(vertex) != type(self): raise TypeError('Cannot point to a non-Vertex type.') self.prev = vertex def prev_vertex(self): """Return the previous clockwise vertex in its corresponding polygon. """ return self.prev def __repr__(self): return '<Vertex {}>'.format(str(self)) def __str__(self): return '({:.2f}, {:.2f})'.format(*self.coordinates) class PolygonIter: def __init__(self, polygon_ref, index): self.polygon = polygon_ref self.direction = 1 self.index = 0 self.index = self._advance(index) def reverse_direction(self): self.direction *= -1 def get_value(self): return self.polygon.get_vertex_at(self.index) def get_index(self): return self.index def get_next_iterator(self): next_iter = PolygonIter(self.polygon, self.index + self.direction) next_iter.direction = self.direction return next_iter def __iter__(self): return self def _advance(self, skips): return_index = self.index + skips if (return_index >= len(self.polygon.vertices) or return_index <= -1): raise IndexError('Cannot advance beyond bounds of corresponding ' 'polygon vertices container.') return return_index def __next__(self): next_iter = PolygonIter(self.polygon, self.index) next_iter.direction = self.direction self.index = self._advance(self.direction) return next_iter def __sub__(self, rhs): return self.index - rhs.index def __add__(self, rhs): return self.index + rhs.index def __eq__(self, rhs): return self.index == rhs.index def __repr__(self): return str(self.polygon.get_vertex_at(self.index)) def __str__(self): return str(self.polygon.get_vertex_at(self.index)) class Polygon: def __init__(self, vertices): """Vertices are connected by line segments in clockwise order to represent a convex polygon. """ self.vertices = [] for v in vertices: self.vertices.append(Vertex(v)) for i in range(len(self.vertices)): self.vertices[i - 1].set_next(self.vertices[i]) self.vertices[i].set_prev(self.vertices[i - 1]) def __repr__(self): return '->'.join([str(v) for v in self.vertices]) def get_iterator(self, index=0): return PolygonIter(self, index) def get_iterator_wrapped_in_bounds(self, index): if index <= -1: iter_index = -index iter_index %= len(self.vertices) return self.get_iterator(index=len(self.vertices) - iter_index) return self.get_iterator(index=index % len(self.vertices)) def get_front_iterator(self): return self.get_iterator(index=0) def get_back_iterator(self): return self.get_iterator(index=len(self.vertices) - 1) def get_vertex_at(self, index): return self.vertices[index] def __iter__(self): return PolygonIter(self, 0) def __reversed__(self): iterator = PolygonIter(self, 0) iterator.reverse_direction() return iterator def plot(self, mplib_axes): xs = [v.x() for v in self.vertices] + [self.vertices[0].x()] ys = [v.y() for v in self.vertices] + [self.vertices[0].y()] mplib_axes.plot(xs, ys, 'o-') return mplib_axes def _search_vertex(self, comparator, start=0, end=None): """Retrieve a vertex that is the "most" of a property that can be extracted per vertex with the comparator. Will use start and end as index values and search in the interval [start, end]. Args: self: Polygon in question. comparator: Function that compares two vertices to create a strict lexical ordering. Must return a boolean value. start: Index into vertex array to begin search. end: Index into vertex array to end search. Returns: Polygon iterator to vertex within vertex array. """ if end is None: end = start + len(self.vertices) - 1 largest_lexical_value = self.get_iterator(index=start) for index in range(start, end): if comparator(self.vertices[index], largest_lexical_value.get_value()): largest_lexical_value = self.get_iterator(index=index) return largest_lexical_value def get_top_vertex(self): """Retrieve vertex with the max y-value of all vertices in polygon. Will use start and end as index values and search in the interval [start, end]. Args: self: Polygon in question. start: Index into vertex array to begin search. end: Index into vertex array to end search. Returns: Polygon iterator to vertex within vertex array. """ return self._search_vertex(lambda v0, v1: v0.y() > v1.y()) def get_bottom_vertex(self): """Retrieve vertex with the min y-value of all vertices in polygon. Will use start and end as index values and search in the interval [start, end]. Args: self: Polygon in question. start: Index into vertex array to begin search. end: Index into vertex array to end search. Returns: Polygon iterator to vertex within vertex array. """ return self._search_vertex(lambda v0, v1: v0.y() < v1.y()) class ConvexPolygon(Polygon): """This class encapsulates properties convex polygons posess in the most efficient runtime complexity possible. Class methods should perform actions in-place.""" def _search_vertex(self, comparator, start=0, end=None): """Retrieve vertex to exploit convexity within the polygon's vertex search space. Will use start and end as index values and search in the interval [start, end]. Args: self: Polygon in question. comparator: Function that compares the middle vertex with its neighbors. Must return a boolean value. start: Index into vertex array to begin search. end: Index into vertex array to end search. Returns: Polygon iterator to vertex within vertex array. """ if end is None: end = start + len(self.vertices) - 1 if start == end: return self.get_iterator(index=start) if start - end == 1: if comparator(self.vertices[start], self.vertices[end]): return self.get_iterator(index=start) else: return self.get_iterator(index=end) mid = start + int((end - start) / 2.0) mid_vtx = self.vertices[mid] after_mid_vtx = self.vertices[mid + 1] before_mid_vtx = self.vertices[mid - 1] if comparator(after_mid_vtx, mid_vtx): return self._search_vertex(comparator, start=mid + 1, end=end) elif comparator(before_mid_vtx, mid_vtx): return self._search_vertex(comparator, start=start, end=mid - 1) else: return self.get_iterator(index=mid)
{ "targets": [ { "target_name": "readpath", "sources": [ "src/dirread.cc", "src/async.cc" ], "include_dirs" : [ "<!(node -e \"require('nan')\")" ] } ], }
class TrieNode: def __init__(self): self.children: Dict[str, TrieNode] = defaultdict(TrieNode) self.word: Optional[str] = None class Solution: def findWords(self, board: List[List[str]], words: List[str]) -> List[str]: m = len(board) n = len(board[0]) ans = [] root = TrieNode() def insert(word: str) -> None: node = root for c in word: if c not in node.children: node.children[c] = TrieNode() node = node.children[c] node.word = word for word in words: insert(word) def dfs(i: int, j: int, node: TrieNode) -> None: if i < 0 or i == m or j < 0 or j == n: return if board[i][j] == '*': return c = board[i][j] if c not in node.children: return child = node.children[c] if child.word: ans.append(child.word) child.word = None board[i][j] = '*' dfs(i + 1, j, child) dfs(i - 1, j, child) dfs(i, j + 1, child) dfs(i, j - 1, child) board[i][j] = c for i in range(m): for j in range(n): dfs(i, j, root) return ans
# This is a list of modules which are not required to build # in order to test out this extension. Mostly useful for CI. module_arkit_enabled = "no" module_assimp_enabled = "no" module_fbx_enabled = "no" module_bmp_enabled = "no" module_bullet_enabled = "no" module_camera_enabled = "no" module_csg_enabled = "no" module_cvtt_enabled = "no" module_dds_enabled = "no" module_enet_enabled = "no" module_etc_enabled = "no" module_gdnative_enabled = "yes" # Required by GUT tests. module_gridmap_enabled = "no" module_hdr_enabled = "no" module_jpg_enabled = "no" module_jsonrpc_enabled = "no" module_mobile_vr_enabled = "no" module_mono_enabled = "no" module_ogg_enabled = "no" module_opensimplex_enabled = "no" module_opus_enabled = "no" module_pvr_enabled = "no" module_recast_enabled = "no" module_squish_enabled = "no" module_stb_vorbis_enabled = "no" module_tga_enabled = "no" module_theora_enabled = "no" module_tinyexr_enabled = "no" module_upnp_enabled = "no" module_vhacd_enabled = "no" module_visual_script_enabled = "no" module_vorbis_enabled = "no" module_webm_enabled = "no" module_webp_enabled = "no" module_webrtc_enabled = "yes" # Required by GDNative. module_websocket_enabled = "no" module_xatlas_unwrap_enabled = "no"
class LegMovement(object): """Represents a leg movement.""" def __init__(self): """Initializes a new instance of the LegMovement class.""" self.empty = False self.coxa = 0.0 self.tibia = 0.0 self.femur = 0.0 self.coxaSpeed = 0.0 self.tibiaSpeed = 0.0 self.femurSpeed = 0.0 self.maxExecTime = 0.0 self.IKCoordinates = [0, 0, 0]
"""Problem 009 A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. """ ans = next(a * b * c for a in range(1, 500) for b in range(1, 500) for c in range(1, 500) if a < b < c and a**2 + b**2 == c**2 and a + b + c == 1000) print(ans)
TEST_DATA = [( 'donation_page', 'https://adblockplus.org/donate', ), ( 'update_page', 'https://new.adblockplus.org/update', ), ( 'first_run_page', 'https://welcome.adblockplus.org/installed' )]
casa = float(input('Valor da casa: R$ ')) salario = float(input('Salário do comprador: R$')) anos = int(input('Quantos anos de financiamento ? ')) prestacao = casa / (anos * 12) minimo = salario * 30 / 100 if prestacao <= minimo: print('Para pagar uma casa de R${:.2f} em {} anos a prestação será de R${:.2f}'.format(casa, anos, prestacao)) print('Empréstimo CONCEDIDO!') else: print('Para pagar uma casa de R${:.2f} em {} anos a prestação será de R${:.2f}'.format(casa, anos, prestacao)) print('Empréstimo NEGADO!')
""" Author: Ramiz Raja Created on: 29/02/2020 """ def fibonnoci_sum(): rangeEnd = 10_000 prev_prev_fibonnoci = 0 prev_fibonnoci = 1 total_sum = 1 next_fibonnoci = 1 while next_fibonnoci < rangeEnd: if next_fibonnoci % 2 != 0: total_sum += next_fibonnoci prev_prev_fibonnoci = prev_fibonnoci prev_fibonnoci = next_fibonnoci next_fibonnoci = prev_prev_fibonnoci + prev_fibonnoci return total_sum result = fibonnoci_sum() print(result) # def is_palindrome(numberStr): # numberStr = numberStr.lower() # return numberStr == numberStr[::-1] # # def palindrome_sum(): # p_sum = 0 # for n in range(10_000): # if is_palindrome(str(n)): # p_sum += n # # return p_sum # # # # result = palindrome_sum() # print(result)
set_name(0x800A2AB8, "VID_OpenModule__Fv", SN_NOWARN) set_name(0x800A2B78, "InitScreens__Fv", SN_NOWARN) set_name(0x800A2C68, "MEM_SetupMem__Fv", SN_NOWARN) set_name(0x800A2C94, "SetupWorkRam__Fv", SN_NOWARN) set_name(0x800A2D24, "SYSI_Init__Fv", SN_NOWARN) set_name(0x800A2E30, "GM_Open__Fv", SN_NOWARN) set_name(0x800A2E54, "PA_Open__Fv", SN_NOWARN) set_name(0x800A2E8C, "PAD_Open__Fv", SN_NOWARN) set_name(0x800A2ED0, "OVR_Open__Fv", SN_NOWARN) set_name(0x800A2EF0, "SCR_Open__Fv", SN_NOWARN) set_name(0x800A2F20, "DEC_Open__Fv", SN_NOWARN) set_name(0x800A3194, "GetVersionString__FPc", SN_NOWARN) set_name(0x800A3268, "GetWord__FPc", SN_NOWARN) set_name(0x800A2F44, "StrDate", SN_NOWARN) set_name(0x800A2F50, "StrTime", SN_NOWARN) set_name(0x800A2F5C, "Words", SN_NOWARN) set_name(0x800A3134, "MonDays", SN_NOWARN)
#Nicolas Andrade de Freitas - Turma 2190 #Exercicio 22 j = float(input("Digite o valor em jardas")) m = j*0.91 print("o valor {} jardas em metros é de:{}".format(j,m))
class SpatialElementTag(Element, IDisposable): """ A tag attached to an SpatialElement (room,space or area) in Autodesk Revit. """ def Dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def getBoundingBox(self, *args): """ getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """ pass def ReleaseUnmanagedResources(self, *args): """ ReleaseUnmanagedResources(self: Element,disposing: bool) """ pass def setElementType(self, *args): """ setElementType(self: Element,type: ElementType,incompatibleExceptionMessage: str) """ pass def __enter__(self, *args): """ __enter__(self: IDisposable) -> object """ pass def __exit__(self, *args): """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass HasLeader = property(lambda self: object(), lambda self, v: None, lambda self: None) """Identifies if a leader is displayed for the tag or not. Get: HasLeader(self: SpatialElementTag) -> bool Set: HasLeader(self: SpatialElementTag)=value """ IsOrphaned = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Identifies if the tag is orphaned or not. Get: IsOrphaned(self: SpatialElementTag) -> bool """ IsTaggingLink = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Identifies if the tag has reference to an object in a linked document or not. Get: IsTaggingLink(self: SpatialElementTag) -> bool """ LeaderElbow = property( lambda self: object(), lambda self, v: None, lambda self: None ) """The position of the leader's elbow (middle point). Get: LeaderElbow(self: SpatialElementTag) -> XYZ Set: LeaderElbow(self: SpatialElementTag)=value """ LeaderEnd = property(lambda self: object(), lambda self, v: None, lambda self: None) """The position of the leader's end. Get: LeaderEnd(self: SpatialElementTag) -> XYZ Set: LeaderEnd(self: SpatialElementTag)=value """ Location = property(lambda self: object(), lambda self, v: None, lambda self: None) """The location of the tag. Get: Location(self: SpatialElementTag) -> Location """ Name = property(lambda self: object(), lambda self, v: None, lambda self: None) """The name associated with the tag. Set: Name(self: SpatialElementTag)=value """ TagHeadPosition = property( lambda self: object(), lambda self, v: None, lambda self: None ) """The position of the tag's head. Get: TagHeadPosition(self: SpatialElementTag) -> XYZ Set: TagHeadPosition(self: SpatialElementTag)=value """ TagOrientation = property( lambda self: object(), lambda self, v: None, lambda self: None ) """The orientation of the tag. Get: TagOrientation(self: SpatialElementTag) -> SpatialElementTagOrientation Set: TagOrientation(self: SpatialElementTag)=value """ View = property(lambda self: object(), lambda self, v: None, lambda self: None) """The view in which the tag was placed. Get: View(self: SpatialElementTag) -> View """
# basic stack implementation # author: D1N3SHh # https://github.com/D1N3SHh/algorithms class StackOverflowError(BaseException): pass class StackEmptyError(BaseException): pass class Stack(): def __init__(self, max_size = 10): self.max_size = max_size self.s = [] def __repr__(self): return str(self.s) def push(self, x): if len(self.s) < self.max_size: self.s.append(x) else: raise StackOverflowError def pop(self): if len(self.s) > 0: self.s.pop(-1) else: raise StackEmptyError def peek(self): x = self.s[-1] self.pop() return x def example_usage(): stack = Stack(5) # [] stack.push(1111) # [1111] stack.push(2222) # [1111, 2222] stack.push(3333) # [1111, 2222, 3333] print('Stack:', stack) print('Peek:', stack.peek()) # [1111, 2222] stack.push(4444) # [1111, 2222, 4444] print('Stack:', stack) if __name__ == "__main__": example_usage() # run an example on start
class UniquenessError(ValueError): def __init__(self, index_name): ValueError.__init__(self, index_name) class NotFoundError(KeyError): pass
""" The module implements exceptions for Zserio python runtime library. """ class PythonRuntimeException(Exception): """ Exception thrown in case of an error in Zserio python runtime library. """
#Crie um programa que leia um número inteiro e mostre na tela se ele é PAR ou ÍMPAR. while True: num = input('Digite um número inteiro: ') try: num = int(num) except: print('Valor inválido, tente novamente!') else: break if(num % 2 == 0): print(f'O número {num} é par') else: print(f'O número {num} é ímpar')
# encoding: utf-8 # module System.Collections.Generic calls itself Generic # from mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 # by generator 1.145 # no doc # no imports # no functions # classes class Comparer(object, IComparer, IComparer[T]): # no doc def Compare(self, x, y): """ Compare(self: Comparer[T], x: T, y: T) -> int """ pass @staticmethod def Create(comparison): """ Create(comparison: Comparison[T]) -> Comparer[T] """ pass def __cmp__(self, *args): #cannot find CLR method """ x.__cmp__(y) <==> cmp(x,y) """ pass def __init__(self, *args): #cannot find CLR method """ 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 def __reduce_ex__(self, *args): #cannot find CLR method pass def __repr__(self, *args): #cannot find CLR method """ __repr__(self: object) -> str """ pass class Dictionary(object, IDictionary[TKey, TValue], ICollection[KeyValuePair[TKey, TValue]], IEnumerable[KeyValuePair[TKey, TValue]], IEnumerable, IDictionary, ICollection, IReadOnlyDictionary[TKey, TValue], IReadOnlyCollection[KeyValuePair[TKey, TValue]], ISerializable, IDeserializationCallback): """ Dictionary[TKey, TValue]() Dictionary[TKey, TValue](capacity: int) Dictionary[TKey, TValue](comparer: IEqualityComparer[TKey]) Dictionary[TKey, TValue](capacity: int, comparer: IEqualityComparer[TKey]) Dictionary[TKey, TValue](dictionary: IDictionary[TKey, TValue]) Dictionary[TKey, TValue](dictionary: IDictionary[TKey, TValue], comparer: IEqualityComparer[TKey]) """ def Add(self, key, value): """ Add(self: Dictionary[TKey, TValue], key: TKey, value: TValue) """ pass def Clear(self): """ Clear(self: Dictionary[TKey, TValue]) """ pass def ContainsKey(self, key): """ ContainsKey(self: Dictionary[TKey, TValue], key: TKey) -> bool """ pass def ContainsValue(self, value): """ ContainsValue(self: Dictionary[TKey, TValue], value: TValue) -> bool """ pass def GetEnumerator(self): """ GetEnumerator(self: Dictionary[TKey, TValue]) -> Enumerator """ pass def GetObjectData(self, info, context): """ GetObjectData(self: Dictionary[TKey, TValue], info: SerializationInfo, context: StreamingContext) """ pass def OnDeserialization(self, sender): """ OnDeserialization(self: Dictionary[TKey, TValue], sender: object) """ pass def Remove(self, key): """ Remove(self: Dictionary[TKey, TValue], key: TKey) -> bool """ pass def TryGetValue(self, key, value): """ TryGetValue(self: Dictionary[TKey, TValue], key: TKey) -> (bool, TValue) """ pass def __add__(self, *args): #cannot find CLR method """ x.__add__(y) <==> x+y """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__(self: IDictionary[TKey, TValue], key: TKey) -> bool __contains__(self: IDictionary, key: object) -> bool """ pass def __getitem__(self, *args): #cannot find CLR method """ x.__getitem__(y) <==> x[y] """ pass def __init__(self, *args): #cannot find CLR method """ 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 def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass def __len__(self, *args): #cannot find CLR method """ x.__len__() <==> len(x) """ pass @staticmethod # known case of __new__ def __new__(self, *__args): """ __new__(cls: type) __new__(cls: type, capacity: int) __new__(cls: type, comparer: IEqualityComparer[TKey]) __new__(cls: type, capacity: int, comparer: IEqualityComparer[TKey]) __new__(cls: type, dictionary: IDictionary[TKey, TValue]) __new__(cls: type, dictionary: IDictionary[TKey, TValue], comparer: IEqualityComparer[TKey]) __new__(cls: type, info: SerializationInfo, context: StreamingContext) """ pass def __reduce_ex__(self, *args): #cannot find CLR method pass def __repr__(self, *args): #cannot find CLR method """ __repr__(self: Dictionary[TKey, TValue]) -> str __repr__(self: Dictionary[K, V]) -> str """ pass def __setitem__(self, *args): #cannot find CLR method """ x.__setitem__(i, y) <==> x[i]= """ pass Comparer = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Comparer(self: Dictionary[TKey, TValue]) -> IEqualityComparer[TKey] """ Count = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Count(self: Dictionary[TKey, TValue]) -> int """ Keys = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Keys(self: Dictionary[TKey, TValue]) -> KeyCollection """ Values = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Values(self: Dictionary[TKey, TValue]) -> ValueCollection """ Enumerator = None KeyCollection = None ValueCollection = None class EqualityComparer(object, IEqualityComparer, IEqualityComparer[T]): # no doc def Equals(self, *__args): """ Equals(self: EqualityComparer[T], x: T, y: T) -> bool """ pass def GetHashCode(self, obj=None): """ GetHashCode(self: EqualityComparer[T], obj: T) -> int """ pass def __eq__(self, *args): #cannot find CLR method """ x.__eq__(y) <==> x==y """ pass def __init__(self, *args): #cannot find CLR method """ 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 def __reduce_ex__(self, *args): #cannot find CLR method pass def __repr__(self, *args): #cannot find CLR method """ __repr__(self: object) -> str """ pass class IAsyncEnumerable: # no doc def GetAsyncEnumerator(self, cancellationToken): """ GetAsyncEnumerator(self: IAsyncEnumerable[T], cancellationToken: CancellationToken) -> IAsyncEnumerator[T] Returns an enumerator that iterates asynchronously through the collection. cancellationToken: A System.Threading.CancellationToken that may be used to cancel the asynchronous iteration. Returns: An enumerator that can be used to iterate asynchronously through the collection. """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass class IAsyncEnumerator(IAsyncDisposable): # no doc def MoveNextAsync(self): """ MoveNextAsync(self: IAsyncEnumerator[T]) -> ValueTask[bool] Advances the enumerator asynchronously to the next element of the collection. Returns: A System.Threading.Tasks.ValueTask that will complete with a result of true if the enumerator was successfully advanced to the next element, or false if the enumerator has passed the end of the collection. """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass Current = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Gets the element in the collection at the current position of the enumerator. Get: Current(self: IAsyncEnumerator[T]) -> T """ class ICollection(IEnumerable[T], IEnumerable): # no doc def Add(self, item): """ Add(self: ICollection[T], item: T) """ pass def Clear(self): """ Clear(self: ICollection[T]) """ pass def Contains(self, item): """ Contains(self: ICollection[T], item: T) -> bool """ pass def CopyTo(self, array, arrayIndex): """ CopyTo(self: ICollection[T], array: Array[T], arrayIndex: int) """ pass def Remove(self, item): """ Remove(self: ICollection[T], item: T) -> bool """ pass def __add__(self, *args): #cannot find CLR method """ x.__add__(y) <==> x+y """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__[T](enumerable: IEnumerable[T], value: T) -> bool """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass Count = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Count(self: ICollection[T]) -> int """ IsReadOnly = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: IsReadOnly(self: ICollection[T]) -> bool """ class IComparer: # no doc def Compare(self, x, y): """ Compare(self: IComparer[T], x: T, y: T) -> int """ pass def __cmp__(self, *args): #cannot find CLR method """ x.__cmp__(y) <==> cmp(x,y) """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass class IDictionary(ICollection[KeyValuePair[TKey, TValue]], IEnumerable[KeyValuePair[TKey, TValue]], IEnumerable): # no doc def Add(self, key, value): """ Add(self: IDictionary[TKey, TValue], key: TKey, value: TValue) """ pass def ContainsKey(self, key): """ ContainsKey(self: IDictionary[TKey, TValue], key: TKey) -> bool """ pass def Remove(self, key): """ Remove(self: IDictionary[TKey, TValue], key: TKey) -> bool """ pass def TryGetValue(self, key, value): """ TryGetValue(self: IDictionary[TKey, TValue], key: TKey) -> (bool, TValue) """ pass def __add__(self, *args): #cannot find CLR method """ x.__add__(y) <==> x+y """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__(self: ICollection[KeyValuePair[TKey, TValue]], item: KeyValuePair[TKey, TValue]) -> bool """ pass def __getitem__(self, *args): #cannot find CLR method """ x.__getitem__(y) <==> x[y] """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass def __len__(self, *args): #cannot find CLR method """ x.__len__() <==> len(x) """ pass def __setitem__(self, *args): #cannot find CLR method """ x.__setitem__(i, y) <==> x[i]= """ pass Keys = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Keys(self: IDictionary[TKey, TValue]) -> ICollection[TKey] """ Values = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Values(self: IDictionary[TKey, TValue]) -> ICollection[TValue] """ class IEnumerable(IEnumerable): # no doc def GetEnumerator(self): """ GetEnumerator(self: IEnumerable[T]) -> IEnumerator[T] """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass class IEnumerator(IDisposable, IEnumerator): # no doc def next(self, *args): #cannot find CLR method """ next(self: object) -> object """ pass def __enter__(self, *args): #cannot find CLR method """ __enter__(self: IDisposable) -> object """ pass def __exit__(self, *args): #cannot find CLR method """ __exit__(self: IDisposable, exc_type: object, exc_value: object, exc_back: object) """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __iter__(self, *args): #cannot find CLR method """ __iter__[T](self: IEnumerator[T]) -> object """ pass Current = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Current(self: IEnumerator[T]) -> T """ class IEqualityComparer: # no doc def Equals(self, x, y): """ Equals(self: IEqualityComparer[T], x: T, y: T) -> bool """ pass def GetHashCode(self, obj): """ GetHashCode(self: IEqualityComparer[T], obj: T) -> int """ pass def __eq__(self, *args): #cannot find CLR method """ x.__eq__(y) <==> x==y """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass class IList(ICollection[T], IEnumerable[T], IEnumerable): # no doc def IndexOf(self, item): """ IndexOf(self: IList[T], item: T) -> int """ pass def Insert(self, index, item): """ Insert(self: IList[T], index: int, item: T) """ pass def RemoveAt(self, index): """ RemoveAt(self: IList[T], index: int) """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__(self: ICollection[T], item: T) -> bool """ pass def __getitem__(self, *args): #cannot find CLR method """ x.__getitem__(y) <==> x[y] """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass def __len__(self, *args): #cannot find CLR method """ x.__len__() <==> len(x) """ pass def __setitem__(self, *args): #cannot find CLR method """ x.__setitem__(i, y) <==> x[i]= """ pass class IReadOnlyCollection(IEnumerable[T], IEnumerable): # no doc def __contains__(self, *args): #cannot find CLR method """ __contains__[T](enumerable: IEnumerable[T], value: T) -> bool """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass Count = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Count(self: IReadOnlyCollection[T]) -> int """ class IReadOnlyDictionary(IReadOnlyCollection[KeyValuePair[TKey, TValue]], IEnumerable[KeyValuePair[TKey, TValue]], IEnumerable): # no doc def ContainsKey(self, key): """ ContainsKey(self: IReadOnlyDictionary[TKey, TValue], key: TKey) -> bool """ pass def TryGetValue(self, key, value): """ TryGetValue(self: IReadOnlyDictionary[TKey, TValue], key: TKey) -> (bool, TValue) """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__[KeyValuePair`2](enumerable: IEnumerable[KeyValuePair[TKey, TValue]], value: KeyValuePair[TKey, TValue]) -> bool """ pass def __getitem__(self, *args): #cannot find CLR method """ x.__getitem__(y) <==> x[y] """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass Keys = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Keys(self: IReadOnlyDictionary[TKey, TValue]) -> IEnumerable[TKey] """ Values = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Values(self: IReadOnlyDictionary[TKey, TValue]) -> IEnumerable[TValue] """ class IReadOnlyList(IReadOnlyCollection[T], IEnumerable[T], IEnumerable): # no doc def __contains__(self, *args): #cannot find CLR method """ __contains__[T](enumerable: IEnumerable[T], value: T) -> bool """ pass def __getitem__(self, *args): #cannot find CLR method """ x.__getitem__(y) <==> x[y] """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass class ISet(ICollection[T], IEnumerable[T], IEnumerable): # no doc def Add(self, item): """ Add(self: ISet[T], item: T) -> bool """ pass def ExceptWith(self, other): """ ExceptWith(self: ISet[T], other: IEnumerable[T]) """ pass def IntersectWith(self, other): """ IntersectWith(self: ISet[T], other: IEnumerable[T]) """ pass def IsProperSubsetOf(self, other): """ IsProperSubsetOf(self: ISet[T], other: IEnumerable[T]) -> bool """ pass def IsProperSupersetOf(self, other): """ IsProperSupersetOf(self: ISet[T], other: IEnumerable[T]) -> bool """ pass def IsSubsetOf(self, other): """ IsSubsetOf(self: ISet[T], other: IEnumerable[T]) -> bool """ pass def IsSupersetOf(self, other): """ IsSupersetOf(self: ISet[T], other: IEnumerable[T]) -> bool """ pass def Overlaps(self, other): """ Overlaps(self: ISet[T], other: IEnumerable[T]) -> bool """ pass def SetEquals(self, other): """ SetEquals(self: ISet[T], other: IEnumerable[T]) -> bool """ pass def SymmetricExceptWith(self, other): """ SymmetricExceptWith(self: ISet[T], other: IEnumerable[T]) """ pass def UnionWith(self, other): """ UnionWith(self: ISet[T], other: IEnumerable[T]) """ pass def __add__(self, *args): #cannot find CLR method """ x.__add__(y) <==> x+y """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__(self: ICollection[T], item: T) -> bool """ pass def __init__(self, *args): #cannot find CLR method """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass def __len__(self, *args): #cannot find CLR method """ x.__len__() <==> len(x) """ pass class KeyNotFoundException(SystemException, ISerializable, _Exception): """ KeyNotFoundException() KeyNotFoundException(message: str) KeyNotFoundException(message: str, innerException: Exception) """ def __init__(self, *args): #cannot find CLR method """ 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 @staticmethod # known case of __new__ def __new__(self, message=None, innerException=None): """ __new__(cls: type) __new__(cls: type, message: str) __new__(cls: type, message: str, innerException: Exception) __new__(cls: type, info: SerializationInfo, context: StreamingContext) """ pass def __reduce_ex__(self, *args): #cannot find CLR method pass def __str__(self, *args): #cannot find CLR method pass SerializeObjectState = None class KeyValuePair(object): """ KeyValuePair[TKey, TValue](key: TKey, value: TValue) """ def ToString(self): """ ToString(self: KeyValuePair[TKey, TValue]) -> str """ pass @staticmethod # known case of __new__ def __new__(self, key, value): """ __new__[KeyValuePair`2]() -> KeyValuePair[TKey, TValue] __new__(cls: type, key: TKey, value: TValue) """ pass Key = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Key(self: KeyValuePair[TKey, TValue]) -> TKey """ Value = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Value(self: KeyValuePair[TKey, TValue]) -> TValue """ class LinkedList(object, ICollection[T], IEnumerable[T], IEnumerable, ICollection, IReadOnlyCollection[T], ISerializable, IDeserializationCallback): """ LinkedList[T]() LinkedList[T](collection: IEnumerable[T]) """ def AddAfter(self, node, *__args): """ AddAfter(self: LinkedList[T], node: LinkedListNode[T], newNode: LinkedListNode[T])AddAfter(self: LinkedList[T], node: LinkedListNode[T], value: T) -> LinkedListNode[T] """ pass def AddBefore(self, node, *__args): """ AddBefore(self: LinkedList[T], node: LinkedListNode[T], value: T) -> LinkedListNode[T] AddBefore(self: LinkedList[T], node: LinkedListNode[T], newNode: LinkedListNode[T]) """ pass def AddFirst(self, *__args): """ AddFirst(self: LinkedList[T], value: T) -> LinkedListNode[T] AddFirst(self: LinkedList[T], node: LinkedListNode[T]) """ pass def AddLast(self, *__args): """ AddLast(self: LinkedList[T], value: T) -> LinkedListNode[T] AddLast(self: LinkedList[T], node: LinkedListNode[T]) """ pass def Clear(self): """ Clear(self: LinkedList[T]) """ pass def Contains(self, value): """ Contains(self: LinkedList[T], value: T) -> bool """ pass def CopyTo(self, array, index): """ CopyTo(self: LinkedList[T], array: Array[T], index: int) """ pass def Find(self, value): """ Find(self: LinkedList[T], value: T) -> LinkedListNode[T] """ pass def FindLast(self, value): """ FindLast(self: LinkedList[T], value: T) -> LinkedListNode[T] """ pass def GetEnumerator(self): """ GetEnumerator(self: LinkedList[T]) -> Enumerator """ pass def GetObjectData(self, info, context): """ GetObjectData(self: LinkedList[T], info: SerializationInfo, context: StreamingContext) """ pass def OnDeserialization(self, sender): """ OnDeserialization(self: LinkedList[T], sender: object) """ pass def Remove(self, *__args): """ Remove(self: LinkedList[T], value: T) -> bool Remove(self: LinkedList[T], node: LinkedListNode[T]) """ pass def RemoveFirst(self): """ RemoveFirst(self: LinkedList[T]) """ pass def RemoveLast(self): """ RemoveLast(self: LinkedList[T]) """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__(self: ICollection[T], item: T) -> bool """ pass def __init__(self, *args): #cannot find CLR method """ 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 def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass def __len__(self, *args): #cannot find CLR method """ x.__len__() <==> len(x) """ pass @staticmethod # known case of __new__ def __new__(self, collection=None): """ __new__(cls: type) __new__(cls: type, collection: IEnumerable[T]) __new__(cls: type, info: SerializationInfo, context: StreamingContext) """ pass def __reduce_ex__(self, *args): #cannot find CLR method pass def __repr__(self, *args): #cannot find CLR method """ __repr__(self: object) -> str """ pass Count = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Count(self: LinkedList[T]) -> int """ First = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: First(self: LinkedList[T]) -> LinkedListNode[T] """ Last = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Last(self: LinkedList[T]) -> LinkedListNode[T] """ Enumerator = None class LinkedListNode(object): """ LinkedListNode[T](value: T) """ @staticmethod # known case of __new__ def __new__(self, value): """ __new__(cls: type, value: T) """ pass List = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: List(self: LinkedListNode[T]) -> LinkedList[T] """ Next = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Next(self: LinkedListNode[T]) -> LinkedListNode[T] """ Previous = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Previous(self: LinkedListNode[T]) -> LinkedListNode[T] """ Value = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Value(self: LinkedListNode[T]) -> T Set: Value(self: LinkedListNode[T]) = value """ class List(object, IList[T], ICollection[T], IEnumerable[T], IEnumerable, IList, ICollection, IReadOnlyList[T], IReadOnlyCollection[T]): """ List[T]() List[T](capacity: int) List[T](collection: IEnumerable[T]) """ def Add(self, item): """ Add(self: List[T], item: T) """ pass def AddRange(self, collection): """ AddRange(self: List[T], collection: IEnumerable[T]) """ pass def AsReadOnly(self): """ AsReadOnly(self: List[T]) -> ReadOnlyCollection[T] """ pass def BinarySearch(self, *__args): """ BinarySearch(self: List[T], index: int, count: int, item: T, comparer: IComparer[T]) -> int BinarySearch(self: List[T], item: T) -> int BinarySearch(self: List[T], item: T, comparer: IComparer[T]) -> int """ pass def Clear(self): """ Clear(self: List[T]) """ pass def Contains(self, item): """ Contains(self: List[T], item: T) -> bool """ pass def ConvertAll(self, converter): """ ConvertAll[TOutput](self: List[T], converter: Converter[T, TOutput]) -> List[TOutput] """ pass def CopyTo(self, *__args): """ CopyTo(self: List[T], index: int, array: Array[T], arrayIndex: int, count: int)CopyTo(self: List[T], array: Array[T])CopyTo(self: List[T], array: Array[T], arrayIndex: int) """ pass def Exists(self, match): """ Exists(self: List[T], match: Predicate[T]) -> bool """ pass def Find(self, match): """ Find(self: List[T], match: Predicate[T]) -> T """ pass def FindAll(self, match): """ FindAll(self: List[T], match: Predicate[T]) -> List[T] """ pass def FindIndex(self, *__args): """ FindIndex(self: List[T], match: Predicate[T]) -> int FindIndex(self: List[T], startIndex: int, match: Predicate[T]) -> int FindIndex(self: List[T], startIndex: int, count: int, match: Predicate[T]) -> int """ pass def FindLast(self, match): """ FindLast(self: List[T], match: Predicate[T]) -> T """ pass def FindLastIndex(self, *__args): """ FindLastIndex(self: List[T], match: Predicate[T]) -> int FindLastIndex(self: List[T], startIndex: int, match: Predicate[T]) -> int FindLastIndex(self: List[T], startIndex: int, count: int, match: Predicate[T]) -> int """ pass def ForEach(self, action): """ ForEach(self: List[T], action: Action[T]) """ pass def GetEnumerator(self): """ GetEnumerator(self: List[T]) -> Enumerator """ pass def GetRange(self, index, count): """ GetRange(self: List[T], index: int, count: int) -> List[T] """ pass def IndexOf(self, item, index=None, count=None): """ IndexOf(self: List[T], item: T) -> int IndexOf(self: List[T], item: T, index: int) -> int IndexOf(self: List[T], item: T, index: int, count: int) -> int """ pass def Insert(self, index, item): """ Insert(self: List[T], index: int, item: T) """ pass def InsertRange(self, index, collection): """ InsertRange(self: List[T], index: int, collection: IEnumerable[T]) """ pass def LastIndexOf(self, item, index=None, count=None): """ LastIndexOf(self: List[T], item: T) -> int LastIndexOf(self: List[T], item: T, index: int) -> int LastIndexOf(self: List[T], item: T, index: int, count: int) -> int """ pass def Remove(self, item): """ Remove(self: List[T], item: T) -> bool """ pass def RemoveAll(self, match): """ RemoveAll(self: List[T], match: Predicate[T]) -> int """ pass def RemoveAt(self, index): """ RemoveAt(self: List[T], index: int) """ pass def RemoveRange(self, index, count): """ RemoveRange(self: List[T], index: int, count: int) """ pass def Reverse(self, index=None, count=None): """ Reverse(self: List[T], index: int, count: int)Reverse(self: List[T]) """ pass def Sort(self, *__args): """ Sort(self: List[T])Sort(self: List[T], comparer: IComparer[T])Sort(self: List[T], index: int, count: int, comparer: IComparer[T])Sort(self: List[T], comparison: Comparison[T]) """ pass def ToArray(self): """ ToArray(self: List[T]) -> Array[T] """ pass def TrimExcess(self): """ TrimExcess(self: List[T]) """ pass def TrueForAll(self, match): """ TrueForAll(self: List[T], match: Predicate[T]) -> bool """ pass def __add__(self, *args): #cannot find CLR method """ x.__add__(y) <==> x+y """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__(self: ICollection[T], item: T) -> bool __contains__(self: IList, value: object) -> bool """ pass def __delitem__(self, *args): #cannot find CLR method """ x.__delitem__(y) <==> del x[y]x.__delitem__(y) <==> del x[y]x.__delitem__(y) <==> del x[y] """ pass def __getitem__(self, *args): #cannot find CLR method """ x.__getitem__(y) <==> x[y] """ pass def __getslice__(self, *args): #cannot find CLR method """ __getslice__(self: List[T], x: int, y: int) -> List[T] __getslice__(self: List[T], x: int, y: int) -> List[T] """ pass def __init__(self, *args): #cannot find CLR method """ 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 def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass def __len__(self, *args): #cannot find CLR method """ x.__len__() <==> len(x) """ pass @staticmethod # known case of __new__ def __new__(self, *__args): """ __new__(cls: type) __new__(cls: type, capacity: int) __new__(cls: type, collection: IEnumerable[T]) """ pass def __reduce_ex__(self, *args): #cannot find CLR method pass def __repr__(self, *args): #cannot find CLR method """ __repr__(self: List[T]) -> str __repr__(self: List[T]) -> str """ pass def __setitem__(self, *args): #cannot find CLR method """ x.__setitem__(i, y) <==> x[i]= """ pass Capacity = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Capacity(self: List[T]) -> int Set: Capacity(self: List[T]) = value """ Count = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Count(self: List[T]) -> int """ Enumerator = None class Queue(object, IEnumerable[T], IEnumerable, ICollection, IReadOnlyCollection[T]): """ Queue[T]() Queue[T](capacity: int) Queue[T](collection: IEnumerable[T]) """ def Clear(self): """ Clear(self: Queue[T]) """ pass def Contains(self, item): """ Contains(self: Queue[T], item: T) -> bool """ pass def CopyTo(self, array, arrayIndex): """ CopyTo(self: Queue[T], array: Array[T], arrayIndex: int) """ pass def Dequeue(self): """ Dequeue(self: Queue[T]) -> T """ pass def Enqueue(self, item): """ Enqueue(self: Queue[T], item: T) """ pass def GetEnumerator(self): """ GetEnumerator(self: Queue[T]) -> Enumerator """ pass def Peek(self): """ Peek(self: Queue[T]) -> T """ pass def ToArray(self): """ ToArray(self: Queue[T]) -> Array[T] """ pass def TrimExcess(self): """ TrimExcess(self: Queue[T]) """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__[T](enumerable: IEnumerable[T], value: T) -> bool """ pass def __init__(self, *args): #cannot find CLR method """ 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 def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass def __len__(self, *args): #cannot find CLR method """ x.__len__() <==> len(x) """ pass @staticmethod # known case of __new__ def __new__(self, *__args): """ __new__(cls: type) __new__(cls: type, capacity: int) __new__(cls: type, collection: IEnumerable[T]) """ pass def __reduce_ex__(self, *args): #cannot find CLR method pass def __repr__(self, *args): #cannot find CLR method """ __repr__(self: object) -> str """ pass Count = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Count(self: Queue[T]) -> int """ Enumerator = None class SortedDictionary(object, IDictionary[TKey, TValue], ICollection[KeyValuePair[TKey, TValue]], IEnumerable[KeyValuePair[TKey, TValue]], IEnumerable, IDictionary, ICollection, IReadOnlyDictionary[TKey, TValue], IReadOnlyCollection[KeyValuePair[TKey, TValue]]): """ SortedDictionary[TKey, TValue]() SortedDictionary[TKey, TValue](dictionary: IDictionary[TKey, TValue]) SortedDictionary[TKey, TValue](dictionary: IDictionary[TKey, TValue], comparer: IComparer[TKey]) SortedDictionary[TKey, TValue](comparer: IComparer[TKey]) """ def Add(self, key, value): """ Add(self: SortedDictionary[TKey, TValue], key: TKey, value: TValue) """ pass def Clear(self): """ Clear(self: SortedDictionary[TKey, TValue]) """ pass def ContainsKey(self, key): """ ContainsKey(self: SortedDictionary[TKey, TValue], key: TKey) -> bool """ pass def ContainsValue(self, value): """ ContainsValue(self: SortedDictionary[TKey, TValue], value: TValue) -> bool """ pass def CopyTo(self, array, index): """ CopyTo(self: SortedDictionary[TKey, TValue], array: Array[KeyValuePair[TKey, TValue]], index: int) """ pass def GetEnumerator(self): """ GetEnumerator(self: SortedDictionary[TKey, TValue]) -> Enumerator """ pass def Remove(self, key): """ Remove(self: SortedDictionary[TKey, TValue], key: TKey) -> bool """ pass def TryGetValue(self, key, value): """ TryGetValue(self: SortedDictionary[TKey, TValue], key: TKey) -> (bool, TValue) """ pass def __add__(self, *args): #cannot find CLR method """ x.__add__(y) <==> x+y """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__(self: IDictionary[TKey, TValue], key: TKey) -> bool __contains__(self: IDictionary, key: object) -> bool """ pass def __getitem__(self, *args): #cannot find CLR method """ x.__getitem__(y) <==> x[y] """ pass def __init__(self, *args): #cannot find CLR method """ 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 def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass def __len__(self, *args): #cannot find CLR method """ x.__len__() <==> len(x) """ pass @staticmethod # known case of __new__ def __new__(self, *__args): """ __new__(cls: type) __new__(cls: type, dictionary: IDictionary[TKey, TValue]) __new__(cls: type, dictionary: IDictionary[TKey, TValue], comparer: IComparer[TKey]) __new__(cls: type, comparer: IComparer[TKey]) """ pass def __reduce_ex__(self, *args): #cannot find CLR method pass def __repr__(self, *args): #cannot find CLR method """ __repr__(self: object) -> str """ pass def __setitem__(self, *args): #cannot find CLR method """ x.__setitem__(i, y) <==> x[i]= """ pass Comparer = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Comparer(self: SortedDictionary[TKey, TValue]) -> IComparer[TKey] """ Count = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Count(self: SortedDictionary[TKey, TValue]) -> int """ Keys = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Keys(self: SortedDictionary[TKey, TValue]) -> KeyCollection """ Values = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Values(self: SortedDictionary[TKey, TValue]) -> ValueCollection """ Enumerator = None KeyCollection = None ValueCollection = None class SortedList(object, IDictionary[TKey, TValue], ICollection[KeyValuePair[TKey, TValue]], IEnumerable[KeyValuePair[TKey, TValue]], IEnumerable, IDictionary, ICollection, IReadOnlyDictionary[TKey, TValue], IReadOnlyCollection[KeyValuePair[TKey, TValue]]): """ SortedList[TKey, TValue]() SortedList[TKey, TValue](capacity: int) SortedList[TKey, TValue](comparer: IComparer[TKey]) SortedList[TKey, TValue](capacity: int, comparer: IComparer[TKey]) SortedList[TKey, TValue](dictionary: IDictionary[TKey, TValue]) SortedList[TKey, TValue](dictionary: IDictionary[TKey, TValue], comparer: IComparer[TKey]) """ def Add(self, key, value): """ Add(self: SortedList[TKey, TValue], key: TKey, value: TValue) """ pass def Clear(self): """ Clear(self: SortedList[TKey, TValue]) """ pass def ContainsKey(self, key): """ ContainsKey(self: SortedList[TKey, TValue], key: TKey) -> bool """ pass def ContainsValue(self, value): """ ContainsValue(self: SortedList[TKey, TValue], value: TValue) -> bool """ pass def GetEnumerator(self): """ GetEnumerator(self: SortedList[TKey, TValue]) -> IEnumerator[KeyValuePair[TKey, TValue]] """ pass def IndexOfKey(self, key): """ IndexOfKey(self: SortedList[TKey, TValue], key: TKey) -> int """ pass def IndexOfValue(self, value): """ IndexOfValue(self: SortedList[TKey, TValue], value: TValue) -> int """ pass def Remove(self, key): """ Remove(self: SortedList[TKey, TValue], key: TKey) -> bool """ pass def RemoveAt(self, index): """ RemoveAt(self: SortedList[TKey, TValue], index: int) """ pass def TrimExcess(self): """ TrimExcess(self: SortedList[TKey, TValue]) """ pass def TryGetValue(self, key, value): """ TryGetValue(self: SortedList[TKey, TValue], key: TKey) -> (bool, TValue) """ pass def __add__(self, *args): #cannot find CLR method """ x.__add__(y) <==> x+y """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__(self: IDictionary[TKey, TValue], key: TKey) -> bool __contains__(self: IDictionary, key: object) -> bool """ pass def __getitem__(self, *args): #cannot find CLR method """ x.__getitem__(y) <==> x[y] """ pass def __init__(self, *args): #cannot find CLR method """ 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 def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass def __len__(self, *args): #cannot find CLR method """ x.__len__() <==> len(x) """ pass @staticmethod # known case of __new__ def __new__(self, *__args): """ __new__(cls: type) __new__(cls: type, capacity: int) __new__(cls: type, comparer: IComparer[TKey]) __new__(cls: type, capacity: int, comparer: IComparer[TKey]) __new__(cls: type, dictionary: IDictionary[TKey, TValue]) __new__(cls: type, dictionary: IDictionary[TKey, TValue], comparer: IComparer[TKey]) """ pass def __reduce_ex__(self, *args): #cannot find CLR method pass def __repr__(self, *args): #cannot find CLR method """ __repr__(self: object) -> str """ pass def __setitem__(self, *args): #cannot find CLR method """ x.__setitem__(i, y) <==> x[i]= """ pass Capacity = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Capacity(self: SortedList[TKey, TValue]) -> int Set: Capacity(self: SortedList[TKey, TValue]) = value """ Comparer = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Comparer(self: SortedList[TKey, TValue]) -> IComparer[TKey] """ Count = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Count(self: SortedList[TKey, TValue]) -> int """ Keys = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Keys(self: SortedList[TKey, TValue]) -> IList[TKey] """ Values = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Values(self: SortedList[TKey, TValue]) -> IList[TValue] """ class SortedSet(object, ISet[T], ICollection[T], IEnumerable[T], IEnumerable, ICollection, ISerializable, IDeserializationCallback, IReadOnlyCollection[T]): """ SortedSet[T]() SortedSet[T](comparer: IComparer[T]) SortedSet[T](collection: IEnumerable[T]) SortedSet[T](collection: IEnumerable[T], comparer: IComparer[T]) """ def Add(self, item): """ Add(self: SortedSet[T], item: T) -> bool """ pass def Clear(self): """ Clear(self: SortedSet[T]) """ pass def Contains(self, item): """ Contains(self: SortedSet[T], item: T) -> bool """ pass def CopyTo(self, array, index=None, count=None): """ CopyTo(self: SortedSet[T], array: Array[T])CopyTo(self: SortedSet[T], array: Array[T], index: int)CopyTo(self: SortedSet[T], array: Array[T], index: int, count: int) """ pass @staticmethod def CreateSetComparer(memberEqualityComparer=None): """ CreateSetComparer() -> IEqualityComparer[SortedSet[T]] CreateSetComparer(memberEqualityComparer: IEqualityComparer[T]) -> IEqualityComparer[SortedSet[T]] """ pass def ExceptWith(self, other): """ ExceptWith(self: SortedSet[T], other: IEnumerable[T]) """ pass def GetEnumerator(self): """ GetEnumerator(self: SortedSet[T]) -> Enumerator """ pass def GetObjectData(self, *args): #cannot find CLR method """ GetObjectData(self: SortedSet[T], info: SerializationInfo, context: StreamingContext) """ pass def GetViewBetween(self, lowerValue, upperValue): """ GetViewBetween(self: SortedSet[T], lowerValue: T, upperValue: T) -> SortedSet[T] """ pass def IntersectWith(self, other): """ IntersectWith(self: SortedSet[T], other: IEnumerable[T]) """ pass def IsProperSubsetOf(self, other): """ IsProperSubsetOf(self: SortedSet[T], other: IEnumerable[T]) -> bool """ pass def IsProperSupersetOf(self, other): """ IsProperSupersetOf(self: SortedSet[T], other: IEnumerable[T]) -> bool """ pass def IsSubsetOf(self, other): """ IsSubsetOf(self: SortedSet[T], other: IEnumerable[T]) -> bool """ pass def IsSupersetOf(self, other): """ IsSupersetOf(self: SortedSet[T], other: IEnumerable[T]) -> bool """ pass def OnDeserialization(self, *args): #cannot find CLR method """ OnDeserialization(self: SortedSet[T], sender: object) """ pass def Overlaps(self, other): """ Overlaps(self: SortedSet[T], other: IEnumerable[T]) -> bool """ pass def Remove(self, item): """ Remove(self: SortedSet[T], item: T) -> bool """ pass def RemoveWhere(self, match): """ RemoveWhere(self: SortedSet[T], match: Predicate[T]) -> int """ pass def Reverse(self): """ Reverse(self: SortedSet[T]) -> IEnumerable[T] """ pass def SetEquals(self, other): """ SetEquals(self: SortedSet[T], other: IEnumerable[T]) -> bool """ pass def SymmetricExceptWith(self, other): """ SymmetricExceptWith(self: SortedSet[T], other: IEnumerable[T]) """ pass def TryGetValue(self, equalValue, actualValue): """ TryGetValue(self: SortedSet[T], equalValue: T) -> (bool, T) """ pass def UnionWith(self, other): """ UnionWith(self: SortedSet[T], other: IEnumerable[T]) """ pass def __add__(self, *args): #cannot find CLR method """ x.__add__(y) <==> x+y """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__(self: ICollection[T], item: T) -> bool """ pass def __init__(self, *args): #cannot find CLR method """ 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 def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass def __len__(self, *args): #cannot find CLR method """ x.__len__() <==> len(x) """ pass @staticmethod # known case of __new__ def __new__(self, *__args): """ __new__(cls: type) __new__(cls: type, comparer: IComparer[T]) __new__(cls: type, collection: IEnumerable[T]) __new__(cls: type, collection: IEnumerable[T], comparer: IComparer[T]) __new__(cls: type, info: SerializationInfo, context: StreamingContext) """ pass def __reduce_ex__(self, *args): #cannot find CLR method pass def __repr__(self, *args): #cannot find CLR method """ __repr__(self: object) -> str """ pass Comparer = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Comparer(self: SortedSet[T]) -> IComparer[T] """ Count = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Count(self: SortedSet[T]) -> int """ Max = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Max(self: SortedSet[T]) -> T """ Min = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Min(self: SortedSet[T]) -> T """ Enumerator = None class Stack(object, IEnumerable[T], IEnumerable, ICollection, IReadOnlyCollection[T]): """ Stack[T]() Stack[T](capacity: int) Stack[T](collection: IEnumerable[T]) """ def Clear(self): """ Clear(self: Stack[T]) """ pass def Contains(self, item): """ Contains(self: Stack[T], item: T) -> bool """ pass def CopyTo(self, array, arrayIndex): """ CopyTo(self: Stack[T], array: Array[T], arrayIndex: int) """ pass def GetEnumerator(self): """ GetEnumerator(self: Stack[T]) -> Enumerator """ pass def Peek(self): """ Peek(self: Stack[T]) -> T """ pass def Pop(self): """ Pop(self: Stack[T]) -> T """ pass def Push(self, item): """ Push(self: Stack[T], item: T) """ pass def ToArray(self): """ ToArray(self: Stack[T]) -> Array[T] """ pass def TrimExcess(self): """ TrimExcess(self: Stack[T]) """ pass def __contains__(self, *args): #cannot find CLR method """ __contains__[T](enumerable: IEnumerable[T], value: T) -> bool """ pass def __init__(self, *args): #cannot find CLR method """ 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 def __iter__(self, *args): #cannot find CLR method """ __iter__(self: IEnumerable) -> object """ pass def __len__(self, *args): #cannot find CLR method """ x.__len__() <==> len(x) """ pass @staticmethod # known case of __new__ def __new__(self, *__args): """ __new__(cls: type) __new__(cls: type, capacity: int) __new__(cls: type, collection: IEnumerable[T]) """ pass def __reduce_ex__(self, *args): #cannot find CLR method pass def __repr__(self, *args): #cannot find CLR method """ __repr__(self: object) -> str """ pass Count = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Get: Count(self: Stack[T]) -> int """ Enumerator = None
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Resellers', 'category': 'Sales', 'website': 'https://www.odoo.com/page/website-builder', 'summary': 'Publish Your Channel of Resellers', 'version': '1.0', 'description': """ Publish and Assign Partner ========================== """, 'depends': ['base_geolocalize', 'crm', 'account', 'portal', 'website_partner', 'website_google_map', 'website_portal'], 'data': [ 'data/portal_data.xml', 'data/crm_partner_assign_data.xml', 'security/ir.model.access.csv', 'wizard/crm_forward_to_partner_view.xml', 'views/res_partner_views.xml', 'views/crm_lead_views.xml', 'views/website_crm_partner_assign_templates.xml', 'report/crm_lead_report_view.xml', 'report/crm_partner_report_view.xml', ], 'demo': [ 'data/res_partner_demo.xml', 'data/crm_lead_demo.xml', 'data/res_partner_grade_demo.xml', ], 'qweb': ['static/src/xml/*.xml'], 'installable': True, }
# -*- coding: utf-8 -*- """ Given a string and a pattern, find out if the string contains any permutation of the pattern. Permutation is defined as the re-arranging of the characters of the string. For example, “abc” has the following six permutations: abc acb bac bca cab cba If a string has ‘n’ distinct characters, it will have n!n! permutations. Example 1: Input: String="oidbcaf", Pattern="abc" Output: true Explanation: The string contains "bca" which is a permutation of the given pattern. Example 2: Input: String="odicf", Pattern="dc" Output: false Explanation: No permutation of the pattern is present in the given string as a substring. Example 3: Input: String="bcdxabcdy", Pattern="bcdyabcdx" Output: true Explanation: Both the string and the pattern are a permutation of each other. Example 4: Input: String="aaacb", Pattern="abc" Output: true Explanation: The string contains "acb" which is a permutation of the given pattern. """ def find_permutation(str1, pattern): window_start, matched = 0, 0 char_frequency = {} for chr in pattern: if chr not in char_frequency: char_frequency[chr] = 0 char_frequency[chr] += 1 # our goal is to match all the characters from the 'char_frequency' with the current window # try to extend the range [window_start, window_end] for window_end in range(len(str1)): right_char = str1[window_end] if right_char in char_frequency: # decrement the frequency of matched character char_frequency[right_char] -= 1 if char_frequency[right_char] == 0: matched += 1 if matched == len(char_frequency): return True # shrink the window by one character if window_end >= len(pattern) - 1: left_char = str1[window_start] window_start += 1 if left_char in char_frequency: if char_frequency[left_char] == 0: matched -= 1 char_frequency[left_char] += 1 return False def main(): print('Permutation exist: ' + str(find_permutation("oidbcaf", "abc"))) print('Permutation exist: ' + str(find_permutation("odicf", "dc"))) print('Permutation exist: ' + str(find_permutation("bcdxabcdy", "bcdyabcdx"))) print('Permutation exist: ' + str(find_permutation("aaacb", "abc"))) main()
class DataTemplate(FrameworkTemplate,INameScope,ISealable,IHaveResources,IQueryAmbient): """ Describes the visual structure of a data object. DataTemplate() DataTemplate(dataType: object) """ def ValidateTemplatedParent(self,*args): """ ValidateTemplatedParent(self: DataTemplate,templatedParent: FrameworkElement) Checks the templated parent against a set of rules. templatedParent: The element this template is applied to. """ 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 @staticmethod def __new__(self,dataType=None): """ __new__(cls: type) __new__(cls: type,dataType: object) """ pass DataTemplateKey=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the default key of the System.Windows.DataTemplate. Get: DataTemplateKey(self: DataTemplate) -> object """ DataType=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets or sets the type for which this System.Windows.DataTemplate is intended. Get: DataType(self: DataTemplate) -> object Set: DataType(self: DataTemplate)=value """ Triggers=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets a collection of triggers that apply property values or perform actions based on one or more conditions. Get: Triggers(self: DataTemplate) -> TriggerCollection """
W = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] # 加权系数 M_run = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # 闰年每月天数 M_ping = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # 平年每月天数 def check(id_number): try: id_number = str(id_number) except: return None if len(id_number) != 18 or not id_number[:-1].isdigit() and (id_number[-1] != 'X' or id_number[-1] != 'x'): return None id_number_dict = dict() id_number_dict['地址码'] = int(id_number[:6]) # 校验身份证地址码 if len(str(id_number_dict['地址码'])) != 6: return None id_number_dict['YY'] = int(id_number[6:10]) # 校验身份证年份 if len(str(id_number_dict['YY'])) != 4 or id_number_dict['YY'] > 2019: return None id_number_dict['MM'] = int(id_number[10:12]) # 校验身份证月份 if id_number_dict['MM'] > 12 or id_number_dict['MM'] == 0: return None id_number_dict['DD'] = int(id_number[12:14]) # 校验身份证日期 if id_number_dict['YY'] % 400 == 0 or (id_number_dict['YY'] % 4 == 0 and id_number_dict['YY'] % 100 != 0): if id_number_dict['DD'] > M_run[id_number_dict['MM'] - 1]: return None else: if id_number_dict['DD'] > M_ping[id_number_dict['MM'] - 1]: return None id_number_dict['顺序码'] = id_number[14:17] # 校验身份证顺序码 # if (int(id_number_dict['顺序码'][-1]) % 2 == 0 and id_sex == '男') or ( # int(id_number_dict['顺序码'][-1]) % 2 == 1 and id_sex == '女'): # print('身份证号码顺序码错误') # return None if id_number[17] == 'X' or id_number[17] == 'x': id_number_dict['校验码'] = 10 else: id_number_dict['校验码'] = int(id_number[17]) # 校验身份证校验码 A = list(map(int, list(id_number[:-1]))) id_S = sum([x * y for (x, y) in zip(A, W)]) id_N = (12 - id_S % 11) % 11 if id_N == id_number_dict['校验码']: return True else: return None if __name__ == '__main__': print(check('11010119900307651X')) print(check('110101199003072551')) print(check(110101199003072551))
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'market_platform_backend', 'USER': 'postgres', 'HOST': 'postgres', 'PORT': '5432', 'PASSWORD': '' } } CELERY_BROKER_URL = 'redis://redis:6379' CELERY_RESULT_BACKEND = 'redis://redis:6379' DEBUG = False
numero = int(input("Digite um numero para calcular tabuada: ")) tab = 0 while (tab <= 10): print (tab ,"X",numero,"=", numero * tab) tab +=1
SPACE = 20 def print_stand_species(summary_stand): formatted = ['STAND METRICS'] for i, row in enumerate(summary_stand): formatted.append(''.join([j + (' ' * (SPACE - len(j))) for j in row])) if i == 0 or i == len(summary_stand) - 2: formatted.append('-' * (SPACE * len(row))) return '\n'.join(formatted) def print_stand_logs(summary_logs): formatted = ['LOG METRICS'] for metric in summary_logs: formatted.append(metric) for species in summary_logs[metric]: table_len = SPACE * len(summary_logs[metric][species][0]) first = '-' * SPACE * 3 spp_len = len(species) formatted.append(first + species + ('-' * (table_len - len(first) - spp_len))) for i, row in enumerate(summary_logs[metric][species]): formatted.append(''.join([j + (' ' * (SPACE - len(j))) for j in row])) if i == 0: formatted.append('-' * (SPACE * len(row))) formatted.append('') formatted.append('') return '\n'.join(formatted) def print_stand_stats(summary_stats): formatted = ['STAND STATISTICS'] for species in summary_stats: table_len = SPACE * len(summary_stats[species][0]) first = '-' * SPACE * 4 spp_len = len(species) formatted.append(first + species + ('-' * (table_len - len(first) - spp_len))) for i, row in enumerate(summary_stats[species]): formatted.append(''.join([j + (' ' * (SPACE - len(j))) for j in row])) if i == 0: formatted.append('-' * (SPACE * len(row))) formatted.append('') formatted.append('') return '\n'.join(formatted) def print_thin(summary_thin): formatted = [] for condition in summary_thin: formatted.append(condition) for i, row in enumerate(summary_thin[condition]): if i == len(summary_thin[condition]) - 1: formatted.append('-' * SPACE * len(row)) formatted.append(''.join([j + (' ' * (SPACE - len(j))) for j in row])) if i == 0: formatted.append('-' * SPACE * len(row)) formatted += '\n' return '\n'.join(formatted)
def hashadNum(num): digitSum = sum([int(k) for k in str(num)]) if num % digitSum == 0: return True else: return False n = int(input()) while not (hashadNum(n)): n += 1 print(n)
# -*- encoding: utf-8 -*- """ Created by Ênio Viana at 22/09/2021 at 23:05:30 Project: py_dss_tools [set, 2021] """ class ESPVLControl: name = "ESPVLControl" name_plural = "ESPVLControls" columns = ['basefreq', 'element', 'enabled', 'forecast', 'kvarlimit', 'kwband', 'like', 'localcontrollist', 'localcontrolweights', 'pvsystemlist', 'pvsystemweights', 'storagelist', 'storageweights', 'terminal', 'type'] def __init__(self): self.__element = None self.__forecast = None self.__kvarlimit = None self.__kwband = None self.__localcontrollist = None self.__localcontrolweights = None self.__pvsystemlist = None self.__pvsystemweights = None self.__storagelist = None self.__storageweights = None self.__terminal = None self.__type = None @property def element(self): return self.__element @element.setter def element(self, value): self.__element = value @property def forecast(self): return self.__forecast @forecast.setter def forecast(self, value): self.__forecast = value @property def kvarlimit(self): return self.__kvarlimit @kvarlimit.setter def kvarlimit(self, value): self.__kvarlimit = value @property def kwband(self): return self.__kwband @kwband.setter def kwband(self, value): self.__kwband = value @property def localcontrollist(self): return self.__localcontrollist @localcontrollist.setter def localcontrollist(self, value): self.__localcontrollist = value @property def localcontrolweights(self): return self.__localcontrolweights @localcontrolweights.setter def localcontrolweights(self, value): self.__localcontrolweights = value @property def pvsystemlist(self): return self.__pvsystemlist @pvsystemlist.setter def pvsystemlist(self, value): self.__pvsystemlist = value @property def pvsystemweights(self): return self.__pvsystemweights @pvsystemweights.setter def pvsystemweights(self, value): self.__pvsystemweights = value @property def storagelist(self): return self.__storagelist @storagelist.setter def storagelist(self, value): self.__storagelist = value @property def storageweights(self): return self.__storageweights @storageweights.setter def storageweights(self, value): self.__storageweights = value @property def terminal(self): return self.__terminal @terminal.setter def terminal(self, value): self.__terminal = value @property def type(self): return self.__type @type.setter def type(self, value): self.__type = value
""" Módulo com configurações gerais """ # Campos customizado no VMM CAMPO_AGRUPAMENTO = ('VMM_MANAGER_AGRUPAMENTO', 'Agrupamento da máquina (script vmm_manager).') CAMPO_ID = ('VMM_MANAGER_ID', 'Nome da VM informada no inventário (script vmm_manager).') CAMPO_IMAGEM = ('VMM_MANAGER_IMAGEM', 'Imagem utilizada para criar a VM (script vmm_manager).') CAMPO_REGIAO = ('VMM_MANAGER_REGIAO', 'Região na qual a VM foi criada (script vmm_manager).') CAMPO_REDE_PRINCIPAL = ('VMM_MANAGER_REDE_PRINCIPAL', 'Nome da rede principal da VM (script vmm_manager).')
''' Matrix: Count the number of islands in a matrix ''' class Solution: def numIslands(self, grid): """ :type grid: List[List[str]] :rtype: int """ def getIsland(i,j): if 0<=i<len(grid) and 0<=j<len(grid[0]) and grid[i][j]=='1': grid[i][j]='0' return 1+getIsland(i-1,j)+getIsland(i+1,j)+getIsland(i,j+1)+getIsland(i,j-1) return 0 result=0 for row, cols in enumerate(grid): for col, val in enumerate(cols): if getIsland(row,col)>0: result+=1 return result if __name__=='__main__': solution = Solution() t1=[ [1,1,1,1,0], [1,1,0,1,0], [1,1,0,0,0], [0,0,0,0,0]] print(solution.numIslands(t1))
def parseExpression(expression): operators = ['**', '+', '-', '*', '/', '%'] operator = '+' for currOperator in operators: if expression.__contains__(currOperator): operator = currOperator break if bool(operator): operands = expression.split(operator) return {'firstOperand': int(operands[0]), 'operator': operator, 'secondOperand': int(operands[1])} def add(firstOperand, secondOperand): return firstOperand + secondOperand def subtract(firstOperand, secondOperand): return firstOperand - secondOperand def multiply(firstOperand, secondOperand): return firstOperand * secondOperand def divide(firstOperand, secondOperand): return firstOperand / secondOperand def mod(firstOperand, secondOperand): return firstOperand % secondOperand def pow(firstOperand, secondOperand): return firstOperand ** secondOperand def calculate(firstOperand, operator, secondOperand): operatorMappingFunc = {'+': add, '-': subtract, '*': multiply, '/': divide, '%': mod, '**': pow} return operatorMappingFunc[operator](firstOperand, secondOperand)
# -*- coding: utf-8 -*- # --- Slack configuration --- # get your own at https://api.slack.com/docs/oauth-test-tokens SLACK_TOKEN = "xoxp-XXX" # the channel Slasher will send its messages to SLACK_CHANNEL = "#random" # Slasher's username SLACK_USERNAME = "Slasher" # Slasher's icon SLACK_USER_EMOJI = ":robot_face:" # --- Giphy configuration --- GIPHY_TAGS = ["fireworks", "guitar"]
""" http://pythontutor.ru/lessons/2d_arrays/problems/snowflake/ Дано нечетное число n. Создайте двумерный массив из n×n элементов, заполнив его символами "." (каждый элемент массива является строкой из одного символа). Затем заполните символами "*" среднюю строку массива, средний столбец массива, главную диагональ и побочную диагональ. В результате единицы в массиве должны образовывать изображение звездочки. Выведите полученный массив на экран, разделяя элементы массива пробелами. """ n = int(input()) lst = [['.'] * n for i in range(n)] m = n // 2 for i in range(n): for j in range(n): if (i == j) or (j == n // 2) or (i == n // 2) or (j == n - 1 - i): lst[i][j] = '*' for line in lst: print(' '.join(line))
S = input().split() N = int(input()) print(*S) for _ in range(N): next_S = input().split() for i in range(4): p = i // 2 q = i % 2 if S[p] == next_S[q]: next_S[q] = S[p^1] S = next_S print(*S) break else: assert(False)
class Pessoa: olhos=2 def __init__(self, *filhos, nome=None, idade=23): self.idade = idade self.nome = nome self.filhos = list(filhos) def cumprimentar(self): return f'Olá, meu nome é {self.nome}' @staticmethod def metodo_estatico(): return 42 @classmethod def nome_e_atributos_de_classe(cls): return f'{cls} - olhos {cls.olhos}' class Homem(Pessoa): def cumprimentar(self): cumprimentar_da_classe = super().cumprimentar() return f'{cumprimentar_da_classe}. Aperto de mão' class Mutante(Pessoa): olhos = 3 if __name__=='__main__': martinho = Mutante(nome='Martinho') rennan = Homem(martinho, nome='Rennan') print(Pessoa.cumprimentar(rennan)) print(id(rennan)) print(rennan.cumprimentar()) print(rennan.nome) print(rennan.idade) for filho in rennan.filhos: print(filho.nome) rennan.sobrenome = 'Lima' del rennan.filhos rennan.olhos = 1 del rennan.olhos print(rennan.__dict__) print(martinho.__dict__) print(Pessoa.olhos) print(rennan.olhos) print(id(Pessoa.olhos), id(rennan.olhos)) print(Pessoa.metodo_estatico(), rennan.metodo_estatico()) print(Pessoa.nome_e_atributos_de_classe(), rennan.nome_e_atributos_de_classe()) pessoa = Pessoa('Anonimo') print(isinstance(pessoa, Pessoa)) print(isinstance(pessoa, Homem)) print(isinstance(rennan, Pessoa)) print(isinstance(rennan, Homem)) print(martinho.olhos) print(rennan.cumprimentar()) print(martinho.cumprimentar())
nome = str(input('Informe seu nome: ')).strip() dividido = nome.split() print('Seu primeiro nome é: {}'.format(dividido[0])) print('Seu último nome é: {}'.format(dividido[len(dividido) - 1]))
"""Websocket errors""" class WebSocketInternalError(Exception): """Exception raised for a WebSocket internal error"""
# -*- coding: utf-8 -*- DESC = "solar-2018-10-11" INFO = { "DescribeSubProject": { "params": [ { "name": "SubProjectId", "desc": "子项目id" } ], "desc": "子项目详情" }, "DescribeProjectStock": { "params": [ { "name": "SubProjectId", "desc": "子项目id" } ], "desc": "项目库存详情" }, "DescribeProject": { "params": [ { "name": "ProjectId", "desc": "项目ID" } ], "desc": "项目详情展示" }, "DescribeResourceTemplateHeaders": { "params": [ { "name": "WxAppId", "desc": "微信公众号appId" } ], "desc": "素材查询服务号模板的列表(样例)" }, "DescribeCustomer": { "params": [ { "name": "UserId", "desc": "用户ID" } ], "desc": "客户档案查询客户详情" }, "SendWxTouchTask": { "params": [ { "name": "GroupId", "desc": "客户分组ID" }, { "name": "DistinctFlag", "desc": "去除今日已发送的客户" }, { "name": "IsSendNow", "desc": "是否立马发送" }, { "name": "SendDate", "desc": "发送时间,一般为0" }, { "name": "TaskName", "desc": "任务名称" }, { "name": "WxTouchType", "desc": "微信触达类型,text, news, smallapp, tmplmsg" }, { "name": "Title", "desc": "标题" }, { "name": "Content", "desc": "文本内容" }, { "name": "NewsId", "desc": "图文素材ID" }, { "name": "SmallProgramId", "desc": "小程序卡片ID" }, { "name": "TemplateId", "desc": "模板消息ID" }, { "name": "WxAppId", "desc": "微信公众号appId" } ], "desc": "发送企业微信触达任务" }, "CreateProject": { "params": [ { "name": "ProjectName", "desc": "项目名称" }, { "name": "ProjectOrg", "desc": "项目机构" }, { "name": "ProjectBudget", "desc": "项目预算" }, { "name": "ProjectIntroduction", "desc": "项目简介" }, { "name": "ProjectOrgId", "desc": "所属部门ID" } ], "desc": "创建项目" }, "ReplenishProjectStock": { "params": [ { "name": "SubProjectId", "desc": "项目id" }, { "name": "PrizeId", "desc": "奖品id" }, { "name": "PrizeNum", "desc": "奖品数量" }, { "name": "PoolIndex", "desc": "奖池索引" }, { "name": "PoolName", "desc": "奖池名称" } ], "desc": "补充子项目库存" }, "DescribeProjects": { "params": [ { "name": "PageNo", "desc": "页码" }, { "name": "PageSize", "desc": "页面大小" }, { "name": "SearchWord", "desc": "过滤规则" }, { "name": "Filters", "desc": "部门范围过滤" }, { "name": "ProjectStatus", "desc": "项目状态, 0:编辑中 1:运营中 2:已下线 3:已删除 4:审批中" } ], "desc": "项目列表展示" }, "OffLineProject": { "params": [ { "name": "ProjectId", "desc": "项目ID" } ], "desc": "下线项目" }, "ExpireFlow": { "params": [ { "name": "FlowId", "desc": "工单ID" } ], "desc": "把审批中的工单置为已失效" }, "DeleteProject": { "params": [ { "name": "ProjectId", "desc": "项目ID" } ], "desc": "删除项目" }, "CheckStaffChUser": { "params": [ { "name": "UserId", "desc": "员工ID" }, { "name": "OperateType", "desc": "渠道状态:checkpass审核通过, checkreject审核拒绝, enableoperate启用, stopoperate停用" } ], "desc": "员工渠道更改员工状态" }, "DescribeCustomers": { "params": [ { "name": "QueryType", "desc": "查询类型,0.个人,1负责部门,2.指定部门" }, { "name": "GroupId", "desc": "分组ID" }, { "name": "MarkFlag", "desc": "是否星级标记 1是 0否" }, { "name": "TagIds", "desc": "客户标签,多个标签用逗号隔开" }, { "name": "RelChannelFlag", "desc": "员工标识筛选,0:非员工,1:员工" }, { "name": "NeedPhoneFlag", "desc": "必须存在手机 1是 0否" }, { "name": "Province", "desc": "省份" }, { "name": "City", "desc": "城市" }, { "name": "Sex", "desc": "性别 1男 2女" }, { "name": "KeyWord", "desc": "城市" }, { "name": "Offset", "desc": "查询开始位置" }, { "name": "Limit", "desc": "每页记录条数" }, { "name": "SubProjectId", "desc": "子项目ID" } ], "desc": "查询客户档案列表" }, "ModifyProject": { "params": [ { "name": "ProjectId", "desc": "项目ID" }, { "name": "ProjectName", "desc": "项目名称" }, { "name": "ProjectBudget", "desc": "项目预算" }, { "name": "ProjectOrg", "desc": "项目机构" }, { "name": "ProjectIntroduction", "desc": "项目简介" }, { "name": "ProjectOrgId", "desc": "项目机构Id" } ], "desc": "修改项目" }, "CreateSubProject": { "params": [ { "name": "ProjectId", "desc": "所属项目id" }, { "name": "SubProjectName", "desc": "子项目名称" } ], "desc": "创建子项目" }, "CopyActivityChannel": { "params": [ { "name": "ActivityId", "desc": "活动ID" }, { "name": "ChannelFrom", "desc": "来源渠道ID" }, { "name": "ChannelTo", "desc": "目的渠道id" } ], "desc": "复制活动渠道的策略" } }
class User: """ class that generates new instances of user """ user_list=[] def __init__(self,first_name,last_name,create_pw,confirm_pw): ''' __init__ method that helps us define properties for our objects. Args: first_name: New user first name. last_name : New user last name. create_pw: New user create pw. confirm_pw : New user confirm pw . ''' self.first_name = first_name self.last_name = last_name self.create_pw = create_pw self.confirm_pw= confirm_pw user_list=[] def login_user(self): ''' login_user method saves contact object into user_list ''' User.user_list.append(self)
""" Problem: Given an array L with n elements. Inversion occurs when L[i] > L[j] when 0 < i < j < n. Example: count_inversions([1,3,5,2,4,6]) -> 3 Explanation: 3 pairs of inversions (3,2), (5,3), (5,4) """ def count_inversions(elems: list[any]) -> int: # return the number of inversions in the array without mutating it return _count(elems)[1] def _count(elems: list[any]) -> tuple[list[any], int]: if len(elems) > 1: middle = int(len(elems) / 2) sorted_left, count_left = _count(elems[:middle]) sorted_right, count_right = _count(elems[middle:]) sorted_arr, count_split = _merge_and_count_split( sorted_left, sorted_right) return sorted_arr, count_left + count_right + count_split else: return elems, 0 def _merge_and_count_split(L: list[any], R: list[any]) -> tuple[list[any], int]: count = 0 sorted_arr = [] i = 0 j = 0 while i < len(L) and j < len(R): if L[i] <= R[j]: sorted_arr.append(L[i]) i += 1 else: sorted_arr.append(R[j]) j += 1 count += len(L) - i if i < len(L): sorted_arr += L[i:] if j < len(R): sorted_arr += R[j:] return (sorted_arr, count)
#!/usr/bin/env python # coding: utf-8 # p677 class MapSum: def __init__(self): """ Initialize your data structure here. """ self._kv = dict() # type: dict self._prefix = dict() # type: dict def insert(self, key, val): """ :type key: str :type val: int :rtype: void """ dv = val - self._kv.get(key, 0) self._kv[key] = val for i in range(len(key)): prefix = key[:i + 1] self._prefix[prefix] = self._prefix.get(prefix, 0) + dv def sum(self, prefix): """ :type prefix: str :rtype: int """ return self._prefix.get(prefix, 0) if __name__ == '__main__': # Your MapSum object will be instantiated and called as such: obj = MapSum() obj.insert("abc", 3) obj.insert("ab", 2) print(obj.sum("a")) obj.insert("apple", 3) print(obj.sum("ap")) obj.insert("app", 2) print(obj.sum("apple"))
def start() : driverType = irr.driverChoiceConsole(); if driverType == irr.EDT_COUNT : return 1; device = irr.createDevice(driverType, irr.dimension2d_u32(640, 480)); if device == None : return 1; driver = device.getVideoDriver(); smgr = device.getSceneManager(); device.getFileSystem().addZipFileArchive("../../media/map-20kdm2.pk3"); mesh = smgr.getMesh("20kdm2.bsp"); node = None; if mesh != None : node = smgr.addOctreeSceneNode(mesh.getMesh(0), None, -1, 1024); if node != None : node.setPosition(irr.vector3df(-1300,-144,-1249)); smgr.addCameraSceneNodeFPS(); device.getCursorControl().setVisible(False); lastFPS = -1; while device.run() : if device.isWindowActive() : driver.beginScene(True, True, irr.SColor(255,200,200,200)); smgr.drawAll(); driver.endScene(); fps = driver.getFPS(); if lastFPS != fps : tmp = "cpgf Irrlicht Python Binding Demo - Quake 3 Map example ["; tmp = tmp + driver.getName(); tmp = tmp + "] fps: "; tmp = tmp + str(fps); device.setWindowCaption(tmp); lastFPS = fps; device.drop(); return 0; start();
class Node(): def __init__(self, name): self.name = name self.possValues = [] self.value = "" self.parents = [] self.children = [] self.CPD = {} # variables for use in Variable Elimination self.inDeg = 0 self.used = False
# first development commit # first feature commit my_str_var = "" new_var_feature = "" another_var_feature = "" def some_function(mylist=[]): _mylist = mylist for x in _mylist: print(f"x is {x}") mylist = ['one', 'two', 'three', 'four'] # here is another section a_var = 0 b_var = 1 c_var = a_var + b_var print(f"c_var {c_var}") # more comments # more comments d_var = 4 e_var = 1 f_var = d_var - e_var print(f"f_var {f_var}") # here is another comment """ here is a doc string """ if __name__ == "__main__": some_function(mylist=mylist)
def convert24(time): if time[-2:] == "AM" and time[:2] == "12": return "00" + time[2:-2] elif time[-2:] == "AM": return time[:-2] elif time[-2:] == "PM" and time[:2] == "12": return time[:-2] else: return str(int(time[:2]) + 12) + time[2:6] tc=int(input()) while tc>0: ans="" P=input() N=int(input()) for i in range(0,N): LR=input() L=LR[:8] R=LR[9:17] ActP=convert24(P) L24=convert24(L) R24=convert24(R) Lreal=int(L24.replace(":","")) Rreal=int(R24.replace(":","")) Preal=int(ActP.replace(":","")) if(Lreal<=Preal and Rreal>=Preal): ans+="1" else: ans+="0" print(ans) tc-=1
# encoding: utf-8 class Config(object): # Number of results to fetch from API RESULT_COUNT = 9 # How long to cache results for CACHE_MAX_AGE = 20 # seconds ICON = "2B939AF4-1A27-4D41-96FE-E75C901C780F.png" GOOGLE_ICON = "google.png" # Algolia credentials ALGOLIA_APP_ID = "BH4D9OD16A" ALGOLIA_SEARCH_ONLY_API_KEY = "1d8534f83b9b0cfea8f16498d19fbcab" ALGOLIA_SEARCH_INDEX = "material-ui"
############################ data loading ######################################## train_subject_ids = [1,6,7,8,9,11] """ training subject ids """ test_subject_ids = [5] """test subject id""" omit_one_hot = False """one-hot encoding when loading human3.6m dataset""" ############################ model ############################################## architecture = "basic" """architecture version: Seq2seq architecture to use: [basic, tied]""" HUMAN_SIZE = 54 """human size""" source_seq_len = 50 """input sequence length""" target_seq_len = 25 """target sequence lenght""" rnn_size = 1024 """rnn hidden size""" rnn_num_layers = 1 """rnn layer num""" max_gradient_norm = 5 """maximum gradient norm""" residual_velocities = False """Add a residual connection that effectively models velocities""" ############################## Training ################################## use_cuda = True # param: use_cuda? batch_size = 16 """batch size""" learning_rate = 5e-3 """learning rate""" learning_rate_decay_factor = 0.95 """learning rate decay""" loss_to_use = "sampling_based" """The type of loss to use, supervised or sampling_based""" ############################## Logging ################################## print_every = 50 """printing frequency during training"""
'''input 100 4 16 4554 ''' '''input 20 2 5 84 ''' # -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem B def sum_digit(number): string = str(number) array = list(map(int, list(string))) return sum(array) if __name__ == '__main__': N, A, B = list(map(int, input().split())) total = 0 for number in range(1, N + 1): if A <= sum_digit(number) <= B: total += number print(total)
SITE_TITLE = "Awesome Boilerplates" FRAMEWORK_TITLE = "" RESTRICT_PACKAGE_EDITORS = False RESTRICT_GRID_EDITORS = False ADMINS = [ ("Vinta", "awesomeboilerplates@vinta.com.br"), ]
class Node: def __init__(self, val): self.val = val self.left = None self.right = None def store_inorder(root, inorder): if root is None: return store_inorder(root.left, inorder) inorder.append(root.data) store_inorder(root.right, inorder) def count_nodes(root): if root is None: return 0 return count_nodes(root.left) + count_nodes(root.right) + 1 def array_to_bst(arr, root): if root is None: return array_to_bst(arr, root.left) root.data = arr[0] arr.pop(0) array_to_bst(arr, root.right) def bt_to_bst(root): if root is None: return n = count_nodes(root) arr = [] store_inorder(root, arr) arr.sort() array_to_bst(arr, root)
# To store registered users registered_users = {} # To store User staus Ture for Login & False for Logout user_status = {} user_account = {} def total_users(): return len(registered_users)
grid = [ ['W', 'L', 'W', 'W', 'W'], ['W', 'L', 'W', 'W', 'W'], ['W', 'W', 'W', 'L', 'W'], ['W', 'W', 'L', 'L', 'W'], ['L', 'W', 'W', 'L', 'L'], ['L', 'L', 'W', 'W', 'W'], ] visited_land = [] def minimum_island(grid): min = 100 for i in range(0, len(grid)): for j in range(0, len(grid[0])): count = explore(grid, i, j) if count < min and count != 0: min = count return min def explore(grid, row, col): if row < 0 or row >= len(grid): return 0 if col < 0 or col >= len(grid[0]): return 0 if grid[row][col] == 'W': return 0 if [row, col] in visited_land: return 0 visited_land.append([row, col]) count = 1 count += explore(grid, row-1, col) count += explore(grid, row+1, col) count += explore(grid, row, col-1) count += explore(grid, row, col+1) return count
#练习3-1 names = ['Jack','Mary','Thomas','Tom','Jerry'] print(names) #练习3-2 for i in range(len(names)): print(f'How are you? {names[i]}') #练习3-3 print('\n') vehicles = ['bicycle','car','bus','subway','feet'] for i in range(len(vehicles)): print(f'I would like to go to school by/on {vehicles[i]}.')
params = dict() class Param(object): def __init__(self, name, value=None): self._name = name self._value = value params[self.format()] = self @property def name(self): return self._name def format(self): string = self.name if self.value is not None: string += "=" + self.value return string @property def value(self): return self._value class UnknownParam(Param): def __init__(self, name, value=None): self._name = name self._value = value ## Do not append the parameter to the list.