content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# -*- coding: utf-8 -*-
"""
Created on Tue May 25 11:16:49 2021
@author: SST-Lab
"""
class XBank:
loggedinCounter = 0
def _init_(self, atmpin, theaccountbalance, thename):
self.atmpin = theatmpin
self.accountbalance = theaccountbalance
self.name = thename
XBank.loggedinCounter = XBank.loggedinCounter + 1
def CollectMoney(self, amounttowithdraw):
if(amounttowithdraw > self.accountbalance):
print(f"Sorry we are not able to process at this time")
else:
print(f"Collect your cash...Thanks for banking with XBank")
def ChangePin(self, newPin):
self.atmpin = newPin
print(f"Your pin has been changed...Thanks for banking with XBank")
@classmethod
def No0fCustomersLoggedin (cls):
print(f"we have total of" + str(XBank.loggedinCounter) + "that have logged in")
f = open("C: \\Users\\SST-LAB\\Desktop\\database.txt",'r')
#print(f.readline())
password = []
accountB = []
name = []
breaker = []
for x in f:
breaker = x.split(' ')
password.append(breaker[0])
accountB.append(breaker[1])
name.append(breaker[2])
break
print("enter your pin.....")
pasw = input()
if(pasw == password[0]):
customer = XBank(password[0],accountB[0],name[0]) | """
Created on Tue May 25 11:16:49 2021
@author: SST-Lab
"""
class Xbank:
loggedin_counter = 0
def _init_(self, atmpin, theaccountbalance, thename):
self.atmpin = theatmpin
self.accountbalance = theaccountbalance
self.name = thename
XBank.loggedinCounter = XBank.loggedinCounter + 1
def collect_money(self, amounttowithdraw):
if amounttowithdraw > self.accountbalance:
print(f'Sorry we are not able to process at this time')
else:
print(f'Collect your cash...Thanks for banking with XBank')
def change_pin(self, newPin):
self.atmpin = newPin
print(f'Your pin has been changed...Thanks for banking with XBank')
@classmethod
def no0f_customers_loggedin(cls):
print(f'we have total of' + str(XBank.loggedinCounter) + 'that have logged in')
f = open('C: \\Users\\SST-LAB\\Desktop\\database.txt', 'r')
password = []
account_b = []
name = []
breaker = []
for x in f:
breaker = x.split(' ')
password.append(breaker[0])
accountB.append(breaker[1])
name.append(breaker[2])
break
print('enter your pin.....')
pasw = input()
if pasw == password[0]:
customer = x_bank(password[0], accountB[0], name[0]) |
def linear_search(list, target):
"""
Returns the index position of the target if found, else returns None
"""
for i in range(0, len(list)):
if list[i] == target:
return i
return None
def verify(index):
if index is not None:
print("Target is found at index: ", index)
else:
print("Target is not found in the list")
one_to_ten = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
result = linear_search(one_to_ten, 2)
verify(result)
| def linear_search(list, target):
"""
Returns the index position of the target if found, else returns None
"""
for i in range(0, len(list)):
if list[i] == target:
return i
return None
def verify(index):
if index is not None:
print('Target is found at index: ', index)
else:
print('Target is not found in the list')
one_to_ten = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
result = linear_search(one_to_ten, 2)
verify(result) |
DEBIAN = 'debian'
CENTOS = 'centos'
OPENSUSE = 'opensuse'
UBUNTU = 'ubuntu'
| debian = 'debian'
centos = 'centos'
opensuse = 'opensuse'
ubuntu = 'ubuntu' |
#MenuTitle: Make bottom left node first
# -*- coding: utf-8 -*-
__doc__="""
Makes the bottom left node in each path the first node in all masters
"""
def left(x):
return x.position.x
def bottom(x):
return x.position.y
layers = Glyphs.font.selectedLayers
for aLayer in layers:
for idx, thisLayer in enumerate(aLayer.parent.layers):
for p in thisLayer.paths:
oncurves = filter(lambda n: n.type != "offcurve", list(p.nodes))
n = sorted(sorted(oncurves, key = bottom),key=left)[0]
n.makeNodeFirst() | __doc__ = '\nMakes the bottom left node in each path the first node in all masters\n'
def left(x):
return x.position.x
def bottom(x):
return x.position.y
layers = Glyphs.font.selectedLayers
for a_layer in layers:
for (idx, this_layer) in enumerate(aLayer.parent.layers):
for p in thisLayer.paths:
oncurves = filter(lambda n: n.type != 'offcurve', list(p.nodes))
n = sorted(sorted(oncurves, key=bottom), key=left)[0]
n.makeNodeFirst() |
class Solution(object):
def nextPermutation(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
# find the longest non-decreasing suffix in nums
right = len(nums) - 1
while right >= 1 and nums[right] <= nums[right - 1]:
right -= 1
if right == 0:
return self.reverse(nums, 0, len(nums) - 1)
# find pivot
pivot = right - 1
# find rightmost succesor
for i in xrange(len(nums) - 1, pivot, -1):
if nums[i] > nums[pivot]:
succesor = i
break
# swap pivot and succesor
nums[pivot], nums[succesor] = nums[succesor], nums[pivot]
# reverse the suffix
self.reverse(nums, pivot + 1, len(nums) - 1)
def reverse(self, nums, l, r):
"""
reverse nums[l:r]
:type nums: List[int]
:type l: int
:type r: int
:rtype None
"""
while l < r:
nums[l], nums[r] = nums[r], nums[l]
l += 1
r -= 1 | class Solution(object):
def next_permutation(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
right = len(nums) - 1
while right >= 1 and nums[right] <= nums[right - 1]:
right -= 1
if right == 0:
return self.reverse(nums, 0, len(nums) - 1)
pivot = right - 1
for i in xrange(len(nums) - 1, pivot, -1):
if nums[i] > nums[pivot]:
succesor = i
break
(nums[pivot], nums[succesor]) = (nums[succesor], nums[pivot])
self.reverse(nums, pivot + 1, len(nums) - 1)
def reverse(self, nums, l, r):
"""
reverse nums[l:r]
:type nums: List[int]
:type l: int
:type r: int
:rtype None
"""
while l < r:
(nums[l], nums[r]) = (nums[r], nums[l])
l += 1
r -= 1 |
cand1 = 0
cand2 = 0
cand3 = 0
eleitores = int(input('Digite a quantidade de eleitores: '))
print('Para votar no Candidato 1 digite [1]\nPara votar no Candidato 2 digite [2]\nPara votar no Candidato 3 digite [3]')
for cont in range(0, eleitores):
voto = str(input('Digite seu voto: '))
if voto == '1':
cand1 += 1
if voto == '2':
cand2 += 1
if voto == '3':
cand3 += 1
print('O resultado foi: \nO Candidato 1 recebeu {} votos;\nO Candidato 2 recebeu {} votos;\nO Candidato 3 recebeu {} votos.'.format(cand1, cand2, cand3))
| cand1 = 0
cand2 = 0
cand3 = 0
eleitores = int(input('Digite a quantidade de eleitores: '))
print('Para votar no Candidato 1 digite [1]\nPara votar no Candidato 2 digite [2]\nPara votar no Candidato 3 digite [3]')
for cont in range(0, eleitores):
voto = str(input('Digite seu voto: '))
if voto == '1':
cand1 += 1
if voto == '2':
cand2 += 1
if voto == '3':
cand3 += 1
print('O resultado foi: \nO Candidato 1 recebeu {} votos;\nO Candidato 2 recebeu {} votos;\nO Candidato 3 recebeu {} votos.'.format(cand1, cand2, cand3)) |
# ----------------------------------------------------------------------
# Copyright (c) Microsoft Corporation.
# All rights reserved.
# ----------------------------------------------------------------------
# TODO: Consider just inheriting from Python's set type -MPL
class SymbolSet:
def __init__(self):
self._symbol_set_collection = set()
@property
def size(self):
return len(self._symbol_set_collection)
def add(self, new_symbol):
self._symbol_set_collection.add(new_symbol)
def merge(self, sym_set):
if sym_set is not None:
self._symbol_set_collection = self._symbol_set_collection.union(sym_set)
def copy(self):
return self._symbol_set_collection.copy()
def __iter__(self):
return iter(self._symbol_set_collection)
| class Symbolset:
def __init__(self):
self._symbol_set_collection = set()
@property
def size(self):
return len(self._symbol_set_collection)
def add(self, new_symbol):
self._symbol_set_collection.add(new_symbol)
def merge(self, sym_set):
if sym_set is not None:
self._symbol_set_collection = self._symbol_set_collection.union(sym_set)
def copy(self):
return self._symbol_set_collection.copy()
def __iter__(self):
return iter(self._symbol_set_collection) |
fix = {'5':'S', '0':'O', '1':'I'}
def correct(s):
return "".join(fix.get(c, c) for c in s)
| fix = {'5': 'S', '0': 'O', '1': 'I'}
def correct(s):
return ''.join((fix.get(c, c) for c in s)) |
def config_step_task(name, task_name, task_params=[], on_failure='TERMINATE_CLUSTER'):
"""
Returns a Python dict representing the step.
:param name: semantic name of the task
:param task_name: task name, identifies executable
:param task_params: task parameters
:param on_failure: either "CONTINUE" or "TERMINATE_CLUSTER"
:return:
"""
return {
'Name': name,
'ActionOnFailure': on_failure,
'HadoopJarStep': {
'Jar': 'command-runner.jar',
'Args': ['/usr/local/bin/{task_name}'.format(task_name=task_name)] + task_params
}
}
| def config_step_task(name, task_name, task_params=[], on_failure='TERMINATE_CLUSTER'):
"""
Returns a Python dict representing the step.
:param name: semantic name of the task
:param task_name: task name, identifies executable
:param task_params: task parameters
:param on_failure: either "CONTINUE" or "TERMINATE_CLUSTER"
:return:
"""
return {'Name': name, 'ActionOnFailure': on_failure, 'HadoopJarStep': {'Jar': 'command-runner.jar', 'Args': ['/usr/local/bin/{task_name}'.format(task_name=task_name)] + task_params}} |
#!/usr/bin/python3
def test_erc165_support(nft):
erc165_interface_id = "0x01ffc9a7"
assert nft.supportsInterface(erc165_interface_id) is True
def test_erc721_support(nft):
erc721_interface_id = "0x80ac58cd"
assert nft.supportsInterface(erc721_interface_id) is True
| def test_erc165_support(nft):
erc165_interface_id = '0x01ffc9a7'
assert nft.supportsInterface(erc165_interface_id) is True
def test_erc721_support(nft):
erc721_interface_id = '0x80ac58cd'
assert nft.supportsInterface(erc721_interface_id) is True |
def fatorial(_numero = 1, show = False):
resultado = 1
for item in range(1, _numero + 1):
resultado *= item
if show:
texto = ''
for item in reversed(range(1, _numero + 1)):
texto += '{} '.format(item)
if item == 1:
texto += '= {}'.format(resultado)
else:
texto += 'x '
else:
texto = '{}'.format(resultado)
return texto
print(fatorial(5, True))
print(fatorial(5, False))
print(fatorial()) | def fatorial(_numero=1, show=False):
resultado = 1
for item in range(1, _numero + 1):
resultado *= item
if show:
texto = ''
for item in reversed(range(1, _numero + 1)):
texto += '{} '.format(item)
if item == 1:
texto += '= {}'.format(resultado)
else:
texto += 'x '
else:
texto = '{}'.format(resultado)
return texto
print(fatorial(5, True))
print(fatorial(5, False))
print(fatorial()) |
"""
Management of OpenStack Keystone Roles
======================================
.. versionadded:: 2018.3.0
:depends: shade
:configuration: see :py:mod:`salt.modules.keystoneng` for setup instructions
Example States
.. code-block:: yaml
create role:
keystone_role.present:
- name: role1
delete role:
keystone_role.absent:
- name: role1
create role with optional params:
keystone_role.present:
- name: role1
- description: 'my group'
"""
__virtualname__ = "keystone_role"
def __virtual__():
if "keystoneng.role_get" in __salt__:
return __virtualname__
return (
False,
"The keystoneng execution module failed to load: shade python module is not"
" available",
)
def present(name, auth=None, **kwargs):
"""
Ensure an role exists
name
Name of the role
description
An arbitrary description of the role
"""
ret = {"name": name, "changes": {}, "result": True, "comment": ""}
kwargs = __utils__["args.clean_kwargs"](**kwargs)
__salt__["keystoneng.setup_clouds"](auth)
kwargs["name"] = name
role = __salt__["keystoneng.role_get"](**kwargs)
if not role:
if __opts__["test"] is True:
ret["result"] = None
ret["changes"] = kwargs
ret["comment"] = "Role will be created."
return ret
role = __salt__["keystoneng.role_create"](**kwargs)
ret["changes"]["id"] = role.id
ret["changes"]["name"] = role.name
ret["comment"] = "Created role"
return ret
# NOTE(SamYaple): Update support pending https://review.openstack.org/#/c/496992/
return ret
def absent(name, auth=None, **kwargs):
"""
Ensure role does not exist
name
Name of the role
"""
ret = {"name": name, "changes": {}, "result": True, "comment": ""}
__salt__["keystoneng.setup_clouds"](auth)
kwargs["name"] = name
role = __salt__["keystoneng.role_get"](**kwargs)
if role:
if __opts__["test"] is True:
ret["result"] = None
ret["changes"] = {"id": role.id}
ret["comment"] = "Role will be deleted."
return ret
__salt__["keystoneng.role_delete"](name=role)
ret["changes"]["id"] = role.id
ret["comment"] = "Deleted role"
return ret
| """
Management of OpenStack Keystone Roles
======================================
.. versionadded:: 2018.3.0
:depends: shade
:configuration: see :py:mod:`salt.modules.keystoneng` for setup instructions
Example States
.. code-block:: yaml
create role:
keystone_role.present:
- name: role1
delete role:
keystone_role.absent:
- name: role1
create role with optional params:
keystone_role.present:
- name: role1
- description: 'my group'
"""
__virtualname__ = 'keystone_role'
def __virtual__():
if 'keystoneng.role_get' in __salt__:
return __virtualname__
return (False, 'The keystoneng execution module failed to load: shade python module is not available')
def present(name, auth=None, **kwargs):
"""
Ensure an role exists
name
Name of the role
description
An arbitrary description of the role
"""
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
kwargs = __utils__['args.clean_kwargs'](**kwargs)
__salt__['keystoneng.setup_clouds'](auth)
kwargs['name'] = name
role = __salt__['keystoneng.role_get'](**kwargs)
if not role:
if __opts__['test'] is True:
ret['result'] = None
ret['changes'] = kwargs
ret['comment'] = 'Role will be created.'
return ret
role = __salt__['keystoneng.role_create'](**kwargs)
ret['changes']['id'] = role.id
ret['changes']['name'] = role.name
ret['comment'] = 'Created role'
return ret
return ret
def absent(name, auth=None, **kwargs):
"""
Ensure role does not exist
name
Name of the role
"""
ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
__salt__['keystoneng.setup_clouds'](auth)
kwargs['name'] = name
role = __salt__['keystoneng.role_get'](**kwargs)
if role:
if __opts__['test'] is True:
ret['result'] = None
ret['changes'] = {'id': role.id}
ret['comment'] = 'Role will be deleted.'
return ret
__salt__['keystoneng.role_delete'](name=role)
ret['changes']['id'] = role.id
ret['comment'] = 'Deleted role'
return ret |
BLACK = '\x1b[0;30m'
RED = '\x1b[0;31m'
GREEN = '\x1b[0;32m'
BROWN = '\x1b[0;33m'
BLUE = '\x1b[0;34m'
PURPLE = '\x1b[0;35m'
CYAN = '\x1b[0;36m'
LIGHT_GRAY = '\x1b[0;37m'
DARK_GRAY = '\x1b[1;30m'
LIGHT_RED = '\x1b[1;31m'
LIGHT_GREEN = '\x1b[1;32m'
YELLOW = '\x1b[1;33m'
LIGHT_BLUE = '\x1b[1;34m'
LIGHT_PURPLE = '\x1b[1;35m'
LIGHT_CYAN = '\x1b[1;36m'
WHITE = '\x1b[1;37m'
NONE = '\x1b[0m'
| black = '\x1b[0;30m'
red = '\x1b[0;31m'
green = '\x1b[0;32m'
brown = '\x1b[0;33m'
blue = '\x1b[0;34m'
purple = '\x1b[0;35m'
cyan = '\x1b[0;36m'
light_gray = '\x1b[0;37m'
dark_gray = '\x1b[1;30m'
light_red = '\x1b[1;31m'
light_green = '\x1b[1;32m'
yellow = '\x1b[1;33m'
light_blue = '\x1b[1;34m'
light_purple = '\x1b[1;35m'
light_cyan = '\x1b[1;36m'
white = '\x1b[1;37m'
none = '\x1b[0m' |
""" Assignment 8
1. Write a function that will return True if the passed-in number is even,
and False if it is odd.
2. Write a second function that will call the first with values 0-6 and print
each result on a new line.
3. Invoke the second function.
The signature of the first function should be: `is_even(num: int) -> bool`
The signature of the second function should be: `test_is_even() -> None` """
# Answer
def is_even(num: int) -> bool:
return num % 2 == 0
def test_is_even() -> None:
for i in range(7):
print(is_even(i))
test_is_even()
| """ Assignment 8
1. Write a function that will return True if the passed-in number is even,
and False if it is odd.
2. Write a second function that will call the first with values 0-6 and print
each result on a new line.
3. Invoke the second function.
The signature of the first function should be: `is_even(num: int) -> bool`
The signature of the second function should be: `test_is_even() -> None` """
def is_even(num: int) -> bool:
return num % 2 == 0
def test_is_even() -> None:
for i in range(7):
print(is_even(i))
test_is_even() |
authentication = {
"type": "object",
"properties": {
"access": {
"type": "object",
"properties": {
"token": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
},
"required": ["id"],
},
"serviceCatalog": {
"type": "array",
},
},
"required": ["token", "serviceCatalog", ],
},
},
"required": ["access", ],
}
| authentication = {'type': 'object', 'properties': {'access': {'type': 'object', 'properties': {'token': {'type': 'object', 'properties': {'id': {'type': 'string'}}, 'required': ['id']}, 'serviceCatalog': {'type': 'array'}}, 'required': ['token', 'serviceCatalog']}}, 'required': ['access']} |
class Node:
def __init__(self, value):
self.value = value
self.next = None
class Queue:
def __init__(self):
self.front = None
self.rear = None
def enqueue(self, data):
node = Node(data)
if self.rear:
self.rear.next = node
self.rear = node
else:
self.front = node
self.rear = node
def dequeue(self):
temp = self.front
if self.is_empty():
raise AttributeError ('Queue is empty')
else:
self.front = self.front.next
temp.next = None
if self.front == None:
self.rear = None
return temp.value
def peek(self):
try:
return self.front.value
except AttributeError:
raise AttributeError ('Queue is empty')
def is_empty(self):
if self.rear == None and self.front == None :
return True
else:
return False
def print_(self):
temp = self.front
str = ''
while temp:
str += f'{temp.value} - > '
temp = temp.next
return str
class Stack:
def __init__(self):
self.top = None
def push(self, data):
node = Node(data)
if self.top:
node.next = self.top
self.top = node
def pop(self):
if not self.top :
raise AttributeError ('Queue is empty')
else:
temp = self.top
self.top = self.top.next
temp.next = None
return temp.value
def peek(self):
if not self.is_empty():
return self.top.value
else :
raise AttributeError ('Queue is empty')
def is_empty(self):
if not self.top:
return True
else:
return False
if __name__ == "__main__":
stack = Stack()
# print('check when initlize the stack ',stack.is_empty())
# stack.push(5)
# stack.push(6)
# stack.push('cat')
# print(stack.peek())
# print('check after adding some items ',stack.is_empty())
# stack.pop()
# stack.pop()
# print(stack.peek())
# print('check after pop() some items ',stack.is_empty())
# stack.pop()
# print(stack.peek())
# print('check after pop() all items ',stack.is_empty())
# print(stack.is_empty())
# stack.push(5)
# stack.push(6)
# stack.push('cat')
# stack.pop()
# stack.pop()
# stack.pop()
# print(stack.is_empty())
queue = Queue()
queue.enqueue(4)
queue.enqueue(5)
# queue.enqueue(5)
# queue.enqueue(77)
# queue.dequeue()
# print(queue.print_())
| class Node:
def __init__(self, value):
self.value = value
self.next = None
class Queue:
def __init__(self):
self.front = None
self.rear = None
def enqueue(self, data):
node = node(data)
if self.rear:
self.rear.next = node
self.rear = node
else:
self.front = node
self.rear = node
def dequeue(self):
temp = self.front
if self.is_empty():
raise attribute_error('Queue is empty')
else:
self.front = self.front.next
temp.next = None
if self.front == None:
self.rear = None
return temp.value
def peek(self):
try:
return self.front.value
except AttributeError:
raise attribute_error('Queue is empty')
def is_empty(self):
if self.rear == None and self.front == None:
return True
else:
return False
def print_(self):
temp = self.front
str = ''
while temp:
str += f'{temp.value} - > '
temp = temp.next
return str
class Stack:
def __init__(self):
self.top = None
def push(self, data):
node = node(data)
if self.top:
node.next = self.top
self.top = node
def pop(self):
if not self.top:
raise attribute_error('Queue is empty')
else:
temp = self.top
self.top = self.top.next
temp.next = None
return temp.value
def peek(self):
if not self.is_empty():
return self.top.value
else:
raise attribute_error('Queue is empty')
def is_empty(self):
if not self.top:
return True
else:
return False
if __name__ == '__main__':
stack = stack()
queue = queue()
queue.enqueue(4)
queue.enqueue(5) |
class Customer:
def __init__(self, name, age, phone_no, address):
self.name = name
self.age = age
self.phone_no = phone_no
self.address = address
def view_details(self):
print(self.name, self.age, self.phone_no)
print(self.address.get_door_no(),
self.address.get_street(), self.address.get_pincode())
class Address:
def __init__(self, door_no, street, pincode):
self.__door_no = door_no
self.__street = street
self.__pincode = pincode
def get_door_no(self):
return self.__door_no
def get_street(self):
return self.__street
def get_pincode(self):
return self.__pincode
def set_door_no(self, value):
self.__door_no = value
def set_street(self, value):
self.__street = value
def set_pincode(self, value):
self.__pincode = value
def update_address(self):
pass
add1 = Address(123, "5th Lane", 56001)
cus1 = Customer("Jack", 24, 1234, add1)
cus1.view_details()
| class Customer:
def __init__(self, name, age, phone_no, address):
self.name = name
self.age = age
self.phone_no = phone_no
self.address = address
def view_details(self):
print(self.name, self.age, self.phone_no)
print(self.address.get_door_no(), self.address.get_street(), self.address.get_pincode())
class Address:
def __init__(self, door_no, street, pincode):
self.__door_no = door_no
self.__street = street
self.__pincode = pincode
def get_door_no(self):
return self.__door_no
def get_street(self):
return self.__street
def get_pincode(self):
return self.__pincode
def set_door_no(self, value):
self.__door_no = value
def set_street(self, value):
self.__street = value
def set_pincode(self, value):
self.__pincode = value
def update_address(self):
pass
add1 = address(123, '5th Lane', 56001)
cus1 = customer('Jack', 24, 1234, add1)
cus1.view_details() |
#!/usr/bin/env python3
# https://abc054.contest.atcoder.jp/tasks/abc054_a
a, b = map(int, input().split())
if a == b: print('Draw')
elif a == 1: print('Alice')
elif b == 1: print('Bob')
elif a > b: print('Alice')
else: print('Bob')
| (a, b) = map(int, input().split())
if a == b:
print('Draw')
elif a == 1:
print('Alice')
elif b == 1:
print('Bob')
elif a > b:
print('Alice')
else:
print('Bob') |
class NoQueueError(Exception):
pass
class JobError(RuntimeError):
pass
class TimeoutError(JobError):
pass
class CrashError(JobError):
pass | class Noqueueerror(Exception):
pass
class Joberror(RuntimeError):
pass
class Timeouterror(JobError):
pass
class Crasherror(JobError):
pass |
# ------------------------------
# 33. Search in Rotated Sorted Array
#
# Description:
# Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
#
# (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
# You are given a target value to search. If found in the array return its index, otherwise return -1.
#
# You may assume no duplicate exists in the array.
#
#
# Version: 1.0
# 10/22/17 by Jianfa
# ------------------------------
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if not nums:
return -1
if target not in nums:
return -1
left = 0
right = len(nums) - 1
while left < right:
mid = (left + right) / 2
if (nums[0] > target) ^ (nums[0] > nums[mid]) ^ (target > nums[mid]):
left = mid + 1
else:
right = mid
return left if target == nums[left] else -1
# Used for test
if __name__ == "__main__":
test = Solution()
nums = [3,4,5,1,2]
print(test.search(nums, 5))
# ------------------------------
# Summary:
# Idea from https://leetcode.com/problems/search-in-rotated-sorted-array/discuss/14419/Pretty-short-C%2B%2BJavaRubyPython
# There are three conditions need to be thought: nums[0] > target? nums[0] > nums[mid]? target > nums[mid]?
# If exactly two of them are true, then target should be at left side.
# Using XOR to distinguish. | class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
if not nums:
return -1
if target not in nums:
return -1
left = 0
right = len(nums) - 1
while left < right:
mid = (left + right) / 2
if (nums[0] > target) ^ (nums[0] > nums[mid]) ^ (target > nums[mid]):
left = mid + 1
else:
right = mid
return left if target == nums[left] else -1
if __name__ == '__main__':
test = solution()
nums = [3, 4, 5, 1, 2]
print(test.search(nums, 5)) |
# Encoding and Decoding in Python 3.x
a = 'Harshit'
# initialize byte object.
c = b'Harshit'
# using encode() to encode string
d = a.encode('ASCII')
if (d == c):
print("Encoding successful.")
else:
print("Encoding unsuccessful. :( ")
# Similarly, decode() is the inverse process.
# decode() will convert byte to string.
| a = 'Harshit'
c = b'Harshit'
d = a.encode('ASCII')
if d == c:
print('Encoding successful.')
else:
print('Encoding unsuccessful. :( ') |
#! /usr/bin/env python3
"""
--- besspin-ci.py is the CI entry to the BESSPIN program.
--- This file provide the combinations of CI files generated.
--- Every combination is represented as a set of tuples.
Each tuple represents one setting and its possible values.
Each "values" should be a tuple. Please note that a 1-element tuple should be: ('element',)
"""
backupBesspinAMI = { 'ImageId' : 'ami-067bd21562d1f150e',
'CreationDate' : '2021-05-19T20:09:51.000Z',
'OwnerId' : '363527286999'}
# Please update occasionally. Used by ./utils.getBesspinAMI() instead of erring.
ciAWSqueue = 'https://sqs.us-west-2.amazonaws.com/845509001885/ssith-fett-target-ci-develop-pipeline-PipelineSQSQueue-1IOF3D3BU1MEP.fifo'
ciAWSbucket = 'ssith-fett-target-ci-develop'
ciAWSqueueTesting = 'https://sqs.us-west-2.amazonaws.com/363527286999/aws-test-suite-queue.fifo'
ciAWSbucketTesting = 'aws-test-suite-bucket'
commonDefaults = {
('openConsole',('No',)),
('gdbDebug',('No',)),
('useCustomHwTarget',('No',)),
('useCustomTargetIp',('No',)),
('useCustomQemu',('No',)),
('useCustomOsImage',('No',)),
('useCustomProcessor',('No',)),
('remoteTargetIp',('172.31.30.56',))
}
commonDefaultsFETT = {
('mode',('fettTest',))
}
commonDefaultsCWEs = {
('mode',('evaluateSecurityTests',)),
('vulClasses', ('[bufferErrors, PPAC, resourceManagement, informationLeakage, numericErrors, hardwareSoC, injection]',)),
('checkAgainstValidScores',('Yes',)),
('useCustomScoring',('No',)),
('useCustomCompiling',('No',)),
('computeNaiveCWEsTally',('Yes',)),
('computeBesspinScale',('Yes',)),
('FreeRTOStimeout',(10,)),
('runAllTests',('Yes',)),
('runUnixMultitaskingTests',('Yes',)),
('instancesPerTestPart',(1,))
}
unixDefaultsCWEs = commonDefaultsCWEs.union({
('nTests',(150,)),
('cross-compiler',('GCC','Clang',)), # If cross-compiler is Clang, linker will be over-written to LLD
('linker',('GCC',)),
})
freertosDefaultsCWEs = commonDefaultsCWEs.union({
('nTests',(60,))
})
unixDefaults = commonDefaults.union({
('useCustomCredentials',('yes',)),
('userName',('researcher',)),
('userPasswordHash',('$6$xcnc07LxM26Xq$VBAn8.ZfCzEf5MEpftSsCndDaxfPs5gXWjdrvrHcSA6O6eRoV5etd9V8E.BE0/q4P8pGOz96Nav3PPuXOktmv.',)),
('buildApps',('no',)),
('rootUserAccess',('yes',))
})
gfe_unixOnPremDefaults = unixDefaults.union({
('binarySource',('GFE',)),
('elfLoader',('netboot',)),
('sourceVariant',('default',))
})
gfe_unixAwsDefaults = unixDefaults.union({
('binarySource',('GFE',)),
('elfLoader',('JTAG',)),
('sourceVariant',('default',)),
('target',('awsf1',))
})
gfe_unixAllTargets_onprem = gfe_unixOnPremDefaults.union({
('processor',('chisel_p2', 'bluespec_p2',)),
('target',('qemu', 'vcu118',)),
('osImage',('FreeBSD', 'debian',))
})
gfe_unixDevPR_onprem = gfe_unixOnPremDefaults.union({
('processor',('chisel_p2',)),
('target',('vcu118',)),
('osImage',('FreeBSD', 'debian',))
})
gfe_debianDevPR_aws = gfe_unixAwsDefaults.union({
('processor',('chisel_p2',)),
('osImage',('debian',))
})
gfe_freebsdDevPR_aws = gfe_unixAwsDefaults.union({
('processor',('bluespec_p2',)),
('osImage',('FreeBSD',))
})
mit_unixDevPR_aws = unixDefaults.union({
('binarySource',('MIT',)),
('elfLoader',('JTAG',)),
('sourceVariant',('default',)),
('processor',('bluespec_p2',)),
('target',('awsf1',)),
('osImage',('debian',))
})
lmco_unixDevPR_aws = unixDefaults.union({
('binarySource',('LMCO',)),
('elfLoader',('JTAG',)),
('sourceVariant',('default',)),
('processor',('chisel_p2',)),
('target',('awsf1',)),
('osImage',('debian',))
})
sri_cambridge_unixDevPR_aws = unixDefaults.union({
('binarySource',('SRI-Cambridge',)),
('elfLoader',('JTAG',)),
('sourceVariant',('default','purecap','temporal',)),
('processor',('bluespec_p2',)),
('target',('awsf1',)),
('osImage',('FreeBSD',))
})
freertosDefaults = commonDefaults.union({
('osImage',('FreeRTOS',)),
('elfLoader',('JTAG',)),
('sourceVariant',('default',)),
('freertosFatFs',('default',))
})
gfe_freertosAllTargets_onprem = freertosDefaults.union({
('binarySource',('GFE',)),
('processor',('chisel_p1',)),
('target',('vcu118',)),
('cross-compiler',('GCC','Clang',)),
('linker',('GCC',)),
('buildApps',('yes',))
})
gfe_freertosDevPR_onprem = gfe_freertosAllTargets_onprem
gfe_freertosDevPR_aws = freertosDefaults.union({
('binarySource',('GFE',)),
('processor',('chisel_p1',)),
('target',('awsf1',)),
('cross-compiler',('GCC','Clang',)),
('linker',('GCC',)), # If cross-compiler is Clang, linker will be over-written to LLD
('buildApps',('yes',))
})
lmco_freertosDevPR_aws = freertosDefaults.union({
('binarySource',('LMCO',)),
('processor',('chisel_p1',)),
('target',('awsf1',)),
('cross-compiler',('GCC',)),
('linker',('GCC',)), # If cross-compiler is Clang, linker will be over-written to LLD
('buildApps',('yes',))
})
michigan_freertosDevPR_aws = freertosDefaults.union({
('binarySource',('Michigan',)),
('processor',('chisel_p1',)),
('target',('awsf1',)),
('buildApps',('no',))
})
appSets = {
'runPeriodic' : {
'OnPrem' : {
'fett' : {
'gfe_freertos' : gfe_freertosAllTargets_onprem.union(commonDefaultsFETT),
'gfe_unix' : gfe_unixAllTargets_onprem.union(commonDefaultsFETT)
},
'cwe' : {
'gfe_freertos' : gfe_freertosAllTargets_onprem.union(freertosDefaultsCWEs),
'gfe_unix' : gfe_unixAllTargets_onprem.union(unixDefaultsCWEs)
}
}
},
'runDevPR' : {
'OnPrem' : {
'fett' : {
'gfe_freertos' : gfe_freertosDevPR_onprem.union(commonDefaultsFETT),
'gfe_unix' : gfe_unixDevPR_onprem.union(commonDefaultsFETT)
},
'cwe' : {
'gfe_freertos' : gfe_freertosDevPR_onprem.union(freertosDefaultsCWEs),
'gfe_unix' : gfe_unixDevPR_onprem.union(unixDefaultsCWEs)
}
},
'aws' : {
'fett' : {
'gfe_debian' : gfe_debianDevPR_aws.union(commonDefaultsFETT),
'gfe_freebsd' : gfe_freebsdDevPR_aws.union(commonDefaultsFETT),
'gfe_freertos' : gfe_freertosDevPR_aws.union(commonDefaultsFETT),
'lmco_freertos' : lmco_freertosDevPR_aws.union(commonDefaultsFETT),
'michigan_freertos' : michigan_freertosDevPR_aws.union(commonDefaultsFETT),
'mit_unix' : mit_unixDevPR_aws.union(commonDefaultsFETT),
'lmco_unix' : lmco_unixDevPR_aws.union(commonDefaultsFETT),
'sri-cambridge_unix' : sri_cambridge_unixDevPR_aws.union(commonDefaultsFETT)
},
'cwe' : {
'gfe_debian' : gfe_debianDevPR_aws.union(unixDefaultsCWEs),
'gfe_freebsd' : gfe_freebsdDevPR_aws.union(unixDefaultsCWEs),
'gfe_freertos' : gfe_freertosDevPR_aws.union(freertosDefaultsCWEs)
}
}
}
}
appSets['runRelease'] = appSets['runPeriodic']
| """
--- besspin-ci.py is the CI entry to the BESSPIN program.
--- This file provide the combinations of CI files generated.
--- Every combination is represented as a set of tuples.
Each tuple represents one setting and its possible values.
Each "values" should be a tuple. Please note that a 1-element tuple should be: ('element',)
"""
backup_besspin_ami = {'ImageId': 'ami-067bd21562d1f150e', 'CreationDate': '2021-05-19T20:09:51.000Z', 'OwnerId': '363527286999'}
ci_aw_squeue = 'https://sqs.us-west-2.amazonaws.com/845509001885/ssith-fett-target-ci-develop-pipeline-PipelineSQSQueue-1IOF3D3BU1MEP.fifo'
ci_aw_sbucket = 'ssith-fett-target-ci-develop'
ci_aw_squeue_testing = 'https://sqs.us-west-2.amazonaws.com/363527286999/aws-test-suite-queue.fifo'
ci_aw_sbucket_testing = 'aws-test-suite-bucket'
common_defaults = {('openConsole', ('No',)), ('gdbDebug', ('No',)), ('useCustomHwTarget', ('No',)), ('useCustomTargetIp', ('No',)), ('useCustomQemu', ('No',)), ('useCustomOsImage', ('No',)), ('useCustomProcessor', ('No',)), ('remoteTargetIp', ('172.31.30.56',))}
common_defaults_fett = {('mode', ('fettTest',))}
common_defaults_cw_es = {('mode', ('evaluateSecurityTests',)), ('vulClasses', ('[bufferErrors, PPAC, resourceManagement, informationLeakage, numericErrors, hardwareSoC, injection]',)), ('checkAgainstValidScores', ('Yes',)), ('useCustomScoring', ('No',)), ('useCustomCompiling', ('No',)), ('computeNaiveCWEsTally', ('Yes',)), ('computeBesspinScale', ('Yes',)), ('FreeRTOStimeout', (10,)), ('runAllTests', ('Yes',)), ('runUnixMultitaskingTests', ('Yes',)), ('instancesPerTestPart', (1,))}
unix_defaults_cw_es = commonDefaultsCWEs.union({('nTests', (150,)), ('cross-compiler', ('GCC', 'Clang')), ('linker', ('GCC',))})
freertos_defaults_cw_es = commonDefaultsCWEs.union({('nTests', (60,))})
unix_defaults = commonDefaults.union({('useCustomCredentials', ('yes',)), ('userName', ('researcher',)), ('userPasswordHash', ('$6$xcnc07LxM26Xq$VBAn8.ZfCzEf5MEpftSsCndDaxfPs5gXWjdrvrHcSA6O6eRoV5etd9V8E.BE0/q4P8pGOz96Nav3PPuXOktmv.',)), ('buildApps', ('no',)), ('rootUserAccess', ('yes',))})
gfe_unix_on_prem_defaults = unixDefaults.union({('binarySource', ('GFE',)), ('elfLoader', ('netboot',)), ('sourceVariant', ('default',))})
gfe_unix_aws_defaults = unixDefaults.union({('binarySource', ('GFE',)), ('elfLoader', ('JTAG',)), ('sourceVariant', ('default',)), ('target', ('awsf1',))})
gfe_unix_all_targets_onprem = gfe_unixOnPremDefaults.union({('processor', ('chisel_p2', 'bluespec_p2')), ('target', ('qemu', 'vcu118')), ('osImage', ('FreeBSD', 'debian'))})
gfe_unix_dev_pr_onprem = gfe_unixOnPremDefaults.union({('processor', ('chisel_p2',)), ('target', ('vcu118',)), ('osImage', ('FreeBSD', 'debian'))})
gfe_debian_dev_pr_aws = gfe_unixAwsDefaults.union({('processor', ('chisel_p2',)), ('osImage', ('debian',))})
gfe_freebsd_dev_pr_aws = gfe_unixAwsDefaults.union({('processor', ('bluespec_p2',)), ('osImage', ('FreeBSD',))})
mit_unix_dev_pr_aws = unixDefaults.union({('binarySource', ('MIT',)), ('elfLoader', ('JTAG',)), ('sourceVariant', ('default',)), ('processor', ('bluespec_p2',)), ('target', ('awsf1',)), ('osImage', ('debian',))})
lmco_unix_dev_pr_aws = unixDefaults.union({('binarySource', ('LMCO',)), ('elfLoader', ('JTAG',)), ('sourceVariant', ('default',)), ('processor', ('chisel_p2',)), ('target', ('awsf1',)), ('osImage', ('debian',))})
sri_cambridge_unix_dev_pr_aws = unixDefaults.union({('binarySource', ('SRI-Cambridge',)), ('elfLoader', ('JTAG',)), ('sourceVariant', ('default', 'purecap', 'temporal')), ('processor', ('bluespec_p2',)), ('target', ('awsf1',)), ('osImage', ('FreeBSD',))})
freertos_defaults = commonDefaults.union({('osImage', ('FreeRTOS',)), ('elfLoader', ('JTAG',)), ('sourceVariant', ('default',)), ('freertosFatFs', ('default',))})
gfe_freertos_all_targets_onprem = freertosDefaults.union({('binarySource', ('GFE',)), ('processor', ('chisel_p1',)), ('target', ('vcu118',)), ('cross-compiler', ('GCC', 'Clang')), ('linker', ('GCC',)), ('buildApps', ('yes',))})
gfe_freertos_dev_pr_onprem = gfe_freertosAllTargets_onprem
gfe_freertos_dev_pr_aws = freertosDefaults.union({('binarySource', ('GFE',)), ('processor', ('chisel_p1',)), ('target', ('awsf1',)), ('cross-compiler', ('GCC', 'Clang')), ('linker', ('GCC',)), ('buildApps', ('yes',))})
lmco_freertos_dev_pr_aws = freertosDefaults.union({('binarySource', ('LMCO',)), ('processor', ('chisel_p1',)), ('target', ('awsf1',)), ('cross-compiler', ('GCC',)), ('linker', ('GCC',)), ('buildApps', ('yes',))})
michigan_freertos_dev_pr_aws = freertosDefaults.union({('binarySource', ('Michigan',)), ('processor', ('chisel_p1',)), ('target', ('awsf1',)), ('buildApps', ('no',))})
app_sets = {'runPeriodic': {'OnPrem': {'fett': {'gfe_freertos': gfe_freertosAllTargets_onprem.union(commonDefaultsFETT), 'gfe_unix': gfe_unixAllTargets_onprem.union(commonDefaultsFETT)}, 'cwe': {'gfe_freertos': gfe_freertosAllTargets_onprem.union(freertosDefaultsCWEs), 'gfe_unix': gfe_unixAllTargets_onprem.union(unixDefaultsCWEs)}}}, 'runDevPR': {'OnPrem': {'fett': {'gfe_freertos': gfe_freertosDevPR_onprem.union(commonDefaultsFETT), 'gfe_unix': gfe_unixDevPR_onprem.union(commonDefaultsFETT)}, 'cwe': {'gfe_freertos': gfe_freertosDevPR_onprem.union(freertosDefaultsCWEs), 'gfe_unix': gfe_unixDevPR_onprem.union(unixDefaultsCWEs)}}, 'aws': {'fett': {'gfe_debian': gfe_debianDevPR_aws.union(commonDefaultsFETT), 'gfe_freebsd': gfe_freebsdDevPR_aws.union(commonDefaultsFETT), 'gfe_freertos': gfe_freertosDevPR_aws.union(commonDefaultsFETT), 'lmco_freertos': lmco_freertosDevPR_aws.union(commonDefaultsFETT), 'michigan_freertos': michigan_freertosDevPR_aws.union(commonDefaultsFETT), 'mit_unix': mit_unixDevPR_aws.union(commonDefaultsFETT), 'lmco_unix': lmco_unixDevPR_aws.union(commonDefaultsFETT), 'sri-cambridge_unix': sri_cambridge_unixDevPR_aws.union(commonDefaultsFETT)}, 'cwe': {'gfe_debian': gfe_debianDevPR_aws.union(unixDefaultsCWEs), 'gfe_freebsd': gfe_freebsdDevPR_aws.union(unixDefaultsCWEs), 'gfe_freertos': gfe_freertosDevPR_aws.union(freertosDefaultsCWEs)}}}}
appSets['runRelease'] = appSets['runPeriodic'] |
'''
Verify correct field and URL verification behavior
for not and nocase modifiers.
'''
# @file
#
# Copyright 2021, Verizon Media
# SPDX-License-Identifier: Apache-2.0
#
Test.Summary = '''
Verify correct field and URL verification behavior for
equals, absent, present, contains, prefix, and suffix
with not, nocase, and both not and nocase modifiers
'''
#
# Test 1: Verify field verification in a YAML replay file.
# Each combinaton of test type, not/as, and case/nocase, and positive/negative result
# are tested for client, and a mixture for server
#
r = Test.AddTestRun("Verify 'not' and 'nocase' directives work for a single HTTP transaction")
client = r.AddClientProcess("client1", "replay_files/not_nocase.yaml")
server = r.AddServerProcess("server1", "replay_files/not_nocase.yaml")
proxy = r.AddProxyProcess(
"proxy1",
listen_port=client.Variables.http_port,
server_port=server.Variables.http_port)
server.Streams.stdout += Testers.ContainsExpression(
'Not Equals Success: Different. Key: "5", Field Name: "host", Correct Value: "le.on", Actual Value: "example.one"',
'Validation should be happy that "le.on" is not equal to "example.one".')
server.Streams.stdout += Testers.ContainsExpression(
'Not Presence Success: Absent. Key: "5", Field Name: "x-test-absent"',
'Validation should be happy that "X-Test-Absent" has no value.')
server.Streams.stdout += Testers.ContainsExpression(
'Not Absence Success: Present. Key: "5", Field Name: "x-test-present", Value: "It\'s there"',
'Validation should be happy that "X-Test-Present" has a value.')
server.Streams.stdout += Testers.ContainsExpression(
'Not Contains Success: Not Found. Key: "5", Field Name: "host", Required Value: "leo", Actual Value: "example.one"',
'Validation should be happy that "leo" is not contained in "example.one".')
server.Streams.stdout += Testers.ContainsExpression(
'Not Prefix Success: Not Found. Key: "5", Field Name: "x-test-request", Required Value: "equ", Actual Value: "RequestData"',
'Validation should be happy that "equ" does not prefix "RequestData".')
server.Streams.stdout += Testers.ContainsExpression(
'Not Suffix Success: Not Found. Key: "5", Field Name: "x-test-present", Required Value: "It\'s", Actual Value: "It\'s there"',
'Validation should be happy that "It\'s" does not suffix "It\'s there".')
server.Streams.stdout += Testers.ContainsExpression(
'No Case Equals Success: Key: "5", Field Name: "host", Required Value: "EXAMpLE.ONE", Value: "example.one"',
'Validation should be happy that "EXAMpLE.ONE" nocase equals "example.one".')
server.Streams.stdout += Testers.ContainsExpression(
'No Case Contains Success: Key: "5", Field Name: "host", Required Value: "Le.ON", Value: "example.one"',
'Validation should be happy that "Le.ON" is nocase contained in "example.one".')
server.Streams.stdout += Testers.ContainsExpression(
'No Case Prefix Success: Key: "5", Field Name: "x-test-request", Required Value: "rEQ", Value: "RequestData"',
'Validation should be happy that "rEQ" nocase prefixes "RequestData".')
server.Streams.stdout += Testers.ContainsExpression(
'No Case Suffix Success: Key: "5", Field Name: "x-test-present", Required Value: "heRe", Value: "It\'s there"',
'Validation should be happy that "heRe" nocase suffixes "It\'s there".')
server.Streams.stdout += Testers.ContainsExpression(
'Not No Case Equals Success: Different. Key: "5", Field Name: "host", Correct Value: "example.ON", Actual Value: "example.one"',
'Validation should be happy that "le.on" does not nocase equal "example.one".')
server.Streams.stdout += Testers.ContainsExpression(
'Not No Case Contains Success: Not Found. Key: "5", Field Name: "host", Required Value: "U", Actual Value: "example.one"',
'Validation should be happy that "leo" is not nocase contained in "example.one".')
server.Streams.stdout += Testers.ContainsExpression(
'Not No Case Prefix Success: Not Found. Key: "5", Field Name: "x-test-request", Required Value: "EQU", Actual Value: "RequestData"',
'Validation should be happy that "equ" does not nocase prefix "RequestData".')
server.Streams.stdout += Testers.ContainsExpression(
'Not No Case Suffix Success: Not Found. Key: "5", Field Name: "x-test-present", Required Value: "hre", Actual Value: "It\'s there"',
'Validation should be happy that "hre" does not nocase suffix "It\'s there".')
server.Streams.stdout += Testers.ContainsExpression(
'Not Equals Violation: Key: "5", Field Name: "host", Value: "example.one"',
'Validation should complain that "example.on" equals "example.one".')
server.Streams.stdout += Testers.ContainsExpression(
'Not Presence Violation: Key: "5", Field Name: "x-test-present", Value: "It\'s there"',
'Validation should complain that "X-Test-Present" has a value.')
server.Streams.stdout += Testers.ContainsExpression(
'Not Absence Violation: Key: "5", Field Name: "x-test-absent"',
'Validation should complain that "X-Test-Absent" has no value.')
server.Streams.stdout += Testers.ContainsExpression(
'Not Contains Violation: Key: "5", Field Name: "host", Required Value: "le.on", Value: "example.one"',
'Validation should complain that "le.on" is contained in "example.one".')
server.Streams.stdout += Testers.ContainsExpression(
'Not Prefix Violation: Key: "5", Field Name: "x-test-request", Required Value: "Req", Value: "RequestData"',
'Validation should complain that "Req" prefixes "RequestData".')
server.Streams.stdout += Testers.ContainsExpression(
'Not Suffix Violation: Key: "5", Field Name: "x-test-present", Required Value: "there", Value: "It\'s there"',
'Validation should complain that "there" suffixes "It\'s there".')
server.Streams.stdout += Testers.ContainsExpression(
'No Case Equals Violation: Different. Key: "5", Field Name: "host", Correct Value: "EXAMPLE.ON", Actual Value: "example.one"',
'Validation should complain that "EXAMPL.ON" does not nocase equal "example.one".')
server.Streams.stdout += Testers.ContainsExpression(
'No Case Contains Violation: Not Found. Key: "5", Field Name: "host", Required Value: "LE..On", Actual Value: "example.one"',
'Validation should complain that "LE..On" is not nocase contained in "example.one".')
server.Streams.stdout += Testers.ContainsExpression(
'No Case Prefix Violation: Not Found. Key: "5", Field Name: "x-test-request", Required Value: "-TE", Actual Value: "RequestData"',
'Validation should complain that "-TE" does not nocase prefix "RequestData".')
server.Streams.stdout += Testers.ContainsExpression(
'No Case Suffix Violation: Not Found. Key: "5", Field Name: "x-test-present", Required Value: "THER", Actual Value: "It\'s there"',
'Validation should complain that "THER" does not nocase suffix "It\'s there".')
server.Streams.stdout += Testers.ContainsExpression(
'Not No Case Equals Violation: Key: "5", Field Name: "host", Required Value: "Example.one", Value: "example.one"',
'Validation should complain that "Example.one" nocase equals "example.one".')
server.Streams.stdout += Testers.ContainsExpression(
'Not No Case Contains Violation: Key: "5", Field Name: "host", Required Value: "le.oN", Value: "example.one"',
'Validation should complain that "le.oN" is nocase contained in "example.one".')
server.Streams.stdout += Testers.ContainsExpression(
'Not No Case Prefix Violation: Key: "5", Field Name: "x-test-request", Required Value: "req", Value: "RequestData"',
'Validation should complain that "req" nocase prefixes "RequestData".')
server.Streams.stdout += Testers.ContainsExpression(
'Not No Case Suffix Violation: Key: "5", Field Name: "x-test-present", Required Value: "eRE", Value: "It\'s there"',
'Validation should complain that "eRE" nocase suffixes "It\'s there".')
server.Streams.stdout = Testers.ContainsExpression(
'Not No Case Contains Violation: Key: "5", URI Part: "path", Required Value: "iG/S", Value: "/config/settings.yaml"',
'Validation should complain that "iG/S" is nocase contained in the path.')
client.Streams.stdout += Testers.ContainsExpression(
'Not Equals Success: Different. Key: "5", Field Name: "content-type", Correct Value: "text", Actual Value: "text/html"',
'Validation should be happy that "text" does not equal "text/html".')
client.Streams.stdout += Testers.ContainsExpression(
'Not Presence Violation: Key: "5", Field Name: "set-cookie", Value: "ABCD"',
'Validation should complain that "set-cookie" is present.')
client.Streams.stdout += Testers.ContainsExpression(
'Not Absence Violation: Key: "5", Field Name: "fake-cookie"',
'Validation should complain that "fake-cookie" is absent.')
client.Streams.stdout += Testers.ContainsExpression(
'Not No Case Contains Violation: Key: "5", Field Name: "content-type", Required Value: "Tex", Value: "text/html"',
'Validation should complain that "Tex" is nocase contained in "text/html".')
client.Streams.stdout += Testers.ContainsExpression(
'Not No Case Prefix Success: Absent. Key: "5", Field Name: "fake-cookie", Required Value: "B"',
'Validation should be happy that "B" does not nocase prefix a nonexistent header.')
client.Streams.stdout += Testers.ContainsExpression(
'No Case Suffix Success: Key: "5", Field Name: "content-type", Required Value: "L", Value: "text/html"',
'Validation should be happy that "L" nocase suffixes "text/html".')
client.Streams.stdout += Testers.ContainsExpression(
'Not Prefix Success: Not Found. Key: "5", Field Name: "multiple", Required Values: "Abc" "DEF", Received Values: "abc" "DEF"',
'Validation should be happy that "Abc" does not prefix "abc", even though "DEF" prefixes "DEF".')
client.Streams.stdout += Testers.ContainsExpression(
'Not No Case Equals Violation: Key: "5", Field Name: "multiple", Required Values: "Abc" "DEF", Values: "abc" "DEF"',
'Validation should complain that each required value nocase equals the corresponding received value.')
client.ReturnCode = 1
server.ReturnCode = 1
| """
Verify correct field and URL verification behavior
for not and nocase modifiers.
"""
Test.Summary = '\nVerify correct field and URL verification behavior for\nequals, absent, present, contains, prefix, and suffix\nwith not, nocase, and both not and nocase modifiers\n'
r = Test.AddTestRun("Verify 'not' and 'nocase' directives work for a single HTTP transaction")
client = r.AddClientProcess('client1', 'replay_files/not_nocase.yaml')
server = r.AddServerProcess('server1', 'replay_files/not_nocase.yaml')
proxy = r.AddProxyProcess('proxy1', listen_port=client.Variables.http_port, server_port=server.Variables.http_port)
server.Streams.stdout += Testers.ContainsExpression('Not Equals Success: Different. Key: "5", Field Name: "host", Correct Value: "le.on", Actual Value: "example.one"', 'Validation should be happy that "le.on" is not equal to "example.one".')
server.Streams.stdout += Testers.ContainsExpression('Not Presence Success: Absent. Key: "5", Field Name: "x-test-absent"', 'Validation should be happy that "X-Test-Absent" has no value.')
server.Streams.stdout += Testers.ContainsExpression('Not Absence Success: Present. Key: "5", Field Name: "x-test-present", Value: "It\'s there"', 'Validation should be happy that "X-Test-Present" has a value.')
server.Streams.stdout += Testers.ContainsExpression('Not Contains Success: Not Found. Key: "5", Field Name: "host", Required Value: "leo", Actual Value: "example.one"', 'Validation should be happy that "leo" is not contained in "example.one".')
server.Streams.stdout += Testers.ContainsExpression('Not Prefix Success: Not Found. Key: "5", Field Name: "x-test-request", Required Value: "equ", Actual Value: "RequestData"', 'Validation should be happy that "equ" does not prefix "RequestData".')
server.Streams.stdout += Testers.ContainsExpression('Not Suffix Success: Not Found. Key: "5", Field Name: "x-test-present", Required Value: "It\'s", Actual Value: "It\'s there"', 'Validation should be happy that "It\'s" does not suffix "It\'s there".')
server.Streams.stdout += Testers.ContainsExpression('No Case Equals Success: Key: "5", Field Name: "host", Required Value: "EXAMpLE.ONE", Value: "example.one"', 'Validation should be happy that "EXAMpLE.ONE" nocase equals "example.one".')
server.Streams.stdout += Testers.ContainsExpression('No Case Contains Success: Key: "5", Field Name: "host", Required Value: "Le.ON", Value: "example.one"', 'Validation should be happy that "Le.ON" is nocase contained in "example.one".')
server.Streams.stdout += Testers.ContainsExpression('No Case Prefix Success: Key: "5", Field Name: "x-test-request", Required Value: "rEQ", Value: "RequestData"', 'Validation should be happy that "rEQ" nocase prefixes "RequestData".')
server.Streams.stdout += Testers.ContainsExpression('No Case Suffix Success: Key: "5", Field Name: "x-test-present", Required Value: "heRe", Value: "It\'s there"', 'Validation should be happy that "heRe" nocase suffixes "It\'s there".')
server.Streams.stdout += Testers.ContainsExpression('Not No Case Equals Success: Different. Key: "5", Field Name: "host", Correct Value: "example.ON", Actual Value: "example.one"', 'Validation should be happy that "le.on" does not nocase equal "example.one".')
server.Streams.stdout += Testers.ContainsExpression('Not No Case Contains Success: Not Found. Key: "5", Field Name: "host", Required Value: "U", Actual Value: "example.one"', 'Validation should be happy that "leo" is not nocase contained in "example.one".')
server.Streams.stdout += Testers.ContainsExpression('Not No Case Prefix Success: Not Found. Key: "5", Field Name: "x-test-request", Required Value: "EQU", Actual Value: "RequestData"', 'Validation should be happy that "equ" does not nocase prefix "RequestData".')
server.Streams.stdout += Testers.ContainsExpression('Not No Case Suffix Success: Not Found. Key: "5", Field Name: "x-test-present", Required Value: "hre", Actual Value: "It\'s there"', 'Validation should be happy that "hre" does not nocase suffix "It\'s there".')
server.Streams.stdout += Testers.ContainsExpression('Not Equals Violation: Key: "5", Field Name: "host", Value: "example.one"', 'Validation should complain that "example.on" equals "example.one".')
server.Streams.stdout += Testers.ContainsExpression('Not Presence Violation: Key: "5", Field Name: "x-test-present", Value: "It\'s there"', 'Validation should complain that "X-Test-Present" has a value.')
server.Streams.stdout += Testers.ContainsExpression('Not Absence Violation: Key: "5", Field Name: "x-test-absent"', 'Validation should complain that "X-Test-Absent" has no value.')
server.Streams.stdout += Testers.ContainsExpression('Not Contains Violation: Key: "5", Field Name: "host", Required Value: "le.on", Value: "example.one"', 'Validation should complain that "le.on" is contained in "example.one".')
server.Streams.stdout += Testers.ContainsExpression('Not Prefix Violation: Key: "5", Field Name: "x-test-request", Required Value: "Req", Value: "RequestData"', 'Validation should complain that "Req" prefixes "RequestData".')
server.Streams.stdout += Testers.ContainsExpression('Not Suffix Violation: Key: "5", Field Name: "x-test-present", Required Value: "there", Value: "It\'s there"', 'Validation should complain that "there" suffixes "It\'s there".')
server.Streams.stdout += Testers.ContainsExpression('No Case Equals Violation: Different. Key: "5", Field Name: "host", Correct Value: "EXAMPLE.ON", Actual Value: "example.one"', 'Validation should complain that "EXAMPL.ON" does not nocase equal "example.one".')
server.Streams.stdout += Testers.ContainsExpression('No Case Contains Violation: Not Found. Key: "5", Field Name: "host", Required Value: "LE..On", Actual Value: "example.one"', 'Validation should complain that "LE..On" is not nocase contained in "example.one".')
server.Streams.stdout += Testers.ContainsExpression('No Case Prefix Violation: Not Found. Key: "5", Field Name: "x-test-request", Required Value: "-TE", Actual Value: "RequestData"', 'Validation should complain that "-TE" does not nocase prefix "RequestData".')
server.Streams.stdout += Testers.ContainsExpression('No Case Suffix Violation: Not Found. Key: "5", Field Name: "x-test-present", Required Value: "THER", Actual Value: "It\'s there"', 'Validation should complain that "THER" does not nocase suffix "It\'s there".')
server.Streams.stdout += Testers.ContainsExpression('Not No Case Equals Violation: Key: "5", Field Name: "host", Required Value: "Example.one", Value: "example.one"', 'Validation should complain that "Example.one" nocase equals "example.one".')
server.Streams.stdout += Testers.ContainsExpression('Not No Case Contains Violation: Key: "5", Field Name: "host", Required Value: "le.oN", Value: "example.one"', 'Validation should complain that "le.oN" is nocase contained in "example.one".')
server.Streams.stdout += Testers.ContainsExpression('Not No Case Prefix Violation: Key: "5", Field Name: "x-test-request", Required Value: "req", Value: "RequestData"', 'Validation should complain that "req" nocase prefixes "RequestData".')
server.Streams.stdout += Testers.ContainsExpression('Not No Case Suffix Violation: Key: "5", Field Name: "x-test-present", Required Value: "eRE", Value: "It\'s there"', 'Validation should complain that "eRE" nocase suffixes "It\'s there".')
server.Streams.stdout = Testers.ContainsExpression('Not No Case Contains Violation: Key: "5", URI Part: "path", Required Value: "iG/S", Value: "/config/settings.yaml"', 'Validation should complain that "iG/S" is nocase contained in the path.')
client.Streams.stdout += Testers.ContainsExpression('Not Equals Success: Different. Key: "5", Field Name: "content-type", Correct Value: "text", Actual Value: "text/html"', 'Validation should be happy that "text" does not equal "text/html".')
client.Streams.stdout += Testers.ContainsExpression('Not Presence Violation: Key: "5", Field Name: "set-cookie", Value: "ABCD"', 'Validation should complain that "set-cookie" is present.')
client.Streams.stdout += Testers.ContainsExpression('Not Absence Violation: Key: "5", Field Name: "fake-cookie"', 'Validation should complain that "fake-cookie" is absent.')
client.Streams.stdout += Testers.ContainsExpression('Not No Case Contains Violation: Key: "5", Field Name: "content-type", Required Value: "Tex", Value: "text/html"', 'Validation should complain that "Tex" is nocase contained in "text/html".')
client.Streams.stdout += Testers.ContainsExpression('Not No Case Prefix Success: Absent. Key: "5", Field Name: "fake-cookie", Required Value: "B"', 'Validation should be happy that "B" does not nocase prefix a nonexistent header.')
client.Streams.stdout += Testers.ContainsExpression('No Case Suffix Success: Key: "5", Field Name: "content-type", Required Value: "L", Value: "text/html"', 'Validation should be happy that "L" nocase suffixes "text/html".')
client.Streams.stdout += Testers.ContainsExpression('Not Prefix Success: Not Found. Key: "5", Field Name: "multiple", Required Values: "Abc" "DEF", Received Values: "abc" "DEF"', 'Validation should be happy that "Abc" does not prefix "abc", even though "DEF" prefixes "DEF".')
client.Streams.stdout += Testers.ContainsExpression('Not No Case Equals Violation: Key: "5", Field Name: "multiple", Required Values: "Abc" "DEF", Values: "abc" "DEF"', 'Validation should complain that each required value nocase equals the corresponding received value.')
client.ReturnCode = 1
server.ReturnCode = 1 |
#!/usr/bin/python3
""" Class Square creation module
A Blueprint for squares
"""
class Square:
"""Set the class square"""
def __init__(self, size=0):
"""Iniatiate Attributes for Square class.
Args:
size: integer with size of the square.
"""
self.__size = size
@property
def size(self):
"""Get the private size value.
Return:
self._size: value of size
"""
return self.__size
@size.setter
def size(self, value):
"""Set size into class object.
Args:
value: size to check
Raises:
ValueError: if size is lesser than 0.
TypeError: if size is not an integer.
"""
if type(value) is int:
if value < 0:
raise ValueError("size must be >= 0")
self.__size = value
else:
raise TypeError("size must be an integer")
def area(self):
"""Square Area method.
Return:
The Area of the square.
"""
return self.__size ** 2
| """ Class Square creation module
A Blueprint for squares
"""
class Square:
"""Set the class square"""
def __init__(self, size=0):
"""Iniatiate Attributes for Square class.
Args:
size: integer with size of the square.
"""
self.__size = size
@property
def size(self):
"""Get the private size value.
Return:
self._size: value of size
"""
return self.__size
@size.setter
def size(self, value):
"""Set size into class object.
Args:
value: size to check
Raises:
ValueError: if size is lesser than 0.
TypeError: if size is not an integer.
"""
if type(value) is int:
if value < 0:
raise value_error('size must be >= 0')
self.__size = value
else:
raise type_error('size must be an integer')
def area(self):
"""Square Area method.
Return:
The Area of the square.
"""
return self.__size ** 2 |
# Python API for using CAPI 3 core files from VUnit
# Authors:
# Unai Martinez-Corral
#
# Copyright 2021 Unai Martinez-Corral <unai.martinezcorral@ehu.eus>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
def AddCoreFilesets(vunitHandle, core, filesets):
"""
Add the sources of some filesets from a CAPI 3 compliant core, into a VUnit
handle through VUnit's API (``add_library`` and ``add_source_files``).
:param vunitHandle: handle to the VUnit object instance.
:param core: CAPI 3 compliant object (coming from LoadCoreFile).
:param filesets: name of the filesets to be added into the VUnit handle.
"""
_root = core.FILE_PATH.parent
_defaultLib = "VUnitUserLib"
_sources = {_defaultLib: []}
for fsetname in filesets:
if fsetname in core.filesets:
fset = core.filesets[fsetname]
_lib = _defaultLib if fset.logical_name == "" else fset.logical_name
if _lib not in _sources:
_sources[_lib] = []
_sources[_lib] += [_root / fset.path / fstr for fstr in fset.files]
for _lib, _files in _sources.items():
vunitHandle.add_library(_lib).add_source_files(_files)
| def add_core_filesets(vunitHandle, core, filesets):
"""
Add the sources of some filesets from a CAPI 3 compliant core, into a VUnit
handle through VUnit's API (``add_library`` and ``add_source_files``).
:param vunitHandle: handle to the VUnit object instance.
:param core: CAPI 3 compliant object (coming from LoadCoreFile).
:param filesets: name of the filesets to be added into the VUnit handle.
"""
_root = core.FILE_PATH.parent
_default_lib = 'VUnitUserLib'
_sources = {_defaultLib: []}
for fsetname in filesets:
if fsetname in core.filesets:
fset = core.filesets[fsetname]
_lib = _defaultLib if fset.logical_name == '' else fset.logical_name
if _lib not in _sources:
_sources[_lib] = []
_sources[_lib] += [_root / fset.path / fstr for fstr in fset.files]
for (_lib, _files) in _sources.items():
vunitHandle.add_library(_lib).add_source_files(_files) |
"""Welcome to FIRESONG, the FIRst Extragalactic Simulation Of Neutrinos and Gamma-rays"""
__author__ = 'C.F. Tung, T. Glauch, M. Larson, A. Pizzuto, R. Reimann, I. Taboada'
__email__ = ''
__version__ = '1.8'
__all__ = ['Firesong', 'Evolution', 'distance', 'FluxPDF',
'input_out', 'Luminosity', 'sampling', 'Legend']
| """Welcome to FIRESONG, the FIRst Extragalactic Simulation Of Neutrinos and Gamma-rays"""
__author__ = 'C.F. Tung, T. Glauch, M. Larson, A. Pizzuto, R. Reimann, I. Taboada'
__email__ = ''
__version__ = '1.8'
__all__ = ['Firesong', 'Evolution', 'distance', 'FluxPDF', 'input_out', 'Luminosity', 'sampling', 'Legend'] |
# ------------------------------
# 1027. Longest Arithmetic Sequence
#
# Description:
# Given an array A of integers, return the length of the longest arithmetic subsequence in A.
# Recall that a subsequence of A is a list A[i_1], A[i_2], ..., A[i_k] with 0 <= i_1 < i_2 <
# ... < i_k <= A.length - 1, and that a sequence B is arithmetic if B[i+1] - B[i] are all the
# same value (for 0 <= i < B.length - 1).
#
# Example 1:
# Input: [3,6,9,12]
# Output: 4
# Explanation:
# The whole array is an arithmetic sequence with steps of length = 3.
#
# Example 2:
# Input: [9,4,7,2,10]
# Output: 3
# Explanation:
# The longest arithmetic subsequence is [4,7,10].
#
# Example 3:
# Input: [20,1,15,3,10,5,8]
# Output: 4
# Explanation:
# The longest arithmetic subsequence is [20,15,10,5].
#
# Note:
# 2 <= A.length <= 2000
# 0 <= A[i] <= 10000
#
# Version: 1.0
# 11/03/19 by Jianfa
# ------------------------------
class Solution:
def longestArithSeqLength(self, A: List[int]) -> int:
dp = {} # dp[(index, diff)] is the length of longest arithmetic subsequence ending at index with difference diff
for i in range(len(A)):
for j in range(i+1, len(A)):
dp[j, A[j] - A[i]] = dp.get((i, A[j] - A[i]), 1) + 1 # get((i, A[j] - A[i]), 1) the 1 is for the single element length
return max(dp.values())
# Used for testing
if __name__ == "__main__":
test = Solution()
# ------------------------------
# Summary:
# DP solution from: https://leetcode.com/problems/longest-arithmetic-sequence/discuss/274611/JavaC%2B%2BPython-DP
#
# O(N^2) time, O(N^2) space | class Solution:
def longest_arith_seq_length(self, A: List[int]) -> int:
dp = {}
for i in range(len(A)):
for j in range(i + 1, len(A)):
dp[j, A[j] - A[i]] = dp.get((i, A[j] - A[i]), 1) + 1
return max(dp.values())
if __name__ == '__main__':
test = solution() |
products = {}
command = input()
while command != "statistics":
command = input()
while command != "statistics":
tokens = command.split(": ")
product = tokens[0]
quantity = int(tokens[1])
if product not in products:
products[product] = 0
products[product] += quantity
print("Products in stock:")
for(product, quantity) in products.items():
print(f"- {product}: {quantity}")
print(f"Total Products: {len(products.keys())}")
print(f"Total Quantity: {sum(products.values())}")
| products = {}
command = input()
while command != 'statistics':
command = input()
while command != 'statistics':
tokens = command.split(': ')
product = tokens[0]
quantity = int(tokens[1])
if product not in products:
products[product] = 0
products[product] += quantity
print('Products in stock:')
for (product, quantity) in products.items():
print(f'- {product}: {quantity}')
print(f'Total Products: {len(products.keys())}')
print(f'Total Quantity: {sum(products.values())}') |
DEBUG = False
ALLOWED_HOSTS = ['*']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'db1',
'USER': 'alex',
'PASSWORD': 'asdewqr1',
'HOST': 'localhost', # Set to empty string for localhost.
'PORT': '', # Set to empty string for default.
}
} | debug = False
allowed_hosts = ['*']
databases = {'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'db1', 'USER': 'alex', 'PASSWORD': 'asdewqr1', 'HOST': 'localhost', 'PORT': ''}} |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright (c) 2002-2020 "Neo4j,"
# Neo4j Sweden AB [http://neo4j.com]
#
# This file is part of Neo4j.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
This module contains the core driver exceptions.
"""
class ProtocolError(Exception):
""" Raised when an unexpected or unsupported protocol event occurs.
"""
class ServiceUnavailable(Exception):
""" Raised when no database service is available.
"""
class IncompleteCommitError(Exception):
""" Raised when a disconnection occurs while still waiting for a commit
response. For non-idempotent write transactions, this leaves the data
in an unknown state with regard to whether the transaction completed
successfully or not.
"""
class SecurityError(Exception):
""" Raised when an action is denied due to security settings.
"""
class CypherError(Exception):
""" Raised when the Cypher engine returns an error to the client.
"""
message = None
code = None
classification = None
category = None
title = None
metadata = None
@classmethod
def hydrate(cls, message=None, code=None, **metadata):
message = message or "An unknown error occurred."
code = code or "Neo.DatabaseError.General.UnknownError"
try:
_, classification, category, title = code.split(".")
except ValueError:
classification = "DatabaseError"
category = "General"
title = "UnknownError"
error_class = cls._extract_error_class(classification, code)
inst = error_class(message)
inst.message = message
inst.code = code
inst.classification = classification
inst.category = category
inst.title = title
inst.metadata = metadata
return inst
@classmethod
def _extract_error_class(cls, classification, code):
if classification == "ClientError":
try:
return client_errors[code]
except KeyError:
return ClientError
elif classification == "TransientError":
try:
return transient_errors[code]
except KeyError:
return TransientError
elif classification == "DatabaseError":
return DatabaseError
else:
return cls
class ClientError(CypherError):
""" The Client sent a bad request - changing the request might yield a successful outcome.
"""
class DatabaseError(CypherError):
""" The database failed to service the request.
"""
class TransientError(CypherError):
""" The database cannot service the request right now, retrying later might yield a successful outcome.
"""
class DatabaseUnavailableError(TransientError):
"""
"""
class ConstraintError(ClientError):
"""
"""
class CypherSyntaxError(ClientError):
"""
"""
class CypherTypeError(ClientError):
"""
"""
class NotALeaderError(ClientError):
"""
"""
class Forbidden(ClientError, SecurityError):
"""
"""
class ForbiddenOnReadOnlyDatabaseError(Forbidden):
"""
"""
class AuthError(ClientError, SecurityError):
""" Raised when authentication failure occurs.
"""
client_errors = {
# ConstraintError
"Neo.ClientError.Schema.ConstraintValidationFailed": ConstraintError,
"Neo.ClientError.Schema.ConstraintViolation": ConstraintError,
"Neo.ClientError.Statement.ConstraintVerificationFailed": ConstraintError,
"Neo.ClientError.Statement.ConstraintViolation": ConstraintError,
# CypherSyntaxError
"Neo.ClientError.Statement.InvalidSyntax": CypherSyntaxError,
"Neo.ClientError.Statement.SyntaxError": CypherSyntaxError,
# CypherTypeError
"Neo.ClientError.Procedure.TypeError": CypherTypeError,
"Neo.ClientError.Statement.InvalidType": CypherTypeError,
"Neo.ClientError.Statement.TypeError": CypherTypeError,
# Forbidden
"Neo.ClientError.General.ForbiddenOnReadOnlyDatabase": ForbiddenOnReadOnlyDatabaseError,
"Neo.ClientError.General.ReadOnly": Forbidden,
"Neo.ClientError.Schema.ForbiddenOnConstraintIndex": Forbidden,
"Neo.ClientError.Schema.IndexBelongsToConstraint": Forbidden,
"Neo.ClientError.Security.Forbidden": Forbidden,
"Neo.ClientError.Transaction.ForbiddenDueToTransactionType": Forbidden,
# AuthError
"Neo.ClientError.Security.AuthorizationFailed": AuthError,
"Neo.ClientError.Security.Unauthorized": AuthError,
# NotALeaderError
"Neo.ClientError.Cluster.NotALeader": NotALeaderError
}
transient_errors = {
# DatabaseUnavailableError
"Neo.TransientError.General.DatabaseUnavailable": DatabaseUnavailableError
}
class SessionExpired(Exception):
""" Raised when no a session is no longer able to fulfil
the purpose described by its original parameters.
"""
def __init__(self, session, *args, **kwargs):
super(SessionExpired, self).__init__(session, *args, **kwargs)
class TransactionError(Exception):
""" Raised when an error occurs while using a transaction.
"""
def __init__(self, transaction, *args, **kwargs):
super(TransactionError, self).__init__(*args, **kwargs)
self.transaction = transaction
| """
This module contains the core driver exceptions.
"""
class Protocolerror(Exception):
""" Raised when an unexpected or unsupported protocol event occurs.
"""
class Serviceunavailable(Exception):
""" Raised when no database service is available.
"""
class Incompletecommiterror(Exception):
""" Raised when a disconnection occurs while still waiting for a commit
response. For non-idempotent write transactions, this leaves the data
in an unknown state with regard to whether the transaction completed
successfully or not.
"""
class Securityerror(Exception):
""" Raised when an action is denied due to security settings.
"""
class Cyphererror(Exception):
""" Raised when the Cypher engine returns an error to the client.
"""
message = None
code = None
classification = None
category = None
title = None
metadata = None
@classmethod
def hydrate(cls, message=None, code=None, **metadata):
message = message or 'An unknown error occurred.'
code = code or 'Neo.DatabaseError.General.UnknownError'
try:
(_, classification, category, title) = code.split('.')
except ValueError:
classification = 'DatabaseError'
category = 'General'
title = 'UnknownError'
error_class = cls._extract_error_class(classification, code)
inst = error_class(message)
inst.message = message
inst.code = code
inst.classification = classification
inst.category = category
inst.title = title
inst.metadata = metadata
return inst
@classmethod
def _extract_error_class(cls, classification, code):
if classification == 'ClientError':
try:
return client_errors[code]
except KeyError:
return ClientError
elif classification == 'TransientError':
try:
return transient_errors[code]
except KeyError:
return TransientError
elif classification == 'DatabaseError':
return DatabaseError
else:
return cls
class Clienterror(CypherError):
""" The Client sent a bad request - changing the request might yield a successful outcome.
"""
class Databaseerror(CypherError):
""" The database failed to service the request.
"""
class Transienterror(CypherError):
""" The database cannot service the request right now, retrying later might yield a successful outcome.
"""
class Databaseunavailableerror(TransientError):
"""
"""
class Constrainterror(ClientError):
"""
"""
class Cyphersyntaxerror(ClientError):
"""
"""
class Cyphertypeerror(ClientError):
"""
"""
class Notaleadererror(ClientError):
"""
"""
class Forbidden(ClientError, SecurityError):
"""
"""
class Forbiddenonreadonlydatabaseerror(Forbidden):
"""
"""
class Autherror(ClientError, SecurityError):
""" Raised when authentication failure occurs.
"""
client_errors = {'Neo.ClientError.Schema.ConstraintValidationFailed': ConstraintError, 'Neo.ClientError.Schema.ConstraintViolation': ConstraintError, 'Neo.ClientError.Statement.ConstraintVerificationFailed': ConstraintError, 'Neo.ClientError.Statement.ConstraintViolation': ConstraintError, 'Neo.ClientError.Statement.InvalidSyntax': CypherSyntaxError, 'Neo.ClientError.Statement.SyntaxError': CypherSyntaxError, 'Neo.ClientError.Procedure.TypeError': CypherTypeError, 'Neo.ClientError.Statement.InvalidType': CypherTypeError, 'Neo.ClientError.Statement.TypeError': CypherTypeError, 'Neo.ClientError.General.ForbiddenOnReadOnlyDatabase': ForbiddenOnReadOnlyDatabaseError, 'Neo.ClientError.General.ReadOnly': Forbidden, 'Neo.ClientError.Schema.ForbiddenOnConstraintIndex': Forbidden, 'Neo.ClientError.Schema.IndexBelongsToConstraint': Forbidden, 'Neo.ClientError.Security.Forbidden': Forbidden, 'Neo.ClientError.Transaction.ForbiddenDueToTransactionType': Forbidden, 'Neo.ClientError.Security.AuthorizationFailed': AuthError, 'Neo.ClientError.Security.Unauthorized': AuthError, 'Neo.ClientError.Cluster.NotALeader': NotALeaderError}
transient_errors = {'Neo.TransientError.General.DatabaseUnavailable': DatabaseUnavailableError}
class Sessionexpired(Exception):
""" Raised when no a session is no longer able to fulfil
the purpose described by its original parameters.
"""
def __init__(self, session, *args, **kwargs):
super(SessionExpired, self).__init__(session, *args, **kwargs)
class Transactionerror(Exception):
""" Raised when an error occurs while using a transaction.
"""
def __init__(self, transaction, *args, **kwargs):
super(TransactionError, self).__init__(*args, **kwargs)
self.transaction = transaction |
class Dummy:
def __str__(self) -> str:
return "dummy"
d1 = Dummy()
print(d1)
| class Dummy:
def __str__(self) -> str:
return 'dummy'
d1 = dummy()
print(d1) |
"""
Problem 1 - https://adventofcode.com/2020/day/2
Part 1 -
Given a list of password and conditions the passwords have to fulfill, return the number of passwords that fulfill the conditions
Part 2 -
Same as part 1 with different conditions
"""
# Set up the input
with open('input-02122020.txt', 'r') as file:
s = file.readlines()
# Solution to part 1
def valid_1(password, lower, upper, letter):
"""
Takes in a password and checks if it is valid
"""
l_count = 0
for char in password:
if char == letter:
l_count += 1
if int(lower) <= l_count <= int(upper):
return 1
else:
return 0
def solve_1(passw):
valid = 0
for p in passw:
password = p.split()[-1]
lower = p.split('-')[0]
upper = p.split()[0].split('-')[-1]
letter = p.split(':')[0][-1]
valid += valid_1(password, lower, upper, letter)
return valid
ans_1 = solve_1(s)
print(ans_1)
# Answer was 418
# Solution to part 2
def valid_2(password, lower, upper, letter):
"""
Takes in a password and checks if it is valid
"""
if password[lower] == letter and password[upper] != letter:
return 1
elif password[lower] != letter and password[upper] == letter:
return 1
else:
return 0
def solve_2(passw):
valid = 0
for p in passw:
password = p.split()[-1]
lower = int(p.split('-')[0]) - 1
upper = int(p.split()[0].split('-')[-1]) - 1
letter = p.split(':')[0][-1]
valid += valid_2(password, lower, upper, letter)
return valid
ans_2 = solve_2(s)
print(ans_2)
# Answer was 616
| """
Problem 1 - https://adventofcode.com/2020/day/2
Part 1 -
Given a list of password and conditions the passwords have to fulfill, return the number of passwords that fulfill the conditions
Part 2 -
Same as part 1 with different conditions
"""
with open('input-02122020.txt', 'r') as file:
s = file.readlines()
def valid_1(password, lower, upper, letter):
"""
Takes in a password and checks if it is valid
"""
l_count = 0
for char in password:
if char == letter:
l_count += 1
if int(lower) <= l_count <= int(upper):
return 1
else:
return 0
def solve_1(passw):
valid = 0
for p in passw:
password = p.split()[-1]
lower = p.split('-')[0]
upper = p.split()[0].split('-')[-1]
letter = p.split(':')[0][-1]
valid += valid_1(password, lower, upper, letter)
return valid
ans_1 = solve_1(s)
print(ans_1)
def valid_2(password, lower, upper, letter):
"""
Takes in a password and checks if it is valid
"""
if password[lower] == letter and password[upper] != letter:
return 1
elif password[lower] != letter and password[upper] == letter:
return 1
else:
return 0
def solve_2(passw):
valid = 0
for p in passw:
password = p.split()[-1]
lower = int(p.split('-')[0]) - 1
upper = int(p.split()[0].split('-')[-1]) - 1
letter = p.split(':')[0][-1]
valid += valid_2(password, lower, upper, letter)
return valid
ans_2 = solve_2(s)
print(ans_2) |
"""
Last one was a bit easy. Let's ramp it up a tad :)
This challenge is close to the real deal. Some of you may get it here. Solve the equation for X.
Example
For string = "99X=1(mod 8)", the output should be
breakDown3(string) = 3.
"99X=1(mod 8)".
To solve this equation, first you must reduce the left side. Make it as small as possible without being negative by decreasing it by mod. So, for example
99X
would reduce to
3x.
Now your expression should look like this:
3X=1(mod 8).
Now that the left side is done, we switch focus to the right side. If we mod by 8, we can safely add or subtract 8 to get the same answer, so we add 8 to the number on the right until we get a number evenly divisible by the left number. So
3X=1(mod 8)
goes to
3x=9(mod 8).
9 is evenly divided by 3, so we stop there. Our final step is to isolate X, so we divide 9 by 3 leaving us with
X=3.
"""
def breakDown3(s):
l, r, m = map(int, re.findall("\d+", s))
while r % l:
r += m
return r / l
| """
Last one was a bit easy. Let's ramp it up a tad :)
This challenge is close to the real deal. Some of you may get it here. Solve the equation for X.
Example
For string = "99X=1(mod 8)", the output should be
breakDown3(string) = 3.
"99X=1(mod 8)".
To solve this equation, first you must reduce the left side. Make it as small as possible without being negative by decreasing it by mod. So, for example
99X
would reduce to
3x.
Now your expression should look like this:
3X=1(mod 8).
Now that the left side is done, we switch focus to the right side. If we mod by 8, we can safely add or subtract 8 to get the same answer, so we add 8 to the number on the right until we get a number evenly divisible by the left number. So
3X=1(mod 8)
goes to
3x=9(mod 8).
9 is evenly divided by 3, so we stop there. Our final step is to isolate X, so we divide 9 by 3 leaving us with
X=3.
"""
def break_down3(s):
(l, r, m) = map(int, re.findall('\\d+', s))
while r % l:
r += m
return r / l |
_use_time = True
try:
_start_time = datetime.utcnow().timestamp()
except Exception:
_use_time = False | _use_time = True
try:
_start_time = datetime.utcnow().timestamp()
except Exception:
_use_time = False |
# -*- coding: utf-8 -*-
"""
sphinxcontrib.websupport.version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2007-2018 by the Sphinx team, see README.
:license: BSD, see LICENSE for details.
"""
__version__ = '1.1.0'
__version_info__ = tuple(map(int, __version__.split('.')))
| """
sphinxcontrib.websupport.version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2007-2018 by the Sphinx team, see README.
:license: BSD, see LICENSE for details.
"""
__version__ = '1.1.0'
__version_info__ = tuple(map(int, __version__.split('.'))) |
# -*- coding: utf-8 -*-
extensions = ['sphinx.ext.viewcode']
master_doc = 'index'
exclude_patterns = ['_build']
viewcode_follow_imported_members = False
| extensions = ['sphinx.ext.viewcode']
master_doc = 'index'
exclude_patterns = ['_build']
viewcode_follow_imported_members = False |
#!/usr/bin/env python
# encoding: utf-8
__all__ = ['gcd']
def gcd(a, b):
"""Compute gcd(a,b)
:param a: first number
:param b: second number
:returns: the gcd
"""
pos_a, _a = (a >= 0), abs(a)
pos_b, _b = (b >= 0), abs(b)
gcd_sgn = (-1 + 2*(pos_a or pos_b))
if _a > _b:
c = _a % _b
else:
c = _b % _a
if c == 0:
return gcd_sgn * min(_a,_b)
elif _a == 1:
return gcd_sgn * _b
elif _b == 1:
return gcd_sgn * _a
else:
return gcd_sgn * gcd(min(_a,_b), c)
if __name__ == '__main__':
print(gcd(3, 15))
print(gcd(3, 15))
print(gcd(-15, -3))
print(gcd(-3, -12))
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del
| __all__ = ['gcd']
def gcd(a, b):
"""Compute gcd(a,b)
:param a: first number
:param b: second number
:returns: the gcd
"""
(pos_a, _a) = (a >= 0, abs(a))
(pos_b, _b) = (b >= 0, abs(b))
gcd_sgn = -1 + 2 * (pos_a or pos_b)
if _a > _b:
c = _a % _b
else:
c = _b % _a
if c == 0:
return gcd_sgn * min(_a, _b)
elif _a == 1:
return gcd_sgn * _b
elif _b == 1:
return gcd_sgn * _a
else:
return gcd_sgn * gcd(min(_a, _b), c)
if __name__ == '__main__':
print(gcd(3, 15))
print(gcd(3, 15))
print(gcd(-15, -3))
print(gcd(-3, -12)) |
'''
Anti-palindrome strings
You are given a string containing only lowercase alphabets. You can swap two adjacent characters any number of times (including 0).
A string is called anti-palindrome if it is not a palindrome. If it is possible to make a string anti-palindrome, then find the lexicographically smallest anti-palindrome. Otherwise, print .
Input format
The first line contains a single integer denoting the number of test cases. The description of test cases follows.
Each line contains a string of lower case alphabets only.
Output format
For each test case, print the answer in a new line.
Constraints
contains only lowercase alphabets.
SAMPLE INPUT
4
bpc
pp
deep
zyx
SAMPLE OUTPUT
bcp
-1
deep
xyz
Explanation
In the first test case, you can create "bcp" which is not a palindrome and it is a lexicographically-smallest string.
In the second test case, you cannot form any anti palindrome.
'''
for _ in range(int(input())):
x=list(input())
if x[::]==x[::-1]:
print(-1)
else:
print(''.join(sorted(x))) | """
Anti-palindrome strings
You are given a string containing only lowercase alphabets. You can swap two adjacent characters any number of times (including 0).
A string is called anti-palindrome if it is not a palindrome. If it is possible to make a string anti-palindrome, then find the lexicographically smallest anti-palindrome. Otherwise, print .
Input format
The first line contains a single integer denoting the number of test cases. The description of test cases follows.
Each line contains a string of lower case alphabets only.
Output format
For each test case, print the answer in a new line.
Constraints
contains only lowercase alphabets.
SAMPLE INPUT
4
bpc
pp
deep
zyx
SAMPLE OUTPUT
bcp
-1
deep
xyz
Explanation
In the first test case, you can create "bcp" which is not a palindrome and it is a lexicographically-smallest string.
In the second test case, you cannot form any anti palindrome.
"""
for _ in range(int(input())):
x = list(input())
if x[:] == x[::-1]:
print(-1)
else:
print(''.join(sorted(x))) |
"""
all opcodes Python3.6.0
"""
# general
NOP = 9
POP_TOP = 1
ROT_TWO = 2
ROT_THREE = 3
DUP_TOP = 4
DUP_TOP_TWO = 5
# one operand
UNARY_POSITIVE = 10
UNARY_NEGATIVE = 11
UNARY_NOT = 12
UNARY_INVERT = 15
GET_ITER = 68
GET_YIELD_FROM_ITER = 69
# two operand
BINARY_POWER = 19
BINARY_MULTIPLY = 20
BINARY_MATRIX_MULTIPLY = 16
BINARY_FLOOR_DIVIDE = 26
BINARY_TRUE_DIVIDE = 27
BINARY_MODULO = 22
BINARY_ADD = 23
BINARY_SUBTRACT = 24
BINARY_SUBSCR = 25
BINARY_LSHIFT = 62
BINARY_RSHIFT = 63
BINARY_AND = 64
BINARY_XOR = 65
BINARY_OR = 66
# inplace
INPLACE_POWER = 67
INPLACE_MULTIPLY = 57
INPLACE_MATRIX_MULTIPLY = 17
INPLACE_FLOOR_DIVIDE = 28
INPLACE_TRUE_DIVIDE = 29
INPLACE_MODULO = 59
INPLACE_ADD = 55
INPLACE_SUBTRACT = 56
STORE_SUBSCR = 60
DELETE_SUBSCR = 61
INPLACE_LSHIFT = 75
INPLACE_RSHIFT = 76
INPLACE_AND = 77
INPLACE_XOR = 78
INPLACE_OR = 79
# coroutine (not implemented)
GET_AWAITABLE = 73
GET_AITER = 50
GET_ANEXT = 51
BEFORE_ASYNC_WITH = 52
SETUP_ASYNC_WITH = 154
# loop
FOR_ITER = 93
SETUP_LOOP = 120 # Distance to target address
BREAK_LOOP = 80
CONTINUE_LOOP = 119 # Target address
# comprehension
SET_ADD = 146
LIST_APPEND = 145
MAP_ADD = 147
# return
RETURN_VALUE = 83
YIELD_VALUE = 86
YIELD_FROM = 72
SETUP_ANNOTATIONS = 85
# context
SETUP_WITH = 143
WITH_CLEANUP_START = 81
WITH_CLEANUP_FINISH = 82
# import
IMPORT_STAR = 84
IMPORT_NAME = 108 # Index in name list
IMPORT_FROM = 109 # Index in name list
# block stack
POP_BLOCK = 87
SETUP_EXCEPT = 121 # ""
SETUP_FINALLY = 122 # ""
POP_EXCEPT = 89
END_FINALLY = 88
# variable
STORE_NAME = 90 # Index in name list
DELETE_NAME = 91 # ""
UNPACK_SEQUENCE = 92 # Number of tuple items
UNPACK_EX = 94
STORE_ATTR = 95 # Index in name list
DELETE_ATTR = 96 # ""
STORE_GLOBAL = 97 # ""
DELETE_GLOBAL = 98 # ""
# load
LOAD_CONST = 100 # Index in const list
LOAD_NAME = 101 # Index in name list
LOAD_ATTR = 106 # Index in name list
LOAD_GLOBAL = 116 # Index in name list
LOAD_FAST = 124 # Local variable number
STORE_FAST = 125 # Local variable number
DELETE_FAST = 126 # Local variable number
# build object
BUILD_TUPLE = 102 # Number of tuple items
BUILD_LIST = 103 # Number of list items
BUILD_SET = 104 # Number of set items
BUILD_MAP = 105 # Number of dict entries
BUILD_CONST_KEY_MAP = 156
BUILD_STRING = 157
BUILD_TUPLE_UNPACK = 152
BUILD_LIST_UNPACK = 149
BUILD_MAP_UNPACK = 150
BUILD_SET_UNPACK = 153
BUILD_MAP_UNPACK_WITH_CALL = 151
BUILD_TUPLE_UNPACK_WITH_CALL = 158
# bool
COMPARE_OP = 107 # Comparison operator
# counter
JUMP_FORWARD = 110 # Number of bytes to skip
POP_JUMP_IF_TRUE = 115 # ""
POP_JUMP_IF_FALSE = 114 # ""
JUMP_IF_TRUE_OR_POP = 112 # ""
JUMP_IF_FALSE_OR_POP = 111 # Target byte offset from beginning of code
JUMP_ABSOLUTE = 113 # ""
# exception
RAISE_VARARGS = 130 # Number of raise arguments (1, 2, or 3)
# function
CALL_FUNCTION = 131 # #args
MAKE_FUNCTION = 132 # Flags
BUILD_SLICE = 133 # Number of items
LOAD_CLOSURE = 135
LOAD_DEREF = 136
STORE_DEREF = 137
DELETE_DEREF = 138
CALL_FUNCTION_KW = 141 # #args + #kwargs
CALL_FUNCTION_EX = 142 # Flags
LOAD_CLASSDEREF = 148
# others
PRINT_EXPR = 70
LOAD_BUILD_CLASS = 71
HAVE_ARGUMENT = 90 # Opcodes from here have an argument:
EXTENDED_ARG = 144
FORMAT_VALUE = 155
| """
all opcodes Python3.6.0
"""
nop = 9
pop_top = 1
rot_two = 2
rot_three = 3
dup_top = 4
dup_top_two = 5
unary_positive = 10
unary_negative = 11
unary_not = 12
unary_invert = 15
get_iter = 68
get_yield_from_iter = 69
binary_power = 19
binary_multiply = 20
binary_matrix_multiply = 16
binary_floor_divide = 26
binary_true_divide = 27
binary_modulo = 22
binary_add = 23
binary_subtract = 24
binary_subscr = 25
binary_lshift = 62
binary_rshift = 63
binary_and = 64
binary_xor = 65
binary_or = 66
inplace_power = 67
inplace_multiply = 57
inplace_matrix_multiply = 17
inplace_floor_divide = 28
inplace_true_divide = 29
inplace_modulo = 59
inplace_add = 55
inplace_subtract = 56
store_subscr = 60
delete_subscr = 61
inplace_lshift = 75
inplace_rshift = 76
inplace_and = 77
inplace_xor = 78
inplace_or = 79
get_awaitable = 73
get_aiter = 50
get_anext = 51
before_async_with = 52
setup_async_with = 154
for_iter = 93
setup_loop = 120
break_loop = 80
continue_loop = 119
set_add = 146
list_append = 145
map_add = 147
return_value = 83
yield_value = 86
yield_from = 72
setup_annotations = 85
setup_with = 143
with_cleanup_start = 81
with_cleanup_finish = 82
import_star = 84
import_name = 108
import_from = 109
pop_block = 87
setup_except = 121
setup_finally = 122
pop_except = 89
end_finally = 88
store_name = 90
delete_name = 91
unpack_sequence = 92
unpack_ex = 94
store_attr = 95
delete_attr = 96
store_global = 97
delete_global = 98
load_const = 100
load_name = 101
load_attr = 106
load_global = 116
load_fast = 124
store_fast = 125
delete_fast = 126
build_tuple = 102
build_list = 103
build_set = 104
build_map = 105
build_const_key_map = 156
build_string = 157
build_tuple_unpack = 152
build_list_unpack = 149
build_map_unpack = 150
build_set_unpack = 153
build_map_unpack_with_call = 151
build_tuple_unpack_with_call = 158
compare_op = 107
jump_forward = 110
pop_jump_if_true = 115
pop_jump_if_false = 114
jump_if_true_or_pop = 112
jump_if_false_or_pop = 111
jump_absolute = 113
raise_varargs = 130
call_function = 131
make_function = 132
build_slice = 133
load_closure = 135
load_deref = 136
store_deref = 137
delete_deref = 138
call_function_kw = 141
call_function_ex = 142
load_classderef = 148
print_expr = 70
load_build_class = 71
have_argument = 90
extended_arg = 144
format_value = 155 |
def bom_populate(bom):
bom.components.new(
name="s1",
description="HPE ML30 INTEL, 4U Tower, 8 HD's fit inside, 1 gbit dual",
cost=378,
rackspace_u=0,
cru=0,
sru=0,
hru=0,
mru=0,
su_perc=50,
cu_perc=50,
power=150,
)
bom.components.new(
name="s2",
description="HPE ML110 INTEL, 4U Tower, 8 HD's fit inside, 1 gbit dual",
cost=454,
rackspace_u=4,
cru=0,
sru=0,
hru=0,
mru=0,
su_perc=90,
cu_perc=10,
power=150,
)
bom.components.new(name="margin", description="margin per node for threefold and its partners", power=0, cost=500)
bom.components.new(
name="hd12", description="HPE 12TB SATA 6G Midline 7.2K LFF (6-8 watt)", cost=350, hru=12000, power=10, su_perc=100
)
bom.components.new(
name="intel1",
description="Intel Xeon E-2224 (3.4GHz/4-core/71W) (4 logical cores)",
cost=296,
cru=4,
power=80,
cu_perc=100,
passmark=8202,
)
bom.components.new(
name="intel2",
description="Intel Xeon-Silver 4208 (2.1GHz/8-core/85W) (16 logical cores)",
cost=576,
cru=16,
power=85,
cu_perc=100,
passmark=13867,
)
bom.components.new(
name="intel3",
description="Intel Xeon-Silver 4216 (2.1GHz/16-core/100W) (32 logical cores)",
cost=1041,
cru=16,
power=100,
cu_perc=100,
passmark=20656,
)
bom.components.new(name="ssd1", description="960 GB HPE SSD", cost=180, sru=1920, power=10, su_perc=100)
bom.components.new(name="mem16_ecc", description="mem 16", cost=98, mru=16, power=8, cu_perc=100)
bom.components.new(name="mem32_ecc", description="mem 32", cost=220, mru=32, power=8, cu_perc=100)
#bom.components.new(name="sas_contr", description="HPE Smart Array E208i-p SR Gen10 (8 Internal Lanes/No Cache)", cost=60, power=20, su_perc=100)
#bom.components.new(name="power_supply", description="350 Power Supply", cost=16, power=0, cu_perc=50, su_perc=50)
#bom.components.new(name="sas_cable", description="sas cable kit", cost=33, power=0, su_perc=100)
#bom.components.new(name="front_fan", description="front fan kit", cost=44, power=0, cu_perc=50, su_perc=50)
bom.components.new(
name="ng2",
description="48 ports 10 gbit + 4 ports 10 gbit sfp: fs.com + cables",
cost=1,
power=100,
rackspace_u=1,
)
# create the template ml30
d = bom.devices.new(name="hpe_compute_tower_ml30")
d.components.new(name="s1", nr=1)
d.components.new(name="intel1", nr=1)
d.components.new(name="hd12", nr=2)
d.components.new(name="mem16_ecc", nr=1)
d.components.new(name="ssd1", nr=1)
#d.components.new(name="sas_contr", nr=1)
#d.components.new(name="power_supply", nr=1)
#d.components.new(name="sas_cable", nr=1)
#d.components.new(name="front_fan", nr=1)
# create the template ml110 8core
d = bom.devices.new(name="hpe_compute_tower_ml110_8")
d.components.new(name="s2", nr=1)
d.components.new(name="intel2", nr=1)
d.components.new(name="hd12", nr=2)
d.components.new(name="mem32_ecc", nr=2)
d.components.new(name="ssd1", nr=1)
#d.components.new(name="sas_contr", nr=1)
#d.components.new(name="power_supply", nr=1)
# create the template ml110 16core
d = bom.devices.new(name="hpe_compute_tower_ml110_16")
d.components.new(name="s2", nr=1)
d.components.new(name="intel3", nr=1)
d.components.new(name="hd12", nr=2)
d.components.new(name="mem32_ecc", nr=2)
d.components.new(name="ssd1", nr=1)
#d.components.new(name="sas_contr", nr=1)
#d.components.new(name="power_supply", nr=1)
d = bom.devices.new(name="switch_48")
d.components.new(name="ng2", nr=1)
return bom
| def bom_populate(bom):
bom.components.new(name='s1', description="HPE ML30 INTEL, 4U Tower, 8 HD's fit inside, 1 gbit dual", cost=378, rackspace_u=0, cru=0, sru=0, hru=0, mru=0, su_perc=50, cu_perc=50, power=150)
bom.components.new(name='s2', description="HPE ML110 INTEL, 4U Tower, 8 HD's fit inside, 1 gbit dual", cost=454, rackspace_u=4, cru=0, sru=0, hru=0, mru=0, su_perc=90, cu_perc=10, power=150)
bom.components.new(name='margin', description='margin per node for threefold and its partners', power=0, cost=500)
bom.components.new(name='hd12', description='HPE 12TB SATA 6G Midline 7.2K LFF (6-8 watt)', cost=350, hru=12000, power=10, su_perc=100)
bom.components.new(name='intel1', description='Intel Xeon E-2224 (3.4GHz/4-core/71W) (4 logical cores)', cost=296, cru=4, power=80, cu_perc=100, passmark=8202)
bom.components.new(name='intel2', description='Intel Xeon-Silver 4208 (2.1GHz/8-core/85W) (16 logical cores)', cost=576, cru=16, power=85, cu_perc=100, passmark=13867)
bom.components.new(name='intel3', description='Intel Xeon-Silver 4216 (2.1GHz/16-core/100W) (32 logical cores)', cost=1041, cru=16, power=100, cu_perc=100, passmark=20656)
bom.components.new(name='ssd1', description='960 GB HPE SSD', cost=180, sru=1920, power=10, su_perc=100)
bom.components.new(name='mem16_ecc', description='mem 16', cost=98, mru=16, power=8, cu_perc=100)
bom.components.new(name='mem32_ecc', description='mem 32', cost=220, mru=32, power=8, cu_perc=100)
bom.components.new(name='ng2', description='48 ports 10 gbit + 4 ports 10 gbit sfp: fs.com + cables', cost=1, power=100, rackspace_u=1)
d = bom.devices.new(name='hpe_compute_tower_ml30')
d.components.new(name='s1', nr=1)
d.components.new(name='intel1', nr=1)
d.components.new(name='hd12', nr=2)
d.components.new(name='mem16_ecc', nr=1)
d.components.new(name='ssd1', nr=1)
d = bom.devices.new(name='hpe_compute_tower_ml110_8')
d.components.new(name='s2', nr=1)
d.components.new(name='intel2', nr=1)
d.components.new(name='hd12', nr=2)
d.components.new(name='mem32_ecc', nr=2)
d.components.new(name='ssd1', nr=1)
d = bom.devices.new(name='hpe_compute_tower_ml110_16')
d.components.new(name='s2', nr=1)
d.components.new(name='intel3', nr=1)
d.components.new(name='hd12', nr=2)
d.components.new(name='mem32_ecc', nr=2)
d.components.new(name='ssd1', nr=1)
d = bom.devices.new(name='switch_48')
d.components.new(name='ng2', nr=1)
return bom |
class Model:
def to_dict(self):
return NotImplementedError
class User(Model):
def to_dict(self):
return {}
class UserID(Model):
def to_dict(self):
return {}
class UserAuth(Model):
def to_dict(self):
return {}
| class Model:
def to_dict(self):
return NotImplementedError
class User(Model):
def to_dict(self):
return {}
class Userid(Model):
def to_dict(self):
return {}
class Userauth(Model):
def to_dict(self):
return {} |
# @file dsc_processor_plugin
# Plugin for for parsing DSCs
##
# Copyright (c) Microsoft Corporation
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
class IDscProcessorPlugin(object):
##
# does the transform on the DSC
#
# @param dsc - the in-memory model of the DSC
# @param thebuilder - UefiBuild object to get env information
#
# @return 0 for success NonZero for error.
##
def do_transform(self, dsc, thebuilder):
return 0
##
# gets the level that this transform operates at
#
# @param thebuilder - UefiBuild object to get env information
#
# @return 0 for the most generic level
##
def get_level(self, thebuilder):
return 0
| class Idscprocessorplugin(object):
def do_transform(self, dsc, thebuilder):
return 0
def get_level(self, thebuilder):
return 0 |
def q2(stop_value):
first, second = 0, 1
i = 0
while first < stop_value:
print(f"{i}th term is: {first}")
first, second = first + second, first
i += 1
if __name__ == "__main__":
n = 20
q2(n)
| def q2(stop_value):
(first, second) = (0, 1)
i = 0
while first < stop_value:
print(f'{i}th term is: {first}')
(first, second) = (first + second, first)
i += 1
if __name__ == '__main__':
n = 20
q2(n) |
def titulo():
print('~' * 80)
print('{:^80}'.format('Sistema Interativo PyHelp'))
print('~' * 80)
def leia_comando():
comando = str(input(
'> Insira o comando que deseja obter ajuda: ("fim" para encerrar) ')).lower().strip()
return comando
def imprimir_manual(_comando):
try:
print()
help(_comando)
print()
except:
pass
def encerramento():
print('-' * 80)
print('{:^80}'.format('Obrigado por utilizar o PyHelp!'))
print('-' * 80)
while True:
titulo()
comando = leia_comando()
imprimir_manual(comando)
if comando == 'fim':
encerramento()
break
| def titulo():
print('~' * 80)
print('{:^80}'.format('Sistema Interativo PyHelp'))
print('~' * 80)
def leia_comando():
comando = str(input('> Insira o comando que deseja obter ajuda: ("fim" para encerrar) ')).lower().strip()
return comando
def imprimir_manual(_comando):
try:
print()
help(_comando)
print()
except:
pass
def encerramento():
print('-' * 80)
print('{:^80}'.format('Obrigado por utilizar o PyHelp!'))
print('-' * 80)
while True:
titulo()
comando = leia_comando()
imprimir_manual(comando)
if comando == 'fim':
encerramento()
break |
class Status:
""" If you create a custom Status symbol, please keep in mind that
all statuses are registered globally and that can cause name collisions.
However, it's an intended use case for your checks to be able to yield
custom statuses. Interpreters of the check protocol will have to skip
statuses unknown to them or treat them in an otherwise non-fatal fashion.
"""
def __new__(cls, name, weight=0):
""" Don't create two instances with same name.
>>> a = Status('PASS')
>>> a
<Status hello>
>>> b = Status('PASS')
>>> b
<Status hello>
>>> b is a
True
>>> b == a
True
"""
instance = cls.__instances.get(name, None)
if instance is None:
instance = cls.__instances[name] = super(Status, cls).__new__(cls)
setattr(instance, '_Status__name', name)
setattr(instance, '_Status__weight', weight)
return instance
__instances = {}
def __str__(self):
return f'<Status {self.__name}>'
@property
def name(self):
return self.__name
@property
def weight(self):
return self.__weight
def __gt__(self, other):
return self.weight > other.weight
def __ge__(self, other):
return self.weight >= other.weight
def __lt__(self, other):
return self.weight < other.weight
def __le__(self, other):
return self.weight <= other.weight
__repr__ = __str__
# Status messages of the check runner protocol
# Structuring statuses
# * begin with "START" and "END"
# * have weights < 0
# * START statuses have even weight, corresponding END statuses have odd
# weights, such that START.weight + 1 == END.weight
# * the bigger the weight the bigger is the structure, structuring on a macro-level
# * different structures can have the same weights, if they occur on the same level
# * ENDCHECK is the biggest structuring status
#
# Log statuses
# * have weights >= 0
# * the more important the status the bigger the weight
# * ERROR has the biggest weight
# * PASS is the lowest status a check can have,
# i.e.: a check run must at least yield one log that is >= PASS
#
# From all the statuses that can occur within a check, the "worst" one
# is defining for the check overall status:
# ERROR > FAIL > WARN > INFO > SKIP > PASS > DEBUG
# Anything from WARN to PASS does not make a check fail.
# A result < PASS creates an ERROR. That means, DEBUG is not a valid
# result of a check, nor is any of the structuring statuses.
# A check with SKIP can't (MUST NOT) create any other event.
# Log statuses
# only between STARTCHECK and ENDCHECK:
DEBUG = Status('DEBUG', 0) # Silent by default
PASS = Status('PASS', 1)
SKIP = Status('SKIP', 2) # SKIP is heavier than PASS because it's likely more interesting to
# see what got skipped, to reveal blind spots.
INFO = Status('INFO', 3)
WARN = Status('WARN', 4) # A check that results in WARN may indicate a problem, but also may be OK.
FAIL = Status('FAIL', 5) # A FAIL is a problem detected in the font or family.
ERROR = Status('ERROR', 6) # Something a programmer must fix. It will make a check fail as well.
# Start of the suite of checks. Must be always the first message, even in async mode.
# Message is the full execution order of the whole profile
START = Status('START', -6)
# Only between START and before the first SECTIONSUMMARY and END
# Message is None.
STARTCHECK = Status('STARTCHECK', -2)
# Ends the last check started by STARTCHECK.
# Message the the result status of the whole check, one of PASS, SKIP, FAIL, ERROR.
ENDCHECK = Status('ENDCHECK', -1)
# After the last ENDCHECK one SECTIONSUMMARY for each section before END.
# Message is a tuple of:
# * the actual execution order of the section in the check runner session
# as reported. Especially in async mode, the order can differ significantly
# from the actual order of checks in the session.
# * a Counter dictionary where the keys are Status.name of
# the ENDCHECK message. If serialized, some existing statuses may not be
# in the counter because they never occurred in the section.
SECTIONSUMMARY = Status('SECTIONSUMMARY', -3)
# End of the suite of checks. Must be always the last message, even in async mode.
# Message is a counter as described in SECTIONSUMMARY, but with the collected
# results of all checks in all sections.
END = Status('END', -5)
| class Status:
""" If you create a custom Status symbol, please keep in mind that
all statuses are registered globally and that can cause name collisions.
However, it's an intended use case for your checks to be able to yield
custom statuses. Interpreters of the check protocol will have to skip
statuses unknown to them or treat them in an otherwise non-fatal fashion.
"""
def __new__(cls, name, weight=0):
""" Don't create two instances with same name.
>>> a = Status('PASS')
>>> a
<Status hello>
>>> b = Status('PASS')
>>> b
<Status hello>
>>> b is a
True
>>> b == a
True
"""
instance = cls.__instances.get(name, None)
if instance is None:
instance = cls.__instances[name] = super(Status, cls).__new__(cls)
setattr(instance, '_Status__name', name)
setattr(instance, '_Status__weight', weight)
return instance
__instances = {}
def __str__(self):
return f'<Status {self.__name}>'
@property
def name(self):
return self.__name
@property
def weight(self):
return self.__weight
def __gt__(self, other):
return self.weight > other.weight
def __ge__(self, other):
return self.weight >= other.weight
def __lt__(self, other):
return self.weight < other.weight
def __le__(self, other):
return self.weight <= other.weight
__repr__ = __str__
debug = status('DEBUG', 0)
pass = status('PASS', 1)
skip = status('SKIP', 2)
info = status('INFO', 3)
warn = status('WARN', 4)
fail = status('FAIL', 5)
error = status('ERROR', 6)
start = status('START', -6)
startcheck = status('STARTCHECK', -2)
endcheck = status('ENDCHECK', -1)
sectionsummary = status('SECTIONSUMMARY', -3)
end = status('END', -5) |
"""Detects and configures the local Python.
Add the following to your WORKSPACE FILE:
```python
python_configure(name = "cpython37", interpreter = "python3.7")
```
Args:
name: A unique name for this workspace rule.
interpreter: interpreter used to config this workspace
"""
def _tpl(repository_ctx, tpl, substitutions = {}, out = None):
if not out:
out = tpl
repository_ctx.template(
out,
Label("//third_party/cpython:%s.tpl" % tpl),
substitutions,
)
def _fail(msg):
"""Output failure message when auto configuration fails."""
red = "\033[0;31m"
no_color = "\033[0m"
fail("%sPython Configuration Error:%s %s\n" % (red, no_color, msg))
def _execute(
repository_ctx,
cmdline,
error_msg = None,
error_details = None,
empty_stdout_fine = False,
environment = {}):
"""Executes an arbitrary shell command.
Args:
repository_ctx: the repository_ctx object
cmdline: list of strings, the command to execute
error_msg: string, a summary of the error if the command fails
error_details: string, details about the error or steps to fix it
empty_stdout_fine: bool, if True, an empty stdout result is fine, otherwise
it's an error
environment: environment variables passed to repository_ctx.execute
Return:
the result of repository_ctx.execute(cmdline)
"""
result = repository_ctx.execute(cmdline, environment = environment)
if result.stderr or not (empty_stdout_fine or result.stdout):
_fail("\n".join([
error_msg.strip() if error_msg else "Repository command failed",
result.stderr.strip(),
error_details if error_details else "",
]))
return result
def _get_bin(repository_ctx, bin_name):
"""Gets the bin path."""
bin_path = repository_ctx.which(bin_name)
if bin_path != None:
return str(bin_path)
_fail("Cannot find %s in PATH" % bin_name)
def _get_python_include(repository_ctx, python_bin):
"""Gets the python include path."""
result = _execute(
repository_ctx,
[
python_bin,
"-c",
"from __future__ import print_function;" +
"from distutils import sysconfig;" +
"print(sysconfig.get_python_inc())",
],
error_msg = "Problem getting python include path.",
)
return repository_ctx.path(result.stdout.splitlines()[0])
def _get_python_import_lib_path(repository_ctx, python_bin):
"""Get Python import library"""
result = _execute(
repository_ctx,
[
python_bin,
"-c",
"from __future__ import print_function;" +
"from distutils import sysconfig; import os; " +
'print(os.path.join(*sysconfig.get_config_vars("LIBDIR", "LDLIBRARY")))',
],
error_msg = "Problem getting python import library.",
)
return repository_ctx.path(result.stdout.splitlines()[0])
def _get_python_version(repository_ctx, python_bin):
"""Get Python import library"""
result = _execute(
repository_ctx,
[
python_bin,
"-c",
"from __future__ import print_function;" +
"import sys;" +
"print(sys.version_info[0]);" +
"print(sys.version_info[1])",
],
error_msg = "Problem getting python versiony.",
)
return [int(v) for v in result.stdout.splitlines()]
def _get_python_config_flags(repository_ctx, python_config_bin, flags):
result = _execute(
repository_ctx,
[
python_config_bin,
flags,
],
error_msg = "Problem getting python-config %s." % flags,
).stdout.splitlines()[0]
return ",\n ".join([
'"%s"' % flag
for flag in result.split(" ")
if not flag.startswith("-I")
])
def _python_autoconf_impl(repository_ctx):
"""Implementation of the python_autoconf repository rule.
Creates the repository containing files set up to build with Python.
"""
python_bin = _get_bin(repository_ctx, repository_ctx.attr.interpreter)
python_include = _get_python_include(repository_ctx, python_bin)
python_import_lib = _get_python_import_lib_path(repository_ctx, python_bin)
python_version = _get_python_version(repository_ctx, python_bin)
if repository_ctx.attr.devel:
python_config_bin = _get_bin(repository_ctx, repository_ctx.attr.interpreter + "-config")
python_cflags = _get_python_config_flags(repository_ctx, python_config_bin, "--cflags")
python_ldflags = _get_python_config_flags(repository_ctx, python_config_bin, "--ldflags")
if python_version[0] > 2:
python_extension_suffix = _get_python_config_flags(repository_ctx, python_config_bin, "--extension-suffix")
else:
python_extension_suffix = '".so"'
repository_ctx.symlink(python_bin, "python")
repository_ctx.symlink(python_include, "include")
repository_ctx.symlink(python_import_lib, "lib/" + python_import_lib.basename)
_tpl(repository_ctx, "BUILD")
_tpl(repository_ctx, "defs.bzl", substitutions = {
"%{CPYTHON}": repository_ctx.name,
"%{CFLAGS}": python_cflags,
"%{LDFLAGS}": python_ldflags,
"%{EXTENSION_SUFFIX}": python_extension_suffix,
})
python_configure = repository_rule(
attrs = {
"interpreter": attr.string(),
"devel": attr.bool(default = False, doc = "Add support for compiling python extension"),
},
implementation = _python_autoconf_impl,
configure = True,
local = True,
)
| """Detects and configures the local Python.
Add the following to your WORKSPACE FILE:
```python
python_configure(name = "cpython37", interpreter = "python3.7")
```
Args:
name: A unique name for this workspace rule.
interpreter: interpreter used to config this workspace
"""
def _tpl(repository_ctx, tpl, substitutions={}, out=None):
if not out:
out = tpl
repository_ctx.template(out, label('//third_party/cpython:%s.tpl' % tpl), substitutions)
def _fail(msg):
"""Output failure message when auto configuration fails."""
red = '\x1b[0;31m'
no_color = '\x1b[0m'
fail('%sPython Configuration Error:%s %s\n' % (red, no_color, msg))
def _execute(repository_ctx, cmdline, error_msg=None, error_details=None, empty_stdout_fine=False, environment={}):
"""Executes an arbitrary shell command.
Args:
repository_ctx: the repository_ctx object
cmdline: list of strings, the command to execute
error_msg: string, a summary of the error if the command fails
error_details: string, details about the error or steps to fix it
empty_stdout_fine: bool, if True, an empty stdout result is fine, otherwise
it's an error
environment: environment variables passed to repository_ctx.execute
Return:
the result of repository_ctx.execute(cmdline)
"""
result = repository_ctx.execute(cmdline, environment=environment)
if result.stderr or not (empty_stdout_fine or result.stdout):
_fail('\n'.join([error_msg.strip() if error_msg else 'Repository command failed', result.stderr.strip(), error_details if error_details else '']))
return result
def _get_bin(repository_ctx, bin_name):
"""Gets the bin path."""
bin_path = repository_ctx.which(bin_name)
if bin_path != None:
return str(bin_path)
_fail('Cannot find %s in PATH' % bin_name)
def _get_python_include(repository_ctx, python_bin):
"""Gets the python include path."""
result = _execute(repository_ctx, [python_bin, '-c', 'from __future__ import print_function;' + 'from distutils import sysconfig;' + 'print(sysconfig.get_python_inc())'], error_msg='Problem getting python include path.')
return repository_ctx.path(result.stdout.splitlines()[0])
def _get_python_import_lib_path(repository_ctx, python_bin):
"""Get Python import library"""
result = _execute(repository_ctx, [python_bin, '-c', 'from __future__ import print_function;' + 'from distutils import sysconfig; import os; ' + 'print(os.path.join(*sysconfig.get_config_vars("LIBDIR", "LDLIBRARY")))'], error_msg='Problem getting python import library.')
return repository_ctx.path(result.stdout.splitlines()[0])
def _get_python_version(repository_ctx, python_bin):
"""Get Python import library"""
result = _execute(repository_ctx, [python_bin, '-c', 'from __future__ import print_function;' + 'import sys;' + 'print(sys.version_info[0]);' + 'print(sys.version_info[1])'], error_msg='Problem getting python versiony.')
return [int(v) for v in result.stdout.splitlines()]
def _get_python_config_flags(repository_ctx, python_config_bin, flags):
result = _execute(repository_ctx, [python_config_bin, flags], error_msg='Problem getting python-config %s.' % flags).stdout.splitlines()[0]
return ',\n '.join(['"%s"' % flag for flag in result.split(' ') if not flag.startswith('-I')])
def _python_autoconf_impl(repository_ctx):
"""Implementation of the python_autoconf repository rule.
Creates the repository containing files set up to build with Python.
"""
python_bin = _get_bin(repository_ctx, repository_ctx.attr.interpreter)
python_include = _get_python_include(repository_ctx, python_bin)
python_import_lib = _get_python_import_lib_path(repository_ctx, python_bin)
python_version = _get_python_version(repository_ctx, python_bin)
if repository_ctx.attr.devel:
python_config_bin = _get_bin(repository_ctx, repository_ctx.attr.interpreter + '-config')
python_cflags = _get_python_config_flags(repository_ctx, python_config_bin, '--cflags')
python_ldflags = _get_python_config_flags(repository_ctx, python_config_bin, '--ldflags')
if python_version[0] > 2:
python_extension_suffix = _get_python_config_flags(repository_ctx, python_config_bin, '--extension-suffix')
else:
python_extension_suffix = '".so"'
repository_ctx.symlink(python_bin, 'python')
repository_ctx.symlink(python_include, 'include')
repository_ctx.symlink(python_import_lib, 'lib/' + python_import_lib.basename)
_tpl(repository_ctx, 'BUILD')
_tpl(repository_ctx, 'defs.bzl', substitutions={'%{CPYTHON}': repository_ctx.name, '%{CFLAGS}': python_cflags, '%{LDFLAGS}': python_ldflags, '%{EXTENSION_SUFFIX}': python_extension_suffix})
python_configure = repository_rule(attrs={'interpreter': attr.string(), 'devel': attr.bool(default=False, doc='Add support for compiling python extension')}, implementation=_python_autoconf_impl, configure=True, local=True) |
# Mu Lung Dojo Bulletin Board (2091006) | Mu Lung Temple (250000100)
dojo = 925020000
response = sm.sendAskYesNo("Would you like to go to Mu Lung Dojo?")
if response:
sm.setReturnField()
sm.setReturnPortal(0)
sm.warp(dojo) | dojo = 925020000
response = sm.sendAskYesNo('Would you like to go to Mu Lung Dojo?')
if response:
sm.setReturnField()
sm.setReturnPortal(0)
sm.warp(dojo) |
# --------------
# Code starts here
class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes']
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(new_class)
# Code ends here
# --------------
# Code starts here
courses= {'Math': 65, 'English': 70, 'History': 80, 'French': 70, 'Science': 60}
print(courses)
total= sum(courses.values())
print(total)
percentage = total / 500 * 100
print(percentage)
# Code ends here
# --------------
# Code starts here
mathematics= {'Geoffrey Hinton':78, 'Andrew Ng':95, 'Sebastian Raschka':65, 'Yoshua Bengio':50, 'Hilary Mason':70, 'Corinna Cortes':66, 'Peter Warden':75}
topper= max(mathematics,key = mathematics.get)
print(topper)
# Code ends here
# --------------
# Given string
topper = 'andrew ng'
# Code starts here
first_name,last_name = topper.split( )
full_name = last_name + ' ' + first_name
certificate_name = full_name.upper()
print(certificate_name)
#print(first_name)
#print(last_name)
# Code ends here
| class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes']
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(new_class)
courses = {'Math': 65, 'English': 70, 'History': 80, 'French': 70, 'Science': 60}
print(courses)
total = sum(courses.values())
print(total)
percentage = total / 500 * 100
print(percentage)
mathematics = {'Geoffrey Hinton': 78, 'Andrew Ng': 95, 'Sebastian Raschka': 65, 'Yoshua Bengio': 50, 'Hilary Mason': 70, 'Corinna Cortes': 66, 'Peter Warden': 75}
topper = max(mathematics, key=mathematics.get)
print(topper)
topper = 'andrew ng'
(first_name, last_name) = topper.split()
full_name = last_name + ' ' + first_name
certificate_name = full_name.upper()
print(certificate_name) |
"""
Spark mllib
Algorithms ->
Classification
regression
clustering
topic modelling.
etc.
workflows ->
feature transformations
pipelines
evaluations
hyperparameter
tuning
utilities ->
Distributed math libraries
statistics
functions
"""
# Normalize -> maps data from original range to range of 0 to 1
# Advantage of Normalization is large range values and small range values are brough to common range and that is 0 to 1.
# Standardize -> Maps data from origninal range to range -1 to 1
# mean is 0
# normally distributed with standard deviation of 1
# Used when features have different scales and
# ML algorithms assume a normal distribution.
# Patitioning -> Maps data value from continuous values to buckets
# Deciles and percentiles ane examples of buckets
# useful when you want to work with groups of values
# instead of a continuous range of values.
# TEXT: TOkeniziong -> list of words.
# TEXT: TF-IDF -> Maps text from a single, typically long strings to a vector of frequencies of each word relative to a text.
# TF-IDF assumes infrequently used workds are more useful to classify text.
##### NORMALIZING
| """
Spark mllib
Algorithms ->
Classification
regression
clustering
topic modelling.
etc.
workflows ->
feature transformations
pipelines
evaluations
hyperparameter
tuning
utilities ->
Distributed math libraries
statistics
functions
""" |
badge_icon = 'app.icns'
icon_locations = {
'LBRY.app': (115, 164),
'Applications': (387, 164)
}
background='dmg_background.png'
default_view='icon-view'
symlinks = { 'Applications': '/Applications' }
window_rect=((200, 200), (500, 320))
files = [ 'LBRY.app' ]
icon_size=128
| badge_icon = 'app.icns'
icon_locations = {'LBRY.app': (115, 164), 'Applications': (387, 164)}
background = 'dmg_background.png'
default_view = 'icon-view'
symlinks = {'Applications': '/Applications'}
window_rect = ((200, 200), (500, 320))
files = ['LBRY.app']
icon_size = 128 |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 11 01:37:09 2018
@author: sushy
"""
secretWord = 'apple'
lettersGuessed = ['e', 'i', 'k', 'p', 'r', 's']
def getGuessedWord(sW, lG):
'''
sW: string, the word the user is guessing
lG: list, what letters have been guessed so far
returns: string, comprised of letters and underscores that represents
what letters in secretWord have been guessed so far.
'''
#first want to create a list with all the letters in secret word, so we can change certain letters
letters = []
for c in sW:
letters.append(c)
#then for each letter that was not in letters guessed change that to an underscore
for i in range(len(letters)):
if letters[i] not in lG:
letters[i] = ' _ '
#then we want to return the string version of letters
return ''.join(letters)
print(getGuessedWord(secretWord, lettersGuessed))
| """
Created on Mon Jun 11 01:37:09 2018
@author: sushy
"""
secret_word = 'apple'
letters_guessed = ['e', 'i', 'k', 'p', 'r', 's']
def get_guessed_word(sW, lG):
"""
sW: string, the word the user is guessing
lG: list, what letters have been guessed so far
returns: string, comprised of letters and underscores that represents
what letters in secretWord have been guessed so far.
"""
letters = []
for c in sW:
letters.append(c)
for i in range(len(letters)):
if letters[i] not in lG:
letters[i] = ' _ '
return ''.join(letters)
print(get_guessed_word(secretWord, lettersGuessed)) |
#
# PySNMP MIB module TPT-TPA-HARDWARE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPT-TPA-HARDWARE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:26:46 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint")
InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
Counter32, Counter64, Gauge32, TimeTicks, MibIdentifier, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, ObjectIdentity, Bits, IpAddress, iso, Integer32, NotificationType, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Counter64", "Gauge32", "TimeTicks", "MibIdentifier", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ObjectIdentity", "Bits", "IpAddress", "iso", "Integer32", "NotificationType", "Unsigned32")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
tpt_tpa_objs, tpt_tpa_eventsV2, tpt_tpa_unkparams = mibBuilder.importSymbols("TPT-TPAMIBS-MIB", "tpt-tpa-objs", "tpt-tpa-eventsV2", "tpt-tpa-unkparams")
tpt_tpa_hardware_objs = ModuleIdentity((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3)).setLabel("tpt-tpa-hardware-objs")
tpt_tpa_hardware_objs.setRevisions(('2016-05-25 18:54',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: tpt_tpa_hardware_objs.setRevisionsDescriptions(('Updated copyright information. Minor MIB syntax fixes.',))
if mibBuilder.loadTexts: tpt_tpa_hardware_objs.setLastUpdated('201605251854Z')
if mibBuilder.loadTexts: tpt_tpa_hardware_objs.setOrganization('Trend Micro, Inc.')
if mibBuilder.loadTexts: tpt_tpa_hardware_objs.setContactInfo('www.trendmicro.com')
if mibBuilder.loadTexts: tpt_tpa_hardware_objs.setDescription("Hardware definition of a TPA and its components. Copyright (C) 2016 Trend Micro Incorporated. All Rights Reserved. Trend Micro makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Trend Micro shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this material. This document contains proprietary information, which is protected by copyright. No part of this document may be photocopied, reproduced, or translated into another language without the prior written consent of Trend Micro. The information is provided 'as is' without warranty of any kind and is subject to change without notice. The only warranties for Trend Micro products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. Trend Micro shall not be liable for technical or editorial errors or omissions contained herein. TippingPoint(R), the TippingPoint logo, and Digital Vaccine(R) are registered trademarks of Trend Micro. All other company and product names may be trademarks of their respective holders. All rights reserved. This document contains confidential information, trade secrets or both, which are the property of Trend Micro. No part of this documentation may be reproduced in any form or by any means or used to make any derivative work (such as translation, transformation, or adaptation) without written permission from Trend Micro or one of its subsidiaries. All other company and product names may be trademarks of their respective holders. ")
class ManagedElementType(TextualConvention, Integer32):
description = 'Type of a managed base hardware element (slot, port, power supply, fan, etc.) on a device.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24))
namedValues = NamedValues(("unequip", 0), ("chassis", 1), ("backplane", 2), ("controller", 3), ("network-interface", 4), ("network-interface-bcomm", 5), ("network-processor", 6), ("feature-card", 7), ("gige-port", 8), ("ten-base-t-port", 9), ("hundred-base-t-port", 10), ("sonet-atm-port", 11), ("sonet-pos-port", 12), ("sonet-pos-srp-port", 13), ("sdh-atm-port", 14), ("sdh-pos-port", 15), ("sdh-pos-srp-port", 16), ("power-supply", 17), ("power-supply-sub-unit", 18), ("fan-controller", 19), ("fan-sub-unit", 20), ("power-entry-module", 21), ("vnam-port", 22), ("ten-gige-port", 23), ("forty-gige-port", 24))
class ConfigRedundancy(TextualConvention, Integer32):
description = 'An indication of whether a hardware slot is empty, stand-alone, or part of a redundant pair.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4))
namedValues = NamedValues(("unconfigured", 0), ("simplex", 1), ("duplex", 2), ("loadshare", 3), ("autonomous", 4))
class HardwareState(TextualConvention, Integer32):
description = 'The high-level hardware state (active, initializing, standby, etc.).'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))
namedValues = NamedValues(("oos", 0), ("initialize", 1), ("act", 2), ("stby", 3), ("dgn", 4), ("lpbk", 5), ("act-faf", 6), ("stby-faf", 7), ("act-dgrd", 8), ("stby-dgrd", 9))
class HardwareStateQual(TextualConvention, Integer32):
description = 'Further qualification/detail on the high-level hardware state.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29))
namedValues = NamedValues(("port-clear", 0), ("degraded", 1), ("port-los", 2), ("port-lof", 3), ("port-oof", 4), ("port-lop", 5), ("port-signal-degrade", 6), ("port-signal-failure", 7), ("port-ais-p", 8), ("port-ais-l", 9), ("port-rdi", 10), ("port-forced", 11), ("port-lockout", 12), ("yellow-alarm", 13), ("red-alarm", 14), ("parity-err", 15), ("crc-err", 16), ("unequipped-slot", 17), ("blade-pull", 18), ("blade-insert", 19), ("blade-slot-mismatch", 20), ("init-failure", 21), ("parent-oos", 22), ("removed", 23), ("no-info", 24), ("over-temp-alarm", 25), ("under-temp-alarm", 26), ("port-ool", 27), ("port-ool-clear", 28), ("inhibit", 29))
class ExtendedSlot(TextualConvention, Integer32):
description = 'An identifier of either a slot or a hardware component. Slot numbers, slot11 to slot14 are valid on NX device, and refer to slot1 to slot4 on that device.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16))
namedValues = NamedValues(("slot1", 1), ("slot2", 2), ("slot3", 3), ("slot4", 4), ("slot5", 5), ("slot6", 6), ("slot7", 7), ("slot8", 8), ("shelf", 9), ("pem", 10), ("power-supply", 11), ("fan", 12), ("slot11", 13), ("slot12", 14), ("slot13", 15), ("slot14", 16))
class LineType(TextualConvention, Integer32):
description = 'An indication of whether a port is copper or optical.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 21, 22, 23))
namedValues = NamedValues(("undefined", 0), ("copper", 21), ("optical", 22), ("copper-sfp", 23))
class DuplexState(TextualConvention, Integer32):
description = 'An indication of whether a port is running in full or half duplex mode.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2))
namedValues = NamedValues(("unknown", 0), ("half", 1), ("full", 2))
class SfpQualifier(TextualConvention, Integer32):
description = 'SFP qualifier value. These combines both the compliance codes for the 1G SFP and 10G SFP+, and transmitter technology for the 40G QSFP+ and 10G XFP transceivers.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29))
namedValues = NamedValues(("sfp-not-applicable", 0), ("sfp-10g-base-er", 1), ("sfp-10g-base-lrm", 2), ("sfp-10g-base-lr", 3), ("sfp-10g-base-sr", 4), ("sfp-base-px", 5), ("sfp-base-bx10", 6), ("sfp-100base-fx", 7), ("sfp-100base-lx-lx10", 8), ("sfp-1000base-t", 9), ("sfp-1000base-cx", 10), ("sfp-1000base-lx", 11), ("sfp-1000base-sx", 12), ("sfp-850-nm-vcsel", 13), ("sfp-1310-nm-vcsel", 14), ("sfp-1550-nm-vcsel", 15), ("sfp-1310-nm-fp", 16), ("sfp-1310-nm-dfb", 17), ("sfp-1550-nm-dfb", 18), ("sfp-1310-nm-eml", 19), ("sfp-1550-nm-eml", 20), ("sfp-copper-or-others", 21), ("sfp-1490-nm-dfb", 22), ("sfp-copper-cable-unequalized", 23), ("sfp-absent", 24), ("sfp-plus-absent", 25), ("qsfp-plus-absent", 26), ("sfp-xfp-absent", 27), ("sfp-10g-dac", 28), ("sfp-10g-dao", 29))
hw_slotTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1), ).setLabel("hw-slotTable")
if mibBuilder.loadTexts: hw_slotTable.setStatus('current')
if mibBuilder.loadTexts: hw_slotTable.setDescription('Table of slots/ports on the device.')
hw_slotEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1), ).setLabel("hw-slotEntry").setIndexNames((0, "TPT-TPA-HARDWARE-MIB", "slotNumber"), (0, "TPT-TPA-HARDWARE-MIB", "slotPort"))
if mibBuilder.loadTexts: hw_slotEntry.setStatus('current')
if mibBuilder.loadTexts: hw_slotEntry.setDescription('An entry in the slot/port table. Rows cannot be created or deleted.')
slotNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotNumber.setStatus('current')
if mibBuilder.loadTexts: slotNumber.setDescription('Slot number for this hardware element.')
slotPort = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotPort.setStatus('current')
if mibBuilder.loadTexts: slotPort.setDescription('Port number for this hardware element (0 refers to the board).')
slotType = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 3), ManagedElementType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotType.setStatus('current')
if mibBuilder.loadTexts: slotType.setDescription('Type of hardware element corresponding to slot/port.')
slotCfgType = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 4), ConfigRedundancy()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotCfgType.setStatus('current')
if mibBuilder.loadTexts: slotCfgType.setDescription('The configuration/redundancy of a hardware element.')
slotRunState = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 5), HardwareState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotRunState.setStatus('current')
if mibBuilder.loadTexts: slotRunState.setDescription('The high-level hardware state (active, initializing, standby, etc.).')
slotQualifier1 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 6), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotQualifier1.setStatus('current')
if mibBuilder.loadTexts: slotQualifier1.setDescription('Further qualification/detail on the high-level hardware state.')
slotQualifier2 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 7), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotQualifier2.setStatus('current')
if mibBuilder.loadTexts: slotQualifier2.setDescription('Further qualification/detail on the high-level hardware state.')
slotQualifier3 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 8), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotQualifier3.setStatus('current')
if mibBuilder.loadTexts: slotQualifier3.setDescription('Further qualification/detail on the high-level hardware state.')
slotQualifier4 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 9), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotQualifier4.setStatus('current')
if mibBuilder.loadTexts: slotQualifier4.setDescription('Further qualification/detail on the high-level hardware state.')
slotStartTime = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotStartTime.setStatus('current')
if mibBuilder.loadTexts: slotStartTime.setDescription('The time (seconds) at which this hardware element was powered up.')
slotVendorID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotVendorID.setStatus('current')
if mibBuilder.loadTexts: slotVendorID.setDescription('The identifying number of the vendor of this hardware.')
slotDeviceID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 12), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotDeviceID.setStatus('current')
if mibBuilder.loadTexts: slotDeviceID.setDescription('The PCI bus device ID for this slot.')
slotProductID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 13), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotProductID.setStatus('current')
if mibBuilder.loadTexts: slotProductID.setDescription('Versioning and other inventory information for this hardware element.')
slotFPGAVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 14), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotFPGAVersion.setStatus('current')
if mibBuilder.loadTexts: slotFPGAVersion.setDescription('The version of the TPT FPGA chip on this hardware.')
slotInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 15), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotInterface.setStatus('current')
if mibBuilder.loadTexts: slotInterface.setDescription('The entry in the IF-MIB interface table that corresponds to this port.')
slotLineType = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 16), LineType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotLineType.setStatus('current')
if mibBuilder.loadTexts: slotLineType.setDescription('The line type (e.g., copper or optical) of the port.')
slotDuplexState = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 17), DuplexState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotDuplexState.setStatus('current')
if mibBuilder.loadTexts: slotDuplexState.setDescription('The current duplex state (full or half) of the port.')
slotPhysical = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 18), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotPhysical.setStatus('current')
if mibBuilder.loadTexts: slotPhysical.setDescription('Physical port number for this hardware element (0 if not a port).')
slotSfpQualifier1 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 19), SfpQualifier()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotSfpQualifier1.setStatus('current')
if mibBuilder.loadTexts: slotSfpQualifier1.setDescription('Type of the SFP transceiver')
slotSfpQualifier2 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 20), SfpQualifier()).setMaxAccess("readonly")
if mibBuilder.loadTexts: slotSfpQualifier2.setStatus('current')
if mibBuilder.loadTexts: slotSfpQualifier2.setDescription('Type of the SFP transceiver. This is applicable to the dual speed transceivers, and this variable will have value of the second speed supported by those transceivers. For single-speed transceivers, the value will be not applicable.')
hw_chasTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2), ).setLabel("hw-chasTable")
if mibBuilder.loadTexts: hw_chasTable.setStatus('current')
if mibBuilder.loadTexts: hw_chasTable.setDescription('Table of chassis data for the device. Represented as a table with one row, and that row is the same as that for other managed elements.')
hw_chasEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1), ).setLabel("hw-chasEntry").setIndexNames((0, "TPT-TPA-HARDWARE-MIB", "chasNumber"))
if mibBuilder.loadTexts: hw_chasEntry.setStatus('current')
if mibBuilder.loadTexts: hw_chasEntry.setDescription('An entry in the chassis table. Rows cannot be created or deleted.')
chasNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasNumber.setStatus('current')
if mibBuilder.loadTexts: chasNumber.setDescription('Number for this entry in the chassis table. Should always be 0.')
chasType = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 3), ManagedElementType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasType.setStatus('current')
if mibBuilder.loadTexts: chasType.setDescription('Type of hardware element -- should always be chassis or unequip.')
chasCfgType = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 4), ConfigRedundancy()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasCfgType.setStatus('current')
if mibBuilder.loadTexts: chasCfgType.setDescription('The configuration/redundancy of a hardware element.')
chasRunState = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 5), HardwareState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasRunState.setStatus('current')
if mibBuilder.loadTexts: chasRunState.setDescription('The high-level hardware state (active, initializing, standby, etc.).')
chasQualifier1 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 6), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasQualifier1.setStatus('current')
if mibBuilder.loadTexts: chasQualifier1.setDescription('Further qualification/detail on the high-level hardware state.')
chasQualifier2 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 7), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasQualifier2.setStatus('current')
if mibBuilder.loadTexts: chasQualifier2.setDescription('Further qualification/detail on the high-level hardware state.')
chasQualifier3 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 8), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasQualifier3.setStatus('current')
if mibBuilder.loadTexts: chasQualifier3.setDescription('Further qualification/detail on the high-level hardware state.')
chasQualifier4 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 9), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasQualifier4.setStatus('current')
if mibBuilder.loadTexts: chasQualifier4.setDescription('Further qualification/detail on the high-level hardware state.')
chasStartTime = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasStartTime.setStatus('current')
if mibBuilder.loadTexts: chasStartTime.setDescription('The time (seconds) at which the hardware element was powered up.')
chasVendorID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasVendorID.setStatus('current')
if mibBuilder.loadTexts: chasVendorID.setDescription('The identifying number of the vendor of this hardware.')
chasDeviceID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 12), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasDeviceID.setStatus('current')
if mibBuilder.loadTexts: chasDeviceID.setDescription('An identifying number specific to this device.')
chasProductID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 13), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasProductID.setStatus('current')
if mibBuilder.loadTexts: chasProductID.setDescription('Versioning and other inventory information for this hardware element.')
chasFPGAVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 14), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: chasFPGAVersion.setStatus('current')
if mibBuilder.loadTexts: chasFPGAVersion.setDescription('The version of the TPT FPGA chip on this hardware.')
hw_fanTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3), ).setLabel("hw-fanTable")
if mibBuilder.loadTexts: hw_fanTable.setStatus('current')
if mibBuilder.loadTexts: hw_fanTable.setDescription('Table of fans on the device.')
hw_fanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1), ).setLabel("hw-fanEntry").setIndexNames((0, "TPT-TPA-HARDWARE-MIB", "fanSubunit"))
if mibBuilder.loadTexts: hw_fanEntry.setStatus('current')
if mibBuilder.loadTexts: hw_fanEntry.setDescription('An entry in the fan table. Rows cannot be created or deleted.')
fanSubunit = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanSubunit.setStatus('current')
if mibBuilder.loadTexts: fanSubunit.setDescription('Number of fan sub-unit (0 for controller).')
fanType = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 3), ManagedElementType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanType.setStatus('current')
if mibBuilder.loadTexts: fanType.setDescription('Type of hardware element -- should always be fan or unequip.')
fanCfgType = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 4), ConfigRedundancy()).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanCfgType.setStatus('current')
if mibBuilder.loadTexts: fanCfgType.setDescription('The configuration/redundancy of a hardware element.')
fanRunState = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 5), HardwareState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanRunState.setStatus('current')
if mibBuilder.loadTexts: fanRunState.setDescription('The high-level hardware state (active, initializing, standby, etc.).')
fanQualifier1 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 6), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanQualifier1.setStatus('current')
if mibBuilder.loadTexts: fanQualifier1.setDescription('Further qualification/detail on the high-level hardware state.')
fanQualifier2 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 7), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanQualifier2.setStatus('current')
if mibBuilder.loadTexts: fanQualifier2.setDescription('Further qualification/detail on the high-level hardware state.')
fanQualifier3 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 8), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanQualifier3.setStatus('current')
if mibBuilder.loadTexts: fanQualifier3.setDescription('Further qualification/detail on the high-level hardware state.')
fanQualifier4 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 9), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanQualifier4.setStatus('current')
if mibBuilder.loadTexts: fanQualifier4.setDescription('Further qualification/detail on the high-level hardware state.')
fanStartTime = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanStartTime.setStatus('current')
if mibBuilder.loadTexts: fanStartTime.setDescription('The time (seconds) at which the hardware element was powered up.')
fanVendorID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanVendorID.setStatus('current')
if mibBuilder.loadTexts: fanVendorID.setDescription('The identifying number of the vendor of this hardware.')
fanDeviceID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 12), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanDeviceID.setStatus('current')
if mibBuilder.loadTexts: fanDeviceID.setDescription('An identifying number specific to this device.')
fanProductID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 13), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanProductID.setStatus('current')
if mibBuilder.loadTexts: fanProductID.setDescription('Versioning and other inventory information for this hardware element.')
fanFPGAVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 14), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: fanFPGAVersion.setStatus('current')
if mibBuilder.loadTexts: fanFPGAVersion.setDescription('The version of the TPT FPGA chip on this hardware.')
hw_psTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4), ).setLabel("hw-psTable")
if mibBuilder.loadTexts: hw_psTable.setStatus('current')
if mibBuilder.loadTexts: hw_psTable.setDescription('Table of power supplies on the device.')
hw_psEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1), ).setLabel("hw-psEntry").setIndexNames((0, "TPT-TPA-HARDWARE-MIB", "psSubunit"))
if mibBuilder.loadTexts: hw_psEntry.setStatus('current')
if mibBuilder.loadTexts: hw_psEntry.setDescription('An entry in the power supply table. Rows cannot be created or deleted.')
psSubunit = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psSubunit.setStatus('current')
if mibBuilder.loadTexts: psSubunit.setDescription('Number of power supply sub-unit (0 for controller).')
psType = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 3), ManagedElementType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psType.setStatus('current')
if mibBuilder.loadTexts: psType.setDescription('Type of hardware element -- should always be power-supply or unequip.')
psCfgType = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 4), ConfigRedundancy()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psCfgType.setStatus('current')
if mibBuilder.loadTexts: psCfgType.setDescription('The configuration/redundancy of a hardware element.')
psRunState = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 5), HardwareState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psRunState.setStatus('current')
if mibBuilder.loadTexts: psRunState.setDescription('The high-level hardware state (active, initializing, standby, etc.).')
psQualifier1 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 6), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psQualifier1.setStatus('current')
if mibBuilder.loadTexts: psQualifier1.setDescription('Further qualification/detail on the high-level hardware state.')
psQualifier2 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 7), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psQualifier2.setStatus('current')
if mibBuilder.loadTexts: psQualifier2.setDescription('Further qualification/detail on the high-level hardware state.')
psQualifier3 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 8), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psQualifier3.setStatus('current')
if mibBuilder.loadTexts: psQualifier3.setDescription('Further qualification/detail on the high-level hardware state.')
psQualifier4 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 9), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psQualifier4.setStatus('current')
if mibBuilder.loadTexts: psQualifier4.setDescription('Further qualification/detail on the high-level hardware state.')
psStartTime = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psStartTime.setStatus('current')
if mibBuilder.loadTexts: psStartTime.setDescription('The time (seconds) at which the hardware element was powered up.')
psVendorID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psVendorID.setStatus('current')
if mibBuilder.loadTexts: psVendorID.setDescription('The identifying number of the vendor of this hardware.')
psDeviceID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 12), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psDeviceID.setStatus('current')
if mibBuilder.loadTexts: psDeviceID.setDescription('An identifying number specific to this device.')
psProductID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 13), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly")
if mibBuilder.loadTexts: psProductID.setStatus('current')
if mibBuilder.loadTexts: psProductID.setDescription('Versioning and other inventory information for this hardware element.')
psFPGAVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 14), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: psFPGAVersion.setStatus('current')
if mibBuilder.loadTexts: psFPGAVersion.setDescription('The version of the TPT FPGA chip on this hardware.')
hw_pemTable = MibTable((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5), ).setLabel("hw-pemTable")
if mibBuilder.loadTexts: hw_pemTable.setStatus('current')
if mibBuilder.loadTexts: hw_pemTable.setDescription('Table of power entry modules on the device.')
hw_pemEntry = MibTableRow((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1), ).setLabel("hw-pemEntry").setIndexNames((0, "TPT-TPA-HARDWARE-MIB", "pemSubunit"))
if mibBuilder.loadTexts: hw_pemEntry.setStatus('current')
if mibBuilder.loadTexts: hw_pemEntry.setDescription('An entry in the power supply table. Rows cannot be created or deleted.')
pemSubunit = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemSubunit.setStatus('current')
if mibBuilder.loadTexts: pemSubunit.setDescription('Number of power entry module sub-unit (0 for controller).')
pemType = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 3), ManagedElementType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemType.setStatus('current')
if mibBuilder.loadTexts: pemType.setDescription('Type of hardware element -- should always be pem or unequip.')
pemCfgType = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 4), ConfigRedundancy()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemCfgType.setStatus('current')
if mibBuilder.loadTexts: pemCfgType.setDescription('The configuration/redundancy of a hardware element.')
pemRunState = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 5), HardwareState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemRunState.setStatus('current')
if mibBuilder.loadTexts: pemRunState.setDescription('The high-level hardware state (active, initializing, standby, etc.).')
pemQualifier1 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 6), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemQualifier1.setStatus('current')
if mibBuilder.loadTexts: pemQualifier1.setDescription('Further qualification/detail on the high-level hardware state.')
pemQualifier2 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 7), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemQualifier2.setStatus('current')
if mibBuilder.loadTexts: pemQualifier2.setDescription('Further qualification/detail on the high-level hardware state.')
pemQualifier3 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 8), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemQualifier3.setStatus('current')
if mibBuilder.loadTexts: pemQualifier3.setDescription('Further qualification/detail on the high-level hardware state.')
pemQualifier4 = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 9), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemQualifier4.setStatus('current')
if mibBuilder.loadTexts: pemQualifier4.setDescription('Further qualification/detail on the high-level hardware state.')
pemStartTime = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 10), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemStartTime.setStatus('current')
if mibBuilder.loadTexts: pemStartTime.setDescription('The time (seconds) at which the hardware element was powered up.')
pemVendorID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 11), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemVendorID.setStatus('current')
if mibBuilder.loadTexts: pemVendorID.setDescription('The identifying number of the vendor of this hardware.')
pemDeviceID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 12), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemDeviceID.setStatus('current')
if mibBuilder.loadTexts: pemDeviceID.setDescription('An identifying number specific to this device.')
pemProductID = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 13), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemProductID.setStatus('current')
if mibBuilder.loadTexts: pemProductID.setDescription('Versioning and other inventory information for this hardware element.')
pemFPGAVersion = MibTableColumn((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 14), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: pemFPGAVersion.setStatus('current')
if mibBuilder.loadTexts: pemFPGAVersion.setDescription('The version of the TPT FPGA chip on this hardware.')
hw_numSlots = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 6), Unsigned32()).setLabel("hw-numSlots").setMaxAccess("readonly")
if mibBuilder.loadTexts: hw_numSlots.setStatus('current')
if mibBuilder.loadTexts: hw_numSlots.setDescription('The number of slots for this device.')
hw_numFans = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 7), Unsigned32()).setLabel("hw-numFans").setMaxAccess("readonly")
if mibBuilder.loadTexts: hw_numFans.setStatus('current')
if mibBuilder.loadTexts: hw_numFans.setDescription('The number of fan subunits for this device.')
hw_numPowerSupplies = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 8), Unsigned32()).setLabel("hw-numPowerSupplies").setMaxAccess("readonly")
if mibBuilder.loadTexts: hw_numPowerSupplies.setStatus('current')
if mibBuilder.loadTexts: hw_numPowerSupplies.setDescription('The number of power supply subunits for this device.')
hw_numPEMs = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 9), Unsigned32()).setLabel("hw-numPEMs").setMaxAccess("readonly")
if mibBuilder.loadTexts: hw_numPEMs.setStatus('current')
if mibBuilder.loadTexts: hw_numPEMs.setDescription('The number of PEM subunits for this device.')
hw_certificateNumber = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 10), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 30))).setLabel("hw-certificateNumber").setMaxAccess("readonly")
if mibBuilder.loadTexts: hw_certificateNumber.setStatus('current')
if mibBuilder.loadTexts: hw_certificateNumber.setDescription('The hardware certficate number of the device.')
hw_serialNumber = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 11), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 30))).setLabel("hw-serialNumber").setMaxAccess("readonly")
if mibBuilder.loadTexts: hw_serialNumber.setStatus('current')
if mibBuilder.loadTexts: hw_serialNumber.setDescription('The hardware serial number of the device.')
tptHardwareNotifyDeviceID = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40))).setMaxAccess("readonly")
if mibBuilder.loadTexts: tptHardwareNotifyDeviceID.setStatus('current')
if mibBuilder.loadTexts: tptHardwareNotifyDeviceID.setDescription('The unique identifier of the device sending this notification.')
tptHardwareNotifySlot = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 2), ExtendedSlot()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tptHardwareNotifySlot.setStatus('current')
if mibBuilder.loadTexts: tptHardwareNotifySlot.setDescription('The slot of the hardware whose state has changed. If the hardware element is not a board, this value identifies it as a chassis, fan, power supply, PEM, etc.')
tptHardwareNotifyPort = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tptHardwareNotifyPort.setStatus('current')
if mibBuilder.loadTexts: tptHardwareNotifyPort.setDescription('The port or sub-unit number of the hardware whose state has changed. Zero for a board, chassis, fan controller, power supply, or power entry module.')
tptHardwareNotifyMeType = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 4), ManagedElementType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tptHardwareNotifyMeType.setStatus('current')
if mibBuilder.loadTexts: tptHardwareNotifyMeType.setDescription('The type of the managed element (e.g., backplane, controller, power supply, fan, etc.) whose state has changed.')
tptHardwareNotifyCfgType = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 5), ConfigRedundancy()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tptHardwareNotifyCfgType.setStatus('current')
if mibBuilder.loadTexts: tptHardwareNotifyCfgType.setDescription('The configuration/redundancy of the hardware whose state has changed.')
tptHardwareNotifyHlState = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 6), HardwareState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tptHardwareNotifyHlState.setStatus('current')
if mibBuilder.loadTexts: tptHardwareNotifyHlState.setDescription('The high-level hardware state (active, initializing, standby, etc.).')
tptHardwareNotifyHlStateQual = MibScalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 7), HardwareStateQual()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tptHardwareNotifyHlStateQual.setStatus('current')
if mibBuilder.loadTexts: tptHardwareNotifyHlStateQual.setDescription('Further qualification/detail on the high-level state.')
tptHardwareNotify = NotificationType((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 0, 7)).setObjects(("TPT-TPA-HARDWARE-MIB", "tptHardwareNotifyDeviceID"), ("TPT-TPA-HARDWARE-MIB", "tptHardwareNotifySlot"), ("TPT-TPA-HARDWARE-MIB", "tptHardwareNotifyPort"), ("TPT-TPA-HARDWARE-MIB", "tptHardwareNotifyMeType"), ("TPT-TPA-HARDWARE-MIB", "tptHardwareNotifyCfgType"), ("TPT-TPA-HARDWARE-MIB", "tptHardwareNotifyHlState"), ("TPT-TPA-HARDWARE-MIB", "tptHardwareNotifyHlStateQual"))
if mibBuilder.loadTexts: tptHardwareNotify.setStatus('current')
if mibBuilder.loadTexts: tptHardwareNotify.setDescription('Notification: Used to inform the management station of changes in hardware state on the device.')
mibBuilder.exportSymbols("TPT-TPA-HARDWARE-MIB", slotVendorID=slotVendorID, hw_pemTable=hw_pemTable, hw_slotTable=hw_slotTable, tptHardwareNotifyPort=tptHardwareNotifyPort, slotInterface=slotInterface, slotNumber=slotNumber, chasQualifier1=chasQualifier1, PYSNMP_MODULE_ID=tpt_tpa_hardware_objs, hw_slotEntry=hw_slotEntry, chasQualifier3=chasQualifier3, hw_fanEntry=hw_fanEntry, tptHardwareNotifySlot=tptHardwareNotifySlot, hw_psEntry=hw_psEntry, chasCfgType=chasCfgType, chasQualifier4=chasQualifier4, psFPGAVersion=psFPGAVersion, fanRunState=fanRunState, LineType=LineType, chasQualifier2=chasQualifier2, hw_fanTable=hw_fanTable, hw_numSlots=hw_numSlots, slotQualifier2=slotQualifier2, fanVendorID=fanVendorID, psSubunit=psSubunit, ConfigRedundancy=ConfigRedundancy, fanType=fanType, DuplexState=DuplexState, slotPhysical=slotPhysical, fanCfgType=fanCfgType, fanProductID=fanProductID, pemCfgType=pemCfgType, pemQualifier2=pemQualifier2, tptHardwareNotifyMeType=tptHardwareNotifyMeType, slotProductID=slotProductID, chasNumber=chasNumber, chasDeviceID=chasDeviceID, pemType=pemType, pemDeviceID=pemDeviceID, hw_psTable=hw_psTable, slotQualifier1=slotQualifier1, tptHardwareNotifyDeviceID=tptHardwareNotifyDeviceID, fanQualifier3=fanQualifier3, slotDeviceID=slotDeviceID, pemVendorID=pemVendorID, psQualifier1=psQualifier1, psQualifier3=psQualifier3, HardwareStateQual=HardwareStateQual, hw_pemEntry=hw_pemEntry, fanQualifier2=fanQualifier2, slotType=slotType, fanFPGAVersion=fanFPGAVersion, chasRunState=chasRunState, pemSubunit=pemSubunit, chasType=chasType, fanStartTime=fanStartTime, fanQualifier4=fanQualifier4, slotDuplexState=slotDuplexState, tptHardwareNotify=tptHardwareNotify, hw_numPEMs=hw_numPEMs, slotQualifier4=slotQualifier4, chasProductID=chasProductID, tptHardwareNotifyHlStateQual=tptHardwareNotifyHlStateQual, hw_serialNumber=hw_serialNumber, pemStartTime=pemStartTime, slotFPGAVersion=slotFPGAVersion, chasVendorID=chasVendorID, pemQualifier4=pemQualifier4, fanQualifier1=fanQualifier1, chasStartTime=chasStartTime, hw_certificateNumber=hw_certificateNumber, psStartTime=psStartTime, pemFPGAVersion=pemFPGAVersion, psDeviceID=psDeviceID, fanSubunit=fanSubunit, slotLineType=slotLineType, slotPort=slotPort, pemQualifier3=pemQualifier3, SfpQualifier=SfpQualifier, tptHardwareNotifyCfgType=tptHardwareNotifyCfgType, psProductID=psProductID, pemProductID=pemProductID, pemQualifier1=pemQualifier1, slotRunState=slotRunState, fanDeviceID=fanDeviceID, ExtendedSlot=ExtendedSlot, psVendorID=psVendorID, psRunState=psRunState, hw_chasEntry=hw_chasEntry, psQualifier4=psQualifier4, HardwareState=HardwareState, ManagedElementType=ManagedElementType, psCfgType=psCfgType, slotSfpQualifier1=slotSfpQualifier1, hw_chasTable=hw_chasTable, psQualifier2=psQualifier2, hw_numFans=hw_numFans, tptHardwareNotifyHlState=tptHardwareNotifyHlState, tpt_tpa_hardware_objs=tpt_tpa_hardware_objs, chasFPGAVersion=chasFPGAVersion, pemRunState=pemRunState, slotQualifier3=slotQualifier3, slotCfgType=slotCfgType, hw_numPowerSupplies=hw_numPowerSupplies, psType=psType, slotSfpQualifier2=slotSfpQualifier2, slotStartTime=slotStartTime)
| (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueRangeConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint')
(interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(counter32, counter64, gauge32, time_ticks, mib_identifier, module_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, object_identity, bits, ip_address, iso, integer32, notification_type, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter32', 'Counter64', 'Gauge32', 'TimeTicks', 'MibIdentifier', 'ModuleIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ObjectIdentity', 'Bits', 'IpAddress', 'iso', 'Integer32', 'NotificationType', 'Unsigned32')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
(tpt_tpa_objs, tpt_tpa_events_v2, tpt_tpa_unkparams) = mibBuilder.importSymbols('TPT-TPAMIBS-MIB', 'tpt-tpa-objs', 'tpt-tpa-eventsV2', 'tpt-tpa-unkparams')
tpt_tpa_hardware_objs = module_identity((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3)).setLabel('tpt-tpa-hardware-objs')
tpt_tpa_hardware_objs.setRevisions(('2016-05-25 18:54',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
tpt_tpa_hardware_objs.setRevisionsDescriptions(('Updated copyright information. Minor MIB syntax fixes.',))
if mibBuilder.loadTexts:
tpt_tpa_hardware_objs.setLastUpdated('201605251854Z')
if mibBuilder.loadTexts:
tpt_tpa_hardware_objs.setOrganization('Trend Micro, Inc.')
if mibBuilder.loadTexts:
tpt_tpa_hardware_objs.setContactInfo('www.trendmicro.com')
if mibBuilder.loadTexts:
tpt_tpa_hardware_objs.setDescription("Hardware definition of a TPA and its components. Copyright (C) 2016 Trend Micro Incorporated. All Rights Reserved. Trend Micro makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Trend Micro shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this material. This document contains proprietary information, which is protected by copyright. No part of this document may be photocopied, reproduced, or translated into another language without the prior written consent of Trend Micro. The information is provided 'as is' without warranty of any kind and is subject to change without notice. The only warranties for Trend Micro products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. Trend Micro shall not be liable for technical or editorial errors or omissions contained herein. TippingPoint(R), the TippingPoint logo, and Digital Vaccine(R) are registered trademarks of Trend Micro. All other company and product names may be trademarks of their respective holders. All rights reserved. This document contains confidential information, trade secrets or both, which are the property of Trend Micro. No part of this documentation may be reproduced in any form or by any means or used to make any derivative work (such as translation, transformation, or adaptation) without written permission from Trend Micro or one of its subsidiaries. All other company and product names may be trademarks of their respective holders. ")
class Managedelementtype(TextualConvention, Integer32):
description = 'Type of a managed base hardware element (slot, port, power supply, fan, etc.) on a device.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24))
named_values = named_values(('unequip', 0), ('chassis', 1), ('backplane', 2), ('controller', 3), ('network-interface', 4), ('network-interface-bcomm', 5), ('network-processor', 6), ('feature-card', 7), ('gige-port', 8), ('ten-base-t-port', 9), ('hundred-base-t-port', 10), ('sonet-atm-port', 11), ('sonet-pos-port', 12), ('sonet-pos-srp-port', 13), ('sdh-atm-port', 14), ('sdh-pos-port', 15), ('sdh-pos-srp-port', 16), ('power-supply', 17), ('power-supply-sub-unit', 18), ('fan-controller', 19), ('fan-sub-unit', 20), ('power-entry-module', 21), ('vnam-port', 22), ('ten-gige-port', 23), ('forty-gige-port', 24))
class Configredundancy(TextualConvention, Integer32):
description = 'An indication of whether a hardware slot is empty, stand-alone, or part of a redundant pair.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4))
named_values = named_values(('unconfigured', 0), ('simplex', 1), ('duplex', 2), ('loadshare', 3), ('autonomous', 4))
class Hardwarestate(TextualConvention, Integer32):
description = 'The high-level hardware state (active, initializing, standby, etc.).'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))
named_values = named_values(('oos', 0), ('initialize', 1), ('act', 2), ('stby', 3), ('dgn', 4), ('lpbk', 5), ('act-faf', 6), ('stby-faf', 7), ('act-dgrd', 8), ('stby-dgrd', 9))
class Hardwarestatequal(TextualConvention, Integer32):
description = 'Further qualification/detail on the high-level hardware state.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29))
named_values = named_values(('port-clear', 0), ('degraded', 1), ('port-los', 2), ('port-lof', 3), ('port-oof', 4), ('port-lop', 5), ('port-signal-degrade', 6), ('port-signal-failure', 7), ('port-ais-p', 8), ('port-ais-l', 9), ('port-rdi', 10), ('port-forced', 11), ('port-lockout', 12), ('yellow-alarm', 13), ('red-alarm', 14), ('parity-err', 15), ('crc-err', 16), ('unequipped-slot', 17), ('blade-pull', 18), ('blade-insert', 19), ('blade-slot-mismatch', 20), ('init-failure', 21), ('parent-oos', 22), ('removed', 23), ('no-info', 24), ('over-temp-alarm', 25), ('under-temp-alarm', 26), ('port-ool', 27), ('port-ool-clear', 28), ('inhibit', 29))
class Extendedslot(TextualConvention, Integer32):
description = 'An identifier of either a slot or a hardware component. Slot numbers, slot11 to slot14 are valid on NX device, and refer to slot1 to slot4 on that device.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16))
named_values = named_values(('slot1', 1), ('slot2', 2), ('slot3', 3), ('slot4', 4), ('slot5', 5), ('slot6', 6), ('slot7', 7), ('slot8', 8), ('shelf', 9), ('pem', 10), ('power-supply', 11), ('fan', 12), ('slot11', 13), ('slot12', 14), ('slot13', 15), ('slot14', 16))
class Linetype(TextualConvention, Integer32):
description = 'An indication of whether a port is copper or optical.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 21, 22, 23))
named_values = named_values(('undefined', 0), ('copper', 21), ('optical', 22), ('copper-sfp', 23))
class Duplexstate(TextualConvention, Integer32):
description = 'An indication of whether a port is running in full or half duplex mode.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2))
named_values = named_values(('unknown', 0), ('half', 1), ('full', 2))
class Sfpqualifier(TextualConvention, Integer32):
description = 'SFP qualifier value. These combines both the compliance codes for the 1G SFP and 10G SFP+, and transmitter technology for the 40G QSFP+ and 10G XFP transceivers.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29))
named_values = named_values(('sfp-not-applicable', 0), ('sfp-10g-base-er', 1), ('sfp-10g-base-lrm', 2), ('sfp-10g-base-lr', 3), ('sfp-10g-base-sr', 4), ('sfp-base-px', 5), ('sfp-base-bx10', 6), ('sfp-100base-fx', 7), ('sfp-100base-lx-lx10', 8), ('sfp-1000base-t', 9), ('sfp-1000base-cx', 10), ('sfp-1000base-lx', 11), ('sfp-1000base-sx', 12), ('sfp-850-nm-vcsel', 13), ('sfp-1310-nm-vcsel', 14), ('sfp-1550-nm-vcsel', 15), ('sfp-1310-nm-fp', 16), ('sfp-1310-nm-dfb', 17), ('sfp-1550-nm-dfb', 18), ('sfp-1310-nm-eml', 19), ('sfp-1550-nm-eml', 20), ('sfp-copper-or-others', 21), ('sfp-1490-nm-dfb', 22), ('sfp-copper-cable-unequalized', 23), ('sfp-absent', 24), ('sfp-plus-absent', 25), ('qsfp-plus-absent', 26), ('sfp-xfp-absent', 27), ('sfp-10g-dac', 28), ('sfp-10g-dao', 29))
hw_slot_table = mib_table((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1)).setLabel('hw-slotTable')
if mibBuilder.loadTexts:
hw_slotTable.setStatus('current')
if mibBuilder.loadTexts:
hw_slotTable.setDescription('Table of slots/ports on the device.')
hw_slot_entry = mib_table_row((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1)).setLabel('hw-slotEntry').setIndexNames((0, 'TPT-TPA-HARDWARE-MIB', 'slotNumber'), (0, 'TPT-TPA-HARDWARE-MIB', 'slotPort'))
if mibBuilder.loadTexts:
hw_slotEntry.setStatus('current')
if mibBuilder.loadTexts:
hw_slotEntry.setDescription('An entry in the slot/port table. Rows cannot be created or deleted.')
slot_number = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotNumber.setStatus('current')
if mibBuilder.loadTexts:
slotNumber.setDescription('Slot number for this hardware element.')
slot_port = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotPort.setStatus('current')
if mibBuilder.loadTexts:
slotPort.setDescription('Port number for this hardware element (0 refers to the board).')
slot_type = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 3), managed_element_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotType.setStatus('current')
if mibBuilder.loadTexts:
slotType.setDescription('Type of hardware element corresponding to slot/port.')
slot_cfg_type = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 4), config_redundancy()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotCfgType.setStatus('current')
if mibBuilder.loadTexts:
slotCfgType.setDescription('The configuration/redundancy of a hardware element.')
slot_run_state = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 5), hardware_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotRunState.setStatus('current')
if mibBuilder.loadTexts:
slotRunState.setDescription('The high-level hardware state (active, initializing, standby, etc.).')
slot_qualifier1 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 6), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotQualifier1.setStatus('current')
if mibBuilder.loadTexts:
slotQualifier1.setDescription('Further qualification/detail on the high-level hardware state.')
slot_qualifier2 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 7), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotQualifier2.setStatus('current')
if mibBuilder.loadTexts:
slotQualifier2.setDescription('Further qualification/detail on the high-level hardware state.')
slot_qualifier3 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 8), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotQualifier3.setStatus('current')
if mibBuilder.loadTexts:
slotQualifier3.setDescription('Further qualification/detail on the high-level hardware state.')
slot_qualifier4 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 9), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotQualifier4.setStatus('current')
if mibBuilder.loadTexts:
slotQualifier4.setDescription('Further qualification/detail on the high-level hardware state.')
slot_start_time = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 10), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotStartTime.setStatus('current')
if mibBuilder.loadTexts:
slotStartTime.setDescription('The time (seconds) at which this hardware element was powered up.')
slot_vendor_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 11), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotVendorID.setStatus('current')
if mibBuilder.loadTexts:
slotVendorID.setDescription('The identifying number of the vendor of this hardware.')
slot_device_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 12), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotDeviceID.setStatus('current')
if mibBuilder.loadTexts:
slotDeviceID.setDescription('The PCI bus device ID for this slot.')
slot_product_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 13), octet_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotProductID.setStatus('current')
if mibBuilder.loadTexts:
slotProductID.setDescription('Versioning and other inventory information for this hardware element.')
slot_fpga_version = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 14), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotFPGAVersion.setStatus('current')
if mibBuilder.loadTexts:
slotFPGAVersion.setDescription('The version of the TPT FPGA chip on this hardware.')
slot_interface = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 15), interface_index()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotInterface.setStatus('current')
if mibBuilder.loadTexts:
slotInterface.setDescription('The entry in the IF-MIB interface table that corresponds to this port.')
slot_line_type = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 16), line_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotLineType.setStatus('current')
if mibBuilder.loadTexts:
slotLineType.setDescription('The line type (e.g., copper or optical) of the port.')
slot_duplex_state = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 17), duplex_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotDuplexState.setStatus('current')
if mibBuilder.loadTexts:
slotDuplexState.setDescription('The current duplex state (full or half) of the port.')
slot_physical = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 18), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotPhysical.setStatus('current')
if mibBuilder.loadTexts:
slotPhysical.setDescription('Physical port number for this hardware element (0 if not a port).')
slot_sfp_qualifier1 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 19), sfp_qualifier()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotSfpQualifier1.setStatus('current')
if mibBuilder.loadTexts:
slotSfpQualifier1.setDescription('Type of the SFP transceiver')
slot_sfp_qualifier2 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 1, 1, 20), sfp_qualifier()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
slotSfpQualifier2.setStatus('current')
if mibBuilder.loadTexts:
slotSfpQualifier2.setDescription('Type of the SFP transceiver. This is applicable to the dual speed transceivers, and this variable will have value of the second speed supported by those transceivers. For single-speed transceivers, the value will be not applicable.')
hw_chas_table = mib_table((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2)).setLabel('hw-chasTable')
if mibBuilder.loadTexts:
hw_chasTable.setStatus('current')
if mibBuilder.loadTexts:
hw_chasTable.setDescription('Table of chassis data for the device. Represented as a table with one row, and that row is the same as that for other managed elements.')
hw_chas_entry = mib_table_row((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1)).setLabel('hw-chasEntry').setIndexNames((0, 'TPT-TPA-HARDWARE-MIB', 'chasNumber'))
if mibBuilder.loadTexts:
hw_chasEntry.setStatus('current')
if mibBuilder.loadTexts:
hw_chasEntry.setDescription('An entry in the chassis table. Rows cannot be created or deleted.')
chas_number = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasNumber.setStatus('current')
if mibBuilder.loadTexts:
chasNumber.setDescription('Number for this entry in the chassis table. Should always be 0.')
chas_type = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 3), managed_element_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasType.setStatus('current')
if mibBuilder.loadTexts:
chasType.setDescription('Type of hardware element -- should always be chassis or unequip.')
chas_cfg_type = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 4), config_redundancy()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasCfgType.setStatus('current')
if mibBuilder.loadTexts:
chasCfgType.setDescription('The configuration/redundancy of a hardware element.')
chas_run_state = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 5), hardware_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasRunState.setStatus('current')
if mibBuilder.loadTexts:
chasRunState.setDescription('The high-level hardware state (active, initializing, standby, etc.).')
chas_qualifier1 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 6), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasQualifier1.setStatus('current')
if mibBuilder.loadTexts:
chasQualifier1.setDescription('Further qualification/detail on the high-level hardware state.')
chas_qualifier2 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 7), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasQualifier2.setStatus('current')
if mibBuilder.loadTexts:
chasQualifier2.setDescription('Further qualification/detail on the high-level hardware state.')
chas_qualifier3 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 8), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasQualifier3.setStatus('current')
if mibBuilder.loadTexts:
chasQualifier3.setDescription('Further qualification/detail on the high-level hardware state.')
chas_qualifier4 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 9), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasQualifier4.setStatus('current')
if mibBuilder.loadTexts:
chasQualifier4.setDescription('Further qualification/detail on the high-level hardware state.')
chas_start_time = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 10), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasStartTime.setStatus('current')
if mibBuilder.loadTexts:
chasStartTime.setDescription('The time (seconds) at which the hardware element was powered up.')
chas_vendor_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 11), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasVendorID.setStatus('current')
if mibBuilder.loadTexts:
chasVendorID.setDescription('The identifying number of the vendor of this hardware.')
chas_device_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 12), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasDeviceID.setStatus('current')
if mibBuilder.loadTexts:
chasDeviceID.setDescription('An identifying number specific to this device.')
chas_product_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 13), octet_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasProductID.setStatus('current')
if mibBuilder.loadTexts:
chasProductID.setDescription('Versioning and other inventory information for this hardware element.')
chas_fpga_version = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 2, 1, 14), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
chasFPGAVersion.setStatus('current')
if mibBuilder.loadTexts:
chasFPGAVersion.setDescription('The version of the TPT FPGA chip on this hardware.')
hw_fan_table = mib_table((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3)).setLabel('hw-fanTable')
if mibBuilder.loadTexts:
hw_fanTable.setStatus('current')
if mibBuilder.loadTexts:
hw_fanTable.setDescription('Table of fans on the device.')
hw_fan_entry = mib_table_row((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1)).setLabel('hw-fanEntry').setIndexNames((0, 'TPT-TPA-HARDWARE-MIB', 'fanSubunit'))
if mibBuilder.loadTexts:
hw_fanEntry.setStatus('current')
if mibBuilder.loadTexts:
hw_fanEntry.setDescription('An entry in the fan table. Rows cannot be created or deleted.')
fan_subunit = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanSubunit.setStatus('current')
if mibBuilder.loadTexts:
fanSubunit.setDescription('Number of fan sub-unit (0 for controller).')
fan_type = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 3), managed_element_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanType.setStatus('current')
if mibBuilder.loadTexts:
fanType.setDescription('Type of hardware element -- should always be fan or unequip.')
fan_cfg_type = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 4), config_redundancy()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanCfgType.setStatus('current')
if mibBuilder.loadTexts:
fanCfgType.setDescription('The configuration/redundancy of a hardware element.')
fan_run_state = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 5), hardware_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanRunState.setStatus('current')
if mibBuilder.loadTexts:
fanRunState.setDescription('The high-level hardware state (active, initializing, standby, etc.).')
fan_qualifier1 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 6), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanQualifier1.setStatus('current')
if mibBuilder.loadTexts:
fanQualifier1.setDescription('Further qualification/detail on the high-level hardware state.')
fan_qualifier2 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 7), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanQualifier2.setStatus('current')
if mibBuilder.loadTexts:
fanQualifier2.setDescription('Further qualification/detail on the high-level hardware state.')
fan_qualifier3 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 8), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanQualifier3.setStatus('current')
if mibBuilder.loadTexts:
fanQualifier3.setDescription('Further qualification/detail on the high-level hardware state.')
fan_qualifier4 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 9), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanQualifier4.setStatus('current')
if mibBuilder.loadTexts:
fanQualifier4.setDescription('Further qualification/detail on the high-level hardware state.')
fan_start_time = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 10), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanStartTime.setStatus('current')
if mibBuilder.loadTexts:
fanStartTime.setDescription('The time (seconds) at which the hardware element was powered up.')
fan_vendor_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 11), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanVendorID.setStatus('current')
if mibBuilder.loadTexts:
fanVendorID.setDescription('The identifying number of the vendor of this hardware.')
fan_device_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 12), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanDeviceID.setStatus('current')
if mibBuilder.loadTexts:
fanDeviceID.setDescription('An identifying number specific to this device.')
fan_product_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 13), octet_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanProductID.setStatus('current')
if mibBuilder.loadTexts:
fanProductID.setDescription('Versioning and other inventory information for this hardware element.')
fan_fpga_version = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 3, 1, 14), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
fanFPGAVersion.setStatus('current')
if mibBuilder.loadTexts:
fanFPGAVersion.setDescription('The version of the TPT FPGA chip on this hardware.')
hw_ps_table = mib_table((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4)).setLabel('hw-psTable')
if mibBuilder.loadTexts:
hw_psTable.setStatus('current')
if mibBuilder.loadTexts:
hw_psTable.setDescription('Table of power supplies on the device.')
hw_ps_entry = mib_table_row((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1)).setLabel('hw-psEntry').setIndexNames((0, 'TPT-TPA-HARDWARE-MIB', 'psSubunit'))
if mibBuilder.loadTexts:
hw_psEntry.setStatus('current')
if mibBuilder.loadTexts:
hw_psEntry.setDescription('An entry in the power supply table. Rows cannot be created or deleted.')
ps_subunit = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psSubunit.setStatus('current')
if mibBuilder.loadTexts:
psSubunit.setDescription('Number of power supply sub-unit (0 for controller).')
ps_type = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 3), managed_element_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psType.setStatus('current')
if mibBuilder.loadTexts:
psType.setDescription('Type of hardware element -- should always be power-supply or unequip.')
ps_cfg_type = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 4), config_redundancy()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psCfgType.setStatus('current')
if mibBuilder.loadTexts:
psCfgType.setDescription('The configuration/redundancy of a hardware element.')
ps_run_state = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 5), hardware_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psRunState.setStatus('current')
if mibBuilder.loadTexts:
psRunState.setDescription('The high-level hardware state (active, initializing, standby, etc.).')
ps_qualifier1 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 6), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psQualifier1.setStatus('current')
if mibBuilder.loadTexts:
psQualifier1.setDescription('Further qualification/detail on the high-level hardware state.')
ps_qualifier2 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 7), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psQualifier2.setStatus('current')
if mibBuilder.loadTexts:
psQualifier2.setDescription('Further qualification/detail on the high-level hardware state.')
ps_qualifier3 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 8), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psQualifier3.setStatus('current')
if mibBuilder.loadTexts:
psQualifier3.setDescription('Further qualification/detail on the high-level hardware state.')
ps_qualifier4 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 9), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psQualifier4.setStatus('current')
if mibBuilder.loadTexts:
psQualifier4.setDescription('Further qualification/detail on the high-level hardware state.')
ps_start_time = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 10), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psStartTime.setStatus('current')
if mibBuilder.loadTexts:
psStartTime.setDescription('The time (seconds) at which the hardware element was powered up.')
ps_vendor_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 11), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psVendorID.setStatus('current')
if mibBuilder.loadTexts:
psVendorID.setDescription('The identifying number of the vendor of this hardware.')
ps_device_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 12), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psDeviceID.setStatus('current')
if mibBuilder.loadTexts:
psDeviceID.setDescription('An identifying number specific to this device.')
ps_product_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 13), octet_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psProductID.setStatus('current')
if mibBuilder.loadTexts:
psProductID.setDescription('Versioning and other inventory information for this hardware element.')
ps_fpga_version = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 4, 1, 14), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
psFPGAVersion.setStatus('current')
if mibBuilder.loadTexts:
psFPGAVersion.setDescription('The version of the TPT FPGA chip on this hardware.')
hw_pem_table = mib_table((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5)).setLabel('hw-pemTable')
if mibBuilder.loadTexts:
hw_pemTable.setStatus('current')
if mibBuilder.loadTexts:
hw_pemTable.setDescription('Table of power entry modules on the device.')
hw_pem_entry = mib_table_row((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1)).setLabel('hw-pemEntry').setIndexNames((0, 'TPT-TPA-HARDWARE-MIB', 'pemSubunit'))
if mibBuilder.loadTexts:
hw_pemEntry.setStatus('current')
if mibBuilder.loadTexts:
hw_pemEntry.setDescription('An entry in the power supply table. Rows cannot be created or deleted.')
pem_subunit = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemSubunit.setStatus('current')
if mibBuilder.loadTexts:
pemSubunit.setDescription('Number of power entry module sub-unit (0 for controller).')
pem_type = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 3), managed_element_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemType.setStatus('current')
if mibBuilder.loadTexts:
pemType.setDescription('Type of hardware element -- should always be pem or unequip.')
pem_cfg_type = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 4), config_redundancy()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemCfgType.setStatus('current')
if mibBuilder.loadTexts:
pemCfgType.setDescription('The configuration/redundancy of a hardware element.')
pem_run_state = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 5), hardware_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemRunState.setStatus('current')
if mibBuilder.loadTexts:
pemRunState.setDescription('The high-level hardware state (active, initializing, standby, etc.).')
pem_qualifier1 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 6), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemQualifier1.setStatus('current')
if mibBuilder.loadTexts:
pemQualifier1.setDescription('Further qualification/detail on the high-level hardware state.')
pem_qualifier2 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 7), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemQualifier2.setStatus('current')
if mibBuilder.loadTexts:
pemQualifier2.setDescription('Further qualification/detail on the high-level hardware state.')
pem_qualifier3 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 8), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemQualifier3.setStatus('current')
if mibBuilder.loadTexts:
pemQualifier3.setDescription('Further qualification/detail on the high-level hardware state.')
pem_qualifier4 = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 9), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemQualifier4.setStatus('current')
if mibBuilder.loadTexts:
pemQualifier4.setDescription('Further qualification/detail on the high-level hardware state.')
pem_start_time = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 10), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemStartTime.setStatus('current')
if mibBuilder.loadTexts:
pemStartTime.setDescription('The time (seconds) at which the hardware element was powered up.')
pem_vendor_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 11), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemVendorID.setStatus('current')
if mibBuilder.loadTexts:
pemVendorID.setDescription('The identifying number of the vendor of this hardware.')
pem_device_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 12), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemDeviceID.setStatus('current')
if mibBuilder.loadTexts:
pemDeviceID.setDescription('An identifying number specific to this device.')
pem_product_id = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 13), octet_string().subtype(subtypeSpec=value_size_constraint(0, 32))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemProductID.setStatus('current')
if mibBuilder.loadTexts:
pemProductID.setDescription('Versioning and other inventory information for this hardware element.')
pem_fpga_version = mib_table_column((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 5, 1, 14), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
pemFPGAVersion.setStatus('current')
if mibBuilder.loadTexts:
pemFPGAVersion.setDescription('The version of the TPT FPGA chip on this hardware.')
hw_num_slots = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 6), unsigned32()).setLabel('hw-numSlots').setMaxAccess('readonly')
if mibBuilder.loadTexts:
hw_numSlots.setStatus('current')
if mibBuilder.loadTexts:
hw_numSlots.setDescription('The number of slots for this device.')
hw_num_fans = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 7), unsigned32()).setLabel('hw-numFans').setMaxAccess('readonly')
if mibBuilder.loadTexts:
hw_numFans.setStatus('current')
if mibBuilder.loadTexts:
hw_numFans.setDescription('The number of fan subunits for this device.')
hw_num_power_supplies = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 8), unsigned32()).setLabel('hw-numPowerSupplies').setMaxAccess('readonly')
if mibBuilder.loadTexts:
hw_numPowerSupplies.setStatus('current')
if mibBuilder.loadTexts:
hw_numPowerSupplies.setDescription('The number of power supply subunits for this device.')
hw_num_pe_ms = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 9), unsigned32()).setLabel('hw-numPEMs').setMaxAccess('readonly')
if mibBuilder.loadTexts:
hw_numPEMs.setStatus('current')
if mibBuilder.loadTexts:
hw_numPEMs.setDescription('The number of PEM subunits for this device.')
hw_certificate_number = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 10), octet_string().subtype(subtypeSpec=value_size_constraint(0, 30))).setLabel('hw-certificateNumber').setMaxAccess('readonly')
if mibBuilder.loadTexts:
hw_certificateNumber.setStatus('current')
if mibBuilder.loadTexts:
hw_certificateNumber.setDescription('The hardware certficate number of the device.')
hw_serial_number = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 2, 3, 11), octet_string().subtype(subtypeSpec=value_size_constraint(0, 30))).setLabel('hw-serialNumber').setMaxAccess('readonly')
if mibBuilder.loadTexts:
hw_serialNumber.setStatus('current')
if mibBuilder.loadTexts:
hw_serialNumber.setDescription('The hardware serial number of the device.')
tpt_hardware_notify_device_id = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 1), octet_string().subtype(subtypeSpec=value_size_constraint(0, 40))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tptHardwareNotifyDeviceID.setStatus('current')
if mibBuilder.loadTexts:
tptHardwareNotifyDeviceID.setDescription('The unique identifier of the device sending this notification.')
tpt_hardware_notify_slot = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 2), extended_slot()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tptHardwareNotifySlot.setStatus('current')
if mibBuilder.loadTexts:
tptHardwareNotifySlot.setDescription('The slot of the hardware whose state has changed. If the hardware element is not a board, this value identifies it as a chassis, fan, power supply, PEM, etc.')
tpt_hardware_notify_port = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tptHardwareNotifyPort.setStatus('current')
if mibBuilder.loadTexts:
tptHardwareNotifyPort.setDescription('The port or sub-unit number of the hardware whose state has changed. Zero for a board, chassis, fan controller, power supply, or power entry module.')
tpt_hardware_notify_me_type = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 4), managed_element_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tptHardwareNotifyMeType.setStatus('current')
if mibBuilder.loadTexts:
tptHardwareNotifyMeType.setDescription('The type of the managed element (e.g., backplane, controller, power supply, fan, etc.) whose state has changed.')
tpt_hardware_notify_cfg_type = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 5), config_redundancy()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tptHardwareNotifyCfgType.setStatus('current')
if mibBuilder.loadTexts:
tptHardwareNotifyCfgType.setDescription('The configuration/redundancy of the hardware whose state has changed.')
tpt_hardware_notify_hl_state = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 6), hardware_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tptHardwareNotifyHlState.setStatus('current')
if mibBuilder.loadTexts:
tptHardwareNotifyHlState.setDescription('The high-level hardware state (active, initializing, standby, etc.).')
tpt_hardware_notify_hl_state_qual = mib_scalar((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 1, 7), hardware_state_qual()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
tptHardwareNotifyHlStateQual.setStatus('current')
if mibBuilder.loadTexts:
tptHardwareNotifyHlStateQual.setDescription('Further qualification/detail on the high-level state.')
tpt_hardware_notify = notification_type((1, 3, 6, 1, 4, 1, 10734, 3, 3, 3, 0, 7)).setObjects(('TPT-TPA-HARDWARE-MIB', 'tptHardwareNotifyDeviceID'), ('TPT-TPA-HARDWARE-MIB', 'tptHardwareNotifySlot'), ('TPT-TPA-HARDWARE-MIB', 'tptHardwareNotifyPort'), ('TPT-TPA-HARDWARE-MIB', 'tptHardwareNotifyMeType'), ('TPT-TPA-HARDWARE-MIB', 'tptHardwareNotifyCfgType'), ('TPT-TPA-HARDWARE-MIB', 'tptHardwareNotifyHlState'), ('TPT-TPA-HARDWARE-MIB', 'tptHardwareNotifyHlStateQual'))
if mibBuilder.loadTexts:
tptHardwareNotify.setStatus('current')
if mibBuilder.loadTexts:
tptHardwareNotify.setDescription('Notification: Used to inform the management station of changes in hardware state on the device.')
mibBuilder.exportSymbols('TPT-TPA-HARDWARE-MIB', slotVendorID=slotVendorID, hw_pemTable=hw_pemTable, hw_slotTable=hw_slotTable, tptHardwareNotifyPort=tptHardwareNotifyPort, slotInterface=slotInterface, slotNumber=slotNumber, chasQualifier1=chasQualifier1, PYSNMP_MODULE_ID=tpt_tpa_hardware_objs, hw_slotEntry=hw_slotEntry, chasQualifier3=chasQualifier3, hw_fanEntry=hw_fanEntry, tptHardwareNotifySlot=tptHardwareNotifySlot, hw_psEntry=hw_psEntry, chasCfgType=chasCfgType, chasQualifier4=chasQualifier4, psFPGAVersion=psFPGAVersion, fanRunState=fanRunState, LineType=LineType, chasQualifier2=chasQualifier2, hw_fanTable=hw_fanTable, hw_numSlots=hw_numSlots, slotQualifier2=slotQualifier2, fanVendorID=fanVendorID, psSubunit=psSubunit, ConfigRedundancy=ConfigRedundancy, fanType=fanType, DuplexState=DuplexState, slotPhysical=slotPhysical, fanCfgType=fanCfgType, fanProductID=fanProductID, pemCfgType=pemCfgType, pemQualifier2=pemQualifier2, tptHardwareNotifyMeType=tptHardwareNotifyMeType, slotProductID=slotProductID, chasNumber=chasNumber, chasDeviceID=chasDeviceID, pemType=pemType, pemDeviceID=pemDeviceID, hw_psTable=hw_psTable, slotQualifier1=slotQualifier1, tptHardwareNotifyDeviceID=tptHardwareNotifyDeviceID, fanQualifier3=fanQualifier3, slotDeviceID=slotDeviceID, pemVendorID=pemVendorID, psQualifier1=psQualifier1, psQualifier3=psQualifier3, HardwareStateQual=HardwareStateQual, hw_pemEntry=hw_pemEntry, fanQualifier2=fanQualifier2, slotType=slotType, fanFPGAVersion=fanFPGAVersion, chasRunState=chasRunState, pemSubunit=pemSubunit, chasType=chasType, fanStartTime=fanStartTime, fanQualifier4=fanQualifier4, slotDuplexState=slotDuplexState, tptHardwareNotify=tptHardwareNotify, hw_numPEMs=hw_numPEMs, slotQualifier4=slotQualifier4, chasProductID=chasProductID, tptHardwareNotifyHlStateQual=tptHardwareNotifyHlStateQual, hw_serialNumber=hw_serialNumber, pemStartTime=pemStartTime, slotFPGAVersion=slotFPGAVersion, chasVendorID=chasVendorID, pemQualifier4=pemQualifier4, fanQualifier1=fanQualifier1, chasStartTime=chasStartTime, hw_certificateNumber=hw_certificateNumber, psStartTime=psStartTime, pemFPGAVersion=pemFPGAVersion, psDeviceID=psDeviceID, fanSubunit=fanSubunit, slotLineType=slotLineType, slotPort=slotPort, pemQualifier3=pemQualifier3, SfpQualifier=SfpQualifier, tptHardwareNotifyCfgType=tptHardwareNotifyCfgType, psProductID=psProductID, pemProductID=pemProductID, pemQualifier1=pemQualifier1, slotRunState=slotRunState, fanDeviceID=fanDeviceID, ExtendedSlot=ExtendedSlot, psVendorID=psVendorID, psRunState=psRunState, hw_chasEntry=hw_chasEntry, psQualifier4=psQualifier4, HardwareState=HardwareState, ManagedElementType=ManagedElementType, psCfgType=psCfgType, slotSfpQualifier1=slotSfpQualifier1, hw_chasTable=hw_chasTable, psQualifier2=psQualifier2, hw_numFans=hw_numFans, tptHardwareNotifyHlState=tptHardwareNotifyHlState, tpt_tpa_hardware_objs=tpt_tpa_hardware_objs, chasFPGAVersion=chasFPGAVersion, pemRunState=pemRunState, slotQualifier3=slotQualifier3, slotCfgType=slotCfgType, hw_numPowerSupplies=hw_numPowerSupplies, psType=psType, slotSfpQualifier2=slotSfpQualifier2, slotStartTime=slotStartTime) |
class Solution:
def criticalConnections(self, n: int, connections: List[List[int]]) -> List[List[int]]:
INF = 1000000
lows = [INF] * n
ranks = [INF] * n
graph = collections.defaultdict(list)
for u, v in connections:
graph[u].append(v)
graph[v].append(u)
self.time = 0
def dfs(node, parent):
lows[node] = self.time
ranks[node] = self.time
self.time += 1
for nei in graph[node]:
if ranks[nei] == INF:
dfs(nei, node)
for nei in graph[node]:
if nei != parent:
lows[node] = min(lows[node], lows[nei])
dfs(0, -1)
ans = []
for u, v in connections:
if lows[v] > ranks[u] or lows[u] > ranks[v]:
ans.append([u, v])
return ans
| class Solution:
def critical_connections(self, n: int, connections: List[List[int]]) -> List[List[int]]:
inf = 1000000
lows = [INF] * n
ranks = [INF] * n
graph = collections.defaultdict(list)
for (u, v) in connections:
graph[u].append(v)
graph[v].append(u)
self.time = 0
def dfs(node, parent):
lows[node] = self.time
ranks[node] = self.time
self.time += 1
for nei in graph[node]:
if ranks[nei] == INF:
dfs(nei, node)
for nei in graph[node]:
if nei != parent:
lows[node] = min(lows[node], lows[nei])
dfs(0, -1)
ans = []
for (u, v) in connections:
if lows[v] > ranks[u] or lows[u] > ranks[v]:
ans.append([u, v])
return ans |
# mode: run
# ticket: 593
# tag: property, decorator
my_property = property
class Prop(object):
"""
>>> p = Prop()
>>> p.prop
GETTING 'None'
>>> p.prop = 1
SETTING '1' (previously: 'None')
>>> p.prop
GETTING '1'
1
>>> p.prop = 2
SETTING '2' (previously: '1')
>>> p.prop
GETTING '2'
2
>>> del p.prop
DELETING (previously: '2')
>>> p.my_prop
GETTING 'my_prop'
389
"""
_value = None
@property
def prop(self):
print("GETTING '%s'" % self._value)
return self._value
@prop.setter
def prop(self, value):
print("SETTING '%s' (previously: '%s')" % (value, self._value))
self._value = value
@prop.deleter
def prop(self):
print("DELETING (previously: '%s')" % self._value)
self._value = None
@my_property
def my_prop(self):
print("GETTING 'my_prop'")
return 389
| my_property = property
class Prop(object):
"""
>>> p = Prop()
>>> p.prop
GETTING 'None'
>>> p.prop = 1
SETTING '1' (previously: 'None')
>>> p.prop
GETTING '1'
1
>>> p.prop = 2
SETTING '2' (previously: '1')
>>> p.prop
GETTING '2'
2
>>> del p.prop
DELETING (previously: '2')
>>> p.my_prop
GETTING 'my_prop'
389
"""
_value = None
@property
def prop(self):
print("GETTING '%s'" % self._value)
return self._value
@prop.setter
def prop(self, value):
print("SETTING '%s' (previously: '%s')" % (value, self._value))
self._value = value
@prop.deleter
def prop(self):
print("DELETING (previously: '%s')" % self._value)
self._value = None
@my_property
def my_prop(self):
print("GETTING 'my_prop'")
return 389 |
l = [83, 85, 78, 123, 77, 52, 57, 53, 45, 102, 52, 110, 33, 125]
flag = ""
for c in l:
flag += chr(c)
print(flag)
| l = [83, 85, 78, 123, 77, 52, 57, 53, 45, 102, 52, 110, 33, 125]
flag = ''
for c in l:
flag += chr(c)
print(flag) |
class ServerObj:
"""Server class"""
def __init__(self):
self._name = ''
self._totalPhysicalMemory = 0
self._freePhysicalMemory = 0
self._disks = []
@property
def name(self):
return self._name
@name.setter
def name(self, n):
self._name = n
@property
def os(self):
return self._os
@os.setter
def os(self, o):
self._os = o
@property
def totalPhysicalMemory(self):
return self._totalPhysicalMemory
@totalPhysicalMemory.setter
def totalPhysicalMemory(self, tpm):
self._totalPhysicalMemory = tpm
@property
def freePhysicalMemory(self):
return self._freePhysicalMemory
@freePhysicalMemory.setter
def freePhysicalMemory(self, fpm):
self._freePhysicalMemory = fpm
@property
def disks(self):
return self._disks
@disks.setter
def disks(self, d):
self._disks = d | class Serverobj:
"""Server class"""
def __init__(self):
self._name = ''
self._totalPhysicalMemory = 0
self._freePhysicalMemory = 0
self._disks = []
@property
def name(self):
return self._name
@name.setter
def name(self, n):
self._name = n
@property
def os(self):
return self._os
@os.setter
def os(self, o):
self._os = o
@property
def total_physical_memory(self):
return self._totalPhysicalMemory
@totalPhysicalMemory.setter
def total_physical_memory(self, tpm):
self._totalPhysicalMemory = tpm
@property
def free_physical_memory(self):
return self._freePhysicalMemory
@freePhysicalMemory.setter
def free_physical_memory(self, fpm):
self._freePhysicalMemory = fpm
@property
def disks(self):
return self._disks
@disks.setter
def disks(self, d):
self._disks = d |
l,S1,final=[],[],[]
S=input('Enter the numbers: ')
S1=S.split()
for i in S1:
l.append(int(i))
final=str("['"+str(l)+"']")
print(final)
| (l, s1, final) = ([], [], [])
s = input('Enter the numbers: ')
s1 = S.split()
for i in S1:
l.append(int(i))
final = str("['" + str(l) + "']")
print(final) |
# Permutation
def permutation_rec(a):
if len(a) == 0:
return []
if len(a) == 1:
return [a]
l = []
for i in range(len(a)):
x = a[:i] + a[i+1:]
for j in permutation_rec(x):
str2 = a[i] + j
l.append(str2)
return l
count = 0
for r in permutation_rec('chip'):
count += 1
print(count, r)
| def permutation_rec(a):
if len(a) == 0:
return []
if len(a) == 1:
return [a]
l = []
for i in range(len(a)):
x = a[:i] + a[i + 1:]
for j in permutation_rec(x):
str2 = a[i] + j
l.append(str2)
return l
count = 0
for r in permutation_rec('chip'):
count += 1
print(count, r) |
# almostIncreasingSequence or "too big or too small"
# is there one exception to the list being sorted? (with no repeats)
# including being already sorted
# (User's) Problem
# We Have:
# list of int
# We Need:
# Is there one exception to the list being sorted? yes/no
# We Must:
# return boolean: true false
# use function name: almostIncreasingSequence()
# must be done in at least linear time? O(n)
# so do it one pass
#
# Solution (Product)
# issue: too big or too small
# is the out of place number too big or too small?
#
# edge case: if already sorted: true
# iterate through input_list
# compare each item to previous (so starting with index 1)
# if i+1 is smaller, remove that item from list and
# then recheck if list is now sorted
# if so, the list was only one-off from being sorted
# use set to remove duplicates
#
# issue: too big or too small
# because when there is an anomology it isn't clear which number to remove...
# if first number, it's too big
# if last number, it's too small
# if in middle: ?
# if backwards iterate is smaller than or equal to next 2 numbers
# then remove -i
# else remove -(i+1)
def almostIncreasingSequence(input_list):
# edge caes: if already sorted and no dupes, return true
if input_list == sorted(list(set(input_list))):
return True
# iterate through one time:
# and check before and after any anomaly found:
# anamoly = an item out of sequence
for i in range(len(input_list) - 1):
# look at previous: less than or = (repeating also not ok)
if input_list[i] >= input_list[i + 1]:
# conditionals for if out of place item is found
# case 1: first item: remove first
# case 2: last item: remove last
# case 3: middle item: dropping each in tern
#
# case 1: first item: remove first
if i == 0:
input_list.pop(i)
# case 2: last item: remove last
elif i == len(input_list) - 1:
input_list.pop(-1)
# case 3: in middle so maybe too big or too small
else:
list_copy = input_list.copy() # make a copy
list_copy.pop(i)
input_list.pop(i + 1)
if input_list == sorted(list(set(input_list))) or list_copy == sorted(
list(set(list_copy))
):
return True
else: # otherwise, false:
# more than one exception to being sorted
return False
| def almost_increasing_sequence(input_list):
if input_list == sorted(list(set(input_list))):
return True
for i in range(len(input_list) - 1):
if input_list[i] >= input_list[i + 1]:
if i == 0:
input_list.pop(i)
elif i == len(input_list) - 1:
input_list.pop(-1)
else:
list_copy = input_list.copy()
list_copy.pop(i)
input_list.pop(i + 1)
if input_list == sorted(list(set(input_list))) or list_copy == sorted(list(set(list_copy))):
return True
else:
return False |
# Header used at the top of log files and such
# usage: header = "(>'')><('')><(''<)"
header = r"""
_____ .__
____ ____ _____/ ____\_____ | | ___.__.
_/ ___\/ _ \ / \ __\\____ \| |< | |
\ \__( <_> ) | \ | | |_> > |_\___ |
\___ >____/|___| /__| | __/|____/ ____|
\/ \/ |__| \/
"""
# config elements overriden by the commandline
# usage: don't set this from configs see --config in help
__override_dict = {"confply": {}}
# config elements overriden by the commandline
# usage: don't set this from configs see --config in help
__override_list = []
# sets the desired tool to be used for the command.
# usage: tool = "clang"
tool = "default"
# path to the config file, used internally
# usage: don't use it
config_path = ""
# sets whether to run the resulting commands or not
# usage: run = True
run = True
# sets the topic of the log, e.g. [confply] confguring commands.
# usage: log_topic = "my command"
log_topic = "confply"
# enable debug logging
# usage: log_debug = True
log_debug = False
# if true, confply will log it's config.
# default behaviour is as if true.
# usage: log_config = False
log_config = False
# if set, confply will save it's output to the file
# default behaviour is as if unset, no logs created.
# usage: log_file = "../logs/my_command.log"
log_file = ""
# if true, confply will echo the log file to the terminal
# usage: echo_log_file = False
log_echo_file = False
# if set, confply will run the function after the command runs.
# usage: post_run = my_function
def confply_post_run(): pass
post_run = confply_post_run
# if set, confply will run the function after the config loads.
# usage: post_load = my_function
def confply_post_load(): pass
post_load = confply_post_load
# platform that the command is running on
# usage: if(platform == "linux"): pass
platform = "unknown"
# arguements that were passed to confply
# usage: if "debug" in args: pass
args = []
# list of configs the current config depends on
# usage: dependencies = ["config.py"]
dependencies = []
# appends to the end of the command
# usage: command_append = "-something-unsupported"
command_append = ""
# prepend to the start of the command
# usage: command_prepend_with = "-something-unsupported"
command_prepend = ""
# version control system
# usage: vcs = "git"
vcs = "git"
# path to the root of the vcs repository
# usage: log_file = vcs_root+"/logs/my_log.log"
vcs_root = "."
# author of latest submission/commit
# usage: log.normal(vcs_author)
vcs_author = "unknown"
# current branch
# usage: log.normal(vcs_branch)
vcs_branch = "unknown"
# latest submission/commit log
# usage: log.normal(vcs_log)
vcs_log = "unknown"
# mail server login details
# usage: mail_from = "confply@github.com"
mail_from = ""
# send messages to email address
# usage: mail_to = "graehu@github.com"
mail_to = ""
# mail server login details
# usage: __mail_login = ("username", "password")
__mail_login = ()
# mail hosting server
# usage: __mail_host = ""
__mail_host = "smtp.gmail.com"
# file attachments for the mail
# usage: mail_attachments = ["path/to/attachment.txt"]
mail_attachments = []
# what to send: None, failure, success, or all
# usage: slack_send = None
mail_send = "failure"
# files to upload with your message
# usage: slack_uploads = ["path/to/attachment.txt"]
slack_uploads = []
# bot token for the confply slack bot
# usage: __slack_bot_token = "random_hex_string"
__slack_bot_token = ""
# what to send: None, failure, success, or all
# usage: slack_send = None
slack_send = "failure"
| header = '\n _____ .__\n ____ ____ _____/ ____\\_____ | | ___.__.\n_/ ___\\/ _ \\ / \\ __\\\\____ \\| |< | |\n\\ \\__( <_> ) | \\ | | |_> > |_\\___ |\n \\___ >____/|___| /__| | __/|____/ ____|\n \\/ \\/ |__| \\/\n'
__override_dict = {'confply': {}}
__override_list = []
tool = 'default'
config_path = ''
run = True
log_topic = 'confply'
log_debug = False
log_config = False
log_file = ''
log_echo_file = False
def confply_post_run():
pass
post_run = confply_post_run
def confply_post_load():
pass
post_load = confply_post_load
platform = 'unknown'
args = []
dependencies = []
command_append = ''
command_prepend = ''
vcs = 'git'
vcs_root = '.'
vcs_author = 'unknown'
vcs_branch = 'unknown'
vcs_log = 'unknown'
mail_from = ''
mail_to = ''
__mail_login = ()
__mail_host = 'smtp.gmail.com'
mail_attachments = []
mail_send = 'failure'
slack_uploads = []
__slack_bot_token = ''
slack_send = 'failure' |
#
# PySNMP MIB module XEDIA-DHCP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XEDIA-DHCP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:36:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "ValueRangeConstraint")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup")
Unsigned32, Counter32, ObjectIdentity, IpAddress, MibIdentifier, TimeTicks, Integer32, Bits, NotificationType, iso, MibScalar, MibTable, MibTableRow, MibTableColumn, Gauge32, Counter64, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "Counter32", "ObjectIdentity", "IpAddress", "MibIdentifier", "TimeTicks", "Integer32", "Bits", "NotificationType", "iso", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Gauge32", "Counter64", "ModuleIdentity")
TextualConvention, TruthValue, DisplayString, RowStatus = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "TruthValue", "DisplayString", "RowStatus")
xediaMibs, = mibBuilder.importSymbols("XEDIA-REG", "xediaMibs")
xediaDhcpMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 838, 3, 28))
if mibBuilder.loadTexts: xediaDhcpMIB.setLastUpdated('9802232155Z')
if mibBuilder.loadTexts: xediaDhcpMIB.setOrganization('Xedia Corp.')
xdhcpObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 838, 3, 28, 1))
xdhcpConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 838, 3, 28, 2))
xdhcpRelay = MibIdentifier((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1))
xdhcpRelayMode = MibScalar((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: xdhcpRelayMode.setStatus('current')
xdhcpRelayMaxHops = MibScalar((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16)).clone(4)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: xdhcpRelayMaxHops.setStatus('current')
xdhcpRelayIncludeCircuitID = MibScalar((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 3), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: xdhcpRelayIncludeCircuitID.setStatus('current')
xdhcpRelayDestTable = MibTable((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10), )
if mibBuilder.loadTexts: xdhcpRelayDestTable.setStatus('current')
xdhcpRelayDestEntry = MibTableRow((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1), ).setIndexNames((0, "XEDIA-DHCP-MIB", "xdhcpRelayDestIndex"))
if mibBuilder.loadTexts: xdhcpRelayDestEntry.setStatus('current')
xdhcpRelayDestIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16)))
if mibBuilder.loadTexts: xdhcpRelayDestIndex.setStatus('current')
xdhcpRelayDestination = MibTableColumn((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 2), DisplayString()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: xdhcpRelayDestination.setStatus('current')
xdhcpRelayDestOperAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 3), IpAddress().clone(hexValue="00000000")).setMaxAccess("readonly")
if mibBuilder.loadTexts: xdhcpRelayDestOperAddress.setStatus('current')
xdhcpRelayDestRequests = MibTableColumn((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: xdhcpRelayDestRequests.setStatus('current')
xdhcpRelayDestReplies = MibTableColumn((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: xdhcpRelayDestReplies.setStatus('current')
xdhcpRelayDestProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("dhcp", 1), ("bootp", 2), ("dhcpAndBootp", 3))).clone('dhcpAndBootp')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: xdhcpRelayDestProtocol.setStatus('current')
xdhcpRelayDestRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 7), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: xdhcpRelayDestRowStatus.setStatus('current')
xdhcpRelayDestInterface = MibTableColumn((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 8), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 7)).clone('all')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: xdhcpRelayDestInterface.setStatus('current')
xdhcpCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 838, 3, 28, 2, 1))
xdhcpGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 838, 3, 28, 2, 2))
xdhcpCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 838, 3, 28, 2, 1, 1)).setObjects(("XEDIA-DHCP-MIB", "xdhcpAllGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
xdhcpCompliance = xdhcpCompliance.setStatus('current')
xdhcpAllGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 838, 3, 28, 2, 2, 1)).setObjects(("XEDIA-DHCP-MIB", "xdhcpRelayMode"), ("XEDIA-DHCP-MIB", "xdhcpRelayMaxHops"), ("XEDIA-DHCP-MIB", "xdhcpRelayIncludeCircuitID"), ("XEDIA-DHCP-MIB", "xdhcpRelayDestination"), ("XEDIA-DHCP-MIB", "xdhcpRelayDestOperAddress"), ("XEDIA-DHCP-MIB", "xdhcpRelayDestRequests"), ("XEDIA-DHCP-MIB", "xdhcpRelayDestReplies"), ("XEDIA-DHCP-MIB", "xdhcpRelayDestProtocol"), ("XEDIA-DHCP-MIB", "xdhcpRelayDestRowStatus"), ("XEDIA-DHCP-MIB", "xdhcpRelayDestInterface"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
xdhcpAllGroup = xdhcpAllGroup.setStatus('current')
mibBuilder.exportSymbols("XEDIA-DHCP-MIB", PYSNMP_MODULE_ID=xediaDhcpMIB, xdhcpRelayMode=xdhcpRelayMode, xdhcpRelayDestReplies=xdhcpRelayDestReplies, xdhcpRelayDestInterface=xdhcpRelayDestInterface, xdhcpRelayDestRowStatus=xdhcpRelayDestRowStatus, xdhcpRelayMaxHops=xdhcpRelayMaxHops, xdhcpCompliances=xdhcpCompliances, xdhcpGroups=xdhcpGroups, xdhcpRelayIncludeCircuitID=xdhcpRelayIncludeCircuitID, xdhcpCompliance=xdhcpCompliance, xdhcpAllGroup=xdhcpAllGroup, xdhcpConformance=xdhcpConformance, xdhcpRelayDestination=xdhcpRelayDestination, xdhcpRelayDestEntry=xdhcpRelayDestEntry, xdhcpObjects=xdhcpObjects, xdhcpRelayDestTable=xdhcpRelayDestTable, xdhcpRelayDestIndex=xdhcpRelayDestIndex, xdhcpRelay=xdhcpRelay, xdhcpRelayDestProtocol=xdhcpRelayDestProtocol, xdhcpRelayDestRequests=xdhcpRelayDestRequests, xediaDhcpMIB=xediaDhcpMIB, xdhcpRelayDestOperAddress=xdhcpRelayDestOperAddress)
| (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_union, constraints_intersection, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection', 'ValueRangeConstraint')
(if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex')
(module_compliance, notification_group, object_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup', 'ObjectGroup')
(unsigned32, counter32, object_identity, ip_address, mib_identifier, time_ticks, integer32, bits, notification_type, iso, mib_scalar, mib_table, mib_table_row, mib_table_column, gauge32, counter64, module_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'Unsigned32', 'Counter32', 'ObjectIdentity', 'IpAddress', 'MibIdentifier', 'TimeTicks', 'Integer32', 'Bits', 'NotificationType', 'iso', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Gauge32', 'Counter64', 'ModuleIdentity')
(textual_convention, truth_value, display_string, row_status) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'TruthValue', 'DisplayString', 'RowStatus')
(xedia_mibs,) = mibBuilder.importSymbols('XEDIA-REG', 'xediaMibs')
xedia_dhcp_mib = module_identity((1, 3, 6, 1, 4, 1, 838, 3, 28))
if mibBuilder.loadTexts:
xediaDhcpMIB.setLastUpdated('9802232155Z')
if mibBuilder.loadTexts:
xediaDhcpMIB.setOrganization('Xedia Corp.')
xdhcp_objects = mib_identifier((1, 3, 6, 1, 4, 1, 838, 3, 28, 1))
xdhcp_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 838, 3, 28, 2))
xdhcp_relay = mib_identifier((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1))
xdhcp_relay_mode = mib_scalar((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
xdhcpRelayMode.setStatus('current')
xdhcp_relay_max_hops = mib_scalar((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 16)).clone(4)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
xdhcpRelayMaxHops.setStatus('current')
xdhcp_relay_include_circuit_id = mib_scalar((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 3), truth_value().clone('false')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
xdhcpRelayIncludeCircuitID.setStatus('current')
xdhcp_relay_dest_table = mib_table((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10))
if mibBuilder.loadTexts:
xdhcpRelayDestTable.setStatus('current')
xdhcp_relay_dest_entry = mib_table_row((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1)).setIndexNames((0, 'XEDIA-DHCP-MIB', 'xdhcpRelayDestIndex'))
if mibBuilder.loadTexts:
xdhcpRelayDestEntry.setStatus('current')
xdhcp_relay_dest_index = mib_table_column((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 16)))
if mibBuilder.loadTexts:
xdhcpRelayDestIndex.setStatus('current')
xdhcp_relay_destination = mib_table_column((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 2), display_string()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
xdhcpRelayDestination.setStatus('current')
xdhcp_relay_dest_oper_address = mib_table_column((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 3), ip_address().clone(hexValue='00000000')).setMaxAccess('readonly')
if mibBuilder.loadTexts:
xdhcpRelayDestOperAddress.setStatus('current')
xdhcp_relay_dest_requests = mib_table_column((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
xdhcpRelayDestRequests.setStatus('current')
xdhcp_relay_dest_replies = mib_table_column((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
xdhcpRelayDestReplies.setStatus('current')
xdhcp_relay_dest_protocol = mib_table_column((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('dhcp', 1), ('bootp', 2), ('dhcpAndBootp', 3))).clone('dhcpAndBootp')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
xdhcpRelayDestProtocol.setStatus('current')
xdhcp_relay_dest_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 7), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
xdhcpRelayDestRowStatus.setStatus('current')
xdhcp_relay_dest_interface = mib_table_column((1, 3, 6, 1, 4, 1, 838, 3, 28, 1, 1, 10, 1, 8), display_string().subtype(subtypeSpec=value_size_constraint(0, 7)).clone('all')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
xdhcpRelayDestInterface.setStatus('current')
xdhcp_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 838, 3, 28, 2, 1))
xdhcp_groups = mib_identifier((1, 3, 6, 1, 4, 1, 838, 3, 28, 2, 2))
xdhcp_compliance = module_compliance((1, 3, 6, 1, 4, 1, 838, 3, 28, 2, 1, 1)).setObjects(('XEDIA-DHCP-MIB', 'xdhcpAllGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
xdhcp_compliance = xdhcpCompliance.setStatus('current')
xdhcp_all_group = object_group((1, 3, 6, 1, 4, 1, 838, 3, 28, 2, 2, 1)).setObjects(('XEDIA-DHCP-MIB', 'xdhcpRelayMode'), ('XEDIA-DHCP-MIB', 'xdhcpRelayMaxHops'), ('XEDIA-DHCP-MIB', 'xdhcpRelayIncludeCircuitID'), ('XEDIA-DHCP-MIB', 'xdhcpRelayDestination'), ('XEDIA-DHCP-MIB', 'xdhcpRelayDestOperAddress'), ('XEDIA-DHCP-MIB', 'xdhcpRelayDestRequests'), ('XEDIA-DHCP-MIB', 'xdhcpRelayDestReplies'), ('XEDIA-DHCP-MIB', 'xdhcpRelayDestProtocol'), ('XEDIA-DHCP-MIB', 'xdhcpRelayDestRowStatus'), ('XEDIA-DHCP-MIB', 'xdhcpRelayDestInterface'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
xdhcp_all_group = xdhcpAllGroup.setStatus('current')
mibBuilder.exportSymbols('XEDIA-DHCP-MIB', PYSNMP_MODULE_ID=xediaDhcpMIB, xdhcpRelayMode=xdhcpRelayMode, xdhcpRelayDestReplies=xdhcpRelayDestReplies, xdhcpRelayDestInterface=xdhcpRelayDestInterface, xdhcpRelayDestRowStatus=xdhcpRelayDestRowStatus, xdhcpRelayMaxHops=xdhcpRelayMaxHops, xdhcpCompliances=xdhcpCompliances, xdhcpGroups=xdhcpGroups, xdhcpRelayIncludeCircuitID=xdhcpRelayIncludeCircuitID, xdhcpCompliance=xdhcpCompliance, xdhcpAllGroup=xdhcpAllGroup, xdhcpConformance=xdhcpConformance, xdhcpRelayDestination=xdhcpRelayDestination, xdhcpRelayDestEntry=xdhcpRelayDestEntry, xdhcpObjects=xdhcpObjects, xdhcpRelayDestTable=xdhcpRelayDestTable, xdhcpRelayDestIndex=xdhcpRelayDestIndex, xdhcpRelay=xdhcpRelay, xdhcpRelayDestProtocol=xdhcpRelayDestProtocol, xdhcpRelayDestRequests=xdhcpRelayDestRequests, xediaDhcpMIB=xediaDhcpMIB, xdhcpRelayDestOperAddress=xdhcpRelayDestOperAddress) |
class CustomError(Exception):
def __init__(self, *args):
if args:
self.topic = args[0]
else:
self.topic = None
def __str__(self):
if self.topic:
return 'Custom Error:, {0}'.format(self.topic)
class MessageHandler(object):
def __init__(self, event):
self.pass_event(event)
@staticmethod
def pass_event(event):
if event.get('documentType') != 'microsoft-word':
raise CustomError("Not correct document type")
| class Customerror(Exception):
def __init__(self, *args):
if args:
self.topic = args[0]
else:
self.topic = None
def __str__(self):
if self.topic:
return 'Custom Error:, {0}'.format(self.topic)
class Messagehandler(object):
def __init__(self, event):
self.pass_event(event)
@staticmethod
def pass_event(event):
if event.get('documentType') != 'microsoft-word':
raise custom_error('Not correct document type') |
class Solution:
# @return a string
def longestCommonPrefix(self, strs):
n = len(strs)
if n == 0:
return ''
if n == 1:
return strs[0]
prefix = ''
m = min([len(s) for s in strs])
for i in range(m):
first = strs[0]
common = True
for s in strs[1:]:
if first[i] != s[i]:
common = False
break
if not common:
break
else:
prefix += first[i]
return prefix
| class Solution:
def longest_common_prefix(self, strs):
n = len(strs)
if n == 0:
return ''
if n == 1:
return strs[0]
prefix = ''
m = min([len(s) for s in strs])
for i in range(m):
first = strs[0]
common = True
for s in strs[1:]:
if first[i] != s[i]:
common = False
break
if not common:
break
else:
prefix += first[i]
return prefix |
"""Shared constants."""
# Wiktionary dump URL
# {0}: current locale
# {1}: dump date
BASE_URL = "https://dumps.wikimedia.org/{0}wiktionary"
DUMP_URL = f"{BASE_URL}/{{1}}/{{0}}wiktionary-{{1}}-pages-meta-current.xml.bz2"
# GitHub stuff
# {0}: current locale
REPOS = "BoboTiG/ebook-reader-dict"
GH_REPOS = f"https://github.com/{REPOS}"
RELEASE_URL = f"https://api.github.com/repos/{REPOS}/releases/tags/{{0}}"
DOWNLOAD_URL_DICTFILE = f"{GH_REPOS}/releases/download/{{0}}/dict-{{0}}.df"
DOWNLOAD_URL_KOBO = f"{GH_REPOS}/releases/download/{{0}}/dicthtml-{{0}}.zip"
DOWNLOAD_URL_STARDICT = f"{GH_REPOS}/releases/download/{{0}}/dict-{{0}}.zip"
# HTML formatting for each word
# TODO: move that into the dict specific class
WORD_FORMAT = """
<w>
<p>
<a name="{word}"/><b>{current_word}</b>{pronunciation}{genre}
<ol>{definitions}</ol>
<br/>
{etymology}
</p>
{var}
</w>
"""
# Inline CSS for inline images handling <math> tags.
IMG_CSS = ";".join(
[
# try to keep a height proportional to the current font height
"height: 100%",
"max-height: 0.8em",
"width: auto",
# and adjust the vertical alignment to not alter the line height
"vertical-align: bottom",
]
).replace(" ", "")
| """Shared constants."""
base_url = 'https://dumps.wikimedia.org/{0}wiktionary'
dump_url = f'{BASE_URL}/{{1}}/{{0}}wiktionary-{{1}}-pages-meta-current.xml.bz2'
repos = 'BoboTiG/ebook-reader-dict'
gh_repos = f'https://github.com/{REPOS}'
release_url = f'https://api.github.com/repos/{REPOS}/releases/tags/{{0}}'
download_url_dictfile = f'{GH_REPOS}/releases/download/{{0}}/dict-{{0}}.df'
download_url_kobo = f'{GH_REPOS}/releases/download/{{0}}/dicthtml-{{0}}.zip'
download_url_stardict = f'{GH_REPOS}/releases/download/{{0}}/dict-{{0}}.zip'
word_format = '\n<w>\n <p>\n <a name="{word}"/><b>{current_word}</b>{pronunciation}{genre}\n <ol>{definitions}</ol>\n <br/>\n {etymology}\n </p>\n {var}\n</w>\n'
img_css = ';'.join(['height: 100%', 'max-height: 0.8em', 'width: auto', 'vertical-align: bottom']).replace(' ', '') |
def parseSolutions(solutions, orderList):
parsedSolutions = []
for solution in solutions:
solutionItems = solution.items()
schedule = []
finishTimes = []
for item in solutionItems:
if "enter" in item[0]:
parsedItem = item[0].split("-")
order = orderList.orderFromID(int(parsedItem[0]))
schedule.append((order, parsedItem[2], item[1]))
if "finish" in item[0]:
parsedItem = item[0].split("-")
order = orderList.orderFromID(int(parsedItem[0]))
finishTimes.append((order, item[1]))
schedule.sort(lambda a, b: cmp(a[2], b[2]))
finishTimes.sort(lambda a, b: cmp(a[1], b[1]))
parsedSolutions.append((schedule, finishTimes))
return parsedSolutions
| def parse_solutions(solutions, orderList):
parsed_solutions = []
for solution in solutions:
solution_items = solution.items()
schedule = []
finish_times = []
for item in solutionItems:
if 'enter' in item[0]:
parsed_item = item[0].split('-')
order = orderList.orderFromID(int(parsedItem[0]))
schedule.append((order, parsedItem[2], item[1]))
if 'finish' in item[0]:
parsed_item = item[0].split('-')
order = orderList.orderFromID(int(parsedItem[0]))
finishTimes.append((order, item[1]))
schedule.sort(lambda a, b: cmp(a[2], b[2]))
finishTimes.sort(lambda a, b: cmp(a[1], b[1]))
parsedSolutions.append((schedule, finishTimes))
return parsedSolutions |
# Copyright 2014-2019 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2015 Bassirou Ndaw <https://github.com/bassn>
# Copyright 2015 Alexis de Lattre <https://github.com/alexis-via>
# Copyright 2016-2017 Stanislav Krotov <https://it-projects.info/team/ufaks>
# Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
# Copyright 2017 Artyom Losev
# Copyright 2017 Lilia Salihova
# Copyright 2017-2018 Gabbasov Dinar <https://it-projects.info/team/GabbasovDinar>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License MIT (https://opensource.org/licenses/MIT).
{
"name": "POS: Prepaid credits",
"summary": "Comfortable sales for your regular customers. Debt payment method for POS",
"category": "Point Of Sale",
"images": ["images/debt_notebook.png"],
"version": "12.0.5.3.2",
"author": "IT-Projects LLC, Ivan Yelizariev",
"support": "apps@itpp.dev",
"website": "https://apps.odoo.com/apps/modules/12.0/pos_debt_notebook/",
"license": "Other OSI approved licence", # MIT
"price": 280.00,
"currency": "EUR",
"external_dependencies": {"python": [], "bin": []},
"depends": ["point_of_sale"],
"data": [
"security/pos_debt_notebook_security.xml",
"data/product.xml",
"views/pos_debt_report_view.xml",
"views.xml",
"views/pos_credit_update.xml",
"wizard/pos_credit_invoices_views.xml",
"wizard/pos_credit_company_invoices_views.xml",
"data.xml",
"security/ir.model.access.csv",
],
"qweb": ["static/src/xml/pos.xml"],
"demo": ["data/demo.xml"],
"installable": True,
"uninstall_hook": "pre_uninstall",
"demo_title": "POS Debt/Credit Notebook",
"demo_addons": [],
"demo_addons_hidden": [],
"demo_url": "pos-debt-notebook",
"demo_summary": "Comfortable sales for your regular customers.",
"demo_images": ["images/debt_notebook.png"],
}
| {'name': 'POS: Prepaid credits', 'summary': 'Comfortable sales for your regular customers. Debt payment method for POS', 'category': 'Point Of Sale', 'images': ['images/debt_notebook.png'], 'version': '12.0.5.3.2', 'author': 'IT-Projects LLC, Ivan Yelizariev', 'support': 'apps@itpp.dev', 'website': 'https://apps.odoo.com/apps/modules/12.0/pos_debt_notebook/', 'license': 'Other OSI approved licence', 'price': 280.0, 'currency': 'EUR', 'external_dependencies': {'python': [], 'bin': []}, 'depends': ['point_of_sale'], 'data': ['security/pos_debt_notebook_security.xml', 'data/product.xml', 'views/pos_debt_report_view.xml', 'views.xml', 'views/pos_credit_update.xml', 'wizard/pos_credit_invoices_views.xml', 'wizard/pos_credit_company_invoices_views.xml', 'data.xml', 'security/ir.model.access.csv'], 'qweb': ['static/src/xml/pos.xml'], 'demo': ['data/demo.xml'], 'installable': True, 'uninstall_hook': 'pre_uninstall', 'demo_title': 'POS Debt/Credit Notebook', 'demo_addons': [], 'demo_addons_hidden': [], 'demo_url': 'pos-debt-notebook', 'demo_summary': 'Comfortable sales for your regular customers.', 'demo_images': ['images/debt_notebook.png']} |
""" Implement shared pieces of Erlang node negotiation and distribution
protocol
"""
DIST_VSN = 5
DIST_VSN_PAIR = (DIST_VSN, DIST_VSN)
" Supported distribution protocol version (MAX,MIN). "
def dist_version_check(max_min: tuple) -> bool:
""" Check pair of versions against version which is supported by us
:type max_min: tuple(int, int)
:param max_min: (Max, Min) version pair for peer-supported dist version
"""
return max_min[0] >= DIST_VSN >= max_min[1]
# __all__ = ['DIST_VSN', 'DIST_VSN_PAIR']
| """ Implement shared pieces of Erlang node negotiation and distribution
protocol
"""
dist_vsn = 5
dist_vsn_pair = (DIST_VSN, DIST_VSN)
' Supported distribution protocol version (MAX,MIN). '
def dist_version_check(max_min: tuple) -> bool:
""" Check pair of versions against version which is supported by us
:type max_min: tuple(int, int)
:param max_min: (Max, Min) version pair for peer-supported dist version
"""
return max_min[0] >= DIST_VSN >= max_min[1] |
description = 'BOA Translations stages'
pvprefix = 'SQ:BOA:mcu2:'
devices = dict(
translation_300mm_a = device('nicos_ess.devices.epics.motor.EpicsMotor',
description = 'Translation 1',
motorpv = pvprefix + 'TVA',
errormsgpv = pvprefix + 'TVA-MsgTxt',
),
translation_300mm_b = device('nicos_ess.devices.epics.motor.EpicsMotor',
description = 'Translation 2',
motorpv = pvprefix + 'TVB',
errormsgpv = pvprefix + 'TVB-MsgTxt',
),
)
| description = 'BOA Translations stages'
pvprefix = 'SQ:BOA:mcu2:'
devices = dict(translation_300mm_a=device('nicos_ess.devices.epics.motor.EpicsMotor', description='Translation 1', motorpv=pvprefix + 'TVA', errormsgpv=pvprefix + 'TVA-MsgTxt'), translation_300mm_b=device('nicos_ess.devices.epics.motor.EpicsMotor', description='Translation 2', motorpv=pvprefix + 'TVB', errormsgpv=pvprefix + 'TVB-MsgTxt')) |
query = """
select * from languages;
"""
query = """
select *
from games
where test=0
"""
def get_query():
query = f"SELEct max(weight) from world where ocean='Atlantic'"
return query
def get_query():
limit = 6
query = f"SELEct speed from world where animal='dolphin' limit {limit}"
return query
def return_5():
query = 'select 5'
return query
def insert():
query = '''
insert into table_name (column1, column2, column3)
values (value1, value2, value3);
'''
return query
def join():
query = '''
select Orders.OrderID, Customers.CustomerName, Orders.OrderDate
from Orders
inner join Customers on Orders.CustomerID=Customers.CustomerID;
'''
return query
| query = '\n select * from languages;\n'
query = '\n select *\n from games\n where test=0\n'
def get_query():
query = f"SELEct max(weight) from world where ocean='Atlantic'"
return query
def get_query():
limit = 6
query = f"SELEct speed from world where animal='dolphin' limit {limit}"
return query
def return_5():
query = 'select 5'
return query
def insert():
query = '\n insert into table_name (column1, column2, column3)\n values (value1, value2, value3);\n '
return query
def join():
query = '\n select Orders.OrderID, Customers.CustomerName, Orders.OrderDate\n from Orders\n inner join Customers on Orders.CustomerID=Customers.CustomerID;\n '
return query |
def frac(num1,num2):
if num1 == 0 or num2 ==0:
return 0
else:
sum1 = num1 / num2
sum1 = str(sum1)
sum1 = sum1.split(".")
final = "0."+ sum1[1][0]
final = float(final)
return final
print(frac(4,1)) | def frac(num1, num2):
if num1 == 0 or num2 == 0:
return 0
else:
sum1 = num1 / num2
sum1 = str(sum1)
sum1 = sum1.split('.')
final = '0.' + sum1[1][0]
final = float(final)
return final
print(frac(4, 1)) |
my_dict = {}
my_dict[(1,2,4)] = 8
my_dict[(4,2,1)] = 10
my_dict[(1,2)] = 12
sum = 0
for k in my_dict:
sum += my_dict[k]
print (sum)
print(my_dict)
| my_dict = {}
my_dict[1, 2, 4] = 8
my_dict[4, 2, 1] = 10
my_dict[1, 2] = 12
sum = 0
for k in my_dict:
sum += my_dict[k]
print(sum)
print(my_dict) |
def increase(colour, increments):
"""Take a colour and increase each channel by the increments given in the list"""
colour_values = [int(colour[1:3], 16), int(colour[3:5], 16), int(colour[5:], 16)]
output = [min(255, colour_values[0] + increments[0]), min(255, colour_values[1] + increments[1]), min(255, colour_values[2] + increments[2])]
output = [max(0, output[0]), max(0, output[1]), max(0, output[2])]
return '#{}{}{}'.format(hex(output[0])[2:], hex(output[1])[2:], hex(output[2])[2:])
def multiply(colour, multipliers):
"""Take a colour and multiply each channel by the multipliers given in the list"""
colour_values = [int(colour[1:3], 16), int(colour[3:5], 16), int(colour[5:], 16)]
output = [min(255, colour_values[0] * multipliers[0]), min(255, colour_values[1] * multipliers[1]), min(255, colour_values[2] * multipliers[2])]
output = [max(0, output[0]), max(0, output[1]), max(0, output[2])]
return '#{}{}{}'.format(hex(output[0])[2:], hex(output[1])[2:], hex(output[2])[2:]) | def increase(colour, increments):
"""Take a colour and increase each channel by the increments given in the list"""
colour_values = [int(colour[1:3], 16), int(colour[3:5], 16), int(colour[5:], 16)]
output = [min(255, colour_values[0] + increments[0]), min(255, colour_values[1] + increments[1]), min(255, colour_values[2] + increments[2])]
output = [max(0, output[0]), max(0, output[1]), max(0, output[2])]
return '#{}{}{}'.format(hex(output[0])[2:], hex(output[1])[2:], hex(output[2])[2:])
def multiply(colour, multipliers):
"""Take a colour and multiply each channel by the multipliers given in the list"""
colour_values = [int(colour[1:3], 16), int(colour[3:5], 16), int(colour[5:], 16)]
output = [min(255, colour_values[0] * multipliers[0]), min(255, colour_values[1] * multipliers[1]), min(255, colour_values[2] * multipliers[2])]
output = [max(0, output[0]), max(0, output[1]), max(0, output[2])]
return '#{}{}{}'.format(hex(output[0])[2:], hex(output[1])[2:], hex(output[2])[2:]) |
user = input("Say something! ")
print(user.upper())
print(user.lower())
print(user.swapcase())
| user = input('Say something! ')
print(user.upper())
print(user.lower())
print(user.swapcase()) |
# 1. The code below prints the numbers from 1 to 50. Rewrite the code using a while loop to
# accomplish the same thing.
# for i in range(1,51):
# print(i)
i = 1
while i <= 50:
print(i)
i += 1
| i = 1
while i <= 50:
print(i)
i += 1 |
#!/usr/bin/env python
def vowel_percent(in_str):
vowels = 'aeiou'
consonants = 'bcdfghjklmnpqrstvwxyz'
vowel_count = 0
consonant_count = 0
total = 0
for a_char in in_str:
if a_char in vowels or a_char in consonants:
total += 1 # only increment total for letters, not space/punctuation
if a_char in vowels:
vowel_count += 1
else:
consonant_count += 1
if total != 0: # don't want to divide by zero
_vowel_percent = (100.0*vowel_count)/total
else:
_vowel_percent = 0.0
print("Letters in string '{}' are {:.2f} percent vowels.".
format(in_str, _vowel_percent))
def main():
vowel_percent('The quick brown fox jumped over the lazy dog')
vowel_percent('XYZ')
if __name__ == '__main__':
main()
| def vowel_percent(in_str):
vowels = 'aeiou'
consonants = 'bcdfghjklmnpqrstvwxyz'
vowel_count = 0
consonant_count = 0
total = 0
for a_char in in_str:
if a_char in vowels or a_char in consonants:
total += 1
if a_char in vowels:
vowel_count += 1
else:
consonant_count += 1
if total != 0:
_vowel_percent = 100.0 * vowel_count / total
else:
_vowel_percent = 0.0
print("Letters in string '{}' are {:.2f} percent vowels.".format(in_str, _vowel_percent))
def main():
vowel_percent('The quick brown fox jumped over the lazy dog')
vowel_percent('XYZ')
if __name__ == '__main__':
main() |
#Code written by Ryan Helgoth
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
sol = []
for i in range(len(nums)):
currentNum = nums[i]
if currentNum <= target:
amountLeft = target - currentNum
try:
index1 = i
index2 = nums.index(amountLeft)
if index1 != index2:
print("Solution found on itteration number {}".format(i+1))
return [index1, index2]
else:
print("Solution not found on itteration number {}".format(i+1))
except ValueError:
print("Solution not found on itteration number {}".format(i+1)) | class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
sol = []
for i in range(len(nums)):
current_num = nums[i]
if currentNum <= target:
amount_left = target - currentNum
try:
index1 = i
index2 = nums.index(amountLeft)
if index1 != index2:
print('Solution found on itteration number {}'.format(i + 1))
return [index1, index2]
else:
print('Solution not found on itteration number {}'.format(i + 1))
except ValueError:
print('Solution not found on itteration number {}'.format(i + 1)) |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 14 09:13:30 2019
@author: NOTEBOOK
"""
def main():
g = 'green'
o = 'orange'
p = 'purple'
print('')
print('Welcome to your Color mixing application '+
'Please be aware that you can only input '+
'primary colours(red,blue,yellow)')
slot_1 = input('Enter color 1: ')
slot_2 = input('Enter color 2: ')
print('')
if (slot_1 == 'red' and slot_2 == 'blue') \
or (slot_1 == 'blue' and slot_2 == 'red'):
print ('Colour mixture results in', p)
elif (slot_1 == 'red' and slot_2 == 'yellow')\
or (slot_1 == 'yellow' and slot_2 == 'red'):
print ('Colour mixture results in', o)
elif (slot_1 == 'yellow' and slot_2 == 'blue') \
or (slot_1 == 'blue' and slot_2 == 'yellow'):
print ('Colour mixture results in', g)
else:
print('')
print('Error!!!! please input primary colors only!!')
main()
| """
Created on Sat Dec 14 09:13:30 2019
@author: NOTEBOOK
"""
def main():
g = 'green'
o = 'orange'
p = 'purple'
print('')
print('Welcome to your Color mixing application ' + 'Please be aware that you can only input ' + 'primary colours(red,blue,yellow)')
slot_1 = input('Enter color 1: ')
slot_2 = input('Enter color 2: ')
print('')
if slot_1 == 'red' and slot_2 == 'blue' or (slot_1 == 'blue' and slot_2 == 'red'):
print('Colour mixture results in', p)
elif slot_1 == 'red' and slot_2 == 'yellow' or (slot_1 == 'yellow' and slot_2 == 'red'):
print('Colour mixture results in', o)
elif slot_1 == 'yellow' and slot_2 == 'blue' or (slot_1 == 'blue' and slot_2 == 'yellow'):
print('Colour mixture results in', g)
else:
print('')
print('Error!!!! please input primary colors only!!')
main() |
class UsersPage:
TITLE = "All users"
INVITE_BUTTON = "Invite a new user"
MANAGE_ROLES_BUTTON = "Manage roles"
INVITE_SUCCESSFUL_BANNER = "User has been invited successfully"
class Table:
NAME = "Name"
EMAIL = "Email"
TEAM = "Team"
ROLE = "Role"
STATUS = "Status"
ACTIONS = "Actions"
PENDING = "Pending"
VIEW = "View"
class UserProfile:
BACK_LINK = "Back to " + UsersPage.TITLE.lower()
EDIT_BUTTON = "Edit user"
REACTIVATE_BUTTON = "Reactivate user"
DEACTIVATE_BUTTON = "Deactivate user"
class SummaryList:
FIRST_NAME = "First name"
LAST_NAME = "Last name"
EMAIL = "Email"
TEAM = "Team"
ROLE = "Role"
CHANGE = "Change"
DEFAULT_QUEUE = "Default queue"
class AddUserForm:
BACK_LINK = "Back to " + UsersPage.TITLE.lower()
TITLE = "Invite a user"
class Email:
TITLE = "Email"
DESCRIPTION = ""
class Team:
TITLE = "Team"
DESCRIPTION = ""
class Role:
TITLE = "Role"
DESCRIPTION = ""
class DefaultQueue:
TITLE = "Default queue"
DESCRIPTION = ""
class EditUserForm:
BACK_LINK = "Back to {0} {1}"
TITLE = "Edit {0} {1}"
SUBMIT_BUTTON = "Save and return"
class Email:
TITLE = "Email"
DESCRIPTION = ""
class Team:
TITLE = "Team"
DESCRIPTION = ""
class Role:
TITLE = "Role"
DESCRIPTION = ""
class DefaultQueue:
TITLE = "Default queue"
DESCRIPTION = ""
class ManagePage:
MANAGE_ROLES = "Manage roles"
PENDING = "Pending"
REACTIVATE_USER = "Reactivate user"
DEACTIVATE_USER = "Deactivate user"
CANCEL = "Cancel"
class AssignUserPage:
USER_ERROR_MESSAGE = "Select or search for the user you want to assign the case to"
QUEUE_ERROR_MESSAGE = "Select or search for a team queue"
| class Userspage:
title = 'All users'
invite_button = 'Invite a new user'
manage_roles_button = 'Manage roles'
invite_successful_banner = 'User has been invited successfully'
class Table:
name = 'Name'
email = 'Email'
team = 'Team'
role = 'Role'
status = 'Status'
actions = 'Actions'
pending = 'Pending'
view = 'View'
class Userprofile:
back_link = 'Back to ' + UsersPage.TITLE.lower()
edit_button = 'Edit user'
reactivate_button = 'Reactivate user'
deactivate_button = 'Deactivate user'
class Summarylist:
first_name = 'First name'
last_name = 'Last name'
email = 'Email'
team = 'Team'
role = 'Role'
change = 'Change'
default_queue = 'Default queue'
class Adduserform:
back_link = 'Back to ' + UsersPage.TITLE.lower()
title = 'Invite a user'
class Email:
title = 'Email'
description = ''
class Team:
title = 'Team'
description = ''
class Role:
title = 'Role'
description = ''
class Defaultqueue:
title = 'Default queue'
description = ''
class Edituserform:
back_link = 'Back to {0} {1}'
title = 'Edit {0} {1}'
submit_button = 'Save and return'
class Email:
title = 'Email'
description = ''
class Team:
title = 'Team'
description = ''
class Role:
title = 'Role'
description = ''
class Defaultqueue:
title = 'Default queue'
description = ''
class Managepage:
manage_roles = 'Manage roles'
pending = 'Pending'
reactivate_user = 'Reactivate user'
deactivate_user = 'Deactivate user'
cancel = 'Cancel'
class Assignuserpage:
user_error_message = 'Select or search for the user you want to assign the case to'
queue_error_message = 'Select or search for a team queue' |
SETTINGS = {
"FPS": 60,
"WIDTH": 1280,
"HEIGHT": 720,
"SOUNDS_VOLUME": 1.0,
"MUSICS_VOLUME": 0.1
} | settings = {'FPS': 60, 'WIDTH': 1280, 'HEIGHT': 720, 'SOUNDS_VOLUME': 1.0, 'MUSICS_VOLUME': 0.1} |
"""
Custom error classes
"""
class GenerationError(Exception):
pass
class TooManyInvalidError(RuntimeError):
pass
| """
Custom error classes
"""
class Generationerror(Exception):
pass
class Toomanyinvaliderror(RuntimeError):
pass |
#
# PySNMP MIB module BAS-SONET-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BAS-SONET-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:17:54 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")
ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion")
basSonet, = mibBuilder.importSymbols("BAS-MIB", "basSonet")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance")
Integer32, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, IpAddress, ModuleIdentity, TimeTicks, Bits, Counter64, ObjectIdentity, MibIdentifier, Gauge32, Counter32, NotificationType, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "IpAddress", "ModuleIdentity", "TimeTicks", "Bits", "Counter64", "ObjectIdentity", "MibIdentifier", "Gauge32", "Counter32", "NotificationType", "Unsigned32")
TimeStamp, TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TimeStamp", "TextualConvention", "DisplayString")
basSonetMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1))
if mibBuilder.loadTexts: basSonetMib.setLastUpdated('9810071415Z')
if mibBuilder.loadTexts: basSonetMib.setOrganization('Broadband Access Systems')
basSonetObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1))
basSonetPathTable = MibTable((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1), )
if mibBuilder.loadTexts: basSonetPathTable.setStatus('current')
basSonetPathEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: basSonetPathEntry.setStatus('current')
basSonetPathB3Err = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetPathB3Err.setStatus('current')
basSonetPathG1Err = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetPathG1Err.setStatus('current')
basSonetPathPais = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetPathPais.setStatus('current')
basSonetPathPrdi = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetPathPrdi.setStatus('current')
basSonetPathPlop = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetPathPlop.setStatus('current')
basSonetPathB3Threshold = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(3, 9)).clone(6)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: basSonetPathB3Threshold.setStatus('current')
basSonetPathRxJ1 = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 7), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetPathRxJ1.setStatus('current')
basSonetPathRxC2 = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 8), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetPathRxC2.setStatus('current')
basSonetPathRxG1 = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 9), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetPathRxG1.setStatus('current')
basSonetLineTable = MibTable((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2), )
if mibBuilder.loadTexts: basSonetLineTable.setStatus('current')
basSonetLineEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"))
if mibBuilder.loadTexts: basSonetLineEntry.setStatus('current')
basSonetLineTxErr = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineTxErr.setStatus('current')
basSonetLineB1Err = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineB1Err.setStatus('current')
basSonetLineB2Err = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineB2Err.setStatus('current')
basSonetLineM1Err = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineM1Err.setStatus('current')
basSonetLineRxFifoOverflow = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineRxFifoOverflow.setStatus('current')
basSonetLineRxAbort = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineRxAbort.setStatus('current')
basSonetLineRxRunts = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineRxRunts.setStatus('current')
basSonetLineLoc = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineLoc.setStatus('current')
basSonetLineLof = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineLof.setStatus('current')
basSonetLineLos = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineLos.setStatus('current')
basSonetLineLais = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineLais.setStatus('current')
basSonetLineLrdi = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineLrdi.setStatus('current')
basSonetLineB1Threshold = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(3, 9)).clone(6)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: basSonetLineB1Threshold.setStatus('current')
basSonetLineB2Threshold = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(3, 9)).clone(6)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: basSonetLineB2Threshold.setStatus('current')
basSonetLineSFThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(3, 9)).clone(3)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: basSonetLineSFThreshold.setStatus('current')
basSonetLineSDThreshold = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(3, 9)).clone(6)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: basSonetLineSDThreshold.setStatus('current')
basSonetLineLastCleared = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 17), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineLastCleared.setStatus('current')
basSonetLineRxK1 = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 18), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineRxK1.setStatus('current')
basSonetLineRxK2 = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 19), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineRxK2.setStatus('current')
basSonetLineRxGiants = MibTableColumn((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: basSonetLineRxGiants.setStatus('current')
mibBuilder.exportSymbols("BAS-SONET-MIB", basSonetPathRxG1=basSonetPathRxG1, basSonetLineB2Threshold=basSonetLineB2Threshold, basSonetPathPais=basSonetPathPais, basSonetLineRxFifoOverflow=basSonetLineRxFifoOverflow, basSonetLineTable=basSonetLineTable, basSonetLineRxK1=basSonetLineRxK1, basSonetLineLos=basSonetLineLos, basSonetLineB1Threshold=basSonetLineB1Threshold, basSonetPathRxJ1=basSonetPathRxJ1, basSonetPathG1Err=basSonetPathG1Err, basSonetLineB2Err=basSonetLineB2Err, basSonetObjects=basSonetObjects, basSonetPathB3Err=basSonetPathB3Err, basSonetLineLoc=basSonetLineLoc, basSonetLineRxRunts=basSonetLineRxRunts, basSonetLineSDThreshold=basSonetLineSDThreshold, basSonetLineLais=basSonetLineLais, basSonetLineRxK2=basSonetLineRxK2, basSonetPathEntry=basSonetPathEntry, PYSNMP_MODULE_ID=basSonetMib, basSonetLineSFThreshold=basSonetLineSFThreshold, basSonetLineM1Err=basSonetLineM1Err, basSonetLineRxAbort=basSonetLineRxAbort, basSonetLineLof=basSonetLineLof, basSonetLineLrdi=basSonetLineLrdi, basSonetLineLastCleared=basSonetLineLastCleared, basSonetPathPrdi=basSonetPathPrdi, basSonetPathPlop=basSonetPathPlop, basSonetLineRxGiants=basSonetLineRxGiants, basSonetLineEntry=basSonetLineEntry, basSonetPathB3Threshold=basSonetPathB3Threshold, basSonetLineB1Err=basSonetLineB1Err, basSonetLineTxErr=basSonetLineTxErr, basSonetMib=basSonetMib, basSonetPathRxC2=basSonetPathRxC2, basSonetPathTable=basSonetPathTable)
| (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion')
(bas_sonet,) = mibBuilder.importSymbols('BAS-MIB', 'basSonet')
(if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex')
(object_group, notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'NotificationGroup', 'ModuleCompliance')
(integer32, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, ip_address, module_identity, time_ticks, bits, counter64, object_identity, mib_identifier, gauge32, counter32, notification_type, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'IpAddress', 'ModuleIdentity', 'TimeTicks', 'Bits', 'Counter64', 'ObjectIdentity', 'MibIdentifier', 'Gauge32', 'Counter32', 'NotificationType', 'Unsigned32')
(time_stamp, textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TimeStamp', 'TextualConvention', 'DisplayString')
bas_sonet_mib = module_identity((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1))
if mibBuilder.loadTexts:
basSonetMib.setLastUpdated('9810071415Z')
if mibBuilder.loadTexts:
basSonetMib.setOrganization('Broadband Access Systems')
bas_sonet_objects = mib_identifier((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1))
bas_sonet_path_table = mib_table((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1))
if mibBuilder.loadTexts:
basSonetPathTable.setStatus('current')
bas_sonet_path_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
basSonetPathEntry.setStatus('current')
bas_sonet_path_b3_err = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 1), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetPathB3Err.setStatus('current')
bas_sonet_path_g1_err = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetPathG1Err.setStatus('current')
bas_sonet_path_pais = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetPathPais.setStatus('current')
bas_sonet_path_prdi = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetPathPrdi.setStatus('current')
bas_sonet_path_plop = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetPathPlop.setStatus('current')
bas_sonet_path_b3_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(3, 9)).clone(6)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
basSonetPathB3Threshold.setStatus('current')
bas_sonet_path_rx_j1 = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 7), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetPathRxJ1.setStatus('current')
bas_sonet_path_rx_c2 = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 8), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetPathRxC2.setStatus('current')
bas_sonet_path_rx_g1 = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 1, 1, 9), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetPathRxG1.setStatus('current')
bas_sonet_line_table = mib_table((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2))
if mibBuilder.loadTexts:
basSonetLineTable.setStatus('current')
bas_sonet_line_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'))
if mibBuilder.loadTexts:
basSonetLineEntry.setStatus('current')
bas_sonet_line_tx_err = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 1), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineTxErr.setStatus('current')
bas_sonet_line_b1_err = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineB1Err.setStatus('current')
bas_sonet_line_b2_err = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineB2Err.setStatus('current')
bas_sonet_line_m1_err = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineM1Err.setStatus('current')
bas_sonet_line_rx_fifo_overflow = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 5), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineRxFifoOverflow.setStatus('current')
bas_sonet_line_rx_abort = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 6), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineRxAbort.setStatus('current')
bas_sonet_line_rx_runts = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 7), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineRxRunts.setStatus('current')
bas_sonet_line_loc = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineLoc.setStatus('current')
bas_sonet_line_lof = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 9), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineLof.setStatus('current')
bas_sonet_line_los = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineLos.setStatus('current')
bas_sonet_line_lais = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 11), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineLais.setStatus('current')
bas_sonet_line_lrdi = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 12), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineLrdi.setStatus('current')
bas_sonet_line_b1_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 13), integer32().subtype(subtypeSpec=value_range_constraint(3, 9)).clone(6)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
basSonetLineB1Threshold.setStatus('current')
bas_sonet_line_b2_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 14), integer32().subtype(subtypeSpec=value_range_constraint(3, 9)).clone(6)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
basSonetLineB2Threshold.setStatus('current')
bas_sonet_line_sf_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 15), integer32().subtype(subtypeSpec=value_range_constraint(3, 9)).clone(3)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
basSonetLineSFThreshold.setStatus('current')
bas_sonet_line_sd_threshold = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 16), integer32().subtype(subtypeSpec=value_range_constraint(3, 9)).clone(6)).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
basSonetLineSDThreshold.setStatus('current')
bas_sonet_line_last_cleared = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 17), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineLastCleared.setStatus('current')
bas_sonet_line_rx_k1 = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 18), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineRxK1.setStatus('current')
bas_sonet_line_rx_k2 = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 19), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineRxK2.setStatus('current')
bas_sonet_line_rx_giants = mib_table_column((1, 3, 6, 1, 4, 1, 3493, 2, 20, 1, 1, 2, 1, 20), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
basSonetLineRxGiants.setStatus('current')
mibBuilder.exportSymbols('BAS-SONET-MIB', basSonetPathRxG1=basSonetPathRxG1, basSonetLineB2Threshold=basSonetLineB2Threshold, basSonetPathPais=basSonetPathPais, basSonetLineRxFifoOverflow=basSonetLineRxFifoOverflow, basSonetLineTable=basSonetLineTable, basSonetLineRxK1=basSonetLineRxK1, basSonetLineLos=basSonetLineLos, basSonetLineB1Threshold=basSonetLineB1Threshold, basSonetPathRxJ1=basSonetPathRxJ1, basSonetPathG1Err=basSonetPathG1Err, basSonetLineB2Err=basSonetLineB2Err, basSonetObjects=basSonetObjects, basSonetPathB3Err=basSonetPathB3Err, basSonetLineLoc=basSonetLineLoc, basSonetLineRxRunts=basSonetLineRxRunts, basSonetLineSDThreshold=basSonetLineSDThreshold, basSonetLineLais=basSonetLineLais, basSonetLineRxK2=basSonetLineRxK2, basSonetPathEntry=basSonetPathEntry, PYSNMP_MODULE_ID=basSonetMib, basSonetLineSFThreshold=basSonetLineSFThreshold, basSonetLineM1Err=basSonetLineM1Err, basSonetLineRxAbort=basSonetLineRxAbort, basSonetLineLof=basSonetLineLof, basSonetLineLrdi=basSonetLineLrdi, basSonetLineLastCleared=basSonetLineLastCleared, basSonetPathPrdi=basSonetPathPrdi, basSonetPathPlop=basSonetPathPlop, basSonetLineRxGiants=basSonetLineRxGiants, basSonetLineEntry=basSonetLineEntry, basSonetPathB3Threshold=basSonetPathB3Threshold, basSonetLineB1Err=basSonetLineB1Err, basSonetLineTxErr=basSonetLineTxErr, basSonetMib=basSonetMib, basSonetPathRxC2=basSonetPathRxC2, basSonetPathTable=basSonetPathTable) |
class Question:
def __init__(self, prompt, answer):
self.prompt = prompt
self.answer = answer
question_prompt = ["what is my name? \n" , "When was I born? \n", "Name my by color \n"]
questions = [Question(question_prompt[0], "Michael"),
Question(question_prompt[1], 2002),
Question(question_prompt[2], "blue")]
def score(questions):
score = 0
for question in questions:
answer = input(question.prompt)
if answer == question.answer:
score += 1
print("You got " + str(score) + "/" + str(len(questions)))
score(questions) | class Question:
def __init__(self, prompt, answer):
self.prompt = prompt
self.answer = answer
question_prompt = ['what is my name? \n', 'When was I born? \n', 'Name my by color \n']
questions = [question(question_prompt[0], 'Michael'), question(question_prompt[1], 2002), question(question_prompt[2], 'blue')]
def score(questions):
score = 0
for question in questions:
answer = input(question.prompt)
if answer == question.answer:
score += 1
print('You got ' + str(score) + '/' + str(len(questions)))
score(questions) |
"""
Recursivly compute the Fibonacci sequence
"""
def rec_fib(n):
if n == 1:
return 1
elif n == 0:
return 0
else:
return rec_fib(n-1)+rec_fib(n-2)
def main():
n : int = int(input("n := "))
for i in range(0, n):
print(rec_fib(i))
if __name__ == "__main__":
main()
| """
Recursivly compute the Fibonacci sequence
"""
def rec_fib(n):
if n == 1:
return 1
elif n == 0:
return 0
else:
return rec_fib(n - 1) + rec_fib(n - 2)
def main():
n: int = int(input('n := '))
for i in range(0, n):
print(rec_fib(i))
if __name__ == '__main__':
main() |
Scale.default = Scale.egyptian
Root.default = 0
Clock.bpm = 120
print(SynthDefs)
print(BufferManager())
print(Player.get_attributes())
p1 >> play(
P["@+ET"],
).every(3, "stutter", dur=1/2)
p1 >> play(
P["V+EA"],
).every(3, "stutter", dur=1/2)
p2 >> play(
P["<X >< n >"],#.layer("mirror"),
sample = 2,
)
p2.stop()
p3.stop()
p4.stop()
p5 >> play(
P["{ pPpP[pp][PP][pP][Pp]}"],
dur = 1/2,
sample = 1,
amp = 2
)
v1chop = 128 # 16, 32, 48, 56, 64, 128, 256
v1 >> varsaw(
[(0,1),(4,5),(1,2),(5,6),(8,9)],
oct = 4,
dur = [8,8,8,4,4],
sus = [8,8,8,4,4],
pan = (-1, 1),
slide = 0,
chop = [v1chop]*3+[v1chop/2]*2,
)
d1 >> dub(
[0,4,1,5,8],
oct = 3,
dur = [8]*3+[4]*2,
sus = [8]*3+[4]*2,
pan = (-1,1),
hpf = 100
)
# ================================
| Scale.default = Scale.egyptian
Root.default = 0
Clock.bpm = 120
print(SynthDefs)
print(buffer_manager())
print(Player.get_attributes())
p1 >> play(P['@+ET']).every(3, 'stutter', dur=1 / 2)
p1 >> play(P['V+EA']).every(3, 'stutter', dur=1 / 2)
p2 >> play(P['<X >< n >'], sample=2)
p2.stop()
p3.stop()
p4.stop()
p5 >> play(P['{ pPpP[pp][PP][pP][Pp]}'], dur=1 / 2, sample=1, amp=2)
v1chop = 128
v1 >> varsaw([(0, 1), (4, 5), (1, 2), (5, 6), (8, 9)], oct=4, dur=[8, 8, 8, 4, 4], sus=[8, 8, 8, 4, 4], pan=(-1, 1), slide=0, chop=[v1chop] * 3 + [v1chop / 2] * 2)
d1 >> dub([0, 4, 1, 5, 8], oct=3, dur=[8] * 3 + [4] * 2, sus=[8] * 3 + [4] * 2, pan=(-1, 1), hpf=100) |
# coding: utf-8
def check(a,b,s,ans):
for j in range(b):
if [s[k] for k in range(12) if k%b==j].count('X')==a:
ans.append('%dx%d'%(a,b))
return ans
return ans
t = int(input())
for i in range(t):
ans = []
s = input()
ans = check(1,12,s,ans)
ans = check(2,6,s,ans)
ans = check(3,4,s,ans)
ans = check(4,3,s,ans)
ans = check(6,2,s,ans)
ans = check(12,1,s,ans)
if ans:
print(len(ans),' '.join(ans))
else:
print(0)
| def check(a, b, s, ans):
for j in range(b):
if [s[k] for k in range(12) if k % b == j].count('X') == a:
ans.append('%dx%d' % (a, b))
return ans
return ans
t = int(input())
for i in range(t):
ans = []
s = input()
ans = check(1, 12, s, ans)
ans = check(2, 6, s, ans)
ans = check(3, 4, s, ans)
ans = check(4, 3, s, ans)
ans = check(6, 2, s, ans)
ans = check(12, 1, s, ans)
if ans:
print(len(ans), ' '.join(ans))
else:
print(0) |
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Name this module.
This is blank
"""
| """
Name this module.
This is blank
""" |
## @ StitchIfwi.py
# This is an IFWI stitch config script for Slim Bootloader
#
# Copyright (c) 2020, Intel Corporation. All rights reserved. <BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
extra_usage_txt = \
"""This is an IFWI stitch config script for Slim Bootloader For the FIT tool and
stitching ingredients listed in step 2 below, please contact your Intel representative.
1. Create a stitching workspace directory. The paths mentioned below are all
relative to it.
2. Extract required tools and ingredients to stitching workspace.
- FIT tool
Copy 'fit.exe' or 'fit' and 'vsccommn.bin' to 'Fit' folder
- BPMGEN2 Tool
Copy the contents of the tool to Bpmgen2 folder
Rename the bpmgen2 parameter to bpmgen2.params if its name is not this name.
- Components
Copy 'cse_image.bin' to 'Input/cse_image.bin'
Copy PMC firmware image to 'Input/pmc.bin'.
Copy EC firmware image to 'Input/ec.bin'.
copy ECregionpointer.bin to 'Input/ecregionpointer.bin'
Copy GBE binary image to 'Input/gbe.bin'.
Copy ACM firmware image to 'Input/acm.bin'.
3. Openssl
Openssl is required for stitch. the stitch tool will search evn OPENSSL_PATH,
to find Openssl. If evn OPENSSL_PATH is not found, will find openssl from
"C:\\Openssl\\Openssl"
4. Stitch the final image
EX:
Assuming stitching workspace is at D:\Stitch and building ifwi for CMLV platform
To stitch IFWI with SPI QUAD mode and Boot Guard profile VM:
StitchIfwi.py -b vm -p cmlv -w D:\Stitch -s Stitch_Components.zip -c StitchIfwiConfig.py
"""
def get_bpmgen2_params_change_list ():
params_change_list = []
params_change_list.append ([
# variable | value |
# ===================================
('PlatformRules', 'CMLV Embedded'),
('BpmStrutVersion', '0x20'),
('BpmRevision', '0x01'),
('BpmRevocation', '1'),
('AcmRevocation', '2'),
('NEMPages', '3'),
('IbbFlags', '0x2'),
('IbbHashAlgID', '0x0B:SHA256'),
('TxtInclude', 'FALSE'),
('PcdInclude', 'TRUE'),
('BpmSigScheme', '0x14:RSASSA'),
('BpmSigPubKey', r'Bpmgen2\keys\bpm_pubkey_2048.pem'),
('BpmSigPrivKey', r'Bpmgen2\keys\bpm_privkey_2048.pem'),
('BpmKeySizeBits', '2048'),
('BpmSigHashAlgID', '0x0B:SHA256'),
])
return params_change_list
def get_platform_sku():
platform_sku ={
'cmlv' : 'H410'
}
return platform_sku
def get_oemkeymanifest_change_list():
xml_change_list = []
xml_change_list.append ([
# Path | value |
# =========================================================================================
('./KeyManifestEntries/KeyManifestEntry/Usage', 'OemDebugManifest'),
('./KeyManifestEntries/KeyManifestEntry/HashBinary', 'Temp/kmsigpubkey.hash'),
])
return xml_change_list
def get_xml_change_list (platform, spi_quad):
xml_change_list = []
xml_change_list.append ([
# Path | value |
# =========================================================================================
#Region Order
('./BuildSettings/BuildResults/RegionOrder', '45321'),
('./FlashLayout/DescriptorRegion/OemBinary', '$SourceDir\OemBinary.bin'),
('./FlashLayout/BiosRegion/InputFile', '$SourceDir\BiosRegion.bin'),
('./FlashLayout/Ifwi_IntelMePmcRegion/MeRegionFile', '$SourceDir\MeRegionFile.bin'),
('./FlashLayout/Ifwi_IntelMePmcRegion/PmcBinary', '$SourceDir\PmcBinary.bin'),
('./FlashLayout/EcRegion/InputFile', '$SourceDir\EcRegion.bin'),
('./FlashLayout/EcRegion/Enabled', 'Enabled'),
('./FlashLayout/EcRegion/EcRegionPointer', '$SourceDir\EcRegionPointer.bin'),
('./FlashLayout/GbeRegion/InputFile', '$SourceDir\GbeRegion.bin'),
('./FlashLayout/GbeRegion/Enabled', 'Enabled'),
('./FlashLayout/SubPartitions/PchcSubPartitionData/InputFile', '$SourceDir\PchcSubPartitionData.bin'),
('./FlashSettings/FlashComponents/FlashComponent1Size', '32MB'),
('./FlashSettings/FlashComponents/SpiResHldDelay', '8us'),
('./FlashSettings/VsccTable/VsccEntries/VsccEntry/VsccEntryName', 'VsccEntry0'),
('./FlashSettings/VsccTable/VsccEntries/VsccEntry/VsccEntryVendorId', '0xEF'),
('./FlashSettings/VsccTable/VsccEntries/VsccEntry/VsccEntryDeviceId0', '0x40'),
('./FlashSettings/VsccTable/VsccEntries/VsccEntry/VsccEntryDeviceId1', '0x19'),
('./IntelMeKernel/IntelMeBootConfiguration/PrtcBackupPower', 'None'),
('./PlatformProtection/ContentProtection/Lspcon4kdisp', 'PortD'),
('./PlatformProtection/PlatformIntegrity/OemPublicKeyHash', '4D 19 B4 F2 3F F9 17 0C 2C 46 B3 D7 6B F0 59 19 A7 FA 8B 6B 11 3D F5 3C 86 C0 E8 00 3C 23 A8 DC'),
('./PlatformProtection/PlatformIntegrity/OemExtInputFile', '$SourceDir\OemExtInputFile.bin'),
('./PlatformProtection/BootGuardConfiguration/BtGuardKeyManifestId', '0x1'),
('./PlatformProtection/IntelPttConfiguration/PttSupported', 'No'),
('./PlatformProtection/IntelPttConfiguration/PttPwrUpState', 'Disabled'),
('./PlatformProtection/IntelPttConfiguration/PttSupportedFpf', 'No'),
('./PlatformProtection/TpmOverSpiBusConfiguration/SpiOverTpmBusEnable', 'Yes'),
('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC3', 'Disabled'),
('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC6', 'Disabled'),
('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC9', 'Disabled'),
('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC10', 'Disabled'),
('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC11', 'Disabled'),
('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC12', 'Disabled'),
('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC13', 'Disabled'),
('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC14', 'Disabled'),
('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC15', 'Disabled'),
('./NetworkingConnectivity/WiredLanConfiguration/GbePCIePortSelect', 'Port13'),
('./NetworkingConnectivity/WiredLanConfiguration/PhyConnected', 'PHY on SMLink0'),
('./InternalPchBuses/PchTimerConfiguration/t573TimingConfig', '100ms'),
('./InternalPchBuses/PchTimerConfiguration/TscClearWarmReset', 'Yes'),
('./Debug/IntelTraceHubTechnology/UnlockToken', '$SourceDir\\UnlockToken.bin'),
('./Debug/EspiFeatureOverrides/EspiEcLowFreqOvrd', 'Yes'),
('./CpuStraps/PlatformImonDisable', 'Enabled'),
('./CpuStraps/IaVrOffsetVid', 'No'),
('./StrapsDifferences/PCH_Strap_CSME_SMT2_TCOSSEL_Diff', '0x00000000'),
('./StrapsDifferences/PCH_Strap_CSME_SMT3_TCOSSEL_Diff', '0x00000000'),
('./StrapsDifferences/PCH_Strap_PN1_RPCFG_2_Diff', '0x00000003'),
('./StrapsDifferences/PCH_Strap_PN2_RPCFG_2_Diff', '0x00000003'),
('./StrapsDifferences/PCH_Strap_ISH_ISH_BaseClass_code_SoftStrap_Diff', '0x00000000'),
('./StrapsDifferences/PCH_Strap_SMB_spi_strap_smt3_en_Diff', '0x00000001'),
('./StrapsDifferences/PCH_Strap_GBE_SMLink1_Frequency_Diff', '0x00000001'),
('./StrapsDifferences/PCH_Strap_GBE_SMLink3_Frequency_Diff', '0x00000003'),
('./StrapsDifferences/PCH_Strap_USBX_XHC_PORT6_OWNERSHIP_STRAP_Diff', '0x00000000'),
('./StrapsDifferences/PCH_Strap_USBX_XHC_PORT5_OWNERSHIP_STRAP_Diff', '0x00000000'),
('./StrapsDifferences/PCH_Strap_USBX_XHC_PORT2_OWNERSHIP_STRAP_Diff', '0x00000000'),
('./StrapsDifferences/PCH_Strap_PMC_MMP0_DIS_STRAP_Diff', '0x00000001'),
('./StrapsDifferences/PCH_Strap_PMC_EPOC_DATA_STRAP_Diff', '0x00000002'),
('./StrapsDifferences/PCH_Strap_spth_modphy_softstraps_com1_com0_pllwait_cntr_2_0_Diff', '0x00000001'),
('./StrapsDifferences/PCH_Strap_SPI_SPI_EN_D0_DEEP_PWRDN_Diff', '0x00000000'),
('./StrapsDifferences/PCH_Strap_SPI_cs1_respmod_dis_Diff', '0x00000000'),
('./StrapsDifferences/PCH_Strap_DMI_OPDMI_LW_Diff', '0x00000003'),
('./StrapsDifferences/PCH_Strap_DMI_OPDMI_TLS_Diff', '0x00000003'),
('./StrapsDifferences/PCH_Strap_DMI_OPDMI_PAD_Diff', '0x0000000F'),
('./StrapsDifferences/PCH_Strap_DMI_OPDMI_ECCE_Diff', '0x00000001'),
('./FlexIO/IntelRstForPcieConfiguration/RstPCIeController3', '1x4'),
('./FlexIO/PcieLaneReversalConfiguration/PCIeCtrl3LnReversal', 'No'),
('./FlexIO/SataPcieComboPortConfiguration/SataPCIeComboPort2', 'PCIe'),
('./FlexIO/SataPcieComboPortConfiguration/SataPCIeComboPort4', 'SATA'),
('./FlexIO/SataPcieComboPortConfiguration/SataPCIeComboPort5', 'SATA'),
('./FlexIO/Usb3PortConfiguration/USB3PCIeComboPort2', 'PCIe'),
('./FlexIO/PcieGen3PllClockControl/PCIeSecGen3PllEnable', 'Yes'),
('./IntelPreciseTouchAndStylus/IntelPreciseTouchAndStylusConfiguration/Touch1MaxFreq', '17 MHz'),
('./FWUpdateImage/FWMeRegion/InputFile', '$SourceDir\FWMeRegion.bin'),
('./FWUpdateImage/FWPmcRegion/InputFile', '$SourceDir\FWPmcRegion.bin'),
('./FWUpdateImage/FWOemKmRegion/InputFile', '$SourceDir\FWOemKmRegion.bin'),
('./FWUpdateImage/FWPchcRegion/InputFile', '$SourceDir\FWPchcRegion.bin'),
('./FlashSettings/BiosConfiguration/TopSwapOverride', '256KB'),
])
return xml_change_list
def get_component_replace_list():
replace_list = [
# Path file name compress Key
('IFWI/BIOS/TS0/ACM0', 'Input/acm.bin', 'dummy', ''),
('IFWI/BIOS/TS1/ACM0', 'Input/acm.bin', 'dummy', ''),
]
return replace_list
| extra_usage_txt = 'This is an IFWI stitch config script for Slim Bootloader For the FIT tool and\nstitching ingredients listed in step 2 below, please contact your Intel representative.\n\n 1. Create a stitching workspace directory. The paths mentioned below are all\n relative to it.\n\n 2. Extract required tools and ingredients to stitching workspace.\n - FIT tool\n Copy \'fit.exe\' or \'fit\' and \'vsccommn.bin\' to \'Fit\' folder\n - BPMGEN2 Tool\n Copy the contents of the tool to Bpmgen2 folder\n Rename the bpmgen2 parameter to bpmgen2.params if its name is not this name.\n - Components\n Copy \'cse_image.bin\' to \'Input/cse_image.bin\'\n Copy PMC firmware image to \'Input/pmc.bin\'.\n Copy EC firmware image to \'Input/ec.bin\'.\n copy ECregionpointer.bin to \'Input/ecregionpointer.bin\'\n Copy GBE binary image to \'Input/gbe.bin\'.\n Copy ACM firmware image to \'Input/acm.bin\'.\n\n 3. Openssl\n Openssl is required for stitch. the stitch tool will search evn OPENSSL_PATH,\n to find Openssl. If evn OPENSSL_PATH is not found, will find openssl from\n "C:\\Openssl\\Openssl"\n\n 4. Stitch the final image\n EX:\n Assuming stitching workspace is at D:\\Stitch and building ifwi for CMLV platform\n To stitch IFWI with SPI QUAD mode and Boot Guard profile VM:\n StitchIfwi.py -b vm -p cmlv -w D:\\Stitch -s Stitch_Components.zip -c StitchIfwiConfig.py\n\n'
def get_bpmgen2_params_change_list():
params_change_list = []
params_change_list.append([('PlatformRules', 'CMLV Embedded'), ('BpmStrutVersion', '0x20'), ('BpmRevision', '0x01'), ('BpmRevocation', '1'), ('AcmRevocation', '2'), ('NEMPages', '3'), ('IbbFlags', '0x2'), ('IbbHashAlgID', '0x0B:SHA256'), ('TxtInclude', 'FALSE'), ('PcdInclude', 'TRUE'), ('BpmSigScheme', '0x14:RSASSA'), ('BpmSigPubKey', 'Bpmgen2\\keys\\bpm_pubkey_2048.pem'), ('BpmSigPrivKey', 'Bpmgen2\\keys\\bpm_privkey_2048.pem'), ('BpmKeySizeBits', '2048'), ('BpmSigHashAlgID', '0x0B:SHA256')])
return params_change_list
def get_platform_sku():
platform_sku = {'cmlv': 'H410'}
return platform_sku
def get_oemkeymanifest_change_list():
xml_change_list = []
xml_change_list.append([('./KeyManifestEntries/KeyManifestEntry/Usage', 'OemDebugManifest'), ('./KeyManifestEntries/KeyManifestEntry/HashBinary', 'Temp/kmsigpubkey.hash')])
return xml_change_list
def get_xml_change_list(platform, spi_quad):
xml_change_list = []
xml_change_list.append([('./BuildSettings/BuildResults/RegionOrder', '45321'), ('./FlashLayout/DescriptorRegion/OemBinary', '$SourceDir\\OemBinary.bin'), ('./FlashLayout/BiosRegion/InputFile', '$SourceDir\\BiosRegion.bin'), ('./FlashLayout/Ifwi_IntelMePmcRegion/MeRegionFile', '$SourceDir\\MeRegionFile.bin'), ('./FlashLayout/Ifwi_IntelMePmcRegion/PmcBinary', '$SourceDir\\PmcBinary.bin'), ('./FlashLayout/EcRegion/InputFile', '$SourceDir\\EcRegion.bin'), ('./FlashLayout/EcRegion/Enabled', 'Enabled'), ('./FlashLayout/EcRegion/EcRegionPointer', '$SourceDir\\EcRegionPointer.bin'), ('./FlashLayout/GbeRegion/InputFile', '$SourceDir\\GbeRegion.bin'), ('./FlashLayout/GbeRegion/Enabled', 'Enabled'), ('./FlashLayout/SubPartitions/PchcSubPartitionData/InputFile', '$SourceDir\\PchcSubPartitionData.bin'), ('./FlashSettings/FlashComponents/FlashComponent1Size', '32MB'), ('./FlashSettings/FlashComponents/SpiResHldDelay', '8us'), ('./FlashSettings/VsccTable/VsccEntries/VsccEntry/VsccEntryName', 'VsccEntry0'), ('./FlashSettings/VsccTable/VsccEntries/VsccEntry/VsccEntryVendorId', '0xEF'), ('./FlashSettings/VsccTable/VsccEntries/VsccEntry/VsccEntryDeviceId0', '0x40'), ('./FlashSettings/VsccTable/VsccEntries/VsccEntry/VsccEntryDeviceId1', '0x19'), ('./IntelMeKernel/IntelMeBootConfiguration/PrtcBackupPower', 'None'), ('./PlatformProtection/ContentProtection/Lspcon4kdisp', 'PortD'), ('./PlatformProtection/PlatformIntegrity/OemPublicKeyHash', '4D 19 B4 F2 3F F9 17 0C 2C 46 B3 D7 6B F0 59 19 A7 FA 8B 6B 11 3D F5 3C 86 C0 E8 00 3C 23 A8 DC'), ('./PlatformProtection/PlatformIntegrity/OemExtInputFile', '$SourceDir\\OemExtInputFile.bin'), ('./PlatformProtection/BootGuardConfiguration/BtGuardKeyManifestId', '0x1'), ('./PlatformProtection/IntelPttConfiguration/PttSupported', 'No'), ('./PlatformProtection/IntelPttConfiguration/PttPwrUpState', 'Disabled'), ('./PlatformProtection/IntelPttConfiguration/PttSupportedFpf', 'No'), ('./PlatformProtection/TpmOverSpiBusConfiguration/SpiOverTpmBusEnable', 'Yes'), ('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC3', 'Disabled'), ('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC6', 'Disabled'), ('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC9', 'Disabled'), ('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC10', 'Disabled'), ('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC11', 'Disabled'), ('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC12', 'Disabled'), ('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC13', 'Disabled'), ('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC14', 'Disabled'), ('./Icc/IccPolicies/Profiles/Profile/ClockOutputConfiguration/ClkoutSRC15', 'Disabled'), ('./NetworkingConnectivity/WiredLanConfiguration/GbePCIePortSelect', 'Port13'), ('./NetworkingConnectivity/WiredLanConfiguration/PhyConnected', 'PHY on SMLink0'), ('./InternalPchBuses/PchTimerConfiguration/t573TimingConfig', '100ms'), ('./InternalPchBuses/PchTimerConfiguration/TscClearWarmReset', 'Yes'), ('./Debug/IntelTraceHubTechnology/UnlockToken', '$SourceDir\\UnlockToken.bin'), ('./Debug/EspiFeatureOverrides/EspiEcLowFreqOvrd', 'Yes'), ('./CpuStraps/PlatformImonDisable', 'Enabled'), ('./CpuStraps/IaVrOffsetVid', 'No'), ('./StrapsDifferences/PCH_Strap_CSME_SMT2_TCOSSEL_Diff', '0x00000000'), ('./StrapsDifferences/PCH_Strap_CSME_SMT3_TCOSSEL_Diff', '0x00000000'), ('./StrapsDifferences/PCH_Strap_PN1_RPCFG_2_Diff', '0x00000003'), ('./StrapsDifferences/PCH_Strap_PN2_RPCFG_2_Diff', '0x00000003'), ('./StrapsDifferences/PCH_Strap_ISH_ISH_BaseClass_code_SoftStrap_Diff', '0x00000000'), ('./StrapsDifferences/PCH_Strap_SMB_spi_strap_smt3_en_Diff', '0x00000001'), ('./StrapsDifferences/PCH_Strap_GBE_SMLink1_Frequency_Diff', '0x00000001'), ('./StrapsDifferences/PCH_Strap_GBE_SMLink3_Frequency_Diff', '0x00000003'), ('./StrapsDifferences/PCH_Strap_USBX_XHC_PORT6_OWNERSHIP_STRAP_Diff', '0x00000000'), ('./StrapsDifferences/PCH_Strap_USBX_XHC_PORT5_OWNERSHIP_STRAP_Diff', '0x00000000'), ('./StrapsDifferences/PCH_Strap_USBX_XHC_PORT2_OWNERSHIP_STRAP_Diff', '0x00000000'), ('./StrapsDifferences/PCH_Strap_PMC_MMP0_DIS_STRAP_Diff', '0x00000001'), ('./StrapsDifferences/PCH_Strap_PMC_EPOC_DATA_STRAP_Diff', '0x00000002'), ('./StrapsDifferences/PCH_Strap_spth_modphy_softstraps_com1_com0_pllwait_cntr_2_0_Diff', '0x00000001'), ('./StrapsDifferences/PCH_Strap_SPI_SPI_EN_D0_DEEP_PWRDN_Diff', '0x00000000'), ('./StrapsDifferences/PCH_Strap_SPI_cs1_respmod_dis_Diff', '0x00000000'), ('./StrapsDifferences/PCH_Strap_DMI_OPDMI_LW_Diff', '0x00000003'), ('./StrapsDifferences/PCH_Strap_DMI_OPDMI_TLS_Diff', '0x00000003'), ('./StrapsDifferences/PCH_Strap_DMI_OPDMI_PAD_Diff', '0x0000000F'), ('./StrapsDifferences/PCH_Strap_DMI_OPDMI_ECCE_Diff', '0x00000001'), ('./FlexIO/IntelRstForPcieConfiguration/RstPCIeController3', '1x4'), ('./FlexIO/PcieLaneReversalConfiguration/PCIeCtrl3LnReversal', 'No'), ('./FlexIO/SataPcieComboPortConfiguration/SataPCIeComboPort2', 'PCIe'), ('./FlexIO/SataPcieComboPortConfiguration/SataPCIeComboPort4', 'SATA'), ('./FlexIO/SataPcieComboPortConfiguration/SataPCIeComboPort5', 'SATA'), ('./FlexIO/Usb3PortConfiguration/USB3PCIeComboPort2', 'PCIe'), ('./FlexIO/PcieGen3PllClockControl/PCIeSecGen3PllEnable', 'Yes'), ('./IntelPreciseTouchAndStylus/IntelPreciseTouchAndStylusConfiguration/Touch1MaxFreq', '17 MHz'), ('./FWUpdateImage/FWMeRegion/InputFile', '$SourceDir\\FWMeRegion.bin'), ('./FWUpdateImage/FWPmcRegion/InputFile', '$SourceDir\\FWPmcRegion.bin'), ('./FWUpdateImage/FWOemKmRegion/InputFile', '$SourceDir\\FWOemKmRegion.bin'), ('./FWUpdateImage/FWPchcRegion/InputFile', '$SourceDir\\FWPchcRegion.bin'), ('./FlashSettings/BiosConfiguration/TopSwapOverride', '256KB')])
return xml_change_list
def get_component_replace_list():
replace_list = [('IFWI/BIOS/TS0/ACM0', 'Input/acm.bin', 'dummy', ''), ('IFWI/BIOS/TS1/ACM0', 'Input/acm.bin', 'dummy', '')]
return replace_list |
####################################SLICING######################################
# x[start:stop:step]
# result starts at <start> including it
# result ends at <stop> excluding it
# optional third argument determines which arguments are carved out (default is 1)
# slice assgnments ->
###################################EJEMPLO1######################################
letters_amazon = '''
We spent several years building our own database engine,
Amazon Aurora, a fully-managed MySQL and PostgreSQL-compatible
service with the same or better durability and availability as
the commercial engines, but at one-tenth of the cost. We were
not surprised when this worked.
'''
find = lambda x, q: x[x.find(q)-18:x.find(q)+18] if q in x else -1
print( find(letters_amazon, 'SQL') )
###################################EJEMPLO2######################################
price = [[9.9, 9.8, 9.8, 9.4, 9.5, 9.7],
[9.5, 9.4, 9.4, 9.3, 9.2, 9.1],
[8.4, 7.9, 7.9, 8.1, 8.0, 8.0],
[7.1, 5.9, 4.8, 4.8, 4.7, 3.9]]
sample = [line[::2] for line in price]
print(sample)
###################################EJEMPLO3######################################
visitors = ['Firefox', 'corrupted', 'Chrome', 'corrupted',
'Safari', 'corrupted', 'Safari', 'corrupted',
'Chrome', 'corrupted', 'Firefox', 'corrupted']
visitors[1::2] = visitors[::2]
print(visitors) | letters_amazon = '\nWe spent several years building our own database engine,\nAmazon Aurora, a fully-managed MySQL and PostgreSQL-compatible\nservice with the same or better durability and availability as\nthe commercial engines, but at one-tenth of the cost. We were\nnot surprised when this worked.\n'
find = lambda x, q: x[x.find(q) - 18:x.find(q) + 18] if q in x else -1
print(find(letters_amazon, 'SQL'))
price = [[9.9, 9.8, 9.8, 9.4, 9.5, 9.7], [9.5, 9.4, 9.4, 9.3, 9.2, 9.1], [8.4, 7.9, 7.9, 8.1, 8.0, 8.0], [7.1, 5.9, 4.8, 4.8, 4.7, 3.9]]
sample = [line[::2] for line in price]
print(sample)
visitors = ['Firefox', 'corrupted', 'Chrome', 'corrupted', 'Safari', 'corrupted', 'Safari', 'corrupted', 'Chrome', 'corrupted', 'Firefox', 'corrupted']
visitors[1::2] = visitors[::2]
print(visitors) |
# Python program to find largest
# number in a list
# list of numbers
list1 = [10, 20, 4, 45, 99]
# printing the maximum element
print("Largest element is:", max(list1))
| list1 = [10, 20, 4, 45, 99]
print('Largest element is:', max(list1)) |
"""
Colours used in Capel & Mortlock (2019).
"""
darkblue = '#114A56'
midblue = '#1A7282'
lightblue = '#6DA5AF'
lightpurple = '#875F74'
purple = '#592441'
grey = '#BEC1C2'
lightgrey = '#F9F9F9'
darkgrey= '#464747'
white = '#FFFFFF'
| """
Colours used in Capel & Mortlock (2019).
"""
darkblue = '#114A56'
midblue = '#1A7282'
lightblue = '#6DA5AF'
lightpurple = '#875F74'
purple = '#592441'
grey = '#BEC1C2'
lightgrey = '#F9F9F9'
darkgrey = '#464747'
white = '#FFFFFF' |
t = int(input())
visit = None
sequence = None
def dfs(x, y, r, c, dist):
global visit, sequence
visit[x][y] = True
# print(x, y, dist)
# print(visit)
sequence[x][y] = dist
if dist == r * c - 1:
return True
for nx in range(r):
for ny in range(c):
if visit[nx][ny] or nx == x or ny == y or ((nx - ny) == (x - y)) or ((nx + ny) == (x + y)):
continue
if dfs(nx, ny, r, c, dist + 1):
return True
visit[x][y] = False
return False
def ainit(r, c, v):
ret = []
for _ in range(r):
ret.append([False] * c)
return ret
def printAnswer(r, c):
a = [None] * (r * c)
for i in range(r):
for j in range(c):
a[sequence[i][j]] = (i + 1, j + 1)
for i,j in a:
print(i,j)
def solve():
global visit, sequence
r, c = [int(i) for i in input().split()]
for i in range(r):
for j in range(c):
visit = ainit(r, c, True)
sequence = ainit(r ,c, 0)
# print("Entry point: {}, {}".format(i,j))
ret = dfs(i, j, r, c, 0)
if ret:
print("POSSIBLE")
printAnswer(r, c)
return
print("IMPOSSIBLE")
for i in range(1, t + 1):
print("Case #{}: ".format(i), end='')
solve() | t = int(input())
visit = None
sequence = None
def dfs(x, y, r, c, dist):
global visit, sequence
visit[x][y] = True
sequence[x][y] = dist
if dist == r * c - 1:
return True
for nx in range(r):
for ny in range(c):
if visit[nx][ny] or nx == x or ny == y or (nx - ny == x - y) or (nx + ny == x + y):
continue
if dfs(nx, ny, r, c, dist + 1):
return True
visit[x][y] = False
return False
def ainit(r, c, v):
ret = []
for _ in range(r):
ret.append([False] * c)
return ret
def print_answer(r, c):
a = [None] * (r * c)
for i in range(r):
for j in range(c):
a[sequence[i][j]] = (i + 1, j + 1)
for (i, j) in a:
print(i, j)
def solve():
global visit, sequence
(r, c) = [int(i) for i in input().split()]
for i in range(r):
for j in range(c):
visit = ainit(r, c, True)
sequence = ainit(r, c, 0)
ret = dfs(i, j, r, c, 0)
if ret:
print('POSSIBLE')
print_answer(r, c)
return
print('IMPOSSIBLE')
for i in range(1, t + 1):
print('Case #{}: '.format(i), end='')
solve() |
class Event:
def __init__(self, event_name, sender, params=None):
"""
Defines an event.
name: event name
sender: who has sent the event
params: dictionary of event parameters
"""
self.event_name = event_name
self.sender = sender
self.params = params
@property
def name(self):
return self.event_name
def handle(self, simulation, sender, params):
"""
Method that will be called when the event will need to be handled.
Defined by a function: (simulation_instance, sender, params)->resulting_parameters
"""
pass
class EventEmitter:
def __init__(self, emitter):
"""
Emit events with some policy (for implementing automatic event generation).
emitter: entity that will be the sender of the events emitted by this emitter
"""
self.emitter = emitter
def emit(self, model):
pass | class Event:
def __init__(self, event_name, sender, params=None):
"""
Defines an event.
name: event name
sender: who has sent the event
params: dictionary of event parameters
"""
self.event_name = event_name
self.sender = sender
self.params = params
@property
def name(self):
return self.event_name
def handle(self, simulation, sender, params):
"""
Method that will be called when the event will need to be handled.
Defined by a function: (simulation_instance, sender, params)->resulting_parameters
"""
pass
class Eventemitter:
def __init__(self, emitter):
"""
Emit events with some policy (for implementing automatic event generation).
emitter: entity that will be the sender of the events emitted by this emitter
"""
self.emitter = emitter
def emit(self, model):
pass |
#!/usr/bin/env python3
# -*- coding utf-8 -*-
__Author__ ='eamon'
'Object Oriented Programming'
std1={'name':'Eamon','Score':99}
std2={'name':'chen','Score':100}
def print_score(std):
print('%s: %s' % (std['name'], std['Score']))
print_score(std1)
print_score(std2)
class Student(object):
def __init__(self,name,score):
self.__name=name
self.__score=score
def print_score(self):
print('%s: %s' %(self.__name,self.__score))
def get_grade(self):
if self.__score >=90:
return 'A'
elif self.__score >=60:
return 'B'
else:
return 'C'
def get_name(self):
return self.__name
eamon= Student('eamon',99)
chen = Student('chen',100)
eamon.print_score()
chen.print_score()
class TestStudent(object):
pass
tstStud = TestStudent()
print(tstStud)
tstStud.name = 'eamon_tst'
print(tstStud.name)
eamon.get_grade()
eamon.age = 10
print(eamon.age)
bart =Student('Babie cart',98)
bart.print_score()
# print(bart.__name) // Private var
print(bart._Student__name)
#inherit and multibehavior
class Animal(object):
def run(self):
print('Animal is running')
def eat(self):
print('Animal is eating')
class Dog(Animal):
pass
class Cat(Animal):
def run(self):
print('cat is running')
def eat(self):
print('cat is eating')
dog = Dog()
dog.run()
cat = Cat()
cat.eat()
r= isinstance(cat ,Cat)
print(r)
def run_twice(animal):
animal.run()
animal.run()
run_twice(dog)
class Tortoise(Animal):
def run(self):
print('Tortoise is running slowly...')
run_twice(Tortoise())
#duck like object
class Timer(object):
def run(self):
print('timer is ticking and tocking')
run_twice(Timer()) | ___author__ = 'eamon'
'Object Oriented Programming'
std1 = {'name': 'Eamon', 'Score': 99}
std2 = {'name': 'chen', 'Score': 100}
def print_score(std):
print('%s: %s' % (std['name'], std['Score']))
print_score(std1)
print_score(std2)
class Student(object):
def __init__(self, name, score):
self.__name = name
self.__score = score
def print_score(self):
print('%s: %s' % (self.__name, self.__score))
def get_grade(self):
if self.__score >= 90:
return 'A'
elif self.__score >= 60:
return 'B'
else:
return 'C'
def get_name(self):
return self.__name
eamon = student('eamon', 99)
chen = student('chen', 100)
eamon.print_score()
chen.print_score()
class Teststudent(object):
pass
tst_stud = test_student()
print(tstStud)
tstStud.name = 'eamon_tst'
print(tstStud.name)
eamon.get_grade()
eamon.age = 10
print(eamon.age)
bart = student('Babie cart', 98)
bart.print_score()
print(bart._Student__name)
class Animal(object):
def run(self):
print('Animal is running')
def eat(self):
print('Animal is eating')
class Dog(Animal):
pass
class Cat(Animal):
def run(self):
print('cat is running')
def eat(self):
print('cat is eating')
dog = dog()
dog.run()
cat = cat()
cat.eat()
r = isinstance(cat, Cat)
print(r)
def run_twice(animal):
animal.run()
animal.run()
run_twice(dog)
class Tortoise(Animal):
def run(self):
print('Tortoise is running slowly...')
run_twice(tortoise())
class Timer(object):
def run(self):
print('timer is ticking and tocking')
run_twice(timer()) |
class HostManagerBase(object):
def get_sni_host(self, ip):
return "", ""
| class Hostmanagerbase(object):
def get_sni_host(self, ip):
return ('', '') |
n = int(input("Enter the month number:"))
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = 2
if n in a:
print("The total number of days in month",n,"is 31")
elif n in b:
print("The total number of days in month",n,"is 30")
elif n == c:
print("This month may have 28 or 29 days based on leap year")
else:
print("Invalid month number")
| n = int(input('Enter the month number:'))
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = 2
if n in a:
print('The total number of days in month', n, 'is 31')
elif n in b:
print('The total number of days in month', n, 'is 30')
elif n == c:
print('This month may have 28 or 29 days based on leap year')
else:
print('Invalid month number') |
# Hyperparameters
BUFFER_SIZE = int(1e6)
BATCH_SIZE = 64
GAMMA = 0.99
TAU = 0.01
LRA = 1e-4
LRC = 1e-3
HIDDEN_1 = 400
HIDDEN_2 = 300
MAX_EPISODES = 50000
MAX_STEPS = 200
GLOBAL_LINEAR_EPS_DECAY = 1e-5 # Decay over 100 thousand transitions
OPTION_LINEAR_EPS_DECAY = 2e-5 # Decay over 50 thousand transitions
PRINT_EVERY = 10
| buffer_size = int(1000000.0)
batch_size = 64
gamma = 0.99
tau = 0.01
lra = 0.0001
lrc = 0.001
hidden_1 = 400
hidden_2 = 300
max_episodes = 50000
max_steps = 200
global_linear_eps_decay = 1e-05
option_linear_eps_decay = 2e-05
print_every = 10 |
class Rqst:
"""
Request object helper
"""
@classmethod
def get_post_get_param(cls, request, name, default_value):
"""
Retrieve either POST or GET variable from the request object
:param request: the request object
:param name: the name
:param default_value: the default value if not found
:return:
"""
return request.POST.get(name, request.GET.get(name, default_value))
@classmethod
def get_pk_or_id(cls, request, pk_keys=('pk', 'id'), default_value=None, cast_int=True):
"""
Get the primary key or id from the request object.
:param request: the request object
:param pk_keys: the key name(s)
:param default_value:
:param cast_int: indicate weather to convert the value to integer
:return: the value of the variable name
"""
try:
for k in pk_keys:
result = cls.get_post_get_param(request, k, None)
if result is not None:
if cast_int:
return int(result)
return result
except Exception as ex:
print('Error: %s' % ex)
return default_value
@classmethod
def is_get_request(cls, request):
"""
Is the request is GET method.
:param request: request object
:return:
"""
return str(request.method).upper() == 'GET'
@classmethod
def is_post_request(cls, request):
"""
Is the request is GET method.
:param request: request object
:return:
"""
return str(request.method).upper() == 'POST'
| class Rqst:
"""
Request object helper
"""
@classmethod
def get_post_get_param(cls, request, name, default_value):
"""
Retrieve either POST or GET variable from the request object
:param request: the request object
:param name: the name
:param default_value: the default value if not found
:return:
"""
return request.POST.get(name, request.GET.get(name, default_value))
@classmethod
def get_pk_or_id(cls, request, pk_keys=('pk', 'id'), default_value=None, cast_int=True):
"""
Get the primary key or id from the request object.
:param request: the request object
:param pk_keys: the key name(s)
:param default_value:
:param cast_int: indicate weather to convert the value to integer
:return: the value of the variable name
"""
try:
for k in pk_keys:
result = cls.get_post_get_param(request, k, None)
if result is not None:
if cast_int:
return int(result)
return result
except Exception as ex:
print('Error: %s' % ex)
return default_value
@classmethod
def is_get_request(cls, request):
"""
Is the request is GET method.
:param request: request object
:return:
"""
return str(request.method).upper() == 'GET'
@classmethod
def is_post_request(cls, request):
"""
Is the request is GET method.
:param request: request object
:return:
"""
return str(request.method).upper() == 'POST' |
# opyright 2010 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Possible task states for instances. extended for vcloud driver
Compute instance task states represent what is happening to the instance at the
current moment.
"""
# TASK STATES FOR INSTANCE SPAWING
DOWNLOADING = 'downloading' # downoading image file from glance
CONVERTING = 'converting' # convert qcow2 to vmdk
PACKING = 'packing' # making ovf package
NETWORK_CREATING = 'network_creating'
IMPORTING = 'importing' # importing ovf package to vcloud director
VM_CREATING = 'vm_creating' # create and power on vm
# TASK STATES FOR INSATCNE MIGRATION
EXPORTING = 'exporting'
UPLOADING = 'uploading'
PROVIDER_PREPARING = 'provider_preparing'
| """Possible task states for instances. extended for vcloud driver
Compute instance task states represent what is happening to the instance at the
current moment.
"""
downloading = 'downloading'
converting = 'converting'
packing = 'packing'
network_creating = 'network_creating'
importing = 'importing'
vm_creating = 'vm_creating'
exporting = 'exporting'
uploading = 'uploading'
provider_preparing = 'provider_preparing' |
"""To be deleted once https://github.com/ansible/ansible/pull/15062 has been merged"""
def issubset(a, b):
return set(a) <= set(b)
def issuperset(a, b):
return set(a) >= set(b)
class FilterModule(object):
def filters(self):
return {
'issubset': issubset,
'issuperset': issuperset,
}
| """To be deleted once https://github.com/ansible/ansible/pull/15062 has been merged"""
def issubset(a, b):
return set(a) <= set(b)
def issuperset(a, b):
return set(a) >= set(b)
class Filtermodule(object):
def filters(self):
return {'issubset': issubset, 'issuperset': issuperset} |
# @author: cchen
# pretty long and should be simplified later
class Solution:
# @param {string} s
# @return {string}
def longestPalindrome(self, s):
size = len(s)
ls = []
ll = 0
rr = 0
l = 0
r = 0
maxlen = r - l + 1
for i in range(1, size):
if s[i - 1] == s[i]:
r = i
else:
if r - l + 1 > maxlen:
maxlen = r - l + 1
ll = l
rr = r
ls.append([[l, r], s[i - 1]])
l = i
r = i
if r - l + 1 > maxlen:
maxlen = r - l + 1
ll = l
rr = r
ls.append([[l, r], s[size - 1]])
for i in range(1, len(ls) - 1):
l = i - 1
r = i + 1
clen = ls[i][0][1] - ls[i][0][0] + 1
while -1 < l and r < len(ls) and ls[l][1] == ls[r][1]:
llen = ls[l][0][1] - ls[l][0][0] + 1
rlen = ls[r][0][1] - ls[r][0][0] + 1
if llen == rlen:
clen += 2 * llen
if clen > maxlen:
maxlen = clen
ll = ls[l][0][0]
rr = ls[r][0][1]
l -= 1
r += 1
else:
if llen > rlen:
clen += 2 * rlen
else:
clen += 2 * llen
if clen > maxlen:
maxlen = clen
if llen > rlen:
ll = ls[l][0][1] - rlen + 1
rr = ls[r][0][1]
else:
ll = ls[l][0][0]
rr = ls[r][0][0] + llen - 1
break
return s[ll:rr + 1]
| class Solution:
def longest_palindrome(self, s):
size = len(s)
ls = []
ll = 0
rr = 0
l = 0
r = 0
maxlen = r - l + 1
for i in range(1, size):
if s[i - 1] == s[i]:
r = i
else:
if r - l + 1 > maxlen:
maxlen = r - l + 1
ll = l
rr = r
ls.append([[l, r], s[i - 1]])
l = i
r = i
if r - l + 1 > maxlen:
maxlen = r - l + 1
ll = l
rr = r
ls.append([[l, r], s[size - 1]])
for i in range(1, len(ls) - 1):
l = i - 1
r = i + 1
clen = ls[i][0][1] - ls[i][0][0] + 1
while -1 < l and r < len(ls) and (ls[l][1] == ls[r][1]):
llen = ls[l][0][1] - ls[l][0][0] + 1
rlen = ls[r][0][1] - ls[r][0][0] + 1
if llen == rlen:
clen += 2 * llen
if clen > maxlen:
maxlen = clen
ll = ls[l][0][0]
rr = ls[r][0][1]
l -= 1
r += 1
else:
if llen > rlen:
clen += 2 * rlen
else:
clen += 2 * llen
if clen > maxlen:
maxlen = clen
if llen > rlen:
ll = ls[l][0][1] - rlen + 1
rr = ls[r][0][1]
else:
ll = ls[l][0][0]
rr = ls[r][0][0] + llen - 1
break
return s[ll:rr + 1] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.