content
stringlengths
7
1.05M
def data_provider(fn_data_provider): """Data provider decorator, allows another callable to provide the data for the test""" def test_decorator(fn): def repl(self, *args): for i in fn_data_provider(): try: fn(self, *i) except AssertionError: print("Assertion error caught with data set {}".format(i)) raise return repl return test_decorator
# Write It # Demonstrates writing to a text file # Запишем # Демонстрирует запись в текстовый файл # print("Creating a text file with the write() method.") print("Создаю текстовый файл методом write().") text_file = open("write_it_1.txt", "w") text_file.write("Line 1\n") text_file.write("This is line 2\n") text_file.write("That makes this line 3\n") text_file.close() # print("\nReading the newly created file.") print("\nЧитаю вновь созданный файл.") text_file = open("write_it_1.txt", "r") print(text_file.read()) text_file.close() # print("\nCreating a text file with the writelines() method.") print("\nСоздаю текстовый файл методом writelines().") text_file = open("write_it_2.txt", "w") lines = ["Line 1\n", "This is line 2\n", "That makes this line 3\n"] text_file.writelines(lines) text_file.close() # print("\nReading the newly created file.") print("\nЧитаю вновь созданный файл.") text_file = open("write_it_2.txt", "r") print(text_file.read()) text_file.close() # input("\n\nPress the enter key to exit.")
model_filename = "cifar10.model" data_filename = "cifar10.npz" model_url = "#" data_url = "https://github.com/danielwilczak101/EasyNN/raw/datasets/cifar/cifar10.npz" labels = { 0: "airplane", 1: "automobile", 2: "bird", 3: "cat", 4: "deer", 5: "dog", 6: "frog", 7: "horse", 8: "ship", 9: "truck" }
class Produto: # Classes começam com letra maiúscula #Construtor def __init__(self,nome,preco): self.nome = nome self.preco = preco #Getters @property def nome(self): return self.__nome @property def preco(self): return self.__preco #Setters @nome.setter def nome(self, vl_nome): self.__nome = str(vl_nome) @preco.setter def preco(self, vl_preco): #Se for uma string: Retira os espaços(strip(' ')) e troca o 'R$' por vazio if isinstance(vl_preco, str): vl_preco = float(vl_preco.strip(' ').replace('R$','')) #Tratamento de erro try: self.__preco = float(vl_preco) except Exception: print("[ERRO] Valores inválidos para Preco!")
#Normalmenet se declara asi #numero = 9 #La variable que se relaciona con la instancia de una clase class Persona: edad=18#Clase Persona con variable de clase que es edad def __init__(self,nombre,nacionalidad): self.nombre=nombre#variables de instancia self.nacionalidad=nacionalidad persona1= Persona("Jose","Mexicano") #Acceder a una variable de clase print(Persona.edad)# esta imprime (Variable de clase) #Creando objeto para imprimir print(Persona.nombre) para el objeto persona2 persona2=Persona("Franklin","Colombo-Argentino") print(persona2.nombre)# esta no imprime porque hay que crear el objeto (Variable de instancia)
# # PySNMP MIB module SIAE-IFEXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file://./sm_ifext.mib # Produced by pysmi-0.3.2 at Fri Jul 19 08:18:02 2019 # On host 0e190c6811ee platform Linux version 4.9.125-linuxkit by user root # Using Python version 3.7.3 (default, Apr 3 2019, 05:39:12) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") AlarmSeverityCode, AlarmStatus = mibBuilder.importSymbols("SIAE-ALARM-MIB", "AlarmSeverityCode", "AlarmStatus") siaeMib, = mibBuilder.importSymbols("SIAE-TREE-MIB", "siaeMib") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") ObjectIdentity, Counter64, Bits, Gauge32, MibIdentifier, iso, NotificationType, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, Unsigned32, IpAddress, Integer32, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "Counter64", "Bits", "Gauge32", "MibIdentifier", "iso", "NotificationType", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "Unsigned32", "IpAddress", "Integer32", "ModuleIdentity") DisplayString, RowStatus, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "TextualConvention") ifext = ModuleIdentity((1, 3, 6, 1, 4, 1, 3373, 1103, 73)) ifext.setRevisions(('2015-07-21 00:00', '2014-12-02 00:00', '2014-09-26 00:00', '2014-06-05 00:00', '2014-02-21 00:00', '2013-10-28 00:00',)) if mibBuilder.loadTexts: ifext.setLastUpdated('201507210000Z') if mibBuilder.loadTexts: ifext.setOrganization('SIAE MICROELETTRONICA spa') ifextMibVersion = MibScalar((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 1), Integer32().clone(1)).setMaxAccess("readonly") if mibBuilder.loadTexts: ifextMibVersion.setStatus('current') ifextTable = MibTable((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2), ) if mibBuilder.loadTexts: ifextTable.setStatus('current') ifextTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1), ).setIndexNames((0, "SIAE-IFEXT-MIB", "ifextIfIndex")) if mibBuilder.loadTexts: ifextTableEntry.setStatus('current') ifextIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: ifextIfIndex.setStatus('current') ifextLabel = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readonly") if mibBuilder.loadTexts: ifextLabel.setStatus('current') ifextAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3), ("loopback", 4))).clone('down')).setMaxAccess("readonly") if mibBuilder.loadTexts: ifextAdminStatus.setStatus('current') ifextPortUsage = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("unused", 0), ("lan", 1), ("radio", 2), ("mgmt", 3), ("stack", 4), ("aux", 5), ("pwe3", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ifextPortUsage.setStatus('current') ifextMediumType = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("copper", 1), ("fiber", 2), ("combo", 3), ("other", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ifextMediumType.setStatus('current') ifextMediumSelection = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("none", 0), ("copper", 1), ("fiber", 2))).clone('none')).setMaxAccess("readonly") if mibBuilder.loadTexts: ifextMediumSelection.setStatus('current') ifextAlarmReportEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disable", 1), ("enable", 2))).clone('enable')).setMaxAccess("readcreate") if mibBuilder.loadTexts: ifextAlarmReportEnable.setStatus('current') ifextSfpId = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifextSfpId.setStatus('current') ifextCapabilities = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 9), Bits().clone(namedValues=NamedValues(("ifextCapabilityLoop", 0), ("ifextCapability2g5Bps", 1), ("ifextCapabilityMabSensor", 2), ("ifextCapabilityEncrypt", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ifextCapabilities.setStatus('current') ifextLosAlarm = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 10), AlarmStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: ifextLosAlarm.setStatus('current') ifextRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 2, 1, 11), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: ifextRowStatus.setStatus('current') ifextMaintTable = MibTable((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 3), ) if mibBuilder.loadTexts: ifextMaintTable.setStatus('current') ifextMaintTableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 3, 1), ).setIndexNames((0, "SIAE-IFEXT-MIB", "ifextIfIndex")) if mibBuilder.loadTexts: ifextMaintTableEntry.setStatus('current') ifextLineLoop = MibTableColumn((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disable", 1), ("enable", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ifextLineLoop.setStatus('current') ifextLosAlarmSeverityCode = MibScalar((1, 3, 6, 1, 4, 1, 3373, 1103, 73, 5), AlarmSeverityCode().clone('majorTrapEnable')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ifextLosAlarmSeverityCode.setStatus('current') mibBuilder.exportSymbols("SIAE-IFEXT-MIB", ifextLabel=ifextLabel, ifextAlarmReportEnable=ifextAlarmReportEnable, ifextMaintTable=ifextMaintTable, ifextMediumType=ifextMediumType, ifextMaintTableEntry=ifextMaintTableEntry, ifextPortUsage=ifextPortUsage, ifextRowStatus=ifextRowStatus, ifextLineLoop=ifextLineLoop, ifextLosAlarm=ifextLosAlarm, ifextCapabilities=ifextCapabilities, ifextIfIndex=ifextIfIndex, ifextTableEntry=ifextTableEntry, ifextMibVersion=ifextMibVersion, PYSNMP_MODULE_ID=ifext, ifextSfpId=ifextSfpId, ifextTable=ifextTable, ifextLosAlarmSeverityCode=ifextLosAlarmSeverityCode, ifext=ifext, ifextMediumSelection=ifextMediumSelection, ifextAdminStatus=ifextAdminStatus)
"""Custom dataloaders for testing""" class CustomInfDataloader: def __init__(self, dataloader): self.dataloader = dataloader self.iter = iter(dataloader) self.count = 0 def __iter__(self): self.count = 0 return self def __next__(self): if self.count >= 50: raise StopIteration self.count = self.count + 1 try: return next(self.iter) except StopIteration: self.iter = iter(self.dataloader) return next(self.iter) class CustomNotImplementedErrorDataloader: def __init__(self, dataloader): self.dataloader = dataloader self.iter = iter(dataloader) self.count = 0 def __len__(self): """raise NotImplementedError""" raise NotImplementedError def __iter__(self): self.count = 0 return self def __next__(self): if self.count >= 50: raise StopIteration self.count = self.count + 1 try: return next(self.iter) except StopIteration: self.iter = iter(self.dataloader) return next(self.iter)
a = float(input("a = ")) b = float(input("b = ")) c = float(input("c = ")) if a==b==c: print('nothing') elif a==c: print(2) elif b==a: print(3) elif b==c: print(1) else: print('nothing')
""" Example Backup Plugin """ __import__("pkg_resources").declare_namespace(__name__)
# Copyright (c) 2020-2021 Matematyka dla Ciekawych Świata (http://ciekawi.icm.edu.pl/) # Copyright (c) 2020-2021 Robert Ryszard Paciorek <rrp@opcode.eu.org> # # MIT License # # 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 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. code_fun_A = r""" #include <stdio.h> void f1() { puts("Witaj Świecie"); } int main() { f1(); } """ code_fun_B = r""" #include <stdio.h> int f1() { puts("Witaj Świecie"); return 2; } int main() { int x = f1(); printf("x=%d\n", x); f1(); } """ code_fun_C = r""" #include <stdio.h> int f1(int a, float b) { puts("Witaj Świecie"); return 2*a + b; } int main() { int a = 3; int x = f1(a, 1.3); printf("x=%d\n", x); } """ try: clipData except NameError: clipData = [] clipData += [ { 'title': [ "#06.2", "Funkcje, struktury", "i tablice w C", "" ] }, { 'comment': 'C funkcje' }, { 'consoleTop': [ [0.0, eduMovie.clear + eduMovie.code2console(code_fun_A, "c")], ["funB", eduMovie.clear + eduMovie.code2console(code_fun_B, "c")], ["funC", eduMovie.clear + eduMovie.code2console(code_fun_C, "c")], ], 'consoleDown': [ [0.0, eduMovie.runCode(code_fun_A, args=["&& ./a.out"], cmd="gcc")], ["funB", eduMovie.runCode(code_fun_B, args=["&& ./a.out"], cmd="gcc")], ["funC", eduMovie.runCode(code_fun_C, args=["&& ./a.out"], cmd="gcc")], ], 'text' : [ 'C oczywiście pozwala nam na definiowanie własnych funkcji. <m>' 'Robimy to poprzez zapis: typ zwracany przez daną funkcję, <m> nazwa tej funkcji, nawiasy okrągłe oraz instrukcje, <m> które mają być wykonane w ramach funkcji ujęte w klamerki. <m>' 'Użyty w przykładzie typ void oznacza że funkcja nie zwraca wartości. <m>' 'Wywołanie funkcji odbywa się poprzez podanie jej nazwy <m> po której następują nawiasy okrągłe. <mark name="funB" />' 'Jeżeli chcielibyśmy żeby nasza funkcja zwracała jakąś wartość to używamy return. <m>' 'Wartość zwracaną przez funkcję możemy odebrać i na przykład zachować <m> w jakiejś zmiennej, możemy też ją zignorować. <mark name="funC" />' 'Funkcje mogą też przyjmować argumenty. <m>' 'Zmienne pod które zostaną podstawione argumenty zapisujemy <m> w nawiasach okrągłych po nazwie funkcji w jej definicji. <m>' 'Przed nazwami zmiennych podajemy ich typy, <m> a kolejne zmienne rozdzielamy przecinkami. <m>' 'Argumenty przekazywane do funkcji podajemy w nawiasach okrągłych <m> związanych z wywołaniem tej funkcji i także rozdzielamy je przecinkami. <m>' ] }, ]
""" Management of OpenStack Neutron Security Group Rules ==================================================== .. versionadded:: 2018.3.0 :depends: shade :configuration: see :py:mod:`salt.modules.neutronng` for setup instructions Example States .. code-block:: yaml create security group rule: neutron_secgroup_rule.present: - name: security_group1 - project_name: Project1 - protocol: icmp delete security group: neutron_secgroup_rule.absent: - name_or_id: security_group1 create security group with optional params: neutron_secgroup_rule.present: - name: security_group1 - description: "Very Secure Security Group" - project_id: 1dcac318a83b4610b7a7f7ba01465548 """ __virtualname__ = "neutron_secgroup_rule" def __virtual__(): if "neutronng.list_subnets" in __salt__: return __virtualname__ return ( False, "The neutronng execution module failed to load: shade python module is not available", ) def _rule_compare(rule1, rule2): """ Compare the common keys between security group rules against eachother """ commonkeys = set(rule1.keys()).intersection(rule2.keys()) for key in commonkeys: if rule1[key] != rule2[key]: return False return True def present(name, auth=None, **kwargs): """ Ensure a security group rule exists defaults: port_range_min=None, port_range_max=None, protocol=None, remote_ip_prefix=None, remote_group_id=None, direction='ingress', ethertype='IPv4', project_id=None name Name of the security group to associate with this rule project_name Name of the project associated with the security group protocol The protocol that is matched by the security group rule. Valid values are None, tcp, udp, and icmp. """ ret = {"name": name, "changes": {}, "result": True, "comment": ""} kwargs = __utils__["args.clean_kwargs"](**kwargs) __salt__["neutronng.setup_clouds"](auth) if "project_name" in kwargs: kwargs["project_id"] = kwargs["project_name"] del kwargs["project_name"] project = __salt__["keystoneng.project_get"](name=kwargs["project_id"]) if project is None: ret["result"] = False ret["comment"] = "Project does not exist" return ret secgroup = __salt__["neutronng.security_group_get"]( name=name, filters={"tenant_id": project.id} ) if secgroup is None: ret["result"] = False ret["changes"] = ({},) ret["comment"] = "Security Group does not exist {}".format(name) return ret # we have to search through all secgroup rules for a possible match rule_exists = None for rule in secgroup["security_group_rules"]: if _rule_compare(rule, kwargs) is True: rule_exists = True if rule_exists is None: if __opts__["test"] is True: ret["result"] = None ret["changes"] = kwargs ret["comment"] = "Security Group rule will be created." return ret # The variable differences are a little clumsy right now kwargs["secgroup_name_or_id"] = secgroup new_rule = __salt__["neutronng.security_group_rule_create"](**kwargs) ret["changes"] = new_rule ret["comment"] = "Created security group rule" return ret return ret def absent(name, auth=None, **kwargs): """ Ensure a security group rule does not exist name name or id of the security group rule to delete rule_id uuid of the rule to delete project_id id of project to delete rule from """ rule_id = kwargs["rule_id"] ret = {"name": rule_id, "changes": {}, "result": True, "comment": ""} __salt__["neutronng.setup_clouds"](auth) secgroup = __salt__["neutronng.security_group_get"]( name=name, filters={"tenant_id": kwargs["project_id"]} ) # no need to delete a rule if the security group doesn't exist if secgroup is None: ret["comment"] = "security group does not exist" return ret # This should probably be done with compare on fields instead of # rule_id in the future rule_exists = None for rule in secgroup["security_group_rules"]: if _rule_compare(rule, {"id": rule_id}) is True: rule_exists = True if rule_exists: if __opts__["test"]: ret["result"] = None ret["changes"] = {"id": kwargs["rule_id"]} ret["comment"] = "Security group rule will be deleted." return ret __salt__["neutronng.security_group_rule_delete"](rule_id=rule_id) ret["changes"]["id"] = rule_id ret["comment"] = "Deleted security group rule" return ret
#!/usr/bin/env python3 """ This is the exceptions file foi the CalculationsWithDots project """ class InvalidName(Exception): """ Description of InvalidName This Exception class is raised, if the given name is invalid. """ pass class InvalidCoordinate(Exception): """ Description of InvalidCoordinate This Exception class is raised, if the given coordinate is invalid. """ pass
# -*- coding: utf-8 -*- """@package Methods.Geometry.Segment.get_end Return the end point of an Segment method @date Created on Thu Jul 27 13:51:43 2018 @copyright (C) 2015-2016 EOMYS ENGINEERING. @author pierre_b @todo unittest it """ def get_end(self): """Return the end point of the segment Parameters ---------- self : Segment A Segment object Returns ------- end: complex End point of the Segment """ return self.end
# 456. 132 Pattern """ Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j]. Return true if there is a 132 pattern in nums, otherwise, return false. Follow up: The O(n^2) is trivial, could you come up with the O(n logn) or the O(n) solution? Input: nums = [3,1,4,2] Output: true Explanation: There is a 132 pattern in the sequence: [1, 4, 2]. """ class Solution: def find132pattern(self, nums: List[int]) -> bool: # Initialzed the stack stack = [] # Handling the edge case, if there are less than 3 elements if len(set(nums)) < 3: return False # Precomputing the minimum value array with first index same as first index of nums array # to get arr[i] in O(1) minVal = [nums[0]] for i in range(1, len(nums)): minVal.append(min(nums[i], minVal[-1])) # Loop over for "j" index from right to left as "i"th index is fixed and can be taken from minVal for i in range(len(nums) - 1, -1, -1): # If the ith element is greater than the minimim ith element then only move forward if nums[i] > minVal[i]: # Remove the value from the top of the stack if "arr[k]" is smaller than the minimum while stack and stack[-1] <= minVal[i]: stack.pop() # If arr[i] < arr[k] < arr[j], return True if stack and minVal[i] < stack[-1] < nums[i]: return True stack.append(nums[i]) return False
#!/usr/bin/python """ This is a collections of functions common to the other, individual pieces of this project """ __author__ = "AJ Wilson" __copyright__ = " " __license__ = " " __version__ = "0.0.0.0" __maintainer__ = "AJ Wilson" __email__ = "aj.wilson08[at]gmail.com" __status__ = "WIP" def function1(): return None
def fib(n): ''' uses generater to return fibonacci sequence up to given # n dynamically ''' a,b = 1,1 for _ in range(0,n): yield a a,b = b,a+b return a
def negate_literal(L): return L[1:] if L[0] == '!' else '!' + L def unit_subsumption(P, u): return [ C for C in P if u not in C ] def unit_resolution(P, u): n = negate_literal(u) return [ ([l for l in C if l != n]) for C in P ] def simplify(F, L): return unit_resolution(unit_subsumption(F, L), L) def get_unit(F): U = next((C for C in F if len(C) == 1), None) return U[0] if U else None def get_literal(F): return F[0][0] def contains_empty(F): return len([C for C in F if len(C) == 0]) > 0 def dpll(F): while True: L = get_unit(F) if not L: break F = simplify(F, L) if not F: return True if contains_empty(F): return False L = get_literal(F) return dpll(simplify(F, L)) or dpll(simplify(F, negate_literal(L))) def unit_propagation(P, v): while True: u = get_unit(P) if not u: break v[u] = 1 P = unit_subsumption(P, u) P = unit_resolution(P, u) return P, v # F = [ ('A', 'B'), ('!A', 'C'), ('B', '!C'), ('!A', '!B', '!C') ] # F = [ ('!A', 'B'), ('!B', 'C'), ('A', 'B', 'C'), ('A', '!C'), ('!A', '!B', '!C') ] # F = [ ('!x', 'y', '!z'), ('!x', 'z'), ('!y', 'x'), ('y') ] F = [ ('u', '!w'), ('u', '!z'), ('w', '!y'), ('w', '!x'), ('x', 'y', 'z') ] print(F) if dpll(F): print("F ist erfüllbar.") else: print("F ist unerfüllbar.") P = [ ('!x', 'y', '!z'), ('!x', 'z'), ('!y', 'x'), ('y') ] v = dict() print(P) P, v = unit_propagation(P, v) print(v)
config = { "qqGroup": "", "pro_ids": ['11111', '22222'], "daily": { "pro_ids": ['11111'] }, # "pk": { # "me": "22222", # "vs": ['33333'] # } "dailyInterval": 25, "pkInterval": 30 }
class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def swapPairs(self, head): if not head: return None if not head.next: return head curr = head after = head.next pre = None head = after while after: curr.next = after.next after.next = curr if pre: pre.next = after tmp = curr curr = after after = tmp if not after.next: break pre = curr.next curr = curr.next.next after = after.next.next print(pre.val) return head solution = Solution() a = ListNode(0) b = ListNode(1) c = ListNode(2) d = ListNode(3) a.next = b b.next = c x = solution.swapPairs(a) while x: print(x.val) x = x.next
#!/usr/bin/env python # -*- coding: utf-8 -*- """ # CODE NAME HERE # CODE DESCRIPTION HERE Created on 2019-01-17 at 14:31 @author: cook """ __all__ = [] # ============================================================================= # Define functions # ============================================================================= # ============================================================================= # End of code # =============================================================================
{ 'targets': [ { 'target_name': 'brotli', 'type': 'static_library', 'include_dirs': ['c/include'], 'conditions': [ ['OS=="linux"', { 'defines': [ 'OS_LINUX' ] }], ['OS=="freebsd"', { 'defines': [ 'OS_FREEBSD' ] }], ['OS=="mac"', { 'defines': [ 'OS_MACOSX' ] }], ], 'direct_dependent_settings': { 'include_dirs': [ 'c/include' ] }, 'libraries': [ '-lm', ], 'sources': [ # Common 'c/common/dictionary.c', 'c/common/transform.c', # Decoder 'c/dec/bit_reader.c', 'c/dec/decode.c', 'c/dec/huffman.c', 'c/dec/state.c', # Encoder 'c/enc/backward_references.c', 'c/enc/backward_references_hq.c', 'c/enc/bit_cost.c', 'c/enc/block_splitter.c', 'c/enc/brotli_bit_stream.c', 'c/enc/cluster.c', 'c/enc/compress_fragment.c', 'c/enc/compress_fragment_two_pass.c', 'c/enc/dictionary_hash.c', 'c/enc/encode.c', 'c/enc/encoder_dict.c', 'c/enc/entropy_encode.c', 'c/enc/histogram.c', 'c/enc/literal_cost.c', 'c/enc/memory.c', 'c/enc/metablock.c', 'c/enc/static_dict.c', 'c/enc/utf8_util.c' ] } ] }
'''Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que ele foi multado. A multa vai custar R$7,00 por cada Km acima do limite.''' print('-=-' *20) velocidade = float(input('\033[1mQual é a velocidade atual do carro?\033[m ')) print('-=-' *20) if velocidade > 80: print('\033[1;31mMULTADO!\033[m Você excedeu o \033[33mlimite permitido que é 80 Km/h.\033[m') multa = (velocidade -80 ) * 7 print ('Você deve pagar uma \033[1;31mmulta de R${:.2f}\033[m'.format(multa)) print('Tenha um bom dia! Dirija com segurança!')
{ 'variables': { 'base_cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', '-std=c++11', ], 'debug_cflags': ['-g', '-O0'], 'release_cflags': ['-O3'], }, 'targets': [ { 'target_name': 'tonclient', 'sources': ['binding.cc'], 'conditions': [ ['OS == "win"', { 'libraries': [ '../tonclient.lib', 'advapi32.lib', 'ws2_32.lib', 'userenv.lib', 'shell32.lib', 'Secur32.lib', 'Crypt32.lib', ], }, { 'libraries': [ '../libtonclient.a', '-Wl,-rpath,./addon/' ], }], ], 'configurations': { 'Debug': { 'cflags': ['<@(debug_cflags)'], 'xcode_settings': { 'OTHER_CFLAGS': ['<@(debug_cflags)'], }, }, 'Release': { 'cflags': ['<@(release_cflags)'], 'xcode_settings': { 'OTHER_CFLAGS': ['<@(release_cflags)'], }, }, }, 'cflags': ['<@(base_cflags)'], 'xcode_settings': { 'OTHER_CFLAGS': ['<@(base_cflags)'], }, }, ], }
int1 = input("Enter first integer: ") int2 = input("Enter second integer: ") sum = int(int1) + int(int2) if sum in range(105, 201): print(200)
nome = input('Qual o seu nome, meu chapa? ') # print('Seja bem vindo meu camarada, ' + nome + '!') # print('Seja bem vindo meu camarada, {:20}!'.format(nome)) //Em 20 espaços # print('Seja bem vindo meu camarada, {:>20}!'.format(nome)) //Em 20 espaços e alinhado esquerda # print('Seja bem vindo meu camarada, {:^20}!'.format(nome)) //Em 20 espaços e centralizado print('Seja bem vindo meu camarada, {:=^20}!'.format(nome)) print('') print('='*100)
class Documents: def __init__(self, session): self.session = session def index_documents(self, content_source_key, documents, **kwargs): """Index a batch of documents in a content source. Raises :class:`~elastic_workplace_search.NonExistentRecord` if the content_source_key is malformed or invalid. Raises :class:`~elastic_workplace_search.WorkplaceSearchError` if there are any HTTP errors. :param content_source_key: Key for the content source. :param documents: Array of documents to be indexed. :return: Array of document indexing results. >>> from elastic_workplace_search import Client >>> from elastic_workplace_search.exceptions import WorkplaceSearchError >>> content_source_key = 'content source key' >>> authorization_token = 'authorization token' >>> client = Client(authorization_token) >>> documents = [ { 'id': '1', 'url': 'https://github.com/elastic/workplace-search-python', 'title': 'Elastic Workplace Search Official Python client', 'body': 'A descriptive body' } ] >>> try: >>> document_results = client.documents.index_documents(content_source_key, documents) >>> print(document_results) >>> except WorkplaceSearchError: >>> # handle exception >>> pass [{'errors': [], 'id': '1', 'id': None}] """ return self._async_create_or_update_documents(content_source_key, documents) def delete_documents(self, content_source_key, ids): """Destroys documents in a content source by their ids. Raises :class:`~elastic_workplace_search.NonExistentRecord` if the content_source_key is malformed or invalid. Raises :class:`~elastic_workplace_search.WorkplaceSearchError` if there are any HTTP errors. :param content_source_key: Key for the content source. :param ids: Array of document ids to be destroyed. :return: Array of result dicts, with keys of `id` and `status` >>> from elastic_workplace_search import Client >>> from elastic_workplace_search.exceptions import WorkplaceSearchError >>> content_source_key = 'content source key' >>> authorization_token = 'authorization token' >>> client = Client(authorization_token) >>> try: >>> response = client.documents.delete_documents(content_source_key, ['1']) >>> print(response) >>> except WorkplaceSearchError: >>> # handle exception >>> pass [{"id": '1',"success": True}] """ endpoint = "sources/{}/documents/bulk_destroy".format( content_source_key) return self.session.request('post', endpoint, json=ids) def _async_create_or_update_documents(self, content_source_key, documents): endpoint = "sources/{}/documents/bulk_create".format(content_source_key) return self.session.request('post', endpoint, json=documents)
movie_name = ['加勒比海盗', '骇客帝国', '第一滴血', '指环王', '霍比特人', '速度与激情'] print('------删除之前--------') for temp in movie_name: print(temp) del movie_name[2] print('--------删除之后---------') for temp in movie_name: print(temp)
# Create Plotter acc_plotter = skdiscovery.data_structure.series.accumulators.Plotter('Plotter') # Create stage containter for Plotter sc_plotter = StageContainer(acc_plotter)
# https://leetcode.com/problems/binary-watch/ # # algorithms # Easy (45.81%) # Total Accepted: 69,493 # Total Submissions: 151,697 class Solution(object): def readBinaryWatch(self, num): """ :type num: int :rtype: List[str] """ hour = [1, 2, 4, 8] minute = [1, 2, 4, 8, 16, 32] res = [] h_arr, m_arr = [], [] def recursive(arr, idx, length, tmp, res_arr): arr_len = len(arr) if length == 0: res_arr.append(tmp) return if idx >= arr_len: return for i in xrange(idx, arr_len): recursive(arr, i + 1, length - 1, tmp + arr[i], res_arr) for i in xrange(0, num + 1): h_arr, m_arr = [], [] recursive(hour, 0, i, 0, h_arr) recursive(minute, 0, num - i, 0, m_arr) for h in h_arr: if h > 11: continue for m in m_arr: if m > 59: continue tmp = str(h) + ':' + ('0' if m < 10 else '') + str(m) res.append(tmp) return res
""" An *example* .bzl file. You will find here a rule, a macro and the implementation function for the rule. """ def custom_macro(name, format, srcs=[]): '''Custom macro documentation example. Args: :param format: The format to write check report in. :param srcs: Source files to run the checks against. ''' pass def __impl_custom_build_rule(ctx): """Documentation of the custom_build_rule implementation.""" filesd = None return [DefaultInfo(files=filesd)] custom_build_rule = rule( implementation = __impl_custom_build_rule, doc = """Explanation of **custom_build_rule**. Taken from `doc` attribute of rule definition. """, attrs = { "targets": attr.label( mandatory=True, allow_files=True, doc="List of dependency rules which are building libraries"), "package_name": attr.string( mandatory=True, doc="Test string"), "package_script": attr.label( mandatory=False, default="//scripts:doc_gen_logger.py", allow_single_file=True, doc="Python script for simple file packaging"), } )
# ---------------------------------------------------------------------- # ctokens.py # # Token specifications for symbols in ANSI C and C++. This file is # meant to be used as a library in other tokenizers. # ---------------------------------------------------------------------- # Reserved words tokens = [ # Literals (identifier, integer constant, float constant, string constant, char const) 'ID', 'TYPEID', 'INTEGER', 'FLOAT', 'STRING', 'CHARACTER', # Operators (+,-,*,/,%,|,&,~,^,<<,>>, ||, &&, !, <, <=, >, >=, ==, !=) 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MODULO', 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT', 'LOR', 'LAND', 'LNOT', 'LT', 'LE', 'GT', 'GE', 'EQ', 'NE', # Assignment (=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=) 'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', 'PLUSEQUAL', 'MINUSEQUAL', 'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', 'OREQUAL', # Increment/decrement (++,--) 'INCREMENT', 'DECREMENT', # Structure dereference (->) 'ARROW', # Ternary operator (?) 'TERNARY', # Delimeters ( ) [ ] { } , . ; : 'LPAREN', 'RPAREN', 'LBRACKET', 'RBRACKET', 'LBRACE', 'RBRACE', 'COMMA', 'PERIOD', 'SEMI', 'COLON', # Ellipsis (...) 'ELLIPSIS', ] # Operators t_PLUS = r'\+' t_MINUS = r'-' t_TIMES = r'\*' t_DIVIDE = r'/' t_MODULO = r'%' t_OR = r'\|' t_AND = r'&' t_NOT = r'~' t_XOR = r'\^' t_LSHIFT = r'<<' t_RSHIFT = r'>>' t_LOR = r'\|\|' t_LAND = r'&&' t_LNOT = r'!' t_LT = r'<' t_GT = r'>' t_LE = r'<=' t_GE = r'>=' t_EQ = r'==' t_NE = r'!=' # Assignment operators t_EQUALS = r'=' t_TIMESEQUAL = r'\*=' t_DIVEQUAL = r'/=' t_MODEQUAL = r'%=' t_PLUSEQUAL = r'\+=' t_MINUSEQUAL = r'-=' t_LSHIFTEQUAL = r'<<=' t_RSHIFTEQUAL = r'>>=' t_ANDEQUAL = r'&=' t_OREQUAL = r'\|=' t_XOREQUAL = r'\^=' # Increment/decrement t_INCREMENT = r'\+\+' t_DECREMENT = r'--' # -> t_ARROW = r'->' # ? t_TERNARY = r'\?' # Delimeters t_LPAREN = r'\(' t_RPAREN = r'\)' t_LBRACKET = r'\[' t_RBRACKET = r'\]' t_LBRACE = r'\{' t_RBRACE = r'\}' t_COMMA = r',' t_PERIOD = r'\.' t_SEMI = r';' t_COLON = r':' t_ELLIPSIS = r'\.\.\.' # Identifiers t_ID = r'[A-Za-z_][A-Za-z0-9_]*' # Integer literal t_INTEGER = r'\d+([uU]|[lL]|[uU][lL]|[lL][uU])?' # Floating literal t_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?' # String literal t_STRING = r'\"([^\\\n]|(\\.))*?\"' # Character constant 'c' or L'c' t_CHARACTER = r'(L)?\'([^\\\n]|(\\.))*?\'' # Comment (C-Style) def t_COMMENT(t): r'/\*(.|\n)*?\*/' t.lexer.lineno += t.value.count('\n') return t # Comment (C++-Style) def t_CPPCOMMENT(t): r'//.*\n' t.lexer.lineno += 1 return t
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # ----------------------------------------------------------------------------- # # P A G E B O T # # Copyright (c) 2016+ Buro Petr van Blokland + Claudia Mens # www.pagebot.io # Licensed under MIT conditions # # Supporting DrawBot, www.drawbot.com # Supporting Flat, xxyxyz.org/flat # ----------------------------------------------------------------------------- # # nanostyle.css.py # # CSS file as Python string. This avoids the use (and install of SCSS) and is # much more flexible, as it as adapt to conditions, calculation and the usage of # selections of Theme/Palette instances. # # Since we'll be translating the ^(label)s directly by the theme.mood, all "%" # should be escaped by a double "%%" # # https://css-tricks.com/font-size-viewport-units/ # https://css-tricks.com/almanac/properties/f/font-size/ # https://css-tricks.com/books/volume-i/scale-typography-screen-size/ cssPy = """ body { background-color: #%(body.fill)s; color: #%(body.textFill)s; font-family: 'Upgrade-Regular', sans-serif; font-size: 17px; line-height: 1.4em; font-weight: normal; letter-spacing: 0.025em; margin: 8px; /* Margin between all page content and window */ } img { width: 100%%; } p { font-size: 1em; font-family: 'Upgrade-Regular'; } p em { font-style: normal; font-family: 'Upgrade-RegularItalic'; } p strong, li strong { font-weight: normal; font-family: 'Upgrade-Semibold'; } a { text-decoration: none; color: #%(p.textLink)s; } a:hover { text-decoration: none; color: #%(p.textHover)s; background-color: #%(p.fill)s; } ul { padding: 0 0 0 20px; } /* Heading */ h1, h2, h3, h4, h5, h6 { font-weight: normal; font-family: 'Upgrade-Regular', sans-serif; margin: .45em 0; padding: 0; } h1 {font-size: 2em; line-height: 1.2em;} h2 {font-size: 1.75em; line-height: 1.2em;} h3 {font-size: 1.5em; line-height: 1.2em;} h4 {font-size: 1.25em; line-height: 1.2em;} h5 {font-size: 1em; line-height: 1.2em;} p {font-size: 1em; line-height: 1.4em;} h1 { font-family: 'Upgrade-Semibold', sans-serif; margin: 0; color: #%(h1.textFill)s; } h1 a { color: #%(h1.textLink)s; } h1 a:hover { color: #%(h1.textHover)s; background-color: none; } h2 a { color: #%(h2.textLink)s; background-color: none; } h2 a:hover { color: #%(h2.textHover)s; background-color: none; } h3 a { color: #%(h3.textLink)s; background-color: none; } h3 a:hover { color: #%(h3.textHover)s; background-color: none; } h4 a { color: #%(h4.textLink)s; background-color: none; } h4 a:hover { color: #%(h4.textHover)s; background-color: none; } h5 a { color: #%(h5.textLink)s; background-color: none; } h5 a:hover { color: #%(h5.textHover)s; background-color: none; } /* Debugging */ .cssId { /* Debug showing e.cssId */ font-size: 1em; color: yellow; background-color: red; } /* Overall layout */ .wrapper, .content, .footer { display: grid; grid-template-columns: 1fr; column-gap: 10px; row-gap: 10px; background-color: #%(page.fill)s; } .header { display: block; background-color: #%(page.fill)s; } .clearfix { overflow: auto; /* CSS hack to grow div including all child content. */ } .textbox { width: 100%%; } /* Logo */ .logo { float: left; width: 30%%; padding: 0.5em 0 0 1em; } .logo h1 { font-size: 2em; font-family: 'Upgrade-Medium'; letter-spacing: 0.015em; color: #%(logo.textFill)s; } /* Rulers */ .main hr { border: 8px solid #%(hr2.stroke)s; } .side hr { border: 1px solid #%(hr2.stroke)s; } /* Desktop navigation/menu */ nav.navigation { float: right; width: 60å%%; padding: 0.75em 1em 0 0; z-index: 1000; } .navigation-menu { float: right; /* overflow: auto; CSS hack to grow div including all child content. */ } ul.navmenu { list-style: none; padding: 0; margin: 0; background-color: #%(menu.fill)s; } ul.navmenu li { display: block; position: relative; float: left; background: #%(menu.fill)s; } li ul.navmenu { display: none; z-index: 1000; } li:hover > ul.navmenu { display: block; position: absolute; } ul.navmenu li a { display: block; padding: 6px 12px; text-decoration: none; white-space: nowrap; color: #%(menu.textLink)s; margin-right: 0px; } ul.navmenu li a:hover { color: #ccc; background-color: #%(menu.textHover)s; } li:hover ul.navmenu { display: block; position: absolute; } /* li:hover li { float: none; } */ li:hover a { background-color: #%(menu.fill)s; } li:hover li a:hover { background-color: #%(menu.fillHover)s; color: #%(li.textHover)s; } .main-navigation li ul.navmenu li { border-top: 0; } /* 80%% to prevent menu's running off from the right side? */ ul.navmenu ul.navmenu ul.navmenu { left: 100%%; top: 0; margin-right: } ul.navmenu:before, ul.navmenu:after { content: " "; /* 1 */ display: table; /* 2 */ } ul.navmenu:after { clear: both; } /* Mobile menu and BurgerButton */ .menu { } .burgerbutton { float: right; display: none; padding-top: 0.5em; } .mobilemenu { display: none; } .mobilemenu .button, .mobilemenu .button2 { color: #%(mobilemenu.textLink)s; background-color: #%(mobilemenu.fill)s; border: none; width: 100%%; margin: 2px 0; padding: 6px; text-align: center; text-decoration: none display: inline-block; font-size: 3em; font-family: 'Upgrade-Medium', sans-serif; } .mobilemenu .button2 { color: #%(base3)s; font-size: 2em; padding: 5px; font-family: 'Upgrade-MediumItalic', sans-serif; } /* Banner on full width */ .banner { padding: 6pt 0; margin: 6pt 0 6pt 0; background-color: #%(banner.fill)s; } .banner .textbox h1 { font-size: 3em; line-height: 1.3em; font-family: 'Upgrade-Regular', sans-serif; color: #%(banner.textFill)s; } /* Collection */ .collection { background-color: #%(collection.fill)s; } .collectionelement{ margin: 6px 2px 0 0; /* Width is defined by collection container depending on the amount of child elements. */ } .introduction { background-color: #%(intro.fill)s; padding: 1em; } .introduction .textbox h1 { font-size: 3em; line-height: 1.2em; font-family: 'Upgrade-Light', sans-serif; color: #%(intro.textFill)s; } .introduction .textbox h1 a { font-family: 'Upgrade-Book', sans-serif; color: #%(intro.textLink)s; } .introduction .textbox h1 a:hover { color: #%(intro.textHover)s; } /* Slide show */ .slideshowgroup { display: grid; grid-template-columns: 2fr 1fr; column-gap: 10px; row-gap: 10px; background-color: #%(group.fillDiap)s; } .slideshow { background-color: #%(group.fillDiap)s; } .slideside { background-color: #%(group.fillDiap)s; padding: 0 1em 1em 0; } .slideside .textbox h1 { color: #%(h2.textFillDiap)s; letter-spacing: 0.025em; font-size: 1.4em; line-height: 1.2em; font-family: 'Upgrade-Regular'; } .slideside .textbox h1 a { color: #%(base3)s; } .slideside .textbox h1 a:textHover { color: #%(base3.colorFront)s; } .slideside .textbox h2 { color: #%(h2.textFillDiap)s; letter-spacing: 0.025em; font-size: 1.4em; line-height: 1.2em; font-family: 'Upgrade-Regular'; } .slideside .textbox h3 { color: #%(h3.textFillDiap)s; letter-spacing: 0.025em; font-size: 1.1em; line-height: 1.2em; font-family: 'Upgrade-Medium'; } .slideside .textbox p { color: #%(p.textFillDiap)s; letter-spacing: 0.025em; font-size: 1em; line-height: 1.4em; font-family: 'Upgrade-Regular'; } .slideside .textbox p em { fony-style: normal; font-family: 'Upgrade-RegularItalic'; } sup { /* Superior number <sup> by Upgrade OT-feature */ top: 0em; color: #%(p.textFill)s; font-size: inherit; vertical-align: inherit; -moz-font-feature-settings:"sups=1"; -moz-font-feature-settings:"sups"; -ms-font-feature-settings:"sups"; -webkit-font-feature-settings:"sups"; font-feature-settings:"sups"; } h1 sup { /* Superior Scale number in h1 */ color: #%(h1.textFill)s; } li sup { /* Superior Scale number in Menu */ color: #%(li.textFill)s; } /* Content */ .content { padding:1em; } .caption .textbox { font-family: 'Upgrade-RegularItalic'; font-size: 1em; line-height: 1.4em; } .section { display: grid; grid-template-columns: 2fr 1fr; column-gap: 10px; row-gap: 10px; background-color: #%(base2.colorBack)s; } .mains { display: grid; grid-template-columns: 1fr; column-gap: 10px; row-gap: 10px; } .main { padding: 0 %(side.pr)s; border-top: 15px solid #%(hr.stroke)s; } .sides { display: grid; grid-template-columns: 1fr; column-gap: 10px; row-gap: 10px; } .side { padding: 0 %(side.pr)s; border-top: 15px solid #%(hr.stroke)s; } /* Cropped has attribute background-image and optional floating elements inside.*/ .cropped { padding: 0; border-top: 15px solid #%(hr.stroke)s; } /* Solve Cropped empty <p> first. .cropped .textbox { padding: 0.5em 1em; background-color: rgba(255, 255, 255, 0.8); } */ /* Info area, open/clode by button */ .info { margin: 0; padding: 0; } .info-opened{ display: none; } .info-closed{ display: block; } .info-doopen, .info-doclose { /* [?] button, [x] button */ float: right; margin: 0; text-align: center; padding: 0.2em 0.5em; height: 1em; width: 1em; font-size: 1.5em; background-color: #%(base3)s; /* Buttons in logo color */ color: #%(base3.colorMostBack)s; } .footer { } /**************************************** ***************************************** MEDIAQUERIES ***************************************** ****************************************/ @media only screen and (max-width: 800px) { body { /*background-color: red;*/ margin: 0; } h1 {font-size: 2.4em; line-height: 1.15em;} h2 {font-size: 2.2em; line-height: 1.15em;} h3 {font-size: 1.8em; line-height: 1.15em;} h4 {font-size: 1.4em; line-height: 1.15em;} h5 {font-size: 1.25em; line-height: 1.15em;} p, li {font-size: 1.25em; line-height: 1.3em;} .logo { width: 80%%; } .logo h1 { font-size: 1.5em; } .burgerbutton { float: right; display: block; margin-right: 12pt; } nav.navigation { display: none; } .menu { display: none; } .mobilemenu { float: left; width: 100%%; display: none; } .mobilemenu .button { font-size: 2em; } .mobilemenu .button2 { font-size: 1.5em; } .banner .textbox h1 { font-size: 2.4em; line-height: 1.15em; } .banner .textbox h2 { font-size: 2.2em; line-height: 1.15em; } .banner .textbox p { font-size: 1.25em; line-height: 1.3em; } .slideshowgroup { grid-template-columns: 1fr; } .slideside { padding-left: 12pt; padding-right: 12pt; } .slideside .textbox p { font-size: 1.25em; line-height: 1.3em; } .introduction .textbox h1 { font-size: 2.25em; line-height: 1.2em; } .caption .textbox { font-family: 'Upgrade-RegularItalic'; font-size: 1.25em; line-height: 1.3em; } .section { display: grid; grid-template-columns: 1fr; } .cropped { height: 60vw; /* 60%% of view-port width. */ border-top: none; } } @media only screen and (min-width: 800px) { body { /*background-color: cyan;*/ } h1 {font-size: 3em; line-height: 1.2em;} h2 {font-size: 2em; line-height: 1.2em;} h3 {font-size: 1.6em; line-height: 1.2em;} h4 {font-size: 1.25em; line-height: 1.2em;} h5 {font-size: 1em; line-height: 1.2em;} p, li {font-size: 1em; line-height: 1.4em;} .header { grid-template-columns: 1fr 2fr; } .logo h1 { font-size: 1.6em; } .navigation { display: block; } .burgerbutton, .mobilemenu { display: none; } .banner .textbox h1 { font-size: 3em; line-height: 1em; } } @media only screen and (min-width: 1000px) { body { /*background-color: orange;*/ } .header { grid-template-columns: 2fr 3fr; } .logo h1 { font-size: 2em; } .navigation { display: block; } .burgerbutton, .mobilemenu { display: none; } .banner .textbox h1 { font-size: 2.5em; line-height: 1.1em; } } @media only screen and (min-width: 1200px) { body { /*background-color: blue;*/ } .wrapper { width: 1200px; margin: auto; } .navigation { display: block; } .burgerbutton, .mobilemenu { display: none; } } /* PRINT STYLESHEET */ @media print { * { background: transparent !important; color: black !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; } /* Black prints faster: h5bp.com/s */ a, a:visited { text-decoration: underline; } a[href]:after { content: " (" attr(href) ")"; } abbr[title]:after { content: " (" attr(title) ")"; } .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } /* Don't show links for images, or javascript/internal links */ pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } thead { display: table-header-group; } /* h5bp.com/t */ tr, img { page-break-inside: avoid; } img { max-width: 100%% !important; } @page { margin: 0.5cm; } p, h2, h3 { orphans: 3; widows: 3; } h2, h3 { page-break-after: avoid; } """
twitch_icon = "<:twitch:404633403603025921> " cmd_fail = "<:tickNo:342738745092734976> " cmd_success = "<:tickYes:342738345673228290> " loading = "<a:loading:515632705262583819> " bullet = "<:bullet:516382013779869726> " right_arrow_alt = "<:arrow:343407434746036224>" left_arrow = "<a:a_left_arrow:527634992415899650>" right_arrow = "<a:a_right_arrow:527634993015685130>"
list_a = [10, 20, 30] list_b = ["Jan", "Peter", "Max"] list_c = [True, False, True] for val_a, val_b, val_c in zip(list_a, list_b, list_c): print(val_a, val_b, val_c) print("\n") for i in range(len(list_a)): print(i, list_a[i]) print("\n") for i, val in enumerate(list_a): print(i, val)
class ViewDisplaySketchyLines(object,IDisposable): """ Represents the settings for sketchy lines. """ def Dispose(self): """ Dispose(self: ViewDisplaySketchyLines) """ pass def ReleaseUnmanagedResources(self,*args): """ ReleaseUnmanagedResources(self: ViewDisplaySketchyLines,disposing: bool) """ 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 def __repr__(self,*args): """ __repr__(self: object) -> str """ pass EnableSketchyLines=property(lambda self: object(),lambda self,v: None,lambda self: None) """True to enable sketchy lines visibility. False to disable it. Get: EnableSketchyLines(self: ViewDisplaySketchyLines) -> bool Set: EnableSketchyLines(self: ViewDisplaySketchyLines)=value """ Extension=property(lambda self: object(),lambda self,v: None,lambda self: None) """The extension scale value. Controls the magnitude of line's extension. Values between 0 and 10. Get: Extension(self: ViewDisplaySketchyLines) -> int Set: Extension(self: ViewDisplaySketchyLines)=value """ IsValidObject=property(lambda self: object(),lambda self,v: None,lambda self: None) """Specifies whether the .NET object represents a valid Revit entity. Get: IsValidObject(self: ViewDisplaySketchyLines) -> bool """ Jitter=property(lambda self: object(),lambda self,v: None,lambda self: None) """The jitter defines jitteriness of the line. Values between 0 and 10. Get: Jitter(self: ViewDisplaySketchyLines) -> int Set: Jitter(self: ViewDisplaySketchyLines)=value """
# # @lc app=leetcode id=977 lang=python3 # # [977] Squares of a Sorted Array # # https://leetcode.com/problems/squares-of-a-sorted-array/description/ # # algorithms # Easy (72.86%) # Total Accepted: 56.2K # Total Submissions: 77.7K # Testcase Example: '[-4,-1,0,3,10]' # # Given an array of integers A sorted in non-decreasing order, return an array # of the squares of each number, also in sorted non-decreasing order. # # # # # Example 1: # # # Input: [-4,-1,0,3,10] # Output: [0,1,9,16,100] # # # # Example 2: # # # Input: [-7,-3,2,3,11] # Output: [4,9,9,49,121] # # # # # Note: # # # 1 <= A.length <= 10000 # -10000 <= A[i] <= 10000 # A is sorted in non-decreasing order. # # # # class Solution: def sortedSquares(self, A: List[int]) -> List[int]: # left,right=0,len(A)-1 # sol=[_ for _ in range(len(A))] # for i in range(len(A)-1,-1,-1): # if abs(A[left])>abs(A[right]): # sol[i]=A[left]*A[left] # left+=1 # else: # sol[i]=A[right]*A[right] # right-=1 # return sol return sorted(x*x for x in A)
PATH_DATA = "../train_data/pan20-author-profiling-training-2020-02-23" PATH_DATA_EN = "../train_data/pan20-author-profiling-training-2020-02-23/en" PATH_DATA_ES = "../train_data/pan20-author-profiling-training-2020-02-23/es" PATH_DATA_EN_TRUTH = "../train_data/pan20-author-profiling-training-2020-02-23/en/truth.txt" PATH_DATA_ES_TRUTH = "../train_data/pan20-author-profiling-training-2020-02-23/es/truth.txt" PATH_EXPR = "../expr" PATH_MODELS = "../models" PATH_OUT = "../out" PATH_IMGS = "../imgs" #D2V D2V_EPOCHS = 50 D2V_LR = 0.01 D2V_VS = 100 #TPOT TPOT_OUT = 2 #EXTENDED_TFIDF parametersWide = {"loss":["hinge","log","modified_huber"], \ "penalty":["elasticnet"],"alpha":[0.01,0.001,0.0001,0.0005],\ "l1_ratio":[0.05,0.25,0.3,0.6,0.8,0.95], \ "power_t":[0.5,0.1,0.9]} #TIRA_ONE_PARAMTERES parametersTIRA_DIMS = [256,512,768] parametersTIRA_FEATURES = [2500,5000,10000,15000] parametersTIRA_GS1 = {"loss":["hinge","log"],\ "penalty":["elasticnet"],\ "alpha":[0.01,0.001,0.0001,0.0005],\ "l1_ratio":[0.05,0.25,0.3,0.6,0.8,0.95],\ "power_t":[0.5,0.1,0.9]} parametersTIRA_GS2 = {"C":[0.1,1,10,25,50,100,500],"penalty":["l2"]}
__all__ = ['Meta'] class Meta: pass
# Copyright (c) 2019 zfit # TODO: improve errors of models. Generate more general error, inherit and use more specific? class PDFCompatibilityError(Exception): pass class LogicalUndefinedOperationError(Exception): pass class ExtendedPDFError(Exception): pass class AlreadyExtendedPDFError(ExtendedPDFError): pass class NotExtendedPDFError(ExtendedPDFError): pass class ConversionError(Exception): pass class SubclassingError(Exception): pass class BasePDFSubclassingError(SubclassingError): pass class IntentionNotUnambiguousError(Exception): pass class UnderdefinedError(IntentionNotUnambiguousError): pass class LimitsUnderdefinedError(UnderdefinedError): pass class OverdefinedError(IntentionNotUnambiguousError): pass class LimitsOverdefinedError(OverdefinedError): pass class AxesNotUnambiguousError(IntentionNotUnambiguousError): pass class NotSpecifiedError(Exception): pass class LimitsNotSpecifiedError(NotSpecifiedError): pass class NormRangeNotSpecifiedError(NotSpecifiedError): pass class AxesNotSpecifiedError(NotSpecifiedError): pass class ObsNotSpecifiedError(NotSpecifiedError): pass # Parameter Errors class NameAlreadyTakenError(Exception): pass # Operation errors class IncompatibleError(Exception): pass class ShapeIncompatibleError(IncompatibleError): pass class ObsIncompatibleError(IncompatibleError): pass class SpaceIncompatibleError(IncompatibleError): pass class LimitsIncompatibleError(IncompatibleError): pass class ModelIncompatibleError(IncompatibleError): pass # Data errors class WeightsNotImplementedError(Exception): pass # Minimizer errors class NotMinimizedError(Exception): pass # Runtime Errors class NoSessionSpecifiedError(Exception): pass # PDF class internal handling errors class NormRangeNotImplementedError(Exception): """Indicates that a function does not support the normalization range argument `norm_range`.""" pass class MultipleLimitsNotImplementedError(Exception): """Indicates that a function does not support several limits in a :py:class:`~zfit.Space`.""" pass # Developer verbose messages class DueToLazynessNotImplementedError(Exception): """Only for developing purpose! Does not serve as a 'real' Exception.""" pass
# Analisando Triângulo v1.0 #a soma de dois lados é sempre menor que o terceiro lado. print('-=-' * 10) print('Analisador de triangulos') print('-=-' * 10) r1 = float(input('Primeiro segmento: ')) r2 = float(input('Segundo segmento: ')) r3 = float(input('Terceiro segmento: ')) soma12 = r1 + r2 soma13 = r1 + r3 soma23 = r2 +r3 if soma12 > r3 and soma13 > r2 and soma23 > r1: print('Os segmentos acima podem formar um triângulo!') else: print('Os segmentos fornecidos acima NÃO podem formar um triângulo!')
def good(): return ['Harry', 'Ron', 'Hermione'] # expected output: ''' ['Harry', 'Ron', 'Hermione'] ''' print( good() )
glosario = {'listas' : "Se pueden identificar con []", 'tuplas' : "Se identifican con *()", 'glosario' : "Se identifican con {}", 'if' : "Condicional", 'for' : "Ciclo", '#' : "Para crear un comentario", 'str' : "Abreviacion de String", '==' : "usado para comparar elementos", "=!" : "Usado para verificar que dos elementos son diferentes", 'and' : "Usado en condicionales para comprar mas formas a los elementos"} for clave in glosario.values(): print(clave.title())
n = 8 fib0 = 0 fib1 = 1 if n > 0: temp = fib0 fib0 = fib1 fib1 = fib1 + temp n = n - 1 else: print(f'Resultado {fib0}')
class Solution(object): def maxSlidingWindow(self, nums, k): """ :type nums: List[int] :type k: int :rtype: List[int] """ que, len1, len2 = [], 0, len(nums) ans = [] for i in range(k): while len1 > 0 and nums[i] >= que[-1][0]: que.pop() len1 -= 1 que.append((nums[i], i)) len1 += 1 for i in range(k, len2): ans.append(que[0][0]) if i - que[0][1] >= k: del que[0] len1 -= 1 while len1 > 0 and nums[i] >= que[-1][0]: que.pop() len1 -= 1 que.append((nums[i], i)) len1 += 1 ans.append(que[0][0]) return ans
class ShellGame(object): def __init__(self, start, swaps): self.start = start self.swaps = swaps def find_the_ball(self): if len(self.swaps) == 0: return self.start else: for pos in self.swaps: for x in pos: self.start = x return self.start
""" from: http://adventofcode.com/2017/day/5 --- Part Two --- Now, the jumps are even stranger: after each jump, if the offset was three or more, instead decrease it by 1. Otherwise, increase it by 1 as before. Using this rule with the above example, the process now takes 10 steps, and the offset values after finding the exit are left as 2 3 2 3 -1. How many steps does it now take to reach the exit? """ def main(): """Solve the problem!""" maze = [] jump_count = 0 # import the maze with open("input.txt") as input_file: for line in input_file: maze.append(int(line)) index = 0 while index < len(maze): jump_value = maze[index] if jump_value >= 3: maze[index] = maze[index] - 1 else: maze[index] = maze[index] + 1 index = index + jump_value jump_count = jump_count + 1 print(jump_count) if __name__ == "__main__": main()
ROP_POPJUMPLR_STACK12 = 0x0101CD24; ROP_POPJUMPLR_STACK20 = 0x01024D88; ROP_CALLFUNC = 0x01080274; ROP_CALLR28_POP_R28_TO_R31 = 0x0107DD70; ROP_POP_R28R29R30R31 = 0x0101D8D4; ROP_POP_R27 = 0x0101CB00; ROP_POP_R24_TO_R31 = 0x010204C8; ROP_CALLFUNCPTR_WITHARGS_FROM_R3MEM = 0x010253C0; ROP_SETR3TOR31_POP_R31 = 0x0101CC10; ROP_Register = 0x010277B8; ROP_Deregister = 0x010277C4; ROP_CopyToSaveArea = 0x010277DC; ROP_CopyFromSaveArea = 0x010277D0; ROP_CreateThreadInternal = 0x01041BA8; ROP_LR_TO_0XC_R1 = 0x0101CD24; ROP_lwz_r3_0_r3__lwz_r0_0xc_r1__mtlr_r0__addi_r1_r1_8__blr = 0x01040C58; ROP_memcpy = 0x01035FC8; ROP_DCFlushRange = 0x01023F88; ROP_ICInvalidateRange = 0x010240B0; ROP_OSSwitchSecCodeGenMode = 0x010376C0; ROP_OSCodegenCopy = 0x010376D8; ROP_OSGetCodegenVirtAddrRange = 0x010375C0; ROP_OSGetCoreId = 0x01024E8C; ROP_OSGetCurrentThread = 0x01043150; ROP_OSSetThreadAffinity = 0x010429DC; ROP_OSYieldThread = 0x010418E4; ROP_OSFatal = 0x01031618; ROP_Exit = 0x0101CD80; ROP_OSScreenFlipBuffersEx = 0x0103AFD0; ROP_OSScreenClearBufferEx = 0x0103B090; ROP_OSDynLoad_Acquire = 0x0102A3B4; ROP_OSDynLoad_FindExport = 0x0102B828; ROP_os_snprintf = 0x0102F160; ROP_OSSendAppSwitchRequest = 0x01039C30; ROP_OSExitThread = 0x01041D6C; ROP_OSSleepTicks = 0x0104274C; ROP_OSTestAndSetAtomic64 = 0x010229BC; ROP_OSDisableInterrupts = 0x01033250; ROP_OSForceFullRelaunch = 0x01035FA8; ROP_OSRestoreInterrupts = 0x01033368; ROP__Exit = 0x0101CD80; ROP_OSCreateThread = 0x01041B64; ROP_OSResumeThread = 0x01042108; ROP_IM_Open = 0x010821F0; ROP_IM_SetDeviceState = 0x01082598; ROP_IM_Close = 0x01082200; ROP___PPCExit = 0x0101C580; ROP_OSRequestFastExit = 0x01039630; ROP_OSRestartCrashedApp = 0x010302DC; ROP_OSShutdown = 0x0101FD0C; ROP_OSSuspendThread = 0x01042C60; ROP_OSRunThreadsOnExit = 0x01047644; ROP_OSBlockThreadsOnExit = 0x01047628; ROP_GX2SetSemaphore_2C = 0x01157F18; ROP_GX2_r3r4load = 0x0114EF74; ROP_GX2_r30r31load = 0x011519EC; ROP_GX2_do_flush = 0x0114F394; ROP_GX2_call_r12 = 0x01189DDC; ROP_GX2Init = 0x01156B78; ROP_GX2Shutdown = 0x0115733C; ROP_GX2Flush = 0x011575AC; ROP_GX2DrawDone = 0x01157560; ROP_GX2WaitForVsync = 0x01151964; ROP_GX2DirectCallDisplayList = 0x01152BF0; ROP_socket = 0x010C21C8; ROP_connect = 0x010C0828; ROP_recv = 0x010C0AEC; ROP_R3_TO_R11 = 0x0DA6364C; ROP_R11_TO_R1 = 0x0C009578; ROP_R3_TO_R7 = 0x0D37A6F4; ROP_R3_TO_R4 = 0x0DA6364C; ROP_POP_R12 = 0x0C8F991C; ROP_R3_TO_R6 = 0x0DFA353C; ROP_R3_TO_R5_POP_R29_R30_R31 = 0x0DA21BC4;
nome = input("qual é o seu nome?").strip() print("nome em letras maiusculas", nome.upper()) print("nome com letras minusculas", nome.lower()) print("numero de letras no nome {}".format(len(nome)-nome.count(" "))) print("primeiro nome tem {} letras".format())
class NoPrivateKey(Exception): """ No private key was provided so unable to perform any operations requiring message signing. """ pass class DigitalTwinMapError(Exception): """ No Digital Twin was created with this index or there is no such topic in Digital Twin map. """ pass
# # PySNMP MIB module CISCO-VPN-LIC-USAGE-MONITOR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-VPN-LIC-USAGE-MONITOR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:03:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ModuleCompliance, ObjectGroup, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "ObjectGroup", "NotificationGroup") MibIdentifier, ObjectIdentity, Counter64, TimeTicks, IpAddress, ModuleIdentity, Bits, Unsigned32, Counter32, NotificationType, iso, Gauge32, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "ObjectIdentity", "Counter64", "TimeTicks", "IpAddress", "ModuleIdentity", "Bits", "Unsigned32", "Counter32", "NotificationType", "iso", "Gauge32", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") ciscoVpnLicUsageMonitorMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 816)) ciscoVpnLicUsageMonitorMIB.setRevisions(('2013-09-13 00:00',)) if mibBuilder.loadTexts: ciscoVpnLicUsageMonitorMIB.setLastUpdated('201309130000Z') if mibBuilder.loadTexts: ciscoVpnLicUsageMonitorMIB.setOrganization('Cisco Systems, Inc.') class VPNLicType(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("other", 1), ("anyconnectpremium", 2)) class VPNLicDeviceRole(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("server", 1), ("bkpserver", 2), ("client", 3)) class LicServerStatus(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("active", 1), ("inactive", 2), ("expired", 3)) class LicServerRegistered(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("no", 1), ("yes", 2), ("invalid", 3)) ciscoVpnLicUsageMonitorMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 0)) ciscoVpnLicUsageMonitorMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 1)) ciscoVpnLicUsageMonitorMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 1)) cvpnLicDeviceRole = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 1), VPNLicDeviceRole()).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicDeviceRole.setStatus('current') cvpnLicServer = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2)) cvpnLicBkpServer = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3)) cvpnLicClient = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4)) cvpnLicServerAddrType = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 1), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerAddrType.setStatus('current') cvpnLicServerAddr = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 2), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerAddr.setStatus('current') cvpnLicBkpSerAddrType = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 3), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicBkpSerAddrType.setStatus('current') cvpnLicBkpSerAddr = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 4), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicBkpSerAddr.setStatus('current') cvpnLicServerVer = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerVer.setStatus('current') cvpnLicServerStatus = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 6), LicServerStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerStatus.setStatus('current') cvpnLicServerTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7), ) if mibBuilder.loadTexts: cvpnLicServerTable.setStatus('current') cvpnLicServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1), ).setIndexNames((0, "CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerVPNLicType")) if mibBuilder.loadTexts: cvpnLicServerEntry.setStatus('current') cvpnLicServerVPNLicType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1, 1), VPNLicType()) if mibBuilder.loadTexts: cvpnLicServerVPNLicType.setStatus('current') cvpnLicServerNumLicCapacity = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1, 2), Unsigned32()).setUnits('license').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerNumLicCapacity.setStatus('current') cvpnLicServerNumLicAvail = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1, 3), Unsigned32()).setUnits('license').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerNumLicAvail.setStatus('current') cvpnLicServerUtilized = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 2, 7, 1, 4), Unsigned32()).setUnits('license').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerUtilized.setStatus('current') cvpnLicBkpServerAddrType = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 1), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicBkpServerAddrType.setStatus('current') cvpnLicBkpServerAddr = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 2), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicBkpServerAddr.setStatus('current') cvpnLicBkpServerDevID = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 3), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicBkpServerDevID.setStatus('current') cvpnLicBkpServerVer = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 4), Unsigned32()).setUnits('license').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicBkpServerVer.setStatus('current') cvpnLicBkpServerRegd = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 5), LicServerRegistered()).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicBkpServerRegd.setStatus('current') cvpnLicBkpServerHAPeerDevID = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 6), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicBkpServerHAPeerDevID.setStatus('current') cvpnLicBkpServerHAPeerRegd = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 7), LicServerRegistered()).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicBkpServerHAPeerRegd.setStatus('current') cvpnLicBkpServerStatus = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 8), LicServerStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicBkpServerStatus.setStatus('current') cvpnLicServerHelloTx = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 9), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerHelloTx.setStatus('current') cvpnLicServerHelloRx = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 10), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerHelloRx.setStatus('current') cvpnLicServerHelloError = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 11), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerHelloError.setStatus('current') cvpnLicServerSyncTx = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 12), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerSyncTx.setStatus('current') cvpnLicServerSyncRx = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 13), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerSyncRx.setStatus('current') cvpnLicServerSyncError = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 14), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerSyncError.setStatus('current') cvpnLicServerUpdateTx = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 15), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerUpdateTx.setStatus('current') cvpnLicServerUpdateRx = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 16), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerUpdateRx.setStatus('current') cvpnLicServerUpdateError = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 3, 17), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicServerUpdateError.setStatus('current') cvpnLicClntInfoTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1), ) if mibBuilder.loadTexts: cvpnLicClntInfoTable.setStatus('current') cvpnLicClntInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1), ).setIndexNames((0, "CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntVPNLicType"), (0, "CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoDeviceID")) if mibBuilder.loadTexts: cvpnLicClntInfoEntry.setStatus('current') cvpnLicClntVPNLicType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 1), VPNLicType()) if mibBuilder.loadTexts: cvpnLicClntVPNLicType.setStatus('current') cvpnLicClntInfoDeviceID = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 2), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))) if mibBuilder.loadTexts: cvpnLicClntInfoDeviceID.setStatus('current') cvpnLicClntInfoHostName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 3), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoHostName.setStatus('current') cvpnLicClntInfoPlatLmt = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 4), Unsigned32()).setUnits('license').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoPlatLmt.setStatus('current') cvpnLicClntInfoCurUsage = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 5), Unsigned32()).setUnits('license').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoCurUsage.setStatus('current') cvpnLicClntInfoHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 6), Unsigned32()).setUnits('license').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoHigh.setStatus('current') cvpnLicClntInfoRegReqTx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 7), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoRegReqTx.setStatus('current') cvpnLicClntInfoRegReqRx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 8), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoRegReqRx.setStatus('current') cvpnLicClntInfoRegReqError = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 9), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoRegReqError.setStatus('current') cvpnLicClntInfoGetReqTx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 10), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoGetReqTx.setStatus('current') cvpnLicClntInfoGetReqRx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 11), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoGetReqRx.setStatus('current') cvpnLicClntInfoGetReqError = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 12), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoGetReqError.setStatus('current') cvpnLicClntInfoRelReqTx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 13), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoRelReqTx.setStatus('current') cvpnLicClntInfoRelReqRx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 14), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoRelReqRx.setStatus('current') cvpnLicClntInfoRelReqError = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 15), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoRelReqError.setStatus('current') cvpnLicClntInfoTransferReqTx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 16), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoTransferReqTx.setStatus('current') cvpnLicClntInfoTransferReqRx = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 17), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoTransferReqRx.setStatus('current') cvpnLicClntInfoTransferReqError = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 816, 0, 4, 1, 1, 18), Counter32()).setUnits('packets').setMaxAccess("readonly") if mibBuilder.loadTexts: cvpnLicClntInfoTransferReqError.setStatus('current') ciscoVpnLicUsageMonitorMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 2)) ciscoVpnLicUsageMonitorMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 1, 1)).setObjects(("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "ciscoVPNSharedLicUsageMandatoryGroup"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "ciscoVPNSharedLicOptUsageGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoVpnLicUsageMonitorMIBCompliance = ciscoVpnLicUsageMonitorMIBCompliance.setStatus('current') ciscoVPNSharedLicUsageMandatoryGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 2, 1)).setObjects(("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicDeviceRole"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerAddrType"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerAddr"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpSerAddrType"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpSerAddr"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerVer"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerStatus"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerNumLicCapacity"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerNumLicAvail"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerUtilized"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoHostName"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoPlatLmt"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoCurUsage"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoHigh")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoVPNSharedLicUsageMandatoryGroup = ciscoVPNSharedLicUsageMandatoryGroup.setStatus('current') ciscoVPNSharedLicOptUsageGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 816, 1, 2, 2)).setObjects(("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerAddrType"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerAddr"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerDevID"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerVer"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerRegd"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerHAPeerDevID"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerHAPeerRegd"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicBkpServerStatus"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerHelloTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerHelloRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerHelloError"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerSyncTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerSyncRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerSyncError"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerUpdateTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerUpdateRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicServerUpdateError"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoRegReqTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoRegReqRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoRegReqError"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoGetReqTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoGetReqRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoGetReqError"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoRelReqTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoRelReqRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoRelReqError"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoTransferReqTx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoTransferReqRx"), ("CISCO-VPN-LIC-USAGE-MONITOR-MIB", "cvpnLicClntInfoTransferReqError")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoVPNSharedLicOptUsageGroup = ciscoVPNSharedLicOptUsageGroup.setStatus('current') mibBuilder.exportSymbols("CISCO-VPN-LIC-USAGE-MONITOR-MIB", cvpnLicClient=cvpnLicClient, cvpnLicServerVer=cvpnLicServerVer, cvpnLicClntInfoEntry=cvpnLicClntInfoEntry, cvpnLicBkpServerHAPeerDevID=cvpnLicBkpServerHAPeerDevID, cvpnLicBkpServerHAPeerRegd=cvpnLicBkpServerHAPeerRegd, cvpnLicServerHelloTx=cvpnLicServerHelloTx, LicServerStatus=LicServerStatus, cvpnLicClntInfoHostName=cvpnLicClntInfoHostName, cvpnLicClntInfoRelReqRx=cvpnLicClntInfoRelReqRx, ciscoVpnLicUsageMonitorMIBCompliance=ciscoVpnLicUsageMonitorMIBCompliance, cvpnLicServerUpdateRx=cvpnLicServerUpdateRx, ciscoVpnLicUsageMonitorMIBGroups=ciscoVpnLicUsageMonitorMIBGroups, cvpnLicClntInfoTransferReqTx=cvpnLicClntInfoTransferReqTx, cvpnLicServerUpdateError=cvpnLicServerUpdateError, cvpnLicServerSyncTx=cvpnLicServerSyncTx, cvpnLicClntInfoTransferReqError=cvpnLicClntInfoTransferReqError, ciscoVpnLicUsageMonitorMIBCompliances=ciscoVpnLicUsageMonitorMIBCompliances, cvpnLicServerVPNLicType=cvpnLicServerVPNLicType, ciscoVPNSharedLicOptUsageGroup=ciscoVPNSharedLicOptUsageGroup, cvpnLicServerStatus=cvpnLicServerStatus, VPNLicDeviceRole=VPNLicDeviceRole, cvpnLicServerUpdateTx=cvpnLicServerUpdateTx, ciscoVPNSharedLicUsageMandatoryGroup=ciscoVPNSharedLicUsageMandatoryGroup, cvpnLicBkpSerAddr=cvpnLicBkpSerAddr, cvpnLicBkpServerRegd=cvpnLicBkpServerRegd, cvpnLicClntVPNLicType=cvpnLicClntVPNLicType, cvpnLicClntInfoPlatLmt=cvpnLicClntInfoPlatLmt, cvpnLicClntInfoRelReqTx=cvpnLicClntInfoRelReqTx, cvpnLicClntInfoRegReqTx=cvpnLicClntInfoRegReqTx, ciscoVpnLicUsageMonitorMIB=ciscoVpnLicUsageMonitorMIB, cvpnLicBkpServerAddrType=cvpnLicBkpServerAddrType, cvpnLicClntInfoGetReqRx=cvpnLicClntInfoGetReqRx, cvpnLicServerUtilized=cvpnLicServerUtilized, cvpnLicBkpServerStatus=cvpnLicBkpServerStatus, cvpnLicServerSyncRx=cvpnLicServerSyncRx, cvpnLicClntInfoTable=cvpnLicClntInfoTable, cvpnLicClntInfoRegReqRx=cvpnLicClntInfoRegReqRx, cvpnLicClntInfoCurUsage=cvpnLicClntInfoCurUsage, cvpnLicServerTable=cvpnLicServerTable, cvpnLicServerNumLicAvail=cvpnLicServerNumLicAvail, PYSNMP_MODULE_ID=ciscoVpnLicUsageMonitorMIB, ciscoVpnLicUsageMonitorMIBConform=ciscoVpnLicUsageMonitorMIBConform, cvpnLicClntInfoRegReqError=cvpnLicClntInfoRegReqError, cvpnLicClntInfoGetReqTx=cvpnLicClntInfoGetReqTx, cvpnLicClntInfoRelReqError=cvpnLicClntInfoRelReqError, LicServerRegistered=LicServerRegistered, cvpnLicBkpServerAddr=cvpnLicBkpServerAddr, cvpnLicClntInfoTransferReqRx=cvpnLicClntInfoTransferReqRx, cvpnLicBkpServerVer=cvpnLicBkpServerVer, cvpnLicClntInfoGetReqError=cvpnLicClntInfoGetReqError, VPNLicType=VPNLicType, cvpnLicServerHelloRx=cvpnLicServerHelloRx, cvpnLicDeviceRole=cvpnLicDeviceRole, cvpnLicServerHelloError=cvpnLicServerHelloError, cvpnLicServerAddrType=cvpnLicServerAddrType, cvpnLicServer=cvpnLicServer, ciscoVpnLicUsageMonitorMIBObjects=ciscoVpnLicUsageMonitorMIBObjects, cvpnLicServerEntry=cvpnLicServerEntry, cvpnLicServerSyncError=cvpnLicServerSyncError, cvpnLicClntInfoHigh=cvpnLicClntInfoHigh, cvpnLicServerAddr=cvpnLicServerAddr, cvpnLicClntInfoDeviceID=cvpnLicClntInfoDeviceID, cvpnLicBkpSerAddrType=cvpnLicBkpSerAddrType, cvpnLicBkpServer=cvpnLicBkpServer, cvpnLicBkpServerDevID=cvpnLicBkpServerDevID, cvpnLicServerNumLicCapacity=cvpnLicServerNumLicCapacity)
# Copyright(c) 2017, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * 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. # * Neither the name of Intel Corporation nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # 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 OWNER 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. # GUID value: "58656F6E-4650-4741-B747-425376303031" # The string below will be converted to hex format # before being written into the bitstream file METADATA_GUID = b'XeonFPGA\xb7GBSv001' # Metadata length field is a unsigned 32 bit int SIZEOF_LEN_FIELD = 4 # Length of GUID string GUID_LEN = len(METADATA_GUID)
{ "targets": [ { "target_name": "lmdb-queue", "include_dirs" : [ "<!(node -e \"require('nan')\")", "<!(node -e \"require('nnu')\")", "deps" ], "dependencies": [ "<(module_root_dir)/deps/lmdb.gyp:lmdb" ], "sources": [ "src/module.cc", "src/env.h", "src/env.cc", "src/topic.h", "src/topic.cc", "src/consumer.h", "src/consumer.cc", "src/producer.h", "src/producer.cc", "src/wrapper.h" ], "conditions": [ [ "OS == 'win'", { 'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeTypeInfo': 'false', 'EnableFunctionLevelLinking': 'true', 'DisableSpecificWarnings': [ '4267' ], 'AdditionalOptions': ['/EHsc'] } } } ], [ "OS=='linux'", { "cflags_cc": [ "-std=c++11" ] } ], [ 'OS == "mac"', { 'xcode_settings': { 'MACOSX_DEPLOYMENT_TARGET': '10.7', 'OTHER_CPLUSPLUSFLAGS': [ '-std=c++11' , '-stdlib=libc++' ] } } ] ] } ] }
# coding: utf-8 """ railgun-cli ```````````` railgun command line tool :License: MIT :Copyright: @neo1218 @oaoouo """ __version__ = '0.1.3'
# the key is the name of the class of the workload and the value is the program argument string def get_workloads(checkpoint, analytics_data_paths: list, lda_data_paths: list, gbt_data_path: str, pagerank_data_path: str, k: int, iterations: int, checkpoint_interval: int, sampling_fraction: float = 0.01, analytics_only: bool = False) -> dict: if analytics_only: # for a faster run workloads = { "Analytics": f"--sampling-fraction {sampling_fraction} --checkpoint-rdd {checkpoint} {analytics_data_paths[0]} {analytics_data_paths[1]}" } else: workloads = { "Analytics": f"--sampling-fraction {sampling_fraction} --checkpoint-rdd {checkpoint} {analytics_data_paths[0]} {analytics_data_paths[1]}", "LDAWorkload": f"--k {k} --iterations {iterations} --checkpoint {checkpoint} --checkpoint-interval {checkpoint_interval} {lda_data_paths[0]} {lda_data_paths[1]}", "GradientBoostedTrees": f"--iterations {iterations} --checkpoint {checkpoint} --checkpoint-interval {checkpoint_interval} {gbt_data_path}", "PageRank": f"--save-path output/ --iterations {iterations} --checkpoint {checkpoint} {pagerank_data_path}" } return workloads
__author__ = 'Cib' class interface(): pass
def foo(a): """ :param a: """ pass foo("a")
class MyStack: def __init__(self): self.q = deque() def push(self, x: int) -> None: self.q.append(x) def pop(self) -> int: for i in range(len(self.q)-1): self.q.append(self.q.popleft()) return self.q.popleft() def top(self) -> int: temp = self.pop() self.q.append(temp) return temp def empty(self) -> bool: return len(self.q) == 0 # Your MyStack object will be instantiated and called as such: # obj = MyStack() # obj.push(x) # param_2 = obj.pop() # param_3 = obj.top() # param_4 = obj.empty()
N = int(input()) A = list(map(int, input().split())) ans = 0 max_tall = 0 for i in range(0, N): if max_tall > A[i]: ans += max_tall - A[i] if A[i] > max_tall: max_tall = A[i] print(ans)
# # PySNMP MIB module A3COM0027-RMON-EXTENSIONS (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM0027-RMON-EXTENSIONS # Produced by pysmi-0.3.4 at Wed May 1 11:08:40 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) # rmonExtensions, = mibBuilder.importSymbols("A3COM0004-GENERIC", "rmonExtensions") ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Integer32, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, Bits, ObjectIdentity, Unsigned32, MibIdentifier, NotificationType, ModuleIdentity, Counter64, iso, Counter32, TimeTicks, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "Bits", "ObjectIdentity", "Unsigned32", "MibIdentifier", "NotificationType", "ModuleIdentity", "Counter64", "iso", "Counter32", "TimeTicks", "IpAddress") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") remotePoll = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 1)) hostExtensions = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 2)) alarmExtensions = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 3)) eventExtensions = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 4)) command = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 5)) probeConfigNetExtensions = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 10, 25, 6)) mibBuilder.exportSymbols("A3COM0027-RMON-EXTENSIONS", remotePoll=remotePoll, probeConfigNetExtensions=probeConfigNetExtensions, hostExtensions=hostExtensions, eventExtensions=eventExtensions, command=command, alarmExtensions=alarmExtensions)
class ps_data: @property def train_data(self): return self._train_data @property def indexs(self): return self._indexs @train_data.setter def train_data(self, val): self._train_data=val @indexs.setter def indexs(self, val): self._indexs=val
class Advice: def __init__(self): self.clothes = [] self.weather = None def add_cloth(self, cloth): self.clothes.append(cloth) def add_message(self, message): self.clothes.append(message) def add_weather(self, weather): self.weather = weather
# Ayiin - Userbot # Credits (C) 2022-2023 @AyiinXd # # FROM Ayiin-Userbot <https://github.com/AyiinXd/Ayiin-Userbot> # t.me/AyiinXdSupport & t.me/AyiinSupport # ========================×======================== # Link For Collaborator # ========================×======================== # ========================Asupan Sagapung======================== asupan_sagapung = [ "https://t.me/AsupanSagapungRobot?start=Z2V0LTk2MTYwOTU5NzQ3NTUy", "https://t.me/asupanexorBot?start=Z2V0LTMyMDU2NDMzNzc2ODY0", "https://t.me/asupanexorBot?start=Z2V0LTM0MDU5OTYwODg3OTE4", "https://t.me/asupanexorBot?start=Z2V0LTM1MDYxNzI0NDQzNDQ1"] # ========================Exolink======================== exolink = ["https://t.me/asupanexorBot?start=Z2V0LTI1MDQ0MDg4ODg4MTc1", "https://t.me/asupanexorBot?start=Z2V0LTI2MDQ1ODUyNDQzNzAy", "https://t.me/asupanexorBot?start=Z2V0LTI4MDQ5Mzc5NTU0NzU2", "https://t.me/asupanexorBot?start=Z2V0LTMwMDUyOTA2NjY1ODEw", "https://t.me/asupanexorBot?start=Z2V0LTMxMDU0NjcwMjIxMzM3", "https://t.me/asupanexorBot?start=Z2V0LTMzMDU4MTk3MzMyMzkx", "https://t.me/asupanexorBot?start=Z2V0LTMyMDU2NDMzNzc2ODY0", "https://t.me/asupanexorBot?start=Z2V0LTM0MDU5OTYwODg3OTE4", "https://t.me/asupanexorBot?start=Z2V0LTM1MDYxNzI0NDQzNDQ1", "https://t.me/asupanexorBot?start=Z2V0LTQyMDc0MDY5MzMyMTM0", "https://t.me/asupanexorBot?start=Z2V0LTM5MDY4Nzc4NjY1NTUz", "https://t.me/asupanexorBot?start=Z2V0LTQxMDcyMzA1Nzc2NjA3", "https://t.me/asupanexorBot?start=Z2V0LTQwMDcwNTQyMjIxMDgw", "https://t.me/asupanexorBot?start=Z2V0LTQzMDc1ODMyODg3NjYx", "https://t.me/asupanexorBot?start=Z2V0LTQ0MDc3NTk2NDQzMTg4", "https://t.me/asupanexorBot?start=Z2V0LTQ1MDc5MzU5OTk4NzE1", "https://t.me/asupanexorBot?start=Z2V0LTQ2MDgxMTIzNTU0MjQy", "https://t.me/asupanexorBot?start=Z2V0LTQ3MDgyODg3MTA5NzY5", "https://t.me/asupanexorBot?start=Z2V0LTQ5MDg2NDE0MjIwODIz", "https://t.me/asupanexorBot?start=Z2V0LTQ4MDg0NjUwNjY1Mjk2", "https://t.me/asupanexorBot?start=Z2V0LTU1MDk2OTk1NTUzOTg1", "https://t.me/asupanexorBot?start=Z2V0LTU0MDk1MjMxOTk4NDU4", "https://t.me/asupanexorBot?start=Z2V0LTUxMDg5OTQxMzMxODc3", "https://t.me/asupanexorBot?start=Z2V0LTUwMDg4MTc3Nzc2MzUw", "https://t.me/asupanexorBot?start=Z2V0LTUyMDkxNzA0ODg3NDA0", "https://t.me/asupanexorBot?start=Z2V0LTUzMDkzNDY4NDQyOTMx", "https://t.me/asupanexorBot?start=Z2V0LTU2MDk4NzU5MTA5NTEy", "https://t.me/asupanexorBot?start=Z2V0LTYxMTA3NTc2ODg3MTQ3", "https://t.me/asupanexorBot?start=Z2V0LTU3MTAwNTIyNjY1MDM5", "https://t.me/asupanexorBot?start=Z2V0LTU4MTAyMjg2MjIwNTY2", "https://t.me/asupanexorBot?start=Z2V0LTU5MTA0MDQ5Nzc2MDkz", "https://t.me/asupanexorBot?start=Z2V0LTYwMTA1ODEzMzMxNjIw", "https://t.me/asupanexorBot?start=Z2V0LTY1MTE0NjMxMTA5MjU1", "https://t.me/asupanexorBot?start=Z2V0LTY0MTEyODY3NTUzNzI4", "https://t.me/asupanexorBot?start=Z2V0LTYyMTA5MzQwNDQyNjc0", "https://t.me/asupanexorBot?start=Z2V0LTYzMTExMTAzOTk4MjAx", "https://t.me/asupanexorBot?start=Z2V0LTY2MTE2Mzk0NjY0Nzgy", "https://t.me/asupanexorBot?start=Z2V0LTY3MTE4MTU4MjIwMzA5", "https://t.me/asupanexorBot?start=Z2V0LTY4MTE5OTIxNzc1ODM2", "https://t.me/asupanexorBot?start=Z2V0LTcyMTI2OTc1OTk3OTQ0", "https://t.me/asupanexorBot?start=Z2V0LTcwMTIzNDQ4ODg2ODkw", "https://t.me/asupanexorBot?start=Z2V0LTY5MTIxNjg1MzMxMzYz", "https://t.me/asupanexorBot?start=Z2V0LTcxMTI1MjEyNDQyNDE3", "https://t.me/asupanexorBot?start=Z2V0LTc3MTM1NzkzNzc1NTc5", "https://t.me/asupanexorBot?start=Z2V0LTczMTI4NzM5NTUzNDcx", "https://t.me/asupanexorBot?start=Z2V0LTc0MTMwNTAzMTA4OTk4", "https://t.me/asupanexorBot?start=Z2V0LTc4MTM3NTU3MzMxMTA2", "https://t.me/asupanexorBot?start=Z2V0LTc1MTMyMjY2NjY0NTI1", "https://t.me/asupanexorBot?start=Z2V0LTc2MTM0MDMwMjIwMDUy", "https://t.me/asupanexorBot?start=Z2V0LTc5MTM5MzIwODg2NjMz", "https://t.me/asupanexorBot?start=Z2V0LTgxMTQyODQ3OTk3Njg3", "https://t.me/asupanexorBot?start=Z2V0LTgyMTQ0NjExNTUzMjE0", "https://t.me/asupanexorBot?start=Z2V0LTgwMTQxMDg0NDQyMTYw", "https://t.me/asupanexorBot?start=Z2V0LTgzMTQ2Mzc1MTA4NzQx", "https://t.me/asupanexorBot?start=Z2V0LTg4MTU1MTkyODg2Mzc2", "https://t.me/asupanexorBot?start=Z2V0LTg2MTUxNjY1Nzc1MzIy", "https://t.me/asupanexorBot?start=Z2V0LTg3MTUzNDI5MzMwODQ5", "https://t.me/asupanexorBot?start=Z2V0LTg0MTQ4MTM4NjY0MjY4", "https://t.me/asupanexorBot?start=Z2V0LTg1MTQ5OTAyMjE5Nzk1", "https://t.me/asupanexorBot?start=Z2V0LTg5MTU2OTU2NDQxOTAz", "https://t.me/asupanexorBot?start=Z2V0LTkwMTU4NzE5OTk3NDMw", "https://t.me/asupanexorBot?start=Z2V0LTkzMTY0MDEwNjY0MDEx", "https://t.me/asupanexorBot?start=Z2V0LTk0MTY1Nzc0MjE5NTM4", "https://t.me/asupanexorBot?start=Z2V0LTkxMTYwNDgzNTUyOTU3", "https://t.me/asupanexorBot?start=Z2V0LTkyMTYyMjQ3MTA4NDg0", "https://t.me/asupanexorBot?start=Z2V0LTk2MTY5MzAxMzMwNTky", "https://t.me/asupanexorBot?start=Z2V0LTk4MTcyODI4NDQxNjQ2", "https://t.me/asupanexorBot?start=Z2V0LTk1MTY3NTM3Nzc1MDY1", "https://t.me/asupanexorBot?start=Z2V0LTk3MTcxMDY0ODg2MTE5", "https://t.me/asupanexorBot?start=Z2V0LTk5MTc0NTkxOTk3MTcz", "https://t.me/asupanexorBot?start=Z2V0LTEwMDE3NjM1NTU1MjcwMA", "https://t.me/asupanexorBot?start=Z2V0LTEwMTE3ODExOTEwODIyNw", "https://t.me/asupanexorBot?start=Z2V0LTEwMjE3OTg4MjY2Mzc1NA", "https://t.me/asupanexorBot?start=Z2V0LTEwNTE4NTE3MzMzMDMzNQ", "https://t.me/asupanexorBot?start=Z2V0LTEwMzE4MTY0NjIxOTI4MQ", "https://t.me/asupanexorBot?start=Z2V0LTEwNDE4MzQwOTc3NDgwOA", "https://t.me/asupanexorBot?start=Z2V0LTEwNjE4NjkzNjg4NTg2Mg", "https://t.me/asupanexorBot?start=Z2V0LTEwNzE4ODcwMDQ0MTM4OQ" ]
dia = input("Digite seu dia de nascimento ") mes = input("Digite seu mês de nascimento ") ano = input("Digite seu ano de nascimento ") print("Sua data de nascimento é {}/{}/{}".format(dia, mes, ano))
def _cantidad_caracter(cadena, caracter, indice, cantidad): if indice == len(cadena): return cantidad if caracter == cadena[indice]: cantidad += 1 return _cantidad_caracter(cadena, caracter, indice + 1, cantidad) def cantidad_caracter(cadena, caracter): """Cuenta la cantidad de apariciones del caracter en la cadena""" return _cantidad_caracter(cadena, caracter, 0, 0)
script_part1 =r""" <!DOCTYPE html> <html lang="en"> <head> <title>Cog Graph</title> <style type="text/css"> body { padding: 0; margin: 0; width: 100%;!important; height: 100%;!important; } #cog-graph-view { width: 700px; height: 700px; } </style> """ graph_lib_src = r""" <script type="text/javascript" src="{js_src}" ></script> </head> """ graph_template = r""" <body> <div id="cog-graph-view"></div> <script type="text/javascript"> results ={plot_data_insert} """ script_part2 = r""" var nodes = new vis.DataSet(); var edges = new vis.DataSet(); for (let i = 0; i < results.length; i++) { res = results[i]; nodes.update({ id: res.from, label: res.from }); nodes.update({ id: res.to, label: res.to }); edges.update({ from: res.from, to: res.to }); } var container = document.getElementById("cog-graph-view"); var data = { nodes: nodes, edges: edges, }; var options = { nodes: { font: { size: 20, color: "black" }, color: "#46944f", shape: "dot", widthConstraint: 200, }, edges: { font: "12px arial #ff0000", scaling: { label: true, }, shadow: true, smooth: true, arrows: { to: {enabled: true}} }, physics: { barnesHut: { gravitationalConstant: -30000 }, stabilization: { iterations: 1000 }, } }; var network = new vis.Network(container, data, options); </script> </body> </html> """
__all__= [ 'table', 'projects', 'annotations', 'converters', 'metrics' ] __version__ = '0.0.3'
""" Faster R-CNN with Normalized Wasserstein Assigner Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=1500 ] = 0.053 Average Precision (AP) @[ IoU=0.25 | area= all | maxDets=1500 ] = -1.000 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.130 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=1500 ] = 0.031 Average Precision (AP) @[ IoU=0.50:0.95 | area=verytiny | maxDets=1500 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area= tiny | maxDets=1500 ] = 0.009 Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=1500 ] = 0.145 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=1500 ] = 0.270 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.091 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=300 ] = 0.092 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=1500 ] = 0.092 Average Recall (AR) @[ IoU=0.50:0.95 | area=verytiny | maxDets=1500 ] = 0.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= tiny | maxDets=1500 ] = 0.008 Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=1500 ] = 0.272 Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=1500 ] = 0.394 Optimal LRP @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.950 Optimal LRP Loc @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.307 Optimal LRP FP @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.583 Optimal LRP FN @[ IoU=0.50 | area= all | maxDets=1500 ] = 0.849 # Class-specific LRP-Optimal Thresholds # [0.742 0.196 0.547 0.534 0.445 0.29 0.35 nan] 2021-06-05 19:50:57,332 - mmdet - INFO - +----------+-------+---------------+-------+--------------+-------+ | category | AP | category | AP | category | AP | +----------+-------+---------------+-------+--------------+-------+ | airplane | 0.141 | bridge | 0.008 | storage-tank | 0.105 | | ship | 0.071 | swimming-pool | 0.047 | vehicle | 0.033 | | person | 0.018 | wind-mill | 0.000 | None | None | +----------+-------+---------------+-------+--------------+-------+ 2021-06-05 19:50:57,333 - mmdet - INFO - +----------+-------+---------------+-------+--------------+-------+ | category | oLRP | category | oLRP | category | oLRP | +----------+-------+---------------+-------+--------------+-------+ | airplane | 0.880 | bridge | 0.982 | storage-tank | 0.905 | | ship | 0.933 | swimming-pool | 0.948 | vehicle | 0.969 | | person | 0.981 | wind-mill | 1.000 | None | None | +----------+-------+---------------+-------+--------------+-------+ """ _base_ = [ '../_base_/models/faster_rcnn_r50_fpn_aitod.py', '../_base_/datasets/aitod_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( train_cfg=dict( rpn=dict( assigner=dict( pos_iou_thr=0.7, neg_iou_thr=0.4, min_pos_iou=0.4)), rcnn=dict( assigner=dict( pos_iou_thr=0.7, neg_iou_thr=0.4, min_pos_iou=0.4)))) fp16 = dict(loss_scale=512.) # optimizer optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001) # learning policy checkpoint_config = dict(interval=4)
''' lab2 ''' #3.1 my_name = "Tom" print(my_name.upper()) #3.2 my_id = 123 print(my_id) #3.3 # 123=my_id my_id=your_id=123 print(my_id) print(your_id) #3.4 my_id_str= "123" print(my_id_str) #3.5 #print(my_name+my_id) #3.6 print(my_name+my_id_str) #3.7 print(my_name*3) #3.8 print('hello, world. This is my first python string'.split('.')) #3.9 #message = 'Tom's id is 123' #print('Tom's id is 123') message = "Tom's id is 123" print(message)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 14 14:14:47 2017 @author: bmjl """ class Point: """This is Point class""" def __init__(self): """This is the Point constructur""" print("Point created") def hello(self): """Hello method""" print("Hello") def hello_module(): """Hello function""" print("Hello from mymod.") if __name__ == "__main__": print("My module")
#/usr/bin/env python def my_func1(callback): def func_wrapper(x): print("my_func1: {0} ".format(callback(x))) return func_wrapper @my_func1 def my_func2(x): return x # Actuall call sequence is similar to: # deco = my_func1(my_func2) # deco("test") => func_wrapper("test") my_func2("test") #------------------------------------------- # Test decorator with parameter def dec_param(param): def my_func3(callback): def func_wrapper(x): print("my_func3: {0} {1} ".format(param, callback(x))) return func_wrapper return my_func3 @dec_param("tag") def my_func4(x): return x # Actuall call sequence is similar to: # deco = dec_pram("tag", my_func3(my_func4)) # deco("test") => func_wrapper("test") my_func4("test")
class RNNConfig(object): embedding_dim = 64 num_classes = 101 num_layers= 2 # num hidden layers hidden_dim = 256 # num hidden rnn = 'gru' # lstm 或 gru dropout_keep_prob = 0.8 # dropout keep prob learning_rate = 1e-3 # batch_size = 128 # print_per_batch = 100 # display save_per_batch = 10 # each how batch save to tensorboard keep_prob = 0.8 trainable = True weight_decay = 0.0005 class CNNConfig(object): basemodel = 'net.inception_resnet_v2' # cnn encoder model batch_size = 4 # num of images in one batch val_batch_size = 4 # validate batch size decay_size = 5000 # num of batch in one epoch nrof_max_epoch_iters = 200000 # max iters of epoch validate_every_n_epochs = 5000 # validata every num epochs gpu_memory_fraction = 0.8 # Upper bound on the amount of GPU memory that will be used by the process. resized_width = 299 resized_height = 299 keep_probability = 0.8 weight_decay = 5e-4 random_crop =True random_rotate = True random_flip = True use_fixed_image_standardization =True # choices=['ADAGRAD', 'ADADELTA', 'ADAM', 'RMSPROP', 'MOM'],help='The optimization algorithm # to use', default='ADAGRAD') optimizer = 'ADAM' learning_rate_decay_epochs = 100 # Number of epochs between learning rate decay. # 'Initial learning rate. If set to a negative value a learning rate , # schedule can be specified in the file "learning_rate_schedule.txt" learning_rate = 0.0 learning_rate_schedule_file = './config/learning_rate_schedule_classifier_ucf.txt' learning_rate_decay_factor = 1.0 # Learning rate decay factor. moving_average_decay = 0.9999 # Exponential decay for tracking of training parameters. embedding_size = 1024
# 2 битовое разреженное число print("{0:b}".format(18432)) N-битовое разреженное число — это число, в бинарной записи # которого присутствует ровно N единиц - все остальные нули. Например число 137 — 3-битовое разреженное, потому что в # двоичной системе записи выглядит как 10001001. # # Рассмотрим все 2-битовые разреженные числа, упорядоченные по возрастанию. Необходимо найти k-тое по порядку число в # этой последовательности. # # Ответ необходимо дать по модулю числа 35184372089371 (остаток от деления на это число). # # Пояснение к примерам: # # Последовательность начинается следующим образом: 3 (11), 5 (101), 6 (110), 9 (1001), 10 (1010), 12 (1100), 17 (10001). # Таким образом первое число - 3, второе - 5, седьмое - 17. def nextsparse(x): # Find binary representation of # x and store it in bin[]. # bin[0] contains least significant # bit (LSB), next bit is in bin[1], # and so on. bin_rep = [] while x != 0: bin_rep.append(x & 1) x >>= 1 # There my be extra bit in result, # so add one extra bit bin_rep.append(0) position = len(bin_rep) # Size of binary representation # The position till which all # bits are finalized changes = 0 # Start from second bit (next to LSB) for m in range(0, position - 2): # If current bit and its previous # bit are 1, but next bit is not 1. if bin_rep[m] == 1 and bin_rep[m + 1] != 1: # Make the next bit 1 bin_rep[m + 1] = 1 bin_rep[m] = 0 changes += 1 break # # Make all bits before current # # bit as 0 to make sure that # # we get the smallest next number # for j in range(i, last_final - 1, -1): # bin[j] = 0 # # # Store position of the bit set # # so that this bit and bits # # before it are not changed next time. # last_final = i + 1 # Find decimal equivalent # of modified bin[] if changes == 0: bin_rep[position - 1] = 1 bin_rep[position - 2] = 0 bin_rep[position - 3] = 0 bin_rep[0] = 1 ans = 0 for v in range(position): ans += bin_rep[v] * (1 << v) return ans def countsetbits(k): count = 0 while k: k &= (k - 1) count += 1 return count # Program to test function countSetBits # i = 18432 # print(countSetBits(i)) # This code is contributed by # Smitha Dinesh Semwal def nth_sparse(p): if p == 1: return 3 count = 1 num = 3 while count < p: num = nextsparse(num) # if is_sparse(num): count += 1 return num def is_sparse(num): if countsetbits(num) == 2: return True else: return False # print(nth_sparse(7)) # while True: # data = input('input') # count = int(data[0]) # # result = [] # # count = int(data[0]) # # for i in range(0, count): # # # print(i) # # result.append(12) # # print(*result, sep='\n') while True: n = int(input()) a = [] for i in range(n): a.append(int(input())) # print(a) data = a # print(data) result = [] for i in data: result.append(nth_sparse(i) % 35184372089371) print(*result, sep='\n')
# HARD # Rolling Hash Method # abc ==> a *26^2, b * 26^1, c * 26^0. # ex: 123 ==> 1*10^2, 2 * 10^1, 3 * 10^0 # we find every possible substring to find if exist a duplicated one # start with mid, if possible ==> find longer one else find shorter one # Time O(NlogN) Space: O(N) class Solution: def longestDupSubstring(self, S: str) -> str: n = len(S) nums = [ord(S[i])- ord('a') for i in range(n)] a = 26 mod = 2**32 #print(nums) left,right = 1,n while left <=right: mid = left +(right-left >>1) if self.match(mid,a,mod,n,nums) != -1: left = mid +1 else: right = mid -1 start = self.match(mid-1,a,mod,n,nums) return S[start:start+left -1] def match(self,mid,a,mod,n,nums): h = 0 print('mid',mid) for i in range(mid): h = (h*a + nums[i])% mod print(i,nums[i],h) seen = set([h]) aMid = pow(a,mid,mod) for i in range(1,n-mid+1): h = (h*a - nums[i-1] *aMid + nums[i+mid-1]) % mod if h in seen: return i seen.add(h) return -1
def squareme(x): return(x**2) myvar = input("Give me a number to square: ") myvar = float(myvar) print("The square of %f is %f." % (myvar, squareme(myvar)) )
class Solution: def rotate(self, N, D): D = D%16 val1 = ((N << D) % (2 ** 16)) ^ int(N // (2 ** (16 - D))) #val1 = (N << D) | (N >> (16 - D)) val2 = (N >> D) ^ int((2 ** (16 - D)) * (N % (2 ** D))) return [val1, val2] if __name__ == '__main__': t = int(input()) for _ in range(t): n, d = input().strip().split(" ") n, d = int(n), int(d) ob = Solution() ans = ob.rotate(n, d) print(ans[0]) print(ans[1])
def test_expect_error(testdir): string = """ Lorem ipsum <!--pytest-codeblocks:expect-exception--> ```python raise RuntimeError() ``` """ testdir.makefile(".md", string) result = testdir.runpytest("--codeblocks") result.assert_outcomes(passed=1) def test_expect_error_fail(testdir): string1 = """ Lorem ipsum <!--pytest-codeblocks:expect-exception--> ```python 1 + 1 ``` """ testdir.makefile(".md", string1) result = testdir.runpytest("--codeblocks") result.assert_outcomes(failed=1)
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ------------------------------------------------- @ Author : Max_Pengjb @ date : 2018/9/22 21:23 @ IDE : PyCharm @ Site : ------------------------------------------------- Description : ------------------------------------------------- """ __author__ = 'Max_Pengjb' """ 汉诺塔问题源于印度一个古老传说。 相传大梵天创造世界的时候做了三根金刚石柱子,在一根柱子上从下往上按照大小顺序摞着64片黄金圆盘。 大梵天命令婆罗门把圆盘从下面开始按大小顺序重新摆放在另一根柱子上。 并且规定,任何时候,在小圆盘上都不能放大圆盘,且在三根柱子之间一次只能移动一个圆盘。 问应该如何操作? 汉诺塔问题的解决思路:如果我们要思考每一步怎么移可能会非常复杂,但是可以将问题简化。 我们可以先假设除a柱最下面的盘子之外,已经成功地将a柱上面的63个盘子移到了b柱, 这时我们只要再将最下面的盘子由a柱移动到c柱即可。 当我们将最大的盘子由a柱移到c柱后,b柱上便是余下的63个盘子,a柱为空。 因此现在的目标就变成了将这63个盘子由b柱移到c柱。 这个问题和原来的问题完全一样,只是由a柱换为了b柱,规模由64变为了63。 因此可以采用相同的方法,先将上面的62个盘子由b柱移到a柱,再将最下面的盘子移到c柱。 以此内推,再以b柱为辅助,将a柱上面的62个圆盘最上面的61个圆盘移动到b柱,并将最后一块圆盘移到c柱。 我们已经发现规律,我们每次都是以a或b中一根柱子为辅助,然后先将除了最下面的圆盘之外的其他圆盘移动到辅助柱子上,再将最底下的圆盘移到c柱子上,不断重复此过程。 这个反复移动圆盘的过程就是递归,例如我们每次想解决n个圆盘的移动问题,就要先解决(n-1)个盘子进行同样操作的问题。 我们先假设a柱上只有3个圆盘,利用Python进行编程实现圆盘的移动, 代码如下: """ def move(n, a, b, c): if n == 1: print("{} -> {}".format(a, c)) return move(n - 1, a, c, b) move(1, a, b, c) move(n - 1, b, a, c) move(8, "a", "b", "c")
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # 01.py # 2016/10/05(Wed) # walkingmask mojiretsu="パタトクカシーー" print(mojiretsu[1]+mojiretsu[3]+mojiretsu[5]+mojiretsu[7])
# These are words that will appear in most intros, and should be ignored when calculating # the similarity score. # TODO: improve the set of words that we should ignore. IGNORED_WORDS = set(["I", "I'm", "and", "a", "to"]) class Student: name = "" email = "" year = 1 gender = "Female" should_match_with_same_gender = False intro = "" def __init__(self, name, email, year, gender, should_match_with_same_gender, intro): self.name = name self.email = email self.year = year self.gender = gender self.should_match_with_same_gender = should_match_with_same_gender self.intro = intro def __eq__(self, other): return self.email == other.email def __hash__(self): return hash(self.email) def build_rankings(from_students, to_students): """ Build dictionary of students to list of their preferred students, in order. Parameters ---------- from_students: Iterable[Student] These students are the rankers, used as dict keys to_students: Iterable[Student] These students are the rankees, used as dict values Output ------ Dict[Student, List[Student]] """ def getvalue(pair): return pair[1] rankings = {} for student in from_students: student_rankings = {} for other_student in to_students: student_rankings[other_student] = _calculate_points(student, other_student) student_rankings_pairs = sorted(student_rankings.items(), key=getvalue, reverse=True) student_rankings_list = [other for other, _ in student_rankings_pairs] rankings[student] = student_rankings_list return rankings def _calculate_points(ranker, rankee): """ Quantify how much the ranker might prefer to be matched with the rankee based on whether or not the ranker has a gender preference, and how similar their intros are. """ # Add points based on words shared in intros points = 0 ranker_words = set(ranker.intro.split()) rankee_words = set(rankee.intro.split()) words_in_common = ranker_words.intersection(rankee_words).difference(IGNORED_WORDS) points += len(words_in_common) # Add points if gender preferences match if ranker.should_match_with_same_gender and ranker.gender == rankee.gender: points += 10 return points
# # PySNMP MIB module HUAWEI-PPP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-PPP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:36:10 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint") hwDatacomm, = mibBuilder.importSymbols("HUAWEI-MIB", "hwDatacomm") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance") ModuleIdentity, MibIdentifier, Gauge32, ObjectIdentity, Integer32, Counter32, Counter64, NotificationType, Unsigned32, iso, Bits, TimeTicks, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "MibIdentifier", "Gauge32", "ObjectIdentity", "Integer32", "Counter32", "Counter64", "NotificationType", "Unsigned32", "iso", "Bits", "TimeTicks", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TruthValue, DisplayString, RowStatus, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "DisplayString", "RowStatus", "TextualConvention") hwPppMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169)) if mibBuilder.loadTexts: hwPppMIB.setLastUpdated('200710172230Z') if mibBuilder.loadTexts: hwPppMIB.setOrganization('Huawei Technologies co.,Ltd.') hwPppObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1)) hwPppConfigTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1), ) if mibBuilder.loadTexts: hwPppConfigTable.setStatus('current') hwPppConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1, 1), ).setIndexNames((0, "HUAWEI-PPP-MIB", "hwPppIfIndex")) if mibBuilder.loadTexts: hwPppConfigEntry.setStatus('current') hwPppIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1, 1, 1), InterfaceIndex()) if mibBuilder.loadTexts: hwPppIfIndex.setStatus('current') hwPppMruNegType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ipv4", 1), ("ipv6", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwPppMruNegType.setStatus('current') hwPppMpIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 1, 1, 12), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwPppMpIfIndex.setStatus('current') hwPppAuthenticateTable = MibTable((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2), ) if mibBuilder.loadTexts: hwPppAuthenticateTable.setStatus('current') hwPppAuthenticateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1), ).setIndexNames((0, "HUAWEI-PPP-MIB", "hwPppIfIndex")) if mibBuilder.loadTexts: hwPppAuthenticateEntry.setStatus('current') hwPppAuthenticateMode = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("chap", 1), ("pap", 2), ("chappap", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwPppAuthenticateMode.setStatus('current') hwPppAuthenticateChapUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 12), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwPppAuthenticateChapUserName.setStatus('current') hwPppAuthenticateChapPwType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("cipher", 1), ("simple", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwPppAuthenticateChapPwType.setStatus('current') hwPppAuthenticateChapPw = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 14), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(1, 16), ValueSizeConstraint(24, 24), ))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwPppAuthenticateChapPw.setStatus('current') hwPppAuthenticatePapUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 15), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwPppAuthenticatePapUserName.setStatus('current') hwPppAuthenticatePapPwType = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("cipher", 1), ("simple", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwPppAuthenticatePapPwType.setStatus('current') hwPppAuthenticatePapPw = MibTableColumn((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 1, 2, 1, 17), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(1, 16), ValueSizeConstraint(24, 24), ))).setMaxAccess("readwrite") if mibBuilder.loadTexts: hwPppAuthenticatePapPw.setStatus('current') hwPppConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11)) hwPppCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 1)) hwPppCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 1, 1)).setObjects(("HUAWEI-PPP-MIB", "hwPppConfigObjectGroup"), ("HUAWEI-PPP-MIB", "hwPppAuthenticateObjectGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hwPppCompliance = hwPppCompliance.setStatus('current') hwPppGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 2)) hwPppConfigObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 2, 1)).setObjects(("HUAWEI-PPP-MIB", "hwPppMruNegType"), ("HUAWEI-PPP-MIB", "hwPppMpIfIndex")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hwPppConfigObjectGroup = hwPppConfigObjectGroup.setStatus('current') hwPppAuthenticateObjectGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 2011, 5, 25, 169, 11, 2, 2)).setObjects(("HUAWEI-PPP-MIB", "hwPppAuthenticateMode"), ("HUAWEI-PPP-MIB", "hwPppAuthenticateChapUserName"), ("HUAWEI-PPP-MIB", "hwPppAuthenticateChapPwType"), ("HUAWEI-PPP-MIB", "hwPppAuthenticateChapPw"), ("HUAWEI-PPP-MIB", "hwPppAuthenticatePapUserName"), ("HUAWEI-PPP-MIB", "hwPppAuthenticatePapPwType"), ("HUAWEI-PPP-MIB", "hwPppAuthenticatePapPw")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hwPppAuthenticateObjectGroup = hwPppAuthenticateObjectGroup.setStatus('current') mibBuilder.exportSymbols("HUAWEI-PPP-MIB", hwPppAuthenticateMode=hwPppAuthenticateMode, hwPppAuthenticateChapUserName=hwPppAuthenticateChapUserName, hwPppConformance=hwPppConformance, hwPppIfIndex=hwPppIfIndex, hwPppAuthenticatePapPw=hwPppAuthenticatePapPw, hwPppConfigObjectGroup=hwPppConfigObjectGroup, hwPppMruNegType=hwPppMruNegType, hwPppCompliances=hwPppCompliances, PYSNMP_MODULE_ID=hwPppMIB, hwPppGroups=hwPppGroups, hwPppAuthenticateEntry=hwPppAuthenticateEntry, hwPppObjects=hwPppObjects, hwPppConfigEntry=hwPppConfigEntry, hwPppAuthenticateTable=hwPppAuthenticateTable, hwPppAuthenticateChapPw=hwPppAuthenticateChapPw, hwPppAuthenticateChapPwType=hwPppAuthenticateChapPwType, hwPppAuthenticatePapUserName=hwPppAuthenticatePapUserName, hwPppCompliance=hwPppCompliance, hwPppConfigTable=hwPppConfigTable, hwPppAuthenticateObjectGroup=hwPppAuthenticateObjectGroup, hwPppAuthenticatePapPwType=hwPppAuthenticatePapPwType, hwPppMIB=hwPppMIB, hwPppMpIfIndex=hwPppMpIfIndex)
n = int(input('Digite um número: ')) print('''Escolha uma das bases para conversão: [ 1 ] BINÁRIO [ 2 ] OCTAL [ 3 ] HEXADECIMAL''') o = int(input('Qual a base de conversão: ')) while o < 1 or o > 3: o = int(input('Qual a base de conversão: ')) if n == 1: print(f'{n} convertido para BINÁRIO é {bin(n)[2:]}') elif n ==2: print(f'{n} convertido para OCTAL é {oct(n)[2:]}') else: print(f'{n} convertido para HEXADECIMAL é {hex(n)[2:]}')
class ColorLanguageTranslator: START = "CRYCYMCRW" END = "CMW" @staticmethod def base7(num): if num == 0: return '0' new_num_string = '' current = num while current != 0: remainder = current % 7 remainder_string = str(remainder) new_num_string = remainder_string + new_num_string current //= 7 return new_num_string # Function for converting a base-7 number(given as a string) to a 3 digit color code: @staticmethod def base7_to_color_code(num): colorDict = { '0': 'K', '1': 'R', '2': 'G', '3': 'Y', '4': 'B', '5': 'M', '6': 'C', } if len(num) == 1: num = "00" + num elif len(num) == 2: num = "0" + num chars = list(num) return colorDict[chars[0]] + colorDict[chars[1]] + colorDict[chars[2]] @staticmethod def translate(byte_array): color_sequence = "".join([ColorLanguageTranslator.base7_to_color_code(ColorLanguageTranslator.base7(x)) for x in byte_array]) sequence_with_repetition = ColorLanguageTranslator.START + color_sequence + ColorLanguageTranslator.END end_sequence = "" for i, c in enumerate(sequence_with_repetition): if i == 0 or sequence_with_repetition[i - 1] != c or end_sequence[i - 1] == 'W': end_sequence += c else: end_sequence += 'W' return end_sequence
class RhinoObjectSelectionEventArgs(EventArgs): # no doc Document=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get: Document(self: RhinoObjectSelectionEventArgs) -> RhinoDoc """ RhinoObjects=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get: RhinoObjects(self: RhinoObjectSelectionEventArgs) -> Array[RhinoObject] """ Selected=property(lambda self: object(),lambda self,v: None,lambda self: None) """Returns true if objects are being selected. Returns false if objects are being deseleced. Get: Selected(self: RhinoObjectSelectionEventArgs) -> bool """
#https://codeforces.com/problemset/problem/734/A input() string = input() a = string.count('A') d = string.count('D') if(a>d): print('Anton') elif d>a: print('Danik') else: print('Friendship')
class ConnectionValidationInfo(object,IDisposable): """ This object contains information about fabrication connection validations. ConnectionValidationInfo() """ def Dispose(self): """ Dispose(self: ConnectionValidationInfo) """ pass def GetWarning(self,index): """ GetWarning(self: ConnectionValidationInfo,index: int) -> ConnectionValidationWarning Access specific warning number of warnings generated by reload. """ pass def IsValidWarningIndex(self,index): """ IsValidWarningIndex(self: ConnectionValidationInfo,index: int) -> bool Validate warning index. """ pass def ManyWarnings(self): """ ManyWarnings(self: ConnectionValidationInfo) -> int Returns number of warnings generated by reload. """ pass def ReleaseUnmanagedResources(self,*args): """ ReleaseUnmanagedResources(self: ConnectionValidationInfo,disposing: bool) """ 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 def __repr__(self,*args): """ __repr__(self: object) -> str """ pass IsValidObject=property(lambda self: object(),lambda self,v: None,lambda self: None) """Specifies whether the .NET object represents a valid Revit entity. Get: IsValidObject(self: ConnectionValidationInfo) -> bool """
# Round the number from input to the required number of # decimals. # The input format: # Two lines: the first with a floating-point number, the second # with an integer representing the decimal count. # The output format: # A formatted string containing the rounded number. # Do NOT forget to convert the input numbers and to enclose # each value in {} in a formatted string # Sample Input 1: # 2.71828 # 3 # Sample Output 1: # 2.718 # first solution decimal = float(input()) nth_place = int(input()) print(f'%.{nth_place}f' % decimal) #second sol print(f'{decimal:.{nth_place}f}') #one line code print(f"{float(input()):.{int(input())}f}")
# # Copyright (c) 2022 Samuel J. McKelvie # # MIT License - See LICENSE file accompanying this package. # """Exception classes for cloud_init_gen package""" class CloudInitGenError(Exception): """Generic exception raised by package cloud_init_gen""" pass
''' This is the position of all the pieces, in a dictionary. This data is essential for the gameplay to work ''' position_dic = { 'a1': "Left White Rook", 'b1': "Left White Knight", 'c1': "Left White Bishop", 'd1': "White Queen", 'e1': "White King", 'f1': "Right White Bishop", 'g1': "Right White Knight", 'h1': "Right White Rook", 'a2': "White Pawn1", 'b2': "White Pawn2", 'c2': "White Pawn3", 'd2': "White Pawn4", 'e2': "White Pawn5", 'f2': "White Pawn6", 'g2': "White Pawn7", 'h2': "White Pawn8", 'a3': "None", 'b3': "None", 'c3': "None", 'd3': "None", 'e3': "None", 'f3': "None", 'g3': "None", 'h3': "None", 'a4': "None", 'b4': "None", 'c4': "None", 'd4': "None", 'e4': "None", 'f4': "None", 'g4': "None", 'h4': "None", 'a5': "None", 'b5': "None", 'c5': "None", 'd5': "None", 'e5': "None", 'f5': "None", 'g5': "None", 'h5': "None", 'a6': "None", 'b6': "None", 'c6': "None", 'd6': "None", 'e6': "None", 'f6': "None", 'g6': "None", 'h6': "None", 'a8': "Left Black Rook", 'b8': "Left Black Knight", 'c8': "Left Black Bishop", 'd8': "Black Queen", 'e8': "Black King", 'f8': "Right Black Bishop", 'g8': "Right Black Knight", 'h8': "Right Black Rook", 'a7': "Black Pawn1", 'b7': "Black Pawn2", 'c7': "Black Pawn3", 'd7': "Black Pawn4", 'e7': "Black Pawn5", 'f7': "Black Pawn6", 'g7': "Black Pawn7", 'h7': "Black Pawn8" } ''' Decalres what team is allowed to move their pieces ''' conversion_to_number = {'a1': 1, 'b1': 2, 'c1': 3, 'd1':4, 'e1':5, 'f1':6, 'g1':7, 'h1':8, 'a2': 9, 'b2': 10, 'c2': 11, 'd2':12, 'e2':13, 'f2':14, 'g2':15, 'h2':16, 'a3': 17, 'b3': 18, 'c3': 19, 'd3':20, 'e3':21, 'f3':22, 'g3':23, 'h3':24, 'a4': 25, 'b4': 26, 'c4': 27, 'd4':28, 'e4':29, 'f4':30, 'g4':31, 'h4':32, 'a5': 33, 'b5': 34, 'c5': 35, 'd5':36, 'e5':37, 'f5':38, 'g5':39, 'h5':40, 'a6': 41, 'b6': 42, 'c6': 43, 'd6':44, 'e6':45, 'f6':46, 'g6':47, 'h6':48, 'a7': 49, 'b7': 50, 'c7':51, 'd7':52, 'e7':53, 'f7':54, 'g7':55, 'h7':56, 'a8': 57, 'b8': 58, 'c8': 59, 'd8':60, 'e8':61, 'f8':62, 'g8':63, 'h8':64} team_turn = 1
count = 0 def max_ind_set(nodes, edges): global count if len(nodes) <= 1: return len(nodes) node = nodes[0] # pick a node # case 1: node lies in independent set => remove neighbours as well nodes1 = [ n for n in nodes if n != node and (node, n) not in edges ] size1 = 1 + max_ind_set(nodes1, edges) count += 1 # case 2: node does not lie in independent set nodes2 = [ n for n in nodes if n != node ] size2 = max_ind_set(nodes2, edges) count += 1 return max(size1, size2) def max_ind_set_improved(nodes, edges): if len(nodes) <= 1: return len(nodes) node = nodes[0] # pick a node # case 1: node lies in independent set => remove neighbours as well nodes1 = [ n for n in nodes if n != node and (node, n) not in edges ] size1 = 1 + max_ind_set_improved(nodes1, edges) if len([ n for n in nodes if (node, n) in edges ]) <= 1: return size1 # case 2: node does not lie in independent set nodes2 = [ n for n in nodes if n != node ] size2 = max_ind_set_improved(nodes2, edges) return max(size1, size2) if __name__ == '__main__': nodes = [1,2,3,4,5,6,7,8] edges = [(1,2),(1,3),(2,3),(2,4),(3,5),(4,5),(4,6),(5,7),(6,7),(6,8),(7,8)] # undirected graph => edges go in both directions (simplifies algorithms) edges += [ (b,a) for (a,b) in edges ] print("max_ind_set = {}".format(max_ind_set(nodes,edges))) print("max_ind_set_improved = {}".format(max_ind_set_improved(nodes,edges))) print(count)
# encoding: utf-8 # module Grasshopper.Kernel.Undo calls itself Undo # from Grasshopper,Version=1.0.0.20,Culture=neutral,PublicKeyToken=dda4f5ec2cd80803 # by generator 1.145 """ NamespaceTracker represent a CLS namespace. """ # no imports # no functions # classes class GH_UndoAction(object, IGH_UndoAction, GH_ISerializable): # no doc def Internal_Redo(self, *args): """ Internal_Redo(self: GH_UndoAction,doc: GH_Document) """ pass def Internal_Undo(self, *args): """ Internal_Undo(self: GH_UndoAction,doc: GH_Document) """ pass def Read(self, reader): """ Read(self: GH_UndoAction,reader: GH_IReader) -> bool """ pass def Redo(self, doc): """ Redo(self: GH_UndoAction,doc: GH_Document) """ pass def Undo(self, doc): """ Undo(self: GH_UndoAction,doc: GH_Document) """ pass def Write(self, writer): """ Write(self: GH_UndoAction,writer: GH_IWriter) -> bool """ 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 def __repr__(self, *args): """ __repr__(self: object) -> str """ pass ExpiresDisplay = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get: ExpiresDisplay(self: GH_UndoAction) -> bool """ ExpiresSolution = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get: ExpiresSolution(self: GH_UndoAction) -> bool """ State = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: State(self: GH_UndoAction) -> GH_UndoState """ class GH_ArchivedUndoAction(GH_UndoAction, IGH_UndoAction, GH_ISerializable): # no doc def Deserialize(self, *args): """ Deserialize(self: GH_ArchivedUndoAction,obj: GH_ISerializable) """ pass def Internal_Redo(self, *args): """ Internal_Redo(self: GH_UndoAction,doc: GH_Document) """ pass def Internal_Undo(self, *args): """ Internal_Undo(self: GH_UndoAction,doc: GH_Document) """ pass def Read(self, reader): """ Read(self: GH_ArchivedUndoAction,reader: GH_IReader) -> bool """ pass def Serialize(self, *args): """ Serialize(self: GH_ArchivedUndoAction,obj: GH_ISerializable) """ pass def SerializeToByteArray(self, *args): """ SerializeToByteArray(self: GH_ArchivedUndoAction,obj: GH_ISerializable) -> Array[Byte] """ pass def Write(self, writer): """ Write(self: GH_ArchivedUndoAction,writer: GH_IWriter) -> bool """ 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 m_data = None class GH_ObjectUndoAction(GH_UndoAction, IGH_UndoAction, GH_ISerializable): # no doc def Internal_Redo(self, *args): """ Internal_Redo(self: GH_ObjectUndoAction,doc: GH_Document) """ pass def Internal_Undo(self, *args): """ Internal_Undo(self: GH_ObjectUndoAction,doc: GH_Document) """ pass def Object_Redo(self, *args): """ Object_Redo(self: GH_ObjectUndoAction,doc: GH_Document,obj: IGH_DocumentObject) """ pass def Object_Undo(self, *args): """ Object_Undo(self: GH_ObjectUndoAction,doc: GH_Document,obj: IGH_DocumentObject) """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self, *args): # cannot find CLR constructor """ __new__(cls: type,object_id: Guid) """ pass class GH_UndoException(Exception, ISerializable, _Exception): """ GH_UndoException(message: str) GH_UndoException(message: str,*args: Array[object]) """ def add_SerializeObjectState(self, *args): """ add_SerializeObjectState(self: Exception,value: EventHandler[SafeSerializationEventArgs]) """ pass def remove_SerializeObjectState(self, *args): """ remove_SerializeObjectState(self: Exception,value: EventHandler[SafeSerializationEventArgs]) """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self, message, args=None): """ __new__(cls: type,message: str) __new__(cls: type,message: str,*args: Array[object]) """ pass def __str__(self, *args): pass class GH_UndoRecord(object): """ GH_UndoRecord() GH_UndoRecord(name: str) GH_UndoRecord(name: str,action: IGH_UndoAction) GH_UndoRecord(name: str,*actions: Array[IGH_UndoAction]) GH_UndoRecord(name: str,actions: IEnumerable[IGH_UndoAction]) """ def AddAction(self, action): """ AddAction(self: GH_UndoRecord,action: IGH_UndoAction) """ pass def Redo(self, doc): """ Redo(self: GH_UndoRecord,doc: GH_Document) """ pass def Undo(self, doc): """ Undo(self: GH_UndoRecord,doc: GH_Document) """ pass @staticmethod def __new__(self, name=None, *__args): """ __new__(cls: type) __new__(cls: type,name: str) __new__(cls: type,name: str,action: IGH_UndoAction) __new__(cls: type,name: str,*actions: Array[IGH_UndoAction]) __new__(cls: type,name: str,actions: IEnumerable[IGH_UndoAction]) """ pass ActionCount = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get: ActionCount(self: GH_UndoRecord) -> int """ Actions = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: Actions(self: GH_UndoRecord) -> IList[IGH_UndoAction] """ ExpiresDisplay = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get: ExpiresDisplay(self: GH_UndoRecord) -> bool """ ExpiresSolution = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get: ExpiresSolution(self: GH_UndoRecord) -> bool """ Guid = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: Guid(self: GH_UndoRecord) -> Guid """ Name = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: Name(self: GH_UndoRecord) -> str Set: Name(self: GH_UndoRecord)=value """ State = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: State(self: GH_UndoRecord) -> GH_UndoState """ Time = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: Time(self: GH_UndoRecord) -> DateTime """ class GH_UndoServer(object, IGH_DebugDescription): """ GH_UndoServer(nOwner: GH_Document) """ def AppendToDebugLog(self, writer): """ AppendToDebugLog(self: GH_UndoServer,writer: GH_DebugDescriptionWriter) """ pass def Clear(self): """ Clear(self: GH_UndoServer) """ pass def ClearRedo(self): """ ClearRedo(self: GH_UndoServer) """ pass def ClearUndo(self): """ ClearUndo(self: GH_UndoServer) """ pass def PerformRedo(self): """ PerformRedo(self: GH_UndoServer) """ pass def PerformUndo(self): """ PerformUndo(self: GH_UndoServer) """ pass def PushUndoRecord(self, *__args): """ PushUndoRecord(self: GH_UndoServer,name: str,action: GH_UndoAction) -> Guid PushUndoRecord(self: GH_UndoServer,record: GH_UndoRecord) """ pass def RemoveRecord(self, id): """ RemoveRecord(self: GH_UndoServer,id: Guid) -> bool """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self, nOwner): """ __new__(cls: type,nOwner: GH_Document) """ pass def __repr__(self, *args): """ __repr__(self: object) -> str """ pass FirstRedoName = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get: FirstRedoName(self: GH_UndoServer) -> str """ FirstUndoName = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get: FirstUndoName(self: GH_UndoServer) -> str """ MaxRecords = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get: MaxRecords(self: GH_UndoServer) -> int Set: MaxRecords(self: GH_UndoServer)=value """ RedoCount = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: RedoCount(self: GH_UndoServer) -> int """ RedoGuids = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: RedoGuids(self: GH_UndoServer) -> List[Guid] """ RedoNames = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: RedoNames(self: GH_UndoServer) -> List[str] """ UndoCount = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: UndoCount(self: GH_UndoServer) -> int """ UndoGuids = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: UndoGuids(self: GH_UndoServer) -> List[Guid] """ UndoNames = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: UndoNames(self: GH_UndoServer) -> List[str] """ class GH_UndoState(Enum, IComparable, IFormattable, IConvertible): """ enum GH_UndoState,values: redo (1),undo (0) """ def __eq__(self, *args): """ x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """ pass def __format__(self, *args): """ __format__(formattable: IFormattable,format: str) -> str """ pass def __ge__(self, *args): pass def __gt__(self, *args): 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 def __le__(self, *args): pass def __lt__(self, *args): pass def __ne__(self, *args): pass def __reduce_ex__(self, *args): pass def __str__(self, *args): pass redo = None undo = None value__ = None class IGH_UndoAction(GH_ISerializable): # no doc def Redo(self, doc): """ Redo(self: IGH_UndoAction,doc: GH_Document) """ pass def Undo(self, doc): """ Undo(self: IGH_UndoAction,doc: GH_Document) """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass ExpiresDisplay = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get: ExpiresDisplay(self: IGH_UndoAction) -> bool """ ExpiresSolution = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Get: ExpiresSolution(self: IGH_UndoAction) -> bool """ State = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get: State(self: IGH_UndoAction) -> GH_UndoState """ # variables with complex values
"""j2cl_test build macro Works similarly to junit_test; see j2cl_test_common.bzl for details """ load(":j2cl_test_common.bzl", "j2cl_test_common") # buildifier: disable=function-docstring-args def j2cl_test( name, tags = [], **kwargs): """Macro for running a JUnit test cross compiled as a web test This macro uses the j2cl_test_tranpile macro to transpile tests and feed them into a jsunit_test. """ j2cl_test_common( name, tags = tags + ["j2cl"], **kwargs )
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. load("//antlir/bzl:shape.bzl", "shape") load("//antlir/bzl:target_tagger.bzl", "new_target_tagger", "target_tagger_to_feature") load(":requires.shape.bzl", "requires_t") def feature_requires( users = None, groups = None, files = None): """ `feature.requires(...)` adds macro-level requirements on image layers. Currently this supports requiring users, groups and files to exist in the layer being built. This feature doesn't materialize anything in the built image, but it will cause a compiler error if any of the users/groups that are requested do not exist in either the `parent_layer` or the layer being built. An example of a reasonable use-case of this functionality is defining a macro that generates systemd units that run as a specific user, where `feature.requires` can be used for additional compile-time safety that the user, groups or files do indeed exist. """ req = shape.new( requires_t, users = users, groups = groups, files = files, ) return target_tagger_to_feature( new_target_tagger(), items = struct(requires = [req]), # The `fake_macro_library` docblock explains this self-dependency extra_deps = ["//antlir/bzl/image/feature:requires"], )
ENCRYPTED_MESSAGE = 'IQ PQTVJ CV PQQP' DECRYPTED_MESSAGE = 'GO NORTH AT NOON' CIPHER_OPTIONS = ['null','caesar','atbash'] cipher_used_in_this_example = CIPHER_OPTIONS[1] # replace with the index of the cipher used in this encryption
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"img_resize": "00_clipmodel.ipynb", "imgs_resize": "00_clipmodel.ipynb", "dict_to_device": "00_clipmodel.ipynb", "norm": "00_clipmodel.ipynb", "detach_norm": "00_clipmodel.ipynb", "text2clip_en": "00_clipmodel.ipynb", "images2clip_en": "00_clipmodel.ipynb", "image2clip": "00_clipmodel.ipynb", "en_model_name": "00_clipmodel.ipynb", "tokenizer": "00_clipmodel.ipynb", "en_processor": "00_clipmodel.ipynb", "en_size": "00_clipmodel.ipynb", "en_dim": "00_clipmodel.ipynb", "images2clip": "00_clipmodel.ipynb", "text2clip": "00_clipmodel.ipynb", "read_sql_query": "00_custom_pandas.ipynb", "Path.ls": "00_tools.ipynb", "mapbox_access_token": "00_paths.ipynb", "main_path": "00_paths.ipynb", "data_path": "00_paths.ipynb", "reference_images_path": "00_paths.ipynb", "testset_path": "00_paths.ipynb", "engine": "00_psql.ipynb", "Session": "00_psql.ipynb", "session": "00_psql.ipynb", "Base": "00_psql.ipynb", "du": "00_psql.ipynb", "query": "00_psql.ipynb", "current": "00_psql.ipynb", "kill": "00_tools.ipynb", "schema": "00_psql.ipynb", "LocalBase": "00_psql.ipynb", "insert_on_conflict": "00_psql.ipynb", "read_sql": "00_psql.ipynb", "Foods": "00_psql.ipynb", "Users": "00_psql.ipynb", "Dishes": "00_psql.ipynb", "User_properties": "00_psql.ipynb", "FoodsP": "00_psql.ipynb", "FoodsPI": "00_psql.ipynb", "FFoods": "00_psql.ipynb", "Food_reference_images": "00_psql.ipynb", "Portions": "00_psql.ipynb", "Indexed": "00_psql.ipynb", "collection_name": "01_search.ipynb", "dim": "00_qdrant.ipynb", "QdrantClient.get_collections": "00_qdrant.ipynb", "QdrantClient.collection_len": "00_qdrant.ipynb", "prod_client": "00_qdrant.ipynb", "dev_client": "00_qdrant.ipynb", "get_image_from_url": "00_tools.ipynb", "get_hash_folder": "00_tools.ipynb", "save_selected_cities": "00_tools.ipynb", "save_location_dicts": "00_tools.ipynb", "get_top_n_countries": "00_tools.ipynb", "path_info": "00_tools.ipynb", "rm_r": "00_tools.ipynb", "search_notebooks": "00_tools.ipynb", "df_chunk_generator": "00_tools.ipynb", "docker_container": "00_tools.ipynb", "LogDBHandler": "00_tools.ipynb", "get_logger": "00_tools.ipynb", "read_image_from_url": "01_search.ipynb", "compound_return": "00_tools.ipynb", "copy_func": "00_tools.ipynb", "patch_to": "00_tools.ipynb", "patch": "00_tools.ipynb", "to_pickle": "00_tools.ipynb", "from_pickle": "00_tools.ipynb", "telegram": "00_tools.ipynb", "pdrows": "00_tools.ipynb", "pd_highlight": "00_tools.ipynb", "inline": "00_tools.ipynb", "plot_map": "00_tools.ipynb", "htop": "00_tools.ipynb", "get_proxies": "00_tools.ipynb", "append_csv": "00_tools.ipynb", "repeat_df": "00_tools.ipynb", "to_sql": "00_tools.ipynb", "timestamp2int": "00_tools.ipynb", "pd_timestamp": "00_tools.ipynb", "startEndTimestamp": "00_tools.ipynb", "pd_set_float": "00_tools.ipynb", "plot_multiple_y": "00_tools.ipynb", "sql_head": "00_tools.ipynb", "make_clickable": "00_tools.ipynb", "selected_countries": "00_tools.ipynb", "foods": "01_search.ipynb", "search_image": "01_search.ipynb", "cos": "01_search.ipynb", "table": "01_search.ipynb", "search_image_": "01_search.ipynb", "series2tensor": "01_search.ipynb", "multiply_vector": "01_search.ipynb", "drop_vector": "01_search.ipynb", "multiple_foods": "01_search.ipynb"} modules = ["clipmodel.py", "custom_pandas.py", "paths.py", "psql.py", "qdrant.py", "tools.py", "classify_image.py", "search.py"] doc_url = "https://{user}.github.io/food/" git_url = "https://github.com/{user}/food/tree/{branch}/" def custom_doc_links(name): return None
#!/usr/bin/env python # -*- coding: utf-8 -*- def calculate(n, d): s = str(n) m = -1 for i in range(0, len(s) - d + 1): p = 1 for j in range(0, d): p *= int(s[i+j]) if p > m: m = p return m # https://stackoverflow.com/questions/12385040/python-defining-an-integer-variable-over-multiple-lines num = int(""" 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445244523161731856403098711121722383113 62229893423380308135336276614282806444486645238749 30358907296290491560440772390713810515859307960866 70172427121883998797908792274921901699720888093776 65727333001053367881220235421809751254540594752243 52584907711670556013604839586446706324415722155397 53697817977846174064955149290862569321978468622482 83972241375657056057490261407972968652414535100474 82166370484403199890008895243450658541227588666881 16427171479924442928230863465674813919123162824586 17866458359124566529476545682848912883142607690042 24219022671055626321111109370544217506941658960408 07198403850962455444362981230987879927244284909188 84580156166097919133875499200524063689912560717606 05886116467109405077541002256983155200055935729725 71636269561882670428252483600823257530420752963450""".replace("\n","")) print(calculate(num, 4)) print(calculate(num, 13))
# -*- coding: utf-8 -*- __author__ = 'Russell Davies' __copyright__ = 'Copyright (c) 2019-present - Russell Davies' __description__ = 'The blakemere package provides a collection of python libraries created by Russell Davies.' __email__ = 'russell@blakemere.ca' __license__ = 'MIT' __title__ = 'blakemere' __version__ = '0.1.0'
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ICM-20948: Low power 9-axis MotionTracking device that is ideally suited for Smartphones, Tablets, Wearable Sensors, and IoT applications.""" __author__ = "ChISL" __copyright__ = "TBD" __credits__ = ["TDK Invensense"] __license__ = "TBD" __version__ = "Version 0.1" __maintainer__ = "https://chisl.io" __email__ = "info@chisl.io" __status__ = "Test" # # THIS FILE IS AUTOMATICALLY CREATED # D O N O T M O D I F Y ! # class REG: WHO_AM_I = 0 USER_CTRL = 3 LP_CONFIG = 5 PWR_MGMT_1 = 6 PWR_MGMT_2 = 7 INT_PIN_CFG = 15 INT_ENABLE = 16 INT_ENABLE_1 = 17 INT_ENABLE_2 = 18 INT_ENABLE_3 = 19 I2C_MST_STATUS = 23 INT_STATUS = 25 INT_STATUS_1 = 26 INT_STATUS_2 = 27 INT_STATUS_3 = 28 DELAY_TIMEH = 40 DELAY_TIMEL = 41 ACCEL_XOUT_H = 45 ACCEL_XOUT_L = 46 ACCEL_YOUT_H = 47 ACCEL_YOUT_L = 48 ACCEL_ZOUT_H = 49 ACCEL_ZOUT_L = 50 GYRO_XOUT_H = 51 GYRO_XOUT_L = 52 GYRO_YOUT_H = 53 GYRO_YOUT_L = 54 GYRO_ZOUT_H = 55 GYRO_ZOUT_L = 56 TEMP_OUT_H = 57 TEMP_OUT_L = 58 EXT_SLV_SENS_DATA_00 = 59 EXT_SLV_SENS_DATA_01 = 60 EXT_SLV_SENS_DATA_02 = 61 EXT_SLV_SENS_DATA_03 = 62 EXT_SLV_SENS_DATA_04 = 63 EXT_SLV_SENS_DATA_05 = 64 EXT_SLV_SENS_DATA_06 = 65 EXT_SLV_SENS_DATA_07 = 66 EXT_SLV_SENS_DATA_08 = 67 EXT_SLV_SENS_DATA_09 = 68 EXT_SLV_SENS_DATA_10 = 69 EXT_SLV_SENS_DATA_11 = 70 EXT_SLV_SENS_DATA_12 = 71 EXT_SLV_SENS_DATA_13 = 72 EXT_SLV_SENS_DATA_14 = 73 EXT_SLV_SENS_DATA_15 = 74 EXT_SLV_SENS_DATA_16 = 75 EXT_SLV_SENS_DATA_17 = 76 EXT_SLV_SENS_DATA_18 = 77 EXT_SLV_SENS_DATA_19 = 78 EXT_SLV_SENS_DATA_20 = 79 EXT_SLV_SENS_DATA_21 = 80 EXT_SLV_SENS_DATA_22 = 81 EXT_SLV_SENS_DATA_23 = 82 FIFO_EN_1 = 102 FIFO_EN_2 = 103 FIFO_RST = 104 FIFO_MODE = 105 FIFO_COUNTH = 112 FIFO_COUNTL = 113 FIFO_R_W = 114 DATA_RDY_STATUS = 116 FIFO_CFG = 118 REG_BANK_SEL = 127
# -*- coding: utf-8 -*- def main(): n = int(input()) a = [int(input()) for _ in range(n)] before = list() after = list() # 操作1を行う必要があるのは, # 操作をする前と条件を満たすよう操作した後で # 各要素の位置の偶奇が不一致のときではないか? for index, ai in enumerate(a, 1): before.append((ai, index % 2)) for index, ai in enumerate(sorted(a), 1): after.append((ai, index % 2)) count = 0 for b, a in zip(sorted(before), after): if b[1] != a[1]: count += 1 # 1回の操作で,2個の位置を変えられる print(count // 2) if __name__ == '__main__': main()
def mergeList(lis1, list2): print("list1 =", list1) print("list2 =", list2) list3 = [] for i in list1: if(i % 2 == 1): list3.append(i) for i in list2: if(i % 2 == 0): list3.append(i) return list3 list1 = [10, 20, 23, 11, 17] list2 = [13, 43, 24, 36, 12] print("Result List is", mergeList(list1, list2))
# -*- coding: utf-8 -*- # by Juan Carlos Montoya <odooerpcloud@gmail.com> { 'name': "Library Management", 'summary': """ Library Management Module for Odoo 11 """, 'description': """ Library Management Module for Odoo 11 """, 'author': "Odoo ERP Cloud", 'website': "http://odooerpcloud.com", 'category': 'Tools', 'version': '0.1', # any module necessary for this one to work correctly 'depends': ['base'], # always loaded 'data': [ "security/groups.xml", "security/ir.model.access.csv", "views/book_view.xml", "data/books.xml", ], 'application': True, }