content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
global output
class Logger:
@staticmethod
def set_logger(cheat_output):
global output
output = cheat_output
@staticmethod
def log(s):
output(s)
@staticmethod
def print_str(s):
n = 500 # chunk length
chunks = [s[i:i+n] for i in range(0, len(s), n)]
for c in chunks:
Logger.log(c)
| global output
class Logger:
@staticmethod
def set_logger(cheat_output):
global output
output = cheat_output
@staticmethod
def log(s):
output(s)
@staticmethod
def print_str(s):
n = 500
chunks = [s[i:i + n] for i in range(0, len(s), n)]
for c in chunks:
Logger.log(c) |
# WHILE LOOP
#
# In this problem, write a function named "my_while_loop" that accepts an
# iterable of strings as a parameter and returns a new list with strings from
# the original list that are longer than five characters.
#
# The function must use a while loop in its implementation.
# TEST DATA
# test = ["nope", "yes this one", "not", "uhuh", "here's one", "narp"]
# print(my_while_loop(test)) # > ["yes this one", "here's one"]
#
# test = ["plop", "", "drop", "zop", "stop"]
# print(my_while_loop(test)) # > []
#
# test = []
# print(my_while_loop(test)) # > []
#NOTES:
# (method) append: (__object: Any) -> None :Append object to the end of the list.
# len: [ function ] Return the number of items in a container.
# (function) len: (__obj: Sized) -> int
# the list, which can be written as a list of comma-separated values (items) between square brackets.
# Lists might contain items of different types,
# but usually the items all have the same type.
squares = [1, 4, 9, 16, 25]
#Like strings (and all other built-in sequence types),
# lists can be indexed and sliced:
print(squares[0]) # indexing returns the item
print(squares[-1])
# [Running] python -u "c:\Users\15512\Google Drive\a-A-September\misc\Non-App-Academy-Exploration\python\my-intro-BG\0Intro2Python-all.py"
# 1
# 25
#**********************************************************************
# def my_while_loop(lst):# (function) my_while_loop: (lst) -> List
# new_lst = [] # (variable) new_lst: List
# i = 0
# while i < len(lst):
# if len(lst[i]) > 5:
# new_lst.append(lst[i])
#
# i += 1
# print("i",i)
# return new_lst
#
#
# test = ["nope", "yes this one", "not", "uhuh", "here's one", "narp"]
# print(my_while_loop(test))
#
# test = ["plop", "", "drop", "zop", "stop"]
# print(my_while_loop(test))
#
# test = []
# print(my_while_loop(test))
# [Running] python -u "c:\Users\15512\Google Drive\a-A-September\misc\Non-App-Academy-Exploration\python\my-intro-BG\0Intro2Python-all.py"
# 1
# 25
# i 1
# i 2
# i 3
# i 4
# i 5
# i 6
# ['yes this one', "here's one"]
# i 1
# i 2
# i 3
# i 4
# i 5
# []
# []
#*****************************************************************************
# FOR LOOP
#
# In this problem, write a function named "my_for_loop" that accepts an
# iterable of strings as a parameter and returns a new list with strings from
# the original list that are longer than five characters. The function must use
# a for loop in its implementation.
#
print("---------------------------------------------------------------")
# WRITE YOUR FUNCTION HERE
def my_for_loop(lst):
new_lst = []
for item in lst:
if len(item) > 5:
new_lst.append(item)
return new_lst
# TEST DATA
test = ["nope", "yes this one", "not", "uhuh", "here's one", "narp"]
print(my_for_loop(test)) # > ["yes this one", "here's one"]
test = ["plop", "", "drop", "zop", "stop"]
print(my_for_loop(test)) # > []
test = []
print(my_for_loop(test)) # > []
| squares = [1, 4, 9, 16, 25]
print(squares[0])
print(squares[-1])
print('---------------------------------------------------------------')
def my_for_loop(lst):
new_lst = []
for item in lst:
if len(item) > 5:
new_lst.append(item)
return new_lst
test = ['nope', 'yes this one', 'not', 'uhuh', "here's one", 'narp']
print(my_for_loop(test))
test = ['plop', '', 'drop', 'zop', 'stop']
print(my_for_loop(test))
test = []
print(my_for_loop(test)) |
# -*- coding: utf-8 -*-
# Encrypt key
modulus = '00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92557c93870114af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d3e82047b97ddef52741d546b8e289dc6935b3ece0462db0a22b8e7'
nonce = '0CoJUm6Qyw8W8jud'
pub_key = '010001'
headers = {
'Accept': '*/*',
'Host': 'music.163.com',
'User-Agent': 'curl/7.51.0',
'Referer': 'http://music.163.com',
'Cookie': 'appver=2.0.2'
}
song_download_url = 'http://music.163.com/weapi/song/enhance/player/url?csrf_token='
def get_song_url(song_id):
return 'http://music.163.com/api/song/detail/?ids=[{}]'.format(song_id)
def get_album_url(album_id):
return 'http://music.163.com/api/album/{}/'.format(album_id)
def get_artist_url(artist_id):
return 'http://music.163.com/api/artist/{}'.format(artist_id)
def get_playlist_url(playlist_id):
return 'http://music.163.com/api/playlist/detail?id={}'.format(playlist_id)
| modulus = '00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92557c93870114af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d3e82047b97ddef52741d546b8e289dc6935b3ece0462db0a22b8e7'
nonce = '0CoJUm6Qyw8W8jud'
pub_key = '010001'
headers = {'Accept': '*/*', 'Host': 'music.163.com', 'User-Agent': 'curl/7.51.0', 'Referer': 'http://music.163.com', 'Cookie': 'appver=2.0.2'}
song_download_url = 'http://music.163.com/weapi/song/enhance/player/url?csrf_token='
def get_song_url(song_id):
return 'http://music.163.com/api/song/detail/?ids=[{}]'.format(song_id)
def get_album_url(album_id):
return 'http://music.163.com/api/album/{}/'.format(album_id)
def get_artist_url(artist_id):
return 'http://music.163.com/api/artist/{}'.format(artist_id)
def get_playlist_url(playlist_id):
return 'http://music.163.com/api/playlist/detail?id={}'.format(playlist_id) |
# https://leetcode.com/problems/single-number/
# Given a non-empty array of integers nums, every element appears twice except for
# one. Find that single one.
# You must implement a solution with a linear runtime complexity and use only
# constant extra space.
################################################################################
# use XOR: a^a = 0
class Solution:
def singleNumber(self, nums: List[int]) -> int:
if not nums or len(nums) == 0: return 0
ans = nums[0]
for i in range(1, len(nums)):
ans ^= nums[i]
return ans
| class Solution:
def single_number(self, nums: List[int]) -> int:
if not nums or len(nums) == 0:
return 0
ans = nums[0]
for i in range(1, len(nums)):
ans ^= nums[i]
return ans |
# Copyright 2019 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
# This file is automatically generated by mkgrokdump and should not
# be modified manually.
# List of known V8 instance types.
INSTANCE_TYPES = {
0: "INTERNALIZED_STRING_TYPE",
2: "EXTERNAL_INTERNALIZED_STRING_TYPE",
8: "ONE_BYTE_INTERNALIZED_STRING_TYPE",
10: "EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE",
18: "UNCACHED_EXTERNAL_INTERNALIZED_STRING_TYPE",
26: "UNCACHED_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE",
32: "STRING_TYPE",
33: "CONS_STRING_TYPE",
34: "EXTERNAL_STRING_TYPE",
35: "SLICED_STRING_TYPE",
37: "THIN_STRING_TYPE",
40: "ONE_BYTE_STRING_TYPE",
41: "CONS_ONE_BYTE_STRING_TYPE",
42: "EXTERNAL_ONE_BYTE_STRING_TYPE",
43: "SLICED_ONE_BYTE_STRING_TYPE",
45: "THIN_ONE_BYTE_STRING_TYPE",
50: "UNCACHED_EXTERNAL_STRING_TYPE",
58: "UNCACHED_EXTERNAL_ONE_BYTE_STRING_TYPE",
64: "SYMBOL_TYPE",
65: "BIG_INT_BASE_TYPE",
66: "HEAP_NUMBER_TYPE",
67: "ODDBALL_TYPE",
68: "EXPORTED_SUB_CLASS_BASE_TYPE",
69: "EXPORTED_SUB_CLASS_TYPE",
70: "FOREIGN_TYPE",
71: "PROMISE_FULFILL_REACTION_JOB_TASK_TYPE",
72: "PROMISE_REJECT_REACTION_JOB_TASK_TYPE",
73: "CALLABLE_TASK_TYPE",
74: "CALLBACK_TASK_TYPE",
75: "PROMISE_RESOLVE_THENABLE_JOB_TASK_TYPE",
76: "LOAD_HANDLER_TYPE",
77: "STORE_HANDLER_TYPE",
78: "FUNCTION_TEMPLATE_INFO_TYPE",
79: "OBJECT_TEMPLATE_INFO_TYPE",
80: "ACCESS_CHECK_INFO_TYPE",
81: "ACCESSOR_INFO_TYPE",
82: "ACCESSOR_PAIR_TYPE",
83: "ALIASED_ARGUMENTS_ENTRY_TYPE",
84: "ALLOCATION_MEMENTO_TYPE",
85: "ALLOCATION_SITE_TYPE",
86: "ARRAY_BOILERPLATE_DESCRIPTION_TYPE",
87: "ASM_WASM_DATA_TYPE",
88: "ASYNC_GENERATOR_REQUEST_TYPE",
89: "BREAK_POINT_TYPE",
90: "BREAK_POINT_INFO_TYPE",
91: "CACHED_TEMPLATE_OBJECT_TYPE",
92: "CALL_HANDLER_INFO_TYPE",
93: "CLASS_POSITIONS_TYPE",
94: "DEBUG_INFO_TYPE",
95: "ENUM_CACHE_TYPE",
96: "FEEDBACK_CELL_TYPE",
97: "FUNCTION_TEMPLATE_RARE_DATA_TYPE",
98: "INTERCEPTOR_INFO_TYPE",
99: "INTERPRETER_DATA_TYPE",
100: "PROMISE_CAPABILITY_TYPE",
101: "PROMISE_REACTION_TYPE",
102: "PROPERTY_DESCRIPTOR_OBJECT_TYPE",
103: "PROTOTYPE_INFO_TYPE",
104: "SCRIPT_TYPE",
105: "SOURCE_TEXT_MODULE_INFO_ENTRY_TYPE",
106: "STACK_FRAME_INFO_TYPE",
107: "STACK_TRACE_FRAME_TYPE",
108: "TEMPLATE_OBJECT_DESCRIPTION_TYPE",
109: "TUPLE2_TYPE",
110: "WASM_CAPI_FUNCTION_DATA_TYPE",
111: "WASM_DEBUG_INFO_TYPE",
112: "WASM_EXCEPTION_TAG_TYPE",
113: "WASM_EXPORTED_FUNCTION_DATA_TYPE",
114: "WASM_INDIRECT_FUNCTION_TABLE_TYPE",
115: "WASM_JS_FUNCTION_DATA_TYPE",
116: "FIXED_ARRAY_TYPE",
117: "HASH_TABLE_TYPE",
118: "EPHEMERON_HASH_TABLE_TYPE",
119: "GLOBAL_DICTIONARY_TYPE",
120: "NAME_DICTIONARY_TYPE",
121: "NUMBER_DICTIONARY_TYPE",
122: "ORDERED_HASH_MAP_TYPE",
123: "ORDERED_HASH_SET_TYPE",
124: "ORDERED_NAME_DICTIONARY_TYPE",
125: "SIMPLE_NUMBER_DICTIONARY_TYPE",
126: "STRING_TABLE_TYPE",
127: "CLOSURE_FEEDBACK_CELL_ARRAY_TYPE",
128: "OBJECT_BOILERPLATE_DESCRIPTION_TYPE",
129: "SCOPE_INFO_TYPE",
130: "SCRIPT_CONTEXT_TABLE_TYPE",
131: "BYTE_ARRAY_TYPE",
132: "BYTECODE_ARRAY_TYPE",
133: "FIXED_DOUBLE_ARRAY_TYPE",
134: "INTERNAL_CLASS_WITH_SMI_ELEMENTS_TYPE",
135: "AWAIT_CONTEXT_TYPE",
136: "BLOCK_CONTEXT_TYPE",
137: "CATCH_CONTEXT_TYPE",
138: "DEBUG_EVALUATE_CONTEXT_TYPE",
139: "EVAL_CONTEXT_TYPE",
140: "FUNCTION_CONTEXT_TYPE",
141: "MODULE_CONTEXT_TYPE",
142: "NATIVE_CONTEXT_TYPE",
143: "SCRIPT_CONTEXT_TYPE",
144: "WITH_CONTEXT_TYPE",
145: "SMALL_ORDERED_HASH_MAP_TYPE",
146: "SMALL_ORDERED_HASH_SET_TYPE",
147: "SMALL_ORDERED_NAME_DICTIONARY_TYPE",
148: "SOURCE_TEXT_MODULE_TYPE",
149: "SYNTHETIC_MODULE_TYPE",
150: "UNCOMPILED_DATA_WITH_PREPARSE_DATA_TYPE",
151: "UNCOMPILED_DATA_WITHOUT_PREPARSE_DATA_TYPE",
152: "WEAK_FIXED_ARRAY_TYPE",
153: "TRANSITION_ARRAY_TYPE",
154: "CELL_TYPE",
155: "CODE_TYPE",
156: "CODE_DATA_CONTAINER_TYPE",
157: "COVERAGE_INFO_TYPE",
158: "DESCRIPTOR_ARRAY_TYPE",
159: "EMBEDDER_DATA_ARRAY_TYPE",
160: "FEEDBACK_METADATA_TYPE",
161: "FEEDBACK_VECTOR_TYPE",
162: "FILLER_TYPE",
163: "FREE_SPACE_TYPE",
164: "INTERNAL_CLASS_TYPE",
165: "INTERNAL_CLASS_WITH_STRUCT_ELEMENTS_TYPE",
166: "MAP_TYPE",
167: "PREPARSE_DATA_TYPE",
168: "PROPERTY_ARRAY_TYPE",
169: "PROPERTY_CELL_TYPE",
170: "SHARED_FUNCTION_INFO_TYPE",
171: "SMI_BOX_TYPE",
172: "SMI_PAIR_TYPE",
173: "SORT_STATE_TYPE",
174: "WEAK_ARRAY_LIST_TYPE",
175: "WEAK_CELL_TYPE",
176: "JS_PROXY_TYPE",
1057: "JS_OBJECT_TYPE",
177: "JS_GLOBAL_OBJECT_TYPE",
178: "JS_GLOBAL_PROXY_TYPE",
179: "JS_MODULE_NAMESPACE_TYPE",
1040: "JS_SPECIAL_API_OBJECT_TYPE",
1041: "JS_PRIMITIVE_WRAPPER_TYPE",
1042: "JS_MAP_KEY_ITERATOR_TYPE",
1043: "JS_MAP_KEY_VALUE_ITERATOR_TYPE",
1044: "JS_MAP_VALUE_ITERATOR_TYPE",
1045: "JS_SET_KEY_VALUE_ITERATOR_TYPE",
1046: "JS_SET_VALUE_ITERATOR_TYPE",
1047: "JS_GENERATOR_OBJECT_TYPE",
1048: "JS_ASYNC_FUNCTION_OBJECT_TYPE",
1049: "JS_ASYNC_GENERATOR_OBJECT_TYPE",
1050: "JS_DATA_VIEW_TYPE",
1051: "JS_TYPED_ARRAY_TYPE",
1052: "JS_MAP_TYPE",
1053: "JS_SET_TYPE",
1054: "JS_WEAK_MAP_TYPE",
1055: "JS_WEAK_SET_TYPE",
1056: "JS_API_OBJECT_TYPE",
1058: "JS_ARGUMENTS_OBJECT_TYPE",
1059: "JS_ARRAY_TYPE",
1060: "JS_ARRAY_BUFFER_TYPE",
1061: "JS_ARRAY_ITERATOR_TYPE",
1062: "JS_ASYNC_FROM_SYNC_ITERATOR_TYPE",
1063: "JS_COLLATOR_TYPE",
1064: "JS_CONTEXT_EXTENSION_OBJECT_TYPE",
1065: "JS_DATE_TYPE",
1066: "JS_DATE_TIME_FORMAT_TYPE",
1067: "JS_DISPLAY_NAMES_TYPE",
1068: "JS_ERROR_TYPE",
1069: "JS_FINALIZATION_REGISTRY_TYPE",
1070: "JS_FINALIZATION_REGISTRY_CLEANUP_ITERATOR_TYPE",
1071: "JS_LIST_FORMAT_TYPE",
1072: "JS_LOCALE_TYPE",
1073: "JS_MESSAGE_OBJECT_TYPE",
1074: "JS_NUMBER_FORMAT_TYPE",
1075: "JS_PLURAL_RULES_TYPE",
1076: "JS_PROMISE_TYPE",
1077: "JS_REG_EXP_TYPE",
1078: "JS_REG_EXP_STRING_ITERATOR_TYPE",
1079: "JS_RELATIVE_TIME_FORMAT_TYPE",
1080: "JS_SEGMENT_ITERATOR_TYPE",
1081: "JS_SEGMENTER_TYPE",
1082: "JS_STRING_ITERATOR_TYPE",
1083: "JS_V8_BREAK_ITERATOR_TYPE",
1084: "JS_WEAK_REF_TYPE",
1085: "WASM_EXCEPTION_OBJECT_TYPE",
1086: "WASM_GLOBAL_OBJECT_TYPE",
1087: "WASM_INSTANCE_OBJECT_TYPE",
1088: "WASM_MEMORY_OBJECT_TYPE",
1089: "WASM_MODULE_OBJECT_TYPE",
1090: "WASM_TABLE_OBJECT_TYPE",
1091: "JS_BOUND_FUNCTION_TYPE",
1092: "JS_FUNCTION_TYPE",
}
# List of known V8 maps.
KNOWN_MAPS = {
("read_only_space", 0x00121): (163, "FreeSpaceMap"),
("read_only_space", 0x00149): (166, "MetaMap"),
("read_only_space", 0x0018d): (67, "NullMap"),
("read_only_space", 0x001c5): (158, "DescriptorArrayMap"),
("read_only_space", 0x001f5): (152, "WeakFixedArrayMap"),
("read_only_space", 0x0021d): (162, "OnePointerFillerMap"),
("read_only_space", 0x00245): (162, "TwoPointerFillerMap"),
("read_only_space", 0x00289): (67, "UninitializedMap"),
("read_only_space", 0x002cd): (8, "OneByteInternalizedStringMap"),
("read_only_space", 0x00329): (67, "UndefinedMap"),
("read_only_space", 0x0035d): (66, "HeapNumberMap"),
("read_only_space", 0x003a1): (67, "TheHoleMap"),
("read_only_space", 0x00401): (67, "BooleanMap"),
("read_only_space", 0x00489): (131, "ByteArrayMap"),
("read_only_space", 0x004b1): (116, "FixedArrayMap"),
("read_only_space", 0x004d9): (116, "FixedCOWArrayMap"),
("read_only_space", 0x00501): (117, "HashTableMap"),
("read_only_space", 0x00529): (64, "SymbolMap"),
("read_only_space", 0x00551): (40, "OneByteStringMap"),
("read_only_space", 0x00579): (129, "ScopeInfoMap"),
("read_only_space", 0x005a1): (170, "SharedFunctionInfoMap"),
("read_only_space", 0x005c9): (155, "CodeMap"),
("read_only_space", 0x005f1): (154, "CellMap"),
("read_only_space", 0x00619): (169, "GlobalPropertyCellMap"),
("read_only_space", 0x00641): (70, "ForeignMap"),
("read_only_space", 0x00669): (153, "TransitionArrayMap"),
("read_only_space", 0x00691): (45, "ThinOneByteStringMap"),
("read_only_space", 0x006b9): (161, "FeedbackVectorMap"),
("read_only_space", 0x0070d): (67, "ArgumentsMarkerMap"),
("read_only_space", 0x0076d): (67, "ExceptionMap"),
("read_only_space", 0x007c9): (67, "TerminationExceptionMap"),
("read_only_space", 0x00831): (67, "OptimizedOutMap"),
("read_only_space", 0x00891): (67, "StaleRegisterMap"),
("read_only_space", 0x008d5): (130, "ScriptContextTableMap"),
("read_only_space", 0x008fd): (127, "ClosureFeedbackCellArrayMap"),
("read_only_space", 0x00925): (160, "FeedbackMetadataArrayMap"),
("read_only_space", 0x0094d): (116, "ArrayListMap"),
("read_only_space", 0x00975): (65, "BigIntMap"),
("read_only_space", 0x0099d): (128, "ObjectBoilerplateDescriptionMap"),
("read_only_space", 0x009c5): (132, "BytecodeArrayMap"),
("read_only_space", 0x009ed): (156, "CodeDataContainerMap"),
("read_only_space", 0x00a15): (157, "CoverageInfoMap"),
("read_only_space", 0x00a3d): (133, "FixedDoubleArrayMap"),
("read_only_space", 0x00a65): (119, "GlobalDictionaryMap"),
("read_only_space", 0x00a8d): (96, "ManyClosuresCellMap"),
("read_only_space", 0x00ab5): (116, "ModuleInfoMap"),
("read_only_space", 0x00add): (120, "NameDictionaryMap"),
("read_only_space", 0x00b05): (96, "NoClosuresCellMap"),
("read_only_space", 0x00b2d): (121, "NumberDictionaryMap"),
("read_only_space", 0x00b55): (96, "OneClosureCellMap"),
("read_only_space", 0x00b7d): (122, "OrderedHashMapMap"),
("read_only_space", 0x00ba5): (123, "OrderedHashSetMap"),
("read_only_space", 0x00bcd): (124, "OrderedNameDictionaryMap"),
("read_only_space", 0x00bf5): (167, "PreparseDataMap"),
("read_only_space", 0x00c1d): (168, "PropertyArrayMap"),
("read_only_space", 0x00c45): (92, "SideEffectCallHandlerInfoMap"),
("read_only_space", 0x00c6d): (92, "SideEffectFreeCallHandlerInfoMap"),
("read_only_space", 0x00c95): (92, "NextCallSideEffectFreeCallHandlerInfoMap"),
("read_only_space", 0x00cbd): (125, "SimpleNumberDictionaryMap"),
("read_only_space", 0x00ce5): (116, "SloppyArgumentsElementsMap"),
("read_only_space", 0x00d0d): (145, "SmallOrderedHashMapMap"),
("read_only_space", 0x00d35): (146, "SmallOrderedHashSetMap"),
("read_only_space", 0x00d5d): (147, "SmallOrderedNameDictionaryMap"),
("read_only_space", 0x00d85): (148, "SourceTextModuleMap"),
("read_only_space", 0x00dad): (126, "StringTableMap"),
("read_only_space", 0x00dd5): (149, "SyntheticModuleMap"),
("read_only_space", 0x00dfd): (151, "UncompiledDataWithoutPreparseDataMap"),
("read_only_space", 0x00e25): (150, "UncompiledDataWithPreparseDataMap"),
("read_only_space", 0x00e4d): (174, "WeakArrayListMap"),
("read_only_space", 0x00e75): (118, "EphemeronHashTableMap"),
("read_only_space", 0x00e9d): (159, "EmbedderDataArrayMap"),
("read_only_space", 0x00ec5): (175, "WeakCellMap"),
("read_only_space", 0x00eed): (32, "StringMap"),
("read_only_space", 0x00f15): (41, "ConsOneByteStringMap"),
("read_only_space", 0x00f3d): (33, "ConsStringMap"),
("read_only_space", 0x00f65): (37, "ThinStringMap"),
("read_only_space", 0x00f8d): (35, "SlicedStringMap"),
("read_only_space", 0x00fb5): (43, "SlicedOneByteStringMap"),
("read_only_space", 0x00fdd): (34, "ExternalStringMap"),
("read_only_space", 0x01005): (42, "ExternalOneByteStringMap"),
("read_only_space", 0x0102d): (50, "UncachedExternalStringMap"),
("read_only_space", 0x01055): (0, "InternalizedStringMap"),
("read_only_space", 0x0107d): (2, "ExternalInternalizedStringMap"),
("read_only_space", 0x010a5): (10, "ExternalOneByteInternalizedStringMap"),
("read_only_space", 0x010cd): (18, "UncachedExternalInternalizedStringMap"),
("read_only_space", 0x010f5): (26, "UncachedExternalOneByteInternalizedStringMap"),
("read_only_space", 0x0111d): (58, "UncachedExternalOneByteStringMap"),
("read_only_space", 0x01145): (67, "SelfReferenceMarkerMap"),
("read_only_space", 0x01179): (95, "EnumCacheMap"),
("read_only_space", 0x011c9): (86, "ArrayBoilerplateDescriptionMap"),
("read_only_space", 0x012c5): (98, "InterceptorInfoMap"),
("read_only_space", 0x032e5): (71, "PromiseFulfillReactionJobTaskMap"),
("read_only_space", 0x0330d): (72, "PromiseRejectReactionJobTaskMap"),
("read_only_space", 0x03335): (73, "CallableTaskMap"),
("read_only_space", 0x0335d): (74, "CallbackTaskMap"),
("read_only_space", 0x03385): (75, "PromiseResolveThenableJobTaskMap"),
("read_only_space", 0x033ad): (78, "FunctionTemplateInfoMap"),
("read_only_space", 0x033d5): (79, "ObjectTemplateInfoMap"),
("read_only_space", 0x033fd): (80, "AccessCheckInfoMap"),
("read_only_space", 0x03425): (81, "AccessorInfoMap"),
("read_only_space", 0x0344d): (82, "AccessorPairMap"),
("read_only_space", 0x03475): (83, "AliasedArgumentsEntryMap"),
("read_only_space", 0x0349d): (84, "AllocationMementoMap"),
("read_only_space", 0x034c5): (87, "AsmWasmDataMap"),
("read_only_space", 0x034ed): (88, "AsyncGeneratorRequestMap"),
("read_only_space", 0x03515): (89, "BreakPointMap"),
("read_only_space", 0x0353d): (90, "BreakPointInfoMap"),
("read_only_space", 0x03565): (91, "CachedTemplateObjectMap"),
("read_only_space", 0x0358d): (93, "ClassPositionsMap"),
("read_only_space", 0x035b5): (94, "DebugInfoMap"),
("read_only_space", 0x035dd): (97, "FunctionTemplateRareDataMap"),
("read_only_space", 0x03605): (99, "InterpreterDataMap"),
("read_only_space", 0x0362d): (100, "PromiseCapabilityMap"),
("read_only_space", 0x03655): (101, "PromiseReactionMap"),
("read_only_space", 0x0367d): (102, "PropertyDescriptorObjectMap"),
("read_only_space", 0x036a5): (103, "PrototypeInfoMap"),
("read_only_space", 0x036cd): (104, "ScriptMap"),
("read_only_space", 0x036f5): (105, "SourceTextModuleInfoEntryMap"),
("read_only_space", 0x0371d): (106, "StackFrameInfoMap"),
("read_only_space", 0x03745): (107, "StackTraceFrameMap"),
("read_only_space", 0x0376d): (108, "TemplateObjectDescriptionMap"),
("read_only_space", 0x03795): (109, "Tuple2Map"),
("read_only_space", 0x037bd): (110, "WasmCapiFunctionDataMap"),
("read_only_space", 0x037e5): (111, "WasmDebugInfoMap"),
("read_only_space", 0x0380d): (112, "WasmExceptionTagMap"),
("read_only_space", 0x03835): (113, "WasmExportedFunctionDataMap"),
("read_only_space", 0x0385d): (114, "WasmIndirectFunctionTableMap"),
("read_only_space", 0x03885): (115, "WasmJSFunctionDataMap"),
("read_only_space", 0x038ad): (134, "InternalClassWithSmiElementsMap"),
("read_only_space", 0x038d5): (165, "InternalClassWithStructElementsMap"),
("read_only_space", 0x038fd): (164, "InternalClassMap"),
("read_only_space", 0x03925): (172, "SmiPairMap"),
("read_only_space", 0x0394d): (171, "SmiBoxMap"),
("read_only_space", 0x03975): (68, "ExportedSubClassBaseMap"),
("read_only_space", 0x0399d): (69, "ExportedSubClassMap"),
("read_only_space", 0x039c5): (173, "SortStateMap"),
("read_only_space", 0x039ed): (85, "AllocationSiteWithWeakNextMap"),
("read_only_space", 0x03a15): (85, "AllocationSiteWithoutWeakNextMap"),
("read_only_space", 0x03a3d): (76, "LoadHandler1Map"),
("read_only_space", 0x03a65): (76, "LoadHandler2Map"),
("read_only_space", 0x03a8d): (76, "LoadHandler3Map"),
("read_only_space", 0x03ab5): (77, "StoreHandler0Map"),
("read_only_space", 0x03add): (77, "StoreHandler1Map"),
("read_only_space", 0x03b05): (77, "StoreHandler2Map"),
("read_only_space", 0x03b2d): (77, "StoreHandler3Map"),
("map_space", 0x00121): (1057, "ExternalMap"),
("map_space", 0x00149): (1073, "JSMessageObjectMap"),
}
# List of known V8 objects.
KNOWN_OBJECTS = {
("read_only_space", 0x00171): "NullValue",
("read_only_space", 0x001b5): "EmptyDescriptorArray",
("read_only_space", 0x001ed): "EmptyWeakFixedArray",
("read_only_space", 0x0026d): "UninitializedValue",
("read_only_space", 0x0030d): "UndefinedValue",
("read_only_space", 0x00351): "NanValue",
("read_only_space", 0x00385): "TheHoleValue",
("read_only_space", 0x003d9): "HoleNanValue",
("read_only_space", 0x003e5): "TrueValue",
("read_only_space", 0x0044d): "FalseValue",
("read_only_space", 0x0047d): "empty_string",
("read_only_space", 0x006e1): "EmptyScopeInfo",
("read_only_space", 0x006e9): "EmptyFixedArray",
("read_only_space", 0x006f1): "ArgumentsMarker",
("read_only_space", 0x00751): "Exception",
("read_only_space", 0x007ad): "TerminationException",
("read_only_space", 0x00815): "OptimizedOut",
("read_only_space", 0x00875): "StaleRegister",
("read_only_space", 0x0116d): "EmptyEnumCache",
("read_only_space", 0x011a1): "EmptyPropertyArray",
("read_only_space", 0x011a9): "EmptyByteArray",
("read_only_space", 0x011b1): "EmptyObjectBoilerplateDescription",
("read_only_space", 0x011bd): "EmptyArrayBoilerplateDescription",
("read_only_space", 0x011f1): "EmptyClosureFeedbackCellArray",
("read_only_space", 0x011f9): "EmptySloppyArgumentsElements",
("read_only_space", 0x01209): "EmptySlowElementDictionary",
("read_only_space", 0x0122d): "EmptyOrderedHashMap",
("read_only_space", 0x01241): "EmptyOrderedHashSet",
("read_only_space", 0x01255): "EmptyFeedbackMetadata",
("read_only_space", 0x01261): "EmptyPropertyCell",
("read_only_space", 0x01275): "EmptyPropertyDictionary",
("read_only_space", 0x0129d): "NoOpInterceptorInfo",
("read_only_space", 0x012ed): "EmptyWeakArrayList",
("read_only_space", 0x012f9): "InfinityValue",
("read_only_space", 0x01305): "MinusZeroValue",
("read_only_space", 0x01311): "MinusInfinityValue",
("read_only_space", 0x0131d): "SelfReferenceMarker",
("read_only_space", 0x0135d): "OffHeapTrampolineRelocationInfo",
("read_only_space", 0x01369): "TrampolineTrivialCodeDataContainer",
("read_only_space", 0x01375): "TrampolinePromiseRejectionCodeDataContainer",
("read_only_space", 0x01381): "GlobalThisBindingScopeInfo",
("read_only_space", 0x013b9): "EmptyFunctionScopeInfo",
("read_only_space", 0x013e1): "NativeScopeInfo",
("read_only_space", 0x013fd): "HashSeed",
("old_space", 0x00121): "ArgumentsIteratorAccessor",
("old_space", 0x00165): "ArrayLengthAccessor",
("old_space", 0x001a9): "BoundFunctionLengthAccessor",
("old_space", 0x001ed): "BoundFunctionNameAccessor",
("old_space", 0x00231): "ErrorStackAccessor",
("old_space", 0x00275): "FunctionArgumentsAccessor",
("old_space", 0x002b9): "FunctionCallerAccessor",
("old_space", 0x002fd): "FunctionNameAccessor",
("old_space", 0x00341): "FunctionLengthAccessor",
("old_space", 0x00385): "FunctionPrototypeAccessor",
("old_space", 0x003c9): "RegExpResultIndicesAccessor",
("old_space", 0x0040d): "StringLengthAccessor",
("old_space", 0x00451): "InvalidPrototypeValidityCell",
("old_space", 0x00459): "EmptyScript",
("old_space", 0x00499): "ManyClosuresCell",
("old_space", 0x004a5): "ArrayConstructorProtector",
("old_space", 0x004b9): "NoElementsProtector",
("old_space", 0x004cd): "IsConcatSpreadableProtector",
("old_space", 0x004e1): "ArraySpeciesProtector",
("old_space", 0x004f5): "TypedArraySpeciesProtector",
("old_space", 0x00509): "PromiseSpeciesProtector",
("old_space", 0x0051d): "StringLengthProtector",
("old_space", 0x00531): "ArrayIteratorProtector",
("old_space", 0x00545): "ArrayBufferDetachingProtector",
("old_space", 0x00559): "PromiseHookProtector",
("old_space", 0x0056d): "PromiseResolveProtector",
("old_space", 0x00581): "MapIteratorProtector",
("old_space", 0x00595): "PromiseThenProtector",
("old_space", 0x005a9): "SetIteratorProtector",
("old_space", 0x005bd): "StringIteratorProtector",
("old_space", 0x005d1): "SingleCharacterStringCache",
("old_space", 0x009d9): "StringSplitCache",
("old_space", 0x00de1): "RegExpMultipleCache",
("old_space", 0x011e9): "BuiltinsConstantsTable",
}
# Lower 32 bits of first page addresses for various heap spaces.
HEAP_FIRST_PAGES = {
0x08100000: "old_space",
0x08140000: "map_space",
0x08040000: "read_only_space",
}
# List of known V8 Frame Markers.
FRAME_MARKERS = (
"ENTRY",
"CONSTRUCT_ENTRY",
"EXIT",
"OPTIMIZED",
"WASM_COMPILED",
"WASM_TO_JS",
"JS_TO_WASM",
"WASM_INTERPRETER_ENTRY",
"WASM_DEBUG_BREAK",
"C_WASM_ENTRY",
"WASM_EXIT",
"WASM_COMPILE_LAZY",
"INTERPRETED",
"STUB",
"BUILTIN_CONTINUATION",
"JAVA_SCRIPT_BUILTIN_CONTINUATION",
"JAVA_SCRIPT_BUILTIN_CONTINUATION_WITH_CATCH",
"INTERNAL",
"CONSTRUCT",
"ARGUMENTS_ADAPTOR",
"BUILTIN",
"BUILTIN_EXIT",
"NATIVE",
)
# This set of constants is generated from a shipping build.
| instance_types = {0: 'INTERNALIZED_STRING_TYPE', 2: 'EXTERNAL_INTERNALIZED_STRING_TYPE', 8: 'ONE_BYTE_INTERNALIZED_STRING_TYPE', 10: 'EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE', 18: 'UNCACHED_EXTERNAL_INTERNALIZED_STRING_TYPE', 26: 'UNCACHED_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE', 32: 'STRING_TYPE', 33: 'CONS_STRING_TYPE', 34: 'EXTERNAL_STRING_TYPE', 35: 'SLICED_STRING_TYPE', 37: 'THIN_STRING_TYPE', 40: 'ONE_BYTE_STRING_TYPE', 41: 'CONS_ONE_BYTE_STRING_TYPE', 42: 'EXTERNAL_ONE_BYTE_STRING_TYPE', 43: 'SLICED_ONE_BYTE_STRING_TYPE', 45: 'THIN_ONE_BYTE_STRING_TYPE', 50: 'UNCACHED_EXTERNAL_STRING_TYPE', 58: 'UNCACHED_EXTERNAL_ONE_BYTE_STRING_TYPE', 64: 'SYMBOL_TYPE', 65: 'BIG_INT_BASE_TYPE', 66: 'HEAP_NUMBER_TYPE', 67: 'ODDBALL_TYPE', 68: 'EXPORTED_SUB_CLASS_BASE_TYPE', 69: 'EXPORTED_SUB_CLASS_TYPE', 70: 'FOREIGN_TYPE', 71: 'PROMISE_FULFILL_REACTION_JOB_TASK_TYPE', 72: 'PROMISE_REJECT_REACTION_JOB_TASK_TYPE', 73: 'CALLABLE_TASK_TYPE', 74: 'CALLBACK_TASK_TYPE', 75: 'PROMISE_RESOLVE_THENABLE_JOB_TASK_TYPE', 76: 'LOAD_HANDLER_TYPE', 77: 'STORE_HANDLER_TYPE', 78: 'FUNCTION_TEMPLATE_INFO_TYPE', 79: 'OBJECT_TEMPLATE_INFO_TYPE', 80: 'ACCESS_CHECK_INFO_TYPE', 81: 'ACCESSOR_INFO_TYPE', 82: 'ACCESSOR_PAIR_TYPE', 83: 'ALIASED_ARGUMENTS_ENTRY_TYPE', 84: 'ALLOCATION_MEMENTO_TYPE', 85: 'ALLOCATION_SITE_TYPE', 86: 'ARRAY_BOILERPLATE_DESCRIPTION_TYPE', 87: 'ASM_WASM_DATA_TYPE', 88: 'ASYNC_GENERATOR_REQUEST_TYPE', 89: 'BREAK_POINT_TYPE', 90: 'BREAK_POINT_INFO_TYPE', 91: 'CACHED_TEMPLATE_OBJECT_TYPE', 92: 'CALL_HANDLER_INFO_TYPE', 93: 'CLASS_POSITIONS_TYPE', 94: 'DEBUG_INFO_TYPE', 95: 'ENUM_CACHE_TYPE', 96: 'FEEDBACK_CELL_TYPE', 97: 'FUNCTION_TEMPLATE_RARE_DATA_TYPE', 98: 'INTERCEPTOR_INFO_TYPE', 99: 'INTERPRETER_DATA_TYPE', 100: 'PROMISE_CAPABILITY_TYPE', 101: 'PROMISE_REACTION_TYPE', 102: 'PROPERTY_DESCRIPTOR_OBJECT_TYPE', 103: 'PROTOTYPE_INFO_TYPE', 104: 'SCRIPT_TYPE', 105: 'SOURCE_TEXT_MODULE_INFO_ENTRY_TYPE', 106: 'STACK_FRAME_INFO_TYPE', 107: 'STACK_TRACE_FRAME_TYPE', 108: 'TEMPLATE_OBJECT_DESCRIPTION_TYPE', 109: 'TUPLE2_TYPE', 110: 'WASM_CAPI_FUNCTION_DATA_TYPE', 111: 'WASM_DEBUG_INFO_TYPE', 112: 'WASM_EXCEPTION_TAG_TYPE', 113: 'WASM_EXPORTED_FUNCTION_DATA_TYPE', 114: 'WASM_INDIRECT_FUNCTION_TABLE_TYPE', 115: 'WASM_JS_FUNCTION_DATA_TYPE', 116: 'FIXED_ARRAY_TYPE', 117: 'HASH_TABLE_TYPE', 118: 'EPHEMERON_HASH_TABLE_TYPE', 119: 'GLOBAL_DICTIONARY_TYPE', 120: 'NAME_DICTIONARY_TYPE', 121: 'NUMBER_DICTIONARY_TYPE', 122: 'ORDERED_HASH_MAP_TYPE', 123: 'ORDERED_HASH_SET_TYPE', 124: 'ORDERED_NAME_DICTIONARY_TYPE', 125: 'SIMPLE_NUMBER_DICTIONARY_TYPE', 126: 'STRING_TABLE_TYPE', 127: 'CLOSURE_FEEDBACK_CELL_ARRAY_TYPE', 128: 'OBJECT_BOILERPLATE_DESCRIPTION_TYPE', 129: 'SCOPE_INFO_TYPE', 130: 'SCRIPT_CONTEXT_TABLE_TYPE', 131: 'BYTE_ARRAY_TYPE', 132: 'BYTECODE_ARRAY_TYPE', 133: 'FIXED_DOUBLE_ARRAY_TYPE', 134: 'INTERNAL_CLASS_WITH_SMI_ELEMENTS_TYPE', 135: 'AWAIT_CONTEXT_TYPE', 136: 'BLOCK_CONTEXT_TYPE', 137: 'CATCH_CONTEXT_TYPE', 138: 'DEBUG_EVALUATE_CONTEXT_TYPE', 139: 'EVAL_CONTEXT_TYPE', 140: 'FUNCTION_CONTEXT_TYPE', 141: 'MODULE_CONTEXT_TYPE', 142: 'NATIVE_CONTEXT_TYPE', 143: 'SCRIPT_CONTEXT_TYPE', 144: 'WITH_CONTEXT_TYPE', 145: 'SMALL_ORDERED_HASH_MAP_TYPE', 146: 'SMALL_ORDERED_HASH_SET_TYPE', 147: 'SMALL_ORDERED_NAME_DICTIONARY_TYPE', 148: 'SOURCE_TEXT_MODULE_TYPE', 149: 'SYNTHETIC_MODULE_TYPE', 150: 'UNCOMPILED_DATA_WITH_PREPARSE_DATA_TYPE', 151: 'UNCOMPILED_DATA_WITHOUT_PREPARSE_DATA_TYPE', 152: 'WEAK_FIXED_ARRAY_TYPE', 153: 'TRANSITION_ARRAY_TYPE', 154: 'CELL_TYPE', 155: 'CODE_TYPE', 156: 'CODE_DATA_CONTAINER_TYPE', 157: 'COVERAGE_INFO_TYPE', 158: 'DESCRIPTOR_ARRAY_TYPE', 159: 'EMBEDDER_DATA_ARRAY_TYPE', 160: 'FEEDBACK_METADATA_TYPE', 161: 'FEEDBACK_VECTOR_TYPE', 162: 'FILLER_TYPE', 163: 'FREE_SPACE_TYPE', 164: 'INTERNAL_CLASS_TYPE', 165: 'INTERNAL_CLASS_WITH_STRUCT_ELEMENTS_TYPE', 166: 'MAP_TYPE', 167: 'PREPARSE_DATA_TYPE', 168: 'PROPERTY_ARRAY_TYPE', 169: 'PROPERTY_CELL_TYPE', 170: 'SHARED_FUNCTION_INFO_TYPE', 171: 'SMI_BOX_TYPE', 172: 'SMI_PAIR_TYPE', 173: 'SORT_STATE_TYPE', 174: 'WEAK_ARRAY_LIST_TYPE', 175: 'WEAK_CELL_TYPE', 176: 'JS_PROXY_TYPE', 1057: 'JS_OBJECT_TYPE', 177: 'JS_GLOBAL_OBJECT_TYPE', 178: 'JS_GLOBAL_PROXY_TYPE', 179: 'JS_MODULE_NAMESPACE_TYPE', 1040: 'JS_SPECIAL_API_OBJECT_TYPE', 1041: 'JS_PRIMITIVE_WRAPPER_TYPE', 1042: 'JS_MAP_KEY_ITERATOR_TYPE', 1043: 'JS_MAP_KEY_VALUE_ITERATOR_TYPE', 1044: 'JS_MAP_VALUE_ITERATOR_TYPE', 1045: 'JS_SET_KEY_VALUE_ITERATOR_TYPE', 1046: 'JS_SET_VALUE_ITERATOR_TYPE', 1047: 'JS_GENERATOR_OBJECT_TYPE', 1048: 'JS_ASYNC_FUNCTION_OBJECT_TYPE', 1049: 'JS_ASYNC_GENERATOR_OBJECT_TYPE', 1050: 'JS_DATA_VIEW_TYPE', 1051: 'JS_TYPED_ARRAY_TYPE', 1052: 'JS_MAP_TYPE', 1053: 'JS_SET_TYPE', 1054: 'JS_WEAK_MAP_TYPE', 1055: 'JS_WEAK_SET_TYPE', 1056: 'JS_API_OBJECT_TYPE', 1058: 'JS_ARGUMENTS_OBJECT_TYPE', 1059: 'JS_ARRAY_TYPE', 1060: 'JS_ARRAY_BUFFER_TYPE', 1061: 'JS_ARRAY_ITERATOR_TYPE', 1062: 'JS_ASYNC_FROM_SYNC_ITERATOR_TYPE', 1063: 'JS_COLLATOR_TYPE', 1064: 'JS_CONTEXT_EXTENSION_OBJECT_TYPE', 1065: 'JS_DATE_TYPE', 1066: 'JS_DATE_TIME_FORMAT_TYPE', 1067: 'JS_DISPLAY_NAMES_TYPE', 1068: 'JS_ERROR_TYPE', 1069: 'JS_FINALIZATION_REGISTRY_TYPE', 1070: 'JS_FINALIZATION_REGISTRY_CLEANUP_ITERATOR_TYPE', 1071: 'JS_LIST_FORMAT_TYPE', 1072: 'JS_LOCALE_TYPE', 1073: 'JS_MESSAGE_OBJECT_TYPE', 1074: 'JS_NUMBER_FORMAT_TYPE', 1075: 'JS_PLURAL_RULES_TYPE', 1076: 'JS_PROMISE_TYPE', 1077: 'JS_REG_EXP_TYPE', 1078: 'JS_REG_EXP_STRING_ITERATOR_TYPE', 1079: 'JS_RELATIVE_TIME_FORMAT_TYPE', 1080: 'JS_SEGMENT_ITERATOR_TYPE', 1081: 'JS_SEGMENTER_TYPE', 1082: 'JS_STRING_ITERATOR_TYPE', 1083: 'JS_V8_BREAK_ITERATOR_TYPE', 1084: 'JS_WEAK_REF_TYPE', 1085: 'WASM_EXCEPTION_OBJECT_TYPE', 1086: 'WASM_GLOBAL_OBJECT_TYPE', 1087: 'WASM_INSTANCE_OBJECT_TYPE', 1088: 'WASM_MEMORY_OBJECT_TYPE', 1089: 'WASM_MODULE_OBJECT_TYPE', 1090: 'WASM_TABLE_OBJECT_TYPE', 1091: 'JS_BOUND_FUNCTION_TYPE', 1092: 'JS_FUNCTION_TYPE'}
known_maps = {('read_only_space', 289): (163, 'FreeSpaceMap'), ('read_only_space', 329): (166, 'MetaMap'), ('read_only_space', 397): (67, 'NullMap'), ('read_only_space', 453): (158, 'DescriptorArrayMap'), ('read_only_space', 501): (152, 'WeakFixedArrayMap'), ('read_only_space', 541): (162, 'OnePointerFillerMap'), ('read_only_space', 581): (162, 'TwoPointerFillerMap'), ('read_only_space', 649): (67, 'UninitializedMap'), ('read_only_space', 717): (8, 'OneByteInternalizedStringMap'), ('read_only_space', 809): (67, 'UndefinedMap'), ('read_only_space', 861): (66, 'HeapNumberMap'), ('read_only_space', 929): (67, 'TheHoleMap'), ('read_only_space', 1025): (67, 'BooleanMap'), ('read_only_space', 1161): (131, 'ByteArrayMap'), ('read_only_space', 1201): (116, 'FixedArrayMap'), ('read_only_space', 1241): (116, 'FixedCOWArrayMap'), ('read_only_space', 1281): (117, 'HashTableMap'), ('read_only_space', 1321): (64, 'SymbolMap'), ('read_only_space', 1361): (40, 'OneByteStringMap'), ('read_only_space', 1401): (129, 'ScopeInfoMap'), ('read_only_space', 1441): (170, 'SharedFunctionInfoMap'), ('read_only_space', 1481): (155, 'CodeMap'), ('read_only_space', 1521): (154, 'CellMap'), ('read_only_space', 1561): (169, 'GlobalPropertyCellMap'), ('read_only_space', 1601): (70, 'ForeignMap'), ('read_only_space', 1641): (153, 'TransitionArrayMap'), ('read_only_space', 1681): (45, 'ThinOneByteStringMap'), ('read_only_space', 1721): (161, 'FeedbackVectorMap'), ('read_only_space', 1805): (67, 'ArgumentsMarkerMap'), ('read_only_space', 1901): (67, 'ExceptionMap'), ('read_only_space', 1993): (67, 'TerminationExceptionMap'), ('read_only_space', 2097): (67, 'OptimizedOutMap'), ('read_only_space', 2193): (67, 'StaleRegisterMap'), ('read_only_space', 2261): (130, 'ScriptContextTableMap'), ('read_only_space', 2301): (127, 'ClosureFeedbackCellArrayMap'), ('read_only_space', 2341): (160, 'FeedbackMetadataArrayMap'), ('read_only_space', 2381): (116, 'ArrayListMap'), ('read_only_space', 2421): (65, 'BigIntMap'), ('read_only_space', 2461): (128, 'ObjectBoilerplateDescriptionMap'), ('read_only_space', 2501): (132, 'BytecodeArrayMap'), ('read_only_space', 2541): (156, 'CodeDataContainerMap'), ('read_only_space', 2581): (157, 'CoverageInfoMap'), ('read_only_space', 2621): (133, 'FixedDoubleArrayMap'), ('read_only_space', 2661): (119, 'GlobalDictionaryMap'), ('read_only_space', 2701): (96, 'ManyClosuresCellMap'), ('read_only_space', 2741): (116, 'ModuleInfoMap'), ('read_only_space', 2781): (120, 'NameDictionaryMap'), ('read_only_space', 2821): (96, 'NoClosuresCellMap'), ('read_only_space', 2861): (121, 'NumberDictionaryMap'), ('read_only_space', 2901): (96, 'OneClosureCellMap'), ('read_only_space', 2941): (122, 'OrderedHashMapMap'), ('read_only_space', 2981): (123, 'OrderedHashSetMap'), ('read_only_space', 3021): (124, 'OrderedNameDictionaryMap'), ('read_only_space', 3061): (167, 'PreparseDataMap'), ('read_only_space', 3101): (168, 'PropertyArrayMap'), ('read_only_space', 3141): (92, 'SideEffectCallHandlerInfoMap'), ('read_only_space', 3181): (92, 'SideEffectFreeCallHandlerInfoMap'), ('read_only_space', 3221): (92, 'NextCallSideEffectFreeCallHandlerInfoMap'), ('read_only_space', 3261): (125, 'SimpleNumberDictionaryMap'), ('read_only_space', 3301): (116, 'SloppyArgumentsElementsMap'), ('read_only_space', 3341): (145, 'SmallOrderedHashMapMap'), ('read_only_space', 3381): (146, 'SmallOrderedHashSetMap'), ('read_only_space', 3421): (147, 'SmallOrderedNameDictionaryMap'), ('read_only_space', 3461): (148, 'SourceTextModuleMap'), ('read_only_space', 3501): (126, 'StringTableMap'), ('read_only_space', 3541): (149, 'SyntheticModuleMap'), ('read_only_space', 3581): (151, 'UncompiledDataWithoutPreparseDataMap'), ('read_only_space', 3621): (150, 'UncompiledDataWithPreparseDataMap'), ('read_only_space', 3661): (174, 'WeakArrayListMap'), ('read_only_space', 3701): (118, 'EphemeronHashTableMap'), ('read_only_space', 3741): (159, 'EmbedderDataArrayMap'), ('read_only_space', 3781): (175, 'WeakCellMap'), ('read_only_space', 3821): (32, 'StringMap'), ('read_only_space', 3861): (41, 'ConsOneByteStringMap'), ('read_only_space', 3901): (33, 'ConsStringMap'), ('read_only_space', 3941): (37, 'ThinStringMap'), ('read_only_space', 3981): (35, 'SlicedStringMap'), ('read_only_space', 4021): (43, 'SlicedOneByteStringMap'), ('read_only_space', 4061): (34, 'ExternalStringMap'), ('read_only_space', 4101): (42, 'ExternalOneByteStringMap'), ('read_only_space', 4141): (50, 'UncachedExternalStringMap'), ('read_only_space', 4181): (0, 'InternalizedStringMap'), ('read_only_space', 4221): (2, 'ExternalInternalizedStringMap'), ('read_only_space', 4261): (10, 'ExternalOneByteInternalizedStringMap'), ('read_only_space', 4301): (18, 'UncachedExternalInternalizedStringMap'), ('read_only_space', 4341): (26, 'UncachedExternalOneByteInternalizedStringMap'), ('read_only_space', 4381): (58, 'UncachedExternalOneByteStringMap'), ('read_only_space', 4421): (67, 'SelfReferenceMarkerMap'), ('read_only_space', 4473): (95, 'EnumCacheMap'), ('read_only_space', 4553): (86, 'ArrayBoilerplateDescriptionMap'), ('read_only_space', 4805): (98, 'InterceptorInfoMap'), ('read_only_space', 13029): (71, 'PromiseFulfillReactionJobTaskMap'), ('read_only_space', 13069): (72, 'PromiseRejectReactionJobTaskMap'), ('read_only_space', 13109): (73, 'CallableTaskMap'), ('read_only_space', 13149): (74, 'CallbackTaskMap'), ('read_only_space', 13189): (75, 'PromiseResolveThenableJobTaskMap'), ('read_only_space', 13229): (78, 'FunctionTemplateInfoMap'), ('read_only_space', 13269): (79, 'ObjectTemplateInfoMap'), ('read_only_space', 13309): (80, 'AccessCheckInfoMap'), ('read_only_space', 13349): (81, 'AccessorInfoMap'), ('read_only_space', 13389): (82, 'AccessorPairMap'), ('read_only_space', 13429): (83, 'AliasedArgumentsEntryMap'), ('read_only_space', 13469): (84, 'AllocationMementoMap'), ('read_only_space', 13509): (87, 'AsmWasmDataMap'), ('read_only_space', 13549): (88, 'AsyncGeneratorRequestMap'), ('read_only_space', 13589): (89, 'BreakPointMap'), ('read_only_space', 13629): (90, 'BreakPointInfoMap'), ('read_only_space', 13669): (91, 'CachedTemplateObjectMap'), ('read_only_space', 13709): (93, 'ClassPositionsMap'), ('read_only_space', 13749): (94, 'DebugInfoMap'), ('read_only_space', 13789): (97, 'FunctionTemplateRareDataMap'), ('read_only_space', 13829): (99, 'InterpreterDataMap'), ('read_only_space', 13869): (100, 'PromiseCapabilityMap'), ('read_only_space', 13909): (101, 'PromiseReactionMap'), ('read_only_space', 13949): (102, 'PropertyDescriptorObjectMap'), ('read_only_space', 13989): (103, 'PrototypeInfoMap'), ('read_only_space', 14029): (104, 'ScriptMap'), ('read_only_space', 14069): (105, 'SourceTextModuleInfoEntryMap'), ('read_only_space', 14109): (106, 'StackFrameInfoMap'), ('read_only_space', 14149): (107, 'StackTraceFrameMap'), ('read_only_space', 14189): (108, 'TemplateObjectDescriptionMap'), ('read_only_space', 14229): (109, 'Tuple2Map'), ('read_only_space', 14269): (110, 'WasmCapiFunctionDataMap'), ('read_only_space', 14309): (111, 'WasmDebugInfoMap'), ('read_only_space', 14349): (112, 'WasmExceptionTagMap'), ('read_only_space', 14389): (113, 'WasmExportedFunctionDataMap'), ('read_only_space', 14429): (114, 'WasmIndirectFunctionTableMap'), ('read_only_space', 14469): (115, 'WasmJSFunctionDataMap'), ('read_only_space', 14509): (134, 'InternalClassWithSmiElementsMap'), ('read_only_space', 14549): (165, 'InternalClassWithStructElementsMap'), ('read_only_space', 14589): (164, 'InternalClassMap'), ('read_only_space', 14629): (172, 'SmiPairMap'), ('read_only_space', 14669): (171, 'SmiBoxMap'), ('read_only_space', 14709): (68, 'ExportedSubClassBaseMap'), ('read_only_space', 14749): (69, 'ExportedSubClassMap'), ('read_only_space', 14789): (173, 'SortStateMap'), ('read_only_space', 14829): (85, 'AllocationSiteWithWeakNextMap'), ('read_only_space', 14869): (85, 'AllocationSiteWithoutWeakNextMap'), ('read_only_space', 14909): (76, 'LoadHandler1Map'), ('read_only_space', 14949): (76, 'LoadHandler2Map'), ('read_only_space', 14989): (76, 'LoadHandler3Map'), ('read_only_space', 15029): (77, 'StoreHandler0Map'), ('read_only_space', 15069): (77, 'StoreHandler1Map'), ('read_only_space', 15109): (77, 'StoreHandler2Map'), ('read_only_space', 15149): (77, 'StoreHandler3Map'), ('map_space', 289): (1057, 'ExternalMap'), ('map_space', 329): (1073, 'JSMessageObjectMap')}
known_objects = {('read_only_space', 369): 'NullValue', ('read_only_space', 437): 'EmptyDescriptorArray', ('read_only_space', 493): 'EmptyWeakFixedArray', ('read_only_space', 621): 'UninitializedValue', ('read_only_space', 781): 'UndefinedValue', ('read_only_space', 849): 'NanValue', ('read_only_space', 901): 'TheHoleValue', ('read_only_space', 985): 'HoleNanValue', ('read_only_space', 997): 'TrueValue', ('read_only_space', 1101): 'FalseValue', ('read_only_space', 1149): 'empty_string', ('read_only_space', 1761): 'EmptyScopeInfo', ('read_only_space', 1769): 'EmptyFixedArray', ('read_only_space', 1777): 'ArgumentsMarker', ('read_only_space', 1873): 'Exception', ('read_only_space', 1965): 'TerminationException', ('read_only_space', 2069): 'OptimizedOut', ('read_only_space', 2165): 'StaleRegister', ('read_only_space', 4461): 'EmptyEnumCache', ('read_only_space', 4513): 'EmptyPropertyArray', ('read_only_space', 4521): 'EmptyByteArray', ('read_only_space', 4529): 'EmptyObjectBoilerplateDescription', ('read_only_space', 4541): 'EmptyArrayBoilerplateDescription', ('read_only_space', 4593): 'EmptyClosureFeedbackCellArray', ('read_only_space', 4601): 'EmptySloppyArgumentsElements', ('read_only_space', 4617): 'EmptySlowElementDictionary', ('read_only_space', 4653): 'EmptyOrderedHashMap', ('read_only_space', 4673): 'EmptyOrderedHashSet', ('read_only_space', 4693): 'EmptyFeedbackMetadata', ('read_only_space', 4705): 'EmptyPropertyCell', ('read_only_space', 4725): 'EmptyPropertyDictionary', ('read_only_space', 4765): 'NoOpInterceptorInfo', ('read_only_space', 4845): 'EmptyWeakArrayList', ('read_only_space', 4857): 'InfinityValue', ('read_only_space', 4869): 'MinusZeroValue', ('read_only_space', 4881): 'MinusInfinityValue', ('read_only_space', 4893): 'SelfReferenceMarker', ('read_only_space', 4957): 'OffHeapTrampolineRelocationInfo', ('read_only_space', 4969): 'TrampolineTrivialCodeDataContainer', ('read_only_space', 4981): 'TrampolinePromiseRejectionCodeDataContainer', ('read_only_space', 4993): 'GlobalThisBindingScopeInfo', ('read_only_space', 5049): 'EmptyFunctionScopeInfo', ('read_only_space', 5089): 'NativeScopeInfo', ('read_only_space', 5117): 'HashSeed', ('old_space', 289): 'ArgumentsIteratorAccessor', ('old_space', 357): 'ArrayLengthAccessor', ('old_space', 425): 'BoundFunctionLengthAccessor', ('old_space', 493): 'BoundFunctionNameAccessor', ('old_space', 561): 'ErrorStackAccessor', ('old_space', 629): 'FunctionArgumentsAccessor', ('old_space', 697): 'FunctionCallerAccessor', ('old_space', 765): 'FunctionNameAccessor', ('old_space', 833): 'FunctionLengthAccessor', ('old_space', 901): 'FunctionPrototypeAccessor', ('old_space', 969): 'RegExpResultIndicesAccessor', ('old_space', 1037): 'StringLengthAccessor', ('old_space', 1105): 'InvalidPrototypeValidityCell', ('old_space', 1113): 'EmptyScript', ('old_space', 1177): 'ManyClosuresCell', ('old_space', 1189): 'ArrayConstructorProtector', ('old_space', 1209): 'NoElementsProtector', ('old_space', 1229): 'IsConcatSpreadableProtector', ('old_space', 1249): 'ArraySpeciesProtector', ('old_space', 1269): 'TypedArraySpeciesProtector', ('old_space', 1289): 'PromiseSpeciesProtector', ('old_space', 1309): 'StringLengthProtector', ('old_space', 1329): 'ArrayIteratorProtector', ('old_space', 1349): 'ArrayBufferDetachingProtector', ('old_space', 1369): 'PromiseHookProtector', ('old_space', 1389): 'PromiseResolveProtector', ('old_space', 1409): 'MapIteratorProtector', ('old_space', 1429): 'PromiseThenProtector', ('old_space', 1449): 'SetIteratorProtector', ('old_space', 1469): 'StringIteratorProtector', ('old_space', 1489): 'SingleCharacterStringCache', ('old_space', 2521): 'StringSplitCache', ('old_space', 3553): 'RegExpMultipleCache', ('old_space', 4585): 'BuiltinsConstantsTable'}
heap_first_pages = {135266304: 'old_space', 135528448: 'map_space', 134479872: 'read_only_space'}
frame_markers = ('ENTRY', 'CONSTRUCT_ENTRY', 'EXIT', 'OPTIMIZED', 'WASM_COMPILED', 'WASM_TO_JS', 'JS_TO_WASM', 'WASM_INTERPRETER_ENTRY', 'WASM_DEBUG_BREAK', 'C_WASM_ENTRY', 'WASM_EXIT', 'WASM_COMPILE_LAZY', 'INTERPRETED', 'STUB', 'BUILTIN_CONTINUATION', 'JAVA_SCRIPT_BUILTIN_CONTINUATION', 'JAVA_SCRIPT_BUILTIN_CONTINUATION_WITH_CATCH', 'INTERNAL', 'CONSTRUCT', 'ARGUMENTS_ADAPTOR', 'BUILTIN', 'BUILTIN_EXIT', 'NATIVE') |
# -*- coding: utf-8 -*-
#
# Warthog - Simple client for A10 load balancers
#
# Copyright 2014-2016 Smarter Travel
#
# Available under the MIT license. See LICENSE for details.
#
"""
warthog.ssl
~~~~~~~~~~~
SSL related constants used by Warthog
"""
# Define our own versions of expected constants in the Python ssl
# module since older Python versions didn't define all of them. For
# example Python 2.6 and Python 3.3 don't include TLSv1.1 or TLSv1.2
# and we need to support the combination of those Python versions
# and TLS versions. Kinda hacky but required. Such is life.
#
# Disabling the lint checks below since we're matching what the stdlib does.
#
# pylint: disable=invalid-name
PROTOCOL_SSLv3 = 1
# pylint: disable=invalid-name
PROTOCOL_TLS = PROTOCOL_SSLv23 = 2
# pylint: disable=invalid-name
PROTOCOL_TLSv1 = 3
# pylint: disable=invalid-name
PROTOCOL_TLSv1_1 = 4
# pylint: disable=invalid-name
PROTOCOL_TLSv1_2 = 5
| """
warthog.ssl
~~~~~~~~~~~
SSL related constants used by Warthog
"""
protocol_ss_lv3 = 1
protocol_tls = protocol_ss_lv23 = 2
protocol_tl_sv1 = 3
protocol_tl_sv1_1 = 4
protocol_tl_sv1_2 = 5 |
#
# PySNMP MIB module HPN-ICF-FDMI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-FDMI-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:26:45 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint")
fcmInstanceIndex, FcNameIdOrZero = mibBuilder.importSymbols("FC-MGMT-MIB", "fcmInstanceIndex", "FcNameIdOrZero")
hpnicfSan, = mibBuilder.importSymbols("HPN-ICF-VSAN-MIB", "hpnicfSan")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
IpAddress, Counter32, Bits, TimeTicks, iso, ObjectIdentity, Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, Gauge32, ModuleIdentity, Counter64, NotificationType, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "Counter32", "Bits", "TimeTicks", "iso", "ObjectIdentity", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "Gauge32", "ModuleIdentity", "Counter64", "NotificationType", "MibIdentifier")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
T11FabricIndex, = mibBuilder.importSymbols("T11-TC-MIB", "T11FabricIndex")
hpnicfFdmi = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7))
hpnicfFdmi.setRevisions(('2012-06-18 00:00',))
if mibBuilder.loadTexts: hpnicfFdmi.setLastUpdated('201206180000Z')
if mibBuilder.loadTexts: hpnicfFdmi.setOrganization('')
hpnicfFdmiObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1))
hpnicfFdmiInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1))
hpnicfFdmiHbaInfoTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1), )
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoTable.setStatus('current')
hpnicfFdmiHbaInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1), ).setIndexNames((0, "FC-MGMT-MIB", "fcmInstanceIndex"), (0, "HPN-ICF-FDMI-MIB", "hpnicfFdmiHbaInfoFabricIndex"), (0, "HPN-ICF-FDMI-MIB", "hpnicfFdmiHbaInfoId"))
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoEntry.setStatus('current')
hpnicfFdmiHbaInfoFabricIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 1), T11FabricIndex())
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoFabricIndex.setStatus('current')
hpnicfFdmiHbaInfoId = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 2), FcNameIdOrZero())
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoId.setStatus('current')
hpnicfFdmiHbaInfoNodeName = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 3), FcNameIdOrZero()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoNodeName.setStatus('current')
hpnicfFdmiHbaInfoMfg = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 4), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoMfg.setStatus('current')
hpnicfFdmiHbaInfoSn = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 5), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoSn.setStatus('current')
hpnicfFdmiHbaInfoModel = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 6), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoModel.setStatus('current')
hpnicfFdmiHbaInfoModelDescr = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 7), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoModelDescr.setStatus('current')
hpnicfFdmiHbaInfoHwVer = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 8), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoHwVer.setStatus('current')
hpnicfFdmiHbaInfoDriverVer = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 9), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoDriverVer.setStatus('current')
hpnicfFdmiHbaInfoOptROMVer = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 10), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoOptROMVer.setStatus('current')
hpnicfFdmiHbaInfoFwVer = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 11), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoFwVer.setStatus('current')
hpnicfFdmiHbaInfoOSInfo = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 12), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoOSInfo.setStatus('current')
hpnicfFdmiHbaInfoMaxCTPayload = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 13), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaInfoMaxCTPayload.setStatus('current')
hpnicfFdmiHbaPortTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2), )
if mibBuilder.loadTexts: hpnicfFdmiHbaPortTable.setStatus('current')
hpnicfFdmiHbaPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1), ).setIndexNames((0, "FC-MGMT-MIB", "fcmInstanceIndex"), (0, "HPN-ICF-FDMI-MIB", "hpnicfFdmiHbaInfoFabricIndex"), (0, "HPN-ICF-FDMI-MIB", "hpnicfFdmiHbaInfoId"), (0, "HPN-ICF-FDMI-MIB", "hpnicfFdmiHbaPortId"))
if mibBuilder.loadTexts: hpnicfFdmiHbaPortEntry.setStatus('current')
hpnicfFdmiHbaPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 1), FcNameIdOrZero())
if mibBuilder.loadTexts: hpnicfFdmiHbaPortId.setStatus('current')
hpnicfFdmiHbaPortSupportedFC4Type = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 2), OctetString().subtype(subtypeSpec=ConstraintsUnion(ValueSizeConstraint(0, 0), ValueSizeConstraint(32, 32), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaPortSupportedFC4Type.setStatus('current')
hpnicfFdmiHbaPortSupportedSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaPortSupportedSpeed.setStatus('current')
hpnicfFdmiHbaPortCurrentSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaPortCurrentSpeed.setStatus('current')
hpnicfFdmiHbaPortMaxFrameSize = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 5), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaPortMaxFrameSize.setStatus('current')
hpnicfFdmiHbaPortOsDevName = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 6), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaPortOsDevName.setStatus('current')
hpnicfFdmiHbaPortHostName = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 7), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfFdmiHbaPortHostName.setStatus('current')
mibBuilder.exportSymbols("HPN-ICF-FDMI-MIB", hpnicfFdmiHbaPortTable=hpnicfFdmiHbaPortTable, hpnicfFdmiHbaInfoOSInfo=hpnicfFdmiHbaInfoOSInfo, hpnicfFdmiHbaPortCurrentSpeed=hpnicfFdmiHbaPortCurrentSpeed, hpnicfFdmiInfo=hpnicfFdmiInfo, hpnicfFdmiHbaInfoModel=hpnicfFdmiHbaInfoModel, hpnicfFdmiHbaInfoDriverVer=hpnicfFdmiHbaInfoDriverVer, hpnicfFdmiObjects=hpnicfFdmiObjects, hpnicfFdmiHbaPortSupportedSpeed=hpnicfFdmiHbaPortSupportedSpeed, hpnicfFdmiHbaPortSupportedFC4Type=hpnicfFdmiHbaPortSupportedFC4Type, hpnicfFdmiHbaInfoEntry=hpnicfFdmiHbaInfoEntry, hpnicfFdmiHbaInfoOptROMVer=hpnicfFdmiHbaInfoOptROMVer, hpnicfFdmiHbaPortOsDevName=hpnicfFdmiHbaPortOsDevName, hpnicfFdmiHbaInfoTable=hpnicfFdmiHbaInfoTable, hpnicfFdmiHbaPortMaxFrameSize=hpnicfFdmiHbaPortMaxFrameSize, PYSNMP_MODULE_ID=hpnicfFdmi, hpnicfFdmiHbaInfoFwVer=hpnicfFdmiHbaInfoFwVer, hpnicfFdmiHbaPortEntry=hpnicfFdmiHbaPortEntry, hpnicfFdmiHbaInfoNodeName=hpnicfFdmiHbaInfoNodeName, hpnicfFdmiHbaPortId=hpnicfFdmiHbaPortId, hpnicfFdmiHbaInfoMfg=hpnicfFdmiHbaInfoMfg, hpnicfFdmi=hpnicfFdmi, hpnicfFdmiHbaInfoSn=hpnicfFdmiHbaInfoSn, hpnicfFdmiHbaInfoHwVer=hpnicfFdmiHbaInfoHwVer, hpnicfFdmiHbaInfoFabricIndex=hpnicfFdmiHbaInfoFabricIndex, hpnicfFdmiHbaInfoId=hpnicfFdmiHbaInfoId, hpnicfFdmiHbaPortHostName=hpnicfFdmiHbaPortHostName, hpnicfFdmiHbaInfoMaxCTPayload=hpnicfFdmiHbaInfoMaxCTPayload, hpnicfFdmiHbaInfoModelDescr=hpnicfFdmiHbaInfoModelDescr)
| (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, single_value_constraint, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueSizeConstraint')
(fcm_instance_index, fc_name_id_or_zero) = mibBuilder.importSymbols('FC-MGMT-MIB', 'fcmInstanceIndex', 'FcNameIdOrZero')
(hpnicf_san,) = mibBuilder.importSymbols('HPN-ICF-VSAN-MIB', 'hpnicfSan')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(ip_address, counter32, bits, time_ticks, iso, object_identity, integer32, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32, gauge32, module_identity, counter64, notification_type, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'IpAddress', 'Counter32', 'Bits', 'TimeTicks', 'iso', 'ObjectIdentity', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32', 'Gauge32', 'ModuleIdentity', 'Counter64', 'NotificationType', 'MibIdentifier')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
(t11_fabric_index,) = mibBuilder.importSymbols('T11-TC-MIB', 'T11FabricIndex')
hpnicf_fdmi = module_identity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7))
hpnicfFdmi.setRevisions(('2012-06-18 00:00',))
if mibBuilder.loadTexts:
hpnicfFdmi.setLastUpdated('201206180000Z')
if mibBuilder.loadTexts:
hpnicfFdmi.setOrganization('')
hpnicf_fdmi_objects = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1))
hpnicf_fdmi_info = mib_identifier((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1))
hpnicf_fdmi_hba_info_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1))
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoTable.setStatus('current')
hpnicf_fdmi_hba_info_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1)).setIndexNames((0, 'FC-MGMT-MIB', 'fcmInstanceIndex'), (0, 'HPN-ICF-FDMI-MIB', 'hpnicfFdmiHbaInfoFabricIndex'), (0, 'HPN-ICF-FDMI-MIB', 'hpnicfFdmiHbaInfoId'))
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoEntry.setStatus('current')
hpnicf_fdmi_hba_info_fabric_index = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 1), t11_fabric_index())
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoFabricIndex.setStatus('current')
hpnicf_fdmi_hba_info_id = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 2), fc_name_id_or_zero())
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoId.setStatus('current')
hpnicf_fdmi_hba_info_node_name = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 3), fc_name_id_or_zero()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoNodeName.setStatus('current')
hpnicf_fdmi_hba_info_mfg = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 4), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoMfg.setStatus('current')
hpnicf_fdmi_hba_info_sn = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 5), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoSn.setStatus('current')
hpnicf_fdmi_hba_info_model = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 6), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoModel.setStatus('current')
hpnicf_fdmi_hba_info_model_descr = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 7), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoModelDescr.setStatus('current')
hpnicf_fdmi_hba_info_hw_ver = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 8), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoHwVer.setStatus('current')
hpnicf_fdmi_hba_info_driver_ver = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 9), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoDriverVer.setStatus('current')
hpnicf_fdmi_hba_info_opt_rom_ver = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 10), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoOptROMVer.setStatus('current')
hpnicf_fdmi_hba_info_fw_ver = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 11), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoFwVer.setStatus('current')
hpnicf_fdmi_hba_info_os_info = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 12), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoOSInfo.setStatus('current')
hpnicf_fdmi_hba_info_max_ct_payload = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 1, 1, 13), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaInfoMaxCTPayload.setStatus('current')
hpnicf_fdmi_hba_port_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2))
if mibBuilder.loadTexts:
hpnicfFdmiHbaPortTable.setStatus('current')
hpnicf_fdmi_hba_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1)).setIndexNames((0, 'FC-MGMT-MIB', 'fcmInstanceIndex'), (0, 'HPN-ICF-FDMI-MIB', 'hpnicfFdmiHbaInfoFabricIndex'), (0, 'HPN-ICF-FDMI-MIB', 'hpnicfFdmiHbaInfoId'), (0, 'HPN-ICF-FDMI-MIB', 'hpnicfFdmiHbaPortId'))
if mibBuilder.loadTexts:
hpnicfFdmiHbaPortEntry.setStatus('current')
hpnicf_fdmi_hba_port_id = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 1), fc_name_id_or_zero())
if mibBuilder.loadTexts:
hpnicfFdmiHbaPortId.setStatus('current')
hpnicf_fdmi_hba_port_supported_fc4_type = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 2), octet_string().subtype(subtypeSpec=constraints_union(value_size_constraint(0, 0), value_size_constraint(32, 32)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaPortSupportedFC4Type.setStatus('current')
hpnicf_fdmi_hba_port_supported_speed = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaPortSupportedSpeed.setStatus('current')
hpnicf_fdmi_hba_port_current_speed = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaPortCurrentSpeed.setStatus('current')
hpnicf_fdmi_hba_port_max_frame_size = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 5), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaPortMaxFrameSize.setStatus('current')
hpnicf_fdmi_hba_port_os_dev_name = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 6), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaPortOsDevName.setStatus('current')
hpnicf_fdmi_hba_port_host_name = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 2, 127, 7, 1, 1, 2, 1, 7), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfFdmiHbaPortHostName.setStatus('current')
mibBuilder.exportSymbols('HPN-ICF-FDMI-MIB', hpnicfFdmiHbaPortTable=hpnicfFdmiHbaPortTable, hpnicfFdmiHbaInfoOSInfo=hpnicfFdmiHbaInfoOSInfo, hpnicfFdmiHbaPortCurrentSpeed=hpnicfFdmiHbaPortCurrentSpeed, hpnicfFdmiInfo=hpnicfFdmiInfo, hpnicfFdmiHbaInfoModel=hpnicfFdmiHbaInfoModel, hpnicfFdmiHbaInfoDriverVer=hpnicfFdmiHbaInfoDriverVer, hpnicfFdmiObjects=hpnicfFdmiObjects, hpnicfFdmiHbaPortSupportedSpeed=hpnicfFdmiHbaPortSupportedSpeed, hpnicfFdmiHbaPortSupportedFC4Type=hpnicfFdmiHbaPortSupportedFC4Type, hpnicfFdmiHbaInfoEntry=hpnicfFdmiHbaInfoEntry, hpnicfFdmiHbaInfoOptROMVer=hpnicfFdmiHbaInfoOptROMVer, hpnicfFdmiHbaPortOsDevName=hpnicfFdmiHbaPortOsDevName, hpnicfFdmiHbaInfoTable=hpnicfFdmiHbaInfoTable, hpnicfFdmiHbaPortMaxFrameSize=hpnicfFdmiHbaPortMaxFrameSize, PYSNMP_MODULE_ID=hpnicfFdmi, hpnicfFdmiHbaInfoFwVer=hpnicfFdmiHbaInfoFwVer, hpnicfFdmiHbaPortEntry=hpnicfFdmiHbaPortEntry, hpnicfFdmiHbaInfoNodeName=hpnicfFdmiHbaInfoNodeName, hpnicfFdmiHbaPortId=hpnicfFdmiHbaPortId, hpnicfFdmiHbaInfoMfg=hpnicfFdmiHbaInfoMfg, hpnicfFdmi=hpnicfFdmi, hpnicfFdmiHbaInfoSn=hpnicfFdmiHbaInfoSn, hpnicfFdmiHbaInfoHwVer=hpnicfFdmiHbaInfoHwVer, hpnicfFdmiHbaInfoFabricIndex=hpnicfFdmiHbaInfoFabricIndex, hpnicfFdmiHbaInfoId=hpnicfFdmiHbaInfoId, hpnicfFdmiHbaPortHostName=hpnicfFdmiHbaPortHostName, hpnicfFdmiHbaInfoMaxCTPayload=hpnicfFdmiHbaInfoMaxCTPayload, hpnicfFdmiHbaInfoModelDescr=hpnicfFdmiHbaInfoModelDescr) |
class Config:
env: str = None
episodes: int = None
max_steps: int = None
max_buff: int = None
batch_size: int = None
state_dim: int = None
state_high = None
state_low = None
seed = None
output = 'out'
action_dim: int = None
action_high = None
action_low = None
action_lim = None
learning_rate: float = None
learning_rate_actor: float = None
gamma: float = None
tau: float = None
epsilon: float = None
eps_decay = None
epsilon_min: float = None
use_cuda: bool = True
checkpoint: bool = False
checkpoint_interval: int = None
use_matplotlib: bool = False
record: bool = False
record_ep_interval: int = None
| class Config:
env: str = None
episodes: int = None
max_steps: int = None
max_buff: int = None
batch_size: int = None
state_dim: int = None
state_high = None
state_low = None
seed = None
output = 'out'
action_dim: int = None
action_high = None
action_low = None
action_lim = None
learning_rate: float = None
learning_rate_actor: float = None
gamma: float = None
tau: float = None
epsilon: float = None
eps_decay = None
epsilon_min: float = None
use_cuda: bool = True
checkpoint: bool = False
checkpoint_interval: int = None
use_matplotlib: bool = False
record: bool = False
record_ep_interval: int = None |
# -*- encoding: utf-8 -*-
"""
hio.core.serial Package
"""
| """
hio.core.serial Package
""" |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class Code(object):
"""A convenience object for constructing code.
Logically each object should be a block of code. All methods except |Render|
and |IsEmpty| return self.
"""
def __init__(self, indent_size=2, comment_length=80):
self._code = []
self._indent_level = 0
self._indent_size = indent_size
self._comment_length = comment_length
def Append(self, line='', substitute=True):
"""Appends a line of code at the current indent level or just a newline if
line is not specified. Trailing whitespace is stripped.
substitute: indicated whether this line should be affected by
code.Substitute().
"""
self._code.append(Line(((' ' * self._indent_level) + line).rstrip(),
substitute=substitute))
return self
def IsEmpty(self):
"""Returns True if the Code object is empty.
"""
return not bool(self._code)
def Concat(self, obj):
"""Concatenate another Code object onto this one. Trailing whitespace is
stripped.
Appends the code at the current indent level. Will fail if there are any
un-interpolated format specifiers eg %s, %(something)s which helps
isolate any strings that haven't been substituted.
"""
if not isinstance(obj, Code):
raise TypeError(type(obj))
assert self is not obj
for line in obj._code:
try:
# line % () will fail if any substitution tokens are left in line
if line.substitute:
line.value %= ()
except TypeError:
raise TypeError('Unsubstituted value when concatting\n' + line)
except ValueError:
raise ValueError('Stray % character when concatting\n' + line)
self.Append(line.value, line.substitute)
return self
def Sblock(self, line=''):
"""Starts a code block.
Appends a line of code and then increases the indent level.
"""
self.Append(line)
self._indent_level += self._indent_size
return self
def Eblock(self, line=''):
"""Ends a code block by decreasing and then appending a line (or a blank
line if not given).
"""
# TODO(calamity): Decide if type checking is necessary
#if not isinstance(line, basestring):
# raise TypeError
self._indent_level -= self._indent_size
self.Append(line)
return self
def Comment(self, comment, comment_prefix='// '):
"""Adds the given string as a comment.
Will split the comment if it's too long. Use mainly for variable length
comments. Otherwise just use code.Append('// ...') for comments.
Unaffected by code.Substitute().
"""
max_len = self._comment_length - self._indent_level - len(comment_prefix)
while len(comment) >= max_len:
line = comment[0:max_len]
last_space = line.rfind(' ')
if last_space != -1:
line = line[0:last_space]
comment = comment[last_space + 1:]
else:
comment = comment[max_len:]
self.Append(comment_prefix + line, substitute=False)
self.Append(comment_prefix + comment, substitute=False)
return self
def Substitute(self, d):
"""Goes through each line and interpolates using the given dict.
Raises type error if passed something that isn't a dict
Use for long pieces of code using interpolation with the same variables
repeatedly. This will reduce code and allow for named placeholders which
are more clear.
"""
if not isinstance(d, dict):
raise TypeError('Passed argument is not a dictionary: ' + d)
for i, line in enumerate(self._code):
if self._code[i].substitute:
# Only need to check %s because arg is a dict and python will allow
# '%s %(named)s' but just about nothing else
if '%s' in self._code[i].value or '%r' in self._code[i].value:
raise TypeError('"%s" or "%r" found in substitution. '
'Named arguments only. Use "%" to escape')
self._code[i].value = line.value % d
self._code[i].substitute = False
return self
def Render(self):
"""Renders Code as a string.
"""
return '\n'.join([l.value for l in self._code])
class Line(object):
"""A line of code.
"""
def __init__(self, value, substitute=True):
self.value = value
self.substitute = substitute
| class Code(object):
"""A convenience object for constructing code.
Logically each object should be a block of code. All methods except |Render|
and |IsEmpty| return self.
"""
def __init__(self, indent_size=2, comment_length=80):
self._code = []
self._indent_level = 0
self._indent_size = indent_size
self._comment_length = comment_length
def append(self, line='', substitute=True):
"""Appends a line of code at the current indent level or just a newline if
line is not specified. Trailing whitespace is stripped.
substitute: indicated whether this line should be affected by
code.Substitute().
"""
self._code.append(line((' ' * self._indent_level + line).rstrip(), substitute=substitute))
return self
def is_empty(self):
"""Returns True if the Code object is empty.
"""
return not bool(self._code)
def concat(self, obj):
"""Concatenate another Code object onto this one. Trailing whitespace is
stripped.
Appends the code at the current indent level. Will fail if there are any
un-interpolated format specifiers eg %s, %(something)s which helps
isolate any strings that haven't been substituted.
"""
if not isinstance(obj, Code):
raise type_error(type(obj))
assert self is not obj
for line in obj._code:
try:
if line.substitute:
line.value %= ()
except TypeError:
raise type_error('Unsubstituted value when concatting\n' + line)
except ValueError:
raise value_error('Stray % character when concatting\n' + line)
self.Append(line.value, line.substitute)
return self
def sblock(self, line=''):
"""Starts a code block.
Appends a line of code and then increases the indent level.
"""
self.Append(line)
self._indent_level += self._indent_size
return self
def eblock(self, line=''):
"""Ends a code block by decreasing and then appending a line (or a blank
line if not given).
"""
self._indent_level -= self._indent_size
self.Append(line)
return self
def comment(self, comment, comment_prefix='// '):
"""Adds the given string as a comment.
Will split the comment if it's too long. Use mainly for variable length
comments. Otherwise just use code.Append('// ...') for comments.
Unaffected by code.Substitute().
"""
max_len = self._comment_length - self._indent_level - len(comment_prefix)
while len(comment) >= max_len:
line = comment[0:max_len]
last_space = line.rfind(' ')
if last_space != -1:
line = line[0:last_space]
comment = comment[last_space + 1:]
else:
comment = comment[max_len:]
self.Append(comment_prefix + line, substitute=False)
self.Append(comment_prefix + comment, substitute=False)
return self
def substitute(self, d):
"""Goes through each line and interpolates using the given dict.
Raises type error if passed something that isn't a dict
Use for long pieces of code using interpolation with the same variables
repeatedly. This will reduce code and allow for named placeholders which
are more clear.
"""
if not isinstance(d, dict):
raise type_error('Passed argument is not a dictionary: ' + d)
for (i, line) in enumerate(self._code):
if self._code[i].substitute:
if '%s' in self._code[i].value or '%r' in self._code[i].value:
raise type_error('"%s" or "%r" found in substitution. Named arguments only. Use "%" to escape')
self._code[i].value = line.value % d
self._code[i].substitute = False
return self
def render(self):
"""Renders Code as a string.
"""
return '\n'.join([l.value for l in self._code])
class Line(object):
"""A line of code.
"""
def __init__(self, value, substitute=True):
self.value = value
self.substitute = substitute |
def greeter(name, message='Live Long and Prosper'):
print('Welcome', name, '-', message)
greeter('Eloise')
greeter('Eloise', 'Hope you like Rugby')
def greeter(name, title='Dr', prompt='Welcome', message='Live Long and Prosper'):
print(prompt, title, name, '-', message)
greeter(message='We like Python', name='Lloyd')
greeter('Lloyd', message='We like Python')
| def greeter(name, message='Live Long and Prosper'):
print('Welcome', name, '-', message)
greeter('Eloise')
greeter('Eloise', 'Hope you like Rugby')
def greeter(name, title='Dr', prompt='Welcome', message='Live Long and Prosper'):
print(prompt, title, name, '-', message)
greeter(message='We like Python', name='Lloyd')
greeter('Lloyd', message='We like Python') |
print('+' * 30)
print(' ' * 6, 'CAIXA ELETRONICO')
print('+' * 30)
sacar = int(input('Quanto Deseja Sacar: R$'))
print('+' * 30)
nota50 = sacar // 50
resto = sacar % 50
nota20 = resto // 20
resto = resto % 20
nota10 = resto // 10
resto = resto % 10
nota1 = resto // 1
if nota50 > 0:
print(f'{nota50} Notas de R$50')
if nota20 > 0:
print(f'{nota20} Notas de R$20')
if nota10 > 0:
print(f'{nota10} Notas de R$10')
if nota1 > 0:
print(f'{nota1} Notas de R$1')
print('+' * 30)
| print('+' * 30)
print(' ' * 6, 'CAIXA ELETRONICO')
print('+' * 30)
sacar = int(input('Quanto Deseja Sacar: R$'))
print('+' * 30)
nota50 = sacar // 50
resto = sacar % 50
nota20 = resto // 20
resto = resto % 20
nota10 = resto // 10
resto = resto % 10
nota1 = resto // 1
if nota50 > 0:
print(f'{nota50} Notas de R$50')
if nota20 > 0:
print(f'{nota20} Notas de R$20')
if nota10 > 0:
print(f'{nota10} Notas de R$10')
if nota1 > 0:
print(f'{nota1} Notas de R$1')
print('+' * 30) |
dnas = [
['Tv0(Zs', 90, 11, 3.31, 100, 1, 0.36, {'ott_len': 28, 'ott_percent': 791, 'stop_loss': 85, 'risk_reward': 10, 'chop_rsi_len': 32, 'chop_bandwidth': 285}],
['wLXY\\1', 36, 71, 20.85, 14, 7, -4.76, {'ott_len': 50, 'ott_percent': 419, 'stop_loss': 263, 'risk_reward': 53, 'chop_rsi_len': 34, 'chop_bandwidth': 43}],
['m@7bp/', 42, 113, 20.42, 25, 16, -3.41, {'ott_len': 44, 'ott_percent': 313, 'stop_loss': 116, 'risk_reward': 61, 'chop_rsi_len': 46, 'chop_bandwidth': 36}],
['oA0qI^', 45, 77, 36.93, 35, 14, -0.85, {'ott_len': 45, 'ott_percent': 322, 'stop_loss': 85, 'risk_reward': 75, 'chop_rsi_len': 22, 'chop_bandwidth': 208}],
['oMHHI_', 44, 56, 30.42, 28, 7, 0.35, {'ott_len': 45, 'ott_percent': 428, 'stop_loss': 192, 'risk_reward': 38, 'chop_rsi_len': 22, 'chop_bandwidth': 212}],
['JX,t2j', 44, 97, 30.14, 46, 13, 4.76, {'ott_len': 22, 'ott_percent': 525, 'stop_loss': 68, 'risk_reward': 77, 'chop_rsi_len': 8, 'chop_bandwidth': 252}],
['e<I(af', 80, 20, 6.6, 66, 6, 1.2, {'ott_len': 39, 'ott_percent': 277, 'stop_loss': 196, 'risk_reward': 10, 'chop_rsi_len': 37, 'chop_bandwidth': 238}],
['[,Y.*j', 49, 121, 41.38, 22, 18, -2.42, {'ott_len': 33, 'ott_percent': 135, 'stop_loss': 267, 'risk_reward': 15, 'chop_rsi_len': 3, 'chop_bandwidth': 252}],
['mO4dGF', 38, 97, 21.19, 30, 13, -1.66, {'ott_len': 44, 'ott_percent': 446, 'stop_loss': 103, 'risk_reward': 63, 'chop_rsi_len': 21, 'chop_bandwidth': 120}],
['CRg4wH', 40, 85, 22.04, 44, 9, 0.95, {'ott_len': 18, 'ott_percent': 472, 'stop_loss': 329, 'risk_reward': 21, 'chop_rsi_len': 50, 'chop_bandwidth': 127}],
['wK@GeQ', 42, 68, 22.15, 30, 10, -2.21, {'ott_len': 50, 'ott_percent': 410, 'stop_loss': 156, 'risk_reward': 37, 'chop_rsi_len': 39, 'chop_bandwidth': 161}],
['oMWHF_', 41, 55, 27.45, 28, 7, -3.61, {'ott_len': 45, 'ott_percent': 428, 'stop_loss': 258, 'risk_reward': 38, 'chop_rsi_len': 20, 'chop_bandwidth': 212}],
['YO><L_', 53, 69, 20.56, 50, 10, 5.23, {'ott_len': 31, 'ott_percent': 446, 'stop_loss': 147, 'risk_reward': 28, 'chop_rsi_len': 24, 'chop_bandwidth': 212}],
[',P`(eV', 50, 60, 20.73, 58, 12, 8.04, {'ott_len': 3, 'ott_percent': 454, 'stop_loss': 298, 'risk_reward': 10, 'chop_rsi_len': 39, 'chop_bandwidth': 179}],
['9.9F`9', 35, 275, 28.03, 17, 46, -8.04, {'ott_len': 12, 'ott_percent': 153, 'stop_loss': 125, 'risk_reward': 37, 'chop_rsi_len': 36, 'chop_bandwidth': 72}],
[':JFX)1', 34, 143, 42.36, 30, 13, -1.86, {'ott_len': 12, 'ott_percent': 401, 'stop_loss': 183, 'risk_reward': 53, 'chop_rsi_len': 3, 'chop_bandwidth': 43}],
['9YC;(q', 40, 109, 18.57, 33, 9, -2.36, {'ott_len': 12, 'ott_percent': 534, 'stop_loss': 170, 'risk_reward': 27, 'chop_rsi_len': 2, 'chop_bandwidth': 278}],
['a5v:,r', 44, 69, 36.07, 37, 8, -3.12, {'ott_len': 36, 'ott_percent': 215, 'stop_loss': 396, 'risk_reward': 26, 'chop_rsi_len': 4, 'chop_bandwidth': 282}],
['2D4j*:', 32, 228, 36.17, 37, 24, 1.91, {'ott_len': 7, 'ott_percent': 348, 'stop_loss': 103, 'risk_reward': 68, 'chop_rsi_len': 3, 'chop_bandwidth': 76}],
['H<XF,l', 40, 98, 31.16, 16, 12, -5.22, {'ott_len': 21, 'ott_percent': 277, 'stop_loss': 263, 'risk_reward': 37, 'chop_rsi_len': 4, 'chop_bandwidth': 260}],
['qAAIr^', 47, 21, 9.29, 20, 5, -2.35, {'ott_len': 46, 'ott_percent': 322, 'stop_loss': 161, 'risk_reward': 39, 'chop_rsi_len': 47, 'chop_bandwidth': 208}],
['LH0k\\o', 50, 12, 7.97, 20, 5, -1.93, {'ott_len': 23, 'ott_percent': 384, 'stop_loss': 85, 'risk_reward': 69, 'chop_rsi_len': 34, 'chop_bandwidth': 271}],
['3S.hwT', 50, 54, 37.5, 33, 12, 2.86, {'ott_len': 8, 'ott_percent': 481, 'stop_loss': 77, 'risk_reward': 67, 'chop_rsi_len': 50, 'chop_bandwidth': 172}],
['5S=Q?i', 37, 82, 21.83, 27, 11, -0.59, {'ott_len': 9, 'ott_percent': 481, 'stop_loss': 143, 'risk_reward': 46, 'chop_rsi_len': 16, 'chop_bandwidth': 249}],
['AQr2pa', 47, 19, 10.64, 50, 6, -0.87, {'ott_len': 17, 'ott_percent': 463, 'stop_loss': 378, 'risk_reward': 19, 'chop_rsi_len': 46, 'chop_bandwidth': 219}],
['^D+leP', 46, 106, 32.53, 41, 17, 1.46, {'ott_len': 34, 'ott_percent': 348, 'stop_loss': 63, 'risk_reward': 70, 'chop_rsi_len': 39, 'chop_bandwidth': 157}],
['\\ERgMp', 53, 28, 16.3, 33, 6, -2.59, {'ott_len': 33, 'ott_percent': 357, 'stop_loss': 236, 'risk_reward': 66, 'chop_rsi_len': 24, 'chop_bandwidth': 274}],
['OXf+R_', 60, 58, 30.93, 50, 8, 4.23, {'ott_len': 25, 'ott_percent': 525, 'stop_loss': 325, 'risk_reward': 13, 'chop_rsi_len': 28, 'chop_bandwidth': 212}],
['jVXfX<', 37, 64, 24.67, 14, 7, -4.53, {'ott_len': 42, 'ott_percent': 508, 'stop_loss': 263, 'risk_reward': 65, 'chop_rsi_len': 31, 'chop_bandwidth': 83}],
['vBJh]Z', 43, 53, 39.69, 37, 8, -3.11, {'ott_len': 49, 'ott_percent': 330, 'stop_loss': 201, 'risk_reward': 67, 'chop_rsi_len': 34, 'chop_bandwidth': 194}],
['tutp,b', 50, 40, 52.45, 0, 5, -5.75, {'ott_len': 48, 'ott_percent': 782, 'stop_loss': 387, 'risk_reward': 74, 'chop_rsi_len': 4, 'chop_bandwidth': 223}],
[',W+d^Z', 39, 53, 19.61, 28, 14, 0.82, {'ott_len': 3, 'ott_percent': 516, 'stop_loss': 63, 'risk_reward': 63, 'chop_rsi_len': 35, 'chop_bandwidth': 194}],
['*W44N`', 50, 68, 12.29, 46, 13, 2.81, {'ott_len': 2, 'ott_percent': 516, 'stop_loss': 103, 'risk_reward': 21, 'chop_rsi_len': 25, 'chop_bandwidth': 216}],
[',W+d+F', 31, 284, 37.8, 25, 27, 2.45, {'ott_len': 3, 'ott_percent': 516, 'stop_loss': 63, 'risk_reward': 63, 'chop_rsi_len': 4, 'chop_bandwidth': 120}],
['F/0eI[', 40, 154, 33.68, 42, 21, 2.91, {'ott_len': 20, 'ott_percent': 162, 'stop_loss': 85, 'risk_reward': 64, 'chop_rsi_len': 22, 'chop_bandwidth': 197}],
['9XS,_)', 46, 130, 14.09, 42, 14, 2.82, {'ott_len': 12, 'ott_percent': 525, 'stop_loss': 241, 'risk_reward': 14, 'chop_rsi_len': 35, 'chop_bandwidth': 14}],
['\\BAZGb', 40, 71, 22.33, 36, 11, -3.44, {'ott_len': 33, 'ott_percent': 330, 'stop_loss': 161, 'risk_reward': 54, 'chop_rsi_len': 21, 'chop_bandwidth': 223}],
['iY2;Lq', 76, 21, 8.08, 71, 7, 3.53, {'ott_len': 41, 'ott_percent': 534, 'stop_loss': 94, 'risk_reward': 27, 'chop_rsi_len': 24, 'chop_bandwidth': 278}],
['+D`0XI', 29, 257, 28.25, 22, 31, 3.4, {'ott_len': 3, 'ott_percent': 348, 'stop_loss': 298, 'risk_reward': 17, 'chop_rsi_len': 31, 'chop_bandwidth': 131}],
['OEJO,F', 41, 105, 33.62, 20, 10, -4.61, {'ott_len': 25, 'ott_percent': 357, 'stop_loss': 201, 'risk_reward': 45, 'chop_rsi_len': 4, 'chop_bandwidth': 120}],
[';(o/-K', 33, 278, 16.2, 28, 38, -1.48, {'ott_len': 13, 'ott_percent': 100, 'stop_loss': 365, 'risk_reward': 16, 'chop_rsi_len': 5, 'chop_bandwidth': 138}],
['7R5S-h', 35, 152, 29.19, 35, 14, 2.41, {'ott_len': 10, 'ott_percent': 472, 'stop_loss': 108, 'risk_reward': 48, 'chop_rsi_len': 5, 'chop_bandwidth': 245}],
['tGVME/', 35, 74, 20.06, 20, 10, -4.75, {'ott_len': 48, 'ott_percent': 375, 'stop_loss': 254, 'risk_reward': 43, 'chop_rsi_len': 20, 'chop_bandwidth': 36}],
['oC5drF', 45, 110, 47.73, 35, 14, -1.8, {'ott_len': 45, 'ott_percent': 339, 'stop_loss': 108, 'risk_reward': 63, 'chop_rsi_len': 47, 'chop_bandwidth': 120}],
['.QVrq_', 72, 11, 13.84, 20, 5, -0.62, {'ott_len': 5, 'ott_percent': 463, 'stop_loss': 254, 'risk_reward': 76, 'chop_rsi_len': 46, 'chop_bandwidth': 212}],
['5TKdDm', 37, 51, 17.75, 22, 9, -3.44, {'ott_len': 9, 'ott_percent': 490, 'stop_loss': 205, 'risk_reward': 63, 'chop_rsi_len': 19, 'chop_bandwidth': 263}],
['[B/d7D', 46, 134, 49.17, 35, 17, -2.48, {'ott_len': 33, 'ott_percent': 330, 'stop_loss': 81, 'risk_reward': 63, 'chop_rsi_len': 11, 'chop_bandwidth': 113}],
[')TQ<w\\', 36, 11, 6.5, 28, 7, -1.36, {'ott_len': 2, 'ott_percent': 490, 'stop_loss': 232, 'risk_reward': 28, 'chop_rsi_len': 50, 'chop_bandwidth': 201}],
['gKT*`t', 83, 6, 6.18, 0, 1, -1.31, {'ott_len': 40, 'ott_percent': 410, 'stop_loss': 245, 'risk_reward': 12, 'chop_rsi_len': 36, 'chop_bandwidth': 289}],
['@Om:db', 44, 25, 10.94, 20, 5, -2.7, {'ott_len': 16, 'ott_percent': 446, 'stop_loss': 356, 'risk_reward': 26, 'chop_rsi_len': 38, 'chop_bandwidth': 223}],
['Q[FofV', 41, 55, 23.07, 28, 7, -2.57, {'ott_len': 26, 'ott_percent': 552, 'stop_loss': 183, 'risk_reward': 73, 'chop_rsi_len': 40, 'chop_bandwidth': 179}],
['\\BHH@l', 45, 61, 42.54, 33, 9, -1.02, {'ott_len': 33, 'ott_percent': 330, 'stop_loss': 192, 'risk_reward': 38, 'chop_rsi_len': 17, 'chop_bandwidth': 260}],
['75\\adC', 37, 200, 68.9, 21, 32, -4.78, {'ott_len': 10, 'ott_percent': 215, 'stop_loss': 280, 'risk_reward': 61, 'chop_rsi_len': 38, 'chop_bandwidth': 109}],
['oMvHF`', 42, 45, 22.17, 28, 7, -3.61, {'ott_len': 45, 'ott_percent': 428, 'stop_loss': 396, 'risk_reward': 38, 'chop_rsi_len': 20, 'chop_bandwidth': 216}],
['t;FMPb', 47, 53, 22.55, 33, 6, 1.33, {'ott_len': 48, 'ott_percent': 268, 'stop_loss': 183, 'risk_reward': 43, 'chop_rsi_len': 26, 'chop_bandwidth': 223}],
['_7@QqN', 44, 87, 28.24, 46, 15, 3.21, {'ott_len': 35, 'ott_percent': 233, 'stop_loss': 156, 'risk_reward': 46, 'chop_rsi_len': 46, 'chop_bandwidth': 149}],
['5OCd3F', 33, 150, 49.76, 33, 12, -1.0, {'ott_len': 9, 'ott_percent': 446, 'stop_loss': 170, 'risk_reward': 63, 'chop_rsi_len': 9, 'chop_bandwidth': 120}],
['.PFCsR', 47, 57, 45.36, 36, 11, 1.71, {'ott_len': 5, 'ott_percent': 454, 'stop_loss': 183, 'risk_reward': 34, 'chop_rsi_len': 48, 'chop_bandwidth': 164}],
[',H+c7e', 30, 240, 13.89, 33, 27, 6.32, {'ott_len': 3, 'ott_percent': 384, 'stop_loss': 63, 'risk_reward': 62, 'chop_rsi_len': 11, 'chop_bandwidth': 234}],
['ZB-d3D', 45, 132, 36.83, 33, 18, -0.14, {'ott_len': 32, 'ott_percent': 330, 'stop_loss': 72, 'risk_reward': 63, 'chop_rsi_len': 9, 'chop_bandwidth': 113}],
['D9YmB.', 35, 139, 12.09, 42, 14, -1.17, {'ott_len': 18, 'ott_percent': 251, 'stop_loss': 267, 'risk_reward': 71, 'chop_rsi_len': 18, 'chop_bandwidth': 32}],
['<S*w?2', 34, 188, 21.9, 41, 17, 4.17, {'ott_len': 13, 'ott_percent': 481, 'stop_loss': 59, 'risk_reward': 80, 'chop_rsi_len': 16, 'chop_bandwidth': 47}],
['4juD3[', 36, 95, 32.91, 14, 7, -3.13, {'ott_len': 8, 'ott_percent': 685, 'stop_loss': 391, 'risk_reward': 35, 'chop_rsi_len': 9, 'chop_bandwidth': 197}],
['+BFG)D', 26, 324, 32.58, 22, 31, -0.86, {'ott_len': 3, 'ott_percent': 330, 'stop_loss': 183, 'risk_reward': 37, 'chop_rsi_len': 3, 'chop_bandwidth': 113}],
['@]*Bg5', 62, 140, 27.38, 57, 14, 1.83, {'ott_len': 16, 'ott_percent': 570, 'stop_loss': 59, 'risk_reward': 33, 'chop_rsi_len': 40, 'chop_bandwidth': 58}],
['1Pj:,K', 28, 143, 14.43, 35, 14, -1.15, {'ott_len': 7, 'ott_percent': 454, 'stop_loss': 342, 'risk_reward': 26, 'chop_rsi_len': 4, 'chop_bandwidth': 138}],
['G5M(hV', 61, 68, 8.34, 69, 13, 5.3, {'ott_len': 20, 'ott_percent': 215, 'stop_loss': 214, 'risk_reward': 10, 'chop_rsi_len': 41, 'chop_bandwidth': 179}],
['M[,q.f', 38, 92, 10.67, 25, 12, -3.19, {'ott_len': 24, 'ott_percent': 552, 'stop_loss': 68, 'risk_reward': 75, 'chop_rsi_len': 6, 'chop_bandwidth': 238}],
['+ZOg>n', 35, 70, 23.29, 33, 9, -1.16, {'ott_len': 3, 'ott_percent': 543, 'stop_loss': 223, 'risk_reward': 66, 'chop_rsi_len': 15, 'chop_bandwidth': 267}],
['H<-\\5i', 45, 140, 23.73, 30, 20, -3.11, {'ott_len': 21, 'ott_percent': 277, 'stop_loss': 72, 'risk_reward': 56, 'chop_rsi_len': 10, 'chop_bandwidth': 249}],
['1CndgF', 34, 156, 49.82, 41, 17, 2.8, {'ott_len': 7, 'ott_percent': 339, 'stop_loss': 360, 'risk_reward': 63, 'chop_rsi_len': 40, 'chop_bandwidth': 120}],
['/N7r.J', 30, 193, 13.97, 25, 16, -0.27, {'ott_len': 5, 'ott_percent': 437, 'stop_loss': 116, 'risk_reward': 76, 'chop_rsi_len': 6, 'chop_bandwidth': 135}],
['PD1>V<', 54, 163, 20.0, 55, 20, 3.96, {'ott_len': 26, 'ott_percent': 348, 'stop_loss': 90, 'risk_reward': 29, 'chop_rsi_len': 30, 'chop_bandwidth': 83}],
['oB4dID', 45, 118, 56.11, 35, 14, -2.13, {'ott_len': 45, 'ott_percent': 330, 'stop_loss': 103, 'risk_reward': 63, 'chop_rsi_len': 22, 'chop_bandwidth': 113}],
['l7\\gc^', 60, 35, 42.7, 25, 8, -1.2, {'ott_len': 43, 'ott_percent': 233, 'stop_loss': 280, 'risk_reward': 66, 'chop_rsi_len': 38, 'chop_bandwidth': 208}],
['07t1iJ', 30, 199, 23.05, 26, 30, -1.64, {'ott_len': 6, 'ott_percent': 233, 'stop_loss': 387, 'risk_reward': 18, 'chop_rsi_len': 41, 'chop_bandwidth': 135}],
['5f6+)7', 67, 154, 17.73, 83, 12, 4.9, {'ott_len': 9, 'ott_percent': 649, 'stop_loss': 112, 'risk_reward': 13, 'chop_rsi_len': 3, 'chop_bandwidth': 65}],
['<A?I4^', 38, 159, 45.22, 35, 17, 5.35, {'ott_len': 13, 'ott_percent': 322, 'stop_loss': 152, 'risk_reward': 39, 'chop_rsi_len': 9, 'chop_bandwidth': 208}],
['i7nMgb', 54, 24, 28.38, 0, 4, -2.04, {'ott_len': 41, 'ott_percent': 233, 'stop_loss': 360, 'risk_reward': 43, 'chop_rsi_len': 40, 'chop_bandwidth': 223}],
['o:JK9p', 50, 62, 32.74, 37, 8, -0.2, {'ott_len': 45, 'ott_percent': 259, 'stop_loss': 201, 'risk_reward': 41, 'chop_rsi_len': 12, 'chop_bandwidth': 274}],
['`8*VG,', 48, 167, 27.71, 43, 23, 5.44, {'ott_len': 36, 'ott_percent': 242, 'stop_loss': 59, 'risk_reward': 51, 'chop_rsi_len': 21, 'chop_bandwidth': 25}],
['7P0n)2', 35, 182, 37.96, 37, 16, 1.33, {'ott_len': 10, 'ott_percent': 454, 'stop_loss': 85, 'risk_reward': 72, 'chop_rsi_len': 3, 'chop_bandwidth': 47}],
['DFRlX-', 38, 112, 21.16, 27, 11, -1.95, {'ott_len': 18, 'ott_percent': 366, 'stop_loss': 236, 'risk_reward': 70, 'chop_rsi_len': 31, 'chop_bandwidth': 28}],
['CE)V>;', 47, 197, 19.86, 57, 21, 7.03, {'ott_len': 18, 'ott_percent': 357, 'stop_loss': 54, 'risk_reward': 51, 'chop_rsi_len': 15, 'chop_bandwidth': 80}],
['91u6iJ', 33, 163, 31.1, 25, 27, -3.59, {'ott_len': 12, 'ott_percent': 180, 'stop_loss': 391, 'risk_reward': 22, 'chop_rsi_len': 41, 'chop_bandwidth': 135}],
['4Ptp2B', 34, 136, 35.44, 28, 14, -1.41, {'ott_len': 8, 'ott_percent': 454, 'stop_loss': 387, 'risk_reward': 74, 'chop_rsi_len': 8, 'chop_bandwidth': 105}],
[',[+o+V', 30, 267, 51.0, 23, 21, 2.16, {'ott_len': 3, 'ott_percent': 552, 'stop_loss': 63, 'risk_reward': 73, 'chop_rsi_len': 4, 'chop_bandwidth': 179}],
['RcvHf_', 53, 28, 17.13, 16, 6, -4.14, {'ott_len': 27, 'ott_percent': 623, 'stop_loss': 396, 'risk_reward': 38, 'chop_rsi_len': 40, 'chop_bandwidth': 212}],
['c3rg61', 39, 91, 11.05, 27, 11, -1.18, {'ott_len': 38, 'ott_percent': 197, 'stop_loss': 378, 'risk_reward': 66, 'chop_rsi_len': 11, 'chop_bandwidth': 43}],
['k:VQKm', 61, 34, 55.14, 20, 5, -1.93, {'ott_len': 43, 'ott_percent': 259, 'stop_loss': 254, 'risk_reward': 46, 'chop_rsi_len': 23, 'chop_bandwidth': 263}],
['a<<sMo', 59, 27, 25.74, 33, 6, -1.06, {'ott_len': 36, 'ott_percent': 277, 'stop_loss': 139, 'risk_reward': 76, 'chop_rsi_len': 24, 'chop_bandwidth': 271}],
['5Bl/TL', 32, 153, 26.35, 28, 21, 0.03, {'ott_len': 9, 'ott_percent': 330, 'stop_loss': 351, 'risk_reward': 16, 'chop_rsi_len': 29, 'chop_bandwidth': 142}],
['Y-j@sZ', 56, 23, 20.73, 0, 3, -1.74, {'ott_len': 31, 'ott_percent': 144, 'stop_loss': 342, 'risk_reward': 31, 'chop_rsi_len': 48, 'chop_bandwidth': 194}],
['><r+c-', 39, 161, 18.91, 44, 18, 5.83, {'ott_len': 15, 'ott_percent': 277, 'stop_loss': 378, 'risk_reward': 13, 'chop_rsi_len': 38, 'chop_bandwidth': 28}],
['5@E5rH', 37, 168, 22.7, 43, 23, 7.03, {'ott_len': 9, 'ott_percent': 313, 'stop_loss': 178, 'risk_reward': 22, 'chop_rsi_len': 47, 'chop_bandwidth': 127}],
['v@WLkU', 46, 47, 45.51, 20, 10, -4.43, {'ott_len': 49, 'ott_percent': 313, 'stop_loss': 258, 'risk_reward': 42, 'chop_rsi_len': 43, 'chop_bandwidth': 175}],
['g<)r>J', 46, 137, 36.35, 42, 19, 2.02, {'ott_len': 40, 'ott_percent': 277, 'stop_loss': 54, 'risk_reward': 76, 'chop_rsi_len': 15, 'chop_bandwidth': 135}],
['+BFdKD', 29, 295, 38.89, 24, 29, -2.33, {'ott_len': 3, 'ott_percent': 330, 'stop_loss': 183, 'risk_reward': 63, 'chop_rsi_len': 23, 'chop_bandwidth': 113}],
[',jiF3Y', 27, 136, 28.09, 45, 11, 0.43, {'ott_len': 3, 'ott_percent': 685, 'stop_loss': 338, 'risk_reward': 37, 'chop_rsi_len': 9, 'chop_bandwidth': 190}],
['1EkquE', 33, 156, 45.58, 27, 18, -1.61, {'ott_len': 7, 'ott_percent': 357, 'stop_loss': 347, 'risk_reward': 75, 'chop_rsi_len': 49, 'chop_bandwidth': 116}],
['2c0HI_', 47, 92, 21.02, 50, 16, 5.48, {'ott_len': 7, 'ott_percent': 623, 'stop_loss': 85, 'risk_reward': 38, 'chop_rsi_len': 22, 'chop_bandwidth': 212}],
['+BFdrD', 26, 263, 26.97, 24, 29, -2.82, {'ott_len': 3, 'ott_percent': 330, 'stop_loss': 183, 'risk_reward': 63, 'chop_rsi_len': 47, 'chop_bandwidth': 113}],
[',B`d6D', 30, 297, 39.81, 26, 30, 0.5, {'ott_len': 3, 'ott_percent': 330, 'stop_loss': 298, 'risk_reward': 63, 'chop_rsi_len': 11, 'chop_bandwidth': 113}],
['r6:IS^', 55, 67, 37.97, 53, 13, 4.91, {'ott_len': 47, 'ott_percent': 224, 'stop_loss': 130, 'risk_reward': 39, 'chop_rsi_len': 28, 'chop_bandwidth': 208}],
['5swn)a', 30, 86, 13.25, 8, 12, -6.03, {'ott_len': 9, 'ott_percent': 765, 'stop_loss': 400, 'risk_reward': 72, 'chop_rsi_len': 3, 'chop_bandwidth': 219}],
['5H3VCa', 37, 126, 32.34, 37, 16, 4.24, {'ott_len': 9, 'ott_percent': 384, 'stop_loss': 99, 'risk_reward': 51, 'chop_rsi_len': 18, 'chop_bandwidth': 219}],
['lR\\iHN', 38, 62, 35.84, 28, 7, -4.01, {'ott_len': 43, 'ott_percent': 472, 'stop_loss': 280, 'risk_reward': 68, 'chop_rsi_len': 21, 'chop_bandwidth': 149}],
]
| dnas = [['Tv0(Zs', 90, 11, 3.31, 100, 1, 0.36, {'ott_len': 28, 'ott_percent': 791, 'stop_loss': 85, 'risk_reward': 10, 'chop_rsi_len': 32, 'chop_bandwidth': 285}], ['wLXY\\1', 36, 71, 20.85, 14, 7, -4.76, {'ott_len': 50, 'ott_percent': 419, 'stop_loss': 263, 'risk_reward': 53, 'chop_rsi_len': 34, 'chop_bandwidth': 43}], ['m@7bp/', 42, 113, 20.42, 25, 16, -3.41, {'ott_len': 44, 'ott_percent': 313, 'stop_loss': 116, 'risk_reward': 61, 'chop_rsi_len': 46, 'chop_bandwidth': 36}], ['oA0qI^', 45, 77, 36.93, 35, 14, -0.85, {'ott_len': 45, 'ott_percent': 322, 'stop_loss': 85, 'risk_reward': 75, 'chop_rsi_len': 22, 'chop_bandwidth': 208}], ['oMHHI_', 44, 56, 30.42, 28, 7, 0.35, {'ott_len': 45, 'ott_percent': 428, 'stop_loss': 192, 'risk_reward': 38, 'chop_rsi_len': 22, 'chop_bandwidth': 212}], ['JX,t2j', 44, 97, 30.14, 46, 13, 4.76, {'ott_len': 22, 'ott_percent': 525, 'stop_loss': 68, 'risk_reward': 77, 'chop_rsi_len': 8, 'chop_bandwidth': 252}], ['e<I(af', 80, 20, 6.6, 66, 6, 1.2, {'ott_len': 39, 'ott_percent': 277, 'stop_loss': 196, 'risk_reward': 10, 'chop_rsi_len': 37, 'chop_bandwidth': 238}], ['[,Y.*j', 49, 121, 41.38, 22, 18, -2.42, {'ott_len': 33, 'ott_percent': 135, 'stop_loss': 267, 'risk_reward': 15, 'chop_rsi_len': 3, 'chop_bandwidth': 252}], ['mO4dGF', 38, 97, 21.19, 30, 13, -1.66, {'ott_len': 44, 'ott_percent': 446, 'stop_loss': 103, 'risk_reward': 63, 'chop_rsi_len': 21, 'chop_bandwidth': 120}], ['CRg4wH', 40, 85, 22.04, 44, 9, 0.95, {'ott_len': 18, 'ott_percent': 472, 'stop_loss': 329, 'risk_reward': 21, 'chop_rsi_len': 50, 'chop_bandwidth': 127}], ['wK@GeQ', 42, 68, 22.15, 30, 10, -2.21, {'ott_len': 50, 'ott_percent': 410, 'stop_loss': 156, 'risk_reward': 37, 'chop_rsi_len': 39, 'chop_bandwidth': 161}], ['oMWHF_', 41, 55, 27.45, 28, 7, -3.61, {'ott_len': 45, 'ott_percent': 428, 'stop_loss': 258, 'risk_reward': 38, 'chop_rsi_len': 20, 'chop_bandwidth': 212}], ['YO><L_', 53, 69, 20.56, 50, 10, 5.23, {'ott_len': 31, 'ott_percent': 446, 'stop_loss': 147, 'risk_reward': 28, 'chop_rsi_len': 24, 'chop_bandwidth': 212}], [',P`(eV', 50, 60, 20.73, 58, 12, 8.04, {'ott_len': 3, 'ott_percent': 454, 'stop_loss': 298, 'risk_reward': 10, 'chop_rsi_len': 39, 'chop_bandwidth': 179}], ['9.9F`9', 35, 275, 28.03, 17, 46, -8.04, {'ott_len': 12, 'ott_percent': 153, 'stop_loss': 125, 'risk_reward': 37, 'chop_rsi_len': 36, 'chop_bandwidth': 72}], [':JFX)1', 34, 143, 42.36, 30, 13, -1.86, {'ott_len': 12, 'ott_percent': 401, 'stop_loss': 183, 'risk_reward': 53, 'chop_rsi_len': 3, 'chop_bandwidth': 43}], ['9YC;(q', 40, 109, 18.57, 33, 9, -2.36, {'ott_len': 12, 'ott_percent': 534, 'stop_loss': 170, 'risk_reward': 27, 'chop_rsi_len': 2, 'chop_bandwidth': 278}], ['a5v:,r', 44, 69, 36.07, 37, 8, -3.12, {'ott_len': 36, 'ott_percent': 215, 'stop_loss': 396, 'risk_reward': 26, 'chop_rsi_len': 4, 'chop_bandwidth': 282}], ['2D4j*:', 32, 228, 36.17, 37, 24, 1.91, {'ott_len': 7, 'ott_percent': 348, 'stop_loss': 103, 'risk_reward': 68, 'chop_rsi_len': 3, 'chop_bandwidth': 76}], ['H<XF,l', 40, 98, 31.16, 16, 12, -5.22, {'ott_len': 21, 'ott_percent': 277, 'stop_loss': 263, 'risk_reward': 37, 'chop_rsi_len': 4, 'chop_bandwidth': 260}], ['qAAIr^', 47, 21, 9.29, 20, 5, -2.35, {'ott_len': 46, 'ott_percent': 322, 'stop_loss': 161, 'risk_reward': 39, 'chop_rsi_len': 47, 'chop_bandwidth': 208}], ['LH0k\\o', 50, 12, 7.97, 20, 5, -1.93, {'ott_len': 23, 'ott_percent': 384, 'stop_loss': 85, 'risk_reward': 69, 'chop_rsi_len': 34, 'chop_bandwidth': 271}], ['3S.hwT', 50, 54, 37.5, 33, 12, 2.86, {'ott_len': 8, 'ott_percent': 481, 'stop_loss': 77, 'risk_reward': 67, 'chop_rsi_len': 50, 'chop_bandwidth': 172}], ['5S=Q?i', 37, 82, 21.83, 27, 11, -0.59, {'ott_len': 9, 'ott_percent': 481, 'stop_loss': 143, 'risk_reward': 46, 'chop_rsi_len': 16, 'chop_bandwidth': 249}], ['AQr2pa', 47, 19, 10.64, 50, 6, -0.87, {'ott_len': 17, 'ott_percent': 463, 'stop_loss': 378, 'risk_reward': 19, 'chop_rsi_len': 46, 'chop_bandwidth': 219}], ['^D+leP', 46, 106, 32.53, 41, 17, 1.46, {'ott_len': 34, 'ott_percent': 348, 'stop_loss': 63, 'risk_reward': 70, 'chop_rsi_len': 39, 'chop_bandwidth': 157}], ['\\ERgMp', 53, 28, 16.3, 33, 6, -2.59, {'ott_len': 33, 'ott_percent': 357, 'stop_loss': 236, 'risk_reward': 66, 'chop_rsi_len': 24, 'chop_bandwidth': 274}], ['OXf+R_', 60, 58, 30.93, 50, 8, 4.23, {'ott_len': 25, 'ott_percent': 525, 'stop_loss': 325, 'risk_reward': 13, 'chop_rsi_len': 28, 'chop_bandwidth': 212}], ['jVXfX<', 37, 64, 24.67, 14, 7, -4.53, {'ott_len': 42, 'ott_percent': 508, 'stop_loss': 263, 'risk_reward': 65, 'chop_rsi_len': 31, 'chop_bandwidth': 83}], ['vBJh]Z', 43, 53, 39.69, 37, 8, -3.11, {'ott_len': 49, 'ott_percent': 330, 'stop_loss': 201, 'risk_reward': 67, 'chop_rsi_len': 34, 'chop_bandwidth': 194}], ['tutp,b', 50, 40, 52.45, 0, 5, -5.75, {'ott_len': 48, 'ott_percent': 782, 'stop_loss': 387, 'risk_reward': 74, 'chop_rsi_len': 4, 'chop_bandwidth': 223}], [',W+d^Z', 39, 53, 19.61, 28, 14, 0.82, {'ott_len': 3, 'ott_percent': 516, 'stop_loss': 63, 'risk_reward': 63, 'chop_rsi_len': 35, 'chop_bandwidth': 194}], ['*W44N`', 50, 68, 12.29, 46, 13, 2.81, {'ott_len': 2, 'ott_percent': 516, 'stop_loss': 103, 'risk_reward': 21, 'chop_rsi_len': 25, 'chop_bandwidth': 216}], [',W+d+F', 31, 284, 37.8, 25, 27, 2.45, {'ott_len': 3, 'ott_percent': 516, 'stop_loss': 63, 'risk_reward': 63, 'chop_rsi_len': 4, 'chop_bandwidth': 120}], ['F/0eI[', 40, 154, 33.68, 42, 21, 2.91, {'ott_len': 20, 'ott_percent': 162, 'stop_loss': 85, 'risk_reward': 64, 'chop_rsi_len': 22, 'chop_bandwidth': 197}], ['9XS,_)', 46, 130, 14.09, 42, 14, 2.82, {'ott_len': 12, 'ott_percent': 525, 'stop_loss': 241, 'risk_reward': 14, 'chop_rsi_len': 35, 'chop_bandwidth': 14}], ['\\BAZGb', 40, 71, 22.33, 36, 11, -3.44, {'ott_len': 33, 'ott_percent': 330, 'stop_loss': 161, 'risk_reward': 54, 'chop_rsi_len': 21, 'chop_bandwidth': 223}], ['iY2;Lq', 76, 21, 8.08, 71, 7, 3.53, {'ott_len': 41, 'ott_percent': 534, 'stop_loss': 94, 'risk_reward': 27, 'chop_rsi_len': 24, 'chop_bandwidth': 278}], ['+D`0XI', 29, 257, 28.25, 22, 31, 3.4, {'ott_len': 3, 'ott_percent': 348, 'stop_loss': 298, 'risk_reward': 17, 'chop_rsi_len': 31, 'chop_bandwidth': 131}], ['OEJO,F', 41, 105, 33.62, 20, 10, -4.61, {'ott_len': 25, 'ott_percent': 357, 'stop_loss': 201, 'risk_reward': 45, 'chop_rsi_len': 4, 'chop_bandwidth': 120}], [';(o/-K', 33, 278, 16.2, 28, 38, -1.48, {'ott_len': 13, 'ott_percent': 100, 'stop_loss': 365, 'risk_reward': 16, 'chop_rsi_len': 5, 'chop_bandwidth': 138}], ['7R5S-h', 35, 152, 29.19, 35, 14, 2.41, {'ott_len': 10, 'ott_percent': 472, 'stop_loss': 108, 'risk_reward': 48, 'chop_rsi_len': 5, 'chop_bandwidth': 245}], ['tGVME/', 35, 74, 20.06, 20, 10, -4.75, {'ott_len': 48, 'ott_percent': 375, 'stop_loss': 254, 'risk_reward': 43, 'chop_rsi_len': 20, 'chop_bandwidth': 36}], ['oC5drF', 45, 110, 47.73, 35, 14, -1.8, {'ott_len': 45, 'ott_percent': 339, 'stop_loss': 108, 'risk_reward': 63, 'chop_rsi_len': 47, 'chop_bandwidth': 120}], ['.QVrq_', 72, 11, 13.84, 20, 5, -0.62, {'ott_len': 5, 'ott_percent': 463, 'stop_loss': 254, 'risk_reward': 76, 'chop_rsi_len': 46, 'chop_bandwidth': 212}], ['5TKdDm', 37, 51, 17.75, 22, 9, -3.44, {'ott_len': 9, 'ott_percent': 490, 'stop_loss': 205, 'risk_reward': 63, 'chop_rsi_len': 19, 'chop_bandwidth': 263}], ['[B/d7D', 46, 134, 49.17, 35, 17, -2.48, {'ott_len': 33, 'ott_percent': 330, 'stop_loss': 81, 'risk_reward': 63, 'chop_rsi_len': 11, 'chop_bandwidth': 113}], [')TQ<w\\', 36, 11, 6.5, 28, 7, -1.36, {'ott_len': 2, 'ott_percent': 490, 'stop_loss': 232, 'risk_reward': 28, 'chop_rsi_len': 50, 'chop_bandwidth': 201}], ['gKT*`t', 83, 6, 6.18, 0, 1, -1.31, {'ott_len': 40, 'ott_percent': 410, 'stop_loss': 245, 'risk_reward': 12, 'chop_rsi_len': 36, 'chop_bandwidth': 289}], ['@Om:db', 44, 25, 10.94, 20, 5, -2.7, {'ott_len': 16, 'ott_percent': 446, 'stop_loss': 356, 'risk_reward': 26, 'chop_rsi_len': 38, 'chop_bandwidth': 223}], ['Q[FofV', 41, 55, 23.07, 28, 7, -2.57, {'ott_len': 26, 'ott_percent': 552, 'stop_loss': 183, 'risk_reward': 73, 'chop_rsi_len': 40, 'chop_bandwidth': 179}], ['\\BHH@l', 45, 61, 42.54, 33, 9, -1.02, {'ott_len': 33, 'ott_percent': 330, 'stop_loss': 192, 'risk_reward': 38, 'chop_rsi_len': 17, 'chop_bandwidth': 260}], ['75\\adC', 37, 200, 68.9, 21, 32, -4.78, {'ott_len': 10, 'ott_percent': 215, 'stop_loss': 280, 'risk_reward': 61, 'chop_rsi_len': 38, 'chop_bandwidth': 109}], ['oMvHF`', 42, 45, 22.17, 28, 7, -3.61, {'ott_len': 45, 'ott_percent': 428, 'stop_loss': 396, 'risk_reward': 38, 'chop_rsi_len': 20, 'chop_bandwidth': 216}], ['t;FMPb', 47, 53, 22.55, 33, 6, 1.33, {'ott_len': 48, 'ott_percent': 268, 'stop_loss': 183, 'risk_reward': 43, 'chop_rsi_len': 26, 'chop_bandwidth': 223}], ['_7@QqN', 44, 87, 28.24, 46, 15, 3.21, {'ott_len': 35, 'ott_percent': 233, 'stop_loss': 156, 'risk_reward': 46, 'chop_rsi_len': 46, 'chop_bandwidth': 149}], ['5OCd3F', 33, 150, 49.76, 33, 12, -1.0, {'ott_len': 9, 'ott_percent': 446, 'stop_loss': 170, 'risk_reward': 63, 'chop_rsi_len': 9, 'chop_bandwidth': 120}], ['.PFCsR', 47, 57, 45.36, 36, 11, 1.71, {'ott_len': 5, 'ott_percent': 454, 'stop_loss': 183, 'risk_reward': 34, 'chop_rsi_len': 48, 'chop_bandwidth': 164}], [',H+c7e', 30, 240, 13.89, 33, 27, 6.32, {'ott_len': 3, 'ott_percent': 384, 'stop_loss': 63, 'risk_reward': 62, 'chop_rsi_len': 11, 'chop_bandwidth': 234}], ['ZB-d3D', 45, 132, 36.83, 33, 18, -0.14, {'ott_len': 32, 'ott_percent': 330, 'stop_loss': 72, 'risk_reward': 63, 'chop_rsi_len': 9, 'chop_bandwidth': 113}], ['D9YmB.', 35, 139, 12.09, 42, 14, -1.17, {'ott_len': 18, 'ott_percent': 251, 'stop_loss': 267, 'risk_reward': 71, 'chop_rsi_len': 18, 'chop_bandwidth': 32}], ['<S*w?2', 34, 188, 21.9, 41, 17, 4.17, {'ott_len': 13, 'ott_percent': 481, 'stop_loss': 59, 'risk_reward': 80, 'chop_rsi_len': 16, 'chop_bandwidth': 47}], ['4juD3[', 36, 95, 32.91, 14, 7, -3.13, {'ott_len': 8, 'ott_percent': 685, 'stop_loss': 391, 'risk_reward': 35, 'chop_rsi_len': 9, 'chop_bandwidth': 197}], ['+BFG)D', 26, 324, 32.58, 22, 31, -0.86, {'ott_len': 3, 'ott_percent': 330, 'stop_loss': 183, 'risk_reward': 37, 'chop_rsi_len': 3, 'chop_bandwidth': 113}], ['@]*Bg5', 62, 140, 27.38, 57, 14, 1.83, {'ott_len': 16, 'ott_percent': 570, 'stop_loss': 59, 'risk_reward': 33, 'chop_rsi_len': 40, 'chop_bandwidth': 58}], ['1Pj:,K', 28, 143, 14.43, 35, 14, -1.15, {'ott_len': 7, 'ott_percent': 454, 'stop_loss': 342, 'risk_reward': 26, 'chop_rsi_len': 4, 'chop_bandwidth': 138}], ['G5M(hV', 61, 68, 8.34, 69, 13, 5.3, {'ott_len': 20, 'ott_percent': 215, 'stop_loss': 214, 'risk_reward': 10, 'chop_rsi_len': 41, 'chop_bandwidth': 179}], ['M[,q.f', 38, 92, 10.67, 25, 12, -3.19, {'ott_len': 24, 'ott_percent': 552, 'stop_loss': 68, 'risk_reward': 75, 'chop_rsi_len': 6, 'chop_bandwidth': 238}], ['+ZOg>n', 35, 70, 23.29, 33, 9, -1.16, {'ott_len': 3, 'ott_percent': 543, 'stop_loss': 223, 'risk_reward': 66, 'chop_rsi_len': 15, 'chop_bandwidth': 267}], ['H<-\\5i', 45, 140, 23.73, 30, 20, -3.11, {'ott_len': 21, 'ott_percent': 277, 'stop_loss': 72, 'risk_reward': 56, 'chop_rsi_len': 10, 'chop_bandwidth': 249}], ['1CndgF', 34, 156, 49.82, 41, 17, 2.8, {'ott_len': 7, 'ott_percent': 339, 'stop_loss': 360, 'risk_reward': 63, 'chop_rsi_len': 40, 'chop_bandwidth': 120}], ['/N7r.J', 30, 193, 13.97, 25, 16, -0.27, {'ott_len': 5, 'ott_percent': 437, 'stop_loss': 116, 'risk_reward': 76, 'chop_rsi_len': 6, 'chop_bandwidth': 135}], ['PD1>V<', 54, 163, 20.0, 55, 20, 3.96, {'ott_len': 26, 'ott_percent': 348, 'stop_loss': 90, 'risk_reward': 29, 'chop_rsi_len': 30, 'chop_bandwidth': 83}], ['oB4dID', 45, 118, 56.11, 35, 14, -2.13, {'ott_len': 45, 'ott_percent': 330, 'stop_loss': 103, 'risk_reward': 63, 'chop_rsi_len': 22, 'chop_bandwidth': 113}], ['l7\\gc^', 60, 35, 42.7, 25, 8, -1.2, {'ott_len': 43, 'ott_percent': 233, 'stop_loss': 280, 'risk_reward': 66, 'chop_rsi_len': 38, 'chop_bandwidth': 208}], ['07t1iJ', 30, 199, 23.05, 26, 30, -1.64, {'ott_len': 6, 'ott_percent': 233, 'stop_loss': 387, 'risk_reward': 18, 'chop_rsi_len': 41, 'chop_bandwidth': 135}], ['5f6+)7', 67, 154, 17.73, 83, 12, 4.9, {'ott_len': 9, 'ott_percent': 649, 'stop_loss': 112, 'risk_reward': 13, 'chop_rsi_len': 3, 'chop_bandwidth': 65}], ['<A?I4^', 38, 159, 45.22, 35, 17, 5.35, {'ott_len': 13, 'ott_percent': 322, 'stop_loss': 152, 'risk_reward': 39, 'chop_rsi_len': 9, 'chop_bandwidth': 208}], ['i7nMgb', 54, 24, 28.38, 0, 4, -2.04, {'ott_len': 41, 'ott_percent': 233, 'stop_loss': 360, 'risk_reward': 43, 'chop_rsi_len': 40, 'chop_bandwidth': 223}], ['o:JK9p', 50, 62, 32.74, 37, 8, -0.2, {'ott_len': 45, 'ott_percent': 259, 'stop_loss': 201, 'risk_reward': 41, 'chop_rsi_len': 12, 'chop_bandwidth': 274}], ['`8*VG,', 48, 167, 27.71, 43, 23, 5.44, {'ott_len': 36, 'ott_percent': 242, 'stop_loss': 59, 'risk_reward': 51, 'chop_rsi_len': 21, 'chop_bandwidth': 25}], ['7P0n)2', 35, 182, 37.96, 37, 16, 1.33, {'ott_len': 10, 'ott_percent': 454, 'stop_loss': 85, 'risk_reward': 72, 'chop_rsi_len': 3, 'chop_bandwidth': 47}], ['DFRlX-', 38, 112, 21.16, 27, 11, -1.95, {'ott_len': 18, 'ott_percent': 366, 'stop_loss': 236, 'risk_reward': 70, 'chop_rsi_len': 31, 'chop_bandwidth': 28}], ['CE)V>;', 47, 197, 19.86, 57, 21, 7.03, {'ott_len': 18, 'ott_percent': 357, 'stop_loss': 54, 'risk_reward': 51, 'chop_rsi_len': 15, 'chop_bandwidth': 80}], ['91u6iJ', 33, 163, 31.1, 25, 27, -3.59, {'ott_len': 12, 'ott_percent': 180, 'stop_loss': 391, 'risk_reward': 22, 'chop_rsi_len': 41, 'chop_bandwidth': 135}], ['4Ptp2B', 34, 136, 35.44, 28, 14, -1.41, {'ott_len': 8, 'ott_percent': 454, 'stop_loss': 387, 'risk_reward': 74, 'chop_rsi_len': 8, 'chop_bandwidth': 105}], [',[+o+V', 30, 267, 51.0, 23, 21, 2.16, {'ott_len': 3, 'ott_percent': 552, 'stop_loss': 63, 'risk_reward': 73, 'chop_rsi_len': 4, 'chop_bandwidth': 179}], ['RcvHf_', 53, 28, 17.13, 16, 6, -4.14, {'ott_len': 27, 'ott_percent': 623, 'stop_loss': 396, 'risk_reward': 38, 'chop_rsi_len': 40, 'chop_bandwidth': 212}], ['c3rg61', 39, 91, 11.05, 27, 11, -1.18, {'ott_len': 38, 'ott_percent': 197, 'stop_loss': 378, 'risk_reward': 66, 'chop_rsi_len': 11, 'chop_bandwidth': 43}], ['k:VQKm', 61, 34, 55.14, 20, 5, -1.93, {'ott_len': 43, 'ott_percent': 259, 'stop_loss': 254, 'risk_reward': 46, 'chop_rsi_len': 23, 'chop_bandwidth': 263}], ['a<<sMo', 59, 27, 25.74, 33, 6, -1.06, {'ott_len': 36, 'ott_percent': 277, 'stop_loss': 139, 'risk_reward': 76, 'chop_rsi_len': 24, 'chop_bandwidth': 271}], ['5Bl/TL', 32, 153, 26.35, 28, 21, 0.03, {'ott_len': 9, 'ott_percent': 330, 'stop_loss': 351, 'risk_reward': 16, 'chop_rsi_len': 29, 'chop_bandwidth': 142}], ['Y-j@sZ', 56, 23, 20.73, 0, 3, -1.74, {'ott_len': 31, 'ott_percent': 144, 'stop_loss': 342, 'risk_reward': 31, 'chop_rsi_len': 48, 'chop_bandwidth': 194}], ['><r+c-', 39, 161, 18.91, 44, 18, 5.83, {'ott_len': 15, 'ott_percent': 277, 'stop_loss': 378, 'risk_reward': 13, 'chop_rsi_len': 38, 'chop_bandwidth': 28}], ['5@E5rH', 37, 168, 22.7, 43, 23, 7.03, {'ott_len': 9, 'ott_percent': 313, 'stop_loss': 178, 'risk_reward': 22, 'chop_rsi_len': 47, 'chop_bandwidth': 127}], ['v@WLkU', 46, 47, 45.51, 20, 10, -4.43, {'ott_len': 49, 'ott_percent': 313, 'stop_loss': 258, 'risk_reward': 42, 'chop_rsi_len': 43, 'chop_bandwidth': 175}], ['g<)r>J', 46, 137, 36.35, 42, 19, 2.02, {'ott_len': 40, 'ott_percent': 277, 'stop_loss': 54, 'risk_reward': 76, 'chop_rsi_len': 15, 'chop_bandwidth': 135}], ['+BFdKD', 29, 295, 38.89, 24, 29, -2.33, {'ott_len': 3, 'ott_percent': 330, 'stop_loss': 183, 'risk_reward': 63, 'chop_rsi_len': 23, 'chop_bandwidth': 113}], [',jiF3Y', 27, 136, 28.09, 45, 11, 0.43, {'ott_len': 3, 'ott_percent': 685, 'stop_loss': 338, 'risk_reward': 37, 'chop_rsi_len': 9, 'chop_bandwidth': 190}], ['1EkquE', 33, 156, 45.58, 27, 18, -1.61, {'ott_len': 7, 'ott_percent': 357, 'stop_loss': 347, 'risk_reward': 75, 'chop_rsi_len': 49, 'chop_bandwidth': 116}], ['2c0HI_', 47, 92, 21.02, 50, 16, 5.48, {'ott_len': 7, 'ott_percent': 623, 'stop_loss': 85, 'risk_reward': 38, 'chop_rsi_len': 22, 'chop_bandwidth': 212}], ['+BFdrD', 26, 263, 26.97, 24, 29, -2.82, {'ott_len': 3, 'ott_percent': 330, 'stop_loss': 183, 'risk_reward': 63, 'chop_rsi_len': 47, 'chop_bandwidth': 113}], [',B`d6D', 30, 297, 39.81, 26, 30, 0.5, {'ott_len': 3, 'ott_percent': 330, 'stop_loss': 298, 'risk_reward': 63, 'chop_rsi_len': 11, 'chop_bandwidth': 113}], ['r6:IS^', 55, 67, 37.97, 53, 13, 4.91, {'ott_len': 47, 'ott_percent': 224, 'stop_loss': 130, 'risk_reward': 39, 'chop_rsi_len': 28, 'chop_bandwidth': 208}], ['5swn)a', 30, 86, 13.25, 8, 12, -6.03, {'ott_len': 9, 'ott_percent': 765, 'stop_loss': 400, 'risk_reward': 72, 'chop_rsi_len': 3, 'chop_bandwidth': 219}], ['5H3VCa', 37, 126, 32.34, 37, 16, 4.24, {'ott_len': 9, 'ott_percent': 384, 'stop_loss': 99, 'risk_reward': 51, 'chop_rsi_len': 18, 'chop_bandwidth': 219}], ['lR\\iHN', 38, 62, 35.84, 28, 7, -4.01, {'ott_len': 43, 'ott_percent': 472, 'stop_loss': 280, 'risk_reward': 68, 'chop_rsi_len': 21, 'chop_bandwidth': 149}]] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
static,
"""
class C:
@staticmethod
def f():
pass
C.f()
| """
static,
"""
class C:
@staticmethod
def f():
pass
C.f() |
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Rollup bundling
The versions of Rollup and terser are controlled by the Bazel toolchain.
You do not need to install them into your project.
"""
load("@build_bazel_rules_nodejs//internal/common:node_module_info.bzl", "NodeModuleSources", "collect_node_modules_aspect")
load("//internal/common:collect_es6_sources.bzl", _collect_es2015_sources = "collect_es6_sources")
load("//internal/common:expand_into_runfiles.bzl", "expand_path_into_runfiles")
load("//internal/common:module_mappings.bzl", "get_module_mappings")
_ROLLUP_MODULE_MAPPINGS_ATTR = "rollup_module_mappings"
def _rollup_module_mappings_aspect_impl(target, ctx):
mappings = get_module_mappings(target.label, ctx.rule.attr)
return struct(rollup_module_mappings = mappings)
rollup_module_mappings_aspect = aspect(
_rollup_module_mappings_aspect_impl,
attr_aspects = ["deps"],
)
def _trim_package_node_modules(package_name):
# trim a package name down to its path prior to a node_modules
# segment. 'foo/node_modules/bar' would become 'foo' and
# 'node_modules/bar' would become ''
segments = []
for n in package_name.split("/"):
if n == "node_modules":
break
segments += [n]
return "/".join(segments)
# This function is similar but slightly different than _compute_node_modules_root
# in /internal/node/node.bzl. TODO(gregmagolan): consolidate these functions
def _compute_node_modules_root(ctx):
"""Computes the node_modules root from the node_modules and deps attributes.
Args:
ctx: the skylark execution context
Returns:
The node_modules root as a string
"""
node_modules_root = None
if ctx.files.node_modules:
# ctx.files.node_modules is not an empty list
node_modules_root = "/".join([f for f in [
ctx.attr.node_modules.label.workspace_root,
_trim_package_node_modules(ctx.attr.node_modules.label.package),
"node_modules",
] if f])
for d in ctx.attr.deps:
if NodeModuleSources in d:
possible_root = "/".join(["external", d[NodeModuleSources].workspace, "node_modules"])
if not node_modules_root:
node_modules_root = possible_root
elif node_modules_root != possible_root:
fail("All npm dependencies need to come from a single workspace. Found '%s' and '%s'." % (node_modules_root, possible_root))
if not node_modules_root:
# there are no fine grained deps and the node_modules attribute is an empty filegroup
# but we still need a node_modules_root even if its empty
node_modules_root = "/".join([f for f in [
ctx.attr.node_modules.label.workspace_root,
ctx.attr.node_modules.label.package,
"node_modules",
] if f])
return node_modules_root
# Expand entry_point into runfiles and strip the file extension
def _entry_point_path(ctx):
return "/".join([
expand_path_into_runfiles(ctx, ctx.file.entry_point.dirname),
ctx.file.entry_point.basename,
])[:-(len(ctx.file.entry_point.extension) + 1)]
def write_rollup_config(ctx, plugins = [], root_dir = None, filename = "_%s.rollup.conf.js", output_format = "iife", additional_entry_points = []):
"""Generate a rollup config file.
This is also used by the ng_rollup_bundle and ng_package rules in @angular/bazel.
Args:
ctx: Bazel rule execution context
plugins: extra plugins (defaults to [])
See the ng_rollup_bundle in @angular/bazel for example of usage.
root_dir: root directory for module resolution (defaults to None)
filename: output filename pattern (defaults to `_%s.rollup.conf.js`)
output_format: passed to rollup output.format option, e.g. "umd"
additional_entry_points: additional entry points for code splitting
Returns:
The rollup config file. See https://rollupjs.org/guide/en#configuration-files
"""
config = ctx.actions.declare_file(filename % ctx.label.name)
# build_file_path includes the BUILD.bazel file, transform here to only include the dirname
build_file_dirname = "/".join(ctx.build_file_path.split("/")[:-1])
entry_points = [_entry_point_path(ctx)] + additional_entry_points
mappings = dict()
all_deps = ctx.attr.deps + ctx.attr.srcs
for dep in all_deps:
if hasattr(dep, _ROLLUP_MODULE_MAPPINGS_ATTR):
for k, v in getattr(dep, _ROLLUP_MODULE_MAPPINGS_ATTR).items():
if k in mappings and mappings[k] != v:
fail(("duplicate module mapping at %s: %s maps to both %s and %s" %
(dep.label, k, mappings[k], v)), "deps")
mappings[k] = v
if not root_dir:
# This must be .es6 to match collect_es6_sources.bzl
root_dir = "/".join([ctx.bin_dir.path, build_file_dirname, ctx.label.name + ".es6"])
node_modules_root = _compute_node_modules_root(ctx)
is_default_node_modules = False
if node_modules_root == "node_modules" and ctx.attr.node_modules.label.package == "" and ctx.attr.node_modules.label.name == "node_modules_none":
is_default_node_modules = True
ctx.actions.expand_template(
output = config,
template = ctx.file._rollup_config_tmpl,
substitutions = {
"TMPL_additional_plugins": ",\n".join(plugins),
"TMPL_banner_file": "\"%s\"" % ctx.file.license_banner.path if ctx.file.license_banner else "undefined",
"TMPL_global_name": ctx.attr.global_name if ctx.attr.global_name else ctx.label.name,
"TMPL_inputs": ",".join(["\"%s\"" % e for e in entry_points]),
"TMPL_is_default_node_modules": "true" if is_default_node_modules else "false",
"TMPL_module_mappings": str(mappings),
"TMPL_node_modules_root": node_modules_root,
"TMPL_output_format": output_format,
"TMPL_rootDir": root_dir,
"TMPL_stamp_data": "\"%s\"" % ctx.version_file.path if ctx.version_file else "undefined",
"TMPL_target": str(ctx.label),
"TMPL_workspace_name": ctx.workspace_name,
},
)
return config
def run_rollup(ctx, sources, config, output):
"""Creates an Action that can run rollup on set of sources.
This is also used by ng_package and ng_rollup_bundle rules in @angular/bazel.
Args:
ctx: Bazel rule execution context
sources: JS sources to rollup
config: rollup config file
output: output file
Returns:
the sourcemap output file
"""
map_output = ctx.actions.declare_file(output.basename + ".map", sibling = output)
_run_rollup(ctx, sources, config, output, map_output)
return map_output
def _filter_js_inputs(all_inputs):
# Note: make sure that "all_inputs" is not a depset.
# Iterating over a depset is deprecated!
return [
f
for f in all_inputs
# We also need to include ".map" files as these can be read by
# the "rollup-plugin-sourcemaps" plugin.
if f.path.endswith(".js") or f.path.endswith(".json") or f.path.endswith(".map")
]
def _run_rollup(ctx, sources, config, output, map_output = None):
args = ctx.actions.args()
args.add_all(["--config", config.path])
if map_output:
args.add_all(["--output.file", output.path])
args.add_all(["--output.sourcemap", "--output.sourcemapFile", map_output.path])
else:
args.add_all(["--output.dir", output.path])
args.add_all(["--output.sourcemap"])
# We will produce errors as needed. Anything else is spammy: a well-behaved
# bazel rule prints nothing on success.
args.add("--silent")
if ctx.attr.globals:
args.add("--external")
args.add_joined(ctx.attr.globals.keys(), join_with = ",")
args.add("--globals")
args.add_joined(["%s:%s" % g for g in ctx.attr.globals.items()], join_with = ",")
direct_inputs = [config]
direct_inputs += _filter_js_inputs(ctx.files.node_modules)
# Also include files from npm fine grained deps as inputs.
# These deps are identified by the NodeModuleSources provider.
for d in ctx.attr.deps:
if NodeModuleSources in d:
# Note: we can't avoid calling .to_list() on sources
direct_inputs += _filter_js_inputs(d[NodeModuleSources].sources.to_list())
if ctx.file.license_banner:
direct_inputs += [ctx.file.license_banner]
if ctx.version_file:
direct_inputs += [ctx.version_file]
outputs = [output]
if map_output:
outputs += [map_output]
ctx.actions.run(
progress_message = "Bundling JavaScript %s [rollup]" % output.short_path,
executable = ctx.executable._rollup,
inputs = depset(direct_inputs, transitive = [sources]),
outputs = outputs,
arguments = [args],
)
def _run_tsc(ctx, input, output):
args = ctx.actions.args()
# No types needed since we are just downleveling.
# `--types` proceeded by another config argument means an empty types array
# for the command line parser.
# See https://github.com/Microsoft/TypeScript/issues/18581#issuecomment-330700612
args.add("--types")
args.add("--skipLibCheck")
args.add_all(["--target", "es5"])
args.add_all(["--lib", "es2015,dom"])
args.add("--allowJS")
args.add(input.path)
args.add_all(["--outFile", output.path])
ctx.actions.run(
progress_message = "Downleveling JavaScript to ES5 %s [typescript]" % output.short_path,
executable = ctx.executable._tsc,
inputs = [input],
outputs = [output],
arguments = [args],
)
def _run_tsc_on_directory(ctx, input_dir, output_dir):
config = ctx.actions.declare_file("_%s.code-split.tsconfig.json" % ctx.label.name)
args = ctx.actions.args()
args.add_all(["--project", config.path])
args.add_all(["--input", input_dir.path])
args.add_all(["--output", output_dir.path])
ctx.actions.run(
progress_message = "Downleveling JavaScript to ES5 %s [typescript]" % output_dir.short_path,
executable = ctx.executable._tsc_directory,
inputs = [input_dir],
outputs = [output_dir, config],
arguments = [args],
)
def run_uglify(**kwargs):
print("WARNING: run_uglify has been renamed to run_terser. Please update callsites")
run_terser(**kwargs)
def run_terser(ctx, input, output, debug = False, comments = True, config_name = None, in_source_map = None):
"""Runs terser on an input file.
This is also used by https://github.com/angular/angular.
Args:
ctx: Bazel rule execution context
input: input file
output: output file
debug: if True then output is beautified (defaults to False)
comments: if True then copyright comments are preserved in output file (defaults to True)
config_name: allows callers to control the name of the generated terser configuration,
which will be `_[config_name].terser.json` in the package where the target is declared
in_source_map: sourcemap file for the input file, passed to the "--source-map content="
option of rollup.
Returns:
The sourcemap file
"""
map_output = ctx.actions.declare_file(output.basename + ".map", sibling = output)
_run_terser(ctx, input, output, map_output, debug, comments, config_name, in_source_map)
return map_output
def _run_terser(ctx, input, output, map_output, debug = False, comments = True, config_name = None, in_source_map = None):
inputs = [input]
outputs = [output]
args = ctx.actions.args()
if map_output:
# Running terser on an individual file
if not config_name:
config_name = ctx.label.name
if debug:
config_name += ".debug"
config = ctx.actions.declare_file("_%s.terser.json" % config_name)
args.add_all(["--config-file", config.path])
outputs += [map_output, config]
args.add(input.path)
args.add_all(["--output", output.path])
# Source mapping options are comma-packed into one argv
# see https://github.com/terser-js/terser#command-line-usage
source_map_opts = ["includeSources", "base=" + ctx.bin_dir.path]
if in_source_map:
source_map_opts.append("content=" + in_source_map.path)
inputs.append(in_source_map)
# This option doesn't work in the config file, only on the CLI
args.add_all(["--source-map", ",".join(source_map_opts)])
if comments:
args.add("--comments")
if debug:
args.add("--debug")
args.add("--beautify")
ctx.actions.run(
progress_message = "Optimizing JavaScript %s [terser]" % output.short_path,
executable = ctx.executable._terser_wrapped,
inputs = inputs,
outputs = outputs,
arguments = [args],
)
def run_sourcemapexplorer(ctx, js, map, output):
"""Runs source-map-explorer to produce an HTML visualization of the sourcemap.
Args:
ctx: bazel rule execution context
js: Javascript bundle
map: sourcemap from the bundle back to original sources
output: file where the HTML report is written
"""
# We must run in a shell in order to redirect stdout.
# TODO(alexeagle): file a feature request on ctx.actions.run so that stdout
# could be natively redirected to produce the output file
ctx.actions.run_shell(
inputs = [js, map],
tools = [ctx.executable._source_map_explorer],
outputs = [output],
command = "$1 --html $2 $3 > $4",
arguments = [
ctx.executable._source_map_explorer.path,
js.path,
map.path,
output.path,
],
)
def _generate_toplevel_entry(ctx, bundles_folder, output):
"""Generates a native ESmodule that imports the entry point
"""
main_entry_point_basename = _entry_point_path(ctx).split("/")[-1] + ".js"
ctx.actions.write(output, """import('./%s/%s');""" % (bundles_folder, main_entry_point_basename))
def _generate_code_split_entry(ctx, bundles_folder, output):
"""Generates a SystemJS boilerplate/entry point file.
See doc for additional_entry_points for more information
on purpose and usage of this generated file.
The SystemJS packages map outputted to the file is generated
from the entry_point and additional_entry_point attributes and
is targetted as a specific bundle variant specified by `folder`.
For example, a rollup_bundle in may be configured like so:
```
rollup_bundle(
name = "bundle",
additional_entry_points = [
"src/hello-world/hello-world.module.ngfactory",
"src/todos/todos.module.ngfactory",
],
entry_point = "src/main.prod",
deps = ["//src"],
)
```
In this case, the main_entry_point_dirname will evaluate to
`src/` and this will be stripped from the entry points for
the map. If folder is `bundle_chunks`, the generated SystemJS
boilerplate/entry point file will look like:
```
(function(global) {
System.config({
packages: {
'': {map: {
"./main.prod": "bundle_chunks/main.prod",
"./hello-world/hello-world.module.ngfactory": "bundle_chunks/hello-world.module.ngfactory",
"./todos/todos.module.ngfactory": "bundle_chunks/todos.module.ngfactory"},
defaultExtension: 'js'},
}
});
System.import('main.prod').catch(function(err) {
console.error(err);
});
})(this);
```
Args:
ctx: bazel rule execution context
bundles_folder: the folder name with the bundled chunks to map to
output: the file to generate
"""
entry_point_path = _entry_point_path(ctx)
main_entry_point_basename = entry_point_path.split("/")[-1] + ".js"
main_entry_point_dirname = "/".join(entry_point_path.split("/")[:-1]) + "/"
entry_points = {}
for e in [entry_point_path] + ctx.attr.additional_entry_points:
entry_point = e[len(main_entry_point_dirname):]
entry_points["./" + entry_point] = bundles_folder + "/" + entry_point.split("/")[-1]
ctx.actions.expand_template(
output = output,
template = ctx.file._system_config_tmpl,
substitutions = {
"TMPL_entry_points": str(entry_points),
"TMPL_main_entry_point": main_entry_point_basename,
},
)
def _rollup_bundle(ctx):
if len(ctx.attr.entry_point.files.to_list()) != 1:
fail("labels in entry_point must contain exactly one file")
if ctx.attr.additional_entry_points:
# Generate code split bundles if additional entry points have been specified.
# See doc for additional_entry_points for more information.
# Note: "_chunks" is needed on the output folders since ctx.label.name + ".es2015" is already
# a folder that contains the re-rooted es2015 sources
rollup_config = write_rollup_config(ctx, output_format = "es", additional_entry_points = ctx.attr.additional_entry_points)
code_split_es2015_output_dir = ctx.actions.declare_directory(ctx.label.name + "_chunks_es2015")
_run_rollup(ctx, _collect_es2015_sources(ctx), rollup_config, code_split_es2015_output_dir)
code_split_es2015_min_output_dir = ctx.actions.declare_directory(ctx.label.name + "_chunks_min_es2015")
_run_terser(ctx, code_split_es2015_output_dir, code_split_es2015_min_output_dir, None)
code_split_es2015_min_debug_output_dir = ctx.actions.declare_directory(ctx.label.name + "_chunks_min_debug_es2015")
_run_terser(ctx, code_split_es2015_output_dir, code_split_es2015_min_debug_output_dir, None, debug = True)
code_split_es5_output_dir = ctx.actions.declare_directory(ctx.label.name + "_chunks")
_run_tsc_on_directory(ctx, code_split_es2015_output_dir, code_split_es5_output_dir)
code_split_es5_min_output_dir = ctx.actions.declare_directory(ctx.label.name + "_chunks_min")
_run_terser(ctx, code_split_es5_output_dir, code_split_es5_min_output_dir, None)
code_split_es5_min_debug_output_dir = ctx.actions.declare_directory(ctx.label.name + "_chunks_min_debug")
_run_terser(ctx, code_split_es5_output_dir, code_split_es5_min_debug_output_dir, None, debug = True)
# Generate the SystemJS boilerplate/entry point files
_generate_toplevel_entry(ctx, ctx.label.name + "_chunks_es2015", ctx.outputs.build_es2015)
_generate_toplevel_entry(ctx, ctx.label.name + "_chunks_min_es2015", ctx.outputs.build_es2015_min)
_generate_toplevel_entry(ctx, ctx.label.name + "_chunks_min_debug_es2015", ctx.outputs.build_es2015_min_debug)
_generate_code_split_entry(ctx, ctx.label.name + "_chunks", ctx.outputs.build_es5)
_generate_code_split_entry(ctx, ctx.label.name + "_chunks_min", ctx.outputs.build_es5_min)
_generate_code_split_entry(ctx, ctx.label.name + "_chunks_min_debug", ctx.outputs.build_es5_min_debug)
# There is no UMD/CJS bundle when code-splitting but we still need to satisfy the output
_generate_code_split_entry(ctx, ctx.label.name + "_chunks", ctx.outputs.build_umd)
_generate_code_split_entry(ctx, ctx.label.name + "_chunks", ctx.outputs.build_umd_min)
_generate_code_split_entry(ctx, ctx.label.name + "_chunks", ctx.outputs.build_cjs)
_generate_code_split_entry(ctx, ctx.label.name + "_chunks", ctx.outputs.build_es5_umd)
_generate_code_split_entry(ctx, ctx.label.name + "_chunks", ctx.outputs.build_es5_umd_min)
# There is no source map explorer output when code-splitting but we still need to satisfy the output
ctx.actions.expand_template(
output = ctx.outputs.explore_html,
template = ctx.file._no_explore_html,
substitutions = {},
)
files = [
ctx.outputs.build_es2015,
ctx.outputs.build_es2015_min,
ctx.outputs.build_es2015_min_debug,
ctx.outputs.build_es5,
ctx.outputs.build_es5_min,
ctx.outputs.build_es5_min_debug,
code_split_es2015_output_dir,
code_split_es2015_min_output_dir,
code_split_es2015_min_debug_output_dir,
code_split_es5_output_dir,
code_split_es5_min_output_dir,
code_split_es5_min_debug_output_dir,
]
output_group = OutputGroupInfo(
es2015 = depset([ctx.outputs.build_es2015, code_split_es2015_output_dir]),
es2015_min = depset([ctx.outputs.build_es2015_min, code_split_es2015_min_output_dir]),
es2015_min_debug = depset([ctx.outputs.build_es2015_min_debug, code_split_es2015_min_debug_output_dir]),
es5 = depset([ctx.outputs.build_es5, code_split_es5_output_dir]),
es5_min = depset([ctx.outputs.build_es5_min, code_split_es5_min_output_dir]),
es5_min_debug = depset([ctx.outputs.build_es5_min_debug, code_split_es5_min_debug_output_dir]),
)
else:
# Generate the bundles
rollup_config = write_rollup_config(ctx)
es2015_map = run_rollup(ctx, _collect_es2015_sources(ctx), rollup_config, ctx.outputs.build_es2015)
es2015_min_map = run_terser(ctx, ctx.outputs.build_es2015, ctx.outputs.build_es2015_min, config_name = ctx.label.name + "es2015_min", in_source_map = es2015_map)
es2015_min_debug_map = run_terser(ctx, ctx.outputs.build_es2015, ctx.outputs.build_es2015_min_debug, debug = True, config_name = ctx.label.name + "es2015_min_debug", in_source_map = es2015_map)
_run_tsc(ctx, ctx.outputs.build_es2015, ctx.outputs.build_es5)
es5_min_map = run_terser(ctx, ctx.outputs.build_es5, ctx.outputs.build_es5_min)
es5_min_debug_map = run_terser(ctx, ctx.outputs.build_es5, ctx.outputs.build_es5_min_debug, debug = True)
cjs_rollup_config = write_rollup_config(ctx, filename = "_%s_cjs.rollup.conf.js", output_format = "cjs")
cjs_map = run_rollup(ctx, _collect_es2015_sources(ctx), cjs_rollup_config, ctx.outputs.build_cjs)
umd_rollup_config = write_rollup_config(ctx, filename = "_%s_umd.rollup.conf.js", output_format = "umd")
umd_map = run_rollup(ctx, _collect_es2015_sources(ctx), umd_rollup_config, ctx.outputs.build_umd)
umd_min_map = run_terser(ctx, ctx.outputs.build_umd, ctx.outputs.build_umd_min, config_name = ctx.label.name + "umd_min", in_source_map = umd_map)
_run_tsc(ctx, ctx.outputs.build_umd, ctx.outputs.build_es5_umd)
es5_umd_min_map = run_terser(ctx, ctx.outputs.build_es5_umd, ctx.outputs.build_es5_umd_min, config_name = ctx.label.name + "es5umd_min")
run_sourcemapexplorer(ctx, ctx.outputs.build_es5_min, es5_min_map, ctx.outputs.explore_html)
files = [ctx.outputs.build_es5_min, es5_min_map]
output_group = OutputGroupInfo(
cjs = depset([ctx.outputs.build_cjs, cjs_map]),
es2015 = depset([ctx.outputs.build_es2015, es2015_map]),
es2015_min = depset([ctx.outputs.build_es2015_min, es2015_min_map]),
es2015_min_debug = depset([ctx.outputs.build_es2015_min_debug, es2015_min_debug_map]),
es5 = depset([ctx.outputs.build_es5]),
es5_min = depset([ctx.outputs.build_es5_min, es5_min_map]),
es5_min_debug = depset([ctx.outputs.build_es5_min_debug, es5_min_debug_map]),
es5_umd = depset([ctx.outputs.build_es5_umd]),
es5_umd_min = depset([ctx.outputs.build_es5_umd_min, es5_umd_min_map]),
umd = depset([ctx.outputs.build_umd, umd_map]),
umd_min = depset([ctx.outputs.build_umd_min, umd_min_map]),
)
return [
DefaultInfo(
files = depset(files),
# NB: we don't include any runfiles here since they would always be built
# regardless if they are requested or not
),
output_group,
]
# Expose our list of aspects so derivative rules can override the deps attribute and
# add their own additional aspects.
# If users are in a different repo and load the aspect themselves, they will create
# different Provider symbols (e.g. NodeModuleInfo) and we won't find them.
# So users must use these symbols that are load'ed in rules_nodejs.
ROLLUP_DEPS_ASPECTS = [rollup_module_mappings_aspect, collect_node_modules_aspect]
ROLLUP_ATTRS = {
"srcs": attr.label_list(
doc = """JavaScript source files from the workspace.
These can use ES2015 syntax and ES Modules (import/export)""",
allow_files = [".js"],
),
"additional_entry_points": attr.string_list(
doc = """Additional entry points of the application for code splitting, passed as the input to rollup.
These should be a path relative to the workspace root.
When additional_entry_points are specified, rollup_bundle
will split the bundle in multiple entry points and chunks.
There will be a main entry point chunk as well as entry point
chunks for each additional_entry_point. The file names
of these entry points will correspond to the file names
specified in entry_point and additional_entry_points.
There will also be one or more common chunks that are shared
between entry points named chunk-<HASH>.js. The number
of common chunks is variable depending on the code being
bundled.
Entry points and chunks will be outputted to folders:
- <label-name>_chunks_es2015 // es2015
- <label-name>_chunks // es5
- <label-name>_chunks_min // es5 minified
- <label-name>_chunks_min_debug // es5 minified debug
The following files will be outputted that contain the
SystemJS boilerplate to map the entry points to their file
names and load the main entry point:
flavors:
- <label-name>.es2015.js // es2015 with EcmaScript modules
- <label-name>.js // es5 syntax with CJS modules
- <label-name>.min.js // es5 minified
- <label-name>.min_debug.js // es5 minified debug
NOTE: additional_entry_points MUST be in the same folder or deeper than
the main entry_point for the SystemJS boilerplate/entry point to
be valid. For example, if the main entry_point is
`src/main` then all additional_entry_points must be under
`src/**` such as `src/bar` or `src/foo/bar`. Alternate
additional_entry_points configurations are valid but the
SystemJS boilerplate/entry point files will not be usable and
it is up to the user in these cases to handle the SystemJS
boilerplate manually.
It is sufficient to load one of these SystemJS boilerplate/entry point
files as a script in your HTML to load your application""",
),
"entry_point": attr.label(
doc = """The starting point of the application, passed as the `--input` flag to rollup.
If the entry JavaScript file belongs to the same package (as the BUILD file),
you can simply reference it by its relative name to the package directory:
```
rollup_bundle(
name = "bundle",
entry_point = ":main.js",
)
```
You can specify the entry point as a typescript file so long as you also include
the ts_library target in deps:
```
ts_library(
name = "main",
srcs = ["main.ts"],
)
rollup_bundle(
name = "bundle",
deps = [":main"]
entry_point = ":main.ts",
)
```
The rule will use the corresponding `.js` output of the ts_library rule as the entry point.
If the entry point target is a rule, it should produce a single JavaScript entry file that will be passed to the nodejs_binary rule.
For example:
```
filegroup(
name = "entry_file",
srcs = ["main.js"],
)
rollup_bundle(
name = "bundle",
entry_point = ":entry_file",
)
```
""",
mandatory = True,
allow_single_file = True,
),
"global_name": attr.string(
doc = """A name given to this package when referenced as a global variable.
This name appears in the bundle module incantation at the beginning of the file,
and governs the global symbol added to the global context (e.g. `window`) as a side-
effect of loading the UMD/IIFE JS bundle.
Rollup doc: "The variable name, representing your iife/umd bundle, by which other scripts on the same page can access it."
This is passed to the `output.name` setting in Rollup.""",
),
"globals": attr.string_dict(
doc = """A dict of symbols that reference external scripts.
The keys are variable names that appear in the program,
and the values are the symbol to reference at runtime in a global context (UMD bundles).
For example, a program referencing @angular/core should use ng.core
as the global reference, so Angular users should include the mapping
`"@angular/core":"ng.core"` in the globals.""",
default = {},
),
"license_banner": attr.label(
doc = """A .txt file passed to the `banner` config option of rollup.
The contents of the file will be copied to the top of the resulting bundles.
Note that you can replace a version placeholder in the license file, by using
the special version `0.0.0-PLACEHOLDER`. See the section on stamping in the README.""",
allow_single_file = [".txt"],
),
"node_modules": attr.label(
doc = """Dependencies from npm that provide some modules that must be
resolved by rollup.
This attribute is DEPRECATED. As of version 0.13.0 the recommended approach
to npm dependencies is to use fine grained npm dependencies which are setup
with the `yarn_install` or `npm_install` rules. For example, in a rollup_bundle
target that used the `node_modules` attribute,
```
rollup_bundle(
name = "bundle",
...
node_modules = "//:node_modules",
)
```
which specifies all files within the `//:node_modules` filegroup
to be inputs to the `bundle`. Using fine grained npm dependencies,
`bundle` is defined with only the npm dependencies that are
needed:
```
rollup_bundle(
name = "bundle",
...
deps = [
"@npm//foo",
"@npm//bar",
...
],
)
```
In this case, only the `foo` and `bar` npm packages and their
transitive deps are includes as inputs to the `bundle` target
which reduces the time required to setup the runfiles for this
target (see https://github.com/bazelbuild/bazel/issues/5153).
The @npm external repository and the fine grained npm package
targets are setup using the `yarn_install` or `npm_install` rule
in your WORKSPACE file:
yarn_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
""",
default = Label("//:node_modules_none"),
),
"deps": attr.label_list(
doc = """Other rules that produce JavaScript outputs, such as `ts_library`.""",
aspects = ROLLUP_DEPS_ASPECTS,
),
"_no_explore_html": attr.label(
default = Label("@build_bazel_rules_nodejs//internal/rollup:no_explore.html"),
allow_single_file = True,
),
"_rollup": attr.label(
executable = True,
cfg = "host",
default = Label("@build_bazel_rules_nodejs//internal/rollup:rollup"),
),
"_rollup_config_tmpl": attr.label(
default = Label("@build_bazel_rules_nodejs//internal/rollup:rollup.config.js"),
allow_single_file = True,
),
"_source_map_explorer": attr.label(
executable = True,
cfg = "host",
default = Label("@build_bazel_rules_nodejs//internal/rollup:source-map-explorer"),
),
"_system_config_tmpl": attr.label(
default = Label("@build_bazel_rules_nodejs//internal/rollup:system.config.js"),
allow_single_file = True,
),
"_terser_wrapped": attr.label(
executable = True,
cfg = "host",
default = Label("@build_bazel_rules_nodejs//internal/rollup:terser-wrapped"),
),
"_tsc": attr.label(
executable = True,
cfg = "host",
default = Label("@build_bazel_rules_nodejs//internal/rollup:tsc"),
),
"_tsc_directory": attr.label(
executable = True,
cfg = "host",
default = Label("@build_bazel_rules_nodejs//internal/rollup:tsc-directory"),
),
}
ROLLUP_OUTPUTS = {
"build_cjs": "%{name}.cjs.js",
"build_es2015": "%{name}.es2015.js",
"build_es2015_min": "%{name}.min.es2015.js",
"build_es2015_min_debug": "%{name}.min_debug.es2015.js",
"build_es5": "%{name}.js",
"build_es5_min": "%{name}.min.js",
"build_es5_min_debug": "%{name}.min_debug.js",
"build_es5_umd": "%{name}.es5umd.js",
"build_es5_umd_min": "%{name}.min.es5umd.js",
"build_umd": "%{name}.umd.js",
"build_umd_min": "%{name}.min.umd.js",
"explore_html": "%{name}.explore.html",
}
rollup_bundle = rule(
implementation = _rollup_bundle,
attrs = ROLLUP_ATTRS,
outputs = ROLLUP_OUTPUTS,
)
"""Produces several bundled JavaScript files using Rollup and terser.
Load it with
`load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle")`
It performs this work in several separate processes:
1. Call rollup on the original sources
2. Downlevel the resulting code to es5 syntax for older browsers
3. Minify the bundle with terser, possibly with pretty output for human debugging.
The default output of a `rollup_bundle` rule is the non-debug-minified es5 bundle.
However you can request one of the other outputs with a dot-suffix on the target's name.
For example, if your `rollup_bundle` is named `my_rollup_bundle`, you can use one of these labels:
To request the ES2015 syntax (e.g. `class` keyword) without downleveling or minification, use the `:my_rollup_bundle.es2015.js` label.
To request the ES5 downleveled bundle without minification, use the `:my_rollup_bundle.js` label
To request the debug-minified es5 bundle, use the `:my_rollup_bundle.min_debug.js` label.
To request a UMD-bundle, use the `:my_rollup_bundle.umd.js` label.
To request a CommonJS bundle, use the `:my_rollup_bundle.cjs.js` label.
You can also request an analysis from source-map-explorer by buildng the `:my_rollup_bundle.explore.html` label.
However this is currently broken for `rollup_bundle` ES5 mode because we use tsc for downleveling and
it doesn't compose the resulting sourcemaps with an input sourcemap.
See https://github.com/bazelbuild/rules_nodejs/issues/175
For debugging, note that the `rollup.config.js` and `terser.config.json` files can be found in the bazel-bin folder next to the resulting bundle.
An example usage can be found in https://github.com/bazelbuild/rules_nodejs/tree/master/internal/e2e/rollup
"""
# Adding the above docstring as `doc` attribute
# causes a build error but ONLY on Ubuntu 14.04 on BazelCI.
# ```
# File "internal/npm_package/npm_package.bzl", line 221, in <module>
# outputs = NPM_PACKAGE_OUTPUTS,
# TypeError: rule() got an unexpected keyword argument 'doc'
# ```
# This error does not occur on any other platform on BazelCI including Ubuntu 16.04.
# TOOD(gregmagolan): Figure out why and/or file a bug to Bazel
# See https://github.com/bazelbuild/buildtools/issues/471#issuecomment-485283200
| """Rollup bundling
The versions of Rollup and terser are controlled by the Bazel toolchain.
You do not need to install them into your project.
"""
load('@build_bazel_rules_nodejs//internal/common:node_module_info.bzl', 'NodeModuleSources', 'collect_node_modules_aspect')
load('//internal/common:collect_es6_sources.bzl', _collect_es2015_sources='collect_es6_sources')
load('//internal/common:expand_into_runfiles.bzl', 'expand_path_into_runfiles')
load('//internal/common:module_mappings.bzl', 'get_module_mappings')
_rollup_module_mappings_attr = 'rollup_module_mappings'
def _rollup_module_mappings_aspect_impl(target, ctx):
mappings = get_module_mappings(target.label, ctx.rule.attr)
return struct(rollup_module_mappings=mappings)
rollup_module_mappings_aspect = aspect(_rollup_module_mappings_aspect_impl, attr_aspects=['deps'])
def _trim_package_node_modules(package_name):
segments = []
for n in package_name.split('/'):
if n == 'node_modules':
break
segments += [n]
return '/'.join(segments)
def _compute_node_modules_root(ctx):
"""Computes the node_modules root from the node_modules and deps attributes.
Args:
ctx: the skylark execution context
Returns:
The node_modules root as a string
"""
node_modules_root = None
if ctx.files.node_modules:
node_modules_root = '/'.join([f for f in [ctx.attr.node_modules.label.workspace_root, _trim_package_node_modules(ctx.attr.node_modules.label.package), 'node_modules'] if f])
for d in ctx.attr.deps:
if NodeModuleSources in d:
possible_root = '/'.join(['external', d[NodeModuleSources].workspace, 'node_modules'])
if not node_modules_root:
node_modules_root = possible_root
elif node_modules_root != possible_root:
fail("All npm dependencies need to come from a single workspace. Found '%s' and '%s'." % (node_modules_root, possible_root))
if not node_modules_root:
node_modules_root = '/'.join([f for f in [ctx.attr.node_modules.label.workspace_root, ctx.attr.node_modules.label.package, 'node_modules'] if f])
return node_modules_root
def _entry_point_path(ctx):
return '/'.join([expand_path_into_runfiles(ctx, ctx.file.entry_point.dirname), ctx.file.entry_point.basename])[:-(len(ctx.file.entry_point.extension) + 1)]
def write_rollup_config(ctx, plugins=[], root_dir=None, filename='_%s.rollup.conf.js', output_format='iife', additional_entry_points=[]):
"""Generate a rollup config file.
This is also used by the ng_rollup_bundle and ng_package rules in @angular/bazel.
Args:
ctx: Bazel rule execution context
plugins: extra plugins (defaults to [])
See the ng_rollup_bundle in @angular/bazel for example of usage.
root_dir: root directory for module resolution (defaults to None)
filename: output filename pattern (defaults to `_%s.rollup.conf.js`)
output_format: passed to rollup output.format option, e.g. "umd"
additional_entry_points: additional entry points for code splitting
Returns:
The rollup config file. See https://rollupjs.org/guide/en#configuration-files
"""
config = ctx.actions.declare_file(filename % ctx.label.name)
build_file_dirname = '/'.join(ctx.build_file_path.split('/')[:-1])
entry_points = [_entry_point_path(ctx)] + additional_entry_points
mappings = dict()
all_deps = ctx.attr.deps + ctx.attr.srcs
for dep in all_deps:
if hasattr(dep, _ROLLUP_MODULE_MAPPINGS_ATTR):
for (k, v) in getattr(dep, _ROLLUP_MODULE_MAPPINGS_ATTR).items():
if k in mappings and mappings[k] != v:
fail('duplicate module mapping at %s: %s maps to both %s and %s' % (dep.label, k, mappings[k], v), 'deps')
mappings[k] = v
if not root_dir:
root_dir = '/'.join([ctx.bin_dir.path, build_file_dirname, ctx.label.name + '.es6'])
node_modules_root = _compute_node_modules_root(ctx)
is_default_node_modules = False
if node_modules_root == 'node_modules' and ctx.attr.node_modules.label.package == '' and (ctx.attr.node_modules.label.name == 'node_modules_none'):
is_default_node_modules = True
ctx.actions.expand_template(output=config, template=ctx.file._rollup_config_tmpl, substitutions={'TMPL_additional_plugins': ',\n'.join(plugins), 'TMPL_banner_file': '"%s"' % ctx.file.license_banner.path if ctx.file.license_banner else 'undefined', 'TMPL_global_name': ctx.attr.global_name if ctx.attr.global_name else ctx.label.name, 'TMPL_inputs': ','.join(['"%s"' % e for e in entry_points]), 'TMPL_is_default_node_modules': 'true' if is_default_node_modules else 'false', 'TMPL_module_mappings': str(mappings), 'TMPL_node_modules_root': node_modules_root, 'TMPL_output_format': output_format, 'TMPL_rootDir': root_dir, 'TMPL_stamp_data': '"%s"' % ctx.version_file.path if ctx.version_file else 'undefined', 'TMPL_target': str(ctx.label), 'TMPL_workspace_name': ctx.workspace_name})
return config
def run_rollup(ctx, sources, config, output):
"""Creates an Action that can run rollup on set of sources.
This is also used by ng_package and ng_rollup_bundle rules in @angular/bazel.
Args:
ctx: Bazel rule execution context
sources: JS sources to rollup
config: rollup config file
output: output file
Returns:
the sourcemap output file
"""
map_output = ctx.actions.declare_file(output.basename + '.map', sibling=output)
_run_rollup(ctx, sources, config, output, map_output)
return map_output
def _filter_js_inputs(all_inputs):
return [f for f in all_inputs if f.path.endswith('.js') or f.path.endswith('.json') or f.path.endswith('.map')]
def _run_rollup(ctx, sources, config, output, map_output=None):
args = ctx.actions.args()
args.add_all(['--config', config.path])
if map_output:
args.add_all(['--output.file', output.path])
args.add_all(['--output.sourcemap', '--output.sourcemapFile', map_output.path])
else:
args.add_all(['--output.dir', output.path])
args.add_all(['--output.sourcemap'])
args.add('--silent')
if ctx.attr.globals:
args.add('--external')
args.add_joined(ctx.attr.globals.keys(), join_with=',')
args.add('--globals')
args.add_joined(['%s:%s' % g for g in ctx.attr.globals.items()], join_with=',')
direct_inputs = [config]
direct_inputs += _filter_js_inputs(ctx.files.node_modules)
for d in ctx.attr.deps:
if NodeModuleSources in d:
direct_inputs += _filter_js_inputs(d[NodeModuleSources].sources.to_list())
if ctx.file.license_banner:
direct_inputs += [ctx.file.license_banner]
if ctx.version_file:
direct_inputs += [ctx.version_file]
outputs = [output]
if map_output:
outputs += [map_output]
ctx.actions.run(progress_message='Bundling JavaScript %s [rollup]' % output.short_path, executable=ctx.executable._rollup, inputs=depset(direct_inputs, transitive=[sources]), outputs=outputs, arguments=[args])
def _run_tsc(ctx, input, output):
args = ctx.actions.args()
args.add('--types')
args.add('--skipLibCheck')
args.add_all(['--target', 'es5'])
args.add_all(['--lib', 'es2015,dom'])
args.add('--allowJS')
args.add(input.path)
args.add_all(['--outFile', output.path])
ctx.actions.run(progress_message='Downleveling JavaScript to ES5 %s [typescript]' % output.short_path, executable=ctx.executable._tsc, inputs=[input], outputs=[output], arguments=[args])
def _run_tsc_on_directory(ctx, input_dir, output_dir):
config = ctx.actions.declare_file('_%s.code-split.tsconfig.json' % ctx.label.name)
args = ctx.actions.args()
args.add_all(['--project', config.path])
args.add_all(['--input', input_dir.path])
args.add_all(['--output', output_dir.path])
ctx.actions.run(progress_message='Downleveling JavaScript to ES5 %s [typescript]' % output_dir.short_path, executable=ctx.executable._tsc_directory, inputs=[input_dir], outputs=[output_dir, config], arguments=[args])
def run_uglify(**kwargs):
print('WARNING: run_uglify has been renamed to run_terser. Please update callsites')
run_terser(**kwargs)
def run_terser(ctx, input, output, debug=False, comments=True, config_name=None, in_source_map=None):
"""Runs terser on an input file.
This is also used by https://github.com/angular/angular.
Args:
ctx: Bazel rule execution context
input: input file
output: output file
debug: if True then output is beautified (defaults to False)
comments: if True then copyright comments are preserved in output file (defaults to True)
config_name: allows callers to control the name of the generated terser configuration,
which will be `_[config_name].terser.json` in the package where the target is declared
in_source_map: sourcemap file for the input file, passed to the "--source-map content="
option of rollup.
Returns:
The sourcemap file
"""
map_output = ctx.actions.declare_file(output.basename + '.map', sibling=output)
_run_terser(ctx, input, output, map_output, debug, comments, config_name, in_source_map)
return map_output
def _run_terser(ctx, input, output, map_output, debug=False, comments=True, config_name=None, in_source_map=None):
inputs = [input]
outputs = [output]
args = ctx.actions.args()
if map_output:
if not config_name:
config_name = ctx.label.name
if debug:
config_name += '.debug'
config = ctx.actions.declare_file('_%s.terser.json' % config_name)
args.add_all(['--config-file', config.path])
outputs += [map_output, config]
args.add(input.path)
args.add_all(['--output', output.path])
source_map_opts = ['includeSources', 'base=' + ctx.bin_dir.path]
if in_source_map:
source_map_opts.append('content=' + in_source_map.path)
inputs.append(in_source_map)
args.add_all(['--source-map', ','.join(source_map_opts)])
if comments:
args.add('--comments')
if debug:
args.add('--debug')
args.add('--beautify')
ctx.actions.run(progress_message='Optimizing JavaScript %s [terser]' % output.short_path, executable=ctx.executable._terser_wrapped, inputs=inputs, outputs=outputs, arguments=[args])
def run_sourcemapexplorer(ctx, js, map, output):
"""Runs source-map-explorer to produce an HTML visualization of the sourcemap.
Args:
ctx: bazel rule execution context
js: Javascript bundle
map: sourcemap from the bundle back to original sources
output: file where the HTML report is written
"""
ctx.actions.run_shell(inputs=[js, map], tools=[ctx.executable._source_map_explorer], outputs=[output], command='$1 --html $2 $3 > $4', arguments=[ctx.executable._source_map_explorer.path, js.path, map.path, output.path])
def _generate_toplevel_entry(ctx, bundles_folder, output):
"""Generates a native ESmodule that imports the entry point
"""
main_entry_point_basename = _entry_point_path(ctx).split('/')[-1] + '.js'
ctx.actions.write(output, "import('./%s/%s');" % (bundles_folder, main_entry_point_basename))
def _generate_code_split_entry(ctx, bundles_folder, output):
"""Generates a SystemJS boilerplate/entry point file.
See doc for additional_entry_points for more information
on purpose and usage of this generated file.
The SystemJS packages map outputted to the file is generated
from the entry_point and additional_entry_point attributes and
is targetted as a specific bundle variant specified by `folder`.
For example, a rollup_bundle in may be configured like so:
```
rollup_bundle(
name = "bundle",
additional_entry_points = [
"src/hello-world/hello-world.module.ngfactory",
"src/todos/todos.module.ngfactory",
],
entry_point = "src/main.prod",
deps = ["//src"],
)
```
In this case, the main_entry_point_dirname will evaluate to
`src/` and this will be stripped from the entry points for
the map. If folder is `bundle_chunks`, the generated SystemJS
boilerplate/entry point file will look like:
```
(function(global) {
System.config({
packages: {
'': {map: {
"./main.prod": "bundle_chunks/main.prod",
"./hello-world/hello-world.module.ngfactory": "bundle_chunks/hello-world.module.ngfactory",
"./todos/todos.module.ngfactory": "bundle_chunks/todos.module.ngfactory"},
defaultExtension: 'js'},
}
});
System.import('main.prod').catch(function(err) {
console.error(err);
});
})(this);
```
Args:
ctx: bazel rule execution context
bundles_folder: the folder name with the bundled chunks to map to
output: the file to generate
"""
entry_point_path = _entry_point_path(ctx)
main_entry_point_basename = entry_point_path.split('/')[-1] + '.js'
main_entry_point_dirname = '/'.join(entry_point_path.split('/')[:-1]) + '/'
entry_points = {}
for e in [entry_point_path] + ctx.attr.additional_entry_points:
entry_point = e[len(main_entry_point_dirname):]
entry_points['./' + entry_point] = bundles_folder + '/' + entry_point.split('/')[-1]
ctx.actions.expand_template(output=output, template=ctx.file._system_config_tmpl, substitutions={'TMPL_entry_points': str(entry_points), 'TMPL_main_entry_point': main_entry_point_basename})
def _rollup_bundle(ctx):
if len(ctx.attr.entry_point.files.to_list()) != 1:
fail('labels in entry_point must contain exactly one file')
if ctx.attr.additional_entry_points:
rollup_config = write_rollup_config(ctx, output_format='es', additional_entry_points=ctx.attr.additional_entry_points)
code_split_es2015_output_dir = ctx.actions.declare_directory(ctx.label.name + '_chunks_es2015')
_run_rollup(ctx, _collect_es2015_sources(ctx), rollup_config, code_split_es2015_output_dir)
code_split_es2015_min_output_dir = ctx.actions.declare_directory(ctx.label.name + '_chunks_min_es2015')
_run_terser(ctx, code_split_es2015_output_dir, code_split_es2015_min_output_dir, None)
code_split_es2015_min_debug_output_dir = ctx.actions.declare_directory(ctx.label.name + '_chunks_min_debug_es2015')
_run_terser(ctx, code_split_es2015_output_dir, code_split_es2015_min_debug_output_dir, None, debug=True)
code_split_es5_output_dir = ctx.actions.declare_directory(ctx.label.name + '_chunks')
_run_tsc_on_directory(ctx, code_split_es2015_output_dir, code_split_es5_output_dir)
code_split_es5_min_output_dir = ctx.actions.declare_directory(ctx.label.name + '_chunks_min')
_run_terser(ctx, code_split_es5_output_dir, code_split_es5_min_output_dir, None)
code_split_es5_min_debug_output_dir = ctx.actions.declare_directory(ctx.label.name + '_chunks_min_debug')
_run_terser(ctx, code_split_es5_output_dir, code_split_es5_min_debug_output_dir, None, debug=True)
_generate_toplevel_entry(ctx, ctx.label.name + '_chunks_es2015', ctx.outputs.build_es2015)
_generate_toplevel_entry(ctx, ctx.label.name + '_chunks_min_es2015', ctx.outputs.build_es2015_min)
_generate_toplevel_entry(ctx, ctx.label.name + '_chunks_min_debug_es2015', ctx.outputs.build_es2015_min_debug)
_generate_code_split_entry(ctx, ctx.label.name + '_chunks', ctx.outputs.build_es5)
_generate_code_split_entry(ctx, ctx.label.name + '_chunks_min', ctx.outputs.build_es5_min)
_generate_code_split_entry(ctx, ctx.label.name + '_chunks_min_debug', ctx.outputs.build_es5_min_debug)
_generate_code_split_entry(ctx, ctx.label.name + '_chunks', ctx.outputs.build_umd)
_generate_code_split_entry(ctx, ctx.label.name + '_chunks', ctx.outputs.build_umd_min)
_generate_code_split_entry(ctx, ctx.label.name + '_chunks', ctx.outputs.build_cjs)
_generate_code_split_entry(ctx, ctx.label.name + '_chunks', ctx.outputs.build_es5_umd)
_generate_code_split_entry(ctx, ctx.label.name + '_chunks', ctx.outputs.build_es5_umd_min)
ctx.actions.expand_template(output=ctx.outputs.explore_html, template=ctx.file._no_explore_html, substitutions={})
files = [ctx.outputs.build_es2015, ctx.outputs.build_es2015_min, ctx.outputs.build_es2015_min_debug, ctx.outputs.build_es5, ctx.outputs.build_es5_min, ctx.outputs.build_es5_min_debug, code_split_es2015_output_dir, code_split_es2015_min_output_dir, code_split_es2015_min_debug_output_dir, code_split_es5_output_dir, code_split_es5_min_output_dir, code_split_es5_min_debug_output_dir]
output_group = output_group_info(es2015=depset([ctx.outputs.build_es2015, code_split_es2015_output_dir]), es2015_min=depset([ctx.outputs.build_es2015_min, code_split_es2015_min_output_dir]), es2015_min_debug=depset([ctx.outputs.build_es2015_min_debug, code_split_es2015_min_debug_output_dir]), es5=depset([ctx.outputs.build_es5, code_split_es5_output_dir]), es5_min=depset([ctx.outputs.build_es5_min, code_split_es5_min_output_dir]), es5_min_debug=depset([ctx.outputs.build_es5_min_debug, code_split_es5_min_debug_output_dir]))
else:
rollup_config = write_rollup_config(ctx)
es2015_map = run_rollup(ctx, _collect_es2015_sources(ctx), rollup_config, ctx.outputs.build_es2015)
es2015_min_map = run_terser(ctx, ctx.outputs.build_es2015, ctx.outputs.build_es2015_min, config_name=ctx.label.name + 'es2015_min', in_source_map=es2015_map)
es2015_min_debug_map = run_terser(ctx, ctx.outputs.build_es2015, ctx.outputs.build_es2015_min_debug, debug=True, config_name=ctx.label.name + 'es2015_min_debug', in_source_map=es2015_map)
_run_tsc(ctx, ctx.outputs.build_es2015, ctx.outputs.build_es5)
es5_min_map = run_terser(ctx, ctx.outputs.build_es5, ctx.outputs.build_es5_min)
es5_min_debug_map = run_terser(ctx, ctx.outputs.build_es5, ctx.outputs.build_es5_min_debug, debug=True)
cjs_rollup_config = write_rollup_config(ctx, filename='_%s_cjs.rollup.conf.js', output_format='cjs')
cjs_map = run_rollup(ctx, _collect_es2015_sources(ctx), cjs_rollup_config, ctx.outputs.build_cjs)
umd_rollup_config = write_rollup_config(ctx, filename='_%s_umd.rollup.conf.js', output_format='umd')
umd_map = run_rollup(ctx, _collect_es2015_sources(ctx), umd_rollup_config, ctx.outputs.build_umd)
umd_min_map = run_terser(ctx, ctx.outputs.build_umd, ctx.outputs.build_umd_min, config_name=ctx.label.name + 'umd_min', in_source_map=umd_map)
_run_tsc(ctx, ctx.outputs.build_umd, ctx.outputs.build_es5_umd)
es5_umd_min_map = run_terser(ctx, ctx.outputs.build_es5_umd, ctx.outputs.build_es5_umd_min, config_name=ctx.label.name + 'es5umd_min')
run_sourcemapexplorer(ctx, ctx.outputs.build_es5_min, es5_min_map, ctx.outputs.explore_html)
files = [ctx.outputs.build_es5_min, es5_min_map]
output_group = output_group_info(cjs=depset([ctx.outputs.build_cjs, cjs_map]), es2015=depset([ctx.outputs.build_es2015, es2015_map]), es2015_min=depset([ctx.outputs.build_es2015_min, es2015_min_map]), es2015_min_debug=depset([ctx.outputs.build_es2015_min_debug, es2015_min_debug_map]), es5=depset([ctx.outputs.build_es5]), es5_min=depset([ctx.outputs.build_es5_min, es5_min_map]), es5_min_debug=depset([ctx.outputs.build_es5_min_debug, es5_min_debug_map]), es5_umd=depset([ctx.outputs.build_es5_umd]), es5_umd_min=depset([ctx.outputs.build_es5_umd_min, es5_umd_min_map]), umd=depset([ctx.outputs.build_umd, umd_map]), umd_min=depset([ctx.outputs.build_umd_min, umd_min_map]))
return [default_info(files=depset(files)), output_group]
rollup_deps_aspects = [rollup_module_mappings_aspect, collect_node_modules_aspect]
rollup_attrs = {'srcs': attr.label_list(doc='JavaScript source files from the workspace.\n These can use ES2015 syntax and ES Modules (import/export)', allow_files=['.js']), 'additional_entry_points': attr.string_list(doc='Additional entry points of the application for code splitting, passed as the input to rollup.\n These should be a path relative to the workspace root.\n\n When additional_entry_points are specified, rollup_bundle\n will split the bundle in multiple entry points and chunks.\n There will be a main entry point chunk as well as entry point\n chunks for each additional_entry_point. The file names\n of these entry points will correspond to the file names\n specified in entry_point and additional_entry_points.\n There will also be one or more common chunks that are shared\n between entry points named chunk-<HASH>.js. The number\n of common chunks is variable depending on the code being\n bundled.\n\n Entry points and chunks will be outputted to folders:\n - <label-name>_chunks_es2015 // es2015\n - <label-name>_chunks // es5\n - <label-name>_chunks_min // es5 minified\n - <label-name>_chunks_min_debug // es5 minified debug\n\n The following files will be outputted that contain the\n SystemJS boilerplate to map the entry points to their file\n names and load the main entry point:\n flavors:\n - <label-name>.es2015.js // es2015 with EcmaScript modules\n - <label-name>.js // es5 syntax with CJS modules\n - <label-name>.min.js // es5 minified\n - <label-name>.min_debug.js // es5 minified debug\n\n NOTE: additional_entry_points MUST be in the same folder or deeper than\n the main entry_point for the SystemJS boilerplate/entry point to\n be valid. For example, if the main entry_point is\n `src/main` then all additional_entry_points must be under\n `src/**` such as `src/bar` or `src/foo/bar`. Alternate\n additional_entry_points configurations are valid but the\n SystemJS boilerplate/entry point files will not be usable and\n it is up to the user in these cases to handle the SystemJS\n boilerplate manually.\n\n It is sufficient to load one of these SystemJS boilerplate/entry point\n files as a script in your HTML to load your application'), 'entry_point': attr.label(doc='The starting point of the application, passed as the `--input` flag to rollup.\n\n If the entry JavaScript file belongs to the same package (as the BUILD file), \n you can simply reference it by its relative name to the package directory:\n\n ```\n rollup_bundle(\n name = "bundle",\n entry_point = ":main.js",\n )\n ```\n\n You can specify the entry point as a typescript file so long as you also include\n the ts_library target in deps:\n\n ```\n ts_library(\n name = "main",\n srcs = ["main.ts"],\n )\n\n rollup_bundle(\n name = "bundle",\n deps = [":main"]\n entry_point = ":main.ts",\n )\n ```\n\n The rule will use the corresponding `.js` output of the ts_library rule as the entry point.\n\n If the entry point target is a rule, it should produce a single JavaScript entry file that will be passed to the nodejs_binary rule. \n For example:\n\n ```\n filegroup(\n name = "entry_file",\n srcs = ["main.js"],\n )\n\n rollup_bundle(\n name = "bundle",\n entry_point = ":entry_file",\n )\n ```\n ', mandatory=True, allow_single_file=True), 'global_name': attr.string(doc='A name given to this package when referenced as a global variable.\n This name appears in the bundle module incantation at the beginning of the file,\n and governs the global symbol added to the global context (e.g. `window`) as a side-\n effect of loading the UMD/IIFE JS bundle.\n\n Rollup doc: "The variable name, representing your iife/umd bundle, by which other scripts on the same page can access it."\n\n This is passed to the `output.name` setting in Rollup.'), 'globals': attr.string_dict(doc='A dict of symbols that reference external scripts.\n The keys are variable names that appear in the program,\n and the values are the symbol to reference at runtime in a global context (UMD bundles).\n For example, a program referencing @angular/core should use ng.core\n as the global reference, so Angular users should include the mapping\n `"@angular/core":"ng.core"` in the globals.', default={}), 'license_banner': attr.label(doc='A .txt file passed to the `banner` config option of rollup.\n The contents of the file will be copied to the top of the resulting bundles.\n Note that you can replace a version placeholder in the license file, by using\n the special version `0.0.0-PLACEHOLDER`. See the section on stamping in the README.', allow_single_file=['.txt']), 'node_modules': attr.label(doc='Dependencies from npm that provide some modules that must be\n resolved by rollup.\n\n This attribute is DEPRECATED. As of version 0.13.0 the recommended approach\n to npm dependencies is to use fine grained npm dependencies which are setup\n with the `yarn_install` or `npm_install` rules. For example, in a rollup_bundle\n target that used the `node_modules` attribute,\n\n ```\n rollup_bundle(\n name = "bundle",\n ...\n node_modules = "//:node_modules",\n )\n ```\n\n which specifies all files within the `//:node_modules` filegroup\n to be inputs to the `bundle`. Using fine grained npm dependencies,\n `bundle` is defined with only the npm dependencies that are\n needed:\n\n ```\n rollup_bundle(\n name = "bundle",\n ...\n deps = [\n "@npm//foo",\n "@npm//bar",\n ...\n ],\n )\n ```\n\n In this case, only the `foo` and `bar` npm packages and their\n transitive deps are includes as inputs to the `bundle` target\n which reduces the time required to setup the runfiles for this\n target (see https://github.com/bazelbuild/bazel/issues/5153).\n\n The @npm external repository and the fine grained npm package\n targets are setup using the `yarn_install` or `npm_install` rule\n in your WORKSPACE file:\n\n yarn_install(\n name = "npm",\n package_json = "//:package.json",\n yarn_lock = "//:yarn.lock",\n )\n ', default=label('//:node_modules_none')), 'deps': attr.label_list(doc='Other rules that produce JavaScript outputs, such as `ts_library`.', aspects=ROLLUP_DEPS_ASPECTS), '_no_explore_html': attr.label(default=label('@build_bazel_rules_nodejs//internal/rollup:no_explore.html'), allow_single_file=True), '_rollup': attr.label(executable=True, cfg='host', default=label('@build_bazel_rules_nodejs//internal/rollup:rollup')), '_rollup_config_tmpl': attr.label(default=label('@build_bazel_rules_nodejs//internal/rollup:rollup.config.js'), allow_single_file=True), '_source_map_explorer': attr.label(executable=True, cfg='host', default=label('@build_bazel_rules_nodejs//internal/rollup:source-map-explorer')), '_system_config_tmpl': attr.label(default=label('@build_bazel_rules_nodejs//internal/rollup:system.config.js'), allow_single_file=True), '_terser_wrapped': attr.label(executable=True, cfg='host', default=label('@build_bazel_rules_nodejs//internal/rollup:terser-wrapped')), '_tsc': attr.label(executable=True, cfg='host', default=label('@build_bazel_rules_nodejs//internal/rollup:tsc')), '_tsc_directory': attr.label(executable=True, cfg='host', default=label('@build_bazel_rules_nodejs//internal/rollup:tsc-directory'))}
rollup_outputs = {'build_cjs': '%{name}.cjs.js', 'build_es2015': '%{name}.es2015.js', 'build_es2015_min': '%{name}.min.es2015.js', 'build_es2015_min_debug': '%{name}.min_debug.es2015.js', 'build_es5': '%{name}.js', 'build_es5_min': '%{name}.min.js', 'build_es5_min_debug': '%{name}.min_debug.js', 'build_es5_umd': '%{name}.es5umd.js', 'build_es5_umd_min': '%{name}.min.es5umd.js', 'build_umd': '%{name}.umd.js', 'build_umd_min': '%{name}.min.umd.js', 'explore_html': '%{name}.explore.html'}
rollup_bundle = rule(implementation=_rollup_bundle, attrs=ROLLUP_ATTRS, outputs=ROLLUP_OUTPUTS)
'Produces several bundled JavaScript files using Rollup and terser.\n\nLoad it with\n`load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle")`\n\nIt performs this work in several separate processes:\n1. Call rollup on the original sources\n2. Downlevel the resulting code to es5 syntax for older browsers\n3. Minify the bundle with terser, possibly with pretty output for human debugging.\n\nThe default output of a `rollup_bundle` rule is the non-debug-minified es5 bundle.\n\nHowever you can request one of the other outputs with a dot-suffix on the target\'s name.\nFor example, if your `rollup_bundle` is named `my_rollup_bundle`, you can use one of these labels:\n\nTo request the ES2015 syntax (e.g. `class` keyword) without downleveling or minification, use the `:my_rollup_bundle.es2015.js` label.\nTo request the ES5 downleveled bundle without minification, use the `:my_rollup_bundle.js` label\nTo request the debug-minified es5 bundle, use the `:my_rollup_bundle.min_debug.js` label.\nTo request a UMD-bundle, use the `:my_rollup_bundle.umd.js` label.\nTo request a CommonJS bundle, use the `:my_rollup_bundle.cjs.js` label.\n\nYou can also request an analysis from source-map-explorer by buildng the `:my_rollup_bundle.explore.html` label.\nHowever this is currently broken for `rollup_bundle` ES5 mode because we use tsc for downleveling and\nit doesn\'t compose the resulting sourcemaps with an input sourcemap.\nSee https://github.com/bazelbuild/rules_nodejs/issues/175\n\nFor debugging, note that the `rollup.config.js` and `terser.config.json` files can be found in the bazel-bin folder next to the resulting bundle.\n\nAn example usage can be found in https://github.com/bazelbuild/rules_nodejs/tree/master/internal/e2e/rollup\n' |
class Pager:
def __init__(self, page, listing, total_count):
self.page = page
self.listing = listing
self.per_page = 20 # TODO: make this a setting
self.total_count = total_count
@property
def pages(self):
return int(self.total_count / self.per_page) + (
self.total_count % self.per_page > 0
)
@property
def has_prev(self):
return self.page > 1
@property
def has_next(self):
return self.page < self.pages
def iter_pages(self, left_edge=2, left_current=2, right_current=5, right_edge=2):
last = 0
for num in range(1, self.pages + 1):
if (
num <= left_edge
or (
num > self.page - left_current - 1
and num < self.page + right_current
)
or num > self.pages - right_edge
):
if last + 1 != num:
yield None
yield num
last = num
def __iter__(self):
return iter(self.iter_pages())
def __repr__(self):
return "<Pager %s>" % self.page
| class Pager:
def __init__(self, page, listing, total_count):
self.page = page
self.listing = listing
self.per_page = 20
self.total_count = total_count
@property
def pages(self):
return int(self.total_count / self.per_page) + (self.total_count % self.per_page > 0)
@property
def has_prev(self):
return self.page > 1
@property
def has_next(self):
return self.page < self.pages
def iter_pages(self, left_edge=2, left_current=2, right_current=5, right_edge=2):
last = 0
for num in range(1, self.pages + 1):
if num <= left_edge or (num > self.page - left_current - 1 and num < self.page + right_current) or num > self.pages - right_edge:
if last + 1 != num:
yield None
yield num
last = num
def __iter__(self):
return iter(self.iter_pages())
def __repr__(self):
return '<Pager %s>' % self.page |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace:
class Array(object):
NONE = 0
ArrayUInt = 1
ArrayULong = 2
ArrayDouble = 3
ArrayFloat = 4
| class Array(object):
none = 0
array_u_int = 1
array_u_long = 2
array_double = 3
array_float = 4 |
n = int(input())
for i in range(n):
years = 0
p, r, f = map(int, input().split())
popl = p
while popl <= f:
popl *= r
years += 1
print(years) | n = int(input())
for i in range(n):
years = 0
(p, r, f) = map(int, input().split())
popl = p
while popl <= f:
popl *= r
years += 1
print(years) |
def lcs(list):
if len(list) == 0:
return 0
sums = [0]*(len(list))
for i in range(0, len(list)):
if i == 0:
sums[i] = list[i]
start_index = i
last_index = i
continue
new_sum = sums[i-1] + list[i]
if new_sum > list[i]:
sums[i] = new_sum
else:
sums[i] = list[i]
return max(sums)
print(lcs([-1, 5, -3, 4, 2, -4, 5]))
print(lcs([]))
print(lcs([-1, 5, -3, 1, 2, -4, -5]))
| def lcs(list):
if len(list) == 0:
return 0
sums = [0] * len(list)
for i in range(0, len(list)):
if i == 0:
sums[i] = list[i]
start_index = i
last_index = i
continue
new_sum = sums[i - 1] + list[i]
if new_sum > list[i]:
sums[i] = new_sum
else:
sums[i] = list[i]
return max(sums)
print(lcs([-1, 5, -3, 4, 2, -4, 5]))
print(lcs([]))
print(lcs([-1, 5, -3, 1, 2, -4, -5])) |
class Region(object):
def __init__(self, node):
# FIXME: are these new to 4.4??
# And what is 4.4 anyway, latest is 4.3.4!!
# - mangled_name, paradigm, role
self.name = node.find('name').text
self.idx = int(node.get('id'))
#self.mangled_name = node.find('mangled_name').text
self.description = node.find('descr').text
self.url = node.find('url').text
# Call tree node references
self.cnodes = []
# Classification
#self.paradigm = node.find('paradigm').text
#self.role = node.find('role').text
# No idea...
self.mod = node.get('mod') # What is this?
self.begin = node.get('begin')
self.end = node.get('end')
| class Region(object):
def __init__(self, node):
self.name = node.find('name').text
self.idx = int(node.get('id'))
self.description = node.find('descr').text
self.url = node.find('url').text
self.cnodes = []
self.mod = node.get('mod')
self.begin = node.get('begin')
self.end = node.get('end') |
class SuffStats(object):
def _suff_stats(self, X):
raise NotImplementedError
def add(self, X):
values = self._suff_stats(X)
for key, value in values.items():
self.__dict__[key] += value
def remove(self, X):
values = self._suff_stats(X)
for key, value in values.items():
self.__dict__[key] -= value
def __iadd__(self, X):
self.add(X)
return self
def __isub__(self, X):
self.remove(X)
return self
| class Suffstats(object):
def _suff_stats(self, X):
raise NotImplementedError
def add(self, X):
values = self._suff_stats(X)
for (key, value) in values.items():
self.__dict__[key] += value
def remove(self, X):
values = self._suff_stats(X)
for (key, value) in values.items():
self.__dict__[key] -= value
def __iadd__(self, X):
self.add(X)
return self
def __isub__(self, X):
self.remove(X)
return self |
# -*- coding: utf-8 -*-
"""
Serializer module with a slightly improved versions of the Turtle and Pretty XML serializers.
Both are, actually, almost verbatim copy of the RDFLib Turtle and pretty XML serializer module, respectively.
For more detailed on how serializers work and are registered by RDFLib, please refer to the RDFLib
descriptions and source code.
The differences, v.a.v. the original, for the Pretty XML serializer:
- there were bugs in the original in case an rdf:List was generated with Literal content
- added a pretty print branch for Seq/Alt/Bag
- removal of the CDATA sections when generating an XML Literal (it is a cautionary support in RDFLib but, because XML literals can be generated under very controlled circumstances only in the case of RDFa, it is unnecessary).
- use the character " instead of ' for namespace declarations (to make it uniform with the way attributes are handled
- increased the initial depth for nesting (to 8)
The differences, v.a.v. the original, for the Turtle serializer:
- there was a bug in the syntax of the @prefix setting
- the original Turtle serializer insisted on creating prefixes for all URI references, ending up with a large number of fairly unnecessary prefixes that made the output a bit unreadable. This has been changed so that only the 'registered' prefixes are used, ie, those that the original RDFa source contains
- the original Turtle had a bug and did not generate the shorhands for lists
- changed the indentation rules for anonymous ('squared') blank nodes
""" | """
Serializer module with a slightly improved versions of the Turtle and Pretty XML serializers.
Both are, actually, almost verbatim copy of the RDFLib Turtle and pretty XML serializer module, respectively.
For more detailed on how serializers work and are registered by RDFLib, please refer to the RDFLib
descriptions and source code.
The differences, v.a.v. the original, for the Pretty XML serializer:
- there were bugs in the original in case an rdf:List was generated with Literal content
- added a pretty print branch for Seq/Alt/Bag
- removal of the CDATA sections when generating an XML Literal (it is a cautionary support in RDFLib but, because XML literals can be generated under very controlled circumstances only in the case of RDFa, it is unnecessary).
- use the character " instead of ' for namespace declarations (to make it uniform with the way attributes are handled
- increased the initial depth for nesting (to 8)
The differences, v.a.v. the original, for the Turtle serializer:
- there was a bug in the syntax of the @prefix setting
- the original Turtle serializer insisted on creating prefixes for all URI references, ending up with a large number of fairly unnecessary prefixes that made the output a bit unreadable. This has been changed so that only the 'registered' prefixes are used, ie, those that the original RDFa source contains
- the original Turtle had a bug and did not generate the shorhands for lists
- changed the indentation rules for anonymous ('squared') blank nodes
""" |
N, M = map(int, input().split())
from1 = set()
toN = set()
for _ in range(M):
a, b = map(int, input().split())
if a == 1:
from1.add(b)
elif b == N:
toN.add(a)
if from1 & toN:
print('POSSIBLE')
else:
print('IMPOSSIBLE')
| (n, m) = map(int, input().split())
from1 = set()
to_n = set()
for _ in range(M):
(a, b) = map(int, input().split())
if a == 1:
from1.add(b)
elif b == N:
toN.add(a)
if from1 & toN:
print('POSSIBLE')
else:
print('IMPOSSIBLE') |
# Program to find the product of a,b,c which are Pythagorean Triplet that satisfice the following:
# 1. a < b < c
# 2. a**2 + b**2 = c**2
# 3. a + b + c = 1000
print("Please Wait...")
for a in range(300):
for b in range(400):
for c in range(500):
if(a < b < c):
if((a**2) + (b**2) == (c**2)):
if((a+b+c) == 1000):
print("Product of",a,"*",b,"*",c,"=",(a*b*c))
break
| print('Please Wait...')
for a in range(300):
for b in range(400):
for c in range(500):
if a < b < c:
if a ** 2 + b ** 2 == c ** 2:
if a + b + c == 1000:
print('Product of', a, '*', b, '*', c, '=', a * b * c)
break |
class SouthboundMessage:
__endpoint__ = None
__http_method__ = None
def serialize(self):
raise NotImplementedError
| class Southboundmessage:
__endpoint__ = None
__http_method__ = None
def serialize(self):
raise NotImplementedError |
print(G.has_node('lea'))
# a more general method:
print('lea' in G.nodes()) | print(G.has_node('lea'))
print('lea' in G.nodes()) |
#!/usr/bin/env python
def core_analysis_output():
"""
Construct list for core genome analysis output
"""
core_out = []
core_out.extend(expand("analysis/colour_node/{asb}_nodecol.tsv", asb=graphcon))
core_out.extend(expand("analysis/colour_node/{asb}_nodemat.tsv", asb=graphcon))
core_out.extend(expand("analysis/core_nonref/{asb}_core_analysis.tsv", asb=graphcon))
# phylogenetic tree across assemblies
core_out.extend(["tree/assembly_phylo_tree.pdf"])
return core_out
def sv_analysis_output():
"""
Construct list for structural variations output
"""
sv_out = []
sv_out.extend(expand("analysis/bubble/{asb}_nonrefsv.fa", asb=graphcon))
sv_out.extend(expand("analysis/bubble/{asb}_nonrefsv_woflank.fa", asb=graphcon))
sv_out.extend(expand("analysis/bubble/{asb}_breakpoint_annot.tsv", asb=graphcon))
sv_out.extend(expand("analysis/bubble/{asb}_{svtype}_sv_viz.pdf", asb=graphcon, svtype=svlist))
sv_out.extend(expand("analysis/bubble/{asb}_exon_viz.pdf", asb=graphcon))
# trace paths in the bubbles
sv_out.extend(expand("analysis/bubble/{asb}_path_trace.tsv", asb=graphcon))
# full extended reference
sv_out.extend(expand(f"extended_ref/{config['reference']}+{{asb}}.fa", asb=graphcon))
return sv_out
def rna_analysis_output(include_rna_pipeline=True):
"""
Construct output for the rna_analysis pipeline
Input: config["rna_seq"] if True will include all rna analysis output (default)
Output: None if rna_seq not included otherwise all rna_seq analysis file output
"""
rna_out = []
rna_anims = []
if include_rna_pipeline:
rna_out.extend(expand("analysis/bubble/{asb}_nonrefsv.fa.masked", asb=graphcon))
rna_out.extend(expand("rna_seq/reference/{ref}+{asb}.fa", zip, ref=reflist, asb=graphcon))
# add wildcards from animal in transcriptome
rna_anims, = glob_wildcards(f"{config['rna_basedir']}/{{rna_anims}}_qc_R1.fq.gz")
if not rna_anims:
sys.exit("No transcriptome data found. Possibly path is incorrect")
rna_out.extend(expand(
[f"rna_seq/transcript_assembly/{asb}/{{rna_anims}}/{ref}+{asb}_{{rna_anims}}_merged_transcript" for ref, asb in zip(reflist, graphcon)], rna_anims=rna_anims))
# add result for the gene_prediction
rna_out.extend(expand("rna_seq/gene_model/{asb}_predict_summary.tsv", asb=graphcon))
# add mapping to reference results
rna_out.extend(expand(
f"rna_seq/aligned/{config['reference']}/{{rna_anims}}_{config['reference']}.bam", rna_anims=rna_anims))
# add merge expression results
rna_out.extend([f"rna_seq/transcript_assembly/{asb}/{ref}+{asb}_expression.tsv"
for ref, asb in zip(reflist, graphcon)])
# add blast results
rna_out.extend(expand("analysis/bubble/{asb}_nonrefsv_blastx.tsv", asb=graphcon))
rna_out.extend(expand("rna_seq/gene_model/{asb}_nonref_agustus_blastp.tsv", asb=graphcon))
return rna_anims, rna_out
def wgs_analysis_output(include_dna=config["dna_seq"]):
dna_out = []
if include_dna:
dna_out.append("wgs/stat/wgs_mapping_stat.tsv")
return dna_out
| def core_analysis_output():
"""
Construct list for core genome analysis output
"""
core_out = []
core_out.extend(expand('analysis/colour_node/{asb}_nodecol.tsv', asb=graphcon))
core_out.extend(expand('analysis/colour_node/{asb}_nodemat.tsv', asb=graphcon))
core_out.extend(expand('analysis/core_nonref/{asb}_core_analysis.tsv', asb=graphcon))
core_out.extend(['tree/assembly_phylo_tree.pdf'])
return core_out
def sv_analysis_output():
"""
Construct list for structural variations output
"""
sv_out = []
sv_out.extend(expand('analysis/bubble/{asb}_nonrefsv.fa', asb=graphcon))
sv_out.extend(expand('analysis/bubble/{asb}_nonrefsv_woflank.fa', asb=graphcon))
sv_out.extend(expand('analysis/bubble/{asb}_breakpoint_annot.tsv', asb=graphcon))
sv_out.extend(expand('analysis/bubble/{asb}_{svtype}_sv_viz.pdf', asb=graphcon, svtype=svlist))
sv_out.extend(expand('analysis/bubble/{asb}_exon_viz.pdf', asb=graphcon))
sv_out.extend(expand('analysis/bubble/{asb}_path_trace.tsv', asb=graphcon))
sv_out.extend(expand(f"extended_ref/{config['reference']}+{{asb}}.fa", asb=graphcon))
return sv_out
def rna_analysis_output(include_rna_pipeline=True):
"""
Construct output for the rna_analysis pipeline
Input: config["rna_seq"] if True will include all rna analysis output (default)
Output: None if rna_seq not included otherwise all rna_seq analysis file output
"""
rna_out = []
rna_anims = []
if include_rna_pipeline:
rna_out.extend(expand('analysis/bubble/{asb}_nonrefsv.fa.masked', asb=graphcon))
rna_out.extend(expand('rna_seq/reference/{ref}+{asb}.fa', zip, ref=reflist, asb=graphcon))
(rna_anims,) = glob_wildcards(f"{config['rna_basedir']}/{{rna_anims}}_qc_R1.fq.gz")
if not rna_anims:
sys.exit('No transcriptome data found. Possibly path is incorrect')
rna_out.extend(expand([f'rna_seq/transcript_assembly/{asb}/{{rna_anims}}/{ref}+{asb}_{{rna_anims}}_merged_transcript' for (ref, asb) in zip(reflist, graphcon)], rna_anims=rna_anims))
rna_out.extend(expand('rna_seq/gene_model/{asb}_predict_summary.tsv', asb=graphcon))
rna_out.extend(expand(f"rna_seq/aligned/{config['reference']}/{{rna_anims}}_{config['reference']}.bam", rna_anims=rna_anims))
rna_out.extend([f'rna_seq/transcript_assembly/{asb}/{ref}+{asb}_expression.tsv' for (ref, asb) in zip(reflist, graphcon)])
rna_out.extend(expand('analysis/bubble/{asb}_nonrefsv_blastx.tsv', asb=graphcon))
rna_out.extend(expand('rna_seq/gene_model/{asb}_nonref_agustus_blastp.tsv', asb=graphcon))
return (rna_anims, rna_out)
def wgs_analysis_output(include_dna=config['dna_seq']):
dna_out = []
if include_dna:
dna_out.append('wgs/stat/wgs_mapping_stat.tsv')
return dna_out |
class Configuration:
__shared_state = {
'debug': True,
'router': None,
'templates_dir': None
}
def __new__(cls, *args, **kwargs):
obj = super(Configuration, cls).__new__(cls, *args, **kwargs)
obj.__dict__ = cls.__shared_state
return obj
| class Configuration:
__shared_state = {'debug': True, 'router': None, 'templates_dir': None}
def __new__(cls, *args, **kwargs):
obj = super(Configuration, cls).__new__(cls, *args, **kwargs)
obj.__dict__ = cls.__shared_state
return obj |
_PROJECT_TEMPLATE = """\
{}\
"""
_SETTINGS_TEMPLATE = """\
# Automatically created by: slyd
import os
SPIDER_MANAGER_CLASS = 'slybot.spidermanager.ZipfileSlybotSpiderManager'
EXTENSIONS = {'slybot.closespider.SlybotCloseSpider': 1}
ITEM_PIPELINES = ['slybot.dupefilter.DupeFilterPipeline']
SPIDER_MIDDLEWARES = {'slybot.spiderlets.SpiderletsMiddleware': 999} # as close as possible to spider output
DOWNLOADER_MIDDLEWARES = {
'slybot.pageactions.PageActionsMiddleware': 700,
'slybot.splash.SlybotJsMiddleware': 725
}
PLUGINS = [
'slybot.plugins.scrapely_annotations.Annotations',
'slybot.plugins.selectors.Selectors'
]
SLYDUPEFILTER_ENABLED = True
DUPEFILTER_CLASS = 'scrapyjs.SplashAwareDupeFilter'
PROJECT_ZIPFILE = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
try:
from local_slybot_settings import *
except ImportError:
pass
"""
_SETUP_PY_TEMPLATE = """\
# Automatically created by: slyd
from setuptools import setup, find_packages
setup(
name = '%s',
version = '1.0',
packages = find_packages(),
package_data = {
'spiders': ['*.json', '*/*.json']
},
data_files = [('', ['project.json', 'items.json', 'extractors.json'])],
entry_points = {'scrapy': ['settings = spiders.settings']},
zip_safe = True
)
"""
_SCRAPY_TEMPLATE = """\
# Automatically created by: slyd
[settings]
default = slybot.settings
"""
_ITEMS_TEMPLATE = """\
{
"default": {"fields": {}}
}
"""
templates = {
'PROJECT': _PROJECT_TEMPLATE,
'SETTINGS': _SETTINGS_TEMPLATE,
'SETUP': _SETUP_PY_TEMPLATE,
'SCRAPY': _SCRAPY_TEMPLATE,
'ITEMS': _ITEMS_TEMPLATE
}
| _project_template = '{}'
_settings_template = "# Automatically created by: slyd\nimport os\n\nSPIDER_MANAGER_CLASS = 'slybot.spidermanager.ZipfileSlybotSpiderManager'\nEXTENSIONS = {'slybot.closespider.SlybotCloseSpider': 1}\nITEM_PIPELINES = ['slybot.dupefilter.DupeFilterPipeline']\nSPIDER_MIDDLEWARES = {'slybot.spiderlets.SpiderletsMiddleware': 999} # as close as possible to spider output\nDOWNLOADER_MIDDLEWARES = {\n 'slybot.pageactions.PageActionsMiddleware': 700,\n 'slybot.splash.SlybotJsMiddleware': 725\n}\nPLUGINS = [\n 'slybot.plugins.scrapely_annotations.Annotations',\n 'slybot.plugins.selectors.Selectors'\n]\nSLYDUPEFILTER_ENABLED = True\nDUPEFILTER_CLASS = 'scrapyjs.SplashAwareDupeFilter'\n\nPROJECT_ZIPFILE = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))\n\ntry:\n from local_slybot_settings import *\nexcept ImportError:\n pass\n"
_setup_py_template = "# Automatically created by: slyd\n\nfrom setuptools import setup, find_packages\n\nsetup(\n name = '%s',\n version = '1.0',\n packages = find_packages(),\n package_data = {\n 'spiders': ['*.json', '*/*.json']\n },\n data_files = [('', ['project.json', 'items.json', 'extractors.json'])],\n entry_points = {'scrapy': ['settings = spiders.settings']},\n zip_safe = True\n)\n\n"
_scrapy_template = '# Automatically created by: slyd\n\n[settings]\ndefault = slybot.settings\n'
_items_template = '{\n "default": {"fields": {}}\n}\n'
templates = {'PROJECT': _PROJECT_TEMPLATE, 'SETTINGS': _SETTINGS_TEMPLATE, 'SETUP': _SETUP_PY_TEMPLATE, 'SCRAPY': _SCRAPY_TEMPLATE, 'ITEMS': _ITEMS_TEMPLATE} |
class Atom:
def __init__(self, x, y, z, xvel):
self.x = x
self.y = y
self.z = z
self.type = 1
self.vx = xvel
self.vy = 0.0
self.vz = 0.0
def add_ball(atoms, xpos, xvel):
r = 2
s = 1.55
h = 0.5 * s
for ix in range(-r, r+1):
for iy in range(-r, r+1):
for iz in range(-r, r+1):
x = ix * s
y = iy * s
z = iz * s
if (x**2 + y**2 + z**2 > r**2):
continue
x = x + xpos
atoms.append(Atom(x, y, z, xvel))
atoms.append(Atom(x, y+h, z+h, xvel))
atoms.append(Atom(x+h, y, z+h, xvel))
atoms.append(Atom(x+h, y+h, z, xvel))
def save_file(filename, atoms):
with open(filename, "w") as f:
f.write("Position Data\n\n")
f.write("{} atoms\n".format(len(atoms)))
f.write("1 atom types\n\n")
f.write("-40.00 40.00 xlo xhi\n")
f.write("-20.00 20.00 ylo yhi\n")
f.write("-20.00 20.00 zlo zhi\n")
f.write("\n")
f.write("Atoms\n\n")
for i, a in enumerate(atoms):
f.write("{} {} {} {} {}\n".format(i+1, a.type, a.x, a.y, a.z))
f.write("\n")
f.write("Velocities\n\n")
for i, a in enumerate(atoms):
f.write("{} {} {} {}\n".format(i+1, a.vx, a.vy, a.vz))
print("Generated {}".format(filename))
atoms = []
add_ball(atoms, -20, 2.0)
add_ball(atoms, 20, -2.0)
save_file("collision.atoms", atoms)
| class Atom:
def __init__(self, x, y, z, xvel):
self.x = x
self.y = y
self.z = z
self.type = 1
self.vx = xvel
self.vy = 0.0
self.vz = 0.0
def add_ball(atoms, xpos, xvel):
r = 2
s = 1.55
h = 0.5 * s
for ix in range(-r, r + 1):
for iy in range(-r, r + 1):
for iz in range(-r, r + 1):
x = ix * s
y = iy * s
z = iz * s
if x ** 2 + y ** 2 + z ** 2 > r ** 2:
continue
x = x + xpos
atoms.append(atom(x, y, z, xvel))
atoms.append(atom(x, y + h, z + h, xvel))
atoms.append(atom(x + h, y, z + h, xvel))
atoms.append(atom(x + h, y + h, z, xvel))
def save_file(filename, atoms):
with open(filename, 'w') as f:
f.write('Position Data\n\n')
f.write('{} atoms\n'.format(len(atoms)))
f.write('1 atom types\n\n')
f.write('-40.00 40.00 xlo xhi\n')
f.write('-20.00 20.00 ylo yhi\n')
f.write('-20.00 20.00 zlo zhi\n')
f.write('\n')
f.write('Atoms\n\n')
for (i, a) in enumerate(atoms):
f.write('{} {} {} {} {}\n'.format(i + 1, a.type, a.x, a.y, a.z))
f.write('\n')
f.write('Velocities\n\n')
for (i, a) in enumerate(atoms):
f.write('{} {} {} {}\n'.format(i + 1, a.vx, a.vy, a.vz))
print('Generated {}'.format(filename))
atoms = []
add_ball(atoms, -20, 2.0)
add_ball(atoms, 20, -2.0)
save_file('collision.atoms', atoms) |
lookup = {'A':'aaaaa', 'B':'aaaab', 'C':'aaaba', 'D':'aaabb', 'E':'aabaa',
'F':'aabab', 'G':'aabba', 'H':'aabbb', 'I':'abaaa', 'J':'abaaa',
'K':'abaab', 'L':'ababa', 'M':'ababb', 'N':'abbaa', 'O':'abbab',
'P':'abbba', 'Q':'abbbb', 'R':'baaaa', 'S':'baaab', 'T':'baaba',
'U':'baabb', 'V':'baabb', 'W':'babaa', 'X':'babab', 'Y':'babba', 'Z':'babbb'}
def decrypt(message):
decipher = ''
i = 0
while True :
if(i < len(message)-4):
substr = message[i:i + 5]
if(substr[0] != ' '):
decipher += list(lookup.keys())[list(lookup.values()).index(substr)]
i += 5
else:
decipher += ' '
i += 1
else:
break
return decipher
def main():
message = input("Enter Your Cipher Text: " )
result = decrypt(message.lower())
print (result)
if __name__ == '__main__':
main()
| lookup = {'A': 'aaaaa', 'B': 'aaaab', 'C': 'aaaba', 'D': 'aaabb', 'E': 'aabaa', 'F': 'aabab', 'G': 'aabba', 'H': 'aabbb', 'I': 'abaaa', 'J': 'abaaa', 'K': 'abaab', 'L': 'ababa', 'M': 'ababb', 'N': 'abbaa', 'O': 'abbab', 'P': 'abbba', 'Q': 'abbbb', 'R': 'baaaa', 'S': 'baaab', 'T': 'baaba', 'U': 'baabb', 'V': 'baabb', 'W': 'babaa', 'X': 'babab', 'Y': 'babba', 'Z': 'babbb'}
def decrypt(message):
decipher = ''
i = 0
while True:
if i < len(message) - 4:
substr = message[i:i + 5]
if substr[0] != ' ':
decipher += list(lookup.keys())[list(lookup.values()).index(substr)]
i += 5
else:
decipher += ' '
i += 1
else:
break
return decipher
def main():
message = input('Enter Your Cipher Text: ')
result = decrypt(message.lower())
print(result)
if __name__ == '__main__':
main() |
def extractTravistranslationsCom(item):
'''
Parser for 'travistranslations.com'
DISABLED
'''
return None | def extract_travistranslations_com(item):
"""
Parser for 'travistranslations.com'
DISABLED
"""
return None |
# -*- coding: utf-8 -*-
"""
test.t_scripts
~~~~~~~~~~~~~~
:copyright: Copyright 2013 by the ControlBeast team, see AUTHORS.
:license: ISC, see LICENSE for details.
""" | """
test.t_scripts
~~~~~~~~~~~~~~
:copyright: Copyright 2013 by the ControlBeast team, see AUTHORS.
:license: ISC, see LICENSE for details.
""" |
"""Top-level package for wangls."""
__author__ = """Ahmed Ali"""
__email__ = 'norbixin@live.com'
__version__ = '0.1.6'
| """Top-level package for wangls."""
__author__ = 'Ahmed Ali'
__email__ = 'norbixin@live.com'
__version__ = '0.1.6' |
class BufferFullException(Exception):
pass
class BufferEmptyException(Exception):
pass
class CircularBuffer:
def __init__(self, capacity):
self.buffer = [None] * capacity
self.read_index = 0
self.write_index = 0
def read(self):
data = self.buffer[self.read_index]
if not data:
raise BufferEmptyException(r".+")
self.buffer[self.read_index] = None
self.read_index = (self.read_index + 1) % len(self.buffer)
return data
def write(self, data):
if self.buffer[self.write_index]:
raise BufferFullException(r".+")
self.buffer[self.write_index] = data
self.write_index = (self.write_index + 1) % len(self.buffer)
def overwrite(self, data):
if self.buffer[self.write_index]:
self.buffer[self.read_index] = data
self.read_index = (self.read_index + 1) % len(self.buffer)
self.write_index = self.read_index
else:
self.write(data)
def clear(self):
self.buffer = [None] * len(self.buffer)
self.read_index = 0
self.write_index = 0
| class Bufferfullexception(Exception):
pass
class Bufferemptyexception(Exception):
pass
class Circularbuffer:
def __init__(self, capacity):
self.buffer = [None] * capacity
self.read_index = 0
self.write_index = 0
def read(self):
data = self.buffer[self.read_index]
if not data:
raise buffer_empty_exception('.+')
self.buffer[self.read_index] = None
self.read_index = (self.read_index + 1) % len(self.buffer)
return data
def write(self, data):
if self.buffer[self.write_index]:
raise buffer_full_exception('.+')
self.buffer[self.write_index] = data
self.write_index = (self.write_index + 1) % len(self.buffer)
def overwrite(self, data):
if self.buffer[self.write_index]:
self.buffer[self.read_index] = data
self.read_index = (self.read_index + 1) % len(self.buffer)
self.write_index = self.read_index
else:
self.write(data)
def clear(self):
self.buffer = [None] * len(self.buffer)
self.read_index = 0
self.write_index = 0 |
getObject = {
'accountId': 31111,
'balancedTerminationFlag': False,
'cooldown': 1800,
'createDate': '2018-04-30T15:07:40-04:00',
'desiredMemberCount': None,
'id': 12222222,
'lastActionDate': '2019-10-02T16:26:17-04:00',
'loadBalancers': [],
'maximumMemberCount': 6,
'minimumMemberCount': 2,
'modifyDate': '2019-10-03T17:16:47-04:00',
'name': 'tests',
'networkVlans': [
{
'networkVlan': {
'accountId': 31111,
'id': 2222222,
'modifyDate': '2019-07-16T13:09:47-04:00',
'networkSpace': 'PRIVATE',
'primaryRouter': {
'hostname': 'bcr01a.sao01'
},
'primarySubnetId': 1172222,
'vlanNumber': 1111
},
'networkVlanId': 2281111
}
],
'policies': [
{
'actions': [
{
'amount': 1,
'createDate': '2019-09-26T18:30:22-04:00',
'deleteFlag': None,
'id': 611111,
'modifyDate': None,
'scalePolicy': None,
'scalePolicyId': 681111,
'scaleType': 'RELATIVE',
'typeId': 1
}
],
'cooldown': None,
'createDate': '2019-09-26T18:30:14-04:00',
'id': 680000,
'name': 'prime-poly',
'scaleActions': [
{
'amount': 1,
'createDate': '2019-09-26T18:30:22-04:00',
'deleteFlag': None,
'id': 633333,
'modifyDate': None,
'scalePolicy': None,
'scalePolicyId': 680123,
'scaleType': 'RELATIVE',
'typeId': 1
}
],
'triggers': [
{
'createDate': '2019-09-26T18:30:14-04:00',
'deleteFlag': None,
'id': 557111,
'modifyDate': None,
'scalePolicy': None,
'scalePolicyId': 680000,
'typeId': 3
}
]
}
],
'regionalGroup': {
'description': 'sa-bra-south-1',
'id': 663,
'locationGroupTypeId': 42,
'locations': [
{
'id': 983497,
'longName': 'Sao Paulo 1',
'name': 'sao01',
'statusId': 2
}
],
'name': 'sa-bra-south-1',
'securityLevelId': None
},
'regionalGroupId': 663,
'status': {
'id': 1, 'keyName': 'ACTIVE', 'name': 'Active'
},
'suspendedFlag': False,
'terminationPolicy': {
'id': 2, 'keyName': 'NEWEST', 'name': 'Newest'
},
'terminationPolicyId': 2,
'virtualGuestAssets': [],
'virtualGuestMemberCount': 6,
'virtualGuestMemberTemplate': {
'accountId': 31111,
'blockDevices': [
{
'bootableFlag': None,
'createDate': None,
'device': '0',
'diskImage': {
'capacity': 25,
'createDate': None,
'id': None,
'modifyDate': None,
'parentId': None,
'storageRepositoryId': None,
'typeId': None},
'diskImageId': None,
'guestId': None,
'hotPlugFlag': None,
'id': None,
'modifyDate': None,
'statusId': None
},
{
'bootableFlag': None,
'createDate': None,
'device': '2',
'diskImage': {
'capacity': 10,
'createDate': None,
'id': None,
'modifyDate': None,
'parentId': None,
'storageRepositoryId': None,
'typeId': None},
'diskImageId': None,
'guestId': None,
'hotPlugFlag': None,
'id': None,
'modifyDate': None,
'statusId': None
}
],
'createDate': None,
'datacenter': {
'id': None,
'name': 'sao01',
'statusId': None
},
'dedicatedAccountHostOnlyFlag': None,
'domain': 'tech-support.com',
'hostname': 'testing',
'hourlyBillingFlag': True,
'id': None,
'lastPowerStateId': None,
'lastVerifiedDate': None,
'localDiskFlag': False,
'maxCpu': None,
'maxMemory': 1024,
'metricPollDate': None,
'modifyDate': None,
'networkComponents': [
{
'createDate': None,
'guestId': None,
'id': None,
'maxSpeed': 100,
'modifyDate': None,
'networkId': None,
'port': None,
'speed': None
}
],
'operatingSystemReferenceCode': 'CENTOS_LATEST',
'placementGroupId': None,
'postInstallScriptUri': 'https://test.com/',
'privateNetworkOnlyFlag': False,
'provisionDate': None,
'sshKeys': [
{
'createDate': None,
'id': 490279,
'modifyDate': None
}
],
'startCpus': 1,
'statusId': None,
'typeId': None},
'virtualGuestMembers': [
{
'id': 3111111,
'virtualGuest': {
'domain': 'tech-support.com',
'hostname': 'test',
'provisionDate': '2019-09-27T14:29:53-04:00'
}
}
]
}
getVirtualGuestMembers = getObject['virtualGuestMembers']
scale = [
{
"accountId": 31111,
"cooldown": 1800,
"createDate": "2016-10-25T01:48:34+08:00",
"id": 12222222,
"maximumMemberCount": 5,
"minimumMemberCount": 0,
"name": "tests",
"virtualGuest": {
"accountId": 31111,
"createDate": "2019-10-02T15:24:54-06:00",
"billingItem": {
"cancellationDate": "2019-10-02T08:34:21-06:00"}
},
"virtualGuestMemberTemplate": {
"accountId": 31111,
"domain": "sodg.com",
"hostname": "testing",
"maxMemory": 32768,
"startCpus": 32,
"blockDevices": [
{
"device": "0",
"diskImage": {
"capacity": 25,
}
}
],
"datacenter": {
"name": "sao01",
},
"hourlyBillingFlag": True,
"operatingSystemReferenceCode": "CENTOS_LATEST",
"privateNetworkOnlyFlag": True
},
"virtualGuestMemberCount": 0,
"status": {
"id": 1,
"keyName": "ACTIVE",
"name": "Active"
},
"virtualGuestAssets": [],
"virtualGuestMembers": []
},
{
"accountId": 31111,
"cooldown": 1800,
"createDate": "2018-04-24T04:22:00+08:00",
"id": 224533333,
"maximumMemberCount": 10,
"minimumMemberCount": 0,
"modifyDate": "2019-01-19T04:53:21+08:00",
"name": "test-ajcb",
"virtualGuest": {
"accountId": 31111,
"createDate": "2019-10-02T15:24:54-06:00",
"billingItem": {
"cancellationDate": "2019-10-02T08:34:21-06:00"}
},
"virtualGuestMemberTemplate": {
"accountId": 31111,
"domain": "test.local",
"hostname": "autoscale-ajcb01",
"id": None,
"maxCpu": None,
"maxMemory": 1024,
"postInstallScriptUri": "http://test.com",
"startCpus": 1,
"blockDevices": [
{
"device": "0",
"diskImage": {
"capacity": 25,
}
}
],
"datacenter": {
"name": "seo01",
},
"hourlyBillingFlag": True,
"operatingSystemReferenceCode": "CENTOS_7_64",
},
"virtualGuestMemberCount": 0,
"status": {
"id": 1,
"keyName": "ACTIVE",
"name": "Active"
},
"virtualGuestAssets": [],
"virtualGuestMembers": []
}
]
scaleTo = [
{
"accountId": 31111,
"cooldown": 1800,
"createDate": "2016-10-25T01:48:34+08:00",
"id": 12222222,
"lastActionDate": "2016-10-25T01:48:34+08:00",
"maximumMemberCount": 5,
"minimumMemberCount": 0,
"name": "tests",
"regionalGroupId": 663,
"virtualGuest": {
},
"virtualGuestMemberTemplate": {
"accountId": 31111,
"domain": "sodg.com",
"hostname": "testing",
"id": None,
"maxCpu": None,
"maxMemory": 32768,
"startCpus": 32,
"datacenter": {
"name": "sao01",
},
"hourlyBillingFlag": True,
"operatingSystemReferenceCode": "CENTOS_LATEST",
"privateNetworkOnlyFlag": True
},
"virtualGuestMemberCount": 0,
"status": {
"id": 1,
"keyName": "ACTIVE",
"name": "Active"
},
"virtualGuestAssets": [],
"virtualGuestMembers": []
},
{
"accountId": 31111,
"cooldown": 1800,
"createDate": "2018-04-24T04:22:00+08:00",
"id": 224533333,
"lastActionDate": "2019-01-19T04:53:18+08:00",
"maximumMemberCount": 10,
"minimumMemberCount": 0,
"modifyDate": "2019-01-19T04:53:21+08:00",
"name": "test-ajcb",
"regionalGroupId": 1025,
"virtualGuest": {
"accountId": 31111,
"createDate": "2019-10-02T15:24:54-06:00",
"billingItem": {
"cancellationDate": "2019-10-02T08:34:21-06:00"}
},
"virtualGuestMemberTemplate": {
"accountId": 31111,
"domain": "test.local",
"hostname": "autoscale-ajcb01",
"id": None,
"maxCpu": None,
"maxMemory": 1024,
"postInstallScriptUri": "http://test.com",
"startCpus": 1,
"blockDevices": [
{
"device": "0",
"diskImage": {
"capacity": 25,
}
}
],
"datacenter": {
"name": "seo01",
},
"hourlyBillingFlag": True,
"operatingSystemReferenceCode": "CENTOS_7_64",
},
"virtualGuestMemberCount": 0,
"status": {
"id": 1,
"keyName": "ACTIVE",
"name": "Active"
},
"virtualGuestAssets": [],
"virtualGuestMembers": []
},
]
getLogs = [
{
"createDate": "2019-10-03T04:26:11+08:00",
"description": "Scaling group to 6 member(s) by adding 3 member(s) as manually requested",
"id": 3821111,
"scaleGroupId": 2252222,
"scaleGroup": {
"accountId": 31111,
"cooldown": 1800,
"createDate": "2018-05-01T03:07:40+08:00",
"id": 2251111,
"lastActionDate": "2019-10-03T04:26:17+08:00",
"maximumMemberCount": 6,
"minimumMemberCount": 2,
"modifyDate": "2019-10-03T04:26:21+08:00",
"name": "ajcb-autoscale11",
"regionalGroupId": 663,
"terminationPolicyId": 2,
"virtualGuestMemberTemplate": {
"accountId": 31111,
"domain": "techsupport.com",
"hostname": "ajcb-autoscale22",
"maxMemory": 1024,
"postInstallScriptUri": "https://pastebin.com/raw/62wrEKuW",
"startCpus": 1,
"blockDevices": [
{
"device": "0",
"diskImage": {
"capacity": 25,
}
},
{
"device": "2",
"diskImage": {
"capacity": 10,
}
}
],
"datacenter": {
"name": "sao01",
},
"networkComponents": [
{
"maxSpeed": 100,
}
],
"operatingSystemReferenceCode": "CENTOS_LATEST",
"sshKeys": [
{
"id": 49111,
}
]
},
"logs": [
{
"createDate": "2019-09-28T02:31:35+08:00",
"description": "Scaling group to 3 member(s) by removing -1 member(s) as manually requested",
"id": 3821111,
"scaleGroupId": 2251111,
},
{
"createDate": "2019-09-28T02:26:11+08:00",
"description": "Scaling group to 4 member(s) by adding 2 member(s) as manually requested",
"id": 38211111,
"scaleGroupId": 2251111,
},
]
}
},
]
editObject = True
forceDeleteObject = True
createObject = {
"accountId": 307608,
"cooldown": 3600,
"createDate": "2022-04-22T13:45:24-06:00",
"id": 5446140,
"lastActionDate": "2022-04-22T13:45:29-06:00",
"maximumMemberCount": 5,
"minimumMemberCount": 1,
"name": "test22042022",
"regionalGroupId": 4568,
"suspendedFlag": False,
"terminationPolicyId": 2,
"virtualGuestMemberTemplate": {
"accountId": 307608,
"domain": "test.com",
"hostname": "testvs",
"maxMemory": 2048,
"startCpus": 2,
"blockDevices": [
{
"diskImage": {
"capacity": 100,
}
}
],
"hourlyBillingFlag": True,
"localDiskFlag": True,
"networkComponents": [
{
"maxSpeed": 100,
}
],
"operatingSystemReferenceCode": "CENTOS_7_64",
"userData": [
{
"value": "the userData"
}
]
},
"virtualGuestMemberCount": 0,
"networkVlans": [],
"policies": [],
"status": {
"id": 1,
"keyName": "ACTIVE",
"name": "Active"
},
"virtualGuestAssets": [],
"virtualGuestMembers": [
{
"createDate": "2022-04-22T13:45:29-06:00",
"id": 123456,
"scaleGroupId": 5446140,
"virtualGuest": {
"createDate": "2022-04-22T13:45:28-06:00",
"deviceStatusId": 3,
"domain": "test.com",
"fullyQualifiedDomainName": "testvs-97e7.test.com",
"hostname": "testvs-97e7",
"id": 129911702,
"maxCpu": 2,
"maxCpuUnits": "CORE",
"maxMemory": 2048,
"startCpus": 2,
"statusId": 1001,
"typeId": 1,
"uuid": "46e55f99-b412-4287-95b5-b8182b2fc924",
"status": {
"keyName": "ACTIVE",
"name": "Active"
}
}
}
]
}
| get_object = {'accountId': 31111, 'balancedTerminationFlag': False, 'cooldown': 1800, 'createDate': '2018-04-30T15:07:40-04:00', 'desiredMemberCount': None, 'id': 12222222, 'lastActionDate': '2019-10-02T16:26:17-04:00', 'loadBalancers': [], 'maximumMemberCount': 6, 'minimumMemberCount': 2, 'modifyDate': '2019-10-03T17:16:47-04:00', 'name': 'tests', 'networkVlans': [{'networkVlan': {'accountId': 31111, 'id': 2222222, 'modifyDate': '2019-07-16T13:09:47-04:00', 'networkSpace': 'PRIVATE', 'primaryRouter': {'hostname': 'bcr01a.sao01'}, 'primarySubnetId': 1172222, 'vlanNumber': 1111}, 'networkVlanId': 2281111}], 'policies': [{'actions': [{'amount': 1, 'createDate': '2019-09-26T18:30:22-04:00', 'deleteFlag': None, 'id': 611111, 'modifyDate': None, 'scalePolicy': None, 'scalePolicyId': 681111, 'scaleType': 'RELATIVE', 'typeId': 1}], 'cooldown': None, 'createDate': '2019-09-26T18:30:14-04:00', 'id': 680000, 'name': 'prime-poly', 'scaleActions': [{'amount': 1, 'createDate': '2019-09-26T18:30:22-04:00', 'deleteFlag': None, 'id': 633333, 'modifyDate': None, 'scalePolicy': None, 'scalePolicyId': 680123, 'scaleType': 'RELATIVE', 'typeId': 1}], 'triggers': [{'createDate': '2019-09-26T18:30:14-04:00', 'deleteFlag': None, 'id': 557111, 'modifyDate': None, 'scalePolicy': None, 'scalePolicyId': 680000, 'typeId': 3}]}], 'regionalGroup': {'description': 'sa-bra-south-1', 'id': 663, 'locationGroupTypeId': 42, 'locations': [{'id': 983497, 'longName': 'Sao Paulo 1', 'name': 'sao01', 'statusId': 2}], 'name': 'sa-bra-south-1', 'securityLevelId': None}, 'regionalGroupId': 663, 'status': {'id': 1, 'keyName': 'ACTIVE', 'name': 'Active'}, 'suspendedFlag': False, 'terminationPolicy': {'id': 2, 'keyName': 'NEWEST', 'name': 'Newest'}, 'terminationPolicyId': 2, 'virtualGuestAssets': [], 'virtualGuestMemberCount': 6, 'virtualGuestMemberTemplate': {'accountId': 31111, 'blockDevices': [{'bootableFlag': None, 'createDate': None, 'device': '0', 'diskImage': {'capacity': 25, 'createDate': None, 'id': None, 'modifyDate': None, 'parentId': None, 'storageRepositoryId': None, 'typeId': None}, 'diskImageId': None, 'guestId': None, 'hotPlugFlag': None, 'id': None, 'modifyDate': None, 'statusId': None}, {'bootableFlag': None, 'createDate': None, 'device': '2', 'diskImage': {'capacity': 10, 'createDate': None, 'id': None, 'modifyDate': None, 'parentId': None, 'storageRepositoryId': None, 'typeId': None}, 'diskImageId': None, 'guestId': None, 'hotPlugFlag': None, 'id': None, 'modifyDate': None, 'statusId': None}], 'createDate': None, 'datacenter': {'id': None, 'name': 'sao01', 'statusId': None}, 'dedicatedAccountHostOnlyFlag': None, 'domain': 'tech-support.com', 'hostname': 'testing', 'hourlyBillingFlag': True, 'id': None, 'lastPowerStateId': None, 'lastVerifiedDate': None, 'localDiskFlag': False, 'maxCpu': None, 'maxMemory': 1024, 'metricPollDate': None, 'modifyDate': None, 'networkComponents': [{'createDate': None, 'guestId': None, 'id': None, 'maxSpeed': 100, 'modifyDate': None, 'networkId': None, 'port': None, 'speed': None}], 'operatingSystemReferenceCode': 'CENTOS_LATEST', 'placementGroupId': None, 'postInstallScriptUri': 'https://test.com/', 'privateNetworkOnlyFlag': False, 'provisionDate': None, 'sshKeys': [{'createDate': None, 'id': 490279, 'modifyDate': None}], 'startCpus': 1, 'statusId': None, 'typeId': None}, 'virtualGuestMembers': [{'id': 3111111, 'virtualGuest': {'domain': 'tech-support.com', 'hostname': 'test', 'provisionDate': '2019-09-27T14:29:53-04:00'}}]}
get_virtual_guest_members = getObject['virtualGuestMembers']
scale = [{'accountId': 31111, 'cooldown': 1800, 'createDate': '2016-10-25T01:48:34+08:00', 'id': 12222222, 'maximumMemberCount': 5, 'minimumMemberCount': 0, 'name': 'tests', 'virtualGuest': {'accountId': 31111, 'createDate': '2019-10-02T15:24:54-06:00', 'billingItem': {'cancellationDate': '2019-10-02T08:34:21-06:00'}}, 'virtualGuestMemberTemplate': {'accountId': 31111, 'domain': 'sodg.com', 'hostname': 'testing', 'maxMemory': 32768, 'startCpus': 32, 'blockDevices': [{'device': '0', 'diskImage': {'capacity': 25}}], 'datacenter': {'name': 'sao01'}, 'hourlyBillingFlag': True, 'operatingSystemReferenceCode': 'CENTOS_LATEST', 'privateNetworkOnlyFlag': True}, 'virtualGuestMemberCount': 0, 'status': {'id': 1, 'keyName': 'ACTIVE', 'name': 'Active'}, 'virtualGuestAssets': [], 'virtualGuestMembers': []}, {'accountId': 31111, 'cooldown': 1800, 'createDate': '2018-04-24T04:22:00+08:00', 'id': 224533333, 'maximumMemberCount': 10, 'minimumMemberCount': 0, 'modifyDate': '2019-01-19T04:53:21+08:00', 'name': 'test-ajcb', 'virtualGuest': {'accountId': 31111, 'createDate': '2019-10-02T15:24:54-06:00', 'billingItem': {'cancellationDate': '2019-10-02T08:34:21-06:00'}}, 'virtualGuestMemberTemplate': {'accountId': 31111, 'domain': 'test.local', 'hostname': 'autoscale-ajcb01', 'id': None, 'maxCpu': None, 'maxMemory': 1024, 'postInstallScriptUri': 'http://test.com', 'startCpus': 1, 'blockDevices': [{'device': '0', 'diskImage': {'capacity': 25}}], 'datacenter': {'name': 'seo01'}, 'hourlyBillingFlag': True, 'operatingSystemReferenceCode': 'CENTOS_7_64'}, 'virtualGuestMemberCount': 0, 'status': {'id': 1, 'keyName': 'ACTIVE', 'name': 'Active'}, 'virtualGuestAssets': [], 'virtualGuestMembers': []}]
scale_to = [{'accountId': 31111, 'cooldown': 1800, 'createDate': '2016-10-25T01:48:34+08:00', 'id': 12222222, 'lastActionDate': '2016-10-25T01:48:34+08:00', 'maximumMemberCount': 5, 'minimumMemberCount': 0, 'name': 'tests', 'regionalGroupId': 663, 'virtualGuest': {}, 'virtualGuestMemberTemplate': {'accountId': 31111, 'domain': 'sodg.com', 'hostname': 'testing', 'id': None, 'maxCpu': None, 'maxMemory': 32768, 'startCpus': 32, 'datacenter': {'name': 'sao01'}, 'hourlyBillingFlag': True, 'operatingSystemReferenceCode': 'CENTOS_LATEST', 'privateNetworkOnlyFlag': True}, 'virtualGuestMemberCount': 0, 'status': {'id': 1, 'keyName': 'ACTIVE', 'name': 'Active'}, 'virtualGuestAssets': [], 'virtualGuestMembers': []}, {'accountId': 31111, 'cooldown': 1800, 'createDate': '2018-04-24T04:22:00+08:00', 'id': 224533333, 'lastActionDate': '2019-01-19T04:53:18+08:00', 'maximumMemberCount': 10, 'minimumMemberCount': 0, 'modifyDate': '2019-01-19T04:53:21+08:00', 'name': 'test-ajcb', 'regionalGroupId': 1025, 'virtualGuest': {'accountId': 31111, 'createDate': '2019-10-02T15:24:54-06:00', 'billingItem': {'cancellationDate': '2019-10-02T08:34:21-06:00'}}, 'virtualGuestMemberTemplate': {'accountId': 31111, 'domain': 'test.local', 'hostname': 'autoscale-ajcb01', 'id': None, 'maxCpu': None, 'maxMemory': 1024, 'postInstallScriptUri': 'http://test.com', 'startCpus': 1, 'blockDevices': [{'device': '0', 'diskImage': {'capacity': 25}}], 'datacenter': {'name': 'seo01'}, 'hourlyBillingFlag': True, 'operatingSystemReferenceCode': 'CENTOS_7_64'}, 'virtualGuestMemberCount': 0, 'status': {'id': 1, 'keyName': 'ACTIVE', 'name': 'Active'}, 'virtualGuestAssets': [], 'virtualGuestMembers': []}]
get_logs = [{'createDate': '2019-10-03T04:26:11+08:00', 'description': 'Scaling group to 6 member(s) by adding 3 member(s) as manually requested', 'id': 3821111, 'scaleGroupId': 2252222, 'scaleGroup': {'accountId': 31111, 'cooldown': 1800, 'createDate': '2018-05-01T03:07:40+08:00', 'id': 2251111, 'lastActionDate': '2019-10-03T04:26:17+08:00', 'maximumMemberCount': 6, 'minimumMemberCount': 2, 'modifyDate': '2019-10-03T04:26:21+08:00', 'name': 'ajcb-autoscale11', 'regionalGroupId': 663, 'terminationPolicyId': 2, 'virtualGuestMemberTemplate': {'accountId': 31111, 'domain': 'techsupport.com', 'hostname': 'ajcb-autoscale22', 'maxMemory': 1024, 'postInstallScriptUri': 'https://pastebin.com/raw/62wrEKuW', 'startCpus': 1, 'blockDevices': [{'device': '0', 'diskImage': {'capacity': 25}}, {'device': '2', 'diskImage': {'capacity': 10}}], 'datacenter': {'name': 'sao01'}, 'networkComponents': [{'maxSpeed': 100}], 'operatingSystemReferenceCode': 'CENTOS_LATEST', 'sshKeys': [{'id': 49111}]}, 'logs': [{'createDate': '2019-09-28T02:31:35+08:00', 'description': 'Scaling group to 3 member(s) by removing -1 member(s) as manually requested', 'id': 3821111, 'scaleGroupId': 2251111}, {'createDate': '2019-09-28T02:26:11+08:00', 'description': 'Scaling group to 4 member(s) by adding 2 member(s) as manually requested', 'id': 38211111, 'scaleGroupId': 2251111}]}}]
edit_object = True
force_delete_object = True
create_object = {'accountId': 307608, 'cooldown': 3600, 'createDate': '2022-04-22T13:45:24-06:00', 'id': 5446140, 'lastActionDate': '2022-04-22T13:45:29-06:00', 'maximumMemberCount': 5, 'minimumMemberCount': 1, 'name': 'test22042022', 'regionalGroupId': 4568, 'suspendedFlag': False, 'terminationPolicyId': 2, 'virtualGuestMemberTemplate': {'accountId': 307608, 'domain': 'test.com', 'hostname': 'testvs', 'maxMemory': 2048, 'startCpus': 2, 'blockDevices': [{'diskImage': {'capacity': 100}}], 'hourlyBillingFlag': True, 'localDiskFlag': True, 'networkComponents': [{'maxSpeed': 100}], 'operatingSystemReferenceCode': 'CENTOS_7_64', 'userData': [{'value': 'the userData'}]}, 'virtualGuestMemberCount': 0, 'networkVlans': [], 'policies': [], 'status': {'id': 1, 'keyName': 'ACTIVE', 'name': 'Active'}, 'virtualGuestAssets': [], 'virtualGuestMembers': [{'createDate': '2022-04-22T13:45:29-06:00', 'id': 123456, 'scaleGroupId': 5446140, 'virtualGuest': {'createDate': '2022-04-22T13:45:28-06:00', 'deviceStatusId': 3, 'domain': 'test.com', 'fullyQualifiedDomainName': 'testvs-97e7.test.com', 'hostname': 'testvs-97e7', 'id': 129911702, 'maxCpu': 2, 'maxCpuUnits': 'CORE', 'maxMemory': 2048, 'startCpus': 2, 'statusId': 1001, 'typeId': 1, 'uuid': '46e55f99-b412-4287-95b5-b8182b2fc924', 'status': {'keyName': 'ACTIVE', 'name': 'Active'}}}]} |
#
# PySNMP MIB module HPN-ICF-RMON-EXT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-RMON-EXT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:41:09 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")
ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion")
hpnicfrmonExtend, = mibBuilder.importSymbols("HPN-ICF-OID-MIB", "hpnicfrmonExtend")
OwnerString, = mibBuilder.importSymbols("IF-MIB", "OwnerString")
EntryStatus, = mibBuilder.importSymbols("RMON-MIB", "EntryStatus")
trapDestEntry, trapDestIndex = mibBuilder.importSymbols("RMON2-MIB", "trapDestEntry", "trapDestIndex")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ObjectIdentity, NotificationType, Unsigned32, IpAddress, Counter64, Integer32, iso, TimeTicks, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, Counter32, Bits, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "NotificationType", "Unsigned32", "IpAddress", "Counter64", "Integer32", "iso", "TimeTicks", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "Counter32", "Bits", "Gauge32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
hpnicfperformance = ModuleIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4))
hpnicfperformance.setRevisions(('2003-03-15 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: hpnicfperformance.setRevisionsDescriptions(('The initial revision of this MIB module.',))
if mibBuilder.loadTexts: hpnicfperformance.setLastUpdated('200303150000Z')
if mibBuilder.loadTexts: hpnicfperformance.setOrganization('')
if mibBuilder.loadTexts: hpnicfperformance.setContactInfo('')
if mibBuilder.loadTexts: hpnicfperformance.setDescription(' ')
hpnicfprialarmTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1), )
if mibBuilder.loadTexts: hpnicfprialarmTable.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmTable.setDescription('A list of alarm entries.')
hpnicfprialarmEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1), ).setIndexNames((0, "HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmIndex"))
if mibBuilder.loadTexts: hpnicfprialarmEntry.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmEntry.setDescription('A list of parameters that set up a periodic checking for alarm conditions. For example, an instance of the alarmValue object might be named alarmValue.8')
hpnicfprialarmIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfprialarmIndex.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmIndex.setDescription('An index that uniquely identifies an entry in the alarm table. Each such entry defines a diagnostic sample at a particular interval for an object on the device.')
hpnicfprialarmInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmInterval.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmInterval.setDescription('The interval in seconds over which the data is sampled and compared with the rising and falling thresholds. When setting this variable, care should be taken in the case of deltaValue sampling - the interval should be set short enough that the sampled variable is very unlikely to increase or decrease by more than 2^31 - 1 during a single sampling interval. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarmVariable = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmVariable.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmVariable.setDescription('The object identifier of the particular variable to be sampled. Only variables that resolve to an ASN.1 primitive type of INTEGER (INTEGER, Integer32, Counter32, Counter64, Gauge, or TimeTicks) may be sampled. Because SNMP access control is articulated entirely in terms of the contents of MIB views, no access control mechanism exists that can restrict the value of this object to identify only those objects that exist in a particular MIB view. Because there is thus no acceptable means of restricting the read access that could be obtained through the alarm mechanism, the probe must only grant write access to this object in those views that have read access to all objects on the probe. During a set operation, if the supplied variable name is not available in the selected MIB view, a badValue error must be returned. If at any time the variable name of an established alarmEntry is no longer available in the selected MIB view, the probe must change the status of this alarmEntry to invalid(4). This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarmSympol = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 4), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmSympol.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmSympol.setDescription('')
hpnicfprialarmSampleType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("absoluteValue", 1), ("deltaValue", 2), ("speedValue", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmSampleType.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmSampleType.setDescription('The method of sampling the selected variable and calculating the value to be compared against the thresholds. If the value of this object is absoluteValue(1), the value of the selected variable will be compared directly with the thresholds at the end of the sampling interval. If the value of this object is deltaValue(2), the value of the selected variable at the last sample will be subtracted from the current value, and the difference compared with the thresholds. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarmValue = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfprialarmValue.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmValue.setDescription('The value of the statistic during the last sampling period. For example, if the sample type is deltaValue, this value will be the difference between the samples at the beginning and end of the period. If the sample type is absoluteValue, this value will be the sampled value at the end of the period. This is the value that is compared with the rising and falling thresholds. The value during the current sampling period is not made available until the period is completed and will remain available until the next period completes.')
hpnicfprialarmStartupAlarm = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("risingAlarm", 1), ("fallingAlarm", 2), ("risingOrFallingAlarm", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmStartupAlarm.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmStartupAlarm.setDescription('The alarm that may be sent when this entry is first set to valid. If the first sample after this entry becomes valid is greater than or equal to the risingThreshold and alarmStartupAlarm is equal to risingAlarm(1) or risingOrFallingAlarm(3), then a single rising alarm will be generated. If the first sample after this entry becomes valid is less than or equal to the fallingThreshold and alarmStartupAlarm is equal to fallingAlarm(2) or risingOrFallingAlarm(3), then a single falling alarm will be generated. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarmRisingThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 8), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmRisingThreshold.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmRisingThreshold.setDescription('A threshold for the sampled statistic. When the current sampled value is greater than or equal to this threshold, and the value at the last sampling interval was less than this threshold, a single event will be generated. A single event will also be generated if the first sample after this entry becomes valid is greater than or equal to this threshold and the associated alarmStartupAlarm is equal to risingAlarm(1) or risingOrFallingAlarm(3). After a rising event is generated, another such event will not be generated until the sampled value falls below this threshold and reaches the alarmFallingThreshold. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarmFallingThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 9), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmFallingThreshold.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmFallingThreshold.setDescription('A threshold for the sampled statistic. When the current sampled value is less than or equal to this threshold, and the value at the last sampling interval was greater than this threshold, a single event will be generated. A single event will also be generated if the first sample after this entry becomes valid is less than or equal to this threshold and the associated alarmStartupAlarm is equal to fallingAlarm(2) or risingOrFallingAlarm(3). After a falling event is generated, another such event will not be generated until the sampled value rises above this threshold and reaches the alarmRisingThreshold. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarmRisingEventIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmRisingEventIndex.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmRisingEventIndex.setDescription('The index of the eventEntry that is used when a rising threshold is crossed. The eventEntry identified by a particular value of this index is the same as identified by the same value of the eventIndex object. If there is no corresponding entry in the eventTable, then no association exists. In particular, if this value is zero, no associated event will be generated, as zero is not a valid event index. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarmFallingEventIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmFallingEventIndex.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmFallingEventIndex.setDescription('The index of the eventEntry that is used when a falling threshold is crossed. The eventEntry identified by a particular value of this index is the same as identified by the same value of the eventIndex object. If there is no corresponding entry in the eventTable, then no association exists. In particular, if this value is zero, no associated event will be generated, as zero is not a valid event index. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarmStatCycle = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 12), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmStatCycle.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmStatCycle.setDescription('')
hpnicfprialarmStatType = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("forever", 1), ("during", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmStatType.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmStatType.setDescription('')
hpnicfprialarmOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 14), OwnerString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmOwner.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmOwner.setDescription('The entity that configured this entry and is therefore using the resources assigned to it.')
hpnicfprialarmStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 15), EntryStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfprialarmStatus.setStatus('current')
if mibBuilder.loadTexts: hpnicfprialarmStatus.setDescription('The status of this alarm entry.')
hpnicfrmonEnableTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 5), )
if mibBuilder.loadTexts: hpnicfrmonEnableTable.setStatus('current')
if mibBuilder.loadTexts: hpnicfrmonEnableTable.setDescription('A list of enable rmon entries.')
hpnicfrmonEnableEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 5, 1), ).setIndexNames((0, "HPN-ICF-RMON-EXT-MIB", "hpnicfrmonEnableIfIndex"))
if mibBuilder.loadTexts: hpnicfrmonEnableEntry.setStatus('current')
if mibBuilder.loadTexts: hpnicfrmonEnableEntry.setDescription('A list of parameters that set up a hpnicfrmonEnableTable')
hpnicfrmonEnableIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hpnicfrmonEnableIfIndex.setStatus('current')
if mibBuilder.loadTexts: hpnicfrmonEnableIfIndex.setDescription('Specify an interface to enable rmon.')
hpnicfrmonEnableStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hpnicfrmonEnableStatus.setStatus('current')
if mibBuilder.loadTexts: hpnicfrmonEnableStatus.setDescription('Specify an interface to enable rmon.')
hpnicfTrapDestTable = MibTable((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 6), )
if mibBuilder.loadTexts: hpnicfTrapDestTable.setStatus('current')
if mibBuilder.loadTexts: hpnicfTrapDestTable.setDescription('Defines the trap destination Extend Table for providing, via SNMP, the capability of configure a trap dest.')
hpnicfTrapDestEntry = MibTableRow((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 6, 1), )
trapDestEntry.registerAugmentions(("HPN-ICF-RMON-EXT-MIB", "hpnicfTrapDestEntry"))
hpnicfTrapDestEntry.setIndexNames(*trapDestEntry.getIndexNames())
if mibBuilder.loadTexts: hpnicfTrapDestEntry.setStatus('current')
if mibBuilder.loadTexts: hpnicfTrapDestEntry.setDescription('Defines an entry in the hpnicfTrapDestTable.')
hpnicfTrapDestVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 6, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("snmpv1", 1), ("snmpv2", 2), ("snmpv3andauthen", 3), ("snmpv3andnoauthen", 4), ("snmpv3andpriv", 5))).clone('snmpv1')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hpnicfTrapDestVersion.setStatus('current')
if mibBuilder.loadTexts: hpnicfTrapDestVersion.setDescription('The version for trap destination. This object may not be modified if the associated trapDestStatus object is equal to active(1).')
hpnicfrmonExtendEventsV2 = ObjectIdentity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 0))
if mibBuilder.loadTexts: hpnicfrmonExtendEventsV2.setStatus('current')
if mibBuilder.loadTexts: hpnicfrmonExtendEventsV2.setDescription('Definition point for pri RMON notifications.')
hpnicfpririsingAlarm = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 0, 1)).setObjects(("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmIndex"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmSympol"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmSampleType"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmValue"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmRisingThreshold"))
if mibBuilder.loadTexts: hpnicfpririsingAlarm.setStatus('current')
if mibBuilder.loadTexts: hpnicfpririsingAlarm.setDescription('The SNMP trap that is generated when an alarm entry crosses its rising threshold and generates an event that is configured for sending SNMP traps.')
hpnicfprifallingAlarm = NotificationType((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 0, 2)).setObjects(("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmIndex"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmSympol"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmSampleType"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmValue"), ("HPN-ICF-RMON-EXT-MIB", "hpnicfprialarmFallingThreshold"))
if mibBuilder.loadTexts: hpnicfprifallingAlarm.setStatus('current')
if mibBuilder.loadTexts: hpnicfprifallingAlarm.setDescription('The SNMP trap that is generated when an alarm entry crosses its falling threshold and generates an event that is configured for sending SNMP traps.')
mibBuilder.exportSymbols("HPN-ICF-RMON-EXT-MIB", hpnicfprialarmSympol=hpnicfprialarmSympol, hpnicfrmonEnableEntry=hpnicfrmonEnableEntry, hpnicfprialarmStatType=hpnicfprialarmStatType, hpnicfprifallingAlarm=hpnicfprifallingAlarm, hpnicfprialarmRisingThreshold=hpnicfprialarmRisingThreshold, hpnicfprialarmEntry=hpnicfprialarmEntry, hpnicfprialarmRisingEventIndex=hpnicfprialarmRisingEventIndex, hpnicfprialarmFallingEventIndex=hpnicfprialarmFallingEventIndex, hpnicfrmonEnableIfIndex=hpnicfrmonEnableIfIndex, hpnicfrmonEnableTable=hpnicfrmonEnableTable, hpnicfprialarmOwner=hpnicfprialarmOwner, hpnicfrmonExtendEventsV2=hpnicfrmonExtendEventsV2, hpnicfprialarmSampleType=hpnicfprialarmSampleType, hpnicfTrapDestVersion=hpnicfTrapDestVersion, hpnicfprialarmIndex=hpnicfprialarmIndex, hpnicfpririsingAlarm=hpnicfpririsingAlarm, hpnicfprialarmTable=hpnicfprialarmTable, hpnicfprialarmStatCycle=hpnicfprialarmStatCycle, hpnicfperformance=hpnicfperformance, hpnicfprialarmFallingThreshold=hpnicfprialarmFallingThreshold, hpnicfTrapDestEntry=hpnicfTrapDestEntry, hpnicfprialarmStartupAlarm=hpnicfprialarmStartupAlarm, hpnicfprialarmInterval=hpnicfprialarmInterval, hpnicfTrapDestTable=hpnicfTrapDestTable, hpnicfprialarmStatus=hpnicfprialarmStatus, hpnicfprialarmValue=hpnicfprialarmValue, PYSNMP_MODULE_ID=hpnicfperformance, hpnicfrmonEnableStatus=hpnicfrmonEnableStatus, hpnicfprialarmVariable=hpnicfprialarmVariable)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint', 'ConstraintsUnion')
(hpnicfrmon_extend,) = mibBuilder.importSymbols('HPN-ICF-OID-MIB', 'hpnicfrmonExtend')
(owner_string,) = mibBuilder.importSymbols('IF-MIB', 'OwnerString')
(entry_status,) = mibBuilder.importSymbols('RMON-MIB', 'EntryStatus')
(trap_dest_entry, trap_dest_index) = mibBuilder.importSymbols('RMON2-MIB', 'trapDestEntry', 'trapDestIndex')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(object_identity, notification_type, unsigned32, ip_address, counter64, integer32, iso, time_ticks, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, module_identity, counter32, bits, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'ObjectIdentity', 'NotificationType', 'Unsigned32', 'IpAddress', 'Counter64', 'Integer32', 'iso', 'TimeTicks', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ModuleIdentity', 'Counter32', 'Bits', 'Gauge32')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
hpnicfperformance = module_identity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4))
hpnicfperformance.setRevisions(('2003-03-15 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
hpnicfperformance.setRevisionsDescriptions(('The initial revision of this MIB module.',))
if mibBuilder.loadTexts:
hpnicfperformance.setLastUpdated('200303150000Z')
if mibBuilder.loadTexts:
hpnicfperformance.setOrganization('')
if mibBuilder.loadTexts:
hpnicfperformance.setContactInfo('')
if mibBuilder.loadTexts:
hpnicfperformance.setDescription(' ')
hpnicfprialarm_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1))
if mibBuilder.loadTexts:
hpnicfprialarmTable.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmTable.setDescription('A list of alarm entries.')
hpnicfprialarm_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1)).setIndexNames((0, 'HPN-ICF-RMON-EXT-MIB', 'hpnicfprialarmIndex'))
if mibBuilder.loadTexts:
hpnicfprialarmEntry.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmEntry.setDescription('A list of parameters that set up a periodic checking for alarm conditions. For example, an instance of the alarmValue object might be named alarmValue.8')
hpnicfprialarm_index = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfprialarmIndex.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmIndex.setDescription('An index that uniquely identifies an entry in the alarm table. Each such entry defines a diagnostic sample at a particular interval for an object on the device.')
hpnicfprialarm_interval = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 2), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmInterval.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmInterval.setDescription('The interval in seconds over which the data is sampled and compared with the rising and falling thresholds. When setting this variable, care should be taken in the case of deltaValue sampling - the interval should be set short enough that the sampled variable is very unlikely to increase or decrease by more than 2^31 - 1 during a single sampling interval. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarm_variable = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 3), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmVariable.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmVariable.setDescription('The object identifier of the particular variable to be sampled. Only variables that resolve to an ASN.1 primitive type of INTEGER (INTEGER, Integer32, Counter32, Counter64, Gauge, or TimeTicks) may be sampled. Because SNMP access control is articulated entirely in terms of the contents of MIB views, no access control mechanism exists that can restrict the value of this object to identify only those objects that exist in a particular MIB view. Because there is thus no acceptable means of restricting the read access that could be obtained through the alarm mechanism, the probe must only grant write access to this object in those views that have read access to all objects on the probe. During a set operation, if the supplied variable name is not available in the selected MIB view, a badValue error must be returned. If at any time the variable name of an established alarmEntry is no longer available in the selected MIB view, the probe must change the status of this alarmEntry to invalid(4). This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarm_sympol = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 4), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmSympol.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmSympol.setDescription('')
hpnicfprialarm_sample_type = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('absoluteValue', 1), ('deltaValue', 2), ('speedValue', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmSampleType.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmSampleType.setDescription('The method of sampling the selected variable and calculating the value to be compared against the thresholds. If the value of this object is absoluteValue(1), the value of the selected variable will be compared directly with the thresholds at the end of the sampling interval. If the value of this object is deltaValue(2), the value of the selected variable at the last sample will be subtracted from the current value, and the difference compared with the thresholds. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarm_value = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfprialarmValue.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmValue.setDescription('The value of the statistic during the last sampling period. For example, if the sample type is deltaValue, this value will be the difference between the samples at the beginning and end of the period. If the sample type is absoluteValue, this value will be the sampled value at the end of the period. This is the value that is compared with the rising and falling thresholds. The value during the current sampling period is not made available until the period is completed and will remain available until the next period completes.')
hpnicfprialarm_startup_alarm = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('risingAlarm', 1), ('fallingAlarm', 2), ('risingOrFallingAlarm', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmStartupAlarm.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmStartupAlarm.setDescription('The alarm that may be sent when this entry is first set to valid. If the first sample after this entry becomes valid is greater than or equal to the risingThreshold and alarmStartupAlarm is equal to risingAlarm(1) or risingOrFallingAlarm(3), then a single rising alarm will be generated. If the first sample after this entry becomes valid is less than or equal to the fallingThreshold and alarmStartupAlarm is equal to fallingAlarm(2) or risingOrFallingAlarm(3), then a single falling alarm will be generated. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarm_rising_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 8), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmRisingThreshold.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmRisingThreshold.setDescription('A threshold for the sampled statistic. When the current sampled value is greater than or equal to this threshold, and the value at the last sampling interval was less than this threshold, a single event will be generated. A single event will also be generated if the first sample after this entry becomes valid is greater than or equal to this threshold and the associated alarmStartupAlarm is equal to risingAlarm(1) or risingOrFallingAlarm(3). After a rising event is generated, another such event will not be generated until the sampled value falls below this threshold and reaches the alarmFallingThreshold. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarm_falling_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 9), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmFallingThreshold.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmFallingThreshold.setDescription('A threshold for the sampled statistic. When the current sampled value is less than or equal to this threshold, and the value at the last sampling interval was greater than this threshold, a single event will be generated. A single event will also be generated if the first sample after this entry becomes valid is less than or equal to this threshold and the associated alarmStartupAlarm is equal to fallingAlarm(2) or risingOrFallingAlarm(3). After a falling event is generated, another such event will not be generated until the sampled value rises above this threshold and reaches the alarmRisingThreshold. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarm_rising_event_index = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmRisingEventIndex.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmRisingEventIndex.setDescription('The index of the eventEntry that is used when a rising threshold is crossed. The eventEntry identified by a particular value of this index is the same as identified by the same value of the eventIndex object. If there is no corresponding entry in the eventTable, then no association exists. In particular, if this value is zero, no associated event will be generated, as zero is not a valid event index. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarm_falling_event_index = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 11), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmFallingEventIndex.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmFallingEventIndex.setDescription('The index of the eventEntry that is used when a falling threshold is crossed. The eventEntry identified by a particular value of this index is the same as identified by the same value of the eventIndex object. If there is no corresponding entry in the eventTable, then no association exists. In particular, if this value is zero, no associated event will be generated, as zero is not a valid event index. This object may not be modified if the associated alarmStatus object is equal to valid(1).')
hpnicfprialarm_stat_cycle = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 12), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmStatCycle.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmStatCycle.setDescription('')
hpnicfprialarm_stat_type = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('forever', 1), ('during', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmStatType.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmStatType.setDescription('')
hpnicfprialarm_owner = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 14), owner_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmOwner.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmOwner.setDescription('The entity that configured this entry and is therefore using the resources assigned to it.')
hpnicfprialarm_status = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 4, 1, 1, 15), entry_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfprialarmStatus.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprialarmStatus.setDescription('The status of this alarm entry.')
hpnicfrmon_enable_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 5))
if mibBuilder.loadTexts:
hpnicfrmonEnableTable.setStatus('current')
if mibBuilder.loadTexts:
hpnicfrmonEnableTable.setDescription('A list of enable rmon entries.')
hpnicfrmon_enable_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 5, 1)).setIndexNames((0, 'HPN-ICF-RMON-EXT-MIB', 'hpnicfrmonEnableIfIndex'))
if mibBuilder.loadTexts:
hpnicfrmonEnableEntry.setStatus('current')
if mibBuilder.loadTexts:
hpnicfrmonEnableEntry.setDescription('A list of parameters that set up a hpnicfrmonEnableTable')
hpnicfrmon_enable_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 5, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hpnicfrmonEnableIfIndex.setStatus('current')
if mibBuilder.loadTexts:
hpnicfrmonEnableIfIndex.setDescription('Specify an interface to enable rmon.')
hpnicfrmon_enable_status = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 5, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hpnicfrmonEnableStatus.setStatus('current')
if mibBuilder.loadTexts:
hpnicfrmonEnableStatus.setDescription('Specify an interface to enable rmon.')
hpnicf_trap_dest_table = mib_table((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 6))
if mibBuilder.loadTexts:
hpnicfTrapDestTable.setStatus('current')
if mibBuilder.loadTexts:
hpnicfTrapDestTable.setDescription('Defines the trap destination Extend Table for providing, via SNMP, the capability of configure a trap dest.')
hpnicf_trap_dest_entry = mib_table_row((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 6, 1))
trapDestEntry.registerAugmentions(('HPN-ICF-RMON-EXT-MIB', 'hpnicfTrapDestEntry'))
hpnicfTrapDestEntry.setIndexNames(*trapDestEntry.getIndexNames())
if mibBuilder.loadTexts:
hpnicfTrapDestEntry.setStatus('current')
if mibBuilder.loadTexts:
hpnicfTrapDestEntry.setDescription('Defines an entry in the hpnicfTrapDestTable.')
hpnicf_trap_dest_version = mib_table_column((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 6, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('snmpv1', 1), ('snmpv2', 2), ('snmpv3andauthen', 3), ('snmpv3andnoauthen', 4), ('snmpv3andpriv', 5))).clone('snmpv1')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hpnicfTrapDestVersion.setStatus('current')
if mibBuilder.loadTexts:
hpnicfTrapDestVersion.setDescription('The version for trap destination. This object may not be modified if the associated trapDestStatus object is equal to active(1).')
hpnicfrmon_extend_events_v2 = object_identity((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 0))
if mibBuilder.loadTexts:
hpnicfrmonExtendEventsV2.setStatus('current')
if mibBuilder.loadTexts:
hpnicfrmonExtendEventsV2.setDescription('Definition point for pri RMON notifications.')
hpnicfprirising_alarm = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 0, 1)).setObjects(('HPN-ICF-RMON-EXT-MIB', 'hpnicfprialarmIndex'), ('HPN-ICF-RMON-EXT-MIB', 'hpnicfprialarmSympol'), ('HPN-ICF-RMON-EXT-MIB', 'hpnicfprialarmSampleType'), ('HPN-ICF-RMON-EXT-MIB', 'hpnicfprialarmValue'), ('HPN-ICF-RMON-EXT-MIB', 'hpnicfprialarmRisingThreshold'))
if mibBuilder.loadTexts:
hpnicfpririsingAlarm.setStatus('current')
if mibBuilder.loadTexts:
hpnicfpririsingAlarm.setDescription('The SNMP trap that is generated when an alarm entry crosses its rising threshold and generates an event that is configured for sending SNMP traps.')
hpnicfprifalling_alarm = notification_type((1, 3, 6, 1, 4, 1, 11, 2, 14, 11, 15, 8, 4, 0, 2)).setObjects(('HPN-ICF-RMON-EXT-MIB', 'hpnicfprialarmIndex'), ('HPN-ICF-RMON-EXT-MIB', 'hpnicfprialarmSympol'), ('HPN-ICF-RMON-EXT-MIB', 'hpnicfprialarmSampleType'), ('HPN-ICF-RMON-EXT-MIB', 'hpnicfprialarmValue'), ('HPN-ICF-RMON-EXT-MIB', 'hpnicfprialarmFallingThreshold'))
if mibBuilder.loadTexts:
hpnicfprifallingAlarm.setStatus('current')
if mibBuilder.loadTexts:
hpnicfprifallingAlarm.setDescription('The SNMP trap that is generated when an alarm entry crosses its falling threshold and generates an event that is configured for sending SNMP traps.')
mibBuilder.exportSymbols('HPN-ICF-RMON-EXT-MIB', hpnicfprialarmSympol=hpnicfprialarmSympol, hpnicfrmonEnableEntry=hpnicfrmonEnableEntry, hpnicfprialarmStatType=hpnicfprialarmStatType, hpnicfprifallingAlarm=hpnicfprifallingAlarm, hpnicfprialarmRisingThreshold=hpnicfprialarmRisingThreshold, hpnicfprialarmEntry=hpnicfprialarmEntry, hpnicfprialarmRisingEventIndex=hpnicfprialarmRisingEventIndex, hpnicfprialarmFallingEventIndex=hpnicfprialarmFallingEventIndex, hpnicfrmonEnableIfIndex=hpnicfrmonEnableIfIndex, hpnicfrmonEnableTable=hpnicfrmonEnableTable, hpnicfprialarmOwner=hpnicfprialarmOwner, hpnicfrmonExtendEventsV2=hpnicfrmonExtendEventsV2, hpnicfprialarmSampleType=hpnicfprialarmSampleType, hpnicfTrapDestVersion=hpnicfTrapDestVersion, hpnicfprialarmIndex=hpnicfprialarmIndex, hpnicfpririsingAlarm=hpnicfpririsingAlarm, hpnicfprialarmTable=hpnicfprialarmTable, hpnicfprialarmStatCycle=hpnicfprialarmStatCycle, hpnicfperformance=hpnicfperformance, hpnicfprialarmFallingThreshold=hpnicfprialarmFallingThreshold, hpnicfTrapDestEntry=hpnicfTrapDestEntry, hpnicfprialarmStartupAlarm=hpnicfprialarmStartupAlarm, hpnicfprialarmInterval=hpnicfprialarmInterval, hpnicfTrapDestTable=hpnicfTrapDestTable, hpnicfprialarmStatus=hpnicfprialarmStatus, hpnicfprialarmValue=hpnicfprialarmValue, PYSNMP_MODULE_ID=hpnicfperformance, hpnicfrmonEnableStatus=hpnicfrmonEnableStatus, hpnicfprialarmVariable=hpnicfprialarmVariable) |
def test_add_project(app, json_project):
project = json_project
old_projects = app.project.get_project_list()
app.project.create_project(project)
new_projects = app.project.get_project_list()
old_projects.append(project)
assert len(old_projects) == len(new_projects) | def test_add_project(app, json_project):
project = json_project
old_projects = app.project.get_project_list()
app.project.create_project(project)
new_projects = app.project.get_project_list()
old_projects.append(project)
assert len(old_projects) == len(new_projects) |
#Entrada
la=int(input("Ingrese la lectura actual: "))
le=int(input("Ingrese la lectura anterior: "))
#Caja negra
lnc=le-la
if(lnc>=0) and (lnc<=100):
s=lnc*4600
elif(lnc>=101) and (lnc<=300):
s=lnc*80000
elif(lnc>=301) and (lnc<=500):
s=lnc*100000
elif(lnc>=501):
s=lnc*120000
#Salida
print("El monto a pagar sera: ", s) | la = int(input('Ingrese la lectura actual: '))
le = int(input('Ingrese la lectura anterior: '))
lnc = le - la
if lnc >= 0 and lnc <= 100:
s = lnc * 4600
elif lnc >= 101 and lnc <= 300:
s = lnc * 80000
elif lnc >= 301 and lnc <= 500:
s = lnc * 100000
elif lnc >= 501:
s = lnc * 120000
print('El monto a pagar sera: ', s) |
#
# PySNMP MIB module DNOS-NSF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DNOS-NSF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:51:52 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, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection")
dnOS, = mibBuilder.importSymbols("DELL-REF-MIB", "dnOS")
agentInventoryUnitNumber, agentInventoryUnitEntry = mibBuilder.importSymbols("DNOS-INVENTORY-MIB", "agentInventoryUnitNumber", "agentInventoryUnitEntry")
ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup")
MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, IpAddress, ModuleIdentity, iso, ObjectIdentity, NotificationType, Counter64, Unsigned32, Integer32, Gauge32, Counter32, Bits, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "IpAddress", "ModuleIdentity", "iso", "ObjectIdentity", "NotificationType", "Counter64", "Unsigned32", "Integer32", "Gauge32", "Counter32", "Bits", "TimeTicks")
TextualConvention, DisplayString, TruthValue, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "TruthValue", "RowStatus")
fastPathNsf = ModuleIdentity((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46))
fastPathNsf.setRevisions(('2011-01-26 00:00', '2009-04-23 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: fastPathNsf.setRevisionsDescriptions(('Postal address updated.', 'Initial version.',))
if mibBuilder.loadTexts: fastPathNsf.setLastUpdated('201101260000Z')
if mibBuilder.loadTexts: fastPathNsf.setOrganization('Dell, Inc.')
if mibBuilder.loadTexts: fastPathNsf.setContactInfo('')
if mibBuilder.loadTexts: fastPathNsf.setDescription('This MIB defines the objects used for FastPath to configure and report information and status of NSF features.')
agentNsfUnitTable = MibTable((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 1), )
if mibBuilder.loadTexts: agentNsfUnitTable.setStatus('current')
if mibBuilder.loadTexts: agentNsfUnitTable.setDescription('A table of Per-Unit configuration objects for NSF.')
agentNsfUnitEntry = MibTableRow((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 1, 1), )
agentInventoryUnitEntry.registerAugmentions(("DNOS-NSF-MIB", "agentNsfUnitEntry"))
agentNsfUnitEntry.setIndexNames(*agentInventoryUnitEntry.getIndexNames())
if mibBuilder.loadTexts: agentNsfUnitEntry.setStatus('current')
if mibBuilder.loadTexts: agentNsfUnitEntry.setDescription('Each Instance corresponds with a different unit managed by this agent.')
agentNsfUnitSupport = MibTableColumn((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 1, 1, 1), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentNsfUnitSupport.setStatus('current')
if mibBuilder.loadTexts: agentNsfUnitSupport.setDescription('Indicates if the unit supports the NSF feature.')
agentNsfGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2))
agentNsfAdminStatus = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: agentNsfAdminStatus.setStatus('current')
if mibBuilder.loadTexts: agentNsfAdminStatus.setDescription('Controls whether NSF is enabled on the unit/stack.')
agentNsfOperStatus = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentNsfOperStatus.setStatus('current')
if mibBuilder.loadTexts: agentNsfOperStatus.setDescription('Indicates whether NSF is enabled on the unit/stack.')
agentNsfLastStartupReason = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("unknown", 1), ("power-on", 2), ("warm-admin-move", 3), ("cold-admin-move", 4), ("warm-auto-restart", 5), ("cold-auto-restart", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentNsfLastStartupReason.setStatus('current')
if mibBuilder.loadTexts: agentNsfLastStartupReason.setDescription("The type of activation that caused the software to start the last time. unknown: The switch rebooted for an unknown reason. power-on: The switch rebooted. This could have been caused by a power cycle or an administrative 'Reload' command. warm-admin-move: The administrator issued a command for the stand-by manager to take over. cold-admin-move: The administrator issued a command for the stand-by manager to take over, but the system was not ready for a warm-failover. warm-auto-restart: The primary management card restarted due to a failure, and the system executed a nonstop forwarding failover. cold-auto-restart: The system switched from the active manager to the backup manager and was unable to maintain user data traffic. This is usually caused by multiple failures occurring close together")
agentNsfTimeSinceLastRestart = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 4), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentNsfTimeSinceLastRestart.setStatus('current')
if mibBuilder.loadTexts: agentNsfTimeSinceLastRestart.setDescription('Time since the current management card became the active management card.')
agentNsfRestartInProgress = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 5), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentNsfRestartInProgress.setStatus('current')
if mibBuilder.loadTexts: agentNsfRestartInProgress.setDescription('Whether a restart is in progress. A restart is not considered complete until all hardware tables have been fully reconciled.')
agentNsfWarmRestartReady = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 6), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentNsfWarmRestartReady.setStatus('current')
if mibBuilder.loadTexts: agentNsfWarmRestartReady.setDescription('Whether the initial full checkpoint has finished.')
agentNsfBackupConfigurationAge = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 7), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentNsfBackupConfigurationAge.setStatus('current')
if mibBuilder.loadTexts: agentNsfBackupConfigurationAge.setDescription('Age of the configuration on the backup unit. The time since the running configuration was last copied to the backup unit.')
agentNsfInitiateFailover = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: agentNsfInitiateFailover.setStatus('current')
if mibBuilder.loadTexts: agentNsfInitiateFailover.setDescription('Triggers an administrative failover to the backup unit.')
agentCheckpointStatsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3))
agentCheckpointClearStatistics = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: agentCheckpointClearStatistics.setStatus('current')
if mibBuilder.loadTexts: agentCheckpointClearStatistics.setDescription('When set to enable(1), resets checkpoint statistics.')
agentCheckpointMessages = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentCheckpointMessages.setStatus('current')
if mibBuilder.loadTexts: agentCheckpointMessages.setDescription('Total number of checkpoint messages sent.')
agentCheckpointBytes = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentCheckpointBytes.setStatus('current')
if mibBuilder.loadTexts: agentCheckpointBytes.setDescription('Size in bytes of the total ammount of checkpoint messages sent.')
agentCheckpointTimeSinceCountersCleared = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 4), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentCheckpointTimeSinceCountersCleared.setStatus('current')
if mibBuilder.loadTexts: agentCheckpointTimeSinceCountersCleared.setDescription('Indicates how long since the Checkpoint counters have been cleared.')
agentCheckpointMessageRateInterval = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 5), Unsigned32()).setUnits('seconds').setMaxAccess("readonly")
if mibBuilder.loadTexts: agentCheckpointMessageRateInterval.setStatus('current')
if mibBuilder.loadTexts: agentCheckpointMessageRateInterval.setDescription('Indicates the duration in seconds of the message rate interval.')
agentCheckpointMessageRate = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 6), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentCheckpointMessageRate.setStatus('current')
if mibBuilder.loadTexts: agentCheckpointMessageRate.setDescription('Number of checkpoint messages received in the last interval defined by agentCheckpointMessageRateInterval.')
agentCheckpointHighestMessageRate = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 7), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentCheckpointHighestMessageRate.setStatus('current')
if mibBuilder.loadTexts: agentCheckpointHighestMessageRate.setDescription('Highest number of checkpoint messages received in an interval defined by agentCheckpointMessageRateInterval.')
agentNsfOspfGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4))
agentNsfOspfSupportMode = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("planned", 2), ("always", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: agentNsfOspfSupportMode.setStatus('current')
if mibBuilder.loadTexts: agentNsfOspfSupportMode.setDescription('')
agentNsfOspfRestartInterval = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 2), Unsigned32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: agentNsfOspfRestartInterval.setStatus('current')
if mibBuilder.loadTexts: agentNsfOspfRestartInterval.setDescription('')
agentNsfOspfRestartStatus = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown", 1), ("not-restarting", 2), ("planned-restart", 3), ("unplanned-restart", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentNsfOspfRestartStatus.setStatus('current')
if mibBuilder.loadTexts: agentNsfOspfRestartStatus.setDescription('')
agentNsfOspfRestartAge = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 4), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentNsfOspfRestartAge.setStatus('current')
if mibBuilder.loadTexts: agentNsfOspfRestartAge.setDescription('')
agentNsfOspfRestartExitReason = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("none", 1), ("in-progress", 2), ("completed", 3), ("timed-out", 4), ("topology-change", 5), ("manual-clear", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: agentNsfOspfRestartExitReason.setStatus('current')
if mibBuilder.loadTexts: agentNsfOspfRestartExitReason.setDescription('')
agentNsfOspfHelperSupportMode = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("planned", 2), ("always", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: agentNsfOspfHelperSupportMode.setStatus('current')
if mibBuilder.loadTexts: agentNsfOspfHelperSupportMode.setDescription('')
agentNsfOspfHelperStrictLSAChecking = MibScalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: agentNsfOspfHelperStrictLSAChecking.setStatus('current')
if mibBuilder.loadTexts: agentNsfOspfHelperStrictLSAChecking.setDescription('')
agentNsfTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 0))
agentNsfStackRestartComplete = NotificationType((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 0, 1)).setObjects(("DNOS-INVENTORY-MIB", "agentInventoryUnitNumber"), ("DNOS-NSF-MIB", "agentNsfLastStartupReason"))
if mibBuilder.loadTexts: agentNsfStackRestartComplete.setStatus('current')
if mibBuilder.loadTexts: agentNsfStackRestartComplete.setDescription('Sent when the stack finishes restarting after a failover.')
mibBuilder.exportSymbols("DNOS-NSF-MIB", PYSNMP_MODULE_ID=fastPathNsf, agentCheckpointTimeSinceCountersCleared=agentCheckpointTimeSinceCountersCleared, agentNsfOspfRestartExitReason=agentNsfOspfRestartExitReason, agentNsfTraps=agentNsfTraps, agentCheckpointMessageRateInterval=agentCheckpointMessageRateInterval, agentCheckpointMessageRate=agentCheckpointMessageRate, agentNsfBackupConfigurationAge=agentNsfBackupConfigurationAge, agentCheckpointHighestMessageRate=agentCheckpointHighestMessageRate, agentNsfLastStartupReason=agentNsfLastStartupReason, agentNsfAdminStatus=agentNsfAdminStatus, agentNsfTimeSinceLastRestart=agentNsfTimeSinceLastRestart, agentNsfOspfHelperStrictLSAChecking=agentNsfOspfHelperStrictLSAChecking, agentCheckpointClearStatistics=agentCheckpointClearStatistics, agentCheckpointBytes=agentCheckpointBytes, agentNsfUnitTable=agentNsfUnitTable, agentCheckpointStatsGroup=agentCheckpointStatsGroup, agentNsfInitiateFailover=agentNsfInitiateFailover, agentNsfUnitSupport=agentNsfUnitSupport, agentCheckpointMessages=agentCheckpointMessages, agentNsfOspfRestartAge=agentNsfOspfRestartAge, agentNsfOperStatus=agentNsfOperStatus, agentNsfOspfRestartStatus=agentNsfOspfRestartStatus, agentNsfOspfGroup=agentNsfOspfGroup, fastPathNsf=fastPathNsf, agentNsfGroup=agentNsfGroup, agentNsfWarmRestartReady=agentNsfWarmRestartReady, agentNsfUnitEntry=agentNsfUnitEntry, agentNsfOspfRestartInterval=agentNsfOspfRestartInterval, agentNsfStackRestartComplete=agentNsfStackRestartComplete, agentNsfOspfSupportMode=agentNsfOspfSupportMode, agentNsfRestartInProgress=agentNsfRestartInProgress, agentNsfOspfHelperSupportMode=agentNsfOspfHelperSupportMode)
| (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, value_range_constraint, single_value_constraint, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsUnion', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection')
(dn_os,) = mibBuilder.importSymbols('DELL-REF-MIB', 'dnOS')
(agent_inventory_unit_number, agent_inventory_unit_entry) = mibBuilder.importSymbols('DNOS-INVENTORY-MIB', 'agentInventoryUnitNumber', 'agentInventoryUnitEntry')
(module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup')
(mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, ip_address, module_identity, iso, object_identity, notification_type, counter64, unsigned32, integer32, gauge32, counter32, bits, time_ticks) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'IpAddress', 'ModuleIdentity', 'iso', 'ObjectIdentity', 'NotificationType', 'Counter64', 'Unsigned32', 'Integer32', 'Gauge32', 'Counter32', 'Bits', 'TimeTicks')
(textual_convention, display_string, truth_value, row_status) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString', 'TruthValue', 'RowStatus')
fast_path_nsf = module_identity((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46))
fastPathNsf.setRevisions(('2011-01-26 00:00', '2009-04-23 00:00'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
fastPathNsf.setRevisionsDescriptions(('Postal address updated.', 'Initial version.'))
if mibBuilder.loadTexts:
fastPathNsf.setLastUpdated('201101260000Z')
if mibBuilder.loadTexts:
fastPathNsf.setOrganization('Dell, Inc.')
if mibBuilder.loadTexts:
fastPathNsf.setContactInfo('')
if mibBuilder.loadTexts:
fastPathNsf.setDescription('This MIB defines the objects used for FastPath to configure and report information and status of NSF features.')
agent_nsf_unit_table = mib_table((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 1))
if mibBuilder.loadTexts:
agentNsfUnitTable.setStatus('current')
if mibBuilder.loadTexts:
agentNsfUnitTable.setDescription('A table of Per-Unit configuration objects for NSF.')
agent_nsf_unit_entry = mib_table_row((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 1, 1))
agentInventoryUnitEntry.registerAugmentions(('DNOS-NSF-MIB', 'agentNsfUnitEntry'))
agentNsfUnitEntry.setIndexNames(*agentInventoryUnitEntry.getIndexNames())
if mibBuilder.loadTexts:
agentNsfUnitEntry.setStatus('current')
if mibBuilder.loadTexts:
agentNsfUnitEntry.setDescription('Each Instance corresponds with a different unit managed by this agent.')
agent_nsf_unit_support = mib_table_column((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 1, 1, 1), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentNsfUnitSupport.setStatus('current')
if mibBuilder.loadTexts:
agentNsfUnitSupport.setDescription('Indicates if the unit supports the NSF feature.')
agent_nsf_group = mib_identifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2))
agent_nsf_admin_status = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
agentNsfAdminStatus.setStatus('current')
if mibBuilder.loadTexts:
agentNsfAdminStatus.setDescription('Controls whether NSF is enabled on the unit/stack.')
agent_nsf_oper_status = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentNsfOperStatus.setStatus('current')
if mibBuilder.loadTexts:
agentNsfOperStatus.setDescription('Indicates whether NSF is enabled on the unit/stack.')
agent_nsf_last_startup_reason = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('unknown', 1), ('power-on', 2), ('warm-admin-move', 3), ('cold-admin-move', 4), ('warm-auto-restart', 5), ('cold-auto-restart', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentNsfLastStartupReason.setStatus('current')
if mibBuilder.loadTexts:
agentNsfLastStartupReason.setDescription("The type of activation that caused the software to start the last time. unknown: The switch rebooted for an unknown reason. power-on: The switch rebooted. This could have been caused by a power cycle or an administrative 'Reload' command. warm-admin-move: The administrator issued a command for the stand-by manager to take over. cold-admin-move: The administrator issued a command for the stand-by manager to take over, but the system was not ready for a warm-failover. warm-auto-restart: The primary management card restarted due to a failure, and the system executed a nonstop forwarding failover. cold-auto-restart: The system switched from the active manager to the backup manager and was unable to maintain user data traffic. This is usually caused by multiple failures occurring close together")
agent_nsf_time_since_last_restart = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 4), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentNsfTimeSinceLastRestart.setStatus('current')
if mibBuilder.loadTexts:
agentNsfTimeSinceLastRestart.setDescription('Time since the current management card became the active management card.')
agent_nsf_restart_in_progress = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 5), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentNsfRestartInProgress.setStatus('current')
if mibBuilder.loadTexts:
agentNsfRestartInProgress.setDescription('Whether a restart is in progress. A restart is not considered complete until all hardware tables have been fully reconciled.')
agent_nsf_warm_restart_ready = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 6), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentNsfWarmRestartReady.setStatus('current')
if mibBuilder.loadTexts:
agentNsfWarmRestartReady.setDescription('Whether the initial full checkpoint has finished.')
agent_nsf_backup_configuration_age = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 7), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentNsfBackupConfigurationAge.setStatus('current')
if mibBuilder.loadTexts:
agentNsfBackupConfigurationAge.setDescription('Age of the configuration on the backup unit. The time since the running configuration was last copied to the backup unit.')
agent_nsf_initiate_failover = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 2, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
agentNsfInitiateFailover.setStatus('current')
if mibBuilder.loadTexts:
agentNsfInitiateFailover.setDescription('Triggers an administrative failover to the backup unit.')
agent_checkpoint_stats_group = mib_identifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3))
agent_checkpoint_clear_statistics = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
agentCheckpointClearStatistics.setStatus('current')
if mibBuilder.loadTexts:
agentCheckpointClearStatistics.setDescription('When set to enable(1), resets checkpoint statistics.')
agent_checkpoint_messages = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentCheckpointMessages.setStatus('current')
if mibBuilder.loadTexts:
agentCheckpointMessages.setDescription('Total number of checkpoint messages sent.')
agent_checkpoint_bytes = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentCheckpointBytes.setStatus('current')
if mibBuilder.loadTexts:
agentCheckpointBytes.setDescription('Size in bytes of the total ammount of checkpoint messages sent.')
agent_checkpoint_time_since_counters_cleared = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 4), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentCheckpointTimeSinceCountersCleared.setStatus('current')
if mibBuilder.loadTexts:
agentCheckpointTimeSinceCountersCleared.setDescription('Indicates how long since the Checkpoint counters have been cleared.')
agent_checkpoint_message_rate_interval = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 5), unsigned32()).setUnits('seconds').setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentCheckpointMessageRateInterval.setStatus('current')
if mibBuilder.loadTexts:
agentCheckpointMessageRateInterval.setDescription('Indicates the duration in seconds of the message rate interval.')
agent_checkpoint_message_rate = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 6), gauge32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentCheckpointMessageRate.setStatus('current')
if mibBuilder.loadTexts:
agentCheckpointMessageRate.setDescription('Number of checkpoint messages received in the last interval defined by agentCheckpointMessageRateInterval.')
agent_checkpoint_highest_message_rate = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 3, 7), gauge32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentCheckpointHighestMessageRate.setStatus('current')
if mibBuilder.loadTexts:
agentCheckpointHighestMessageRate.setDescription('Highest number of checkpoint messages received in an interval defined by agentCheckpointMessageRateInterval.')
agent_nsf_ospf_group = mib_identifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4))
agent_nsf_ospf_support_mode = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('none', 1), ('planned', 2), ('always', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
agentNsfOspfSupportMode.setStatus('current')
if mibBuilder.loadTexts:
agentNsfOspfSupportMode.setDescription('')
agent_nsf_ospf_restart_interval = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 2), unsigned32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
agentNsfOspfRestartInterval.setStatus('current')
if mibBuilder.loadTexts:
agentNsfOspfRestartInterval.setDescription('')
agent_nsf_ospf_restart_status = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('unknown', 1), ('not-restarting', 2), ('planned-restart', 3), ('unplanned-restart', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentNsfOspfRestartStatus.setStatus('current')
if mibBuilder.loadTexts:
agentNsfOspfRestartStatus.setDescription('')
agent_nsf_ospf_restart_age = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 4), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentNsfOspfRestartAge.setStatus('current')
if mibBuilder.loadTexts:
agentNsfOspfRestartAge.setDescription('')
agent_nsf_ospf_restart_exit_reason = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('none', 1), ('in-progress', 2), ('completed', 3), ('timed-out', 4), ('topology-change', 5), ('manual-clear', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
agentNsfOspfRestartExitReason.setStatus('current')
if mibBuilder.loadTexts:
agentNsfOspfRestartExitReason.setDescription('')
agent_nsf_ospf_helper_support_mode = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('none', 1), ('planned', 2), ('always', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
agentNsfOspfHelperSupportMode.setStatus('current')
if mibBuilder.loadTexts:
agentNsfOspfHelperSupportMode.setDescription('')
agent_nsf_ospf_helper_strict_lsa_checking = mib_scalar((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 4, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
agentNsfOspfHelperStrictLSAChecking.setStatus('current')
if mibBuilder.loadTexts:
agentNsfOspfHelperStrictLSAChecking.setDescription('')
agent_nsf_traps = mib_identifier((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 0))
agent_nsf_stack_restart_complete = notification_type((1, 3, 6, 1, 4, 1, 674, 10895, 5000, 2, 6132, 1, 1, 46, 0, 1)).setObjects(('DNOS-INVENTORY-MIB', 'agentInventoryUnitNumber'), ('DNOS-NSF-MIB', 'agentNsfLastStartupReason'))
if mibBuilder.loadTexts:
agentNsfStackRestartComplete.setStatus('current')
if mibBuilder.loadTexts:
agentNsfStackRestartComplete.setDescription('Sent when the stack finishes restarting after a failover.')
mibBuilder.exportSymbols('DNOS-NSF-MIB', PYSNMP_MODULE_ID=fastPathNsf, agentCheckpointTimeSinceCountersCleared=agentCheckpointTimeSinceCountersCleared, agentNsfOspfRestartExitReason=agentNsfOspfRestartExitReason, agentNsfTraps=agentNsfTraps, agentCheckpointMessageRateInterval=agentCheckpointMessageRateInterval, agentCheckpointMessageRate=agentCheckpointMessageRate, agentNsfBackupConfigurationAge=agentNsfBackupConfigurationAge, agentCheckpointHighestMessageRate=agentCheckpointHighestMessageRate, agentNsfLastStartupReason=agentNsfLastStartupReason, agentNsfAdminStatus=agentNsfAdminStatus, agentNsfTimeSinceLastRestart=agentNsfTimeSinceLastRestart, agentNsfOspfHelperStrictLSAChecking=agentNsfOspfHelperStrictLSAChecking, agentCheckpointClearStatistics=agentCheckpointClearStatistics, agentCheckpointBytes=agentCheckpointBytes, agentNsfUnitTable=agentNsfUnitTable, agentCheckpointStatsGroup=agentCheckpointStatsGroup, agentNsfInitiateFailover=agentNsfInitiateFailover, agentNsfUnitSupport=agentNsfUnitSupport, agentCheckpointMessages=agentCheckpointMessages, agentNsfOspfRestartAge=agentNsfOspfRestartAge, agentNsfOperStatus=agentNsfOperStatus, agentNsfOspfRestartStatus=agentNsfOspfRestartStatus, agentNsfOspfGroup=agentNsfOspfGroup, fastPathNsf=fastPathNsf, agentNsfGroup=agentNsfGroup, agentNsfWarmRestartReady=agentNsfWarmRestartReady, agentNsfUnitEntry=agentNsfUnitEntry, agentNsfOspfRestartInterval=agentNsfOspfRestartInterval, agentNsfStackRestartComplete=agentNsfStackRestartComplete, agentNsfOspfSupportMode=agentNsfOspfSupportMode, agentNsfRestartInProgress=agentNsfRestartInProgress, agentNsfOspfHelperSupportMode=agentNsfOspfHelperSupportMode) |
expected_output = {
'table_id': {
'0xe0000000': {
'forward_referenced': 'No',
'prefix_count': 12,
'prefix_limit': 10000000,
'prefix_limit_notified': 'No',
'safi': 'uni',
'table_deleted': 'No',
'table_id': '0xe0000000',
'table_name': 'default',
'table_reached_convergence': 'Yes',
'table_version': 13,
'vrf_name': 'default'
},
'0xe0000001': {
'forward_referenced': 'No',
'prefix_count': 0,
'prefix_limit': 10000000,
'prefix_limit_notified': 'No',
'safi': 'uni',
'table_deleted': 'No',
'table_id': '0xe0000001',
'table_name': 'default',
'table_reached_convergence': 'Yes',
'table_version': 0,
'vrf_name': 'bob:by'
},
'0xe0000002': {
'forward_referenced': 'No',
'prefix_count': 2,
'prefix_limit': 10000000,
'prefix_limit_notified': 'No',
'safi': 'uni',
'table_deleted': 'No',
'table_id': '0xe0000002',
'table_name': 'default',
'table_reached_convergence': 'Yes',
'table_version': 3,
'vrf_name': 'DC-LAN'
},
'0xe0100000': {
'forward_referenced': 'No',
'prefix_count': 0,
'prefix_limit': 10000000,
'prefix_limit_notified': 'No',
'safi': 'multi',
'table_deleted': 'No',
'table_id': '0xe0100000',
'table_name': 'default',
'table_reached_convergence': 'Yes',
'table_version': 0,
'vrf_name': '**nVjjh'
}
}
}
| expected_output = {'table_id': {'0xe0000000': {'forward_referenced': 'No', 'prefix_count': 12, 'prefix_limit': 10000000, 'prefix_limit_notified': 'No', 'safi': 'uni', 'table_deleted': 'No', 'table_id': '0xe0000000', 'table_name': 'default', 'table_reached_convergence': 'Yes', 'table_version': 13, 'vrf_name': 'default'}, '0xe0000001': {'forward_referenced': 'No', 'prefix_count': 0, 'prefix_limit': 10000000, 'prefix_limit_notified': 'No', 'safi': 'uni', 'table_deleted': 'No', 'table_id': '0xe0000001', 'table_name': 'default', 'table_reached_convergence': 'Yes', 'table_version': 0, 'vrf_name': 'bob:by'}, '0xe0000002': {'forward_referenced': 'No', 'prefix_count': 2, 'prefix_limit': 10000000, 'prefix_limit_notified': 'No', 'safi': 'uni', 'table_deleted': 'No', 'table_id': '0xe0000002', 'table_name': 'default', 'table_reached_convergence': 'Yes', 'table_version': 3, 'vrf_name': 'DC-LAN'}, '0xe0100000': {'forward_referenced': 'No', 'prefix_count': 0, 'prefix_limit': 10000000, 'prefix_limit_notified': 'No', 'safi': 'multi', 'table_deleted': 'No', 'table_id': '0xe0100000', 'table_name': 'default', 'table_reached_convergence': 'Yes', 'table_version': 0, 'vrf_name': '**nVjjh'}}} |
grid_size = 8
cycles = 6
grid = [[[[c for c in input()] for _ in range(grid_size)]]]
for i in range(grid_size):
grid[0][0][i] = ['.' for _ in range(cycles)] + grid[0][0][i] + ['.' for _ in range(cycles)]
for _ in range(cycles):
grid[0][0] = [['.' for _ in range(grid_size + cycles * 2)]] + grid[0][0] + \
[['.' for _ in range(grid_size + cycles * 2)]]
for _ in range(cycles):
grid[0] = [[['.' for _ in range(grid_size + cycles * 2)] for _ in range(grid_size + cycles * 2)]] + grid[0] + \
[[['.' for _ in range(grid_size + cycles * 2)] for _ in range(grid_size + cycles * 2)]]
for _ in range(cycles):
grid = [[[['.' for _ in range(grid_size + cycles * 2)] for _ in range(grid_size + cycles * 2)]
for _ in range(len(grid[0]))]] + grid + \
[[[['.' for _ in range(grid_size + cycles * 2)] for _ in range(grid_size + cycles * 2)]
for _ in range(len(grid[0]))]]
for _ in range(cycles):
new_grid = [[[['.' for _ in range(len(grid[0][0][0]))] for _ in range(len(grid[0][0]))]
for _ in range(len(grid[0]))] for _ in range(len(grid))]
for w in range(len(grid)):
for z in range(len(grid[w])):
for y in range(len(grid[w][z])):
for x in range(len(grid[w][z][y])):
active_neighbours = 0
for h in range(max(0, w-1), min(w+2, len(grid))):
for i in range(max(0, z-1), min(z+2, len(grid[w]))):
for j in range(max(0, y-1), min(y+2, len(grid[w][z]))):
for k in range(max(0, x-1), min(x+2, len(grid[w][z][y]))):
if grid[h][i][j][k] == '#' and (h != w or i != z or j != y or k != x):
active_neighbours += 1
if grid[w][z][y][x] == '#':
new_grid[w][z][y][x] = '#' if 2 <= active_neighbours <= 3 else '.'
else:
new_grid[w][z][y][x] = '#' if active_neighbours == 3 else '.'
grid = new_grid
counter = 0
for w in range(len(grid)):
for z in range(len(grid[w])):
for y in range(len(grid[w][z])):
for x in range(len(grid[w][z][y])):
if grid[w][z][y][x] == '#':
counter += 1
print(counter)
| grid_size = 8
cycles = 6
grid = [[[[c for c in input()] for _ in range(grid_size)]]]
for i in range(grid_size):
grid[0][0][i] = ['.' for _ in range(cycles)] + grid[0][0][i] + ['.' for _ in range(cycles)]
for _ in range(cycles):
grid[0][0] = [['.' for _ in range(grid_size + cycles * 2)]] + grid[0][0] + [['.' for _ in range(grid_size + cycles * 2)]]
for _ in range(cycles):
grid[0] = [[['.' for _ in range(grid_size + cycles * 2)] for _ in range(grid_size + cycles * 2)]] + grid[0] + [[['.' for _ in range(grid_size + cycles * 2)] for _ in range(grid_size + cycles * 2)]]
for _ in range(cycles):
grid = [[[['.' for _ in range(grid_size + cycles * 2)] for _ in range(grid_size + cycles * 2)] for _ in range(len(grid[0]))]] + grid + [[[['.' for _ in range(grid_size + cycles * 2)] for _ in range(grid_size + cycles * 2)] for _ in range(len(grid[0]))]]
for _ in range(cycles):
new_grid = [[[['.' for _ in range(len(grid[0][0][0]))] for _ in range(len(grid[0][0]))] for _ in range(len(grid[0]))] for _ in range(len(grid))]
for w in range(len(grid)):
for z in range(len(grid[w])):
for y in range(len(grid[w][z])):
for x in range(len(grid[w][z][y])):
active_neighbours = 0
for h in range(max(0, w - 1), min(w + 2, len(grid))):
for i in range(max(0, z - 1), min(z + 2, len(grid[w]))):
for j in range(max(0, y - 1), min(y + 2, len(grid[w][z]))):
for k in range(max(0, x - 1), min(x + 2, len(grid[w][z][y]))):
if grid[h][i][j][k] == '#' and (h != w or i != z or j != y or (k != x)):
active_neighbours += 1
if grid[w][z][y][x] == '#':
new_grid[w][z][y][x] = '#' if 2 <= active_neighbours <= 3 else '.'
else:
new_grid[w][z][y][x] = '#' if active_neighbours == 3 else '.'
grid = new_grid
counter = 0
for w in range(len(grid)):
for z in range(len(grid[w])):
for y in range(len(grid[w][z])):
for x in range(len(grid[w][z][y])):
if grid[w][z][y][x] == '#':
counter += 1
print(counter) |
"""A special form of recursion where the
last operation of a function is a recursive call. """
def tailrecursive(n: int, a=1) -> int:
if n == 0:
return a
return tailrecursive(n - 1, n * a)
def nontailrecursive(n: int) -> int:
# The function is not tail
# recursive because the value
# returned by nontailrecursive(n-1) is used
# in nontailrecursive(n) and call to nontailrecursive(n-1)
# is not the last thing done by
# nontailrecursive(n)
if n == 0:
return 1
return n * nontailrecursive(n - 1)
if __name__ == "__main__":
"""
from timeit import timeit
print(timeit(lambda: tailrecursive(10), number=10000)) # 0.012317868999161874
print(timeit(lambda: nontailrecursive(10), number=10000)) # 0.010385317998952814
"""
| """A special form of recursion where the
last operation of a function is a recursive call. """
def tailrecursive(n: int, a=1) -> int:
if n == 0:
return a
return tailrecursive(n - 1, n * a)
def nontailrecursive(n: int) -> int:
if n == 0:
return 1
return n * nontailrecursive(n - 1)
if __name__ == '__main__':
'\n from timeit import timeit\n print(timeit(lambda: tailrecursive(10), number=10000)) # 0.012317868999161874\n print(timeit(lambda: nontailrecursive(10), number=10000)) # 0.010385317998952814\n ' |
#! Symbol table class holds the value of the variables respectively in a dict
class SymbolTable:
def __init__(self, parent = None):
self.symbols = {}
self.parent = parent
def get(self,name):
value = self.symbols.get(name, None)
if value == None and self.parent:
return self.parent.get(name)
return value
def set(self,name, value):
self.symbols[name] = value
def remove(self, name):
del self.symbols[name]
| class Symboltable:
def __init__(self, parent=None):
self.symbols = {}
self.parent = parent
def get(self, name):
value = self.symbols.get(name, None)
if value == None and self.parent:
return self.parent.get(name)
return value
def set(self, name, value):
self.symbols[name] = value
def remove(self, name):
del self.symbols[name] |
class PolyCurve(Curve,IDisposable,ISerializable):
"""
Represents a curve that is the result of joining several (possibly different)
types of curves.
PolyCurve()
"""
def Append(self,*__args):
"""
Append(self: PolyCurve,curve: Curve) -> bool
Appends and matches the start of the curve to the end of polycurve.
This function
will fail if the PolyCurve is closed or if SegmentCount > 0 and the new segment is closed.
curve: Segment to append.
Returns: true on success,false on failure.
Append(self: PolyCurve,arc: Arc) -> bool
Appends and matches the start of the arc to the end of polycurve.
This function
will fail if the polycurve is closed or if SegmentCount > 0 and the arc is closed.
arc: Arc segment to append.
Returns: true on success,false on failure.
Append(self: PolyCurve,line: Line) -> bool
Appends and matches the start of the line to the end of polycurve.
This function
will fail if the polycurve is closed.
line: Line segment to append.
Returns: true on success,false on failure.
"""
pass
def ConstructConstObject(self,*args):
"""
ConstructConstObject(self: CommonObject,parentObject: object,subobject_index: int)
Assigns a parent object and a subobject index to this.
parentObject: The parent object.
subobject_index: The subobject index.
"""
pass
def Dispose(self):
"""
Dispose(self: Curve,disposing: bool)
For derived class implementers.
This method is called with argument true when class
user calls Dispose(),while with argument false when
the Garbage Collector invokes
the finalizer,or Finalize() method.You must reclaim all used unmanaged resources in both cases,
and can use this chance to call Dispose on disposable fields if the argument is true.Also,you
must call the base virtual method within your overriding method.
disposing: true if the call comes from the Dispose() method; false if it comes from the Garbage Collector
finalizer.
"""
pass
def Duplicate(self):
"""
Duplicate(self: PolyCurve) -> GeometryBase
Duplicates this polycurve.
When not overridden in a derived class,this calls
Rhino.Geometry.PolyCurve.DuplicatePolyCurve.
Returns: An exact duplicate of this curve.
"""
pass
def DuplicatePolyCurve(self):
"""
DuplicatePolyCurve(self: PolyCurve) -> PolyCurve
Duplicates this polycurve.
This is the same as Rhino.Geometry.PolyCurve.Duplicate.
Returns: An exact duplicate of this curve.
"""
pass
def Explode(self):
"""
Explode(self: PolyCurve) -> Array[Curve]
Explodes this PolyCurve into a list of Curve segments. This will not explode nested polycurves.
Call Rhino.Geometry.PolyCurve.RemoveNesting first if you need all individual
segments.
Returns: An array of polycurve segments.
"""
pass
def NonConstOperation(self,*args):
"""
NonConstOperation(self: Curve)
For derived classes implementers.
Defines the necessary implementation to free the
instance from being const.
"""
pass
def OnSwitchToNonConst(self,*args):
"""
OnSwitchToNonConst(self: GeometryBase)
Is called when a non-const operation occurs.
"""
pass
def PolyCurveParameter(self,segmentIndex,segmentCurveParameter):
"""
PolyCurveParameter(self: PolyCurve,segmentIndex: int,segmentCurveParameter: float) -> float
Converts a segment curve parameter to a polycurve parameter.
segmentIndex: Index of segment.
segmentCurveParameter: Parameter on segment.
Returns: Polycurve evaluation parameter or UnsetValue if the polycurve curve parameter could not be
computed.
"""
pass
def RemoveNesting(self):
"""
RemoveNesting(self: PolyCurve) -> bool
Explodes nested polycurve segments and reconstructs this curve from the shattered remains.
The result will have not have any PolyCurves as segments but it will have identical
locus and parameterization.
Returns: true if any nested PolyCurve was found and absorbed,false if no PolyCurve segments could be
found.
"""
pass
def SegmentCurve(self,index):
"""
SegmentCurve(self: PolyCurve,index: int) -> Curve
Gets the segment curve at the given index.
index: Index of segment to retrieve.
Returns: The segment at the given index or null on failure.
"""
pass
def SegmentCurveParameter(self,polycurveParameter):
"""
SegmentCurveParameter(self: PolyCurve,polycurveParameter: float) -> float
Converts a polycurve parameter to a segment curve parameter.
polycurveParameter: Parameter on PolyCurve to convert.
Returns: Segment curve evaluation parameter or UnsetValue if the
segment curve parameter
could not be computed.
"""
pass
def SegmentDomain(self,segmentIndex):
"""
SegmentDomain(self: PolyCurve,segmentIndex: int) -> Interval
Returns the polycurve subdomain assigned to a segment curve.
segmentIndex: Index of segment.
Returns: The polycurve subdomain assigned to a segment curve.
Returns Interval.Unset if
segment_index < 0 or segment_index >= Count().
"""
pass
def SegmentIndex(self,polycurveParameter):
"""
SegmentIndex(self: PolyCurve,polycurveParameter: float) -> int
Finds the segment used for evaluation at polycurve_parameter.
polycurveParameter: Parameter on polycurve for segment lookup.
Returns: Index of the segment used for evaluation at polycurve_parameter.
If
polycurve_parameter < Domain.Min(),then 0 is returned.
If polycurve_parameter >
Domain.Max(),then Count()-1 is returned.
"""
pass
def SegmentIndexes(self,subdomain,segmentIndex0,segmentIndex1):
"""
SegmentIndexes(self: PolyCurve,subdomain: Interval) -> (int,int,int)
Finds the segments that overlap the Polycurve sub domain.
subdomain: Domain on this PolyCurve.
Returns: Number of segments that overlap the subdomain.
"""
pass
def __enter__(self,*args):
"""
__enter__(self: IDisposable) -> object
Provides the implementation of __enter__ for objects which implement IDisposable.
"""
pass
def __exit__(self,*args):
"""
__exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object)
Provides the implementation of __exit__ for objects which implement IDisposable.
"""
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self):
"""
__new__(cls: type,info: SerializationInfo,context: StreamingContext)
__new__(cls: type)
"""
pass
def __reduce_ex__(self,*args):
pass
HasGap=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""This is a quick way to see if the curve has gaps between the sub curve segments.
Get: HasGap(self: PolyCurve) -> bool
"""
IsNested=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets a value indicating whether or not a PolyCurve contains nested PolyCurves.
Get: IsNested(self: PolyCurve) -> bool
"""
SegmentCount=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the number of segments that make up this Polycurve.
Get: SegmentCount(self: PolyCurve) -> int
"""
| class Polycurve(Curve, IDisposable, ISerializable):
"""
Represents a curve that is the result of joining several (possibly different)
types of curves.
PolyCurve()
"""
def append(self, *__args):
"""
Append(self: PolyCurve,curve: Curve) -> bool
Appends and matches the start of the curve to the end of polycurve.
This function
will fail if the PolyCurve is closed or if SegmentCount > 0 and the new segment is closed.
curve: Segment to append.
Returns: true on success,false on failure.
Append(self: PolyCurve,arc: Arc) -> bool
Appends and matches the start of the arc to the end of polycurve.
This function
will fail if the polycurve is closed or if SegmentCount > 0 and the arc is closed.
arc: Arc segment to append.
Returns: true on success,false on failure.
Append(self: PolyCurve,line: Line) -> bool
Appends and matches the start of the line to the end of polycurve.
This function
will fail if the polycurve is closed.
line: Line segment to append.
Returns: true on success,false on failure.
"""
pass
def construct_const_object(self, *args):
"""
ConstructConstObject(self: CommonObject,parentObject: object,subobject_index: int)
Assigns a parent object and a subobject index to this.
parentObject: The parent object.
subobject_index: The subobject index.
"""
pass
def dispose(self):
"""
Dispose(self: Curve,disposing: bool)
For derived class implementers.
This method is called with argument true when class
user calls Dispose(),while with argument false when
the Garbage Collector invokes
the finalizer,or Finalize() method.You must reclaim all used unmanaged resources in both cases,
and can use this chance to call Dispose on disposable fields if the argument is true.Also,you
must call the base virtual method within your overriding method.
disposing: true if the call comes from the Dispose() method; false if it comes from the Garbage Collector
finalizer.
"""
pass
def duplicate(self):
"""
Duplicate(self: PolyCurve) -> GeometryBase
Duplicates this polycurve.
When not overridden in a derived class,this calls
Rhino.Geometry.PolyCurve.DuplicatePolyCurve.
Returns: An exact duplicate of this curve.
"""
pass
def duplicate_poly_curve(self):
"""
DuplicatePolyCurve(self: PolyCurve) -> PolyCurve
Duplicates this polycurve.
This is the same as Rhino.Geometry.PolyCurve.Duplicate.
Returns: An exact duplicate of this curve.
"""
pass
def explode(self):
"""
Explode(self: PolyCurve) -> Array[Curve]
Explodes this PolyCurve into a list of Curve segments. This will not explode nested polycurves.
Call Rhino.Geometry.PolyCurve.RemoveNesting first if you need all individual
segments.
Returns: An array of polycurve segments.
"""
pass
def non_const_operation(self, *args):
"""
NonConstOperation(self: Curve)
For derived classes implementers.
Defines the necessary implementation to free the
instance from being const.
"""
pass
def on_switch_to_non_const(self, *args):
"""
OnSwitchToNonConst(self: GeometryBase)
Is called when a non-const operation occurs.
"""
pass
def poly_curve_parameter(self, segmentIndex, segmentCurveParameter):
"""
PolyCurveParameter(self: PolyCurve,segmentIndex: int,segmentCurveParameter: float) -> float
Converts a segment curve parameter to a polycurve parameter.
segmentIndex: Index of segment.
segmentCurveParameter: Parameter on segment.
Returns: Polycurve evaluation parameter or UnsetValue if the polycurve curve parameter could not be
computed.
"""
pass
def remove_nesting(self):
"""
RemoveNesting(self: PolyCurve) -> bool
Explodes nested polycurve segments and reconstructs this curve from the shattered remains.
The result will have not have any PolyCurves as segments but it will have identical
locus and parameterization.
Returns: true if any nested PolyCurve was found and absorbed,false if no PolyCurve segments could be
found.
"""
pass
def segment_curve(self, index):
"""
SegmentCurve(self: PolyCurve,index: int) -> Curve
Gets the segment curve at the given index.
index: Index of segment to retrieve.
Returns: The segment at the given index or null on failure.
"""
pass
def segment_curve_parameter(self, polycurveParameter):
"""
SegmentCurveParameter(self: PolyCurve,polycurveParameter: float) -> float
Converts a polycurve parameter to a segment curve parameter.
polycurveParameter: Parameter on PolyCurve to convert.
Returns: Segment curve evaluation parameter or UnsetValue if the
segment curve parameter
could not be computed.
"""
pass
def segment_domain(self, segmentIndex):
"""
SegmentDomain(self: PolyCurve,segmentIndex: int) -> Interval
Returns the polycurve subdomain assigned to a segment curve.
segmentIndex: Index of segment.
Returns: The polycurve subdomain assigned to a segment curve.
Returns Interval.Unset if
segment_index < 0 or segment_index >= Count().
"""
pass
def segment_index(self, polycurveParameter):
"""
SegmentIndex(self: PolyCurve,polycurveParameter: float) -> int
Finds the segment used for evaluation at polycurve_parameter.
polycurveParameter: Parameter on polycurve for segment lookup.
Returns: Index of the segment used for evaluation at polycurve_parameter.
If
polycurve_parameter < Domain.Min(),then 0 is returned.
If polycurve_parameter >
Domain.Max(),then Count()-1 is returned.
"""
pass
def segment_indexes(self, subdomain, segmentIndex0, segmentIndex1):
"""
SegmentIndexes(self: PolyCurve,subdomain: Interval) -> (int,int,int)
Finds the segments that overlap the Polycurve sub domain.
subdomain: Domain on this PolyCurve.
Returns: Number of segments that overlap the subdomain.
"""
pass
def __enter__(self, *args):
"""
__enter__(self: IDisposable) -> object
Provides the implementation of __enter__ for objects which implement IDisposable.
"""
pass
def __exit__(self, *args):
"""
__exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object)
Provides the implementation of __exit__ for objects which implement IDisposable.
"""
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self):
"""
__new__(cls: type,info: SerializationInfo,context: StreamingContext)
__new__(cls: type)
"""
pass
def __reduce_ex__(self, *args):
pass
has_gap = property(lambda self: object(), lambda self, v: None, lambda self: None)
'This is a quick way to see if the curve has gaps between the sub curve segments.\n\n\n\nGet: HasGap(self: PolyCurve) -> bool\n\n\n\n'
is_nested = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets a value indicating whether or not a PolyCurve contains nested PolyCurves.\n\n\n\nGet: IsNested(self: PolyCurve) -> bool\n\n\n\n'
segment_count = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Gets the number of segments that make up this Polycurve.\n\n\n\nGet: SegmentCount(self: PolyCurve) -> int\n\n\n\n' |
def tag_skip_and_punct(nlp, name, config):
r''' Detects and tags spacy tokens that are punctuation and that should be skipped.
Args:
nlp (spacy.language.<lng>):
The base spacy NLP pipeline.
name (`str`):
The component instance name.
config (`medcat.config.Config`):
Global config for medcat.
'''
return _Tagger(nlp, name, config)
tag_skip_and_punct.name = "tag_skip_and_punct"
class _Tagger(object):
def __init__(self, nlp, name, config):
self.nlp = nlp
self.name = name
self.config = config
def __call__(self, doc):
# Make life easier
cnf_p = self.config.preprocessing
for token in doc:
if self.config.punct_checker.match(token.lower_) and token.text not in cnf_p['keep_punct']:
# There can't be punct in a token if it also has text
token._.is_punct = True
token._.to_skip = True
elif self.config.word_skipper.match(token.lower_):
# Skip if specific strings
token._.to_skip = True
elif cnf_p['skip_stopwords'] and token.is_stop:
token._.to_skip = True
return doc
| def tag_skip_and_punct(nlp, name, config):
""" Detects and tags spacy tokens that are punctuation and that should be skipped.
Args:
nlp (spacy.language.<lng>):
The base spacy NLP pipeline.
name (`str`):
The component instance name.
config (`medcat.config.Config`):
Global config for medcat.
"""
return __tagger(nlp, name, config)
tag_skip_and_punct.name = 'tag_skip_and_punct'
class _Tagger(object):
def __init__(self, nlp, name, config):
self.nlp = nlp
self.name = name
self.config = config
def __call__(self, doc):
cnf_p = self.config.preprocessing
for token in doc:
if self.config.punct_checker.match(token.lower_) and token.text not in cnf_p['keep_punct']:
token._.is_punct = True
token._.to_skip = True
elif self.config.word_skipper.match(token.lower_):
token._.to_skip = True
elif cnf_p['skip_stopwords'] and token.is_stop:
token._.to_skip = True
return doc |
channel_routing = {
'websocket.receive': 'chat.consumers.ws_message',
'websocket.connect': 'chat.consumers.ws_add',
'websocket.disconnect': 'chat.consumers.ws_disconnect',
'slack.message': 'chat.consumers.slack_message',
}
| channel_routing = {'websocket.receive': 'chat.consumers.ws_message', 'websocket.connect': 'chat.consumers.ws_add', 'websocket.disconnect': 'chat.consumers.ws_disconnect', 'slack.message': 'chat.consumers.slack_message'} |
def power(base, exponent):
assert int(exponent) == exponent and exponent>=0, "exponent must be an integer greater or equal to zero"
if exponent == 0:
return 1
if exponent == 1:
return base
return base * power(base, exponent-1)
print(power(4, 3)) | def power(base, exponent):
assert int(exponent) == exponent and exponent >= 0, 'exponent must be an integer greater or equal to zero'
if exponent == 0:
return 1
if exponent == 1:
return base
return base * power(base, exponent - 1)
print(power(4, 3)) |
class EntangleException(Exception):
"""Entangle exception.
All non-system exceptions raised by Entangle and Entangle definitions must
inherit from :class:`EntangleException`.
:cvar definition: Definition.
:cvar name: Name.
"""
pass
class BadMessageError(EntangleException):
"""Bad message.
"""
definition = 'entangle'
name = 'BadMessage'
class InternalServerError(EntangleException):
"""Internal server error.
"""
definition = 'entangle'
name = 'InternalServerError'
class UnknownMethodError(EntangleException):
"""Unknown method.
"""
definition = 'entangle'
name = 'UnknownMethod'
class InvalidArgumentError(EntangleException):
"""Invalid argument.
"""
definition = 'entangle'
name = 'InvalidArgument'
class UnknownException(EntangleException):
"""Unknown exception.
"""
def __init__(self, definition, name, message):
super(EntangleException, self).__init__(message)
self.definition = definition
self.name = name
class PackingError(EntangleException):
"""Packing error.
"""
definition = 'entangle'
name = 'PackingError'
class DeserializationError(EntangleException):
"""Deserialization error.
"""
definition = 'entangle'
name = 'DeserializationError'
class UnexpectedMessageError(EntangleException):
"""Unexpected message.
"""
definition = 'entangle'
name = 'UnexpectedMessage'
class ConnectionLostError(EntangleException):
"""Connection lost.
"""
definition = 'entangle'
name = 'ConnectionLost'
entangle_exceptions = {
BadMessageError.name: BadMessageError,
InternalServerError.name: InternalServerError,
UnknownMethodError.name: UnknownMethodError,
InvalidArgumentError.name: InvalidArgumentError,
}
"""Entangle exceptions.
"""
def parse_exception(definition, name, message):
"""Parse an exception.
:param definition: Definition.
:param name: Name.
:param message: Message.
:returns:
the parsed exception or :class:`UnknownException` if the exception is
not known.
"""
if definition == 'entangle':
try:
return entangle_exceptions[name](message)
except KeyError:
pass
return UnknownException(definition, name, message)
| class Entangleexception(Exception):
"""Entangle exception.
All non-system exceptions raised by Entangle and Entangle definitions must
inherit from :class:`EntangleException`.
:cvar definition: Definition.
:cvar name: Name.
"""
pass
class Badmessageerror(EntangleException):
"""Bad message.
"""
definition = 'entangle'
name = 'BadMessage'
class Internalservererror(EntangleException):
"""Internal server error.
"""
definition = 'entangle'
name = 'InternalServerError'
class Unknownmethoderror(EntangleException):
"""Unknown method.
"""
definition = 'entangle'
name = 'UnknownMethod'
class Invalidargumenterror(EntangleException):
"""Invalid argument.
"""
definition = 'entangle'
name = 'InvalidArgument'
class Unknownexception(EntangleException):
"""Unknown exception.
"""
def __init__(self, definition, name, message):
super(EntangleException, self).__init__(message)
self.definition = definition
self.name = name
class Packingerror(EntangleException):
"""Packing error.
"""
definition = 'entangle'
name = 'PackingError'
class Deserializationerror(EntangleException):
"""Deserialization error.
"""
definition = 'entangle'
name = 'DeserializationError'
class Unexpectedmessageerror(EntangleException):
"""Unexpected message.
"""
definition = 'entangle'
name = 'UnexpectedMessage'
class Connectionlosterror(EntangleException):
"""Connection lost.
"""
definition = 'entangle'
name = 'ConnectionLost'
entangle_exceptions = {BadMessageError.name: BadMessageError, InternalServerError.name: InternalServerError, UnknownMethodError.name: UnknownMethodError, InvalidArgumentError.name: InvalidArgumentError}
'Entangle exceptions.\n'
def parse_exception(definition, name, message):
"""Parse an exception.
:param definition: Definition.
:param name: Name.
:param message: Message.
:returns:
the parsed exception or :class:`UnknownException` if the exception is
not known.
"""
if definition == 'entangle':
try:
return entangle_exceptions[name](message)
except KeyError:
pass
return unknown_exception(definition, name, message) |
def main():
# input
a = int(input())
b = int(input())
h = int(input())
# compute
# output
print((a+b) * h // 2)
if __name__ == '__main__':
main()
| def main():
a = int(input())
b = int(input())
h = int(input())
print((a + b) * h // 2)
if __name__ == '__main__':
main() |
def Fac(n):
if n == 1:
return n
return n * Fac(n - 1)
def sum_digits(n):
s = 0
while n:
s += n % 10
n //= 10
return s
print(sum_digits(Fac(100))) | def fac(n):
if n == 1:
return n
return n * fac(n - 1)
def sum_digits(n):
s = 0
while n:
s += n % 10
n //= 10
return s
print(sum_digits(fac(100))) |
# Runtime: 258 ms, faster than 43.76% of Python3 online submissions for How Many Numbers Are Smaller Than the Current Number.
# Memory Usage: 14.4 MB, less than 46.01% of Python3 online submissions for How Many Numbers Are Smaller Than the Current Number.
# https://leetcode.com/submissions/detail/591527345/
class Solution:
def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
output_list = list()
for current_number in nums:
count_smaller = 0
for i in nums:
if i < current_number:
count_smaller += 1
output_list.append(count_smaller)
return output_list
| class Solution:
def smaller_numbers_than_current(self, nums: List[int]) -> List[int]:
output_list = list()
for current_number in nums:
count_smaller = 0
for i in nums:
if i < current_number:
count_smaller += 1
output_list.append(count_smaller)
return output_list |
# cook your dish here
for _ in range(int(input())):
n = int(input())
print(int(n/2)+1)
| for _ in range(int(input())):
n = int(input())
print(int(n / 2) + 1) |
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("//bazel_tools:haskell.bzl", "da_haskell_test")
def _damlc_compile_test_impl(ctx):
stack_opt = "-K" + ctx.attr.stack_limit if ctx.attr.stack_limit else ""
heap_opt = "-M" + ctx.attr.heap_limit if ctx.attr.heap_limit else ""
script = """
set -eou pipefail
DAMLC=$(rlocation $TEST_WORKSPACE/{damlc})
MAIN=$(rlocation $TEST_WORKSPACE/{main})
TMP=$(mktemp -d)
function cleanup() {{
rm -rf "$TMP"
}}
trap cleanup EXIT
$DAMLC compile $MAIN -o $TMP/out +RTS -s {stack_opt} {heap_opt}
""".format(
damlc = ctx.executable.damlc.short_path,
main = ctx.files.main[0].short_path,
stack_opt = stack_opt,
heap_opt = heap_opt,
)
ctx.actions.write(
output = ctx.outputs.executable,
content = script,
)
# To ensure the files needed by the script are available, we put them in
# the runfiles.
runfiles = ctx.runfiles(
files =
ctx.files.srcs + ctx.files.main +
[ctx.executable.damlc],
)
return [DefaultInfo(
runfiles = runfiles,
)]
damlc_compile_test = rule(
implementation = _damlc_compile_test_impl,
attrs = {
"srcs": attr.label_list(allow_files = True),
"main": attr.label(allow_files = True),
"damlc": attr.label(
default = Label("//compiler/damlc"),
executable = True,
cfg = "target",
allow_files = True,
),
"stack_limit": attr.string(),
"heap_limit": attr.string(),
},
test = True,
)
def damlc_integration_test(name, main_function):
da_haskell_test(
name = name,
size = "large",
srcs = ["src/DA/Test/DamlcIntegration.hs"],
src_strip_prefix = "src",
main_function = main_function,
data = [
"//compiler/damlc/pkg-db",
"//compiler/damlc/stable-packages",
"//compiler/scenario-service/server:scenario_service_jar",
"@jq_dev_env//:jq",
":daml-test-files",
":bond-trading",
":query-lf-lib",
],
deps = [
"//compiler/daml-lf-ast",
"//compiler/daml-lf-proto",
"//compiler/damlc/daml-compiler",
"//compiler/damlc/daml-ide-core",
"//compiler/damlc/daml-lf-conversion",
"//compiler/damlc/daml-opts:daml-opts-types",
"//compiler/damlc/daml-opts",
"//daml-lf/archive:daml_lf_dev_archive_haskell_proto",
"//libs-haskell/bazel-runfiles",
"//libs-haskell/da-hs-base",
"//libs-haskell/test-utils",
],
hackage_deps = [
"aeson-pretty",
"base",
"bytestring",
"data-default",
"deepseq",
"directory",
"dlist",
"extra",
"filepath",
"ghc-lib",
"ghc-lib-parser",
"ghcide",
"haskell-lsp-types",
"optparse-applicative",
"process",
"proto3-suite",
"shake",
"tagged",
"tasty",
"tasty-hunit",
"text",
"time",
"unordered-containers",
],
visibility = ["//visibility:public"],
)
| load('//bazel_tools:haskell.bzl', 'da_haskell_test')
def _damlc_compile_test_impl(ctx):
stack_opt = '-K' + ctx.attr.stack_limit if ctx.attr.stack_limit else ''
heap_opt = '-M' + ctx.attr.heap_limit if ctx.attr.heap_limit else ''
script = '\n set -eou pipefail\n\n DAMLC=$(rlocation $TEST_WORKSPACE/{damlc})\n MAIN=$(rlocation $TEST_WORKSPACE/{main})\n\n TMP=$(mktemp -d)\n function cleanup() {{\n rm -rf "$TMP"\n }}\n trap cleanup EXIT\n\n $DAMLC compile $MAIN -o $TMP/out +RTS -s {stack_opt} {heap_opt}\n '.format(damlc=ctx.executable.damlc.short_path, main=ctx.files.main[0].short_path, stack_opt=stack_opt, heap_opt=heap_opt)
ctx.actions.write(output=ctx.outputs.executable, content=script)
runfiles = ctx.runfiles(files=ctx.files.srcs + ctx.files.main + [ctx.executable.damlc])
return [default_info(runfiles=runfiles)]
damlc_compile_test = rule(implementation=_damlc_compile_test_impl, attrs={'srcs': attr.label_list(allow_files=True), 'main': attr.label(allow_files=True), 'damlc': attr.label(default=label('//compiler/damlc'), executable=True, cfg='target', allow_files=True), 'stack_limit': attr.string(), 'heap_limit': attr.string()}, test=True)
def damlc_integration_test(name, main_function):
da_haskell_test(name=name, size='large', srcs=['src/DA/Test/DamlcIntegration.hs'], src_strip_prefix='src', main_function=main_function, data=['//compiler/damlc/pkg-db', '//compiler/damlc/stable-packages', '//compiler/scenario-service/server:scenario_service_jar', '@jq_dev_env//:jq', ':daml-test-files', ':bond-trading', ':query-lf-lib'], deps=['//compiler/daml-lf-ast', '//compiler/daml-lf-proto', '//compiler/damlc/daml-compiler', '//compiler/damlc/daml-ide-core', '//compiler/damlc/daml-lf-conversion', '//compiler/damlc/daml-opts:daml-opts-types', '//compiler/damlc/daml-opts', '//daml-lf/archive:daml_lf_dev_archive_haskell_proto', '//libs-haskell/bazel-runfiles', '//libs-haskell/da-hs-base', '//libs-haskell/test-utils'], hackage_deps=['aeson-pretty', 'base', 'bytestring', 'data-default', 'deepseq', 'directory', 'dlist', 'extra', 'filepath', 'ghc-lib', 'ghc-lib-parser', 'ghcide', 'haskell-lsp-types', 'optparse-applicative', 'process', 'proto3-suite', 'shake', 'tagged', 'tasty', 'tasty-hunit', 'text', 'time', 'unordered-containers'], visibility=['//visibility:public']) |
# Idade em Dias
dia=int(input())
print('{} ano(s)'.format(dia//365))
print('{} mes(es)'.format((dia%365)//30))
print('{} dia(s)'.format((dia%365)%30))
| dia = int(input())
print('{} ano(s)'.format(dia // 365))
print('{} mes(es)'.format(dia % 365 // 30))
print('{} dia(s)'.format(dia % 365 % 30)) |
sample_rate = 44100
window_size = 2048 # 1024 # 2048
overlap = 672 # 256 # 672 # So that there are 320 frames in an audio clip
seq_len = 320 # 573 # 320
mel_bins = 64
labels = ['airport', 'bus', 'metro', 'metro_station', 'park', 'public_square',
'shopping_mall', 'street_pedestrian', 'street_traffic', 'tram']
lb_to_ix = {lb: ix for ix, lb in enumerate(labels)}
ix_to_lb = {ix: lb for ix, lb in enumerate(labels)}
labels_domain = ['a', 'b', 'c']
lb_to_ix_domain = {lbd: ixd for ixd, lbd in enumerate(labels_domain)}
ix_to_lb_domain = {ixd: lbd for ixd, lbd in enumerate(labels_domain)}
| sample_rate = 44100
window_size = 2048
overlap = 672
seq_len = 320
mel_bins = 64
labels = ['airport', 'bus', 'metro', 'metro_station', 'park', 'public_square', 'shopping_mall', 'street_pedestrian', 'street_traffic', 'tram']
lb_to_ix = {lb: ix for (ix, lb) in enumerate(labels)}
ix_to_lb = {ix: lb for (ix, lb) in enumerate(labels)}
labels_domain = ['a', 'b', 'c']
lb_to_ix_domain = {lbd: ixd for (ixd, lbd) in enumerate(labels_domain)}
ix_to_lb_domain = {ixd: lbd for (ixd, lbd) in enumerate(labels_domain)} |
class Solution(object):
def checkPossibility(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
if not nums:
return True
l = len(nums)
fixed = False
for i in xrange(l):
if i + 1 < l:
if nums[i] > nums[i + 1]:
if fixed:
return False
if i + 2 >= l or i == 0:
pass
elif nums[i + 1] >= nums[i - 1]:
pass
else:
nums[i + 1] = nums[i]
fixed = True
return True
| class Solution(object):
def check_possibility(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
if not nums:
return True
l = len(nums)
fixed = False
for i in xrange(l):
if i + 1 < l:
if nums[i] > nums[i + 1]:
if fixed:
return False
if i + 2 >= l or i == 0:
pass
elif nums[i + 1] >= nums[i - 1]:
pass
else:
nums[i + 1] = nums[i]
fixed = True
return True |
# alonso = 18
# edad = 0
# for x in range(5):
# edad = edad + 1
# print(alonso + edad)
# # alumnos = [20, 25, 23, 24, 26]
# # for fgh in alumnos:
# # print(fgh)
print(round(3.5))
print(round(4.5))
print(round(5.5))
print(round(80.5))
| print(round(3.5))
print(round(4.5))
print(round(5.5))
print(round(80.5)) |
"""
Definition of the config-related exception types.
"""
################################################################################
# Exception types
class ConfigError(Exception):
"""
Base class for config-related exceptions
"""
pass
class ConfigParsingError(ConfigError):
"""
Exception raised when configuration parsing fails
"""
pass
class ConfigValueError(ConfigError):
"""
Exception raised when configuration contains bad values or is missing values
"""
pass
################################################################################
| """
Definition of the config-related exception types.
"""
class Configerror(Exception):
"""
Base class for config-related exceptions
"""
pass
class Configparsingerror(ConfigError):
"""
Exception raised when configuration parsing fails
"""
pass
class Configvalueerror(ConfigError):
"""
Exception raised when configuration contains bad values or is missing values
"""
pass |
__ACTIVATION__ = 'relu'
__NORM_LAYER__ = 'bn'
def get_default_activation():
global __ACTIVATION__
return __ACTIVATION__
def set_default_activation(name):
global __ACTIVATION__
__ACTIVATION__ = name
def get_default_norm_layer():
global __NORM_LAYER__
return __NORM_LAYER__
def set_default_norm_layer(name):
global __NORM_LAYER__
__NORM_LAYER__ = name
| __activation__ = 'relu'
__norm_layer__ = 'bn'
def get_default_activation():
global __ACTIVATION__
return __ACTIVATION__
def set_default_activation(name):
global __ACTIVATION__
__activation__ = name
def get_default_norm_layer():
global __NORM_LAYER__
return __NORM_LAYER__
def set_default_norm_layer(name):
global __NORM_LAYER__
__norm_layer__ = name |
#
# PySNMP MIB module CISCO-CONFIG-COPY-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/CISCO-CONFIG-COPY-MIB
# Produced by pysmi-0.0.7 at Tue Feb 7 11:41:27 2017
# On host e436de1e4e9d platform Linux version 4.4.0-59-generic by user root
# Using Python version 2.7.13 (default, Dec 22 2016, 09:22:15)
#
( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
( ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint, ValueRangeConstraint, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "ValueRangeConstraint")
( ciscoMgmt, ) = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt")
( FcNameIdOrZero, ) = mibBuilder.importSymbols("CISCO-ST-TC", "FcNameIdOrZero")
( InetAddress, InetAddressType, ) = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType")
( SnmpAdminString, ) = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
( NotificationGroup, ModuleCompliance, ObjectGroup, ) = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup")
( Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, MibIdentifier, Bits, TimeTicks, Counter64, Unsigned32, ModuleIdentity, Gauge32, iso, ObjectIdentity, IpAddress, Counter32, ) = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "MibIdentifier", "Bits", "TimeTicks", "Counter64", "Unsigned32", "ModuleIdentity", "Gauge32", "iso", "ObjectIdentity", "IpAddress", "Counter32")
( DisplayString, TimeStamp, TruthValue, RowStatus, TextualConvention, ) = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TimeStamp", "TruthValue", "RowStatus", "TextualConvention")
ciscoConfigCopyMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 96)).setRevisions(("2005-04-06 00:00", "2004-03-17 00:00", "2002-12-17 00:00", "2002-05-30 00:00", "2002-05-07 00:00", "2002-03-28 00:00",))
class ConfigCopyProtocol(Integer32, TextualConvention):
subtypeSpec = Integer32.subtypeSpec+SingleValueConstraint(1, 2, 3, 4, 5,)
namedValues = NamedValues(("tftp", 1), ("ftp", 2), ("rcp", 3), ("scp", 4), ("sftp", 5),)
class ConfigCopyState(Integer32, TextualConvention):
subtypeSpec = Integer32.subtypeSpec+SingleValueConstraint(1, 2, 3, 4,)
namedValues = NamedValues(("waiting", 1), ("running", 2), ("successful", 3), ("failed", 4),)
class ConfigCopyFailCause(Integer32, TextualConvention):
subtypeSpec = Integer32.subtypeSpec+SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9,)
namedValues = NamedValues(("unknown", 1), ("badFileName", 2), ("timeout", 3), ("noMem", 4), ("noConfig", 5), ("unsupportedProtocol", 6), ("someConfigApplyFailed", 7), ("systemNotReady", 8), ("requestAborted", 9),)
class ConfigFileType(Integer32, TextualConvention):
subtypeSpec = Integer32.subtypeSpec+SingleValueConstraint(1, 2, 3, 4, 5, 6,)
namedValues = NamedValues(("networkFile", 1), ("iosFile", 2), ("startupConfig", 3), ("runningConfig", 4), ("terminal", 5), ("fabricStartupConfig", 6),)
ciscoConfigCopyMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 1))
ccCopy = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1))
ccCopyTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1), )
ccCopyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1), ).setIndexNames((0, "CISCO-CONFIG-COPY-MIB", "ccCopyIndex"))
ccCopyIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1,2147483647)))
ccCopyProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 2), ConfigCopyProtocol().clone('tftp')).setMaxAccess("readcreate")
ccCopySourceFileType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 3), ConfigFileType()).setMaxAccess("readcreate")
ccCopyDestFileType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 4), ConfigFileType()).setMaxAccess("readcreate")
ccCopyServerAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 5), IpAddress()).setMaxAccess("readcreate")
ccCopyFileName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 6), DisplayString()).setMaxAccess("readcreate")
ccCopyUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 7), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1,40))).setMaxAccess("readcreate")
ccCopyUserPassword = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1,40))).setMaxAccess("readcreate")
ccCopyNotificationOnCompletion = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 9), TruthValue().clone('false')).setMaxAccess("readcreate")
ccCopyState = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 10), ConfigCopyState()).setMaxAccess("readonly")
ccCopyTimeStarted = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 11), TimeStamp()).setMaxAccess("readonly")
ccCopyTimeCompleted = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 12), TimeStamp()).setMaxAccess("readonly")
ccCopyFailCause = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 13), ConfigCopyFailCause()).setMaxAccess("readonly")
ccCopyEntryRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 14), RowStatus()).setMaxAccess("readcreate")
ccCopyServerAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 15), InetAddressType()).setMaxAccess("readcreate")
ccCopyServerAddressRev1 = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 16), InetAddress()).setMaxAccess("readcreate")
ccCopyErrorTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2), )
ccCopyErrorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1), ).setIndexNames((0, "CISCO-CONFIG-COPY-MIB", "ccCopyIndex"), (0, "CISCO-CONFIG-COPY-MIB", "ccCopyErrorIndex"))
ccCopyErrorIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 1), Unsigned32())
ccCopyErrorDeviceIpAddressType = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 2), InetAddressType()).setMaxAccess("readonly")
ccCopyErrorDeviceIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 3), InetAddress()).setMaxAccess("readonly")
ccCopyErrorDeviceWWN = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 4), FcNameIdOrZero()).setMaxAccess("readonly")
ccCopyErrorDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 5), SnmpAdminString()).setMaxAccess("readonly")
ciscoConfigCopyMIBTrapPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 2))
ccCopyMIBTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 2, 1))
ccCopyCompletion = NotificationType((1, 3, 6, 1, 4, 1, 9, 9, 96, 2, 1, 1)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyServerAddress"), ("CISCO-CONFIG-COPY-MIB", "ccCopyFileName"), ("CISCO-CONFIG-COPY-MIB", "ccCopyState"), ("CISCO-CONFIG-COPY-MIB", "ccCopyTimeStarted"), ("CISCO-CONFIG-COPY-MIB", "ccCopyTimeCompleted"), ("CISCO-CONFIG-COPY-MIB", "ccCopyFailCause"),))
ciscoConfigCopyMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 3))
ccCopyMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 1))
ccCopyMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2))
ccCopyMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 1, 1)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyGroup"), ("CISCO-CONFIG-COPY-MIB", "ccCopyNotificationsGroup"),))
ccCopyMIBComplianceRev1 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 1, 2)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyGroupRev1"), ("CISCO-CONFIG-COPY-MIB", "ccCopyNotificationsGroup"),))
ccCopyMIBComplianceRev2 = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 1, 3)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyGroupRev1"), ("CISCO-CONFIG-COPY-MIB", "ccCopyNotificationsGroup"), ("CISCO-CONFIG-COPY-MIB", "ccCopyErrorGroup"),))
ccCopyGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2, 1)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyProtocol"), ("CISCO-CONFIG-COPY-MIB", "ccCopySourceFileType"), ("CISCO-CONFIG-COPY-MIB", "ccCopyDestFileType"), ("CISCO-CONFIG-COPY-MIB", "ccCopyServerAddress"), ("CISCO-CONFIG-COPY-MIB", "ccCopyFileName"), ("CISCO-CONFIG-COPY-MIB", "ccCopyUserName"), ("CISCO-CONFIG-COPY-MIB", "ccCopyUserPassword"), ("CISCO-CONFIG-COPY-MIB", "ccCopyNotificationOnCompletion"), ("CISCO-CONFIG-COPY-MIB", "ccCopyState"), ("CISCO-CONFIG-COPY-MIB", "ccCopyTimeStarted"), ("CISCO-CONFIG-COPY-MIB", "ccCopyTimeCompleted"), ("CISCO-CONFIG-COPY-MIB", "ccCopyFailCause"), ("CISCO-CONFIG-COPY-MIB", "ccCopyEntryRowStatus"),))
ccCopyNotificationsGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2, 2)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyCompletion"),))
ccCopyGroupRev1 = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2, 3)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyProtocol"), ("CISCO-CONFIG-COPY-MIB", "ccCopySourceFileType"), ("CISCO-CONFIG-COPY-MIB", "ccCopyDestFileType"), ("CISCO-CONFIG-COPY-MIB", "ccCopyServerAddressType"), ("CISCO-CONFIG-COPY-MIB", "ccCopyServerAddressRev1"), ("CISCO-CONFIG-COPY-MIB", "ccCopyFileName"), ("CISCO-CONFIG-COPY-MIB", "ccCopyUserName"), ("CISCO-CONFIG-COPY-MIB", "ccCopyUserPassword"), ("CISCO-CONFIG-COPY-MIB", "ccCopyNotificationOnCompletion"), ("CISCO-CONFIG-COPY-MIB", "ccCopyState"), ("CISCO-CONFIG-COPY-MIB", "ccCopyTimeStarted"), ("CISCO-CONFIG-COPY-MIB", "ccCopyTimeCompleted"), ("CISCO-CONFIG-COPY-MIB", "ccCopyFailCause"), ("CISCO-CONFIG-COPY-MIB", "ccCopyEntryRowStatus"),))
ccCopyErrorGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2, 4)).setObjects(*(("CISCO-CONFIG-COPY-MIB", "ccCopyErrorDeviceIpAddressType"), ("CISCO-CONFIG-COPY-MIB", "ccCopyErrorDeviceIpAddress"), ("CISCO-CONFIG-COPY-MIB", "ccCopyErrorDeviceWWN"), ("CISCO-CONFIG-COPY-MIB", "ccCopyErrorDescription"),))
mibBuilder.exportSymbols("CISCO-CONFIG-COPY-MIB", ciscoConfigCopyMIBConformance=ciscoConfigCopyMIBConformance, ccCopyMIBGroups=ccCopyMIBGroups, ccCopyServerAddress=ccCopyServerAddress, ccCopyNotificationOnCompletion=ccCopyNotificationOnCompletion, ciscoConfigCopyMIB=ciscoConfigCopyMIB, ccCopyState=ccCopyState, ccCopyDestFileType=ccCopyDestFileType, ccCopySourceFileType=ccCopySourceFileType, ccCopyErrorEntry=ccCopyErrorEntry, ccCopyMIBCompliance=ccCopyMIBCompliance, ccCopyTimeCompleted=ccCopyTimeCompleted, ccCopyErrorDeviceIpAddress=ccCopyErrorDeviceIpAddress, ccCopyEntry=ccCopyEntry, ccCopyErrorDeviceIpAddressType=ccCopyErrorDeviceIpAddressType, PYSNMP_MODULE_ID=ciscoConfigCopyMIB, ccCopyMIBTraps=ccCopyMIBTraps, ccCopyServerAddressType=ccCopyServerAddressType, ccCopyUserPassword=ccCopyUserPassword, ccCopyGroupRev1=ccCopyGroupRev1, ciscoConfigCopyMIBObjects=ciscoConfigCopyMIBObjects, ccCopyMIBCompliances=ccCopyMIBCompliances, ccCopyTable=ccCopyTable, ccCopyErrorDeviceWWN=ccCopyErrorDeviceWWN, ccCopyCompletion=ccCopyCompletion, ciscoConfigCopyMIBTrapPrefix=ciscoConfigCopyMIBTrapPrefix, ccCopyErrorIndex=ccCopyErrorIndex, ccCopyErrorDescription=ccCopyErrorDescription, ccCopyFailCause=ccCopyFailCause, ccCopyUserName=ccCopyUserName, ccCopyTimeStarted=ccCopyTimeStarted, ConfigCopyState=ConfigCopyState, ccCopyNotificationsGroup=ccCopyNotificationsGroup, ConfigCopyFailCause=ConfigCopyFailCause, ccCopyServerAddressRev1=ccCopyServerAddressRev1, ccCopyErrorTable=ccCopyErrorTable, ConfigFileType=ConfigFileType, ccCopyFileName=ccCopyFileName, ConfigCopyProtocol=ConfigCopyProtocol, ccCopyGroup=ccCopyGroup, ccCopyMIBComplianceRev1=ccCopyMIBComplianceRev1, ccCopyEntryRowStatus=ccCopyEntryRowStatus, ccCopyIndex=ccCopyIndex, ccCopyMIBComplianceRev2=ccCopyMIBComplianceRev2, ccCopy=ccCopy, ccCopyErrorGroup=ccCopyErrorGroup, ccCopyProtocol=ccCopyProtocol)
| (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ValueRangeConstraint')
(cisco_mgmt,) = mibBuilder.importSymbols('CISCO-SMI', 'ciscoMgmt')
(fc_name_id_or_zero,) = mibBuilder.importSymbols('CISCO-ST-TC', 'FcNameIdOrZero')
(inet_address, inet_address_type) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddress', 'InetAddressType')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(notification_group, module_compliance, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance', 'ObjectGroup')
(integer32, mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, mib_identifier, bits, time_ticks, counter64, unsigned32, module_identity, gauge32, iso, object_identity, ip_address, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'MibIdentifier', 'Bits', 'TimeTicks', 'Counter64', 'Unsigned32', 'ModuleIdentity', 'Gauge32', 'iso', 'ObjectIdentity', 'IpAddress', 'Counter32')
(display_string, time_stamp, truth_value, row_status, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TimeStamp', 'TruthValue', 'RowStatus', 'TextualConvention')
cisco_config_copy_mib = module_identity((1, 3, 6, 1, 4, 1, 9, 9, 96)).setRevisions(('2005-04-06 00:00', '2004-03-17 00:00', '2002-12-17 00:00', '2002-05-30 00:00', '2002-05-07 00:00', '2002-03-28 00:00'))
class Configcopyprotocol(Integer32, TextualConvention):
subtype_spec = Integer32.subtypeSpec + single_value_constraint(1, 2, 3, 4, 5)
named_values = named_values(('tftp', 1), ('ftp', 2), ('rcp', 3), ('scp', 4), ('sftp', 5))
class Configcopystate(Integer32, TextualConvention):
subtype_spec = Integer32.subtypeSpec + single_value_constraint(1, 2, 3, 4)
named_values = named_values(('waiting', 1), ('running', 2), ('successful', 3), ('failed', 4))
class Configcopyfailcause(Integer32, TextualConvention):
subtype_spec = Integer32.subtypeSpec + single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9)
named_values = named_values(('unknown', 1), ('badFileName', 2), ('timeout', 3), ('noMem', 4), ('noConfig', 5), ('unsupportedProtocol', 6), ('someConfigApplyFailed', 7), ('systemNotReady', 8), ('requestAborted', 9))
class Configfiletype(Integer32, TextualConvention):
subtype_spec = Integer32.subtypeSpec + single_value_constraint(1, 2, 3, 4, 5, 6)
named_values = named_values(('networkFile', 1), ('iosFile', 2), ('startupConfig', 3), ('runningConfig', 4), ('terminal', 5), ('fabricStartupConfig', 6))
cisco_config_copy_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 1))
cc_copy = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1))
cc_copy_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1))
cc_copy_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1)).setIndexNames((0, 'CISCO-CONFIG-COPY-MIB', 'ccCopyIndex'))
cc_copy_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 1), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 2147483647)))
cc_copy_protocol = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 2), config_copy_protocol().clone('tftp')).setMaxAccess('readcreate')
cc_copy_source_file_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 3), config_file_type()).setMaxAccess('readcreate')
cc_copy_dest_file_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 4), config_file_type()).setMaxAccess('readcreate')
cc_copy_server_address = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 5), ip_address()).setMaxAccess('readcreate')
cc_copy_file_name = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 6), display_string()).setMaxAccess('readcreate')
cc_copy_user_name = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 7), display_string().subtype(subtypeSpec=value_size_constraint(1, 40))).setMaxAccess('readcreate')
cc_copy_user_password = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 8), display_string().subtype(subtypeSpec=value_size_constraint(1, 40))).setMaxAccess('readcreate')
cc_copy_notification_on_completion = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 9), truth_value().clone('false')).setMaxAccess('readcreate')
cc_copy_state = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 10), config_copy_state()).setMaxAccess('readonly')
cc_copy_time_started = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 11), time_stamp()).setMaxAccess('readonly')
cc_copy_time_completed = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 12), time_stamp()).setMaxAccess('readonly')
cc_copy_fail_cause = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 13), config_copy_fail_cause()).setMaxAccess('readonly')
cc_copy_entry_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 14), row_status()).setMaxAccess('readcreate')
cc_copy_server_address_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 15), inet_address_type()).setMaxAccess('readcreate')
cc_copy_server_address_rev1 = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 1, 1, 16), inet_address()).setMaxAccess('readcreate')
cc_copy_error_table = mib_table((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2))
cc_copy_error_entry = mib_table_row((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1)).setIndexNames((0, 'CISCO-CONFIG-COPY-MIB', 'ccCopyIndex'), (0, 'CISCO-CONFIG-COPY-MIB', 'ccCopyErrorIndex'))
cc_copy_error_index = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 1), unsigned32())
cc_copy_error_device_ip_address_type = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 2), inet_address_type()).setMaxAccess('readonly')
cc_copy_error_device_ip_address = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 3), inet_address()).setMaxAccess('readonly')
cc_copy_error_device_wwn = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 4), fc_name_id_or_zero()).setMaxAccess('readonly')
cc_copy_error_description = mib_table_column((1, 3, 6, 1, 4, 1, 9, 9, 96, 1, 1, 2, 1, 5), snmp_admin_string()).setMaxAccess('readonly')
cisco_config_copy_mib_trap_prefix = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 2))
cc_copy_mib_traps = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 2, 1))
cc_copy_completion = notification_type((1, 3, 6, 1, 4, 1, 9, 9, 96, 2, 1, 1)).setObjects(*(('CISCO-CONFIG-COPY-MIB', 'ccCopyServerAddress'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyFileName'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyState'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyTimeStarted'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyTimeCompleted'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyFailCause')))
cisco_config_copy_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 3))
cc_copy_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 1))
cc_copy_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2))
cc_copy_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 1, 1)).setObjects(*(('CISCO-CONFIG-COPY-MIB', 'ccCopyGroup'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyNotificationsGroup')))
cc_copy_mib_compliance_rev1 = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 1, 2)).setObjects(*(('CISCO-CONFIG-COPY-MIB', 'ccCopyGroupRev1'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyNotificationsGroup')))
cc_copy_mib_compliance_rev2 = module_compliance((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 1, 3)).setObjects(*(('CISCO-CONFIG-COPY-MIB', 'ccCopyGroupRev1'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyNotificationsGroup'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyErrorGroup')))
cc_copy_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2, 1)).setObjects(*(('CISCO-CONFIG-COPY-MIB', 'ccCopyProtocol'), ('CISCO-CONFIG-COPY-MIB', 'ccCopySourceFileType'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyDestFileType'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyServerAddress'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyFileName'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyUserName'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyUserPassword'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyNotificationOnCompletion'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyState'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyTimeStarted'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyTimeCompleted'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyFailCause'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyEntryRowStatus')))
cc_copy_notifications_group = notification_group((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2, 2)).setObjects(*(('CISCO-CONFIG-COPY-MIB', 'ccCopyCompletion'),))
cc_copy_group_rev1 = object_group((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2, 3)).setObjects(*(('CISCO-CONFIG-COPY-MIB', 'ccCopyProtocol'), ('CISCO-CONFIG-COPY-MIB', 'ccCopySourceFileType'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyDestFileType'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyServerAddressType'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyServerAddressRev1'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyFileName'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyUserName'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyUserPassword'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyNotificationOnCompletion'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyState'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyTimeStarted'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyTimeCompleted'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyFailCause'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyEntryRowStatus')))
cc_copy_error_group = object_group((1, 3, 6, 1, 4, 1, 9, 9, 96, 3, 2, 4)).setObjects(*(('CISCO-CONFIG-COPY-MIB', 'ccCopyErrorDeviceIpAddressType'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyErrorDeviceIpAddress'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyErrorDeviceWWN'), ('CISCO-CONFIG-COPY-MIB', 'ccCopyErrorDescription')))
mibBuilder.exportSymbols('CISCO-CONFIG-COPY-MIB', ciscoConfigCopyMIBConformance=ciscoConfigCopyMIBConformance, ccCopyMIBGroups=ccCopyMIBGroups, ccCopyServerAddress=ccCopyServerAddress, ccCopyNotificationOnCompletion=ccCopyNotificationOnCompletion, ciscoConfigCopyMIB=ciscoConfigCopyMIB, ccCopyState=ccCopyState, ccCopyDestFileType=ccCopyDestFileType, ccCopySourceFileType=ccCopySourceFileType, ccCopyErrorEntry=ccCopyErrorEntry, ccCopyMIBCompliance=ccCopyMIBCompliance, ccCopyTimeCompleted=ccCopyTimeCompleted, ccCopyErrorDeviceIpAddress=ccCopyErrorDeviceIpAddress, ccCopyEntry=ccCopyEntry, ccCopyErrorDeviceIpAddressType=ccCopyErrorDeviceIpAddressType, PYSNMP_MODULE_ID=ciscoConfigCopyMIB, ccCopyMIBTraps=ccCopyMIBTraps, ccCopyServerAddressType=ccCopyServerAddressType, ccCopyUserPassword=ccCopyUserPassword, ccCopyGroupRev1=ccCopyGroupRev1, ciscoConfigCopyMIBObjects=ciscoConfigCopyMIBObjects, ccCopyMIBCompliances=ccCopyMIBCompliances, ccCopyTable=ccCopyTable, ccCopyErrorDeviceWWN=ccCopyErrorDeviceWWN, ccCopyCompletion=ccCopyCompletion, ciscoConfigCopyMIBTrapPrefix=ciscoConfigCopyMIBTrapPrefix, ccCopyErrorIndex=ccCopyErrorIndex, ccCopyErrorDescription=ccCopyErrorDescription, ccCopyFailCause=ccCopyFailCause, ccCopyUserName=ccCopyUserName, ccCopyTimeStarted=ccCopyTimeStarted, ConfigCopyState=ConfigCopyState, ccCopyNotificationsGroup=ccCopyNotificationsGroup, ConfigCopyFailCause=ConfigCopyFailCause, ccCopyServerAddressRev1=ccCopyServerAddressRev1, ccCopyErrorTable=ccCopyErrorTable, ConfigFileType=ConfigFileType, ccCopyFileName=ccCopyFileName, ConfigCopyProtocol=ConfigCopyProtocol, ccCopyGroup=ccCopyGroup, ccCopyMIBComplianceRev1=ccCopyMIBComplianceRev1, ccCopyEntryRowStatus=ccCopyEntryRowStatus, ccCopyIndex=ccCopyIndex, ccCopyMIBComplianceRev2=ccCopyMIBComplianceRev2, ccCopy=ccCopy, ccCopyErrorGroup=ccCopyErrorGroup, ccCopyProtocol=ccCopyProtocol) |
def parse_version(version):
"""Convert version to a tuple.
Tuple will have a form (num1, num2, num3, num4, suffix).
For example:
- 1.1 => (1, 1, 0, 0, "")
- 2.3.4.5 => (2, 3, 4, 5, "")
- 1.0.1-open => (1, 0, 1, 0, "open")
- 1.0.1-beta.12 => (1, 0, 1, 12, "beta")
"""
lversion = version.split(".")
l = len(lversion)
if l > 4 or l == 0:
fail("Invalid version:", version)
suffix = ""
for i in range(l):
if not lversion[i].isdigit():
if suffix != "":
fail("Version suffix already defined:", version)
s = lversion[i].partition("-")
if s[2] == "":
fail("Invalid version segment:", version)
if not s[0].isdigit():
fail("Not a digit in a version:", version)
lversion[i] = int(s[0])
suffix = s[2]
else:
lversion[i] = int(lversion[i])
if l == 4:
return (lversion[0], lversion[1], lversion[2], lversion[3], suffix)
elif l == 3:
return (lversion[0], lversion[1], lversion[2], 0, suffix)
elif l == 2:
return (lversion[0], lversion[1], 0, 0, suffix)
elif l == 1:
return (lversion[0], 0, 0, 0, suffix)
else:
fail("Unreachable")
def test_parse_version():
a = parse_version("1.1")
if a != (1, 1, 0, 0, ""):
print("Unexpected result:", a)
fail("test 1 failed")
a = parse_version("2.3.4.5")
if a != (2, 3, 4, 5, ""):
print("Unexpected result:", a)
fail("test 2 failed")
a = parse_version("1.0.1-open")
if a != (1, 0, 1, 0, "open"):
print("Unexpected result:", a)
fail("test 3 failed")
a = parse_version("1.0.1-beta.12")
if a != (1, 0, 1, 12, "beta"):
print("Unexpected result:", a)
fail("test 4 failed")
def version2string(tversion):
""" Converts version tuple to string """
s = ""
if tversion[3] != 0:
s = "{}.{}.{}.{}".format(tversion[0], tversion[1], tversion[2], tversion[3])
elif tversion[2] != 0:
s = "{}.{}.{}".format(tversion[0], tversion[1], tversion[2])
else:
s = "{}.{}".format(tversion[0], tversion[1])
if tversion[4] != "":
s = s + "-" + tversion[4]
return s
def test_version2string():
a = "1.1"
b = parse_version(a)
c = version2string(b)
if c != a:
print("Unexpected result:", c)
fail("test 1 failed")
a = "2.3.4.5"
b = parse_version(a)
c = version2string(b)
if c != a:
print("Unexpected result:", c)
fail("test 1 failed")
a = "1.0.1-open"
b = parse_version(a)
c = version2string(b)
if c != a:
print("Unexpected result:", c)
fail("test 1 failed")
a = "1.0.1-beta.12"
b = parse_version(a)
c = version2string(b)
if c != "1.0.1.12-beta":
print("Unexpected result:", c)
fail("test 1 failed")
a = "1.0"
b = parse_version(a)
c = version2string(b)
if c != a:
print("Unexpected result:", c)
fail("test 1 failed")
a = "1.2.3"
b = parse_version(a)
c = version2string(b)
if c != a:
print("Unexpected result:", c)
fail("test 1 failed")
def compare_versions(tversion1, tversion2):
for i in range(4):
if tversion1[i] > tversion2[i]:
return 1
if tversion1[i] < tversion2[i]:
return -1
if tversion1[4] == "":
if tversion2[4] == "":
return 0
return 1
if tversion2[4] == "":
if tversion1[4] == "":
return 0
return -1
if tversion1[4] > tversion2[4]:
return 1
if tversion1[4] < tversion2[4]:
return -1
return 0
def test_compare_versions():
z = [["1.1", "1.1", 0], ["1.1", "1.2", -1], ["1.2", "1.1", 1], ["1.1.1", "1.1", 1], ["1.1", "1.1.1", -1], ["1.1.2.4", "1.1.2.3-beta", 1], ["1.1.2.3", "1.1.2.3-beta", 1]]
for k in z:
c = parse_version(k[0])
d = parse_version(k[1])
v = compare_versions(c, d)
if v != k[2]:
print("Unexpected result {} {} = {} (expected {})".format(k[0], k[1], v, k[2]))
fail("test failed")
| def parse_version(version):
"""Convert version to a tuple.
Tuple will have a form (num1, num2, num3, num4, suffix).
For example:
- 1.1 => (1, 1, 0, 0, "")
- 2.3.4.5 => (2, 3, 4, 5, "")
- 1.0.1-open => (1, 0, 1, 0, "open")
- 1.0.1-beta.12 => (1, 0, 1, 12, "beta")
"""
lversion = version.split('.')
l = len(lversion)
if l > 4 or l == 0:
fail('Invalid version:', version)
suffix = ''
for i in range(l):
if not lversion[i].isdigit():
if suffix != '':
fail('Version suffix already defined:', version)
s = lversion[i].partition('-')
if s[2] == '':
fail('Invalid version segment:', version)
if not s[0].isdigit():
fail('Not a digit in a version:', version)
lversion[i] = int(s[0])
suffix = s[2]
else:
lversion[i] = int(lversion[i])
if l == 4:
return (lversion[0], lversion[1], lversion[2], lversion[3], suffix)
elif l == 3:
return (lversion[0], lversion[1], lversion[2], 0, suffix)
elif l == 2:
return (lversion[0], lversion[1], 0, 0, suffix)
elif l == 1:
return (lversion[0], 0, 0, 0, suffix)
else:
fail('Unreachable')
def test_parse_version():
a = parse_version('1.1')
if a != (1, 1, 0, 0, ''):
print('Unexpected result:', a)
fail('test 1 failed')
a = parse_version('2.3.4.5')
if a != (2, 3, 4, 5, ''):
print('Unexpected result:', a)
fail('test 2 failed')
a = parse_version('1.0.1-open')
if a != (1, 0, 1, 0, 'open'):
print('Unexpected result:', a)
fail('test 3 failed')
a = parse_version('1.0.1-beta.12')
if a != (1, 0, 1, 12, 'beta'):
print('Unexpected result:', a)
fail('test 4 failed')
def version2string(tversion):
""" Converts version tuple to string """
s = ''
if tversion[3] != 0:
s = '{}.{}.{}.{}'.format(tversion[0], tversion[1], tversion[2], tversion[3])
elif tversion[2] != 0:
s = '{}.{}.{}'.format(tversion[0], tversion[1], tversion[2])
else:
s = '{}.{}'.format(tversion[0], tversion[1])
if tversion[4] != '':
s = s + '-' + tversion[4]
return s
def test_version2string():
a = '1.1'
b = parse_version(a)
c = version2string(b)
if c != a:
print('Unexpected result:', c)
fail('test 1 failed')
a = '2.3.4.5'
b = parse_version(a)
c = version2string(b)
if c != a:
print('Unexpected result:', c)
fail('test 1 failed')
a = '1.0.1-open'
b = parse_version(a)
c = version2string(b)
if c != a:
print('Unexpected result:', c)
fail('test 1 failed')
a = '1.0.1-beta.12'
b = parse_version(a)
c = version2string(b)
if c != '1.0.1.12-beta':
print('Unexpected result:', c)
fail('test 1 failed')
a = '1.0'
b = parse_version(a)
c = version2string(b)
if c != a:
print('Unexpected result:', c)
fail('test 1 failed')
a = '1.2.3'
b = parse_version(a)
c = version2string(b)
if c != a:
print('Unexpected result:', c)
fail('test 1 failed')
def compare_versions(tversion1, tversion2):
for i in range(4):
if tversion1[i] > tversion2[i]:
return 1
if tversion1[i] < tversion2[i]:
return -1
if tversion1[4] == '':
if tversion2[4] == '':
return 0
return 1
if tversion2[4] == '':
if tversion1[4] == '':
return 0
return -1
if tversion1[4] > tversion2[4]:
return 1
if tversion1[4] < tversion2[4]:
return -1
return 0
def test_compare_versions():
z = [['1.1', '1.1', 0], ['1.1', '1.2', -1], ['1.2', '1.1', 1], ['1.1.1', '1.1', 1], ['1.1', '1.1.1', -1], ['1.1.2.4', '1.1.2.3-beta', 1], ['1.1.2.3', '1.1.2.3-beta', 1]]
for k in z:
c = parse_version(k[0])
d = parse_version(k[1])
v = compare_versions(c, d)
if v != k[2]:
print('Unexpected result {} {} = {} (expected {})'.format(k[0], k[1], v, k[2]))
fail('test failed') |
params = {
'contacts_csv': 'CUSTOMERCONTACTS.csv',
'shipments_csv': 'CUSTOMERSHIPMENTS.csv',
'packingslips_csv': 'PACKINGSLIPS.csv',
'log_file': 'logfile.txt',
'BigVendor_code': 2758,
'dlr_email_template_file': 'Dealer_email.html',
'BigVendor_email_template_file': 'BigVendor_email.html',
# Credentials created via http://www.ups.com/upsdeveloperkit
'ups_access_license': "AAAAAAAAAAAAAAA",
'ups_userid': "xxxxxx",
'ups_password': "xxxxxxx",
# Used only for creating the link for an email recipient
'ups_web_root': "http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=",
'gmail_userid': 'xxxxxxxx',
'gmail_password': 'xxxxxxxxx',
# gmail password is specified with "--password xxxx" command line option.
# This must be set to something that will never appear in a real email,
# because we're doublechecking before sending them to make sure
# this text isn't in the email to send.
'text_placeholder_if_info_missing': '<font color="red">[MISSING]</font>',
'email_from_name': "[My Company] Shipping",
'email_subject_line_jd': "Your [Big Vendor] direct order with [My Company] has shipped",
'email_subject_line_non_jd': "Your order with [My Company] has shipped",
#(need to build in an additional parameter if there will be different subject lines
# for JD vs. non-JD orders.)
'email_from_name_for_internal_notes': "Shipping notification records",
'email_address_for_company_records': "xxxx@xxxx.com",
'email_address_for_contact_info_updating': "xxxx@xxxx.com",
# The 'simulated_emails' option causes the emailer to create HTML files in the
# working directory containing the email example, instead of actually sending
# anything to any email address. Overrides the "testing mode" below.
'simulated_emails': False,
# The 'email_in_testing_mode' option allows email addresses found in the
# customer contacts sheet to be replaced by these testing addresses.
# This has no effect if "simulated_emails" is True.
'email_in_testing_mode': False,
'test_email_recipient_as_customer': "xxxx@xxxx.com",
'test_email_recipient_as_records': "xxxx@xxxx.com",
'test_email_recipient_as_contactupdating': "xxxx@xxxx.com",
}
item_column_labels = {
'part': 'Part No.',
'description': 'Description',
'quantity': 'Qty'
}
shipments_heading = {
'name': 'Name',
'cust_id': 'Customer',
'BigVendor_shortchar_lookup': 'ShortChar01',
}
pslips_heading = {
'slip_id': 'Packing Slip',
'cust_id': 'Customer', # program uses only the right-most "Customer" value
'order_id': 'Order',
'BigVendor_dns_number': 'Reference 4',
'BigVendor_shortchar_id': 'Reference 5',
'addr_name': 'Name',
'addr_line1': "Address",
'addr_line2': "Address2",
'addr_line3': "Address3",
'addr_city': 'City',
'addr_state': 'State/Province',
'addr_pcode': 'Postal Code',
'shipvia': 'Ship Via',
'tracknum': 'Tracking Number',
'description': 'Rev Description',
'partcode': 'Part',
'quantity': 'Qty',
}
contacts_heading = {
'cust_id': 'Customer',
'name': 'Name',
'email': 'EMail Address',
}
mail_fieldtags = {
'greeting_name': 'putncdealernamehere',
'dns': 'putdnshere', # ["Big Vendor"] orders only
'fso': 'putfsohere',
'date': 'putdatehere',
'tracknum': 'placetrackingnumberhere',
'a_name': 'putnamehere',
'a_address': 'putaddresshere',
'a_citysz': 'putcityszhere',
'itemtable': 'puttablehere',
} | params = {'contacts_csv': 'CUSTOMERCONTACTS.csv', 'shipments_csv': 'CUSTOMERSHIPMENTS.csv', 'packingslips_csv': 'PACKINGSLIPS.csv', 'log_file': 'logfile.txt', 'BigVendor_code': 2758, 'dlr_email_template_file': 'Dealer_email.html', 'BigVendor_email_template_file': 'BigVendor_email.html', 'ups_access_license': 'AAAAAAAAAAAAAAA', 'ups_userid': 'xxxxxx', 'ups_password': 'xxxxxxx', 'ups_web_root': 'http://wwwapps.ups.com/WebTracking/track?track=yes&trackNums=', 'gmail_userid': 'xxxxxxxx', 'gmail_password': 'xxxxxxxxx', 'text_placeholder_if_info_missing': '<font color="red">[MISSING]</font>', 'email_from_name': '[My Company] Shipping', 'email_subject_line_jd': 'Your [Big Vendor] direct order with [My Company] has shipped', 'email_subject_line_non_jd': 'Your order with [My Company] has shipped', 'email_from_name_for_internal_notes': 'Shipping notification records', 'email_address_for_company_records': 'xxxx@xxxx.com', 'email_address_for_contact_info_updating': 'xxxx@xxxx.com', 'simulated_emails': False, 'email_in_testing_mode': False, 'test_email_recipient_as_customer': 'xxxx@xxxx.com', 'test_email_recipient_as_records': 'xxxx@xxxx.com', 'test_email_recipient_as_contactupdating': 'xxxx@xxxx.com'}
item_column_labels = {'part': 'Part No.', 'description': 'Description', 'quantity': 'Qty'}
shipments_heading = {'name': 'Name', 'cust_id': 'Customer', 'BigVendor_shortchar_lookup': 'ShortChar01'}
pslips_heading = {'slip_id': 'Packing Slip', 'cust_id': 'Customer', 'order_id': 'Order', 'BigVendor_dns_number': 'Reference 4', 'BigVendor_shortchar_id': 'Reference 5', 'addr_name': 'Name', 'addr_line1': 'Address', 'addr_line2': 'Address2', 'addr_line3': 'Address3', 'addr_city': 'City', 'addr_state': 'State/Province', 'addr_pcode': 'Postal Code', 'shipvia': 'Ship Via', 'tracknum': 'Tracking Number', 'description': 'Rev Description', 'partcode': 'Part', 'quantity': 'Qty'}
contacts_heading = {'cust_id': 'Customer', 'name': 'Name', 'email': 'EMail Address'}
mail_fieldtags = {'greeting_name': 'putncdealernamehere', 'dns': 'putdnshere', 'fso': 'putfsohere', 'date': 'putdatehere', 'tracknum': 'placetrackingnumberhere', 'a_name': 'putnamehere', 'a_address': 'putaddresshere', 'a_citysz': 'putcityszhere', 'itemtable': 'puttablehere'} |
#
# PySNMP MIB module RADLAN-DHCPv6-RELAY (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-DHCPv6-RELAY
# Produced by pysmi-0.3.4 at Mon Apr 29 20:37:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint")
InetAddressIPv6, InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressIPv6", "InetAddressType", "InetAddress")
rlDhcpv6Relay, = mibBuilder.importSymbols("RADLAN-DHCPv6", "rlDhcpv6Relay")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Counter64, IpAddress, Integer32, TimeTicks, Counter32, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, MibIdentifier, ModuleIdentity, Gauge32, Bits, iso, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "IpAddress", "Integer32", "TimeTicks", "Counter32", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "MibIdentifier", "ModuleIdentity", "Gauge32", "Bits", "iso", "ObjectIdentity")
DisplayString, RowStatus, MacAddress, TextualConvention, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "MacAddress", "TextualConvention", "TruthValue")
rlDhcpv6RelayInterfaceListTable = MibTable((1, 3, 6, 1, 4, 1, 89, 214, 3, 1), )
if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceListTable.setStatus('current')
rlDhcpv6RelayInterfaceListEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 214, 3, 1, 1), ).setIndexNames((0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayInterfaceListIfIndex"))
if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceListEntry.setStatus('current')
rlDhcpv6RelayInterfaceListIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 1, 1, 1), Unsigned32())
if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceListIfIndex.setStatus('current')
rlDhcpv6RelayInterfaceListRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 1, 1, 2), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceListRowStatus.setStatus('current')
rlDhcpv6RelayDestinationsGlobalTable = MibTable((1, 3, 6, 1, 4, 1, 89, 214, 3, 2), )
if mibBuilder.loadTexts: rlDhcpv6RelayDestinationsGlobalTable.setStatus('current')
rlDhcpv6RelayDestinationsGlobalEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1), ).setIndexNames((0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayDestinationsGlobalIpv6AddrType"), (0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayDestinationsGlobalIpv6Addr"), (0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayDestinationsGlobalOutputInterface"))
if mibBuilder.loadTexts: rlDhcpv6RelayDestinationsGlobalEntry.setStatus('current')
rlDhcpv6RelayDestinationsGlobalIpv6AddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1, 1), InetAddressType())
if mibBuilder.loadTexts: rlDhcpv6RelayDestinationsGlobalIpv6AddrType.setStatus('current')
rlDhcpv6RelayDestinationsGlobalIpv6Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1, 2), InetAddress())
if mibBuilder.loadTexts: rlDhcpv6RelayDestinationsGlobalIpv6Addr.setStatus('current')
rlDhcpv6RelayDestinationsGlobalOutputInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1, 3), Unsigned32())
if mibBuilder.loadTexts: rlDhcpv6RelayDestinationsGlobalOutputInterface.setStatus('current')
rlDhcpv6RelayDestinationsGlobalRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1, 4), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpv6RelayDestinationsGlobalRowStatus.setStatus('current')
rlDhcpv6RelayInterfaceDestinationsTable = MibTable((1, 3, 6, 1, 4, 1, 89, 214, 3, 3), )
if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsTable.setStatus('current')
rlDhcpv6RelayInterfaceDestinationsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1), ).setIndexNames((0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayInterfaceDestinationsIfindex"), (0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayInterfaceDestinationsIpv6AddrType"), (0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayInterfaceDestinationsIpv6Addr"), (0, "RADLAN-DHCPv6-RELAY", "rlDhcpv6RelayInterfaceDestinationsOutputInterface"))
if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsEntry.setStatus('current')
rlDhcpv6RelayInterfaceDestinationsIfindex = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 1), Unsigned32())
if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsIfindex.setStatus('current')
rlDhcpv6RelayInterfaceDestinationsIpv6AddrType = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 2), InetAddressType())
if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsIpv6AddrType.setStatus('current')
rlDhcpv6RelayInterfaceDestinationsIpv6Addr = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 3), InetAddress())
if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsIpv6Addr.setStatus('current')
rlDhcpv6RelayInterfaceDestinationsOutputInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 4), Unsigned32())
if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsOutputInterface.setStatus('current')
rlDhcpv6RelayInterfaceDestinationsRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 5), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rlDhcpv6RelayInterfaceDestinationsRowStatus.setStatus('current')
mibBuilder.exportSymbols("RADLAN-DHCPv6-RELAY", rlDhcpv6RelayInterfaceDestinationsEntry=rlDhcpv6RelayInterfaceDestinationsEntry, rlDhcpv6RelayInterfaceDestinationsOutputInterface=rlDhcpv6RelayInterfaceDestinationsOutputInterface, rlDhcpv6RelayInterfaceDestinationsRowStatus=rlDhcpv6RelayInterfaceDestinationsRowStatus, rlDhcpv6RelayInterfaceListTable=rlDhcpv6RelayInterfaceListTable, rlDhcpv6RelayDestinationsGlobalOutputInterface=rlDhcpv6RelayDestinationsGlobalOutputInterface, rlDhcpv6RelayInterfaceListIfIndex=rlDhcpv6RelayInterfaceListIfIndex, rlDhcpv6RelayDestinationsGlobalIpv6AddrType=rlDhcpv6RelayDestinationsGlobalIpv6AddrType, rlDhcpv6RelayInterfaceDestinationsIfindex=rlDhcpv6RelayInterfaceDestinationsIfindex, rlDhcpv6RelayInterfaceDestinationsIpv6AddrType=rlDhcpv6RelayInterfaceDestinationsIpv6AddrType, rlDhcpv6RelayDestinationsGlobalIpv6Addr=rlDhcpv6RelayDestinationsGlobalIpv6Addr, rlDhcpv6RelayDestinationsGlobalRowStatus=rlDhcpv6RelayDestinationsGlobalRowStatus, rlDhcpv6RelayInterfaceDestinationsTable=rlDhcpv6RelayInterfaceDestinationsTable, rlDhcpv6RelayInterfaceDestinationsIpv6Addr=rlDhcpv6RelayInterfaceDestinationsIpv6Addr, rlDhcpv6RelayDestinationsGlobalEntry=rlDhcpv6RelayDestinationsGlobalEntry, rlDhcpv6RelayInterfaceListEntry=rlDhcpv6RelayInterfaceListEntry, rlDhcpv6RelayDestinationsGlobalTable=rlDhcpv6RelayDestinationsGlobalTable, rlDhcpv6RelayInterfaceListRowStatus=rlDhcpv6RelayInterfaceListRowStatus)
| (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, constraints_union, constraints_intersection, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'SingleValueConstraint')
(inet_address_i_pv6, inet_address_type, inet_address) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddressIPv6', 'InetAddressType', 'InetAddress')
(rl_dhcpv6_relay,) = mibBuilder.importSymbols('RADLAN-DHCPv6', 'rlDhcpv6Relay')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(counter64, ip_address, integer32, time_ticks, counter32, unsigned32, mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, mib_identifier, module_identity, gauge32, bits, iso, object_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'IpAddress', 'Integer32', 'TimeTicks', 'Counter32', 'Unsigned32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'MibIdentifier', 'ModuleIdentity', 'Gauge32', 'Bits', 'iso', 'ObjectIdentity')
(display_string, row_status, mac_address, textual_convention, truth_value) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'RowStatus', 'MacAddress', 'TextualConvention', 'TruthValue')
rl_dhcpv6_relay_interface_list_table = mib_table((1, 3, 6, 1, 4, 1, 89, 214, 3, 1))
if mibBuilder.loadTexts:
rlDhcpv6RelayInterfaceListTable.setStatus('current')
rl_dhcpv6_relay_interface_list_entry = mib_table_row((1, 3, 6, 1, 4, 1, 89, 214, 3, 1, 1)).setIndexNames((0, 'RADLAN-DHCPv6-RELAY', 'rlDhcpv6RelayInterfaceListIfIndex'))
if mibBuilder.loadTexts:
rlDhcpv6RelayInterfaceListEntry.setStatus('current')
rl_dhcpv6_relay_interface_list_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 89, 214, 3, 1, 1, 1), unsigned32())
if mibBuilder.loadTexts:
rlDhcpv6RelayInterfaceListIfIndex.setStatus('current')
rl_dhcpv6_relay_interface_list_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 89, 214, 3, 1, 1, 2), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlDhcpv6RelayInterfaceListRowStatus.setStatus('current')
rl_dhcpv6_relay_destinations_global_table = mib_table((1, 3, 6, 1, 4, 1, 89, 214, 3, 2))
if mibBuilder.loadTexts:
rlDhcpv6RelayDestinationsGlobalTable.setStatus('current')
rl_dhcpv6_relay_destinations_global_entry = mib_table_row((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1)).setIndexNames((0, 'RADLAN-DHCPv6-RELAY', 'rlDhcpv6RelayDestinationsGlobalIpv6AddrType'), (0, 'RADLAN-DHCPv6-RELAY', 'rlDhcpv6RelayDestinationsGlobalIpv6Addr'), (0, 'RADLAN-DHCPv6-RELAY', 'rlDhcpv6RelayDestinationsGlobalOutputInterface'))
if mibBuilder.loadTexts:
rlDhcpv6RelayDestinationsGlobalEntry.setStatus('current')
rl_dhcpv6_relay_destinations_global_ipv6_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1, 1), inet_address_type())
if mibBuilder.loadTexts:
rlDhcpv6RelayDestinationsGlobalIpv6AddrType.setStatus('current')
rl_dhcpv6_relay_destinations_global_ipv6_addr = mib_table_column((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1, 2), inet_address())
if mibBuilder.loadTexts:
rlDhcpv6RelayDestinationsGlobalIpv6Addr.setStatus('current')
rl_dhcpv6_relay_destinations_global_output_interface = mib_table_column((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1, 3), unsigned32())
if mibBuilder.loadTexts:
rlDhcpv6RelayDestinationsGlobalOutputInterface.setStatus('current')
rl_dhcpv6_relay_destinations_global_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 89, 214, 3, 2, 1, 4), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlDhcpv6RelayDestinationsGlobalRowStatus.setStatus('current')
rl_dhcpv6_relay_interface_destinations_table = mib_table((1, 3, 6, 1, 4, 1, 89, 214, 3, 3))
if mibBuilder.loadTexts:
rlDhcpv6RelayInterfaceDestinationsTable.setStatus('current')
rl_dhcpv6_relay_interface_destinations_entry = mib_table_row((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1)).setIndexNames((0, 'RADLAN-DHCPv6-RELAY', 'rlDhcpv6RelayInterfaceDestinationsIfindex'), (0, 'RADLAN-DHCPv6-RELAY', 'rlDhcpv6RelayInterfaceDestinationsIpv6AddrType'), (0, 'RADLAN-DHCPv6-RELAY', 'rlDhcpv6RelayInterfaceDestinationsIpv6Addr'), (0, 'RADLAN-DHCPv6-RELAY', 'rlDhcpv6RelayInterfaceDestinationsOutputInterface'))
if mibBuilder.loadTexts:
rlDhcpv6RelayInterfaceDestinationsEntry.setStatus('current')
rl_dhcpv6_relay_interface_destinations_ifindex = mib_table_column((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 1), unsigned32())
if mibBuilder.loadTexts:
rlDhcpv6RelayInterfaceDestinationsIfindex.setStatus('current')
rl_dhcpv6_relay_interface_destinations_ipv6_addr_type = mib_table_column((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 2), inet_address_type())
if mibBuilder.loadTexts:
rlDhcpv6RelayInterfaceDestinationsIpv6AddrType.setStatus('current')
rl_dhcpv6_relay_interface_destinations_ipv6_addr = mib_table_column((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 3), inet_address())
if mibBuilder.loadTexts:
rlDhcpv6RelayInterfaceDestinationsIpv6Addr.setStatus('current')
rl_dhcpv6_relay_interface_destinations_output_interface = mib_table_column((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 4), unsigned32())
if mibBuilder.loadTexts:
rlDhcpv6RelayInterfaceDestinationsOutputInterface.setStatus('current')
rl_dhcpv6_relay_interface_destinations_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 89, 214, 3, 3, 1, 5), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rlDhcpv6RelayInterfaceDestinationsRowStatus.setStatus('current')
mibBuilder.exportSymbols('RADLAN-DHCPv6-RELAY', rlDhcpv6RelayInterfaceDestinationsEntry=rlDhcpv6RelayInterfaceDestinationsEntry, rlDhcpv6RelayInterfaceDestinationsOutputInterface=rlDhcpv6RelayInterfaceDestinationsOutputInterface, rlDhcpv6RelayInterfaceDestinationsRowStatus=rlDhcpv6RelayInterfaceDestinationsRowStatus, rlDhcpv6RelayInterfaceListTable=rlDhcpv6RelayInterfaceListTable, rlDhcpv6RelayDestinationsGlobalOutputInterface=rlDhcpv6RelayDestinationsGlobalOutputInterface, rlDhcpv6RelayInterfaceListIfIndex=rlDhcpv6RelayInterfaceListIfIndex, rlDhcpv6RelayDestinationsGlobalIpv6AddrType=rlDhcpv6RelayDestinationsGlobalIpv6AddrType, rlDhcpv6RelayInterfaceDestinationsIfindex=rlDhcpv6RelayInterfaceDestinationsIfindex, rlDhcpv6RelayInterfaceDestinationsIpv6AddrType=rlDhcpv6RelayInterfaceDestinationsIpv6AddrType, rlDhcpv6RelayDestinationsGlobalIpv6Addr=rlDhcpv6RelayDestinationsGlobalIpv6Addr, rlDhcpv6RelayDestinationsGlobalRowStatus=rlDhcpv6RelayDestinationsGlobalRowStatus, rlDhcpv6RelayInterfaceDestinationsTable=rlDhcpv6RelayInterfaceDestinationsTable, rlDhcpv6RelayInterfaceDestinationsIpv6Addr=rlDhcpv6RelayInterfaceDestinationsIpv6Addr, rlDhcpv6RelayDestinationsGlobalEntry=rlDhcpv6RelayDestinationsGlobalEntry, rlDhcpv6RelayInterfaceListEntry=rlDhcpv6RelayInterfaceListEntry, rlDhcpv6RelayDestinationsGlobalTable=rlDhcpv6RelayDestinationsGlobalTable, rlDhcpv6RelayInterfaceListRowStatus=rlDhcpv6RelayInterfaceListRowStatus) |
class FlaskAWSCognitoError(Exception):
pass
class TokenVerifyError(Exception):
pass
| class Flaskawscognitoerror(Exception):
pass
class Tokenverifyerror(Exception):
pass |
# find numbers n such that n and n^2 have same digit sum
def sum_digit(i):
"""Die Funktion berechnet die Quersumme von i."""
summe = 0
for digit in str(i):
summe += int(digit)
return summe
def check_same_digit(m, exponent):
"""Die Funktion checkt, welche Zahlen von 0 bis m die gleiche Quersumme wie ihre Quadratzahlen haben."""
i = 0
while i <= m:
if sum_digit(i) == sum_digit(i**exponent):
numbers.append(i)
else:
pass
i += 1
numbers = []
check_same_digit(1000, 2)
print(numbers)
| def sum_digit(i):
"""Die Funktion berechnet die Quersumme von i."""
summe = 0
for digit in str(i):
summe += int(digit)
return summe
def check_same_digit(m, exponent):
"""Die Funktion checkt, welche Zahlen von 0 bis m die gleiche Quersumme wie ihre Quadratzahlen haben."""
i = 0
while i <= m:
if sum_digit(i) == sum_digit(i ** exponent):
numbers.append(i)
else:
pass
i += 1
numbers = []
check_same_digit(1000, 2)
print(numbers) |
class Queue:
def __init__(self):
self.front = None
self.rear = None
def enqueue(self,value):
new_node = value
if self.rear:
self.rear.next = new_node
self.rear = new_node
else:
self.front = new_node
self.rear = new_node
def dequeue(self):
try:
if self.front:
temp = self.front
self.front = self.front.next
return temp.value
else:
raise Exception('Empty Queue')
except:
return 'Empty Queue'
def peek(self):
try:
if self.front:
return self.front.value
else:
raise Exception('Empty Queue')
except:
return 'Empty Queue'
def isEmpty(self):
if self.front:
return False
elif not self.front:
return True
class Node:
def __init__(self,value):
self.value = value
self.next = None
self.left = None
self.right = None
class BinaryTree:
def __init__(self):
self.root = None
def pre_order(self):
output=[]
def _walk(node):
output.append(node.value)
if node.left:
_walk(node.left)
if node.right:
_walk(node.right)
_walk(self.root)
return output
def in_order(self):
output=[]
def _walk(node):
if node.left:
_walk(node.left)
output.append(node.value)
if node.right:
_walk(node.right)
_walk(self.root)
return output
def post_order(self):
output=[]
def _walk(node):
if node.left:
_walk(node.left)
if node.right:
_walk(node.right)
output.append(node.value)
_walk(self.root)
return output
def breadth_first(self):
if self.root:
output=[]
q = Queue()
q.enqueue(self.root)
while q.front != None:
current = q.front
if current.left:
q.enqueue(current.left)
if current.right:
q.enqueue(current.right)
output.append(current.value)
q.dequeue()
return output
else:
return 'Empty Tree'
def find_maximum_value(self):
self.max=self.root.value
def _walk(node):
if node.value > self.max:
self.max =node.value
if node.left:
_walk(node.left)
if node.right:
_walk(node.right)
_walk(self.root)
return self.max
class BinarySearchTree(BinaryTree):
def add(self, value):
if not self.root:
self.root = Node(value)
else:
def _walk(node):
if value < node.value:
if not node.left:
node.left = Node(value)
return
else:
_walk(node.left)
else:
if not node.right:
node.right = Node(value)
return
else:
_walk(node.right)
_walk(self.root)
def contains(self,value):
if self.root:
current = self.root
def _walk(current):
if value == current.value:
return True
elif value < current.value:
current = current.left
if current:
return _walk(current)
elif value > current.value:
current = current.right
if current:
return _walk(current)
if _walk(current) == True:
return True
else:
return False
else:
return False
def fizz_buzz_tree(tree):
new_tree = tree
if new_tree.root != None:
def _walk(node):
if node.value%3==0 and node.value%5==0:
node.value = 'FizzBuzz'
elif node.value%3==0:
node.value = 'Fizz'
elif node.value%5==0:
node.value = 'Buzz'
elif node.value%3!=0 and node.value%5!=0:
node.value = str(node.value)
if node.left:
_walk(node.left)
if node.right:
_walk(node.right)
_walk(new_tree.root)
return new_tree
else:
new_tree.root =Node('Tree is Empty')
return new_tree
if __name__ == "__main__":
bt = BinaryTree()
bt.root = Node(4)
bt.root.right = Node(9)
bt.root.left = Node(15)
bt.root.right.left = Node(6)
bt.root.left.left = Node(3)
bt.root.left.right = Node(5)
print(bt.find_maximum_value())
print(fizz_buzz_tree(bt).breadth_first())
| class Queue:
def __init__(self):
self.front = None
self.rear = None
def enqueue(self, value):
new_node = value
if self.rear:
self.rear.next = new_node
self.rear = new_node
else:
self.front = new_node
self.rear = new_node
def dequeue(self):
try:
if self.front:
temp = self.front
self.front = self.front.next
return temp.value
else:
raise exception('Empty Queue')
except:
return 'Empty Queue'
def peek(self):
try:
if self.front:
return self.front.value
else:
raise exception('Empty Queue')
except:
return 'Empty Queue'
def is_empty(self):
if self.front:
return False
elif not self.front:
return True
class Node:
def __init__(self, value):
self.value = value
self.next = None
self.left = None
self.right = None
class Binarytree:
def __init__(self):
self.root = None
def pre_order(self):
output = []
def _walk(node):
output.append(node.value)
if node.left:
_walk(node.left)
if node.right:
_walk(node.right)
_walk(self.root)
return output
def in_order(self):
output = []
def _walk(node):
if node.left:
_walk(node.left)
output.append(node.value)
if node.right:
_walk(node.right)
_walk(self.root)
return output
def post_order(self):
output = []
def _walk(node):
if node.left:
_walk(node.left)
if node.right:
_walk(node.right)
output.append(node.value)
_walk(self.root)
return output
def breadth_first(self):
if self.root:
output = []
q = queue()
q.enqueue(self.root)
while q.front != None:
current = q.front
if current.left:
q.enqueue(current.left)
if current.right:
q.enqueue(current.right)
output.append(current.value)
q.dequeue()
return output
else:
return 'Empty Tree'
def find_maximum_value(self):
self.max = self.root.value
def _walk(node):
if node.value > self.max:
self.max = node.value
if node.left:
_walk(node.left)
if node.right:
_walk(node.right)
_walk(self.root)
return self.max
class Binarysearchtree(BinaryTree):
def add(self, value):
if not self.root:
self.root = node(value)
else:
def _walk(node):
if value < node.value:
if not node.left:
node.left = node(value)
return
else:
_walk(node.left)
elif not node.right:
node.right = node(value)
return
else:
_walk(node.right)
_walk(self.root)
def contains(self, value):
if self.root:
current = self.root
def _walk(current):
if value == current.value:
return True
elif value < current.value:
current = current.left
if current:
return _walk(current)
elif value > current.value:
current = current.right
if current:
return _walk(current)
if _walk(current) == True:
return True
else:
return False
else:
return False
def fizz_buzz_tree(tree):
new_tree = tree
if new_tree.root != None:
def _walk(node):
if node.value % 3 == 0 and node.value % 5 == 0:
node.value = 'FizzBuzz'
elif node.value % 3 == 0:
node.value = 'Fizz'
elif node.value % 5 == 0:
node.value = 'Buzz'
elif node.value % 3 != 0 and node.value % 5 != 0:
node.value = str(node.value)
if node.left:
_walk(node.left)
if node.right:
_walk(node.right)
_walk(new_tree.root)
return new_tree
else:
new_tree.root = node('Tree is Empty')
return new_tree
if __name__ == '__main__':
bt = binary_tree()
bt.root = node(4)
bt.root.right = node(9)
bt.root.left = node(15)
bt.root.right.left = node(6)
bt.root.left.left = node(3)
bt.root.left.right = node(5)
print(bt.find_maximum_value())
print(fizz_buzz_tree(bt).breadth_first()) |
class db_connection_issue(Exception):
pass
| class Db_Connection_Issue(Exception):
pass |
# copyright by Adam Celej
class Zamowienie:
def __init__(self, id_zamowienia, id_zamawiajacego, id_przedmiotu):
self.id_zamowienia = id_zamowienia
self.id_zamawiajacego = id_zamawiajacego
self.id_przedmiotu = id_przedmiotu
self.lista_zamowien = []
def __del__(self):
print("Zamowienie zostalo anulowane")
| class Zamowienie:
def __init__(self, id_zamowienia, id_zamawiajacego, id_przedmiotu):
self.id_zamowienia = id_zamowienia
self.id_zamawiajacego = id_zamawiajacego
self.id_przedmiotu = id_przedmiotu
self.lista_zamowien = []
def __del__(self):
print('Zamowienie zostalo anulowane') |
GRAY, BLACK = 0, 1
def top_sort_recursive(graph):
""" Time complexity is the same as DFS, which is O(V + E)
Space complexity: O(V)
"""
order, enter, state = [], set(graph), {}
def dfs(node):
state[node] = GRAY
#print(node)
for k in graph.get(node, ()):
sk = state.get(k, None)
if sk == GRAY:
raise ValueError("cycle")
if sk == BLACK:
continue
enter.discard(k)
dfs(k)
order.append(node)
state[node] = BLACK
while enter: dfs(enter.pop())
return order
def top_sort(graph):
""" Time complexity is the same as DFS, which is O(V + E)
Space complexity: O(V)
"""
order, enter, state = [], set(graph), {}
def is_ready(node):
lst = graph.get(node, ())
if len(lst) == 0:
return True
for k in lst:
sk = state.get(k, None)
if sk == GRAY:
raise ValueError("cycle")
if sk != BLACK:
return False
return True
while enter:
node = enter.pop()
stack = []
while True:
state[node] = GRAY
stack.append(node)
for k in graph.get(node, ()):
sk = state.get(k, None)
if sk == GRAY:
raise ValueError("cycle")
if sk == BLACK:
continue
enter.discard(k)
stack.append(k)
while stack and is_ready(stack[-1]):
node = stack.pop()
order.append(node)
state[node] = BLACK
if len(stack) == 0:
break
node = stack.pop()
return order
| (gray, black) = (0, 1)
def top_sort_recursive(graph):
""" Time complexity is the same as DFS, which is O(V + E)
Space complexity: O(V)
"""
(order, enter, state) = ([], set(graph), {})
def dfs(node):
state[node] = GRAY
for k in graph.get(node, ()):
sk = state.get(k, None)
if sk == GRAY:
raise value_error('cycle')
if sk == BLACK:
continue
enter.discard(k)
dfs(k)
order.append(node)
state[node] = BLACK
while enter:
dfs(enter.pop())
return order
def top_sort(graph):
""" Time complexity is the same as DFS, which is O(V + E)
Space complexity: O(V)
"""
(order, enter, state) = ([], set(graph), {})
def is_ready(node):
lst = graph.get(node, ())
if len(lst) == 0:
return True
for k in lst:
sk = state.get(k, None)
if sk == GRAY:
raise value_error('cycle')
if sk != BLACK:
return False
return True
while enter:
node = enter.pop()
stack = []
while True:
state[node] = GRAY
stack.append(node)
for k in graph.get(node, ()):
sk = state.get(k, None)
if sk == GRAY:
raise value_error('cycle')
if sk == BLACK:
continue
enter.discard(k)
stack.append(k)
while stack and is_ready(stack[-1]):
node = stack.pop()
order.append(node)
state[node] = BLACK
if len(stack) == 0:
break
node = stack.pop()
return order |
# -*- coding: utf-8 -*-
class Match:
score = []
opcionset = {"1st": 0, "2nd": 1, "3rd": 2, "4th": 3, "5th": 4}
def __init__(self, player1, player2, pacted_sets):
self.p1 = player1
self.p2 = player2
self.pacted_sets = pacted_sets
self.textoganador = ""
self.wonp1 = 0
self.wonp2 = 0
del self.score[:]
self.score.append("0-0")
self.ganadorinicial = "none"
def score_set(self):
self.ganador()
return "{0} | {1}".format(self.textoganador, self.listascoreset())
def iniciarganador(self, playerwon):
if self.ganadorinicial == "none":
self.ganadorinicial = playerwon
def listascoreset(self):
listascore = ""
inicio = 0
for index in self.score:
if inicio == 0:
listascore = index
inicio += 1
else:
listascore = listascore + ", " + index
return listascore
def ordenarscoreganador(self, playerwon, scorej1, scorej2):
self.iniciarganador(playerwon)
if self.ganadorinicial == playerwon:
return scorej1 + "-" + scorej2
else:
return scorej2 + "-" + scorej1
def save_set_won(self, player):
if(player == self.p1):
self.wonp1 += 1
else:
self.wonp2 += 1
def save_score_set(self, scorej1, scorej2, numberset, playerwon):
if(numberset == "1st"):
self.score[0] = self.ordenarscoreganador(
playerwon, scorej1, scorej2)
else:
self.score.insert(self.opcionset.get(
numberset), self.ordenarscoreganador(playerwon, scorej1, scorej2))
def ganador(self):
numeroaum = 1
if int(self.pacted_sets) == 5:
numeroaum = 2
if((self.wonp1 + numeroaum) == int(self.pacted_sets)):
self.textoganador = self.p1 + " defeated " + self.p2
elif ((self.wonp2 + numeroaum) == int(self.pacted_sets)):
self.textoganador = self.p2 + " defeated " + self.p1
else:
self.textoganador = self.p1 + " plays with " + self.p2
| class Match:
score = []
opcionset = {'1st': 0, '2nd': 1, '3rd': 2, '4th': 3, '5th': 4}
def __init__(self, player1, player2, pacted_sets):
self.p1 = player1
self.p2 = player2
self.pacted_sets = pacted_sets
self.textoganador = ''
self.wonp1 = 0
self.wonp2 = 0
del self.score[:]
self.score.append('0-0')
self.ganadorinicial = 'none'
def score_set(self):
self.ganador()
return '{0} | {1}'.format(self.textoganador, self.listascoreset())
def iniciarganador(self, playerwon):
if self.ganadorinicial == 'none':
self.ganadorinicial = playerwon
def listascoreset(self):
listascore = ''
inicio = 0
for index in self.score:
if inicio == 0:
listascore = index
inicio += 1
else:
listascore = listascore + ', ' + index
return listascore
def ordenarscoreganador(self, playerwon, scorej1, scorej2):
self.iniciarganador(playerwon)
if self.ganadorinicial == playerwon:
return scorej1 + '-' + scorej2
else:
return scorej2 + '-' + scorej1
def save_set_won(self, player):
if player == self.p1:
self.wonp1 += 1
else:
self.wonp2 += 1
def save_score_set(self, scorej1, scorej2, numberset, playerwon):
if numberset == '1st':
self.score[0] = self.ordenarscoreganador(playerwon, scorej1, scorej2)
else:
self.score.insert(self.opcionset.get(numberset), self.ordenarscoreganador(playerwon, scorej1, scorej2))
def ganador(self):
numeroaum = 1
if int(self.pacted_sets) == 5:
numeroaum = 2
if self.wonp1 + numeroaum == int(self.pacted_sets):
self.textoganador = self.p1 + ' defeated ' + self.p2
elif self.wonp2 + numeroaum == int(self.pacted_sets):
self.textoganador = self.p2 + ' defeated ' + self.p1
else:
self.textoganador = self.p1 + ' plays with ' + self.p2 |
# Copyright 2021 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Definition of java_library rule.
"""
load(":common/java/java_common.bzl", "JAVA_COMMON_DEP")
load(":common/rule_util.bzl", "create_rule")
load(":common/java/java_semantics.bzl", "semantics")
load(":common/java/proguard_validation.bzl", "VALIDATE_PROGUARD_SPECS")
JavaInfo = _builtins.toplevel.JavaInfo
JavaPluginInfo = _builtins.toplevel.JavaPluginInfo
CcInfo = _builtins.toplevel.CcInfo
def _java_library_rule_impl(ctx):
if not ctx.attr.srcs and ctx.attr.deps:
fail("deps not allowed without srcs; move to runtime_deps?")
semantics.check_rule(ctx)
semantics.check_dependency_rule_kinds(ctx)
extra_resources = semantics.preprocess(ctx)
base_info = JAVA_COMMON_DEP.call(ctx, extra_resources = extra_resources, output_prefix = "lib")
proguard_specs_provider = VALIDATE_PROGUARD_SPECS.call(ctx)
base_info.output_groups["_hidden_top_level_INTERNAL_"] = proguard_specs_provider.specs
base_info.extra_providers.append(proguard_specs_provider)
java_info = semantics.postprocess(ctx, base_info)
return [
base_info.default_info,
java_info,
base_info.instrumented_files_info,
OutputGroupInfo(**base_info.output_groups),
] + base_info.extra_providers
java_library = create_rule(
_java_library_rule_impl,
attrs = dict(
{
"licenses": attr.license() if hasattr(attr, "license") else attr.string_list(),
},
**dict(
semantics.EXTRA_ATTRIBUTES,
**({
"classjar": attr.output(),
"sourcejar": attr.output(),
} if semantics.EXPERIMENTAL_USE_OUTPUTATTR_IN_JAVALIBRARY else {})
)
),
deps = [JAVA_COMMON_DEP, VALIDATE_PROGUARD_SPECS] + semantics.EXTRA_DEPS,
provides = [JavaInfo],
outputs = {} if semantics.EXPERIMENTAL_USE_FILEGROUPS_IN_JAVALIBRARY or semantics.EXPERIMENTAL_USE_OUTPUTATTR_IN_JAVALIBRARY else {
"classjar": "lib%{name}.jar",
"sourcejar": "lib%{name}-src.jar",
},
compile_one_filetype = ".java",
)
| """
Definition of java_library rule.
"""
load(':common/java/java_common.bzl', 'JAVA_COMMON_DEP')
load(':common/rule_util.bzl', 'create_rule')
load(':common/java/java_semantics.bzl', 'semantics')
load(':common/java/proguard_validation.bzl', 'VALIDATE_PROGUARD_SPECS')
java_info = _builtins.toplevel.JavaInfo
java_plugin_info = _builtins.toplevel.JavaPluginInfo
cc_info = _builtins.toplevel.CcInfo
def _java_library_rule_impl(ctx):
if not ctx.attr.srcs and ctx.attr.deps:
fail('deps not allowed without srcs; move to runtime_deps?')
semantics.check_rule(ctx)
semantics.check_dependency_rule_kinds(ctx)
extra_resources = semantics.preprocess(ctx)
base_info = JAVA_COMMON_DEP.call(ctx, extra_resources=extra_resources, output_prefix='lib')
proguard_specs_provider = VALIDATE_PROGUARD_SPECS.call(ctx)
base_info.output_groups['_hidden_top_level_INTERNAL_'] = proguard_specs_provider.specs
base_info.extra_providers.append(proguard_specs_provider)
java_info = semantics.postprocess(ctx, base_info)
return [base_info.default_info, java_info, base_info.instrumented_files_info, output_group_info(**base_info.output_groups)] + base_info.extra_providers
java_library = create_rule(_java_library_rule_impl, attrs=dict({'licenses': attr.license() if hasattr(attr, 'license') else attr.string_list()}, **dict(semantics.EXTRA_ATTRIBUTES, **{'classjar': attr.output(), 'sourcejar': attr.output()} if semantics.EXPERIMENTAL_USE_OUTPUTATTR_IN_JAVALIBRARY else {})), deps=[JAVA_COMMON_DEP, VALIDATE_PROGUARD_SPECS] + semantics.EXTRA_DEPS, provides=[JavaInfo], outputs={} if semantics.EXPERIMENTAL_USE_FILEGROUPS_IN_JAVALIBRARY or semantics.EXPERIMENTAL_USE_OUTPUTATTR_IN_JAVALIBRARY else {'classjar': 'lib%{name}.jar', 'sourcejar': 'lib%{name}-src.jar'}, compile_one_filetype='.java') |
"""**************************************************************************
Author : Rohit Kumar | r.k2962002@gmail.com | https://rohitkumar.ml
Domain : Python Language | May Long Challenge 2021 (CodeChef)
Programs : Golf (LKDNGOLF)
URL : https://www.codechef.com/MAY21C/problems/LKDNGOLF/
**************************************************************************"""
for t in range(int(input())):
n, x, k = map(int, input().split())
if x%k == 0:
print("YES")
elif (n+1-x)%k == 0:
print("YES")
else:
print("NO")
"""**************************************************************************"""
| """**************************************************************************
Author : Rohit Kumar | r.k2962002@gmail.com | https://rohitkumar.ml
Domain : Python Language | May Long Challenge 2021 (CodeChef)
Programs : Golf (LKDNGOLF)
URL : https://www.codechef.com/MAY21C/problems/LKDNGOLF/
**************************************************************************"""
for t in range(int(input())):
(n, x, k) = map(int, input().split())
if x % k == 0:
print('YES')
elif (n + 1 - x) % k == 0:
print('YES')
else:
print('NO')
'**************************************************************************' |
#!/usr/bin/env python3
def day5(filename):
with open("input.txt", "r") as rd:
data = rd.readlines()
nice = [s for s in data if nice_string(s)]
print("Step 1:", len(nice))
def nice_string(string):
vowels = "aeiou"
forbidden = ("ab", "cd", "pq", "xy")
if len([l for l in string if l in vowels]) < 3:
return False
for x in range(len(string)-1):
if string[x] == string[x+1]:
break
else:
return False
for x in forbidden:
if x in string:
return False
return True
if __name__ == "__main__":
assert nice_string("ugknbfddgicrmopn")
assert nice_string("aaa")
assert not nice_string("jchzalrnumimnmhp")
assert not nice_string("haegwjzuvuyypxyu")
assert not nice_string("dvszwmarrgswjxmb")
day5("input.txt")
| def day5(filename):
with open('input.txt', 'r') as rd:
data = rd.readlines()
nice = [s for s in data if nice_string(s)]
print('Step 1:', len(nice))
def nice_string(string):
vowels = 'aeiou'
forbidden = ('ab', 'cd', 'pq', 'xy')
if len([l for l in string if l in vowels]) < 3:
return False
for x in range(len(string) - 1):
if string[x] == string[x + 1]:
break
else:
return False
for x in forbidden:
if x in string:
return False
return True
if __name__ == '__main__':
assert nice_string('ugknbfddgicrmopn')
assert nice_string('aaa')
assert not nice_string('jchzalrnumimnmhp')
assert not nice_string('haegwjzuvuyypxyu')
assert not nice_string('dvszwmarrgswjxmb')
day5('input.txt') |
#!usr/bin/env python3
# python provides a way for specifying function parameters using keywords.
# we can define a function that takes positional arguments along with keyword
# arguments that take optional values. Then, when you want to call the
# function, you can specify values by position or by keyword.
# sometimes we want to enforce calling a function by specifying parameters by
# keyword, since it can improve the readability of the code and can make it
# safer in case the parameter has a significant effect on how the program runs.
# This way, the function caller is aware of the significance of the parameter
# and others who read the code can easily see and understand what's happening.
# To accomplish this we can separate the positional arguments with a single
# asterisk character followed by parameters that are keyword-only.
# if we really need to make sure that someone using a particular function
# clearly understands what they're doing and why they're doing it, we can use
# keyword-only arguments to help ensure clarity in the code.
# use keyword-only arguments to help ensure code clarity
def my_function(arg1, arg2, *, suppress_exceptions=False):
print(arg1, arg2, suppress_exceptions)
def my_function2(*, arg1, arg2):
print(arg1, arg2)
def main():
# if we try to call the function without the keyword we'll get
# "TypeError: my_function() takes 2 positional arguments but 3 were given"
# my_function(1, 2, True)
my_function(1, 2, suppress_exceptions=True)
my_function(arg2=1, arg1=2, suppress_exceptions=True)
# my_function2(1,2) # will throw
# TypeError: my_function2() takes 0 positional arguments but 2 were given
my_function2(arg1=1, arg2=2)
if __name__ == "__main__":
main()
# CONSOLE OUTPUT:
# 1 2 True
# 2 1 True
# 1 2
| def my_function(arg1, arg2, *, suppress_exceptions=False):
print(arg1, arg2, suppress_exceptions)
def my_function2(*, arg1, arg2):
print(arg1, arg2)
def main():
my_function(1, 2, suppress_exceptions=True)
my_function(arg2=1, arg1=2, suppress_exceptions=True)
my_function2(arg1=1, arg2=2)
if __name__ == '__main__':
main() |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool:
if not p and not q:
return True
elif (p and not q) or (not p and q):
return False
else:
stack=[(p, q)]
while(stack):
cur_p, cur_q = stack.pop(0)
if cur_p.val!=cur_q.val:
return False
if cur_p.left and cur_q.left:
stack.append((cur_p.left, cur_q.left))
if cur_p.right and cur_q.right:
stack.append((cur_p.right, cur_q.right))
if (cur_p.left and not cur_q.left) or (not cur_p.left and cur_q.left):
return False
if (cur_p.right and not cur_q.right) or (not cur_p.right and cur_q.right):
return False
return True | class Solution:
def is_same_tree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool:
if not p and (not q):
return True
elif p and (not q) or (not p and q):
return False
else:
stack = [(p, q)]
while stack:
(cur_p, cur_q) = stack.pop(0)
if cur_p.val != cur_q.val:
return False
if cur_p.left and cur_q.left:
stack.append((cur_p.left, cur_q.left))
if cur_p.right and cur_q.right:
stack.append((cur_p.right, cur_q.right))
if cur_p.left and (not cur_q.left) or (not cur_p.left and cur_q.left):
return False
if cur_p.right and (not cur_q.right) or (not cur_p.right and cur_q.right):
return False
return True |
# !/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Copyright 2020 Tianshu AI Platform. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================
"""
delayTaskLua = """
local element = redis.call('zscore', KEYS[1],ARGV[1])
if element then
redis.call('zadd',KEYS[1],ARGV[2],ARGV[1])
end
""" | """
Copyright 2020 Tianshu AI Platform. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================
"""
delay_task_lua = "\nlocal element = redis.call('zscore', KEYS[1],ARGV[1])\nif element then\nredis.call('zadd',KEYS[1],ARGV[2],ARGV[1])\nend\n" |
class PeekPointers(GenericCommand):
"""Command to help find pointers belonging to other memory regions helpful in case
of OOB Read when looking for specific pointers"""
_cmdline_ = "peek-pointers"
_syntax_ = "{:s} starting_address <object_name> <all>".format(_cmdline_)
@only_if_gdb_running
def do_invoke(self, argv):
argc = len(argv)
if argc not in (1, 2, 3):
self.usage()
return
addr = lookup_address(int(argv[0], 16))
if (addr.value % DEFAULT_PAGE_SIZE):
err("<starting_address> must be aligned to a page")
return
unique = True if "all" not in argv else False
vmmap = get_process_maps()
if argc >= 2 :
section_name = argv[1].lower()
if section_name == "stack":
sections = [(s.path, s.page_start, s.page_end) for s in vmmap if s.path == "[stack]"]
elif section_name == "heap":
sections = [(s.path, s.page_start, s.page_end) for s in vmmap if s.path == "[heap]"]
elif section_name != "all":
sections = [ (s.path, s.page_start, s.page_end) for s in vmmap if section_name in s.path ]
else:
sections = [ (s.path, s.page_start, s.page_end) for s in vmmap ]
else:
sections = [ (s.path, s.page_start, s.page_end) for s in vmmap ]
while addr.valid:
addr_value = read_int_from_memory(addr.value)
if lookup_address(addr_value):
for i, section in enumerate(sections):
name, start_addr, end_addr = section
if start_addr <= addr_value < end_addr:
sym = gdb_get_location_from_symbol(addr_value)
sym = "<{:s}+{:04x}>".format(*sym) if sym else ''
if name.startswith("/"):
name = os.path.basename(name)
elif len(name)==0:
name = get_filename()
ok(" Found pointer at 0x{:x} to 0x{:x} {:s} ('{:s}', perm: {:s})".format(addr.value, addr_value, sym, name, str(addr.section.permission), ))
if unique:
del sections[i]
break
addr = lookup_address(addr.value + current_arch.ptrsize)
return
if __name__ == "__main__":
register_external_command(PeekPointers())
| class Peekpointers(GenericCommand):
"""Command to help find pointers belonging to other memory regions helpful in case
of OOB Read when looking for specific pointers"""
_cmdline_ = 'peek-pointers'
_syntax_ = '{:s} starting_address <object_name> <all>'.format(_cmdline_)
@only_if_gdb_running
def do_invoke(self, argv):
argc = len(argv)
if argc not in (1, 2, 3):
self.usage()
return
addr = lookup_address(int(argv[0], 16))
if addr.value % DEFAULT_PAGE_SIZE:
err('<starting_address> must be aligned to a page')
return
unique = True if 'all' not in argv else False
vmmap = get_process_maps()
if argc >= 2:
section_name = argv[1].lower()
if section_name == 'stack':
sections = [(s.path, s.page_start, s.page_end) for s in vmmap if s.path == '[stack]']
elif section_name == 'heap':
sections = [(s.path, s.page_start, s.page_end) for s in vmmap if s.path == '[heap]']
elif section_name != 'all':
sections = [(s.path, s.page_start, s.page_end) for s in vmmap if section_name in s.path]
else:
sections = [(s.path, s.page_start, s.page_end) for s in vmmap]
else:
sections = [(s.path, s.page_start, s.page_end) for s in vmmap]
while addr.valid:
addr_value = read_int_from_memory(addr.value)
if lookup_address(addr_value):
for (i, section) in enumerate(sections):
(name, start_addr, end_addr) = section
if start_addr <= addr_value < end_addr:
sym = gdb_get_location_from_symbol(addr_value)
sym = '<{:s}+{:04x}>'.format(*sym) if sym else ''
if name.startswith('/'):
name = os.path.basename(name)
elif len(name) == 0:
name = get_filename()
ok(" Found pointer at 0x{:x} to 0x{:x} {:s} ('{:s}', perm: {:s})".format(addr.value, addr_value, sym, name, str(addr.section.permission)))
if unique:
del sections[i]
break
addr = lookup_address(addr.value + current_arch.ptrsize)
return
if __name__ == '__main__':
register_external_command(peek_pointers()) |
"""Miscellaneous utilities"""
def get_remote_addr(req):
"""
Returns the remote IP address of a user
"""
return req.environ.get('HTTP_X_REAL_IP', req.remote_addr)
def object_access_allowed(groups, path):
"""
Decide if a user is allowed to access a path
"""
for group in groups.split(','):
if path.startswith(group):
return True
return False
| """Miscellaneous utilities"""
def get_remote_addr(req):
"""
Returns the remote IP address of a user
"""
return req.environ.get('HTTP_X_REAL_IP', req.remote_addr)
def object_access_allowed(groups, path):
"""
Decide if a user is allowed to access a path
"""
for group in groups.split(','):
if path.startswith(group):
return True
return False |
# The function for selection sort
def SelectionSort(list):
for i in range (0,len(list)):
elem=list[i]
pos=i
for j in range(i+1,len(list)):
if list[j]>=elem:
elem=list[j]
pos=j
list[i], list[pos] = list[pos], list[i]
return list
def HybridSort(nlist):
# If the length of the list is less than or equal to 4, then sort using selection sort
if len(nlist)<=4:
nlist=SelectionSort(nlist)
# Otherwise sort using merge sort, unless the list is of length 1
if len(nlist)>1 and len(nlist)>4:
# Find the middle of the list
mid = len(nlist)//2
# Use this to create two lists
lefthalf = nlist[:mid]
righthalf = nlist[mid:]
HybridSort(lefthalf)
HybridSort(righthalf)
# Merging
i=j=k=0
# While the lists are not exhausted
while i < len(lefthalf) and j < len(righthalf):
# If the left half first index is greater than right half, add it to the output list
if lefthalf[i] >= righthalf[j]:
nlist[k]=lefthalf[i]
# Increment the value of i so that the element would not be added multiple times
i=i+1
else:
# Other wise the right half first index is larger, so add that
nlist[k]=righthalf[j]
# And again increment the index
j=j+1
# Increment k to jump to the next index in nlist
k=k+1
# If the loop has broken out to here then one of the lists is empty
# Loop adding all the remaining elements of the lefthalf list, if it is empty then just move on
while i < len(lefthalf):
nlist[k]=lefthalf[i]
i=i+1
k=k+1
# Loop adding all the remaining elements of the righthalf list, again, if it is empty then just move on
while j < len(righthalf):
nlist[k]=righthalf[j]
j=j+1
k=k+1
| def selection_sort(list):
for i in range(0, len(list)):
elem = list[i]
pos = i
for j in range(i + 1, len(list)):
if list[j] >= elem:
elem = list[j]
pos = j
(list[i], list[pos]) = (list[pos], list[i])
return list
def hybrid_sort(nlist):
if len(nlist) <= 4:
nlist = selection_sort(nlist)
if len(nlist) > 1 and len(nlist) > 4:
mid = len(nlist) // 2
lefthalf = nlist[:mid]
righthalf = nlist[mid:]
hybrid_sort(lefthalf)
hybrid_sort(righthalf)
i = j = k = 0
while i < len(lefthalf) and j < len(righthalf):
if lefthalf[i] >= righthalf[j]:
nlist[k] = lefthalf[i]
i = i + 1
else:
nlist[k] = righthalf[j]
j = j + 1
k = k + 1
while i < len(lefthalf):
nlist[k] = lefthalf[i]
i = i + 1
k = k + 1
while j < len(righthalf):
nlist[k] = righthalf[j]
j = j + 1
k = k + 1 |
'''
Python module to hold DNS processing exceptions
'''
class SWAN_DNS_Exception(Exception):
'''
General SWAN DNS exception
'''
pass
class SWAN_StopProcessingRequest(SWAN_DNS_Exception):
'''
An exception which indicates to stop the processing of a dns request.
This shuld be thrown from a dns processing modules in order to specify that
processing is no longer needed and an answer should be returned to the sender
'''
pass
class SWAN_UnkownInetFamily(SWAN_DNS_Exception):
'''
An exception which indicate that the server was started with unkown inet_family value
'''
pass
class SWAN_SkipProcessing(SWAN_DNS_Exception):
'''
An exception which indicates that a module processing should be skipped.
'''
pass
class SWAN_ModuleConfigurationError(SWAN_DNS_Exception):
'''
An exception which indicates that a module configuration is invalid
'''
pass
class SWAN_ModuleLoadError(SWAN_DNS_Exception):
'''
An exception which indicate that there was a problem loading a module
'''
pass
class SWAN_NoSuchZoneError(SWAN_DNS_Exception):
'''
An exception which indicate that a dns server can not resolve a specific zone.
'''
pass
class SWAN_DropAnswer(SWAN_DNS_Exception):
'''
An exception which indicates to drop the response and not provide answers to the client
'''
pass
class SWAN_ConfigurationError(SWAN_DNS_Exception):
'''
An exception which indicates that loading the configuration of a server is not valid
'''
pass
| """
Python module to hold DNS processing exceptions
"""
class Swan_Dns_Exception(Exception):
"""
General SWAN DNS exception
"""
pass
class Swan_Stopprocessingrequest(SWAN_DNS_Exception):
"""
An exception which indicates to stop the processing of a dns request.
This shuld be thrown from a dns processing modules in order to specify that
processing is no longer needed and an answer should be returned to the sender
"""
pass
class Swan_Unkowninetfamily(SWAN_DNS_Exception):
"""
An exception which indicate that the server was started with unkown inet_family value
"""
pass
class Swan_Skipprocessing(SWAN_DNS_Exception):
"""
An exception which indicates that a module processing should be skipped.
"""
pass
class Swan_Moduleconfigurationerror(SWAN_DNS_Exception):
"""
An exception which indicates that a module configuration is invalid
"""
pass
class Swan_Moduleloaderror(SWAN_DNS_Exception):
"""
An exception which indicate that there was a problem loading a module
"""
pass
class Swan_Nosuchzoneerror(SWAN_DNS_Exception):
"""
An exception which indicate that a dns server can not resolve a specific zone.
"""
pass
class Swan_Dropanswer(SWAN_DNS_Exception):
"""
An exception which indicates to drop the response and not provide answers to the client
"""
pass
class Swan_Configurationerror(SWAN_DNS_Exception):
"""
An exception which indicates that loading the configuration of a server is not valid
"""
pass |
def insertion_sort(A):
n = len(A)
for i in range(1,n):
key = A[i]
j = i-1
while (j >= 0) and (A[j] > key):
A[j+1] = A[j]
j -= 1
A[j + 1] = key
return A
u = [1,2,3,4,5,6]
v = [6,5,4,3,2,1]
print(insertion_sort(u))
print(insertion_sort(v)) | def insertion_sort(A):
n = len(A)
for i in range(1, n):
key = A[i]
j = i - 1
while j >= 0 and A[j] > key:
A[j + 1] = A[j]
j -= 1
A[j + 1] = key
return A
u = [1, 2, 3, 4, 5, 6]
v = [6, 5, 4, 3, 2, 1]
print(insertion_sort(u))
print(insertion_sort(v)) |
prompt = "\nEnter cities you've visited"
prompt += "\nEnter quit when you're finished! "
cities = []
while True:
place = input(prompt)
if place == 'quit':
break
else:
print(f"I've always wanted to go to {place.title()}!!")
cities.append(prompt)
for city in cities:
print(city.title()) | prompt = "\nEnter cities you've visited"
prompt += "\nEnter quit when you're finished! "
cities = []
while True:
place = input(prompt)
if place == 'quit':
break
else:
print(f"I've always wanted to go to {place.title()}!!")
cities.append(prompt)
for city in cities:
print(city.title()) |
# -*- encoding: utf-8 -*-
"""
@File : __init__.py.py
@Time : 2021/1/22 16:51
@Author : chise
@Email : chise123@live.com
@Software: PyCharm
@info :
"""
| """
@File : __init__.py.py
@Time : 2021/1/22 16:51
@Author : chise
@Email : chise123@live.com
@Software: PyCharm
@info :
""" |
"""Experiment 1, Analysis Group 3.
Characterizing the relationship between respiration and global BOLD signal with and without
denoising.
RPV correlated with SD of mean cortical signal from:
- TE30
- FIT-R2
- MEDN
- MEDN+GODEC
- MEDN+Nuis-Reg
- MEDN+RVT-Reg
- MEDN+RV-Reg
- MEDN+aCompCor
- MEDN+dGSR
- MEDN+MIR
- MEDN+GSR
Plot respiration time series for deep breaths against mean signal from:
- OC
- MEDN
- MEDN+GODEC
- TE30
- FIT-R2
- MEDN+Nuis-Reg
- MEDN+RVT-Reg
- MEDN+RV-Reg
- MEDN+aCompCor
- MEDN+dGSR
- MEDN+MIR
- MEDN+GSR
"""
def correlate_rpv_with_cortical_sd(
participants_file, target_file_patterns, mask_pattern
):
"""Perform analysis 1.
Correlate RPV with standard deviation of mean cortical signal from each of the derivatives,
across participants.
Perform one-sided test of significance on correlation coefficient to determine if RPV is
significantly, positively correlated with SD of mean cortical signal after each denoising
approach.
"""
...
def plot_deep_breath_cortical_signal(
participants_file,
deep_breath_indices,
target_file_patterns,
dseg_pattern,
):
"""Generate plots for analysis 2.
Use visually-identified indices of deep breaths from the respiratory trace to extract
time series from 30 seconds before to 40 seconds after the breath from each of the derivatives,
then plot the mean signals.
"""
...
| """Experiment 1, Analysis Group 3.
Characterizing the relationship between respiration and global BOLD signal with and without
denoising.
RPV correlated with SD of mean cortical signal from:
- TE30
- FIT-R2
- MEDN
- MEDN+GODEC
- MEDN+Nuis-Reg
- MEDN+RVT-Reg
- MEDN+RV-Reg
- MEDN+aCompCor
- MEDN+dGSR
- MEDN+MIR
- MEDN+GSR
Plot respiration time series for deep breaths against mean signal from:
- OC
- MEDN
- MEDN+GODEC
- TE30
- FIT-R2
- MEDN+Nuis-Reg
- MEDN+RVT-Reg
- MEDN+RV-Reg
- MEDN+aCompCor
- MEDN+dGSR
- MEDN+MIR
- MEDN+GSR
"""
def correlate_rpv_with_cortical_sd(participants_file, target_file_patterns, mask_pattern):
"""Perform analysis 1.
Correlate RPV with standard deviation of mean cortical signal from each of the derivatives,
across participants.
Perform one-sided test of significance on correlation coefficient to determine if RPV is
significantly, positively correlated with SD of mean cortical signal after each denoising
approach.
"""
...
def plot_deep_breath_cortical_signal(participants_file, deep_breath_indices, target_file_patterns, dseg_pattern):
"""Generate plots for analysis 2.
Use visually-identified indices of deep breaths from the respiratory trace to extract
time series from 30 seconds before to 40 seconds after the breath from each of the derivatives,
then plot the mean signals.
"""
... |
#2D Array
matrix=[
[1,2,3],
[4,5,6],
[7,8,9]
]
for row in matrix:
for col in row:
print(col)
| matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
for row in matrix:
for col in row:
print(col) |
# -*- Python -*-
"""Repository rule for arm compiler autoconfiguration."""
def _tpl(repository_ctx, tpl, substitutions = {}, out = None):
if not out:
out = tpl
repository_ctx.template(
out,
Label("//third_party/toolchains/cpus/arm:%s.tpl" % tpl),
substitutions,
)
def _arm_compiler_configure_impl(repository_ctx):
# We need to find a cross-compilation include directory for Python, so look
# for an environment variable. Be warned, this crosstool template is only
# regenerated on the first run of Bazel, so if you change the variable after
# it may not be reflected in later builds. Doing a shutdown and clean of Bazel
# doesn't fix this, you'll need to delete the generated file at something like:
# external/local_config_arm_compiler/CROSSTOOL in your Bazel install.
_tpl(repository_ctx, "CROSSTOOL", {
"%{ARM_COMPILER_PATH}%": str(repository_ctx.path(
repository_ctx.attr.remote_config_repo,
)),
})
repository_ctx.symlink(repository_ctx.attr.build_file, "BUILD")
arm_compiler_configure = repository_rule(
implementation = _arm_compiler_configure_impl,
attrs = {
"remote_config_repo": attr.string(mandatory = False, default = ""),
"build_file": attr.label(),
},
)
| """Repository rule for arm compiler autoconfiguration."""
def _tpl(repository_ctx, tpl, substitutions={}, out=None):
if not out:
out = tpl
repository_ctx.template(out, label('//third_party/toolchains/cpus/arm:%s.tpl' % tpl), substitutions)
def _arm_compiler_configure_impl(repository_ctx):
_tpl(repository_ctx, 'CROSSTOOL', {'%{ARM_COMPILER_PATH}%': str(repository_ctx.path(repository_ctx.attr.remote_config_repo))})
repository_ctx.symlink(repository_ctx.attr.build_file, 'BUILD')
arm_compiler_configure = repository_rule(implementation=_arm_compiler_configure_impl, attrs={'remote_config_repo': attr.string(mandatory=False, default=''), 'build_file': attr.label()}) |
class Solution:
def isPowerOfThree(self, n: int) -> bool:
if n <= 0: return False
num, remainder = n // 3, n % 3
if not remainder: return self.isPowerOfThree(num)
else: return True if not num and remainder == 1 else False | class Solution:
def is_power_of_three(self, n: int) -> bool:
if n <= 0:
return False
(num, remainder) = (n // 3, n % 3)
if not remainder:
return self.isPowerOfThree(num)
else:
return True if not num and remainder == 1 else False |
with open ('text.txt', 'r') as f:
names = sorted (name.rstrip ('\n') for name in f)
print (names)
| with open('text.txt', 'r') as f:
names = sorted((name.rstrip('\n') for name in f))
print(names) |
"""
https://leetcode.com/problems/valid-palindrome/
"""
class Solution:
def isPalindrome(self, s: str) -> bool:
sanitized_string = "".join(i.lower() for i in s if i.isalnum())
return sanitized_string == sanitized_string[::-1]
| """
https://leetcode.com/problems/valid-palindrome/
"""
class Solution:
def is_palindrome(self, s: str) -> bool:
sanitized_string = ''.join((i.lower() for i in s if i.isalnum()))
return sanitized_string == sanitized_string[::-1] |
#
# PySNMP MIB module CXQLLC-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CXQLLC-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:17:48 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")
ValueSizeConstraint, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion")
SapIndex, Alias, ThruputClass, cxQLLC = mibBuilder.importSymbols("CXProduct-SMI", "SapIndex", "Alias", "ThruputClass", "cxQLLC")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, iso, Counter32, TimeTicks, Counter64, NotificationType, ModuleIdentity, Gauge32, MibIdentifier, Integer32, Unsigned32, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "iso", "Counter32", "TimeTicks", "Counter64", "NotificationType", "ModuleIdentity", "Gauge32", "MibIdentifier", "Integer32", "Unsigned32", "Bits")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
class X25Address(DisplayString):
subtypeSpec = DisplayString.subtypeSpec + ValueSizeConstraint(0, 15)
class PacketSize(Integer32):
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(4, 5, 6, 7, 8, 9, 10, 11, 12))
namedValues = NamedValues(("bytes16", 4), ("bytes32", 5), ("bytes64", 6), ("bytes128", 7), ("bytes256", 8), ("bytes512", 9), ("bytes1024", 10), ("bytes2048", 11), ("bytes4096", 12))
qllcSapTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1), )
if mibBuilder.loadTexts: qllcSapTable.setStatus('mandatory')
qllcSapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1), ).setIndexNames((0, "CXQLLC-MIB", "qllcSapNumber"))
if mibBuilder.loadTexts: qllcSapEntry.setStatus('mandatory')
qllcSapNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 1), SapIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcSapNumber.setStatus('mandatory')
qllcSapRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcSapRowStatus.setStatus('mandatory')
qllcSapType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("lower", 1), ("upper", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcSapType.setStatus('mandatory')
qllcSapAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 4), Alias()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcSapAlias.setStatus('mandatory')
qllcSapCompanionAlias = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 5), Alias()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcSapCompanionAlias.setStatus('mandatory')
qllcSapSnalcRef = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 8))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcSapSnalcRef.setStatus('mandatory')
qllcSapOperationalMode = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("offline", 1), ("online", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcSapOperationalMode.setStatus('mandatory')
qllcDteTable = MibTable((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2), )
if mibBuilder.loadTexts: qllcDteTable.setStatus('mandatory')
qllcDteEntry = MibTableRow((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1), ).setIndexNames((0, "CXQLLC-MIB", "qllcDteSap"), (0, "CXQLLC-MIB", "qllcDteIndex"))
if mibBuilder.loadTexts: qllcDteEntry.setStatus('mandatory')
qllcDteSap = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 1), SapIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteSap.setStatus('mandatory')
qllcDteIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64))).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteIndex.setStatus('mandatory')
qllcDteRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("invalid", 1), ("valid", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDteRowStatus.setStatus('mandatory')
qllcDteType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("terminalInterfaceUnit", 1), ("hostInterfaceUnit", 2))).clone('terminalInterfaceUnit')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDteType.setStatus('mandatory')
qllcDteCalledAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 5), X25Address()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDteCalledAddress.setStatus('mandatory')
qllcDteCallingAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 6), X25Address()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDteCallingAddress.setStatus('mandatory')
qllcDteDBitCall = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2))).clone('yes')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDteDBitCall.setStatus('mandatory')
qllcDteWindow = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 7)).clone(7)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDteWindow.setStatus('mandatory')
qllcDtePacketSize = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 9), PacketSize().clone('bytes128')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDtePacketSize.setStatus('mandatory')
qllcDteThroughput = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 10), ThruputClass().clone('bps9600')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDteThroughput.setStatus('mandatory')
qllcDteUserData = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 11), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 12))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDteUserData.setStatus('mandatory')
qllcDteFacility = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 12), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDteFacility.setStatus('mandatory')
qllcDteMemotec = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("nonmemotec", 1), ("cx900", 2), ("legacy", 3), ("pvc", 4))).clone('cx900')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDteMemotec.setStatus('mandatory')
qllcDtePvc = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("no", 1), ("yes", 2))).clone('no')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDtePvc.setStatus('mandatory')
qllcDteConnectMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("userdata", 1), ("callingaddress", 2))).clone('userdata')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: qllcDteConnectMethod.setStatus('mandatory')
qllcDteControl = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("clearStats", 1)))).setMaxAccess("writeonly")
if mibBuilder.loadTexts: qllcDteControl.setStatus('mandatory')
qllcDteStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 30), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("connected", 1), ("pendingConnect", 2), ("disconnected", 3), ("pendingDisconnect", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteStatus.setStatus('mandatory')
qllcDteOperationalMode = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("offline", 1), ("online", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteOperationalMode.setStatus('mandatory')
qllcDteState = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=NamedValues(("opened", 1), ("closed", 2), ("xidcmd", 3), ("tstcmd", 4), ("xidrsp", 5), ("tstrsp", 6), ("reset", 7), ("setmode", 8), ("disc", 9), ("reqdisc", 10), ("unknown", 11)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteState.setStatus('mandatory')
qllcDteConnectionType = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("svc", 2), ("pvc", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteConnectionType.setStatus('mandatory')
qllcDteCalls = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 40), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteCalls.setStatus('mandatory')
qllcDteClears = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 41), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteClears.setStatus('mandatory')
qllcDteTxPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 42), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteTxPackets.setStatus('mandatory')
qllcDteRxPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 43), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteRxPackets.setStatus('mandatory')
qllcDteQdc = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 44), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteQdc.setStatus('mandatory')
qllcDteQxid = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 45), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteQxid.setStatus('mandatory')
qllcDteQua = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 46), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteQua.setStatus('mandatory')
qllcDteQsm = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 47), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteQsm.setStatus('mandatory')
qllcDteX25Reset = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 48), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteX25Reset.setStatus('mandatory')
qllcDteSnalcRnr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 49), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteSnalcRnr.setStatus('mandatory')
qllcDteSnalcRr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 50), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteSnalcRr.setStatus('mandatory')
qllcDteX25Rnr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 51), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteX25Rnr.setStatus('mandatory')
qllcDteX25Rr = MibTableColumn((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 52), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcDteX25Rr.setStatus('mandatory')
qllcMibLevel = MibScalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: qllcMibLevel.setStatus('mandatory')
mibBuilder.exportSymbols("CXQLLC-MIB", qllcDteX25Rnr=qllcDteX25Rnr, qllcSapSnalcRef=qllcSapSnalcRef, qllcMibLevel=qllcMibLevel, qllcSapEntry=qllcSapEntry, qllcDteX25Reset=qllcDteX25Reset, qllcDteCallingAddress=qllcDteCallingAddress, qllcDteFacility=qllcDteFacility, qllcDteSnalcRnr=qllcDteSnalcRnr, qllcDtePvc=qllcDtePvc, qllcDteConnectMethod=qllcDteConnectMethod, qllcDteMemotec=qllcDteMemotec, qllcDteIndex=qllcDteIndex, qllcSapNumber=qllcSapNumber, qllcDteQdc=qllcDteQdc, qllcDteRowStatus=qllcDteRowStatus, qllcSapType=qllcSapType, qllcDteType=qllcDteType, PacketSize=PacketSize, qllcDteThroughput=qllcDteThroughput, qllcDteRxPackets=qllcDteRxPackets, qllcDteX25Rr=qllcDteX25Rr, qllcDteTable=qllcDteTable, qllcSapAlias=qllcSapAlias, qllcDteSap=qllcDteSap, qllcDteTxPackets=qllcDteTxPackets, qllcDteConnectionType=qllcDteConnectionType, qllcDtePacketSize=qllcDtePacketSize, qllcDteCalls=qllcDteCalls, qllcDteEntry=qllcDteEntry, qllcDteUserData=qllcDteUserData, qllcDteOperationalMode=qllcDteOperationalMode, qllcDteCalledAddress=qllcDteCalledAddress, qllcSapRowStatus=qllcSapRowStatus, qllcSapTable=qllcSapTable, qllcDteClears=qllcDteClears, qllcSapCompanionAlias=qllcSapCompanionAlias, qllcSapOperationalMode=qllcSapOperationalMode, qllcDteControl=qllcDteControl, qllcDteStatus=qllcDteStatus, qllcDteQsm=qllcDteQsm, qllcDteWindow=qllcDteWindow, qllcDteState=qllcDteState, qllcDteSnalcRr=qllcDteSnalcRr, qllcDteDBitCall=qllcDteDBitCall, qllcDteQua=qllcDteQua, qllcDteQxid=qllcDteQxid, X25Address=X25Address)
| (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, single_value_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ConstraintsUnion')
(sap_index, alias, thruput_class, cx_qllc) = mibBuilder.importSymbols('CXProduct-SMI', 'SapIndex', 'Alias', 'ThruputClass', 'cxQLLC')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(ip_address, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, iso, counter32, time_ticks, counter64, notification_type, module_identity, gauge32, mib_identifier, integer32, unsigned32, bits) = mibBuilder.importSymbols('SNMPv2-SMI', 'IpAddress', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'iso', 'Counter32', 'TimeTicks', 'Counter64', 'NotificationType', 'ModuleIdentity', 'Gauge32', 'MibIdentifier', 'Integer32', 'Unsigned32', 'Bits')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
class X25Address(DisplayString):
subtype_spec = DisplayString.subtypeSpec + value_size_constraint(0, 15)
class Packetsize(Integer32):
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(4, 5, 6, 7, 8, 9, 10, 11, 12))
named_values = named_values(('bytes16', 4), ('bytes32', 5), ('bytes64', 6), ('bytes128', 7), ('bytes256', 8), ('bytes512', 9), ('bytes1024', 10), ('bytes2048', 11), ('bytes4096', 12))
qllc_sap_table = mib_table((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1))
if mibBuilder.loadTexts:
qllcSapTable.setStatus('mandatory')
qllc_sap_entry = mib_table_row((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1)).setIndexNames((0, 'CXQLLC-MIB', 'qllcSapNumber'))
if mibBuilder.loadTexts:
qllcSapEntry.setStatus('mandatory')
qllc_sap_number = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 1), sap_index()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcSapNumber.setStatus('mandatory')
qllc_sap_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('invalid', 1), ('valid', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcSapRowStatus.setStatus('mandatory')
qllc_sap_type = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('lower', 1), ('upper', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcSapType.setStatus('mandatory')
qllc_sap_alias = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 4), alias()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcSapAlias.setStatus('mandatory')
qllc_sap_companion_alias = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 5), alias()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcSapCompanionAlias.setStatus('mandatory')
qllc_sap_snalc_ref = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(0, 8))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcSapSnalcRef.setStatus('mandatory')
qllc_sap_operational_mode = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 1, 1, 20), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('offline', 1), ('online', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcSapOperationalMode.setStatus('mandatory')
qllc_dte_table = mib_table((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2))
if mibBuilder.loadTexts:
qllcDteTable.setStatus('mandatory')
qllc_dte_entry = mib_table_row((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1)).setIndexNames((0, 'CXQLLC-MIB', 'qllcDteSap'), (0, 'CXQLLC-MIB', 'qllcDteIndex'))
if mibBuilder.loadTexts:
qllcDteEntry.setStatus('mandatory')
qllc_dte_sap = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 1), sap_index()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteSap.setStatus('mandatory')
qllc_dte_index = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 64))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteIndex.setStatus('mandatory')
qllc_dte_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('invalid', 1), ('valid', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDteRowStatus.setStatus('mandatory')
qllc_dte_type = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('terminalInterfaceUnit', 1), ('hostInterfaceUnit', 2))).clone('terminalInterfaceUnit')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDteType.setStatus('mandatory')
qllc_dte_called_address = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 5), x25_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDteCalledAddress.setStatus('mandatory')
qllc_dte_calling_address = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 6), x25_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDteCallingAddress.setStatus('mandatory')
qllc_dte_d_bit_call = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('no', 1), ('yes', 2))).clone('yes')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDteDBitCall.setStatus('mandatory')
qllc_dte_window = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(1, 7)).clone(7)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDteWindow.setStatus('mandatory')
qllc_dte_packet_size = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 9), packet_size().clone('bytes128')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDtePacketSize.setStatus('mandatory')
qllc_dte_throughput = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 10), thruput_class().clone('bps9600')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDteThroughput.setStatus('mandatory')
qllc_dte_user_data = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 11), display_string().subtype(subtypeSpec=value_size_constraint(0, 12))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDteUserData.setStatus('mandatory')
qllc_dte_facility = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 12), octet_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDteFacility.setStatus('mandatory')
qllc_dte_memotec = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('nonmemotec', 1), ('cx900', 2), ('legacy', 3), ('pvc', 4))).clone('cx900')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDteMemotec.setStatus('mandatory')
qllc_dte_pvc = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 14), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('no', 1), ('yes', 2))).clone('no')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDtePvc.setStatus('mandatory')
qllc_dte_connect_method = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('userdata', 1), ('callingaddress', 2))).clone('userdata')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
qllcDteConnectMethod.setStatus('mandatory')
qllc_dte_control = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 20), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1))).clone(namedValues=named_values(('clearStats', 1)))).setMaxAccess('writeonly')
if mibBuilder.loadTexts:
qllcDteControl.setStatus('mandatory')
qllc_dte_status = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 30), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('connected', 1), ('pendingConnect', 2), ('disconnected', 3), ('pendingDisconnect', 4)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteStatus.setStatus('mandatory')
qllc_dte_operational_mode = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 31), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('offline', 1), ('online', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteOperationalMode.setStatus('mandatory')
qllc_dte_state = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 32), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=named_values(('opened', 1), ('closed', 2), ('xidcmd', 3), ('tstcmd', 4), ('xidrsp', 5), ('tstrsp', 6), ('reset', 7), ('setmode', 8), ('disc', 9), ('reqdisc', 10), ('unknown', 11)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteState.setStatus('mandatory')
qllc_dte_connection_type = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 33), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('none', 1), ('svc', 2), ('pvc', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteConnectionType.setStatus('mandatory')
qllc_dte_calls = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 40), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteCalls.setStatus('mandatory')
qllc_dte_clears = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 41), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteClears.setStatus('mandatory')
qllc_dte_tx_packets = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 42), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteTxPackets.setStatus('mandatory')
qllc_dte_rx_packets = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 43), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteRxPackets.setStatus('mandatory')
qllc_dte_qdc = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 44), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteQdc.setStatus('mandatory')
qllc_dte_qxid = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 45), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteQxid.setStatus('mandatory')
qllc_dte_qua = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 46), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteQua.setStatus('mandatory')
qllc_dte_qsm = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 47), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteQsm.setStatus('mandatory')
qllc_dte_x25_reset = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 48), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteX25Reset.setStatus('mandatory')
qllc_dte_snalc_rnr = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 49), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteSnalcRnr.setStatus('mandatory')
qllc_dte_snalc_rr = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 50), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteSnalcRr.setStatus('mandatory')
qllc_dte_x25_rnr = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 51), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteX25Rnr.setStatus('mandatory')
qllc_dte_x25_rr = mib_table_column((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 2, 1, 52), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcDteX25Rr.setStatus('mandatory')
qllc_mib_level = mib_scalar((1, 3, 6, 1, 4, 1, 495, 2, 1, 6, 38, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
qllcMibLevel.setStatus('mandatory')
mibBuilder.exportSymbols('CXQLLC-MIB', qllcDteX25Rnr=qllcDteX25Rnr, qllcSapSnalcRef=qllcSapSnalcRef, qllcMibLevel=qllcMibLevel, qllcSapEntry=qllcSapEntry, qllcDteX25Reset=qllcDteX25Reset, qllcDteCallingAddress=qllcDteCallingAddress, qllcDteFacility=qllcDteFacility, qllcDteSnalcRnr=qllcDteSnalcRnr, qllcDtePvc=qllcDtePvc, qllcDteConnectMethod=qllcDteConnectMethod, qllcDteMemotec=qllcDteMemotec, qllcDteIndex=qllcDteIndex, qllcSapNumber=qllcSapNumber, qllcDteQdc=qllcDteQdc, qllcDteRowStatus=qllcDteRowStatus, qllcSapType=qllcSapType, qllcDteType=qllcDteType, PacketSize=PacketSize, qllcDteThroughput=qllcDteThroughput, qllcDteRxPackets=qllcDteRxPackets, qllcDteX25Rr=qllcDteX25Rr, qllcDteTable=qllcDteTable, qllcSapAlias=qllcSapAlias, qllcDteSap=qllcDteSap, qllcDteTxPackets=qllcDteTxPackets, qllcDteConnectionType=qllcDteConnectionType, qllcDtePacketSize=qllcDtePacketSize, qllcDteCalls=qllcDteCalls, qllcDteEntry=qllcDteEntry, qllcDteUserData=qllcDteUserData, qllcDteOperationalMode=qllcDteOperationalMode, qllcDteCalledAddress=qllcDteCalledAddress, qllcSapRowStatus=qllcSapRowStatus, qllcSapTable=qllcSapTable, qllcDteClears=qllcDteClears, qllcSapCompanionAlias=qllcSapCompanionAlias, qllcSapOperationalMode=qllcSapOperationalMode, qllcDteControl=qllcDteControl, qllcDteStatus=qllcDteStatus, qllcDteQsm=qllcDteQsm, qllcDteWindow=qllcDteWindow, qllcDteState=qllcDteState, qllcDteSnalcRr=qllcDteSnalcRr, qllcDteDBitCall=qllcDteDBitCall, qllcDteQua=qllcDteQua, qllcDteQxid=qllcDteQxid, X25Address=X25Address) |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def isPalindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
val = []
p_head = head
if not head:
return True
if not head.next:
return True
while head:
if val != []:
last_val = val[-1]
if last_val == head.val:
break
if head.next:
if last_val == head.next.val:
break
val.append(head.val)
head = head.next
if head == None:
return False
else:
if head.next:
if last_val == head.next.val:
head = head.next
while head and val != []:
if head.val != val.pop():
break
head = head.next
if head == None and val == []:
return True
else:
return False | class Solution(object):
def is_palindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
val = []
p_head = head
if not head:
return True
if not head.next:
return True
while head:
if val != []:
last_val = val[-1]
if last_val == head.val:
break
if head.next:
if last_val == head.next.val:
break
val.append(head.val)
head = head.next
if head == None:
return False
else:
if head.next:
if last_val == head.next.val:
head = head.next
while head and val != []:
if head.val != val.pop():
break
head = head.next
if head == None and val == []:
return True
else:
return False |
'''
openarm Python library
configurations
'''
# protocol
HEAD = 0x5a
# debug
DEBUG = False | """
openarm Python library
configurations
"""
head = 90
debug = False |
'''
Navigator's kill board communicates over serial using the hex codes listed below.
This should be the same as the codes on:
http://docs.mil.ufl.edu/pages/viewpage.action?spaceKey=NAV&title=Kill+Communication+Commands
The board can operate both in a request / response way, or it can be
periodically pinged and will respond with many bytes indicating the status
of all addresses.
For the ping/Async method, send PING, than continue to read the buffer
and parse the various response bytes below.
For the sync / request method, send the REQUEST byte for whatever addresses you
are interested in, then read a 1 byte response for either RESPONSE_FALSE or RESPONSE_TRUE
The computer can also command a kill (for example, if ROS notices a criticaly low battery)
by sending the COMPUTER.KILL.REQUEST and undone with COMPUTER.CLEAR.REQUEST
'''
constants = {
'TIMEOUT_SECONDS': 8.0, # How often board must be pinged to not set HEARTBERAT_REMOTE True
# Note: not official documented, this is just a guess
'RESPONSE_FALSE': '\x00', # True status for synchronous requests of individual addresses
'RESPONSE_TRUE': '\x01', # False status for synchronous requests of individual addresses
'PING': {
'REQUEST': '\x20',
'RESPONSE': '\x30'
},
'KILLS': ['OVERALL', 'BUTTON_FRONT_PORT', 'BUTTON_AFT_PORT', 'BUTTON_FRONT_STARBOARD',\
'BUTTON_AFT_STARBOARD', 'HEARTBEAT_COMPUTER', 'BUTTON_REMOTE',\
'HEARTBEAT_REMOTE', 'COMPUTER'],
'OVERALL': { # Should be True if any of the over are True
'REQUEST': '\x21',
'TRUE': '\x10',
'FALSE': '\x11'
},
'BUTTON_FRONT_PORT': {
'REQUEST': '\x22',
'TRUE': '\x12',
'FALSE': '\x13'
},
'BUTTON_AFT_PORT': {
'REQUEST': '\x23',
'TRUE': '\x14',
'FALSE': '\x15'
},
'BUTTON_FRONT_STARBOARD': {
'REQUEST': '\x24',
'TRUE': '\x16',
'FALSE': '\x17'
},
'BUTTON_AFT_STARBOARD': {
'REQUEST': '\x25',
'TRUE': '\x18',
'FALSE': '\x19'
},
'HEARTBEAT_COMPUTER': { # Will return True if board is not pinged by mobo often enough
'REQUEST': '\x26',
'TRUE': '\x1A',
'FALSE': '\x1B'
},
'BUTTON_REMOTE': {
'REQUEST': '\x28',
'TRUE': '\x3A',
'FALSE': '\x3B'
},
'HEARTBEAT_REMOTE': { # Will return True if board is not pinged by controller often enough
'REQUEST': '\x29',
'TRUE': '\x3C',
'FALSE': '\x3D'
},
'COMPUTER': { # Allows board to be killed over serial (like through ROS)
'KILL': {
'REQUEST': '\x45',
'RESPONSE': '\x55'
},
'CLEAR': {
'REQUEST': '\x46',
'RESPONSE': '\x56'
},
'REQUEST': '\x27',
'TRUE': '\x1C',
'FALSE': '\x1D'
},
'CONNECTED': {
'TRUE': '\x1E',
'FALSE': '\x1F'
},
'LIGHTS': { # Note: YELLOW turns off GREEN and visa versa
'OFF_REQUEST': '\x40',
'OFF_RESPONSE': '\x50',
'YELLOW_REQUEST': '\x41',
'YELLOW_RESPONSE': '\x51',
'GREEN_REQUEST': '\x42',
'GREEN_RESPONSE': '\x52',
},
'CONTROLLER': '\xA0', # Signifies the start of a controller message (joysticks & buttons)
# Immediately followed by 8 bytes: 6 joystick bytes, 2 button bytes
# Joystick message is 3 signed ints from -2048 to 2047
# Button message is 16 bits signifying up to 16 buttons on/off
'CTRL_STICKS': ['UD', 'LR', 'TQ'], # Up/Down, Left/Right, Torque
'CTRL_BUTTONS': ['X', 'Y', 'A', 'B', 'DL', 'DR', 'START'],
'CTRL_BUTTONS_VALUES': { # Amount of buttons and labels will be changed in the future
# This currently mimics xbox controller labels and numbering
'X': '\x00\x04', # Button 2
'Y': '\x00\x08', # Button 3
'A': '\x00\x01', # Button 0
'B': '\x00\x02', # Button 1
'DL': '\x08\x00', # Dpad Left (Button 11)
'DR': '\x10\x00', # Dpad Right (Button 12)
'START': '\x00\x80', # Start (Button 7)
}
}
| """
Navigator's kill board communicates over serial using the hex codes listed below.
This should be the same as the codes on:
http://docs.mil.ufl.edu/pages/viewpage.action?spaceKey=NAV&title=Kill+Communication+Commands
The board can operate both in a request / response way, or it can be
periodically pinged and will respond with many bytes indicating the status
of all addresses.
For the ping/Async method, send PING, than continue to read the buffer
and parse the various response bytes below.
For the sync / request method, send the REQUEST byte for whatever addresses you
are interested in, then read a 1 byte response for either RESPONSE_FALSE or RESPONSE_TRUE
The computer can also command a kill (for example, if ROS notices a criticaly low battery)
by sending the COMPUTER.KILL.REQUEST and undone with COMPUTER.CLEAR.REQUEST
"""
constants = {'TIMEOUT_SECONDS': 8.0, 'RESPONSE_FALSE': '\x00', 'RESPONSE_TRUE': '\x01', 'PING': {'REQUEST': ' ', 'RESPONSE': '0'}, 'KILLS': ['OVERALL', 'BUTTON_FRONT_PORT', 'BUTTON_AFT_PORT', 'BUTTON_FRONT_STARBOARD', 'BUTTON_AFT_STARBOARD', 'HEARTBEAT_COMPUTER', 'BUTTON_REMOTE', 'HEARTBEAT_REMOTE', 'COMPUTER'], 'OVERALL': {'REQUEST': '!', 'TRUE': '\x10', 'FALSE': '\x11'}, 'BUTTON_FRONT_PORT': {'REQUEST': '"', 'TRUE': '\x12', 'FALSE': '\x13'}, 'BUTTON_AFT_PORT': {'REQUEST': '#', 'TRUE': '\x14', 'FALSE': '\x15'}, 'BUTTON_FRONT_STARBOARD': {'REQUEST': '$', 'TRUE': '\x16', 'FALSE': '\x17'}, 'BUTTON_AFT_STARBOARD': {'REQUEST': '%', 'TRUE': '\x18', 'FALSE': '\x19'}, 'HEARTBEAT_COMPUTER': {'REQUEST': '&', 'TRUE': '\x1a', 'FALSE': '\x1b'}, 'BUTTON_REMOTE': {'REQUEST': '(', 'TRUE': ':', 'FALSE': ';'}, 'HEARTBEAT_REMOTE': {'REQUEST': ')', 'TRUE': '<', 'FALSE': '='}, 'COMPUTER': {'KILL': {'REQUEST': 'E', 'RESPONSE': 'U'}, 'CLEAR': {'REQUEST': 'F', 'RESPONSE': 'V'}, 'REQUEST': "'", 'TRUE': '\x1c', 'FALSE': '\x1d'}, 'CONNECTED': {'TRUE': '\x1e', 'FALSE': '\x1f'}, 'LIGHTS': {'OFF_REQUEST': '@', 'OFF_RESPONSE': 'P', 'YELLOW_REQUEST': 'A', 'YELLOW_RESPONSE': 'Q', 'GREEN_REQUEST': 'B', 'GREEN_RESPONSE': 'R'}, 'CONTROLLER': '\xa0', 'CTRL_STICKS': ['UD', 'LR', 'TQ'], 'CTRL_BUTTONS': ['X', 'Y', 'A', 'B', 'DL', 'DR', 'START'], 'CTRL_BUTTONS_VALUES': {'X': '\x00\x04', 'Y': '\x00\x08', 'A': '\x00\x01', 'B': '\x00\x02', 'DL': '\x08\x00', 'DR': '\x10\x00', 'START': '\x00\x80'}} |
"""
Separted classes and functions used by the api module.
Note that these classes and variables are all imported higher up at the
top of the api module. They can be referenced from there instead of digging
in deeper to these submodules.
"""
| """
Separted classes and functions used by the api module.
Note that these classes and variables are all imported higher up at the
top of the api module. They can be referenced from there instead of digging
in deeper to these submodules.
""" |
# -*- coding: utf-8
class History(object):
requests = []
responses = []
_instance = None
@classmethod
def instance(cls):
if not cls._instance:
cls._instance = cls()
return cls._instance
def add_response(self, response_obj):
self.responses.append(response_obj)
def add_request(self, request_obj):
self.requests.append(request_obj)
@property
def request(self):
if len(self.requests) == 0:
return None
else:
return self.requests[-1]
@property
def response(self):
if len(self.responses) == 0:
return None
else:
return self.responses[-1]
def clear(self):
del self.requests[:]
del self.responses[:] | class History(object):
requests = []
responses = []
_instance = None
@classmethod
def instance(cls):
if not cls._instance:
cls._instance = cls()
return cls._instance
def add_response(self, response_obj):
self.responses.append(response_obj)
def add_request(self, request_obj):
self.requests.append(request_obj)
@property
def request(self):
if len(self.requests) == 0:
return None
else:
return self.requests[-1]
@property
def response(self):
if len(self.responses) == 0:
return None
else:
return self.responses[-1]
def clear(self):
del self.requests[:]
del self.responses[:] |
#
# PySNMP MIB module RADLAN-DOT1X-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-DOT1X-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:38:04 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, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection")
MacAddress, = mibBuilder.importSymbols("BRIDGE-MIB", "MacAddress")
PaeControlledPortStatus, dot1xAuthSessionStatsEntry, dot1xPaePortNumber = mibBuilder.importSymbols("IEEE8021-PAE-MIB", "PaeControlledPortStatus", "dot1xAuthSessionStatsEntry", "dot1xPaePortNumber")
PortList, dot1qFdbId, VlanIndex = mibBuilder.importSymbols("Q-BRIDGE-MIB", "PortList", "dot1qFdbId", "VlanIndex")
rnd, = mibBuilder.importSymbols("RADLAN-MIB", "rnd")
SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
iso, ModuleIdentity, Integer32, Gauge32, ObjectIdentity, Counter64, IpAddress, Bits, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, Unsigned32, NotificationType, TimeTicks, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "ModuleIdentity", "Integer32", "Gauge32", "ObjectIdentity", "Counter64", "IpAddress", "Bits", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Unsigned32", "NotificationType", "TimeTicks", "Counter32")
TextualConvention, TruthValue, RowStatus, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "RowStatus", "DisplayString")
rldot1x = ModuleIdentity((1, 3, 6, 1, 4, 1, 89, 95))
rldot1x.setRevisions(('2007-01-02 00:00',))
if mibBuilder.loadTexts: rldot1x.setLastUpdated('200701020000Z')
if mibBuilder.loadTexts: rldot1x.setOrganization('Radlan - a MARVELL company. Marvell Semiconductor, Inc.')
rldot1xMibVersion = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xMibVersion.setStatus('current')
rldot1xExtAuthSessionStatsTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 2), )
if mibBuilder.loadTexts: rldot1xExtAuthSessionStatsTable.setStatus('current')
rldot1xExtAuthSessionStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 2, 1), )
dot1xAuthSessionStatsEntry.registerAugmentions(("RADLAN-DOT1X-MIB", "rldot1xExtAuthSessionStatsEntry"))
rldot1xExtAuthSessionStatsEntry.setIndexNames(*dot1xAuthSessionStatsEntry.getIndexNames())
if mibBuilder.loadTexts: rldot1xExtAuthSessionStatsEntry.setStatus('current')
rlDot1xAuthSessionAuthenticMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("remoteAuthServer", 1), ("localAuthServer", 2), ("none", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDot1xAuthSessionAuthenticMethod.setStatus('current')
rldot1xGuestVlanSupported = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 3), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xGuestVlanSupported.setStatus('current')
rldot1xGuestVlanVID = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 4), VlanIndex()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xGuestVlanVID.setStatus('current')
rldot1xGuestVlanPorts = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 5), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xGuestVlanPorts.setStatus('current')
rldot1xUnAuthenticatedVlanSupported = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 6), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanSupported.setStatus('current')
rldot1xUnAuthenticatedVlanTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 7), )
if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanTable.setStatus('current')
rldot1xUnAuthenticatedVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 7, 1), ).setIndexNames((0, "Q-BRIDGE-MIB", "dot1qFdbId"))
if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanEntry.setStatus('current')
rldot1xUnAuthenticatedVlanStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 7, 1, 1), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rldot1xUnAuthenticatedVlanStatus.setStatus('current')
rldot1xUserBasedVlanSupported = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 8), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xUserBasedVlanSupported.setStatus('current')
rldot1xUserBasedVlanPorts = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 9), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xUserBasedVlanPorts.setStatus('current')
rldot1xAuthenticationPortTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 10), )
if mibBuilder.loadTexts: rldot1xAuthenticationPortTable.setStatus('current')
rldot1xAuthenticationPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 10, 1), ).setIndexNames((0, "IEEE8021-PAE-MIB", "dot1xPaePortNumber"))
if mibBuilder.loadTexts: rldot1xAuthenticationPortEntry.setStatus('current')
rldot1xAuthenticationPortMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("eapolOnly", 1), ("macAndEapol", 2), ("macOnly", 3), ("webOnly", 4), ("webAndEapol", 5), ("webAndMac", 6), ("webAndMacAndEapol", 7))).clone('eapolOnly')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xAuthenticationPortMethod.setStatus('current')
rldot1xRadiusAttrVlanIdEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 2), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xRadiusAttrVlanIdEnabled.setStatus('current')
rldot1xRadiusAttAclNameEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 3), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xRadiusAttAclNameEnabled.setStatus('current')
rldot1xTimeBasedName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 4), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xTimeBasedName.setStatus('current')
rldot1xTimeBasedActive = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 5), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xTimeBasedActive.setStatus('current')
rldot1xRadiusAttrVlanIdentifier = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 6), VlanIndex()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xRadiusAttrVlanIdentifier.setStatus('current')
rldot1xMaxHosts = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 7), Unsigned32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xMaxHosts.setStatus('current')
rldot1xMaxLoginAttempts = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 10))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xMaxLoginAttempts.setStatus('current')
rldot1xTimeoutSilencePeriod = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xTimeoutSilencePeriod.setStatus('current')
rldot1xNumOfAuthorizedHosts = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xNumOfAuthorizedHosts.setStatus('current')
rldot1xAuthenticationOpenEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 11), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xAuthenticationOpenEnabled.setStatus('current')
rldot1xAuthMultiStatsTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 11), )
if mibBuilder.loadTexts: rldot1xAuthMultiStatsTable.setStatus('current')
rldot1xAuthMultiStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 11, 1), ).setIndexNames((0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiStatsPortNumber"), (0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiStatsSourceMac"))
if mibBuilder.loadTexts: rldot1xAuthMultiStatsEntry.setStatus('current')
rldot1xAuthMultiStatsPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiStatsPortNumber.setStatus('current')
rldot1xAuthMultiStatsSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiStatsSourceMac.setStatus('current')
rldot1xAuthMultiEapolFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolFramesRx.setStatus('current')
rldot1xAuthMultiEapolFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolFramesTx.setStatus('current')
rldot1xAuthMultiEapolStartFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolStartFramesRx.setStatus('current')
rldot1xAuthMultiEapolLogoffFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolLogoffFramesRx.setStatus('current')
rldot1xAuthMultiEapolRespIdFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolRespIdFramesRx.setStatus('current')
rldot1xAuthMultiEapolRespFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolRespFramesRx.setStatus('current')
rldot1xAuthMultiEapolReqIdFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolReqIdFramesTx.setStatus('current')
rldot1xAuthMultiEapolReqFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapolReqFramesTx.setStatus('current')
rldot1xAuthMultiInvalidEapolFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiInvalidEapolFramesRx.setStatus('current')
rldot1xAuthMultiEapLengthErrorFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEapLengthErrorFramesRx.setStatus('current')
rldot1xAuthMultiDiagTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 12), )
if mibBuilder.loadTexts: rldot1xAuthMultiDiagTable.setStatus('current')
rldot1xAuthMultiDiagEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 12, 1), ).setIndexNames((0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiDiagPortNumber"), (0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiDiagSourceMac"))
if mibBuilder.loadTexts: rldot1xAuthMultiDiagEntry.setStatus('current')
rldot1xAuthMultiDiagPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiDiagPortNumber.setStatus('current')
rldot1xAuthMultiDiagSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiDiagSourceMac.setStatus('current')
rldot1xAuthMultiEntersConnecting = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEntersConnecting.setStatus('current')
rldot1xAuthMultiEntersAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiEntersAuthenticating.setStatus('current')
rldot1xAuthMultiAuthSuccessWhileAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiAuthSuccessWhileAuthenticating.setStatus('current')
rldot1xAuthMultiAuthFailWhileAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiAuthFailWhileAuthenticating.setStatus('current')
rldot1xAuthMultiAuthReauthsWhileAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiAuthReauthsWhileAuthenticating.setStatus('current')
rldot1xAuthMultiAuthEapStartsWhileAuthenticating = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiAuthEapStartsWhileAuthenticating.setStatus('current')
rldot1xAuthMultiAuthReauthsWhileAuthenticated = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiAuthReauthsWhileAuthenticated.setStatus('current')
rldot1xAuthMultiAuthEapStartsWhileAuthenticated = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiAuthEapStartsWhileAuthenticated.setStatus('current')
rldot1xAuthMultiBackendResponses = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiBackendResponses.setStatus('current')
rldot1xAuthMultiBackendAccessChallenges = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiBackendAccessChallenges.setStatus('current')
rldot1xAuthMultiBackendOtherRequestsToSupplicant = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiBackendOtherRequestsToSupplicant.setStatus('current')
rldot1xAuthMultiBackendNonNakResponsesFromSupplicant = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiBackendNonNakResponsesFromSupplicant.setStatus('current')
rldot1xAuthMultiBackendAuthSuccesses = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiBackendAuthSuccesses.setStatus('current')
rldot1xAuthMultiSessionStatsTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 13), )
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsTable.setStatus('current')
rldot1xAuthMultiSessionStatsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 13, 1), ).setIndexNames((0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiSessionStatsPortNumber"), (0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiSessionStatsSourceMac"))
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsEntry.setStatus('current')
rldot1xAuthMultiSessionStatsPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsPortNumber.setStatus('current')
rldot1xAuthMultiSessionStatsSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionStatsSourceMac.setStatus('current')
rldot1xAuthMultiSessionOctetsRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 3), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionOctetsRx.setStatus('current')
rldot1xAuthMultiSessionOctetsTx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionOctetsTx.setStatus('current')
rldot1xAuthMultiSessionFramesRx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionFramesRx.setStatus('current')
rldot1xAuthMultiSessionFramesTx = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionFramesTx.setStatus('current')
rldot1xAuthMultiSessionId = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 7), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionId.setStatus('current')
rldot1xAuthMultiSessionTime = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 8), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionTime.setStatus('current')
rldot1xAuthMultiSessionUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 9), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionUserName.setStatus('current')
rldot1xAuthMultiSessionRadiusAttrVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionRadiusAttrVlan.setStatus('current')
rldot1xAuthMultiSessionRadiusAttrFilterId = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 11), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionRadiusAttrFilterId.setStatus('current')
rldot1xAuthMultiSessionRadiusAttrSecondFilterId = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 12), SnmpAdminString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSessionRadiusAttrSecondFilterId.setStatus('current')
rlDot1xAuthMultiSessionMonitorResultsReason = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24))).clone(namedValues=NamedValues(("notRejected", 0), ("aclNotExst", 1), ("aclOvrfl", 2), ("authErr", 3), ("fltrErr", 4), ("ipv6WithMac", 5), ("ipv6WithNotIp", 6), ("polBasicMode", 7), ("aclDel", 8), ("polDel", 9), ("vlanDfly", 10), ("vlanDynam", 11), ("vlanGuest", 12), ("vlanNoInMsg", 13), ("vlanNotExst", 14), ("vlanOvfl", 15), ("vlanVoice", 16), ("vlanUnauth", 17), ("frsMthDeny", 18), ("radApierr", 19), ("radInvlres", 20), ("radNoresp", 21), ("aclEgress", 22), ("maxHosts", 23), ("noActivity", 24)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDot1xAuthMultiSessionMonitorResultsReason.setStatus('current')
rlDot1xAuthMultiSessionMethodType = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("eapol", 1), ("mac", 2), ("web", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rlDot1xAuthMultiSessionMethodType.setStatus('current')
rldot1xAuthMultiConfigTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 14), )
if mibBuilder.loadTexts: rldot1xAuthMultiConfigTable.setStatus('current')
rldot1xAuthMultiConfigEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 14, 1), ).setIndexNames((0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiPortNumber"), (0, "RADLAN-DOT1X-MIB", "rldot1xAuthMultiSourceMac"))
if mibBuilder.loadTexts: rldot1xAuthMultiConfigEntry.setStatus('current')
rldot1xAuthMultiPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiPortNumber.setStatus('current')
rldot1xAuthMultiSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiSourceMac.setStatus('current')
rldot1xAuthMultiPaeState = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=NamedValues(("initialize", 1), ("disconnected", 2), ("connecting", 3), ("authenticating", 4), ("authenticated", 5), ("aborting", 6), ("held", 7), ("forceAuth", 8), ("forceUnauth", 9)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiPaeState.setStatus('current')
rldot1xAuthMultiBackendAuthState = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("request", 1), ("response", 2), ("success", 3), ("fail", 4), ("timeout", 5), ("idle", 6), ("initialize", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiBackendAuthState.setStatus('current')
rldot1xAuthMultiControlledPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 5), PaeControlledPortStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xAuthMultiControlledPortStatus.setStatus('current')
rldot1xBpduFilteringEnabled = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 15), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xBpduFilteringEnabled.setStatus('current')
rldot1xRadiusAttributesErrorsAclReject = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 18), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xRadiusAttributesErrorsAclReject.setStatus('current')
rldot1xGuestVlanTimeInterval = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 180))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xGuestVlanTimeInterval.setStatus('current')
rldot1xMacAuthSuccessTrapEnabled = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 20), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xMacAuthSuccessTrapEnabled.setStatus('current')
rldot1xMacAuthFailureTrapEnabled = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 21), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xMacAuthFailureTrapEnabled.setStatus('current')
rldot1xLegacyPortTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 22), )
if mibBuilder.loadTexts: rldot1xLegacyPortTable.setStatus('current')
rldot1xLegacyPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 22, 1), ).setIndexNames((0, "IEEE8021-PAE-MIB", "dot1xPaePortNumber"))
if mibBuilder.loadTexts: rldot1xLegacyPortEntry.setStatus('current')
rldot1xLegacyPortModeEnabled = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 22, 1, 1), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xLegacyPortModeEnabled.setStatus('current')
rldot1xSystemAuthControlMonitorVlan = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 23), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 4094))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xSystemAuthControlMonitorVlan.setStatus('current')
rldot1xClearPortMibCounters = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 24), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xClearPortMibCounters.setStatus('current')
rldot1xWebQuietFailureTrapEnabled = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 25), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xWebQuietFailureTrapEnabled.setStatus('current')
rldot1xMacWebAuthSuccessTrapEnabled = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 26), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("none", 0), ("eapolOnly", 1), ("macAndEapol", 2), ("macOnly", 3), ("webOnly", 4), ("webAndEapol", 5), ("webAndMac", 6), ("webAndMacAndEapol", 7)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xMacWebAuthSuccessTrapEnabled.setStatus('current')
rldot1xMacWebAuthFailureTrapEnabled = MibScalar((1, 3, 6, 1, 4, 1, 89, 95, 27), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("none", 0), ("eapolOnly", 1), ("macAndEapol", 2), ("macOnly", 3), ("webOnly", 4), ("webAndEapol", 5), ("webAndMac", 6), ("webAndMacAndEapol", 7)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xMacWebAuthFailureTrapEnabled.setStatus('current')
rldot1xLockedCientsTable = MibTable((1, 3, 6, 1, 4, 1, 89, 95, 28), )
if mibBuilder.loadTexts: rldot1xLockedCientsTable.setStatus('current')
rldot1xLockedCientsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 89, 95, 28, 1), ).setIndexNames((0, "RADLAN-DOT1X-MIB", "rldot1xLockedCientsPortNumber"), (0, "RADLAN-DOT1X-MIB", "rldot1xLockedCientsSourceMac"))
if mibBuilder.loadTexts: rldot1xLockedCientsEntry.setStatus('current')
rldot1xLockedCientsPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 28, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xLockedCientsPortNumber.setStatus('current')
rldot1xLockedCientsSourceMac = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 28, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xLockedCientsSourceMac.setStatus('current')
rldot1xLockedCientsRemainedTime = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 28, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: rldot1xLockedCientsRemainedTime.setStatus('current')
rldot1xLockedCientsRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 95, 28, 1, 4), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: rldot1xLockedCientsRowStatus.setStatus('current')
mibBuilder.exportSymbols("RADLAN-DOT1X-MIB", rldot1xAuthMultiAuthReauthsWhileAuthenticated=rldot1xAuthMultiAuthReauthsWhileAuthenticated, rldot1xAuthMultiStatsEntry=rldot1xAuthMultiStatsEntry, rldot1xAuthMultiStatsSourceMac=rldot1xAuthMultiStatsSourceMac, rldot1xWebQuietFailureTrapEnabled=rldot1xWebQuietFailureTrapEnabled, rlDot1xAuthSessionAuthenticMethod=rlDot1xAuthSessionAuthenticMethod, rldot1xAuthMultiEapolReqFramesTx=rldot1xAuthMultiEapolReqFramesTx, rldot1xAuthMultiEapolRespIdFramesRx=rldot1xAuthMultiEapolRespIdFramesRx, rldot1xAuthMultiDiagEntry=rldot1xAuthMultiDiagEntry, rldot1xAuthMultiSessionStatsSourceMac=rldot1xAuthMultiSessionStatsSourceMac, rldot1xAuthMultiAuthReauthsWhileAuthenticating=rldot1xAuthMultiAuthReauthsWhileAuthenticating, rldot1xLockedCientsRowStatus=rldot1xLockedCientsRowStatus, PYSNMP_MODULE_ID=rldot1x, rldot1xAuthMultiDiagTable=rldot1xAuthMultiDiagTable, rldot1xMacWebAuthSuccessTrapEnabled=rldot1xMacWebAuthSuccessTrapEnabled, rldot1xAuthenticationPortTable=rldot1xAuthenticationPortTable, rldot1xLockedCientsSourceMac=rldot1xLockedCientsSourceMac, rldot1xUnAuthenticatedVlanStatus=rldot1xUnAuthenticatedVlanStatus, rldot1xLockedCientsEntry=rldot1xLockedCientsEntry, rldot1xClearPortMibCounters=rldot1xClearPortMibCounters, rldot1xAuthMultiEapolRespFramesRx=rldot1xAuthMultiEapolRespFramesRx, rldot1xAuthMultiAuthFailWhileAuthenticating=rldot1xAuthMultiAuthFailWhileAuthenticating, rldot1xAuthMultiSessionStatsEntry=rldot1xAuthMultiSessionStatsEntry, rldot1xExtAuthSessionStatsEntry=rldot1xExtAuthSessionStatsEntry, rldot1xAuthMultiAuthSuccessWhileAuthenticating=rldot1xAuthMultiAuthSuccessWhileAuthenticating, rldot1xAuthMultiSessionTime=rldot1xAuthMultiSessionTime, rldot1xAuthMultiBackendAuthSuccesses=rldot1xAuthMultiBackendAuthSuccesses, rldot1xUnAuthenticatedVlanEntry=rldot1xUnAuthenticatedVlanEntry, rldot1xAuthMultiEapolStartFramesRx=rldot1xAuthMultiEapolStartFramesRx, rldot1xUserBasedVlanSupported=rldot1xUserBasedVlanSupported, rldot1xAuthMultiEapolReqIdFramesTx=rldot1xAuthMultiEapolReqIdFramesTx, rldot1xMaxLoginAttempts=rldot1xMaxLoginAttempts, rldot1xNumOfAuthorizedHosts=rldot1xNumOfAuthorizedHosts, rldot1xGuestVlanVID=rldot1xGuestVlanVID, rldot1xUnAuthenticatedVlanSupported=rldot1xUnAuthenticatedVlanSupported, rldot1xAuthMultiPortNumber=rldot1xAuthMultiPortNumber, rldot1xMaxHosts=rldot1xMaxHosts, rldot1xAuthMultiAuthEapStartsWhileAuthenticated=rldot1xAuthMultiAuthEapStartsWhileAuthenticated, rldot1xLegacyPortTable=rldot1xLegacyPortTable, rldot1xAuthMultiPaeState=rldot1xAuthMultiPaeState, rldot1xAuthMultiSessionId=rldot1xAuthMultiSessionId, rldot1xAuthMultiSessionRadiusAttrVlan=rldot1xAuthMultiSessionRadiusAttrVlan, rldot1xAuthMultiDiagPortNumber=rldot1xAuthMultiDiagPortNumber, rldot1xAuthMultiSessionUserName=rldot1xAuthMultiSessionUserName, rldot1xAuthMultiEntersAuthenticating=rldot1xAuthMultiEntersAuthenticating, rldot1xAuthMultiEntersConnecting=rldot1xAuthMultiEntersConnecting, rldot1xAuthMultiBackendNonNakResponsesFromSupplicant=rldot1xAuthMultiBackendNonNakResponsesFromSupplicant, rldot1x=rldot1x, rldot1xAuthMultiSessionFramesTx=rldot1xAuthMultiSessionFramesTx, rldot1xRadiusAttrVlanIdEnabled=rldot1xRadiusAttrVlanIdEnabled, rldot1xMibVersion=rldot1xMibVersion, rldot1xAuthMultiSessionRadiusAttrFilterId=rldot1xAuthMultiSessionRadiusAttrFilterId, rldot1xAuthenticationOpenEnabled=rldot1xAuthenticationOpenEnabled, rldot1xAuthMultiEapolFramesRx=rldot1xAuthMultiEapolFramesRx, rldot1xGuestVlanSupported=rldot1xGuestVlanSupported, rldot1xRadiusAttrVlanIdentifier=rldot1xRadiusAttrVlanIdentifier, rldot1xRadiusAttAclNameEnabled=rldot1xRadiusAttAclNameEnabled, rldot1xUserBasedVlanPorts=rldot1xUserBasedVlanPorts, rldot1xAuthMultiSessionRadiusAttrSecondFilterId=rldot1xAuthMultiSessionRadiusAttrSecondFilterId, rldot1xTimeoutSilencePeriod=rldot1xTimeoutSilencePeriod, rldot1xGuestVlanPorts=rldot1xGuestVlanPorts, rldot1xMacAuthFailureTrapEnabled=rldot1xMacAuthFailureTrapEnabled, rlDot1xAuthMultiSessionMonitorResultsReason=rlDot1xAuthMultiSessionMonitorResultsReason, rldot1xAuthMultiEapolFramesTx=rldot1xAuthMultiEapolFramesTx, rldot1xAuthMultiStatsPortNumber=rldot1xAuthMultiStatsPortNumber, rldot1xTimeBasedName=rldot1xTimeBasedName, rldot1xAuthMultiSessionOctetsRx=rldot1xAuthMultiSessionOctetsRx, rldot1xGuestVlanTimeInterval=rldot1xGuestVlanTimeInterval, rldot1xLegacyPortModeEnabled=rldot1xLegacyPortModeEnabled, rldot1xAuthMultiDiagSourceMac=rldot1xAuthMultiDiagSourceMac, rldot1xAuthMultiAuthEapStartsWhileAuthenticating=rldot1xAuthMultiAuthEapStartsWhileAuthenticating, rldot1xAuthMultiSessionStatsPortNumber=rldot1xAuthMultiSessionStatsPortNumber, rldot1xUnAuthenticatedVlanTable=rldot1xUnAuthenticatedVlanTable, rldot1xRadiusAttributesErrorsAclReject=rldot1xRadiusAttributesErrorsAclReject, rldot1xLockedCientsRemainedTime=rldot1xLockedCientsRemainedTime, rldot1xTimeBasedActive=rldot1xTimeBasedActive, rldot1xAuthMultiSourceMac=rldot1xAuthMultiSourceMac, rldot1xAuthMultiBackendAccessChallenges=rldot1xAuthMultiBackendAccessChallenges, rldot1xExtAuthSessionStatsTable=rldot1xExtAuthSessionStatsTable, rldot1xLockedCientsTable=rldot1xLockedCientsTable, rldot1xAuthMultiEapolLogoffFramesRx=rldot1xAuthMultiEapolLogoffFramesRx, rldot1xAuthMultiEapLengthErrorFramesRx=rldot1xAuthMultiEapLengthErrorFramesRx, rldot1xAuthMultiSessionOctetsTx=rldot1xAuthMultiSessionOctetsTx, rlDot1xAuthMultiSessionMethodType=rlDot1xAuthMultiSessionMethodType, rldot1xSystemAuthControlMonitorVlan=rldot1xSystemAuthControlMonitorVlan, rldot1xAuthMultiInvalidEapolFramesRx=rldot1xAuthMultiInvalidEapolFramesRx, rldot1xAuthMultiBackendOtherRequestsToSupplicant=rldot1xAuthMultiBackendOtherRequestsToSupplicant, rldot1xAuthMultiSessionFramesRx=rldot1xAuthMultiSessionFramesRx, rldot1xAuthMultiConfigEntry=rldot1xAuthMultiConfigEntry, rldot1xLockedCientsPortNumber=rldot1xLockedCientsPortNumber, rldot1xAuthMultiBackendAuthState=rldot1xAuthMultiBackendAuthState, rldot1xMacAuthSuccessTrapEnabled=rldot1xMacAuthSuccessTrapEnabled, rldot1xAuthMultiSessionStatsTable=rldot1xAuthMultiSessionStatsTable, rldot1xAuthMultiConfigTable=rldot1xAuthMultiConfigTable, rldot1xMacWebAuthFailureTrapEnabled=rldot1xMacWebAuthFailureTrapEnabled, rldot1xLegacyPortEntry=rldot1xLegacyPortEntry, rldot1xAuthMultiControlledPortStatus=rldot1xAuthMultiControlledPortStatus, rldot1xAuthenticationPortEntry=rldot1xAuthenticationPortEntry, rldot1xAuthMultiBackendResponses=rldot1xAuthMultiBackendResponses, rldot1xAuthMultiStatsTable=rldot1xAuthMultiStatsTable, rldot1xBpduFilteringEnabled=rldot1xBpduFilteringEnabled, rldot1xAuthenticationPortMethod=rldot1xAuthenticationPortMethod)
| (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsUnion', 'ConstraintsIntersection')
(mac_address,) = mibBuilder.importSymbols('BRIDGE-MIB', 'MacAddress')
(pae_controlled_port_status, dot1x_auth_session_stats_entry, dot1x_pae_port_number) = mibBuilder.importSymbols('IEEE8021-PAE-MIB', 'PaeControlledPortStatus', 'dot1xAuthSessionStatsEntry', 'dot1xPaePortNumber')
(port_list, dot1q_fdb_id, vlan_index) = mibBuilder.importSymbols('Q-BRIDGE-MIB', 'PortList', 'dot1qFdbId', 'VlanIndex')
(rnd,) = mibBuilder.importSymbols('RADLAN-MIB', 'rnd')
(snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(iso, module_identity, integer32, gauge32, object_identity, counter64, ip_address, bits, mib_identifier, mib_scalar, mib_table, mib_table_row, mib_table_column, unsigned32, notification_type, time_ticks, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'iso', 'ModuleIdentity', 'Integer32', 'Gauge32', 'ObjectIdentity', 'Counter64', 'IpAddress', 'Bits', 'MibIdentifier', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Unsigned32', 'NotificationType', 'TimeTicks', 'Counter32')
(textual_convention, truth_value, row_status, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'TruthValue', 'RowStatus', 'DisplayString')
rldot1x = module_identity((1, 3, 6, 1, 4, 1, 89, 95))
rldot1x.setRevisions(('2007-01-02 00:00',))
if mibBuilder.loadTexts:
rldot1x.setLastUpdated('200701020000Z')
if mibBuilder.loadTexts:
rldot1x.setOrganization('Radlan - a MARVELL company. Marvell Semiconductor, Inc.')
rldot1x_mib_version = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xMibVersion.setStatus('current')
rldot1x_ext_auth_session_stats_table = mib_table((1, 3, 6, 1, 4, 1, 89, 95, 2))
if mibBuilder.loadTexts:
rldot1xExtAuthSessionStatsTable.setStatus('current')
rldot1x_ext_auth_session_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 89, 95, 2, 1))
dot1xAuthSessionStatsEntry.registerAugmentions(('RADLAN-DOT1X-MIB', 'rldot1xExtAuthSessionStatsEntry'))
rldot1xExtAuthSessionStatsEntry.setIndexNames(*dot1xAuthSessionStatsEntry.getIndexNames())
if mibBuilder.loadTexts:
rldot1xExtAuthSessionStatsEntry.setStatus('current')
rl_dot1x_auth_session_authentic_method = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 2, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('remoteAuthServer', 1), ('localAuthServer', 2), ('none', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rlDot1xAuthSessionAuthenticMethod.setStatus('current')
rldot1x_guest_vlan_supported = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 3), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xGuestVlanSupported.setStatus('current')
rldot1x_guest_vlan_vid = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 4), vlan_index()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xGuestVlanVID.setStatus('current')
rldot1x_guest_vlan_ports = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 5), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xGuestVlanPorts.setStatus('current')
rldot1x_un_authenticated_vlan_supported = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 6), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xUnAuthenticatedVlanSupported.setStatus('current')
rldot1x_un_authenticated_vlan_table = mib_table((1, 3, 6, 1, 4, 1, 89, 95, 7))
if mibBuilder.loadTexts:
rldot1xUnAuthenticatedVlanTable.setStatus('current')
rldot1x_un_authenticated_vlan_entry = mib_table_row((1, 3, 6, 1, 4, 1, 89, 95, 7, 1)).setIndexNames((0, 'Q-BRIDGE-MIB', 'dot1qFdbId'))
if mibBuilder.loadTexts:
rldot1xUnAuthenticatedVlanEntry.setStatus('current')
rldot1x_un_authenticated_vlan_status = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 7, 1, 1), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
rldot1xUnAuthenticatedVlanStatus.setStatus('current')
rldot1x_user_based_vlan_supported = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 8), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xUserBasedVlanSupported.setStatus('current')
rldot1x_user_based_vlan_ports = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 9), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xUserBasedVlanPorts.setStatus('current')
rldot1x_authentication_port_table = mib_table((1, 3, 6, 1, 4, 1, 89, 95, 10))
if mibBuilder.loadTexts:
rldot1xAuthenticationPortTable.setStatus('current')
rldot1x_authentication_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 89, 95, 10, 1)).setIndexNames((0, 'IEEE8021-PAE-MIB', 'dot1xPaePortNumber'))
if mibBuilder.loadTexts:
rldot1xAuthenticationPortEntry.setStatus('current')
rldot1x_authentication_port_method = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('eapolOnly', 1), ('macAndEapol', 2), ('macOnly', 3), ('webOnly', 4), ('webAndEapol', 5), ('webAndMac', 6), ('webAndMacAndEapol', 7))).clone('eapolOnly')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xAuthenticationPortMethod.setStatus('current')
rldot1x_radius_attr_vlan_id_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 2), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xRadiusAttrVlanIdEnabled.setStatus('current')
rldot1x_radius_att_acl_name_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 3), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xRadiusAttAclNameEnabled.setStatus('current')
rldot1x_time_based_name = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 4), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xTimeBasedName.setStatus('current')
rldot1x_time_based_active = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 5), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xTimeBasedActive.setStatus('current')
rldot1x_radius_attr_vlan_identifier = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 6), vlan_index()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xRadiusAttrVlanIdentifier.setStatus('current')
rldot1x_max_hosts = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 7), unsigned32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xMaxHosts.setStatus('current')
rldot1x_max_login_attempts = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(0, 10))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xMaxLoginAttempts.setStatus('current')
rldot1x_timeout_silence_period = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xTimeoutSilencePeriod.setStatus('current')
rldot1x_num_of_authorized_hosts = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 10), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xNumOfAuthorizedHosts.setStatus('current')
rldot1x_authentication_open_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 10, 1, 11), truth_value().clone('false')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xAuthenticationOpenEnabled.setStatus('current')
rldot1x_auth_multi_stats_table = mib_table((1, 3, 6, 1, 4, 1, 89, 95, 11))
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsTable.setStatus('current')
rldot1x_auth_multi_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 89, 95, 11, 1)).setIndexNames((0, 'RADLAN-DOT1X-MIB', 'rldot1xAuthMultiStatsPortNumber'), (0, 'RADLAN-DOT1X-MIB', 'rldot1xAuthMultiStatsSourceMac'))
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsEntry.setStatus('current')
rldot1x_auth_multi_stats_port_number = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsPortNumber.setStatus('current')
rldot1x_auth_multi_stats_source_mac = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiStatsSourceMac.setStatus('current')
rldot1x_auth_multi_eapol_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolFramesRx.setStatus('current')
rldot1x_auth_multi_eapol_frames_tx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolFramesTx.setStatus('current')
rldot1x_auth_multi_eapol_start_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolStartFramesRx.setStatus('current')
rldot1x_auth_multi_eapol_logoff_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolLogoffFramesRx.setStatus('current')
rldot1x_auth_multi_eapol_resp_id_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolRespIdFramesRx.setStatus('current')
rldot1x_auth_multi_eapol_resp_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolRespFramesRx.setStatus('current')
rldot1x_auth_multi_eapol_req_id_frames_tx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolReqIdFramesTx.setStatus('current')
rldot1x_auth_multi_eapol_req_frames_tx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapolReqFramesTx.setStatus('current')
rldot1x_auth_multi_invalid_eapol_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiInvalidEapolFramesRx.setStatus('current')
rldot1x_auth_multi_eap_length_error_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 11, 1, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEapLengthErrorFramesRx.setStatus('current')
rldot1x_auth_multi_diag_table = mib_table((1, 3, 6, 1, 4, 1, 89, 95, 12))
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagTable.setStatus('current')
rldot1x_auth_multi_diag_entry = mib_table_row((1, 3, 6, 1, 4, 1, 89, 95, 12, 1)).setIndexNames((0, 'RADLAN-DOT1X-MIB', 'rldot1xAuthMultiDiagPortNumber'), (0, 'RADLAN-DOT1X-MIB', 'rldot1xAuthMultiDiagSourceMac'))
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagEntry.setStatus('current')
rldot1x_auth_multi_diag_port_number = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagPortNumber.setStatus('current')
rldot1x_auth_multi_diag_source_mac = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiDiagSourceMac.setStatus('current')
rldot1x_auth_multi_enters_connecting = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEntersConnecting.setStatus('current')
rldot1x_auth_multi_enters_authenticating = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiEntersAuthenticating.setStatus('current')
rldot1x_auth_multi_auth_success_while_authenticating = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthSuccessWhileAuthenticating.setStatus('current')
rldot1x_auth_multi_auth_fail_while_authenticating = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthFailWhileAuthenticating.setStatus('current')
rldot1x_auth_multi_auth_reauths_while_authenticating = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthReauthsWhileAuthenticating.setStatus('current')
rldot1x_auth_multi_auth_eap_starts_while_authenticating = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthEapStartsWhileAuthenticating.setStatus('current')
rldot1x_auth_multi_auth_reauths_while_authenticated = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthReauthsWhileAuthenticated.setStatus('current')
rldot1x_auth_multi_auth_eap_starts_while_authenticated = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiAuthEapStartsWhileAuthenticated.setStatus('current')
rldot1x_auth_multi_backend_responses = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendResponses.setStatus('current')
rldot1x_auth_multi_backend_access_challenges = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendAccessChallenges.setStatus('current')
rldot1x_auth_multi_backend_other_requests_to_supplicant = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 13), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendOtherRequestsToSupplicant.setStatus('current')
rldot1x_auth_multi_backend_non_nak_responses_from_supplicant = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 14), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendNonNakResponsesFromSupplicant.setStatus('current')
rldot1x_auth_multi_backend_auth_successes = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 12, 1, 15), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendAuthSuccesses.setStatus('current')
rldot1x_auth_multi_session_stats_table = mib_table((1, 3, 6, 1, 4, 1, 89, 95, 13))
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsTable.setStatus('current')
rldot1x_auth_multi_session_stats_entry = mib_table_row((1, 3, 6, 1, 4, 1, 89, 95, 13, 1)).setIndexNames((0, 'RADLAN-DOT1X-MIB', 'rldot1xAuthMultiSessionStatsPortNumber'), (0, 'RADLAN-DOT1X-MIB', 'rldot1xAuthMultiSessionStatsSourceMac'))
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsEntry.setStatus('current')
rldot1x_auth_multi_session_stats_port_number = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsPortNumber.setStatus('current')
rldot1x_auth_multi_session_stats_source_mac = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionStatsSourceMac.setStatus('current')
rldot1x_auth_multi_session_octets_rx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 3), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionOctetsRx.setStatus('current')
rldot1x_auth_multi_session_octets_tx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 4), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionOctetsTx.setStatus('current')
rldot1x_auth_multi_session_frames_rx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionFramesRx.setStatus('current')
rldot1x_auth_multi_session_frames_tx = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionFramesTx.setStatus('current')
rldot1x_auth_multi_session_id = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 7), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionId.setStatus('current')
rldot1x_auth_multi_session_time = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 8), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionTime.setStatus('current')
rldot1x_auth_multi_session_user_name = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 9), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionUserName.setStatus('current')
rldot1x_auth_multi_session_radius_attr_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 10), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionRadiusAttrVlan.setStatus('current')
rldot1x_auth_multi_session_radius_attr_filter_id = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 11), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionRadiusAttrFilterId.setStatus('current')
rldot1x_auth_multi_session_radius_attr_second_filter_id = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 12), snmp_admin_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSessionRadiusAttrSecondFilterId.setStatus('current')
rl_dot1x_auth_multi_session_monitor_results_reason = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24))).clone(namedValues=named_values(('notRejected', 0), ('aclNotExst', 1), ('aclOvrfl', 2), ('authErr', 3), ('fltrErr', 4), ('ipv6WithMac', 5), ('ipv6WithNotIp', 6), ('polBasicMode', 7), ('aclDel', 8), ('polDel', 9), ('vlanDfly', 10), ('vlanDynam', 11), ('vlanGuest', 12), ('vlanNoInMsg', 13), ('vlanNotExst', 14), ('vlanOvfl', 15), ('vlanVoice', 16), ('vlanUnauth', 17), ('frsMthDeny', 18), ('radApierr', 19), ('radInvlres', 20), ('radNoresp', 21), ('aclEgress', 22), ('maxHosts', 23), ('noActivity', 24)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rlDot1xAuthMultiSessionMonitorResultsReason.setStatus('current')
rl_dot1x_auth_multi_session_method_type = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 13, 1, 14), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('eapol', 1), ('mac', 2), ('web', 3)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rlDot1xAuthMultiSessionMethodType.setStatus('current')
rldot1x_auth_multi_config_table = mib_table((1, 3, 6, 1, 4, 1, 89, 95, 14))
if mibBuilder.loadTexts:
rldot1xAuthMultiConfigTable.setStatus('current')
rldot1x_auth_multi_config_entry = mib_table_row((1, 3, 6, 1, 4, 1, 89, 95, 14, 1)).setIndexNames((0, 'RADLAN-DOT1X-MIB', 'rldot1xAuthMultiPortNumber'), (0, 'RADLAN-DOT1X-MIB', 'rldot1xAuthMultiSourceMac'))
if mibBuilder.loadTexts:
rldot1xAuthMultiConfigEntry.setStatus('current')
rldot1x_auth_multi_port_number = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiPortNumber.setStatus('current')
rldot1x_auth_multi_source_mac = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiSourceMac.setStatus('current')
rldot1x_auth_multi_pae_state = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9))).clone(namedValues=named_values(('initialize', 1), ('disconnected', 2), ('connecting', 3), ('authenticating', 4), ('authenticated', 5), ('aborting', 6), ('held', 7), ('forceAuth', 8), ('forceUnauth', 9)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiPaeState.setStatus('current')
rldot1x_auth_multi_backend_auth_state = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('request', 1), ('response', 2), ('success', 3), ('fail', 4), ('timeout', 5), ('idle', 6), ('initialize', 7)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiBackendAuthState.setStatus('current')
rldot1x_auth_multi_controlled_port_status = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 14, 1, 5), pae_controlled_port_status()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xAuthMultiControlledPortStatus.setStatus('current')
rldot1x_bpdu_filtering_enabled = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 15), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xBpduFilteringEnabled.setStatus('current')
rldot1x_radius_attributes_errors_acl_reject = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 18), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xRadiusAttributesErrorsAclReject.setStatus('current')
rldot1x_guest_vlan_time_interval = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 19), integer32().subtype(subtypeSpec=value_range_constraint(0, 180))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xGuestVlanTimeInterval.setStatus('current')
rldot1x_mac_auth_success_trap_enabled = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 20), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xMacAuthSuccessTrapEnabled.setStatus('current')
rldot1x_mac_auth_failure_trap_enabled = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 21), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xMacAuthFailureTrapEnabled.setStatus('current')
rldot1x_legacy_port_table = mib_table((1, 3, 6, 1, 4, 1, 89, 95, 22))
if mibBuilder.loadTexts:
rldot1xLegacyPortTable.setStatus('current')
rldot1x_legacy_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 89, 95, 22, 1)).setIndexNames((0, 'IEEE8021-PAE-MIB', 'dot1xPaePortNumber'))
if mibBuilder.loadTexts:
rldot1xLegacyPortEntry.setStatus('current')
rldot1x_legacy_port_mode_enabled = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 22, 1, 1), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xLegacyPortModeEnabled.setStatus('current')
rldot1x_system_auth_control_monitor_vlan = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 23), integer32().subtype(subtypeSpec=value_range_constraint(0, 4094))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xSystemAuthControlMonitorVlan.setStatus('current')
rldot1x_clear_port_mib_counters = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 24), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xClearPortMibCounters.setStatus('current')
rldot1x_web_quiet_failure_trap_enabled = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 25), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xWebQuietFailureTrapEnabled.setStatus('current')
rldot1x_mac_web_auth_success_trap_enabled = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 26), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('none', 0), ('eapolOnly', 1), ('macAndEapol', 2), ('macOnly', 3), ('webOnly', 4), ('webAndEapol', 5), ('webAndMac', 6), ('webAndMacAndEapol', 7)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xMacWebAuthSuccessTrapEnabled.setStatus('current')
rldot1x_mac_web_auth_failure_trap_enabled = mib_scalar((1, 3, 6, 1, 4, 1, 89, 95, 27), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('none', 0), ('eapolOnly', 1), ('macAndEapol', 2), ('macOnly', 3), ('webOnly', 4), ('webAndEapol', 5), ('webAndMac', 6), ('webAndMacAndEapol', 7)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xMacWebAuthFailureTrapEnabled.setStatus('current')
rldot1x_locked_cients_table = mib_table((1, 3, 6, 1, 4, 1, 89, 95, 28))
if mibBuilder.loadTexts:
rldot1xLockedCientsTable.setStatus('current')
rldot1x_locked_cients_entry = mib_table_row((1, 3, 6, 1, 4, 1, 89, 95, 28, 1)).setIndexNames((0, 'RADLAN-DOT1X-MIB', 'rldot1xLockedCientsPortNumber'), (0, 'RADLAN-DOT1X-MIB', 'rldot1xLockedCientsSourceMac'))
if mibBuilder.loadTexts:
rldot1xLockedCientsEntry.setStatus('current')
rldot1x_locked_cients_port_number = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 28, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xLockedCientsPortNumber.setStatus('current')
rldot1x_locked_cients_source_mac = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 28, 1, 2), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xLockedCientsSourceMac.setStatus('current')
rldot1x_locked_cients_remained_time = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 28, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
rldot1xLockedCientsRemainedTime.setStatus('current')
rldot1x_locked_cients_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 89, 95, 28, 1, 4), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
rldot1xLockedCientsRowStatus.setStatus('current')
mibBuilder.exportSymbols('RADLAN-DOT1X-MIB', rldot1xAuthMultiAuthReauthsWhileAuthenticated=rldot1xAuthMultiAuthReauthsWhileAuthenticated, rldot1xAuthMultiStatsEntry=rldot1xAuthMultiStatsEntry, rldot1xAuthMultiStatsSourceMac=rldot1xAuthMultiStatsSourceMac, rldot1xWebQuietFailureTrapEnabled=rldot1xWebQuietFailureTrapEnabled, rlDot1xAuthSessionAuthenticMethod=rlDot1xAuthSessionAuthenticMethod, rldot1xAuthMultiEapolReqFramesTx=rldot1xAuthMultiEapolReqFramesTx, rldot1xAuthMultiEapolRespIdFramesRx=rldot1xAuthMultiEapolRespIdFramesRx, rldot1xAuthMultiDiagEntry=rldot1xAuthMultiDiagEntry, rldot1xAuthMultiSessionStatsSourceMac=rldot1xAuthMultiSessionStatsSourceMac, rldot1xAuthMultiAuthReauthsWhileAuthenticating=rldot1xAuthMultiAuthReauthsWhileAuthenticating, rldot1xLockedCientsRowStatus=rldot1xLockedCientsRowStatus, PYSNMP_MODULE_ID=rldot1x, rldot1xAuthMultiDiagTable=rldot1xAuthMultiDiagTable, rldot1xMacWebAuthSuccessTrapEnabled=rldot1xMacWebAuthSuccessTrapEnabled, rldot1xAuthenticationPortTable=rldot1xAuthenticationPortTable, rldot1xLockedCientsSourceMac=rldot1xLockedCientsSourceMac, rldot1xUnAuthenticatedVlanStatus=rldot1xUnAuthenticatedVlanStatus, rldot1xLockedCientsEntry=rldot1xLockedCientsEntry, rldot1xClearPortMibCounters=rldot1xClearPortMibCounters, rldot1xAuthMultiEapolRespFramesRx=rldot1xAuthMultiEapolRespFramesRx, rldot1xAuthMultiAuthFailWhileAuthenticating=rldot1xAuthMultiAuthFailWhileAuthenticating, rldot1xAuthMultiSessionStatsEntry=rldot1xAuthMultiSessionStatsEntry, rldot1xExtAuthSessionStatsEntry=rldot1xExtAuthSessionStatsEntry, rldot1xAuthMultiAuthSuccessWhileAuthenticating=rldot1xAuthMultiAuthSuccessWhileAuthenticating, rldot1xAuthMultiSessionTime=rldot1xAuthMultiSessionTime, rldot1xAuthMultiBackendAuthSuccesses=rldot1xAuthMultiBackendAuthSuccesses, rldot1xUnAuthenticatedVlanEntry=rldot1xUnAuthenticatedVlanEntry, rldot1xAuthMultiEapolStartFramesRx=rldot1xAuthMultiEapolStartFramesRx, rldot1xUserBasedVlanSupported=rldot1xUserBasedVlanSupported, rldot1xAuthMultiEapolReqIdFramesTx=rldot1xAuthMultiEapolReqIdFramesTx, rldot1xMaxLoginAttempts=rldot1xMaxLoginAttempts, rldot1xNumOfAuthorizedHosts=rldot1xNumOfAuthorizedHosts, rldot1xGuestVlanVID=rldot1xGuestVlanVID, rldot1xUnAuthenticatedVlanSupported=rldot1xUnAuthenticatedVlanSupported, rldot1xAuthMultiPortNumber=rldot1xAuthMultiPortNumber, rldot1xMaxHosts=rldot1xMaxHosts, rldot1xAuthMultiAuthEapStartsWhileAuthenticated=rldot1xAuthMultiAuthEapStartsWhileAuthenticated, rldot1xLegacyPortTable=rldot1xLegacyPortTable, rldot1xAuthMultiPaeState=rldot1xAuthMultiPaeState, rldot1xAuthMultiSessionId=rldot1xAuthMultiSessionId, rldot1xAuthMultiSessionRadiusAttrVlan=rldot1xAuthMultiSessionRadiusAttrVlan, rldot1xAuthMultiDiagPortNumber=rldot1xAuthMultiDiagPortNumber, rldot1xAuthMultiSessionUserName=rldot1xAuthMultiSessionUserName, rldot1xAuthMultiEntersAuthenticating=rldot1xAuthMultiEntersAuthenticating, rldot1xAuthMultiEntersConnecting=rldot1xAuthMultiEntersConnecting, rldot1xAuthMultiBackendNonNakResponsesFromSupplicant=rldot1xAuthMultiBackendNonNakResponsesFromSupplicant, rldot1x=rldot1x, rldot1xAuthMultiSessionFramesTx=rldot1xAuthMultiSessionFramesTx, rldot1xRadiusAttrVlanIdEnabled=rldot1xRadiusAttrVlanIdEnabled, rldot1xMibVersion=rldot1xMibVersion, rldot1xAuthMultiSessionRadiusAttrFilterId=rldot1xAuthMultiSessionRadiusAttrFilterId, rldot1xAuthenticationOpenEnabled=rldot1xAuthenticationOpenEnabled, rldot1xAuthMultiEapolFramesRx=rldot1xAuthMultiEapolFramesRx, rldot1xGuestVlanSupported=rldot1xGuestVlanSupported, rldot1xRadiusAttrVlanIdentifier=rldot1xRadiusAttrVlanIdentifier, rldot1xRadiusAttAclNameEnabled=rldot1xRadiusAttAclNameEnabled, rldot1xUserBasedVlanPorts=rldot1xUserBasedVlanPorts, rldot1xAuthMultiSessionRadiusAttrSecondFilterId=rldot1xAuthMultiSessionRadiusAttrSecondFilterId, rldot1xTimeoutSilencePeriod=rldot1xTimeoutSilencePeriod, rldot1xGuestVlanPorts=rldot1xGuestVlanPorts, rldot1xMacAuthFailureTrapEnabled=rldot1xMacAuthFailureTrapEnabled, rlDot1xAuthMultiSessionMonitorResultsReason=rlDot1xAuthMultiSessionMonitorResultsReason, rldot1xAuthMultiEapolFramesTx=rldot1xAuthMultiEapolFramesTx, rldot1xAuthMultiStatsPortNumber=rldot1xAuthMultiStatsPortNumber, rldot1xTimeBasedName=rldot1xTimeBasedName, rldot1xAuthMultiSessionOctetsRx=rldot1xAuthMultiSessionOctetsRx, rldot1xGuestVlanTimeInterval=rldot1xGuestVlanTimeInterval, rldot1xLegacyPortModeEnabled=rldot1xLegacyPortModeEnabled, rldot1xAuthMultiDiagSourceMac=rldot1xAuthMultiDiagSourceMac, rldot1xAuthMultiAuthEapStartsWhileAuthenticating=rldot1xAuthMultiAuthEapStartsWhileAuthenticating, rldot1xAuthMultiSessionStatsPortNumber=rldot1xAuthMultiSessionStatsPortNumber, rldot1xUnAuthenticatedVlanTable=rldot1xUnAuthenticatedVlanTable, rldot1xRadiusAttributesErrorsAclReject=rldot1xRadiusAttributesErrorsAclReject, rldot1xLockedCientsRemainedTime=rldot1xLockedCientsRemainedTime, rldot1xTimeBasedActive=rldot1xTimeBasedActive, rldot1xAuthMultiSourceMac=rldot1xAuthMultiSourceMac, rldot1xAuthMultiBackendAccessChallenges=rldot1xAuthMultiBackendAccessChallenges, rldot1xExtAuthSessionStatsTable=rldot1xExtAuthSessionStatsTable, rldot1xLockedCientsTable=rldot1xLockedCientsTable, rldot1xAuthMultiEapolLogoffFramesRx=rldot1xAuthMultiEapolLogoffFramesRx, rldot1xAuthMultiEapLengthErrorFramesRx=rldot1xAuthMultiEapLengthErrorFramesRx, rldot1xAuthMultiSessionOctetsTx=rldot1xAuthMultiSessionOctetsTx, rlDot1xAuthMultiSessionMethodType=rlDot1xAuthMultiSessionMethodType, rldot1xSystemAuthControlMonitorVlan=rldot1xSystemAuthControlMonitorVlan, rldot1xAuthMultiInvalidEapolFramesRx=rldot1xAuthMultiInvalidEapolFramesRx, rldot1xAuthMultiBackendOtherRequestsToSupplicant=rldot1xAuthMultiBackendOtherRequestsToSupplicant, rldot1xAuthMultiSessionFramesRx=rldot1xAuthMultiSessionFramesRx, rldot1xAuthMultiConfigEntry=rldot1xAuthMultiConfigEntry, rldot1xLockedCientsPortNumber=rldot1xLockedCientsPortNumber, rldot1xAuthMultiBackendAuthState=rldot1xAuthMultiBackendAuthState, rldot1xMacAuthSuccessTrapEnabled=rldot1xMacAuthSuccessTrapEnabled, rldot1xAuthMultiSessionStatsTable=rldot1xAuthMultiSessionStatsTable, rldot1xAuthMultiConfigTable=rldot1xAuthMultiConfigTable, rldot1xMacWebAuthFailureTrapEnabled=rldot1xMacWebAuthFailureTrapEnabled, rldot1xLegacyPortEntry=rldot1xLegacyPortEntry, rldot1xAuthMultiControlledPortStatus=rldot1xAuthMultiControlledPortStatus, rldot1xAuthenticationPortEntry=rldot1xAuthenticationPortEntry, rldot1xAuthMultiBackendResponses=rldot1xAuthMultiBackendResponses, rldot1xAuthMultiStatsTable=rldot1xAuthMultiStatsTable, rldot1xBpduFilteringEnabled=rldot1xBpduFilteringEnabled, rldot1xAuthenticationPortMethod=rldot1xAuthenticationPortMethod) |
def find_minor(arr):
minor = arr[0]
minor_index = 0
for i in range(0, len(arr)):
if arr[i] < minor:
minor = arr[i]
minor_index = i
return minor_index
def ordenation_by_selection(arr):
new_arr = []
for i in range(0, len(arr)):
minor = find_minor(arr)
new_arr.append(arr.pop(minor))
return new_arr
print(ordenation_by_selection([5, 2, 1, 4, 3, 6, 9, 7, 8])) | def find_minor(arr):
minor = arr[0]
minor_index = 0
for i in range(0, len(arr)):
if arr[i] < minor:
minor = arr[i]
minor_index = i
return minor_index
def ordenation_by_selection(arr):
new_arr = []
for i in range(0, len(arr)):
minor = find_minor(arr)
new_arr.append(arr.pop(minor))
return new_arr
print(ordenation_by_selection([5, 2, 1, 4, 3, 6, 9, 7, 8])) |
name = 'Phennyfyxata. http://phenny.venefyxatu.be'
nick = 'Phennyfyxata'
host = 'irc.freenode.net'
channels = ['#dutchnano', '#venefyxatu']
#channels = ['#venefyxatu']
owner = 'venefyxatu'
password = 'PLACEHOLDER_PASSWORD'
# This isn't implemented yet:
# serverpass = 'yourserverpassword'
# These are people who will be able to use admin.py's functions...
admins = [owner] # strings with other nicknames
# But admin.py is disabled by default, as follows:
#exclude = ['admin']
# If you want to enumerate a list of modules rather than disabling
# some, use "enable = ['example']", which takes precedent over exclude
#
# enable = []
# Directories to load opt modules from
extra = []
# Services to load: maps channel names to white or black lists
external = {
'#dutchnano': ['!'], # allow all
'#venefyxatu': ['!'],
'#conservative': [], # allow none
'*': ['py', 'whois', 'glyph'], # default whitelist
}
# EOF
tell_filename = "/home/venefyatu/tellfile"
| name = 'Phennyfyxata. http://phenny.venefyxatu.be'
nick = 'Phennyfyxata'
host = 'irc.freenode.net'
channels = ['#dutchnano', '#venefyxatu']
owner = 'venefyxatu'
password = 'PLACEHOLDER_PASSWORD'
admins = [owner]
extra = []
external = {'#dutchnano': ['!'], '#venefyxatu': ['!'], '#conservative': [], '*': ['py', 'whois', 'glyph']}
tell_filename = '/home/venefyatu/tellfile' |
expected_output = {
"trustpoints": {
"TP-self-signed-4146203551": {
"associated_trustpoints": {
"router_self_signed_certificate": {
"issuer": {"cn": "IOS-Self-Signed-Certificate-4146203551"},
"serial_number_in_hex": "01",
"status": "Available",
"storage": "nvram:IOS-Self-Sig#1.cer",
"subject": {
"cn": "IOS-Self-Signed-Certificate-4146203551",
"name": "IOS-Self-Signed-Certificate-4146203551",
},
"usage": "General Purpose",
"validity_date": {
"end_date": "00:00:00 UTC Jan 1 2020",
"start_date": "21:37:27 UTC Apr 23 2018",
},
}
}
}
}
}
| expected_output = {'trustpoints': {'TP-self-signed-4146203551': {'associated_trustpoints': {'router_self_signed_certificate': {'issuer': {'cn': 'IOS-Self-Signed-Certificate-4146203551'}, 'serial_number_in_hex': '01', 'status': 'Available', 'storage': 'nvram:IOS-Self-Sig#1.cer', 'subject': {'cn': 'IOS-Self-Signed-Certificate-4146203551', 'name': 'IOS-Self-Signed-Certificate-4146203551'}, 'usage': 'General Purpose', 'validity_date': {'end_date': '00:00:00 UTC Jan 1 2020', 'start_date': '21:37:27 UTC Apr 23 2018'}}}}}} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.