content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def is_funny(string): data = list(zip(string, reversed(string))) for i in range(len(string)-1): if abs(ord(data[i+1][0]) - ord(data[i][0])) != \ abs(ord(data[i+1][1]) - ord(data[i][1])): return "Not Funny" return "Funny" N = int(input()) for i in range(N): print(is_funny(input()))
def is_funny(string): data = list(zip(string, reversed(string))) for i in range(len(string) - 1): if abs(ord(data[i + 1][0]) - ord(data[i][0])) != abs(ord(data[i + 1][1]) - ord(data[i][1])): return 'Not Funny' return 'Funny' n = int(input()) for i in range(N): print(is_funny(input()))
# # Common methods for the a2gtrad and a2advrad scripts. # # # # SOFTWARE HISTORY # # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # 08/13/2014 3393 nabowle Initial creation to contain common # code for a2*radStub scripts. # 03/15/2015 mjames@ucar Edited/added to awips package as RadarCommon # # def get_datetime_str(record): """ Get the datetime string for a record. Args: record: the record to get data for. Returns: datetime string. """ return str(record.getDataTime())[0:19].replace(" ", "_") + ".0" def get_data_type(azdat): """ Get the radar file type (radial or raster). Args: azdat: Boolean. Returns: Radial or raster. """ if azdat: return "radial" return "raster" def get_hdf5_data(idra): rdat = [] azdat = [] depVals = [] threshVals = [] if idra: for item in idra: if item.getName() == "Data": rdat = item elif item.getName() == "Angles": azdat = item # dattyp = "radial" elif item.getName() == "DependentValues": depVals = item.getShortData() elif item.getName() == "Thresholds": threshVals = item.getShortData() return rdat, azdat, depVals, threshVals def get_header(record, headerFormat, xLen, yLen, azdat, description): # Encode dimensions, time, mapping, description, tilt, and VCP mytime = get_datetime_str(record) dattyp = get_data_type(azdat) if headerFormat: msg = str(xLen) + " " + str(yLen) + " " + mytime + " " + \ dattyp + " " + str(record.getLatitude()) + " " + \ str(record.getLongitude()) + " " + \ str(record.getElevation()) + " " + \ str(record.getElevationNumber()) + " " + \ description + " " + str(record.getTrueElevationAngle()) + " " + \ str(record.getVolumeCoveragePattern()) + "\n" else: msg = str(xLen) + " " + str(yLen) + " " + mytime + " " + \ dattyp + " " + description + " " + \ str(record.getTrueElevationAngle()) + " " + \ str(record.getVolumeCoveragePattern()) + "\n" return msg def encode_thresh_vals(threshVals): spec = [".", "TH", "ND", "RF", "BI", "GC", "IC", "GR", "WS", "DS", "RA", "HR", "BD", "HA", "UK"] nnn = len(threshVals) j = 0 msg = "" while j < nnn: lo = threshVals[j] % 256 hi = threshVals[j] / 256 msg += " " j += 1 if hi < 0: if lo > 14: msg += "." else: msg += spec[lo] continue if hi % 16 >= 8: msg += ">" elif hi % 8 >= 4: msg += "<" if hi % 4 >= 2: msg += "+" elif hi % 2 >= 1: msg += "-" if hi >= 64: msg += "%.2f" % (lo*0.01) elif hi % 64 >= 32: msg += "%.2f" % (lo*0.05) elif hi % 32 >= 16: msg += "%.1f" % (lo*0.1) else: msg += str(lo) msg += "\n" return msg def encode_dep_vals(depVals): nnn = len(depVals) j = 0 msg = [] while j < nnn: msg.append(str(depVals[j])) j += 1 return msg def encode_radial(azVals): azValsLen = len(azVals) j = 0 msg = [] while j < azValsLen: msg.append(azVals[j]) j += 1 return msg
def get_datetime_str(record): """ Get the datetime string for a record. Args: record: the record to get data for. Returns: datetime string. """ return str(record.getDataTime())[0:19].replace(' ', '_') + '.0' def get_data_type(azdat): """ Get the radar file type (radial or raster). Args: azdat: Boolean. Returns: Radial or raster. """ if azdat: return 'radial' return 'raster' def get_hdf5_data(idra): rdat = [] azdat = [] dep_vals = [] thresh_vals = [] if idra: for item in idra: if item.getName() == 'Data': rdat = item elif item.getName() == 'Angles': azdat = item elif item.getName() == 'DependentValues': dep_vals = item.getShortData() elif item.getName() == 'Thresholds': thresh_vals = item.getShortData() return (rdat, azdat, depVals, threshVals) def get_header(record, headerFormat, xLen, yLen, azdat, description): mytime = get_datetime_str(record) dattyp = get_data_type(azdat) if headerFormat: msg = str(xLen) + ' ' + str(yLen) + ' ' + mytime + ' ' + dattyp + ' ' + str(record.getLatitude()) + ' ' + str(record.getLongitude()) + ' ' + str(record.getElevation()) + ' ' + str(record.getElevationNumber()) + ' ' + description + ' ' + str(record.getTrueElevationAngle()) + ' ' + str(record.getVolumeCoveragePattern()) + '\n' else: msg = str(xLen) + ' ' + str(yLen) + ' ' + mytime + ' ' + dattyp + ' ' + description + ' ' + str(record.getTrueElevationAngle()) + ' ' + str(record.getVolumeCoveragePattern()) + '\n' return msg def encode_thresh_vals(threshVals): spec = ['.', 'TH', 'ND', 'RF', 'BI', 'GC', 'IC', 'GR', 'WS', 'DS', 'RA', 'HR', 'BD', 'HA', 'UK'] nnn = len(threshVals) j = 0 msg = '' while j < nnn: lo = threshVals[j] % 256 hi = threshVals[j] / 256 msg += ' ' j += 1 if hi < 0: if lo > 14: msg += '.' else: msg += spec[lo] continue if hi % 16 >= 8: msg += '>' elif hi % 8 >= 4: msg += '<' if hi % 4 >= 2: msg += '+' elif hi % 2 >= 1: msg += '-' if hi >= 64: msg += '%.2f' % (lo * 0.01) elif hi % 64 >= 32: msg += '%.2f' % (lo * 0.05) elif hi % 32 >= 16: msg += '%.1f' % (lo * 0.1) else: msg += str(lo) msg += '\n' return msg def encode_dep_vals(depVals): nnn = len(depVals) j = 0 msg = [] while j < nnn: msg.append(str(depVals[j])) j += 1 return msg def encode_radial(azVals): az_vals_len = len(azVals) j = 0 msg = [] while j < azValsLen: msg.append(azVals[j]) j += 1 return msg
#!/usr/bin/env python def mtx_pivot(mtx) -> list: piv=[] pivr=[[] for c in mtx[0]] for r,row in enumerate(mtx): for c,col in enumerate(row): pivr[c]+=[col] piv+=pivr return piv
def mtx_pivot(mtx) -> list: piv = [] pivr = [[] for c in mtx[0]] for (r, row) in enumerate(mtx): for (c, col) in enumerate(row): pivr[c] += [col] piv += pivr return piv
# #class # # terms # # i. features/attributes # # ii. methods # # i. a class with args # # ii a class without args # # task # # crate a person class # # features; age, sex, name, occupation, height # class Person(object): # """ # docstring for Person: # """ # def __init__(self, name, age, occupation, height, sex): # # super(Person, self).__init__() # self.name = name # self.age = age # self.occupation = occupation # self.height = height # self.sex = sex # def addSex(self, sex): # self.sex = sex # def addAge(self, age): # self.age = int(age) # def addOccupation(self, occupation): # self.occupation = occupation # def addHeight(self, height): # self.height = float(height) # def walk(self, steps): # print(f'{self.name} just took {steps} steps.') # person = Person('Tayo', 22, 'Farmer', 5.9, 'Male') # # person.addSex('Male') # # person.addHeight(5.8) # # person.addOccupation('Farmer') # person.addAge(30) # age = person.age # name = person.name # height = person.height # occupation = person.occupation # sex = person.sex # person.walk(100) # print(f'I am {name} and {age} years old.\nI am a {occupation}.\ # \nI am {height} and I am {sex}.\nThank you!') # tayo = Person # # tayo() # create a person class that can walk # features; height, sex, age, name, occupation # walk takes step ardument # shout # eat # sleep # sing # import random # class Person(object): # """docstring for Person""" # def __init__(self, name): # # super(Person, self).__init__() # self.name = name # # self.engine_number = '000222233030' # self.steps = 0 # print(self.name, 'has just been initialized.') # def setAge(self, value): # self.age = value # def setSex(self, sex): # self.sex = sex # def setHeight(self, height): # self.height = height # def walk(self, steps): # print(self.name, 'is took ', steps, 'steps.') # r_number = random.randint(0, 100) # self.steps += (steps * r_number) # def eat(self, food): # print('I am eating ', food) # tayo = Person('Tayo') # comfort = Person('Comfort') # # set tayo's attributes # tayo.setAge(12) # # set comfort's attributes # comfort.setAge(12) # # Game start # # tayo took 10 steps # tayo.walk(10) # # comfort took 30 steps # comfort.walk(30) # # tayo took 2 steps # tayo.walk(2) # # comfort took 10 steps # comfort.walk(10) # # at the end of the day # # print the steps of each players # print(f'{tayo.name} took {tayo.steps} steps\n {comfort.name} took {comfort.steps} ') # if tayo.steps > comfort.steps: # print(f'The winner is {tayo.name}') # else: # print(f'The winner is {comfort.name}') # # tayo.setAge(20) # # tayo.setSex('Male') # # tayo.setHeight(5.9) # # print(tayo.name, tayo.age) # # tayo.walk(20) # # tayo.eat('Rice') # inheritance # Parent class Parent(object): """docstring for Parent""" def __init__(self, name): # super(Parent, self).__init__() self.name = name self.height = 6.0 # print() def getHeight(self): print(self.height) class Child(Parent): """docstring for Child""" def __init__(self, name): super(Parent, self).__init__() self.name = name self.height = 6.2 def getHeight(self): print(self.height) child = Child('Tayo') print(child.name) child.getHeight() print('------------------------------------') parent = Parent('Tolu') print(parent.name) parent.getHeight()
class Parent(object): """docstring for Parent""" def __init__(self, name): self.name = name self.height = 6.0 def get_height(self): print(self.height) class Child(Parent): """docstring for Child""" def __init__(self, name): super(Parent, self).__init__() self.name = name self.height = 6.2 def get_height(self): print(self.height) child = child('Tayo') print(child.name) child.getHeight() print('------------------------------------') parent = parent('Tolu') print(parent.name) parent.getHeight()
""" LC 6014 You are given a string s and an integer repeatLimit. Construct a new string repeatLimitedString using the characters of s such that no letter appears more than repeatLimit times in a row. You do not have to use all characters from s. Return the lexicographically largest repeatLimitedString possible. A string a is lexicographically larger than a string b if in the first position where a and b differ, string a has a letter that appears later in the alphabet than the corresponding letter in b. If the first min(a.length, b.length) characters do not differ, then the longer string is the lexicographically larger one. Example 1: Input: s = "cczazcc", repeatLimit = 3 Output: "zzcccac" Explanation: We use all of the characters from s to construct the repeatLimitedString "zzcccac". The letter 'a' appears at most 1 time in a row. The letter 'c' appears at most 3 times in a row. The letter 'z' appears at most 2 times in a row. Hence, no letter appears more than repeatLimit times in a row and the string is a valid repeatLimitedString. The string is the lexicographically largest repeatLimitedString possible so we return "zzcccac". Note that the string "zzcccca" is lexicographically larger but the letter 'c' appears more than 3 times in a row, so it is not a valid repeatLimitedString. Example 2: Input: s = "aababab", repeatLimit = 2 Output: "bbabaa" Explanation: We use only some of the characters from s to construct the repeatLimitedString "bbabaa". The letter 'a' appears at most 2 times in a row. The letter 'b' appears at most 2 times in a row. Hence, no letter appears more than repeatLimit times in a row and the string is a valid repeatLimitedString. The string is the lexicographically largest repeatLimitedString possible so we return "bbabaa". Note that the string "bbabaaa" is lexicographically larger but the letter 'a' appears more than 2 times in a row, so it is not a valid repeatLimitedString. """ class Solution: def repeatLimitedString(self, s: str, repeatLimit: int) -> str: cnt = dict(Counter(s)) cs = sorted(cnt) ans = [] # print(cnt, cs) while cs: self.use_letter(cnt, cs, ans, repeatLimit) # print(ans) return "".join(ans) def use_letter(self, cnt, cs, ans, repeatLimit): c = cs[-1] while True: app_n = min(repeatLimit, cnt[c]) ans.append(c * app_n) cnt[c] -= app_n if cnt[c] > 0 and len(cs) > 1: backup = cs[-2] ans.append(backup) cnt[backup] -= 1 if cnt[backup] == 0: cs.pop(len(cs) - 2) else: break cs.pop() """ Time/Space O(N) """
""" LC 6014 You are given a string s and an integer repeatLimit. Construct a new string repeatLimitedString using the characters of s such that no letter appears more than repeatLimit times in a row. You do not have to use all characters from s. Return the lexicographically largest repeatLimitedString possible. A string a is lexicographically larger than a string b if in the first position where a and b differ, string a has a letter that appears later in the alphabet than the corresponding letter in b. If the first min(a.length, b.length) characters do not differ, then the longer string is the lexicographically larger one. Example 1: Input: s = "cczazcc", repeatLimit = 3 Output: "zzcccac" Explanation: We use all of the characters from s to construct the repeatLimitedString "zzcccac". The letter 'a' appears at most 1 time in a row. The letter 'c' appears at most 3 times in a row. The letter 'z' appears at most 2 times in a row. Hence, no letter appears more than repeatLimit times in a row and the string is a valid repeatLimitedString. The string is the lexicographically largest repeatLimitedString possible so we return "zzcccac". Note that the string "zzcccca" is lexicographically larger but the letter 'c' appears more than 3 times in a row, so it is not a valid repeatLimitedString. Example 2: Input: s = "aababab", repeatLimit = 2 Output: "bbabaa" Explanation: We use only some of the characters from s to construct the repeatLimitedString "bbabaa". The letter 'a' appears at most 2 times in a row. The letter 'b' appears at most 2 times in a row. Hence, no letter appears more than repeatLimit times in a row and the string is a valid repeatLimitedString. The string is the lexicographically largest repeatLimitedString possible so we return "bbabaa". Note that the string "bbabaaa" is lexicographically larger but the letter 'a' appears more than 2 times in a row, so it is not a valid repeatLimitedString. """ class Solution: def repeat_limited_string(self, s: str, repeatLimit: int) -> str: cnt = dict(counter(s)) cs = sorted(cnt) ans = [] while cs: self.use_letter(cnt, cs, ans, repeatLimit) return ''.join(ans) def use_letter(self, cnt, cs, ans, repeatLimit): c = cs[-1] while True: app_n = min(repeatLimit, cnt[c]) ans.append(c * app_n) cnt[c] -= app_n if cnt[c] > 0 and len(cs) > 1: backup = cs[-2] ans.append(backup) cnt[backup] -= 1 if cnt[backup] == 0: cs.pop(len(cs) - 2) else: break cs.pop() '\nTime/Space O(N)\n'
def add_native_methods(clazz): def floatToRawIntBits__float__(a0): raise NotImplementedError() def intBitsToFloat__int__(a0): raise NotImplementedError() clazz.floatToRawIntBits__float__ = staticmethod(floatToRawIntBits__float__) clazz.intBitsToFloat__int__ = staticmethod(intBitsToFloat__int__)
def add_native_methods(clazz): def float_to_raw_int_bits__float__(a0): raise not_implemented_error() def int_bits_to_float__int__(a0): raise not_implemented_error() clazz.floatToRawIntBits__float__ = staticmethod(floatToRawIntBits__float__) clazz.intBitsToFloat__int__ = staticmethod(intBitsToFloat__int__)
# AUTOGENERATED! DO NOT EDIT! File to edit: 04_device.ipynb (unless otherwise specified). __all__ = ['versions'] # Cell def versions(): "Checks if GPU enabled and if so displays device details with cuda, pytorch, fastai versions" print("GPU: ", torch.cuda.is_available()) if torch.cuda.is_available() == True: print("Device = ", torch.device(torch.cuda.current_device())) print("Cuda version - ", torch.version.cuda) print("cuDNN version - ", torch.backends.cudnn.version()) print("PyTorch version - ", torch.__version__) print("fastai version", fastai.__version__)
__all__ = ['versions'] def versions(): """Checks if GPU enabled and if so displays device details with cuda, pytorch, fastai versions""" print('GPU: ', torch.cuda.is_available()) if torch.cuda.is_available() == True: print('Device = ', torch.device(torch.cuda.current_device())) print('Cuda version - ', torch.version.cuda) print('cuDNN version - ', torch.backends.cudnn.version()) print('PyTorch version - ', torch.__version__) print('fastai version', fastai.__version__)
class PDB_container: ''' Use to read a pdb file from a cocrystal structure and parse it for further use Note this class cannot write any files and we do not want any files to be added by this class This is good for IO management although the code might be hard to understand ''' def __init__(self): ''' parse a pdb from file ''' pass def register_a_ligand(self): pass def Is_pure_protein(self): pass def Is_pure_nucleic(self): pass def Is_protein_nucleic_complex(self): pass def Bundle_ligand_result_dict(self): pass def Bundle_ligand_result_list(self): pass def list_ligand_ResId(self): pass def get_ligand_dict(self): pass class ligand_container: pass
class Pdb_Container: """ Use to read a pdb file from a cocrystal structure and parse it for further use Note this class cannot write any files and we do not want any files to be added by this class This is good for IO management although the code might be hard to understand """ def __init__(self): """ parse a pdb from file """ pass def register_a_ligand(self): pass def is_pure_protein(self): pass def is_pure_nucleic(self): pass def is_protein_nucleic_complex(self): pass def bundle_ligand_result_dict(self): pass def bundle_ligand_result_list(self): pass def list_ligand__res_id(self): pass def get_ligand_dict(self): pass class Ligand_Container: pass
def method(): if True: return 1 else: return 2 def method2(): x = 2 if x: y = 3 z = 1
def method(): if True: return 1 else: return 2 def method2(): x = 2 if x: y = 3 z = 1
# ***************************************************************************** # NICOS, the Networked Instrument Control System of the MLZ # Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS) # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Module authors: # Mark.Koennecke@psi.ch # # ***************************************************************************** name = 'SINQ Double Monochromator' includes = ['stdsystem'] description = 'Test setup for the SINQ double monochromator' devices = dict( mth1 = device('nicos.devices.generic.VirtualMotor', unit = 'degree', description = 'First blade rotation', abslimits = (-180, 180), precision = 0.01 ), mth2 = device('nicos.devices.generic.VirtualMotor', unit = 'degree', description = 'Second blade rotation', abslimits = (-180, 180), precision = 0.01 ), mtx = device('nicos.devices.generic.VirtualMotor', unit = 'mm', description = 'Blade translation', abslimits = (-1000, 1000), precision = 0.01 ), wavelength = device('nicos_sinq.devices.doublemono.DoubleMonochromator', description = 'SINQ Double Monochromator', unit = 'A', safe_position = 20., dvalue = 3.335, distance = 100., abslimits = (2.4, 6.2), mth1 = 'mth1', mth2 = 'mth2', mtx = 'mtx' ), )
name = 'SINQ Double Monochromator' includes = ['stdsystem'] description = 'Test setup for the SINQ double monochromator' devices = dict(mth1=device('nicos.devices.generic.VirtualMotor', unit='degree', description='First blade rotation', abslimits=(-180, 180), precision=0.01), mth2=device('nicos.devices.generic.VirtualMotor', unit='degree', description='Second blade rotation', abslimits=(-180, 180), precision=0.01), mtx=device('nicos.devices.generic.VirtualMotor', unit='mm', description='Blade translation', abslimits=(-1000, 1000), precision=0.01), wavelength=device('nicos_sinq.devices.doublemono.DoubleMonochromator', description='SINQ Double Monochromator', unit='A', safe_position=20.0, dvalue=3.335, distance=100.0, abslimits=(2.4, 6.2), mth1='mth1', mth2='mth2', mtx='mtx'))
""" https://leetcode.com/problems/reverse-integer """ # define an input for testing purposes x = 1534236469 # actual code to submit test = [] for i in str(x): test += i for z in range(len(test)): if test[-1] == "0": test.pop(-1) else: break if test == []: test.append("0") if test[0] == "-": test.append("-") test.pop(0) test.reverse() solved = "".join(test) # use print statement to check if it works if int(solved) > -2147483648 and int(solved) < 2147483648: print(int(solved)) else: print(0) # My Submission: https://leetcode.com/submissions/detail/433340125/
""" https://leetcode.com/problems/reverse-integer """ x = 1534236469 test = [] for i in str(x): test += i for z in range(len(test)): if test[-1] == '0': test.pop(-1) else: break if test == []: test.append('0') if test[0] == '-': test.append('-') test.pop(0) test.reverse() solved = ''.join(test) if int(solved) > -2147483648 and int(solved) < 2147483648: print(int(solved)) else: print(0)
class Fluorescence: def __init__(self, user_input, input_ceon): self.user_input = user_input self.input_ceons = [input_ceon] self.number_trajectories = user_input.n_snapshots_ex self.child_root = 'nasqm_fluorescence_' self.job_suffix = 'fluorescence' self.parent_restart_root = 'nasqm_qmexcited' self.number_frames_in_parent = user_input.n_mcrd_frames_per_run_qmexcited * user_input.n_exc_runs self.n_snapshots_per_trajectory = self.snaps_per_trajectory() self.amber_restart = False def __str__(self): print_value = ""\ f"Traj_Data Info:\n"\ f"Class: Fluorescence:\n"\ f"Number input_ceons: {len(self.input_ceons)}\n"\ f"Number trajectories: {self.number_trajectories}\n" return print_value def snaps_per_trajectory(self): n_frames = self.number_frames_in_parent run_time = self.user_input.exc_run_time time_delay = self.user_input.fluorescence_time_delay/1000 return int(n_frames * ( 1 - time_delay/run_time))
class Fluorescence: def __init__(self, user_input, input_ceon): self.user_input = user_input self.input_ceons = [input_ceon] self.number_trajectories = user_input.n_snapshots_ex self.child_root = 'nasqm_fluorescence_' self.job_suffix = 'fluorescence' self.parent_restart_root = 'nasqm_qmexcited' self.number_frames_in_parent = user_input.n_mcrd_frames_per_run_qmexcited * user_input.n_exc_runs self.n_snapshots_per_trajectory = self.snaps_per_trajectory() self.amber_restart = False def __str__(self): print_value = f'Traj_Data Info:\nClass: Fluorescence:\nNumber input_ceons: {len(self.input_ceons)}\nNumber trajectories: {self.number_trajectories}\n' return print_value def snaps_per_trajectory(self): n_frames = self.number_frames_in_parent run_time = self.user_input.exc_run_time time_delay = self.user_input.fluorescence_time_delay / 1000 return int(n_frames * (1 - time_delay / run_time))
# # PySNMP MIB module COMPANY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/COMPANY-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:26:32 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") ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") MibScalar, MibTable, MibTableRow, MibTableColumn, iso, Bits, TimeTicks, Counter64, IpAddress, MibIdentifier, Counter32, Gauge32, NotificationType, ObjectIdentity, enterprises, Unsigned32, Integer32, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "Bits", "TimeTicks", "Counter64", "IpAddress", "MibIdentifier", "Counter32", "Gauge32", "NotificationType", "ObjectIdentity", "enterprises", "Unsigned32", "Integer32", "ModuleIdentity") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") allotCom = ModuleIdentity((1, 3, 6, 1, 4, 1, 2603)) if mibBuilder.loadTexts: allotCom.setLastUpdated('0103120000Z') if mibBuilder.loadTexts: allotCom.setOrganization('Allot Communications') if mibBuilder.loadTexts: allotCom.setContactInfo('Allot Communications postal: 5 Hanagar St. Industrial Zone Neve Neeman Hod Hasharon 45800 Israel phone: +972-(0)9-761-9200 fax: +972-(0)9-744-3626 email: support@allot.com') if mibBuilder.loadTexts: allotCom.setDescription('This file defines the private Allot SNMP MIB extensions.') neTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 2603, 2)) nePrimaryActive = NotificationType((1, 3, 6, 1, 4, 1, 2603, 2, 11)) if mibBuilder.loadTexts: nePrimaryActive.setStatus('current') if mibBuilder.loadTexts: nePrimaryActive.setDescription('This trap is sent when the primary NE changes to Active mode') nePrimaryBypass = NotificationType((1, 3, 6, 1, 4, 1, 2603, 2, 12)) if mibBuilder.loadTexts: nePrimaryBypass.setStatus('current') if mibBuilder.loadTexts: nePrimaryBypass.setDescription('This trap is sent when the primary NE changes to Bypass mode') neSecondaryActive = NotificationType((1, 3, 6, 1, 4, 1, 2603, 2, 13)) if mibBuilder.loadTexts: neSecondaryActive.setStatus('current') if mibBuilder.loadTexts: neSecondaryActive.setDescription('This trap is sent when the secondary NE changes to Active mode') neSecondaryStandBy = NotificationType((1, 3, 6, 1, 4, 1, 2603, 2, 14)) if mibBuilder.loadTexts: neSecondaryStandBy.setStatus('current') if mibBuilder.loadTexts: neSecondaryStandBy.setDescription('This trap is sent when the secondary NE changes to StandBy mode') neSecondaryBypass = NotificationType((1, 3, 6, 1, 4, 1, 2603, 2, 15)) if mibBuilder.loadTexts: neSecondaryBypass.setStatus('current') if mibBuilder.loadTexts: neSecondaryBypass.setDescription('This trap is sent when the secondary NE changes to Bypass mode') collTableOverFlow = NotificationType((1, 3, 6, 1, 4, 1, 2603, 2, 21)) if mibBuilder.loadTexts: collTableOverFlow.setStatus('current') if mibBuilder.loadTexts: collTableOverFlow.setDescription('This trap is sent when acounting is not reading from the collector which causes the collector table to exceeds limits') neAlertEvent = NotificationType((1, 3, 6, 1, 4, 1, 2603, 2, 22)) if mibBuilder.loadTexts: neAlertEvent.setStatus('current') if mibBuilder.loadTexts: neAlertEvent.setDescription('This trap is sent when user defined event occurs') neNotificationsGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 2603, 3)).setObjects(("COMPANY-MIB", "nePrimaryActive"), ("COMPANY-MIB", "nePrimaryBypass"), ("COMPANY-MIB", "neSecondaryActive"), ("COMPANY-MIB", "neSecondaryStandBy"), ("COMPANY-MIB", "neSecondaryBypass"), ("COMPANY-MIB", "collTableOverFlow"), ("COMPANY-MIB", "neAlertEvent")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): neNotificationsGroup = neNotificationsGroup.setStatus('current') if mibBuilder.loadTexts: neNotificationsGroup.setDescription('The notifications which indicate specific changes of the NE state.') mibBuilder.exportSymbols("COMPANY-MIB", nePrimaryBypass=nePrimaryBypass, nePrimaryActive=nePrimaryActive, neSecondaryBypass=neSecondaryBypass, PYSNMP_MODULE_ID=allotCom, neSecondaryActive=neSecondaryActive, allotCom=allotCom, collTableOverFlow=collTableOverFlow, neNotificationsGroup=neNotificationsGroup, neTraps=neTraps, neSecondaryStandBy=neSecondaryStandBy, neAlertEvent=neAlertEvent)
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (mib_scalar, mib_table, mib_table_row, mib_table_column, iso, bits, time_ticks, counter64, ip_address, mib_identifier, counter32, gauge32, notification_type, object_identity, enterprises, unsigned32, integer32, module_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'Bits', 'TimeTicks', 'Counter64', 'IpAddress', 'MibIdentifier', 'Counter32', 'Gauge32', 'NotificationType', 'ObjectIdentity', 'enterprises', 'Unsigned32', 'Integer32', 'ModuleIdentity') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') allot_com = module_identity((1, 3, 6, 1, 4, 1, 2603)) if mibBuilder.loadTexts: allotCom.setLastUpdated('0103120000Z') if mibBuilder.loadTexts: allotCom.setOrganization('Allot Communications') if mibBuilder.loadTexts: allotCom.setContactInfo('Allot Communications postal: 5 Hanagar St. Industrial Zone Neve Neeman Hod Hasharon 45800 Israel phone: +972-(0)9-761-9200 fax: +972-(0)9-744-3626 email: support@allot.com') if mibBuilder.loadTexts: allotCom.setDescription('This file defines the private Allot SNMP MIB extensions.') ne_traps = mib_identifier((1, 3, 6, 1, 4, 1, 2603, 2)) ne_primary_active = notification_type((1, 3, 6, 1, 4, 1, 2603, 2, 11)) if mibBuilder.loadTexts: nePrimaryActive.setStatus('current') if mibBuilder.loadTexts: nePrimaryActive.setDescription('This trap is sent when the primary NE changes to Active mode') ne_primary_bypass = notification_type((1, 3, 6, 1, 4, 1, 2603, 2, 12)) if mibBuilder.loadTexts: nePrimaryBypass.setStatus('current') if mibBuilder.loadTexts: nePrimaryBypass.setDescription('This trap is sent when the primary NE changes to Bypass mode') ne_secondary_active = notification_type((1, 3, 6, 1, 4, 1, 2603, 2, 13)) if mibBuilder.loadTexts: neSecondaryActive.setStatus('current') if mibBuilder.loadTexts: neSecondaryActive.setDescription('This trap is sent when the secondary NE changes to Active mode') ne_secondary_stand_by = notification_type((1, 3, 6, 1, 4, 1, 2603, 2, 14)) if mibBuilder.loadTexts: neSecondaryStandBy.setStatus('current') if mibBuilder.loadTexts: neSecondaryStandBy.setDescription('This trap is sent when the secondary NE changes to StandBy mode') ne_secondary_bypass = notification_type((1, 3, 6, 1, 4, 1, 2603, 2, 15)) if mibBuilder.loadTexts: neSecondaryBypass.setStatus('current') if mibBuilder.loadTexts: neSecondaryBypass.setDescription('This trap is sent when the secondary NE changes to Bypass mode') coll_table_over_flow = notification_type((1, 3, 6, 1, 4, 1, 2603, 2, 21)) if mibBuilder.loadTexts: collTableOverFlow.setStatus('current') if mibBuilder.loadTexts: collTableOverFlow.setDescription('This trap is sent when acounting is not reading from the collector which causes the collector table to exceeds limits') ne_alert_event = notification_type((1, 3, 6, 1, 4, 1, 2603, 2, 22)) if mibBuilder.loadTexts: neAlertEvent.setStatus('current') if mibBuilder.loadTexts: neAlertEvent.setDescription('This trap is sent when user defined event occurs') ne_notifications_group = notification_group((1, 3, 6, 1, 4, 1, 2603, 3)).setObjects(('COMPANY-MIB', 'nePrimaryActive'), ('COMPANY-MIB', 'nePrimaryBypass'), ('COMPANY-MIB', 'neSecondaryActive'), ('COMPANY-MIB', 'neSecondaryStandBy'), ('COMPANY-MIB', 'neSecondaryBypass'), ('COMPANY-MIB', 'collTableOverFlow'), ('COMPANY-MIB', 'neAlertEvent')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ne_notifications_group = neNotificationsGroup.setStatus('current') if mibBuilder.loadTexts: neNotificationsGroup.setDescription('The notifications which indicate specific changes of the NE state.') mibBuilder.exportSymbols('COMPANY-MIB', nePrimaryBypass=nePrimaryBypass, nePrimaryActive=nePrimaryActive, neSecondaryBypass=neSecondaryBypass, PYSNMP_MODULE_ID=allotCom, neSecondaryActive=neSecondaryActive, allotCom=allotCom, collTableOverFlow=collTableOverFlow, neNotificationsGroup=neNotificationsGroup, neTraps=neTraps, neSecondaryStandBy=neSecondaryStandBy, neAlertEvent=neAlertEvent)
input_tokenizer = {} input_tokenizer['en-bg'] = '-l en -a' input_tokenizer['en-cs'] = '-l en -a' input_tokenizer['en-de'] = '-l en -a' input_tokenizer['en-el'] = '-l en -a' input_tokenizer['en-hr'] = '-l en -a' input_tokenizer['en-it'] = '-l en -a' input_tokenizer['en-nl'] = '-l en -a' input_tokenizer['en-pl'] = '-l en -a' input_tokenizer['en-pt'] = '-l en -a' input_tokenizer['en-ru'] = '-l en -a' input_tokenizer['en-zh'] = '-l en -a'
input_tokenizer = {} input_tokenizer['en-bg'] = '-l en -a' input_tokenizer['en-cs'] = '-l en -a' input_tokenizer['en-de'] = '-l en -a' input_tokenizer['en-el'] = '-l en -a' input_tokenizer['en-hr'] = '-l en -a' input_tokenizer['en-it'] = '-l en -a' input_tokenizer['en-nl'] = '-l en -a' input_tokenizer['en-pl'] = '-l en -a' input_tokenizer['en-pt'] = '-l en -a' input_tokenizer['en-ru'] = '-l en -a' input_tokenizer['en-zh'] = '-l en -a'
""" The TreeNode represents node in a Tree. This module is perfect for Binary Tree but their implementation needs restructuring of the TreeNode for other Tree types. """ class TreeNode(object): """ Node in a Tree has arguments data,link[0]-leftlink,link[0]-right link emptiness of a TreeNode is indicated by self.data==None """ ### The Default Initializer def __init__(self,data=None,link0=None,link1=None): self.data=data self.link=[] self.link.append(link0) self.link.append(link1) ### Data in the Tree Node is to be returned def getData(self): return self.data ### Compare Method needs to compare only the data. ### Since comparing the subTree Nodes depends on the Tree implementation ### B-Tree , B+ Tree , AVL, Binary Search Tree needs modifications in their compare method ### This TreeNode just need to care about the data present in it ### ### Compare Two Nodes ### -1 if self.data is less than that of arguments ### 0 if both are equal ### 1 if self.data is greater than that of argument def compare(self,Node2): if(self.data==None and Node2.data==None): return True if((self.data!=None and Node2.data==None) or (self.data!=None and Node2.data==None) ): return False if(self.data==Node2.data): return True else: return False NullNode=TreeNode()
""" The TreeNode represents node in a Tree. This module is perfect for Binary Tree but their implementation needs restructuring of the TreeNode for other Tree types. """ class Treenode(object): """ Node in a Tree has arguments data,link[0]-leftlink,link[0]-right link emptiness of a TreeNode is indicated by self.data==None """ def __init__(self, data=None, link0=None, link1=None): self.data = data self.link = [] self.link.append(link0) self.link.append(link1) def get_data(self): return self.data def compare(self, Node2): if self.data == None and Node2.data == None: return True if self.data != None and Node2.data == None or (self.data != None and Node2.data == None): return False if self.data == Node2.data: return True else: return False null_node = tree_node()
#Task No. 3 def FindPath(graph,start,end,path=[]): path = path + [start]; if (start == end): return path if (start not in graph): return None for node in graph[start]: if node not in path: path = FindPath(graph,node,end,path) if path: return path return None graph_1 = {1:[2,5],2:[1,3,5],3:[2,4],4:[3,5,6],5:[1,2,4],6:[4]} print(FindPath(graph_1,6,1,[]))
def find_path(graph, start, end, path=[]): path = path + [start] if start == end: return path if start not in graph: return None for node in graph[start]: if node not in path: path = find_path(graph, node, end, path) if path: return path return None graph_1 = {1: [2, 5], 2: [1, 3, 5], 3: [2, 4], 4: [3, 5, 6], 5: [1, 2, 4], 6: [4]} print(find_path(graph_1, 6, 1, []))
class Node: def __init__(self, value=None): self.value = value self.next = None class linkedList: def __init__(self): self.head=None self.tail=None def __iter__ (self): curNode = self.head while curNode: yield curNode curNode=curNode.next class Stack: def __init__(self): self.linkedList=linkedList() def __str__(self): if self.isEmpty(): return "Empty Stack" else: cal = [str(x.value) for x in self.linkedList] return '\n'.join(cal) def isEmpty(self): if self.linkedList.head==None: return True else: return False def push(self,value): node = Node(value) node.next=self.linkedList.head self.linkedList.head=node def pop(self): if self.isEmpty(): return "Empty Stack" else: nV=self.linkedList.head.value self.linkedList.head = self.linkedList.head.next return nV def peek(self): #show the top element if self.isEmpty(): return "Empty Stack" else: nV=self.linkedList.head.value return nV def deleteL(self): self.linkedList.head=None cStack = Stack() print(cStack.isEmpty()) print(cStack.push(1)) print(cStack.push(2)) print(cStack.push(3)) print(cStack.push(4)) print(cStack) print("0----") print(cStack.pop()) print(cStack.peek())
class Node: def __init__(self, value=None): self.value = value self.next = None class Linkedlist: def __init__(self): self.head = None self.tail = None def __iter__(self): cur_node = self.head while curNode: yield curNode cur_node = curNode.next class Stack: def __init__(self): self.linkedList = linked_list() def __str__(self): if self.isEmpty(): return 'Empty Stack' else: cal = [str(x.value) for x in self.linkedList] return '\n'.join(cal) def is_empty(self): if self.linkedList.head == None: return True else: return False def push(self, value): node = node(value) node.next = self.linkedList.head self.linkedList.head = node def pop(self): if self.isEmpty(): return 'Empty Stack' else: n_v = self.linkedList.head.value self.linkedList.head = self.linkedList.head.next return nV def peek(self): if self.isEmpty(): return 'Empty Stack' else: n_v = self.linkedList.head.value return nV def delete_l(self): self.linkedList.head = None c_stack = stack() print(cStack.isEmpty()) print(cStack.push(1)) print(cStack.push(2)) print(cStack.push(3)) print(cStack.push(4)) print(cStack) print('0----') print(cStack.pop()) print(cStack.peek())
#!/usr/bin/env python3 class Node: def __init__(self, value, left=None, right=None) -> None: self.value = value self.left = left self.right = right def right_most_child_with_parent(self): parent, curr = None, self while curr.right: parent = curr curr = curr.right return parent, curr def second_largest(root): if not root: return None prev, curr = root.right_most_child_with_parent() if curr.left: _, curr = curr.left.right_most_child_with_parent() return curr.value return prev.value if prev else prev """ 7 / 4 / \ 3 5 """ tree = Node(7, Node(4, Node(3), Node(5))) assert second_largest(tree) == 5 """ 5 / \ 4 7 / \ 6 9 / 8 """ tree = Node(5, Node(4), Node(7, Node(6), Node(9, Node(8)))) assert second_largest(tree) == 8 """ 5 """ tree = Node(5) assert second_largest(tree) == None """ 5 \ 7 \ 10 / 9 / 8 """ tree = Node(5, right=Node(7, right=Node(10, left=Node(9, left=Node(8))))) assert second_largest(tree) == 9
class Node: def __init__(self, value, left=None, right=None) -> None: self.value = value self.left = left self.right = right def right_most_child_with_parent(self): (parent, curr) = (None, self) while curr.right: parent = curr curr = curr.right return (parent, curr) def second_largest(root): if not root: return None (prev, curr) = root.right_most_child_with_parent() if curr.left: (_, curr) = curr.left.right_most_child_with_parent() return curr.value return prev.value if prev else prev '\n 7\n /\n 4\n / 3 5 \n' tree = node(7, node(4, node(3), node(5))) assert second_largest(tree) == 5 '\n 5\n / 4 7\n / 6 9\n /\n 8\n' tree = node(5, node(4), node(7, node(6), node(9, node(8)))) assert second_largest(tree) == 8 '\n 5\n' tree = node(5) assert second_largest(tree) == None '\n 5\n 7\n 10\n /\n 9\n /\n 8 \n' tree = node(5, right=node(7, right=node(10, left=node(9, left=node(8))))) assert second_largest(tree) == 9
#!/usr/bin/python def is_member(item_to_check, list_to_check): ''' Checks if an item is in a list ''' for list_item in list_to_check: if item_to_check == list_item: return(True) return(False)
def is_member(item_to_check, list_to_check): """ Checks if an item is in a list """ for list_item in list_to_check: if item_to_check == list_item: return True return False
"""Generics support via go_generics. A Go template is similar to a go library, except that it has certain types that can be replaced before usage. For example, one could define a templatized List struct, whose elements are of type T, then instantiate that template for T=segment, where "segment" is the concrete type. """ TemplateInfo = provider( "Information about a go_generics template.", fields = { "unsafe": "whether the template requires unsafe code", "types": "required types", "opt_types": "optional types", "consts": "required consts", "opt_consts": "optional consts", "deps": "package dependencies", "template": "merged template source file", }, ) def _go_template_impl(ctx): srcs = ctx.files.srcs template = ctx.actions.declare_file(ctx.label.name + "_template.go") args = ["-o=%s" % template.path] + [f.path for f in srcs] ctx.actions.run( inputs = srcs, outputs = [template], mnemonic = "GoGenericsTemplate", progress_message = "Building Go template %s" % ctx.label, arguments = args, executable = ctx.executable._tool, ) return [TemplateInfo( types = ctx.attr.types, opt_types = ctx.attr.opt_types, consts = ctx.attr.consts, opt_consts = ctx.attr.opt_consts, deps = ctx.attr.deps, template = template, )] go_template = rule( implementation = _go_template_impl, attrs = { "srcs": attr.label_list(doc = "the list of source files that comprise the template", mandatory = True, allow_files = True), "deps": attr.label_list(doc = "the standard dependency list", allow_files = True, cfg = "target"), "types": attr.string_list(doc = "the list of generic types in the template that are required to be specified"), "opt_types": attr.string_list(doc = "the list of generic types in the template that can but aren't required to be specified"), "consts": attr.string_list(doc = "the list of constants in the template that are required to be specified"), "opt_consts": attr.string_list(doc = "the list of constants in the template that can but aren't required to be specified"), "_tool": attr.label(executable = True, cfg = "host", default = Label("//tools/go_generics/go_merge")), }, ) def _go_template_instance_impl(ctx): info = ctx.attr.template[TemplateInfo] output = ctx.outputs.out # Check that all required types are defined. for t in info.types: if t not in ctx.attr.types: fail("Missing value for type %s in %s" % (t, ctx.attr.template.label)) # Check that all defined types are expected by the template. for t in ctx.attr.types: if (t not in info.types) and (t not in info.opt_types): fail("Type %s is not a parameter to %s" % (t, ctx.attr.template.label)) # Check that all required consts are defined. for t in info.consts: if t not in ctx.attr.consts: fail("Missing value for constant %s in %s" % (t, ctx.attr.template.label)) # Check that all defined consts are expected by the template. for t in ctx.attr.consts: if (t not in info.consts) and (t not in info.opt_consts): fail("Const %s is not a parameter to %s" % (t, ctx.attr.template.label)) # Build the argument list. args = ["-i=%s" % info.template.path, "-o=%s" % output.path] if ctx.attr.package: args.append("-p=%s" % ctx.attr.package) if len(ctx.attr.prefix) > 0: args.append("-prefix=%s" % ctx.attr.prefix) if len(ctx.attr.suffix) > 0: args.append("-suffix=%s" % ctx.attr.suffix) args += [("-t=%s=%s" % (p[0], p[1])) for p in ctx.attr.types.items()] args += [("-c=%s=%s" % (p[0], p[1])) for p in ctx.attr.consts.items()] args += [("-import=%s=%s" % (p[0], p[1])) for p in ctx.attr.imports.items()] if ctx.attr.anon: args.append("-anon") ctx.actions.run( inputs = [info.template], outputs = [output], mnemonic = "GoGenericsInstance", progress_message = "Building Go template instance %s" % ctx.label, arguments = args, executable = ctx.executable._tool, ) return [DefaultInfo( files = depset([output]), )] go_template_instance = rule( implementation = _go_template_instance_impl, attrs = { "template": attr.label(doc = "the label of the template to be instantiated", mandatory = True), "prefix": attr.string(doc = "a prefix to be added to globals in the template"), "suffix": attr.string(doc = "a suffix to be added to globals in the template"), "types": attr.string_dict(doc = "the map from generic type names to concrete ones"), "consts": attr.string_dict(doc = "the map from constant names to their values"), "imports": attr.string_dict(doc = "the map from imports used in types/consts to their import paths"), "anon": attr.bool(doc = "whether anoymous fields should be processed", mandatory = False, default = False), "package": attr.string(doc = "the package for the generated source file", mandatory = False), "out": attr.output(doc = "output file", mandatory = True), "_tool": attr.label(executable = True, cfg = "host", default = Label("//tools/go_generics")), }, )
"""Generics support via go_generics. A Go template is similar to a go library, except that it has certain types that can be replaced before usage. For example, one could define a templatized List struct, whose elements are of type T, then instantiate that template for T=segment, where "segment" is the concrete type. """ template_info = provider('Information about a go_generics template.', fields={'unsafe': 'whether the template requires unsafe code', 'types': 'required types', 'opt_types': 'optional types', 'consts': 'required consts', 'opt_consts': 'optional consts', 'deps': 'package dependencies', 'template': 'merged template source file'}) def _go_template_impl(ctx): srcs = ctx.files.srcs template = ctx.actions.declare_file(ctx.label.name + '_template.go') args = ['-o=%s' % template.path] + [f.path for f in srcs] ctx.actions.run(inputs=srcs, outputs=[template], mnemonic='GoGenericsTemplate', progress_message='Building Go template %s' % ctx.label, arguments=args, executable=ctx.executable._tool) return [template_info(types=ctx.attr.types, opt_types=ctx.attr.opt_types, consts=ctx.attr.consts, opt_consts=ctx.attr.opt_consts, deps=ctx.attr.deps, template=template)] go_template = rule(implementation=_go_template_impl, attrs={'srcs': attr.label_list(doc='the list of source files that comprise the template', mandatory=True, allow_files=True), 'deps': attr.label_list(doc='the standard dependency list', allow_files=True, cfg='target'), 'types': attr.string_list(doc='the list of generic types in the template that are required to be specified'), 'opt_types': attr.string_list(doc="the list of generic types in the template that can but aren't required to be specified"), 'consts': attr.string_list(doc='the list of constants in the template that are required to be specified'), 'opt_consts': attr.string_list(doc="the list of constants in the template that can but aren't required to be specified"), '_tool': attr.label(executable=True, cfg='host', default=label('//tools/go_generics/go_merge'))}) def _go_template_instance_impl(ctx): info = ctx.attr.template[TemplateInfo] output = ctx.outputs.out for t in info.types: if t not in ctx.attr.types: fail('Missing value for type %s in %s' % (t, ctx.attr.template.label)) for t in ctx.attr.types: if t not in info.types and t not in info.opt_types: fail('Type %s is not a parameter to %s' % (t, ctx.attr.template.label)) for t in info.consts: if t not in ctx.attr.consts: fail('Missing value for constant %s in %s' % (t, ctx.attr.template.label)) for t in ctx.attr.consts: if t not in info.consts and t not in info.opt_consts: fail('Const %s is not a parameter to %s' % (t, ctx.attr.template.label)) args = ['-i=%s' % info.template.path, '-o=%s' % output.path] if ctx.attr.package: args.append('-p=%s' % ctx.attr.package) if len(ctx.attr.prefix) > 0: args.append('-prefix=%s' % ctx.attr.prefix) if len(ctx.attr.suffix) > 0: args.append('-suffix=%s' % ctx.attr.suffix) args += ['-t=%s=%s' % (p[0], p[1]) for p in ctx.attr.types.items()] args += ['-c=%s=%s' % (p[0], p[1]) for p in ctx.attr.consts.items()] args += ['-import=%s=%s' % (p[0], p[1]) for p in ctx.attr.imports.items()] if ctx.attr.anon: args.append('-anon') ctx.actions.run(inputs=[info.template], outputs=[output], mnemonic='GoGenericsInstance', progress_message='Building Go template instance %s' % ctx.label, arguments=args, executable=ctx.executable._tool) return [default_info(files=depset([output]))] go_template_instance = rule(implementation=_go_template_instance_impl, attrs={'template': attr.label(doc='the label of the template to be instantiated', mandatory=True), 'prefix': attr.string(doc='a prefix to be added to globals in the template'), 'suffix': attr.string(doc='a suffix to be added to globals in the template'), 'types': attr.string_dict(doc='the map from generic type names to concrete ones'), 'consts': attr.string_dict(doc='the map from constant names to their values'), 'imports': attr.string_dict(doc='the map from imports used in types/consts to their import paths'), 'anon': attr.bool(doc='whether anoymous fields should be processed', mandatory=False, default=False), 'package': attr.string(doc='the package for the generated source file', mandatory=False), 'out': attr.output(doc='output file', mandatory=True), '_tool': attr.label(executable=True, cfg='host', default=label('//tools/go_generics'))})
def includeme(config): # config.add_static_view('static', 'static', cache_max_age=3600) config.add_route('home', '/') config.add_route('hitori_boards', r'/hitori_boards') config.add_route('hitori_board', r'/hitori_boards/{board_id:\d+}') config.add_route('hitori_board_solve', r'/hitori_boards/{board_id:\d+}/solve') config.add_route('hitori_board_clone', r'/hitori_boards/{board_id:\d+}/clone') config.add_route('hitori_solves', r'/hitori_solves') config.add_route('hitori_solve', r'/hitori_solves/{solve_id:\d+}') config.add_route('hitori_cell_value', r'/hitori_cells/{cell_id:\d+}/value')
def includeme(config): config.add_route('home', '/') config.add_route('hitori_boards', '/hitori_boards') config.add_route('hitori_board', '/hitori_boards/{board_id:\\d+}') config.add_route('hitori_board_solve', '/hitori_boards/{board_id:\\d+}/solve') config.add_route('hitori_board_clone', '/hitori_boards/{board_id:\\d+}/clone') config.add_route('hitori_solves', '/hitori_solves') config.add_route('hitori_solve', '/hitori_solves/{solve_id:\\d+}') config.add_route('hitori_cell_value', '/hitori_cells/{cell_id:\\d+}/value')
vetor = [] i = 1 while(i <= 100): valor = int(input()) vetor.append(valor) i = i + 1 print(max(vetor)) print(vetor.index(max(vetor)) + 1)
vetor = [] i = 1 while i <= 100: valor = int(input()) vetor.append(valor) i = i + 1 print(max(vetor)) print(vetor.index(max(vetor)) + 1)
def test_length_ko_1_adb(style_checker): """Check length-ko-1.adb """ style_checker.set_year(2006) p = style_checker.run_style_checker('gnat', 'length-ko-1.adb') style_checker.assertNotEqual(p.status, 0, p.image) style_checker.assertRunOutputEqual(p, """\ length-ko-1.adb:50:80: (style) this line is too long """) def test_length_ko_2_c(style_checker): """Check length-ko-2.c """ style_checker.set_year(2006) p = style_checker.run_style_checker('gnat', 'length-ko-2.c') style_checker.assertEqual(p.status, 0, p.image) style_checker.assertRunOutputEmpty(p) def test_misc_ok_1_c(style_checker): """Check misc-ok-1.c """ style_checker.set_year(2006) p = style_checker.run_style_checker('gnat', 'misc-ok-1.c') style_checker.assertEqual(p.status, 0, p.image) style_checker.assertRunOutputEmpty(p)
def test_length_ko_1_adb(style_checker): """Check length-ko-1.adb """ style_checker.set_year(2006) p = style_checker.run_style_checker('gnat', 'length-ko-1.adb') style_checker.assertNotEqual(p.status, 0, p.image) style_checker.assertRunOutputEqual(p, 'length-ko-1.adb:50:80: (style) this line is too long\n') def test_length_ko_2_c(style_checker): """Check length-ko-2.c """ style_checker.set_year(2006) p = style_checker.run_style_checker('gnat', 'length-ko-2.c') style_checker.assertEqual(p.status, 0, p.image) style_checker.assertRunOutputEmpty(p) def test_misc_ok_1_c(style_checker): """Check misc-ok-1.c """ style_checker.set_year(2006) p = style_checker.run_style_checker('gnat', 'misc-ok-1.c') style_checker.assertEqual(p.status, 0, p.image) style_checker.assertRunOutputEmpty(p)
"""Constants for dice-ml package.""" class BackEndTypes: Sklearn = 'sklearn' Tensorflow1 = 'TF1' Tensorflow2 = 'TF2' Pytorch = 'PYT' class SamplingStrategy: Random = 'random' Genetic = 'genetic' KdTree = 'kdtree'
"""Constants for dice-ml package.""" class Backendtypes: sklearn = 'sklearn' tensorflow1 = 'TF1' tensorflow2 = 'TF2' pytorch = 'PYT' class Samplingstrategy: random = 'random' genetic = 'genetic' kd_tree = 'kdtree'
class BasePairType: def __init__( self, nt1, nt2, Kd, match_lowercase = False ): ''' Two sequence characters that get matched to base pair, e.g., 'C' and 'G'; and the dissociation constant K_d (in M) associated with initial pair formation. match_lowercase means match 'x' to 'x', 'y' to 'y', etc. TODO: also store chemical modification info. ''' self.nt1 = nt1 self.nt2 = nt2 self.Kd = Kd self.match_lowercase = ( nt1 == '*' and nt2 == '*' and match_lowercase ) self.flipped = self # needs up be updated later. def is_match( self, s1, s2 ): if self.match_lowercase: return ( s1.islower() and s2.islower() and s1 == s2 ) return ( s1 == self.nt1 and s2 == self.nt2 ) def get_tag( self ): if self.match_lowercase: return 'matchlowercase' return self.nt1+self.nt2 def setup_base_pair_type( params, nt1, nt2, Kd, match_lowercase = False ): if not hasattr( params, 'base_pair_types' ): params.base_pair_types = [] bpt1 = BasePairType( nt1, nt2, Kd, match_lowercase = match_lowercase ) params.base_pair_types.append( bpt1 ) if not match_lowercase: bpt2 = BasePairType( nt2, nt1, Kd, match_lowercase = match_lowercase ) bpt1.flipped = bpt2 bpt2.flipped = bpt1 params.base_pair_types.append( bpt2 ) def get_base_pair_type_for_tag( params, tag ): if not hasattr( params, 'base_pair_types' ): return None for base_pair_type in params.base_pair_types: if (tag == 'matchlowercase' and base_pair_type.match_lowercase) or \ (tag == base_pair_type.nt1 + base_pair_type.nt2 ): return base_pair_type #print( 'Could not figure out base_pair_type for ', tag ) return None def get_base_pair_types_for_tag( params, tag ): if not hasattr( params, 'base_pair_types' ): return None if tag == 'WC': WC_nts = [('C','G'),('G','C'),('A','U'),('U','A')] # ,('G','U'),('U','G')] base_pair_types = [] for base_pair_type in params.base_pair_types: if (base_pair_type.nt1,base_pair_type.nt2) in WC_nts: base_pair_types.append( base_pair_type ) return base_pair_types else: return [ get_base_pair_type_for_tag( params, tag ) ] return None def initialize_base_pair_types( self ): self.base_pair_types = []
class Basepairtype: def __init__(self, nt1, nt2, Kd, match_lowercase=False): """ Two sequence characters that get matched to base pair, e.g., 'C' and 'G'; and the dissociation constant K_d (in M) associated with initial pair formation. match_lowercase means match 'x' to 'x', 'y' to 'y', etc. TODO: also store chemical modification info. """ self.nt1 = nt1 self.nt2 = nt2 self.Kd = Kd self.match_lowercase = nt1 == '*' and nt2 == '*' and match_lowercase self.flipped = self def is_match(self, s1, s2): if self.match_lowercase: return s1.islower() and s2.islower() and (s1 == s2) return s1 == self.nt1 and s2 == self.nt2 def get_tag(self): if self.match_lowercase: return 'matchlowercase' return self.nt1 + self.nt2 def setup_base_pair_type(params, nt1, nt2, Kd, match_lowercase=False): if not hasattr(params, 'base_pair_types'): params.base_pair_types = [] bpt1 = base_pair_type(nt1, nt2, Kd, match_lowercase=match_lowercase) params.base_pair_types.append(bpt1) if not match_lowercase: bpt2 = base_pair_type(nt2, nt1, Kd, match_lowercase=match_lowercase) bpt1.flipped = bpt2 bpt2.flipped = bpt1 params.base_pair_types.append(bpt2) def get_base_pair_type_for_tag(params, tag): if not hasattr(params, 'base_pair_types'): return None for base_pair_type in params.base_pair_types: if tag == 'matchlowercase' and base_pair_type.match_lowercase or tag == base_pair_type.nt1 + base_pair_type.nt2: return base_pair_type return None def get_base_pair_types_for_tag(params, tag): if not hasattr(params, 'base_pair_types'): return None if tag == 'WC': wc_nts = [('C', 'G'), ('G', 'C'), ('A', 'U'), ('U', 'A')] base_pair_types = [] for base_pair_type in params.base_pair_types: if (base_pair_type.nt1, base_pair_type.nt2) in WC_nts: base_pair_types.append(base_pair_type) return base_pair_types else: return [get_base_pair_type_for_tag(params, tag)] return None def initialize_base_pair_types(self): self.base_pair_types = []
def getdefaultencoding(space): """Return the current default string encoding used by the Unicode implementation.""" return space.wrap(space.sys.defaultencoding) def setdefaultencoding(space, w_encoding): """Set the current default string encoding used by the Unicode implementation.""" encoding = space.str_w(w_encoding) mod = space.getbuiltinmodule("_codecs") w_lookup = space.getattr(mod, space.wrap("lookup")) # check whether the encoding is there space.call_function(w_lookup, w_encoding) space.sys.w_default_encoder = None space.sys.defaultencoding = encoding def get_w_default_encoder(space): w_encoding = space.wrap(space.sys.defaultencoding) mod = space.getbuiltinmodule("_codecs") w_lookup = space.getattr(mod, space.wrap("lookup")) w_functuple = space.call_function(w_lookup, w_encoding) w_encoder = space.getitem(w_functuple, space.wrap(0)) space.sys.w_default_encoder = w_encoder # cache it return w_encoder
def getdefaultencoding(space): """Return the current default string encoding used by the Unicode implementation.""" return space.wrap(space.sys.defaultencoding) def setdefaultencoding(space, w_encoding): """Set the current default string encoding used by the Unicode implementation.""" encoding = space.str_w(w_encoding) mod = space.getbuiltinmodule('_codecs') w_lookup = space.getattr(mod, space.wrap('lookup')) space.call_function(w_lookup, w_encoding) space.sys.w_default_encoder = None space.sys.defaultencoding = encoding def get_w_default_encoder(space): w_encoding = space.wrap(space.sys.defaultencoding) mod = space.getbuiltinmodule('_codecs') w_lookup = space.getattr(mod, space.wrap('lookup')) w_functuple = space.call_function(w_lookup, w_encoding) w_encoder = space.getitem(w_functuple, space.wrap(0)) space.sys.w_default_encoder = w_encoder return w_encoder
class StructLayoutAttribute(Attribute, _Attribute): """ Lets you control the physical layout of the data fields of a class or structure. StructLayoutAttribute(layoutKind: LayoutKind) StructLayoutAttribute(layoutKind: Int16) """ def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self, layoutKind): """ __new__(cls: type,layoutKind: LayoutKind) __new__(cls: type,layoutKind: Int16) """ pass Value = property(lambda self: object(), lambda self, v: None, lambda self: None) """Gets the System.Runtime.InteropServices.LayoutKind value that specifies how the class or structure is arranged. Get: Value(self: StructLayoutAttribute) -> LayoutKind """ CharSet = None Pack = None Size = None
class Structlayoutattribute(Attribute, _Attribute): """ Lets you control the physical layout of the data fields of a class or structure. StructLayoutAttribute(layoutKind: LayoutKind) StructLayoutAttribute(layoutKind: Int16) """ def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self, layoutKind): """ __new__(cls: type,layoutKind: LayoutKind) __new__(cls: type,layoutKind: Int16) """ pass value = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets the System.Runtime.InteropServices.LayoutKind value that specifies how the class or structure is arranged.\n\n\n\nGet: Value(self: StructLayoutAttribute) -> LayoutKind\n\n\n\n' char_set = None pack = None size = None
#lista de cores para menu: #cor da letra limpa = '\033[m' Lbranco = '\033[30m' Lvermelho = '\033[31m' Lverde = '\033[32m' Lamarelo = '\033[33m' Lazul = '\033[34m' Lroxo = '\033[35m' Lazulclaro = '\033[36' Lcinza = '\033[37' #Fundo Fbranco = '\033[40m' Fvermelho = '\033[41m' Fverde = '\033[42m' Famarelo = '\033[43m' Fazul = '\033[44m' Froxo = '\033[45m' Fazulclaro = '\033[46m' Fcinza = '\033[46m'
limpa = '\x1b[m' lbranco = '\x1b[30m' lvermelho = '\x1b[31m' lverde = '\x1b[32m' lamarelo = '\x1b[33m' lazul = '\x1b[34m' lroxo = '\x1b[35m' lazulclaro = '\x1b[36' lcinza = '\x1b[37' fbranco = '\x1b[40m' fvermelho = '\x1b[41m' fverde = '\x1b[42m' famarelo = '\x1b[43m' fazul = '\x1b[44m' froxo = '\x1b[45m' fazulclaro = '\x1b[46m' fcinza = '\x1b[46m'
def get_user_id(user_or_id): if type(user_or_id) is str or type(user_or_id) is int: return str(user_or_id) elif hasattr(user_or_id, '__getitem__') and 'user_id' in user_or_id: return str(user_or_id['user_id']) elif hasattr(user_or_id, 'user_id'): return str(user_or_id.user_id) return None def truncate_list_length(lst, length, *, add_per_element=0): total_length = 0 for i, elem in enumerate(lst): total_length += len(elem) + add_per_element if total_length > length: return lst[0:i] return lst def mention_users(users, max_count, max_length, *, join="\n", prefix=" - "): trunc_users = users[0:max_count] trunc_message = '_...and {} more._' max_trunc_len = len(str(len(users))) max_message_len = len(trunc_message.format(' ' * max_trunc_len)) final_max_len = max(0, max_length-max_message_len) user_strs = truncate_list_length( [f"{prefix}<@{get_user_id(user)}>" for user in trunc_users], final_max_len, add_per_element=len(join) ) trunc_count = (len(users) - len(trunc_users)) + (len(trunc_users) - len(user_strs)) out_msg = join.join(user_strs) + (trunc_message and join + trunc_message.format(trunc_count) or '') if (len(out_msg) > max_length) and final_max_len >= 3: return '...' elif len(out_msg) > max_length: return '' else: return out_msg def id_from_mention(mention): try: return int(mention.replace('<', '').replace('!', '').replace('>', '').replace('@', '')) except: return False
def get_user_id(user_or_id): if type(user_or_id) is str or type(user_or_id) is int: return str(user_or_id) elif hasattr(user_or_id, '__getitem__') and 'user_id' in user_or_id: return str(user_or_id['user_id']) elif hasattr(user_or_id, 'user_id'): return str(user_or_id.user_id) return None def truncate_list_length(lst, length, *, add_per_element=0): total_length = 0 for (i, elem) in enumerate(lst): total_length += len(elem) + add_per_element if total_length > length: return lst[0:i] return lst def mention_users(users, max_count, max_length, *, join='\n', prefix=' - '): trunc_users = users[0:max_count] trunc_message = '_...and {} more._' max_trunc_len = len(str(len(users))) max_message_len = len(trunc_message.format(' ' * max_trunc_len)) final_max_len = max(0, max_length - max_message_len) user_strs = truncate_list_length([f'{prefix}<@{get_user_id(user)}>' for user in trunc_users], final_max_len, add_per_element=len(join)) trunc_count = len(users) - len(trunc_users) + (len(trunc_users) - len(user_strs)) out_msg = join.join(user_strs) + (trunc_message and join + trunc_message.format(trunc_count) or '') if len(out_msg) > max_length and final_max_len >= 3: return '...' elif len(out_msg) > max_length: return '' else: return out_msg def id_from_mention(mention): try: return int(mention.replace('<', '').replace('!', '').replace('>', '').replace('@', '')) except: return False
load("@io_bazel_rules_docker//container:container.bzl", _container_push = "container_push") def container_push(*args, **kwargs): """Creates a script to push a container image to a Docker registry. The target name must be specified when invoking the push script.""" if "registry" in kwargs: fail( "Cannot set 'registry' attribute on container_push", attr = "registry", ) if "repository" in kwargs: fail( "Cannot set 'repository' attribute on container_push", attr = "repository", ) kwargs["registry"] = "IGNORE" kwargs["repository"] = "IGNORE" _container_push(*args, **kwargs)
load('@io_bazel_rules_docker//container:container.bzl', _container_push='container_push') def container_push(*args, **kwargs): """Creates a script to push a container image to a Docker registry. The target name must be specified when invoking the push script.""" if 'registry' in kwargs: fail("Cannot set 'registry' attribute on container_push", attr='registry') if 'repository' in kwargs: fail("Cannot set 'repository' attribute on container_push", attr='repository') kwargs['registry'] = 'IGNORE' kwargs['repository'] = 'IGNORE' _container_push(*args, **kwargs)
#!/usr/bin/env python class bresenham: def __init__(self, start, end): self.start = list(start) self.end = list(end) self.path = [] self.steep = abs(self.end[1]-self.start[1]) > abs(self.end[0]-self.start[0]) if self.steep: # print 'Steep' self.start = self.swap(self.start[0],self.start[1]) self.end = self.swap(self.end[0],self.end[1]) if self.start[0] > self.end[0]: # print 'flippin and floppin' _x0 = int(self.start[0]) _x1 = int(self.end[0]) self.start[0] = _x1 self.end[0] = _x0 _y0 = int(self.start[1]) _y1 = int(self.end[1]) self.start[1] = _y1 self.end[1] = _y0 dx = self.end[0] - self.start[0] dy = abs(self.end[1] - self.start[1]) error = 0 derr = dy/float(dx) ystep = 0 y = self.start[1] if self.start[1] < self.end[1]: ystep = 1 else: ystep = -1 for x in range(self.start[0],self.end[0]+1): if self.steep: self.path.append((y,x)) else: self.path.append((x,y)) error += derr if error >= 0.5: y += ystep error -= 1.0 def swap(self,n1,n2): return [n2,n1] """ l = bresenham([8,1],[6,4]) print l.path map = [] for x in range(0,15): yc = [] for y in range(0,15): yc.append('#') map.append(yc) for pos in l.path: map[pos[0]][pos[1]] = '.' for y in range(0,15): for x in range(0,15): print map[x][y], print """
class Bresenham: def __init__(self, start, end): self.start = list(start) self.end = list(end) self.path = [] self.steep = abs(self.end[1] - self.start[1]) > abs(self.end[0] - self.start[0]) if self.steep: self.start = self.swap(self.start[0], self.start[1]) self.end = self.swap(self.end[0], self.end[1]) if self.start[0] > self.end[0]: _x0 = int(self.start[0]) _x1 = int(self.end[0]) self.start[0] = _x1 self.end[0] = _x0 _y0 = int(self.start[1]) _y1 = int(self.end[1]) self.start[1] = _y1 self.end[1] = _y0 dx = self.end[0] - self.start[0] dy = abs(self.end[1] - self.start[1]) error = 0 derr = dy / float(dx) ystep = 0 y = self.start[1] if self.start[1] < self.end[1]: ystep = 1 else: ystep = -1 for x in range(self.start[0], self.end[0] + 1): if self.steep: self.path.append((y, x)) else: self.path.append((x, y)) error += derr if error >= 0.5: y += ystep error -= 1.0 def swap(self, n1, n2): return [n2, n1] "\nl = bresenham([8,1],[6,4])\nprint l.path\n\nmap = []\nfor x in range(0,15):\n\tyc = []\n\tfor y in range(0,15):\n\t\tyc.append('#')\n\tmap.append(yc)\n\nfor pos in l.path:\n\tmap[pos[0]][pos[1]] = '.'\n\nfor y in range(0,15):\n\tfor x in range(0,15):\n\t\tprint map[x][y],\n\tprint\n"
# # PySNMP MIB module PROXY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PROXY-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:33:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Unsigned32, Counter32, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, Integer32, iso, Counter64, ObjectIdentity, MibIdentifier, IpAddress, NotificationType, TimeTicks, Bits, experimental = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "Counter32", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "Integer32", "iso", "Counter64", "ObjectIdentity", "MibIdentifier", "IpAddress", "NotificationType", "TimeTicks", "Bits", "experimental") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") nsfnet = MibIdentifier((1, 3, 6, 1, 3, 25)) proxy = ModuleIdentity((1, 3, 6, 1, 3, 25, 17)) proxy.setRevisions(('1998-08-26 00:00',)) if mibBuilder.loadTexts: proxy.setLastUpdated('9809010000Z') if mibBuilder.loadTexts: proxy.setOrganization('National Laboratory for Applied Network Research') proxySystem = MibIdentifier((1, 3, 6, 1, 3, 25, 17, 1)) proxyConfig = MibIdentifier((1, 3, 6, 1, 3, 25, 17, 2)) proxyPerf = MibIdentifier((1, 3, 6, 1, 3, 25, 17, 3)) proxyMemUsage = MibScalar((1, 3, 6, 1, 3, 25, 17, 1, 1), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyMemUsage.setStatus('current') proxyStorage = MibScalar((1, 3, 6, 1, 3, 25, 17, 1, 2), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyStorage.setStatus('current') proxyCpuUsage = MibScalar((1, 3, 6, 1, 3, 25, 17, 1, 3), Unsigned32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyCpuUsage.setStatus('current') proxyUpTime = MibScalar((1, 3, 6, 1, 3, 25, 17, 1, 4), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyUpTime.setStatus('current') proxyAdmin = MibScalar((1, 3, 6, 1, 3, 25, 17, 2, 1), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyAdmin.setStatus('current') proxySoftware = MibScalar((1, 3, 6, 1, 3, 25, 17, 2, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxySoftware.setStatus('current') proxyVersion = MibScalar((1, 3, 6, 1, 3, 25, 17, 2, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyVersion.setStatus('current') proxySysPerf = MibIdentifier((1, 3, 6, 1, 3, 25, 17, 3, 1)) proxyProtoPerf = MibIdentifier((1, 3, 6, 1, 3, 25, 17, 3, 2)) proxyCpuLoad = MibScalar((1, 3, 6, 1, 3, 25, 17, 3, 1, 1), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyCpuLoad.setStatus('current') proxyNumObjects = MibScalar((1, 3, 6, 1, 3, 25, 17, 3, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyNumObjects.setStatus('current') proxyProtoClient = MibIdentifier((1, 3, 6, 1, 3, 25, 17, 3, 2, 1)) proxyProtoServer = MibIdentifier((1, 3, 6, 1, 3, 25, 17, 3, 2, 2)) proxyClientHttpRequests = MibScalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyClientHttpRequests.setStatus('current') proxyClientHttpHits = MibScalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyClientHttpHits.setStatus('current') proxyClientHttpErrors = MibScalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyClientHttpErrors.setStatus('current') proxyClientHttpInKbs = MibScalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyClientHttpInKbs.setStatus('current') proxyClientHttpOutKbs = MibScalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyClientHttpOutKbs.setStatus('current') proxyServerHttpRequests = MibScalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 2, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyServerHttpRequests.setStatus('current') proxyServerHttpErrors = MibScalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 2, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyServerHttpErrors.setStatus('current') proxyServerHttpInKbs = MibScalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 2, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyServerHttpInKbs.setStatus('current') proxyServerHttpOutKbs = MibScalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 2, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyServerHttpOutKbs.setStatus('current') proxyMedianSvcTable = MibTable((1, 3, 6, 1, 3, 25, 17, 3, 3), ) if mibBuilder.loadTexts: proxyMedianSvcTable.setStatus('current') proxyMedianSvcEntry = MibTableRow((1, 3, 6, 1, 3, 25, 17, 3, 3, 1), ).setIndexNames((0, "PROXY-MIB", "proxyMedianTime")) if mibBuilder.loadTexts: proxyMedianSvcEntry.setStatus('current') proxyMedianTime = MibTableColumn((1, 3, 6, 1, 3, 25, 17, 3, 3, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyMedianTime.setStatus('current') proxyHTTPAllSvcTime = MibTableColumn((1, 3, 6, 1, 3, 25, 17, 3, 3, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyHTTPAllSvcTime.setStatus('current') proxyHTTPMissSvcTime = MibTableColumn((1, 3, 6, 1, 3, 25, 17, 3, 3, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyHTTPMissSvcTime.setStatus('current') proxyHTTPHitSvcTime = MibTableColumn((1, 3, 6, 1, 3, 25, 17, 3, 3, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyHTTPHitSvcTime.setStatus('current') proxyHTTPNhSvcTime = MibTableColumn((1, 3, 6, 1, 3, 25, 17, 3, 3, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyHTTPNhSvcTime.setStatus('current') proxyDnsSvcTime = MibTableColumn((1, 3, 6, 1, 3, 25, 17, 3, 3, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: proxyDnsSvcTime.setStatus('current') mibBuilder.exportSymbols("PROXY-MIB", proxyStorage=proxyStorage, proxyMemUsage=proxyMemUsage, proxyServerHttpInKbs=proxyServerHttpInKbs, proxySystem=proxySystem, proxyAdmin=proxyAdmin, nsfnet=nsfnet, proxyHTTPHitSvcTime=proxyHTTPHitSvcTime, proxyUpTime=proxyUpTime, proxySoftware=proxySoftware, proxyClientHttpRequests=proxyClientHttpRequests, proxyServerHttpOutKbs=proxyServerHttpOutKbs, proxy=proxy, proxyPerf=proxyPerf, proxyProtoServer=proxyProtoServer, proxyProtoPerf=proxyProtoPerf, proxyNumObjects=proxyNumObjects, proxyDnsSvcTime=proxyDnsSvcTime, proxyMedianSvcEntry=proxyMedianSvcEntry, proxyHTTPAllSvcTime=proxyHTTPAllSvcTime, proxyConfig=proxyConfig, proxyMedianSvcTable=proxyMedianSvcTable, proxySysPerf=proxySysPerf, PYSNMP_MODULE_ID=proxy, proxyMedianTime=proxyMedianTime, proxyHTTPMissSvcTime=proxyHTTPMissSvcTime, proxyClientHttpOutKbs=proxyClientHttpOutKbs, proxyClientHttpInKbs=proxyClientHttpInKbs, proxyClientHttpErrors=proxyClientHttpErrors, proxyProtoClient=proxyProtoClient, proxyServerHttpErrors=proxyServerHttpErrors, proxyCpuLoad=proxyCpuLoad, proxyCpuUsage=proxyCpuUsage, proxyClientHttpHits=proxyClientHttpHits, proxyServerHttpRequests=proxyServerHttpRequests, proxyVersion=proxyVersion, proxyHTTPNhSvcTime=proxyHTTPNhSvcTime)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (unsigned32, counter32, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, gauge32, integer32, iso, counter64, object_identity, mib_identifier, ip_address, notification_type, time_ticks, bits, experimental) = mibBuilder.importSymbols('SNMPv2-SMI', 'Unsigned32', 'Counter32', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Gauge32', 'Integer32', 'iso', 'Counter64', 'ObjectIdentity', 'MibIdentifier', 'IpAddress', 'NotificationType', 'TimeTicks', 'Bits', 'experimental') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') nsfnet = mib_identifier((1, 3, 6, 1, 3, 25)) proxy = module_identity((1, 3, 6, 1, 3, 25, 17)) proxy.setRevisions(('1998-08-26 00:00',)) if mibBuilder.loadTexts: proxy.setLastUpdated('9809010000Z') if mibBuilder.loadTexts: proxy.setOrganization('National Laboratory for Applied Network Research') proxy_system = mib_identifier((1, 3, 6, 1, 3, 25, 17, 1)) proxy_config = mib_identifier((1, 3, 6, 1, 3, 25, 17, 2)) proxy_perf = mib_identifier((1, 3, 6, 1, 3, 25, 17, 3)) proxy_mem_usage = mib_scalar((1, 3, 6, 1, 3, 25, 17, 1, 1), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyMemUsage.setStatus('current') proxy_storage = mib_scalar((1, 3, 6, 1, 3, 25, 17, 1, 2), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyStorage.setStatus('current') proxy_cpu_usage = mib_scalar((1, 3, 6, 1, 3, 25, 17, 1, 3), unsigned32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyCpuUsage.setStatus('current') proxy_up_time = mib_scalar((1, 3, 6, 1, 3, 25, 17, 1, 4), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyUpTime.setStatus('current') proxy_admin = mib_scalar((1, 3, 6, 1, 3, 25, 17, 2, 1), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyAdmin.setStatus('current') proxy_software = mib_scalar((1, 3, 6, 1, 3, 25, 17, 2, 2), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxySoftware.setStatus('current') proxy_version = mib_scalar((1, 3, 6, 1, 3, 25, 17, 2, 3), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyVersion.setStatus('current') proxy_sys_perf = mib_identifier((1, 3, 6, 1, 3, 25, 17, 3, 1)) proxy_proto_perf = mib_identifier((1, 3, 6, 1, 3, 25, 17, 3, 2)) proxy_cpu_load = mib_scalar((1, 3, 6, 1, 3, 25, 17, 3, 1, 1), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyCpuLoad.setStatus('current') proxy_num_objects = mib_scalar((1, 3, 6, 1, 3, 25, 17, 3, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyNumObjects.setStatus('current') proxy_proto_client = mib_identifier((1, 3, 6, 1, 3, 25, 17, 3, 2, 1)) proxy_proto_server = mib_identifier((1, 3, 6, 1, 3, 25, 17, 3, 2, 2)) proxy_client_http_requests = mib_scalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 1, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyClientHttpRequests.setStatus('current') proxy_client_http_hits = mib_scalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyClientHttpHits.setStatus('current') proxy_client_http_errors = mib_scalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyClientHttpErrors.setStatus('current') proxy_client_http_in_kbs = mib_scalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyClientHttpInKbs.setStatus('current') proxy_client_http_out_kbs = mib_scalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 1, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyClientHttpOutKbs.setStatus('current') proxy_server_http_requests = mib_scalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 2, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyServerHttpRequests.setStatus('current') proxy_server_http_errors = mib_scalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 2, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyServerHttpErrors.setStatus('current') proxy_server_http_in_kbs = mib_scalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 2, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyServerHttpInKbs.setStatus('current') proxy_server_http_out_kbs = mib_scalar((1, 3, 6, 1, 3, 25, 17, 3, 2, 2, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyServerHttpOutKbs.setStatus('current') proxy_median_svc_table = mib_table((1, 3, 6, 1, 3, 25, 17, 3, 3)) if mibBuilder.loadTexts: proxyMedianSvcTable.setStatus('current') proxy_median_svc_entry = mib_table_row((1, 3, 6, 1, 3, 25, 17, 3, 3, 1)).setIndexNames((0, 'PROXY-MIB', 'proxyMedianTime')) if mibBuilder.loadTexts: proxyMedianSvcEntry.setStatus('current') proxy_median_time = mib_table_column((1, 3, 6, 1, 3, 25, 17, 3, 3, 1, 1), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyMedianTime.setStatus('current') proxy_http_all_svc_time = mib_table_column((1, 3, 6, 1, 3, 25, 17, 3, 3, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyHTTPAllSvcTime.setStatus('current') proxy_http_miss_svc_time = mib_table_column((1, 3, 6, 1, 3, 25, 17, 3, 3, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyHTTPMissSvcTime.setStatus('current') proxy_http_hit_svc_time = mib_table_column((1, 3, 6, 1, 3, 25, 17, 3, 3, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyHTTPHitSvcTime.setStatus('current') proxy_http_nh_svc_time = mib_table_column((1, 3, 6, 1, 3, 25, 17, 3, 3, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyHTTPNhSvcTime.setStatus('current') proxy_dns_svc_time = mib_table_column((1, 3, 6, 1, 3, 25, 17, 3, 3, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: proxyDnsSvcTime.setStatus('current') mibBuilder.exportSymbols('PROXY-MIB', proxyStorage=proxyStorage, proxyMemUsage=proxyMemUsage, proxyServerHttpInKbs=proxyServerHttpInKbs, proxySystem=proxySystem, proxyAdmin=proxyAdmin, nsfnet=nsfnet, proxyHTTPHitSvcTime=proxyHTTPHitSvcTime, proxyUpTime=proxyUpTime, proxySoftware=proxySoftware, proxyClientHttpRequests=proxyClientHttpRequests, proxyServerHttpOutKbs=proxyServerHttpOutKbs, proxy=proxy, proxyPerf=proxyPerf, proxyProtoServer=proxyProtoServer, proxyProtoPerf=proxyProtoPerf, proxyNumObjects=proxyNumObjects, proxyDnsSvcTime=proxyDnsSvcTime, proxyMedianSvcEntry=proxyMedianSvcEntry, proxyHTTPAllSvcTime=proxyHTTPAllSvcTime, proxyConfig=proxyConfig, proxyMedianSvcTable=proxyMedianSvcTable, proxySysPerf=proxySysPerf, PYSNMP_MODULE_ID=proxy, proxyMedianTime=proxyMedianTime, proxyHTTPMissSvcTime=proxyHTTPMissSvcTime, proxyClientHttpOutKbs=proxyClientHttpOutKbs, proxyClientHttpInKbs=proxyClientHttpInKbs, proxyClientHttpErrors=proxyClientHttpErrors, proxyProtoClient=proxyProtoClient, proxyServerHttpErrors=proxyServerHttpErrors, proxyCpuLoad=proxyCpuLoad, proxyCpuUsage=proxyCpuUsage, proxyClientHttpHits=proxyClientHttpHits, proxyServerHttpRequests=proxyServerHttpRequests, proxyVersion=proxyVersion, proxyHTTPNhSvcTime=proxyHTTPNhSvcTime)
def removcaract(cnpj): documento = [] for x in cnpj: if x.isnumeric(): documento.append(x) documento = ''.join(documento) return documento
def removcaract(cnpj): documento = [] for x in cnpj: if x.isnumeric(): documento.append(x) documento = ''.join(documento) return documento
#!/usr/bin/env python """ _DQMCat_ """ __all__ = []
""" _DQMCat_ """ __all__ = []
class Solution: def smallestDivisor(self, nums: List[int], threshold: int) -> int: def condition(divisor) -> bool: return sum((num - 1) // divisor + 1 for num in nums) <= threshold lo, hi = 1, max(nums) while lo < hi: mid = lo + (hi - lo) // 2 if condition(mid): hi = mid else: lo = mid + 1 return lo
class Solution: def smallest_divisor(self, nums: List[int], threshold: int) -> int: def condition(divisor) -> bool: return sum(((num - 1) // divisor + 1 for num in nums)) <= threshold (lo, hi) = (1, max(nums)) while lo < hi: mid = lo + (hi - lo) // 2 if condition(mid): hi = mid else: lo = mid + 1 return lo
__author__ = 'maartenbreddels' matplotlib = """import pylab import numpy as np import os import json import sys name = "{name}" if len(sys.argv) == 1 else sys.argv[1] filename_grid = name + "_grid.npy" filename_grid_vector = name + "_grid_vector.npy" filename_grid_selection = name + "_grid_selection.npy" filename_meta = name + "_meta.json" has_selection = os.path.exists(filename_grid_selection) has_vectors = os.path.exists(filename_grid_vector) meta = json.load(file(filename_meta)) grid = np.load(filename_grid) xmin, xmax, ymin, ymax = meta["extent"] if has_selection: grid_selection = np.load(filename_grid_selection) pylab.imshow(grid, extent=meta["extent"], origin="lower", cmap="binary") pylab.imshow(grid_selection, alpha=0.4, extent=meta["extent"], origin="lower") else: pylab.imshow(grid, extent=meta["extent"], origin="lower") if has_vectors: vx, vy, vz = np.load(filename_grid_vector) N = vx.shape[0] dx = (xmax-xmin)/float(N) dy = (ymax-ymin)/float(N) x = np.linspace(xmin+dx/2, xmax-dx/2, N) y = np.linspace(ymin+dy/2, ymax-dy/2, N) x2d, y2d = np.meshgrid(x, y) pylab.quiver(x2d, y2d, vx, vy, color="white") pylab.show() """
__author__ = 'maartenbreddels' matplotlib = 'import pylab\nimport numpy as np\nimport os\nimport json\nimport sys\n\nname = "{name}" if len(sys.argv) == 1 else sys.argv[1]\n\nfilename_grid = name + "_grid.npy"\nfilename_grid_vector = name + "_grid_vector.npy"\nfilename_grid_selection = name + "_grid_selection.npy"\nfilename_meta = name + "_meta.json"\n\nhas_selection = os.path.exists(filename_grid_selection)\nhas_vectors = os.path.exists(filename_grid_vector)\n\nmeta = json.load(file(filename_meta))\ngrid = np.load(filename_grid)\n\nxmin, xmax, ymin, ymax = meta["extent"]\n\nif has_selection:\n grid_selection = np.load(filename_grid_selection)\n pylab.imshow(grid, extent=meta["extent"], origin="lower", cmap="binary")\n pylab.imshow(grid_selection, alpha=0.4, extent=meta["extent"], origin="lower")\nelse:\n pylab.imshow(grid, extent=meta["extent"], origin="lower")\n\nif has_vectors:\n vx, vy, vz = np.load(filename_grid_vector)\n N = vx.shape[0]\n dx = (xmax-xmin)/float(N)\n dy = (ymax-ymin)/float(N)\n x = np.linspace(xmin+dx/2, xmax-dx/2, N)\n y = np.linspace(ymin+dy/2, ymax-dy/2, N)\n x2d, y2d = np.meshgrid(x, y)\n pylab.quiver(x2d, y2d, vx, vy, color="white")\n\npylab.show()\n\n'
"""This program finds the total number of possible combinations that can be used to climb statirs . EG : for 3 stairs ,combination and output will be 1,1,1 , 1,2 , 2,1 i.e 3 . """ def counting_stairs(stair_number): result = stair_number # This function uses Recursion. if(stair_number <=1): result = 1 else: result = (counting_stairs(stair_number-1) + counting_stairs(stair_number-2)) return result if __name__ == '__main__': count_stair = int(input("Enter total number of stairs: ")) print(f"Total Number of possible Combinations = {counting_stairs(count_stair)}") """Output Total Number of possible Combinations = 8 Enter total number of stairs: 5 Time Complexity : O(2^n) Space Complexity :O(1) Created by Shubham Patel on 16-12-2020 on WoC """
"""This program finds the total number of possible combinations that can be used to climb statirs . EG : for 3 stairs ,combination and output will be 1,1,1 , 1,2 , 2,1 i.e 3 . """ def counting_stairs(stair_number): result = stair_number if stair_number <= 1: result = 1 else: result = counting_stairs(stair_number - 1) + counting_stairs(stair_number - 2) return result if __name__ == '__main__': count_stair = int(input('Enter total number of stairs: ')) print(f'Total Number of possible Combinations = {counting_stairs(count_stair)}') 'Output \nTotal Number of possible Combinations = 8\nEnter total number of stairs: 5\n\nTime Complexity : O(2^n)\nSpace Complexity :O(1)\nCreated by Shubham Patel on 16-12-2020 on WoC\n'
def parse_eval_info(cur_eval_video_info): length_eval_info = len(cur_eval_video_info) cur_epoch = int(cur_eval_video_info[0].split(' ')[2].split('-')[1]) cur_video_auc = float(cur_eval_video_info[-1].split(' ')[-3].split('-')[1].split(',')[0]) return cur_epoch, cur_video_auc file = '/home/mry/Desktop/seed-23197-time-31-Aug-at-07-35-19.log' fr = open(file, 'r') a = fr.readlines() real_result_files_line = a[232:] train_log_length_first = 11 train_log_length_common = 9 eval_log_length_list = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5] total_nme_print_length = 1 deliema_line_length = 1 final_block_line_list = [] per_num_length_first = (train_log_length_first + total_nme_print_length + deliema_line_length + sum(eval_log_length_list)) per_num_length_common = (train_log_length_common + total_nme_print_length + deliema_line_length + sum(eval_log_length_list)) epoch_num = 1 + (len(real_result_files_line)-per_num_length_first) // per_num_length_common log_eval_info_list = [] model_count = 0 for epoch in range(epoch_num): if epoch % 10 ==0: start = per_num_length_first*model_count + per_num_length_common*(epoch-model_count) end = start + per_num_length_first all_info_of_curepoch = real_result_files_line[start : end] #all_info_of_curepoch = real_result_files_line[epoch * per_num_length_first:epoch * per_num_length_first + per_num_length_first] eval_info = all_info_of_curepoch[train_log_length_first:] model_count += 1 else: start = per_num_length_first*model_count + per_num_length_common*(epoch-model_count) end = start + per_num_length_common all_info_of_curepoch = real_result_files_line[start : end] eval_info = all_info_of_curepoch[train_log_length_common:] cur_epoch_dict = {} cur_auc_list = [] video_info_dict = {} vd_epoch = -1 for eval_video_id in range(len(eval_log_length_list)): cur_eval_video_info = eval_info[eval_video_id*eval_log_length_list[eval_video_id]:(eval_video_id+1)*eval_log_length_list[eval_video_id]] cur_epoch, cur_auc = parse_eval_info(cur_eval_video_info) cur_auc_list.append(cur_auc) vd_epoch = cur_epoch cur_nme_list = [float(i) for i in eval_info[-2].strip().split(':')[1].split(',')] video_info_dict['NME_total'] = cur_nme_list video_info_dict['AUC0.08error'] = cur_auc_list cur_epoch_dict[vd_epoch] = video_info_dict log_eval_info_list.append(cur_epoch_dict) pass
def parse_eval_info(cur_eval_video_info): length_eval_info = len(cur_eval_video_info) cur_epoch = int(cur_eval_video_info[0].split(' ')[2].split('-')[1]) cur_video_auc = float(cur_eval_video_info[-1].split(' ')[-3].split('-')[1].split(',')[0]) return (cur_epoch, cur_video_auc) file = '/home/mry/Desktop/seed-23197-time-31-Aug-at-07-35-19.log' fr = open(file, 'r') a = fr.readlines() real_result_files_line = a[232:] train_log_length_first = 11 train_log_length_common = 9 eval_log_length_list = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5] total_nme_print_length = 1 deliema_line_length = 1 final_block_line_list = [] per_num_length_first = train_log_length_first + total_nme_print_length + deliema_line_length + sum(eval_log_length_list) per_num_length_common = train_log_length_common + total_nme_print_length + deliema_line_length + sum(eval_log_length_list) epoch_num = 1 + (len(real_result_files_line) - per_num_length_first) // per_num_length_common log_eval_info_list = [] model_count = 0 for epoch in range(epoch_num): if epoch % 10 == 0: start = per_num_length_first * model_count + per_num_length_common * (epoch - model_count) end = start + per_num_length_first all_info_of_curepoch = real_result_files_line[start:end] eval_info = all_info_of_curepoch[train_log_length_first:] model_count += 1 else: start = per_num_length_first * model_count + per_num_length_common * (epoch - model_count) end = start + per_num_length_common all_info_of_curepoch = real_result_files_line[start:end] eval_info = all_info_of_curepoch[train_log_length_common:] cur_epoch_dict = {} cur_auc_list = [] video_info_dict = {} vd_epoch = -1 for eval_video_id in range(len(eval_log_length_list)): cur_eval_video_info = eval_info[eval_video_id * eval_log_length_list[eval_video_id]:(eval_video_id + 1) * eval_log_length_list[eval_video_id]] (cur_epoch, cur_auc) = parse_eval_info(cur_eval_video_info) cur_auc_list.append(cur_auc) vd_epoch = cur_epoch cur_nme_list = [float(i) for i in eval_info[-2].strip().split(':')[1].split(',')] video_info_dict['NME_total'] = cur_nme_list video_info_dict['AUC0.08error'] = cur_auc_list cur_epoch_dict[vd_epoch] = video_info_dict log_eval_info_list.append(cur_epoch_dict) pass
class ExitMixin(): def do_exit(self, _): ''' Exit the shell. ''' print(self._exit_msg) return True def do_EOF(self, params): print() return self.do_exit(params)
class Exitmixin: def do_exit(self, _): """ Exit the shell. """ print(self._exit_msg) return True def do_eof(self, params): print() return self.do_exit(params)
class Solution: def calculateSum(self, N, A, B): A_count = N//A B_count = N//B result = A*A_count*(1+A_count)//2 + B*B_count*(1+B_count)//2 a = min(A,B) b = max(A,B) while a > 0: b, a= a, b%a lcm = (A*B)//b AB_count = (N - N%lcm)//lcm return result - lcm*AB_count*(1+AB_count)//2 if __name__ == '__main__': t = int(input()) for _ in range(t): N,A,B = map(int,input().strip().split()) ob = Solution() ans = ob.calculateSum(N, A, B) print(ans)
class Solution: def calculate_sum(self, N, A, B): a_count = N // A b_count = N // B result = A * A_count * (1 + A_count) // 2 + B * B_count * (1 + B_count) // 2 a = min(A, B) b = max(A, B) while a > 0: (b, a) = (a, b % a) lcm = A * B // b ab_count = (N - N % lcm) // lcm return result - lcm * AB_count * (1 + AB_count) // 2 if __name__ == '__main__': t = int(input()) for _ in range(t): (n, a, b) = map(int, input().strip().split()) ob = solution() ans = ob.calculateSum(N, A, B) print(ans)
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Time, obj[3]: Coupon, obj[4]: Coupon_validity, obj[5]: Gender, obj[6]: Age, obj[7]: Children, obj[8]: Education, obj[9]: Occupation, obj[10]: Income, obj[11]: Bar, obj[12]: Coffeehouse, obj[13]: Restaurant20to50, obj[14]: Direction_same, obj[15]: Distance # {"feature": "Education", "instances": 85, "metric_value": 0.9774, "depth": 1} if obj[8]<=2: # {"feature": "Age", "instances": 68, "metric_value": 0.9944, "depth": 2} if obj[6]<=5: # {"feature": "Passanger", "instances": 60, "metric_value": 1.0, "depth": 3} if obj[0]<=2: # {"feature": "Occupation", "instances": 45, "metric_value": 0.9825, "depth": 4} if obj[9]<=17: # {"feature": "Bar", "instances": 42, "metric_value": 0.9587, "depth": 5} if obj[11]<=3.0: # {"feature": "Time", "instances": 40, "metric_value": 0.9341, "depth": 6} if obj[2]<=3: # {"feature": "Coupon_validity", "instances": 32, "metric_value": 0.8571, "depth": 7} if obj[4]<=0: # {"feature": "Coupon", "instances": 17, "metric_value": 0.9774, "depth": 8} if obj[3]<=2: # {"feature": "Children", "instances": 10, "metric_value": 0.7219, "depth": 9} if obj[7]<=0: return 'False' elif obj[7]>0: # {"feature": "Weather", "instances": 4, "metric_value": 1.0, "depth": 10} if obj[1]<=0: return 'False' elif obj[1]>0: return 'True' else: return 'True' else: return 'False' elif obj[3]>2: # {"feature": "Weather", "instances": 7, "metric_value": 0.8631, "depth": 9} if obj[1]<=0: # {"feature": "Coffeehouse", "instances": 5, "metric_value": 0.971, "depth": 10} if obj[12]<=1.0: # {"feature": "Income", "instances": 4, "metric_value": 0.8113, "depth": 11} if obj[10]>2: return 'True' elif obj[10]<=2: # {"feature": "Direction_same", "instances": 2, "metric_value": 1.0, "depth": 12} if obj[14]<=0: return 'False' elif obj[14]>0: return 'True' else: return 'True' else: return 'False' elif obj[12]>1.0: return 'False' else: return 'False' elif obj[1]>0: return 'True' else: return 'True' else: return 'True' elif obj[4]>0: # {"feature": "Income", "instances": 15, "metric_value": 0.5665, "depth": 8} if obj[10]<=5: return 'False' elif obj[10]>5: # {"feature": "Coupon", "instances": 6, "metric_value": 0.9183, "depth": 9} if obj[3]>2: return 'False' elif obj[3]<=2: return 'True' else: return 'True' else: return 'False' else: return 'False' elif obj[2]>3: # {"feature": "Restaurant20to50", "instances": 8, "metric_value": 0.9544, "depth": 7} if obj[13]<=1.0: # {"feature": "Coffeehouse", "instances": 5, "metric_value": 0.971, "depth": 8} if obj[12]<=1.0: return 'False' elif obj[12]>1.0: return 'True' else: return 'True' elif obj[13]>1.0: return 'True' else: return 'True' else: return 'True' elif obj[11]>3.0: return 'True' else: return 'True' elif obj[9]>17: return 'True' else: return 'True' elif obj[0]>2: # {"feature": "Occupation", "instances": 15, "metric_value": 0.8366, "depth": 4} if obj[9]<=10: # {"feature": "Income", "instances": 13, "metric_value": 0.6194, "depth": 5} if obj[10]>0: return 'True' elif obj[10]<=0: # {"feature": "Coupon_validity", "instances": 3, "metric_value": 0.9183, "depth": 6} if obj[4]>0: return 'False' elif obj[4]<=0: return 'True' else: return 'True' else: return 'False' elif obj[9]>10: return 'False' else: return 'False' else: return 'True' elif obj[6]>5: # {"feature": "Time", "instances": 8, "metric_value": 0.5436, "depth": 3} if obj[2]<=1: return 'True' elif obj[2]>1: return 'False' else: return 'False' else: return 'True' elif obj[8]>2: # {"feature": "Occupation", "instances": 17, "metric_value": 0.7871, "depth": 2} if obj[9]<=20: # {"feature": "Coupon_validity", "instances": 16, "metric_value": 0.6962, "depth": 3} if obj[4]<=0: return 'True' elif obj[4]>0: # {"feature": "Time", "instances": 8, "metric_value": 0.9544, "depth": 4} if obj[2]<=1: # {"feature": "Coffeehouse", "instances": 5, "metric_value": 0.971, "depth": 5} if obj[12]>1.0: # {"feature": "Passanger", "instances": 3, "metric_value": 0.9183, "depth": 6} if obj[0]<=1: return 'True' elif obj[0]>1: return 'False' else: return 'False' elif obj[12]<=1.0: return 'False' else: return 'False' elif obj[2]>1: return 'True' else: return 'True' else: return 'True' elif obj[9]>20: return 'False' else: return 'False' else: return 'True'
def find_decision(obj): if obj[8] <= 2: if obj[6] <= 5: if obj[0] <= 2: if obj[9] <= 17: if obj[11] <= 3.0: if obj[2] <= 3: if obj[4] <= 0: if obj[3] <= 2: if obj[7] <= 0: return 'False' elif obj[7] > 0: if obj[1] <= 0: return 'False' elif obj[1] > 0: return 'True' else: return 'True' else: return 'False' elif obj[3] > 2: if obj[1] <= 0: if obj[12] <= 1.0: if obj[10] > 2: return 'True' elif obj[10] <= 2: if obj[14] <= 0: return 'False' elif obj[14] > 0: return 'True' else: return 'True' else: return 'False' elif obj[12] > 1.0: return 'False' else: return 'False' elif obj[1] > 0: return 'True' else: return 'True' else: return 'True' elif obj[4] > 0: if obj[10] <= 5: return 'False' elif obj[10] > 5: if obj[3] > 2: return 'False' elif obj[3] <= 2: return 'True' else: return 'True' else: return 'False' else: return 'False' elif obj[2] > 3: if obj[13] <= 1.0: if obj[12] <= 1.0: return 'False' elif obj[12] > 1.0: return 'True' else: return 'True' elif obj[13] > 1.0: return 'True' else: return 'True' else: return 'True' elif obj[11] > 3.0: return 'True' else: return 'True' elif obj[9] > 17: return 'True' else: return 'True' elif obj[0] > 2: if obj[9] <= 10: if obj[10] > 0: return 'True' elif obj[10] <= 0: if obj[4] > 0: return 'False' elif obj[4] <= 0: return 'True' else: return 'True' else: return 'False' elif obj[9] > 10: return 'False' else: return 'False' else: return 'True' elif obj[6] > 5: if obj[2] <= 1: return 'True' elif obj[2] > 1: return 'False' else: return 'False' else: return 'True' elif obj[8] > 2: if obj[9] <= 20: if obj[4] <= 0: return 'True' elif obj[4] > 0: if obj[2] <= 1: if obj[12] > 1.0: if obj[0] <= 1: return 'True' elif obj[0] > 1: return 'False' else: return 'False' elif obj[12] <= 1.0: return 'False' else: return 'False' elif obj[2] > 1: return 'True' else: return 'True' else: return 'True' elif obj[9] > 20: return 'False' else: return 'False' else: return 'True'
class Cup: def __init__(self,size,quantity): self.size = size self.quantity = quantity def status(self): return self.size-self.quantity def fill(self, quantity): if self.quantity<=self.status(): self.quantity+=quantity cup = Cup(100, 50) print(cup.status()) cup.fill(40) cup.fill(20) print(cup.status())
class Cup: def __init__(self, size, quantity): self.size = size self.quantity = quantity def status(self): return self.size - self.quantity def fill(self, quantity): if self.quantity <= self.status(): self.quantity += quantity cup = cup(100, 50) print(cup.status()) cup.fill(40) cup.fill(20) print(cup.status())
__author__ = 'croxis' def convertToPatches(model): """Sets up a model for autotesselation.""" for node in model.find_all_matches("**/+GeomNode"): geom_node = node.node() num_geoms = geom_node.get_num_geoms() for i in range(num_geoms): geom_node.modify_geom(i).make_patches_in_place()
__author__ = 'croxis' def convert_to_patches(model): """Sets up a model for autotesselation.""" for node in model.find_all_matches('**/+GeomNode'): geom_node = node.node() num_geoms = geom_node.get_num_geoms() for i in range(num_geoms): geom_node.modify_geom(i).make_patches_in_place()
class BinaryConfusionMatrix: def __init__(self, pos_tag="SPAM", neg_tag="OK"): self.pos_tag = pos_tag self.neg_tag = neg_tag self.tp = 0 self.tn = 0 self.fp = 0 self.fn = 0 def as_dict(self): return {"tp": self.tp, "tn": self.tn, "fp": self.fp, "fn": self.fn} def _is_correct_values(self, value1, value2): correct_values = [self.pos_tag, self.neg_tag] return value1 in correct_values and value2 in correct_values def update(self, truth, prediction): if not self._is_correct_values(truth, prediction): raise ValueError() if truth == self.pos_tag: if prediction == self.pos_tag: self.tp += 1 else: self.fn += 1 else: if prediction == self.neg_tag: self.tn += 1 else: self.fp += 1 def compute_from_dicts(self, truth_dict, pred_dict): for filename, truth in truth_dict.items(): self.update(truth, pred_dict[filename]) def quality_score(self, tp, tn, fp, fn): return (tp + tn) / (tp + tn + 10 * fp + fn)
class Binaryconfusionmatrix: def __init__(self, pos_tag='SPAM', neg_tag='OK'): self.pos_tag = pos_tag self.neg_tag = neg_tag self.tp = 0 self.tn = 0 self.fp = 0 self.fn = 0 def as_dict(self): return {'tp': self.tp, 'tn': self.tn, 'fp': self.fp, 'fn': self.fn} def _is_correct_values(self, value1, value2): correct_values = [self.pos_tag, self.neg_tag] return value1 in correct_values and value2 in correct_values def update(self, truth, prediction): if not self._is_correct_values(truth, prediction): raise value_error() if truth == self.pos_tag: if prediction == self.pos_tag: self.tp += 1 else: self.fn += 1 elif prediction == self.neg_tag: self.tn += 1 else: self.fp += 1 def compute_from_dicts(self, truth_dict, pred_dict): for (filename, truth) in truth_dict.items(): self.update(truth, pred_dict[filename]) def quality_score(self, tp, tn, fp, fn): return (tp + tn) / (tp + tn + 10 * fp + fn)
def karp_rabin(text, word, n, m): MOD = 257 A = random.randint(2, MOD - 1) Am = pow(A, m, MOD) def generate(t): return sum(ord(c) * pow(A, i, MOD) for i, c in enumerate(t[::-1])) % MOD text += '$' hash_text, hash_word = generate(text[1:m + 1]), generate(word[1:]) for i in range(1, n - m + 2): if hash_text == hash_word and text[i:i + m] == word[1:]: yield i hash_text = (A * hash_text + ord(text[i + m]) - Am * ord(text[i])) % MOD
def karp_rabin(text, word, n, m): mod = 257 a = random.randint(2, MOD - 1) am = pow(A, m, MOD) def generate(t): return sum((ord(c) * pow(A, i, MOD) for (i, c) in enumerate(t[::-1]))) % MOD text += '$' (hash_text, hash_word) = (generate(text[1:m + 1]), generate(word[1:])) for i in range(1, n - m + 2): if hash_text == hash_word and text[i:i + m] == word[1:]: yield i hash_text = (A * hash_text + ord(text[i + m]) - Am * ord(text[i])) % MOD
n = 1000000 # n = 100 prime = [True for i in range(n+1)] p = 2 while (p * p <= n): if (prime[p] == True): for i in range(p * p, n+1, p): prime[i] = False p += 1 primes = [] for i in range(2,n+1): if prime[i]: primes.append(i) count = 0 ans = 0 for index,elem in enumerate(primes): sum = 0 temp = 0 for i in range(index,len(primes)): sum += primes[i] temp +=1 if sum > n: break if prime[sum]: if count < temp: ans = sum count = temp print(ans,count)
n = 1000000 prime = [True for i in range(n + 1)] p = 2 while p * p <= n: if prime[p] == True: for i in range(p * p, n + 1, p): prime[i] = False p += 1 primes = [] for i in range(2, n + 1): if prime[i]: primes.append(i) count = 0 ans = 0 for (index, elem) in enumerate(primes): sum = 0 temp = 0 for i in range(index, len(primes)): sum += primes[i] temp += 1 if sum > n: break if prime[sum]: if count < temp: ans = sum count = temp print(ans, count)
STARLARK_BINARY_PATH = { "java": "external/io_bazel/src/main/java/net/starlark/java/cmd/Starlark", "go": "external/net_starlark_go/cmd/starlark/*/starlark", "rust": "external/starlark-rust/target/debug/starlark-repl", } STARLARK_TESTDATA_PATH = "test_suite/"
starlark_binary_path = {'java': 'external/io_bazel/src/main/java/net/starlark/java/cmd/Starlark', 'go': 'external/net_starlark_go/cmd/starlark/*/starlark', 'rust': 'external/starlark-rust/target/debug/starlark-repl'} starlark_testdata_path = 'test_suite/'
# # @lc app=leetcode id=868 lang=python3 # # [868] Binary Gap # # @lc code=start class Solution: def binaryGap(self, N: int) -> int: s = bin(N) res = 0 i = float('inf') for j, n in enumerate(s[2:]): if n == '1': res = max(res, j - i) i = j return res # @lc code=end
class Solution: def binary_gap(self, N: int) -> int: s = bin(N) res = 0 i = float('inf') for (j, n) in enumerate(s[2:]): if n == '1': res = max(res, j - i) i = j return res
class Solution: def convertToBase7(self, num: int) -> str: result = '' n = abs(num) while n: n, curr = divmod(n, 7) result = str(curr) + result return '-' * (num < 0) + result or '0'
class Solution: def convert_to_base7(self, num: int) -> str: result = '' n = abs(num) while n: (n, curr) = divmod(n, 7) result = str(curr) + result return '-' * (num < 0) + result or '0'
########import random abcd=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] k=list(input("Enter your String")) key="HACK" scn=[['']*4 for i in range(0,4)] p=sorted(list(key)) ci=[key.index(i) for i in p] print(ci,p) i,j=0,0 for m in k: if j>3: i+=1 j=0 scn[i][j]=m j+=1 #enc ec=[] i=0 for i in range(0,4): for j in range(0,4): ec.append(scn[j][ci[i]]) print(ec) #dcd dc=[] dcdm=[['']*4 for i in range(0,4)] i,j=0,0 c=-1 for i in range(0,4): for j in range(0,4): c+=1 dcdm[ci[i]][j]=ec[c] for m in range(0,4): for f in range(0,4): dc.append(dcdm[f][m]) dc=dc[:len(k)] print("Key used=",key),print("ec",ec),print("dc",dc) """ while a<len(k): a+=1; a=a*a; scn=[['']*a for i in range(0,a)] key=[random.randint(0,26) for x in range(0,a)] skey=[abcd[a] for a in key] order=sorted(skey) ci=[key.index(i) for i in order] i,j=0,0 for m in k: scn[i][j]=m i+=1 j+=1 """ """ if len(k)>16: print("length should be less than 16") quit() #enc ec=[] i=0 for i in range(0,a): for j in range(0,len(ci)): ec.append([ci[j]][i]) print(ec) #dec dc=[] i=0 for i in range(0,a): ci[i] for j in range(0,a): dc.append([ci[j]][i]) print("Key used=",[abcd.index()]) print(rf,len(rf)) """
abcd = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] k = list(input('Enter your String')) key = 'HACK' scn = [[''] * 4 for i in range(0, 4)] p = sorted(list(key)) ci = [key.index(i) for i in p] print(ci, p) (i, j) = (0, 0) for m in k: if j > 3: i += 1 j = 0 scn[i][j] = m j += 1 ec = [] i = 0 for i in range(0, 4): for j in range(0, 4): ec.append(scn[j][ci[i]]) print(ec) dc = [] dcdm = [[''] * 4 for i in range(0, 4)] (i, j) = (0, 0) c = -1 for i in range(0, 4): for j in range(0, 4): c += 1 dcdm[ci[i]][j] = ec[c] for m in range(0, 4): for f in range(0, 4): dc.append(dcdm[f][m]) dc = dc[:len(k)] (print('Key used=', key), print('ec', ec), print('dc', dc)) "\nwhile a<len(k):\n a+=1;\n a=a*a;\nscn=[['']*a for i in range(0,a)]\nkey=[random.randint(0,26) for x in range(0,a)]\nskey=[abcd[a] for a in key]\norder=sorted(skey)\nci=[key.index(i) for i in order]\ni,j=0,0\nfor m in k:\n scn[i][j]=m\n i+=1\n j+=1\n\n" '\nif len(k)>16:\n print("length should be less than 16")\n quit()\n\n#enc\nec=[]\ni=0\nfor i in range(0,a):\n for j in range(0,len(ci)):\n ec.append([ci[j]][i])\nprint(ec)\n\n#dec\ndc=[]\ni=0\nfor i in range(0,a):\n ci[i]\n for j in range(0,a):\n dc.append([ci[j]][i])\n \n \n \nprint("Key used=",[abcd.index()])\nprint(rf,len(rf))\n'
start = int(input()) stop = int(input()) result = "" for number in range(start, stop + 1): print(chr(number), end=" ")
start = int(input()) stop = int(input()) result = '' for number in range(start, stop + 1): print(chr(number), end=' ')
H, W = map(int, input().split()) field = [[str(i) for i in input()] for _ in range(H)] count = 0 for x in range(W-1): for y in range(H-1): black_num = 0 for x1, y1 in [(x, y), (x+1, y), (x, y+1), (x+1, y+1)]: if field[y1][x1] == '#': black_num += 1 if black_num % 2 == 1: count += 1 print(count)
(h, w) = map(int, input().split()) field = [[str(i) for i in input()] for _ in range(H)] count = 0 for x in range(W - 1): for y in range(H - 1): black_num = 0 for (x1, y1) in [(x, y), (x + 1, y), (x, y + 1), (x + 1, y + 1)]: if field[y1][x1] == '#': black_num += 1 if black_num % 2 == 1: count += 1 print(count)
""" test: """ def sum_function(a, b, c): """ returns sum of a and b :param a: array :param b: integer :return: sum of a and b change """ c = a return c def average_function(a, b): """ returns the average of the squares of a and b :param a: integer :param b: integer :return: average of a and b """ c = (a**2 + b**2) / 2 return c def no_docs(c): return c
""" test: """ def sum_function(a, b, c): """ returns sum of a and b :param a: array :param b: integer :return: sum of a and b change """ c = a return c def average_function(a, b): """ returns the average of the squares of a and b :param a: integer :param b: integer :return: average of a and b """ c = (a ** 2 + b ** 2) / 2 return c def no_docs(c): return c
GET_REPOS = [ { 'name': 'sample_repo', 'nameWithOwner': 'example_org/sample_repo', 'primaryLanguage': { 'name': 'Python', }, 'url': 'https://github.com/example_org/sample_repo', 'sshUrl': 'git@github.com:example_org/sample_repo.git', 'createdAt': '2011-02-15T18:40:15Z', 'description': 'My description', 'updatedAt': '2020-01-02T20:10:09Z', 'homepageUrl': '', 'languages': { 'totalCount': 1, 'nodes': [ {'name': 'Python'}, ], }, 'defaultBranchRef': { 'name': 'master', 'id': 'branch_ref_id==', }, 'isPrivate': True, 'isArchived': False, 'isDisabled': False, 'isLocked': True, 'owner': { 'url': 'https://github.com/example_org', 'login': 'example_org', '__typename': 'Organization', }, 'collaborators': {'edges': [], 'nodes': []}, 'requirements': {'text': 'cartography\nhttplib2<0.7.0\njinja2\nlxml\n-e git+https://example.com#egg=foobar\nhttps://example.com/foobar.tar.gz\npip @ https://github.com/pypa/pip/archive/1.3.1.zip#sha1=da9234ee9982d4bbb3c72346a6de940a148ea686\n'}, # noqa }, { 'name': 'SampleRepo2', 'nameWithOwner': 'example_org/SampleRepo2', 'primaryLanguage': { 'name': 'Python', }, 'url': 'https://github.com/example_org/SampleRepo2', 'sshUrl': 'git@github.com:example_org/SampleRepo2.git', 'createdAt': '2011-09-21T18:55:16Z', 'description': 'Some other description', 'updatedAt': '2020-07-03T00:25:25Z', 'homepageUrl': 'http://example.com/', 'languages': { 'totalCount': 1, 'nodes': [ {'name': 'Python'}, ], }, 'defaultBranchRef': { 'name': 'master', 'id': 'other_branch_ref_id==', }, 'isPrivate': False, 'isArchived': False, 'isDisabled': False, 'isLocked': False, 'owner': { 'url': 'https://github.com/example_org', 'login': 'example_org', '__typename': 'Organization', }, 'collaborators': None, 'requirements': None, }, { 'name': 'cartography', 'nameWithOwner': 'lyft/cartography', 'primaryLanguage': {'name': 'Python'}, 'url': 'https://github.com/lyft/cartography', 'sshUrl': 'git@github.com:lyft/cartography.git', 'createdAt': '2019-02-27T00:16:29Z', 'description': 'One graph to rule them all', 'updatedAt': '2020-09-02T18:35:17Z', 'homepageUrl': '', 'languages': { 'totalCount': 2, 'nodes': [{'name': 'Python'}, {'name': 'Makefile'}], }, 'defaultBranchRef': { 'name': 'master', 'id': 'putsomethinghere', }, 'isPrivate': False, 'isArchived': False, 'isDisabled': False, 'isLocked': False, 'owner': { 'url': 'https://github.com/example_org', 'login': 'example_org', '__typename': 'Organization', }, 'collaborators': { 'edges': [ {'permission': 'WRITE'}, {'permission': 'WRITE'}, {'permission': 'WRITE'}, {'permission': 'WRITE'}, {'permission': 'WRITE'}, ], 'nodes': [ { 'url': 'https://github.com/marco-lancini', 'login': 'marco-lancini', 'name': 'Marco Lancini', 'email': 'm@example.com', 'company': 'ExampleCo', }, { 'url': 'https://github.com/sachafaust', 'login': 'sachafaust', 'name': 'Sacha Faust', 'email': 's@example.com', 'company': 'ExampleCo', }, { 'url': 'https://github.com/SecPrez', 'login': 'SecPrez', 'name': 'SecPrez', 'email': 'sec@example.com', 'company': 'ExampleCo', }, { 'url': 'https://github.com/ramonpetgrave64', 'login': 'ramonpetgrave64', 'name': 'Ramon Petgrave', 'email': 'r@example.com', 'company': 'ExampleCo', }, { 'url': 'https://github.com/roshinis78', 'login': 'roshinis78', 'name': 'Roshini Saravanakumar', 'email': 'ro@example.com', 'company': 'ExampleCo', }, ], }, 'requirements': { 'text': 'cartography==0.1.0\nhttplib2>=0.7.0\njinja2\nlxml\n# This is a comment line to be ignored\n', }, }, ]
get_repos = [{'name': 'sample_repo', 'nameWithOwner': 'example_org/sample_repo', 'primaryLanguage': {'name': 'Python'}, 'url': 'https://github.com/example_org/sample_repo', 'sshUrl': 'git@github.com:example_org/sample_repo.git', 'createdAt': '2011-02-15T18:40:15Z', 'description': 'My description', 'updatedAt': '2020-01-02T20:10:09Z', 'homepageUrl': '', 'languages': {'totalCount': 1, 'nodes': [{'name': 'Python'}]}, 'defaultBranchRef': {'name': 'master', 'id': 'branch_ref_id=='}, 'isPrivate': True, 'isArchived': False, 'isDisabled': False, 'isLocked': True, 'owner': {'url': 'https://github.com/example_org', 'login': 'example_org', '__typename': 'Organization'}, 'collaborators': {'edges': [], 'nodes': []}, 'requirements': {'text': 'cartography\nhttplib2<0.7.0\njinja2\nlxml\n-e git+https://example.com#egg=foobar\nhttps://example.com/foobar.tar.gz\npip @ https://github.com/pypa/pip/archive/1.3.1.zip#sha1=da9234ee9982d4bbb3c72346a6de940a148ea686\n'}}, {'name': 'SampleRepo2', 'nameWithOwner': 'example_org/SampleRepo2', 'primaryLanguage': {'name': 'Python'}, 'url': 'https://github.com/example_org/SampleRepo2', 'sshUrl': 'git@github.com:example_org/SampleRepo2.git', 'createdAt': '2011-09-21T18:55:16Z', 'description': 'Some other description', 'updatedAt': '2020-07-03T00:25:25Z', 'homepageUrl': 'http://example.com/', 'languages': {'totalCount': 1, 'nodes': [{'name': 'Python'}]}, 'defaultBranchRef': {'name': 'master', 'id': 'other_branch_ref_id=='}, 'isPrivate': False, 'isArchived': False, 'isDisabled': False, 'isLocked': False, 'owner': {'url': 'https://github.com/example_org', 'login': 'example_org', '__typename': 'Organization'}, 'collaborators': None, 'requirements': None}, {'name': 'cartography', 'nameWithOwner': 'lyft/cartography', 'primaryLanguage': {'name': 'Python'}, 'url': 'https://github.com/lyft/cartography', 'sshUrl': 'git@github.com:lyft/cartography.git', 'createdAt': '2019-02-27T00:16:29Z', 'description': 'One graph to rule them all', 'updatedAt': '2020-09-02T18:35:17Z', 'homepageUrl': '', 'languages': {'totalCount': 2, 'nodes': [{'name': 'Python'}, {'name': 'Makefile'}]}, 'defaultBranchRef': {'name': 'master', 'id': 'putsomethinghere'}, 'isPrivate': False, 'isArchived': False, 'isDisabled': False, 'isLocked': False, 'owner': {'url': 'https://github.com/example_org', 'login': 'example_org', '__typename': 'Organization'}, 'collaborators': {'edges': [{'permission': 'WRITE'}, {'permission': 'WRITE'}, {'permission': 'WRITE'}, {'permission': 'WRITE'}, {'permission': 'WRITE'}], 'nodes': [{'url': 'https://github.com/marco-lancini', 'login': 'marco-lancini', 'name': 'Marco Lancini', 'email': 'm@example.com', 'company': 'ExampleCo'}, {'url': 'https://github.com/sachafaust', 'login': 'sachafaust', 'name': 'Sacha Faust', 'email': 's@example.com', 'company': 'ExampleCo'}, {'url': 'https://github.com/SecPrez', 'login': 'SecPrez', 'name': 'SecPrez', 'email': 'sec@example.com', 'company': 'ExampleCo'}, {'url': 'https://github.com/ramonpetgrave64', 'login': 'ramonpetgrave64', 'name': 'Ramon Petgrave', 'email': 'r@example.com', 'company': 'ExampleCo'}, {'url': 'https://github.com/roshinis78', 'login': 'roshinis78', 'name': 'Roshini Saravanakumar', 'email': 'ro@example.com', 'company': 'ExampleCo'}]}, 'requirements': {'text': 'cartography==0.1.0\nhttplib2>=0.7.0\njinja2\nlxml\n# This is a comment line to be ignored\n'}}]
class Node(): def __init__(self, valor): self.valor = valor self.next = None class Stack: def __init__(self): self.head = Node("head") self.size = 0 def __str__(self): actual = self.head.next str1 = "[" while actual: str1 += str(actual.valor) + ", " actual = actual.next str1 = str1[:-2] + "]" if(self.size == 0): return "[]" return str1 def lenght(self): return self.size def isEmpty(self): return self.size == 0 def push(self, valor): node = Node(valor) node.next = self.head.next self.head.next = node self.size += 1 def peek(self): if self.isEmpty(): raise Exception("Error la pila esta vacia...") return self.head.next.valor def pop(self): if self.isEmpty(): raise Exception("Error la pila esta vacia...") remove = self.head.next self.head.next = self.head.next.next self.size -= 1 return remove.valor
class Node: def __init__(self, valor): self.valor = valor self.next = None class Stack: def __init__(self): self.head = node('head') self.size = 0 def __str__(self): actual = self.head.next str1 = '[' while actual: str1 += str(actual.valor) + ', ' actual = actual.next str1 = str1[:-2] + ']' if self.size == 0: return '[]' return str1 def lenght(self): return self.size def is_empty(self): return self.size == 0 def push(self, valor): node = node(valor) node.next = self.head.next self.head.next = node self.size += 1 def peek(self): if self.isEmpty(): raise exception('Error la pila esta vacia...') return self.head.next.valor def pop(self): if self.isEmpty(): raise exception('Error la pila esta vacia...') remove = self.head.next self.head.next = self.head.next.next self.size -= 1 return remove.valor
"""This settings module defines the benchmark driver settings""" EXPORT_GRAPHVIZ = False EXPORT_JSON = False REPEATS = 1 LOGICAL_DOT = '' FRAGMENTED_DOT = '' LOGICAL_JSON = '' FRAGMENTED_JSON = '' PRESTO_SETTINGS = {}
"""This settings module defines the benchmark driver settings""" export_graphviz = False export_json = False repeats = 1 logical_dot = '' fragmented_dot = '' logical_json = '' fragmented_json = '' presto_settings = {}
# Databricks notebook source # MAGIC %run ./includes/utils # COMMAND ---------- mountDataLake(clientId="64492359-3450-4f1e-be01-8717789fd01e", clientSecret=dbutils.secrets.get(scope="dpdatalake",key="adappsecret"), tokenEndPoint="https://login.microsoftonline.com/0b55e01a-573a-4060-b656-d1a3d5815791/oauth2/token", storageAccountName="dpdatalake", containerName="data") # COMMAND ---------- # MAGIC %sql # MAGIC CREATE DATABASE IF NOT EXISTS nyctaxi; # MAGIC USE nyctaxi; # MAGIC CREATE TABLE IF NOT EXISTS fact_zone_summary # MAGIC USING DELTA # MAGIC LOCATION '/mnt/data/curated/fact_zone_summary'; # MAGIC CREATE TABLE IF NOT EXISTS dim_zone_lookup # MAGIC USING DELTA # MAGIC LOCATION '/mnt/data/curated/dim_zone_lookup';
mount_data_lake(clientId='64492359-3450-4f1e-be01-8717789fd01e', clientSecret=dbutils.secrets.get(scope='dpdatalake', key='adappsecret'), tokenEndPoint='https://login.microsoftonline.com/0b55e01a-573a-4060-b656-d1a3d5815791/oauth2/token', storageAccountName='dpdatalake', containerName='data')
class Artist: def __init__(self, artist_id, uri, title): self.id = artist_id self.uri = uri self.title = title def __str__(self): return '{} (id={})'.format(self.title, self.id) def to_tuple(self): return (self.id, self.uri, self.title)
class Artist: def __init__(self, artist_id, uri, title): self.id = artist_id self.uri = uri self.title = title def __str__(self): return '{} (id={})'.format(self.title, self.id) def to_tuple(self): return (self.id, self.uri, self.title)
description = 'Actuators and feedback of the shutter, detector, and valves' group = 'lowlevel' excludes = ['IOcard'] devices = dict( I1_pnCCD_Active = device('nicos.devices.generic.ManualSwitch', description = 'high: Detector is turned on', states = [0, 1], ), I2_Shutter_safe = device('nicos.devices.generic.ManualSwitch', description = 'high: Detector is turned on', states = [0, 1], ), I3_Det_chamber_vent_open = device('nicos.devices.generic.ManualSwitch', description = 'high: Detector Chamber venting gauge open', states = [0, 1], ), I4_Exp_ch_vent_open = device('nicos.devices.generic.ManualSwitch', description = 'high: Experiment Chamber venting gauge open', states = [0, 1], ), I5_Det_ch_pump_open = device('nicos.devices.generic.ManualSwitch', description = 'high: Detector Chamber pumping gauge open', states = [0, 1], ), I6_Exp_ch_pump_open = device('nicos.devices.generic.ManualSwitch', description = 'high: Experiment Chamber pumping gauge open', states = [0, 1], ), I7_Exp_ch_vent_gas_selection = device('nicos.devices.generic.ManualSwitch', description = 'Venting either with air or nitrogen', states = [0, 1], ), I8_unused = device('nicos.devices.generic.ManualSwitch', description = '1 Bit wide digital input starting at E8', states = [0, 1], ), O1_pnCCD_Trigger = device('nicos.devices.generic.ManualSwitch', description = 'Send Trigger to detector to start collecting data', states = [0, 1], ), O2_Shutter_open = device('nicos.devices.generic.ManualSwitch', description = 'Open the shutter from LMJ', states = [0, 1], ), O3_Det_ch_vent = device('nicos.devices.generic.ManualSwitch', description = 'Vent Detector Chamber', states = [0, 1], ), O4_Exp_ch_vent= device('nicos.devices.generic.ManualSwitch', description = 'Vent Experiment Chamber', states = [0, 1], ), O5_Det_ch_pump = device('nicos.devices.generic.ManualSwitch', description = 'Open gauge from pump to Detector Chamber', states = [0, 1], ), O6_Exp_ch_pump = device('nicos.devices.generic.ManualSwitch', description = 'Open gauge from pump to Experiment Chamber', states = [0, 1], ), O7_Exp_ch_vent_gas = device('nicos.devices.generic.ManualSwitch', description = 'Choose either air or Nitrogen for venting', states = [0, 1], ), O8_unused = device('nicos.devices.generic.ManualSwitch', description = '1 Bit wide digital output starting at A8', states = [0, 1], ), )
description = 'Actuators and feedback of the shutter, detector, and valves' group = 'lowlevel' excludes = ['IOcard'] devices = dict(I1_pnCCD_Active=device('nicos.devices.generic.ManualSwitch', description='high: Detector is turned on', states=[0, 1]), I2_Shutter_safe=device('nicos.devices.generic.ManualSwitch', description='high: Detector is turned on', states=[0, 1]), I3_Det_chamber_vent_open=device('nicos.devices.generic.ManualSwitch', description='high: Detector Chamber venting gauge open', states=[0, 1]), I4_Exp_ch_vent_open=device('nicos.devices.generic.ManualSwitch', description='high: Experiment Chamber venting gauge open', states=[0, 1]), I5_Det_ch_pump_open=device('nicos.devices.generic.ManualSwitch', description='high: Detector Chamber pumping gauge open', states=[0, 1]), I6_Exp_ch_pump_open=device('nicos.devices.generic.ManualSwitch', description='high: Experiment Chamber pumping gauge open', states=[0, 1]), I7_Exp_ch_vent_gas_selection=device('nicos.devices.generic.ManualSwitch', description='Venting either with air or nitrogen', states=[0, 1]), I8_unused=device('nicos.devices.generic.ManualSwitch', description='1 Bit wide digital input starting at E8', states=[0, 1]), O1_pnCCD_Trigger=device('nicos.devices.generic.ManualSwitch', description='Send Trigger to detector to start collecting data', states=[0, 1]), O2_Shutter_open=device('nicos.devices.generic.ManualSwitch', description='Open the shutter from LMJ', states=[0, 1]), O3_Det_ch_vent=device('nicos.devices.generic.ManualSwitch', description='Vent Detector Chamber', states=[0, 1]), O4_Exp_ch_vent=device('nicos.devices.generic.ManualSwitch', description='Vent Experiment Chamber', states=[0, 1]), O5_Det_ch_pump=device('nicos.devices.generic.ManualSwitch', description='Open gauge from pump to Detector Chamber', states=[0, 1]), O6_Exp_ch_pump=device('nicos.devices.generic.ManualSwitch', description='Open gauge from pump to Experiment Chamber', states=[0, 1]), O7_Exp_ch_vent_gas=device('nicos.devices.generic.ManualSwitch', description='Choose either air or Nitrogen for venting', states=[0, 1]), O8_unused=device('nicos.devices.generic.ManualSwitch', description='1 Bit wide digital output starting at A8', states=[0, 1]))
def multiple_of(num, multiple): return num % multiple == 0 def sum_of_multiples(limit): return sum(x for x in range(limit) if multiple_of(x, 3) or multiple_of(x, 5)) if __name__ == "__main__": print(sum_of_multiples(1000))
def multiple_of(num, multiple): return num % multiple == 0 def sum_of_multiples(limit): return sum((x for x in range(limit) if multiple_of(x, 3) or multiple_of(x, 5))) if __name__ == '__main__': print(sum_of_multiples(1000))
# nobully.py # Metadata NAME = 'nobully' ENABLE = True PATTERN = r'^!nobully (?P<nick>[^\s]+)' USAGE = '''Usage: !nobully <nick> This informs the user identified by nick that they should no longer bully other (innocent) users. ''' # Constants NOBULLY_URL = 'https://www.stop-irc-bullying.info/' # Command async def nobully(bot, message, nick): if nick not in bot.users: return message.with_body(f'Unknown nick: {nick}') else: return message.with_body(f'{message.nick} thinks that you should stop bullying other users, {nick}. Please refer to {NOBULLY_URL} for more information.') # Register def register(bot): return ( ('command', PATTERN, nobully), ) # vim: set sts=4 sw=4 ts=8 expandtab ft=python:
name = 'nobully' enable = True pattern = '^!nobully (?P<nick>[^\\s]+)' usage = 'Usage: !nobully <nick>\nThis informs the user identified by nick that they should no longer bully other (innocent) users.\n' nobully_url = 'https://www.stop-irc-bullying.info/' async def nobully(bot, message, nick): if nick not in bot.users: return message.with_body(f'Unknown nick: {nick}') else: return message.with_body(f'{message.nick} thinks that you should stop bullying other users, {nick}. Please refer to {NOBULLY_URL} for more information.') def register(bot): return (('command', PATTERN, nobully),)
""" Misc. imported libs. """ load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") ############################################# def eigen(): new_git_repository( name = "eigen", commit = "954879183b1e008d7f0fefb97e48a925c4e3fb16", # current as of 2021/06/15 remote = "https://gitlab.com/libeigen/eigen.git", build_file = "@bazel_rules//repositories:BUILD.eigen", shallow_since = "1623784629 -0700", ) ############################################# def libcurl(): new_git_repository( name = "com_github_curl_curl", commit = "55a13f500e3897c6b640757786c02d989a10f2e2", # current as of 2021/06/15 remote = "git://github.com/curl/curl.git", build_file = "@bazel_rules//repositories:BUILD.libcurl", shallow_since = "1623770030 +0200", ) ############################################# def libidn2(): new_git_repository( name = "com_gitlab_libidn_libidn2", commit = "807b5dfef35a1aad0e0ebc5360af0accff1325ab", # current as of 2021/06/10 remote = "https://gitlab.com/libidn/libidn2.git", recursive_init_submodules = True, build_file = "@bazel_rules//repositories:BUILD.libidn2", shallow_since = "1621340058 +0200", ) ############################################# def zlib(): http_archive( name = "zlib", build_file = "@bazel_rules//repositories:BUILD.zlib", sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1", strip_prefix = "zlib-1.2.11", urls = [ "https://mirror.bazel.build/zlib.net/zlib-1.2.11.tar.gz", "https://zlib.net/zlib-1.2.11.tar.gz", ], ) ############################################# def jsoncpp(): new_git_repository( name = "com_github_open_source_parsers_jsoncpp", commit = "375a1119f8bbbf42e5275f31b281b5d87f2e17f2", # current as of 2021/06/10 remote = "git://github.com/open-source-parsers/jsoncpp.git", build_file = "@bazel_rules//repositories:BUILD.jsoncpp", shallow_since = "1620266582 -0500", ) ############################################# def libgnutls(): new_git_repository( name = "com_gitlab_gnutls", commit = "70f8edd864b69f05d93c1b31ca4abc5e049078c4", # current as of 2021/06/15 remote = "https://gitlab.com/gnutls/gnutls.git", recursive_init_submodules = True, patch_cmds = [ "rm devel/libtasn1/gtk-doc.make", # broken symlink in some builds. ], build_file = "@bazel_rules//repositories:BUILD.gnutls", shallow_since = "1623426704 +0000", ) ############################################# def libhttpserver(): new_git_repository( name = "com_github_etr_libhttpserver", build_file = "@bazel_rules//repositories:BUILD.libhttpserver", commit = "c5cf5eaa89830ad2aa706a161a647705661bd671", # current as of 2021/06/09 remote = "git://github.com/etr/libhttpserver.git", shallow_since = "1623266851 -0700", ) ############################################# def libnettle(): new_git_repository( name = "se_liu_lysator_nettle_nettle", commit = "a46a17e9f57c64984d5246aa3475e45f8c562ec7", # current as of 2021/06/10 remote = "https://git.lysator.liu.se/nettle/nettle.git", recursive_init_submodules = True, build_file = "@bazel_rules//repositories:BUILD.nettle", shallow_since = "1621875492 +0200", ) ############################################# def libev(): new_git_repository( name = "com_github_enki_libev", remote = "git://github.com/enki/libev.git", commit = "93823e6ca699df195a6c7b8bfa6006ec40ee0003", shallow_since = "1463172876 -0700", build_file = "@bazel_rules//repositories:BUILD.libev", patch_cmds = [ "chmod 755 autogen.sh", ], ) ############################################# def microhttpd(): DOMAINS = [ # GNU mirrors "ftp.wayne.edu", "mirrors.tripadvisor.com", "mirrors.kernel.org", "mirror.clarkson.edu", "mirrors.syringanetworks.net", "mirror.us-midwest-1.nexcess.net", "mirrors.ocf.berkeley.edu", # primary "ftp.gnu.org", ] http_archive( name = "org_gnu_microhttpd", build_file = "@bazel_rules//repositories:BUILD.microhttpd", sha256 = "e8f445e85faf727b89e9f9590daea4473ae00ead38b237cf1eda55172b89b182", strip_prefix = "libmicrohttpd-0.9.71", urls = ["https://%s/gnu/libmicrohttpd/libmicrohttpd-0.9.71.tar.gz" % domain for domain in DOMAINS], ) ############################################# def openssl(): new_git_repository( name = "com_github_openssl_openssl", commit = "4832560be3b2a709557497cd881f8c390ba7ec34", # current as of 2021/06/15 remote = "https://github.com/openssl/openssl.git", #recursive_init_submodules = True, build_file = "@bazel_rules//repositories:BUILD.openssl", shallow_since = "1623788074 +0200", )
""" Misc. imported libs. """ load('@bazel_tools//tools/build_defs/repo:git.bzl', 'new_git_repository') load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive') def eigen(): new_git_repository(name='eigen', commit='954879183b1e008d7f0fefb97e48a925c4e3fb16', remote='https://gitlab.com/libeigen/eigen.git', build_file='@bazel_rules//repositories:BUILD.eigen', shallow_since='1623784629 -0700') def libcurl(): new_git_repository(name='com_github_curl_curl', commit='55a13f500e3897c6b640757786c02d989a10f2e2', remote='git://github.com/curl/curl.git', build_file='@bazel_rules//repositories:BUILD.libcurl', shallow_since='1623770030 +0200') def libidn2(): new_git_repository(name='com_gitlab_libidn_libidn2', commit='807b5dfef35a1aad0e0ebc5360af0accff1325ab', remote='https://gitlab.com/libidn/libidn2.git', recursive_init_submodules=True, build_file='@bazel_rules//repositories:BUILD.libidn2', shallow_since='1621340058 +0200') def zlib(): http_archive(name='zlib', build_file='@bazel_rules//repositories:BUILD.zlib', sha256='c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1', strip_prefix='zlib-1.2.11', urls=['https://mirror.bazel.build/zlib.net/zlib-1.2.11.tar.gz', 'https://zlib.net/zlib-1.2.11.tar.gz']) def jsoncpp(): new_git_repository(name='com_github_open_source_parsers_jsoncpp', commit='375a1119f8bbbf42e5275f31b281b5d87f2e17f2', remote='git://github.com/open-source-parsers/jsoncpp.git', build_file='@bazel_rules//repositories:BUILD.jsoncpp', shallow_since='1620266582 -0500') def libgnutls(): new_git_repository(name='com_gitlab_gnutls', commit='70f8edd864b69f05d93c1b31ca4abc5e049078c4', remote='https://gitlab.com/gnutls/gnutls.git', recursive_init_submodules=True, patch_cmds=['rm devel/libtasn1/gtk-doc.make'], build_file='@bazel_rules//repositories:BUILD.gnutls', shallow_since='1623426704 +0000') def libhttpserver(): new_git_repository(name='com_github_etr_libhttpserver', build_file='@bazel_rules//repositories:BUILD.libhttpserver', commit='c5cf5eaa89830ad2aa706a161a647705661bd671', remote='git://github.com/etr/libhttpserver.git', shallow_since='1623266851 -0700') def libnettle(): new_git_repository(name='se_liu_lysator_nettle_nettle', commit='a46a17e9f57c64984d5246aa3475e45f8c562ec7', remote='https://git.lysator.liu.se/nettle/nettle.git', recursive_init_submodules=True, build_file='@bazel_rules//repositories:BUILD.nettle', shallow_since='1621875492 +0200') def libev(): new_git_repository(name='com_github_enki_libev', remote='git://github.com/enki/libev.git', commit='93823e6ca699df195a6c7b8bfa6006ec40ee0003', shallow_since='1463172876 -0700', build_file='@bazel_rules//repositories:BUILD.libev', patch_cmds=['chmod 755 autogen.sh']) def microhttpd(): domains = ['ftp.wayne.edu', 'mirrors.tripadvisor.com', 'mirrors.kernel.org', 'mirror.clarkson.edu', 'mirrors.syringanetworks.net', 'mirror.us-midwest-1.nexcess.net', 'mirrors.ocf.berkeley.edu', 'ftp.gnu.org'] http_archive(name='org_gnu_microhttpd', build_file='@bazel_rules//repositories:BUILD.microhttpd', sha256='e8f445e85faf727b89e9f9590daea4473ae00ead38b237cf1eda55172b89b182', strip_prefix='libmicrohttpd-0.9.71', urls=['https://%s/gnu/libmicrohttpd/libmicrohttpd-0.9.71.tar.gz' % domain for domain in DOMAINS]) def openssl(): new_git_repository(name='com_github_openssl_openssl', commit='4832560be3b2a709557497cd881f8c390ba7ec34', remote='https://github.com/openssl/openssl.git', build_file='@bazel_rules//repositories:BUILD.openssl', shallow_since='1623788074 +0200')
# Copyright (c) 2018, WSO2 Inc. (http://wso2.com) All Rights Reserved. # # 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. NS = {'d': 'http://maven.apache.org/POM/4.0.0'} ZIP_FILE_EXTENSION = ".zip" CARBON_NAME = "carbon.zip" VALUE_TAG = "{http://maven.apache.org/POM/4.0.0}value" SURFACE_PLUGIN_ARTIFACT_ID = "maven-surefire-plugin" DATASOURCE_PATHS = {"product-iots": { "CORE": ["conf/datasources/master-datasources.xml", "conf/datasources/cdm-datasources.xml", "conf/datasources/android-datasources.xml"], "BROKER": [], "ANALYTICS": []}, } M2_PATH = {"product-iots": "iot/wso2iot"} DIST_POM_PATH = {"product-is": "modules/distribution/pom.xml", "product-apim": "modules/distribution/product/pom.xml", "product-ei": "distribution/pom.xml"} LIB_PATH = "lib" DISTRIBUTION_PATH = {"product-apim": "modules/distribution/product/target", "product-is": "modules/distribution/target", "product-ei": "distribution/target"} PRODUCT_STORAGE_DIR_NAME = "product" TEST_PLAN_PROPERTY_FILE_NAME = "testplan-props.properties" INFRA_PROPERTY_FILE_NAME = "infrastructure.properties" LOG_FILE_NAME = "integration.log" ORACLE_DB_ENGINE = "ORACLE-SE2" MSSQL_DB_ENGINE = "SQLSERVER-SE" MYSQL_DB_ENGINE = "MYSQL" DEFAULT_ORACLE_SID = "orcl" DEFAULT_DB_USERNAME = "wso2carbon" LOG_STORAGE = "logs" LOG_FILE_PATHS = {"product-apim": [], "product-is": [], "product-ei": []} DB_META_DATA = { "MYSQL": {"prefix": "jdbc:mysql://", "driverClassName": "com.mysql.jdbc.Driver", "jarName": "mysql.jar", "DB_SETUP": { "product-apim": {}, "product-is": {}, "product-ei": {}, "product-iots": {"WSO2_CARBON_DB_CORE": ['dbscripts/mysql5.7.sql'], "WSO2APPM_DB_CORE": ['dbscripts/appmgt/mysql5.7.sql'], "WSO2AM_DB_CORE": ['dbscripts/apimgt/mysql5.7.sql'], "WSO2_MB_STORE_DB_CORE": ['wso2/broker/dbscripts/mb-store/mysql-mb.sql'], "JAGH2_CORE": ['dbscripts/mysql5.7.sql'], "WSO2_SOCIAL_DB_CORE": ['dbscripts/social/mysql/resource.sql'], "DM_DS_CORE": ['dbscripts/cdm/mysql.sql'], "DM_ARCHIVAL_DS_CORE": ['dbscripts/cdm/mysql.sql'], "Android_DB_CORE": ['dbscripts/cdm/plugins/android/mysql.sql']}}}, "SQLSERVER-SE": {"prefix": "jdbc:sqlserver://", "driverClassName": "com.microsoft.sqlserver.jdbc.SQLServerDriver", "jarName": "sqlserver-ex.jar", "DB_SETUP": { "product-apim": {}, "product-is": {}, "product-ei": {"WSO2_CARBON_DB_CORE": ['dbscripts/mssql.sql'], "WSO2_CARBON_DB_BROKER": ['wso2/broker/dbscripts/mssql.sql'], "WSO2_CARBON_DB_BPS": ['wso2/business-process/dbscripts/mssql.sql'], "WSO2_MB_STORE_DB_BROKER": ['wso2/broker/dbscripts/mb-store/mssql-mb.sql'], "WSO2_METRICS_DB_BROKER": ['wso2/broker/dbscripts/metrics/mssql.sql'], "BPS_DS_BPS": ['wso2/business-process/dbscripts/bps/bpel/create/mssql.sql'], "ACTIVITI_DB_BPS": [ 'wso2/business-process/dbscripts/bps/bpmn/create/activiti.mssql.create.identity.sql']}}}, "ORACLE-SE2": {"prefix": "jdbc:oracle:thin:@", "driverClassName": "oracle.jdbc.OracleDriver", "jarName": "oracle-se.jar", "DB_SETUP": { "product-apim": {}, "product-is": {}, "product-ei": {"WSO2_CARBON_DB_CORE": ['dbscripts/oracle.sql'], "WSO2_CARBON_DB_BROKER": ['wso2/broker/dbscripts/oracle.sql'], "WSO2_CARBON_DB_BPS": ['wso2/business-process/dbscripts/oracle.sql'], "WSO2_MB_STORE_DB_BROKER": ['wso2/broker/dbscripts/mb-store/oracle-mb.sql'], "WSO2_METRICS_DB_BROKER": ['wso2/broker/dbscripts/metrics/oracle.sql'], "BPS_DS_BPS": ['wso2/business-process/dbscripts/bps/bpel/create/oracle.sql'], "ACTIVITI_DB_BPS": [ 'wso2/business-process/dbscripts/bps/bpmn/create/activiti.oracle.create.identity.sql']}}}, "POSTGRESQL": {"prefix": "jdbc:postgresql://", "driverClassName": "org.postgresql.Driver", "jarName": "postgres.jar", "DB_SETUP": {"product-apim": {}, "product-is": {}, "product-ei": {}} }}
ns = {'d': 'http://maven.apache.org/POM/4.0.0'} zip_file_extension = '.zip' carbon_name = 'carbon.zip' value_tag = '{http://maven.apache.org/POM/4.0.0}value' surface_plugin_artifact_id = 'maven-surefire-plugin' datasource_paths = {'product-iots': {'CORE': ['conf/datasources/master-datasources.xml', 'conf/datasources/cdm-datasources.xml', 'conf/datasources/android-datasources.xml'], 'BROKER': [], 'ANALYTICS': []}} m2_path = {'product-iots': 'iot/wso2iot'} dist_pom_path = {'product-is': 'modules/distribution/pom.xml', 'product-apim': 'modules/distribution/product/pom.xml', 'product-ei': 'distribution/pom.xml'} lib_path = 'lib' distribution_path = {'product-apim': 'modules/distribution/product/target', 'product-is': 'modules/distribution/target', 'product-ei': 'distribution/target'} product_storage_dir_name = 'product' test_plan_property_file_name = 'testplan-props.properties' infra_property_file_name = 'infrastructure.properties' log_file_name = 'integration.log' oracle_db_engine = 'ORACLE-SE2' mssql_db_engine = 'SQLSERVER-SE' mysql_db_engine = 'MYSQL' default_oracle_sid = 'orcl' default_db_username = 'wso2carbon' log_storage = 'logs' log_file_paths = {'product-apim': [], 'product-is': [], 'product-ei': []} db_meta_data = {'MYSQL': {'prefix': 'jdbc:mysql://', 'driverClassName': 'com.mysql.jdbc.Driver', 'jarName': 'mysql.jar', 'DB_SETUP': {'product-apim': {}, 'product-is': {}, 'product-ei': {}, 'product-iots': {'WSO2_CARBON_DB_CORE': ['dbscripts/mysql5.7.sql'], 'WSO2APPM_DB_CORE': ['dbscripts/appmgt/mysql5.7.sql'], 'WSO2AM_DB_CORE': ['dbscripts/apimgt/mysql5.7.sql'], 'WSO2_MB_STORE_DB_CORE': ['wso2/broker/dbscripts/mb-store/mysql-mb.sql'], 'JAGH2_CORE': ['dbscripts/mysql5.7.sql'], 'WSO2_SOCIAL_DB_CORE': ['dbscripts/social/mysql/resource.sql'], 'DM_DS_CORE': ['dbscripts/cdm/mysql.sql'], 'DM_ARCHIVAL_DS_CORE': ['dbscripts/cdm/mysql.sql'], 'Android_DB_CORE': ['dbscripts/cdm/plugins/android/mysql.sql']}}}, 'SQLSERVER-SE': {'prefix': 'jdbc:sqlserver://', 'driverClassName': 'com.microsoft.sqlserver.jdbc.SQLServerDriver', 'jarName': 'sqlserver-ex.jar', 'DB_SETUP': {'product-apim': {}, 'product-is': {}, 'product-ei': {'WSO2_CARBON_DB_CORE': ['dbscripts/mssql.sql'], 'WSO2_CARBON_DB_BROKER': ['wso2/broker/dbscripts/mssql.sql'], 'WSO2_CARBON_DB_BPS': ['wso2/business-process/dbscripts/mssql.sql'], 'WSO2_MB_STORE_DB_BROKER': ['wso2/broker/dbscripts/mb-store/mssql-mb.sql'], 'WSO2_METRICS_DB_BROKER': ['wso2/broker/dbscripts/metrics/mssql.sql'], 'BPS_DS_BPS': ['wso2/business-process/dbscripts/bps/bpel/create/mssql.sql'], 'ACTIVITI_DB_BPS': ['wso2/business-process/dbscripts/bps/bpmn/create/activiti.mssql.create.identity.sql']}}}, 'ORACLE-SE2': {'prefix': 'jdbc:oracle:thin:@', 'driverClassName': 'oracle.jdbc.OracleDriver', 'jarName': 'oracle-se.jar', 'DB_SETUP': {'product-apim': {}, 'product-is': {}, 'product-ei': {'WSO2_CARBON_DB_CORE': ['dbscripts/oracle.sql'], 'WSO2_CARBON_DB_BROKER': ['wso2/broker/dbscripts/oracle.sql'], 'WSO2_CARBON_DB_BPS': ['wso2/business-process/dbscripts/oracle.sql'], 'WSO2_MB_STORE_DB_BROKER': ['wso2/broker/dbscripts/mb-store/oracle-mb.sql'], 'WSO2_METRICS_DB_BROKER': ['wso2/broker/dbscripts/metrics/oracle.sql'], 'BPS_DS_BPS': ['wso2/business-process/dbscripts/bps/bpel/create/oracle.sql'], 'ACTIVITI_DB_BPS': ['wso2/business-process/dbscripts/bps/bpmn/create/activiti.oracle.create.identity.sql']}}}, 'POSTGRESQL': {'prefix': 'jdbc:postgresql://', 'driverClassName': 'org.postgresql.Driver', 'jarName': 'postgres.jar', 'DB_SETUP': {'product-apim': {}, 'product-is': {}, 'product-ei': {}}}}
name = "Angela" letters_list = [x for x in name] print(letters_list) doubled = [x * 2 for x in range(1, 5)] print(doubled) maybe_tripled = [x * 3 for x in range(1, 10) if x > 5] print(maybe_tripled) def foo(value): if value > 5: return True return False with_fn = [x * 3 for x in range(1, 10) if foo(x)] print(with_fn) squared = [x * x for x in range(1, 51)] print(squared) even = [x for x in [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] if x % 2 == 0] print(even)
name = 'Angela' letters_list = [x for x in name] print(letters_list) doubled = [x * 2 for x in range(1, 5)] print(doubled) maybe_tripled = [x * 3 for x in range(1, 10) if x > 5] print(maybe_tripled) def foo(value): if value > 5: return True return False with_fn = [x * 3 for x in range(1, 10) if foo(x)] print(with_fn) squared = [x * x for x in range(1, 51)] print(squared) even = [x for x in [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] if x % 2 == 0] print(even)
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def reverseBetween(self, head: ListNode, left: int, right: int) -> ListNode: left -= 1 right -= 1 newHead = ListNode(-1) newHead.next = head deque = collections.deque() current = newHead.next for index in range(right + 1): if left <= index <= right: deque.append(current) current = current.next while len(deque) >= 2: front = deque.popleft() back = deque.pop() front.val, back.val = back.val, front.val return newHead.next
class Solution: def reverse_between(self, head: ListNode, left: int, right: int) -> ListNode: left -= 1 right -= 1 new_head = list_node(-1) newHead.next = head deque = collections.deque() current = newHead.next for index in range(right + 1): if left <= index <= right: deque.append(current) current = current.next while len(deque) >= 2: front = deque.popleft() back = deque.pop() (front.val, back.val) = (back.val, front.val) return newHead.next
# entrada 3 float A = float(input()) B = float(input()) C = float(input()) # variaveis (pesos) P1 = 2 P2 = 3 P3 = 5 # calculo da media MEDIA = ((A * P1) + (B*P2) + (C*P3)) / (P1+P2+P3) print('MEDIA = {:.1f}'.format(MEDIA))
a = float(input()) b = float(input()) c = float(input()) p1 = 2 p2 = 3 p3 = 5 media = (A * P1 + B * P2 + C * P3) / (P1 + P2 + P3) print('MEDIA = {:.1f}'.format(MEDIA))
def get_CUDA(vectorSize = 10, func = "sin(2*pi*X/Lx)", px = "0.", py = "0.", pz = "0.", **kwargs): return '''__global__ void initialize(dcmplx *QField, int* lattice, int* gpu_params){ int deviceNum = gpu_params[0]; int numGPUs = gpu_params[2]; int xSize = lattice[0]*numGPUs; int ySize = lattice[2]; int zSize = lattice[4]; int vectorSize = ''' + str(vectorSize) + '''; int x = blockIdx.x * blockDim.x + threadIdx.x; int y = blockIdx.y * blockDim.y + threadIdx.y; int z = blockIdx.z * blockDim.z + threadIdx.z; double this_x = double(x+deviceNum*lattice[0]); int n; dcmplx i(0.,1.); double X = (double)(this_x); double Y = (double)(y); double Z = (double)(z); double Lx = (double) xSize; double Ly = (double) ySize; double Lz = (double) zSize; dcmplx phaseKickX = exp(i*(-('''+str(px)+''')*2.*pi)*(X)/Lx); dcmplx phaseKickY = exp(i*(-('''+str(py)+''')*2.*pi)*(Y)/Ly); dcmplx phaseKickZ = exp(i*(-('''+str(pz)+''')*2.*pi)*(Z)/Lz); dcmplx field = ''' + func + '''*phaseKickX*phaseKickY*phaseKickZ; for (n=0; n<vectorSize; n=n+1){ QField[n+z*vectorSize+y*vectorSize*zSize+x*zSize*ySize*vectorSize] = field/2.; } }'''
def get_cuda(vectorSize=10, func='sin(2*pi*X/Lx)', px='0.', py='0.', pz='0.', **kwargs): return '__global__ void initialize(dcmplx *QField, int* lattice, int* gpu_params){\n\tint deviceNum = gpu_params[0];\n\tint numGPUs = gpu_params[2];\n\tint xSize = lattice[0]*numGPUs;\n\tint ySize = lattice[2];\n\tint zSize = lattice[4];\n\tint vectorSize = ' + str(vectorSize) + ';\n\tint x = blockIdx.x * blockDim.x + threadIdx.x;\n\tint y = blockIdx.y * blockDim.y + threadIdx.y;\n\tint z = blockIdx.z * blockDim.z + threadIdx.z;\n\tdouble this_x = double(x+deviceNum*lattice[0]);\n\tint n;\n\tdcmplx i(0.,1.);\n\tdouble X = (double)(this_x);\n\tdouble Y = (double)(y);\n\tdouble Z = (double)(z);\n\tdouble Lx = (double) xSize;\n\tdouble Ly = (double) ySize;\n\tdouble Lz = (double) zSize;\n\tdcmplx phaseKickX = exp(i*(-(' + str(px) + ')*2.*pi)*(X)/Lx);\n\tdcmplx phaseKickY = exp(i*(-(' + str(py) + ')*2.*pi)*(Y)/Ly);\n\tdcmplx phaseKickZ = exp(i*(-(' + str(pz) + ')*2.*pi)*(Z)/Lz);\n\tdcmplx field = ' + func + '*phaseKickX*phaseKickY*phaseKickZ;\n\t\n \n\tfor (n=0; n<vectorSize; n=n+1){\n\t\tQField[n+z*vectorSize+y*vectorSize*zSize+x*zSize*ySize*vectorSize] = field/2.;\n\t} \n}'
""" Empty files are not supported by Signed VSO Builds. Adding dummy file @author: shagup """
""" Empty files are not supported by Signed VSO Builds. Adding dummy file @author: shagup """
answer1 = widget_inputs["radio1"] answer2 = widget_inputs["radio2"] answer3 = widget_inputs["radio3"] answer4 = widget_inputs["radio4"] is_correct = False comments = [] def commentizer(new): if new not in comments: comments.append(new) if answer2 == True: is_correct = True else: is_correct = is_correct and False commentizer("Open the site and try changing `cover` to `contain` in DevTools to see the difference.") commentizer("Check the first one.") if answer3 == True: is_correct = is_correct and True else: is_correct = is_correct and False commentizer("Open the site and try changing `cover` to `contain` in DevTools to see the difference.") commentizer("Check the second one.") if is_correct: commentizer("Great job! You're starting to learn how to decide between raster and vector options.") grade_result["comment"] = "\n\n".join(comments) grade_result["correct"] = is_correct
answer1 = widget_inputs['radio1'] answer2 = widget_inputs['radio2'] answer3 = widget_inputs['radio3'] answer4 = widget_inputs['radio4'] is_correct = False comments = [] def commentizer(new): if new not in comments: comments.append(new) if answer2 == True: is_correct = True else: is_correct = is_correct and False commentizer('Open the site and try changing `cover` to `contain` in DevTools to see the difference.') commentizer('Check the first one.') if answer3 == True: is_correct = is_correct and True else: is_correct = is_correct and False commentizer('Open the site and try changing `cover` to `contain` in DevTools to see the difference.') commentizer('Check the second one.') if is_correct: commentizer("Great job! You're starting to learn how to decide between raster and vector options.") grade_result['comment'] = '\n\n'.join(comments) grade_result['correct'] = is_correct
# # Copyright (c) 2016, Prometheus Research, LLC # __import__('pkg_resources').declare_namespace(__name__)
__import__('pkg_resources').declare_namespace(__name__)
class Solution: def uniquePaths(self, m: int, n: int) -> int: """initialize a n * m array""" paths = [[0 for col in range(m)] for row in range(n)] """ init all item in last row to 1""" for col in range(m): paths[n - 1][col] = 1 """ init all item in last col to 1""" for row in range(n): paths[row][m - 1] = 1 for row in range(n - 2, -1, -1): for col in range(m - 2, -1, -1): paths[row][col] = paths[row][col + 1] + paths[row + 1][col] return paths[0][0] s = Solution() print(s.uniquePaths(23, 18))
class Solution: def unique_paths(self, m: int, n: int) -> int: """initialize a n * m array""" paths = [[0 for col in range(m)] for row in range(n)] ' init all item in last row to 1' for col in range(m): paths[n - 1][col] = 1 ' init all item in last col to 1' for row in range(n): paths[row][m - 1] = 1 for row in range(n - 2, -1, -1): for col in range(m - 2, -1, -1): paths[row][col] = paths[row][col + 1] + paths[row + 1][col] return paths[0][0] s = solution() print(s.uniquePaths(23, 18))
#task1: print the \\ double backslash print("This is \\\\ double backslash") #task2: print the mountains print ("this is /\\/\\/\\/\\/\\ mountain") #task3:he is awesome(using escape sequence) print ("he is \t awesome") #task4: \" \n \t \' print ("\\\" \\n \\t \\\'")
print('This is \\\\ double backslash') print('this is /\\/\\/\\/\\/\\ mountain') print('he is \t awesome') print('\\" \\n \\t \\\'')
class TaskError(Exception): pass class StrategyError(Exception): pass
class Taskerror(Exception): pass class Strategyerror(Exception): pass
# 1 = Ace, 10 = Jack, 10 = Queen, 10 = King deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10] deck = deck * 4 # TODO: Add cut-card functionality def initiate_deck(): """Asks the user how many decks are in play and generates the shoe""" while True: try: deck_count = int(input("How many decks in play? (Max: 8)")) if not 0 < deck_count < 9: raise ValueError break except ValueError: print("Insert a valid count between 0 and 9") return sorted(deck * deck_count)
deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10] deck = deck * 4 def initiate_deck(): """Asks the user how many decks are in play and generates the shoe""" while True: try: deck_count = int(input('How many decks in play? (Max: 8)')) if not 0 < deck_count < 9: raise ValueError break except ValueError: print('Insert a valid count between 0 and 9') return sorted(deck * deck_count)
class Controller: def __init__(self, period, init_cores, st=0.8): self.period = period self.init_cores = init_cores self.st = st self.name = type(self).__name__ def setName(self, name): self.name = name def setSLA(self, sla): self.sla = sla self.setpoint = sla*self.st def setMonitoring(self, monitoring): self.monitoring = monitoring def setGenerator(self, generator): self.generator = generator def tick(self, t): if not t: self.reset() if t and not (t % self.period): self.control(t) return self.cores def control(self, t): pass def reset(self): self.cores = self.init_cores def __str__(self): return "%s - period: %d init_cores: %.2f" % (self.name, self.period, self.init_cores)
class Controller: def __init__(self, period, init_cores, st=0.8): self.period = period self.init_cores = init_cores self.st = st self.name = type(self).__name__ def set_name(self, name): self.name = name def set_sla(self, sla): self.sla = sla self.setpoint = sla * self.st def set_monitoring(self, monitoring): self.monitoring = monitoring def set_generator(self, generator): self.generator = generator def tick(self, t): if not t: self.reset() if t and (not t % self.period): self.control(t) return self.cores def control(self, t): pass def reset(self): self.cores = self.init_cores def __str__(self): return '%s - period: %d init_cores: %.2f' % (self.name, self.period, self.init_cores)
r""" Utility functions for building Sage """ # **************************************************************************** # Copyright (C) 2017 Jeroen Demeyer <J.Demeyer@UGent.be> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # https://www.gnu.org/licenses/ # **************************************************************************** def stable_uniq(L): """ Given an iterable L, remove duplicate items from L by keeping only the last occurrence of any item. The items must be hashable. EXAMPLES:: sage: from sage_setup.util import stable_uniq sage: stable_uniq( (1, 2, 3, 4, 5, 6, 3, 7, 5, 1, 5, 9) ) [2, 4, 6, 3, 7, 1, 5, 9] """ D = {} for pos, item in enumerate(L): D[item] = pos # Store the last position where an item appears return sorted(D, key=lambda item: D[item]) def have_module(name): """ Check whether a Python module named ``name`` can be imported. This is done by trying to import that module and returning ``True`` if that import succeeded. So, as a side effect, the module is actually imported if possible. EXAMPLES:: sage: from sage_setup.util import have_module sage: have_module("itertools") True sage: have_module("sage.rings.integer") True sage: have_module("no.such.module") False """ try: __import__(name, {}, {}, [], 0) return True except ImportError: return False
""" Utility functions for building Sage """ def stable_uniq(L): """ Given an iterable L, remove duplicate items from L by keeping only the last occurrence of any item. The items must be hashable. EXAMPLES:: sage: from sage_setup.util import stable_uniq sage: stable_uniq( (1, 2, 3, 4, 5, 6, 3, 7, 5, 1, 5, 9) ) [2, 4, 6, 3, 7, 1, 5, 9] """ d = {} for (pos, item) in enumerate(L): D[item] = pos return sorted(D, key=lambda item: D[item]) def have_module(name): """ Check whether a Python module named ``name`` can be imported. This is done by trying to import that module and returning ``True`` if that import succeeded. So, as a side effect, the module is actually imported if possible. EXAMPLES:: sage: from sage_setup.util import have_module sage: have_module("itertools") True sage: have_module("sage.rings.integer") True sage: have_module("no.such.module") False """ try: __import__(name, {}, {}, [], 0) return True except ImportError: return False
# *************************************************************************************** # *************************************************************************************** # # Name : democodegenerator.py # Author : Paul Robson (paul@robsons.org.uk) # Date : 17th December 2018 # Purpose : Imaginary language code generator. # # *************************************************************************************** # *************************************************************************************** # *************************************************************************************** # # Code generator for an imaginary CPU, for testing # # *************************************************************************************** class DemoCodeGenerator(object): def __init__(self,optimise = False): self.addr = 0x1000 # code space self.memoryAddr = 0x3000 # uninitialised data self.opNames = {} for op in "+add;-sub;*mult;/div;%mod;&and;|or;^xor".split(";"): self.opNames[op[0]] = op[1:] self.jumpTypes = { "":"jmp","#":"jnz","=":"jz","+":"jpe","-":"jmi" } # # Get current address in code space. # def getAddress(self): return self.addr # # Allocate memory for a variable. # def allocate(self,count = 1): address = self.memoryAddr for i in range(0,count): print("${0:06x} : dw 0".format(self.memoryAddr)) self.memoryAddr += 2 return address # # Place an ASCIIZ string constant ... somewhere .... return its address # def stringConstant(self,str): print("${0:06x} : db '{1}',0".format(self.addr,str)) # can be inline, or elsewhere addr = self.addr self.addr = self.addr + len(str) + 1 return addr # # Load Accumulator with constant or term. # def loadARegister(self,term): if term[0]: print("${0:06x} : ldr a,(${1:04x})".format(self.addr,term[1])) else: print("${0:06x} : ldr a,#${1:04x}".format(self.addr,term[1])) self.addr += 1 # # Perform a binary operation with a constant/term on the accumulator. # def binaryOperation(self,operator,term): if operator == "!" or operator == "?": # indirect, we do add then read self.binaryOperation("+",term) # add will optimise a bit print("${0:06x} : ldr.{1} a,[a]".format(self.addr,"w" if operator == "!" else "b")) self.addr += 1 return operator = self.opNames[operator] # convert op to opcode name if term[0]: print("${0:06x} : {1:4} a,(${2:04x})".format(self.addr,operator,term[1])) self.addr += 1 else: print("${0:06x} : {1:4} a,#${2:04x}".format(self.addr,operator,term[1])) self.addr += 1 # # Save A at the address given # def saveDirect(self,address): print("${0:06x} : str a,(${1:04x})".format(self.addr,address)) self.addr += 1 # # Save temp register indirect through A, byte or word, and put temp back in A # def saveTempIndirect(self,isWord): print("${0:06x} : str.{1} b,[a]".format(self.addr," " if isWord else "b")) print("${0:06x} : tba".format(self.addr+1)) self.addr += 2 # # Copy A to the temp register, A value unknown after this. # def copyToTemp(self): print("${0:06x} : tab".format(self.addr)) self.addr += 1 # # Compile a call to a procedure (call should protect 'A') # def callProcedure(self,address): print("${0:06x} : call ${1:06x}".format(self.addr,address)) self.addr += 1 # # Return from procedure (should protect A) # def returnProcedure(self): print("${0:06x} : ret".format(self.addr)) self.addr += 1 # # Compile a jump with the given condition ( "", "=", "#", "+" "-""). The # target address is not known yet. # def compileJump(self,condition): assert condition in self.jumpTypes print("${0:06x} : {1:3} ?????".format(self.addr,self.jumpTypes[condition])) jumpAddr = self.addr self.addr += 1 return jumpAddr # # Patch a jump given its base addres # def patchJump(self,jumpAddr,target): print("${0:06x} : (Set target to ${1:06x})".format(jumpAddr,target)) # # Compile the top of a for loop. # def forTopCode(self,indexVar): loop = self.getAddress() print("${0:06x} : dec a".format(self.addr)) # decrement count print("${0:06x} : push a".format(self.addr+1)) # push on stack self.addr += 2 if indexVar is not None: # if index exists put it there self.saveDirect(indexVar.getValue()) return loop # # Compile the bottom of a for loop # def forBottomCode(self,loopAddress): print("${0:06x} : pop a".format(self.addr)) # pop off stack, jump if not done print("${0:06x} : jnz ${1:06x}".format(self.addr+1,loopAddress)) self.addr += 2
class Democodegenerator(object): def __init__(self, optimise=False): self.addr = 4096 self.memoryAddr = 12288 self.opNames = {} for op in '+add;-sub;*mult;/div;%mod;&and;|or;^xor'.split(';'): self.opNames[op[0]] = op[1:] self.jumpTypes = {'': 'jmp', '#': 'jnz', '=': 'jz', '+': 'jpe', '-': 'jmi'} def get_address(self): return self.addr def allocate(self, count=1): address = self.memoryAddr for i in range(0, count): print('${0:06x} : dw 0'.format(self.memoryAddr)) self.memoryAddr += 2 return address def string_constant(self, str): print("${0:06x} : db '{1}',0".format(self.addr, str)) addr = self.addr self.addr = self.addr + len(str) + 1 return addr def load_a_register(self, term): if term[0]: print('${0:06x} : ldr a,(${1:04x})'.format(self.addr, term[1])) else: print('${0:06x} : ldr a,#${1:04x}'.format(self.addr, term[1])) self.addr += 1 def binary_operation(self, operator, term): if operator == '!' or operator == '?': self.binaryOperation('+', term) print('${0:06x} : ldr.{1} a,[a]'.format(self.addr, 'w' if operator == '!' else 'b')) self.addr += 1 return operator = self.opNames[operator] if term[0]: print('${0:06x} : {1:4} a,(${2:04x})'.format(self.addr, operator, term[1])) self.addr += 1 else: print('${0:06x} : {1:4} a,#${2:04x}'.format(self.addr, operator, term[1])) self.addr += 1 def save_direct(self, address): print('${0:06x} : str a,(${1:04x})'.format(self.addr, address)) self.addr += 1 def save_temp_indirect(self, isWord): print('${0:06x} : str.{1} b,[a]'.format(self.addr, ' ' if isWord else 'b')) print('${0:06x} : tba'.format(self.addr + 1)) self.addr += 2 def copy_to_temp(self): print('${0:06x} : tab'.format(self.addr)) self.addr += 1 def call_procedure(self, address): print('${0:06x} : call ${1:06x}'.format(self.addr, address)) self.addr += 1 def return_procedure(self): print('${0:06x} : ret'.format(self.addr)) self.addr += 1 def compile_jump(self, condition): assert condition in self.jumpTypes print('${0:06x} : {1:3} ?????'.format(self.addr, self.jumpTypes[condition])) jump_addr = self.addr self.addr += 1 return jumpAddr def patch_jump(self, jumpAddr, target): print('${0:06x} : (Set target to ${1:06x})'.format(jumpAddr, target)) def for_top_code(self, indexVar): loop = self.getAddress() print('${0:06x} : dec a'.format(self.addr)) print('${0:06x} : push a'.format(self.addr + 1)) self.addr += 2 if indexVar is not None: self.saveDirect(indexVar.getValue()) return loop def for_bottom_code(self, loopAddress): print('${0:06x} : pop a'.format(self.addr)) print('${0:06x} : jnz ${1:06x}'.format(self.addr + 1, loopAddress)) self.addr += 2
# Sphinx helper for Django-specific references def setup(app): app.add_crossref_type( directivename = "label", rolename = "djterm", indextemplate = "pair: %s; label", ) app.add_crossref_type( directivename = "setting", rolename = "setting", indextemplate = "pair: %s; setting", ) app.add_crossref_type( directivename = "templatetag", rolename = "ttag", indextemplate = "pair: %s; template tag", ) app.add_crossref_type( directivename = "templatefilter", rolename = "tfilter", indextemplate = "pair: %s; template filter", ) app.add_crossref_type( directivename = "fieldlookup", rolename = "lookup", indextemplate = "pair: %s; field lookup type", )
def setup(app): app.add_crossref_type(directivename='label', rolename='djterm', indextemplate='pair: %s; label') app.add_crossref_type(directivename='setting', rolename='setting', indextemplate='pair: %s; setting') app.add_crossref_type(directivename='templatetag', rolename='ttag', indextemplate='pair: %s; template tag') app.add_crossref_type(directivename='templatefilter', rolename='tfilter', indextemplate='pair: %s; template filter') app.add_crossref_type(directivename='fieldlookup', rolename='lookup', indextemplate='pair: %s; field lookup type')
""" Contains utility functions to works with learning-object get many. """ def get_many(db_client, filter_, range_, sorted_, user, learning_object_format): """Get learning objects with query.""" start, end = range_ field, order = sorted_ user_role = user.get('role') user_id = user.get('id') # Role level permissions user_role_permissions_handler = { 'oai': [ {'status': 'accepted', 'deleted': { '$in': [True, False] }} ], 'external': [ {'status': 'accepted', 'deleted': False}, ], 'creator': [ { 'creator_id': user_id, 'status': { '$in': ['pending', 'evaluated', 'accepted', 'rejected'] } }, {'status': 'accepted', 'deleted': False}, ], 'expert': [ { 'expert_ids': user_id, 'status': { '$in': ['pending', 'evaluated', 'accepted', 'rejected'] } }, { 'creator_id': user_id, 'status': { '$in': ['pending', 'evaluated', 'accepted', 'rejected'] } }, {'status': 'accepted', 'deleted': False} ], 'administrator': [ {} ], } initial_query = {'$or': user_role_permissions_handler.get(user_role)} if filter_.get('q'): query = {'$text': { '$search': filter_.get('q'), '$diacriticSensitive': False, '$caseSensitive': False, }} query = {**initial_query, **query} cursor = db_client.learning_objects.find( query ) learning_objects = list( cursor .skip(start) .limit((end - start) + 1) ) else: query = {**initial_query, **filter_} cursor = db_client.learning_objects.find(query) learning_objects = list( cursor .sort([(field, -1 if order == 'DESC' else 1)]) .skip(start) .limit((end - start) + 1) ) if learning_object_format: format_handler = { 'xml': lambda lo: lo.get('metadata_xml'), } for index_lo in range(len(learning_objects)): learning_objects[index_lo]['metadata'] = format_handler[learning_object_format]( learning_objects[index_lo]) return learning_objects, cursor.count()
""" Contains utility functions to works with learning-object get many. """ def get_many(db_client, filter_, range_, sorted_, user, learning_object_format): """Get learning objects with query.""" (start, end) = range_ (field, order) = sorted_ user_role = user.get('role') user_id = user.get('id') user_role_permissions_handler = {'oai': [{'status': 'accepted', 'deleted': {'$in': [True, False]}}], 'external': [{'status': 'accepted', 'deleted': False}], 'creator': [{'creator_id': user_id, 'status': {'$in': ['pending', 'evaluated', 'accepted', 'rejected']}}, {'status': 'accepted', 'deleted': False}], 'expert': [{'expert_ids': user_id, 'status': {'$in': ['pending', 'evaluated', 'accepted', 'rejected']}}, {'creator_id': user_id, 'status': {'$in': ['pending', 'evaluated', 'accepted', 'rejected']}}, {'status': 'accepted', 'deleted': False}], 'administrator': [{}]} initial_query = {'$or': user_role_permissions_handler.get(user_role)} if filter_.get('q'): query = {'$text': {'$search': filter_.get('q'), '$diacriticSensitive': False, '$caseSensitive': False}} query = {**initial_query, **query} cursor = db_client.learning_objects.find(query) learning_objects = list(cursor.skip(start).limit(end - start + 1)) else: query = {**initial_query, **filter_} cursor = db_client.learning_objects.find(query) learning_objects = list(cursor.sort([(field, -1 if order == 'DESC' else 1)]).skip(start).limit(end - start + 1)) if learning_object_format: format_handler = {'xml': lambda lo: lo.get('metadata_xml')} for index_lo in range(len(learning_objects)): learning_objects[index_lo]['metadata'] = format_handler[learning_object_format](learning_objects[index_lo]) return (learning_objects, cursor.count())
# # PySNMP MIB module SMON2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SMON2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:59:43 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) # smon, = mibBuilder.importSymbols("APPLIC-MIB", "smon") ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint") OwnerString, = mibBuilder.importSymbols("RMON-MIB", "OwnerString") DataSource, LastCreateTime, TimeFilter, hlMatrixControlIndex, ZeroBasedCounter32, protocolDirLocalIndex = mibBuilder.importSymbols("RMON2-MIB", "DataSource", "LastCreateTime", "TimeFilter", "hlMatrixControlIndex", "ZeroBasedCounter32", "protocolDirLocalIndex") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Counter32, Unsigned32, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, ObjectIdentity, MibIdentifier, Integer32, TimeTicks, iso, NotificationType, Counter64, Bits, ModuleIdentity, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Unsigned32", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "ObjectIdentity", "MibIdentifier", "Integer32", "TimeTicks", "iso", "NotificationType", "Counter64", "Bits", "ModuleIdentity", "Gauge32") TimeStamp, TextualConvention, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TimeStamp", "TextualConvention", "RowStatus", "DisplayString") xsSmon = MibIdentifier((1, 3, 6, 1, 4, 1, 81, 30, 2)) xsSmonResourceAllocation = MibScalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSmonResourceAllocation.setStatus('current') xsHostTopN = MibIdentifier((1, 3, 6, 1, 4, 1, 81, 30, 2, 2)) xsHostTopNControlTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1), ) if mibBuilder.loadTexts: xsHostTopNControlTable.setStatus('current') xsHostTopNControlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1), ).setIndexNames((0, "SMON2-MIB", "xsHostTopNControlIndex")) if mibBuilder.loadTexts: xsHostTopNControlEntry.setStatus('current') xsHostTopNControlIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))) if mibBuilder.loadTexts: xsHostTopNControlIndex.setStatus('current') xsHostTopNControlHostIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsHostTopNControlHostIndex.setStatus('current') xsHostTopNControlRateBase = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("xsHostTopNInPkts", 1), ("xsHostTopNOutPkts", 2), ("xsHostTopNInOctets", 3), ("xsHostTopNOutOctets", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsHostTopNControlRateBase.setStatus('current') xsHostTopNControlTimeRemaining = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsHostTopNControlTimeRemaining.setStatus('current') xsHostTopNControlDuration = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsHostTopNControlDuration.setStatus('current') xsHostTopNControlRequestedSize = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647)).clone(150)).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsHostTopNControlRequestedSize.setStatus('current') xsHostTopNControlGrantedSize = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: xsHostTopNControlGrantedSize.setStatus('current') xsHostTopNControlStartTime = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 8), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsHostTopNControlStartTime.setStatus('current') xsHostTopNControlOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 9), OwnerString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsHostTopNControlOwner.setStatus('current') xsHostTopNControlStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 10), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsHostTopNControlStatus.setStatus('current') xsHostTopNTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 2), ) if mibBuilder.loadTexts: xsHostTopNTable.setStatus('current') xsHostTopNEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 2, 1), ).setIndexNames((0, "SMON2-MIB", "xsHostTopNControlIndex"), (0, "SMON2-MIB", "xsHostTopNIndex")) if mibBuilder.loadTexts: xsHostTopNEntry.setStatus('current') xsHostTopNIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))) if mibBuilder.loadTexts: xsHostTopNIndex.setStatus('current') xsHostTopNProtocolDirLocalIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: xsHostTopNProtocolDirLocalIndex.setStatus('current') xsHostTopNNlAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 2, 1, 3), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsHostTopNNlAddress.setStatus('current') xsHostTopNRate = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 2, 1, 4), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsHostTopNRate.setStatus('current') xsFilter = MibIdentifier((1, 3, 6, 1, 4, 1, 81, 30, 2, 3)) xsHostFilterTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1), ) if mibBuilder.loadTexts: xsHostFilterTable.setStatus('current') xsHostFilterEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1), ).setIndexNames((0, "SMON2-MIB", "xsHostFilterIpAddress")) if mibBuilder.loadTexts: xsHostFilterEntry.setStatus('current') xsHostFilterType = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("ipHost", 1), ("ipSubnet", 2), ("ipxNet", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: xsHostFilterType.setStatus('current') xsHostFilterIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1, 2), OctetString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: xsHostFilterIpAddress.setStatus('current') xsHostFilterIpSubnet = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1, 3), OctetString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: xsHostFilterIpSubnet.setStatus('current') xsHostFilterIpMask = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1, 4), OctetString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: xsHostFilterIpMask.setStatus('current') xsHostFilterIpxAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1, 5), OctetString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: xsHostFilterIpxAddress.setStatus('current') xsHostFilterStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 4))).clone(namedValues=NamedValues(("valid", 1), ("invalid", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: xsHostFilterStatus.setStatus('current') xsHostFilterTableClear = MibScalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("idle", 1), ("clear", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: xsHostFilterTableClear.setStatus('current') xsSubnet = MibIdentifier((1, 3, 6, 1, 4, 1, 81, 30, 2, 4)) xsSubnetControlTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1), ) if mibBuilder.loadTexts: xsSubnetControlTable.setStatus('current') xsSubnetControlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1), ).setIndexNames((0, "SMON2-MIB", "xsSubnetControlIndex")) if mibBuilder.loadTexts: xsSubnetControlEntry.setStatus('current') xsSubnetControlIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))) if mibBuilder.loadTexts: xsSubnetControlIndex.setStatus('current') xsSubnetControlDataSource = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 2), DataSource()).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsSubnetControlDataSource.setStatus('current') xsSubnetControlInserts = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSubnetControlInserts.setStatus('current') xsSubnetControlDeletes = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSubnetControlDeletes.setStatus('current') xsSubnetControlMaxDesiredEntries = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-1, 2147483647))).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsSubnetControlMaxDesiredEntries.setStatus('current') xsSubnetControlOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 6), OwnerString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsSubnetControlOwner.setStatus('current') xsSubnetControlStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 7), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsSubnetControlStatus.setStatus('current') xsSubnetTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2), ) if mibBuilder.loadTexts: xsSubnetTable.setStatus('current') xsSubnetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1), ).setIndexNames((0, "SMON2-MIB", "xsSubnetControlIndex"), (0, "SMON2-MIB", "xsSubnetTimeMark"), (0, "RMON2-MIB", "protocolDirLocalIndex"), (0, "SMON2-MIB", "xsSubnetAddress"), (0, "SMON2-MIB", "xsSubnetMask"), (0, "RMON2-MIB", "protocolDirLocalIndex")) if mibBuilder.loadTexts: xsSubnetEntry.setStatus('current') xsSubnetTimeMark = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1, 1), TimeFilter()) if mibBuilder.loadTexts: xsSubnetTimeMark.setStatus('current') xsSubnetAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1, 2), OctetString()) if mibBuilder.loadTexts: xsSubnetAddress.setStatus('current') xsSubnetMask = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1, 3), OctetString()) if mibBuilder.loadTexts: xsSubnetMask.setStatus('current') xsSubnetInPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1, 4), ZeroBasedCounter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSubnetInPkts.setStatus('current') xsSubnetOutPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1, 5), ZeroBasedCounter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSubnetOutPkts.setStatus('current') xsSubnetCreateTime = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1, 6), LastCreateTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSubnetCreateTime.setStatus('current') xsSubnetMatrixControlTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3), ) if mibBuilder.loadTexts: xsSubnetMatrixControlTable.setStatus('current') xsSubnetMatrixControlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1), ).setIndexNames((0, "SMON2-MIB", "xsSubnetMatrixControlIndex")) if mibBuilder.loadTexts: xsSubnetMatrixControlEntry.setStatus('current') xsSubnetMatrixControlIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))) if mibBuilder.loadTexts: xsSubnetMatrixControlIndex.setStatus('current') xsSubnetMatrixControlDataSource = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 2), DataSource()).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsSubnetMatrixControlDataSource.setStatus('current') xsSubnetMatrixControlInserts = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSubnetMatrixControlInserts.setStatus('current') xsSubnetMatrixControlDeletes = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSubnetMatrixControlDeletes.setStatus('current') xsSubnetMatrixControlMaxDesiredEntries = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-1, 2147483647))).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsSubnetMatrixControlMaxDesiredEntries.setStatus('current') xsSubnetMatrixControlOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 7), OwnerString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsSubnetMatrixControlOwner.setStatus('current') xsSubnetMatrixControlStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 8), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: xsSubnetMatrixControlStatus.setStatus('current') xsSubnetMatrixSDTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4), ) if mibBuilder.loadTexts: xsSubnetMatrixSDTable.setStatus('current') xsSubnetMatrixSDEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1), ).setIndexNames((0, "SMON2-MIB", "xsSubnetMatrixControlIndex"), (0, "SMON2-MIB", "xsSubnetMatrixSDTimeMark"), (0, "RMON2-MIB", "protocolDirLocalIndex"), (0, "SMON2-MIB", "xsSubnetMatrixSDSourceAddress"), (0, "SMON2-MIB", "xsSubnetMatrixSDSourceMask"), (0, "SMON2-MIB", "xsSubnetMatrixSDDestAddress"), (0, "SMON2-MIB", "xsSubnetMatrixSDDestMask"), (0, "RMON2-MIB", "protocolDirLocalIndex")) if mibBuilder.loadTexts: xsSubnetMatrixSDEntry.setStatus('current') xsSubnetMatrixSDTimeMark = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 1), TimeFilter()) if mibBuilder.loadTexts: xsSubnetMatrixSDTimeMark.setStatus('current') xsSubnetMatrixSDSourceAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 2), OctetString()) if mibBuilder.loadTexts: xsSubnetMatrixSDSourceAddress.setStatus('current') xsSubnetMatrixSDSourceMask = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 3), OctetString()) if mibBuilder.loadTexts: xsSubnetMatrixSDSourceMask.setStatus('current') xsSubnetMatrixSDDestAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 4), OctetString()) if mibBuilder.loadTexts: xsSubnetMatrixSDDestAddress.setStatus('current') xsSubnetMatrixSDDestMask = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 5), OctetString()) if mibBuilder.loadTexts: xsSubnetMatrixSDDestMask.setStatus('current') xsSubnetMatrixSDPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 6), ZeroBasedCounter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSubnetMatrixSDPkts.setStatus('current') xsSubnetMatrixSDCreateTime = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 7), LastCreateTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSubnetMatrixSDCreateTime.setStatus('current') xsSubnetMatrixDSTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5), ) if mibBuilder.loadTexts: xsSubnetMatrixDSTable.setStatus('current') xsSubnetMatrixDSEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1), ).setIndexNames((0, "RMON2-MIB", "hlMatrixControlIndex"), (0, "SMON2-MIB", "xsSubnetMatrixDSTimeMark"), (0, "RMON2-MIB", "protocolDirLocalIndex"), (0, "SMON2-MIB", "xsSubnetMatrixDSDestAddress"), (0, "SMON2-MIB", "xsSubnetMatrixDSDestMask"), (0, "SMON2-MIB", "xsSubnetMatrixDSSourceAddress"), (0, "SMON2-MIB", "xsSubnetMatrixDSSourceMask"), (0, "RMON2-MIB", "protocolDirLocalIndex")) if mibBuilder.loadTexts: xsSubnetMatrixDSEntry.setStatus('current') xsSubnetMatrixDSTimeMark = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 1), TimeFilter()) if mibBuilder.loadTexts: xsSubnetMatrixDSTimeMark.setStatus('current') xsSubnetMatrixDSSourceAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 2), OctetString()) if mibBuilder.loadTexts: xsSubnetMatrixDSSourceAddress.setStatus('current') xsSubnetMatrixDSSourceMask = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 3), OctetString()) if mibBuilder.loadTexts: xsSubnetMatrixDSSourceMask.setStatus('current') xsSubnetMatrixDSDestAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 4), OctetString()) if mibBuilder.loadTexts: xsSubnetMatrixDSDestAddress.setStatus('current') xsSubnetMatrixDSDestMask = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 5), OctetString()) if mibBuilder.loadTexts: xsSubnetMatrixDSDestMask.setStatus('current') xsSubnetMatrixDSPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 6), ZeroBasedCounter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSubnetMatrixDSPkts.setStatus('current') xsSubnetMatrixDSCreateTime = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 7), LastCreateTime()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSubnetMatrixDSCreateTime.setStatus('current') xsNumberOfProtocols = MibScalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsNumberOfProtocols.setStatus('current') xsProtocolDistStatsTimeStamp = MibScalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 6), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsProtocolDistStatsTimeStamp.setStatus('current') xsNlHostTimeStamp = MibScalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 7), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsNlHostTimeStamp.setStatus('current') xsSubnetStatsTimeStamp = MibScalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 8), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsSubnetStatsTimeStamp.setStatus('current') xsActiveApplications = MibIdentifier((1, 3, 6, 1, 4, 1, 81, 30, 2, 9)) xsActiveApplicationsBitMask = MibScalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 9, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(128, 128)).setFixedLength(128)).setMaxAccess("readonly") if mibBuilder.loadTexts: xsActiveApplicationsBitMask.setStatus('current') xsActiveApplicationsTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 2, 9, 2), ) if mibBuilder.loadTexts: xsActiveApplicationsTable.setStatus('current') xsActiveApplicationsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 2, 9, 2, 1), ).setIndexNames((0, "SMON2-MIB", "xsActiveApplicationsIndex")) if mibBuilder.loadTexts: xsActiveApplicationsEntry.setStatus('current') xsActiveApplicationsIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 9, 2, 1, 1), Integer32()) if mibBuilder.loadTexts: xsActiveApplicationsIndex.setStatus('current') xsActiveApplicationsPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 2, 9, 2, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: xsActiveApplicationsPkts.setStatus('current') xsSmonStatus = MibScalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("operate", 1), ("paused", 2))).clone('paused')).setMaxAccess("readwrite") if mibBuilder.loadTexts: xsSmonStatus.setStatus('current') drSmon = MibIdentifier((1, 3, 6, 1, 4, 1, 81, 30, 4)) drSmonConfiguration = MibIdentifier((1, 3, 6, 1, 4, 1, 81, 30, 4, 1)) drSmonControlTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1), ) if mibBuilder.loadTexts: drSmonControlTable.setStatus('current') drSmonControlEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1), ).setIndexNames((0, "SMON2-MIB", "drSmonControlModuleID")) if mibBuilder.loadTexts: drSmonControlEntry.setStatus('current') drSmonControlModuleID = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))) if mibBuilder.loadTexts: drSmonControlModuleID.setStatus('current') drSmonControlRowAddressAutoLearnMode = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 255))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2), ("notSupported", 255)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: drSmonControlRowAddressAutoLearnMode.setStatus('current') drSmonControlRoutedPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: drSmonControlRoutedPackets.setStatus('current') drSmonControlProtocolDistStatsTimeStamp = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1, 4), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: drSmonControlProtocolDistStatsTimeStamp.setStatus('current') drSmonControlMatrixRows = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: drSmonControlMatrixRows.setStatus('current') drSmonControlMatrixCols = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: drSmonControlMatrixCols.setStatus('current') drSmonEntityPlacementTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2), ) if mibBuilder.loadTexts: drSmonEntityPlacementTable.setStatus('current') drSmonEntityPlacementEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2, 1), ).setIndexNames((0, "SMON2-MIB", "drSmonEntityPlacementModuleID"), (0, "SMON2-MIB", "drSmonEntityPlacementIndex")) if mibBuilder.loadTexts: drSmonEntityPlacementEntry.setStatus('current') drSmonEntityPlacementModuleID = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))) if mibBuilder.loadTexts: drSmonEntityPlacementModuleID.setStatus('current') drSmonEntityPlacementIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: drSmonEntityPlacementIndex.setStatus('current') drSmonEntityPlacementAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2, 1, 3), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: drSmonEntityPlacementAddress.setStatus('current') drSmonEntityPlacementMask = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2, 1, 4), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: drSmonEntityPlacementMask.setStatus('current') drSmonEntityPlacementType = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("empty", 1), ("autoLearn", 2), ("filter", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: drSmonEntityPlacementType.setStatus('current') drSmonProtocolDir = MibIdentifier((1, 3, 6, 1, 4, 1, 81, 30, 4, 2)) drSmonProtocolDirLCTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 1), ) if mibBuilder.loadTexts: drSmonProtocolDirLCTable.setStatus('current') drSmonProtocolDirLCEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 1, 1), ).setIndexNames((0, "SMON2-MIB", "drSmonProtocolDirLCModuleID")) if mibBuilder.loadTexts: drSmonProtocolDirLCEntry.setStatus('current') drSmonProtocolDirLCModuleID = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))) if mibBuilder.loadTexts: drSmonProtocolDirLCModuleID.setStatus('current') drSmonProtocolDirLCLastChange = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 1, 1, 2), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: drSmonProtocolDirLCLastChange.setStatus('current') drSmonProtocolDirTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2), ) if mibBuilder.loadTexts: drSmonProtocolDirTable.setStatus('current') drSmonProtocolDirEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1), ).setIndexNames((0, "SMON2-MIB", "drSmonProtocolDirModuleID"), (0, "SMON2-MIB", "drSmonProtocolDirID"), (0, "SMON2-MIB", "drSmonProtocolDirParameters")) if mibBuilder.loadTexts: drSmonProtocolDirEntry.setStatus('current') drSmonProtocolDirModuleID = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))) if mibBuilder.loadTexts: drSmonProtocolDirModuleID.setStatus('current') drSmonProtocolDirID = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 2), OctetString()) if mibBuilder.loadTexts: drSmonProtocolDirID.setStatus('current') drSmonProtocolDirParameters = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 3), OctetString()) if mibBuilder.loadTexts: drSmonProtocolDirParameters.setStatus('current') drSmonProtocolDirLocalIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: drSmonProtocolDirLocalIndex.setStatus('current') drSmonProtocolDirDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))).setMaxAccess("readcreate") if mibBuilder.loadTexts: drSmonProtocolDirDescr.setStatus('current') drSmonProtocolDirType = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 6), Bits().clone(namedValues=NamedValues(("extensible", 0), ("addressRecognitionCapable", 1)))).setMaxAccess("readonly") if mibBuilder.loadTexts: drSmonProtocolDirType.setStatus('current') drSmonProtocolDirAddressMapConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notSupported", 1), ("supportedOff", 2), ("supportedOn", 3)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: drSmonProtocolDirAddressMapConfig.setStatus('current') drSmonProtocolDirHostConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notSupported", 1), ("supportedOff", 2), ("supportedOn", 3)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: drSmonProtocolDirHostConfig.setStatus('current') drSmonProtocolDirMatrixConfig = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notSupported", 1), ("supportedOff", 2), ("supportedOn", 3)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: drSmonProtocolDirMatrixConfig.setStatus('current') drSmonProtocolDirOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 10), OwnerString()).setMaxAccess("readcreate") if mibBuilder.loadTexts: drSmonProtocolDirOwner.setStatus('current') drSmonProtocolDirStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 11), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: drSmonProtocolDirStatus.setStatus('current') drSmonFilter = MibIdentifier((1, 3, 6, 1, 4, 1, 81, 30, 4, 3)) drSmonFilterTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1), ) if mibBuilder.loadTexts: drSmonFilterTable.setStatus('current') drSmonFilterEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1, 1), ).setIndexNames((0, "SMON2-MIB", "drSmonFilterModuleID"), (0, "SMON2-MIB", "drSmonFilterIndex")) if mibBuilder.loadTexts: drSmonFilterEntry.setStatus('current') drSmonFilterModuleID = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))) if mibBuilder.loadTexts: drSmonFilterModuleID.setStatus('current') drSmonFilterIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: drSmonFilterIndex.setStatus('current') drSmonFilterAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1, 1, 3), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: drSmonFilterAddress.setStatus('current') drSmonFilterMask = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1, 1, 4), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: drSmonFilterMask.setStatus('current') drSmonFilterStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1, 1, 5), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: drSmonFilterStatus.setStatus('current') drSmonActiveApplications = MibIdentifier((1, 3, 6, 1, 4, 1, 81, 30, 4, 4)) drSmonActiveApplicationsTable = MibTable((1, 3, 6, 1, 4, 1, 81, 30, 4, 4, 1), ) if mibBuilder.loadTexts: drSmonActiveApplicationsTable.setStatus('current') drSmonActiveApplicationsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 81, 30, 4, 4, 1, 1), ).setIndexNames((0, "SMON2-MIB", "drSmonActiveApplicationsModuleID"), (0, "SMON2-MIB", "drSmonActiveApplicationsType"), (0, "SMON2-MIB", "drSmonActiveApplicationsSubType")) if mibBuilder.loadTexts: drSmonActiveApplicationsEntry.setStatus('current') drSmonActiveApplicationsModuleID = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 4, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))) if mibBuilder.loadTexts: drSmonActiveApplicationsModuleID.setStatus('current') drSmonActiveApplicationsType = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 4, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("ethertype", 1), ("ipProtocol", 2), ("udpProtocol", 3), ("tcpProtocol", 4)))) if mibBuilder.loadTexts: drSmonActiveApplicationsType.setStatus('current') drSmonActiveApplicationsSubType = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 4, 1, 1, 3), Integer32()) if mibBuilder.loadTexts: drSmonActiveApplicationsSubType.setStatus('current') drSmonActiveApplicationsPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 81, 30, 4, 4, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: drSmonActiveApplicationsPkts.setStatus('current') mibBuilder.exportSymbols("SMON2-MIB", xsSubnetMatrixDSSourceAddress=xsSubnetMatrixDSSourceAddress, xsActiveApplications=xsActiveApplications, drSmonProtocolDir=drSmonProtocolDir, drSmonControlRoutedPackets=drSmonControlRoutedPackets, xsFilter=xsFilter, xsHostTopNControlStatus=xsHostTopNControlStatus, xsSmon=xsSmon, drSmonProtocolDirHostConfig=drSmonProtocolDirHostConfig, drSmonFilter=drSmonFilter, xsSubnetMatrixControlMaxDesiredEntries=xsSubnetMatrixControlMaxDesiredEntries, xsSubnetMatrixDSSourceMask=xsSubnetMatrixDSSourceMask, xsSubnetControlEntry=xsSubnetControlEntry, xsSubnetEntry=xsSubnetEntry, xsSubnetMatrixSDTable=xsSubnetMatrixSDTable, drSmonConfiguration=drSmonConfiguration, drSmonControlMatrixRows=drSmonControlMatrixRows, drSmonProtocolDirStatus=drSmonProtocolDirStatus, xsHostFilterEntry=xsHostFilterEntry, drSmonControlModuleID=drSmonControlModuleID, drSmonEntityPlacementEntry=drSmonEntityPlacementEntry, xsSubnetControlTable=xsSubnetControlTable, drSmonProtocolDirAddressMapConfig=drSmonProtocolDirAddressMapConfig, drSmonActiveApplications=drSmonActiveApplications, drSmonEntityPlacementAddress=drSmonEntityPlacementAddress, xsSubnetControlMaxDesiredEntries=xsSubnetControlMaxDesiredEntries, xsSubnetAddress=xsSubnetAddress, xsSubnetMask=xsSubnetMask, drSmonProtocolDirID=drSmonProtocolDirID, drSmonProtocolDirModuleID=drSmonProtocolDirModuleID, drSmonControlEntry=drSmonControlEntry, drSmonActiveApplicationsSubType=drSmonActiveApplicationsSubType, drSmonEntityPlacementIndex=drSmonEntityPlacementIndex, drSmonProtocolDirMatrixConfig=drSmonProtocolDirMatrixConfig, xsHostTopNControlEntry=xsHostTopNControlEntry, drSmonActiveApplicationsEntry=drSmonActiveApplicationsEntry, drSmonProtocolDirParameters=drSmonProtocolDirParameters, xsSubnetControlOwner=xsSubnetControlOwner, xsSubnetMatrixSDPkts=xsSubnetMatrixSDPkts, drSmonProtocolDirLCLastChange=drSmonProtocolDirLCLastChange, drSmonEntityPlacementTable=drSmonEntityPlacementTable, drSmonControlProtocolDistStatsTimeStamp=drSmonControlProtocolDistStatsTimeStamp, drSmonEntityPlacementModuleID=drSmonEntityPlacementModuleID, xsHostTopNControlTimeRemaining=xsHostTopNControlTimeRemaining, drSmonFilterTable=drSmonFilterTable, drSmonEntityPlacementType=drSmonEntityPlacementType, xsSubnetMatrixControlInserts=xsSubnetMatrixControlInserts, xsHostFilterIpSubnet=xsHostFilterIpSubnet, xsHostTopNControlHostIndex=xsHostTopNControlHostIndex, xsSubnetControlInserts=xsSubnetControlInserts, xsSubnetMatrixSDTimeMark=xsSubnetMatrixSDTimeMark, xsHostFilterTableClear=xsHostFilterTableClear, xsSubnetInPkts=xsSubnetInPkts, xsHostFilterType=xsHostFilterType, drSmon=drSmon, xsHostTopNControlGrantedSize=xsHostTopNControlGrantedSize, xsHostTopNControlRequestedSize=xsHostTopNControlRequestedSize, xsActiveApplicationsEntry=xsActiveApplicationsEntry, drSmonActiveApplicationsTable=drSmonActiveApplicationsTable, drSmonFilterAddress=drSmonFilterAddress, xsHostTopNProtocolDirLocalIndex=xsHostTopNProtocolDirLocalIndex, xsProtocolDistStatsTimeStamp=xsProtocolDistStatsTimeStamp, drSmonFilterModuleID=drSmonFilterModuleID, drSmonControlMatrixCols=drSmonControlMatrixCols, xsSubnetMatrixDSTable=xsSubnetMatrixDSTable, xsHostTopNControlIndex=xsHostTopNControlIndex, xsSubnet=xsSubnet, xsHostTopNControlOwner=xsHostTopNControlOwner, xsSubnetMatrixDSCreateTime=xsSubnetMatrixDSCreateTime, xsHostTopNIndex=xsHostTopNIndex, xsSubnetTimeMark=xsSubnetTimeMark, xsSubnetMatrixDSPkts=xsSubnetMatrixDSPkts, drSmonProtocolDirLCModuleID=drSmonProtocolDirLCModuleID, xsSubnetMatrixSDSourceMask=xsSubnetMatrixSDSourceMask, drSmonProtocolDirLCEntry=drSmonProtocolDirLCEntry, xsHostTopNControlDuration=xsHostTopNControlDuration, drSmonControlRowAddressAutoLearnMode=drSmonControlRowAddressAutoLearnMode, xsSubnetMatrixSDDestAddress=xsSubnetMatrixSDDestAddress, xsSubnetMatrixSDDestMask=xsSubnetMatrixSDDestMask, xsHostTopNNlAddress=xsHostTopNNlAddress, xsSubnetMatrixDSTimeMark=xsSubnetMatrixDSTimeMark, drSmonActiveApplicationsPkts=drSmonActiveApplicationsPkts, drSmonProtocolDirDescr=drSmonProtocolDirDescr, xsHostFilterIpMask=xsHostFilterIpMask, drSmonProtocolDirLocalIndex=drSmonProtocolDirLocalIndex, xsHostFilterStatus=xsHostFilterStatus, xsSubnetMatrixControlEntry=xsSubnetMatrixControlEntry, drSmonEntityPlacementMask=drSmonEntityPlacementMask, xsHostFilterIpxAddress=xsHostFilterIpxAddress, drSmonActiveApplicationsType=drSmonActiveApplicationsType, xsNlHostTimeStamp=xsNlHostTimeStamp, xsSubnetMatrixControlStatus=xsSubnetMatrixControlStatus, xsSubnetMatrixControlDataSource=xsSubnetMatrixControlDataSource, xsHostTopNControlStartTime=xsHostTopNControlStartTime, xsSubnetMatrixControlIndex=xsSubnetMatrixControlIndex, xsSubnetMatrixDSDestMask=xsSubnetMatrixDSDestMask, xsNumberOfProtocols=xsNumberOfProtocols, xsActiveApplicationsBitMask=xsActiveApplicationsBitMask, xsActiveApplicationsIndex=xsActiveApplicationsIndex, xsHostTopNEntry=xsHostTopNEntry, drSmonProtocolDirTable=drSmonProtocolDirTable, xsSubnetControlStatus=xsSubnetControlStatus, xsSubnetMatrixControlOwner=xsSubnetMatrixControlOwner, xsSubnetMatrixControlTable=xsSubnetMatrixControlTable, xsSmonStatus=xsSmonStatus, xsSubnetControlIndex=xsSubnetControlIndex, drSmonFilterEntry=drSmonFilterEntry, drSmonProtocolDirEntry=drSmonProtocolDirEntry, drSmonFilterStatus=drSmonFilterStatus, xsHostTopN=xsHostTopN, xsSubnetControlDataSource=xsSubnetControlDataSource, xsSmonResourceAllocation=xsSmonResourceAllocation, drSmonProtocolDirLCTable=drSmonProtocolDirLCTable, drSmonFilterIndex=drSmonFilterIndex, xsSubnetMatrixSDSourceAddress=xsSubnetMatrixSDSourceAddress, xsSubnetMatrixSDCreateTime=xsSubnetMatrixSDCreateTime, xsHostTopNRate=xsHostTopNRate, xsHostFilterIpAddress=xsHostFilterIpAddress, xsSubnetOutPkts=xsSubnetOutPkts, xsSubnetMatrixControlDeletes=xsSubnetMatrixControlDeletes, drSmonProtocolDirOwner=drSmonProtocolDirOwner, xsSubnetMatrixDSDestAddress=xsSubnetMatrixDSDestAddress, xsSubnetControlDeletes=xsSubnetControlDeletes, xsSubnetCreateTime=xsSubnetCreateTime, xsActiveApplicationsTable=xsActiveApplicationsTable, drSmonControlTable=drSmonControlTable, xsHostTopNTable=xsHostTopNTable, drSmonProtocolDirType=drSmonProtocolDirType, drSmonActiveApplicationsModuleID=drSmonActiveApplicationsModuleID, xsSubnetTable=xsSubnetTable, drSmonFilterMask=drSmonFilterMask, xsActiveApplicationsPkts=xsActiveApplicationsPkts, xsSubnetStatsTimeStamp=xsSubnetStatsTimeStamp, xsSubnetMatrixDSEntry=xsSubnetMatrixDSEntry, xsHostTopNControlRateBase=xsHostTopNControlRateBase, xsSubnetMatrixSDEntry=xsSubnetMatrixSDEntry, xsHostFilterTable=xsHostFilterTable, xsHostTopNControlTable=xsHostTopNControlTable)
(smon,) = mibBuilder.importSymbols('APPLIC-MIB', 'smon') (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, constraints_union, single_value_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueRangeConstraint') (owner_string,) = mibBuilder.importSymbols('RMON-MIB', 'OwnerString') (data_source, last_create_time, time_filter, hl_matrix_control_index, zero_based_counter32, protocol_dir_local_index) = mibBuilder.importSymbols('RMON2-MIB', 'DataSource', 'LastCreateTime', 'TimeFilter', 'hlMatrixControlIndex', 'ZeroBasedCounter32', 'protocolDirLocalIndex') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (counter32, unsigned32, ip_address, mib_scalar, mib_table, mib_table_row, mib_table_column, bits, object_identity, mib_identifier, integer32, time_ticks, iso, notification_type, counter64, bits, module_identity, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'Unsigned32', 'IpAddress', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'ObjectIdentity', 'MibIdentifier', 'Integer32', 'TimeTicks', 'iso', 'NotificationType', 'Counter64', 'Bits', 'ModuleIdentity', 'Gauge32') (time_stamp, textual_convention, row_status, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TimeStamp', 'TextualConvention', 'RowStatus', 'DisplayString') xs_smon = mib_identifier((1, 3, 6, 1, 4, 1, 81, 30, 2)) xs_smon_resource_allocation = mib_scalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 1), octet_string().subtype(subtypeSpec=value_size_constraint(4, 4)).setFixedLength(4)).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSmonResourceAllocation.setStatus('current') xs_host_top_n = mib_identifier((1, 3, 6, 1, 4, 1, 81, 30, 2, 2)) xs_host_top_n_control_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1)) if mibBuilder.loadTexts: xsHostTopNControlTable.setStatus('current') xs_host_top_n_control_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1)).setIndexNames((0, 'SMON2-MIB', 'xsHostTopNControlIndex')) if mibBuilder.loadTexts: xsHostTopNControlEntry.setStatus('current') xs_host_top_n_control_index = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))) if mibBuilder.loadTexts: xsHostTopNControlIndex.setStatus('current') xs_host_top_n_control_host_index = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsHostTopNControlHostIndex.setStatus('current') xs_host_top_n_control_rate_base = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('xsHostTopNInPkts', 1), ('xsHostTopNOutPkts', 2), ('xsHostTopNInOctets', 3), ('xsHostTopNOutOctets', 4)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsHostTopNControlRateBase.setStatus('current') xs_host_top_n_control_time_remaining = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsHostTopNControlTimeRemaining.setStatus('current') xs_host_top_n_control_duration = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsHostTopNControlDuration.setStatus('current') xs_host_top_n_control_requested_size = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647)).clone(150)).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsHostTopNControlRequestedSize.setStatus('current') xs_host_top_n_control_granted_size = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: xsHostTopNControlGrantedSize.setStatus('current') xs_host_top_n_control_start_time = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 8), time_stamp()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsHostTopNControlStartTime.setStatus('current') xs_host_top_n_control_owner = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 9), owner_string()).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsHostTopNControlOwner.setStatus('current') xs_host_top_n_control_status = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 1, 1, 10), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsHostTopNControlStatus.setStatus('current') xs_host_top_n_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 2)) if mibBuilder.loadTexts: xsHostTopNTable.setStatus('current') xs_host_top_n_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 2, 1)).setIndexNames((0, 'SMON2-MIB', 'xsHostTopNControlIndex'), (0, 'SMON2-MIB', 'xsHostTopNIndex')) if mibBuilder.loadTexts: xsHostTopNEntry.setStatus('current') xs_host_top_n_index = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))) if mibBuilder.loadTexts: xsHostTopNIndex.setStatus('current') xs_host_top_n_protocol_dir_local_index = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: xsHostTopNProtocolDirLocalIndex.setStatus('current') xs_host_top_n_nl_address = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 2, 1, 3), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsHostTopNNlAddress.setStatus('current') xs_host_top_n_rate = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 2, 2, 1, 4), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsHostTopNRate.setStatus('current') xs_filter = mib_identifier((1, 3, 6, 1, 4, 1, 81, 30, 2, 3)) xs_host_filter_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1)) if mibBuilder.loadTexts: xsHostFilterTable.setStatus('current') xs_host_filter_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1)).setIndexNames((0, 'SMON2-MIB', 'xsHostFilterIpAddress')) if mibBuilder.loadTexts: xsHostFilterEntry.setStatus('current') xs_host_filter_type = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('ipHost', 1), ('ipSubnet', 2), ('ipxNet', 3)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: xsHostFilterType.setStatus('current') xs_host_filter_ip_address = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1, 2), octet_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: xsHostFilterIpAddress.setStatus('current') xs_host_filter_ip_subnet = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1, 3), octet_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: xsHostFilterIpSubnet.setStatus('current') xs_host_filter_ip_mask = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1, 4), octet_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: xsHostFilterIpMask.setStatus('current') xs_host_filter_ipx_address = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1, 5), octet_string()).setMaxAccess('readwrite') if mibBuilder.loadTexts: xsHostFilterIpxAddress.setStatus('current') xs_host_filter_status = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 4))).clone(namedValues=named_values(('valid', 1), ('invalid', 4)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: xsHostFilterStatus.setStatus('current') xs_host_filter_table_clear = mib_scalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 3, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('idle', 1), ('clear', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: xsHostFilterTableClear.setStatus('current') xs_subnet = mib_identifier((1, 3, 6, 1, 4, 1, 81, 30, 2, 4)) xs_subnet_control_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1)) if mibBuilder.loadTexts: xsSubnetControlTable.setStatus('current') xs_subnet_control_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1)).setIndexNames((0, 'SMON2-MIB', 'xsSubnetControlIndex')) if mibBuilder.loadTexts: xsSubnetControlEntry.setStatus('current') xs_subnet_control_index = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))) if mibBuilder.loadTexts: xsSubnetControlIndex.setStatus('current') xs_subnet_control_data_source = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 2), data_source()).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsSubnetControlDataSource.setStatus('current') xs_subnet_control_inserts = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSubnetControlInserts.setStatus('current') xs_subnet_control_deletes = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSubnetControlDeletes.setStatus('current') xs_subnet_control_max_desired_entries = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(-1, 2147483647))).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsSubnetControlMaxDesiredEntries.setStatus('current') xs_subnet_control_owner = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 6), owner_string()).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsSubnetControlOwner.setStatus('current') xs_subnet_control_status = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 1, 1, 7), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsSubnetControlStatus.setStatus('current') xs_subnet_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2)) if mibBuilder.loadTexts: xsSubnetTable.setStatus('current') xs_subnet_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1)).setIndexNames((0, 'SMON2-MIB', 'xsSubnetControlIndex'), (0, 'SMON2-MIB', 'xsSubnetTimeMark'), (0, 'RMON2-MIB', 'protocolDirLocalIndex'), (0, 'SMON2-MIB', 'xsSubnetAddress'), (0, 'SMON2-MIB', 'xsSubnetMask'), (0, 'RMON2-MIB', 'protocolDirLocalIndex')) if mibBuilder.loadTexts: xsSubnetEntry.setStatus('current') xs_subnet_time_mark = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1, 1), time_filter()) if mibBuilder.loadTexts: xsSubnetTimeMark.setStatus('current') xs_subnet_address = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1, 2), octet_string()) if mibBuilder.loadTexts: xsSubnetAddress.setStatus('current') xs_subnet_mask = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1, 3), octet_string()) if mibBuilder.loadTexts: xsSubnetMask.setStatus('current') xs_subnet_in_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1, 4), zero_based_counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSubnetInPkts.setStatus('current') xs_subnet_out_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1, 5), zero_based_counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSubnetOutPkts.setStatus('current') xs_subnet_create_time = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 2, 1, 6), last_create_time()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSubnetCreateTime.setStatus('current') xs_subnet_matrix_control_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3)) if mibBuilder.loadTexts: xsSubnetMatrixControlTable.setStatus('current') xs_subnet_matrix_control_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1)).setIndexNames((0, 'SMON2-MIB', 'xsSubnetMatrixControlIndex')) if mibBuilder.loadTexts: xsSubnetMatrixControlEntry.setStatus('current') xs_subnet_matrix_control_index = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))) if mibBuilder.loadTexts: xsSubnetMatrixControlIndex.setStatus('current') xs_subnet_matrix_control_data_source = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 2), data_source()).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsSubnetMatrixControlDataSource.setStatus('current') xs_subnet_matrix_control_inserts = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSubnetMatrixControlInserts.setStatus('current') xs_subnet_matrix_control_deletes = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSubnetMatrixControlDeletes.setStatus('current') xs_subnet_matrix_control_max_desired_entries = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(-1, 2147483647))).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsSubnetMatrixControlMaxDesiredEntries.setStatus('current') xs_subnet_matrix_control_owner = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 7), owner_string()).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsSubnetMatrixControlOwner.setStatus('current') xs_subnet_matrix_control_status = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 3, 1, 8), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: xsSubnetMatrixControlStatus.setStatus('current') xs_subnet_matrix_sd_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4)) if mibBuilder.loadTexts: xsSubnetMatrixSDTable.setStatus('current') xs_subnet_matrix_sd_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1)).setIndexNames((0, 'SMON2-MIB', 'xsSubnetMatrixControlIndex'), (0, 'SMON2-MIB', 'xsSubnetMatrixSDTimeMark'), (0, 'RMON2-MIB', 'protocolDirLocalIndex'), (0, 'SMON2-MIB', 'xsSubnetMatrixSDSourceAddress'), (0, 'SMON2-MIB', 'xsSubnetMatrixSDSourceMask'), (0, 'SMON2-MIB', 'xsSubnetMatrixSDDestAddress'), (0, 'SMON2-MIB', 'xsSubnetMatrixSDDestMask'), (0, 'RMON2-MIB', 'protocolDirLocalIndex')) if mibBuilder.loadTexts: xsSubnetMatrixSDEntry.setStatus('current') xs_subnet_matrix_sd_time_mark = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 1), time_filter()) if mibBuilder.loadTexts: xsSubnetMatrixSDTimeMark.setStatus('current') xs_subnet_matrix_sd_source_address = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 2), octet_string()) if mibBuilder.loadTexts: xsSubnetMatrixSDSourceAddress.setStatus('current') xs_subnet_matrix_sd_source_mask = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 3), octet_string()) if mibBuilder.loadTexts: xsSubnetMatrixSDSourceMask.setStatus('current') xs_subnet_matrix_sd_dest_address = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 4), octet_string()) if mibBuilder.loadTexts: xsSubnetMatrixSDDestAddress.setStatus('current') xs_subnet_matrix_sd_dest_mask = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 5), octet_string()) if mibBuilder.loadTexts: xsSubnetMatrixSDDestMask.setStatus('current') xs_subnet_matrix_sd_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 6), zero_based_counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSubnetMatrixSDPkts.setStatus('current') xs_subnet_matrix_sd_create_time = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 4, 1, 7), last_create_time()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSubnetMatrixSDCreateTime.setStatus('current') xs_subnet_matrix_ds_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5)) if mibBuilder.loadTexts: xsSubnetMatrixDSTable.setStatus('current') xs_subnet_matrix_ds_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1)).setIndexNames((0, 'RMON2-MIB', 'hlMatrixControlIndex'), (0, 'SMON2-MIB', 'xsSubnetMatrixDSTimeMark'), (0, 'RMON2-MIB', 'protocolDirLocalIndex'), (0, 'SMON2-MIB', 'xsSubnetMatrixDSDestAddress'), (0, 'SMON2-MIB', 'xsSubnetMatrixDSDestMask'), (0, 'SMON2-MIB', 'xsSubnetMatrixDSSourceAddress'), (0, 'SMON2-MIB', 'xsSubnetMatrixDSSourceMask'), (0, 'RMON2-MIB', 'protocolDirLocalIndex')) if mibBuilder.loadTexts: xsSubnetMatrixDSEntry.setStatus('current') xs_subnet_matrix_ds_time_mark = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 1), time_filter()) if mibBuilder.loadTexts: xsSubnetMatrixDSTimeMark.setStatus('current') xs_subnet_matrix_ds_source_address = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 2), octet_string()) if mibBuilder.loadTexts: xsSubnetMatrixDSSourceAddress.setStatus('current') xs_subnet_matrix_ds_source_mask = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 3), octet_string()) if mibBuilder.loadTexts: xsSubnetMatrixDSSourceMask.setStatus('current') xs_subnet_matrix_ds_dest_address = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 4), octet_string()) if mibBuilder.loadTexts: xsSubnetMatrixDSDestAddress.setStatus('current') xs_subnet_matrix_ds_dest_mask = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 5), octet_string()) if mibBuilder.loadTexts: xsSubnetMatrixDSDestMask.setStatus('current') xs_subnet_matrix_ds_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 6), zero_based_counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSubnetMatrixDSPkts.setStatus('current') xs_subnet_matrix_ds_create_time = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 4, 5, 1, 7), last_create_time()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSubnetMatrixDSCreateTime.setStatus('current') xs_number_of_protocols = mib_scalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsNumberOfProtocols.setStatus('current') xs_protocol_dist_stats_time_stamp = mib_scalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 6), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsProtocolDistStatsTimeStamp.setStatus('current') xs_nl_host_time_stamp = mib_scalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 7), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsNlHostTimeStamp.setStatus('current') xs_subnet_stats_time_stamp = mib_scalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 8), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsSubnetStatsTimeStamp.setStatus('current') xs_active_applications = mib_identifier((1, 3, 6, 1, 4, 1, 81, 30, 2, 9)) xs_active_applications_bit_mask = mib_scalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 9, 1), octet_string().subtype(subtypeSpec=value_size_constraint(128, 128)).setFixedLength(128)).setMaxAccess('readonly') if mibBuilder.loadTexts: xsActiveApplicationsBitMask.setStatus('current') xs_active_applications_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 2, 9, 2)) if mibBuilder.loadTexts: xsActiveApplicationsTable.setStatus('current') xs_active_applications_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 2, 9, 2, 1)).setIndexNames((0, 'SMON2-MIB', 'xsActiveApplicationsIndex')) if mibBuilder.loadTexts: xsActiveApplicationsEntry.setStatus('current') xs_active_applications_index = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 9, 2, 1, 1), integer32()) if mibBuilder.loadTexts: xsActiveApplicationsIndex.setStatus('current') xs_active_applications_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 2, 9, 2, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: xsActiveApplicationsPkts.setStatus('current') xs_smon_status = mib_scalar((1, 3, 6, 1, 4, 1, 81, 30, 2, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('operate', 1), ('paused', 2))).clone('paused')).setMaxAccess('readwrite') if mibBuilder.loadTexts: xsSmonStatus.setStatus('current') dr_smon = mib_identifier((1, 3, 6, 1, 4, 1, 81, 30, 4)) dr_smon_configuration = mib_identifier((1, 3, 6, 1, 4, 1, 81, 30, 4, 1)) dr_smon_control_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1)) if mibBuilder.loadTexts: drSmonControlTable.setStatus('current') dr_smon_control_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1)).setIndexNames((0, 'SMON2-MIB', 'drSmonControlModuleID')) if mibBuilder.loadTexts: drSmonControlEntry.setStatus('current') dr_smon_control_module_id = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))) if mibBuilder.loadTexts: drSmonControlModuleID.setStatus('current') dr_smon_control_row_address_auto_learn_mode = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 255))).clone(namedValues=named_values(('enable', 1), ('disable', 2), ('notSupported', 255)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: drSmonControlRowAddressAutoLearnMode.setStatus('current') dr_smon_control_routed_packets = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: drSmonControlRoutedPackets.setStatus('current') dr_smon_control_protocol_dist_stats_time_stamp = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1, 4), time_ticks()).setMaxAccess('readonly') if mibBuilder.loadTexts: drSmonControlProtocolDistStatsTimeStamp.setStatus('current') dr_smon_control_matrix_rows = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: drSmonControlMatrixRows.setStatus('current') dr_smon_control_matrix_cols = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 1, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: drSmonControlMatrixCols.setStatus('current') dr_smon_entity_placement_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2)) if mibBuilder.loadTexts: drSmonEntityPlacementTable.setStatus('current') dr_smon_entity_placement_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2, 1)).setIndexNames((0, 'SMON2-MIB', 'drSmonEntityPlacementModuleID'), (0, 'SMON2-MIB', 'drSmonEntityPlacementIndex')) if mibBuilder.loadTexts: drSmonEntityPlacementEntry.setStatus('current') dr_smon_entity_placement_module_id = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))) if mibBuilder.loadTexts: drSmonEntityPlacementModuleID.setStatus('current') dr_smon_entity_placement_index = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: drSmonEntityPlacementIndex.setStatus('current') dr_smon_entity_placement_address = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2, 1, 3), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: drSmonEntityPlacementAddress.setStatus('current') dr_smon_entity_placement_mask = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2, 1, 4), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: drSmonEntityPlacementMask.setStatus('current') dr_smon_entity_placement_type = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 1, 2, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('empty', 1), ('autoLearn', 2), ('filter', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: drSmonEntityPlacementType.setStatus('current') dr_smon_protocol_dir = mib_identifier((1, 3, 6, 1, 4, 1, 81, 30, 4, 2)) dr_smon_protocol_dir_lc_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 1)) if mibBuilder.loadTexts: drSmonProtocolDirLCTable.setStatus('current') dr_smon_protocol_dir_lc_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 1, 1)).setIndexNames((0, 'SMON2-MIB', 'drSmonProtocolDirLCModuleID')) if mibBuilder.loadTexts: drSmonProtocolDirLCEntry.setStatus('current') dr_smon_protocol_dir_lc_module_id = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))) if mibBuilder.loadTexts: drSmonProtocolDirLCModuleID.setStatus('current') dr_smon_protocol_dir_lc_last_change = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 1, 1, 2), time_stamp()).setMaxAccess('readonly') if mibBuilder.loadTexts: drSmonProtocolDirLCLastChange.setStatus('current') dr_smon_protocol_dir_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2)) if mibBuilder.loadTexts: drSmonProtocolDirTable.setStatus('current') dr_smon_protocol_dir_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1)).setIndexNames((0, 'SMON2-MIB', 'drSmonProtocolDirModuleID'), (0, 'SMON2-MIB', 'drSmonProtocolDirID'), (0, 'SMON2-MIB', 'drSmonProtocolDirParameters')) if mibBuilder.loadTexts: drSmonProtocolDirEntry.setStatus('current') dr_smon_protocol_dir_module_id = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))) if mibBuilder.loadTexts: drSmonProtocolDirModuleID.setStatus('current') dr_smon_protocol_dir_id = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 2), octet_string()) if mibBuilder.loadTexts: drSmonProtocolDirID.setStatus('current') dr_smon_protocol_dir_parameters = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 3), octet_string()) if mibBuilder.loadTexts: drSmonProtocolDirParameters.setStatus('current') dr_smon_protocol_dir_local_index = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly') if mibBuilder.loadTexts: drSmonProtocolDirLocalIndex.setStatus('current') dr_smon_protocol_dir_descr = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 5), display_string().subtype(subtypeSpec=value_size_constraint(1, 64))).setMaxAccess('readcreate') if mibBuilder.loadTexts: drSmonProtocolDirDescr.setStatus('current') dr_smon_protocol_dir_type = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 6), bits().clone(namedValues=named_values(('extensible', 0), ('addressRecognitionCapable', 1)))).setMaxAccess('readonly') if mibBuilder.loadTexts: drSmonProtocolDirType.setStatus('current') dr_smon_protocol_dir_address_map_config = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('notSupported', 1), ('supportedOff', 2), ('supportedOn', 3)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: drSmonProtocolDirAddressMapConfig.setStatus('current') dr_smon_protocol_dir_host_config = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('notSupported', 1), ('supportedOff', 2), ('supportedOn', 3)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: drSmonProtocolDirHostConfig.setStatus('current') dr_smon_protocol_dir_matrix_config = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('notSupported', 1), ('supportedOff', 2), ('supportedOn', 3)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: drSmonProtocolDirMatrixConfig.setStatus('current') dr_smon_protocol_dir_owner = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 10), owner_string()).setMaxAccess('readcreate') if mibBuilder.loadTexts: drSmonProtocolDirOwner.setStatus('current') dr_smon_protocol_dir_status = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 2, 2, 1, 11), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: drSmonProtocolDirStatus.setStatus('current') dr_smon_filter = mib_identifier((1, 3, 6, 1, 4, 1, 81, 30, 4, 3)) dr_smon_filter_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1)) if mibBuilder.loadTexts: drSmonFilterTable.setStatus('current') dr_smon_filter_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1, 1)).setIndexNames((0, 'SMON2-MIB', 'drSmonFilterModuleID'), (0, 'SMON2-MIB', 'drSmonFilterIndex')) if mibBuilder.loadTexts: drSmonFilterEntry.setStatus('current') dr_smon_filter_module_id = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))) if mibBuilder.loadTexts: drSmonFilterModuleID.setStatus('current') dr_smon_filter_index = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: drSmonFilterIndex.setStatus('current') dr_smon_filter_address = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1, 1, 3), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: drSmonFilterAddress.setStatus('current') dr_smon_filter_mask = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1, 1, 4), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: drSmonFilterMask.setStatus('current') dr_smon_filter_status = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 3, 1, 1, 5), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: drSmonFilterStatus.setStatus('current') dr_smon_active_applications = mib_identifier((1, 3, 6, 1, 4, 1, 81, 30, 4, 4)) dr_smon_active_applications_table = mib_table((1, 3, 6, 1, 4, 1, 81, 30, 4, 4, 1)) if mibBuilder.loadTexts: drSmonActiveApplicationsTable.setStatus('current') dr_smon_active_applications_entry = mib_table_row((1, 3, 6, 1, 4, 1, 81, 30, 4, 4, 1, 1)).setIndexNames((0, 'SMON2-MIB', 'drSmonActiveApplicationsModuleID'), (0, 'SMON2-MIB', 'drSmonActiveApplicationsType'), (0, 'SMON2-MIB', 'drSmonActiveApplicationsSubType')) if mibBuilder.loadTexts: drSmonActiveApplicationsEntry.setStatus('current') dr_smon_active_applications_module_id = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 4, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))) if mibBuilder.loadTexts: drSmonActiveApplicationsModuleID.setStatus('current') dr_smon_active_applications_type = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 4, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('ethertype', 1), ('ipProtocol', 2), ('udpProtocol', 3), ('tcpProtocol', 4)))) if mibBuilder.loadTexts: drSmonActiveApplicationsType.setStatus('current') dr_smon_active_applications_sub_type = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 4, 1, 1, 3), integer32()) if mibBuilder.loadTexts: drSmonActiveApplicationsSubType.setStatus('current') dr_smon_active_applications_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 81, 30, 4, 4, 1, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: drSmonActiveApplicationsPkts.setStatus('current') mibBuilder.exportSymbols('SMON2-MIB', xsSubnetMatrixDSSourceAddress=xsSubnetMatrixDSSourceAddress, xsActiveApplications=xsActiveApplications, drSmonProtocolDir=drSmonProtocolDir, drSmonControlRoutedPackets=drSmonControlRoutedPackets, xsFilter=xsFilter, xsHostTopNControlStatus=xsHostTopNControlStatus, xsSmon=xsSmon, drSmonProtocolDirHostConfig=drSmonProtocolDirHostConfig, drSmonFilter=drSmonFilter, xsSubnetMatrixControlMaxDesiredEntries=xsSubnetMatrixControlMaxDesiredEntries, xsSubnetMatrixDSSourceMask=xsSubnetMatrixDSSourceMask, xsSubnetControlEntry=xsSubnetControlEntry, xsSubnetEntry=xsSubnetEntry, xsSubnetMatrixSDTable=xsSubnetMatrixSDTable, drSmonConfiguration=drSmonConfiguration, drSmonControlMatrixRows=drSmonControlMatrixRows, drSmonProtocolDirStatus=drSmonProtocolDirStatus, xsHostFilterEntry=xsHostFilterEntry, drSmonControlModuleID=drSmonControlModuleID, drSmonEntityPlacementEntry=drSmonEntityPlacementEntry, xsSubnetControlTable=xsSubnetControlTable, drSmonProtocolDirAddressMapConfig=drSmonProtocolDirAddressMapConfig, drSmonActiveApplications=drSmonActiveApplications, drSmonEntityPlacementAddress=drSmonEntityPlacementAddress, xsSubnetControlMaxDesiredEntries=xsSubnetControlMaxDesiredEntries, xsSubnetAddress=xsSubnetAddress, xsSubnetMask=xsSubnetMask, drSmonProtocolDirID=drSmonProtocolDirID, drSmonProtocolDirModuleID=drSmonProtocolDirModuleID, drSmonControlEntry=drSmonControlEntry, drSmonActiveApplicationsSubType=drSmonActiveApplicationsSubType, drSmonEntityPlacementIndex=drSmonEntityPlacementIndex, drSmonProtocolDirMatrixConfig=drSmonProtocolDirMatrixConfig, xsHostTopNControlEntry=xsHostTopNControlEntry, drSmonActiveApplicationsEntry=drSmonActiveApplicationsEntry, drSmonProtocolDirParameters=drSmonProtocolDirParameters, xsSubnetControlOwner=xsSubnetControlOwner, xsSubnetMatrixSDPkts=xsSubnetMatrixSDPkts, drSmonProtocolDirLCLastChange=drSmonProtocolDirLCLastChange, drSmonEntityPlacementTable=drSmonEntityPlacementTable, drSmonControlProtocolDistStatsTimeStamp=drSmonControlProtocolDistStatsTimeStamp, drSmonEntityPlacementModuleID=drSmonEntityPlacementModuleID, xsHostTopNControlTimeRemaining=xsHostTopNControlTimeRemaining, drSmonFilterTable=drSmonFilterTable, drSmonEntityPlacementType=drSmonEntityPlacementType, xsSubnetMatrixControlInserts=xsSubnetMatrixControlInserts, xsHostFilterIpSubnet=xsHostFilterIpSubnet, xsHostTopNControlHostIndex=xsHostTopNControlHostIndex, xsSubnetControlInserts=xsSubnetControlInserts, xsSubnetMatrixSDTimeMark=xsSubnetMatrixSDTimeMark, xsHostFilterTableClear=xsHostFilterTableClear, xsSubnetInPkts=xsSubnetInPkts, xsHostFilterType=xsHostFilterType, drSmon=drSmon, xsHostTopNControlGrantedSize=xsHostTopNControlGrantedSize, xsHostTopNControlRequestedSize=xsHostTopNControlRequestedSize, xsActiveApplicationsEntry=xsActiveApplicationsEntry, drSmonActiveApplicationsTable=drSmonActiveApplicationsTable, drSmonFilterAddress=drSmonFilterAddress, xsHostTopNProtocolDirLocalIndex=xsHostTopNProtocolDirLocalIndex, xsProtocolDistStatsTimeStamp=xsProtocolDistStatsTimeStamp, drSmonFilterModuleID=drSmonFilterModuleID, drSmonControlMatrixCols=drSmonControlMatrixCols, xsSubnetMatrixDSTable=xsSubnetMatrixDSTable, xsHostTopNControlIndex=xsHostTopNControlIndex, xsSubnet=xsSubnet, xsHostTopNControlOwner=xsHostTopNControlOwner, xsSubnetMatrixDSCreateTime=xsSubnetMatrixDSCreateTime, xsHostTopNIndex=xsHostTopNIndex, xsSubnetTimeMark=xsSubnetTimeMark, xsSubnetMatrixDSPkts=xsSubnetMatrixDSPkts, drSmonProtocolDirLCModuleID=drSmonProtocolDirLCModuleID, xsSubnetMatrixSDSourceMask=xsSubnetMatrixSDSourceMask, drSmonProtocolDirLCEntry=drSmonProtocolDirLCEntry, xsHostTopNControlDuration=xsHostTopNControlDuration, drSmonControlRowAddressAutoLearnMode=drSmonControlRowAddressAutoLearnMode, xsSubnetMatrixSDDestAddress=xsSubnetMatrixSDDestAddress, xsSubnetMatrixSDDestMask=xsSubnetMatrixSDDestMask, xsHostTopNNlAddress=xsHostTopNNlAddress, xsSubnetMatrixDSTimeMark=xsSubnetMatrixDSTimeMark, drSmonActiveApplicationsPkts=drSmonActiveApplicationsPkts, drSmonProtocolDirDescr=drSmonProtocolDirDescr, xsHostFilterIpMask=xsHostFilterIpMask, drSmonProtocolDirLocalIndex=drSmonProtocolDirLocalIndex, xsHostFilterStatus=xsHostFilterStatus, xsSubnetMatrixControlEntry=xsSubnetMatrixControlEntry, drSmonEntityPlacementMask=drSmonEntityPlacementMask, xsHostFilterIpxAddress=xsHostFilterIpxAddress, drSmonActiveApplicationsType=drSmonActiveApplicationsType, xsNlHostTimeStamp=xsNlHostTimeStamp, xsSubnetMatrixControlStatus=xsSubnetMatrixControlStatus, xsSubnetMatrixControlDataSource=xsSubnetMatrixControlDataSource, xsHostTopNControlStartTime=xsHostTopNControlStartTime, xsSubnetMatrixControlIndex=xsSubnetMatrixControlIndex, xsSubnetMatrixDSDestMask=xsSubnetMatrixDSDestMask, xsNumberOfProtocols=xsNumberOfProtocols, xsActiveApplicationsBitMask=xsActiveApplicationsBitMask, xsActiveApplicationsIndex=xsActiveApplicationsIndex, xsHostTopNEntry=xsHostTopNEntry, drSmonProtocolDirTable=drSmonProtocolDirTable, xsSubnetControlStatus=xsSubnetControlStatus, xsSubnetMatrixControlOwner=xsSubnetMatrixControlOwner, xsSubnetMatrixControlTable=xsSubnetMatrixControlTable, xsSmonStatus=xsSmonStatus, xsSubnetControlIndex=xsSubnetControlIndex, drSmonFilterEntry=drSmonFilterEntry, drSmonProtocolDirEntry=drSmonProtocolDirEntry, drSmonFilterStatus=drSmonFilterStatus, xsHostTopN=xsHostTopN, xsSubnetControlDataSource=xsSubnetControlDataSource, xsSmonResourceAllocation=xsSmonResourceAllocation, drSmonProtocolDirLCTable=drSmonProtocolDirLCTable, drSmonFilterIndex=drSmonFilterIndex, xsSubnetMatrixSDSourceAddress=xsSubnetMatrixSDSourceAddress, xsSubnetMatrixSDCreateTime=xsSubnetMatrixSDCreateTime, xsHostTopNRate=xsHostTopNRate, xsHostFilterIpAddress=xsHostFilterIpAddress, xsSubnetOutPkts=xsSubnetOutPkts, xsSubnetMatrixControlDeletes=xsSubnetMatrixControlDeletes, drSmonProtocolDirOwner=drSmonProtocolDirOwner, xsSubnetMatrixDSDestAddress=xsSubnetMatrixDSDestAddress, xsSubnetControlDeletes=xsSubnetControlDeletes, xsSubnetCreateTime=xsSubnetCreateTime, xsActiveApplicationsTable=xsActiveApplicationsTable, drSmonControlTable=drSmonControlTable, xsHostTopNTable=xsHostTopNTable, drSmonProtocolDirType=drSmonProtocolDirType, drSmonActiveApplicationsModuleID=drSmonActiveApplicationsModuleID, xsSubnetTable=xsSubnetTable, drSmonFilterMask=drSmonFilterMask, xsActiveApplicationsPkts=xsActiveApplicationsPkts, xsSubnetStatsTimeStamp=xsSubnetStatsTimeStamp, xsSubnetMatrixDSEntry=xsSubnetMatrixDSEntry, xsHostTopNControlRateBase=xsHostTopNControlRateBase, xsSubnetMatrixSDEntry=xsSubnetMatrixSDEntry, xsHostFilterTable=xsHostFilterTable, xsHostTopNControlTable=xsHostTopNControlTable)
delta_vector = [(1, 0), (0, -1), (-1, 0), (0, 1)] current_east_pos = 0 current_north_pos = 0 current_delta = 0 for _ in range(747): instruction = input() movement = instruction[0] value = int(instruction[1:]) if movement == 'N': current_north_pos += value if movement == 'S': current_north_pos -= value if movement == 'E': current_east_pos += value if movement == 'W': current_east_pos -= value if movement == 'L': current_delta = (current_delta - (value // 90)) % 4 if movement == 'R': current_delta = (current_delta + (value // 90)) % 4 if movement == 'F': current_east_pos += delta_vector[current_delta][0] * value current_north_pos += delta_vector[current_delta][1] * value manhattan_distance = abs(current_east_pos) + abs(current_north_pos) print(manhattan_distance)
delta_vector = [(1, 0), (0, -1), (-1, 0), (0, 1)] current_east_pos = 0 current_north_pos = 0 current_delta = 0 for _ in range(747): instruction = input() movement = instruction[0] value = int(instruction[1:]) if movement == 'N': current_north_pos += value if movement == 'S': current_north_pos -= value if movement == 'E': current_east_pos += value if movement == 'W': current_east_pos -= value if movement == 'L': current_delta = (current_delta - value // 90) % 4 if movement == 'R': current_delta = (current_delta + value // 90) % 4 if movement == 'F': current_east_pos += delta_vector[current_delta][0] * value current_north_pos += delta_vector[current_delta][1] * value manhattan_distance = abs(current_east_pos) + abs(current_north_pos) print(manhattan_distance)
""" Creating some co-ordinates with nested loops. Output will be something like (0,1) (0,2) (0,3) (1,0) (1,1) and so on. """ #Initiationg the loop for x in range(3): for y in range(3): print(f"({x}, {y})")
""" Creating some co-ordinates with nested loops. Output will be something like (0,1) (0,2) (0,3) (1,0) (1,1) and so on. """ for x in range(3): for y in range(3): print(f'({x}, {y})')
# input n = int(input()) cont1 = int(input()) conttot = 1 # grafo contador = 0 g = [[0 for i in range(n)] for j in range(n)] lista = input().split() for col in range(n): for linha in range(n): g[col][linha] = int(lista[contador]) contador += 1 if col == linha: g[col][linha] = 0 # Lista De Contaminados contaminados = [] contaminados.append(cont1) # Descobrindo Contaminados for linha in range(n): if g[cont1][linha] == 1: contaminados.append(linha) g[cont1][linha] = 0 conttot += 1 while True: for y in range(n): if g[linha][y] == 1 and y != cont1 and linha not in contaminados: contaminados.append(linha) conttot += 1 print(conttot)
n = int(input()) cont1 = int(input()) conttot = 1 contador = 0 g = [[0 for i in range(n)] for j in range(n)] lista = input().split() for col in range(n): for linha in range(n): g[col][linha] = int(lista[contador]) contador += 1 if col == linha: g[col][linha] = 0 contaminados = [] contaminados.append(cont1) for linha in range(n): if g[cont1][linha] == 1: contaminados.append(linha) g[cont1][linha] = 0 conttot += 1 while True: for y in range(n): if g[linha][y] == 1 and y != cont1 and (linha not in contaminados): contaminados.append(linha) conttot += 1 print(conttot)
class gbXMLConditionType(Enum,IComparable,IFormattable,IConvertible): """ This enumeration corresponds to the conditionType attribute in gbXML. The enumerated attribute identifies the type of heating,cooling, or ventilation the space has. enum gbXMLConditionType,values: Cooled (1),Heated (0),HeatedAndCooled (2),NaturallyVentedOnly (5),NoConditionType (-1),NoOfConditionTypes (6),Unconditioned (3),Vented (4) """ def __eq__(self,*args): """ x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """ pass def __format__(self,*args): """ __format__(formattable: IFormattable,format: str) -> str """ pass def __ge__(self,*args): pass def __gt__(self,*args): pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __le__(self,*args): pass def __lt__(self,*args): pass def __ne__(self,*args): pass def __reduce_ex__(self,*args): pass def __str__(self,*args): pass Cooled=None Heated=None HeatedAndCooled=None NaturallyVentedOnly=None NoConditionType=None NoOfConditionTypes=None Unconditioned=None value__=None Vented=None
class Gbxmlconditiontype(Enum, IComparable, IFormattable, IConvertible): """ This enumeration corresponds to the conditionType attribute in gbXML. The enumerated attribute identifies the type of heating,cooling, or ventilation the space has. enum gbXMLConditionType,values: Cooled (1),Heated (0),HeatedAndCooled (2),NaturallyVentedOnly (5),NoConditionType (-1),NoOfConditionTypes (6),Unconditioned (3),Vented (4) """ def __eq__(self, *args): """ x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """ pass def __format__(self, *args): """ __format__(formattable: IFormattable,format: str) -> str """ pass def __ge__(self, *args): pass def __gt__(self, *args): pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __le__(self, *args): pass def __lt__(self, *args): pass def __ne__(self, *args): pass def __reduce_ex__(self, *args): pass def __str__(self, *args): pass cooled = None heated = None heated_and_cooled = None naturally_vented_only = None no_condition_type = None no_of_condition_types = None unconditioned = None value__ = None vented = None
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def maxDepth(self, root): """ :type root: TreeNode :rtype: int """ if root is None: return 0 current_level, depth = [root], 0 while current_level: next_level = [] while current_level: top = current_level.pop() if top.left: next_level.append(top.left) if top.right: next_level.append(top.right) current_level = next_level depth += 1 return depth
class Solution: def max_depth(self, root): """ :type root: TreeNode :rtype: int """ if root is None: return 0 (current_level, depth) = ([root], 0) while current_level: next_level = [] while current_level: top = current_level.pop() if top.left: next_level.append(top.left) if top.right: next_level.append(top.right) current_level = next_level depth += 1 return depth
with open("Actions.txt") as f: print(f) lines = f.readlines() trim_list = list(map(lambda line: line.strip(), lines)) sig = "-- HERE --" sig_indx = trim_list.index(sig) pure_inst = trim_list[sig_indx:] print(pure_inst) res = [] for p in pure_inst: split = p.split(" ", 1) if split[0].isdigit(): res.append(split[1]) print(res)
with open('Actions.txt') as f: print(f) lines = f.readlines() trim_list = list(map(lambda line: line.strip(), lines)) sig = '-- HERE --' sig_indx = trim_list.index(sig) pure_inst = trim_list[sig_indx:] print(pure_inst) res = [] for p in pure_inst: split = p.split(' ', 1) if split[0].isdigit(): res.append(split[1]) print(res)
c = int() def hanoi(discs, main, target, aux): global c if discs >= 1: c = c + 1 hanoi(discs - 1, main, aux, target) print("[{}] -> Move disc {} from {} to {}".format(c, discs, main, target)) hanoi(discs - 1, aux, target, main) if __name__ == "__main__": discs = int(input()) hanoi(discs, "main", "target", "aux")
c = int() def hanoi(discs, main, target, aux): global c if discs >= 1: c = c + 1 hanoi(discs - 1, main, aux, target) print('[{}] -> Move disc {} from {} to {}'.format(c, discs, main, target)) hanoi(discs - 1, aux, target, main) if __name__ == '__main__': discs = int(input()) hanoi(discs, 'main', 'target', 'aux')
def f(): def g(): pass if __name__ == '__main__': g() print(1) f()
def f(): def g(): pass if __name__ == '__main__': g() print(1) f()
lst = [int(x) for x in input().split()] k = int(input()) lst.sort() print(lst[-k], end="")
lst = [int(x) for x in input().split()] k = int(input()) lst.sort() print(lst[-k], end='')
n,k=map(int,input().split());a=[int(i) for i in input().split()];m=sum(a[:k]);s=m for i in range(k,n): s+=(a[i]-a[i-k]) if s>m:m=s print(m)
(n, k) = map(int, input().split()) a = [int(i) for i in input().split()] m = sum(a[:k]) s = m for i in range(k, n): s += a[i] - a[i - k] if s > m: m = s print(m)
with open("day-02/input.txt", "r") as file: puzzle_input = [i.split() for i in file.readlines()] def part_1(puzzle_input): depth = 0 horizontal = 0 for command, value in puzzle_input: value = int(value) if command == "forward": horizontal += value elif command == "up": depth -= value elif command == "down": depth += value return depth * horizontal def part_2(puzzle_input): aim = 0 depth = 0 horizontal = 0 for command, value in puzzle_input: value = int(value) if command == "forward": horizontal += value depth += aim * value elif command == "up": aim -= value elif command == "down": aim += value return depth * horizontal print(part_1(puzzle_input)) print(part_2(puzzle_input))
with open('day-02/input.txt', 'r') as file: puzzle_input = [i.split() for i in file.readlines()] def part_1(puzzle_input): depth = 0 horizontal = 0 for (command, value) in puzzle_input: value = int(value) if command == 'forward': horizontal += value elif command == 'up': depth -= value elif command == 'down': depth += value return depth * horizontal def part_2(puzzle_input): aim = 0 depth = 0 horizontal = 0 for (command, value) in puzzle_input: value = int(value) if command == 'forward': horizontal += value depth += aim * value elif command == 'up': aim -= value elif command == 'down': aim += value return depth * horizontal print(part_1(puzzle_input)) print(part_2(puzzle_input))
obj = { 'Profiles' : [ { 'Source' : 'sfmc_sg10004_programmes_genrelevel1fan548day_oc_uas_dae', 'Media': ['audio','video'], 'Preferences' : [ { 'Score' : 1, 'Label' : 'Religion & Ethics' }, { 'Score' : 4, 'Label' : 'Entertainment' }, { 'Score' : 5, 'Label' : 'Music' }, { 'Score' : 5, 'Label' : 'Comedy' }, { 'Score' : 5, 'Label' : 'News' }, { 'Score' : 4, 'Label' : 'Drama' }, { 'Score' : 1, 'Label' : 'Learning' }, { 'Score' : 5, 'Label' : 'Factual' }, { 'Score' : 5, 'Label' : 'Sport' } ] }, { 'Source' : 'sfmc_sg10004a_programmes_genrelevel1fan548day_oc_uas_dae', 'Media': ['audio'], 'Preferences' : [ { 'Score' : 4, 'Label' : 'News' }, { 'Score' : 2, 'Label' : 'Sport' }, { 'Score' : 1, 'Label' : 'Religion & Ethics' }, { 'Score' : 1, 'Label' : 'Learning' }, { 'Score' : 5, 'Label' : 'Music' }, { 'Score' : 5, 'Label' : 'Comedy' }, { 'Score' : 1, 'Label' : 'Entertainment' }, { 'Score' : 5, 'Label' : 'Factual' }, { 'Score' : 2, 'Label' : 'Drama' } ] }, { 'Source' : 'sfmc_sg10004v_programmes_genrelevel1fan548day_oc_uas_dae', 'Media': ['video'], 'Preferences' : [ { 'Score' : 2, 'Label' : 'Entertainment' }, { 'Score' : 5, 'Label' : 'Music' }, { 'Score' : 1, 'Label' : 'Comedy' }, { 'Score' : 4, 'Label' : 'Drama' }, { 'Score' : 2, 'Label' : 'News' }, { 'Score' : 5, 'Label' : 'Factual' }, { 'Score' : 5, 'Label' : 'Sport' } ] }, { 'Source' : 'sfmc_sg10005_programmes_genrelevel2fan548day_oc_uas_dae', 'Media': ['audio','video'], 'Preferences' : [ { 'Score' : 2, 'Label' : 'Comedy-Sitcoms' }, { 'Score' : 2, 'Label' : 'Comedy-Music' }, { 'Score' : 5, 'Label' : 'Factual-null' }, { 'Score' : 5, 'Label' : 'Factual-Politics' }, { 'Score' : 1, 'Label' : 'Music-Dance & Electronica' }, { 'Score' : 1, 'Label' : 'Entertainment-null' }, { 'Score' : 5, 'Label' : 'Music-Easy Listening, Soundtracks & Musicals' }, { 'Score' : 1, 'Label' : 'Music-Folk' }, { 'Score' : 5, 'Label' : 'Factual-Arts, Culture & the Media' }, { 'Score' : 1, 'Label' : 'Religion & Ethics-null' }, { 'Score' : 5, 'Label' : 'Music-Pop & Chart' }, { 'Score' : 2, 'Label' : 'Sport-Cricket' }, { 'Score' : 5, 'Label' : 'Music-Classical' }, { 'Score' : 4, 'Label' : 'News-null' }, { 'Score' : 5, 'Label' : 'Music-null' }, { 'Score' : 2, 'Label' : 'Comedy-Standup' }, { 'Score' : 5, 'Label' : 'Factual-Life Stories' }, { 'Score' : 4, 'Label' : 'Music-Rock & Indie' }, { 'Score' : 1, 'Label' : 'Comedy-Satire' }, { 'Score' : 1, 'Label' : 'Factual-Science & Nature' }, { 'Score' : 1, 'Label' : 'Music-Hip Hop, RnB & Dancehall' }, { 'Score' : 5, 'Label' : 'Music-Classic Pop & Rock' }, { 'Score' : 1, 'Label' : 'Drama-Biographical' }, { 'Score' : 2, 'Label' : 'Factual-History' }, { 'Score' : 1, 'Label' : 'Factual-Rock & Indie' }, { 'Score' : 1, 'Label' : 'Drama-null' }, { 'Score' : 4, 'Label' : 'Comedy-null' }, { 'Score' : 2, 'Label' : 'Drama-Soaps' }, { 'Score' : 1, 'Label' : 'Drama-SciFi & Fantasy' }, { 'Score' : 1, 'Label' : 'Factual-Health & Wellbeing' }, { 'Score' : 2, 'Label' : 'Comedy-Impressionists' }, { 'Score' : 1, 'Label' : 'Comedy-Character' }, { 'Score' : 1, 'Label' : 'Factual-Travel' }, { 'Score' : 1, 'Label' : 'Learning-Adults' } ] }, { 'Source' : 'sfmc_sg10006_products_productfanpageviews548day_oc_cs_dae', 'Media': [], 'Preferences' : [ { 'Score' : 5, 'Label' : 'iplayerradio' }, { 'Score' : 5, 'Label' : 'ideas' }, { 'Score' : 5, 'Label' : 'aboutthebbc' }, { 'Score' : 1, 'Label' : 'newsbeat' }, { 'Score' : 4, 'Label' : 'kl-bitesize' }, { 'Score' : 3, 'Label' : 'cbeebies' }, { 'Score' : 5, 'Label' : 'news-v2-nonws' }, { 'Score' : 5, 'Label' : 'weather' }, { 'Score' : 5, 'Label' : 'homepageandsearch' }, { 'Score' : 3, 'Label' : 'news-v2-ws' }, { 'Score' : 5, 'Label' : 'tvandiplayer' }, { 'Score' : 5, 'Label' : 'sport' }, { 'Score' : 3, 'Label' : 'bbcthree' }, { 'Score' : 5, 'Label' : 'music' }, { 'Score' : 5, 'Label' : 'kl-iwonder' }, { 'Score' : 5, 'Label' : 'news' }, { 'Score' : 4, 'Label' : 'cbbc' } ] } ] }
obj = {'Profiles': [{'Source': 'sfmc_sg10004_programmes_genrelevel1fan548day_oc_uas_dae', 'Media': ['audio', 'video'], 'Preferences': [{'Score': 1, 'Label': 'Religion & Ethics'}, {'Score': 4, 'Label': 'Entertainment'}, {'Score': 5, 'Label': 'Music'}, {'Score': 5, 'Label': 'Comedy'}, {'Score': 5, 'Label': 'News'}, {'Score': 4, 'Label': 'Drama'}, {'Score': 1, 'Label': 'Learning'}, {'Score': 5, 'Label': 'Factual'}, {'Score': 5, 'Label': 'Sport'}]}, {'Source': 'sfmc_sg10004a_programmes_genrelevel1fan548day_oc_uas_dae', 'Media': ['audio'], 'Preferences': [{'Score': 4, 'Label': 'News'}, {'Score': 2, 'Label': 'Sport'}, {'Score': 1, 'Label': 'Religion & Ethics'}, {'Score': 1, 'Label': 'Learning'}, {'Score': 5, 'Label': 'Music'}, {'Score': 5, 'Label': 'Comedy'}, {'Score': 1, 'Label': 'Entertainment'}, {'Score': 5, 'Label': 'Factual'}, {'Score': 2, 'Label': 'Drama'}]}, {'Source': 'sfmc_sg10004v_programmes_genrelevel1fan548day_oc_uas_dae', 'Media': ['video'], 'Preferences': [{'Score': 2, 'Label': 'Entertainment'}, {'Score': 5, 'Label': 'Music'}, {'Score': 1, 'Label': 'Comedy'}, {'Score': 4, 'Label': 'Drama'}, {'Score': 2, 'Label': 'News'}, {'Score': 5, 'Label': 'Factual'}, {'Score': 5, 'Label': 'Sport'}]}, {'Source': 'sfmc_sg10005_programmes_genrelevel2fan548day_oc_uas_dae', 'Media': ['audio', 'video'], 'Preferences': [{'Score': 2, 'Label': 'Comedy-Sitcoms'}, {'Score': 2, 'Label': 'Comedy-Music'}, {'Score': 5, 'Label': 'Factual-null'}, {'Score': 5, 'Label': 'Factual-Politics'}, {'Score': 1, 'Label': 'Music-Dance & Electronica'}, {'Score': 1, 'Label': 'Entertainment-null'}, {'Score': 5, 'Label': 'Music-Easy Listening, Soundtracks & Musicals'}, {'Score': 1, 'Label': 'Music-Folk'}, {'Score': 5, 'Label': 'Factual-Arts, Culture & the Media'}, {'Score': 1, 'Label': 'Religion & Ethics-null'}, {'Score': 5, 'Label': 'Music-Pop & Chart'}, {'Score': 2, 'Label': 'Sport-Cricket'}, {'Score': 5, 'Label': 'Music-Classical'}, {'Score': 4, 'Label': 'News-null'}, {'Score': 5, 'Label': 'Music-null'}, {'Score': 2, 'Label': 'Comedy-Standup'}, {'Score': 5, 'Label': 'Factual-Life Stories'}, {'Score': 4, 'Label': 'Music-Rock & Indie'}, {'Score': 1, 'Label': 'Comedy-Satire'}, {'Score': 1, 'Label': 'Factual-Science & Nature'}, {'Score': 1, 'Label': 'Music-Hip Hop, RnB & Dancehall'}, {'Score': 5, 'Label': 'Music-Classic Pop & Rock'}, {'Score': 1, 'Label': 'Drama-Biographical'}, {'Score': 2, 'Label': 'Factual-History'}, {'Score': 1, 'Label': 'Factual-Rock & Indie'}, {'Score': 1, 'Label': 'Drama-null'}, {'Score': 4, 'Label': 'Comedy-null'}, {'Score': 2, 'Label': 'Drama-Soaps'}, {'Score': 1, 'Label': 'Drama-SciFi & Fantasy'}, {'Score': 1, 'Label': 'Factual-Health & Wellbeing'}, {'Score': 2, 'Label': 'Comedy-Impressionists'}, {'Score': 1, 'Label': 'Comedy-Character'}, {'Score': 1, 'Label': 'Factual-Travel'}, {'Score': 1, 'Label': 'Learning-Adults'}]}, {'Source': 'sfmc_sg10006_products_productfanpageviews548day_oc_cs_dae', 'Media': [], 'Preferences': [{'Score': 5, 'Label': 'iplayerradio'}, {'Score': 5, 'Label': 'ideas'}, {'Score': 5, 'Label': 'aboutthebbc'}, {'Score': 1, 'Label': 'newsbeat'}, {'Score': 4, 'Label': 'kl-bitesize'}, {'Score': 3, 'Label': 'cbeebies'}, {'Score': 5, 'Label': 'news-v2-nonws'}, {'Score': 5, 'Label': 'weather'}, {'Score': 5, 'Label': 'homepageandsearch'}, {'Score': 3, 'Label': 'news-v2-ws'}, {'Score': 5, 'Label': 'tvandiplayer'}, {'Score': 5, 'Label': 'sport'}, {'Score': 3, 'Label': 'bbcthree'}, {'Score': 5, 'Label': 'music'}, {'Score': 5, 'Label': 'kl-iwonder'}, {'Score': 5, 'Label': 'news'}, {'Score': 4, 'Label': 'cbbc'}]}]}
def kb_ids2known_facts(kb_ids): """ :param kb_ids: a knowledge base of facts that are already mapped to ids :return: a set of all known facts (used later for negative sampling) """ facts = set() for struct in kb_ids: arrays = kb_ids[struct][0] num_facts = len(arrays[0]) for i in range(num_facts): fact = [x[i] for x in arrays] facts.add(tuple(fact)) return facts
def kb_ids2known_facts(kb_ids): """ :param kb_ids: a knowledge base of facts that are already mapped to ids :return: a set of all known facts (used later for negative sampling) """ facts = set() for struct in kb_ids: arrays = kb_ids[struct][0] num_facts = len(arrays[0]) for i in range(num_facts): fact = [x[i] for x in arrays] facts.add(tuple(fact)) return facts
""" 1025. Divisor Game Easy Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number N on the chalkboard. On each player's turn, that player makes a move consisting of: Choosing any x with 0 < x < N and N % x == 0. Replacing the number N on the chalkboard with N - x. Also, if a player cannot make a move, they lose the game. Return True if and only if Alice wins the game, assuming both players play optimally. Example 1: Input: 2 Output: true Explanation: Alice chooses 1, and Bob has no more moves. Example 2: Input: 3 Output: false Explanation: Alice chooses 1, Bob chooses 1, and Alice has no more moves. Note: 1 <= N <= 1000 """ class Solution: def divisorGame(self, N: int) -> bool: return N % 2 == 0
""" 1025. Divisor Game Easy Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number N on the chalkboard. On each player's turn, that player makes a move consisting of: Choosing any x with 0 < x < N and N % x == 0. Replacing the number N on the chalkboard with N - x. Also, if a player cannot make a move, they lose the game. Return True if and only if Alice wins the game, assuming both players play optimally. Example 1: Input: 2 Output: true Explanation: Alice chooses 1, and Bob has no more moves. Example 2: Input: 3 Output: false Explanation: Alice chooses 1, Bob chooses 1, and Alice has no more moves. Note: 1 <= N <= 1000 """ class Solution: def divisor_game(self, N: int) -> bool: return N % 2 == 0
''' Created on 05.03.2018 @author: Alex ''' class ImageSorterException(Exception): pass
""" Created on 05.03.2018 @author: Alex """ class Imagesorterexception(Exception): pass
# Copyright 2017 OpenStack Foundation # All Rights Reserved. # # 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. # Define supported virtual NIC types. VNIC_TYPE_DIRECT and VNIC_TYPE_MACVTAP # are used for SR-IOV ports VNIC_TYPE_NORMAL = 'normal' VNIC_TYPE_DIRECT = 'direct' VNIC_TYPE_MACVTAP = 'macvtap' VNIC_TYPE_DIRECT_PHYSICAL = 'direct-physical' VNIC_TYPE_BAREMETAL = 'baremetal' VNIC_TYPE_VIRTIO_FORWARDER = 'virtio-forwarder' # Define list of ports which needs pci request. # Note: The macvtap port needs a PCI request as it is a tap interface # with VF as the lower physical interface. # Note: Currently, VNIC_TYPE_VIRTIO_FORWARDER assumes a 1:1 # relationship with a VF. This is expected to change in the future. VNIC_TYPES_SRIOV = (VNIC_TYPE_DIRECT, VNIC_TYPE_MACVTAP, VNIC_TYPE_DIRECT_PHYSICAL, VNIC_TYPE_VIRTIO_FORWARDER) # Define list of ports which are passthrough to the guest # and need a special treatment on snapshot and suspend/resume VNIC_TYPES_DIRECT_PASSTHROUGH = (VNIC_TYPE_DIRECT, VNIC_TYPE_DIRECT_PHYSICAL)
vnic_type_normal = 'normal' vnic_type_direct = 'direct' vnic_type_macvtap = 'macvtap' vnic_type_direct_physical = 'direct-physical' vnic_type_baremetal = 'baremetal' vnic_type_virtio_forwarder = 'virtio-forwarder' vnic_types_sriov = (VNIC_TYPE_DIRECT, VNIC_TYPE_MACVTAP, VNIC_TYPE_DIRECT_PHYSICAL, VNIC_TYPE_VIRTIO_FORWARDER) vnic_types_direct_passthrough = (VNIC_TYPE_DIRECT, VNIC_TYPE_DIRECT_PHYSICAL)
# coding=utf-8 """ Some utilities related to numbers. """ def is_even(num: int) -> bool: """Is num even? :param num: number to check. :type num: int :returns: True if num is even. :rtype: bool :raises: ``TypeError`` if num is not an int. """ if not isinstance(num, int): raise TypeError("{} is not an int".format(num)) return num % 2 == 0 def is_odd(num: int) -> bool: """Is num odd? :param num: number to check. :type num: int :returns: True if num is odd. :rtype: bool :raises: ``TypeError`` if num is not an int. """ if not isinstance(num, int): raise TypeError("{} is not an int".format(num)) return num % 2 == 1
""" Some utilities related to numbers. """ def is_even(num: int) -> bool: """Is num even? :param num: number to check. :type num: int :returns: True if num is even. :rtype: bool :raises: ``TypeError`` if num is not an int. """ if not isinstance(num, int): raise type_error('{} is not an int'.format(num)) return num % 2 == 0 def is_odd(num: int) -> bool: """Is num odd? :param num: number to check. :type num: int :returns: True if num is odd. :rtype: bool :raises: ``TypeError`` if num is not an int. """ if not isinstance(num, int): raise type_error('{} is not an int'.format(num)) return num % 2 == 1
# writing a function to find the maximum and minmimum integer in a list numbers = [] while True: inp = (input('Please enter a number: ')) if inp == 'done!': break try: val = int(inp) except: print('Invalid input') print('Please provide a number') continue numbers.append(val) print(numbers) # the problem with this loop is this would not work when creating a loop for smallest """ largest = 0 for i in numbers: print('Before the largest is: ', largest, i) if i > largest: largest = i """ largest = None for i in numbers: if largest is None or i > largest: largest = i """ smallest = 0 for i in numbers: print('Before the smallest is: ', smallest, i) if i < smallest: smallest = i else: smallest = smallest """ smallest = None for i in numbers: if smallest is None or i < smallest: smallest = i print('After the loop, largest: ', largest) print('After the loop, smallest: ', smallest)
numbers = [] while True: inp = input('Please enter a number: ') if inp == 'done!': break try: val = int(inp) except: print('Invalid input') print('Please provide a number') continue numbers.append(val) print(numbers) "\nlargest = 0\nfor i in numbers:\n print('Before the largest is: ', largest, i)\n if i > largest:\n largest = i\n" largest = None for i in numbers: if largest is None or i > largest: largest = i "\nsmallest = 0\nfor i in numbers:\n print('Before the smallest is: ', smallest, i)\n if i < smallest:\n smallest = i\n else:\n smallest = smallest\n" smallest = None for i in numbers: if smallest is None or i < smallest: smallest = i print('After the loop, largest: ', largest) print('After the loop, smallest: ', smallest)
class Animal: nombre: str edad: int nPatas: int raza: str ruido: str color: str def __init__(self, nombre, edad, nPatas, raza, ruido, color): self.nombre = nombre self.edad = edad self.nPatas = nPatas self.raza = raza self.ruido = ruido self.color = color def hacerRuido(self): print(self.ruido) def comer(self): print(f'El animal va a comer')
class Animal: nombre: str edad: int n_patas: int raza: str ruido: str color: str def __init__(self, nombre, edad, nPatas, raza, ruido, color): self.nombre = nombre self.edad = edad self.nPatas = nPatas self.raza = raza self.ruido = ruido self.color = color def hacer_ruido(self): print(self.ruido) def comer(self): print(f'El animal va a comer')
# This file is part of the Pygame SGE. # # The Pygame SGE is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # The Pygame SGE is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with the Pygame SGE. If not, see <http://www.gnu.org/licenses/>. """ This module provides input event classes. Input event objects are used to consolidate all necessary information about input events in a clean way. You normally don't need to use input event objects directly. Input events are handled automatically in each frame of the SGE's main loop. You only need to use input event objects directly if you take control away from the SGE's main loop, e.g. to create your own loop. """ __all__ = ["KeyPress", "KeyRelease", "MouseMove", "MouseButtonPress", "MouseButtonRelease", "JoystickAxisMove", "JoystickHatMove", "JoystickTrackballMove", "JoystickButtonPress", "JoystickButtonRelease", "JoystickEvent", "KeyboardFocusGain", "KeyboardFocusLose", "MouseFocusGain", "MouseFocusLose", "QuitRequest"] class KeyPress: """ This input event represents a key on the keyboard being pressed. .. attribute:: key The identifier string of the key that was pressed. See the table in the documentation for :mod:`sge.keyboard`. .. attribute:: char The unicode string associated with the key press, or an empty unicode string if no text is associated with the key press. See the table in the documentation for :mod:`sge.keyboard`. """ def __init__(self, key, char): self.key = key self.char = char class KeyRelease: """ This input event represents a key on the keyboard being released. .. attribute:: key The identifier string of the key that was released. See the table in the documentation for :class:`sge.input.KeyPress`. """ def __init__(self, key): self.key = key class MouseMove: """ This input event represents the mouse being moved. .. attribute:: x The horizontal relative movement of the mouse. .. attribute:: y The vertical relative movement of the mouse. """ def __init__(self, x, y): self.x = x self.y = y class MouseButtonPress: """ This input event represents a mouse button being pressed. .. attribute:: button The identifier string of the mouse button that was pressed. See the table below. ====================== ================= Mouse Button Name Identifier String ====================== ================= Left mouse button ``"left"`` Right mouse button ``"right"`` Middle mouse button ``"middle"`` Extra mouse button 1 ``"extra1"`` Extra mouse button 2 ``"extra2"`` ====================== ================= """ def __init__(self, button): self.button = button class MouseButtonRelease: """ This input event represents a mouse button being released. .. attribute:: button The identifier string of the mouse button that was released. See the table in the documentation for :class:`sge.input.MouseButtonPress`. """ def __init__(self, button): self.button = button class MouseWheelMove: """ This input event represents a mouse wheel moving. .. attribute:: x The horizontal scroll amount, where ``-1`` is to the left, ``1`` is to the right, and ``0`` is no horizontal scrolling. .. attribute:: y The vertical scroll amount, where ``-1`` is up, ``1`` is down, and ``0`` is no vertical scrolling. """ def __init__(self, x, y): self.x = x self.y = y class JoystickAxisMove: """ This input event represents a joystick axis moving. .. attribute:: js_name The name of the joystick. .. attribute:: js_id The number of the joystick, where ``0`` is the first joystick. .. attribute:: axis The number of the axis that moved, where ``0`` is the first axis on the joystick. .. attribute:: value The tilt of the axis as a float from ``-1`` to ``1``, where ``0`` is centered, ``-1`` is all the way to the left or up, and ``1`` is all the way to the right or down. """ def __init__(self, js_name, js_id, axis, value): self.js_name = js_name self.js_id = js_id self.axis = axis self.value = max(-1.0, min(value, 1.0)) class JoystickHatMove: """ This input event represents a joystick hat moving. .. attribute:: js_name The name of the joystick. .. attribute:: js_id The number of the joystick, where ``0`` is the first joystick. .. attribute:: hat The number of the hat that moved, where ``0`` is the first axis on the joystick. .. attribute:: x The horizontal position of the hat, where ``0`` is centered, ``-1`` is left, and ``1`` is right. .. attribute:: y The vertical position of the hat, where ``0`` is centered, ``-1`` is up, and ``1`` is down. """ def __init__(self, js_name, js_id, hat, x, y): self.js_name = js_name self.js_id = js_id self.hat = hat self.x = x self.y = y class JoystickTrackballMove: """ This input event represents a joystick trackball moving. .. attribute:: js_name The name of the joystick. .. attribute:: js_id The number of the joystick, where ``0`` is the first joystick. .. attribute:: ball The number of the trackball that moved, where ``0`` is the first trackball on the joystick. .. attribute:: x The horizontal relative movement of the trackball. .. attribute:: y The vertical relative movement of the trackball. """ def __init__(self, js_name, js_id, ball, x, y): self.js_name = js_name self.js_id = js_id self.ball = ball self.x = x self.y = y class JoystickButtonPress: """ This input event represents a joystick button being pressed. .. attribute:: js_name The name of the joystick. .. attribute:: js_id The number of the joystick, where ``0`` is the first joystick. .. attribute:: button The number of the button that was pressed, where ``0`` is the first button on the joystick. """ def __init__(self, js_name, js_id, button): self.js_name = js_name self.js_id = js_id self.button = button class JoystickButtonRelease: """ This input event represents a joystick button being released. .. attribute:: js_name The name of the joystick. .. attribute:: js_id The number of the joystick, where ``0`` is the first joystick. .. attribute:: button The number of the button that was released, where ``0`` is the first button on the joystick. """ def __init__(self, js_name, js_id, button): self.js_name = js_name self.js_id = js_id self.button = button class JoystickEvent: """ This input event represents the movement of any joystick input. This makes it possible to treat all joystick inputs the same way, which can be used to simplify things like control customization. .. attribute:: js_name The name of the joystick. .. attribute:: js_id The number of the joystick, where ``0`` is the first joystick. .. attribute:: input_type The type of joystick control that was moved. Can be one of the following: - ``"axis-"`` -- The tilt of a joystick axis to the left or up changes. - ``"axis+"`` -- The tilt of a joystick axis to the right or down changes. - ``"axis0"`` -- The tilt of a joystick axis changes. - ``"hat_left"`` -- Whether or not a joystick hat's position is to the left changes. - ``"hat_right"`` -- Whether or not a joystick hat's position is to the right changes. - ``"hat_center_x"`` -- Whether or not a joystick hat is horizontally centered changes. - ``"hat_up"`` -- Whether or not a joystick hat's position is up changes. - ``"hat_down"`` -- Whether or not a joystick hat's position is down changes. - ``"hat_center_y"`` -- Whether or not a joystick hat is vertically centered changes. - ``"trackball_left"`` -- A joystick trackball is moved left. - ``"trackball_right"`` -- A joystick trackball is moved right. - ``"trackball_up"`` -- A joystick trackball is moved up. - ``"trackball_down"`` -- A joystick trackball is moved down. - ``"button"`` -- Whether or not a joystick button is pressed changes. .. attribute:: input_id The number of the joystick control that was moved, where ``0`` is the first control of its type on the joystick. .. attribute:: value The value of the event, which is different depending on the value of :attr:`input_type`. If :attr:`input_type` is ``"trackball_left"``, ``"trackball_right"``, ``"trackball_up"``, or ``"trackball_down"``, this is the relative movement of the trackball in the respective direction. Otherwise, this is the new value of the respective control. See the documentation for :func:`sge.joystick.get_value` for more information. """ def __init__(self, js_name, js_id, input_type, input_id, value): self.js_name = js_name self.js_id = js_id self.input_type = input_type self.input_id = input_id self.value = value class KeyboardFocusGain: """ This input event represents the game window gaining keyboard focus. Keyboard focus is normally needed for keyboard input to be received. .. note:: On some window systems, such as the one used by Windows, no distinction is made between keyboard and mouse focus, but on some other window systems, such as the X Window System, a distinction is made: one window can have keyboard focus while another has mouse focus. Be careful to observe the difference; failing to do so may result in annoying bugs, and you won't notice these bugs if you are testing on a window manager that doesn't recognize the difference. """ class KeyboardFocusLose: """ This input event represents the game window losing keyboard focus. Keyboard focus is normally needed for keyboard input to be received. .. note:: See the note in the documentation for :class:`sge.input.KeyboardFocusGain`. """ class MouseFocusGain: """ This input event represents the game window gaining mouse focus. Mouse focus is normally needed for mouse input to be received. .. note:: See the note in the documentation for :class:`sge.input.KeyboardFocusGain`. """ class MouseFocusLose: """ This input event represents the game window losing mouse focus. Mouse focus is normally needed for mouse input to be received. .. note:: See the note in the documentation for :class:`sge.input.KeyboardFocusGain`. """ class WindowResize: """ This input event represents the player resizing the window. """ class QuitRequest: """ This input event represents the OS requesting for the program to close (e.g. when the user presses a "close" button on the window border). """
""" This module provides input event classes. Input event objects are used to consolidate all necessary information about input events in a clean way. You normally don't need to use input event objects directly. Input events are handled automatically in each frame of the SGE's main loop. You only need to use input event objects directly if you take control away from the SGE's main loop, e.g. to create your own loop. """ __all__ = ['KeyPress', 'KeyRelease', 'MouseMove', 'MouseButtonPress', 'MouseButtonRelease', 'JoystickAxisMove', 'JoystickHatMove', 'JoystickTrackballMove', 'JoystickButtonPress', 'JoystickButtonRelease', 'JoystickEvent', 'KeyboardFocusGain', 'KeyboardFocusLose', 'MouseFocusGain', 'MouseFocusLose', 'QuitRequest'] class Keypress: """ This input event represents a key on the keyboard being pressed. .. attribute:: key The identifier string of the key that was pressed. See the table in the documentation for :mod:`sge.keyboard`. .. attribute:: char The unicode string associated with the key press, or an empty unicode string if no text is associated with the key press. See the table in the documentation for :mod:`sge.keyboard`. """ def __init__(self, key, char): self.key = key self.char = char class Keyrelease: """ This input event represents a key on the keyboard being released. .. attribute:: key The identifier string of the key that was released. See the table in the documentation for :class:`sge.input.KeyPress`. """ def __init__(self, key): self.key = key class Mousemove: """ This input event represents the mouse being moved. .. attribute:: x The horizontal relative movement of the mouse. .. attribute:: y The vertical relative movement of the mouse. """ def __init__(self, x, y): self.x = x self.y = y class Mousebuttonpress: """ This input event represents a mouse button being pressed. .. attribute:: button The identifier string of the mouse button that was pressed. See the table below. ====================== ================= Mouse Button Name Identifier String ====================== ================= Left mouse button ``"left"`` Right mouse button ``"right"`` Middle mouse button ``"middle"`` Extra mouse button 1 ``"extra1"`` Extra mouse button 2 ``"extra2"`` ====================== ================= """ def __init__(self, button): self.button = button class Mousebuttonrelease: """ This input event represents a mouse button being released. .. attribute:: button The identifier string of the mouse button that was released. See the table in the documentation for :class:`sge.input.MouseButtonPress`. """ def __init__(self, button): self.button = button class Mousewheelmove: """ This input event represents a mouse wheel moving. .. attribute:: x The horizontal scroll amount, where ``-1`` is to the left, ``1`` is to the right, and ``0`` is no horizontal scrolling. .. attribute:: y The vertical scroll amount, where ``-1`` is up, ``1`` is down, and ``0`` is no vertical scrolling. """ def __init__(self, x, y): self.x = x self.y = y class Joystickaxismove: """ This input event represents a joystick axis moving. .. attribute:: js_name The name of the joystick. .. attribute:: js_id The number of the joystick, where ``0`` is the first joystick. .. attribute:: axis The number of the axis that moved, where ``0`` is the first axis on the joystick. .. attribute:: value The tilt of the axis as a float from ``-1`` to ``1``, where ``0`` is centered, ``-1`` is all the way to the left or up, and ``1`` is all the way to the right or down. """ def __init__(self, js_name, js_id, axis, value): self.js_name = js_name self.js_id = js_id self.axis = axis self.value = max(-1.0, min(value, 1.0)) class Joystickhatmove: """ This input event represents a joystick hat moving. .. attribute:: js_name The name of the joystick. .. attribute:: js_id The number of the joystick, where ``0`` is the first joystick. .. attribute:: hat The number of the hat that moved, where ``0`` is the first axis on the joystick. .. attribute:: x The horizontal position of the hat, where ``0`` is centered, ``-1`` is left, and ``1`` is right. .. attribute:: y The vertical position of the hat, where ``0`` is centered, ``-1`` is up, and ``1`` is down. """ def __init__(self, js_name, js_id, hat, x, y): self.js_name = js_name self.js_id = js_id self.hat = hat self.x = x self.y = y class Joysticktrackballmove: """ This input event represents a joystick trackball moving. .. attribute:: js_name The name of the joystick. .. attribute:: js_id The number of the joystick, where ``0`` is the first joystick. .. attribute:: ball The number of the trackball that moved, where ``0`` is the first trackball on the joystick. .. attribute:: x The horizontal relative movement of the trackball. .. attribute:: y The vertical relative movement of the trackball. """ def __init__(self, js_name, js_id, ball, x, y): self.js_name = js_name self.js_id = js_id self.ball = ball self.x = x self.y = y class Joystickbuttonpress: """ This input event represents a joystick button being pressed. .. attribute:: js_name The name of the joystick. .. attribute:: js_id The number of the joystick, where ``0`` is the first joystick. .. attribute:: button The number of the button that was pressed, where ``0`` is the first button on the joystick. """ def __init__(self, js_name, js_id, button): self.js_name = js_name self.js_id = js_id self.button = button class Joystickbuttonrelease: """ This input event represents a joystick button being released. .. attribute:: js_name The name of the joystick. .. attribute:: js_id The number of the joystick, where ``0`` is the first joystick. .. attribute:: button The number of the button that was released, where ``0`` is the first button on the joystick. """ def __init__(self, js_name, js_id, button): self.js_name = js_name self.js_id = js_id self.button = button class Joystickevent: """ This input event represents the movement of any joystick input. This makes it possible to treat all joystick inputs the same way, which can be used to simplify things like control customization. .. attribute:: js_name The name of the joystick. .. attribute:: js_id The number of the joystick, where ``0`` is the first joystick. .. attribute:: input_type The type of joystick control that was moved. Can be one of the following: - ``"axis-"`` -- The tilt of a joystick axis to the left or up changes. - ``"axis+"`` -- The tilt of a joystick axis to the right or down changes. - ``"axis0"`` -- The tilt of a joystick axis changes. - ``"hat_left"`` -- Whether or not a joystick hat's position is to the left changes. - ``"hat_right"`` -- Whether or not a joystick hat's position is to the right changes. - ``"hat_center_x"`` -- Whether or not a joystick hat is horizontally centered changes. - ``"hat_up"`` -- Whether or not a joystick hat's position is up changes. - ``"hat_down"`` -- Whether or not a joystick hat's position is down changes. - ``"hat_center_y"`` -- Whether or not a joystick hat is vertically centered changes. - ``"trackball_left"`` -- A joystick trackball is moved left. - ``"trackball_right"`` -- A joystick trackball is moved right. - ``"trackball_up"`` -- A joystick trackball is moved up. - ``"trackball_down"`` -- A joystick trackball is moved down. - ``"button"`` -- Whether or not a joystick button is pressed changes. .. attribute:: input_id The number of the joystick control that was moved, where ``0`` is the first control of its type on the joystick. .. attribute:: value The value of the event, which is different depending on the value of :attr:`input_type`. If :attr:`input_type` is ``"trackball_left"``, ``"trackball_right"``, ``"trackball_up"``, or ``"trackball_down"``, this is the relative movement of the trackball in the respective direction. Otherwise, this is the new value of the respective control. See the documentation for :func:`sge.joystick.get_value` for more information. """ def __init__(self, js_name, js_id, input_type, input_id, value): self.js_name = js_name self.js_id = js_id self.input_type = input_type self.input_id = input_id self.value = value class Keyboardfocusgain: """ This input event represents the game window gaining keyboard focus. Keyboard focus is normally needed for keyboard input to be received. .. note:: On some window systems, such as the one used by Windows, no distinction is made between keyboard and mouse focus, but on some other window systems, such as the X Window System, a distinction is made: one window can have keyboard focus while another has mouse focus. Be careful to observe the difference; failing to do so may result in annoying bugs, and you won't notice these bugs if you are testing on a window manager that doesn't recognize the difference. """ class Keyboardfocuslose: """ This input event represents the game window losing keyboard focus. Keyboard focus is normally needed for keyboard input to be received. .. note:: See the note in the documentation for :class:`sge.input.KeyboardFocusGain`. """ class Mousefocusgain: """ This input event represents the game window gaining mouse focus. Mouse focus is normally needed for mouse input to be received. .. note:: See the note in the documentation for :class:`sge.input.KeyboardFocusGain`. """ class Mousefocuslose: """ This input event represents the game window losing mouse focus. Mouse focus is normally needed for mouse input to be received. .. note:: See the note in the documentation for :class:`sge.input.KeyboardFocusGain`. """ class Windowresize: """ This input event represents the player resizing the window. """ class Quitrequest: """ This input event represents the OS requesting for the program to close (e.g. when the user presses a "close" button on the window border). """