content
stringlengths
7
1.05M
class Solution: def nextGreaterElement(self, n: int) -> int: s = list(str(n)) i = len(s) - 1 while i - 1 >= 0 and s[i - 1] >= s[i]: i -= 1 if i == 0: return -1 j = len(s) - 1 while s[j] <= s[i - 1]: j -= 1 s[i - 1], s[j] = s[j], s[i - 1] s[i:] = s[i:][::-1] res = int(''.join(s)) if res <= 2 ** 31 - 1: return res return -1
class MyrialCompileException(Exception): pass class MyrialUnexpectedEndOfFileException(MyrialCompileException): def __str__(self): return "Unexpected end-of-file" class MyrialParseException(MyrialCompileException): def __init__(self, token): self.token = token def __str__(self): return 'Parse error at token %s on line %d' % (self.token.value, self.token.lineno) class MyrialScanException(MyrialCompileException): def __init__(self, token): self.token = token def __str__(self): return 'Illegal token string %s on line %d' % (self.token.value, self.token.lineno) class DuplicateFunctionDefinitionException(MyrialCompileException): def __init__(self, funcname, lineno): self.funcname = funcname self.lineno = lineno def __str__(self): return 'Duplicate function definition for %s on line %d' % (self.funcname, # noqa self.lineno) # noqa class NoSuchFunctionException(MyrialCompileException): def __init__(self, funcname, lineno): self.funcname = funcname self.lineno = lineno def __str__(self): return 'No such function definition for %s on line %d' % (self.funcname, # noqa self.lineno) # noqa class ReservedTokenException(MyrialCompileException): def __init__(self, token, lineno): self.token = token self.lineno = lineno def __str__(self): return 'The token "%s" on line %d is reserved.' % (self.token, self.lineno) # noqa class InvalidArgumentList(MyrialCompileException): def __init__(self, funcname, expected_args, lineno): self.funcname = funcname self.expected_args = expected_args self.lineno = lineno def __str__(self): return "Incorrect number of arguments for %s(%s) on line %d" % ( self.funcname, ','.join(self.expected_args), self.lineno) class UndefinedVariableException(MyrialCompileException): def __init__(self, funcname, var, lineno): self.funcname = funcname self.var = var self.lineno = lineno def __str__(self): return "Undefined variable %s in function %s at line %d" % ( self.var, self.funcname, self.lineno) class DuplicateVariableException(MyrialCompileException): def __init__(self, funcname, lineno): self.funcname = funcname self.lineno = lineno def __str__(self): return "Duplicately defined in function %s at line %d" % ( self.funcname, self.lineno) class BadApplyDefinitionException(MyrialCompileException): def __init__(self, funcname, lineno): self.funcname = funcname self.lineno = lineno def __str__(self): return "Bad apply definition for in function %s at line %d" % ( self.funcname, self.lineno) class UnnamedStateVariableException(MyrialCompileException): def __init__(self, funcname, lineno): self.funcname = funcname self.lineno = lineno def __str__(self): return "Unnamed state variable in function %s at line %d" % ( self.funcname, self.lineno) class IllegalWildcardException(MyrialCompileException): def __init__(self, funcname, lineno): self.funcname = funcname self.lineno = lineno def __str__(self): return "Illegal use of wildcard in function %s at line %d" % ( self.funcname, self.lineno) class NestedTupleExpressionException(MyrialCompileException): def __init__(self, lineno): self.lineno = lineno def __str__(self): return "Illegal use of tuple expression on line %d" % self.lineno class InvalidEmitList(MyrialCompileException): def __init__(self, function, lineno): self.function = function self.lineno = lineno def __str__(self): return "Wrong number of emit arguments in %s at line %d" % ( self.function, self.lineno) class IllegalColumnNamesException(MyrialCompileException): def __init__(self, lineno): self.lineno = lineno def __str__(self): return "Invalid column names on line %d" % self.lineno class ColumnIndexOutOfBounds(Exception): pass class SchemaMismatchException(MyrialCompileException): def __init__(self, op_name): self.op_name = op_name def __str__(self): return "Incompatible input schemas for %s operation" % self.op_name class NoSuchRelationException(MyrialCompileException): def __init__(self, relname): self.relname = relname def __str__(self): return "No such relation: %s" % self.relname
#punto 1 #entradas n=int(input("Escriba el primer digito ")) k=int(input("Escriba el primer digito ")) #caja negra y salidas while True: n=0 if(k<n): n=n-1 print(n) elif(n==k): print(k) break
''' Created on 2015年12月1日 https://leetcode.com/problems/word-ladder/ @author: Darren ''' def wordLadder(startWord,endWord,wordDic,path,visited): for index in range(len(startWord)): for i in range(26): newWord=startWord[:index]+chr(ord("a")+i)+startWord[index+1:] if newWord==startWord: continue elif newWord==endWord: return path+[endWord] elif newWord in wordDic and newWord not in visited: visited.add(newWord) res=wordLadder(newWord, endWord, wordDic, path+[newWord],visited) if res: return res visited.remove(newWord) return None def wordLadder2(startWord,endWord,wordDic,path,visited,res): for index in range(len(startWord)): for i in range(26): newWord=startWord[:index]+chr(ord("a")+i)+startWord[index+1:] if newWord==startWord: continue elif newWord==endWord: res.append(path+[endWord]) elif newWord in wordDic and newWord not in visited: visited.add(newWord) wordLadder2(newWord, endWord, wordDic, path+[newWord],visited,res) visited.remove(newWord) startWord="hit" endWord="cog" wordDic=["hot","dot","dog","lot","log"] print("->".join(wordLadder(startWord, endWord, wordDic, ["hit"],set()))) res=[] wordLadder2(startWord, endWord, wordDic, [startWord], set(), res) print(res) for item in res: print("->".join(item))
class CandeError(Exception): pass class CandeSerializationError(CandeError): pass class CandeDeserializationError(CandeError): pass class CandeReadError(CandeError): pass class CandePartError(CandeError): pass class CandeFormatError(CandePartError): pass
items = ['T-Shirt','Sweater'] print("*** Note: If you want to quit this program, simply type 'quit' or 'QUIT'.") print("*" * 20) while True: action = (input("Welcome to our shop, what do you want (C, R, U, D)? ")).upper() if action == "R": print("Our items: ", end='') print(*items,sep=', ') elif action == "C": new_item = input("Enter new item: ") items.append(new_item) print("Our items: ", end='') print(*items,sep=', ') elif action == "U": update_pos = int(input("Update position? ")) - 1 if update_pos in range(0,len(items)): update_item = input("New item? ") items[update_pos] = update_item print("Our items: ", end='') print(*items,sep=', ') else: print("Not found.") elif action == "D": delete_pos = int(input("Delete position? ")) - 1 if delete_pos in range(0,len(items)): items.pop(delete_pos) print("Our items: ", end='') print(*items,sep=', ') else: print("Not found.") elif action == "QUIT": break else: print("Wrong command. Type again please!")
''' Catalan numbers (Cn) are a sequence of natural numbers that occur in many places. The most important ones being that Cn gives the number of Binary Search Trees possible with n values. Cn is the number of full Binary Trees with n + 1 leaves. Cn is the number of different ways n + 1 factors can be completely parenthesized. ''' # n denotes the nth Catalan Number that we want to compute n = int(input()) # Catalan array stores the catalan numbers from 1....n Catalan = [0] * (n + 1) # The first two values are 1 for this series Catalan[0] = 1 Catalan[1] = 1 ''' For e.g if n = 5, then Cn = (Catalan(0) * Catalan(4)) + (Catalan(1) * Catalan(3)) + (Catalan(2) * Catalan(2)) + (Catalan(3) * Catalan(1)) + (Catalan(4)* Catalan(0)) We can see here that Catalan numbers form a recursive relation i.e for nth term, the Catalan number Cn is the sum of Catalan(i) * Catalan(n-i-1) where i goes from 0...n-1. We can also observe that several values are getting repeated and hence we optimise the performance by applying memoization. ''' for i in range(2, n + 1): for j in range(0, i): Catalan[i] = Catalan[i] + (Catalan[j] * Catalan[i - j - 1]) # nth Catalan number is given by n - 1th index print("The Catalan Number (Cn) is: " + str(Catalan[n - 1])) ''' Input: 10 Output: The Catalan Number (Cn) is: 4862 Input: 5 Output: The Catalan Number (Cn) is: 14 '''
# operador logico print("Ingrese el valor de a") a = float(input()) print("Ingrese el valor de b") b = float(input()) print("b es mayor que a") print(b > a) print(type(b > a)) print("b es menor que a") print(b < a) print("b es mayor o igual que a") print(b >= a) print("b es menor o igual que a") print(b <= a) print("b es diferente de a") print(b != a) var = b == a print("b = a? ", var)
def similar_users_query(user): # Pass user object, return query to get users who starred same things as them query = """ select subq.user_id , sum(1/log(subq.stargazers_count+1)) `score` , count(*) `count` from (select others.user_id , others.starred_repo_id , repo.repo_name , repo.description , repo.last_modified , repo.language , repo.stargazers_count , repo.forks_count , repo.from_hacker_news from (select user_id , starred_repo_id from github_user_starred_repos where user_id != {0}) others join (select starred_repo_id from github_user_starred_repos where user_id = {0}) usr on others.starred_repo_id=usr.starred_repo_id join (select id , repo_name , description , last_modified , language , stargazers_count , forks_count , from_hacker_news from github_repos) repo on others.starred_repo_id=repo.id) subq group by subq.user_id order by 2 desc """.format(user.id) return query def similar_repos_query(user): # Pass user object, return query to get users who starred same things as them query = """ select other_repos.user_id , other_repos.starred_repo_id , repo.repo_name , repo.description , repo.last_modified , repo.language , repo.stargazers_count , repo.forks_count , repo.from_hacker_news , hn.added_at , hn.submission_time , hn.title , hn.url from (select user_id , starred_repo_id from github_user_starred_repos where user_id != {0}) other_repos join (select distinct(others.user_id) `user_id` from (select user_id , starred_repo_id from github_user_starred_repos where user_id != {0}) others join (select starred_repo_id from github_user_starred_repos where user_id = {0}) usr on others.starred_repo_id = usr.starred_repo_id) others on other_repos.user_id=others.user_id join (select id , repo_name , description , last_modified , language , stargazers_count , forks_count , from_hacker_news from github_repos) repo on other_repos.starred_repo_id=repo.id join (select added_at , submission_time , title , url , github_repo_name from hacker_news) hn on repo.repo_name = hn.github_repo_name """.format(user.id) return query
# Copyright (c) 2017 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """This file defines the constants variables for the TLDK test.""" class TLDKConstants(object): """Define the directory path for the TLDK test.""" # TLDK testing directory location at topology nodes REMOTE_FW_DIR = '/tmp/TLDK-testing' # Shell scripts location TLDK_SCRIPTS = 'tests/tldk/tldk_scripts' # Libraries location TLDK_DEPLIBS = 'tests/tldk/tldk_deplibs' # Config files location for the TLDK test TLDK_TESTCONFIG = 'tests/tldk/tldk_testconfig'
class d_linked_node: def __init__(self, initData, initNext, initPrevious): # constructs a new node and initializes it to contain # the given object (initData) and links to the given next # and previous nodes. self.__data = initData self.__next = initNext self.__previous = initPrevious if (initPrevious != None): initPrevious.__next = self if (initNext != None): initNext.__previous = self def getData(self): return self.__data def getNext(self): return self.__next def getPrevious(self): return self.__previous def setData(self, newData): self.__data = newData def setNext(self, newNext): self.__next= newNext def setPrevious(self, newPrevious): self.__previous= newPrevious
class TimeInBedLessSleepError(Exception): """Ошибка возникающая, если время проведенное в кровати меньше времени сна""" pass class NonUniqueNotationDate(Exception): """Ошибка возникающая, если при импортировании файла с записями находится запись с датой, которая уже существует в дневнике сна/базе данных""" pass Errors = { 'add': 'При добавлении записи в дневник произошла ошибка', 'update': 'При обновлении записи в дневнике произошла ошибка', 'value': 'Неподходящее значение', 'syntax': 'Неподходящий формат', 'type': 'Неподходящий тип данных', 'database': 'При обращении к базе данных произошла ошибка', 'file': 'Файл не был найден', 'import': 'При импортировании произошла ошибка', 'other': 'Прочая ошибка' }
#python program to subtract two numbers using function def subtraction(x,y): #function definifion for subtraction sub=x-y return sub num1=int(input("please enter first number: "))#input from user to num1 num2=int(input("please enter second number: "))#input from user to num2 print("Subtraction is: ",subtraction(num1,num2))#call the function
''' Package to read and process material export data. To use, initiate an endomaterial object and start exploring! --------- Examples: ## Init from ukw_intelli_store import EndoMaterial em = EndoMaterial(path, path) ## To explore all used materials: em.mat_info ## To explore specific material id em.get_mat_info_for_id(material_id) ## To get all logged dgvs keys: em.get_dgvs_keys() ## To explore a single dgvs key: em.get_dgvs_key_summary() ''' __version__ = '0.0.0'
# Source: https://www.geeksforgeeks.org/sets-in-python/ # Python program to # demonstrate intersection # of two sets set1 = [0,1,2,3,4,5] set2 = [3,4,5,6,7,8,9] set3 = set1 + set2 unique_set3 = [] for i in set3: if i not in unique_set3: unique_set3.append(i) print("Intersection using intersection() function") print(set3) print(unique_set3)
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ib.ext.cfg.EWrapperMsgGenerator -> config module for EWrapperMsgGenerator.java. """ modulePreamble = [ 'from ib.ext.AnyWrapperMsgGenerator import AnyWrapperMsgGenerator', 'from ib.ext.Util import Util', ]
class Validator: PLUS_CHAR = 43 AT_CHAR = 64 def __init__(self): self.validation_results = None self.sequence_symbols = list() for symbol in "ACTGN.": self.sequence_symbols.append(ord(symbol)) self.quality_score_symbols = list() for symbol in "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\ [\]^_`abcdefghijklmnopqrstuvwxyz{|}~": self.quality_score_symbols.append(ord(symbol)) def validate(self, file_path): valid = True with open(file_path, 'rb') as source: record = list() for line in source: if not valid: break line = line.rstrip() line_is_not_empty = line # added for readability if line_is_not_empty: record.append(line) record_is_ready = len(record) == 4 if record_is_ready: valid = valid and self._validate_record(record) record.clear() else: valid = False valid = valid and len(record) == 0 return valid def _validate_record(self, record): valid_identifier = self._validate_identifier_line(record[0]) valid_bases = self._validate_bases(record[1]) valid_plus = self._validate_plus(record[2]) valid_quality_scores = self._validate_quality_scores(record[3]) equal_lengths = self._validate_bases_length_equals_qc_length(record[1], record[3]) return valid_identifier and valid_bases and valid_plus and valid_quality_scores \ and equal_lengths def _validate_identifier_line(self, line): # is the first char @ ? has_at_char = line[0] == Validator.AT_CHAR # all ascii chars? all_ascii = Validator._all_ascii(line) return has_at_char and all_ascii #TODO implement case insensitive check def _validate_bases(self, line): valid = False has_n_char = False has_period = False for symbol in line: valid = symbol in self.sequence_symbols if valid: if symbol == ord("N"): has_n_char = True if symbol == ord("."): has_period = True return valid and not has_n_char or not has_period def _validate_plus(self, line): # is the first char a plus sign? has_plus_char = line[0] == Validator.PLUS_CHAR return has_plus_char def _validate_quality_scores(self, line): for symbol in line: if symbol not in self.quality_score_symbols: return False; return True def _validate_bases_length_equals_qc_length(self, base_line, qc_line): base_length = len(base_line) quality_length = len(qc_line) return base_length == quality_length @staticmethod def _all_ascii(line): for char in line: if char > 128: return False return True
#work in prgress - This creates a skelatal mods file for the givne set of files templateFile = "C:\\python-scripts\\xml-file-output\\aids_skeletalmods.xml" def createXmlFiles(idList): print("create xml file list") for id in idList: #print("processing id " + id ) tree = ElementTree() tree.parse(templateFile) root = tree.getroot() nameElement = tree.find('titleInfo/title') nameElement.text = id apElement = tree.find('identifier') apElement.text = id root.attrib = {"xmlns:xlink":"http://www.w3.org/1999/xlink", "xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance", "xmlns":"http://www.loc.gov/mods/v3", "version":"3.5", "xsi:schemaLocation":"http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd"} #print("writing file " + xmlOutputDir + id + ".xml") tree.write(xmlOutputDir + id + ".xml") def createXmlFiles(idList): print("create xml file list") for id in idList: #print("processing id " + id ) tree = ElementTree() tree.parse(templateFile) root = tree.getroot() nameElement = tree.find('titleInfo/title') nameElement.text = id apElement = tree.find('identifier') apElement.text = id root.attrib = {"xmlns:xlink":"http://www.w3.org/1999/xlink", "xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance", "xmlns":"http://www.loc.gov/mods/v3", "version":"3.5", "xsi:schemaLocation":"http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd"} #print("writing file " + xmlOutputDir + id + ".xml") tree.write(xmlOutputDir + id + ".xml") def processSets(offset, maxFilesToProcess): fileIdList = getFileList(itemDirectory, "tif") setSize = len(fileIdList) if(not maxFilesToProcess): maxFilesToProcess = setSize + 1 if(not offset): offset = 0 offset = int(offset) maxFilesToProcess = int(maxFilesToProcess) setSize = int(setSize) print ("Max files to process = " + str(maxFilesToProcess)) print ("Offset = " + str(offset)) counter = 1 totalBytes = 0 fileSet = [] startCount = 1 for fileName, fileSize in fileIdList.items(): if( (counter >= offset) and (counter <= maxFilesToProcess) ) : print("counter = " + str(counter) + " processing file " + fileName + " with size " + str(fileSize)) nextFile = fileName fileSet.append(fileName) counter = counter + 1 if(len(fileSet) > 0): createXmlFiles(fileSet) # maxFilesPerZip = input("Please enter maximum number of files per zip file: ") maxFilesToProcess = input("Please enter maximum number of files to process enter to process all: ") offset = input("Please enter the offset position (inclusive) press enter to start from the beginning: ") processSets(offset, maxFilesToProcess)
j,i=65,-2 for I in range (1,14): J= j-5 I=i+3 print('I=%d J=%d' %(I,J)) j=J i=I
enums = { 'AmpPath': { 'values': [ { 'documentation': { 'description': ' Sets the amplification path to use the high power path. \n' }, 'name': 'HIGH_POWER', 'value': 16000 }, { 'documentation': { 'description': ' Sets the amplification path to use the low harmonic path. \n' }, 'name': 'LOW_HARMONIC', 'value': 16001 } ] }, 'AnalogModulationFMBand': { 'values': [ { 'documentation': { 'description': ' Specifies narrowband frequency modulation.\n' }, 'name': 'NARROWBAND', 'value': 17000 }, { 'documentation': { 'description': ' Specifies wideband frequency modulation.\n' }, 'name': 'WIDEBAND', 'value': 17001 } ] }, 'AnalogModulationFMNarrowbandIntegrator': { 'values': [ { 'documentation': { 'description': ' Specifies a range from 100 Hz to 1 kHz.\n' }, 'name': '100_HZ_TO_1_KHZ', 'value': 18000 }, { 'documentation': { 'description': ' Specifies a range from 1 kHz to 10 kHz.\n' }, 'name': '1_KHZ_TO_10_KHZ', 'value': 18001 }, { 'documentation': { 'description': ' Specifies a range from 10 kHz to 100 kHz.\n' }, 'name': '10_KHZ_TO_100_KHZ', 'value': 18002 } ] }, 'AnalogModulationPMMode': { 'values': [ { 'documentation': { 'description': ' Specifies high deviation. High deviation comes at the expense of a higher phase noise.\n' }, 'name': 'HIGH_DEVIATION', 'value': 19000 }, { 'documentation': { 'description': ' Specifies low phase noise. Low phase noise comes at the expense of a lower maximum deviation.\n' }, 'name': 'LOW_PHASE_NOISE', 'value': 19001 } ] }, 'AnalogModulationType': { 'values': [ { 'documentation': { 'description': ' Disables analog modulation.\n' }, 'name': 'NONE', 'value': 0 }, { 'documentation': { 'description': ' Specifies that the analog modulation type is FM.\n' }, 'name': 'FM', 'value': 2000 }, { 'documentation': { 'description': ' Specifies that the analog modulation type is PM.\n' }, 'name': 'PM', 'value': 2001 }, { 'documentation': { 'description': ' Specifies that the analog modulation type is AM.\n' }, 'name': 'AM', 'value': 2002 } ] }, 'AnalogModulationWaveformType': { 'values': [ { 'documentation': { 'description': ' Specifies that the analog modulation waveform type is sine.\n' }, 'name': 'SINE', 'value': 3000 }, { 'documentation': { 'description': ' Specifies that the analog modulation waveform type is square.\n' }, 'name': 'SQUARE', 'value': 3001 }, { 'documentation': { 'description': ' Specifies that the analog modulation waveform type is triangle.\n' }, 'name': 'TRIANGLE', 'value': 3002 } ] }, 'AnySignalOutputTerm': { 'generate-mappings': True, 'values': [ { 'documentation': { 'description': ' The signal is not exported.\n' }, 'name': 'DO_NOT_EXPORT', 'value': '' }, { 'documentation': { 'description': ' PFI 0 on the front panel SMB connector. For the PXIe-5841 with PXIe-5655, the signal is exported to the PXIe-5841 PFI 0.\n' }, 'name': 'PFI0', 'value': 'PFI0' }, { 'documentation': { 'description': ' PFI 1 on the front panel SMB connector.\n' }, 'name': 'PFI1', 'value': 'PFI1' }, { 'documentation': { 'description': ' PFI 4 on the front panel DDC connector.\n' }, 'name': 'PFI4', 'value': 'PFI4' }, { 'documentation': { 'description': ' PFI 5 on the front panel DDC connector.\n' }, 'name': 'PFI5', 'value': 'PFI5' }, { 'documentation': { 'description': ' PXI trigger line 0.\n' }, 'name': 'PXI_TRIG0', 'value': 'PXI_Trig0' }, { 'documentation': { 'description': ' PXI trigger line 1.\n' }, 'name': 'PXI_TRIG1', 'value': 'PXI_Trig1' }, { 'documentation': { 'description': ' PXI trigger line 2.\n' }, 'name': 'PXI_TRIG2', 'value': 'PXI_Trig2' }, { 'documentation': { 'description': ' PXI trigger line 3.\n' }, 'name': 'PXI_TRIG3', 'value': 'PXI_Trig3' }, { 'documentation': { 'description': ' PXI trigger line 4.\n' }, 'name': 'PXI_TRIG4', 'value': 'PXI_Trig4' }, { 'documentation': { 'description': ' PXI trigger line 5.\n' }, 'name': 'PXI_TRIG5', 'value': 'PXI_Trig5' }, { 'documentation': { 'description': ' PXI trigger line 6.\n' }, 'name': 'PXI_TRIG6', 'value': 'PXI_Trig6' }, { 'documentation': { 'description': ' PXIe DStar C trigger line. This value is valid on only the PXIe-5820/5830/5831/5840/5841.\n' }, 'name': 'PXIE_DSTARC', 'value': 'PXIe_DStarC' }, { 'documentation': { 'description': ' TRIG IN/OUT terminal.\n' }, 'name': 'TRIG_OUT', 'value': 'TrigOut' } ] }, 'ArbFilterType': { 'values': [ { 'documentation': { 'description': ' None' }, 'name': 'NONE', 'value': 10000 }, { 'documentation': { 'description': ' Applies a root-raised cosine filter to the data with the alpha value specified with the NIRFSG_ATTR_ARB_FILTER_ROOT_RAISED_COSINE_ALPHA attribute. ' }, 'name': 'ROOT_RAISED_COSINE', 'value': 10001 }, { 'documentation': { 'description': ' Applies a raised cosine filter to the data with the alpha value specified with the NIRFSG_ATTR_ARB_FILTER_RAISED_COSINE_ALPHA attribute. ' }, 'name': 'RAISED_COSINE', 'value': 10002 } ] }, 'ArbOnboardSampleClockMode': { 'values': [ { 'documentation': { 'description': ' Specifies that the clock mode is high resoultion. High resolution sampling is when a sample rate is generated by a high resolution clock source.\n' }, 'name': 'HIGH_RESOLUTION', 'value': 6000 }, { 'documentation': { 'description': ' Specifies that the clock mode is divide down. Divide down sampling is when sample rates are generated by dividing the source frequency.\n' }, 'name': 'DIVIDE_DOWN', 'value': 6001 } ] }, 'ArbSampleClockSource': { 'generate-mappings': True, 'values': [ { 'documentation': { 'description': ' Use the AWG module onboard clock as the clock source.\n' }, 'name': 'ONBOARD_CLOCK', 'value': 'OnboardClock' }, { 'documentation': { 'description': ' Use the external clock as the clock source.\n' }, 'name': 'CLK_IN', 'value': 'ClkIn' } ] }, 'ConfigListTrigOutputTerm': { 'generate-mappings': True, 'values': [ { 'documentation': { 'description': ' The signal is not exported.\n' }, 'name': 'DO_NOT_EXPORT', 'value': '' }, { 'documentation': { 'description': ' PFI 0 on the front panel SMB connector. For the PXIe-5841 with PXIe-5655, the signal is exported to the PXIe-5841 PFI 0.\n' }, 'name': 'PFI0', 'value': 'PFI0' }, { 'documentation': { 'description': ' PFI 1 on the front panel SMB connector.\n' }, 'name': 'PFI1', 'value': 'PFI1' }, { 'documentation': { 'description': ' PXI trigger line 0.\n' }, 'name': 'PXI_TRIG0', 'value': 'PXI_Trig0' }, { 'documentation': { 'description': ' PXI trigger line 1.\n' }, 'name': 'PXI_TRIG1', 'value': 'PXI_Trig1' }, { 'documentation': { 'description': ' PXI trigger line 2.\n' }, 'name': 'PXI_TRIG2', 'value': 'PXI_Trig2' }, { 'documentation': { 'description': ' PXI trigger line 3.\n' }, 'name': 'PXI_TRIG3', 'value': 'PXI_Trig3' }, { 'documentation': { 'description': ' PXI trigger line 4.\n' }, 'name': 'PXI_TRIG4', 'value': 'PXI_Trig4' }, { 'documentation': { 'description': ' PXI trigger line 5.\n' }, 'name': 'PXI_TRIG5', 'value': 'PXI_Trig5' }, { 'documentation': { 'description': ' PXI trigger line 6.\n' }, 'name': 'PXI_TRIG6', 'value': 'PXI_Trig6' }, { 'documentation': { 'description': ' PXIe DStar C trigger line. This value is valid on only the PXIe-5820/5830/5831/5840/5841.\n' }, 'name': 'PXIE_DSTARC', 'value': 'PXIe_DStarC' }, { 'documentation': { 'description': ' TRIG IN/OUT terminal.\n' }, 'name': 'TRIG_OUT', 'value': 'TrigOut' } ] }, 'ConfigListTrigSource': { 'generate-mappings': True, 'values': [ { 'documentation': { 'description': ' PFI 0 on the front panel SMB connector.\n' }, 'name': 'PFI0', 'value': 'PFI0' }, { 'documentation': { 'description': ' PFI 1 on the front panel SMB connector.\n' }, 'name': 'PFI1', 'value': 'PFI1' }, { 'documentation': { 'description': ' PXI trigger line 0.\n' }, 'name': 'PXI_TRIG0', 'value': 'PXI_Trig0' }, { 'documentation': { 'description': ' PXI trigger line 1.\n' }, 'name': 'PXI_TRIG1', 'value': 'PXI_Trig1' }, { 'documentation': { 'description': ' PXI trigger line 2.\n' }, 'name': 'PXI_TRIG2', 'value': 'PXI_Trig2' }, { 'documentation': { 'description': ' PXI trigger line 3.\n' }, 'name': 'PXI_TRIG3', 'value': 'PXI_Trig3' }, { 'documentation': { 'description': ' PXI trigger line 4.\n' }, 'name': 'PXI_TRIG4', 'value': 'PXI_Trig4' }, { 'documentation': { 'description': ' PXI trigger line 5.\n' }, 'name': 'PXI_TRIG5', 'value': 'PXI_Trig5' }, { 'documentation': { 'description': ' PXI trigger line 6.\n' }, 'name': 'PXI_TRIG6', 'value': 'PXI_Trig6' }, { 'documentation': { 'description': ' PXI trigger line 7.\n' }, 'name': 'PXI_TRIG7', 'value': 'PXI_Trig7' }, { 'documentation': { 'description': ' PXI Star trigger line. This value is valid on only the PXIe-5820/5830/5831/5840/5841.\n' }, 'name': 'PXIE_DSTARB', 'value': 'PXIe_DStarB' }, { 'documentation': { 'description': ' Marker Event 0.\n' }, 'name': 'MARKER0_EVENT', 'value': 'Marker0Event' }, { 'documentation': { 'description': ' Marker Event 1.\n' }, 'name': 'MARKER1_EVENT', 'value': 'Marker1Event' }, { 'documentation': { 'description': ' Marker Event 2.\n' }, 'name': 'MARKER2_EVENT', 'value': 'Marker2Event' }, { 'documentation': { 'description': ' Marker Event 3.\n' }, 'name': 'MARKER3_EVENT', 'value': 'Marker3Event' }, { 'documentation': { 'description': ' Timer Event.\n' }, 'name': 'TIMER_EVENT', 'value': 'TimerEvent' }, { 'documentation': { 'description': ' TRIG IN/OUT terminal.\n' }, 'name': 'TRIG_IN', 'value': 'TrigIn' } ] }, 'ConfigListTriggerDigEdgeEdge': { 'values': [ { 'documentation': { 'description': ' Specifies the rising edge as the active edge. The rising edge occurs when the signal transitions from low level to high level.\n' }, 'name': 'RISING_EDGE', 'value': 0 } ] }, 'ConfigSettledEventOutputTerm': { 'generate-mappings': True, 'values': [ { 'documentation': { 'description': ' The signal is not exported.\n' }, 'name': 'DO_NOT_EXPORT', 'value': '' }, { 'documentation': { 'description': ' PXI trigger line 0.\n' }, 'name': 'PXI_TRIG0', 'value': 'PXI_Trig0' }, { 'documentation': { 'description': ' PXI trigger line 1.\n' }, 'name': 'PXI_TRIG1', 'value': 'PXI_Trig1' }, { 'documentation': { 'description': ' PXI trigger line 2.\n' }, 'name': 'PXI_TRIG2', 'value': 'PXI_Trig2' }, { 'documentation': { 'description': ' PXI trigger line 3.\n' }, 'name': 'PXI_TRIG3', 'value': 'PXI_Trig3' }, { 'documentation': { 'description': ' PXI trigger line 4.\n' }, 'name': 'PXI_TRIG4', 'value': 'PXI_Trig4' }, { 'documentation': { 'description': ' PXI trigger line 5.\n' }, 'name': 'PXI_TRIG5', 'value': 'PXI_Trig5' }, { 'documentation': { 'description': ' PXI trigger line 6.\n' }, 'name': 'PXI_TRIG6', 'value': 'PXI_Trig6' }, { 'documentation': { 'description': ' PXIe DStar C trigger line. This value is valid on only the PXIe-5820/5830/5831/5840/5841.\n' }, 'name': 'PXIE_DSTARC', 'value': 'PXIe_DStarC' }, { 'documentation': { 'description': ' TRIG IN/OUT terminal.\n' }, 'name': 'TRIG_OUT', 'value': 'TrigOut' } ] }, 'ConfigurationListRepeat': { 'values': [ { 'documentation': { 'description': ' NI-RFSG runs the configuration list continuously.\n' }, 'name': 'CONFIGURATION_LIST_REPEAT_CONTINUOUS', 'value': 0 }, { 'documentation': { 'description': ' NI-RFSG runs the configuration list only once.' }, 'name': 'CONFIGURATION_LIST_REPEAT_SINGLE', 'value': 1 } ] }, 'DeembeddingType': { 'values': [ { 'documentation': { 'description': ' De-embedding is not applied to the measurement. ' }, 'name': 'NONE', 'value': 25000 }, { 'documentation': { 'description': ' De-embeds the measurement using only the gain term.' }, 'name': 'SCALAR', 'value': 25001 }, { 'documentation': { 'description': ' De-embeds the measurement using the gain term and the reflection term.' }, 'name': 'VECTOR', 'value': 25002 } ] }, 'DigitalEdgeConfigurationListStepTriggerSource': { 'generate-mappings': True, 'values': [ { 'name': 'PFI0', 'value': 'PFI0' }, { 'name': 'PFI1', 'value': 'PFI1' }, { 'name': 'PFI2', 'value': 'PFI2' }, { 'name': 'PFI3', 'value': 'PFI3' }, { 'name': 'PXI_TRIG0', 'value': 'PXI_Trig0' }, { 'name': 'PXI_TRIG1', 'value': 'PXI_Trig1' }, { 'name': 'PXI_TRIG2', 'value': 'PXI_Trig2' }, { 'name': 'PXI_TRIG3', 'value': 'PXI_Trig3' }, { 'name': 'PXI_TRIG4', 'value': 'PXI_Trig4' }, { 'name': 'PXI_TRIG5', 'value': 'PXI_Trig5' }, { 'name': 'PXI_TRIG6', 'value': 'PXI_Trig6' }, { 'name': 'PXI_TRIG7', 'value': 'PXI_Trig7' }, { 'name': 'PXI_STAR', 'value': 'PXI_STAR' }, { 'name': 'MARKER0_EVENT', 'value': 'Marker0Event' }, { 'name': 'MARKER1_EVENT', 'value': 'Marker1Event' }, { 'name': 'MARKER2_EVENT', 'value': 'Marker2Event' }, { 'name': 'MARKER3_EVENT', 'value': 'Marker3Event' }, { 'name': 'TIMER_EVENT', 'value': 'TimerEvent' }, { 'name': 'TRIG_IN', 'value': 'TrigIn' } ] }, 'DigitalEdgeEdge': { 'values': [ { 'documentation': { 'description': ' Occurs when the signal transitions from low level to high level. \n' }, 'name': 'RISING_EDGE', 'value': 0 }, { 'documentation': { 'description': ' Occurs when the signal transitions from high level to low level. \n' }, 'name': 'FALLING_EDGE', 'value': 1 } ] }, 'DigitalEdgeScriptTriggerIdentifier': { 'generate-mappings': True, 'values': [ { 'name': 'SCRIPT_TRIGGER0', 'value': 'scriptTrigger0' }, { 'name': 'SCRIPT_TRIGGER1', 'value': 'scriptTrigger1' }, { 'name': 'SCRIPT_TRIGGER2', 'value': 'scriptTrigger2' }, { 'name': 'SCRIPT_TRIGGER3', 'value': 'scriptTrigger3' } ] }, 'DigitalLevelActiveLevel': { 'values': [ { 'documentation': { 'description': ' Trigger when the digital trigger signal is high. \n' }, 'name': 'ACTIVE_HIGH', 'value': 9000 }, { 'documentation': { 'description': ' Trigger when the digital trigger signal is low. \n' }, 'name': 'ACTIVE_LOW', 'value': 9001 } ] }, 'DigitalModulationType': { 'values': [ { 'documentation': { 'description': ' Disables digital modulation.\n' }, 'name': 'NONE', 'value': 0 }, { 'documentation': { 'description': ' Specifies that the digital modulation type is frequency-shift keying (FSK).\n' }, 'name': 'FSK', 'value': 4000 }, { 'documentation': { 'description': ' Specifies that the digital modulation type is on-off keying (OOK).\n' }, 'name': 'OOK', 'value': 4001 }, { 'documentation': { 'description': ' Specifies that the digital modulation type is PSK.\n' }, 'name': 'PSK', 'value': 4002 } ] }, 'DigitalModulationWaveformType': { 'values': [ { 'documentation': { 'description': ' Specifies that the digital modulation waveform type is pseudorandom bit sequence (PRBS).\n' }, 'name': 'PRBS', 'value': 5000 }, { 'documentation': { 'description': ' Specifies that the digital modulation waveform type is user defined. To specify the user-defined waveform, call the niRFSG_ConfigureDigitalModulationUserDefinedWaveform function.\n' }, 'name': 'USER_DEFINED', 'value': 5001 } ] }, 'EnableValues': { 'values': [ { 'documentation': { 'description': ' Enabled' }, 'name': 'ENABLE', 'value': 1 }, { 'documentation': { 'description': ' Disabled' }, 'name': 'DISABLE', 'value': 0 } ] }, 'FrequencySettlingUnits': { 'values': [ { 'documentation': { 'description': ' Specifies the value in Frequency Settling is the time to wait after the frequency PLL locks.\n' }, 'name': 'TIME_AFTER_LOCK', 'value': 12000 }, { 'documentation': { 'description': ' Specifies the value in Frequency Settling is the time to wait after all writes to change the frequency occur.\n' }, 'name': 'TIME_AFTER_IO', 'value': 12001 }, { 'documentation': { 'description': ' Specifies the value in Frequency Settling is the minimum frequency accuracy when settling completes. Units are in parts per million (PPM or 1E-6).\n' }, 'name': 'PPM', 'value': 12002 } ] }, 'GenerationMode': { 'values': [ { 'documentation': { 'description': ' Configures the RF signal generator to generate a CW signal. \n' }, 'name': 'CW', 'value': 1000 }, { 'documentation': { 'description': ' Configures the RF signal generator to generate the arbitrary waveform specified by the NIRFSG_ATTR_ARB_SELECTED_WAVEFORM attribute. \n' }, 'name': 'ARB_WAVEFORM', 'value': 1001 }, { 'documentation': { 'description': ' Configures the RF signal generator to generate arbitrary waveforms as directed by the NIRFSG_ATTR_SELECTED_SCRIPT attribute. \n' }, 'name': 'SCRIPT', 'value': 1002 } ] }, 'IqOffsetUnits': { 'values': [ { 'name': 'PERCENT', 'value': 11000 }, { 'name': 'VOLTS', 'value': 11001 } ] }, 'IqOutPortTermConfig': { 'values': [ { 'documentation': { 'description': ' Sets the terminal configuration to differential. \n' }, 'name': 'DIFFERENTIAL', 'value': 15000 }, { 'documentation': { 'description': ' Sets the terminal configuration to single-ended. \n' }, 'name': 'SINGLE_ENDED', 'value': 15001 } ] }, 'LinearInterpolationFormat': { 'values': [ { 'name': 'REAL_AND_IMAGINARY', 'value': 26000 }, { 'name': 'MAGNITUDE_AND_PHASE', 'value': 26001 }, { 'name': 'MAGNITUDE_DB_AND_PHASE', 'value': 26002 } ] }, 'ListStepTriggerType': { 'values': [ { 'documentation': { 'description': ' Generation starts immediately. No trigger is configured. \n' }, 'name': 'NONE', 'value': 0 }, { 'documentation': { 'description': ' The data operation does not start until a digital edge is detected. The source of the digital edge is specified in the NIRFSG_ATTR_DIGITAL_EDGE_START_TRIGGER_SOURCE attribute, and the active edge is specified in the NIRFSG_ATTR_DIGITAL_EDGE_START_TRIGGER_EDGE attribute. \n' }, 'name': 'DIGITAL_EDGE', 'value': 1 } ] }, 'LoSource': { 'generate-mappings': True, 'values': [ { 'documentation': { 'description': ' Uses an internal LO as the LO source. If you specify an internal LO source, the LO is generated within the device itself. \n\n PXIe-5840 with PXIe-5653: If the center frequency is greater than or equal to 3.2 GHz, this configuration uses the PXIe-5653 LO source. For frequencies less than 3.2 GHz, this configuration uses the PXIe-5840 internal LO. \n PXIe-5841 with PXIe-5655: This configuration uses the onboard LO of the PXIe-5655. \n' }, 'name': 'ONBOARD', 'value': 'Onboard' }, { 'documentation': { 'description': ' Uses an external LO as the LO source. Connect a signal to the LO IN connector on the device and use the NIRFSG_ATTR_UPCONVERTER_CENTER_FREQUENCY attribute to specify the LO frequency. \n' }, 'name': 'LO_IN', 'value': 'LO_In' }, { 'documentation': { 'description': ' Uses the PXIe-5840 internal LO as the LO source. This value is valid on only the PXIe-5840 with PXIe-5653.' }, 'name': 'SECONDARY', 'value': 'Secondary' }, { 'documentation': { 'description': ' Uses the same internal LO during some RX and TX operations. In this mode, an internal synthesizer is chosen by the driver and the synthesizer signal is switched to both the RF In and RF Out mixers. This value is valid on only the PXIe-5830/5831/5841 with PXIe-5655. \n' }, 'name': 'SG_SA_SHARED', 'value': 'SG_SA_Shared' }, { 'documentation': { 'description': ' NI-RFSG internally makes the configuration to share the LO between NI-RFSA and NI-RFSG. This value is valid only on the PXIe-5820/5830/5831/5832/5840/5841. \n' }, 'name': 'AUTOMATIC_SG_SA_SHARED', 'value': 'Automatic_SG_SA_Shared' } ] }, 'LoadOptions': { 'values': [ { 'documentation': { 'description': ' NI-RFSG loads all the configurations to the session.' }, 'name': 'SKIP_NONE', 'value': 0 }, { 'documentation': { 'description': ' NI-RFSG skips loading the waveform configurations to the session.' }, 'name': 'SKIP_WAVEFORMS', 'value': 1 } ] }, 'LoopBandwidth': { 'values': [ { 'documentation': { 'description': ' Specifies that the device uses a narrow loop bandwidth.\n' }, 'name': 'NARROW', 'value': 0 }, { 'documentation': { 'description': ' Specifies that the device uses a medium loop bandwidth.\n' }, 'name': 'MEDIUM', 'value': 1 }, { 'documentation': { 'description': ' Specifies that the device uses a wide loop bandwidth.\n' }, 'name': 'WIDE', 'value': 2 } ] }, 'MarkerEventOutputBehavior': { 'values': [ { 'documentation': { 'description': ' Specifies the Marker Event output behavior as pulse. \n' }, 'name': 'PULSE', 'value': 23000 }, { 'documentation': { 'description': ' Specifies the Marker Event output behavior as toggle. \n' }, 'name': 'TOGGLE', 'value': 23001 } ] }, 'MarkerEventPulseWidthUnits': { 'values': [ { 'documentation': { 'description': ' Specifies the Marker Event pulse width units as seconds. \n' }, 'name': 'SECONDS', 'value': 22000 }, { 'documentation': { 'description': ' Specifies the Marker Event pulse width units as Sample Clock periods. \n' }, 'name': 'SAMPLE_CLOCK_PERIODS', 'value': 22001 } ] }, 'MarkerEventToggleInitialState': { 'values': [ { 'documentation': { 'description': ' Specifies the initial state of the Marker Event toggle behavior as digital low. \n' }, 'name': 'DIGITAL_LOW', 'value': 21000 }, { 'documentation': { 'description': ' Specifies the initial state of the Marker Event toggle behavior as digital high. \n' }, 'name': 'DIGITAL_HIGH', 'value': 21001 } ] }, 'Module': { 'values': [ { 'name': 'PRIMARY_MODULE', 'value': 13000 }, { 'name': 'AWG', 'value': 13001 }, { 'name': 'LO', 'value': 13002 } ] }, 'OutputPort': { 'values': [ { 'documentation': { 'description': ' Enables the RF OUT port. \n' }, 'name': 'RF_OUT', 'value': 14000 }, { 'documentation': { 'description': ' Enables the I/Q OUT port. \n' }, 'name': 'IQ_OUT', 'value': 14001 }, { 'documentation': { 'description': ' Enables the CAL OUT port. \n' }, 'name': 'CAL_OUT', 'value': 14002 }, { 'documentation': { 'description': ' Enables the I connectors of the I/Q OUT port. \n' }, 'name': 'I_ONLY', 'value': 14003 } ] }, 'OutputSignal': { 'generate-mappings': True, 'values': [ { 'name': 'DO_NOT_EXPORT', 'value': '' }, { 'name': 'PFI0', 'value': 'PFI0' }, { 'name': 'PFI1', 'value': 'PFI1' }, { 'name': 'PFI4', 'value': 'PFI4' }, { 'name': 'PFI5', 'value': 'PFI5' }, { 'name': 'PXI_STAR', 'value': 'PXI_STAR' }, { 'name': 'PXI_TRIG0', 'value': 'PXI_Trig0' }, { 'name': 'PXI_TRIG1', 'value': 'PXI_Trig1' }, { 'name': 'PXI_TRIG2', 'value': 'PXI_Trig2' }, { 'name': 'PXI_TRIG3', 'value': 'PXI_Trig3' }, { 'name': 'PXI_TRIG4', 'value': 'PXI_Trig4' }, { 'name': 'PXI_TRIG5', 'value': 'PXI_Trig5' }, { 'name': 'PXI_TRIG6', 'value': 'PXI_Trig6' }, { 'name': 'REF_OUT2', 'value': 'RefOut2' }, { 'name': 'REF_OUT', 'value': 'RefOut' }, { 'name': 'TRIG_OUT', 'value': 'TrigOut' } ] }, 'OverflowErrorReporting': { 'values': [ { 'documentation': { 'description': ' Configures NI-RFSG to return a warning when an OSP overflow occurs.' }, 'name': 'WARNING', 'value': 1301 }, { 'documentation': { 'description': ' Configures NI-RFSG to not return an error or a warning when an OSP overflow occurs.' }, 'name': 'DISABLED', 'value': 1302 } ] }, 'PPAScriptInheritance': { 'values': [ { 'documentation': { 'description': ' Errors out if different values are detected in the script.\n' }, 'name': 'EXACT_MATCH', 'value': 0 }, { 'documentation': { 'description': ' Uses the minimum value found in the script.\n' }, 'name': 'MINIMUM', 'value': 1 }, { 'documentation': { 'description': ' Uses the maximum value found in the script.\n' }, 'name': 'MAXIMUM', 'value': 2 } ] }, 'PXIChassisClk10': { 'generate-mappings': True, 'values': [ { 'documentation': { 'description': ' Do not drive the PXI_CLK10 signal.\n' }, 'name': 'NONE', 'value': 'None' }, { 'documentation': { 'description': ' Use the highly stable oven-controlled onboard Reference Clock to drive the PXI_CLK10 signal. This value is not valid on the PXIe-5672.\n' }, 'name': 'ONBOARD_CLOCK', 'value': 'OnboardClock' }, { 'documentation': { 'description': ' Use the clock present at the front panel REF IN connector to drive the PXI_CLK10 signal.\n' }, 'name': 'REF_IN', 'value': 'RefIn' } ] }, 'PhaseContinuity': { 'values': [ { 'documentation': { 'description': ' Auto' }, 'name': 'AUTO', 'value': -1 }, { 'documentation': { 'description': ' Enabled' }, 'name': 'ENABLE', 'value': 1 }, { 'documentation': { 'description': ' Disabled' }, 'name': 'DISABLE', 'value': 0 } ] }, 'PowerLevelType': { 'values': [ { 'documentation': { 'description': ' Specifies that the power level type is average power. Average power indicates the desired power averaged in time. The driver maximizes the dynamic range by scaling the IQ waveform. If you write more than one waveform, NI-RFSG scales each waveform without preserving the power level ratio between the waveforms. This value is not valid for the PXIe-5820. \n' }, 'name': 'AVERAGE_POWER', 'value': 7000 }, { 'documentation': { 'description': ' Specifies that the power level type is peak power. Peak power indicates the maximum power level of the RF signal averaged over one period of the RF carrier signal frequency (the peak envelope power). This setting requires that the magnitude of the IQ waveform must always be less than or equal to one. When using the peak power level type, the power level of the RF signal matches the specified power level at moments when the magnitude of the IQ waveform equals one. If you write more than one waveform, the relative scaling between waveforms is preserved.\n' }, 'name': 'PEAK_POWER', 'value': 7001 } ] }, 'PulseModulationMode': { 'values': [ { 'documentation': { 'description': ' Provides for a more optimal power output match for the device during the off cycle of the pulse mode operation. \n' }, 'name': 'OPTIMAL_MATCH', 'value': 20000 }, { 'documentation': { 'description': ' Allows for the best on/off power ratio of the pulsed signal. \n' }, 'name': 'HIGH_ISOLATION', 'value': 20001 } ] }, 'RefClockOutputTerm': { 'generate-mappings': True, 'values': [ { 'documentation': { 'description': ' Do not export the Reference Clock.\n' }, 'name': 'DO_NOT_EXPORT', 'value': '' }, { 'documentation': { 'description': ' Export the Reference Clock signal to the REF OUT connector of the device.\n' }, 'name': 'REF_OUT', 'value': 'RefOut' }, { 'documentation': { 'description': ' Export the Reference Clock signal to the REF OUT2 connector of the device, if applicable.\n' }, 'name': 'REF_OUT2', 'value': 'RefOut2' }, { 'documentation': { 'description': ' Export the Reference Clock signal to the CLK OUT connector of the device.\n' }, 'name': 'CLK_OUT', 'value': 'ClkOut' } ] }, 'RefClockRate': { 'values': [ { 'name': '10_MHZ', 'value': 10000000 }, { 'name': 'AUTO', 'value': -1 } ] }, 'RefClockSource': { 'generate-mappings': True, 'values': [ { 'documentation': { 'description': ' Uses the onboard Reference Clock as the clock source.\n PXIe-5830/5831—For the PXIe-5830, connect the PXIe-5820 REF IN connector to the PXIe-3621 REF OUT connector. For the PXIe-5831, connect the PXIe-5820 REF IN connector to the PXIe-3622 REF OUT connector. \n PXIe-5831 with PXIe-5653—Connect the PXIe-5820 REF IN connector to the PXIe-3622 REF OUT connector. Connect the PXIe-5653 REF OUT (10 MHz) connector to the PXIe-3622 REF IN connector. \n PXIe-5840 with PXIe-5653—Lock to the PXIe-5653 onboard clock. Connect the REF OUT (10 MHz) connector on the PXIe-5653 to the PXIe-5840 REF IN connector. Configure open NI-RFSA sessions to the device to use NIRFSA_VAL_REF_IN_STR for the PXIe-5840 or NIRFSA_VAL_REF_IN_2_STR for the PXIe-5840 with PXIe-5653. \n PXIe-5841 with PXIe-5655—Lock to the PXIe-5655 onboard clock. Connect the REF OUT connector on the PXIe-5655 to the PXIe-5841 REF IN connector. \n' }, 'name': 'ONBOARD_CLOCK', 'value': 'OnboardClock' }, { 'documentation': { 'description': ' Use the clock signal present at the front panel RefIn connector as the clock source.\n PXIe-5830/5831—For the PXIe-5830, connect the PXIe-5820 REF IN connector to the PXIe-3621 REF OUT connector. For the PXIe-5831, connect the PXIe-5820 REF IN connector to the PXIe-3622 REF OUT connector. For the PXIe-5830, lock the external signal to the PXIe-3621 REF IN connector. For the PXIe-5831, lock the external signal to the PXIe-3622 REF IN connector. \n PXIe-5831 with PXIe-5653—Connect the PXIe-5820 REF IN connector to the PXIe-3622 REF OUT connector. Connect the PXIe-5653 REF OUT (10 MHz) connector to the PXIe-3622 REF IN connector. Lock the external signal to the PXIe-5653 REF IN connector. PXIe-5840 with PXIe-5653—Lock to the PXIe-5653 onboard clock. Connect the REF OUT (10 MHz) connector on the PXIe-5653 to the PXIe-5840 REF IN connector. \n PXIe-5841 with PXIe-5655—Lock to the signal at the REF IN connector on the associated PXIe-5655. Connect the PXIe-5655 REF OUT connector to the PXIe-5841 REF IN connector. \n' }, 'name': 'REF_IN', 'value': 'RefIn' }, { 'documentation': { 'description': ' Use the PXI_CLK signal, which is present on the PXI backplane, as the clock source.\n' }, 'name': 'PXI_CLK', 'value': 'PXI_CLK' }, { 'documentation': { 'description': ' Use the clock signal present at the front panel ClkIn connector as the clock source. This value is not valid for the PXIe-5644/5645/5646 or PXIe-5820/5830/5831/5831 with PXIe-5653/5840/5840 with PXIe-5653/5841/5841 with PXIe-5655. \n' }, 'name': 'CLK_IN', 'value': 'ClkIn' }, { 'documentation': { 'description': ' This value is valid on only the PXIe-5840 with PXIe-5653. NI-RFSG locks the Reference Clock to the clock sourced at the PXIe-5840 REF IN terminal that is already configured by an NI-RFSA session. Connect the PXIe-5840 REF OUT connector to the PXIe-5653 REF IN connector. Configure open NI-RFSA sessions to the device to use NIRFSA_VAL_REF_IN_STR for the PXIe-5840 or NIRFSA_VAL_ONBOARD_CLOCK_STR for the PXIe-5840 with PXIe-5653. \n' }, 'name': 'REF_IN_2', 'value': 'RefIn2' }, { 'documentation': { 'description': ' This value is valid on only the PXIe-5831 with PXIe-5653 and the PXIe-5840 with PXIe-5653. PXIe-5831 with PXIe-5653—NI-RFSG configures the PXIe-5653 to export the Reference clock and configures the PXIe-5820 and PXIe-3622 to use NIRFSG_VAL_PXI_CLK_STR as the Reference Clock source. Connect the PXIe-5653 REF OUT (10 MHz) connector to the PXI chassis REF IN connector. \n PXIe-5840 with PXIe-5653—NI-RFSG configures the PXIe-5653 to export the Reference Clock, and configures the PXIe-5840 to use NIRFSG_VAL_PXI_CLK_STR. Connect the PXIe-5653 REF OUT (10 MHz) connector to the PXI chassis REF IN connector. For best performance, configure all other devices in the system to use NIRFSG_VAL_PXI_CLK_STR as the Reference Clock source. \n' }, 'name': 'PXI_CLK_MASTER', 'value': 'PXI_ClkMaster' } ] }, 'RelativeTo': { 'values': [ { 'name': 'START_OF_WAVEFORM', 'value': 8000 }, { 'name': 'CURRENT_POSITION', 'value': 8001 } ] }, 'ResetOptions': { 'values': [ { 'documentation': { 'description': ' NI-RFSG resets all the configurations.' }, 'name': 'SKIP_NONE', 'value': 0 }, { 'documentation': { 'description': ' NI-RFSG skips resetting the waveform configurations.' }, 'name': 'SKIP_WAVEFORMS', 'value': 1 }, { 'documentation': { 'description': ' NI-RFSG skips resetting the scripts.' }, 'name': 'SKIP_SCRIPTS', 'value': 2 }, { 'documentation': { 'description': ' NI-RFSG skips resetting the de-embeding tables.' }, 'name': 'SKIP_DEEMBEDING_TABLES', 'value': 8 } ] }, 'ResetWithOptionsStepsToOmit': { 'values': [ { 'name': 'NONE', 'value': 0 }, { 'name': 'WAVEFORMS', 'value': 1 }, { 'name': 'SCRIPTS', 'value': 2 }, { 'name': 'ROUTES', 'value': 4 }, { 'name': 'DEEMBEDDING_TABLES', 'value': 8 } ] }, 'RfInLoExportEnabled': { 'values': [ { 'name': 'UNSPECIFIED', 'value': -2 }, { 'name': 'DISABLE', 'value': 0 }, { 'name': 'ENABLE', 'value': 1 } ] }, 'RoutedSignal': { 'values': [ { 'name': 'CONFIGURATION_LIST_STEP_TRIGGER', 'value': 6 }, { 'name': 'CONFIGURATION_SETTLED_EVENT', 'value': 7 }, { 'name': 'DONE_EVENT', 'value': 5 }, { 'name': 'MARKER_EVENT', 'value': 2 }, { 'name': 'REF_CLOCK', 'value': 3 }, { 'name': 'SCRIPT_TRIGGER', 'value': 1 }, { 'name': 'STARTED_EVENT', 'value': 4 }, { 'name': 'START_TRIGGER', 'value': 0 } ] }, 'SParameterOrientation': { 'values': [ { 'name': 'PORT1_TOWARDS_DUT', 'value': 24000 }, { 'name': 'PORT2_TOWARDS_DUT', 'value': 24001 } ] }, 'ScriptTriggerType': { 'values': [ { 'documentation': { 'description': ' Setting trigger attributes to this value specifies that no trigger is configured. Signal generation starts immediately. \n' }, 'name': 'NONE', 'value': 0 }, { 'documentation': { 'description': ' The data operation does not start until a digital edge is detected. The source of the digital edge is specified in the NIRFSG_ATTR_DIGITAL_EDGE_SCRIPT_TRIGGER_SOURCE attribute, and the active edge is specified in the NIRFSG_ATTR_DIGITAL_EDGE_SCRIPT_TRIGGER_EDGE attribute. \n' }, 'name': 'DIGITAL_EDGE', 'value': 1 }, { 'documentation': { 'description': ' The data operation does not start until a digital level is detected. The source of the digital level is specified in the NIRFSG_ATTR_DIGITAL_LEVEL_SCRIPT_TRIGGER_SOURCE attribute, and the active level is specified in the NIRFSG_ATTR_DIGITAL_LEVEL_SCRIPT_TRIGGER_ACTIVE_LEVEL attribute. \n' }, 'name': 'DIGITAL_LEVEL', 'value': 8000 }, { 'documentation': { 'description': ' The data operation does not start until a software event occurs. You may create a software event by calling the niRFSG_SendSoftwareEdgeTrigger function. \n' }, 'name': 'SOFTWARE', 'value': 2 } ] }, 'SelfCalibrateRangeStepsToOmit': { 'values': [ { 'name': 'OMIT_NONE', 'value': 0 }, { 'name': 'LO_SELF_CAL', 'value': 1 }, { 'name': 'POWER_LEVEL_ACCURACY', 'value': 2 }, { 'name': 'RESIDUAL_LO_POWER', 'value': 4 }, { 'name': 'IMAGE_SUPPRESSION', 'value': 8 }, { 'name': 'SYNTHESIZER_ALIGNMENT', 'value': 16 } ] }, 'SignalIdentifier': { 'generate-mappings': True, 'values': [ { 'name': 'NONE', 'value': '' }, { 'name': 'SCRIPT_TRIGGER0', 'value': 'scriptTrigger0' }, { 'name': 'SCRIPT_TRIGGER1', 'value': 'scriptTrigger1' }, { 'name': 'SCRIPT_TRIGGER2', 'value': 'scriptTrigger2' }, { 'name': 'SCRIPT_TRIGGER3', 'value': 'scriptTrigger3' }, { 'name': 'MARKER0', 'value': 'marker0' }, { 'name': 'MARKER1', 'value': 'marker1' }, { 'name': 'MARKER2', 'value': 'marker2' }, { 'name': 'MARKER3', 'value': 'marker3' } ] }, 'StartTriggerType': { 'values': [ { 'documentation': { 'description': ' Setting trigger attributes to this value specifies that no trigger is configured. \n' }, 'name': 'NONE', 'value': 0 }, { 'documentation': { 'description': ' The data operation does not start until a digital edge is detected. The source of the digital edge is specified in the NIRFSG_ATTR_DIGITAL_EDGE_START_TRIGGER_SOURCE attribute, and the active edge is specified in the NIRFSG_ATTR_DIGITAL_EDGE_START_TRIGGER_EDGE attribute. \n' }, 'name': 'DIGITAL_EDGE', 'value': 1 }, { 'documentation': { 'description': ' The data operation does not start until a software event occurs. You may create a software event by calling the niRFSG_SendSoftwareEdgeTrigger function. \n' }, 'name': 'SOFTWARE', 'value': 2 }, { 'documentation': { 'description': ' Data operation does not start until the endpoint reaches a threshold specified in the NIRFSG_ATTR_P2P_ENDPOINT_FULLNESS_START_TRIGGER_LEVEL attribute. \n' }, 'name': 'P2_P_ENDPOINT_FULLNESS', 'value': 3 } ] }, 'TriggerSource': { 'generate-mappings': True, 'values': [ { 'documentation': { 'description': ' PFI 0 on the front panel SMB connector.\n' }, 'name': 'PFI0', 'value': 'PFI0' }, { 'documentation': { 'description': ' PFI 1 on the front panel SMB connector.\n' }, 'name': 'PFI1', 'value': 'PFI1' }, { 'documentation': { 'description': ' PFI 2 on the front panel DDC connector.\n' }, 'name': 'PFI2', 'value': 'PFI2' }, { 'documentation': { 'description': ' PFI 3 on the front panel DDC connector.\n' }, 'name': 'PFI3', 'value': 'PFI3' }, { 'documentation': { 'description': ' PXI trigger line 0.\n' }, 'name': 'PXI_TRIG0', 'value': 'PXI_Trig0' }, { 'documentation': { 'description': ' PXI trigger line 1.\n' }, 'name': 'PXI_TRIG1', 'value': 'PXI_Trig1' }, { 'documentation': { 'description': ' PXI trigger line 2.\n' }, 'name': 'PXI_TRIG2', 'value': 'PXI_Trig2' }, { 'documentation': { 'description': ' PXI trigger line 3.\n' }, 'name': 'PXI_TRIG3', 'value': 'PXI_Trig3' }, { 'documentation': { 'description': ' PXI trigger line 4.\n' }, 'name': 'PXI_TRIG4', 'value': 'PXI_Trig4' }, { 'documentation': { 'description': ' PXI trigger line 5.\n' }, 'name': 'PXI_TRIG5', 'value': 'PXI_Trig5' }, { 'documentation': { 'description': ' PXI trigger line 6.\n' }, 'name': 'PXI_TRIG6', 'value': 'PXI_Trig6' }, { 'documentation': { 'description': ' PXI trigger line 7.\n' }, 'name': 'PXI_TRIG7', 'value': 'PXI_Trig7' }, { 'documentation': { 'description': ' PXI Star trigger line. This value is not valid on the PXIe-5644/5645/5646.\n' }, 'name': 'PXI_STAR', 'value': 'PXI_STAR' }, { 'documentation': { 'description': ' PXIe DStar B trigger line. This value is valid on only the PXIe-5820/5830/5831/5840/5841. \n' }, 'name': 'PXIE_DSTARB', 'value': 'PXIe_DStarB' }, { 'documentation': { 'description': ' Sync Start trigger line.' }, 'name': 'SYNC_START_TRIGGER', 'value': 'Sync_Start' }, { 'documentation': { 'description': ' Sync script trigger line.' }, 'name': 'SYNC_SCRIPT_TRIGGER', 'value': 'Sync_Script' }, { 'documentation': { 'description': ' TRIG IN/OUT terminal.\n' }, 'name': 'TRIG_IN', 'value': 'TrigIn' } ] }, 'UpconverterFrequencyOffsetMode': { 'values': [ { 'documentation': { 'description': ' NI-RFSG places the upconverter center frequency outside of the signal bandwidth if the NIRFSG_ATTR_SIGNAL_BANDWIDTH attribute has been set and can be avoided. ' }, 'name': 'AUTO', 'value': -1 }, { 'documentation': { 'description': ' NI-RFSG places the upconverter center frequency outside of the signal bandwidth if the NIRFSG_ATTR_SIGNAL_BANDWIDTH attribute has been set and can be avoided. NI-RFSG returns an error if unable to avoid the specified signal bandwidth, or if the NIRFSG_ATTR_SIGNAL_BANDWIDTH attribute has not been set. ' }, 'name': 'ENABLE', 'value': 1 }, { 'documentation': { 'description': ' NI-RFSG uses the offset that you specified with the NIRFSG_ATTR_UPCONVERTER_FREQUENCY_OFFSET or NIRFSG_ATTR_UPCONVERTER_CENTER_FREQUENCY attributes. ' }, 'name': 'USER_DEFINED', 'value': 5001 } ] }, 'WriteWaveformBurstDetectionMode': { 'values': [ { 'documentation': { 'description': ' NI-RFSG automatically detects the burst start and burst stop locations by analyzing the waveform.' }, 'name': 'AUTO', 'value': -1 }, { 'documentation': { 'description': ' User sets the burst detection parameters.' }, 'name': 'MANUAL', 'value': 0 } ] }, 'YigMainCoil': { 'values': [ { 'documentation': { 'description': ' Adjusts the YIG main coil for an underdampened response. \n' }, 'name': 'SLOW', 'value': 0 }, { 'documentation': { 'description': ' Adjusts the YIG main coil for an overdampened response. \n' }, 'name': 'FAST', 'value': 1 } ] } }
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Created by Ross on 19-1-18 """由于垃圾windows把我的代码无缘无故给删了,所以现在直接使用MKYAN的代码,若有侵权,请告知""" class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: # 返回合并后列表 def Merge(self, pHead1, pHead2): # write code here if not pHead1: return pHead2 elif not pHead2: return pHead1 pMergedHead = None if (pHead1.val < pHead2.val): pMergedHead = pHead1 pMergedHead.next = self.Merge(pHead1.next, pHead2) else: pMergedHead = pHead2 pMergedHead.next = self.Merge(pHead1, pHead2.next) return pMergedHead if __name__ == '__main__': pass
class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def isMirror(self, left: TreeNode, right: TreeNode) -> bool: if left is None and right is None: return True elif left is not None and right is not None: inner = self.isMirror(left.right, right.left) outer = self.isMirror(left.left, right.right) return left.val == right.val and inner and outer return False def isSymmetric(self, root: TreeNode) -> bool: return root is None or self.isMirror(root.left, root.right)
class Solution(object): def maxRotateFunction(self, A): """ :type A: List[int] :rtype: int """ totalSum = sum(A) Al = len(A) F = {0:0} for i in range(Al): F[0] += i * A[i] maxNum = F[0] for i in range(Al-1,0,-1): F[Al-i] = F[Al-i-1] + totalSum - Al * A[i] maxNum = max(maxNum,F[Al-i]) return maxNum # TLE def maxRotateFunction_TLE(self, A): """ :type A: List[int] :rtype: int """ Rsum = {} rotated = 0 max = None l = len(A) for i in range(l): mmax = None for j in range(l): if j in Rsum: Rsum[j] += i * A[rotated%l] else: Rsum[j] = i * A[rotated%l] if mmax is None or mmax < Rsum[j]: mmax = Rsum[j] rotated -= 1 max = mmax rotated += 1 return 0 if max is None else max
class Config: # image size image_min_dims = 512 image_max_dims = 512 steps_per_epoch = 50 validation_steps = 20 batch_size = 16 epochs = 10 shuffle = True num_classes = 21
'''https://leetcode.com/problems/course-schedule/ 207. Course Schedule Medium 7445 303 Add to List Share There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai. For example, the pair [0, 1], indicates that to take course 0 you have to first take course 1. Return true if you can finish all courses. Otherwise, return false. Example 1: Input: numCourses = 2, prerequisites = [[1,0]] Output: true Explanation: There are a total of 2 courses to take. To take course 1 you should have finished course 0. So it is possible. Example 2: Input: numCourses = 2, prerequisites = [[1,0],[0,1]] Output: false Explanation: There are a total of 2 courses to take. To take course 1 you should have finished course 0, and to take course 0 you should also have finished course 1. So it is impossible. Constraints: 1 <= numCourses <= 105 0 <= prerequisites.length <= 5000 prerequisites[i].length == 2 0 <= ai, bi < numCourses All the pairs prerequisites[i] are unique.''' # [207] Course Schedule # class Solution: def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool: indegree = [0 for i in range(numCourses)] connection = {i: [] for i in range(numCourses)} for link in prerequisites: connection[link[1]].append(link[0]) indegree[link[0]] += 1 zero_indegree = [] for i in range(numCourses): if indegree[i] == 0: zero_indegree.append(i) i = 0 while i < len(zero_indegree): for node in connection[zero_indegree[i]]: indegree[node] -= 1 if indegree[node] == 0: zero_indegree.append(node) i += 1 if len(zero_indegree) == numCourses: return True else: return False def DFS(self): record = [[0 for _ in range(numCourses)] for _ in range(numCourses)] visited = [False for _ in range(numCourses)] for item in prerequisites: record[item[1]][item[0]] = 1 # sort def dfs(num): for i in range(numCourses): if record[num][i] == 1: visited[num] = True if visited[i]: return False else: if not dfs(i): return False visited[num] = False return True for i in range(numCourses): if not dfs(i): return False return True
# SPDX-FileCopyrightText: Copyright (C) 2019-2021 Ryan Finnie # SPDX-License-Identifier: MIT class SMWRand: """Super Mario World random number generator Based on deconstruction by Retro Game Mechanics Explained https://www.youtube.com/watch?v=q15yNrJHOak """ # SPDX-SnippetComment: Originally from https://github.com/rfinnie/rf-pymods # SPDX-SnippetCopyrightText: Copyright (C) 2019-2021 Ryan Finnie # SPDX-LicenseInfoInSnippet: MIT seed_1 = 0 seed_2 = 0 def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): pass def _rand(self): self.seed_1 = (self.seed_1 + (self.seed_1 << 2) + 1) & 0xFF self.seed_2 = ( (self.seed_2 << 1) + int((self.seed_2 & 0x90) in (0x90, 0)) ) & 0xFF return self.seed_1 ^ self.seed_2 def rand(self): output_2 = self._rand() output_1 = self._rand() return (output_1, output_2)
#=================================================================================================================================================================================== # Author: Shlomo Stept # ccvaliditycheck.py will open up a window and determine if any credit card number; entered by the user, is valid. #=================================================================================================================================================================================== # Prompt for User to Enter A credit Card number as a long integer userInput = input("Enter Your Credit Card Number as a long integer: ") # Initilizing variables to keep track of, the Sum of every other even and odd, credit card number totalEven=0 totalOdd=0 # Variable that detemines the number of loops requred due to length of the credit card number entered numberofVariables = len(userInput) # Initalizing variables to keep track of the Loop the program is on, and this is also determine/track the List/ (array) vairable the program needs to use/pull from the userInput countEven = numberofVariables-2 countOdd = numberofVariables-1 # Test to determine of the credit card value entered is the correct length of a credit card (some new cards have 19 digits) if numberofVariables > 12 and numberofVariables < 20: # loop that runs through every ODD number moving from right to left (of the credit card) and adds them all up for loopcounter in range(numberofVariables,0,-2): oddPlacesSingle = int(userInput[countOdd]) totalOdd = totalOdd + oddPlacesSingle countOdd = countOdd - 2 # loop that runs through every EVEN number moving from right to left (of the credit card); doubles that number and then adds them all up for loopcounter in range(numberofVariables-1,0,-2): evenPlacesDouble = 2 * int(userInput[countEven]) # Evaluation, whether the doubling, results in a value more than one digit, and if it does, adds the two digits to get a single digit number if len(str(evenPlacesDouble)) > 1: evenPlacesDouble = str(evenPlacesDouble) evenPlacesDouble = int(evenPlacesDouble[0]) + int(evenPlacesDouble[1]) else: exit totalEven = totalEven + evenPlacesDouble countEven = countEven - 2 # Variable that takes the total of Even values that were doubles, and the total of all ODD values that were just summed, and adds the total odd and total even up total = totalEven + totalOdd # Test to determine if the Grand total, of odd-single and doubled-Even values is divisable by ten. The final step in determining the Validity of the Credit Card Number entered if len (str(total)) > 1: total = str( total ) if int ( total [ (len(str(total))) -1 ]) == 0: # Test to determine of the credit card number entered is associated with VISA, MASTERCARD, DISCOVER, OR AMERICAN EXPRESS. if int(userInput[0]) == 3 and int(userInput[1]) == 7 : print("\n\tYour American Express card is Valid, Congragulations!") elif int(userInput[0]) == 4: print("\n\tYour Visa card is Valid, Congragulations!") elif int(userInput[0]) == 5: print("\n\tYour Master Card card is Valid, Congragulations!") elif int(userInput[0]) == 6: print("\n\tYour Discover card is Valid, Congragulations!") else: print("\n\tYour Alternative credit card is Valid, Congragulations!") # TEST RESULTS that return an invalid, if the credit card number failed to be devided by ten or any of the other validity tests previously run. else: print("\nYour card is Invalid, Please try again.") else: print("\nYour card is Invalid, Please try again.") else: print("\nYour card is Invalid,Please try again.")
#coding=utf-8 # interval interval = 60 # 上报的 step 间隔 # vcenter host = "172.16.10.127" # vcenter 的地址 user = "administrator@vsphere.local" # vcenter 的用户名 pwd = "P@ssw0rd" # vcenter 的密码 port = 443 # vcenter 的端口
# Time complexity: O(n) # Approach: Manacher's Algorithm. Please watch this vide for explanation https://youtu.be/V-sEwsca1ak class Solution: def longestPalindrome(self, s: str) -> str: newS = "" n = 2 * len(s) + 1 ind = 0 for j in range(n): if j % 2 == 1: newS += s[ind] ind += 1 else: newS += "$" LPS = [0] * n start, end, i = 0, 0, 0 while i < n: while start > 0 and end < n-1 and newS[start-1] == newS[end+1]: start -= 1 end += 1 LPS[i] = end - start + 1 if end == n - 1: break newCenter = end + (1 if i%2==0 else 0) for j in range(i+1, end+1): LPS[j] = min(LPS[i-(j-i)], 2*(end-j)+1) if j + LPS[i-(j-i)]//2 == end: newCenter = j break i = newCenter start = i - LPS[i]//2 end = i + LPS[i]//2 ind, mx = 0, 0 for j in range(n): if mx < LPS[j]: ind, mx = j, LPS[j] ans = "" start = ind - LPS[ind]//2 end = ind + LPS[ind]//2 for j in range(start, end+1): if newS[j] != "$": ans += newS[j] return ans
def is_index_valid(i, length): return 0 <= i < length initial_loot = input().split('|') while True: line = input() if line == 'Yohoho!': break command = line.split(' ', maxsplit=1) if command[0] == 'Loot': items = command[1].split() for item in items: if item not in initial_loot: initial_loot.insert(0, item) elif command[0] == 'Drop': index = int(command[1]) if not is_index_valid(index, len(initial_loot)): continue dropped_item = initial_loot.pop(index) initial_loot.append(dropped_item) elif command[0] == 'Steal': count = int(command[1]) stolen_items = [] if count <= len(initial_loot): for _ in range(count): stolen = initial_loot.pop() stolen_items.insert(0, stolen) else: for _ in range(len(initial_loot)): stolen = initial_loot.pop() stolen_items.insert(0, stolen) print(', '.join(stolen_items)) items_count = len(initial_loot) if len(initial_loot) > 0: total_length = 0 for item in initial_loot: item_length = len(item) total_length += item_length average_gain = total_length / items_count print(f'Average treasure gain: {average_gain:.2f} pirate credits.') else: print(f'Failed treasure hunt.')
초성 = ['ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'] 중성 = ['ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ', 'ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ', 'ㅙ', 'ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅠ', 'ㅡ', 'ㅢ', 'ㅣ'] 종성 = ['', 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ', 'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ', 'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'] a=input() b=input() c=input() a = 초성.index(a) b = 중성.index(b) c = 종성.index(c) print(chr(44032 +a*588+b*28+c))
# Funksjon som sjekker om året er et skuddår def is_leap_year(year): if year % 400 == 0: return True elif year % 100 == 0: return False elif year % 4 == 0: return True return False # Funksjon som returnerer hvilken ukedag året starter på. # (fungerer bare fra og med 1900) def weekday_newyear(year): if year == 1900: return 0 else: ukedag = 1 i = 1901 while i < year: if is_leap_year(i) == True: ukedag += 2 else: ukedag += 1 i += 1 return ukedag%7 # Teller hvor mange søndager som er den 1 i hver mnd. fra 1901 til og med 2013 sundays = 0 for year in range(1901, 2001): ukedag_nummer = weekday_newyear(year) if ukedag_nummer == 6: sundays += 1 dagerPrMnd = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30] #januar til om med november for dager in dagerPrMnd: if dager == 28 and is_leap_year(year): ukedag_nummer += dager + 1 else: ukedag_nummer += dager if ukedag_nummer%7 == 6: sundays += 1 print(sundays)
def idade_pessoa(id): idp = int(id) if idp <0: return 'idade inválida' elif idp <12: return 'você ainda é uma criança' elif idp <18: return 'você é adolecente' elif idp <65: return 'Você já é adulto' elif idp <100: return 'você está na melhor idade' else: return 'você é uma pessoa centenária'
__author__ = 'Administrator' # class Foo(object): # instance = None # # def __init__(self): # self.name = 'alex' # @classmethod # def get_instance(cls): # if Foo.instance: # return Foo.instance # else: # Foo.instance = Foo() # return Foo.instance # # def process(self): # return '123' # obj1 = Foo() # obj2 = Foo() # print(id(obj1),id(obj2)) # obj1 = Foo.get_instance() # obj2 = Foo.get_instance() # print(id(obj1),id(obj2)) class Foo(object): instance = None def __init__(self): self.name = 'alex' def __new__(cls, *args, **kwargs): if Foo.instance: return Foo.instance else: Foo.instance = object.__new__(cls, *args, **kwargs) return Foo.instance # obj1 = Foo() # obj2 = Foo() # print(id(obj1),id(obj2))
ano = int(input('Ano que você nasceu: ')) if ano%4==0 and ano%100!=0 or ano%400==0: print('Ano Bissexto') else: print('Não foi Bissexto')
# Requer atributo e atributo_comp = {"atributo": int (id_atributo), "atributo_comp" : int (id_atributo)} select_efetividades = lambda : """ Select fator FROM efetividades WHERE atributo = :atributo AND atributo_comp = :atributo_comp """
''' 디지털 세계 토지조사 디지몬들이 살고 있는 추억의 세계 디지털 월드는 다양한 크기의 섬들로 이루어져있습니다. 당신은 디지털국토정보공사를 도와 디지털월드를 개발하기 위한 토지조사를 진행하기로 하였습니다. 디지털 월드는 정사각형모양으로 생겼고, 토지는 1, 해양은 0으로 구성되어있습니다. 1이 상,하,좌,우로 연결되어있는 경우를 섬이라고 합니다. 디지털 월드에 있는 모든 섬들의 갯수와 섬의 크기를 조사하여 디지털 국토정보공사의 지적측량을 도와주세요. 디지털월드의 국토는 다음과 같이 생겼습니다. 그림 1 디지털월드를 탐색해서 다음과 같이 섬의 구역을 나누고, 그 크기를 조사하면 됩니다. 그림 2 여러분이 출력해야 할 것은 총 섬의 개수와 섬의 크기가 각각 몇인지를 오름차순으로 정리한 결과입니다. 실습 입력 첫째 줄에는 디지털 월드의 크기가 주어집니다. 디지털 월드는 항상 정사각형입니다. 두 번째 줄부터 디지털 월드 국토의 정보가 주어집니다. 1은 땅, 0은 바다입니다. 출력 1이 상,하,좌,우로 연결되어있는 경우를 섬이라고 합니다. 두가지 정보를 가진 튜플을 출력합니다. (섬의 전체 갯수, 각 섬의 크기를 오름차순으로 정렬한 리스트)를 출력합니다. 입력 예시 7 0110100 0110101 1110101 0000111 0100000 0111110 0111000 출력 예시 (3, [7, 8, 9]) ''' def dfs(x, y, pMap, visited): global isize visited[x][y] = 1 di = [(1,0), (0,1), (-1,0), (0,-1)] n = len(pMap) for d in di: nx = x + d[0] ny = y + d[1] if nx < 0 or ny < 0 or nx >= n or ny >= n: continue if pMap[nx][ny] == 0: continue if not visited[nx][ny]: isize += 1 dfs(nx, ny, pMap, visited) def cadastralSurvey(pMap): ''' 디지털월드의 국토의 모양이 주어졌을 때, 섬의 갯수 (int) 와 각 섬의 크기들 (list)을 반환하세요. ''' global isize num_island = 0 n = len(pMap) visited = [] for i in range(n): visited.append([0 for j in range(n)]) islands_size = [] for i in range(n): for j in range(n): if pMap[i][j] == 1 and visited[i][j] == 0: num_island += 1 isize = 1 dfs(i, j, pMap, visited) islands_size.append(isize) return num_island, sorted(islands_size) def read_input(): size = int(input()) returnMap = [] for _ in range(size): line = input() __line = [] for j in range(len(line)) : __line.append(int(line[j])) returnMap.append(__line) return returnMap def main(): pMap = read_input() print(cadastralSurvey(pMap)) if __name__ == "__main__": main()
inputfile = open('primes.txt') lista = inputfile.read().split(',') inputfile.close() lista = sorted([int(i) for i in lista]) outputfile = open('primes_sorted.txt', 'w') for i in lista: outputfile.write(str(i)+',')
inp = input("Input roman numerals: ").upper() + " " tot = 0 numeralDict = { "I":1, "V":5, "X":10, "L":50, "C":100, "D":500, "M":1000 } inp = list(inp) for charNum in range(len(inp)): char = inp[charNum] if(char == "I"): if(inp[charNum + 1] != "I" and inp[charNum + 1] != " "): tot -= 1 else: tot += 1 elif(char != " "): tot += numeralDict[char] print(tot)
# Crie um programa que leia o nome de uma pessoa e diga se ela tem 'Silva' no nome nome = str(input('Digite seu nome completo: ')).strip() print('Seu nome tem Silva? {}'.format('SILVA' in nome.upper())) # Resolução da aula # nome = str(input('Qual é seu nome completo? ')).strip() # print('Seu nome tem Silva? {}'.format('silva' in nome.lower()))
def saudacao(saudar, nome): print(saudar, nome) saudacao('Olá', 'Leandro')
f=open('countlines.txt','rt') n=0 for i in f: n+=1 print(n) f.close()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Created by techno at 25/04/19 #Feature: #Enter feature name here # Enter feature description here #Scenario: # Enter scenario name here # Enter steps here """ tokenizing a string and counting unique words""" text = ('this is sample text with several words different ' 'this is more sample text with some different words') word_counts = {} #count ocurrences of each unique word for word in text.split(): if word in word_counts: word_counts[word] +=1 #update existing key-value pair print(word_counts) # print just to check how is working else: word_counts[word] = 1 #insert new key-value pair print(word_counts) # print just to check how is working print(f'{"WORD":<12}COUNT') for word, count in sorted(word_counts.items()): print(f'{word:<12}{count}') print('\nNumer of unique words:', len(word_counts)) """ Line 10 tokenizes text by calling string method split, which separates the words using the method’s delimiter string argument. If you do not provide an argument, split uses a space. The method returns a list of tokens (that is, the words in text). Lines 10–14 iterate through the list of words. For each word, line 11 determines whether that word (the key) is already in the dictionary. If so, line 12 increments that word’s count; otherwise, line 14 inserts a new key–value pair for that word with an initial count of 1. Lines 16–21 summarize the results in a two-column table containing each word and its corresponding count. The for statement in lines 18 and 19 iterates through the diction-ary’s key–value pairs. It unpacks each key and value into the variables word and count, then displays them in two columns. Line 21 displays the number of unique words. """
our_method_top50_dict = { 2: { 'is_hired_1mo': 0.98, 'is_unemployed': 0.98, 'lost_job_1mo': 0.74, 'job_search': 0.12, 'job_offer': 1.0}, 0: { 'is_hired_1mo': 0.92, 'is_unemployed': 0.06, 'lost_job_1mo': 0.3, 'job_search': 1.0, 'job_offer': 1.0}, 1: { 'is_hired_1mo': 1.0, 'is_unemployed': 0.72, 'lost_job_1mo': 0.88, 'job_search': 1.0, 'job_offer': 1.0}, 3: { 'is_hired_1mo': 1.0, 'is_unemployed': 0.88, 'lost_job_1mo': 0.06, 'job_search': 1.0, 'job_offer': 1.0}, 4: { 'is_hired_1mo': 1.0, 'is_unemployed': 0.96, 'lost_job_1mo': 0.72, 'job_search': 1.0, 'job_offer': 1.0}} adaptive_top50_dict = { 0: { 'is_hired_1mo': 0.92, 'is_unemployed': 0.06, 'lost_job_1mo': 0.3, 'job_search': 1.0, 'job_offer': 1.0}, 3: { 'is_hired_1mo': 1.0, 'is_unemployed': 1.0, 'lost_job_1mo': 0.8, 'job_search': 1.0, 'job_offer': 1.0}, 1: { 'is_hired_1mo': 0.96, 'is_unemployed': 0.92, 'lost_job_1mo': 0.4, 'job_search': 0.44, 'job_offer': 1.0}, 2: { 'is_hired_1mo': 1.0, 'is_unemployed': 1.0, 'lost_job_1mo': 0.14, 'job_search': 1.0, 'job_offer': 0.98}, 4: { 'is_hired_1mo': 1.0, 'is_unemployed': 1.0, 'lost_job_1mo': 1.0, 'job_search': 1.0, 'job_offer': 1.0}} uncertainty_top50_dict = { 0: { 'is_hired_1mo': 0.92, 'is_unemployed': 0.06, 'lost_job_1mo': 0.3, 'job_search': 1.0, 'job_offer': 1.0}, 3: { 'is_hired_1mo': 0.98, 'is_unemployed': 0.9, 'lost_job_1mo': 0.82, 'job_search': 1.0, 'job_offer': 1.0}, 2: { 'is_hired_1mo': 0.64, 'is_unemployed': 1.0, 'lost_job_1mo': 0.92, 'job_search': 1.0, 'job_offer': 1.0}, 1: { 'is_hired_1mo': 1.0, 'is_unemployed': 0.98, 'lost_job_1mo': 0.12, 'job_search': 1.0, 'job_offer': 1.0}, 4: { 'is_hired_1mo': 1.0, 'is_unemployed': 1.0, 'lost_job_1mo': 1.0, 'job_search': 1.0, 'job_offer': 1.0}} uncertainty_uncalibrated_top50_dict = { 0: { 'is_hired_1mo': 0.92, 'is_unemployed': 0.06, 'lost_job_1mo': 0.3, 'job_search': 1.0, 'job_offer': 1.0}, 3: { 'is_hired_1mo': 0.94, 'is_unemployed': 0.36, 'lost_job_1mo': 0.86, 'job_search': 1.0, 'job_offer': 0.28}, 4: { 'is_hired_1mo': 0.54, 'is_unemployed': 0.98, 'lost_job_1mo': 0.02, 'job_search': 0.26, 'job_offer': 1.0}, 2: { 'is_hired_1mo': 1.0, 'is_unemployed': 0.78, 'lost_job_1mo': 0.94, 'job_search': 1.0, 'job_offer': 1.0}, 1: { 'is_hired_1mo': 0.94, 'is_unemployed': 0.36, 'lost_job_1mo': 0.66, 'job_search': 1.0, 'job_offer': 0.98}} our_method_top10K_dict = { 2: { 'is_hired_1mo': 1.0, 'is_unemployed': 0.9285714285714286, 'lost_job_1mo': 0.32857142857142857, 'job_search': 0.5285714285714286, 'job_offer': 1.0}, 0: { 'is_hired_1mo': 0.8, 'is_unemployed': 0.08571428571428572, 'lost_job_1mo': 0.07142857142857142, 'job_search': 0.8714285714285714, 'job_offer': 1.0}, 1: { 'is_hired_1mo': 0.9571428571428572, 'is_unemployed': 0.6285714285714286, 'lost_job_1mo': 0.5285714285714286, 'job_search': 0.8571428571428571, 'job_offer': 1.0}, 3: { 'is_hired_1mo': 0.9714285714285714, 'is_unemployed': 0.5428571428571428, 'lost_job_1mo': 0.1, 'job_search': 1.0, 'job_offer': 1.0}, 4: { 'is_hired_1mo': 0.9857142857142858, 'is_unemployed': 0.9285714285714286, 'lost_job_1mo': 0.5, 'job_search': 1.0, 'job_offer': 1.0}} adaptive_top10K_dict = { 3: { 'is_hired_1mo': 0.8857142857142857, 'is_unemployed': 0.5857142857142857, 'lost_job_1mo': 0.5714285714285714, 'job_search': 1.0, 'job_offer': 1.0}, 1: { 'is_hired_1mo': 0.9428571428571428, 'is_unemployed': 0.7142857142857143, 'lost_job_1mo': 0.14285714285714285, 'job_search': 0.38571428571428573, 'job_offer': 1.0}, 2: { 'is_hired_1mo': 0.9285714285714286, 'is_unemployed': 0.8571428571428571, 'lost_job_1mo': 0.05714285714285714, 'job_search': 0.9571428571428572, 'job_offer': 1.0}, 4: { 'is_hired_1mo': 0.8571428571428571, 'is_unemployed': 0.9714285714285714, 'lost_job_1mo': 0.5571428571428572, 'job_search': 0.9857142857142858, 'job_offer': 1.0}, 0: { 'is_hired_1mo': 0.8, 'is_unemployed': 0.08571428571428572, 'lost_job_1mo': 0.07142857142857142, 'job_search': 0.8714285714285714, 'job_offer': 1.0}, } uncertainty_top10K_dict = { 3: { 'is_hired_1mo': 0.9857142857142858, 'is_unemployed': 0.9, 'lost_job_1mo': 0.5571428571428572, 'job_search': 1.0, 'job_offer': 1.0}, 2: { 'is_hired_1mo': 0.6571428571428571, 'is_unemployed': 0.9, 'lost_job_1mo': 0.4714285714285714, 'job_search': 0.9714285714285714, 'job_offer': 1.0}, 1: { 'is_hired_1mo': 1.0, 'is_unemployed': 0.6428571428571429, 'lost_job_1mo': 0.11428571428571428, 'job_search': 1.0, 'job_offer': 1.0}, 4: { 'is_hired_1mo': 0.8571428571428571, 'is_unemployed': 0.8714285714285714, 'lost_job_1mo': 0.5571428571428572, 'job_search': 0.9857142857142858, 'job_offer': 1.0}, 0: { 'is_hired_1mo': 0.8, 'is_unemployed': 0.08571428571428572, 'lost_job_1mo': 0.07142857142857142, 'job_search': 0.8714285714285714, 'job_offer': 1.0}, } uncertainty_uncalibrated_top10k_dict = { 3: { 'is_hired_1mo': 1.0, 'is_unemployed': 0.08571428571428572, 'lost_job_1mo': 0.45714285714285713, 'job_search': 0.9857142857142858, 'job_offer': 0.0}, 4: { 'is_hired_1mo': 0.6857142857142857, 'is_unemployed': 0.6714285714285714, 'lost_job_1mo': 0.07142857142857142, 'job_search': 0.5714285714285714, 'job_offer': 1.0}, 2: { 'is_hired_1mo': 0.9857142857142858, 'is_unemployed': 0.5428571428571428, 'lost_job_1mo': 0.6142857142857143, 'job_search': 0.9857142857142858, 'job_offer': 1.0}, 1: { 'is_hired_1mo': 0.9571428571428572, 'is_unemployed': 0.21428571428571427, 'lost_job_1mo': 0.22857142857142856, 'job_search': 0.6857142857142857, 'job_offer': 0.9428571428571428}, 0: { 'is_hired_1mo': 0.8, 'is_unemployed': 0.08571428571428572, 'lost_job_1mo': 0.07142857142857142, 'job_search': 0.8714285714285714, 'job_offer': 1.0}, } our_method_topP_dict = { 2: { 'is_hired_1mo': 0.8666666666666667, 'is_unemployed': 1.0, 'lost_job_1mo': 0.55, 'job_search': 0.6, 'job_offer': 1.0}, 0: { 'is_hired_1mo': 0.8, 'is_unemployed': 0.08571428571428572, 'lost_job_1mo': 0.1724137931034483, 'job_search': 0.8714285714285714, 'job_offer': 1.0}, 1: { 'is_hired_1mo': 0.8, 'is_unemployed': 0.7, 'lost_job_1mo': 0.85, 'job_search': 0.8375, 'job_offer': 1.0}, 3: { 'is_hired_1mo': 0.77, 'is_unemployed': 0.5222222222222223, 'lost_job_1mo': 0.1, 'job_search': 0.96, 'job_offer': 0.98}, 4: { 'is_hired_1mo': 0.9375, 'is_unemployed': 0.8111111111111111, 'lost_job_1mo': 0.5833333333333334, 'job_search': 0.7142857142857143, 'job_offer': 0.9866666666666667}} adaptive_topP_dict = { 3: { 'is_hired_1mo': 0.8857142857142857, 'is_unemployed': 0.9512195121951219, 'lost_job_1mo': 0.8, 'job_search': 0.91, 'job_offer': 0.98}, 1: { 'is_hired_1mo': 0.875, 'is_unemployed': 0.6875, 'lost_job_1mo': 0.3, 'job_search': 0.4, 'job_offer': 0.9733333333333334}, 2: { 'is_hired_1mo': 0.8875, 'is_unemployed': 0.9666666666666667, 'lost_job_1mo': 0.1, 'job_search': 0.9166666666666666, 'job_offer': 0.94}, 4: { 'is_hired_1mo': 0.8571428571428571, 'is_unemployed': 0.9, 'lost_job_1mo': 0.76, 'job_search': 0.95, 'job_offer': 0.98}, 0: { 'is_hired_1mo': 0.8, 'is_unemployed': 0.08571428571428572, 'lost_job_1mo': 0.1724137931034483, 'job_search': 0.8714285714285714, 'job_offer': 1.0}, } uncertainty_topP_dict = { 3: { 'is_hired_1mo': 0.9333333333333333, 'is_unemployed': 0.7555555555555555, 'lost_job_1mo': 0.78, 'job_search': 0.9, 'job_offer': 0.9533333333333334}, 2: { 'is_hired_1mo': 0.6444444444444445, 'is_unemployed': 0.825, 'lost_job_1mo': 0.75, 'job_search': 0.95, 'job_offer': 1.0}, 1: { 'is_hired_1mo': 0.7454545454545455, 'is_unemployed': 0.7333333333333333, 'lost_job_1mo': 0.175, 'job_search': 0.89, 'job_offer': 0.94}, 4: { 'is_hired_1mo': 0.8, 'is_unemployed': 0.8, 'lost_job_1mo': 0.6333333333333333, 'job_search': 0.8, 'job_offer': 0.9666666666666667}, 0: { 'is_hired_1mo': 0.8, 'is_unemployed': 0.08571428571428572, 'lost_job_1mo': 0.1724137931034483, 'job_search': 0.8714285714285714, 'job_offer': 1.0}, } uncertainty_uncalibrated_topP_dict = { 3: { 'is_hired_1mo': 0.9555555555555556, 'is_unemployed': 0.1, 'lost_job_1mo': 0.85, 'job_search': 0.9666666666666667, 'job_offer': 0.0}, 4: { 'is_hired_1mo': 0.7, 'is_unemployed': 0.6714285714285714, 'lost_job_1mo': 0.07142857142857142, 'job_search': 0.59, 'job_offer': 0.9666666666666667}, 2: { 'is_hired_1mo': 0.8777777777777778, 'is_unemployed': 0.43333333333333335, 'lost_job_1mo': 0.7, 'job_search': 0.9333333333333333, 'job_offer': 0.9857142857142858}, 1: { 'is_hired_1mo': 0.6727272727272727, 'is_unemployed': 0.358974358974359, 'lost_job_1mo': 0.5333333333333333, 'job_search': 0.7166666666666667, 'job_offer': 0.94}, 0: { 'is_hired_1mo': 0.8, 'is_unemployed': 0.08571428571428572, 'lost_job_1mo': 0.1724137931034483, 'job_search': 0.8714285714285714, 'job_offer': 1.0}, } our_method_new_dict = { 4: { 'job_search': { 'numerator': 273734, 'sem': 17108.4445409312}, 'is_hired_1mo': { 'numerator': 14419, 'sem': 366.99671598899175}, 'lost_job_1mo': { 'numerator': 2227, 'sem': 539.6417202779419}, 'is_unemployed': { 'numerator': 21711, 'sem': 12857.60055036169}, 'job_offer': { 'numerator': 398140, 'sem': 44551.92694544843}}, 0: { 'is_unemployed': { 'numerator': 5363, 'sem': 16693273.716407115}, 'job_search': { 'numerator': 9955, 'sem': 4007.9818390547352}, 'lost_job_1mo': { 'numerator': 110, 'sem': 2507.0304745155704}, 'is_hired_1mo': { 'numerator': 5876, 'sem': 1440.5507101946998}, 'job_offer': { 'numerator': 397551, 'sem': 21053.672213431728}}, 3: { 'is_hired_1mo': { 'numerator': 32170, 'sem': 15120.377307912013}, 'lost_job_1mo': { 'numerator': 6611, 'sem': 2235705.395599921}, 'is_unemployed': { 'numerator': 25741, 'sem': 7611.7323763009435}, 'job_offer': { 'numerator': 603974, 'sem': 68313.02689650582}, 'job_search': { 'numerator': 53456, 'sem': 7483.790444209734}}, 2: { 'is_unemployed': { 'numerator': 4646, 'sem': 626.9208018618386}, 'is_hired_1mo': { 'numerator': 18584, 'sem': 3451.8503622544213}, 'job_offer': { 'numerator': 398040, 'sem': 11364.921234701022}, 'job_search': { 'numerator': 63723, 'sem': 10846.197020221041}, 'lost_job_1mo': { 'numerator': 413, 'sem': 306.64505669819584}}, 1: { 'is_hired_1mo': { 'numerator': 22382, 'sem': 11409.994092103772}, 'job_offer': { 'numerator': 388810, 'sem': 14451.582794272697}, 'lost_job_1mo': { 'numerator': 437, 'sem': 175.86948118261208}, 'is_unemployed': { 'numerator': 2813, 'sem': 948.9439720005547}, 'job_search': { 'numerator': 16140, 'sem': 4210.272625790964}}} adaptive_new_dict = { 0: { 'is_unemployed': { 'numerator': 5363, 'sem': 16693273.716407115}, 'job_search': { 'numerator': 9955, 'sem': 4007.9818390547352}, 'lost_job_1mo': { 'numerator': 110, 'sem': 2507.0304745155704}, 'is_hired_1mo': { 'numerator': 5876, 'sem': 1440.5507101946998}, 'job_offer': { 'numerator': 397551, 'sem': 21053.672213431728}}, 1: { 'is_unemployed': { 'numerator': 12031, 'sem': 7726.799776019945}, 'lost_job_1mo': { 'numerator': 111, 'sem': 515.2125927164042}, 'job_search': { 'numerator': 13663, 'sem': 5549.774344602734}, 'is_hired_1mo': { 'numerator': 13799, 'sem': 5795.455532339655}, 'job_offer': { 'numerator': 452457, 'sem': 62954.13118906742}}, 2: { 'job_search': { 'numerator': 153855, 'sem': 11781.304215985185}, 'is_unemployed': { 'numerator': 4371, 'sem': 1269.4789663340573}, 'job_offer': { 'numerator': 573631, 'sem': 56246.765267860545}, 'lost_job_1mo': { 'numerator': 418, 'sem': 5649172.944711616}, 'is_hired_1mo': { 'numerator': 16584, 'sem': 3087.7931741284956}}, 4: { 'is_unemployed': { 'numerator': 16014, 'sem': 6253.689632372853}, 'is_hired_1mo': { 'numerator': 8766, 'sem': 2875.0965294760767}, 'lost_job_1mo': { 'numerator': 1238, 'sem': 480.9785550015688}, 'job_search': { 'numerator': 17117, 'sem': 1808.3838577036793}, 'job_offer': { 'numerator': 502520, 'sem': 41362.28738283996}}, 3: { 'is_unemployed': { 'numerator': 1002, 'sem': 418.159029977143}, 'is_hired_1mo': { 'numerator': 7953, 'sem': 1637.1488788134022}, 'job_search': { 'numerator': 46384, 'sem': 3869.1915428802877}, 'lost_job_1mo': { 'numerator': 1047, 'sem': 266.4834153426912}, 'job_offer': { 'numerator': 512423, 'sem': 41770.65447128737}}} uncertainty_new_dict = { 4: { 'lost_job_1mo': { 'numerator': 2340, 'sem': 1014.7282972059196}, 'job_search': { 'numerator': 78380, 'sem': 97346.85658409167}, 'is_unemployed': { 'numerator': 14536, 'sem': 6791.858226085842}, 'is_hired_1mo': { 'numerator': 10119, 'sem': 2972.5758399128595}, 'job_offer': { 'numerator': 401625, 'sem': 21081.31529751928}}, 1: { 'is_unemployed': { 'numerator': 3228, 'sem': 1228.0100832225278}, 'lost_job_1mo': { 'numerator': 552, 'sem': 4469674.866698298}, 'job_offer': { 'numerator': 612708, 'sem': 57112.29214399502}, 'job_search': { 'numerator': 42962, 'sem': 27601.546048149256}, 'is_hired_1mo': { 'numerator': 97768, 'sem': 47307.47888641291}}, 3: { 'job_search': { 'numerator': 93841, 'sem': 31369.23556608593}, 'job_offer': { 'numerator': 516548, 'sem': 88235.57752764622}, 'is_unemployed': { 'numerator': 20132, 'sem': 5044.345309986642}, 'lost_job_1mo': { 'numerator': 1070, 'sem': 214.21570463056867}, 'is_hired_1mo': { 'numerator': 27930, 'sem': 3577.721669440321}}, 2: { 'is_hired_1mo': { 'numerator': 20810, 'sem': 2861.0333260285565}, 'is_unemployed': { 'numerator': 12728, 'sem': 1700.1869141976804}, 'job_offer': { 'numerator': 398092, 'sem': 10243.721819469301}, 'lost_job_1mo': { 'numerator': 637, 'sem': 241.20102291602242}, 'job_search': { 'numerator': 51418, 'sem': 2575.3470007528185}}, 0: { 'is_unemployed': { 'numerator': 5363, 'sem': 16693273.716407115}, 'job_search': { 'numerator': 9955, 'sem': 4007.9818390547352}, 'lost_job_1mo': { 'numerator': 110, 'sem': 2507.0304745155704}, 'is_hired_1mo': { 'numerator': 5876, 'sem': 1440.5507101946998}, 'job_offer': { 'numerator': 397551, 'sem': 21053.672213431728}}, } uncertainty_uncalibrated_new_dict = { 0: { 'is_unemployed': { 'numerator': 5363, 'sem': 16693273.716407115}, 'job_search': { 'numerator': 9955, 'sem': 4007.9818390547352}, 'lost_job_1mo': { 'numerator': 110, 'sem': 2507.0304745155704}, 'is_hired_1mo': { 'numerator': 5876, 'sem': 1440.5507101946998}, 'job_offer': { 'numerator': 397551, 'sem': 21053.672213431728}}, 4: { 'lost_job_1mo': { 'numerator': 8916, 'sem': 11036527.93587803}, 'is_unemployed': { 'numerator': 7001, 'sem': 21549.54012277195}, 'is_hired_1mo': { 'numerator': 27676, 'sem': 2636.147839352088}, 'job_offer': { 'numerator': 625859, 'sem': 29576.835392492}, 'job_search': { 'numerator': 50729, 'sem': 9656.648068224675}}, 3: { 'job_search': { 'numerator': 29614, 'sem': 2545.5133076343727}, 'is_unemployed': { 'numerator': 1031, 'sem': 2525.835113127583}, 'is_hired_1mo': { 'numerator': 21080, 'sem': 2532.796165703048}, 'lost_job_1mo': { 'numerator': 738, 'sem': 250.86318309712837}, 'job_offer': { 'numerator': 10, 'sem': 0}}, 2: { 'is_hired_1mo': { 'numerator': 28655, 'sem': 2430.142652865983}, 'lost_job_1mo': { 'numerator': 2937, 'sem': 831.243117876841}, 'job_search': { 'numerator': 23071, 'sem': 3054.9995697587638}, 'job_offer': { 'numerator': 376527, 'sem': 28485.961558385043}, 'is_unemployed': { 'numerator': 25294, 'sem': 6380.589292580216}}, 1: { 'job_search': { 'numerator': 2863, 'sem': 1345.1047321110705}, 'lost_job_1mo': { 'numerator': 131, 'sem': 105.74747007400558}, 'is_unemployed': { 'numerator': 326, 'sem': 762.636610213694}, 'job_offer': { 'numerator': 437090, 'sem': 29739.845930574476}, 'is_hired_1mo': { 'numerator': 76054, 'sem': 24013.321646355937}}}
def solve() -> int: n, a, b, x, y, z = map(int, input().split()) y = min(y, a * x) z = min(z, b * x) if y * b > z * a: a, b = b, a y, z = z, y mn_cost = 1 << 60 if n // a <= a - 1: for i in range(n // a + 1): j, k = divmod(n - i * a, b) mn_cost = min(mn_cost, i * y + j * z + k * x) else: for j in range(a): i, k = divmod(n - j * b, a) mn_cost = min(mn_cost, i * y + j * z + k * x) return mn_cost def main() -> None: t = int(input()) res = [] for _ in range(t): res.append(solve()) print(*res, sep="\n") if __name__ == "__main__": main()
pessoas_jantar = input("Boa noite,quantas pessoas estão para jantar?:") pessoas_jantar = int(pessoas_jantar) if pessoas_jantar >= 8: print("Desculpe como vocês estão em " + str(pessoas_jantar) + " pessoas,precisarão aguardar termos mesas disponiveis.") else: print("Ok! Por favor me acompanhe até sua mesa!")
def total(n): return n <= 9 and n >= 0 def main(): n = int(input("Digite um numero entre 0 e 9, caso contrario será falso: ")) resultado = total(n) print(f' o numero é {resultado}') if __name__ == '__main__': main()
# Problem Statement: https://leetcode.com/problems/climbing-stairs/ class Solution: def climbStairs(self, n: int) -> int: # Base Cases if n==1: return 1 if n==2: return 2 # Memoization memo_table = [1]*(n+1) # Initialization memo_table[1] = 1 memo_table[2] = 2 # Iterative solution Memoization for i in range(3, n+1): memo_table[i] = memo_table[i-1]+memo_table[i-2] return memo_table[n]
#concatenation # youtuber = " varun verma" #some string concatenation # print("subscribe to "+ youtuber) # print("subscribe to {}" .format(youtuber)) # print(f"subscriber to {youtuber}") adj= input("Adjective: ") verb1 = input("Verb: ") verb2 = input("Verb: ") famous_person = input("Famous Person: ") madlib = f"Computer is so {adj}! it makes me so excited all the time because \ I like to {verb1}. Stay hydrated and {verb2} like you are {famous_person}" print(madlib)
class Solution: def XXX(self, nums: List[int]) -> bool: l = len(nums) start = l-1 end = 1 for index in range(1,l): val = nums[start - index] if val >= end: end = 1 else: end += 1 return end == 1
# Sage version information for Python scripts # This file is auto-generated by the sage-update-version script, do not edit! version = '9.5.beta2' date = '2021-09-26' banner = 'SageMath version 9.5.beta2, Release Date: 2021-09-26'
countries = { "kabul": "afghanistan", "tirana": "albania", "alger": "algeria", "fagatogo": "american samoa", "andorra la vella": "andorra", "luanda": "angola", "the valley": "anguilla", "null": "united states minor outlying islands", "saint john's": "antigua and barbuda", "buenos aires": "argentina", "yerevan": "armenia", "oranjestad": "aruba", "canberra": "australia", "wien": "austria", "baku": "azerbaijan", "nassau": "bahamas", "al-manama": "bahrain", "dhaka": "bangladesh", "bridgetown": "barbados", "minsk": "belarus", "bruxelles [brussel]": "belgium", "belmopan": "belize", "porto-novo": "benin", "hamilton": "bermuda", "thimphu": "bhutan", "la paz": "bolivia", "sarajevo": "bosnia and herzegovina", "gaborone": "botswana", "brasília": "brazil", "bandar seri begawan": "brunei", "sofia": "bulgaria", "ouagadougou": "burkina faso", "bujumbura": "burundi", "phnom penh": "cambodia", "yaound": "cameroon", "ottawa": "canada", "praia": "cape verde", "george town": "cayman islands", "bangui": "central african republic", "n'djam": "chad", "santiago de chile": "chile", "peking": "china", "flying fish cove": "christmas island", "west island": "cocos (keeling) islands", "santaf": "colombia", "moroni": "comoros", "brazzaville": "congo", "avarua": "cook islands", "san jos": "costa rica", "zagreb": "croatia", "la habana": "cuba", "nicosia": "cyprus", "praha": "czech republic", "copenhagen": "denmark", "djibouti": "djibouti", "roseau": "dominica", "santo domingo de guzm": "dominican republic", "dili": "east timor", "quito": "ecuador", "cairo": "egypt", "san salvador": "el salvador", "london": "united kingdom", "malabo": "equatorial guinea", "asmara": "eritrea", "tallinn": "estonia", "addis abeba": "ethiopia", "stanley": "falkland islands", "tórshavn": "faroe islands", "suva": "fiji islands", "helsinki [helsingfors]": "finland", "paris": "france", "cayenne": "french guiana", "papeete": "french polynesia", "libreville": "gabon", "banjul": "gambia", "tbilisi": "georgia", "berlin": "germany", "accra": "ghana", "gibraltar": "gibraltar", "athenai": "greece", "nuuk": "greenland", "saint george's": "grenada", "basse-terre": "guadeloupe", "aga": "guam", "ciudad de guatemala": "guatemala", "conakry": "guinea", "bissau": "guinea-bissau", "georgetown": "guyana", "port-au-prince": "haiti", "citt": "holy see (vatican capital state)", "tegucigalpa": "honduras", "victoria": "seychelles", "budapest": "hungary", "reykjav": "iceland", "new delhi": "india", "jakarta": "indonesia", "tehran": "iran", "baghdad": "iraq", "dublin": "ireland", "jerusalem": "israel", "roma": "italy", "yamoussoukro": "ivory coast", "kingston": "norfolk island", "tokyo": "japan", "amman": "jordan", "astana": "kazakhstan", "nairobi": "kenya", "bairiki": "kiribati", "kuwait": "kuwait", "bishkek": "kyrgyzstan", "vientiane": "laos", "riga": "latvia", "beirut": "lebanon", "maseru": "lesotho", "monrovia": "liberia", "tripoli": "libyan arab jamahiriya", "vaduz": "liechtenstein", "vilnius": "lithuania", "luxembourg [luxemburg/l": "luxembourg", "macao": "macao", "skopje": "north macedonia", "antananarivo": "madagascar", "lilongwe": "malawi", "kuala lumpur": "malaysia", "male": "maldives", "bamako": "mali", "valletta": "malta", "dalap-uliga-darrit": "marshall islands", "fort-de-france": "martinique", "nouakchott": "mauritania", "port-louis": "mauritius", "mamoutzou": "mayotte", "ciudad de m": "mexico", "palikir": "micronesia, federated states of", "chisinau": "moldova", "monaco-ville": "monaco", "ulan bator": "mongolia", "plymouth": "montserrat", "rabat": "morocco", "maputo": "mozambique", "rangoon (yangon)": "myanmar", "windhoek": "namibia", "yaren": "nauru", "kathmandu": "nepal", "amsterdam": "netherlands", "willemstad": "netherlands antilles", "noum": "new caledonia", "wellington": "new zealand", "managua": "nicaragua", "niamey": "niger", "abuja": "nigeria", "alofi": "niue", "pyongyang": "north korea", "belfast": "northern ireland", "garapan": "northern mariana islands", "oslo": "norway", "masqat": "oman", "islamabad": "pakistan", "koror": "palau", "gaza": "palestine", "ciudad de panam": "panama", "port moresby": "papua new guinea", "asunci": "paraguay", "lima": "peru", "manila": "philippines", "adamstown": "pitcairn", "warszawa": "poland", "lisboa": "portugal", "san juan": "puerto rico", "doha": "qatar", "saint-denis": "reunion", "bucuresti": "romania", "moscow": "russian federation", "kigali": "rwanda", "jamestown": "saint helena", "basseterre": "saint kitts and nevis", "castries": "saint lucia", "saint-pierre": "saint pierre and miquelon", "kingstown": "saint vincent and the grenadines", "apia": "samoa", "san marino": "san marino", "s": "sao tome and principe", "riyadh": "saudi arabia", "edinburgh": "scotland", "dakar": "senegal", "freetown": "sierra leone", "singapore": "singapore", "bratislava": "slovakia", "ljubljana": "slovenia", "honiara": "solomon islands", "mogadishu": "somalia", "pretoria": "south africa", "seoul": "south korea", "juba": "south sudan", "madrid": "spain", "khartum": "sudan", "paramaribo": "suriname", "longyearbyen": "svalbard and jan mayen", "mbabane": "swaziland", "stockholm": "sweden", "bern": "switzerland", "damascus": "syria", "dushanbe": "tajikistan", "dodoma": "tanzania", "bangkok": "thailand", "lom": "togo", "fakaofo": "tokelau", "nuku'alofa": "tonga", "port-of-spain": "trinidad and tobago", "tunis": "tunisia", "ankara": "turkey", "ashgabat": "turkmenistan", "cockburn town": "turks and caicos islands", "funafuti": "tuvalu", "kampala": "uganda", "kyiv": "ukraine", "abu dhabi": "united arab emirates", "washington": "united states", "montevideo": "uruguay", "toskent": "uzbekistan", "port-vila": "vanuatu", "caracas": "venezuela", "hanoi": "vietnam", "road town": "virgin islands, british", "charlotte amalie": "virgin islands, u.s.", "cardiff": "wales", "mata-utu": "wallis and futuna", "el-aai": "western sahara", "sanaa": "yemen", "beograd": "yugoslavia", "lusaka": "zambia", "harare": "zimbabwe" }
def createTree(self, root, *elements): root = None for element in elements: root = self.insert(root, element) return root
class ClassList(list): def __init__(self): self.OnClassListChange = lambda *args,**kwargs:0 def AddClass(self,Cls, notify = True): if Cls not in self: self.append(Cls) if notify:self.OnClassListChange(added = self[-1]) def RemoveClass(self, Cls, notify = True): if Cls in self: self.remove(Cls) if notify:self.OnClassListChange(removed = Cls) return self def __add__(self, other): self.AddClass(other) return self def __sub__(self,other): self.RemoveClass(other) return self def __iadd__(self, other): self.AddClass(other) return self def __isub__(self,other): self.RemoveClass(other) return self
''' Defines `Error`, the base class for all exceptions generated in this package. ''' class Error(Exception): pass
def can_build(env, platform): return True def configure(env): pass def get_doc_classes(): return [ "WorldArea", "VoxelLight", "VoxelmanLight", "VoxelmanLevelGenerator", "VoxelmanLevelGeneratorFlat", "VoxelSurfaceMerger", "VoxelSurfaceSimple", "VoxelSurface", "VoxelmanLibraryMerger", "VoxelmanLibrarySimple", "VoxelmanLibrary", "VoxelCubePoints", "VoxelMesherCubic", "VoxelMeshData", "MarchingCubesCellData", "VoxelMesherMarchingCubes", "VoxelMesher", "EnvironmentData", "VoxelChunk", "VoxelChunkDefault", "VoxelStructure", "BlockVoxelStructure", "VoxelWorld", "VoxelMesherBlocky", "VoxelWorldBlocky", "VoxelChunkBlocky", "VoxelMesherLiquidBlocky", "VoxelWorldMarchingCubes", "VoxelChunkMarchingCubes", "VoxelMesherCubic", "VoxelWorldCubic", "VoxelChunkCubic", "VoxelMesherDefault", "VoxelWorldDefault", "VoxelJob", "VoxelTerrarinJob", "VoxelLightJob", "VoxelPropJob", ] def get_doc_path(): return "doc_classes"
# # PySNMP MIB module Fore-J2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Fore-J2-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:17:14 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection") asx, = mibBuilder.importSymbols("Fore-Common-MIB", "asx") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Bits, Counter32, Counter64, ObjectIdentity, IpAddress, TimeTicks, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, Integer32, ModuleIdentity, Unsigned32, MibIdentifier, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Counter32", "Counter64", "ObjectIdentity", "IpAddress", "TimeTicks", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "Integer32", "ModuleIdentity", "Unsigned32", "MibIdentifier", "iso") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") foreJ2 = ModuleIdentity((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6)) if mibBuilder.loadTexts: foreJ2.setLastUpdated('9911050000Z') if mibBuilder.loadTexts: foreJ2.setOrganization('FORE') if mibBuilder.loadTexts: foreJ2.setContactInfo(' Postal: FORE Systems Inc. 1000 FORE Drive Warrendale, PA 15086-7502 Tel: +1 724 742 6900 Email: nm_mibs@fore.com Web: http://www.fore.com') if mibBuilder.loadTexts: foreJ2.setDescription('write something interesting here') j2ConfGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 1)) j2StatsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2)) j2ConfTable = MibTable((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 1, 1), ) if mibBuilder.loadTexts: j2ConfTable.setStatus('current') if mibBuilder.loadTexts: j2ConfTable.setDescription('A table of J2 switch port configuration information.') j2ConfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 1, 1, 1), ).setIndexNames((0, "Fore-J2-MIB", "j2ConfBoard"), (0, "Fore-J2-MIB", "j2ConfModule"), (0, "Fore-J2-MIB", "j2ConfPort")) if mibBuilder.loadTexts: j2ConfEntry.setStatus('current') if mibBuilder.loadTexts: j2ConfEntry.setDescription('A table entry containing J2 configuration information for each port.') j2ConfBoard = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 1, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2ConfBoard.setStatus('current') if mibBuilder.loadTexts: j2ConfBoard.setDescription("The index of this port's switch board.") j2ConfModule = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 1, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2ConfModule.setStatus('current') if mibBuilder.loadTexts: j2ConfModule.setDescription('The network module of this port.') j2ConfPort = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 1, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2ConfPort.setStatus('current') if mibBuilder.loadTexts: j2ConfPort.setDescription('The number of this port.') j2LineLength = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("j2ShortLine", 1), ("j2LongLine", 2))).clone('j2ShortLine')).setMaxAccess("readwrite") if mibBuilder.loadTexts: j2LineLength.setStatus('current') if mibBuilder.loadTexts: j2LineLength.setDescription('This variable represents the length of the physical medium connected to the J2 interface: j2ShortLine (1) means the line is a short line with less than 4db of attenuation from the transmitting source. j2LongLine (2) means the line is a long line, with greater than 4db of attenuation from the transmitting source.') j2LoopbackConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("j2NoLoop", 1), ("j2LineLoop", 2), ("j2DiagLoop", 3), ("j2OtherLoop", 4))).clone('j2NoLoop')).setMaxAccess("readwrite") if mibBuilder.loadTexts: j2LoopbackConfig.setStatus('current') if mibBuilder.loadTexts: j2LoopbackConfig.setDescription("This variable represents the loopback configuration of the J2 interface. j2NoLoop (1) means that the interface is not in a loopback state. j2LineLoop (2) means that receive signal is looped back for retransmission without passing through the port's reframing function. j2DiagLoop (3) means that the transmit data stream is looped back to the receiver. j2OtherLoop (4) means that the interface is in a loopback that is not defined here.") j2TxClockSource = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("rxTiming", 1), ("localTiming", 2))).clone('localTiming')).setMaxAccess("readwrite") if mibBuilder.loadTexts: j2TxClockSource.setStatus('current') if mibBuilder.loadTexts: j2TxClockSource.setDescription('The source of the transmit clock.') j2LineStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65534)).clone(1)).setMaxAccess("readonly") if mibBuilder.loadTexts: j2LineStatus.setStatus('current') if mibBuilder.loadTexts: j2LineStatus.setDescription('This variable indicates the Line Status of the interface. The variable contains loopback state information and failure state information. It is a bit map represented as a sum. The j2NoAlarm should be set if and only if no other flag is set. The various bit positions are: 1 j2NoAlarm 2 j2RxLOF Receive Loss of Frame 4 j2RxLOC Receive Loss of Clock (Not used anymore) 8 j2RxAIS Receive Alarm Indication Signal 16 j2TxLOC Transmit Loss of Clock (Not used anymore) 32 j2RxRAIS Receive Remote Alarm Indication Signal 64 j2RxLOS Receive Loss of Signal 128 j2TxRAIS Transmit Yellow ( Remote Alarm Indication Signal) 256 j2Other any line status not defined here 32768 j2RxLCD Receiving LCD failure indication.') j2IdleUnassignedCells = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 1, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("unassigned", 1), ("idle", 2))).clone('unassigned')).setMaxAccess("readwrite") if mibBuilder.loadTexts: j2IdleUnassignedCells.setStatus('current') if mibBuilder.loadTexts: j2IdleUnassignedCells.setDescription("This variable indicates the types of cells that should be sent in case there is no real data to send. According to the ATM Forum, Unassigned cells should be sent (octet 1-3 are 0's, octet 4 is 0000xxx0, where x is 'don't care'). According to the CCITT specifications, Idle cells should be sent (everything is '0' except for the CLP bit which is '1'). By default, unassigned cells are transmitted in case there is no data to send.") j2ErrorTable = MibTable((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1), ) if mibBuilder.loadTexts: j2ErrorTable.setStatus('current') if mibBuilder.loadTexts: j2ErrorTable.setDescription('A table of J2 error counters.') j2ErrorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1), ).setIndexNames((0, "Fore-J2-MIB", "j2ErrorBoard"), (0, "Fore-J2-MIB", "j2ErrorModule"), (0, "Fore-J2-MIB", "j2ErrorPort")) if mibBuilder.loadTexts: j2ErrorEntry.setStatus('current') if mibBuilder.loadTexts: j2ErrorEntry.setDescription('A table entry containing J2 error counters.') j2ErrorBoard = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2ErrorBoard.setStatus('current') if mibBuilder.loadTexts: j2ErrorBoard.setDescription("The index of this port's switch board.") j2ErrorModule = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2ErrorModule.setStatus('current') if mibBuilder.loadTexts: j2ErrorModule.setDescription('The network module of this port.') j2ErrorPort = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2ErrorPort.setStatus('current') if mibBuilder.loadTexts: j2ErrorPort.setDescription('The number of this port.') j2B8ZSCodingErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2B8ZSCodingErrors.setStatus('current') if mibBuilder.loadTexts: j2B8ZSCodingErrors.setDescription('The number of B8ZS coding violation errors.') j2CRC5Errors = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2CRC5Errors.setStatus('current') if mibBuilder.loadTexts: j2CRC5Errors.setDescription('The number of CRC-5 received errors.') j2FramingErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2FramingErrors.setStatus('current') if mibBuilder.loadTexts: j2FramingErrors.setDescription('The number of framing patterns received in error.') j2RxLossOfFrame = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2RxLossOfFrame.setStatus('current') if mibBuilder.loadTexts: j2RxLossOfFrame.setDescription('The number of seconds during which the receiver was experiencing Loss Of Frame.') j2RxLossOfClock = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2RxLossOfClock.setStatus('current') if mibBuilder.loadTexts: j2RxLossOfClock.setDescription('The number of seconds during which the receiver was not observing transitions on the received clock signal.') j2RxAIS = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2RxAIS.setStatus('current') if mibBuilder.loadTexts: j2RxAIS.setDescription('The number of seconds during which the receiver detected an Alarm Indication Signal.') j2TxLossOfClock = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2TxLossOfClock.setStatus('current') if mibBuilder.loadTexts: j2TxLossOfClock.setDescription('The number of seconds during which the transmitter was experiencing Loss Of Clock.') j2RxRemoteAIS = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2RxRemoteAIS.setStatus('current') if mibBuilder.loadTexts: j2RxRemoteAIS.setDescription('The number of seconds during which the receiver observed the Alarm Indication Signal in the m-bits channel.') j2RxLossOfSignal = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 1, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2RxLossOfSignal.setStatus('current') if mibBuilder.loadTexts: j2RxLossOfSignal.setDescription('The number of seconds during which the transmitter was experien cing Loss Of Signal.') j2AtmTable = MibTable((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 2), ) if mibBuilder.loadTexts: j2AtmTable.setStatus('current') if mibBuilder.loadTexts: j2AtmTable.setDescription('A table of J2 ATM statistics information.') j2AtmEntry = MibTableRow((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 2, 1), ).setIndexNames((0, "Fore-J2-MIB", "j2AtmBoard"), (0, "Fore-J2-MIB", "j2AtmModule"), (0, "Fore-J2-MIB", "j2AtmPort")) if mibBuilder.loadTexts: j2AtmEntry.setStatus('current') if mibBuilder.loadTexts: j2AtmEntry.setDescription('A table entry containing J2 ATM statistics information.') j2AtmBoard = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 2, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2AtmBoard.setStatus('current') if mibBuilder.loadTexts: j2AtmBoard.setDescription("The index of this port's switch board.") j2AtmModule = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2AtmModule.setStatus('current') if mibBuilder.loadTexts: j2AtmModule.setDescription('The network module of this port.') j2AtmPort = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 2, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2AtmPort.setStatus('current') if mibBuilder.loadTexts: j2AtmPort.setDescription('The number of this port.') j2AtmHCSs = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 2, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2AtmHCSs.setStatus('current') if mibBuilder.loadTexts: j2AtmHCSs.setDescription('Number of header check sequence (HCS) error events. The HCS is a CRC-8 calculation over the first 4 octets of the ATM cell header.') j2AtmRxCells = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 2, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2AtmRxCells.setStatus('current') if mibBuilder.loadTexts: j2AtmRxCells.setDescription('Number of ATM cells that were received.') j2AtmTxCells = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 2, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2AtmTxCells.setStatus('current') if mibBuilder.loadTexts: j2AtmTxCells.setDescription('Number of non-null ATM cells that were transmitted.') j2AtmLCDs = MibTableColumn((1, 3, 6, 1, 4, 1, 326, 2, 2, 1, 1, 6, 2, 2, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: j2AtmLCDs.setStatus('current') if mibBuilder.loadTexts: j2AtmLCDs.setDescription('The number of seconds in which Loss of Cell Delineation (LCD) has occurred. An LCD defect is detected when an out of cell delination state has persisted for 4ms. An LCD defect is cleared when the sync state has been maintained for 4ms.') mibBuilder.exportSymbols("Fore-J2-MIB", j2RxAIS=j2RxAIS, j2RxRemoteAIS=j2RxRemoteAIS, j2AtmRxCells=j2AtmRxCells, j2FramingErrors=j2FramingErrors, j2LineStatus=j2LineStatus, j2RxLossOfClock=j2RxLossOfClock, j2LineLength=j2LineLength, j2LoopbackConfig=j2LoopbackConfig, j2AtmEntry=j2AtmEntry, j2IdleUnassignedCells=j2IdleUnassignedCells, PYSNMP_MODULE_ID=foreJ2, j2ErrorPort=j2ErrorPort, j2AtmModule=j2AtmModule, j2AtmTxCells=j2AtmTxCells, j2ErrorBoard=j2ErrorBoard, j2ConfModule=j2ConfModule, j2ConfEntry=j2ConfEntry, j2AtmBoard=j2AtmBoard, j2ConfTable=j2ConfTable, foreJ2=foreJ2, j2ErrorModule=j2ErrorModule, j2ConfGroup=j2ConfGroup, j2AtmLCDs=j2AtmLCDs, j2RxLossOfFrame=j2RxLossOfFrame, j2B8ZSCodingErrors=j2B8ZSCodingErrors, j2ConfBoard=j2ConfBoard, j2ConfPort=j2ConfPort, j2AtmPort=j2AtmPort, j2TxClockSource=j2TxClockSource, j2ErrorTable=j2ErrorTable, j2StatsGroup=j2StatsGroup, j2RxLossOfSignal=j2RxLossOfSignal, j2CRC5Errors=j2CRC5Errors, j2AtmHCSs=j2AtmHCSs, j2AtmTable=j2AtmTable, j2TxLossOfClock=j2TxLossOfClock, j2ErrorEntry=j2ErrorEntry)
n = int(input()) lado = 2 for i in range(n): lado = 2*lado-1 print(lado*lado)
class SequentialSearchST(): first = None class Node(): def __init__(self, key, val, next): self.key = key self.val = val self.next = next def get(self, key): x = self.first while x is not None: if key == x.key: return x.val x = x.next return None def put(self, key, val): x = self.first while x is not None: if key == x.key: x.val = val return self.first = Node(key, val, self.first)
class Solution: def findNumberIn2DArray(self, matrix, target: int) -> bool: if not matrix: return False n,m=len(matrix),len(matrix[0]) if m==0: return False row,col=0,m-1 while 1: print(row,col) cur=matrix[row][col] # print(cur,target) if target== cur: return True if target<cur: col-=1 else: row+=1 if row>=n or col<0: break return False print(Solution().findNumberIn2DArray([[-1,3]],-1))
class StackCollection: def __init__(self, client=None, data=None): super(StackCollection, self).__init__() if data is None: paginator = client.get_paginator('describe_stacks') results = paginator.paginate() self.list = list() for result in results: stacks = result['Stacks'] for stack in stacks: self.list.append(stack) else: self.list = list(data) def __len__(self): return len(self.list) def __getitem__(self, ii): return self.list[ii] def __delitem__(self, ii): del self.list[ii] def __setitem__(self, ii, val): self.list[ii] = val def __str__(self): return str(self.list) def insert(self, ii, val): self.list.insert(ii, val) def reverse(self): return self[::-1] def filter_by(self, func): filtered = [stack for stack in self.list if func(stack)] return StackCollection(data=filtered) @staticmethod def has_prefix(stack_prefix, stack): for tag in stack.get('Tags', []): if tag['Key'] == 'Name' and tag.get( 'Value', "").startswith(stack_prefix): return True return False @staticmethod def is_cf_stack(stack): for tag in stack.get('Tags', []): if tag['Key'] == 'tool' and tag['Value'] == 'cluster_funk': return True return False @staticmethod def has_env(env, stack): for tag in stack.get('Tags', []): if tag['Key'] == 'environment' and tag['Value'] == env: return True return False def output_dict(self): result = {} for stack in self: for output in stack.get("Outputs", []): result[output.get("OutputKey", "")] = output["OutputValue"] return result
""" import a import a.b import a.B (and is the cross thing) import a.* import a.b as c from a import b, c import a, b from _ import * """ # objects see their own vars # function args are seen ((x)->x)(2) # import bogus # errors # bogus -> NameError """ del list[index] del x del dict[key] delete object.member, which removes member as a key from object only related to: dynamics dicts reloading modules gc or c++ memory management kind of the opposite of declare tbh """ # module.copy() # in # a ast wrapper AST Stack CodeStack # term expr # tests: # code imports, CODE does not # i'd love a reimport func # INSPECT: # i should be able to see vars of a thing # scope_stack[-1] # inspect # cancel import if errors? # import a as b, c as d # from a import b # import a.* # error on * * # allow **? dunno # cannot declare in object - artificial scope # test method in class # test fake module declaration through ins and qualnames # test closure # can't set this # getattr errors from importing # importing with errors does not set the name
# author: Allyson Vasquez # version: May.14.2020 # Practice using functions & lists # https://www.w3resource.com/python-exercises/python-functions-exercises.php # Find the max of three numbers def max(x,y,z): if x > y or x == y: num1 = x else: num1 = y if num1 > z or num1 == z: max_num = num1 else: max_num = z return max_num # Sum all numbers in a list def sum(x): total = 0 for i in range(len(x)): total += x[i] return total # Calculate the factorial of a number def factorial(x): fac = 1 if x == 0: return 0 elif x == 1: return 1 while x > 0: fac *= x x -= 1 return fac # Check if a number is in a given range def inRange(x, min, max): if x in range(min, max): print(x, 'is in range between', min, max) else: print(x, 'is NOT range between', min, max) # Calculate number of upper/lowercase letters in a string def caseCount(x): upper = 0 lower = 0 for i in x: if i.isupper(): upper += 1 elif i.islower(): lower += 1 print('String inputted:', x) print('\tUppercase letters:', upper) print('\tLowercase letters:', lower) def main(): print('Max of 3 numbers:', max(112, 18, 43)) my_list = [32, 84, 12, 23, 62] print('Sum of numbers in a list:', sum(my_list)) print(factorial(10)) inRange(5, 1, 10) inRange(12, 31, 43) caseCount('My name is Allyson Vasquez') if __name__ == '__main__': main()
def ajuda(com, cor=0): print(c[cor], end='') help(com) print(c[0], end='') def titulo(msg, cor=0): tam = len(msg)+4 print(c[cor], end='') print('~' * tam) print(f' {msg}') print('~' * tam) print(c[0], end='') #pricipal c = ('\033[m', #sem cores '\033[0;30;41m', #vermelho '\033[32;40m', #verde '\033[30;43m', #branco fundo amarelo ) comando = '' while True: titulo('SISTEMA DE AJUDA PyHELP', 1) comando = str(input('Função ou biblioteca > ')) if comando.upper() == "FIM": break else: ajuda(comando, 3) titulo('ATÉ LOGO!!', 2)
# pylint: disable=missing-docstring __title__ = "estraven" __summary__ = "An opinionated YAML formatter for Ansible playbooks" __version__ = "0.0.0" __url__ = "https://github.com/enpaul/estraven/" __license__ = "MIT" __authors__ = ["Ethan Paul <24588726+enpaul@users.noreply.github.com>"]
""" 0034. Find First and Last Position of Element in Sorted Array Medium Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1]. Follow up: Could you write an algorithm with O(log n) runtime complexity? Example 1: Input: nums = [5,7,7,8,8,10], target = 8 Output: [3,4] Example 2: Input: nums = [5,7,7,8,8,10], target = 6 Output: [-1,-1] Example 3: Input: nums = [], target = 0 Output: [-1,-1] Constraints: 0 <= nums.length <= 105 -109 <= nums[i] <= 109 nums is a non-decreasing array. -109 <= target <= 109 """ class Solution: def searchRange(self, nums: List[int], target: int) -> List[int]: res = [-1, -1] cnt = 1 for idx, num in enumerate(nums): if num == target: if cnt == 1: res[0] = idx cnt = 2 if cnt == 2: res[1] = idx return res # O(logn) solution class Solution: def searchRange(self, nums: List[int], target: int) -> List[int]: def helper(num): lo, hi = 0, len(nums) while lo < hi: mid = (lo+hi)//2 if nums[mid] >= num: hi = mid else: lo = mid + 1 return lo idx = helper(target) return [idx, helper(target+1)-1] if target in nums[idx: idx+1] else [-1, -1]
def parallel_generator(generators, functors): """ :param generators: A list of k generators (initialized) repersenting files, file are sorted with respect to the functors. :param functors: A list of k functors (must be the same size as the generators), that return a comparable object (comaprable with < ). :output: Each yield returns the next equivalence class according to the sorting in a format of a k-list with None if the generator didn't have an object of that equivalence class. Each entry in the list is also a list of the objects in that equivalence class that the corresponding generator produced. For example output may look like this (where k = 3): [None,[object1], [object2, object3]] """ # Work buffer, lines that aren't in output yet reside here #current_lines = [generator.__next__() if generator is not None else None for generator in generators] current_lines = [] for generator in generators: try: line = next(generator) except StopIteration: line = None current_lines.append(line) if len(current_lines) == current_lines.count(None): return finished_files = 0 number_of_files = len(generators) # Boolean array for which generator finished listOfFinished = [0 for index in range(len(generators))] # Actual logic while (finished_files < number_of_files) : # As long as not all files ended current_intervals = [func(line) if line is not None else None for line, func in zip( current_lines, functors)] # Extracting (str,int) # Sort the intervals according to the (default) sorting of the given # object current_intervals_sorted = sorted( [interval for interval in current_intervals if interval is not None]) min_interval = current_intervals_sorted[0] # Minimum interval # Get all the indexes (in the original list) of the lines with the same # minimal equivalence class equivalence_class_indexes = [index for index in range( len(current_intervals)) if (current_intervals[index] == min_interval)] # Number of generators that generated in current eq. class num_gen_curr_eq_class = len(equivalence_class_indexes) # Init output list with Nones next_equivalence_class = [None] * len(generators) # Init lists for generators that outputed for i in equivalence_class_indexes: next_equivalence_class[i] = [] # For each generator check if he generated an object(line) in the equivalence class, # If it did add the object to the output list and try to add next line # until he stops generating from this eq. class (else it stays None) while(num_gen_curr_eq_class > 0): for i in equivalence_class_indexes: next_equivalence_class[i].append(current_lines[i]) try: current_lines[i] = next(generators[i]) new_interval = functors[i](current_lines[i]) except StopIteration: current_lines[i] = None equivalence_class_indexes.remove(i) num_gen_curr_eq_class -= 1 break if(new_interval > min_interval): equivalence_class_indexes.remove(i) num_gen_curr_eq_class -= 1 break yield next_equivalence_class # Yield the equivlanece class # Setting up lists for next iteration # For each generator that generated an outputted line, get his next # line for i in equivalence_class_indexes: try: current_lines[i] = next(generators[i]) except StopIteration: current_lines[i] = None # Check if any generator finished yielding eveyrthing for index in range(len(current_lines)): if current_lines[index] == None: # Meaning no more output if listOfFinished[index] == 0: # If not already finished finished_files += 1 listOfFinished[index] = 1 return # When all generators finished
def reg(n): j = 0 i = 2 while i**2<=n and j!=1: if n % i == 0: j = 1 else: i = i + 1 else: if j == 1: j = "Составное число" elif j == 0: j = "Простое число" return j n = int(input()) print(reg(n))
concept_detector_cfg = dict( quantile_threshold=0.99, with_bboxes=True, count_disjoint=True, ) target_layer = 'layer3.5'
method1 = [] method2 = [] with open("out.raw", "rb") as file: byteValue = file.read(2) while byteValue != b"": intValueOne = int.from_bytes(byteValue, "big", signed=True) intValueTwo = int.from_bytes(byteValue, "little", signed=True) method1.append(intValueOne) method2.append(intValueTwo) byteValue = file.read(2) for i in range(0, len(method1), 1000): print(f"method1: {method1[i]}") print(f"method1: {method1[len(method1)-1]}") print("\n") for i in range(0, len(method2), 1000): print(f"method2: {method2[i]}") print(f"method2: {method2[len(method2)-1]}")
# # PySNMP MIB module CISCO-TELEPRESENCE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-TELEPRESENCE-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:14:18 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, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint") ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt") InterfaceIndexOrZero, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndexOrZero") InetAddress, InetAddressType = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") NotificationType, ModuleIdentity, Bits, Gauge32, IpAddress, Integer32, Counter32, iso, ObjectIdentity, MibIdentifier, Unsigned32, TimeTicks, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "NotificationType", "ModuleIdentity", "Bits", "Gauge32", "IpAddress", "Integer32", "Counter32", "iso", "ObjectIdentity", "MibIdentifier", "Unsigned32", "TimeTicks", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TimeStamp, DisplayString, TruthValue, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "TimeStamp", "DisplayString", "TruthValue", "TextualConvention") ciscoTelepresenceMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 643)) ciscoTelepresenceMIB.setRevisions(('2014-07-18 00:00', '2012-07-17 00:00', '2012-03-23 00:00', '2011-08-23 00:00', '2010-07-23 00:00', '2010-07-13 00:00', '2009-07-12 00:00', '2008-02-13 00:00', '2007-12-11 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ciscoTelepresenceMIB.setRevisionsDescriptions(('Added ctpDPPeripheralStatusTable Table and added auxHDMIInputDevice(19) and bringYourOwnDevice(20) enum value in CtpPeripheralDeviceCategoryCode', 'Added detectionDisabled in CtpPeripheralStatusCode', 'Added ctpVlanId, ctpDefaultGateway and ctpDefaultGatewayAddrType in ctpObjects', 'Added uiDevice in CtpPeripheralDeviceCategoryCode', 'Added ctpUSBPeripheralStatusTable and ctpWIFIPeripheralStatusTable in ctpPeripheralStatusEntry. ciscoTelepresenceComplianceR02 has been deprecated by ciscoTelepresenceComplianceR03. ciscoTpPeripheralStatusGroupR01 has been deprecated by ciscoTpPeripheralStatusGroupR02', 'Added ctpPeriStatusChangeNotifyEnable.', 'Added ctpPeripheralDeviceCategory and ctpPeripheralDeviceNumber in ctpPeripheralStatusEntry. Added commError in CtpPeripheralStatusCode. Updated the description of ctpPeripheralErrorHistoryTable.', 'Added serial peripheral status and peripheral attribute table.', 'Initial version of this MIB module.',)) if mibBuilder.loadTexts: ciscoTelepresenceMIB.setLastUpdated('201411240000Z') if mibBuilder.loadTexts: ciscoTelepresenceMIB.setOrganization('Cisco Systems, Inc.') if mibBuilder.loadTexts: ciscoTelepresenceMIB.setContactInfo('Cisco Systems Customer Service Postal: 170 W Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cochan@cisco.com') if mibBuilder.loadTexts: ciscoTelepresenceMIB.setDescription('The MIB module defines the managed objects for a Telepresence system. Telepresence refers to a set of technologies which allow a person to feel as if they were present, to give the appearance that they were present, or to have an effect, at a location other than their true location. A complete Telepresence system includes one or more Telepresence CODECS and peripherals such as display, camera, speaker, microphone and presentation device. Peripherals are attached directly to a Telepresence CODEC via an interface. Some peripherals may have more than one interface to transmit audio and/or video data and provide a configuration and/or control access.') class CtpSystemResetMode(TextualConvention, Integer32): description = 'This textual convention identifies the system reset mode. noRestart (1) -- No operation. restartPending (2) -- Restart a system without shutting down when there is no active call; otherwise, system will be restarted after the call is terminated. resetPending (3) -- Shut down a system and bring it back up if there is no active call; otherwise, system will be reset after the call is terminated. forceReset (4) -- Shut down a system and bring it back up no matter if there is an active call or not.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4)) namedValues = NamedValues(("noRestart", 1), ("restartPending", 2), ("resetPending", 3), ("forceReset", 4)) class CtpPeripheralCableCode(TextualConvention, Integer32): description = 'The textual convention identifies cable status of the attached peripheral through HDMI. plugged (1) -- Peripheral cable is plugged. loose (2) -- Peripheral cable is loose. unplugged (3) -- Peripheral cable is unplugged. unknown (4) -- Cannot detect peripheral cable status. internalError (5) -- Internal error.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5)) namedValues = NamedValues(("plugged", 1), ("loose", 2), ("unplugged", 3), ("unknown", 4), ("internalError", 5)) class CtpPeripheralPowerCode(TextualConvention, Integer32): description = 'The textual convention identifies power status of the attached peripheral through HDMI. on (1) -- Peripheral power is on. standby (2) -- Peripheral power is in standby mode. off (3) -- Peripheral power is off. unknown (4) -- Cannot detect peripheral power status. internalError (5) -- Internal error.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5)) namedValues = NamedValues(("on", 1), ("standby", 2), ("off", 3), ("unknown", 4), ("internalError", 5)) class CtpPeripheralStatusCode(TextualConvention, Integer32): description = 'The textual convention identifies the peripheral status. noError (0) -- Expected peripheral device is functioning through the attached port. other (1) -- None of the listed state. cableError (2) -- Expected peripheral device has cabling issue. powerError (3) -- Expected peripheral device has power issue. mgmtSysConfigError (4) -- Expected peripheral device has communications management system configuration issue. systemError (5) -- Telepresence system error. deviceError (6) -- Expected peripheral device is attached but not fully functional. linkError (7) -- Expected peripheral device has port level link issue. commError (8) -- Expected peripheral device has port level communication issue. detectionDisabled (9) -- Status detection has been disabled.' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) namedValues = NamedValues(("noError", 0), ("other", 1), ("cableError", 2), ("powerError", 3), ("mgmtSysConfigError", 4), ("systemError", 5), ("deviceError", 6), ("linkError", 7), ("commError", 8), ("detectionDisabled", 9)) class CtpSystemAccessProtocol(TextualConvention, Integer32): description = 'The textual convention identifies supported Telepresence user access protocol. http (1) -- Hypertext Transfer Protocol (HTTP) snmp (2) -- Simple Network Management Protocol (SNMP) ssh (3) -- Secure Shell (SSH)' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("http", 1), ("snmp", 2), ("ssh", 3)) class CtpPeripheralDeviceCategoryCode(TextualConvention, Integer32): description = 'The textual convention identifies the peripheral type. unknown (0) -- Unknown Device other (1) -- None of the listed device uplinkDevice (2) -- Device attached to CTS uplink port ipPhone (3) -- IP phone camera (4) -- Camera display (5) -- Display secCodec (6) -- CTS secondary codec docCamera (7) -- Document camera projector (8) -- Projector dviDevice (9) -- Device attached to DVI port presentationCodec (10) -- CTS codec process presentation -- stream auxiliaryControlUnit (11) -- Auxiliary control unit audioExpansionUnit (12) -- Audio expansion unit microphone (13) -- Microphone headset (14) -- Headset positionMic (15) -- Position microphone digitalMediaSystem (16) -- Digitial Media System auxHDMIOuputDevice (17) -- Auxiliary HDMI output device uiDevice (18) -- User Interface device for CTS auxHDMIInputDevice (19) -- HDMI input enabled device bringYourOwnDevice (20) -- Bring Your Own Device, -- like PC,Laptop,Tablet etc' status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)) namedValues = NamedValues(("unknown", 0), ("other", 1), ("uplinkDevice", 2), ("ipPhone", 3), ("camera", 4), ("display", 5), ("secCodec", 6), ("docCamera", 7), ("projector", 8), ("dviDevice", 9), ("presentationCodec", 10), ("auxiliaryControlUnit", 11), ("audioExpansionUnit", 12), ("microphone", 13), ("headset", 14), ("positionMic", 15), ("digitialMediaSystem", 16), ("auxHDMIOutputDevice", 17), ("uiDevice", 18), ("auxHDMIInputDevice", 19), ("bringYourOwnDevice", 20)) ciscoTelepresenceMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 643, 0)) ciscoTelepresenceMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 643, 1)) ciscoTelepresenceMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 643, 2)) ctpObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 1)) ctpPeripheralStatusObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2)) ctpEventHistory = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3)) ctpPeripheralErrorNotifyEnable = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ctpPeripheralErrorNotifyEnable.setStatus('deprecated') if mibBuilder.loadTexts: ctpPeripheralErrorNotifyEnable.setDescription("This object controls generation of ctpPeripheralErrorNotification. When the object is 'true(1)', generation of ctpPeripheralErrorNotification is enabled. When the object is 'false(2)', generation of ctpPeripheralErrorNotification is disabled. ctpPeripheralErrorNotifyEnable object is superseded by ctpPeriStatusChangeNotifyEnable.") ctpSysUserAuthFailNotifyEnable = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 1, 2), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ctpSysUserAuthFailNotifyEnable.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailNotifyEnable.setDescription("This object controls generation of ctpSysUserAuthFailNotification. When the object is 'true(1)', generation of ctpSysUserAuthFailNotification is enabled. When the object is 'false(2)', generation of ctpSysUserAuthFailNotification is disabled.") ctpSystemReset = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 1, 3), CtpSystemResetMode().clone('noRestart')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ctpSystemReset.setStatus('current') if mibBuilder.loadTexts: ctpSystemReset.setDescription('This object is used to reset or restart a Telepresence system.') ctpPeriStatusChangeNotifyEnable = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 1, 4), TruthValue().clone('false')).setMaxAccess("readwrite") if mibBuilder.loadTexts: ctpPeriStatusChangeNotifyEnable.setStatus('current') if mibBuilder.loadTexts: ctpPeriStatusChangeNotifyEnable.setDescription("This object controls generation of ctpPeriStatusChangeNotification. When the object is 'true(1)', generation of ctpPeriStatusChangeNotification is enabled. When the object is 'false(2)', generation of ctpPeriStatusChangeNotification is disabled.") ctpVlanId = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 1, 5), Unsigned32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ctpVlanId.setStatus('current') if mibBuilder.loadTexts: ctpVlanId.setDescription('This object specifies the Telepresence system VLAN ID.') ctpDefaultGatewayAddrType = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 1, 6), InetAddressType()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ctpDefaultGatewayAddrType.setStatus('current') if mibBuilder.loadTexts: ctpDefaultGatewayAddrType.setDescription('This object specifies the type of address contained in the corresponding instance of ctpDefaultGateway.') ctpDefaultGateway = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 1, 7), InetAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: ctpDefaultGateway.setStatus('current') if mibBuilder.loadTexts: ctpDefaultGateway.setDescription('This object specifies the Telepresence system default gateway.') ctpPeripheralStatusTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 1), ) if mibBuilder.loadTexts: ctpPeripheralStatusTable.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralStatusTable.setDescription('The table contains system peripheral information. An entry in this table has a corresponding entry, INDEX-ed by the same value of ctpPeripheralIndex, in the table relevant to the type of interface: ctpEtherPeripheralStatusTable for Ethernet, ctpHDMIPeripheralStatusTable for HDMI or ctpDVIPeripheralStatusTable for DVI.') ctpPeripheralStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 1, 1), ).setIndexNames((0, "CISCO-TELEPRESENCE-MIB", "ctpPeripheralIndex")) if mibBuilder.loadTexts: ctpPeripheralStatusEntry.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralStatusEntry.setDescription('An entry contains information about one peripheral which is configured or detected by a Telepresence system.') ctpPeripheralIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 1, 1, 1), Unsigned32()) if mibBuilder.loadTexts: ctpPeripheralIndex.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralIndex.setDescription('This object specifies a unique index for a peripheral which is attached to a Telepresence system.') ctpPeripheralDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 1, 1, 2), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpPeripheralDescription.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralDescription.setDescription('This object specifies a description of the attached peripheral. Peripheral description may be the peripheral type, model and/or version information or a peripheral signal description.') ctpPeripheralStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 1, 1, 3), CtpPeripheralStatusCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpPeripheralStatus.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralStatus.setDescription('This object specifies a peripheral status.') ctpPeripheralDeviceCategory = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 1, 1, 4), CtpPeripheralDeviceCategoryCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpPeripheralDeviceCategory.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralDeviceCategory.setDescription('This object specifies a peripheral category of a device.') ctpPeripheralDeviceNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 1, 1, 5), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpPeripheralDeviceNumber.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralDeviceNumber.setDescription('This object specifies a device number for a peripheral. Device number is unique within the same peripheral device category.') ctpEtherPeripheralStatusTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 2), ) if mibBuilder.loadTexts: ctpEtherPeripheralStatusTable.setStatus('current') if mibBuilder.loadTexts: ctpEtherPeripheralStatusTable.setDescription('The table contains information about all peripherals connected to the system via Ethernet port.') ctpEtherPeripheralStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 2, 1), ).setIndexNames((0, "CISCO-TELEPRESENCE-MIB", "ctpPeripheralIndex"), (0, "CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralIndex")) if mibBuilder.loadTexts: ctpEtherPeripheralStatusEntry.setStatus('current') if mibBuilder.loadTexts: ctpEtherPeripheralStatusEntry.setDescription('An entry contains information about one peripheral attached to the Telepresence system via Ethernet.') ctpEtherPeripheralIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 2, 1, 1), Unsigned32()) if mibBuilder.loadTexts: ctpEtherPeripheralIndex.setStatus('current') if mibBuilder.loadTexts: ctpEtherPeripheralIndex.setDescription("This object specifies a unique number for a peripheral Ethernet interface. If no peripheral has more than one Ethernet interface, this object will have value '1'.") ctpEtherPeripheralIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 2, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpEtherPeripheralIfIndex.setStatus('current') if mibBuilder.loadTexts: ctpEtherPeripheralIfIndex.setDescription("The object specifies an index value that uniquely identifies the interface to which this entry is applicable. The interface identified by a particular value of this index is the same interface as identified by the same value of the IF-MIB's ifIndex. If this entry doesn't have corresponding ifIndex, then this value will have value '0'.") ctpEtherPeripheralAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 2, 1, 3), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpEtherPeripheralAddrType.setStatus('current') if mibBuilder.loadTexts: ctpEtherPeripheralAddrType.setDescription('This object specifies the type of address contained in the corresponding instance of ctpEtherPeripheralAddr.') ctpEtherPeripheralAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 2, 1, 4), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpEtherPeripheralAddr.setStatus('current') if mibBuilder.loadTexts: ctpEtherPeripheralAddr.setDescription('This object specifies the address of the attached peripheral in the format given by the corresponding instance of ctpEtherPeripheralAddrType.') ctpEtherPeripheralStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 2, 1, 5), CtpPeripheralStatusCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpEtherPeripheralStatus.setStatus('current') if mibBuilder.loadTexts: ctpEtherPeripheralStatus.setDescription('This object specifies attached peripheral status retrieved via Ethernet port.') ctpHDMIPeripheralStatusTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 3), ) if mibBuilder.loadTexts: ctpHDMIPeripheralStatusTable.setStatus('current') if mibBuilder.loadTexts: ctpHDMIPeripheralStatusTable.setDescription('The table contains information about all peripherals connected to the system via HDMI.') ctpHDMIPeripheralStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 3, 1), ).setIndexNames((0, "CISCO-TELEPRESENCE-MIB", "ctpPeripheralIndex"), (0, "CISCO-TELEPRESENCE-MIB", "ctpHDMIPeripheralIndex")) if mibBuilder.loadTexts: ctpHDMIPeripheralStatusEntry.setStatus('current') if mibBuilder.loadTexts: ctpHDMIPeripheralStatusEntry.setDescription('An entry contains information about one Telepresence HDMI peripheral.') ctpHDMIPeripheralIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 3, 1, 1), Unsigned32()) if mibBuilder.loadTexts: ctpHDMIPeripheralIndex.setStatus('current') if mibBuilder.loadTexts: ctpHDMIPeripheralIndex.setDescription("This object specifies a unique number for a peripheral HDMI. If no peripheral has more than one HDMI, this object will have value '1'.") ctpHDMIPeripheralCableStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 3, 1, 2), CtpPeripheralCableCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpHDMIPeripheralCableStatus.setStatus('current') if mibBuilder.loadTexts: ctpHDMIPeripheralCableStatus.setDescription("This object specifies cable status of an attached peripheral. This object is set to 'loose' if system detects cable is 'unplugged' but power is 'on'.") ctpHDMIPeripheralPowerStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 3, 1, 3), CtpPeripheralPowerCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpHDMIPeripheralPowerStatus.setStatus('current') if mibBuilder.loadTexts: ctpHDMIPeripheralPowerStatus.setDescription("This object specifies power status of an attached peripheral. This object is set to 'unknown' if system detects cable is 'unplugged'.") ctpDVIPeripheralStatusTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 4), ) if mibBuilder.loadTexts: ctpDVIPeripheralStatusTable.setStatus('current') if mibBuilder.loadTexts: ctpDVIPeripheralStatusTable.setDescription('The table contains information about all peripherals connected to the system via DVI.') ctpDVIPeripheralStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 4, 1), ).setIndexNames((0, "CISCO-TELEPRESENCE-MIB", "ctpPeripheralIndex"), (0, "CISCO-TELEPRESENCE-MIB", "ctpDVIPeripheralIndex")) if mibBuilder.loadTexts: ctpDVIPeripheralStatusEntry.setStatus('current') if mibBuilder.loadTexts: ctpDVIPeripheralStatusEntry.setDescription('An entry contains information about one peripheral attached to the Telepresence system via DVI.') ctpDVIPeripheralIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 4, 1, 1), Unsigned32()) if mibBuilder.loadTexts: ctpDVIPeripheralIndex.setStatus('current') if mibBuilder.loadTexts: ctpDVIPeripheralIndex.setDescription("This object specifies a unique number for a peripheral DVI. If no peripheral has more than one DVI, this object will have value '1'. Note that some Telepresence systems have no DVI port and some Telepresence systems have only one DVI port.") ctpDVIPeripheralCableStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 4, 1, 2), CtpPeripheralCableCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpDVIPeripheralCableStatus.setStatus('current') if mibBuilder.loadTexts: ctpDVIPeripheralCableStatus.setDescription('This object specifies attached device cable status reported by DVI.') ctpRS232PeripheralStatusTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 5), ) if mibBuilder.loadTexts: ctpRS232PeripheralStatusTable.setStatus('current') if mibBuilder.loadTexts: ctpRS232PeripheralStatusTable.setDescription('The table contains information about all peripherals connected to the system via RS-232.') ctpRS232PeripheralStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 5, 1), ).setIndexNames((0, "CISCO-TELEPRESENCE-MIB", "ctpPeripheralIndex"), (0, "CISCO-TELEPRESENCE-MIB", "ctpRS232PeripheralIndex")) if mibBuilder.loadTexts: ctpRS232PeripheralStatusEntry.setStatus('current') if mibBuilder.loadTexts: ctpRS232PeripheralStatusEntry.setDescription('An entry contains information about one peripheral attached to the Telepresence system via RS-232.') ctpRS232PeripheralIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 5, 1, 1), Unsigned32()) if mibBuilder.loadTexts: ctpRS232PeripheralIndex.setStatus('current') if mibBuilder.loadTexts: ctpRS232PeripheralIndex.setDescription("This object specifies a unique number for a peripheral RS-232. If no peripheral has more than one RS-232, this object will have value '1'. Note that some Telepresence systems have no RS-232 port.") ctpRS232PortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 5, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpRS232PortIndex.setStatus('current') if mibBuilder.loadTexts: ctpRS232PortIndex.setDescription("The object specifies an index value that uniquely identifies the RS-232 port to which this entry is applicable. Its value is the same as RS-232-MIB's rs232PortIndex for the port. If RS-232-MIB is not supported by the agent, then this value will have value '0'.") ctpRS232PeripheralConnStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("connected", 1), ("unknown", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpRS232PeripheralConnStatus.setStatus('current') if mibBuilder.loadTexts: ctpRS232PeripheralConnStatus.setDescription("This object specifies peripheral which is connected via RS232. When the object is 'connected(1)', peripheral connection via RS232 is working properly. When the object is 'unknown(2)', peripheral connection via RS232 is not working properly. It may due to device problem or connection problem.") ctpPeripheralAttributeTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 6), ) if mibBuilder.loadTexts: ctpPeripheralAttributeTable.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralAttributeTable.setDescription("The table contains information about attributes for the peripherals which are connected to the system. Peripheral attribute may specify peripheral's component information, for example, an entry may specify lifetime of a lamp on a presentation device.") ctpPeripheralAttributeEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 6, 1), ).setIndexNames((0, "CISCO-TELEPRESENCE-MIB", "ctpPeripheralIndex"), (0, "CISCO-TELEPRESENCE-MIB", "ctpPeripheralAttributeIndex")) if mibBuilder.loadTexts: ctpPeripheralAttributeEntry.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralAttributeEntry.setDescription('An entry contains information about one peripheral attribute related to the peripheral specified by ctpPeripheralIndex.') ctpPeripheralAttributeIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 6, 1, 1), Unsigned32()) if mibBuilder.loadTexts: ctpPeripheralAttributeIndex.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralAttributeIndex.setDescription("This object specifies a unique number for a peripheral attribute. If no peripheral has more than one attribute, this object will have value '1'.") ctpPeripheralAttributeDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 6, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("lampOperTime", 1), ("lampState", 2), ("powerSwitchState", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpPeripheralAttributeDescr.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralAttributeDescr.setDescription('This object specifies description of a attribute. The supported attributes are lampOperTime(1) -- indicate the lamp operating time of a peripheral lampState(2) -- indicate the lamp state powerSwitchState(3) -- indicate the power on/off state of a peripheral Note that not all peripheral contains all the supported attributes. Agent reports whatever is available.') ctpPeripheralAttributeValue = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 6, 1, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpPeripheralAttributeValue.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralAttributeValue.setDescription('This object specifies value of the attribute corresponding to ctpPeripheralAttributeDescr. The possible value of the supported attributes is listed as the following: Attribute Unit SYNTAX ----------------------------------------------------------- lampOperTime hours Unsigned32(0..4294967295) lampState INTEGER { on(1), off(2), failure(3), unknown(4) } powerSwitchState INTEGER { on(1), off(2), unknown(3) }') ctpUSBPeripheralStatusTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 7), ) if mibBuilder.loadTexts: ctpUSBPeripheralStatusTable.setStatus('current') if mibBuilder.loadTexts: ctpUSBPeripheralStatusTable.setDescription('This table contains information about all the peripherals connected to the system via USB.') ctpUSBPeripheralStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 7, 1), ).setIndexNames((0, "CISCO-TELEPRESENCE-MIB", "ctpPeripheralIndex"), (0, "CISCO-TELEPRESENCE-MIB", "ctpUSBPeripheralIndex")) if mibBuilder.loadTexts: ctpUSBPeripheralStatusEntry.setStatus('current') if mibBuilder.loadTexts: ctpUSBPeripheralStatusEntry.setDescription('An entry drescribes a peripheral connected to the Telepresence system through USB.') ctpUSBPeripheralIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 7, 1, 1), Unsigned32()) if mibBuilder.loadTexts: ctpUSBPeripheralIndex.setStatus('current') if mibBuilder.loadTexts: ctpUSBPeripheralIndex.setDescription('This object indicates an arbitrary positive, integer-value that uniquely identifies the USB peripheral.') ctpUSBPeripheralCableStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 7, 1, 2), CtpPeripheralCableCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpUSBPeripheralCableStatus.setStatus('current') if mibBuilder.loadTexts: ctpUSBPeripheralCableStatus.setDescription('This object indicates the status of the cable attaching the USB peripheral.') ctpUSBPeripheralPowerStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 7, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown", 1), ("self", 2), ("bus", 3), ("both", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpUSBPeripheralPowerStatus.setStatus('current') if mibBuilder.loadTexts: ctpUSBPeripheralPowerStatus.setDescription("This object indicates the source of power for the attached USB peripheral: 'unknown' - The source of power is unknown. 'self' - The USB peripheral is externally powered. 'bus' - The USB peripheral is powered by the USB bus. 'both' - The USB peripheral can be powered by both the USB bus or self") ctpUSBPeripheralPortType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 7, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("host", 1), ("device", 2), ("hub", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpUSBPeripheralPortType.setStatus('current') if mibBuilder.loadTexts: ctpUSBPeripheralPortType.setDescription("This object indicates the type of device connected to the USB port: 'host' - no device os connected to the port 'device' - a usb device is connected to the port 'hub' - a usb hub is connected to the port") ctpUSBPeripheralPortRate = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 7, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("low", 1), ("full", 2), ("high", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpUSBPeripheralPortRate.setStatus('current') if mibBuilder.loadTexts: ctpUSBPeripheralPortRate.setDescription("This object indicates the current operational rate of the USB peripheral: 'unknown' - The USB port rate is unknown 'low' - The USB port rate is at 1.5 Mbps. 'full' - The USB port rate is at 12 Mbps. 'high' - The USB port rate is at 480 Mbps.") ctp802dot11PeripheralStatusTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 8), ) if mibBuilder.loadTexts: ctp802dot11PeripheralStatusTable.setStatus('current') if mibBuilder.loadTexts: ctp802dot11PeripheralStatusTable.setDescription('The table contains information about all peripherals connected to the system via 802dot11.') ctp802dot11PeripheralStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 8, 1), ).setIndexNames((0, "CISCO-TELEPRESENCE-MIB", "ctpPeripheralIndex"), (0, "CISCO-TELEPRESENCE-MIB", "ctp802dot11PeripheralIndex")) if mibBuilder.loadTexts: ctp802dot11PeripheralStatusEntry.setStatus('current') if mibBuilder.loadTexts: ctp802dot11PeripheralStatusEntry.setDescription('An entry describes one Telepresence 802dot11 peripheral.') ctp802dot11PeripheralIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 8, 1, 1), Unsigned32()) if mibBuilder.loadTexts: ctp802dot11PeripheralIndex.setStatus('current') if mibBuilder.loadTexts: ctp802dot11PeripheralIndex.setDescription('This object indicates an arbitrary positive, integer-value that uniquely identifies the IEEE 802.11 peripheral.') ctp802dot11PeripheralIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 8, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctp802dot11PeripheralIfIndex.setStatus('current') if mibBuilder.loadTexts: ctp802dot11PeripheralIfIndex.setDescription("This object indicates an index value that uniquely identifies the interface to which this entry is applicable. If this entry doesn't have corresponding ifIndex, then this value will have value '0'.") ctp802dot11PeripheralAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 8, 1, 3), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctp802dot11PeripheralAddrType.setStatus('current') if mibBuilder.loadTexts: ctp802dot11PeripheralAddrType.setDescription('This object indicates the type of address indicated by the corresponding instance of ctp802dot11PeripheralAddr.') ctp802dot11PeripheralAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 8, 1, 4), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctp802dot11PeripheralAddr.setStatus('current') if mibBuilder.loadTexts: ctp802dot11PeripheralAddr.setDescription('This object indicates the address of the attached peripheral in the format indicated by the corresponding instance of ctp802dot11PeripheralAddrType.') ctp802dot11PeripheralLinkStrength = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 8, 1, 5), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctp802dot11PeripheralLinkStrength.setStatus('current') if mibBuilder.loadTexts: ctp802dot11PeripheralLinkStrength.setDescription('This object indicates the link strength of an IEEE 802.11 link for a peripheral. A return value of 0 indicates the link is not connected. A return value between 1 - 5 indicates the strength of the link, with 1 being the weakest and 5 being the strongest.') ctp802dot11PeripheralLinkStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 8, 1, 6), CtpPeripheralCableCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctp802dot11PeripheralLinkStatus.setStatus('current') if mibBuilder.loadTexts: ctp802dot11PeripheralLinkStatus.setDescription('This object indicates the link status of the attached peripheral via IEEE 802.11 link.') ctpDPPeripheralStatusTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 9), ) if mibBuilder.loadTexts: ctpDPPeripheralStatusTable.setStatus('current') if mibBuilder.loadTexts: ctpDPPeripheralStatusTable.setDescription('The table contains information about all peripherals connected to the system via DP.') ctpDPPeripheralStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 9, 1), ).setIndexNames((0, "CISCO-TELEPRESENCE-MIB", "ctpPeripheralIndex"), (0, "CISCO-TELEPRESENCE-MIB", "ctpDPPeripheralIndex")) if mibBuilder.loadTexts: ctpDPPeripheralStatusEntry.setStatus('current') if mibBuilder.loadTexts: ctpDPPeripheralStatusEntry.setDescription('An entry contains information about one Telepresence DP peripheral.') ctpDPPeripheralIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 9, 1, 1), Unsigned32()) if mibBuilder.loadTexts: ctpDPPeripheralIndex.setStatus('current') if mibBuilder.loadTexts: ctpDPPeripheralIndex.setDescription("This object indicates a unique number for a peripheral DP. If no peripheral has more than one DP, this object will have value '1'.") ctpDPPeripheralCableStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 9, 1, 2), CtpPeripheralCableCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpDPPeripheralCableStatus.setStatus('current') if mibBuilder.loadTexts: ctpDPPeripheralCableStatus.setDescription("This object indicates the cable status of a peripheral which is attached to the system via Display Port interface. This object returns 'loose' if system detects cable is 'unplugged' but power is 'on'.") ctpDPPeripheralPowerStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 2, 9, 1, 3), CtpPeripheralPowerCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpDPPeripheralPowerStatus.setStatus('current') if mibBuilder.loadTexts: ctpDPPeripheralPowerStatus.setDescription("This object indicates the power status of a peripheral which is attached to the system via Display Port interface. This object returns 'unknown' if system detects cable is 'unplugged'.") ctpPeripheralErrorHistTableSize = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 500)).clone(10)).setMaxAccess("readwrite") if mibBuilder.loadTexts: ctpPeripheralErrorHistTableSize.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralErrorHistTableSize.setDescription("This object specifies the maximum number of entries that the ctpPeripheralErrorHistTable can contain. When the capacity of the ctpPeripheralErrorHistTable has reached the value specified by this object, then the agent deletes the oldest entity in order to accommodate the new entry. A value of '0' prevents any history from being retained. Some agents restrict the value of this object to be less than 500.") ctpPeripheralErrorHistLastIndex = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpPeripheralErrorHistLastIndex.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralErrorHistLastIndex.setDescription('This object specifies the value of the ctpPeripheralErrorHistIndex object corresponding to the last entry added to the table by the agent. If the management application uses the notifications defined by this module, then it can poll this object to determine whether it has missed a notification sent by the agent.') ctpPeripheralErrorHistoryTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 3), ) if mibBuilder.loadTexts: ctpPeripheralErrorHistoryTable.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralErrorHistoryTable.setDescription('This table contains a history of the detected peripheral status changes. After a management agent restart, when sysUpTime is reset to zero, this table records all notifications until such time as it becomes full. Thereafter, it remains full by retaining the number of most recent notifications specified in ctpPeripheralErrorHistTableSize.') ctpPeripheralErrorHistoryEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 3, 1), ).setIndexNames((0, "CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorHistoryIndex")) if mibBuilder.loadTexts: ctpPeripheralErrorHistoryEntry.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralErrorHistoryEntry.setDescription('An entry contains information about a Telepresence peripheral status changes.') ctpPeripheralErrorHistoryIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 3, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: ctpPeripheralErrorHistoryIndex.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralErrorHistoryIndex.setDescription("A unique non-zero integer value that identifies a CtpPeripheralErrorHistoryEntry in the table. The value of this index starts from '1' and monotonically increases for each peripheral error known to the agent. If the value of this object is '4294967295', the agent will use '1' as the value of the next detected peripheral status change.") ctpPeripheralErrorIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 3, 1, 2), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpPeripheralErrorIndex.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralErrorIndex.setDescription('The object specifies the value of ctpPeripheralIndex of a peripheral which is in error state. This object is deprecated in favor of ctpPeripheralErrorDeviceCategory and ctpPeripheralErrorDeviceNumber.') ctpPeripheralErrorStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 3, 1, 3), CtpPeripheralStatusCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpPeripheralErrorStatus.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralErrorStatus.setDescription('This object specifies the peripheral status after its status changed.') ctpPeripheralErrorTimeStamp = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 3, 1, 4), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpPeripheralErrorTimeStamp.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralErrorTimeStamp.setDescription('This object specifies the value of the sysUpTime object at the time the notification was generated.') ctpPeripheralErrorDeviceCategory = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 3, 1, 5), CtpPeripheralDeviceCategoryCode()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpPeripheralErrorDeviceCategory.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralErrorDeviceCategory.setDescription('The object specifies peripheral device category after its status changed.') ctpPeripheralErrorDeviceNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 3, 1, 6), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpPeripheralErrorDeviceNumber.setStatus('current') if mibBuilder.loadTexts: ctpPeripheralErrorDeviceNumber.setDescription('The object specifies peripheral device number after its status changed. Device number is unique within the same peripheral device category.') ctpSysUserAuthFailHistTableSize = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 500)).clone(10)).setMaxAccess("readwrite") if mibBuilder.loadTexts: ctpSysUserAuthFailHistTableSize.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailHistTableSize.setDescription("This object specifies the number of entries that the ctpSysUserAuthFailHistTable can contain. When the capacity of the ctpSysUserAuthFailHistTable has reached the value specified by this object, then the agent deletes the oldest entity in order to accommodate the new entry. A value of '0' prevents any history from being retained. Some agents restrict the value of this object to be less than 500.") ctpSysUserAuthFailHistLastIndex = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpSysUserAuthFailHistLastIndex.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailHistLastIndex.setDescription('This object specifies the value of the ctpSysUserAuthFailHistIndex object corresponding to the last entry added to the table by the agent. If the management application uses the notifications defined by this module, then it can poll this object to determine whether it has missed a notification sent by the agent.') ctpSysUserAuthFailHistoryTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 6), ) if mibBuilder.loadTexts: ctpSysUserAuthFailHistoryTable.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailHistoryTable.setDescription('This table contains a history of detected user authentication failures. After a management agent restart, when sysUpTime is reset to zero, this table records all user authentication failure notifications until such time as it becomes full. Thereafter, it remains full by retaining the number of most recent notifications specified in ctpSysUserAuthFailHistTableSize.') ctpSysUserAuthFailHistoryEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 6, 1), ).setIndexNames((0, "CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailHistoryIndex")) if mibBuilder.loadTexts: ctpSysUserAuthFailHistoryEntry.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailHistoryEntry.setDescription('An entry contains information about a Telepresence system user authentication failure.') ctpSysUserAuthFailHistoryIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 6, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: ctpSysUserAuthFailHistoryIndex.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailHistoryIndex.setDescription("A unique non-zero integer value that identifies a CtpSysUserAuthFailHistoryEntry in the table. The value of this index starts from '1' and monotonically increases for each system authentication failure event known to the agent. If the value of this object is '4294967295', the agent will use '1' as the value of the next user authentication failure event.") ctpSysUserAuthFailSourceAddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 6, 1, 2), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpSysUserAuthFailSourceAddrType.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailSourceAddrType.setDescription('The object specifies the type of address contained in the corresponding instance of ctpSysUserAuthFailSourceAddr.') ctpSysUserAuthFailSourceAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 6, 1, 3), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpSysUserAuthFailSourceAddr.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailSourceAddr.setDescription('The object specifies the source address when the user authentication failure occurred, in the format given by the corresponding instance of ctpSysUserAuthFailSourceAddrType.') ctpSysUserAuthFailSourcePort = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 6, 1, 4), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpSysUserAuthFailSourcePort.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailSourcePort.setDescription('The object specifies the source TCP/UDP port number when a user authentication failure occurred.') ctpSysUserAuthFailUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 6, 1, 5), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpSysUserAuthFailUserName.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailUserName.setDescription('The object specifies the user name which was used to gain system access when authentication failure occurred.') ctpSysUserAuthFailAccessProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 6, 1, 6), CtpSystemAccessProtocol()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpSysUserAuthFailAccessProtocol.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailAccessProtocol.setDescription('This object specifies the access protocol when a user authentication failure occurred.') ctpSysUserAuthFailTimeStamp = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 643, 1, 3, 6, 1, 7), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: ctpSysUserAuthFailTimeStamp.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailTimeStamp.setDescription('This object specifies the value of the sysUpTime object at the time the notification was generated.') ctpPeripheralErrorNotification = NotificationType((1, 3, 6, 1, 4, 1, 9, 9, 643, 0, 1)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorIndex"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorStatus")) if mibBuilder.loadTexts: ctpPeripheralErrorNotification.setStatus('deprecated') if mibBuilder.loadTexts: ctpPeripheralErrorNotification.setDescription('This notification is sent when a peripheral error is detected. This notification is deprecated in favor of ctpPeriStatusChangeNotification. ctpPeripheralErrorNotification object is superseded by ctpPeriStatusChangeNotification.') ctpSysUserAuthFailNotification = NotificationType((1, 3, 6, 1, 4, 1, 9, 9, 643, 0, 2)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailSourceAddrType"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailSourceAddr"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailSourcePort"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailUserName"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailAccessProtocol")) if mibBuilder.loadTexts: ctpSysUserAuthFailNotification.setStatus('current') if mibBuilder.loadTexts: ctpSysUserAuthFailNotification.setDescription('This notification is sent when a user authentication failure via a Telepresence supported access protocol is detected.') ctpPeriStatusChangeNotification = NotificationType((1, 3, 6, 1, 4, 1, 9, 9, 643, 0, 3)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorIndex"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorDeviceCategory"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorDeviceNumber"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorStatus")) if mibBuilder.loadTexts: ctpPeriStatusChangeNotification.setStatus('current') if mibBuilder.loadTexts: ctpPeriStatusChangeNotification.setDescription('This notification is sent when a peripheral status is changed.') ciscoTelepresenceCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 1)) ciscoTelepresenceMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2)) ciscoTelepresenceCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 1, 1)).setObjects(("CISCO-TELEPRESENCE-MIB", "ciscoTpConfigurationGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpPeripheralStatusGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpEventHistoryGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpNotificationGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTelepresenceCompliance = ciscoTelepresenceCompliance.setStatus('deprecated') if mibBuilder.loadTexts: ciscoTelepresenceCompliance.setDescription('The compliance statement for entities which implement the Cisco Telepresence MIB.') ciscoTelepresenceComplianceR01 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 1, 2)).setObjects(("CISCO-TELEPRESENCE-MIB", "ciscoTpConfigurationGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpPeripheralStatusGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpEventHistoryGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpNotificationGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpRS232PeripheralStatusGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpPeripheralAttributeGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTelepresenceComplianceR01 = ciscoTelepresenceComplianceR01.setStatus('deprecated') if mibBuilder.loadTexts: ciscoTelepresenceComplianceR01.setDescription('The compliance statement for entities which implement the Cisco Telepresence MIB.') ciscoTelepresenceComplianceR02 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 1, 3)).setObjects(("CISCO-TELEPRESENCE-MIB", "ciscoTpConfigurationGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpPeripheralStatusGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpEventHistoryGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpNotificationGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpRS232PeripheralStatusGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpPeripheralAttributeGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTelepresenceComplianceR02 = ciscoTelepresenceComplianceR02.setStatus('deprecated') if mibBuilder.loadTexts: ciscoTelepresenceComplianceR02.setDescription('The compliance statement for entities which implement the Cisco Telepresence MIB.') ciscoTelepresenceComplianceR03 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 1, 4)).setObjects(("CISCO-TELEPRESENCE-MIB", "ciscoTpConfigurationGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpPeripheralStatusGroupR02"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpEventHistoryGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpNotificationGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpRS232PeripheralStatusGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpPeripheralAttributeGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTelepresenceComplianceR03 = ciscoTelepresenceComplianceR03.setStatus('deprecated') if mibBuilder.loadTexts: ciscoTelepresenceComplianceR03.setDescription('The compliance statement for entities which implement the Cisco Telepresence MIB.') ciscoTelepresenceComplianceR04 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 1, 5)).setObjects(("CISCO-TELEPRESENCE-MIB", "ciscoTpConfigurationGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpConfigurationGroupR02"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpPeripheralStatusGroupR02"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpEventHistoryGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpNotificationGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpRS232PeripheralStatusGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpPeripheralAttributeGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTelepresenceComplianceR04 = ciscoTelepresenceComplianceR04.setStatus('deprecated') if mibBuilder.loadTexts: ciscoTelepresenceComplianceR04.setDescription('The compliance statement for entities which implement the Cisco Telepresence MIB.') ciscoTelepresenceComplianceR05 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 1, 6)).setObjects(("CISCO-TELEPRESENCE-MIB", "ciscoTpConfigurationGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpConfigurationGroupR02"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpPeripheralStatusGroupR02"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpEventHistoryGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpNotificationGroupR01"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpDPPeripheralStatusGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpRS232PeripheralStatusGroup"), ("CISCO-TELEPRESENCE-MIB", "ciscoTpPeripheralAttributeGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTelepresenceComplianceR05 = ciscoTelepresenceComplianceR05.setStatus('current') if mibBuilder.loadTexts: ciscoTelepresenceComplianceR05.setDescription('The compliance statement for entities which implement the Cisco Telepresence MIB.') ciscoTpConfigurationGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 1)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorNotifyEnable"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailNotifyEnable"), ("CISCO-TELEPRESENCE-MIB", "ctpSystemReset")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpConfigurationGroup = ciscoTpConfigurationGroup.setStatus('deprecated') if mibBuilder.loadTexts: ciscoTpConfigurationGroup.setDescription('A collection of objects providing the notification configuration and system reset. ciscoTpConfigurationGroup object is superseded by ciscoTpConfigurationGroupR01.') ciscoTpPeripheralStatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 2)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpPeripheralDescription"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralIfIndex"), ("CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralAddrType"), ("CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralAddr"), ("CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpHDMIPeripheralCableStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpHDMIPeripheralPowerStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpDVIPeripheralCableStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpPeripheralStatusGroup = ciscoTpPeripheralStatusGroup.setStatus('deprecated') if mibBuilder.loadTexts: ciscoTpPeripheralStatusGroup.setDescription('A collection of objects providing the Telepresence peripheral information. ciscoTpPeripheralStatusGroup object is superseded by ciscoTpPeripheralStatusGroupR01.') ciscoTpEventHistoryGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 3)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorHistTableSize"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorHistLastIndex"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorIndex"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorTimeStamp"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailHistTableSize"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailHistLastIndex"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailSourceAddrType"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailSourceAddr"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailSourcePort"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailUserName"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailAccessProtocol"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailTimeStamp")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpEventHistoryGroup = ciscoTpEventHistoryGroup.setStatus('deprecated') if mibBuilder.loadTexts: ciscoTpEventHistoryGroup.setDescription('A collection of managed objects providing notification event history information. ciscoTpEventHistoryGroup object is superseded by ciscoTpEventHistoryGroupR01.') ciscoTpNotificationGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 4)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorNotification"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailNotification")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpNotificationGroup = ciscoTpNotificationGroup.setStatus('deprecated') if mibBuilder.loadTexts: ciscoTpNotificationGroup.setDescription('A collection of Telepresence system notifications. ciscoTpNotificationGroup object is superseded by ciscoTpNotificationGroupR01.') ciscoTpRS232PeripheralStatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 5)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpRS232PortIndex"), ("CISCO-TELEPRESENCE-MIB", "ctpRS232PeripheralConnStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpRS232PeripheralStatusGroup = ciscoTpRS232PeripheralStatusGroup.setStatus('current') if mibBuilder.loadTexts: ciscoTpRS232PeripheralStatusGroup.setDescription('A collection of objects providing the information about Telepresence peripheral which is connected via RS232.') ciscoTpPeripheralAttributeGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 6)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpPeripheralAttributeDescr"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralAttributeValue")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpPeripheralAttributeGroup = ciscoTpPeripheralAttributeGroup.setStatus('current') if mibBuilder.loadTexts: ciscoTpPeripheralAttributeGroup.setDescription('A collection of managed objects providing peripheral attribute information.') ciscoTpPeripheralStatusGroupR01 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 7)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpPeripheralDescription"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralDeviceCategory"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralDeviceNumber"), ("CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralIfIndex"), ("CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralAddrType"), ("CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralAddr"), ("CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpHDMIPeripheralCableStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpHDMIPeripheralPowerStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpDVIPeripheralCableStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpPeripheralStatusGroupR01 = ciscoTpPeripheralStatusGroupR01.setStatus('deprecated') if mibBuilder.loadTexts: ciscoTpPeripheralStatusGroupR01.setDescription('A collection of objects providing the Telepresence peripheral information. ciscoTpPeripheralStatusGroupR01 object is superseded by ciscoTpPeripheralStatusGroupR02.') ciscoTpEventHistoryGroupR01 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 8)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorHistTableSize"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorHistLastIndex"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorIndex"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorTimeStamp"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorDeviceCategory"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralErrorDeviceNumber"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailHistTableSize"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailHistLastIndex"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailSourceAddrType"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailSourceAddr"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailSourcePort"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailUserName"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailAccessProtocol"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailTimeStamp")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpEventHistoryGroupR01 = ciscoTpEventHistoryGroupR01.setStatus('current') if mibBuilder.loadTexts: ciscoTpEventHistoryGroupR01.setDescription('A collection of managed objects providing notification event history information.') ciscoTpNotificationGroupR01 = NotificationGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 9)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpPeriStatusChangeNotification"), ("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailNotification")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpNotificationGroupR01 = ciscoTpNotificationGroupR01.setStatus('current') if mibBuilder.loadTexts: ciscoTpNotificationGroupR01.setDescription('A collection of Telepresence system notifications.') ciscoTpConfigurationGroupR01 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 10)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpSysUserAuthFailNotifyEnable"), ("CISCO-TELEPRESENCE-MIB", "ctpSystemReset"), ("CISCO-TELEPRESENCE-MIB", "ctpPeriStatusChangeNotifyEnable")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpConfigurationGroupR01 = ciscoTpConfigurationGroupR01.setStatus('current') if mibBuilder.loadTexts: ciscoTpConfigurationGroupR01.setDescription('A collection of objects providing the notification configuration and system reset.') ciscoTpPeripheralStatusGroupR02 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 11)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpPeripheralDescription"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralDeviceCategory"), ("CISCO-TELEPRESENCE-MIB", "ctpPeripheralDeviceNumber"), ("CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralIfIndex"), ("CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralAddrType"), ("CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralAddr"), ("CISCO-TELEPRESENCE-MIB", "ctpEtherPeripheralStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpHDMIPeripheralCableStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpHDMIPeripheralPowerStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpDVIPeripheralCableStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpUSBPeripheralCableStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpUSBPeripheralPowerStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpUSBPeripheralPortType"), ("CISCO-TELEPRESENCE-MIB", "ctpUSBPeripheralPortRate"), ("CISCO-TELEPRESENCE-MIB", "ctp802dot11PeripheralIfIndex"), ("CISCO-TELEPRESENCE-MIB", "ctp802dot11PeripheralAddrType"), ("CISCO-TELEPRESENCE-MIB", "ctp802dot11PeripheralAddr"), ("CISCO-TELEPRESENCE-MIB", "ctp802dot11PeripheralLinkStrength"), ("CISCO-TELEPRESENCE-MIB", "ctp802dot11PeripheralLinkStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpPeripheralStatusGroupR02 = ciscoTpPeripheralStatusGroupR02.setStatus('current') if mibBuilder.loadTexts: ciscoTpPeripheralStatusGroupR02.setDescription('A collection of objects providing the Telepresence peripheral information.') ciscoTpConfigurationGroupR02 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 12)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpVlanId"), ("CISCO-TELEPRESENCE-MIB", "ctpDefaultGateway"), ("CISCO-TELEPRESENCE-MIB", "ctpDefaultGatewayAddrType")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpConfigurationGroupR02 = ciscoTpConfigurationGroupR02.setStatus('current') if mibBuilder.loadTexts: ciscoTpConfigurationGroupR02.setDescription('A collection of objects providing network configurations.') ciscoTpDPPeripheralStatusGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 643, 2, 2, 13)).setObjects(("CISCO-TELEPRESENCE-MIB", "ctpDPPeripheralCableStatus"), ("CISCO-TELEPRESENCE-MIB", "ctpDPPeripheralPowerStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ciscoTpDPPeripheralStatusGroup = ciscoTpDPPeripheralStatusGroup.setStatus('current') if mibBuilder.loadTexts: ciscoTpDPPeripheralStatusGroup.setDescription('A collection of objects providing the information about Telepresence peripheral which is connected via Display Port.') mibBuilder.exportSymbols("CISCO-TELEPRESENCE-MIB", ciscoTpRS232PeripheralStatusGroup=ciscoTpRS232PeripheralStatusGroup, ctpSystemReset=ctpSystemReset, CtpPeripheralCableCode=CtpPeripheralCableCode, CtpSystemResetMode=CtpSystemResetMode, ctpDPPeripheralCableStatus=ctpDPPeripheralCableStatus, ctpDPPeripheralPowerStatus=ctpDPPeripheralPowerStatus, ctpPeriStatusChangeNotification=ctpPeriStatusChangeNotification, ctpRS232PeripheralIndex=ctpRS232PeripheralIndex, ctpDPPeripheralStatusTable=ctpDPPeripheralStatusTable, ctpPeripheralIndex=ctpPeripheralIndex, ctpPeripheralErrorNotifyEnable=ctpPeripheralErrorNotifyEnable, ciscoTelepresenceMIBGroups=ciscoTelepresenceMIBGroups, ctpPeripheralErrorIndex=ctpPeripheralErrorIndex, ctpRS232PeripheralStatusTable=ctpRS232PeripheralStatusTable, ctpUSBPeripheralPortRate=ctpUSBPeripheralPortRate, ctpPeripheralErrorNotification=ctpPeripheralErrorNotification, ctpDVIPeripheralCableStatus=ctpDVIPeripheralCableStatus, ctpPeripheralStatusTable=ctpPeripheralStatusTable, ctp802dot11PeripheralIfIndex=ctp802dot11PeripheralIfIndex, ctp802dot11PeripheralLinkStrength=ctp802dot11PeripheralLinkStrength, ctpPeripheralStatusObjects=ctpPeripheralStatusObjects, ctpHDMIPeripheralCableStatus=ctpHDMIPeripheralCableStatus, ctpHDMIPeripheralStatusEntry=ctpHDMIPeripheralStatusEntry, ctpHDMIPeripheralStatusTable=ctpHDMIPeripheralStatusTable, ctpPeripheralAttributeTable=ctpPeripheralAttributeTable, ctpSysUserAuthFailHistoryEntry=ctpSysUserAuthFailHistoryEntry, ciscoTpPeripheralAttributeGroup=ciscoTpPeripheralAttributeGroup, ctpEtherPeripheralIfIndex=ctpEtherPeripheralIfIndex, ctpPeripheralErrorDeviceNumber=ctpPeripheralErrorDeviceNumber, ctpEtherPeripheralStatusTable=ctpEtherPeripheralStatusTable, ctpUSBPeripheralPortType=ctpUSBPeripheralPortType, ciscoTelepresenceComplianceR02=ciscoTelepresenceComplianceR02, ctpRS232PeripheralConnStatus=ctpRS232PeripheralConnStatus, ctpSysUserAuthFailNotification=ctpSysUserAuthFailNotification, ctpUSBPeripheralStatusTable=ctpUSBPeripheralStatusTable, ctpPeripheralStatusEntry=ctpPeripheralStatusEntry, ciscoTelepresenceCompliances=ciscoTelepresenceCompliances, ctpPeripheralAttributeValue=ctpPeripheralAttributeValue, ctpDPPeripheralIndex=ctpDPPeripheralIndex, ctpUSBPeripheralStatusEntry=ctpUSBPeripheralStatusEntry, ctpDefaultGateway=ctpDefaultGateway, ctp802dot11PeripheralStatusTable=ctp802dot11PeripheralStatusTable, ctpEtherPeripheralStatusEntry=ctpEtherPeripheralStatusEntry, ctpSysUserAuthFailHistoryIndex=ctpSysUserAuthFailHistoryIndex, ciscoTpNotificationGroup=ciscoTpNotificationGroup, ctpPeripheralAttributeEntry=ctpPeripheralAttributeEntry, ctpRS232PeripheralStatusEntry=ctpRS232PeripheralStatusEntry, ctpPeripheralErrorDeviceCategory=ctpPeripheralErrorDeviceCategory, ctpSysUserAuthFailNotifyEnable=ctpSysUserAuthFailNotifyEnable, ciscoTpDPPeripheralStatusGroup=ciscoTpDPPeripheralStatusGroup, ctpSysUserAuthFailAccessProtocol=ctpSysUserAuthFailAccessProtocol, ctpDefaultGatewayAddrType=ctpDefaultGatewayAddrType, ciscoTelepresenceComplianceR01=ciscoTelepresenceComplianceR01, ctpEventHistory=ctpEventHistory, ctpDVIPeripheralStatusEntry=ctpDVIPeripheralStatusEntry, ctpSysUserAuthFailTimeStamp=ctpSysUserAuthFailTimeStamp, ciscoTelepresenceCompliance=ciscoTelepresenceCompliance, ctp802dot11PeripheralLinkStatus=ctp802dot11PeripheralLinkStatus, ciscoTpConfigurationGroupR01=ciscoTpConfigurationGroupR01, ciscoTpPeripheralStatusGroup=ciscoTpPeripheralStatusGroup, ctpPeripheralAttributeIndex=ctpPeripheralAttributeIndex, ciscoTelepresenceMIB=ciscoTelepresenceMIB, ctpDVIPeripheralIndex=ctpDVIPeripheralIndex, ctpEtherPeripheralIndex=ctpEtherPeripheralIndex, ctpHDMIPeripheralPowerStatus=ctpHDMIPeripheralPowerStatus, ctpPeripheralErrorHistoryEntry=ctpPeripheralErrorHistoryEntry, ctpSysUserAuthFailHistoryTable=ctpSysUserAuthFailHistoryTable, ctpRS232PortIndex=ctpRS232PortIndex, ctpSysUserAuthFailHistTableSize=ctpSysUserAuthFailHistTableSize, ctpVlanId=ctpVlanId, ctpPeripheralStatus=ctpPeripheralStatus, ciscoTelepresenceComplianceR05=ciscoTelepresenceComplianceR05, ciscoTelepresenceComplianceR04=ciscoTelepresenceComplianceR04, ctpUSBPeripheralIndex=ctpUSBPeripheralIndex, ciscoTpConfigurationGroupR02=ciscoTpConfigurationGroupR02, ciscoTelepresenceMIBNotifs=ciscoTelepresenceMIBNotifs, ctpDVIPeripheralStatusTable=ctpDVIPeripheralStatusTable, ctpPeripheralErrorHistoryTable=ctpPeripheralErrorHistoryTable, ctpPeripheralErrorStatus=ctpPeripheralErrorStatus, ciscoTpEventHistoryGroupR01=ciscoTpEventHistoryGroupR01, ctpPeripheralErrorHistTableSize=ctpPeripheralErrorHistTableSize, CtpPeripheralStatusCode=CtpPeripheralStatusCode, ctpEtherPeripheralStatus=ctpEtherPeripheralStatus, ciscoTpNotificationGroupR01=ciscoTpNotificationGroupR01, CtpPeripheralDeviceCategoryCode=CtpPeripheralDeviceCategoryCode, ciscoTpPeripheralStatusGroupR01=ciscoTpPeripheralStatusGroupR01, CtpSystemAccessProtocol=CtpSystemAccessProtocol, ctpSysUserAuthFailSourceAddrType=ctpSysUserAuthFailSourceAddrType, ctpObjects=ctpObjects, ctpPeripheralDeviceCategory=ctpPeripheralDeviceCategory, ctpPeripheralErrorHistoryIndex=ctpPeripheralErrorHistoryIndex, ctpPeripheralErrorTimeStamp=ctpPeripheralErrorTimeStamp, ctpSysUserAuthFailSourceAddr=ctpSysUserAuthFailSourceAddr, ctpUSBPeripheralCableStatus=ctpUSBPeripheralCableStatus, ctp802dot11PeripheralIndex=ctp802dot11PeripheralIndex, ctpHDMIPeripheralIndex=ctpHDMIPeripheralIndex, ciscoTpEventHistoryGroup=ciscoTpEventHistoryGroup, ctpPeripheralDeviceNumber=ctpPeripheralDeviceNumber, ciscoTpPeripheralStatusGroupR02=ciscoTpPeripheralStatusGroupR02, ciscoTpConfigurationGroup=ciscoTpConfigurationGroup, ctpPeriStatusChangeNotifyEnable=ctpPeriStatusChangeNotifyEnable, PYSNMP_MODULE_ID=ciscoTelepresenceMIB, ctpSysUserAuthFailHistLastIndex=ctpSysUserAuthFailHistLastIndex, ciscoTelepresenceComplianceR03=ciscoTelepresenceComplianceR03, ctp802dot11PeripheralStatusEntry=ctp802dot11PeripheralStatusEntry, ctpUSBPeripheralPowerStatus=ctpUSBPeripheralPowerStatus, ciscoTelepresenceMIBConform=ciscoTelepresenceMIBConform, ciscoTelepresenceMIBObjects=ciscoTelepresenceMIBObjects, ctpSysUserAuthFailSourcePort=ctpSysUserAuthFailSourcePort, ctp802dot11PeripheralAddrType=ctp802dot11PeripheralAddrType, CtpPeripheralPowerCode=CtpPeripheralPowerCode, ctpEtherPeripheralAddrType=ctpEtherPeripheralAddrType, ctpPeripheralErrorHistLastIndex=ctpPeripheralErrorHistLastIndex, ctpDPPeripheralStatusEntry=ctpDPPeripheralStatusEntry, ctpSysUserAuthFailUserName=ctpSysUserAuthFailUserName, ctpEtherPeripheralAddr=ctpEtherPeripheralAddr, ctpPeripheralDescription=ctpPeripheralDescription, ctp802dot11PeripheralAddr=ctp802dot11PeripheralAddr, ctpPeripheralAttributeDescr=ctpPeripheralAttributeDescr)
#!usr/bin/python # -*- coding:utf8 -*- """ __del__:析构方法, 当对象在内存中被释放时,自动触发此方法 """ class Foo: def __del__(self): print("__del__") obj = Foo() # 程序结束自动会被回收
class SearchModule: def __init__(self): pass def search_for_competition_by_name(self, competitions, query): m, answer = self.search(competitions, attribute_name="caption", query=query) if m == 0: return False return answer def search_for_competition_by_code(self, competitions, query): return self.search_by_code(competitions, attribute_name="league", query=query) def search_for_team_by_name(self, teams, query): m, answer = self.search(teams, attribute_name="name", query=query) if m == 0: return False return answer def search_for_team_by_code(self, teams, query): return self.search_by_code(teams, attribute_name="code", query=query) def search_for_player_by_name(self, players, query): m, answer = self.search(players, attribute_name="name", query=query) if m == 0: return False return answer def search_for_team_from_standing_by_name(self, teams, query): m, answer = self.search(teams, attribute_name="team_name", query=query) if m == 0: return False return answer @staticmethod def search_by_code(dataset, attribute_name, query): search = query.lower() for index, data in enumerate(dataset): code = getattr(data, attribute_name).lower() if code == search: return dataset[index] return False @staticmethod def search(dataset, attribute_name, query): values = [0 for _ in range(0, len(dataset))] search = query.lower().split() upper_threshold = len(search) for index, data in enumerate(dataset): data_name = getattr(data, attribute_name).lower() search_array = data_name.split() for index2, text in enumerate(search_array): if index2 >= upper_threshold: break threshold = len(search[index2]) for i in range(0, len(text)): if i >= threshold - 1: break if text[i] == search[index2][i]: values[index] += 1 max_value = max(values) max_index = values.index(max_value) return max_value, dataset[max_index]
""" Write a program to display values of variables in Python. """ message = "Keep Smiling!" print(message) userNo = 101 print("User No is ", userNo) gender = 'M' print("Gender: ",gender)
load("@io_bazel_rules_dotnet//dotnet:defs.bzl", "core_library", "core_resource") filegroup( name = "core_common", srcs = [ ":src/common/ExceptionExtensions.cs", ":src/common/Guard.cs", ":src/common/TestMethodDisplay.cs", ":src/common/TestMethodDisplayOptions.cs", ] + ["@xunit_assert//:common_files"], ) core_resource( name = "xunit_core_resource", src = "src/xunit.core/Resources/xunit.core.rd.xml", identifier = "Xunit.Resources.xunit.core.rd.xml", ) core_library( name = "xunit.core.dll", srcs = [":core_common"] + glob(["src/xunit.core/**/*.cs"]), data = [ ":src/xunit.core/xunit.core.dll.tdnet", ], defines = [ "XUNIT_FRAMEWORK", ], resources = [":xunit_core_resource"], visibility = ["//visibility:public"], deps = [ "@core_sdk_stdlib//:libraryset", "@xunit_abstractions//:abstractions.xunit.dll", ], ) filegroup( name = "execution_common", srcs = [ ":src/common/AssemblyExtensions.cs", ":src/common/CommonTasks.cs", ":src/common/DictionaryExtensions.cs", ":src/common/ExceptionExtensions.cs", ":src/common/ExceptionUtility.cs", ":src/common/ExecutionHelper.cs", ":src/common/Guard.cs", ":src/common/LongLivedMarshalByRefObject.cs", ":src/common/NewReflectionExtensions.cs", ":src/common/NullMessageSink.cs", ":src/common/SerializationHelper.cs", ":src/common/SourceInformation.cs", ":src/common/TestOptionsNames.cs", ":src/common/XunitSerializationInfo.cs", ":src/common/XunitWorkerThread.cs", ] + glob(["src/messages/**/*.cs"]) + ["@xunit_assert//:common_files"], ) core_library( name = "xunit.execution.dll", srcs = [":execution_common"] + glob(["src/xunit.execution/**/*.cs"]), defines = [ "XUNIT_FRAMEWORK", "NETSTANDARD", ], visibility = ["//visibility:public"], deps = [ ":xunit.core.dll", "@core_sdk_stdlib//:libraryset", ], ) filegroup( name = "runner_utility_common", srcs = [ ":src/common/AssemblyExtensions.cs", ":src/common/CommonTasks.cs", ":src/common/ConcurrentDictionary.cs", ":src/common/ConsoleHelper.cs", ":src/common/DictionaryExtensions.cs", ":src/common/ExceptionExtensions.cs", ":src/common/ExceptionUtility.cs", ":src/common/Guard.cs", ":src/common/Json.cs", ":src/common/LongLivedMarshalByRefObject.cs", ":src/common/NewReflectionExtensions.cs", ":src/common/NullMessageSink.cs", ":src/common/SerializationHelper.cs", ":src/common/SourceInformation.cs", ":src/common/TestMethodDisplay.cs", ":src/common/TestMethodDisplayOptions.cs", ":src/common/TestOptionsNames.cs", ":src/common/XunitSerializationInfo.cs", ":src/common/XunitWorkerThread.cs", ":src/common/AssemblyResolution/AssemblyHelper_Desktop.cs", ":src/common/AssemblyResolution/_DiagnosticMessage.cs", ] + glob(["src/messages/**/*.cs"]), ) core_library( name = "xunit.runner.utility.dll", srcs = [":runner_utility_common"] + glob(["src/xunit.runner.utility/**/*.cs"]), defines = [ "NETSTANDARD2_0", "NETSTANDARD", "NETCOREAPP", ], visibility = ["//visibility:public"], deps = [ "@core_sdk_stdlib//:libraryset", "@xunit_abstractions//:abstractions.xunit.dll", ], ) filegroup( name = "runner_reporters_common", srcs = [ ":src/common/Json.cs", ":src/common/XunitWorkerThread.cs", ], ) core_library( name = "xunit.runner.reporters.dll", srcs = [":runner_reporters_common"] + glob(["src/xunit.runner.reporters/**/*.cs"]), defines = [ "NETSTANDARD2_0", "NETSTANDARD", ], visibility = ["//visibility:public"], deps = [ ":xunit.runner.utility.dll", "@core_sdk_stdlib//:libraryset", "@xunit_abstractions//:abstractions.xunit.dll", ], ) filegroup( name = "console_common", srcs = [ ":src/common/AssemblyExtensions.cs", ":src/common/ConsoleHelper.cs", ":src/common/DictionaryExtensions.cs", ":src/common/Guard.cs", ":src/common/Json.cs", ] + glob(["src/common/AssemblyResolution/**/*.cs"]), ) core_resource( name = "HTML_xslt", src = "src/xunit.console/HTML.xslt", identifier = "Xunit.ConsoleClient.HTML.xslt", ) core_resource( name = "NUnitXml_xslt", src = "src/xunit.console/NUnitXml.xslt", identifier = "Xunit.ConsoleClient.NUnitXml.xslt", ) core_resource( name = "xUnit1_xslt", src = "src/xunit.console/xUnit1.xslt", identifier = "Xunit.ConsoleClient.xUnit1.xslt", ) core_resource( name = "JUnitXml_xslt", src = "src/xunit.console/JUnitXml.xslt", identifier = "Xunit.ConsoleClient.JUnitXml.xslt", ) core_library( name = "xunit.console.dll", srcs = [":console_common"] + glob(["src/xunit.console/**/*.cs"]), defines = [ "NETSTANDARD2_0", "NETSTANDARD", "NETCOREAPP", "NETCOREAPP2_0", ], resources = [ ":HTML_xslt", ":JUnitXml_xslt", ":NUnitXml_xslt", ":xUnit1_xslt", ], unsafe = True, visibility = ["//visibility:public"], deps = [ ":xunit.runner.reporters.dll", ], ) filegroup( name = "test_utility_common", srcs = [ ":src/common/AssemblyExtensions.cs", ":src/common/DictionaryExtensions.cs", ":src/common/ExceptionExtensions.cs", ":src/common/ExecutionHelper.cs", ":src/common/TestOptionsNames.cs", ], ) # core_library( # name = "xunit.test.utility.dll", # srcs = [":test_utility_common"] + glob(["xunit/test/test.utility/**/*.cs"]), # defines = [ # "NETSTANDARD2_0", # "NETSTANDARD", # ], # visibility = ["//visibility:public"], # deps = [ # ":xunit.core.dll", # "@core_sdk_stdlib//:libraryset", # "@xunit_abstractions//:abstractions.xunit.dll", # ], # ) #core_xunit_test( # name = "test.xunit.assert", # srcs = ["@xunit_assert//:test_files"] + glob(["xunit/test/test.xunit.assert/**/*.cs"]), # defines = [ # "XUNIT_FRAMEWORK", # ], # visibility = ["//visibility:public"], # deps = [ # "@core_sdk_stdlib//:libraryset", # "@xunit_abstractions//:abstractions.xunit", # "@xunit_assert//:assert.xunit", # ":xunit.core", # ":xunit.test.utility", # ], # testlauncher=":xunit.console" #)
res = [] with open('test.txt', mode='r', encoding="utf-8") as f: for line in f: arr = line.split() print(arr) res.append(arr[1]) r = '\t'.join(res) with open('res.txt', mode='w', encoding="utf-8") as f: # print(r) f.write(r)
class GuildConfig: def __init__(self, data): self._data = data self.prefix = self.settings['prefix'] self.offset = self.settings['offset'] self.regional_pkmn = self.settings['regional'] self.has_configured = self.settings['done'] @property def settings(self): return self._data['prefix'] class RaidData: def __init__(self, data): self._data = data class WildData: def __init__(self, data): self._data = data class QuestData: def __init__(self, data): self._data = data class EventData: def __init__(self, data): self._data = data class TrainerData: def __init__(self, bot, data): self._bot = bot self._data = data self.raid_reports = data.get('raid_reports') self.ex_reports = data.get('ex_reports') self.wild_reports = data.get('wild_reports') self.egg_reports = data.get('egg_reports') self.research_reports = data.get('research_reports') self.silph_id = data.get('silphid') self.silph = self.silph_profile @property def silph_card(self): if not self.silph_id: return None silph_cog = self._bot.cogs.get('Silph') if not silph_cog: return None return silph_cog.get_silph_card(self.silph_id) @property def silph_profile(self): if not self.silph_id: return None silph_cog = self._bot.cogs.get('Silph') if not silph_cog: return None return silph_cog.get_silph_profile_lazy(self.silph_id) class GuildData: def __init__(self, ctx, data): self.ctx = ctx self._data = data @property def config(self): return GuildConfig(self._data['configure_dict']) @property def raids(self): return self._data['raidchannel_dict'] def raid(self, channel_id=None): channel_id = channel_id or self.ctx.channel.id data = self.raids.get(channel_id) return RaidData(data) if data else None @property def trainers(self): return self._data['trainers'] def trainer(self, member_id=None): member_id = member_id or self.ctx.author.id trainer_data = self.trainers.get(member_id) if not trainer_data: return None return TrainerData(self.ctx.bot, trainer_data)
# -*- coding: utf-8 -*- """Top-level package for Elejandria Libros chef.""" __author__ = """Learning Equality""" __email__ = 'benjamin@learningequality.org' __version__ = '0.1.0'
""" # Definition for a Node. class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right """ class Solution: def treeToDoublyList(self, root: 'Node') -> 'Node': if not root: return None nodes = [] def inorder(root): if root: inorder(root.left) nodes.append(root) inorder(root.right) inorder(root) for i in range(len(nodes)-1): nodes[i].right = nodes[i+1] nodes[i+1].left = nodes[i] nodes[0].left = nodes[-1] nodes[-1].right = nodes[0] return nodes[0]
def solution(salaries: list[int]) -> int: return sorted(salaries)[1] if __name__ == '__main__': user_input = input() param = [int(x) for x in user_input.split()] print(solution(salaries=param))
#adding two numbers num1 = 2 num2 = 3 sum = num1 + num2 print("The sum is:", sum)
""" Cube class contains the logic for maintaining the current state of the container, or Bedlam Cube, and methods for checking, inserting, and removing individual Shape objects from the cube space. """ """ Each Cube is made up of X * Y * Z Cuboids, Each of which for simplicities sakes contain all the info for the shapes that occupy the cube. """ class Cuboid: def __init__(self): self.shape = None #empty cuboid if the shape is None self.rotation = 0 self.x = -1 self.y = -1 self.z = -1 def __repr__(self): return "%s:%s"%(self.shape, self.rotation) __str__ = __repr__ class Cube: #initialiase with x*y*z cuboids def __init__(self, width=4, length=4, depth=4, ): self.width = width self.length = length self.depth = depth self.space = [[[Cuboid() for x in range(self.width)] for y in range(self.length)] for z in range(self.depth)] #checks that a specific shape and rotation of that shape #will fit into this cube at position x,y,z. Basically if #_any_ of the 'blocks' that make up the shape correspond #to a cuboid that already HAS a shape assigned, then this #shape will not fit. def check_shape(self, shape, rotation ,x ,y ,z): for block in shape.rotations[rotation]: bx, by, bz = block cx = bx + x cy = by + y cz = bz + z if cx >= self.width or \ cy >= self.length or \ cz >= self.depth or \ self.space[cx][cy][cz].shape != None: return False return True # blanks out the cuboid shape objects for a given shape # This happens during the iterative process of trying # each shape in turn, if a child shape cannot be placed # then the parent has to be removed and moved/rotated # before being placed again. def remove_shape(self, shape, rotation, x, y, z): for block in shape.rotations[rotation]: bx, by, bz = block cx = bx + x cy = by + y cz = bz + z self.space[cx][cy][cz].shape = None # Sets the shape into the Cube at this specific rotation # and position IFF it fits i.e. uses check_shape first # to see and then sets if it can. def put_shape (self, shape, rotation, x, y, z): if self.check_shape(shape, rotation, x, y, z): for block in shape.rotations[rotation]: bx, by, bz = block cx = bx + x cy = by + y cz = bz + z self.space[cx][cy][cz].shape = shape self.space[cx][cy][cz].rotation = rotation self.space[cx][cy][cz].sx = x self.space[cx][cy][cz].sy = y self.space[cx][cy][cz].sz = z return True return False def __repr__(self): return "%s"%str(self.space) __str__ = __repr__
def validate_positive_integer(param): if isinstance(param,int) and (param > 0): return(None) else: raise ValueError("Invalid value, expected positive integer, got {0}".format(param))
n = float(input('Distância viagem: ')) '''if n > 200: n1 = n*0.45 else: n1 = n*0.5''' # modo 2 n1 = n*0.5 if n<=200 else n*0.45 print('Sua viagem de {}km custará {} reais'.format(n, n1))
class Node: """ This Node class has been created for you. It contains the necessary properties for the solution, which are: - text - next """ def __init__(self, data, value): self.data = data self.value = value self.__left = None self.__right = None def __repr__(self): return '<Node {}>'.format(self.value) def set_right(self, node): if isinstance(node, Node) or node is None: self.__right = node else: raise TypeError("The 'right' node must be of type Node or None.") def set_left(self, node): if isinstance(node, Node) or node is None: self.__left = node else: raise TypeError("The 'left' node must be of type Node or None.") def get_right(self): return self.__right def get_left(self): return self.__left def print_details(self): print("{}: {}".format(self.value, self.data))
class Solution: def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int: n = len(gas) total_tank, curr_tank = 0, 0 start = 0 for i in range(n): total_tank += gas[i] - cost[i] curr_tank += gas[i] - cost[i] # If one couldn't get here, if curr_tank < 0: # Pick up the next station as the starting one. start = i + 1 # Start with an empty tank. curr_tank = 0 return start if total_tank >= 0 else -1
def test(): # Here we can either check objects created in the solution code, or the # string value of the solution, available as __solution__. A helper for # printing formatted messages is available as __msg__. See the testTemplate # in the meta.json for details. # If an assertion fails, the message will be displayed assert set(bs_column.values) == {'strong', 'weak'}, "Have you selected the 'base_score' column?" assert set(score_freq) == set([573, 228]), "You count values are incorrect. Are you using the 'count' function?" assert "plot.bar" in __solution__ , "Are you using the 'plot.bar' function?" assert list(score_plot.get_ylim()) == [0.0, 601.65], "The y-axis labels are incorrect, are you using the 'count' function?" assert str(list(score_plot.get_xticklabels())) == "[Text(0, 0, 'weak'), Text(0, 0, 'strong')]", "\nThe x-axis labels are incorrect. Are you using the 'count' function?" __msg__.good("Nice work, well done!")
# New tokens can be found at https://archive.org/account/s3.php IA_ACCESS_KEY = 'change to valid token' IA_SECRET_KEY = 'change to valid token' DOI_FORMAT = '10.70102/fk2osf.io/{guid}' OSF_BEARER_TOKEN = '' DATACITE_USERNAME = None DATACITE_PASSWORD = None DATACITE_URL = None DATACITE_PREFIX = '10.70102' # Datacite's test DOI prefix -- update in production
test = { 'name': 'q5', 'points': 3, 'suites': [ { 'cases': [ {'code': ">>> big_tippers(['suraj', 15, 'isaac', 9, 'angela', 19]) == ['suraj', 'angela']\nTrue", 'hidden': False, 'locked': False}, { 'code': ">>> big_tippers(['suraj', 15, 'isaac', 25, 'angela', 19, 'anna', 21, 'aayush', 14, 'sukrit', 8]) == ['isaac', 'angela', 'anna']\nTrue", 'hidden': False, 'locked': False}, { 'code': '>>> # If you fail this, note that we want the names of those who tipped MORE than the average,;\n' '>>> # not equal to or more than;\n' ">>> big_tippers(['a', 2, 'b', 2, 'c', 2]) == []\n" 'True', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
#statsFunctions2.py def total(list_obj): total = 0 n = len(list_obj) for i in range(n): total += list_obj[i] return total def mean(list_obj): n = len(list_obj) mean = total(list_obj) / n return mean list1 = [3, 6, 9, 12, 15] total_list1 = total(list1) print(total_list1) mean_list1 = mean(list1) print("Mean of list1:", mean_list1)
hora = input('Digite a hora atual: ') try: hora = int(hora) if 0 <= hora <= 11: print('Bom Dia') elif 12 <= hora <= 17: print('Boa Tarde') elif 18 <= hora <= 23: print('Boa Noite') else: print('Valor Inválido') except: print('Valor Inválido')
ble_address_type = { 'gap_address_type_public': 0, 'gap_address_type_random': 1 } gap_discoverable_mode = { 'non_discoverable': 0x00, 'limited_discoverable': 0x01, 'general_discoverable': 0x02, 'broadcast': 0x03, 'user_data': 0x04, 'enhanced_broadcasting': 0x80 } gap_connectable_mode = { 'non_connectable': 0x00, 'directed_connectable': 0x01, 'undirected_connectable': 0x02, 'scannable_non_connectable': 0x03, } gap_discover_mode = { 'limited': 0x00, 'generic': 0x01, 'observation': 0x02, } bonding = { # create bonding if devices not already bonded 'do_not_create_bonding': 0x00, 'create_bonding': 0x01, } bondable = { 'no': 0x00, 'yes': 0x01, } connection_status_flag = { 'connected': 0x01, 'encrypted': 0x02, 'completed': 0x04, 'parameters_change': 0x08, } scan_response_packet_type = { 0x00: 'connectable_advertisement_packet', 0x02: 'non-connectable_advertisement_packet', 0x04: 'scan_response_packet', 0x06: 'discoverable_advertisement_packet', } scan_response_data_type = { 0x01: 'flags', 0x02: 'incomplete_list_16-bit_service_class_uuids', 0x03: 'complete_list_16-bit_service_class_uuids', 0x04: 'incomplete_list_32-bit_service_class_uuids', 0x05: 'complete_list_32-bit_service_class_uuids', 0x06: 'incomplete_list_128-bit_service_class_uuids', 0x07: 'complete_list_128-bit_service_class_uuids', 0x08: 'shortened_local_name', 0x09: 'complete_local_name', 0x0A: 'tx_power_level', 0x0D: 'class_of_device', 0x0E: 'simple_pairing_hash_c/c-192', 0x0F: 'simple_pairing_randomizer_r/r-192', 0x10: 'device_id/security_manager_tk_value', 0x11: 'security_manager_out_of_band_flags', 0x12: 'slave_connection_interval_range', 0x14: 'list_of_16-bit_service_solicitation_uuids', 0x1F: 'list_of_32-bit_service_solicitation_uuids', 0x15: 'list_of_128-bit_service_solicitation_uuids', 0x16: 'service_data/service_data-16-bit_uuid', 0x20: 'service_data-32-bit_uuid', 0x21: 'service_data-128-bit_uuid', 0x22: 'LE_secure_connections_confirmation_value', 0x23: 'LE_secure_connections_random_value', 0x17: 'public_target_address', 0x18: 'random_target_address', 0x19: 'appearance', 0x1A: 'advertising_interval', 0x1B: 'LE_bluetooth_device_address', 0x1C: 'LE_role', 0x1D: 'simple_pairing_hash_c-256', 0x1E: 'simple_pairing_randomizer_r-256', 0x3D: '3D_information_data', 0xFF: 'manufacturer_specific_data', } # GATT gatt_service_uuid = { 'generic_access_profile': bytearray([0x18, 0x00]), 'generic_attribute_profile': bytearray([0x18, 0x01]), } gatt_attribute_type_uuid = { 'primary_service': bytearray([0x28, 0x00]), 'secondary_service': bytearray([0x28, 0x01]), 'include': bytearray([0x28, 0x02]), 'characteristic': bytearray([0x28, 0x03]), } gatt_characteristic_descriptor_uuid = { 'characteristic_extended_properties': bytearray([0x29, 0x00]), 'characteristic_user_description': bytearray([0x29, 0x01]), 'client_characteristic_configuration': bytearray([0x29, 0x02]), 'server_characteristic_configuration': bytearray([0x29, 0x03]), 'characteristic_format': bytearray([0x29, 0x04]), 'characteristic_aggregate_format': bytearray([0x29, 0x05]), } gatt_characteristic_type_uuid = { 'device_name': bytearray([0x2A, 0x00]), 'appearance': bytearray([0x2A, 0x01]), 'peripheral_privacy_flag': bytearray([0x2A, 0x02]), 'reconnection_address': bytearray([0x2A, 0x03]), 'peripheral_preferred_connection_parameters': bytearray([0x2A, 0x04]), 'service_changed': bytearray([0x2A, 0x05]), }
#------------------------------------------------------------------------------- # mrna #------------------------------------------------------------------------------- def runFib(inputFile): fi = open(inputFile, 'r') #reads in the file that list the before/after file names inputData = fi.readline().split() #reads in files n, m = int(inputData[0]), int(inputData[1]) mature, immature = 0, 1 for i in range(n-1): babies = mature * m mature = immature + mature immature = babies total = mature + immature return total #------------------------------------------------------------------------------- # Fin #-------------------------------------------------------------------------------
#!/usr/bin/python CONFIG = { "BUCKET": "sd_s3_testbucket", "EXEC_FMT": "/usr/bin/python -m syndicate.rg.gateway", "DRIVER": "syndicate.rg.drivers.s3" }
expected_output = { 'lsps': { 'mlx8.1_to_ces.2': { 'destination': '1.1.1.1', 'admin': 'UP', 'operational': 'UP', 'flap_count': 1, 'retry_count': 0, 'tunnel_interface': 'tunnel0' }, 'mlx8.1_to_ces.1': { 'destination': '2.2.2.2', 'admin': 'UP', 'operational': 'UP', 'flap_count': 1, 'retry_count': 0, 'tunnel_interface': 'tunnel56' }, 'mlx8.1_to_mlx8.2': { 'destination': '3.3.3.3', 'admin': 'UP', 'operational': 'UP', 'flap_count': 1, 'retry_count': 0, 'tunnel_interface': 'tunnel63' }, 'mlx8.1_to_mlx8.3': { 'destination': '4.4.4.4', 'admin': 'DOWN', 'operational': 'DOWN', 'flap_count': 0, 'retry_count': 0 } } }
""" Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chosen from C unlimited number of times. Note: All numbers (including target) will be positive integers. The solution set must not contain duplicate combinations. For example, given candidate set [2, 3, 6, 7] and target 7, A solution set is: [ [7], [2, 2, 3] ] """ class Solution(object): def combinationSum(self, candidates, target): """ :type candidates: List[int] :type target: int :rtype: List[List[int]] """ #import copy def backtracking(start_index, candidates, remain, sub_solution, solution): if remain == 0: #solution.append(copy.deepcopy(sub_solution)) solution.append(sub_solution) return for i in range(start_index, len(candidates)): if remain - candidates[i] >= 0: backtracking(i, candidates, remain - candidates[i], sub_solution + [candidates[i]], solution) solution = [] candidates = list(candidates) backtracking(0, candidates, target, [], solution) return solution s = Solution() print(s.combinationSum([2, 3, 6, 7], 7))
{ 'targets': [ { 'target_name': 'modemmanager-dbus-proxies', 'type': 'none', 'variables': { 'xml2cpp_type': 'proxy', 'xml2cpp_in_dir': '<(sysroot)/usr/share/dbus-1/interfaces/', 'xml2cpp_out_dir': 'include/dbus_proxies', }, 'sources': [ '<(xml2cpp_in_dir)/mm-mobile-error.xml', '<(xml2cpp_in_dir)/mm-serial-error.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Cdma.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Firmware.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Gsm.Card.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Gsm.Contacts.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Gsm.Network.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Gsm.SMS.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Gsm.Ussd.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Gsm.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Simple.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Bearer.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Modem.Location.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Modem.Modem3gpp.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Modem.ModemCdma.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Modem.Simple.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Modem.Time.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Modem.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Sim.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.xml', ], 'includes': ['xml2cpp.gypi'], }, { 'target_name': 'modemmanager-dbus-adaptors', 'type': 'none', 'variables': { 'xml2cpp_type': 'adaptor', 'xml2cpp_in_dir': '<(sysroot)/usr/share/dbus-1/interfaces/', 'xml2cpp_out_dir': 'include/dbus_adaptors', }, 'sources': [ '<(xml2cpp_in_dir)/mm-mobile-error.xml', '<(xml2cpp_in_dir)/mm-serial-error.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Cdma.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Firmware.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Gsm.Card.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Gsm.Contacts.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Gsm.Network.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Gsm.SMS.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Gsm.Ussd.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Gsm.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.Simple.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.Modem.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Bearer.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Modem.Location.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Modem.Modem3gpp.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Modem.ModemCdma.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Modem.Simple.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Modem.Time.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Modem.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.Sim.xml', '<(xml2cpp_in_dir)/org.freedesktop.ModemManager1.xml', ], 'includes': ['xml2cpp.gypi'], }, { 'target_name': 'dbus-proxies', 'type': 'none', 'variables': { 'xml2cpp_type': 'proxy', 'xml2cpp_in_dir': '<(sysroot)/usr/share/dbus-1/interfaces/', 'xml2cpp_out_dir': 'include/dbus_proxies', }, 'sources': [ '<(xml2cpp_in_dir)/org.freedesktop.DBus.Properties.xml', ], 'includes': ['xml2cpp.gypi'], }, { 'target_name': 'cloud_policy_proto_generator', 'type': 'none', 'hard_dependency': 1, 'variables': { 'policy_tools_dir': '<(sysroot)/usr/share/policy_tools', 'policy_resources_dir': '<(sysroot)/usr/share/policy_resources', 'proto_out_dir': '<(SHARED_INTERMEDIATE_DIR)/proto', }, 'actions': [{ 'action_name': 'run_generate_script', 'inputs': [ '<(policy_tools_dir)/generate_policy_source.py', '<(policy_resources_dir)/policy_templates.json', '<(policy_resources_dir)/VERSION', ], 'outputs': [ '<(proto_out_dir)/cloud_policy.proto' ], 'action': [ 'python', '<(policy_tools_dir)/generate_policy_source.py', '--cloud-policy-protobuf=<(proto_out_dir)/cloud_policy.proto', '<(policy_resources_dir)/VERSION', '<(OS)', '1', # chromeos-flag '<(policy_resources_dir)/policy_templates.json', ], }], }, { 'target_name': 'policy-protos', 'type': 'static_library', 'variables': { 'proto_in_dir': '<(sysroot)/usr/include/proto', 'proto_out_dir': 'include/bindings', }, 'sources': [ '<(proto_in_dir)/chrome_device_policy.proto', '<(proto_in_dir)/chrome_extension_policy.proto', '<(proto_in_dir)/device_management_backend.proto', '<(proto_in_dir)/device_management_local.proto', ], 'includes': ['protoc.gypi'], }, { 'target_name': 'user_policy-protos', 'type': 'static_library', 'variables': { 'proto_in_dir': '<(SHARED_INTERMEDIATE_DIR)/proto', 'proto_out_dir': 'include/bindings', }, 'dependencies': [ 'cloud_policy_proto_generator', ], 'sources': [ '<(proto_in_dir)/cloud_policy.proto', ], 'includes': ['protoc.gypi'], }, { 'target_name': 'install_attributes-proto', 'type': 'static_library', # install_attributes-proto.a is used by a shared_libary # object, so we need to build it with '-fPIC' instead of '-fPIE'. 'cflags!': ['-fPIE'], 'cflags': ['-fPIC'], 'variables': { 'proto_in_dir': '<(sysroot)/usr/include/proto', 'proto_out_dir': 'include/bindings', }, 'sources': [ '<(proto_in_dir)/install_attributes.proto', ], 'includes': ['protoc.gypi'], }, ], }
n1 = int(input("Digite um número: ")) if __name__ == '__main__': if n1 % 2 == 0: print("Número Par") elif n1 % 2 == 1: print("Número Ímpar") else: print("Valor Inválido")
class Queue: def __init__(self): self.in_stack = [] self.out_stack = [] # Transfer values in stack1 to stack2 def stack_transfer(self, stack1, stack2): while stack1: stack2.append(stack1.pop()) def enqueue(self, value): self.in_stack.append(value) def dequeue(self): # If no items on either stack if not self.in_stack and not self.out_stack: return None # If in_stack has items, but out_stack is empty if self.in_stack and not self.out_stack: self.stack_transfer(self.in_stack, self.out_stack) return self.out_stack.pop() if __name__ == "__main__": myQueue = Queue() for i in xrange(1, 10): myQueue.enqueue(i) while True: value = myQueue.dequeue() if value is None: exit(0) else: print(value)
l = iface.activeLayer() iter = l.getFeatures() geoms = [] for feature in iter: geom = feature.geometry() if not(geom.isMultipart()): l.boundingBox(feature.id()) geoms.append(geom)