content
stringlengths
7
1.05M
def access_required(): pass
#!/usr/bin/python # -*- coding: utf-8 -*- """ Author : Fatih Kahraman Mail : fatih.khrmn@hotmail.com """ class Book: def __init__(self, page_count, author, book_type): self.page_count = page_count self.author = author self.book_type = book_type self.book_shape = "Dikdörtgen" def print_book_info(self): print("Sayfa sayısı: ",self.page_count) print("Yazar: ", self.author) print("Kitap tipi: ", self.book_type) print("Kitap şekli: ", self.book_shape) def __str__(self): return "Kitabın adı: {}".format(self.book_name) def __call__(self, *args, **kwargs): self.book_name = args[0] if __name__ == '__main__': book = Book(200, "Selim Tuna", "Roman") book.print_book_info() book("Python Günlükleri") print(book)
class cacheFilesManagerInterface: def __init__(self, cacheRootPath, resourcesRootPath): super().__init__() def createCacheFiles (self, fileInfo): raise NotImplementedError() def deleteCacheFiles (self, fileInfo): raise NotImplementedError() def getCacheFile (self, fileUID, chunkNumber): raise NotImplementedError() def restoreFileFromCache (self, fileInfo): raise NotImplementedError() def copyFileIntoChunks (self, cachedFileInfo): raise NotImplementedError() def writeChunkContent (self, content, fileName): raise NotImplementedError()
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # # $Id$ # class SystemManagementInterface(object): """ Interface description for hardware management controllers - IPMI - IOL """ def __init__(self, config): self.config = config def getPowerStatus(self): raise NotImplementedError def isPowered(self): ''' Return boolean if system is powered on or not ''' raise NotImplementedError def powerOn(self): ''' Powers on a system ''' raise NotImplementedError def powerOff(self): ''' Powers off a system ''' raise NotImplementedError def powerOffSoft(self): ''' Powers off a system via acpi''' raise NotImplementedError def powerCycle(self): ''' Powers cycles a system ''' raise NotImplementedError def powerReset(self): ''' Resets a system ''' raise NotImplementedError def activateConsole(self): ''' Activate Console''' raise NotImplementedError def registerToZoni(self): ''' register hardware to zoni''' raise NotImplementedError # Extensions from MIMOS - specific to HP Blade via c7000 Blade Enclosure def powerOnNet(self): ''' Power HP Blade Server directly from PXE ''' raise NotImplementedError
print('\033[33m-=-\033[m' * 20) print('\033[33m************* Fatorial *************\033[m') print('\033[33m-=-\033[m' * 20) v = float(input('Insira um valor: ')) c = 1 f = 1 while c <= v: f = f * c c += 1 print('O fatorial de {} é {}' .format(v, f))
print('-='*20) print('\033[1;35mAnalisador de Triângulos 2.0\033[m') print('-='*20) lado1 = float(input('Insira o tamanho do 1º lado: ')) lado2 = float(input('Insira o tamanho do 2º lado: ')) lado3 = float(input('Insira o tamanho do 3º lado: ')) if ((lado1 + lado2) > lado3) and ((lado1 + lado3) > lado2) and ((lado3 + lado2) > lado1): print('Os segmentos acima podem formar um triângulo.') if lado1 == lado2 and lado1 == lado3: print('E o tipo do triângulo é: \033[1;33mEQUILÁTERO\033[m') elif (lado1 == lado2 and lado1 != lado3) or (lado1 == lado3 and lado1 != lado2) or (lado3 == lado2 and lado3 != lado1): print('E o tipo do triângulo é: \033[1;33mISÓSCELES\033[m') else: print('E o tipo do triângulo é: \033[1;33mESCALENO\033[m') else: print('\033[1;31mOs segmentos acima não podem formar um triângulo.')
#!/usr/bin/python # -*- encoding: utf-8; py-indent-offset: 4 -*- # +------------------------------------------------------------------+ # | ____ _ _ __ __ _ __ | # | / ___| |__ ___ ___| | __ | \/ | |/ / | # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | # | | |___| | | | __/ (__| < | | | | . \ | # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | # | | # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de | # +------------------------------------------------------------------+ # # This file is part of Check_MK. # The official homepage is at http://mathias-kettner.de/check_mk. # # check_mk 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 in version 2. check_mk is distributed # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. See the GNU General Public License for more de- # tails. You should have received a copy of the GNU General Public # License along with GNU Make; see the file COPYING. If not, write # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301 USA. # This file contains the defaults settings for almost all configuration # variables that can be overridden in main.mk. Some configuration # variables are preset in checks/* as well. monitoring_core = "nagios" # other option: "cmc" agent_port = 6556 agent_ports = [] snmp_ports = [] # UDP ports used for SNMP tcp_connect_timeout = 5.0 use_dns_cache = True # prevent DNS by using own cache file delay_precompile = False # delay Python compilation to Nagios execution restart_locking = "abort" # also possible: "wait", None check_submission = "file" # alternative: "pipe" aggr_summary_hostname = "%s-s" agent_min_version = 0 # warn, if plugin has not at least version check_max_cachefile_age = 0 # per default do not use cache files when checking cluster_max_cachefile_age = 90 # secs. piggyback_max_cachefile_age = 3600 # secs piggyback_translation = [] # Ruleset for translating piggyback host names simulation_mode = False agent_simulator = False perfdata_format = "pnp" # also possible: "standard" check_mk_perfdata_with_times = True debug_log = False # deprecated monitoring_host = None # deprecated max_num_processes = 50 fallback_agent_output_encoding = 'latin1' # SNMP communities and encoding has_inline_snmp = False # is set to True by inline_snmp module, when available use_inline_snmp = True non_inline_snmp_hosts = [] # Ruleset to disable Inline-SNMP per host when # use_inline_snmp is enabled. snmp_limit_oid_range = [] # Ruleset to recduce fetched OIDs of a check, only inline SNMP record_inline_snmp_stats = False snmp_default_community = 'public' snmp_communities = [] snmp_timing = [] snmp_character_encodings = [] explicit_snmp_communities = {} # override the rule based configuration # RRD creation (only with CMC) cmc_log_rrdcreation = None # also: "terse", "full" cmc_host_rrd_config = [] # Rule for per-host configuration of RRDs cmc_service_rrd_config = [] # Rule for per-service configuration of RRDs # Inventory and inventory checks inventory_check_interval = None # Nagios intervals (4h = 240) inventory_check_severity = 1 # warning inventory_check_do_scan = True # include SNMP scan for SNMP devices inventory_max_cachefile_age = 120 # seconds inventory_check_autotrigger = True # Automatically trigger inv-check after automation-inventory always_cleanup_autochecks = None # For compatiblity with old configuration periodic_discovery = [] # Nagios templates and other settings concerning generation # of Nagios configuration files. No need to change these values. # Better adopt the content of the templates host_template = 'check_mk_host' cluster_template = 'check_mk_cluster' pingonly_template = 'check_mk_pingonly' active_service_template = 'check_mk_active' inventory_check_template = 'check_mk_inventory' passive_service_template = 'check_mk_passive' passive_service_template_perf = 'check_mk_passive_perf' summary_service_template = 'check_mk_summarized' service_dependency_template = 'check_mk' default_host_group = 'check_mk' generate_hostconf = True generate_dummy_commands = True dummy_check_commandline = 'echo "ERROR - you did an active check on this service - please disable active checks" && exit 1' nagios_illegal_chars = '`;~!$%^&*|\'"<>?,()=' # Data to be defined in main.mk checks = [] static_checks = {} check_parameters = [] checkgroup_parameters = {} inv_parameters = {} # for HW/SW-Inventory legacy_checks = [] # non-WATO variant of legacy checks active_checks = {} # WATO variant for fully formalized checks special_agents = {} # WATO variant for datasource_programs custom_checks = [] # WATO variant for free-form custom checks without formalization all_hosts = [] host_paths = {} snmp_hosts = [ (['snmp'], ALL_HOSTS) ] tcp_hosts = [ (['tcp'], ALL_HOSTS), (NEGATE, ['snmp'], ALL_HOSTS), (['!ping'], ALL_HOSTS) ] bulkwalk_hosts = [] snmpv2c_hosts = [] snmp_without_sys_descr = [] snmpv3_contexts = [] usewalk_hosts = [] dyndns_hosts = [] # use host name as ip address for these hosts primary_address_family = [] ignored_checktypes = [] # exclude from inventory ignored_services = [] # exclude from inventory ignored_checks = [] # exclude from inventory host_groups = [] service_groups = [] service_contactgroups = [] service_notification_periods = [] # deprecated, will be removed soon. host_notification_periods = [] # deprecated, will be removed soon. host_contactgroups = [] parents = [] define_hostgroups = None define_servicegroups = None define_contactgroups = None contactgroup_members = {} contacts = {} timeperiods = {} # needed for WATO clusters = {} clustered_services = [] clustered_services_of = {} # new in 1.1.4 clustered_services_mapping = [] # new for 1.2.5i1 Wato Rule datasource_programs = [] service_aggregations = [] service_dependencies = [] non_aggregated_hosts = [] aggregate_check_mk = False aggregation_output_format = "multiline" # new in 1.1.6. Possible also: "multiline" summary_host_groups = [] summary_service_groups = [] # service groups for aggregated services summary_service_contactgroups = [] # service contact groups for aggregated services summary_host_notification_periods = [] summary_service_notification_periods = [] ipaddresses = {} # mapping from hostname to IPv4 address ipv6addresses = {} # mapping from hostname to IPv6 address only_hosts = None distributed_wato_site = None # used by distributed WATO extra_host_conf = {} extra_summary_host_conf = {} extra_service_conf = {} extra_summary_service_conf = {} extra_nagios_conf = "" service_descriptions = {} donation_hosts = [] donation_command = 'mail -r checkmk@yoursite.de -s "Host donation %s" donatehosts@mathias-kettner.de' % check_mk_version scanparent_hosts = [ ( ALL_HOSTS ) ] host_attributes = {} # needed by WATO, ignored by Check_MK ping_levels = [] # special parameters for host/PING check_command host_check_commands = [] # alternative host check instead of check_icmp check_mk_exit_status = [] # Rule for specifying CMK's exit status in case of various errors check_mk_agent_target_versions = [] # Rule for defining expected version for agents check_periods = [] snmp_check_interval = [] inv_exports = {} # Rulesets for inventory export hooks notification_parameters = {} # Rulesets for parameters of notification scripts use_new_descriptions_for = [] host_icons_and_actions = [] # Custom user icons / actions to be configured service_icons_and_actions = [] # Custom user icons / actions to be configured # Rulesets for agent bakery agent_config = {} bake_agents_on_restart = False
#Command line program that performs various conversions def errorMsg(ErrorCode): #Assigning menu methods as values to dictionary keys codes = { 1: MainMenu, 2: CurrencyConverter, 3: TemperatureConverter, 4: MassConverter, 5: LengthConverter } #Extracting the method from dictionary using key, NOTE get() is dictionary function func = codes.get(ErrorCode) #Error message which will be displayed if the input is bad print("\nUnrecognized action! Try again.\n") return func() def ExitProgram(): print("\nExiting Program.") #CURRENCY def convertEuroDin(euros): try: course = 119.643 #Current euro course convert = float(euros) * course print("Euro to din conversion:",round(convert,3)) CurrencyConverter() except ValueError: errorMsg(2) def convertDinEuro(din): try: course = 119.643 convert = float(din) / course print("Dinar to euro conversion:",round(convert,3)) CurrencyConverter() except ValueError: errorMsg(2) #TEMPERATURE def convertC(f): try: celsius = (float(f)-32)*5/9 print(f,"Fahrenheits in Celsius is:",round(celsius,2)) TemperatureConverter() except ValueError: errorMsg(3) def convertF(c): try: fahrenheit = float(c) * 9/5 + 32 print(c,"Celsiuses in Fahrenheits is:",round(fahrenheit,2)) TemperatureConverter() except ValueError: errorMsg(3) #MASS def convertKg(lb): try: kg = float(lb) * 0.45359237 print(lb,"Pound is equal to",round(kg,2),"Kilograms.") MassConverter() except ValueError: errorMsg(4) def convertLb(kg): try: lb = float(kg) / 0.45359237 print(kg,"Kilogram is equal to",round(lb,2),"Pound.") MassConverter() except ValueError: errorMsg(4) #LENGTH def convertM(ft): #Convert ft to m try: meter=float(ft) * 0.3048 print(ft,"Feet is equal to",round(meter,2),"Meter.") LengthConverter() except ValueError: errorMsg(5) def convertFt(m): try: feet=float(m) / 0.3048 print(m,"Meter is equal to",round(feet,2),"Feet.") LengthConverter() except ValueError: errorMsg(5) def convertCm(inch): try: cm = float(inch) * 2.54 print(inch,"Inch is equal to",round(cm,2),"Centimeter.") LengthConverter() except ValueError: errorMsg(5) def convertInch(cm): try: inch=float(cm) / 2.54 print(cm,"Centimeter is equal to",round(inch,2),"Inch.") LengthConverter() except ValueError: errorMsg(5) def convertMi(km): try: miles = float(km) / 1.609344 print(km,"Kilometer in miles is:",int(miles)) LengthConverter() except ValueError: errorMsg(5) def convertKm(mi): try: kms = float(mi) * 1.609344 print(mi,"Mile in kilometers is:",int(kms)) LengthConverter() except ValueError: errorMsg(5) #Handling inputs as menu options for each section, following functions are menu itself def CurrencyConverter(): option=str.capitalize(input("\n1 - Convert Euros to Din\n2 - Convert Din to Euro\nM:Main Menu\nChoose option:")) if option == '1': euro=input("\nEnter ammount of euros:") convertEuroDin(euro) elif option == '2': dinar = input("\nEnter ammount of dinars:") convertDinEuro(dinar) elif option == 'M': MainMenu() else: errorMsg(2) def TemperatureConverter(): option = str.capitalize(input("\n1 - Convert Fahrenheits to Celsius\n2 - Convert Celsius to Fahrenheit\nM:Main Menu\nChoose option:")) if option == '1': f = input("\nEnter fahrenheits:") convertC(f) elif option == '2': c = input("\nEnter celsiuses:") convertF(c) elif option == 'M': MainMenu() else: errorMsg(3) def MassConverter(): option = str.capitalize(input("\n1 - Convert kg to lb\n2 - Convert lb to kg\nM:Main Menu\nChoose option:")) if option == '1': kg = input("\nEnter kilograms:") convertLb(kg) elif option == '2': lb = input("\nEnter pounds:") convertKg(lb) elif option == 'M': MainMenu() else: errorMsg(4) def LengthConverter(): option = str.capitalize(input("\n1 - Convert m to ft\n2 - Convert ft to m\n3 - Convert cm to inch\n4 - Convert inch to cm\n5 - Convert km to miles\n6 - Convert miles to km\nM:Main Menu\nChoose option:")) if option == '1': meter = input("\nEnter meters:") convertFt(meter) elif option == '2': feet = input("\nEnter feets:") convertM(feet) elif option == '3': cm = input("\nEnter centimeters:") convertInch(cm) elif option == '4': inch = input("\nEnter inches:") convertCm(inch) elif option == '5': km = input("\nEnter kilometers:") convertMi(km) elif option == '6': mile = input("\nEnter miles:") convertKm(mile) elif option == 'M': MainMenu() else: errorMsg(5) def MainMenu(): option = str.capitalize(input("\nAvailable programs:\n1:Currency Converter\n2:Temperature Converter\n3:Mass Converter\n4:Length Converter\nX:Exit Program\nChoose option:")) if option == '1': CurrencyConverter() elif option =='2': TemperatureConverter() elif option =='3': MassConverter() elif option =='4': LengthConverter() elif option == 'X': ExitProgram() else: errorMsg(1) #Main Program active = True while(active): #Main Menu which displays all available converions by sections MainMenu() active = False
if __name__ == "__main__": Motifs = [ "TCGGGGGTTTTT", "CCGGTGACTTAC", "ACGGGGATTTTC", "TTGGGGACTTTT", "AAGGGGACTTCC", "TTGGGGACTTCC", "TCGGGGATTCAT", "TCGGGGATTCCT", "TAGGGGAACTAC", "TCGGGTATAACC", ]
fibs = {0: 0, 1: 1} def fib(n): if n in fibs: return fibs[n] if n % 2 == 0: fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2) return fibs[n] fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2) return fibs[n] # limit 100000
t = int(input()) while t: X, Y = map(int, input().split()) while X>0 and Y>0 : if X>Y: if X%Y==0: X=Y break X = X%Y else: if Y%X==0: Y=X break Y = Y%X print(X+Y) t = t-1
""" Problem Defination LCS Problem Statement: Given two sequences, find the length of longest subsequence present in both of them. A subsequence is a sequence that appears in the same relative order, but not necessarily contiguous. For example, “abc”, “abg”, “bdf”, “aeg”, ‘”acefg”, .. etc are subsequences of “abcdefg”. In order to find out the complexity of brute force approach, we need to first know the number of possible different subsequences of a string with length n, i.e., find the number of subsequences with lengths ranging from 1,2,..n-1. Recall from theory of permutation and combination that number of combinations with 1 element are nC1. Number of combinations with 2 elements are nC2 and so forth and so on. We know that nC0 + nC1 + nC2 + … nCn = 2n. So a string of length n has 2n-1 different possible subsequences since we do not consider the subsequence with length 0. This implies that the time complexity of the brute force approach will be O(n * 2n). Note that it takes O(n) time to check if a subsequence is common to both the strings. This time complexity can be improved using dynamic programming. Examples: LCS for input Sequences “ABCDGH” and “AEDFHR” is “ADH” of length 3. LCS for input Sequences “AGGTAB” and “GXTXAYB” is “GTAB” of length 4. """ # Dynamic Programming implementation of LCS problem def lcs(X , Y): # find the length of the strings m = len(X) n = len(Y) # declaring the array for storing the dp values L = [[None]*(n+1) for i in range(m+1)] """Following steps build L[m+1][n+1] in bottom up fashion Note: L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1]""" for i in range(m+1): for j in range(n+1): if i == 0 or j == 0 : L[i][j] = 0 elif X[i-1] == Y[j-1]: L[i][j] = L[i-1][j-1]+1 else: L[i][j] = max(L[i-1][j] , L[i][j-1]) # L[m][n] contains the length of LCS of X[0..n-1] & Y[0..m-1] print('for Iternation {i} {j}') print(L) return L[m][n] #end of function lcs # Driver program to test the above function X = "AGGTAB" Y = "GXTXAYB" print ("Length of LCS is ", lcs(X, Y))
a = int(input()) b = int(input()) r = 0 if a < b: for x in range(a + 1, b): if x % 2 != 0: r += x elif a >= b: for x in range(a - 1, b, -1): if x % 2 != 0: r += x print(r)
def regionQuery(self,P,eps): result = [] for d in self.dataSet: if (((d[0]-P[0])**2 + (d[1] - P[1])**2)**0.5)<=eps: result.append(d) return result def expandCluster(self,point,NeighbourPoints,C,eps,MinPts): C.addPoint(point) for p in NeighbourPoints: if p not in self.visited: self.visited.append(p) np = self.regionQuery(p,eps) if len(np) >= MinPts: for n in np: if n not in NeighbourPoints: NeighbourPoints.append(n) for c in self.Clusters: if not c.has(p): if not C.has(p): C.addPoint(p) if len(self.Clusters) == 0: if not C.has(p): C.addPoint(p) self.Clusters.append(C)
def main(): n = int(input()) x = sorted(map(int, input().split())) q = int(input()) m = [int(input()) for _ in range(q)] for coin in m: l, r = -1, n while l + 1 < r: mid = (l + r) // 2 if x[mid] <= coin: l = mid else: r = mid print(l + 1) main()
"""A library for installing Python wheels. """ __version__ = "0.2.0.dev0"
with open("opcodes.txt") as f: code = tuple([int(x) for x in f.read().strip().split(',')]) def op1(code, a, b, c, pos): code[c] = a + b return pos+4 def op2(code, a, b, c, pos): code[c] = a * b return pos+4 def op3(code, a, pos): global sysID code[a] = sysID return pos+2 def op4(code, a, pos): global output output = a return pos+2 def op5(code, a, b, pos): return b if a != 0 else pos+3 def op6(code, a, b, pos): return b if a == 0 else pos+3 def op7(code, a, b, c, pos): code[c] = 1 if a < b else 0 return pos+4 def op8(code, a, b, c, pos): code[c] = 1 if a == b else 0 return pos+4 ops = [op1, op2, op3, op4, op5, op6, op7, op8] def run_code(code): pos = 0 while True: opcode = code[pos] % 100 a_mode = (code[pos] % 1000) // 100 b_mode = (code[pos] % 10000) // 1000 if opcode in [1,2,7,8]: a = code[code[pos+1]] if a_mode == 0 else code[pos+1] b = code[code[pos+2]] if b_mode == 0 else code[pos+2] c = code[pos+3] pos = ops[opcode-1](code, a, b, c, pos) elif opcode in [5, 6]: a = code[code[pos+1]] if a_mode == 0 else code[pos+1] b = code[code[pos+2]] if b_mode == 0 else code[pos+2] pos = ops[opcode-1](code, a, b, pos) elif opcode == 4: a = code[code[pos+1]] if a_mode == 0 else code[pos+1] pos = ops[3](code, a, pos) elif opcode == 3: pos = ops[2](code, code[pos+1], pos) else: if opcode != 99: print ("Unknown opcode:", opcode) break sysID = 1 output = None run_code(list(code)) print("Part 1:", output) sysID = 5 run_code(list(code)) print("Part 2:", output)
# # PySNMP MIB module MSERIES-PORT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MSERIES-PORT-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:15:42 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) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint") mseries, = mibBuilder.importSymbols("MSERIES-MIB", "mseries") PortMode, PortStatus, PortType = mibBuilder.importSymbols("MSERIES-TC", "PortMode", "PortStatus", "PortType") ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup") ModuleIdentity, NotificationType, MibIdentifier, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, Bits, Counter64, ObjectIdentity, Unsigned32, iso, TimeTicks, Gauge32, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "NotificationType", "MibIdentifier", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "Bits", "Counter64", "ObjectIdentity", "Unsigned32", "iso", "TimeTicks", "Gauge32", "Counter32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") smartPort = ModuleIdentity((1, 3, 6, 1, 4, 1, 30826, 1, 3)) smartPort.setRevisions(('2014-02-12 13:44',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: smartPort.setRevisionsDescriptions(('The initial revision of the MSERIES Port MIB.',)) if mibBuilder.loadTexts: smartPort.setLastUpdated('201402121344Z') if mibBuilder.loadTexts: smartPort.setOrganization('SmartOptics') if mibBuilder.loadTexts: smartPort.setContactInfo('http://www.smartoptics.com') if mibBuilder.loadTexts: smartPort.setDescription('This is the enterprise specific Port MIB for SmartOptics M-Series.') smartPortObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1)) smartPortGeneral = MibIdentifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 1)) smartPortList = MibIdentifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2)) smartPortMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2)) smartPortGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2, 1)) smartPortCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2, 2)) smartPortTable = MibTable((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1), ) if mibBuilder.loadTexts: smartPortTable.setStatus('current') if mibBuilder.loadTexts: smartPortTable.setDescription('A port table.') smartPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1), ).setIndexNames((0, "MSERIES-PORT-MIB", "smartPortIndex")) if mibBuilder.loadTexts: smartPortEntry.setStatus('current') if mibBuilder.loadTexts: smartPortEntry.setDescription('An entry in the port list.') smartPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: smartPortIndex.setStatus('current') if mibBuilder.loadTexts: smartPortIndex.setDescription('A unique index for each port that corresponds to the index in the interface table') smartPortName = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: smartPortName.setStatus('current') if mibBuilder.loadTexts: smartPortName.setDescription('The name of the port.') smartPortAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 3), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smartPortAlias.setStatus('current') if mibBuilder.loadTexts: smartPortAlias.setDescription('User configurable Port Alias for the port. Not writeable in SmartOS v2.3') smartPortType = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 4), PortType()).setMaxAccess("readonly") if mibBuilder.loadTexts: smartPortType.setStatus('current') if mibBuilder.loadTexts: smartPortType.setDescription('The type of port. rx(1) - Receiving port. tx(2) - Transmitting port. biDi(3) - Bidirectional port.') smartPortPower = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: smartPortPower.setStatus('current') if mibBuilder.loadTexts: smartPortPower.setDescription('The power level in units of 0.1 dBm.') smartPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 6), PortStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: smartPortStatus.setStatus('current') if mibBuilder.loadTexts: smartPortStatus.setDescription('The operational state for a port. idle(1) - The port is not activated down(2) - The port traffic is lost. up(3) - There is traffic on the port. high(4) - The port got to high power. low(5) - The port got to low power. eyeSafety(6) - The Line Tx port is in Eye Safety Mode. This means that either the connector on the Line Tx port is not inserted or that you have too strong reflection from the line fiber. cd(7) - Channel detected. ncd(8) - No channel detected.') smartPortMode = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 7), PortMode()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smartPortMode.setStatus('current') if mibBuilder.loadTexts: smartPortMode.setDescription("The Mode of the Port. normal (1) - The port is active. No alarms are beeing suppressed. service (2) . The port is in service mode and alarms are beeing suppressed. When service is ready smartPortMode should be set to 'normal' again. Not writeable in SmartOS v2.3") smartPortHighPowerAlarmThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 8), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smartPortHighPowerAlarmThreshold.setStatus('current') if mibBuilder.loadTexts: smartPortHighPowerAlarmThreshold.setDescription('The threshold for the High Power alarm. Not writeable in SmartOS v2.3') smartPortLowPowerAlarmThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 30826, 1, 3, 1, 2, 1, 1, 9), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: smartPortLowPowerAlarmThreshold.setStatus('current') if mibBuilder.loadTexts: smartPortLowPowerAlarmThreshold.setDescription('The threshold for the Low Power alarm. Not writeable in SmartOS v2.3') smartPortListGroupV1 = ObjectGroup((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2, 1, 1)).setObjects(("MSERIES-PORT-MIB", "smartPortIndex"), ("MSERIES-PORT-MIB", "smartPortName"), ("MSERIES-PORT-MIB", "smartPortAlias"), ("MSERIES-PORT-MIB", "smartPortType"), ("MSERIES-PORT-MIB", "smartPortPower"), ("MSERIES-PORT-MIB", "smartPortStatus"), ("MSERIES-PORT-MIB", "smartPortMode"), ("MSERIES-PORT-MIB", "smartPortHighPowerAlarmThreshold"), ("MSERIES-PORT-MIB", "smartPortLowPowerAlarmThreshold")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): smartPortListGroupV1 = smartPortListGroupV1.setStatus('current') if mibBuilder.loadTexts: smartPortListGroupV1.setDescription('The Port List MIB objects v1.') smartPortBasicComplV1 = ModuleCompliance((1, 3, 6, 1, 4, 1, 30826, 1, 3, 2, 2, 1)).setObjects(("MSERIES-PORT-MIB", "smartPortListGroupV1")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): smartPortBasicComplV1 = smartPortBasicComplV1.setStatus('current') if mibBuilder.loadTexts: smartPortBasicComplV1.setDescription('Basic implementation requirements for the port MIB V1.') mibBuilder.exportSymbols("MSERIES-PORT-MIB", smartPortCompliances=smartPortCompliances, smartPortPower=smartPortPower, smartPortHighPowerAlarmThreshold=smartPortHighPowerAlarmThreshold, smartPortTable=smartPortTable, PYSNMP_MODULE_ID=smartPort, smartPortBasicComplV1=smartPortBasicComplV1, smartPortGeneral=smartPortGeneral, smartPortType=smartPortType, smartPortName=smartPortName, smartPortGroups=smartPortGroups, smartPortIndex=smartPortIndex, smartPort=smartPort, smartPortAlias=smartPortAlias, smartPortStatus=smartPortStatus, smartPortList=smartPortList, smartPortMode=smartPortMode, smartPortLowPowerAlarmThreshold=smartPortLowPowerAlarmThreshold, smartPortEntry=smartPortEntry, smartPortMIBConformance=smartPortMIBConformance, smartPortListGroupV1=smartPortListGroupV1, smartPortObjects=smartPortObjects)
# -*- coding: utf-8 -*- # @Author : LG """ 执行用时:32 ms, 在所有 Python3 提交中击败了99.63% 的用户 内存消耗:13.8 MB, 在所有 Python3 提交中击败了12.97% 的用户 解题思路: 先将链表拆分为单个节点,并统计链长度 根据链表长度以及k,计算,每段的节点个数以及多余的节点数 按照计算结果连接链表 具体实现见代码注释 """ class Solution: def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]: record = [] # 列表保存拆分成单个的节点 r = root num = 0 # 统计链表长度 while r: # 拆分链表节点 r_next = r.next r.next = None record.append(r) r = r_next num += 1 result = [] # 最终结果 remainder = num % k # 计算分段后的多余节点数 n = num // k # 每段的个数 if n < 1: return record + [None] * (k - num) start_index = 0 # 起始位置 for i in range(k): if remainder > 0: # 如果还有多余的节点,则前几段每段多一个节点 nodes = record[start_index:start_index + n + 1] start_index += n + 1 remainder -= 1 # 多余节点数-1 else: nodes = record[start_index:start_index + n] start_index += n nodes += [None] for j, node in enumerate(nodes): # 重组每段链表 if node: node.next = nodes[j + 1] result.append(nodes[0]) # 将重组后的每段链表添加到最终结果中 return result
# # Pelican_manager # __title__ = 'pelican_manager' __description__ = 'easy way to management pelican blog.' __url__ = 'https://github.com/xiaojieluo/pelican-manager' __version__ = '0.2.1' __build__ = 0x021801 __author__ = 'Xiaojie Luo' __author_email__ = 'xiaojieluoff@gmail.com' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2017 Xiaojie Luo' __cake__ = u'\u2728 \U0001f370 \u2728'
#!/usr/bin/env python #pylint: skip-file # This source code is licensed under the Apache license found in the # LICENSE file in the root directory of this project. class ScheduleInfoOutput(object): def __init__(self): """ Attributes: swaggerTypes (dict): The key is attribute name and the value is attribute type. attributeMap (dict): The key is attribute name and the value is json key in definition. """ self.swaggerTypes = { 'description': 'str', 'startTime': 'date-time', 'endTime': 'date-time', 'origin': 'str', 'operation': 'str', 'taskId': 'str', 'groupName': 'str', 'scheduledWorkSpecId': 'str', 'prevTime': 'date-time', 'nextTime': 'date-time' } self.attributeMap = { 'description': 'description', 'startTime': 'startTime', 'endTime': 'endTime', 'origin': 'origin', 'operation': 'operation', 'taskId': 'taskId', 'groupName': 'groupName', 'scheduledWorkSpecId': 'scheduledWorkSpecId', 'prevTime': 'prevTime', 'nextTime': 'nextTime' } #Simple description to be shown to end-users self.description = None # str #The time at which the trigger should first fire. If the schedule has fired and will not fire again, this value will be null self.startTime = None # date-time #The time at which the trigger should quit repeating self.endTime = None # date-time #Contextual field used to identify work spcifications originating from the same source self.origin = None # str #Contextual field used by the service to identify an operation self.operation = None # str #UUID of the Task self.taskId = None # str #A grouping name that can be specified by the service to allow for filtered work spec retrieval self.groupName = None # str #UUID of the ScheduledWorkSpec associated with the scheduled task self.scheduledWorkSpecId = None # str #The previous time at which the trigger fired. If the trigger has not yet fired, null will be returned self.prevTime = None # date-time #The next time at which the trigger should fire self.nextTime = None # date-time
class OpenAPISchemaError(Exception): """ Custom exception raised when package tests fail. """ pass
def addBlogsEntryL1(index_file): blogTemplate = ''' <h1 style="color:#d45131"> My Latest Blogs✍️</h1> <div align='left' class="div-blog"> <!-- BLOG-POST-LIST:START --><!-- BLOG-POST-LIST:END --> </div> ''' temp_file = index_file.replace('<!-- BLOG-ENTRY -->', blogTemplate) return temp_file def addBlogsEntryL2(index_file): nav_template = ''' <li class="nav-item"><a class="nav-link js-scroll-trigger" href="#blogs">Latest Blogs</a></li> ''' temp_file = index_file.replace('<!-- BLOGS-NAV-ENTRY -->', nav_template) blog_template = ''' <section class="resume-section" id="blogs"> <div class="resume-section-content"> <h2 class="mb-5">Blogs</h2> <!-- BLOG-POST-LIST:START --><!-- BLOG-POST-LIST:END --> </div> </section> <hr class="m-0" /> ''' final_file = temp_file.replace('<!-- BLOGS-ENTRY -->', blog_template) return final_file
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # This file is part of ltlf2dfa. # # ltlf2dfa 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 3 of the License, or # (at your option) any later version. # # ltlf2dfa 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 ltlf2dfa. If not, see <https://www.gnu.org/licenses/>. # """Declaration of metadata for the package.""" __title__ = "ltlf2dfa" __description__ = "LTLf and PLTLf to Deterministic Finite-state Automata (DFA)" __url__ = "https://github.com/whitemech/ltlf2dfa.git" __version__ = "1.0.2" __author__ = "Francesco Fuggitti" __author_email__ = "fuggitti@diag.uniroma1.it" __license__ = "GNU Lesser General Public License v3 or later (LGPLv3+)" __copyright__ = "2018-2022 WhiteMech"
# my_script.py # enlarge function def enlarge(n): return n * 100
DEFINE = 'define' BEGIN = 'begin' SET = 'set!' LAMBDA = 'lambda' LET = 'let' LET_STAR = 'let*' LET_REC = 'letrec' OPEN_PARANT = '(' CLOSE_PARANT = ')' ADD = '+' SUB = '-' MULT = '*' DIV = '/' DOT = '.' QUOTE = 'quote' QUASIQUOTE = 'quasiquote' UNQUOTE = 'unquote' UNQUOTE_SPLICING = 'unquote-splicing' APPLY = 'apply' IF = 'if' COND = 'cond' DELAY = 'delay' FORCE = 'force' DEFAULT = 'default' SLEEP = 'sleep' RANDOM = 'random'
""" System configuration constants """ RANGE_MIN = 1 RANGE_MAX = 100000 ENTRY_SIZE = 3 MAX_INPUT_SIZE = 99 ERROR_MSG_INVALID_FILE_EXTENSION = "The provided file has an invalid format. Only text (.txt) files are accepted." ERROR_MSG_EXCEEDED_MAX_INPUT_SIZE = "Number of entries bigger than the allowed maximum (%d)." % MAX_INPUT_SIZE ERROR_MSG_INPUT_SIZE_MISMATCH = "Mismatch between informed and actual number of entries." ERROR_MSG_INVALID_ENTRY_SIZE = "Invalid entry size at line %d. Expected: %d per entry." ERROR_MSG_INVALID_ENTRY_RANGE = "Invalid entry range at line %d." ERROR_MSG_INVALID_ENTRY_TYPE = "Invalid input format at line %d. Only integers are accepted."
"""Library for wally. This library provides an API for budgeting. """
################################### # File Name : compare_identity_analysis.py ################################### #!/usr/bin/python3 def main(): print ("=== compare identity ===") print (999 is 999) x = 999; y = 999; print (x is y) z = 999; print (x is z) print (id(x)) print (id(y)) print (id(z)) if __name__ == "__main__": main()
# # PySNMP MIB module FASTPATH-PFC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTPATH-PFC-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:12:20 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) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection") fastPath, = mibBuilder.importSymbols("BROADCOM-REF-MIB", "fastPath") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Bits, NotificationType, ModuleIdentity, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, TimeTicks, iso, Counter64, Gauge32, Integer32, Unsigned32, IpAddress, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "NotificationType", "ModuleIdentity", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "TimeTicks", "iso", "Counter64", "Gauge32", "Integer32", "Unsigned32", "IpAddress", "Counter32") RowStatus, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "DisplayString", "TextualConvention") fastPathPFC = ModuleIdentity((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47)) if mibBuilder.loadTexts: fastPathPFC.setLastUpdated('200905220000Z') if mibBuilder.loadTexts: fastPathPFC.setOrganization('Broadcom Corporation') if mibBuilder.loadTexts: fastPathPFC.setContactInfo(' Customer Support Postal: Broadcom Corporation 100 Perimeter Park Drive Suite H Morrisville, NC 27560 Tel: +1 919 865 2700') if mibBuilder.loadTexts: fastPathPFC.setDescription('The MIB definitions Priority based Flow Control Feature.') agentPfcCfgGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1)) agentPfcTable = MibTable((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1), ) if mibBuilder.loadTexts: agentPfcTable.setStatus('current') if mibBuilder.loadTexts: agentPfcTable.setDescription('A table providing configuration of PFC Profile per interface.') agentPfcEntry = MibTableRow((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1), ).setIndexNames((0, "FASTPATH-PFC-MIB", "agentPfcIntfIndex")) if mibBuilder.loadTexts: agentPfcEntry.setStatus('current') if mibBuilder.loadTexts: agentPfcEntry.setDescription('PFC Profile configuration for a port.') agentPfcIntfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: agentPfcIntfIndex.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfIndex.setDescription('This is a unique index for an entry in the agentPfcTable. A non-zero value indicates the ifIndex for the corresponding interface entry in the ifTable.') agentPfcIntfAdminMode = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2))).clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentPfcIntfAdminMode.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfAdminMode.setDescription('Enables/disables PFC profile on an interface.') agentPfcIntfPfcStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("inactive", 2))).clone(2)).setMaxAccess("readonly") if mibBuilder.loadTexts: agentPfcIntfPfcStatus.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfPfcStatus.setDescription('Shows the operational-status of PFC on an interface.') agentPfcTotalIntfPfcFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 4), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesRx.setStatus('current') if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesRx.setDescription('Total Received PFC Frames on this interface.') agentPfcTotalIntfPfcFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 1, 1, 5), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesTx.setStatus('current') if mibBuilder.loadTexts: agentPfcTotalIntfPfcFramesTx.setDescription('Total Transmitted PFC Frames on this interface.') agentPfcActionTable = MibTable((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2), ) if mibBuilder.loadTexts: agentPfcActionTable.setStatus('current') if mibBuilder.loadTexts: agentPfcActionTable.setDescription('A table providing priority and action mappings configuration of PFC.') agentPfcActionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1), ).setIndexNames((0, "FASTPATH-PFC-MIB", "agentPfcIntfIndex"), (0, "FASTPATH-PFC-MIB", "agentPfcPriority")) if mibBuilder.loadTexts: agentPfcActionEntry.setStatus('current') if mibBuilder.loadTexts: agentPfcActionEntry.setDescription('PFC Action Profile configuration for a port.') agentPfcPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))) if mibBuilder.loadTexts: agentPfcPriority.setStatus('current') if mibBuilder.loadTexts: agentPfcPriority.setDescription('This is a unique index for an entry in the agentPfcActionTable. A non-zero value indicates the CosQueue Priority.') agentPfcAction = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("drop", 1), ("nodrop", 2))).clone(1)).setMaxAccess("readwrite") if mibBuilder.loadTexts: agentPfcAction.setStatus('current') if mibBuilder.loadTexts: agentPfcAction.setDescription('Set Drop/No-Drop action in PFC profile for the corresponding priority.') agentPfcIntfStatsPerPriorityTable = MibTable((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3), ) if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityTable.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityTable.setDescription('A table providing statistics of PFC per interface per priority.') agentPfcIntfStatsPerPriorityEntry = MibTableRow((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3, 1), ).setIndexNames((0, "FASTPATH-PFC-MIB", "agentPfcIntfIndex"), (0, "FASTPATH-PFC-MIB", "agentPfcPriority")) if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityEntry.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfStatsPerPriorityEntry.setDescription('PFC Stats for a priority and for a port.') agentPfcIntfPfcPriorityFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 47, 1, 3, 1, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: agentPfcIntfPfcPriorityFramesRx.setStatus('current') if mibBuilder.loadTexts: agentPfcIntfPfcPriorityFramesRx.setDescription('Received PFC Frames on this interface for a priority.') mibBuilder.exportSymbols("FASTPATH-PFC-MIB", agentPfcCfgGroup=agentPfcCfgGroup, agentPfcPriority=agentPfcPriority, agentPfcTotalIntfPfcFramesTx=agentPfcTotalIntfPfcFramesTx, agentPfcIntfIndex=agentPfcIntfIndex, agentPfcIntfStatsPerPriorityTable=agentPfcIntfStatsPerPriorityTable, agentPfcActionTable=agentPfcActionTable, agentPfcTable=agentPfcTable, agentPfcIntfStatsPerPriorityEntry=agentPfcIntfStatsPerPriorityEntry, PYSNMP_MODULE_ID=fastPathPFC, agentPfcIntfAdminMode=agentPfcIntfAdminMode, agentPfcAction=agentPfcAction, fastPathPFC=fastPathPFC, agentPfcTotalIntfPfcFramesRx=agentPfcTotalIntfPfcFramesRx, agentPfcIntfPfcPriorityFramesRx=agentPfcIntfPfcPriorityFramesRx, agentPfcEntry=agentPfcEntry, agentPfcIntfPfcStatus=agentPfcIntfPfcStatus, agentPfcActionEntry=agentPfcActionEntry)
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class X86SystemVParameterManager(object): def __init__(self, emulator): self.__emulator = emulator def __getitem__(self, index): # NOTE: Only works if it is call before the stack frame is made. esp = self.__emulator.registers['esp'] return self.__emulator.read_memory(esp + 4 * index + 0x4, 4) def __setitem__(self, index, value): # NOTE: Only works if it is call before the stack frame is made. esp = self.__emulator.registers['esp'] return self.__emulator.write_memory(esp + 4 * index + 0x4, 4, value) class X86SystemV(object): def __init__(self, emulator): self.__emulator = emulator self.__parameters = X86SystemVParameterManager(emulator) @property def parameters(self): return self.__parameters @property def return_value(self): return self.__emulator.registers['eax'] @return_value.setter def return_value(self, value): self.__emulator.registers['eax'] = value class X86_64SystemVParameterManager(object): def __init__(self, emulator): self.__emulator = emulator def __getitem__(self, index): if index == 0: return self.__emulator.registers['rdi'] elif index == 1: return self.__emulator.registers['rsi'] elif index == 2: return self.__emulator.registers['rdx'] elif index == 3: return self.__emulator.registers['rcx'] elif index == 4: return self.__emulator.registers['r8'] elif index == 5: return self.__emulator.registers['r9'] else: raise NotImplementedError() def __setitem__(self, index, value): if index == 0: self.__emulator.registers['rdi'] = value elif index == 1: self.__emulator.registers['rsi'] = value elif index == 2: self.__emulator.registers['rdx'] = value elif index == 3: self.__emulator.registers['rcx'] = value elif index == 4: self.__emulator.registers['r8'] = value elif index == 5: self.__emulator.registers['r9'] = value else: raise NotImplementedError() class X86_64SystemV(object): def __init__(self, emulator): self.__emulator = emulator self.__parameters = X86_64SystemVParameterManager(emulator) @property def parameters(self): return self.__parameters @property def return_value(self): return self.__emulator.registers['rax'] @return_value.setter def return_value(self, value): self.__emulator.registers['rax'] = value class ArmSystemVParameterManager(object): def __init__(self, emulator): self.__emulator = emulator def __getitem__(self, index): if index == 0: return self.__emulator.registers['r0'] elif index == 1: return self.__emulator.registers['r1'] elif index == 2: return self.__emulator.registers['r2'] elif index == 3: return self.__emulator.registers['r3'] else: raise NotImplementedError() def __setitem__(self, index, value): if index == 0: self.__emulator.registers['r0'] = value elif index == 1: self.__emulator.registers['r1'] = value elif index == 2: self.__emulator.registers['r2'] = value elif index == 3: self.__emulator.registers['r3'] = value else: raise NotImplementedError() class ArmSystemV(object): def __init__(self, emulator): self.__emulator = emulator self.__parameters = ArmSystemVParameterManager(emulator) @property def parameters(self): return self.__parameters @property def return_value(self): return self.__emulator.registers['r0'] @return_value.setter def return_value(self, value): self.__emulator.registers['r0'] = value
def find_path(start, end, parents): """ Constructs a path between two vertices, given the parents of all vertices. """ path, parent = [], end while parent != parents[start]: path.append(parent) parent = parents[parent] return path[::-1]
def resolve(): ''' code here ''' num_S, num_c = [int(item) for item in input().split()] delta = num_c - num_S *2 scc = 0 if num_S != 0: if num_c // 2 <= num_S : scc = num_c//2 else: scc = num_S scc += delta//4 else: scc = num_c//4 print(scc) if __name__ == "__main__": resolve()
class Template(object): def __init__(self, usages, snippets, blocks): self.usages = usages self.snippets = snippets self.blocks = blocks def accept(self, visitor): visitor.visit_template(self) class Text(object): def __init__(self, text_token): self._token = text_token def get_token(self): return self._token token = property(get_token) def _get_content(self): return self._token.lexeme content = property(_get_content) def accept(self, visitor): visitor.visit_text(self) class CondBlock(object): def __init__(self, branches): self.branches = branches def accept(self, visitor): visitor.visit_cond(self) class ForBlock(object): def __init__(self, item_ident, list_expr, blocks, filter_cond=None): self.item_ident = item_ident self.list_expr = list_expr self.blocks = blocks self.filter_cond = filter_cond def accept(self, visitor): visitor.visit_for(self) class Snippet(object): def __init__(self, snippet_name, params, blocks): self.name = snippet_name self.params = params self.blocks = blocks def accept(self, visitor): visitor.visit_snippet(self) class SnippetCall(object): def __init__(self, snippet_name, args): self.name = snippet_name self.args = args def accept(self, visitor): visitor.visit_snippet_call(self) class Call(object): def __init__(self, callee, args): self.callee = callee self.args = args def accept(self, visitor): visitor.visit_call(self) class Use(object): def __init__(self, template_name, names): self.template_name = template_name self.names = names # names and aliases def accept(self, visitor): visitor.visit_use(self) class SingleToken(object): def __init__(self, token): self.token = token def accept(self, visitor): visitor.visit_expr(self) class Identifier(SingleToken): def __init__(self, identifier_token): SingleToken.__init__(self, identifier_token) def get_name(self): return self.token.lexeme class SimpleValue(SingleToken): def __init__(self, token): SingleToken.__init__(self, token) def get_value(self): raise Exception("Not implemented") class Bool(SimpleValue): def __init__(self, bool_token): SimpleValue.__init__(self, bool_token) def get_value(self): s = self.token.lexeme return s == "true" or s == "else" class String(SimpleValue): def __init__(self, str_token): SimpleValue.__init__(self, str_token) def get_value(self): return self.token.lexeme def get_string(self): return self.token.lexeme[1:-1].replace("\\'", "'") class Int(SimpleValue): def __init__(self, int_token): SimpleValue.__init__(self, int_token) def get_value(self): return int(self.token.lexeme) class Real(SimpleValue): def __init__(self, real_token): SimpleValue.__init__(self, real_token) def get_value(self): return float(self.token.lexeme) class QualifiedName(object): def __init__(self, identifier_tokens): self.identifier_tokens = identifier_tokens def accept(self, visitor): visitor.visit_expr(self) def get_name(self): return str(self) def __str__(self): return ".".join(list(map(lambda ident: ident.lexeme, self.identifier_tokens))) class LogicalBinExpr(object): def __init__(self, op, left, right): self.op = op self.left = left self.right = right def accept(self, visitor): visitor.visit_logical_bin(self) class LogicalRelation(object): def __init__(self, op, left, right): self.op = op self.left = left self.right = right def accept(self, visitor): visitor.visit_logical_rel(self) class Negation(object): def __init__(self, expr): self.expr = expr def accept(self, visitor): visitor.visit_negation(self) class BaseVisitor(object): def __init__(self): pass def visit_template(self, templ): pass def visit_text(self, text): pass def visit_cond(self, cond_block): pass def visit_for(self, for_block): pass def visit_snippet(self, snippet): pass def visit_snippet_call(self, snippet_call): pass def visit_use(self, use): pass def visit_call(self, func_call): pass def visit_expr(self, expr): pass def visit_logical_bin(self, logical_bin): pass def visit_logical_rel(self, logical_rel): pass def visit_negation(self, negation): pass
#take user inputs for Item code itemCode = input("Item Code : ") while itemCode != "1" and itemCode != "2" and itemCode != "3": print("Invalid Input!! Try again") itemCode = input("Item Code : ") #take user inputs for quantity quantity = input("Quantity : ") quantity = float(quantity) #take user inputs for customer type cType = input("Customer Type (L / N) : ") while cType != "L" and cType != "l" and cType != "N" and cType != "n": print("Invalid Input!! Try again") cType = input("Customer Type (L / N) : ") #calculate basic price if itemCode == "1": total = 530 * quantity elif itemCode == "2": total = 300 * quantity elif itemCode == "3": total = 950 * quantity #calculate discount if cType == "L" or cType == "l": discount = float(total * 25 / 100) else: discount = float(total * 5 / 100) #calculate total price total = total - discount #display the discount and total print("Discount : " + str(discount)) print("Total bill after the discount : " + str(total))
"""API operation on tags.""" class TagOperator(object): """Task tag settings.""" def __init__(self, connect): """Initialize instance. Args: connect (rayvision_api.api.connect.Connect): The connect instance. """ self._connect = connect def add_label(self, new_name, status=1): """Add a custom label. Args: new_name (str): Label name. status (int, optional): Label status,0 or 1,default is 1. """ data = { 'newName': new_name, 'status': int(status) } return self._connect.post(self._connect.url.add, data) def delete_label(self, del_name): """Delete custom label. Args: del_name (str): The name of the label to be deleted. """ data = {'delName': del_name} return self._connect.post(self._connect.url.delete, data) def get_label_list(self): """Get custom labels. Returns: dict: Label list info. e.g.: { "projectNameList": [ { "projectId": 3671, "projectName": "myLabel" } ] } """ return self._connect.post(self._connect.url.getList, validator=False) def get_project_list(self): """Get custom labels. Returns: list: Label list info. e.g.: [ { "projectId": 3671, "projectName": "myLabel" } ] """ return self.get_label_list()['projectNameList'] def add_task_tag(self, tag, task_ids): """Add a custom task tag. Args: tag (str): Label name. task_ids (list[int], optional): task id list. """ data = { "label": tag, "taskIds": task_ids } return self._connect.post(self._connect.url.addTaskLabel, data) def delete_task_tag(self, tag_ids): """del custom task label. Args: label_ids (list[int], optional): lable id list. """ data = { "labelIds": tag_ids } return self._connect.post(self._connect.url.deleteTaskLabel, data) def get_list(self, flag=0): """Get the project name based on the flag. Args: flag (int): 0. Query items under this account; 1. Query items under this account and under the master account; 2. Query all items associated with (all items under the same master account) """ data = { 'flag': flag, } return self._connect.post(self._connect.url.list, data)
#!/usr/bin/env python # -*- coding: utf-8 -*- # Keyword TOKEN_TYPE_IF = 0 TOKEN_TYPE_ELIF = 1 TOKEN_TYPE_ELSE = 2 TOKEN_TYPE_FOR = 3 TOKEN_TYPE_IN = 4 TOKEN_TYPE_WHILE = 5 TOKEN_TYPE_BREAK = 6 TOKEN_TYPE_NOT = 7 TOKEN_TYPE_AND = 8 TOKEN_TYPE_OR = 9 TOKEN_TYPE_RETURN = 10 TOKEN_TYPE_IMPORT = 11 TOKEN_TYPE_FUN = 12 TOKEN_TYPE_CLASS = 13 TOKEN_TYPE_LET = 14 TOKEN_TYPE_GLOBAL = 15 TOKEN_TYPE_TRUE = 16 TOKEN_TYPE_FALSE = 17 TOKEN_TYPE_CONTINUE = 18 TOKEN_TYPE_DEL = 19 keyword_strs = { 'if': TOKEN_TYPE_IF, 'elif': TOKEN_TYPE_ELIF, 'else': TOKEN_TYPE_ELSE, 'for': TOKEN_TYPE_FOR, 'in': TOKEN_TYPE_IN, 'while': TOKEN_TYPE_WHILE, 'break': TOKEN_TYPE_BREAK, 'not': TOKEN_TYPE_NOT, 'and': TOKEN_TYPE_AND, 'or': TOKEN_TYPE_OR, 'return': TOKEN_TYPE_RETURN, 'import': TOKEN_TYPE_IMPORT, 'fun': TOKEN_TYPE_FUN, 'class': TOKEN_TYPE_CLASS, 'let': TOKEN_TYPE_LET, 'global': TOKEN_TYPE_GLOBAL, 'True': TOKEN_TYPE_TRUE, 'False': TOKEN_TYPE_FALSE, 'continue': TOKEN_TYPE_CONTINUE, 'del': TOKEN_TYPE_DEL, } # Arithmetic operators TOKEN_TYPE_ADD = 20 TOKEN_TYPE_SUB = 21 TOKEN_TYPE_MUL = 22 TOKEN_TYPE_DIV = 23 TOKEN_TYPE_MOD = 24 # % TOKEN_TYPE_POWER = 25 # Logical operators TOKEN_TYPE_EQU = 26 TOKEN_TYPE_NEQU = 27 # != TOKEN_TYPE_GT = 28 TOKEN_TYPE_LT = 29 TOKEN_TYPE_GE = 30 TOKEN_TYPE_LE = 31 # Assigning operator TOKEN_TYPE_ASSIGN = 32 # Bitwise operator TOKEN_TYPE_LOGIC_AND = 33 TOKEN_TYPE_LOGIC_OR = 34 TOKEN_TYPE_LOGIC_XOR = 35 TOKEN_TYPE_LOGIC_NOT = 36 TOKEN_TYPE_LOGIC_SHL = 37 TOKEN_TYPE_LOGIC_SHR = 38 # Data type TOKEN_TYPE_NUM = 39 TOKEN_TYPE_STR = 40 # Others TOKEN_TYPE_COMMA = 41 TOKEN_TYPE_POINT = 42 TOKEN_TYPE_COLON = 43 # : TOKEN_TYPE_SEMICOLON = 44 # ;, ; is comment TOKEN_TYPE_LEFT_PARENT = 45 # ( TOKEN_TYPE_RIGHT_PARENT = 46 # ) TOKEN_TYPE_LEFT_BRACKET = 47 # [ TOKEN_TYPE_RIGHT_BRACKET = 48 # ] TOKEN_TYPE_LEFT_BRACE = 49 # { TOKEN_TYPE_RIGHT_BRACE = 50 # } TOKEN_TYPE_DOUBLE_QUOTATION = 51 TOKEN_TYPE_SINGLE_QUOTE = 52 # ' is anonymous function TOKEN_TYPE_EOF = 53 # The end of file TOKEN_TYPE_UNKNOWN = 54 # Extra TOKEN_TYPE_NIL = 55 # File start sign TOKEN_TYPE_ID = 56 TOKEN_TYPE_SPACER = 57 # ` TOKEN_TYPE_STR_LINES = 58 TOKEN_TYPE_SELF = 59
############################################################################### '''''' ############################################################################### # import unittest def testfunc(a, b, c, d=4, # another comment /, e: int = 5, # stuff f=6, g=7, h=8, *args, # morestuff i, j=10, # k k0=11, k1=110, k2=1100, l=12, # noqa: E741 m=13, # bonusstuff n=14, # morebonusstuff o=15, # ignore fee='fee', fie='fie', foe='foe', fum='fum', # subignore boo='boo', p=16, **kwargs, ): print( a, b, c, d, e, f, g, h, args, i, j, k0, k1, k2, l, m, n, o, p, kwargs ) # class CascadeTest(unittest.TestCase): # def test(self): # inputs = Inputs(testfunc) # self.assertEqual(inputs.stuff.f, 6) # inputs.stuff.f = 'myval' # self.assertEqual(inputs.stuff.f, 'myval') # self.assertEqual(inputs.f, 'myval') # inputs['k'] = 'myval' # self.assertEqual(inputs.k, 'myval') # self.assertEqual(inputs.morestuff.substuff.k, 'myval') # self.assertTrue(not hasattr(inputs, 'foo')) # self.assertTrue(not hasattr(inputs, '_c')) # # if __name__ == '__main__': # unittest.main() ############################################################################### ###############################################################################
def main(): # input N = int(input()) SPs = [input().split() for _ in range(N)] SPs = list(map(lambda x: (x[1][0], int(x[1][1]), x[0]), enumerate(SPs))) # enumerate()を利用しているのでx[0]にはインデックスが格納されている # compute SPs.sort(key=lambda x: x[1], reverse=True) SPs.sort(key=lambda x: x[0]) # output for _, _, i in SPs: print(i+1) if __name__ == '__main__': main()
class Pessoa: olhos = 2 def __init__(self,*filhos,nome=None,idade=27): self.nome = nome self.idade = idade self.filhos = list(filhos) def cumprimentar(self): return f'Olá id{self}' @staticmethod def metodo_estatico(): return 42 @classmethod def metodo_classe(cls): return f'{cls} olhos: {cls.olhos}' if __name__ == '__main__': lucas = Pessoa(nome='Lucas de Moura Quadros',idade=27) yago = Pessoa(nome='Yago de Moura Quadros',idade=26) laura = Pessoa(nome='Laura Quadros',idade=16) clarinha = Pessoa(nome='Maria Clara de Quadros',idade=5) luiz = Pessoa(lucas,yago,laura,clarinha,nome='Luiz Alberto de Quadros',idade=55) print("\nFilhos do Luiz:\n") for filho in luiz.filhos: print(filho.nome) lucas.olhos = 3 print(Pessoa.olhos) print(lucas.__dict__) del lucas.olhos print(lucas.__dict__,lucas.olhos) Pessoa.olhos = 1 print(lucas.__dict__,lucas.olhos) print(Pessoa.metodo_estatico(),lucas.metodo_estatico()) print(Pessoa.metodo_classe(),lucas.metodo_classe()) """ To import in Python Console: from oo.pessoa import Pessoa """
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: retlisthead, retlistpos = None, None lv: int = 0 while l1 is not None or l2 is not None: v1, l1 = (l1.val, l1.next) if l1 is not None else (0, None) v2, l2 = (l2.val, l2.next) if l2 is not None else (0, None) v = v1 + v2 + lv lv = v // 10 node = ListNode(v % 10) if retlisthead is None: retlisthead = node else: retlistpos.next = node retlistpos = node if lv != 0: retlistpos.next = ListNode(lv) return retlisthead def NodeToList(l: ListNode) -> list: ret = list() while l is not None: ret.append(l.val) l = l.next return ret def ListToNode(l: list) -> ListNode: retlisthead, retlistpos = None, None for v in l: node = ListNode(v) if retlisthead is None: retlisthead = node else: retlistpos.next = node retlistpos = node return retlisthead if __name__ == "__main__": sol = Solution() l1 = ListToNode([2, 4, 3]) l2 = ListToNode([5, 6, 4]) print(NodeToList(sol.addTwoNumbers(l1, l2))) l1 = ListToNode([0]) l2 = ListToNode([0]) print(NodeToList(sol.addTwoNumbers(l1, l2))) l1 = ListToNode([9, 9, 9, 9, 9, 9, 9]) l2 = ListToNode([9, 9, 9, 9]) print(NodeToList(sol.addTwoNumbers(l1, l2)))
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]: Len = 0 tmp = root while tmp: Len+=1 tmp = tmp.next part_len = Len // k remain = Len % k res = [] for _ in range(k): head = ListNode(0) each = head for _ in range(part_len): node = ListNode(root.val) each.next = node each = each.next root = root.next if remain and root: remain_node = ListNode(root.val) each.next = remain_node if root: root = root.next remain -= 1 res.append(head.next) return res
T = int(input()) for _ in range(T): s = input() n_1 = 0 for c in s: if c == '1': n_1 += 1 if n_1%2: print('WIN') else: print('LOSE')
# -*- coding: utf-8 -*- class AM232xError(Exception): """ AM232x とのデータ送受信において、何らかのエラーが発生したことを示す Exception. am232x モジュールが投げる例外の基底クラスとして利用する。 """ class ReceiveAM232xDataError(AM232xError): """ AM232x からデータを受信した際に、エラーが発生したことを示すエラーコードが含まれていたことを示す Exception. """ def __init__(self, error_code, chip_name="am232x"): self._chip_name = chip_name self._error_code = error_code def __str__(self): return ("{chip_name} : Received error code : 0x{error_code:x}" .format(chip_name=self._chip_name, error_code=self._error_code)) class AM232xCrcCheckError(AM232xError): """ AM232x から受信した CRC と、受信したデータから計算した CRC に相違があることを示す Exception. """ def __init__(self, recv_crc, calc_crc, chip_name="am232x"): self._chip_name = chip_name self._recv_crc = recv_crc self._calc_crc = calc_crc def __str__(self): return ("{chip_name} : CRC error : [receive : 0x{recv_crc:x}, calculate : 0x{calc_crc:x}]" .format(chip_name=self._chip_name, recv_crc=self._recv_crc, calc_crc=self._calc_crc))
""" 问题描述:给定两个字符串str1和str2,再给定三个整数ic、dc和rc,分别代表插入、删除 和替换一个字符的代价,返回将str1编辑成str2的最小代价。 举例: str1='abc', str2='adc', ic=5, dc=3, rc=2 从'abc'编辑成'adc',把'b'替换成'd'是代价最小的,所以返回2. str1='abc',str2='adc',ic=5,dc=3,rc=100 从abc编辑成adc,先删除b,然后插入d代价是最小的,所以返回8 str1='abc',str2='abc',ic=5,dc=3,rc=2 不用编辑了,本来就是一样的字符串,所以返回0 """ class LowestEditCost: @classmethod def get_lowest_edit_cost_way_1(cls, str1, str2, ic, dc, rc): if str1 is None or str2 is None: return 0 len1 = len(str1) len2 = len(str2) dp = [[0 for _ in range(len2+1)] for _ in range(len1+1)] for i in range(len1+1): dp[i][0] = dc * i for j in range(len2+1): dp[0][j] = ic * j for i in range(1, len1+1): for j in range(1, len2+1): if str1[i-1] == str2[j-1]: dp[i][j] = dp[i-1][j-1] else: dp[i][j] = dp[i-1][j-1] + rc dp[i][j] = min([dp[i][j], dp[i-1][j]+dc]) dp[i][j] = min(dp[i][j], dp[i][j-1]+ic) return dp[len1][len2] @classmethod def get_lowest_edit_cost_way_2(cls, str1, str2, ic, dc, rc): if str1 is None or str2 is None: return 0 longs = str1 if len(str1) >= len(str2) else str2 shorts = str1 if len(str1) < len(str2) else str2 if len(str1) < len(str2): temp = ic ic = dc dc = temp dp = [0 for _ in range(len(shorts)+1)] for i in range(1, len(shorts)+1): dp[i] = ic * i for i in range(1, len(longs)+1): pre = dp[0] dp[0] = dc * i for j in range(1, len(shorts)+1): temp = dp[j] if longs[i-1] == shorts[j-1]: dp[j] = pre else: dp[j] = pre + rc dp[j] = min([dp[j], dp[j-1]+ic]) dp[j] = min([dp[j], temp+dc]) pre = temp return dp[len(shorts)] if __name__ == '__main__': str1 = "ab12cd3" str2 = "abcdf" print(LowestEditCost.get_lowest_edit_cost_way_1(str1, str2, 5, 3, 2)) print(LowestEditCost.get_lowest_edit_cost_way_2(str1, str2, 5, 3, 2)) str1 = "abcdf" str2 = "ab12cd3" print(LowestEditCost.get_lowest_edit_cost_way_1(str1, str2, 3, 2, 4)) print(LowestEditCost.get_lowest_edit_cost_way_1(str1, str2, 3, 2, 4)) str1 = "" str2 = "ab12cd3" print(LowestEditCost.get_lowest_edit_cost_way_1(str1, str2, 1, 7, 5)) print(LowestEditCost.get_lowest_edit_cost_way_2(str1, str2, 1, 7, 5)) str1 = "abcdf" str2 = "" print(LowestEditCost.get_lowest_edit_cost_way_1(str1, str2, 2, 9, 8)) print(LowestEditCost.get_lowest_edit_cost_way_2(str1, str2, 2, 9, 8))
""" 存放常量 """ # # 增加列调整因子 # 存储数据时使用因子调整为整数uint32,读取时使用因子倒数调整回原始数据 # 可简化代码及提高存取速度 # 防止数据溢出,尽量保持原有数据精度。 ADJUST_FACTOR = {'turnover':10000, # 换手率为百分比34.78 代表 34.78% #'change_pct':10000, # _read_bcolz_data只处理uint32, change_pct为int32 'open':1000, 'high':1000, 'low':1000, 'close':1000, 'prev_close':1000, 'amount':0.0001, 'volume':0.0001, # 指数数据须缩小,否则会溢出 'cmv':0.0001, 'tmv':0.0001} # 包含退市或暂停上市股票代码 TEST_SIDS = frozenset([1, 33, 155, 333, 792, 2006, 2071, 2146, 2209, 2024, 300001, 300354, 300422, 300536, 300692, 600000, 600432, 600645, 601857, 601398, # 指数sid 499001])
D = int(input("Saisir le nombre de kilomètres parcourus : ")) if D <= 5000: F = D*0.536 else: if D <= 20000: F = 1180+D*0.30 else: F = D*0.359 print("Vos frais kilométriques s'élèvent à ", F, "Euros HT") money_request = int(input("saisir le montant demandé : ")) # division euclidienne "doublée" afin de récupérer le reste ainsi que le nombre de billet billet_number200 = money_request//200 billet_reste = money_request % 200 billet_number100 = billet_reste//100 billet_reste = billet_reste % 100 billet_number50 = billet_reste//50 billet_reste = billet_reste % 50 billet_number20 = billet_reste//20 billet_reste = billet_reste % 20 billet_number10 = billet_reste//10 # Affichage de la composition des billets en vue de l'appel d'une fonction print("nombre de billet de 200 : ", billet_number200) print("nombre de billet de 100 : ", billet_number100) print("nombre de billet de 50 : ", billet_number50) print("nombre de billet de 20 : ", billet_number20) print("nombre de billet de 10 : ", billet_number10)
def obrnut(tekst): return tekst[::-1] def da_li_je_palindrom(tekst): return tekst == obrnut(tekst) nesto = input("Ukucja tekst: ") if(da_li_je_palindrom(nesto)): print("Da, to je palindrom") else: print("Ne to nije palindrom")
def arrayPartition(nums): nums.sort() suma=0 for i in range(0,len(nums),2): suma+=min(nums[i],nums[i+1]) return suma nums = [1,4,3,2] print(arrayPartition(nums))
# Write your solution here def spruce(n): row = "*" print("a spruce!") while n > 0: print(" " * (n-1) + row + " " * (n-1)) row += "**" n -= 1 l = int((len(row)-3)/2) print(" " * l + "*" + " " * l) # You can test your function by callil if __name__ == "__main__": spruce(5) spruce(4)
""" Copyright (c) 2021 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ # OSBS2 TBD def get_inspect_for_image(image): # util.get_inspect_for_image(image, registry, insecure=False, dockercfg_path=None) # or use skopeo # insecure = self.pull_registries[base_image.registry]['insecure'] # dockercfg_path = self.pull_registries[base_image.registry]['dockercfg_path'] # self._base_image_inspect =\ # atomic_reactor.util.get_inspect_for_image(base_image, base_image.registry, insecure, # dockercfg_path) return {} def get_image_history(image): # get image history with skopeo / registry api return [] def inspect_built_image(): # get output image final/arch specific from somewhere # and call get_inspect_for_image return {} def base_image_inspect(): # get base image from workflow.dockerfile_images # and call get_inspect_for_image return {} def remove_image(image, force=False): # self.tasker.remove_image(image, force=force) # most likely won't be needed at all return {} def tag_image(image, new_image): # self.tasker.tag_image(image, new_image) return True def get_image(image): # self.tasker.get_image(image) # use skopeo copy return {}
class Rule_Set: def __init__(self): """Creates a single rule set for IP2 packets based on 10 fields. Args: - self: this index, the one to create. mandatory object reference. Returns: None. """ self.source_IP = {} self.dest_IP = {} self.source_Port = {} self.dest_Port = {} self.protocol = {} self.count = 0 def get_rules(self, filepath): with open(filepath) as file: for iteration, line in enumerate(file): line = line.split() self.handle_Source_IP(line[0], iteration) self.handle_Dest_IP(line[1], iteration) self.handle_Source_Port(line[2]+line[3]+line[4], iteration) self.handle_Dest_Port(line[5]+line[6]+line[7], iteration) self.handle_protocol(line[8], iteration) self.count = iteration def handle_Source_IP(self, IP, iteration): a, b, c, temp = IP[1:].split('.') temp = temp.split('/') d = temp[0] x = temp[1] IP = self.get_IP_int(int(a), int(b), int(c), int(d)) IP_bounds = self.get_IP_Bounds(IP, int(x)) self.source_IP[iteration] = [IP_bounds[0], IP_bounds[1]] def handle_Dest_IP(self, IP, iteration): a, b, c, temp = IP.split('.') temp = temp.split('/') d = temp[0] x = temp[1] IP = self.get_IP_int(int(a), int(b), int(c), int(d)) IP_bounds = self.get_IP_Bounds(IP, int(x)) self.dest_IP[iteration] = [IP_bounds[0], IP_bounds[1]] def handle_Source_Port(self, port, iteration): port = port.split(':') self.source_Port[iteration] = [int(port[0]), int(port[1])] def handle_Dest_Port(self, port, iteration): port = port.split(':') self.dest_Port[iteration] = [int(port[0]), int(port[1])] def handle_protocol(self, protocol, iteration): protocol = protocol.split('/') self.protocol[iteration] = [self.hex_to_int( protocol[0]), self.hex_to_int(protocol[1])] def get_IP_int(self, a, b, c, d): return d + (256 * c) + (65536 * b) + (16777216 * a) def get_IP_Bounds(self, value, x): LowerBound = value LowerBound = LowerBound >> (32 - x) LowerBound = LowerBound << (32 - x) Power = int(32 - x) UpperBound = LowerBound + pow(2, Power) - 1 return [LowerBound, UpperBound] def hex_to_int(self, value): return int(value, 16)
class Node: def __init__(self,key): self.left = None self.right = None self.val = key def printInorder(root): if root: printInorder(root.left) print(root.val), printInorder(root.right) def printPostorder(root): if root: printPostorder(root.left) printPostorder(root.right) print(root.val), def printPreorder(root): if root: print(root.val), printPreorder(root.left) printPreorder(root.right) root = Node(1) root.left = Node(2) root.right = Node(3) root.left.left = Node(4) root.left.right = Node(5) print ("Preorder traversal of binary tree is") printPreorder(root) print ("\nInorder traversal of binary tree is") printInorder(root) print ("\nPostorder traversal of binary tree is") printPostorder(root)
"""Example Sudoku problems and solutions.""" # keys of problems that are easy to solve by brute force # used by the tests TEST_KEYS = ['easy1', 'hard1', 'hard2', 'swordfish1'] # ##### Example Sudoku problems # Notes: # 1) 'swordfish1' requires the complicated swordfish manoeuver # http://www.sudokuoftheday.com/pages/techniques-9.php # 2) it takes a *long* time to 'minimal1' or 'minimal2' with # my brute-force solver sudoku_problems = {'easy1': [[0,0,3,7,0,0,0,5,0], [0,7,0,0,5,0,8,0,0], [1,0,0,0,0,6,0,0,4], [5,0,2,0,0,0,0,0,0], [8,0,0,9,0,4,0,0,6], [0,0,0,0,0,0,9,0,2], [3,0,0,5,0,0,0,0,7], [0,0,4,0,9,0,0,6,0], [0,2,0,0,0,7,4,0,0]], 'hard1': [[0,0,0,0,5,8,0,0,9], [5,0,8,3,0,0,0,0,6], [0,0,3,4,0,0,0,0,0], [7,0,0,0,0,4,3,5,0], [8,0,0,0,0,0,0,0,2], [0,4,1,5,0,0,0,0,8], [0,0,0,0,0,3,8,7,0], [0,0,0,0,0,5,0,0,0], [3,2,0,8,1,0,0,6,0]], 'hard2': [[5,0,1,2,8,0,0,0,0], [8,0,0,0,0,0,7,0,2], [2,0,0,0,0,0,1,8,5], [0,1,4,7,0,0,5,0,0], [0,0,0,4,0,0,0,2,0], [0,2,6,0,0,0,0,0,0], [1,0,0,0,3,6,0,0,0], [4,0,0,0,0,0,0,5,1], [6,0,0,0,4,1,0,0,0]], 'minimal1': [[0,0,0,0,0,0,0,1,0], [4,0,0,0,0,0,0,0,0], [0,2,0,0,0,0,0,0,0], [0,0,0,0,5,0,4,0,7], [0,0,8,0,0,0,3,0,0], [0,0,1,0,9,0,0,0,0], [3,0,0,4,0,0,2,0,0], [0,5,0,1,0,0,0,0,0], [0,0,0,8,0,6,0,0,0]], 'minimal2': [[2,0,0,4,0,8,0,0,0], [1,0,0,0,0,0,0,3,0], [0,0,0,0,0,0,0,0,0], [0,6,0,0,4,0,0,0,0], [0,0,0,2,0,0,0,5,0], [0,8,5,0,0,0,0,0,0], [0,0,0,1,0,0,2,0,0], [7,0,0,3,0,0,0,0,0], [0,0,0,0,0,0,5,0,8]], 'swordfish1': [[0,0,0,4,7,0,6,0,0], [0,0,4,0,0,0,3,0,5], [9,2,0,0,0,0,0,0,0], [0,3,1,0,0,0,0,0,0], [0,0,0,9,3,6,0,0,0], [0,0,0,0,0,0,2,8,0], [0,0,0,0,0,0,0,1,6], [4,0,8,0,0,0,9,0,0], [0,0,7,0,5,2,0,0,0]] } # ##### Solutions to problems sudoku_solutions = {'easy1': [[4,8,3,7,1,2,6,5,9], [2,7,6,4,5,9,8,1,3], [1,5,9,8,3,6,7,2,4], [5,9,2,6,7,3,1,4,8], [8,3,1,9,2,4,5,7,6], [6,4,7,1,8,5,9,3,2], [3,6,8,5,4,1,2,9,7], [7,1,4,2,9,8,3,6,5], [9,2,5,3,6,7,4,8,1 ]], 'hard1': [[4,6,2,7,5,8,1,3,9], [5,7,8,3,9,1,4,2,6], [9,1,3,4,6,2,5,8,7], [7,9,6,2,8,4,3,5,1], [8,3,5,1,7,9,6,4,2], [2,4,1,5,3,6,7,9,8], [1,5,9,6,2,3,8,7,4], [6,8,7,9,4,5,2,1,3], [3,2,4,8,1,7,9,6,5]], 'hard2': [[5,7,1,2,8,4,9,6,3], [8,6,3,1,9,5,7,4,2], [2,4,9,6,7,3,1,8,5], [3,1,4,7,6,2,5,9,8], [7,8,5,4,1,9,3,2,6], [9,2,6,3,5,8,4,1,7], [1,9,2,5,3,6,8,7,4], [4,3,8,9,2,7,6,5,1], [6,5,7,8,4,1,2,3,9]], 'minimal1': [[6,9,3,7,8,4,5,1,2], [4,8,7,5,1,2,9,3,6], [1,2,5,9,6,3,8,7,4], [9,3,2,6,5,1,4,8,7], [5,6,8,2,4,7,3,9,1], [7,4,1,3,9,8,6,2,5], [3,1,9,4,7,5,2,6,8], [8,5,6,1,2,9,7,4,3], [2,7,4,8,3,6,1,5,9]], 'swordfish1': [[3,1,5,4,7,9,6,2,8], [7,8,4,2,6,1,3,9,5], [9,2,6,5,8,3,1,4,7], [5,3,1,7,2,8,4,6,9], [8,4,2,9,3,6,5,7,1], [6,7,9,1,4,5,2,8,3], [2,5,3,8,9,4,7,1,6], [4,6,8,3,1,7,9,5,2], [1,9,7,6,5,2,8,3,4]] }
# Containers e Iteração # Acesso, Tamanho e Fatiamento nome='Diogo' # para acessar os itens(caracteres da string) nome[0] # retorna o D # len traz o comprimento da sequencia len(nome) # para acessar o último # tem de colocar o -1 para poder trazer o ultimo, # pois o indice começa de zero nome(len(nome) - 1) # na pratica o mais fácil ét razer o indice negativo nome[-1] nome[-2] # Slicing ou fatiamento nome[0:3] # do terceiro de tras para frente ao fim nome[-3:len(nome)] nome[-3:] # Do inicio ao quarto nome[:3] # para usar o terceiro parametro que seria o passo nome[:4:2] # vai de 0 a 4 pulando de dois em dois # inverter string nome[::-1] # começa de trás para frente # o mesmo serve para listas e tuplas lista = list(range(10)) lista[0] lista[:5] lista[::-1] len(lista)
with open("input.txt") as f: p1 = [] f.readline() line = f.readline() while line != "\n": p1.append(int(line.strip())) line = f.readline() f.readline() p2 = [] line = f.readline() while line != "": p2.append(int(line.strip())) line = f.readline() game_history = {} def serialize(hand): return ",".join(str(x) for x in hand) # returns 1 if p1 wins, 2 if p2 wins, 0 if p1 wins game immediately def play_round(p1, p2, game): entry = (serialize(p1), serialize(p2)) if entry in game_history[game]: return 0 game_history[game].add(entry) p1_card = p1.pop(0) p2_card = p2.pop(0) if len(p1) >= p1_card and len(p2) >= p2_card: round_winner = play_game(p1[:p1_card], p2[:p2_card], game+1) else: round_winner = 1 if p1_card > p2_card else 2 if round_winner == 1: p1.extend([p1_card, p2_card]) elif round_winner == 2: p2.extend([p2_card, p1_card]) return round_winner def play_game(p1, p2, game=0): game_history[game] = set() while len(p1) > 0 and len(p2) > 0: if play_round(p1, p2, game) == 0: return 1 return 1 if len(p1) > 0 else 2 winner = play_game(p1, p2) winner_hand = p2 if winner == 2 else p1 print(winner) print(p1) print(p2) print(sum(card * x for card, x in zip(winner_hand, range(len(winner_hand), 0, -1))))
nota1 = int(input("escriba la prmera nota de su alumno:")) nota2 = int(input("escriba la segunda nota de su alumno:")) nota3 = int(input("escriba la tercera nota de su alumno:")) nota4 = int(input("escriba la cuarta nota de su alumno:")) media = (nota1 + nota2 + nota3 + nota4) / 4 print(media) sapo = True while sapo == True: if media >= 15: print("Alumno con talento") sapo = False if media in range(12,15): print("Con capacidad") if media < 12: print("Debe reorientarse") sapo = False if media> 20: print("esto es imposible ha debido haber un error introduciendo las notas") sapo = False
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return an integer def minDepth(self, root): if root is None: return 0 # BFS queue1 = [] queue2 = [] queue1.append(root) queue2.append(1) while queue1: root = queue1.pop(0) depth = queue2.pop(0) if root.left is None and root.right is None: return depth if root.left is not None: queue1.append(root.left) queue2.append(depth + 1) if root.right is not None: queue1.append(root.right) queue2.append(depth + 1)
# Python - 3.6.0 Test.describe('Basic tests') Test.assert_equals(sequence_sum(2, 6, 2), 12) Test.assert_equals(sequence_sum(1, 5, 1), 15) Test.assert_equals(sequence_sum(1, 5, 3), 5) Test.assert_equals(sequence_sum(0, 15, 3), 45) Test.assert_equals(sequence_sum(16, 15, 3), 0) Test.assert_equals(sequence_sum(2, 24, 22), 26) Test.assert_equals(sequence_sum(2, 2, 2), 2) Test.assert_equals(sequence_sum(2, 2, 1), 2) Test.assert_equals(sequence_sum(1, 15, 3), 35) Test.assert_equals(sequence_sum(15, 1, 3), 0)
def test_atom_feed(app): app.get("/stream.atom") def test_rss_feed(app): app.get("/stream.rss")
"""Constants for integration_blueprint.""" # Base component constants NAME = "TuneBlade" DOMAIN = "tuneblade" DOMAIN_DATA = f"{DOMAIN}_data" VERSION = "0.0.5" ISSUE_URL = "https://github.com/spycle/tuneblade/issues" # Icons ICON = "mdi:cast-audio-variant" # Device classes MEDIA_PLAYER_DEVICE_CLASS = "speaker" # Platforms SWITCH = "switch" MEDIA_PLAYER = "media_player" PLATFORMS = [SWITCH, MEDIA_PLAYER] # Configuration and options CONF_ENABLED = "enabled" CONF_USERNAME = "username" CONF_PASSWORD = "password" CONF_AIRPLAY_PASSWORD = "airplay_password" CONF_DEVICE_ID = "device_id" CONF_HOST = "host" CONF_PORT = "port" # Defaults DEFAULT_NAME = DOMAIN STARTUP_MESSAGE = f""" ------------------------------------------------------------------- {NAME} Version: {VERSION} This is a custom integration! If you have any issues with this you need to open an issue here: {ISSUE_URL} ------------------------------------------------------------------- """
age = 12 if age < 4: print("Your admission cost is $0.") elif age < 18: print("Your admission cost is $25.") else: print("Your admission cost is $40.") age = 12 if age < 4: price = 0 elif age < 18: price = 25 print(f"Your admission cost is ${price}.") age = 12 if age < 4: price = 0 elif age < 18: price = 25 elif age < 65: price = 40 else: price = 20 print(f"Your admission cost is ${price}.") age = 12 if age < 4: price = 0 elif age < 18: price = 25 elif age < 65: price = 40 elif age >= 65: price = 20 print(f"Your admission cost is ${price}.")
class Aluno: def __init__(self, nome, email): self.nome = nome self.email = email def show_infos(self): print(f"Ola, me chamo {self.nome} meu email é: {self.email}") aluno_1 = Aluno("Cleber", "cleber@gmail.com") aluno_1.show_infos()
class Updated: def __init__(self, payload): self.tiers_added = payload['tiersAdded'] self.orb_count_diff = payload['orbCountDiff'] self.inventory_updates = payload['inventoryUpdates']
with open('arquivo.txt','r', encoding='utf-8') as arquivo: #Lê todo conteúdo como uma string conteudoTodo = arquivo.read() #Lê o arquivo de linha em linha umaLinha = arquivo.readline() #Lê todas as linhas de um arquivo todasLinhas = arquivo.readlines()
#2XX Success SUCESS_OK = 200 #4XX Error ERROR_BAD_REQUEST = 400 ERROR_UNAUTHORIZED = 401 ERROR_FORBIDDEN = 403 ERROR_NOT_FOUND = 404 #5xx ERROR_SERVER = 500
# desafio-005 num = int(input('Digite um número: ')) ante = num -1 sucess = num +1 print('O numero digitado é {} antecessor do numero é {} e o seu sucessor é {}'.format(num,ante,sucess))
s1 = "xyaabbbccccdefwwsadfhlgfdfhgskdghkdfzhgzjhgkdzhgfkxhgfkzhgkjfdhgizfghkzhgkzdhfgkz" s2 = "xxxxyyyyabklmopqdfaiusfghskjghsjkdgbsdkgjbsdgbskdkfbnsdkhsgb" # take 2 strings s1 and s2 including only letters from ato z. # Return a new sorted string, the longest possible, containing distinct letters def longest(s1, s2): s = sorted(set(s1 + s2)) return s
def fc(claim, s=None): suffix = ('-'+s) if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/claim/{1}'.format(suffix, claim) def fdlc(claim): return fc(claim, s='dl') def scope(scope, s=None): suffix = ('-'+s) if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/scope/{1}'.format(suffix, scope)
# Given a string, use recursion to output a list of all the possible permutations of a string # If a character is repeated, treat all versions as distinct # Itertools does permutations def permute(s): out = [] # Base case is when there is only one letter if len(s) < 2: out = [s] else: # For every letter in string for i, letter in enumerate(s): # For every permutation resultingfromstep2 a nd3 for perm in permute(s[:i] + s[i+1:]): # add it to the output out += [let+perm] return out s = "abc" print(permute(s))
# from https://github.com/peteboyd/lammps_interface.git ATOMIC_MASSES = { "H": 1.00794, "He": 4.002602, "Li": 6.941, "Be": 9.012182, "B": 10.811, "C": 12.0107, "N": 14.0067, "O": 15.9994, "F": 18.9984032, "Ne": 20.1797, "Na": 22.98976928, "Mg": 24.3050, "Al": 26.9815386, "Si": 28.0855, "P": 30.973762, "S": 32.065, "Cl": 35.453, "Ar": 39.948, "K": 39.0983, "Ca": 40.078, "Sc": 44.955912, "Ti": 47.867, "V": 50.9415, "Cr": 51.9961, "Mn": 54.938045, "Fe": 55.845, "Co": 58.933195, "Ni": 58.6934, "Cu": 63.546, "Zn": 65.38, "Ga": 69.723, "Ge": 72.64, "As": 74.92160, "Se": 78.96, "Br": 79.904, "Kr": 83.798, "Rb": 85.4678, "Sr": 87.62, "Y": 88.90585, "Zr": 91.224, "Nb": 92.90638, "Mo": 95.96, "Tc": 98, "Ru": 101.07, "Rh": 102.90550, "Pd": 106.42, "Ag": 107.8682, "Cd": 112.411, "In": 114.818, "Sn": 118.710, "Sb": 121.760, "Te": 127.60, "I": 126.90447, "Xe": 131.293, "Cs": 132.9054519, "Ba": 137.327, "La": 138.90547, "Ce": 140.116, "Pr": 140.90765, "Nd": 144.242, "Pm": 145, "Sm": 150.36, "Eu": 151.964, "Gd": 157.25, "Tb": 158.92535, "Dy": 162.500, "Ho": 164.93032, "Er": 167.259, "Tm": 168.93421, "Yb": 173.054, "Lu": 174.9668, "Hf": 178.49, "Ta": 180.94788, "W": 183.84, "Re": 186.207, "Os": 190.23, "Ir": 192.217, "Pt": 195.084, "Au": 196.966569, "Hg": 200.59, "Tl": 204.3833, "Pb": 207.2, "Bi": 208.98040, "Po": 209, "At": 210, "Rn": 222, "Fr": 223, "Ra": 226, "Ac": 227, "Th": 232.03806, "Pa": 231.03588, "U": 238.02891, "Np": 237, "Pu": 244, "Am": 243, "Cm": 247, "Bk": 247, "Cf": 251, "Es": 252, "Fm": 257, "Md": 258, "No": 259, "Lr": 262, "Rf": 265, "Db": 268, "Sg": 271, "Bh": 272, "Hs": 270, "Mt": 276, "Ds": 281, "Rg": 280, "Cn": 285, "Uut": 284, "Uuq": 289, "Uup": 288, "Uuh": 293, "Uuo": 294 }
# # pkpgcounter : a generic Page Description Language parser # # (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet <alet@librelogiciel.com> # This program 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 3 of the License, or # (at your option) any later version. # # This program 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, see <http://www.gnu.org/licenses/>. # # $Id: version.py 376 2007-12-09 20:32:26Z jerome $ # """This modules defines some important constants used in this software.""" __version__ = "3.50" __doc__ = """pkpgcounter : a generic Page Description Languages parser.""" __author__ = "Jerome Alet" __authoremail__ = "alet@librelogiciel.com" __years__ = "2003, 2004, 2005, 2006, 2007" __gplblurb__ = """This program 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 3 of the License, or (at your option) any later version. This program 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, see <http://www.gnu.org/licenses/>."""
""" Entradas --- Salidas: todos los numeros enteros impares menores que 100, sin contar multiplos de 7 Numeros --> int --> A """ # Caja negra A = 1 for i in range(50): if (A%7) != 0: print(A) # Salida A += 2 else: A += 2
#!/usr/bin/env python3 # DEKLARACE ZÁSTUPNÝCH PROMNĚNÝCH NULA=0 JEDNA=1 DVA=2 # Konec deklarace ''' Třída Polynomial pro zpracování ruzných polynomů, dle zadání ''' class Polynomial: ''' Definife funkce __INIT__, uprava dat pro další operace/funkce ''' def __init__(self, *args, **arg): # Definitce funkce __INIT__ self.polynom = [] # Deklarace if args: # podmínka na zjistění jestli byl vložen list if len(args) != NULA and type(args[NULA]) == list: self.polynom = args[NULA].copy() # pokud to je list a není nulový Tak se skopíruje hlubokou kopii else: [self.polynom.append(i) for i in args] # projetí všech hodnot a přidání hodnoty self.polynom if arg: # jestli že to není list for i in list(arg): # projetí všech klíču if arg[i] != NULA: # když se nerovná nule while len(self.polynom) <= (int(i[JEDNA:])): self.polynom.append(NULA) # projetí všech položek přidání hodnot self.polynom[int(i[JEDNA:])] = arg[i] # přidání zbytku a kontrola def __str__(self): ''' Funkce pro tisk která upravu výstupní data ''' vysledek = "" # deklarace if not len(self.polynom): return "0" # jestliže je pole nulové vrátí nulu for i, koefi in enumerate(reversed(self.polynom)): # projetí všech hodnot if koefi: # koeficiont if koefi < NULA: znam, koefi = (' - ' if vysledek else '- '), -koefi # jestli že je konficient záporný elif koefi > NULA: znam = (' + ' if vysledek else '') #jestli že je kladný str_koefi = '' if koefi == JEDNA and (len(self.polynom) - (i + JEDNA)) != NULA else str(koefi) if (len(self.polynom) - (i + JEDNA)) == NULA: str_mocnina = '' # jestliže je mocnina rovná nule elif (len(self.polynom) - (i + JEDNA)) == JEDNA: str_mocnina = 'x' # jestliže je mocnina rovná 1 else: str_mocnina = ('x' + '^' + str((len(self.polynom) - (i + JEDNA)))) # výpočet vysledek += (znam + str_koefi + str_mocnina) # výpočet return vysledek def __eq__(self, dalsi): ''' porovnání na zjištění velkosti ''' if type(dalsi) == Polynomial and self.polynom == dalsi.polynom: return True # podmínka jestli je to Polynomial a zd podmínka zda-li se rovnají return False def __add__(self, dalsi): ''' Přídání jednoho polinomu do ruhého nebo opačně dle délky ''' list = [] # deklarace listu if len(self.polynom) > len(dalsi.polynom): [dalsi.polynom.append(NULA) for i in range((len(self.polynom) - len(dalsi.polynom)))] # podmínka na zjistění velikosti, přidání hodnot do else: [self.polynom.append(NULA) for i in range((len(dalsi.polynom) - len(self.polynom)))] # přidání hodnot do [list.append(self.polynom[i] + dalsi.polynom[i]) for i in range(len(self.polynom))] # projetí a sloužení do jedného return Polynomial(list) # návrat list def __mul__(self, dalsi): ''' násobení polynomu a návrat jeho nové hodnoty ''' list = ([NULA] * ((len(self.polynom) + len(dalsi.polynom)) - JEDNA)) # vyvtoření pole for i in range(len(self.polynom)): # projetí 2x cyklu for j in range(len(dalsi.polynom)): list[i + j] += (self.polynom[i] * dalsi.polynom[j]) # naplnění pole vypočtem return Polynomial(list) # návrat listu def __pow__(self, mocnina): ''' projíždí je je mocnina a podle toho vykoná operaci nad daty v polinomu ''' if mocnina == NULA: return Polynomial(JEDNA) # jestli je mocnina =0, return 1 elif mocnina >= JEDNA: # porovnání jestli je mocnina větší než 0 if mocnina == JEDNA: return self # jestli je mocnina = 1, return to co přišlo do funkce else: vysledek = self # první číslo mocnina += JEDNA # upravení mocniy for i in range(DVA, mocnina): vysledek = (vysledek * self) # naplnění zbytkem čísel return vysledek # návrat hodnoty return NULA def derivative(self): ''' Funcke pro derivaci polynomu ''' derivace = [] # Deklarace listu pro výsldek [derivace.append((self.polynom[i] * i)) for i in range(JEDNA, len(self.polynom))] # Projetí pole od druhého indexu a zdeerivace u všech položek a návrat do listu return Polynomial(derivace) # Návrat po derivaci def at_value(self, *arg): ''' Funkce pro přidání hodnoty ''' hodnota =NULA # deklarace hodnota1=NULA # deklarace if len(arg) == JEDNA: # velikost argumentu == 1 for i in range(len(self.polynom)): hodnota += (self.polynom[i] * (arg[NULA] ** i)) # přiřazení všechn hodnot do listu return hodnota # návrat honoty elif len(arg) == DVA: # velikost argumentu == 2 for i in range(len(self.polynom)): # projetí pole hodnota += (self.polynom[i] * (arg[NULA] ** i)) # přiřazení do první hodnota1 += (self.polynom[i] * (arg[(NULA+JEDNA)] ** i)) # přiřazení do druhé return (hodnota1 - hodnota) # návrat rodílu else: return NULA # nevyhovující stav def test(): ''' Funkce pro otestování všech funkcí ve tříde Polynomial ''' assert str(Polynomial(0,1,0,-1,4,-2,0,1,3,0)) == "3x^8 + x^7 - 2x^5 + 4x^4 - x^3 + x" assert str(Polynomial([-5,1,0,-1,4,-2,0,1,3,0])) == "3x^8 + x^7 - 2x^5 + 4x^4 - x^3 + x - 5" assert str(Polynomial(x7=1, x4=4, x8=3, x9=0, x0=0, x5=-2, x3= -1, x1=1)) == "3x^8 + x^7 - 2x^5 + 4x^4 - x^3 + x" assert str(Polynomial(x2=0)) == "0" assert str(Polynomial(x0=0)) == "0" assert Polynomial(x0=2, x1=0, x3=0, x2=3) == Polynomial(2,0,3) assert Polynomial(x2=0) == Polynomial(x0=0) assert str(Polynomial(x0=1)+Polynomial(x1=1)) == "x + 1" assert str(Polynomial([-1,1,1,0])+Polynomial(1,-1,1)) == "2x^2" pol1 = Polynomial(x2=3, x0=1) pol2 = Polynomial(x1=1, x3=0) assert str(pol1+pol2) == "3x^2 + x + 1" assert str(pol1+pol2) == "3x^2 + x + 1" assert str(Polynomial(x0=-1,x1=1)**1) == "x - 1" assert str(Polynomial(x0=-1,x1=1)**2) == "x^2 - 2x + 1" pol3 = Polynomial(x0=-1,x1=1) assert str(pol3**4) == "x^4 - 4x^3 + 6x^2 - 4x + 1" assert str(pol3**4) == "x^4 - 4x^3 + 6x^2 - 4x + 1" assert str(Polynomial(x0=2).derivative()) == "0" assert str(Polynomial(x3=2,x1=3,x0=2).derivative()) == "6x^2 + 3" assert str(Polynomial(x3=2,x1=3,x0=2).derivative().derivative()) == "12x" pol4 = Polynomial(x3=2,x1=3,x0=2) assert str(pol4.derivative()) == "6x^2 + 3" assert str(pol4.derivative()) == "6x^2 + 3" assert Polynomial(-2,3,4,-5).at_value(0) == -2 assert Polynomial(x2=3, x0=-1, x1=-2).at_value(3) == 20 assert Polynomial(x2=3, x0=-1, x1=-2).at_value(3,5) == 44 pol5 = Polynomial([1,0,-2]) assert pol5.at_value(-2.4) == -10.52 assert pol5.at_value(-2.4) == -10.52 assert pol5.at_value(-1,3.6) == -23.92 assert pol5.at_value(-1,3.6) == -23.92 if __name__ == '__main__': test()
def func(): print('func') def func2(): print('func2') def func3(): print('func3') __all__ = ['func2', 'func3']
class BaseArray(Element, IDisposable): """ An abstract base class that represents an array within the Revit project. """ def Dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def getBoundingBox(self, *args): """ getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """ pass def GetCopiedMemberIds(self): """ GetCopiedMemberIds(self: BaseArray) -> ICollection[ElementId] Retrieves the copied member Ids of the Array. Returns: The copied member Ids of the Array """ pass def GetOriginalMemberIds(self): """ GetOriginalMemberIds(self: BaseArray) -> ICollection[ElementId] Retrieves the original member Ids of the Array. Returns: The original member Ids of the Array """ pass def ReleaseUnmanagedResources(self, *args): """ ReleaseUnmanagedResources(self: Element,disposing: bool) """ pass def setElementType(self, *args): """ setElementType(self: Element,type: ElementType,incompatibleExceptionMessage: str) """ pass def __enter__(self, *args): """ __enter__(self: IDisposable) -> object """ pass def __exit__(self, *args): """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass Label = property(lambda self: object(), lambda self, v: None, lambda self: None) """The family parameter label of the BaseArray. Get: Label(self: BaseArray) -> FamilyParameter Set: Label(self: BaseArray)=value """ Name = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get and Set the Name property Set: Name(self: BaseArray)=value """ NumMembers = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Retrieves or changes the number of the arrayed members. Get: NumMembers(self: BaseArray) -> int Set: NumMembers(self: BaseArray)=value """
""" Q701 Insert into a Binary Search Tree Medium Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into the BST. Return the root node of the BST after the insertion. It is guaranteed that the new value does not exist in the original BST. Note that there may exist multiple valid ways for the insertion, as long as the tree remains a BST after insertion. You can return any of them. """ # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode: def insert_(root, val): if root.left is None and root.right is None: if root.val > val: root.left = TreeNode(val) else: root.right = TreeNode(val) return None if root.val > val: if root.left is not None: insert_(root.left, val) else: root.left = TreeNode(val) else: if root.right is not None: insert_(root.right, val) else: root.right = TreeNode(val) return None insert_(root, val) return root a1 = TreeNode(1) a2 = TreeNode(2) a3 = TreeNode(3) a2.left = a1 a2.right = a3 sol = Solution() def preorder(tree): if tree is not None: print(tree.val) preorder(tree.left) preorder(tree.right) sol.insertIntoBST(a2, 4) preorder(a2)
__all__ = ('func', 'C') def func(): pass class C: pass
DBPEDIA_URI = "http://dbpedia.org/sparql" # dsbox02.isi.edu # ELASTICSEARCH_URI "http://kg2018a.isi.edu:9200/my_wiki_content_first/_search" # SPARQL_URI = "http://dsbox02.isi.edu:8888/bigdata/namespace/wdq/sparql" # IDENTIFIER_WIKIFIER = "http://minds03.isi.edu:4444/get_properties" # DataMachines Nov 2019 ELASTICSEARCH_URI = "http://10.108.20.4:9200/my_wiki_content_first/_search" SPARQL_URI = "http://10.108.20.4:9966/bigdata/namespace/wdq/sparql" IDENTIFIER_WIKIFIER = "http://10.108.20.4:9000/get_properties" # old # sparql = SPARQLWrapper("http://sitaware.isi.edu:8080/bigdata/namespace/wdq/sparql") # sparql = SPARQLWrapper("https://query.wikidata.org/sparql") # sparqldb = SPARQLWrapper("http://dbpedia.org/sparql")
""" Python Fundamentals 2 @author: Balint Szoke @date: 2/11/2017 """ """--------------------------------------------------- REVIEW ---------------------------------------------------""" # Assignment x = 3.14 # Strings s = 'this is a string' type(s) len(s) # Lists l = [1, 'help', 12.14] print('This is a', type(l), 'containing', len(l), 'items') #change types with str(), int(), float() #Methods 's is {t} with {c} chars'.format(t=type(s), c=len(s)) l.append(x) print(l) # Tab completion! #%% """--------------------------------------------------- OTHER NATIVE PYTHON DATA TYPES ---------------------------------------------------""" #==================== # Dictionary #==================== dict1 = {'first': 12, 'second': 20, 3: 'first'} print(dict1) type(dict1) # Unordered, access values through keys dict1['first'] dict1[3] # dict1[0] # indexing doesn't work #Key must be unique (only keeps last one) dict2 = {'first': 12, 'first': [4, 1]} print(dict2) # Key must be inmutable! What's the problem? #dict3 = {[1, 2]: 4} # Methods dict1.keys() dict1.values() list(dict1) list(dict1.values()) #========================== # Boolean (comparisons) #========================== # Yes/no questions 4 < 5 # interpreted as: is 5 greater than 4? x > 5 # can involve variables type(x > 5) z = x > 5 # True/False value can be assigned # Basic comparison operators x == 3 # equal to? 5 >= 5 # greater than or equal to? x != 3 # not equal to? # True == 1, False == 0 int(z) # can reverse comparisons with "not" not 3 > 5 # Use it the usual way x, y = 4*2, 2**3 "x={x}, y={y}, so x>y is {s}".format(x=x, y=y, s=x>y) type('Sarah') == str # can involve "type checking" len('Sarah') >= 3 # Tricky one name1 = 'Chase' name2 = 'Spencer' name1 > name2 name1 < name2 # what's going on? try 'a' < 'b' # Handy alternatives: "is" and "is not" x is y # "equal to"? x is not y # Clear syntax 1 in [1, 4, 5] 3 not in [1, 4, 5] # Standard Boolean logic to combine comparisons print(True and True, True and False, False and False) print(True or True, True or False, False or False) #%% """--------------------------------------------------- SLICING : access a range of items from a container ---------------------------------------------------""" x = [4, 1, 5, 2, 10, 23] x[3] # indexing x[:3] # everything to the left (3 NOT included) x[3:] # everything to the right (3 included) x[1:4] """ Rule: x[n_start:n_end] gives [x[n_start], x[n_start + 1], ..., x[n_end-1]] """ # Counting backward x[-1] # last element x[-2] # second to last x[2:-2] # combined # not only lists name = 'python' # how to get 'py' from name? name[:2] #%% """=================================================== FLOW CONTROL control which commands are executed and the order in which they are processed ===================================================""" """--------------------------------------------------- (1) CONDITIONALS (if and else) tell Python to do things depending on the value of a Boolean ---------------------------------------------------""" this = True if this is True: # don't forget the colon print("hello") # don't forget the indentation that = False #that = 5 # careful with negation! if that is not True: print("bye") # Indentation inticates an "inner code" x = 2 if x > 0: x = x + 1 x = x * 5 print(x) """ Structure matters! different branches """ x = 2 if x > 0: # first branch starts here print(x) x = x + 1 print(x) if x < 5: # conditional second branch starts here print(x) x = x * 5 x = x**3 # second branch ends here print(x) # back to the first branch # ELSE - what to do if the condition is false if this is True: print('this is true') else: print('this is false') # ELIF - add more branches to the decision tree if x < 2: print("x < 2") elif x == 2: print("x == 2") else: print("x > 2") '''--------------------------------------------------- (2) Loops (over containers): do the same thing many times ---------------------------------------------------''' # Print out list of names one at a time namelist = ['Chase', 'Anne', 'Josh', 'Alberto'] for i in namelist: print(i) """ Iterables: def: An object capable of returning its members one at a time. e.g.: list, str, tuple, dict """ for i in "hello": print(i) ''' i is just a dummy! It can be anything, but be careful with using already defined var names ''' x = 5 print('before the loop x is', x) for x in '01234': print('in the loop, x is', int(x)) print('after the loop x is', x) # Compute the sum of the elements of a list of nums numlist = [-2, 3.1, 10, 23] summ = 0 for i in numlist: summ = summ + i print(summ) #================================================= # Loops over counters # loop over something a fixed number of times #================================================= how_many = 10 for i in range(how_many): print("boring") # or we can use the elements of range() # range(n) gives all integers from 0 to n-1 for i in range(5): print(i) # different starting point for i in range(2, 8): print(i) # print the squares of integers up to 10 for number in range(10): square = number**2 print('Number and its square:', number, square) # combine loop with conditional for num in range(10): if num > 5: print(num) # we might want to break the loop if something happens maxnum = 20 total = 0 for num in range(maxnum): total = total + num if total > 100: break # exit loop print('At num =', num, 'we had total =', total) #========================================== # List comprehensions = # create list using implicit loops #========================================== # Compare for item in namelist: print(item.upper()) #with [item2.upper() for item2 in namelist] # list comprehension with condition fruits = ['apple', 'banana', 'orange'] fruits6 = [i for i in fruits if len(i)>=6] print(fruits6) #%% '''================================================== DEFINING OUR OWN FUNCTIONS ==================================================''' #-------------------------- # Function with no output #-------------------------- def hello(firstname): print("Hello,", firstname) hello('Balint') def silly(): print("the same") #-------------------------------------------------------- # Function creates a new value that Python can work with # RETURN - sends output back to the main program #-------------------------------------------------------- def square_me(number): """ Takes numerical input and returns its square """ square = number**2 return square #Test square_me(7) def nextyear(string_year): """ Takes a string year and returns a string of next year """ int_year = int(string_year) next_year = int_year + 1 return str(next_year) nextyear('2016') # use it just like the built-in functions for i in range(2010, 2016): year = str(i) next_year = nextyear(year) print('year is', year, 'Next year is', next_year)
class Config(object): c_dim = 5 c2_dim = 8 celeba_crop_size = 178 rafd_crop_size = 256 image_size = 128 g_conv_dim = 64 d_conv_dim = 64 g_repeat_num = 6 d_repeat_num = 6 lambda_cls = 1 lambda_rec = 10 lambda_gp = 10 dataset = 'CelebA' batch_size = 16 num_iters = 200000 num_iters_decay = 100000 g_lr = 0.0001 d_lr = 0.0001 n_critic = 5 beta1 = 0.5 beta2 = 0.999 resume_iters = None selected_attrs = ['Black_Hair', 'Blond_Hair', 'Brown_Hair', 'Male', 'Young'] # Test configuration. test_iters = 200000 # Miscellaneous. num_workers = 1 mode = 'train' use_tensorboard = True # Directories. celeba_image_dir = 'data/CelebA_nocrop/images' attr_path = 'data/list_attr_celeba.txt' rafd_image_di = 'data/RaFD/train' log_dir = 'stargan/logs' model_save_dir = 'stargan/models' sample_dir = 'stargan/samples' result_dir = 'stargan/results' # Step size. log_step = 10 sample_step = 1000 model_save_step = 10000 lr_update_step = 1000 config = Config()
""" This package contains exceptions that may be raised by the CHARMM components of the OpenMM Application layer This file is part of the OpenMM molecular simulation toolkit originating from Simbios, the NIH National Center for Physics-Based Simulation of Biological Structures at Stanford, funded under the NIH Roadmap for Medical Research, grant U54 GM072970. See https://simtk.org. This code was originally part of the ParmEd program and was ported for use with OpenMM. Copyright (c) 2014 the Authors Author: Jason M. Swails Contributors: Date: April 18, 2014 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ class CharmmError(Exception): """ Base class for all exceptions raised in this package """ class CharmmWarning(Warning): """ Base class for all warnings emitted in this package """ class CharmmPSFError(CharmmError): """ If there is a problem parsing CHARMM PSF files """ class CharmmPsfEOF(CharmmError): """ Raised when the end-of-file is reached on a CHARMM PSF file """ class SplitResidueWarning(CharmmWarning): """ For if a residue with the same number but different names is split """ class ResidueError(CharmmError): """ For when there are problems defining a residue """ class CharmmPSFWarning(CharmmWarning): """ For non-fatal PSF parsing issues """ class CharmmFileError(CharmmError): """ If there is a problem parsing CHARMM files """ class MissingParameter(CharmmError): """ If a parameter is missing from a database """ class CmapError(CharmmError): """ For an error arising from CMAP grid incompatibilities """ class BondError(CharmmError): """ Prevent an atom from bonding to itself """ class MoleculeError(CharmmError): """ For (impossibly) messed up connectivity """
li = input().split() dicti={} for i in li: if i not in dicti: dicti[i]=1 else: print(i)
# N개의 정수가 주어질때, 각 정수 M에 대하여 1부터 M까지의 합의 제곱과 각각의 제곱의 합과의 차를 구하시오 # Given N integers, for each integer M, find the difference between the sum of squares of the first M natural numbers and the square of the sum. for _ in range(int(input())): n = int(input()) sum_of_squares = n*(n+1)*(2*n+1) // 6 square_of_sum = (n*(n+1)//2)**2 print(square_of_sum-sum_of_squares)
formatter = "{} {} {} {}" #this gives 4 empty slots in the formatter variable print(formatter.format(1, 2, 3, 4)) #this fill the slots with 1234 print(formatter.format("one", "two", "three", "four")) #this fills the slots with one two three four print(formatter.format(True, False, False, True)) #this fills the slots with true false false true print(formatter.format(formatter, formatter, formatter, formatter)) #this calls the variable 4 times but does not fill, so 16 {} show up print(formatter.format( "Try your", "Own text here", "Maybe a poem", "Or a song about fear" )) #this calls up four different strings to fill the slots in the variable
class LavadoraFacade(object): def lavar(self): self._lavar = Lavar() self._lavar.subsistema_operation() def enjuagar(self): self._enjuagar = Enjuagar() self._enjuagar.subsistema_operation() def centrifugado(self): self._centrifugado = Centrifugado() self._centrifugado.subsistema_operation() def ciclo_completo(self): self._ciclo_completo = Completo() self._ciclo_completo.subsistema_operation() class Lavar(object): def subsistema_operation(self): print("Lavando...\nFinalizado!") class Enjuagar(object): def subsistema_operation(self): print("Enjuagando...\nFinalizado!") class Centrifugado(object): def subsistema_operation(self): print("Centrifugando...\nFinalizado!") class Completo(object): def subsistema_operation(self): print ("Lavando...\nEnjuagando...\nCentrifugando...\nFinalizado!") if __name__ == "__main__": print(LavadoraFacade().ciclo_completo())
#Given an array of integers, find and print the maximum number of integers you #can select from the array such that the absolute difference between any two of #the chosen integers is less than or equal to . For example, if your array is , #you can create two subarrays meeting the criterion: and . The maximum length #subarray has elements. list = input().split() list = [int(i) for i in list] list.sort() print(list) def pickingNumbers(list): # Write your code here maximum = [] maxim = 0 while len(list) > 1: if len(list) != 0: A = max(list) count_max = list.count(A) for j in range(count_max): list.remove(max(list)) maxim += count_max if len(list) == 0 and len(maximum) == 0: return count_max if len(list) != 0: B = max(list) count_max = list.count(B) maxim += count_max check = abs(A - B) if check <= 1: maximum.append(maxim) maxim = 0 return max(maximum) print(pickingNumbers(list))
# Python lists can be used as Arrays in Python # Creating an array things = ['pen', 'car', 'books'] print(things) # accessing the array element print(things[0]) # prints the first element of the array things # modifying the value of the array element things[1] = 'pencil' # second element of things, gets changed to pencil print(things[1]) # length/size of the array length = len(things) print(length) # length variable holds the size of the array which is in this case, 3 # looping through the array/lists for a in things: # iterating over each element of the array print(a) for i in range(len(things)): # iterating the variable i upto the length of array print(things[i]) # and then accessing the array element present at index i
def isDivisibleBy(int, divisor): return int % divisor == 0; def doFizzBuzz(): for i in range(1, 101): isDivisibleByThree = isDivisibleBy(i, 3) isDivisibleByFive = isDivisibleBy(i, 5) if (isDivisibleByThree and isDivisibleByFive): print('fizzbuzz') elif isDivisibleByThree: print('fizz') elif isDivisibleByFive: print('buzz') else: print(i) doFizzBuzz()
# -*- coding: utf-8 -*- """ Created on Thu Nov 21 15:38:43 2019 @author: Mijael """ vnclass_dict = { 'stop-55.4': ['causer', 'theme', 'location'], 'masquerade-29.6': ['agent', 'attribute', 'location'], 'masquerade-29.6-1': ['agent', 'attribute', 'location'], 'masquerade-29.6-2': ['agent', 'attribute', 'location'], 'captain-29.8': ['agent', 'beneficiary', 'location'], 'captain-29.8-1': ['agent', 'beneficiary', 'location'], 'captain-29.8-1-1': ['agent', 'beneficiary', 'location'], 'preparing-26.3': ['agent', 'product', 'material', 'beneficiary', 'location'], 'defend-72.3': ['agent', 'beneficiary', 'theme', 'location'], 'help-72.1': ['agent', 'beneficiary', 'theme', 'location'], 'help-72.1-1': ['agent', 'beneficiary', 'theme', 'location'], 'help-72.1-1-1': ['agent', 'beneficiary', 'theme', 'location'], 'help-72.1-2': ['agent', 'beneficiary', 'theme', 'location'], 'interact-36.6': ['agent', 'co_agent', 'location'], 'marry-36.2': ['agent', 'co_agent', 'location'], 'meet-36.3': ['agent', 'co_agent', 'location'], 'meet-36.3-1': ['agent', 'co_agent', 'location'], 'meet-36.3-2': ['agent', 'co_agent', 'location'], 'subordinate-95.2.1': ['agent', 'co_agent', 'location'], 'supervision-95.2.2': ['agent', 'co_agent', 'location'], 'cooperate-73.1': ['agent', 'co_agent', 'theme', 'location'], 'cooperate-73.1-1': ['agent', 'co_agent', 'theme', 'location'], 'cooperate-73.1-2': ['agent', 'co_agent', 'theme', 'location'], 'cooperate-73.1-3': ['agent', 'co_agent', 'theme', 'location'], 'correspond-36.1.1': ['agent', 'co_agent', 'topic', 'location'], 'correspond-36.1.1-1': ['agent', 'co_agent', 'topic', 'location'], 'correspond-36.1.1-1-1': ['agent', 'co_agent', 'topic', 'location'], 'conspire-71': ['agent', 'co_agent', ['theme', 'beneficiary'], 'location'], 'battle-36.4': ['agent', 'co_agent', ['theme', 'topic'], ['location']], 'battle-36.4-1': ['agent', 'co_agent', ['theme', 'topic'], ['location']], 'settle-36.1.2': ['agent', 'co_agent', ['topic', 'goal'], 'location'], 'settle-36.1.2-1': ['agent', 'co_agent', ['topic', 'goal'], 'location'], 'butter-9.9': ['agent', 'destination', 'theme', 'initial_location', 'trajectory', 'location'], 'fill-9.8': ['agent', 'destination', 'theme', 'initial_location', 'trajectory', 'location'], 'fill-9.8-1': ['agent', 'destination', 'theme', 'initial_location', 'trajectory', 'location'], 'spend_time-104': ['agent', 'duration', 'attribute', 'location'], 'touch-20': ['agent', 'theme', 'experiencer', 'instrument', 'location'], 'touch-20-1': ['agent', 'theme', 'experiencer', 'instrument', 'location'], 'assuming_position-50': ['agent', 'location'], 'gobble-39.3': ['agent', 'patient', 'location'], 'hiccup-40.1.1': ['agent', 'location'], 'snooze-40.4': ['agent', 'location'], 'concealment-16': ['agent', 'patient', 'beneficiary', 'location'], 'concealment-16-1': ['agent', 'patient', 'beneficiary', 'location'], #'tape-22.4-1': ['agent', 'patient', 'co_patient', 'instrument', 'location'], 'hit-18.1': ['agent', 'patient', 'co_patient', 'instrument', 'result', 'location'], 'tape-22.4': ['agent', 'patient', 'co_patient', 'instrument', 'result', 'location'], 'amalgamate-22.2': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-1': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-1-1': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-2': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-2-1': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-3': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-3-1': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-3-1-1': ['agent', 'patient', 'co_patient', 'location'], 'amalgamate-22.2-3-2': ['agent', 'patient', 'co_patient', 'location'], 'disassemble-23.3': ['agent', 'patient', 'co_patient', 'location'], 'mix-22.1': ['agent', 'patient', 'co_patient', 'location'], 'mix-22.1-1': ['agent', 'patient', 'co_patient', 'location'], 'mix-22.1-1-1': ['agent', 'patient', 'co_patient', 'location'], 'mix-22.1-2': ['agent', 'patient', 'co_patient', 'location'], 'mix-22.1-2-1': ['agent', 'patient', 'co_patient', 'location'], 'separate-23.1': ['agent', 'patient', 'co_patient', 'location'], 'separate-23.1-1': ['agent', 'patient', 'co_patient', 'location'], 'separate-23.1-2': ['agent', 'patient', 'co_patient', 'location'], 'shake-22.3': ['agent', 'patient', 'co_patient', 'location'], 'shake-22.3-1': ['agent', 'patient', 'co_patient', 'location'], 'shake-22.3-1-1': ['agent', 'patient', 'co_patient', 'location'], 'shake-22.3-2': ['agent', 'patient', 'co_patient', 'location'], 'shake-22.3-2-1': ['agent', 'patient', 'co_patient', 'location'], 'split-23.2': ['agent', 'patient', 'co_patient', 'location'], 'adjust-26.9': ['agent', 'patient', 'goal', 'source', 'location'], 'swat-18.2': ['agent', 'patient', 'instrument', 'result', 'location'], 'bend-45.2': ['agent', 'patient', 'instrument', 'location'], 'carve-21.2': ['agent', 'patient', 'instrument', 'location'], 'carve-21.2-1': ['agent', 'patient', 'instrument', 'location'], 'carve-21.2-2': ['agent', 'patient', 'instrument', 'location'], 'cooking-45.3': ['agent', 'patient', 'instrument', 'location'], 'cut-21.1-1': [['agent', 'causer'], 'patient', 'experiencer', 'instrument', 'movement', 'location'], 'destroy-44': ['agent', 'patient', 'instrument', 'location'], 'floss-41.2.1': ['agent', 'patient', 'instrument', 'final_state', 'location'], 'hit-18.1-1': ['agent', 'patient', 'instrument', 'location'], 'murder-42.1': ['agent', 'patient', 'instrument', 'location'], 'murder-42.1-1': ['agent', 'patient', 'instrument', 'location'], 'other_cos-45.4': ['agent', 'patient', 'instrument', 'result', 'final_state', 'location'], 'remedy-45.7': ['agent', 'patient', 'instrument', 'result', 'final_state', 'location'], 'remedy-45.7-1': ['agent', 'patient', 'instrument', 'result', 'final_state', 'location'], 'subjugate-42.3': ['agent', 'patient', 'instrument', 'location'], 'break-45.1': ['agent', 'patient', 'instrument', 'result', 'final_state', 'location'], 'poison-42.2': ['agent', 'patient', 'instrument', 'result', 'location'], 'spank-18.3': ['agent', 'patient', 'instrument', 'result', 'location'], 'cut-21.1': ['agent', 'patient', 'instrument', 'source', ['goal', 'result'], 'movement', 'location'], 'attack-60.1': ['agent', 'patient', 'location'], 'attack-60.1-1': ['agent', 'patient', 'location'], 'birth-28.2': ['agent', 'patient', 'location'], 'birth-28.2-1': ['agent', 'patient', 'location'], 'body_internal_motion-49.1': ['agent', 'patient', 'location'], 'braid-41.2.2': ['agent', 'patient', 'final_state', 'location'], 'calve-28.1': ['agent', 'patient', 'location'], 'chew-39.2': ['agent', 'patient', 'location'], 'chew-39.2-1': ['agent', 'patient', 'location'], 'chew-39.2-2': ['agent', 'patient', 'location'], 'dine-39.5': ['agent', 'patient', 'location'], 'dress-41.1.1': ['agent', 'patient', 'location'], 'dressing_well-41.3.2': [['agent', 'patient'], 'location'], 'eat-39.1-3': ['agent', 'patient', 'location'], 'gobble-39.3-1': ['agent', 'patient', 'location'], 'gobble-39.3-2': ['agent', 'patient', 'location'], 'gorge-39.6': ['agent', 'patient', 'location'], 'groom-41.1.2': ['agent', 'patient', 'location'], 'urge-58.1': ['agent', 'patient', 'result', 'location'], 'void-106': ['agent', 'patient', 'result', 'location'], 'coloring-24': ['agent', 'patient', 'material', 'result', 'location'], 'compel-59.1': ['agent', 'patient', 'predicate', 'location'], 'lure-59.3': ['agent', 'patient', 'predicate', 'location'], 'stimulate-59.4': ['agent', 'patient', 'predicate', 'location'], 'grow-26.2.1': ['agent', 'patient', 'product', 'location'], 'rear-26.2.2': ['agent', 'patient', 'product', 'location'], 'rear-26.2.2-1': ['agent', 'patient', 'product', 'location'], 'turn-26.6.1': ['agent', 'patient', 'result', 'initial_state', 'location'], 'turn-26.6.1-1': ['agent', 'patient', 'result', 'initial_state', 'location'], 'beg-58.2': ['agent', 'patient', 'result', 'location'], 'beg-58.2-1': ['agent', 'patient', 'result', 'location'], 'beg-58.2-1-1': ['agent', 'patient', 'result', 'location'], 'bully-59.5': ['agent', 'patient', 'result', 'location'], 'order-58.3': ['agent', 'patient', 'result', 'location'], 'order-58.3-1': ['agent', 'patient', 'result', 'location'], 'other_cos-45.4-1': ['agent', 'patient', 'result', 'location'], 'suffocate-40.7': ['agent', 'patient', 'result', 'location'], 'render-29.90-1': ['agent', 'patient', 'result', 'source', 'location'], 'render-29.90-2': ['agent', 'patient', 'result', 'source', 'location'], 'devour-39.4': ['agent', 'patient', 'source', 'location'], 'eat-39.1': ['agent', 'patient', 'source', 'location'], 'eat-39.1-1': ['agent', 'patient', 'source', 'location'], 'eat-39.1-2': ['agent', 'patient', 'source', 'location'], 'prosecute-33.2-1': ['agent', 'patient', 'theme', 'attribute', 'location'], 'prosecute-33.2': ['agent', 'patient', 'theme', 'location'], 'trick-59.2': ['agent', 'patient', ['predicate', 'result'], 'location'], 'convert-26.6.2-1-1': ['agent', 'patient', ['result', 'goal'], 'initial_state', 'location'], 'urge-58.1-1': ['agent', 'patient', ['topic', 'result'], 'location'], 'urge-58.1-1-1': ['agent', 'patient', ['topic', 'result'], 'location'], 'act-114': ['agent', 'predicate', 'location'], 'act-114-1': ['agent', 'predicate', 'location'], 'act-114-1-1': ['agent', 'predicate', 'location'], 'preparing-26.3-1': ['agent', 'product', 'material', 'beneficiary', 'location'], 'preparing-26.3-2': ['agent', 'product', 'material', 'beneficiary', 'location'], 'build-26.1': ['agent', 'product', 'material', 'asset', 'beneficiary', 'location'], 'build-26.1-1': ['agent', 'product', 'material', 'asset', 'beneficiary', 'location'], 'knead-26.5': ['agent', 'product', 'material', 'location'], 'bill-54.5': ['agent', 'recipient', 'asset', 'location'], 'animal_sounds-38': ['agent', 'recipient', 'theme', 'location'], 'create-26.4-1': ['agent', 'result', 'beneficiary', 'location'], 'create-26.4': ['agent', 'result', 'material', 'beneficiary', 'location'], 'create-26.4-1-1': ['agent', 'result', 'material', 'beneficiary', 'location'], 'resign-10.11': ['agent', 'source', 'goal', 'location'], 'resign-10.11-1': ['agent', 'source', 'goal', 'location'], 'resign-10.11-2': ['agent', 'source', 'goal', 'location'], 'withdraw-82': ['agent', 'source', 'location'], 'withdraw-82-1': ['agent', 'source', 'location'], 'withdraw-82-2': ['agent', 'source', 'location'], 'withdraw-82-3': ['agent', 'source', 'location'], 'substance_emission-43.4-1-1': ['agent', 'source', 'theme', 'location'], 'assessment-34.1': ['agent', 'theme', 'attribute', 'location'], 'characterize-29.2': ['agent', 'theme', 'attribute', 'location'], 'characterize-29.2-1': ['agent', 'theme', 'attribute', 'location'], 'characterize-29.2-1-1': ['agent', 'theme', 'attribute', 'location'], 'characterize-29.2-1-2': ['agent', 'theme', 'attribute', 'location'], 'consider-29.9': ['agent', 'theme', 'attribute', 'location'], 'consider-29.9-1': ['agent', 'theme', 'attribute', 'location'], 'consider-29.9-1-1': ['agent', 'theme', 'attribute', 'location'], 'consider-29.9-1-1-1': ['agent', 'theme', 'attribute', 'location'], 'consider-29.9-2': ['agent', 'theme', 'attribute', 'location'], 'hire-13.5.3': ['agent', 'theme', 'attribute', 'location'], 'judgment-33.1': ['agent', 'theme', 'attribute', 'location'], 'judgment-33.1-1': ['agent', 'theme', 'attribute', 'location'], 'judgment-33.1-1-1': ['agent', 'theme', 'attribute', 'location'], 'pronounce-29.3.1': ['agent', 'theme', 'attribute', 'location'], 'suspect-81': ['agent', 'theme', 'attribute', 'location'], 'sustain-55.6-1': ['agent', 'theme', 'attribute', 'location'], 'volunteer-95.4-1': ['agent', 'theme', 'attribute', 'location'], 'register-54.1-1': ['agent', 'theme', 'attribute', 'value', 'location'], 'allow-64.1': ['agent', 'theme', 'beneficiary', 'location'], 'allow-64.1-1': ['agent', 'theme', 'beneficiary', 'location'], 'conduct-111.1': ['agent', 'theme', 'beneficiary', 'location'], 'forbid-64.4': ['agent', 'theme', 'beneficiary', 'location'], 'forbid-64.4-1': ['agent', 'theme', 'beneficiary', 'location'], 'let-64.2': ['agent', 'theme', 'beneficiary', 'location'], 'performance-26.7': ['agent', 'theme', 'beneficiary', 'location'], 'performance-26.7-1': ['agent', 'theme', 'beneficiary', 'location'], 'employment-95.3': ['agent', 'theme', 'co_agent', 'attribute', 'location'], 'play-114.2': ['agent', 'theme', 'co_agent', 'location'], 'play-114.2-1': ['agent', 'theme', 'co_agent', 'location'], 'work-73.2': ['agent', 'theme', 'co_agent', 'location'], 'correlate-86.1': ['agent', 'theme', 'co_theme', 'location'], 'herd-47.5.2': ['agent', 'theme', 'co_theme', 'location'], 'multiply-108': ['agent', 'theme', 'co_theme', 'location'], 'multiply-108-1': ['agent', 'theme', 'co_theme', 'location'], 'multiply-108-2': ['agent', 'theme', 'co_theme', 'location'], 'multiply-108-3': ['agent', 'theme', 'co_theme', 'location'], 'carry-11.4': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'carry-11.4-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'carry-11.4-1-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'coil-9.6': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'confine-92': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'confine-92-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'drive-11.5': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'drive-11.5-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'funnel-9.3': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'funnel-9.3-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'funnel-9.3-1-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'pelt-17.2': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'pocket-9.10': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'pocket-9.10-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'put-9.1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'put-9.1-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'put-9.1-2': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'put_direction-9.4': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'put_spatial-9.2': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'send-11.1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'send-11.1-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'slide-11.2-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'spray-9.7': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'spray-9.7-1': ['agent', 'theme', 'destination', 'initial_location', 'location'], 'accompany-51.7': ['agent', 'theme', 'destination', 'initial_location', 'trajectory', 'location'], 'nonvehicle-51.4.2': ['agent', 'theme', 'destination', 'initial_location', 'trajectory', 'location'], 'run-51.3.2-2-1': ['agent', 'theme', 'destination', 'initial_location', 'trajectory', 'location'], 'slide-11.2': ['agent', 'theme', 'destination', 'initial_location', 'trajectory', 'location'], 'illustrate-25.3': ['agent', 'theme', 'destination', 'location'], 'image_impression-25.1': ['agent', 'theme', 'destination', 'location'], 'scribble-25.2': ['agent', 'theme', 'destination', 'location'], 'scribble-25.2-1': ['agent', 'theme', 'destination', 'location'], 'spray-9.7-1-1': ['agent', 'theme', 'destination', 'location'], 'spray-9.7-2': ['agent', 'theme', 'destination', 'location'], 'transcribe-25.4': ['agent', 'theme', 'destination', 'location'], 'pit-10.7': ['agent', 'theme', 'destination', 'source', 'location'], 'rotate-51.9.1-1': ['agent', 'theme', 'extent', 'initial_location', 'location'], 'classify-29.10': ['agent', 'theme', 'goal', 'location'], 'dedicate-79': ['agent', 'theme', 'goal', 'location'], 'exclude-107.3': ['agent', 'theme', 'goal', 'location'], 'exclude-107.3-1': ['agent', 'theme', 'goal', 'location'], 'involve-107.1': ['agent', 'theme', 'goal', 'location'], 'body_motion-49.2': ['agent', 'theme', 'goal', 'path', 'location'], 'body_motion-49.2-1': ['agent', 'theme', 'goal', 'path', 'location'], 'push-12-1-1': ['agent', 'theme', 'goal', 'source', 'trajectory', 'location'], 'wipe_instr-10.4.2': ['agent', 'theme', 'initial_location', 'destination', 'instrument', 'result', 'location'], 'pour-9.5': ['agent', 'theme', 'initial_location', 'destination', 'location'], 'wipe_instr-10.4.2-1': ['agent', 'theme', 'initial_location', 'destination', 'location'], 'chase-51.6': ['agent', 'theme', 'initial_location', 'destination', 'trajectory', 'location'], 'vehicle_path-51.4.3': ['agent', 'theme', 'initial_location', 'destination', 'trajectory', 'location'], 'distinguish-23.5': ['agent', 'theme', 'instrument', 'co_theme', 'location'], 'distinguish-23.5-1': ['agent', 'theme', 'instrument', 'co_theme', 'location'], 'begin-55.1': ['agent', 'theme', 'instrument', 'location'], 'begin-55.1-1-1': ['agent', 'theme', 'instrument', 'location'], 'confront-98': ['agent', 'theme', 'instrument', 'location'], 'establish-55.5-1': ['agent', 'theme', 'instrument', 'location'], 'satisfy-55.7': ['agent', 'theme', 'instrument', 'location'], 'support-15.3': ['agent', 'theme', 'instrument', 'location'], 'support-15.3-1': ['agent', 'theme', 'instrument', 'location'], 'sustain-55.6': ['agent', 'theme', 'instrument', 'location'], 'accept-77.1': ['agent', 'theme', 'location'], 'admit-64.3': ['agent', 'theme', 'location'], 'admit-64.3-1': ['agent', 'theme', 'location'], 'adopt-93': ['agent', 'theme', 'location'], 'begin-55.1-1': ['agent', 'theme', 'location'], 'being_dressed-41.3.3': ['agent', 'theme', 'location'], 'breathe-40.1.2-1': ['agent', 'theme', 'location'], 'caring-75.2': ['agent', 'theme', 'location'], 'caring-75.2-1': ['agent', 'theme', 'location'], 'caring-75.2-1-1': ['agent', 'theme', 'location'], 'caring-75.2-2': ['agent', 'theme', 'location'], 'complete-55.2': ['agent', 'theme', 'location'], 'complete-55.2-1': ['agent', 'theme', 'location'], 'cope-83': ['agent', 'theme', 'location'], 'cope-83-1': ['agent', 'theme', 'location'], 'cope-83-1-1': ['agent', 'theme', 'location'], 'declare-29.4-1-1': ['agent', 'theme', 'location'], 'declare-29.4-1-1-1': ['agent', 'theme', 'location'], 'declare-29.4-1-1-2': ['agent', 'theme', 'location'], 'declare-29.4-1-1-3': ['agent', 'theme', 'location'], 'declare-29.4-2': ['agent', 'theme', 'location'], 'enforce-63': ['agent', 'theme', 'location'], 'establish-55.5': ['agent', 'theme', 'location'], 'hold-15.1': ['agent', 'theme', 'location'], 'hunt-35.1': ['agent', 'theme', 'location'], 'investigate-35.4': ['agent', 'theme', 'location'], 'keep-15.2': ['agent', 'theme', 'location'], 'light_emission-43.1': ['agent', 'theme', 'location'], 'linger-53.1': ['agent', 'theme', 'location'], 'linger-53.1-1': ['agent', 'theme', 'location'], 'modes_of_being_with_motion-47.3': ['agent', 'theme', 'location'], 'neglect-75.1': ['agent', 'theme', 'location'], 'neglect-75.1-1': ['agent', 'theme', 'location'], 'orphan-29.7': ['agent', 'theme', 'location'], 'patent-101': ['agent', 'theme', 'location'], 'peer-30.3': ['agent', 'theme', 'location'], 'promote-102': ['agent', 'theme', 'location'], 'push-12': ['agent', 'theme', 'location'], 'refrain-69': ['agent', 'theme', 'location'], 'rehearse-26.8': ['agent', 'theme', 'location'], 'rehearse-26.8-1': ['agent', 'theme', 'location'], 'reject-77.2': ['agent', 'theme', 'location'], 'reject-77.2-1': ['agent', 'theme', 'location'], 'rely-70': ['agent', 'theme', 'location'], 'risk-94': ['agent', 'theme', 'location'], 'risk-94-1': ['agent', 'theme', 'location'], 'rummage-35.5': ['agent', 'theme', 'location'], 'rummage-35.5-1': ['agent', 'theme', 'location'], 'rush-53.2': ['agent', 'theme', 'location'], 'search-35.2': ['agent', 'theme', 'location'], 'simple_dressing-41.3.1': ['agent', 'theme', 'location'], 'snooze-40.4-1': ['agent', 'theme', 'location'], 'sound_emission-43.2': ['agent', 'theme', 'location'], 'spatial_configuration-47.6-1': ['agent', 'theme', 'location'], 'stalk-35.3': ['agent', 'theme', 'location'], 'stop-55.4-1-1': ['agent', 'theme', 'location'], 'succeed-74': ['agent', 'theme', 'location'], 'succeed-74-1': ['agent', 'theme', 'location'], 'succeed-74-1-1': ['agent', 'theme', 'location'], 'succeed-74-2': ['agent', 'theme', 'location'], 'succeed-74-3': ['agent', 'theme', 'location'], 'succeed-74-3-1': ['agent', 'theme', 'location'], 'succeed-74-3-1-1': ['agent', 'theme', 'location'], 'trifle-105.3': ['agent', 'theme', 'location'], 'try-61.1': ['agent', 'theme', 'location'], 'vehicle-51.4.1-1': ['agent', 'theme', 'location'], 'body_motion-49.2-1-1': ['agent', 'theme', 'path', 'location'], 'volunteer-95.4': ['agent', 'pivot', 'theme', 'location'], 'conjecture-29.5': ['agent', 'theme', 'predicate', 'location'], 'conjecture-29.5-1': ['agent', 'theme', 'predicate', 'location'], 'conjecture-29.5-2': ['agent', 'theme', 'predicate', 'location'], 'reciprocate-112': ['agent', 'theme', 'predicate', 'location'], 'reciprocate-112-1': ['agent', 'theme', 'predicate', 'location'], 'respond-113': ['agent', 'theme', 'predicate', 'location'], 'use-105.1': ['agent', 'theme', 'predicate', 'location'], 'coil-9.6-1': ['agent', 'theme', 'prop', 'location'], 'feeding-39.7': ['agent', 'theme', 'recipient', 'location'], 'reflexive_appearance-48.1.2': ['agent', 'theme', 'recipient', 'location'], 'appoint-29.1': ['agent', 'theme', 'result', 'location'], 'declare-29.4': ['agent', 'theme', 'result', 'location'], 'declare-29.4-1': ['agent', 'theme', 'result', 'location'], 'dub-29.3.2': ['agent', 'theme', 'result', 'location'], 'push-12-1': ['agent', 'theme', 'result', 'location'], 'banish-10.2': ['agent', 'theme', 'source', 'destination', 'location'], 'clear-10.3': ['agent', 'theme', 'source', 'destination', 'location'], 'clear-10.3-1': ['agent', 'theme', 'source', 'destination', 'location'], 'debone-10.8': ['agent', 'theme', 'source', 'destination', 'location'], 'wipe_manner-10.4.1': ['agent', 'theme', 'source', 'destination', 'location'], 'fire-10.10': ['agent', 'theme', 'source', 'goal', 'attribute', 'location'], 'remove-10.1': ['agent', 'theme', 'source', 'goal', 'location'], 'base-97.1': ['agent', 'theme', 'source', 'location'], 'deduce-97.2': ['agent', 'theme', 'source', 'location'], 'discover-84': ['agent', 'theme', 'source', 'location'], 'discover-84-1': ['agent', 'theme', 'source', 'location'], 'discover-84-1-1': ['agent', 'theme', 'source', 'location'], 'ferret-35.6': ['agent', 'theme', 'source', 'location'], 'wipe_manner-10.4.1-1': ['agent', 'theme', 'source', 'location'], 'estimate-34.2': ['agent', 'theme', 'value', 'location'], 'estimate-34.2-1': ['agent', 'theme', 'value', 'location'], 'price-54.4': ['agent', 'theme', 'value', 'location'], 'bring-11.3-1': ['agent', 'theme', ['destination', 'co_theme'], 'location'], 'roll-51.3.1': ['agent', 'theme', ['destination', 'result'], ['initial_location', 'source'], 'trajectory', 'location'], 'run-51.3.2-2': ['agent', 'theme', ['destination', 'result'], ['initial_location', 'source'], 'trajectory', 'location'], 'vehicle-51.4.1': ['agent', 'theme', ['destination', 'result'], ['initial_location', 'source'], 'trajectory', 'location'], 'continue-55.3': ['agent', 'theme', ['final_time', 'time'], 'location'], 'waltz-51.5': ['agent', 'theme', ['initial_location', 'source'], 'goal', 'trajectory', 'location'], 'mine-10.9': ['agent', 'theme', 'initial_location', 'destination', 'location'], 'intend-61.2': ['agent', 'topic', 'attribute', 'location'], 'focus-87.1': ['agent', 'topic', 'location'], 'focus-87.1-1': ['agent', 'topic', 'location'], 'intend-61.2-1': ['agent', 'topic', 'location'], 'intend-61.2-1-1': ['agent', 'topic', 'location'], 'fit-54.3': ['agent', 'value', 'goal', 'location'], 'poke-19': ['agent', ['patient', 'destination'], 'instrument', 'location'], 'addict-96': ['agent', ['patient', 'experiencer'], 'stimulus', 'location'], 'acquiesce-95.1': ['agent', ['theme', 'co_agent'], 'location'], 'acquiesce-95.1-1': ['agent', ['theme', 'co_agent'], 'location'], 'invest-13.5.4': ['agent', ['theme', 'goal'], 'asset', 'location'], 'invest-13.5.4-1': ['agent', ['theme', 'goal'], 'asset', 'location'], 'avoid-52': ['agent', 'theme', 'location'], 'benefit-72.2': ['beneficiary', 'causer', 'location'], 'cost-54.2': ['beneficiary', 'theme', 'value', 'location'], 'caused_calibratable_cos-45.6.2': ['causer', 'patient', 'attribute', 'extent', 'source', 'goal', 'location'], 'limit-76': ['causer', 'patient', 'goal', 'location'], 'indicate-78': ['causer', 'recipient', 'topic', 'location'], 'indicate-78-1': ['causer', 'recipient', 'topic', 'location'], 'indicate-78-1-1': ['causer', 'recipient', 'topic', 'location'], 'free-10.6.3': ['causer', 'source', 'theme', 'location'], 'free-10.6.3-1': ['causer', 'source', 'theme', 'location'], 'free-10.6.3-1-1': ['causer', 'source', 'theme', 'location'], 'engender-27.1': ['causer', 'theme', 'location'], 'engender-27.1-1': ['causer', 'theme', 'location'], 'result-27.2': ['causer', 'theme', 'location'], 'hurt-40.8.3': ['experiencer', 'patient', 'location'], 'hurt-40.8.3-1': ['experiencer', 'patient', 'location'], 'hurt-40.8.3-1-1': ['experiencer', 'patient', 'location'], 'hurt-40.8.3-2': ['experiencer', 'patient', 'location'], 'pain-40.8.1': ['experiencer', 'patient', 'stimulus', 'location'], 'tingle-40.8.2': ['experiencer', 'patient', 'stimulus', 'location'], 'admire-31.2': ['experiencer', 'stimulus', 'attribute', 'location'], 'comprehend-87.2': ['experiencer', 'stimulus', 'attribute', 'location'], 'comprehend-87.2-1': ['experiencer', 'stimulus', 'attribute', 'location'], 'admire-31.2-1': ['experiencer', 'stimulus', 'location'], 'appeal-31.4': ['experiencer', 'stimulus', 'location'], 'appeal-31.4-1': ['experiencer', 'stimulus', 'location'], 'appeal-31.4-2': ['experiencer', 'stimulus', 'location'], 'appeal-31.4-3': ['experiencer', 'stimulus', 'location'], 'body_internal_states-40.6': ['experiencer', 'stimulus', 'location'], 'care-88.1': ['experiencer', 'stimulus', 'emotion', 'location'], 'care-88.1-1': ['experiencer', 'stimulus', 'emotion', 'location'], 'change_bodily_state-40.8.4': ['experiencer', 'stimulus', 'final_state', 'location'], 'cognize-85': ['experiencer', 'stimulus', 'location'], 'comprehend-87.2-1-1': ['experiencer', 'stimulus', 'location'], 'comprehend-87.2-1-1-1': ['experiencer', 'stimulus', 'location'], 'empathize-88.2': ['experiencer', 'stimulus', 'location'], 'encounter-30.5': ['experiencer', 'stimulus', 'location'], 'flinch-40.5': ['experiencer', 'stimulus', 'position', 'location'], 'marvel-31.3': ['experiencer', 'stimulus', 'emotion', 'location'], 'matter-91': ['experiencer', 'stimulus', 'location'], 'see-30.1': ['experiencer', 'stimulus', 'location'], 'see-30.1-1': ['experiencer', 'stimulus', 'location'], 'see-30.1-1-1': ['experiencer', 'stimulus', 'location'], 'see-30.1-1-1-1': ['experiencer', 'stimulus', 'location'], 'sight-30.2': ['experiencer', 'stimulus', 'location'], 'stimulus_subject-30.4': ['experiencer', 'stimulus', 'location'], 'wish-62': ['experiencer', 'stimulus', 'location'], 'bulge-47.5.3': [['agent', 'destination'], 'theme', 'location'], 'calibratable_cos-45.6.1': ['patient', 'attribute', 'extent', 'initial_state', 'result', 'location'], 'calibratable_cos-45.6.1-1': ['patient', 'attribute', 'extent', 'initial_state', 'result', 'location'], 'die-42.4': ['patient', 'causer', 'location'], 'die-42.4-1': ['patient', 'causer', 'location'], 'caused_calibratable_cos-45.6.2-1': ['patient', 'extent', 'source', 'goal', 'attribute', 'direction', 'location'], 'disappearance-48.2': ['theme', 'initial_location', 'location'], 'disappearance-48.2-1': ['theme', 'initial_location', 'location'], 'entity_specific_cos-45.5': ['patient', 'final_state', 'location'], 'break_down-45.8': ['patient', 'location'], 'convert-26.6.2': ['patient', 'result', 'initial_state', 'location'], 'convert-26.6.2-1': ['patient', 'result', 'initial_state', 'location'], 'become-109.1': ['patient', 'result', 'location'], 'become-109.1-1': ['patient', 'result', 'location'], 'become-109.1-1-1': ['patient', 'result', 'location'], 'contain-15.4': ['pivot', 'theme', 'location'], 'exhale-40.1.3': ['pivot', 'theme', 'location'], 'exhale-40.1.3-1': ['pivot', 'theme', 'location'], 'exhale-40.1.3-2': ['pivot', 'theme', 'location'], 'long-32.2': ['pivot', 'theme', 'location'], 'long-32.2-1': ['pivot', 'theme', 'location'], 'long-32.2-2': ['pivot', 'theme', 'location'], 'own-100.1': ['pivot', 'theme', 'location'], 'want-32.1': ['pivot', 'theme', 'location'], 'want-32.1-1': ['pivot', 'theme', 'location'], 'want-32.1-1-1': ['pivot', 'theme', 'location'], 'require-103': ['pivot', 'theme', 'source', 'location'], 'require-103-1': ['pivot', 'theme', 'source', 'location'], 'require-103-2': ['pivot', 'theme', 'source', 'location'], 'ensure-99': ['precondition', 'theme', 'beneficiary', 'location'], 'equip-13.4.2-1-1': ['recipient', 'theme', 'location'], 'substance_emission-43.4': ['source', 'theme', 'location'], 'substance_emission-43.4-1': ['source', 'theme', 'location'], 'amuse-31.1': ['stimulus', 'experiencer', 'location'], 'earn-54.6': ['theme', 'asset', 'location'], 'comprise-107.2': ['theme', 'attribute', 'location'], 'comprise-107.2-1': ['theme', 'attribute', 'location'], 'seem-109': ['theme', 'attribute', 'location'], 'seem-109-1': ['theme', 'attribute', 'location'], 'seem-109-1-1': ['theme', 'attribute', 'location'], 'seem-109-1-1-1': ['theme', 'attribute', 'location'], 'exceed-90': ['theme', 'co_theme', 'attribute', 'location'], 'representation-110.1': ['theme', 'co_theme', 'context', 'location'], 'bump-18.4': ['theme', 'co_theme', 'location'], 'bump-18.4-1': ['theme', 'co_theme', 'location'], 'cling-22.5': ['theme', 'co_theme', 'location'], 'contiguous_location-47.8': ['theme', 'co_theme', 'location'], 'contiguous_location-47.8-1': ['theme', 'co_theme', 'location'], 'contiguous_location-47.8-2': ['theme', 'co_theme', 'location'], 'differ-23.4': ['theme', 'co_theme', 'location'], 'harmonize-22.6': ['theme', 'co_theme', 'location'], 'relate-86.2': ['theme', 'co_theme', 'location'], 'relate-86.2-1': ['theme', 'co_theme', 'location'], 'relate-86.2-2': ['theme', 'co_theme', 'location'], 'substitute-13.6.2': ['theme', 'co_theme', ['source', 'co_goal'], ['co_source', 'goal'], ['location']], 'substitute-13.6.2-1': ['theme', 'co_theme', ['source', 'goal'], ['co_source', 'co_goal'], ['location']], 'escape-51.1-1-2': ['theme', 'destination', 'initial_location', 'trajectory', 'location'], 'nonvehicle-51.4.2-1': ['theme', 'destination', 'initial_location', 'trajectory', 'location'], 'run-51.3.2': ['theme', 'destination', 'initial_location', 'trajectory', 'location'], 'run-51.3.2-1': ['theme', 'destination', 'initial_location', 'trajectory', 'location'], 'rotate-51.9.1': ['theme', 'extent', 'initial_location', 'trajectory', 'location'], 'attend-107.4': ['theme', 'goal', 'location'], 'attend-107.4-1': ['theme', 'goal', 'location'], 'attend-107.4-2': ['theme', 'goal', 'location'], 'reach-51.8': ['theme', 'goal', 'source', 'trajectory', 'location'], 'escape-51.1': ['theme', 'initial_location', 'destination', 'trajectory', 'location'], 'escape-51.1-1': ['theme', 'initial_location', 'destination', 'trajectory', 'location'], 'escape-51.1-1-1': ['theme', 'initial_location', 'destination', 'trajectory', 'location'], 'appear-48.1.1': ['theme', 'location'], 'disfunction-105.2.2': ['theme', 'location'], 'entity_specific_modes_being-47.2': ['theme', 'location'], 'exist-47.1': ['theme', 'location'], 'function-105.2.1': ['theme', 'location'], 'lodge-46': ['theme', 'location'], 'meander-47.7': ['theme', 'location'], 'meander-47.7-1': ['theme', 'location'], 'occur-48.3': ['theme', 'location'], 'occur-48.3-1': ['theme', 'location'], 'occur-48.3-2': ['theme', 'location'], 'smell_emission-43.3': ['theme', 'location'], 'sound_existence-47.4': ['theme', 'location'], 'stop-55.4-1': ['theme', 'location'], 'swarm-47.5.1': ['theme', 'location'], 'swarm-47.5.1-1': ['theme', 'location'], 'swarm-47.5.1-2': ['theme', 'location'], 'swarm-47.5.1-2-1': ['theme', 'location'], # 'terminus-47.9': ['theme', 'destination', 'location'], # 'weather-57': ['theme', 'location'], 'weekend-56': ['theme', 'location'], 'spatial_configuration-47.6': ['theme', 'pos', 'location'], 'function-105.2.1-1': ['theme', 'predicate', 'location'], 'leave-51.2': ['theme', 'source', 'goal', 'trajectory', 'location'], 'leave-51.2-1': ['theme', 'source', 'goal', 'trajectory', 'location'], 'escape-51.1-1-3': ['theme', 'trajectory', 'destination', 'initial_location', 'location'], 'register-54.1': ['theme', 'value', 'location'], 'register-54.1-1-1': ['theme', 'value', 'location'], 'exist-47.1-1': ['theme', ['pivot', 'manner'], 'location'], 'rob-10.6.4': [['agent', 'beneficiary'], 'theme', 'source', 'location'], 'steal-10.5': [['agent', 'beneficiary'], 'theme', 'source', 'location'], 'steal-10.5-1': [['agent', 'beneficiary'], 'theme', 'source', 'location'], 'render-29.90': [['agent', 'causer'], 'patient', 'result', 'source', 'location'], 'throw-17.1-1-1': [['agent', 'causer'], 'theme', 'result', 'location'], 'exchange-13.6.1': [['agent', 'co_goal', 'source'], ['co_agent', 'goal', 'co_source'], 'theme', 'co_theme', 'location'], 'talk-37.5': [['agent', 'co_recipient', 'source'], ['co_agent', 'co_source', 'recipient'], 'topic', 'location'], 'get-13.5.1': [['agent', 'goal'], 'theme', 'beneficiary', 'source', 'asset', 'location'], 'absorb-39.8': [['agent', 'goal'], 'theme', 'source', 'location'], 'cheat-10.6.1': [['agent', 'goal'], 'theme', 'source', 'location'], 'cheat-10.6.1-1': [['agent', 'goal'], 'theme', 'source', 'location'], 'cheat-10.6.1-1-1': [['agent', 'goal'], 'theme', 'source', 'location'], 'deprive-10.6.2': [['agent', 'goal'], 'theme', 'source', 'location'], 'get-13.5.1-1': [['agent', 'goal'], 'theme', 'source', 'location'], 'learn-14': [['agent', 'goal'], 'topic', ['recipient', 'source'], 'location'], 'learn-14-1': [['agent', 'goal'], 'topic', ['recipient', 'source'], 'location'], 'learn-14-2': [['agent', 'goal'], 'topic', ['recipient', 'source'], 'location'], 'learn-14-2-1': [['agent', 'goal'], 'topic', ['recipient', 'source'], 'location'], 'interrogate-37.1.3': [['agent', 'goal'], ['recipient', 'source'], 'topic', 'attribute', 'location'], 'inquire-37.1.2': [['agent', 'goal'], ['recipient', 'source'], 'topic', 'location'], 'throw-17.1': [['agent', 'initial_location'], 'theme', 'destination', 'location'], 'throw-17.1-1': [['agent', 'initial_location'], 'theme', 'destination', 'location'], 'bring-11.3': [['agent', 'instrument'], 'theme', 'destination', 'initial_location', 'location'], 'obtain-13.5.2-1': [['agent', 'recipient'], 'theme', 'source', 'asset', 'location'], 'berry-13.7': [['agent', 'recipient'], 'theme', 'source', 'location'], 'obtain-13.5.2': [['agent', 'recipient'], 'theme', 'source', 'location'], 'chit_chat-37.6': [['agent', 'source', 'co_recipient'], ['co_agent', 'recipient', 'co_source'], 'topic', 'location'], 'chit_chat-37.6-1': [['agent', 'source', 'co_recipient'], ['co_agent', 'recipient', 'co_source'], 'topic', 'location'], 'consume-66': [['agent', 'source'], 'asset', 'goal', 'location'], 'consume-66-1': [['agent', 'source'], 'asset', 'goal', 'location'], 'wink-40.3.1': [['agent', 'source'], 'patient', 'recipient', 'theme', 'location'], 'crane-40.3.2': [['agent', 'source'], 'patient', 'recipient', 'topic', 'location'], 'contribute-13.2': [['agent', 'source'], 'recipient', 'theme', 'location'], 'contribute-13.2-1': [['agent', 'source'], 'recipient', 'theme', 'location'], 'contribute-13.2-1-1': [['agent', 'source'], 'recipient', 'theme', 'location'], 'contribute-13.2-2': [['agent', 'source'], 'recipient', 'theme', 'location'], 'contribute-13.2-2-1': [['agent', 'source'], 'recipient', 'theme', 'location'], 'equip-13.4.2': [['agent', 'source'], 'recipient', 'theme', 'location'], 'equip-13.4.2-1': [['agent', 'source'], 'recipient', 'theme', 'location'], 'nonverbal_expression-40.2': [['agent', 'source'], 'recipient', 'theme', 'location'], 'advise-37.9': [['agent', 'source'], 'recipient', 'topic', 'location'], 'advise-37.9-1': [['agent', 'source'], 'recipient', 'topic', 'location'], 'complain-37.8': [['agent', 'source'], 'recipient', 'topic', 'location'], 'confess-37.10': [['agent', 'source'], 'recipient', 'topic', 'location'], 'curtsey-40.3.3': [['agent', 'source'], 'recipient', 'topic', 'location'], 'initiate_communication-37.4.2': [['agent', 'source'], 'recipient', 'topic', 'location'], 'initiate_communication-37.4.2-1': [['agent', 'source'], 'recipient', 'topic', 'location'], 'promise-37.13': [['agent', 'source'], 'recipient', 'topic', 'location'], 'transfer_mesg-37.1.1': [['agent', 'source'], 'recipient', 'topic', 'location'], 'transfer_mesg-37.1.1-1': [['agent', 'source'], 'recipient', 'topic', 'location'], 'transfer_mesg-37.1.1-1-1': [['agent', 'source'], 'recipient', 'topic', 'location'], 'pay-68': [['agent', 'source'], 'theme', 'asset', 'recipient', 'location'], 'pay-68-1': [['agent', 'source'], 'theme', 'asset', 'recipient', 'location'], 'breathe-40.1.2': [['agent', 'source'], 'theme', 'destination', 'location'], 'give-13.1-1': [['agent', 'source'], 'theme', 'recipient', 'asset', 'location'], 'fulfilling-13.4.1': [['agent', 'source'], 'theme', 'recipient', 'location'], 'fulfilling-13.4.1-1': [['agent', 'source'], 'theme', 'recipient', 'location'], 'fulfilling-13.4.1-2': [['agent', 'source'], 'theme', 'recipient', 'location'], 'give-13.1': [['agent', 'source'], 'theme', 'recipient', 'location'], 'future_having-13.3': [['agent', 'source'], 'theme', ['beneficiary', 'goal'], 'location'], 'instr_communication-37.4.1': [['agent', 'source'], 'topic', 'recipient', 'location'], 'lecture-37.11': [['agent', 'source'], 'topic', 'recipient', 'location'], 'lecture-37.11-1': [['agent', 'source'], 'topic', 'recipient', 'location'], 'lecture-37.11-1-1': [['agent', 'source'], 'topic', 'recipient', 'location'], 'lecture-37.11-2': [['agent', 'source'], 'topic', 'recipient', 'location'], 'manner_speaking-37.3': [['agent', 'source'], 'topic', 'recipient', 'manner', 'location'], 'say-37.7': [['agent', 'source'], 'topic', 'recipient', 'location'], 'say-37.7-1': [['agent', 'source'], 'topic', 'recipient', 'location'], 'say-37.7-1-1': [['agent', 'source'], 'topic', 'recipient', 'location'], 'say-37.7-1-1-1': [['agent', 'source'], 'topic', 'recipient', 'location'], 'say-37.7-1-2': [['agent', 'source'], 'topic', 'recipient', 'location'], 'tell-37.2': [['agent', 'source'], 'topic', 'recipient', 'location'], 'overstate-37.12': [['agent', 'source'], ['theme', 'topic'], 'recipient', 'location'], 'orbit-51.9.2': [['theme', 'axis'], ['destination', 'initial_location'], 'trajectory', 'location'] }
__all__ = ["analyze_traffic", "utils", "manage_resolutions", "url_regex_resolver", "get_popular_urls", "funnel_in_outs", "funnel_stats", "sankey_funnel", "frequent_funnel", "analyze_clicks", "analyze_timing"]
# # PySNMP MIB module CISCO-FCIP-MGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FCIP-MGMT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:41:05 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) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint") ciscoExperiment, = mibBuilder.importSymbols("CISCO-SMI", "ciscoExperiment") DomainId, FcNameIdOrZero, FcNameId = mibBuilder.importSymbols("CISCO-ST-TC", "DomainId", "FcNameIdOrZero", "FcNameId") InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") Integer32, ModuleIdentity, NotificationType, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Gauge32, Unsigned32, TimeTicks, IpAddress, MibIdentifier, Counter32, ObjectIdentity, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "ModuleIdentity", "NotificationType", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Gauge32", "Unsigned32", "TimeTicks", "IpAddress", "MibIdentifier", "Counter32", "ObjectIdentity", "iso") RowStatus, DisplayString, TextualConvention, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "DisplayString", "TextualConvention", "TruthValue") ciscoFcipMgmtMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 10, 96)) ciscoFcipMgmtMIB.setRevisions(('2003-05-19 00:00', '2002-10-05 00:00',)) if mibBuilder.loadTexts: ciscoFcipMgmtMIB.setLastUpdated('200305190000Z') if mibBuilder.loadTexts: ciscoFcipMgmtMIB.setOrganization('Cisco Systems Inc.') ciscoFcipObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1)) cfmFcipConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2)) cfmFcipConfig = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1)) cfmFcipNotification = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 2)) cfmFcipNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 2, 0)) class CfmFcEntityMode(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("ePortMode", 1), ("bPortMode", 2), ("other", 3)) cfmFcipDynIpConfType = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("slpv2", 1), ("none", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: cfmFcipDynIpConfType.setStatus('current') cfmFcipFabricWWN = MibScalar((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 2), FcNameIdOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipFabricWWN.setStatus('current') cfmFcipEntityInstanceTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3), ) if mibBuilder.loadTexts: cfmFcipEntityInstanceTable.setStatus('current') cfmFcipEntityInstanceEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId")) if mibBuilder.loadTexts: cfmFcipEntityInstanceEntry.setStatus('current') cfmFcipEntityId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 1), Unsigned32()) if mibBuilder.loadTexts: cfmFcipEntityId.setStatus('current') cfmFcipEntityAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 2), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipEntityAddressType.setStatus('current') cfmFcipEntityAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 3), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipEntityAddress.setStatus('current') cfmFcipEntityTcpConnPort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipEntityTcpConnPort.setStatus('current') cfmFcipEntitySACKOption = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipEntitySACKOption.setStatus('current') cfmFcipEntitySeqNumWrap = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 6), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipEntitySeqNumWrap.setStatus('current') cfmFcipEntityPHBSupport = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 7), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipEntityPHBSupport.setStatus('current') cfmFcipEntityStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 3, 1, 8), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipEntityStatus.setStatus('current') cfmFcipLinkTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4), ) if mibBuilder.loadTexts: cfmFcipLinkTable.setStatus('current') cfmFcipLinkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipLinkIndex")) if mibBuilder.loadTexts: cfmFcipLinkEntry.setStatus('current') cfmFcipLinkIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 1), Unsigned32()) if mibBuilder.loadTexts: cfmFcipLinkIndex.setStatus('current') cfmFcipLinkIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkIfIndex.setStatus('current') cfmFcipLinkCost = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipLinkCost.setStatus('current') cfmFcipLinkLocalFcipEntityMode = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 4), CfmFcEntityMode()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkLocalFcipEntityMode.setStatus('current') cfmFcipLinkRemFcipEntityWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 5), FcNameIdOrZero()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityWWN.setStatus('current') cfmFcipLinkRemFcipEntityId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityId.setStatus('current') cfmFcipLinkRemFcipEntityAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 7), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityAddrType.setStatus('current') cfmFcipLinkRemFcipEntityAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 8), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityAddress.setStatus('current') cfmFcipLinkRemFcipEntityMode = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 9), CfmFcEntityMode()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkRemFcipEntityMode.setStatus('current') cfmFcipLinkStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 4, 1, 10), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipLinkStatus.setStatus('current') cfmFcipTcpConnTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5), ) if mibBuilder.loadTexts: cfmFcipTcpConnTable.setStatus('current') cfmFcipTcpConnEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipLinkIndex"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnLocalPort"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnRemPort")) if mibBuilder.loadTexts: cfmFcipTcpConnEntry.setStatus('current') cfmFcipTcpConnLocalPort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))) if mibBuilder.loadTexts: cfmFcipTcpConnLocalPort.setStatus('current') cfmFcipTcpConnRemPort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))) if mibBuilder.loadTexts: cfmFcipTcpConnRemPort.setStatus('current') cfmFcipTcpConnPurpose = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("control", 1), ("data", 2), ("both", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipTcpConnPurpose.setStatus('current') cfmFcipTcpConnRWSize = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 4), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipTcpConnRWSize.setStatus('current') cfmFcipTcpConnMSS = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 5), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipTcpConnMSS.setStatus('current') cfmFcipTcpConnTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 5, 1, 6), Unsigned32()).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipTcpConnTimeOut.setStatus('current') cfmFcipDynamicRouteTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6), ) if mibBuilder.loadTexts: cfmFcipDynamicRouteTable.setStatus('current') cfmFcipDynamicRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipDynamicRouteDID"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipDynamicRouteIndex")) if mibBuilder.loadTexts: cfmFcipDynamicRouteEntry.setStatus('current') cfmFcipDynamicRouteIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 1), Unsigned32()) if mibBuilder.loadTexts: cfmFcipDynamicRouteIndex.setStatus('current') cfmFcipDynamicRouteDID = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 2), DomainId()) if mibBuilder.loadTexts: cfmFcipDynamicRouteDID.setStatus('current') cfmFcipDynamicRouteLinkIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 6, 1, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipDynamicRouteLinkIndex.setStatus('current') cfmFcipStaticRouteTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7), ) if mibBuilder.loadTexts: cfmFcipStaticRouteTable.setStatus('current') cfmFcipStaticRouteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtDID"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtIndex")) if mibBuilder.loadTexts: cfmFcipStaticRouteEntry.setStatus('current') cfmFcipStaRtIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 1), Unsigned32()) if mibBuilder.loadTexts: cfmFcipStaRtIndex.setStatus('current') cfmFcipStaRtDID = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 2), DomainId()) if mibBuilder.loadTexts: cfmFcipStaRtDID.setStatus('current') cfmFcipStaRtRemFcipEntWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 3), FcNameId()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntWWN.setStatus('current') cfmFcipStaRtRemFcipEntId = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 4), Unsigned32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntId.setStatus('current') cfmFcipStaRtRemFcipEntAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 5), InetAddressType()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntAddrType.setStatus('current') cfmFcipStaRtRemFcipEntAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 6), InetAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipStaRtRemFcipEntAddr.setStatus('current') cfmFcipStaRtStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 7, 1, 7), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cfmFcipStaRtStatus.setStatus('current') cfmFcipLinkErrorsTable = MibTable((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8), ) if mibBuilder.loadTexts: cfmFcipLinkErrorsTable.setStatus('current') cfmFcipLinkErrorsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1), ).setIndexNames((0, "CISCO-FCIP-MGMT-MIB", "cfmFcipEntityId"), (0, "CISCO-FCIP-MGMT-MIB", "cfmFcipLinkIndex")) if mibBuilder.loadTexts: cfmFcipLinkErrorsEntry.setStatus('current') cfmFcipLinkFcipLossofFcSynchs = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 1), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipLossofFcSynchs.setStatus('current') cfmFcipLinkFcipSfNotRcv = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipSfNotRcv.setStatus('current') cfmFcipLinkFcipSfRespNotRcv = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipSfRespNotRcv.setStatus('current') cfmFcipLinkFcipSfRespMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipSfRespMismatch.setStatus('current') cfmFcipLinkFcipSfInvalidNonce = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipSfInvalidNonce.setStatus('current') cfmFcipLinkFcipDuplicateSfRcv = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 6), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipDuplicateSfRcv.setStatus('current') cfmFcipLinkFcipSfInvalidWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 7), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipSfInvalidWWN.setStatus('current') cfmFcipLinkFcipBB2LkaTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipBB2LkaTimeOut.setStatus('current') cfmFcipLinkFcipSntpTimeStampExp = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkFcipSntpTimeStampExp.setStatus('current') cfmFcipLinkTcpTooManyErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkTcpTooManyErrors.setStatus('current') cfmFcipLinkTcpKeepAliveTimeOut = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkTcpKeepAliveTimeOut.setStatus('current') cfmFcipLinkTcpExDatagramsDropped = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 12), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkTcpExDatagramsDropped.setStatus('current') cfmFcipLinkTcpSaParamMismatch = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 10, 96, 1, 1, 8, 1, 13), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: cfmFcipLinkTcpSaParamMismatch.setStatus('current') cfmFcipCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 1)) cfmFcipGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2)) cfmFcipCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 1, 1)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityScalarGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityInstanceGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipDynamicRouteGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaticRouteGroup"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkErrorsGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipCompliance = cfmFcipCompliance.setStatus('current') cfmFcipEntityScalarGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 1)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipDynIpConfType"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipFabricWWN")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipEntityScalarGroup = cfmFcipEntityScalarGroup.setStatus('current') cfmFcipEntityInstanceGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 2)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityAddressType"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityAddress"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityTcpConnPort"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntitySACKOption"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntitySeqNumWrap"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityPHBSupport"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipEntityStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipEntityInstanceGroup = cfmFcipEntityInstanceGroup.setStatus('current') cfmFcipLinkGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 3)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkIfIndex"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkCost"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkLocalFcipEntityMode"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityWWN"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityId"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityAddrType"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityAddress"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkRemFcipEntityMode"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipLinkGroup = cfmFcipLinkGroup.setStatus('current') cfmFcipTcpConnGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 4)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnPurpose"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnRWSize"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnMSS"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipTcpConnTimeOut")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipTcpConnGroup = cfmFcipTcpConnGroup.setStatus('current') cfmFcipDynamicRouteGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 5)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipDynamicRouteLinkIndex")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipDynamicRouteGroup = cfmFcipDynamicRouteGroup.setStatus('current') cfmFcipStaticRouteGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 6)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtRemFcipEntWWN"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtRemFcipEntId"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtRemFcipEntAddrType"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtRemFcipEntAddr"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipStaRtStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipStaticRouteGroup = cfmFcipStaticRouteGroup.setStatus('current') cfmFcipLinkErrorsGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 10, 96, 2, 2, 7)).setObjects(("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipLossofFcSynchs"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfNotRcv"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfRespNotRcv"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfRespMismatch"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfInvalidNonce"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipDuplicateSfRcv"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSfInvalidWWN"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipBB2LkaTimeOut"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkFcipSntpTimeStampExp"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkTcpTooManyErrors"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkTcpKeepAliveTimeOut"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkTcpExDatagramsDropped"), ("CISCO-FCIP-MGMT-MIB", "cfmFcipLinkTcpSaParamMismatch")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cfmFcipLinkErrorsGroup = cfmFcipLinkErrorsGroup.setStatus('current') mibBuilder.exportSymbols("CISCO-FCIP-MGMT-MIB", cfmFcipLinkFcipBB2LkaTimeOut=cfmFcipLinkFcipBB2LkaTimeOut, PYSNMP_MODULE_ID=ciscoFcipMgmtMIB, cfmFcipLinkTable=cfmFcipLinkTable, cfmFcipStaRtRemFcipEntAddrType=cfmFcipStaRtRemFcipEntAddrType, cfmFcipLinkRemFcipEntityAddrType=cfmFcipLinkRemFcipEntityAddrType, cfmFcipTcpConnPurpose=cfmFcipTcpConnPurpose, cfmFcipEntityStatus=cfmFcipEntityStatus, cfmFcipLinkFcipSfInvalidWWN=cfmFcipLinkFcipSfInvalidWWN, cfmFcipTcpConnTimeOut=cfmFcipTcpConnTimeOut, cfmFcipLinkTcpTooManyErrors=cfmFcipLinkTcpTooManyErrors, cfmFcipLinkGroup=cfmFcipLinkGroup, cfmFcipLinkEntry=cfmFcipLinkEntry, cfmFcipEntityAddress=cfmFcipEntityAddress, cfmFcipStaRtDID=cfmFcipStaRtDID, cfmFcipLinkErrorsEntry=cfmFcipLinkErrorsEntry, cfmFcipFabricWWN=cfmFcipFabricWWN, cfmFcipCompliance=cfmFcipCompliance, cfmFcipDynamicRouteEntry=cfmFcipDynamicRouteEntry, cfmFcipTcpConnEntry=cfmFcipTcpConnEntry, cfmFcipGroups=cfmFcipGroups, cfmFcipDynamicRouteDID=cfmFcipDynamicRouteDID, CfmFcEntityMode=CfmFcEntityMode, cfmFcipLinkStatus=cfmFcipLinkStatus, cfmFcipNotifications=cfmFcipNotifications, cfmFcipLinkRemFcipEntityId=cfmFcipLinkRemFcipEntityId, cfmFcipTcpConnGroup=cfmFcipTcpConnGroup, cfmFcipTcpConnMSS=cfmFcipTcpConnMSS, cfmFcipStaRtRemFcipEntAddr=cfmFcipStaRtRemFcipEntAddr, cfmFcipLinkErrorsTable=cfmFcipLinkErrorsTable, cfmFcipEntityPHBSupport=cfmFcipEntityPHBSupport, cfmFcipTcpConnRemPort=cfmFcipTcpConnRemPort, cfmFcipDynamicRouteTable=cfmFcipDynamicRouteTable, cfmFcipLinkLocalFcipEntityMode=cfmFcipLinkLocalFcipEntityMode, ciscoFcipMgmtMIB=ciscoFcipMgmtMIB, cfmFcipLinkFcipSfRespNotRcv=cfmFcipLinkFcipSfRespNotRcv, cfmFcipEntityId=cfmFcipEntityId, cfmFcipLinkTcpSaParamMismatch=cfmFcipLinkTcpSaParamMismatch, cfmFcipLinkFcipDuplicateSfRcv=cfmFcipLinkFcipDuplicateSfRcv, cfmFcipEntityInstanceTable=cfmFcipEntityInstanceTable, cfmFcipConfig=cfmFcipConfig, cfmFcipEntityAddressType=cfmFcipEntityAddressType, cfmFcipLinkFcipSntpTimeStampExp=cfmFcipLinkFcipSntpTimeStampExp, cfmFcipLinkFcipSfInvalidNonce=cfmFcipLinkFcipSfInvalidNonce, ciscoFcipObjects=ciscoFcipObjects, cfmFcipDynamicRouteLinkIndex=cfmFcipDynamicRouteLinkIndex, cfmFcipTcpConnLocalPort=cfmFcipTcpConnLocalPort, cfmFcipEntitySeqNumWrap=cfmFcipEntitySeqNumWrap, cfmFcipLinkRemFcipEntityWWN=cfmFcipLinkRemFcipEntityWWN, cfmFcipConformance=cfmFcipConformance, cfmFcipTcpConnRWSize=cfmFcipTcpConnRWSize, cfmFcipStaRtIndex=cfmFcipStaRtIndex, cfmFcipLinkRemFcipEntityAddress=cfmFcipLinkRemFcipEntityAddress, cfmFcipNotification=cfmFcipNotification, cfmFcipLinkTcpKeepAliveTimeOut=cfmFcipLinkTcpKeepAliveTimeOut, cfmFcipEntitySACKOption=cfmFcipEntitySACKOption, cfmFcipDynIpConfType=cfmFcipDynIpConfType, cfmFcipStaRtRemFcipEntWWN=cfmFcipStaRtRemFcipEntWWN, cfmFcipLinkFcipSfRespMismatch=cfmFcipLinkFcipSfRespMismatch, cfmFcipLinkFcipLossofFcSynchs=cfmFcipLinkFcipLossofFcSynchs, cfmFcipEntityInstanceEntry=cfmFcipEntityInstanceEntry, cfmFcipLinkTcpExDatagramsDropped=cfmFcipLinkTcpExDatagramsDropped, cfmFcipStaticRouteEntry=cfmFcipStaticRouteEntry, cfmFcipEntityScalarGroup=cfmFcipEntityScalarGroup, cfmFcipLinkRemFcipEntityMode=cfmFcipLinkRemFcipEntityMode, cfmFcipCompliances=cfmFcipCompliances, cfmFcipLinkIndex=cfmFcipLinkIndex, cfmFcipTcpConnTable=cfmFcipTcpConnTable, cfmFcipLinkCost=cfmFcipLinkCost, cfmFcipStaRtStatus=cfmFcipStaRtStatus, cfmFcipDynamicRouteGroup=cfmFcipDynamicRouteGroup, cfmFcipDynamicRouteIndex=cfmFcipDynamicRouteIndex, cfmFcipLinkFcipSfNotRcv=cfmFcipLinkFcipSfNotRcv, cfmFcipEntityTcpConnPort=cfmFcipEntityTcpConnPort, cfmFcipEntityInstanceGroup=cfmFcipEntityInstanceGroup, cfmFcipStaticRouteGroup=cfmFcipStaticRouteGroup, cfmFcipLinkErrorsGroup=cfmFcipLinkErrorsGroup, cfmFcipLinkIfIndex=cfmFcipLinkIfIndex, cfmFcipStaRtRemFcipEntId=cfmFcipStaRtRemFcipEntId, cfmFcipStaticRouteTable=cfmFcipStaticRouteTable)
class unionFindSet: def __init__(self, S): self.S = {i: i for i in S} self.size = {i: 1 for i in S} def find(self, x): if x != self.S[x]: self.S[x] = self.find(self.S[x]) return self.S[x] def union(self, a, b, key=lambda x: x): x, y = sorted((self.find(a), self.find(b)), key=key) self.S[y] = x if x != y: self.size[x] += self.size[y] def getSize(self, x): return self.size[self.find(x)]
""" ---For Bolinger Trade Strategy--- 1. Goes to Tick Data in cassandra and check if we will get a fill on Mid level value or Not 2. If Yes then returns TRUE else returns FALSE """ def check_data(product,time_start,time_end,date1,session,mid_price,side): query_fetch_tick_data="select type,price,is_block from data where xric=? and date1=? and time1>=? and time1<=? allow filtering" p = session.prepare(query_fetch_tick_data) tick_data = session.execute(p,(product,date1,time_start,time_end)) for item in tick_data: if item[1]!=None and item[2]!=True: if item[0]=='Trade': if side=='buy': if item[1]<=mid_price: return True else: return False else: if item[1]>=mid_price: return True else: return False return False
# -*- coding: utf-8 -*- """ Created on Tue Apr 9 15:15:50 2020 @author: Patrick """ """Implementation of Fast Orthogonal Search""" #============================================== #candidates_generation.py #============================================== def CandidatePool_Generation(x_train, y_train, K, L): Candidates = [] # x[n-l], l = 0,...,10 (11 Candidates) for l in range(0, L+1): zero_list = l * [0] data_list = x_train[:len(x_train)-l] xn_l = [*zero_list, *data_list] Candidates.append(xn_l) # y[n-k], l = 1,...,10 (10 Candidates) for k in range(1, K+1): zero_list = k * [0] data_list = y_train[:len(y_train)-k] yn_k = [*zero_list, *data_list] Candidates.append(yn_k) # x[n-l1]x[n-l2], l1 = 0,...,10 # l2 = l1,...,10 (66 Candidates) for l1 in range(0, L+1): for l2 in range(l1, L+1): zero_list_l1 = l1 * [0] zero_list_l2 = l2 * [0] data_list_l1 = x_train[:len(x_train)-l1] data_list_l2 = x_train[:len(x_train)-l2] xn_l1 = [*zero_list_l1, *data_list_l1] xn_l2 = [*zero_list_l2, *data_list_l2] Candidates.append([i*j for i,j in zip(xn_l1,xn_l2)]) # y[n-l1]y[n-l2], k1 = 1,...,10 # k2 = k1,...,10 (55 Candidates) for k1 in range(1, K+1): for k2 in range(k1, K+1): zero_list_k1 = k1 * [0] zero_list_k2 = k2 * [0] data_list_k1 = y_train[:len(y_train)-k1] data_list_k2 = y_train[:len(y_train)-k2] yn_k1 = [*zero_list_k1, *data_list_k1] yn_k2 = [*zero_list_k2, *data_list_k2] Candidates.append([i*j for i,j in zip(yn_k1,yn_k2)]) # x[n-l]y[n-k], l = 1,...,10 # k = 1,...,10 (110 Candidates) for l in range(0, L+1): for k in range(1, K+1): zero_list_l = l * [0] zero_list_k = k * [0] data_list_l = x_train[:len(x_train)-l] data_list_k = y_train[:len(y_train)-k] xn_l = [*zero_list_l, *data_list_l] yn_k = [*zero_list_k, *data_list_k] Candidates.append([i*j for i,j in zip(xn_l,yn_k)]) return Candidates #
""" This package includes the internal APIs for PySpark about interoperability between pandas, PySpark and PyArrow. This package should not be directly imported and used. """
class Solution: def combine(self, n, k): """ :type n: int :type k: int :rtype: List[List[int]] """ ret = [] curr = [] def generate(curr_pos): if len(curr) == k: ret.append(curr[:]) else: for i in range(curr_pos, n): curr.append(i + 1) generate(i + 1) curr.pop() generate(0) return ret
registered = False api_key = None environment = None log_404 = False log_403 = False log_405 = False use_ssl = False
pytest_plugins = [ "polygon.tests.fixtures", "polygon.plugins.tests.fixtures", "polygon.graphql.tests.fixtures", ]
ry = 0 def setup(): size(800, 800, P3D) global obj, texture1 texture1 = loadImage("texture.jpg") obj = loadShape("man.obj") def draw(): global ry background(0) lights() translate(width / 2, height / 2 + 200, -200) rotateZ(PI) rotateY(ry) scale(25) # Orange point light on the right pointLight(150, 100, 0, # Color 200, -150, 0) # Position # Blue directional light from the left directionalLight(0, 102, 255, # Color 1, 0, 0) # The x-, y-, z-axis direction # Yellow spotlight from the front spotLight(255, 255, 109, # Color 0, 40, 200, # Position 0, 10, 5, # Direction 90, 2) # Angle, concentration ambientLight(255, 0, 0); texture(texture1) shape(obj) box(100, 100, 200) ry += 0.02