content
stringlengths
7
1.05M
def collatzChain(n): lengthChain=0 while n!=1: if n%2==0: n=int(n/2) else: n=int((3*n)+1) print(n) def collatzChainLength(n): lengthChain=0 while n!=1: if n%2==0: n=int(n/2) else: n=int((3*n)+1) #print(n) lengthChain+=1 return lengthChain maxChainLength=0 maxChainValue=0 for i in range(100,1000000): chainLength = collatzChainLength(i) if maxChainLength < chainLength: maxChainLength = chainLength maxChainValue = i else: continue print(maxChainValue)
vowels = "aeiouAEIOU" consonants = "bcdfghjklmnpqrstvwxyz"; consonants+=consonants.upper() #The f means final, I thought acually writing final would take to long fvowels = "" fcon="" fother="" userInput = input("Please input sentance to split: ") print ("Splitting sentance: " + userInput) #Iterates through inputed charecters for char in userInput: #Checks if the current iterated charecter is a vowel if char in vowels: fvowels += char #Checks if the current iterated charecter is a consonant elif char in consonants: fcon+= char #Otherwise else: fother += char print("Process Completed") print("Vowels: " + fvowels) print("Consonants: " + fcon) print("Other: "+ fother)
#!/usr/bin/env python3 # Replace by your own program print("hello world")
#! /usr/bin/env python # -*- coding: utf-8 -*- """ @Author:lichunhui @Time: 2018/7/12 10:12 @Description: """
""" Module: 'flowlib.faces._encode' on M5 FlowUI v1.4.0-beta """ # MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32') # Stubber: 1.3.1 class Encode: '' def _available(): pass def _update(): pass def clearValue(): pass def deinit(): pass def getDir(): pass def getPress(): pass def getValue(): pass def setLed(): pass i2c_bus = None time = None
""" Database module """ class Database(object): """ Defines data structures and methods to store article content. """ def save(self, article): """ Saves an article. Args: article: article metadata and text content """ def complete(self): """ Signals processing is complete and runs final storage methods. """ def close(self): """ Commits and closes the database. """
def is_mechanic(user): return user.groups.filter(name='mechanic') # return user.is_superuser def is_mechanic_above(user): return user.groups.filter(name='mechanic') or user.is_superuser # return user.is_superuser
# -*- coding: utf-8 -*- """ Written by Daniel M. Aukes and CONTRIBUTORS Email: danaukes<at>asu.edu. Please see LICENSE for full license. """ class ClassTools(object): def copyattrs(self, source, names): for name in names: setattr(self, name, getattr(source, name)) def copyvalues(self, *args, **kwargs): self.copyattrs(*args, **kwargs) def copyclasses(self, source, names, function): for name in names: classin = getattr(source, name) classout = function(classin) setattr(self, name, classout) def init_copy(self, arglist, kwarglist): args = [getattr(self, name) for name in arglist] kwargs = dict([(name, getattr(self, name)) for name in kwarglist]) return type(self)(*args, **kwargs)
less = "Nimis"; more = "Non satis"; requiredGold = 104; def sumCoinValues(coins): totalValue = 0; for coin in coins: totalValue += coin.value return totalValue def collectAllCoins(): item = hero.findNearest(hero.findItems()) while item: hero.moveXY(item.pos.x, item.pos.y) item = hero.findNearest(hero.findItems()) while True: items = hero.findItems() goldAmount = sumCoinValues(items) if goldAmount != 0: if goldAmount < requiredGold: hero.say(less) elif goldAmount > requiredGold: hero.say(more) else: collectAllCoins()
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 02/12/2017 8:57 PM # @Project : BioQueue # @Author : Li Yao # @File : svn.py def get_sub_protocol(db_obj, protocol_parent, step_order_start=1): steps = list() steps.append(db_obj(software='svn', parameter='checkout {{InputFile}}', parent=protocol_parent, user_id=0, hash='c025d53644388a50fb3704b4a81d5a93', step_order=step_order_start)) return step_order_start+len(steps), steps
n = int(input("> ")) suma = 0 while n > 0: suma += n % 10 n //= 10 print(suma)
# Author: Ashish Jangra from Teenage Coder var_int = 3 var_float = -3.14 var_boolean = False var_string = "True" print(type(var_int)) print(type(var_boolean)) print(type(var_string)) print(type(var_float))
def transform_string(number: int) -> str: if number % 10 == 1: return f'{number} процент' elif number % 10 == 4: return f'{number} процента' elif number % 10 <= 9 : return f'{number} процентов' elif number % 10 <= 0: return f'{number} процентов' for n in range(1, 101): print(transform_string(n))
class Saml: def __init__(self, britive): self.britive = britive self.base_url = f'{self.britive.base_url}/saml' def settings(self, as_list: bool = False) -> any: """ Retrieve the SAML settings for the tenant. For historical reasons there was a time in which multiple SAML settings could exist for a given tenant. This was to support certificate rotation. However a change in certificate issuance occurred and as a result this API call will only ever return 1 item in the list now. As such, `as_list` will default to `False` but returning the data as a list will continue to be supported for backwards compatibility. :param as_list: There is only 1 set of SAML settings per tenant. The API returns the settings as list but since there is only one this python library will return the single settings dict unless this parameter is set to True. :return: Details of the SAML settings for the tenant. """ settings = self.britive.get(f'{self.base_url}/settings') if as_list: return settings return settings[0] def metadata(self) -> str: """ Return the SAML metadata required in the SAML SSO configuration with a service provider. This operation is supported only in AWS and Oracle. The caller is responsible for saving this content to disk, if needed. :return: String representing the SAML XML metadata. """ saml_id = self.settings(as_list=False)['id'] return self.britive.get(f'{self.base_url}/metadata/{saml_id}') def certificate(self): """ Return the SAML certificate required in the SAML SSO configuration with a service provider. This operation is applicable for applications that do not support importing SAML metadata. The caller is responsible for saving this content to disk, if needed. :return: String representing the SAML XML metadata. """ saml_id = self.settings(as_list=False)['id'] return self.britive.get(f'{self.base_url}/certificate/{saml_id}')
# version code d345910f07ae coursera = 1 # Please fill out this stencil and submit using the provided submission script. ## 1: (Task 1) Movie Review ## Task 1 def movie_review(name): """ Input: the name of a movie Output: a string (one of the review options), selected at random using randint """ return ... ## 2: (Task 2) Make Inverse Index def makeInverseIndex(strlist): """ Input: a list of documents as strings Output: a dictionary that maps each word in any document to the set consisting of the document ids (ie, the index in the strlist) for all documents containing the word. Distinguish between an occurence of a string (e.g. "use") in the document as a word (surrounded by spaces), and an occurence of the string as a substring of a word (e.g. "because"). Only the former should be represented in the inverse index. Feel free to use a loop instead of a comprehension. Example: >>> makeInverseIndex(['hello world','hello','hello cat','hellolot of cats']) == {'hello': {0, 1, 2}, 'cat': {2}, 'of': {3}, 'world': {0}, 'cats': {3}, 'hellolot': {3}} True """ pass ## 3: (Task 3) Or Search def orSearch(inverseIndex, query): """ Input: an inverse index, as created by makeInverseIndex, and a list of words to query Output: the set of document ids that contain _any_ of the specified words Feel free to use a loop instead of a comprehension. >>> idx = makeInverseIndex(['Johann Sebastian Bach', 'Johannes Brahms', 'Johann Strauss the Younger', 'Johann Strauss the Elder', ' Johann Christian Bach', 'Carl Philipp Emanuel Bach']) >>> orSearch(idx, ['Bach','the']) {0, 2, 3, 4, 5} >>> orSearch(idx, ['Johann', 'Carl']) {0, 2, 3, 4, 5} """ pass ## 4: (Task 4) And Search def andSearch(inverseIndex, query): """ Input: an inverse index, as created by makeInverseIndex, and a list of words to query Output: the set of all document ids that contain _all_ of the specified words Feel free to use a loop instead of a comprehension. >>> idx = makeInverseIndex(['Johann Sebastian Bach', 'Johannes Brahms', 'Johann Strauss the Younger', 'Johann Strauss the Elder', ' Johann Christian Bach', 'Carl Philipp Emanuel Bach']) >>> andSearch(idx, ['Johann', 'the']) {2, 3} >>> andSearch(idx, ['Johann', 'Bach']) {0, 4} """ pass
ultimo = 0 fila1 = [] fila2 = [] while True: print("\nExistem %d clientes na fila 1 e %d na fila 2." % (len(fila1), len(fila2))) print("Fila 1 atual:", fila1) print("Fila 2 autal:", fila2) print("Digite F para adicionar um cliente ao fim da fila 1 (ou G para fila 2),") print("ou A para realizar o atendimento a fila 1 (ou B para fila 2") print("S para sair.") operacao = input("Operação (F, G, A, B ou S):") x = 0 sair = False while x < len(operacao): if operacao[x] != "A" and operacao[x] != "F": fila = fila2 else: fila = fila1 if operacao[x] == "A" or operacao[x] == "B": if (len(fila)) > 0: atendido = fila.pop(0) print(f"Cliente {atendido}atendido") else: print("Fila vazia! Ninguém para atender.") elif operacao[x] == "F" or operacao[x] == "G": ultimo += 1 fila.append(ultimo) elif operacao[x] == "S": sair = True break else: print("Operação inválida: %s na posição %d! Digite apenas F, A ou S!" % (operacao[x], x)) x = x + 1 if sair: break
a, b, c, x, y = map(int, input().split()) ans = 5000*(10**5)*2 for i in range(max(x, y)+1): tmp_ans = i*2*c if x > i: tmp_ans += (x-i)*a if y > i: tmp_ans += (y-i)*b ans = min(ans, tmp_ans) print(ans)
# Python - 2.7.6 def AddExtra(listOfNumbers): return listOfNumbers + ['']
@dataclass class Position: x: int = 0 y: int = 0 def __matmul__(self, other: tuple[int, int]) -> None: self.x = other[0] self.y = other[1]
# -*- coding: utf-8 -*- info = { "name": "is", "date_order": "DMY", "january": [ "janúar", "jan" ], "february": [ "febrúar", "feb" ], "march": [ "mars", "mar" ], "april": [ "apríl", "apr" ], "may": [ "maí" ], "june": [ "júní", "jún" ], "july": [ "júlí", "júl" ], "august": [ "ágúst", "ágú" ], "september": [ "september", "sep" ], "october": [ "október", "okt" ], "november": [ "nóvember", "nóv" ], "december": [ "desember", "des" ], "monday": [ "mánudagur", "mán" ], "tuesday": [ "þriðjudagur", "þri" ], "wednesday": [ "miðvikudagur", "mið" ], "thursday": [ "fimmtudagur", "fim" ], "friday": [ "föstudagur", "fös" ], "saturday": [ "laugardagur", "lau" ], "sunday": [ "sunnudagur", "sun" ], "am": [ "fh" ], "pm": [ "eh" ], "year": [ "ár" ], "month": [ "mánuður", "mán" ], "week": [ "vika", "v" ], "day": [ "dagur", "d" ], "hour": [ "klukkustund", "klst" ], "minute": [ "mínúta", "mín" ], "second": [ "sekúnda", "sek" ], "relative-type": { "1 year ago": [ "á síðasta ári" ], "0 year ago": [ "á þessu ári" ], "in 1 year": [ "á næsta ári" ], "1 month ago": [ "í síðasta mánuði", "í síðasta mán" ], "0 month ago": [ "í þessum mánuði", "í þessum mán" ], "in 1 month": [ "í næsta mánuði", "í næsta mán" ], "1 week ago": [ "í síðustu viku" ], "0 week ago": [ "í þessari viku" ], "in 1 week": [ "í næstu viku" ], "1 day ago": [ "í gær" ], "0 day ago": [ "í dag" ], "in 1 day": [ "á morgun" ], "0 hour ago": [ "this hour" ], "0 minute ago": [ "this minute" ], "0 second ago": [ "núna" ] }, "relative-type-regex": { "in \\1 year": [ "eftir (\\d+) ár" ], "\\1 year ago": [ "fyrir (\\d+) ári", "fyrir (\\d+) árum" ], "in \\1 month": [ "eftir (\\d+) mánuð", "eftir (\\d+) mánuði", "eftir (\\d+) mán" ], "\\1 month ago": [ "fyrir (\\d+) mánuði", "fyrir (\\d+) mánuðum", "fyrir (\\d+) mán" ], "in \\1 week": [ "eftir (\\d+) viku", "eftir (\\d+) vikur" ], "\\1 week ago": [ "fyrir (\\d+) viku", "fyrir (\\d+) vikum" ], "in \\1 day": [ "eftir (\\d+) dag", "eftir (\\d+) daga" ], "\\1 day ago": [ "fyrir (\\d+) degi", "fyrir (\\d+) dögum" ], "in \\1 hour": [ "eftir (\\d+) klukkustund", "eftir (\\d+) klukkustundir", "eftir (\\d+) klst" ], "\\1 hour ago": [ "fyrir (\\d+) klukkustund", "fyrir (\\d+) klukkustundum", "fyrir (\\d+) klst" ], "in \\1 minute": [ "eftir (\\d+) mínútu", "eftir (\\d+) mínútur", "eftir (\\d+) mín" ], "\\1 minute ago": [ "fyrir (\\d+) mínútu", "fyrir (\\d+) mínútum", "fyrir (\\d+) mín" ], "in \\1 second": [ "eftir (\\d+) sekúndu", "eftir (\\d+) sekúndur", "eftir (\\d+) sek" ], "\\1 second ago": [ "fyrir (\\d+) sekúndu", "fyrir (\\d+) sekúndum", "fyrir (\\d+) sek" ] }, "locale_specific": {}, "skip": [ " ", ".", ",", ";", "-", "/", "'", "|", "@", "[", "]", "," ] }
# testlist_comp # : (test | star_expr) (comp_for | (COMMA (test | star_expr))* COMMA?) # ; # test [x] # star_expr comp_for [z for z in a] # test COMMA star_expr COMMA [x, *a,] # star_expr COMMA test COMMA star_expr [*u, a, *i]
"""Errors not related to the Telegram API itself""" class ReadCancelledError(Exception): """Occurs when a read operation was cancelled.""" def __init__(self): super().__init__(self, 'The read operation was cancelled.') class TypeNotFoundError(Exception): """ Occurs when a type is not found, for example, when trying to read a TLObject with an invalid constructor code. """ def __init__(self, invalid_constructor_id): super().__init__( self, 'Could not find a matching Constructor ID for the TLObject ' 'that was supposed to be read with ID {}. Most likely, a TLObject ' 'was trying to be read when it should not be read.' .format(hex(invalid_constructor_id))) self.invalid_constructor_id = invalid_constructor_id class InvalidChecksumError(Exception): """ Occurs when using the TCP full mode and the checksum of a received packet doesn't match the expected checksum. """ def __init__(self, checksum, valid_checksum): super().__init__( self, 'Invalid checksum ({} when {} was expected). ' 'This packet should be skipped.' .format(checksum, valid_checksum)) self.checksum = checksum self.valid_checksum = valid_checksum class BrokenAuthKeyError(Exception): """ Occurs when the authorization key for a data center is not valid. """ def __init__(self): super().__init__( self, 'The authorization key is broken, and it must be reset.' ) class SecurityError(Exception): """ Generic security error, mostly used when generating a new AuthKey. """ def __init__(self, *args): if not args: args = ['A security check failed.'] super().__init__(self, *args) class CdnFileTamperedError(SecurityError): """ Occurs when there's a hash mismatch between the decrypted CDN file and its expected hash. """ def __init__(self): super().__init__( 'The CDN file has been altered and its download cancelled.' )
def foo(x): return 1/x def zoo(x): res = foo(x) return res print(zoo(0))
# Desenvolva um programa que leia quatro valores pelo teclado e guarde-os em uma tupla. No final, mostre: # A) Quantas vezes apareceu o valor 9. # B) Em que posição foi digitado o primeiro valor 3. # C) Quais foram os números pares. numero = (int(input('Digite o 1º número: ')), int(input('Digite o 2º número: ')), int(input('Digite o 3º número ')), int(input('Digite o 4º número '))) print('—' * 50) print(f'Você digitou os valores {numero}') print('—' * 50) print(f'O valor 9 apareceu {numero.count(9)} vezes') print('—' * 50) if 3 in numero: print(f'O valor 3 apareceu na {numero.index(3) + 1}ª posição') print('—' * 50) else: print('Valor 3 não foi digitado em nenhuma posição') print('—' * 50) print(f'Os valores pares digitados foram ', end='') for num in numero: if num % 2 == 0: print(num, end=' ') print() print('—' * 50)
# Email Configuration EMAIL_PORT = 587 EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_USER = '[email protected]' EMAIL_HOST_PASSWORD = 'bob' EMAIL_USE_TLS = True
self.description = "dir->symlink change during package upgrade (conflict)" p1 = pmpkg("pkg1", "1.0-1") p1.files = ["test/", "test/file1", "test/dir/file1", "test/dir/file2"] self.addpkg2db("local", p1) p2 = pmpkg("pkg2") p2.files = ["test/dir/file3"] self.addpkg2db("local", p2) p3 = pmpkg("pkg1", "2.0-1") p3.files = ["test2/", "test2/file3", "test -> test2"] self.addpkg2db("sync", p3) self.args = "-S pkg1" self.addrule("PACMAN_RETCODE=1") self.addrule("PKG_EXIST=pkg1") self.addrule("PKG_VERSION=pkg1|1.0-1")
# __about__.py # # Copyright (C) 2006-2020 wolfSSL Inc. # # This file is part of wolfSSL. # # wolfSSL is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # wolfSSL is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA #/ metadata = dict( __name__ = "wolfcrypt", __version__ = "0.1.9", __license__ = "GPLv2 or Commercial License", __author__ = "wolfSSL Inc.", __author_email__ = "[email protected]", __url__ = "https://wolfssl.github.io/wolfcrypt-py", __description__ = \ u"A Python library that encapsulates wolfSSL's wolfCrypt API.", __keywords__ = "security, cryptography, ssl, embedded, embedded ssl", __classifiers__ = [ u"License :: OSI Approved :: GNU General Public License v2 (GPLv2)", u"License :: Other/Proprietary License", u"Operating System :: OS Independent", u"Programming Language :: Python :: 2.7", u"Programming Language :: Python :: 3.5", u"Topic :: Security", u"Topic :: Security :: Cryptography", u"Topic :: Software Development" ] ) globals().update(metadata) __all__ = list(metadata.keys())
class Notifier: def __init__(self, transporter): self.transporter = transporter def log(self, s): self.transporter.send('logs', s) def error(self, message, stack): self.transporter.send('process:exception', { 'message': message, 'stack': stack })
# sub_tasks_no_name.py data_sets = ['Tmean', 'Sunshine'] def task_reformat_data(): """Reformats all raw files for easier analysis""" for data_type in data_sets: yield { 'actions': ['python reformat_weather_data.py %(dependencies)s > %(targets)s'], 'file_dep': ['UK_{}_data.txt'.format(data_type)], 'targets': ['UK_{}_data.reformatted.txt'.format(data_type)], }
def isPalindrome(s): """ :type s: str :rtype: bool """ s = "".join([i.lower() for i in s if i.isalnum()]) if len(s) == 0: return True count = -1 for i in range(len(s)): if s[i] == s[count]: count -= 1 else: return False return True Input = "A man, a plan, a canal: Panama" print(isPalindrome(Input)) # Output: true
class Registry: def __init__(self): self._registered_methods = {} def namespaces(self): return list(self._registered_methods) def methods(self, *namespace_path): return self._registered_methods[namespace_path] def clear(self): self._registered_methods = {} def register_at(self, *namespace_path, name="new", **call_options): def wrapper(fn): registry_namespace = self._registered_methods.setdefault(namespace_path, {}) if name in registry_namespace: raise ValueError( "Name '{}' is already registered in namespace {}".format( name, namespace_path ) ) registry_namespace[name] = Method(fn, call_options) return fn return wrapper class Method: def __init__(self, fn, call_options): self.fn = fn self.call_options = call_options registry = Registry() register_at = registry.register_at
#Crie um programa que leia a idade e o sexo de várias pessoas. #A cada pessoa cadastrada, o programa deverá perguntar se o usuário #quer ou não continuar. No final, mostre: #A) - Quantas pessoas são maiores de 18 anos #B) - Quantos homens foram cadastrados #C) - Quantas mulheres tem menos de 20 anos maiores = homens = mulheres20 = 0 while True: print('-' * 30) print(f'{"Cadastro de pessoas":^30}') print('-' * 30) idade = int(input('Idade: ')) if idade > 18: maiores += 1 while True: sexo = str(input('Sexo [M/F]: ')).strip().upper()[0] if sexo == 'M': homens += 1 break if sexo == 'F' and idade > 20: mulheres20 += 1 break if sexo == 'F' and idade <= 20: break if sexo not in 'MF': print('Escolha somente M ou F') while True: escolha = str(input('Deseja continuar [S/N]: ')).strip().upper()[0] if escolha not in 'SN': print('Escolha somente S ou N') if escolha == 'S': break if escolha == 'N': break if escolha == 'N': break print('-='*22) print(f'Ao todo {maiores} pessoas são maiores de 18 anos') print(f'Ao todo foram {homens} homens cadastrados') print(f'Ao todo {mulheres20} mulheres tem mais de 20 anos') print('-='*22)
class AppRoutes: def __init__(self) -> None: self.prefix = "/api" self.users_sign_ups = "/api/users/sign-ups" self.auth_token = "/api/auth/token" self.auth_token_long = "/api/auth/token/long" self.auth_refresh = "/api/auth/refresh" self.users = "/api/users" self.users_self = "/api/users/self" self.groups = "/api/groups" self.groups_self = "/api/groups/self" self.recipes = "/api/recipes" self.recipes_category = "/api/recipes/category" self.recipes_tag = "/api/recipes/tag" self.categories = "/api/categories" self.recipes_tags = "/api/recipes/tags/" self.recipes_create = "/api/recipes/create" self.recipes_create_url = "/api/recipes/create-url" self.meal_plans_all = "/api/meal-plans/all" self.meal_plans_create = "/api/meal-plans/create" self.meal_plans_this_week = "/api/meal-plans/this-week" self.meal_plans_today = "/api/meal-plans/today" self.site_settings_custom_pages = "/api/site-settings/custom-pages" self.site_settings = "/api/site-settings" self.site_settings_webhooks_test = "/api/site-settings/webhooks/test" self.themes = "/api/themes" self.themes_create = "/api/themes/create" self.backups_available = "/api/backups/available" self.backups_export_database = "/api/backups/export/database" self.backups_upload = "/api/backups/upload" self.migrations = "/api/migrations" self.debug_version = "/api/debug/version" self.debug_last_recipe_json = "/api/debug/last-recipe-json" def users_sign_ups_token(self, token): return f"{self.prefix}/users/sign-ups/{token}" def users_id(self, id): return f"{self.prefix}/users/{id}" def users_id_reset_password(self, id): return f"{self.prefix}/users/{id}/reset-password" def users_id_image(self, id): return f"{self.prefix}/users/{id}/image" def users_id_password(self, id): return f"{self.prefix}/users/{id}/password" def groups_id(self, id): return f"{self.prefix}/groups/{id}" def categories_category(self, category): return f"{self.prefix}/categories/{category}" def recipes_tags_tag(self, tag): return f"{self.prefix}/recipes/tags/{tag}" def recipes_recipe_slug(self, recipe_slug): return f"{self.prefix}/recipes/{recipe_slug}" def recipes_recipe_slug_image(self, recipe_slug): return f"{self.prefix}/recipes/{recipe_slug}/image" def meal_plans_plan_id(self, plan_id): return f"{self.prefix}/meal-plans/{plan_id}" def meal_plans_id_shopping_list(self, id): return f"{self.prefix}/meal-plans/{id}/shopping-list" def site_settings_custom_pages_id(self, id): return f"{self.prefix}/site-settings/custom-pages/{id}" def themes_theme_name(self, theme_name): return f"{self.prefix}/themes/{theme_name}" def backups_file_name_download(self, file_name): return f"{self.prefix}/backups/{file_name}/download" def backups_file_name_import(self, file_name): return f"{self.prefix}/backups/{file_name}/import" def backups_file_name_delete(self, file_name): return f"{self.prefix}/backups/{file_name}/delete" def migrations_source_file_name_import(self, source, file_name): return f"{self.prefix}/migrations/{source}/{file_name}/import" def migrations_source_file_name_delete(self, source, file_name): return f"{self.prefix}/migrations/{source}/{file_name}/delete" def migrations_source_upload(self, source): return f"{self.prefix}/migrations/{source}/upload" def debug_log_num(self, num): return f"{self.prefix}/debug/log/{num}"
release_major = 2 release_minor = 3 release_patch = 0 release_so_abi_rev = 2 # These are set by the distribution script release_vc_rev = None release_datestamp = 0 release_type = 'unreleased'
# -*- coding: utf-8 -*- def two_sum(nums, target): if ((nums is None) or not isinstance(nums, list) or len(nums) == 0): return False nums.sort() low, high = 0, len(nums) - 1 while low < high: total = nums[low] + nums[high] if total < target: while low + 1 < high and nums[low] == nums[low + 1]: low += 1 low += 1 elif total > target: while high - 1 >= low and nums[high - 1] == nums[high]: high -= 1 high -= 1 else: return True return False if __name__ == '__main__': nums = [10, 15, 3, 7] k = 17 print(' Input:', nums, sep=' ') print(' Target: ', k, sep=' ') found = two_sum(nums, k) print('', 'found' if found else 'NOT found')
"""Top-level package for Nexia.""" __version__ = "0.1.0" ROOT_URL = "https://www.mynexia.com" MOBILE_URL = f"{ROOT_URL}/mobile" DEFAULT_DEVICE_NAME = "Home Automation" PUT_UPDATE_DELAY = 0.5 HOLD_PERMANENT = "permanent_hold" HOLD_RESUME_SCHEDULE = "run_schedule" OPERATION_MODE_AUTO = "AUTO" OPERATION_MODE_COOL = "COOL" OPERATION_MODE_HEAT = "HEAT" OPERATION_MODE_OFF = "OFF" OPERATION_MODES = [ OPERATION_MODE_AUTO, OPERATION_MODE_COOL, OPERATION_MODE_HEAT, OPERATION_MODE_OFF, ] # The order of these is important as it maps to preset# PRESET_MODE_HOME = "Home" PRESET_MODE_AWAY = "Away" PRESET_MODE_SLEEP = "Sleep" PRESET_MODE_NONE = "None" SYSTEM_STATUS_COOL = "Cooling" SYSTEM_STATUS_HEAT = "Heating" SYSTEM_STATUS_WAIT = "Waiting..." SYSTEM_STATUS_IDLE = "System Idle" AIR_CLEANER_MODE_AUTO = "auto" AIR_CLEANER_MODE_QUICK = "quick" AIR_CLEANER_MODE_ALLERGY = "allergy" AIR_CLEANER_MODES = [ AIR_CLEANER_MODE_AUTO, AIR_CLEANER_MODE_QUICK, AIR_CLEANER_MODE_ALLERGY, ] HUMIDITY_MIN = 0.35 HUMIDITY_MAX = 0.65 APP_VERSION = "5.9.0" UNIT_CELSIUS = "C" UNIT_FAHRENHEIT = "F" DAMPER_CLOSED = "Damper Closed" DAMPER_OPEN = "Damper Open" ZONE_IDLE = "Idle" ALL_IDS = "all"
"""Device capabilities.""" # API Version 1.0.5 DEV_TYPES = { 1: "Washing Machine", 2: "Thumble Dryer", 7: "Dishwasher", 19: "Fridge", 20: "Freezer", 74: "TwoInOne Hob", } STATE_CAPABILITIES = { 19: { "ProgramID", "status", "programType", "targetTemperature", "temperature", "signalInfo", "signalFailure", "signalDoor", "remoteEnable", }, 20: { "ProgramID", "status", "programType", "targetTemperature", "temperature", "signalInfo", "signalFailure", "signalDoor", "remoteEnable", }, } ACTION_CAPABILITIES = { 19: {"targetTemperature", "startSupercooling"}, 20: {"targetTemperature", "startSuperfreezing"}, } LIVE_ACTION_CAPABILITIES = { "711934968": { "processAction": [4], "light": [], "ambientLight": [], "startTime": [], "ventilationStep": [], "programId": [], "targetTemperature": [{"zone": 1, "min": -26, "max": -16}], "deviceName": True, "powerOn": False, "powerOff": False, "colors": [], "modes": [1], }, "711944869": { "processAction": [6], "light": [], "ambientLight": [], "startTime": [], "ventilationStep": [], "programId": [], "targetTemperature": [{"zone": 1, "min": 1, "max": 9}], "deviceName": True, "powerOn": False, "powerOff": False, "colors": [], "modes": [1], }, } TEST_DATA_7 = { "ident": { "type": { "key_localized": "Device type", "value_raw": 7, "value_localized": "Dishwasher", }, "deviceName": "", "protocolVersion": 2, "deviceIdentLabel": { "fabNumber": "<fabNumber1>", "fabIndex": "64", "techType": "G6865-W", "matNumber": "<matNumber1>", "swids": [ "<swid1>", "<swid2>", "<swid3>", "<...>", ], }, "xkmIdentLabel": {"techType": "EK039W", "releaseVersion": "02.72"}, }, "state": { "ProgramID": { "value_raw": 38, "value_localized": "QuickPowerWash", "key_localized": "Program name", }, "status": { "value_raw": 5, "value_localized": "In use", "key_localized": "status", }, "programType": { "value_raw": 2, "value_localized": "Automatic programme", "key_localized": "Program type", }, "programPhase": { "value_raw": 1799, "value_localized": "Drying", "key_localized": "Program phase", }, "remainingTime": [0, 15], "startTime": [0, 0], "targetTemperature": [ {"value_raw": -32768, "value_localized": None, "unit": "Celsius"} ], "temperature": [ {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, ], "signalInfo": False, "signalFailure": False, "signalDoor": False, "remoteEnable": { "fullRemoteControl": True, "smartGrid": False, "mobileStart": False, }, "ambientLight": None, "light": None, "elapsedTime": [0, 59], "spinningSpeed": { "unit": "rpm", "value_raw": None, "value_localized": None, "key_localized": "Spin speed", }, "dryingStep": { "value_raw": None, "value_localized": "", "key_localized": "Drying level", }, "ventilationStep": { "value_raw": None, "value_localized": "", "key_localized": "Fan level", }, "plateStep": [], "ecoFeedback": { "currentWaterConsumption": { "unit": "l", "value": 12, }, "currentEnergyConsumption": { "unit": "kWh", "value": 1.4, }, "waterForecast": 0.2, "energyForecast": 0.1, }, "batteryLevel": None, }, } TEST_DATA_18 = { "ident": { "type": { "key_localized": "Device type", "value_raw": 18, "value_localized": "Cooker Hood", }, "deviceName": "", "protocolVersion": 2, "deviceIdentLabel": { "fabNumber": "<fabNumber3>", "fabIndex": "64", "techType": "Fläkt", "matNumber": "<matNumber3>", "swids": [ "<swid1>", "<swid2>", "<swid3>", "<...>", ], }, "xkmIdentLabel": {"techType": "EK039W", "releaseVersion": "02.72"}, }, "state": { "ProgramID": { "value_raw": 1, "value_localized": "Off", "key_localized": "Program name", }, "status": { "value_raw": 1, "value_localized": "Off", "key_localized": "status", }, "programType": { "value_raw": 0, "value_localized": "Program", "key_localized": "Program type", }, "programPhase": { "value_raw": 4608, "value_localized": "", "key_localized": "Program phase", }, "remainingTime": [0, 0], "startTime": [0, 0], "targetTemperature": [ {"value_raw": -32768, "value_localized": None, "unit": "Celsius"} ], "temperature": [ {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, ], "signalInfo": False, "signalFailure": False, "signalDoor": False, "remoteEnable": { "fullRemoteControl": True, "smartGrid": False, "mobileStart": False, }, "ambientLight": 2, "light": 2, "elapsedTime": {}, "spinningSpeed": { "unit": "rpm", "value_raw": None, "value_localized": None, "key_localized": "Spin speed", }, "dryingStep": { "value_raw": None, "value_localized": "", "key_localized": "Drying level", }, "ventilationStep": { "value_raw": 0, "value_localized": "0", "key_localized": "Fan level", }, "plateStep": [], "ecoFeedback": None, "batteryLevel": None, }, } TEST_DATA_21 = { "ident": { "type": { "key_localized": "Device type", "value_raw": 21, "value_localized": "Fridge freezer", }, "deviceName": "", "protocolVersion": 203, "deviceIdentLabel": { "fabNumber": "**REDACTED**", "fabIndex": "00", "techType": "KFN 7734 D", "matNumber": "11642200", "swids": ["000"], }, "xkmIdentLabel": { "techType": "EK037LHBM", "releaseVersion": "32.15", }, }, "state": { "ProgramID": { "value_raw": 0, "value_localized": "", "key_localized": "Program name", }, "status": { "value_raw": 5, "value_localized": "In use", "key_localized": "status", }, "programType": { "value_raw": 0, "value_localized": "Program", "key_localized": "Program type", }, "programPhase": { "value_raw": 0, "value_localized": "", "key_localized": "Program phase", }, "remainingTime": [0, 0], "startTime": [0, 0], "targetTemperature": [ {"value_raw": 500, "value_localized": 5.0, "unit": "Celsius"}, {"value_raw": -1800, "value_localized": -18.0, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, ], "temperature": [ {"value_raw": 493, "value_localized": 4.93, "unit": "Celsius"}, {"value_raw": -1807, "value_localized": -18.07, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, ], "signalInfo": False, "signalFailure": False, "signalDoor": False, "remoteEnable": { "fullRemoteControl": True, "smartGrid": False, "mobileStart": False, }, "ambientLight": None, "light": None, "elapsedTime": [], "spinningSpeed": { "unit": "rpm", "value_raw": None, "value_localized": "", "key_localized": "Spin speed", }, "dryingStep": { "value_raw": None, "value_localized": "", "key_localized": "Drying level", }, "ventilationStep": { "value_raw": None, "value_localized": "", "key_localized": "Fan level", }, "plateStep": [], "ecoFeedback": None, "batteryLevel": None, }, } TEST_DATA_24 = { "ident": { "type": { "key_localized": "Device type", "value_raw": 24, "value_localized": "Washer dryer", }, "deviceName": "", "protocolVersion": 4, "deviceIdentLabel": { "fabNumber": "<fabNumber2>", "fabIndex": "32", "techType": "WTR870", "matNumber": "<matNumber2>", "swids": [ "<swid1>", "<swid2>", "<swid3>", "<...>", ], }, "xkmIdentLabel": {"techType": "EK037", "releaseVersion": "03.88"}, }, "state": { "ProgramID": { "value_raw": 3, "value_localized": "Minimum iron", "key_localized": "Program name", }, "status": {"value_raw": 1, "value_localized": "Off", "key_localized": "status"}, "programType": { "value_raw": 1, "value_localized": "Own programme", "key_localized": "Program type", }, "programPhase": { "value_raw": 256, "value_localized": "", "key_localized": "Program phase", }, "remainingTime": [1, 59], "startTime": [0, 0], "targetTemperature": [ {"value_raw": 3000, "value_localized": 30, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, ], "temperature": [ {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, ], "signalInfo": False, "signalFailure": False, "signalDoor": True, "remoteEnable": { "fullRemoteControl": True, "smartGrid": False, "mobileStart": False, }, "ambientLight": None, "light": None, "elapsedTime": [0, 0], "spinningSpeed": { "unit": "rpm", "value_raw": 1000, "value_localized": "1000", "key_localized": "Spin speed", }, "dryingStep": { "value_raw": 0, "value_localized": "", "key_localized": "Drying level", }, "ventilationStep": { "value_raw": None, "value_localized": "", "key_localized": "Fan level", }, "plateStep": [], "ecoFeedback": None, "batteryLevel": None, }, } TEST_DATA_74 = { "ident": { "type": { "key_localized": "Device type", "value_raw": 74, "value_localized": "", }, "deviceName": "", "protocolVersion": 203, "deviceIdentLabel": { "fabNumber": "**REDACTED**", "fabIndex": "00", "techType": "KMDA7634", "matNumber": "", "swids": ["000"], }, "xkmIdentLabel": { "techType": "EK039W", "releaseVersion": "02.72", }, }, "state": { "ProgramID": { "value_raw": 0, "value_localized": "", "key_localized": "Program name", }, "status": { "value_raw": 5, "value_localized": "In use", "key_localized": "status", }, "programType": { "value_raw": 0, "value_localized": "Program", "key_localized": "Program type", }, "programPhase": { "value_raw": 0, "value_localized": "", "key_localized": "Program phase", }, "remainingTime": [0, 0], "startTime": [0, 0], "targetTemperature": [ {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, ], "temperature": [ {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, ], "signalInfo": False, "signalFailure": False, "signalDoor": False, "remoteEnable": { "fullRemoteControl": True, "smartGrid": False, "mobileStart": False, }, "ambientLight": None, "light": None, "elapsedTime": [], "spinningSpeed": { "unit": "rpm", "value_raw": None, "value_localized": "", "key_localized": "Spin speed", }, "dryingStep": { "value_raw": None, "value_localized": "", "key_localized": "Drying level", }, "ventilationStep": { "value_raw": None, "value_localized": "", "key_localized": "Fan level", }, "plateStep": [ {"value_raw": 0, "value_localized": 0, "key_localized": "Power level"}, {"value_raw": 3, "value_localized": 2, "key_localized": "Power level"}, {"value_raw": 7, "value_localized": 4, "key_localized": "Power level"}, {"value_raw": 15, "value_localized": 8, "key_localized": "Power level"}, {"value_raw": 117, "value_localized": 10, "key_localized": "Power level"}, ], "ecoFeedback": None, "batteryLevel": None, }, } TEST_DATA_TEMPLATE = { "ident": { "type": { "key_localized": "Device type", "value_raw": 0, "value_localized": "Template", }, "deviceName": "", "protocolVersion": 203, "deviceIdentLabel": { "fabNumber": "**REDACTED**", "fabIndex": "00", "techType": "", "matNumber": "", "swids": ["000"], }, "xkmIdentLabel": { "techType": "", "releaseVersion": "", }, }, "state": { "ProgramID": { "value_raw": 0, "value_localized": "", "key_localized": "Program name", }, "status": { "value_raw": 5, "value_localized": "In use", "key_localized": "status", }, "programType": { "value_raw": 0, "value_localized": "Program", "key_localized": "Program type", }, "programPhase": { "value_raw": 0, "value_localized": "", "key_localized": "Program phase", }, "remainingTime": [0, 0], "startTime": [0, 0], "targetTemperature": [ {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, ], "temperature": [ {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, ], "signalInfo": False, "signalFailure": False, "signalDoor": False, "remoteEnable": { "fullRemoteControl": True, "smartGrid": False, "mobileStart": False, }, "ambientLight": None, "light": None, "elapsedTime": [], "spinningSpeed": { "unit": "rpm", "value_raw": None, "value_localized": "", "key_localized": "Spin speed", }, "dryingStep": { "value_raw": None, "value_localized": "", "key_localized": "Drying level", }, "ventilationStep": { "value_raw": None, "value_localized": "", "key_localized": "Fan level", }, "plateStep": [], "ecoFeedback": None, "batteryLevel": None, }, } TEST_ACTION_21 = { "processAction": [4, 6], "light": [], "ambientLight": [], "startTime": [], "ventilationStep": [], "programId": [], "targetTemperature": [ {"zone": 1, "min": 1, "max": 9}, {"zone": 2, "min": -26, "max": -16}, ], "deviceName": True, "powerOn": False, "powerOff": True, "colors": [], "modes": [1], "programs": [], "id_log": [], }
''' Python program which adds up columns and rows of given table as shown in the specified figure Input number of rows/columns (0 to exit) 4 Input cell value: 25 69 51 26 68 35 29 54 54 57 45 63 61 68 47 59 Result: 25 69 51 26 171 68 35 29 54 186 54 57 45 63 219 61 68 47 59 235 208 229 172 202 811 Input number of rows/columns (0 to exit) ''' while True: print("Input number of rows/columns (0 to exit)") n = int(input()) if n == 0: break print("Input cell value:") x = [] for i in range(n): x.append([int(num) for num in input().split()]) for i in range(n): sum = 0 for j in range(n): sum += x[i][j] x[i].append(sum) x.append([]) for i in range(n + 1): sum = 0 for j in range(n): sum += x[j][i] x[n].append(sum) print("Result:") for i in range(n + 1): for j in range(n + 1): print('{0:>5}'.format(x[i][j]), end="") print()
# -*- coding: utf-8 -*- """ Created on Tue May 28 19:29:10 2019 @author: ASUS """ #import numpy as np #def factorial(): # my_array = [] # for i in range(5): # my_array.append(int(input("Enter number: "))) # my_array = np.array(my_array) # print(np.floor(my_array)) # #factorial() def factorial(n): if(n <= 1): return 1 else: return(n*factorial(n-1)) n = int(input("Enter number: ")) print(factorial(n))
# Set up the winner variable to hold None winner = None print('winner:', winner) print('winner is None:', winner is None) print('winner is not None:', winner is not None) print(type(winner)) # Now set winner to be True print('Set winner to True') winner = True print('winner:', winner) print('winner is None:', winner is None) print('winner is not None:', winner is not None) print(type(winner))
# This should cover all the syntactical constructs that we hope to support # Intended sources should be the variable `SOURCE` and intended sinks should be # arguments to the function `SINK` (see python/ql/test/experimental/dataflow/testConfig.qll). # # Functions whose name ends with "_with_local_flow" will also be tested for local flow. # These are included so that we can easily evaluate the test code SOURCE = "source" def SINK(x): print(x) def test_tuple_with_local_flow(): x = (3, SOURCE) y = x[1] SINK(y) # List taken from https://docs.python.org/3/reference/expressions.html # 6.2.1. Identifiers (Names) def test_names(): x = SOURCE SINK(x) # 6.2.2. Literals def test_string_literal(): x = "source" SINK(x) def test_bytes_literal(): x = b"source" SINK(x) def test_integer_literal(): x = 42 SINK(x) def test_floatnumber_literal(): x = 42.0 SINK(x) def test_imagnumber_literal(): x = 42j SINK(x) # 6.2.3. Parenthesized forms def test_parenthesized_form(): x = (SOURCE) SINK(x) # 6.2.5. List displays def test_list_display(): x = [SOURCE] SINK(x[0]) def test_list_comprehension(): x = [SOURCE for y in [3]] SINK(x[0]) def test_nested_list_display(): x = [* [SOURCE]] SINK(x[0]) # 6.2.6. Set displays def test_set_display(): x = {SOURCE} SINK(x.pop()) def test_set_comprehension(): x = {SOURCE for y in [3]} SINK(x.pop()) def test_nested_set_display(): x = {* {SOURCE}} SINK(x.pop()) # 6.2.7. Dictionary displays def test_dict_display(): x = {"s": SOURCE} SINK(x["s"]) def test_dict_comprehension(): x = {y: SOURCE for y in ["s"]} SINK(x["s"]) def test_nested_dict_display(): x = {** {"s": SOURCE}} SINK(x["s"]) # 6.2.8. Generator expressions def test_generator(): x = (SOURCE for y in [3]) SINK([*x][0]) # List taken from https://docs.python.org/3/reference/expressions.html # 6. Expressions # 6.1. Arithmetic conversions # 6.2. Atoms # 6.2.1. Identifiers (Names) # 6.2.2. Literals # 6.2.3. Parenthesized forms # 6.2.4. Displays for lists, sets and dictionaries # 6.2.5. List displays # 6.2.6. Set displays # 6.2.7. Dictionary displays # 6.2.8. Generator expressions # 6.2.9. Yield expressions # 6.2.9.1. Generator-iterator methods # 6.2.9.2. Examples # 6.2.9.3. Asynchronous generator functions # 6.2.9.4. Asynchronous generator-iterator methods # 6.3. Primaries # 6.3.1. Attribute references # 6.3.2. Subscriptions # 6.3.3. Slicings # 6.3.4. Calls # 6.4. Await expression # 6.5. The power operator # 6.6. Unary arithmetic and bitwise operations # 6.7. Binary arithmetic operations # 6.8. Shifting operations # 6.9. Binary bitwise operations # 6.10. Comparisons # 6.10.1. Value comparisons # 6.10.2. Membership test operations # 6.10.3. Identity comparisons # 6.11. Boolean operations # 6.12. Assignment expressions # 6.13. Conditional expressions # 6.14. Lambdas # 6.15. Expression lists # 6.16. Evaluation order # 6.17. Operator precedence
''' @Description: @Author: 妄想 @Date: 2020-06-23 13:27:00 @LastEditTime: 2020-06-25 14:42:17 @LastEditors: 妄想 ''' # -*- coding: utf-8 -*- # Scrapy settings for myspider project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # https://docs.scrapy.org/en/latest/topics/settings.html # https://docs.scrapy.org/en/latest/topics/downloader-middleware.html # https://docs.scrapy.org/en/latest/topics/spider-middleware.html BOT_NAME = 'myspider' SPIDER_MODULES = ['myspider.spiders'] NEWSPIDER_MODULE = 'myspider.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent #USER_AGENT = 'myspider (+http://www.yourdomain.com)' # Obey robots.txt rules ROBOTSTXT_OBEY = True # Configure maximum concurrent requests performed by Scrapy (default: 16) #CONCURRENT_REQUESTS = 32 # Configure a delay for requests for the same website (default: 0) # See https://docs.scrapy.org/en/latest/topics/settings.html#download-delay # See also autothrottle settings and docs DOWNLOAD_DELAY = 3 DOWNLOADER_MIDDLEWARES = { 'scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware': 110, # "myspider.Proxy_Middleware.ProxyMiddleware":100, 'scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware': 100, 'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware': 550, 'scrapy.downloadermiddlewares.ajaxcrawl.AjaxCrawlMiddleware': 560, 'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware': 590, # 'scrapy.downloadermiddlewares.chunked.ChunkedTransferMiddleware': 830, 'scrapy.downloadermiddlewares.stats.DownloaderStats': 850, 'myspider.timeout_middleware.Timeout_Middleware':610, 'scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware': None, 'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware': 300, 'scrapy.downloadermiddlewares.retry.RetryMiddleware': None, 'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware': None, 'scrapy.downloadermiddlewares.redirect.RedirectMiddleware': 400, 'scrapy.downloadermiddlewares.cookies.CookiesMiddleware': None, 'scrapy.downloadermiddlewares.httpcache.HttpCacheMiddleware': None, 'myspider.useragent_dowmload_middleware.RotateUserAgentMiddleware':400, # 'myspider.redirect_middleware.Redirect_Middleware':500, } #设置数据入库pipline ITEM_PIPELINES = { 'myspider.mysql_pipeline.MysqlPipeline': 10, } # Disable cookies (enabled by default) COOKIES_ENABLED = False # redis # 调度器,在 redis 里分配请求 SCHEDULER = "scrapy_redis.scheduler.Scheduler" # 去重 DUPEFILTER_CLASS = "scrapy_redis.dupefilter.RFPDupeFilter" # 在 redis 中保持 scrapy-redis 用到的各个队列,从而允许暂停和暂停后恢复,即不清理 redis queue SCHEDULER_PERSIST = True # ITEM_PIPELINES={ # 'scrapy_redis.pipelines.RedisPipeline': 400, # } SCHEDULER_QUEUE_CLASS = 'scrapy_redis.queue.SpiderPriorityQueue' REDIS_HOST = '120.26.177.209' REDIS_PORT = '6379' REDIS_ENCODING = 'utf-8' REDIS_PARAMS = {'password': '123456'}
n = int(input()) prime=0 for i in range(n-1,0,-1): if i==2: prime = i elif(i>2): st=True for j in range(2,int(n**0.5)+1): if(i%j==0): st=False break if(st): prime = i break s_prime=0 for i in range(n+1,n+(n-prime)): if(i>2): st=True for j in range(2,int(n**0.5)+1): if(i%j==0): st=False break if(st): s_prime=i break else: break if(s_prime!=0 and (n-prime > s_prime-n)): print(s_prime) else: print(prime) # input = 10 # output = 11
cars = { 'Ford': ['Falcon', 'Focus', 'Festiva', 'Fairlane'], 'Holden': ['Commodore', 'Captiva', 'Barina', 'Trailblazer'], 'Nissan': ['Maxima', 'Pulsar', '350Z', 'Navara'], 'Honda': ['Civic', 'Accord', 'Odyssey', 'Jazz'], 'Jeep': ['Grand Cherokee', 'Cherokee', 'Trailhawk', 'Trackhawk'] } def get_all_jeeps(cars=cars): """return a comma + space (', ') separated string of jeep models (original order)""" return ', '.join(cars['Jeep']) def get_first_model_each_manufacturer(cars=cars): """return a list of matching models (original ordering)""" return [model[0] for _, model in cars.items()] def get_all_matching_models(cars=cars, grep='trail'): """return a list of all models containing the case insensitive 'grep' string which defaults to 'trail' for this exercise, sort the resulting sequence alphabetically""" return sorted([model for _, models in cars.items() for model in models if grep.lower() in str(model).lower()]) def sort_car_models(cars=cars): """return a copy of the cars dict with the car models (values) sorted alphabetically""" return {brand: sorted(model) for brand, model in cars.items()}
""" Entradas Salario-->float-->s Ventas_1-->float-->v1 Ventas_2-->float-->v2 Ventas_3-->float-->v3 Salidas Total_1-->float-->t1 Total_2-->float-->t2 Total_3-->float-->t3 """ s=float(input("Ingrese su salario bruto: ")) v1=float(input("Ingrese las ventas del departamento 1: ")) v2=float(input("Ingrese las ventas del departamento 2: ")) v3=float(input("Ingrese las ventas del departamento 3: ")) vt=v1+v2+v3 p=vt*0.33 if(v1>p): t1=(s*0.20)+s else: t1=s if(v2>p): t2=(s*0.20)+s else: t2=s if(v3>p): t3=(s*0.20)+s else: t3=s print("El pago del departamento 1 es: $","{:.0f}".format(t1)) print("El pago del departamento 2 es: $","{:.0f}".format(t2)) print("EL pafo del departamento 3 es: $","{:.0f}".format(t3))
version_defaults = { 'param_keys': { 'grid5': ['accrate', 'x', 'z', 'qb', 'mass'], 'synth5': ['accrate', 'x', 'z', 'qb', 'mass'], 'grid6': ['accrate', 'x', 'z', 'qb', 'mass'], 'he1': ['accrate', 'x', 'z', 'qb', 'mass'], 'he2': ['accrate', 'qb'], }, 'bprops': { 'grid5': ('rate', 'u_rate', 'fluence', 'u_fluence', 'peak', 'u_peak'), 'synth5': ('rate', 'u_rate', 'fluence', 'u_fluence', 'peak', 'u_peak'), 'grid6': ('rate', 'u_rate', 'fluence', 'u_fluence', 'peak', 'u_peak'), 'he1': ('rate', 'u_rate', 'fluence', 'u_fluence', 'peak', 'u_peak'), 'he2': ('rate', 'u_rate'), }, } version_definitions = { 'param_keys': { # The input params (and their order) when calling interpolator 'grid5': {}, 'synth5': {}, 'grid6': {}, 'he1': {}, 'he2': {}, }, # The burst properties being interpolated 'bprops': { 'grid5': {}, 'synth5': {}, 'grid6': {}, 'he1': {}, 'he2': {}, }, # The base grid to interpolate over (see: grids/grid_versions.py) # Note: if not defined, defaults to: grid_version = interp_version 'grid_version': { 'grid5': {}, 'synth5': {}, 'grid6': {}, 'he1': {}, 'he2': {}, }, } class InterpVersion: """Class for defining different interpolator versions """ def __init__(self, source, version): self.source = source self.version = version self.param_keys = get_parameter(source, version, 'param_keys') self.bprops = get_parameter(source, version, 'bprops') self.grid_version = get_parameter(source, version, 'grid_version') def __repr__(self): return (f'Interpolator version definitions for {self.source} V{self.version}' + f'\nbase grid versions : {self.grid_version}' + f'\nparam keys : {self.param_keys}' + f'\nbprops : {self.bprops}' ) def get_parameter(source, version, parameter): if parameter == 'grid_version': default = version else: default = version_defaults[parameter][source] out = version_definitions[parameter][source].get(version, default) if type(out) is int and (parameter != 'grid_version'): return version_definitions[parameter][source][out] else: return out
fname = input("Enter file name: ") try: fhand = open(fname) except: print('Something wrong with the file') for line in fhand: print((line.upper()).rstrip())
# -*- coding: utf-8 -*- def ULongToHexHash(long: int): buffer = [None] * 8 buffer[0] = (long >> 56).to_bytes(28,byteorder='little').hex()[:2] buffer[1] = (long >> 48).to_bytes(28,byteorder='little').hex()[:2] buffer[2] = (long >> 40).to_bytes(28,byteorder='little').hex()[:2] buffer[3] = (long >> 32).to_bytes(28,byteorder='little').hex()[:2] buffer[4] = (long >> 24).to_bytes(28,byteorder='little').hex()[:2] buffer[5] = (long >> 16).to_bytes(28,byteorder='little').hex()[:2] buffer[6] = (long >> 8).to_bytes(28,byteorder='little').hex()[:2] buffer[7] = (long).to_bytes(28,byteorder='little').hex()[:2] return (''.join(buffer)).upper() def SwapOrder(data: bytes) -> bytes: hex_str = data.hex() data = [None] * len(hex_str) # TODO: Improve this ^ if len(hex_str) == 8: data[0] = hex_str[6] data[1] = hex_str[7] data[2] = hex_str[4] data[3] = hex_str[5] data[4] = hex_str[2] data[5] = hex_str[3] data[6] = hex_str[0] data[7] = hex_str[1] return ''.join(data) def ParseIntBlob32(_hash: str) -> str: if (4 < (len(_hash) % 3) or len(_hash) % 3 != 0): raise ValueError(f'Failed to convert {_hash} to Blob 32') numbers = [] i = 0 while i < len(_hash): numstr = int(_hash[i] + _hash[i+1] + _hash[i+2]) numbers.append(numstr) i += 3 return int.from_bytes(bytearray(numbers), byteorder='little', signed=False) def ParseIntBlob64(_hash: str) -> str: if (len(_hash) % 3 != 0): raise ValueError(f'Failed to convert {_hash} to Blob 64') hex_str = "" i = 0 while i < len(_hash): num_str = hex(int((str(_hash[i]) + str(_hash[i+1]) + str(_hash[i+2]))))[2:] if len(num_str) == 1: num_str = f'0{num_str}' hex_str = num_str + hex_str i += 3 return hex_str
def hide_spines(ax, positions=["top", "right"]): """ Pass a matplotlib axis and list of positions with spines to be removed args: ax: Matplotlib axis object positions: Python list e.g. ['top', 'bottom'] """ assert isinstance(positions, list), "Position must be passed as a list " for position in positions: ax.spines[position].set_visible(False)
class Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ result_len = 0 result_str = '' if len(strs) == 1: return strs[0] # get the smallest str min_len = None smallest_str = None for item in strs: l = len(item) if min_len is None: min_len = l smallest_str = item elif l < min_len: min_len = l smallest_str = item for item in (strs): match_len = 0 for i in range(min_len): if item[i] == smallest_str[i]: match_len = match_len + 1 else: break if match_len == 0: result_str = '' break else: if match_len < min_len: min_len = match_len result_str = item[:min_len] return result_str if __name__ == '__main__': sol = Solution() strs = ['hello', 'hakjkaj', 'll'] print(sol.longestCommonPrefix(strs)) strs = ['ahello', 'hellg', 'hello'] print(sol.longestCommonPrefix(strs)) strs = ['c', 'c'] print(sol.longestCommonPrefix(strs))
"""Top-level package for Freud API Crawler.""" __author__ = """Peter Andorfer""" __email__ = '[email protected]' __version__ = '0.19.0'
expected_output = { "peer_type": { "vbond": { "downtime": { "2021-12-15T04:19:41+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DCONFAIL", "peer_organization": "", "peer_private_ip": "184.118.1.19", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.19", "peer_public_port": "12346", "peer_system_ip": "0.0.0.0", "remote_error": "NOERR", "repeat_count": "1", "site_id": "0", "state": "connect", }, "2021-12-16T17:40:20+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.19", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.19", "peer_public_port": "12346", "peer_system_ip": "0.0.0.0", "remote_error": "NOERR", "repeat_count": "4", "site_id": "0", "state": "tear_down", }, "2021-12-16T19:28:22+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.19", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.19", "peer_public_port": "12346", "peer_system_ip": "0.0.0.0", "remote_error": "NOERR", "repeat_count": "7", "site_id": "0", "state": "tear_down", }, "2021-12-17T04:55:11+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.19", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.19", "peer_public_port": "12346", "peer_system_ip": "0.0.0.0", "remote_error": "NOERR", "repeat_count": "0", "site_id": "0", "state": "tear_down", }, "2021-12-17T04:57:19+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.19", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.19", "peer_public_port": "12346", "peer_system_ip": "0.0.0.0", "remote_error": "NOERR", "repeat_count": "2", "site_id": "0", "state": "tear_down", }, "2021-12-17T14:36:12+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.19", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.19", "peer_public_port": "12346", "peer_system_ip": "0.0.0.0", "remote_error": "NOERR", "repeat_count": "1", "site_id": "0", "state": "tear_down", }, "2021-12-21T06:50:19+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DCONFAIL", "peer_organization": "", "peer_private_ip": "184.118.1.19", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.19", "peer_public_port": "12346", "peer_system_ip": "0.0.0.0", "remote_error": "NOERR", "repeat_count": "3", "site_id": "0", "state": "connect", }, "2021-12-21T06:54:07+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.19", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.19", "peer_public_port": "12346", "peer_system_ip": "0.0.0.0", "remote_error": "NOERR", "repeat_count": "13", "site_id": "0", "state": "tear_down", }, "2021-12-21T15:05:22+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.19", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.19", "peer_public_port": "12346", "peer_system_ip": "0.0.0.0", "remote_error": "NOERR", "repeat_count": "4", "site_id": "0", "state": "tear_down", }, "2022-01-19T06:18:27+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.19", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.19", "peer_public_port": "12346", "peer_system_ip": "0.0.0.0", "remote_error": "NOERR", "repeat_count": "2", "site_id": "0", "state": "tear_down", }, "2022-01-19T06:18:57+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DCONFAIL", "peer_organization": "", "peer_private_ip": "184.118.1.19", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.19", "peer_public_port": "12346", "peer_system_ip": "0.0.0.0", "remote_error": "NOERR", "repeat_count": "0", "site_id": "0", "state": "connect", }, }, }, "vmanage": { "downtime": { "2021-12-16T19:28:22+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.31", "peer_private_port": "12746", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.31", "peer_public_port": "12746", "peer_system_ip": "10.0.0.2", "remote_error": "NOERR", "repeat_count": "7", "site_id": "100", "state": "tear_down", }, "2021-12-17T04:57:19+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.31", "peer_private_port": "12746", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.31", "peer_public_port": "12746", "peer_system_ip": "10.0.0.2", "remote_error": "NOERR", "repeat_count": "2", "site_id": "100", "state": "tear_down", }, "2021-12-21T06:54:07+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.31", "peer_private_port": "12746", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.31", "peer_public_port": "12746", "peer_system_ip": "10.0.0.2", "remote_error": "NOERR", "repeat_count": "13", "site_id": "100", "state": "tear_down", }, "2021-12-21T15:05:22+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.31", "peer_private_port": "12746", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.31", "peer_public_port": "12746", "peer_system_ip": "10.0.0.2", "remote_error": "NOERR", "repeat_count": "4", "site_id": "100", "state": "tear_down", }, "2022-01-19T06:18:27+0000": { "domain_id": "0", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.31", "peer_private_port": "12746", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.31", "peer_public_port": "12746", "peer_system_ip": "10.0.0.2", "remote_error": "NOERR", "repeat_count": "2", "site_id": "100", "state": "tear_down", }, }, }, "vsmart": { "downtime": { "2021-12-16T19:28:22+0000": { "domain_id": "1", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.21", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.21", "peer_public_port": "12346", "peer_system_ip": "10.0.0.3", "remote_error": "NOERR", "repeat_count": "7", "site_id": "100", "state": "tear_down", }, "2021-12-17T04:57:19+0000": { "domain_id": "1", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.21", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.21", "peer_public_port": "12346", "peer_system_ip": "10.0.0.3", "remote_error": "NOERR", "repeat_count": "2", "site_id": "100", "state": "tear_down", }, "2021-12-21T06:54:07+0000": { "domain_id": "1", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.21", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.21", "peer_public_port": "12346", "peer_system_ip": "10.0.0.3", "remote_error": "NOERR", "repeat_count": "13", "site_id": "100", "state": "tear_down", }, "2021-12-21T15:05:22+0000": { "domain_id": "1", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.21", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.21", "peer_public_port": "12346", "peer_system_ip": "10.0.0.3", "remote_error": "NOERR", "repeat_count": "4", "site_id": "100", "state": "tear_down", }, "2022-01-19T06:18:27+0000": { "domain_id": "1", "local_color": "gold", "local_error": "DISTLOC", "peer_organization": "", "peer_private_ip": "184.118.1.21", "peer_private_port": "12346", "peer_protocol": "dtls", "peer_public_ip": "184.118.1.21", "peer_public_port": "12346", "peer_system_ip": "10.0.0.3", "remote_error": "NOERR", "repeat_count": "2", "site_id": "100", "state": "tear_down", }, }, }, }, }
map = {'corridor':['room1','','','room2'],'room1':['','','corridor',''],'room2':['','corridor','','']} commands = {'room1':room1,'room2':room2,'corridor':corridor} def Moving(location): rooms = map[location] directions = ['North','East','South','West'] availableDirections = [directions[i] for i,j in enumerate(rooms) if rooms[i] != ''] direction = input('Which direction would you like to go? ') while direction not in availableDirections: print('You can not go that way') direction = input('Which direction would you like to go? ') return rooms[directions.index(direction)] def corridor(): print('You are in a long corridor') print('There are exits to the North and West') commands[Moving('corridor')]() def room1(): print('You are in a small broom cupboard. The air smells musty and it is very dark') print('There are exits to the South') commands[Moving('room1')]() def room2(): print('You are in a very dark room. You can not see anything. You know there is an exit to the East though') commands[Moving('room2')]()
""" https://edabit.com/challenge/2jcxK7gpn6Z474kjz Casino Security You're head of security at a casino that has money being stolen from it. You get the data in the form of strings and you have to set off an alarm if a thief is detected. If there is no guard between thief and money, return "ALARM!" If the money is protected, return "Safe" String Components x - Empty Space T - Thief G - Guard $ - Money Examples security("xxxxTTxGxx$xxTxxx") ➞ "ALARM!" security("xxTxxG$xxxx$xxxx") ➞ "Safe" security("TTxxxx$xxGxx$Gxxx") ➞ "ALARM!" """ # SOLUTION WITHOUT REGEX!!! def security(txt): a, x, T, G, S = [], [], [], [], [] for i in txt: if i != "x": a.append(i) for i in range(len(a)): if a[i]=="T": T.append(i) elif a[i]=="G": G.append(i) elif a[i]=="$": S.append(i) if len(T) == 0 or len(S)==0: return "Safe" for i in T: for j in S: if abs(i-j) == 1: return "ALARM!" return "Safe" security("xxTxxx$xxxTxxxGxxT")#, "ALARM!") #security("xxxxTTxGxx$xxTxxx") #➞ "ALARM!" #security("xxTxxG$xxxx$xxxx") #➞ "Safe" #security("TTxxxx$xxGxx$Gxxx") #➞ "ALARM!" #security("xxxTxxxxT")#, "Safe") #security("xxGxxxGGG")#, "Safe") #security("x$xx$x$x$xx")#, "Safe")
# -*- coding:utf-8 -*- """ OOP: Object-Oriented Programming/Paradigm 3 main characteristics: * Encapsulation: Scope of data is limited to the Object * Inheritance: Object fields can be implicitly used in extended classes * Polymorphism: Same name can have different signatures """ # ############################################################################# # # GLOBALS # ############################################################################# # ############################################################################# # # CLOSURE # ############################################################################# def increment(n): return lambda x: x + n def counter(): count = 0 def inc(): nonlocal count count += 1 return count return lambda: inc() # ############################################################################# # # CLASS VS INSTANCE # ############################################################################# class Counter: """ A class defines the attributes and methods (fields) of the object, and the instance is the actual implementation of the class. * Attributes are data (like a painting) * Methods are functions, need to be executed (like music) Whenever you want to put together functionality and state, a class is a good design. """ # class attribute: identical for all instances of this class. # if 1 instance changes it, all change MODEL = "XYZ.123.BETA" def __init__(self, company): """ This function is called when the object is created """ print("created", self.__class__.__name__) self._count = 0 # instance attributes are declared this way self.company = company def reset(self): # methods are declared this way """ """ self._count = 0 return self._count def increment(self): """ """ # self._count = self._count + 1 self._count += 1 return self._count # "decorator" # static methods do NOT have a state. It is used to gather different # functions under same class (also more advanced uses like traits) @staticmethod # no self required, this is like a "free function" def sum(a, b): """ """ return a + b # no reference to self or the class # We require only what we need. I we don't alter the INSTANCE, we # don't need "self". A classmethod passes the reference to the # class, NOT to the instance, and can be used to modify class # fields. @classmethod def change_model(cls, new_model): """ """ cls.MODEL = new_model breakpoint() ryanair = Counter("Ryanair") iberia = Counter("Iberia") Counter.sum(3, 4) # EXAMPLE FOR SELF METHODS for _ in range(50): ryanair.increment() print("Disculpe cual es mi asiento??") # ... for _ in range(27): ryanair.increment() print("Resultado:", ryanair._count) # EXAMPLE FOR CLASS METHODS: # we change the model in 1 instance, and we observe that the model has # changed for ALL instances of the class print(">>>", iberia.MODEL) ryanair.change_model("XYZ.125") print(">>>", iberia.MODEL) breakpoint() # ############################################################################# # # NP ARRAYS # #############################################################################
def fence_pattern(rails, message_size): pass def encode(rails, message): pass def decode(rails, encoded_message): pass
# python3 def last_digit_of_fibonacci_number_naive(n): assert 0 <= n <= 10 ** 7 if n <= 1: return n return (last_digit_of_fibonacci_number_naive(n - 1) + last_digit_of_fibonacci_number_naive(n - 2)) % 10 def last_digit_of_fibonacci_number(n): assert 0 <= n <= 10 ** 7 if (n < 2): return n else: fib = [0, 1] for i in range(2, n + 1): fib.append((fib[i - 1] + fib[i - 2]) % 10) return fib[n] if __name__ == '__main__': input_n = int(input()) print(last_digit_of_fibonacci_number(input_n))
""" A python program for Dijkstra's single source shortest path algorithm. The program is for adjacency list representation of the graph """ # Function that implements Dijkstra's single source shortest path algorithm # for a graph represented using adjacency list representation def dijkstra(N, graph, src): S = list() S.append(src) dist = {x: 99 for x in range(1, N+1)} dist[src] = 0 minCost = 999 selected_u = 0 selected_v = 0 while S != list(graph.keys()): for u in S: dictOfu = graph[u] for v in dictOfu: if v not in S: cost_u_to_v = dist[u] + dictOfu[v] if cost_u_to_v < minCost: minCost = cost_u_to_v selected_u = u selected_v = v dist[selected_v] = minCost S.append(selected_v) print(selected_u, '--->', selected_v) minCost = 999 S.sort() # Function used to take input of graph and source node def main(): graph = {} N = int(input('Enter number of Nodes: ')) for i in range(1, N+1): print('Enter adjacent Node(s) and its weight(s) for Node: ', i) string = input() adjListWithWeights = string.split() print(adjListWithWeights) adjDict = {} for x in adjListWithWeights: y = x.split(',') adjDict[int(y[0])] = int(y[1]) graph[i] = adjDict print("The input graph is: ", graph) src = int(input('Enter source value: ')) dijkstra(N, graph, src) # Call the main function to start the program main() # Sample program input and output """ Suppose the graph is: 1 ------> 2 (weight 1) 1 ------> 3 (weight 5) 2 ------> 1 (weight 1) 2 ------> 3 (weight 1) 3 ------> 1 (weight 2) 3 ------> 2 (weight 2) The input will be Enter number of Nodes: 3 Enter adjacent Node(s) and its weight(s) for Node: 1 --------> 2,1 3,5 Enter adjacent Node(s) and its weight(s) for Node: 2 --------> 1,1 3,1 Enter adjacent Node(s) and its weight(s) for Node: 3 --------> 1,2 2,2 The input graph is: -------> {1: {2: 1, 3: 5}, 2: {1: 1, 3: 1}, 3: {1: 2, 2: 2}} Enter source value: 2 Final output 2 ---> 1 2 ---> 3 """
# From pep-0318 examples: # https://www.python.org/dev/peps/pep-0318/#examples def accepts(*types): def check_accepts(f): assert len(types) == f.func_code.co_argcount def new_f(*args, **kwds): for (a, t) in zip(args, types): assert isinstance(a, t), "arg %r does not match %s" % (a, t) return f(*args, **kwds) new_f.func_name = f.func_name return new_f return check_accepts def returns(rtype): def check_returns(f): def new_f(*args, **kwds): result = f(*args, **kwds) assert isinstance(result, rtype), "return value %r does not match %s" % ( result, rtype, ) return result new_f.func_name = f.func_name return new_f return check_returns # Example usage: # @accepts(int, (int,float)) # @returns((int,float)) # def func(arg1, arg2): # return arg1 * arg2
# coding=utf-8 # # @lc app=leetcode id=43 lang=python # # [43] Multiply Strings # # https://leetcode.com/problems/multiply-strings/description/ # # algorithms # Medium (29.97%) # Likes: 1015 # Dislikes: 472 # Total Accepted: 205.7K # Total Submissions: 666.4K # Testcase Example: '"2"\n"3"' # # Given two non-negative integers num1 and num2 represented as strings, return # the product of num1 and num2, also represented as a string. # # Example 1: # # # Input: num1 = "2", num2 = "3" # Output: "6" # # Example 2: # # # Input: num1 = "123", num2 = "456" # Output: "56088" # # # Note: # # # The length of both num1 and num2 is < 110. # Both num1 and num2 contain only digits 0-9. # Both num1 and num2 do not contain any leading zero, except the number 0 # itself. # You must not use any built-in BigInteger library or convert the inputs to # integer directly. # # # class Solution(object): def multiply(self, num1, num2): """ :type num1: str :type num2: str :rtype: str """ count = 0 step_a = 1 for a in num1[::-1]: step_b = 1 for b in num2[::-1]: count += int(a) * int(b) * step_a * step_b step_b *= 10 step_a *= 10 return str(count) # if __name__ == '__main__': # s = Solution() # print s.multiply("123", "25")
# -*- coding: utf-8 -*- """ 669. Trim a Binary Search Tree Given the root of a binary search tree and the lowest and highest boundaries as low and high, trim the tree so that all its elements lies in [low, high]. Trimming the tree should not change the relative structure of the elements that will remain in the tree (i.e., any node's descendant should remain a descendant). It can be proven that there is a unique answer. Return the root of the trimmed binary search tree. Note that the root may change depending on the given bounds. Constraints: The number of nodes in the tree in the range [1, 104]. 0 <= Node.val <= 104 The value of each node in the tree is unique. root is guaranteed to be a valid binary search tree. 0 <= low <= high <= 104 """ # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def trimBST(self, root: TreeNode, low: int, high: int) -> TreeNode: if root is None: return None if root.val < low: return self.trimBST(root.right, low, high) elif root.val > high: return self.trimBST(root.left, low, high) else: root.left = self.trimBST(root.left, low, high) root.right = self.trimBST(root.right, low, high) return root
historical_yrs = [i + 14 for i in range(6)] future_yrs = [5*i + 20 for i in range(7)] cities = { 'NR': { 'Delhi': (28.620198, 77.207953), 'Jaipur': (26.913310, 75.800162), 'Lucknow': (26.850000, 80.949997), 'Kanpur': (26.460681, 80.313318), 'Ghaziabad': (28.673733, 77.437598), 'Ludhiana': (30.903434, 75.854784), 'Agra': (27.188679, 77.985161), # 'Faridabad': # 'Varanasi': # 'Meerut': # 'Srinagar': # 'Aurangabad': # 'Jodhpur': # 'Chandigarh': }, 'WR': { 'Bombay': (19.136698, 72.874997), 'Ahmedabad': (23.046722, 72.594153), 'Surat': (21.172953, 72.830534), 'Pune': (18.522325, 73.839962), 'Nagpur': (21.143781, 79.083838), 'Thane': (19.208691, 72.986695), 'Bhopal': (23.229054, 77.454641), 'Indore': (22.729657, 75.864191), 'Pimpri-Chinchwad': (18.634826, 73.799352), # 'Vadodara': # 'Nashik': # 'Rajkot': # 'Vasai-Virar': # 'Varanasi': # 'Gwalior': # 'Jabalpur': # 'Raipur': (21.250000, 81.629997) }, 'ER': { 'Kolkata': (22.602239, 88.384624), 'Patna': (25.606163, 85.129308), # 'Howrah': (22.575807, 88.218517), ignoring b/c close to kolkata 'Ranchi': (23.369065, 85.323193), }, 'SR': { 'Hyderabad': (17.403782, 78.419709), 'Bangalore': (12.998121, 77.575998), 'Chennai': (13.057463, 80.237652), 'Visakhapatnam': (17.722926, 83.235116), 'Coimbatore': (11.022585, 76.960722), 'Vijayawada': (16.520201, 80.638189), 'Madurai': (9.925952, 78.124883), }, 'NER': { 'Guwahati': (26.152019, 91.733483), 'Agartala': (23.841343, 91.283016), 'Imphal': (24.810497, 93.934348), }, } fields = { 'QV10M': 'h10m', # specific humidity 10m above surface 'QV2M': 'h2m', # specific humidity 2m above surface 'T10M': 't10m', # temperature 10m above surface 'T2M': 't2m', # temperature 2m above surface 'TQI': 'tqi', # total precipitable ice water 'TQL': 'tql', # total precipitable liquid water 'TQV': 'tqv', # total precipitable water vapor 'U10M': 'ew10m', # eastward wind 10m above surface 'U2M': 'ew2m', # eastward wind 2m above surface 'V10M': 'nw10m', # northward wind 10m above surface 'V2M': 'nw2m', # northward wind 2m above surface }
port="COM3" # if ('virtual' in globals() and virtual): virtualArduino = Runtime.start("virtualArduino", "VirtualArduino") virtualArduino.connect(port) ard = Runtime.createAndStart("Arduino","Arduino") ard.connect(port) # i2cmux = Runtime.createAndStart("i2cMux","I2cMux") # From version 1.0.2316 use attach instead of setController # i2cmux.setController(ard,"1","0x70") i2cmux.attach(ard,"1","0x70") # mpu6050_0 = Runtime.createAndStart("Mpu6050-0","Mpu6050") mpu6050_0.attach(i2cmux,"0","0x68") mpu6050_1 = Runtime.createAndStart("Mpu6050-1","Mpu6050") mpu6050_1.attach(i2cmux,"1","0x68")
READ_ONLY_FS = 'Операции записи на диск запрещены' TIMEOUT = 'Превышен лимит времени на выполнение программы' CHECKER_ERROR = 'Возникла ошибка при проверке результата работы программы' NEED_CONSOLE_INPUT = 'Указажите входные данные'
""" looks for parameter values that are reflected in the response. Author: maradrianbelen.com The scan function will be called for request/response made via ZAP, excluding some of the automated tools Passive scan rules should not make any requests Note that new passive scripts will initially be disabled Right click the script in the Scripts tree and select "enable" Refactored & Improved by nil0x42 """ # Set to True if you want to see results on a per param basis # (i.e.: A single URL may be listed more than once) RESULT_PER_FINDING = False # Ignore parameters whose length is too short MIN_PARAM_VALUE_LENGTH = 8 def scan(ps, msg, src): # Docs on alert raising function: # raiseAlert(int risk, int confidence, str name, str description, str uri, # str param, str attack, str otherInfo, str solution, # str evidence, int cweId, int wascId, HttpMessage msg) # risk: 0: info, 1: low, 2: medium, 3: high # confidence: 0: falsePositive, 1: low, 2: medium, 3: high, 4: confirmed alert_title = "Reflected HTTP GET parameter(s) (script)" alert_desc = ("Reflected parameter value has been found. " "A reflected parameter values may introduce XSS " "vulnerability or HTTP header injection.") uri = header = body = None reflected_params = [] for param in msg.getUrlParams(): value = param.getValue() if len(value) < MIN_PARAM_VALUE_LENGTH: continue if not header: uri = msg.getRequestHeader().getURI().toString() header = msg.getResponseHeader().toString() body = msg.getResponseBody().toString() if value in header or value in body: if RESULT_PER_FINDING: param_name = param.getName() ps.raiseAlert(0, 2, alert_title, alert_desc, uri, param_name, None, None, None, value, 0, 0, msg) else: reflected_params.append(param.getName()) if reflected_params and not RESULT_PER_FINDING: reflected_params = u",".join(reflected_params) ps.raiseAlert(0, 2, alert_title, alert_desc, uri, reflected_params, None, None, None, None, 0, 0, msg)
# # PySNMP MIB module NBS-CMMCENUM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NBS-CMMCENUM-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:17:11 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") ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint") nbs, = mibBuilder.importSymbols("NBS-MIB", "nbs") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Bits, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, IpAddress, NotificationType, Unsigned32, MibIdentifier, Counter64, Counter32, Gauge32, ModuleIdentity, iso, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "IpAddress", "NotificationType", "Unsigned32", "MibIdentifier", "Counter64", "Counter32", "Gauge32", "ModuleIdentity", "iso", "ObjectIdentity") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") nbsCmmcEnumMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 629, 225)) if mibBuilder.loadTexts: nbsCmmcEnumMib.setLastUpdated('201503120000Z') if mibBuilder.loadTexts: nbsCmmcEnumMib.setOrganization('NBS') if mibBuilder.loadTexts: nbsCmmcEnumMib.setContactInfo('For technical support, please contact your service channel') if mibBuilder.loadTexts: nbsCmmcEnumMib.setDescription('This MIB module defines some frequently updated lists for NBS-CMMC-MIB.') class NbsCmmcEnumChassisType(TextualConvention, Integer32): description = 'The type of Chassis.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39)) namedValues = NamedValues(("other", 1), ("bu16", 2), ("bu4", 3), ("bu1", 4), ("bu5", 5), ("bu3", 6), ("bu2", 7), ("fCpe", 8), ("bmc", 9), ("virtual16", 10), ("bu21", 11), ("bu42", 12), ("virtual1", 13), ("virtual2", 14), ("virtual3", 15), ("virtual4", 16), ("bu22", 17), ("bu82", 18), ("bu3v", 19), ("virtual3v", 20), ("bu12", 21), ("occ48", 22), ("occ96", 23), ("occ128", 24), ("occ320", 25), ("od48", 26), ("virtod48", 27), ("od12", 28), ("virtod12", 29), ("od16", 30), ("virtod16", 31), ("od32", 32), ("virtod32", 33), ("od16lc", 34), ("virtod16lc", 35), ("od6", 36), ("virtod6", 37), ("od4", 38), ("virtod4", 39)) class NbsCmmcEnumSlotOperationType(TextualConvention, Integer32): description = 'Mode, or primary function, of card in slot' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45)) namedValues = NamedValues(("other", 1), ("management", 2), ("converter", 3), ("repeater", 4), ("switch", 5), ("splitterCombiner", 6), ("fastRepeater", 7), ("gigabitRepeater", 8), ("monitor", 9), ("opticSwitch", 10), ("remote", 11), ("redundant", 12), ("centralOffice", 13), ("customerPremise", 14), ("multiplexer", 15), ("deprecated16", 16), ("deprecated17", 17), ("deprecated18", 18), ("optAmpBoosterAGC", 19), ("optAmpBoosterAPC", 20), ("optAmpInlineAGC", 21), ("optAmpInlineAPC", 22), ("optAmpPreampAGC", 23), ("optAmpPreampAPC", 24), ("coDualActive", 25), ("coDualInactive", 26), ("physLayerSwitch", 27), ("packetMux", 28), ("optAmpVariableGain", 29), ("optAmpMidstageAGC", 30), ("optAmpMidstageAPC", 31), ("multiCO1g", 32), ("multiCO10g", 33), ("addDropMux", 34), ("multicast", 35), ("optAttenuator", 36), ("repeater40G", 37), ("multiplexer4x10G", 38), ("optAmpPreampAPPC", 39), ("optPassive", 40), ("transponder", 41), ("muxponder", 42), ("addWssDropSplitter", 43), ("dropWssAddCombiner", 44), ("dualAddWssDropSplitter", 45)) class NbsCmmcEnumSlotType(TextualConvention, Integer32): description = "This data type is used as the syntax of the nbsCmmcSlotType object in the definition of NBS-CMMC-MIB's nbsCmmcSlotTable. This object is used internally by Manager, and is not useful to most end-users." status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254), SingleValueConstraint(255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509), SingleValueConstraint(510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757)) namedValues = NamedValues(("empty0", 0), ("empty1", 1), ("empty2", 2), ("empty3", 3), ("em316gs1", 4), ("em316gs2", 5), ("em316gs3", 6), ("em316fms1", 7), ("em316fms2", 8), ("em316fms3", 9), ("em316as1", 10), ("em316as2", 11), ("em316as3", 12), ("em316fds1", 13), ("em316fds2", 14), ("em316fds3", 15), ("em316o3s1", 16), ("em316o3s2", 17), ("em316o3s3", 18), ("em316o12s1", 19), ("em316o12s2", 20), ("em316o12s3", 21), ("em316gsfs1", 22), ("em316gsfs2", 23), ("em316gsfs3", 24), ("em316fsfs1", 25), ("em316fsfs2", 26), ("em316fsfsx", 27), ("em316fsfsz", 28), ("em316fmsfs1", 29), ("em316fmsfs2", 30), ("em316fmsfs3", 31), ("em316asfs2", 32), ("em316asfs3", 33), ("em316fdsfs2", 34), ("em316fdsfs3", 35), ("em316o3sfs2", 36), ("em316o3sfs3", 37), ("em316o12sfs2", 38), ("em316o12sfs3", 39), ("em316em", 40), ("em316emx", 41), ("em316es", 42), ("em316esx", 43), ("em315esz", 44), ("em316fm", 45), ("em316fs1", 46), ("em316fs2", 47), ("em316fsx", 48), ("em315fsz", 49), ("em3162swm", 50), ("em3162sws1", 51), ("em3162sws2", 52), ("em3162sws3a", 53), ("em3162sws3b", 54), ("em3164wdm", 55), ("em316nm", 56), ("em3164sw", 57), ("em3164hub", 58), ("em316sc3m", 59), ("em316sc8m", 60), ("em316sc3s", 61), ("em316sc5s", 62), ("em316fr1", 63), ("em316fr2", 64), ("em316fr3", 65), ("em316gr1", 66), ("em316gr2", 67), ("em316gr3", 68), ("em316f21", 69), ("em316f22", 70), ("em316wdm4", 71), ("em316g", 72), ("em316gsf", 73), ("em316fn", 74), ("em316fsfn", 75), ("em316fmsn", 76), ("em316fmsfn", 77), ("em316asn", 78), ("em316asfsn", 79), ("em316fdsn", 80), ("em316fdsfsn", 81), ("em316o3sn", 82), ("em316o3sfsn", 83), ("em316o12sn", 84), ("em316o12sfsn", 85), ("em316emsn", 86), ("em316emsfsn", 87), ("em316ssn", 88), ("em316ssfsn", 89), ("em316tr", 90), ("em316t1", 91), ("em316t1sf", 92), ("nc3162bu", 93), ("em316wdm4o12", 94), ("em316wdm4o3", 95), ("em316grg", 96), ("em316mso12", 97), ("em316mso3", 98), ("em316e1", 99), ("em316e1sf", 100), ("wdmtrnk", 101), ("em316wdm43", 102), ("em316wdm44", 103), ("em104", 104), ("em105", 105), ("em106", 106), ("em316ds31", 107), ("em316ds32", 108), ("em3164sw1", 109), ("em3166sw1", 110), ("em3166sw2", 111), ("em316wfcs", 112), ("em316wfts", 113), ("em316e11", 114), ("em316e12", 115), ("nc316bu31", 116), ("nc316bu32", 117), ("em316od3", 118), ("nc316nw41", 119), ("nc316nw42", 120), ("em316em1", 121), ("em316e2", 122), ("em316fc", 123), ("em316fcsf", 124), ("nc316nw43", 125), ("nc316nw44", 126), ("em316o48", 127), ("em316o48sf", 128), ("ns129", 129), ("ns130", 130), ("ns131", 131), ("em3163sw", 132), ("em3163swsf", 133), ("em316o3c1", 134), ("em316o3csf", 135), ("nc316nw45", 136), ("nc316nw46", 137), ("em316wdm4f", 138), ("em316wdm4fc", 139), ("em316dpg", 140), ("em3162gsws", 141), ("ns142", 142), ("em316wgcs", 143), ("em316wgts", 144), ("em316wfccs", 145), ("em316wfcts", 146), ("em316wecs", 147), ("em316wets", 148), ("em316osw", 149), ("ns150", 150), ("ns151", 151), ("em316fe11l", 152), ("em316ft11l", 153), ("em316wdm81", 154), ("ns155", 155), ("wdm38", 156), ("ns157", 157), ("em316o3f1", 158), ("ns159", 159), ("em316wdm85", 160), ("em316wdmc3", 161), ("ns162", 162), ("em316fmsh", 163), ("ns164", 164), ("ns165", 165), ("ns166", 166), ("em316e31", 167), ("ns168", 168), ("em316fe12r", 169), ("ns170", 170), ("ns171", 171), ("ns172", 172), ("em316gc1", 173), ("em316gcsf", 174), ("ns175", 175), ("ns176", 176), ("em316ds3sh", 177), ("ns178", 178), ("em316nmhb1", 179), ("em316ds3r", 180), ("ns181", 181), ("em316fe11r", 182), ("em316ft11r", 183), ("ns184", 184), ("em316wdmc4", 185), ("em316adsl1", 186), ("ns187", 187), ("ns188", 188), ("ns189", 189), ("ns190", 190), ("ns191", 191), ("ns192", 192), ("ns193", 193), ("ns194", 194), ("em316gccsf", 195), ("em316gctsf", 196), ("em316osh", 197), ("ns198", 198), ("ns199", 199), ("ns200", 200), ("ns201", 201), ("ns202", 202), ("ns203", 203), ("ns204", 204), ("ns205", 205), ("ns206", 206), ("ns207", 207), ("ns208", 208), ("ns209", 209), ("em316sadm1", 210), ("ns211", 211), ("ns212", 212), ("em316flm1", 213), ("em316flm2", 214), ("ns215", 215), ("ns216", 216), ("ns217", 217), ("ns218", 218), ("wdm24ctr", 219), ("ns220", 220), ("wdm24ctl", 221), ("em316frm1", 222), ("em316frm2", 223), ("wdm44sf", 224), ("em316swrfhp", 225), ("ns226", 226), ("em316swhp", 227), ("ns228", 228), ("em316f2rm1", 229), ("em316f2rm2", 230), ("ns231", 231), ("ns232", 232), ("ns233", 233), ("ns234", 234), ("ns235", 235), ("ns236", 236), ("ns237", 237), ("ns238", 238), ("em316wfrmc", 239), ("em316wfrmt", 240), ("em316t1mux1", 241), ("em316t1mux2", 242), ("em316e1mux4j", 243), ("em316e1x4sfj", 244), ("ns245", 245), ("em316efrm1", 246), ("em316efrm2", 247), ("ns248", 248), ("ns249", 249), ("ns250", 250), ("ns251", 251), ("ns252", 252), ("ns253", 253), ("ns254", 254)) + NamedValues(("ns255", 255), ("ns256", 256), ("ns257", 257), ("em316sc1021", 258), ("ns259", 259), ("ns260", 260), ("ns261", 261), ("em316edsc1", 262), ("em316edsc2", 263), ("em316wdmslot", 264), ("em316wdmc265", 265), ("empty266", 266), ("em316wp1", 267), ("em316wp2", 268), ("em316oa", 269), ("em316e1mux1", 270), ("em316e1mux2", 271), ("em3162tsfp", 272), ("em316dmr48", 273), ("ns3162sfpr", 274), ("ns316xp342r", 275), ("em316ef", 276), ("em316efsf", 277), ("em316padms", 278), ("ns279", 279), ("ns280", 280), ("ns281", 281), ("ns316f16csfp", 282), ("ns316sdi8", 283), ("ns284", 284), ("em316wdmpa4", 285), ("em316wdmpa4t", 286), ("ns287", 287), ("em3162gbicl", 288), ("em3162gbicr", 289), ("em316ge1sfl", 290), ("em316ge1sfr", 291), ("em316fchub", 292), ("em316fcr", 293), ("em316mr48", 294), ("ns295", 295), ("em316fe1xx", 296), ("em316ft1sf", 297), ("em316gbicsfp", 298), ("ns299", 299), ("ns300", 300), ("em316pamulc8n", 301), ("em316pamulc4n", 302), ("em316t1muxrrm", 303), ("em316e1muxrrm", 304), ("ns305", 305), ("em316wo3c", 306), ("ns307", 307), ("em316grmah", 308), ("em316grmahsf", 309), ("em316efrmah", 310), ("em316efrmahsf", 311), ("em316erm", 312), ("em316ermsf", 313), ("em316efan", 314), ("em316efansf", 315), ("ns316", 316), ("nc316Xp343r", 317), ("ns318", 318), ("em316pamulc8", 319), ("em316pamulc4", 320), ("cm316fFtth", 321), ("ns322", 322), ("ns323", 323), ("ns324", 324), ("ns325", 325), ("em316padm41mu", 326), ("ns327", 327), ("em316pamuscm4", 328), ("em316pamuscd4", 329), ("em316pamuscm8", 330), ("em316pamuscd8", 331), ("em316muxmusc16", 332), ("em316dmuxmusc16", 333), ("ns334", 334), ("em316dpadms", 335), ("ns336", 336), ("em316dwmux16", 337), ("em316dwdmx16", 338), ("ns339", 339), ("ns340", 340), ("em316fe1sf", 341), ("em316xt1", 342), ("em316fe1rj", 343), ("em316gt1sfv", 344), ("ns345", 345), ("ns346", 346), ("ns347", 347), ("ns348", 348), ("ns349", 349), ("nc316xp322", 350), ("nc316xp323", 351), ("em316wermc", 352), ("em316wermt", 353), ("ns354", 354), ("ns355", 355), ("ns356", 356), ("ns357", 357), ("em316ee1rmft", 358), ("em316xe1rmft", 359), ("em316lx2", 360), ("em316lxm", 361), ("em316dwmux32", 362), ("em316dwdmx32v", 363), ("em316dwmux32nv", 364), ("em316dwdmx32n", 365), ("ns366", 366), ("ns367", 367), ("em316fe1rmft", 368), ("em316efe1ah", 369), ("em316eft1ah", 370), ("em316efe1rj", 371), ("ns372", 372), ("ns373", 373), ("ns374", 374), ("em316grmahsh", 375), ("em316ermahsh", 376), ("ns377", 377), ("ns378", 378), ("em316ermah", 379), ("ns380", 380), ("em3162sfpx", 381), ("ns382", 382), ("pmcwdm8sfp", 383), ("ns384", 384), ("ns385", 385), ("mccSfp36", 386), ("mccGRj36", 387), ("em316osc", 388), ("em316gemx2r", 389), ("em316gemx6r", 390), ("mccSfp72", 391), ("mccGRj72", 392), ("em316gcl", 393), ("em316gclsf", 394), ("em316wgclc", 395), ("em316wgclt", 396), ("ns397", 397), ("ns398", 398), ("ns399", 399), ("ns400", 400), ("ns401", 401), ("ns402", 402), ("ns403", 403), ("ns404", 404), ("ns405", 405), ("ns406", 406), ("ns407", 407), ("ns408", 408), ("ns409", 409), ("ns410", 410), ("ns411", 411), ("ns412", 412), ("ns413", 413), ("ns414", 414), ("ns415", 415), ("ns416", 416), ("em316xfpr", 417), ("oemntgrmah", 418), ("oemntermah", 419), ("oemntnm", 420), ("em316wds3c", 421), ("em316wds3t", 422), ("em316we3c", 423), ("em316we3t", 424), ("ns425", 425), ("ns426", 426), ("em316eft1mua4v", 427), ("em316efx1mub4", 428), ("em316efe1muc4v", 429), ("ns430", 430), ("ns431", 431), ("ns432", 432), ("em316t1mux4rm", 433), ("em316e1muxrjrm", 434), ("em316e1mux4rm", 435), ("em316dmr", 436), ("em316mr", 437), ("ns438", 438), ("ns439", 439), ("ns440", 440), ("em316ge1rjsf", 441), ("em316mr48q", 442), ("em316dmr48q", 443), ("em316mrmx2r", 444), ("ns445", 445), ("ns446", 446), ("ns447", 447), ("ns448", 448), ("ns449", 449), ("ns450", 450), ("mcc9xfp", 451), ("ns452", 452), ("em316cdadd2", 453), ("em316cdadd1", 454), ("ns455", 455), ("ns456", 456), ("em316nmlx12", 457), ("em316nmlx21", 458), ("em316nmlx", 459), ("ns460", 460), ("em316sw22", 461), ("em316sw12", 462), ("em316sw04", 463), ("em316sw13", 464), ("ns465", 465), ("ns466", 466), ("ns467", 467), ("ns468", 468), ("ns469", 469), ("ns470", 470), ("em3164swb", 471), ("ns472", 472), ("ns473", 473), ("ns474", 474), ("em316csadsxx", 475), ("em316csadsxxyy", 476), ("em316csaddxx", 477), ("em316csaddxxyy", 478), ("em3163swb", 479), ("em316ds3", 480), ("em316dt3e3", 481), ("ns482", 482), ("em316mux4xn", 483), ("em316dmx4xn", 484), ("em316mux4xbd", 485), ("em316dmx4xbd", 486), ("em316mux8nbd", 487), ("em316dmx8nbd", 488), ("em316mux8bd", 489), ("em316dmx8bd", 490), ("em316dpadxx", 491), ("em316dpadxxyy", 492), ("em316dpad4xx", 493), ("em316dpad8xx", 494), ("em316wt1c", 495), ("ns496", 496), ("em316gt1rm", 497), ("em316g6t1rm1", 498), ("em316g6t1rm2", 499), ("em316dsadsxx", 500), ("em316ddaddxx", 501), ("em316ddaddxxyy", 502), ("em316edfalv", 503), ("em316psc", 504), ("em316sos", 505), ("em316doscb", 506), ("em316padm8", 507), ("em316csads4", 508), ("ns509", 509)) + NamedValues(("ns510", 510), ("ns511", 511), ("ns512", 512), ("em316plc", 513), ("ns514", 514), ("ns515", 515), ("ns516", 516), ("ns517", 517), ("ns518", 518), ("em316dwmx8", 519), ("ns520", 520), ("em316genpasv", 521), ("em316ge1rm", 522), ("ns523", 523), ("ns524", 524), ("em316g6e1rms2", 525), ("ns526", 526), ("ns527", 527), ("ns528", 528), ("ns529", 529), ("mcc18t1e1", 530), ("ns531", 531), ("ns532", 532), ("mcc18dt3e3", 533), ("em316edfar", 534), ("ns535", 535), ("ns536", 536), ("ns537", 537), ("em316ossh", 538), ("em316sc3", 539), ("ns540", 540), ("em316fc400", 541), ("ns542", 542), ("ns543", 543), ("ns544", 544), ("em316eusmv", 545), ("ns546", 546), ("ns547", 547), ("em316dcm100r", 548), ("em316dcm100l", 549), ("ns550", 550), ("em316twoxfpet", 551), ("em316dwmux16be", 552), ("ns553", 553), ("ns554", 554), ("empmc8xfp", 555), ("ns556", 556), ("em316dwmx16bem", 557), ("ns558", 558), ("em316e1t1xy", 559), ("dwmx32rbm", 560), ("ns561", 561), ("ns562", 562), ("ns563", 563), ("empmc36t1e1", 564), ("ns565", 565), ("em316palc8nl", 566), ("em316palc8nr", 567), ("em316gswxy", 568), ("em316dwd40m5713", 569), ("em316dwd40m5712", 570), ("em316dwd40m5711", 571), ("em316mux535531b", 572), ("ns573", 573), ("em31610gxy", 574), ("ns575", 575), ("ns576", 576), ("ns577", 577), ("ns578", 578), ("ns579", 579), ("ns580", 580), ("ns581", 581), ("ns582", 582), ("ns583", 583), ("ns584", 584), ("em316os2", 585), ("em316osa", 586), ("ns587", 587), ("ns588", 588), ("ns589", 589), ("ns590", 590), ("ns591", 591), ("ns592", 592), ("em316ea", 593), ("ns594", 594), ("em316eusm10gr", 595), ("em316eusm10gl", 596), ("em316dmdxa16b1", 597), ("em316dmdxa16b2", 598), ("em316dmdxa16b3", 599), ("em316dmdxa16b4", 600), ("em316dmdxa16b5", 601), ("em316dmdxa40m01", 602), ("em316dmdxa40m02", 603), ("em316dmdxa40m03", 604), ("em316dmdxa40m04", 605), ("em316dmdxa40m05", 606), ("em316dmdxa40m06", 607), ("em316dmdxa40m07", 608), ("em316dmdxa40m08", 609), ("em316dmdxa40m09", 610), ("em316dmdxa40m10", 611), ("em316dmdxa40m11", 612), ("em316dmdxa16ra", 613), ("em316dmdxa16rb", 614), ("em31620g1", 615), ("em31620g2", 616), ("em31640g3", 617), ("em31640g4", 618), ("em31640g5", 619), ("em316rpon", 620), ("ns621", 621), ("empmc36sas", 622), ("em316osw8", 623), ("ns624", 624), ("ns625", 625), ("em31610g8swxyr", 626), ("em31610g8swxym", 627), ("em31610g8swxyl", 628), ("ns629", 629), ("em316cmux831b", 630), ("ns631", 631), ("em316mdx46ma001", 632), ("em316mdx46ma002", 633), ("em316mdx46ma003", 634), ("em316mdx46ma004", 635), ("em316mdx46ma005", 636), ("em316mdx46ma006", 637), ("em316mdx46ma007", 638), ("em316mdx46ma008", 639), ("em316mdx46ma009", 640), ("em316mdx46ma010", 641), ("em316mdx46ma011", 642), ("em316mdx46ma012", 643), ("em316osw128a", 644), ("em316osw128b", 645), ("em316osw128c", 646), ("em316osw128d", 647), ("em316osw128e", 648), ("em316osw128f", 649), ("em316osw128g", 650), ("em316osw128h", 651), ("em316osw128i", 652), ("em316osw128j", 653), ("em316osw128k", 654), ("em316osw128l", 655), ("em316osw128m", 656), ("ns657", 657), ("em316dcmxx", 658), ("em316osshlc", 659), ("em316eavg2217", 660), ("em316dmr10g3r", 661), ("em316fdt1e1rm", 662), ("em316sw8fxr", 663), ("em316sw8fxlv", 664), ("em316mdx46mx002", 665), ("em316mdx46mb003", 666), ("em316mdx46mb002", 667), ("em316mdx46mc002", 668), ("em316eamlp2017v", 669), ("ns670", 670), ("em316gemx4rr", 671), ("em316gemx4rlv", 672), ("empmcqsfp36", 673), ("ns674", 674), ("ns675", 675), ("em3162qsfp40", 676), ("ns677", 677), ("ns678", 678), ("mcc36ic", 679), ("ns680", 680), ("em316voar", 681), ("em316voalv", 682), ("em316dvmdxa", 683), ("em316dvmdxbv", 684), ("em316cmdxm8al", 685), ("em316cmdxm8ar", 686), ("ns687", 687), ("ns688", 688), ("em316dvmdxav1", 689), ("em316dvmdxav2", 690), ("em316dvmdxav3", 691), ("em316dvmdxav4", 692), ("em316dvmdxav5", 693), ("em316dvmdxav6", 694), ("em316dvmdxav7", 695), ("em316dvmdxav8", 696), ("em316dvmdxav9", 697), ("ns698", 698), ("ns699", 699), ("ns700", 700), ("em316ra12r", 701), ("em316ra12lv", 702), ("ns703", 703), ("em316ra12mv", 704), ("ns705", 705), ("ns706", 706), ("em316dmr10gf", 707), ("ns708", 708), ("ns709", 709), ("ns710", 710), ("ns711", 711), ("ns712", 712), ("ns713", 713), ("ns714", 714), ("ns715", 715), ("ns716", 716), ("ns717", 717), ("ns718", 718), ("ns719", 719), ("oddmr10g3r", 720), ("oddmr10gf", 721), ("od2hwss4dws", 722), ("od2hmxp100g", 723), ("odtxp100gf2c", 724), ("ns725", 725), ("em316raf10", 726), ("ns727", 727), ("odtxp100g2c", 728), ("ns729", 729), ("od2hwss4dcw", 730), ("ns731", 731), ("ns732", 732), ("odugc", 733), ("ns734", 734), ("ns735", 735), ("odfiller", 736), ("odtxp100g2cw1", 737), ("od2hwss4dww", 738), ("ns739", 739), ("ns740", 740), ("ns741", 741), ("ns742", 742), ("ns743", 743), ("ns744", 744), ("ns745", 745), ("ns746", 746), ("em316twoxfp16g", 747), ("od2hdwss4dws", 748), ("ns749", 749), ("ns750", 750), ("ns751", 751), ("ns752", 752), ("od2hdmx10g", 753), ("ns754", 754), ("ns755", 755), ("ns756", 756), ("odtxp100gf", 757)) class NbsCmmcEnumPortConnector(TextualConvention, Integer32): description = 'The Port Connector.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40)) namedValues = NamedValues(("unknown", 1), ("removed", 2), ("foDSC", 3), ("foSC", 4), ("cuRj45", 5), ("foLC", 6), ("coaxF", 7), ("coaxBNC", 8), ("coax2BNC", 9), ("cuRj45wLEDs", 10), ("cuRj11", 11), ("cuDb9", 12), ("cuHssdc", 13), ("coaxHeader", 14), ("foFiberJack", 15), ("foMtRj", 16), ("foMu", 17), ("sg", 18), ("foPigtail", 19), ("cuPigtail", 20), ("smb", 21), ("firewireA", 22), ("firewireB", 23), ("cuRj48", 24), ("fo1LC", 25), ("fo2ST", 26), ("sataDevicePlug", 27), ("sataHostPlug", 28), ("miniCoax", 29), ("mpo", 30), ("miniSAS4x", 31), ("reserved", 32), ("cxpCuPassive", 33), ("cxpCuActive", 34), ("cxpFoActive", 35), ("cxpFoConnect", 36), ("fc", 37), ("cuMicroUsbB", 38), ("rj45wUSBRJ45Active", 39), ("rj45wUSBUSBActive", 40)) class NbsCmmcChannelBand(TextualConvention, Integer32): description = "The ITU grid labels DWDM channels with a letter 'band' and a numeric channel. Within this mib, the band is indicated by this object, and the channel number is shown in the object nbsOsaChannelNumber. Frequencies of at least 180100 GHz but less than 190100 GHz are considered the L spectrum, and frequencies of at least 190100 but less than 200100 GHz are considered the C spectrum. Frequencies evenly divisible by 100 GHz are designated with a 'C' or 'L' prepended to the channel number. Frequencies that are offset by 50 GHz are designated 'H' within the C spectrum, and 'Q' within the L spectrum." status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4)) namedValues = NamedValues(("notSupported", 0), ("cBand", 1), ("hBand", 2), ("lBand", 3), ("qBand", 4)) mibBuilder.exportSymbols("NBS-CMMCENUM-MIB", NbsCmmcChannelBand=NbsCmmcChannelBand, NbsCmmcEnumChassisType=NbsCmmcEnumChassisType, NbsCmmcEnumPortConnector=NbsCmmcEnumPortConnector, PYSNMP_MODULE_ID=nbsCmmcEnumMib, NbsCmmcEnumSlotType=NbsCmmcEnumSlotType, nbsCmmcEnumMib=nbsCmmcEnumMib, NbsCmmcEnumSlotOperationType=NbsCmmcEnumSlotOperationType)
#! /usr/bin/env python3 '''A library of functions for our cool app''' def add(a, b): return a + b def add1(a): return a - 1 def sub1(a): pass
def test_ports(api, utils): """Demonstrates adding ports to a configuration and setting the configuration on the traffic generator. The traffic generator should have no items configured other than the ports in this test. """ tx_port = utils.settings.ports[0] rx_port = utils.settings.ports[1] config = api.config() config.ports.port(name="tx_port", location=tx_port).port( name="rx_port", location=rx_port ).port(name="port with no location") config.options.port_options.location_preemption = True api.set_config(config) config = api.config() api.set_config(config)
""" 39 / 39 test cases passed. Runtime: 340 ms Memory Usage: 34.7 MB """ class Solution: def numOfMinutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int: graph = [[] for _ in range(n)] for i in range(n): id = manager[i] if id != -1: graph[id].append(i) que = collections.deque([(headID, informTime[headID])]) ans = 0 while que: for _ in range(len(que)): pid, time = que.popleft() ans = max(ans, time) for id in graph[pid]: que.append((id, time + informTime[id])) return ans
'''21 - Faça um Programa para um caixa eletrônico. O programa deverá perguntar ao usuário a valor do saque e depois informar quantas notas de cada valor serão fornecidas. As notas disponíveis serão as de 1, 5, 10, 50 e 100 reais. O valor mínimo é de 10 reais e o máximo de 600 reais. O programa não deve se preocupar com a quantidade de notas existentes na máquina. Exemplo 1: Para sacar a quantia de 256 reais, o programa fornece duas notas de 100, uma nota de 50, uma nota de 5 e uma nota de 1; Exemplo 2: Para sacar a quantia de 399 reais, o programa fornece três notas de 100, uma nota de 50, quatro notas de 10, uma nota de 5 e quatro notas de 1.''' def otimiza_saque(): valor_do_saque = float(input('Valor do Saque: ')) nota = [1, 5, 10, 50, 100] vezes_usadas = [0, 0, 0, 0, 0] resultado = {} if valor_do_saque < 10 or valor_do_saque > 600: print('Valor indisponivel para saque.') else: notas_de_100 = valor_do_saque / nota[4] print(f'Nota 100: {int(notas_de_100)}') resto_de_100 = valor_do_saque % nota[4] if resto_de_100 != 0: notas_de_50 = resto_de_100 / nota[3] print(f'Notas 50: {int(notas_de_50)}') resto_de_50 = resto_de_100 % nota[3] if resto_de_50 != 0: notas_de_10 = resto_de_50 / nota[2] print(f'Notas 10: {int(notas_de_10)}') resto_de_10 = resto_de_50 % nota[2] if resto_de_10 != 0: notas_de_5 = resto_de_10 / nota[1] print(f'Notas 5: {int(notas_de_5)}') resto_de_5 = resto_de_10 % nota[1] if resto_de_5 != 0: notas_de_1 = resto_de_5 / nota[0] print(f'Notas 1: {int(notas_de_1)}') otimiza_saque()
# V0 # IDEA : DP class Solution(object): def wordBreak(self, s, wordDict): """ :type s: str :type wordDict: List[str] :rtype: bool """ dp = [False] * (len(s) + 1) dp[0] = True for i in range(1, len(s) + 1): for k in range(i): if dp[k] and s[k:i] in wordDict: dp[i] = True return dp.pop() # V1 # https://blog.csdn.net/fuxuemingzhu/article/details/79368360 class Solution(object): def wordBreak(self, s, wordDict): """ :type s: str :type wordDict: List[str] :rtype: bool """ print(s) print(wordDict) dp = [False] * (len(s) + 1) dp[0] = True print(dp) for i in range(1, len(s) + 1): for k in range(i): # if dp[k] : if dp[k] == True if dp[k] and s[k:i] in wordDict: dp[i] = True print(dp) return dp.pop() # V1' # https://www.jiuzhang.com/solution/word-break/#tag-highlight-lang-python class Solution: # @param s: A string s # @param dict: A dictionary of words dict def wordBreak(self, s, dict): if len(dict) == 0: return len(s) == 0 n = len(s) f = [False] * (n + 1) f[0] = True maxLength = max([len(w) for w in dict]) for i in range(1, n + 1): for j in range(1, min(i, maxLength) + 1): if not f[i - j]: continue if s[i - j:i] in dict: f[i] = True break return f[n] # V2 # Time: O(n * l^2) # Space: O(n) class Solution(object): def wordBreak(self, s, wordDict): """ :type s: str :type wordDict: Set[str] :rtype: bool """ n = len(s) max_len = 0 for string in wordDict: max_len = max(max_len, len(string)) can_break = [False for _ in range(n + 1)] can_break[0] = True for i in range(1, n + 1): for l in range(1, min(i, max_len) + 1): if can_break[i-l] and s[i-l:i] in wordDict: can_break[i] = True break return can_break[-1]
# # PySNMP MIB module LANART-AGENT (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LANART-AGENT # Produced by pysmi-0.3.4 at Mon Apr 29 19:54:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Bits, ObjectIdentity, TimeTicks, Integer32, ModuleIdentity, NotificationType, Counter64, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Unsigned32, Counter32, MibIdentifier, iso, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "ObjectIdentity", "TimeTicks", "Integer32", "ModuleIdentity", "NotificationType", "Counter64", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Unsigned32", "Counter32", "MibIdentifier", "iso", "Gauge32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") ccitt = MibIdentifier((0,)) null = MibIdentifier((0, 0)) iso = MibIdentifier((1,)) org = MibIdentifier((1, 3)) dod = MibIdentifier((1, 3, 6)) internet = MibIdentifier((1, 3, 6, 1)) directory = MibIdentifier((1, 3, 6, 1, 1)) mgmt = MibIdentifier((1, 3, 6, 1, 2)) experimental = MibIdentifier((1, 3, 6, 1, 3)) private = MibIdentifier((1, 3, 6, 1, 4)) enterprises = MibIdentifier((1, 3, 6, 1, 4, 1)) mib_2 = MibIdentifier((1, 3, 6, 1, 2, 1)).setLabel("mib-2") class DisplayString(OctetString): pass class PhysAddress(OctetString): pass system = MibIdentifier((1, 3, 6, 1, 2, 1, 1)) interfaces = MibIdentifier((1, 3, 6, 1, 2, 1, 2)) at = MibIdentifier((1, 3, 6, 1, 2, 1, 3)) ip = MibIdentifier((1, 3, 6, 1, 2, 1, 4)) icmp = MibIdentifier((1, 3, 6, 1, 2, 1, 5)) tcp = MibIdentifier((1, 3, 6, 1, 2, 1, 6)) udp = MibIdentifier((1, 3, 6, 1, 2, 1, 7)) egp = MibIdentifier((1, 3, 6, 1, 2, 1, 8)) transmission = MibIdentifier((1, 3, 6, 1, 2, 1, 10)) snmp = MibIdentifier((1, 3, 6, 1, 2, 1, 11)) sysDescr = MibScalar((1, 3, 6, 1, 2, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysDescr.setStatus('mandatory') sysObjectID = MibScalar((1, 3, 6, 1, 2, 1, 1, 2), ObjectIdentifier()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysObjectID.setStatus('mandatory') sysUpTime = MibScalar((1, 3, 6, 1, 2, 1, 1, 3), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: sysUpTime.setStatus('mandatory') sysContact = MibScalar((1, 3, 6, 1, 2, 1, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite") if mibBuilder.loadTexts: sysContact.setStatus('mandatory') sysName = MibScalar((1, 3, 6, 1, 2, 1, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite") if mibBuilder.loadTexts: sysName.setStatus('mandatory') sysLocation = MibScalar((1, 3, 6, 1, 2, 1, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readwrite") if mibBuilder.loadTexts: sysLocation.setStatus('mandatory') sysServices = MibScalar((1, 3, 6, 1, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 127))).setMaxAccess("readonly") if mibBuilder.loadTexts: sysServices.setStatus('mandatory') ifNumber = MibScalar((1, 3, 6, 1, 2, 1, 2, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifNumber.setStatus('mandatory') ifTable = MibTable((1, 3, 6, 1, 2, 1, 2, 2), ) if mibBuilder.loadTexts: ifTable.setStatus('mandatory') ifEntry = MibTableRow((1, 3, 6, 1, 2, 1, 2, 2, 1), ).setIndexNames((0, "LANART-AGENT", "ifIndex")) if mibBuilder.loadTexts: ifEntry.setStatus('mandatory') ifIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifIndex.setStatus('mandatory') ifDescr = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: ifDescr.setStatus('mandatory') ifType = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))).clone(namedValues=NamedValues(("other", 1), ("regular1822", 2), ("hdh1822", 3), ("ddn-x25", 4), ("rfc877-x25", 5), ("ethernet-csmacd", 6), ("iso88023-csmacd", 7), ("iso88024-tokenBus", 8), ("iso88025-tokenRing", 9), ("iso88026-man", 10), ("starLan", 11), ("proteon-10Mbit", 12), ("proteon-80Mbit", 13), ("hyperchannel", 14), ("fddi", 15), ("lapb", 16), ("sdlc", 17), ("ds1", 18), ("e1", 19), ("basicISDN", 20), ("primaryISDN", 21), ("propPointToPointSerial", 22), ("ppp", 23), ("softwareLoopback", 24), ("eon", 25), ("ethernet-3Mbit", 26), ("nsip", 27), ("slip", 28), ("ultra", 29), ("ds3", 30), ("sip", 31), ("frame-relay", 32)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ifType.setStatus('mandatory') ifMtu = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifMtu.setStatus('mandatory') ifSpeed = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 5), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifSpeed.setStatus('mandatory') ifPhysAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 6), PhysAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifPhysAddress.setStatus('mandatory') ifAdminStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ifAdminStatus.setStatus('mandatory') ifOperStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ifOperStatus.setStatus('mandatory') ifLastChange = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 9), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifLastChange.setStatus('mandatory') ifInOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifInOctets.setStatus('mandatory') ifInUcastPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifInUcastPkts.setStatus('mandatory') ifInNUcastPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifInNUcastPkts.setStatus('mandatory') ifInDiscards = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifInDiscards.setStatus('mandatory') ifInErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifInErrors.setStatus('mandatory') ifInUnknownProtos = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifInUnknownProtos.setStatus('mandatory') ifOutOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifOutOctets.setStatus('mandatory') ifOutUcastPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifOutUcastPkts.setStatus('mandatory') ifOutNUcastPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifOutNUcastPkts.setStatus('mandatory') ifOutDiscards = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifOutDiscards.setStatus('mandatory') ifOutErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifOutErrors.setStatus('mandatory') ifOutQLen = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 21), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifOutQLen.setStatus('mandatory') ifSpecific = MibTableColumn((1, 3, 6, 1, 2, 1, 2, 2, 1, 22), ObjectIdentifier()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifSpecific.setStatus('mandatory') atTable = MibTable((1, 3, 6, 1, 2, 1, 3, 1), ) if mibBuilder.loadTexts: atTable.setStatus('deprecated') atEntry = MibTableRow((1, 3, 6, 1, 2, 1, 3, 1, 1), ).setIndexNames((0, "LANART-AGENT", "atIfIndex"), (0, "LANART-AGENT", "atNetAddress")) if mibBuilder.loadTexts: atEntry.setStatus('deprecated') atIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 3, 1, 1, 1), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atIfIndex.setStatus('deprecated') atPhysAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 3, 1, 1, 2), PhysAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atPhysAddress.setStatus('deprecated') atNetAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 3, 1, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: atNetAddress.setStatus('deprecated') ipForwarding = MibScalar((1, 3, 6, 1, 2, 1, 4, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("forwarding", 1), ("not-forwarding", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipForwarding.setStatus('mandatory') ipDefaultTTL = MibScalar((1, 3, 6, 1, 2, 1, 4, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipDefaultTTL.setStatus('mandatory') ipInReceives = MibScalar((1, 3, 6, 1, 2, 1, 4, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipInReceives.setStatus('mandatory') ipInHdrErrors = MibScalar((1, 3, 6, 1, 2, 1, 4, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipInHdrErrors.setStatus('mandatory') ipInAddrErrors = MibScalar((1, 3, 6, 1, 2, 1, 4, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipInAddrErrors.setStatus('mandatory') ipForwDatagrams = MibScalar((1, 3, 6, 1, 2, 1, 4, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipForwDatagrams.setStatus('mandatory') ipInUnknownProtos = MibScalar((1, 3, 6, 1, 2, 1, 4, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipInUnknownProtos.setStatus('mandatory') ipInDiscards = MibScalar((1, 3, 6, 1, 2, 1, 4, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipInDiscards.setStatus('mandatory') ipInDelivers = MibScalar((1, 3, 6, 1, 2, 1, 4, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipInDelivers.setStatus('mandatory') ipOutRequests = MibScalar((1, 3, 6, 1, 2, 1, 4, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipOutRequests.setStatus('mandatory') ipOutDiscards = MibScalar((1, 3, 6, 1, 2, 1, 4, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipOutDiscards.setStatus('mandatory') ipOutNoRoutes = MibScalar((1, 3, 6, 1, 2, 1, 4, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipOutNoRoutes.setStatus('mandatory') ipReasmTimeout = MibScalar((1, 3, 6, 1, 2, 1, 4, 13), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipReasmTimeout.setStatus('mandatory') ipReasmReqds = MibScalar((1, 3, 6, 1, 2, 1, 4, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipReasmReqds.setStatus('mandatory') ipReasmOKs = MibScalar((1, 3, 6, 1, 2, 1, 4, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipReasmOKs.setStatus('mandatory') ipReasmFails = MibScalar((1, 3, 6, 1, 2, 1, 4, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipReasmFails.setStatus('mandatory') ipFragOKs = MibScalar((1, 3, 6, 1, 2, 1, 4, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipFragOKs.setStatus('mandatory') ipFragFails = MibScalar((1, 3, 6, 1, 2, 1, 4, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipFragFails.setStatus('mandatory') ipFragCreates = MibScalar((1, 3, 6, 1, 2, 1, 4, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipFragCreates.setStatus('mandatory') ipAddrTable = MibTable((1, 3, 6, 1, 2, 1, 4, 20), ) if mibBuilder.loadTexts: ipAddrTable.setStatus('mandatory') ipAddrEntry = MibTableRow((1, 3, 6, 1, 2, 1, 4, 20, 1), ).setIndexNames((0, "LANART-AGENT", "ipAdEntAddr")) if mibBuilder.loadTexts: ipAddrEntry.setStatus('mandatory') ipAdEntAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 20, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipAdEntAddr.setStatus('mandatory') ipAdEntIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 20, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipAdEntIfIndex.setStatus('mandatory') ipAdEntNetMask = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 20, 1, 3), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipAdEntNetMask.setStatus('mandatory') ipAdEntBcastAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 20, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipAdEntBcastAddr.setStatus('mandatory') ipAdEntReasmMaxSize = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 20, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: ipAdEntReasmMaxSize.setStatus('mandatory') ipRouteTable = MibTable((1, 3, 6, 1, 2, 1, 4, 21), ) if mibBuilder.loadTexts: ipRouteTable.setStatus('mandatory') ipRouteEntry = MibTableRow((1, 3, 6, 1, 2, 1, 4, 21, 1), ).setIndexNames((0, "LANART-AGENT", "ipRouteDest")) if mibBuilder.loadTexts: ipRouteEntry.setStatus('mandatory') ipRouteDest = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 1), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipRouteDest.setStatus('mandatory') ipRouteIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 2), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipRouteIfIndex.setStatus('mandatory') ipRouteMetric1 = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 3), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipRouteMetric1.setStatus('mandatory') ipRouteMetric2 = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipRouteMetric2.setStatus('mandatory') ipRouteMetric3 = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 5), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipRouteMetric3.setStatus('mandatory') ipRouteMetric4 = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 6), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipRouteMetric4.setStatus('mandatory') ipRouteNextHop = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 7), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipRouteNextHop.setStatus('mandatory') ipRouteType = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("invalid", 2), ("direct", 3), ("indirect", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipRouteType.setStatus('mandatory') ipRouteProto = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14))).clone(namedValues=NamedValues(("other", 1), ("local", 2), ("netmgmt", 3), ("icmp", 4), ("egp", 5), ("ggp", 6), ("hello", 7), ("rip", 8), ("is-is", 9), ("es-is", 10), ("ciscoIgrp", 11), ("bbnSpfIgp", 12), ("ospf", 13), ("bgp", 14)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ipRouteProto.setStatus('mandatory') ipRouteAge = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 10), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipRouteAge.setStatus('mandatory') ipRouteMask = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 11), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipRouteMask.setStatus('mandatory') ipRouteMetric5 = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 12), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipRouteMetric5.setStatus('mandatory') ipRouteInfo = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 21, 1, 13), ObjectIdentifier()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipRouteInfo.setStatus('mandatory') ipNetToMediaTable = MibTable((1, 3, 6, 1, 2, 1, 4, 22), ) if mibBuilder.loadTexts: ipNetToMediaTable.setStatus('mandatory') ipNetToMediaEntry = MibTableRow((1, 3, 6, 1, 2, 1, 4, 22, 1), ).setIndexNames((0, "LANART-AGENT", "ipNetToMediaIfIndex"), (0, "LANART-AGENT", "ipNetToMediaNetAddress")) if mibBuilder.loadTexts: ipNetToMediaEntry.setStatus('mandatory') ipNetToMediaIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 22, 1, 1), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipNetToMediaIfIndex.setStatus('mandatory') ipNetToMediaPhysAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 22, 1, 2), PhysAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipNetToMediaPhysAddress.setStatus('mandatory') ipNetToMediaNetAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 22, 1, 3), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipNetToMediaNetAddress.setStatus('mandatory') ipNetToMediaType = MibTableColumn((1, 3, 6, 1, 2, 1, 4, 22, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("invalid", 2), ("dynamic", 3), ("static", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: ipNetToMediaType.setStatus('mandatory') ipRoutingDiscards = MibScalar((1, 3, 6, 1, 2, 1, 4, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ipRoutingDiscards.setStatus('mandatory') icmpInMsgs = MibScalar((1, 3, 6, 1, 2, 1, 5, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInMsgs.setStatus('mandatory') icmpInErrors = MibScalar((1, 3, 6, 1, 2, 1, 5, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInErrors.setStatus('mandatory') icmpInDestUnreachs = MibScalar((1, 3, 6, 1, 2, 1, 5, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInDestUnreachs.setStatus('mandatory') icmpInTimeExcds = MibScalar((1, 3, 6, 1, 2, 1, 5, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInTimeExcds.setStatus('mandatory') icmpInParmProbs = MibScalar((1, 3, 6, 1, 2, 1, 5, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInParmProbs.setStatus('mandatory') icmpInSrcQuenchs = MibScalar((1, 3, 6, 1, 2, 1, 5, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInSrcQuenchs.setStatus('mandatory') icmpInRedirects = MibScalar((1, 3, 6, 1, 2, 1, 5, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInRedirects.setStatus('mandatory') icmpInEchos = MibScalar((1, 3, 6, 1, 2, 1, 5, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInEchos.setStatus('mandatory') icmpInEchoReps = MibScalar((1, 3, 6, 1, 2, 1, 5, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInEchoReps.setStatus('mandatory') icmpInTimestamps = MibScalar((1, 3, 6, 1, 2, 1, 5, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInTimestamps.setStatus('mandatory') icmpInTimestampReps = MibScalar((1, 3, 6, 1, 2, 1, 5, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInTimestampReps.setStatus('mandatory') icmpInAddrMasks = MibScalar((1, 3, 6, 1, 2, 1, 5, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInAddrMasks.setStatus('mandatory') icmpInAddrMaskReps = MibScalar((1, 3, 6, 1, 2, 1, 5, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpInAddrMaskReps.setStatus('mandatory') icmpOutMsgs = MibScalar((1, 3, 6, 1, 2, 1, 5, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutMsgs.setStatus('mandatory') icmpOutErrors = MibScalar((1, 3, 6, 1, 2, 1, 5, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutErrors.setStatus('mandatory') icmpOutDestUnreachs = MibScalar((1, 3, 6, 1, 2, 1, 5, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutDestUnreachs.setStatus('mandatory') icmpOutTimeExcds = MibScalar((1, 3, 6, 1, 2, 1, 5, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutTimeExcds.setStatus('mandatory') icmpOutParmProbs = MibScalar((1, 3, 6, 1, 2, 1, 5, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutParmProbs.setStatus('mandatory') icmpOutSrcQuenchs = MibScalar((1, 3, 6, 1, 2, 1, 5, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutSrcQuenchs.setStatus('mandatory') icmpOutRedirects = MibScalar((1, 3, 6, 1, 2, 1, 5, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutRedirects.setStatus('mandatory') icmpOutEchos = MibScalar((1, 3, 6, 1, 2, 1, 5, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutEchos.setStatus('mandatory') icmpOutEchoReps = MibScalar((1, 3, 6, 1, 2, 1, 5, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutEchoReps.setStatus('mandatory') icmpOutTimestamps = MibScalar((1, 3, 6, 1, 2, 1, 5, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutTimestamps.setStatus('mandatory') icmpOutTimestampReps = MibScalar((1, 3, 6, 1, 2, 1, 5, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutTimestampReps.setStatus('mandatory') icmpOutAddrMasks = MibScalar((1, 3, 6, 1, 2, 1, 5, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutAddrMasks.setStatus('mandatory') icmpOutAddrMaskReps = MibScalar((1, 3, 6, 1, 2, 1, 5, 26), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: icmpOutAddrMaskReps.setStatus('mandatory') tcpRtoAlgorithm = MibScalar((1, 3, 6, 1, 2, 1, 6, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("constant", 2), ("rsre", 3), ("vanj", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpRtoAlgorithm.setStatus('mandatory') tcpRtoMin = MibScalar((1, 3, 6, 1, 2, 1, 6, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpRtoMin.setStatus('mandatory') tcpRtoMax = MibScalar((1, 3, 6, 1, 2, 1, 6, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpRtoMax.setStatus('mandatory') tcpMaxConn = MibScalar((1, 3, 6, 1, 2, 1, 6, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpMaxConn.setStatus('mandatory') tcpActiveOpens = MibScalar((1, 3, 6, 1, 2, 1, 6, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpActiveOpens.setStatus('mandatory') tcpPassiveOpens = MibScalar((1, 3, 6, 1, 2, 1, 6, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpPassiveOpens.setStatus('mandatory') tcpAttemptFails = MibScalar((1, 3, 6, 1, 2, 1, 6, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpAttemptFails.setStatus('mandatory') tcpEstabResets = MibScalar((1, 3, 6, 1, 2, 1, 6, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpEstabResets.setStatus('mandatory') tcpCurrEstab = MibScalar((1, 3, 6, 1, 2, 1, 6, 9), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpCurrEstab.setStatus('mandatory') tcpInSegs = MibScalar((1, 3, 6, 1, 2, 1, 6, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpInSegs.setStatus('mandatory') tcpOutSegs = MibScalar((1, 3, 6, 1, 2, 1, 6, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpOutSegs.setStatus('mandatory') tcpRetransSegs = MibScalar((1, 3, 6, 1, 2, 1, 6, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpRetransSegs.setStatus('mandatory') tcpConnTable = MibTable((1, 3, 6, 1, 2, 1, 6, 13), ) if mibBuilder.loadTexts: tcpConnTable.setStatus('mandatory') tcpConnEntry = MibTableRow((1, 3, 6, 1, 2, 1, 6, 13, 1), ).setIndexNames((0, "LANART-AGENT", "tcpConnLocalAddress"), (0, "LANART-AGENT", "tcpConnLocalPort"), (0, "LANART-AGENT", "tcpConnRemAddress"), (0, "LANART-AGENT", "tcpConnRemPort")) if mibBuilder.loadTexts: tcpConnEntry.setStatus('mandatory') tcpConnState = MibTableColumn((1, 3, 6, 1, 2, 1, 6, 13, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12))).clone(namedValues=NamedValues(("closed", 1), ("listen", 2), ("synSent", 3), ("synReceived", 4), ("established", 5), ("finWait1", 6), ("finWait2", 7), ("closeWait", 8), ("lastAck", 9), ("closing", 10), ("timeWait", 11), ("deleteTCB", 12)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: tcpConnState.setStatus('mandatory') tcpConnLocalAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 6, 13, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpConnLocalAddress.setStatus('mandatory') tcpConnLocalPort = MibTableColumn((1, 3, 6, 1, 2, 1, 6, 13, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpConnLocalPort.setStatus('mandatory') tcpConnRemAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 6, 13, 1, 4), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpConnRemAddress.setStatus('mandatory') tcpConnRemPort = MibTableColumn((1, 3, 6, 1, 2, 1, 6, 13, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpConnRemPort.setStatus('mandatory') tcpInErrs = MibScalar((1, 3, 6, 1, 2, 1, 6, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpInErrs.setStatus('mandatory') tcpOutRsts = MibScalar((1, 3, 6, 1, 2, 1, 6, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: tcpOutRsts.setStatus('mandatory') udpInDatagrams = MibScalar((1, 3, 6, 1, 2, 1, 7, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: udpInDatagrams.setStatus('mandatory') udpNoPorts = MibScalar((1, 3, 6, 1, 2, 1, 7, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: udpNoPorts.setStatus('mandatory') udpInErrors = MibScalar((1, 3, 6, 1, 2, 1, 7, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: udpInErrors.setStatus('mandatory') udpOutDatagrams = MibScalar((1, 3, 6, 1, 2, 1, 7, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: udpOutDatagrams.setStatus('mandatory') udpTable = MibTable((1, 3, 6, 1, 2, 1, 7, 5), ) if mibBuilder.loadTexts: udpTable.setStatus('mandatory') udpEntry = MibTableRow((1, 3, 6, 1, 2, 1, 7, 5, 1), ).setIndexNames((0, "LANART-AGENT", "udpLocalAddress"), (0, "LANART-AGENT", "udpLocalPort")) if mibBuilder.loadTexts: udpEntry.setStatus('mandatory') udpLocalAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 7, 5, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: udpLocalAddress.setStatus('mandatory') udpLocalPort = MibTableColumn((1, 3, 6, 1, 2, 1, 7, 5, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: udpLocalPort.setStatus('mandatory') snmpInPkts = MibScalar((1, 3, 6, 1, 2, 1, 11, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInPkts.setStatus('mandatory') snmpOutPkts = MibScalar((1, 3, 6, 1, 2, 1, 11, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpOutPkts.setStatus('mandatory') snmpInBadVersions = MibScalar((1, 3, 6, 1, 2, 1, 11, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInBadVersions.setStatus('mandatory') snmpInBadCommunityNames = MibScalar((1, 3, 6, 1, 2, 1, 11, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInBadCommunityNames.setStatus('mandatory') snmpInBadCommunityUses = MibScalar((1, 3, 6, 1, 2, 1, 11, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInBadCommunityUses.setStatus('mandatory') snmpInASNParseErrs = MibScalar((1, 3, 6, 1, 2, 1, 11, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInASNParseErrs.setStatus('mandatory') snmpInTooBigs = MibScalar((1, 3, 6, 1, 2, 1, 11, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInTooBigs.setStatus('mandatory') snmpInNoSuchNames = MibScalar((1, 3, 6, 1, 2, 1, 11, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInNoSuchNames.setStatus('mandatory') snmpInBadValues = MibScalar((1, 3, 6, 1, 2, 1, 11, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInBadValues.setStatus('mandatory') snmpInReadOnlys = MibScalar((1, 3, 6, 1, 2, 1, 11, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInReadOnlys.setStatus('mandatory') snmpInGenErrs = MibScalar((1, 3, 6, 1, 2, 1, 11, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInGenErrs.setStatus('mandatory') snmpInTotalReqVars = MibScalar((1, 3, 6, 1, 2, 1, 11, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInTotalReqVars.setStatus('mandatory') snmpInTotalSetVars = MibScalar((1, 3, 6, 1, 2, 1, 11, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInTotalSetVars.setStatus('mandatory') snmpInGetRequests = MibScalar((1, 3, 6, 1, 2, 1, 11, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInGetRequests.setStatus('mandatory') snmpInGetNexts = MibScalar((1, 3, 6, 1, 2, 1, 11, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInGetNexts.setStatus('mandatory') snmpInSetRequests = MibScalar((1, 3, 6, 1, 2, 1, 11, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInSetRequests.setStatus('mandatory') snmpInGetResponses = MibScalar((1, 3, 6, 1, 2, 1, 11, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInGetResponses.setStatus('mandatory') snmpInTraps = MibScalar((1, 3, 6, 1, 2, 1, 11, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpInTraps.setStatus('mandatory') snmpOutTooBigs = MibScalar((1, 3, 6, 1, 2, 1, 11, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpOutTooBigs.setStatus('mandatory') snmpOutNoSuchNames = MibScalar((1, 3, 6, 1, 2, 1, 11, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpOutNoSuchNames.setStatus('mandatory') snmpOutBadValues = MibScalar((1, 3, 6, 1, 2, 1, 11, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpOutBadValues.setStatus('mandatory') snmpOutGenErrs = MibScalar((1, 3, 6, 1, 2, 1, 11, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpOutGenErrs.setStatus('mandatory') snmpOutGetRequests = MibScalar((1, 3, 6, 1, 2, 1, 11, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpOutGetRequests.setStatus('mandatory') snmpOutGetNexts = MibScalar((1, 3, 6, 1, 2, 1, 11, 26), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpOutGetNexts.setStatus('mandatory') snmpOutSetRequests = MibScalar((1, 3, 6, 1, 2, 1, 11, 27), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpOutSetRequests.setStatus('mandatory') snmpOutGetResponses = MibScalar((1, 3, 6, 1, 2, 1, 11, 28), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpOutGetResponses.setStatus('mandatory') snmpOutTraps = MibScalar((1, 3, 6, 1, 2, 1, 11, 29), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: snmpOutTraps.setStatus('mandatory') snmpEnableAuthenTraps = MibScalar((1, 3, 6, 1, 2, 1, 11, 30), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: snmpEnableAuthenTraps.setStatus('mandatory') class MacAddress(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(6, 6) fixedLength = 6 class BridgeId(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(8, 8) fixedLength = 8 class Timeout(Integer32): pass dot1dBridge = MibIdentifier((1, 3, 6, 1, 2, 1, 17)) dot1dBase = MibIdentifier((1, 3, 6, 1, 2, 1, 17, 1)) dot1dStp = MibIdentifier((1, 3, 6, 1, 2, 1, 17, 2)) dot1dSr = MibIdentifier((1, 3, 6, 1, 2, 1, 17, 3)) dot1dTp = MibIdentifier((1, 3, 6, 1, 2, 1, 17, 4)) dot1dStatic = MibIdentifier((1, 3, 6, 1, 2, 1, 17, 5)) newRoot = NotificationType((1, 3, 6, 1, 2, 1, 17) + (0,1)) topologyChange = NotificationType((1, 3, 6, 1, 2, 1, 17) + (0,2)) snmpDot3RptrMgt = MibIdentifier((1, 3, 6, 1, 2, 1, 22)) rptrBasicPackage = MibIdentifier((1, 3, 6, 1, 2, 1, 22, 1)) rptrMonitorPackage = MibIdentifier((1, 3, 6, 1, 2, 1, 22, 2)) rptrAddrTrackPackage = MibIdentifier((1, 3, 6, 1, 2, 1, 22, 3)) rptrRptrInfo = MibIdentifier((1, 3, 6, 1, 2, 1, 22, 1, 1)) rptrGroupInfo = MibIdentifier((1, 3, 6, 1, 2, 1, 22, 1, 2)) rptrPortInfo = MibIdentifier((1, 3, 6, 1, 2, 1, 22, 1, 3)) rptrMonitorRptrInfo = MibIdentifier((1, 3, 6, 1, 2, 1, 22, 2, 1)) rptrMonitorGroupInfo = MibIdentifier((1, 3, 6, 1, 2, 1, 22, 2, 2)) rptrMonitorPortInfo = MibIdentifier((1, 3, 6, 1, 2, 1, 22, 2, 3)) rptrAddrTrackRptrInfo = MibIdentifier((1, 3, 6, 1, 2, 1, 22, 3, 1)) rptrAddrTrackGroupInfo = MibIdentifier((1, 3, 6, 1, 2, 1, 22, 3, 2)) rptrAddrTrackPortInfo = MibIdentifier((1, 3, 6, 1, 2, 1, 22, 3, 3)) rptrGroupCapacity = MibScalar((1, 3, 6, 1, 2, 1, 22, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrGroupCapacity.setStatus('mandatory') rptrOperStatus = MibScalar((1, 3, 6, 1, 2, 1, 22, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("other", 1), ("ok", 2), ("rptrFailure", 3), ("groupFailure", 4), ("portFailure", 5), ("generalFailure", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrOperStatus.setStatus('mandatory') rptrHealthText = MibScalar((1, 3, 6, 1, 2, 1, 22, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrHealthText.setStatus('mandatory') rptrReset = MibScalar((1, 3, 6, 1, 2, 1, 22, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("noReset", 1), ("reset", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rptrReset.setStatus('mandatory') rptrNonDisruptTest = MibScalar((1, 3, 6, 1, 2, 1, 22, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("noSelfTest", 1), ("selfTest", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rptrNonDisruptTest.setStatus('mandatory') rptrTotalPartitionedPorts = MibScalar((1, 3, 6, 1, 2, 1, 22, 1, 1, 6), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrTotalPartitionedPorts.setStatus('mandatory') rptrGroupTable = MibTable((1, 3, 6, 1, 2, 1, 22, 1, 2, 1), ) if mibBuilder.loadTexts: rptrGroupTable.setStatus('mandatory') rptrGroupEntry = MibTableRow((1, 3, 6, 1, 2, 1, 22, 1, 2, 1, 1), ).setIndexNames((0, "LANART-AGENT", "rptrGroupIndex")) if mibBuilder.loadTexts: rptrGroupEntry.setStatus('mandatory') rptrGroupIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 1, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrGroupIndex.setStatus('mandatory') rptrGroupDescr = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 1, 2, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrGroupDescr.setStatus('mandatory') rptrGroupObjectID = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 1, 2, 1, 1, 3), ObjectIdentifier()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrGroupObjectID.setStatus('mandatory') rptrGroupOperStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 1, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("other", 1), ("operational", 2), ("malfunctioning", 3), ("notPresent", 4), ("underTest", 5), ("resetInProgress", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrGroupOperStatus.setStatus('mandatory') rptrGroupLastOperStatusChange = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 1, 2, 1, 1, 5), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrGroupLastOperStatusChange.setStatus('mandatory') rptrGroupPortCapacity = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 1, 2, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrGroupPortCapacity.setStatus('mandatory') rptrPortTable = MibTable((1, 3, 6, 1, 2, 1, 22, 1, 3, 1), ) if mibBuilder.loadTexts: rptrPortTable.setStatus('mandatory') rptrPortEntry = MibTableRow((1, 3, 6, 1, 2, 1, 22, 1, 3, 1, 1), ).setIndexNames((0, "LANART-AGENT", "rptrPortGroupIndex"), (0, "LANART-AGENT", "rptrPortIndex")) if mibBuilder.loadTexts: rptrPortEntry.setStatus('mandatory') rptrPortGroupIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 1, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrPortGroupIndex.setStatus('mandatory') rptrPortIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 1, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrPortIndex.setStatus('mandatory') rptrPortAdminStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 1, 3, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: rptrPortAdminStatus.setStatus('mandatory') rptrPortAutoPartitionState = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 1, 3, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("notAutoPartitioned", 1), ("autoPartitioned", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrPortAutoPartitionState.setStatus('mandatory') rptrPortOperStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 1, 3, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("operational", 1), ("notOperational", 2), ("notPresent", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrPortOperStatus.setStatus('mandatory') rptrMonitorTransmitCollisions = MibScalar((1, 3, 6, 1, 2, 1, 22, 2, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorTransmitCollisions.setStatus('mandatory') rptrMonitorGroupTable = MibTable((1, 3, 6, 1, 2, 1, 22, 2, 2, 1), ) if mibBuilder.loadTexts: rptrMonitorGroupTable.setStatus('mandatory') rptrMonitorGroupEntry = MibTableRow((1, 3, 6, 1, 2, 1, 22, 2, 2, 1, 1), ).setIndexNames((0, "LANART-AGENT", "rptrMonitorGroupIndex")) if mibBuilder.loadTexts: rptrMonitorGroupEntry.setStatus('mandatory') rptrMonitorGroupIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorGroupIndex.setStatus('mandatory') rptrMonitorGroupTotalFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 2, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorGroupTotalFrames.setStatus('mandatory') rptrMonitorGroupTotalOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 2, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorGroupTotalOctets.setStatus('mandatory') rptrMonitorGroupTotalErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 2, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorGroupTotalErrors.setStatus('mandatory') rptrMonitorPortTable = MibTable((1, 3, 6, 1, 2, 1, 22, 2, 3, 1), ) if mibBuilder.loadTexts: rptrMonitorPortTable.setStatus('mandatory') rptrMonitorPortEntry = MibTableRow((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1), ).setIndexNames((0, "LANART-AGENT", "rptrMonitorPortGroupIndex"), (0, "LANART-AGENT", "rptrMonitorPortIndex")) if mibBuilder.loadTexts: rptrMonitorPortEntry.setStatus('mandatory') rptrMonitorPortGroupIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortGroupIndex.setStatus('mandatory') rptrMonitorPortIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortIndex.setStatus('mandatory') rptrMonitorPortReadableFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortReadableFrames.setStatus('mandatory') rptrMonitorPortReadableOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortReadableOctets.setStatus('mandatory') rptrMonitorPortFCSErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortFCSErrors.setStatus('mandatory') rptrMonitorPortAlignmentErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortAlignmentErrors.setStatus('mandatory') rptrMonitorPortFrameTooLongs = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortFrameTooLongs.setStatus('mandatory') rptrMonitorPortShortEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortShortEvents.setStatus('mandatory') rptrMonitorPortRunts = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortRunts.setStatus('mandatory') rptrMonitorPortCollisions = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortCollisions.setStatus('mandatory') rptrMonitorPortLateEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortLateEvents.setStatus('mandatory') rptrMonitorPortVeryLongEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortVeryLongEvents.setStatus('mandatory') rptrMonitorPortDataRateMismatches = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortDataRateMismatches.setStatus('mandatory') rptrMonitorPortAutoPartitions = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortAutoPartitions.setStatus('mandatory') rptrMonitorPortTotalErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 2, 3, 1, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrMonitorPortTotalErrors.setStatus('mandatory') rptrAddrTrackTable = MibTable((1, 3, 6, 1, 2, 1, 22, 3, 3, 1), ) if mibBuilder.loadTexts: rptrAddrTrackTable.setStatus('mandatory') rptrAddrTrackEntry = MibTableRow((1, 3, 6, 1, 2, 1, 22, 3, 3, 1, 1), ).setIndexNames((0, "LANART-AGENT", "rptrAddrTrackGroupIndex"), (0, "LANART-AGENT", "rptrAddrTrackPortIndex")) if mibBuilder.loadTexts: rptrAddrTrackEntry.setStatus('mandatory') rptrAddrTrackGroupIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 3, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrAddrTrackGroupIndex.setStatus('mandatory') rptrAddrTrackPortIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 3, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrAddrTrackPortIndex.setStatus('mandatory') rptrAddrTrackLastSourceAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 3, 3, 1, 1, 3), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrAddrTrackLastSourceAddress.setStatus('mandatory') rptrAddrTrackSourceAddrChanges = MibTableColumn((1, 3, 6, 1, 2, 1, 22, 3, 3, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: rptrAddrTrackSourceAddrChanges.setStatus('mandatory') rptrHealth = NotificationType((1, 3, 6, 1, 2, 1, 22) + (0,1)).setObjects(("LANART-AGENT", "rptrOperStatus")) rptrGroupChange = NotificationType((1, 3, 6, 1, 2, 1, 22) + (0,2)).setObjects(("LANART-AGENT", "rptrGroupIndex")) rptrResetEvent = NotificationType((1, 3, 6, 1, 2, 1, 22) + (0,3)).setObjects(("LANART-AGENT", "rptrOperStatus")) lanart = MibIdentifier((1, 3, 6, 1, 4, 1, 712)) laMib1 = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1)) laProducts = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1)) laHubMib = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 2)) laSys = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 2, 1)) laTpPort = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 2, 2)) laTpHub = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1)) laTpHub1 = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 1)) etm120x = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 1, 12)) etm160x = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 1, 16)) etm240x = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 1, 24)) laTpHub2 = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 2)) ete120x = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 2, 12)) ete160x = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 2, 16)) ete240x = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 2, 24)) laTpHub3 = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 3)) bbAui = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 3, 0)) bbAuiTp = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 3, 1)) bbAuiBnc = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 3, 2)) bbAuiTpBnc = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 3, 3)) bbAui10BASE_FL = MibIdentifier((1, 3, 6, 1, 4, 1, 712, 1, 1, 1, 3, 4)).setLabel("bbAui10BASE-FL") laSysConfig = MibScalar((1, 3, 6, 1, 4, 1, 712, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("save", 1), ("load", 2), ("factory", 3), ("ok", 4), ("failed", 5)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: laSysConfig.setStatus('mandatory') laJoystick = MibScalar((1, 3, 6, 1, 4, 1, 712, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: laJoystick.setStatus('mandatory') laLinkAlert = MibScalar((1, 3, 6, 1, 4, 1, 712, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2), ("not-applicable", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: laLinkAlert.setStatus('mandatory') laTpPortTable = MibTable((1, 3, 6, 1, 4, 1, 712, 1, 2, 2, 1), ) if mibBuilder.loadTexts: laTpPortTable.setStatus('mandatory') laTpPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 712, 1, 2, 2, 1, 1), ).setIndexNames((0, "LANART-AGENT", "laTpPortGroupIndex"), (0, "LANART-AGENT", "laTpPortIndex")) if mibBuilder.loadTexts: laTpPortEntry.setStatus('mandatory') laTpPortGroupIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 712, 1, 2, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: laTpPortGroupIndex.setStatus('mandatory') laTpPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 712, 1, 2, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1024))).setMaxAccess("readonly") if mibBuilder.loadTexts: laTpPortIndex.setStatus('mandatory') laTpLinkTest = MibTableColumn((1, 3, 6, 1, 4, 1, 712, 1, 2, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2), ("failed", 3), ("not-applicable", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: laTpLinkTest.setStatus('mandatory') laTpAutoPolarity = MibTableColumn((1, 3, 6, 1, 4, 1, 712, 1, 2, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2), ("corrected", 3), ("not-applicable", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: laTpAutoPolarity.setStatus('mandatory') mibBuilder.exportSymbols("LANART-AGENT", rptrRptrInfo=rptrRptrInfo, ifOutOctets=ifOutOctets, ipRouteMask=ipRouteMask, ipFragOKs=ipFragOKs, mib_2=mib_2, atPhysAddress=atPhysAddress, atNetAddress=atNetAddress, snmpOutGenErrs=snmpOutGenErrs, ipInDelivers=ipInDelivers, ifOutErrors=ifOutErrors, icmpOutAddrMasks=icmpOutAddrMasks, snmpInGenErrs=snmpInGenErrs, mgmt=mgmt, internet=internet, ipInDiscards=ipInDiscards, rptrPortInfo=rptrPortInfo, rptrGroupOperStatus=rptrGroupOperStatus, rptrMonitorPortTotalErrors=rptrMonitorPortTotalErrors, ccitt=ccitt, ifMtu=ifMtu, rptrMonitorPortTable=rptrMonitorPortTable, icmpOutRedirects=icmpOutRedirects, rptrMonitorPortDataRateMismatches=rptrMonitorPortDataRateMismatches, rptrMonitorGroupIndex=rptrMonitorGroupIndex, ipReasmReqds=ipReasmReqds, tcpConnTable=tcpConnTable, dot1dBridge=dot1dBridge, ip=ip, icmpInAddrMaskReps=icmpInAddrMaskReps, snmpInTotalSetVars=snmpInTotalSetVars, snmpEnableAuthenTraps=snmpEnableAuthenTraps, rptrMonitorGroupTotalOctets=rptrMonitorGroupTotalOctets, etm120x=etm120x, snmpInTraps=snmpInTraps, egp=egp, rptrPortOperStatus=rptrPortOperStatus, rptrAddrTrackRptrInfo=rptrAddrTrackRptrInfo, bbAuiTp=bbAuiTp, icmpOutMsgs=icmpOutMsgs, ipReasmOKs=ipReasmOKs, transmission=transmission, ifType=ifType, tcpConnRemAddress=tcpConnRemAddress, icmpOutErrors=icmpOutErrors, ipFragFails=ipFragFails, atTable=atTable, snmpInGetRequests=snmpInGetRequests, icmpOutDestUnreachs=icmpOutDestUnreachs, tcpRtoMin=tcpRtoMin, rptrPortGroupIndex=rptrPortGroupIndex, rptrMonitorPortReadableFrames=rptrMonitorPortReadableFrames, udpEntry=udpEntry, sysObjectID=sysObjectID, ifOperStatus=ifOperStatus, ipRouteAge=ipRouteAge, laProducts=laProducts, rptrMonitorRptrInfo=rptrMonitorRptrInfo, null=null, snmpInSetRequests=snmpInSetRequests, ifTable=ifTable, ipInReceives=ipInReceives, snmpInTooBigs=snmpInTooBigs, ipRouteMetric1=ipRouteMetric1, laMib1=laMib1, atEntry=atEntry, dot1dStp=dot1dStp, rptrGroupObjectID=rptrGroupObjectID, ipInHdrErrors=ipInHdrErrors, ifInOctets=ifInOctets, snmpOutPkts=snmpOutPkts, ipRouteMetric2=ipRouteMetric2, ipNetToMediaType=ipNetToMediaType, laTpHub1=laTpHub1, icmp=icmp, ipForwarding=ipForwarding, rptrGroupIndex=rptrGroupIndex, sysLocation=sysLocation, rptrMonitorGroupTotalFrames=rptrMonitorGroupTotalFrames, rptrMonitorPortVeryLongEvents=rptrMonitorPortVeryLongEvents, snmpInGetResponses=snmpInGetResponses, ete240x=ete240x, laTpPort=laTpPort, icmpOutAddrMaskReps=icmpOutAddrMaskReps, rptrMonitorPortReadableOctets=rptrMonitorPortReadableOctets, icmpInParmProbs=icmpInParmProbs, MacAddress=MacAddress, ifDescr=ifDescr, ipRouteIfIndex=ipRouteIfIndex, ipRoutingDiscards=ipRoutingDiscards, tcpAttemptFails=tcpAttemptFails, snmpOutGetResponses=snmpOutGetResponses, snmpInBadCommunityUses=snmpInBadCommunityUses, rptrMonitorPortLateEvents=rptrMonitorPortLateEvents, dot1dStatic=dot1dStatic, udpNoPorts=udpNoPorts, snmpInBadVersions=snmpInBadVersions, rptrMonitorPortFCSErrors=rptrMonitorPortFCSErrors, laTpPortGroupIndex=laTpPortGroupIndex, snmpInBadValues=snmpInBadValues, tcp=tcp, experimental=experimental, ifOutNUcastPkts=ifOutNUcastPkts, ifInDiscards=ifInDiscards, snmpOutGetNexts=snmpOutGetNexts, rptrAddrTrackGroupInfo=rptrAddrTrackGroupInfo, rptrResetEvent=rptrResetEvent, ifOutUcastPkts=ifOutUcastPkts, snmpOutTraps=snmpOutTraps, dot1dTp=dot1dTp, rptrAddrTrackPortInfo=rptrAddrTrackPortInfo, icmpInTimestamps=icmpInTimestamps, laTpHub3=laTpHub3, rptrMonitorPortIndex=rptrMonitorPortIndex, tcpRtoMax=tcpRtoMax, tcpConnLocalPort=tcpConnLocalPort, rptrOperStatus=rptrOperStatus, ipNetToMediaEntry=ipNetToMediaEntry, snmpOutSetRequests=snmpOutSetRequests, dot1dSr=dot1dSr, rptrPortTable=rptrPortTable, snmp=snmp, laTpAutoPolarity=laTpAutoPolarity, ipOutDiscards=ipOutDiscards, icmpOutTimestampReps=icmpOutTimestampReps, ipForwDatagrams=ipForwDatagrams, rptrHealthText=rptrHealthText, system=system, tcpInSegs=tcpInSegs, etm240x=etm240x, interfaces=interfaces, ipAdEntBcastAddr=ipAdEntBcastAddr, icmpOutSrcQuenchs=icmpOutSrcQuenchs, BridgeId=BridgeId, ipRouteDest=ipRouteDest, rptrMonitorGroupTotalErrors=rptrMonitorGroupTotalErrors, rptrPortAutoPartitionState=rptrPortAutoPartitionState, tcpCurrEstab=tcpCurrEstab, snmpInBadCommunityNames=snmpInBadCommunityNames, ipRouteMetric3=ipRouteMetric3, rptrGroupChange=rptrGroupChange, rptrNonDisruptTest=rptrNonDisruptTest, sysServices=sysServices, snmpInPkts=snmpInPkts, udpLocalAddress=udpLocalAddress, rptrGroupPortCapacity=rptrGroupPortCapacity, laJoystick=laJoystick, bbAuiBnc=bbAuiBnc, rptrAddrTrackPortIndex=rptrAddrTrackPortIndex, ifEntry=ifEntry, ipNetToMediaPhysAddress=ipNetToMediaPhysAddress, laSysConfig=laSysConfig, enterprises=enterprises, ipReasmFails=ipReasmFails, snmpOutTooBigs=snmpOutTooBigs, rptrMonitorPortAlignmentErrors=rptrMonitorPortAlignmentErrors, rptrGroupLastOperStatusChange=rptrGroupLastOperStatusChange, laLinkAlert=laLinkAlert, icmpInErrors=icmpInErrors, udpInErrors=udpInErrors, rptrMonitorGroupTable=rptrMonitorGroupTable, ipRouteInfo=ipRouteInfo, rptrMonitorPackage=rptrMonitorPackage, icmpOutTimeExcds=icmpOutTimeExcds, ipInUnknownProtos=ipInUnknownProtos, rptrMonitorPortShortEvents=rptrMonitorPortShortEvents, dot1dBase=dot1dBase, tcpRetransSegs=tcpRetransSegs, udpOutDatagrams=udpOutDatagrams, org=org, rptrMonitorPortEntry=rptrMonitorPortEntry, rptrGroupDescr=rptrGroupDescr, private=private, rptrMonitorPortAutoPartitions=rptrMonitorPortAutoPartitions, rptrGroupInfo=rptrGroupInfo, ifAdminStatus=ifAdminStatus, ipNetToMediaTable=ipNetToMediaTable, rptrAddrTrackSourceAddrChanges=rptrAddrTrackSourceAddrChanges, rptrMonitorPortRunts=rptrMonitorPortRunts, ipAdEntNetMask=ipAdEntNetMask, tcpOutSegs=tcpOutSegs, rptrTotalPartitionedPorts=rptrTotalPartitionedPorts, ifSpeed=ifSpeed, sysName=sysName, ipOutRequests=ipOutRequests, ifInNUcastPkts=ifInNUcastPkts, laTpPortEntry=laTpPortEntry, ipRouteEntry=ipRouteEntry, at=at, rptrPortIndex=rptrPortIndex, ifIndex=ifIndex, etm160x=etm160x, tcpMaxConn=tcpMaxConn, icmpInDestUnreachs=icmpInDestUnreachs, rptrAddrTrackEntry=rptrAddrTrackEntry, udpLocalPort=udpLocalPort, icmpOutTimestamps=icmpOutTimestamps, tcpConnRemPort=tcpConnRemPort, snmpInNoSuchNames=snmpInNoSuchNames, tcpConnEntry=tcpConnEntry, ifInErrors=ifInErrors, snmpInGetNexts=snmpInGetNexts, newRoot=newRoot, rptrGroupCapacity=rptrGroupCapacity, rptrMonitorGroupEntry=rptrMonitorGroupEntry, rptrMonitorPortFrameTooLongs=rptrMonitorPortFrameTooLongs, ete120x=ete120x, laTpPortTable=laTpPortTable, rptrGroupTable=rptrGroupTable, ifOutQLen=ifOutQLen, rptrMonitorPortGroupIndex=rptrMonitorPortGroupIndex, sysContact=sysContact, icmpInAddrMasks=icmpInAddrMasks, ifInUnknownProtos=ifInUnknownProtos, ifLastChange=ifLastChange, DisplayString=DisplayString, ipAddrTable=ipAddrTable, snmpInASNParseErrs=snmpInASNParseErrs, rptrAddrTrackTable=rptrAddrTrackTable, udp=udp, ipInAddrErrors=ipInAddrErrors, icmpInEchos=icmpInEchos, tcpEstabResets=tcpEstabResets, tcpActiveOpens=tcpActiveOpens, icmpInEchoReps=icmpInEchoReps, laTpHub2=laTpHub2, tcpConnState=tcpConnState, Timeout=Timeout, topologyChange=topologyChange, laTpHub=laTpHub, icmpInTimestampReps=icmpInTimestampReps, ifNumber=ifNumber, ipNetToMediaIfIndex=ipNetToMediaIfIndex, icmpOutEchos=icmpOutEchos, ipAdEntIfIndex=ipAdEntIfIndex, tcpInErrs=tcpInErrs, icmpInTimeExcds=icmpInTimeExcds, laTpPortIndex=laTpPortIndex, rptrBasicPackage=rptrBasicPackage, iso=iso, atIfIndex=atIfIndex, sysUpTime=sysUpTime, icmpInMsgs=icmpInMsgs, udpTable=udpTable, snmpInTotalReqVars=snmpInTotalReqVars, snmpOutGetRequests=snmpOutGetRequests, rptrGroupEntry=rptrGroupEntry, laHubMib=laHubMib, ete160x=ete160x, ipAdEntAddr=ipAdEntAddr, sysDescr=sysDescr, ipRouteNextHop=ipRouteNextHop, ipRouteTable=ipRouteTable, directory=directory, ipReasmTimeout=ipReasmTimeout) mibBuilder.exportSymbols("LANART-AGENT", rptrAddrTrackPackage=rptrAddrTrackPackage, ifSpecific=ifSpecific, rptrAddrTrackLastSourceAddress=rptrAddrTrackLastSourceAddress, rptrAddrTrackGroupIndex=rptrAddrTrackGroupIndex, ifOutDiscards=ifOutDiscards, ifInUcastPkts=ifInUcastPkts, snmpInReadOnlys=snmpInReadOnlys, dod=dod, rptrMonitorTransmitCollisions=rptrMonitorTransmitCollisions, ipRouteType=ipRouteType, rptrReset=rptrReset, rptrPortEntry=rptrPortEntry, ipAddrEntry=ipAddrEntry, PhysAddress=PhysAddress, ipRouteProto=ipRouteProto, rptrMonitorPortInfo=rptrMonitorPortInfo, ipAdEntReasmMaxSize=ipAdEntReasmMaxSize, tcpPassiveOpens=tcpPassiveOpens, icmpInRedirects=icmpInRedirects, tcpConnLocalAddress=tcpConnLocalAddress, udpInDatagrams=udpInDatagrams, bbAuiTpBnc=bbAuiTpBnc, rptrPortAdminStatus=rptrPortAdminStatus, rptrMonitorPortCollisions=rptrMonitorPortCollisions, laTpLinkTest=laTpLinkTest, icmpOutParmProbs=icmpOutParmProbs, snmpOutNoSuchNames=snmpOutNoSuchNames, rptrHealth=rptrHealth, ipRouteMetric5=ipRouteMetric5, ipFragCreates=ipFragCreates, ipRouteMetric4=ipRouteMetric4, laSys=laSys, icmpOutEchoReps=icmpOutEchoReps, lanart=lanart, tcpOutRsts=tcpOutRsts, tcpRtoAlgorithm=tcpRtoAlgorithm, snmpDot3RptrMgt=snmpDot3RptrMgt, ipNetToMediaNetAddress=ipNetToMediaNetAddress, ipOutNoRoutes=ipOutNoRoutes, rptrMonitorGroupInfo=rptrMonitorGroupInfo, icmpInSrcQuenchs=icmpInSrcQuenchs, ipDefaultTTL=ipDefaultTTL, snmpOutBadValues=snmpOutBadValues, bbAui10BASE_FL=bbAui10BASE_FL, ifPhysAddress=ifPhysAddress, bbAui=bbAui)
class PoolUserConfiguration: def __init__(self, pool_name: str, username: str, password: str): self.pool_name = pool_name self.username = username self.password = password def __eq__(self, other): if not isinstance(other, PoolUserConfiguration): return False return self.pool_name == other.pool_name def __str__(self) -> str: return 'PoolUserConfiguration{' \ + 'pool_name=' + self.pool_name \ + ', username=' + self.username \ + ', password=' + self.password \ + '}'
if not ( ( 'a' in vars() or 'a' in globals() ) and type(a) == type(0) ): print("no suitable a") else: print("good to go")
# coding: utf-8 def boo(): a = '这是导入的自定义模块' print(a) return a
""" 0147. Insertion Sort List Medium Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted list (black) initially contains only the first element in the list. With each iteration one element (red) is removed from the input data and inserted in-place into the sorted list Algorithm of Insertion Sort: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. At each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, and inserts it there. It repeats until no input elements remain. Example 1: Input: 4->2->1->3 Output: 1->2->3->4 Example 2: Input: -1->5->3->4->0 Output: -1->0->3->4->5 """ # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def insertionSortList(self, head: ListNode) -> ListNode: dummy = ListNode(0) dummy.next = nodeToInsert = head while head and head.next: if head.val > head.next.val: nodeToInsert = head.next nodeToInsertPre = dummy while nodeToInsertPre.next.val < nodeToInsert.val: nodeToInsertPre = nodeToInsertPre.next head.next = nodeToInsert.next nodeToInsert.next = nodeToInsertPre.next nodeToInsertPre.next = nodeToInsert else: head = head.next return dummy.next
#!/usr/bin/python3 ''' Usando no gerador de html v5 **kwargs Unpacking de dicionario, passando o dicionario e desempacotanto ele Criado exercicio inverso com o nome packing_nomeado ''' def resultado_f1(primeiro, segundo, terceiro): print(f'1) {primeiro}') print(f'2) {segundo}') print(f'3) {terceiro}') if __name__ == '__main__': podium = {'segundo': 'M. Verstappen', 'primeiro': 'L. Hamilton', 'terceiro': 'S. Vettel'} resultado_f1(**podium) # Fontes: # Curso Python 3 - Curso Completo do Básico ao Avançado Udemy Aula 121 # https://github.com/cod3rcursos/curso-python/tree/master/funcoes
# Part of the awpa package: https://github.com/pyga/awpa # See LICENSE for copyright. """Token constants (from "token.h").""" # This file is automatically generated; please don't muck it up! # # To update the symbols in this file, 'cd' to the top directory of # the python source tree after building the interpreter and run: # # ./python Lib/token.py #--start constants-- ENDMARKER = 0 NAME = 1 NUMBER = 2 STRING = 3 NEWLINE = 4 INDENT = 5 DEDENT = 6 LPAR = 7 RPAR = 8 LSQB = 9 RSQB = 10 COLON = 11 COMMA = 12 SEMI = 13 PLUS = 14 MINUS = 15 STAR = 16 SLASH = 17 VBAR = 18 AMPER = 19 LESS = 20 GREATER = 21 EQUAL = 22 DOT = 23 PERCENT = 24 BACKQUOTE = 25 LBRACE = 26 RBRACE = 27 EQEQUAL = 28 NOTEQUAL = 29 LESSEQUAL = 30 GREATEREQUAL = 31 TILDE = 32 CIRCUMFLEX = 33 LEFTSHIFT = 34 RIGHTSHIFT = 35 DOUBLESTAR = 36 PLUSEQUAL = 37 MINEQUAL = 38 STAREQUAL = 39 SLASHEQUAL = 40 PERCENTEQUAL = 41 AMPEREQUAL = 42 VBAREQUAL = 43 CIRCUMFLEXEQUAL = 44 LEFTSHIFTEQUAL = 45 RIGHTSHIFTEQUAL = 46 DOUBLESTAREQUAL = 47 DOUBLESLASH = 48 DOUBLESLASHEQUAL = 49 AT = 50 OP = 51 ERRORTOKEN = 52 N_TOKENS = 53 NT_OFFSET = 256 #--end constants-- tok_name = {value: name for name, value in globals().items() if isinstance(value, int) and not name.startswith('_')} def ISTERMINAL(x): return x < NT_OFFSET def ISNONTERMINAL(x): return x >= NT_OFFSET def ISEOF(x): return x == ENDMARKER
''' A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contains two binary gaps: one of length 4 and one of length 3. The number 20 has binary representation 10100 and contains one binary gap of length 1. The number 15 has binary representation 1111 and has no binary gaps. The number 32 has binary representation 100000 and has no binary gaps. Write a function: def solution(N) that, given a positive integer N, returns the length of its longest binary gap. The function should return 0 if N doesn't contain a binary gap. For example, given N = 1041 the function should return 5, because N has binary representation 10000010001 and so its longest binary gap is of length 5. Given N = 32 the function should return 0, because N has binary representation '100000' and thus no binary gaps. Write an efficient algorithm for the following assumptions: N is an integer within the range [1..2,147,483,647]. ''' def solution(N): i = 0 binary_N = bin(N)[2:] restult_set = [] breaker = False while i < len(binary_N): if binary_N[i] == '1': count = 0 j = i + 1 while j < len(binary_N): if (binary_N[j] == '0') and (j != len(binary_N) - 1 ): count = count + 1 j = j + 1 elif (binary_N[j] == '0') and (j == len(binary_N) - 1 ): breaker = True break elif (binary_N[j] == '1') and (j != len(binary_N) - 1 ): restult_set.append(count) i = j break else: #(A[j] == '1') and (j == len(N) - 1 ) restult_set.append(count) breaker = True break if breaker: break if not restult_set: return 0 else: return sorted(restult_set)[-1]
class Node: """ Class that represent a tile or node in a senku game. ... Attributes ---------- """ def __init__(self, matrix): self.step = 0 # The step or node geneared self.parent_id = 0 # The Node parent id self.name = f'Node: {str(self.step)}!' # Node name self.matrix = matrix # The matrix representation. self.level = 0 # The level in senku, is equivalent to the number of movements self.parent = None # The node parent self.heuristic = 0 # A value that tell us how near is the node to a solution def count_pegs(self): """ Counts the number of filled items (equals to 1). Return ------ The number of filled items """ count = 0 for i in range(0, len(self.matrix)): for j in range(0, len(self.matrix[i])): if self.matrix[i][j] == "1": count += 1 return count def count_level(self): """ Counts the number of empty items (equals to 0). The level is the number of movements made. Return ------ The number of empty items """ count = 0 for i in range(0, len(self.matrix)): for j in range(0,len(self.matrix[i])): if self.matrix[i][j] == "0": count += 1 # We substract 1 to count level from 0 return count - 1 def positions_to_play(self): """ Look for target positions an put them into a list Return ------ a list of target positions """ positions = [] for i in range(0, len(self.matrix)): for j in range(0, len(self.matrix[i])): if self.matrix[i][j] == "0": # Add [row, column] to the list positions.append([i, j]) return positions def verify_winner(self): """ Check if the Node is a solution Return ------ true if the Node is solution """ return self.count_pegs() == 1 def tiles(self, nums, row = 1, spaces = 0): """ Returns the string representation for a row to be printed ... Parameters ---------- nums : list An array with the tiles values row : int The row number spaces : int The number of spaces to add to the string. Return ------ A string with the rows values formated """ # We add the (" " * 5) to align the rows # with odd number of values separator = ("+---+" + (" " * 5)) * row space = (" " * 5) * spaces tile = space + separator + space + "\n" tile += space for i in nums: # We add the (" " * 5) to align the rows # with odd number of values tile += f"| {i} |" + (" " * 5) tile += space + "\n" tile += space + separator + space + "\n" return tile def __str__(self): """ Iterates the Node matrix and return the string that represents the Node Return ------ Node representative string """ # The full representative string str_matrix = "" if self.matrix is not None: # Save the lenght into a variable # to send this number to the tiles method # and calculate the number of spaces spaces = len(self.matrix) for i in range(0, spaces): nums = list(filter(lambda x: x != "_", self.matrix[i])) str_matrix += self.tiles(nums, (i+1), (spaces - i)) return str_matrix def __eq__(self, other): """ Compares two Nodes. Parameters ---------- other : Node Element to be compared Return ------ true if both Nodes have the same matrix """ return self.matrix == other.matrix
#計算用関数 def subset_sum(d,numbers, target, partial=[]): #d,numbers(1からnまでの値のリスト),target(合計x),partial(取り出した値の組み合わせリスト) s = sum(partial) #取り出した組み合わせの合計を求める result = "" #結果出漁用変数初期化 # 組み合わせの合計(s)がtarget(xの値)と等しいかどうかを確認 if s == target: if len(partial) == d: #組み合わせの内、dの数の組み合わせのみ出力 for i in range(len(partial)): result += str(partial[i]) if i == (len(partial)-1): result += " = "+str(target) else: result += " + " print(result) if s >= target: return # sがx以上の場合は呼出しもと(for文内のsubset_sum関数)にリターンする for i in range(len(numbers)): #1からnまでの値を順番に取り出す n = numbers[i] #numbersのiの値を取り出す remaining = numbers[i+1:] #残りの値をスライスし、リストに格納する subset_sum(d,remaining, target, partial + [n]) #subset_sum関数を再帰呼び出しし、第2引数にはnumbersの取り出した残りのリスト(remaining)を渡し、第4引数には組み合わせの合計を求めるリストpartial)に1つずつ取り出したnumbersの値のリスト(n)を連結 #実行プログラム n = int(input("n=")) d = int(input("d=")) x = int(input("x=")) numbers = [] #1からnの数をリストnumbersに格納 for i in range(n): numbers.append(i+1) subset_sum(d,numbers,x)
l = [0,1,2,3,4,5,6,7,8,9,] def f(x): return x**2 print(list(map(f,l))) def fake_map(function,list): list_new = [] for n in list: i = function(n) list_new.append(i) return list_new print(fake_map(f,l))
working = True match working: case True: print("OK") case False: print()
""" tdc_helper.py - tdc helper functions Copyright (C) 2017 Lucas Bates <[email protected]> """ def get_categorized_testlist(alltests, ucat): """ Sort the master test list into categories. """ testcases = dict() for category in ucat: testcases[category] = list(filter(lambda x: category in x['category'], alltests)) return(testcases) def get_unique_item(lst): """ For a list, return a set of the unique items in the list. """ return list(set(lst)) def get_test_categories(alltests): """ Discover all unique test categories present in the test case file. """ ucat = [] for t in alltests: ucat.extend(get_unique_item(t['category'])) ucat = get_unique_item(ucat) return ucat def list_test_cases(testlist): """ Print IDs and names of all test cases. """ for curcase in testlist: print(curcase['id'] + ': (' + ', '.join(curcase['category']) + ") " + curcase['name']) def list_categories(testlist): """ Show all categories that are present in a test case file. """ categories = set(map(lambda x: x['category'], testlist)) print("Available categories:") print(", ".join(str(s) for s in categories)) print("") def print_list(cmdlist): """ Print a list of strings prepended with a tab. """ for l in cmdlist: if (type(l) == list): print("\t" + str(l[0])) else: print("\t" + str(l)) def print_sll(items): print("\n".join(str(s) for s in items)) def print_test_case(tcase): """ Pretty-printing of a given test case. """ for k in tcase.keys(): if (type(tcase[k]) == list): print(k + ":") print_list(tcase[k]) else: print(k + ": " + tcase[k]) def show_test_case_by_id(testlist, caseID): """ Find the specified test case to pretty-print. """ if not any(d.get('id', None) == caseID for d in testlist): print("That ID does not exist.") exit(1) else: print_test_case(next((d for d in testlist if d['id'] == caseID)))
def test_scout_tumor_normal(invoke_cli, tumor_normal_config): # GIVEN a tumor-normal config file # WHEN running analysis result = invoke_cli([ 'plugins', 'scout', '--sample-config', tumor_normal_config, '--customer-id', 'cust000' ]) # THEN it should run without any error print(result) assert result.exit_code == 0 def test_scout_tumor_only(invoke_cli, tumor_only_config): # GIVEN a tumor-only config file # WHEN running analysis result = invoke_cli([ 'plugins', 'scout', '--sample-config', tumor_only_config, '--customer-id', 'cust000' ]) # THEN it should run without any error print(result) assert result.exit_code == 0
''' # Copyright (C) 2020 by ZestIOT. All rights reserved. The # information in this document is the property of ZestIOT. Except # as specifically authorized in writing by ZestIOT, the receiver # of this document shall keep the information contained herein # confidential and shall protect the same in whole or in part from # disclosure and dissemination to third parties. Disclosure and # disseminations to the receiver's employees shall only be made on # a strict need to know basis. Input: Coordinates and Scores of Persons whose view is to be detected and number of persons in ROI. Output: Coordinates, Scores and number of Persons who are viewing in required direction. Requirements: This function shall perform the following: 1)For each person it will identify does the person is looking in required direction by considering the below key points. keypoints are nose,left eye,right eye,left ear,right ear,left shoulder 2)A new list of identified person coordinates and scores viewing in required direction is returned ''' def view_detection(view_coords,view_scores,roi): number_view = 0 motion_coords = [] motion_scores = [] for person in range(0,roi): nose_score,left_eye_score, right_eye_score, nose_x, nose_y, left_eye_y,right_eye_x, right_eye_y, left_ear_score, right_ear_score = view_scores[person][0],view_scores[person][1],view_scores[person][2], view_coords[person][0][0], view_coords[person][0][1], view_coords[person][1][1],view_coords[person][2][0], view_coords[person][2][1], view_scores[person][3], view_scores[person][4] left_shoulder_x, right_shoulder_x = view_coords[person][5][0], view_coords[person][6][0] if (((nose_y < left_eye_y) and (nose_y > right_eye_y) and ((nose_x+45 > left_shoulder_x and nose_x+45 > right_shoulder_x) and (left_ear_score > 0.1 and right_ear_score > 0.1))) or ( left_ear_score < 0.1 and right_ear_score >= 0.3 and left_eye_score >= 0.1 and right_eye_score >= 0.3 and (nose_x+45 > left_shoulder_x and nose_x+45 > right_shoulder_x) and ((right_shoulder_x - right_eye_x) < 41))) : motion_coords.append(view_coords[person]) motion_scores.append(view_scores[person]) number_view = number_view+1 return motion_coords,motion_scores,number_view
# funcs01.py def test_para_02(l1: list ): l1.append(42) def test_para(a: int, b: int, c: int = 10 ): print("*"*34, "test_para", "*"*35) print("Parameter a: ", a) print("Parameter b: ", b) print("Parameter c: ", c) print("*"*80, "\n") x: int = 10 y = 12 z = 13 test_para(x, y, z) print("x: ", x) test_para(20, 30, 40) test_para("A", "B", "C") test_para(100, 200) liste1 = [1,2,3] test_para_02(liste1) print(liste1)
""" Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,3,2]. Note: Recursive solution is trivial, could you do it iteratively? confused what "{1,#,2,3}" means? > read more on how binary tree is serialized on OJ. """ __author__ = 'Danyang' class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def inorderTraversal(self, root): """ Morris Traversal """ ret = [] cur = root while cur: if not cur.left: ret.append(cur.val) cur = cur.right else: pre = cur.left while pre.right and pre.right != cur: pre = pre.right if not pre.right: pre.right = cur cur = cur.left else: pre.right = None ret.append(cur.val) cur = cur.right return ret def inorderTraversal_memory(self, root): """ :type root: TreeNode :param root: :return: a list of integers """ lst = [] self.inorderTraverse_itr(root, lst) return lst def inorderTraverse(self, root, lst): """ In order traverse """ if not root: return self.inorderTraverse(root.left, lst) lst.append(root.val) self.inorderTraverse(root.right, lst) def inorderTraverse_itr(self, root, lst): """ iterative version leftmost first in the lst double loop reference: http://fisherlei.blogspot.sg/2013/01/leetcode-binary-tree-inorder-traversal.html :type root: TreeNode :param root: :param lst: :return: """ if not root: return cur = root stk = [] while stk or cur: while cur: stk.append(cur) cur = cur.left cur = stk.pop() # left_most lst.append(cur.val) cur = cur.right # if cur.right: # should go to next iteration # cur = cur.right # stk.append(cur)
## ## This file is maintained by Ansible - CHANGES WILL BE OVERWRITTEN ## USERS = ( '[email protected]', '[email protected]', '[email protected]' ) NORM_USERS = [ u.lower() for u in USERS ] def dynamic_normal_reserved( user_email ): if user_email is not None and user_email.lower() in NORM_USERS: return 'reserved' return 'slurm_normal' def dynamic_normal_reserved_16gb( user_email ): if user_email is not None and user_email.lower() in NORM_USERS: return 'reserved_16gb' return 'slurm_normal_16gb' def dynamic_normal_reserved_64gb( user_email ): if user_email is not None and user_email.lower() in NORM_USERS: return 'reserved_64gb' return 'slurm_normal_64gb' def dynamic_multi_reserved( user_email ): if user_email is not None and user_email.lower() in NORM_USERS: return 'reserved_multi' return 'slurm_multi'
# Game GAME_NAME = 'Pong-v0' # Preprocessing STACK_SIZE = 4 FRAME_H = 84 FRAME_W = 84 # Model STATE_SHAPE = [FRAME_H, FRAME_W, STACK_SIZE] # Training NUM_EPISODES = 2500 # Discount factor GAMMA = 0.99 # RMSProp LEARNING_RATE = 2.5e-4 # Save the model every 50 episodes SAVE_EVERY = 50 SAVE_PATH = './checkpoints'
SECRET_KEY = 'dev' SQLALCHEMY_DATABASE_URI = 'postgresql:///sopy' SQLALCHEMY_TRACK_MODIFICATIONS = False ALEMBIC_CONTEXT = { 'compare_type': True, 'compare_server_default': True, 'user_module_prefix': 'user', } # Set the following in <app.instance_path>/config.py # On dev that's <project>/instance/config.py # On prod that's <env>/var/sopy-instance/config.py # SE_API_KEY = str # SE_CONSUMER_KEY = int # SE_CONSUMER_SECRET = str # GOOGLE_ANALYTICS_KEY = str
class Tagger(object): tags = [] def __call__(self, tokens): raise NotImplementedError def check_tag(self, tag): return tag in self.tags class PassTagger(Tagger): def __call__(self, tokens): for token in tokens: yield token class TaggersComposition(Tagger): def __init__(self, taggers): self.taggers = taggers def __call__(self, tokens): for tagger in self.taggers: tokens = tagger(tokens) return tokens def check_tag(self, tag): return any( _.check_tag(tag) for _ in self.taggers )
sys.stdout = open("3-letter.txt", "w") data = "abcdefghijklmnopqrstuvwxyz" data += data.upper() for a in data: for b in data: for c in data: print(a+b+c) sys.stdout.close()
# date: 17/07/2020 # Description: # Given a set of words, # find all words that are concatenations of other words in the set. class Solution(object): def findAllConcatenatedWords(self, words): seen = [] wrds = [] for i,a in enumerate(words): for j,b in enumerate(words): # don't check the same string if i != j: # check if the string is in the words list, and has not checked before if a+b in words and a+b not in seen: wrds.append(a+b) seen.append(a+b) return wrds input = ['rat', 'cat', 'cats', 'dog', 'catsdog', 'dogcat', 'dogcatrat'] print(Solution().findAllConcatenatedWords(input)) # ['catsdog', 'dogcat', 'dogcatrat']
#定义简单加减乘除函数 def add(x, y): return (x + y) def subtract(x, y): return(x -y) def multipy(x, y): return(x * y) def devide(x, y): return(x / y) print('请选择想要进行的运算:') print('1.相加') print('2.相减') print('3.相乘') print('4.相除') i = int(input('请选择需要进行的运算:')) num1 = float(input('请输入第一个数:')) num2 = float(input('请输入第二个数:')) if i == 1: print(num1, num2, '的和为:', add(num1, num2)) elif i == 2: print(num1, num2, '相减为:', subtract(num1, num2)) elif i == 3: print(num1, num2, '的积为:', multipy(num1, num2)) elif i == 4: print(num1, num2, '相除为:', devide(num1, num2)) else: print('请非法输入')
# iterators/iterator.py class OddEven: def __init__(self, data): self._data = data self.indexes = (list(range(0, len(data), 2)) + list(range(1, len(data), 2))) def __iter__(self): return self def __next__(self): if self.indexes: return self._data[self.indexes.pop(0)] raise StopIteration oddeven = OddEven('ThIsIsCoOl!') print(''.join(c for c in oddeven)) # TIICO!hssol oddeven = OddEven('CiAo') # or manually... it = iter(oddeven) # this calls oddeven.__iter__ internally print(next(it)) # C print(next(it)) # A print(next(it)) # i print(next(it)) # o # make sure it works correctly with edge cases oddeven = OddEven('') print(' '.join(c for c in oddeven)) oddeven = OddEven('A') print(' '.join(c for c in oddeven)) oddeven = OddEven('Ab') print(' '.join(c for c in oddeven)) oddeven = OddEven('AbC') print(' '.join(c for c in oddeven)) """ $ python iterators/iterator.py TIICO!hssol C A i o A A b A C b """
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # Scratch buffer slice with manual indexing class BufferSlice: def __init__(self, buf, name): self.name = name self.buf = buf self.offset = -1 # Offset into the global scratch buffer self.chunks = [] # Returns the global index into the scratch buffer def get_global_index(self, index): assert (self.offset > -1), 'set_offset needs to be called first' return self.offset + index def get_buffer(self): return self.buf def instance_size(self): return len(self.chunks) def set_offset(self, offset): self.offset = offset def __getitem__(self, index): return self.chunks[index] def __setitem__(self, index, value): current_size = len(self.chunks) while index > current_size: self.chunks.append(None) current_size = len(self.chunks) if index == current_size: self.chunks.append(value) else: self.chunks[index] = value
# Generated by h2py from stdin TCS_MULTILINE = 0x0200 CBRS_ALIGN_LEFT = 0x1000 CBRS_ALIGN_TOP = 0x2000 CBRS_ALIGN_RIGHT = 0x4000 CBRS_ALIGN_BOTTOM = 0x8000 CBRS_ALIGN_ANY = 0xF000 CBRS_BORDER_LEFT = 0x0100 CBRS_BORDER_TOP = 0x0200 CBRS_BORDER_RIGHT = 0x0400 CBRS_BORDER_BOTTOM = 0x0800 CBRS_BORDER_ANY = 0x0F00 CBRS_TOOLTIPS = 0x0010 CBRS_FLYBY = 0x0020 CBRS_FLOAT_MULTI = 0x0040 CBRS_BORDER_3D = 0x0080 CBRS_HIDE_INPLACE = 0x0008 CBRS_SIZE_DYNAMIC = 0x0004 CBRS_SIZE_FIXED = 0x0002 CBRS_FLOATING = 0x0001 CBRS_GRIPPER = 0x00400000 CBRS_ORIENT_HORZ = (CBRS_ALIGN_TOP|CBRS_ALIGN_BOTTOM) CBRS_ORIENT_VERT = (CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT) CBRS_ORIENT_ANY = (CBRS_ORIENT_HORZ|CBRS_ORIENT_VERT) CBRS_ALL = 0xFFFF CBRS_NOALIGN = 0x00000000 CBRS_LEFT = (CBRS_ALIGN_LEFT|CBRS_BORDER_RIGHT) CBRS_TOP = (CBRS_ALIGN_TOP|CBRS_BORDER_BOTTOM) CBRS_RIGHT = (CBRS_ALIGN_RIGHT|CBRS_BORDER_LEFT) CBRS_BOTTOM = (CBRS_ALIGN_BOTTOM|CBRS_BORDER_TOP) SBPS_NORMAL = 0x0000 SBPS_NOBORDERS = 0x0100 SBPS_POPOUT = 0x0200 SBPS_OWNERDRAW = 0x1000 SBPS_DISABLED = 0x04000000 SBPS_STRETCH = 0x08000000 ID_INDICATOR_EXT = 0xE700 ID_INDICATOR_CAPS = 0xE701 ID_INDICATOR_NUM = 0xE702 ID_INDICATOR_SCRL = 0xE703 ID_INDICATOR_OVR = 0xE704 ID_INDICATOR_REC = 0xE705 ID_INDICATOR_KANA = 0xE706 ID_SEPARATOR = 0 AFX_IDW_CONTROLBAR_FIRST = 0xE800 AFX_IDW_CONTROLBAR_LAST = 0xE8FF AFX_IDW_TOOLBAR = 0xE800 AFX_IDW_STATUS_BAR = 0xE801 AFX_IDW_PREVIEW_BAR = 0xE802 AFX_IDW_RESIZE_BAR = 0xE803 AFX_IDW_DOCKBAR_TOP = 0xE81B AFX_IDW_DOCKBAR_LEFT = 0xE81C AFX_IDW_DOCKBAR_RIGHT = 0xE81D AFX_IDW_DOCKBAR_BOTTOM = 0xE81E AFX_IDW_DOCKBAR_FLOAT = 0xE81F def AFX_CONTROLBAR_MASK(nIDC): return (1 << (nIDC - AFX_IDW_CONTROLBAR_FIRST)) AFX_IDW_PANE_FIRST = 0xE900 AFX_IDW_PANE_LAST = 0xE9ff AFX_IDW_HSCROLL_FIRST = 0xEA00 AFX_IDW_VSCROLL_FIRST = 0xEA10 AFX_IDW_SIZE_BOX = 0xEA20 AFX_IDW_PANE_SAVE = 0xEA21 AFX_IDS_APP_TITLE = 0xE000 AFX_IDS_IDLEMESSAGE = 0xE001 AFX_IDS_HELPMODEMESSAGE = 0xE002 AFX_IDS_APP_TITLE_EMBEDDING = 0xE003 AFX_IDS_COMPANY_NAME = 0xE004 AFX_IDS_OBJ_TITLE_INPLACE = 0xE005 ID_FILE_NEW = 0xE100 ID_FILE_OPEN = 0xE101 ID_FILE_CLOSE = 0xE102 ID_FILE_SAVE = 0xE103 ID_FILE_SAVE_AS = 0xE104 ID_FILE_PAGE_SETUP = 0xE105 ID_FILE_PRINT_SETUP = 0xE106 ID_FILE_PRINT = 0xE107 ID_FILE_PRINT_DIRECT = 0xE108 ID_FILE_PRINT_PREVIEW = 0xE109 ID_FILE_UPDATE = 0xE10A ID_FILE_SAVE_COPY_AS = 0xE10B ID_FILE_SEND_MAIL = 0xE10C ID_FILE_MRU_FIRST = 0xE110 ID_FILE_MRU_FILE1 = 0xE110 ID_FILE_MRU_FILE2 = 0xE111 ID_FILE_MRU_FILE3 = 0xE112 ID_FILE_MRU_FILE4 = 0xE113 ID_FILE_MRU_FILE5 = 0xE114 ID_FILE_MRU_FILE6 = 0xE115 ID_FILE_MRU_FILE7 = 0xE116 ID_FILE_MRU_FILE8 = 0xE117 ID_FILE_MRU_FILE9 = 0xE118 ID_FILE_MRU_FILE10 = 0xE119 ID_FILE_MRU_FILE11 = 0xE11A ID_FILE_MRU_FILE12 = 0xE11B ID_FILE_MRU_FILE13 = 0xE11C ID_FILE_MRU_FILE14 = 0xE11D ID_FILE_MRU_FILE15 = 0xE11E ID_FILE_MRU_FILE16 = 0xE11F ID_FILE_MRU_LAST = 0xE11F ID_EDIT_CLEAR = 0xE120 ID_EDIT_CLEAR_ALL = 0xE121 ID_EDIT_COPY = 0xE122 ID_EDIT_CUT = 0xE123 ID_EDIT_FIND = 0xE124 ID_EDIT_PASTE = 0xE125 ID_EDIT_PASTE_LINK = 0xE126 ID_EDIT_PASTE_SPECIAL = 0xE127 ID_EDIT_REPEAT = 0xE128 ID_EDIT_REPLACE = 0xE129 ID_EDIT_SELECT_ALL = 0xE12A ID_EDIT_UNDO = 0xE12B ID_EDIT_REDO = 0xE12C ID_WINDOW_NEW = 0xE130 ID_WINDOW_ARRANGE = 0xE131 ID_WINDOW_CASCADE = 0xE132 ID_WINDOW_TILE_HORZ = 0xE133 ID_WINDOW_TILE_VERT = 0xE134 ID_WINDOW_SPLIT = 0xE135 AFX_IDM_WINDOW_FIRST = 0xE130 AFX_IDM_WINDOW_LAST = 0xE13F AFX_IDM_FIRST_MDICHILD = 0xFF00 ID_APP_ABOUT = 0xE140 ID_APP_EXIT = 0xE141 ID_HELP_INDEX = 0xE142 ID_HELP_FINDER = 0xE143 ID_HELP_USING = 0xE144 ID_CONTEXT_HELP = 0xE145 ID_HELP = 0xE146 ID_DEFAULT_HELP = 0xE147 ID_NEXT_PANE = 0xE150 ID_PREV_PANE = 0xE151 ID_FORMAT_FONT = 0xE160 ID_OLE_INSERT_NEW = 0xE200 ID_OLE_EDIT_LINKS = 0xE201 ID_OLE_EDIT_CONVERT = 0xE202 ID_OLE_EDIT_CHANGE_ICON = 0xE203 ID_OLE_EDIT_PROPERTIES = 0xE204 ID_OLE_VERB_FIRST = 0xE210 ID_OLE_VERB_LAST = 0xE21F AFX_ID_PREVIEW_CLOSE = 0xE300 AFX_ID_PREVIEW_NUMPAGE = 0xE301 AFX_ID_PREVIEW_NEXT = 0xE302 AFX_ID_PREVIEW_PREV = 0xE303 AFX_ID_PREVIEW_PRINT = 0xE304 AFX_ID_PREVIEW_ZOOMIN = 0xE305 AFX_ID_PREVIEW_ZOOMOUT = 0xE306 ID_VIEW_TOOLBAR = 0xE800 ID_VIEW_STATUS_BAR = 0xE801 ID_RECORD_FIRST = 0xE900 ID_RECORD_LAST = 0xE901 ID_RECORD_NEXT = 0xE902 ID_RECORD_PREV = 0xE903 IDC_STATIC = (-1) AFX_IDS_SCFIRST = 0xEF00 AFX_IDS_SCSIZE = 0xEF00 AFX_IDS_SCMOVE = 0xEF01 AFX_IDS_SCMINIMIZE = 0xEF02 AFX_IDS_SCMAXIMIZE = 0xEF03 AFX_IDS_SCNEXTWINDOW = 0xEF04 AFX_IDS_SCPREVWINDOW = 0xEF05 AFX_IDS_SCCLOSE = 0xEF06 AFX_IDS_SCRESTORE = 0xEF12 AFX_IDS_SCTASKLIST = 0xEF13 AFX_IDS_MDICHILD = 0xEF1F AFX_IDS_DESKACCESSORY = 0xEFDA AFX_IDS_OPENFILE = 0xF000 AFX_IDS_SAVEFILE = 0xF001 AFX_IDS_ALLFILTER = 0xF002 AFX_IDS_UNTITLED = 0xF003 AFX_IDS_SAVEFILECOPY = 0xF004 AFX_IDS_PREVIEW_CLOSE = 0xF005 AFX_IDS_UNNAMED_FILE = 0xF006 AFX_IDS_ABOUT = 0xF010 AFX_IDS_HIDE = 0xF011 AFX_IDP_NO_ERROR_AVAILABLE = 0xF020 AFX_IDS_NOT_SUPPORTED_EXCEPTION = 0xF021 AFX_IDS_RESOURCE_EXCEPTION = 0xF022 AFX_IDS_MEMORY_EXCEPTION = 0xF023 AFX_IDS_USER_EXCEPTION = 0xF024 AFX_IDS_PRINTONPORT = 0xF040 AFX_IDS_ONEPAGE = 0xF041 AFX_IDS_TWOPAGE = 0xF042 AFX_IDS_PRINTPAGENUM = 0xF043 AFX_IDS_PREVIEWPAGEDESC = 0xF044 AFX_IDS_PRINTDEFAULTEXT = 0xF045 AFX_IDS_PRINTDEFAULT = 0xF046 AFX_IDS_PRINTFILTER = 0xF047 AFX_IDS_PRINTCAPTION = 0xF048 AFX_IDS_PRINTTOFILE = 0xF049 AFX_IDS_OBJECT_MENUITEM = 0xF080 AFX_IDS_EDIT_VERB = 0xF081 AFX_IDS_ACTIVATE_VERB = 0xF082 AFX_IDS_CHANGE_LINK = 0xF083 AFX_IDS_AUTO = 0xF084 AFX_IDS_MANUAL = 0xF085 AFX_IDS_FROZEN = 0xF086 AFX_IDS_ALL_FILES = 0xF087 AFX_IDS_SAVE_MENU = 0xF088 AFX_IDS_UPDATE_MENU = 0xF089 AFX_IDS_SAVE_AS_MENU = 0xF08A AFX_IDS_SAVE_COPY_AS_MENU = 0xF08B AFX_IDS_EXIT_MENU = 0xF08C AFX_IDS_UPDATING_ITEMS = 0xF08D AFX_IDS_METAFILE_FORMAT = 0xF08E AFX_IDS_DIB_FORMAT = 0xF08F AFX_IDS_BITMAP_FORMAT = 0xF090 AFX_IDS_LINKSOURCE_FORMAT = 0xF091 AFX_IDS_EMBED_FORMAT = 0xF092 AFX_IDS_PASTELINKEDTYPE = 0xF094 AFX_IDS_UNKNOWNTYPE = 0xF095 AFX_IDS_RTF_FORMAT = 0xF096 AFX_IDS_TEXT_FORMAT = 0xF097 AFX_IDS_INVALID_CURRENCY = 0xF098 AFX_IDS_INVALID_DATETIME = 0xF099 AFX_IDS_INVALID_DATETIMESPAN = 0xF09A AFX_IDP_INVALID_FILENAME = 0xF100 AFX_IDP_FAILED_TO_OPEN_DOC = 0xF101 AFX_IDP_FAILED_TO_SAVE_DOC = 0xF102 AFX_IDP_ASK_TO_SAVE = 0xF103 AFX_IDP_FAILED_TO_CREATE_DOC = 0xF104 AFX_IDP_FILE_TOO_LARGE = 0xF105 AFX_IDP_FAILED_TO_START_PRINT = 0xF106 AFX_IDP_FAILED_TO_LAUNCH_HELP = 0xF107 AFX_IDP_INTERNAL_FAILURE = 0xF108 AFX_IDP_COMMAND_FAILURE = 0xF109 AFX_IDP_FAILED_MEMORY_ALLOC = 0xF10A AFX_IDP_PARSE_INT = 0xF110 AFX_IDP_PARSE_REAL = 0xF111 AFX_IDP_PARSE_INT_RANGE = 0xF112 AFX_IDP_PARSE_REAL_RANGE = 0xF113 AFX_IDP_PARSE_STRING_SIZE = 0xF114 AFX_IDP_PARSE_RADIO_BUTTON = 0xF115 AFX_IDP_PARSE_BYTE = 0xF116 AFX_IDP_PARSE_UINT = 0xF117 AFX_IDP_PARSE_DATETIME = 0xF118 AFX_IDP_PARSE_CURRENCY = 0xF119 AFX_IDP_FAILED_INVALID_FORMAT = 0xF120 AFX_IDP_FAILED_INVALID_PATH = 0xF121 AFX_IDP_FAILED_DISK_FULL = 0xF122 AFX_IDP_FAILED_ACCESS_READ = 0xF123 AFX_IDP_FAILED_ACCESS_WRITE = 0xF124 AFX_IDP_FAILED_IO_ERROR_READ = 0xF125 AFX_IDP_FAILED_IO_ERROR_WRITE = 0xF126 AFX_IDP_STATIC_OBJECT = 0xF180 AFX_IDP_FAILED_TO_CONNECT = 0xF181 AFX_IDP_SERVER_BUSY = 0xF182 AFX_IDP_BAD_VERB = 0xF183 AFX_IDP_FAILED_TO_NOTIFY = 0xF185 AFX_IDP_FAILED_TO_LAUNCH = 0xF186 AFX_IDP_ASK_TO_UPDATE = 0xF187 AFX_IDP_FAILED_TO_UPDATE = 0xF188 AFX_IDP_FAILED_TO_REGISTER = 0xF189 AFX_IDP_FAILED_TO_AUTO_REGISTER = 0xF18A AFX_IDP_FAILED_TO_CONVERT = 0xF18B AFX_IDP_GET_NOT_SUPPORTED = 0xF18C AFX_IDP_SET_NOT_SUPPORTED = 0xF18D AFX_IDP_ASK_TO_DISCARD = 0xF18E AFX_IDP_FAILED_TO_CREATE = 0xF18F AFX_IDP_FAILED_MAPI_LOAD = 0xF190 AFX_IDP_INVALID_MAPI_DLL = 0xF191 AFX_IDP_FAILED_MAPI_SEND = 0xF192 AFX_IDP_FILE_NONE = 0xF1A0 AFX_IDP_FILE_GENERIC = 0xF1A1 AFX_IDP_FILE_NOT_FOUND = 0xF1A2 AFX_IDP_FILE_BAD_PATH = 0xF1A3 AFX_IDP_FILE_TOO_MANY_OPEN = 0xF1A4 AFX_IDP_FILE_ACCESS_DENIED = 0xF1A5 AFX_IDP_FILE_INVALID_FILE = 0xF1A6 AFX_IDP_FILE_REMOVE_CURRENT = 0xF1A7 AFX_IDP_FILE_DIR_FULL = 0xF1A8 AFX_IDP_FILE_BAD_SEEK = 0xF1A9 AFX_IDP_FILE_HARD_IO = 0xF1AA AFX_IDP_FILE_SHARING = 0xF1AB AFX_IDP_FILE_LOCKING = 0xF1AC AFX_IDP_FILE_DISKFULL = 0xF1AD AFX_IDP_FILE_EOF = 0xF1AE AFX_IDP_ARCH_NONE = 0xF1B0 AFX_IDP_ARCH_GENERIC = 0xF1B1 AFX_IDP_ARCH_READONLY = 0xF1B2 AFX_IDP_ARCH_ENDOFFILE = 0xF1B3 AFX_IDP_ARCH_WRITEONLY = 0xF1B4 AFX_IDP_ARCH_BADINDEX = 0xF1B5 AFX_IDP_ARCH_BADCLASS = 0xF1B6 AFX_IDP_ARCH_BADSCHEMA = 0xF1B7 AFX_IDS_OCC_SCALEUNITS_PIXELS = 0xF1C0 AFX_IDS_STATUS_FONT = 0xF230 AFX_IDS_TOOLTIP_FONT = 0xF231 AFX_IDS_UNICODE_FONT = 0xF232 AFX_IDS_MINI_FONT = 0xF233 AFX_IDP_SQL_FIRST = 0xF280 AFX_IDP_SQL_CONNECT_FAIL = 0xF281 AFX_IDP_SQL_RECORDSET_FORWARD_ONLY = 0xF282 AFX_IDP_SQL_EMPTY_COLUMN_LIST = 0xF283 AFX_IDP_SQL_FIELD_SCHEMA_MISMATCH = 0xF284 AFX_IDP_SQL_ILLEGAL_MODE = 0xF285 AFX_IDP_SQL_MULTIPLE_ROWS_AFFECTED = 0xF286 AFX_IDP_SQL_NO_CURRENT_RECORD = 0xF287 AFX_IDP_SQL_NO_ROWS_AFFECTED = 0xF288 AFX_IDP_SQL_RECORDSET_READONLY = 0xF289 AFX_IDP_SQL_SQL_NO_TOTAL = 0xF28A AFX_IDP_SQL_ODBC_LOAD_FAILED = 0xF28B AFX_IDP_SQL_DYNASET_NOT_SUPPORTED = 0xF28C AFX_IDP_SQL_SNAPSHOT_NOT_SUPPORTED = 0xF28D AFX_IDP_SQL_API_CONFORMANCE = 0xF28E AFX_IDP_SQL_SQL_CONFORMANCE = 0xF28F AFX_IDP_SQL_NO_DATA_FOUND = 0xF290 AFX_IDP_SQL_ROW_UPDATE_NOT_SUPPORTED = 0xF291 AFX_IDP_SQL_ODBC_V2_REQUIRED = 0xF292 AFX_IDP_SQL_NO_POSITIONED_UPDATES = 0xF293 AFX_IDP_SQL_LOCK_MODE_NOT_SUPPORTED = 0xF294 AFX_IDP_SQL_DATA_TRUNCATED = 0xF295 AFX_IDP_SQL_ROW_FETCH = 0xF296 AFX_IDP_SQL_INCORRECT_ODBC = 0xF297 AFX_IDP_SQL_UPDATE_DELETE_FAILED = 0xF298 AFX_IDP_SQL_DYNAMIC_CURSOR_NOT_SUPPORTED = 0xF299 AFX_IDP_DAO_FIRST = 0xF2A0 AFX_IDP_DAO_ENGINE_INITIALIZATION = 0xF2A0 AFX_IDP_DAO_DFX_BIND = 0xF2A1 AFX_IDP_DAO_OBJECT_NOT_OPEN = 0xF2A2 AFX_IDP_DAO_ROWTOOSHORT = 0xF2A3 AFX_IDP_DAO_BADBINDINFO = 0xF2A4 AFX_IDP_DAO_COLUMNUNAVAILABLE = 0xF2A5 AFX_IDC_LISTBOX = 100 AFX_IDC_CHANGE = 101 AFX_IDC_PRINT_DOCNAME = 201 AFX_IDC_PRINT_PRINTERNAME = 202 AFX_IDC_PRINT_PORTNAME = 203 AFX_IDC_PRINT_PAGENUM = 204 ID_APPLY_NOW = 0x3021 ID_WIZBACK = 0x3023 ID_WIZNEXT = 0x3024 ID_WIZFINISH = 0x3025 AFX_IDC_TAB_CONTROL = 0x3020 AFX_IDD_FILEOPEN = 28676 AFX_IDD_FILESAVE = 28677 AFX_IDD_FONT = 28678 AFX_IDD_COLOR = 28679 AFX_IDD_PRINT = 28680 AFX_IDD_PRINTSETUP = 28681 AFX_IDD_FIND = 28682 AFX_IDD_REPLACE = 28683 AFX_IDD_NEWTYPEDLG = 30721 AFX_IDD_PRINTDLG = 30722 AFX_IDD_PREVIEW_TOOLBAR = 30723 AFX_IDD_PREVIEW_SHORTTOOLBAR = 30731 AFX_IDD_INSERTOBJECT = 30724 AFX_IDD_CHANGEICON = 30725 AFX_IDD_CONVERT = 30726 AFX_IDD_PASTESPECIAL = 30727 AFX_IDD_EDITLINKS = 30728 AFX_IDD_FILEBROWSE = 30729 AFX_IDD_BUSY = 30730 AFX_IDD_OBJECTPROPERTIES = 30732 AFX_IDD_CHANGESOURCE = 30733 AFX_IDC_CONTEXTHELP = 30977 AFX_IDC_MAGNIFY = 30978 AFX_IDC_SMALLARROWS = 30979 AFX_IDC_HSPLITBAR = 30980 AFX_IDC_VSPLITBAR = 30981 AFX_IDC_NODROPCRSR = 30982 AFX_IDC_TRACKNWSE = 30983 AFX_IDC_TRACKNESW = 30984 AFX_IDC_TRACKNS = 30985 AFX_IDC_TRACKWE = 30986 AFX_IDC_TRACK4WAY = 30987 AFX_IDC_MOVE4WAY = 30988 AFX_IDB_MINIFRAME_MENU = 30994 AFX_IDB_CHECKLISTBOX_NT = 30995 AFX_IDB_CHECKLISTBOX_95 = 30996 AFX_IDR_PREVIEW_ACCEL = 30997 AFX_IDI_STD_MDIFRAME = 31233 AFX_IDI_STD_FRAME = 31234 AFX_IDC_FONTPROP = 1000 AFX_IDC_FONTNAMES = 1001 AFX_IDC_FONTSTYLES = 1002 AFX_IDC_FONTSIZES = 1003 AFX_IDC_STRIKEOUT = 1004 AFX_IDC_UNDERLINE = 1005 AFX_IDC_SAMPLEBOX = 1006 AFX_IDC_COLOR_BLACK = 1100 AFX_IDC_COLOR_WHITE = 1101 AFX_IDC_COLOR_RED = 1102 AFX_IDC_COLOR_GREEN = 1103 AFX_IDC_COLOR_BLUE = 1104 AFX_IDC_COLOR_YELLOW = 1105 AFX_IDC_COLOR_MAGENTA = 1106 AFX_IDC_COLOR_CYAN = 1107 AFX_IDC_COLOR_GRAY = 1108 AFX_IDC_COLOR_LIGHTGRAY = 1109 AFX_IDC_COLOR_DARKRED = 1110 AFX_IDC_COLOR_DARKGREEN = 1111 AFX_IDC_COLOR_DARKBLUE = 1112 AFX_IDC_COLOR_LIGHTBROWN = 1113 AFX_IDC_COLOR_DARKMAGENTA = 1114 AFX_IDC_COLOR_DARKCYAN = 1115 AFX_IDC_COLORPROP = 1116 AFX_IDC_SYSTEMCOLORS = 1117 AFX_IDC_PROPNAME = 1201 AFX_IDC_PICTURE = 1202 AFX_IDC_BROWSE = 1203 AFX_IDC_CLEAR = 1204 AFX_IDD_PROPPAGE_COLOR = 32257 AFX_IDD_PROPPAGE_FONT = 32258 AFX_IDD_PROPPAGE_PICTURE = 32259 AFX_IDB_TRUETYPE = 32384 AFX_IDS_PROPPAGE_UNKNOWN = 0xFE01 AFX_IDS_COLOR_DESKTOP = 0xFE04 AFX_IDS_COLOR_APPWORKSPACE = 0xFE05 AFX_IDS_COLOR_WNDBACKGND = 0xFE06 AFX_IDS_COLOR_WNDTEXT = 0xFE07 AFX_IDS_COLOR_MENUBAR = 0xFE08 AFX_IDS_COLOR_MENUTEXT = 0xFE09 AFX_IDS_COLOR_ACTIVEBAR = 0xFE0A AFX_IDS_COLOR_INACTIVEBAR = 0xFE0B AFX_IDS_COLOR_ACTIVETEXT = 0xFE0C AFX_IDS_COLOR_INACTIVETEXT = 0xFE0D AFX_IDS_COLOR_ACTIVEBORDER = 0xFE0E AFX_IDS_COLOR_INACTIVEBORDER = 0xFE0F AFX_IDS_COLOR_WNDFRAME = 0xFE10 AFX_IDS_COLOR_SCROLLBARS = 0xFE11 AFX_IDS_COLOR_BTNFACE = 0xFE12 AFX_IDS_COLOR_BTNSHADOW = 0xFE13 AFX_IDS_COLOR_BTNTEXT = 0xFE14 AFX_IDS_COLOR_BTNHIGHLIGHT = 0xFE15 AFX_IDS_COLOR_DISABLEDTEXT = 0xFE16 AFX_IDS_COLOR_HIGHLIGHT = 0xFE17 AFX_IDS_COLOR_HIGHLIGHTTEXT = 0xFE18 AFX_IDS_REGULAR = 0xFE19 AFX_IDS_BOLD = 0xFE1A AFX_IDS_ITALIC = 0xFE1B AFX_IDS_BOLDITALIC = 0xFE1C AFX_IDS_SAMPLETEXT = 0xFE1D AFX_IDS_DISPLAYSTRING_FONT = 0xFE1E AFX_IDS_DISPLAYSTRING_COLOR = 0xFE1F AFX_IDS_DISPLAYSTRING_PICTURE = 0xFE20 AFX_IDS_PICTUREFILTER = 0xFE21 AFX_IDS_PICTYPE_UNKNOWN = 0xFE22 AFX_IDS_PICTYPE_NONE = 0xFE23 AFX_IDS_PICTYPE_BITMAP = 0xFE24 AFX_IDS_PICTYPE_METAFILE = 0xFE25 AFX_IDS_PICTYPE_ICON = 0xFE26 AFX_IDS_COLOR_PPG = 0xFE28 AFX_IDS_COLOR_PPG_CAPTION = 0xFE29 AFX_IDS_FONT_PPG = 0xFE2A AFX_IDS_FONT_PPG_CAPTION = 0xFE2B AFX_IDS_PICTURE_PPG = 0xFE2C AFX_IDS_PICTURE_PPG_CAPTION = 0xFE2D AFX_IDS_PICTUREBROWSETITLE = 0xFE30 AFX_IDS_BORDERSTYLE_0 = 0xFE31 AFX_IDS_BORDERSTYLE_1 = 0xFE32 AFX_IDS_VERB_EDIT = 0xFE40 AFX_IDS_VERB_PROPERTIES = 0xFE41 AFX_IDP_PICTURECANTOPEN = 0xFE83 AFX_IDP_PICTURECANTLOAD = 0xFE84 AFX_IDP_PICTURETOOLARGE = 0xFE85 AFX_IDP_PICTUREREADFAILED = 0xFE86 AFX_IDP_E_ILLEGALFUNCTIONCALL = 0xFEA0 AFX_IDP_E_OVERFLOW = 0xFEA1 AFX_IDP_E_OUTOFMEMORY = 0xFEA2 AFX_IDP_E_DIVISIONBYZERO = 0xFEA3 AFX_IDP_E_OUTOFSTRINGSPACE = 0xFEA4 AFX_IDP_E_OUTOFSTACKSPACE = 0xFEA5 AFX_IDP_E_BADFILENAMEORNUMBER = 0xFEA6 AFX_IDP_E_FILENOTFOUND = 0xFEA7 AFX_IDP_E_BADFILEMODE = 0xFEA8 AFX_IDP_E_FILEALREADYOPEN = 0xFEA9 AFX_IDP_E_DEVICEIOERROR = 0xFEAA AFX_IDP_E_FILEALREADYEXISTS = 0xFEAB AFX_IDP_E_BADRECORDLENGTH = 0xFEAC AFX_IDP_E_DISKFULL = 0xFEAD AFX_IDP_E_BADRECORDNUMBER = 0xFEAE AFX_IDP_E_BADFILENAME = 0xFEAF AFX_IDP_E_TOOMANYFILES = 0xFEB0 AFX_IDP_E_DEVICEUNAVAILABLE = 0xFEB1 AFX_IDP_E_PERMISSIONDENIED = 0xFEB2 AFX_IDP_E_DISKNOTREADY = 0xFEB3 AFX_IDP_E_PATHFILEACCESSERROR = 0xFEB4 AFX_IDP_E_PATHNOTFOUND = 0xFEB5 AFX_IDP_E_INVALIDPATTERNSTRING = 0xFEB6 AFX_IDP_E_INVALIDUSEOFNULL = 0xFEB7 AFX_IDP_E_INVALIDFILEFORMAT = 0xFEB8 AFX_IDP_E_INVALIDPROPERTYVALUE = 0xFEB9 AFX_IDP_E_INVALIDPROPERTYARRAYINDEX = 0xFEBA AFX_IDP_E_SETNOTSUPPORTEDATRUNTIME = 0xFEBB AFX_IDP_E_SETNOTSUPPORTED = 0xFEBC AFX_IDP_E_NEEDPROPERTYARRAYINDEX = 0xFEBD AFX_IDP_E_SETNOTPERMITTED = 0xFEBE AFX_IDP_E_GETNOTSUPPORTEDATRUNTIME = 0xFEBF AFX_IDP_E_GETNOTSUPPORTED = 0xFEC0 AFX_IDP_E_PROPERTYNOTFOUND = 0xFEC1 AFX_IDP_E_INVALIDCLIPBOARDFORMAT = 0xFEC2 AFX_IDP_E_INVALIDPICTURE = 0xFEC3 AFX_IDP_E_PRINTERERROR = 0xFEC4 AFX_IDP_E_CANTSAVEFILETOTEMP = 0xFEC5 AFX_IDP_E_SEARCHTEXTNOTFOUND = 0xFEC6 AFX_IDP_E_REPLACEMENTSTOOLONG = 0xFEC7
"""Remove Dups: Write code to remove duplicates from an unsorted linked list.""" def remove_dups(linked_list): """Remove duplicates from a linked list.""" prev_node = None curr_node = linked_list.head vals_seen = set() while curr_node: if curr_node.val in vals_seen: prev_node.next = curr_node.next curr_node = curr_node.next else: vals_seen.add(curr_node.val) prev_node = curr_node curr_node = curr_node.next
x = 1 if x == 1: # indented four spaces print("Hello World")