content
stringlengths 7
1.05M
| fixed_cases
stringlengths 1
1.28M
|
|---|---|
vacation_cost = float(input())
available_money = float(input())
spending_counter = 0
days_passed = 0
saved = True
while available_money < vacation_cost:
#spend or save
action_type = input()
current_sum = float(input())
days_passed += 1
if action_type == 'spend':
spending_counter += 1
available_money -= current_sum
if available_money < 0:
available_money = 0
elif action_type == 'save':
available_money += current_sum
if spending_counter == 5:
print("You can't save the money.")
print(days_passed)
saved = False
break
if saved:
print(f'You saved the money for {days_passed} days.')
|
vacation_cost = float(input())
available_money = float(input())
spending_counter = 0
days_passed = 0
saved = True
while available_money < vacation_cost:
action_type = input()
current_sum = float(input())
days_passed += 1
if action_type == 'spend':
spending_counter += 1
available_money -= current_sum
if available_money < 0:
available_money = 0
elif action_type == 'save':
available_money += current_sum
if spending_counter == 5:
print("You can't save the money.")
print(days_passed)
saved = False
break
if saved:
print(f'You saved the money for {days_passed} days.')
|
NOT_FOUND = -1
class Search(object):
def __init__(self, sample):
self.sample = sample
|
not_found = -1
class Search(object):
def __init__(self, sample):
self.sample = sample
|
__all__ = 'MissingContextVariable',
class MissingContextVariable(KeyError):
pass
|
__all__ = ('MissingContextVariable',)
class Missingcontextvariable(KeyError):
pass
|
# with-Statement
def setup():
size(400, 400)
background(255)
def draw():
fill(color(255, 153, 0))
ellipse(100, 100, 50, 50)
with pushStyle():
fill(color(255, 51, 51))
strokeWeight(5)
ellipse(200, 200, 50, 50)
ellipse(300, 300, 50, 50)
|
def setup():
size(400, 400)
background(255)
def draw():
fill(color(255, 153, 0))
ellipse(100, 100, 50, 50)
with push_style():
fill(color(255, 51, 51))
stroke_weight(5)
ellipse(200, 200, 50, 50)
ellipse(300, 300, 50, 50)
|
# Develop a program that calculates the sum between all the odd numbers
# that are multiples of three and are in the range of 1 to 500.
sum = 0
for i in range(1,501):
if (i % 2 != 0 ) and (i % 3 == 0):
sum += i
print(sum)
|
sum = 0
for i in range(1, 501):
if i % 2 != 0 and i % 3 == 0:
sum += i
print(sum)
|
# https://www.codewars.com/kata/526571aae218b8ee490006f4/
'''
Instructions :
Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is non-negative.
Example: The binary representation of 1234 is 10011010010, so the function should return 5 in this case
'''
def countBits(n):
return bin(n).replace('0b', '').count('1')
|
"""
Instructions :
Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is non-negative.
Example: The binary representation of 1234 is 10011010010, so the function should return 5 in this case
"""
def count_bits(n):
return bin(n).replace('0b', '').count('1')
|
# this is a part of binary search tree class.
# The right, left and parent functions can be found in the binary search tree implementation.
def TreeSearch(T,p,k):
if k == p.key():
return p # successful search
elif k < p.key() and T.left(p) is not None:
return TreeSearch(T,T.left(p),k) # recur on the left subtree
elif k > p.key() and T.right(p) is not None:
return TreeSearch(T,T.right(p),k) # recur on the right subtree
return p # unsuccessful search
|
def tree_search(T, p, k):
if k == p.key():
return p
elif k < p.key() and T.left(p) is not None:
return tree_search(T, T.left(p), k)
elif k > p.key() and T.right(p) is not None:
return tree_search(T, T.right(p), k)
return p
|
def isNode(data):
if type(data) == Node:
return True
else:
return False
class Node:
def __init__(self, data=None) -> None:
self.data = data
self.previous = None
self.next = None
def __str__(self) -> str:
if self.previous == None and self.next == None:
return (
f"Previous Node: None <---Current Node: {self.data}--->Next Node: None"
)
elif self.next == None:
return f"Previous Node: {self.previous.data}<---Current Node: {self.data}--->Next Node: Tail"
elif self.previous == None:
return f"Previous Node: Beginning <---Current Node: {self.data}--->Next Node: {self.next.data}"
return f"Previous Node: {self.previous.data}<---Current Node: {self.data}--->Next Node: {self.next.data}"
class DoublyLinkedList:
def __init__(self) -> None:
self.head = None
self.tail = None
self.count = 0
def create_a_Node(self, data):
self.count += 1
if self.head == None:
newNode = Node(data)
self.head = newNode
self.tail = newNode
else:
newNode = Node(data)
return newNode
def add_at_begin(self, data):
currentNode = self.head
newNode = DoublyLinkedList.create_a_Node(self, data)
currentNode.previous = newNode
newNode.next = currentNode
self.head = newNode
def add_at_end(self, data):
currentNode = self.tail
newNode = DoublyLinkedList.create_a_Node(self, data)
currentNode.next = newNode
newNode.previous = currentNode
self.tail = newNode
def insert_in_middle(self, data, num):
index = 1
currentNode = self.head
while index < num:
currentNode = currentNode.next
index += 1
nextNode = currentNode.next
newNode = DoublyLinkedList.create_a_Node(self, data)
newNode.previous = currentNode
newNode.next = currentNode.next
nextNode.previous = newNode
currentNode.next = newNode
def print_node_in_list(self):
currentNode = self.head
while currentNode.next != None:
print(currentNode)
currentNode = currentNode.next
print(currentNode)
def delNode(self, num ):
if num == 1:
currentNode = self.head
currentNode.next.previous = None
self.head = currentNode.next
elif num == -1:
currentNode = self.tail
currentNode.previous.next = None
self.tail = currentNode.previous
else:
index = 1
currentNode = self.head
while index < num:
currentNode = currentNode.next
index += 1
connectnext = currentNode.previous
connectprevious = currentNode.next
connectnext.next = connectprevious
connectprevious.previous = connectnext
self.count -= 1
def searchNode(self,data,isdel = 0 ):
isfound = False
foundNode = None
currentNode1 = self.head
currentNode2 = self.tail
while currentNode1 !=currentNode2 :
if currentNode1.data == data:
isfound = True
foundNode = currentNode1
print(f'Found it {foundNode}')
break
elif currentNode2.data == data:
isfound = True
foundNode = currentNode2
print(f'Found it {foundNode}')
break
else:
currentNode1 = currentNode1.next
currentNode2 = currentNode2.previous
if isfound == False:
if currentNode1.data == data:
foundNode = currentNode1
print(f'Found it {foundNode}')
isfound = True
if isdel == 1:
self.count -=1
connectpre = foundNode.next
connectnext = foundNode.previous
connectpre.previous = connectnext
connectnext.next = connectpre
print(f'{foundNode} Deleted')
return foundNode
else:
return foundNode
else:
print(f'Not found')
return None
if __name__ == "__main__":
myDoublyLinkedlist = DoublyLinkedList()
myDoublyLinkedlist.create_a_Node("Elaine")
myDoublyLinkedlist.add_at_end("Kyle")
myDoublyLinkedlist.add_at_end("Ming")
myDoublyLinkedlist.add_at_begin("Meimei")
myDoublyLinkedlist.add_at_begin("Jenny")
myDoublyLinkedlist.insert_in_middle("Kerwin", 2)
myDoublyLinkedlist.delNode(2)
myDoublyLinkedlist.print_node_in_list()
myDoublyLinkedlist.searchNode('Elaine',1)
print(myDoublyLinkedlist.count)
myDoublyLinkedlist.print_node_in_list()
# initcialNode = Node("Elaine")
# initcialNode2 = Node("Kyle")
# initcialNode3 = Node('2')
# myDoublyLinkedlist.head = initcialNode
# initcialNode.next = initcialNode2
# initcialNode2.previous = initcialNode
# initcialNode3.previous = initcialNode2
# initcialNode2.next = initcialNode3
# print(initcialNode2)
# print(initcialNode)
# print(initcialNode3)
|
def is_node(data):
if type(data) == Node:
return True
else:
return False
class Node:
def __init__(self, data=None) -> None:
self.data = data
self.previous = None
self.next = None
def __str__(self) -> str:
if self.previous == None and self.next == None:
return f'Previous Node: None <---Current Node: {self.data}--->Next Node: None'
elif self.next == None:
return f'Previous Node: {self.previous.data}<---Current Node: {self.data}--->Next Node: Tail'
elif self.previous == None:
return f'Previous Node: Beginning <---Current Node: {self.data}--->Next Node: {self.next.data}'
return f'Previous Node: {self.previous.data}<---Current Node: {self.data}--->Next Node: {self.next.data}'
class Doublylinkedlist:
def __init__(self) -> None:
self.head = None
self.tail = None
self.count = 0
def create_a__node(self, data):
self.count += 1
if self.head == None:
new_node = node(data)
self.head = newNode
self.tail = newNode
else:
new_node = node(data)
return newNode
def add_at_begin(self, data):
current_node = self.head
new_node = DoublyLinkedList.create_a_Node(self, data)
currentNode.previous = newNode
newNode.next = currentNode
self.head = newNode
def add_at_end(self, data):
current_node = self.tail
new_node = DoublyLinkedList.create_a_Node(self, data)
currentNode.next = newNode
newNode.previous = currentNode
self.tail = newNode
def insert_in_middle(self, data, num):
index = 1
current_node = self.head
while index < num:
current_node = currentNode.next
index += 1
next_node = currentNode.next
new_node = DoublyLinkedList.create_a_Node(self, data)
newNode.previous = currentNode
newNode.next = currentNode.next
nextNode.previous = newNode
currentNode.next = newNode
def print_node_in_list(self):
current_node = self.head
while currentNode.next != None:
print(currentNode)
current_node = currentNode.next
print(currentNode)
def del_node(self, num):
if num == 1:
current_node = self.head
currentNode.next.previous = None
self.head = currentNode.next
elif num == -1:
current_node = self.tail
currentNode.previous.next = None
self.tail = currentNode.previous
else:
index = 1
current_node = self.head
while index < num:
current_node = currentNode.next
index += 1
connectnext = currentNode.previous
connectprevious = currentNode.next
connectnext.next = connectprevious
connectprevious.previous = connectnext
self.count -= 1
def search_node(self, data, isdel=0):
isfound = False
found_node = None
current_node1 = self.head
current_node2 = self.tail
while currentNode1 != currentNode2:
if currentNode1.data == data:
isfound = True
found_node = currentNode1
print(f'Found it {foundNode}')
break
elif currentNode2.data == data:
isfound = True
found_node = currentNode2
print(f'Found it {foundNode}')
break
else:
current_node1 = currentNode1.next
current_node2 = currentNode2.previous
if isfound == False:
if currentNode1.data == data:
found_node = currentNode1
print(f'Found it {foundNode}')
isfound = True
if isdel == 1:
self.count -= 1
connectpre = foundNode.next
connectnext = foundNode.previous
connectpre.previous = connectnext
connectnext.next = connectpre
print(f'{foundNode} Deleted')
return foundNode
else:
return foundNode
else:
print(f'Not found')
return None
if __name__ == '__main__':
my_doubly_linkedlist = doubly_linked_list()
myDoublyLinkedlist.create_a_Node('Elaine')
myDoublyLinkedlist.add_at_end('Kyle')
myDoublyLinkedlist.add_at_end('Ming')
myDoublyLinkedlist.add_at_begin('Meimei')
myDoublyLinkedlist.add_at_begin('Jenny')
myDoublyLinkedlist.insert_in_middle('Kerwin', 2)
myDoublyLinkedlist.delNode(2)
myDoublyLinkedlist.print_node_in_list()
myDoublyLinkedlist.searchNode('Elaine', 1)
print(myDoublyLinkedlist.count)
myDoublyLinkedlist.print_node_in_list()
|
"""test too short name
"""
__revision__ = 1
A = None
def a():
"""yo"""
pass
|
"""test too short name
"""
__revision__ = 1
a = None
def a():
"""yo"""
pass
|
# weight = [3, 5, 7]
# n = len(weight)
# a = 6
#
# for i in range(n):
# print(weight)
# if weight[i] < a:
# weight.remove(weight[i])
#
# print(weight)
# arr8 = [4, 3, 4, 4, 4, 2]
#
# print('start')
# for i in range(len(arr8) - 1):
# print(arr8[:i+1], arr8[i+1:], " - ", i)
def solution(arr):
size = 0
value = 0
for i in range(len(arr)):
if size == 0:
value = arr[i]
size += 1
else:
if value != arr[i] and size != 0:
size -= 1
else:
size += 1
leader = value
if arr.count(leader) <= len(arr) // 2:
return 0
print("Leader - ", leader)
print("Count - ", arr.count(leader))
equi_leaders = 0
leader_count_so_far = 0
for index in range(len(arr)):
if arr[index] == leader:
leader_count_so_far += 1
if leader_count_so_far > (index + 1) // 2 and \
arr.count(leader) - leader_count_so_far > (len(arr) - index - 1) // 2:
equi_leaders += 1
return equi_leaders
a = [2, 5, 5, 4, 4, 4]
b = [3, 4]
arr4 = [4, 3, 4, 4, 4, 2]
print(solution(arr4), "Answer - 2")
print(solution([1, 2, 3, 4, 5]), "Andwer - 0")
print(solution([1, 2]), "Answer - 0")
|
def solution(arr):
size = 0
value = 0
for i in range(len(arr)):
if size == 0:
value = arr[i]
size += 1
elif value != arr[i] and size != 0:
size -= 1
else:
size += 1
leader = value
if arr.count(leader) <= len(arr) // 2:
return 0
print('Leader - ', leader)
print('Count - ', arr.count(leader))
equi_leaders = 0
leader_count_so_far = 0
for index in range(len(arr)):
if arr[index] == leader:
leader_count_so_far += 1
if leader_count_so_far > (index + 1) // 2 and arr.count(leader) - leader_count_so_far > (len(arr) - index - 1) // 2:
equi_leaders += 1
return equi_leaders
a = [2, 5, 5, 4, 4, 4]
b = [3, 4]
arr4 = [4, 3, 4, 4, 4, 2]
print(solution(arr4), 'Answer - 2')
print(solution([1, 2, 3, 4, 5]), 'Andwer - 0')
print(solution([1, 2]), 'Answer - 0')
|
"""Demo assignment with separate test files."""
def square(x):
"""Return x squared."""
return x * x
def double(x):
"""Return x doubled."""
return x # Incorrect
|
"""Demo assignment with separate test files."""
def square(x):
"""Return x squared."""
return x * x
def double(x):
"""Return x doubled."""
return x
|
class GeometryBase(CommonObject,IDisposable,ISerializable):
# no doc
def ComponentIndex(self):
""" ComponentIndex(self: GeometryBase) -> ComponentIndex """
pass
def ConstructConstObject(self,*args):
""" ConstructConstObject(self: CommonObject,parentObject: object,subobject_index: int) """
pass
def Dispose(self):
""" Dispose(self: CommonObject,disposing: bool) """
pass
def Duplicate(self):
""" Duplicate(self: GeometryBase) -> GeometryBase """
pass
def DuplicateShallow(self):
""" DuplicateShallow(self: GeometryBase) -> GeometryBase """
pass
def GetBoundingBox(self,*__args):
"""
GetBoundingBox(self: GeometryBase,plane: Plane) -> BoundingBox
GetBoundingBox(self: GeometryBase,plane: Plane) -> (BoundingBox,Box)
GetBoundingBox(self: GeometryBase,accurate: bool) -> BoundingBox
GetBoundingBox(self: GeometryBase,xform: Transform) -> BoundingBox
"""
pass
def GetUserString(self,key):
""" GetUserString(self: GeometryBase,key: str) -> str """
pass
def GetUserStrings(self):
""" GetUserStrings(self: GeometryBase) -> NameValueCollection """
pass
def MakeDeformable(self):
""" MakeDeformable(self: GeometryBase) -> bool """
pass
def MemoryEstimate(self):
""" MemoryEstimate(self: GeometryBase) -> UInt32 """
pass
def NonConstOperation(self,*args):
""" NonConstOperation(self: CommonObject) """
pass
def OnSwitchToNonConst(self,*args):
""" OnSwitchToNonConst(self: GeometryBase) """
pass
def Rotate(self,angleRadians,rotationAxis,rotationCenter):
""" Rotate(self: GeometryBase,angleRadians: float,rotationAxis: Vector3d,rotationCenter: Point3d) -> bool """
pass
def Scale(self,scaleFactor):
""" Scale(self: GeometryBase,scaleFactor: float) -> bool """
pass
def SetUserString(self,key,value):
""" SetUserString(self: GeometryBase,key: str,value: str) -> bool """
pass
def Transform(self,xform):
""" Transform(self: GeometryBase,xform: Transform) -> bool """
pass
def Translate(self,*__args):
"""
Translate(self: GeometryBase,x: float,y: float,z: float) -> bool
Translate(self: GeometryBase,translationVector: Vector3d) -> bool
"""
pass
def __enter__(self,*args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self,*args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,*args): #cannot find CLR constructor
""" __new__(cls: type,info: SerializationInfo,context: StreamingContext) """
pass
def __reduce_ex__(self,*args):
pass
HasBrepForm=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: HasBrepForm(self: GeometryBase) -> bool
"""
IsDeformable=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsDeformable(self: GeometryBase) -> bool
"""
IsDocumentControlled=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: IsDocumentControlled(self: GeometryBase) -> bool
"""
ObjectType=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: ObjectType(self: GeometryBase) -> ObjectType
"""
UserStringCount=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Get: UserStringCount(self: GeometryBase) -> int
"""
|
class Geometrybase(CommonObject, IDisposable, ISerializable):
def component_index(self):
""" ComponentIndex(self: GeometryBase) -> ComponentIndex """
pass
def construct_const_object(self, *args):
""" ConstructConstObject(self: CommonObject,parentObject: object,subobject_index: int) """
pass
def dispose(self):
""" Dispose(self: CommonObject,disposing: bool) """
pass
def duplicate(self):
""" Duplicate(self: GeometryBase) -> GeometryBase """
pass
def duplicate_shallow(self):
""" DuplicateShallow(self: GeometryBase) -> GeometryBase """
pass
def get_bounding_box(self, *__args):
"""
GetBoundingBox(self: GeometryBase,plane: Plane) -> BoundingBox
GetBoundingBox(self: GeometryBase,plane: Plane) -> (BoundingBox,Box)
GetBoundingBox(self: GeometryBase,accurate: bool) -> BoundingBox
GetBoundingBox(self: GeometryBase,xform: Transform) -> BoundingBox
"""
pass
def get_user_string(self, key):
""" GetUserString(self: GeometryBase,key: str) -> str """
pass
def get_user_strings(self):
""" GetUserStrings(self: GeometryBase) -> NameValueCollection """
pass
def make_deformable(self):
""" MakeDeformable(self: GeometryBase) -> bool """
pass
def memory_estimate(self):
""" MemoryEstimate(self: GeometryBase) -> UInt32 """
pass
def non_const_operation(self, *args):
""" NonConstOperation(self: CommonObject) """
pass
def on_switch_to_non_const(self, *args):
""" OnSwitchToNonConst(self: GeometryBase) """
pass
def rotate(self, angleRadians, rotationAxis, rotationCenter):
""" Rotate(self: GeometryBase,angleRadians: float,rotationAxis: Vector3d,rotationCenter: Point3d) -> bool """
pass
def scale(self, scaleFactor):
""" Scale(self: GeometryBase,scaleFactor: float) -> bool """
pass
def set_user_string(self, key, value):
""" SetUserString(self: GeometryBase,key: str,value: str) -> bool """
pass
def transform(self, xform):
""" Transform(self: GeometryBase,xform: Transform) -> bool """
pass
def translate(self, *__args):
"""
Translate(self: GeometryBase,x: float,y: float,z: float) -> bool
Translate(self: GeometryBase,translationVector: Vector3d) -> bool
"""
pass
def __enter__(self, *args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self, *args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self, *args):
""" __new__(cls: type,info: SerializationInfo,context: StreamingContext) """
pass
def __reduce_ex__(self, *args):
pass
has_brep_form = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: HasBrepForm(self: GeometryBase) -> bool\n\n\n\n'
is_deformable = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: IsDeformable(self: GeometryBase) -> bool\n\n\n\n'
is_document_controlled = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: IsDocumentControlled(self: GeometryBase) -> bool\n\n\n\n'
object_type = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: ObjectType(self: GeometryBase) -> ObjectType\n\n\n\n'
user_string_count = property(lambda self: object(), lambda self, v: None, lambda self: None)
'Get: UserStringCount(self: GeometryBase) -> int\n\n\n\n'
|
def sort(elements):
while True:
swapped = False
for i in range(len(elements)-1):
if elements[i] > elements[i+1]:
# swap
temp = elements[i]
elements[i] = elements[i+1]
elements[i+1] = temp
swapped = True
if not swapped:
break
return elements
|
def sort(elements):
while True:
swapped = False
for i in range(len(elements) - 1):
if elements[i] > elements[i + 1]:
temp = elements[i]
elements[i] = elements[i + 1]
elements[i + 1] = temp
swapped = True
if not swapped:
break
return elements
|
PORT = 8000
URL = "http://localhost:{}".format(PORT)
SITE_LOCATION = 'test_site/index.html'
csv_log_single_site_init = [(False, False, True), (False, False, False)]
# TODO: Add logs and csv tests
# (True, False, True), (False, False, True), (True, True, True)]
variations = [{
'element': 'id',
'element_id': 'header',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'headerLeft',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'headerRight',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'wrapall',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'sidebar',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'logo',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'sidebarContent',
'expected_amount': 1,
}, {
'element': 'id',
'element_id': 'main',
'expected_amount': 1,
}
]
TESTS = list()
for variation in variations:
for options in csv_log_single_site_init:
init_params = dict()
init_params['url'] = URL
init_params['element_id'] = variation['element_id']
init_params['csv'] = options[0]
init_params['debug'] = options[1]
init_params['single_site'] = options[2]
TESTS.append(
(init_params, variation['element'], variation['element_id'], URL, options[0], options[1], options[2], variation['expected_amount']))
|
port = 8000
url = 'http://localhost:{}'.format(PORT)
site_location = 'test_site/index.html'
csv_log_single_site_init = [(False, False, True), (False, False, False)]
variations = [{'element': 'id', 'element_id': 'header', 'expected_amount': 1}, {'element': 'id', 'element_id': 'headerLeft', 'expected_amount': 1}, {'element': 'id', 'element_id': 'headerRight', 'expected_amount': 1}, {'element': 'id', 'element_id': 'wrapall', 'expected_amount': 1}, {'element': 'id', 'element_id': 'sidebar', 'expected_amount': 1}, {'element': 'id', 'element_id': 'logo', 'expected_amount': 1}, {'element': 'id', 'element_id': 'sidebarContent', 'expected_amount': 1}, {'element': 'id', 'element_id': 'main', 'expected_amount': 1}]
tests = list()
for variation in variations:
for options in csv_log_single_site_init:
init_params = dict()
init_params['url'] = URL
init_params['element_id'] = variation['element_id']
init_params['csv'] = options[0]
init_params['debug'] = options[1]
init_params['single_site'] = options[2]
TESTS.append((init_params, variation['element'], variation['element_id'], URL, options[0], options[1], options[2], variation['expected_amount']))
|
#
# PySNMP MIB module ELTEX-MES-HWENVIROMENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-HWENVIROMENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:01:22 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, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion")
eltMes, = mibBuilder.importSymbols("ELTEX-MES", "eltMes")
RlEnvMonState, = mibBuilder.importSymbols("RADLAN-HWENVIROMENT", "RlEnvMonState")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Unsigned32, TimeTicks, Gauge32, MibIdentifier, ObjectIdentity, Counter32, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, Integer32, IpAddress, Bits, iso, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "TimeTicks", "Gauge32", "MibIdentifier", "ObjectIdentity", "Counter32", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "Integer32", "IpAddress", "Bits", "iso", "Counter64")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
eltMesEnv = ModuleIdentity((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11))
eltMesEnv.setRevisions(('2016-03-04 00:00', '2015-06-11 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: eltMesEnv.setRevisionsDescriptions(('Add eltEnvResetButtonMode scalar.', 'Initial revision.',))
if mibBuilder.loadTexts: eltMesEnv.setLastUpdated('201603040000Z')
if mibBuilder.loadTexts: eltMesEnv.setOrganization('Eltex Enterprise Co, Ltd.')
if mibBuilder.loadTexts: eltMesEnv.setContactInfo('www.eltex.nsk.ru')
if mibBuilder.loadTexts: eltMesEnv.setDescription("This private MIB module contains Eltex's hardware enviroment definition.")
eltEnvMonBatteryStatusTable = MibTable((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11, 1), )
if mibBuilder.loadTexts: eltEnvMonBatteryStatusTable.setStatus('current')
if mibBuilder.loadTexts: eltEnvMonBatteryStatusTable.setDescription('The table of battery status maintained by the environmental monitor card.')
eltEnvMonBatteryStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11, 1, 1), ).setIndexNames((0, "ELTEX-MES-HWENVIROMENT-MIB", "eltEnvMonBatteryStatusIndex"))
if mibBuilder.loadTexts: eltEnvMonBatteryStatusEntry.setStatus('current')
if mibBuilder.loadTexts: eltEnvMonBatteryStatusEntry.setDescription('An entry in the battery status table, representing the status of the associated battery maintained by the environmental monitor.')
eltEnvMonBatteryStatusIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11, 1, 1, 1), Integer32())
if mibBuilder.loadTexts: eltEnvMonBatteryStatusIndex.setStatus('current')
if mibBuilder.loadTexts: eltEnvMonBatteryStatusIndex.setDescription('Unique index for the battery being instrumented. This index is for SNMP purposes only, and has no intrinsic meaning.')
eltEnvMonBatteryState = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11, 1, 1, 2), RlEnvMonState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: eltEnvMonBatteryState.setStatus('current')
if mibBuilder.loadTexts: eltEnvMonBatteryState.setDescription('The mandatory state of the battery being instrumented.')
eltEnvMonBatteryStatusCharge = MibTableColumn((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(0, 100), ValueRangeConstraint(255, 255), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: eltEnvMonBatteryStatusCharge.setStatus('current')
if mibBuilder.loadTexts: eltEnvMonBatteryStatusCharge.setDescription('Remaining percentage of battery charge. Value of 255 means that this parameter is undefined due to battery not supporting this feature or because it cannot be obtained in current state.')
eltEnvResetButtonMode = MibScalar((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("enable", 0), ("disable", 1), ("reset-only", 2))).clone('enable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: eltEnvResetButtonMode.setStatus('current')
if mibBuilder.loadTexts: eltEnvResetButtonMode.setDescription('Mode of reset button: 0 - Enable, 1 - disable, 2 - reset-only mode')
mibBuilder.exportSymbols("ELTEX-MES-HWENVIROMENT-MIB", eltEnvMonBatteryStatusEntry=eltEnvMonBatteryStatusEntry, eltEnvMonBatteryStatusIndex=eltEnvMonBatteryStatusIndex, eltEnvMonBatteryStatusCharge=eltEnvMonBatteryStatusCharge, PYSNMP_MODULE_ID=eltMesEnv, eltEnvResetButtonMode=eltEnvResetButtonMode, eltMesEnv=eltMesEnv, eltEnvMonBatteryState=eltEnvMonBatteryState, eltEnvMonBatteryStatusTable=eltEnvMonBatteryStatusTable)
|
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion')
(elt_mes,) = mibBuilder.importSymbols('ELTEX-MES', 'eltMes')
(rl_env_mon_state,) = mibBuilder.importSymbols('RADLAN-HWENVIROMENT', 'RlEnvMonState')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(unsigned32, time_ticks, gauge32, mib_identifier, object_identity, counter32, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, module_identity, integer32, ip_address, bits, iso, counter64) = mibBuilder.importSymbols('SNMPv2-SMI', 'Unsigned32', 'TimeTicks', 'Gauge32', 'MibIdentifier', 'ObjectIdentity', 'Counter32', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ModuleIdentity', 'Integer32', 'IpAddress', 'Bits', 'iso', 'Counter64')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
elt_mes_env = module_identity((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11))
eltMesEnv.setRevisions(('2016-03-04 00:00', '2015-06-11 00:00'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
eltMesEnv.setRevisionsDescriptions(('Add eltEnvResetButtonMode scalar.', 'Initial revision.'))
if mibBuilder.loadTexts:
eltMesEnv.setLastUpdated('201603040000Z')
if mibBuilder.loadTexts:
eltMesEnv.setOrganization('Eltex Enterprise Co, Ltd.')
if mibBuilder.loadTexts:
eltMesEnv.setContactInfo('www.eltex.nsk.ru')
if mibBuilder.loadTexts:
eltMesEnv.setDescription("This private MIB module contains Eltex's hardware enviroment definition.")
elt_env_mon_battery_status_table = mib_table((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11, 1))
if mibBuilder.loadTexts:
eltEnvMonBatteryStatusTable.setStatus('current')
if mibBuilder.loadTexts:
eltEnvMonBatteryStatusTable.setDescription('The table of battery status maintained by the environmental monitor card.')
elt_env_mon_battery_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11, 1, 1)).setIndexNames((0, 'ELTEX-MES-HWENVIROMENT-MIB', 'eltEnvMonBatteryStatusIndex'))
if mibBuilder.loadTexts:
eltEnvMonBatteryStatusEntry.setStatus('current')
if mibBuilder.loadTexts:
eltEnvMonBatteryStatusEntry.setDescription('An entry in the battery status table, representing the status of the associated battery maintained by the environmental monitor.')
elt_env_mon_battery_status_index = mib_table_column((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11, 1, 1, 1), integer32())
if mibBuilder.loadTexts:
eltEnvMonBatteryStatusIndex.setStatus('current')
if mibBuilder.loadTexts:
eltEnvMonBatteryStatusIndex.setDescription('Unique index for the battery being instrumented. This index is for SNMP purposes only, and has no intrinsic meaning.')
elt_env_mon_battery_state = mib_table_column((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11, 1, 1, 2), rl_env_mon_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
eltEnvMonBatteryState.setStatus('current')
if mibBuilder.loadTexts:
eltEnvMonBatteryState.setDescription('The mandatory state of the battery being instrumented.')
elt_env_mon_battery_status_charge = mib_table_column((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(value_range_constraint(0, 100), value_range_constraint(255, 255)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
eltEnvMonBatteryStatusCharge.setStatus('current')
if mibBuilder.loadTexts:
eltEnvMonBatteryStatusCharge.setDescription('Remaining percentage of battery charge. Value of 255 means that this parameter is undefined due to battery not supporting this feature or because it cannot be obtained in current state.')
elt_env_reset_button_mode = mib_scalar((1, 3, 6, 1, 4, 1, 35265, 1, 23, 11, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('enable', 0), ('disable', 1), ('reset-only', 2))).clone('enable')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
eltEnvResetButtonMode.setStatus('current')
if mibBuilder.loadTexts:
eltEnvResetButtonMode.setDescription('Mode of reset button: 0 - Enable, 1 - disable, 2 - reset-only mode')
mibBuilder.exportSymbols('ELTEX-MES-HWENVIROMENT-MIB', eltEnvMonBatteryStatusEntry=eltEnvMonBatteryStatusEntry, eltEnvMonBatteryStatusIndex=eltEnvMonBatteryStatusIndex, eltEnvMonBatteryStatusCharge=eltEnvMonBatteryStatusCharge, PYSNMP_MODULE_ID=eltMesEnv, eltEnvResetButtonMode=eltEnvResetButtonMode, eltMesEnv=eltMesEnv, eltEnvMonBatteryState=eltEnvMonBatteryState, eltEnvMonBatteryStatusTable=eltEnvMonBatteryStatusTable)
|
class Solution:
def levelOrder(self, root: 'Node') -> List[List[int]]:
if root==None:
return []
list_trans=[]
queue=[root]
while queue:
child=[]
nodes=[]
for node in queue:
child.append(node.val)
if node.children:
nodes+=node.children
list_trans.append(child)
queue=nodes
return list_trans
|
class Solution:
def level_order(self, root: 'Node') -> List[List[int]]:
if root == None:
return []
list_trans = []
queue = [root]
while queue:
child = []
nodes = []
for node in queue:
child.append(node.val)
if node.children:
nodes += node.children
list_trans.append(child)
queue = nodes
return list_trans
|
MAP_SIZE = 24
TILE_SIZE = 16
ENTITY_ID = 1
ARROW_SPEED = 9999
ENTITYMAP = {}
PLAYER_ENTITIES = []
TILEMAP = {}
GAMEINFO = {} # playerid, gameinstance
# REMOVE = []
|
map_size = 24
tile_size = 16
entity_id = 1
arrow_speed = 9999
entitymap = {}
player_entities = []
tilemap = {}
gameinfo = {}
|
# coding: utf-8
"""
author: Olivier Chabrol
updated by: Louai KB
"""
class Node:
""" Node of a list """
def __init__(self, data):
"""constructor
Args:
data (float): the data of the node
"""
self.data = data
self.next = None
def __str__(self):
"""string method
Returns:
string
"""
return str(self.data)
def __repr__(self):
"""representative method
Returns:
the data of the object
"""
return self.data
class LinkedList:
""" Linked list """
def __init__(self, nodes=None):
"""constructor
Args:
nodes (list, optional): a list of data to be converted into a linked list.
Defaults to None.
"""
self.head = None
if nodes is not None and len(nodes) != 0:
node = Node(data=nodes.pop(0))
self.head = node
for elem in nodes:
node.next = Node(data=elem)
node = node.next
def is_empty(self):
"""method to check if the linked list is empty or not
Returns:
a boolean
"""
return self.head is None
def get(self, index):
"""method to get the node from the index
Args:
index (int): the index of the node
Raises:
Exception: if the node is empty
Returns:
Node
"""
if self.is_empty():
raise Exception('empty node')
self.recursion(index, self.head)
def recursion(self, index, node):
"""recursive method to get the node from the index
Args:
index (int): the index of the node
node (Node): the head node
Returns:
the searched Node
"""
if node is None:
return node
elif index == 0:
return node
return self.recursion(index - 1, node.next)
def add_after(self, data, new_node):
"""a method to insert a node after a given node
Args:
data (float): data of the node which we will insert the new node after it
new_node (Node): new node to be inserted
Raises:
Exception: list is empty
Exception: Node with data not found
"""
if not self.head:
raise Exception("List is empty")
for node in self:
if node.data == data:
new_node.next = node.next
node.next = new_node
return
raise Exception("Node with data '{}' not found".format(data))
def add_before(self, data, new_node):
"""a method to insert a node before a given node
Args:
data (float): data of the node which we will insert the new node before it
new_node (Node): the new node to be inserted
Raises:
Exception: list is empty
Exception: Node with data not found
Returns:
Node
"""
if not self.head:
raise Exception("List is empty")
if self.head.data == data:
return self.add_first(new_node)
prev_node = self.head
for node in self:
if node.data == data:
prev_node.next = new_node
new_node.next = node
return
prev_node = node
raise Exception("Node with data '{}' not found".format(data))
def remove_node(self, data):
"""Method that allows to delete all node(s) where value == data.
Args:
data (float): data of the nodes
Raises:
Exception: list is empty
Exception: Node with data not found
"""
if not self.head:
raise Exception("List is empty")
if self.head.data == data:
self.head = self.head.next
return
previous_node = self.head
for node in self:
if node.data == data:
previous_node.next = node.next
return
previous_node = node
raise Exception("Node with data '{}' not found".format(data))
def add_first(self, node_to_add):
"""Method that inserts a node at the first element of the list.
Args:
node_to_add (Node)
"""
node_to_add.next = self.head
self.head = node_to_add
def add_last(self, node_to_add):
"""Method that inserts a node at the last element of the list.
Args:
node_to_add (Node)
"""
if self.head is None:
self.head = node_to_add
return
node = self.head
# while node.next is not None:*
while node.next is not None:
node = node.next
node.next = node_to_add
def __repr__(self):
"""representative method
Returns:
the data of the object
"""
node = self.head
nodes = []
while node is not None:
nodes.append(node.data)
node = node.next
#return "a"
return "{}".format(nodes)
def __iter__(self):
"""Iteration method
"""
node = self.head
while node is not None:
yield node
node = node.next
|
"""
author: Olivier Chabrol
updated by: Louai KB
"""
class Node:
""" Node of a list """
def __init__(self, data):
"""constructor
Args:
data (float): the data of the node
"""
self.data = data
self.next = None
def __str__(self):
"""string method
Returns:
string
"""
return str(self.data)
def __repr__(self):
"""representative method
Returns:
the data of the object
"""
return self.data
class Linkedlist:
""" Linked list """
def __init__(self, nodes=None):
"""constructor
Args:
nodes (list, optional): a list of data to be converted into a linked list.
Defaults to None.
"""
self.head = None
if nodes is not None and len(nodes) != 0:
node = node(data=nodes.pop(0))
self.head = node
for elem in nodes:
node.next = node(data=elem)
node = node.next
def is_empty(self):
"""method to check if the linked list is empty or not
Returns:
a boolean
"""
return self.head is None
def get(self, index):
"""method to get the node from the index
Args:
index (int): the index of the node
Raises:
Exception: if the node is empty
Returns:
Node
"""
if self.is_empty():
raise exception('empty node')
self.recursion(index, self.head)
def recursion(self, index, node):
"""recursive method to get the node from the index
Args:
index (int): the index of the node
node (Node): the head node
Returns:
the searched Node
"""
if node is None:
return node
elif index == 0:
return node
return self.recursion(index - 1, node.next)
def add_after(self, data, new_node):
"""a method to insert a node after a given node
Args:
data (float): data of the node which we will insert the new node after it
new_node (Node): new node to be inserted
Raises:
Exception: list is empty
Exception: Node with data not found
"""
if not self.head:
raise exception('List is empty')
for node in self:
if node.data == data:
new_node.next = node.next
node.next = new_node
return
raise exception("Node with data '{}' not found".format(data))
def add_before(self, data, new_node):
"""a method to insert a node before a given node
Args:
data (float): data of the node which we will insert the new node before it
new_node (Node): the new node to be inserted
Raises:
Exception: list is empty
Exception: Node with data not found
Returns:
Node
"""
if not self.head:
raise exception('List is empty')
if self.head.data == data:
return self.add_first(new_node)
prev_node = self.head
for node in self:
if node.data == data:
prev_node.next = new_node
new_node.next = node
return
prev_node = node
raise exception("Node with data '{}' not found".format(data))
def remove_node(self, data):
"""Method that allows to delete all node(s) where value == data.
Args:
data (float): data of the nodes
Raises:
Exception: list is empty
Exception: Node with data not found
"""
if not self.head:
raise exception('List is empty')
if self.head.data == data:
self.head = self.head.next
return
previous_node = self.head
for node in self:
if node.data == data:
previous_node.next = node.next
return
previous_node = node
raise exception("Node with data '{}' not found".format(data))
def add_first(self, node_to_add):
"""Method that inserts a node at the first element of the list.
Args:
node_to_add (Node)
"""
node_to_add.next = self.head
self.head = node_to_add
def add_last(self, node_to_add):
"""Method that inserts a node at the last element of the list.
Args:
node_to_add (Node)
"""
if self.head is None:
self.head = node_to_add
return
node = self.head
while node.next is not None:
node = node.next
node.next = node_to_add
def __repr__(self):
"""representative method
Returns:
the data of the object
"""
node = self.head
nodes = []
while node is not None:
nodes.append(node.data)
node = node.next
return '{}'.format(nodes)
def __iter__(self):
"""Iteration method
"""
node = self.head
while node is not None:
yield node
node = node.next
|
obstacleSet = set([(10, 2, 4, 5), (3, 4), (4, 4), (5, 4)])
print((2, 4) in obstacleSet)
print(obstacleSet)
print(set([(1, 2), (3, 4)]))
|
obstacle_set = set([(10, 2, 4, 5), (3, 4), (4, 4), (5, 4)])
print((2, 4) in obstacleSet)
print(obstacleSet)
print(set([(1, 2), (3, 4)]))
|
def quickSort(array, head, tail):
# an implementation of quicksort algorithm
if head >= tail:
return
else:
pivot = partition(array, head, tail)
quickSort(array, head, pivot)
quickSort(array, pivot+1, tail)
def partition(array, head, tail):
pivot = array[head]
i = head + 1
for j in range(head+1, tail):
if array[j] < pivot:
swap(array, i, j)
i += 1
swap(array, i-1, head)
return i-1
def swap(A, x, y ):
A[x],A[y]=A[y],A[x]
|
def quick_sort(array, head, tail):
if head >= tail:
return
else:
pivot = partition(array, head, tail)
quick_sort(array, head, pivot)
quick_sort(array, pivot + 1, tail)
def partition(array, head, tail):
pivot = array[head]
i = head + 1
for j in range(head + 1, tail):
if array[j] < pivot:
swap(array, i, j)
i += 1
swap(array, i - 1, head)
return i - 1
def swap(A, x, y):
(A[x], A[y]) = (A[y], A[x])
|
passports = []
x=0
vCount=0
keys = {"byr",
"iyr",
"eyr",
"hgt",
"hcl",
"ecl",
"pid"}
with open("Day4\\test2.txt", "r") as data:
passports = [i.replace('\n', ' ').split()
for i in data.read().split('\n\n')]
for i in passports:
print(i)
print(i[0:1])
print(keys)
# for i in passports:
# #print(passports[x])
# x+=1
# print(vCount)
|
passports = []
x = 0
v_count = 0
keys = {'byr', 'iyr', 'eyr', 'hgt', 'hcl', 'ecl', 'pid'}
with open('Day4\\test2.txt', 'r') as data:
passports = [i.replace('\n', ' ').split() for i in data.read().split('\n\n')]
for i in passports:
print(i)
print(i[0:1])
print(keys)
|
'''
Vanir OS exception hierarchy
'''
class VanirException(Exception):
'''Exception that can be shown to the user'''
class VanirVMNotFoundError(VanirException, KeyError):
'''Domain cannot be found in the system'''
def __init__(self, vmname):
super(VanirVMNotFoundError, self).__init__(
'No such domain: {!r}'.format(vmname))
self.vmname = vmname
class VanirVMError(VanirException):
'''Some problem with domain state.'''
def __init__(self, vm, msg):
super(VanirVMError, self).__init__(msg)
self.vm = vm
class VanirVMInUseError(VanirVMError):
'''VM is in use, cannot remove.'''
def __init__(self, vm, msg=None):
super(VanirVMInUseError, self).__init__(vm,
msg or 'Domain is in use: {!r}'.format(vm.name))
class VanirVMNotStartedError(VanirVMError):
'''Domain is not started.
This exception is thrown when machine is halted, but should be started
(that is, either running or paused).
'''
def __init__(self, vm, msg=None):
super(VanirVMNotStartedError, self).__init__(vm,
msg or 'Domain is powered off: {!r}'.format(vm.name))
class VanirVMNotRunningError(VanirVMNotStartedError):
'''Domain is not running.
This exception is thrown when machine should be running but is either
halted or paused.
'''
def __init__(self, vm, msg=None):
super(VanirVMNotRunningError, self).__init__(vm,
msg or 'Domain not running (either powered off or paused): {!r}' \
.format(vm.name))
class VanirVMNotPausedError(VanirVMNotStartedError):
'''Domain is not paused.
This exception is thrown when machine should be paused, but is not.
'''
def __init__(self, vm, msg=None):
super(VanirVMNotPausedError, self).__init__(vm,
msg or 'Domain is not paused: {!r}'.format(vm.name))
class VanirVMNotSuspendedError(VanirVMError):
'''Domain is not suspended.
This exception is thrown when machine should be suspended but is either
halted or running.
'''
def __init__(self, vm, msg=None):
super(VanirVMNotSuspendedError, self).__init__(vm,
msg or 'Domain is not suspended: {!r}'.format(vm.name))
class VanirVMNotHaltedError(VanirVMError):
'''Domain is not halted.
This exception is thrown when machine should be halted, but is not (either
running or paused).
'''
def __init__(self, vm, msg=None):
super(VanirVMNotHaltedError, self).__init__(vm,
msg or 'Domain is not powered off: {!r}'.format(vm.name))
class VanirVMShutdownTimeoutError(VanirVMError):
'''Domain shutdown timed out.
'''
def __init__(self, vm, msg=None):
super(VanirVMShutdownTimeoutError, self).__init__(vm,
msg or 'Domain shutdown timed out: {!r}'.format(vm.name))
class VanirNoTemplateError(VanirVMError):
'''Cannot start domain, because there is no template'''
def __init__(self, vm, msg=None):
super(VanirNoTemplateError, self).__init__(vm,
msg or 'Template for the domain {!r} not found'.format(vm.name))
class VanirPoolInUseError(VanirException):
'''VM is in use, cannot remove.'''
def __init__(self, pool, msg=None):
super(VanirPoolInUseError, self).__init__(
msg or 'Storage pool is in use: {!r}'.format(pool.name))
class VanirValueError(VanirException, ValueError):
'''Cannot set some value, because it is invalid, out of bounds, etc.'''
class VanirPropertyValueError(VanirValueError):
'''Cannot set value of vanir.property, because user-supplied value is wrong.
'''
def __init__(self, holder, prop, value, msg=None):
super(VanirPropertyValueError, self).__init__(
msg or 'Invalid value {!r} for property {!r} of {!r}'.format(
value, prop.__name__, holder))
self.holder = holder
self.prop = prop
self.value = value
class VanirNoSuchPropertyError(VanirException, AttributeError):
'''Requested property does not exist
'''
def __init__(self, holder, prop_name, msg=None):
super(VanirNoSuchPropertyError, self).__init__(
msg or 'Invalid property {!r} of {!s}'.format(
prop_name, holder))
self.holder = holder
self.prop = prop_name
class VanirNotImplementedError(VanirException, NotImplementedError):
'''Thrown at user when some feature is not implemented'''
def __init__(self, msg=None):
super(VanirNotImplementedError, self).__init__(
msg or 'This feature is not available')
class BackupCancelledError(VanirException):
'''Thrown at user when backup was manually cancelled'''
def __init__(self, msg=None):
super(BackupCancelledError, self).__init__(
msg or 'Backup cancelled')
class VanirMemoryError(VanirVMError, MemoryError):
'''Cannot start domain, because not enough memory is available'''
def __init__(self, vm, msg=None):
super(VanirMemoryError, self).__init__(vm,
msg or 'Not enough memory to start domain {!r}'.format(vm.name))
class VanirFeatureNotFoundError(VanirException, KeyError):
'''Feature not set for a given domain'''
def __init__(self, domain, feature):
super(VanirFeatureNotFoundError, self).__init__(
'Feature not set for domain {}: {}'.format(domain, feature))
self.feature = feature
self.vm = domain
class VanirTagNotFoundError(VanirException, KeyError):
'''Tag not set for a given domain'''
def __init__(self, domain, tag):
super().__init__('Tag not set for domain {}: {}'.format(
domain, tag))
self.vm = domain
self.tag = tag
|
"""
Vanir OS exception hierarchy
"""
class Vanirexception(Exception):
"""Exception that can be shown to the user"""
class Vanirvmnotfounderror(VanirException, KeyError):
"""Domain cannot be found in the system"""
def __init__(self, vmname):
super(VanirVMNotFoundError, self).__init__('No such domain: {!r}'.format(vmname))
self.vmname = vmname
class Vanirvmerror(VanirException):
"""Some problem with domain state."""
def __init__(self, vm, msg):
super(VanirVMError, self).__init__(msg)
self.vm = vm
class Vanirvminuseerror(VanirVMError):
"""VM is in use, cannot remove."""
def __init__(self, vm, msg=None):
super(VanirVMInUseError, self).__init__(vm, msg or 'Domain is in use: {!r}'.format(vm.name))
class Vanirvmnotstartederror(VanirVMError):
"""Domain is not started.
This exception is thrown when machine is halted, but should be started
(that is, either running or paused).
"""
def __init__(self, vm, msg=None):
super(VanirVMNotStartedError, self).__init__(vm, msg or 'Domain is powered off: {!r}'.format(vm.name))
class Vanirvmnotrunningerror(VanirVMNotStartedError):
"""Domain is not running.
This exception is thrown when machine should be running but is either
halted or paused.
"""
def __init__(self, vm, msg=None):
super(VanirVMNotRunningError, self).__init__(vm, msg or 'Domain not running (either powered off or paused): {!r}'.format(vm.name))
class Vanirvmnotpausederror(VanirVMNotStartedError):
"""Domain is not paused.
This exception is thrown when machine should be paused, but is not.
"""
def __init__(self, vm, msg=None):
super(VanirVMNotPausedError, self).__init__(vm, msg or 'Domain is not paused: {!r}'.format(vm.name))
class Vanirvmnotsuspendederror(VanirVMError):
"""Domain is not suspended.
This exception is thrown when machine should be suspended but is either
halted or running.
"""
def __init__(self, vm, msg=None):
super(VanirVMNotSuspendedError, self).__init__(vm, msg or 'Domain is not suspended: {!r}'.format(vm.name))
class Vanirvmnothaltederror(VanirVMError):
"""Domain is not halted.
This exception is thrown when machine should be halted, but is not (either
running or paused).
"""
def __init__(self, vm, msg=None):
super(VanirVMNotHaltedError, self).__init__(vm, msg or 'Domain is not powered off: {!r}'.format(vm.name))
class Vanirvmshutdowntimeouterror(VanirVMError):
"""Domain shutdown timed out.
"""
def __init__(self, vm, msg=None):
super(VanirVMShutdownTimeoutError, self).__init__(vm, msg or 'Domain shutdown timed out: {!r}'.format(vm.name))
class Vanirnotemplateerror(VanirVMError):
"""Cannot start domain, because there is no template"""
def __init__(self, vm, msg=None):
super(VanirNoTemplateError, self).__init__(vm, msg or 'Template for the domain {!r} not found'.format(vm.name))
class Vanirpoolinuseerror(VanirException):
"""VM is in use, cannot remove."""
def __init__(self, pool, msg=None):
super(VanirPoolInUseError, self).__init__(msg or 'Storage pool is in use: {!r}'.format(pool.name))
class Vanirvalueerror(VanirException, ValueError):
"""Cannot set some value, because it is invalid, out of bounds, etc."""
class Vanirpropertyvalueerror(VanirValueError):
"""Cannot set value of vanir.property, because user-supplied value is wrong.
"""
def __init__(self, holder, prop, value, msg=None):
super(VanirPropertyValueError, self).__init__(msg or 'Invalid value {!r} for property {!r} of {!r}'.format(value, prop.__name__, holder))
self.holder = holder
self.prop = prop
self.value = value
class Vanirnosuchpropertyerror(VanirException, AttributeError):
"""Requested property does not exist
"""
def __init__(self, holder, prop_name, msg=None):
super(VanirNoSuchPropertyError, self).__init__(msg or 'Invalid property {!r} of {!s}'.format(prop_name, holder))
self.holder = holder
self.prop = prop_name
class Vanirnotimplementederror(VanirException, NotImplementedError):
"""Thrown at user when some feature is not implemented"""
def __init__(self, msg=None):
super(VanirNotImplementedError, self).__init__(msg or 'This feature is not available')
class Backupcancellederror(VanirException):
"""Thrown at user when backup was manually cancelled"""
def __init__(self, msg=None):
super(BackupCancelledError, self).__init__(msg or 'Backup cancelled')
class Vanirmemoryerror(VanirVMError, MemoryError):
"""Cannot start domain, because not enough memory is available"""
def __init__(self, vm, msg=None):
super(VanirMemoryError, self).__init__(vm, msg or 'Not enough memory to start domain {!r}'.format(vm.name))
class Vanirfeaturenotfounderror(VanirException, KeyError):
"""Feature not set for a given domain"""
def __init__(self, domain, feature):
super(VanirFeatureNotFoundError, self).__init__('Feature not set for domain {}: {}'.format(domain, feature))
self.feature = feature
self.vm = domain
class Vanirtagnotfounderror(VanirException, KeyError):
"""Tag not set for a given domain"""
def __init__(self, domain, tag):
super().__init__('Tag not set for domain {}: {}'.format(domain, tag))
self.vm = domain
self.tag = tag
|
def entrada():
n,l = map(int,input().split())
return n,l
def perimetro(n,lado):
return n*lado
def main():
n,l=entrada()
print(perimetro(n,l))
main()
|
def entrada():
(n, l) = map(int, input().split())
return (n, l)
def perimetro(n, lado):
return n * lado
def main():
(n, l) = entrada()
print(perimetro(n, l))
main()
|
#
# PySNMP MIB module DES-1228p-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DES-1228P-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:23:55 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, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ValueSizeConstraint")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
ModuleIdentity, enterprises, ObjectIdentity, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, MibIdentifier, NotificationType, Unsigned32, TimeTicks, Bits, mib_2, IpAddress, iso, Counter64, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "ModuleIdentity", "enterprises", "ObjectIdentity", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "MibIdentifier", "NotificationType", "Unsigned32", "TimeTicks", "Bits", "mib-2", "IpAddress", "iso", "Counter64", "Gauge32")
TextualConvention, DisplayString, PhysAddress = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString", "PhysAddress")
d_link = MibIdentifier((1, 3, 6, 1, 4, 1, 171)).setLabel("d-link")
dlink_products = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10)).setLabel("dlink-products")
dlink_DES12XXSeriesProd = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75)).setLabel("dlink-DES12XXSeriesProd")
des_1228pa1 = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3)).setLabel("des-1228pa1")
class OwnerString(DisplayString):
pass
class MacAddress(OctetString):
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(6, 6)
fixedLength = 6
class PortList(TextualConvention, OctetString):
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(6, 6)
fixedLength = 6
class RowStatus(TextualConvention, Integer32):
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))
namedValues = NamedValues(("active", 1), ("notInService", 2), ("notReady", 3), ("createAndGo", 4), ("createAndWait", 5), ("destroy", 6))
companyCommGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1))
companyMiscGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 3))
companySpanGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 4))
companyConfigGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11))
companyTVlanGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13))
companyPortTrunkGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 14))
companyPoEGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 15))
companyStaticGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21))
companyIgsGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22))
companyDot1xGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23))
companyLLDPExtnGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24))
commSetTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 1), )
if mibBuilder.loadTexts: commSetTable.setStatus('mandatory')
commSetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 1, 1), ).setIndexNames((0, "DES-1228p-MIB", "commSetIndex"))
if mibBuilder.loadTexts: commSetEntry.setStatus('mandatory')
commSetIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2))).setMaxAccess("readonly")
if mibBuilder.loadTexts: commSetIndex.setStatus('mandatory')
commSetName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commSetName.setStatus('mandatory')
commSetStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 1, 1, 3), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commSetStatus.setStatus('mandatory')
commGetTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 2), )
if mibBuilder.loadTexts: commGetTable.setStatus('mandatory')
commGetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 2, 1), ).setIndexNames((0, "DES-1228p-MIB", "commGetIndex"))
if mibBuilder.loadTexts: commGetEntry.setStatus('mandatory')
commGetIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2))).setMaxAccess("readonly")
if mibBuilder.loadTexts: commGetIndex.setStatus('mandatory')
commGetName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commGetName.setStatus('mandatory')
commGetStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 2, 1, 3), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commGetStatus.setStatus('mandatory')
commTrapTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3), )
if mibBuilder.loadTexts: commTrapTable.setStatus('mandatory')
commTrapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1), ).setIndexNames((0, "DES-1228p-MIB", "commTrapIndex"))
if mibBuilder.loadTexts: commTrapEntry.setStatus('mandatory')
commTrapIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2))).setMaxAccess("readonly")
if mibBuilder.loadTexts: commTrapIndex.setStatus('mandatory')
commTrapName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapName.setStatus('mandatory')
commTrapIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 3), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapIpAddress.setStatus('mandatory')
commTrapSNMPBootup = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapSNMPBootup.setStatus('mandatory')
commTrapSNMPTPLinkUpDown = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapSNMPTPLinkUpDown.setStatus('mandatory')
commTrapSNMPFiberLinkUpDown = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapSNMPFiberLinkUpDown.setStatus('mandatory')
commTrapTrapAbnormalTPRXError = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapTrapAbnormalTPRXError.setStatus('mandatory')
commTrapTrapAbnormalTPTXError = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapTrapAbnormalTPTXError.setStatus('mandatory')
commTrapTrapAbnormalFiberRXError = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapTrapAbnormalFiberRXError.setStatus('mandatory')
commTrapTrapAbnormalFiberTXError = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapTrapAbnormalFiberTXError.setStatus('mandatory')
commTrapTrapPOEPowerFail = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapTrapPOEPowerFail.setStatus('mandatory')
commTrapTrapPOEPortOvercurrent = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapTrapPOEPortOvercurrent.setStatus('mandatory')
commTrapTrapPOEPortShort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapTrapPOEPortShort.setStatus('mandatory')
commTrapStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 16), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: commTrapStatus.setStatus('mandatory')
miscReset = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 3, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("reset", 1), ("noop", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: miscReset.setStatus('mandatory')
miscStatisticsReset = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 3, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("reset", 1), ("noop", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: miscStatisticsReset.setStatus('mandatory')
spanOnOff = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 4, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: spanOnOff.setStatus('mandatory')
configVerSwPrimary = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readonly")
if mibBuilder.loadTexts: configVerSwPrimary.setStatus('mandatory')
configVerHwChipSet = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 31))).setMaxAccess("readonly")
if mibBuilder.loadTexts: configVerHwChipSet.setStatus('mandatory')
configBootTftpOperation = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("download", 1), ("upload", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configBootTftpOperation.setStatus('mandatory')
configBootTftpServerIp = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 4), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configBootTftpServerIp.setStatus('mandatory')
configBootImageFileName = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 5), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 63))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configBootImageFileName.setStatus('mandatory')
configPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 6), )
if mibBuilder.loadTexts: configPortTable.setStatus('mandatory')
configPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 6, 1), ).setIndexNames((0, "DES-1228p-MIB", "configPort"))
if mibBuilder.loadTexts: configPortEntry.setStatus('mandatory')
configPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 6, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: configPort.setStatus('mandatory')
configPortSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 6, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("disable", 1), ("auto", 2), ("rate10M-Half", 3), ("rate10M-Full", 4), ("rate100M-Half", 5), ("rate100M-Full", 6), ("rate1000M-Full", 7)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configPortSpeed.setStatus('mandatory')
configPortOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 6, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("down", 1), ("rate10M-Half", 2), ("rate10M-Full", 3), ("rate100M-Half", 4), ("rate100M-Full", 5), ("rate1000M-Full", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: configPortOperStatus.setStatus('mandatory')
configPortPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 6, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("low", 1), ("middle", 2), ("high", 3), ("highest", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configPortPriority.setStatus('mandatory')
configVLANMode = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("modeTagBased", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configVLANMode.setStatus('mandatory')
configMirrorTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8), )
if mibBuilder.loadTexts: configMirrorTable.setStatus('mandatory')
configMirrorEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8, 1), ).setIndexNames((0, "DES-1228p-MIB", "configMirrorId"))
if mibBuilder.loadTexts: configMirrorEntry.setStatus('mandatory')
configMirrorId = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 1))).setMaxAccess("readonly")
if mibBuilder.loadTexts: configMirrorId.setStatus('mandatory')
configMirrorMon = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8, 1, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configMirrorMon.setStatus('mandatory')
configMirrorTXSrc = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8, 1, 3), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configMirrorTXSrc.setStatus('mandatory')
configMirrorRXSrc = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8, 1, 4), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configMirrorRXSrc.setStatus('mandatory')
configMirrorStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8, 1, 5), RowStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configMirrorStatus.setStatus('mandatory')
configSNMPEnable = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configSNMPEnable.setStatus('mandatory')
configIpAssignmentMode = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("manual", 1), ("dhcp", 2), ("other", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configIpAssignmentMode.setStatus('mandatory')
configPhysAddress = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 13), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: configPhysAddress.setStatus('mandatory')
configPasswordAdmin = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 15), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 20))).setMaxAccess("writeonly")
if mibBuilder.loadTexts: configPasswordAdmin.setStatus('mandatory')
configIpAddress = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 16), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configIpAddress.setStatus('mandatory')
configNetMask = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 17), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configNetMask.setStatus('mandatory')
configGateway = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 18), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configGateway.setStatus('mandatory')
configSave = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 19), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("save", 1), ("noop", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configSave.setStatus('mandatory')
configRestoreDefaults = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("restore", 1), ("noop", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configRestoreDefaults.setStatus('mandatory')
configTftpServerIpAddress = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 32), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configTftpServerIpAddress.setStatus('mandatory')
configTftpServerFileName = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 33), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configTftpServerFileName.setStatus('mandatory')
configTftpOperation = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 34), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("download", 1), ("upload", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: configTftpOperation.setStatus('mandatory')
tvlanTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1), )
if mibBuilder.loadTexts: tvlanTable.setStatus('mandatory')
tvlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1, 1), ).setIndexNames((0, "DES-1228p-MIB", "tvlanId"))
if mibBuilder.loadTexts: tvlanEntry.setStatus('mandatory')
tvlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tvlanId.setStatus('mandatory')
tvlanName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1, 1, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tvlanName.setStatus('mandatory')
tvlanMember = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1, 1, 3), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tvlanMember.setStatus('mandatory')
tvlanUntaggedPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1, 1, 4), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tvlanUntaggedPorts.setStatus('mandatory')
tvlanStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 3, 5, 6))).clone(namedValues=NamedValues(("active", 1), ("notready", 3), ("createAndwait", 5), ("destroy", 6)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tvlanStatus.setStatus('mandatory')
tvlanManagementOnOff = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tvlanManagementOnOff.setStatus('mandatory')
tvlanManagementid = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tvlanManagementid.setStatus('mandatory')
tvlanPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 4), )
if mibBuilder.loadTexts: tvlanPortTable.setStatus('mandatory')
tvlanPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 4, 1), ).setIndexNames((0, "DES-1228p-MIB", "tvlanPortPortId"))
if mibBuilder.loadTexts: tvlanPortEntry.setStatus('mandatory')
tvlanPortPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 4, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tvlanPortPortId.setStatus('mandatory')
tvlanPortVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 4, 1, 2), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tvlanPortVlanId.setStatus('mandatory')
tvlanAsyOnOff = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tvlanAsyOnOff.setStatus('mandatory')
portTrunkTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 14, 1), )
if mibBuilder.loadTexts: portTrunkTable.setStatus('mandatory')
portTrunkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 14, 1, 1), ).setIndexNames((0, "DES-1228p-MIB", "portTrunkId"), (0, "DES-1228p-MIB", "portTrunkMember"))
if mibBuilder.loadTexts: portTrunkEntry.setStatus('mandatory')
portTrunkId = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 14, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: portTrunkId.setStatus('mandatory')
portTrunkName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 14, 1, 1, 2), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: portTrunkName.setStatus('mandatory')
portTrunkMember = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 14, 1, 1, 3), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: portTrunkMember.setStatus('mandatory')
poePortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 15, 1), )
if mibBuilder.loadTexts: poePortTable.setStatus('mandatory')
poePortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 15, 1, 1), ).setIndexNames((0, "DES-1228p-MIB", "poeportgroup"), (0, "DES-1228p-MIB", "poeportid"))
if mibBuilder.loadTexts: poePortEntry.setStatus('mandatory')
poeportgroup = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 15, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: poeportgroup.setStatus('mandatory')
poeportid = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 15, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: poeportid.setStatus('mandatory')
poeportpowerlimit = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 15, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("auto", 0), ("class1", 1), ("class2", 2), ("class3", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: poeportpowerlimit.setStatus('mandatory')
staticOnOff = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: staticOnOff.setStatus('mandatory')
staticAutoLearning = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 2), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: staticAutoLearning.setStatus('mandatory')
staticTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3), )
if mibBuilder.loadTexts: staticTable.setStatus('mandatory')
staticEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3, 1), ).setIndexNames((0, "DES-1228p-MIB", "staticId"))
if mibBuilder.loadTexts: staticEntry.setStatus('mandatory')
staticId = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: staticId.setStatus('mandatory')
staticMac = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3, 1, 2), MacAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: staticMac.setStatus('mandatory')
staticPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3, 1, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: staticPort.setStatus('mandatory')
staticVlanID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3, 1, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: staticVlanID.setStatus('mandatory')
staticStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 3, 5, 6))).clone(namedValues=NamedValues(("active", 1), ("notready", 3), ("createAndwait", 5), ("destroy", 6)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: staticStatus.setStatus('mandatory')
igsSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1))
igsVlan = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3))
igsStatus = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone(2)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: igsStatus.setStatus('mandatory')
igsv3Processing = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone(1)).setMaxAccess("readonly")
if mibBuilder.loadTexts: igsv3Processing.setStatus('mandatory')
igsRouterPortPurgeInterval = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(60, 600)).clone(260)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: igsRouterPortPurgeInterval.setStatus('mandatory')
igsHostPortPurgeInterval = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(130, 153025)).clone(260)).setMaxAccess("readonly")
if mibBuilder.loadTexts: igsHostPortPurgeInterval.setStatus('mandatory')
igsReportForwardInterval = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 25)).clone(5)).setMaxAccess("readonly")
if mibBuilder.loadTexts: igsReportForwardInterval.setStatus('mandatory')
igsLeaveProcessInterval = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 25)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: igsLeaveProcessInterval.setStatus('mandatory')
igsMcastEntryAgeingInterval = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(60, 600)).clone(600)).setMaxAccess("readonly")
if mibBuilder.loadTexts: igsMcastEntryAgeingInterval.setStatus('mandatory')
igsSharedSegmentAggregationInterval = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 60)).clone(30)).setMaxAccess("readonly")
if mibBuilder.loadTexts: igsSharedSegmentAggregationInterval.setStatus('mandatory')
igsGblReportFwdOnAllPorts = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("allports", 1), ("rtrports", 2))).clone(2)).setMaxAccess("readonly")
if mibBuilder.loadTexts: igsGblReportFwdOnAllPorts.setStatus('mandatory')
igsNextMcastFwdMode = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ipbased", 1), ("macbased", 2))).clone(1)).setMaxAccess("readonly")
if mibBuilder.loadTexts: igsNextMcastFwdMode.setStatus('mandatory')
igsQueryInterval = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(60, 600)).clone(125)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: igsQueryInterval.setStatus('mandatory')
igsQueryMaxResponseTime = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 25)).clone(10)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: igsQueryMaxResponseTime.setStatus('mandatory')
igsRobustnessValue = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(2, 255)).clone(2)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: igsRobustnessValue.setStatus('mandatory')
igsLastMembQueryInterval = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 25)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: igsLastMembQueryInterval.setStatus('mandatory')
igsVlanMcastFwdTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 1), )
if mibBuilder.loadTexts: igsVlanMcastFwdTable.setStatus('mandatory')
igsVlanMcastFwdEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 1, 1), ).setIndexNames((0, "DES-1228p-MIB", "igsVlanMcastFwdVlanIdMac"), (0, "DES-1228p-MIB", "igsVlanMcastFwdGroupAddress"))
if mibBuilder.loadTexts: igsVlanMcastFwdEntry.setStatus('mandatory')
igsVlanMcastFwdVlanIdMac = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4094)))
if mibBuilder.loadTexts: igsVlanMcastFwdVlanIdMac.setStatus('mandatory')
igsVlanMcastFwdGroupAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 1, 1, 2), MacAddress())
if mibBuilder.loadTexts: igsVlanMcastFwdGroupAddress.setStatus('mandatory')
igsVlanMcastFwdPortListMac = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 1, 1, 3), PortList()).setMaxAccess("readonly")
if mibBuilder.loadTexts: igsVlanMcastFwdPortListMac.setStatus('mandatory')
igsVlanRouterPortListTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 3), )
if mibBuilder.loadTexts: igsVlanRouterPortListTable.setStatus('mandatory')
igsVlanRouterPortListEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 3, 1), ).setIndexNames((0, "DES-1228p-MIB", "igsVlanRouterPortListVlanId"))
if mibBuilder.loadTexts: igsVlanRouterPortListEntry.setStatus('mandatory')
igsVlanRouterPortListVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4094)))
if mibBuilder.loadTexts: igsVlanRouterPortListVlanId.setStatus('mandatory')
igsVlanRouterPortList = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 3, 1, 2), PortList()).setMaxAccess("readonly")
if mibBuilder.loadTexts: igsVlanRouterPortList.setStatus('mandatory')
igsVlanFilterTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 4), )
if mibBuilder.loadTexts: igsVlanFilterTable.setStatus('mandatory')
igsVlanFilterEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 4, 1), ).setIndexNames((0, "DES-1228p-MIB", "igsVlanId"))
if mibBuilder.loadTexts: igsVlanFilterEntry.setStatus('mandatory')
igsVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4094)))
if mibBuilder.loadTexts: igsVlanId.setStatus('mandatory')
igsVlanFilterStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 4, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: igsVlanFilterStatus.setStatus('mandatory')
radius = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 1))
dot1xAuth = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2))
radiusServerAddress = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 1, 1), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: radiusServerAddress.setStatus('mandatory')
radiusServerPort = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: radiusServerPort.setStatus('mandatory')
radiusServerSharedSecret = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 1, 3), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: radiusServerSharedSecret.setStatus('mandatory')
dot1xAuthSystemControl = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1xAuthSystemControl.setStatus('mandatory')
dot1xAuthQuietPeriod = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535)).clone(60)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1xAuthQuietPeriod.setStatus('mandatory')
dot1xAuthTxPeriod = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)).clone(30)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1xAuthTxPeriod.setStatus('mandatory')
dot1xAuthSuppTimeout = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)).clone(30)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1xAuthSuppTimeout.setStatus('mandatory')
dot1xAuthServerTimeout = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)).clone(30)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1xAuthServerTimeout.setStatus('mandatory')
dot1xAuthMaxReq = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 10)).clone(2)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1xAuthMaxReq.setStatus('mandatory')
dot1xAuthReAuthPeriod = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 7), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295)).clone(3600)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1xAuthReAuthPeriod.setStatus('mandatory')
dot1xAuthReAuthEnabled = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1xAuthReAuthEnabled.setStatus('mandatory')
dot1xAuthConfigPortTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9), )
if mibBuilder.loadTexts: dot1xAuthConfigPortTable.setStatus('mandatory')
dot1xAuthConfigPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9, 1), ).setIndexNames((0, "DES-1228p-MIB", "dot1xAuthConfigPortNumber"))
if mibBuilder.loadTexts: dot1xAuthConfigPortEntry.setStatus('mandatory')
dot1xAuthConfigPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dot1xAuthConfigPortNumber.setStatus('mandatory')
dot1xAuthConfigPortControl = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: dot1xAuthConfigPortControl.setStatus('mandatory')
dot1xAuthConfigPortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("authnull", 0), ("authorized", 1), ("unauthorized", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: dot1xAuthConfigPortStatus.setStatus('mandatory')
dot1xAuthConfigPortSessionTime = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9, 1, 4), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dot1xAuthConfigPortSessionTime.setStatus('mandatory')
dot1xAuthConfigPortSessionUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9, 1, 5), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: dot1xAuthConfigPortSessionUserName.setStatus('mandatory')
lldpSysMACDigest = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).setFixedLength(32)).setMaxAccess("readonly")
if mibBuilder.loadTexts: lldpSysMACDigest.setStatus('mandatory')
lldpAntiRoguePortControl = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 2), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: lldpAntiRoguePortControl.setStatus('mandatory')
lldpRemOrgDefInfoTable = MibTable((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 3), )
if mibBuilder.loadTexts: lldpRemOrgDefInfoTable.setStatus('mandatory')
lldpAntiRogueKey = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(20, 20)).setFixedLength(20)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: lldpAntiRogueKey.setStatus('mandatory')
lldpSysConfigChecksum = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: lldpSysConfigChecksum.setStatus('mandatory')
lldpGalobalEnable = MibScalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: lldpGalobalEnable.setStatus('mandatory')
lldpRemOrgDefInfoEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 3, 1), ).setIndexNames((0, "DES-1228p-MIB", "lldpAntiRoguePortIndex"))
if mibBuilder.loadTexts: lldpRemOrgDefInfoEntry.setStatus('mandatory')
lldpAntiRoguePortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 3, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: lldpAntiRoguePortIndex.setStatus('mandatory')
lldpAntiRoguePortStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2))).clone(namedValues=NamedValues(("authentication_disabled", 0), ("authentication_enabled", 1), ("authentication_successful", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: lldpAntiRoguePortStatus.setStatus('mandatory')
lldpRemOrgDefInfoOUI = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(3, 3)).setFixedLength(3)).setMaxAccess("readonly")
if mibBuilder.loadTexts: lldpRemOrgDefInfoOUI.setStatus('mandatory')
swFiberInsert = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 75, 3) + (0,1))
swFiberRemove = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 75, 3) + (0,2))
swFiberAbnormalRXError = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 75, 3) + (0,3))
swFiberAbnormalTXError = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 75, 3) + (0,4))
swTPAbnormalRXError = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 75, 3) + (0,5))
swTPAbnormalTXError = NotificationType((1, 3, 6, 1, 4, 1, 171, 10, 75, 3) + (0,6))
mibBuilder.exportSymbols("DES-1228p-MIB", igsVlanFilterTable=igsVlanFilterTable, des_1228pa1=des_1228pa1, configMirrorEntry=configMirrorEntry, lldpAntiRoguePortStatus=lldpAntiRoguePortStatus, poeportgroup=poeportgroup, igsVlanRouterPortList=igsVlanRouterPortList, commSetTable=commSetTable, dot1xAuthConfigPortStatus=dot1xAuthConfigPortStatus, configPort=configPort, commTrapIpAddress=commTrapIpAddress, tvlanPortTable=tvlanPortTable, dot1xAuthTxPeriod=dot1xAuthTxPeriod, igsVlanRouterPortListVlanId=igsVlanRouterPortListVlanId, commTrapSNMPTPLinkUpDown=commTrapSNMPTPLinkUpDown, staticId=staticId, configVerSwPrimary=configVerSwPrimary, swTPAbnormalTXError=swTPAbnormalTXError, igsLeaveProcessInterval=igsLeaveProcessInterval, commTrapSNMPBootup=commTrapSNMPBootup, spanOnOff=spanOnOff, commTrapTrapPOEPortShort=commTrapTrapPOEPortShort, igsVlanMcastFwdVlanIdMac=igsVlanMcastFwdVlanIdMac, tvlanManagementid=tvlanManagementid, miscReset=miscReset, dot1xAuthSystemControl=dot1xAuthSystemControl, companyMiscGroup=companyMiscGroup, configVLANMode=configVLANMode, portTrunkId=portTrunkId, dot1xAuthConfigPortSessionTime=dot1xAuthConfigPortSessionTime, configBootTftpServerIp=configBootTftpServerIp, PortList=PortList, igsMcastEntryAgeingInterval=igsMcastEntryAgeingInterval, configMirrorRXSrc=configMirrorRXSrc, companyDot1xGroup=companyDot1xGroup, igsVlanFilterStatus=igsVlanFilterStatus, configPortEntry=configPortEntry, configMirrorStatus=configMirrorStatus, commGetIndex=commGetIndex, configMirrorId=configMirrorId, lldpAntiRogueKey=lldpAntiRogueKey, poeportpowerlimit=poeportpowerlimit, dot1xAuthReAuthEnabled=dot1xAuthReAuthEnabled, igsVlanId=igsVlanId, configNetMask=configNetMask, staticOnOff=staticOnOff, tvlanTable=tvlanTable, companyCommGroup=companyCommGroup, staticMac=staticMac, staticEntry=staticEntry, tvlanEntry=tvlanEntry, commSetName=commSetName, swFiberAbnormalTXError=swFiberAbnormalTXError, commTrapEntry=commTrapEntry, configBootTftpOperation=configBootTftpOperation, commGetStatus=commGetStatus, commTrapTrapAbnormalFiberTXError=commTrapTrapAbnormalFiberTXError, igsHostPortPurgeInterval=igsHostPortPurgeInterval, igsVlanMcastFwdTable=igsVlanMcastFwdTable, dlink_products=dlink_products, tvlanId=tvlanId, igsSystem=igsSystem, dot1xAuthConfigPortControl=dot1xAuthConfigPortControl, dot1xAuthConfigPortNumber=dot1xAuthConfigPortNumber, configIpAddress=configIpAddress, lldpGalobalEnable=lldpGalobalEnable, commTrapTrapPOEPortOvercurrent=commTrapTrapPOEPortOvercurrent, swTPAbnormalRXError=swTPAbnormalRXError, configSNMPEnable=configSNMPEnable, igsQueryMaxResponseTime=igsQueryMaxResponseTime, igsReportForwardInterval=igsReportForwardInterval, dot1xAuthQuietPeriod=dot1xAuthQuietPeriod, radiusServerPort=radiusServerPort, configPasswordAdmin=configPasswordAdmin, swFiberAbnormalRXError=swFiberAbnormalRXError, igsSharedSegmentAggregationInterval=igsSharedSegmentAggregationInterval, lldpAntiRoguePortControl=lldpAntiRoguePortControl, commTrapTrapAbnormalTPTXError=commTrapTrapAbnormalTPTXError, commTrapTrapPOEPowerFail=commTrapTrapPOEPowerFail, lldpRemOrgDefInfoEntry=lldpRemOrgDefInfoEntry, companySpanGroup=companySpanGroup, tvlanPortEntry=tvlanPortEntry, igsStatus=igsStatus, radius=radius, tvlanUntaggedPorts=tvlanUntaggedPorts, configVerHwChipSet=configVerHwChipSet, igsVlanFilterEntry=igsVlanFilterEntry, configTftpOperation=configTftpOperation, dot1xAuthConfigPortTable=dot1xAuthConfigPortTable, configBootImageFileName=configBootImageFileName, commTrapTrapAbnormalFiberRXError=commTrapTrapAbnormalFiberRXError, tvlanAsyOnOff=tvlanAsyOnOff, configPhysAddress=configPhysAddress, tvlanPortVlanId=tvlanPortVlanId, dlink_DES12XXSeriesProd=dlink_DES12XXSeriesProd, RowStatus=RowStatus, igsNextMcastFwdMode=igsNextMcastFwdMode, staticTable=staticTable, staticAutoLearning=staticAutoLearning, configPortSpeed=configPortSpeed, poePortEntry=poePortEntry, configPortTable=configPortTable, companyPortTrunkGroup=companyPortTrunkGroup, staticStatus=staticStatus, igsVlanRouterPortListTable=igsVlanRouterPortListTable, commGetName=commGetName, lldpRemOrgDefInfoOUI=lldpRemOrgDefInfoOUI, portTrunkName=portTrunkName, companyIgsGroup=companyIgsGroup, commSetStatus=commSetStatus, dot1xAuthMaxReq=dot1xAuthMaxReq, commTrapTrapAbnormalTPRXError=commTrapTrapAbnormalTPRXError, igsv3Processing=igsv3Processing, tvlanMember=tvlanMember, companyLLDPExtnGroup=companyLLDPExtnGroup, tvlanPortPortId=tvlanPortPortId, dot1xAuthSuppTimeout=dot1xAuthSuppTimeout, portTrunkTable=portTrunkTable, dot1xAuthConfigPortEntry=dot1xAuthConfigPortEntry, dot1xAuthConfigPortSessionUserName=dot1xAuthConfigPortSessionUserName, configPortPriority=configPortPriority, tvlanManagementOnOff=tvlanManagementOnOff, configTftpServerIpAddress=configTftpServerIpAddress, d_link=d_link, companyConfigGroup=companyConfigGroup, lldpSysConfigChecksum=lldpSysConfigChecksum, portTrunkMember=portTrunkMember, lldpAntiRoguePortIndex=lldpAntiRoguePortIndex, configGateway=configGateway, poePortTable=poePortTable, configPortOperStatus=configPortOperStatus, swFiberRemove=swFiberRemove, igsVlan=igsVlan, igsVlanMcastFwdGroupAddress=igsVlanMcastFwdGroupAddress, configMirrorTXSrc=configMirrorTXSrc, dot1xAuth=dot1xAuth, commTrapStatus=commTrapStatus, igsGblReportFwdOnAllPorts=igsGblReportFwdOnAllPorts, radiusServerAddress=radiusServerAddress, configMirrorTable=configMirrorTable, staticVlanID=staticVlanID, commGetTable=commGetTable, MacAddress=MacAddress, commTrapTable=commTrapTable, miscStatisticsReset=miscStatisticsReset, igsVlanRouterPortListEntry=igsVlanRouterPortListEntry, configTftpServerFileName=configTftpServerFileName, lldpRemOrgDefInfoTable=lldpRemOrgDefInfoTable, staticPort=staticPort, tvlanStatus=tvlanStatus, companyPoEGroup=companyPoEGroup, igsVlanMcastFwdEntry=igsVlanMcastFwdEntry, commTrapName=commTrapName, swFiberInsert=swFiberInsert, tvlanName=tvlanName, configIpAssignmentMode=configIpAssignmentMode, companyTVlanGroup=companyTVlanGroup, dot1xAuthServerTimeout=dot1xAuthServerTimeout, lldpSysMACDigest=lldpSysMACDigest, commTrapIndex=commTrapIndex, configMirrorMon=configMirrorMon, igsLastMembQueryInterval=igsLastMembQueryInterval, radiusServerSharedSecret=radiusServerSharedSecret, OwnerString=OwnerString, commTrapSNMPFiberLinkUpDown=commTrapSNMPFiberLinkUpDown, commSetIndex=commSetIndex, companyStaticGroup=companyStaticGroup, poeportid=poeportid, commGetEntry=commGetEntry, igsRobustnessValue=igsRobustnessValue, configSave=configSave, igsRouterPortPurgeInterval=igsRouterPortPurgeInterval, configRestoreDefaults=configRestoreDefaults, portTrunkEntry=portTrunkEntry, igsVlanMcastFwdPortListMac=igsVlanMcastFwdPortListMac, igsQueryInterval=igsQueryInterval, dot1xAuthReAuthPeriod=dot1xAuthReAuthPeriod, commSetEntry=commSetEntry)
|
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ValueSizeConstraint')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(module_identity, enterprises, object_identity, counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, integer32, mib_identifier, notification_type, unsigned32, time_ticks, bits, mib_2, ip_address, iso, counter64, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'ModuleIdentity', 'enterprises', 'ObjectIdentity', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Integer32', 'MibIdentifier', 'NotificationType', 'Unsigned32', 'TimeTicks', 'Bits', 'mib-2', 'IpAddress', 'iso', 'Counter64', 'Gauge32')
(textual_convention, display_string, phys_address) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString', 'PhysAddress')
d_link = mib_identifier((1, 3, 6, 1, 4, 1, 171)).setLabel('d-link')
dlink_products = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10)).setLabel('dlink-products')
dlink_des12_xx_series_prod = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75)).setLabel('dlink-DES12XXSeriesProd')
des_1228pa1 = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3)).setLabel('des-1228pa1')
class Ownerstring(DisplayString):
pass
class Macaddress(OctetString):
subtype_spec = OctetString.subtypeSpec + value_size_constraint(6, 6)
fixed_length = 6
class Portlist(TextualConvention, OctetString):
status = 'current'
subtype_spec = OctetString.subtypeSpec + value_size_constraint(6, 6)
fixed_length = 6
class Rowstatus(TextualConvention, Integer32):
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))
named_values = named_values(('active', 1), ('notInService', 2), ('notReady', 3), ('createAndGo', 4), ('createAndWait', 5), ('destroy', 6))
company_comm_group = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1))
company_misc_group = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 3))
company_span_group = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 4))
company_config_group = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11))
company_t_vlan_group = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13))
company_port_trunk_group = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 14))
company_po_e_group = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 15))
company_static_group = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21))
company_igs_group = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22))
company_dot1x_group = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23))
company_lldp_extn_group = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24))
comm_set_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 1))
if mibBuilder.loadTexts:
commSetTable.setStatus('mandatory')
comm_set_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 1, 1)).setIndexNames((0, 'DES-1228p-MIB', 'commSetIndex'))
if mibBuilder.loadTexts:
commSetEntry.setStatus('mandatory')
comm_set_index = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
commSetIndex.setStatus('mandatory')
comm_set_name = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 1, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 20))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commSetName.setStatus('mandatory')
comm_set_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 1, 1, 3), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commSetStatus.setStatus('mandatory')
comm_get_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 2))
if mibBuilder.loadTexts:
commGetTable.setStatus('mandatory')
comm_get_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 2, 1)).setIndexNames((0, 'DES-1228p-MIB', 'commGetIndex'))
if mibBuilder.loadTexts:
commGetEntry.setStatus('mandatory')
comm_get_index = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
commGetIndex.setStatus('mandatory')
comm_get_name = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 2, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 20))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commGetName.setStatus('mandatory')
comm_get_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 2, 1, 3), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commGetStatus.setStatus('mandatory')
comm_trap_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3))
if mibBuilder.loadTexts:
commTrapTable.setStatus('mandatory')
comm_trap_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1)).setIndexNames((0, 'DES-1228p-MIB', 'commTrapIndex'))
if mibBuilder.loadTexts:
commTrapEntry.setStatus('mandatory')
comm_trap_index = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
commTrapIndex.setStatus('mandatory')
comm_trap_name = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 20))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapName.setStatus('mandatory')
comm_trap_ip_address = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 3), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapIpAddress.setStatus('mandatory')
comm_trap_snmp_bootup = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapSNMPBootup.setStatus('mandatory')
comm_trap_snmptp_link_up_down = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapSNMPTPLinkUpDown.setStatus('mandatory')
comm_trap_snmp_fiber_link_up_down = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapSNMPFiberLinkUpDown.setStatus('mandatory')
comm_trap_trap_abnormal_tprx_error = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapTrapAbnormalTPRXError.setStatus('mandatory')
comm_trap_trap_abnormal_tptx_error = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapTrapAbnormalTPTXError.setStatus('mandatory')
comm_trap_trap_abnormal_fiber_rx_error = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapTrapAbnormalFiberRXError.setStatus('mandatory')
comm_trap_trap_abnormal_fiber_tx_error = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapTrapAbnormalFiberTXError.setStatus('mandatory')
comm_trap_trap_poe_power_fail = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapTrapPOEPowerFail.setStatus('mandatory')
comm_trap_trap_poe_port_overcurrent = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 14), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapTrapPOEPortOvercurrent.setStatus('mandatory')
comm_trap_trap_poe_port_short = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapTrapPOEPortShort.setStatus('mandatory')
comm_trap_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 1, 3, 1, 16), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
commTrapStatus.setStatus('mandatory')
misc_reset = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 3, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('reset', 1), ('noop', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
miscReset.setStatus('mandatory')
misc_statistics_reset = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 3, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('reset', 1), ('noop', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
miscStatisticsReset.setStatus('mandatory')
span_on_off = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 4, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
spanOnOff.setStatus('mandatory')
config_ver_sw_primary = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 1), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
configVerSwPrimary.setStatus('mandatory')
config_ver_hw_chip_set = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 2), display_string().subtype(subtypeSpec=value_size_constraint(0, 31))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
configVerHwChipSet.setStatus('mandatory')
config_boot_tftp_operation = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('download', 1), ('upload', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configBootTftpOperation.setStatus('mandatory')
config_boot_tftp_server_ip = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 4), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configBootTftpServerIp.setStatus('mandatory')
config_boot_image_file_name = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 5), display_string().subtype(subtypeSpec=value_size_constraint(0, 63))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configBootImageFileName.setStatus('mandatory')
config_port_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 6))
if mibBuilder.loadTexts:
configPortTable.setStatus('mandatory')
config_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 6, 1)).setIndexNames((0, 'DES-1228p-MIB', 'configPort'))
if mibBuilder.loadTexts:
configPortEntry.setStatus('mandatory')
config_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 6, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
configPort.setStatus('mandatory')
config_port_speed = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 6, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('disable', 1), ('auto', 2), ('rate10M-Half', 3), ('rate10M-Full', 4), ('rate100M-Half', 5), ('rate100M-Full', 6), ('rate1000M-Full', 7)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configPortSpeed.setStatus('mandatory')
config_port_oper_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 6, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('down', 1), ('rate10M-Half', 2), ('rate10M-Full', 3), ('rate100M-Half', 4), ('rate100M-Full', 5), ('rate1000M-Full', 6)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
configPortOperStatus.setStatus('mandatory')
config_port_priority = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 6, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('low', 1), ('middle', 2), ('high', 3), ('highest', 4)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configPortPriority.setStatus('mandatory')
config_vlan_mode = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1))).clone(namedValues=named_values(('modeTagBased', 1)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configVLANMode.setStatus('mandatory')
config_mirror_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8))
if mibBuilder.loadTexts:
configMirrorTable.setStatus('mandatory')
config_mirror_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8, 1)).setIndexNames((0, 'DES-1228p-MIB', 'configMirrorId'))
if mibBuilder.loadTexts:
configMirrorEntry.setStatus('mandatory')
config_mirror_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 1))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
configMirrorId.setStatus('mandatory')
config_mirror_mon = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8, 1, 2), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configMirrorMon.setStatus('mandatory')
config_mirror_tx_src = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8, 1, 3), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configMirrorTXSrc.setStatus('mandatory')
config_mirror_rx_src = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8, 1, 4), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configMirrorRXSrc.setStatus('mandatory')
config_mirror_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 8, 1, 5), row_status()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configMirrorStatus.setStatus('mandatory')
config_snmp_enable = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configSNMPEnable.setStatus('mandatory')
config_ip_assignment_mode = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 12), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('manual', 1), ('dhcp', 2), ('other', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configIpAssignmentMode.setStatus('mandatory')
config_phys_address = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 13), mac_address()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
configPhysAddress.setStatus('mandatory')
config_password_admin = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 15), display_string().subtype(subtypeSpec=value_size_constraint(0, 20))).setMaxAccess('writeonly')
if mibBuilder.loadTexts:
configPasswordAdmin.setStatus('mandatory')
config_ip_address = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 16), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configIpAddress.setStatus('mandatory')
config_net_mask = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 17), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configNetMask.setStatus('mandatory')
config_gateway = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 18), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configGateway.setStatus('mandatory')
config_save = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 19), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('save', 1), ('noop', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configSave.setStatus('mandatory')
config_restore_defaults = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 22), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('restore', 1), ('noop', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configRestoreDefaults.setStatus('mandatory')
config_tftp_server_ip_address = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 32), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configTftpServerIpAddress.setStatus('mandatory')
config_tftp_server_file_name = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 33), display_string().subtype(subtypeSpec=value_size_constraint(0, 64))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configTftpServerFileName.setStatus('mandatory')
config_tftp_operation = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 11, 34), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('download', 1), ('upload', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
configTftpOperation.setStatus('mandatory')
tvlan_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1))
if mibBuilder.loadTexts:
tvlanTable.setStatus('mandatory')
tvlan_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1, 1)).setIndexNames((0, 'DES-1228p-MIB', 'tvlanId'))
if mibBuilder.loadTexts:
tvlanEntry.setStatus('mandatory')
tvlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tvlanId.setStatus('mandatory')
tvlan_name = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1, 1, 2), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
tvlanName.setStatus('mandatory')
tvlan_member = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1, 1, 3), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
tvlanMember.setStatus('mandatory')
tvlan_untagged_ports = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1, 1, 4), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
tvlanUntaggedPorts.setStatus('mandatory')
tvlan_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 1, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 3, 5, 6))).clone(namedValues=named_values(('active', 1), ('notready', 3), ('createAndwait', 5), ('destroy', 6)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
tvlanStatus.setStatus('mandatory')
tvlan_management_on_off = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
tvlanManagementOnOff.setStatus('mandatory')
tvlan_managementid = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 3), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
tvlanManagementid.setStatus('mandatory')
tvlan_port_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 4))
if mibBuilder.loadTexts:
tvlanPortTable.setStatus('mandatory')
tvlan_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 4, 1)).setIndexNames((0, 'DES-1228p-MIB', 'tvlanPortPortId'))
if mibBuilder.loadTexts:
tvlanPortEntry.setStatus('mandatory')
tvlan_port_port_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 4, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tvlanPortPortId.setStatus('mandatory')
tvlan_port_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 4, 1, 2), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
tvlanPortVlanId.setStatus('mandatory')
tvlan_asy_on_off = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 13, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
tvlanAsyOnOff.setStatus('mandatory')
port_trunk_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 14, 1))
if mibBuilder.loadTexts:
portTrunkTable.setStatus('mandatory')
port_trunk_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 14, 1, 1)).setIndexNames((0, 'DES-1228p-MIB', 'portTrunkId'), (0, 'DES-1228p-MIB', 'portTrunkMember'))
if mibBuilder.loadTexts:
portTrunkEntry.setStatus('mandatory')
port_trunk_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 14, 1, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
portTrunkId.setStatus('mandatory')
port_trunk_name = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 14, 1, 1, 2), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
portTrunkName.setStatus('mandatory')
port_trunk_member = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 14, 1, 1, 3), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
portTrunkMember.setStatus('mandatory')
poe_port_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 15, 1))
if mibBuilder.loadTexts:
poePortTable.setStatus('mandatory')
poe_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 15, 1, 1)).setIndexNames((0, 'DES-1228p-MIB', 'poeportgroup'), (0, 'DES-1228p-MIB', 'poeportid'))
if mibBuilder.loadTexts:
poePortEntry.setStatus('mandatory')
poeportgroup = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 15, 1, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
poeportgroup.setStatus('mandatory')
poeportid = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 15, 1, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
poeportid.setStatus('mandatory')
poeportpowerlimit = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 15, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2, 3))).clone(namedValues=named_values(('auto', 0), ('class1', 1), ('class2', 2), ('class3', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
poeportpowerlimit.setStatus('mandatory')
static_on_off = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
staticOnOff.setStatus('mandatory')
static_auto_learning = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 2), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
staticAutoLearning.setStatus('mandatory')
static_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3))
if mibBuilder.loadTexts:
staticTable.setStatus('mandatory')
static_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3, 1)).setIndexNames((0, 'DES-1228p-MIB', 'staticId'))
if mibBuilder.loadTexts:
staticEntry.setStatus('mandatory')
static_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
staticId.setStatus('mandatory')
static_mac = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3, 1, 2), mac_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
staticMac.setStatus('mandatory')
static_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3, 1, 3), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
staticPort.setStatus('mandatory')
static_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3, 1, 4), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
staticVlanID.setStatus('mandatory')
static_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 21, 3, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 3, 5, 6))).clone(namedValues=named_values(('active', 1), ('notready', 3), ('createAndwait', 5), ('destroy', 6)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
staticStatus.setStatus('mandatory')
igs_system = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1))
igs_vlan = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3))
igs_status = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone(2)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
igsStatus.setStatus('mandatory')
igsv3_processing = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone(1)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
igsv3Processing.setStatus('mandatory')
igs_router_port_purge_interval = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(60, 600)).clone(260)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
igsRouterPortPurgeInterval.setStatus('mandatory')
igs_host_port_purge_interval = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(130, 153025)).clone(260)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
igsHostPortPurgeInterval.setStatus('mandatory')
igs_report_forward_interval = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(0, 25)).clone(5)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
igsReportForwardInterval.setStatus('mandatory')
igs_leave_process_interval = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(0, 25)).clone(1)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
igsLeaveProcessInterval.setStatus('mandatory')
igs_mcast_entry_ageing_interval = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(60, 600)).clone(600)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
igsMcastEntryAgeingInterval.setStatus('mandatory')
igs_shared_segment_aggregation_interval = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 60)).clone(30)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
igsSharedSegmentAggregationInterval.setStatus('mandatory')
igs_gbl_report_fwd_on_all_ports = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('allports', 1), ('rtrports', 2))).clone(2)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
igsGblReportFwdOnAllPorts.setStatus('mandatory')
igs_next_mcast_fwd_mode = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('ipbased', 1), ('macbased', 2))).clone(1)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
igsNextMcastFwdMode.setStatus('mandatory')
igs_query_interval = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 14), integer32().subtype(subtypeSpec=value_range_constraint(60, 600)).clone(125)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
igsQueryInterval.setStatus('mandatory')
igs_query_max_response_time = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 15), integer32().subtype(subtypeSpec=value_range_constraint(10, 25)).clone(10)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
igsQueryMaxResponseTime.setStatus('mandatory')
igs_robustness_value = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 16), integer32().subtype(subtypeSpec=value_range_constraint(2, 255)).clone(2)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
igsRobustnessValue.setStatus('mandatory')
igs_last_memb_query_interval = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 1, 17), integer32().subtype(subtypeSpec=value_range_constraint(1, 25)).clone(1)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
igsLastMembQueryInterval.setStatus('mandatory')
igs_vlan_mcast_fwd_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 1))
if mibBuilder.loadTexts:
igsVlanMcastFwdTable.setStatus('mandatory')
igs_vlan_mcast_fwd_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 1, 1)).setIndexNames((0, 'DES-1228p-MIB', 'igsVlanMcastFwdVlanIdMac'), (0, 'DES-1228p-MIB', 'igsVlanMcastFwdGroupAddress'))
if mibBuilder.loadTexts:
igsVlanMcastFwdEntry.setStatus('mandatory')
igs_vlan_mcast_fwd_vlan_id_mac = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 4094)))
if mibBuilder.loadTexts:
igsVlanMcastFwdVlanIdMac.setStatus('mandatory')
igs_vlan_mcast_fwd_group_address = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 1, 1, 2), mac_address())
if mibBuilder.loadTexts:
igsVlanMcastFwdGroupAddress.setStatus('mandatory')
igs_vlan_mcast_fwd_port_list_mac = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 1, 1, 3), port_list()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
igsVlanMcastFwdPortListMac.setStatus('mandatory')
igs_vlan_router_port_list_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 3))
if mibBuilder.loadTexts:
igsVlanRouterPortListTable.setStatus('mandatory')
igs_vlan_router_port_list_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 3, 1)).setIndexNames((0, 'DES-1228p-MIB', 'igsVlanRouterPortListVlanId'))
if mibBuilder.loadTexts:
igsVlanRouterPortListEntry.setStatus('mandatory')
igs_vlan_router_port_list_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 3, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 4094)))
if mibBuilder.loadTexts:
igsVlanRouterPortListVlanId.setStatus('mandatory')
igs_vlan_router_port_list = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 3, 1, 2), port_list()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
igsVlanRouterPortList.setStatus('mandatory')
igs_vlan_filter_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 4))
if mibBuilder.loadTexts:
igsVlanFilterTable.setStatus('mandatory')
igs_vlan_filter_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 4, 1)).setIndexNames((0, 'DES-1228p-MIB', 'igsVlanId'))
if mibBuilder.loadTexts:
igsVlanFilterEntry.setStatus('mandatory')
igs_vlan_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 4, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 4094)))
if mibBuilder.loadTexts:
igsVlanId.setStatus('mandatory')
igs_vlan_filter_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 22, 3, 4, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
igsVlanFilterStatus.setStatus('mandatory')
radius = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 1))
dot1x_auth = mib_identifier((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2))
radius_server_address = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 1, 1), ip_address()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
radiusServerAddress.setStatus('mandatory')
radius_server_port = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
radiusServerPort.setStatus('mandatory')
radius_server_shared_secret = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 1, 3), display_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
radiusServerSharedSecret.setStatus('mandatory')
dot1x_auth_system_control = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dot1xAuthSystemControl.setStatus('mandatory')
dot1x_auth_quiet_period = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535)).clone(60)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dot1xAuthQuietPeriod.setStatus('mandatory')
dot1x_auth_tx_period = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535)).clone(30)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dot1xAuthTxPeriod.setStatus('mandatory')
dot1x_auth_supp_timeout = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535)).clone(30)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dot1xAuthSuppTimeout.setStatus('mandatory')
dot1x_auth_server_timeout = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535)).clone(30)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dot1xAuthServerTimeout.setStatus('mandatory')
dot1x_auth_max_req = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 6), integer32().subtype(subtypeSpec=value_range_constraint(1, 10)).clone(2)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dot1xAuthMaxReq.setStatus('mandatory')
dot1x_auth_re_auth_period = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 7), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 4294967295)).clone(3600)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dot1xAuthReAuthPeriod.setStatus('mandatory')
dot1x_auth_re_auth_enabled = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dot1xAuthReAuthEnabled.setStatus('mandatory')
dot1x_auth_config_port_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9))
if mibBuilder.loadTexts:
dot1xAuthConfigPortTable.setStatus('mandatory')
dot1x_auth_config_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9, 1)).setIndexNames((0, 'DES-1228p-MIB', 'dot1xAuthConfigPortNumber'))
if mibBuilder.loadTexts:
dot1xAuthConfigPortEntry.setStatus('mandatory')
dot1x_auth_config_port_number = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dot1xAuthConfigPortNumber.setStatus('mandatory')
dot1x_auth_config_port_control = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
dot1xAuthConfigPortControl.setStatus('mandatory')
dot1x_auth_config_port_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('authnull', 0), ('authorized', 1), ('unauthorized', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dot1xAuthConfigPortStatus.setStatus('mandatory')
dot1x_auth_config_port_session_time = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9, 1, 4), time_ticks()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dot1xAuthConfigPortSessionTime.setStatus('mandatory')
dot1x_auth_config_port_session_user_name = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 23, 2, 9, 1, 5), display_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
dot1xAuthConfigPortSessionUserName.setStatus('mandatory')
lldp_sys_mac_digest = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 1), display_string().subtype(subtypeSpec=value_size_constraint(32, 32)).setFixedLength(32)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
lldpSysMACDigest.setStatus('mandatory')
lldp_anti_rogue_port_control = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 2), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
lldpAntiRoguePortControl.setStatus('mandatory')
lldp_rem_org_def_info_table = mib_table((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 3))
if mibBuilder.loadTexts:
lldpRemOrgDefInfoTable.setStatus('mandatory')
lldp_anti_rogue_key = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 4), octet_string().subtype(subtypeSpec=value_size_constraint(20, 20)).setFixedLength(20)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
lldpAntiRogueKey.setStatus('mandatory')
lldp_sys_config_checksum = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
lldpSysConfigChecksum.setStatus('mandatory')
lldp_galobal_enable = mib_scalar((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
lldpGalobalEnable.setStatus('mandatory')
lldp_rem_org_def_info_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 3, 1)).setIndexNames((0, 'DES-1228p-MIB', 'lldpAntiRoguePortIndex'))
if mibBuilder.loadTexts:
lldpRemOrgDefInfoEntry.setStatus('mandatory')
lldp_anti_rogue_port_index = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 3, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
lldpAntiRoguePortIndex.setStatus('mandatory')
lldp_anti_rogue_port_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 3, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 1, 2))).clone(namedValues=named_values(('authentication_disabled', 0), ('authentication_enabled', 1), ('authentication_successful', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
lldpAntiRoguePortStatus.setStatus('mandatory')
lldp_rem_org_def_info_oui = mib_table_column((1, 3, 6, 1, 4, 1, 171, 10, 75, 3, 24, 3, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(3, 3)).setFixedLength(3)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
lldpRemOrgDefInfoOUI.setStatus('mandatory')
sw_fiber_insert = notification_type((1, 3, 6, 1, 4, 1, 171, 10, 75, 3) + (0, 1))
sw_fiber_remove = notification_type((1, 3, 6, 1, 4, 1, 171, 10, 75, 3) + (0, 2))
sw_fiber_abnormal_rx_error = notification_type((1, 3, 6, 1, 4, 1, 171, 10, 75, 3) + (0, 3))
sw_fiber_abnormal_tx_error = notification_type((1, 3, 6, 1, 4, 1, 171, 10, 75, 3) + (0, 4))
sw_tp_abnormal_rx_error = notification_type((1, 3, 6, 1, 4, 1, 171, 10, 75, 3) + (0, 5))
sw_tp_abnormal_tx_error = notification_type((1, 3, 6, 1, 4, 1, 171, 10, 75, 3) + (0, 6))
mibBuilder.exportSymbols('DES-1228p-MIB', igsVlanFilterTable=igsVlanFilterTable, des_1228pa1=des_1228pa1, configMirrorEntry=configMirrorEntry, lldpAntiRoguePortStatus=lldpAntiRoguePortStatus, poeportgroup=poeportgroup, igsVlanRouterPortList=igsVlanRouterPortList, commSetTable=commSetTable, dot1xAuthConfigPortStatus=dot1xAuthConfigPortStatus, configPort=configPort, commTrapIpAddress=commTrapIpAddress, tvlanPortTable=tvlanPortTable, dot1xAuthTxPeriod=dot1xAuthTxPeriod, igsVlanRouterPortListVlanId=igsVlanRouterPortListVlanId, commTrapSNMPTPLinkUpDown=commTrapSNMPTPLinkUpDown, staticId=staticId, configVerSwPrimary=configVerSwPrimary, swTPAbnormalTXError=swTPAbnormalTXError, igsLeaveProcessInterval=igsLeaveProcessInterval, commTrapSNMPBootup=commTrapSNMPBootup, spanOnOff=spanOnOff, commTrapTrapPOEPortShort=commTrapTrapPOEPortShort, igsVlanMcastFwdVlanIdMac=igsVlanMcastFwdVlanIdMac, tvlanManagementid=tvlanManagementid, miscReset=miscReset, dot1xAuthSystemControl=dot1xAuthSystemControl, companyMiscGroup=companyMiscGroup, configVLANMode=configVLANMode, portTrunkId=portTrunkId, dot1xAuthConfigPortSessionTime=dot1xAuthConfigPortSessionTime, configBootTftpServerIp=configBootTftpServerIp, PortList=PortList, igsMcastEntryAgeingInterval=igsMcastEntryAgeingInterval, configMirrorRXSrc=configMirrorRXSrc, companyDot1xGroup=companyDot1xGroup, igsVlanFilterStatus=igsVlanFilterStatus, configPortEntry=configPortEntry, configMirrorStatus=configMirrorStatus, commGetIndex=commGetIndex, configMirrorId=configMirrorId, lldpAntiRogueKey=lldpAntiRogueKey, poeportpowerlimit=poeportpowerlimit, dot1xAuthReAuthEnabled=dot1xAuthReAuthEnabled, igsVlanId=igsVlanId, configNetMask=configNetMask, staticOnOff=staticOnOff, tvlanTable=tvlanTable, companyCommGroup=companyCommGroup, staticMac=staticMac, staticEntry=staticEntry, tvlanEntry=tvlanEntry, commSetName=commSetName, swFiberAbnormalTXError=swFiberAbnormalTXError, commTrapEntry=commTrapEntry, configBootTftpOperation=configBootTftpOperation, commGetStatus=commGetStatus, commTrapTrapAbnormalFiberTXError=commTrapTrapAbnormalFiberTXError, igsHostPortPurgeInterval=igsHostPortPurgeInterval, igsVlanMcastFwdTable=igsVlanMcastFwdTable, dlink_products=dlink_products, tvlanId=tvlanId, igsSystem=igsSystem, dot1xAuthConfigPortControl=dot1xAuthConfigPortControl, dot1xAuthConfigPortNumber=dot1xAuthConfigPortNumber, configIpAddress=configIpAddress, lldpGalobalEnable=lldpGalobalEnable, commTrapTrapPOEPortOvercurrent=commTrapTrapPOEPortOvercurrent, swTPAbnormalRXError=swTPAbnormalRXError, configSNMPEnable=configSNMPEnable, igsQueryMaxResponseTime=igsQueryMaxResponseTime, igsReportForwardInterval=igsReportForwardInterval, dot1xAuthQuietPeriod=dot1xAuthQuietPeriod, radiusServerPort=radiusServerPort, configPasswordAdmin=configPasswordAdmin, swFiberAbnormalRXError=swFiberAbnormalRXError, igsSharedSegmentAggregationInterval=igsSharedSegmentAggregationInterval, lldpAntiRoguePortControl=lldpAntiRoguePortControl, commTrapTrapAbnormalTPTXError=commTrapTrapAbnormalTPTXError, commTrapTrapPOEPowerFail=commTrapTrapPOEPowerFail, lldpRemOrgDefInfoEntry=lldpRemOrgDefInfoEntry, companySpanGroup=companySpanGroup, tvlanPortEntry=tvlanPortEntry, igsStatus=igsStatus, radius=radius, tvlanUntaggedPorts=tvlanUntaggedPorts, configVerHwChipSet=configVerHwChipSet, igsVlanFilterEntry=igsVlanFilterEntry, configTftpOperation=configTftpOperation, dot1xAuthConfigPortTable=dot1xAuthConfigPortTable, configBootImageFileName=configBootImageFileName, commTrapTrapAbnormalFiberRXError=commTrapTrapAbnormalFiberRXError, tvlanAsyOnOff=tvlanAsyOnOff, configPhysAddress=configPhysAddress, tvlanPortVlanId=tvlanPortVlanId, dlink_DES12XXSeriesProd=dlink_DES12XXSeriesProd, RowStatus=RowStatus, igsNextMcastFwdMode=igsNextMcastFwdMode, staticTable=staticTable, staticAutoLearning=staticAutoLearning, configPortSpeed=configPortSpeed, poePortEntry=poePortEntry, configPortTable=configPortTable, companyPortTrunkGroup=companyPortTrunkGroup, staticStatus=staticStatus, igsVlanRouterPortListTable=igsVlanRouterPortListTable, commGetName=commGetName, lldpRemOrgDefInfoOUI=lldpRemOrgDefInfoOUI, portTrunkName=portTrunkName, companyIgsGroup=companyIgsGroup, commSetStatus=commSetStatus, dot1xAuthMaxReq=dot1xAuthMaxReq, commTrapTrapAbnormalTPRXError=commTrapTrapAbnormalTPRXError, igsv3Processing=igsv3Processing, tvlanMember=tvlanMember, companyLLDPExtnGroup=companyLLDPExtnGroup, tvlanPortPortId=tvlanPortPortId, dot1xAuthSuppTimeout=dot1xAuthSuppTimeout, portTrunkTable=portTrunkTable, dot1xAuthConfigPortEntry=dot1xAuthConfigPortEntry, dot1xAuthConfigPortSessionUserName=dot1xAuthConfigPortSessionUserName, configPortPriority=configPortPriority, tvlanManagementOnOff=tvlanManagementOnOff, configTftpServerIpAddress=configTftpServerIpAddress, d_link=d_link, companyConfigGroup=companyConfigGroup, lldpSysConfigChecksum=lldpSysConfigChecksum, portTrunkMember=portTrunkMember, lldpAntiRoguePortIndex=lldpAntiRoguePortIndex, configGateway=configGateway, poePortTable=poePortTable, configPortOperStatus=configPortOperStatus, swFiberRemove=swFiberRemove, igsVlan=igsVlan, igsVlanMcastFwdGroupAddress=igsVlanMcastFwdGroupAddress, configMirrorTXSrc=configMirrorTXSrc, dot1xAuth=dot1xAuth, commTrapStatus=commTrapStatus, igsGblReportFwdOnAllPorts=igsGblReportFwdOnAllPorts, radiusServerAddress=radiusServerAddress, configMirrorTable=configMirrorTable, staticVlanID=staticVlanID, commGetTable=commGetTable, MacAddress=MacAddress, commTrapTable=commTrapTable, miscStatisticsReset=miscStatisticsReset, igsVlanRouterPortListEntry=igsVlanRouterPortListEntry, configTftpServerFileName=configTftpServerFileName, lldpRemOrgDefInfoTable=lldpRemOrgDefInfoTable, staticPort=staticPort, tvlanStatus=tvlanStatus, companyPoEGroup=companyPoEGroup, igsVlanMcastFwdEntry=igsVlanMcastFwdEntry, commTrapName=commTrapName, swFiberInsert=swFiberInsert, tvlanName=tvlanName, configIpAssignmentMode=configIpAssignmentMode, companyTVlanGroup=companyTVlanGroup, dot1xAuthServerTimeout=dot1xAuthServerTimeout, lldpSysMACDigest=lldpSysMACDigest, commTrapIndex=commTrapIndex, configMirrorMon=configMirrorMon, igsLastMembQueryInterval=igsLastMembQueryInterval, radiusServerSharedSecret=radiusServerSharedSecret, OwnerString=OwnerString, commTrapSNMPFiberLinkUpDown=commTrapSNMPFiberLinkUpDown, commSetIndex=commSetIndex, companyStaticGroup=companyStaticGroup, poeportid=poeportid, commGetEntry=commGetEntry, igsRobustnessValue=igsRobustnessValue, configSave=configSave, igsRouterPortPurgeInterval=igsRouterPortPurgeInterval, configRestoreDefaults=configRestoreDefaults, portTrunkEntry=portTrunkEntry, igsVlanMcastFwdPortListMac=igsVlanMcastFwdPortListMac, igsQueryInterval=igsQueryInterval, dot1xAuthReAuthPeriod=dot1xAuthReAuthPeriod, commSetEntry=commSetEntry)
|
BOT_PREFIX = '[bot] '
BOT_SUFFIX = '\n'
class BotReply:
def send_reply(self, dest, tg_socket):
raise NotImplementedError
|
bot_prefix = '[bot] '
bot_suffix = '\n'
class Botreply:
def send_reply(self, dest, tg_socket):
raise NotImplementedError
|
products = [
{
'id': 1,
'name': 'Apple',
'price': 200,
'quantity': 20
},
{
'id': 2,
'name': 'Milk',
'price': 20,
'quantity': 100
},
{
'id': 3,
'name': 'Rice',
'price': 500,
'quantity': 20
},
{
'id': 4,
'name': 'Pepsi',
'price': 55,
'quantity': 20
},
]
print('-----------------------------------------------')
print('\t\tSuper Market')
print('-----------------------------------------------')
print('SNo\tName\tPrice\tQuantity')
print('-----------------------------------------------')
for product in products:
print(product['id'],'\t', product['name'],'\t', product['price'], '\t',product['quantity'])
print('-----------------------------------------------')
total_bill = 0
while True:
item = int(input('Add item to cart: '))
quant = int(input('How much: '))
for product in products:
if item == product['id']:
total_bill = product['price'] * quant + total_bill
choice = input('do you want add another item(y/n): ')
if choice.lower() == 'n':
if total_bill >=2000:
total_bill = total_bill - (total_bill * 5 / 100 )
print('congrats, you got 5 % discount')
print('Total Bill Amount: ', total_bill)
break
# item_1 = input('enter your product name: ')
# price_1 = 200
# quan_1 = int(input('enter the quantity: '))
# item_2 = input('enter your product name: ')
# price_2 = 16.50
# quan_2 = int(input('enter the quantity: '))
# item_3 = input('enter your product name: ')
# price_3= 1300
# quan_3 = int(input('enter the quantity: '))
# total_amount = price_1 * quan_1 + price_2 * quan_2 + price_3 * quan_3
# if total_amount >= 2000:
# discount_amount = int(total_amount * 5 / 100)
# print('-----------------------------------------------')
# print('\t\tSuper Market')
# print('-----------------------------------------------')
# print('SNO\tProduct\tPrice\tQuantity\tAmount')
# print('-----------------------------------------------')
# print('1.\t', item_1,'\t',price_1, '\t', quan_1, '\t\t', price_1 * quan_1 )
# print('2.\t', item_2,'\t',price_2, '\t', quan_2, '\t\t', price_2 * quan_2 )
# print('3.\t', item_3,'\t',price_3, '\t', quan_3, '\t\t', price_3 * quan_3 )
# print('------------------------------------------------')
# print('\t\tActual Amount = ', total_amount)
# print('\t\tDiscount Amount(5%) = ', discount_amount)
# print('-----------------------------------------------')
# print('\t\tTotal Bill Amount = ', total_amount - discount_amount)
|
products = [{'id': 1, 'name': 'Apple', 'price': 200, 'quantity': 20}, {'id': 2, 'name': 'Milk', 'price': 20, 'quantity': 100}, {'id': 3, 'name': 'Rice', 'price': 500, 'quantity': 20}, {'id': 4, 'name': 'Pepsi', 'price': 55, 'quantity': 20}]
print('-----------------------------------------------')
print('\t\tSuper Market')
print('-----------------------------------------------')
print('SNo\tName\tPrice\tQuantity')
print('-----------------------------------------------')
for product in products:
print(product['id'], '\t', product['name'], '\t', product['price'], '\t', product['quantity'])
print('-----------------------------------------------')
total_bill = 0
while True:
item = int(input('Add item to cart: '))
quant = int(input('How much: '))
for product in products:
if item == product['id']:
total_bill = product['price'] * quant + total_bill
choice = input('do you want add another item(y/n): ')
if choice.lower() == 'n':
if total_bill >= 2000:
total_bill = total_bill - total_bill * 5 / 100
print('congrats, you got 5 % discount')
print('Total Bill Amount: ', total_bill)
break
|
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
|
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
|
"""
CSCI-603: Trees (week 10)
Author: Sean Strout @ RIT CS
This is an implementation of a binary tree node.
"""
class BTNode:
"""
A binary tree node contains:
:slot val: A user defined value
:slot left: A left child (BTNode or None)
:slot right: A right child (BTNode or None)
"""
__slots__ = 'val', 'left', 'right'
def __init__(self, val, left=None, right=None):
"""
Initialize a node.
:param val: The value to store in the node
:param left: The left child (BTNode or None)
:param right: The right child (BTNode or None)
:return: None
"""
self.val = val
self.left = left
self.right = right
def testBTNode():
"""
A test function for BTNode.
:return: None
"""
parent = BTNode(10)
left = BTNode(20)
right = BTNode(30)
parent.left = left
parent.right = right
print('parent (30):', parent.val)
print('left (10):', parent.left.val)
print('right (20):', parent.right.val)
if __name__ == '__main__':
testBTNode()
|
"""
CSCI-603: Trees (week 10)
Author: Sean Strout @ RIT CS
This is an implementation of a binary tree node.
"""
class Btnode:
"""
A binary tree node contains:
:slot val: A user defined value
:slot left: A left child (BTNode or None)
:slot right: A right child (BTNode or None)
"""
__slots__ = ('val', 'left', 'right')
def __init__(self, val, left=None, right=None):
"""
Initialize a node.
:param val: The value to store in the node
:param left: The left child (BTNode or None)
:param right: The right child (BTNode or None)
:return: None
"""
self.val = val
self.left = left
self.right = right
def test_bt_node():
"""
A test function for BTNode.
:return: None
"""
parent = bt_node(10)
left = bt_node(20)
right = bt_node(30)
parent.left = left
parent.right = right
print('parent (30):', parent.val)
print('left (10):', parent.left.val)
print('right (20):', parent.right.val)
if __name__ == '__main__':
test_bt_node()
|
def load(file = "data.txt"):
data = []
for line in open(file):
data.append(line)
return data
|
def load(file='data.txt'):
data = []
for line in open(file):
data.append(line)
return data
|
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def diameterOfBinaryTree(self, root: TreeNode) -> int:
if root is None:
return 0
diameter = 0
def getTreeHeight(node):
nonlocal diameter
if node.left is None and node.right is None:
return 0
leftHeight = 0 if node.left is None else getTreeHeight(node.left) + 1
rightHeight = 0 if node.right is None else getTreeHeight(node.right) + 1
diameter = max(leftHeight + rightHeight, diameter)
return max(leftHeight, rightHeight)
getTreeHeight(root)
return diameter
|
class Solution:
def diameter_of_binary_tree(self, root: TreeNode) -> int:
if root is None:
return 0
diameter = 0
def get_tree_height(node):
nonlocal diameter
if node.left is None and node.right is None:
return 0
left_height = 0 if node.left is None else get_tree_height(node.left) + 1
right_height = 0 if node.right is None else get_tree_height(node.right) + 1
diameter = max(leftHeight + rightHeight, diameter)
return max(leftHeight, rightHeight)
get_tree_height(root)
return diameter
|
def listToString(s):
"""
Description: Need to build function because argparse function returns list, not string. Called from main.
:param s: argparse output
:return: string of url
"""
# initialize an empty string
url_string = ""
# traverse in the string
for ele in s:
url_string += ele
# return string
return url_string
if __name__ == "__main__":
url = 'https://www.basketball-reference.com/leagues/NBA_2019_per_game.html'
result = listToString(url)
|
def list_to_string(s):
"""
Description: Need to build function because argparse function returns list, not string. Called from main.
:param s: argparse output
:return: string of url
"""
url_string = ''
for ele in s:
url_string += ele
return url_string
if __name__ == '__main__':
url = 'https://www.basketball-reference.com/leagues/NBA_2019_per_game.html'
result = list_to_string(url)
|
def prefix_prefix(w, m):
def naive_scan(i, j):
r = 0
while i + r <= m and j + r <= m and w[i + r] == w[j + r]:
r += 1
return r
PREF, s = [-1] * 2 + [0] * (m - 1), 1
for i in range(2, m + 1):
# niezmiennik: s jest takie, ze s + PREF[s] - 1 jest maksymalne i PREF[s] > 0
k = i - s + 1
s_max = s + PREF[s] - 1
if s_max < i:
PREF[i] = naive_scan(i, 1)
if PREF[i] > 0:
s = i
elif PREF[k] + k - 1 < PREF[s]:
PREF[i] = PREF[k]
else:
PREF[i] = (s_max - i + 1) + naive_scan(s_max + 1, s_max - i + 2)
s = i
PREF[1] = m
return PREF
|
def prefix_prefix(w, m):
def naive_scan(i, j):
r = 0
while i + r <= m and j + r <= m and (w[i + r] == w[j + r]):
r += 1
return r
(pref, s) = ([-1] * 2 + [0] * (m - 1), 1)
for i in range(2, m + 1):
k = i - s + 1
s_max = s + PREF[s] - 1
if s_max < i:
PREF[i] = naive_scan(i, 1)
if PREF[i] > 0:
s = i
elif PREF[k] + k - 1 < PREF[s]:
PREF[i] = PREF[k]
else:
PREF[i] = s_max - i + 1 + naive_scan(s_max + 1, s_max - i + 2)
s = i
PREF[1] = m
return PREF
|
class lz78(object):
@staticmethod
def name():
return 'LZ78'
@staticmethod
def compress(data, *args, **kwargs):
'''LZ78 compression
'''
d, word = {0: ''}, 0
dyn_d = (
lambda d, key: d.get(key) or d.__setitem__(key, len(d)) or 0
)
return [
token for
char in
data for
token in
[(word, char)] for
word in [dyn_d(d, token)] if not word
] + [(word, '')]
@staticmethod
def decompress(data, *args, **kwargs):
'''LZ78 decompression
'''
d, j = {0: ''}, ''.join
dyn_d = (
lambda d, value: d.__setitem__(len(d), value) or value
)
return j([dyn_d(d, d[codeword] + char) for (codeword, char) in data])
|
class Lz78(object):
@staticmethod
def name():
return 'LZ78'
@staticmethod
def compress(data, *args, **kwargs):
"""LZ78 compression
"""
(d, word) = ({0: ''}, 0)
dyn_d = lambda d, key: d.get(key) or d.__setitem__(key, len(d)) or 0
return [token for char in data for token in [(word, char)] for word in [dyn_d(d, token)] if not word] + [(word, '')]
@staticmethod
def decompress(data, *args, **kwargs):
"""LZ78 decompression
"""
(d, j) = ({0: ''}, ''.join)
dyn_d = lambda d, value: d.__setitem__(len(d), value) or value
return j([dyn_d(d, d[codeword] + char) for (codeword, char) in data])
|
def insideBoard(board, x, y):
"""detecta si la ficha que quieres poner esta dentro de los limites del tablero
Args:
board (list): lista que contiene el tablero
x (int): posicion x en la que quieres poner en el tablero
y (int): posicion y en la que quieres poner en el tablero
Returns:
boolean: si esta dentro true si no false
"""
columns = len(board[0])
rows = len(board)
if x in range(columns) and y in range(rows):
return True
else:
return False
def legalMove(board, x, y):
"""Comprueba si el movimiento es valido, que no se superponga sobre otras fichas,
este dentro del tablero y que no este flotando la ficha
Args:
board (list): lista que contiene el tablero
x (int): posicion x en la que quieres poner en el tablero
y (int): posicion y en la que quieres poner en el tablero
Returns:
boolean: si el movimiento es valido
"""
if insideBoard(board, x, y) == False:
return False
cond1 = board[y][x] == ''
cond2 = (board[y-1][x] == 'x') or (board[y-1][x] == 'o')
cond3 = (y == 0)
if (cond1 and cond2) or (cond3):
return True
else:
return False
def win(board, x, y, turn):
"""detecta si en ese movimiento hay victoria
Args:
board (list): lista que contiene el tablero
x (int): posicion x en la que quieres poner en el tablero
y (int): posicion y en la que quieres poner en el tablero
turn (string): que jugador ha puesto, ej: 'X'/'O' o 'red'/'yellow'
Returns:
boolean: true si hay victoria, false si no hay victoria
"""
directions = [[[0, 1], [0, -1]], [[1, 1], [-1, -1]],
[[1, 0], [-1, 0]], [[1, -1], [-1, 1]]]
for direction in directions:
counter = 0
for vector in direction:
loop = 0
x_ = x
y_ = y
for loop in range(4):
loop = loop + 1
x_ = x_ + vector[0]
y_ = y_ + vector[1]
cond = insideBoard(board, x_, y_) and board[y_][x_] == turn
if cond:
counter = counter + 1
else:
break
if counter == 3:
return True
return False
board1 = [['', '', '', '', '', '', ''],
['', '', '', '', '', '', ''],
['', '', '', '', '', '', ''],
['', '', '', '', '', '', ''],
['', '', '', '', '', '', ''],
['', '', '', '', '', '', '']]
board2 = [['', 'x', '', 'x', 'x', '', ''],
['', '', '', 'o', 'x', '', ''],
['', '', '', 'x', 'x', '', ''],
['', '', '', '', '', '', ''],
['', '', '', '', '', '', ''],
['', '', '', '', '', '', '']]
board4 = [['o', 'o', 'o', 'x', 'x', 'o', 'o'],
['o', 'o', '', 'o', 'x', 'o', 'o'],
['o', 'x', '', 'x', 'o', 'x', 'o'],
['x', '', '', '', '', 'x', ''],
['x', '', '', '', '', '', ''],
['', '', '', '', '', '', '']]
board3 = [['00', '10', '20', '30', '40', '50', '60'],
['01', '11', '21', '31', '41', '51', '61'],
['02', '12', '22', '32', '42', '52', '62'],
['03', '13', '23', '33', '43', '53', '63'],
['04', '14', '24', '34', '44', '54', '64'],
['05', '15', '25', '35', '45', '55', '65']]
def test_win():
assert win(board2, 4, 3, 'x') == True
assert win(board2, 2, 0, 'x') == True
assert win(board2, 6, 0, 'x') == False
assert win(board2, 8, 8, 'x') == False
assert win(board2, 5, 5, 'x') == False
assert win(board4, 6, 3, 'x') == True
assert win(board4, 2, 1, 'x') == True
assert win(board4, 2, 3, 'x') == False
assert win(board4, 0, 5, 'o') == False
|
def inside_board(board, x, y):
"""detecta si la ficha que quieres poner esta dentro de los limites del tablero
Args:
board (list): lista que contiene el tablero
x (int): posicion x en la que quieres poner en el tablero
y (int): posicion y en la que quieres poner en el tablero
Returns:
boolean: si esta dentro true si no false
"""
columns = len(board[0])
rows = len(board)
if x in range(columns) and y in range(rows):
return True
else:
return False
def legal_move(board, x, y):
"""Comprueba si el movimiento es valido, que no se superponga sobre otras fichas,
este dentro del tablero y que no este flotando la ficha
Args:
board (list): lista que contiene el tablero
x (int): posicion x en la que quieres poner en el tablero
y (int): posicion y en la que quieres poner en el tablero
Returns:
boolean: si el movimiento es valido
"""
if inside_board(board, x, y) == False:
return False
cond1 = board[y][x] == ''
cond2 = board[y - 1][x] == 'x' or board[y - 1][x] == 'o'
cond3 = y == 0
if cond1 and cond2 or cond3:
return True
else:
return False
def win(board, x, y, turn):
"""detecta si en ese movimiento hay victoria
Args:
board (list): lista que contiene el tablero
x (int): posicion x en la que quieres poner en el tablero
y (int): posicion y en la que quieres poner en el tablero
turn (string): que jugador ha puesto, ej: 'X'/'O' o 'red'/'yellow'
Returns:
boolean: true si hay victoria, false si no hay victoria
"""
directions = [[[0, 1], [0, -1]], [[1, 1], [-1, -1]], [[1, 0], [-1, 0]], [[1, -1], [-1, 1]]]
for direction in directions:
counter = 0
for vector in direction:
loop = 0
x_ = x
y_ = y
for loop in range(4):
loop = loop + 1
x_ = x_ + vector[0]
y_ = y_ + vector[1]
cond = inside_board(board, x_, y_) and board[y_][x_] == turn
if cond:
counter = counter + 1
else:
break
if counter == 3:
return True
return False
board1 = [['', '', '', '', '', '', ''], ['', '', '', '', '', '', ''], ['', '', '', '', '', '', ''], ['', '', '', '', '', '', ''], ['', '', '', '', '', '', ''], ['', '', '', '', '', '', '']]
board2 = [['', 'x', '', 'x', 'x', '', ''], ['', '', '', 'o', 'x', '', ''], ['', '', '', 'x', 'x', '', ''], ['', '', '', '', '', '', ''], ['', '', '', '', '', '', ''], ['', '', '', '', '', '', '']]
board4 = [['o', 'o', 'o', 'x', 'x', 'o', 'o'], ['o', 'o', '', 'o', 'x', 'o', 'o'], ['o', 'x', '', 'x', 'o', 'x', 'o'], ['x', '', '', '', '', 'x', ''], ['x', '', '', '', '', '', ''], ['', '', '', '', '', '', '']]
board3 = [['00', '10', '20', '30', '40', '50', '60'], ['01', '11', '21', '31', '41', '51', '61'], ['02', '12', '22', '32', '42', '52', '62'], ['03', '13', '23', '33', '43', '53', '63'], ['04', '14', '24', '34', '44', '54', '64'], ['05', '15', '25', '35', '45', '55', '65']]
def test_win():
assert win(board2, 4, 3, 'x') == True
assert win(board2, 2, 0, 'x') == True
assert win(board2, 6, 0, 'x') == False
assert win(board2, 8, 8, 'x') == False
assert win(board2, 5, 5, 'x') == False
assert win(board4, 6, 3, 'x') == True
assert win(board4, 2, 1, 'x') == True
assert win(board4, 2, 3, 'x') == False
assert win(board4, 0, 5, 'o') == False
|
longname = {'S': 'Susceptible',
'E': 'Exposed',
'I': 'Infected (symptomatic)',
'A': 'Asymptomatically Infected',
'R': 'Recovered',
'H': 'Hospitalised',
'C': 'Critical',
'D': 'Deaths',
'O': 'Offsite',
'Q': 'Quarantined',
'U': 'No ICU Care',
'CS': 'Change in Susceptible',
'CE': 'Change in Exposed',
'CI': 'Change in Infected (symptomatic)',
'CA': 'Change in Asymptomatically Infected',
'CR': 'Change in Recovered',
'CH': 'Change in Hospitalised',
'CC': 'Change in Critical',
'CD': 'Change in Deaths',
'CO': 'Change in Offsite',
'CQ': 'Change in Quarantined',
'CU': 'Change in No ICU Care',
'Ninf': 'Change in total active infections', # sum of E, I, A
}
shortname = {'S': 'Sus.',
'E': 'Exp.',
'I': 'Inf. (symp.)',
'A': 'Asym.',
'R': 'Rec.',
'H': 'Hosp.',
'C': 'Crit.',
'D': 'Deaths',
'O': 'Offsite',
'Q': 'Quar.',
'U': 'No ICU',
'CS': 'Change in Sus.',
'CE': 'Change in Exp.',
'CI': 'Change in Inf. (symp.)',
'CA': 'Change in Asym.',
'CR': 'Change in Rec.',
'CH': 'Change in Hosp.',
'CC': 'Change in Crit.',
'CD': 'Change in Deaths',
'CO': 'Change in Offsite',
'CQ': 'Change in Quar.',
'CU': 'Change in No ICU',
'Ninf': 'New Infected', # newly exposed to the disease = - change in susceptibles
}
index = {'S': 0,
'E': 1,
'I': 2,
'A': 3,
'R': 4,
'H': 5,
'C': 6,
'D': 7,
'O': 8,
'Q': 9,
'U': 10,
'CS': 11,
'CE': 12,
'CI': 13,
'CA': 14,
'CR': 15,
'CH': 16,
'CC': 17,
'CD': 18,
'CO': 19,
'CQ': 20,
'CU': 21,
'Ninf': 22,
}
# This is for the plotter and will be deprecated soon
colour = {'S': 'rgb(0,0,255)', #'blue',
'E': 'rgb(255,150,255)', #'pink',
'I': 'rgb(255,150,50)', #'orange',
'A': 'rgb(255,50,50)', #'dunno',
'R': 'rgb(0,255,0)', #'green',
'H': 'rgb(255,0,0)', #'red',
'C': 'rgb(50,50,50)', #'black',
'D': 'rgb(130,0,255)', #'purple',
'O': 'rgb(130,100,150)', #'dunno',
'Q': 'rgb(150,130,100)', #'dunno',
'U': 'rgb(150,100,150)', #'dunno',
'CS': 'rgb(0,0,255)', #'blue',
'CE': 'rgb(255,150,255)', #'pink',
'CI': 'rgb(255,150,50)', #'orange',
'CA': 'rgb(255,50,50)', #'dunno',
'CR': 'rgb(0,255,0)', #'green',
'CH': 'rgb(255,0,0)', #'red',
'CC': 'rgb(50,50,50)', #'black',
'CD': 'rgb(130,0,255)', #'purple',
'CO': 'rgb(130,100,150)', #'dunno',
'CQ': 'rgb(150,130,100)', #'dunno',
'CU': 'rgb(150,100,150)', #'dunno',
'Ninf': 'rgb(255,125,100)', #
}
# This is for the plotter and will be deprecated soon
fill_colour = {'S': 'rgba(0,0,255),0.1', #'blue',
'E': 'rgba(255,150,255),0.1', #'pink',
'I': 'rgba(255,150,50),0.1', #'orange',
'A': 'rgba(255,50,50),0.1', #'dunno',
'R': 'rgba(0,255,0),0.1', #'green',
'H': 'rgba(255,0,0),0.1', #'red',
'C': 'rgba(50,50,50),0.1', #'black',
'D': 'rgba(130,0,255),0.1', #'purple',
'O': 'rgba(130,100,150),0.1', #'dunno',
'Q': 'rgba(150,130,100),0.1', #'dunno',
'U': 'rgba(150,100,150),0.1', #'dunno',
'CS': 'rgba(0,0,255),0.1', #'blue',
'CE': 'rgba(255,150,255),0.1', #'pink',
'CI': 'rgba(255,150,50),0.1', #'orange',
'CA': 'rgba(255,50,50),0.1', #'dunno',
'CR': 'rgba(0,255,0),0.1', #'green',
'CH': 'rgba(255,0,0),0.1', #'red',
'CC': 'rgba(50,50,50),0.1', #'black',
'CD': 'rgba(130,0,255),0.1', #'purple',
'CO': 'rgba(130,100,150),0.1', #'dunno',
'CQ': 'rgba(150,130,100),0.1', #'dunno',
'CU': 'rgba(150,100,150),0.1', #'dunno',
'Ninf': 'rgba(255,125,100),0.1', #
}
|
longname = {'S': 'Susceptible', 'E': 'Exposed', 'I': 'Infected (symptomatic)', 'A': 'Asymptomatically Infected', 'R': 'Recovered', 'H': 'Hospitalised', 'C': 'Critical', 'D': 'Deaths', 'O': 'Offsite', 'Q': 'Quarantined', 'U': 'No ICU Care', 'CS': 'Change in Susceptible', 'CE': 'Change in Exposed', 'CI': 'Change in Infected (symptomatic)', 'CA': 'Change in Asymptomatically Infected', 'CR': 'Change in Recovered', 'CH': 'Change in Hospitalised', 'CC': 'Change in Critical', 'CD': 'Change in Deaths', 'CO': 'Change in Offsite', 'CQ': 'Change in Quarantined', 'CU': 'Change in No ICU Care', 'Ninf': 'Change in total active infections'}
shortname = {'S': 'Sus.', 'E': 'Exp.', 'I': 'Inf. (symp.)', 'A': 'Asym.', 'R': 'Rec.', 'H': 'Hosp.', 'C': 'Crit.', 'D': 'Deaths', 'O': 'Offsite', 'Q': 'Quar.', 'U': 'No ICU', 'CS': 'Change in Sus.', 'CE': 'Change in Exp.', 'CI': 'Change in Inf. (symp.)', 'CA': 'Change in Asym.', 'CR': 'Change in Rec.', 'CH': 'Change in Hosp.', 'CC': 'Change in Crit.', 'CD': 'Change in Deaths', 'CO': 'Change in Offsite', 'CQ': 'Change in Quar.', 'CU': 'Change in No ICU', 'Ninf': 'New Infected'}
index = {'S': 0, 'E': 1, 'I': 2, 'A': 3, 'R': 4, 'H': 5, 'C': 6, 'D': 7, 'O': 8, 'Q': 9, 'U': 10, 'CS': 11, 'CE': 12, 'CI': 13, 'CA': 14, 'CR': 15, 'CH': 16, 'CC': 17, 'CD': 18, 'CO': 19, 'CQ': 20, 'CU': 21, 'Ninf': 22}
colour = {'S': 'rgb(0,0,255)', 'E': 'rgb(255,150,255)', 'I': 'rgb(255,150,50)', 'A': 'rgb(255,50,50)', 'R': 'rgb(0,255,0)', 'H': 'rgb(255,0,0)', 'C': 'rgb(50,50,50)', 'D': 'rgb(130,0,255)', 'O': 'rgb(130,100,150)', 'Q': 'rgb(150,130,100)', 'U': 'rgb(150,100,150)', 'CS': 'rgb(0,0,255)', 'CE': 'rgb(255,150,255)', 'CI': 'rgb(255,150,50)', 'CA': 'rgb(255,50,50)', 'CR': 'rgb(0,255,0)', 'CH': 'rgb(255,0,0)', 'CC': 'rgb(50,50,50)', 'CD': 'rgb(130,0,255)', 'CO': 'rgb(130,100,150)', 'CQ': 'rgb(150,130,100)', 'CU': 'rgb(150,100,150)', 'Ninf': 'rgb(255,125,100)'}
fill_colour = {'S': 'rgba(0,0,255),0.1', 'E': 'rgba(255,150,255),0.1', 'I': 'rgba(255,150,50),0.1', 'A': 'rgba(255,50,50),0.1', 'R': 'rgba(0,255,0),0.1', 'H': 'rgba(255,0,0),0.1', 'C': 'rgba(50,50,50),0.1', 'D': 'rgba(130,0,255),0.1', 'O': 'rgba(130,100,150),0.1', 'Q': 'rgba(150,130,100),0.1', 'U': 'rgba(150,100,150),0.1', 'CS': 'rgba(0,0,255),0.1', 'CE': 'rgba(255,150,255),0.1', 'CI': 'rgba(255,150,50),0.1', 'CA': 'rgba(255,50,50),0.1', 'CR': 'rgba(0,255,0),0.1', 'CH': 'rgba(255,0,0),0.1', 'CC': 'rgba(50,50,50),0.1', 'CD': 'rgba(130,0,255),0.1', 'CO': 'rgba(130,100,150),0.1', 'CQ': 'rgba(150,130,100),0.1', 'CU': 'rgba(150,100,150),0.1', 'Ninf': 'rgba(255,125,100),0.1'}
|
l = [0]*101
for i in range(1, 10):
for j in range(1, 10):
l[i*j] = 1
n = int(input())
if l[n] == 1:
print("Yes")
else:
print("No")
|
l = [0] * 101
for i in range(1, 10):
for j in range(1, 10):
l[i * j] = 1
n = int(input())
if l[n] == 1:
print('Yes')
else:
print('No')
|
"""
@date: 2021/7/5
@description:
"""
|
"""
@date: 2021/7/5
@description:
"""
|
class RomanNumerals:
def to_roman(val):
result = ''
symbols = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
nums = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
nums_len = len(nums)
i = 0
while i < nums_len:
if nums[i] <= val:
val -= nums[i]
result += symbols[i]
i -= 1
i += 1
return result
def from_roman(roman_num):
symbols_to_nums = {
"I": 1,
"IV": 4,
"V": 5,
"IX": 9,
"X": 10,
"XL": 40,
"L": 50,
"XC": 90,
"C": 100,
"CD": 400,
"D": 500,
"CM": 900,
"M": 1000,
}
result = 0
input_len = len(roman_num)
i = 0
while i < input_len:
search = symbols_to_nums.get(roman_num[i:i+2], None)
if search is None:
search = symbols_to_nums.get(roman_num[i:i+1], None)
i -= 1
result += search
i += 2
return result
def main():
print(RomanNumerals.to_roman(1000) == "M")
print(RomanNumerals.to_roman(4) == "IV")
print(RomanNumerals.to_roman(1) == "I")
print(RomanNumerals.to_roman(9) == "IX")
print(RomanNumerals.to_roman(1990) == "MCMXC")
print(RomanNumerals.to_roman(2008) == "MMVIII")
print(RomanNumerals.to_roman(3999) == "MMMCMXCIX")
print(RomanNumerals.from_roman("XXI") == 21)
print(RomanNumerals.from_roman("I") == 1)
print(RomanNumerals.from_roman("IX") == 9)
print(RomanNumerals.from_roman("IV") == 4)
print(RomanNumerals.from_roman("MMVIII") == 2008)
print(RomanNumerals.from_roman("MDCLXVI") == 1666)
if __name__ == '__main__':
main()
|
class Romannumerals:
def to_roman(val):
result = ''
symbols = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
nums = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
nums_len = len(nums)
i = 0
while i < nums_len:
if nums[i] <= val:
val -= nums[i]
result += symbols[i]
i -= 1
i += 1
return result
def from_roman(roman_num):
symbols_to_nums = {'I': 1, 'IV': 4, 'V': 5, 'IX': 9, 'X': 10, 'XL': 40, 'L': 50, 'XC': 90, 'C': 100, 'CD': 400, 'D': 500, 'CM': 900, 'M': 1000}
result = 0
input_len = len(roman_num)
i = 0
while i < input_len:
search = symbols_to_nums.get(roman_num[i:i + 2], None)
if search is None:
search = symbols_to_nums.get(roman_num[i:i + 1], None)
i -= 1
result += search
i += 2
return result
def main():
print(RomanNumerals.to_roman(1000) == 'M')
print(RomanNumerals.to_roman(4) == 'IV')
print(RomanNumerals.to_roman(1) == 'I')
print(RomanNumerals.to_roman(9) == 'IX')
print(RomanNumerals.to_roman(1990) == 'MCMXC')
print(RomanNumerals.to_roman(2008) == 'MMVIII')
print(RomanNumerals.to_roman(3999) == 'MMMCMXCIX')
print(RomanNumerals.from_roman('XXI') == 21)
print(RomanNumerals.from_roman('I') == 1)
print(RomanNumerals.from_roman('IX') == 9)
print(RomanNumerals.from_roman('IV') == 4)
print(RomanNumerals.from_roman('MMVIII') == 2008)
print(RomanNumerals.from_roman('MDCLXVI') == 1666)
if __name__ == '__main__':
main()
|
'''
Write an algorithm Sums-One-Two-Three(n) that takes an integer n and, in
time O(n), returns the number of possible ways to write n as a sum of 1, 2, and 3. For
example, Sums-One-Two-Three(4) must return 7 because there are 7 ways to write 4 as a
sum of ones, twos, and threes (1+1+1+1, 1+1+2, 1+2+1, 2+1+1, 2+2, 1+3, 3+1).
Analyze the complexity of your solution. Hint: use dynamic programming.
'''
def sumOneTwoThree(n):
return sumOneTwoThree_(n, {})
def sumOneTwoThree_(n, memo):
if n in memo:
#print("yo")
return memo[n]
else:
if n <= 0:
res = 0
elif n == 1:
res = 1
elif n == 2:
res = 2
elif n == 3:
res =4
else:
res = sumOneTwoThree_(n-1, memo) + \
sumOneTwoThree_(n-2, memo) + \
sumOneTwoThree_(n-3, memo)
memo[n] = res
return res
def sumOneTwoThreeIterative(n):
# base cases
if n == 0:
return 0
if n == 1:
return 1
if n == 2:
return 2
if n == 3:
return 4
# iteration
a = 1 # solution for n-3
b = 2 # solution for n-2
c = 4 # solution for n-1
res = a + b + c # solution for n
i = 4
while i < n:
a = b
b = c
c = res
res = a + b + c
i += 1
return res
print(sumOneTwoThree(4))
print(sumOneTwoThree(60))
print(sumOneTwoThree(900))
print("")
print(sumOneTwoThreeIterative(4))
print(sumOneTwoThreeIterative(60))
print(sumOneTwoThreeIterative(900))
# this is not possible with the recursive solution !!
# its a huge number
print(sumOneTwoThreeIterative(6000))
|
"""
Write an algorithm Sums-One-Two-Three(n) that takes an integer n and, in
time O(n), returns the number of possible ways to write n as a sum of 1, 2, and 3. For
example, Sums-One-Two-Three(4) must return 7 because there are 7 ways to write 4 as a
sum of ones, twos, and threes (1+1+1+1, 1+1+2, 1+2+1, 2+1+1, 2+2, 1+3, 3+1).
Analyze the complexity of your solution. Hint: use dynamic programming.
"""
def sum_one_two_three(n):
return sum_one_two_three_(n, {})
def sum_one_two_three_(n, memo):
if n in memo:
return memo[n]
elif n <= 0:
res = 0
elif n == 1:
res = 1
elif n == 2:
res = 2
elif n == 3:
res = 4
else:
res = sum_one_two_three_(n - 1, memo) + sum_one_two_three_(n - 2, memo) + sum_one_two_three_(n - 3, memo)
memo[n] = res
return res
def sum_one_two_three_iterative(n):
if n == 0:
return 0
if n == 1:
return 1
if n == 2:
return 2
if n == 3:
return 4
a = 1
b = 2
c = 4
res = a + b + c
i = 4
while i < n:
a = b
b = c
c = res
res = a + b + c
i += 1
return res
print(sum_one_two_three(4))
print(sum_one_two_three(60))
print(sum_one_two_three(900))
print('')
print(sum_one_two_three_iterative(4))
print(sum_one_two_three_iterative(60))
print(sum_one_two_three_iterative(900))
print(sum_one_two_three_iterative(6000))
|
# Write your solution for 1.3 here!
a=0
i=1
while a < 10000:
a+=i
i+=1
print(i)
#####
a=0
i=2
while a<10000:
a+=i
i+=2
print(i)
|
a = 0
i = 1
while a < 10000:
a += i
i += 1
print(i)
a = 0
i = 2
while a < 10000:
a += i
i += 2
print(i)
|
class account:
def check_password_length(self, password):
if len(password) > 8:
return True
else:
return False
if __name__ == '__main__':
accVerify = account()
print('The password length is ' + str(accVerify.check_password_length('offtoschool')))
|
class Account:
def check_password_length(self, password):
if len(password) > 8:
return True
else:
return False
if __name__ == '__main__':
acc_verify = account()
print('The password length is ' + str(accVerify.check_password_length('offtoschool')))
|
"""
Some useful data sets to be used in the analysis
The command :func:`sequana.sequana_data` may be used to retrieved data from
this package. For example, a small but standard reference (phix) is used in
some NGS experiments. The file is small enough that it is provided within
sequana and its filename (full path) can be retrieved as follows::
from sequana import sequana_data
fullpath = sequana_data("phiX174.fa", "data")
Other files stored in this directory will be documented here.
"""
#: List of adapters used in various sequencing platforms
adapters = {
"adapters_netflex_pcr_free_1_fwd": "adapters_netflex_pcr_free_1_fwd.fa",
"adapters_netflex_pcr_free_1_rev": "adapters_netflex_pcr_free_1_rev.fa"
}
|
"""
Some useful data sets to be used in the analysis
The command :func:`sequana.sequana_data` may be used to retrieved data from
this package. For example, a small but standard reference (phix) is used in
some NGS experiments. The file is small enough that it is provided within
sequana and its filename (full path) can be retrieved as follows::
from sequana import sequana_data
fullpath = sequana_data("phiX174.fa", "data")
Other files stored in this directory will be documented here.
"""
adapters = {'adapters_netflex_pcr_free_1_fwd': 'adapters_netflex_pcr_free_1_fwd.fa', 'adapters_netflex_pcr_free_1_rev': 'adapters_netflex_pcr_free_1_rev.fa'}
|
class Node:
def __init__(self, init_data, pointer = None):
self.data = init_data
self.pointer = pointer
def get_data(self):
return self.data
def get_next(self):
return self.pointer
def set_data(self, data):
self.data = data
def set_next(self, data):
self.pointer = data
class LinkedList:
def __init__(self):
self.root = None
self.size = 0
def get_size(self):
return str(self.size)
def add(self, data):
new = Node(data, self.root)
self.root = new
self.size += 1
def remove(self, data):
current = self.root
prev_node = None
while current:
if current.get_data() == data:
if prev_node:
prev_node.set_next(current.get_next())
else:
self.root = current
self.size -= 1
return
else:
prev_node = current
current = current.get_next()
print("Data not in linked list")
def search(self, data):
current = self.root
while current:
if current.get_data == data:
return data
else:
current = current.get_next()
return None
|
class Node:
def __init__(self, init_data, pointer=None):
self.data = init_data
self.pointer = pointer
def get_data(self):
return self.data
def get_next(self):
return self.pointer
def set_data(self, data):
self.data = data
def set_next(self, data):
self.pointer = data
class Linkedlist:
def __init__(self):
self.root = None
self.size = 0
def get_size(self):
return str(self.size)
def add(self, data):
new = node(data, self.root)
self.root = new
self.size += 1
def remove(self, data):
current = self.root
prev_node = None
while current:
if current.get_data() == data:
if prev_node:
prev_node.set_next(current.get_next())
else:
self.root = current
self.size -= 1
return
else:
prev_node = current
current = current.get_next()
print('Data not in linked list')
def search(self, data):
current = self.root
while current:
if current.get_data == data:
return data
else:
current = current.get_next()
return None
|
def tennis_set(s1, s2):
n1 = min(s1, s2)
n2 = max(s1, s2)
if n2 == 6:
return n1 < 5
return n2 == 7 and n1 >= 5 and n1 < n2
|
def tennis_set(s1, s2):
n1 = min(s1, s2)
n2 = max(s1, s2)
if n2 == 6:
return n1 < 5
return n2 == 7 and n1 >= 5 and (n1 < n2)
|
class people:
def __init__(self):
self.nick_name = ""
self.qq_number = ""
self.topic_name = ""
def display(self):
print("------------------------topic_name = %s------------------------" % self.topic_name)
print("nick_name = ", self.nick_name)
print("%-13s%s" % ("qq_number = ", self.qq_number))
|
class People:
def __init__(self):
self.nick_name = ''
self.qq_number = ''
self.topic_name = ''
def display(self):
print('------------------------topic_name = %s------------------------' % self.topic_name)
print('nick_name = ', self.nick_name)
print('%-13s%s' % ('qq_number = ', self.qq_number))
|
def get_object_or_none(model, *args, **kwargs):
try:
return model._default_manager.get(*args, **kwargs)
except model.DoesNotExist:
return None
def get_object_or_this(model, this, *args, **kwargs):
return get_object_or_none(model, *args, **kwargs) or this
|
def get_object_or_none(model, *args, **kwargs):
try:
return model._default_manager.get(*args, **kwargs)
except model.DoesNotExist:
return None
def get_object_or_this(model, this, *args, **kwargs):
return get_object_or_none(model, *args, **kwargs) or this
|
class Solution:
def merge(self, nums1, m, nums2, n):
i=m-1
j=n-1
tmp=m+n-1
while i>=0 and j>=0:
if nums1[i]<nums2[j]:
nums1[tmp]=nums2[j]
tmp-=1
j-=1
else:
nums1[tmp]=nums1[i]
tmp-=1
i-=1
while j>=0:
nums1[tmp]=nums2[j]
tmp-=1
j-=1
|
class Solution:
def merge(self, nums1, m, nums2, n):
i = m - 1
j = n - 1
tmp = m + n - 1
while i >= 0 and j >= 0:
if nums1[i] < nums2[j]:
nums1[tmp] = nums2[j]
tmp -= 1
j -= 1
else:
nums1[tmp] = nums1[i]
tmp -= 1
i -= 1
while j >= 0:
nums1[tmp] = nums2[j]
tmp -= 1
j -= 1
|
# -*- coding: utf-8 -*-
# {name: (aka, width, height, aspect ratio)}
HIGH_DEFINITION_MAP = {
"NHD": ("nHD", 640, 360, (16, 9)),
"QHD": ("qHD", 960, 540, (16, 9)),
"HD": ("HD", 1280, 720, (16, 9)),
"HD PLUS": ("HD+", 1600, 900, (16, 9)),
"FHD": ("FHD", 1920, 1080, (16, 9)),
"WQHD": ("WQHD", 2560, 1440, (16, 9)),
"QHD PLUS": ("QHD+", 3200, 1800, (16, 9)),
"UHD 4K": ("4K UHD", 3840, 2160, (16, 9)),
"UHD PLUS 5K": ("5K UHD+", 5120, 2880, (16, 9)),
"UHD 8K": ("8K UHD", 7680, 4320, (16, 9)),
}
VIDEO_GRAPHICS_ARRAY_MAP = {
"QQVGA": ("QQVGA", 160, 120, (4, 3)),
"HQVGA 240 160": ("HQVGA", 240, 160, (3, 2)),
"HQVGA 256 160": ("HQVGA", 256, 160, (16, 10)),
"QVGA": ("QVGA", 320, 240, (4, 3)),
"WQVGA 384 240": ("WQVGA", 384, 240, (16, 10)),
"WQVGA 360 240": ("WQVGA", 360, 240, (3, 2)),
"WQVGA 400 240": ("WQVGA", 400, 240, (5, 3)),
"HVGA": ("HVGA", 480, 320, (3, 2)),
"VGA": ("VGA", 640, 480, (4, 3)),
"WVGA 768 480": ("WVGA", 768, 480, (16, 10)),
"WVGA 720 480": ("WVGA", 720, 480, (3, 2)),
"WVGA 800 480": ("WVGA", 800, 480, (5, 3)),
"FWVGA": ("FWVGA", 854, 480, (16, 9)),
"SVGA": ("SVGA", 800, 600, (4, 3)),
"DVGA": ("DVGA", 960, 640, (3, 2)),
"WSVGA 1024 576": ("WSVGA", 1024, 576, (16, 9)),
"WSVGA 1024 600": ("WSVGA", 1024, 600, (128, 75)),
}
EXTENDED_GRAPHICS_ARRAY_MAP = {
"XGA": ("XGA", 1024, 768, (4, 3)),
"WXGA 1152 768": ("WXGA", 1152, 768, (3, 2)),
"WXGA 1280 768": ("WXGA", 1280, 768, (5, 3)),
"WXGA 1280 800": ("WXGA", 1280, 800, (16, 10)),
"WXGA 1360 768": ("WXGA", 1360, 768, (16, 9)),
"FWXGA": ("FWXGA", 1366, 768, (16, 9)),
"XGA PLUS": ("XGA+", 1152, 864, (4, 3)),
"WXGA PLUS": ("WXGA+", 1440, 900, (16, 10)),
"WSXGA": ("WSXGA", 1440, 960, (3, 2)),
"SXGA": ("SXGA", 1280, 1024, (5, 4)),
"SXGA PLUS": ("SXGA+", 1400, 1050, (4, 3)),
"WSXGA PLUS": ("WSXGA+", 1680, 1050, (16, 10)),
"UXGA": ("UXGA", 1600, 1200, (4, 3)),
"WUXGA": ("WUXGA", 1920, 1200, (16, 10)),
}
QUAD_EXTENDED_GRAPHICS_ARRAY_MAP = {
"QWXGA": ("QWXGA", 2048, 1152, (16, 9)),
"QXGA": ("QXGA", 2048, 1536, (4, 3)),
"WQXGA 2560 1600": ("WQXGA", 2560, 1600, (16, 10)),
"WQXGA 2880 1800": ("WQXGA", 2880, 1800, (16, 10)),
"QSXGA": ("QSXGA", 2560, 2048, (5, 4)),
"WQSXGA": ("WQSXGA", 3200, 2048, (25, 16)),
"QUXGA": ("QUXGA", 3200, 2400, (4, 3)),
"WQUXGA": ("WQUXGA", 3840, 2400, (16, 10)),
}
HYPER_EXTENDED_GRAPHICS_ARRAY_MAP = {
"HXGA": ("HXGA", 4096, 3072, (4, 3)),
"WHXGA": ("WHXGA", 5120, 3200, (16, 10)),
"HSXGA": ("HSXGA", 5120, 4096, (5, 4)),
"WHSXGA": ("WHSXGA", 6400, 4096, (25, 16)),
"HUXGA": ("HUXGA", 6400, 4800, (4, 3)),
"WHUXGA": ("WHUXGA", 7680, 4800, (16, 10)),
}
STANDARD_DISPLAY_RESOLUTIONS_MAP = (
(160, 120, (4, 3)),
(320, 200, (8, 5)),
(640, 200, (16, 5)),
(640, 350, (64, 35)),
(640, 480, (4, 3)),
(720, 348, (60, 29)),
(800, 600, (4, 3)),
(1024, 768, (4, 3)),
(1152, 864, (4, 3)),
(1280, 1024, (5, 4)),
(1400, 1050, (4, 3)),
(1600, 1200, (4, 3)),
(2048, 1536, (4, 3)),
(2560, 2048, (5, 4)),
(3200, 2400, (4, 3)),
(4096, 3072, (4, 3)),
(5120, 4096, (5, 4)),
(6400, 4800, (4, 3)),
)
WIDESCREEN_DISPLAY_RESOLUTIONS_MAP = (
(240, 160, (3, 2)),
(320, 240, (4, 3)),
(432, 240, (9, 5)),
(480, 270, (16, 9)),
(480, 320, (3, 2)),
(640, 400, (8, 5)),
(800, 480, (5, 3)),
(854, 480, (427, 240)),
(1024, 576, (16, 9)),
(1280, 720, (16, 9)),
(1280, 768, (5, 3)),
(1280, 800, (8, 5)),
(1366, 768, (683, 384)),
(1366, 900, (683, 450)),
(1440, 900, (8, 5)),
(1600, 900, (16, 9)),
(1680, 945, (16, 9)),
(1680, 1050, (8, 5)),
(1920, 1080, (16, 9)),
(1920, 1200, (8, 5)),
(2048, 1152, (16, 9)),
(2560, 1440, (16, 9)),
(2560, 1600, (8, 5)),
(3200, 2048, (25, 16)),
(3840, 2160, (16, 9)),
(3200, 2400, (4, 3)),
(5120, 2880, (16, 9)),
(5120, 3200, (8, 5)),
(5760, 3240, (16, 9)),
(6400, 4096, (25, 16)),
(7680, 4320, (16, 9)),
(7680, 4800, (8, 5)),
)
|
high_definition_map = {'NHD': ('nHD', 640, 360, (16, 9)), 'QHD': ('qHD', 960, 540, (16, 9)), 'HD': ('HD', 1280, 720, (16, 9)), 'HD PLUS': ('HD+', 1600, 900, (16, 9)), 'FHD': ('FHD', 1920, 1080, (16, 9)), 'WQHD': ('WQHD', 2560, 1440, (16, 9)), 'QHD PLUS': ('QHD+', 3200, 1800, (16, 9)), 'UHD 4K': ('4K UHD', 3840, 2160, (16, 9)), 'UHD PLUS 5K': ('5K UHD+', 5120, 2880, (16, 9)), 'UHD 8K': ('8K UHD', 7680, 4320, (16, 9))}
video_graphics_array_map = {'QQVGA': ('QQVGA', 160, 120, (4, 3)), 'HQVGA 240 160': ('HQVGA', 240, 160, (3, 2)), 'HQVGA 256 160': ('HQVGA', 256, 160, (16, 10)), 'QVGA': ('QVGA', 320, 240, (4, 3)), 'WQVGA 384 240': ('WQVGA', 384, 240, (16, 10)), 'WQVGA 360 240': ('WQVGA', 360, 240, (3, 2)), 'WQVGA 400 240': ('WQVGA', 400, 240, (5, 3)), 'HVGA': ('HVGA', 480, 320, (3, 2)), 'VGA': ('VGA', 640, 480, (4, 3)), 'WVGA 768 480': ('WVGA', 768, 480, (16, 10)), 'WVGA 720 480': ('WVGA', 720, 480, (3, 2)), 'WVGA 800 480': ('WVGA', 800, 480, (5, 3)), 'FWVGA': ('FWVGA', 854, 480, (16, 9)), 'SVGA': ('SVGA', 800, 600, (4, 3)), 'DVGA': ('DVGA', 960, 640, (3, 2)), 'WSVGA 1024 576': ('WSVGA', 1024, 576, (16, 9)), 'WSVGA 1024 600': ('WSVGA', 1024, 600, (128, 75))}
extended_graphics_array_map = {'XGA': ('XGA', 1024, 768, (4, 3)), 'WXGA 1152 768': ('WXGA', 1152, 768, (3, 2)), 'WXGA 1280 768': ('WXGA', 1280, 768, (5, 3)), 'WXGA 1280 800': ('WXGA', 1280, 800, (16, 10)), 'WXGA 1360 768': ('WXGA', 1360, 768, (16, 9)), 'FWXGA': ('FWXGA', 1366, 768, (16, 9)), 'XGA PLUS': ('XGA+', 1152, 864, (4, 3)), 'WXGA PLUS': ('WXGA+', 1440, 900, (16, 10)), 'WSXGA': ('WSXGA', 1440, 960, (3, 2)), 'SXGA': ('SXGA', 1280, 1024, (5, 4)), 'SXGA PLUS': ('SXGA+', 1400, 1050, (4, 3)), 'WSXGA PLUS': ('WSXGA+', 1680, 1050, (16, 10)), 'UXGA': ('UXGA', 1600, 1200, (4, 3)), 'WUXGA': ('WUXGA', 1920, 1200, (16, 10))}
quad_extended_graphics_array_map = {'QWXGA': ('QWXGA', 2048, 1152, (16, 9)), 'QXGA': ('QXGA', 2048, 1536, (4, 3)), 'WQXGA 2560 1600': ('WQXGA', 2560, 1600, (16, 10)), 'WQXGA 2880 1800': ('WQXGA', 2880, 1800, (16, 10)), 'QSXGA': ('QSXGA', 2560, 2048, (5, 4)), 'WQSXGA': ('WQSXGA', 3200, 2048, (25, 16)), 'QUXGA': ('QUXGA', 3200, 2400, (4, 3)), 'WQUXGA': ('WQUXGA', 3840, 2400, (16, 10))}
hyper_extended_graphics_array_map = {'HXGA': ('HXGA', 4096, 3072, (4, 3)), 'WHXGA': ('WHXGA', 5120, 3200, (16, 10)), 'HSXGA': ('HSXGA', 5120, 4096, (5, 4)), 'WHSXGA': ('WHSXGA', 6400, 4096, (25, 16)), 'HUXGA': ('HUXGA', 6400, 4800, (4, 3)), 'WHUXGA': ('WHUXGA', 7680, 4800, (16, 10))}
standard_display_resolutions_map = ((160, 120, (4, 3)), (320, 200, (8, 5)), (640, 200, (16, 5)), (640, 350, (64, 35)), (640, 480, (4, 3)), (720, 348, (60, 29)), (800, 600, (4, 3)), (1024, 768, (4, 3)), (1152, 864, (4, 3)), (1280, 1024, (5, 4)), (1400, 1050, (4, 3)), (1600, 1200, (4, 3)), (2048, 1536, (4, 3)), (2560, 2048, (5, 4)), (3200, 2400, (4, 3)), (4096, 3072, (4, 3)), (5120, 4096, (5, 4)), (6400, 4800, (4, 3)))
widescreen_display_resolutions_map = ((240, 160, (3, 2)), (320, 240, (4, 3)), (432, 240, (9, 5)), (480, 270, (16, 9)), (480, 320, (3, 2)), (640, 400, (8, 5)), (800, 480, (5, 3)), (854, 480, (427, 240)), (1024, 576, (16, 9)), (1280, 720, (16, 9)), (1280, 768, (5, 3)), (1280, 800, (8, 5)), (1366, 768, (683, 384)), (1366, 900, (683, 450)), (1440, 900, (8, 5)), (1600, 900, (16, 9)), (1680, 945, (16, 9)), (1680, 1050, (8, 5)), (1920, 1080, (16, 9)), (1920, 1200, (8, 5)), (2048, 1152, (16, 9)), (2560, 1440, (16, 9)), (2560, 1600, (8, 5)), (3200, 2048, (25, 16)), (3840, 2160, (16, 9)), (3200, 2400, (4, 3)), (5120, 2880, (16, 9)), (5120, 3200, (8, 5)), (5760, 3240, (16, 9)), (6400, 4096, (25, 16)), (7680, 4320, (16, 9)), (7680, 4800, (8, 5)))
|
def shape_legend(node, ax, handles, labels, reverse=False, **kwargs):
"""Plot legend manipulation. This code is copied from the oemof example script
see link here: https://github.com/oemof/oemof-examples/tree/master/oemof_examples/oemof.solph/v0.3.x/plotting_examples
"""
handels = handles
labels = labels
axes = ax
parameter = {}
new_labels = []
for label in labels:
label = label.replace('(', '')
label = label.replace('), flow)', '')
label = label.replace(node, '')
label = label.replace(',', '')
label = label.replace(' ', '')
new_labels.append(label)
labels = new_labels
parameter['bbox_to_anchor'] = kwargs.get('bbox_to_anchor', (1, 0.5))
parameter['loc'] = kwargs.get('loc', 'center left')
parameter['ncol'] = kwargs.get('ncol', 1)
plotshare = kwargs.get('plotshare', 0.9)
if reverse:
handels = handels.reverse()
labels = labels.reverse()
box = axes.get_position()
axes.set_position([box.x0, box.y0, box.width * plotshare, box.height])
parameter['handles'] = handels
parameter['labels'] = labels
axes.legend(**parameter)
return axes
|
def shape_legend(node, ax, handles, labels, reverse=False, **kwargs):
"""Plot legend manipulation. This code is copied from the oemof example script
see link here: https://github.com/oemof/oemof-examples/tree/master/oemof_examples/oemof.solph/v0.3.x/plotting_examples
"""
handels = handles
labels = labels
axes = ax
parameter = {}
new_labels = []
for label in labels:
label = label.replace('(', '')
label = label.replace('), flow)', '')
label = label.replace(node, '')
label = label.replace(',', '')
label = label.replace(' ', '')
new_labels.append(label)
labels = new_labels
parameter['bbox_to_anchor'] = kwargs.get('bbox_to_anchor', (1, 0.5))
parameter['loc'] = kwargs.get('loc', 'center left')
parameter['ncol'] = kwargs.get('ncol', 1)
plotshare = kwargs.get('plotshare', 0.9)
if reverse:
handels = handels.reverse()
labels = labels.reverse()
box = axes.get_position()
axes.set_position([box.x0, box.y0, box.width * plotshare, box.height])
parameter['handles'] = handels
parameter['labels'] = labels
axes.legend(**parameter)
return axes
|
def remove_background(frame):
fgbg = cv2.createBackgroundSubtractorMOG2(history=20)
fgmask = fgbg.apply(frame)
kernel = np.ones((3, 3), np.uint8)
fgmask = cv2.erode(fgmask, kernel, iterations=1)
res = cv2.bitwise_and(frame, frame, mask=fgmask)
return res
# gamma transfer
def gamma_trans(img,gamma):
gamma_table=[np.power(x/255.0,gamma)*255.0 for x in range(256)]
gamma_table=np.round(np.array(gamma_table)).astype(np.uint8)
return cv2.LUT(img,gamma_table)
def adjusted_skin_detection(frame):
ycrcb = cv2.cvtColor(frame, cv2.COLOR_BGR2YCrCb)
B = frame[:,:,0]
G = frame[:,:,1]
R = frame[:,:,2]
Y = 0.299*R + 0.587*G + 0.114*B
Y_value = np.mean(Y)
print(Y_value)
if Y_value<200:
cr0 = (R-Y)*0.713 + 128
else:
cr0 = np.multiply(((R-Y)**2*0.713),((-5000/91)*(Y-200)**(-2)+7)) + 128
cr = np.array(cr0, dtype=np.uint8)
cr1 = cv2.GaussianBlur(cr, _blurKernel, 0)
_, skin = cv2.threshold(cr1, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
kernel = np.ones(_erodeKernel, np.uint8)
skin = cv2.erode(skin, kernel, iterations=1)
skin = cv2.dilate(skin, kernel, iterations=1)
return skin
# calculate center coordinate of contour
def get_center(largecont):
M = cv2.moments(largecont)
center = (int(M['m10'] / M['m00']), int(M['m01'] / M['m00']))
return center
|
def remove_background(frame):
fgbg = cv2.createBackgroundSubtractorMOG2(history=20)
fgmask = fgbg.apply(frame)
kernel = np.ones((3, 3), np.uint8)
fgmask = cv2.erode(fgmask, kernel, iterations=1)
res = cv2.bitwise_and(frame, frame, mask=fgmask)
return res
def gamma_trans(img, gamma):
gamma_table = [np.power(x / 255.0, gamma) * 255.0 for x in range(256)]
gamma_table = np.round(np.array(gamma_table)).astype(np.uint8)
return cv2.LUT(img, gamma_table)
def adjusted_skin_detection(frame):
ycrcb = cv2.cvtColor(frame, cv2.COLOR_BGR2YCrCb)
b = frame[:, :, 0]
g = frame[:, :, 1]
r = frame[:, :, 2]
y = 0.299 * R + 0.587 * G + 0.114 * B
y_value = np.mean(Y)
print(Y_value)
if Y_value < 200:
cr0 = (R - Y) * 0.713 + 128
else:
cr0 = np.multiply((R - Y) ** 2 * 0.713, -5000 / 91 * (Y - 200) ** (-2) + 7) + 128
cr = np.array(cr0, dtype=np.uint8)
cr1 = cv2.GaussianBlur(cr, _blurKernel, 0)
(_, skin) = cv2.threshold(cr1, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
kernel = np.ones(_erodeKernel, np.uint8)
skin = cv2.erode(skin, kernel, iterations=1)
skin = cv2.dilate(skin, kernel, iterations=1)
return skin
def get_center(largecont):
m = cv2.moments(largecont)
center = (int(M['m10'] / M['m00']), int(M['m01'] / M['m00']))
return center
|
def urlify(str, length=None):
"""Write a method to replace all spaces with '%20'.
Args:
str - String whose spaces should be replaced by '%20'
length - length of str minus any spaces padded at the beginning or end
Returns:
A string similar to str except whose spaces have been replaced.
"""
return str.strip().replace(' ', '%20')
|
def urlify(str, length=None):
"""Write a method to replace all spaces with '%20'.
Args:
str - String whose spaces should be replaced by '%20'
length - length of str minus any spaces padded at the beginning or end
Returns:
A string similar to str except whose spaces have been replaced.
"""
return str.strip().replace(' ', '%20')
|
class ElectricalDemandFactorRule(Enum, IComparable, IFormattable, IConvertible):
"""
This enum describes the different demand factor rule types available to the application.
Within a demand factor a rule will be referenced and the user will have to enter values
corresponding to that rule.
enum ElectricalDemandFactorRule,values: Constant (0),LoadTable (2),LoadTablePerPortion (4),QuantityTable (1),QuantityTablePerPortion (3)
"""
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self, *args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self, *args):
pass
def __gt__(self, *args):
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self, *args):
pass
def __lt__(self, *args):
pass
def __ne__(self, *args):
pass
def __reduce_ex__(self, *args):
pass
def __str__(self, *args):
pass
Constant = None
LoadTable = None
LoadTablePerPortion = None
QuantityTable = None
QuantityTablePerPortion = None
value__ = None
|
class Electricaldemandfactorrule(Enum, IComparable, IFormattable, IConvertible):
"""
This enum describes the different demand factor rule types available to the application.
Within a demand factor a rule will be referenced and the user will have to enter values
corresponding to that rule.
enum ElectricalDemandFactorRule,values: Constant (0),LoadTable (2),LoadTablePerPortion (4),QuantityTable (1),QuantityTablePerPortion (3)
"""
def __eq__(self, *args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self, *args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __ge__(self, *args):
pass
def __gt__(self, *args):
pass
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __le__(self, *args):
pass
def __lt__(self, *args):
pass
def __ne__(self, *args):
pass
def __reduce_ex__(self, *args):
pass
def __str__(self, *args):
pass
constant = None
load_table = None
load_table_per_portion = None
quantity_table = None
quantity_table_per_portion = None
value__ = None
|
#as a list:
l=[3,4]
l+=[5,6]
print(l)
#as a stack:
#top input
#lifo
l.append(10)
print(l)
l.pop()#pops the ele that is inserted at last
#as a queue
#fifo
l.insert(0,5)
l.pop()
|
l = [3, 4]
l += [5, 6]
print(l)
l.append(10)
print(l)
l.pop()
l.insert(0, 5)
l.pop()
|
print('Hello World!')
long_mssg = """
.................................................
This script should be replaced for an AI-script
of your own which has an output of some sort that
you are interested in getting
................................................
"""
print(long_mssg)
|
print('Hello World!')
long_mssg = '\n .................................................\n This script should be replaced for an AI-script\n of your own which has an output of some sort that\n you are interested in getting\n ................................................\n '
print(long_mssg)
|
#--------------------------------------------#
# My Solution #
#--------------------------------------------#
def checkio(words: str):
count = 0
for word in words.split():
if word.isalpha():
count += 1
else:
count = 0
if count == 3:
return True
return False
#--------------------------------------------#
# Better Solutions #
#--------------------------------------------#
#import re
#def checkio(words):
#return bool(re.search('\D+ \D+ \D+', words))
#or
#return bool(re.compile("([a-zA-Z]+ ){2}[a-zA-Z]+").search(words))
#def checkio(x):
#counter = 0
#for e in x.split():
#try:
#int(e)
#counter = 0
#except ValueError:
#counter += 1
#if counter >= 3: return True
#return False
#--------------------------------------------#
# Test #
#--------------------------------------------#
a = checkio("Hello World hello") #== True, "Hello"
b = checkio("He is 123 man") #== False, "123 man"
c = checkio("1 2 3 4") #== False, "Digits"
d = checkio("bla bla bla bla") #== True, "Bla Bla"
e = checkio("Hi") #== False, "Hi"
print(a, b, c, d, e, sep= "\n")
|
def checkio(words: str):
count = 0
for word in words.split():
if word.isalpha():
count += 1
else:
count = 0
if count == 3:
return True
return False
a = checkio('Hello World hello')
b = checkio('He is 123 man')
c = checkio('1 2 3 4')
d = checkio('bla bla bla bla')
e = checkio('Hi')
print(a, b, c, d, e, sep='\n')
|
class Player:
def __init__(self, type_):
self.hp = 200
self.type = type_
def combat_simulation(f):
map = []
players = []
for line in f.readlines():
row = []
for c in line.strip():
if c == '#':
row.append(False)
elif c == '.':
row.append(True)
elif c == 'G':
p = Player('G')
row.append(p)
players.append(p)
elif c == 'E':
p = Player('E')
row.append(p)
players.append(p)
map.append(row)
print_map(map)
def move_to(map, source, type_):
queue = [source]
visited = {}
while queue:
x, y = queue.pop(0)
if y not in visited:
visited[y] = {}
if x in visited[y]:
continue
visited[y][x] = True
if y > 1:
val = map[y-1][x]
if val is True:
queue.append((x, y - 1))
elif isinstance(val, Player) and val.type != type_:
# we have a possible location to consider
pass
if y < (len(map) - 1):
if map[y+1][x] is True:
queue.append((x, y + 1))
if x > 1:
if map[y][x-1] is True:
queue.append((x - 1, y))
if x < (len(map[0]) - 1):
if map[y+1][x] is True:
queue.append((x + 1, y))
def print_map(map):
for row in map:
for cell in row:
if cell is False:
print('#', end='')
elif cell is True:
print('.', end='')
elif isinstance(cell, Player):
print(cell.type, end='')
print()
def test_combat_simulation():
assert combat_simulation(open('input/15.demo')) == 27730
assert combat_simulation(open('input/15.test')) == 27730
assert combat_simulation(open('input/15-1.test')) == 36334
assert combat_simulation(open('input/15-2.test')) == 39514
assert combat_simulation(open('input/15-3.test')) == 27755
assert combat_simulation(open('input/15-4.test')) == 28944
assert combat_simulation(open('input/15-5.test')) == 18740
|
class Player:
def __init__(self, type_):
self.hp = 200
self.type = type_
def combat_simulation(f):
map = []
players = []
for line in f.readlines():
row = []
for c in line.strip():
if c == '#':
row.append(False)
elif c == '.':
row.append(True)
elif c == 'G':
p = player('G')
row.append(p)
players.append(p)
elif c == 'E':
p = player('E')
row.append(p)
players.append(p)
map.append(row)
print_map(map)
def move_to(map, source, type_):
queue = [source]
visited = {}
while queue:
(x, y) = queue.pop(0)
if y not in visited:
visited[y] = {}
if x in visited[y]:
continue
visited[y][x] = True
if y > 1:
val = map[y - 1][x]
if val is True:
queue.append((x, y - 1))
elif isinstance(val, Player) and val.type != type_:
pass
if y < len(map) - 1:
if map[y + 1][x] is True:
queue.append((x, y + 1))
if x > 1:
if map[y][x - 1] is True:
queue.append((x - 1, y))
if x < len(map[0]) - 1:
if map[y + 1][x] is True:
queue.append((x + 1, y))
def print_map(map):
for row in map:
for cell in row:
if cell is False:
print('#', end='')
elif cell is True:
print('.', end='')
elif isinstance(cell, Player):
print(cell.type, end='')
print()
def test_combat_simulation():
assert combat_simulation(open('input/15.demo')) == 27730
assert combat_simulation(open('input/15.test')) == 27730
assert combat_simulation(open('input/15-1.test')) == 36334
assert combat_simulation(open('input/15-2.test')) == 39514
assert combat_simulation(open('input/15-3.test')) == 27755
assert combat_simulation(open('input/15-4.test')) == 28944
assert combat_simulation(open('input/15-5.test')) == 18740
|
"""Constants for testclient."""
# these have different places than in the gateway
PLUTO_PSK = '/tmp/psk.txt'
PLUTO_PIDFILE = '/tmp/pluto.pid'
OPENL2TP_PIDFILE = '/tmp/openl2tp.pid'
POOL_SIZE=5
|
"""Constants for testclient."""
pluto_psk = '/tmp/psk.txt'
pluto_pidfile = '/tmp/pluto.pid'
openl2_tp_pidfile = '/tmp/openl2tp.pid'
pool_size = 5
|
# created by RomaOkorosso at 21.03.2021
# config.py
db_url = "postgres://USER:PASSWORD@IP:PORT/DATABASE_NAME"
|
db_url = 'postgres://USER:PASSWORD@IP:PORT/DATABASE_NAME'
|
def tree_transplant(self, u, v):
if(u.pai == None):
self.raiz = v
elif(u.pai.left == u):
u.pai.left = v
else:
u.pai.right = v
if(v != None):
v.pai = u.pai
|
def tree_transplant(self, u, v):
if u.pai == None:
self.raiz = v
elif u.pai.left == u:
u.pai.left = v
else:
u.pai.right = v
if v != None:
v.pai = u.pai
|
"""
Baseline training file used in app production
----------------OBSOLETE----------------
import os
import sqlite3
from sklearn.linear_model import LogisticRegression
from basilica import Connection
import psycopg2
# Load in basilica api key
API_KEY = "d3c5e936-18b0-3aac-8a2c-bf95511eaaa5"
# Filepath for database
DATABASE_URL = "postgres://khqrpuidioocyy:28306f6ac214b8c5ff675ab1e38ed6007d0b810d0a538df3e0db3da0f3cde717@ec2-18-210-214-86.compute-1.amazonaws.com:5432/d1jb037n8m5r20"
# Heroku postgresql credentials
DB_NAME = "d1jb037n8m5r20"
DB_USER = "khqrpuidioocyy"
DB_PASSWORD = "28306f6ac214b8c5ff675ab1e38ed6007d0b810d0a538df3e0db3da0f3cde717"
DB_HOST = "ec2-18-210-214-86.compute-1.amazonaws.com"
# Connect to basilica for embedding text
basilica_connection = Connection(API_KEY)
sql_connection = psycopg2.connect(dbname=DB_NAME, user=DB_USER, password=DB_PASSWORD, host=DB_HOST)
sql_cursor = sql_connection.cursor()
def train_model():
# SQL commands to select all and delete null
select_data =
SELECT
*
FROM
"postgresql-shallow-75985";
# breakpoint()
# print(data)
# Execute select all commands
sql_cursor.execute(select_data)
data = sql_cursor.fetchall()
# Ensure the select command is working
# for row in data:
# print(f"\nSubreddits: {row['subreddit']}")
# print(f"\nTest: {row['Text']}")
print("TRAINING THE MODEL...")
subreddits = []
text_embeddings = []
# breakpoint()
for row in data:
subreddits.append(row[1])
embedding = basilica_connection.embed_sentence(row[2], model="reddit")
text_embeddings.append(embedding)
# breakpoint()
# print(subreddits, text_embeddings)
classifier = LogisticRegression()
classifier.fit(text_embeddings, subreddits)
return classifier
if __name__ == "__main__":
classifier = train_model()
# breakpoint()
"""
|
"""
Baseline training file used in app production
----------------OBSOLETE----------------
import os
import sqlite3
from sklearn.linear_model import LogisticRegression
from basilica import Connection
import psycopg2
# Load in basilica api key
API_KEY = "d3c5e936-18b0-3aac-8a2c-bf95511eaaa5"
# Filepath for database
DATABASE_URL = "postgres://khqrpuidioocyy:28306f6ac214b8c5ff675ab1e38ed6007d0b810d0a538df3e0db3da0f3cde717@ec2-18-210-214-86.compute-1.amazonaws.com:5432/d1jb037n8m5r20"
# Heroku postgresql credentials
DB_NAME = "d1jb037n8m5r20"
DB_USER = "khqrpuidioocyy"
DB_PASSWORD = "28306f6ac214b8c5ff675ab1e38ed6007d0b810d0a538df3e0db3da0f3cde717"
DB_HOST = "ec2-18-210-214-86.compute-1.amazonaws.com"
# Connect to basilica for embedding text
basilica_connection = Connection(API_KEY)
sql_connection = psycopg2.connect(dbname=DB_NAME, user=DB_USER, password=DB_PASSWORD, host=DB_HOST)
sql_cursor = sql_connection.cursor()
def train_model():
# SQL commands to select all and delete null
select_data =
SELECT
*
FROM
"postgresql-shallow-75985";
# breakpoint()
# print(data)
# Execute select all commands
sql_cursor.execute(select_data)
data = sql_cursor.fetchall()
# Ensure the select command is working
# for row in data:
# print(f"
Subreddits: {row['subreddit']}")
# print(f"
Test: {row['Text']}")
print("TRAINING THE MODEL...")
subreddits = []
text_embeddings = []
# breakpoint()
for row in data:
subreddits.append(row[1])
embedding = basilica_connection.embed_sentence(row[2], model="reddit")
text_embeddings.append(embedding)
# breakpoint()
# print(subreddits, text_embeddings)
classifier = LogisticRegression()
classifier.fit(text_embeddings, subreddits)
return classifier
if __name__ == "__main__":
classifier = train_model()
# breakpoint()
"""
|
"""Test case for variable redefined in inner loop."""
for item in range(0, 5):
print("hello")
for item in range(5, 10): #[redefined-outer-name]
print(item)
print("yay")
print(item)
print("done")
|
"""Test case for variable redefined in inner loop."""
for item in range(0, 5):
print('hello')
for item in range(5, 10):
print(item)
print('yay')
print(item)
print('done')
|
def longestWord(sentence):
wordArray = sentence.split(" ")
longest = ""
for word in wordArray:
if(len(word) >= len(longest)):
longest = word
return longest
print(longestWord("Hello World"))
|
def longest_word(sentence):
word_array = sentence.split(' ')
longest = ''
for word in wordArray:
if len(word) >= len(longest):
longest = word
return longest
print(longest_word('Hello World'))
|
c = str(input())
if c[0] == c[1] == c[2]:
print("Won")
else:
print("Lost")
|
c = str(input())
if c[0] == c[1] == c[2]:
print('Won')
else:
print('Lost')
|
class Node:
def __init__(self,data=None):
self.data=data
self.next=None
class LinkedList:
def __init__(self):
self.head=None
def showlist(self):
while self.head is not None:
print(self.head.data)
self.head=self.head.next
list=LinkedList()
list.head=Node("Jan")
e1=Node("Feb")
e2=Node("Mar")
e3=Node("Apr")
#linking first node to second node
list.head.next=e1
e1.next=e2
e2.next=e3
list.showlist()
|
class Node:
def __init__(self, data=None):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def showlist(self):
while self.head is not None:
print(self.head.data)
self.head = self.head.next
list = linked_list()
list.head = node('Jan')
e1 = node('Feb')
e2 = node('Mar')
e3 = node('Apr')
list.head.next = e1
e1.next = e2
e2.next = e3
list.showlist()
|
### Left and Right product lists ###
class Solution1:
def productExceptSelf(self, nums: List[int]) -> List[int]:
l = 1
r = 1
length = len(nums)
ans = [1]*length
for i in range( 0, length ):
ans[i] *=l
ans[length -i-1] *= r
l *= nums[i]
r *= nums[length-i-1]
return ans
|
class Solution1:
def product_except_self(self, nums: List[int]) -> List[int]:
l = 1
r = 1
length = len(nums)
ans = [1] * length
for i in range(0, length):
ans[i] *= l
ans[length - i - 1] *= r
l *= nums[i]
r *= nums[length - i - 1]
return ans
|
print("welcome to calculator \n")
a=int(input("enter first value"))
b=int(input("enter seconde value"))
print("which operation you want two perform \n add sub mul div")
c=input()
if c=="add":
d=a+b
print(d)
if c=="sub":
d=a-b
print(d)
if c=="mul":
d=a*b
print(d)
if c=="div":
d=a/b
print(d)
|
print('welcome to calculator \n')
a = int(input('enter first value'))
b = int(input('enter seconde value'))
print('which operation you want two perform \n add sub mul div')
c = input()
if c == 'add':
d = a + b
print(d)
if c == 'sub':
d = a - b
print(d)
if c == 'mul':
d = a * b
print(d)
if c == 'div':
d = a / b
print(d)
|
#!/usr/bin/env python3
print('hello world')
print('hello', 'world')
## use "sep" parameter to change output
print('hello', 'world', sep = '_')
|
print('hello world')
print('hello', 'world')
print('hello', 'world', sep='_')
|
people=30
cars=40
trucks=15
if cars>people:
print("We should take the cars")
elif cars<people:
print("We should not take the cars")
else:
print("We can't decide")
if trucks>cars:
print("That's too many trucks")
elif trucks<cars:
print("Maybe we could take the trucks")
else:
print("We still can't decide")
if people >trucks:
print("Alright,let's just take the trucks")
else:
print("Fine,let's stay home then")
|
people = 30
cars = 40
trucks = 15
if cars > people:
print('We should take the cars')
elif cars < people:
print('We should not take the cars')
else:
print("We can't decide")
if trucks > cars:
print("That's too many trucks")
elif trucks < cars:
print('Maybe we could take the trucks')
else:
print("We still can't decide")
if people > trucks:
print("Alright,let's just take the trucks")
else:
print("Fine,let's stay home then")
|
'''
Description
Given a continuous stream of data, write a function that returns the first unique number (including the last number) when the terminating number arrives. If the terminating number is not found, return -1.
Example
Example1
Input:
[1, 2, 2, 1, 3, 4, 4, 5, 6]
5
Output: 3
Example2
Input:
[1, 2, 2, 1, 3, 4, 4, 5, 6]
7
Output: -1
Example3
Input:
[1, 2, 2, 1, 3, 4]
3
Output: 3
'''
class Solution:
"""
@param nums: a continuous stream of numbers
@param number: a number
@return: returns the first unique number
"""
def firstUniqueNumber(self, nums, number):
# Write your code here
onedict = {}
flag = False
for i, x in enumerate(nums):
if x not in onedict:
onedict[x] = [1, i]
else:
onedict[x][0] += 1
if number == x:
flag = True
break
if flag == True:
oncelist = []
for key in onedict:
if onedict[key][0] == 1:
oncelist.append([key, onedict[key][1]])
x = 2e30
returnkey = None
for one in oncelist:
if one[1] < x:
x = one[1]
returnkey = one[0]
return returnkey
else:
return -1
|
"""
Description
Given a continuous stream of data, write a function that returns the first unique number (including the last number) when the terminating number arrives. If the terminating number is not found, return -1.
Example
Example1
Input:
[1, 2, 2, 1, 3, 4, 4, 5, 6]
5
Output: 3
Example2
Input:
[1, 2, 2, 1, 3, 4, 4, 5, 6]
7
Output: -1
Example3
Input:
[1, 2, 2, 1, 3, 4]
3
Output: 3
"""
class Solution:
"""
@param nums: a continuous stream of numbers
@param number: a number
@return: returns the first unique number
"""
def first_unique_number(self, nums, number):
onedict = {}
flag = False
for (i, x) in enumerate(nums):
if x not in onedict:
onedict[x] = [1, i]
else:
onedict[x][0] += 1
if number == x:
flag = True
break
if flag == True:
oncelist = []
for key in onedict:
if onedict[key][0] == 1:
oncelist.append([key, onedict[key][1]])
x = 2e+30
returnkey = None
for one in oncelist:
if one[1] < x:
x = one[1]
returnkey = one[0]
return returnkey
else:
return -1
|
def armsinside():
i01.rightArm.rotate.attach()
i01.rightArm.rotate.moveTo(0)
sleep(7)
i01.rightArm.rotate.detach()
|
def armsinside():
i01.rightArm.rotate.attach()
i01.rightArm.rotate.moveTo(0)
sleep(7)
i01.rightArm.rotate.detach()
|
Byte = {
'LF': '\x0A',
'NULL': '\x00'
}
class Frame:
def __init__(self, command, headers, body):
self.command = command
self.headers = headers
self.body = '' if body is None else body
def __str__(self):
lines = [self.command]
skipContentLength = 'content-length' in self.headers
if skipContentLength:
del self.headers['content-length']
for name in self.headers:
value = self.headers[name]
lines.append("" + name + ":" + value)
if self.body is not None and not skipContentLength:
lines.append("content-length:" + str(len(self.body)))
lines.append(Byte['LF'] + self.body)
return Byte['LF'].join(lines)
@staticmethod
def unmarshall_single(data):
lines = data.split(Byte['LF'])
command = lines[0].strip()
headers = {}
# get all headers
i = 1
while lines[i] != '':
# get key, value from raw header
(key, value) = lines[i].split(':')
headers[key] = value
i += 1
# set body to None if there is no body
body = None if lines[i + 1] == Byte['NULL'] else lines[i + 1][:-1]
return Frame(command, headers, body)
@staticmethod
def marshall(command, headers, body):
return str(Frame(command, headers, body)) + Byte['NULL']
|
byte = {'LF': '\n', 'NULL': '\x00'}
class Frame:
def __init__(self, command, headers, body):
self.command = command
self.headers = headers
self.body = '' if body is None else body
def __str__(self):
lines = [self.command]
skip_content_length = 'content-length' in self.headers
if skipContentLength:
del self.headers['content-length']
for name in self.headers:
value = self.headers[name]
lines.append('' + name + ':' + value)
if self.body is not None and (not skipContentLength):
lines.append('content-length:' + str(len(self.body)))
lines.append(Byte['LF'] + self.body)
return Byte['LF'].join(lines)
@staticmethod
def unmarshall_single(data):
lines = data.split(Byte['LF'])
command = lines[0].strip()
headers = {}
i = 1
while lines[i] != '':
(key, value) = lines[i].split(':')
headers[key] = value
i += 1
body = None if lines[i + 1] == Byte['NULL'] else lines[i + 1][:-1]
return frame(command, headers, body)
@staticmethod
def marshall(command, headers, body):
return str(frame(command, headers, body)) + Byte['NULL']
|
fin = open('input_24.txt')
def getdir(text):
while text:
direction = text[:2]
if direction in ['nw','ne','sw','se']:
text = text[2:]
yield direction
else:
text = text[1:]
yield direction[0]
ftiles = set() # (row,column)
# row, column
moves = {'nw':(-1,-1),'w':(0,-2),'sw':(1,-1),'se':(1,1),'e':(0,2),'ne':(-1,1)}
for line in fin:
line = line.strip()
r = c = 0
for dir_ in getdir(line):
r += moves[dir_][0]
c += moves[dir_][1]
if (r,c) in ftiles:
ftiles.remove((r,c))
else:
ftiles.add((r,c))
fin.close()
print("Black tiles:",len(ftiles))
dirs = ((-1,-1),(0,-2),(1,-1),(1,1),(0,2),(-1,1))
def neighbors_of(tile):
global ftiles
global dirs
ncount = 0
for dir_ in dirs:
r,c = (tile[0]+dir_[0],tile[1]+dir_[1])
if (r,c) in ftiles:
ncount += 1
return ncount
def tick():
global ftiles
global dirs
newtiles = set()
for tile in ftiles:
# check on survival
if neighbors_of(tile) in [1,2]:
newtiles.add(tile)
# check all *its* neighbors for new flips
for dir_ in dirs:
r,c = (tile[0]+dir_[0],tile[1]+dir_[1])
if neighbors_of((r,c)) == 2:
newtiles.add((r,c))
ftiles = newtiles
tickcount = 100
print("Start with:",len(ftiles))
while tickcount:
tickcount -= 1
tick()
print(len(ftiles))
|
fin = open('input_24.txt')
def getdir(text):
while text:
direction = text[:2]
if direction in ['nw', 'ne', 'sw', 'se']:
text = text[2:]
yield direction
else:
text = text[1:]
yield direction[0]
ftiles = set()
moves = {'nw': (-1, -1), 'w': (0, -2), 'sw': (1, -1), 'se': (1, 1), 'e': (0, 2), 'ne': (-1, 1)}
for line in fin:
line = line.strip()
r = c = 0
for dir_ in getdir(line):
r += moves[dir_][0]
c += moves[dir_][1]
if (r, c) in ftiles:
ftiles.remove((r, c))
else:
ftiles.add((r, c))
fin.close()
print('Black tiles:', len(ftiles))
dirs = ((-1, -1), (0, -2), (1, -1), (1, 1), (0, 2), (-1, 1))
def neighbors_of(tile):
global ftiles
global dirs
ncount = 0
for dir_ in dirs:
(r, c) = (tile[0] + dir_[0], tile[1] + dir_[1])
if (r, c) in ftiles:
ncount += 1
return ncount
def tick():
global ftiles
global dirs
newtiles = set()
for tile in ftiles:
if neighbors_of(tile) in [1, 2]:
newtiles.add(tile)
for dir_ in dirs:
(r, c) = (tile[0] + dir_[0], tile[1] + dir_[1])
if neighbors_of((r, c)) == 2:
newtiles.add((r, c))
ftiles = newtiles
tickcount = 100
print('Start with:', len(ftiles))
while tickcount:
tickcount -= 1
tick()
print(len(ftiles))
|
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: quantra
class FlowType(object):
Interest = 0
PastInterest = 1
Notional = 2
|
class Flowtype(object):
interest = 0
past_interest = 1
notional = 2
|
#!/usr/bin/env python3
list1 = ['cisco-nxos', 'arista_eos', 'cisco-ios']
print(list1)
print(list1[1])
list1.extend(['juniper'])
print(list1)
list1.append(['10.1.0.1','10.2.0.1','10.3.0.1'])
print(list1)
print("4th element in list1 is ".format(list1[4]))
print(list1[4][0])
|
list1 = ['cisco-nxos', 'arista_eos', 'cisco-ios']
print(list1)
print(list1[1])
list1.extend(['juniper'])
print(list1)
list1.append(['10.1.0.1', '10.2.0.1', '10.3.0.1'])
print(list1)
print('4th element in list1 is '.format(list1[4]))
print(list1[4][0])
|
if __name__ == '__main__':
print("TESTOUTPUT")
|
if __name__ == '__main__':
print('TESTOUTPUT')
|
class Solution(object):
def binaryTreePaths(self, root):
if not root: return []
arrow = '->'
ans = []
stack = []
stack.append((root, ''))
while stack:
node, path = stack.pop()
path += arrow+str(node.val) if path else str(node.val) #add arrow except beginnings
if not node.left and not node.right: ans.append(path) #if isLeaf, append path.
if node.left: stack.append((node.left, path))
if node.right: stack.append((node.right, path))
return ans
"""
Time: O(N)
Space: O(N)
Standard BFS.
"""
class Solution(object):
def binaryTreePaths(self, root):
q = collections.deque([(root, '')])
ans = []
while q:
node, path = q.popleft()
path = (path+'->'+str(node.val)) if path else str(node.val)
if node.left: q.append((node.left, path))
if node.right: q.append((node.right, path))
if not node.left and not node.right: ans.append(path)
return ans
|
class Solution(object):
def binary_tree_paths(self, root):
if not root:
return []
arrow = '->'
ans = []
stack = []
stack.append((root, ''))
while stack:
(node, path) = stack.pop()
path += arrow + str(node.val) if path else str(node.val)
if not node.left and (not node.right):
ans.append(path)
if node.left:
stack.append((node.left, path))
if node.right:
stack.append((node.right, path))
return ans
'\nTime: O(N)\nSpace: O(N)\n\nStandard BFS.\n'
class Solution(object):
def binary_tree_paths(self, root):
q = collections.deque([(root, '')])
ans = []
while q:
(node, path) = q.popleft()
path = path + '->' + str(node.val) if path else str(node.val)
if node.left:
q.append((node.left, path))
if node.right:
q.append((node.right, path))
if not node.left and (not node.right):
ans.append(path)
return ans
|
def insert_user_list():
keys = ['_id', 'name', 'is_zero_user', 'gender', 'location', 'business',
'education', 'motto', 'answer_num', 'collection_num',
'followed_column_num', 'followed_topic_num', 'followee_num',
'follower_num', 'post_num', 'question_num', 'thank_num',
'upvote_num', 'photo_url', 'weibo_url']
out_db = MongoClient().zhihu_network.users
for line in open('./user_info.data'):
line = line.strip().split('\t')
assert (len(keys) == len(line))
user = dict(zip(keys, line))
for key in user:
if key.endswith('_num'):
user[key] = int(user[key])
out_db.insert(user)
|
def insert_user_list():
keys = ['_id', 'name', 'is_zero_user', 'gender', 'location', 'business', 'education', 'motto', 'answer_num', 'collection_num', 'followed_column_num', 'followed_topic_num', 'followee_num', 'follower_num', 'post_num', 'question_num', 'thank_num', 'upvote_num', 'photo_url', 'weibo_url']
out_db = mongo_client().zhihu_network.users
for line in open('./user_info.data'):
line = line.strip().split('\t')
assert len(keys) == len(line)
user = dict(zip(keys, line))
for key in user:
if key.endswith('_num'):
user[key] = int(user[key])
out_db.insert(user)
|
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: DeepSeaSceneLighting
class LightUnion(object):
NONE = 0
DirectionalLight = 1
PointLight = 2
SpotLight = 3
|
class Lightunion(object):
none = 0
directional_light = 1
point_light = 2
spot_light = 3
|
def ciagCyfr(x):
lista = []
for i in range(x):
if i%2 == 0:
i = i+1
lista.append(i)
else:
i = (i+1)*(-1)
lista.append(i)
print(lista)
|
def ciag_cyfr(x):
lista = []
for i in range(x):
if i % 2 == 0:
i = i + 1
lista.append(i)
else:
i = (i + 1) * -1
lista.append(i)
print(lista)
|
""" Largest Element in Array: Given an array find the largest element in the array """
"""Solution: """
def largest_element(a) -> int:
le = 0
for i in a:
if i > le:
le = i
return le
def main():
arr_input = [40, 100, 8, 50]
a = largest_element(arr_input)
print(a)
# Using the special variable
# __name__
if __name__ == "__main__":
main()
|
""" Largest Element in Array: Given an array find the largest element in the array """
'Solution: '
def largest_element(a) -> int:
le = 0
for i in a:
if i > le:
le = i
return le
def main():
arr_input = [40, 100, 8, 50]
a = largest_element(arr_input)
print(a)
if __name__ == '__main__':
main()
|
def bubbleSort(l, n):
for i in range(n):
for j in range(n-1-i):
if l[j][0] > l[j+1][0]:
l[j], l[j+1] = l[j+1], l[j]
return l[:]
def selectionSort(l, n):
for i in range(n):
minj = i
for j in range(i+1, n):
if l[j][0] < l[minj][0]:
minj = j
l[i], l[minj] = l[minj], l[i]
return l[:]
n = int(input())
l = []
for c in input().split():
l.append((int(c[1]), c[0]))
bl = ' '.join([k + str(n) for n, k in bubbleSort(l[:], n)])
sl = ' '.join([k + str(n) for n, k in selectionSort(l[:], n)])
print(bl)
print('Stable')
print(sl)
print('Stable' if sl == bl else 'Not stable')
|
def bubble_sort(l, n):
for i in range(n):
for j in range(n - 1 - i):
if l[j][0] > l[j + 1][0]:
(l[j], l[j + 1]) = (l[j + 1], l[j])
return l[:]
def selection_sort(l, n):
for i in range(n):
minj = i
for j in range(i + 1, n):
if l[j][0] < l[minj][0]:
minj = j
(l[i], l[minj]) = (l[minj], l[i])
return l[:]
n = int(input())
l = []
for c in input().split():
l.append((int(c[1]), c[0]))
bl = ' '.join([k + str(n) for (n, k) in bubble_sort(l[:], n)])
sl = ' '.join([k + str(n) for (n, k) in selection_sort(l[:], n)])
print(bl)
print('Stable')
print(sl)
print('Stable' if sl == bl else 'Not stable')
|
# Version of the migration tool
VERSION = "0.6"
LOG_DIR="/var/log"
LOG_FILE_PATH="%s/filerobot-migrate.log" % LOG_DIR
UPLOADED_UUIDS_PATH="%s/filerobot-migrate-uploaded-uuids.log" % LOG_DIR
LOG_FAILED_PATH="%s/filerobot-migrate-failed" % LOG_DIR
LOG_RETRY_FAILED_PATH="%s/filerobot-migrate-retry-failed.log" % LOG_DIR
DEFAULT_INPUT_FILE="input.tsv"
|
version = '0.6'
log_dir = '/var/log'
log_file_path = '%s/filerobot-migrate.log' % LOG_DIR
uploaded_uuids_path = '%s/filerobot-migrate-uploaded-uuids.log' % LOG_DIR
log_failed_path = '%s/filerobot-migrate-failed' % LOG_DIR
log_retry_failed_path = '%s/filerobot-migrate-retry-failed.log' % LOG_DIR
default_input_file = 'input.tsv'
|
md_icons = {
'md-3d-rotation':
u"\uf000",
'md-accessibility':
u"\uf001",
'md-account-balance':
u"\uf002",
'md-account-balance-wallet':
u"\uf003",
'md-account-box':
u"\uf004",
'md-account-child':
u"\uf005",
'md-account-circle':
u"\uf006",
'md-add-shopping-cart':
u"\uf007",
'md-alarm':
u"\uf008",
'md-alarm-add':
u"\uf009",
'md-alarm-off':
u"\uf00a",
'md-alarm-on':
u"\uf00b",
'md-android':
u"\uf00c",
'md-announcement':
u"\uf00d",
'md-aspect-ratio':
u"\uf00e",
'md-assessment':
u"\uf00f",
'md-assignment':
u"\uf010",
'md-assignment-ind':
u"\uf011",
'md-assignment-late':
u"\uf012",
'md-assignment-return':
u"\uf013",
'md-assignment-returned':
u"\uf014",
'md-assignment-turned-in':
u"\uf015",
'md-autorenew':
u"\uf016",
'md-backup':
u"\uf017",
'md-book':
u"\uf018",
'md-bookmark':
u"\uf019",
'md-bookmark-outline':
u"\uf01a",
'md-bug-report':
u"\uf01b",
'md-cached':
u"\uf01c",
'md-class':
u"\uf01d",
'md-credit-card':
u"\uf01e",
'md-dashboard':
u"\uf01f",
'md-delete':
u"\uf020",
'md-description':
u"\uf021",
'md-dns':
u"\uf022",
'md-done':
u"\uf023",
'md-done-all':
u"\uf024",
'md-event':
u"\uf025",
'md-exit-to-app':
u"\uf026",
'md-explore':
u"\uf027",
'md-extension':
u"\uf028",
'md-face-unlock':
u"\uf029",
'md-favorite':
u"\uf02a",
'md-favorite-outline':
u"\uf02b",
'md-find-in-page':
u"\uf02c",
'md-find-replace':
u"\uf02d",
'md-flip-to-back':
u"\uf02e",
'md-flip-to-front':
u"\uf02f",
'md-get-app':
u"\uf030",
'md-grade':
u"\uf031",
'md-group-work':
u"\uf032",
'md-help':
u"\uf033",
'md-highlight-remove':
u"\uf034",
'md-history':
u"\uf035",
'md-home':
u"\uf036",
'md-https':
u"\uf037",
'md-info':
u"\uf038",
'md-info-outline':
u"\uf039",
'md-input':
u"\uf03a",
'md-invert-colors':
u"\uf03b",
'md-label':
u"\uf03c",
'md-label-outline':
u"\uf03d",
'md-language':
u"\uf03e",
'md-launch':
u"\uf03f",
'md-list':
u"\uf040",
'md-lock':
u"\uf041",
'md-lock-open':
u"\uf042",
'md-lock-outline':
u"\uf043",
'md-loyalty':
u"\uf044",
'md-markunread-mailbox':
u"\uf045",
'md-note-add':
u"\uf046",
'md-open-in-browser':
u"\uf047",
'md-open-in-new':
u"\uf048",
'md-open-with':
u"\uf049",
'md-pageview':
u"\uf04a",
'md-payment':
u"\uf04b",
'md-perm-camera-mic':
u"\uf04c",
'md-perm-contact-cal':
u"\uf04d",
'md-perm-data-setting':
u"\uf04e",
'md-perm-device-info':
u"\uf04f",
'md-perm-identity':
u"\uf050",
'md-perm-media':
u"\uf051",
'md-perm-phone-msg':
u"\uf052",
'md-perm-scan-wifi':
u"\uf053",
'md-picture-in-picture':
u"\uf054",
'md-polymer':
u"\uf055",
'md-print':
u"\uf056",
'md-query-builder':
u"\uf057",
'md-question-answer':
u"\uf058",
'md-receipt':
u"\uf059",
'md-redeem':
u"\uf05a",
'md-report-problem':
u"\uf05b",
'md-restore':
u"\uf05c",
'md-room':
u"\uf05d",
'md-schedule':
u"\uf05e",
'md-search':
u"\uf05f",
'md-settings':
u"\uf060",
'md-settings-applications':
u"\uf061",
'md-settings-backup-restore':
u"\uf062",
'md-settings-bluetooth':
u"\uf063",
'md-settings-cell':
u"\uf064",
'md-settings-display':
u"\uf065",
'md-settings-ethernet':
u"\uf066",
'md-settings-input-antenna':
u"\uf067",
'md-settings-input-component':
u"\uf068",
'md-settings-input-composite':
u"\uf069",
'md-settings-input-hdmi':
u"\uf06a",
'md-settings-input-svideo':
u"\uf06b",
'md-settings-overscan':
u"\uf06c",
'md-settings-phone':
u"\uf06d",
'md-settings-power':
u"\uf06e",
'md-settings-remote':
u"\uf06f",
'md-settings-voice':
u"\uf070",
'md-shop':
u"\uf071",
'md-shopping-basket':
u"\uf072",
'md-shopping-cart':
u"\uf073",
'md-shop-two':
u"\uf074",
'md-speaker-notes':
u"\uf075",
'md-spellcheck':
u"\uf076",
'md-star-rate':
u"\uf077",
'md-stars':
u"\uf078",
'md-store':
u"\uf079",
'md-subject':
u"\uf07a",
'md-swap-horiz':
u"\uf07b",
'md-swap-vert':
u"\uf07c",
'md-swap-vert-circle':
u"\uf07d",
'md-system-update-tv':
u"\uf07e",
'md-tab':
u"\uf07f",
'md-tab-unselected':
u"\uf080",
'md-theaters':
u"\uf081",
'md-thumb-down':
u"\uf082",
'md-thumbs-up-down':
u"\uf083",
'md-thumb-up':
u"\uf084",
'md-toc':
u"\uf085",
'md-today':
u"\uf086",
'md-track-changes':
u"\uf087",
'md-translate':
u"\uf088",
'md-trending-down':
u"\uf089",
'md-trending-neutral':
u"\uf08a",
'md-trending-up':
u"\uf08b",
'md-turned-in':
u"\uf08c",
'md-turned-in-not':
u"\uf08d",
'md-verified-user':
u"\uf08e",
'md-view-agenda':
u"\uf08f",
'md-view-array':
u"\uf090",
'md-view-carousel':
u"\uf091",
'md-view-column':
u"\uf092",
'md-view-day':
u"\uf093",
'md-view-headline':
u"\uf094",
'md-view-list':
u"\uf095",
'md-view-module':
u"\uf096",
'md-view-quilt':
u"\uf097",
'md-view-stream':
u"\uf098",
'md-view-week':
u"\uf099",
'md-visibility':
u"\uf09a",
'md-visibility-off':
u"\uf09b",
'md-wallet-giftcard':
u"\uf09c",
'md-wallet-membership':
u"\uf09d",
'md-wallet-travel':
u"\uf09e",
'md-work':
u"\uf09f",
'md-error':
u"\uf0a0",
'md-warning':
u"\uf0a1",
'md-album':
u"\uf0a2",
'md-av-timer':
u"\uf0a3",
'md-closed-caption':
u"\uf0a4",
'md-equalizer':
u"\uf0a5",
'md-explicit':
u"\uf0a6",
'md-fast-forward':
u"\uf0a7",
'md-fast-rewind':
u"\uf0a8",
'md-games':
u"\uf0a9",
'md-hearing':
u"\uf0aa",
'md-high-quality':
u"\uf0ab",
'md-loop':
u"\uf0ac",
'md-mic':
u"\uf0ad",
'md-mic-none':
u"\uf0ae",
'md-mic-off':
u"\uf0af",
'md-movie':
u"\uf0b0",
'md-my-library-add':
u"\uf0b1",
'md-my-library-books':
u"\uf0b2",
'md-my-library-music':
u"\uf0b3",
'md-new-releases':
u"\uf0b4",
'md-not-interested':
u"\uf0b5",
'md-pause':
u"\uf0b6",
'md-pause-circle-fill':
u"\uf0b7",
'md-pause-circle-outline':
u"\uf0b8",
'md-play-arrow':
u"\uf0b9",
'md-play-circle-fill':
u"\uf0ba",
'md-play-circle-outline':
u"\uf0bb",
'md-playlist-add':
u"\uf0bc",
'md-play-shopping-bag':
u"\uf0bd",
'md-queue':
u"\uf0be",
'md-queue-music':
u"\uf0bf",
'md-radio':
u"\uf0c0",
'md-recent-actors':
u"\uf0c1",
'md-repeat':
u"\uf0c2",
'md-repeat-one':
u"\uf0c3",
'md-replay':
u"\uf0c4",
'md-shuffle':
u"\uf0c5",
'md-skip-next':
u"\uf0c6",
'md-skip-previous':
u"\uf0c7",
'md-snooze':
u"\uf0c8",
'md-stop':
u"\uf0c9",
'md-subtitles':
u"\uf0ca",
'md-surround-sound':
u"\uf0cb",
'md-videocam':
u"\uf0cc",
'md-videocam-off':
u"\uf0cd",
'md-video-collection':
u"\uf0ce",
'md-volume-down':
u"\uf0cf",
'md-volume-mute':
u"\uf0d0",
'md-volume-off':
u"\uf0d1",
'md-volume-up':
u"\uf0d2",
'md-web':
u"\uf0d3",
'md-business':
u"\uf0d4",
'md-call':
u"\uf0d5",
'md-call-end':
u"\uf0d6",
'md-call-made':
u"\uf0d7",
'md-call-merge':
u"\uf0d8",
'md-call-missed':
u"\uf0d9",
'md-call-received':
u"\uf0da",
'md-call-split':
u"\uf0db",
'md-chat':
u"\uf0dc",
'md-clear-all':
u"\uf0dd",
'md-comment':
u"\uf0de",
'md-contacts':
u"\uf0df",
'md-dialer-sip':
u"\uf0e0",
'md-dialpad':
u"\uf0e1",
'md-dnd-on':
u"\uf0e2",
'md-email':
u"\uf0e3",
'md-forum':
u"\uf0e4",
'md-import-export':
u"\uf0e5",
'md-invert-colors-off':
u"\uf0e6",
'md-invert-colors-on':
u"\uf0e7",
'md-live-help':
u"\uf0e8",
'md-location-off':
u"\uf0e9",
'md-location-on':
u"\uf0ea",
'md-message':
u"\uf0eb",
'md-messenger':
u"\uf0ec",
'md-no-sim':
u"\uf0ed",
'md-phone':
u"\uf0ee",
'md-portable-wifi-off':
u"\uf0ef",
'md-quick-contacts-dialer':
u"\uf0f0",
'md-quick-contacts-mail':
u"\uf0f1",
'md-ring-volume':
u"\uf0f2",
'md-stay-current-landscape':
u"\uf0f3",
'md-stay-current-portrait':
u"\uf0f4",
'md-stay-primary-landscape':
u"\uf0f5",
'md-stay-primary-portrait':
u"\uf0f6",
'md-swap-calls':
u"\uf0f7",
'md-textsms':
u"\uf0f8",
'md-voicemail':
u"\uf0f9",
'md-vpn-key':
u"\uf0fa",
'md-add':
u"\uf0fb",
'md-add-box':
u"\uf0fc",
'md-add-circle':
u"\uf0fd",
'md-add-circle-outline':
u"\uf0fe",
'md-archive':
u"\uf0ff",
'md-backspace':
u"\uf100",
'md-block':
u"\uf101",
'md-clear':
u"\uf102",
'md-content-copy':
u"\uf103",
'md-content-cut':
u"\uf104",
'md-content-paste':
u"\uf105",
'md-create':
u"\uf106",
'md-drafts':
u"\uf107",
'md-filter-list':
u"\uf108",
'md-flag':
u"\uf109",
'md-forward':
u"\uf10a",
'md-gesture':
u"\uf10b",
'md-inbox':
u"\uf10c",
'md-link':
u"\uf10d",
'md-mail':
u"\uf10e",
'md-markunread':
u"\uf10f",
'md-redo':
u"\uf110",
'md-remove':
u"\uf111",
'md-remove-circle':
u"\uf112",
'md-remove-circle-outline':
u"\uf113",
'md-reply':
u"\uf114",
'md-reply-all':
u"\uf115",
'md-report':
u"\uf116",
'md-save':
u"\uf117",
'md-select-all':
u"\uf118",
'md-send':
u"\uf119",
'md-sort':
u"\uf11a",
'md-text-format':
u"\uf11b",
'md-undo':
u"\uf11c",
'md-access-alarm':
u"\uf11d",
'md-access-alarms':
u"\uf11e",
'md-access-time':
u"\uf11f",
'md-add-alarm':
u"\uf120",
'md-airplanemode-off':
u"\uf121",
'md-airplanemode-on':
u"\uf122",
'md-battery-20':
u"\uf123",
'md-battery-30':
u"\uf124",
'md-battery-50':
u"\uf125",
'md-battery-60':
u"\uf126",
'md-battery-80':
u"\uf127",
'md-battery-90':
u"\uf128",
'md-battery-alert':
u"\uf129",
'md-battery-charging-20':
u"\uf12a",
'md-battery-charging-30':
u"\uf12b",
'md-battery-charging-50':
u"\uf12c",
'md-battery-charging-60':
u"\uf12d",
'md-battery-charging-80':
u"\uf12e",
'md-battery-charging-90':
u"\uf12f",
'md-battery-charging-full':
u"\uf130",
'md-battery-full':
u"\uf131",
'md-battery-std':
u"\uf132",
'md-battery-unknown':
u"\uf133",
'md-bluetooth':
u"\uf134",
'md-bluetooth-connected':
u"\uf135",
'md-bluetooth-disabled':
u"\uf136",
'md-bluetooth-searching':
u"\uf137",
'md-brightness-auto':
u"\uf138",
'md-brightness-high':
u"\uf139",
'md-brightness-low':
u"\uf13a",
'md-brightness-medium':
u"\uf13b",
'md-data-usage':
u"\uf13c",
'md-developer-mode':
u"\uf13d",
'md-devices':
u"\uf13e",
'md-dvr':
u"\uf13f",
'md-gps-fixed':
u"\uf140",
'md-gps-not-fixed':
u"\uf141",
'md-gps-off':
u"\uf142",
'md-location-disabled':
u"\uf143",
'md-location-searching':
u"\uf144",
'md-multitrack-audio':
u"\uf145",
'md-network-cell':
u"\uf146",
'md-network-wifi':
u"\uf147",
'md-nfc':
u"\uf148",
'md-now-wallpaper':
u"\uf149",
'md-now-widgets':
u"\uf14a",
'md-screen-lock-landscape':
u"\uf14b",
'md-screen-lock-portrait':
u"\uf14c",
'md-screen-lock-rotation':
u"\uf14d",
'md-screen-rotation':
u"\uf14e",
'md-sd-storage':
u"\uf14f",
'md-settings-system-daydream':
u"\uf150",
'md-signal-cellular-0-bar':
u"\uf151",
'md-signal-cellular-1-bar':
u"\uf152",
'md-signal-cellular-2-bar':
u"\uf153",
'md-signal-cellular-3-bar':
u"\uf154",
'md-signal-cellular-4-bar':
u"\uf155",
'md-signal-cellular-connected-no-internet-0-bar':
u"\uf156",
'md-signal-cellular-connected-no-internet-1-bar':
u"\uf157",
'md-signal-cellular-connected-no-internet-2-bar':
u"\uf158",
'md-signal-cellular-connected-no-internet-3-bar':
u"\uf159",
'md-signal-cellular-connected-no-internet-4-bar':
u"\uf15a",
'md-signal-cellular-no-sim':
u"\uf15b",
'md-signal-cellular-null':
u"\uf15c",
'md-signal-cellular-off':
u"\uf15d",
'md-signal-wifi-0-bar':
u"\uf15e",
'md-signal-wifi-1-bar':
u"\uf15f",
'md-signal-wifi-2-bar':
u"\uf160",
'md-signal-wifi-3-bar':
u"\uf161",
'md-signal-wifi-4-bar':
u"\uf162",
'md-signal-wifi-off':
u"\uf163",
'md-storage':
u"\uf164",
'md-usb':
u"\uf165",
'md-wifi-lock':
u"\uf166",
'md-wifi-tethering':
u"\uf167",
'md-attach-file':
u"\uf168",
'md-attach-money':
u"\uf169",
'md-border-all':
u"\uf16a",
'md-border-bottom':
u"\uf16b",
'md-border-clear':
u"\uf16c",
'md-border-color':
u"\uf16d",
'md-border-horizontal':
u"\uf16e",
'md-border-inner':
u"\uf16f",
'md-border-left':
u"\uf170",
'md-border-outer':
u"\uf171",
'md-border-right':
u"\uf172",
'md-border-style':
u"\uf173",
'md-border-top':
u"\uf174",
'md-border-vertical':
u"\uf175",
'md-format-align-center':
u"\uf176",
'md-format-align-justify':
u"\uf177",
'md-format-align-left':
u"\uf178",
'md-format-align-right':
u"\uf179",
'md-format-bold':
u"\uf17a",
'md-format-clear':
u"\uf17b",
'md-format-color-fill':
u"\uf17c",
'md-format-color-reset':
u"\uf17d",
'md-format-color-text':
u"\uf17e",
'md-format-indent-decrease':
u"\uf17f",
'md-format-indent-increase':
u"\uf180",
'md-format-italic':
u"\uf181",
'md-format-line-spacing':
u"\uf182",
'md-format-list-bulleted':
u"\uf183",
'md-format-list-numbered':
u"\uf184",
'md-format-paint':
u"\uf185",
'md-format-quote':
u"\uf186",
'md-format-size':
u"\uf187",
'md-format-strikethrough':
u"\uf188",
'md-format-textdirection-l-to-r':
u"\uf189",
'md-format-textdirection-r-to-l':
u"\uf18a",
'md-format-underline':
u"\uf18b",
'md-functions':
u"\uf18c",
'md-insert-chart':
u"\uf18d",
'md-insert-comment':
u"\uf18e",
'md-insert-drive-file':
u"\uf18f",
'md-insert-emoticon':
u"\uf190",
'md-insert-invitation':
u"\uf191",
'md-insert-link':
u"\uf192",
'md-insert-photo':
u"\uf193",
'md-merge-type':
u"\uf194",
'md-mode-comment':
u"\uf195",
'md-mode-edit':
u"\uf196",
'md-publish':
u"\uf197",
'md-vertical-align-bottom':
u"\uf198",
'md-vertical-align-center':
u"\uf199",
'md-vertical-align-top':
u"\uf19a",
'md-wrap-text':
u"\uf19b",
'md-attachment':
u"\uf19c",
'md-cloud':
u"\uf19d",
'md-cloud-circle':
u"\uf19e",
'md-cloud-done':
u"\uf19f",
'md-cloud-download':
u"\uf1a0",
'md-cloud-off':
u"\uf1a1",
'md-cloud-queue':
u"\uf1a2",
'md-cloud-upload':
u"\uf1a3",
'md-file-download':
u"\uf1a4",
'md-file-upload':
u"\uf1a5",
'md-folder':
u"\uf1a6",
'md-folder-open':
u"\uf1a7",
'md-folder-shared':
u"\uf1a8",
'md-cast':
u"\uf1a9",
'md-cast-connected':
u"\uf1aa",
'md-computer':
u"\uf1ab",
'md-desktop-mac':
u"\uf1ac",
'md-desktop-windows':
u"\uf1ad",
'md-dock':
u"\uf1ae",
'md-gamepad':
u"\uf1af",
'md-headset':
u"\uf1b0",
'md-headset-mic':
u"\uf1b1",
'md-keyboard':
u"\uf1b2",
'md-keyboard-alt':
u"\uf1b3",
'md-keyboard-arrow-down':
u"\uf1b4",
'md-keyboard-arrow-left':
u"\uf1b5",
'md-keyboard-arrow-right':
u"\uf1b6",
'md-keyboard-arrow-up':
u"\uf1b7",
'md-keyboard-backspace':
u"\uf1b8",
'md-keyboard-capslock':
u"\uf1b9",
'md-keyboard-control':
u"\uf1ba",
'md-keyboard-hide':
u"\uf1bb",
'md-keyboard-return':
u"\uf1bc",
'md-keyboard-tab':
u"\uf1bd",
'md-keyboard-voice':
u"\uf1be",
'md-laptop':
u"\uf1bf",
'md-laptop-chromebook':
u"\uf1c0",
'md-laptop-mac':
u"\uf1c1",
'md-laptop-windows':
u"\uf1c2",
'md-memory':
u"\uf1c3",
'md-mouse':
u"\uf1c4",
'md-phone-android':
u"\uf1c5",
'md-phone-iphone':
u"\uf1c6",
'md-phonelink':
u"\uf1c7",
'md-phonelink-off':
u"\uf1c8",
'md-security':
u"\uf1c9",
'md-sim-card':
u"\uf1ca",
'md-smartphone':
u"\uf1cb",
'md-speaker':
u"\uf1cc",
'md-tablet':
u"\uf1cd",
'md-tablet-android':
u"\uf1ce",
'md-tablet-mac':
u"\uf1cf",
'md-tv':
u"\uf1d0",
'md-watch':
u"\uf1d1",
'md-add-to-photos':
u"\uf1d2",
'md-adjust':
u"\uf1d3",
'md-assistant-photo':
u"\uf1d4",
'md-audiotrack':
u"\uf1d5",
'md-blur-circular':
u"\uf1d6",
'md-blur-linear':
u"\uf1d7",
'md-blur-off':
u"\uf1d8",
'md-blur-on':
u"\uf1d9",
'md-brightness-1':
u"\uf1da",
'md-brightness-2':
u"\uf1db",
'md-brightness-3':
u"\uf1dc",
'md-brightness-4':
u"\uf1dd",
'md-brightness-5':
u"\uf1de",
'md-brightness-6':
u"\uf1df",
'md-brightness-7':
u"\uf1e0",
'md-brush':
u"\uf1e1",
'md-camera':
u"\uf1e2",
'md-camera-alt':
u"\uf1e3",
'md-camera-front':
u"\uf1e4",
'md-camera-rear':
u"\uf1e5",
'md-camera-roll':
u"\uf1e6",
'md-center-focus-strong':
u"\uf1e7",
'md-center-focus-weak':
u"\uf1e8",
'md-collections':
u"\uf1e9",
'md-colorize':
u"\uf1ea",
'md-color-lens':
u"\uf1eb",
'md-compare':
u"\uf1ec",
'md-control-point':
u"\uf1ed",
'md-control-point-duplicate':
u"\uf1ee",
'md-crop':
u"\uf1ef",
'md-crop-3-2':
u"\uf1f0",
'md-crop-5-4':
u"\uf1f1",
'md-crop-7-5':
u"\uf1f2",
'md-crop-16-9':
u"\uf1f3",
'md-crop-din':
u"\uf1f4",
'md-crop-free':
u"\uf1f5",
'md-crop-landscape':
u"\uf1f6",
'md-crop-original':
u"\uf1f7",
'md-crop-portrait':
u"\uf1f8",
'md-crop-square':
u"\uf1f9",
'md-dehaze':
u"\uf1fa",
'md-details':
u"\uf1fb",
'md-edit':
u"\uf1fc",
'md-exposure':
u"\uf1fd",
'md-exposure-minus-1':
u"\uf1fe",
'md-exposure-minus-2':
u"\uf1ff",
'md-exposure-zero':
u"\uf200",
'md-exposure-plus-1':
u"\uf201",
'md-exposure-plus-2':
u"\uf202",
'md-filter':
u"\uf203",
'md-filter-1':
u"\uf204",
'md-filter-2':
u"\uf205",
'md-filter-3':
u"\uf206",
'md-filter-4':
u"\uf207",
'md-filter-5':
u"\uf208",
'md-filter-6':
u"\uf209",
'md-filter-7':
u"\uf20a",
'md-filter-8':
u"\uf20b",
'md-filter-9':
u"\uf20c",
'md-filter-9-plus':
u"\uf20d",
'md-filter-b-and-w':
u"\uf20e",
'md-filter-center-focus':
u"\uf20f",
'md-filter-drama':
u"\uf210",
'md-filter-frames':
u"\uf211",
'md-filter-hdr':
u"\uf212",
'md-filter-none':
u"\uf213",
'md-filter-tilt-shift':
u"\uf214",
'md-filter-vintage':
u"\uf215",
'md-flare':
u"\uf216",
'md-flash-auto':
u"\uf217",
'md-flash-off':
u"\uf218",
'md-flash-on':
u"\uf219",
'md-flip':
u"\uf21a",
'md-gradient':
u"\uf21b",
'md-grain':
u"\uf21c",
'md-grid-off':
u"\uf21d",
'md-grid-on':
u"\uf21e",
'md-hdr-off':
u"\uf21f",
'md-hdr-on':
u"\uf220",
'md-hdr-strong':
u"\uf221",
'md-hdr-weak':
u"\uf222",
'md-healing':
u"\uf223",
'md-image':
u"\uf224",
'md-image-aspect-ratio':
u"\uf225",
'md-iso':
u"\uf226",
'md-landscape':
u"\uf227",
'md-leak-add':
u"\uf228",
'md-leak-remove':
u"\uf229",
'md-lens':
u"\uf22a",
'md-looks':
u"\uf22b",
'md-looks-1':
u"\uf22c",
'md-looks-2':
u"\uf22d",
'md-looks-3':
u"\uf22e",
'md-looks-4':
u"\uf22f",
'md-looks-5':
u"\uf230",
'md-looks-6':
u"\uf231",
'md-loupe':
u"\uf232",
'md-movie-creation':
u"\uf233",
'md-nature':
u"\uf234",
'md-nature-people':
u"\uf235",
'md-navigate-before':
u"\uf236",
'md-navigate-next':
u"\uf237",
'md-palette':
u"\uf238",
'md-panorama':
u"\uf239",
'md-panorama-fisheye':
u"\uf23a",
'md-panorama-horizontal':
u"\uf23b",
'md-panorama-vertical':
u"\uf23c",
'md-panorama-wide-angle':
u"\uf23d",
'md-photo':
u"\uf23e",
'md-photo-album':
u"\uf23f",
'md-photo-camera':
u"\uf240",
'md-photo-library':
u"\uf241",
'md-portrait':
u"\uf242",
'md-remove-red-eye':
u"\uf243",
'md-rotate-left':
u"\uf244",
'md-rotate-right':
u"\uf245",
'md-slideshow':
u"\uf246",
'md-straighten':
u"\uf247",
'md-style':
u"\uf248",
'md-switch-camera':
u"\uf249",
'md-switch-video':
u"\uf24a",
'md-tag-faces':
u"\uf24b",
'md-texture':
u"\uf24c",
'md-timelapse':
u"\uf24d",
'md-timer':
u"\uf24e",
'md-timer-3':
u"\uf24f",
'md-timer-10':
u"\uf250",
'md-timer-auto':
u"\uf251",
'md-timer-off':
u"\uf252",
'md-tonality':
u"\uf253",
'md-transform':
u"\uf254",
'md-tune':
u"\uf255",
'md-wb-auto':
u"\uf256",
'md-wb-cloudy':
u"\uf257",
'md-wb-incandescent':
u"\uf258",
'md-wb-irradescent':
u"\uf259",
'md-wb-sunny':
u"\uf25a",
'md-beenhere':
u"\uf25b",
'md-directions':
u"\uf25c",
'md-directions-bike':
u"\uf25d",
'md-directions-bus':
u"\uf25e",
'md-directions-car':
u"\uf25f",
'md-directions-ferry':
u"\uf260",
'md-directions-subway':
u"\uf261",
'md-directions-train':
u"\uf262",
'md-directions-transit':
u"\uf263",
'md-directions-walk':
u"\uf264",
'md-flight':
u"\uf265",
'md-hotel':
u"\uf266",
'md-layers':
u"\uf267",
'md-layers-clear':
u"\uf268",
'md-local-airport':
u"\uf269",
'md-local-atm':
u"\uf26a",
'md-local-attraction':
u"\uf26b",
'md-local-bar':
u"\uf26c",
'md-local-cafe':
u"\uf26d",
'md-local-car-wash':
u"\uf26e",
'md-local-convenience-store':
u"\uf26f",
'md-local-drink':
u"\uf270",
'md-local-florist':
u"\uf271",
'md-local-gas-station':
u"\uf272",
'md-local-grocery-store':
u"\uf273",
'md-local-hospital':
u"\uf274",
'md-local-hotel':
u"\uf275",
'md-local-laundry-service':
u"\uf276",
'md-local-library':
u"\uf277",
'md-local-mall':
u"\uf278",
'md-local-movies':
u"\uf279",
'md-local-offer':
u"\uf27a",
'md-local-parking':
u"\uf27b",
'md-local-pharmacy':
u"\uf27c",
'md-local-phone':
u"\uf27d",
'md-local-pizza':
u"\uf27e",
'md-local-play':
u"\uf27f",
'md-local-post-office':
u"\uf280",
'md-local-print-shop':
u"\uf281",
'md-local-restaurant':
u"\uf282",
'md-local-see':
u"\uf283",
'md-local-shipping':
u"\uf284",
'md-local-taxi':
u"\uf285",
'md-location-history':
u"\uf286",
'md-map':
u"\uf287",
'md-my-location':
u"\uf288",
'md-navigation':
u"\uf289",
'md-pin-drop':
u"\uf28a",
'md-place':
u"\uf28b",
'md-rate-review':
u"\uf28c",
'md-restaurant-menu':
u"\uf28d",
'md-satellite':
u"\uf28e",
'md-store-mall-directory':
u"\uf28f",
'md-terrain':
u"\uf290",
'md-traffic':
u"\uf291",
'md-apps':
u"\uf292",
'md-cancel':
u"\uf293",
'md-arrow-drop-down-circle':
u"\uf294",
'md-arrow-drop-down':
u"\uf295",
'md-arrow-drop-up':
u"\uf296",
'md-arrow-back':
u"\uf297",
'md-arrow-forward':
u"\uf298",
'md-check':
u"\uf299",
'md-close':
u"\uf29a",
'md-chevron-left':
u"\uf29b",
'md-chevron-right':
u"\uf29c",
'md-expand-less':
u"\uf29d",
'md-expand-more':
u"\uf29e",
'md-fullscreen':
u"\uf29f",
'md-fullscreen-exit':
u"\uf2a0",
'md-menu':
u"\uf2a1",
'md-more-horiz':
u"\uf2a2",
'md-more-vert':
u"\uf2a3",
'md-refresh':
u"\uf2a4",
'md-unfold-less':
u"\uf2a5",
'md-unfold-more':
u"\uf2a6",
'md-adb':
u"\uf2a7",
'md-bluetooth-audio':
u"\uf2a8",
'md-disc-full':
u"\uf2a9",
'md-dnd-forwardslash':
u"\uf2aa",
'md-do-not-disturb':
u"\uf2ab",
'md-drive-eta':
u"\uf2ac",
'md-event-available':
u"\uf2ad",
'md-event-busy':
u"\uf2ae",
'md-event-note':
u"\uf2af",
'md-folder-special':
u"\uf2b0",
'md-mms':
u"\uf2b1",
'md-more':
u"\uf2b2",
'md-network-locked':
u"\uf2b3",
'md-phone-bluetooth-speaker':
u"\uf2b4",
'md-phone-forwarded':
u"\uf2b5",
'md-phone-in-talk':
u"\uf2b6",
'md-phone-locked':
u"\uf2b7",
'md-phone-missed':
u"\uf2b8",
'md-phone-paused':
u"\uf2b9",
'md-play-download':
u"\uf2ba",
'md-play-install':
u"\uf2bb",
'md-sd-card':
u"\uf2bc",
'md-sim-card-alert':
u"\uf2bd",
'md-sms':
u"\uf2be",
'md-sms-failed':
u"\uf2bf",
'md-sync':
u"\uf2c0",
'md-sync-disabled':
u"\uf2c1",
'md-sync-problem':
u"\uf2c2",
'md-system-update':
u"\uf2c3",
'md-tap-and-play':
u"\uf2c4",
'md-time-to-leave':
u"\uf2c5",
'md-vibration':
u"\uf2c6",
'md-voice-chat':
u"\uf2c7",
'md-vpn-lock':
u"\uf2c8",
'md-cake':
u"\uf2c9",
'md-domain':
u"\uf2ca",
'md-location-city':
u"\uf2cb",
'md-mood':
u"\uf2cc",
'md-notifications-none':
u"\uf2cd",
'md-notifications':
u"\uf2ce",
'md-notifications-off':
u"\uf2cf",
'md-notifications-on':
u"\uf2d0",
'md-notifications-paused':
u"\uf2d1",
'md-pages':
u"\uf2d2",
'md-party-mode':
u"\uf2d3",
'md-group':
u"\uf2d4",
'md-group-add':
u"\uf2d5",
'md-people':
u"\uf2d6",
'md-people-outline':
u"\uf2d7",
'md-person':
u"\uf2d8",
'md-person-add':
u"\uf2d9",
'md-person-outline':
u"\uf2da",
'md-plus-one':
u"\uf2db",
'md-poll':
u"\uf2dc",
'md-public':
u"\uf2dd",
'md-school':
u"\uf2de",
'md-share':
u"\uf2df",
'md-whatshot':
u"\uf2e0",
'md-check-box':
u"\uf2e1",
'md-check-box-outline-blank':
u"\uf2e2",
'md-radio-button-off':
u"\uf2e3",
'md-radio-button-on':
u"\uf2e4",
'md-star':
u"\uf2e5",
'md-star-half':
u"\uf2e6",
'md-star-outline':
u"\uf2e7",
}
|
md_icons = {'md-3d-rotation': u'\uf000', 'md-accessibility': u'\uf001', 'md-account-balance': u'\uf002', 'md-account-balance-wallet': u'\uf003', 'md-account-box': u'\uf004', 'md-account-child': u'\uf005', 'md-account-circle': u'\uf006', 'md-add-shopping-cart': u'\uf007', 'md-alarm': u'\uf008', 'md-alarm-add': u'\uf009', 'md-alarm-off': u'\uf00a', 'md-alarm-on': u'\uf00b', 'md-android': u'\uf00c', 'md-announcement': u'\uf00d', 'md-aspect-ratio': u'\uf00e', 'md-assessment': u'\uf00f', 'md-assignment': u'\uf010', 'md-assignment-ind': u'\uf011', 'md-assignment-late': u'\uf012', 'md-assignment-return': u'\uf013', 'md-assignment-returned': u'\uf014', 'md-assignment-turned-in': u'\uf015', 'md-autorenew': u'\uf016', 'md-backup': u'\uf017', 'md-book': u'\uf018', 'md-bookmark': u'\uf019', 'md-bookmark-outline': u'\uf01a', 'md-bug-report': u'\uf01b', 'md-cached': u'\uf01c', 'md-class': u'\uf01d', 'md-credit-card': u'\uf01e', 'md-dashboard': u'\uf01f', 'md-delete': u'\uf020', 'md-description': u'\uf021', 'md-dns': u'\uf022', 'md-done': u'\uf023', 'md-done-all': u'\uf024', 'md-event': u'\uf025', 'md-exit-to-app': u'\uf026', 'md-explore': u'\uf027', 'md-extension': u'\uf028', 'md-face-unlock': u'\uf029', 'md-favorite': u'\uf02a', 'md-favorite-outline': u'\uf02b', 'md-find-in-page': u'\uf02c', 'md-find-replace': u'\uf02d', 'md-flip-to-back': u'\uf02e', 'md-flip-to-front': u'\uf02f', 'md-get-app': u'\uf030', 'md-grade': u'\uf031', 'md-group-work': u'\uf032', 'md-help': u'\uf033', 'md-highlight-remove': u'\uf034', 'md-history': u'\uf035', 'md-home': u'\uf036', 'md-https': u'\uf037', 'md-info': u'\uf038', 'md-info-outline': u'\uf039', 'md-input': u'\uf03a', 'md-invert-colors': u'\uf03b', 'md-label': u'\uf03c', 'md-label-outline': u'\uf03d', 'md-language': u'\uf03e', 'md-launch': u'\uf03f', 'md-list': u'\uf040', 'md-lock': u'\uf041', 'md-lock-open': u'\uf042', 'md-lock-outline': u'\uf043', 'md-loyalty': u'\uf044', 'md-markunread-mailbox': u'\uf045', 'md-note-add': u'\uf046', 'md-open-in-browser': u'\uf047', 'md-open-in-new': u'\uf048', 'md-open-with': u'\uf049', 'md-pageview': u'\uf04a', 'md-payment': u'\uf04b', 'md-perm-camera-mic': u'\uf04c', 'md-perm-contact-cal': u'\uf04d', 'md-perm-data-setting': u'\uf04e', 'md-perm-device-info': u'\uf04f', 'md-perm-identity': u'\uf050', 'md-perm-media': u'\uf051', 'md-perm-phone-msg': u'\uf052', 'md-perm-scan-wifi': u'\uf053', 'md-picture-in-picture': u'\uf054', 'md-polymer': u'\uf055', 'md-print': u'\uf056', 'md-query-builder': u'\uf057', 'md-question-answer': u'\uf058', 'md-receipt': u'\uf059', 'md-redeem': u'\uf05a', 'md-report-problem': u'\uf05b', 'md-restore': u'\uf05c', 'md-room': u'\uf05d', 'md-schedule': u'\uf05e', 'md-search': u'\uf05f', 'md-settings': u'\uf060', 'md-settings-applications': u'\uf061', 'md-settings-backup-restore': u'\uf062', 'md-settings-bluetooth': u'\uf063', 'md-settings-cell': u'\uf064', 'md-settings-display': u'\uf065', 'md-settings-ethernet': u'\uf066', 'md-settings-input-antenna': u'\uf067', 'md-settings-input-component': u'\uf068', 'md-settings-input-composite': u'\uf069', 'md-settings-input-hdmi': u'\uf06a', 'md-settings-input-svideo': u'\uf06b', 'md-settings-overscan': u'\uf06c', 'md-settings-phone': u'\uf06d', 'md-settings-power': u'\uf06e', 'md-settings-remote': u'\uf06f', 'md-settings-voice': u'\uf070', 'md-shop': u'\uf071', 'md-shopping-basket': u'\uf072', 'md-shopping-cart': u'\uf073', 'md-shop-two': u'\uf074', 'md-speaker-notes': u'\uf075', 'md-spellcheck': u'\uf076', 'md-star-rate': u'\uf077', 'md-stars': u'\uf078', 'md-store': u'\uf079', 'md-subject': u'\uf07a', 'md-swap-horiz': u'\uf07b', 'md-swap-vert': u'\uf07c', 'md-swap-vert-circle': u'\uf07d', 'md-system-update-tv': u'\uf07e', 'md-tab': u'\uf07f', 'md-tab-unselected': u'\uf080', 'md-theaters': u'\uf081', 'md-thumb-down': u'\uf082', 'md-thumbs-up-down': u'\uf083', 'md-thumb-up': u'\uf084', 'md-toc': u'\uf085', 'md-today': u'\uf086', 'md-track-changes': u'\uf087', 'md-translate': u'\uf088', 'md-trending-down': u'\uf089', 'md-trending-neutral': u'\uf08a', 'md-trending-up': u'\uf08b', 'md-turned-in': u'\uf08c', 'md-turned-in-not': u'\uf08d', 'md-verified-user': u'\uf08e', 'md-view-agenda': u'\uf08f', 'md-view-array': u'\uf090', 'md-view-carousel': u'\uf091', 'md-view-column': u'\uf092', 'md-view-day': u'\uf093', 'md-view-headline': u'\uf094', 'md-view-list': u'\uf095', 'md-view-module': u'\uf096', 'md-view-quilt': u'\uf097', 'md-view-stream': u'\uf098', 'md-view-week': u'\uf099', 'md-visibility': u'\uf09a', 'md-visibility-off': u'\uf09b', 'md-wallet-giftcard': u'\uf09c', 'md-wallet-membership': u'\uf09d', 'md-wallet-travel': u'\uf09e', 'md-work': u'\uf09f', 'md-error': u'\uf0a0', 'md-warning': u'\uf0a1', 'md-album': u'\uf0a2', 'md-av-timer': u'\uf0a3', 'md-closed-caption': u'\uf0a4', 'md-equalizer': u'\uf0a5', 'md-explicit': u'\uf0a6', 'md-fast-forward': u'\uf0a7', 'md-fast-rewind': u'\uf0a8', 'md-games': u'\uf0a9', 'md-hearing': u'\uf0aa', 'md-high-quality': u'\uf0ab', 'md-loop': u'\uf0ac', 'md-mic': u'\uf0ad', 'md-mic-none': u'\uf0ae', 'md-mic-off': u'\uf0af', 'md-movie': u'\uf0b0', 'md-my-library-add': u'\uf0b1', 'md-my-library-books': u'\uf0b2', 'md-my-library-music': u'\uf0b3', 'md-new-releases': u'\uf0b4', 'md-not-interested': u'\uf0b5', 'md-pause': u'\uf0b6', 'md-pause-circle-fill': u'\uf0b7', 'md-pause-circle-outline': u'\uf0b8', 'md-play-arrow': u'\uf0b9', 'md-play-circle-fill': u'\uf0ba', 'md-play-circle-outline': u'\uf0bb', 'md-playlist-add': u'\uf0bc', 'md-play-shopping-bag': u'\uf0bd', 'md-queue': u'\uf0be', 'md-queue-music': u'\uf0bf', 'md-radio': u'\uf0c0', 'md-recent-actors': u'\uf0c1', 'md-repeat': u'\uf0c2', 'md-repeat-one': u'\uf0c3', 'md-replay': u'\uf0c4', 'md-shuffle': u'\uf0c5', 'md-skip-next': u'\uf0c6', 'md-skip-previous': u'\uf0c7', 'md-snooze': u'\uf0c8', 'md-stop': u'\uf0c9', 'md-subtitles': u'\uf0ca', 'md-surround-sound': u'\uf0cb', 'md-videocam': u'\uf0cc', 'md-videocam-off': u'\uf0cd', 'md-video-collection': u'\uf0ce', 'md-volume-down': u'\uf0cf', 'md-volume-mute': u'\uf0d0', 'md-volume-off': u'\uf0d1', 'md-volume-up': u'\uf0d2', 'md-web': u'\uf0d3', 'md-business': u'\uf0d4', 'md-call': u'\uf0d5', 'md-call-end': u'\uf0d6', 'md-call-made': u'\uf0d7', 'md-call-merge': u'\uf0d8', 'md-call-missed': u'\uf0d9', 'md-call-received': u'\uf0da', 'md-call-split': u'\uf0db', 'md-chat': u'\uf0dc', 'md-clear-all': u'\uf0dd', 'md-comment': u'\uf0de', 'md-contacts': u'\uf0df', 'md-dialer-sip': u'\uf0e0', 'md-dialpad': u'\uf0e1', 'md-dnd-on': u'\uf0e2', 'md-email': u'\uf0e3', 'md-forum': u'\uf0e4', 'md-import-export': u'\uf0e5', 'md-invert-colors-off': u'\uf0e6', 'md-invert-colors-on': u'\uf0e7', 'md-live-help': u'\uf0e8', 'md-location-off': u'\uf0e9', 'md-location-on': u'\uf0ea', 'md-message': u'\uf0eb', 'md-messenger': u'\uf0ec', 'md-no-sim': u'\uf0ed', 'md-phone': u'\uf0ee', 'md-portable-wifi-off': u'\uf0ef', 'md-quick-contacts-dialer': u'\uf0f0', 'md-quick-contacts-mail': u'\uf0f1', 'md-ring-volume': u'\uf0f2', 'md-stay-current-landscape': u'\uf0f3', 'md-stay-current-portrait': u'\uf0f4', 'md-stay-primary-landscape': u'\uf0f5', 'md-stay-primary-portrait': u'\uf0f6', 'md-swap-calls': u'\uf0f7', 'md-textsms': u'\uf0f8', 'md-voicemail': u'\uf0f9', 'md-vpn-key': u'\uf0fa', 'md-add': u'\uf0fb', 'md-add-box': u'\uf0fc', 'md-add-circle': u'\uf0fd', 'md-add-circle-outline': u'\uf0fe', 'md-archive': u'\uf0ff', 'md-backspace': u'\uf100', 'md-block': u'\uf101', 'md-clear': u'\uf102', 'md-content-copy': u'\uf103', 'md-content-cut': u'\uf104', 'md-content-paste': u'\uf105', 'md-create': u'\uf106', 'md-drafts': u'\uf107', 'md-filter-list': u'\uf108', 'md-flag': u'\uf109', 'md-forward': u'\uf10a', 'md-gesture': u'\uf10b', 'md-inbox': u'\uf10c', 'md-link': u'\uf10d', 'md-mail': u'\uf10e', 'md-markunread': u'\uf10f', 'md-redo': u'\uf110', 'md-remove': u'\uf111', 'md-remove-circle': u'\uf112', 'md-remove-circle-outline': u'\uf113', 'md-reply': u'\uf114', 'md-reply-all': u'\uf115', 'md-report': u'\uf116', 'md-save': u'\uf117', 'md-select-all': u'\uf118', 'md-send': u'\uf119', 'md-sort': u'\uf11a', 'md-text-format': u'\uf11b', 'md-undo': u'\uf11c', 'md-access-alarm': u'\uf11d', 'md-access-alarms': u'\uf11e', 'md-access-time': u'\uf11f', 'md-add-alarm': u'\uf120', 'md-airplanemode-off': u'\uf121', 'md-airplanemode-on': u'\uf122', 'md-battery-20': u'\uf123', 'md-battery-30': u'\uf124', 'md-battery-50': u'\uf125', 'md-battery-60': u'\uf126', 'md-battery-80': u'\uf127', 'md-battery-90': u'\uf128', 'md-battery-alert': u'\uf129', 'md-battery-charging-20': u'\uf12a', 'md-battery-charging-30': u'\uf12b', 'md-battery-charging-50': u'\uf12c', 'md-battery-charging-60': u'\uf12d', 'md-battery-charging-80': u'\uf12e', 'md-battery-charging-90': u'\uf12f', 'md-battery-charging-full': u'\uf130', 'md-battery-full': u'\uf131', 'md-battery-std': u'\uf132', 'md-battery-unknown': u'\uf133', 'md-bluetooth': u'\uf134', 'md-bluetooth-connected': u'\uf135', 'md-bluetooth-disabled': u'\uf136', 'md-bluetooth-searching': u'\uf137', 'md-brightness-auto': u'\uf138', 'md-brightness-high': u'\uf139', 'md-brightness-low': u'\uf13a', 'md-brightness-medium': u'\uf13b', 'md-data-usage': u'\uf13c', 'md-developer-mode': u'\uf13d', 'md-devices': u'\uf13e', 'md-dvr': u'\uf13f', 'md-gps-fixed': u'\uf140', 'md-gps-not-fixed': u'\uf141', 'md-gps-off': u'\uf142', 'md-location-disabled': u'\uf143', 'md-location-searching': u'\uf144', 'md-multitrack-audio': u'\uf145', 'md-network-cell': u'\uf146', 'md-network-wifi': u'\uf147', 'md-nfc': u'\uf148', 'md-now-wallpaper': u'\uf149', 'md-now-widgets': u'\uf14a', 'md-screen-lock-landscape': u'\uf14b', 'md-screen-lock-portrait': u'\uf14c', 'md-screen-lock-rotation': u'\uf14d', 'md-screen-rotation': u'\uf14e', 'md-sd-storage': u'\uf14f', 'md-settings-system-daydream': u'\uf150', 'md-signal-cellular-0-bar': u'\uf151', 'md-signal-cellular-1-bar': u'\uf152', 'md-signal-cellular-2-bar': u'\uf153', 'md-signal-cellular-3-bar': u'\uf154', 'md-signal-cellular-4-bar': u'\uf155', 'md-signal-cellular-connected-no-internet-0-bar': u'\uf156', 'md-signal-cellular-connected-no-internet-1-bar': u'\uf157', 'md-signal-cellular-connected-no-internet-2-bar': u'\uf158', 'md-signal-cellular-connected-no-internet-3-bar': u'\uf159', 'md-signal-cellular-connected-no-internet-4-bar': u'\uf15a', 'md-signal-cellular-no-sim': u'\uf15b', 'md-signal-cellular-null': u'\uf15c', 'md-signal-cellular-off': u'\uf15d', 'md-signal-wifi-0-bar': u'\uf15e', 'md-signal-wifi-1-bar': u'\uf15f', 'md-signal-wifi-2-bar': u'\uf160', 'md-signal-wifi-3-bar': u'\uf161', 'md-signal-wifi-4-bar': u'\uf162', 'md-signal-wifi-off': u'\uf163', 'md-storage': u'\uf164', 'md-usb': u'\uf165', 'md-wifi-lock': u'\uf166', 'md-wifi-tethering': u'\uf167', 'md-attach-file': u'\uf168', 'md-attach-money': u'\uf169', 'md-border-all': u'\uf16a', 'md-border-bottom': u'\uf16b', 'md-border-clear': u'\uf16c', 'md-border-color': u'\uf16d', 'md-border-horizontal': u'\uf16e', 'md-border-inner': u'\uf16f', 'md-border-left': u'\uf170', 'md-border-outer': u'\uf171', 'md-border-right': u'\uf172', 'md-border-style': u'\uf173', 'md-border-top': u'\uf174', 'md-border-vertical': u'\uf175', 'md-format-align-center': u'\uf176', 'md-format-align-justify': u'\uf177', 'md-format-align-left': u'\uf178', 'md-format-align-right': u'\uf179', 'md-format-bold': u'\uf17a', 'md-format-clear': u'\uf17b', 'md-format-color-fill': u'\uf17c', 'md-format-color-reset': u'\uf17d', 'md-format-color-text': u'\uf17e', 'md-format-indent-decrease': u'\uf17f', 'md-format-indent-increase': u'\uf180', 'md-format-italic': u'\uf181', 'md-format-line-spacing': u'\uf182', 'md-format-list-bulleted': u'\uf183', 'md-format-list-numbered': u'\uf184', 'md-format-paint': u'\uf185', 'md-format-quote': u'\uf186', 'md-format-size': u'\uf187', 'md-format-strikethrough': u'\uf188', 'md-format-textdirection-l-to-r': u'\uf189', 'md-format-textdirection-r-to-l': u'\uf18a', 'md-format-underline': u'\uf18b', 'md-functions': u'\uf18c', 'md-insert-chart': u'\uf18d', 'md-insert-comment': u'\uf18e', 'md-insert-drive-file': u'\uf18f', 'md-insert-emoticon': u'\uf190', 'md-insert-invitation': u'\uf191', 'md-insert-link': u'\uf192', 'md-insert-photo': u'\uf193', 'md-merge-type': u'\uf194', 'md-mode-comment': u'\uf195', 'md-mode-edit': u'\uf196', 'md-publish': u'\uf197', 'md-vertical-align-bottom': u'\uf198', 'md-vertical-align-center': u'\uf199', 'md-vertical-align-top': u'\uf19a', 'md-wrap-text': u'\uf19b', 'md-attachment': u'\uf19c', 'md-cloud': u'\uf19d', 'md-cloud-circle': u'\uf19e', 'md-cloud-done': u'\uf19f', 'md-cloud-download': u'\uf1a0', 'md-cloud-off': u'\uf1a1', 'md-cloud-queue': u'\uf1a2', 'md-cloud-upload': u'\uf1a3', 'md-file-download': u'\uf1a4', 'md-file-upload': u'\uf1a5', 'md-folder': u'\uf1a6', 'md-folder-open': u'\uf1a7', 'md-folder-shared': u'\uf1a8', 'md-cast': u'\uf1a9', 'md-cast-connected': u'\uf1aa', 'md-computer': u'\uf1ab', 'md-desktop-mac': u'\uf1ac', 'md-desktop-windows': u'\uf1ad', 'md-dock': u'\uf1ae', 'md-gamepad': u'\uf1af', 'md-headset': u'\uf1b0', 'md-headset-mic': u'\uf1b1', 'md-keyboard': u'\uf1b2', 'md-keyboard-alt': u'\uf1b3', 'md-keyboard-arrow-down': u'\uf1b4', 'md-keyboard-arrow-left': u'\uf1b5', 'md-keyboard-arrow-right': u'\uf1b6', 'md-keyboard-arrow-up': u'\uf1b7', 'md-keyboard-backspace': u'\uf1b8', 'md-keyboard-capslock': u'\uf1b9', 'md-keyboard-control': u'\uf1ba', 'md-keyboard-hide': u'\uf1bb', 'md-keyboard-return': u'\uf1bc', 'md-keyboard-tab': u'\uf1bd', 'md-keyboard-voice': u'\uf1be', 'md-laptop': u'\uf1bf', 'md-laptop-chromebook': u'\uf1c0', 'md-laptop-mac': u'\uf1c1', 'md-laptop-windows': u'\uf1c2', 'md-memory': u'\uf1c3', 'md-mouse': u'\uf1c4', 'md-phone-android': u'\uf1c5', 'md-phone-iphone': u'\uf1c6', 'md-phonelink': u'\uf1c7', 'md-phonelink-off': u'\uf1c8', 'md-security': u'\uf1c9', 'md-sim-card': u'\uf1ca', 'md-smartphone': u'\uf1cb', 'md-speaker': u'\uf1cc', 'md-tablet': u'\uf1cd', 'md-tablet-android': u'\uf1ce', 'md-tablet-mac': u'\uf1cf', 'md-tv': u'\uf1d0', 'md-watch': u'\uf1d1', 'md-add-to-photos': u'\uf1d2', 'md-adjust': u'\uf1d3', 'md-assistant-photo': u'\uf1d4', 'md-audiotrack': u'\uf1d5', 'md-blur-circular': u'\uf1d6', 'md-blur-linear': u'\uf1d7', 'md-blur-off': u'\uf1d8', 'md-blur-on': u'\uf1d9', 'md-brightness-1': u'\uf1da', 'md-brightness-2': u'\uf1db', 'md-brightness-3': u'\uf1dc', 'md-brightness-4': u'\uf1dd', 'md-brightness-5': u'\uf1de', 'md-brightness-6': u'\uf1df', 'md-brightness-7': u'\uf1e0', 'md-brush': u'\uf1e1', 'md-camera': u'\uf1e2', 'md-camera-alt': u'\uf1e3', 'md-camera-front': u'\uf1e4', 'md-camera-rear': u'\uf1e5', 'md-camera-roll': u'\uf1e6', 'md-center-focus-strong': u'\uf1e7', 'md-center-focus-weak': u'\uf1e8', 'md-collections': u'\uf1e9', 'md-colorize': u'\uf1ea', 'md-color-lens': u'\uf1eb', 'md-compare': u'\uf1ec', 'md-control-point': u'\uf1ed', 'md-control-point-duplicate': u'\uf1ee', 'md-crop': u'\uf1ef', 'md-crop-3-2': u'\uf1f0', 'md-crop-5-4': u'\uf1f1', 'md-crop-7-5': u'\uf1f2', 'md-crop-16-9': u'\uf1f3', 'md-crop-din': u'\uf1f4', 'md-crop-free': u'\uf1f5', 'md-crop-landscape': u'\uf1f6', 'md-crop-original': u'\uf1f7', 'md-crop-portrait': u'\uf1f8', 'md-crop-square': u'\uf1f9', 'md-dehaze': u'\uf1fa', 'md-details': u'\uf1fb', 'md-edit': u'\uf1fc', 'md-exposure': u'\uf1fd', 'md-exposure-minus-1': u'\uf1fe', 'md-exposure-minus-2': u'\uf1ff', 'md-exposure-zero': u'\uf200', 'md-exposure-plus-1': u'\uf201', 'md-exposure-plus-2': u'\uf202', 'md-filter': u'\uf203', 'md-filter-1': u'\uf204', 'md-filter-2': u'\uf205', 'md-filter-3': u'\uf206', 'md-filter-4': u'\uf207', 'md-filter-5': u'\uf208', 'md-filter-6': u'\uf209', 'md-filter-7': u'\uf20a', 'md-filter-8': u'\uf20b', 'md-filter-9': u'\uf20c', 'md-filter-9-plus': u'\uf20d', 'md-filter-b-and-w': u'\uf20e', 'md-filter-center-focus': u'\uf20f', 'md-filter-drama': u'\uf210', 'md-filter-frames': u'\uf211', 'md-filter-hdr': u'\uf212', 'md-filter-none': u'\uf213', 'md-filter-tilt-shift': u'\uf214', 'md-filter-vintage': u'\uf215', 'md-flare': u'\uf216', 'md-flash-auto': u'\uf217', 'md-flash-off': u'\uf218', 'md-flash-on': u'\uf219', 'md-flip': u'\uf21a', 'md-gradient': u'\uf21b', 'md-grain': u'\uf21c', 'md-grid-off': u'\uf21d', 'md-grid-on': u'\uf21e', 'md-hdr-off': u'\uf21f', 'md-hdr-on': u'\uf220', 'md-hdr-strong': u'\uf221', 'md-hdr-weak': u'\uf222', 'md-healing': u'\uf223', 'md-image': u'\uf224', 'md-image-aspect-ratio': u'\uf225', 'md-iso': u'\uf226', 'md-landscape': u'\uf227', 'md-leak-add': u'\uf228', 'md-leak-remove': u'\uf229', 'md-lens': u'\uf22a', 'md-looks': u'\uf22b', 'md-looks-1': u'\uf22c', 'md-looks-2': u'\uf22d', 'md-looks-3': u'\uf22e', 'md-looks-4': u'\uf22f', 'md-looks-5': u'\uf230', 'md-looks-6': u'\uf231', 'md-loupe': u'\uf232', 'md-movie-creation': u'\uf233', 'md-nature': u'\uf234', 'md-nature-people': u'\uf235', 'md-navigate-before': u'\uf236', 'md-navigate-next': u'\uf237', 'md-palette': u'\uf238', 'md-panorama': u'\uf239', 'md-panorama-fisheye': u'\uf23a', 'md-panorama-horizontal': u'\uf23b', 'md-panorama-vertical': u'\uf23c', 'md-panorama-wide-angle': u'\uf23d', 'md-photo': u'\uf23e', 'md-photo-album': u'\uf23f', 'md-photo-camera': u'\uf240', 'md-photo-library': u'\uf241', 'md-portrait': u'\uf242', 'md-remove-red-eye': u'\uf243', 'md-rotate-left': u'\uf244', 'md-rotate-right': u'\uf245', 'md-slideshow': u'\uf246', 'md-straighten': u'\uf247', 'md-style': u'\uf248', 'md-switch-camera': u'\uf249', 'md-switch-video': u'\uf24a', 'md-tag-faces': u'\uf24b', 'md-texture': u'\uf24c', 'md-timelapse': u'\uf24d', 'md-timer': u'\uf24e', 'md-timer-3': u'\uf24f', 'md-timer-10': u'\uf250', 'md-timer-auto': u'\uf251', 'md-timer-off': u'\uf252', 'md-tonality': u'\uf253', 'md-transform': u'\uf254', 'md-tune': u'\uf255', 'md-wb-auto': u'\uf256', 'md-wb-cloudy': u'\uf257', 'md-wb-incandescent': u'\uf258', 'md-wb-irradescent': u'\uf259', 'md-wb-sunny': u'\uf25a', 'md-beenhere': u'\uf25b', 'md-directions': u'\uf25c', 'md-directions-bike': u'\uf25d', 'md-directions-bus': u'\uf25e', 'md-directions-car': u'\uf25f', 'md-directions-ferry': u'\uf260', 'md-directions-subway': u'\uf261', 'md-directions-train': u'\uf262', 'md-directions-transit': u'\uf263', 'md-directions-walk': u'\uf264', 'md-flight': u'\uf265', 'md-hotel': u'\uf266', 'md-layers': u'\uf267', 'md-layers-clear': u'\uf268', 'md-local-airport': u'\uf269', 'md-local-atm': u'\uf26a', 'md-local-attraction': u'\uf26b', 'md-local-bar': u'\uf26c', 'md-local-cafe': u'\uf26d', 'md-local-car-wash': u'\uf26e', 'md-local-convenience-store': u'\uf26f', 'md-local-drink': u'\uf270', 'md-local-florist': u'\uf271', 'md-local-gas-station': u'\uf272', 'md-local-grocery-store': u'\uf273', 'md-local-hospital': u'\uf274', 'md-local-hotel': u'\uf275', 'md-local-laundry-service': u'\uf276', 'md-local-library': u'\uf277', 'md-local-mall': u'\uf278', 'md-local-movies': u'\uf279', 'md-local-offer': u'\uf27a', 'md-local-parking': u'\uf27b', 'md-local-pharmacy': u'\uf27c', 'md-local-phone': u'\uf27d', 'md-local-pizza': u'\uf27e', 'md-local-play': u'\uf27f', 'md-local-post-office': u'\uf280', 'md-local-print-shop': u'\uf281', 'md-local-restaurant': u'\uf282', 'md-local-see': u'\uf283', 'md-local-shipping': u'\uf284', 'md-local-taxi': u'\uf285', 'md-location-history': u'\uf286', 'md-map': u'\uf287', 'md-my-location': u'\uf288', 'md-navigation': u'\uf289', 'md-pin-drop': u'\uf28a', 'md-place': u'\uf28b', 'md-rate-review': u'\uf28c', 'md-restaurant-menu': u'\uf28d', 'md-satellite': u'\uf28e', 'md-store-mall-directory': u'\uf28f', 'md-terrain': u'\uf290', 'md-traffic': u'\uf291', 'md-apps': u'\uf292', 'md-cancel': u'\uf293', 'md-arrow-drop-down-circle': u'\uf294', 'md-arrow-drop-down': u'\uf295', 'md-arrow-drop-up': u'\uf296', 'md-arrow-back': u'\uf297', 'md-arrow-forward': u'\uf298', 'md-check': u'\uf299', 'md-close': u'\uf29a', 'md-chevron-left': u'\uf29b', 'md-chevron-right': u'\uf29c', 'md-expand-less': u'\uf29d', 'md-expand-more': u'\uf29e', 'md-fullscreen': u'\uf29f', 'md-fullscreen-exit': u'\uf2a0', 'md-menu': u'\uf2a1', 'md-more-horiz': u'\uf2a2', 'md-more-vert': u'\uf2a3', 'md-refresh': u'\uf2a4', 'md-unfold-less': u'\uf2a5', 'md-unfold-more': u'\uf2a6', 'md-adb': u'\uf2a7', 'md-bluetooth-audio': u'\uf2a8', 'md-disc-full': u'\uf2a9', 'md-dnd-forwardslash': u'\uf2aa', 'md-do-not-disturb': u'\uf2ab', 'md-drive-eta': u'\uf2ac', 'md-event-available': u'\uf2ad', 'md-event-busy': u'\uf2ae', 'md-event-note': u'\uf2af', 'md-folder-special': u'\uf2b0', 'md-mms': u'\uf2b1', 'md-more': u'\uf2b2', 'md-network-locked': u'\uf2b3', 'md-phone-bluetooth-speaker': u'\uf2b4', 'md-phone-forwarded': u'\uf2b5', 'md-phone-in-talk': u'\uf2b6', 'md-phone-locked': u'\uf2b7', 'md-phone-missed': u'\uf2b8', 'md-phone-paused': u'\uf2b9', 'md-play-download': u'\uf2ba', 'md-play-install': u'\uf2bb', 'md-sd-card': u'\uf2bc', 'md-sim-card-alert': u'\uf2bd', 'md-sms': u'\uf2be', 'md-sms-failed': u'\uf2bf', 'md-sync': u'\uf2c0', 'md-sync-disabled': u'\uf2c1', 'md-sync-problem': u'\uf2c2', 'md-system-update': u'\uf2c3', 'md-tap-and-play': u'\uf2c4', 'md-time-to-leave': u'\uf2c5', 'md-vibration': u'\uf2c6', 'md-voice-chat': u'\uf2c7', 'md-vpn-lock': u'\uf2c8', 'md-cake': u'\uf2c9', 'md-domain': u'\uf2ca', 'md-location-city': u'\uf2cb', 'md-mood': u'\uf2cc', 'md-notifications-none': u'\uf2cd', 'md-notifications': u'\uf2ce', 'md-notifications-off': u'\uf2cf', 'md-notifications-on': u'\uf2d0', 'md-notifications-paused': u'\uf2d1', 'md-pages': u'\uf2d2', 'md-party-mode': u'\uf2d3', 'md-group': u'\uf2d4', 'md-group-add': u'\uf2d5', 'md-people': u'\uf2d6', 'md-people-outline': u'\uf2d7', 'md-person': u'\uf2d8', 'md-person-add': u'\uf2d9', 'md-person-outline': u'\uf2da', 'md-plus-one': u'\uf2db', 'md-poll': u'\uf2dc', 'md-public': u'\uf2dd', 'md-school': u'\uf2de', 'md-share': u'\uf2df', 'md-whatshot': u'\uf2e0', 'md-check-box': u'\uf2e1', 'md-check-box-outline-blank': u'\uf2e2', 'md-radio-button-off': u'\uf2e3', 'md-radio-button-on': u'\uf2e4', 'md-star': u'\uf2e5', 'md-star-half': u'\uf2e6', 'md-star-outline': u'\uf2e7'}
|
# Time: O(n)
# Space: O(n)
class Solution(object):
def isPrefixOfWord(self, sentence, searchWord):
"""
:type sentence: str
:type searchWord: str
:rtype: int
"""
def KMP(text, pattern):
def getPrefix(pattern):
prefix = [-1] * len(pattern)
j = -1
for i in range(1, len(pattern)):
while j > -1 and pattern[j + 1] != pattern[i]:
j = prefix[j]
if pattern[j + 1] == pattern[i]:
j += 1
prefix[i] = j
return prefix
prefix = getPrefix(pattern)
j = -1
for i in range(len(text)):
while j != -1 and pattern[j+1] != text[i]:
j = prefix[j]
if pattern[j+1] == text[i]:
j += 1
if j+1 == len(pattern):
return i-j
return -1
if sentence.startswith(searchWord):
return 1
p = KMP(sentence, ' ' + searchWord)
if p == -1:
return -1
return 1+sum(sentence[i] == ' ' for i in range(p+1))
|
class Solution(object):
def is_prefix_of_word(self, sentence, searchWord):
"""
:type sentence: str
:type searchWord: str
:rtype: int
"""
def kmp(text, pattern):
def get_prefix(pattern):
prefix = [-1] * len(pattern)
j = -1
for i in range(1, len(pattern)):
while j > -1 and pattern[j + 1] != pattern[i]:
j = prefix[j]
if pattern[j + 1] == pattern[i]:
j += 1
prefix[i] = j
return prefix
prefix = get_prefix(pattern)
j = -1
for i in range(len(text)):
while j != -1 and pattern[j + 1] != text[i]:
j = prefix[j]
if pattern[j + 1] == text[i]:
j += 1
if j + 1 == len(pattern):
return i - j
return -1
if sentence.startswith(searchWord):
return 1
p = kmp(sentence, ' ' + searchWord)
if p == -1:
return -1
return 1 + sum((sentence[i] == ' ' for i in range(p + 1)))
|
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# * RUNTIME SHENG TRANSLATOR - CORE *
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# * Welcome to Runtime Sheng translator. v1.0.0 *
# * MIT License, Copyright(c) 2018, Antony Muga *
# * All Rights Reserved. *
# * Author: Antony Muga *
# ----------------------------------------------------------
# * Project's Links: *
# * Twitter: https://twitter.com/RuntimeClubKe *
# * Runtime Club on LinkedIn *
# * Runtime Club on Github *
# * RuntimeTranslate project on GitHub *
# ----------------------------------------------------------
# * Personal social links: *
# * GitHub: https://github.com/antonymuga/ *
# * Website: https://antonymuga.github.io *
# * LinkedIn: https://www.linkedin.com/in/antony-muga/ *
# * Email: https://sites.google.com/view/antonymuga/home *
# ----------------------------------------------------------
projectDetails = """
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* RUNTIME SHENG TRANSLATOR *
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
* Welcome to Runtime Sheng translator. v1.0.0 *
* MIT License, Copyright(c) 2018, Antony Muga *
* All Rights Reserved. *
* Author: Antony Muga *
----------------------------------------------------------
* Project's Links: *
* TWITTER: https://twitter.com/RuntimeLab *
* LINKEDIN: Runtime Lab *
* GITHUB: RuntimeLab organization *
* GITHUB: Fork RuntimeShengTranslator project *
----------------------------------------------------------
* AUTHOR: ANTONY MUGA *
* Personal social links: *
* GITHUB: https://github.com/antonymuga/ *
* WEBSITE: https://antonymuga.github.io *
* LINKEDIN: https://www.linkedin.com/in/antony-muga/ *
* CONTACT: https://sites.google.com/view/antonymuga/home*
----------------------------------------------------------
"""
signOff = """
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
THANK YOU FOR USING RUNTIME TRANSLATE v1.0.0
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
TWITTER: RuntimeLab
LINKEDIN: Runtime Lab
---------------------------------------------------------------
GITHUB: RuntimeLab organization
FORK ON GITHUB & CONTRIBUTE: RuntimeShengTranslator
---------------------------------------------------------------
AUTHOR: Antony Muga
GITHUB: https://github.com/antonymuga/
LINKEDIN: https://www.linkedin.com/in/antony-muga/
WEBSITE: https://antonymuga.github.io
EMAIL: https://sites.google.com/view/antonymuga/home
---------------------------------------------------------------
Copyright(c) 2018, Antony Muga, RuntimeLab
https://antonymuga.github.io/
---------------------------------------------------------------
"""
|
project_details = "\n\t\t++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\t\t* RUNTIME SHENG TRANSLATOR *\n\t\t++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\t\t* Welcome to Runtime Sheng translator. v1.0.0 *\n\t\t* MIT License, Copyright(c) 2018, Antony Muga *\n\t\t* All Rights Reserved. *\n\t\t* Author: Antony Muga *\n\t\t----------------------------------------------------------\n\t\t* Project's Links: *\n\t\t* TWITTER: https://twitter.com/RuntimeLab *\n\t\t* LINKEDIN: Runtime Lab *\n\t\t* GITHUB: RuntimeLab organization *\n\t\t* GITHUB: Fork RuntimeShengTranslator project *\n\t\t----------------------------------------------------------\n\t\t* AUTHOR: ANTONY MUGA \t\t\t *\n\t\t* Personal social links: *\n\t\t* GITHUB: https://github.com/antonymuga/ *\n\t\t* WEBSITE: https://antonymuga.github.io *\n\t\t* LINKEDIN: https://www.linkedin.com/in/antony-muga/ *\n\t\t* CONTACT: https://sites.google.com/view/antonymuga/home*\n\t\t----------------------------------------------------------\n\t\t"
sign_off = '\n\t\t+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\t\t\tTHANK YOU FOR USING RUNTIME TRANSLATE v1.0.0\n\t\t+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\t\t\tTWITTER: RuntimeLab\n\t\t\tLINKEDIN: Runtime Lab\n\t\t---------------------------------------------------------------\n\t\t\tGITHUB: RuntimeLab organization\n\t\t\tFORK ON GITHUB & CONTRIBUTE: RuntimeShengTranslator\n\t\t---------------------------------------------------------------\n\t\t\tAUTHOR: Antony Muga\n\t\t\tGITHUB: https://github.com/antonymuga/ \n\t\t\tLINKEDIN: https://www.linkedin.com/in/antony-muga/\n\t\t\tWEBSITE: https://antonymuga.github.io\n\t\t\tEMAIL: https://sites.google.com/view/antonymuga/home\n\t\t---------------------------------------------------------------\n\t\t\tCopyright(c) 2018, Antony Muga, RuntimeLab\n\t\t\thttps://antonymuga.github.io/\n\t\t---------------------------------------------------------------\n'
|
#
# PySNMP MIB module XYPLEX-IPX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYPLEX-IPX-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:40:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsUnion", "ConstraintsIntersection")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Gauge32, TimeTicks, Counter64, iso, Bits, ModuleIdentity, IpAddress, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, Counter32, ObjectIdentity, enterprises, Unsigned32, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "TimeTicks", "Counter64", "iso", "Bits", "ModuleIdentity", "IpAddress", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "Counter32", "ObjectIdentity", "enterprises", "Unsigned32", "MibIdentifier")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
xyplex = MibIdentifier((1, 3, 6, 1, 4, 1, 33))
ipx = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 15))
ipxSystem = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 15, 1))
ipxIf = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 15, 2))
ipxNetbios = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 15, 3))
ipxRip = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 15, 4))
ipxSap = MibIdentifier((1, 3, 6, 1, 4, 1, 33, 15, 5))
ipxRouting = MibScalar((1, 3, 6, 1, 4, 1, 33, 15, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxRouting.setStatus('mandatory')
ipxIfTable = MibTable((1, 3, 6, 1, 4, 1, 33, 15, 2, 1), )
if mibBuilder.loadTexts: ipxIfTable.setStatus('mandatory')
ipxIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1), ).setIndexNames((0, "XYPLEX-IPX-MIB", "ipxIfIndex"))
if mibBuilder.loadTexts: ipxIfEntry.setStatus('mandatory')
ipxIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfIndex.setStatus('mandatory')
ipxIfState = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxIfState.setStatus('mandatory')
ipxIfNetwork = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 3), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxIfNetwork.setStatus('mandatory')
ipxIfFrameStyle = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ethernet", 1), ("ieee8022", 2))).clone('ieee8022')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxIfFrameStyle.setStatus('mandatory')
ipxIfFramesIn = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfFramesIn.setStatus('mandatory')
ipxIfFramesOut = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfFramesOut.setStatus('mandatory')
ipxIfErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfErrors.setStatus('mandatory')
ipxIfTransitDelay = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 8), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxIfTransitDelay.setStatus('mandatory')
ipxIfTransitDelayActual = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfTransitDelayActual.setStatus('mandatory')
ipxNetbiosHopLimit = MibScalar((1, 3, 6, 1, 4, 1, 33, 15, 3, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxNetbiosHopLimit.setStatus('mandatory')
ipxNetbiosIfTable = MibTable((1, 3, 6, 1, 4, 1, 33, 15, 3, 2), )
if mibBuilder.loadTexts: ipxNetbiosIfTable.setStatus('mandatory')
ipxNetbiosIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1), ).setIndexNames((0, "XYPLEX-IPX-MIB", "ipxNetbiosIfIndex"))
if mibBuilder.loadTexts: ipxNetbiosIfEntry.setStatus('mandatory')
ipxNetbiosIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxNetbiosIfIndex.setStatus('mandatory')
ipxIfNetbiosForwarding = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxIfNetbiosForwarding.setStatus('mandatory')
ipxIfNetbiosIn = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfNetbiosIn.setStatus('mandatory')
ipxIfNetbiosOut = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfNetbiosOut.setStatus('mandatory')
ipxRipIfTable = MibTable((1, 3, 6, 1, 4, 1, 33, 15, 4, 1), )
if mibBuilder.loadTexts: ipxRipIfTable.setStatus('mandatory')
ipxRipIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1), ).setIndexNames((0, "XYPLEX-IPX-MIB", "ipxRipIfIndex"))
if mibBuilder.loadTexts: ipxRipIfEntry.setStatus('mandatory')
ipxRipIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxRipIfIndex.setStatus('mandatory')
ipxIfRipBcst = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxIfRipBcst.setStatus('mandatory')
ipxIfRipBcstDiscardTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 3), Integer32().clone(180)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxIfRipBcstDiscardTimeout.setStatus('mandatory')
ipxIfRipBcstTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 4), Integer32().clone(60)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxIfRipBcstTimer.setStatus('mandatory')
ipxIfRipIn = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfRipIn.setStatus('mandatory')
ipxIfRipOut = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfRipOut.setStatus('mandatory')
ipxIfRipAgedOut = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfRipAgedOut.setStatus('mandatory')
ipxRipTable = MibTable((1, 3, 6, 1, 4, 1, 33, 15, 4, 2), )
if mibBuilder.loadTexts: ipxRipTable.setStatus('mandatory')
ipxRipEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1), ).setIndexNames((0, "XYPLEX-IPX-MIB", "ipxRipNetwork"))
if mibBuilder.loadTexts: ipxRipEntry.setStatus('mandatory')
ipxRipNetwork = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxRipNetwork.setStatus('mandatory')
ipxRipRouter = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxRipRouter.setStatus('mandatory')
ipxRipInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxRipInterface.setStatus('mandatory')
ipxRipHops = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxRipHops.setStatus('mandatory')
ipxRipTransTime = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxRipTransTime.setStatus('mandatory')
ipxRipAge = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxRipAge.setStatus('mandatory')
ipxSapIfTable = MibTable((1, 3, 6, 1, 4, 1, 33, 15, 5, 1), )
if mibBuilder.loadTexts: ipxSapIfTable.setStatus('mandatory')
ipxSapIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1), ).setIndexNames((0, "XYPLEX-IPX-MIB", "ipxSapIfIndex"))
if mibBuilder.loadTexts: ipxSapIfEntry.setStatus('mandatory')
ipxSapIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxSapIfIndex.setStatus('mandatory')
ipxIfSapBcst = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxIfSapBcst.setStatus('mandatory')
ipxIfSapBcstDiscardTimeout = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 3), Integer32().clone(180)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxIfSapBcstDiscardTimeout.setStatus('mandatory')
ipxIfSapBcstTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 4), Integer32().clone(60)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ipxIfSapBcstTimer.setStatus('mandatory')
ipxIfSapIn = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfSapIn.setStatus('mandatory')
ipxIfSapOut = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfSapOut.setStatus('mandatory')
ipxIfSapAgedOut = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxIfSapAgedOut.setStatus('mandatory')
ipxSapTable = MibTable((1, 3, 6, 1, 4, 1, 33, 15, 5, 2), )
if mibBuilder.loadTexts: ipxSapTable.setStatus('mandatory')
ipxSapEntry = MibTableRow((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1), ).setIndexNames((0, "XYPLEX-IPX-MIB", "ipxSapName"), (0, "XYPLEX-IPX-MIB", "ipxSapType"))
if mibBuilder.loadTexts: ipxSapEntry.setStatus('mandatory')
ipxSapName = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(48, 48)).setFixedLength(48)).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxSapName.setStatus('mandatory')
ipxSapNetwork = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxSapNetwork.setStatus('mandatory')
ipxSapHost = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxSapHost.setStatus('mandatory')
ipxSapSocket = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 4), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxSapSocket.setStatus('mandatory')
ipxSapInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxSapInterface.setStatus('mandatory')
ipxSapType = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=NamedValues(("user", 1), ("userGroup", 2), ("printQueue", 3), ("novellFileServer", 4), ("jobServer", 5), ("gateway1", 6), ("printServer", 7), ("archiveQueue", 8), ("archiveServer", 9), ("jobQueue", 10), ("administration", 11)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxSapType.setStatus('mandatory')
ipxSapAge = MibTableColumn((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ipxSapAge.setStatus('mandatory')
mibBuilder.exportSymbols("XYPLEX-IPX-MIB", ipxNetbiosIfEntry=ipxNetbiosIfEntry, ipxRipIfIndex=ipxRipIfIndex, ipxRipRouter=ipxRipRouter, ipxIfRipBcstTimer=ipxIfRipBcstTimer, ipxRip=ipxRip, ipxIfRipOut=ipxIfRipOut, ipxSap=ipxSap, ipxIfSapAgedOut=ipxIfSapAgedOut, ipxIfRipIn=ipxIfRipIn, ipxIfIndex=ipxIfIndex, ipxRipNetwork=ipxRipNetwork, ipxRipInterface=ipxRipInterface, ipxSapName=ipxSapName, ipxIfFramesOut=ipxIfFramesOut, ipxSystem=ipxSystem, ipxSapIfEntry=ipxSapIfEntry, ipxIfSapBcstTimer=ipxIfSapBcstTimer, ipxSapEntry=ipxSapEntry, ipxSapIfTable=ipxSapIfTable, ipxRipAge=ipxRipAge, ipxIfSapBcstDiscardTimeout=ipxIfSapBcstDiscardTimeout, ipxRipEntry=ipxRipEntry, ipxSapHost=ipxSapHost, ipxIfRipAgedOut=ipxIfRipAgedOut, ipxIfTransitDelayActual=ipxIfTransitDelayActual, ipxIfTable=ipxIfTable, ipxRipTransTime=ipxRipTransTime, ipxNetbios=ipxNetbios, ipxIfSapIn=ipxIfSapIn, ipxSapAge=ipxSapAge, ipxSapInterface=ipxSapInterface, ipxIfState=ipxIfState, ipxRipIfTable=ipxRipIfTable, ipxIfFramesIn=ipxIfFramesIn, ipxNetbiosIfTable=ipxNetbiosIfTable, ipxIfSapBcst=ipxIfSapBcst, ipxNetbiosIfIndex=ipxNetbiosIfIndex, xyplex=xyplex, ipxIfNetbiosForwarding=ipxIfNetbiosForwarding, ipxSapSocket=ipxSapSocket, ipxIfRipBcst=ipxIfRipBcst, ipxRipTable=ipxRipTable, ipxIfErrors=ipxIfErrors, ipxRipIfEntry=ipxRipIfEntry, ipxRipHops=ipxRipHops, ipxIfRipBcstDiscardTimeout=ipxIfRipBcstDiscardTimeout, ipxNetbiosHopLimit=ipxNetbiosHopLimit, ipxSapIfIndex=ipxSapIfIndex, ipxIfFrameStyle=ipxIfFrameStyle, ipxSapNetwork=ipxSapNetwork, ipxRouting=ipxRouting, ipxIfTransitDelay=ipxIfTransitDelay, ipxSapTable=ipxSapTable, ipxIfSapOut=ipxIfSapOut, ipx=ipx, ipxIfNetbiosOut=ipxIfNetbiosOut, ipxSapType=ipxSapType, ipxIf=ipxIf, ipxIfNetwork=ipxIfNetwork, ipxIfEntry=ipxIfEntry, ipxIfNetbiosIn=ipxIfNetbiosIn)
|
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsUnion', 'ConstraintsIntersection')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(gauge32, time_ticks, counter64, iso, bits, module_identity, ip_address, notification_type, mib_scalar, mib_table, mib_table_row, mib_table_column, integer32, counter32, object_identity, enterprises, unsigned32, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'Gauge32', 'TimeTicks', 'Counter64', 'iso', 'Bits', 'ModuleIdentity', 'IpAddress', 'NotificationType', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Integer32', 'Counter32', 'ObjectIdentity', 'enterprises', 'Unsigned32', 'MibIdentifier')
(display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention')
xyplex = mib_identifier((1, 3, 6, 1, 4, 1, 33))
ipx = mib_identifier((1, 3, 6, 1, 4, 1, 33, 15))
ipx_system = mib_identifier((1, 3, 6, 1, 4, 1, 33, 15, 1))
ipx_if = mib_identifier((1, 3, 6, 1, 4, 1, 33, 15, 2))
ipx_netbios = mib_identifier((1, 3, 6, 1, 4, 1, 33, 15, 3))
ipx_rip = mib_identifier((1, 3, 6, 1, 4, 1, 33, 15, 4))
ipx_sap = mib_identifier((1, 3, 6, 1, 4, 1, 33, 15, 5))
ipx_routing = mib_scalar((1, 3, 6, 1, 4, 1, 33, 15, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxRouting.setStatus('mandatory')
ipx_if_table = mib_table((1, 3, 6, 1, 4, 1, 33, 15, 2, 1))
if mibBuilder.loadTexts:
ipxIfTable.setStatus('mandatory')
ipx_if_entry = mib_table_row((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1)).setIndexNames((0, 'XYPLEX-IPX-MIB', 'ipxIfIndex'))
if mibBuilder.loadTexts:
ipxIfEntry.setStatus('mandatory')
ipx_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfIndex.setStatus('mandatory')
ipx_if_state = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2))).clone('enabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxIfState.setStatus('mandatory')
ipx_if_network = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 3), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxIfNetwork.setStatus('mandatory')
ipx_if_frame_style = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('ethernet', 1), ('ieee8022', 2))).clone('ieee8022')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxIfFrameStyle.setStatus('mandatory')
ipx_if_frames_in = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfFramesIn.setStatus('mandatory')
ipx_if_frames_out = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfFramesOut.setStatus('mandatory')
ipx_if_errors = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfErrors.setStatus('mandatory')
ipx_if_transit_delay = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 8), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxIfTransitDelay.setStatus('mandatory')
ipx_if_transit_delay_actual = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 2, 1, 1, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfTransitDelayActual.setStatus('mandatory')
ipx_netbios_hop_limit = mib_scalar((1, 3, 6, 1, 4, 1, 33, 15, 3, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxNetbiosHopLimit.setStatus('mandatory')
ipx_netbios_if_table = mib_table((1, 3, 6, 1, 4, 1, 33, 15, 3, 2))
if mibBuilder.loadTexts:
ipxNetbiosIfTable.setStatus('mandatory')
ipx_netbios_if_entry = mib_table_row((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1)).setIndexNames((0, 'XYPLEX-IPX-MIB', 'ipxNetbiosIfIndex'))
if mibBuilder.loadTexts:
ipxNetbiosIfEntry.setStatus('mandatory')
ipx_netbios_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxNetbiosIfIndex.setStatus('mandatory')
ipx_if_netbios_forwarding = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2))).clone('enabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxIfNetbiosForwarding.setStatus('mandatory')
ipx_if_netbios_in = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfNetbiosIn.setStatus('mandatory')
ipx_if_netbios_out = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 3, 2, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfNetbiosOut.setStatus('mandatory')
ipx_rip_if_table = mib_table((1, 3, 6, 1, 4, 1, 33, 15, 4, 1))
if mibBuilder.loadTexts:
ipxRipIfTable.setStatus('mandatory')
ipx_rip_if_entry = mib_table_row((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1)).setIndexNames((0, 'XYPLEX-IPX-MIB', 'ipxRipIfIndex'))
if mibBuilder.loadTexts:
ipxRipIfEntry.setStatus('mandatory')
ipx_rip_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxRipIfIndex.setStatus('mandatory')
ipx_if_rip_bcst = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2))).clone('enabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxIfRipBcst.setStatus('mandatory')
ipx_if_rip_bcst_discard_timeout = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 3), integer32().clone(180)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxIfRipBcstDiscardTimeout.setStatus('mandatory')
ipx_if_rip_bcst_timer = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 4), integer32().clone(60)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxIfRipBcstTimer.setStatus('mandatory')
ipx_if_rip_in = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfRipIn.setStatus('mandatory')
ipx_if_rip_out = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfRipOut.setStatus('mandatory')
ipx_if_rip_aged_out = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 1, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfRipAgedOut.setStatus('mandatory')
ipx_rip_table = mib_table((1, 3, 6, 1, 4, 1, 33, 15, 4, 2))
if mibBuilder.loadTexts:
ipxRipTable.setStatus('mandatory')
ipx_rip_entry = mib_table_row((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1)).setIndexNames((0, 'XYPLEX-IPX-MIB', 'ipxRipNetwork'))
if mibBuilder.loadTexts:
ipxRipEntry.setStatus('mandatory')
ipx_rip_network = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxRipNetwork.setStatus('mandatory')
ipx_rip_router = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(6, 6)).setFixedLength(6)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxRipRouter.setStatus('mandatory')
ipx_rip_interface = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxRipInterface.setStatus('mandatory')
ipx_rip_hops = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxRipHops.setStatus('mandatory')
ipx_rip_trans_time = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxRipTransTime.setStatus('mandatory')
ipx_rip_age = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 4, 2, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxRipAge.setStatus('mandatory')
ipx_sap_if_table = mib_table((1, 3, 6, 1, 4, 1, 33, 15, 5, 1))
if mibBuilder.loadTexts:
ipxSapIfTable.setStatus('mandatory')
ipx_sap_if_entry = mib_table_row((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1)).setIndexNames((0, 'XYPLEX-IPX-MIB', 'ipxSapIfIndex'))
if mibBuilder.loadTexts:
ipxSapIfEntry.setStatus('mandatory')
ipx_sap_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxSapIfIndex.setStatus('mandatory')
ipx_if_sap_bcst = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('disabled', 1), ('enabled', 2))).clone('enabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxIfSapBcst.setStatus('mandatory')
ipx_if_sap_bcst_discard_timeout = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 3), integer32().clone(180)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxIfSapBcstDiscardTimeout.setStatus('mandatory')
ipx_if_sap_bcst_timer = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 4), integer32().clone(60)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
ipxIfSapBcstTimer.setStatus('mandatory')
ipx_if_sap_in = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfSapIn.setStatus('mandatory')
ipx_if_sap_out = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfSapOut.setStatus('mandatory')
ipx_if_sap_aged_out = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 1, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxIfSapAgedOut.setStatus('mandatory')
ipx_sap_table = mib_table((1, 3, 6, 1, 4, 1, 33, 15, 5, 2))
if mibBuilder.loadTexts:
ipxSapTable.setStatus('mandatory')
ipx_sap_entry = mib_table_row((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1)).setIndexNames((0, 'XYPLEX-IPX-MIB', 'ipxSapName'), (0, 'XYPLEX-IPX-MIB', 'ipxSapType'))
if mibBuilder.loadTexts:
ipxSapEntry.setStatus('mandatory')
ipx_sap_name = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 1), display_string().subtype(subtypeSpec=value_size_constraint(48, 48)).setFixedLength(48)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxSapName.setStatus('mandatory')
ipx_sap_network = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxSapNetwork.setStatus('mandatory')
ipx_sap_host = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(6, 6)).setFixedLength(6)).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxSapHost.setStatus('mandatory')
ipx_sap_socket = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 4), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxSapSocket.setStatus('mandatory')
ipx_sap_interface = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxSapInterface.setStatus('mandatory')
ipx_sap_type = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))).clone(namedValues=named_values(('user', 1), ('userGroup', 2), ('printQueue', 3), ('novellFileServer', 4), ('jobServer', 5), ('gateway1', 6), ('printServer', 7), ('archiveQueue', 8), ('archiveServer', 9), ('jobQueue', 10), ('administration', 11)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxSapType.setStatus('mandatory')
ipx_sap_age = mib_table_column((1, 3, 6, 1, 4, 1, 33, 15, 5, 2, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
ipxSapAge.setStatus('mandatory')
mibBuilder.exportSymbols('XYPLEX-IPX-MIB', ipxNetbiosIfEntry=ipxNetbiosIfEntry, ipxRipIfIndex=ipxRipIfIndex, ipxRipRouter=ipxRipRouter, ipxIfRipBcstTimer=ipxIfRipBcstTimer, ipxRip=ipxRip, ipxIfRipOut=ipxIfRipOut, ipxSap=ipxSap, ipxIfSapAgedOut=ipxIfSapAgedOut, ipxIfRipIn=ipxIfRipIn, ipxIfIndex=ipxIfIndex, ipxRipNetwork=ipxRipNetwork, ipxRipInterface=ipxRipInterface, ipxSapName=ipxSapName, ipxIfFramesOut=ipxIfFramesOut, ipxSystem=ipxSystem, ipxSapIfEntry=ipxSapIfEntry, ipxIfSapBcstTimer=ipxIfSapBcstTimer, ipxSapEntry=ipxSapEntry, ipxSapIfTable=ipxSapIfTable, ipxRipAge=ipxRipAge, ipxIfSapBcstDiscardTimeout=ipxIfSapBcstDiscardTimeout, ipxRipEntry=ipxRipEntry, ipxSapHost=ipxSapHost, ipxIfRipAgedOut=ipxIfRipAgedOut, ipxIfTransitDelayActual=ipxIfTransitDelayActual, ipxIfTable=ipxIfTable, ipxRipTransTime=ipxRipTransTime, ipxNetbios=ipxNetbios, ipxIfSapIn=ipxIfSapIn, ipxSapAge=ipxSapAge, ipxSapInterface=ipxSapInterface, ipxIfState=ipxIfState, ipxRipIfTable=ipxRipIfTable, ipxIfFramesIn=ipxIfFramesIn, ipxNetbiosIfTable=ipxNetbiosIfTable, ipxIfSapBcst=ipxIfSapBcst, ipxNetbiosIfIndex=ipxNetbiosIfIndex, xyplex=xyplex, ipxIfNetbiosForwarding=ipxIfNetbiosForwarding, ipxSapSocket=ipxSapSocket, ipxIfRipBcst=ipxIfRipBcst, ipxRipTable=ipxRipTable, ipxIfErrors=ipxIfErrors, ipxRipIfEntry=ipxRipIfEntry, ipxRipHops=ipxRipHops, ipxIfRipBcstDiscardTimeout=ipxIfRipBcstDiscardTimeout, ipxNetbiosHopLimit=ipxNetbiosHopLimit, ipxSapIfIndex=ipxSapIfIndex, ipxIfFrameStyle=ipxIfFrameStyle, ipxSapNetwork=ipxSapNetwork, ipxRouting=ipxRouting, ipxIfTransitDelay=ipxIfTransitDelay, ipxSapTable=ipxSapTable, ipxIfSapOut=ipxIfSapOut, ipx=ipx, ipxIfNetbiosOut=ipxIfNetbiosOut, ipxSapType=ipxSapType, ipxIf=ipxIf, ipxIfNetwork=ipxIfNetwork, ipxIfEntry=ipxIfEntry, ipxIfNetbiosIn=ipxIfNetbiosIn)
|
'''
'''
def load(config):
data = []
with open(config['SimLex-999']['Dataset_File'], 'r') as stream:
# skip headers
stream.readline()
# load data
for line in stream:
(w1, w2, _, score, _) = [s.strip() for s in line.split('\t', 4)]
data.append((w1, w2, float(score)))
return data
|
"""
"""
def load(config):
data = []
with open(config['SimLex-999']['Dataset_File'], 'r') as stream:
stream.readline()
for line in stream:
(w1, w2, _, score, _) = [s.strip() for s in line.split('\t', 4)]
data.append((w1, w2, float(score)))
return data
|
class Solution:
def addBinary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
sumStr = str(int(a) + int(b))
sumList = [int(sumStr[i]) for i in range(len(sumStr))]
for i in range(0, len(sumList) - 1):
k = len(sumList) - i - 1
if sumList[k] >= 2:
sumList[k] -= 2
sumList[k - 1] += 1
if sumList[0] >= 2:
sumList[0] -= 2
sumList.insert(0, 1)
res = ""
for i in range(len(sumList)):
res += str(sumList[i])
return res
if __name__ == '__main__':
a = input()
b = input()
print(Solution().addBinary(a, b))
|
class Solution:
def add_binary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
sum_str = str(int(a) + int(b))
sum_list = [int(sumStr[i]) for i in range(len(sumStr))]
for i in range(0, len(sumList) - 1):
k = len(sumList) - i - 1
if sumList[k] >= 2:
sumList[k] -= 2
sumList[k - 1] += 1
if sumList[0] >= 2:
sumList[0] -= 2
sumList.insert(0, 1)
res = ''
for i in range(len(sumList)):
res += str(sumList[i])
return res
if __name__ == '__main__':
a = input()
b = input()
print(solution().addBinary(a, b))
|
"""
Provides Python modules such as;
* LiteXXX referenced as submodules.
* (Maybe?) pip installable libraries like;
- colorterm
- hexfile
- etc
"""
|
"""
Provides Python modules such as;
* LiteXXX referenced as submodules.
* (Maybe?) pip installable libraries like;
- colorterm
- hexfile
- etc
"""
|
class Missed(object):
pass
class Null:
pass
class RaiseKeyError:
pass
class LazyCache(object):
"""Wraps a Django cache object to provide more features."""
missed = Missed()
def __init__(self, cache, default_timeout=None):
self.cache = cache
self.default_timeout = default_timeout
def __getattr__(self, name):
return getattr(self, self.cache, name)
def __getitem__(self, key):
return self.get(key, default=RaiseKeyError)
def __delitem__(self, key):
self.delete(key)
def __setitem__(self, key, value):
self.set(key, value)
def _prepare_value(self, value):
if value is None:
value = Null
return value
def _restore_value(self, key, value):
if value is Null:
return None
if value is RaiseKeyError:
raise KeyError('"%s" was not found in the cache.' % key)
return value
def add(self, key, value, timeout=0, **kwargs):
value = self._prepare_value(key, value, timeout)
return self.cache.add(key, value, timeout=timeout, **kwargs)
def get(self, key, default=None, **kwargs):
value = self.cache.get(key, default=default, **kwargs)
value = self._restore_value(key, value)
return value
def get_many(self, keys, **kwargs):
data = self.cache.get_many(keys, **kwargs)
restored_data = {}
for key, value in data.items():
value = self._restore_value(key, value)
restored_data[key] = value
return restored_data
def get_or_miss(self, key, miss=False):
"""
Returns the cached value, or the "missed" object if it was not found
in the cache. Passing in True for the second argument will make it
bypass the cache and always return the "missed" object.
Example usage:
def get_value(refresh_cache=False):
key = 'some.key.123'
value = cache.get_or_miss(key, refresh_cache)
if value is cache.missed:
value = generate_new_value()
cache.set(key, value)
return value
"""
return miss and self.missed or self.get(key, default=self.missed)
def set(self, key, value, timeout=None, **kwargs):
if timeout is None:
timeout = self.default_timeout
value = self._prepare_value(key, value, timeout)
return self.cache.set(key, value, timeout=timeout, **kwargs)
def set_many(self, data, timeout=None, **kwargs):
if timeout is None:
timeout = self.default_timeout
prepared_data = {}
for key, value in data.items():
value = self._prepare_value(key, value, timeout)
prepared_data[key] = value
self.cache.set_many(prepared_data, timeout=timeout, **kwargs)
|
class Missed(object):
pass
class Null:
pass
class Raisekeyerror:
pass
class Lazycache(object):
"""Wraps a Django cache object to provide more features."""
missed = missed()
def __init__(self, cache, default_timeout=None):
self.cache = cache
self.default_timeout = default_timeout
def __getattr__(self, name):
return getattr(self, self.cache, name)
def __getitem__(self, key):
return self.get(key, default=RaiseKeyError)
def __delitem__(self, key):
self.delete(key)
def __setitem__(self, key, value):
self.set(key, value)
def _prepare_value(self, value):
if value is None:
value = Null
return value
def _restore_value(self, key, value):
if value is Null:
return None
if value is RaiseKeyError:
raise key_error('"%s" was not found in the cache.' % key)
return value
def add(self, key, value, timeout=0, **kwargs):
value = self._prepare_value(key, value, timeout)
return self.cache.add(key, value, timeout=timeout, **kwargs)
def get(self, key, default=None, **kwargs):
value = self.cache.get(key, default=default, **kwargs)
value = self._restore_value(key, value)
return value
def get_many(self, keys, **kwargs):
data = self.cache.get_many(keys, **kwargs)
restored_data = {}
for (key, value) in data.items():
value = self._restore_value(key, value)
restored_data[key] = value
return restored_data
def get_or_miss(self, key, miss=False):
"""
Returns the cached value, or the "missed" object if it was not found
in the cache. Passing in True for the second argument will make it
bypass the cache and always return the "missed" object.
Example usage:
def get_value(refresh_cache=False):
key = 'some.key.123'
value = cache.get_or_miss(key, refresh_cache)
if value is cache.missed:
value = generate_new_value()
cache.set(key, value)
return value
"""
return miss and self.missed or self.get(key, default=self.missed)
def set(self, key, value, timeout=None, **kwargs):
if timeout is None:
timeout = self.default_timeout
value = self._prepare_value(key, value, timeout)
return self.cache.set(key, value, timeout=timeout, **kwargs)
def set_many(self, data, timeout=None, **kwargs):
if timeout is None:
timeout = self.default_timeout
prepared_data = {}
for (key, value) in data.items():
value = self._prepare_value(key, value, timeout)
prepared_data[key] = value
self.cache.set_many(prepared_data, timeout=timeout, **kwargs)
|
def poly_sum(xs, ys):
# return the list representing the sum of the polynomials represented by the
# lists xs and ys
zs = []
l = min(len(xs), len(ys))
for i in range(0, l):
zs.append(xs[i] + ys[i])
if len(xs) > len(ys):
for i in range(l, len(xs)):
zs.append(xs[i])
else:
for i in range(l, len(ys)):
zs.append(ys[i])
return zs
def test(test_case_xs, test_case_ys, expected):
actual = poly_sum(test_case_xs, test_case_ys)
if actual == expected:
print("Passed test for " + str(test_case_xs) + ", " + str(test_case_ys))
else:
print("Didn't pass test for " + str(test_case_xs) + ", " + str(test_case_ys))
print("The result was " + str(actual) + " but it should have been " + str(expected))
test([], [], [])
test([1, 2], [3, 4], [4, 6])
test([-10, 10, 20], [10, -10, -20], [0, 0, 0])
test([1, 2, 3, 4, 5], [1, 2, 3], [2, 4, 6, 4, 5])
test([1, 2, 3], [1, 2, 3, 4, 5], [2, 4, 6, 4, 5])
|
def poly_sum(xs, ys):
zs = []
l = min(len(xs), len(ys))
for i in range(0, l):
zs.append(xs[i] + ys[i])
if len(xs) > len(ys):
for i in range(l, len(xs)):
zs.append(xs[i])
else:
for i in range(l, len(ys)):
zs.append(ys[i])
return zs
def test(test_case_xs, test_case_ys, expected):
actual = poly_sum(test_case_xs, test_case_ys)
if actual == expected:
print('Passed test for ' + str(test_case_xs) + ', ' + str(test_case_ys))
else:
print("Didn't pass test for " + str(test_case_xs) + ', ' + str(test_case_ys))
print('The result was ' + str(actual) + ' but it should have been ' + str(expected))
test([], [], [])
test([1, 2], [3, 4], [4, 6])
test([-10, 10, 20], [10, -10, -20], [0, 0, 0])
test([1, 2, 3, 4, 5], [1, 2, 3], [2, 4, 6, 4, 5])
test([1, 2, 3], [1, 2, 3, 4, 5], [2, 4, 6, 4, 5])
|
class Stack:
def __init__(self, data=[]):
self.data = data
def __repr__(self) -> str:
return f"{self.data}"
def peek(self):
if self.data:
return self.data[-1]
else:
return None
def pop(self):
return self.data.pop()
def push(self, d):
self.data.append(d)
def isempty(self):
if len(self.data) == 0:
return True
else:
return False
def merge(base, addition):
merged = []
for i, b in enumerate(base):
if b == 0:
merged.append(0)
else:
merged.append(b + addition[i])
return merged
def max_mat_rect(m):
h = len(m)
area = 0
for i in range(h):
hist = m[i] if i == 0 else merge(m[i], hist)
area = max(area, max_rect(hist))
return area
def max_rect(bars):
stack = Stack()
bars.append(0)
area = 0
for i, h in enumerate(bars):
if stack.isempty() or h > bars[stack.peek()]:
stack.push(i)
else:
while not stack.isempty() and h < bars[stack.peek()]:
i0 = stack.pop()
width = i - i0
area = max(area, bars[i0] * width)
return area
print(max_rect([0, 2, 1, 5, 5, 2, 3]))
print(max_rect([2, 4, 4]))
m = [[0, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 0, 0]]
print(max_mat_rect(m))
|
class Stack:
def __init__(self, data=[]):
self.data = data
def __repr__(self) -> str:
return f'{self.data}'
def peek(self):
if self.data:
return self.data[-1]
else:
return None
def pop(self):
return self.data.pop()
def push(self, d):
self.data.append(d)
def isempty(self):
if len(self.data) == 0:
return True
else:
return False
def merge(base, addition):
merged = []
for (i, b) in enumerate(base):
if b == 0:
merged.append(0)
else:
merged.append(b + addition[i])
return merged
def max_mat_rect(m):
h = len(m)
area = 0
for i in range(h):
hist = m[i] if i == 0 else merge(m[i], hist)
area = max(area, max_rect(hist))
return area
def max_rect(bars):
stack = stack()
bars.append(0)
area = 0
for (i, h) in enumerate(bars):
if stack.isempty() or h > bars[stack.peek()]:
stack.push(i)
else:
while not stack.isempty() and h < bars[stack.peek()]:
i0 = stack.pop()
width = i - i0
area = max(area, bars[i0] * width)
return area
print(max_rect([0, 2, 1, 5, 5, 2, 3]))
print(max_rect([2, 4, 4]))
m = [[0, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 0, 0]]
print(max_mat_rect(m))
|
"""esta clase va a manejar las fracciones"""
def validaEntero(funcion):
def validar(*args):
if len(args) == 2:
numero1=args[0]
numero2=args[1]
numero1=convierteTipo(numero1)
numero2=convierteTipo(numero2)
return funcion(numero1, numero2)
elif len(args) == 3:
numero1=args[1]
numero2=args[2]
numero1=convierteTipo(numero1)
numero2=convierteTipo(numero2)
return funcion(args[0], numero1, numero2)
else:
print('Error: numero de argumentos invalido')
return False
return validar
def convierteTipo(variable):
if type(variable) == float:
try:
variable=int(round(variable))
except Exception as e:
print('Error: ', e)
elif type(variable) == str:
try:
variable=int(variable)
except Exception as e:
print('Error: ', e)
elif type(variable) == int:
pass
else:
print('Error: los argumentos deben str, float o int')
print('variable: ',type(variable))
return False
return variable
class Fraccion:
"""esta clase va a manejar las fracciones"""
atributoComun='xxx'
@validaEntero
def __init__(self, numerador, denominador):
self.numerador = numerador
self.denominador = denominador
def __str__(self):
return str(self.numerador) + "/" + str(self.denominador)
def sumar(self, otraFraccion):
if self.denominador == otraFraccion.denominador:
nuevoNumerador = self.numerador + otraFraccion.numerador
nuevoDenominador = self.denominador
else:
nuevoDenominador=self.mcm(self.denominador, otraFraccion.denominador)
nuevoNumerador=self.numerador*(nuevoDenominador/self.denominador) + otraFraccion.numerador*(nuevoDenominador/otraFraccion.denominador)
return Fraccion(nuevoNumerador, nuevoDenominador)
def restar(self, otraFraccion):
if self.denominador == otraFraccion.denominador:
nuevoNumerador = self.numerador - otraFraccion.numerador
nuevoDenominador = self.denominador
else:
nuevoDenominador=self.mcm(self.denominador, otraFraccion.denominador)
nuevoNumerador=self.numerador*(nuevoDenominador/self.denominador) - otraFraccion.numerador*(nuevoDenominador/otraFraccion.denominador)
return Fraccion(nuevoNumerador, nuevoDenominador)
def mcm(self,numero1, numero2):
lista1=[]
lista2=[]
vacia=True
for i in range(1,10):
lista1.append(numero1*i)
lista2.append(numero2*i)
lista1.sort()
for numero in lista1:
if numero in lista2:
vacia = False
return numero
if vacia == True:
return numero1*numero2
@validaEntero
def MCD(self,numero1, numero2):
lista1=[]
lista2=[]
lista3=[]
for i in range(1,numero1+1):
if numero1%i==0:
lista1.append(i)
for i in range(1,numero2+1):
if numero2%i==0:
lista2.append(i)
for numero in lista1:
if numero in lista2:
lista3.append(numero)
return max(lista3)
def simplificar(self):
MCD=self.MCD(self.numerador, self.denominador)
return Fraccion(self.numerador/MCD, self.denominador/MCD)
def multiplicar(self, otraFraccion):
pass
def dividir(self, otraFraccion):
pass
def carga():
fraccion=input('ingrese la fraccion separada por ,: ')
numeros=fraccion.split(',')
numerador=numeros[0]
denominador=numeros[1]
return Fraccion(numerador, denominador)
fraccion1=carga()
fraccion2=carga()
print(fraccion1)
print(fraccion2)
print(fraccion1.restar(fraccion2))
fraccion3=fraccion1.sumar(fraccion2)
print(fraccion3)
print(fraccion3.simplificar())
|
"""esta clase va a manejar las fracciones"""
def valida_entero(funcion):
def validar(*args):
if len(args) == 2:
numero1 = args[0]
numero2 = args[1]
numero1 = convierte_tipo(numero1)
numero2 = convierte_tipo(numero2)
return funcion(numero1, numero2)
elif len(args) == 3:
numero1 = args[1]
numero2 = args[2]
numero1 = convierte_tipo(numero1)
numero2 = convierte_tipo(numero2)
return funcion(args[0], numero1, numero2)
else:
print('Error: numero de argumentos invalido')
return False
return validar
def convierte_tipo(variable):
if type(variable) == float:
try:
variable = int(round(variable))
except Exception as e:
print('Error: ', e)
elif type(variable) == str:
try:
variable = int(variable)
except Exception as e:
print('Error: ', e)
elif type(variable) == int:
pass
else:
print('Error: los argumentos deben str, float o int')
print('variable: ', type(variable))
return False
return variable
class Fraccion:
"""esta clase va a manejar las fracciones"""
atributo_comun = 'xxx'
@validaEntero
def __init__(self, numerador, denominador):
self.numerador = numerador
self.denominador = denominador
def __str__(self):
return str(self.numerador) + '/' + str(self.denominador)
def sumar(self, otraFraccion):
if self.denominador == otraFraccion.denominador:
nuevo_numerador = self.numerador + otraFraccion.numerador
nuevo_denominador = self.denominador
else:
nuevo_denominador = self.mcm(self.denominador, otraFraccion.denominador)
nuevo_numerador = self.numerador * (nuevoDenominador / self.denominador) + otraFraccion.numerador * (nuevoDenominador / otraFraccion.denominador)
return fraccion(nuevoNumerador, nuevoDenominador)
def restar(self, otraFraccion):
if self.denominador == otraFraccion.denominador:
nuevo_numerador = self.numerador - otraFraccion.numerador
nuevo_denominador = self.denominador
else:
nuevo_denominador = self.mcm(self.denominador, otraFraccion.denominador)
nuevo_numerador = self.numerador * (nuevoDenominador / self.denominador) - otraFraccion.numerador * (nuevoDenominador / otraFraccion.denominador)
return fraccion(nuevoNumerador, nuevoDenominador)
def mcm(self, numero1, numero2):
lista1 = []
lista2 = []
vacia = True
for i in range(1, 10):
lista1.append(numero1 * i)
lista2.append(numero2 * i)
lista1.sort()
for numero in lista1:
if numero in lista2:
vacia = False
return numero
if vacia == True:
return numero1 * numero2
@validaEntero
def mcd(self, numero1, numero2):
lista1 = []
lista2 = []
lista3 = []
for i in range(1, numero1 + 1):
if numero1 % i == 0:
lista1.append(i)
for i in range(1, numero2 + 1):
if numero2 % i == 0:
lista2.append(i)
for numero in lista1:
if numero in lista2:
lista3.append(numero)
return max(lista3)
def simplificar(self):
mcd = self.MCD(self.numerador, self.denominador)
return fraccion(self.numerador / MCD, self.denominador / MCD)
def multiplicar(self, otraFraccion):
pass
def dividir(self, otraFraccion):
pass
def carga():
fraccion = input('ingrese la fraccion separada por ,: ')
numeros = fraccion.split(',')
numerador = numeros[0]
denominador = numeros[1]
return fraccion(numerador, denominador)
fraccion1 = carga()
fraccion2 = carga()
print(fraccion1)
print(fraccion2)
print(fraccion1.restar(fraccion2))
fraccion3 = fraccion1.sumar(fraccion2)
print(fraccion3)
print(fraccion3.simplificar())
|
_asmm_version = '1.3.2'
_xml_version = '1.0b'
_py_version = '3.5.1'
_eclipse_version = '4.6.3'
_qt_version = '5.9'
_report_version = '3.4.0'
|
_asmm_version = '1.3.2'
_xml_version = '1.0b'
_py_version = '3.5.1'
_eclipse_version = '4.6.3'
_qt_version = '5.9'
_report_version = '3.4.0'
|
a = int(input("a :"))
b = int(input("b :"))
c = int(input("c :"))
delta = (b**2) - (4*a*c)
print(delta)
|
a = int(input('a :'))
b = int(input('b :'))
c = int(input('c :'))
delta = b ** 2 - 4 * a * c
print(delta)
|
def test_hello_svc_without_param(hello_svc_client):
"""
Given: hello svc running on cluster
And: I have cluster ip address
And: I have service port
When: I do a get call
Then: I should get back 200 Ok
And: I should get back string Hi there, !"
"""
status, response = hello_svc_client.get()
assert status == 200
assert response == f"Hi there, !"
def test_hello_svc_with_param(hello_svc_client):
"""
Given: hello svc running on cluster
And: I have cluster ip address
And: I have service port
When: I do a get call with string parameter
Then: I should get back 200 Ok
And: I should get back string Hi there, <param>!"
"""
name = "pradeep"
status, response = hello_svc_client.get(name=name)
assert status == 200
assert response == f"Hi there, {name}!"
|
def test_hello_svc_without_param(hello_svc_client):
"""
Given: hello svc running on cluster
And: I have cluster ip address
And: I have service port
When: I do a get call
Then: I should get back 200 Ok
And: I should get back string Hi there, !"
"""
(status, response) = hello_svc_client.get()
assert status == 200
assert response == f'Hi there, !'
def test_hello_svc_with_param(hello_svc_client):
"""
Given: hello svc running on cluster
And: I have cluster ip address
And: I have service port
When: I do a get call with string parameter
Then: I should get back 200 Ok
And: I should get back string Hi there, <param>!"
"""
name = 'pradeep'
(status, response) = hello_svc_client.get(name=name)
assert status == 200
assert response == f'Hi there, {name}!'
|
class Solution:
# Count Consecutive Groups (Top Voted), O(n) time and space
def countBinarySubstrings(self, s: str) -> int:
s = list(map(len, s.replace('01', '0 1').replace('10', '1 0').split()))
return sum(min(a, b) for a, b in zip(s, s[1:]))
# Linear Scan (Solution), O(n) time, O(1) space
def countBinarySubstrings(self, s: str) -> int:
ans, prev, cur = 0, 0, 1
for i in range(1, len(s)):
if s[i-1] != s[i]:
ans += min(prev, cur)
prev, cur = cur, 1
else:
cur += 1
return ans + min(prev, cur)
|
class Solution:
def count_binary_substrings(self, s: str) -> int:
s = list(map(len, s.replace('01', '0 1').replace('10', '1 0').split()))
return sum((min(a, b) for (a, b) in zip(s, s[1:])))
def count_binary_substrings(self, s: str) -> int:
(ans, prev, cur) = (0, 0, 1)
for i in range(1, len(s)):
if s[i - 1] != s[i]:
ans += min(prev, cur)
(prev, cur) = (cur, 1)
else:
cur += 1
return ans + min(prev, cur)
|
#
class FmeRenderer(object):
RENDER_MODE_CONSOLE = 1
RENDER_MODE_GRAPH = 2
def __init__(self, render_mode=RENDER_MODE_CONSOLE):
self.name = 'apps.fme.FmeRender'
self.render_mode = render_mode
def render_obs(self, obs):
pass
|
class Fmerenderer(object):
render_mode_console = 1
render_mode_graph = 2
def __init__(self, render_mode=RENDER_MODE_CONSOLE):
self.name = 'apps.fme.FmeRender'
self.render_mode = render_mode
def render_obs(self, obs):
pass
|
# Set options for certfile, ip, password, and toggle off
c.NotebookApp.certfile = '/tmp/mycert.pem'
c.NotebookApp.keyfile = '/tmp/mykey.key'
# Set ip to '*' to bind on all interfaces (ips) for the public server
c.NotebookApp.ip = '*'
# It is a good idea to set a known, fixed port for server access
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False
|
c.NotebookApp.certfile = '/tmp/mycert.pem'
c.NotebookApp.keyfile = '/tmp/mykey.key'
c.NotebookApp.ip = '*'
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False
|
class Solution:
def canJump(self, nums: List[int]) -> bool:
maxlen = 0
i = 0
while i <= maxlen and i < len(nums):
maxlen = max(maxlen, i + nums[i])
i += 1
if maxlen >= len(nums) - 1:
return True
return False
|
class Solution:
def can_jump(self, nums: List[int]) -> bool:
maxlen = 0
i = 0
while i <= maxlen and i < len(nums):
maxlen = max(maxlen, i + nums[i])
i += 1
if maxlen >= len(nums) - 1:
return True
return False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.