content
stringlengths 7
1.05M
|
---|
#!/usr/bin/env python
def bubble_search_func(data_list):
cnt_num_all = len(data_list)
for i in range(cnt_num_all-1):
for j in range(1,cnt_num_all-i):
if(data_list[j-1]>data_list[j]):
data_list[j-1],data_list[j]=data_list[j],data_list[j-1]
data_list = [54, 25, 93, 17, 77, 31, 44, 55, 20, 10]
bubble_search_func(data_list)
print(data_list)
|
entries = [
{
'env-title': 'atari-enduro',
'score': 207.47,
},
{
'env-title': 'atari-space-invaders',
'score': 459.89,
},
{
'env-title': 'atari-qbert',
'score': 7184.73,
},
{
'env-title': 'atari-seaquest',
'score': 1383.38,
},
{
'env-title': 'atari-pong',
'score': 13.9,
},
{
'env-title': 'atari-beam-rider',
'score': 594.45,
},
{
'env-title': 'atari-breakout',
'score': 81.61,
},
]
|
class Solution:
def diStringMatch(self, S):
low,high=0,len(S)
ans=[]
for i in S:
if i=="I":
ans.append(low)
low+=1
else:
ans.append(high)
high-=1
return ans +[low]
|
# 二叉树中序遍历的 生成器写法
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def mid_order(root):
if not root: return
yield from mid_order(root.left)
yield root.val
yield from mid_order(root.right)
|
def factorielle_rec(n: int) -> int:
"""
Description:
Factorielle méthode récursive
Paramètres:
n: {int} -- Nombre à factorielle
Retourne:
{int} -- Factorielle de n
Exemple:
>>> factorielle_rec(100)
9.332622e+157
Pour l'écriture scientifique: f"{factorielle_rec(100):e}"
"""
return 1 if n == 0 else n * factorielle_rec(n - 1)
def factorielle_it(n: int) -> int:
"""
Description:
Factorielle méthode itérative
Paramètres:
n: {int} -- Nombre à factorielle
Retourne:
{int} -- Factorielle de n
Exemple:
>>> factorielle_it(100)
9.332622e+157
Pour l'écriture scientifique: f"{factorielle_it(100):e}"
"""
result = 1
for i in range(1, n + 1):
result *= i
return result |
def main() -> None:
s = input()
print(s * (6 // len(s)))
if __name__ == "__main__":
main()
|
'''
Вводится последовательность из N чисел. Найти произведение и
количество положительных среди них чисел
'''
proizvedenie = 1
a = input().split(" ")
for i in range(0, len(a)):
proizvedenie *= int(a[i])
print("Произведение " + str(proizvedenie))
print("Кол-во чисел " + str(len(a))) |
# 执行用时 : 348 ms
# 内存消耗 : 13 MB
# 方案:哈希表
class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
# 创建哈希表{value:idx}
record = {}
# 遍数组
for idx, value in enumerate(nums):
# 如果差值在哈希表中,返回对应索引 以及 循环中本次idx
# 如果差值不在,则在哈希表中插入该value:idx
if (target - value) in record.keys():
return [record[target - value], idx]
else:
record[value] = idx
|
"""Voce deve criar uma classe carro que vai assumir dois atributos compostos por duas classes:
1) Motor
2) Direcao
O motor terá a responsabilidade de controlar a velocidade.
Ele Oferece os seguintes atributos:
1) Atribuo de dado velocidade
2) Método acelerar, que deverá incrementar 1 unidade
3) Médoto freardecrementar a velocidade de 2 unidades
A Direcao tera a responsabilidade de controlar a direcao, ela oferece os seguintes atributos:
1) Valor de direcao com valores possiveis norte, sul, leste, oeste
2) Método girar a direita -
2) Método girar a esquerda
N
O L
S
exemplo:
# Testando motor
>>> motor = Motor()
>>> motor.velocidade
0
>>> motor.acelerar()
>>> motor.velocidade
1
>>> motor.acelerar()
>>> motor.velocidade
2
>>> motor.acelerar()
>>> motor.velocidade
3
>>> motor.frear()
>>> motor.velocidade
1
>>> motor.frear()
>>> motor.velocidade
0
>>> #Testando direcao
>>> direcao = Direcao()
>>> direcao.valor
'Norte'
>>> direcao.girar_a_direita()
>>> direcao.valor
'Leste'
>>> direcao.girar_a_direita()
>>> direcao.valor
'Sul'
>>> direcao.girar_a_direita()
>>> direcao.valor
'Oeste'
>>> direcao.girar_a_direita()
>>> direcao.valor
'Norte'
>>> direcao.girar_a_esquerda()
>>> direcao.valor
'Oeste'
>>> direcao.girar_a_esquerda()
>>> direcao.valor
'Sul'
>>> direcao.girar_a_esquerda()
>>> direcao.valor
'Leste'
>>> direcao.girar_a_esquerda()
>>> direcao.valor
'Norte'
>>> carro = Carro(direcao, motor)
>>> carro.calcular_velocidade()
0
>>> carro.acelerar()
>>> carro.calcular_velocidade()
1
>>> carro.acelerar()
>>> carro.calcular_velocidade()
2
>>> carro.frear()
>>> carro.calcular_velocidade()
0
>>> carro.calcular_direcao()
'Norte'
>>> carro.girar_a_direita()
>>> carro.calcular_direcao()
'Leste'
>>> carro.girar_a_esquerda()
>>> carro.calcular_direcao()
'Norte'
>>> carro.girar_a_esquerda()
>>> carro.calcular_direcao()
'Oeste'
"""
NORTE = 'Norte'
LESTE = 'Leste'
SUL = 'Sul'
OESTE = 'Oeste'
class Direcao:
def __init__(self):
self.valor = NORTE
def girar_a_direita(self):
if self.valor == NORTE:
self.valor = LESTE
elif self.valor == LESTE:
self.valor = SUL
elif self.valor == SUL:
self.valor = OESTE
elif self.valor == OESTE:
self.valor = NORTE
def girar_a_esquerda(self):
if self.valor == NORTE:
self.valor = OESTE
elif self.valor == OESTE:
self.valor = SUL
elif self.valor == SUL:
self.valor = LESTE
elif self.valor == LESTE:
self.valor = NORTE
class Carro:
def __init__(self, direcao, motor):
self.direcao = direcao
self.motor = motor
def calcular_velocidade(self):
return self.motor.velocidade
def acelerar(self):
self.motor.acelerar()
def frear(self):
self.motor.frear()
def calcular_direcao(self):
return self.direcao.valor
def girar_a_direita(self):
self.direcao.girar_a_direita()
def girar_a_esquerda(self):
self.direcao.girar_a_esquerda()
class Motor:
def __init__(self):
self.velocidade = 0
def acelerar(self):
self.velocidade += 1
def frear(self):
self.velocidade -= 2
self.velocidade = max(0, self.velocidade) |
def get_next_target(page):
start_link = page.find('<a href=')
if start_link == -1:
return None,0
else:
start_quote = page.find('"', start_link)
end_quote = page.find('"', start_quote + 1)
url = page[start_quote + 1:end_quote]
return url, end_quote
|
#
# @lc app=leetcode id=107 lang=python3
#
# [107] Binary Tree Level Order Traversal II
#
# https://leetcode.com/problems/binary-tree-level-order-traversal-ii/description/
#
# algorithms
# Easy (48.66%)
# Likes: 1105
# Dislikes: 201
# Total Accepted: 289.3K
# Total Submissions: 572.4K
# Testcase Example: '[3,9,20,null,null,15,7]'
#
# Given a binary tree, return the bottom-up level order traversal of its nodes'
# values. (ie, from left to right, level by level from leaf to root).
#
#
# For example:
# Given binary tree [3,9,20,null,null,15,7],
#
# 3
# / \
# 9 20
# / \
# 15 7
#
#
#
# return its bottom-up level order traversal as:
#
# [
# [15,7],
# [9,20],
# [3]
# ]
#
#
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def levelOrderBottom(self, root: TreeNode) -> List[List[int]]:
if not root:
return []
stack = deque([root])
ans = collections.deque()
while stack:
one,length = [],len(stack)
for _ in range(length):
node = stack.popleft()
one.append(node.val)
if node.left:
stack.append(node.left)
if node.right:
stack.append(node.right)
ans.appendleft(one)
return list(ans)
# @lc code=end
|
def test_socfaker_application_status(socfaker_fixture):
assert socfaker_fixture.application.status in ['Active', 'Inactive', 'Legacy']
def test_socfaker_application_account_status(socfaker_fixture):
assert socfaker_fixture.application.account_status in ['Enabled', 'Disabled']
def test_socfaker_name(socfaker_fixture):
assert socfaker_fixture.application.name
def test_socfaker_application_logon_timestamp(socfaker_fixture):
assert socfaker_fixture.application.logon_timestamp |
_base_ = [
'../_base_/models/retinanet_r50_fpn.py',
'../_base_/datasets/bdd100k_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
# optimizer
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
# model
model = dict(
bbox_head=dict(
num_classes=10, # bdd100k class number
)
)
# data loader
data = dict(
samples_per_gpu=4, # TODO samples pre gpu
workers_per_gpu=2,
)
|
"""
You are given an integer array nums and an integer k.
In one operation, you can pick two numbers from the array whose sum equals k and remove them from the array.
Return the maximum number of operations you can perform on the array.
Example 1:
Input: nums = [1,2,3,4], k = 5
Output: 2
Explanation: Starting with nums = [1,2,3,4]:
- Remove numbers 1 and 4, then nums = [2,3]
- Remove numbers 2 and 3, then nums = []
There are no more pairs that sum up to 5, hence a total of 2 operations.
Example 2:
Input: nums = [3,1,3,4,3], k = 6
Output: 1
Explanation: Starting with nums = [3,1,3,4,3]:
- Remove the first two 3's, then nums = [1,4,3]
There are no more pairs that sum up to 6, hence a total of 1 operation.
Constraints:
1 <= nums.length <= 105
1 <= nums[i] <= 109
1 <= k <= 109
"""
class Solution:
def maxOperations(self, nums: List[int], k: int) -> int:
c = collections.Counter(nums)
r = 0
for n, v in c.items():
t = k - n
if t not in c:
continue
if t == n:
m = v // 2
r += m
c[n] = v - m
continue
m = min(v, c[t])
r += m
c[n] = v - m
c[t] = c[t] - m
return r |
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def buildTree(self, inorder, postorder):
"""
:type preorder: List[int]
:type inorder: List[int]
:rtype: TreeNode
"""
def buildChildTree(inIndex, postIndex, length):
if length == 0:
return None
root = TreeNode(postorder[postIndex])
count = 0
while inorder[inIndex+count] != postorder[postIndex]:
count += 1
root.left = buildChildTree(inIndex, postIndex-length+count, count)
root.right = buildChildTree(inIndex+count+1, postIndex-1, length-count-1)
return root
return buildChildTree(0, len(postorder)-1, len(postorder)) |
class InterfaceWriter(object):
def __init__(self, output_path):
self._output_path_template = output_path + '/_{key}_{subsystem}.i'
self._fp = {
'pre': {},
'post': {},
}
def _write(self, key, subsystem, text):
subsystem = subsystem.lower()
fp = self._fp[key].get(subsystem)
if fp is None:
self._fp[key][subsystem] = fp = open(self._output_path_template.format(key=key, subsystem=subsystem), 'w+')
fp.write(text)
fp.write('\n')
def write_pre(self, subsystem, text):
self._write('pre', subsystem, text)
def write_post(self, subsystem, text):
self._write('post', subsystem, text)
def close(self):
for fp_map in self._fp.values():
for fp in fp_map.values():
fp.close()
|
# Format of training prompt
defaultPrompt = """I am a Cardiologist. My patient asked me what this means:
Input: Normal left ventricular size and systolic function. EF > 55 %. Normal right ventricular size and systolic function. Normal valve structure and function
Output: Normal pumping function of the left and right side of the heart. Heart valves are normal
-
Input: {}
Output:"""
|
abilities = {1: 'Stench', 2: 'Drizzle', 3: 'Speed Boost', 4: 'Battle Armor', 5: 'Sturdy', 6: 'Damp', 7: 'Limber',
8: 'Sand Veil', 9: 'Static', 10: 'Volt Absorb', 11: 'Water Absorb', 12: 'Oblivious', 13: 'Cloud Nine',
14: 'Compound Eyes', 15: 'Insomnia', 16: 'Color Change', 17: 'Immunity', 18: 'Flash Fire',
19: 'Shield Dust', 20: 'Own Tempo', 21: 'Suction Cups', 22: 'Intimidate', 23: 'Shadow Tag',
24: 'Rough Skin', 25: 'Wonder Guard', 26: 'Levitate', 27: 'Effect Spore', 28: 'Synchronize',
29: 'Clear Body', 30: 'Natural Cure', 31: 'Lightning Rod', 32: 'Serene Grace', 33: 'Swift Swim',
34: 'Chlorophyll', 35: 'Illuminate', 36: 'Trace', 37: 'Huge Power', 38: 'Poison Point', 39: 'Inner Focus',
40: 'Magma Armor', 41: 'Water Veil', 42: 'Magnet Pull', 43: 'Soundproof', 44: 'Rain Dish',
45: 'Sand Stream', 46: 'Pressure', 47: 'Thick Fat', 48: 'Early Bird', 49: 'Flame Body',
50: 'Run Away', 51: 'Keen Eye', 52: 'Hyper Cutter', 53: 'Pickup', 54: 'Truant', 55: 'Hustle',
56: 'Cute Charm', 57: 'Plus', 58: 'Minus', 59: 'Forecast', 60: 'Sticky Hold', 61: 'Shed Skin',
62: 'Guts', 63: 'Marvel Scale', 64: 'Liquid Ooze', 65: 'Overgrow', 66: 'Blaze', 67: 'Torrent',
68: 'Swarm', 69: 'Rock Head', 70: 'Drought', 71: 'Arena Trap', 72: 'Vital Spirit', 73: 'White Smoke',
74: 'Pure Power', 75: 'Shell Armor', 76: 'Air Lock', 77: 'Tangled Feet', 78: 'Motor Drive', 79: 'Rivalry',
80: 'Steadfast', 81: 'Snow Cloak', 82: 'Gluttony', 83: 'Anger Point', 84: 'Unburden', 85: 'Heatproof',
86: 'Simple', 87: 'Dry Skin', 88: 'Download', 89: 'Iron Fist', 90: 'Poison Heal', 91: 'Adaptability',
92: 'Skill Link', 93: 'Hydration', 94: 'Solar Power', 95: 'Quick Feet', 96: 'Normalize', 97: 'Sniper',
98: 'Magic Guard', 99: 'No Guard', 100: 'Stall', 101: 'Technician', 102: 'Leaf Guard', 103: 'Klutz',
104: 'Mold Breaker', 105: 'Super Luck', 106: 'Aftermath', 107: 'Anticipation', 108: 'Forewarn',
109: 'Unaware', 110: 'Tinted Lens', 111: 'Filter', 112: 'Slow Start', 113: 'Scrappy',
114: 'Storm Drain', 115: 'Ice Body', 116: 'Solid Rock', 117: 'Snow Warning', 118: 'Honey Gather',
119: 'Frisk', 120: 'Reckless', 121: 'Multitype', 122: 'Flower Gift', 123: 'Bad Dreams', 124: 'Pickpocket',
125: 'Sheer Force', 126: 'Contrary', 127: 'Unnerve', 128: 'Defiant', 129: 'Defeatist', 130: 'Cursed Body',
131: 'Healer', 132: 'Friend Guard', 133: 'Weak Armor', 134: 'Heavy Metal', 135: 'Light Metal',
136: 'Multiscale', 137: 'Toxic Boost', 138: 'Flare Boost', 139: 'Harvest', 140: 'Telepathy', 141: 'Moody',
142: 'Overcoat', 143: 'Poison Touch', 144: 'Regenerator', 145: 'Big Pecks', 146: 'Sand Rush',
147: 'Wonder Skin', 148: 'Analytic', 149: 'Illusion', 150: 'Imposter', 151: 'Infiltrator', 152: 'Mummy',
153: 'Moxie', 154: 'Justified', 155: 'Rattled', 156: 'Magic Bounce', 157: 'Sap Sipper', 158: 'Prankster',
159: 'Sand Force', 160: 'Iron Barbs', 161: 'Zen Mode', 162: 'Victory Star', 163: 'Turboblaze',
164: 'Teravolt', 165: 'Aroma Veil', 166: 'Flower Veil', 167: 'Cheek Pouch', 168: 'Protean',
169: 'Fur Coat', 170: 'Magician', 171: 'Bulletproof', 172: 'Competitive', 173: 'Strong Jaw',
174: 'Refrigerate', 175: 'Sweet Veil', 176: 'Stance Change', 177: 'Gale Wings', 178: 'Mega Launcher',
179: 'Grass Pelt', 180: 'Symbiosis', 181: 'Tough Claws', 182: 'Pixilate', 183: 'Gooey', 184: 'Aerilate',
185: 'Parental Bond', 186: 'Dark Aura', 187: 'Fairy Aura', 188: 'Aura Break', 189: 'Primordial Sea',
190: 'Desolate Land', 191: 'Delta Stream', 192: 'Stamina', 193: 'Wimp Out', 194: 'Emergency Exit',
195: 'Water Compaction', 196: 'Merciless', 197: 'Shields Down', 198: 'Stakeout', 199: 'Water Bubble',
200: 'Steelworker', 201: 'Berserk', 202: 'Slush Rush', 203: 'Long Reach', 204: 'Liquid Voice',
205: 'Triage', 206: 'Galvanize', 207: 'Surge Surfer', 208: 'Schooling', 209: 'Disguise',
210: 'Battle Bond', 211: 'Power Construct', 212: 'Corrosion', 213: 'Comatose', 214: 'Queenly Majesty',
215: 'Innards Out', 216: 'Dancer', 217: 'Battery', 218: 'Fluffy', 219: 'Dazzling', 220: 'Soul-Heart',
221: 'Tangling Hair', 222: 'Receiver', 223: 'Power of Alchemy', 224: 'Beast Boost', 225: 'RKS System',
226: 'Electric Surge', 227: 'Psychic Surge', 228: 'Misty Surge', 229: 'Grassy Surge',
230: 'Full Metal Body', 231: 'Shadow Shield', 232: 'Prism Armor', 233: 'Neuroforce', 234: 'Intrepid Sword',
235: 'Dauntless Shield', 236: 'Libero', 237: 'Ball Fetch', 238: 'Cotton Down', 239: 'Propeller Tail',
240: 'Mirror Armor', 241: 'Gulp Missile', 242: 'Stalwart', 243: 'Steam Engine', 244: 'Punk Rock',
245: 'Sand Spit', 246: 'Ice Scales', 247: 'Ripen', 248: 'Ice Face', 249: 'Power Spot', 250: 'Mimicry',
251: 'Screen Cleaner', 252: 'Steely Spirit', 253: 'Perish Body', 254: 'Wandering Spirit',
255: 'Gorilla Tactics', 256: 'Neutralizing Gas', 257: 'Pastel Veil', 258: 'Hunger Switch',
259: 'Quick Draw', 260: 'Unseen Fist', 261: 'Curious Medicine', 262: 'Transistor', 263: "Dragon's Maw",
264: 'Chilling Neigh', 265: 'Grim Neigh', 266: 'As One', 267: 'As One'}
|
STRICTDOC_GRAMMAR = r"""
Document[noskipws]:
'[DOCUMENT]' '\n'
// NAME: is deprecated. Both documents and sections now have TITLE:.
(('NAME: ' name = /.*$/ '\n') | ('TITLE: ' title = /.*$/ '\n')?)
(config = DocumentConfig)?
('\n' grammar = DocumentGrammar)?
free_texts *= SpaceThenFreeText
section_contents *= SectionOrRequirement
;
ReservedKeyword[noskipws]:
'DOCUMENT' | 'GRAMMAR'
;
DocumentGrammar[noskipws]:
'[GRAMMAR]' '\n'
'ELEMENTS:' '\n'
elements += GrammarElement
;
GrammarElement[noskipws]:
'- TAG: ' tag = RequirementType '\n'
' FIELDS:' '\n'
fields += GrammarElementField
;
GrammarElementField[noskipws]:
GrammarElementFieldString |
GrammarElementFieldSingleChoice |
GrammarElementFieldMultipleChoice |
GrammarElementFieldTag
;
GrammarElementFieldString[noskipws]:
' - TITLE: ' title=FieldName '\n'
' TYPE: String' '\n'
' REQUIRED: ' (required = BooleanChoice) '\n'
;
GrammarElementFieldSingleChoice[noskipws]:
' - TITLE: ' title=FieldName '\n'
' TYPE: SingleChoice'
'(' ((options = ChoiceOption) (options *= ChoiceOptionXs)) ')' '\n'
' REQUIRED: ' (required = BooleanChoice) '\n'
;
GrammarElementFieldMultipleChoice[noskipws]:
' - TITLE: ' title=FieldName '\n'
' TYPE: MultipleChoice'
'(' ((options = ChoiceOption) (options *= ChoiceOptionXs)) ')' '\n'
' REQUIRED: ' (required = BooleanChoice) '\n'
;
GrammarElementFieldTag[noskipws]:
' - TITLE: ' title=FieldName '\n'
' TYPE: Tag' '\n'
' REQUIRED: ' (required = BooleanChoice) '\n'
;
BooleanChoice[noskipws]:
('True' | 'False')
;
DocumentConfig[noskipws]:
('VERSION: ' version = /.*$/ '\n')?
('NUMBER: ' number = /.*$/ '\n')?
('OPTIONS:' '\n'
(' MARKUP: ' (markup = MarkupChoice) '\n')?
(' AUTO_LEVELS: ' (auto_levels = AutoLevelsChoice) '\n')?
)?
;
MarkupChoice[noskipws]:
'RST' | 'Text' | 'HTML'
;
AutoLevelsChoice[noskipws]:
'On' | 'Off'
;
Section[noskipws]:
'[SECTION]'
'\n'
('UID: ' uid = /.+$/ '\n')?
('LEVEL: ' level = /.*/ '\n')?
'TITLE: ' title = /.*$/ '\n'
free_texts *= SpaceThenFreeText
section_contents *= SectionOrRequirement
'\n'
'[/SECTION]'
'\n'
;
SectionOrRequirement[noskipws]:
'\n' (Section | Requirement | CompositeRequirement)
;
SpaceThenRequirement[noskipws]:
'\n' (Requirement | CompositeRequirement)
;
SpaceThenFreeText[noskipws]:
'\n' (FreeText)
;
ReservedKeyword[noskipws]:
'DOCUMENT' | 'GRAMMAR' | 'SECTION' | 'FREETEXT'
;
Requirement[noskipws]:
'[' !CompositeRequirementTagName requirement_type = RequirementType ']' '\n'
fields *= RequirementField
;
CompositeRequirementTagName[noskipws]:
'COMPOSITE_'
;
RequirementType[noskipws]:
!ReservedKeyword /[A-Z]+(_[A-Z]+)*/
;
RequirementField[noskipws]:
(
field_name = 'REFS' ':' '\n'
(field_value_references += Reference)
) |
(
field_name = FieldName ':'
(
((' ' field_value = SingleLineString | field_value = '') '\n') |
(' ' (field_value_multiline = MultiLineString) '\n')
)
)
;
CompositeRequirement[noskipws]:
'[COMPOSITE_' requirement_type = RequirementType ']' '\n'
fields *= RequirementField
requirements *= SpaceThenRequirement
'\n'
'[/COMPOSITE_REQUIREMENT]' '\n'
;
ChoiceOption[noskipws]:
/[\w\/-]+( *[\w\/-]+)*/
;
ChoiceOptionXs[noskipws]:
/, /- ChoiceOption
;
RequirementStatus[noskipws]:
'Draft' | 'Active' | 'Deleted';
RequirementComment[noskipws]:
'COMMENT: ' (
comment_single = SingleLineString | comment_multiline = MultiLineString
) '\n'
;
FreeText[noskipws]:
'[FREETEXT]' '\n'
parts+=TextPart
FreeTextEnd
;
FreeTextEnd: /^/ '[/FREETEXT]' '\n';
TextPart[noskipws]:
(InlineLink | NormalString)
;
NormalString[noskipws]:
(!SpecialKeyword !FreeTextEnd /(?ms)./)*
;
SpecialKeyword:
InlineLinkStart // more keywords are coming later
;
InlineLinkStart: '[LINK: ';
InlineLink[noskipws]:
InlineLinkStart value = /[^\]]*/ ']'
;
"""
|
li=["a","b","d"]
print(li)
str="".join(li)#adding the lists value together
print(str)
str=" ".join(li)#adding the lists value together along with a space
print(str)
str=",".join(li)#adding the lists value together along with a comma
print(str)
str="&".join(li)#adding the lists value together along with a &
print(str) |
def limpar(*args):
telaPrincipal = args[0]
cursor = args[1]
banco10 = args[2]
sql_limpa_tableWidget = args[3]
telaPrincipal.valorTotal.setText("Valor Total:")
telaPrincipal.tableWidget_cadastro.clear()
telaPrincipal.desconto.clear()
telaPrincipal.acrescimo.clear()
sql_limpa_tableWidget.limpar(cursor, banco10) |
consonents = ['sch', 'squ', 'thr', 'qu', 'th', 'sc', 'sh', 'ch', 'st', 'rh']
consonents.extend('bcdfghjklmnpqrstvwxyz')
def prefix(word):
if word[:2] not in ['xr', 'yt']:
for x in consonents:
if word.startswith(x):
return (x, word[len(x):])
return ('', word)
def translate(phrase):
return ' '.join([x + y + 'ay' for y, x in
map(prefix, phrase.split())])
|
[
[float("NaN"), float("NaN"), 73.55631426, 76.45173763],
[float("NaN"), float("NaN"), 71.11031587, 73.6557548],
[float("NaN"), float("NaN"), 11.32891221, 9.80444014],
[float("NaN"), float("NaN"), 10.27812002, 8.15602626],
[float("NaN"), float("NaN"), 21.60703222, 17.9604664],
[float("NaN"), float("NaN"), 2.44599839, 2.79598283],
[float("NaN"), float("NaN"), 0.61043458, 0.41397093],
[float("NaN"), float("NaN"), 2.65390256, 2.9383991],
[float("NaN"), float("NaN"), 1.36865038, 1.84961059],
[float("NaN"), float("NaN"), 0.20366599, 0.38581535],
[float("NaN"), float("NaN"), 1.57231637, 2.23542594],
]
|
numbers = [float(num) for num in input().split()]
nums_dict = {}
for el in numbers:
if el not in nums_dict:
nums_dict[el] = 0
nums_dict[el] += 1
[print(f"{el:.1f} - {occurence} times") for el, occurence in nums_dict.items()] |
modules_rules = {
"graphlib": (None, (3, 9)),
"test.support.socket_helper": (None, (3, 9)),
"zoneinfo": (None, (3, 9)),
}
classes_rules = {
"asyncio.BufferedProtocol": (None, (3, 7)),
"asyncio.PidfdChildWatcher": (None, (3, 9)),
"importlib.abc.Traversable": (None, (3, 9)),
"importlib.abc.TraversableReader": (None, (3, 9)),
"pstats.FunctionProfile": (None, (3, 9)),
"pstats.StatsProfile": (None, (3, 9)),
}
exceptions_rules = {
}
functions_rules = {
"ast.unparse": (None, (3, 9)),
"asyncio.loop.shutdown_default_executor": (None, (3, 9)),
"asyncio.to_thread": (None, (3, 9)),
"bytearray.removeprefix": (None, (3, 9)),
"bytearray.removesuffix": (None, (3, 9)),
"bytes.removeprefix": (None, (3, 9)),
"bytes.removesuffix": (None, (3, 9)),
"curses.get_escdelay": (None, (3, 9)),
"curses.get_tabsize": (None, (3, 9)),
"curses.set_escdelay": (None, (3, 9)),
"curses.set_tabsize": (None, (3, 9)),
"gc.is_finalized": (None, (3, 9)),
"imaplib.IMAP4.unselect": (None, (3, 9)),
"importlib.machinery.FrozenImporter.create_module": (None, (3, 4)),
"importlib.machinery.FrozenImporter.exec_module": (None, (3, 4)),
"importlib.resources.files": (None, (3, 9)),
"keyword.issoftkeyword": (None, (3, 9)),
"logging.StreamHandler.setStream": (None, (3, 7)),
"math.lcm": (None, (3, 9)),
"math.nextafter": (None, (3, 9)),
"math.ulp": (None, (3, 9)),
"multiprocessing.SimpleQueue.close": (None, (3, 9)),
"os.pidfd_open": (None, (3, 9)),
"os.waitstatus_to_exitcode": (None, (3, 9)),
"pathlib.Path.link_to": (None, (3, 8)),
"pathlib.Path.readlink": (None, (3, 9)),
"pathlib.PurePath.is_relative_to": (None, (3, 9)),
"pathlib.PurePath.with_stem": (None, (3, 9)),
"pkgutil.resolve_name": (None, (3, 9)),
"pstats.Stats.get_stats_profile": (None, (3, 9)),
"random.randbytes": (None, (3, 9)),
"signal.pidfd_send_signal": (None, (3, 9)),
"socket.recv_fds": (None, (3, 9)),
"socket.send_fds": (None, (3, 9)),
"statistics.NormalDist.zscore": (None, (3, 9)),
"str.removeprefix": (None, (3, 9)),
"str.removesuffix": (None, (3, 9)),
"test.support.print_warning": (None, (3, 9)),
"test.support.wait_process": (None, (3, 9)),
"tracemalloc.reset_peak": (None, (3, 9)),
"types.CodeType.replace": (None, (3, 8)),
"typing.get_origin": (None, (3, 8)),
"venv.EnvBuilder.upgrade_dependencies": (None, (3, 9)),
"xml.etree.ElementTree.indent": (None, (3, 9)),
}
variables_and_constants_rules = {
"decimal.HAVE_CONTEXTVAR": (None, (3, 7)),
"difflib.SequenceMatcher.bjunk": (None, (3, 2)),
"difflib.SequenceMatcher.bpopular": (None, (3, 2)),
"fcntl.F_GETPATH": (None, (3, 9)),
"fcntl.F_OFD_GETLK": (None, (3, 9)),
"fcntl.F_OFD_SETLK": (None, (3, 9)),
"fcntl.F_OFD_SETLKW": (None, (3, 9)),
"http.HTTPStatus.EARLY_HINTS": (None, (3, 9)),
"http.HTTPStatus.IM_A_TEAPOT": (None, (3, 9)),
"http.HTTPStatus.TOO_EARLY": (None, (3, 9)),
"keyword.softkwlist": (None, (3, 9)),
"logging.StreamHandler.terminator": (None, (3, 2)),
"os.CLD_KILLED": (None, (3, 9)),
"os.CLD_STOPPED": (None, (3, 9)),
"os.P_PIDFD": (None, (3, 9)),
"socket.CAN_J1939": (None, (3, 9)),
"socket.CAN_RAW_JOIN_FILTERS": (None, (3, 9)),
"socket.IPPROTO_UDPLITE": (None, (3, 9)),
"sys.__unraisablehook__": (None, (3, 8)),
"sys.flags.dev_mode": (None, (3, 7)),
"sys.flags.utf8_mode": (None, (3, 7)),
"sys.platlibdir": (None, (3, 9)),
"time.CLOCK_TAI": (None, (3, 9)),
"token.COLONEQUAL": (None, (3, 8)),
"token.TYPE_COMMENT": (None, (3, 8)),
"token.TYPE_IGNORE": (None, (3, 8)),
"tracemalloc.Traceback.total_nframe": (None, (3, 9)),
"typing.Annotated": (None, (3, 9)),
"unittest.mock.Mock.call_args.args": (None, (3, 8)),
"unittest.mock.Mock.call_args.kwargs": (None, (3, 8)),
"urllib.response.addinfourl.status": (None, (3, 9)),
}
decorators_rules = {
"functools.cache": (None, (3, 9)),
}
kwargs_rules = {
("argparse.ArgumentParser", "exit_on_error"): (None, (3, 9)),
("ast.dump", "indent"): (None, (3, 9)),
("asyncio.Future.cancel", "msg"): (None, (3, 9)),
("asyncio.Task.cancel", "msg"): (None, (3, 9)),
("asyncio.loop.create_connection", "happy_eyeballs_delay"): (None, (3, 8)),
("asyncio.loop.create_connection", "interleave"): (None, (3, 8)),
("bytearray.hex", "bytes_per_sep"): (None, (3, 8)),
("bytearray.hex", "sep"): (None, (3, 8)),
("compileall.compile_dir", "hardlink_dupes"): (None, (3, 9)),
("compileall.compile_dir", "limit_sl_dest"): (None, (3, 9)),
("compileall.compile_dir", "prependdir"): (None, (3, 9)),
("compileall.compile_dir", "stripdir"): (None, (3, 9)),
("compileall.compile_file", "hardlink_dupes"): (None, (3, 9)),
("compileall.compile_file", "limit_sl_dest"): (None, (3, 9)),
("compileall.compile_file", "prependdir"): (None, (3, 9)),
("compileall.compile_file", "stripdir"): (None, (3, 9)),
("concurrent.futures.Executor.shutdown", "cancel_futures"): (None, (3, 9)),
("ftplib.FTP", "encoding"): (None, (3, 9)),
("ftplib.FTP_TLS", "encoding"): (None, (3, 9)),
("hashlib.blake2b", "usedforsecurity"): (None, (3, 9)),
("hashlib.blake2s", "usedforsecurity"): (None, (3, 9)),
("hashlib.md5", "usedforsecurity"): (None, (3, 9)),
("hashlib.new", "usedforsecurity"): (None, (3, 9)),
("hashlib.sha1", "usedforsecurity"): (None, (3, 9)),
("hashlib.sha224", "usedforsecurity"): (None, (3, 9)),
("hashlib.sha256", "usedforsecurity"): (None, (3, 9)),
("hashlib.sha384", "usedforsecurity"): (None, (3, 9)),
("hashlib.sha3_224", "usedforsecurity"): (None, (3, 9)),
("hashlib.sha3_256", "usedforsecurity"): (None, (3, 9)),
("hashlib.sha3_384", "usedforsecurity"): (None, (3, 9)),
("hashlib.sha3_512", "usedforsecurity"): (None, (3, 9)),
("hashlib.sha512", "usedforsecurity"): (None, (3, 9)),
("hashlib.shake_128", "usedforsecurity"): (None, (3, 9)),
("hashlib.shake_256", "usedforsecurity"): (None, (3, 9)),
("imaplib.IMAP4", "timeout"): (None, (3, 9)),
("imaplib.IMAP4.open", "timeout"): (None, (3, 9)),
("imaplib.IMAP4_SSL", "ssl_context"): (None, (3, 3)),
("imaplib.IMAP4_SSL", "timeout"): (None, (3, 9)),
("logging.basicConfig", "encoding"): (None, (3, 9)),
("logging.basicConfig", "errors"): (None, (3, 9)),
("logging.handlers.RotatingFileHandler", "errors"): (None, (3, 9)),
("logging.handlers.TimedRotatingFileHandler", "errors"): (None, (3, 9)),
("logging.handlers.WatchedFileHandler", "errors"): (None, (3, 9)),
("memoryview.hex", "bytes_per_sep"): (None, (3, 8)),
("memoryview.hex", "sep"): (None, (3, 8)),
("os.sendfile", "in_fd"): (None, (3, 9)),
("os.sendfile", "out_fd"): (None, (3, 9)),
("pow", "base"): (None, (3, 8)),
("pow", "exp"): (None, (3, 8)),
("pow", "mod"): (None, (3, 8)),
("random.sample", "counts"): (None, (3, 9)),
("smtplib.LMTP", "timeout"): (None, (3, 9)),
("subprocess.Popen", "extra_groups"): (None, (3, 9)),
("subprocess.Popen", "group"): (None, (3, 9)),
("subprocess.Popen", "umask"): (None, (3, 9)),
("subprocess.Popen", "user"): (None, (3, 9)),
("threading.Semaphore.release", "n"): (None, (3, 9)),
("typing.get_type_hints", "include_extras"): (None, (3, 9)),
("venv.EnvBuilder", "upgrade_deps"): (None, (3, 9)),
("xml.etree.ElementInclude.include", "base_url"): (None, (3, 9)),
("xml.etree.ElementInclude.include", "max_depth"): (None, (3, 9)),
}
|
def bolha_curta(self, lista):
fim = len(lista)
for i in range(fim-1, 0, -1):
trocou = False
for j in range(i):
if lista[j] > lista[j+1]:
lista[j], lista[j+1] = lista[j+1], lista[j]
trocou = True
if trocou== False:
return
|
a = float(input('digite um numero:'))
b = float(input('digite um numero:'))
c = float(input('digite um numero:'))
if a > b:
if a > c:
ma = a
if b > c:
mi = c
if c > b:
mi = b
if b > a:
if b > c:
ma = b
if a > c:
mi = c
if c > a:
mi = a
if c > b:
if c > a:
ma = c
if b > a:
mi = a
if a > b:
mi = b
print('O menor numero e : {} e o maior e {}'.format(mi, ma)) |
def run():
countries = {
'mexico': 122,
'colombia': 49,
'argentina': 43,
'chile': 18,
'peru': 31
}
while True:
try:
country = input(
'¿De que país quieres saber la población?: ').lower()
print(
f'La población de {country} es {countries[country]} millones\n')
except KeyError:
print('No tenemos ese país en la base de datos :(\n')
if __name__ == '__main__':
run()
|
"""
Common constants for Pipeline.
"""
AD_FIELD_NAME = 'asof_date'
ANNOUNCEMENT_FIELD_NAME = 'announcement_date'
CASH_FIELD_NAME = 'cash'
CASH_AMOUNT_FIELD_NAME = 'cash_amount'
BUYBACK_ANNOUNCEMENT_FIELD_NAME = 'buyback_date'
DAYS_SINCE_PREV = 'days_since_prev'
DAYS_SINCE_PREV_DIVIDEND_ANNOUNCEMENT = 'days_since_prev_dividend_announcement'
DAYS_SINCE_PREV_EX_DATE = 'days_since_prev_ex_date'
DAYS_TO_NEXT = 'days_to_next'
DAYS_TO_NEXT_EX_DATE = 'days_to_next_ex_date'
EX_DATE_FIELD_NAME = 'ex_date'
NEXT_AMOUNT = 'next_amount'
NEXT_ANNOUNCEMENT = 'next_announcement'
NEXT_EX_DATE = 'next_ex_date'
NEXT_PAY_DATE = 'next_pay_date'
PAY_DATE_FIELD_NAME = 'pay_date'
PREVIOUS_AMOUNT = 'previous_amount'
PREVIOUS_ANNOUNCEMENT = 'previous_announcement'
PREVIOUS_BUYBACK_ANNOUNCEMENT = 'previous_buyback_announcement'
PREVIOUS_BUYBACK_CASH = 'previous_buyback_cash'
PREVIOUS_BUYBACK_SHARE_COUNT = 'previous_buyback_share_count'
PREVIOUS_EX_DATE = 'previous_ex_date'
PREVIOUS_PAY_DATE = 'previous_pay_date'
SHARE_COUNT_FIELD_NAME = 'share_count'
SID_FIELD_NAME = 'sid'
TS_FIELD_NAME = 'timestamp'
|
# Write a Python program to get the n (non-negative integer) copies of the first 2 characters of a given string.
# Return the n copies of the whole string if the length is less than 2
s = input("Enter a string: ")
def copies(string, number):
copy = ""
for i in range(number):
copy += string[0] + string[1]
return copy
if len(s) > 2:
n = int(input("Enter the number of copies: "))
print(copies(s, n))
else:
print(s + s)
|
#!/usr/bin/env python3
#https://codeforces.com/problemset/problem/1284/B
#记录每个序列是否有上升,如果没有min.max是多少..
#n=1e5,还得避免O(N**2)..
#上升情况分解
#情况1: sx+sy中sx或sy本身是上升的
#情况2: sx,sy都不上升,判断四个极值的情况(存在几个上升)
#DP..增量计数; f(n+1)=f(n)+X; X=??
# 如果s本身上升,X=(2n+1)
# 如果s本身不升,拿s的min/max去一个数据结构去检查(min/max各一个?)..(低于线性..binary search??)
# ..
def bs(k,li):
l, r = 0, len(li)-1
if li[l] > k: return 0
if li[r] <= k: return len(li)
while True: #HOLD: li[l]<= k < li[r] VERY important!
if r-l<2: return r
m = l + ((r-l) >> 1) #safer; NOTE: () for right order
if li[m]>k:
r = m
else:
l = m
n = int(input())
sll = [list(map(int,input().split())) for _ in range(n)]
minl = []
maxl = []
for sl in sll:
nn = sl[0]
m = sl[1]
ascent = False
if nn==1:
minl.append(m)
maxl.append(m)
continue
for i in range(2,nn+1):
if sl[i] > m:
ascent = True
break
else:
m = sl[i]
if not ascent: # count non-ascenting
minl.append(min(sl[1:]))
maxl.append(max(sl[1:]))
maxs = sorted(maxl) #mins = sorted(minl)
cnt = sum([bs(m,maxs) for m in minl]) # m+maxs, counting non-ascending (m >= maxs)
print(n*n-cnt)
|
# model settings
model = dict(
type='Recognizer3D',
backbone=dict(type='X3D', frozen_stages = -1, gamma_w=1, gamma_b=2.25, gamma_d=2.2),
cls_head=dict(
type='X3DHead',
in_channels=432,
num_classes=400,
multi_class=False,
spatial_type='avg',
dropout_ratio=0.7,
fc1_bias=False),
# model training and testing settings
train_cfg=None,
test_cfg=dict(average_clips='prob'))
# model = dict(
# type='Recognizer3D',
# backbone=dict(type='X3D', frozen_stages = 0, gamma_w=2, gamma_b=2.25, gamma_d=5),
# cls_head=dict(
# type='X3DHead',
# in_channels=864,
# num_classes=7,
# spatial_type='avg',
# dropout_ratio=0.6,
# fc1_bias=False),
# # model training and testing settings
# train_cfg=None,
# test_cfg=dict(average_clips='prob'))
|
#coding:utf-8
# 数据库结构体
class DataBase:
url = ""
port = 3306
username = ""
password = ""
database = ""
charset = ""
# 测试用例信息结构体
class CaseInfo:
path = ""
case_list = []
# 测试用例结构体
class Case:
url = ""
db_table = ""
case_id = ""
method = ""
data = {}
check_item = {}
status = ""
db_key = {}
check_result = "" |
channels1 = { "#test1": ("@user1", "user2", "user3"),
"#test2": ("@user4", "user5", "user6"),
"#test3": ("@user7", "user8", "user9")
}
channels2 = { "#test1": ("@user1", "user2", "user3"),
"#test2": ("@user4", "user5", "user6"),
"#test3": ("@user7", "user8", "user9"),
None: ("user10" , "user11")
}
channels3 = { "#test1": ("@user1", "user2", "user3"),
"#test2": ("@user2",),
"#test3": ("@user3", "@user4", "user5", "user6"),
"#test4": ("@user7", "+user8", "+user9", "user1", "user2"),
"#test5": ("@user1", "@user5"),
None: ("user10" , "user11")
}
channels4 = { None: ("user1", "user2", "user3", "user4", "user5") } |
class BaseAnsiblerException(Exception):
message = "Error"
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args)
self.__class__.message = kwargs.get("message", self.message)
def __str__(self) -> str:
return self.__class__.message
class CommandNotFound(BaseAnsiblerException):
message = "Command not found"
class RolesParseError(BaseAnsiblerException):
message = "Could not parse default roles"
class MetaYMLError(BaseAnsiblerException):
message = "Invalid meta/main.yml"
class RoleMetadataError(BaseAnsiblerException):
message = "Role metadata error"
class MoleculeTestsNotFound(BaseAnsiblerException):
message = "Molecule tests not foound"
class MoleculeTestParseError(BaseAnsiblerException):
message = "Could not parse molecule test file"
class NoPackageJsonError(BaseAnsiblerException):
message = "No package.json"
|
"""
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
"""
__author__ = 'Danyang'
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def buildTree(self, preorder, inorder):
"""
Recursive algorithm. Pre-order, in-order, post-order traversal relationship
pre-order: [root, left_subtree, right_subtree]
in-order: [left_subtree, root, right_subtree]
recursive algorithm
:param preorder: a list of integers
:param inorder: a list of integers
:return: TreeNode, root
"""
if not preorder:
return None
root = TreeNode(preorder[0])
root_index = inorder.index(root.val)
root.left = self.buildTree(preorder[1:root_index+1], inorder[0:root_index])
root.right = self.buildTree(preorder[root_index+1:], inorder[root_index+1:])
return root
|
def make_list(element, keep_none=False):
""" Turns element into a list of itself
if it is not of type list or tuple. """
if element is None and not keep_none:
element = [] # Convert none to empty list
if not isinstance(element, (list, tuple, set)):
element = [element]
elif isinstance(element, (tuple, set)):
element = list(element)
return element |
#Evaludador de numero primo
#Created by @neriphy
numero = input("Ingrese el numero a evaluar: ")
divisor = numero - 1
residuo = True
while divisor > 1 and residuo == True:
if numero%divisor != 0:
divisor = divisor - 1
print("Evaluando")
residuo = True
elif numero%divisor == 0:
residuo = False
if residuo == True:
print(numero,"es un numero primo")
if residuo == False:
print(numero,"no es un numero primo")
|
# Python programming that returns the weight of the maximum weight path in a triangle
def triangle_max_weight(arrs, level=0, index=0):
if level == len(arrs) - 1:
return arrs[level][index]
else:
return arrs[level][index] + max(
triangle_max_weight(arrs, level + 1, index), triangle_max_weight(arrs, level + 1, index + 1)
)
if __name__ == "__main__": # Driver function
arrs1 =[[1], [2, 3], [1, 5, 1]]
print(triangle_max_weight(arrs1))
|
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]:
## By passing the case if empty linked list
if not head:
return head
else:
## We will be using two nodes method with prev and curr
## intialized to None and head respectively
prev, curr = None, head
## We will be traversing throught the linked list
while curr:
## Let us temporalily save the rest of the linked list
## right to the curr node in rest_ll
rest_ll = curr.next
## Make the curr point to the pre
curr.next = prev
## Prev point to the curr
prev = curr
## Update curr to point to the rest of the ll
curr = rest_ll
return prev
|
def get_span_and_trace(headers):
try:
trace, span = headers.get("X-Cloud-Trace-Context").split("/")
except (ValueError, AttributeError):
return None, None
span = span.split(";")[0]
return span, trace
|
def trigger():
return """
CREATE OR REPLACE FUNCTION trg_ticket_prioridade()
RETURNS TRIGGER AS $$
DECLARE
prioridade_grupo smallint;
prioridade_subgrupo smallint;
BEGIN
prioridade_grupo = COALESCE((SELECT prioridade FROM grupo WHERE id = NEW.grupo_id), 0);
prioridade_subgrupo = COALESCE((SELECT prioridade FROM subgrupo WHERE id = NEW.subgrupo_id), 0);
NEW.prioridade = prioridade_grupo + prioridade_subgrupo;
RETURN NEW;
END
$$ LANGUAGE plpgsql;
DROP TRIGGER IF EXISTS trg_ticket_prioridade ON ticket;
CREATE TRIGGER trg_ticket_prioridade
BEFORE INSERT OR UPDATE ON ticket
FOR EACH ROW EXECUTE PROCEDURE trg_ticket_prioridade();
"""
|
# CPU: 0.18 s
n_rows, _ = map(int, input().split())
common_items = set(input().split())
for _ in range(n_rows - 1):
common_items = common_items.intersection(set(input().split()))
print(len(common_items))
print(*sorted(common_items), sep="\n")
|
class APIException(Exception):
def __init__(self, message, code=None):
self.context = {}
if code:
self.context['errorCode'] = code
super().__init__(message)
|
lista = []
pess = []
men = 0
mai = 0
while True:
pess.append(str(input('Nome:')))
pess.append(float(input('Peso:')))
if len(lista)==0:# se nao cadastrou ninguem ainda
mai = men = pess[1]#o maior é o mesmo que o menor e igual pess na posicao 1 que é o peso
else:
if pess[1] > mai:
mai = pess[1]
if pess[1] < men:
men = pess[1]
lista.append(pess[:])
pess.clear()
resp = str(input('Quer continuar? [S/N]: '))
if resp in 'Nn':
break
print(f'Ao todo, você cadastrou {len(lista)} pessoas.')
print(f'O maior peso foi de {mai}Kg. Peso de ',end='')
for p in lista:#para cada p dentro de lista, vai pegar cada lista e jogar em p
if p[1] == mai:
print(f'[{p[0]}]',end='')
print()
print(f'O menor peso foi de {men}Kg. peso de ',end='')
for p in lista:
if p[1] == men:
print(f'[{p[0]}]',end='')
print()
|
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
max_len = 0
l, r = 0, 0
count = dict()
while r < len(s):
count[s[r]] = count.get(s[r], 0) + 1
while count[s[r]] > 1:
count[s[l]] = count[s[l]] - 1
l += 1
max_len = max(max_len, r-l+1)
r += 1
return max_len
|
class DeviceInterface:
# This operation is used to initialize the device instance. Accepts a dictionary that is read in from the device's yaml definition.
# This device_config_yaml may contain any number of parameters/fields necessary to initialize/setup the instance for data collection.
def initialize(self, device_config_dict):
pass
# This is a standard operation that will return a dictionary to be converted to the appropriate format (json, plaintext, etc) for
# use by endpoints or other publishing methods.
def get_device_data(self):
pass |
'''
mro stands for Method Resolution Order.
It returns a list of types the class is
derived from, in the order they are searched
for methods'''
print(__doc__)
print('\n'+'-'*35+ 'Method Resolution Order'+'-'*35)
class A(object):
def dothis(self):
print('From A class')
class B1(A):
def dothis(self):
print('From B1 class')
pass
class B2(object):
def dothis(self):
print('From B2 class')
pass
class B3(A):
def dothis(self):
print('From B3 class')
# Diamond inheritance
class D1(B1, B3):
pass
class D2(B1, B2):
pass
d1_instance = D1()
d1_instance.dothis()
print(D1.__mro__)
d2_instance = D2()
d2_instance.dothis()
print(D2.__mro__) |
def solution(s1, s2):
'''
EXPLANATION
-------------------------------------------------------------------
I approached this problem by creating two dictionaries, one for
each string. These dictionaries are formatted with characters as
keys, and counts as values. I then iterate over each string,
counting the instances of each character.
Finally, I iterate over the first dictionary, and if that character
exists in the second dictionary, I add the lesser of the two values
to create a total count of shared characters.
-------------------------------------------------------------------
'''
s1_dict = {}
s2_dict = {}
count = 0
for letter in s1:
s1_dict[letter] = s1.count(letter)
s1.replace(letter, "")
for letter in s2:
s2_dict[letter] = s2.count(letter)
s2.replace(letter, "")
for letter in s1_dict:
if letter in s2_dict:
if s1_dict[letter] > s2_dict[letter]:
count += s2_dict[letter]
else:
count += s1_dict[letter]
return count
def oneline(s1, s2):
'''
EXPLANATION
-------------------------------------------------------------------
keeping_it_leal from Germany comes back again with this far more
concise solution to the problem utilizing Python's set() function.
The set function returns all unique elements of an iterable. By
using this, we can simply create an array of the minimum counts
of each unique character in EITHER string (s1 chosen here), and
return the sum of these counts. If the character doesn't exist in
the second string, the minimum will therein be zero, which is a
more implicit way to compare characters between the strings.
-------------------------------------------------------------------
'''
return sum([min(s1.count(c),s2.count(c)) for c in set(s1)])
|
a = float(input('Введите число: '))
def koren (a):
x = 3
k = 0
if (a<0):
raise ValueError('Ошибка, введите число, меньшее нуля')
while k != (a**0.5):
k = 0.5 * (x + a/x)
x = k
return(k)
print('Корень из числа ' + str(a) + ' равен ' + str(koren(a)))
|
class Node:
def __init__(self, data=None, left=None, right=None):
self._left = left
self._data = data
self._right = right
@property
def left(self):
return self._left
@left.setter
def left(self, left):
self._left = left
@property
def right(self):
return self._right
@right.setter
def right(self, right):
self._right = right
@property
def data(self):
return self._data
@data.setter
def data(self, left):
self._data = data
def spiral(root):
stack1 = []
stack2 = []
stack1.append(root)
while len(stack1) > 0 or len(stack2) > 0:
while len(stack1) > 0:
curr_node = stack1.pop()
print(curr_node.data)
if curr_node.left:
stack2.append(curr_node.left)
if curr_node.right:
stack2.append(curr_node.right)
while len(stack2) > 0:
curr_node = stack2.pop()
print(curr_node.data)
if curr_node.right:
stack1.append(curr_node.right)
if curr_node.left:
stack1.append(curr_node.left)
def spiral_reverse(root):
stack1 = []
stack2 = []
stack1.append(root)
while len(stack1) > 0 or len(stack2) > 0:
while len(stack1) > 0:
curr_node = stack1.pop()
print(curr_node.data)
if curr_node.right:
stack2.append(curr_node.right)
if curr_node.left:
stack2.append(curr_node.left)
while len(stack2) > 0:
curr_node = stack2.pop()
print(curr_node.data)
if curr_node.left:
stack1.append(curr_node.left)
if curr_node.right:
stack1.append(curr_node.right)
if __name__ == '__main__':
tree = Node(1)
tree.left = Node(2)
tree.right = Node(3)
tree.left.left = Node(4)
tree.left.right = Node(5)
tree.right.right = Node(7)
tree.right.left = Node(18)
tree.right.right.right = Node(8)
tree.left.right.left = Node(17)
tree.left.right.right = Node(6)
tree.left.right.left.left = Node(19)
spiral_reverse(tree)
|
#Faça um programa que pergunte ao usuario o valor do produto,
#e mostre o valor final com 5% de desconto.
valorProduto = float(input('Qual o valor do produto? R$ '))
desconto = (valorProduto * 5) / 100
vFinal = valorProduto - desconto
print('O valor do produto é R${}'.format(valorProduto))
print('O novo valor com o desconto é de R${}'.format(vFinal))
|
# A resizable list of integers
class Vector(object):
# Attributes
items: [int] = None
size: int = 0
# Constructor
def __init__(self:"Vector"):
self.items = [0]
# Returns current capacity
def capacity(self:"Vector") -> int:
return len(self.items)
# Increases capacity of vector by one element
def increase_capacity(self:"Vector") -> int:
self.items = self.items + [0]
return self.capacity()
# Appends one item to end of vector
def append(self:"Vector", item: int):
if self.size == self.capacity():
self.increase_capacity()
self.items[self.size] = item
self.size = self.size + 1
# A faster (but more memory-consuming) implementation of vector
class DoublingVector(Vector):
doubling_limit:int = 16
# Overriding to do fewer resizes
def increase_capacity(self:"DoublingVector") -> int:
if (self.capacity() <= self.doubling_limit // 2):
self.items = self.items + self.items
else:
# If doubling limit has been reached, fall back to
# standard capacity increases
self.items = self.items + [0]
return self.capacity()
def vrange(i:int, j:int) -> Vector:
v:Vector = None
v = DoublingVector()
while i < j:
v.append(i)
i = i + 1
return v
vec:Vector = None
num:int = 0
# Create a vector and populate it with The Numbers
vec = DoublingVector()
for num in [4, 8, 15, 16, 23, 42]:
vec.append(num)
__assert__(vec.capacity() == 8)
__assert__(vec.size == 6)
__assert__(vec.items[0] == 4)
__assert__(vec.items[1] == 8)
__assert__(vec.items[2] == 15)
__assert__(vec.items[3] == 16)
__assert__(vec.items[4] == 23)
__assert__(vec.items[5] == 42)
# extras from doubling
__assert__(vec.items[6] == 15)
__assert__(vec.items[7] == 16)
vec = Vector()
for num in [4, 8, 15, 16, 23, 42]:
vec.append(num)
__assert__(vec.capacity() == 6)
__assert__(vec.size == 6)
__assert__(vec.items[0] == 4)
__assert__(vec.items[1] == 8)
__assert__(vec.items[2] == 15)
__assert__(vec.items[3] == 16)
__assert__(vec.items[4] == 23)
__assert__(vec.items[5] == 42)
vec = vrange(0, 1)
__assert__(vec.capacity() == 1)
__assert__(vec.size == 1)
__assert__(vec.items[0] == 0)
vec = vrange(0, 2)
__assert__(vec.capacity() == 2)
__assert__(vec.size == 2)
__assert__(vec.items[0] == 0)
__assert__(vec.items[1] == 1)
vec = vrange(1, 3)
__assert__(vec.capacity() == 2)
__assert__(vec.size == 2)
__assert__(vec.items[0] == 1)
__assert__(vec.items[1] == 2)
vec = vrange(1, 1)
__assert__(vec.capacity() == 1)
__assert__(vec.size == 0)
vec = vrange(0, -1)
__assert__(vec.capacity() == 1)
__assert__(vec.size == 0)
vec = vrange(1, 100)
__assert__(vec.size == 99)
|
'''
Arithmetic progression with 10 elements.
'''
first_term = int(input('Type the first term of this A.P: '))
reason = int(input('Type the reason of this A.P: '))
last_term = first_term + (50-1)*reason # A.P formula
for c in range (first_term, last_term + reason , reason):
print(c, end=' ► ')
|
#!/usr/bin/python3
# File: fizz_buzz.py
# Author: Jonathan Belden
# Description: Fizz-Buzz Coding Challenge
# Reference: https://edabit.com/challenge/WXqH9qvvGkmx4dMvp
def evaluate(inputValue):
result = None
if inputValue % 3 == 0 and inputValue % 5 == 0:
result = "FizzBuzz"
elif inputValue % 3 == 0:
result = "Fizz"
elif inputValue % 5 == 0:
result = "Buzz"
else:
result = str(inputValue)
return result |
class Solution:
"""
@param A:
@return: nothing
"""
def numFactoredBinaryTrees(self, A):
A.sort()
MOD = 10 ** 9 + 7
dp = {}
for j in range(len(A)):
dp[A[j]] = 1
for i in range(j):
if A[j] % A[i] == 0:
num = A[j] // A[i]
if num in dp:
dp[A[j]] = (dp[A[j]] + dp[A[i]] * dp[num]) % MOD
return sum(dp.values()) % MOD
|
def multiplo(a, b):
if a % b == 0:
return True
else:
return False
print(multiplo(2, 1))
print(multiplo(9, 5))
print(multiplo(81, 9))
|
class Quadrado:
def __init__(self, lado):
self.tamanho_lado = lado
def mudar_valor_lado(self, novo_lado):
lado = novo_lado
self.tamanho_lado = novo_lado
def retornar_valor_lado(self, retorno):
self.tamanho_lado = retorno
print(retorno)
def calcular_area(self, area):
self.tamanho_lado = area
print(area*area)
quadrado = Quadrado(6)
print('Tamanho atual é:')
print(quadrado.tamanho_lado)
print('----------------')
quadrado.mudar_valor_lado(3)
print('Novo tamanho é:')
print(quadrado.tamanho_lado)
print('----------------')
print('Tamanho atual:')
quadrado.retornar_valor_lado(3)
print('----------------')
print('Total da area ficou em :')
quadrado.calcular_area(3)
|
valores = []
quant = int(input())
for c in range(0, quant):
x, y = input().split(' ')
x = int(x)
y = int(y)
maior = menor = soma = 0
if x > y:
maior = x
menor = y
else:
maior = y
menor = x
if maior == menor+1 or maior == menor:
valores.append(0)
else:
for i in range(menor+1, maior):
if i % 2 != 0:
soma += i
if i+1 == maior:
valores.append(soma)
for valor in valores:
print(valor)
|
def binary_search(collection, lhs, rhs, value):
if rhs > lhs:
mid = lhs + (rhs - lhs) // 2
if collection[mid] == value:
return mid
if collection[mid] > value:
return binary_search(collection, lhs, mid-1, value)
return binary_search(collection, mid+1, rhs, value)
return -1
def eq(exp, val):
assert exp == val, f'Expected: {exp}, got value {val}'
def main():
tests = [
(0, 5, [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),
(8, 13, [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]),
(8, 9, [1,2,3,4,5,6,7,8,9]),
]
for expected, value, collection in tests:
eq(expected, binary_search(collection, 0, len(collection), value))
if __name__ == '__main__':
main()
print('success') |
#Exercício Python 9: Faça um programa que leia um número Inteiro qualquer e mostre na tela a sua tabuada.
n = int(input("Digite um número: "))
i = 0
print("--------------")
while i < 10:
i += 1
print("{:2} x {:2} = {:2}".format(n, i, n*i))
print("--------------") |
click(Pattern("Bameumbrace.png").similar(0.80))
sleep(1)
click("3abnb.png")
exit(0)
|
class Rover:
def __init__(self,photo,name,date):
self.photo = photo
self.name = name
self.date = date
class Articles:
def __init__(self,author,title,description,url,poster,time):
self.author = author
self.title = title
self.description = description
self.url = url
self.poster = poster
self.time = time |
'''https://leetcode.com/problems/max-consecutive-ones/'''
class Solution:
def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
i, j = 0, 0
ans = 0
while j<len(nums):
if nums[j]==0:
ans = max(ans, j-i)
i = j+1
j+=1
return max(ans, j-i) |
class Solution:
def snakesAndLadders(self, board: List[List[int]]) -> int:
n = len(board)
q = collections.deque()
q.append(1)
visited = set()
visited.add(1)
step = 0
while q:
size = len(q)
for _ in range(size):
num = q.popleft()
if num == n*n:
return step
for i in range(1,7):
if num+i > n*n:
break
nxt = self.getValue(board, num+i)
if nxt == -1:
nxt = num+i
if nxt not in visited:
q.append(nxt)
visited.add(nxt)
step += 1
return -1
def getValue(self, board, num):
n = len(board)
x = (num-1)//n
y = (num-1)%n
if x%2 == 1:
y = n-1-y
x = n-1-x
return board[x][y] |
def mergingLetters(s, t):
#edge cases
mergedStr = ""
firstChar = list(s)
secondChar = list(t)
for i, ele in enumerate(secondChar):
if i < len(firstChar):
mergedStr = mergedStr + firstChar[i]
print('first pointer', firstChar[i], mergedStr)
if i < len(secondChar):
mergedStr = mergedStr + secondChar[i]
print('second pointer', secondChar[i], "merged",mergedStr)
return mergedStr
print(mergingLetters('abcd', 'jjjjjjj')) |
"""
题目:
给定一个 32 位有符号整数,将整数中的数字进行反转。
示例 1:
输入: 123
输出: 321
示例 2:
输入: -123
输出: -321
示例 3:
输入: 120
输出: 21
注意:
假设我们的环境只能存储 32 位有符号整数,其数值范围是 [−2**31, 2**31 − 1]。根据这个假设,如果反转后的整数溢出,则返回 0。
"""
class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
if x == 0:
return 0
elif x > 0:
y = int(str(x)[::-1].lstrip('0'))
else:
y = int('-' + str(x)[:0:-1].lstrip('0'))
return 0 if y > 2**31 - 1 or y < -2**31 else y
|
#
# PySNMP MIB module TIMETRA-SAS-IEEE8021-PAE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-SAS-IEEE8021-PAE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:21: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)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection")
dot1xAuthConfigEntry, = mibBuilder.importSymbols("IEEE8021-PAE-MIB", "dot1xAuthConfigEntry")
ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup")
Counter32, NotificationType, Gauge32, MibIdentifier, ModuleIdentity, Bits, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, iso, Integer32, Counter64, IpAddress, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "NotificationType", "Gauge32", "MibIdentifier", "ModuleIdentity", "Bits", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "iso", "Integer32", "Counter64", "IpAddress", "Unsigned32")
DisplayString, TruthValue, TextualConvention, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TruthValue", "TextualConvention", "RowStatus")
timetraSASNotifyPrefix, timetraSASConfs, timetraSASModules, timetraSASObjs = mibBuilder.importSymbols("TIMETRA-SAS-GLOBAL-MIB", "timetraSASNotifyPrefix", "timetraSASConfs", "timetraSASModules", "timetraSASObjs")
TNamedItem, TPolicyStatementNameOrEmpty, ServiceAdminStatus = mibBuilder.importSymbols("TIMETRA-TC-MIB", "TNamedItem", "TPolicyStatementNameOrEmpty", "ServiceAdminStatus")
timeraSASIEEE8021PaeMIBModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 6527, 6, 2, 1, 1, 17))
timeraSASIEEE8021PaeMIBModule.setRevisions(('1912-07-01 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: timeraSASIEEE8021PaeMIBModule.setRevisionsDescriptions(('Rev 1.0 03 Aug 2012 00:00 1.0 release of the ALCATEL-SAS-IEEE8021-PAE-MIB.',))
if mibBuilder.loadTexts: timeraSASIEEE8021PaeMIBModule.setLastUpdated('1207010000Z')
if mibBuilder.loadTexts: timeraSASIEEE8021PaeMIBModule.setOrganization('Alcatel-Lucent')
if mibBuilder.loadTexts: timeraSASIEEE8021PaeMIBModule.setContactInfo('Alcatel-Lucent SROS Support Web: http://support.alcatel-lucent.com ')
if mibBuilder.loadTexts: timeraSASIEEE8021PaeMIBModule.setDescription("This document is the SNMP MIB module to manage and provision the 7x50 extensions to the IEEE8021-PAE-MIB (Port Access Entity nodule for managing IEEE 802.X) feature for the Alcatel 7210 device. Copyright 2004-2012 Alcatel-Lucent. All rights reserved. Reproduction of this document is authorized on the condition that the foregoing copyright notice is included. This SNMP MIB module (Specification) embodies Alcatel-Lucent's proprietary intellectual property. Alcatel-Lucent retains all title and ownership in the Specification, including any revisions. Alcatel-Lucent grants all interested parties a non-exclusive license to use and distribute an unmodified copy of this Specification in connection with management of Alcatel-Lucent products, and without fee, provided this copyright notice and license appear on all copies. This Specification is supplied 'as is', and Alcatel-Lucent makes no warranty, either express or implied, as to the use, operation, condition, or performance of the Specification.")
tmnxSASDot1xObjs = MibIdentifier((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 2, 16))
tmnxSASDot1xAuthenticatorObjs = MibIdentifier((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 2, 16, 1))
tmnxSASDot1xConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 1, 12))
tmnxDot1xSASCompliancs = MibIdentifier((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 1, 12, 1))
tmnxDot1xSASGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 1, 12, 2))
dot1xAuthConfigExtnTable = MibTable((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 2, 16, 1, 1), )
if mibBuilder.loadTexts: dot1xAuthConfigExtnTable.setStatus('current')
if mibBuilder.loadTexts: dot1xAuthConfigExtnTable.setDescription('The table dot1xAuthConfigExtnTable allows configuration of RADIUS authentication parameters for the 802.1X PAE feature on port level.')
dot1xAuthConfigExtnEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 2, 16, 1, 1, 1), )
dot1xAuthConfigEntry.registerAugmentions(("TIMETRA-SAS-IEEE8021-PAE-MIB", "dot1xAuthConfigExtnEntry"))
dot1xAuthConfigExtnEntry.setIndexNames(*dot1xAuthConfigEntry.getIndexNames())
if mibBuilder.loadTexts: dot1xAuthConfigExtnEntry.setStatus('current')
if mibBuilder.loadTexts: dot1xAuthConfigExtnEntry.setDescription('dot1xAuthConfigExtnEntry is an entry (conceptual row) in the dot1xAuthConfigExtnTable. Each entry represents the configuration for Radius Authentication on a port. Entries have a presumed StorageType of nonVolatile.')
dot1xPortEtherTunnel = MibTableColumn((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 2, 16, 1, 1, 1, 150), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1xPortEtherTunnel.setStatus('current')
if mibBuilder.loadTexts: dot1xPortEtherTunnel.setDescription('The value of tmnxPortEtherDot1xTunnel specifies whether the DOT1X packet tunneling for the ethernet port is enabled or disabled. When tunneling is enabled, the port will not process any DOT1X packets but will tunnel them through instead.')
dot1xAuthConfigExtnGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 1, 12, 2, 1)).setObjects(("TIMETRA-SAS-IEEE8021-PAE-MIB", "dot1xPortEtherTunnel"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
dot1xAuthConfigExtnGroup = dot1xAuthConfigExtnGroup.setStatus('current')
if mibBuilder.loadTexts: dot1xAuthConfigExtnGroup.setDescription('The group of objects supporting management of Radius authentication for the IEEE801.1X PAE feature on Alcatel 7210 SR series systems.')
dot1xAuthConfigExtnCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 6527, 6, 2, 2, 1, 12, 1, 1)).setObjects(("TIMETRA-SAS-IEEE8021-PAE-MIB", "dot1xAuthConfigExtnGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
dot1xAuthConfigExtnCompliance = dot1xAuthConfigExtnCompliance.setStatus('current')
if mibBuilder.loadTexts: dot1xAuthConfigExtnCompliance.setDescription('The compliance statement for management of Radius authentication for the IEEE801.1X PAE feature on Alcatel 7210 SR series systems.')
mibBuilder.exportSymbols("TIMETRA-SAS-IEEE8021-PAE-MIB", dot1xAuthConfigExtnGroup=dot1xAuthConfigExtnGroup, dot1xAuthConfigExtnEntry=dot1xAuthConfigExtnEntry, tmnxSASDot1xObjs=tmnxSASDot1xObjs, timeraSASIEEE8021PaeMIBModule=timeraSASIEEE8021PaeMIBModule, tmnxDot1xSASGroups=tmnxDot1xSASGroups, PYSNMP_MODULE_ID=timeraSASIEEE8021PaeMIBModule, dot1xAuthConfigExtnCompliance=dot1xAuthConfigExtnCompliance, tmnxDot1xSASCompliancs=tmnxDot1xSASCompliancs, dot1xPortEtherTunnel=dot1xPortEtherTunnel, tmnxSASDot1xConformance=tmnxSASDot1xConformance, dot1xAuthConfigExtnTable=dot1xAuthConfigExtnTable, tmnxSASDot1xAuthenticatorObjs=tmnxSASDot1xAuthenticatorObjs)
|
x = 0
y = 0
aim = 0
with open('input') as f:
for line in f:
direction = line.split()[0]
magnitude = int(line.split()[1])
if direction == 'forward':
x += magnitude
y += aim * magnitude
elif direction == 'down':
aim += magnitude
elif direction == 'up':
aim -= magnitude
print(str(x * y))
|
#
# PySNMP MIB module PRIVATE-SW0657840-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PRIVATE-SW0657840-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:33:18 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")
ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueSizeConstraint")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
NotificationGroup, ModuleCompliance, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance", "ObjectGroup")
Integer32, Counter64, Counter32, MibIdentifier, iso, Gauge32, enterprises, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, ObjectIdentity, Unsigned32, IpAddress, Bits, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "Counter64", "Counter32", "MibIdentifier", "iso", "Gauge32", "enterprises", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "ObjectIdentity", "Unsigned32", "IpAddress", "Bits", "NotificationType")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
privatetech = ModuleIdentity((1, 3, 6, 1, 4, 1, 5205))
if mibBuilder.loadTexts: privatetech.setLastUpdated('200607030000Z')
if mibBuilder.loadTexts: privatetech.setOrganization('xxx Tech Corp.')
switch = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2))
sw0657840ProductID = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9))
sw0657840Produces = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1))
sw0657840System = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1))
sw0657840CommonSys = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 1))
sw0657840Reboot = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ValueRangeConstraint(2, 2), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840Reboot.setStatus('current')
sw0657840BiosVsersion = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840BiosVsersion.setStatus('current')
sw0657840FirmwareVersion = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840FirmwareVersion.setStatus('current')
sw0657840HardwareVersion = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 1, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840HardwareVersion.setStatus('current')
sw0657840MechanicalVersion = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840MechanicalVersion.setStatus('current')
sw0657840SerialNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 1, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SerialNumber.setStatus('current')
sw0657840HostMacAddress = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 1, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840HostMacAddress.setStatus('current')
sw0657840DevicePort = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 1, 8), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840DevicePort.setStatus('current')
sw0657840RamSize = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 1, 9), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840RamSize.setStatus('current')
sw0657840FlashSize = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 1, 10), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840FlashSize.setStatus('current')
sw0657840IP = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 2))
sw0657840DhcpSetting = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840DhcpSetting.setStatus('current')
sw0657840IPAddress = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 2, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840IPAddress.setStatus('current')
sw0657840NetMask = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 2, 3), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840NetMask.setStatus('current')
sw0657840DefaultGateway = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 2, 4), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840DefaultGateway.setStatus('current')
sw0657840DnsSetting = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 2, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840DnsSetting.setStatus('current')
sw0657840DnsServer = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 2, 6), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840DnsServer.setStatus('current')
sw0657840Time = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 3))
sw0657840SystemCurrentTime = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 3, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SystemCurrentTime.setStatus('current')
sw0657840ManualTimeSetting = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 3, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840ManualTimeSetting.setStatus('current')
sw0657840NTPServer = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 3, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840NTPServer.setStatus('current')
sw0657840NTPTimeZone = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 3, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-12, 13))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840NTPTimeZone.setStatus('current')
sw0657840NTPTimeSync = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 3, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840NTPTimeSync.setStatus('current')
sw0657840DaylightSavingTime = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 3, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-5, 5))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840DaylightSavingTime.setStatus('current')
sw0657840DaylightStartTime = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 3, 7), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840DaylightStartTime.setStatus('current')
sw0657840DaylightEndTime = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 3, 8), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840DaylightEndTime.setStatus('current')
sw0657840Account = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 4))
sw0657840AccountNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 4, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 5))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840AccountNumber.setStatus('current')
sw0657840AccountTable = MibTable((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 4, 2), )
if mibBuilder.loadTexts: sw0657840AccountTable.setStatus('current')
sw0657840AccountEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 4, 2, 1), ).setIndexNames((0, "PRIVATE-SW0657840-MIB", "sw0657840AccountIndex"))
if mibBuilder.loadTexts: sw0657840AccountEntry.setStatus('current')
sw0657840AccountIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 4, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 5))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840AccountIndex.setStatus('current')
sw0657840AccountAuthorization = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 4, 2, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840AccountAuthorization.setStatus('current')
sw0657840AccountName = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 4, 2, 1, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840AccountName.setStatus('current')
sw0657840AccountPassword = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 4, 2, 1, 4), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840AccountPassword.setStatus('current')
sw0657840AccountAddName = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 4, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840AccountAddName.setStatus('current')
sw0657840AccountAddPassword = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 4, 4), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840AccountAddPassword.setStatus('current')
sw0657840DoAccountAdd = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 4, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840DoAccountAdd.setStatus('current')
sw0657840AccountDel = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 1, 4, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(2, 5))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840AccountDel.setStatus('current')
sw0657840Snmp = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 2))
sw0657840GetCommunity = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 2, 1), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840GetCommunity.setStatus('current')
sw0657840SetCommunity = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 2, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840SetCommunity.setStatus('current')
sw0657840TrapHostNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 2, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 6))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840TrapHostNumber.setStatus('current')
sw0657840TrapHostTable = MibTable((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 2, 4), )
if mibBuilder.loadTexts: sw0657840TrapHostTable.setStatus('current')
sw0657840TrapHostEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 2, 4, 1), ).setIndexNames((0, "PRIVATE-SW0657840-MIB", "sw0657840TrapHostIndex"))
if mibBuilder.loadTexts: sw0657840TrapHostEntry.setStatus('current')
sw0657840TrapHostIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 2, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 6))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840TrapHostIndex.setStatus('current')
sw0657840TrapHostIP = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 2, 4, 1, 2), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840TrapHostIP.setStatus('current')
sw0657840TrapHostPort = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 2, 4, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840TrapHostPort.setStatus('current')
sw0657840TrapHostCommunity = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 2, 4, 1, 4), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840TrapHostCommunity.setStatus('current')
sw0657840Alarm = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3))
sw0657840Event = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 1))
sw0657840EventNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840EventNumber.setStatus('current')
sw0657840EventTable = MibTable((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 1, 2), )
if mibBuilder.loadTexts: sw0657840EventTable.setStatus('current')
sw0657840EventEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 1, 2, 1), ).setIndexNames((0, "PRIVATE-SW0657840-MIB", "sw0657840EventIndex"))
if mibBuilder.loadTexts: sw0657840EventEntry.setStatus('current')
sw0657840EventIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840EventIndex.setStatus('current')
sw0657840EventName = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 1, 2, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840EventName.setStatus('current')
sw0657840EventSendEmail = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840EventSendEmail.setStatus('current')
sw0657840EventSendSMS = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840EventSendSMS.setStatus('current')
sw0657840EventSendTrap = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840EventSendTrap.setStatus('current')
sw0657840Email = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 2))
sw0657840EmailServer = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 2, 1), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840EmailServer.setStatus('current')
sw0657840EmailUsername = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 2, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840EmailUsername.setStatus('current')
sw0657840EmailPassword = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 2, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840EmailPassword.setStatus('current')
sw0657840EmailUserNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 2, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 6))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840EmailUserNumber.setStatus('current')
sw0657840EmailUserTable = MibTable((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 2, 5), )
if mibBuilder.loadTexts: sw0657840EmailUserTable.setStatus('current')
sw0657840EmailUserEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 2, 5, 1), ).setIndexNames((0, "PRIVATE-SW0657840-MIB", "sw0657840EmailUserIndex"))
if mibBuilder.loadTexts: sw0657840EmailUserEntry.setStatus('current')
sw0657840EmailUserIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 2, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 6))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840EmailUserIndex.setStatus('current')
sw0657840EmailUserAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 2, 5, 1, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840EmailUserAddress.setStatus('current')
sw0657840SMS = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 3))
sw0657840SMSServer = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 3, 1), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840SMSServer.setStatus('current')
sw0657840SMSUsername = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 3, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840SMSUsername.setStatus('current')
sw0657840SMSPassword = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 3, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840SMSPassword.setStatus('current')
sw0657840SMSUserNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 3, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 6))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SMSUserNumber.setStatus('current')
sw0657840SMSUserTable = MibTable((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 3, 5), )
if mibBuilder.loadTexts: sw0657840SMSUserTable.setStatus('current')
sw0657840SMSUserEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 3, 5, 1), ).setIndexNames((0, "PRIVATE-SW0657840-MIB", "sw0657840SMSUserIndex"))
if mibBuilder.loadTexts: sw0657840SMSUserEntry.setStatus('current')
sw0657840SMSUserIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 3, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 6))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SMSUserIndex.setStatus('current')
sw0657840SMSUserMobilePhone = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 3, 3, 5, 1, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840SMSUserMobilePhone.setStatus('current')
sw0657840Tftp = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 4))
sw0657840TftpServer = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 4, 1), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840TftpServer.setStatus('current')
sw0657840Configuration = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 5))
sw0657840SaveRestore = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 5, 1))
sw0657840SaveStart = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840SaveStart.setStatus('current')
sw0657840SaveUser = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840SaveUser.setStatus('current')
sw0657840RestoreDefault = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 5, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ValueRangeConstraint(2, 2), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840RestoreDefault.setStatus('current')
sw0657840RestoreUser = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 5, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840RestoreUser.setStatus('current')
sw0657840ConfigFile = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 5, 2))
sw0657840ExportConfigName = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 5, 2, 1), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840ExportConfigName.setStatus('current')
sw0657840DoExportConfig = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 5, 2, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(1, 1), ValueRangeConstraint(2, 2), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840DoExportConfig.setStatus('current')
sw0657840ImportConfigName = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 5, 2, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840ImportConfigName.setStatus('current')
sw0657840DoImportConfig = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 5, 2, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(1, 1), ValueRangeConstraint(2, 2), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840DoImportConfig.setStatus('current')
sw0657840Diagnostic = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 6))
sw0657840EEPROMTest = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 6, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840EEPROMTest.setStatus('current')
sw0657840UartTest = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 6, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840UartTest.setStatus('current')
sw0657840DramTest = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 6, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840DramTest.setStatus('current')
sw0657840FlashTest = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 6, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840FlashTest.setStatus('current')
sw0657840InternalLoopbackTest = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 6, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840InternalLoopbackTest.setStatus('current')
sw0657840ExternalLoopbackTest = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 6, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840ExternalLoopbackTest.setStatus('current')
sw0657840PingTest = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 6, 7), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840PingTest.setStatus('current')
sw0657840Log = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 7))
sw0657840ClearLog = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 7, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840ClearLog.setStatus('current')
sw0657840UploadLog = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 7, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840UploadLog.setStatus('current')
sw0657840AutoUploadLogState = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 7, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840AutoUploadLogState.setStatus('current')
sw0657840LogNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 7, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 120))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840LogNumber.setStatus('current')
sw0657840LogTable = MibTable((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 7, 5), )
if mibBuilder.loadTexts: sw0657840LogTable.setStatus('current')
sw0657840LogEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 7, 5, 1), ).setIndexNames((0, "PRIVATE-SW0657840-MIB", "sw0657840LogIndex"))
if mibBuilder.loadTexts: sw0657840LogEntry.setStatus('current')
sw0657840LogIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 7, 5, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 120))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840LogIndex.setStatus('current')
sw0657840LogEvent = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 7, 5, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840LogEvent.setStatus('current')
sw0657840Firmware = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 8))
sw0657840FirmwareFileName = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 8, 1), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840FirmwareFileName.setStatus('current')
sw0657840DoFirmwareUpgrade = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 8, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840DoFirmwareUpgrade.setStatus('current')
sw0657840Port = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9))
sw0657840PortStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 1))
sw0657840PortStatusNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840PortStatusNumber.setStatus('current')
sw0657840PortStatusTable = MibTable((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 1, 2), )
if mibBuilder.loadTexts: sw0657840PortStatusTable.setStatus('current')
sw0657840PortStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 1, 2, 1), ).setIndexNames((0, "PRIVATE-SW0657840-MIB", "sw0657840PortStatusIndex"))
if mibBuilder.loadTexts: sw0657840PortStatusEntry.setStatus('current')
sw0657840PortStatusIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840PortStatusIndex.setStatus('current')
sw0657840PortStatusMedia = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 1, 2, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840PortStatusMedia.setStatus('current')
sw0657840PortStatusLink = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 1, 2, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840PortStatusLink.setStatus('current')
sw0657840PortStatusPortState = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 1, 2, 1, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840PortStatusPortState.setStatus('current')
sw0657840PortStatusAutoNego = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 1, 2, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840PortStatusAutoNego.setStatus('current')
sw0657840PortStatusSpdDpx = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 1, 2, 1, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840PortStatusSpdDpx.setStatus('current')
sw0657840PortStatusFlwCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 1, 2, 1, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840PortStatusFlwCtrl.setStatus('current')
sw0657840PortStatuDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 1, 2, 1, 8), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840PortStatuDescription.setStatus('current')
sw0657840PortConf = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 2))
sw0657840PortConfNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 2, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840PortConfNumber.setStatus('current')
sw0657840PortConfTable = MibTable((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 2, 2), )
if mibBuilder.loadTexts: sw0657840PortConfTable.setStatus('current')
sw0657840PortConfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 2, 2, 1), ).setIndexNames((0, "PRIVATE-SW0657840-MIB", "sw0657840PortConfIndex"))
if mibBuilder.loadTexts: sw0657840PortConfEntry.setStatus('current')
sw0657840PortConfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840PortConfIndex.setStatus('current')
sw0657840PortConfPortState = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840PortConfPortState.setStatus('current')
sw0657840PortConfSpdDpx = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 2, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 5))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840PortConfSpdDpx.setStatus('current')
sw0657840PortConfFlwCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 2, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840PortConfFlwCtrl.setStatus('current')
sw0657840PortConfDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 9, 2, 2, 1, 5), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840PortConfDescription.setStatus('current')
sw0657840Mirror = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 10))
sw0657840MirrorMode = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 10, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840MirrorMode.setStatus('current')
sw0657840MirroringPort = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 10, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840MirroringPort.setStatus('current')
sw0657840MirroredPorts = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 10, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840MirroredPorts.setStatus('current')
sw0657840MaxPktLen = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 11))
sw0657840MaxPktLen1 = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 11, 1))
sw0657840MaxPktLenPortNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 11, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840MaxPktLenPortNumber.setStatus('current')
sw0657840MaxPktLenConfTable = MibTable((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 11, 1, 2), )
if mibBuilder.loadTexts: sw0657840MaxPktLenConfTable.setStatus('current')
sw0657840MaxPktLenConfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 11, 1, 2, 1), ).setIndexNames((0, "PRIVATE-SW0657840-MIB", "sw0657840MaxPktLenConfIndex"))
if mibBuilder.loadTexts: sw0657840MaxPktLenConfEntry.setStatus('current')
sw0657840MaxPktLenConfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 11, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840MaxPktLenConfIndex.setStatus('current')
sw0657840MaxPktLenConfSetting = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 11, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(1518, 1518), ValueRangeConstraint(1532, 1532), ValueRangeConstraint(9216, 9216), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840MaxPktLenConfSetting.setStatus('current')
sw0657840Bandwidth = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 12))
sw0657840Bandwidth1 = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 12, 1))
sw0657840BandwidthPortNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 12, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840BandwidthPortNumber.setStatus('current')
sw0657840BandwidthConfTable = MibTable((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 12, 1, 2), )
if mibBuilder.loadTexts: sw0657840BandwidthConfTable.setStatus('current')
sw0657840BandwidthConfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 12, 1, 2, 1), ).setIndexNames((0, "PRIVATE-SW0657840-MIB", "sw0657840BandwidthConfIndex"))
if mibBuilder.loadTexts: sw0657840BandwidthConfEntry.setStatus('current')
sw0657840BandwidthConfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 12, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840BandwidthConfIndex.setStatus('current')
sw0657840BandwidthConfIngressState = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 12, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840BandwidthConfIngressState.setStatus('current')
sw0657840BandwidthConfIngressBW = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 12, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840BandwidthConfIngressBW.setStatus('current')
sw0657840BandwidthConfStormState = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 12, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840BandwidthConfStormState.setStatus('current')
sw0657840BandwidthConfStormBW = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 12, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840BandwidthConfStormBW.setStatus('current')
sw0657840BandwidthConfEgressState = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 12, 1, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840BandwidthConfEgressState.setStatus('current')
sw0657840BandwidthConfEgressBW = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 12, 1, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840BandwidthConfEgressBW.setStatus('current')
sw0657840LoopDetectedConf = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 13))
sw0657840LoopDetectedNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 13, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840LoopDetectedNumber.setStatus('current')
sw0657840LoopDetectedTable = MibTable((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 13, 2), )
if mibBuilder.loadTexts: sw0657840LoopDetectedTable.setStatus('current')
sw0657840LoopDetectedEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 13, 2, 1), ).setIndexNames((0, "PRIVATE-SW0657840-MIB", "sw0657840LoopDetectedfIndex"))
if mibBuilder.loadTexts: sw0657840LoopDetectedEntry.setStatus('current')
sw0657840LoopDetectedfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 13, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840LoopDetectedfIndex.setStatus('current')
sw0657840LoopDetectedStateEbl = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 13, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840LoopDetectedStateEbl.setStatus('current')
sw0657840LoopDetectedCurrentStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 13, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840LoopDetectedCurrentStatus.setStatus('current')
sw0657840LoopDetectedResumed = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 13, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840LoopDetectedResumed.setStatus('current')
sw0657840LoopDetectedAction = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 13, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 0), ValueRangeConstraint(1, 1), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sw0657840LoopDetectedAction.setStatus('current')
sw0657840SFPInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14))
sw0657840SFPInfoNumber = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPInfoNumber.setStatus('current')
sw0657840SFPInfoTable = MibTable((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2), )
if mibBuilder.loadTexts: sw0657840SFPInfoTable.setStatus('current')
sw0657840SFPInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1), ).setIndexNames((0, "PRIVATE-SW0657840-MIB", "sw0657840SFPInfoIndex"))
if mibBuilder.loadTexts: sw0657840SFPInfoEntry.setStatus('current')
sw0657840SFPInfoIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPInfoIndex.setStatus('current')
sw0657840SFPConnectorType = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 2), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPConnectorType.setStatus('current')
sw0657840SFPFiberType = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 3), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPFiberType.setStatus('current')
sw0657840SFPWavelength = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 4), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPWavelength.setStatus('current')
sw0657840SFPBaudRate = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPBaudRate.setStatus('current')
sw0657840SFPVendorOUI = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 6), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPVendorOUI.setStatus('current')
sw0657840SFPVendorName = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPVendorName.setStatus('current')
sw0657840SFPVendorPN = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 8), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPVendorPN.setStatus('current')
sw0657840SFPVendorRev = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 9), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPVendorRev.setStatus('current')
sw0657840SFPVendorSN = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 10), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPVendorSN.setStatus('current')
sw0657840SFPDateCode = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 11), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPDateCode.setStatus('current')
sw0657840SFPTemperature = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 12), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPTemperature.setStatus('current')
sw0657840SFPVcc = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 13), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPVcc.setStatus('current')
sw0657840SFPTxBias = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 14), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPTxBias.setStatus('current')
sw0657840SFPTxPWR = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 15), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPTxPWR.setStatus('current')
sw0657840SFPRxPWR = MibTableColumn((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 14, 2, 1, 16), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sw0657840SFPRxPWR.setStatus('current')
sw0657840TrapEntry = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20))
sw0657840ModuleInserted = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 1)).setObjects(("IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: sw0657840ModuleInserted.setStatus('current')
sw0657840ModuleRemoved = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 2)).setObjects(("IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: sw0657840ModuleRemoved.setStatus('current')
sw0657840DualMediaSwapped = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 3)).setObjects(("IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: sw0657840DualMediaSwapped.setStatus('current')
sw0657840LoopDetected = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 5)).setObjects(("IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: sw0657840LoopDetected.setStatus('current')
sw0657840StpStateDisabled = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 100))
if mibBuilder.loadTexts: sw0657840StpStateDisabled.setStatus('current')
sw0657840StpStateEnabled = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 101))
if mibBuilder.loadTexts: sw0657840StpStateEnabled.setStatus('current')
sw0657840StpTopologyChanged = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 102)).setObjects(("IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: sw0657840StpTopologyChanged.setStatus('current')
sw0657840LacpStateDisabled = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 120)).setObjects(("IF-MIB", "ifIndex"), ("PRIVATE-SW0657840-MIB", "groupId"))
if mibBuilder.loadTexts: sw0657840LacpStateDisabled.setStatus('current')
sw0657840LacpStateEnabled = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 121)).setObjects(("IF-MIB", "ifIndex"), ("PRIVATE-SW0657840-MIB", "groupId"))
if mibBuilder.loadTexts: sw0657840LacpStateEnabled.setStatus('current')
sw0657840LacpPortAdded = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 123)).setObjects(("IF-MIB", "ifIndex"), ("PRIVATE-SW0657840-MIB", "actorkey"), ("PRIVATE-SW0657840-MIB", "partnerkey"))
if mibBuilder.loadTexts: sw0657840LacpPortAdded.setStatus('current')
sw0657840LacpPortTrunkFailure = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 124)).setObjects(("IF-MIB", "ifIndex"), ("PRIVATE-SW0657840-MIB", "actorkey"), ("PRIVATE-SW0657840-MIB", "partnerkey"))
if mibBuilder.loadTexts: sw0657840LacpPortTrunkFailure.setStatus('current')
sw0657840GvrpStateDisabled = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 140))
if mibBuilder.loadTexts: sw0657840GvrpStateDisabled.setStatus('current')
sw0657840GvrpStateEnabled = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 141))
if mibBuilder.loadTexts: sw0657840GvrpStateEnabled.setStatus('current')
sw0657840VlanStateDisabled = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 150))
if mibBuilder.loadTexts: sw0657840VlanStateDisabled.setStatus('current')
sw0657840VlanPortBaseEnabled = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 151))
if mibBuilder.loadTexts: sw0657840VlanPortBaseEnabled.setStatus('current')
sw0657840VlanTagBaseEnabled = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 152))
if mibBuilder.loadTexts: sw0657840VlanTagBaseEnabled.setStatus('current')
sw0657840VlanMetroModeEnabled = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 153)).setObjects(("PRIVATE-SW0657840-MIB", "uplink"))
if mibBuilder.loadTexts: sw0657840VlanMetroModeEnabled.setStatus('current')
sw0657840VlanDoubleTagEnabled = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 154))
if mibBuilder.loadTexts: sw0657840VlanDoubleTagEnabled.setStatus('current')
sw0657840UserLogin = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 200)).setObjects(("PRIVATE-SW0657840-MIB", "username"))
if mibBuilder.loadTexts: sw0657840UserLogin.setStatus('current')
sw0657840UserLogout = NotificationType((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 20, 201)).setObjects(("PRIVATE-SW0657840-MIB", "username"))
if mibBuilder.loadTexts: sw0657840UserLogout.setStatus('current')
sw0657840TrapVariable = MibIdentifier((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 21))
username = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 21, 1), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: username.setStatus('current')
groupId = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 21, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readonly")
if mibBuilder.loadTexts: groupId.setStatus('current')
actorkey = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 21, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: actorkey.setStatus('current')
partnerkey = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 21, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: partnerkey.setStatus('current')
uplink = MibScalar((1, 3, 6, 1, 4, 1, 5205, 2, 9, 1, 21, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: uplink.setStatus('current')
mibBuilder.exportSymbols("PRIVATE-SW0657840-MIB", sw0657840Diagnostic=sw0657840Diagnostic, sw0657840SMSUserTable=sw0657840SMSUserTable, sw0657840PortConfFlwCtrl=sw0657840PortConfFlwCtrl, sw0657840SerialNumber=sw0657840SerialNumber, sw0657840DevicePort=sw0657840DevicePort, sw0657840SFPTxPWR=sw0657840SFPTxPWR, username=username, sw0657840PortConfTable=sw0657840PortConfTable, sw0657840PingTest=sw0657840PingTest, sw0657840Time=sw0657840Time, sw0657840PortStatusTable=sw0657840PortStatusTable, sw0657840SFPVendorRev=sw0657840SFPVendorRev, sw0657840ModuleInserted=sw0657840ModuleInserted, sw0657840AccountNumber=sw0657840AccountNumber, sw0657840ModuleRemoved=sw0657840ModuleRemoved, sw0657840SFPWavelength=sw0657840SFPWavelength, sw0657840PortStatusLink=sw0657840PortStatusLink, sw0657840BandwidthConfStormBW=sw0657840BandwidthConfStormBW, sw0657840UploadLog=sw0657840UploadLog, sw0657840EventSendSMS=sw0657840EventSendSMS, sw0657840PortConf=sw0657840PortConf, sw0657840DoImportConfig=sw0657840DoImportConfig, sw0657840PortConfSpdDpx=sw0657840PortConfSpdDpx, sw0657840Alarm=sw0657840Alarm, switch=switch, sw0657840EEPROMTest=sw0657840EEPROMTest, sw0657840LoopDetectedConf=sw0657840LoopDetectedConf, sw0657840LacpStateDisabled=sw0657840LacpStateDisabled, sw0657840BandwidthConfIngressBW=sw0657840BandwidthConfIngressBW, sw0657840TrapHostIndex=sw0657840TrapHostIndex, actorkey=actorkey, sw0657840ExternalLoopbackTest=sw0657840ExternalLoopbackTest, sw0657840MirroringPort=sw0657840MirroringPort, sw0657840RestoreDefault=sw0657840RestoreDefault, sw0657840SFPVendorOUI=sw0657840SFPVendorOUI, sw0657840AccountIndex=sw0657840AccountIndex, sw0657840MirroredPorts=sw0657840MirroredPorts, sw0657840AutoUploadLogState=sw0657840AutoUploadLogState, sw0657840DoAccountAdd=sw0657840DoAccountAdd, sw0657840BandwidthPortNumber=sw0657840BandwidthPortNumber, sw0657840RamSize=sw0657840RamSize, sw0657840EventIndex=sw0657840EventIndex, sw0657840Produces=sw0657840Produces, sw0657840FlashSize=sw0657840FlashSize, sw0657840EmailPassword=sw0657840EmailPassword, sw0657840SMSUsername=sw0657840SMSUsername, sw0657840Mirror=sw0657840Mirror, sw0657840Configuration=sw0657840Configuration, sw0657840BandwidthConfStormState=sw0657840BandwidthConfStormState, sw0657840NTPTimeSync=sw0657840NTPTimeSync, sw0657840LoopDetectedfIndex=sw0657840LoopDetectedfIndex, sw0657840TrapEntry=sw0657840TrapEntry, sw0657840SMSServer=sw0657840SMSServer, sw0657840MirrorMode=sw0657840MirrorMode, sw0657840SFPTemperature=sw0657840SFPTemperature, sw0657840UartTest=sw0657840UartTest, sw0657840GvrpStateEnabled=sw0657840GvrpStateEnabled, sw0657840TrapVariable=sw0657840TrapVariable, sw0657840SaveRestore=sw0657840SaveRestore, sw0657840PortConfNumber=sw0657840PortConfNumber, sw0657840PortStatusIndex=sw0657840PortStatusIndex, sw0657840AccountPassword=sw0657840AccountPassword, sw0657840PortStatusMedia=sw0657840PortStatusMedia, sw0657840SMSUserEntry=sw0657840SMSUserEntry, sw0657840DoExportConfig=sw0657840DoExportConfig, sw0657840Bandwidth=sw0657840Bandwidth, sw0657840TrapHostTable=sw0657840TrapHostTable, sw0657840SystemCurrentTime=sw0657840SystemCurrentTime, sw0657840EventEntry=sw0657840EventEntry, sw0657840EventSendTrap=sw0657840EventSendTrap, sw0657840LoopDetectedEntry=sw0657840LoopDetectedEntry, sw0657840SFPRxPWR=sw0657840SFPRxPWR, sw0657840MaxPktLenConfTable=sw0657840MaxPktLenConfTable, sw0657840LoopDetectedAction=sw0657840LoopDetectedAction, sw0657840ProductID=sw0657840ProductID, sw0657840VlanPortBaseEnabled=sw0657840VlanPortBaseEnabled, sw0657840LogIndex=sw0657840LogIndex, sw0657840UserLogin=sw0657840UserLogin, sw0657840SFPBaudRate=sw0657840SFPBaudRate, sw0657840Account=sw0657840Account, sw0657840TrapHostCommunity=sw0657840TrapHostCommunity, sw0657840LacpPortTrunkFailure=sw0657840LacpPortTrunkFailure, sw0657840EventTable=sw0657840EventTable, sw0657840LoopDetectedCurrentStatus=sw0657840LoopDetectedCurrentStatus, sw0657840FirmwareVersion=sw0657840FirmwareVersion, sw0657840ImportConfigName=sw0657840ImportConfigName, sw0657840PortStatusAutoNego=sw0657840PortStatusAutoNego, sw0657840MaxPktLen=sw0657840MaxPktLen, sw0657840DhcpSetting=sw0657840DhcpSetting, sw0657840Reboot=sw0657840Reboot, sw0657840SaveUser=sw0657840SaveUser, sw0657840PortStatusPortState=sw0657840PortStatusPortState, sw0657840BandwidthConfIngressState=sw0657840BandwidthConfIngressState, sw0657840SetCommunity=sw0657840SetCommunity, sw0657840VlanDoubleTagEnabled=sw0657840VlanDoubleTagEnabled, sw0657840Log=sw0657840Log, sw0657840DoFirmwareUpgrade=sw0657840DoFirmwareUpgrade, sw0657840HostMacAddress=sw0657840HostMacAddress, sw0657840FirmwareFileName=sw0657840FirmwareFileName, sw0657840LoopDetectedTable=sw0657840LoopDetectedTable, sw0657840ManualTimeSetting=sw0657840ManualTimeSetting, sw0657840LogEvent=sw0657840LogEvent, sw0657840ClearLog=sw0657840ClearLog, sw0657840EventName=sw0657840EventName, sw0657840PortStatuDescription=sw0657840PortStatuDescription, sw0657840NTPTimeZone=sw0657840NTPTimeZone, sw0657840LacpStateEnabled=sw0657840LacpStateEnabled, sw0657840SMSUserMobilePhone=sw0657840SMSUserMobilePhone, sw0657840StpStateEnabled=sw0657840StpStateEnabled, sw0657840VlanTagBaseEnabled=sw0657840VlanTagBaseEnabled, sw0657840DnsServer=sw0657840DnsServer, sw0657840LogTable=sw0657840LogTable, sw0657840MaxPktLen1=sw0657840MaxPktLen1, sw0657840EmailUserIndex=sw0657840EmailUserIndex, sw0657840ConfigFile=sw0657840ConfigFile, sw0657840LoopDetected=sw0657840LoopDetected, sw0657840EmailUserTable=sw0657840EmailUserTable, sw0657840DaylightEndTime=sw0657840DaylightEndTime, sw0657840SaveStart=sw0657840SaveStart, sw0657840SMS=sw0657840SMS, sw0657840DnsSetting=sw0657840DnsSetting, sw0657840Snmp=sw0657840Snmp, sw0657840IPAddress=sw0657840IPAddress, sw0657840DefaultGateway=sw0657840DefaultGateway, sw0657840AccountDel=sw0657840AccountDel, sw0657840EmailUserNumber=sw0657840EmailUserNumber, sw0657840AccountAddPassword=sw0657840AccountAddPassword, sw0657840SFPVendorSN=sw0657840SFPVendorSN, sw0657840EmailUserAddress=sw0657840EmailUserAddress, sw0657840NTPServer=sw0657840NTPServer, sw0657840EventNumber=sw0657840EventNumber, sw0657840BandwidthConfEntry=sw0657840BandwidthConfEntry, sw0657840LoopDetectedStateEbl=sw0657840LoopDetectedStateEbl, sw0657840GvrpStateDisabled=sw0657840GvrpStateDisabled, sw0657840AccountName=sw0657840AccountName, sw0657840EmailUsername=sw0657840EmailUsername, sw0657840DramTest=sw0657840DramTest, sw0657840FlashTest=sw0657840FlashTest, sw0657840Tftp=sw0657840Tftp, sw0657840RestoreUser=sw0657840RestoreUser, sw0657840EmailUserEntry=sw0657840EmailUserEntry, sw0657840VlanMetroModeEnabled=sw0657840VlanMetroModeEnabled, sw0657840SFPInfoIndex=sw0657840SFPInfoIndex, sw0657840PortStatusFlwCtrl=sw0657840PortStatusFlwCtrl, partnerkey=partnerkey, sw0657840DualMediaSwapped=sw0657840DualMediaSwapped, sw0657840SFPInfoNumber=sw0657840SFPInfoNumber, sw0657840Email=sw0657840Email, sw0657840MaxPktLenPortNumber=sw0657840MaxPktLenPortNumber, sw0657840LoopDetectedNumber=sw0657840LoopDetectedNumber, groupId=groupId, sw0657840SFPInfo=sw0657840SFPInfo, sw0657840PortStatus=sw0657840PortStatus, sw0657840TrapHostIP=sw0657840TrapHostIP, sw0657840TftpServer=sw0657840TftpServer, sw0657840Event=sw0657840Event, sw0657840BandwidthConfEgressBW=sw0657840BandwidthConfEgressBW, sw0657840SFPFiberType=sw0657840SFPFiberType, sw0657840BiosVsersion=sw0657840BiosVsersion, sw0657840Bandwidth1=sw0657840Bandwidth1, sw0657840ExportConfigName=sw0657840ExportConfigName, sw0657840SFPInfoEntry=sw0657840SFPInfoEntry, sw0657840SFPInfoTable=sw0657840SFPInfoTable, sw0657840AccountAddName=sw0657840AccountAddName, sw0657840TrapHostPort=sw0657840TrapHostPort, sw0657840TrapHostEntry=sw0657840TrapHostEntry, sw0657840CommonSys=sw0657840CommonSys, privatetech=privatetech, sw0657840VlanStateDisabled=sw0657840VlanStateDisabled, sw0657840DaylightSavingTime=sw0657840DaylightSavingTime, sw0657840AccountTable=sw0657840AccountTable, sw0657840BandwidthConfTable=sw0657840BandwidthConfTable, sw0657840LoopDetectedResumed=sw0657840LoopDetectedResumed, sw0657840SMSUserIndex=sw0657840SMSUserIndex, sw0657840StpStateDisabled=sw0657840StpStateDisabled, sw0657840PortStatusEntry=sw0657840PortStatusEntry, sw0657840SMSUserNumber=sw0657840SMSUserNumber, sw0657840BandwidthConfEgressState=sw0657840BandwidthConfEgressState, sw0657840LogEntry=sw0657840LogEntry, sw0657840MechanicalVersion=sw0657840MechanicalVersion, sw0657840NetMask=sw0657840NetMask, sw0657840GetCommunity=sw0657840GetCommunity, sw0657840SFPConnectorType=sw0657840SFPConnectorType, sw0657840TrapHostNumber=sw0657840TrapHostNumber, sw0657840SFPVcc=sw0657840SFPVcc, sw0657840LogNumber=sw0657840LogNumber, sw0657840LacpPortAdded=sw0657840LacpPortAdded, sw0657840SFPVendorPN=sw0657840SFPVendorPN, sw0657840UserLogout=sw0657840UserLogout, sw0657840EmailServer=sw0657840EmailServer, sw0657840EventSendEmail=sw0657840EventSendEmail, sw0657840Port=sw0657840Port, sw0657840IP=sw0657840IP, sw0657840HardwareVersion=sw0657840HardwareVersion, sw0657840MaxPktLenConfEntry=sw0657840MaxPktLenConfEntry, sw0657840DaylightStartTime=sw0657840DaylightStartTime, sw0657840SFPVendorName=sw0657840SFPVendorName, sw0657840PortConfIndex=sw0657840PortConfIndex, sw0657840PortConfDescription=sw0657840PortConfDescription, sw0657840BandwidthConfIndex=sw0657840BandwidthConfIndex, sw0657840PortStatusNumber=sw0657840PortStatusNumber, sw0657840AccountEntry=sw0657840AccountEntry, sw0657840StpTopologyChanged=sw0657840StpTopologyChanged, sw0657840InternalLoopbackTest=sw0657840InternalLoopbackTest, sw0657840MaxPktLenConfSetting=sw0657840MaxPktLenConfSetting, sw0657840SFPTxBias=sw0657840SFPTxBias, sw0657840PortConfEntry=sw0657840PortConfEntry, sw0657840MaxPktLenConfIndex=sw0657840MaxPktLenConfIndex, uplink=uplink, sw0657840PortStatusSpdDpx=sw0657840PortStatusSpdDpx, sw0657840PortConfPortState=sw0657840PortConfPortState, sw0657840System=sw0657840System, sw0657840Firmware=sw0657840Firmware, PYSNMP_MODULE_ID=privatetech, sw0657840SMSPassword=sw0657840SMSPassword, sw0657840SFPDateCode=sw0657840SFPDateCode, sw0657840AccountAuthorization=sw0657840AccountAuthorization)
|
class MinDiffList:
# def __init__(self):
# self.diff = sys.maxint
def findMinDiff(self, arr):
arr.sort()
self.diff = arr[len(arr) - 1]
for iter in range(len(arr)):
adjacentDiff = abs(arr[iter + 1]) - abs(arr[iter])
if adjacentDiff < self.diff:
self.diff = adjacentDiff
return adjacentDiff
findDiff = MinDiffList()
print(findDiff.findMinDiff([1, 2, 3, 4, 5, 888, 100, 120, -5, 0.8]))
|
"""
Author: CaptCorpMURICA
Project: 100DaysPython
File: module1_day06_lists.py
Creation Date: 6/2/2019, 8:55 AM
Description: Learn the basic of lists in python.
"""
list_1 = []
list_2 = list()
print("List 1 Type: {}\nList 2 Type: {}".format(type(list_1), type(list_2)))
text = "Luggage Combination"
print(list(text))
luggage = [1, 3, 5, 2, 4]
luggage.sort()
print(luggage)
numbers = [1, 2, 3, 4, 5]
numbers_sorted = numbers
numbers_sorted.sort(reverse=True)
print("numbers: {}\nnumbers_sorted: {}".format(numbers, numbers_sorted))
numbers = [1, 2, 3, 4, 5]
numbers_sorted = list(numbers)
numbers_sorted.sort(reverse=True)
print("numbers: {}\nnumbers_sorted: {}".format(numbers, numbers_sorted))
odd = [1, 3, 5]
even = [2, 4]
luggage = odd + even
print(luggage)
luggage = [1, 3, 5]
even = [2, 4]
luggage.extend(even)
print(luggage)
odd = [1, 3, 5]
even = [2, 4]
luggage = odd + even
print("Unsorted list: {}".format(luggage))
print("Using the sorted() function: {}".format(sorted(luggage)))
luggage.sort()
print("Using the .sort() method: {}".format(luggage))
lines = []
lines.append("They told me to comb the desert, so I'm combing the desert")
lines.append("YOGURT! I hate Yogurt! Even with strawberries!")
lines.append("We'll meet again in Spaceballs 2 : The Quest for More Money.")
print(lines)
luggage = [1, 2, 3, 4, 5]
print(luggage.index(2))
quote = list("YOGURT! I hate Yogurt! Even with strawberries!")
print(quote.count("r"))
luggage = [1, 2, 4, 5]
luggage.insert(2, 3)
print(luggage)
luggage = [1, 2, 3, 3, 4, 5, 6]
luggage.pop()
print(luggage)
luggage.pop(2)
print(luggage)
rng = list(range(0,10))
rng.remove(7)
print(rng)
countdown = [5, 4, 3, 2, 1]
countdown.reverse()
print(countdown)
sample = list(range(1,13))
times_12 = [i * 12 for i in sample]
print(times_12)
luggage.clear()
print(luggage)
luggage = [2, 2, 3, 4, 5]
luggage[0] = 1
print(luggage)
|
class MagicDice:
def __init__(self, account, active_key):
self.account = account
self.active_key = active_key
|
def countWord(word):
count = 0
with open('test.txt') as file:
for line in file:
if word in line:
count += line.count(word)
return count
word = input('Enter word: ')
count = countWord(word)
print(word, '- occurence: ', count) |
header = """/*
Icebreaker and IceSugar RSMB5 project - RV32I for Lattice iCE40
With complete open-source toolchain flow using:
-> yosys
-> icarus verilog
-> icestorm project
Tests are written in several languages
-> Systemverilog Pure Testbench (Vivado)
-> UVM testbench (Vivado)
-> PyUvm (Icarus)
-> Formal either using SVA and PSL (Vivado) or cuncurrent assertions with Yosys
Copyright (c) 2021 Raffaele Signoriello (raff.signoriello92@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
This file contains register parameters and is autogenerated
*/
"""
sv_inclusion = """
`ifndef COCOTB_SIM
// Main Inclusion
`else
// Main Inclusion
`endif
"""
module_name_param = """
// Main Module
module gen_rif #(
// Parameter Declaration
parameter REG_WIDTH = 32,
parameter ERROUT_IF_NOT_ACCESS = 1
)"""
standard_rif_input_ports = """
(
// Port Declaration
// General RIF input port
input logic rif_clk, // Clock
input logic rif_arst, // Asynchronous reset active high
input logic rif_write, // If 0 -> Read if 1 -> Write
input logic rif_cs, // States if the slave has been properly selected
input logic [REG_WIDTH-1:0] rif_addr, // Address coming into the bus
input logic [REG_WIDTH-1:0] rif_wdata, // Write Data coming into the bus"""
hw_write_template_port = """
input logic [REG_WIDTH-1:0] $input_port_hw_rw_access_name,"""
hw_read_template_port = """
output logic [REG_WIDTH-1:0] $output_port_hw_rw_access_name,"""
standard_rif_output_ports = """
// General RIF output ports
output logic [REG_WIDTH-1:0] rif_rdata, // Read Data coming out the bus
output logic rif_error, // Give error in few specific conditions only
output logic rif_ready // Is controlled by the slave and claims if the specifc slave is busy or not
);"""
set_of_decoder_flags = """
logic $dec_val;"""
set_register = """
logic [REG_WIDTH-1:0] $reg_rw;"""
internal_additional_signals = """
// Register Access Process
logic error_handler, error_access;
logic wr_rq, rd_rq;
// Register decoder we are addressing 1Word at time so remove the first 2 bits
logic [REG_WIDTH-1:0] reg_dec, reg_dec_dly;"""
internal_decoder_signals_generation = """
assign reg_dec = rif_addr >> 2;
always_ff@(posedge rif_clk or posedge rif_arst) begin
if(rif_arst) reg_dec_dly <= 'h0;
else reg_dec_dly <= reg_dec;
end"""
internal_wr_rd_request = """
// Assign the WR_REQUEST and RD_REQUEST
assign wr_rq = rif_write & rif_cs;
assign rd_rq = ~rif_write & rif_cs;
// Register the request to be used for the READY signal
logic [1:0] regsistered_request;
always_ff @(posedge rif_clk or posedge rif_arst) begin : request_reg
if(rif_arst) begin
regsistered_request <= 2'b11;
end else begin
// Regardless of the read of write request we have to register the CS
regsistered_request[0] <= (~rif_cs);
regsistered_request[1] <= regsistered_request[0];
end
end
"""
initialize_decoder_state = """
// Address decoding with full combo logic
always_comb begin: addres_decoding
// Initialize
error_access = 1'b0;"""
init_dec_access = """
$dec_val = 1'b0;"""
case_switch_over_address = """
// Select using the address
case (rif_addr)"""
selection = """
$define_name: begin $dec_val = 1'b1; end"""
defualt_end_case = """
default: begin
if(ERROUT_IF_NOT_ACCESS) error_access = 1'b1;
else error_access = 1'b0;
end
endcase // Endcase
end // addres_decoding
"""
initialize_write_decoder_std = """
// Register write access
always_ff @(posedge rif_clk or posedge rif_arst) begin : proc_reg_write_access
if(rif_arst) begin
rif_rdata <= 'h0;"""
initialize_write_decoder_init_start = """
$reg_name <= $reset_val; """
initialize_write_decoder_init_end = """
end
else begin: reg_write_decoder"""
register_write_decoder_start = """
// Logic for HW = R and SW = RW
if($dec_val) begin
if(wr_rq) begin
$reg_name <= rif_wdata & $sw_write_mask;
end
end"""
register_write_decoder_end = """
end // proc_reg_write_access
"""
errorr_handler_logic_start = """
// check the error using COMBO logic to fire an error if RD happens on a RO register
always_comb begin: read_process_error_handle"""
errorr_handler_logic = """
// Logic for HW = W and SW = RO
if($dec_val) begin
if(wr_rq) begin
error_handler = 1'b1;
end
else if(rd_rq) begin
rif_rdata = $read_reg & $sw_read_mask;
error_handler = 1'b0;
end
end"""
errorr_handler_logic_end = """
end // read_process_error_handle
"""
errorr_handler_write_logic_start = """
// check the error using COMBO logic to fire an error if RD happens on a WO register
always_comb begin: write_process_error_handle"""
errorr_handler_write_logic = """
// Logic for HW = R and SW = WO
if($dec_val) begin
if(rd_rq) begin
error_handler = 1'b1;
rif_rdata = 'h0'
end
else begin
error_handler = 1'b0;
end
end"""
errorr_handler_write_logic_end = """
end // write_process_error_handle
"""
internal_latest_assignement = """
// assign the Error output
assign rif_error = rif_cs ? (error_handler | error_access) : 'h0;
// Assign the ready signal
assign rif_ready = &(regsistered_request);
"""
assign_for_hw_read_policy_reg = """
assign $out_port = rif_cs ? ($reg_name & $hw_read_mask) : 'h0;"""
assign_for_hw_write_policy_reg = """
assign $reg_name = $in_port & $hw_write_mask;"""
end_module_rif = """
endmodule : gen_rif""" |
num = int(input())
x = 0
if num == 0:
print(1)
exit()
while num != 0:
x +=1
num = num//10
print(x)
|
class SpecValidator:
def __init__(self, type=None, default=None, choices=[], min=None,
max=None):
self.type = type
self.default = default
self.choices = choices
self.min = min
self.max = max
|
"""FactoryAggregate provider prototype."""
class FactoryAggregate:
"""FactoryAggregate provider prototype."""
def __init__(self, **factories):
"""Initialize instance."""
self.factories = factories
def __call__(self, factory_name, *args, **kwargs):
"""Create object."""
return self.factories[factory_name](*args, **kwargs)
def __getattr__(self, factory_name):
"""Return factory with specified name."""
return self.factories[factory_name]
|
def f(x):
#return 1*x**3 + 5*x**2 - 2*x - 24
#return 1*x**4 - 4*x**3 - 2*x**2 + 12*x - 3
return 82*x + 6*x**2 - 0.67*x**3
print(f(2)-f(1))
#print((f(3.5) - f(0.5)) / -3)
#print(f(0.5)) |
# Weird Algorithm
# Consider an algorithm that takes as input a positive integer n. If n is even, the algorithm divides it by two, and if n is odd, the algorithm multiplies it by three and adds one. The algorithm repeats this, until n is one.
n = int(input())
print(n, end=" ")
while n != 1:
if n % 2 == 0:
n = n // 2
else:
n = (n * 3) + 1
print(n, end=" ")
|
T = int(input())
if T > 100:
print('Steam')
elif T < 0:
print('Ice')
else:
print('Water')
|
PSQL_CONNECTION_PARAMS = {
'dbname': 'ifcb',
'user': '******',
'password': '******',
'host': '/var/run/postgresql/'
}
DATA_DIR = '/mnt/ifcb'
|
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
tunacell package
============
plotting/defs.py module
~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
DEFAULT_COLORS = ('red', 'blue', 'purple', 'green', 'yellowgreen', 'cyan',
'magenta',
'indigo', 'darkorange', 'pink', 'yellow')
colors = DEFAULT_COLORS
# plotting parameters
params = {'length': {
'bottom': 1.,
'top': 8.,
'delta': 2.,
'unit': '$\mu$m'
},
'dot_length': {
'bottom': 1e-2,
'top': 1e-1,
'delta': 3e-2,
'unit': '$\mu$m/hr'
},
'dotlog_length': {
'bottom': 0.5,
'top': 2.5,
'delta': 0.5,
'unit': 'dbs/hr'
},
'width': {
'bottom': .5,
'top': 1.5,
'delta': .2,
'unit': '$\mu$m'
},
'fluo': {
'bottom': 1e5,
'top': 2e6,
'delta': 5e5,
'unit': 'A.U.'
},
'dot_fluo': {
'bottom': 1e2,
'top': 5e4,
'delta': 1e4,
'unit': 'A.U./hr'
},
'dotlog_fluo': {
'bottom': 0.1,
'top': 3,
'delta': 0.5,
'unit': 'dbs/hr'
},
'concentration': {
'bottom': 2e5,
'top': 5e5,
'delta': 1e5,
},
'volume': {
'bottom': 0.,
'top': 4.,
'delta': 1.,
'unit': '$\mu$m$^3$'
},
'area': {
'bottom': 1.,
'top': 8.,
'delta': 2.,
'unit': '$\mu$m$^2$'
},
'dotlog_area': {
'bottom': 0.5,
'top': 2.5,
'delta': 0.5,
'unit': 'dbs/hr'
},
'density': {
'bottom': 1e5,
'top': 4e5,
'delta': 1e5
},
'ALratio': {
'bottom': .1,
'top': 1.5,
'delta': .4,
'unit': '$\mu$m'
},
'age': {
'bottom': 0.,
'top': 1.
}
}
def get_params(obs, params, *keys):
return [params[obs][k] for k in keys] |
class KeyBoardService():
def __init__(self):
pass
def is_key_pressed(self, *keys):
pass
def is_key_released(self, *key):
pass |
#!/usr/bin/env python3
"""Switcharoo.
Create a function that takes a string and returns a new string with its
first and last characters swapped, except under three conditions:
If the length of the string is less than two, return "Incompatible.".
If the argument is not a string, return "Incompatible.".
If the first and last characters are the same, return "Two's a pair.".
Source:
https://edabit.com/challenge/tnKZCAkdnZpiuDiWA
"""
def flip_end_chars(txt):
"""Flip the first and last characters if txt is a string."""
if isinstance(txt, str) and txt and len(txt) > 1:
first, last = txt[0], txt[-1]
if first == last:
return "Two's a pair."
return "{}{}{}".format(last, txt[1:-1], first)
return "Incompatible."
def main():
assert flip_end_chars("Cat, dog, and mouse.") == ".at, dog, and mouseC"
assert flip_end_chars("Anna, Banana") == "anna, BananA"
assert flip_end_chars("[]") == "]["
assert flip_end_chars("") == "Incompatible."
assert flip_end_chars([1, 2, 3]) == "Incompatible."
assert flip_end_chars("dfdkf49824fdfdfjhd") == "Two's a pair."
assert flip_end_chars("#343473847#") == "Two's a pair."
print('Passed.')
if __name__ == "__main__":
main()
|
"""1/1 adventofcode"""
with open("input.txt", "r", encoding="UTF-8") as i_file:
data = list(map(int, i_file.read().splitlines()))
values = ["i" if data[i] > data[i - 1] else "d" for i in range(1, len(data))]
print(values.count("i"))
|
def past(h, m, s):
h_ms = h * 3600000
m_ms = m * 60000
s_ms = s * 1000
return h_ms + m_ms + s_ms
# Best Practices
def past(h, m, s):
return (3600*h + 60*m + s) * 1000 |
# En este problema vamos a resolver el problema de la bandera de Dijkstra.
# Tenemos una fila de fichas que cada una puede ser de un único color: roja, verde o azul. Están colocadas en un orden cualquiera
# y tenemos que ordenarlas de manera que quede, de izquierda a derecha, los colores ordenados primero en rojo, luego verde y por
# último azul. La organización se obtiene mediante intercambios sucesivos, pero el color de la ficha sólo se comprueba una vez.
def intercambiar(bandera, x, y):
temporal = bandera[x]
bandera[x] = bandera[y]
bandera[y] = temporal
def permutar(bandera, i, j, k):
if k != j:
if bandera[j+1] == "R":
intercambiar(bandera, i+1, j+1)
permutar(bandera, i+1, j+1, k)
elif bandera[j+1] == "V":
permutar(bandera, i, j+1, k)
elif bandera[j+1] == "A":
intercambiar(bandera, j+1, k)
permutar(bandera, i, j, k-1)
else:
print("Has introducido una ficha inválida")
exit()
return bandera
bandera = [""]
n = int(input("Introduce el número de elementos que quieres en tu bandera a ordenar: "))
print("Ahora introduce las fichas aleatoriamente (ficha roja = R, ficha verde = V, ficha azul = A)")
for i in range (0, n):
ele = input()
ele = ele.capitalize()
bandera.append(ele)
bandera_ordenada = permutar(bandera, 0, 0, len(bandera) - 1)
bandera_ordenada.pop(0)
print("¡Esta es tu bandera ordenada!\n" + str(bandera_ordenada)) |
# Iteration: Repeat the same procedure until it reaches a end point.
# Specify the data to iterate over,what to do to data at every step, and we need to specify when our loop should stop.
# Infinite Loop: Bug that may occur when ending condition speicified incorrectly or not specified.
spices = [
'salt',
'pepper',
'cumin',
'turmeric'
]
for spice in spices: # in is a python keyword that indicates that what follows is the set of values that we want to iterate over
print(spice)
print("No more boring omelettes!")
|
# coding: utf-8
print(__import__('task_list_dev').tools.get_list())
|
#Warmup-1 > not_string
def not_string(str):
if str.startswith('not'):
return str
else:
return "not " + str |
num = int(input('Digite um número: '))
print('''Qual será a base de conversão do número {}
[1] para "binário"
[2] para "octal"
[3] para "hexadecimal"'''.format(num))
num1 = int(input('Escolha uma opção: '))
if num1 == 1:
print('Você escolheu converter o número {} para binário. O valor é de {}.'.format(
num, bin(num)))
elif num1 == 2:
print('Você escolheu converter o número {} para octal. O valor é de {}'.format(
num, oct(num)))
elif num1 == 3:
print('Você escolheu converter o número {} para hexadecimal. O valor é de {}'.format(
num, hex(num)))
else:
print('Escolha uma opção válida.')
|
'''
Docstring with single quotes instead of double quotes.
'''
my_str = "not an int"
|
def selection_sort(input_list):
for i in range(len(input_list)):
min_index = i
for k in range(i, len(input_list)):
if input_list[k] < input_list[min_index]:
min_index = k
input_list[i], input_list[min_index] = input_list[min_index], input_list[i]
return input_list
|
username = 'user@example.com'
password = 'hunter2'
# larger = less change of delays if you skip a lot
# smaller = more responsive to ups/downs
queue_size = 2 |
""" A list of stopwords to filter out, in addition to those that are already being filtered by the built-in toolkit. """
CustomStopwords = ['alltid', 'fler', 'ta', 'tar', 'sker', 'redan', 'who', 'what', 'gilla', 'big', 'something','fler',
'cv', 'snart', 'minst', 'kunna', '000', 'hr-plus', 'enligt', 'is/it', 'vill', 'samt',
'tjänsten', 'kommer', 'hos', 'goda', 'person', 'tror', 'skapa', 'ge', 'ger', 'sitta', 'sitter', 'sitt',
'även', 'del', 'ansökan', 'söker', 'både', 'arbeta', 'bland', 'annat', 'års', 'göra', 'gör', 'rätt',
'många']
Punctuation = ['”', '·', '’', "''", '--', '-', '–']
CompanyNames = ['visma', 'tietoevry', 'columbus', 'barkfors', '//www.instagram.com/columbussverige/']
Technologies = ['http', 'https']
|
# import logging
# logging.basicConfig(filename='example.log',level=logging.DEBUG)
# logging.debug('This message should go to the log file')
# logging.info('So should this')
# logging.warning('And this, too ã')
class ValidaSmart():
def __init__(self):
self._carrega_modulos_externos()
def _carrega_modulos_externos(self):
self.layout_pessoas = LayoutPessoas()
self.layout_pessoas_enderecos = LayoutPessoasEnderecos()
self.layout_produtos = LayoutProdutos()
def executa(self):
print('[ValidaSmart] Executando...')
self.layout_pessoas.executa()
self.layout_pessoas_enderecos.executa()
self.layout_produtos.executa()
print('[ValidaSmart] Executado!')
########################################################
class LayoutPessoas():
def __init__(self):
self._carrega_modulos_externos()
def _carrega_modulos_externos(self):
pass
def executa(self):
print('[LayoutPessoas] Executando...')
print('[LayoutPessoas] Executado!')
class LayoutPessoasEnderecos():
def __init__(self):
self._carrega_modulos_externos()
def _carrega_modulos_externos(self):
pass
def executa(self):
print('[LayoutPessoasEnderecos] Executando...')
print('[LayoutPessoasEnderecos] Executado!')
class LayoutProdutos():
def __init__(self):
self._carrega_modulos_externos()
def _carrega_modulos_externos(self):
self.campo_ncm = CampoNCM([1, 2, 3, 4, 5])
def executa(self):
print('[LayoutProdutos] Executando...')
self.campo_ncm.confere_dados()
print('[LayoutProdutos] Executado!')
########################################################
def busca_ncm(ncm):
print(f'[Funcao Busca NCM] Buscando NCM {ncm}')
if ncm == 1:
print(f'[Funcao Busca NCM] NCM {ncm} é válido')
else:
print(f'[Funcao Busca NCM] NCM {ncm} é inválido')
########################################################
class CampoTipoString():
def __init__(self, lista_registros):
self.lista_registros = lista_registros
self._quantidade_registros = len(self.lista_registros)
self._nome_classe = self.__class__.__name__
@property
def tipo(self):
return 'string'
def confere_dados(self):
print(f'[{self._nome_classe}] Iniciando a conferencia padrão...')
self._verifica_tipo_campo()
self._verifica_tamanho_campo()
self._valida_registros_em_branco()
print(f'[{self._nome_classe}] Conferência padrão concluída.')
def _verifica_tipo_campo(self):
print(f'[{self._nome_classe}] Verificando tipo do campo...')
print(f'[{self._nome_classe}] Tipo do campo verificado.')
def _verifica_tamanho_campo(self):
print(f'[{self._nome_classe}] Verificando tamanho do campo...')
print(f'[{self._nome_classe}] Tamanho do campo verificado.')
def _valida_registros_em_branco(self):
print(f'[{self._nome_classe}] Validando caracteres em branco...')
print(f'[{self._nome_classe}] Validação de caracteres em branco concluída.')
########################################################
class CampoNCM(CampoTipoString):
def confere_dados(self):
super().confere_dados()
print(f'[{self._nome_classe}] Iniciando a conferencias específicas do campo...')
self._valida_caracteres_permitidos()
print(f'[{self._nome_classe}] Conferencias específicas do campo concluídas...')
def busca_ncms(self):
print('[CampoNCM] Buscando NCMs...')
for ncm in self.lista_registros:
busca_ncm(ncm)
print('[CampoNCM] Busca de NCMs concluída.')
def _valida_caracteres_permitidos(self):
print(f'[{self._nome_classe}] Validando caracteres...')
print(f'[{self._nome_classe}] Caracteres validados.')
if __name__ == '__main__':
valida_smart = ValidaSmart()
valida_smart.executa()
print(valida_smart.layout_produtos.campo_ncm.tipo) |
machine_number = 43
user_number = int( raw_input("enter a number: ") )
print( type(user_number) )
if user_number == machine_number:
print("Bravo!!!")
|
def pedir_entero (mensaje,min,max):
numero = input(mensaje.format(min,max))
if type(numero)==int:
while numero <= min or numero>=max:
numero = input("el numero debe estar entre {:d} y {:d} ".format(min,max))
return numero
else:
return "debes introducir un entero"
valido = pedir_entero("Cual es tu numero favorito entre {:d} y {:d}? ",-25,25)
if type(valido)==int:
print("Has introducido un numero valido: {:d}".format(valido))
else :
print(valido) |
test_cases = int(input().strip())
def sum_sub_nums(idx, value):
global result
if value == K:
result += 1
return
if value > K or idx >= N:
return
sum_sub_nums(idx + 1, value)
sum_sub_nums(idx + 1, value + nums[idx])
for t in range(1, test_cases + 1):
N, K = map(int, input().strip().split())
nums = list(map(int, input().strip().split()))
result = 0
sum_sub_nums(0, 0)
print('#{} {}'.format(t, result))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.