content
stringlengths
7
1.05M
with open('day9.txt') as f: data = f.read().splitlines()[0].split(' ') nPlayers = int(data[0]) nMarbles = int(data[6]) # Players playerScores = [0] * nPlayers currentPlayer = -1 # Marbles right = [None] * nMarbles left = [None] * nMarbles # Initialise current = 0 total = 1 right[current] = current left[current] = current for i in range(1, nMarbles): # Update player currentPlayer = (currentPlayer + 1) % nPlayers # Update marbles if i % 23 == 0: # Add new marble to score playerScores[currentPlayer] += i # Remove the 7th marble counterclockwise and keep marble7 = left[left[left[left[left[left[left[current]]]]]]] playerScores[currentPlayer] += marble7 # Set new current current = right[marble7] # Redo the adjacency lists posLeft = left[marble7] posRight = right[marble7] right[posLeft] = posRight left[posRight] = posLeft right[marble7] = None left[marble7] = None else: posLeft = right[current] posRight = right[right[current]] right[posLeft] = i right[i] = posRight left[i] = posLeft left[posRight] = i current = i print(max(playerScores))
# 280. Wiggle Sort # ttungl@gmail.com # Given an unsorted array nums, reorder it in-place # such that nums[0] <= nums[1] >= nums[2] <= nums[3].... # For example, given nums = [3, 5, 2, 1, 6, 4], # one possible answer is [1, 6, 2, 5, 3, 4]. class Solution(object): def wiggleSort(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ # sol 1: # wiggle constraint: nums[i-1] <= nums[i] >= nums[i+1] # otherwise, swap them. # runtime: 120ms if not nums: return n = len(nums) for i in range(1, n, 2): if nums[i-1] > nums[i]: nums[i-1], nums[i] = nums[i], nums[i-1] if i+1 < n and nums[i] < nums[i+1]: nums[i], nums[i+1] = nums[i+1], nums[i] # sol 2: # runtime: 126ms if not nums: return for i in range(len(nums)-1): if (i%2 == 0 and (nums[i] > nums[i+1])) or (i%2 == 1 and nums[i] < nums[i+1]): nums[i], nums[i+1] = nums[i+1], nums[i] # sol 3: # runtime: 115ms m = (len(nums)+1)//2 nums.sort() nums[::2], nums[1::2] = nums[:m][::-1], nums[m:][::-1]
#!/usr/bin/env python # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Using the classifier -------------------- .. toctree:: :maxdepth: 3 cv/base cv/data cv/helper Cross-validation in MRIQC ------------------------- .. toctree:: :maxdepth: 3 cv/experiments """
def arithmeticExpression(a, b, c): """ Consider an arithmetic expression of the form a#b=c. Check whether it is possible to replace # with one of the four signs: +, -, * or / to obtain a correct """ return ( True if (a + b == c) or (a - b == c) or (a * b == c) or (a / b == c) else False )
# 3. Conte o total de comidas citadas no dicionário e quantas se repetem. lista = [] valor = [] itemData = [ { "name": "Meowsy", "species" : "cat", "foods": { "likes": ["tuna", "catnip"], "dislikes": ["ham", "zucchini"] } }, { "name": "Barky", "species" : "dog", "foods": { "likes": ["bones", "carrots"], "dislikes": ["tuna"] } }, { "name": "Purrpaws", "species" : "cat", "foods": { "likes": ["mice"], "dislikes": ["cookies"] } } ] comidas = [] for a in itemData: for b in a ['foods']['dislikes']: comidas.append(b) for c in a ['foods']['likes']: comidas.append(c) print(comidas) lista.count(valor) for a in comidas: print(comidas.count(a), a)
def consulta(message): resultado = {} ################# resultado['telefone'] = message.split('TELEFONE: ')[1].split('\n')[0] resultado['nome'] = message.split('NOME: ')[1].split('\n')[0] resultado['cpfCnpj'] = message.split('CPF/CNPJ: ')[1].split('\n')[0] resultado['operadora'] = message.split('OPERADORA: ')[1].split('\n')[0] resultado['ativacao'] = message.split('ATIVAÇÃO: ')[1].split('\n')[0] ################# return resultado
# Somar o preço dos produtos utilizando List Comprehension carrinho = [] carrinho.append(("Camisa 1", 35)) carrinho.append(("Bone 1", 20)) carrinho.append(("Calça 1", 80)) total = sum([int(y) for x, y in carrinho]) print(total)
LUCYFER_SETTINGS = { "SAVED_SEARCHES_ENABLE": False, "SAVED_SEARCHES_KEY": None, }
r = 'S' while r == "S": n = int(input('Digite um numero: ')) r = str(input('Quer continuar [S/N]: ')).upper() print('Acabou')
def reverse(number): stack = [] result = "" for num in str(number): stack.append(num) for i in range(len(stack)): result += stack.pop() print(result) return int(result) reverse(3479)
T_Call = 0 T_Squat = 1 T_Shank = 2 T_Jump = 3 T_Slap = 4 T_EyeContact = 5 function_name_dict = { T_Call: "call", T_Squat: "squat", T_Shank: "shank", T_Jump: "jump", T_Slap: "slap", T_EyeContact: "eye_contact" } RESPECT_MAX = 255
def power_of_two(x): if x == 1: return True if x < 1: return False return power_of_two(x / 2)
# 입력 p1, s1 = map(int, input().split()) s2, p2 = map(int, input().split()) # 출력 if p1+p2 > s1+s2: print("Persepolis") elif p1+p2 < s1+s2: print("Esteghlal") else: # 동점인 경우 if s1 > p2: print("Esteghlal") elif s1 < p2: print("Persepolis") else: print("Penalty")
class Solution: def searchRange(self, nums: List[int], target: int) -> List[int]: def search(lo, hi): if nums[lo] == target == nums[hi]: return [lo, hi] if nums[lo] <= target <= nums[hi]: mid = (lo + hi) // 2 l, r = search(lo, mid), search(mid+1, hi) return max(l, r) if -1 in l+r else [l[0], r[1]] return [-1, -1] if len(nums)==0: return [-1,-1] return search(0, len(nums)-1)
#15 Distance units # Askng for distance in feet. x = float(input("Enter the distance in feet = ")) inches = x * 12 yards = x * 0.33333 miles = x * 0.000189 print("Inches = ",inches," Yards = ",yards," Miles = ",miles)
# Generate n colors along a vector def get_vector(a, b): """Given two points (3D), Returns the common vector""" vector = ((b[0] - a[0]), (b[1] - a[1]), (b[2] - a[2])) return vector def get_t(n): if n <= 2: return [0, 1] else: t = [] for i in range(n): if i == 0: t.append(0) i += 1 elif i < n - 1: t.append(1/(n - 1) * i) i += 1 else: t.append(1) i += 1 return t def get_palette(a, b, n): vector = get_vector(a, b) t = get_t(n) palette = [] for i in range(n): scalar = ((t[i] * vector[0]), (t[i] * vector[1]), (t[i] * vector[2])) palette.append((round(scalar[0] + a[0]), round(scalar[1] + a[1]), round(scalar[2] + a[2]))) return palette
load("@berty_go//:config.bzl", "berty_go_config") load("@co_znly_rules_gomobile//:repositories.bzl", "gomobile_repositories") load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") load("@build_bazel_rules_swift//swift:repositories.bzl", "swift_rules_dependencies") def berty_bridge_config(): # fetch and config berty go dependencies berty_go_config() # config gomobile repositories gomobile_repositories() # config ios apple_support_dependencies() swift_rules_dependencies()
n = 95 for i in range(1,1000): a = n ^ i print(bin(a),a) print(i,bin(n),n) print()
''' Description : Use Of Basic Input / Output Function Date : 07 Feb 2021 Function Author : Prasad Dangare Input : Str Output : -- ''' print("Enter One Number") # to display on screen no = input() # to accept the standard input device ie keyword print ("Your Number Is : ", no) print ("Data Type Of Give Number Is : ", type(no))
# Global Reach # Demonstrates global variables def read_global(): print("From inside the local scope of read_global(), value is:", value) def shadow_global(): value = -10 print("From inside the local scope of shadow_global(), value is:", value) def change_global(): global value value = -10 print("From inside the local scope of change_global(), value is:", value) # main # value is a global variable because we're in the global scope here value = 10 print("In the global scope, value has been set to:", value, "\n") read_global() print("Back in the global scope, value is still:", value, "\n") shadow_global() print("Back in the global scope, value is still:", value, "\n") change_global() print("Back in the global scope, value has now changed to:", value) input("\n\nPress the enter key to exit.")
a = int(input("Enter: ")) reserve = a temp = 0 rev=0 while a>0: temp = a%10 a = a//10 rev = rev*10 + temp if reserve == rev: print("Palindrome") else: print("not")
class Track(object): id = 0 header_line = 1 filename = "" key_color = "#FF4D55" name = "" description = "" track_image_url = "http://lorempixel.com/400/200" location = "" gid = "" order = -1 def __init__(self, id, name, header_line, key_color, location, gid, order): super(Track, self).__init__() self.id = id self.name = name self.header_line = header_line self.key_color = key_color self.track_image_url = "http://lorempixel.com/400/200" self.location = location self.gid = gid self.order = order class Service(object): id = 0 service = "" url = "" def __init__(self, id, service, url): super(Service, self).__init__() self.id = id self.service = service self.url = url class LogoIco(object): logo_url = "" ico_url = "" main_page_url = "" def __init__(self, logo_url, ico_url, main_page_url): super(LogoIco, self).__init__() self.logo_url = logo_url self.ico_url = ico_url self.main_page_url = main_page_url class Speaker(object): def __init__(self): super(Speaker, self).__init__() class Copyright(object): def __init__(self): super(Copyright, self).__init__() class Session(object): def __init__(self): super(Session, self).__init__() class Sponsor(object): def __init__(self): super(Sponsor, self).__init__() class Microlocation(object): def __init__(self): super(Microlocation, self).__init__()
#!/usr/bin/env python3 if __name__ == '__main__': students_list = [] while True: command = input("Add, list, exit: ").lower() if command == 'exit': break elif command == 'add': last_name = input('Your last name^ ') class_name = input('Class ') grades = [] n = 0 while n < 5: grades.append(int(input('Your grades '))) n += 1 student = { 'Last name': last_name, 'Class': class_name, 'Grades': grades, } students_list.append(student) if len(students_list) > 1: students_list.sort(key=lambda item: item.get('Last name', '')) print(students_list) elif command == 'list': for index in range(len(students_list)): for key in students_list: print(students_list[index][key])
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', # pretrained='checkpoints/metanet-b4/det_fmtb4_v1.pth.tar', backbone=dict( type='Central_Model', backbone_name='MTB4', task_names=('gv_patch', 'gv_global'), main_task_name='gv_global', trans_type='crossconvhrnetlayer', task_name_to_backbone={ 'gv_global': { 'repeats': [2, 3, 6, 6, 6, 12], 'expansion': [1, 4, 6, 3, 2, 5], 'channels': [32, 64, 128, 192, 192, 384], 'final_drop': 0.0, 'block_ops': ['MBConv3x3'] * 4 + ['SABlock'] * 2, 'input_size': 256 }, 'gv_patch': { 'repeats': [2, 3, 6, 6, 6, 12], 'expansion': [1, 4, 6, 3, 2, 5], 'channels': [32, 64, 128, 192, 192, 384], 'final_drop': 0.0, 'block_ops': ['MBConv3x3'] * 4 + ['SABlock'] * 2, 'input_size': 256 } }, layer2channel={ 'layer1': 64, 'layer2': 128, 'layer3': 192 }, layer2auxlayers={ 'layer1': [ 'layer1', ], 'layer2': [ 'layer1', 'layer2', ], 'layer3': ['layer1', 'layer2', 'layer3'], }, trans_layers=['layer1', 'layer2', 'layer3'], channels=[64, 128, 192], ), decode_head=dict(type='ASPPHead', in_channels=384, in_index=3, channels=512, dilations=(1, 12, 24, 36), dropout_ratio=0.1, num_classes=19, norm_cfg=norm_cfg, align_corners=False, loss_decode=dict(type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), auxiliary_head=dict(type='FCNHead', in_channels=192, in_index=2, channels=256, num_convs=1, concat_input=False, dropout_ratio=0.1, num_classes=19, norm_cfg=norm_cfg, align_corners=False, loss_decode=dict(type='CrossEntropyLoss', use_sigmoid=False, loss_weight=0.4)), # model training and testing settings train_cfg=dict(), test_cfg=dict(mode='whole')) custom_imports = dict(imports=[ 'gvbenchmark.seg.models.backbones.central_model', ], allow_failed_imports=False)
# OpenWeatherMap API Key weather_api_key = "2e751db150eed8a2a8ae9dc91e31a091" # Google API Key g_key = "AIzaSyBqrWs9x-quXSBQkAVuz-x7PP3t64gJj7E"
def validacao(p): ok = False while not ok: n = str(input(p)).replace(',', '.').strip() if n.isalpha() or n == '': print(f'ERRO! "{n}" é um preço inválido!') else: ok = True return float(n)
def main(): s = input() weathers = ['Sunny', 'Cloudy', 'Rainy'] length = weathers.__len__() index = weathers.index(s) + 1 if index >= length: index = 0 print(weathers[index]) if __name__ == "__main__": main()
# Find height of a given binary tree class Node(): def __init__(self, value): self.left = None self.right = None self.value = value class Tree(): def height(self, node: Node): if node is None or (node.left is None and node.right is None): return 0 else: left_sub_tree_height = self.height(node.left) right_sub_tree_height = self.height(node.right) return max(left_sub_tree_height, right_sub_tree_height) + 1 n = Node(15) n.left = Node(10) n.right = Node(20) n.left.right = Node(12) n.right.left = Node(18) n.right.right = Node(30) # Creating left skewed tree n1 = Node(5) n1.left = Node(0) n1.left.left = Node(0) n1.left.left.left = Node(0) n1.left.left.left.left = Node(0) n1.left.left.left.left.left = Node(0) n1.left.left.left.left.left.left = Node(0) n.left.left = n1 print(f'The height of the tree is {Tree().height(n)}')
# 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. SERVICE_TYPE = 'loadbalancer' NEUTRON = 'neutron' LBAAS_AGENT_RPC_TOPIC = 'lbaas_agent' LBAAS_GENERIC_CONFIG_RPC_TOPIC = 'lbaas_generic_config' LBAAS_PLUGIN_RPC_TOPIC = 'n-lbaas-plugin' AGENT_TYPE_LOADBALANCER = 'OC Loadbalancer agent' # Service operation status constants ACTIVE = "ACTIVE" DOWN = "DOWN" CREATED = "CREATED" PENDING_CREATE = "PENDING_CREATE" PENDING_UPDATE = "PENDING_UPDATE" PENDING_DELETE = "PENDING_DELETE" INACTIVE = "INACTIVE" ERROR = "ERROR" STATUS_SUCCESS = "SUCCESS" ACTIVE_PENDING_STATUSES = ( ACTIVE, PENDING_CREATE, PENDING_UPDATE ) """ HTTP request/response """ HAPROXY_AGENT_LISTEN_PORT = 1234 REQUEST_URL = "http://%s:%s/%s" HTTP_REQ_METHOD_POST = 'POST' HTTP_REQ_METHOD_GET = 'GET' HTTP_REQ_METHOD_PUT = 'PUT' HTTP_REQ_METHOD_DELETE = 'DELETE' CONTENT_TYPE_HEADER = 'Content-type' JSON_CONTENT_TYPE = 'application/json' LB_METHOD_ROUND_ROBIN = 'ROUND_ROBIN' LB_METHOD_LEAST_CONNECTIONS = 'LEAST_CONNECTIONS' LB_METHOD_SOURCE_IP = 'SOURCE_IP' PROTOCOL_TCP = 'TCP' PROTOCOL_HTTP = 'HTTP' PROTOCOL_HTTPS = 'HTTPS' HEALTH_MONITOR_PING = 'PING' HEALTH_MONITOR_TCP = 'TCP' HEALTH_MONITOR_HTTP = 'HTTP' HEALTH_MONITOR_HTTPS = 'HTTPS' LBAAS = 'lbaas' PROTOCOL_MAP = { PROTOCOL_TCP: 'tcp', PROTOCOL_HTTP: 'http', PROTOCOL_HTTPS: 'https', } BALANCE_MAP = { LB_METHOD_ROUND_ROBIN: 'roundrobin', LB_METHOD_LEAST_CONNECTIONS: 'leastconn', LB_METHOD_SOURCE_IP: 'source' } REQUEST_RETRIES = 0 REQUEST_TIMEOUT = 120 # Operations CREATE = 'create' UPDATE = 'update' DELETE = 'delete' """ Event ids """ EVENT_CREATE_POOL = 'CREATE_POOL' EVENT_UPDATE_POOL = 'UPDATE_POOL' EVENT_DELETE_POOL = 'DELETE_POOL' EVENT_CREATE_VIP = 'CREATE_VIP' EVENT_UPDATE_VIP = 'UPDATE_VIP' EVENT_DELETE_VIP = 'DELETE_VIP' EVENT_CREATE_MEMBER = 'CREATE_MEMBER' EVENT_UPDATE_MEMBER = 'UPDATE_MEMBER' EVENT_DELETE_MEMBER = 'DELETE_MEMBER' EVENT_CREATE_POOL_HEALTH_MONITOR = 'CREATE_POOL_HEALTH_MONITOR' EVENT_UPDATE_POOL_HEALTH_MONITOR = 'UPDATE_POOL_HEALTH_MONITOR' EVENT_DELETE_POOL_HEALTH_MONITOR = 'DELETE_POOL_HEALTH_MONITOR' EVENT_AGENT_UPDATED = 'AGENT_UPDATED' EVENT_COLLECT_STATS = 'COLLECT_STATS'
def conta_caracter(s): """ Função que conta os caracteres de uma string. :param s: String a ser contada """ resultado = {} for caracter in s: resultado[caracter] = resultado.get(caracter, 0) + 1 return resultado if __name__ == '__main__': print(conta_caracter('pêssego')) print() print(conta_caracter('goiabada')) #==============================================================================
#!/usr/local/bin/python3 message = str(input("Message: ")) secret = "" for character in reversed(message): secret = secret + str(chr(ord(character)+1)) print(secret)
class Solution: def majorityElement(self, nums: List[int]) -> int: counter = {} for num in nums: if num not in counter: counter[num] = 1 else: counter[num] += 1 for key, value in counter.items(): if value > len(nums)/2: return key
oo000 = 0 for ii in range ( 11 ) : oo000 += ii if 51 - 51: IiI1i11I print ( oo000 ) # dd678faae9ac167bc83abf78e5cb2f3f0688d3a3
""" Author: PyDev Description: Doubly Linked List with a Tail consist of a element, where the element is the skeleton and consist of a value next, and previous variable/element. There is a Head pointer to refer to the front of the Linked List. The Tail pointer to refer to the end of Linked List/last elment """ class Element: """ A class that represent single skeleton of the Linked List""" def __init__(self, value): """ initiliaze new elements of the linked list with new value Arguments: - value: any object reference to assign new element to Linked List Instance varabiles: - value: an object value - next: a reference/pointer to next element in the linked list and default value is None - previous: a reference/pointer to previous element in the linked list and default value is None """ self.value = value self.next = None self.previous = None class DoublyLinkedListWithTail: """ A class of Doubly-Linked List where it have attributes and properties, such as: - Doubly Linked List - With tail Methods: - pushFront(new_element) - topFront() - popFront() - pushBack(new_element) - topBack() - popBack() - find() - erase() - isEmpty() - addBefore() - addAfter() """ def __init__(self, head = None): """ initilize DoublyLinkedListWithoutTail object instance Arguments: - head: default to None Instance variables: - head: an object value which refer to head/start of the Linked List - Tail: an object value which refer to the back/end of the Linked List """ self.head = self.tail = head def pushFront(self, new_element): """ add new element to the front Arguments: - new_element: an object that reference to new element to be added """ if self.tail: new_element.next = self.head self.head = new_element new_element.next.previous = self.head else: self.head = self.tail = new_element def topFront(self): """ return front element/item Returns: - the front element/item object """ return self.head def popFront(self): """remove front element/item""" if self.head: next_element = self.head.next if next_element: next_element.previous = None else: self.tail = None previous_head_object = self.head self.head = next_element else: print("Doubly Linked List With Tail is empty!") def pushBack(self, new_element): """ add to back,also known as append Arguments: - new_element: an object that reference to new element to be added """ if self.tail: self.tail.next = new_element new_element.previous = self.tail self.tail = new_element else: self.head = self.tail = new_element new_element.previous = None def topBack(self): """ return back/last element/item Returns: - the back/last element/item object """ if self.tail: return self.tail else: print("Doubly Linked List With Tail is empty!") def popBack(self): """ remove back element/item """ if self.head: if self.head == self.tail: self.head = self.tail = None else: self.tail = self.tail.previous self.tail.next = None else: print("Error! Doubly Linked List With Tail is empty!") def find(self, value): """ find if the value of an object is available in the current Linked List Arguments: - value: an object that represent a value we want to look for Returns: - boolean object """ current = self.head if self.head: while current.value != value and current.next: current = current.next if current.value == value: return True else: return False else: print("Doubly Linked List Without Tail is empty!") def erase(self, value): """ remove an element/item from Linked List Arguments: - value: an object that represent a value we want to look for """ current = self.head while current.value != value and current.next: current = current.next if current.value == value: if self.head.value == value: # We can use self.popFront() or self.head = current.next current.next = None elif not current.next: # We can use self.popBack() or self.tail = current.previous current.previous = None else: next_element = current.next previous_element = current.previous previous_element.next = next_element next_element.previous = previous_element current.next = current.previous = None def isEmpty(self): """ check if the Linked List is empty or not Reutruns: - boolean object """ if self.head: return False else: return True def addBefore(self, new_element, node): """ add new element/item before a position in the Linked List Arguments: - new_element: an object that reference to a new element to be added - node: an object that reference to an integer object that tells the method to where place the new element/item """ new_element.next = node new_element.previous = node.previous node.previous = new_element if new_element.previous: new_element.previous.next = new_element if self.head == node: self.head = new_element def addAfter(self, new_element, node): """ add new element/item after a node/element/item in the Linked List Arguments: - new_element: an object that reference to a new element to be added - node: an object that is part of the Linked List elements """ new_element.next = node.next new_element.previous = node node.next = new_element if new_element.next: new_element.next.previous = new_element if self.tail == node: self.tail = new_element
class Commit: def __init__(self): """ A simple feature container for each git commit """ self.features = {} def add(self, key, value): if key in self.features: raise Exception("Do not overwrite features") self.features[key] = value def remove(self, key): if key in self.features: return self.features.pop(key) raise Exception(f"The commit object does not have the feature: {key}") def get(self, key): if key in self.features: return self.features[key] raise Exception(f"The commit object does not have the feature: {key}") def get_all(self): return self.features.copy() def to_list(self): tmp = self.features.copy() tmp.pop("message", None) tmp.pop("files", None) return list(tmp.values())
APP_PORT = 7991 LOGFILE_PATH = "/var/log/application/db_replication.log" MASTER_MYSQL = { 'host': '127.0.0.1', 'port': 3306, 'user': 'root', 'password': 'password' }
""" Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a function that takes an integer n and return all possible combinations of its factors. Note: You may assume that n is always positive. Factors should be greater than 1 and less than n. Examples: input: 1 output: [] input: 37 output: [] input: 12 output: [ [2, 6], [2, 2, 3], [3, 4] ] input: 32 output: [ [2, 16], [2, 2, 8], [2, 2, 2, 4], [2, 2, 2, 2, 2], [2, 4, 4], [4, 8] ] """ # Iterative: def get_factors(n): todo, combis = [(n, 2, [])], [] while todo: n, i, combi = todo.pop() while i * i <= n: if n % i == 0: combis.append(combi + [i, n//i]) todo.append((n//i, i, combi+[i])) i += 1 return combis # Recursive: def get_factors_recur(n): def factor(n, i, combi, combis): while i * i <= n: if n % i == 0: combis.append(combi + [i, n//i]), factor(n//i, i, combi+[i], combis) i += 1 return combis return factor(n, 2, [], [])
############################################################################# #Replace with the persons name that you were texting leftName = "Bob" #Replace with your name rightName = "John" #############################################################################
BASE_DIR="" DATA_DIR="/mnt/nfs/work1/akshay/akshay/projects/oracle_cb/data/" REMOTE_PATH_TO_PYTHON="/mnt/nfs/work1/akshay/akshay/anaconda3/python3" REMOTE_BASE_DIR="/mnt/nfs/work1/akshay/akshay/projects/oracle_cb/"
def prime(num): flag=False for a in range(2,num-1): #basically prime no are divisible by itself and by 1 only so set input value -1 so i takes previous num if num%a==0: flag=True if flag==False: print("prime") else: print("not prime") num=int(input("enter the no")) prime(num)
#!/usr/bin/env python ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. # Modifications Copyright (c) 2018 LG Electronics, Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################### class ADVehicle: def __init__(self): self._chassis_pb = None self._localization_pb = None self.front_edge_to_center = 3.89 self.back_edge_to_center = 1.043 self.left_edge_to_center = 1.055 self.right_edge_to_center = 1.055 self.speed_mps = None self.x = None self.y = None self.heading = None def update_chassis(self, chassis_pb): self._chassis_pb = chassis_pb self.speed_mps = self._chassis_pb.speed_mps def update_localization(self, localization_pb): self._localization_pb = localization_pb self.x = self._localization_pb.pose.position.x self.y = self._localization_pb.pose.position.y self.heading = self._localization_pb.pose.heading def is_ready(self): if self._chassis_pb is None or self._localization_pb is None: return False return True
""" Some constants. """ VERSION = "0.1.0" BAT = "bat" LIGHT_THEME = "GitHub" LEFT_SIDE, RIGHT_SIDE = range(2)
class Environment: def __init__(self, bindings=None): self.stack = [bindings or {}] self.index = 0 def set(self, name, val, i=None): """ Assign value to a name. By default, names will be stored in the lowest scope possible. """ i = i if i != None else self.index if name in self.stack[i]: self.stack[i][name] = val elif i > 0: self.set(name, val, i - 1) else: self.stack[i][name] = val def get(self, name, i=None): """ Try to retrieve value for the specified name. If not available in the current scope, search in parent. """ i = i if i != None else self.index if name in self.stack[i]: return self.stack[i][name] elif i > 0: return self.get(name, i - 1) else: raise NameError( "symbol '{}' is not defined" .format(name) ) def push(self, bindings=None): self.index += 1 self.stack.append(bindings or {}) def pop(self): self.index -= 1 self.stack.pop() def show(self, exclude=None, include=None): for s in self.stack: for n, v in s.items(): if (not include or n in include) and not (exclude and n in exclude): print(' {} - {}'.format(n, v))
"""Chapter 5: Question 4. A simple condition to check if a number is power of 2: n & (n-1) == 0 Example: n = 1000 1000 & (1000 - 1)) = 1000 & 0111 = 0000 = 0 """ def is_power_of_two(n): """Checks if n is a power of 2. Args: n: Non-negative integer. """ if n < 0: raise ValueError('Input argument must be >= 0.') return n & (n-1) == 0
HTTP_STATUS_CODES = { "100": "Continue", "101": "Switching Protocols", "102": "Processing", "200": "OK", "201": "Created", "202": "Accepted", "203": "Non-Authoritative Information", "204": "No Content", "205": "Reset Content", "206": "Partial Content", "207": "Multi-Status", "208": "Already Reported", "226": "IM Used", "300": "Multiple Choices", "301": "Moved Permanently", "302": "Found", "303": "See Other", "304": "Not Modified", "305": "Use Proxy", "306": "Switch Proxy", "307": "Temporary Redirect", "308": "Permanent Redirect", "400": "Bad Request", "401": "Unauthorized", "402": "Payment Required", "403": "Forbidden", "404": "Not Found", "405": "Method Not Allowed", "406": "Not Acceptable", "407": "Proxy Authentication Required", "408": "Request Timeout", "409": "Conflict", "410": "Gone", "411": "Length Required", "412": "Precondition Failed", "413": "Payload Too Large", "414": "URI Too Long", "415": "Unsupported Media Type", "416": "Range Not Satisfiable", "417": "Expectation Failed", "418": "I'm a teapot", "421": "Misdirected Request", "422": "Unprocessable Entity", "423": "Locked", "424": "Failed Dependency", "425": "Too Early", "426": "Upgrade Required", "428": "Precontidion Required", "429": "Too Many Requests", "431": "Request Header Fields Too Large", "451": "Unavailable For Legal Reasons", "500": "Internal Server Error", "501": "Not Implemented", "502": "Bad Gateway", "503": "Service Unavailable", "504": "Gateway Timeout", "505": "HTTP Version Not Supported", "506": "Variant Also Negotiates", "507": "Insufficient Storage", "508": "Loop Detected", "510": "Not Extended", "511": "Network Authentication Require", }
# -*- coding: utf-8 -*- """ Created on Mon Mar 16 00:26:52 2020 @author: RogelioTESI """ def es_primo(Numero): resultado = True rep = 0 for divisor in range(2,Numero): if (Numero % divisor)==0: resultado = False break rep = rep+(divisor-1) return resultado,rep x,rep = es_primo(13)
# Write your code here N = int(input()) arr = list(map(int, input().split())) def give_soln(n): return ((2**n) - (1 + (n) + (n*(n-1)/2))) my_dict = dict() for i in arr: if i in my_dict: my_dict[i] += 1 else: my_dict[i] = 1 count = 0 for side in my_dict: if my_dict[side] >=3: count += give_soln(my_dict[side]) print(int(count)%(10**9 + 7))
"""This is where you modify constants""" USER = "user" PASSWORD = "pwd" DATABASE_NAME = "mydb" CATEGORIES = ["Fromages", "Desserts", "Viandes", "Chocolats", "Snacks", ] PRODUCT_NUMBER = 1000
model = dict( type='GroupFree3DNet', backbone=dict( type='PointNet2SASSG', in_channels=3, num_points=(2048, 1024, 512, 256), radius=(0.2, 0.4, 0.8, 1.2), num_samples=(64, 32, 16, 16), sa_channels=((64, 64, 128), (128, 128, 256), (128, 128, 256), (128, 128, 256)), fp_channels=((256, 256), (256, 288)), norm_cfg=dict(type='BN2d'), sa_cfg=dict( type='PointSAModule', pool_mod='max', use_xyz=True, normalize_xyz=True)), bbox_head=dict( type='GroupFree3DHead', in_channels=288, num_decoder_layers=6, num_proposal=256, transformerlayers=dict( type='BaseTransformerLayer', attn_cfgs=dict( type='GroupFree3DMHA', embed_dims=288, num_heads=8, attn_drop=0.1, dropout_layer=dict(type='Dropout', drop_prob=0.1)), ffn_cfgs=dict( embed_dims=288, feedforward_channels=2048, ffn_drop=0.1, act_cfg=dict(type='ReLU', inplace=True)), operation_order=('self_attn', 'norm', 'cross_attn', 'norm', 'ffn', 'norm')), pred_layer_cfg=dict( in_channels=288, shared_conv_channels=(288, 288), bias=True), sampling_objectness_loss=dict( type='FocalLoss', use_sigmoid=True, gamma=2.0, alpha=0.25, loss_weight=8.0), objectness_loss=dict( type='FocalLoss', use_sigmoid=True, gamma=2.0, alpha=0.25, loss_weight=1.0), center_loss=dict( type='SmoothL1Loss', reduction='sum', loss_weight=10.0), dir_class_loss=dict( type='CrossEntropyLoss', reduction='sum', loss_weight=1.0), dir_res_loss=dict( type='SmoothL1Loss', reduction='sum', loss_weight=10.0), size_class_loss=dict( type='CrossEntropyLoss', reduction='sum', loss_weight=1.0), size_res_loss=dict( type='SmoothL1Loss', beta=1.0, reduction='sum', loss_weight=10.0), semantic_loss=dict( type='CrossEntropyLoss', reduction='sum', loss_weight=1.0)), # model training and testing settings train_cfg=dict(sample_mod='kps'), test_cfg=dict( sample_mod='kps', nms_thr=0.25, score_thr=0.0, per_class_proposal=True, prediction_stages='last'))
#!/usr/bin/env python __all__ = ['adaptor', 'get_by_cai','util'] __author__ = "Rob Knight" __copyright__ = "Copyright 2007-2012, The Cogent Project" __credits__ = ["Rob Knight", "Stephanie Wilson", "Michael Eaton"] __license__ = "GPL" __version__ = "1.5.3" __maintainer__ = "Rob Knight" __email__ = "rob@spot.colorado.edu" __status__ = "Production"
# Заява про звуження переліку лікарських форм (Додаток 16) def test_15_lims_test_case_2_5(app): app.session.login(password='111', path_to_key='C:/98745612_7878789898_DU180323123055.ZS2') app.first_application.create_fifth_application() app.first_application.change_mpd_fifth() app.first_application.notifications_and_license_terms_fourth(comment='Коментар тест') app.first_application.submit_application_fourth(path_to_key='C:/98745612_7878789898_DU180323123055.ZS2', password='111') app.session.logout()
# -*- coding: utf-8 -*- class FieldError(Exception): pass class FieldDoesNotExist(Exception): pass class ReadOnlyError(AttributeError): pass
# Created by MechAviv # Quest ID :: 34931 # Not coded yet sm.setSpeakerID(3001510) sm.setSpeakerType(3) sm.flipDialogue() sm.setBoxChat() sm.boxChatPlayerAsSpeaker() sm.setBoxOverrideSpeaker() sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.setColor(1) sm.sendNext("#face1#Good work! I'm getting the signal again. We need to move quickly. Follow me.") sm.setSpeakerID(3001509) sm.setSpeakerType(3) sm.flipDialogue() sm.setBoxChat() sm.boxChatPlayerAsSpeaker() sm.setBoxOverrideSpeaker() sm.flipBoxChat() sm.flipBoxChatPlayerAsSpeaker() sm.setColor(1) sm.sendSay("#face3#Oh, we didn't let the sandstorm get us down!\r\nNow our trouble's behind us, and we're searchin' around!") # Update Quest Record EX | Quest ID: [34995] | Data: 00=h1;10=h0;01=h0;11=h0;02=h0;12=h0;13=h0;04=h0;23=h0;14=h0;05=h0;24=h0;15=h0;06=h0;16=h0;07=h0;17=h0;09=h0 sm.completeQuest(34931) # Unhandled Stat Changed [EXP] Packet: 00 00 00 00 01 00 00 00 00 00 EB 21 00 00 00 00 00 00 FF 00 00 00 00 sm.giveExp(7360) # Update Quest Record EX | Quest ID: [34931] | Data: exp=1 # Update Quest Record EX | Quest ID: [34995] | Data: 00=h1;10=h0;01=h0;11=h1;02=h0;12=h0;13=h0;04=h0;23=h0;14=h0;05=h0;24=h0;15=h0;06=h0;16=h0;07=h0;17=h0;09=h0 # Unhandled Message [47] Packet: 2F 0A 00 00 00 40 9C 00 00 00 00 00 00 28 00 00 00 00 00 00 80 05 BB 46 E6 17 02 0C 00 75 73 65 72 5F 6C 76 75 70 3D 32 36 B8 58 08 00 00 00 00 00 23 02 00 00 00 00 00 80 05 BB 46 E6 17 02 0D 00 6D 6F 62 5F 6B 69 6C 6C 3D 34 39 35 38 58 68 08 00 00 00 00 00 27 02 00 00 00 00 00 80 05 BB 46 E6 17 02 0D 00 6D 6F 62 5F 6B 69 6C 6C 3D 34 39 35 38 B0 83 08 00 00 00 00 00 2E 02 00 00 00 00 00 80 05 BB 46 E6 17 02 0B 00 6D 6F 62 5F 6B 69 6C 6C 3D 31 38 70 5E 09 00 00 00 00 00 66 02 00 00 00 00 00 80 05 BB 46 E6 17 02 14 00 63 6F 6D 62 6F 6B 69 6C 6C 5F 69 6E 63 72 65 73 65 3D 32 32 E0 75 09 00 00 00 00 00 6C 02 00 00 00 00 00 80 05 BB 46 E6 17 02 0D 00 6D 75 6C 74 69 6B 69 6C 6C 3D 34 32 34 98 81 09 00 00 00 00 00 6F 02 00 00 00 00 00 80 05 BB 46 E6 17 02 0D 00 6D 75 6C 74 69 6B 69 6C 6C 3D 34 32 34 50 8D 09 00 00 00 00 00 72 02 00 00 00 00 00 80 05 BB 46 E6 17 02 0A 00 6D 6F 62 5F 6B 69 6C 6C 3D 38 08 99 09 00 00 00 00 00 75 02 00 00 00 00 00 80 05 BB 46 E6 17 02 0A 00 6D 6F 62 5F 6B 69 6C 6C 3D 38 C4 22 11 00 00 00 00 00 63 04 00 00 0C 02 A0 18 36 98 8A D6 D4 01 0D 00 66 69 65 6C 64 5F 65 6E 74 65 72 3D 31 sm.warp(402090005, 0)
""" Codemonk link: https://www.hackerearth.com/practice/basic-programming/bit-manipulation/basics-of-bit-manipulation/practice-problems/algorithm/monk-and-tasks/ Given an array, the number of tasks is represented by the number of ones in the binary representation of each integer in the array. Print those integers in an increasing order based on the number of ones in the binary representation. Input - Output: First line contains the number of test cases. The next line contains the length of the array. The output is explained above. Sample input: 1 4 3 4 7 10 Sample Output: 4 3 10 7 """ """ The problem is straightforward. We find the number of ones in the binary representation of each integer in the array and we sort the integer based on this count, following an increasing order. The input length is insignificant. O(N) for the second "for" statement. The while statement in insignificant. Python uses Timsort which has O(NlogN) complexity. Final complexity: O(N + NlogN) => O(NlogN) """ test_cases = int(input()) for i in range(test_cases): days = int(input()) tasks = list(map(int, input().rstrip().split())) tasks_bin = [] for j in range(len(tasks)): count = 0 num = tasks[j] while num: # Count the number of 1's using bit manipulation. # num - 1 changes the LSB and the bits right to it. # Each time we make num & (num - 1) we remove the LSB. num = num & (num - 1) count += 1 tasks_bin.append(count) # Sort based on the first element of each sub-pair. final = [x[1] for x in sorted(zip(tasks_bin, tasks), key=lambda pair: pair[0])] print(*final) # Faster approach, bin returns string # for i in range(int(input())): # n = int(input()) # a = input().split() # print(" ".join(sorted(a, key=lambda x: bin(int(x)).count('1'))))
__all__ = ["InvalidCredentialsException"] class InvalidCredentialsException(Exception): pass class NoHostsConnectedToException(Exception): pass
# More details on this kata # https://www.codewars.com/kata/51c8e37cee245da6b40000bd def solution(string,markers): if len(string) == 0: return '' t, tt, test, l, j, ret= [], [], [], [], [], '' s = string.split('\n') for _s in s: for m in markers: if _s.find(m) != -1: t.append(_s.find(m)) test.append(t) t = [] for a in test: tt.append(sorted(a)) for i, _s in zip(tt, s): if i == []: l.append(_s) if i != []: l.append(_s[:i[0]]) for s in l: if s != '': if s[-1] == ' ': j.append(s[:-1]) continue else: j.append(s) continue else: j.append(s) for i, s in enumerate(j): if i == len(j) - 1: ret += s continue ret += s + '\n' return ret
# Copyright (c) 2018, Benjamin Shropshire, # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # 3. Neither the name of the copyright holder nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """ A basic test that always passes, as long as everythin in `targets` builds. This is usefull, for example, with a genrule. """ def build_test(name = None, targets = [], tags = []): """A test that depends on arbitary targets. Args: name: The target name. targets: Targets to check. tags: tags for the test. """ # Use a genrule to ensure the targets are built native.genrule( name = name + "_gen", srcs = targets, outs = [name + "_gen.out"], tags = tags, visibility = ["//visibility:private"], cmd = "echo > $@", ) native.sh_test( name = name, srcs = ["@bazel_rules//build_test:blank.sh"], data = [name + "_gen.out"], tags = tags, timeout = "short", )
def leiaint(n=""): n = str(n) while not n.isdecimal(): n = str(input('Digite um número: ')).strip() if not n.isdecimal(): print('\033[0;31mERRO! Digite um número inteiro válido.\033[m') n = int(n) return n numero = leiaint() print(f'Você acabou de digitar o número {numero}')
def get_global_config(): result = { 'outcome' : 'success', 'data' : { 'credentials_file' : r'./config/config.ini', } } return result
# Url to manually retrieve authorization code AUTH_URL = "https://auth.tdameritrade.com/auth" # API endpoint for token and authorization code authentication OAUTH_URL = "https://api.tdameritrade.com/v1/oauth2/token" # Quote endpoints GET_QUOTES_URL = "https://api.tdameritrade.com/v1/marketdata/quotes" GET_QUOTE_URL = "https://api.tdameritrade.com/v1/marketdata/" # History endpoint GET_PRICE_HISTORY_URL = "https://api.tdameritrade.com/v1/marketdata/"
""" Default django-evostream configuration """ EVOSTREAM_URI = 'http://127.0.0.1:7777'
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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. # # NOTE: This class is auto generated by the jdcloud code generator program. class ConsumeRecord(object): def __init__(self, id=None, billingRecordId=None, appCode=None, serviceCode=None, region=None, resourceId=None, pin=None, formula=None, billingType=None, priceSnapShot=None, startTime=None, endTime=None, createTime=None, billFee=None, billFee2=None, discountFee=None, couponId=None, couponFee=None, transactionNo=None, isBillGenerated=None, subBillId=None, refundNo=None, actualFee=None, formulaName=None): """ :param id: (Optional) 消费记录数据库唯一id :param billingRecordId: (Optional) 消费记录id :param appCode: (Optional) appCode :param serviceCode: (Optional) serviceCode :param region: (Optional) 区域 :param resourceId: (Optional) 资源id :param pin: (Optional) 用户pin :param formula: (Optional) 规格 :param billingType: (Optional) 计费类型 :param priceSnapShot: (Optional) 价格快照 :param startTime: (Optional) 开始时间 :param endTime: (Optional) 结束时间 :param createTime: (Optional) 创建日期 :param billFee: (Optional) 账单金额 :param billFee2: (Optional) 账单金额保留小数点后2位 :param discountFee: (Optional) 折扣金额 :param couponId: (Optional) 优惠券id :param couponFee: (Optional) 优惠金额 :param transactionNo: (Optional) 交易单号 :param isBillGenerated: (Optional) null :param subBillId: (Optional) 子账单id :param refundNo: (Optional) 退款单号 :param actualFee: (Optional) 优惠后金额 :param formulaName: (Optional) 规格名称 """ self.id = id self.billingRecordId = billingRecordId self.appCode = appCode self.serviceCode = serviceCode self.region = region self.resourceId = resourceId self.pin = pin self.formula = formula self.billingType = billingType self.priceSnapShot = priceSnapShot self.startTime = startTime self.endTime = endTime self.createTime = createTime self.billFee = billFee self.billFee2 = billFee2 self.discountFee = discountFee self.couponId = couponId self.couponFee = couponFee self.transactionNo = transactionNo self.isBillGenerated = isBillGenerated self.subBillId = subBillId self.refundNo = refundNo self.actualFee = actualFee self.formulaName = formulaName
def start(): print('\nThis is my Rock Paper Scissors Game!\n\n') Player_one = "Kaly" Player_two = "Erik" def choices(Player_one_choice, Player_two_choice): if Player_one_choice == 'rock' and Player_two_choice == 'paper': return('Paper cover Rock! ' + Player_two + ' Wins !') elif Player_one_choice == 'paper' and Player_two_choice == 'rock': return('Paper cover Rock! ' + Player_one + ' Wins !') elif Player_one_choice == 'scissors' and Player_two_choice == 'paper': return('Scissors cuts Paper! ' + Player_one + ' Wins !') elif Player_one_choice == 'paper' and Player_two_choice == 'scissors': return('Scissors cuts Paper! ' + Player_two + ' Wins !') elif Player_one_choice == 'scissors' and Player_two_choice == 'rock': return('Rock smashes Scissors! ' + Player_two + ' Wins !') elif Player_one_choice == 'rock' and Player_two_choice == 'scissors': return('Rock smashes Scissors! ' + Player_one + ' Wins !') elif Player_one_choice == Player_two_choice: return(Player_one+' and '+ Player_two + ' tied!') else: return('Please type Rock, Paper or Scissors!') Player_one_choose = input('Does '+ Player_one + ' choose Rock, Paper or Scissors? ').lower() Player_two_choose = input('Does '+ Player_two + ' choose Rock, Paper or Scissors? ').lower() print(choices(Player_one_choose, Player_two_choose)) def Play_Again(): Again = input("Would you like to play the game again? ").lower() if Again == 'no': quit() if Again == 'yes': start() else: print('Please enter Yes or No. Thank you!') Play_Again() Play_Again() start()
def parameters(): epsilon = 0.0001 # regularization K = 3 # number of desired clusters n_iter = 5 # number of iterations skin_n_iter = 5 skin_epsilon = 0.0001 skin_K = 3 theta = 2.0 # threshold for skin detection return epsilon, K, n_iter, skin_n_iter, skin_epsilon, skin_K, theta
"""Constants used by the Netatmo component.""" API = "api" DOMAIN = "netatmo" MANUFACTURER = "Netatmo" MODELS = { "NAPlug": "Relay", "NATherm1": "Smart Thermostat", "NRV": "Smart Radiator Valves", "NACamera": "Smart Indoor Camera", "NOC": "Smart Outdoor Camera", "NSD": "Smart Smoke Alarm", "NACamDoorTag": "Smart Door and Window Sensors", "NHC": "Smart Indoor Air Quality Monitor", "NAMain": "Smart Home Weather station – indoor module", "NAModule1": "Smart Home Weather station – outdoor module", "NAModule4": "Smart Additional Indoor module", "NAModule3": "Smart Rain Gauge", "NAModule2": "Smart Anemometer", "public": "Public Weather stations", } AUTH = "netatmo_auth" CONF_PUBLIC = "public_sensor_config" CAMERA_DATA = "netatmo_camera" HOME_DATA = "netatmo_home_data" DATA_HANDLER = "netatmo_data_handler" SIGNAL_NAME = "signal_name" CONF_CLOUDHOOK_URL = "cloudhook_url" CONF_WEATHER_AREAS = "weather_areas" CONF_NEW_AREA = "new_area" CONF_AREA_NAME = "area_name" CONF_LAT_NE = "lat_ne" CONF_LON_NE = "lon_ne" CONF_LAT_SW = "lat_sw" CONF_LON_SW = "lon_sw" CONF_PUBLIC_MODE = "mode" CONF_UUID = "uuid" OAUTH2_AUTHORIZE = "https://api.netatmo.com/oauth2/authorize" OAUTH2_TOKEN = "https://api.netatmo.com/oauth2/token" DATA_CAMERAS = "cameras" DATA_DEVICE_IDS = "netatmo_device_ids" DATA_EVENTS = "netatmo_events" DATA_HOMES = "netatmo_homes" DATA_PERSONS = "netatmo_persons" DATA_SCHEDULES = "netatmo_schedules" NETATMO_WEBHOOK_URL = None NETATMO_EVENT = "netatmo_event" DEFAULT_PERSON = "Unknown" DEFAULT_DISCOVERY = True DEFAULT_WEBHOOKS = False ATTR_ID = "id" ATTR_PSEUDO = "pseudo" ATTR_NAME = "name" ATTR_EVENT_TYPE = "event_type" ATTR_HEATING_POWER_REQUEST = "heating_power_request" ATTR_HOME_ID = "home_id" ATTR_HOME_NAME = "home_name" ATTR_PERSON = "person" ATTR_PERSONS = "persons" ATTR_IS_KNOWN = "is_known" ATTR_FACE_URL = "face_url" ATTR_SCHEDULE_ID = "schedule_id" ATTR_SCHEDULE_NAME = "schedule_name" ATTR_SELECTED_SCHEDULE = "selected_schedule" ATTR_CAMERA_LIGHT_MODE = "camera_light_mode" SERVICE_SET_CAMERA_LIGHT = "set_camera_light" SERVICE_SET_SCHEDULE = "set_schedule" SERVICE_SET_PERSONS_HOME = "set_persons_home" SERVICE_SET_PERSON_AWAY = "set_person_away" EVENT_TYPE_CANCEL_SET_POINT = "cancel_set_point" EVENT_TYPE_LIGHT_MODE = "light_mode" EVENT_TYPE_OFF = "off" EVENT_TYPE_ON = "on" EVENT_TYPE_SET_POINT = "set_point" EVENT_TYPE_THERM_MODE = "therm_mode" MODE_LIGHT_ON = "on" MODE_LIGHT_OFF = "off" MODE_LIGHT_AUTO = "auto" CAMERA_LIGHT_MODES = [MODE_LIGHT_ON, MODE_LIGHT_OFF, MODE_LIGHT_AUTO]
"""IntelliJ plugin debug target rule used for debugging IntelliJ plugins. Creates a plugin target debuggable from IntelliJ. Any files in the 'deps' and 'javaagents' attribute are deployed to the plugin sandbox. Any files are stripped of their prefix and installed into <sandbox>/plugins. If you need structure, first put the files into //build_defs:build_defs%repackage_files. intellij_plugin_debug_targets can be nested. repackaged_files( name = "foo_files", srcs = [ ":my_plugin_jar", ":my_additional_plugin_files", ], prefix = "plugins/foo/lib", ) intellij_plugin_debug_target( name = "my_debug_target", deps = [ ":my_jar", ], javaagents = [ ":agent_deploy.jar", ], ) """ load("//build_defs:build_defs.bzl", "output_path", "repackaged_files_data") SUFFIX = ".intellij-plugin-debug-target-deploy-info" def _repackaged_deploy_file(f, repackaging_data): return struct( src = f, deploy_location = output_path(f, repackaging_data), ) def _flat_deploy_file(f): return struct( src = f, deploy_location = f.basename, ) def _intellij_plugin_debug_target_aspect_impl(target, ctx): aspect_intellij_plugin_deploy_info = None files = target.files if ctx.rule.kind == "intellij_plugin_debug_target": aspect_intellij_plugin_deploy_info = target.intellij_plugin_deploy_info elif ctx.rule.kind == "_repackaged_files": data = target[repackaged_files_data] aspect_intellij_plugin_deploy_info = struct( deploy_files = [_repackaged_deploy_file(f, data) for f in data.files.to_list()], java_agent_deploy_files = [], ) # TODO(brendandouglas): Remove when migrating to Bazel 0.5, when DefaultInfo # provider can be populated by '_repackaged_files' directly files = depset(transitive = [files, data.files]) else: aspect_intellij_plugin_deploy_info = struct( deploy_files = [_flat_deploy_file(f) for f in target.files.to_list()], java_agent_deploy_files = [], ) return struct( input_files = files, aspect_intellij_plugin_deploy_info = aspect_intellij_plugin_deploy_info, ) _intellij_plugin_debug_target_aspect = aspect( implementation = _intellij_plugin_debug_target_aspect_impl, ) def _build_deploy_info_file(deploy_file): return struct( execution_path = deploy_file.src.path, deploy_location = deploy_file.deploy_location, ) def _intellij_plugin_debug_target_impl(ctx): files = depset() deploy_files = [] java_agent_deploy_files = [] for target in ctx.attr.deps: files = depset(transitive = [files, target.input_files]) deploy_files.extend(target.aspect_intellij_plugin_deploy_info.deploy_files) java_agent_deploy_files.extend(target.aspect_intellij_plugin_deploy_info.java_agent_deploy_files) for target in ctx.attr.javaagents: files = depset(transitive = [files, target.input_files]) java_agent_deploy_files.extend(target.aspect_intellij_plugin_deploy_info.deploy_files) java_agent_deploy_files.extend(target.aspect_intellij_plugin_deploy_info.java_agent_deploy_files) deploy_info = struct( deploy_files = [_build_deploy_info_file(f) for f in deploy_files], java_agent_deploy_files = [_build_deploy_info_file(f) for f in java_agent_deploy_files], ) output = ctx.actions.declare_file(ctx.label.name + SUFFIX) ctx.actions.write(output, deploy_info.to_proto()) # We've already consumed any dependent intellij_plugin_debug_targets into our own, # do not build or report these files = depset([f for f in files.to_list() if not f.path.endswith(SUFFIX)]) files = depset([output], transitive = [files]) return struct( files = files, intellij_plugin_deploy_info = struct( deploy_files = deploy_files, java_agent_deploy_files = java_agent_deploy_files, ), ) intellij_plugin_debug_target = rule( implementation = _intellij_plugin_debug_target_impl, attrs = { "deps": attr.label_list(aspects = [_intellij_plugin_debug_target_aspect]), "javaagents": attr.label_list(aspects = [_intellij_plugin_debug_target_aspect]), }, )
def perm(text1, text2): return sum(ord(c) for c in text1) == sum(ord(c) for c in text2) # test one = 'abc' two = 'bcaa' print(perm(one, two))
class Problem: def __init__(self, n, m): self.n = n self.m = m self.answer = [0 for _ in range(m)] self.used = [False for _ in range(n)] def printAnswer(self): for number in self.answer: print(number,end=' ') print() def makeAnswer(self, index): if index == len(self.answer): self.printAnswer() return for i in range(1, n+1): if index == 0 or (self.used[i-1] == False and self.answer[index-1]<i): self.answer[index] = i self.used[i-1] = True self.makeAnswer(index+1) self.used[i-1] = False self.answer[index] = 0 return def printAnswers(self): self.makeAnswer(0) return n, m = map(int, input().split()) problem = Problem(n, m) problem.printAnswers()
class Node: def __init__(self, data): self.right = self.left = None self.data = data class Solution: def insert(self, root, data): if root is None: return Node(data) else: if data <= root.data: cur = self.insert(root.left, data) root.left = cur else: cur = self.insert(root.right, data) root.right = cur return root def level_order(self, root): tree_height = self.get_height(root) for level in range(1, tree_height + 1): self.print_nodes_in_level(root, level) def print_nodes_in_level(self, root, level): if root is not None: if level == 1: print(root.data, end=' ') elif level > 1: self.print_nodes_in_level(root.left, level - 1) self.print_nodes_in_level(root.right, level - 1) def get_height(self, root): if root is None: return 0 else: current = root height_left = self.get_height(current.left) height_right = self.get_height(current.right) return 1 + max(height_left, height_right) T = int(input()) myTree = Solution() root = None for i in range(T): data = int(input()) root = myTree.insert(root, data) myTree.level_order(root)
def define_suit(card): if card.endswith("C"): return "clubs" if card.endswith("D"): return "diamonds" if card.endswith("H"): return "hearts" if card.endswith("S"): return "spades"
_base_ = [ '../_base_/models/retinanet_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( backbone=dict( type='ResNetEMOD', ar=dict(ratio=1. / 4.), stage_with_ar=(True, True, True, True) ), bbox_head=dict(num_classes=11)) # dataset settings dataset_type = 'CocoDataset' data_root = 'data/underwater/' classes=('Gastropoda', 'Osteroida', 'Cephalopoda', 'Decapoda', 'Aplousobranchia', 'NotPleuronectiformes', 'Perciformes', 'Fish', 'Rajiformes', 'NonLiving', 'Pleuronectiformes') img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', img_scale=(1333, 800), keep_ratio=True), dict(type='RandomFlip', flip_ratio=0.5), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='DefaultFormatBundle'), dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']), ] test_pipeline = [ dict(type='LoadImageFromFile'), dict( type='MultiScaleFlipAug', img_scale=(1333, 800), flip=False, transforms=[ dict(type='Resize', keep_ratio=True), dict(type='RandomFlip'), dict(type='Normalize', **img_norm_cfg), dict(type='Pad', size_divisor=32), dict(type='ImageToTensor', keys=['img']), dict(type='Collect', keys=['img']), ]) ] data = dict( samples_per_gpu=2, workers_per_gpu=2, train=dict( type=dataset_type, classes=classes, ann_file=data_root + 'annotations/habcam_seq0_training_1.mscoco.json', img_prefix=data_root + 'habcam_seq0/', pipeline=train_pipeline), val=dict( type=dataset_type, classes=classes, ann_file=data_root + 'annotations/habcam_seq0_validation_1.mscoco.json', img_prefix=data_root + 'habcam_seq0/', pipeline=test_pipeline), test=dict( type=dataset_type, classes=classes, ann_file=data_root + 'annotations/habcam_seq0_validation_1.mscoco.json', img_prefix=data_root + 'habcam_seq0/', pipeline=test_pipeline)) # optimizer optimizer = dict(type='SGD', lr=0.005, momentum=0.9, weight_decay=0.0001) optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2),_delete_=True) # learning policy lr_config = dict( policy='step', warmup='linear', warmup_iters=500, warmup_ratio=0.1, step=[8, 11]) runner = dict(type='EpochBasedRunner', max_epochs=12)
class ValorantApi(Exception): pass class InvalidOrMissingParameter(ValorantApi): # 400 pass class NotFound(ValorantApi): # 404 pass class AttributeExistsError(ValorantApi): pass
class MobilePhone: def __init__(self, memory): self.memory = memory class Camera: def take_picture(self): print("Say cheese!") class CameraPhone(MobilePhone, Camera): pass iphone = CameraPhone('16GB') print(iphone.memory) iphone.take_picture()
# =============================================================== # =======================AST=HIERARCHY=========================== # =============================================================== ERROR = 0 INTEGER = 1 class Node: def __init__(self): self.static_type = "" class ProgramNode(Node): def __init__(self, class_list): Node.__init__(self) self.class_list = class_list #self.expr = expr class ClassNode(Node): def __init__(self,name,parent,feature_list): Node.__init__(self) self.name = name self.parent = parent self.feature_list = feature_list class FeatureNode(Node): pass class Atribute_Definition(FeatureNode): def __init__(self,att_id,att_type,exp): Node.__init__(self) self.att_id = att_id self.att_type = att_type self.expr = exp class Method_Definition(FeatureNode): def __init__(self,meth_id,param_list, return_type, exp): Node.__init__(self) self.meth_id = meth_id self.param_list = param_list self.return_type = return_type self.exp = exp class ParamNode(Node): def __init__(self,par_id,par_type): Node.__init__(self) self.par_id = par_id self.par_type = par_type class ExpressionNode(Node): pass class DotNode(Node): def __init__(self,expression,method_id,exp,exp_type): Node.__init__(self) self.expression = expression self.method_id = method_id self.exp_type = exp_type self.exp = exp class MethodCallNode(Node): def __init__(self,method_id,exp): Node.__init__(self) self.method_id = method_id self.exp = exp class IfNode(Node): def __init__(self,condition,true_exp,false_exp): Node.__init__(self) self.condition = condition self.true_exp = true_exp self.false_exp = false_exp class WhileNode(Node): def __init__(self,condition,exp): Node.__init__(self) self.condition = condition self.exp = exp class CaseNode(Node): def __init__(self, cases_list, exp): Node.__init__(self) self.exp = exp self.cases_list = cases_list # Case[] class Case(Node): def __init__(self,var_id,exp_type,exp): Node.__init__(self) self.exp = exp self.exp_type = exp_type self.var_id = var_id class NewNode(Node): def __init__(self,n_type): Node.__init__(self) self.type = n_type class UtilNode(Node): pass class BinaryOperatorNode(ExpressionNode): def __init__(self, left, right): Node.__init__(self) self.left = left self.right = right class UnaryOperator(ExpressionNode): def __init__(self, expr): Node.__init__(self) self.expr = expr class CompareNode(ExpressionNode): def __init__(self, left, right): Node.__init__(self) self.left = left self.right = right class AtomicNode(ExpressionNode): pass class IsVoidNode(UnaryOperator): pass class PlusNode(BinaryOperatorNode): pass class MinusNode(BinaryOperatorNode): pass class StarNode(BinaryOperatorNode): pass class DivNode(BinaryOperatorNode): pass class NegationNode(UnaryOperator): pass class IntComplement(UnaryOperator): pass class LessThan(CompareNode): pass class LessThanEquals(CompareNode): pass class Equals(CompareNode): pass class LetInNode(AtomicNode): def __init__(self, declaration_list, expr): Node.__init__(self) self.declaration_list = declaration_list self.expr = expr class BlockNode(AtomicNode): def __init__(self, expr_list): Node.__init__(self) self.expr_list = expr_list class ParentesisNode(AtomicNode): def __init__(self, expr): Node.__init__(self) self.expr = expr class AssignNode(AtomicNode): def __init__(self, idx_token, expr): Node.__init__(self) self.idx_token = idx_token self.expr = expr self.variable_info = None class IntegerNode(AtomicNode): def __init__(self, integer_token): Node.__init__(self) self.integer_token = integer_token class StringNode(AtomicNode): def __init__(self, string): Node.__init__(self) self.string = string class BoolNode(AtomicNode): def __init__(self, boolean): Node.__init__(self) self.boolean = boolean class VariableNode(AtomicNode): def __init__(self, idx_token): Node.__init__(self) self.idx_token = idx_token self.variable_info = None class DeclarationNode(UtilNode): def __init__(self, idx_token, id_type, expr=None): Node.__init__(self) self.idx_token = idx_token self.id_type = id_type self.expr = expr self.variable_info = None
# for i in range(17): # print("{0:>2} in hex is {0:>02x}".format(i)) # # # x = 0x20 # y = 0x0a # # # print(x) # print(y) # print(x * y) # # # print(0b101010) # When converting a decimal number to binary, you look for the highest power # of 2 smaller than the number and put a 1 in that column. You then take the # remainder and repeat the process with the next highest power - putting a 1 # if it goes into the remainder and a zero otherwise. Keep repeating until you # have dealt with all powers down to 2 ** 0 (i.e., 1). # # Write a program that requests a number from the keyboard, then prints out # its binary representation. # # Obviously you could use a format string, but that is not allowed for this # challenge. # # The program should cater for numbers up to 65535; i.e. (2 ** 16) - 1 # # Hint: you will need integer division (//), and modulo (%) to get the remainder. # You will also need ** to raise one number to the power of another: # For example, 2 ** 8 raises 2 to the power 8. # # As an optional extra, avoid printing leading zeros. # # Once the program is working, modify it to print Octal rather than binary. powers = [] for power in range(15, -1, -1): powers.append(2 ** power) #binary # powers.append(8 ** power) #octal print(powers) x = int(input("Please enter a number: ")) printing = False for power in powers: # print(x // power, end="") bit = x // power if bit != 0 or power == 1: printing = True if printing: print(bit, end="") x %= power
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def __repr__(self): return str(self.val) # Brute Force; Time: O(n^2); Space: O(n) def next_larger_nodes(head): res = [] slow = head while slow: fast = slow.next while fast: if fast.val > slow.val: res.append(fast.val) break fast = fast.next else: res.append(0) slow = slow.next return res # Using Stack; Time: O(n); Space: O(n) def next_larger_nodes2(head): stack = [head.val] res = [0] cur = head.next while cur: count = 0 while stack and cur.val > stack[-1]: if res[-1 - count] == 0: res[-1 - count] = cur.val stack.pop() count += 1 stack.append(cur.val) res.append(0) cur = cur.next return res # Better implementation def next_larger_nodes3(head): stack, res, pos = [], [], 0 while head: res.append(0) while stack and head.val > stack[-1][1]: idx, _ = stack.pop() res[idx] = head.val stack.append((pos, head.val)) head = head.next pos += 1 return res # Test cases: head = ListNode(1) head.next = ListNode(2) head.next.next = ListNode(3) # head.next.next.next = ListNode(3) # head.next.next.next.next = ListNode(5) print(next_larger_nodes3(head))
print('Vamos realizar o fatorial: ') n = int(input('Digite um número inteiro: ')) c = n f = 1 print('{}! = '.format(n), end=' ') while c > 0: print(c, end=' ') print(' x ' if c > 1 else ' = ', end=' ') f *= c c -= 1 print(f) print('FIM!')
{ "targets": [ { "target_name": "crc", "sources": [ "./src/crc_module.c", "./src/crc.c" ] }, ] }
class Node: def __init__(self, val, next=None): self.val = val self.next = next input_list = [0, 1, 2, 3, 4] root = None for val in input_list: root = Node(val, root) cur = root while cur: print(cur.val) cur = cur.next print('Stack after pop: ') root = root.next cur = root while cur: print(cur.val) cur = cur.next print('Peeked data', root.val) print('Peeked data', root.val) print('Clearing out') root = None print('Stack is empty' if root is None else 'Stack is not empty')
class ExportObjStatus: SUCCESS = 'success' ERROR = 'error' IN_PROGRESS = 'in_progress' CHOICES = [ (SUCCESS, 'Success'), (ERROR, 'Error'), (IN_PROGRESS, 'In progress'), ]
class Base: """Base class readily accepts defaults""" def __init__(self, **kws): for k, v in kws.items(): if not hasattr(self, k): setattr(self, k, v) class Laziness(Base): """Generally lazy lookup""" def __init__(self, method, **kws): super().__init__(**kws) self._lookup = {} self._method = method def __getitem__(self, key, **kws): value = self._lookup.get(key) if value is None: value = self._method(key, **kws) self._lookup[key] = value return value
def capitalize(string): # We can't use title() here, consider the case: "123name" -> "123Name", which isn't correct. for substring in string.split(): string = string.replace(substring, substring.capitalize()) return string
# https://leetcode.com/problems/find-leaves-of-binary-tree/ class Solution: def findLeaves(self, root: Optional[TreeNode]) -> List[List[int]]: result = [] while root.left or root.right: result.append(self.popLeaves(root, root, [])) result.append([root.val]) return result def popLeaves(self, root: Optional[TreeNode], parent: Optional[TreeNode], result: List[int]) -> List[int]: if root is None: return None if not (root.left or root.right): if parent.left == root: parent.left = None else: parent.right = None return result.append(root.val) self.popLeaves(root.left, root, result) self.popLeaves(root.right, root, result) return result # Efficient Solution class Solution: def findLeaves(self, root: Optional[TreeNode]) -> List[List[int]]: def dfs(node): if not node: return -1 height = 1 + max(dfs(node.left), dfs(node.right)) if height == len(result): result.append([]) result[height].append(node.val) return height result = [] dfs(root) return result
class Monster: def __init__(self, name, color): self.name = name self.color = color def attack(self): print('I am attacking...') class Fogthing(Monster): def attack(self): print('I am killing...') def make_sound(self): print('Grrrrrrrrrr\n') fogthing = Fogthing("Fogthing", "Yellow") fogthing.attack() fogthing.make_sound()
# if train_or_eval = True then 训练 else 测试 train_or_eval = False # train_or_eval = True if train_or_eval is not True: # 测试的配置 task = 'denoising' dataset_dir = r'/user51/mxy/data/J4R/frames_heavy_test_JPEG' # 测试图片包括边缘图的路径 dataset_gtc_dir = r'/user51/mxy/data/J4R/frames_heavy_test_JPEG' # 相对应的gtc路径(使用了训练集中的gtc),所有设置的路径都是00006/1这种文件夹的父文件夹才可以 out_img_dir = 'evaluate' # 实验结果存放位置 pathlistfile = r'/user51/mxy/data/J4R/test_heavy.txt' # 测试的图片的具体路径 # pathlistfile = './train/test_heavy.txt' model_path = 'toflow_models_mine/denoising_best.pkl' gpuID = 0 # map_location='cuda:1' map_location = 'cuda:0' BATCH_SIZE = 1 h = 888 w = 888 N = 3 # 5张图片 else: # 训练的配置 task = 'denoising' edited_img_dir = r'/user51/mxy/data/J4R/heavy_train' # 训练输入的图片的文件夹 dataset_dir = r'/user51/mxy/data/J4R/heavy_train' pathlistfile = r'/user51/mxy/data/J4R/train_heavy.txt' # 训练的图片的具体路径 visualize_root = './visualization_mine/' # 存放展示结果的文件夹 visualize_pathlist = ['00001/4'] # 需要展示训练结果的训练图片所在的小文件夹 checkpoints_root = './checkpoints_mine' # 训练过程中产生的检查点的存放位置 model_besaved_root = './toflow_models_mine' # best_model 和 final_model 的参数的保存位置 model_best_name = '_best.pkl' model_final_name = '_final.pkl' gpuID = 0 # Hyper Parameters if task == 'interp': LR = 3 * 1e-5 elif task in ['denoise', 'denoising', 'sr', 'super-resolution']: # LR = 1 * 1e-5 LR = 0.0001 EPOCH = 141 WEIGHT_DECAY = 1e-4 BATCH_SIZE = 1 LR_strategy = [] # h = 360 # w = 480 h = 256 w = 256 # h = 120 # w = 120 N = 3 # 输入7张图片 ssim_weight = 1.1 l1_loss_weight = 0.75 w_VGG = 0 w_ST = 1 w_LT = 0 alpha = 50 use_checkpoint = False # 一开始不使用已有的检查点 checkpoint_exited_path = './checkpoints_mine/checkpoints_40epoch.ckpt' # 已有的检查点 work_place = '.' model_name = task model_houzhui = '.pkl' Training_pic_path = 'toflow_models_mine/Training_result_mine_maxoper.jpg' model_information_txt = model_name + '_information.txt'
def compute(): numer = 1 # 分子 denom = 0 # 分母 for i in range(100): numer, denom = e_contfrac_term(i) * numer + denom, numer # this formula can only meet the specification of the molecular(分子), # we cannot use this formula to get the right value of Denominator ans = sum(int(c) for c in str(numer)) return str(ans) def e_contfrac_term(i): if i == 0: return 2 elif i % 3 == 2: return i // 3 * 2 + 2 else: return 1 if __name__ == "__main__": print(compute())
# https://codeforces.com/problemset/problem/1367/A t = int(input()) for i in range(t): s = input() ss = [s[0]] for i in range(0, len(s)-1, 2): ss.append((s[i], s[i+1])[1]) print(''.join(ss))
""" Column Explorer =============================================================================== """ # import ipywidgets as widgets # from IPython.display import display # from ipywidgets import GridspecLayout, Layout # from .dashboard import document_to_html # from .utils import load_filtered_documents # class _App: # def __init__(self, directory, top_n=100): # # Data # self.documents = read_filtered_records(directory) # columns = sorted(self.documents.columns) # # Left panel controls # self.command_panel = [ # widgets.HTML("<hr><b>Column:</b>", layout=Layout(margin="0px 0px 0px 5px")), # widgets.Dropdown( # description="", # value=columns[0], # options=columns, # layout=Layout(width="auto"), # style={"description_width": "130px"}, # ), # widgets.HTML("<hr><b>Term:</b>", layout=Layout(margin="0px 0px 0px 5px")), # widgets.Dropdown( # description="", # value=None, # options=[], # layout=Layout(width="auto"), # style={"description_width": "130px"}, # ), # widgets.HTML( # "<hr><b>Found documents:</b>", layout=Layout(margin="0px 0px 0px 5px") # ), # widgets.Select( # options=[], # layout=Layout(height="360pt", width="auto"), # ), # ] # # interactive output function # widgets.interactive_output( # f=self.interactive_output, # controls={ # "column": self.command_panel[1], # "value": self.command_panel[3], # "article_title": self.command_panel[5], # }, # ) # # Grid size (Generic) # self.app_layout = GridspecLayout( # max(9, len(self.command_panel) + 1), 4, height="700px" # ) # # Creates command panel (Generic) # self.app_layout[:, 0] = widgets.VBox( # self.command_panel, # layout=Layout( # margin="10px 8px 5px 10px", # ), # ) # # Output area (Generic) # self.output = widgets.Output() # .add_class("output_color") # self.app_layout[0:, 1:] = widgets.VBox( # [self.output], # layout=Layout(margin="10px 4px 4px 4px", border="1px solid gray"), # ) # # self.execute() # def run(self): # return self.app_layout # def execute(self): # with self.output: # column = self.column # documents = self.documents.copy() # documents[column] = documents[column].str.split("; ") # x = documents.explode(column) # # populate terms # all_terms = x[column].copy() # all_terms = all_terms.dropna() # all_terms = all_terms.drop_duplicates() # all_terms = all_terms.sort_values() # self.command_panel[3].options = all_terms # # # # Populate titles # # # keyword = self.command_panel[3].value # s = x[x[column] == keyword] # s = s[["global_citations", "document_title"]] # s = s.sort_values( # ["global_citations", "document_title"], ascending=[False, True] # ) # s = s[["document_title"]].drop_duplicates() # self.command_panel[5].options = s["document_title"].tolist() # # # # Print info from selected title # # # out = self.documents[ # self.documents["document_title"] == self.command_panel[5].value # ] # out = out.reset_index(drop=True) # out = out.iloc[0] # self.output.clear_output() # with self.output: # display(widgets.HTML(document_to_html(out))) # def interactive_output(self, **kwargs): # for key in kwargs.keys(): # setattr(self, key, kwargs[key]) # self.execute() # def column_explorer(directory, top_n=100): # """ # Column explorer # :param directory: # :param top_n: # :return: # """ # app = _App(directory, top_n) # return app.run()
# coding : utf-8 ''' Copyright 2019 Agnese Salutari. 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 ''' templatesRoot = "static/templates/" cssFilesRoot = "static/css/" jsFilesRoot = "static/scripts/" jsonFilesRoot = "static/json/" imgFilesRoot = "static/img/" templates = { "index.html": { "name": "index.html", "model": "IndexViewModel", }, "index": { "name": "index.html", "model": "IndexViewModel", }, "/": { "name": "index.html", "model": "IndexViewModel", }, "": { "name": "index.html", "model": "IndexViewModel", }, } actionsForPOST = { # "fooRequest": Models.Example.save, } def callbackTest(self, value): print("I'm the callbackTest!!! " + str(value)) callbacks = { "POST": callbackTest, "GET": callbackTest, }
ora_start=int(input("Ora=")) minut_start=int(input("Minute=")) durata_ore=int(input("Cate ore dureaza drumul=")) durata_minute=int(input("Cate minute dureaza drumul")) ora_fin = ora_start+durata_ore minute_fin = minut_start+durata_minute if minute_fin>60: minute_fin%=60 ora_fin+=1 print(ora_fin,minute_fin)
def digitDifferenceSort(a): def dg(n): s = list(map(int, str(n))) return max(s) - min(s) ans = [(a[i], i) for i in range(len(a))] A = sorted(ans, key = lambda x: (dg(x[0]), -x[1])) return [c[0] for c in A]
# Topology with a single loop # A --- B --- C # | | # D --- E topo = { 'A' : ['B', 'D'], 'B' : ['A', 'C', 'E'], 'C' : ['B'], 'D' : ['A', 'E'], 'E' : ['B', 'D'] }
class Body: """ Represents the status of the body, each part of the body has a name and a value representing its status 1 = perferctly fine, 0 = unavailale """ def __init__(self, parts=None): if parts is not None: self.boyd_parts = parts.copy() else: self.body_parts = {} def status(self): """return the average body status""" total = len(self.body_parts) if total <= 0: return 0 return sum((p for p in self.body_parts.values())) // total
# fmt: off cost_sequence = [ 102267214109.0, 102267223999.0, 102269202999.00002, 102566201999.00002, 132365101999.0, 102475101999.00002, 102465101999.00002, 132465101999.0, 162165001999.0, 162565001999.0, 162965001999.0, 163965001999.0, 163955001999.0, 134065001999.0, 134465001999.0, 104575001998.99998, 104565001999.00002, 104565001999.00002, 104644201999.00002, 94744201999.00002, 84745201999.00002, 84745201999.00002, 84745993999.00003, 84646993999.00003, 84646003999.00003, 74647003999.00002, 74647003999.00002, 74647003999.00002, 74647011919.00002, 74647011998.20001, 74646021998.20001, 74646011999.20001 ] annotations = [ (0, 102267214109.0, """ (def rev$conv1d (Tuple (Vec k (Vec l (Vec kn Float))) (Vec l (Vec n Float))) ((var0 : (Tuple (Vec k (Vec l (Vec kn Float))) (Vec l (Vec n Float)) (Vec k (Vec n Float))))) (let ((kernels (get$1$3 var0)) (image (get$2$3 var0)) (d$r (get$3$3 var0))) (sumbuild k (lam (ki : Integer) (let (a_6 (index ki d$r)) (sumbuild n (lam (ni : Integer) (let (a_8 (index ni a_6)) (let (a_7 (build kn (lam (var1 : Integer) a_8))) (sumbuild kn (lam (kni : Integer) (let (a_10 (index kni a_7)) (let (a_11 (build l (lam (sum$i : Integer) a_10))) (sumbuild l (lam (li : Integer) (let (noi (sub (add ni (div kn 2)) kni)) (let (outside_image (or (gt 0 noi) (gte noi n))) (add (if outside_image (tuple (constVec k (constVec l (constVec kn 0.0))) (constVec l (constVec n 0.0))) (tuple (constVec k (constVec l (constVec kn 0.0))) (deltaVec l li (deltaVec n noi (mul (index kni (index li (index ki kernels))) (index li a_11)))))) (tuple (deltaVec k ki (deltaVec l li (deltaVec kn kni (mul (if outside_image 0.0 (index noi (index li image))) (index li a_11))))) (constVec l (constVec n 0.0))))))))))))))))))) """), (11, 163955001999.0, """ (def rev$conv1d (Tuple (Vec k (Vec l (Vec kn Float))) (Vec l (Vec n Float))) (var0 : (Vec k (Vec l (Vec kn Float))) (Vec l (Vec n Float)) (Vec k (Vec n Float))) (let ((kernels (get$1$3 var0)) (image (get$2$3 var0)) (d$r (get$3$3 var0))) (sumbuild k (lam (ki : Integer) (sumbuild n (lam (ni : Integer) (sumbuild kn (lam (kni : Integer) (sumbuild l (lam (li : Integer) (let (noi (sub (add ni (div kn 2)) kni)) (let (outside_image (or (gt 0 (sub (add ni (div kn 2)) kni)) (gte (sub (add ni (div kn 2)) kni) n))) (add (if (or (gt 0 (sub (add ni (div kn 2)) kni)) (gte (sub (add ni (div kn 2)) kni) n)) (tuple (constVec k (constVec l (constVec kn 0.0))) (constVec l (constVec n 0.0))) (tuple (constVec k (constVec l (constVec kn 0.0))) (deltaVec l li (deltaVec n noi (mul (index kni (index li (index ki kernels))) (index li (build l (lam (sum$i : Integer) (index ni (index ki d$r)))))))))) (tuple (deltaVec k ki (deltaVec l li (deltaVec kn kni (mul (if outside_image 0.0 (index noi (index li image))) (index li (build l (lam (var0 : Integer) (index ni (index ki d$r))))))))) (constVec l (constVec n 0.0)))))))))))))))) """), (31, 74646011999.20001, """ (def rev$conv1d (Tuple (Vec k (Vec l (Vec kn Float))) (Vec l (Vec n Float))) (var0 : (Vec k (Vec l (Vec kn Float))) (Vec l (Vec n Float)) (Vec k (Vec n Float))) (let ((kernels (get$1$3 var0)) (image (get$2$3 var0)) (d$r (get$3$3 var0))) (add (sumbuild k (lam (var6 : Integer) (sumbuild n (lam (var5 : Integer) (sumbuild kn (lam (var7 : Integer) (sumbuild l (lam (var8 : Integer) (if (or (gt 0 (sub (add var5 (div kn 2)) var7)) (gte (sub (add var5 (div kn 2)) var7) n)) (tuple (constVec k (constVec l (constVec kn 0.0))) (constVec l (constVec n 0.0))) (tuple (constVec k (constVec l (constVec kn 0.0))) (deltaVec l var8 (deltaVec n (sub (add var5 (div kn 2)) var7) (mul (index var7 (index var8 (index var6 kernels))) (let (sum$i var8) (index var5 (index var6 d$r)))))))))))))))) (tuple (build k (lam (var4 : Integer) (sumbuild n (lam (var3 : Integer) (build l (lam (var1 : Integer) (build kn (lam (var2 : Integer) (mul (if (or (gt 0 (sub (add var3 (div kn 2)) var2)) (gte (sub (add var3 (div kn 2)) var2) n)) 0.0 (index (sub (add var3 (div kn 2)) var2) (index var1 image))) (let (var0 var1) (index var3 (index var4 d$r)))))))))))) (constVec l (constVec n 0.0))))) """) ]
# # PySNMP MIB module IB-SMA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IB-SMA-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:39:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection") IbDataPortAndInvalid, IbUnicastLid, IbMulticastLid, infinibandMIB, IbDataPort, IbGuid, IbSmPortList = mibBuilder.importSymbols("IB-TC-MIB", "IbDataPortAndInvalid", "IbUnicastLid", "IbMulticastLid", "infinibandMIB", "IbDataPort", "IbGuid", "IbSmPortList") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") TimeTicks, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, iso, Bits, Gauge32, MibIdentifier, NotificationType, IpAddress, Integer32, ObjectIdentity, ModuleIdentity, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "iso", "Bits", "Gauge32", "MibIdentifier", "NotificationType", "IpAddress", "Integer32", "ObjectIdentity", "ModuleIdentity", "Unsigned32") TextualConvention, DisplayString, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "TruthValue") ibSmaMIB = ModuleIdentity((1, 3, 6, 1, 3, 117, 3)) ibSmaMIB.setRevisions(('2005-09-01 12:00',)) if mibBuilder.loadTexts: ibSmaMIB.setLastUpdated('200509011200Z') if mibBuilder.loadTexts: ibSmaMIB.setOrganization('IETF IP Over IB (IPOIB) Working Group') ibSmaObjects = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1)) ibSmaNotifications = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 2)) ibSmaConformance = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 3)) ibSmaNodeInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 1)) ibSmaNodeString = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 1), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaNodeString.setStatus('current') ibSmaNodeBaseVersion = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaNodeBaseVersion.setStatus('current') ibSmaNodeClassVersion = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaNodeClassVersion.setStatus('current') ibSmaNodeType = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("channelAdapter", 1), ("switch", 2), ("router", 3), ("reserved", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaNodeType.setStatus('current') ibSmaNodeNumPorts = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 254))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaNodeNumPorts.setStatus('current') ibSmaSystemImageGuid = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 6), IbGuid()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSystemImageGuid.setStatus('current') ibSmaNodeGuid = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 7), IbGuid()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaNodeGuid.setStatus('current') ibSmaNodePortGuid = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 8), IbGuid()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaNodePortGuid.setStatus('current') ibSmaNodePartitionTableNum = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 9), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaNodePartitionTableNum.setStatus('current') ibSmaNodeDeviceId = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 10), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaNodeDeviceId.setStatus('current') ibSmaNodeRevision = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 11), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaNodeRevision.setStatus('current') ibSmaNodeLocalPortNumOrZero = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 12), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 254))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaNodeLocalPortNumOrZero.setStatus('current') ibSmaNodeVendorId = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 13), OctetString().subtype(subtypeSpec=ValueSizeConstraint(3, 3)).setFixedLength(3)).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaNodeVendorId.setStatus('current') ibSmaNodeLid = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 14), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeLid.setStatus('current') ibSmaNodePortNum = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 15), IbDataPort()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodePortNum.setStatus('current') ibSmaNodeMethod = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 16), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeMethod.setStatus('current') ibSmaNodeAttributeId = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 17), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeAttributeId.setStatus('current') ibSmaNodeAttributeModifier = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 18), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeAttributeModifier.setStatus('current') ibSmaNodeKey = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 19), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeKey.setStatus('current') ibSmaNodeLid2 = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 20), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeLid2.setStatus('current') ibSmaNodeServiceLevel = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 21), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeServiceLevel.setStatus('current') ibSmaNodeQueuePair1 = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 22), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 16777215))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeQueuePair1.setStatus('current') ibSmaNodeQueuePair2 = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 23), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 16777215))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeQueuePair2.setStatus('current') ibSmaNodeGid1 = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 24), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeGid1.setStatus('current') ibSmaNodeGid2 = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 25), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeGid2.setStatus('current') ibSmaNodeCapMask = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 26), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeCapMask.setStatus('current') ibSmaNodeSwitchLid = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 27), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeSwitchLid.setStatus('current') ibSmaNodeDataValid = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 1, 28), Bits().clone(namedValues=NamedValues(("lidaddr1", 0), ("lidaddr2", 1), ("pkey", 2), ("sl", 3), ("qp1", 4), ("qp2", 5), ("gidaddr1", 6), ("gidaddr2", 7)))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: ibSmaNodeDataValid.setStatus('current') ibSmaSwitchInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 2)) ibSmaSwLinearFdbTableNum = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 49151))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwLinearFdbTableNum.setStatus('current') ibSmaSwRandomFdbTableNum = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 49151))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwRandomFdbTableNum.setStatus('current') ibSmaSwMulticastFdbTableNum = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 16383))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwMulticastFdbTableNum.setStatus('current') ibSmaSwLinearFdbTop = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 49151))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwLinearFdbTop.setStatus('current') ibSmaSwDefaultPort = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 254))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwDefaultPort.setStatus('current') ibSmaSwDefMcastPriPort = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 6), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 254))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwDefMcastPriPort.setStatus('current') ibSmaSwDefMcastNotPriPort = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 254))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwDefMcastNotPriPort.setStatus('current') ibSmaSwLifeTimeValue = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 8), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 20))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwLifeTimeValue.setStatus('current') ibSmaSwPortStateChange = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 9), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwPortStateChange.setStatus('current') ibSmaSwLidsPerPort = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 10), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwLidsPerPort.setStatus('current') ibSmaSwPartitionEnforceNum = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 11), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwPartitionEnforceNum.setStatus('current') ibSmaSwInboundEnforceCap = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 12), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwInboundEnforceCap.setStatus('current') ibSmaSwOutboundEnforceCap = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 13), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwOutboundEnforceCap.setStatus('current') ibSmaSwFilterRawPktInputCap = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 14), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwFilterRawPktInputCap.setStatus('current') ibSmaSwFilterRawPktOutputCap = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 15), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwFilterRawPktOutputCap.setStatus('current') ibSmaSwEnhancedPort0 = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 2, 16), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSwEnhancedPort0.setStatus('current') ibSmaGuidInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 3)) ibSmaGuidInfoTable = MibTable((1, 3, 6, 1, 3, 117, 3, 1, 3, 1), ) if mibBuilder.loadTexts: ibSmaGuidInfoTable.setStatus('current') ibSmaGuidInfoEntry = MibTableRow((1, 3, 6, 1, 3, 117, 3, 1, 3, 1, 1), ).setIndexNames((0, "IB-SMA-MIB", "ibSmaGuidPortIndex"), (0, "IB-SMA-MIB", "ibSmaGuidIndex")) if mibBuilder.loadTexts: ibSmaGuidInfoEntry.setStatus('current') ibSmaGuidPortIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 3, 1, 1, 1), IbDataPort()) if mibBuilder.loadTexts: ibSmaGuidPortIndex.setStatus('current') ibSmaGuidIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 3, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))) if mibBuilder.loadTexts: ibSmaGuidIndex.setStatus('current') ibSmaGuidVal = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 3, 1, 1, 3), IbGuid()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaGuidVal.setStatus('current') ibSmaMgmtPortInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 4)) ibSmaPortMKey = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortMKey.setStatus('current') ibSmaPortGidPrefix = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortGidPrefix.setStatus('current') ibSmaPortLid = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 49151))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortLid.setStatus('current') ibSmaPortMasterSmLid = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 49151))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortMasterSmLid.setStatus('current') ibSmaPortIsSubnetManager = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 5), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsSubnetManager.setStatus('current') ibSmaPortIsNoticeSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 6), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsNoticeSupported.setStatus('current') ibSmaPortIsTrapSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 7), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsTrapSupported.setStatus('current') ibSmaPortIsAutoMigrateSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 8), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsAutoMigrateSupported.setStatus('current') ibSmaPortIsSlMappingSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 9), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsSlMappingSupported.setStatus('current') ibSmaPortIsMKeyNvram = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 10), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsMKeyNvram.setStatus('current') ibSmaPortIsPKeyNvram = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 11), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsPKeyNvram.setStatus('current') ibSmaPortIsLedInfoSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 12), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsLedInfoSupported.setStatus('current') ibSmaPortIsSmDisabled = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 13), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsSmDisabled.setStatus('current') ibSmaPortIsSysImgGuidSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 14), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsSysImgGuidSupported.setStatus('current') ibSmaPortIsPKeyExtPortTrapSup = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 15), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsPKeyExtPortTrapSup.setStatus('current') ibSmaPortIsCommManageSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 16), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsCommManageSupported.setStatus('current') ibSmaPortIsSnmpTunnelSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 17), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsSnmpTunnelSupported.setStatus('current') ibSmaPortIsReinitSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 18), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsReinitSupported.setStatus('current') ibSmaPortIsDevManageSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 19), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsDevManageSupported.setStatus('current') ibSmaPortIsVendorClassSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 20), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsVendorClassSupported.setStatus('current') ibSmaPortIsDrNoticeSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 21), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsDrNoticeSupported.setStatus('current') ibSmaPortIsCapMaskNoticSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 22), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsCapMaskNoticSupported.setStatus('current') ibSmaPortIsBootMgmtSupported = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 23), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortIsBootMgmtSupported.setStatus('current') ibSmaPortMKeyLeasePeriod = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 24), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortMKeyLeasePeriod.setStatus('current') ibSmaPortMKeyProtectBits = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 25), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("noMKeyProtection", 1), ("succeedWithReturnKey", 2), ("succeedWithReturnZeroes", 3), ("failOnNoMatch", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortMKeyProtectBits.setStatus('current') ibSmaPortMasterSmSl = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 26), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortMasterSmSl.setStatus('current') ibSmaPortInitTypeLoad = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 27), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortInitTypeLoad.setStatus('current') ibSmaPortInitTypeContent = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 28), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortInitTypeContent.setStatus('current') ibSmaPortInitTypePresence = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 29), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortInitTypePresence.setStatus('current') ibSmaPortInitTypeResuscitate = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 30), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortInitTypeResuscitate.setStatus('current') ibSmaPortInitNoLoadReply = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 31), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortInitNoLoadReply.setStatus('current') ibSmaPortInitPreserveContReply = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 32), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortInitPreserveContReply.setStatus('current') ibSmaPortInitPreservePresReply = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 33), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortInitPreservePresReply.setStatus('current') ibSmaPortMKeyViolations = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 34), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortMKeyViolations.setStatus('current') ibSmaPortPKeyViolations = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 35), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortPKeyViolations.setStatus('current') ibSmaPortQKeyViolations = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 36), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortQKeyViolations.setStatus('current') ibSmaPortNumGuid = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 37), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortNumGuid.setStatus('current') ibSmaPortSubnetTimeout = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 38), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 31))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortSubnetTimeout.setStatus('current') ibSmaPortResponseTimeValue = MibScalar((1, 3, 6, 1, 3, 117, 3, 1, 4, 39), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 31))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortResponseTimeValue.setStatus('current') ibSmaDataPortInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 5)) ibSmaPortInfoTable = MibTable((1, 3, 6, 1, 3, 117, 3, 1, 5, 1), ) if mibBuilder.loadTexts: ibSmaPortInfoTable.setStatus('current') ibSmaPortInfoEntry = MibTableRow((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1), ).setIndexNames((0, "IB-SMA-MIB", "ibSmaPortIndex")) if mibBuilder.loadTexts: ibSmaPortInfoEntry.setStatus('current') ibSmaPortIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 1), IbDataPort()) if mibBuilder.loadTexts: ibSmaPortIndex.setStatus('current') ibSmaPortLinkWidthEnabled = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("oneX", 1), ("fourX", 2), ("oneXOr4X", 3), ("twelveX", 4), ("oneXOr12X", 5), ("fourXOr12X", 6), ("oneX4XOr12X", 7), ("linkWidthSupported", 8), ("other", 9)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortLinkWidthEnabled.setStatus('current') ibSmaPortLinkWidthSupported = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("oneX", 1), ("oneXOr4X", 2), ("oneX4XOr12X", 3), ("other", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortLinkWidthSupported.setStatus('current') ibSmaPortLinkWidthActive = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("oneX", 1), ("fourX", 2), ("twelveX", 3), ("other", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortLinkWidthActive.setStatus('current') ibSmaPortLinkSpeedSupported = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("twoPoint5Gbps", 1), ("other", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortLinkSpeedSupported.setStatus('current') ibSmaPortLinkState = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("down", 1), ("init", 2), ("armed", 3), ("active", 4), ("other", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortLinkState.setStatus('current') ibSmaPortPhysState = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("sleep", 1), ("polling", 2), ("disabled", 3), ("portConfigTraining", 4), ("linkUp", 5), ("linkErrorRecovery", 6), ("other", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortPhysState.setStatus('current') ibSmaPortLinkDownDefaultState = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("sleep", 1), ("polling", 2), ("other", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortLinkDownDefaultState.setStatus('current') ibSmaPortLidMaskCount = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 9), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortLidMaskCount.setStatus('current') ibSmaPortLinkSpeedActive = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("twoPoint5Gbps", 1), ("other", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortLinkSpeedActive.setStatus('current') ibSmaPortLinkSpeedEnabled = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("twoPoint5Gbps", 1), ("linkSpeedSupported", 2), ("other", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortLinkSpeedEnabled.setStatus('current') ibSmaPortNeighborMtu = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("mtu256", 1), ("mtu512", 2), ("mtu1024", 3), ("mtu2048", 4), ("mtu4096", 5), ("other", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortNeighborMtu.setStatus('current') ibSmaPortVirtLaneSupport = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("vl0", 1), ("vl0ToVl1", 2), ("vl0ToVl3", 3), ("vl0ToVl7", 4), ("vl0ToVl14", 5), ("other", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortVirtLaneSupport.setStatus('current') ibSmaPortVlHighPriorityLimit = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 14), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortVlHighPriorityLimit.setStatus('current') ibSmaPortVlArbHighCapacity = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 15), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortVlArbHighCapacity.setStatus('current') ibSmaPortVlArbLowCapacity = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 16), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 64))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortVlArbLowCapacity.setStatus('current') ibSmaPortMtuCapacity = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("mtu256", 1), ("mtu512", 2), ("mtu1024", 3), ("mtu2048", 4), ("mtu4096", 5), ("other", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortMtuCapacity.setStatus('current') ibSmaPortVlStallCount = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 18), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortVlStallCount.setStatus('current') ibSmaPortHeadOfQueueLife = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 19), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 20))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortHeadOfQueueLife.setStatus('current') ibSmaPortOperationalVls = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("vl0", 1), ("vl0ToVl1", 2), ("vl0ToVl3", 3), ("vl0ToVl7", 4), ("vl0ToVl14", 5), ("other", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortOperationalVls.setStatus('current') ibSmaPortPartEnforceInbound = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 21), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortPartEnforceInbound.setStatus('current') ibSmaPortPartEnforceOutbound = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 22), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortPartEnforceOutbound.setStatus('current') ibSmaPortFilterRawPktInbound = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 23), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortFilterRawPktInbound.setStatus('current') ibSmaPortFilterRawPktOutbound = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 24), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortFilterRawPktOutbound.setStatus('current') ibSmaPortLocalPhysErrorThreshold = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 25), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortLocalPhysErrorThreshold.setStatus('current') ibSmaPortOverrunErrorThreshold = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 5, 1, 1, 26), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortOverrunErrorThreshold.setStatus('current') ibSmaPKeyInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 6)) ibSmaPKeyTable = MibTable((1, 3, 6, 1, 3, 117, 3, 1, 6, 1), ) if mibBuilder.loadTexts: ibSmaPKeyTable.setStatus('current') ibSmaPKeyEntry = MibTableRow((1, 3, 6, 1, 3, 117, 3, 1, 6, 1, 1), ).setIndexNames((0, "IB-SMA-MIB", "ibSmaPKeyIBAPortIndex"), (0, "IB-SMA-MIB", "ibSmaPKeyIndex")) if mibBuilder.loadTexts: ibSmaPKeyEntry.setStatus('current') ibSmaPKeyIBAPortIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 6, 1, 1, 1), IbDataPortAndInvalid()) if mibBuilder.loadTexts: ibSmaPKeyIBAPortIndex.setStatus('current') ibSmaPKeyIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 6, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65504))) if mibBuilder.loadTexts: ibSmaPKeyIndex.setStatus('current') ibSmaPKeyMembership = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 6, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("limited", 2), ("full", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPKeyMembership.setStatus('current') ibSmaPKeyBase = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 6, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 65527))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPKeyBase.setStatus('current') ibSmaSlToVlMapInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 7)) ibSmaSL2VLMapTable = MibTable((1, 3, 6, 1, 3, 117, 3, 1, 7, 1), ) if mibBuilder.loadTexts: ibSmaSL2VLMapTable.setStatus('current') ibSmaSL2VLMapEntry = MibTableRow((1, 3, 6, 1, 3, 117, 3, 1, 7, 1, 1), ).setIndexNames((0, "IB-SMA-MIB", "ibSmaIBAOutPortIndex"), (0, "IB-SMA-MIB", "ibSmaIBAInPortIndex"), (0, "IB-SMA-MIB", "ibSmaServiceLevelIndex")) if mibBuilder.loadTexts: ibSmaSL2VLMapEntry.setStatus('current') ibSmaIBAOutPortIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 7, 1, 1, 1), IbDataPortAndInvalid()) if mibBuilder.loadTexts: ibSmaIBAOutPortIndex.setStatus('current') ibSmaIBAInPortIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 7, 1, 1, 2), IbDataPortAndInvalid()) if mibBuilder.loadTexts: ibSmaIBAInPortIndex.setStatus('current') ibSmaServiceLevelIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 7, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))) if mibBuilder.loadTexts: ibSmaServiceLevelIndex.setStatus('current') ibSmaVirtualLane = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 7, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaVirtualLane.setStatus('current') ibSmaVLArbitInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 8)) ibSmaHiPriVlArbTable = MibTable((1, 3, 6, 1, 3, 117, 3, 1, 8, 1), ) if mibBuilder.loadTexts: ibSmaHiPriVlArbTable.setStatus('current') ibSmaHiPriVlArbEntry = MibTableRow((1, 3, 6, 1, 3, 117, 3, 1, 8, 1, 1), ).setIndexNames((0, "IB-SMA-MIB", "ibSmaHiPriIBAPortIndex"), (0, "IB-SMA-MIB", "ibSmaHiPriNIndex")) if mibBuilder.loadTexts: ibSmaHiPriVlArbEntry.setStatus('current') ibSmaHiPriIBAPortIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 8, 1, 1, 1), IbDataPort()) if mibBuilder.loadTexts: ibSmaHiPriIBAPortIndex.setStatus('current') ibSmaHiPriNIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 8, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))) if mibBuilder.loadTexts: ibSmaHiPriNIndex.setStatus('current') ibSmaHiPriVirtLane = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 8, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 14))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaHiPriVirtLane.setStatus('current') ibSmaHiPriWeight = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 8, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaHiPriWeight.setStatus('current') ibSmaLowPriVlArbTable = MibTable((1, 3, 6, 1, 3, 117, 3, 1, 8, 2), ) if mibBuilder.loadTexts: ibSmaLowPriVlArbTable.setStatus('current') ibSmaLowPriVlArbEntry = MibTableRow((1, 3, 6, 1, 3, 117, 3, 1, 8, 2, 1), ).setIndexNames((0, "IB-SMA-MIB", "ibSmaLowPriIBAPortIndex"), (0, "IB-SMA-MIB", "ibSmaLowPriNIndex")) if mibBuilder.loadTexts: ibSmaLowPriVlArbEntry.setStatus('current') ibSmaLowPriIBAPortIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 8, 2, 1, 1), IbDataPort()) if mibBuilder.loadTexts: ibSmaLowPriIBAPortIndex.setStatus('current') ibSmaLowPriNIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 8, 2, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))) if mibBuilder.loadTexts: ibSmaLowPriNIndex.setStatus('current') ibSmaLowPriVirtLane = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 8, 2, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 14))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaLowPriVirtLane.setStatus('current') ibSmaLowPriWeight = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 8, 2, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaLowPriWeight.setStatus('current') ibSmaLFTInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 9)) ibSmaLinForTable = MibTable((1, 3, 6, 1, 3, 117, 3, 1, 9, 1), ) if mibBuilder.loadTexts: ibSmaLinForTable.setStatus('current') ibSmaLinForEntry = MibTableRow((1, 3, 6, 1, 3, 117, 3, 1, 9, 1, 1), ).setIndexNames((0, "IB-SMA-MIB", "ibSmaLinDestDLIDIndex")) if mibBuilder.loadTexts: ibSmaLinForEntry.setStatus('current') ibSmaLinDestDLIDIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 9, 1, 1, 1), IbUnicastLid()) if mibBuilder.loadTexts: ibSmaLinDestDLIDIndex.setStatus('current') ibSmaLinForwEgressPort = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 9, 1, 1, 2), IbDataPortAndInvalid()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaLinForwEgressPort.setStatus('current') ibSmaRFTInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 10)) ibSmaRandomForwardingTable = MibTable((1, 3, 6, 1, 3, 117, 3, 1, 10, 1), ) if mibBuilder.loadTexts: ibSmaRandomForwardingTable.setStatus('current') ibSmaRandomForwardingEntry = MibTableRow((1, 3, 6, 1, 3, 117, 3, 1, 10, 1, 1), ).setIndexNames((0, "IB-SMA-MIB", "ibSmaRandomForwardingPortIndex")) if mibBuilder.loadTexts: ibSmaRandomForwardingEntry.setStatus('current') ibSmaRandomForwardingPortIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 10, 1, 1, 1), IbDataPort()) if mibBuilder.loadTexts: ibSmaRandomForwardingPortIndex.setStatus('current') ibSmaRandomDestLID = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 10, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 49152))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaRandomDestLID.setStatus('current') ibSmaRandomForwEgressPort = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 10, 1, 1, 3), IbDataPort()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaRandomForwEgressPort.setStatus('current') ibSmaRandomLMC = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 10, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaRandomLMC.setStatus('current') ibSmaRandomIsValid = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 10, 1, 1, 5), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaRandomIsValid.setStatus('current') ibSmaMFTInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 11)) ibSmaMulForTable = MibTable((1, 3, 6, 1, 3, 117, 3, 1, 11, 1), ) if mibBuilder.loadTexts: ibSmaMulForTable.setStatus('current') ibSmaMulForEntry = MibTableRow((1, 3, 6, 1, 3, 117, 3, 1, 11, 1, 1), ).setIndexNames((0, "IB-SMA-MIB", "ibSmaMulDestDLIDIndex")) if mibBuilder.loadTexts: ibSmaMulForEntry.setStatus('current') ibSmaMulDestDLIDIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 11, 1, 1, 1), IbMulticastLid()) if mibBuilder.loadTexts: ibSmaMulDestDLIDIndex.setStatus('current') ibSmaMulForwMask = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 11, 1, 1, 2), IbSmPortList()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaMulForwMask.setStatus('current') ibSmaSMInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 12)) ibSmaSubMgrInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 12, 1)) ibSmaSmInfoTable = MibTable((1, 3, 6, 1, 3, 117, 3, 1, 12, 1, 1), ) if mibBuilder.loadTexts: ibSmaSmInfoTable.setStatus('current') ibSmaSmInfoEntry = MibTableRow((1, 3, 6, 1, 3, 117, 3, 1, 12, 1, 1, 1), ).setIndexNames((0, "IB-SMA-MIB", "ibSmaSmInfoPortIndex")) if mibBuilder.loadTexts: ibSmaSmInfoEntry.setStatus('current') ibSmaSmInfoPortIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 12, 1, 1, 1, 1), IbDataPort()) if mibBuilder.loadTexts: ibSmaSmInfoPortIndex.setStatus('current') ibSmaSmGuid = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 12, 1, 1, 1, 2), IbGuid()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSmGuid.setStatus('current') ibSmaSmSmKey = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 12, 1, 1, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(8, 8)).setFixedLength(8)).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSmSmKey.setStatus('current') ibSmaSmSmpCount = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 12, 1, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSmSmpCount.setStatus('current') ibSmaSmPriority = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 12, 1, 1, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSmPriority.setStatus('current') ibSmaSmState = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 12, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("notActive", 1), ("discovering", 2), ("standby", 3), ("master", 4), ("unknown", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaSmState.setStatus('current') ibSmaVendDiagInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 13)) ibSmaVendDiagInfoTable = MibTable((1, 3, 6, 1, 3, 117, 3, 1, 13, 1), ) if mibBuilder.loadTexts: ibSmaVendDiagInfoTable.setStatus('current') ibSmaVendDiagInfoEntry = MibTableRow((1, 3, 6, 1, 3, 117, 3, 1, 13, 1, 1), ).setIndexNames((0, "IB-SMA-MIB", "ibSmaVendDiagPortIndex")) if mibBuilder.loadTexts: ibSmaVendDiagInfoEntry.setStatus('current') ibSmaVendDiagPortIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 13, 1, 1, 1), IbDataPortAndInvalid()) if mibBuilder.loadTexts: ibSmaVendDiagPortIndex.setStatus('current') ibSmaPortGenericDiagCode = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 13, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("portReady", 1), ("performingSelfTest", 2), ("initializing", 3), ("softError", 4), ("hardError", 5), ("other", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortGenericDiagCode.setStatus('current') ibSmaPortVendorDiagCode = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 13, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 2047))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortVendorDiagCode.setStatus('current') ibSmaPortVendorDiagIndexFwd = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 13, 1, 1, 4), TruthValue()).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortVendorDiagIndexFwd.setStatus('current') ibSmaPortVendorDiagData = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 13, 1, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(124, 124)).setFixedLength(124)).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaPortVendorDiagData.setStatus('current') ibSmaLedInfo = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 1, 14)) ibSmaLedInfoTable = MibTable((1, 3, 6, 1, 3, 117, 3, 1, 14, 1), ) if mibBuilder.loadTexts: ibSmaLedInfoTable.setStatus('current') ibSmaLedInfoEntry = MibTableRow((1, 3, 6, 1, 3, 117, 3, 1, 14, 1, 1), ).setIndexNames((0, "IB-SMA-MIB", "ibSmaLedIndex")) if mibBuilder.loadTexts: ibSmaLedInfoEntry.setStatus('current') ibSmaLedIndex = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 14, 1, 1, 1), IbDataPort()) if mibBuilder.loadTexts: ibSmaLedIndex.setStatus('current') ibSmaLedState = MibTableColumn((1, 3, 6, 1, 3, 117, 3, 1, 14, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("unknown", 1), ("on", 2), ("off", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: ibSmaLedState.setStatus('current') ibSmaNotificationPrefix = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 2, 0)) ibSmaPortLinkStateChange = NotificationType((1, 3, 6, 1, 3, 117, 3, 2, 0, 1)).setObjects(("IB-SMA-MIB", "ibSmaNodeLid")) if mibBuilder.loadTexts: ibSmaPortLinkStateChange.setStatus('current') ibSmaLinkIntegrityThresReached = NotificationType((1, 3, 6, 1, 3, 117, 3, 2, 0, 2)).setObjects(("IB-SMA-MIB", "ibSmaNodeLid"), ("IB-SMA-MIB", "ibSmaNodePortNum")) if mibBuilder.loadTexts: ibSmaLinkIntegrityThresReached.setStatus('current') ibSmaExcessBuffOverrunThres = NotificationType((1, 3, 6, 1, 3, 117, 3, 2, 0, 3)).setObjects(("IB-SMA-MIB", "ibSmaNodeLid"), ("IB-SMA-MIB", "ibSmaNodePortNum")) if mibBuilder.loadTexts: ibSmaExcessBuffOverrunThres.setStatus('current') ibSmaFlowCntrlUpdateTimerExpire = NotificationType((1, 3, 6, 1, 3, 117, 3, 2, 0, 4)).setObjects(("IB-SMA-MIB", "ibSmaNodeLid"), ("IB-SMA-MIB", "ibSmaNodePortNum")) if mibBuilder.loadTexts: ibSmaFlowCntrlUpdateTimerExpire.setStatus('current') ibSmaCapabilityMaskModified = NotificationType((1, 3, 6, 1, 3, 117, 3, 2, 0, 5)).setObjects(("IB-SMA-MIB", "ibSmaNodeLid"), ("IB-SMA-MIB", "ibSmaNodeCapMask")) if mibBuilder.loadTexts: ibSmaCapabilityMaskModified.setStatus('current') ibSmaSysImageGuidModified = NotificationType((1, 3, 6, 1, 3, 117, 3, 2, 0, 6)).setObjects(("IB-SMA-MIB", "ibSmaNodeLid"), ("IB-SMA-MIB", "ibSmaSystemImageGuid")) if mibBuilder.loadTexts: ibSmaSysImageGuidModified.setStatus('current') ibSmaBadManagementKey = NotificationType((1, 3, 6, 1, 3, 117, 3, 2, 0, 7)).setObjects(("IB-SMA-MIB", "ibSmaNodeKey"), ("IB-SMA-MIB", "ibSmaNodeLid"), ("IB-SMA-MIB", "ibSmaNodeMethod"), ("IB-SMA-MIB", "ibSmaNodeAttributeId"), ("IB-SMA-MIB", "ibSmaNodeAttributeModifier")) if mibBuilder.loadTexts: ibSmaBadManagementKey.setStatus('current') ibSmaBadPartitionKey = NotificationType((1, 3, 6, 1, 3, 117, 3, 2, 0, 8)).setObjects(("IB-SMA-MIB", "ibSmaNodeKey"), ("IB-SMA-MIB", "ibSmaNodeLid"), ("IB-SMA-MIB", "ibSmaNodeGid1"), ("IB-SMA-MIB", "ibSmaNodeQueuePair1"), ("IB-SMA-MIB", "ibSmaNodeLid2"), ("IB-SMA-MIB", "ibSmaNodeGid2"), ("IB-SMA-MIB", "ibSmaNodeQueuePair2"), ("IB-SMA-MIB", "ibSmaNodeServiceLevel")) if mibBuilder.loadTexts: ibSmaBadPartitionKey.setStatus('current') ibSmaBadQueueKey = NotificationType((1, 3, 6, 1, 3, 117, 3, 2, 0, 9)).setObjects(("IB-SMA-MIB", "ibSmaNodeKey"), ("IB-SMA-MIB", "ibSmaNodeLid"), ("IB-SMA-MIB", "ibSmaNodeGid1"), ("IB-SMA-MIB", "ibSmaNodeQueuePair1"), ("IB-SMA-MIB", "ibSmaNodeLid2"), ("IB-SMA-MIB", "ibSmaNodeGid2"), ("IB-SMA-MIB", "ibSmaNodeQueuePair2"), ("IB-SMA-MIB", "ibSmaNodeServiceLevel")) if mibBuilder.loadTexts: ibSmaBadQueueKey.setStatus('current') ibSmaBadPKeyAtSwitchPort = NotificationType((1, 3, 6, 1, 3, 117, 3, 2, 0, 10)).setObjects(("IB-SMA-MIB", "ibSmaNodeKey"), ("IB-SMA-MIB", "ibSmaNodeLid"), ("IB-SMA-MIB", "ibSmaNodeGid1"), ("IB-SMA-MIB", "ibSmaNodeQueuePair1"), ("IB-SMA-MIB", "ibSmaNodeLid2"), ("IB-SMA-MIB", "ibSmaNodeGid2"), ("IB-SMA-MIB", "ibSmaNodeQueuePair2"), ("IB-SMA-MIB", "ibSmaNodeServiceLevel"), ("IB-SMA-MIB", "ibSmaNodeSwitchLid"), ("IB-SMA-MIB", "ibSmaNodeDataValid")) if mibBuilder.loadTexts: ibSmaBadPKeyAtSwitchPort.setStatus('current') ibSmaCompliances = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 3, 1)) ibSmaGroups = MibIdentifier((1, 3, 6, 1, 3, 117, 3, 3, 2)) ibSmaBasicNodeCompliance = ModuleCompliance((1, 3, 6, 1, 3, 117, 3, 3, 1, 1)).setObjects(("IB-SMA-MIB", "ibSmaNodeGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaBasicNodeCompliance = ibSmaBasicNodeCompliance.setStatus('current') ibSmaFullSwitchCompliance = ModuleCompliance((1, 3, 6, 1, 3, 117, 3, 3, 1, 2)).setObjects(("IB-SMA-MIB", "ibSmaNodeGroup"), ("IB-SMA-MIB", "ibSmaSwitchGroup"), ("IB-SMA-MIB", "ibSmaGuidGroup"), ("IB-SMA-MIB", "ibSmaMgmtPortGroup"), ("IB-SMA-MIB", "ibSmaDataPortGroup"), ("IB-SMA-MIB", "ibSmaPKeyGroup"), ("IB-SMA-MIB", "ibSmaSlToVlMapGroup"), ("IB-SMA-MIB", "ibSmaVLArbitGroup"), ("IB-SMA-MIB", "ibSmaLFTGroup"), ("IB-SMA-MIB", "ibSmaRFTGroup"), ("IB-SMA-MIB", "ibSmaMFTGroup"), ("IB-SMA-MIB", "ibSmaSMGroup"), ("IB-SMA-MIB", "ibSmaVendDiagGroup"), ("IB-SMA-MIB", "ibSmaLedGroup"), ("IB-SMA-MIB", "ibSmaNotificationsGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaFullSwitchCompliance = ibSmaFullSwitchCompliance.setStatus('current') ibSmaFullRouterCACompliance = ModuleCompliance((1, 3, 6, 1, 3, 117, 3, 3, 1, 3)).setObjects(("IB-SMA-MIB", "ibSmaNodeGroup"), ("IB-SMA-MIB", "ibSmaGuidGroup"), ("IB-SMA-MIB", "ibSmaMgmtPortGroup"), ("IB-SMA-MIB", "ibSmaDataPortGroup"), ("IB-SMA-MIB", "ibSmaPKeyGroup"), ("IB-SMA-MIB", "ibSmaSlToVlMapGroup"), ("IB-SMA-MIB", "ibSmaVLArbitGroup"), ("IB-SMA-MIB", "ibSmaSMGroup"), ("IB-SMA-MIB", "ibSmaVendDiagGroup"), ("IB-SMA-MIB", "ibSmaLedGroup"), ("IB-SMA-MIB", "ibSmaNotificationsGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaFullRouterCACompliance = ibSmaFullRouterCACompliance.setStatus('current') ibSmaNodeGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 1)).setObjects(("IB-SMA-MIB", "ibSmaNodeString"), ("IB-SMA-MIB", "ibSmaNodeBaseVersion"), ("IB-SMA-MIB", "ibSmaNodeClassVersion"), ("IB-SMA-MIB", "ibSmaNodeType"), ("IB-SMA-MIB", "ibSmaNodeNumPorts"), ("IB-SMA-MIB", "ibSmaSystemImageGuid"), ("IB-SMA-MIB", "ibSmaNodeGuid"), ("IB-SMA-MIB", "ibSmaNodePortGuid"), ("IB-SMA-MIB", "ibSmaNodePartitionTableNum"), ("IB-SMA-MIB", "ibSmaNodeDeviceId"), ("IB-SMA-MIB", "ibSmaNodeRevision"), ("IB-SMA-MIB", "ibSmaNodeLocalPortNumOrZero"), ("IB-SMA-MIB", "ibSmaNodeVendorId"), ("IB-SMA-MIB", "ibSmaNodeLid"), ("IB-SMA-MIB", "ibSmaNodePortNum"), ("IB-SMA-MIB", "ibSmaNodeMethod"), ("IB-SMA-MIB", "ibSmaNodeAttributeId"), ("IB-SMA-MIB", "ibSmaNodeAttributeModifier"), ("IB-SMA-MIB", "ibSmaNodeKey"), ("IB-SMA-MIB", "ibSmaNodeLid2"), ("IB-SMA-MIB", "ibSmaNodeServiceLevel"), ("IB-SMA-MIB", "ibSmaNodeQueuePair1"), ("IB-SMA-MIB", "ibSmaNodeQueuePair2"), ("IB-SMA-MIB", "ibSmaNodeGid1"), ("IB-SMA-MIB", "ibSmaNodeGid2"), ("IB-SMA-MIB", "ibSmaNodeCapMask"), ("IB-SMA-MIB", "ibSmaNodeSwitchLid"), ("IB-SMA-MIB", "ibSmaNodeDataValid")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaNodeGroup = ibSmaNodeGroup.setStatus('current') ibSmaSwitchGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 2)).setObjects(("IB-SMA-MIB", "ibSmaSwLinearFdbTableNum"), ("IB-SMA-MIB", "ibSmaSwRandomFdbTableNum"), ("IB-SMA-MIB", "ibSmaSwMulticastFdbTableNum"), ("IB-SMA-MIB", "ibSmaSwLinearFdbTop"), ("IB-SMA-MIB", "ibSmaSwDefaultPort"), ("IB-SMA-MIB", "ibSmaSwDefMcastPriPort"), ("IB-SMA-MIB", "ibSmaSwDefMcastNotPriPort"), ("IB-SMA-MIB", "ibSmaSwLifeTimeValue"), ("IB-SMA-MIB", "ibSmaSwPortStateChange"), ("IB-SMA-MIB", "ibSmaSwLidsPerPort"), ("IB-SMA-MIB", "ibSmaSwPartitionEnforceNum"), ("IB-SMA-MIB", "ibSmaSwInboundEnforceCap"), ("IB-SMA-MIB", "ibSmaSwOutboundEnforceCap"), ("IB-SMA-MIB", "ibSmaSwFilterRawPktInputCap"), ("IB-SMA-MIB", "ibSmaSwFilterRawPktOutputCap"), ("IB-SMA-MIB", "ibSmaSwEnhancedPort0")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaSwitchGroup = ibSmaSwitchGroup.setStatus('current') ibSmaGuidGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 3)).setObjects(("IB-SMA-MIB", "ibSmaGuidVal")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaGuidGroup = ibSmaGuidGroup.setStatus('current') ibSmaMgmtPortGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 4)).setObjects(("IB-SMA-MIB", "ibSmaPortMKey"), ("IB-SMA-MIB", "ibSmaPortGidPrefix"), ("IB-SMA-MIB", "ibSmaPortLid"), ("IB-SMA-MIB", "ibSmaPortMasterSmLid"), ("IB-SMA-MIB", "ibSmaPortIsSubnetManager"), ("IB-SMA-MIB", "ibSmaPortIsNoticeSupported"), ("IB-SMA-MIB", "ibSmaPortIsTrapSupported"), ("IB-SMA-MIB", "ibSmaPortIsAutoMigrateSupported"), ("IB-SMA-MIB", "ibSmaPortIsSlMappingSupported"), ("IB-SMA-MIB", "ibSmaPortIsMKeyNvram"), ("IB-SMA-MIB", "ibSmaPortIsPKeyNvram"), ("IB-SMA-MIB", "ibSmaPortIsLedInfoSupported"), ("IB-SMA-MIB", "ibSmaPortIsSmDisabled"), ("IB-SMA-MIB", "ibSmaPortIsSysImgGuidSupported"), ("IB-SMA-MIB", "ibSmaPortIsPKeyExtPortTrapSup"), ("IB-SMA-MIB", "ibSmaPortIsCommManageSupported"), ("IB-SMA-MIB", "ibSmaPortIsSnmpTunnelSupported"), ("IB-SMA-MIB", "ibSmaPortIsReinitSupported"), ("IB-SMA-MIB", "ibSmaPortIsDevManageSupported"), ("IB-SMA-MIB", "ibSmaPortIsVendorClassSupported"), ("IB-SMA-MIB", "ibSmaPortIsDrNoticeSupported"), ("IB-SMA-MIB", "ibSmaPortIsCapMaskNoticSupported"), ("IB-SMA-MIB", "ibSmaPortIsBootMgmtSupported"), ("IB-SMA-MIB", "ibSmaPortMKeyLeasePeriod"), ("IB-SMA-MIB", "ibSmaPortMKeyProtectBits"), ("IB-SMA-MIB", "ibSmaPortMasterSmSl"), ("IB-SMA-MIB", "ibSmaPortInitTypeLoad"), ("IB-SMA-MIB", "ibSmaPortInitTypeContent"), ("IB-SMA-MIB", "ibSmaPortInitTypePresence"), ("IB-SMA-MIB", "ibSmaPortInitTypeResuscitate"), ("IB-SMA-MIB", "ibSmaPortInitNoLoadReply"), ("IB-SMA-MIB", "ibSmaPortInitPreserveContReply"), ("IB-SMA-MIB", "ibSmaPortInitPreservePresReply"), ("IB-SMA-MIB", "ibSmaPortMKeyViolations"), ("IB-SMA-MIB", "ibSmaPortPKeyViolations"), ("IB-SMA-MIB", "ibSmaPortQKeyViolations"), ("IB-SMA-MIB", "ibSmaPortNumGuid"), ("IB-SMA-MIB", "ibSmaPortSubnetTimeout"), ("IB-SMA-MIB", "ibSmaPortResponseTimeValue")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaMgmtPortGroup = ibSmaMgmtPortGroup.setStatus('current') ibSmaDataPortGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 5)).setObjects(("IB-SMA-MIB", "ibSmaPortLinkWidthEnabled"), ("IB-SMA-MIB", "ibSmaPortLinkWidthSupported"), ("IB-SMA-MIB", "ibSmaPortLinkWidthActive"), ("IB-SMA-MIB", "ibSmaPortLinkSpeedSupported"), ("IB-SMA-MIB", "ibSmaPortLinkState"), ("IB-SMA-MIB", "ibSmaPortPhysState"), ("IB-SMA-MIB", "ibSmaPortLinkDownDefaultState"), ("IB-SMA-MIB", "ibSmaPortLidMaskCount"), ("IB-SMA-MIB", "ibSmaPortLinkSpeedActive"), ("IB-SMA-MIB", "ibSmaPortLinkSpeedEnabled"), ("IB-SMA-MIB", "ibSmaPortNeighborMtu"), ("IB-SMA-MIB", "ibSmaPortVirtLaneSupport"), ("IB-SMA-MIB", "ibSmaPortVlHighPriorityLimit"), ("IB-SMA-MIB", "ibSmaPortVlArbHighCapacity"), ("IB-SMA-MIB", "ibSmaPortVlArbLowCapacity"), ("IB-SMA-MIB", "ibSmaPortMtuCapacity"), ("IB-SMA-MIB", "ibSmaPortVlStallCount"), ("IB-SMA-MIB", "ibSmaPortHeadOfQueueLife"), ("IB-SMA-MIB", "ibSmaPortOperationalVls"), ("IB-SMA-MIB", "ibSmaPortPartEnforceInbound"), ("IB-SMA-MIB", "ibSmaPortPartEnforceOutbound"), ("IB-SMA-MIB", "ibSmaPortFilterRawPktInbound"), ("IB-SMA-MIB", "ibSmaPortFilterRawPktOutbound"), ("IB-SMA-MIB", "ibSmaPortLocalPhysErrorThreshold"), ("IB-SMA-MIB", "ibSmaPortOverrunErrorThreshold")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaDataPortGroup = ibSmaDataPortGroup.setStatus('current') ibSmaPKeyGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 6)).setObjects(("IB-SMA-MIB", "ibSmaPKeyMembership"), ("IB-SMA-MIB", "ibSmaPKeyBase")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaPKeyGroup = ibSmaPKeyGroup.setStatus('current') ibSmaSlToVlMapGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 7)).setObjects(("IB-SMA-MIB", "ibSmaVirtualLane")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaSlToVlMapGroup = ibSmaSlToVlMapGroup.setStatus('current') ibSmaVLArbitGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 8)).setObjects(("IB-SMA-MIB", "ibSmaHiPriVirtLane"), ("IB-SMA-MIB", "ibSmaHiPriWeight"), ("IB-SMA-MIB", "ibSmaLowPriVirtLane"), ("IB-SMA-MIB", "ibSmaLowPriWeight")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaVLArbitGroup = ibSmaVLArbitGroup.setStatus('current') ibSmaLFTGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 9)).setObjects(("IB-SMA-MIB", "ibSmaLinForwEgressPort")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaLFTGroup = ibSmaLFTGroup.setStatus('current') ibSmaRFTGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 10)).setObjects(("IB-SMA-MIB", "ibSmaRandomDestLID"), ("IB-SMA-MIB", "ibSmaRandomForwEgressPort"), ("IB-SMA-MIB", "ibSmaRandomLMC"), ("IB-SMA-MIB", "ibSmaRandomIsValid")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaRFTGroup = ibSmaRFTGroup.setStatus('current') ibSmaMFTGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 11)).setObjects(("IB-SMA-MIB", "ibSmaMulForwMask")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaMFTGroup = ibSmaMFTGroup.setStatus('current') ibSmaSMGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 12)).setObjects(("IB-SMA-MIB", "ibSmaSmGuid"), ("IB-SMA-MIB", "ibSmaSmSmKey"), ("IB-SMA-MIB", "ibSmaSmSmpCount"), ("IB-SMA-MIB", "ibSmaSmPriority"), ("IB-SMA-MIB", "ibSmaSmState")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaSMGroup = ibSmaSMGroup.setStatus('current') ibSmaVendDiagGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 13)).setObjects(("IB-SMA-MIB", "ibSmaPortGenericDiagCode"), ("IB-SMA-MIB", "ibSmaPortVendorDiagCode"), ("IB-SMA-MIB", "ibSmaPortVendorDiagIndexFwd"), ("IB-SMA-MIB", "ibSmaPortVendorDiagData")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaVendDiagGroup = ibSmaVendDiagGroup.setStatus('current') ibSmaLedGroup = ObjectGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 14)).setObjects(("IB-SMA-MIB", "ibSmaLedState")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaLedGroup = ibSmaLedGroup.setStatus('current') ibSmaNotificationsGroup = NotificationGroup((1, 3, 6, 1, 3, 117, 3, 3, 2, 15)).setObjects(("IB-SMA-MIB", "ibSmaPortLinkStateChange"), ("IB-SMA-MIB", "ibSmaLinkIntegrityThresReached"), ("IB-SMA-MIB", "ibSmaExcessBuffOverrunThres"), ("IB-SMA-MIB", "ibSmaFlowCntrlUpdateTimerExpire"), ("IB-SMA-MIB", "ibSmaCapabilityMaskModified"), ("IB-SMA-MIB", "ibSmaSysImageGuidModified"), ("IB-SMA-MIB", "ibSmaBadManagementKey"), ("IB-SMA-MIB", "ibSmaBadPartitionKey"), ("IB-SMA-MIB", "ibSmaBadQueueKey"), ("IB-SMA-MIB", "ibSmaBadPKeyAtSwitchPort")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ibSmaNotificationsGroup = ibSmaNotificationsGroup.setStatus('current') mibBuilder.exportSymbols("IB-SMA-MIB", ibSmaNodeBaseVersion=ibSmaNodeBaseVersion, ibSmaRandomForwardingTable=ibSmaRandomForwardingTable, ibSmaNotificationPrefix=ibSmaNotificationPrefix, ibSmaNodeRevision=ibSmaNodeRevision, ibSmaSmInfoEntry=ibSmaSmInfoEntry, ibSmaVendDiagInfoEntry=ibSmaVendDiagInfoEntry, ibSmaMgmtPortGroup=ibSmaMgmtPortGroup, ibSmaNodeType=ibSmaNodeType, ibSmaNodeGid1=ibSmaNodeGid1, ibSmaPKeyIBAPortIndex=ibSmaPKeyIBAPortIndex, ibSmaMIB=ibSmaMIB, ibSmaBadManagementKey=ibSmaBadManagementKey, ibSmaFullSwitchCompliance=ibSmaFullSwitchCompliance, ibSmaPKeyIndex=ibSmaPKeyIndex, ibSmaPortInitTypeContent=ibSmaPortInitTypeContent, ibSmaLinDestDLIDIndex=ibSmaLinDestDLIDIndex, ibSmaPortIndex=ibSmaPortIndex, ibSmaPKeyTable=ibSmaPKeyTable, ibSmaVendDiagInfoTable=ibSmaVendDiagInfoTable, ibSmaHiPriVirtLane=ibSmaHiPriVirtLane, ibSmaVLArbitGroup=ibSmaVLArbitGroup, ibSmaNodeNumPorts=ibSmaNodeNumPorts, ibSmaPortInitPreserveContReply=ibSmaPortInitPreserveContReply, ibSmaSubMgrInfo=ibSmaSubMgrInfo, ibSmaLFTInfo=ibSmaLFTInfo, ibSmaSwPartitionEnforceNum=ibSmaSwPartitionEnforceNum, ibSmaRandomForwardingPortIndex=ibSmaRandomForwardingPortIndex, ibSmaSMInfo=ibSmaSMInfo, ibSmaPortOperationalVls=ibSmaPortOperationalVls, ibSmaPortInitNoLoadReply=ibSmaPortInitNoLoadReply, ibSmaBadQueueKey=ibSmaBadQueueKey, ibSmaRFTInfo=ibSmaRFTInfo, ibSmaPortNumGuid=ibSmaPortNumGuid, ibSmaHiPriVlArbEntry=ibSmaHiPriVlArbEntry, ibSmaPortMKeyProtectBits=ibSmaPortMKeyProtectBits, ibSmaLowPriWeight=ibSmaLowPriWeight, ibSmaServiceLevelIndex=ibSmaServiceLevelIndex, ibSmaPortGenericDiagCode=ibSmaPortGenericDiagCode, ibSmaGroups=ibSmaGroups, ibSmaNodeAttributeId=ibSmaNodeAttributeId, ibSmaNodeQueuePair2=ibSmaNodeQueuePair2, ibSmaPortLinkSpeedActive=ibSmaPortLinkSpeedActive, ibSmaVendDiagGroup=ibSmaVendDiagGroup, ibSmaSwLinearFdbTop=ibSmaSwLinearFdbTop, ibSmaPortMasterSmSl=ibSmaPortMasterSmSl, ibSmaLinForwEgressPort=ibSmaLinForwEgressPort, ibSmaPortLinkDownDefaultState=ibSmaPortLinkDownDefaultState, ibSmaLedIndex=ibSmaLedIndex, ibSmaSwitchGroup=ibSmaSwitchGroup, ibSmaPortPhysState=ibSmaPortPhysState, ibSmaPortLinkState=ibSmaPortLinkState, ibSmaSwFilterRawPktInputCap=ibSmaSwFilterRawPktInputCap, ibSmaPortVlArbHighCapacity=ibSmaPortVlArbHighCapacity, ibSmaGuidIndex=ibSmaGuidIndex, ibSmaPortVlStallCount=ibSmaPortVlStallCount, ibSmaPortMKeyViolations=ibSmaPortMKeyViolations, ibSmaPortInfoEntry=ibSmaPortInfoEntry, ibSmaVendDiagInfo=ibSmaVendDiagInfo, ibSmaLedState=ibSmaLedState, ibSmaNodeDataValid=ibSmaNodeDataValid, ibSmaRandomIsValid=ibSmaRandomIsValid, ibSmaNodeLid=ibSmaNodeLid, ibSmaGuidGroup=ibSmaGuidGroup, ibSmaPortMtuCapacity=ibSmaPortMtuCapacity, ibSmaSysImageGuidModified=ibSmaSysImageGuidModified, ibSmaIBAOutPortIndex=ibSmaIBAOutPortIndex, ibSmaLowPriIBAPortIndex=ibSmaLowPriIBAPortIndex, ibSmaPortInitTypePresence=ibSmaPortInitTypePresence, ibSmaNodePartitionTableNum=ibSmaNodePartitionTableNum, ibSmaCompliances=ibSmaCompliances, ibSmaPortIsLedInfoSupported=ibSmaPortIsLedInfoSupported, ibSmaPortIsReinitSupported=ibSmaPortIsReinitSupported, ibSmaGuidInfoEntry=ibSmaGuidInfoEntry, PYSNMP_MODULE_ID=ibSmaMIB, ibSmaNodeKey=ibSmaNodeKey, ibSmaPortIsSysImgGuidSupported=ibSmaPortIsSysImgGuidSupported, ibSmaPortResponseTimeValue=ibSmaPortResponseTimeValue, ibSmaHiPriWeight=ibSmaHiPriWeight, ibSmaNodePortGuid=ibSmaNodePortGuid, ibSmaFullRouterCACompliance=ibSmaFullRouterCACompliance, ibSmaNodeGuid=ibSmaNodeGuid, ibSmaPortQKeyViolations=ibSmaPortQKeyViolations, ibSmaHiPriIBAPortIndex=ibSmaHiPriIBAPortIndex, ibSmaLowPriVlArbEntry=ibSmaLowPriVlArbEntry, ibSmaNotificationsGroup=ibSmaNotificationsGroup, ibSmaSmInfoTable=ibSmaSmInfoTable, ibSmaSwLifeTimeValue=ibSmaSwLifeTimeValue, ibSmaMulForwMask=ibSmaMulForwMask, ibSmaPKeyBase=ibSmaPKeyBase, ibSmaPortLocalPhysErrorThreshold=ibSmaPortLocalPhysErrorThreshold, ibSmaPortNeighborMtu=ibSmaPortNeighborMtu, ibSmaRandomForwardingEntry=ibSmaRandomForwardingEntry, ibSmaNodeInfo=ibSmaNodeInfo, ibSmaPortInitTypeResuscitate=ibSmaPortInitTypeResuscitate, ibSmaRandomForwEgressPort=ibSmaRandomForwEgressPort, ibSmaPortIsSlMappingSupported=ibSmaPortIsSlMappingSupported, ibSmaMulForEntry=ibSmaMulForEntry, ibSmaSlToVlMapGroup=ibSmaSlToVlMapGroup, ibSmaSwDefMcastPriPort=ibSmaSwDefMcastPriPort, ibSmaPortMasterSmLid=ibSmaPortMasterSmLid, ibSmaHiPriVlArbTable=ibSmaHiPriVlArbTable, ibSmaSwInboundEnforceCap=ibSmaSwInboundEnforceCap, ibSmaPortVlHighPriorityLimit=ibSmaPortVlHighPriorityLimit, ibSmaPortIsSubnetManager=ibSmaPortIsSubnetManager, ibSmaPortIsDrNoticeSupported=ibSmaPortIsDrNoticeSupported, ibSmaPortFilterRawPktInbound=ibSmaPortFilterRawPktInbound, ibSmaPortMKeyLeasePeriod=ibSmaPortMKeyLeasePeriod, ibSmaSystemImageGuid=ibSmaSystemImageGuid, ibSmaPortGidPrefix=ibSmaPortGidPrefix, ibSmaPortLid=ibSmaPortLid, ibSmaPortLidMaskCount=ibSmaPortLidMaskCount, ibSmaSmSmKey=ibSmaSmSmKey, ibSmaSMGroup=ibSmaSMGroup, ibSmaPortMKey=ibSmaPortMKey, ibSmaLedInfoTable=ibSmaLedInfoTable, ibSmaPortVendorDiagCode=ibSmaPortVendorDiagCode, ibSmaIBAInPortIndex=ibSmaIBAInPortIndex, ibSmaVendDiagPortIndex=ibSmaVendDiagPortIndex, ibSmaPortVendorDiagData=ibSmaPortVendorDiagData, ibSmaSwDefaultPort=ibSmaSwDefaultPort, ibSmaFlowCntrlUpdateTimerExpire=ibSmaFlowCntrlUpdateTimerExpire, ibSmaPortLinkSpeedEnabled=ibSmaPortLinkSpeedEnabled, ibSmaNodeVendorId=ibSmaNodeVendorId, ibSmaSwPortStateChange=ibSmaSwPortStateChange, ibSmaLowPriVlArbTable=ibSmaLowPriVlArbTable, ibSmaPortIsSmDisabled=ibSmaPortIsSmDisabled, ibSmaPortIsBootMgmtSupported=ibSmaPortIsBootMgmtSupported, ibSmaPKeyMembership=ibSmaPKeyMembership, ibSmaRandomDestLID=ibSmaRandomDestLID, ibSmaSmSmpCount=ibSmaSmSmpCount, ibSmaPortVendorDiagIndexFwd=ibSmaPortVendorDiagIndexFwd, ibSmaLinForEntry=ibSmaLinForEntry, ibSmaSwFilterRawPktOutputCap=ibSmaSwFilterRawPktOutputCap, ibSmaSmInfoPortIndex=ibSmaSmInfoPortIndex, ibSmaPortIsPKeyExtPortTrapSup=ibSmaPortIsPKeyExtPortTrapSup, ibSmaLFTGroup=ibSmaLFTGroup, ibSmaPortFilterRawPktOutbound=ibSmaPortFilterRawPktOutbound, ibSmaPortIsVendorClassSupported=ibSmaPortIsVendorClassSupported, ibSmaPortIsDevManageSupported=ibSmaPortIsDevManageSupported, ibSmaPortLinkWidthEnabled=ibSmaPortLinkWidthEnabled, ibSmaPortLinkWidthSupported=ibSmaPortLinkWidthSupported, ibSmaLinkIntegrityThresReached=ibSmaLinkIntegrityThresReached, ibSmaNodeClassVersion=ibSmaNodeClassVersion, ibSmaDataPortInfo=ibSmaDataPortInfo, ibSmaNodeLocalPortNumOrZero=ibSmaNodeLocalPortNumOrZero, ibSmaPortInitTypeLoad=ibSmaPortInitTypeLoad, ibSmaPKeyInfo=ibSmaPKeyInfo, ibSmaGuidVal=ibSmaGuidVal, ibSmaLinForTable=ibSmaLinForTable, ibSmaMgmtPortInfo=ibSmaMgmtPortInfo, ibSmaSwMulticastFdbTableNum=ibSmaSwMulticastFdbTableNum, ibSmaNodeDeviceId=ibSmaNodeDeviceId, ibSmaMFTGroup=ibSmaMFTGroup, ibSmaSwEnhancedPort0=ibSmaSwEnhancedPort0, ibSmaHiPriNIndex=ibSmaHiPriNIndex, ibSmaSwLidsPerPort=ibSmaSwLidsPerPort, ibSmaLedGroup=ibSmaLedGroup, ibSmaNodeGroup=ibSmaNodeGroup, ibSmaPortSubnetTimeout=ibSmaPortSubnetTimeout, ibSmaSL2VLMapEntry=ibSmaSL2VLMapEntry, ibSmaSlToVlMapInfo=ibSmaSlToVlMapInfo, ibSmaPortInitPreservePresReply=ibSmaPortInitPreservePresReply, ibSmaBasicNodeCompliance=ibSmaBasicNodeCompliance, ibSmaMulDestDLIDIndex=ibSmaMulDestDLIDIndex, ibSmaMFTInfo=ibSmaMFTInfo, ibSmaBadPartitionKey=ibSmaBadPartitionKey, ibSmaCapabilityMaskModified=ibSmaCapabilityMaskModified, ibSmaNodeString=ibSmaNodeString, ibSmaSmGuid=ibSmaSmGuid, ibSmaPortLinkStateChange=ibSmaPortLinkStateChange, ibSmaLowPriNIndex=ibSmaLowPriNIndex, ibSmaPortPKeyViolations=ibSmaPortPKeyViolations, ibSmaSmPriority=ibSmaSmPriority, ibSmaVirtualLane=ibSmaVirtualLane, ibSmaConformance=ibSmaConformance, ibSmaNodeGid2=ibSmaNodeGid2, ibSmaLedInfoEntry=ibSmaLedInfoEntry, ibSmaPortIsSnmpTunnelSupported=ibSmaPortIsSnmpTunnelSupported, ibSmaGuidInfo=ibSmaGuidInfo, ibSmaPKeyEntry=ibSmaPKeyEntry, ibSmaSwRandomFdbTableNum=ibSmaSwRandomFdbTableNum, ibSmaLowPriVirtLane=ibSmaLowPriVirtLane, ibSmaPortHeadOfQueueLife=ibSmaPortHeadOfQueueLife, ibSmaPortLinkWidthActive=ibSmaPortLinkWidthActive, ibSmaRFTGroup=ibSmaRFTGroup, ibSmaSwitchInfo=ibSmaSwitchInfo, ibSmaNodeAttributeModifier=ibSmaNodeAttributeModifier, ibSmaSL2VLMapTable=ibSmaSL2VLMapTable, ibSmaPortLinkSpeedSupported=ibSmaPortLinkSpeedSupported, ibSmaObjects=ibSmaObjects, ibSmaDataPortGroup=ibSmaDataPortGroup, ibSmaPortIsCommManageSupported=ibSmaPortIsCommManageSupported, ibSmaVLArbitInfo=ibSmaVLArbitInfo, ibSmaNodeLid2=ibSmaNodeLid2, ibSmaPortIsPKeyNvram=ibSmaPortIsPKeyNvram, ibSmaPortOverrunErrorThreshold=ibSmaPortOverrunErrorThreshold, ibSmaBadPKeyAtSwitchPort=ibSmaBadPKeyAtSwitchPort, ibSmaNotifications=ibSmaNotifications, ibSmaPortIsCapMaskNoticSupported=ibSmaPortIsCapMaskNoticSupported, ibSmaSwDefMcastNotPriPort=ibSmaSwDefMcastNotPriPort, ibSmaGuidInfoTable=ibSmaGuidInfoTable, ibSmaSwOutboundEnforceCap=ibSmaSwOutboundEnforceCap, ibSmaNodeQueuePair1=ibSmaNodeQueuePair1, ibSmaSwLinearFdbTableNum=ibSmaSwLinearFdbTableNum, ibSmaPortPartEnforceOutbound=ibSmaPortPartEnforceOutbound, ibSmaPortIsMKeyNvram=ibSmaPortIsMKeyNvram, ibSmaPortIsNoticeSupported=ibSmaPortIsNoticeSupported, ibSmaMulForTable=ibSmaMulForTable, ibSmaGuidPortIndex=ibSmaGuidPortIndex, ibSmaNodeServiceLevel=ibSmaNodeServiceLevel, ibSmaPortVlArbLowCapacity=ibSmaPortVlArbLowCapacity, ibSmaPortInfoTable=ibSmaPortInfoTable, ibSmaPKeyGroup=ibSmaPKeyGroup, ibSmaPortIsAutoMigrateSupported=ibSmaPortIsAutoMigrateSupported, ibSmaRandomLMC=ibSmaRandomLMC, ibSmaNodePortNum=ibSmaNodePortNum, ibSmaNodeSwitchLid=ibSmaNodeSwitchLid, ibSmaExcessBuffOverrunThres=ibSmaExcessBuffOverrunThres, ibSmaNodeCapMask=ibSmaNodeCapMask, ibSmaLedInfo=ibSmaLedInfo, ibSmaPortVirtLaneSupport=ibSmaPortVirtLaneSupport, ibSmaPortPartEnforceInbound=ibSmaPortPartEnforceInbound, ibSmaSmState=ibSmaSmState, ibSmaNodeMethod=ibSmaNodeMethod, ibSmaPortIsTrapSupported=ibSmaPortIsTrapSupported)
def computador_escolhe_jogada(n, m): computadorRemove = 1 while computadorRemove != m: if ((n - computadorRemove) % (m+1) == 0): return computadorRemove else: computadorRemove += 1 return computadorRemove def usuario_escolhe_jogada(n, m): jogadaValida = False while not jogadaValida: jogadorRemove = int(input("Quantas peças você vai tirar? ")) if jogadorRemove > m or jogadorRemove < 1: print() print("Oops! Jogada inválida! Tente de novo.") print() else: jogadaValida = True return jogadorRemove def campeonato(): numeroRodada = 1 while numeroRodada <= 3: print() print("**** Rodada", numeroRodada, "****") print() partida() numeroRodada += 1 print() print("Placar: Você 0 X 3 Computador") def partida(): n = int(input("Quantas peças? ")) m = int(input("Limite de peças por jogada? ")) vezDoPC = False if (n % (m+1) == 0): print() print("Voce começa!") else: print() print("Computador começa!") vezDoPC = True while (n > 0): if vezDoPC: computadorRemove = computador_escolhe_jogada(n, m) n = n - computadorRemove if computadorRemove == 1: print() print("O computador tirou uma peça") else: print() print("O computador tirou", computadorRemove, "peças") vezDoPC = False else: jogadorRemove = usuario_escolhe_jogada(n, m) n = n - jogadorRemove if jogadorRemove == 1: print() print("Você tirou uma peça") else: print() print("Você tirou", jogadorRemove, "peças") vezDoPC = True if (n == 1): print("Agora resta apenas uma peça no tabuleiro.") print() else: if (n != 0): print("Agora restam,", n, "peças no tabuleiro.") print() print("Fim do jogo! O computador ganhou!") def main(): print("Bem-vindo ao jogo do NIM! Escolha:") print() print("1 - para jogar uma partida isolada") print("2 - para jogar um campeonato ") print() tipoDePartida = int(input()) if tipoDePartida == 2: print() print("Voce escolheu um campeonato!") print() campeonato() else: if tipoDePartida == 1: print() partida() main()
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name : ecc Description : Author : x3nny date : 2021/10/7 ------------------------------------------------- Change Activity: 2021/10/7: Init ------------------------------------------------- """ __author__ = 'x3nny'
def phone_number(num): string = [(str(x)) for x in num] string = ''.join(string) return f'({string[:3]}) {string[3:6]}-{string[6:]}' print(phone_number([1,2,3,4,5,6,7,8,9,0]))
""" Sermin exceptions """ class RunError(Exception): """ Sermin error during a blueprint run """ pass class ShellError(RunError): """ Sermin shell command failed """ pass
#!/usr/bin/env python # coding:utf8 class Singleton(type): __instances = {} def __call__(cls, *args, **kwargs): if cls not in cls.__instances: cls.__instances[cls] = super(Singleton, cls).__call__(*args, **kwargs) return cls.__instances[cls] class MetaclassSingleton(metaclass=Singleton): def check(self): print("the instance has been created") if __name__ == "__main__": MetaclassSingleton().check() # 目前最优解,这里的 __call__ 更加灵活