content
stringlengths
7
1.05M
class RobotState: """ Interface a robot state must implement to be used with :py:class:`roboball2d.physics.rendering.pyglet_renderer.PygletRenderer` See : :py:class:`roboball2d.robot.default_robot_state.DefaultRobotState """ def __init__(self, robot_config, generalized_coordinates = None, generalized_velocities = None): raise NotImplementedError("__init__ not implemented.") def render(self): raise NotImplementedError("render not implemented.")
# -*- coding: utf-8 -*- def main(): s = input() f = int(s[:2]) l = int(s[2:]) if 1 <= f <= 12 and 1 <= l <= 12: print('AMBIGUOUS') elif 1 <= l <= 12: print('YYMM') elif 1 <= f <= 12: print('MMYY') else: print('NA') if __name__ == '__main__': main()
#!/usr/bin/env python # -*- coding: utf-8 -*- atoms = { 'C': 1, 'H': 4, 'O': 1, } bonds = { 'C-O': 1, 'C-H': 3, 'O-H': 1, } linear = False externalSymmetry = 1 spinMultiplicity = 2 opticalIsomers = 1 #confirmed energy = { 'M08SO': QchemLog('ch3oh.out'), } geometry = QchemLog('ch3oh.out') frequencies = QchemLog('ch3oh.out')
A = 'A' B = 'B' C = 'C' D = 'D' state = {} action = None model = {A: None, B: None, C: None, D: None} # Initially ignorant RULE_ACTION = { 1: 'Suck', 2: 'Right', 3: 'NoOp' } rules = { (A, 'Dirty'):1, (B, 'Dirty'):1, (C, 'Dirty'):1, (D, 'Dirty'):1, (A, 'Clean'):2, (B, 'Clean'):2, (C, 'Clean'):2, (D, 'Clean'):2, (A, B, C, D, 'Clean'):3 } #Ex. rule (if location == A && Dirty then rule 1) Enviroment = { A: 'Dirty', B: 'Dirty', C: 'Dirty', D: 'Dirty', 'Current': A } def INTERPRET_INPUT(input): # No interpretation return input def RULE_MATCH(state,rules): # Match rule for a given state rule = rules.get(tuple(state)) return rule def UPDATE_STATE(state, action, percept): (location, status) = percept state = percept if model[A] == model[B] == model[C] == model[D] == 'Clean': state = (A, B, C, D, 'Clean') # Model consulted only for A and B clean model[location] = status # Update the model state return state def REFLEX_AGENT_WITH_STATE(percept): global state, action state = UPDATE_STATE(state, action, percept) rule = RULE_MATCH(state, rules) action = RULE_ACTION[rule] return action def Sensors(): # Sense Enviroment location = Enviroment['Current'] return (location, Enviroment[location]) def Actuators(action): # Modify Enviroment location = Enviroment['Current'] if action == 'Suck': Enviroment[location] = 'Clean' elif action == 'Right' and location == A: Enviroment['Current'] = B elif action == 'Right' and location == B: Enviroment['Current'] = C elif action == 'Right' and location == C: Enviroment['Current'] = D elif action == 'Right' and location == D: Enviroment['Current'] = A def run(n): # run the agent through n steps print(' Current New') print('Location Status Action Location Status') for i in range(1,n): (location, status) = Sensors() # Sense Enviroment before action print("{:12s}{:8s}".format(location, status), end='') action = REFLEX_AGENT_WITH_STATE(Sensors()) Actuators(action) (location, status) = Sensors() # Sense Enviroment after action print("{:8s}{:12s}{:4s}".format(action, location, status)) run(20)
class Config(object): DEBUG = True TESTING = True # MySQL config MYSQL_DATABASE_HOST = 'localhost' MYSQL_DATABASE_PORT = 3306 MYSQL_DATABASE_USER = 'knoydart' MYSQL_DATABASE_PASSWORD = '7xGFGzF8BbzsJFCd' MYSQL_DATABASE_DB = 'knoydart' MYSQL_DATABASE_CHARSET = 'utf8' DATATAKER_HOST = '185.34.63.131' DATATAKER_PORT = 7700 DATATAKER_PASS = 'q5DX5zZT2A'
def part1(): values = [[int(i) if i.isnumeric() else i for i in i.split(" ")] for i in open("input.txt","r").read().split("\n")] depth = 0 horizontal = 0 for i in values: if i[0] == "up": depth -= i[1] elif i[0] == "down": depth += i[1] elif i[0] == "forward": horizontal += i[1] return depth*horizontal def part2(): values = [[int(i) if i.isnumeric() else i for i in i.split(" ")] for i in open("input.txt","r").read().split("\n")] aim = 0 depth = 0 horizontal = 0 for i in values: if i[0] == "up": aim -= i[1] elif i[0] == "down": aim += i[1] elif i[0] == "forward": horizontal += i[1] depth += aim * i[1] return depth*horizontal return total print(f"answer to part1: {part1()}") print(f"answer to part2: {part2()}")
class Resources: class LoginPage: USERNAME_FIELD_PLACEHOLDER = "Username" PASSWORD_FIELD_PLACEHOLDER = "Password" LOGIN_BUTTON_TEXT = "Login" NON_EXISTING_USER_ERROR_TEXT = "Epic sadface: Username and password do not match any user in this service" MISSING_USERNAME_ERROR_TEXT = "Epic sadface: Username is required" MISSING_PASSWORD_ERROR_TEXT = "Epic sadface: Password is required" LOCKED_OUT_USER_ERROR_TEXT = "Epic sadface: Sorry, this user has been locked out."
def fun(liczby): n = len(str(liczby)) dziel=1 tak = 10 suma = 0 cos = liczby for x in range(0,n): liczba=liczby%tak liczby-=liczba tak*=10 liczba/=dziel suma+=liczba dziel*=10 return int(suma) print(fun(545435433))
def largestNumber(n): ''' Given an integer n, return the largest number that contains exactly n digits. ''' return 10 ** n - 1 print(largestNumber(1)) print(largestNumber(5)) print(largestNumber(10))
class InitializationEventAttribute(Attribute, _Attribute): """ Specifies which event is raised on initialization. This class cannot be inherited. InitializationEventAttribute(eventName: str) """ def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass @staticmethod def __new__(self, eventName): """ __new__(cls: type,eventName: str) """ pass EventName = property(lambda self: object(), lambda self, v: None, lambda self: None) """Gets the name of the initialization event. Get: EventName(self: InitializationEventAttribute) -> str """
# -*- coding: utf-8 -*- class Solution: def strStr(self, haystack, needle): return haystack.find(needle) if __name__ == '__main__': solution = Solution() assert 2 == solution.strStr('hello', 'll') assert -1 == solution.strStr('aaaaa', 'bba') assert 0 == solution.strStr('aaaaa', '')
PARAMS = { "default": { "folders": ["INBOX"], "csvdir": "./data", "outdir": "./trained", }, "suse-manager": { "folders": ["INBOX/suse-manager"], "csvdir": "./suse-manager-data", "outdir": "./suse-manager-trained", } }
class ArthurContextProperty(ArthurContext): """ Question: We want to find out which context a given word is part of. Possible calculations: 1. Calculate levenshtein distance of given word with all val_samples, then return key of the val_sample with smallest levenshtein distance. 2. If given text follows a certain regex, adds its relevancy score with regex_weight. regex_weight defaults at 0.5, and can be set up manually below. 3. If we have information of text found in pdf right before given word, we can perhaps give weight to associated key, but this is not 100%. Maybe we can try with #1 first and when improvement is needed we can try #2 and #3. For example, consider following ArthurDocumentElements in pdf (subtle differences are intentional): - Community features: - private settings, southern exposures. As levensthein distance is closest when compared with "appliances included", that is the value that will be returned. Different languages may have different rules. We can expand our project by creating other contexts. ## Complications: **1. Key and value could be stored in one line, for example: "View: ocean view".** To deal with this, maybe we can imitate a method used in DNA string comparison, where values found before and after search string are not penalized (see Smith- Waterman algorithm). """ ### Return json text of context. def value(): return """ { "address": { "val_regex": "[,-a-zA-Z0-9 ]", "val_samples": ["3150 Rutland Rd, Victoria, British Columbia V8R4R8"] }, "total_rooms": { "key_location": "right", "key_samples": [{"type": "image", "path": ""}], "val_regex": "[0-9]" }, "total_bathrooms": { "key_location": "right", "key_samples": [{"type": "image", "path": ""}], "val_regex": "[0-9]" }, "property_type": { "key_samples": ["property type"], "val_regex": "[-a-zA-Z0-9 ]", "val_samples": [ "single family" ] }, "land_size": { "key_samples": ["land size"], "val_regex": "^[0-9][.0-9a-z ]+", "regex_weight": 0.8, "val_samples": ["0.9065 hec"] }, "building_type": { "key_samples": ["building type"], "val_regex": "[-a-zA-Z0-9 ]", "val_samples": ["house"] }, "built_in": { "key_samples": ["built in"], "val_regex": "[0-9]{4}", "regex_weight": 0.8, "val_samples": ["1914"] }, "title": { "key_samples": ["title"], "val_regex": "[-a-zA-Z0-9 ]", "val_samples": [ "freehold" ] }, "appliances_included": { "key_samples": ["appliances included"], "val_regex": "[-a-zA-Z0-9 ]", "val_samples": [ "hot tub", "water softener", "central vacuum" ] }, "community_features": { "key_samples": ["community features"], "val_regex": "[-a-zA-Z0-9 ]", "val_samples": [ "quiet area" ] }, "features": { "key_samples": ["features"], "val_regex": "[-a-zA-Z0-9 ]", "val_samples": [ "cul-de-sac", "private setting", "southern exposure", "wheelchair access" ] }, "view": { "key_samples": ["view"], "val_regex": "[-a-zA-Z0-9 ]", "val_samples": [ "view of water", "mountain view", "city view", "ocean view", "lake view" ] }, "parking_type": { "key_samples": ["parking type"], "val_regex": "[-a-zA-Z0-9 ]", "val_samples": [ "garage" ] }, "waterfront": { "key_samples": ["waterfront"], "val_regex": "[-a-zA-Z0-9 ]", "val_samples": ["waterfront on ocean"] }, "zoning_id": { "key_samples": ["zoning id"], "val_regex": "[-a-zA-Z0-9 ]", "val_samples": ["residential"] }, "description": { "key_samples": ["description"], "val_regex": "." }, "floor_space": { "key_samples": ["floor space"], "val_regex": "^[0-9][.0-9a-z ]+", "regex_weight": 0.8, "val_samples": ["1025.742 m2"] }, "style": { "key_samples": ["style"], "val_regex": "[-a-zA-Z0-9 ]", "val_samples": ["detached"] }, "walk_score": { "key_samples": ["walk score"], "val_regex": "[0-9]", "regex_weight": 0.8, "val_samples": [6] }, "walk_score_detail": { "key_samples": ["walk score"], "val_regex": "[-a-zA-Z0-9 ]", "val_samples": ["car-dependent"] }, "agent_name": { "val_regex": "[-a-zA-Z0-9 ]", "val_samples": ["Sylvia", "Therrien"], }, "agent_job_desc": { "val_regex": "[-a-zA-Z0-9 ]", "val_samples": ["personal real estate corporation"], }, "agent_company_name": { "val_regex": "[-a-zA-Z0-9 ]", "val_samples": ["newport realty"], }, "agent_company_address": { "val_regex": "[,-a-zA-Z0-9 ]", "val_samples": ["1286 Fairfield Rd", "Victoria, BC V8V4W3"] }, "agent_company_phone": { "key_samples": [{"type": "image", "path": ""}], "val_regex": "[-0-9]", "val_samples": ["250-385-2033"] }, "agent_company_fax": { "key_samples": ["fax:"], "val_regex": "[-0-9]", "val_samples": ["250-385-3763"] } } """
#!/usr/bin/python3 SYMBOL_TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz12345678"+ \ "90 !?." LEN_SYM_TABLE = len(SYMBOL_TABLE) print("[+] Length of Symbol table is {}".format(LEN_SYM_TABLE)) def decrypt(c_message, key): plaintext = [] for ch in c_message: pos = SYMBOL_TABLE.find(ch) if pos == -1: plaintext.append(ch) continue if pos - key < 0: pos = (pos - key) + LEN_SYM_TABLE else: pos = (pos - key) plaintext.append(SYMBOL_TABLE[pos]) return ''.join(plaintext) ## bruteforce across keylength of SYMBOL_TABLE def bruteForceCaeserCipher(message): for key in range(LEN_SYM_TABLE): print("Key: {} -- {}".format(key,decrypt(message,key))) if __name__ == '__main__': message = "avnl1olyD4l'ylDohww6DhzDjhuDil" bruteForceCaeserCipher(message)
def try_describe_request(command): if isinstance(command, list) and len(command) == 3: command_type = command[0] if command_type == 4: player_key = command[1] actions = command[2] # known action samples # [2, id, (target x, y), ?power] # [1, id] - destruct # [0, id, (x, y)] - change speed return { 'command_type': command_type, 'player_key': player_key, 'actions': actions } else: return command return command def try_describe_ship(ship): if len(ship) != 8: return ship d = {} d['role'] = ship[0] d['id'] = ship[1] d['pos'] = ship[2] d['speed'] = ship[3] d['params'] = { 'remaining fuely': ship[4][0], 'max shot power': ship[4][1], 'heat decrease rate': ship[4][2], 'ships count': ship[4][3], } d['heat'] = ship[5] d['max heat'] = ship[6] d['unk8'] = ship[7] return d def try_describe_game_state(state): if len(state) != 3: return state d = {} d['step'] = state[0] d['unk2'] = state[1] d['ships'] = [ { 'ship': try_describe_ship(block[0]), 'commands': block[1] } for block in state[2]] return d def try_describe_game_params(params): if len(params) != 5: return params d = {} d['max time'] = params[0] d['is_defender'] = params[1] d['unk3'] = params[2] d['?planet params'] = params[3] d['enemy init ship params?? (only attacker??)'] = params[4] return d def try_describe_response(response): if isinstance(response, list) and len(response) == 4: d = {} d['success'] = response[0] d['game_state'] = response[1] d['game params'] = try_describe_game_params(response[2]) d['game state'] = try_describe_game_state(response[3]) return d else: return response
class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0 : return False elif x < 10: return True else: strx = str(x) i = 0 j = len(strx) - 1 while i < j: if strx[i] != strx[j]: return False i += 1 j -= 1 return True
# Day 10 - Search Insert Position # Naive class Solution: def searchInsert(self, nums: List[int], target: int) -> int: for i, num in enumerate(nums): if target <= num: return i return len(nums) # Binary Search class Solution: def searchInsert(self, nums: List[int], target: int) -> int: l, r = 0, len(nums) while l < r: m = (l + r) // 2 if nums[m] < target: l = m + 1 elif target <= nums[m]: r = m return l
class ListNode: def __init__(self, key=None, value=None): self.key = key self.value = value self.prev = None self.next = None class LRUCache: def __init__(self, capacity: int): self.capacity = capacity self.hashmap = {} # 新建两个节点 head 和 tail self.head = ListNode() self.tail = ListNode() # 初始化链表为 head <-> tail self.head.next = self.tail self.tail.prev = self.head # 因为get与put操作都可能需要将双向链表中的某个节点移到末尾,所以定义一个方法 def move_node_to_tail(self, key): # 先将哈希表key指向的节点拎出来,为了简洁起名node # hashmap[key] hashmap[key] # | | # V --> V # prev <-> node <-> next pre <-> next ... node node = self.hashmap[key] node.prev.next = node.next node.next.prev = node.prev # 之后将node插入到尾节点前 # hashmap[key] hashmap[key] # | | # V --> V # prev <-> tail ... node prev <-> node <-> tail node.prev = self.tail.prev node.next = self.tail self.tail.prev.next = node self.tail.prev = node def get(self, key): if key in self.hashmap: # 如果已经在链表中了久把它移到末尾(变成最新访问的) self.move_node_to_tail(key) res = self.hashmap.get(key, None) if res is None: return else: return res.value def put(self, key, value) -> None: if key in self.hashmap: # 如果key本身已经在哈希表中了就不需要在链表中加入新的节点 # 但是需要更新字典该值对应节点的value self.hashmap[key].value = value # 之后将该节点移到末尾 self.move_node_to_tail(key) else: if len(self.hashmap) == self.capacity: # 去掉哈希表对应项 self.hashmap.pop(self.head.next.key) # 去掉最久没有被访问过的节点,即头节点之后的节点 self.head.next = self.head.next.next self.head.next.prev = self.head # 如果不在的话就插入到尾节点前 new = ListNode(key, value) self.hashmap[key] = new new.prev = self.tail.prev new.next = self.tail self.tail.prev.next = new self.tail.prev = new # 作者:liye-3 # 链接:https://leetcode-cn.com/problems/lru-cache/solution/shu-ju-jie-gou-fen-xi-python-ha-xi-shuang-xiang-li/ # 来源:力扣(LeetCode) # 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
# Copyright 2014 Rackspace # # 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. LB_ALGORITHM_ROUND_ROBIN = 'ROUND_ROBIN' LB_ALGORITHM_LEAST_CONNECTIONS = 'LEAST_CONNECTIONS' LB_ALGORITHM_SOURCE_IP = 'SOURCE_IP' SUPPORTED_LB_ALGORITHMS = (LB_ALGORITHM_LEAST_CONNECTIONS, LB_ALGORITHM_ROUND_ROBIN, LB_ALGORITHM_SOURCE_IP) SESSION_PERSISTENCE_SOURCE_IP = 'SOURCE_IP' SESSION_PERSISTENCE_HTTP_COOKIE = 'HTTP_COOKIE' SESSION_PERSISTENCE_APP_COOKIE = 'APP_COOKIE' SUPPORTED_SP_TYPES = (SESSION_PERSISTENCE_SOURCE_IP, SESSION_PERSISTENCE_HTTP_COOKIE, SESSION_PERSISTENCE_APP_COOKIE) HEALTH_MONITOR_PING = 'PING' HEALTH_MONITOR_TCP = 'TCP' HEALTH_MONITOR_HTTP = 'HTTP' HEALTH_MONITOR_HTTPS = 'HTTPS' HEALTH_MONITOR_TLS_HELLO = 'TLS-HELLO' HEALTH_MONITOR_UDP_CONNECT = 'UDP-CONNECT' SUPPORTED_HEALTH_MONITOR_TYPES = (HEALTH_MONITOR_HTTP, HEALTH_MONITOR_HTTPS, HEALTH_MONITOR_PING, HEALTH_MONITOR_TCP, HEALTH_MONITOR_TLS_HELLO, HEALTH_MONITOR_UDP_CONNECT) HEALTH_MONITOR_HTTP_METHOD_GET = 'GET' HEALTH_MONITOR_HTTP_METHOD_HEAD = 'HEAD' HEALTH_MONITOR_HTTP_METHOD_POST = 'POST' HEALTH_MONITOR_HTTP_METHOD_PUT = 'PUT' HEALTH_MONITOR_HTTP_METHOD_DELETE = 'DELETE' HEALTH_MONITOR_HTTP_METHOD_TRACE = 'TRACE' HEALTH_MONITOR_HTTP_METHOD_OPTIONS = 'OPTIONS' HEALTH_MONITOR_HTTP_METHOD_CONNECT = 'CONNECT' HEALTH_MONITOR_HTTP_METHOD_PATCH = 'PATCH' HEALTH_MONITOR_HTTP_DEFAULT_METHOD = HEALTH_MONITOR_HTTP_METHOD_GET SUPPORTED_HEALTH_MONITOR_HTTP_METHODS = ( HEALTH_MONITOR_HTTP_METHOD_GET, HEALTH_MONITOR_HTTP_METHOD_HEAD, HEALTH_MONITOR_HTTP_METHOD_POST, HEALTH_MONITOR_HTTP_METHOD_PUT, HEALTH_MONITOR_HTTP_METHOD_DELETE, HEALTH_MONITOR_HTTP_METHOD_TRACE, HEALTH_MONITOR_HTTP_METHOD_OPTIONS, HEALTH_MONITOR_HTTP_METHOD_CONNECT, HEALTH_MONITOR_HTTP_METHOD_PATCH) HEALTH_MONITOR_DEFAULT_EXPECTED_CODES = '200' HEALTH_MONITOR_DEFAULT_URL_PATH = '/' TYPE = 'type' URL_PATH = 'url_path' HTTP_METHOD = 'http_method' EXPECTED_CODES = 'expected_codes' DELAY = 'delay' TIMEOUT = 'timeout' MAX_RETRIES = 'max_retries' RISE_THRESHOLD = 'rise_threshold' UPDATE_STATS = 'UPDATE_STATS' UPDATE_HEALTH = 'UPDATE_HEALTH' PROTOCOL_TCP = 'TCP' PROTOCOL_UDP = 'UDP' PROTOCOL_HTTP = 'HTTP' PROTOCOL_HTTPS = 'HTTPS' PROTOCOL_TERMINATED_HTTPS = 'TERMINATED_HTTPS' PROTOCOL_PROXY = 'PROXY' SUPPORTED_PROTOCOLS = (PROTOCOL_TCP, PROTOCOL_HTTPS, PROTOCOL_HTTP, PROTOCOL_TERMINATED_HTTPS, PROTOCOL_PROXY, PROTOCOL_UDP) VALID_LISTENER_POOL_PROTOCOL_MAP = { PROTOCOL_TCP: [PROTOCOL_HTTP, PROTOCOL_HTTPS, PROTOCOL_PROXY, PROTOCOL_TCP], PROTOCOL_HTTP: [PROTOCOL_HTTP, PROTOCOL_PROXY], PROTOCOL_HTTPS: [PROTOCOL_HTTPS, PROTOCOL_PROXY, PROTOCOL_TCP], PROTOCOL_TERMINATED_HTTPS: [PROTOCOL_HTTP, PROTOCOL_PROXY], PROTOCOL_UDP: [PROTOCOL_UDP]} # API Integer Ranges MIN_PORT_NUMBER = 1 MAX_PORT_NUMBER = 65535 DEFAULT_CONNECTION_LIMIT = -1 MIN_CONNECTION_LIMIT = -1 DEFAULT_WEIGHT = 1 MIN_WEIGHT = 0 MAX_WEIGHT = 256 MIN_HM_RETRIES = 1 MAX_HM_RETRIES = 10 # 1 year: y d h m ms MAX_TIMEOUT = 365 * 24 * 60 * 60 * 1000 MIN_TIMEOUT = 0 DEFAULT_TIMEOUT_CLIENT_DATA = 50000 DEFAULT_TIMEOUT_MEMBER_CONNECT = 5000 DEFAULT_TIMEOUT_MEMBER_DATA = 50000 DEFAULT_TIMEOUT_TCP_INSPECT = 0 # Note: The database Amphora table has a foreign key constraint against # the provisioning_status table # Amphora has been allocated to a load balancer AMPHORA_ALLOCATED = 'ALLOCATED' # Amphora is being built AMPHORA_BOOTING = 'BOOTING' # Amphora is ready to be allocated to a load balancer AMPHORA_READY = 'READY' ACTIVE = 'ACTIVE' PENDING_DELETE = 'PENDING_DELETE' PENDING_UPDATE = 'PENDING_UPDATE' PENDING_CREATE = 'PENDING_CREATE' DELETED = 'DELETED' ERROR = 'ERROR' SUPPORTED_PROVISIONING_STATUSES = (ACTIVE, AMPHORA_ALLOCATED, AMPHORA_BOOTING, AMPHORA_READY, PENDING_DELETE, PENDING_CREATE, PENDING_UPDATE, DELETED, ERROR) MUTABLE_STATUSES = (ACTIVE,) DELETABLE_STATUSES = (ACTIVE, ERROR) FAILOVERABLE_STATUSES = (ACTIVE, ERROR) SUPPORTED_AMPHORA_STATUSES = (AMPHORA_ALLOCATED, AMPHORA_BOOTING, ERROR, AMPHORA_READY, DELETED, PENDING_CREATE, PENDING_DELETE) ONLINE = 'ONLINE' OFFLINE = 'OFFLINE' DEGRADED = 'DEGRADED' ERROR = 'ERROR' DRAINING = 'DRAINING' NO_MONITOR = 'NO_MONITOR' OPERATING_STATUS = 'operating_status' PROVISIONING_STATUS = 'provisioning_status' SUPPORTED_OPERATING_STATUSES = (ONLINE, OFFLINE, DEGRADED, ERROR, DRAINING, NO_MONITOR) AMPHORA_VM = 'VM' SUPPORTED_AMPHORA_TYPES = (AMPHORA_VM,) # L7 constants L7RULE_TYPE_HOST_NAME = 'HOST_NAME' L7RULE_TYPE_PATH = 'PATH' L7RULE_TYPE_FILE_TYPE = 'FILE_TYPE' L7RULE_TYPE_HEADER = 'HEADER' L7RULE_TYPE_COOKIE = 'COOKIE' SUPPORTED_L7RULE_TYPES = (L7RULE_TYPE_HOST_NAME, L7RULE_TYPE_PATH, L7RULE_TYPE_FILE_TYPE, L7RULE_TYPE_HEADER, L7RULE_TYPE_COOKIE) L7RULE_COMPARE_TYPE_REGEX = 'REGEX' L7RULE_COMPARE_TYPE_STARTS_WITH = 'STARTS_WITH' L7RULE_COMPARE_TYPE_ENDS_WITH = 'ENDS_WITH' L7RULE_COMPARE_TYPE_CONTAINS = 'CONTAINS' L7RULE_COMPARE_TYPE_EQUAL_TO = 'EQUAL_TO' SUPPORTED_L7RULE_COMPARE_TYPES = (L7RULE_COMPARE_TYPE_REGEX, L7RULE_COMPARE_TYPE_STARTS_WITH, L7RULE_COMPARE_TYPE_ENDS_WITH, L7RULE_COMPARE_TYPE_CONTAINS, L7RULE_COMPARE_TYPE_EQUAL_TO) L7POLICY_ACTION_REJECT = 'REJECT' L7POLICY_ACTION_REDIRECT_TO_URL = 'REDIRECT_TO_URL' L7POLICY_ACTION_REDIRECT_TO_POOL = 'REDIRECT_TO_POOL' SUPPORTED_L7POLICY_ACTIONS = (L7POLICY_ACTION_REJECT, L7POLICY_ACTION_REDIRECT_TO_URL, L7POLICY_ACTION_REDIRECT_TO_POOL) MIN_POLICY_POSITION = 1 # Largest a 32-bit integer can be, which is a limitation # here if you're using MySQL, as most probably are. This just needs # to be larger than any existing rule position numbers which will # definitely be the case with 2147483647 MAX_POLICY_POSITION = 2147483647 # Testing showed haproxy config failed to parse after more than # 53 rules per policy MAX_L7RULES_PER_L7POLICY = 50 # See RFCs 2616, 2965, 6265, 7230: Should match characters valid in a # http header or cookie name. HTTP_HEADER_NAME_REGEX = r'\A[a-zA-Z0-9!#$%&\'*+-.^_`|~]+\Z' # See RFCs 2616, 2965, 6265: Should match characters valid in a cookie value. HTTP_COOKIE_VALUE_REGEX = r'\A[a-zA-Z0-9!#$%&\'()*+-./:<=>?@[\]^_`{|}~]+\Z' # See RFC 7230: Should match characters valid in a header value. HTTP_HEADER_VALUE_REGEX = (r'\A[a-zA-Z0-9' r'!"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~\\]+\Z') # Also in RFC 7230: Should match characters valid in a header value # when quoted with double quotes. HTTP_QUOTED_HEADER_VALUE_REGEX = (r'\A"[a-zA-Z0-9 \t' r'!"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~\\]*"\Z') # Task/Flow constants AMPHORA = 'amphora' FAILED_AMPHORA = 'failed_amphora' FAILOVER_AMPHORA = 'failover_amphora' AMPHORAE = 'amphorae' AMPHORA_ID = 'amphora_id' AMPHORA_INDEX = 'amphora_index' FAILOVER_AMPHORA_ID = 'failover_amphora_id' DELTA = 'delta' DELTAS = 'deltas' HEALTH_MON = 'health_mon' HEALTH_MONITOR = 'health_monitor' LISTENER = 'listener' LISTENERS = 'listeners' LISTENER_ID = 'listener_id' LOADBALANCER = 'loadbalancer' LOADBALANCERS = 'loadbalancers' LOADBALANCER_ID = 'loadbalancer_id' LOAD_BALANCER_ID = 'load_balancer_id' SERVER_GROUP_ID = 'server_group_id' ANTI_AFFINITY = 'anti-affinity' SOFT_ANTI_AFFINITY = 'soft-anti-affinity' MEMBER = 'member' MEMBERS = 'members' MEMBER_ID = 'member_id' COMPUTE_ID = 'compute_id' COMPUTE_OBJ = 'compute_obj' AMP_DATA = 'amp_data' AMPS_DATA = 'amps_data' NICS = 'nics' VIP = 'vip' POOL = 'pool' POOLS = 'pools' POOL_CHILD_COUNT = 'pool_child_count' POOL_ID = 'pool_id' L7POLICY = 'l7policy' L7RULE = 'l7rule' OBJECT = 'object' SERVER_PEM = 'server_pem' UPDATE_DICT = 'update_dict' VIP_NETWORK = 'vip_network' AMPHORAE_NETWORK_CONFIG = 'amphorae_network_config' ADDED_PORTS = 'added_ports' PORTS = 'ports' MEMBER_PORTS = 'member_ports' LOADBALANCER_TOPOLOGY = 'topology' HEALTHMONITORS = 'healthmonitors' HEALTH_MONITOR_ID = 'health_monitor_id' L7POLICIES = 'l7policies' L7POLICY_ID = 'l7policy_id' L7RULES = 'l7rules' L7RULE_ID = 'l7rule_id' LOAD_BALANCER_UPDATES = 'load_balancer_updates' LISTENER_UPDATES = 'listener_updates' POOL_UPDATES = 'pool_updates' MEMBER_UPDATES = 'member_updates' HEALTH_MONITOR_UPDATES = 'health_monitor_updates' L7POLICY_UPDATES = 'l7policy_updates' L7RULE_UPDATES = 'l7rule_updates' TIMEOUT_DICT = 'timeout_dict' REQ_CONN_TIMEOUT = 'req_conn_timeout' REQ_READ_TIMEOUT = 'req_read_timeout' CONN_MAX_RETRIES = 'conn_max_retries' CONN_RETRY_INTERVAL = 'conn_retry_interval' CERT_ROTATE_AMPHORA_FLOW = 'octavia-cert-rotate-amphora-flow' CREATE_AMPHORA_FLOW = 'octavia-create-amphora-flow' CREATE_AMPHORA_FOR_LB_FLOW = 'octavia-create-amp-for-lb-flow' CREATE_HEALTH_MONITOR_FLOW = 'octavia-create-health-monitor-flow' CREATE_LISTENER_FLOW = 'octavia-create-listener_flow' PRE_CREATE_LOADBALANCER_FLOW = 'octavia-pre-create-loadbalancer-flow' CREATE_SERVER_GROUP_FLOW = 'octavia-create-server-group-flow' UPDATE_LB_SERVERGROUPID_FLOW = 'octavia-update-lb-server-group-id-flow' CREATE_LISTENERS_FLOW = 'octavia-create-all-listeners-flow' CREATE_LOADBALANCER_FLOW = 'octavia-create-loadbalancer-flow' CREATE_LOADBALANCER_GRAPH_FLOW = 'octavia-create-loadbalancer-graph-flow' CREATE_MEMBER_FLOW = 'octavia-create-member-flow' CREATE_POOL_FLOW = 'octavia-create-pool-flow' CREATE_L7POLICY_FLOW = 'octavia-create-l7policy-flow' CREATE_L7RULE_FLOW = 'octavia-create-l7rule-flow' DELETE_AMPHORA_FLOW = 'octavia-delete-amphora-flow' DELETE_HEALTH_MONITOR_FLOW = 'octavia-delete-health-monitor-flow' DELETE_LISTENER_FLOW = 'octavia-delete-listener_flow' DELETE_LOADBALANCER_FLOW = 'octavia-delete-loadbalancer-flow' DELETE_MEMBER_FLOW = 'octavia-delete-member-flow' DELETE_POOL_FLOW = 'octavia-delete-pool-flow' DELETE_L7POLICY_FLOW = 'octavia-delete-l7policy-flow' DELETE_L7RULE_FLOW = 'octavia-delete-l7policy-flow' FAILOVER_AMPHORA_FLOW = 'octavia-failover-amphora-flow' LOADBALANCER_NETWORKING_SUBFLOW = 'octavia-new-loadbalancer-net-subflow' UPDATE_HEALTH_MONITOR_FLOW = 'octavia-update-health-monitor-flow' UPDATE_LISTENER_FLOW = 'octavia-update-listener-flow' UPDATE_LOADBALANCER_FLOW = 'octavia-update-loadbalancer-flow' UPDATE_MEMBER_FLOW = 'octavia-update-member-flow' UPDATE_POOL_FLOW = 'octavia-update-pool-flow' UPDATE_L7POLICY_FLOW = 'octavia-update-l7policy-flow' UPDATE_L7RULE_FLOW = 'octavia-update-l7rule-flow' UPDATE_AMPS_SUBFLOW = 'octavia-update-amps-subflow' POST_MAP_AMP_TO_LB_SUBFLOW = 'octavia-post-map-amp-to-lb-subflow' CREATE_AMP_FOR_LB_SUBFLOW = 'octavia-create-amp-for-lb-subflow' GET_AMPHORA_FOR_LB_SUBFLOW = 'octavia-get-amphora-for-lb-subflow' POST_LB_AMP_ASSOCIATION_SUBFLOW = ( 'octavia-post-loadbalancer-amp_association-subflow') MAP_LOADBALANCER_TO_AMPHORA = 'octavia-mapload-balancer-to-amphora' RELOAD_AMPHORA = 'octavia-reload-amphora' CREATE_AMPHORA_INDB = 'octavia-create-amphora-indb' GENERATE_SERVER_PEM = 'octavia-generate-serverpem' UPDATE_CERT_EXPIRATION = 'octavia-update-cert-expiration' CERT_COMPUTE_CREATE = 'octavia-cert-compute-create' COMPUTE_CREATE = 'octavia-compute-create' UPDATE_AMPHORA_COMPUTEID = 'octavia-update-amphora-computeid' MARK_AMPHORA_BOOTING_INDB = 'octavia-mark-amphora-booting-indb' WAIT_FOR_AMPHORA = 'octavia-wait_for_amphora' COMPUTE_WAIT = 'octavia-compute-wait' UPDATE_AMPHORA_INFO = 'octavia-update-amphora-info' AMPHORA_FINALIZE = 'octavia-amphora-finalize' MARK_AMPHORA_ALLOCATED_INDB = 'octavia-mark-amphora-allocated-indb' RELOADLOAD_BALANCER = 'octavia-reloadload-balancer' MARK_LB_ACTIVE_INDB = 'octavia-mark-lb-active-indb' MARK_AMP_MASTER_INDB = 'octavia-mark-amp-master-indb' MARK_AMP_BACKUP_INDB = 'octavia-mark-amp-backup-indb' MARK_AMP_STANDALONE_INDB = 'octavia-mark-amp-standalone-indb' GET_VRRP_SUBFLOW = 'octavia-get-vrrp-subflow' AMP_VRRP_UPDATE = 'octavia-amphora-vrrp-update' AMP_VRRP_START = 'octavia-amphora-vrrp-start' AMP_VRRP_STOP = 'octavia-amphora-vrrp-stop' AMP_UPDATE_VRRP_INTF = 'octavia-amphora-update-vrrp-intf' CREATE_VRRP_GROUP_FOR_LB = 'octavia-create-vrrp-group-for-lb' CREATE_VRRP_SECURITY_RULES = 'octavia-create-vrrp-security-rules' AMP_COMPUTE_CONNECTIVITY_WAIT = 'octavia-amp-compute-connectivity-wait' AMP_LISTENER_UPDATE = 'octavia-amp-listeners-update' GENERATE_SERVER_PEM_TASK = 'GenerateServerPEMTask' # Batch Member Update constants MEMBERS = 'members' UNORDERED_MEMBER_UPDATES_FLOW = 'octavia-unordered-member-updates-flow' UNORDERED_MEMBER_ACTIVE_FLOW = 'octavia-unordered-member-active-flow' UPDATE_ATTRIBUTES_FLOW = 'octavia-update-attributes-flow' DELETE_MODEL_OBJECT_FLOW = 'octavia-delete-model-object-flow' BATCH_UPDATE_MEMBERS_FLOW = 'octavia-batch-update-members-flow' MEMBER_TO_ERROR_ON_REVERT_FLOW = 'octavia-member-to-error-on-revert-flow' DECREMENT_MEMBER_QUOTA_FLOW = 'octavia-decrement-member-quota-flow' MARK_MEMBER_ACTIVE_INDB = 'octavia-mark-member-active-indb' UPDATE_MEMBER_INDB = 'octavia-update-member-indb' DELETE_MEMBER_INDB = 'octavia-delete-member-indb' # Task Names RELOAD_LB_AFTER_AMP_ASSOC = 'reload-lb-after-amp-assoc' RELOAD_LB_AFTER_AMP_ASSOC_FULL_GRAPH = 'reload-lb-after-amp-assoc-full-graph' RELOAD_LB_AFTER_PLUG_VIP = 'reload-lb-after-plug-vip' NOVA_1 = '1.1' NOVA_21 = '2.1' NOVA_3 = '3' NOVA_VERSIONS = (NOVA_1, NOVA_21, NOVA_3) # Auth sections SERVICE_AUTH = 'service_auth' RPC_NAMESPACE_CONTROLLER_AGENT = 'controller' # Build Type Priority LB_CREATE_FAILOVER_PRIORITY = 20 LB_CREATE_NORMAL_PRIORITY = 40 LB_CREATE_SPARES_POOL_PRIORITY = 60 LB_CREATE_ADMIN_FAILOVER_PRIORITY = 80 BUILD_TYPE_PRIORITY = 'build_type_priority' # Active standalone roles and topology TOPOLOGY_SINGLE = 'SINGLE' TOPOLOGY_ACTIVE_STANDBY = 'ACTIVE_STANDBY' ROLE_MASTER = 'MASTER' ROLE_BACKUP = 'BACKUP' ROLE_STANDALONE = 'STANDALONE' SUPPORTED_LB_TOPOLOGIES = (TOPOLOGY_ACTIVE_STANDBY, TOPOLOGY_SINGLE) SUPPORTED_AMPHORA_ROLES = (ROLE_BACKUP, ROLE_MASTER, ROLE_STANDALONE) TOPOLOGY_STATUS_OK = 'OK' ROLE_MASTER_PRIORITY = 100 ROLE_BACKUP_PRIORITY = 90 VRRP_AUTH_DEFAULT = 'PASS' VRRP_AUTH_AH = 'AH' SUPPORTED_VRRP_AUTH = (VRRP_AUTH_DEFAULT, VRRP_AUTH_AH) KEEPALIVED_CMD = '/usr/sbin/keepalived ' # The DEFAULT_VRRP_ID value needs to be variable for multi tenant support # per amphora in the future DEFAULT_VRRP_ID = 1 VRRP_PROTOCOL_NUM = 112 AUTH_HEADER_PROTOCOL_NUMBER = 51 TEMPLATES = '/templates' AGENT_API_TEMPLATES = '/templates' AGENT_CONF_TEMPLATE = 'amphora_agent_conf.template' USER_DATA_CONFIG_DRIVE_TEMPLATE = 'user_data_config_drive.template' OPEN = 'OPEN' FULL = 'FULL' # OPEN = HAProxy listener status nbconn < maxconn # FULL = HAProxy listener status not nbconn < maxconn HAPROXY_LISTENER_STATUSES = (OPEN, FULL) UP = 'UP' DOWN = 'DOWN' # UP = HAProxy backend has working or no servers # DOWN = HAProxy backend has no working servers HAPROXY_BACKEND_STATUSES = (UP, DOWN) DRAIN = 'DRAIN' MAINT = 'MAINT' NO_CHECK = 'no check' # DRAIN = member is weight 0 and is in draining mode # MAINT = member is downed for maintenance? not sure when this happens # NO_CHECK = no health monitor is enabled HAPROXY_MEMBER_STATUSES = (UP, DOWN, DRAIN, MAINT, NO_CHECK) # Current maximum number of conccurent connections in HAProxy. # This is limited by the systemd "LimitNOFILE" and # the sysctl fs.file-max fs.nr_open settings in the image HAPROXY_MAX_MAXCONN = 1000000 # Quota Constants QUOTA_UNLIMITED = -1 MIN_QUOTA = QUOTA_UNLIMITED MAX_QUOTA = 2000000000 API_VERSION = '0.5' NOOP_EVENT_STREAMER = 'noop_event_streamer' HAPROXY_BASE_PEER_PORT = 1025 KEEPALIVED_JINJA2_UPSTART = 'keepalived.upstart.j2' KEEPALIVED_JINJA2_SYSTEMD = 'keepalived.systemd.j2' KEEPALIVED_JINJA2_SYSVINIT = 'keepalived.sysvinit.j2' CHECK_SCRIPT_CONF = 'keepalived_check_script.conf.j2' KEEPALIVED_CHECK_SCRIPT = 'keepalived_lvs_check_script.sh.j2' PLUGGED_INTERFACES = '/var/lib/octavia/plugged_interfaces' HAPROXY_USER_GROUP_CFG = '/var/lib/octavia/haproxy-default-user-group.conf' AMPHORA_NAMESPACE = 'amphora-haproxy' # List of HTTP headers which are supported for insertion SUPPORTED_HTTP_HEADERS = ['X-Forwarded-For', 'X-Forwarded-Port', 'X-Forwarded-Proto'] FLOW_DOC_TITLES = {'AmphoraFlows': 'Amphora Flows', 'LoadBalancerFlows': 'Load Balancer Flows', 'ListenerFlows': 'Listener Flows', 'PoolFlows': 'Pool Flows', 'MemberFlows': 'Member Flows', 'HealthMonitorFlows': 'Health Monitor Flows', 'L7PolicyFlows': 'Layer 7 Policy Flows', 'L7RuleFlows': 'Layer 7 Rule Flows'} NETNS_PRIMARY_INTERFACE = 'eth1' SYSCTL_CMD = '/sbin/sysctl' AMP_ACTION_START = 'start' AMP_ACTION_STOP = 'stop' AMP_ACTION_RELOAD = 'reload' AMP_ACTION_RESTART = 'restart' GLANCE_IMAGE_ACTIVE = 'active' INIT_SYSTEMD = 'systemd' INIT_UPSTART = 'upstart' INIT_SYSVINIT = 'sysvinit' INIT_UNKOWN = 'unknown' VALID_INIT_SYSTEMS = (INIT_SYSTEMD, INIT_SYSVINIT, INIT_UPSTART) INIT_PATH = '/sbin/init' SYSTEMD_DIR = '/usr/lib/systemd/system' SYSVINIT_DIR = '/etc/init.d' UPSTART_DIR = '/etc/init' INIT_PROC_COMM_PATH = '/proc/1/comm' KEEPALIVED_SYSTEMD = 'octavia-keepalived.service' KEEPALIVED_SYSVINIT = 'octavia-keepalived' KEEPALIVED_UPSTART = 'octavia-keepalived.conf' KEEPALIVED_SYSTEMD_PREFIX = 'octavia-keepalivedlvs-%s.service' KEEPALIVED_SYSVINIT_PREFIX = 'octavia-keepalivedlvs-%s' KEEPALIVED_UPSTART_PREFIX = 'octavia-keepalivedlvs-%s.conf' # Authentication KEYSTONE = 'keystone' NOAUTH = 'noauth' TESTING = 'testing' # Amphora distro-specific data UBUNTU_AMP_NET_DIR_TEMPLATE = '/etc/netns/{netns}/network/interfaces.d/' RH_AMP_NET_DIR_TEMPLATE = '/etc/netns/{netns}/sysconfig/network-scripts/' UBUNTU = 'ubuntu' CENTOS = 'centos' # Pagination, sorting, filtering values APPLICATION_JSON = 'application/json' PAGINATION_HELPER = 'pagination_helper' ASC = 'asc' DESC = 'desc' ALLOWED_SORT_DIR = (ASC, DESC) DEFAULT_SORT_DIR = ASC DEFAULT_SORT_KEYS = ['created_at', 'id'] DEFAULT_PAGE_SIZE = 1000 # RBAC LOADBALANCER_API = 'os_load-balancer_api' RULE_API_ADMIN = 'rule:load-balancer:admin' RULE_API_READ = 'rule:load-balancer:read' RULE_API_READ_GLOBAL = 'rule:load-balancer:read-global' RULE_API_WRITE = 'rule:load-balancer:write' RULE_API_READ_QUOTA = 'rule:load-balancer:read-quota' RULE_API_READ_QUOTA_GLOBAL = 'rule:load-balancer:read-quota-global' RULE_API_WRITE_QUOTA = 'rule:load-balancer:write-quota' RBAC_LOADBALANCER = '{}:loadbalancer:'.format(LOADBALANCER_API) RBAC_LISTENER = '{}:listener:'.format(LOADBALANCER_API) RBAC_POOL = '{}:pool:'.format(LOADBALANCER_API) RBAC_MEMBER = '{}:member:'.format(LOADBALANCER_API) RBAC_HEALTHMONITOR = '{}:healthmonitor:'.format(LOADBALANCER_API) RBAC_L7POLICY = '{}:l7policy:'.format(LOADBALANCER_API) RBAC_L7RULE = '{}:l7rule:'.format(LOADBALANCER_API) RBAC_QUOTA = '{}:quota:'.format(LOADBALANCER_API) RBAC_AMPHORA = '{}:amphora:'.format(LOADBALANCER_API) RBAC_PROVIDER = '{}:provider:'.format(LOADBALANCER_API) RBAC_POST = 'post' RBAC_PUT = 'put' RBAC_PUT_FAILOVER = 'put_failover' RBAC_DELETE = 'delete' RBAC_GET_ONE = 'get_one' RBAC_GET_ALL = 'get_all' RBAC_GET_ALL_GLOBAL = 'get_all-global' RBAC_GET_DEFAULTS = 'get_defaults' RBAC_GET_STATS = 'get_stats' RBAC_GET_STATUS = 'get_status' # PROVIDERS # TODO(johnsom) When providers are implemented, this should be removed. OCTAVIA = 'octavia' # FLAVORS # TODO(johnsom) When flavors are implemented, this should be removed. SUPPORTED_FLAVORS = () # systemctl commands DISABLE = 'disable' ENABLE = 'enable' # systemd amphora netns service prefix AMP_NETNS_SVC_PREFIX = 'amphora-netns'
class Parent: def __getitem__(self, idx): return 0 class Child(Parent): def index_super(self, idx): return super()[idx] kid = Child() print(f'kid[0]: {kid[0]}') print(f'kid.index_super(0): {kid.index_super(0)}')
def run_training_loop(): dataset_reader = build_dataset_reader() # These are a subclass of pytorch Datasets, with some allennlp-specific # functionality added. train_data, dev_data = read_data(dataset_reader) vocab = build_vocab(train_data + dev_data) model = build_model(vocab) # This is the allennlp-specific functionality in the Dataset object; # we need to be able convert strings in the data to integers, and this # is how we do it. train_data.index_with(vocab) dev_data.index_with(vocab) # These are again a subclass of pytorch DataLoaders, with an # allennlp-specific collate function, that runs our indexing and # batching code. train_loader, dev_loader = build_data_loaders(train_data, dev_data) # You obviously won't want to create a temporary file for your training # results, but for execution in binder for this guide, we need to do this. with tempfile.TemporaryDirectory() as serialization_dir: trainer = build_trainer( model, serialization_dir, train_loader, dev_loader ) print("Starting training") trainer.train() print("Finished training") # The other `build_*` methods are things we've seen before, so they are # in the setup section above. def build_data_loaders( train_data: torch.utils.data.Dataset, dev_data: torch.utils.data.Dataset, ) -> Tuple[allennlp.data.DataLoader, allennlp.data.DataLoader]: # Note that DataLoader is imported from allennlp above, *not* torch. # We need to get the allennlp-specific collate function, which is # what actually does indexing and batching. train_loader = DataLoader(train_data, batch_size=8, shuffle=True) dev_loader = DataLoader(dev_data, batch_size=8, shuffle=False) return train_loader, dev_loader def build_trainer( model: Model, serialization_dir: str, train_loader: DataLoader, dev_loader: DataLoader ) -> Trainer: parameters = [ [n, p] for n, p in model.named_parameters() if p.requires_grad ] optimizer = AdamOptimizer(parameters) trainer = GradientDescentTrainer( model=model, serialization_dir=serialization_dir, data_loader=train_loader, validation_data_loader=dev_loader, num_epochs=5, optimizer=optimizer, ) return trainer run_training_loop()
class Solution: def peakIndexInMountainArray(self, arr): for i in range(1, len(arr)-1): if arr[i-1] < arr[i] > arr[i+1]: return i """ Success Details Runtime: 76 ms, faster than 62.35% of Python3 online submissions for Peak Index in a Mountain Array. Memory Usage: 15.4 MB, less than 12.58% of Python3 online submissions for Peak Index in a Mountain Array. Next challenges: Find in Mountain Array """
n, m = [int(tmp) for tmp in input().split()] dic = {} for cnt in range(n): k, v = [tmp for tmp in input().split()] dic[k] = v words = input().split() for word in words: if word in dic: print(dic[word], end=' kachal! ') else: print(end='kachal! ')
def is_superset(A, B, count): if A == B or len(A) < len(B): count = count elif A.issuperset(B): count = count + 1 return count if __name__ == "__main__": A = set(map(int, input().split())) # Set A elements n = int(input()) # no. of other sets count = 0 for i in range(n): set_B = set(map(int, input().split())) count = is_superset(A, set_B, count) if count == n: print(True, end="") else: print(False, end="") # Input # 1 2 3 4 5 6 7 8 9 10 11 12 23 45 84 78 # 2 # 1 2 3 4 5 # 100 11 12 # Output # False # Strict superset # Set([1,3,4]) is a strict superset of set([1,3]). # Set([1,3,4]) is not a strict superset of set([1,3,4]). # Set([1,3,4]) is not a strict superset of set([1,3,5]).
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- def go() : return {"id":10, "sequence":"chen"} def go2(a,b,c): return str({"id":b, "sequence":"chen"}) print('chen')
# Starting values (of global variables) def get_response(text): print("") print(text) selection = input() return selection class CoffeeMachine: def __init__(self, w, m, b, c, dollars): self.water = w self.milk = m self.beans = b self.cups = c self.money = dollars def remaining(self): print("") print("The coffee machine has:") print(str(self.water) + " of water") print(str(self.milk) + " of milk") print(str(self.beans) + " of coffee beans") print(str(self.cups) + " of disposable cups") print("$" + str(self.money) + " of money") def enough(self, w, m, b, c): # checks if there is enough stock for sale if self.water - w < 0: return "water" elif self.milk - m < 0: return "milk" elif self.beans - b < 0: return "beans" elif self.cups - c < 0: return "cups" else: return "ok" def buy(self): coffee_type = get_response("What do you want to buy? 1 - espresso, 2 - latte, 3 - cappuccino: ") if coffee_type == "1": # Espresso: resource = self.enough(250, 0, 16, 1) if resource == "ok": self.water -= 250 self.milk -= 0 self.beans -= 16 self.cups -= 1 self.money += 4 print("I have enough resources, making you a coffee!") else: print("Sorry, not enough " + resource + "!") elif coffee_type == "2": # Latte: resource = self.enough(350, 75, 20, 1) if resource == "ok": self.water -= 350 self.milk -= 75 self.beans -= 20 self.cups -= 1 self.money += 7 print("I have enough resources, making you a coffee!") else: print("Sorry, not enough " + resource + "!") elif coffee_type == "3": # Cappuccino: resource = self.enough(200, 100, 12, 1) if resource == "ok": self.water -= 200 self.milk -= 100 self.beans -= 12 self.cups -= 1 self.money += 6 print("I have enough resources, making you a coffee!") else: print("Sorry, not enough " + resource + "!") def fill(self): self.water += int(get_response("Write how many ml of water do you want to add: ")) self.milk += int(get_response("Write how many ml of milk do you want to add: ")) self.beans += int(get_response("Write how many grams of coffee beans do you want to add: ")) self.cups += int(get_response("Write how many disposable cups of coffee do you want to add: ")) def take(self): print("I gave you $" + str(self.money)) self.money = 0 # Main programs command = "" machine = CoffeeMachine(400, 540, 120, 9, 550) while command != "exit": command = get_response("Write action (buy, fill, take, remaining, exit): ") if command == "buy": machine.buy() elif command == "fill": machine.fill() elif command == "take": machine.take() elif command == "remaining": machine.remaining()
def encryptRailFence(text, key): rail = [['\n' for i in range(len(text))] for j in range(key)] dir_down = False row, col = 0, 0 for i in range(len(text)): if (row == 0) or (row == key - 1): dir_down = not dir_down rail[row][col] = text[i] col += 1 if dir_down: row += 1 else: row -= 1 result = [] for i in range(key): for j in range(len(text)): if rail[i][j] != '\n': result.append(rail[i][j]) return("" . join(result)) def decryptRailFence(cipher, key): rail = [['\n' for i in range(len(cipher))] for j in range(key)] dir_down = None row, col = 0, 0 for i in range(len(cipher)): if row == 0: dir_down = True if row == key - 1: dir_down = False rail[row][col] = '*' col += 1 if dir_down: row += 1 else: row -= 1 index = 0 for i in range(key): for j in range(len(cipher)): if ((rail[i][j] == '*') and (index < len(cipher))): rail[i][j] = cipher[index] index += 1 result = [] row, col = 0, 0 for i in range(len(cipher)): # check the direction of flow if row == 0: dir_down = True if row == key-1: dir_down = False if (rail[row][col] != '*'): result.append(rail[row][col]) col += 1 if dir_down: row += 1 else: row -= 1 return("".join(result)) if __name__ == "__main__": s=input("Enter the text:") n=int(input("Key:")) str=encryptRailFence(s, n) print(f"Encrypted Text:{str}") print(f"Decrypted Text:{decryptRailFence(str, n)}")
'''3. Altere o exercício anterior para que a string copiada alterne entre letras maiúsculas e minúsculas Exemplo: se o usuário digitar "latex" o programa deve imprimir "LaTeX".''' frase = 'latex' frase1 = list(frase) nova_frase = [] for i in range(len(frase1)): if i%2==0: nova_frase.append(frase1[i].upper()) if i%2==1: nova_frase.append(frase1[i].lower()) frase = ''.join(nova_frase) print(frase)
array_a = [1, 2, 3, 5] array_b = [4, 6, 7, 8] def merge(array1, array2): idx_a = 0 idx_b = 0 len_a = len(array1) len_b = len(array2) res = [] while True: if array1[idx_a] > array2[idx_b]: res.append(array2[idx_b]) idx_b += 1 else: res.append(array1[idx_a]) idx_a += 1 if idx_a == len_a -1 or idx_b == len_b - 1: break if idx_b == len_b - 1: return res + array1[idx_a:] else: return res + array2[idx_b:] print(merge(array_a, array_b))
class Scenario: def __init__(self, start, end, mmap, dvmap, tc_id: int, park=None, side=0): self.start = start self.end = end self.map = mmap self.ID = str(tc_id) self.park = park self.dvmap = dvmap self.side = side def __str__(self): return str(self.__class__) + ": " + str(self.__dict__)
#!/usr/bin/env python # -*- coding: utf-8 -*- styles_test_suite = { "name": "Border styles tests", "scenarios": [ { "name": "basic border style", "args": ["-b", "basic", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": '''\ +---+---+ | 1 | 2 | +---+---+ | 3 | 4 | | 5 | 6 | +---+---+ ''' }, { "name": "basic2 border style", "args": ["-b", "basic2", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": '''\ +---+---+ | 1 | 2 | +---+---+ | 3 | 4 | +---+---+ | 5 | 6 | +---+---+ ''' }, { "name": "simple border style", "args": ["-b", "simple", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": '''\ 1 2 --- --- 3 4 5 6 ''' }, { "name": "plain border style", "args": ["-b", "plain", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": '''\ ------- 1 2 ------- 3 4 5 6 ''' }, { "name": "dot border style", "args": ["-b", "dot", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": '''\ ......... : 1 : 2 : :...:...: : 3 : 4 : : 5 : 6 : :...:...: ''' }, { "name": "empty border style", "args": ["-b", "empty", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": '''\ 1 2 3 4 5 6 ''' }, { "name": "empty2 border style", "args": ["-b", "empty2", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": '''\ 1 2 3 4 5 6 ''' }, { "name": "solid border style", "args": ["-b", "solid", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": u'''\ ┌───┬───┐ │ 1 │ 2 │ ├───┼───┤ │ 3 │ 4 │ │ 5 │ 6 │ └───┴───┘ ''' }, { "name": "solid_round border style", "args": ["-b", "solid_round", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": u'''\ ╭───┬───╮ │ 1 │ 2 │ ├───┼───┤ │ 3 │ 4 │ │ 5 │ 6 │ ╰───┴───╯ ''' }, { "name": "nice border style", "args": ["-b", "nice", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": u'''\ ╔═══╦═══╗ ║ 1 ║ 2 ║ ╠═══╬═══╣ ║ 3 ║ 4 ║ ║ 5 ║ 6 ║ ╚═══╩═══╝ ''' }, { "name": "double border style", "args": ["-b", "double", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": u'''\ ╔═══╦═══╗ ║ 1 ║ 2 ║ ╠═══╬═══╣ ║ 3 ║ 4 ║ ║ 5 ║ 6 ║ ╚═══╩═══╝ ''' }, { "name": "double2 border style", "args": ["-b", "double2", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": u'''\ ╔═══╤═══╗ ║ 1 │ 2 ║ ╠═══╪═══╣ ║ 3 │ 4 ║ ╟───┼───╢ ║ 5 │ 6 ║ ╚═══╧═══╝ ''' }, { "name": "bold border style", "args": ["-b", "bold", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": u'''\ ┏━━━┳━━━┓ ┃ 1 ┃ 2 ┃ ┣━━━╋━━━┫ ┃ 3 ┃ 4 ┃ ┃ 5 ┃ 6 ┃ ┗━━━┻━━━┛ ''' }, { "name": "bold2 border style", "args": ["-b", "bold2", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": u'''\ ┏━━━┯━━━┓ ┃ 1 │ 2 ┃ ┣━━━┿━━━┫ ┃ 3 │ 4 ┃ ┠───┼───┨ ┃ 5 │ 6 ┃ ┗━━━┷━━━┛ ''' }, { "name": "frame border style", "args": ["-b", "frame", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": u'''\ ▛▀▀▀▀▀▀▀▜ ▌ 1 ┃ 2 ▐ ▌━━━╋━━━▐ ▌ 3 ┃ 4 ▐ ▌ 5 ┃ 6 ▐ ▙▄▄▄▄▄▄▄▟ ''' }, { "name": "frame border style (long option)", "args": ["--border=frame", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": u'''\ ▛▀▀▀▀▀▀▀▜ ▌ 1 ┃ 2 ▐ ▌━━━╋━━━▐ ▌ 3 ┃ 4 ▐ ▌ 5 ┃ 6 ▐ ▙▄▄▄▄▄▄▄▟ ''' }, { "name": "incorrect border style", "args": ["-b", "abraCadabra", "--header=0"], "input": '''\ 1,2 3,4 5,6 ''' , "output": "fort: error: Invalid border style\n", "exitCode": 1 }, ]}
# 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 RefreshTask(object): def __init__(self, createDate=None, failed=None, success=None, taskId=None, id=None, retryStatus=None, taskStatus=None, taskType=None, urlTasks=None): """ :param createDate: (Optional) 任务创建时间,UTC时间 :param failed: (Optional) 任务失败率 :param success: (Optional) 任务成功率 :param taskId: (Optional) 刷新预热的任务id :param id: (Optional) 数据库表id :param retryStatus: (Optional) 重试状态(unretry:不重试,retry:重试) :param taskStatus: (Optional) 任务状态(running:执行中,success:成功,failed:失败) :param taskType: (Optional) 刷新预热类型,(url:url刷新,dir:目录刷新,prefetch:预热) :param urlTasks: (Optional) 详细的任务 """ self.createDate = createDate self.failed = failed self.success = success self.taskId = taskId self.id = id self.retryStatus = retryStatus self.taskStatus = taskStatus self.taskType = taskType self.urlTasks = urlTasks
""" entradas contraseña-->c-->int salidas acceso permitido-->str clave invalida-->str """ while True: c=int(input("")) #entradas if(c==2002): print("Acesso permitido") #salidas break else: print("Senha invalida") #salidas
# # All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or # its licensors. # # For complete copyright and license terms please see the LICENSE at the root of this # distribution (the "License"). All use of this software is governed by the License, # or, if provided, by the license below or the license accompanying this file. Do not # remove or modify any license notices. This file is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # def message(e): # type: (Exception) -> str """ Gets the 'message' from an exception """ # If we want the message, check if it exists # Supports Python2 # # For python 3 call str will grab the message if hasattr(e, 'message'): return e.message else: return str(e)
# Loops # Loops are repeating segments of code, and come in two types, while and for. Lets start with a "for" loop. # "for" loops can be expressed in the following manner: for i in range(0, 9): print(i) # For loops work by repeating until the loop has executed a specific number of times, or until all values in a data # structure have been accessed. We will touch more on using for loops with data structures later in this lesson. But # first, lets dissect what this code segment is doing. # We first see the characters "for", which indicate to the computer that the following code will be a for loop. # The next part of the code is known as the "iterable", and in this example, every time the code is run it will be # increased in value by one. # Following the iterable, we see what looks like a function, and it is! Don't worry about what it is too much, all # you need to know right now is that it sets the range for this function, meaning that it sets the starting value, and # the value at which the for loop will terminate at. This value is stored in the iterable "i". In the above example, the # loop will stop when i reaches the value of 9, not before or after, but exactly on. This is checked at the start of # each loop execution ("iteration"). # What follows the semicolon is what action the for loop will perform, in this case, it will simply print the current # value of i. This value will increase with each iteration of the loop. i is increased by one at the end of each # iteration. # If you have a keen eye, you may have noticed that the loop only goes from zero to eight! You may think this is a # bug, as (0, 9) is clearly specified as the range for the function, but you must remember lesson zero and how loops # work. The value starts at zero, which is printed to console, and terminates at 9, which is checked at the beginning # of each iteration. This means that nine would never be printed, as nine is the number at which the loop terminates at. # If you count how many numbers are printed to console, you'll also notice nine numbers are there, since you began # counting at zero. exampleList = [ "This", "Is", "a", "Demonstration" ] for i in exampleList: print(i) # In this loop, you'll see we have dropped range() in favor of a list! This means that the loop will execute until # every value in the loop becomes "i". Since we are calling print() for each value, all of the strings stored inside # the list will be printed to console. You can do many advanced things with this, as you will soon learn. # While loops condition = True while condition: print("Success") condition = False # While loops are a form of conditional statement, and will only run while the condition being checked against is # True (by default), or anything you change it to. Many of the ways to interact with standard conditional statements # also apply to while loops. condition = False while not condition: print("Success") condition = True # And of course, strings work too! exampleString = "rain" while exampleString == "rain": print("Success") exampleString = "water" # While loops are important, because they have no definite end. You may need to execute one block of code until a # certain condition is met, for example, in web scraping, you may check a website until you find a certain block # of text. You may also want to use while loops in user interfaces to continually ask questions, or to keep a certain # block of code running in order to continually execute your program. # To finish this lesson, try out both kinds of loops for yourself! Feel free to ask any questions.
# Given an integer array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3].... # # You may assume the input array always has a valid answer. def wiggleSort(nums): nums.sort() mid = (len(nums) + 1) // 2 left, right = nums[:mid], nums[mid:] nums[::2] = left[::-1] nums[1::2] = right[::-1] nums = [1,3,2,2,3,1] wiggleSort(nums) print(nums)
""" File: weather_master.py Name: HJ ----------------------- This program should implement a console program that asks weather data from user to compute the average, highest, lowest, cold days among the inputs. Output format should match what is shown in the sample run in the Assignment 2 Handout. """ QUIT = -100 def main(): """ This program print the highest, lowest, and average temperature by computing the users inputs. """ print("standCode \"Weather Master 4.0") data = int(input('Next Temperature: (or '+str(QUIT)+' to quit)? ')) if data == QUIT: # filter the first input is QUIT print('No temperatures were entered.') else: high_temp = data low_temp = data total_temp = data days = 1 cold_days = 0 if data < 16: # whether the first input is below 16 degree cold_days += 1 while True: data = int(input('Next Temperature: (or ' + str(QUIT) + ' to quit)? ')) if data == QUIT: # leave the loop if QUIT number is entered break if data > high_temp: high_temp = data if data < low_temp: low_temp = data if data < 16: cold_days += 1 total_temp += data days += 1 print('Highest temperature = '+str(high_temp)) print('Lowest temperature = '+str(low_temp)) print('Average = '+str(total_temp/days)) print(str(cold_days)+' cold day(s)') ###### DO NOT EDIT CODE BELOW THIS LINE ###### if __name__ == "__main__": main()
""" LC 127 A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that: Every adjacent pair of words differs by a single letter. Every si for 1 <= i <= k is in wordList. Note that beginWord does not need to be in wordList. sk == endWord Given two words, beginWord and endWord, and a dictionary wordList, return the number of words in the shortest transformation sequence from beginWord to endWord, or 0 if no such sequence exists. Example 1: Input: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"] Output: 5 Explanation: One shortest transformation sequence is "hit" -> "hot" -> "dot" -> "dog" -> cog", which is 5 words long. Example 2: Input: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log"] Output: 0 Explanation: The endWord "cog" is not in wordList, therefore there is no valid transformation sequence. """ class Solution: def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int: if endWord not in wordList: return 0 wordList.append(beginWord) wordList = set(wordList) self.word_set = wordList level = deque([beginWord]) cnt = 1 while level: cnt += 1 for _ in range(len(level)): for c in self.n2c(level.popleft()): if c == endWord: return cnt level.append(c) return 0 def n2c(self, s1): for i in range(len(s1)): for k in map(chr, range(ord('a'), ord('z') + 1)): if k == s1[i]: continue s2 = s1[:i] + k + s1[i + 1:] if s2 not in self.word_set: continue self.word_set.remove(s2) yield s2 """ Time O(L^2 * N) Space O(LN) """
l = [1,2,3,4,5] print(l) def mul_by2(num): return num*2 for result in map(mul_by2,l): print(result)
new_npc_stats = { 'base_stats': { 'vit': 4, 'dex': 4, 'str': 4, 'int': 4, 'agility': 8, 'toughness': 9, }, 'stats': { 'max_hp': 'from vit', # vit*hp_per_vit + lvl*hp_per_lvl 'max_mana': 'from int?', 'armor': 'from str and toughness', 'magic_resistance': 'from toughness', # and int? 'speed': 'from dex and agility', 'dodge': 'from dex and speed', 'crit_chance': 'from dex', 'crit_dmg': 'from dex', }, 'storage': { 'equipped items': 'armor, weapons, ...', 'spell book': 'spells / abilities', 'potions': '', # in party? 'party': 'party instance' }, 'tracked_values': { 'ct': 1000, # when c reaches this, unit gets a turn 'c': 0, # holds current charge value - +speed each clock tick in battle 'status_effects': [], 'elemental_resistance': 0, # from items (and toughness?) 'hp': '', 'mana': '', } }
"""Custom shna errors.""" class ShnaError(Exception): """Custom shna exception class.""" pass
#합 '''n이 주어졌을 때, 1부터 n까지 합을 구하는 프로그램을 작성하시오. 첫째 줄에 n (1 ≤ n ≤ 10,000)이 주어진다. 1부터 n까지 합을 출력한다.''' a = input() a = int(a) result = 0 for i in range(1,a+1): result += i print(result) #################################### b = input() b = int(b) result = int(((b+1)*b)/2) print(result)
#Create a function that accept a name and return reverse of this def reverse_name(a): reverse = "" for i in a: reverse = i + reverse return reverse name = input("Enter the NAME ") result = reverse_name(name) print("\nThe Reverse name is", result.title())
print('=' * 12 + 'Desafio 93' + '=' * 12) jogador = dict() jogador['Nome'] = input('Digite o nome do jogador: ') jogador['Gols'] = list() partidas = int(input(f'Quantas partidas {jogador["Nome"]} jogou? ')) total = 0 for c in range(partidas): qtde = int(input(f'Gols na partida {c + 1}: ')) total += qtde jogador['Gols'].append(qtde) jogador['Total'] = total print('\nInformações do dicionário:') for c, v in jogador.items(): print(f'{c}: {v}') print('\nDetalhes:') print(f'O jogador {jogador["Nome"]} disputou {partidas} partidas:') for c, v in enumerate(jogador['Gols']): print(f' Partida {c + 1} => {v} gols') print(f'O total de gols marcados por {jogador["Nome"]} foi {jogador["Total"]}.')
class InvalidInputsError(Exception): """ Raised during :class:`Service`'s :meth:`service_clean` method. Encapsulates both field_errors and non_field_errors into a single entity. :param dictionary errors: :class:`Services`'s ``errors`` dictionary :param dictionary non_field_errors: :class:`Service`'s ``non_field_errors`` dictionary """ def __init__(self, errors, non_field_errors): self.errors = errors self.non_field_errors = non_field_errors def __repr__(self): return '{}({}, {})'.format( type(self).__name__, repr(self.errors), repr(self.non_field_errors))
""" Ethereum Constantinople Hardfork ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The Seventh Ethereum hardfork. """ MAINNET_FORK_BLOCK = 7280000 CHAIN_ID = 1
""" DESAFIO 095: Aprimorando os Dicionários Aprimore o DESAFIO 093 para que ele funcione com vários jogadores, incluindo um sistema de visualização de detalhes do aproveitamento de cada jogador. """ div = '-' * 35 div2 = '-' * 44 jogador = dict() jogadores = list() qtdgols = list() totgols = 0 while True: print(div) jogador['nome'] = str(input('Nome do Jogador: ')) partidas = int(input(f'Quantas partidas {jogador["nome"]} jogou? ')) for p in range(partidas): gol = int(input(f'Quantos gols na partida {p + 1}? ')) qtdgols.append(gol) totgols += gol jogador['gols'] = qtdgols[:] jogador['total'] = totgols jogadores.append(jogador.copy()) totgols = 0 qtdgols.clear() continuar = str(input('Quer continuar [S/N]? ')).upper().strip()[0] if 'N' in continuar: break print(div2) print(f'{" CÓD":<5}', end=' ') print(f'{"NOME":<15}', end=' ') print(f'{"GOLS":<15}', end=' ') print(f'{"TOTAL":<7}', end=' ') print() print(div2) for i, j in enumerate(jogadores): print(f'{i + 1:>4}', end=' ') print(f' {j["nome"]:<15}', end=' ') print(f'{str(j["gols"]):<15}', end=' ') print(f'{j["total"]:<7}', end=' ') print() print(div2) while True: mostrar = int(input('Mostrar dados de qual jogador (digite 999 para encerrar o programa)? ')) if mostrar == 999: break elif mostrar > len(jogadores) or mostrar <= 0: print(f'ERRO! Não existe jogador com código {mostrar}! Tente novamente.') else: print(f'-- Levantamento do Jogador {jogadores[mostrar - 1]["nome"]}:') for i, j in enumerate(jogadores[mostrar - 1]["gols"]): if j == 1: leg_gols = 'gol' else: leg_gols = 'gols' print(f' No jogo {i + 1} fez {j} {leg_gols}.') print(div2) print('<< VOLTE SEMPRE >>')
""" 0796. Rotate String We are given two strings, A and B. A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example, if A = 'abcde', then it will be 'bcdea' after one shift on A. Return True if and only if A can become B after some number of shifts on A. Example 1: Input: A = 'abcde', B = 'cdeab' Output: true Example 2: Input: A = 'abcde', B = 'abced' Output: false Note: A and B will have length at most 100. """ class Solution: def rotateString(self, A: str, B: str) : if len(A) != len(B): return False elif not A and not B : return True else: for i in range(len(A)): if A[i:]+A[:i] == B: return True return False class Solution: def rotateString(self, A: str, B: str): if len(A) != len(B): return False elif not A and not B : return True else: if A in B*2: return True return False class Solution: def rotateString(self, A: str, B: str): return (len(A) == len(B)) and (B in A*2)
def generate(n, diff, left, right): if n > 9: return if n and (2 * abs(diff) <= n): if n == 1: generate(n - 1, diff, left, "0" + right) generate(n - 1, diff, left, "1" + right) if left != "": generate(n - 2, diff, left + "0", right + "0") generate(n - 2, diff - 1, left + "0", right + "1") generate(n - 2, diff, left + "1", right + "1") generate(n - 2, diff + 1, left + "1", right + "0") if n == 0 and diff == 0: print(left + right) generate(int(input()), 0, "", "")
#!/usr/bin/python3 # coding=utf-8 class LoopNotFoundError(Exception): def __init__(self, message): super().__init__(message)
class Solution: def balancedStringSplit(self, s: str) -> int: l=0 r=1 k=0 while r<len(s)+1: print(s[l:r]) if s[l:r].count("L") == s[l:r].count("R"): k=k+1 l=r r=r+1 r=r+1 return k
def for_c(): """ Lower case Alphabet letter 'c' pattern using Python for loop""" for row in range(4): for col in range(4): if col==0 and row%3!=0 or col>0 and row%3==0: print('*', end = ' ') else: print(' ', end = ' ') print() def while_c(): """ Lower case Alphabet letter 'c' patter using Python while loop""" row = 0 while row<4: col = 0 while col<4: if col==0 and row%3!=0 or col>0 and row%3==0: print('*', end = ' ') else: print(' ', end = ' ') col += 1 print() row += 1
# Zaimplementować funkcję factorial(n: int) -> int, która zwróci silnię wartości przekazanej w parametrze def factorial(n: int): if n==0: return 1 else: return n*factorial(n-1) print(factorial(5))
class Solution: def climbStairs(self, n: int) -> int: dp = [0] * (n + 1) dp[0] = 1 weights = [1, 2] for i in range(n + 1): for j in weights: if i >= j: dp[i] += dp[i-j] return dp[n]
def _first_available(color_list): """ (https://en.wikipedia.org/wiki/Greedy_coloring) Return smallest non-negative integer not in the given list of colors. :param color_list: List of neighboring nodes colors :type color_list: list of int :rtype: int """ color_set = set(color_list) count = 0 while True: if count not in color_set: return count count += 1 def get_heuristic(G): """ Greedy colouring heuristic (explanation and code: https://en.wikipedia.org/wiki/Greedy_coloring) :param G: an :py:class:`~graphilp.imports.ilpgraph.ILPGraph` :return: two dictionaries: {color_1:[list_of_color_1_nodes], ...} and {node_1:color_of_node_1, ...} """ nodes = G.G.nodes() node_to_col = {} col_to_node = {} for node in nodes: neighbor_colors = [node_to_col.get(neigh_node) for neigh_node in G.G.neighbors(node)] node_color = _first_available(neighbor_colors) node_to_col[node] = node_color if node_color not in col_to_node: col_to_node[node_color] = [node] else: col_to_node.get(node_color).append(node) return col_to_node, node_to_col
########################################### # Glyph position table for buzzard.py ########################################### # TYPEFACE: Roboto # All glyphs' y-min is set on the baseline # All glyphs' x-pos is monospace default # Entries in this table are complex numbers # where the real component is added to the # x position of the glyph and the imaginary # component is added to the y position ########################################### glyphPos = { "g": -5+35j, "j": 5+40j, "l": -5+0j, "p": 0+40j, "q": 0+40j, "y": 0+40j, "B": -5+0j, "Q": 0+20j, "1": -15+0j, "_": 0+0j, "-": 0-55j, "*": 0-65j, "#": 0+0j, "$": 0+15j, "^": 0-90j, "~": 0-90j, "+": 0-25j, "=": 0-35j, "?": 0+0j, ";": 0+25j, ",": 0+25j, "'": 0-80j, "\"": 0+0j, "(": 0+30j, ")": 0+30j, "<": 0+0j, ">": 0+0j, "{": 0+30j, "}": 0+30j, "[": 0+30j, "]":0+30j, "|": 0+30j, "\\": 0+0j, "/": 0+0j, "²": 0-60j } spaceDistance = 50
class Solution: def permuteUnique(self, nums: List[int]) -> List[List[int]]: marked = [False] * len(nums) ans = [] self.dfs(sorted(nums), marked, [], ans) return ans def dfs(self, nums, marked, path, ans): if len(path) == len(nums): ans.append(list(path)) return for i in range(len(nums)): if i > 0 and nums[i] == nums[i-1] and not marked[i-1]: continue if marked[i]: continue marked[i] = True path.append(nums[i]) self.dfs(nums, marked, path, ans) marked[i] = False path.pop()
def hasFront(arr,r,c,i,j): if(i-1 >= 0): return arr[i-1][j] == arr[i][j] return False def hasBack(arr,r,c,i,j): if(i+1 < r): return arr[i+1][j] == arr[i][j] return False def hasLR(arr,r,c,i,j): if(j+1 < c): if(arr[i][j+1] == arr[i][j]): return True if(j-1 >= 0): if(arr[i][j-1] == arr[i][j]): return True return False def hasDiagonal(arr,r,c,i,j): if(i-1 >=0 and j-1 >=0): if(arr[i-1][j-1] == arr[i][j]): return True if(i+1 < r and j+1 < c): if(arr[i+1][j+1] == arr[i][j]): return True if(i-1 >=0 and j+1 < c): if(arr[i-1][j+1] == arr[i][j]): return True if(i+1 < r and j-1 >= 0): if(arr[i+1][j-1] == arr[i][j]): return True return False r = int(input('Enter # of rows:')) c = int(input('Enter # of columns:')) print('-Enter the student arrangement-') arr = [] for _ in range(r): arr.append([e for e in input().split()]) result = [] for _ in range(r): result.append([0.0 for i in range(c)]) for i in range(r): for j in range(c): if(hasFront(arr,r,c,i,j)): result[i][j] += 0.3 if(hasBack(arr,r,c,i,j)): result[i][j] += 0.2 if(hasLR(arr,r,c,i,j)): result[i][j] += 0.2 if(hasDiagonal(arr,r,c,i,j)): result[i][j] += 0.025 for e in result: print(e)
__author__ = 'Xavier Bruhiere' __copyright__ = 'Xavier Bruhiere' __licence__ = 'Apache 2.0' __version__ = '0.0.2'
class Sim: def __init__(self, fish: list[int]): self.fish = fish def step(self): fish = self.fish for i in range(len(self.fish)): if fish[i] == 0: fish.append(8) fish[i] = 7 fish[i] -= 1 if __name__ == "__main__": with open("input.txt") as file: raw_input_data = file.read() with open("example.txt") as file: raw_example_data = file.read() # A variable used to choose which one of the two to use # Example data is used to see if the code works use_example_data = False if use_example_data: raw_data = raw_example_data else: raw_data = raw_input_data data = [int(fish) for fish in raw_data.split(",")] simulation = Sim(data) for i in range(80): simulation.step() print("Total: {}".format(len(simulation.fish)))
""" 1 3 5 1 3 3 5 | arr[L..R] > s | L R --------------- l r -------- """ n, r = [int(x) for x in input().split()] arr = [int(x) for x in input().split()] def two_pointer(arr,k): l = 0 N = len(arr) count = 0 for r in range(N): while arr[r] - arr[l] > k: l += 1 count += l return count ans = two_pointer(arr, r) print(ans)
# Uses python3 def get_change_naive(m): count = m // 10 m %= 10 count += m // 5 m %= 5 count += m // 1 return count def get_change_greedy(m): #write your code here change, count = 0, 0 coins = [1, 5, 10] index = len(coins) - 1 while change < m: while (change <= m and (m - change) >= coins[index]): change += coins[index] count += 1 index -= 1 return count if __name__ == '__main__': m = int(input()) print(get_change_greedy(m))
""" :mod:`refcount` =============== A simple library for providing a reference counter with optional acquire/release callbacks as well as access protection to reference counted values. .. moduleauthor:: Paul Mundt <paul.mundt@adaptant.io> """ # pylint: disable=unnecessary-pass class UnderflowException(Exception): """ Reference counter underflow exception, raised on counter underflow. >>> from refcount import Refcounter >>> ref = Refcounter() >>> ref.dec() >>> ref.usecount 0 >>> ref.dec() # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): refcount.UnderflowException: refcount underflow """ pass class Refcounter: """ Provides a reference counter with an optional release callback that is triggered when the last user drops off. """ def __init__(self, usecount=1, acquire=None, release=None): """ Initialize a reference counter :param usecount: Initial refcount value :type usecount: int :param acquire: A callback function that is called when a reference count goes above 0 :type acquire: function, optional :param release: A callback function that is called when the reference count drops to 0 :type release: function, optional """ self._usecount = usecount self._acquire = acquire self._release = release def add(self, value): """ Add to a reference count If the reference count becomes higher than 0, the acquire callback (if provided) will be automatically triggered. >>> from refcount import Refcounter >>> ref = Refcounter() >>> ref.add(2) >>> ref.usecount 3 :param value: Amount to add :type value: int """ if self._usecount == 0 and self._acquire: self._usecount += value self._acquire() else: self._usecount += value def add_not_zero(self, value): """ Add to a reference count unless it is 0 >>> from refcount import Refcounter >>> ref = Refcounter() >>> ref.dec() >>> ref.usecount 0 >>> ref.add_not_zero(2) False :param value: Amount to add :type value: int :return: False if refcount is 0, True otherwise """ if self._usecount == 0: return False self.add(value) return True def inc(self): """ Increment reference count by 1 If the reference count becomes higher than 0, the acquire callback (if provided) will be automatically triggered. >>> from refcount import Refcounter >>> ref = Refcounter() >>> ref.usecount 1 >>> ref.inc() >>> ref.usecount 2 """ self.add(1) def inc_not_zero(self): """ Increment a reference by 1 unless it is 0 >>> from refcount import Refcounter >>> ref = Refcounter() >>> ref.dec() >>> ref.usecount 0 >>> ref.inc_not_zero() False :return: False if refcount is 0, True otherwise """ if self._usecount == 0: return False self.inc() return True def sub(self, value): """ Subtract from a reference count >>> from refcount import Refcounter >>> ref = Refcounter(usecount=3) >>> ref.usecount 3 >>> ref.sub(2) >>> ref.usecount 1 If the reference count drops to 0, the release callback (if provided) will be automatically triggered. :param value: Amount to subtract :type value: int :raises UnderflowException: refcount underflow """ if self._usecount - value < 0: raise UnderflowException('refcount underflow') self._usecount -= value if self._usecount == 0 and self._release is not None: self._release() def sub_and_test(self, value): """ Subtract reference count and test if the reference count is 0 This can be used by code that wishes to implement a cleanup path triggered only when the reference count drops to 0. If the reference count drops to 0, the release callback (if provided) will be automatically triggered. >>> from refcount import Refcounter >>> ref = Refcounter() >>> ref.inc() >>> if ref.sub_and_test(2): ... print('reference count is now 0') reference count is now 0 :param value: Amount to subtract :type value: int :return: True if reference count is 0, otherwise False :rtype: bool :raises UnderflowException: refcount underflow """ self.sub(value) return self._usecount == 0 def dec(self): """ Decrement reference count by 1 If the reference count drops to 0, the release callback (if provided) will be automatically triggered. >>> from refcount import Refcounter >>> def refcount_released(): ... print('no more users') >>> ref = Refcounter(release=refcount_released) >>> ref.inc() >>> ref.dec() >>> ref.dec() no more users :raises UnderflowException: refcount underflow """ self.sub(1) def dec_and_test(self): """ Decrement reference count and test if the reference count is 0 This can be used by code that wishes to implement a cleanup path triggered only when the reference count drops to 0. If the reference count drops to 0, the release callback (if provided) will be automatically triggered. >>> from refcount import Refcounter >>> ref = Refcounter() >>> if ref.dec_and_test(): ... print('reference count is now 0') reference count is now 0 :return: True if reference count is 0, otherwise False :rtype: bool :raises UnderflowException: refcount underflow """ self.dec() return self._usecount == 0 @property def usecount(self): """ Read/write the reference count >>> from refcount import Refcounter >>> ref = Refcounter() >>> ref.usecount 1 >>> ref.inc() >>> ref.usecount 2 >>> ref.usecount = 4 >>> ref.usecount 4 :return: Current reference count :rtype: int """ return self._usecount @usecount.setter def usecount(self, value): self._usecount = value class RefcountedValue(Refcounter): """ Provides access protection to a reference counted value. Allows the reference counting for a value to be arbitrarily incremented and decremented, permitting access to the protected value so long as a valid reference count is held. Once the reference count has dropped to 0, continued references will raise a NameError exception. A release callback method may optionally be provided, and will be called as soon as the last remaining reference is dropped. """ def __init__(self, value, usecount=1, acquire=None, release=None): """ Initialize a reference counted value :param value: The protected reference counted value :type value: Any :param usecount: Initial refcount value :type usecount: int :param acquire: A callback function that is called when a reference count goes above 0 :type acquire: function, optional :param release: A callback function that is called when the reference count drops to 0 :type release: function, optional """ self._value = value super().__init__(usecount=usecount, acquire=acquire, release=release) @property def value(self): """ Reference count protected value Allows access to the protected value as long as a valid reference count is held. >>> from refcount import RefcountedValue >>> ref = RefcountedValue(value=True) >>> ref.value True >>> ref.dec() >>> ref.value # doctest: +IGNORE_EXCEPTION_DETAIL Traceback (most recent call last): NameError: Value referenced with no reference count :return: value :raises NameError: Value referenced with no reference count """ if self._usecount == 0: raise NameError('Value referenced with no reference count') return self._value @value.setter def value(self, value): if self._usecount == 0: raise NameError('Value referenced with no reference count') self._value = value
class Solution: def rangeSumBST(self, root, L, R): return self.inorder(root, 0, L, R) def inorder(self,root, value, L, R): if root: value = self.inorder(root.left, value, L, R) if root.val >= L and root.val <= R: value += root.val value = self.inorder(root.right, value, L, R) return value
# def make_multiple(n): # def multiply(x): # print(f'{x} * {n} is ', x * n) # return multiply # times_three = make_multiple(3) # times_five = make_multiple(5) # del make_multiple # times_three(10) # == make_multiple(3)(10) # print('Closure of make_multiple', make_multiple.__closure__) # print('Closure of times_three', times_three.__closure__[0].cell_contents) # print('Closure of times_five', times_five.__closure__) # times_five(100) # times_five(10) # times_three(20) def add_discount(promo=100): print('In function that returns decorator') def inner(func): print('In decorator') def discounted(user, money): print('closure for: ', func.__name__) return func(user, money * (promo / 100)) # return value is the return value of `func` return discounted # return value is closure return inner # return value is decorator # decorator = add_discount(promo=20) # print('after add_discount return value') # pay_phone = decorator(pay_phone) # @shano @add_discount(promo=20) def pay_phone(user, money): print('phone', user, money) # @add_discount() # def pay_net(user, money): # print('net', user, money) print('Before pay_phone is called') pay_phone('marto', 100) # pay_net('marto', 100)
# 최초 답안 # 코드를 보면 말도 안되는 수준 ^^;; def check_pal(n): num = str(n) for i in range(len(num)//2): if num[i] == num[len(num)-1-i]: pass else: return False print(num) return True def reverse(n): s = '' num = str(n) for ch in reversed(num): s += ch return int(s) def func(n): return int(n) + reverse(n) n = int(input()) d = [] def main(n): for i in range(3): if i == 0: d.append(n + reverse(n)) if check_pal(d[i]): print(d[i]) return True else: d.append(func(d[i-1])) if not main(n): print(-1)
macro_caller = ''' <div class="table"> <a id="calling_table"></a> <p class="title">Calling Table</p> <div class="table-contents"> <table frame="box" rules="all"> <thead> </thead> <tbody> <tr> <td><p><span>Include <a href="https://somelink.com/thispage.html#macro"></a></span></p></td> </tr> </tbody> </table> </div> </div> ''' macro_callee = ''' <div class="table"> <a id="macro"></a> <p class="title">Called Table</p> <div class="table-contents"> <table frame="box" rules="all"> <thead> </thead> <tbody> <tr> <td>Useful Information</td> </tr> </tbody> </table> </div> </div> ''' divlist = ''' <div class="table"> <a id="tbl1"></a> <p class="title">tbl1</p> <div class="table-contents"> <table frame="box" rules="all"> <thead> </thead> <tbody> <tr> <td>Useful Information</td> </tr> </tbody> </table> </div> </div> <div class="table"> <a id="tbl2"></a> <p class="title">tbl2</p> <div class="table-contents"> <table frame="box" rules="all"> <thead> </thead> <tbody> <tr> <td>Useful Information</td> </tr> </tbody> </table> </div> </div> <div class="table"> <a id="tbl3"></a> <p class="title">tbl3</p> <div class="table-contents"> <table frame="box" rules="all"> <thead> </thead> <tbody> <tr> <td>Useful Information</td> </tr> </tbody> </table> </div> </div> ''' cr_iod_section = ''' <div class="section"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"> <a id="sect_A.2" shape="rect"></a>A.2&nbsp;Computed Radiography Image IOD</h2> </div> </div> </div> <div class="section"> <div class="titlepage"> <div> <div> <h3 class="title"> <a id="sect_A.2.1" shape="rect"></a>A.2.1&nbsp;CR Image IOD Description</h3> </div> </div> </div> <p> <a id="para_d1de8bb0-9b4c-4318-839e-e466a8e3de2e" shape="rect"></a>The Computed Radiography (CR) Image Information Object Definition specifies an image that has been created by a computed radiography imaging device.</p> <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Note</h3> <p> <a id="para_f15c3af6-cfd3-4764-ba54-1674fe6f3602" shape="rect"></a>Digital Luminescence Radiography is an equivalent term for computed Radiography.</p> </div> </div> <div class="section"> <div class="titlepage"> <div> <div> <h3 class="title"> <a id="sect_A.2.2" shape="rect"></a>A.2.2&nbsp;CR Image IOD Entity-Relationship Model</h3> </div> </div> </div> <p> <a id="para_6bd914ca-bef5-40d6-92c7-dbe9e8f34759" shape="rect"></a>This IOD uses the E-R Model in <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_A.1.2" title="A.1.2 IOD Entity-Relationship Model" shape="rect">Section&nbsp;A.1.2</a>, with only the Image IE below the Series IE. The Frame of Reference IE is not a component of this IOD.</p> </div> <div class="section"> <div class="titlepage"> <div> <div> <h3 class="title"> <a id="sect_A.2.3" shape="rect"></a>A.2.3&nbsp;CR Image IOD Module Table</h3> </div> </div> </div> <p> <a id="para_8e9b9882-30e4-4395-9774-eab5ea4559e8" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#table_A.2-1" title="Table A.2-1. CR Image IOD Modules" shape="rect">Table&nbsp;A.2-1</a> specifies the Modules of the CR Image IOD.</p> <div class="table"> <a id="table_A.2-1" shape="rect"></a> <p class="title"> <strong>Table&nbsp;A.2-1.&nbsp;CR Image IOD Modules</strong> </p> <div class="table-contents"> <table frame="box" rules="all"> <thead> <tr valign="top"> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_28e42d61-377f-4682-9d88-da5e5365a395" shape="rect"></a>IE</p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_95fae2e4-1ed9-4d29-bc9c-0f8686e77b0b" shape="rect"></a>Module</p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_2ba6d8f0-4d9b-47e4-8526-d71dd7f54845" shape="rect"></a>Reference</p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_eca4d531-84f7-4e84-9160-0944cff46991" shape="rect"></a>Usage</p> </th> </tr> </thead> <tbody> <tr valign="top"> <td align="left" rowspan="2" colspan="1"> <p> <a id="para_5aa8b3f7-568e-412b-9b86-87014069f3a3" shape="rect"></a>Patient</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_bc79bc38-fded-4e83-b6cf-358317aeb7a2" shape="rect"></a>Patient</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_a3b139fa-41a0-4df8-808c-38cb364c850d" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.1.1" title="C.7.1.1 Patient Module" shape="rect">C.7.1.1</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_cf0b8a2b-c59e-407e-a1c0-45924a108d74" shape="rect"></a>M</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_834fae3d-253a-4360-9a6f-94aee097dc49" shape="rect"></a>Clinical Trial Subject</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_41e4a5af-fc11-45db-b9ad-fe28652cc651" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.1.3" title="C.7.1.3 Clinical Trial Subject Module" shape="rect">C.7.1.3</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_28527800-853e-4f79-97f1-6234eb1d3c0d" shape="rect"></a>U</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="3" colspan="1"> <p> <a id="para_ef4f5872-b6f4-46a5-aabc-054a5a67e93f" shape="rect"></a>Study</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_3afefb6d-8eb6-4cf9-92fa-c6cb50873da8" shape="rect"></a>General Study</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_64574519-b874-4628-8258-5476c306da79" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.2.1" title="C.7.2.1 General Study Module" shape="rect">C.7.2.1</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_c5849c80-b002-43e0-ae0f-527e322e694c" shape="rect"></a>M</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_393f2483-ba32-4664-ab6c-30c0392cc918" shape="rect"></a>Patient Study</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_7686a9ed-8ace-4b85-a6eb-72a2815beb39" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.2.2" title="C.7.2.2 Patient Study Module" shape="rect">C.7.2.2</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_7c6fc16b-6b27-4eb3-9fa4-584ab0eeb810" shape="rect"></a>U</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_c00649d9-1926-4bd8-8605-90e358146f75" shape="rect"></a>Clinical Trial Study</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_a7033261-8521-481f-9dca-87c89c6138be" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.2.3" title="C.7.2.3 Clinical Trial Study Module" shape="rect">C.7.2.3</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_581a54f2-7e7f-4617-8cfd-0008fd799c7f" shape="rect"></a>U</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="3" colspan="1"> <p> <a id="para_e2608dce-e9da-4dd6-8940-04ea47d51a17" shape="rect"></a>Series</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_17e3d9a6-d0c7-4756-9582-1eb16888a744" shape="rect"></a>General Series</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_93be873b-e198-451c-9def-ecdccb4d8852" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.3.1" title="C.7.3.1 General Series Module" shape="rect">C.7.3.1</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_4cb50869-5884-4518-96d0-815ef2899275" shape="rect"></a>M</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_7e390a4d-c5fd-46f1-8e83-79fc72edc07e" shape="rect"></a>CR Series</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_40f9906f-2965-4c48-b765-2c3b89d84a15" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.8.1.1" title="C.8.1.1 CR Series Module" shape="rect">C.8.1.1</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_69924ade-cc99-4d38-84cd-5f9061b498fe" shape="rect"></a>M</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_f74f3bf3-db94-431e-987c-421ca1743d8a" shape="rect"></a>Clinical Trial Series</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_d31a6b8c-47d5-4997-bfaf-9a7f4b79b708" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.3.2" title="C.7.3.2 Clinical Trial Series Module" shape="rect">C.7.3.2</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_a2000d71-50ad-4876-a76e-d891fc4ae476" shape="rect"></a>U</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_7371a85d-a1cd-48fd-a1d9-3efc8ef5da2d" shape="rect"></a>Equipment</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_02a38e1d-d322-4686-9342-039323a86f6d" shape="rect"></a>General Equipment</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_cf5652f6-095d-42d8-9666-a34801035ea3" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.5.1" title="C.7.5.1 General Equipment Module" shape="rect">C.7.5.1</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_a9a1f855-6c61-4621-ab68-358c66d0f85f" shape="rect"></a>M</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="12" colspan="1"> <p> <a id="para_55790433-b9e7-4895-b142-8a099909d824" shape="rect"></a>Image</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_5909a777-a45b-4d16-a16f-6c41a5ac1749" shape="rect"></a>General Image</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_c4f433f0-0a10-4fda-84ce-dda21638de66" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.6.1" title="C.7.6.1 General Image Module" shape="rect">C.7.6.1</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_b550ee7d-3988-4fe9-96a4-a5330c30e5fc" shape="rect"></a>M</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_5fa7ace6-ca0e-4c83-8612-4b97cdf3dcb5" shape="rect"></a>Image Pixel</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_902e736f-769d-430d-9f99-0e51e4032cca" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.6.3" title="C.7.6.3 Image Pixel Module" shape="rect">C.7.6.3</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_67ef5f83-5ab2-4f7b-ad7b-6ce866b8d310" shape="rect"></a>M</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_2d287a91-b1fd-4915-81d6-c6d8001a6d8e" shape="rect"></a>Contrast/Bolus</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_0c6dc198-fee8-4904-843c-c41e27a6e27f" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.6.4" title="C.7.6.4 Contrast/Bolus Module" shape="rect">C.7.6.4</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_941c1f1e-49cb-44ef-8b7d-5763953ab041" shape="rect"></a>C - Required if contrast media was used in this image</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_051d483d-1cef-4f58-b728-5186848916ae" shape="rect"></a>Display Shutter</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_9597d767-a5af-43e7-a302-ab76bfa0cc36" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.6.11" title="C.7.6.11 Display Shutter Module" shape="rect">C.7.6.11</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_1f78cc34-f31b-4d2f-8a21-6ceb710fed62" shape="rect"></a>U</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_9e7645e3-a0cc-4d61-ae20-1da01ffe6e31" shape="rect"></a>Device</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_c6b37cc1-ae01-4b53-88c4-959c267d9733" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.6.12" title="C.7.6.12 Device Module" shape="rect">C.7.6.12</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_feb3027e-505b-4e9c-84e7-09c7df6d09e0" shape="rect"></a>U</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_f0e92fe2-8733-4658-9126-852b167b4089" shape="rect"></a>Specimen</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_4a5152e5-648d-429f-a7b2-d6ab8caeed2b" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.6.22" title="C.7.6.22 Specimen Module" shape="rect">C.7.6.22</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_79ef4fa1-20ef-481b-af08-aa76769c6ae1" shape="rect"></a>U</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_207abe81-d5ba-4695-8b18-1c92a70f3cc5" shape="rect"></a>CR Image</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_99c06c36-495a-4881-8e10-e2beb8bb5fb0" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.8.1.2" title="C.8.1.2 CR Image Module" shape="rect">C.8.1.2</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_bcc647a1-d93f-4c53-96ca-a37ac86986d7" shape="rect"></a>M</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_d564e827-8274-47d3-b641-933aa4e9f2f9" shape="rect"></a>Overlay Plane</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_ebbdf045-b753-4245-b450-b034c19a6d4f" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.9.2" title="C.9.2 Overlay Plane Module" shape="rect">C.9.2</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_27336772-bccc-4c52-8f35-01c88d9fbec4" shape="rect"></a>U</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_09e8b2e3-f555-40f9-85b5-98909e2e9249" shape="rect"></a>Modality LUT</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_8985bee5-74ca-417a-8eba-9d081ac04e94" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.11.1" title="C.11.1 Modality LUT Module" shape="rect">C.11.1</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_c2a2d701-acd7-4ff8-8931-fc6e76e9709a" shape="rect"></a>U</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_b33b14c6-87ae-479f-908a-eaf0884be908" shape="rect"></a>VOI LUT</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_124fe9c3-fde2-46fd-8633-b8c7eb4c311a" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.11.2" title="C.11.2 VOI LUT Module" shape="rect">C.11.2</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_30157c90-d1ca-40d7-94fd-7b6208c73e56" shape="rect"></a>U</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_522a9b46-2fc2-4482-b248-c43fe2208257" shape="rect"></a>SOP Common</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_cd8bc6b8-9d2e-4ef5-8b30-7d9c13d93ac5" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.12.1" title="C.12.1 SOP Common Module" shape="rect">C.12.1</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_5f04022b-47a0-4930-b094-c11a74283b9e" shape="rect"></a>M</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_d015b873-dcd2-44f7-bb47-51903f0f3c55" shape="rect"></a>Common Instance Reference</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_1d02db6b-46a7-4b07-8126-ea4bf4f555c9" shape="rect"></a> <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.12.2" title="C.12.2 Common Instance Reference Module" shape="rect">C.12.2</a> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_68e1e0b5-a959-452d-9a31-8b4a09abf60a" shape="rect"></a>U</p> </td> </tr> </tbody> </table> </div> </div> <br class="table-break" clear="none"> <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> <h3 class="title">Note</h3> <p> <a id="para_dfdad0c6-73c1-4872-9b23-f7b9fd7b59b7" shape="rect"></a>The <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.10.2" title="C.10.2 Curve Module (Retired)" shape="rect">Curve Module (Retired)</a> was previously included in the Image IE for this IOD but has been retired. See <a class="link" href="ftp://medical.nema.org/MEDICAL/Dicom/2004/printed/04_03pu3.pdf" target="_top" shape="rect">PS3.3-2004</a>.</p> </div> </div> </div> ''' patient_group_macro = ''' <div class="table"> <a id="table_C.7.1.4-1" shape="rect"></a> <p class="title"> <strong>Table&nbsp;C.7.1.4-1.&nbsp;Patient Group Macro Attributes</strong> </p> <div class="table-contents"> <table frame="box" rules="all"> <thead> <tr valign="top"> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_f0634cf7-b29a-45a0-b884-bdf3915f87b6" shape="rect"></a>Attribute Name</p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_b1993d7a-f427-4b98-bb26-2a15d8b3e8df" shape="rect"></a>Tag</p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_24f3ff37-c38f-4624-bf40-94c988415514" shape="rect"></a>Type</p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_b50b0311-6cad-4063-b5b4-b0c962181fa5" shape="rect"></a>Attribute Description</p> </th> </tr> </thead> <tbody> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_ac463e7a-7a49-4df0-9563-925879fa192f" shape="rect"></a>Source Patient Group Identification Sequence</p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_7ce8eb67-9a3b-4ebd-ad49-c72328c32afc" shape="rect"></a>(0010,0026)</p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_8e67145a-175e-40d8-a2f1-c40eeb40b42a" shape="rect"></a>3</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_4c308fd9-cd58-435d-9711-b10624077265" shape="rect"></a>A sequence containing the value used for Patient ID (0010,0020) and related Attributes in the source composite instances that contained a group of subjects whose data was acquired at the same time, from which this composite instance was extracted. See <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.1.4.1.1" title="C.7.1.4.1.1 Groups of Subjects" shape="rect">Section&nbsp;C.7.1.4.1.1</a>.</p> <p> <a id="para_131b838f-b085-4807-9cd0-724b1bb4401d" shape="rect"></a>Only a single Item is permitted in this sequence.</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_4e2c78f4-121c-446d-b4f9-00922e4b2116" shape="rect"></a>&gt;Patient ID</p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_020d0ae6-aec6-474e-978c-c8e6b790e01d" shape="rect"></a>(0010,0020)</p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_43bce51e-b255-44cf-9a18-291f5b02e0fa" shape="rect"></a>1</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_86b92af1-ebec-45dc-8d5b-02d425c1e14e" shape="rect"></a>Primary identifier for the group of subjects.</p> </td> </tr> <tr valign="top"> <td align="left" colspan="3" rowspan="1"> <p> <a id="para_176f5141-c45d-44f1-8195-fc9dd6317035" shape="rect"></a> <span class="italic">&gt;Include <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#table_10-18" title="Table 10-18. Issuer of Patient ID Macro Attributes" shape="rect">Table&nbsp;10-18 “Issuer of Patient ID Macro Attributes”</a> </span> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_a4b4d4e1-389d-4ddc-8984-163b0ad35f16" shape="rect"></a> </p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_b208469e-5d8c-46a2-9cf0-341bbf126814" shape="rect"></a>Group of Patients Identification Sequence</p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_bf33eb29-9d28-4ac4-a046-9170a82d8795" shape="rect"></a> (0010,0027) </p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_f973bdfd-c14d-4dcf-8110-dc7622e41c1b" shape="rect"></a> 3 </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_1b7939c6-bab7-4d07-a892-163d0f084837" shape="rect"></a>A sequence containing the identifiers and locations of the individual subjects whose data was acquired at the same time (as a group) and encoded in this composite instance. See <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.1.4.1.1" title="C.7.1.4.1.1 Groups of Subjects" shape="rect">Section&nbsp;C.7.1.4.1.1</a>.</p> <p> <a id="para_de1a0650-3c6b-4e92-99cc-d6de41bdc986" shape="rect"></a>One or more Items are permitted in this sequence.</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_647e5ca7-b0e0-4284-a4bd-240186b63810" shape="rect"></a>&gt;Patient ID</p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_cfb3c2db-bc63-47c9-83b8-77c6c7893d96" shape="rect"></a>(0010,0020)</p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_ce905dab-1a45-4aa3-80c3-e481dbb144e0" shape="rect"></a>1</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_12abde71-9393-4f1a-8b60-28200e39fc8a" shape="rect"></a>Primary identifier for an individual subject.</p> </td> </tr> <tr valign="top"> <td align="left" colspan="3" rowspan="1"> <p> <a id="para_53ced2c3-7a7e-4c9e-b372-2da23c48cb40" shape="rect"></a> <span class="italic">&gt;Include <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#table_10-18" title="Table 10-18. Issuer of Patient ID Macro Attributes" shape="rect">Table&nbsp;10-18 “Issuer of Patient ID Macro Attributes”</a> </span> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_1e78f488-9bb3-42cd-b4e0-1a107cef2a36" shape="rect"></a> </p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_b5abdd92-26c3-4db9-b909-fbf4d02602ff" shape="rect"></a>&gt;Subject Relative Position in Image</p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_9df9cc40-9b61-4f75-9730-0728ca60a94e" shape="rect"></a>(0010,0028)</p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_54be252d-c12d-4ea5-9cbe-cfbde97c5707" shape="rect"></a>3</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_d12ecf33-092b-41b5-93c1-b808a92362e1" shape="rect"></a>The position in the image pixel data of the individual subject identified in this sequence relative to the other subjects. See <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.1.4.1.1.1" title="C.7.1.4.1.1.1 Subject Relative Position in Image and Patient Position" shape="rect">Section&nbsp;C.7.1.4.1.1.1</a>.</p> </td> </tr> <tr valign="top"> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_2f1fbbb0-5079-4c82-945d-8f5f3f00c749" shape="rect"></a>&gt;Patient Position</p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_fd9d7137-5ae6-43eb-94a2-003ce45d1c37" shape="rect"></a>(0018,5100)</p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_61df4667-e47e-4c9b-800a-404bc80c45eb" shape="rect"></a>3</p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_f4dcf837-531d-46af-9a64-6ae7c7a79501" shape="rect"></a>Patient position descriptor relative to the equipment. See <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.1.4.1.1.1" title="C.7.1.4.1.1.1 Subject Relative Position in Image and Patient Position" shape="rect">Section&nbsp;C.7.1.4.1.1.1</a>.</p> <p> <a id="para_55f962dc-3a58-4e4e-b225-35388c607643" shape="rect"></a>See <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.7.3.1.1.2" title="C.7.3.1.1.2 Patient Position" shape="rect">Section&nbsp;C.7.3.1.1.2</a> for Defined Terms and further explanation.</p> </td> </tr> </tbody> </table> </div> </div> ''' macro_expand_caller = ''' <div class="table"> <a id="table_C.7-1" shape="rect"></a> <p class="title"> <strong>Table&nbsp;C.7-1.&nbsp;Patient Module Attributes</strong> </p> <div class="table-contents"> <table frame="box" rules="all"> <thead> <tr valign="top"> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_b3c32db2-8602-4023-89bb-3856b3c51c8e" shape="rect"></a>Attribute Name</p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_2f7d731b-1fef-4474-81fb-bd2eb47efb40" shape="rect"></a>Tag</p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_8d036e51-8ab1-43d3-8460-77d97c7a5ff9" shape="rect"></a>Type</p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_53c874ba-0179-437b-86d0-406e872b2065" shape="rect"></a>Attribute Description</p> </th> </tr> </thead> <tbody> <tr valign="top"> <td align="left" colspan="3" rowspan="1"> <p> <a id="para_066d6894-dcf3-476c-a67d-d59366cb430d" shape="rect"></a> <span class="italic">Include <a class="xref" href="http://dicom.nema.org/medical/dicom/current/output/html/part03.html#table_C.7.1.4-1" title="Table C.7.1.4-1. Patient Group Macro Attributes" shape="rect">Table&nbsp;C.7.1.4-1 “Patient Group Macro Attributes”</a> </span> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_a9ef0519-e45f-498b-82c4-d9980afde268" shape="rect"></a> </p> </td> </tr> </tbody> </table> </div> </div> ''' properties_snippet = ''' <div class="table"> <a id="table_6-1" shape="rect"></a> <p class="title"> <strong>Table 6-1. Registry of DICOM Data Elements</strong> </p> <div class="table-contents"> <table frame="box" rules="all"> <thead> <tr valign="top"> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_3e8c52d5-3582-4ec4-a7e6-acd7604caf32" shape="rect"></a> <span class="bold"> <strong>Tag</strong> </span> </p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_ac298c3b-bcdd-462b-9240-c38e738bfb7c" shape="rect"></a> <span class="bold"> <strong>Name</strong> </span> </p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_99f6b0ff-e1b0-484e-83b5-c3003d61704c" shape="rect"></a> <span class="bold"> <strong>Keyword</strong> </span> </p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_42b3621d-8b30-46eb-8992-10bb21310ac7" shape="rect"></a> <span class="bold"> <strong>VR</strong> </span> </p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_551ea829-a949-4bfd-a201-bb102024e64c" shape="rect"></a> <span class="bold"> <strong>VM</strong> </span> </p> </th> <th align="center" rowspan="1" colspan="1"> <p> <a id="para_3a18713f-2e81-4664-b9a1-e4e3d41957ab" shape="rect"></a> </p> </th> </tr> </thead> <tbody> <tr valign="top"> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_a3b3bd4c-066d-47ca-9cfc-310e017063df" shape="rect"></a> <span class="italic">(0008,0001)</span> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_98dadd68-a5fc-4f46-9590-cf129f76a96f" shape="rect"></a> <span class="italic">Length to End</span> </p> </td> <td align="left" rowspan="1" colspan="1"> <p> <a id="para_d4f02df2-6cdf-4324-afb8-5d033d1d63a2" shape="rect"></a> <span class="italic">Length ToEnd</span> </p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_40ad40bf-10cb-42fe-bf58-10794de1d4e7" shape="rect"></a> <span class="italic">UL</span> </p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_f0c1b432-1911-4196-ac5e-c50217908dd9" shape="rect"></a> <span class="italic">1</span> </p> </td> <td align="center" rowspan="1" colspan="1"> <p> <a id="para_b8e51f4b-5e85-4337-b2a7-14eecec3d1f5" shape="rect"></a> <span class="italic">RET</span> </p> </td> </tr> </tbody> </table> </div> </div> '''
class Levenshtein: """ The Levenshtein distance between two strings: source, target Methods: constructor(source, target, costs): initialises data attributes and calculates distances and backtrace distance(): returns the minimum edit distance for the two strings edit_ops(): returns a list of operations to perform on source to transform into target print_distance_matrix(): print out the distance matrix print_edit_ops(): print out the edit operations Data attributes: source: source string target: target string costs: a tuple or a list with three integers (i, d, s) where i defines the costs for a insertion d defines the costs for a deletion s defines the costs for a substitution D: distance matrix edits: operations to perform on source to transform into target Usage: >>> l = Levenshtein("hello", "world", costs=(2,2,1)) >>> min_distance = l.distance() >>> operations = l.edit_ops() >>> print(l.print_distance_matrix()) - - w o r l d - 0 2 4 6 8 10 h 2 1 3 5 7 9 e 4 3 2 4 6 8 l 6 5 4 3 4 6 l 8 7 6 5 3 5 o 10 9 7 7 5 4 >>> print(l.print_edit_ops()) Type i j -------------------- Substitution 0 0 Substitution 1 1 Substitution 2 2 Match 3 3 Substitution 4 4 """ def __init__(self, source, target, costs=(1, 1, 1)): self.source = source self.target = target self.costs = costs self.D = self.__edit_distance() self.edits = self.__backtrace() def __backtrace(self): """ Trace back through the cost matrix to generate the list of edits """ # Find out indices of bottom-right most cell in matrix i, j = len(self.source), len(self.target) # Assign costs insertion_cost, deletion_cost, substitution_cost = self.costs # Distance matrix D = self.D # Declare list of edit operations edits = list() # While we don't reach the top-leftmost cell while not (i == 0 and j == 0): # Find out cost of current cell current_cost = D[i][j] if (i != 0 and j != 0) and current_cost == D[i - 1][j - 1]: # Same letter i, j = i - 1, j - 1 edits.append({"type": "Match", "i": i, "j": j}) elif (i != 0 and j != 0) and current_cost == D[i - 1][ j - 1 ] + substitution_cost: # Previous cell is diagonally opposite i, j = i - 1, j - 1 edits.append({"type": "Substitution", "i": i, "j": j}) elif i != 0 and current_cost == D[i - 1][j] + deletion_cost: # Previous cell is above current cell i, j = i - 1, j edits.append({"type": "Deletion", "i": i, "j": j}) elif j != 0 and current_cost == D[i][j - 1] + insertion_cost: # Previous cell is on the left of current cell i, j = i, j - 1 edits.append({"type": "Insertion", "i": i, "j": j}) # Reverse the backtrace of operations edits.reverse() return edits def __edit_distance(self): """ Calculates every cell of distance matrix """ # Calculate number of rows and columns in distance matrix rows = len(self.source) + 1 cols = len(self.target) + 1 # Assign costs insertion_cost, deletion_cost, substitution_cost = self.costs # Declaring distance matrix D = [[0 for i in range(cols)] for j in range(rows)] # Initialising first row for i in range(rows): D[i][0] = i * deletion_cost # Initialising first column for j in range(cols): D[0][j] = j * insertion_cost # Fill the rest of the matrix for i in range(1, rows): for j in range(1, cols): if self.source[i - 1] == self.target[j - 1]: # Same character D[i][j] = D[i - 1][j - 1] else: # Different character # Accounting for the cost of operation insertion = D[i][j - 1] + insertion_cost deletion = D[i - 1][j] + deletion_cost substitution = D[i - 1][j - 1] + substitution_cost # Choosing the best option and filling the cell D[i][j] = min(insertion, deletion, substitution) # Return distance matrix return D def distance(self): """ Returns bottom-rightmost entry of distance matrix """ return self.D[-1][-1] def edit_ops(self): """ Returns list of edit operations """ return self.edits def print_distance_matrix(self): """ Pretty prints the distance matrix """ rows = len(self.source) + 1 cols = len(self.target) + 1 first_row = "--" + self.target first_column = "-" + self.source for i in first_row: print("%2c " % i, end="") print() for i in range(0, rows): print("%2c " % (first_column[i]), end="") for j in range(0, cols): print("%2d " % (self.D[i][j]), end="") print() def print_edit_ops(self): """ Pretty prints the edit operations """ print("%-13s %2s %2s" % ("Type", "i", "j")) print("-" * 20) for op in self.edits: print("%-13s %2d %2d\n" % (op["type"], op["i"], op["j"]), end="")
# encoding: utf-8 # module apt_inst # from /usr/lib/python3/dist-packages/apt_inst.cpython-35m-x86_64-linux-gnu.so # by generator 1.145 """ Functions for working with ar/tar archives and .deb packages. This module provides useful classes and functions to work with archives, modelled after the 'TarFile' class in the 'tarfile' module. """ # no imports # no functions # classes class ArArchive(object): """ ArArchive(file: str/int/file) Represent an archive in the 4.4 BSD ar format, which is used for e.g. deb packages. The parameter 'file' may be a string specifying the path of a file, or a file-like object providing the fileno() method. It may also be an int specifying a file descriptor (returned by e.g. os.open()). The recommended way of using it is to pass in the path to the file. """ def extract(self, name, target=None): # real signature unknown; restored from __doc__ """ extract(name: str[, target: str]) -> bool Extract the member given by 'name' into the directory given by 'target'. If the extraction fails, raise OSError. In case of success, return True if the file owner could be set or False if this was not possible. If the requested member does not exist, raise LookupError. """ return False def extractall(self, target=None): # real signature unknown; restored from __doc__ """ extractall([target: str]) -> bool Extract all archive contents into the directory given by 'target'. If the extraction fails, raise an error. Otherwise, return True if the owner could be set or False if the owner could not be changed. """ return False def extractdata(self, name): # real signature unknown; restored from __doc__ """ extractdata(name: str) -> bytes Return the contents of the member, as a bytes object. Raise LookupError if there is no ArMember with the given name. """ return b"" def getmember(self, name): # real signature unknown; restored from __doc__ """ getmember(name: str) -> ArMember Return an ArMember object for the member given by 'name'. Raise LookupError if there is no ArMember with the given name. """ return ArMember def getmembers(self): # real signature unknown; restored from __doc__ """ getmembers() -> list Return a list of all members in the archive. """ return [] def getnames(self): # real signature unknown; restored from __doc__ """ getnames() -> list Return a list of the names of all members in the archive. """ return [] def gettar(self, name, comp): # real signature unknown; restored from __doc__ """ gettar(name: str, comp: str) -> TarFile Return a TarFile object for the member given by 'name' which will be decompressed using the compression algorithm given by 'comp'. This is almost equal to: member = arfile.getmember(name) tarfile = TarFile(file, member.start, member.size, 'gzip')' It just opens a new TarFile on the given position in the stream. """ return TarFile def __contains__(self, *args, **kwargs): # real signature unknown """ Return key in self. """ pass def __getitem__(self, *args, **kwargs): # real signature unknown """ Return self[key]. """ pass def __init__(self, file, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ pass def __iter__(self, *args, **kwargs): # real signature unknown """ Implement iter(self). """ pass @staticmethod # known case of __new__ def __new__(*args, **kwargs): # real signature unknown """ Create and return a new object. See help(type) for accurate signature. """ pass class ArMember(object): """ Represent a single file within an AR archive. For Debian packages this can be e.g. control.tar.gz. This class provides information about this file, such as the mode and size. """ def __init__(self, *args, **kwargs): # real signature unknown pass def __repr__(self, *args, **kwargs): # real signature unknown """ Return repr(self). """ pass gid = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The group id of the owner.""" mode = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The mode of the file.""" mtime = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Last time of modification.""" name = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The name of the file.""" size = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The size of the files.""" start = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The offset in the archive where the file starts.""" uid = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The user ID of the owner.""" class DebFile(ArArchive): """ DebFile(file: str/int/file) A DebFile object represents a file in the .deb package format. The parameter 'file' may be a string specifying the path of a file, or a file-like object providing the fileno() method. It may also be an int specifying a file descriptor (returned by e.g. os.open()). The recommended way of using it is to pass in the path to the file. It differs from ArArchive by providing the members 'control', 'data' and 'version' for accessing the control.tar.gz, data.tar.$compression (all apt compression methods are supported), and debian-binary members in the archive. """ def __init__(self, file, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ pass @staticmethod # known case of __new__ def __new__(*args, **kwargs): # real signature unknown """ Create and return a new object. See help(type) for accurate signature. """ pass control = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The TarFile object associated with the control.tar.gz member.""" data = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The TarFile object associated with the data.tar.$compression member. All apt compression methods are supported. """ debian_binary = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The package version, as contained in debian-binary.""" class TarFile(object): """ TarFile(file: str/int/file[, min: int, max: int, comp: str]) The parameter 'file' may be a string specifying the path of a file, or a file-like object providing the fileno() method. It may also be an int specifying a file descriptor (returned by e.g. os.open()). The parameter 'min' describes the offset in the file where the archive begins and the parameter 'max' is the size of the archive. The compression of the archive is set by the parameter 'comp'. It can be set to any program supporting the -d switch, the default being gzip. """ def extractall(self, rootdir=None): # real signature unknown; restored from __doc__ """ extractall([rootdir: str]) -> True Extract the archive in the current directory. The argument 'rootdir' can be used to change the target directory. """ return False def extractdata(self, member): # real signature unknown; restored from __doc__ """ extractdata(member: str) -> bytes Return the contents of the member, as a bytes object. Raise LookupError if there is no member with the given name. """ return b"" def go(self, callback, member=None): # real signature unknown; restored from __doc__ """ go(callback: callable[, member: str]) -> True Go through the archive and call the callable 'callback' for each member with 2 arguments. The first argument is the TarMember and the second one is the data, as bytes. The optional parameter 'member' can be used to specify the member for which to call the callback. If not specified, it will be called for all members. If specified and not found, LookupError will be raised. """ return False def __init__(self, file, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ pass @staticmethod # known case of __new__ def __new__(*args, **kwargs): # real signature unknown """ Create and return a new object. See help(type) for accurate signature. """ pass def __repr__(self, *args, **kwargs): # real signature unknown """ Return repr(self). """ pass class TarMember(object): """ Represent a single member of a 'tar' archive. This class, which has been modelled after 'tarfile.TarInfo', represents information about a given member in an archive. """ def isblk(self, *args, **kwargs): # real signature unknown """ Determine whether the member is a block device. """ pass def ischr(self, *args, **kwargs): # real signature unknown """ Determine whether the member is a character device. """ pass def isdev(self, *args, **kwargs): # real signature unknown """ Determine whether the member is a device (block, character or FIFO). """ pass def isdir(self, *args, **kwargs): # real signature unknown """ Determine whether the member is a directory. """ pass def isfifo(self, *args, **kwargs): # real signature unknown """ Determine whether the member is a FIFO. """ pass def isfile(self, *args, **kwargs): # real signature unknown """ Determine whether the member is a regular file. """ pass def islnk(self, *args, **kwargs): # real signature unknown """ Determine whether the member is a hardlink. """ pass def isreg(self, *args, **kwargs): # real signature unknown """ Determine whether the member is a regular file, same as isfile(). """ pass def issym(self, *args, **kwargs): # real signature unknown """ Determine whether the member is a symbolic link. """ pass def __init__(self, *args, **kwargs): # real signature unknown pass def __repr__(self, *args, **kwargs): # real signature unknown """ Return repr(self). """ pass gid = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The owner's group ID.""" linkname = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The target of the link.""" major = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The major ID of the device.""" minor = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The minor ID of the device.""" mode = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The mode (permissions).""" mtime = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """Last time of modification.""" name = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The name of the file.""" size = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The size of the file.""" uid = property(lambda self: object(), lambda self, v: None, lambda self: None) # default """The owner's user ID.""" # variables with complex values __loader__ = None # (!) real value is '' __spec__ = None # (!) real value is ''
# Support code class Node: def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None): self.val = val self.left = left self.right = right self.next = next # Problem code def connect(root): if not root: return None connect_helper(root.left, root.right) return root def connect_helper(node1, node2): if not node1 or not node2: return node1.next = node2 connect_helper(node1.left, node1.right) connect_helper(node1.right, node2.left) connect_helper(node2.left, node2.right)
def parse(): with open('day09/input.txt') as f: lines = f.readlines() arr = [] for line in lines: a = [] for c in line.strip(): a.append(int(c)) arr.append(a) return arr arr = parse() h = len(arr) w = len(arr[0]) def wave(xx: int, yy: int) -> int: n = 0 q = [ [yy, xx] ] while len(q) > 0: y, x = q.pop(0) if arr[y][x] == -1: continue arr[y][x] = -1 n += 1 if x > 0 and arr[y][x-1] != 9 and arr[y][x-1] != -1: q.append([y, x-1]) if y > 0 and arr[y-1][x] != 9 and arr[y-1][x] != -1: q.append([y-1, x]) if x < w-1 and arr[y][x+1] != 9 and arr[y][x+1] != -1: q.append([y, x+1]) if y < h-1 and arr[y+1][x] != 9 and arr[y+1][x] != -1: q.append([y+1, x]) return n basins = [] for y in range(h): for x in range(w): if arr[y][x] != -1 and arr[y][x] != 9: size = wave(x, y) basins.append(size) basins = sorted(basins, reverse=True) product = 1 for i in range(3): product *= basins[i] print(product)
n = float(input('massa da substancia em gramas: ')) meiavida = n tempo = 0 while meiavida >= 0.05: meiavida *= 0.5 tempo +=50 print('para q a substancia de massa {}g atinja 0.05g , levou {:.0f}s'.format(n,tempo))
# # PySNMP MIB module Juniper-DISMAN-EVENT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-DISMAN-EVENT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:51:24 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint") mteTriggerEntry, = mibBuilder.importSymbols("DISMAN-EVENT-MIB", "mteTriggerEntry") juniMibs, = mibBuilder.importSymbols("Juniper-MIBs", "juniMibs") NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup") Gauge32, Unsigned32, ModuleIdentity, iso, Counter32, TimeTicks, ObjectIdentity, Integer32, MibIdentifier, Counter64, IpAddress, Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "Unsigned32", "ModuleIdentity", "iso", "Counter32", "TimeTicks", "ObjectIdentity", "Integer32", "MibIdentifier", "Counter64", "IpAddress", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") juniDismanEventMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66)) juniDismanEventMIB.setRevisions(('2003-10-30 15:35',)) if mibBuilder.loadTexts: juniDismanEventMIB.setLastUpdated('200310301535Z') if mibBuilder.loadTexts: juniDismanEventMIB.setOrganization('Juniper Networks, Inc.') juniDismanEventMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 1)) juniMteTrigger = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 1, 1)) juniMteTriggerTable = MibTable((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 1, 1, 1), ) if mibBuilder.loadTexts: juniMteTriggerTable.setStatus('current') juniMteTriggerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 1, 1, 1, 1), ) mteTriggerEntry.registerAugmentions(("Juniper-DISMAN-EVENT-MIB", "juniMteTriggerEntry")) juniMteTriggerEntry.setIndexNames(*mteTriggerEntry.getIndexNames()) if mibBuilder.loadTexts: juniMteTriggerEntry.setStatus('current') juniMteTriggerContextNameLimit = MibTableColumn((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 1, 1, 1, 1, 2), Unsigned32()).setMaxAccess("readcreate") if mibBuilder.loadTexts: juniMteTriggerContextNameLimit.setStatus('current') juniDismanEventMIBNotificationPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 2)) juniDismanEventMIBNotificationObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 2, 1)) juniMteExistenceTestResult = MibScalar((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("present", 0), ("absent", 1), ("changed", 2)))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: juniMteExistenceTestResult.setStatus('current') juniDismanEventConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 3)) juniDismanEventCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 3, 1)) juniDismanEventGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 3, 2)) juniDismanEventCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 3, 1, 1)).setObjects(("Juniper-DISMAN-EVENT-MIB", "juniMteTriggerTableGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniDismanEventCompliance = juniDismanEventCompliance.setStatus('current') juniMteTriggerTableGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4874, 2, 2, 66, 3, 2, 1)).setObjects(("Juniper-DISMAN-EVENT-MIB", "juniMteTriggerContextNameLimit"), ("Juniper-DISMAN-EVENT-MIB", "juniMteExistenceTestResult")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): juniMteTriggerTableGroup = juniMteTriggerTableGroup.setStatus('current') mibBuilder.exportSymbols("Juniper-DISMAN-EVENT-MIB", juniMteTriggerTable=juniMteTriggerTable, juniDismanEventMIBNotificationPrefix=juniDismanEventMIBNotificationPrefix, juniMteTrigger=juniMteTrigger, juniDismanEventGroups=juniDismanEventGroups, juniDismanEventCompliances=juniDismanEventCompliances, juniDismanEventCompliance=juniDismanEventCompliance, juniDismanEventMIBNotificationObjects=juniDismanEventMIBNotificationObjects, juniDismanEventConformance=juniDismanEventConformance, juniMteTriggerEntry=juniMteTriggerEntry, juniDismanEventMIB=juniDismanEventMIB, juniMteTriggerContextNameLimit=juniMteTriggerContextNameLimit, PYSNMP_MODULE_ID=juniDismanEventMIB, juniDismanEventMIBObjects=juniDismanEventMIBObjects, juniMteExistenceTestResult=juniMteExistenceTestResult, juniMteTriggerTableGroup=juniMteTriggerTableGroup)
class Tape(object): blank_symbol = " " def __init__(self, tape_string=""): self.__tape = dict((enumerate(tape_string))) # last line is equivalent to the following three lines: # self.__tape = {} # for i in range(len(tape_string)): # self.__tape[i] = input[i] def __str__(self): s = "" min_used_index = min(self.__tape.keys()) max_used_index = max(self.__tape.keys()) for i in range(min_used_index, max_used_index): s += self.__tape[i] return s def __getitem__(self, index): if index in self.__tape: return self.__tape[index] else: return Tape.blank_symbol def __setitem__(self, pos, char): self.__tape[pos] = char class TuringMachine(object): def __init__(self, tape="", blank_symbol=" ", initial_state="", final_states=None, transition_function=None): self.__tape = Tape(tape) self.__head_position = 0 self.__blank_symbol = blank_symbol self.__current_state = initial_state if transition_function == None: self.__transition_function = {} else: self.__transition_function = transition_function if final_states == None: self.__final_states = set() else: self.__final_states = set(final_states) def get_tape(self): return str(self.__tape) def step(self): char_under_head = self.__tape[self.__head_position] x = (self.__current_state, char_under_head) if x in self.__transition_function: y = self.__transition_function[x] self.__tape[self.__head_position] = y[1] if y[2] == "R": self.__head_position += 1 elif y[2] == "L": self.__head_position -= 1 self.__current_state = y[0] def final(self): if self.__current_state in self.__final_states: return True else: return False
sunny = [ " \\ | / ", " - O - ", " / | \\ " ] partial_clouds = [ " \\ /( ) ", " - O( )", " / ( ) ", ] clouds = [ " ( )()_ ", " ( ) ", " ( )() " ] night = [ " . * ", " * . O ", " . . * . " ] drizzle = [ " ' ' '", " ' ' ' ", "' ' '" ] rain = [ " ' '' ' ' ", " '' ' ' ' ", " ' ' '' ' " ] thunderstorm = [ " ''_/ _/' ", " ' / _/' '", " /_/'' '' " ] chaos = [ " c__ ''' '", " ' '' c___", " c__ ' 'c_" ] snow = [ " * '* ' * ", " '* ' * ' ", " *' * ' * " ] fog = [ " -- _ -- ", " -__-- - ", " - _--__ " ] wind = [ " c__ -- _ ", " -- _-c__ ", " c --___c " ]
# File type alias FileType = str # Constants IMAGE: FileType = "IMAGE" AUDIO: FileType = "AUDIO"
a=10 b=5 print(a+b) print("addition")
# system functions for the effects of time on a player def raise_hunger(db, messenger, object): print('HUNGER for {0}'.format(object['entity'])) if object['hunger'] >= 9: # player is going to die, so let's just skip the database # TODO: don't do this, and let an event driven system pick up players who have gotten too hungry username = object['entity'] db.set_component_for_entity('player_state', {'location': '0;0', 'hunger': 0}, username) db.set_component_for_entity('inventory', {}, username) return [ messenger.plain_text('You have died of hunger!', username), messenger.plain_text('You have lost everything in your inventory!', username), messenger.plain_text('You have been resurrected at The Origin!', username) ] db.increment_property_of_component('player_state', object['entity'], 'hunger', 1) if 2 <= object['hunger'] < 3: return [messenger.plain_text('You begin to feel hungry', object['entity'])] if 4 <= object['hunger'] < 5: return [messenger.plain_text('You hunger is giving way to hangriness', object['entity'])] if 6 <= object['hunger'] < 7: return [messenger.plain_text('Your hunger hurts, making anything but eating mentally difficult', object['entity'])] if 8 <= object['hunger'] < 9: return [messenger.plain_text('You are about to die of hunger! Eat, NOW!', object['entity'])] return []
DOMAIN = 'https://example.com' # (route, [querie string keys]) # queries must be emtpy list if it has no query strings. ROUTES = [ ('/exercise', ['page', 'date']), ('/homework', ['date']), ] # { query string key: [query string values ]} QUERIES = { 'page': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'date': ['2019-01-01', '2019-04-03', '2019-04-08', '2019-05-06'] }
## use memoization to implement dynamic programming...!!! def solve(i,arr,dp): ## parameter(index of array, input array, define dp table..) if i <= -1: return 0 if dp[i] != -1: return dp[i] ## recursive calls op1 = arr[i] + solve(i-2,arr,dp) op2 = solve(i-1,arr,dp) ## get maximum from both recursive calls...!!!! dp[i] = max(op1,op2) return dp[i] ## main function for calling and return value...!!! def findmaxsum(arr,n): dp = [-1]*(n) ## pass value from the last index of array.. solve(n-1,arr,dp) return dp[n-1] ## Driver code...!!! if __name__ == "__main__": n = int(input()) arr = list(map(int,input().split())) print("maximum sum robber can get from houses-->",findmaxsum(arr,n)) """ sample input... 6 5 5 10 100 10 5 """
class Solution: def validUtf8(self, data: List[int]) -> bool: p = 0 while p < len(data): b = self._get_binary(data[p]) one = 0 for c in b: if c == '1': one += 1 else: break if one == 0: p += 1 continue if p + one - 1 >= len(data) or one > 4 or one == 1: return False if not self._validate(data[p+1:p+one]): return False p += one return True def _validate(self, seq): for s in seq: b = self._get_binary(s) if b[:2] != '10': return False return True def _get_binary(self, num): b = bin(num)[2:] return '0' * (8 - len(b)) + b
def largest_palindrome_product(): values = { "first": 0, "second": 0, "product": 0 } for first in range(1000): for second in range(1000): product = first * second product_string = str(product) if product_string == product_string[::-1]: if first + second > values["first"] + values["second"]: values = { "first": first, "second": second, "product": product } return values["product"] print(largest_palindrome_product())
#Faça um programa que leia o nome completo de uma pessoa, mostrando em seguida o primeiro e o último nome separadamente. n = input('Qual seu nome todo:').strip() e = n.split() print('Seu primeiro nome é:', e[0]) f = n.rfind(' ') + 1 print('Seu ultimo nome é:', n[f:])
# Copyright 2003 by Bartek Wilczynski. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """ Parser and code for dealing with the standalone version of AlignAce, a motif search program. It also includes a very simple interface to CompareACE tool. http://atlas.med.harvard.edu/ """
tmp = max(x, y) x = min(x, y) y = tmp tmp = max(y, z) y = min(y, z) z = tmp tmp = max(x, y) x = min(x, y) y = tmp
def fib(n, k, a=0, b=1): if n == 0: return 1 if n == 1: return b return fib(n - 1, k, b * k, a + b) print(fib(31, 2))
#We need to calculate all multiples of 3 and 5 that are lesser than given number N #My initial attempt wasnt great so i took help from this wonderful article https://medium.com/@TheZaki/project-euler-1-multiples-of-3-and-5-c24cb64071b0 : N = 10 def sum(n, k): d = n // k return k * (d * (d+1)) // 2 def test(n): return sum(n, 3) + sum(n, 5) - sum(n, 15) print(test(N-1))
# # PySNMP MIB module HPN-ICF-IPSEC-MONITOR-V2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-IPSEC-MONITOR-V2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:27:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint") hpnicfCommon, = mibBuilder.importSymbols("HPN-ICF-OID-MIB", "hpnicfCommon") InterfaceIndex, ifIndex = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex", "ifIndex") InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") TimeTicks, Gauge32, NotificationType, Unsigned32, MibIdentifier, ModuleIdentity, Bits, Counter64, Integer32, IpAddress, Counter32, iso, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "Gauge32", "NotificationType", "Unsigned32", "MibIdentifier", "ModuleIdentity", "Bits", "Counter64", "Integer32", "IpAddress", "Counter32", "iso", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn") TextualConvention, DisplayString, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "TruthValue") hpnicfIPsecMonitorV2 = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126)) hpnicfIPsecMonitorV2.setRevisions(('2012-06-27 00:00',)) if mibBuilder.loadTexts: hpnicfIPsecMonitorV2.setLastUpdated('201206270000Z') if mibBuilder.loadTexts: hpnicfIPsecMonitorV2.setOrganization('') class HpnicfIPsecDiffHellmanGrpV2(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 5, 14, 24, 2147483647)) namedValues = NamedValues(("none", 0), ("dhGroup1", 1), ("dhGroup2", 2), ("dhGroup5", 5), ("dhGroup14", 14), ("dhGroup24", 24), ("invalidGroup", 2147483647)) class HpnicfIPsecEncapModeV2(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 2147483647)) namedValues = NamedValues(("tunnel", 1), ("transport", 2), ("invalidMode", 2147483647)) class HpnicfIPsecEncryptAlgoV2(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 2147483647)) namedValues = NamedValues(("none", 0), ("desCbc", 1), ("ideaCbc", 2), ("blowfishCbc", 3), ("rc5R16B64Cbc", 4), ("tripleDesCbc", 5), ("castCbc", 6), ("aesCbc", 7), ("nsaCbc", 8), ("aesCbc128", 9), ("aesCbc192", 10), ("aesCbc256", 11), ("aesCtr", 12), ("aesCamelliaCbc", 13), ("rc4", 14), ("invalidAlg", 2147483647)) class HpnicfIPsecAuthAlgoV2(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 2147483647)) namedValues = NamedValues(("none", 0), ("md5", 1), ("sha1", 2), ("sha256", 3), ("sha384", 4), ("sha512", 5), ("invalidAlg", 2147483647)) class HpnicfIPsecSaProtocolV2(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 2, 3, 4)) namedValues = NamedValues(("reserved", 0), ("ah", 2), ("esp", 3), ("ipcomp", 4)) class HpnicfIPsecIDTypeV2(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)) namedValues = NamedValues(("reserved", 0), ("ipv4Addr", 1), ("fqdn", 2), ("userFqdn", 3), ("ipv4AddrSubnet", 4), ("ipv6Addr", 5), ("ipv6AddrSubnet", 6), ("ipv4AddrRange", 7), ("ipv6AddrRange", 8), ("derAsn1Dn", 9), ("derAsn1Gn", 10), ("keyId", 11)) class HpnicfIPsecTrafficTypeV2(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 4, 5, 6, 7, 8)) namedValues = NamedValues(("ipv4Addr", 1), ("ipv4AddrSubnet", 4), ("ipv6Addr", 5), ("ipv6AddrSubnet", 6), ("ipv4AddrRange", 7), ("ipv6AddrRange", 8)) class HpnicfIPsecNegoTypeV2(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 2147483647)) namedValues = NamedValues(("ike", 1), ("manual", 2), ("invalidType", 2147483647)) class HpnicfIPsecTunnelStateV2(TextualConvention, Integer32): status = 'current' subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2)) namedValues = NamedValues(("active", 1), ("timeout", 2)) hpnicfIPsecObjectsV2 = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1)) hpnicfIPsecScalarObjectsV2 = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 1)) hpnicfIPsecMIBVersion = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 1, 1), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecMIBVersion.setStatus('current') hpnicfIPsecTunnelV2Table = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2), ) if mibBuilder.loadTexts: hpnicfIPsecTunnelV2Table.setStatus('current') hpnicfIPsecTunnelV2Entry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1), ).setIndexNames((0, "HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIndexV2")) if mibBuilder.loadTexts: hpnicfIPsecTunnelV2Entry.setStatus('current') hpnicfIPsecTunIndexV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfIPsecTunIndexV2.setStatus('current') hpnicfIPsecTunIfIndexV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 2), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunIfIndexV2.setStatus('current') hpnicfIPsecTunIKETunnelIndexV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunIKETunnelIndexV2.setStatus('current') hpnicfIPsecTunIKETunLocalIDTypeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 4), HpnicfIPsecIDTypeV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunIKETunLocalIDTypeV2.setStatus('current') hpnicfIPsecTunIKETunLocalIDVal1V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunIKETunLocalIDVal1V2.setStatus('current') hpnicfIPsecTunIKETunLocalIDVal2V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunIKETunLocalIDVal2V2.setStatus('current') hpnicfIPsecTunIKETunRemoteIDTypeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 7), HpnicfIPsecIDTypeV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunIKETunRemoteIDTypeV2.setStatus('current') hpnicfIPsecTunIKETunRemoteIDVal1V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunIKETunRemoteIDVal1V2.setStatus('current') hpnicfIPsecTunIKETunRemoteIDVal2V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 9), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunIKETunRemoteIDVal2V2.setStatus('current') hpnicfIPsecTunLocalAddrTypeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 10), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunLocalAddrTypeV2.setStatus('current') hpnicfIPsecTunLocalAddrV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 11), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunLocalAddrV2.setStatus('current') hpnicfIPsecTunRemoteAddrTypeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 12), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunRemoteAddrTypeV2.setStatus('current') hpnicfIPsecTunRemoteAddrV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 13), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunRemoteAddrV2.setStatus('current') hpnicfIPsecTunKeyTypeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 14), HpnicfIPsecNegoTypeV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunKeyTypeV2.setStatus('current') hpnicfIPsecTunEncapModeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 15), HpnicfIPsecEncapModeV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunEncapModeV2.setStatus('current') hpnicfIPsecTunInitiatorV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 2147483647))).clone(namedValues=NamedValues(("local", 1), ("remote", 2), ("none", 2147483647)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInitiatorV2.setStatus('current') hpnicfIPsecTunLifeSizeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 17), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunLifeSizeV2.setStatus('current') hpnicfIPsecTunLifeTimeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunLifeTimeV2.setStatus('current') hpnicfIPsecTunRemainTimeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunRemainTimeV2.setStatus('current') hpnicfIPsecTunActiveTimeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 20), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunActiveTimeV2.setStatus('current') hpnicfIPsecTunRemainSizeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 21), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunRemainSizeV2.setStatus('current') hpnicfIPsecTunTotalRefreshesV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunTotalRefreshesV2.setStatus('current') hpnicfIPsecTunCurrentSaInstancesV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 23), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunCurrentSaInstancesV2.setStatus('current') hpnicfIPsecTunInSaEncryptAlgoV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 24), HpnicfIPsecEncryptAlgoV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInSaEncryptAlgoV2.setStatus('current') hpnicfIPsecTunInSaAhAuthAlgoV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 25), HpnicfIPsecAuthAlgoV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInSaAhAuthAlgoV2.setStatus('current') hpnicfIPsecTunInSaEspAuthAlgoV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 26), HpnicfIPsecAuthAlgoV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInSaEspAuthAlgoV2.setStatus('current') hpnicfIPsecTunDiffHellmanGrpV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 27), HpnicfIPsecDiffHellmanGrpV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunDiffHellmanGrpV2.setStatus('current') hpnicfIPsecTunOutSaEncryptAlgoV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 28), HpnicfIPsecEncryptAlgoV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunOutSaEncryptAlgoV2.setStatus('current') hpnicfIPsecTunOutSaAhAuthAlgoV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 29), HpnicfIPsecAuthAlgoV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunOutSaAhAuthAlgoV2.setStatus('current') hpnicfIPsecTunOutSaEspAuthAlgoV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 30), HpnicfIPsecAuthAlgoV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunOutSaEspAuthAlgoV2.setStatus('current') hpnicfIPsecTunPolicyNameV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 31), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunPolicyNameV2.setStatus('current') hpnicfIPsecTunPolicyNumV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 32), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunPolicyNumV2.setStatus('current') hpnicfIPsecTunStatusV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 2, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("initial", 1), ("ready", 2), ("rekeyed", 3), ("closed", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunStatusV2.setStatus('current') hpnicfIPsecTunnelStatV2Table = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3), ) if mibBuilder.loadTexts: hpnicfIPsecTunnelStatV2Table.setStatus('current') hpnicfIPsecTunnelStatV2Entry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1), ).setIndexNames((0, "HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIndexV2")) if mibBuilder.loadTexts: hpnicfIPsecTunnelStatV2Entry.setStatus('current') hpnicfIPsecTunInOctetsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 1), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInOctetsV2.setStatus('current') hpnicfIPsecTunInDecompOctetsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 2), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInDecompOctetsV2.setStatus('current') hpnicfIPsecTunInPktsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInPktsV2.setStatus('current') hpnicfIPsecTunInDropPktsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInDropPktsV2.setStatus('current') hpnicfIPsecTunInReplayDropPktsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInReplayDropPktsV2.setStatus('current') hpnicfIPsecTunInAuthFailsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 6), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInAuthFailsV2.setStatus('current') hpnicfIPsecTunInDecryptFailsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 7), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInDecryptFailsV2.setStatus('current') hpnicfIPsecTunOutOctetsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunOutOctetsV2.setStatus('current') hpnicfIPsecTunOutUncompOctetsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunOutUncompOctetsV2.setStatus('current') hpnicfIPsecTunOutPktsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunOutPktsV2.setStatus('current') hpnicfIPsecTunOutDropPktsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunOutDropPktsV2.setStatus('current') hpnicfIPsecTunOutEncryptFailsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 12), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunOutEncryptFailsV2.setStatus('current') hpnicfIPsecTunNoMemoryDropPktsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 13), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunNoMemoryDropPktsV2.setStatus('current') hpnicfIPsecTunQueueFullDropPktsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 14), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunQueueFullDropPktsV2.setStatus('current') hpnicfIPsecTunInvalidLenDropPktsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 15), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInvalidLenDropPktsV2.setStatus('current') hpnicfIPsecTunTooLongDropPktsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 16), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunTooLongDropPktsV2.setStatus('current') hpnicfIPsecTunInvalidSaDropPktsV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 3, 1, 17), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTunInvalidSaDropPktsV2.setStatus('current') hpnicfIPsecSaV2Table = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 4), ) if mibBuilder.loadTexts: hpnicfIPsecSaV2Table.setStatus('current') hpnicfIPsecSaV2Entry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 4, 1), ).setIndexNames((0, "HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIndexV2"), (0, "HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecSaIndexV2")) if mibBuilder.loadTexts: hpnicfIPsecSaV2Entry.setStatus('current') hpnicfIPsecSaIndexV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfIPsecSaIndexV2.setStatus('current') hpnicfIPsecSaDirectionV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 4, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("in", 1), ("out", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecSaDirectionV2.setStatus('current') hpnicfIPsecSaSpiValueV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 4, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecSaSpiValueV2.setStatus('current') hpnicfIPsecSaSecProtocolV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 4, 1, 4), HpnicfIPsecSaProtocolV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecSaSecProtocolV2.setStatus('current') hpnicfIPsecSaEncryptAlgoV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 4, 1, 5), HpnicfIPsecEncryptAlgoV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecSaEncryptAlgoV2.setStatus('current') hpnicfIPsecSaAuthAlgoV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 4, 1, 6), HpnicfIPsecAuthAlgoV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecSaAuthAlgoV2.setStatus('current') hpnicfIPsecSaStatusV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 4, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("active", 1), ("expiring", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecSaStatusV2.setStatus('current') hpnicfIPsecTrafficV2Table = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5), ) if mibBuilder.loadTexts: hpnicfIPsecTrafficV2Table.setStatus('current') hpnicfIPsecTrafficV2Entry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1), ).setIndexNames((0, "HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIndexV2")) if mibBuilder.loadTexts: hpnicfIPsecTrafficV2Entry.setStatus('current') hpnicfIPsecTrafficLocalTypeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 1), HpnicfIPsecTrafficTypeV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficLocalTypeV2.setStatus('current') hpnicfIPsecTrafficLocalAddr1TypeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 2), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficLocalAddr1TypeV2.setStatus('current') hpnicfIPsecTrafficLocalAddr1V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 3), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficLocalAddr1V2.setStatus('current') hpnicfIPsecTrafficLocalAddr2TypeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 4), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficLocalAddr2TypeV2.setStatus('current') hpnicfIPsecTrafficLocalAddr2V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 5), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficLocalAddr2V2.setStatus('current') hpnicfIPsecTrafficLocalProtocol1V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficLocalProtocol1V2.setStatus('current') hpnicfIPsecTrafficLocalProtocol2V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficLocalProtocol2V2.setStatus('current') hpnicfIPsecTrafficLocalPort1V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficLocalPort1V2.setStatus('current') hpnicfIPsecTrafficLocalPort2V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficLocalPort2V2.setStatus('current') hpnicfIPsecTrafficRemoteTypeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 10), HpnicfIPsecTrafficTypeV2()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficRemoteTypeV2.setStatus('current') hpnicfIPsecTrafficRemAddr1TypeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 11), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficRemAddr1TypeV2.setStatus('current') hpnicfIPsecTrafficRemAddr1V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 12), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficRemAddr1V2.setStatus('current') hpnicfIPsecTrafficRemAddr2TypeV2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 13), InetAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficRemAddr2TypeV2.setStatus('current') hpnicfIPsecTrafficRemAddr2V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 14), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficRemAddr2V2.setStatus('current') hpnicfIPsecTrafficRemoPro1V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficRemoPro1V2.setStatus('current') hpnicfIPsecTrafficRemoPro2V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficRemoPro2V2.setStatus('current') hpnicfIPsecTrafficRemPort1V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficRemPort1V2.setStatus('current') hpnicfIPsecTrafficRemPort2V2 = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 5, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecTrafficRemPort2V2.setStatus('current') hpnicfIPsecGlobalStatsV2 = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6)) hpnicfIPsecGlobalActiveTunnelsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 1), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalActiveTunnelsV2.setStatus('current') hpnicfIPsecGlobalActiveSasV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 2), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalActiveSasV2.setStatus('current') hpnicfIPsecGlobalInOctetsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 3), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalInOctetsV2.setStatus('current') hpnicfIPsecGlobalInDecompOctetsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 4), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalInDecompOctetsV2.setStatus('current') hpnicfIPsecGlobalInPktsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 5), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalInPktsV2.setStatus('current') hpnicfIPsecGlobalInDropsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 6), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalInDropsV2.setStatus('current') hpnicfIPsecGlobalInReplayDropsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 7), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalInReplayDropsV2.setStatus('current') hpnicfIPsecGlobalInAuthFailsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalInAuthFailsV2.setStatus('current') hpnicfIPsecGlobalInDecryptFailsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalInDecryptFailsV2.setStatus('current') hpnicfIPsecGlobalOutOctetsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalOutOctetsV2.setStatus('current') hpnicfIPsecGlobalOutUncompOctetsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalOutUncompOctetsV2.setStatus('current') hpnicfIPsecGlobalOutPktsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 12), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalOutPktsV2.setStatus('current') hpnicfIPsecGlobalOutDropsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 13), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalOutDropsV2.setStatus('current') hpnicfIPsecGlobalOutEncryptFailsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 14), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalOutEncryptFailsV2.setStatus('current') hpnicfIPsecGlobalNoMemoryDropsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 15), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalNoMemoryDropsV2.setStatus('current') hpnicfIPsecGlobalNoFindSaDropsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 16), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalNoFindSaDropsV2.setStatus('current') hpnicfIPsecGlobalQueueFullDropsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 17), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalQueueFullDropsV2.setStatus('current') hpnicfIPsecGlobalInvalidLenDropsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 18), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalInvalidLenDropsV2.setStatus('current') hpnicfIPsecGlobalTooLongDropsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 19), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalTooLongDropsV2.setStatus('current') hpnicfIPsecGlobalInvalidSaDropsV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 6, 20), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: hpnicfIPsecGlobalInvalidSaDropsV2.setStatus('current') hpnicfIPsecTrapObjectV2 = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 7)) hpnicfIPsecPolicyNameV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 7, 1), DisplayString()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfIPsecPolicyNameV2.setStatus('current') hpnicfIPsecPolicySeqNumV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 7, 2), Integer32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfIPsecPolicySeqNumV2.setStatus('current') hpnicfIPsecPolicySizeV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 7, 3), Integer32()).setMaxAccess("accessiblefornotify") if mibBuilder.loadTexts: hpnicfIPsecPolicySizeV2.setStatus('current') hpnicfIPsecTrapCntlV2 = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8)) hpnicfIPsecTrapGlobalCntlV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8, 1), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfIPsecTrapGlobalCntlV2.setStatus('current') hpnicfIPsecTunnelStartTrapCntlV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8, 2), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfIPsecTunnelStartTrapCntlV2.setStatus('current') hpnicfIPsecTunnelStopTrapCntlV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8, 3), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfIPsecTunnelStopTrapCntlV2.setStatus('current') hpnicfIPsecNoSaTrapCntlV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8, 4), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfIPsecNoSaTrapCntlV2.setStatus('current') hpnicfIPsecAuthFailureTrapCntlV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8, 5), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfIPsecAuthFailureTrapCntlV2.setStatus('current') hpnicfIPsecEncryFailureTrapCntlV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8, 6), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfIPsecEncryFailureTrapCntlV2.setStatus('current') hpnicfIPsecDecryFailureTrapCntlV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8, 7), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfIPsecDecryFailureTrapCntlV2.setStatus('current') hpnicfIPsecInvalidSaTrapCntlV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8, 8), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfIPsecInvalidSaTrapCntlV2.setStatus('current') hpnicfIPsecPolicyAddTrapCntlV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8, 9), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfIPsecPolicyAddTrapCntlV2.setStatus('current') hpnicfIPsecPolicyDelTrapCntlV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8, 10), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfIPsecPolicyDelTrapCntlV2.setStatus('current') hpnicfIPsecPolicyAttachTrapCntlV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8, 11), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfIPsecPolicyAttachTrapCntlV2.setStatus('current') hpnicfIPsecPolicyDetachTrapCntlV2 = MibScalar((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 8, 12), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: hpnicfIPsecPolicyDetachTrapCntlV2.setStatus('current') hpnicfIPsecTrapV2 = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9)) hpnicfIPsecNotificationsV2 = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9, 0)) hpnicfIPsecTunnelStartV2 = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9, 0, 1)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIndexV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLifeTimeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLifeSizeV2")) if mibBuilder.loadTexts: hpnicfIPsecTunnelStartV2.setStatus('current') hpnicfIPsecTunnelStopV2 = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9, 0, 2)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIndexV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunActiveTimeV2")) if mibBuilder.loadTexts: hpnicfIPsecTunnelStopV2.setStatus('current') hpnicfIPsecNoSaFailureV2 = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9, 0, 3)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIndexV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrV2")) if mibBuilder.loadTexts: hpnicfIPsecNoSaFailureV2.setStatus('current') hpnicfIPsecAuthFailFailureV2 = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9, 0, 4)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIndexV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrV2")) if mibBuilder.loadTexts: hpnicfIPsecAuthFailFailureV2.setStatus('current') hpnicfIPsecEncryFailFailureV2 = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9, 0, 5)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIndexV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrV2")) if mibBuilder.loadTexts: hpnicfIPsecEncryFailFailureV2.setStatus('current') hpnicfIPsecDecryFailFailureV2 = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9, 0, 6)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIndexV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrV2")) if mibBuilder.loadTexts: hpnicfIPsecDecryFailFailureV2.setStatus('current') hpnicfIPsecInvalidSaFailureV2 = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9, 0, 7)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIndexV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecSaIndexV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecSaSpiValueV2")) if mibBuilder.loadTexts: hpnicfIPsecInvalidSaFailureV2.setStatus('current') hpnicfIPsecPolicyAddV2 = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9, 0, 8)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyNameV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicySeqNumV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicySizeV2")) if mibBuilder.loadTexts: hpnicfIPsecPolicyAddV2.setStatus('current') hpnicfIPsecPolicyDelV2 = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9, 0, 9)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyNameV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicySeqNumV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicySizeV2")) if mibBuilder.loadTexts: hpnicfIPsecPolicyDelV2.setStatus('current') hpnicfIPsecPolicyAttachV2 = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9, 0, 10)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyNameV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicySizeV2"), ("IF-MIB", "ifIndex")) if mibBuilder.loadTexts: hpnicfIPsecPolicyAttachV2.setStatus('current') hpnicfIPsecPolicyDetachV2 = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 1, 9, 0, 11)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyNameV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicySizeV2"), ("IF-MIB", "ifIndex")) if mibBuilder.loadTexts: hpnicfIPsecPolicyDetachV2.setStatus('current') hpnicfIPsecConformanceV2 = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2)) hpnicfIPsecCompliancesV2 = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2, 1)) hpnicfIPsecGroupsV2 = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2, 2)) hpnicfIPsecComplianceV2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2, 1, 1)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecScalarObjectsGroupV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunnelTableGroupV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunnelStatGroupV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecSaGroupV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficTableGroupV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalStatsGroupV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrapObjectGroupV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrapCntlGroupV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrapGroupV2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfIPsecComplianceV2 = hpnicfIPsecComplianceV2.setStatus('current') hpnicfIPsecScalarObjectsGroupV2 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2, 2, 1)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecMIBVersion")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfIPsecScalarObjectsGroupV2 = hpnicfIPsecScalarObjectsGroupV2.setStatus('current') hpnicfIPsecTunnelTableGroupV2 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2, 2, 2)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIfIndexV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIKETunnelIndexV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIKETunLocalIDTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIKETunLocalIDVal1V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIKETunLocalIDVal2V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIKETunRemoteIDTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIKETunRemoteIDVal1V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunIKETunRemoteIDVal2V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLocalAddrV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemoteAddrV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunKeyTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunEncapModeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInitiatorV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLifeSizeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunLifeTimeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemainTimeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunActiveTimeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunRemainSizeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunTotalRefreshesV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunCurrentSaInstancesV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInSaEncryptAlgoV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInSaAhAuthAlgoV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInSaEspAuthAlgoV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunDiffHellmanGrpV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunOutSaEncryptAlgoV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunOutSaAhAuthAlgoV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunOutSaEspAuthAlgoV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunPolicyNameV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunPolicyNumV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunStatusV2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfIPsecTunnelTableGroupV2 = hpnicfIPsecTunnelTableGroupV2.setStatus('current') hpnicfIPsecTunnelStatGroupV2 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2, 2, 3)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInOctetsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInDecompOctetsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInPktsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInDropPktsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInReplayDropPktsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInAuthFailsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInDecryptFailsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunOutOctetsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunOutUncompOctetsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunOutPktsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunOutDropPktsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunOutEncryptFailsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunNoMemoryDropPktsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunQueueFullDropPktsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInvalidLenDropPktsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunTooLongDropPktsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunInvalidSaDropPktsV2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfIPsecTunnelStatGroupV2 = hpnicfIPsecTunnelStatGroupV2.setStatus('current') hpnicfIPsecSaGroupV2 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2, 2, 4)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecSaDirectionV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecSaSpiValueV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecSaSecProtocolV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecSaEncryptAlgoV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecSaAuthAlgoV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecSaStatusV2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfIPsecSaGroupV2 = hpnicfIPsecSaGroupV2.setStatus('current') hpnicfIPsecTrafficTableGroupV2 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2, 2, 5)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficLocalTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficLocalAddr1TypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficLocalAddr1V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficLocalAddr2TypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficLocalAddr2V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficLocalProtocol1V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficLocalProtocol2V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficLocalPort1V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficLocalPort2V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficRemoteTypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficRemAddr1TypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficRemAddr1V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficRemAddr2TypeV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficRemAddr2V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficRemoPro1V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficRemoPro2V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficRemPort1V2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrafficRemPort2V2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfIPsecTrafficTableGroupV2 = hpnicfIPsecTrafficTableGroupV2.setStatus('current') hpnicfIPsecGlobalStatsGroupV2 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2, 2, 6)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalActiveTunnelsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalActiveSasV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalInOctetsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalInDecompOctetsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalInPktsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalInDropsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalInReplayDropsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalInAuthFailsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalInDecryptFailsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalOutOctetsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalOutUncompOctetsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalOutPktsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalOutDropsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalOutEncryptFailsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalNoMemoryDropsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalNoFindSaDropsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalQueueFullDropsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalInvalidLenDropsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalTooLongDropsV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecGlobalInvalidSaDropsV2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfIPsecGlobalStatsGroupV2 = hpnicfIPsecGlobalStatsGroupV2.setStatus('current') hpnicfIPsecTrapObjectGroupV2 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2, 2, 7)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyNameV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicySeqNumV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicySizeV2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfIPsecTrapObjectGroupV2 = hpnicfIPsecTrapObjectGroupV2.setStatus('current') hpnicfIPsecTrapCntlGroupV2 = ObjectGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2, 2, 8)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTrapGlobalCntlV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunnelStartTrapCntlV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunnelStopTrapCntlV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecNoSaTrapCntlV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecAuthFailureTrapCntlV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecEncryFailureTrapCntlV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecDecryFailureTrapCntlV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecInvalidSaTrapCntlV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyAddTrapCntlV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyDelTrapCntlV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyAttachTrapCntlV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyDetachTrapCntlV2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfIPsecTrapCntlGroupV2 = hpnicfIPsecTrapCntlGroupV2.setStatus('current') hpnicfIPsecTrapGroupV2 = NotificationGroup((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 126, 2, 2, 9)).setObjects(("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunnelStartV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecTunnelStopV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecNoSaFailureV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecAuthFailFailureV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecEncryFailFailureV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecDecryFailFailureV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecInvalidSaFailureV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyAddV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyDelV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyAttachV2"), ("HPN-ICF-IPSEC-MONITOR-V2-MIB", "hpnicfIPsecPolicyDetachV2")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): hpnicfIPsecTrapGroupV2 = hpnicfIPsecTrapGroupV2.setStatus('current') mibBuilder.exportSymbols("HPN-ICF-IPSEC-MONITOR-V2-MIB", HpnicfIPsecSaProtocolV2=HpnicfIPsecSaProtocolV2, hpnicfIPsecTunInReplayDropPktsV2=hpnicfIPsecTunInReplayDropPktsV2, hpnicfIPsecTunnelStatV2Entry=hpnicfIPsecTunnelStatV2Entry, hpnicfIPsecTunTooLongDropPktsV2=hpnicfIPsecTunTooLongDropPktsV2, hpnicfIPsecTunnelTableGroupV2=hpnicfIPsecTunnelTableGroupV2, hpnicfIPsecTrafficRemoteTypeV2=hpnicfIPsecTrafficRemoteTypeV2, HpnicfIPsecAuthAlgoV2=HpnicfIPsecAuthAlgoV2, hpnicfIPsecTunOutPktsV2=hpnicfIPsecTunOutPktsV2, hpnicfIPsecNoSaFailureV2=hpnicfIPsecNoSaFailureV2, hpnicfIPsecEncryFailFailureV2=hpnicfIPsecEncryFailFailureV2, hpnicfIPsecTrafficLocalAddr2TypeV2=hpnicfIPsecTrafficLocalAddr2TypeV2, hpnicfIPsecSaDirectionV2=hpnicfIPsecSaDirectionV2, hpnicfIPsecTunTotalRefreshesV2=hpnicfIPsecTunTotalRefreshesV2, hpnicfIPsecTrafficLocalAddr2V2=hpnicfIPsecTrafficLocalAddr2V2, hpnicfIPsecPolicyAddV2=hpnicfIPsecPolicyAddV2, hpnicfIPsecSaAuthAlgoV2=hpnicfIPsecSaAuthAlgoV2, hpnicfIPsecGlobalOutPktsV2=hpnicfIPsecGlobalOutPktsV2, hpnicfIPsecTunNoMemoryDropPktsV2=hpnicfIPsecTunNoMemoryDropPktsV2, hpnicfIPsecTunLocalAddrTypeV2=hpnicfIPsecTunLocalAddrTypeV2, hpnicfIPsecDecryFailFailureV2=hpnicfIPsecDecryFailFailureV2, hpnicfIPsecSaGroupV2=hpnicfIPsecSaGroupV2, hpnicfIPsecTunOutUncompOctetsV2=hpnicfIPsecTunOutUncompOctetsV2, hpnicfIPsecTunInDecryptFailsV2=hpnicfIPsecTunInDecryptFailsV2, hpnicfIPsecTunInSaEspAuthAlgoV2=hpnicfIPsecTunInSaEspAuthAlgoV2, hpnicfIPsecGlobalInPktsV2=hpnicfIPsecGlobalInPktsV2, hpnicfIPsecGlobalOutEncryptFailsV2=hpnicfIPsecGlobalOutEncryptFailsV2, hpnicfIPsecGroupsV2=hpnicfIPsecGroupsV2, hpnicfIPsecPolicyNameV2=hpnicfIPsecPolicyNameV2, hpnicfIPsecTrafficRemAddr1TypeV2=hpnicfIPsecTrafficRemAddr1TypeV2, hpnicfIPsecTrafficRemPort1V2=hpnicfIPsecTrafficRemPort1V2, hpnicfIPsecMIBVersion=hpnicfIPsecMIBVersion, hpnicfIPsecTunIndexV2=hpnicfIPsecTunIndexV2, hpnicfIPsecTunnelStartV2=hpnicfIPsecTunnelStartV2, hpnicfIPsecGlobalInvalidSaDropsV2=hpnicfIPsecGlobalInvalidSaDropsV2, hpnicfIPsecTunRemainSizeV2=hpnicfIPsecTunRemainSizeV2, hpnicfIPsecTrafficRemAddr2TypeV2=hpnicfIPsecTrafficRemAddr2TypeV2, hpnicfIPsecTunInAuthFailsV2=hpnicfIPsecTunInAuthFailsV2, hpnicfIPsecGlobalTooLongDropsV2=hpnicfIPsecGlobalTooLongDropsV2, hpnicfIPsecInvalidSaTrapCntlV2=hpnicfIPsecInvalidSaTrapCntlV2, hpnicfIPsecTrafficRemPort2V2=hpnicfIPsecTrafficRemPort2V2, hpnicfIPsecGlobalInAuthFailsV2=hpnicfIPsecGlobalInAuthFailsV2, hpnicfIPsecTunOutDropPktsV2=hpnicfIPsecTunOutDropPktsV2, hpnicfIPsecPolicyAttachTrapCntlV2=hpnicfIPsecPolicyAttachTrapCntlV2, hpnicfIPsecTunDiffHellmanGrpV2=hpnicfIPsecTunDiffHellmanGrpV2, hpnicfIPsecTrafficLocalProtocol1V2=hpnicfIPsecTrafficLocalProtocol1V2, hpnicfIPsecTunnelV2Table=hpnicfIPsecTunnelV2Table, hpnicfIPsecTrapGroupV2=hpnicfIPsecTrapGroupV2, hpnicfIPsecTrafficRemAddr2V2=hpnicfIPsecTrafficRemAddr2V2, hpnicfIPsecTunQueueFullDropPktsV2=hpnicfIPsecTunQueueFullDropPktsV2, hpnicfIPsecTunKeyTypeV2=hpnicfIPsecTunKeyTypeV2, hpnicfIPsecTunInvalidSaDropPktsV2=hpnicfIPsecTunInvalidSaDropPktsV2, hpnicfIPsecGlobalOutUncompOctetsV2=hpnicfIPsecGlobalOutUncompOctetsV2, hpnicfIPsecTrafficTableGroupV2=hpnicfIPsecTrafficTableGroupV2, hpnicfIPsecTrafficRemoPro1V2=hpnicfIPsecTrafficRemoPro1V2, hpnicfIPsecTunPolicyNameV2=hpnicfIPsecTunPolicyNameV2, hpnicfIPsecTunInOctetsV2=hpnicfIPsecTunInOctetsV2, HpnicfIPsecDiffHellmanGrpV2=HpnicfIPsecDiffHellmanGrpV2, hpnicfIPsecSaIndexV2=hpnicfIPsecSaIndexV2, PYSNMP_MODULE_ID=hpnicfIPsecMonitorV2, hpnicfIPsecTunIfIndexV2=hpnicfIPsecTunIfIndexV2, hpnicfIPsecSaSecProtocolV2=hpnicfIPsecSaSecProtocolV2, hpnicfIPsecTunIKETunLocalIDVal1V2=hpnicfIPsecTunIKETunLocalIDVal1V2, hpnicfIPsecSaEncryptAlgoV2=hpnicfIPsecSaEncryptAlgoV2, hpnicfIPsecPolicySeqNumV2=hpnicfIPsecPolicySeqNumV2, hpnicfIPsecTunOutSaEncryptAlgoV2=hpnicfIPsecTunOutSaEncryptAlgoV2, hpnicfIPsecComplianceV2=hpnicfIPsecComplianceV2, hpnicfIPsecTunOutOctetsV2=hpnicfIPsecTunOutOctetsV2, hpnicfIPsecGlobalOutOctetsV2=hpnicfIPsecGlobalOutOctetsV2, hpnicfIPsecEncryFailureTrapCntlV2=hpnicfIPsecEncryFailureTrapCntlV2, hpnicfIPsecTunInDecompOctetsV2=hpnicfIPsecTunInDecompOctetsV2, hpnicfIPsecPolicyAttachV2=hpnicfIPsecPolicyAttachV2, hpnicfIPsecGlobalInOctetsV2=hpnicfIPsecGlobalInOctetsV2, hpnicfIPsecGlobalInReplayDropsV2=hpnicfIPsecGlobalInReplayDropsV2, hpnicfIPsecTunInSaEncryptAlgoV2=hpnicfIPsecTunInSaEncryptAlgoV2, hpnicfIPsecGlobalNoMemoryDropsV2=hpnicfIPsecGlobalNoMemoryDropsV2, hpnicfIPsecTrafficLocalAddr1V2=hpnicfIPsecTrafficLocalAddr1V2, hpnicfIPsecTrafficLocalAddr1TypeV2=hpnicfIPsecTrafficLocalAddr1TypeV2, hpnicfIPsecTunIKETunRemoteIDVal2V2=hpnicfIPsecTunIKETunRemoteIDVal2V2, hpnicfIPsecTunCurrentSaInstancesV2=hpnicfIPsecTunCurrentSaInstancesV2, hpnicfIPsecGlobalInDropsV2=hpnicfIPsecGlobalInDropsV2, hpnicfIPsecPolicyDelV2=hpnicfIPsecPolicyDelV2, hpnicfIPsecTrafficLocalPort1V2=hpnicfIPsecTrafficLocalPort1V2, hpnicfIPsecTunInvalidLenDropPktsV2=hpnicfIPsecTunInvalidLenDropPktsV2, hpnicfIPsecPolicyAddTrapCntlV2=hpnicfIPsecPolicyAddTrapCntlV2, hpnicfIPsecTrapV2=hpnicfIPsecTrapV2, hpnicfIPsecMonitorV2=hpnicfIPsecMonitorV2, hpnicfIPsecTrafficV2Table=hpnicfIPsecTrafficV2Table, hpnicfIPsecTunOutEncryptFailsV2=hpnicfIPsecTunOutEncryptFailsV2, hpnicfIPsecTrafficLocalTypeV2=hpnicfIPsecTrafficLocalTypeV2, hpnicfIPsecTrapObjectV2=hpnicfIPsecTrapObjectV2, hpnicfIPsecPolicyDetachV2=hpnicfIPsecPolicyDetachV2, hpnicfIPsecGlobalInvalidLenDropsV2=hpnicfIPsecGlobalInvalidLenDropsV2, hpnicfIPsecTunInSaAhAuthAlgoV2=hpnicfIPsecTunInSaAhAuthAlgoV2, hpnicfIPsecSaV2Table=hpnicfIPsecSaV2Table, hpnicfIPsecPolicySizeV2=hpnicfIPsecPolicySizeV2, hpnicfIPsecTunIKETunRemoteIDTypeV2=hpnicfIPsecTunIKETunRemoteIDTypeV2, hpnicfIPsecAuthFailureTrapCntlV2=hpnicfIPsecAuthFailureTrapCntlV2, hpnicfIPsecTunIKETunRemoteIDVal1V2=hpnicfIPsecTunIKETunRemoteIDVal1V2, hpnicfIPsecObjectsV2=hpnicfIPsecObjectsV2, hpnicfIPsecGlobalActiveSasV2=hpnicfIPsecGlobalActiveSasV2, hpnicfIPsecTunLifeSizeV2=hpnicfIPsecTunLifeSizeV2, hpnicfIPsecTrafficLocalProtocol2V2=hpnicfIPsecTrafficLocalProtocol2V2, hpnicfIPsecGlobalInDecompOctetsV2=hpnicfIPsecGlobalInDecompOctetsV2, hpnicfIPsecTrafficV2Entry=hpnicfIPsecTrafficV2Entry, HpnicfIPsecIDTypeV2=HpnicfIPsecIDTypeV2, hpnicfIPsecTunStatusV2=hpnicfIPsecTunStatusV2, hpnicfIPsecCompliancesV2=hpnicfIPsecCompliancesV2, HpnicfIPsecEncryptAlgoV2=HpnicfIPsecEncryptAlgoV2, hpnicfIPsecTrafficRemoPro2V2=hpnicfIPsecTrafficRemoPro2V2, hpnicfIPsecTrafficRemAddr1V2=hpnicfIPsecTrafficRemAddr1V2, hpnicfIPsecPolicyDelTrapCntlV2=hpnicfIPsecPolicyDelTrapCntlV2, hpnicfIPsecTunOutSaAhAuthAlgoV2=hpnicfIPsecTunOutSaAhAuthAlgoV2, hpnicfIPsecSaStatusV2=hpnicfIPsecSaStatusV2, hpnicfIPsecGlobalOutDropsV2=hpnicfIPsecGlobalOutDropsV2, hpnicfIPsecTunRemoteAddrTypeV2=hpnicfIPsecTunRemoteAddrTypeV2, hpnicfIPsecTrapObjectGroupV2=hpnicfIPsecTrapObjectGroupV2, hpnicfIPsecTunEncapModeV2=hpnicfIPsecTunEncapModeV2, hpnicfIPsecTunnelStatGroupV2=hpnicfIPsecTunnelStatGroupV2, hpnicfIPsecTunLifeTimeV2=hpnicfIPsecTunLifeTimeV2, hpnicfIPsecTunnelStopTrapCntlV2=hpnicfIPsecTunnelStopTrapCntlV2, hpnicfIPsecPolicyDetachTrapCntlV2=hpnicfIPsecPolicyDetachTrapCntlV2, hpnicfIPsecTunOutSaEspAuthAlgoV2=hpnicfIPsecTunOutSaEspAuthAlgoV2, HpnicfIPsecTrafficTypeV2=HpnicfIPsecTrafficTypeV2, hpnicfIPsecTunInitiatorV2=hpnicfIPsecTunInitiatorV2, hpnicfIPsecTunInPktsV2=hpnicfIPsecTunInPktsV2, hpnicfIPsecSaV2Entry=hpnicfIPsecSaV2Entry, hpnicfIPsecTunIKETunLocalIDVal2V2=hpnicfIPsecTunIKETunLocalIDVal2V2, hpnicfIPsecGlobalActiveTunnelsV2=hpnicfIPsecGlobalActiveTunnelsV2, hpnicfIPsecAuthFailFailureV2=hpnicfIPsecAuthFailFailureV2, hpnicfIPsecTunnelStatV2Table=hpnicfIPsecTunnelStatV2Table, hpnicfIPsecTunPolicyNumV2=hpnicfIPsecTunPolicyNumV2, hpnicfIPsecGlobalQueueFullDropsV2=hpnicfIPsecGlobalQueueFullDropsV2, HpnicfIPsecNegoTypeV2=HpnicfIPsecNegoTypeV2, hpnicfIPsecInvalidSaFailureV2=hpnicfIPsecInvalidSaFailureV2, hpnicfIPsecGlobalStatsGroupV2=hpnicfIPsecGlobalStatsGroupV2, hpnicfIPsecTunnelV2Entry=hpnicfIPsecTunnelV2Entry, hpnicfIPsecTunRemoteAddrV2=hpnicfIPsecTunRemoteAddrV2, HpnicfIPsecTunnelStateV2=HpnicfIPsecTunnelStateV2, hpnicfIPsecSaSpiValueV2=hpnicfIPsecSaSpiValueV2, hpnicfIPsecTunIKETunnelIndexV2=hpnicfIPsecTunIKETunnelIndexV2, hpnicfIPsecNoSaTrapCntlV2=hpnicfIPsecNoSaTrapCntlV2, hpnicfIPsecScalarObjectsGroupV2=hpnicfIPsecScalarObjectsGroupV2, hpnicfIPsecConformanceV2=hpnicfIPsecConformanceV2, hpnicfIPsecNotificationsV2=hpnicfIPsecNotificationsV2, HpnicfIPsecEncapModeV2=HpnicfIPsecEncapModeV2, hpnicfIPsecGlobalInDecryptFailsV2=hpnicfIPsecGlobalInDecryptFailsV2, hpnicfIPsecTrapCntlV2=hpnicfIPsecTrapCntlV2, hpnicfIPsecTunInDropPktsV2=hpnicfIPsecTunInDropPktsV2, hpnicfIPsecTunActiveTimeV2=hpnicfIPsecTunActiveTimeV2, hpnicfIPsecTrafficLocalPort2V2=hpnicfIPsecTrafficLocalPort2V2, hpnicfIPsecDecryFailureTrapCntlV2=hpnicfIPsecDecryFailureTrapCntlV2, hpnicfIPsecTrapGlobalCntlV2=hpnicfIPsecTrapGlobalCntlV2, hpnicfIPsecTunRemainTimeV2=hpnicfIPsecTunRemainTimeV2, hpnicfIPsecTrapCntlGroupV2=hpnicfIPsecTrapCntlGroupV2, hpnicfIPsecScalarObjectsV2=hpnicfIPsecScalarObjectsV2, hpnicfIPsecTunLocalAddrV2=hpnicfIPsecTunLocalAddrV2, hpnicfIPsecGlobalStatsV2=hpnicfIPsecGlobalStatsV2, hpnicfIPsecTunnelStartTrapCntlV2=hpnicfIPsecTunnelStartTrapCntlV2, hpnicfIPsecGlobalNoFindSaDropsV2=hpnicfIPsecGlobalNoFindSaDropsV2, hpnicfIPsecTunIKETunLocalIDTypeV2=hpnicfIPsecTunIKETunLocalIDTypeV2, hpnicfIPsecTunnelStopV2=hpnicfIPsecTunnelStopV2)
# You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition: # struct Node { # int val; # Node *left; # Node *right; # Node *next; # } # Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL. # Initially, all next pointers are set to NULL. # NOTE: Leetcode asks for soln using O(1) space. Look at leetcode discussions for this soln. class Node: def __init__(self, val, left, right, next): self.val = val self.left = left self.right = right self.next = next class Solution: def connect(self, root: 'Node') -> 'Node': if not root: return None cur = root level, nextLevel = [cur], [] while level: for i in range(0, len(level) - 1): level[i].next = level[i + 1] for node in level: if node.left: nextLevel.append(node.left) if node.right: nextLevel.append(node.right) level = nextLevel nextLevel = [] return root
while 1: while 1: while 1: break break break
class Edge: def __init__(self, src, dest, cost, vertex1, vertex2, wasser_cost=0): self.src = src self.dest = dest self.cost = cost self.vertex1 = vertex1 self.vertex2 = vertex2 self.wasser_cost = wasser_cost
# Alexis Cumpstone # Created: 2019 #This program extracts the coded word from the given string and prints, on #one line, the word in all uppercase, all lowercase and in reverse. encoded = "absbpstokyhopwok" #Extract every 4th character from the string to form the 4 letter word decoded = encoded[3::4] wordAllUpper = decoded.upper() wordAllLower = decoded.lower() wordReverse = decoded[::-1] print(wordAllUpper, wordAllLower, wordReverse)
#!/usr/bin/python3 def no_c(my_string): str = "" for i in my_string[:]: if i != 'c' and i != 'C': str += i return (str)
# Funktion: max def list_max(my_list): result = my_list[0] for i in range(1, len(my_list)): wert = my_list[i] if wert > result: result = wert return result # Liste l1 = [-2, 1, -10] l2 = [-20, 123, 22] # Funktionsaufruf l1_max = list_max(l1) l2_max = list_max(l2)
''' +------+-------+----------------+ | Item | Price | Special offers | +------+-------+----------------+ | A | 50 | 3A for 130 | | B | 30 | 2B for 45 | | C | 20 | | | D | 15 | | +------+-------+----------------+ ''' def get_skus(): return { 'A': {'price':50, 'offers': [{'amount': 3, 'price': 130}]}, 'B': {'price':30, 'offers': [{'amount': 2, 'price': 45}]}, 'C': {'price':20, 'offers': []}, 'D': {'price':15, 'offers': []} } # noinspection PyUnusedLocal # skus = unicode string def checkout(basket): skus = get_skus() if list(set(basket) - set(skus.keys())): return -1 total_price = 0 for (sku, options) in skus.iteritems(): amount = basket.count(sku) for offer in options['offers']: while offer['amount'] <= amount: total_price += offer['price'] amount -= offer['amount'] total_price += amount * options['price'] return total_price
## @package fib # # @author cognocoder. # Fibonacci glued between Python and C++. ## Fibonacci list. # @param n specifies the size of the list. # @returns Returns a Fibonacci list with n elements. # @throws ValeuError for negative values of n. # @see {@link #fib.ifib ifib}, {@link #fib.bfib bfib}. def fib(n): try: return ifib(n) except TypeError: return ifib(int(n)) ## Recursive Fibonacci list. # @param n specifies the size of the list. # @returns Returns a Fibonacci list with n elements. # @throws ValeuError for negative values of n. # @see {@link #fib.bfib bfib}. def ifib(n): arr = bfib(n) if n < 3: return arr while len(arr) < n: arr.append(arr[-2] + arr[-1]) return arr ## Base Fibonacci list. # @param n specifies the size of the list. # @return Returns a base Fibonacci list. # @throws ValeuError for negative values of n. def bfib(n): if n < 0: raise ValueError("n must be a positve integer") arr = [] if n == 0: return arr arr.append(0) if n == 1: return arr # Base list size limit reached arr.append(1) return arr
class console: def log(*args, **kwargs): print(*args, **kwargs) console.log("Hello World")
# Number of terms till which the sequence needs to be printed n = int(input()) a, b = 1, 1 count = 0 # We need to first check if the number is prime or not def ifprime(n): if n> 1: for i in range(2, n// 2 + 1): if (n % i) == 0: return False else: return True else: return False if n == 1: print("Fibonacci sequence upto", n, ":") print(a) else: while count < n: if not ifprime(n1) and a % 5 != 0: print(a, end=' ') else: print(0, end=' ') sums = a + b a = b b = sums count += 1
def c(sr=False, sy=False, e=False): """ -> Cores vermelha e amarela :param sr: start red(começo vermelho) :param sy: start yellow(começo amarelo) :param e: end(fim) :return: codigo de começo e fim de cor """ if sr: return '\033[0;31m' if sy: return '\033[0;33m' if e: return '\033[m' def leia_int(msg): """ -> Func que remplaza o int() e valida o mesmo. :param msg: input (descrição que mostra na tela) :return: o valor em int() do usuario. """ while True: numero = input(msg) if numero.isdigit(): valor = int(numero) break else: print(f'{c(sr=True)}Erro!{c(e=True)} {c(sy=True)}{numero}{c(e=True)} {c(sr=True)}Não é valido! {c(e=True)}') return valor n = leia_int('Digite um número: ') print(f'Você digitou o número {n}')
class A(object): __doc__ = 16 print(A.__doc__) # <ref>