content
stringlengths
7
1.05M
class basedriver (object): def __init__(self, ctx, model): self._ctx = ctx self._model = model def check_update(self, current): if current is None: return True if current.version is None: return True if current.version != self._model.version: return True return False def update(self, fmgr): raise NotImplementedError() def unpack(self, fmgr, locations): raise NotImplementedError() def cleanup(self): pass
def get(key): return None def set(key, value): pass
""" [2017-09-29] Challenge #333 [Hard] Build a Web API-driven Data Site https://www.reddit.com/r/dailyprogrammer/comments/739j8c/20170929_challenge_333_hard_build_a_web_apidriven/ # Description A common theme in present-day programming are web APIs. We've had a previous challenge where you had to _consume_ an API, today's challenge is to _implement_ one. Today's is relatively simple: a single CSV file as input that can probably be represented by a single database table. Your solution may use whatever technologies you wish to build on: * Web server software, e.g. Flask, Rails, Play!, etc * Database software, e.g. MySQL, MongoDB, etc - or none, using a database is optional * Database interaction layer, e.g. SQLAlchemy, ActiveRecord, Ecto, etc This challenge focuses less on the guts of the server and more on routing requests, transforming a request into a data extraction method, and returning those results. Today's challenge will utilize the State of Iowa - Monthly Voter Registration Totals by County data set: https://data.iowa.gov/Communities-People/State-of-Iowa-Monthly-Voter-Registration-Totals-by/cp55-uurs Download the JSON, CSV or other and use that as your input. It contains 19 columns and over 20,000 rows. Now expose the data via a web API. Your solution **must** implement the following API behaviors: * A "get_voters_where" endpoint that takes the following optional arguments: county, month, party affiliation, active_status, and limit (the max number of results to return). The endpoint must return a JSON-formatted output, but the schema is up to you. * All APIs must be RESTful (see [The REST API in five minutes](https://developer.marklogic.com/try/rest/index) for some background if you need it). This challenge extends Wednesday's idea of practicality and real world scenarios. Wednesday was some basic data science, today is some basic application development. It's open ended. # Bonus Ensure your API is immune to attack vectors like SQL injection. """ def main(): pass if __name__ == "__main__": main()
# Problem Statement: https://leetcode.com/problems/longest-increasing-subsequence/ class Solution: def lengthOfLIS(self, nums: List[int]) -> int: arr = nums if not arr: return 0 lens = [1 for num in arr] seqs = [None for num in arr] for i, num in enumerate(arr): curr_num = num for j in range(0, i): other_num = arr[j] if other_num < curr_num and lens[j] + 1 >= lens[i]: lens[i] = lens[j] + 1 seqs[i] = j return max(lens)
print('load # extractor diagram V1 essential') # Essential version for the final summary automation in the main notebook. #It contains only the winning prefilter and feature extraction from the development process. class extdia_v1_essential(extractor_diagram): def ini_diagram(self): # custom # extractor diagram name self.name = 'EDiaV1' # name extention HP if self.fHP: self.name += 'HP' # name extention augment if self.augment>-1: self.name += 'aug' + str(self.augment) # name extention DeviceType ( Time Slicing or not) if self.DeviceType==1: self.name += 'TsSl' # extractor pre objects self.pre['denoise'] = feature_extractor_pre_nnFilterDenoise(self.base_folder,'den') self.pre['denoise'].set_hyperparamter(aggregation=np.mean, channel=0) if self.fHP: self.pre['HP'] = simple_FIR_HP(self.fHP, 16000) else: self.pre['HP'] = simple_FIR_HP(120, 16000) # extractor objects self.ext['MEL'] = feature_extractor_mel(self.base_folder,'MELv1') self.ext['MEL'].set_hyperparamter(n_fft=1024, n_mels=80, hop_length=512, channel=0) self.ext['PSD'] = feature_extractor_welchPSD(BASE_FOLDER,'PSDv1') self.ext['PSD'].set_hyperparamter(nperseg=512, nfft=1024, channel=0) # outport ini self.outport_akkulist['MEL_raw'] = [] self.outport_akkulist['PSD_raw'] = [] self.outport_akkulist['MEL_den'] = [] pass def execute_diagram(self,file_path,file_class, probe=False): # custom #-record target to akku append later # get file and cut main channel wmfs = [copy.deepcopy(memory_wave_file().read_wavfile(self.base_folder,file_path))] wmfs[0].channel = np.array([wmfs[0].channel[self.main_channel]]) #print(wmfs[0].channel.shape ) wmfs_class = [file_class] # react to augmenting flag if file_class==self.augment: #print(file_class,self.augment,file_path) wmfs.append(create_augmenter(wmfs[0])) wmfs_class.append(-1) #print(wmfs[0].channel.shape) for wmf_i,wmf in enumerate(wmfs): #print(wmf_i,wmfs_class[wmf_i],file_path) self.target_akkulist.append(wmfs_class[wmf_i]) #print(wmfs[wmf_i].channel.shape) # HP toggle on off if self.fHP: wmfs[wmf_i].channel[0] = self.pre['HP'].apply(wmf.channel[0]) #print(wmfs[wmf_i].channel.shape) # Time Slice if self.DeviceType == 1: wmfs[wmf_i].channel = TimeSliceAppendActivation(wmfs[wmf_i].channel,wmfs[wmf_i].srate) #print(wmfs[wmf_i].channel.shape,file_path) # denoise 2 self.pre['denoise'].create_from_wav(wmfs[wmf_i]) wmf_den2 = copy.deepcopy(self.pre['denoise'].get_wav_memory_file()) #->OUTPORTs self.ext['PSD'].create_from_wav(wmfs[wmf_i]) self.outport_akkulist['PSD_raw'].append(copy.deepcopy(self.ext['PSD'].get_dict())) self.ext['MEL'].create_from_wav(wmfs[wmf_i]) self.outport_akkulist['MEL_raw'].append(copy.deepcopy(self.ext['MEL'].get_dict())) self.ext['MEL'].create_from_wav(wmf_den2) self.outport_akkulist['MEL_den'].append(copy.deepcopy(self.ext['MEL'].get_dict())) pass
class Solution(object): def kidsWithCandies(self, candies, extraCandies): """ :type candies: List[int] :type extraCandies: int :rtype: List[bool] """ max_candies = max(candies) # out_l = [] # for i in candies: # if(i + extraCandies >= max_candies): # out_l.append(True) # else: # out_l.append(False) # return out_l # One Liner return [True if(i + extraCandies >= max_candies) else False for i in candies]
n = int(input()) sticks = list(map(int, input().split())) uniq = sorted(set(sticks)) for i in uniq: print(len([x for x in sticks if x >= i]))
x = 1 y = 10 if(x == 1): print("x equals 1") if(y != 1): print("y doesn't equal 1") if(x < y): print("x is less than y") elif(x > y): print("x is greater than y") else: print("x equals y") if (x == 1 and y == 10): print("Both values true") if(x < 10): if (y > 5): print("x is less than 10, y is greater than 5")
class BackgroundClip( Property, ): BorderBox = "border-box" PaddingBox = "padding-box" ContentBox = "content-box"
''' config file ''' n_one_hot_slot = 6 # 0 - user_id, 1 - movie_id, 2 - gender, 3 - age, 4 - occ, 5 - release year n_mul_hot_slot = 2 # 6 - title (mul-hot), 7 - genres (mul-hot) max_len_per_slot = 5 # max num of fts in one mul-hot slot num_csv_col_warm = 17 num_csv_col_w_ngb = 17 + 160 # num of cols in the csv file (w ngb) layer_dim = [256, 128, 1] # for ngb n_one_hot_slot_ngb = 6 n_mul_hot_slot_ngb = 2 max_len_per_slot_ngb = 5 max_n_ngb_ori = 10 # num of ngbs in data file max_n_ngb = 10 # num of ngbs to use in model, <= max_n_ngb_ori pre = './data/' suf = '.tfrecord' # a, b - used for meta learning train_file_name_a = [pre+'train_oneshot_a_w_ngb'+suf, pre+'train_oneshot_b_w_ngb'+suf] #, pre+'train_oneshot_c_w_ngb'+suf] train_file_name_b = [pre+'train_oneshot_b_w_ngb'+suf, pre+'train_oneshot_c_w_ngb'+suf] #, pre+'train_oneshot_a_w_ngb'+suf] # warm, warm_2 - used for warm-up training train_file_name_warm = [pre+'test_oneshot_a'+suf] train_file_name_warm_2 = [pre+'test_oneshot_b'+suf] # you can use 'test_oneshot_a_w_ngb' for validation test_file_name = [pre+'test_test_w_ngb'+suf] # the following are indices for features (excluding label) # 0 - user_id, 1 - movie_id, 2 - gender, 3 - age, 4 - occ, 5 - release year, 6 - title (mul-hot), 7 - genres (mul-hot) # tar_idx - whose emb to be generated # attr_idx - which are intrinsic item attributes tar_idx = [1] # must be from small to large attr_idx = [5,6,7] n_ft = 11134 input_format = 'tfrecord' #'csv' time_style = '%Y-%m-%d %H:%M:%S' rnd_seed = 123 # random seed (different seeds lead to different results) att_dim = 10*len(attr_idx) batch_size = 128 # used for warm up training # meta_mode: self - use the new ad's own attributes # ngb - use ngbs' pre-trained ID embs. meta_mode = 'GME-A' # 'self', 'ngb', 'GME-P', 'GME-G', 'GME-A' meta_batch_size_range = [60] # learning rate for getting a new adapted embedding cold_eta_range = [1e-4] # [0.05, 0.1] # learning rate for meta learning meta_eta_range = [5e-3] # [1e-4, 5e-4, 1e-3, 5e-3, 1e-2] # learning rate for warm-up training eta_range = [1e-3] n_epoch = 1 # number of times to loop over the warm-up training data set n_epoch_meta = 1 # number of times to loop over the meta training data set alpha = 0.1 gamma = 1.0 test_batch_size = 128 # whether to perform warm up training # only valid for 'gme_all_in_one_warm_up.py' warm_up_bool = False # True ################# save_model_ind = 0 # load emb and FC layer weights from a pre-trained DNN model model_loading_addr = './tmp/dnn_1011_1705/' output_file_name = '0801_0900' k = 10 # embedding size / number of latent factors opt_alg = 'Adam' # 'Adagrad' kp_prob = 1.0 record_step_size = 200 # record the loss and auc after xx steps
first_num_elements, second_num_elements2 = [int(num) for num in input().split()] first_set = {input() for _ in range(first_num_elements)} second_set = {input() for _ in range(second_num_elements2)} print(*first_set.intersection(second_set), sep='\n') # 4 3 # 1 # 3 # 5 # 7 # 3 # 4 # 5
def decode_index(index: int) -> str: return {0: "ham", 1: "spam"}[index] def probability_to_index(prediction: list) -> int: return 0 if prediction[0] > prediction[1] else 1
a = [] impar = [] par = [] while True: n1 = int(input("Digite um valor: ")) a.append(n1) if n1 % 2 == 0: par.append(n1) elif n1 % 2 != 0: impar.append(n1) s = str(input("Deseja continuar? [S/N]")) if s in 'Nn': break print(f"Lista geral {a}") print(f"Lista dos pares {par}") print(f"Lista dos impares {impar}")
# Рекурсивные функции print(' Рекурсивные функции ') print('factorial методом пекурсивной функции') def fact(num): if num == 0: return 1 else: return num * fact(num - 1) print(fact(10)) print() # То же самое, но В ЦИКЛЕ print(' То же самое, но В ЦИКЛЕ ') factorial = 1 for i in range(1, 11): factorial *= i print(factorial) # Возведение в степень (a*b) с помощью Рекурсивной ф-ции print(' Возведение в степень (a*b) с помощью Рекурсивной ф-ции ') def degree(a,b): if b == 0: return 1 else: return a * degree(a,b-1) print(degree(2, 10)) print() # То же самое (возведение в степень), но В ЦИКЛЕ print(' То же самое(возведение в степень), но В ЦИКЛЕ ') deg = 1 for i in range(1, 11): deg *= 2 print(deg) # Рекурсию редко используют, она может занять всю оперативную память, но иногда попадаются очень красивые решения, # котор. использ-ют Рекур-ую функцию print('! ! Рекурсию редко используют, она может занять всю оперативную память,! !')
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def findTilt(self, root): def travel(node, tiles): if node is None: return 0 sum_left = travel(node.left, tiles) sum_right = travel(node.right, tiles) diff = abs(sum_left - sum_right) tiles.append(diff) sum_all = node.val + sum_left + sum_right return sum_all tiles = [] travel(root, tiles) return sum(tiles)
class Triangle: def __init__(self,a,b,c): self.a=a self.b=b self.c=c def is_valid(self): if (self.a+self.b>self.c) and (self.a+self.c>self.b) and (self.b+self.c>self.a): return 'Valid' else: return 'Invalid' def Side_Classification(self): if self.is_valid()=='Valid': if (self.a==self.b and self.b==self.c): return 'Equilateral' elif (self.a==self.b or self.b==self.c or self.a==self.c): return 'Isosceles' else: return 'Scalene' else: return 'Invalid' def Angle_Classification(self): if self.is_valid()=='Valid': l=sorted([self.a,self.b,self.c]) a,b,c=l if ((a)**2+(b)**2 >(c)**2): return 'Acute' elif ((a)**2+(b)**2 ==(c)**2): return 'Right' else: return 'Obtuse' else: return 'Invalid' def Area(self): if self.is_valid()=='Valid': a,b,c=[self.a,self.b,self.c] s=(a+b+c)/2 area=(s*(s-a)*(s-b)*(s-c))**0.5 return area else: return 'Invalid' a=int(input()) b=int(input()) c=int(input()) T=Triangle(a,b,c) print(T.is_valid()) print(T.Side_Classification()) print(T.Angle_Classification()) print(T.Area())
def main(app_config=None, q1=0, q2=2): some_var = {'key': 'value'} if q1 > 9: return { "dict_return": 1, } return some_var if __name__ == "__main__": main()
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright (c) 2002-2018 "Neo Technology," # Network Engine for Objects in Lund AB [http://neotechnology.com] # # This file is part of Neo4j. # # 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. class Structure(list): def __init__(self, capacity, signature): self.capacity = capacity self.signature = signature def __repr__(self): return repr(tuple(iter(self))) def __eq__(self, other): return list(self) == list(other) def __ne__(self, other): return not self.__eq__(other) def __iter__(self): yield self.signature yield tuple(super(Structure, self).__iter__())
#Implemnting queue ADT using singly linked list class LinkedQueue: """FIFO queue implementation using a singly linked list for storage""" class Empty(Exception): """Error attempting to access an element from an empty container""" pass class _Node: """Lightweight, nonpublic class for storing singly linked node """ __slots__ = '_element', '_next' def __init__(self, element, next): self._elment = element self._next = next def __init__(self): #create an empty queue self._head = None self._tail = None self._size = 0 def __len__(self): #retuns size of the queue return self._size def is_empty(self): #returns true if the list is empty return self._size == 0 def first(self): #return but do not remove the top element of the queue if self.is_empty(): raise Empty('queue is empty') return self._head._element def dequeue(self): #remove and returns the first the element of the queue if self.is_empty(): raise Empty('Queue is empty') answer = self._head._element self._head = self._head._element self._size -= 1 if self.is_empty(): self._tail = None return answer def enqueue(self, e): #add an element to the back of the queue newest = self._Node(e, None) #this node will be a new tail node if self.is_empty(): self._head = newest else: self._tail._next = newest self._tail = newest self._size += 1
# -*- coding: utf-8 -*- """ Created on Fri May 29 10:48:30 2020 @author: Tim """ n = 1000 count = 0 for i in range(n): for j in range(n): for k in range(n): if i < j and j < k: count += 1 print(count)
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None def isSymmetric(self, root: TreeNode) -> bool: """ function to determine if the provided TreeNode is the root of a symmetric binary tree """ def isMirror(left: TreeNode, right: TreeNode) -> bool: """ Utility function to determine if two trees mirror each other. If the root and all subtrees searched here are mirrors, then the tree as a whole is symmetric """ # Two null values are mirrors if left is None and right is None: return True # If only one value is null, these trees do not mirror each other if left is None or right is None: return False # If the values are not equal, the trees do not mirror each other if left.val != right.val: return False # If left.left mirrors right.right, and left.right mirrors right.left, # the subtrees mirror each other return isMirror(left.left, right.right) and isMirror(left.right, right.left) return isMirror(root, root)
# Python3 program to find the numbers # of non negative integral solutions # return number of non negative # integral solutions def countSolutions(n, val,indent): print(indent+"countSolutions(",n,val,")") # initialize total = 0 total = 0 # Base Case if n = 1 and val >= 0 # then it should return 1 if n == 1 and val >= 0: return 1 # iterate the loop till equal the val for i in range(val + 1): # total solution of of equations # and again call the recursive # function Solutions(variable,value) total += countSolutions(n - 1, val - i,indent+" ") # return the total no possible solution return total # driver code n = 4 val = 2 print(countSolutions(n, val,""))
# -*- coding: utf-8 -*- DATABASE_MAPPING = { 'database_list': { 'resource': 'database/', 'docs': '', 'methods': ['GET'], }, 'database_get': { 'resource': 'database/{id}/', 'docs': '', 'methods': ['GET'], }, 'database_create': { 'resource': 'database/', 'docs': '', 'methods': ['POST'], }, 'database_update': { 'resource': 'database/{id}/', 'docs': '', 'methods': ['PUT'], }, 'database_delete': { 'resource': 'database/{id}/', 'docs': '', 'methods': ['DELETE'], }, }
def is_abundant(number): mysum = 1 # Can always divide by 1, so start looking at divisor 2 for divisor in range(2, int(round(number / 2 + 1))): if number % divisor == 0: mysum += divisor if mysum > number: return True else: return False
# Copyright European Organization for Nuclear Research (CERN) # # 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 # # Authors: # - Muhammad Aditya Hilmy, <[email protected]>, 2020 class DIDNotAvailableException(BaseException): def __init__(self): super().__init__("DID is not yet available.") class MultipleItemDID(list): # pragma: no cover def __init__(self, items, did_available=True): super(MultipleItemDID, self).__init__(items) self.items = items self.did_available = did_available def __str__(self): if not self.did_available: raise DIDNotAvailableException() return super().__str__() def __repr__(self): if not self.did_available: raise DIDNotAvailableException() return super().__repr__() def __getitem__(self, key): if not self.did_available: raise DIDNotAvailableException() return super().__getitem__(key) def __iter__(self): if not self.did_available: raise DIDNotAvailableException() return super().__iter__() class SingleItemDID(str): # pragma: no cover def __init__(self, path): super(SingleItemDID, self).__init__() self.path = path self.did_available = path is not None def __str__(self): if not self.did_available: raise DIDNotAvailableException() return self.path def __repr__(self): if not self.did_available: raise DIDNotAvailableException() return self.path def __getitem__(self, key): if not self.did_available: raise DIDNotAvailableException() return super().__getitem__(key) def __iter__(self): if not self.did_available: raise DIDNotAvailableException() return super().__iter__()
class OAuthError(Exception): """Base class for OAuth errors""" pass class OAuthStateMismatchError(OAuthError): pass class OAuthCannotDisconnectError(OAuthError): pass class OAuthUserAlreadyExistsError(OAuthError): pass
def ispow2(n): ''' True if n is a power of 2, False otherwise >>> ispow2(5) False >>> ispow2(4) True ''' return (n & (n-1)) == 0 def nextpow2(n): ''' Given n, return the nearest power of two that is >= n >>> nextpow2(1) 1 >>> nextpow2(2) 2 >>> nextpow2(5) 8 >>> nextpow2(17) 32 ''' if ispow2(n): return n count = 0 while n != 0: n = n >> 1 count += 1 return 1 << count class SamplingRateError(ValueError): ''' Indicates that the conversion of frequency to sampling rate could not be performed. ''' def __init__(self, fs, requested_fs): self.fs = fs self.requested_fs = requested_fs def __str__(self): mesg = 'The requested sampling rate, %f Hz, is greater than ' + \ 'the DSP clock frequency of %f Hz.' return mesg % (self.requested_fs, self.fs) def convert(src_unit, dest_unit, value, dsp_fs): ''' Converts value to desired unit give the sampling frequency of the DSP. Parameters specified in paradigms are typically expressed as frequency and time while many DSP parameters are expressed in number of samples (referenced to the DSP sampling frequency). This function provides a convenience method for converting between conventional values and the 'digital' values used by the DSP. Note that for converting units of time/frequency to n/nPer, we have to coerce the value to a multiple of the DSP period (e.g. the number of 'ticks' of the DSP clock). Appropriate strings for the unit types: fs sampling frequency nPer number of samples per period n number of samples s seconds ms milliseconds nPow2 number of samples, coerced to the next greater power of 2 (used for ensuring efficient FFT computation) >>> convert('s', 'n', 0.5, 10000) 5000 >>> convert('fs', 'nPer', 500, 10000) 20 >>> convert('s', 'nPow2', 5, 97.5e3) 524288 Parameters ---------- src_unit: string dest_unit: string Destination unit value: numerical (e.g. integer or float) Value to be converted Returns ------- converted unit : numerical value ''' def fs_to_nPer(req_fs, dsp_fs): if dsp_fs < req_fs: raise SamplingRateError(dsp_fs, req_fs) return int(dsp_fs/req_fs) def nPer_to_fs(nPer, dsp_fs): return dsp_fs/nPer def n_to_s(n, dsp_fs): return n/dsp_fs def s_to_n(s, dsp_fs): return int(s*dsp_fs) def ms_to_n(ms, dsp_fs): return int(ms*1e-3*dsp_fs) def n_to_ms(n, dsp_fs): return n/dsp_fs*1e3 def s_to_nPow2(s, dsp_fs): return nextpow2(s_to_n(s, dsp_fs)) fun = '%s_to_%s' % (src_unit, dest_unit) return locals()[fun](value, dsp_fs)
# Complete the fibonacciModified function below. def fibonacciModified(t1, t2, n): term = 3 while term <= n: actual_number = t1 + t2**2 t1 = t2 t2 = actual_number term += 1 return actual_number
a=1; b=2; c=a+b; print("hello world") 121213
name = input() age = int(input()) while name != 'Anton': print(name) name = input() age = input() print(f'I am Anton')
class Task(object): def __init__(self, name, description="", task_id=None): self.id = task_id self.name = name self.description = description def serialize(self): return { "id": self.id, "name": self.name, "description": self.description } @staticmethod def serialize_multiple(tasks): return [task.serialize() for task in tasks]
# -*- coding: utf-8 -*- _available_examples = ["ex_001_Molecule_Hamiltonian.py", "ex_002_Molecule_Aggregate.py", "ex_003_CorrFcnSpectDens.py", "ex_004_SpectDensDatabase.py", "ex_005_UnitsManagementHamiltonian.py", "ex_006_Absorption_1.py", "ex_010_RedfieldTheory_1.py", "ex_011_LindbladForm_1.py", "ex_012_Integrodiff.py", "ex_013_HEOM.py", "ex_014_HEOM_rates.py", "ex_015_RedfieldTheory_2.py", "ex_016_FoersterTheory_1.py", "ex_020_EvolutionSuperOperator_1.py", "ex_050_PDB_FMO1.py", "ex_300_ParallelIterators.py", "ex_800_DiagProblem.py", "ex_853_RC.py", "ex_854_2DSpectrum_DimerDisorder.py"] _available_data = ["data_050_3eni.pdb", "data_050_3eoj.pdb", "ex_853_RC.yaml", "ex_854_2DSpectrum_DimerDisorder.yaml"]
def recursive_multiply(x, y): if (x < y): return recursive_multiply(y, x) elif (y != 0): return (x + recursive_multiply(x, y-1)) else: return 0 x = int(input("Enter x")) y = int(input("Enter y")) print(recursive_multiply(x, y))
DEFAULT_STACK_SIZE = 8 class PcStack(object): def __init__(self, programCounter, size: int=DEFAULT_STACK_SIZE): self._programCounter = programCounter self._size = size self._stack = [0]*size self._stackPointer = 0 @property def programCounter(self): return self._programCounter @property def size(self) -> int: return self._size @property def stack(self): return self._stack @property def stackPointer(self) -> int: return self._stackPointer @stackPointer.setter def stackPointer(self, value: int): self._stackPointer = value @property def current(self): return self.stack[self.stackPointer] @current.setter def current(self, value: int): self.stack[self.stackPointer] = value def incStackPointer(self): self._stackPointer = (self.stackPointer + 1) % self.size def decStackPointer(self): if self.stackPointer == 0: self.stackPointer = self.size - 1 else: self.stackPointer = self.stackPointer - 1 def push(self, address): self.current = self.programCounter.address + 1 self.incStackPointer() self.programCounter.address = address def pop(self): self.decStackPointer() self.programCounter.address = self.current
# -*- coding: utf-8 -*- """ File Name: kthLargest.py Author : jynnezhang Date: 2020/4/30 10:02 上午 Description: 二叉搜索树的第k大节点 https://leetcode-cn.com/problems/er-cha-sou-suo-shu-de-di-kda-jie-dian-lcof/ """ class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def kthLargest(self, root: TreeNode, k: int) -> int: if root is None: return None res = [] self.preOrder(root, res) if k > len(res): return None else: return res[len(res)-k] def preOrder(self, cur, res): if cur is None: return 0 self.preOrder(cur.left, res) res.append(cur.val) self.preOrder(cur.right, res) # 提前返回! def kthLargest2(self, root: TreeNode, k: int) -> int: def dfs(root): if not root: return dfs(root.right) if self.k == 0: return self.k -= 1 if self.k == 0: self.res = root.val dfs(root.left) self.k = k self.res = 0 dfs(root) return self.res
# -*- coding: utf-8 -*- user_schema = { 'username': { 'type': 'string', 'minlength': 1, 'maxlength': 64, 'required': True, 'unique': True }, 'email': { 'type': 'string', 'regex': '^\S+@\S+.\S+', 'required': True, 'unique': True }, 'password': { 'type': 'string', 'minlength': 1, 'maxlength': 64, 'required': True }, } user = { 'item_title': 'user', 'additional_lookup': { 'url': 'regex("[\w]+")', 'field': 'username' }, 'cache_control': 'max-age=10,must-revalidate', 'cache_expires': 10, 'resource_methods': ['GET', 'POST'], 'schema': user_schema } todolist_schema = { 'title': { 'type': 'string', 'minlength': 1, 'maxlength': 128, 'required': True }, 'creator': { 'type': 'string' }, 'todos': {}, } todolist = { 'item_title': 'todolist', 'additional_lookup': { 'url': 'regex("[\w]+")', # 'field': '_id' 'field': 'title' }, 'cache_control': 'max-age=10,must-revalidate', 'cache_expires': 10, 'resource_methods': ['GET', 'POST', 'DELETE'], 'schema': todolist_schema } todo_schema = { 'description': { 'type': 'string', 'minlength': 1, 'maxlength': 128, 'required': True }, 'creator': { 'type': 'string' }, 'todolist': {}, } todo = { 'item_title': 'todo', 'additional_lookup': { 'url': 'regex("[\w]+")', # 'field': '_id' 'field': 'description' }, 'cache_control': 'max-age=10,must-revalidate', 'cache_expires': 10, 'resource_methods': ['GET', 'POST', 'DELETE'], 'schema': todo_schema } DOMAIN = { 'users': user, 'todolists': todolist, 'todos': todo } # mongo db settings MONGO_HOST = 'localhost' MONGO_PORT = 27017 MONGO_USERNAME = '' MONGO_PASSWORD = '' MONGO_DBNAME = 'apitest'
''' https://www.geeksforgeeks.org/find-count-number-given-string-present-2d-character-array/ Given a 2-Dimensional character array and a string, we need to find the given string in 2-dimensional character array such that individual characters can be present left to right, right to left, top to down or down to top. Examples: In case you wish to attend live classes with experts, please refer DSA Live Classes for Working Professionals and Competitive Programming Live for Students. Input : a ={ {D,D,D,G,D,D}, {B,B,D,E,B,S}, {B,S,K,E,B,K}, {D,D,D,D,D,E}, {D,D,D,D,D,E}, {D,D,D,D,D,G} } str= "GEEKS" Output :2 Input : a = { {B,B,M,B,B,B}, {C,B,A,B,B,B}, {I,B,G,B,B,B}, {G,B,I,B,B,B}, {A,B,C,B,B,B}, {M,C,I,G,A,M} } str= "MAGIC" Output :3 We have discussed simpler problem to find if a word exists or not in a matrix. To count all occurrences, we follow simple brute force approach. Traverse through each character of the matrix and taking each character as start of the string to be found, try to search in all the possible directions. Whenever, a word is found, increase the count, and after traversing the matrix what ever will be the value of count will be number of times string exists in character matrix. Algorithm : 1- Traverse matrix character by character and take one character as string start 2- For each character find the string in all the four directions recursively 3- If a string found, we increase the count 4- When we are done with one character as start, we repeat the same process for the next character 5- Calculate the sum of count for each character 6- Final count will be the answer''' # Python code for finding count # of string in a given 2D # character array. # utility function to search # complete string from any # given index of 2d array def internalSearch(ii, needle, row, col, hay, row_max, col_max): found = 0 if (row >= 0 and row <= row_max and col >= 0 and col <= col_max and needle[ii] == hay[row][col]): match = needle[ii] ii += 1 hay[row][col] = 0 if (ii == len(needle)): found = 1 else: # through Backtrack searching # in every directions found += internalSearch(ii, needle, row, col + 1, hay, row_max, col_max) found += internalSearch(ii, needle, row, col - 1, hay, row_max, col_max) found += internalSearch(ii, needle, row + 1, col, hay, row_max, col_max) found += internalSearch(ii, needle, row - 1, col, hay, row_max, col_max) hay[row][col] = match return found # Function to search the string in 2d array def searchString(needle, row, col, strr, row_count, col_count): found = 0 for r in range(row_count): for c in range(col_count): found += internalSearch(0, needle, r, c, strr, row_count - 1, col_count - 1) return found # Driver code needle = "MAGIC" inputt = ["BBABBM", "CBMBBA", "IBABBG", "GOZBBI", "ABBBBC", "MCIGAM"] strr = [0] * len(inputt) for i in range(len(inputt)): strr[i] = list(inputt[i]) print("count: ", searchString(needle, 0, 0, strr, len(strr), len(strr[0])))
# # PHASE: jvm flags # # DOCUMENT THIS # def phase_jvm_flags(ctx, p): if ctx.attr.tests_from: archives = _get_test_archive_jars(ctx, ctx.attr.tests_from) else: archives = p.compile.merged_provider.runtime_output_jars serialized_archives = _serialize_archives_short_path(archives) test_suite = _gen_test_suite_flags_based_on_prefixes_and_suffixes( ctx, serialized_archives, ) return [ "-ea", test_suite.archiveFlag, test_suite.prefixesFlag, test_suite.suffixesFlag, test_suite.printFlag, test_suite.testSuiteFlag, ] def _gen_test_suite_flags_based_on_prefixes_and_suffixes(ctx, archives): return struct( archiveFlag = "-Dbazel.discover.classes.archives.file.paths=%s" % archives, prefixesFlag = "-Dbazel.discover.classes.prefixes=%s" % ",".join( ctx.attr.prefixes, ), printFlag = "-Dbazel.discover.classes.print.discovered=%s" % ctx.attr.print_discovered_classes, suffixesFlag = "-Dbazel.discover.classes.suffixes=%s" % ",".join( ctx.attr.suffixes, ), testSuiteFlag = "-Dbazel.test_suite=%s" % ctx.attr.suite_class, ) def _serialize_archives_short_path(archives): archives_short_path = "" for archive in archives: archives_short_path += archive.short_path + "," return archives_short_path[:-1] #remove redundant comma def _get_test_archive_jars(ctx, test_archives): flattened_list = [] for archive in test_archives: class_jars = [java_output.class_jar for java_output in archive[JavaInfo].outputs.jars] flattened_list.extend(class_jars) return flattened_list
METADATA = 'metadata' CONTENT = 'content' FILENAME = 'filename' PARAM_CREATION_DATE = '_audit_creation_date' PARAM_R1 = '_diffrn_reflns_av_R_equivalents' PARAM_SIGMI_NETI = '_diffrn_reflns_av_sigmaI/netI' PARAM_COMPLETENESS = '_reflns_odcompleteness_completeness' PARAM_SPACEGROUP = '_space_group_name_H-M_alt' PARAM_SPACEGROUP_NUM = '_space_group_IT_number' PARAM_CONST_CELLA = '_cell_length_a' PARAM_CONST_CELLB = '_cell_length_b' PARAM_CONST_CELLC = '_cell_length_c' PARAM_CONST_AL = '_cell_angle_alpha' PARAM_CONST_BE = '_cell_angle_beta' PARAM_CONST_GA = '_cell_angle_gamma' PARAM_CONST_VOL = '_cell_volume' PARAM_REFLECTIONS = '_cell_measurement_reflns_used' PARAM_WAVELENGTH = '_diffrn_radiation_wavelength' PARAM_CELLA = '_cell_oxdiff_length_a' PARAM_CELLB = '_cell_oxdiff_length_b' PARAM_CELLC = '_cell_oxdiff_length_c' PARAM_AL = '_cell_oxdiff_angle_alpha' PARAM_BE = '_cell_oxdiff_angle_beta' PARAM_GA = '_cell_oxdiff_angle_gamma' PARAM_VOL = '_cell_oxdiff_volume' PARAM_UB11 = '_diffrn_orient_matrix_UB_11' PARAM_UB12 = '_diffrn_orient_matrix_UB_12' PARAM_UB13 = '_diffrn_orient_matrix_UB_13' PARAM_UB21 = '_diffrn_orient_matrix_UB_21' PARAM_UB22 = '_diffrn_orient_matrix_UB_22' PARAM_UB23 = '_diffrn_orient_matrix_UB_23' PARAM_UB31 = '_diffrn_orient_matrix_UB_31' PARAM_UB32 = '_diffrn_orient_matrix_UB_32' PARAM_UB33 = '_diffrn_orient_matrix_UB_33' PARAM_2THETA_MIN = '_cell_measurement_theta_min' PARAM_2THETA_MAX = '_cell_measurement_theta_max'
class cves(): cve_url = "https://services.nvd.nist.gov/rest/json/cves/1.0?pubStartDate=2021-09-01T00:00:00:000+UTC-00:00&resultsPerPage=100&keyword=" keywords = ["RHCS", "RHEL", "Thales", "nShield", "Certificate+Authority&isExactMatch=true", "NSS", "tomcat", "TLS"]
class SingleMethods: def __init__(self, finished_reports_dictionary, single_reports_dictionary, sample_data, latex_header_and_sample_list_dictionary, loq_dictionary ): self.finished_reports_dictionary = finished_reports_dictionary self.single_reports_dictionary = single_reports_dictionary self.sample_data = sample_data self.latex_header_and_sample_list_dictionary = latex_header_and_sample_list_dictionary self.loq_dictionary = loq_dictionary def generate_single_sample_reports(self): for key, value in self.single_reports_dictionary.items(): if value[0] == 'Percent' and value[1] == 'Basic': self.generate_single_percent_basic_report(key) elif value[0] == 'Percent' and value[1] == 'Deluxe': self.generate_single_percent_deluxe_report(key) elif value[0] == 'mg/g' and value[1] == 'Basic': self.generate_single_mg_g_basic_report(key) elif value[0] == 'mg/g' and value[1] == 'Deluxe': self.generate_single_mg_g_deluxe_report(key) elif value[0] == 'mg/mL' and value[1] == 'Basic': self.generate_single_mg_ml_basic_report(key) elif value[0] == 'mg/mL' and value[1] == 'Deluxe': self.generate_single_mg_ml_deluxe_report(key) elif value[0] == 'per unit' and value[1] == 'Basic': self.generate_single_unit_basic_report(key) elif value[0] == 'per unit' and value[1] == 'Deluxe': self.generate_single_unit_deluxe_report(key) else: self.generate_single_percent_deluxe_report(key) return self.finished_reports_dictionary def generate_single_percent_basic_report(self, sample_id): temporary_data_frame = self.sample_data.samples_data_frame[self.sample_data.samples_data_frame['sampleid'] == sample_id] temporary_data = self.get_relevant_values_and_recoveries_for_single_reports(temporary_data_frame, 'Percent', 'Basic') temporary_table = self.create_single_basic_table(temporary_data, 'Percent') header = self.latex_header_and_sample_list_dictionary[sample_id[0:6]] footer = self.generate_footer() report = header + temporary_table + footer self.finished_reports_dictionary[sample_id] = report def generate_single_mg_g_basic_report(self, sample_id): temporary_data_frame = self.sample_data.samples_data_frame[self.sample_data.samples_data_frame['sampleid'] == sample_id] temporary_data = self.get_relevant_values_and_recoveries_for_single_reports(temporary_data_frame, 'mg_g', 'Basic') temporary_table = self.create_single_basic_table(temporary_data, 'mg_g') header = self.latex_header_and_sample_list_dictionary[sample_id[0:6]] footer = self.generate_footer() report = header + temporary_table + footer self.finished_reports_dictionary[sample_id] = report def generate_single_percent_deluxe_report(self, sample_id): temporary_data_frame = self.sample_data.samples_data_frame[self.sample_data.samples_data_frame['sampleid'] == sample_id] temporary_data = self.get_relevant_values_and_recoveries_for_single_reports(temporary_data_frame, 'Percent', 'Deluxe') temporary_table = self.create_single_deluxe_table(temporary_data, 'Percent') header = self.latex_header_and_sample_list_dictionary[sample_id[0:6]] footer = self.generate_footer() report = header + temporary_table + footer self.finished_reports_dictionary[sample_id] = report def generate_single_mg_g_deluxe_report(self, sample_id): temporary_data_frame = self.sample_data.samples_data_frame[self.sample_data.samples_data_frame['sampleid'] == sample_id] temporary_data = self.get_relevant_values_and_recoveries_for_single_reports(temporary_data_frame, 'mg_g', 'Deluxe') temporary_table = self.create_single_deluxe_table(temporary_data, 'mg_g') header = self.latex_header_and_sample_list_dictionary[sample_id[0:6]] footer = self.generate_footer() report = header + temporary_table + footer self.finished_reports_dictionary[sample_id] = report def generate_single_mg_ml_basic_report(self, sample_id): temporary_data_frame = self.sample_data.samples_data_frame[self.sample_data.samples_data_frame['sampleid'] == sample_id] temporary_data = self.get_relevant_values_and_recoveries_for_single_reports_unit(temporary_data_frame, 'Basic', 'density') temporary_table = self.create_single_basic_table_unit(temporary_data, 'density') header = self.latex_header_and_sample_list_dictionary[sample_id[0:6]] footer = self.generate_footer() report = header + temporary_table + footer self.finished_reports_dictionary[sample_id] = report def generate_single_mg_ml_deluxe_report(self, sample_id): temporary_data_frame = self.sample_data.samples_data_frame[self.sample_data.samples_data_frame['sampleid'] == sample_id] temporary_data = self.get_relevant_values_and_recoveries_for_single_reports_unit(temporary_data_frame, 'Deluxe', 'density') temporary_table = self.create_single_deluxe_table_unit(temporary_data, 'density') header = self.latex_header_and_sample_list_dictionary[sample_id[0:6]] footer = self.generate_footer() report = header + temporary_table + footer self.finished_reports_dictionary[sample_id] = report def generate_single_unit_basic_report(self, sample_id): temporary_data_frame = self.sample_data.samples_data_frame[self.sample_data.samples_data_frame['sampleid'] == sample_id] temporary_data = self.get_relevant_values_and_recoveries_for_single_reports_unit(temporary_data_frame, 'Basic', 'unit') temporary_table = self.create_single_basic_table_unit(temporary_data, 'unit') header = self.latex_header_and_sample_list_dictionary[sample_id[0:6]] footer = self.generate_footer() report = header + temporary_table + footer self.finished_reports_dictionary[sample_id] = report def generate_single_unit_deluxe_report(self, sample_id): temporary_data_frame = self.sample_data.samples_data_frame[self.sample_data.samples_data_frame['sampleid'] == sample_id] temporary_data = self.get_relevant_values_and_recoveries_for_single_reports_unit(temporary_data_frame, 'Deluxe', 'unit') temporary_table = self.create_single_deluxe_table_unit(temporary_data, 'unit') header = self.latex_header_and_sample_list_dictionary[sample_id[0:6]] footer = self.generate_footer() report = header + temporary_table + footer self.finished_reports_dictionary[sample_id] = report def get_standard_recovery_values(self, report_type): temporary_data_frame = self.sample_data.best_recovery_qc_data_frame ibu_recovery_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 1.0, ['percrecovery']].iloc[0]['percrecovery'] ibu_recovery_value = self.round_down_to_correct_decimal_point(ibu_recovery_value) cbdv_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 2.0, ['percrecovery']].iloc[0]['percrecovery'] cbdv_value = self.round_down_to_correct_decimal_point(cbdv_value) cbdva_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 3.0, ['percrecovery']].iloc[0]['percrecovery'] cbdva_value = self.round_down_to_correct_decimal_point(cbdva_value) thcv_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 4.0, ['percrecovery']].iloc[0]['percrecovery'] thcv_value = self.round_down_to_correct_decimal_point(thcv_value) # cbgva_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 5.0, # ['percrecovery']].iloc[0]['percrecovery'] # cbgva_value = self.round_down_to_correct_decimal_point(cbgva_value) cbd_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 6.0, ['percrecovery']].iloc[0]['percrecovery'] cbd_value = self.round_down_to_correct_decimal_point(cbd_value) cbg_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 7.0, ['percrecovery']].iloc[0]['percrecovery'] cbg_value = self.round_down_to_correct_decimal_point(cbg_value) cbda_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 8.0, ['percrecovery']].iloc[0]['percrecovery'] cbda_value = self.round_down_to_correct_decimal_point(cbda_value) cbn_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 9.0, ['percrecovery']].iloc[0]['percrecovery'] cbn_value = self.round_down_to_correct_decimal_point(cbn_value) cbga_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 10.0, ['percrecovery']].iloc[0]['percrecovery'] cbga_value = self.round_down_to_correct_decimal_point(cbga_value) thcva_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 11.0, ['percrecovery']].iloc[0]['percrecovery'] thcva_value = self.round_down_to_correct_decimal_point(thcva_value) d9_thc_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 12.0, ['percrecovery']].iloc[0]['percrecovery'] d9_thc_value = self.round_down_to_correct_decimal_point(d9_thc_value) d8_thc_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 13.0, ['percrecovery']].iloc[0]['percrecovery'] d8_thc_value = self.round_down_to_correct_decimal_point(d8_thc_value) cbl_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 14.0, ['percrecovery']].iloc[0]['percrecovery'] cbl_value = self.round_down_to_correct_decimal_point(cbl_value) cbc_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 15.0, ['percrecovery']].iloc[0]['percrecovery'] cbc_value = self.round_down_to_correct_decimal_point(cbc_value) cbna_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 16.0, ['percrecovery']].iloc[0]['percrecovery'] cbna_value = self.round_down_to_correct_decimal_point(cbna_value) thca_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 17.0, ['percrecovery']].iloc[0]['percrecovery'] thca_value = self.round_down_to_correct_decimal_point(thca_value) cbla_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 18.0, ['percrecovery']].iloc[0]['percrecovery'] cbla_value = self.round_down_to_correct_decimal_point(cbla_value) cbca_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 19.0, ['percrecovery']].iloc[0]['percrecovery'] cbca_value = self.round_down_to_correct_decimal_point(cbca_value) if report_type == 'Deluxe': return [ibu_recovery_value, cbdv_value, cbdva_value, thcv_value, "N/A", cbd_value, cbg_value, cbda_value, cbn_value, cbga_value, thcva_value, d9_thc_value, d8_thc_value, cbl_value, cbc_value, cbna_value, thca_value, cbla_value, cbca_value] else: return [ibu_recovery_value, cbd_value, cbda_value, cbn_value, cbna_value, d9_thc_value, thca_value, d8_thc_value] def get_relevant_values_and_recoveries_for_single_reports(self, temporary_data_frame, sample_type, report_type): if sample_type == 'Percent': sample_column_type = 'percentage_concentration' elif sample_type == 'mg_g': sample_column_type = 'mg_g' elif sample_type == 'mg_ml': sample_column_type = 'mg_ml' else: sample_column_type = 'percentage_concentration' ibu_recovery_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 1.0, ['percrecovery']].iloc[0]['percrecovery'] ibu_recovery_value = self.round_down_to_correct_decimal_point(ibu_recovery_value) cbdv_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 2.0, [sample_column_type]].iloc[0][sample_column_type] cbdv_value = self.round_down_to_correct_decimal_point(cbdv_value) cbdva_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 3.0, [sample_column_type]].iloc[0][sample_column_type] cbdva_value = self.round_down_to_correct_decimal_point(cbdva_value) thcv_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 4.0, [sample_column_type]].iloc[0][sample_column_type] thcv_value = self.round_down_to_correct_decimal_point(thcv_value) cbgva_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 5.0, [sample_column_type]].iloc[0][sample_column_type] cbgva_value = self.round_down_to_correct_decimal_point(cbgva_value) cbd_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 6.0, [sample_column_type]].iloc[0][sample_column_type] cbd_value = self.round_down_to_correct_decimal_point(cbd_value) cbg_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 7.0, [sample_column_type]].iloc[0][sample_column_type] cbg_value = self.round_down_to_correct_decimal_point(cbg_value) cbda_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 8.0, [sample_column_type]].iloc[0][sample_column_type] cbda_value = self.round_down_to_correct_decimal_point(cbda_value) cbn_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 9.0, [sample_column_type]].iloc[0][sample_column_type] cbn_value = self.round_down_to_correct_decimal_point(cbn_value) cbga_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 10.0, [sample_column_type]].iloc[0][sample_column_type] cbga_value = self.round_down_to_correct_decimal_point(cbga_value) thcva_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 11.0, [sample_column_type]].iloc[0][sample_column_type] thcva_value = self.round_down_to_correct_decimal_point(thcva_value) d9_thc_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 12.0, [sample_column_type]].iloc[0][sample_column_type] d9_thc_value = self.round_down_to_correct_decimal_point(d9_thc_value) d8_thc_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 13.0, [sample_column_type]].iloc[0][sample_column_type] d8_thc_value = self.round_down_to_correct_decimal_point(d8_thc_value) cbl_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 14.0, [sample_column_type]].iloc[0][sample_column_type] cbl_value = self.round_down_to_correct_decimal_point(cbl_value) cbc_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 15.0, [sample_column_type]].iloc[0][sample_column_type] cbc_value = self.round_down_to_correct_decimal_point(cbc_value) cbna_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 16.0, [sample_column_type]].iloc[0][sample_column_type] cbna_value = self.round_down_to_correct_decimal_point(cbna_value) thca_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 17.0, [sample_column_type]].iloc[0][sample_column_type] thca_value = self.round_down_to_correct_decimal_point(thca_value) cbla_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 18.0, [sample_column_type]].iloc[0][sample_column_type] cbla_value = self.round_down_to_correct_decimal_point(cbla_value) cbca_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 19.0, [sample_column_type]].iloc[0][sample_column_type] cbca_value = self.round_down_to_correct_decimal_point(cbca_value) if report_type == 'Deluxe': return [ibu_recovery_value, cbdv_value, cbdva_value, thcv_value, cbgva_value, cbd_value, cbg_value, cbda_value, cbn_value, cbga_value, thcva_value, d9_thc_value, d8_thc_value, cbl_value, cbc_value, cbna_value, thca_value, cbla_value, cbca_value] else: return [ibu_recovery_value, cbd_value, cbda_value, cbn_value, cbna_value, d9_thc_value, thca_value, d8_thc_value] def get_relevant_values_and_recoveries_for_single_reports_unit(self, temporary_data_frame, report_type, unit_type): if unit_type == 'unit': column_1 = 'mg_g' column_2 = 'mg_unit' elif unit_type == 'density': column_1 = 'mg_ml' column_2 = 'percentage_concentration' else: column_1 = 'percentage_concentration' column_2 = 'percentage_concentration' ibu_recovery_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 1.0, ['percrecovery']].iloc[0]['percrecovery'] ibu_recovery_value = self.round_down_to_correct_decimal_point(ibu_recovery_value) cbdv_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 2.0, [column_1]].iloc[0][column_1] cbdv_value = self.round_down_to_correct_decimal_point(cbdv_value) cbdva_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 3.0, [column_1]].iloc[0][column_1] cbdva_value = self.round_down_to_correct_decimal_point(cbdva_value) thcv_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 4.0, [column_1]].iloc[0][column_1] thcv_value = self.round_down_to_correct_decimal_point(thcv_value) cbgva_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 5.0, [column_1]].iloc[0][column_1] cbgva_value = self.round_down_to_correct_decimal_point(cbgva_value) cbd_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 6.0, [column_1]].iloc[0][column_1] cbd_value = self.round_down_to_correct_decimal_point(cbd_value) cbg_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 7.0, [column_1]].iloc[0][column_1] cbg_value = self.round_down_to_correct_decimal_point(cbg_value) cbda_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 8.0, [column_1]].iloc[0][column_1] cbda_value = self.round_down_to_correct_decimal_point(cbda_value) cbn_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 9.0, [column_1]].iloc[0][column_1] cbn_value = self.round_down_to_correct_decimal_point(cbn_value) cbga_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 10.0, [column_1]].iloc[0][column_1] cbga_value = self.round_down_to_correct_decimal_point(cbga_value) thcva_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 11.0, [column_1]].iloc[0][column_1] thcva_value = self.round_down_to_correct_decimal_point(thcva_value) d9_thc_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 12.0, [column_1]].iloc[0][column_1] d9_thc_value = self.round_down_to_correct_decimal_point(d9_thc_value) d8_thc_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 13.0, [column_1]].iloc[0][column_1] d8_thc_value = self.round_down_to_correct_decimal_point(d8_thc_value) cbl_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 14.0, [column_1]].iloc[0][column_1] cbl_value = self.round_down_to_correct_decimal_point(cbl_value) cbc_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 15.0, [column_1]].iloc[0][column_1] cbc_value = self.round_down_to_correct_decimal_point(cbc_value) cbna_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 16.0, [column_1]].iloc[0][column_1] cbna_value = self.round_down_to_correct_decimal_point(cbna_value) thca_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 17.0, [column_1]].iloc[0][column_1] thca_value = self.round_down_to_correct_decimal_point(thca_value) cbla_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 18.0, [column_1]].iloc[0][column_1] cbla_value = self.round_down_to_correct_decimal_point(cbla_value) cbca_value = temporary_data_frame.loc[temporary_data_frame['id17'] == 19.0, [column_1]].iloc[0][column_1] cbca_value = self.round_down_to_correct_decimal_point(cbca_value) # UNITS cbdv_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 2.0, [column_2]].iloc[0][column_2] cbdv_value_u = self.round_down_to_correct_decimal_point(cbdv_value_u) cbdva_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 3.0, [column_2]].iloc[0][column_2] cbdva_value_u = self.round_down_to_correct_decimal_point(cbdva_value_u) thcv_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 4.0, [column_2]].iloc[0][column_2] thcv_value_u = self.round_down_to_correct_decimal_point(thcv_value_u) cbgva_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 5.0, [column_2]].iloc[0][column_2] cbgva_value_u = self.round_down_to_correct_decimal_point(cbgva_value_u) cbd_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 6.0, [column_2]].iloc[0][column_2] cbd_value_u = self.round_down_to_correct_decimal_point(cbd_value_u) cbg_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 7.0, [column_2]].iloc[0][column_2] cbg_value_u = self.round_down_to_correct_decimal_point(cbg_value_u) cbda_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 8.0, [column_2]].iloc[0][column_2] cbda_value_u = self.round_down_to_correct_decimal_point(cbda_value_u) cbn_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 9.0, [column_2]].iloc[0][column_2] cbn_value_u = self.round_down_to_correct_decimal_point(cbn_value_u) cbga_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 10.0, [column_2]].iloc[0][column_2] cbga_value_u = self.round_down_to_correct_decimal_point(cbga_value_u) thcva_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 11.0, [column_2]].iloc[0][column_2] thcva_value_u = self.round_down_to_correct_decimal_point(thcva_value_u) d9_thc_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 12.0, [column_2]].iloc[0][column_2] d9_thc_value_u = self.round_down_to_correct_decimal_point(d9_thc_value_u) d8_thc_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 13.0, [column_2]].iloc[0][column_2] d8_thc_value_u = self.round_down_to_correct_decimal_point(d8_thc_value_u) cbl_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 14.0, [column_2]].iloc[0][column_2] cbl_value_u = self.round_down_to_correct_decimal_point(cbl_value_u) cbc_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 15.0, [column_2]].iloc[0][column_2] cbc_value_u = self.round_down_to_correct_decimal_point(cbc_value_u) cbna_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 16.0, [column_2]].iloc[0][column_2] cbna_value_u = self.round_down_to_correct_decimal_point(cbna_value_u) thca_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 17.0, [column_2]].iloc[0][column_2] thca_value_u = self.round_down_to_correct_decimal_point(thca_value_u) cbla_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 18.0, [column_2]].iloc[0][column_2] cbla_value_u = self.round_down_to_correct_decimal_point(cbla_value_u) cbca_value_u = temporary_data_frame.loc[temporary_data_frame['id17'] == 19.0, [column_2]].iloc[0][column_2] cbca_value_u = self.round_down_to_correct_decimal_point(cbca_value_u) if report_type == 'Deluxe': return [ibu_recovery_value, [cbdv_value, cbdv_value_u], [cbdva_value, cbdva_value_u], [thcv_value, thcv_value_u], [cbgva_value, cbgva_value_u], [cbd_value, cbd_value_u], [cbg_value, cbg_value_u], [cbda_value, cbda_value_u], [cbn_value, cbn_value_u], [cbga_value, cbga_value_u], [thcva_value, thcva_value_u], [d9_thc_value, d9_thc_value_u], [d8_thc_value, d8_thc_value_u], [cbl_value, cbl_value_u], [cbc_value, cbc_value_u], [cbna_value, cbna_value_u], [thca_value, thca_value_u], [cbla_value, cbla_value_u], [cbca_value, cbca_value_u]] else: return [ibu_recovery_value, [cbd_value, cbd_value_u], [cbda_value, cbda_value_u], [cbn_value, cbn_value_u], [cbna_value, cbna_value_u], [d9_thc_value, d9_thc_value_u], [thca_value, thca_value_u], [d8_thc_value, d8_thc_value_u]] def create_single_deluxe_table(self, data, sample_type): thc_total = self.create_total_line('regular', 'deluxe', 'THC', data) cbd_total = self.create_total_line('regular', 'deluxe', 'CBD', data) recov_data = self.get_standard_recovery_values('Deluxe') if sample_type == 'Percent': sample_type = r'\%' elif sample_type == 'mg_g': sample_type = 'mg/g' elif sample_type == 'mg_ml': sample_type = 'mg/mL' else: sample_type = r'\%' deluxe_potency_table_string = r""" \newline \renewcommand{\arraystretch}{1.2} \begin{table}[h!]\centering \begin{tabular}{p{\dimexpr0.270\textwidth-2\tabcolsep-\arrayrulewidth\relax}| p{\dimexpr0.490\textwidth-2\tabcolsep-\arrayrulewidth\relax}| p{\dimexpr0.07\textwidth-2\tabcolsep-\arrayrulewidth\relax} p{\dimexpr0.1\textwidth-2\tabcolsep-\arrayrulewidth\relax} p{\dimexpr0.07\textwidth-2\tabcolsep-\arrayrulewidth\relax} } \textbf{Cannabinoids} & \textbf{Sample 1} & \textbf{\small Blank} & \textbf{\small Recovery} & $\mathbf{\small S_{0}}$\\ & (""" + sample_type + r""") & (\%) & (\%) & (\%) \\ \hline \hline $\Delta^{9}$-THC & """ + data[11] + r""" & ND & """ + recov_data[11] + r"""& """ + self.loq_dictionary[11] + r"""\\ $\Delta^{9}$-THC Acid & """ + data[16] + r""" & ND & """ + recov_data[16] + r"""& """ + self.loq_dictionary[16] + r"""\\ \hline \hline \textbf{Total THC*} & \textbf{""" + thc_total + r"""} & & &\\ \hline \hline $\Delta^{8}$THC & """ + data[12] + r""" & ND & """ + recov_data[12] + r"""& """ + self.loq_dictionary[12] + r"""\\ $\Delta^{8}$THC Acid & ND & ND & N/A & N/A \\ \hline Cannabichromene (CBC) & """ + data[14] + r""" & ND& """ + recov_data[14] + r"""& """ + self.loq_dictionary[14] + r"""\\ Cannabichromene Acid & """ + data[18] + r""" & ND & """ + recov_data[18] + r"""& """ + self.loq_dictionary[18] + r"""\\ \hline Cannabidiol (CBD) &""" + data[5] + r""" & ND & """ + recov_data[5] + r"""& """ + self.loq_dictionary[5] + r"""\\ Cannabidiol Acid & """ + data[7] + r""" & ND & """ + recov_data[7] + r"""& """ + self.loq_dictionary[7] + r"""\\ \hline \hline \textbf{Total CBD**} & \textbf{""" + cbd_total + r"""} & & &\\ \hline \hline Cannabigerol (CBG) & """ + data[6] + r""" & ND & """ + recov_data[6] + r"""& """ + self.loq_dictionary[6] + r"""\\ Cannabigerol Acid & """ + data[9] + r""" & ND & """ + recov_data[9] + r"""& """ + self.loq_dictionary[9] + r"""\\ \hline Cannabicyclol (CBL) & """ + data[13] + r""" & ND & """ + recov_data[13] + r"""& """ + self.loq_dictionary[13] + r"""\\ Cannabicyclol Acid & """ + data[17] + r""" & ND & """ + recov_data[17] + r"""& """ + self.loq_dictionary[17] + r"""\\ \hline Cannabidivarin (CBDV) & """ + data[1] + r""" & ND & """ + recov_data[1] + r"""& """ + self.loq_dictionary[1] + r"""\\ Cannabidivarin Acid & """ + data[2] + r""" & ND & """ + recov_data[2] + r"""&""" + self.loq_dictionary[2] + r"""\\ \hline $\Delta^{9}$ THCV & """ + data[3] + r""" & ND& """ + recov_data[3] + r"""& """ + self.loq_dictionary[3] + r"""\\ $\Delta^{9}$ THCV Acid & """ + data[10] + r""" & ND & """ + recov_data[10] + r"""& """ + self.loq_dictionary[10] + r"""\\ \hline Cannabinol (CBN) & """ + data[8] + r""" & ND & """ + recov_data[8] + r"""& """ + self.loq_dictionary[8] + r"""\\ Cannabinol Acid & """ + data[15] + r""" & ND & """ + recov_data[15] + r"""& """ + self.loq_dictionary[15] + r""" \\ \hline Cannabigerivarin Acid & ND & ND & N/A & N/A \\ \hline \hline \textbf{Moisture} & 0.00 & & &\\ \hline \hline \end{tabular} \end{table} """ return deluxe_potency_table_string def create_single_deluxe_table_unit(self, data, unit_type): thc_total = self.create_total_line('unit', 'deluxe', 'THC', data) cbd_total = self.create_total_line('unit', 'deluxe', 'CBD', data) recov_data = self.get_standard_recovery_values('Deluxe') if unit_type == 'unit': sample_type_1 = 'mg/g' sample_type_2 = 'mg/unit' elif unit_type == 'density': sample_type_1 = 'mg/mL' sample_type_2 = r'\%' else: sample_type_1 = r'\%' sample_type_2 = r'\%' deluxe_potency_table_string = r""" \newline \renewcommand{\arraystretch}{1.2} \begin{table}[h!]\centering \begin{tabular}{p{\dimexpr0.270\textwidth-2\tabcolsep-\arrayrulewidth\relax}| p{\dimexpr0.245\textwidth-2\tabcolsep-\arrayrulewidth\relax}| p{\dimexpr0.245\textwidth-2\tabcolsep-\arrayrulewidth\relax}| p{\dimexpr0.07\textwidth-2\tabcolsep-\arrayrulewidth\relax} p{\dimexpr0.1\textwidth-2\tabcolsep-\arrayrulewidth\relax} p{\dimexpr0.07\textwidth-2\tabcolsep-\arrayrulewidth\relax} } \textbf{Cannabinoids} & \textbf{Sample 1} & \textbf{Sample 1} & \textbf{\small Blank} & \textbf{\small Recovery} & $\mathbf{\small S_{0}}$ \\ & (""" + sample_type_1 + r""") & (""" + sample_type_2 + r""") & (\%) & (\%) & (\%) \\ \hline \hline $\Delta^{9}$-THC & """ + data[11][0] + r""" & """ + data[11][1] + r""" & ND & """ + recov_data[11] + r"""&""" + \ self.loq_dictionary[11] + r"""\\ $\Delta^{9}$-THC Acid & """ + data[16][0] + r""" & """ + data[16][1] + r""" & ND & """ + recov_data[ 16] + r"""& """ + self.loq_dictionary[16] + r"""\\ \hline \hline \textbf{Total THC*} & \textbf{""" + thc_total[0] + r"""} & \textbf{""" + thc_total[1] + r"""} & & &\\ \hline \hline $\Delta^{8}$THC & """ + data[12][0] + r""" & """ + data[12][1] + r""" & ND & """ + recov_data[12] + r"""& """ + \ self.loq_dictionary[12] + r"""\\ $\Delta^{8}$THC Acid & ND & ND & ND & N/A & N/A\\ \hline Cannabichromene (CBC) & """ + data[14][0] + r""" & """ + data[14][1] + r""" & ND & """ + recov_data[14] + r"""& """ + \ self.loq_dictionary[14] + r"""\\ Cannabichromene Acid & """ + data[18][0] + r""" & """ + data[18][1] + r""" & ND & """ + recov_data[18] + r"""& """ + \ self.loq_dictionary[18] + r"""\\ \hline Cannabidiol (CBD) &""" + data[5][0] + r""" & """ + data[5][1] + r""" & ND & """ + recov_data[5] + r"""& """ + \ self.loq_dictionary[5] + r"""\\ Cannabidiol Acid & """ + data[7][0] + r""" & """ + data[7][1] + r""" & ND & """ + recov_data[7] + r"""& """ + \ self.loq_dictionary[7] + r"""\\ \hline \hline \textbf{Total CBD**} & \textbf{""" + cbd_total[0] + r"""} & \textbf{""" + cbd_total[1] + r"""} & & &\\ \hline \hline Cannabigerol (CBG) & """ + data[6][0] + r""" & """ + data[6][1] + r""" & ND & """ + recov_data[6] + r"""& """ + \ self.loq_dictionary[6] + r"""\\ Cannabigerol Acid & """ + data[9][0] + r""" & """ + data[9][1] + r""" & ND & """ + recov_data[9] + r"""& """ + \ self.loq_dictionary[9] + r"""\\ \hline Cannabicyclol (CBL) & """ + data[13][0] + r""" & """ + data[13][1] + r""" & ND & """ + recov_data[ 13] + r"""& """ + self.loq_dictionary[13] + r"""\\ Cannabicyclol Acid & """ + data[17][0] + r""" & """ + data[17][1] + r""" & ND & """ + recov_data[17] + r"""& """ + \ self.loq_dictionary[17] + r"""\\ \hline Cannabidivarin (CBDV) & """ + data[1][0] + r""" & """ + data[1][1] + r""" & ND & """ + recov_data[1] + r"""& """ + \ self.loq_dictionary[1] + r"""\\ Cannabidivarin Acid & """ + data[2][0] + r""" & """ + data[2][1] + r""" & ND & """ + recov_data[2] + r"""& """ + \ self.loq_dictionary[2] + r"""\\ \hline $\Delta^{9}$ THCV & """ + data[3][0] + r""" & """ + data[3][1] + r""" & ND & """ + recov_data[3] + r"""& """ + \ self.loq_dictionary[3] + r"""\\ $\Delta^{9}$ THCV Acid & """ + data[10][0] + r""" & """ + data[10][1] + r""" & ND & """ + recov_data[ 10] + r"""& """ + self.loq_dictionary[10] + r"""\\ \hline Cannabinol (CBN) & """ + data[8][0] + r""" & """ + data[8][1] + r""" & ND & """ + recov_data[8] + r"""& """ + \ self.loq_dictionary[8] + r"""\\ Cannabinol Acid & """ + data[15][0] + r""" & """ + data[15][1] + r""" & ND & """ + recov_data[15] + r"""& """ + \ self.loq_dictionary[15] + r""" \\ \hline Cannabigerivarin Acid & ND & ND & N/A & N/A \\ \hline \hline \textbf{Moisture} & 0.00 & & & \\ \hline \hline \end{tabular} \end{table} """ return deluxe_potency_table_string def create_single_basic_table(self, data, sample_type): thc_total = self.create_total_line('regular', 'basic', 'THC', data) cbd_total = self.create_total_line('regular', 'basic', 'CBD', data) recov_data = self.get_standard_recovery_values('Basic') if sample_type == 'Percent': sample_type = r'\%' elif sample_type == 'mg_g': sample_type = 'mg/g' elif sample_type == 'mg_ml': sample_type = 'mg/mL' else: sample_type = r'\%' basic_potency_table_string = r""" \newline \renewcommand{\arraystretch}{1.2} \begin{table}[h!]\centering \begin{tabular}{p{\dimexpr0.270\textwidth-2\tabcolsep-\arrayrulewidth\relax}| p{\dimexpr0.490\textwidth-2\tabcolsep-\arrayrulewidth\relax}| p{\dimexpr0.07\textwidth-2\tabcolsep-\arrayrulewidth\relax} p{\dimexpr0.1\textwidth-2\tabcolsep-\arrayrulewidth\relax} p{\dimexpr0.07\textwidth-2\tabcolsep-\arrayrulewidth\relax} } \textbf{Cannabinoids} & \textbf{Sample 1} & \textbf{\small Blank} & \textbf{\small Recovery} & $\mathbf{\small S_{0}}$\\ & (""" + sample_type + r""") & (\%) & (\%) & (\%) \\ \hline \hline $\Delta^{9}$-THC & """ + data[5] + r""" & ND & """ + recov_data[5] + r"""& """ + self.loq_dictionary[5] + r"""\\ $\Delta^{9}$-THC Acid & """ + data[6] + r""" & ND & """ + recov_data[6] + r"""& """ + self.loq_dictionary[6] + r"""\\ \hline \hline \textbf{Total THC*} & \textbf{""" + thc_total + r"""} & & &\\ \hline \hline $\Delta^{8}$-THC & """ + data[7] + r""" & ND & """ + recov_data[7] + r"""& """ + self.loq_dictionary[7] + r"""\\ $\Delta^{8}$THC Acid & ND & ND & N/A & N/A \\ \hline Cannabidiol (CBD) &""" + data[1] + r""" & ND & """ + recov_data[1] + r"""& """ + self.loq_dictionary[1] + r"""\\ Cannabidiol Acid &""" + data[2] + r""" & ND & """ + recov_data[2] + r"""& """ + self.loq_dictionary[2] + r"""\\ \hline \hline \textbf{Total CBD**} & \textbf{""" + cbd_total + r"""} & & &\\ \hline \hline Cannabinol (CBN) & """ + data[3] + r""" & ND & """ + recov_data[3] + r"""& """ + self.loq_dictionary[3] + r"""\\ Cannabinol Acid & """ + data[4] + r""" & ND & """ + recov_data[4] + r"""& """ + self.loq_dictionary[4] + r"""\\ \hline \hline \textbf{Moisture} & 0.00 & & &\\ \hline \hline \end{tabular} \end{table} """ return basic_potency_table_string def create_single_basic_table_unit(self, data, unit_type): thc_total = self.create_total_line('unit', 'basic', 'THC', data) cbd_total = self.create_total_line('unit', 'basic', 'CBD', data) recov_data = self.get_standard_recovery_values('Basic') if unit_type == 'unit': sample_type_1 = 'mg/g' sample_type_2 = 'mg/unit' elif unit_type == 'density': sample_type_1 = 'mg/mL' sample_type_2 = r'\%' else: sample_type_1 = r'\%' sample_type_2 = r'\%' basic_potency_table_string = r""" \newline \renewcommand{\arraystretch}{1.2} \begin{table}[h!]\centering \begin{tabular}{p{\dimexpr0.270\textwidth-2\tabcolsep-\arrayrulewidth\relax}| p{\dimexpr0.245\textwidth-2\tabcolsep-\arrayrulewidth\relax}| p{\dimexpr0.245\textwidth-2\tabcolsep-\arrayrulewidth\relax}| p{\dimexpr0.07\textwidth-2\tabcolsep-\arrayrulewidth\relax} p{\dimexpr0.1\textwidth-2\tabcolsep-\arrayrulewidth\relax} p{\dimexpr0.07\textwidth-2\tabcolsep-\arrayrulewidth\relax} } \textbf{Cannabinoids} & \textbf{Sample 1} & \textbf{Sample 1} & \textbf{\small Blank} & \textbf{\small Recovery} & $\mathbf{\small S_{0}}$ \\ & (""" + sample_type_1 + r""") & (""" + sample_type_2 + r""") & (\%) & (\%) & (\%) \\ \hline \hline $\Delta^{9}$ THC & """ + data[5][0] + r""" & """ + data[5][1] + r""" & ND & """ + recov_data[5] + r"""& """ + \ self.loq_dictionary[5] + r"""\\ $\Delta^{9}$ THC Acid & """ + data[6][0] + r""" & """ + data[6][1] + r""" & ND & """ + recov_data[ 6] + r"""& """ + self.loq_dictionary[6] + r"""\\ \hline \hline \textbf{Total THC*} & \textbf{""" + thc_total[0] + r"""} & \textbf{""" + thc_total[1] + r"""} & & &\\ \hline \hline $\Delta^{8}$ THC & """ + data[7][0] + r""" & """ + data[7][1] + r""" & ND & """ + recov_data[7] + r"""& """ + \ self.loq_dictionary[7] + r"""\\ $\Delta^{8}$THC Acid & ND & ND & ND & N/A & N/A \\ \hline Cannabidiol (CBD) &""" + data[1][0] + r""" & """ + data[1][1] + r""" & ND & """ + recov_data[1] + r"""& """ + \ self.loq_dictionary[1] + r"""\\ Cannabidiol Acid &""" + data[2][0] + r""" & """ + data[2][1] + r""" & ND & """ + recov_data[2] + r"""& """ + \ self.loq_dictionary[2] + r"""\\ \hline \hline \textbf{Total CBD**} & \textbf{""" + cbd_total[0] + r"""} & \textbf{""" + cbd_total[1] + r"""} & & &\\ \hline \hline Cannabinol (CBN) & """ + data[3][0] + r""" & """ + data[3][1] + r""" & ND & """ + recov_data[3] + r"""& """ + \ self.loq_dictionary[3] + r"""\\ Cannabinol Acid & """ + data[4][0] + r""" & """ + data[4][1] + r""" & ND & """ + recov_data[4] + r"""& """ + \ self.loq_dictionary[4] + r"""\\ \hline \hline \textbf{Moisture} & 0.00 & & &\\ \hline \hline \end{tabular} \end{table} """ return basic_potency_table_string def generate_footer(self): footer_string = r""" Methods: solvent extraction; measured by UPLC-UV, tandem MS, P.I. 1.14 \& based on USP monograph 29 \newline $\si{S_{o}}$ = standard deviation at zero analyte concentration. MDL generally considered to be 3x $\si{S_{o}}$ value. \newline\newline ND = none detected. N/A = not applicable. THC = tetrahydrocannabinol.\newline \textbf{*Total THC} = $\Delta^{9}$-THC + (THCA x 0.877 ). \textbf{**Total CBD} = CBD + (CBDA x 0.877).\newline\newline Material will be held for up to 3 weeks unless alternative arrangements have been made. Sample holding time may vary and is dependent on MBL license restrictions. \newline\newline\newline R. Bilodeau \phantom{aaaaaaaaaaaaaaaaaaaaaaaaaxaaaaaasasssssssssssss}H. Hartmann\\ Analytical Chemist: \underline{\hspace{3cm}}{ \hspace{3.2cm} Sr. Analytical Chemist: \underline{\hspace{3cm}} \fancyfoot[C]{\textbf{MB Laboratories Ltd.}\\ \textbf{Web:} www.mblabs.com} \fancyfoot[R]{\textbf{Mail:} PO Box 2103\\ Sidney, B.C., V8L 356} \fancyfoot[L]{\textbf{T:} 250 656 1334\\ \textbf{E:} [email protected]} \end{document} """ return footer_string def round_down_to_correct_decimal_point(self, data_value): if 100 > data_value >= 1: data_value = str(data_value)[0:4] elif 1 > data_value > 0: data_value = str(data_value)[0:5] elif data_value >= 100: data_value = str(data_value)[0:3] else: data_value = 'ND' return data_value def create_total_line(self, total_line_type, report_type, cannabinoid, data): if total_line_type == "unit": if cannabinoid == 'THC': if report_type == 'basic': delta9 = data[5][0] acid = data[6][0] delta9_unit = data[5][1] acid_unit = data[6][1] else: delta9 = data[11][0] acid = data[16][0] delta9_unit = data[11][1] acid_unit = data[16][1] if delta9 == 'ND': delta9 = 0 if acid == 'ND': acid = 0 if delta9_unit == 'ND': delta9_unit = 0 if acid_unit == 'ND': acid_unit = 0 total1 = float(delta9) + (float(acid) * 0.877) total2 = float(delta9_unit) + (float(acid_unit) * 0.877) if 100 > total1 >= 1: total1 = str(total1)[0:4] elif 1 > total1 > 0: total1 = str(total1)[0:5] elif total1 >= 100: total1 = str(total1)[0:3] else: total1 = 'ND' if 100 > total2 >= 1: total2 = str(total2)[0:4] elif 1 > total2 > 0: total2 = str(total2)[0:5] elif total2 >= 100: total2 = str(total2)[0:3] else: total2 = 'ND' return [total1, total2] else: if report_type == 'basic': cbd = data[1][0] acid = data[2][0] cbd_unit = data[1][1] acid_unit = data[2][1] else: cbd = data[5][0] acid = data[7][0] cbd_unit = data[5][1] acid_unit = data[7][1] if cbd == 'ND': cbd = 0 if acid == 'ND': acid = 0 if cbd_unit == 'ND': cbd_unit = 0 if acid_unit == 'ND': acid_unit = 0 total1 = float(cbd) + (float(acid) * 0.877) total2 = float(cbd_unit) + (float(acid_unit) * 0.877) if 100 > total1 >= 1: total1 = str(total1)[0:4] elif 1 > total1 > 0: total1 = str(total1)[0:5] elif total1 >= 100: total1 = str(total1)[0:3] else: total1 = 'ND' if 100 > total2 >= 1: total2 = str(total2)[0:4] elif 1 > total2 > 0: total2 = str(total2)[0:5] elif total2 >= 100: total2 = str(total2)[0:3] else: total2 = 'ND' return [total1, total2] elif total_line_type == "regular": if cannabinoid == 'THC': if report_type == 'basic': delta9 = data[5] acid = data[6] else: delta9 = data[11] acid = data[16] if delta9 == 'ND': delta9 = 0 if acid == 'ND': acid = 0 total = float(delta9) + (float(acid) * 0.877) if 100 > total >= 1: total = str(total)[0:4] elif 1 > total > 0: total = str(total)[0:5] elif total >= 100: total = str(total)[0:3] else: total = 'ND' return total else: if report_type == "basic": cbd = data[1] acid = data[2] else: cbd = data[5] acid = data[7] if cbd == 'ND': cbd = 0 if acid == 'ND': acid = 0 total = float(cbd) + (float(acid) * 0.877) if 100 > total >= 1: total = str(total)[0:4] elif 1 > total > 0: total = str(total)[0:5] elif total >= 100: total = str(total)[0:3] else: total = 'ND' return total
#!/usr/local/bin/python3 class Object(object): def __init__(self, id): self.id = id self.children = [] root = Object("COM") objects = {"COM": root} def get_object(id): if id not in objects: objects[id] = Object(id) return objects[id] with open("input.txt") as f: for line in f.readlines(): parent, child = map(get_object, line.strip().split(")")) parent.children.append(child) checksum = 0 def traverse(node, distance): global checksum checksum += distance for child in node.children: traverse(child, distance + 1) traverse(root, 0) print("checksum: %d" % checksum)
begin_unit comment|'# Copyright (c) 2013 Intel, Inc.' nl|'\n' comment|'# Copyright (c) 2012 OpenStack Foundation' nl|'\n' comment|'# All Rights Reserved.' nl|'\n' comment|'#' nl|'\n' comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl|'\n' comment|'# not use this file except in compliance with the License. You may obtain' nl|'\n' comment|'# a copy of the License at' nl|'\n' comment|'#' nl|'\n' comment|'# http://www.apache.org/licenses/LICENSE-2.0' nl|'\n' comment|'#' nl|'\n' comment|'# Unless required by applicable law or agreed to in writing, software' nl|'\n' comment|'# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT' nl|'\n' comment|'# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the' nl|'\n' comment|'# License for the specific language governing permissions and limitations' nl|'\n' comment|'# under the License.' nl|'\n' nl|'\n' nl|'\n' name|'import' name|'glob' newline|'\n' name|'import' name|'os' newline|'\n' name|'import' name|'re' newline|'\n' nl|'\n' name|'from' name|'oslo_log' name|'import' name|'log' name|'as' name|'logging' newline|'\n' name|'import' name|'six' newline|'\n' nl|'\n' name|'from' name|'nova' name|'import' name|'exception' newline|'\n' name|'from' name|'nova' op|'.' name|'i18n' name|'import' name|'_LW' newline|'\n' nl|'\n' DECL|variable|LOG name|'LOG' op|'=' name|'logging' op|'.' name|'getLogger' op|'(' name|'__name__' op|')' newline|'\n' nl|'\n' DECL|variable|PCI_VENDOR_PATTERN name|'PCI_VENDOR_PATTERN' op|'=' string|'"^(hex{4})$"' op|'.' name|'replace' op|'(' string|'"hex"' op|',' string|'"[\\da-fA-F]"' op|')' newline|'\n' DECL|variable|_PCI_ADDRESS_PATTERN name|'_PCI_ADDRESS_PATTERN' op|'=' op|'(' string|'"^(hex{4}):(hex{2}):(hex{2}).(oct{1})$"' op|'.' nl|'\n' name|'replace' op|'(' string|'"hex"' op|',' string|'"[\\da-fA-F]"' op|')' op|'.' nl|'\n' name|'replace' op|'(' string|'"oct"' op|',' string|'"[0-7]"' op|')' op|')' newline|'\n' DECL|variable|_PCI_ADDRESS_REGEX name|'_PCI_ADDRESS_REGEX' op|'=' name|'re' op|'.' name|'compile' op|'(' name|'_PCI_ADDRESS_PATTERN' op|')' newline|'\n' nl|'\n' DECL|variable|_SRIOV_TOTALVFS name|'_SRIOV_TOTALVFS' op|'=' string|'"sriov_totalvfs"' newline|'\n' nl|'\n' nl|'\n' DECL|function|pci_device_prop_match name|'def' name|'pci_device_prop_match' op|'(' name|'pci_dev' op|',' name|'specs' op|')' op|':' newline|'\n' indent|' ' string|'"""Check if the pci_dev meet spec requirement\n\n Specs is a list of PCI device property requirements.\n An example of device requirement that the PCI should be either:\n a) Device with vendor_id as 0x8086 and product_id as 0x8259, or\n b) Device with vendor_id as 0x10de and product_id as 0x10d8:\n\n [{"vendor_id":"8086", "product_id":"8259"},\n {"vendor_id":"10de", "product_id":"10d8"}]\n\n """' newline|'\n' DECL|function|_matching_devices name|'def' name|'_matching_devices' op|'(' name|'spec' op|')' op|':' newline|'\n' indent|' ' name|'return' name|'all' op|'(' name|'pci_dev' op|'.' name|'get' op|'(' name|'k' op|')' op|'==' name|'v' name|'for' name|'k' op|',' name|'v' name|'in' name|'six' op|'.' name|'iteritems' op|'(' name|'spec' op|')' op|')' newline|'\n' nl|'\n' dedent|'' name|'return' name|'any' op|'(' name|'_matching_devices' op|'(' name|'spec' op|')' name|'for' name|'spec' name|'in' name|'specs' op|')' newline|'\n' nl|'\n' nl|'\n' DECL|function|parse_address dedent|'' name|'def' name|'parse_address' op|'(' name|'address' op|')' op|':' newline|'\n' indent|' ' string|'"""Returns (domain, bus, slot, function) from PCI address that is stored in\n PciDevice DB table.\n """' newline|'\n' name|'m' op|'=' name|'_PCI_ADDRESS_REGEX' op|'.' name|'match' op|'(' name|'address' op|')' newline|'\n' name|'if' name|'not' name|'m' op|':' newline|'\n' indent|' ' name|'raise' name|'exception' op|'.' name|'PciDeviceWrongAddressFormat' op|'(' name|'address' op|'=' name|'address' op|')' newline|'\n' dedent|'' name|'return' name|'m' op|'.' name|'groups' op|'(' op|')' newline|'\n' nl|'\n' nl|'\n' DECL|function|get_pci_address_fields dedent|'' name|'def' name|'get_pci_address_fields' op|'(' name|'pci_addr' op|')' op|':' newline|'\n' indent|' ' name|'dbs' op|',' name|'sep' op|',' name|'func' op|'=' name|'pci_addr' op|'.' name|'partition' op|'(' string|"'.'" op|')' newline|'\n' name|'domain' op|',' name|'bus' op|',' name|'slot' op|'=' name|'dbs' op|'.' name|'split' op|'(' string|"':'" op|')' newline|'\n' name|'return' op|'(' name|'domain' op|',' name|'bus' op|',' name|'slot' op|',' name|'func' op|')' newline|'\n' nl|'\n' nl|'\n' DECL|function|get_pci_address dedent|'' name|'def' name|'get_pci_address' op|'(' name|'domain' op|',' name|'bus' op|',' name|'slot' op|',' name|'func' op|')' op|':' newline|'\n' indent|' ' name|'return' string|"'%s:%s:%s.%s'" op|'%' op|'(' name|'domain' op|',' name|'bus' op|',' name|'slot' op|',' name|'func' op|')' newline|'\n' nl|'\n' nl|'\n' DECL|function|get_function_by_ifname dedent|'' name|'def' name|'get_function_by_ifname' op|'(' name|'ifname' op|')' op|':' newline|'\n' indent|' ' string|'"""Given the device name, returns the PCI address of a device\n and returns True if the address in a physical function.\n """' newline|'\n' name|'dev_path' op|'=' string|'"/sys/class/net/%s/device"' op|'%' name|'ifname' newline|'\n' name|'sriov_totalvfs' op|'=' number|'0' newline|'\n' name|'if' name|'os' op|'.' name|'path' op|'.' name|'isdir' op|'(' name|'dev_path' op|')' op|':' newline|'\n' indent|' ' name|'try' op|':' newline|'\n' comment|'# sriov_totalvfs contains the maximum possible VFs for this PF' nl|'\n' indent|' ' name|'with' name|'open' op|'(' name|'dev_path' op|'+' name|'_SRIOV_TOTALVFS' op|')' name|'as' name|'fd' op|':' newline|'\n' indent|' ' name|'sriov_totalvfs' op|'=' name|'int' op|'(' name|'fd' op|'.' name|'read' op|'(' op|')' op|')' newline|'\n' name|'return' op|'(' name|'os' op|'.' name|'readlink' op|'(' name|'dev_path' op|')' op|'.' name|'strip' op|'(' string|'"./"' op|')' op|',' nl|'\n' name|'sriov_totalvfs' op|'>' number|'0' op|')' newline|'\n' dedent|'' dedent|'' name|'except' op|'(' name|'IOError' op|',' name|'ValueError' op|')' op|':' newline|'\n' indent|' ' name|'return' name|'os' op|'.' name|'readlink' op|'(' name|'dev_path' op|')' op|'.' name|'strip' op|'(' string|'"./"' op|')' op|',' name|'False' newline|'\n' dedent|'' dedent|'' name|'return' name|'None' op|',' name|'False' newline|'\n' nl|'\n' nl|'\n' DECL|function|is_physical_function dedent|'' name|'def' name|'is_physical_function' op|'(' name|'domain' op|',' name|'bus' op|',' name|'slot' op|',' name|'function' op|')' op|':' newline|'\n' indent|' ' name|'dev_path' op|'=' string|'"/sys/bus/pci/devices/%(d)s:%(b)s:%(s)s.%(f)s/"' op|'%' op|'{' nl|'\n' string|'"d"' op|':' name|'domain' op|',' string|'"b"' op|':' name|'bus' op|',' string|'"s"' op|':' name|'slot' op|',' string|'"f"' op|':' name|'function' op|'}' newline|'\n' name|'if' name|'os' op|'.' name|'path' op|'.' name|'isdir' op|'(' name|'dev_path' op|')' op|':' newline|'\n' indent|' ' name|'sriov_totalvfs' op|'=' number|'0' newline|'\n' name|'try' op|':' newline|'\n' indent|' ' name|'with' name|'open' op|'(' name|'dev_path' op|'+' name|'_SRIOV_TOTALVFS' op|')' name|'as' name|'fd' op|':' newline|'\n' indent|' ' name|'sriov_totalvfs' op|'=' name|'int' op|'(' name|'fd' op|'.' name|'read' op|'(' op|')' op|')' newline|'\n' name|'return' name|'sriov_totalvfs' op|'>' number|'0' newline|'\n' dedent|'' dedent|'' name|'except' op|'(' name|'IOError' op|',' name|'ValueError' op|')' op|':' newline|'\n' indent|' ' name|'pass' newline|'\n' dedent|'' dedent|'' name|'return' name|'False' newline|'\n' nl|'\n' nl|'\n' DECL|function|_get_sysfs_netdev_path dedent|'' name|'def' name|'_get_sysfs_netdev_path' op|'(' name|'pci_addr' op|',' name|'pf_interface' op|')' op|':' newline|'\n' indent|' ' string|'"""Get the sysfs path based on the PCI address of the device.\n\n Assumes a networking device - will not check for the existence of the path.\n """' newline|'\n' name|'if' name|'pf_interface' op|':' newline|'\n' indent|' ' name|'return' string|'"/sys/bus/pci/devices/%s/physfn/net"' op|'%' op|'(' name|'pci_addr' op|')' newline|'\n' dedent|'' name|'return' string|'"/sys/bus/pci/devices/%s/net"' op|'%' op|'(' name|'pci_addr' op|')' newline|'\n' nl|'\n' nl|'\n' DECL|function|get_ifname_by_pci_address dedent|'' name|'def' name|'get_ifname_by_pci_address' op|'(' name|'pci_addr' op|',' name|'pf_interface' op|'=' name|'False' op|')' op|':' newline|'\n' indent|' ' string|'"""Get the interface name based on a VF\'s pci address\n\n The returned interface name is either the parent PF\'s or that of the VF\n itself based on the argument of pf_interface.\n """' newline|'\n' name|'dev_path' op|'=' name|'_get_sysfs_netdev_path' op|'(' name|'pci_addr' op|',' name|'pf_interface' op|')' newline|'\n' name|'try' op|':' newline|'\n' indent|' ' name|'dev_info' op|'=' name|'os' op|'.' name|'listdir' op|'(' name|'dev_path' op|')' newline|'\n' name|'return' name|'dev_info' op|'.' name|'pop' op|'(' op|')' newline|'\n' dedent|'' name|'except' name|'Exception' op|':' newline|'\n' indent|' ' name|'raise' name|'exception' op|'.' name|'PciDeviceNotFoundById' op|'(' name|'id' op|'=' name|'pci_addr' op|')' newline|'\n' nl|'\n' nl|'\n' DECL|function|get_mac_by_pci_address dedent|'' dedent|'' name|'def' name|'get_mac_by_pci_address' op|'(' name|'pci_addr' op|',' name|'pf_interface' op|'=' name|'False' op|')' op|':' newline|'\n' indent|' ' string|'"""Get the MAC address of the nic based on it\'s PCI address\n\n Raises PciDeviceNotFoundById in case the pci device is not a NIC\n """' newline|'\n' name|'dev_path' op|'=' name|'_get_sysfs_netdev_path' op|'(' name|'pci_addr' op|',' name|'pf_interface' op|')' newline|'\n' name|'if_name' op|'=' name|'get_ifname_by_pci_address' op|'(' name|'pci_addr' op|',' name|'pf_interface' op|')' newline|'\n' name|'addr_file' op|'=' name|'os' op|'.' name|'path' op|'.' name|'join' op|'(' name|'dev_path' op|',' name|'if_name' op|',' string|"'address'" op|')' newline|'\n' nl|'\n' name|'try' op|':' newline|'\n' indent|' ' name|'with' name|'open' op|'(' name|'addr_file' op|')' name|'as' name|'f' op|':' newline|'\n' indent|' ' name|'mac' op|'=' name|'next' op|'(' name|'f' op|')' op|'.' name|'strip' op|'(' op|')' newline|'\n' name|'return' name|'mac' newline|'\n' dedent|'' dedent|'' name|'except' op|'(' name|'IOError' op|',' name|'StopIteration' op|')' name|'as' name|'e' op|':' newline|'\n' indent|' ' name|'LOG' op|'.' name|'warning' op|'(' name|'_LW' op|'(' string|'"Could not find the expected sysfs file for "' nl|'\n' string|'"determining the MAC address of the PCI device "' nl|'\n' string|'"%(addr)s. May not be a NIC. Error: %(e)s"' op|')' op|',' nl|'\n' op|'{' string|"'addr'" op|':' name|'pci_addr' op|',' string|"'e'" op|':' name|'e' op|'}' op|')' newline|'\n' name|'raise' name|'exception' op|'.' name|'PciDeviceNotFoundById' op|'(' name|'id' op|'=' name|'pci_addr' op|')' newline|'\n' nl|'\n' nl|'\n' DECL|function|get_vf_num_by_pci_address dedent|'' dedent|'' name|'def' name|'get_vf_num_by_pci_address' op|'(' name|'pci_addr' op|')' op|':' newline|'\n' indent|' ' string|'"""Get the VF number based on a VF\'s pci address\n\n A VF is associated with an VF number, which ip link command uses to\n configure it. This number can be obtained from the PCI device filesystem.\n """' newline|'\n' name|'VIRTFN_RE' op|'=' name|'re' op|'.' name|'compile' op|'(' string|'"virtfn(\\d+)"' op|')' newline|'\n' name|'virtfns_path' op|'=' string|'"/sys/bus/pci/devices/%s/physfn/virtfn*"' op|'%' op|'(' name|'pci_addr' op|')' newline|'\n' name|'vf_num' op|'=' name|'None' newline|'\n' name|'try' op|':' newline|'\n' indent|' ' name|'for' name|'vf_path' name|'in' name|'glob' op|'.' name|'iglob' op|'(' name|'virtfns_path' op|')' op|':' newline|'\n' indent|' ' name|'if' name|'re' op|'.' name|'search' op|'(' name|'pci_addr' op|',' name|'os' op|'.' name|'readlink' op|'(' name|'vf_path' op|')' op|')' op|':' newline|'\n' indent|' ' name|'t' op|'=' name|'VIRTFN_RE' op|'.' name|'search' op|'(' name|'vf_path' op|')' newline|'\n' name|'vf_num' op|'=' name|'t' op|'.' name|'group' op|'(' number|'1' op|')' newline|'\n' name|'break' newline|'\n' dedent|'' dedent|'' dedent|'' name|'except' name|'Exception' op|':' newline|'\n' indent|' ' name|'pass' newline|'\n' dedent|'' name|'if' name|'vf_num' name|'is' name|'None' op|':' newline|'\n' indent|' ' name|'raise' name|'exception' op|'.' name|'PciDeviceNotFoundById' op|'(' name|'id' op|'=' name|'pci_addr' op|')' newline|'\n' dedent|'' name|'return' name|'vf_num' newline|'\n' dedent|'' endmarker|'' end_unit
#!/usr/bin/env python """ https://leetcode.com/problems/plus-one/description/ Created on 2018-11-14 @author: '[email protected]' Reference: """ class Solution: def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ l = len(digits) - 1 while l >= 0 and digits[l] == 9: digits[l] = 0 l -= 1 if l < 0: digits.insert(0, 1) else: digits[l] += 1 return digits def test(): assert Solution().plusOne([0]) == [1] assert Solution().plusOne([1, 2, 3, 4]) == [1, 2, 3, 5] assert Solution().plusOne([1, 2, 3, 9]) == [1, 2, 4, 0] assert Solution().plusOne([9, 9, 9]) == [1, 0, 0, 0]
key = {'f':'l', 'd': 'l','j':'r', 'k':'r'} words = {} for _ in range(int(input())): n = int(input()) for _ in range(n): s = input() if words.get(s): words[s] += 1 else : words[s] = 1 # print(words) final_ans = 0 for i in words: c_word_ans = 0.2 pre = key[i[0]] for j in i[1::]: if(key[j] == pre):c_word_ans += 0.4 else: c_word_ans += 0.2 pre = key[j] final_ans += c_word_ans + ((words[i] - 1) * c_word_ans / 2) print(int(final_ans * 10))
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. class PotentialEdgeColumnPair: def __init__(self, source, destination, score): self._source = source self._destination = destination self._score = score def source(self): return self._source def destination(self): return self._destination def score(self): return self._score
class ModelOutput: # Class that defines model output structure def __init__(self, arg_type, arg_size, is_spacial): self.arg_type = arg_type self.arg_size = arg_size self.is_spacial = is_spacial
class DateGetter: '''Parse a date using the datetime format string defined in the current jxn's config. ''' def _get_date(self, label_text): fmt = self.get_config_value('datetime_format') text = self.get_field_text(label_text) if text is not None: dt = datetime.strptime(text, fmt) dt = self.cfg.datetime_add_tz(dt) return dt class BillsFields(FieldAggregator, DateGetter): text_fields = ( 'law_number', 'type', 'status', 'name', 'version', 'sponsor_office') def get_intro_data(self): return self._get_date('intro_date') def get_file_created(self): return self._get_date('file_created') def gen_sources(self): grouped = collections.defaultdict(set) for note, url in self.chainmap['sources'].items(): grouped[url].add(note) for url, notes in grouped.items(): yield dict(url=url, note=', '.join(sorted(notes))) class BillsSearchForm(FirefoxForm): '''Model the legistar "Legislation" search form. ''' sources_note = 'bill search table' def is_advanced_search(self): switch_el_id = self.cfg.BILL_SEARCH_SWITCH_EL_ID switch_el = self.firefox.find_element_by_id(switch_el_id) switch_el_text = switch_el.text.lower() if self.cfg.BILL_SEARCH_SWITCH_SIMPLE in switch_el_text: return True return False def switch_to_advanced_search(self): switch_el_id = self.cfg.BILL_SEARCH_SWITCH_EL_ID switch_el = self.firefox.find_element_by_id(switch_el_id) switch_el.click() def fill_out_form(self): if not self.is_advanced_search(): self.switch_to_advanced_search() max_results_id = "ctl00_ContentPlaceHolder1_lstMax" self.set_dropdown(max_results_id, 'All') years_id = "ctl00_ContentPlaceHolder1_lstYearsAdvanced" self.set_dropdown(years_id, 'This Year') class BillsDetailView(DetailView, BillsFields): sources_note = 'bill detail' text_fields = ('version', 'name') def get_file_number(self): return self.get_field_text('file_number') def get_title(self): title = self.get_field_text('title') # If no title, re-use type (i.e., "Resolution") if not title: title = self.get_field_text('type') return title def get_agenda_date(self): return self._get_date('agenda') def get_enactment_date(self): return self._get_date('enactment_date') def get_final_action(self): return self._get_date('final_action') def gen_sponsors(self): sponsors = self.get_field_text('sponsors') for name in re.split(r',\s+', sponsors): name = name.strip() if name: yield dict(name=name) def gen_documents(self): for el in self.xpath('attachments', './/a'): data = ElementAccessor(el) url = data.get_url() media_type = 'application/pdf' yield dict( name=data.get_text(), links=[dict( url=data.get_url(), media_type=media_type)]) def gen_action(self): yield from self.Form(self) def gen_identifiers(self): '''Yield out the internal legistar bill id and guid found in the detail page url. ''' detail_url = self.chainmap['sources'][self.sources_note] url = urlparse(detail_url) for idtype, ident in parse_qsl(url.query): if idtype == 'options' or ident == 'Advanced': continue yield dict( scheme="legistar_" + idtype.lower(), identifier=ident) def get_legislative_session(self): dates = [] labels = ('agenda', 'created') for label in labels: labeltext = self.get_label_text(label, skipitem=False) if labeltext not in self.field_data.keys(): continue if not self.field_data[labeltext]: continue data = self.field_data[labeltext][0] fmt = self.get_config_value('datetime_format') text = data.get_text() if text is not None: dt = datetime.strptime(text, fmt) dt = self.cfg.datetime_add_tz(dt) dates.append(dt) _, actions = self.gen_action() for action in actions: dates.append(action['date']) if dates: return str(max(dates).year) self.critical('Need session date.') class BillsDetailTableRow(TableRow, FieldAggregator, DateGetter): sources_node = 'bill action table' disable_aggregator_funcs = True text_fields = ( ('action_by', 'organization'), ('action', 'text'), 'version', 'result', 'journal_page', ) def get_detail_viewtype(self): return BillsDetailAction def get_detail_url(self): return self.get_media_url('action_details') def get_date(self): return self._get_date('date') def _get_media(self, label): '''Given a field label, get it's url (if any) and send a head request to determine the content_type. Return a dict. ''' data = self.get_field_data(label) url = data.get_url() if url is None: raise self.SkipItem() self.info('Sending HEAD request for %r' % url) media_type = 'application/pdf' return dict( name=data.get_text(), links=[dict( url=data.get_url(), media_type=media_type)]) @make_item('media', wrapwith=list) def gen_media(self): for label in self.get_config_value('pupa_media'): try: yield self._get_media(label) except self.SkipItem: continue class BillsDetailAction(DetailView, ActionBase): sources_note = 'bill action detail' text_fields = ( 'file_number', 'type', 'title', 'mover', 'seconder', 'result', 'agenda_note', 'minutes_note', 'action', 'action_text') @make_item('votes', wrapwith=list) def gen_votes(self): table_path = self.get_config_value('table_class') Table = resolve_name(table_path) yield from self.make_child(Table, self) @make_item('sources', wrapwith=list) def gen_sources(self): yield dict(url=self.url, note='action detail') class BillsDetailActionTable(Table, ActionBase): sources_note = 'bill action detail table' def get_table_cell_type(self): path = self.get_config_value('tablecell_class') return resolve_name(path) def get_table_row_type(self): path = self.get_config_value('tablerow_class') return resolve_name(path) class BillsDetailActionTableRow(TableRow, ActionBase): sources_node = 'bill action detail table' text_fields = ('person', 'vote') def _get_date(date): if isinstance(date, datetime.datetime): return date.strftime('%Y-%m-%d') else: return date class ActionAdapter(Adapter): aliases = [('text', 'description')] extras_keys = ['version', 'media', 'result'] drop_keys = ['sources', 'journal_page'] #make_item('date') def get_date(self): return _get_date(self.data['date']) class VoteAdapter(Adapter): pupa_model = pupa.scrape.Vote text_fields = ['organization'] aliases = [ ('text', 'motion_text'), ] drop_keys = ['date'] extras_keys = ['version', 'media', 'journal_page'] #make_item('identifier') def get_identifier(self): '''The internal legistar bill id and guid found in the detail page url. ''' i = self.data.pop('i') for source in self.data['sources']: if not 'historydetail' in source['url'].lower(): continue url = urlparse(source['url']) ids = {} for idtype, ident in parse_qsl(url.query): if idtype == 'options': continue ids[idtype.lower()] = ident return ids['guid'] # The vote has no "action details" page, thus no identifier. # Fudge one based on the bill's guid. for source in self.bill_adapter.data['identifiers']: if source['scheme'] != 'legistar_guid': continue return '%s-vote%d' % (source['identifier'], i) #make_item('start_date') def get_date(self): return _get_date(self.data.get('date')) #make_item('result') def get_result(self): if not self.data['result']: raise self.SkipItem() result = self.get_vote_result(self.data['result']) return result #make_item('votes', wrapwith=list) def gen_votes(self): for data in self.data['votes']: if not data: continue res = {} res['option'] = self.get_vote_option(data['vote']) res['note'] = data['vote'] res['voter'] = data['person'] yield res def get_instance(self, **extra_instance_data): data = self.get_instance_data() data.update(extra_instance_data) motion_text = data['motion_text'] data['classification'] = self.classify_motion_text(motion_text) # Drop the org if necessary. When org is the top-level org, omit. if self.should_drop_organization(data): data.pop('organization', None) vote_data_list = data.pop('votes') extras = data.pop('extras') sources = data.pop('sources') data.pop('i', None) vote = self.pupa_model(**data) counts = collections.Counter() for vote_data in vote_data_list: counts[vote_data['option']] += 1 vote.vote(**vote_data) for option, value in counts.items(): vote.set_count(option, value) for source in sources: vote.add_source(**source) vote.extras.update(extras) # Skip no-result "votes" # https://sfgov.legistar.com/LegislationDetail.aspx?ID=1866659&GUID=A23A12AB-C833-4235-81A1-02AD7B8E7CF0&Options=Advanced&Search if vote.result is None: return return vote # ------------------------------------------------------------------------ # Overridables # ------------------------------------------------------------------------ def get_vote_result(self, result): '''Noramalizes the vote result value using the default values on Config base, possibly overridded by jxn.BILL_VOTE_RESULT_MAP. ''' result = result.replace('-', ' ').lower() result = self.cfg._BILL_VOTE_RESULT_MAP[result] return result def get_vote_option(self, option_text): '''Noramalizes the vote option value using the default values on Config base, possibly overridded by jxn.BILL_VOTE_OPTION_MAP. ''' option_text = option_text.replace('-', ' ').lower() return self.cfg._BILL_VOTE_OPTION_MAP[option_text] def should_drop_organization(self, data): '''If this function returns True, the org is dropped from the vote obj. XXX: Right now, always drops the org. ''' return True def classify_motion_text(self, motion_text): '''Jurisdiction configs can override this to determine how vote motions will be classified. ''' return [] class BillsAdapter(Adapter): pupa_model = pupa.scrape.Bill aliases = [ ('file_number', 'identifier'), ] extras_keys = [ 'law_number', 'status'] #make_item('classification') def get_classn(self): return self.get_bill_classification(self.data.pop('type')) #make_item('actions', wrapwith=list) def gen_actions(self): for data in self.data.get('actions'): data = dict(data) data.pop('votes') action = self.make_child(ActionAdapter, data).get_instance_data() if action['description'] is None: action['description'] = '' yield action #make_item('sponsorships') def get_sponsorships(self): return self.data.get('sponsors', []) #make_item('votes', wrapwith=list) def gen_votes(self): for i, data in enumerate(self.data.get('actions')): data['i'] = i converter = self.make_child(VoteAdapter, data) converter.bill_adapter = self more_data = dict( legislative_session=self.data['legislative_session']) vote = converter.get_instance(**more_data) if vote is not None and vote.votes: yield vote #make_item('subject') def _gen_subjects(self, wrapwith=list): yield from self.gen_subjects() def get_instance(self): '''Build a pupa instance from the data. ''' data = self.get_instance_data() data_copy = dict(data) # Allow jxns to define what bills get dropped. if self.should_drop_bill(data_copy): return bill = pupa.scrape.Bill( identifier=data['identifier'], legislative_session=data['legislative_session'], classification=data.get('classification', []), title=data['title'], ) for action in data.pop('actions'): action.pop('extras') self.drop_action_organization(action) bill.add_action(**action) for sponsorship in data.pop('sponsorships'): if not self.should_drop_sponsor(sponsorship): kwargs = dict( classification=self.get_sponsor_classification(sponsorship), entity_type=self.get_sponsor_entity_type(sponsorship), primary=self.get_sponsor_primary(sponsorship)) kwargs.update(sponsorship) bill.add_sponsorship(**kwargs) for source in data.pop('sources'): bill.add_source(**source) bill.extras.update(data.pop('extras')) for identifier in data.pop('identifiers'): bill.add_identifier(**identifier) if bill.title is None: bill.title = '' yield bill for vote in data.pop('votes'): vote.set_bill(bill) self.vote_cache[vote.identifier] = vote yield vote @CachedAttr def vote_cache(self): '''So we don't dupe any votes. Maps identifier to vote obj. ''' return {} # ------------------------------------------------------------------------ # Overridables: sponsorships # ------------------------------------------------------------------------ def should_drop_sponsor(self, data): '''If this function retruns True, the sponsor is dropped. ''' return False def get_sponsor_classification(self, data): '''Return the sponsor's pupa classification. Legistar generally doesn't provide any info like this, so we just return "". ''' return 'sponsor' def get_sponsor_entity_type(self, data): '''Return the sponsor's pupa entity type. ''' return 'person' def get_sponsor_primary(self, data): '''Return whether the sponsor is primary. Legistar generally doesn't provide this. ''' return False # ------------------------------------------------------------------------ # Overridables: actions # ------------------------------------------------------------------------ def drop_action_organization(self, data): ''' XXX: This temporarily drops the action['organization'] from all actions. See pupa issue #105 https://github.com/opencivicdata/pupa/issues/105/ When the organization is the top-level org, it doesn't get set on the action. ''' data.pop('organization', None) # ------------------------------------------------------------------------ # Overridables: miscellaneous # ------------------------------------------------------------------------ def get_bill_classification(self, billtype): '''Convert the legistar bill `type` column into a pupa classification array. ''' # Try to get the classn from the subtype. classn = getattr(self, '_BILL_CLASSIFICATIONS', {}) classn = dict(classn).get(billtype) if classn is not None: return [classn] # Bah, no matches--try to guess it. type_lower = billtype.lower() for classn in dict(ocd_common.BILL_CLASSIFICATION_CHOICES): if classn in type_lower: return [classn] # None found; return emtpy array. return []
# Crie um programa que leia vários números inteiros pelo teclado. # o programa só vai parar quando o usuário digitar o valor 999. # no final mostre quantos números foram digitados e a soma entre eles, desconsiderando o flag '''Somar todos os valores digitados, exceto o 999''' n = soma = c = 0 while n != 999: soma += n n = int(input('Digite um número [999 para sair]: ')) c += 1 print(f'Você digitou {c - 1} números e a soma entre els é igual a {soma}') # idêntica a 64
n = int(input()) alph = ["A",'B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','Q','X','Y','Z'] boxes = [] for x in range(n): box = [] length = int(input()) for y in range(length): box.append([]) for i in range(length): box[y].append(".") boxes.append(box) letter = int((length - 1)/2) for i in range(letter+1): for x in range(length-(i*2)): for y in range(length-(i*2)): box[x+i][y+i] = alph[letter-i] c = 0 for box in boxes: c += 1 for x in box: for y in x: print(y, end="") print() if c < len(boxes): print()
PROCESS_CREATE = 0 PROCESS_EDIT = 1 PROCESS_VIEW = 2 PROCESS_DELETE = 3 PROCESS_EDIT_DELETE = 4 # Edit with delete button PROCESS_VIEW_EDIT = 5 # View with edit button PERMISSION_DISABLE = 2 PERMISSION_ON = 1 PERMISSION_OFF = 0 PERMISSION_AUTHENTICATED = 3 PERMISSION_STAFF = 4 PERMISSION_METHOD = 5 class ProcessSetup: def __init__(self, modal_title, django_permission, class_attribute, fallback): self.modal_title = modal_title self.django_permission = django_permission self.class_attribute = class_attribute self.fallback = fallback process_data = { PROCESS_CREATE: ProcessSetup('New', ['add'], 'permission_create', None), PROCESS_EDIT: ProcessSetup('Edit', ['change'], 'permission_edit', PROCESS_VIEW), PROCESS_VIEW: ProcessSetup('View', ['view'], 'permission_view', None), PROCESS_DELETE: ProcessSetup('Delete', ['delete'], 'permission_delete', None), PROCESS_EDIT_DELETE: ProcessSetup('Edit', ['delete', 'change'], 'permission_delete', PROCESS_EDIT), PROCESS_VIEW_EDIT: ProcessSetup('View', ['change'], 'permission_edit', PROCESS_VIEW), } modal_url_type = { 'view': PROCESS_VIEW, 'viewedit': PROCESS_VIEW_EDIT, 'edit': PROCESS_EDIT, 'editdelete': PROCESS_EDIT_DELETE, 'delete': PROCESS_DELETE, }
# Copyright (c) 2020 Greg Dubicki # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # # See the License for the specific language governing permissions and # limitations under the License. # # MIT License # # Copyright (c) 2018 Shane Wang # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # -*- coding: utf-8 -*- class CacheNode(object): def __init__(self, key, value, freq_node, pre, nxt): self.key = key self.value = value self.freq_node = freq_node self.pre = pre # previous CacheNode self.nxt = nxt # next CacheNode def free_myself(self): if self.freq_node.cache_head == self.freq_node.cache_tail: self.freq_node.cache_head = self.freq_node.cache_tail = None elif self.freq_node.cache_head == self: self.nxt.pre = None self.freq_node.cache_head = self.nxt elif self.freq_node.cache_tail == self: self.pre.nxt = None self.freq_node.cache_tail = self.pre else: self.pre.nxt = self.nxt self.nxt.pre = self.pre self.pre = None self.nxt = None self.freq_node = None class FreqNode(object): def __init__(self, freq, pre, nxt): self.freq = freq self.pre = pre # previous FreqNode self.nxt = nxt # next FreqNode self.cache_head = None # CacheNode head under this FreqNode self.cache_tail = None # CacheNode tail under this FreqNode def count_caches(self): if self.cache_head is None and self.cache_tail is None: return 0 elif self.cache_head == self.cache_tail: return 1 else: return "2+" def remove(self): if self.pre is not None: self.pre.nxt = self.nxt if self.nxt is not None: self.nxt.pre = self.pre pre = self.pre nxt = self.nxt self.pre = self.nxt = self.cache_head = self.cache_tail = None return (pre, nxt) def pop_head_cache(self): if self.cache_head is None and self.cache_tail is None: return None elif self.cache_head == self.cache_tail: cache_head = self.cache_head self.cache_head = self.cache_tail = None return cache_head else: cache_head = self.cache_head self.cache_head.nxt.pre = None self.cache_head = self.cache_head.nxt return cache_head def append_cache_to_tail(self, cache_node): cache_node.freq_node = self if self.cache_head is None and self.cache_tail is None: self.cache_head = self.cache_tail = cache_node else: cache_node.pre = self.cache_tail cache_node.nxt = None self.cache_tail.nxt = cache_node self.cache_tail = cache_node def insert_after_me(self, freq_node): freq_node.pre = self freq_node.nxt = self.nxt if self.nxt is not None: self.nxt.pre = freq_node self.nxt = freq_node def insert_before_me(self, freq_node): if self.pre is not None: self.pre.nxt = freq_node freq_node.pre = self.pre freq_node.nxt = self self.pre = freq_node class LFUCache(object): def __init__(self, capacity): self.cache = {} # {key: cache_node} self.capacity = capacity self.freq_link_head = None def get(self, key): if key in self.cache: cache_node = self.cache[key] freq_node = cache_node.freq_node value = cache_node.value self.move_forward(cache_node, freq_node) return value else: return -1 def set(self, key, value): if self.capacity <= 0: return -1 if key not in self.cache: if len(self.cache) >= self.capacity: self.dump_cache() self.create_cache(key, value) else: cache_node = self.cache[key] freq_node = cache_node.freq_node cache_node.value = value self.move_forward(cache_node, freq_node) def move_forward(self, cache_node, freq_node): if freq_node.nxt is None or freq_node.nxt.freq != freq_node.freq + 1: target_freq_node = FreqNode(freq_node.freq + 1, None, None) target_empty = True else: target_freq_node = freq_node.nxt target_empty = False cache_node.free_myself() target_freq_node.append_cache_to_tail(cache_node) if target_empty: freq_node.insert_after_me(target_freq_node) if freq_node.count_caches() == 0: if self.freq_link_head == freq_node: self.freq_link_head = target_freq_node freq_node.remove() def dump_cache(self): head_freq_node = self.freq_link_head # close the session when removing it from cache session = self.cache.pop(head_freq_node.cache_head.key) session.close() head_freq_node.pop_head_cache() if head_freq_node.count_caches() == 0: self.freq_link_head = head_freq_node.nxt head_freq_node.remove() def create_cache(self, key, value): cache_node = CacheNode(key, value, None, None, None) self.cache[key] = cache_node if self.freq_link_head is None or self.freq_link_head.freq != 0: new_freq_node = FreqNode(0, None, None) new_freq_node.append_cache_to_tail(cache_node) if self.freq_link_head is not None: self.freq_link_head.insert_before_me(new_freq_node) self.freq_link_head = new_freq_node else: self.freq_link_head.append_cache_to_tail(cache_node)
def solution(clothes): answer = {} for i in clothes: if i[1] in answer: answer[i[1]]+=1 else: answer[i[1]] = 1 cnt = 1 for i in answer.values(): cnt *= (i+1) return cnt - 1
# Request Link and Long Polling Use TELEGRAM_TOKEN = '' WEBHOOK_URL = '' TELEGRAM_BASE = f'https://api.telegram.org/bot{TELEGRAM_TOKEN}' TELEGRAM_WEBHOOK_URL = TELEGRAM_BASE + f'/setWebhook?url={WEBHOOK_URL}/hook' FUGLE_API_TOKEN = '' # Other Chatbot Token EXAMPLE_TOKEN = '' # WEBHOOK_URL = ''
# Speed Fine Problem # input limit = int(input('Enter the speed limit: ')) speed = int(input('Enter the recorded speed of the car: ')) # processing & output if speed <= limit: print('Congratulations, you are within the speed limit!') else: difference = speed - limit if difference > 30: print('You are speeding and your fine is $500.') elif difference > 20: print('You are speeding and your fine is $270.') else: print('You are speeding and your fine is $100.')
# coding=utf-8 """ Data Integration """ __author__ = 'Seray Beser' __copyright__ = 'Copyright 2018 Seray Beser' __license__ = 'Apache License 2.0' __version__ = '0.0.1' __email__ = '[email protected]' __status__ = 'Development' class DataIntegration(object): """ Data Integration """ def __init__(self, data): self.data = data
# # PySNMP MIB module DEVICE (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DEVICE # Produced by pysmi-0.3.4 at Mon Apr 29 18:26:39 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") IpAddress, Unsigned32, ObjectIdentity, iso, ModuleIdentity, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, MibIdentifier, NotificationType, Integer32, enterprises, Counter32, Gauge32, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "Unsigned32", "ObjectIdentity", "iso", "ModuleIdentity", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "MibIdentifier", "NotificationType", "Integer32", "enterprises", "Counter32", "Gauge32", "TimeTicks") DisplayString, MacAddress, RowStatus, TruthValue, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "MacAddress", "RowStatus", "TruthValue", "TextualConvention") pepwave = MibIdentifier((1, 3, 6, 1, 4, 1, 27662)) productMib = MibIdentifier((1, 3, 6, 1, 4, 1, 27662, 200)) generalMib = MibIdentifier((1, 3, 6, 1, 4, 1, 27662, 200, 1)) deviceMib = MibIdentifier((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1)) deviceInfo = ModuleIdentity((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1, 1)) if mibBuilder.loadTexts: deviceInfo.setLastUpdated('201305210000Z') if mibBuilder.loadTexts: deviceInfo.setOrganization('PEPWAVE') deviceInfoSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1, 1, 1)) deviceModel = MibScalar((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1, 1, 1, 1), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceModel.setStatus('current') deviceSerialNumber = MibScalar((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1, 1, 1, 2), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceSerialNumber.setStatus('current') deviceFirmwareVersion = MibScalar((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1, 1, 1, 3), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceFirmwareVersion.setStatus('current') deviceInfoTime = MibIdentifier((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1, 1, 2)) deviceSystemTime = MibScalar((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1, 1, 2, 1), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceSystemTime.setStatus('current') deviceSystemUpTime = MibScalar((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1, 1, 2, 2), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceSystemUpTime.setStatus('current') deviceInfoUsage = MibIdentifier((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1, 1, 3)) deviceCpuLoad = MibScalar((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1, 1, 3, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceCpuLoad.setStatus('current') deviceTotalMemory = MibScalar((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1, 1, 3, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceTotalMemory.setStatus('current') deviceMemoryUsage = MibScalar((1, 3, 6, 1, 4, 1, 27662, 200, 1, 1, 1, 3, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: deviceMemoryUsage.setStatus('current') mibBuilder.exportSymbols("DEVICE", deviceInfoTime=deviceInfoTime, deviceCpuLoad=deviceCpuLoad, deviceSerialNumber=deviceSerialNumber, deviceInfoSystem=deviceInfoSystem, pepwave=pepwave, deviceInfo=deviceInfo, deviceModel=deviceModel, deviceFirmwareVersion=deviceFirmwareVersion, deviceTotalMemory=deviceTotalMemory, PYSNMP_MODULE_ID=deviceInfo, productMib=productMib, deviceSystemTime=deviceSystemTime, deviceInfoUsage=deviceInfoUsage, generalMib=generalMib, deviceSystemUpTime=deviceSystemUpTime, deviceMib=deviceMib, deviceMemoryUsage=deviceMemoryUsage)
#Desenvolva um programa que leia o comprimento de 3 retas #e diga ao usuário se elas podem ou não formar um triângulo. r1 = float(input('Primeiro segmento: ')) r2 = float(input('Segundo segmento: ')) r3 = float(input('Terceiro segmento: ')) if r1 < r2 + r3 and r2 < r1 + r3 and r3 < r1 + r2: print('Essas medidas formam um TRIÂNGULO') else: print('Essas medidas NÃO FORMAM UM TRIÂNGULO')
# Question # 17. Write a menu driven program to find the area of circle, square, rectangle & triangle. # Code types = ["circle", "square", "rectangle", "triangle"] print("-"*15) # 15 is length of Area Calculator. not intentional though it was a random rumber print("Area Calculator") print("-"*15) print() print("Please enter the following numbers according to the shape you want to calculate the area of.") print() for i, type in enumerate(types): print(i, ":", types[i]) print() shape = int(input()) if types[shape] == "circle": r = float(input("Randius:\n")) print("Area:", 22 / 7 * r * r) elif types[shape] == "square": a = float(input("Side length pls:\n")) print("Area:", a**2) elif types[shape] == "rectangle": s1 = float(input("Side 1:\n")) s2 = float(input("Side 2:\n")) print("Area:",s1*s2) elif types[shape] == "triangle": s1 = float(input("Side 1:\n")) s2 = float(input("Side 2:\n")) s3 = float(input("Side 3:\n")) s = (s1 + s2 + s3) / 2 print(s) print(s * (s-s1) * (s-s2) * (s-s3) ) print("Area:", ( s * (s-s1) * (s-s2) * (s-s3) ) ** 0.5 ) # Output # # --------------- # Area Calculator # --------------- # # Please enter the following numbers according to the shape you want to calculate the area of. # # 0 : circle # 1 : square # 2 : rectangle # 3 : triangle # # 3 # Side 1: # 5 # Side 2: # 5 # Side 3: # 3 # 6.5 # 51.1875 # Area: 7.1545440106270926 # Additional Comments: # None
""".""" # import time # import logging class SCPI(object): """SCPI helper functions.""" @property def SCPI_OPT(self): return self.query(':SYSTem:OPTions?').strip('"').split(',') @property def SystemErrorQueue(self): """Get System Error Queue. :returns: List of errors """ responces = [] i, s = self.inst.query_ascii_values(':SYSTem:ERRor?', converter='s') responce = [int(i), s.strip('"')] while responce[0] != 0: responces.append(responce) i, s = self.inst.query_ascii_values(':SYSTem:ERRor?', converter='s') responce = [int(i), s.strip('"')] if len(responces) == 0: return None else: return responces def SCPI_local(self): """Go To Local.""" return self.query_float(':SYSTem:COMMunicate:GTLocal?')
####################### # Login configuration # ####################### weblab_db_username = 'weblab' weblab_db_password = 'weblab' ######################################## # User Processing Server configuration # ######################################## core_session_type = 'Memory' core_coordinator_db_username = 'weblab' core_coordinator_db_password = 'weblab' core_coordinator_laboratory_servers = { "laboratory:lab_and_experiment1@main_machine" : { "exp1|ud-dummy|Dummy experiments" : "dummy1@ud-dummy", "exp2|ud-dummy|Dummy experiments" : "dummy2@ud-dummy", "exp3|ud-dummy|Dummy experiments" : "dummy3@ud-dummy", "exp4|ud-dummy|Dummy experiments" : "dummy4@ud-dummy", "exp5|ud-dummy|Dummy experiments" : "dummy5@ud-dummy", "exp6|ud-dummy|Dummy experiments" : "dummy6@ud-dummy", "exp7|ud-dummy|Dummy experiments" : "dummy7@ud-dummy", "exp8|ud-dummy|Dummy experiments" : "dummy8@ud-dummy", "exp9|ud-dummy|Dummy experiments" : "dummy9@ud-dummy", "exp10|ud-dummy|Dummy experiments" : "dummy10@ud-dummy", "exp11|ud-dummy|Dummy experiments" : "dummy11@ud-dummy", "exp12|ud-dummy|Dummy experiments" : "dummy12@ud-dummy", "exp13|ud-dummy|Dummy experiments" : "dummy13@ud-dummy", "exp14|ud-dummy|Dummy experiments" : "dummy14@ud-dummy", "exp15|ud-dummy|Dummy experiments" : "dummy15@ud-dummy", "exp16|ud-dummy|Dummy experiments" : "dummy16@ud-dummy", "exp17|ud-dummy|Dummy experiments" : "dummy17@ud-dummy", "exp18|ud-dummy|Dummy experiments" : "dummy18@ud-dummy", "exp19|ud-dummy|Dummy experiments" : "dummy19@ud-dummy", "exp20|ud-dummy|Dummy experiments" : "dummy20@ud-dummy", "exp21|ud-dummy|Dummy experiments" : "dummy21@ud-dummy", "exp22|ud-dummy|Dummy experiments" : "dummy22@ud-dummy", "exp23|ud-dummy|Dummy experiments" : "dummy23@ud-dummy", "exp24|ud-dummy|Dummy experiments" : "dummy24@ud-dummy", "exp25|ud-dummy|Dummy experiments" : "dummy25@ud-dummy", "exp26|ud-dummy|Dummy experiments" : "dummy26@ud-dummy", "exp27|ud-dummy|Dummy experiments" : "dummy27@ud-dummy", "exp28|ud-dummy|Dummy experiments" : "dummy28@ud-dummy", "exp29|ud-dummy|Dummy experiments" : "dummy29@ud-dummy", "exp30|ud-dummy|Dummy experiments" : "dummy30@ud-dummy", "exp31|ud-dummy|Dummy experiments" : "dummy31@ud-dummy", "exp32|ud-dummy|Dummy experiments" : "dummy32@ud-dummy", "exp33|ud-dummy|Dummy experiments" : "dummy33@ud-dummy", "exp34|ud-dummy|Dummy experiments" : "dummy34@ud-dummy", "exp35|ud-dummy|Dummy experiments" : "dummy35@ud-dummy", "exp36|ud-dummy|Dummy experiments" : "dummy36@ud-dummy", "exp37|ud-dummy|Dummy experiments" : "dummy37@ud-dummy", "exp38|ud-dummy|Dummy experiments" : "dummy38@ud-dummy", "exp39|ud-dummy|Dummy experiments" : "dummy39@ud-dummy", "exp40|ud-dummy|Dummy experiments" : "dummy40@ud-dummy", }, "laboratory:lab_and_experiment2@main_machine" : { "exp41|ud-dummy|Dummy experiments" : "dummy41@ud-dummy", "exp42|ud-dummy|Dummy experiments" : "dummy42@ud-dummy", "exp43|ud-dummy|Dummy experiments" : "dummy43@ud-dummy", "exp44|ud-dummy|Dummy experiments" : "dummy44@ud-dummy", "exp45|ud-dummy|Dummy experiments" : "dummy45@ud-dummy", "exp46|ud-dummy|Dummy experiments" : "dummy46@ud-dummy", "exp47|ud-dummy|Dummy experiments" : "dummy47@ud-dummy", "exp48|ud-dummy|Dummy experiments" : "dummy48@ud-dummy", "exp49|ud-dummy|Dummy experiments" : "dummy49@ud-dummy", "exp50|ud-dummy|Dummy experiments" : "dummy50@ud-dummy", "exp51|ud-dummy|Dummy experiments" : "dummy51@ud-dummy", "exp52|ud-dummy|Dummy experiments" : "dummy52@ud-dummy", "exp53|ud-dummy|Dummy experiments" : "dummy53@ud-dummy", "exp54|ud-dummy|Dummy experiments" : "dummy54@ud-dummy", "exp55|ud-dummy|Dummy experiments" : "dummy55@ud-dummy", "exp56|ud-dummy|Dummy experiments" : "dummy56@ud-dummy", "exp57|ud-dummy|Dummy experiments" : "dummy57@ud-dummy", "exp58|ud-dummy|Dummy experiments" : "dummy58@ud-dummy", "exp59|ud-dummy|Dummy experiments" : "dummy59@ud-dummy", "exp60|ud-dummy|Dummy experiments" : "dummy60@ud-dummy", "exp61|ud-dummy|Dummy experiments" : "dummy61@ud-dummy", "exp62|ud-dummy|Dummy experiments" : "dummy62@ud-dummy", "exp63|ud-dummy|Dummy experiments" : "dummy63@ud-dummy", "exp64|ud-dummy|Dummy experiments" : "dummy64@ud-dummy", "exp65|ud-dummy|Dummy experiments" : "dummy65@ud-dummy", "exp66|ud-dummy|Dummy experiments" : "dummy66@ud-dummy", "exp67|ud-dummy|Dummy experiments" : "dummy67@ud-dummy", "exp68|ud-dummy|Dummy experiments" : "dummy68@ud-dummy", "exp69|ud-dummy|Dummy experiments" : "dummy69@ud-dummy", "exp70|ud-dummy|Dummy experiments" : "dummy70@ud-dummy", "exp71|ud-dummy|Dummy experiments" : "dummy71@ud-dummy", "exp72|ud-dummy|Dummy experiments" : "dummy72@ud-dummy", "exp73|ud-dummy|Dummy experiments" : "dummy73@ud-dummy", "exp74|ud-dummy|Dummy experiments" : "dummy74@ud-dummy", "exp75|ud-dummy|Dummy experiments" : "dummy75@ud-dummy", "exp76|ud-dummy|Dummy experiments" : "dummy76@ud-dummy", "exp77|ud-dummy|Dummy experiments" : "dummy77@ud-dummy", "exp78|ud-dummy|Dummy experiments" : "dummy78@ud-dummy", "exp79|ud-dummy|Dummy experiments" : "dummy79@ud-dummy", "exp80|ud-dummy|Dummy experiments" : "dummy80@ud-dummy", } } core_scheduling_systems = { "ud-dummy" : ("PRIORITY_QUEUE", {}), } ########################## # Database configuration # ########################## db_host = "localhost" db_database = "WebLabTests" core_universal_identifier = 'da2579d6-e3b2-11e0-a66a-00216a5807c8' core_universal_identifier_human = 'server X at Sample University' core_server_url = 'http://localhost/weblab/'
# DomirScire def get_final_line(filename): final_line = '' for current_line in open(filename): final_line = current_line return final_line if __name__ == "__main__": print(get_final_line('./'))
class MockArgs(object): """Mock for command line args.""" def __init__(self, **kwargs): self.doctype = kwargs.get('doctype') self.output = kwargs.get('output') self.path = kwargs.get('path') class NameOptions(object): """Mock of configurable names.""" def __init__(self): self.characters = [] self.places = [] self.things = [] self.invalid = [] class MockOptions(object): """Mock of options parsed from config.""" def __init__(self): self.names = NameOptions()
# Indo de um número para outro na ordem decrescente. num = int(input('Digite um número: ')) for c in range(0, num + 1): print(c) print('FIM')
class Solution(object): def sortColors(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ if not nums: return None redcount=0 whilecount=0 bluecount=0 for num in nums: if num==0: redcount+=1 elif num==1: whilecount+=1 else: bluecount+=1 # set the nums for i in xrange(redcount): nums[i]=0 for i in xrange(redcount,redcount+whilecount): nums[i]=1 for i in xrange(redcount+whilecount,redcount+whilecount+bluecount): nums[i]=2
class Solution: def makeString(self, s: str) -> str: result = [] for c in s: if c != '#': result.append(c) elif len(result) > 0: result.pop() return str(result) def backspaceCompare(self, s: str, t: str) -> bool: return self.makeString(s) == self.makeString(t) s = Solution() print(s.backspaceCompare("ab#c", "ad#c")) print(s.backspaceCompare("ab##", "c#d#")) print(s.backspaceCompare("a##c", "#a#c")) print(s.backspaceCompare("a#c", "b"))
# Get frequencies of attributes def get_frequencies(plant_dict): frequencies = {} # First keep count of how many times an attribute appears count = 0 # Keep track of the number of plants for plant in plant_dict: plant_attributes = set() # Don't count duplicate attributes (such as a flower having 2 colors) plant_tuples = plant_dict[plant] for tup in plant_tuples: attribute = tup[0] if attribute in plant_attributes: continue if attribute not in frequencies: frequencies[attribute] = 1 else: frequencies[attribute] += 1 plant_attributes.add(attribute) count += 1 # Then divide by count to get a percentage for attribute in frequencies: frequencies[attribute] /= float(count)/100 return frequencies # Nicely print the attribute frequencies def print_frequencies(frequencies): for k, v in frequencies.items(): print("{}: {}%".format(k, str(v))) # Print the attributes for each plant def print_attributes(plant_dict): for plant in plant_dict: print("{} has the following features:".format(plant)) for t in plant_dict[plant]: print(t) print('')
squares = [] for value in range(1,11): squares.append(value **2) print(squares) digits = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] print(min(digits)) print(max(digits)) print(sum(digits)) squares = [value**2 for value in range(1,11)] print(squares) odd_numbers = list(range(1,20,1)) print(odd_numbers) cars = ['audi', 'bmw', 'subaru', 'toyota'] for car in cars: if car == 'bmw': print(car.upper()) else: print(car.title())
# Stub only, D support was broken with Python2.6 and unnecessary to Nuitka def generate(env): return def exists(env): return False
class Base: def __init__(self, x=0): self.x = x class Slave(Base): def __init__(self, x): super(Slave, self).__init__() self.x = x s1 = Slave(x=2) print(s1.x)
def strStr(haystack: str, needle: str) -> int: i = 0 j = 0 len1 = len(haystack) len2 = len(needle) while i < len1 and j < len2: if haystack[i] == needle[j]: i += 1 j += 1 else: i = i - (j - 1) j = 0 if j == len2: return i-j else: return -1 print(strStr("abcdeabc", "bcd"))
#!/usr/bin/env python3 # coding:utf-8 def getCommonDivisor(m, d): while d: m, d = d, m%d return m def calc(m, d): if d == 0: return "X -- ZeroDivisionError" elif m == 0: return '0' elif m == d: return '1' com_div = getCommonDivisor(m, d) return str(m//com_div) + '/' + str(d//com_div) def myAdd(a, b, c, d): """ a/b + c/d """ molecule = a*d + b*c denominator = b*d return calc(molecule, denominator) def myMinus(a, b, c, d): """ a/b - c/d """ molecule = a*d - b*c denominator = b*d return calc(molecule, denominator) if __name__ == "__main__": print("1/2 + 1/3 =", myAdd(1, 2, 1, 3)) print("1/2 + 1/0 =", myAdd(1, 2, 1, 0)) print("1/2 + 1/2 =", myAdd(1, 2, 1, 2)) print("1/2 - 1/3 =", myMinus(1, 2, 1, 3))
''' Program to count number of trees in a forest. Approach: The idea is to apply Depth First Search on every node. If every connected node is visited from one source then increment count by one. If some nodes yet not visited again perform DFS traversal. Return the count. Example: Input : edges[] = {0, 1}, {0, 2}, {3, 4} Output : 2 Explanation : There are 2 trees 0 3 / \ \ 1 2 4 Input : edges[] = {0, 1}, {0, 2}, {3, 4}, {5, 6} Output : 3 Explanation : There are 3 trees 0 3 5 / \ \ \ 1 2 4 6 ''' def Insert_Edge(Graph, u, v): Graph[u].append(v) Graph[v].append(u) def Depth_First_Search_Traversal(u, Graph, Check_visited): Check_visited[u] = True for i in range(len(Graph[u])): if (Check_visited[Graph[u][i]] == False): Depth_First_Search_Traversal(Graph[u][i], Graph, Check_visited) def Count_Tree(Graph, V): Check_visited = [False] * V res = 0 for u in range(V): if (Check_visited[u] == False): Depth_First_Search_Traversal(u, Graph, Check_visited) res += 1 return res # Driver code if __name__ == '__main__': V = 7 Graph = [[] for i in range(V)] Insert_Edge(Graph, 0, 1) Insert_Edge(Graph, 0, 2) Insert_Edge(Graph, 3, 4) Insert_Edge(Graph, 5, 6) print(Count_Tree(Graph, V))
def reverseInput(word): # str[start:stop:step] return word[::-1] def reverseInput2(word): new_word = "" for char in word: new_word = char + new_word return new_word if __name__ == "__main__": word = input("Enter the word: ") print(reverseInput(word)) print(reverseInput2(word))
''' In a N x N grid representing a field of cherries, each cell is one of three possible integers. 0 means the cell is empty, so you can pass through; 1 means the cell contains a cherry, that you can pick up and pass through; -1 means the cell contains a thorn that blocks your way. Your task is to collect maximum number of cherries possible by following the rules below: Starting at the position (0, 0) and reaching (N-1, N-1) by moving right or down through valid path cells (cells with value 0 or 1); After reaching (N-1, N-1), returning to (0, 0) by moving left or up through valid path cells; When passing through a path cell containing a cherry, you pick it up and the cell becomes an empty cell (0); If there is no valid path between (0, 0) and (N-1, N-1), then no cherries can be collected. Example 1: Input: grid = [[0, 1, -1], [1, 0, -1], [1, 1, 1]] Output: 5 Explanation: The player started at (0, 0) and went down, down, right right to reach (2, 2). 4 cherries were picked up during this single trip, and the matrix becomes [[0,1,-1],[0,0,-1],[0,0,0]]. Then, the player went left, up, up, left to return home, picking up one more cherry. The total number of cherries picked up is 5, and this is the maximum possible. Note: grid is an N by N 2D array, with 1 <= N <= 50. Each grid[i][j] is an integer in the set {-1, 0, 1}. It is guaranteed that grid[0][0] and grid[N-1][N-1] are not -1. ''' class Solution(object): def cherryPickup(self, grid): """ :type grid: List[List[int]] :rtype: int """ if not grid or not grid[0]: return 0 f = [[[float('-inf') for rowb in xrange(len(grid))] for rowa in xrange(len(grid))] for k in xrange(len(grid) + len(grid[0]) - 1)] if grid[0][0] >= 0: f[0][0][0] = grid[0][0] for k in xrange(1, len(grid) + len(grid[0]) - 1): for rowa in xrange(len(grid)): cola = k - rowa if cola < 0 or len(grid[0]) <= cola or grid[rowa][cola] == -1: continue for rowb in xrange(len(grid)): colb = k - rowb if colb < 0 or len(grid[0]) <= colb or grid[rowb][colb] == -1: continue if 0 <= rowa - 1 and 0 <= rowb - 1: f[k][rowa][rowb] = max(f[k][rowa][rowb], f[k-1][rowa-1][rowb-1]) if 0 <= rowa - 1 and 0 <= colb - 1: f[k][rowa][rowb] = max(f[k][rowa][rowb], f[k-1][rowa-1][rowb]) if 0 <= cola - 1 and 0 <= rowb - 1: f[k][rowa][rowb] = max(f[k][rowa][rowb], f[k-1][rowa][rowb-1]) if 0 <= cola - 1 and 0 <= colb - 1: f[k][rowa][rowb] = max(f[k][rowa][rowb], f[k-1][rowa][rowb]) if rowa == rowb: f[k][rowa][rowb] += grid[rowa][cola] else: f[k][rowa][rowb] += grid[rowa][cola] + grid[rowb][colb] return max(0, f[-1][-1][-1])
EXAMPLE = '''\ |+1|-1|+2|-2|+3|-3|+sg|+pl|-sg|-pl| 1sg| X| | | X| | X| X| | | X| 1pl| X| | | X| | X| | X| X| | 2sg| | X| X| | | X| X| | | X| 2pl| | X| X| | | X| | X| X| | 3sg| | X| | X| X| | X| | | X| 3pl| | X| | X| X| | | X| X| | '''
class Solution: def intToRoman(self, num): """ :type num: int :rtype: str """ roman = 'MDCLXVI' romandiv = [1000, 500, 100, 50, 10, 5, 1] ans = '' strnum = str(num) i = 6 - (len(strnum) - 1) * 2 for c in strnum: if c == '1': ans += roman[i] elif c == '2': ans += roman[i] * 2 elif c == '3': ans += roman[i] * 3 elif c == '4': ans += roman[i] + roman[i - 1] elif c == '5': ans += roman[i - 1] elif c == '6': ans += roman[i - 1] + roman[i] elif c == '7': ans += roman[i - 1] + roman[i] * 2 elif c == '8': ans += roman[i - 1] + roman[i] * 3 elif c == '9': ans += roman[i] + roman[i - 2] i += 2 return ans if __name__ == "__main__": solution = Solution() print(solution.intToRoman(3)) print(solution.intToRoman(4)) print(solution.intToRoman(9)) print(solution.intToRoman(58)) print(solution.intToRoman(1994))
def is_valid_row_col(next_r, next_c): if 0 <= next_r < 8 and 0 <= next_c < 8: return True return False matrix = [] queens = [] for _ in range(8): data = input().split(" ") matrix.append(data) row_king = int col_king = int for row in range(8): for column in range(8): if matrix[row][column] == "K": row_king = row col_king = column rotations = { "up": (-1, 0), "down": (1, 0), "left": (0, -1), "right": (0, 1), "up_left": (-1, -1), "up_right": (-1, 1), "down_left": (1, -1), "down_right": (1, 1) } for rotation in rotations: next_row = row_king + rotations[rotation][0] next_col = col_king + rotations[rotation][1] while is_valid_row_col(next_row, next_col): if matrix[next_row][next_col] == "Q": queens.append([next_row, next_col]) break next_row += rotations[rotation][0] next_col += rotations[rotation][1] if queens: [print(q) for q in queens] else: print("The king is safe!")
# O(n) time and O(log n) space def max_path_sum(tree): _, max_path_sum = max_path_sum_helper(tree) return max_path_sum def max_path_sum_helper(tree): if not tree: # Base case of not a node return (0, 0) # Depth first bottom up approach to calculate the max path sum left_branch_sum, left_triangle_sum = max_path_sum_helper(tree.left) right_branch_sum, right_triangle_sum = max_path_sum_helper(tree.right) # Using node label instead of tree seems to be more appropriate node_value = tree.value # The max between left or right child_branch_sum = max(left_branch_sum, right_branch_sum) # The max from either node, node + left, or node + right node_child_sum = max(node_value + child_branch_sum, node_value) # The max sum may comes a triangle (left - Node - right) # or either node or node - left or node - right triangle_sum = max(node_child_sum, left_branch_sum + node_value + right_branch_sum) # Only one triangle is allowed since maximum connection between a node is two. # Since the maximum path sum can only exist one triangle being formed, then # the triangle might come from the current node triangle, left triangle, or right triangle. max_path_sum = max(triangle_sum, left_triangle_sum, right_triangle_sum) # Returns to the parent node in order to compute a valid path to avoid multiple triangles. # That is, return (max sum that does not form a triangle, max sum possibly formed by a triangle) return node_child_sum, max_path_sum
""" Mouse Press. Saves one PDF of the contents of the display window each time the mouse is pressed. """ add_library('pdf') saveOneFrame = False def setup(): size(600, 600) frameRate(24) def draw(): global saveOneFrame if saveOneFrame: beginRecord(PDF, "Line.pdf") background(255) stroke(0, 20) strokeWeight(20.0) line(mouseX, 0, width - mouseY, height) if saveOneFrame: endRecord() saveOneFrame = False def mousePressed(): global saveOneFrame saveOneFrame = True
#!/usr/bin/env python # encoding: utf-8 ''' @author: Jason Lee @license: (C) Copyright @ Jason Lee @contact: [email protected] @file: jianzhi_offer_63_2.py @time: 2019/4/24 15:13 @desc: ''' class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: # 返回对应节点TreeNode # only need to inorder traversal the tree def KthNode(self, pRoot, k): if not pRoot: return None if k <= 0: return None self.k = k return self.inorder(pRoot) def inorder(self, pRoot): if not pRoot: # reach a leaf node return None res = self.inorder(pRoot.left) if not res: if self.k > 1: self.k -= 1 res = None elif self.k == 1: res = pRoot if not res: res = self.inorder(pRoot.right) return res if __name__ == '__main__': root = TreeNode(8) left = TreeNode(6) right = TreeNode(10) left.left = TreeNode(5) left.right = TreeNode(7) right.left = TreeNode(9) right.right = TreeNode(11) root.left = left root.right = right res = Solution() b = res.KthNode(root, 4) print(b)
# # PySNMP MIB module SW-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SW-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:36:37 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint") fcSwitch, bcsiModules = mibBuilder.importSymbols("Brocade-REG-MIB", "fcSwitch", "bcsiModules") SwTrunkMaster, SwSensorIndex, SwDomainIndex, FcWwn, SwNbIndex, SwPortIndex = mibBuilder.importSymbols("Brocade-TC", "SwTrunkMaster", "SwSensorIndex", "SwDomainIndex", "FcWwn", "SwNbIndex", "SwPortIndex") connUnitPortEntry, connUnitPortStatEntry = mibBuilder.importSymbols("FCMGMT-MIB", "connUnitPortEntry", "connUnitPortStatEntry") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Bits, Unsigned32, Integer32, ModuleIdentity, NotificationType, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, iso, TimeTicks, MibIdentifier, Counter64, Gauge32, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Unsigned32", "Integer32", "ModuleIdentity", "NotificationType", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "iso", "TimeTicks", "MibIdentifier", "Counter64", "Gauge32", "ObjectIdentity") TextualConvention, DisplayString, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "TruthValue") swMibModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 1588, 3, 1, 3)) swMibModule.setRevisions(('2003-01-13 14:30', '2003-07-20 14:30', '2004-04-15 10:30', '2004-08-06 18:30', '2005-04-29 20:16', '2006-01-09 09:00', '2006-05-17 09:00', '2007-01-23 09:00', '2007-06-08 12:00', '2007-06-27 10:30', '2007-08-01 12:20', '2007-08-29 04:42', '2008-01-29 07:59', '2008-07-17 03:45', '2008-07-24 02:32', '2008-07-25 02:32', '2008-09-09 09:00', '2009-09-28 09:00', '2009-02-21 09:00', '2009-03-30 09:00', '2009-06-25 12:00', '2009-06-29 01:00', '2009-06-30 13:06', '2009-06-30 06:00', '2009-10-30 05:00', '2009-11-03 13:06', '2009-11-05 12:00', '2009-11-05 05:00', '2009-11-06 11:30', '2009-11-30 10:30', '2009-12-03 17:30', '2010-01-30 17:30', '2010-07-08 11:30', '2010-07-15 11:30', '2010-07-21 11:30', '2010-08-06 11:30', '2010-08-20 10:30', '2010-10-07 10:30', '2010-10-09 10:30', '2010-10-25 10:30', '2010-11-01 06:00', '2010-11-02 10:30', '2010-12-02 10:30', '2010-12-08 10:30', '2010-12-20 10:00', '2010-12-21 04:00', '2010-12-22 10:00', '2010-12-30 10:00', '2011-01-06 10:30', '2011-01-07 10:30', '2011-02-18 06:00', '2012-02-23 10:30', '2012-03-05 03:33', '2012-05-15 14:25', '2012-06-04 17:20', '2012-06-14 10:00', '2012-06-29 15:20', '2012-07-10 16:00', '2012-09-26 14:00', '2013-03-21 13:00', '2013-04-04 17:48', '2013-04-22 11:30', '2013-04-25 18:03', '2013-05-15 14:30', '2013-06-05 16:00', '2013-06-29 10:00', '2013-09-12 10:00', '2013-10-04 13:40',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: swMibModule.setRevisionsDescriptions(('The initial version of this module.', 'Added swIDIDMode to the swFabric group.', 'Added object for Trap Severity Level, swFwLastSeverityLevel. Added the enumeration swFwResourceFlash for SwFwClassesAreas. Deprecated the mib object swEventTrapLevel. Updated the description of swGroupId and corrected the spell mistakes. Obsoleted the swFault Trap. Added enumerations four-GB for swFCPortSpeed and unknown, other for swFCPortType.', 'Added swFCPortSpecifier object to swFCPortTable.', 'Modified the #SUMMARY and #ARGUMENTS for swFabricWatchTrap', '1. Modified the description for swPortTrunked 2. Updated the SW Traps summary and description to remove the obsolete varbindings', 'Added swFCPortFlag object to swFCPortTable', 'Added enumerations eight-GB and ten-GB for swFCPortSpeed', 'Included swFCPortFlag as an additiional variable binding for trap SWFCPortScn', 'Added enumerations octuple and decuple for swNbBaudRate', 'Added the enumerations swFwEPortUtil and swFwEPortPktl for swFwClassAreaIndex', 'Added swFCPortBrcdType object to swFCPortTable', 'Added Toptalker support and swVfId to the swFabric group.', 'Added swIPv6ChangeTrap, swIPv6Address and swIPv6Status .', 'Added swModel to distiguish between 7500 and 7500E switch .', 'Added the enumerations swFwPortLr, swFwEPortLr, swFwEPortUtil, swFwEPortPktl, swFwFCUPortLr, swFwFOPPortLr for swFwClassAreaIndex.', 'Added swPmgrEventTrap information.', 'Added additional fabric watch threshold in SwFwActs.', 'Added port phy states.', 'Added swEventVfId in swEventTable.', "Removed the version information from Brocade's proprietary MIB file name.", 'Modified swVfid position at the last of swFabric table', 'Added swFwCPUMemUsage enumeration under swFwClassAreaIndex.', 'Updated the description of swCpuAction/swMemAction and access of swcpuormemoryusage objects and changed the type of swEndDeviceInvalidWord, swEndDeviceLinkFailure,swEndDeviceSyncLoss, swEndDeviceSigLoss, swEndDeviceProtoErr,swEndDeviceInvalidCRC from integer32 to counter32.', 'Added swFabricReconfigTrap and swFabricSegmentTrap.', 'Removed enum switchReboot from swAdmStatus.', 'Changed swFwCustUnit access to read-only', 'Added enums swFwEPortTrunkUtil,swFwFCUPortTrunkUtil and swFwFOPPortTrunkUtil in SwFwClassesAreas', 'Added swConnUnitExtensionTable and entries for 64 bit portstats.', 'Added swMemUsageLimit1 and swMemUsageLimit3 under swCpuOrMemoryUsage', 'Added swExttrap as internal trap.', 'Changed the descriptions for swConnUnitExtensionTable.', 'Obsoleted swGroupTable, swGroupMemTable from swGroup.', 'Added swFCPortWwn, swFCPortBrcdType in swFcPortScn and added swStateChangeTrap', 'Added trap swPortMoveTrap', 'Added trap portStats objects under SwConnUnitPortStatEntry', 'Added trap swBrcdGenericTrap', 'Added swVfName', 'Added swPortConfigTable', 'Added swFCPortPrevType in swFCPortScn', 'Added fifty filter classes under swFwClassAreaIndex', 'Updated the description of swBrcdTrapBitMask and swBrcdGenericTrap for Fapwwn Trap', 'Deprecated swAgtCmtyTable and provided support of standard mibs SnmpCommunityTable and snmpTargetParamsTable and snmpTargetAddrTable', 'Updated the datatype for swPortEncrypt and swPortCompression', 'Added enumeration sexdecuple for swNbBaudRate', 'Added a new value lowBufferCrsd(7) for swFwLastEvent', 'Changed the area name filter-fmcfg to filterFmCfg in SwFwClassesAreas', 'Included FDMI event case in swBrcdTrapBitMask', 'Added class3 discards error in SwConnUnitPortStatEntry', 'Moved swPortConfigTable, CiperMode and Encrypt/CompressStatus to faext.mib', 'Changed fportmode(2) to portmode(2) for object swTopTalkerMntMode.', 'Added swauthProtocolPassword and swauthProtocolPassword for IBM DirectorServer applications', 'Added new enum noSigDet(14) for object swFCPortPhyState', 'Changed the syntax of swCpuAction and swMemAction objects.', 'Added PCS block errors in swConnUnitPortStatEntry', 'Added swDeviceStatus and swDeviceStatusTrap', 'Added sixteenGB support to swFCPortSpeed and also deprecated teh same', 'Added an area filterFmCfg51 in the class SwFwClassesAreas', 'Removed the tab space and added the space key for swFCPortEntry 38 as this caused a crash in MIB browser', 'Added swFCPortDisableReason in SwFCPortEntry and swFCPortScn trap.', 'Added unroutable frame counter in swConnUnitPortStatEntry', 'Made the swFCPortSpeed obsolete', 'Changed the description for swVFName and swConnUnitPCSErrorCounter', 'Updated swFCPortCapacity description', 'Added swFwPowerOnHours in SwFwClassesAreas', 'Updated the description for swCpuUsageLimit, swCpuAction, swMemAction, swMemUsageLimit1 and swMemUsageLimit3.', 'Added FEC Counters swConnUnitFECCorrectedCounter, swConnUnitFECUnCorrectedCounter', 'Added swZoneConfigChangeTrap',)) if mibBuilder.loadTexts: swMibModule.setLastUpdated('201310041340Z') if mibBuilder.loadTexts: swMibModule.setOrganization('Brocade Communications Systems, Inc.,') if mibBuilder.loadTexts: swMibModule.setContactInfo('Customer Support Group Brocade Communications Systems, 1745 Technology Drive, San Jose, CA 95110 U.S.A Tel: +1-408-392-6061 Fax: +1-408-392-6656 Email: [email protected] WEB: www.brocade.com') if mibBuilder.loadTexts: swMibModule.setDescription("The MIB module is for Brocade's Fibre Channel Switch. Copyright (c) 1996-2003 Brocade Communications Systems, Inc. All rights reserved.") sw = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1)) if mibBuilder.loadTexts: sw.setStatus('current') if mibBuilder.loadTexts: sw.setDescription("The OID sub-tree for Brocade's Silkworm Series of Fibre Channel Switches.") sw28k = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 2)) if mibBuilder.loadTexts: sw28k.setStatus('current') if mibBuilder.loadTexts: sw28k.setDescription("The OID for Brocade's Silkworm 2800 model Fibre Channel Switch.") sw21kN24k = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 3)) if mibBuilder.loadTexts: sw21kN24k.setStatus('current') if mibBuilder.loadTexts: sw21kN24k.setDescription("The OID for Brocade's Silkworm 2100 and 2400 series model Fibre Channel Switch.") sw20x0 = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 4)) if mibBuilder.loadTexts: sw20x0.setStatus('current') if mibBuilder.loadTexts: sw20x0.setDescription("The OID for Brocade's Silkworm 20x0 series model Fibre Channel Switch.") class SwSevType(TextualConvention, Integer32): description = "The event trap level in conjunction with the an event's severity level." status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5)) namedValues = NamedValues(("none", 0), ("critical", 1), ("error", 2), ("warning", 3), ("informational", 4), ("debug", 5)) class FcPortFlag(TextualConvention, Bits): description = 'Represents the port status for a FC Flag. Currently this will indicate if the port is virtual or physical.' status = 'current' namedValues = NamedValues(("physical", 0), ("virtual", 1)) swSystem = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1)) if mibBuilder.loadTexts: swSystem.setStatus('current') if mibBuilder.loadTexts: swSystem.setDescription('The OID sub-tree for swSystem group.') swFabric = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2)) if mibBuilder.loadTexts: swFabric.setStatus('current') if mibBuilder.loadTexts: swFabric.setDescription('The OID sub-tree for swFabric group.') swModule = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 3)) if mibBuilder.loadTexts: swModule.setStatus('current') if mibBuilder.loadTexts: swModule.setDescription('The OID sub-tree for swModule group.') swAgtCfg = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 4)) if mibBuilder.loadTexts: swAgtCfg.setStatus('current') if mibBuilder.loadTexts: swAgtCfg.setDescription('The OID sub-tree for swAgtCfg group.') swFCport = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6)) if mibBuilder.loadTexts: swFCport.setStatus('current') if mibBuilder.loadTexts: swFCport.setDescription('The OID sub-tree for swFCport group.') swNs = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7)) if mibBuilder.loadTexts: swNs.setStatus('current') if mibBuilder.loadTexts: swNs.setDescription('The OID sub-tree for swNs group.') swEvent = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 8)) if mibBuilder.loadTexts: swEvent.setStatus('current') if mibBuilder.loadTexts: swEvent.setDescription('The OID sub-tree for swEvent group.') swFwSystem = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10)) if mibBuilder.loadTexts: swFwSystem.setStatus('current') if mibBuilder.loadTexts: swFwSystem.setDescription('The OID sub-tree for swFwSystem group.') swEndDevice = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 21)) if mibBuilder.loadTexts: swEndDevice.setStatus('current') if mibBuilder.loadTexts: swEndDevice.setDescription('The OID sub-tree for swEndDevice group.') swGroup = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 22)) if mibBuilder.loadTexts: swGroup.setStatus('obsolete') if mibBuilder.loadTexts: swGroup.setDescription('The OID sub-tree for swGroup group.') swBlmPerfMnt = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23)) if mibBuilder.loadTexts: swBlmPerfMnt.setStatus('current') if mibBuilder.loadTexts: swBlmPerfMnt.setDescription('The OID sub-tree for swBlmPerfMnt (Bloom Performance Monitor) group.') swTrunk = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24)) if mibBuilder.loadTexts: swTrunk.setStatus('current') if mibBuilder.loadTexts: swTrunk.setDescription('The OID sub-tree for swTrunk group.') swTopTalker = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 25)) if mibBuilder.loadTexts: swTopTalker.setStatus('current') if mibBuilder.loadTexts: swTopTalker.setDescription('The OID sub-tree for TopTalker group.') swCpuOrMemoryUsage = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26)) if mibBuilder.loadTexts: swCpuOrMemoryUsage.setStatus('current') if mibBuilder.loadTexts: swCpuOrMemoryUsage.setDescription('The OID sub-tree for cpu or memory usage group.') swConnUnitPortStatExtentionTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27), ) if mibBuilder.loadTexts: swConnUnitPortStatExtentionTable.setStatus('current') if mibBuilder.loadTexts: swConnUnitPortStatExtentionTable.setDescription('This represents the Conn unit Port Stats') swCurrentDate = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: swCurrentDate.setStatus('current') if mibBuilder.loadTexts: swCurrentDate.setDescription('The current date information in displayable textual format.') swBootDate = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: swBootDate.setStatus('current') if mibBuilder.loadTexts: swBootDate.setDescription('The date and time when the system last booted, in displayable textual format.') swFWLastUpdated = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFWLastUpdated.setStatus('current') if mibBuilder.loadTexts: swFWLastUpdated.setDescription('The information indicates the date when the firmware was last updated, in displayable textual format.') swFlashLastUpdated = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFlashLastUpdated.setStatus('current') if mibBuilder.loadTexts: swFlashLastUpdated.setDescription('The information indicates the date when the FLASH was last updated, in displayable textual format.') swBootPromLastUpdated = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: swBootPromLastUpdated.setStatus('current') if mibBuilder.loadTexts: swBootPromLastUpdated.setDescription('The information indicates the date when the boot PROM was last updated, in displayable textual format.') swFirmwareVersion = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 6), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 24))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFirmwareVersion.setStatus('current') if mibBuilder.loadTexts: swFirmwareVersion.setDescription('The current version of the firwmare.') swOperStatus = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("online", 1), ("offline", 2), ("testing", 3), ("faulty", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swOperStatus.setStatus('current') if mibBuilder.loadTexts: swOperStatus.setDescription('The current operational status of the switch. The states are as follow: o online(1) means the switch is accessible by an external Fibre Channel port; o offline(2) means the switch is not accessible; o testing(3) means the switch is in a built-in test mode and is not accessible by an external Fibre Channel port; o faulty(4) means the switch is not operational.') swAdmStatus = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("online", 1), ("offline", 2), ("testing", 3), ("faulty", 4), ("reboot", 5), ("fastboot", 6)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swAdmStatus.setStatus('current') if mibBuilder.loadTexts: swAdmStatus.setDescription("The desired administrative status of the switch. A management station may place the switch in a desired state by setting this object accordingly. The states are as follow: o online(1) means set the switch to be accessible by an external Fibre Channel port; o offline(2) means set the switch to be inaccessible; o testing(3) means set the switch to run the built-in test; o faulty(4) means set the switch to a 'soft' faulty condition; o reboot(5) means set the switch to reboot in 1 second. o fastboot(6) means set the switch to fastboot in 1 second. Fastboot would cause the switch to boot but skip over the POST. When the switch is in faulty state, only two states can be set: faulty and reboot/fastboot.") swTelnetShellAdmStatus = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("unknown", 0), ("terminated", 1)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swTelnetShellAdmStatus.setStatus('current') if mibBuilder.loadTexts: swTelnetShellAdmStatus.setDescription('The desired administrative status of the Telnet shell. By setting it to terminated(1), the current Telnet shell task is deleted. When this variable instance is read, it reports the value last set through SNMP.') swSsn = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: swSsn.setStatus('current') if mibBuilder.loadTexts: swSsn.setDescription('The soft serial number of the switch.') swFlashDLOperStatus = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 0), ("swCurrent", 1), ("swFwUpgraded", 2), ("swCfUploaded", 3), ("swCfDownloaded", 4), ("swFwCorrupted", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFlashDLOperStatus.setStatus('current') if mibBuilder.loadTexts: swFlashDLOperStatus.setDescription('The operational status of the FLASH. The operational states are as follow: o swCurrent(1) indicates that the FLASH contains the current firmware image or config file; o swFwUpgraded(2) state indicates that it contains the image upgraded from the swFlashDLHost.0.; o swCfUploaded(3) state indicates that the switch configuration file has been uploaded to the host; and o swCfDownloaded(4) state indicates that the switch configuration file has been downloaded from the host. o swFwCorrupted (5) state indicates that the firmware in the FLASH of the switch is corrupted.') swFlashDLAdmStatus = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("swCurrent", 1), ("swFwUpgrade", 2), ("swCfUpload", 3), ("swCfDownload", 4), ("swFwCorrupted", 5)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFlashDLAdmStatus.setStatus('current') if mibBuilder.loadTexts: swFlashDLAdmStatus.setDescription('The desired state of the FLASH. A management station may place the FLASH in a desired state by setting this object accordingly: o swCurrent(1) indicates that the FLASH contains the current firmware image or config file; o swFwUpgrade(2) means that the firmware in the FLASH is to be upgraded from the host specified; o swCfUpload(3) means that the switch config file is to be uploaded to the host specified; or o swCfDownload(4) means that the switch config file is to be downloaded from the host specified. o swFwCorrupted(5) state indicates that the firmware in the FLASH is corrupted. This value is for informational purpose only. However, set of swFlashDLAdmStatus to this value is not allowed. The host is specified in swFlashDLHost.0. In addition, user name is specified in swFlashDLUser.0, and the file name specified in swFlashDLFile.0. Reference the user manual on the following commands, o firmwareDownload, o configUpload, and o configDownload.') swFlashDLHost = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 13), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFlashDLHost.setStatus('current') if mibBuilder.loadTexts: swFlashDLHost.setDescription('The name or IP address (in dot notation) of the host to download or upload a relevant file to the FLASH.') swFlashDLUser = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 14), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFlashDLUser.setStatus('current') if mibBuilder.loadTexts: swFlashDLUser.setDescription('The user name on the host to download or upload a relevant file to or from the FLASH.') swFlashDLFile = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 15), DisplayString()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFlashDLFile.setStatus('current') if mibBuilder.loadTexts: swFlashDLFile.setDescription('The name of the file to be downloaded or uploaded.') swFlashDLPassword = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 16), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 100))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFlashDLPassword.setStatus('current') if mibBuilder.loadTexts: swFlashDLPassword.setDescription('The password to be used in for FTP transfer of files in the download or upload operation.') swBeaconOperStatus = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swBeaconOperStatus.setStatus('current') if mibBuilder.loadTexts: swBeaconOperStatus.setDescription('The current operational status of the switch beacon. When the beacon is on, the LEDs on the front panel of the switch run alternately from left to right and right to left. The color is yellow. When the beacon is off, each LED will be in their its regular status indicating color and state.') swBeaconAdmStatus = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 19), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("on", 1), ("off", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swBeaconAdmStatus.setStatus('current') if mibBuilder.loadTexts: swBeaconAdmStatus.setDescription('The desired status of the switch beacon. When the beacon is set to on, the LEDs on the front panel of the switch run alternately from left to right and right to left. The color is yellow. When the beacon is set to off, each LED will be in its regular status indicating color and state.') swDiagResult = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("sw-ok", 1), ("sw-faulty", 2), ("sw-embedded-port-fault", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDiagResult.setStatus('current') if mibBuilder.loadTexts: swDiagResult.setDescription('The result of the power-on startup (POST) diagnostics.') swNumSensors = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 21), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swNumSensors.setStatus('current') if mibBuilder.loadTexts: swNumSensors.setDescription('The number of sensors inside the switch.') swSensorTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 22), ) if mibBuilder.loadTexts: swSensorTable.setStatus('current') if mibBuilder.loadTexts: swSensorTable.setDescription('The table of sensor entries.') swSensorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 22, 1), ).setIndexNames((0, "SW-MIB", "swSensorIndex")) if mibBuilder.loadTexts: swSensorEntry.setStatus('current') if mibBuilder.loadTexts: swSensorEntry.setDescription('An entry of the sensor information.') swSensorIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 22, 1, 1), SwSensorIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: swSensorIndex.setStatus('current') if mibBuilder.loadTexts: swSensorIndex.setDescription('This object identifies the sensor.') swSensorType = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 22, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("temperature", 1), ("fan", 2), ("power-supply", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swSensorType.setStatus('current') if mibBuilder.loadTexts: swSensorType.setDescription('This object identifies the sensor type.') swSensorStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 22, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("unknown", 1), ("faulty", 2), ("below-min", 3), ("nominal", 4), ("above-max", 5), ("absent", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swSensorStatus.setStatus('current') if mibBuilder.loadTexts: swSensorStatus.setDescription('The current status of the sensor.') swSensorValue = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 22, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swSensorValue.setStatus('current') if mibBuilder.loadTexts: swSensorValue.setDescription('The current value (reading) of the sensor. The value, -2147483648, represents an unknown quantity. It also means that the sensor does not have the capability to measure the actual value. In V2.0, the temperature sensor value will be in Celsius; the fan value will be in RPM (revolution per minute); and the power supply sensor reading will be unknown.') swSensorInfo = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 22, 1, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swSensorInfo.setStatus('current') if mibBuilder.loadTexts: swSensorInfo.setDescription("Additional displayable information on the sensor. In V2.x, it contains the sensor type and number in textual format. For example, 'Temp 3', 'Fan 6'.") swTrackChangesInfo = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 23), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: swTrackChangesInfo.setStatus('current') if mibBuilder.loadTexts: swTrackChangesInfo.setDescription('Track changes string. For trap only') swID = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 24), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swID.setStatus('current') if mibBuilder.loadTexts: swID.setDescription('The number of the logical switch (0/1)') swEtherIPAddress = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 25), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swEtherIPAddress.setStatus('current') if mibBuilder.loadTexts: swEtherIPAddress.setDescription('The IP Address of the Ethernet interface of this logical switch.') swEtherIPMask = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 26), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swEtherIPMask.setStatus('current') if mibBuilder.loadTexts: swEtherIPMask.setDescription('The IP Mask of the Ethernet interface of this logical switch.') swFCIPAddress = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 27), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCIPAddress.setStatus('current') if mibBuilder.loadTexts: swFCIPAddress.setDescription('The IP Address of the FC interface of this logical switch.') swFCIPMask = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 28), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCIPMask.setStatus('current') if mibBuilder.loadTexts: swFCIPMask.setDescription('The IP Mask of the FC interface of this logical switch.') swIPv6Address = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 29), DisplayString()) if mibBuilder.loadTexts: swIPv6Address.setStatus('current') if mibBuilder.loadTexts: swIPv6Address.setDescription('IPV6 address.') swIPv6Status = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 30), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("tentative", 1), ("preferred", 2), ("ipdeprecated", 3), ("inactive", 4)))) if mibBuilder.loadTexts: swIPv6Status.setStatus('current') if mibBuilder.loadTexts: swIPv6Status.setDescription('The current status of ipv6 address.') swModel = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("switch7500", 1), ("switch7500E", 2), ("other", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swModel.setStatus('current') if mibBuilder.loadTexts: swModel.setDescription('Indicates whether the switch is 7500 or 7500E .') swTestString = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 32), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 255))) if mibBuilder.loadTexts: swTestString.setStatus('current') if mibBuilder.loadTexts: swTestString.setDescription('presence of this string represents test trap.') swPortList = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 33), OctetString()) if mibBuilder.loadTexts: swPortList.setStatus('current') if mibBuilder.loadTexts: swPortList.setDescription('This string represents the list of ports and its WWN when ports moved from one switch to another.') swBrcdTrapBitMask = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 34), Integer32()) if mibBuilder.loadTexts: swBrcdTrapBitMask.setStatus('current') if mibBuilder.loadTexts: swBrcdTrapBitMask.setDescription('Type of notification will be represented by a single bit in this variable. 0x01 - Fabric change event 0x02 - Device change event 0x04 - Fapwwn change event 0x08 - FDMI events.') swFCPortPrevType = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 35), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("fl-port", 3), ("f-port", 4), ("e-port", 5), ("g-port", 6), ("ex-port", 7)))) if mibBuilder.loadTexts: swFCPortPrevType.setStatus('current') if mibBuilder.loadTexts: swFCPortPrevType.setDescription('This represents port type of a port before it goes online/offline and it is valid only in swFcPortSCN trap') swDeviceStatus = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 1, 36), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("login", 1), ("logout", 2), ("unknown", 3)))) if mibBuilder.loadTexts: swDeviceStatus.setStatus('current') if mibBuilder.loadTexts: swDeviceStatus.setDescription('This represents the attached device status. The status will change whenever port/node goes to online/offline') swDomainID = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 1), SwDomainIndex()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDomainID.setStatus('current') if mibBuilder.loadTexts: swDomainID.setDescription('The current Fibre Channel domain ID of the switch. To set a new value, the switch (swAdmStatus) must be in offline or testing state.') swPrincipalSwitch = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("yes", 1), ("no", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swPrincipalSwitch.setStatus('current') if mibBuilder.loadTexts: swPrincipalSwitch.setDescription('This object indicates whether the switch is the Principal switch as per FC-SW.') swNumNbs = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swNumNbs.setStatus('current') if mibBuilder.loadTexts: swNumNbs.setDescription('The number of Inter-Switch Links in the (immediate) neighborhood.') swNbTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 9), ) if mibBuilder.loadTexts: swNbTable.setStatus('current') if mibBuilder.loadTexts: swNbTable.setDescription('This table contains the ISLs in the immediate neighborhood of the switch.') swNbEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 9, 1), ).setIndexNames((0, "SW-MIB", "swNbIndex")) if mibBuilder.loadTexts: swNbEntry.setStatus('current') if mibBuilder.loadTexts: swNbEntry.setDescription('An entry containing each neighbor ISL parameters.') swNbIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 9, 1, 1), SwNbIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: swNbIndex.setStatus('current') if mibBuilder.loadTexts: swNbIndex.setDescription('This object identifies the neighbor ISL entry.') swNbMyPort = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 9, 1, 2), SwPortIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: swNbMyPort.setStatus('current') if mibBuilder.loadTexts: swNbMyPort.setDescription('This is the port that has an ISL to another switch.') swNbRemDomain = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 9, 1, 3), SwDomainIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: swNbRemDomain.setStatus('current') if mibBuilder.loadTexts: swNbRemDomain.setDescription('This is the Fibre Channel domain on the other end of the ISL.') swNbRemPort = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 9, 1, 4), SwPortIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: swNbRemPort.setStatus('current') if mibBuilder.loadTexts: swNbRemPort.setDescription('This is the port index on the other end of the ISL.') swNbBaudRate = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 9, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8, 16, 32, 64, 128, 256, 512))).clone(namedValues=NamedValues(("other", 1), ("oneEighth", 2), ("quarter", 4), ("half", 8), ("full", 16), ("double", 32), ("quadruple", 64), ("octuple", 128), ("decuple", 256), ("sexdecuple", 512)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swNbBaudRate.setStatus('current') if mibBuilder.loadTexts: swNbBaudRate.setDescription('The baud rate of the ISL.') swNbIslState = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 9, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("sw-down", 0), ("sw-init", 1), ("sw-internal2", 2), ("sw-internal3", 3), ("sw-internal4", 4), ("sw-active", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swNbIslState.setStatus('current') if mibBuilder.loadTexts: swNbIslState.setDescription('The current state of the ISL. The swNbIslState will be 0 when ISL is in incompatible state or port is a slave port.') swNbIslCost = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 9, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swNbIslCost.setStatus('current') if mibBuilder.loadTexts: swNbIslCost.setDescription('The current link cost of the ISL.') swNbRemPortName = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 9, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swNbRemPortName.setStatus('current') if mibBuilder.loadTexts: swNbRemPortName.setDescription('The World_wide_Name of the remote port.') swFabricMemTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 10), ) if mibBuilder.loadTexts: swFabricMemTable.setStatus('current') if mibBuilder.loadTexts: swFabricMemTable.setDescription('This table contains information on the member switches of a fabric. This may not be available on all versions of Fabric OS.') swFabricMemEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 10, 1), ).setIndexNames((0, "SW-MIB", "swFabricMemWwn")) if mibBuilder.loadTexts: swFabricMemEntry.setStatus('current') if mibBuilder.loadTexts: swFabricMemEntry.setDescription('An entry containing each switch in the fabric.') swFabricMemWwn = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 10, 1, 1), FcWwn()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFabricMemWwn.setStatus('current') if mibBuilder.loadTexts: swFabricMemWwn.setDescription('This object identifies the World wide name of the member switch.') swFabricMemDid = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 10, 1, 2), SwDomainIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFabricMemDid.setStatus('current') if mibBuilder.loadTexts: swFabricMemDid.setDescription('This object identifies the domain id of the member switch.') swFabricMemName = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 10, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFabricMemName.setStatus('current') if mibBuilder.loadTexts: swFabricMemName.setDescription('This object identifies the name of the member switch.') swFabricMemEIP = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 10, 1, 4), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFabricMemEIP.setStatus('current') if mibBuilder.loadTexts: swFabricMemEIP.setDescription('This object identifies the ethernet IP address of the member switch.') swFabricMemFCIP = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 10, 1, 5), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFabricMemFCIP.setStatus('current') if mibBuilder.loadTexts: swFabricMemFCIP.setDescription('This object identifies the Fibre Channel IP address of the member switch.') swFabricMemGWIP = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 10, 1, 6), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFabricMemGWIP.setStatus('current') if mibBuilder.loadTexts: swFabricMemGWIP.setDescription('This object identifies the Gateway IP address of the member switch.') swFabricMemType = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 10, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFabricMemType.setStatus('current') if mibBuilder.loadTexts: swFabricMemType.setDescription('This object identifies the member switch type.') swFabricMemShortVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 10, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 24))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFabricMemShortVersion.setStatus('current') if mibBuilder.loadTexts: swFabricMemShortVersion.setDescription('This object identifies Fabric OS version of the member switch.') swIDIDMode = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swIDIDMode.setStatus('current') if mibBuilder.loadTexts: swIDIDMode.setDescription('Status of Insistent Domain ID (IDID) mode. Status indicating IDID mode is enabled or not.') swPmgrEventType = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 6))).clone(namedValues=NamedValues(("create", 0), ("delete", 1), ("moveport", 2), ("fidchange", 3), ("basechange", 4), ("vfstatechange", 6)))) if mibBuilder.loadTexts: swPmgrEventType.setStatus('current') if mibBuilder.loadTexts: swPmgrEventType.setDescription('Indicates Partition manager event type.') swPmgrEventTime = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 13), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))) if mibBuilder.loadTexts: swPmgrEventTime.setStatus('current') if mibBuilder.loadTexts: swPmgrEventTime.setDescription('This object identifies the date and time when this pmgr event occurred, in textual format.') swPmgrEventDescr = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 14), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))) if mibBuilder.loadTexts: swPmgrEventDescr.setStatus('current') if mibBuilder.loadTexts: swPmgrEventDescr.setDescription('This object identifies the textual description of the pmgr event.') swVfId = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swVfId.setStatus('current') if mibBuilder.loadTexts: swVfId.setDescription('The Virtual fabric id.') swVfName = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 2, 16), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: swVfName.setStatus('current') if mibBuilder.loadTexts: swVfName.setDescription('This represents the virtual fabric name configured in the switch') swAgtCmtyTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 4, 11), ) if mibBuilder.loadTexts: swAgtCmtyTable.setStatus('deprecated') if mibBuilder.loadTexts: swAgtCmtyTable.setDescription('A table that contains, one entry for each Community, the access control and parameters of the Community.') swauthProtocolPassword = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 4, 12), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swauthProtocolPassword.setStatus('current') if mibBuilder.loadTexts: swauthProtocolPassword.setDescription('This entry is created specific to the Pharos switch to change the password for the auth protocol to reserved user DirectorServerSNMPv3User') swprivProtocolPassword = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 4, 13), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swprivProtocolPassword.setStatus('current') if mibBuilder.loadTexts: swprivProtocolPassword.setDescription('This entry is created specific to the Pharos switch to change the password for the priv protocol to reserved user DirectorServerSNMPv3User') swAgtCmtyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 4, 11, 1), ).setIndexNames((0, "SW-MIB", "swAgtCmtyIdx")) if mibBuilder.loadTexts: swAgtCmtyEntry.setStatus('deprecated') if mibBuilder.loadTexts: swAgtCmtyEntry.setDescription('An entry containing the Community parameters.') swAgtCmtyIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 4, 11, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 6))).setMaxAccess("readonly") if mibBuilder.loadTexts: swAgtCmtyIdx.setStatus('deprecated') if mibBuilder.loadTexts: swAgtCmtyIdx.setDescription('This object identifies the SNMPv1 Community entry.') swAgtCmtyStr = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 4, 11, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(2, 16))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swAgtCmtyStr.setStatus('deprecated') if mibBuilder.loadTexts: swAgtCmtyStr.setDescription('This is a Community string supported by the agent. If a new value is set successfully, it takes effect immediately.') swAgtTrapRcp = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 4, 11, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swAgtTrapRcp.setStatus('deprecated') if mibBuilder.loadTexts: swAgtTrapRcp.setDescription('This is the trap recipient associated with the Community. If a new value is set successfully, it takes effect immediately.') swAgtTrapSeverityLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 4, 11, 1, 4), SwSevType()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swAgtTrapSeverityLevel.setStatus('deprecated') if mibBuilder.loadTexts: swAgtTrapSeverityLevel.setDescription("This is the trap severity level associated with the swAgtTrapRcp. The trap severity level in conjunction with the an event's severity level. When an event occurs and if its severity level is at or below the set value, the SNMP trap is sent to configured trap recipients. The severity level is limited to particular events. If a new value is set successfully, it takes effect immediately.") swFCPortCapacity = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortCapacity.setStatus('current') if mibBuilder.loadTexts: swFCPortCapacity.setDescription('The maximum number of of physical ports on the switch. This will include ports of the protocol: FC, FCIP(GE ports), VE(FCIP)...') swFCPortTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2), ) if mibBuilder.loadTexts: swFCPortTable.setStatus('current') if mibBuilder.loadTexts: swFCPortTable.setDescription('A table that contains, one entry for each switch port, configuration and service parameters of the port.') swFCPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1), ).setIndexNames((0, "SW-MIB", "swFCPortIndex")) if mibBuilder.loadTexts: swFCPortEntry.setStatus('current') if mibBuilder.loadTexts: swFCPortEntry.setDescription('An entry containing the configuration and service parameters of the switch port.') swFCPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 1), SwPortIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortIndex.setStatus('current') if mibBuilder.loadTexts: swFCPortIndex.setDescription('This object identifies the switch port index. Note that the value of a port index is 1 higher than the port number labeled on the front panel. E.g. port index 1 correspond to port number 0.') swFCPortType = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("stitch", 1), ("flannel", 2), ("loom", 3), ("bloom", 4), ("rdbloom", 5), ("wormhole", 6), ("other", 7), ("unknown", 8)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortType.setStatus('current') if mibBuilder.loadTexts: swFCPortType.setDescription('This object identifies the type of switch port. It may be of type stitch(1), flannel(2), loom(3) , bloom(4),rdbloom(5) or wormhole(6).') swFCPortPhyState = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 255))).clone(namedValues=NamedValues(("noCard", 1), ("noTransceiver", 2), ("laserFault", 3), ("noLight", 4), ("noSync", 5), ("inSync", 6), ("portFault", 7), ("diagFault", 8), ("lockRef", 9), ("validating", 10), ("invalidModule", 11), ("noSigDet", 14), ("unknown", 255)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortPhyState.setStatus('current') if mibBuilder.loadTexts: swFCPortPhyState.setDescription('This object identifies the physical state of the port: noCard(1) no card present in this switch slot; noTransceiver(2) no Transceiver module in this port. noGbic(2) was used previously. Transceiver is the generic name for GBIC, SFP etc.; laserFault(3) the module is signaling a laser fault (defective Transceiver); noLight(4) the module is not receiving light; noSync(5) the module is receiving light but is out of sync; inSync(6) the module is receiving light and is in sync; portFault(7) the port is marked faulty (defective Transceiver, cable or device); diagFault(8) the port failed diagnostics (defective G_Port or FL_Port card or motherboard); lockRef(9) the port is locking to the reference signal. validating(10) Validation is in progress invalidModule(11) Invalid SFP unknown(255) unknown. ') swFCPortOpStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown", 0), ("online", 1), ("offline", 2), ("testing", 3), ("faulty", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortOpStatus.setStatus('current') if mibBuilder.loadTexts: swFCPortOpStatus.setDescription('This object identifies the operational status of the port. The online(1) state indicates that user frames can be passed. The unknown(0) state indicates that likely the port module is physically absent (see swFCPortPhyState).') swFCPortAdmStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("online", 1), ("offline", 2), ("testing", 3), ("faulty", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFCPortAdmStatus.setStatus('current') if mibBuilder.loadTexts: swFCPortAdmStatus.setDescription('The desired state of the port. A management station may place the port in a desired state by setting this object accordingly. The testing(3) state indicates that no user frames can be passed. As the result of either explicit management action or per configuration information accessible by the switch, swFCPortAdmStatus is then changed to either the online(1) or testing(3) states, or remains in the offline(2) state.') swFCPortLinkState = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2), ("loopback", 3)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFCPortLinkState.setStatus('current') if mibBuilder.loadTexts: swFCPortLinkState.setDescription("This object indicates the link state of the port. The value may be: enabled(1) - port is allowed to participate in the FC-PH protocol with its attached port (or ports if it is in a FC-AL loop); disabled(2) - the port is not allowed to participate in the FC-PH protocol with its attached port(s); loopback(3) - the port may transmit frames through an internal path to verify the health of the transmitter and receiver path. Note that when the port's link state changes, its operational status (swFCPortOpStatus) will be affected.") swFCPortTxType = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("lw", 2), ("sw", 3), ("ld", 4), ("cu", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortTxType.setStatus('current') if mibBuilder.loadTexts: swFCPortTxType.setDescription('This object indicates the media transmitter type of the port. The value may be: unknown(1) cannot determined to the port driver lw(2) long wave laser sw(3) short wave laser ld(4) long wave LED cu(5) copper (electrical).') swFCPortTxWords = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortTxWords.setStatus('current') if mibBuilder.loadTexts: swFCPortTxWords.setDescription('This object counts the number of Fibre Channel words that the port has transmitted.') swFCPortRxWords = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxWords.setStatus('current') if mibBuilder.loadTexts: swFCPortRxWords.setDescription('This object counts the number of Fibre Channel words that the port has received.') swFCPortTxFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortTxFrames.setStatus('current') if mibBuilder.loadTexts: swFCPortTxFrames.setDescription('This object counts the number of (Fibre Channel) frames that the port has transmitted.') swFCPortRxFrames = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxFrames.setStatus('current') if mibBuilder.loadTexts: swFCPortRxFrames.setDescription('This object counts the number of (Fibre Channel) frames that the port has received.') swFCPortRxC2Frames = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxC2Frames.setStatus('current') if mibBuilder.loadTexts: swFCPortRxC2Frames.setDescription('This object counts the number of Class 2 frames that the port has received.') swFCPortRxC3Frames = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxC3Frames.setStatus('current') if mibBuilder.loadTexts: swFCPortRxC3Frames.setDescription('This object counts the number of Class 3 frames that the port has received.') swFCPortRxLCs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxLCs.setStatus('current') if mibBuilder.loadTexts: swFCPortRxLCs.setDescription('This object counts the number of Link Control frames that the port has received.') swFCPortRxMcasts = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxMcasts.setStatus('current') if mibBuilder.loadTexts: swFCPortRxMcasts.setDescription('This object counts the number of Multicast frames that the port has received.') swFCPortTooManyRdys = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortTooManyRdys.setStatus('current') if mibBuilder.loadTexts: swFCPortTooManyRdys.setDescription('This object counts the number of times when RDYs exceeds the frames received.') swFCPortNoTxCredits = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortNoTxCredits.setStatus('current') if mibBuilder.loadTexts: swFCPortNoTxCredits.setDescription('This object counts the number of times when the transmit credit has reached zero.') swFCPortRxEncInFrs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxEncInFrs.setStatus('current') if mibBuilder.loadTexts: swFCPortRxEncInFrs.setDescription('This object counts the number of encoding error or disparity error inside frames received.') swFCPortRxCrcs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxCrcs.setStatus('current') if mibBuilder.loadTexts: swFCPortRxCrcs.setDescription('This object counts the number of CRC errors detected for frames received.') swFCPortRxTruncs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxTruncs.setStatus('current') if mibBuilder.loadTexts: swFCPortRxTruncs.setDescription('This object counts the number of truncated frames that the port has received.') swFCPortRxTooLongs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxTooLongs.setStatus('current') if mibBuilder.loadTexts: swFCPortRxTooLongs.setDescription('This object counts the number of received frames that are too long.') swFCPortRxBadEofs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxBadEofs.setStatus('current') if mibBuilder.loadTexts: swFCPortRxBadEofs.setDescription('This object counts the number of received frames that have bad EOF delimiter.') swFCPortRxEncOutFrs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 26), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxEncOutFrs.setStatus('current') if mibBuilder.loadTexts: swFCPortRxEncOutFrs.setDescription('This object counts the number of encoding error or disparity error outside frames received.') swFCPortRxBadOs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 27), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortRxBadOs.setStatus('current') if mibBuilder.loadTexts: swFCPortRxBadOs.setDescription('This object counts the number of invalid Ordered Sets received.') swFCPortC3Discards = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 28), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortC3Discards.setStatus('current') if mibBuilder.loadTexts: swFCPortC3Discards.setDescription('This object counts the number of Class 3 frames that the port has discarded.') swFCPortMcastTimedOuts = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 29), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortMcastTimedOuts.setStatus('current') if mibBuilder.loadTexts: swFCPortMcastTimedOuts.setDescription('This object counts the number of Multicast frames that has been timed out.') swFCPortTxMcasts = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 30), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortTxMcasts.setStatus('current') if mibBuilder.loadTexts: swFCPortTxMcasts.setDescription('This object counts the number of Multicast frames that has been transmitted.') swFCPortLipIns = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 31), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortLipIns.setStatus('current') if mibBuilder.loadTexts: swFCPortLipIns.setDescription('This object counts the number of Loop Initializations that has been initiated by loop devices attached.') swFCPortLipOuts = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 32), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortLipOuts.setStatus('current') if mibBuilder.loadTexts: swFCPortLipOuts.setDescription('This object counts the number of Loop Initializations that has been initiated by the port.') swFCPortLipLastAlpa = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 33), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortLipLastAlpa.setStatus('current') if mibBuilder.loadTexts: swFCPortLipLastAlpa.setDescription('This object indicates the Physical Address (AL_PA) of the loop device that initiated the last Loop Initialization.') swFCPortWwn = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 34), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortWwn.setStatus('current') if mibBuilder.loadTexts: swFCPortWwn.setDescription('The World_wide_Name of the Fibre Channel port. The contents of an instance are in the IEEE extended format as specified in FC-PH; the 12-bit port identifier represents the port number within the switch.') swFCPortSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 35), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("one-GB", 1), ("two-GB", 2), ("auto-Negotiate", 3), ("four-GB", 4), ("eight-GB", 5), ("ten-GB", 6), ("unknown", 7), ("sixteen-GB", 8)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFCPortSpeed.setStatus('obsolete') if mibBuilder.loadTexts: swFCPortSpeed.setDescription('The desired baud rate for the port. It can have the values of 1GB (1), 2GB (2), Auto-Negotiate (3), 4GB (4), 8GB (5), 10GB (6), 16GB (8). Some of the above values may not be supported by all type of switches.') swFCPortName = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 36), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortName.setStatus('current') if mibBuilder.loadTexts: swFCPortName.setDescription('A string indicates the name of the addressed port. The names should be persistent across switch reboots. Port names do not have to be unique within a switch or within a fabric.') swFCPortSpecifier = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 37), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortSpecifier.setStatus('current') if mibBuilder.loadTexts: swFCPortSpecifier.setDescription("This string indicates the physical port number of the addressed port. The format of the string is: <slot>/port, where 'slot' being present only for bladed systems. ") swFCPortFlag = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 38), FcPortFlag()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortFlag.setStatus('current') if mibBuilder.loadTexts: swFCPortFlag.setDescription('A bit map of port status flags which includes the information of port type. Currently this will indicate if the port is virtual or physical.') swFCPortBrcdType = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 39), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("unknown", 1), ("other", 2), ("fl-port", 3), ("f-port", 4), ("e-port", 5), ("g-port", 6), ("ex-port", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFCPortBrcdType.setStatus('current') if mibBuilder.loadTexts: swFCPortBrcdType.setDescription('The Brocade port type.') swFCPortDisableReason = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 6, 2, 1, 40), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230))).clone(namedValues=NamedValues(("r-recover-fail", 1), ("r-invalid-reason", 2), ("r-forced", 3), ("r-sw-disabled", 4), ("r-bl-disabled", 5), ("r-slot-off", 6), ("r-sw-enabled", 7), ("r-bl-enabled", 8), ("r-slot-on", 9), ("r-persistid", 10), ("r-sw-violation", 11), ("r-prv-dev-violation", 12), ("r-pub-dev-violation", 13), ("r-port-data-fail", 14), ("r-online-incomplete", 15), ("r-online-route-fail", 16), ("r-inconsistent", 17), ("r-set-vcc-fail", 18), ("r-ecp-in-testing", 19), ("r-elp-in-testing", 20), ("r-ecp-retries-exceeded", 21), ("r-invalid-ecp-state", 22), ("r-bad-ecp-rcvd", 23), ("r-send-rtmark-fail", 24), ("r-send-ecp-fail", 25), ("r-save-link-rtt-fail", 26), ("r-em-incnst", 27), ("r-pci-attach-fail", 28), ("r-buf-starv", 29), ("r-elp-fctl-mismatch", 30), ("r-eport-disabled", 31), ("r-trunk-with-vcxlt", 32), ("r-sw-fl-port-not-ready", 33), ("r-link-reinit", 34), ("r-domain-id-change", 35), ("r-auth-rejected", 36), ("r-auth-timeout", 37), ("r-auth-fail-retry", 38), ("r-fcr-conf-mismatch1", 39), ("r-fcr-conf-mismatch2", 40), ("r-fcr-port-ld-mode-mismatch", 41), ("r-fcr-ld-credit-mismatch", 42), ("r-fcr-set-vcc-failed", 43), ("r-fcr-set-rtc-failed", 44), ("r-fcr-elp-ver-inconsis", 45), ("r-fcr-elp-fctl-mismatch", 46), ("r-fcr-pid-mismatch", 47), ("r-fcr-tov-mismatch", 48), ("r-fcr-ld-incompat", 49), ("r-fcr-isolated", 50), ("r-elp-retries-exceeded", 51), ("r-fcr-exports-exceeded", 52), ("r-fcr-license", 53), ("r-fcr-conf-ex", 54), ("r-fcr-ftag-over", 55), ("r-fcr-ftag-conflict", 56), ("r-fcr-fowner-conflict", 57), ("r-fcr-zone-resource", 58), ("r-fcr-port-state-to", 59), ("r-fcr-authn-reject", 60), ("r-fcr-sec-fcs-list", 61), ("r-fcr-sec-failure", 62), ("r-fcr-incompatible-mode", 63), ("r-fcr-sec-scc-list", 64), ("r-fcr-generic", 65), ("r-sw-ex-port-not-ready", 66), ("r-fcr-class-f-incompat", 67), ("r-fcr-class-n-incompat", 68), ("r-fcr-invalid-flow-rcvd", 69), ("r-fcr-state-disabled", 70), ("r-fdd-strict-exist", 71), ("r-last-port-disable-msg", 72), ("r-sw-l-port-not-support", 73), ("r-peer-port-in-di-zone", 74), ("r-zone-incompat", 75), ("r-sw-config-l-port-not-support", 76), ("r-sw-port-mirror-configured", 77), ("r-nportlogin-inprogress", 78), ("r-nonpiv", 79), ("r-nomapping", 80), ("r-unknowntype", 81), ("r-nportoffline", 82), ("r-flogifailed", 83), ("r-nportbusy", 84), ("r-noflogi", 85), ("r-noflogiresp", 86), ("r-flogidupalpa", 87), ("r-loopcfg", 88), ("r-noenclicense", 89), ("r-nofiportmapping", 90), ("r-brcdfabconn", 91), ("r-port-reset", 92), ("r-floginport", 93), ("r-fdd-strict-conflict", 94), ("r-fdd-cfg-conflict", 95), ("r-fdd-cfg-conflict-na-neigh", 96), ("r-fcr-insistent-front-did-mismatch", 97), ("r-fcr-fabric-binding-failure", 98), ("r-fcr-non-standard-domain-offset", 99), ("r-area-in-use", 100), ("r-mstr-diff-pg", 101), ("r-mstr-diff-area", 102), ("r-ta-not-supported", 103), ("r-eport-not-supported", 104), ("r-fport-not-supported", 105), ("r-cfg-not-supported", 106), ("r-port-ll-th-exceeded", 107), ("r-port-synl-th-exceeded", 108), ("r-port-pe-th-exceeded", 109), ("f-port-disable-no-trk-lic", 110), ("r-port-inw-th-exceeded", 111), ("r-port-crc-th-exceeded", 112), ("f-port-tr-disable-speed-not-ok", 113), ("r-port-auto-disable", 114), ("r-fcr-export-in-non-base-sw", 115), ("r-base-switch-supports-no-device", 116), ("r-port-trunk-proto-error", 117), ("r-no-area-avail", 118), ("r-cannot-unbind-existing-area", 119), ("r-cannot-use-10bit-area", 120), ("r-authentication-required", 121), ("r-port-lr-th-exceeded", 122), ("r-fcr-export-lf-conflict", 123), ("r-incompat", 124), ("r-did-overlap", 125), ("r-zone-conflict", 126), ("r-eport-seg", 127), ("r-no-license", 128), ("r-platform-db", 129), ("r-sec-incompat", 130), ("r-sec-violation", 131), ("r-ecp-longdist", 132), ("r-dup-wwn", 133), ("r-eport-isolated", 134), ("r-ad", 135), ("r-esc-did-offset", 136), ("r-esc-etiz", 137), ("r-esc-fid", 138), ("r-safe-zone", 139), ("r-vf", 140), ("r-vf-bs-incompat", 141), ("r-pers-pid-on-lport", 142), ("r-pers-pid-portaddr-collision", 143), ("r-pers-pid-port-on-same-area", 144), ("r-pers-pid-port-addr-bnd", 145), ("r-msfr", 146), ("r-sw-halfbw-lic", 147), ("r-1g-mode-incompat", 148), ("r-10g-mode-incompat", 149), ("r-dual-mode-incompat", 150), ("r-implict-plt-service-block", 151), ("r-port-st-th-exceeded", 152), ("r-port-c3txto-th-exceeded", 153), ("r-eport-not-supported-def-sw", 154), ("r-eport-ll-th-exceeded", 155), ("r-eport-synl-th-exceeded", 156), ("r-eport-pe-th-exceeded", 157), ("r-eport-inw-th-exceeded", 158), ("r-eport-crc-th-exceeded", 159), ("r-eport-lr-th-exceeded", 160), ("r-eport-st-th-exceeded", 161), ("r-eport-c3txto-th-exceeded", 162), ("r-fopport-ll-th-exceeded", 163), ("r-fopport-synl-th-exceeded", 164), ("r-fopport-pe-th-exceeded", 165), ("r-fopport-inw-th-exceeded", 166), ("r-fopport-crc-th-exceeded", 167), ("r-fopport-lr-th-exceeded", 168), ("r-fopport-st-th-exceeded", 169), ("r-fopport-c3txto-th-exceeded", 170), ("r-fcuport-ll-th-exceeded", 171), ("r-fcuport-synl-th-exceeded", 172), ("r-fcuport-pe-th-exceeded", 173), ("r-fcuport-inw-th-exceeded", 174), ("r-fcuport-crc-th-exceeded", 175), ("r-fcuport-lr-th-exceeded", 176), ("r-fcuport-st-th-exceeded", 177), ("r-fcuport-c3txto-th-exceeded", 178), ("r-port-no-area-avail-pers-disable", 179), ("r-eport-locked", 180), ("r-enh-tizone", 181), ("r-sw-port-swap-not-supported", 182), ("r-fport-slow-drain-condition", 183), ("r-esc-vlanid", 184), ("r-port-recov-state", 185), ("r-port-auto-disable-losn", 186), ("r-port-auto-disable-losg", 187), ("r-port-auto-disable-ols", 188), ("r-port-auto-disable-nos", 189), ("r-port-auto-disable-lip", 190), ("r-port-compression", 191), ("r-port-encryption", 192), ("r-port-enccomp-res", 193), ("r-port-decommissioned", 194), ("r-port-dportmode", 195), ("r-port-dport-incompat", 196), ("r-port-enc-comp-mismatch", 197), ("r-non-rcs-rem-dom", 198), ("r-port-fips-comp-mismatch", 199), ("r-port-non-fips-comp-mismatch", 200), ("r-port-enc-auth-disabled", 201), ("r-port-disable-on-zeroize", 202), ("r-cfgspeed-not-supported", 203), ("r-fcr-ex-port-not-allowed", 204), ("r-port-duplicate-pwwn", 205), ("r-fcr-trunk-master-sfid-not-set", 206), ("r-nportistrunkmem", 207), ("r-policynotsupported", 208), ("r-no-icl-license", 209), ("r-no-ten-gig-license", 210), ("r-fdd-strict-scc-conflict", 211), ("r-fdd-strict-dcc-conflict", 212), ("r-fdd-strict-fcs-conflict", 213), ("r-fdd-strict-fabwide-conflict", 214), ("r-fdd-strict-pwd-conflict", 215), ("r-fcr-interop-conf", 216), ("r-port-enc-interop-conflict", 217), ("r-port-comp-interop-conflict", 218), ("r-no-port-open-rsp", 219), ("r-no-eicl-license", 220), ("r-eicl-license-limited", 221), ("r-esc-base-sw", 222), ("r-sw-cpu-overload", 223), ("r-no-icl-pod2-license", 224), ("r-port-area-mismatch-pers-disable", 225), ("r-unauthorized-device", 226), ("r-max-flogi-reached", 227), ("r-auth-not-supported-in-switch", 228), ("r-icl-ex-on-non-vf", 229), ("r-user-disabled-reason", 230)))) if mibBuilder.loadTexts: swFCPortDisableReason.setStatus('current') if mibBuilder.loadTexts: swFCPortDisableReason.setDescription('It indicates the state change reason when port goes from online to offline') swNsLocalNumEntry = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsLocalNumEntry.setStatus('current') if mibBuilder.loadTexts: swNsLocalNumEntry.setDescription('The number of local Name Server entries.') swNsLocalTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2), ) if mibBuilder.loadTexts: swNsLocalTable.setStatus('current') if mibBuilder.loadTexts: swNsLocalTable.setDescription('The table of local Name Server entries.') swNsLocalEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1), ).setIndexNames((0, "SW-MIB", "swNsEntryIndex")) if mibBuilder.loadTexts: swNsLocalEntry.setStatus('current') if mibBuilder.loadTexts: swNsLocalEntry.setDescription('An entry of the local Name Server database.') swNsEntryIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsEntryIndex.setStatus('current') if mibBuilder.loadTexts: swNsEntryIndex.setDescription('The object identifies the Name Server database entry.') swNsPortID = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsPortID.setStatus('current') if mibBuilder.loadTexts: swNsPortID.setDescription('The object identifies the Fibre Channel port address ID of the entry.') swNsPortType = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("nPort", 1), ("nlPort", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsPortType.setStatus('current') if mibBuilder.loadTexts: swNsPortType.setDescription('The object identifies the type of port: N_Port, NL_Port, etc., for this entry. The type is defined in FC-GS-2.') swNsPortName = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 4), FcWwn()).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsPortName.setStatus('current') if mibBuilder.loadTexts: swNsPortName.setDescription('The object identifies the Fibre Channel World_wide Name of the port entry.') swNsPortSymb = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsPortSymb.setStatus('current') if mibBuilder.loadTexts: swNsPortSymb.setDescription("The object identifies the contents of a Symbolic Name of the port entry. In FC-GS-2, a Symbolic Name consists of a byte array of 1 through 255 bytes, and the first byte of the array specifies the length of its 'contents'. This object variable corresponds to the 'contents' of the Symbolic Name, without the first byte.") swNsNodeName = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 6), FcWwn()).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsNodeName.setStatus('current') if mibBuilder.loadTexts: swNsNodeName.setDescription('The object identifies the Fibre Channel World_wide Name of the associated node as defined in FC-GS-2.') swNsNodeSymb = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsNodeSymb.setStatus('current') if mibBuilder.loadTexts: swNsNodeSymb.setDescription("The object identifies the contents of a Symbolic Name of the the node associated with the entry. In FC-GS-2, a Symbolic Name consists of a byte array of 1 through 255 bytes, and the first byte of the array specifies the length of its 'contents'. This object variable corresponds to the 'contents' of the Symbolic Name, without the first byte (specifying the length).") swNsIPA = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsIPA.setStatus('current') if mibBuilder.loadTexts: swNsIPA.setDescription('The object identifies the Initial Process Associator of the node for the entry as defined in FC-GS-2.') swNsIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 9), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsIpAddress.setStatus('current') if mibBuilder.loadTexts: swNsIpAddress.setDescription('The object identifies the IP address of the node for the entry as defined in FC-GS-2. The format of the address is in IPv6.') swNsCos = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15))).clone(namedValues=NamedValues(("class-F", 1), ("class-1", 2), ("class-F-1", 3), ("class-2", 4), ("class-F-2", 5), ("class-1-2", 6), ("class-F-1-2", 7), ("class-3", 8), ("class-F-3", 9), ("class-1-3", 10), ("class-F-1-3", 11), ("class-2-3", 12), ("class-F-2-3", 13), ("class-1-2-3", 14), ("class-F-1-2-3", 15)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsCos.setStatus('current') if mibBuilder.loadTexts: swNsCos.setDescription('The object identifies the class of services supported by the port. The value is a bit-map defined as follows: o bit 0 is class F, o bit 1 is class 1, o bit 2 is class 2, o bit 3 is class 3, o bit 4 is class 4, etc.') swNsFc4 = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 11), OctetString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).setFixedLength(32)).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsFc4.setStatus('current') if mibBuilder.loadTexts: swNsFc4.setDescription('The object identifies the FC-4s supported by the port as defined in FC-GS-2.') swNsIpNxPort = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 12), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsIpNxPort.setStatus('current') if mibBuilder.loadTexts: swNsIpNxPort.setDescription('The object identifies IpAddress of the Nx_port for the entry.') swNsWwn = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 13), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsWwn.setStatus('current') if mibBuilder.loadTexts: swNsWwn.setDescription('The object identifies the World Wide Name (WWN) of the Fx_port for the entry.') swNsHardAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 7, 2, 1, 14), OctetString().subtype(subtypeSpec=ValueSizeConstraint(3, 3)).setFixedLength(3)).setMaxAccess("readonly") if mibBuilder.loadTexts: swNsHardAddr.setStatus('current') if mibBuilder.loadTexts: swNsHardAddr.setDescription('The object identifies the 24-bit hard address of the node for the entry.') swEventTrapLevel = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 8, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("none", 0), ("critical", 1), ("error", 2), ("warning", 3), ("informational", 4), ("debug", 5)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swEventTrapLevel.setStatus('deprecated') if mibBuilder.loadTexts: swEventTrapLevel.setDescription("swAgtTrapSeverityLevel, in absence of swEventTrapLevel, specifies the Trap Severity Level of each defined trap recipient host. This object specifies the swEventTrap level in conjunction with an event's severity level. When an event occurs and if its severity level is at or below the value specified by this object instance, the agent will send the associated swEventTrap to configured recipients.") swEventNumEntries = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 8, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swEventNumEntries.setStatus('current') if mibBuilder.loadTexts: swEventNumEntries.setDescription('The number of entries in the Event Table.') swEventTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 8, 5), ) if mibBuilder.loadTexts: swEventTable.setStatus('current') if mibBuilder.loadTexts: swEventTable.setDescription('The table of event entries.') swEventEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 8, 5, 1), ).setIndexNames((0, "SW-MIB", "swEventIndex")) if mibBuilder.loadTexts: swEventEntry.setStatus('current') if mibBuilder.loadTexts: swEventEntry.setDescription('An entry of the event table.') swEventIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 8, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swEventIndex.setStatus('current') if mibBuilder.loadTexts: swEventIndex.setDescription('This object identifies the event entry.') swEventTimeInfo = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 8, 5, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: swEventTimeInfo.setStatus('current') if mibBuilder.loadTexts: swEventTimeInfo.setDescription('This object identifies the date and time when this event occurred, in textual format.') swEventLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 8, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("critical", 1), ("error", 2), ("warning", 3), ("informational", 4), ("debug", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swEventLevel.setStatus('current') if mibBuilder.loadTexts: swEventLevel.setDescription('This object identifies the severity level of this event entry.') swEventRepeatCount = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 8, 5, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swEventRepeatCount.setStatus('current') if mibBuilder.loadTexts: swEventRepeatCount.setDescription('This object identifies how many times this particular event has occurred.') swEventDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 8, 5, 1, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: swEventDescr.setStatus('current') if mibBuilder.loadTexts: swEventDescr.setDescription('This object identifies the textual description of the event.') swEventVfId = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 8, 5, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swEventVfId.setStatus('current') if mibBuilder.loadTexts: swEventVfId.setDescription('This object identifies the Virtual fabric id.') class SwFwActs(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) namedValues = NamedValues(("swFwNoAction", 0), ("swFwErrlog", 1), ("swFwSnmptrap", 2), ("swFwErrlogSnmptrap", 3), ("swFwPortloglock", 4), ("swFwErrlogPortloglock", 5), ("swFwSnmptrapPortloglock", 6), ("swFwErrlogSnmptrapPortloglock", 7), ("swFwRn", 8), ("swFwElRn", 9), ("swFwStRn", 10), ("swFwElStRn", 11), ("swFwPlRn", 12), ("swFwElPlRn", 13), ("swFwStPlRn", 14), ("swFwElStPlRn", 15), ("swFwMailAlert", 16), ("swFwMailAlertErrlog", 17), ("swFwMailAlertSnmptrap", 18), ("swFwMailAlertErrlogSnmptrap", 19), ("swFwMailAlertPortloglock", 20), ("swFwMailAlertErrlogPortloglock", 21), ("swFwMailAlertSnmptrapPortloglock", 22), ("swFwMailAlertErrlogSnmptrapPortloglock", 23), ("swFwMailAlertRn", 24), ("swFwElMailAlertRn", 25), ("swFwMailAlertStRn", 26), ("swFwMailAlertElStRn", 27), ("swFwMailAlertPlRn", 28), ("swFwMailAlertElPlRn", 29), ("swFwMailAlertStPlRn", 30), ("swFwMailAlertElStPlRn", 31), ("swFwPf", 32), ("swFwElPf", 33), ("swFwStPf", 34), ("swFwElStPf", 35), ("swFwPlPf", 36), ("swFwElPlPf", 37), ("swFwStPlPf", 38), ("swFwElStPlPf", 39), ("swFwRnPf", 40), ("swFwElRnPf", 41), ("swFwStRnPf", 42), ("swFwElStRnPf", 43), ("swFwPlRnPf", 44), ("swFwElPlRnPf", 45), ("swFwStPlRnPf", 46), ("swFwElStPlRnPf", 47), ("swFwMailAlertPf", 48), ("swFwMailAlertElPf", 49), ("swFwMailAlertStPf", 50), ("swFwMailAlertElStPf", 51), ("swFwMailAlertPlPf", 52), ("swFwMailAlertElPlPf", 53), ("swFwMailAlertStPlPf", 54), ("swFwMailAlertElStPlPf", 55), ("swFwMailAlertRnPf", 56), ("swFwMailAlertElRnPf", 57), ("swFwMailAlertStRnPf", 58), ("swFwMailAlertElStRnPf", 59), ("swFwMailAlertPlRnPf", 60), ("swFwMailAlertElPlRnPf", 61), ("swFwMailAlertStPlRnPf", 62), ("swFwMailAlertElStPlRnPf", 63)) class SwFwLevels(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("swFwReserved", 1), ("swFwDefault", 2), ("swFwCustom", 3)) class SwFwClassesAreas(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152)) namedValues = NamedValues(("swFwEnvTemp", 1), ("swFwEnvFan", 2), ("swFwEnvPs", 3), ("swFwTransceiverTemp", 4), ("swFwTransceiverRxp", 5), ("swFwTransceiverTxp", 6), ("swFwTransceiverCurrent", 7), ("swFwPortLink", 8), ("swFwPortSync", 9), ("swFwPortSignal", 10), ("swFwPortPe", 11), ("swFwPortWords", 12), ("swFwPortCrcs", 13), ("swFwPortRXPerf", 14), ("swFwPortTXPerf", 15), ("swFwPortState", 16), ("swFwFabricEd", 17), ("swFwFabricFr", 18), ("swFwFabricDi", 19), ("swFwFabricSc", 20), ("swFwFabricZc", 21), ("swFwFabricFq", 22), ("swFwFabricFl", 23), ("swFwFabricGs", 24), ("swFwEPortLink", 25), ("swFwEPortSync", 26), ("swFwEPortSignal", 27), ("swFwEPortPe", 28), ("swFwEPortWords", 29), ("swFwEPortCrcs", 30), ("swFwEPortRXPerf", 31), ("swFwEPortTXPerf", 32), ("swFwEPortState", 33), ("swFwFCUPortLink", 34), ("swFwFCUPortSync", 35), ("swFwFCUPortSignal", 36), ("swFwFCUPortPe", 37), ("swFwFCUPortWords", 38), ("swFwFCUPortCrcs", 39), ("swFwFCUPortRXPerf", 40), ("swFwFCUPortTXPerf", 41), ("swFwFCUPortState", 42), ("swFwFOPPortLink", 43), ("swFwFOPPortSync", 44), ("swFwFOPPortSignal", 45), ("swFwFOPPortPe", 46), ("swFwFOPPortWords", 47), ("swFwFOPPortCrcs", 48), ("swFwFOPPortRXPerf", 49), ("swFwFOPPortTXPerf", 50), ("swFwFOPPortState", 51), ("swFwPerfALPACRC", 52), ("swFwPerfEToECRC", 53), ("swFwPerfEToERxCnt", 54), ("swFwPerfEToETxCnt", 55), ("swFwPerffltCusDef", 56), ("swFwTransceiverVoltage", 57), ("swFwSecTelnetViolations", 58), ("swFwSecHTTPViolations", 59), ("swFwSecAPIViolations", 60), ("swFwSecRSNMPViolations", 61), ("swFwSecWSNMPViolations", 62), ("swFwSecSESViolations", 63), ("swFwSecMSViolations", 64), ("swFwSecSerialViolations", 65), ("swFwSecFPViolations", 66), ("swFwSecSCCViolations", 67), ("swFwSecDCCViolations", 68), ("swFwSecLoginViolations", 69), ("swFwSecInvalidTS", 70), ("swFwSecInvalidSign", 71), ("swFwSecInvalidCert", 72), ("swFwSecSlapFail", 73), ("swFwSecSlapBadPkt", 74), ("swFwSecTSOutSync", 75), ("swFwSecNoFcs", 76), ("swFwSecIncompDB", 77), ("swFwSecIllegalCmd", 78), ("swFwSAMTotalDownTime", 79), ("swFwSAMTotalUpTime", 80), ("swFwSAMDurationOfOccur", 81), ("swFwSAMFreqOfOccur", 82), ("swFwResourceFlash", 83), ("swFwEPortUtil", 84), ("swFwEPortPktl", 85), ("swFwPortLr", 86), ("swFwEPortLr", 87), ("swFwFCUPortLr", 88), ("swFwFOPPortLr", 89), ("swFwPortC3Discard", 90), ("swFwEPortC3Discard", 91), ("swFwFCUPortC3Discard", 92), ("swFwFOPPortC3Discard", 93), ("swFwVEPortStateChange", 94), ("swFwVEPortUtil", 95), ("swFwVEPortPktLoss", 96), ("swFwEPortTrunkUtil", 97), ("swFwFCUPortTrunkUtil", 98), ("swFwFOPPortTrunkUtil", 99), ("swFwCPUMemUsage", 100), ("filterFmCfg1", 101), ("filterFmCfg2", 102), ("filterFmCfg3", 103), ("filterFmCfg4", 104), ("filterFmCfg5", 105), ("filterFmCfg6", 106), ("filterFmCfg7", 107), ("filterFmCfg8", 108), ("filterFmCfg9", 109), ("filterFmCfg10", 110), ("filterFmCfg11", 111), ("filterFmCfg12", 112), ("filterFmCfg13", 113), ("filterFmCfg14", 114), ("filterFmCfg15", 115), ("filterFmCfg16", 116), ("filterFmCfg17", 117), ("filterFmCfg18", 118), ("filterFmCfg19", 119), ("filterFmCfg20", 120), ("filterFmCfg21", 121), ("filterFmCfg22", 122), ("filterFmCfg23", 123), ("filterFmCfg24", 124), ("filterFmCfg25", 125), ("filterFmCfg26", 126), ("filterFmCfg27", 127), ("filterFmCfg28", 128), ("filterFmCfg29", 129), ("filterFmCfg30", 130), ("filterFmCfg31", 131), ("filterFmCfg32", 132), ("filterFmCfg33", 133), ("filterFmCfg34", 134), ("filterFmCfg35", 135), ("filterFmCfg36", 136), ("filterFmCfg37", 137), ("filterFmCfg38", 138), ("filterFmCfg39", 139), ("filterFmCfg40", 140), ("filterFmCfg41", 141), ("filterFmCfg42", 142), ("filterFmCfg43", 143), ("filterFmCfg44", 144), ("filterFmCfg45", 145), ("filterFmCfg46", 146), ("filterFmCfg47", 147), ("filterFmCfg48", 148), ("filterFmCfg49", 149), ("filterFmCfg50", 150), ("filterFmCfg51", 151), ("swFwPowerOnHours", 152)) class SwFwWriteVals(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("swFwCancelWrite", 1), ("swFwApplyWrite", 2)) class SwFwTimebase(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5)) namedValues = NamedValues(("swFwTbNone", 1), ("swFwTbSec", 2), ("swFwTbMin", 3), ("swFwTbHour", 4), ("swFwTbDay", 5)) class SwFwStatus(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("disabled", 1), ("enabled", 2)) class SwFwEvent(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7)) namedValues = NamedValues(("started", 1), ("changed", 2), ("exceeded", 3), ("below", 4), ("above", 5), ("inBetween", 6), ("lowBufferCrsd", 7)) class SwFwBehavior(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("triggered", 1), ("continuous", 2)) class SwFwState(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3)) namedValues = NamedValues(("swFwInformative", 1), ("swFwNormal", 2), ("swFwFaulty", 3)) class SwFwLicense(Integer32): subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("swFwLicensed", 1), ("swFwNotLicensed", 2)) swFwFabricWatchLicense = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 1), SwFwLicense()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwFabricWatchLicense.setStatus('current') if mibBuilder.loadTexts: swFwFabricWatchLicense.setDescription('tells if licensed or not.') swFwClassAreaTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2), ) if mibBuilder.loadTexts: swFwClassAreaTable.setStatus('current') if mibBuilder.loadTexts: swFwClassAreaTable.setDescription('The table of classes and areas.') swFwClassAreaEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1), ).setIndexNames((0, "SW-MIB", "swFwClassAreaIndex")) if mibBuilder.loadTexts: swFwClassAreaEntry.setStatus('current') if mibBuilder.loadTexts: swFwClassAreaEntry.setDescription('An entry of the classes and areas.') swFwClassAreaIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 1), SwFwClassesAreas()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwClassAreaIndex.setStatus('current') if mibBuilder.loadTexts: swFwClassAreaIndex.setDescription('This object identifies the class type.') swFwWriteThVals = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 2), SwFwWriteVals()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwWriteThVals.setStatus('current') if mibBuilder.loadTexts: swFwWriteThVals.setDescription('This object is set to apply the value changes.') swFwDefaultUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwDefaultUnit.setStatus('current') if mibBuilder.loadTexts: swFwDefaultUnit.setDescription('A Default unit string name for a threshold area.') swFwDefaultTimebase = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 4), SwFwTimebase()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwDefaultTimebase.setStatus('current') if mibBuilder.loadTexts: swFwDefaultTimebase.setDescription('A Default timebase for the current threshold counter.') swFwDefaultLow = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwDefaultLow.setStatus('current') if mibBuilder.loadTexts: swFwDefaultLow.setDescription('A Default low threshold value.') swFwDefaultHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwDefaultHigh.setStatus('current') if mibBuilder.loadTexts: swFwDefaultHigh.setDescription('A Default high threshold value.') swFwDefaultBufSize = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwDefaultBufSize.setStatus('current') if mibBuilder.loadTexts: swFwDefaultBufSize.setDescription('A Default buffer size value.') swFwCustUnit = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwCustUnit.setStatus('current') if mibBuilder.loadTexts: swFwCustUnit.setDescription('A custom unit string name for a threshold area.') swFwCustTimebase = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 9), SwFwTimebase()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwCustTimebase.setStatus('current') if mibBuilder.loadTexts: swFwCustTimebase.setDescription('A custom timebase for the current threshold counter.') swFwCustLow = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwCustLow.setStatus('current') if mibBuilder.loadTexts: swFwCustLow.setDescription('A custom low threshold value.') swFwCustHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwCustHigh.setStatus('current') if mibBuilder.loadTexts: swFwCustHigh.setDescription('A custom high threshold value.') swFwCustBufSize = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwCustBufSize.setStatus('current') if mibBuilder.loadTexts: swFwCustBufSize.setDescription('A custom buffer size value.') swFwThLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 13), SwFwLevels()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwThLevel.setStatus('current') if mibBuilder.loadTexts: swFwThLevel.setDescription('A level where all the threshold values are set at.') swFwWriteActVals = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 14), SwFwWriteVals()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwWriteActVals.setStatus('current') if mibBuilder.loadTexts: swFwWriteActVals.setDescription('This object is set to apply act value changes.') swFwDefaultChangedActs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 15), SwFwActs()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwDefaultChangedActs.setStatus('current') if mibBuilder.loadTexts: swFwDefaultChangedActs.setDescription('Default action matrix for changed event.') swFwDefaultExceededActs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 16), SwFwActs()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwDefaultExceededActs.setStatus('current') if mibBuilder.loadTexts: swFwDefaultExceededActs.setDescription('Default action matrix for exceeded event.') swFwDefaultBelowActs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 17), SwFwActs()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwDefaultBelowActs.setStatus('current') if mibBuilder.loadTexts: swFwDefaultBelowActs.setDescription('Default action matrix for below event.') swFwDefaultAboveActs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 18), SwFwActs()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwDefaultAboveActs.setStatus('current') if mibBuilder.loadTexts: swFwDefaultAboveActs.setDescription('Default action matrix for above event.') swFwDefaultInBetweenActs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 19), SwFwActs()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwDefaultInBetweenActs.setStatus('current') if mibBuilder.loadTexts: swFwDefaultInBetweenActs.setDescription('Default action matrix for in-between event.') swFwCustChangedActs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 20), SwFwActs()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwCustChangedActs.setStatus('current') if mibBuilder.loadTexts: swFwCustChangedActs.setDescription('custom action matrix for changed event.') swFwCustExceededActs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 21), SwFwActs()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwCustExceededActs.setStatus('current') if mibBuilder.loadTexts: swFwCustExceededActs.setDescription('custom action matrix for exceeded event.') swFwCustBelowActs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 22), SwFwActs()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwCustBelowActs.setStatus('current') if mibBuilder.loadTexts: swFwCustBelowActs.setDescription('custom action matrix for below event.') swFwCustAboveActs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 23), SwFwActs()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwCustAboveActs.setStatus('current') if mibBuilder.loadTexts: swFwCustAboveActs.setDescription('custom action matrix for above event.') swFwCustInBetweenActs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 24), SwFwActs()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwCustInBetweenActs.setStatus('current') if mibBuilder.loadTexts: swFwCustInBetweenActs.setDescription('custom action matrix for in-between event.') swFwValidActs = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 25), SwFwActs()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwValidActs.setStatus('current') if mibBuilder.loadTexts: swFwValidActs.setDescription('matrix of valid acts for an class/area.') swFwActLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 2, 1, 26), SwFwLevels()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwActLevel.setStatus('current') if mibBuilder.loadTexts: swFwActLevel.setDescription('A level where all the actions are set at.') swFwThresholdTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3), ) if mibBuilder.loadTexts: swFwThresholdTable.setStatus('current') if mibBuilder.loadTexts: swFwThresholdTable.setDescription('The table of individual thresholds.') swFwThresholdEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1), ).setIndexNames((0, "SW-MIB", "swFwClassAreaIndex"), (0, "SW-MIB", "swFwThresholdIndex")) if mibBuilder.loadTexts: swFwThresholdEntry.setStatus('current') if mibBuilder.loadTexts: swFwThresholdEntry.setDescription('An entry of an individual threshold.') swFwThresholdIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwThresholdIndex.setStatus('current') if mibBuilder.loadTexts: swFwThresholdIndex.setDescription('This object identifies the element index of an threshold.') swFwStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1, 2), SwFwStatus()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwStatus.setStatus('current') if mibBuilder.loadTexts: swFwStatus.setDescription('This object identifies if an threshold is enabled or disabled.') swFwName = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwName.setStatus('current') if mibBuilder.loadTexts: swFwName.setDescription('This object is a name of the threshold.') swFwLabel = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 70))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwLabel.setStatus('current') if mibBuilder.loadTexts: swFwLabel.setDescription('This object is a label of the threshold.') swFwCurVal = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwCurVal.setStatus('current') if mibBuilder.loadTexts: swFwCurVal.setDescription('This object is a current counter of the threshold.') swFwLastEvent = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1, 6), SwFwEvent()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwLastEvent.setStatus('current') if mibBuilder.loadTexts: swFwLastEvent.setDescription('This object is a last event type of the threshold.') swFwLastEventVal = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwLastEventVal.setStatus('current') if mibBuilder.loadTexts: swFwLastEventVal.setDescription('This object is a last event value of the threshold.') swFwLastEventTime = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwLastEventTime.setStatus('current') if mibBuilder.loadTexts: swFwLastEventTime.setDescription('This object is a last event time of the threshold.') swFwLastState = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1, 9), SwFwState()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwLastState.setStatus('current') if mibBuilder.loadTexts: swFwLastState.setDescription('This object is a last event state of the threshold.') swFwBehaviorType = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1, 10), SwFwBehavior()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwBehaviorType.setStatus('current') if mibBuilder.loadTexts: swFwBehaviorType.setDescription('A behavior of which the thresholds generate event.') swFwBehaviorInt = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swFwBehaviorInt.setStatus('current') if mibBuilder.loadTexts: swFwBehaviorInt.setDescription('A integer of which the thresholds generate continuous event.') swFwLastSeverityLevel = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 10, 3, 1, 12), SwSevType()).setMaxAccess("readonly") if mibBuilder.loadTexts: swFwLastSeverityLevel.setStatus('current') if mibBuilder.loadTexts: swFwLastSeverityLevel.setDescription('This object is a last event severity level of the threshold.') swEndDeviceRlsTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 21, 1), ) if mibBuilder.loadTexts: swEndDeviceRlsTable.setStatus('current') if mibBuilder.loadTexts: swEndDeviceRlsTable.setDescription("The table of individual end devices' rls.") swEndDeviceRlsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 21, 1, 1), ).setIndexNames((0, "SW-MIB", "swEndDevicePort"), (0, "SW-MIB", "swEndDeviceAlpa")) if mibBuilder.loadTexts: swEndDeviceRlsEntry.setStatus('current') if mibBuilder.loadTexts: swEndDeviceRlsEntry.setDescription("An entry of an individual end devices' rls.") swEndDevicePort = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 21, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))) if mibBuilder.loadTexts: swEndDevicePort.setStatus('current') if mibBuilder.loadTexts: swEndDevicePort.setDescription('This object identifies the port of the end device.') swEndDeviceAlpa = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 21, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))) if mibBuilder.loadTexts: swEndDeviceAlpa.setStatus('current') if mibBuilder.loadTexts: swEndDeviceAlpa.setDescription('This object identifies the alpa of the end device.') swEndDevicePortID = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 21, 1, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly") if mibBuilder.loadTexts: swEndDevicePortID.setStatus('current') if mibBuilder.loadTexts: swEndDevicePortID.setDescription('The object identifies the Fibre Channel port address ID of the entry.') swEndDeviceLinkFailure = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 21, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swEndDeviceLinkFailure.setStatus('current') if mibBuilder.loadTexts: swEndDeviceLinkFailure.setDescription('Link failure count for the end device.') swEndDeviceSyncLoss = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 21, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swEndDeviceSyncLoss.setStatus('current') if mibBuilder.loadTexts: swEndDeviceSyncLoss.setDescription('Sync loss count for the end device.') swEndDeviceSigLoss = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 21, 1, 1, 6), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swEndDeviceSigLoss.setStatus('current') if mibBuilder.loadTexts: swEndDeviceSigLoss.setDescription('Sig loss count for the end device.') swEndDeviceProtoErr = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 21, 1, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swEndDeviceProtoErr.setStatus('current') if mibBuilder.loadTexts: swEndDeviceProtoErr.setDescription('Protocol err count for the end device.') swEndDeviceInvalidWord = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 21, 1, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swEndDeviceInvalidWord.setStatus('current') if mibBuilder.loadTexts: swEndDeviceInvalidWord.setDescription('Invalid word count for the end device.') swEndDeviceInvalidCRC = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 21, 1, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swEndDeviceInvalidCRC.setStatus('current') if mibBuilder.loadTexts: swEndDeviceInvalidCRC.setDescription('Invalid CRC count for the end device.') swGroupTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 22, 1), ) if mibBuilder.loadTexts: swGroupTable.setStatus('obsolete') if mibBuilder.loadTexts: swGroupTable.setDescription('The table of groups. This may not be available on all versions of Fabric OS.') swGroupEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 22, 1, 1), ).setIndexNames((0, "SW-MIB", "swGroupIndex")) if mibBuilder.loadTexts: swGroupEntry.setStatus('obsolete') if mibBuilder.loadTexts: swGroupEntry.setDescription('An entry of table of groups.') swGroupIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 22, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swGroupIndex.setStatus('obsolete') if mibBuilder.loadTexts: swGroupIndex.setDescription('This object is the group index starting from 1.') swGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 22, 1, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: swGroupName.setStatus('obsolete') if mibBuilder.loadTexts: swGroupName.setDescription('This object identifies the name of the group.') swGroupType = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 22, 1, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 15))).setMaxAccess("readonly") if mibBuilder.loadTexts: swGroupType.setStatus('obsolete') if mibBuilder.loadTexts: swGroupType.setDescription('This object identifies the type of the group.') swGroupMemTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 22, 2), ) if mibBuilder.loadTexts: swGroupMemTable.setStatus('obsolete') if mibBuilder.loadTexts: swGroupMemTable.setDescription('The table of members of all groups. This may not be available on all versions of Fabric OS.') swGroupMemEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 22, 2, 1), ).setIndexNames((0, "SW-MIB", "swGroupId"), (0, "SW-MIB", "swGroupMemWwn")) if mibBuilder.loadTexts: swGroupMemEntry.setStatus('obsolete') if mibBuilder.loadTexts: swGroupMemEntry.setDescription('An entry for a member of a group.') swGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 22, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swGroupId.setStatus('obsolete') if mibBuilder.loadTexts: swGroupId.setDescription('This object identifies the Group Id of the member switch.') swGroupMemWwn = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 22, 2, 1, 2), FcWwn()).setMaxAccess("readonly") if mibBuilder.loadTexts: swGroupMemWwn.setStatus('obsolete') if mibBuilder.loadTexts: swGroupMemWwn.setDescription('This object identifies the WWN of the member switch.') swGroupMemPos = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 22, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swGroupMemPos.setStatus('obsolete') if mibBuilder.loadTexts: swGroupMemPos.setDescription('This object identifies position of the member switch in the group. This is based on the order that the switches were added in the group.') swBlmPerfALPAMntTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 1), ) if mibBuilder.loadTexts: swBlmPerfALPAMntTable.setStatus('current') if mibBuilder.loadTexts: swBlmPerfALPAMntTable.setDescription('ALPA monitoring counter Table. ') swBlmPerfALPAMntEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 1, 1), ).setIndexNames((0, "SW-MIB", "swBlmPerfAlpaPort"), (0, "SW-MIB", "swBlmPerfAlpaIndx")) if mibBuilder.loadTexts: swBlmPerfALPAMntEntry.setStatus('current') if mibBuilder.loadTexts: swBlmPerfALPAMntEntry.setDescription(' ALPA monitoring counter for given ALPA.') swBlmPerfAlpaPort = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 1, 1, 1), SwPortIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfAlpaPort.setStatus('current') if mibBuilder.loadTexts: swBlmPerfAlpaPort.setDescription(' This Object identifies the port index of the switch.') swBlmPerfAlpaIndx = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 126))).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfAlpaIndx.setStatus('current') if mibBuilder.loadTexts: swBlmPerfAlpaIndx.setDescription(' This Object identifies the ALPA index. There can be 126 ALPA values') swBlmPerfAlpa = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfAlpa.setStatus('current') if mibBuilder.loadTexts: swBlmPerfAlpa.setDescription(" This Object identifies the ALPA values. These values range between x'01' and x'EF'(1 to 239). ALPA value x'00' is reserved for FL_Port If Alpa device is invalid, then it will have -1 value. ") swBlmPerfAlpaCRCCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 1, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfAlpaCRCCnt.setStatus('current') if mibBuilder.loadTexts: swBlmPerfAlpaCRCCnt.setDescription('Get CRC count for given ALPA and port. This monitoring provides information on the number of CRC errors occurred on the frames destined to each possible ALPA attached to a specific port.') swBlmPerfEEMntTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 2), ) if mibBuilder.loadTexts: swBlmPerfEEMntTable.setStatus('current') if mibBuilder.loadTexts: swBlmPerfEEMntTable.setDescription(' End-to-End monitoring counter Table') swBlmPerfEEMntEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 2, 1), ).setIndexNames((0, "SW-MIB", "swBlmPerfEEPort"), (0, "SW-MIB", "swBlmPerfEERefKey")) if mibBuilder.loadTexts: swBlmPerfEEMntEntry.setStatus('current') if mibBuilder.loadTexts: swBlmPerfEEMntEntry.setDescription('End-to-End monitoring counter for given port.') swBlmPerfEEPort = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 2, 1, 1), SwPortIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfEEPort.setStatus('current') if mibBuilder.loadTexts: swBlmPerfEEPort.setDescription(' This object identifies the port number of the switch.') swBlmPerfEERefKey = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfEERefKey.setStatus('current') if mibBuilder.loadTexts: swBlmPerfEERefKey.setDescription('This object identifies the reference number of the counter. This reference is number assigned when a filter is created. In SNMP Index start one instead of 0, add one to actual ref key') swBlmPerfEECRC = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 2, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfEECRC.setStatus('current') if mibBuilder.loadTexts: swBlmPerfEECRC.setDescription(' Get End to End CRC error for the frames that matched the SID-DID pair.') swBlmPerfEEFCWRx = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 2, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfEEFCWRx.setStatus('current') if mibBuilder.loadTexts: swBlmPerfEEFCWRx.setDescription('Get End to End count of Fibre Channel words (FCW), received by the port, that matched the SID-DID pair. ') swBlmPerfEEFCWTx = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 2, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfEEFCWTx.setStatus('current') if mibBuilder.loadTexts: swBlmPerfEEFCWTx.setDescription('Get End to End count of Fibre Channel words (FCW), transmitted by the port, that matched the SID-DID pair. ') swBlmPerfEESid = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfEESid.setStatus('current') if mibBuilder.loadTexts: swBlmPerfEESid.setDescription(' Gets SID info by reference number. SID (Source Identifier) is a 3-byte field in the frame header used to indicate the address identifier of the N-Port from which the frame was sent.') swBlmPerfEEDid = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfEEDid.setStatus('current') if mibBuilder.loadTexts: swBlmPerfEEDid.setDescription('Gets DID info by reference number. DID (Destination Identifier) is a 3-byte field in the frame header used to indicate the address identifier of the N-Port to which the frame was sent.') swBlmPerfFltMntTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 3), ) if mibBuilder.loadTexts: swBlmPerfFltMntTable.setStatus('current') if mibBuilder.loadTexts: swBlmPerfFltMntTable.setDescription('Filter based monitoring counter.') swBlmPerfFltMntEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 3, 1), ).setIndexNames((0, "SW-MIB", "swBlmPerfFltPort"), (0, "SW-MIB", "swBlmPerfFltRefkey")) if mibBuilder.loadTexts: swBlmPerfFltMntEntry.setStatus('current') if mibBuilder.loadTexts: swBlmPerfFltMntEntry.setDescription(' Filter base monitoring counter for given port.') swBlmPerfFltPort = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 3, 1, 1), SwPortIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfFltPort.setStatus('current') if mibBuilder.loadTexts: swBlmPerfFltPort.setDescription('This object identifies the port number of the switch.') swBlmPerfFltRefkey = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfFltRefkey.setStatus('current') if mibBuilder.loadTexts: swBlmPerfFltRefkey.setDescription(' This object identifies the reference number of the filter. This reference number is assigned when a filter is created. In SNMP Index start one instead of 0, add one to actual ref key') swBlmPerfFltCnt = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfFltCnt.setStatus('current') if mibBuilder.loadTexts: swBlmPerfFltCnt.setDescription('Get statistics of filter based monitor. Filter based monitoring provides information about a filter hit count such as 1. Read command 2. SCSI or IP traffic 3. SCSI Read/Write') swBlmPerfFltAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 23, 3, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readonly") if mibBuilder.loadTexts: swBlmPerfFltAlias.setStatus('current') if mibBuilder.loadTexts: swBlmPerfFltAlias.setDescription(' Alias name for the filter.') swSwitchTrunkable = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(8, 0))).clone(namedValues=NamedValues(("yes", 8), ("no", 0)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swSwitchTrunkable.setStatus('current') if mibBuilder.loadTexts: swSwitchTrunkable.setDescription('The trunking status of the switch - whether the switch supports the trunking feature or not. The values are yes(8) - the trunking feature is supported no(0). - the trunking feature is not supported. ') swTrunkTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 2), ) if mibBuilder.loadTexts: swTrunkTable.setStatus('current') if mibBuilder.loadTexts: swTrunkTable.setDescription(' Table to display trunking information for the switch. ') swTrunkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 2, 1), ).setIndexNames((0, "SW-MIB", "swTrunkPortIndex")) if mibBuilder.loadTexts: swTrunkEntry.setStatus('current') if mibBuilder.loadTexts: swTrunkEntry.setDescription('Entry for the trunking table.') swTrunkPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 2, 1, 1), SwPortIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: swTrunkPortIndex.setStatus('current') if mibBuilder.loadTexts: swTrunkPortIndex.setDescription('This object identifies the switch port index. Note that the value of a port index is 1 higher than the port number labeled on the front panel. e.g. port index 1 correspond to port number 0. ') swTrunkGroupNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swTrunkGroupNumber.setStatus('current') if mibBuilder.loadTexts: swTrunkGroupNumber.setDescription('This object is a logical entity which specifies the Group Number to which the port belongs to. If this value is Zero it means the port is not Trunked.') swTrunkMaster = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 2, 1, 3), SwTrunkMaster()).setMaxAccess("readonly") if mibBuilder.loadTexts: swTrunkMaster.setStatus('current') if mibBuilder.loadTexts: swTrunkMaster.setDescription('Port number that is the trunk master of the group. The trunk master implicitly defines the group. All ports with the same master are considered to be part of the same group.') swPortTrunked = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("disabled", 0), ("enabled", 1)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swPortTrunked.setStatus('current') if mibBuilder.loadTexts: swPortTrunked.setDescription('The active trunk status for a member port. Values are enabled(1) or disabled(0).') swTrunkGrpTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 3), ) if mibBuilder.loadTexts: swTrunkGrpTable.setStatus('current') if mibBuilder.loadTexts: swTrunkGrpTable.setDescription('Table to display trunking Performance information for the switch.') swTrunkGrpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 3, 1), ).setIndexNames((0, "SW-MIB", "swTrunkGrpNumber")) if mibBuilder.loadTexts: swTrunkGrpEntry.setStatus('current') if mibBuilder.loadTexts: swTrunkGrpEntry.setDescription('Entry for the trunking Group table.') swTrunkGrpNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: swTrunkGrpNumber.setStatus('current') if mibBuilder.loadTexts: swTrunkGrpNumber.setDescription('This object is a logical entity which specifies the Group Number to which port belongs to.') swTrunkGrpMaster = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 3, 1, 2), SwTrunkMaster()).setMaxAccess("readonly") if mibBuilder.loadTexts: swTrunkGrpMaster.setStatus('current') if mibBuilder.loadTexts: swTrunkGrpMaster.setDescription('This object gives the master port id for the TrunkGroup.') swTrunkGrpTx = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swTrunkGrpTx.setStatus('current') if mibBuilder.loadTexts: swTrunkGrpTx.setDescription('Gives the aggregate value of the transmitted words from this TrunkGroup.') swTrunkGrpRx = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 24, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swTrunkGrpRx.setStatus('current') if mibBuilder.loadTexts: swTrunkGrpRx.setDescription('Gives the aggregate value of the received words by this TrunkGroup.') swTopTalkerMntMode = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 25, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("fabricmode", 1), ("portmode", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swTopTalkerMntMode.setStatus('current') if mibBuilder.loadTexts: swTopTalkerMntMode.setDescription('Gives the mode in which toptalker is installed') swTopTalkerMntNumEntries = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 25, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: swTopTalkerMntNumEntries.setStatus('current') if mibBuilder.loadTexts: swTopTalkerMntNumEntries.setDescription('Gives the number of toptalking flows') swTopTalkerMntTable = MibTable((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 25, 3), ) if mibBuilder.loadTexts: swTopTalkerMntTable.setStatus('current') if mibBuilder.loadTexts: swTopTalkerMntTable.setDescription('Table to display toptalkingflows') swTopTalkerMntEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 25, 3, 1), ).setIndexNames((0, "SW-MIB", "swTopTalkerMntIndex")) if mibBuilder.loadTexts: swTopTalkerMntEntry.setStatus('current') if mibBuilder.loadTexts: swTopTalkerMntEntry.setDescription('Entry for the toptalker table') swTopTalkerMntIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 25, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: swTopTalkerMntIndex.setStatus('current') if mibBuilder.loadTexts: swTopTalkerMntIndex.setDescription('This object identifies the list/object entry') swTopTalkerMntPort = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 25, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: swTopTalkerMntPort.setStatus('current') if mibBuilder.loadTexts: swTopTalkerMntPort.setDescription('This object identifies the switch port number on which the f-port mode toptalker is added.') swTopTalkerMntSpid = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 25, 3, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: swTopTalkerMntSpid.setStatus('current') if mibBuilder.loadTexts: swTopTalkerMntSpid.setDescription('This object identifies the SID of the host') swTopTalkerMntDpid = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 25, 3, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: swTopTalkerMntDpid.setStatus('current') if mibBuilder.loadTexts: swTopTalkerMntDpid.setDescription('This object identifies the DID of the SID-DID pair') swTopTalkerMntflow = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 25, 3, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: swTopTalkerMntflow.setStatus('current') if mibBuilder.loadTexts: swTopTalkerMntflow.setDescription('This object identifies the traffic flow in MB/sec') swTopTalkerMntSwwn = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 25, 3, 1, 6), FcWwn()).setMaxAccess("readonly") if mibBuilder.loadTexts: swTopTalkerMntSwwn.setStatus('current') if mibBuilder.loadTexts: swTopTalkerMntSwwn.setDescription('This object identifies the SID in WWN format of the host') swTopTalkerMntDwwn = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 25, 3, 1, 7), FcWwn()).setMaxAccess("readonly") if mibBuilder.loadTexts: swTopTalkerMntDwwn.setStatus('current') if mibBuilder.loadTexts: swTopTalkerMntDwwn.setDescription('This object identifies the DID in WWN format of the SID-DID pair') swCpuUsage = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readonly") if mibBuilder.loadTexts: swCpuUsage.setStatus('current') if mibBuilder.loadTexts: swCpuUsage.setDescription("System's cpu usage.") swCpuNoOfRetries = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 100))).setMaxAccess("readonly") if mibBuilder.loadTexts: swCpuNoOfRetries.setStatus('current') if mibBuilder.loadTexts: swCpuNoOfRetries.setDescription('Number of times system should take cpu utilization sample before sending the CPU utilization trap.') swCpuUsageLimit = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 100))).setMaxAccess("readonly") if mibBuilder.loadTexts: swCpuUsageLimit.setStatus('current') if mibBuilder.loadTexts: swCpuUsageLimit.setDescription('CPU usage limit. If MAPS is enabled, then this object is not supported and return 0 value.') swCpuPollingInterval = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 3600))).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: swCpuPollingInterval.setStatus('current') if mibBuilder.loadTexts: swCpuPollingInterval.setDescription('Time interval between two memory samples.') swCpuAction = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("none", 0), ("raslog", 1), ("snmp", 2), ("raslogandSnmp", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swCpuAction.setStatus('current') if mibBuilder.loadTexts: swCpuAction.setDescription('Specifies the actions to be taken if system resources exceed the specified threshold. If MAPS is enabled, then this object is not supported and return 0 value.') swMemUsage = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMemUsage.setStatus('current') if mibBuilder.loadTexts: swMemUsage.setDescription("System's memory usage.") swMemNoOfRetries = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMemNoOfRetries.setStatus('current') if mibBuilder.loadTexts: swMemNoOfRetries.setDescription('Number of times system should take memory usage sample before sending the memory usage trap.') swMemUsageLimit = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMemUsageLimit.setStatus('current') if mibBuilder.loadTexts: swMemUsageLimit.setDescription('Memory usage limit') swMemPollingInterval = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 3600))).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: swMemPollingInterval.setStatus('current') if mibBuilder.loadTexts: swMemPollingInterval.setDescription('Time interval between two memory samples.') swMemAction = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("none", 0), ("raslog", 1), ("snmp", 2), ("raslogandSnmp", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swMemAction.setStatus('current') if mibBuilder.loadTexts: swMemAction.setDescription('Specifies the actions to be taken if system resources exceed the specified threshold. If MAPS is enabled, then this object is not supported and return 0 value.') swMemUsageLimit1 = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMemUsageLimit1.setStatus('current') if mibBuilder.loadTexts: swMemUsageLimit1.setDescription('Low memory usage limit. If MAPS is enabled, then this object is not supported and return 0 value.') swMemUsageLimit3 = MibScalar((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 26, 12), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swMemUsageLimit3.setStatus('current') if mibBuilder.loadTexts: swMemUsageLimit3.setDescription('High memory usage limit. If MAPS is enabled, then this object is not supported and return 0 value.') swConnUnitPortStatEntry = MibTableRow((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1), ) connUnitPortStatEntry.registerAugmentions(("SW-MIB", "swConnUnitPortStatEntry")) swConnUnitPortStatEntry.setIndexNames(*connUnitPortStatEntry.getIndexNames()) if mibBuilder.loadTexts: swConnUnitPortStatEntry.setStatus('current') if mibBuilder.loadTexts: swConnUnitPortStatEntry.setDescription('This represents the Conn unit Port Stats') swConnUnitCRCWithBadEOF = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitCRCWithBadEOF.setStatus('current') if mibBuilder.loadTexts: swConnUnitCRCWithBadEOF.setDescription('The number of frames with CRC error with Bad EOF.') swConnUnitZeroTenancy = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitZeroTenancy.setStatus('current') if mibBuilder.loadTexts: swConnUnitZeroTenancy.setDescription('This counter is incremented when the FL_port acquires the loop but does not transmit a frame.') swConnUnitFLNumOfTenancy = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitFLNumOfTenancy.setStatus('current') if mibBuilder.loadTexts: swConnUnitFLNumOfTenancy.setDescription('This counter is incremented when the FL_port acquires the loop.') swConnUnitNLNumOfTenancy = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitNLNumOfTenancy.setStatus('current') if mibBuilder.loadTexts: swConnUnitNLNumOfTenancy.setDescription('This counter is incremented when the NL_port acquires the loop.') swConnUnitStopTenancyStarVation = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitStopTenancyStarVation.setStatus('current') if mibBuilder.loadTexts: swConnUnitStopTenancyStarVation.setDescription('This counter is incremented when the FL_port can not transmit a frame because of lack of credit.') swConnUnitOpend = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitOpend.setStatus('current') if mibBuilder.loadTexts: swConnUnitOpend.setDescription('The number of times FC port entered OPENED state.') swConnUnitTransferConnection = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitTransferConnection.setStatus('current') if mibBuilder.loadTexts: swConnUnitTransferConnection.setDescription('The number of times FC port entered TRANSFER state.') swConnUnitOpen = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitOpen.setStatus('current') if mibBuilder.loadTexts: swConnUnitOpen.setDescription('The number of times FC port entered OPEN state.') swConnUnitInvalidARB = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 9), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitInvalidARB.setStatus('current') if mibBuilder.loadTexts: swConnUnitInvalidARB.setDescription('The number of times FC port received invalid ARB.') swConnUnitFTB1Miss = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 10), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitFTB1Miss.setStatus('current') if mibBuilder.loadTexts: swConnUnitFTB1Miss.setDescription('This counter is incremented when the port receives a frame with a DID that can not be routed by FCR.. Applicable to 8G platforms only.') swConnUnitFTB2Miss = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 11), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitFTB2Miss.setStatus('current') if mibBuilder.loadTexts: swConnUnitFTB2Miss.setDescription('This counter is incremented when the port receives a frame with an SID/DID combination that can not be routed by the VF module.Applicable to 8G platforms only.') swConnUnitFTB6Miss = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 12), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitFTB6Miss.setStatus('current') if mibBuilder.loadTexts: swConnUnitFTB6Miss.setDescription('This counter is incremented when port receives a frame with an SID that can not be routed by FCR. Applicable to 8G platforms.') swConnUnitZoneMiss = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 13), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitZoneMiss.setStatus('current') if mibBuilder.loadTexts: swConnUnitZoneMiss.setDescription('This counter is incremented when the port receives a frame with an SID and DID that are not zoned together.') swConnUnitLunZoneMiss = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 14), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitLunZoneMiss.setStatus('current') if mibBuilder.loadTexts: swConnUnitLunZoneMiss.setDescription('This counter is incremented when the port receives a frame with an SID, DID and LUN that are not zoned together( This is not currently used ).') swConnUnitBadEOF = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 15), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitBadEOF.setStatus('current') if mibBuilder.loadTexts: swConnUnitBadEOF.setDescription('The number of frames with bad end-of-frame.') swConnUnitLCRX = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 16), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitLCRX.setStatus('current') if mibBuilder.loadTexts: swConnUnitLCRX.setDescription('The number of link control frames received.') swConnUnitRDYPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 17), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitRDYPriority.setStatus('current') if mibBuilder.loadTexts: swConnUnitRDYPriority.setDescription('The number of times that sending R_RDY or VC_RDY primitive signals was a higher priority than sending frames, due to diminishing credit reserves in the transmitter at the other end of the fibre.') swConnUnitLli = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 18), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitLli.setStatus('current') if mibBuilder.loadTexts: swConnUnitLli.setDescription('The number low level interrupts generated by the physical and link layer.') swConnUnitInterrupts = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 19), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitInterrupts.setStatus('current') if mibBuilder.loadTexts: swConnUnitInterrupts.setDescription(' This represents all the interrupts received on a port. Includes LLI, unknown etc') swConnUnitUnknownInterrupts = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 20), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitUnknownInterrupts.setStatus('current') if mibBuilder.loadTexts: swConnUnitUnknownInterrupts.setDescription(' Represents all the unknown interrupts received on a port.') swConnUnitTimedOut = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 21), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitTimedOut.setStatus('current') if mibBuilder.loadTexts: swConnUnitTimedOut.setDescription('Represents number of timed out frames due to any reason.') swConnUnitProcRequired = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 22), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitProcRequired.setStatus('current') if mibBuilder.loadTexts: swConnUnitProcRequired.setDescription('Represents number of frames trapped by CPU.') swConnUnitTxBufferUnavailable = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 23), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitTxBufferUnavailable.setStatus('current') if mibBuilder.loadTexts: swConnUnitTxBufferUnavailable.setDescription('Number of times port failed to transmit frames .') swConnUnitStateChange = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 24), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitStateChange.setStatus('current') if mibBuilder.loadTexts: swConnUnitStateChange.setDescription(' Number of times port has gone to offline, online, and faulty state.') swConnUnitC3DiscardDueToRXTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 25), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitC3DiscardDueToRXTimeout.setStatus('current') if mibBuilder.loadTexts: swConnUnitC3DiscardDueToRXTimeout.setDescription('Number of Class 3 receive frames discarded due to timeout.') swConnUnitC3DiscardDueToDestUnreachable = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 26), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitC3DiscardDueToDestUnreachable.setStatus('current') if mibBuilder.loadTexts: swConnUnitC3DiscardDueToDestUnreachable.setDescription('Number of Class 3 frames discarded due to destination unreachable.') swConnUnitC3DiscardDueToTXTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 27), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitC3DiscardDueToTXTimeout.setStatus('current') if mibBuilder.loadTexts: swConnUnitC3DiscardDueToTXTimeout.setDescription('Number of Class 3 transmit frames discarded due to timeout.') swConnUnitC3DiscardOther = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 28), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitC3DiscardOther.setStatus('current') if mibBuilder.loadTexts: swConnUnitC3DiscardOther.setDescription('Number of Class 3 frames discarded due to unknow reasons.') swConnUnitPCSErrorCounter = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 29), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitPCSErrorCounter.setStatus('current') if mibBuilder.loadTexts: swConnUnitPCSErrorCounter.setDescription('Number of Physical coding sublayer(PCS) block errors. It records the encoding violations on 10G or 16Gbps port.') swConnUnitUnroutableFrameCounter = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 30), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitUnroutableFrameCounter.setStatus('current') if mibBuilder.loadTexts: swConnUnitUnroutableFrameCounter.setDescription('It indicates unroutable frame counter') swConnUnitFECCorrectedCounter = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 31), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitFECCorrectedCounter.setStatus('current') if mibBuilder.loadTexts: swConnUnitFECCorrectedCounter.setDescription('It indicates Forward Error Correction Corrected Blocks count.FEC feature is only applicable to 10G/16G platforms.') swConnUnitFECUnCorrectedCounter = MibTableColumn((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 27, 1, 32), OctetString().subtype(subtypeSpec=ValueSizeConstraint(64, 64)).setFixedLength(64)).setMaxAccess("readonly") if mibBuilder.loadTexts: swConnUnitFECUnCorrectedCounter.setStatus('current') if mibBuilder.loadTexts: swConnUnitFECUnCorrectedCounter.setDescription('It indicates Forward Error Correction UnCorrected Blocks count.FEC feature is only applicable to 10G/16G platforms.') swTrapsV2 = ObjectIdentity((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0)) if mibBuilder.loadTexts: swTrapsV2.setStatus('current') if mibBuilder.loadTexts: swTrapsV2.setDescription("The Traps for Brocade's Fibre Channel Switch.") swFault = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 1)).setObjects(("SW-MIB", "swDiagResult"), ("SW-MIB", "swSsn")) if mibBuilder.loadTexts: swFault.setStatus('obsolete') if mibBuilder.loadTexts: swFault.setDescription("Obsoleted this trap as firmware doesn't support this trap. A swFault(1) is generated whenever the diagnostics detects a fault with the switch.") swSensorScn = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 2)).setObjects(("SW-MIB", "swSensorStatus"), ("SW-MIB", "swSensorIndex"), ("SW-MIB", "swSensorType"), ("SW-MIB", "swSensorValue"), ("SW-MIB", "swSensorInfo"), ("SW-MIB", "swSsn")) if mibBuilder.loadTexts: swSensorScn.setStatus('current') if mibBuilder.loadTexts: swSensorScn.setDescription('A swSensorScn(2) is generated whenever an environment sensor changes its operational state. For instance, a fan stop working. The VarBind in the Trap Data Unit shall contain the corresponding instance of the sensor status, sensor index, sensor type, sensor value (reading) and sensor information. Note that the sensor information contains the type of sensor and its number in textual format.') swFCPortScn = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 3)).setObjects(("SW-MIB", "swFCPortOpStatus"), ("SW-MIB", "swFCPortIndex"), ("SW-MIB", "swFCPortName"), ("SW-MIB", "swFCPortWwn"), ("SW-MIB", "swFCPortPrevType"), ("SW-MIB", "swFCPortBrcdType"), ("SW-MIB", "swSsn"), ("SW-MIB", "swFCPortFlag"), ("SW-MIB", "swFCPortDisableReason"), ("SW-MIB", "swVfId")) if mibBuilder.loadTexts: swFCPortScn.setStatus('current') if mibBuilder.loadTexts: swFCPortScn.setDescription('This trap is sent whenever an FC port operational status or its type changed. The events that trigger this trap are port goes to online/offline, port type changed to E-port/F-port/FL-port. swFCPortName and swSsn are optional varbind in the trap PDU') swEventTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 4)).setObjects(("SW-MIB", "swEventIndex"), ("SW-MIB", "swEventTimeInfo"), ("SW-MIB", "swEventLevel"), ("SW-MIB", "swEventRepeatCount"), ("SW-MIB", "swEventDescr"), ("SW-MIB", "swSsn"), ("SW-MIB", "swVfId")) if mibBuilder.loadTexts: swEventTrap.setStatus('current') if mibBuilder.loadTexts: swEventTrap.setDescription('This trap is generated when an event whose level at or below swEventTrapLevel occurs.') swFabricWatchTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 5)).setObjects(("SW-MIB", "swFwClassAreaIndex"), ("SW-MIB", "swFwThresholdIndex"), ("SW-MIB", "swFwName"), ("SW-MIB", "swFwLabel"), ("SW-MIB", "swFwLastEventVal"), ("SW-MIB", "swFwLastEventTime"), ("SW-MIB", "swFwLastEvent"), ("SW-MIB", "swFwLastState"), ("SW-MIB", "swFwLastSeverityLevel"), ("SW-MIB", "swSsn"), ("SW-MIB", "swVfId")) if mibBuilder.loadTexts: swFabricWatchTrap.setStatus('current') if mibBuilder.loadTexts: swFabricWatchTrap.setDescription('trap to be sent by Fabric Watch to notify of an event.') swTrackChangesTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 6)).setObjects(("SW-MIB", "swTrackChangesInfo"), ("SW-MIB", "swSsn"), ("SW-MIB", "swVfId")) if mibBuilder.loadTexts: swTrackChangesTrap.setStatus('current') if mibBuilder.loadTexts: swTrackChangesTrap.setDescription('trap to be sent for tracking login/logout/config changes.') swIPv6ChangeTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 7)).setObjects(("SW-MIB", "swIPv6Address"), ("SW-MIB", "swIPv6Status")) if mibBuilder.loadTexts: swIPv6ChangeTrap.setStatus('current') if mibBuilder.loadTexts: swIPv6ChangeTrap.setDescription('This trap is generated when an ipv6 address status change event occurs.') swPmgrEventTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 8)).setObjects(("SW-MIB", "swPmgrEventType"), ("SW-MIB", "swPmgrEventTime"), ("SW-MIB", "swPmgrEventDescr"), ("SW-MIB", "swSsn"), ("SW-MIB", "swVfId")) if mibBuilder.loadTexts: swPmgrEventTrap.setStatus('current') if mibBuilder.loadTexts: swPmgrEventTrap.setDescription('This trap is generated when any partition manager change happens.') swFabricReconfigTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 9)).setObjects(("SW-MIB", "swDomainID")) if mibBuilder.loadTexts: swFabricReconfigTrap.setStatus('current') if mibBuilder.loadTexts: swFabricReconfigTrap.setDescription('trap to be sent for tracking fabric reconfiguration') swFabricSegmentTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 10)).setObjects(("SW-MIB", "swFCPortIndex"), ("SW-MIB", "swFCPortName"), ("SW-MIB", "swSsn"), ("SW-MIB", "swFCPortFlag"), ("SW-MIB", "swVfId")) if mibBuilder.loadTexts: swFabricSegmentTrap.setStatus('current') if mibBuilder.loadTexts: swFabricSegmentTrap.setDescription('trap to be sent for tracking segmentation') swExtTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 11)) if mibBuilder.loadTexts: swExtTrap.setStatus('current') if mibBuilder.loadTexts: swExtTrap.setDescription('THIS IS INTERNAL TRAP') swStateChangeTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 12)).setObjects(("SW-MIB", "swOperStatus"), ("SW-MIB", "swVfId")) if mibBuilder.loadTexts: swStateChangeTrap.setStatus('current') if mibBuilder.loadTexts: swStateChangeTrap.setDescription('This trap is sent whenever switch state changes to online/offline') swPortMoveTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 13)).setObjects(("SW-MIB", "swPortList"), ("SW-MIB", "swVfId")) if mibBuilder.loadTexts: swPortMoveTrap.setStatus('current') if mibBuilder.loadTexts: swPortMoveTrap.setDescription('This trap is sent when ports are moved from one switch to another') swBrcdGenericTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 14)).setObjects(("SW-MIB", "swBrcdTrapBitMask")) if mibBuilder.loadTexts: swBrcdGenericTrap.setStatus('current') if mibBuilder.loadTexts: swBrcdGenericTrap.setDescription("This trap is sent when there is any one of the following event occured. 1. fabric change 2. device change 3. Fapwwn change 4. fdmi event This Trap is strictly for brocade's internal usage.") swDeviceStatusTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 15)).setObjects(("SW-MIB", "swFCPortSpecifier"), ("SW-MIB", "swDeviceStatus"), ("SW-MIB", "swEndDevicePortID"), ("SW-MIB", "swNsNodeName")) if mibBuilder.loadTexts: swDeviceStatusTrap.setStatus('current') if mibBuilder.loadTexts: swDeviceStatusTrap.setDescription('This trap is sent whenever there is a device login or logout') swZoneConfigChangeTrap = NotificationType((1, 3, 6, 1, 4, 1, 1588, 2, 1, 1, 1, 0, 16)).setObjects(("SW-MIB", "swVfId")) if mibBuilder.loadTexts: swZoneConfigChangeTrap.setStatus('current') if mibBuilder.loadTexts: swZoneConfigChangeTrap.setDescription('This trap is sent whenever there is change in local zone database.') mibBuilder.exportSymbols("SW-MIB", swFwCustUnit=swFwCustUnit, swIDIDMode=swIDIDMode, swSensorValue=swSensorValue, swFabric=swFabric, swTrunkMaster=swTrunkMaster, swDeviceStatusTrap=swDeviceStatusTrap, swTrunkGrpMaster=swTrunkGrpMaster, swFabricMemName=swFabricMemName, swSensorType=swSensorType, sw20x0=sw20x0, swTrunkPortIndex=swTrunkPortIndex, swGroupTable=swGroupTable, swFwClassAreaEntry=swFwClassAreaEntry, swNsWwn=swNsWwn, swBlmPerfEESid=swBlmPerfEESid, swFCPortAdmStatus=swFCPortAdmStatus, swGroupName=swGroupName, swFwValidActs=swFwValidActs, swTrunkGrpNumber=swTrunkGrpNumber, swEventTable=swEventTable, swConnUnitTxBufferUnavailable=swConnUnitTxBufferUnavailable, swFCPortType=swFCPortType, swTrackChangesInfo=swTrackChangesInfo, swTopTalkerMntNumEntries=swTopTalkerMntNumEntries, swFCPortTooManyRdys=swFCPortTooManyRdys, swTopTalkerMntDwwn=swTopTalkerMntDwwn, swSensorInfo=swSensorInfo, swVfName=swVfName, swEventTrapLevel=swEventTrapLevel, swFwDefaultBelowActs=swFwDefaultBelowActs, swGroupEntry=swGroupEntry, swFabricSegmentTrap=swFabricSegmentTrap, swGroup=swGroup, swEndDevicePortID=swEndDevicePortID, SwFwWriteVals=SwFwWriteVals, swFCPortPhyState=swFCPortPhyState, swTopTalkerMntSwwn=swTopTalkerMntSwwn, swTrunkTable=swTrunkTable, swVfId=swVfId, SwFwClassesAreas=SwFwClassesAreas, swSwitchTrunkable=swSwitchTrunkable, swFwCustHigh=swFwCustHigh, swFwLastEventTime=swFwLastEventTime, swFlashDLPassword=swFlashDLPassword, swBlmPerfAlpa=swBlmPerfAlpa, swFCPortMcastTimedOuts=swFCPortMcastTimedOuts, swConnUnitC3DiscardDueToRXTimeout=swConnUnitC3DiscardDueToRXTimeout, swTopTalkerMntflow=swTopTalkerMntflow, swExtTrap=swExtTrap, swFCPortLipIns=swFCPortLipIns, swBlmPerfEEDid=swBlmPerfEEDid, swNsPortName=swNsPortName, PYSNMP_MODULE_ID=swMibModule, swEventIndex=swEventIndex, swNsPortID=swNsPortID, swCpuUsageLimit=swCpuUsageLimit, swPortMoveTrap=swPortMoveTrap, swFwClassAreaTable=swFwClassAreaTable, swFCPortRxBadEofs=swFCPortRxBadEofs, swBlmPerfMnt=swBlmPerfMnt, swFCPortLipLastAlpa=swFCPortLipLastAlpa, swFwSystem=swFwSystem, swBlmPerfFltMntEntry=swBlmPerfFltMntEntry, swFCPortRxCrcs=swFCPortRxCrcs, swTopTalkerMntPort=swTopTalkerMntPort, swEndDeviceSyncLoss=swEndDeviceSyncLoss, swBlmPerfEEPort=swBlmPerfEEPort, swFlashDLFile=swFlashDLFile, swConnUnitUnknownInterrupts=swConnUnitUnknownInterrupts, swNumSensors=swNumSensors, swFlashDLOperStatus=swFlashDLOperStatus, swTopTalkerMntSpid=swTopTalkerMntSpid, swConnUnitC3DiscardDueToDestUnreachable=swConnUnitC3DiscardDueToDestUnreachable, swFault=swFault, swFCPortTable=swFCPortTable, swBlmPerfAlpaPort=swBlmPerfAlpaPort, swFwDefaultUnit=swFwDefaultUnit, swConnUnitLCRX=swConnUnitLCRX, swFCIPMask=swFCIPMask, swConnUnitRDYPriority=swConnUnitRDYPriority, swFCport=swFCport, swConnUnitTransferConnection=swConnUnitTransferConnection, swNsCos=swNsCos, swEventNumEntries=swEventNumEntries, swBlmPerfEERefKey=swBlmPerfEERefKey, swTopTalkerMntMode=swTopTalkerMntMode, swGroupIndex=swGroupIndex, swConnUnitZeroTenancy=swConnUnitZeroTenancy, swFabricWatchTrap=swFabricWatchTrap, swNsIpAddress=swNsIpAddress, swBlmPerfFltMntTable=swBlmPerfFltMntTable, swMemNoOfRetries=swMemNoOfRetries, swNsPortSymb=swNsPortSymb, swNsIpNxPort=swNsIpNxPort, swIPv6ChangeTrap=swIPv6ChangeTrap, swTrunk=swTrunk, swBlmPerfAlpaIndx=swBlmPerfAlpaIndx, swBlmPerfEEMntTable=swBlmPerfEEMntTable, swConnUnitPortStatEntry=swConnUnitPortStatEntry, swEndDevicePort=swEndDevicePort, swFCPortRxC2Frames=swFCPortRxC2Frames, swDomainID=swDomainID, swAdmStatus=swAdmStatus, swGroupMemWwn=swGroupMemWwn, swMemAction=swMemAction, SwFwState=SwFwState, swNbEntry=swNbEntry, swFabricMemEntry=swFabricMemEntry, swFabricMemDid=swFabricMemDid, FcPortFlag=FcPortFlag, swFwCustLow=swFwCustLow, swFCPortSpeed=swFCPortSpeed, swTelnetShellAdmStatus=swTelnetShellAdmStatus, swFwStatus=swFwStatus, swConnUnitUnroutableFrameCounter=swConnUnitUnroutableFrameCounter, swNsEntryIndex=swNsEntryIndex, swFCPortRxFrames=swFCPortRxFrames, swConnUnitBadEOF=swConnUnitBadEOF, swEndDeviceInvalidWord=swEndDeviceInvalidWord, swSensorEntry=swSensorEntry, swConnUnitPCSErrorCounter=swConnUnitPCSErrorCounter, SwFwLicense=SwFwLicense, swSensorStatus=swSensorStatus, swNs=swNs, swMemUsage=swMemUsage, swAgtCmtyIdx=swAgtCmtyIdx, swFwDefaultLow=swFwDefaultLow, swNbMyPort=swNbMyPort, swFCPortIndex=swFCPortIndex, swSsn=swSsn, swConnUnitInvalidARB=swConnUnitInvalidARB, swConnUnitFTB1Miss=swConnUnitFTB1Miss, swNsHardAddr=swNsHardAddr, swEventEntry=swEventEntry, swModel=swModel, swFCIPAddress=swFCIPAddress, swFCPortTxFrames=swFCPortTxFrames, swEndDevice=swEndDevice, swEventVfId=swEventVfId, swFWLastUpdated=swFWLastUpdated, swConnUnitInterrupts=swConnUnitInterrupts, swFwWriteActVals=swFwWriteActVals, swFlashDLAdmStatus=swFlashDLAdmStatus, swEvent=swEvent, swEtherIPMask=swEtherIPMask, SwFwActs=SwFwActs, swFwThLevel=swFwThLevel, swFwCustBelowActs=swFwCustBelowActs, sw=sw, swCpuPollingInterval=swCpuPollingInterval, swBlmPerfFltCnt=swBlmPerfFltCnt, swFwFabricWatchLicense=swFwFabricWatchLicense, swAgtTrapSeverityLevel=swAgtTrapSeverityLevel, swPortTrunked=swPortTrunked, swEventLevel=swEventLevel, swSensorTable=swSensorTable, swPmgrEventTrap=swPmgrEventTrap, swTrunkEntry=swTrunkEntry, swFwLastSeverityLevel=swFwLastSeverityLevel, swNumNbs=swNumNbs, swGroupMemEntry=swGroupMemEntry, SwFwLevels=SwFwLevels, swBlmPerfAlpaCRCCnt=swBlmPerfAlpaCRCCnt, swFlashLastUpdated=swFlashLastUpdated, swZoneConfigChangeTrap=swZoneConfigChangeTrap, swBootPromLastUpdated=swBootPromLastUpdated, swNsLocalEntry=swNsLocalEntry, swFwLastEvent=swFwLastEvent, swFwClassAreaIndex=swFwClassAreaIndex, swBlmPerfEEFCWRx=swBlmPerfEEFCWRx, swConnUnitOpen=swConnUnitOpen, swBlmPerfEEFCWTx=swBlmPerfEEFCWTx, swFwCustAboveActs=swFwCustAboveActs, swNbTable=swNbTable, swNsPortType=swNsPortType, swConnUnitStopTenancyStarVation=swConnUnitStopTenancyStarVation, swFwThresholdEntry=swFwThresholdEntry, swMibModule=swMibModule, swConnUnitFTB2Miss=swConnUnitFTB2Miss, swAgtCmtyStr=swAgtCmtyStr, swFCPortRxC3Frames=swFCPortRxC3Frames, swID=swID, swDeviceStatus=swDeviceStatus, swBlmPerfALPAMntTable=swBlmPerfALPAMntTable, swFCPortCapacity=swFCPortCapacity, swBrcdTrapBitMask=swBrcdTrapBitMask, swNsNodeName=swNsNodeName, swFwBehaviorInt=swFwBehaviorInt, swFCPortBrcdType=swFCPortBrcdType, swFabricMemTable=swFabricMemTable, swFCPortEntry=swFCPortEntry, swTrunkGroupNumber=swTrunkGroupNumber, swTopTalkerMntDpid=swTopTalkerMntDpid, swprivProtocolPassword=swprivProtocolPassword, swFwWriteThVals=swFwWriteThVals, swConnUnitZoneMiss=swConnUnitZoneMiss, swFCPortRxEncOutFrs=swFCPortRxEncOutFrs, swBootDate=swBootDate, swFCPortLipOuts=swFCPortLipOuts, swGroupMemPos=swGroupMemPos, swTrackChangesTrap=swTrackChangesTrap, swConnUnitNLNumOfTenancy=swConnUnitNLNumOfTenancy, swFCPortRxEncInFrs=swFCPortRxEncInFrs, swBeaconAdmStatus=swBeaconAdmStatus, swBlmPerfEEMntEntry=swBlmPerfEEMntEntry, swEventDescr=swEventDescr, swNbIslCost=swNbIslCost, swConnUnitC3DiscardDueToTXTimeout=swConnUnitC3DiscardDueToTXTimeout, swFwCustExceededActs=swFwCustExceededActs, swEventRepeatCount=swEventRepeatCount, swFCPortTxMcasts=swFCPortTxMcasts, swConnUnitOpend=swConnUnitOpend, swOperStatus=swOperStatus, swBlmPerfALPAMntEntry=swBlmPerfALPAMntEntry, swFwDefaultInBetweenActs=swFwDefaultInBetweenActs, sw21kN24k=sw21kN24k, swFwDefaultExceededActs=swFwDefaultExceededActs, swModule=swModule, swBlmPerfEECRC=swBlmPerfEECRC, swNbRemDomain=swNbRemDomain, swCpuOrMemoryUsage=swCpuOrMemoryUsage, swAgtCmtyEntry=swAgtCmtyEntry, swFCPortRxTooLongs=swFCPortRxTooLongs, swIPv6Address=swIPv6Address, swTopTalkerMntEntry=swTopTalkerMntEntry, swFwLastState=swFwLastState, swMemUsageLimit1=swMemUsageLimit1, swTrunkGrpTable=swTrunkGrpTable, swSystem=swSystem, swFwThresholdIndex=swFwThresholdIndex, swPortList=swPortList, swFCPortNoTxCredits=swFCPortNoTxCredits, swFCPortC3Discards=swFCPortC3Discards, swEndDeviceAlpa=swEndDeviceAlpa, swFirmwareVersion=swFirmwareVersion, swGroupType=swGroupType, swEndDeviceSigLoss=swEndDeviceSigLoss, swTrapsV2=swTrapsV2, swMemUsageLimit=swMemUsageLimit, swConnUnitFECCorrectedCounter=swConnUnitFECCorrectedCounter, swTopTalker=swTopTalker, swFabricReconfigTrap=swFabricReconfigTrap, swConnUnitC3DiscardOther=swConnUnitC3DiscardOther, swFlashDLUser=swFlashDLUser, swauthProtocolPassword=swauthProtocolPassword, swCpuNoOfRetries=swCpuNoOfRetries, SwSevType=SwSevType, swFwName=swFwName, swFwDefaultChangedActs=swFwDefaultChangedActs, swFwCustTimebase=swFwCustTimebase, swTrunkGrpEntry=swTrunkGrpEntry, swAgtTrapRcp=swAgtTrapRcp, swCpuUsage=swCpuUsage, swEndDeviceRlsEntry=swEndDeviceRlsEntry) mibBuilder.exportSymbols("SW-MIB", swFwCustInBetweenActs=swFwCustInBetweenActs, swFabricMemWwn=swFabricMemWwn, swFCPortTxWords=swFCPortTxWords, swConnUnitPortStatExtentionTable=swConnUnitPortStatExtentionTable, swConnUnitTimedOut=swConnUnitTimedOut, swTrunkGrpTx=swTrunkGrpTx, swNbIndex=swNbIndex, swNbIslState=swNbIslState, swBlmPerfFltAlias=swBlmPerfFltAlias, swMemPollingInterval=swMemPollingInterval, swIPv6Status=swIPv6Status, swFabricMemType=swFabricMemType, swFwCustBufSize=swFwCustBufSize, swFCPortWwn=swFCPortWwn, swFCPortLinkState=swFCPortLinkState, swEventTrap=swEventTrap, swFCPortFlag=swFCPortFlag, swConnUnitStateChange=swConnUnitStateChange, swFwDefaultBufSize=swFwDefaultBufSize, swNsIPA=swNsIPA, swDiagResult=swDiagResult, swNbBaudRate=swNbBaudRate, swFwDefaultHigh=swFwDefaultHigh, swNsLocalTable=swNsLocalTable, swConnUnitProcRequired=swConnUnitProcRequired, swAgtCfg=swAgtCfg, swFCPortOpStatus=swFCPortOpStatus, swFabricMemGWIP=swFabricMemGWIP, swAgtCmtyTable=swAgtCmtyTable, swFCPortRxLCs=swFCPortRxLCs, swFwCurVal=swFwCurVal, swFabricMemEIP=swFabricMemEIP, swConnUnitLli=swConnUnitLli, swPmgrEventDescr=swPmgrEventDescr, SwFwStatus=SwFwStatus, swTopTalkerMntTable=swTopTalkerMntTable, swGroupMemTable=swGroupMemTable, swPmgrEventType=swPmgrEventType, swFwThresholdTable=swFwThresholdTable, swFabricMemShortVersion=swFabricMemShortVersion, swCpuAction=swCpuAction, swFwBehaviorType=swFwBehaviorType, swFwActLevel=swFwActLevel, swTestString=swTestString, swFCPortRxWords=swFCPortRxWords, swNbRemPort=swNbRemPort, swCurrentDate=swCurrentDate, swFCPortRxTruncs=swFCPortRxTruncs, swStateChangeTrap=swStateChangeTrap, swSensorScn=swSensorScn, swNsLocalNumEntry=swNsLocalNumEntry, swEtherIPAddress=swEtherIPAddress, swFwDefaultAboveActs=swFwDefaultAboveActs, swEndDeviceProtoErr=swEndDeviceProtoErr, swEventTimeInfo=swEventTimeInfo, swConnUnitFTB6Miss=swConnUnitFTB6Miss, swPrincipalSwitch=swPrincipalSwitch, SwFwBehavior=SwFwBehavior, swFwLabel=swFwLabel, swFCPortName=swFCPortName, swEndDeviceLinkFailure=swEndDeviceLinkFailure, swFlashDLHost=swFlashDLHost, swFCPortTxType=swFCPortTxType, swTrunkGrpRx=swTrunkGrpRx, swFwDefaultTimebase=swFwDefaultTimebase, swNsFc4=swNsFc4, swBlmPerfFltRefkey=swBlmPerfFltRefkey, swFCPortRxMcasts=swFCPortRxMcasts, swBrcdGenericTrap=swBrcdGenericTrap, swTopTalkerMntIndex=swTopTalkerMntIndex, swNsNodeSymb=swNsNodeSymb, swBlmPerfFltPort=swBlmPerfFltPort, swFabricMemFCIP=swFabricMemFCIP, swFCPortPrevType=swFCPortPrevType, swMemUsageLimit3=swMemUsageLimit3, swConnUnitFECUnCorrectedCounter=swConnUnitFECUnCorrectedCounter, swPmgrEventTime=swPmgrEventTime, swConnUnitLunZoneMiss=swConnUnitLunZoneMiss, SwFwTimebase=SwFwTimebase, swNbRemPortName=swNbRemPortName, swEndDeviceInvalidCRC=swEndDeviceInvalidCRC, swConnUnitFLNumOfTenancy=swConnUnitFLNumOfTenancy, sw28k=sw28k, swBeaconOperStatus=swBeaconOperStatus, swFCPortScn=swFCPortScn, swFCPortDisableReason=swFCPortDisableReason, swGroupId=swGroupId, swFCPortSpecifier=swFCPortSpecifier, swFCPortRxBadOs=swFCPortRxBadOs, swSensorIndex=swSensorIndex, swFwCustChangedActs=swFwCustChangedActs, SwFwEvent=SwFwEvent, swConnUnitCRCWithBadEOF=swConnUnitCRCWithBadEOF, swEndDeviceRlsTable=swEndDeviceRlsTable, swFwLastEventVal=swFwLastEventVal)
text = '''aaaaaa aaaaaa aaaa aaaa a aa aa a aa0 bbbbbb bbbbbb bbbbbbbbbb.ccc ccccc c0 dddd ddddd ddddd.eeeee eeeeeee.fffff0 fffff fff ffffff.ggg ggg gg g.eeefaa0.''' lines = list(text.split('\n')) words = list(text.split(' ')) sentenses = list(text.split('.')) print(len(lines), lines, '\n') print(len(words), words, '\n') print(len(sentenses), sentenses, '\n') print(len(text))
class BinaryTree: def __init__(self, rootValue): self.value = rootValue self.left = None self.right = None def addLeftChild(self, val): newNode = BinaryTree(val) self.left = newNode def addRightChild(self, val): newNode = BinaryTree(val) self.right = newNode def setLeftChild(self, child): self.left = child def setRightChild(self, child): self.right = child
#!/usr/bin/env python """Args, Kwargs""" __author__ = "Petar Stoyanov" def main(*args, **kwargs): """Docstring""" for arg in args: print(arg) for (key, value) in kwargs.items(): print("{} - {}".format(key, value)) if __name__ == '__main__': main(1, 2, 3, name='pesho', age=30)
#a = 3 #b = 4 #c = a ** b #print (c) #x = 5 #print(x) #x = 5 #x += 3 # #print(x) #x = 5 #x -= 3 # #print(x) #x = 5 #x *= 3 #print(x) #x = 5 #x /= 3 #print(x) #x = 5 #x%=3 #print(x) # comparisin opperraters #x = 5 #y = 3 # #print(x == y) # # returns False because 5 is not equal to 3 #x = 5 #y = 3 # #print(x != y) #x = 5 #y = 3 # #print(x >= y) # # returns True because five is greater, or equal, to 3 x = 5 y = 3 print(x <= y) # returns False because 5 is neither less than or equal to 3
fruit = ["apple", "banana", "peach"] fruit # outputs # >>> ['apple', 'banana', 'peach']
#!/usr/bin/env python #--- Day 6: Universal Orbit Map --- #You've landed at the Universal Orbit Map facility on Mercury. Because navigation in space often involves transferring between orbits, the orbit maps here are useful for finding efficient routes between, for example, you and Santa. You download a map of the local orbits (your puzzle input). #Except for the universal Center of Mass (COM), every object in space is in orbit around exactly one other object. An orbit looks roughly like this: # \ # \ # | # | #AAA--> o o <--BBB # | # | # / # / #In this diagram, the object BBB is in orbit around AAA. The path that BBB takes around AAA (drawn with lines) is only partly shown. In the map data, this orbital relationship is written AAA)BBB, which means "BBB is in orbit around AAA". #Before you use your map data to plot a course, you need to make sure it wasn't corrupted during the download. To verify maps, the Universal Orbit Map facility uses orbit count checksums - the total number of direct orbits (like the one shown above) and indirect orbits. #Whenever A orbits B and B orbits C, then A indirectly orbits C. This chain can be any number of objects long: if A orbits B, B orbits C, and C orbits D, then A indirectly orbits D. #For example, suppose you have the following map: #COM)B #B)C #C)D #D)E #E)F #B)G #G)H #D)I #E)J #J)K #K)L #Visually, the above map of orbits looks like this: # G - H J - K - L # / / #COM - B - C - D - E - F # \ # I #In this visual representation, when two objects are connected by a line, the one on the right directly orbits the one on the left. #Here, we can count the total number of orbits as follows: #* D directly orbits C and indirectly orbits B and COM, a total of 3 orbits. #* L directly orbits K and indirectly orbits J, E, D, C, B, and COM, a total of 7 orbits. #* COM orbits nothing. #The total number of direct and indirect orbits in this example is 42. #What is the total number of direct and indirect orbits in your map data? puzzle_input = [] # 1) read input with open("day06.txt", "r") as file: ### DEBUG INPUT #with open("day06-test.txt", "r") as file: for entry in file.readlines(): puzzle_input.append(entry.rstrip().split(")")) # 1.1) check whether it would be a binary tree or not #checklist = [x[0] for x in split_input] #for x in checklist: # if checklist.count(x) > 2: # print("not binary,", x, "contained more than twice!") ## damn it: not binary, 7LD contained more than twice! ## okay. Let's build a ternary tree... # 2) build a tree from the input data # After having read through some reddit posts looking for help on this one (Python has no native tree structure, I was not able to get anytree do what I wanted it to do, I was not able to get my input into any reasonable structure, ...), I'm afraid I have to take a look at dictionaries again. At least, I already was at the right way of counting things, but without knowledge about how dictionaries work, I couldn't possibly figure out how to set it up properly (and my trials with doing it with lists of lists of lists of lists etc. etc. failed). # every object is key with value being the object that they orbit orbit_dict = {key: value for value, key in puzzle_input} # now, for every object=key, count how many "parents" there are, i.e. look-up the key's value in the keys until COM is reached - and COM is no key, so this will stop the while loop calc_orbits = 0 for obj in orbit_dict.keys(): obj_tmp = obj while obj_tmp in orbit_dict: calc_orbits += 1 obj_tmp = orbit_dict[obj_tmp] print(calc_orbits) ### DEBUG OUTPUT print(puzzle_input[0:5]) #print(orbit_dict)
""" Classes which create external representations of core objects. This allows the core objects to remain decoupled from the API and clients. These classes act as an adapter between the data format api clients expect, and the internal data of an object. """
def line(char='-', size=40): print(char * size) def title(text=''): line() print(f'{text.upper():^40}') line() def section(title='', paragraph='', size=40, char='-'): """ AINDA PRECISA TERMINAR ESSA MERDA :param title: :param paragraph: :param size: :param char: :return: """ print(char * size) print(f'{title.upper().center(size)}') words = paragraph.split() # c = 0 # for word in words: # print(f'[{c}] ({len(word)}) {word}') # c += 1 empty_space = size i = 0 while empty_space > 0: if (len(words[i])) < empty_space: # ainda tem espaço: imprime print(words[i], end=' ') i += 1 empty_space -= len(words[i]) else: print() empty_space = size print(char * size)
def print_name(prefix): print("searchingname with" + prefix) try: while True: name = (yield) if prefix in name: print(name) except GeneratorExit as identifier: print("Coroutine Exited") corou = print_name("Dear") corou.__next__() corou.send("Atul") corou.send("Dear Atul") corou.close()
n = int(input()) s = [1 if element == 'U' else -1 for element in input()] counter = 0 status = 0 step = 0 while step < n: if status == 0 and s[step] == -1: status = 1 start_pt = step step += 1 sum_val = -1 while step < n and status != 0: sum_val += s[step] if sum_val == 0: counter += 1 status = 0 step += 1 elif status == 0 and s[step] == 1: status = -1 start_pt = step step += 1 sum_val = 1 while step < n and status != 0: sum_val += s[step] if sum_val == 0: status = 0 step += 1 print (counter)
''' Author: tusikalanse Date: 2021-07-10 18:07:33 LastEditTime: 2021-07-10 18:10:07 LastEditors: tusikalanse Description: ''' cnt = 0 def gao(i: int) -> int: for _ in range(50): i = i + int(str(i)[::-1]) if str(i) == str(i)[::-1]: return 0 return 1 for i in range(10000): cnt += gao(i) print(cnt)
# To demonstrate, we insert the number 8 to specify the available space for the value. # Use "=" to place the plus/minus sign at the left most position: txt = "The temperature is {:=8} degrees celsius." print(txt.format(-5))
pais=('Alemania', 'Francia','Reino Unido','Italia','España', 'Países Bajos', 'Polonia', 'Bélgica', 'Suecia', 'Austria', 'Grecia','Rumania', 'República Checa', 'Portugal', 'Dinamarca', 'Hungría', 'Irlanda', 'Finlandia', 'Eslovaquia', 'Bulgaria' , 'Lituania', 'Eslovenia', 'Letonia', 'Luxemburgo', 'Estonia', 'Chipre', 'Malta') constantePais = 2 def posicionPais (paises): """tupla--->str OBJ: Devolver la posición de un elemento de la tupla PRE: cincoPaises debe estar definida, n debe ser un int""" n=int(input('Introduzca la posición deseada: ')) print(paises[n-1]) def estaEnTupla (paises): """ tuple-->str OBJ: comprueba si un país está en la tupla de los cinco primeros países. PRE: la tupla cincoPaises debe estar definida; país debe ser un str; la primera letra del país que se desea buscar debe ir en mayúscula . """ pais = input('Introduzca el país que desa comprobar: ') print (pais in paises) def contadorDePoblacion(nHabitantes, poblaciones): """int, tuple-->int OBJ: Encontrar los países con una población mayor a la introducida PRE: valor introducido>=0 """ contadorPais=0 for i in range (len(poblaciones)): if poblacion[i]>nHabitantes: contadorPais+=1 return contadorPais def poblacionPaises(poblaciones,constantePais): """tuple-->int OBJ: Devolver la suma de población de los cinco primeros países PRE: Tupla con los valores de población """ sumaPoblacion=0 for i in range(0,constantePais): sumaPoblacion = sumaPoblacion+poblaciones[i] return sumaPoblacion def tablaConPorcentaje(poblaciones,constantePais): """tuple-->int OBJ: Devolver la suma de población de los cinco primeros países PRE: Tupla con los valores de población """ porcentajes=() for i in range(0,constantePais): porcentajePoblacion= round((poblaciones[i]/poblacionPaises(poblaciones,constantePais))*100,4) porcentajes+=(porcentajePoblacion,) return porcentajes poblacion=(82605000,64770000,65893000,60721000,46427000,17091000,38453000,11354000, 9985000,8779000,11548000,200340000,10545000,10265000,5739000,9790000,4809000, 5506000,5433000,7110000,2852000,2066000,1953000,590000,1316000,850000,437000) def tablaPaises(poblacion, pais, constantePais): """tuple, tuple OBJ: Imprimir dos tablas, una con los nombres de los paises y otra con su población PRE: importar la tupla población y crear una con los nombres de los paises """ print('Paises','\t\t\t','Población','\t\t','Porcentaje') print('________________ ',' ___________________',' ___________________') for i in range(constantePais): print('%12s'%(pais[i]),'\t\t', end='') print(poblacion[i],'\t\t', end='') print(tablaConPorcentaje(poblaciones,constantePais)[i],'\t\t', end='') print('\n') def rentaMedia (poblaciones, rentas, constantePais): """tuple, tuple, tuple, int---> int OBJ: Calcular la RPC media de los 5 paises""" rMedia = 0 for i in range(constantePais): rMedia+= (rentas[i]*poblaciones[i])/poblacionPaises(poblaciones,constantePais) return rMedia def recorrerTupla (poblaciones, constantePais,paises): """int--> str OBJ: Encontrar los paises con menos poblecion de la introducida PRE: poblacionComparar<=0 """ poblacionComparar= int(input('Introduzca la población a comparar: ')) i=0 print(len(poblaciones)) while i<len(poblaciones): i+=1 if poblaciones[i-1]<poblacionComparar: print(paises[i-1]) def introducir_pais (): """str,int,int--> tupla,tupla,tupla OBJ: Hacer una tupla con todos los paises introducidos """ pais='' paises=() rentas=() poblaciones=() while pais!='fin': pais=input('Escriba el pais o fin para salir ') if pais!='fin': #Necesario para evitar que se añadan valores erroneos poblacion=int(input('Escriba la población del pais ')) renta=int(input('Escriba la renta del pais ')) paises+= (pais,) poblaciones+= (poblacion,) rentas+= (renta,) return paises,rentas,poblaciones paises,rentas,poblaciones=(introducir_pais ()) rentaMedia (poblaciones, rentas, constantePais) recorrerTupla (poblaciones, constantePais,paises) tablaPaises(poblaciones, paises, constantePais) nHabitantes=int(input('Introduzca el número de habitantes del país: '))
# Given a sentence, reverse each word in the sentence while keeping the order the same! # Code def word_flipper(our_string): """ Flip the individual words in a sentence Args: our_string(string): String with words to flip Returns: string: String with words flipped """ split = our_string.split(" ") retval = [] for s in split: retval.append(s[::-1]) retvalstr = " ".join(retval) return retvalstr # Test Cases print ("Pass" if ('retaw' == word_flipper('water')) else "Fail") print ("Pass" if ('sihT si na elpmaxe' == word_flipper('This is an example')) else "Fail") print ("Pass" if ('sihT si eno llams pets rof ...' == word_flipper('This is one small step for ...')) else "Fail")
""" sort and two pointers (twosum2) """ class Solution(object): def threeSum(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ result = [] nums.sort() for i in range(len(nums)): if i > 0 and nums[i] == nums[i-1]: continue left = i+1 right = len(nums)-1 while left < right: cur_sum = nums[i] + nums[left] + nums[right] if cur_sum > 0: right -=1 elif cur_sum < 0: left +=1 else: result.append([nums[i],nums[left],nums[right]]) left +=1 while nums[left] == nums[left-1] and left < right: left +=1 return result
''' Flask config. ''' display = {} CREDS_PATH = "app/creds.txt" TEMPLATES_AUTO_RELOAD = True
# equation constants # gas diffusivity CONST_EQ_GAS_DIFFUSIVITY = { "Chapman-Enskog": 1, "Wilke-Lee": 2 } # gas viscosity CONST_EQ_GAS_VISCOSITY = { "eq1": 1, "eq2": 2 } # sherwood number CONST_EQ_Sh = { "Frossling": 1, "Rosner": 2, "Garner-and-Keey": 3 } # thermal conductivity CONST_EQ_GAS_THERMAL_CONDUCTIVITY = { "eq1": 1, "eq2": 2 }
#shape of rectangle: def for_rectangle(): """printing shape of'rectangle' using for loop""" for row in range(5): for col in range(11): if row in(0,4) or col in(0,10): print("*",end=" ") else: print(" ",end=" ") print() def while_rectangle(): """printing shape of'rectangle' using while loop""" i=0 while i<5: j=0 while j<11: if i in(0,4) or j in(0,10): print("*",end=" ") else: print(" ",end=" ") j+=1 print() i+=1