content
stringlengths 7
1.05M
| fixed_cases
stringlengths 1
1.28M
|
---|---|
# Given an array, cyclically rotate the array clockwise by one.
def rotateCyclic(a):
start = 0
end = 1
while(end != len(a)):
temp = a[start]
a[start] = a[end]
a[end] = temp
end += 1
a = [1,2,3,4,5,6]
rotateCyclic(a)
print(a)
|
def rotate_cyclic(a):
start = 0
end = 1
while end != len(a):
temp = a[start]
a[start] = a[end]
a[end] = temp
end += 1
a = [1, 2, 3, 4, 5, 6]
rotate_cyclic(a)
print(a)
|
s = 'hello world'
y =[]
for i in s.split(' '):
x=i[0].upper() + i[1:]
y.append(x)
z= ' '.join(y)
print(z)
|
s = 'hello world'
y = []
for i in s.split(' '):
x = i[0].upper() + i[1:]
y.append(x)
z = ' '.join(y)
print(z)
|
def removeTheLoop(head):
##Your code here
if detectloop(head)==0:
return
one=head
two=head
while(one and two and two.next):
one=one.next
two=two.next.next
#print(one.data,two.data)
if one==two:
f=one
break
#print(f.data)
temp=head
while(temp!=f):
if temp.next==f.next:
#print(temp.next.data,f.next.data)
f.next=None
break
else:
temp=temp.next
f=f.next
return True
|
def remove_the_loop(head):
if detectloop(head) == 0:
return
one = head
two = head
while one and two and two.next:
one = one.next
two = two.next.next
if one == two:
f = one
break
temp = head
while temp != f:
if temp.next == f.next:
f.next = None
break
else:
temp = temp.next
f = f.next
return True
|
#!usr/bin/env python3
def main():
print('Reading text files')
f = open('lines.txt') # open returns a file object, that's an iterator. by default it opens in read & text mode
for line in f:
print(line.rstrip()) # Return a copy of the string with trailing whitespace removed
print('\nWriting text files')
infile = open('lines.txt', 'rt') # open in read mode and text mode
outfile = open('lines-copy.txt', 'wt') # open in write mode and text mode
for line in infile:
print(line.rstrip(), file=outfile)
print('.', end='', flush=True) # flushes the output buffer so we ensure we print the "." properly
outfile.close() # to prevent any data loss when exiting the main function
print('\ndone.')
print('\nWriting binary files')
infile = open('berlin.jpg', 'rb') # open in read mode and binary mode
outfile = open('berlin-copy.jpg', 'wb') # open in write mode and binary mode
while True:
buffer = infile.read(10240) # 10k bytes
if buffer: # is going to be false when is empty
outfile.write(buffer)
print('.', end='', flush=True) # each "." represents 10k bytes read and written
else:
break
outfile.close()
print('\ndone.')
if __name__ == '__main__':
main()
# CONSOLE OUTPUT:
# Reading text files
# 01 The first line.
# 02 The second line.
# 03 The third line.
# 04 The fourth line.
# 05 The fifth line.
# 06 The sixth line.
# 07 The seventh line.
# 08 The eight line.
# 09 The ninth line.
# 10 The tenth line.
#
# Writing text files
# ..........
# done.
#
# Writing binary files
# .....................................................
# done.
|
def main():
print('Reading text files')
f = open('lines.txt')
for line in f:
print(line.rstrip())
print('\nWriting text files')
infile = open('lines.txt', 'rt')
outfile = open('lines-copy.txt', 'wt')
for line in infile:
print(line.rstrip(), file=outfile)
print('.', end='', flush=True)
outfile.close()
print('\ndone.')
print('\nWriting binary files')
infile = open('berlin.jpg', 'rb')
outfile = open('berlin-copy.jpg', 'wb')
while True:
buffer = infile.read(10240)
if buffer:
outfile.write(buffer)
print('.', end='', flush=True)
else:
break
outfile.close()
print('\ndone.')
if __name__ == '__main__':
main()
|
def mcd(a, b):
if a > b:
small = b
else:
small = a
for i in range(1, small+1):
if((a % i == 0) and (b % i == 0)):
mcd1 = i
return mcd1
a = int(input("intrduzca un numero:"))
b = int(input("intrduzca un segundo numero:"))
print ("The mcd is : ",end="")
print (mcd(a,b))
#lo que hacemos es asignar cual de los dos es el menor de los valores y por cada numero contenido entre el
# 1 y el menor de los valores, dividimos ambos numeros entre todos aquellos hasta que damos un valor para
# el que ambos son divisores exactos ( el mayor de estos ya que varios daran de resto 0 pero el
# mayor el que nos interesa) y ese seria el mcd.
|
def mcd(a, b):
if a > b:
small = b
else:
small = a
for i in range(1, small + 1):
if a % i == 0 and b % i == 0:
mcd1 = i
return mcd1
a = int(input('intrduzca un numero:'))
b = int(input('intrduzca un segundo numero:'))
print('The mcd is : ', end='')
print(mcd(a, b))
|
"""
entradas
cantidadmetros-->m-->float
salidas
metrosapulgadas-->pu-->float
mmetrosapies-->pi-->float
"""
#entradas
m=float(input("Ingrese la cantidad de metros: "))
#caja negra
pu=round((m*39.27), 2)
pi=round((pu/12), 2)
#salidas
print(m, " metros equivalen a ", pu, " pulgadas y ", pi, " pies")
|
"""
entradas
cantidadmetros-->m-->float
salidas
metrosapulgadas-->pu-->float
mmetrosapies-->pi-->float
"""
m = float(input('Ingrese la cantidad de metros: '))
pu = round(m * 39.27, 2)
pi = round(pu / 12, 2)
print(m, ' metros equivalen a ', pu, ' pulgadas y ', pi, ' pies')
|
# MenuTitle: Display all kerning group members
# -*- coding: utf-8 -*-
__doc__ = """
Opens a tab containing all the members of the currently selected glyphs kerning groups.
"""
Glyphs.clearLog()
# Glyphs.showMacroWindow()
lefts = dict((g.parent.leftKerningGroup, []) for g in Glyphs.font.selectedLayers if g.parent.leftKerningGroup)
rights = dict((g.parent.rightKerningGroup, []) for g in Glyphs.font.selectedLayers if g.parent.rightKerningGroup)
for g in Glyphs.font.glyphs:
try:
lefts[g.leftKerningGroup].append(g.name)
except KeyError:
pass
try:
rights[g.rightKerningGroup].append(g.name)
except KeyError:
pass
# thisGlyph = Glyphs.font.selectedLayers[0].parent
# leftGroup = ['/' + g.name for g in Glyphs.font.glyphs if g.leftKerningGroup == thisGlyph.leftKerningGroup]
# rightGroup = ['/' + g.name for g in Glyphs.font.glyphs if g.rightKerningGroup == thisGlyph.rightKerningGroup]
# print rightGroup
strings = []
strings.append('Leftside Kerning Group(s):\n' + '\n'.join([' '.join(map(lambda x: '/' + x, gn)) for gn in sorted(lefts.values())]))
strings.append('Rightside Kerning Group(s):\n' + '\n'.join([' '.join(map(lambda x: '/' + x, gn)) for gn in sorted(rights.values())]))
string = '\n\n'.join(strings)
if string:
Glyphs.font.newTab(string)
|
__doc__ = '\nOpens a tab containing all the members of the currently selected glyphs kerning groups.\n'
Glyphs.clearLog()
lefts = dict(((g.parent.leftKerningGroup, []) for g in Glyphs.font.selectedLayers if g.parent.leftKerningGroup))
rights = dict(((g.parent.rightKerningGroup, []) for g in Glyphs.font.selectedLayers if g.parent.rightKerningGroup))
for g in Glyphs.font.glyphs:
try:
lefts[g.leftKerningGroup].append(g.name)
except KeyError:
pass
try:
rights[g.rightKerningGroup].append(g.name)
except KeyError:
pass
strings = []
strings.append('Leftside Kerning Group(s):\n' + '\n'.join([' '.join(map(lambda x: '/' + x, gn)) for gn in sorted(lefts.values())]))
strings.append('Rightside Kerning Group(s):\n' + '\n'.join([' '.join(map(lambda x: '/' + x, gn)) for gn in sorted(rights.values())]))
string = '\n\n'.join(strings)
if string:
Glyphs.font.newTab(string)
|
#!/usr/bin/env python3
# encoding: utf-8
# author: cappyclearl
# Given an array and a value, remove all instances of that value in-place and return the new length.
# Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.
# The order of elements can be changed. It doesn't matter what you leave beyond the new length.
# Example:
# Given nums = [3,2,2,3], val = 3,
# Your function should return length = 2, with the first two elements of nums being 2.
class Solution:
def removeElement(self, nums, val):
"""
:type nums: List[int]
:type val: int
:rtype: int
"""
remove_count = nums.count(val)
for i in range(remove_count):
nums.remove(val)
return len(nums)
|
class Solution:
def remove_element(self, nums, val):
"""
:type nums: List[int]
:type val: int
:rtype: int
"""
remove_count = nums.count(val)
for i in range(remove_count):
nums.remove(val)
return len(nums)
|
# Link: https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/
class Solution:
# @return an integer
def lengthOfLongestSubstring(self, s):
d = {}
start = 0
maxlen = 0
for i, c in enumerate(s):
if c not in d.keys():
if (i - start + 1) > maxlen:
maxlen = i - start + 1
d[c] = i
else:
for _ in range(start, d[c]):
d.pop(s[_])
start = d[c] + 1
d[c] = i
return maxlen
|
class Solution:
def length_of_longest_substring(self, s):
d = {}
start = 0
maxlen = 0
for (i, c) in enumerate(s):
if c not in d.keys():
if i - start + 1 > maxlen:
maxlen = i - start + 1
d[c] = i
else:
for _ in range(start, d[c]):
d.pop(s[_])
start = d[c] + 1
d[c] = i
return maxlen
|
class Number_Pad_To_Words():
let_to_num = {
'a': '2',
'b': '2',
'c': '2',
'd': '3',
'e': '3',
'f': '3',
'g': '4',
'h': '4',
'i': '4',
'j': '5',
'k': '5',
'l': '5',
'm': '6',
'n': '6',
'o': '6',
'p': '7',
'q': '7',
'r': '7',
's': '7',
't': '8',
'u': '8',
'v': '8',
'w': '9',
'x': '9',
'y': '9',
'z': '9'
}
# O(ns) n -> number of words, s -> num of letters
def __init__(self, words):
self.num_to_words = {}
for word in words:
ans = ''
for let in word:
ans+= self.let_to_num[let]
if ans not in self.num_to_words:
self.num_to_words[ans] = [word]
else:
self.num_to_words[ans].append(word)
# O(1) lookup time
def get_num_to_words(self, num):
if str(num) not in self.num_to_words:
return []
return self.num_to_words[str(num)]
|
class Number_Pad_To_Words:
let_to_num = {'a': '2', 'b': '2', 'c': '2', 'd': '3', 'e': '3', 'f': '3', 'g': '4', 'h': '4', 'i': '4', 'j': '5', 'k': '5', 'l': '5', 'm': '6', 'n': '6', 'o': '6', 'p': '7', 'q': '7', 'r': '7', 's': '7', 't': '8', 'u': '8', 'v': '8', 'w': '9', 'x': '9', 'y': '9', 'z': '9'}
def __init__(self, words):
self.num_to_words = {}
for word in words:
ans = ''
for let in word:
ans += self.let_to_num[let]
if ans not in self.num_to_words:
self.num_to_words[ans] = [word]
else:
self.num_to_words[ans].append(word)
def get_num_to_words(self, num):
if str(num) not in self.num_to_words:
return []
return self.num_to_words[str(num)]
|
JOB_TYPES = [
('Delivery driver'),
('Web developer'),
('Lecturer'),
]
|
job_types = ['Delivery driver', 'Web developer', 'Lecturer']
|
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 30 18:05:06 2017
@author: pfduc
"""
class BookingError(Exception):
def __init__(self, arg):
self.message = arg
class TimeSlotError(BookingError):
def __init__(self, arg):
self.message = arg
|
"""
Created on Fri Jun 30 18:05:06 2017
@author: pfduc
"""
class Bookingerror(Exception):
def __init__(self, arg):
self.message = arg
class Timesloterror(BookingError):
def __init__(self, arg):
self.message = arg
|
class Shazam:
pass
def foo(p):
"""
@param p: the magic word
@type p: Shazam
@return:
"""
|
class Shazam:
pass
def foo(p):
"""
@param p: the magic word
@type p: Shazam
@return:
"""
|
'''
mymod.py - counts the number of lines and chars in the file.
'''
def countLines(name):
'''
countLines(name) - counts the number of lines in the file "name".
Example: countLines("/home/test_user1/test_dir1/test.txt")
'''
file = open(name)
return len(file.readlines())
def countChars(name):
'''
countChars(name) - counts the number of chars in the file "name".
Example: countChars("/home/test_user1/test_dir1/test.txt")
'''
file = open(name)
return sum(len(x) for x in file.read())
def countLines1(file):
file.seek(0)
return len(file.readlines())
def countChars1(file):
file.seek(0)
return sum(len(x) for x in file.read())
def test(name):
if type(name) == str:
return "File {0} contains: {1} lines; {2} chars.".format(name, countLines(name), countChars(name))
else:
return "File {0} contains: {1} lines; {2} chars.".format(name.name, countLines1(name), countChars1(name))
if __name__ == '__main__':
print(test('mymod.py'))
|
"""
mymod.py - counts the number of lines and chars in the file.
"""
def count_lines(name):
"""
countLines(name) - counts the number of lines in the file "name".
Example: countLines("/home/test_user1/test_dir1/test.txt")
"""
file = open(name)
return len(file.readlines())
def count_chars(name):
"""
countChars(name) - counts the number of chars in the file "name".
Example: countChars("/home/test_user1/test_dir1/test.txt")
"""
file = open(name)
return sum((len(x) for x in file.read()))
def count_lines1(file):
file.seek(0)
return len(file.readlines())
def count_chars1(file):
file.seek(0)
return sum((len(x) for x in file.read()))
def test(name):
if type(name) == str:
return 'File {0} contains: {1} lines; {2} chars.'.format(name, count_lines(name), count_chars(name))
else:
return 'File {0} contains: {1} lines; {2} chars.'.format(name.name, count_lines1(name), count_chars1(name))
if __name__ == '__main__':
print(test('mymod.py'))
|
#!/usr/bin/env python3
# Parse input
with open("14/input.txt", "r") as fd:
seq = list(fd.readline().rstrip())
fd.readline()
line = fd.readline().rstrip()
instr = dict()
while line:
i = tuple([x for x in line.split(" -> ")])
instr[i[0]] = i[1]
line = fd.readline().rstrip()
# Simulate Polymer
# Count initial pairs
counts = dict()
for i, k in zip(seq, seq[1:]):
pair = "".join([i, k])
counts[pair] = counts.get(pair, 0) + 1
# Simulate pairwise counts
for i in range(40):
copy = dict()
for k, v in counts.items():
if k in instr.keys():
r = instr[k]
copy[f"{k[0]}{r}"] = copy.get(f"{k[0]}{r}", 0) + v
copy[f"{r}{k[1]}"] = copy.get(f"{r}{k[1]}", 0) + v
counts = copy
# Count occurences of characters
element_count = dict()
for k, v in counts.items():
for c in k:
element_count[c] = element_count.get(c, 0) + v
element_count[seq[0]] += 1
element_count[seq[-1]] += 1
max_e = int(max(element_count.values()) / 2)
min_e = int(min(element_count.values()) / 2)
print(max_e - min_e)
|
with open('14/input.txt', 'r') as fd:
seq = list(fd.readline().rstrip())
fd.readline()
line = fd.readline().rstrip()
instr = dict()
while line:
i = tuple([x for x in line.split(' -> ')])
instr[i[0]] = i[1]
line = fd.readline().rstrip()
counts = dict()
for (i, k) in zip(seq, seq[1:]):
pair = ''.join([i, k])
counts[pair] = counts.get(pair, 0) + 1
for i in range(40):
copy = dict()
for (k, v) in counts.items():
if k in instr.keys():
r = instr[k]
copy[f'{k[0]}{r}'] = copy.get(f'{k[0]}{r}', 0) + v
copy[f'{r}{k[1]}'] = copy.get(f'{r}{k[1]}', 0) + v
counts = copy
element_count = dict()
for (k, v) in counts.items():
for c in k:
element_count[c] = element_count.get(c, 0) + v
element_count[seq[0]] += 1
element_count[seq[-1]] += 1
max_e = int(max(element_count.values()) / 2)
min_e = int(min(element_count.values()) / 2)
print(max_e - min_e)
|
x=5
while x < 10:
print(x)
x += 1
|
x = 5
while x < 10:
print(x)
x += 1
|
src = Split('''
prov_app.c
''')
if aos_global_config.get("ERASE") == 1:
component.add_macros(CONFIG_ERASE_KEY);
component = aos_component('prov_app', src)
component.add_comp_deps('kernel/yloop', 'tools/cli', 'security/prov', 'security/prov/test')
component.add_global_macros('AOS_NO_WIFI')
|
src = split('\n prov_app.c\n')
if aos_global_config.get('ERASE') == 1:
component.add_macros(CONFIG_ERASE_KEY)
component = aos_component('prov_app', src)
component.add_comp_deps('kernel/yloop', 'tools/cli', 'security/prov', 'security/prov/test')
component.add_global_macros('AOS_NO_WIFI')
|
#!/usr/bin/env python3
# https://agc001.contest.atcoder.jp/tasks/agc001_a
n = int(input())
l = [int(x) for x in input().split()]
l.sort()
print(sum(l[::2]))
|
n = int(input())
l = [int(x) for x in input().split()]
l.sort()
print(sum(l[::2]))
|
"""
This module provides basic methods for unit conversion and calculation of basic wind plant variables
"""
def convert_power_to_energy(power_col, sample_rate_min="10T"):
"""
Compute energy [kWh] from power [kw] and return the data column
Args:
df(:obj:`pandas.DataFrame`): the existing data frame to append to
col(:obj:`string`): Power column to use if not power_kw
sample_rate_min(:obj:`float`): Sampling rate in minutes to use for conversion, if not ten minutes
Returns:
:obj:`pandas.Series`: Energy in kWh that matches the length of the input data frame 'df'
"""
time_conversion = {"1T": 1.0, "5T": 5.0, "10T": 10.0, "30T": 30.0, "1H": 60.0}
energy_kwh = power_col * time_conversion[sample_rate_min] / 60.0
return energy_kwh
def compute_gross_energy(
net_energy, avail_losses, curt_losses, avail_type="frac", curt_type="frac"
):
"""
This function computes gross energy for a wind plant or turbine by adding reported availability and
curtailment losses to reported net energy. Account is made of whether availabilty or curtailment loss data
is reported in energy ('energy') or fractional units ('frac'). If in energy units, this function assumes that net
energy, availability loss, and curtailment loss are all reported in the same units
Args:
net energy (numpy array of Pandas series): reported net energy for wind plant or turbine
avail (numpy array of Pandas series): reported availability losses for wind plant or turbine
curt (numpy array of Pandas series): reported curtailment losses for wind plant or turbine
Returns:
gross (numpy array of Pandas series): calculated gross energy for wind plant or turbine
"""
if (avail_type == "frac") & (curt_type == "frac"):
gross = net_energy / (1 - avail_losses - curt_losses)
elif (avail_type == "frac") & (curt_type == "energy"):
gross = net_energy / (1 - avail_losses) + curt_losses
elif (avail_type == "energy") & (curt_type == "frac"):
gross = net_energy / (1 - curt_losses) + avail_losses
elif (avail_type == "energy") & (curt_type == "energy"):
gross = net_energy + curt_losses + avail_losses
if len(gross[gross < net_energy]) > 0:
raise Exception("Gross energy cannot be less than net energy. Check your input values")
if (len(avail_losses[avail_losses < 0]) > 0) | (len(curt_losses[curt_losses < 0]) > 0):
raise Exception(
"Cannot have negative availability or curtailment input values. Check your data"
)
return gross
def convert_feet_to_meter(variable):
"""
Compute variable in [meter] from [feet] and return the data column
Args:
df(:obj:`pandas.Series`): the existing data frame to append to
variable(:obj:`string`): variable in feet
Returns:
:obj:`pandas.Series`: variable in meters of the input data frame 'df'
"""
out = variable * 0.3048
return out
|
"""
This module provides basic methods for unit conversion and calculation of basic wind plant variables
"""
def convert_power_to_energy(power_col, sample_rate_min='10T'):
"""
Compute energy [kWh] from power [kw] and return the data column
Args:
df(:obj:`pandas.DataFrame`): the existing data frame to append to
col(:obj:`string`): Power column to use if not power_kw
sample_rate_min(:obj:`float`): Sampling rate in minutes to use for conversion, if not ten minutes
Returns:
:obj:`pandas.Series`: Energy in kWh that matches the length of the input data frame 'df'
"""
time_conversion = {'1T': 1.0, '5T': 5.0, '10T': 10.0, '30T': 30.0, '1H': 60.0}
energy_kwh = power_col * time_conversion[sample_rate_min] / 60.0
return energy_kwh
def compute_gross_energy(net_energy, avail_losses, curt_losses, avail_type='frac', curt_type='frac'):
"""
This function computes gross energy for a wind plant or turbine by adding reported availability and
curtailment losses to reported net energy. Account is made of whether availabilty or curtailment loss data
is reported in energy ('energy') or fractional units ('frac'). If in energy units, this function assumes that net
energy, availability loss, and curtailment loss are all reported in the same units
Args:
net energy (numpy array of Pandas series): reported net energy for wind plant or turbine
avail (numpy array of Pandas series): reported availability losses for wind plant or turbine
curt (numpy array of Pandas series): reported curtailment losses for wind plant or turbine
Returns:
gross (numpy array of Pandas series): calculated gross energy for wind plant or turbine
"""
if (avail_type == 'frac') & (curt_type == 'frac'):
gross = net_energy / (1 - avail_losses - curt_losses)
elif (avail_type == 'frac') & (curt_type == 'energy'):
gross = net_energy / (1 - avail_losses) + curt_losses
elif (avail_type == 'energy') & (curt_type == 'frac'):
gross = net_energy / (1 - curt_losses) + avail_losses
elif (avail_type == 'energy') & (curt_type == 'energy'):
gross = net_energy + curt_losses + avail_losses
if len(gross[gross < net_energy]) > 0:
raise exception('Gross energy cannot be less than net energy. Check your input values')
if (len(avail_losses[avail_losses < 0]) > 0) | (len(curt_losses[curt_losses < 0]) > 0):
raise exception('Cannot have negative availability or curtailment input values. Check your data')
return gross
def convert_feet_to_meter(variable):
"""
Compute variable in [meter] from [feet] and return the data column
Args:
df(:obj:`pandas.Series`): the existing data frame to append to
variable(:obj:`string`): variable in feet
Returns:
:obj:`pandas.Series`: variable in meters of the input data frame 'df'
"""
out = variable * 0.3048
return out
|
"""
Pattern Matching: You are given two strings, pattern and value. The pattern string consists of
just the letters a and b, describing a pattern within a string. For example, the string "catcatgocatgo"
matches the pattern "aabab" (where cat is a and go is b). It also matches patterns like a, ab, and b.
Write a method to determine if value matches pattern.
(16.18, p511)
SOLUTION: Backtracking
N is length of `value` string and length of pattern can't exceed N.
Time O(N^2)
Space O(N)
"""
def _matches(
pattern: str, value: str, main_size: int, alt_size: int, first_alt: int
) -> bool:
"""Return True if value matches pattern, False otherwise.
The main and alternate pattern strings are known.
:param pattern: pattern to match
:param value: string
:param main_size: length of the main pattern
:param alt_size: length of the alternate pattern
:param first_alt: beginning index of the first occurrence of the alternate pattern in `value`
:return: True if value matches pattern, False otherwise.
"""
# Let i be the index of `pattern` and j be index of `value`.
v = main_size
main = value[:main_size] # worst case O(N) space
alt = value[first_alt : first_alt + alt_size]
for p in range(1, len(pattern)):
is_main = pattern[p] == pattern[0]
size = main_size if is_main else alt_size
_next = value[v : v + size]
if is_main and main != _next:
return False
if not is_main and alt != _next:
return False
v += size
return True
def matches(pattern: str, value: str) -> bool:
if pattern is None or len(pattern) == 0:
raise ValueError("pattern must not be empty string")
if value is None or len(value) == 0:
return False
main = pattern[0]
alt = "b" if main == "a" else "a"
n_main = pattern.count(main)
n_alt = len(pattern) - n_main
first_alt: int = pattern.find(alt)
max_main_size = int(len(value) / n_main) # round down
for main_size in range(1, max_main_size + 1):
remainder = len(value) - main_size * n_main
if n_alt == 0 or remainder % n_alt == 0:
# index of first `alt` substring occurs after how many repetitions of `main` substring
alt_index = first_alt * main_size
alt_size = 0 if n_alt == 0 else int(remainder / n_alt) # round down
if _matches(pattern, value, main_size, alt_size, alt_index):
return True
return False
|
"""
Pattern Matching: You are given two strings, pattern and value. The pattern string consists of
just the letters a and b, describing a pattern within a string. For example, the string "catcatgocatgo"
matches the pattern "aabab" (where cat is a and go is b). It also matches patterns like a, ab, and b.
Write a method to determine if value matches pattern.
(16.18, p511)
SOLUTION: Backtracking
N is length of `value` string and length of pattern can't exceed N.
Time O(N^2)
Space O(N)
"""
def _matches(pattern: str, value: str, main_size: int, alt_size: int, first_alt: int) -> bool:
"""Return True if value matches pattern, False otherwise.
The main and alternate pattern strings are known.
:param pattern: pattern to match
:param value: string
:param main_size: length of the main pattern
:param alt_size: length of the alternate pattern
:param first_alt: beginning index of the first occurrence of the alternate pattern in `value`
:return: True if value matches pattern, False otherwise.
"""
v = main_size
main = value[:main_size]
alt = value[first_alt:first_alt + alt_size]
for p in range(1, len(pattern)):
is_main = pattern[p] == pattern[0]
size = main_size if is_main else alt_size
_next = value[v:v + size]
if is_main and main != _next:
return False
if not is_main and alt != _next:
return False
v += size
return True
def matches(pattern: str, value: str) -> bool:
if pattern is None or len(pattern) == 0:
raise value_error('pattern must not be empty string')
if value is None or len(value) == 0:
return False
main = pattern[0]
alt = 'b' if main == 'a' else 'a'
n_main = pattern.count(main)
n_alt = len(pattern) - n_main
first_alt: int = pattern.find(alt)
max_main_size = int(len(value) / n_main)
for main_size in range(1, max_main_size + 1):
remainder = len(value) - main_size * n_main
if n_alt == 0 or remainder % n_alt == 0:
alt_index = first_alt * main_size
alt_size = 0 if n_alt == 0 else int(remainder / n_alt)
if _matches(pattern, value, main_size, alt_size, alt_index):
return True
return False
|
"""
This program repeatedly asks a user to guess a number. The program ends
when they're geussed correctly.
"""
# Secret number
my_number = 10
# Ask the user to guess
guess = int(input("Enter a guess: "))
# Keep asking until the guess becomes equal to the secret number
while guess != my_number:
print("Guess again!")
guess = int(input("Enter a guess: "))
print("Good job, you got it!")
|
"""
This program repeatedly asks a user to guess a number. The program ends
when they're geussed correctly.
"""
my_number = 10
guess = int(input('Enter a guess: '))
while guess != my_number:
print('Guess again!')
guess = int(input('Enter a guess: '))
print('Good job, you got it!')
|
N,*H = [int(x) for x in open(0).read().split()]
def solve(l, r):
if l>r:
return 0
min_=min(H[l:r+1])
for i in range(l,r+1):
H[i]-=min_
count=min_
i=l
while i<r:
while i<=r and H[i]==0: i+=1
s=i
while i<=r and H[i]>0: i+=1
count+=solve(s,i-1)
return count
print(solve(0, len(H)-1))
|
(n, *h) = [int(x) for x in open(0).read().split()]
def solve(l, r):
if l > r:
return 0
min_ = min(H[l:r + 1])
for i in range(l, r + 1):
H[i] -= min_
count = min_
i = l
while i < r:
while i <= r and H[i] == 0:
i += 1
s = i
while i <= r and H[i] > 0:
i += 1
count += solve(s, i - 1)
return count
print(solve(0, len(H) - 1))
|
# FizzBuzz
# Getting input from users for the max number to go to for FizzBuzz
ip = input("Enter the max number to go for FizzBuzz: \n")
# If user inputs a number this is executed
if (ip != ""):
for i in range(1, int(ip) + 1):
if (i % 3 == 0 and i%5 == 0):
print("FizzBuzz")
elif (i % 3 == 0):
print("Fizz")
elif (i % 5 == 0):
print("Buzz")
else:
print(i)
# If the input is empty, the value is taken as 100
else:
for i in range(1, 101):
if (i % 3 == 0 and i%5 == 0):
print("FizzBuzz")
elif (i % 3 == 0):
print("Fizz")
elif (i % 5 == 0):
print("Buzz")
else:
print(i)
|
ip = input('Enter the max number to go for FizzBuzz: \n')
if ip != '':
for i in range(1, int(ip) + 1):
if i % 3 == 0 and i % 5 == 0:
print('FizzBuzz')
elif i % 3 == 0:
print('Fizz')
elif i % 5 == 0:
print('Buzz')
else:
print(i)
else:
for i in range(1, 101):
if i % 3 == 0 and i % 5 == 0:
print('FizzBuzz')
elif i % 3 == 0:
print('Fizz')
elif i % 5 == 0:
print('Buzz')
else:
print(i)
|
town = input().lower()
sell_count = float(input())
if 0<=sell_count<=500:
if town == "sofia":
comission = sell_count*0.05
print(f'{comission:.2f}')
elif town=="varna":
comission = sell_count * 0.045
print(f'{comission:.2f}')
elif town == "plovdiv":
comission = sell_count * 0.055
print(f'{comission:.2f}')
else:
print('error')
elif 500<sell_count<=1000:
if town == "sofia":
comission = sell_count*0.07
print(f'{comission:.2f}')
elif town=="varna":
comission = sell_count * 0.075
print(f'{comission:.2f}')
elif town == "plovdiv":
comission = sell_count * 0.08
print(f'{comission:.2f}')
else:
print('error')
elif 1000<sell_count<=10000:
if town == "sofia":
comission = sell_count*0.08
print(f'{comission:.2f}')
elif town=="varna":
comission = sell_count * 0.10
print(f'{comission:.2f}')
elif town == "plovdiv":
comission = sell_count * 0.12
print(f'{comission:.2f}')
else:
print('error')
elif 10000 < sell_count:
if town == "sofia":
comission = sell_count*0.12
print(f'{comission:.2f}')
elif town=="varna":
comission = sell_count * 0.13
print(f'{comission:.2f}')
elif town == "plovdiv":
comission = sell_count * 0.145
print(f'{comission:.2f}')
else:
print('error')
else:
print('error')
|
town = input().lower()
sell_count = float(input())
if 0 <= sell_count <= 500:
if town == 'sofia':
comission = sell_count * 0.05
print(f'{comission:.2f}')
elif town == 'varna':
comission = sell_count * 0.045
print(f'{comission:.2f}')
elif town == 'plovdiv':
comission = sell_count * 0.055
print(f'{comission:.2f}')
else:
print('error')
elif 500 < sell_count <= 1000:
if town == 'sofia':
comission = sell_count * 0.07
print(f'{comission:.2f}')
elif town == 'varna':
comission = sell_count * 0.075
print(f'{comission:.2f}')
elif town == 'plovdiv':
comission = sell_count * 0.08
print(f'{comission:.2f}')
else:
print('error')
elif 1000 < sell_count <= 10000:
if town == 'sofia':
comission = sell_count * 0.08
print(f'{comission:.2f}')
elif town == 'varna':
comission = sell_count * 0.1
print(f'{comission:.2f}')
elif town == 'plovdiv':
comission = sell_count * 0.12
print(f'{comission:.2f}')
else:
print('error')
elif 10000 < sell_count:
if town == 'sofia':
comission = sell_count * 0.12
print(f'{comission:.2f}')
elif town == 'varna':
comission = sell_count * 0.13
print(f'{comission:.2f}')
elif town == 'plovdiv':
comission = sell_count * 0.145
print(f'{comission:.2f}')
else:
print('error')
else:
print('error')
|
class Keyword(object):
"""
Represents a keyword that can be intercepted from a message.
"""
def __init__(self, keyword, has_args, handler):
self.keyword = keyword
self.has_args = has_args
self.handler = handler
def handle(self, args=None):
"""
Calls the handler of a `Keyword` object with an optional argument.
:param args: Argument in text form.
:returns: Return value from calling the handler function.
"""
# Check if the keyword has arguments
if self.has_args:
return self.handler(args)
else:
if args is not None and len(args) > 0:
raise ValueError('Keyword does not accept arguments.')
return self.handler()
class KeywordManager(object):
"""
A collection class for Keywords.
"""
def __init__(self, keywords_list):
self.keywords = []
for keyword in keywords_list:
self.add(**keyword)
def add(self, type, keyword, has_args, handler, **kwargs):
"""
Add a `Keyword` to the collection.
:param keyword_type: Type of keyword to add.
:param keyword: The keyword string.
:param has_args: Boolean value indicating whether the handler accepts
arguments.
:param handler: A handler function to call when keyword is detected.
:param kwargs: Additional arguments to the keyword type
"""
# Check if keyword already exists in collection.
for word in self.keywords:
if word.keyword == keyword:
raise ValueError('Keyword already exists')
# Check for a keyword type
if issubclass(type, Keyword):
keyword = type(
keyword=keyword, has_args=has_args, handler=handler, **kwargs)
else:
raise ValueError(
'No keyword type of \'{}\' exists'.format(type))
self.keywords.append(keyword)
def get(self, keyword):
"""
Get a `Keyword` by keyword string.
:param keyword: Keyword string of the `Keyword` to get.
:returns: A `Keyword` object.
:rtype: Keyword
"""
# Search through the list of keywords for the matching one
for word in self.keywords:
if word.keyword == keyword:
return word
# Return `None` if not found
return None
|
class Keyword(object):
"""
Represents a keyword that can be intercepted from a message.
"""
def __init__(self, keyword, has_args, handler):
self.keyword = keyword
self.has_args = has_args
self.handler = handler
def handle(self, args=None):
"""
Calls the handler of a `Keyword` object with an optional argument.
:param args: Argument in text form.
:returns: Return value from calling the handler function.
"""
if self.has_args:
return self.handler(args)
else:
if args is not None and len(args) > 0:
raise value_error('Keyword does not accept arguments.')
return self.handler()
class Keywordmanager(object):
"""
A collection class for Keywords.
"""
def __init__(self, keywords_list):
self.keywords = []
for keyword in keywords_list:
self.add(**keyword)
def add(self, type, keyword, has_args, handler, **kwargs):
"""
Add a `Keyword` to the collection.
:param keyword_type: Type of keyword to add.
:param keyword: The keyword string.
:param has_args: Boolean value indicating whether the handler accepts
arguments.
:param handler: A handler function to call when keyword is detected.
:param kwargs: Additional arguments to the keyword type
"""
for word in self.keywords:
if word.keyword == keyword:
raise value_error('Keyword already exists')
if issubclass(type, Keyword):
keyword = type(keyword=keyword, has_args=has_args, handler=handler, **kwargs)
else:
raise value_error("No keyword type of '{}' exists".format(type))
self.keywords.append(keyword)
def get(self, keyword):
"""
Get a `Keyword` by keyword string.
:param keyword: Keyword string of the `Keyword` to get.
:returns: A `Keyword` object.
:rtype: Keyword
"""
for word in self.keywords:
if word.keyword == keyword:
return word
return None
|
class Compass(object):
def __init__(self, spacedomains):
self.categories = tuple(spacedomains)
self.spacedomains = spacedomains
# check time compatibility between components
self._check_spacedomain_compatibilities(spacedomains)
def _check_spacedomain_compatibilities(self, spacedomains):
for category in spacedomains:
# check that components' spacedomains are equal
# (to stay until spatial supermesh supported)
if not spacedomains[category].spans_same_region_as(
spacedomains[self.categories[0]]):
raise NotImplementedError(
"components' spacedomains are not identical")
|
class Compass(object):
def __init__(self, spacedomains):
self.categories = tuple(spacedomains)
self.spacedomains = spacedomains
self._check_spacedomain_compatibilities(spacedomains)
def _check_spacedomain_compatibilities(self, spacedomains):
for category in spacedomains:
if not spacedomains[category].spans_same_region_as(spacedomains[self.categories[0]]):
raise not_implemented_error("components' spacedomains are not identical")
|
"""
LeetCode Problem 801. Minimum Swaps To Make Sequences Increasing
Link: https://leetcode.com/problems/minimum-swaps-to-make-sequences-increasing/
Written by: Mostofa Adib Shakib
Language: Python
Time complexity: O(n)
Space complexity: O(n)
Explanation:
1) A[i - 1] < A[i] && B[i - 1] < B[i].
In this case, if we want to keep A and B increasing before the index i, can only have two choices.
-> 1.1 don't swap at (i-1) and don't swap at i, we can get not_swap[i] = not_swap[i-1]
-> 1.2 swap at (i-1) and swap at i, we can get swap[i] = swap[i-1]+1
If swap at (i-1) and do not swap at i, we can not guarantee A and B increasing.
2) A[i-1] < B[i] && B[i-1] < A[i]
In this case, if we want to keep A and B increasing before the index i, can only have two choices.
-> 2.1 swap at (i-1) and do not swap at i, we can get notswap[i] = Math.min(swap[i-1], notswap[i] )
-> 2.2 do not swap at (i-1) and swap at i, we can get swap[i]=Math.min(notswap[i-1]+1, swap[i])
"""
class Solution:
def minSwap(self, A: List[int], B: List[int]) -> int:
length = len(A)
not_swap = [0] + [float('inf')] * (length-1)
swap = [1] + [float('inf')] * (length-1)
for i in range(1, length):
if A[i - 1] < A[i] and B[i - 1] < B[i]:
swap[i] = swap[i - 1] + 1
not_swap[i] = not_swap[i - 1]
if A[i - 1] < B[i] and B[i - 1] < A[i]:
swap[i] = min(swap[i], not_swap[i - 1] + 1)
not_swap[i] = min(not_swap[i], swap[i - 1])
return min(swap[-1], not_swap[-1])
|
"""
LeetCode Problem 801. Minimum Swaps To Make Sequences Increasing
Link: https://leetcode.com/problems/minimum-swaps-to-make-sequences-increasing/
Written by: Mostofa Adib Shakib
Language: Python
Time complexity: O(n)
Space complexity: O(n)
Explanation:
1) A[i - 1] < A[i] && B[i - 1] < B[i].
In this case, if we want to keep A and B increasing before the index i, can only have two choices.
-> 1.1 don't swap at (i-1) and don't swap at i, we can get not_swap[i] = not_swap[i-1]
-> 1.2 swap at (i-1) and swap at i, we can get swap[i] = swap[i-1]+1
If swap at (i-1) and do not swap at i, we can not guarantee A and B increasing.
2) A[i-1] < B[i] && B[i-1] < A[i]
In this case, if we want to keep A and B increasing before the index i, can only have two choices.
-> 2.1 swap at (i-1) and do not swap at i, we can get notswap[i] = Math.min(swap[i-1], notswap[i] )
-> 2.2 do not swap at (i-1) and swap at i, we can get swap[i]=Math.min(notswap[i-1]+1, swap[i])
"""
class Solution:
def min_swap(self, A: List[int], B: List[int]) -> int:
length = len(A)
not_swap = [0] + [float('inf')] * (length - 1)
swap = [1] + [float('inf')] * (length - 1)
for i in range(1, length):
if A[i - 1] < A[i] and B[i - 1] < B[i]:
swap[i] = swap[i - 1] + 1
not_swap[i] = not_swap[i - 1]
if A[i - 1] < B[i] and B[i - 1] < A[i]:
swap[i] = min(swap[i], not_swap[i - 1] + 1)
not_swap[i] = min(not_swap[i], swap[i - 1])
return min(swap[-1], not_swap[-1])
|
time1 = int(input())
time2 = int(input())
time3 = int(input())
sum = time1 + time2 + time3
minutes = int(sum / 60)
seconds = sum % 60
if seconds <= 9:
print('{0}:0{1}'.format(minutes, seconds))
else:
print('{0}:{1}'.format(minutes, seconds))
|
time1 = int(input())
time2 = int(input())
time3 = int(input())
sum = time1 + time2 + time3
minutes = int(sum / 60)
seconds = sum % 60
if seconds <= 9:
print('{0}:0{1}'.format(minutes, seconds))
else:
print('{0}:{1}'.format(minutes, seconds))
|
"""packer_builder/release.py"""
# Version tracking for package.
__author__ = 'Larry Smith Jr.'
__version__ = '0.1.0'
__package_name__ = 'packer_builder'
|
"""packer_builder/release.py"""
__author__ = 'Larry Smith Jr.'
__version__ = '0.1.0'
__package_name__ = 'packer_builder'
|
#
# @lc app=leetcode id=908 lang=python3
#
# [908] Smallest Range I
#
# @lc code=start
class Solution:
def smallestRangeI(self, A: List[int], K: int) -> int:
mi, ma = min(A), max(A)
return 0 if ma - mi - 2*K <= 0 else ma - mi - 2*K
# @lc code=end
|
class Solution:
def smallest_range_i(self, A: List[int], K: int) -> int:
(mi, ma) = (min(A), max(A))
return 0 if ma - mi - 2 * K <= 0 else ma - mi - 2 * K
|
class RandomizedSet(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.d = {} # key - position in list
self.l = [] # numbers
def insert(self, val):
"""
Inserts a value to the set. Returns true if the set did not already contain the specified element.
:type val: int
:rtype: bool
"""
# check if already exist in l
if val in self.d:
return False
# append to l and add key to d
index = len(self.l)
self.l.append(val)
self.d[val] = index
return True
def remove(self, val):
"""
Removes a value from the set. Returns true if the set contained the specified element.
:type val: int
:rtype: bool
"""
# check if not in l
if val not in self.d:
return False
# find index through d and get val, then move the last element to this index and update that key
if self.d[val]==len(self.l)-1:
self.d.pop(val)
self.l.pop()
return True
index = self.d[val]
last = self.l.pop()
self.l[index] = last
self.d[last] = index
self.d.pop(val)
return True
def getRandom(self):
"""
Get a random element from the set.
:rtype: int
"""
# pick a random index in [0:len(l)]
return random.choice(self.l)
# Your RandomizedSet object will be instantiated and called as such:
# obj = RandomizedSet()
# param_1 = obj.insert(val)
# param_2 = obj.remove(val)
# param_3 = obj.getRandom()
|
class Randomizedset(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.d = {}
self.l = []
def insert(self, val):
"""
Inserts a value to the set. Returns true if the set did not already contain the specified element.
:type val: int
:rtype: bool
"""
if val in self.d:
return False
index = len(self.l)
self.l.append(val)
self.d[val] = index
return True
def remove(self, val):
"""
Removes a value from the set. Returns true if the set contained the specified element.
:type val: int
:rtype: bool
"""
if val not in self.d:
return False
if self.d[val] == len(self.l) - 1:
self.d.pop(val)
self.l.pop()
return True
index = self.d[val]
last = self.l.pop()
self.l[index] = last
self.d[last] = index
self.d.pop(val)
return True
def get_random(self):
"""
Get a random element from the set.
:rtype: int
"""
return random.choice(self.l)
|
a = [[10,0],[10,0],[10,0],[10,0],[10,0],[10,0],[10,0],[10,0],[10,0],[10,0]]
step=30
def setup():
size(500,500)
smooth()
noStroke()
myInit()
def myInit():
for i in range(len(a)):
a[i]=[random(0,10)]
for j in range(len(a[i])):
a[i][j]=random(0,30)
def draw():
global step
fill(180,50)
background(10)
for i in range(len(a)):
for j in range(len(a[i])):
stroke(100)
strokeWeight(1)
fill(50)
rect(i*step+100,j*step+100,step,step)
noStroke()
fill(250,90)
ellipse (i*step +115 , j*step +115 , a[i][j], a[i][j])
def mouseClicked():
myInit()
|
a = [[10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0], [10, 0]]
step = 30
def setup():
size(500, 500)
smooth()
no_stroke()
my_init()
def my_init():
for i in range(len(a)):
a[i] = [random(0, 10)]
for j in range(len(a[i])):
a[i][j] = random(0, 30)
def draw():
global step
fill(180, 50)
background(10)
for i in range(len(a)):
for j in range(len(a[i])):
stroke(100)
stroke_weight(1)
fill(50)
rect(i * step + 100, j * step + 100, step, step)
no_stroke()
fill(250, 90)
ellipse(i * step + 115, j * step + 115, a[i][j], a[i][j])
def mouse_clicked():
my_init()
|
# porownania
print('----------')
print((1, 2, 3) < (1, 2, 4))
print([1, 2, 3] < [1, 2, 4])
print('ABC' < 'C' < 'Pascal' < 'Python')
print((1, 2, 3, 4) < (1, 2, 4))
print((1, 2) < (1, 2, -1))
print((1, 2, 3) == (1.0, 2.0, 3.0))
print((1, 2, ('aa', 'ab')) < (1, 2, ('abc', 'a'), 4))
print('--- inne ---')
print(list((1, 2, 3)) < [1, 2, 3])
print((1, 2, 3) > tuple([1, 2, 3]))
print(0 == 0 == 0.0 == 0j)
|
print('----------')
print((1, 2, 3) < (1, 2, 4))
print([1, 2, 3] < [1, 2, 4])
print('ABC' < 'C' < 'Pascal' < 'Python')
print((1, 2, 3, 4) < (1, 2, 4))
print((1, 2) < (1, 2, -1))
print((1, 2, 3) == (1.0, 2.0, 3.0))
print((1, 2, ('aa', 'ab')) < (1, 2, ('abc', 'a'), 4))
print('--- inne ---')
print(list((1, 2, 3)) < [1, 2, 3])
print((1, 2, 3) > tuple([1, 2, 3]))
print(0 == 0 == 0.0 == 0j)
|
# Error handler
class GeneralError(Exception):
"""
This is for general error
"""
def __init__(self, error, severity, status_code):
self.error = error
self.severity = severity
self.status_code = status_code
|
class Generalerror(Exception):
"""
This is for general error
"""
def __init__(self, error, severity, status_code):
self.error = error
self.severity = severity
self.status_code = status_code
|
################################### SERVER'S SIDE ###################################
#const
mask = 0xffffffff
#bitwise operations have the least priority
#Note 1: all variables are unsigned 32-bit quantities and wrap modulo 2**32 when calculating, except for
#ml, message length: 64-bit quantity, and
#hh, message digest: 160-bit quantity
#Note 2: big endian
key = b'SuPeR_sEcReT_kEy,_NoT_tO_bE_gUeSsEd_So_EaSiLy'
def big_endian_64_bit( num ):
num = hex(num).replace('0x','').rjust(16,'0')
return bytes([int(num[i:i+2], 16) for i in range(0, len(num), 2)])
def leftrot( num ):
return ((num << 1) & mask) + (num >> 31)
def bytes2int( block ):
return sum([block[len(block)-1-i] * (256**i) for i in range(len(block))])
def leftrotate(num, offset):
num_type = type(num)
if num_type == bytes:
num = bytes2int(num)
for i in range(offset):
num = leftrot(num)
if num_type == bytes:
num = big_endian_64_bit( num )[4:]
return num
def XOR( block1, block2, block3, block4 ):
return bytes([x^y^z^t for x,y,z,t in zip(block1, block2, block3, block4)])
def SHA1( message ): #the inner mechanism only
#Initialize variable:
h0 = 0x67452301
h1 = 0xEFCDAB89
h2 = 0x98BADCFE
h3 = 0x10325476
h4 = 0xC3D2E1F0
ml = len(message) * 8
#Pre-processing
message += b'\x80'
while (len(message) * 8) % 512 != 448:
message += b'\x00'
message += big_endian_64_bit( ml % (2**64))
#Process the message in successive 512-bit chunks:
chunks = [message[i:i+64] for i in range(0, len(message), 64)]
for chunk in chunks:
w = [chunk[i:i+4] for i in range(0, 64, 4)]
#Message schedule: extend the sixteen 32-bit words into eighty 32-bit words:
for i in range(16, 80):
#Note 3: SHA-0 differs by not having this leftrotate.
w += [leftrotate( XOR(w[i-3], w[i-8], w[i-14], w[i-16]), 1 )]
#Initialize hash value for this chunk:
a = h0
b = h1
c = h2
d = h3
e = h4
#Main loop:
for i in range(80):
f = 0
k = 0
if i in range(20):
f = (b & c) | ((b ^ mask) & d)
k = 0x5A827999
elif i in range(20,40):
f = b ^ c ^ d
k = 0x6ED9EBA1
elif i in range(40,60):
f = (b & c) | (b & d) | (c & d)
k = 0x8F1BBCDC
elif i in range(60,80):
f = b ^ c ^ d
k = 0xCA62C1D6
temp = (leftrotate(a, 5) + f + e + k + bytes2int(w[i])) % (2**32)
e = d
d = c
c = leftrotate(b, 30)
b = a
a = temp
#Add this chunk's hash to result so far:
h0 = (h0 + a) % (2**32)
h1 = (h1 + b) % (2**32)
h2 = (h2 + c) % (2**32)
h3 = (h3 + d) % (2**32)
h4 = (h4 + e) % (2**32)
#Produce the final hash value (big-endian) as a 160-bit number:
hh = (h0 << 128) | (h1 << 96) | (h2 << 64) | (h3 << 32) | h4
return hh
def isValid( message, hh ):
res = False
if SHA1(key + message) == hh:
res = True
return res
################################### ATTACKER'S SIDE ###################################
def pad( bytelength ): #MD_padding
ml = bytelength * 8
#Pre-processing
padding = b'\x80'
while ((bytelength + len(padding)) * 8) % 512 != 448:
padding += b'\x00'
padding += big_endian_64_bit( ml )
return padding
def SHA1_LE(old_hh, wanna_be, length):
if (len(wanna_be + pad(length)) * 8) % 512 != 0:
hh = -1
else:
#Initialize variable:
h0 = (old_hh & (mask << 128)) >> 128
h1 = (old_hh & (mask << 96)) >> 96
h2 = (old_hh & (mask << 64)) >> 64
h3 = (old_hh & (mask << 32)) >> 32
h4 = old_hh & mask
ml = length * 8
#Pre-processing
message = wanna_be + pad(length)
#Process the message in successive 512-bit chunks:
chunks = [message[i:i+64] for i in range(0, len(message), 64)]
for chunk in chunks:
w = [chunk[i:i+4] for i in range(0, 64, 4)]
#Message schedule: extend the sixteen 32-bit words into eighty 32-bit words:
for i in range(16, 80):
#Note 3: SHA-0 differs by not having this leftrotate.
w += [leftrotate( XOR(w[i-3], w[i-8], w[i-14], w[i-16]), 1 )]
#Initialize hash value for this chunk:
a = h0
b = h1
c = h2
d = h3
e = h4
#Main loop:
for i in range(80):
f = 0
k = 0
if i in range(20):
f = (b & c) | ((b ^ mask) & d)
k = 0x5A827999
elif i in range(20,40):
f = b ^ c ^ d
k = 0x6ED9EBA1
elif i in range(40,60):
f = (b & c) | (b & d) | (c & d)
k = 0x8F1BBCDC
elif i in range(60,80):
f = b ^ c ^ d
k = 0xCA62C1D6
temp = (leftrotate(a, 5) + f + e + k + bytes2int(w[i])) % (2**32)
e = d
d = c
c = leftrotate(b, 30)
b = a
a = temp
#Add this chunk's hash to result so far:
h0 = (h0 + a) % (2**32)
h1 = (h1 + b) % (2**32)
h2 = (h2 + c) % (2**32)
h3 = (h3 + d) % (2**32)
h4 = (h4 + e) % (2**32)
#Produce the final hash value (big-endian) as a 160-bit number:
hh = (h0 << 128) | (h1 << 96) | (h2 << 64) | (h3 << 32) | h4
return hh
def main():
print('========= A user is granting access to the server =========')
#user has this message
mes = b'comment1=cooking%20MCs;userdata=foo;comment2=%20like%20a%20pound%20of%20bacon'
#user sign it with a common key shared with the server
old_hh = SHA1(key + mes)
#user use the message and its signature to the server
valid = isValid(mes, old_hh)
if valid:
print('Welcome back!')
else:
print('Invalid signature, please check your information again.')
print('\n========= And an attack has retrieve the user\'s message and corresponding hash =========')
print(mes)
print(hex(old_hh).replace('0x','').rjust(40,'0'))
print('\nNow he will implement the length extension attack on SHA-1 to make a new valid message')
print('with signature without any knowledge of the secret key itself...')
wanna_be = b';admin=true'
keyl = -1
message = b''
hh = -1
while not isValid(message, hh):
keyl += 1
message = mes + pad(keyl + len(mes)) + wanna_be
hh = SHA1_LE(old_hh, wanna_be, keyl + len(message))
print('\nFINALLY!!!!!!!!!!!')
print('Keyl = ' + str(keyl))
print(message)
print(hex(SHA1(key + message)).replace('0x','').rjust(40,'0')) #for demonstration purpose only
print(hex(hh).replace('0x','').rjust(40,'0'))
if __name__ == '__main__':
main()
|
mask = 4294967295
key = b'SuPeR_sEcReT_kEy,_NoT_tO_bE_gUeSsEd_So_EaSiLy'
def big_endian_64_bit(num):
num = hex(num).replace('0x', '').rjust(16, '0')
return bytes([int(num[i:i + 2], 16) for i in range(0, len(num), 2)])
def leftrot(num):
return (num << 1 & mask) + (num >> 31)
def bytes2int(block):
return sum([block[len(block) - 1 - i] * 256 ** i for i in range(len(block))])
def leftrotate(num, offset):
num_type = type(num)
if num_type == bytes:
num = bytes2int(num)
for i in range(offset):
num = leftrot(num)
if num_type == bytes:
num = big_endian_64_bit(num)[4:]
return num
def xor(block1, block2, block3, block4):
return bytes([x ^ y ^ z ^ t for (x, y, z, t) in zip(block1, block2, block3, block4)])
def sha1(message):
h0 = 1732584193
h1 = 4023233417
h2 = 2562383102
h3 = 271733878
h4 = 3285377520
ml = len(message) * 8
message += b'\x80'
while len(message) * 8 % 512 != 448:
message += b'\x00'
message += big_endian_64_bit(ml % 2 ** 64)
chunks = [message[i:i + 64] for i in range(0, len(message), 64)]
for chunk in chunks:
w = [chunk[i:i + 4] for i in range(0, 64, 4)]
for i in range(16, 80):
w += [leftrotate(xor(w[i - 3], w[i - 8], w[i - 14], w[i - 16]), 1)]
a = h0
b = h1
c = h2
d = h3
e = h4
for i in range(80):
f = 0
k = 0
if i in range(20):
f = b & c | (b ^ mask) & d
k = 1518500249
elif i in range(20, 40):
f = b ^ c ^ d
k = 1859775393
elif i in range(40, 60):
f = b & c | b & d | c & d
k = 2400959708
elif i in range(60, 80):
f = b ^ c ^ d
k = 3395469782
temp = (leftrotate(a, 5) + f + e + k + bytes2int(w[i])) % 2 ** 32
e = d
d = c
c = leftrotate(b, 30)
b = a
a = temp
h0 = (h0 + a) % 2 ** 32
h1 = (h1 + b) % 2 ** 32
h2 = (h2 + c) % 2 ** 32
h3 = (h3 + d) % 2 ** 32
h4 = (h4 + e) % 2 ** 32
hh = h0 << 128 | h1 << 96 | h2 << 64 | h3 << 32 | h4
return hh
def is_valid(message, hh):
res = False
if sha1(key + message) == hh:
res = True
return res
def pad(bytelength):
ml = bytelength * 8
padding = b'\x80'
while (bytelength + len(padding)) * 8 % 512 != 448:
padding += b'\x00'
padding += big_endian_64_bit(ml)
return padding
def sha1_le(old_hh, wanna_be, length):
if len(wanna_be + pad(length)) * 8 % 512 != 0:
hh = -1
else:
h0 = (old_hh & mask << 128) >> 128
h1 = (old_hh & mask << 96) >> 96
h2 = (old_hh & mask << 64) >> 64
h3 = (old_hh & mask << 32) >> 32
h4 = old_hh & mask
ml = length * 8
message = wanna_be + pad(length)
chunks = [message[i:i + 64] for i in range(0, len(message), 64)]
for chunk in chunks:
w = [chunk[i:i + 4] for i in range(0, 64, 4)]
for i in range(16, 80):
w += [leftrotate(xor(w[i - 3], w[i - 8], w[i - 14], w[i - 16]), 1)]
a = h0
b = h1
c = h2
d = h3
e = h4
for i in range(80):
f = 0
k = 0
if i in range(20):
f = b & c | (b ^ mask) & d
k = 1518500249
elif i in range(20, 40):
f = b ^ c ^ d
k = 1859775393
elif i in range(40, 60):
f = b & c | b & d | c & d
k = 2400959708
elif i in range(60, 80):
f = b ^ c ^ d
k = 3395469782
temp = (leftrotate(a, 5) + f + e + k + bytes2int(w[i])) % 2 ** 32
e = d
d = c
c = leftrotate(b, 30)
b = a
a = temp
h0 = (h0 + a) % 2 ** 32
h1 = (h1 + b) % 2 ** 32
h2 = (h2 + c) % 2 ** 32
h3 = (h3 + d) % 2 ** 32
h4 = (h4 + e) % 2 ** 32
hh = h0 << 128 | h1 << 96 | h2 << 64 | h3 << 32 | h4
return hh
def main():
print('========= A user is granting access to the server =========')
mes = b'comment1=cooking%20MCs;userdata=foo;comment2=%20like%20a%20pound%20of%20bacon'
old_hh = sha1(key + mes)
valid = is_valid(mes, old_hh)
if valid:
print('Welcome back!')
else:
print('Invalid signature, please check your information again.')
print("\n========= And an attack has retrieve the user's message and corresponding hash =========")
print(mes)
print(hex(old_hh).replace('0x', '').rjust(40, '0'))
print('\nNow he will implement the length extension attack on SHA-1 to make a new valid message')
print('with signature without any knowledge of the secret key itself...')
wanna_be = b';admin=true'
keyl = -1
message = b''
hh = -1
while not is_valid(message, hh):
keyl += 1
message = mes + pad(keyl + len(mes)) + wanna_be
hh = sha1_le(old_hh, wanna_be, keyl + len(message))
print('\nFINALLY!!!!!!!!!!!')
print('Keyl = ' + str(keyl))
print(message)
print(hex(sha1(key + message)).replace('0x', '').rjust(40, '0'))
print(hex(hh).replace('0x', '').rjust(40, '0'))
if __name__ == '__main__':
main()
|
# DOCUMENTATION
# main
def main():
canadian = {"red", "white"}
british = {"red", "blue", "white"}
italian = {"red", "white", "green"}
if canadian.issubset(british):
print("canadian flag colours occur in british")
if not italian.issubset(british):
print("not all italian flag colors occur in british")
french = {"red", "white", "blue"}
if french == british:
print("all colors in french occur in british")
french.add("transparent")
print(french)
french.discard("transparent")
print(french)
print(canadian.union(italian))
print(british.intersection(italian))
print(british.difference(italian))
try:
french.remove("waldo")
except Exception:
print("waldo not found")
print(french.clear())
# PROGRAM RUN
if __name__ == "__main__":
main()
|
def main():
canadian = {'red', 'white'}
british = {'red', 'blue', 'white'}
italian = {'red', 'white', 'green'}
if canadian.issubset(british):
print('canadian flag colours occur in british')
if not italian.issubset(british):
print('not all italian flag colors occur in british')
french = {'red', 'white', 'blue'}
if french == british:
print('all colors in french occur in british')
french.add('transparent')
print(french)
french.discard('transparent')
print(french)
print(canadian.union(italian))
print(british.intersection(italian))
print(british.difference(italian))
try:
french.remove('waldo')
except Exception:
print('waldo not found')
print(french.clear())
if __name__ == '__main__':
main()
|
# @desc Predict the returned value
# @desc by Savonnah '23
def calc(num):
if num <= 10:
result = num * 2
else:
result = num * 10
return result
def main():
print(calc(1))
print(calc(41))
print(calc(-5))
print(calc(3))
print(calc(10))
if __name__ == '__main__':
main()
|
def calc(num):
if num <= 10:
result = num * 2
else:
result = num * 10
return result
def main():
print(calc(1))
print(calc(41))
print(calc(-5))
print(calc(3))
print(calc(10))
if __name__ == '__main__':
main()
|
### PROBLEM 3
degF = 40.5
degC = (5/9) * (degF - 32)
print(degC)
#when degF is -40.0, degC is -40.0
##when degF is 40.5, degC is 4.72
|
deg_f = 40.5
deg_c = 5 / 9 * (degF - 32)
print(degC)
|
#
# @lc app=leetcode id=1290 lang=python3
#
# [1290] Convert Binary Number in a Linked List to Integer
#
# @lc code=start
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def getDecimalValue(self, head: ListNode) -> int:
decimal = 0
while head:
decimal <<= 1
decimal |= head.val
head = head.next
return decimal
# @lc code=end
|
class Solution:
def get_decimal_value(self, head: ListNode) -> int:
decimal = 0
while head:
decimal <<= 1
decimal |= head.val
head = head.next
return decimal
|
#!/usr/bin/python3
def palindrome(num):
if num == num[::-1]:
return True
return False
def addOne(num):
num = int(num) + 1
return str(num)
def isPalindrome(num):
num = str(num)
num = num.zfill(6)
value = palindrome(num[2:])
if value:
num = num.zfill(6)
value2 = palindrome(num[1:])
if value2:
num = num.zfill(6)
value3 = palindrome(num[1:-2])
if value3:
num = num.zfill(6)
value4 = palindrome(num)
if value4:
return True
return False
resultList = []
for i in range(1, 999996):
result = isPalindrome(i)
if result:
resultList.append(i)
print(resultList)
|
def palindrome(num):
if num == num[::-1]:
return True
return False
def add_one(num):
num = int(num) + 1
return str(num)
def is_palindrome(num):
num = str(num)
num = num.zfill(6)
value = palindrome(num[2:])
if value:
num = num.zfill(6)
value2 = palindrome(num[1:])
if value2:
num = num.zfill(6)
value3 = palindrome(num[1:-2])
if value3:
num = num.zfill(6)
value4 = palindrome(num)
if value4:
return True
return False
result_list = []
for i in range(1, 999996):
result = is_palindrome(i)
if result:
resultList.append(i)
print(resultList)
|
a = int(input())
b = int(a/5)
if (a%5 == 0):
print(b)
else:
print(b+1)
|
a = int(input())
b = int(a / 5)
if a % 5 == 0:
print(b)
else:
print(b + 1)
|
# Day8 of my 100DaysOfCode Challenge
# Program to open a file in append mode
file = open('Day8/new.txt', 'a')
file.write("This is a really great experience")
file.close()
|
file = open('Day8/new.txt', 'a')
file.write('This is a really great experience')
file.close()
|
#!/usr/bin/python
def max_in_list(list_of_numbers):
'''
Finds the largest number in a list
'''
biggest_num = 0
for i in list_of_numbers:
if i > biggest_num:
biggest_num = i
return(biggest_num)
|
def max_in_list(list_of_numbers):
"""
Finds the largest number in a list
"""
biggest_num = 0
for i in list_of_numbers:
if i > biggest_num:
biggest_num = i
return biggest_num
|
{
"targets":[
{
"target_name": "accessor",
"sources": ["accessor.cpp"]
}
]
}
|
{'targets': [{'target_name': 'accessor', 'sources': ['accessor.cpp']}]}
|
# terrascript/data/Trois-Six/sendgrid.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:26:45 UTC)
__all__ = []
|
__all__ = []
|
__author__ = 'arobres, jfernandez'
# PUPPET WRAPPER CONFIGURATION
PUPPET_MASTER_PROTOCOL = 'https'
PUPPET_WRAPPER_IP = 'puppet-master.dev-havana.fi-ware.org'
PUPPET_WRAPPER_PORT = 8443
PUPPET_MASTER_USERNAME = 'root'
PUPPET_MASTER_PWD = '**********'
PUPPET_WRAPPER_MONGODB_PORT = 27017
PUPPET_WRAPPER_MONGODB_DB_NAME = 'puppetWrapper'
PUPPET_WRAPPER_MONGODB_COLLECTION = 'nodes'
#AUTHENTICATION
CONFIG_KEYSTONE_URL = 'http://130.206.80.57:4731/v2.0/tokens'
CONFIG_KEYSTONE_TENANT_NAME_VALUE = '**********'
CONFIG_KEYSTONE_USERNAME_VALUE = '**********'
CONFIG_KEYSTONE_PWD_VALUE = '**********'
|
__author__ = 'arobres, jfernandez'
puppet_master_protocol = 'https'
puppet_wrapper_ip = 'puppet-master.dev-havana.fi-ware.org'
puppet_wrapper_port = 8443
puppet_master_username = 'root'
puppet_master_pwd = '**********'
puppet_wrapper_mongodb_port = 27017
puppet_wrapper_mongodb_db_name = 'puppetWrapper'
puppet_wrapper_mongodb_collection = 'nodes'
config_keystone_url = 'http://130.206.80.57:4731/v2.0/tokens'
config_keystone_tenant_name_value = '**********'
config_keystone_username_value = '**********'
config_keystone_pwd_value = '**********'
|
'''
A simple programme to print hex grid on terminal screen.
Tip: I have used `raw` strings.
Author: Sunil Dhaka
'''
GRID_WIDTH=20
GRID_HEIGHT=16
def main():
for _ in range(GRID_HEIGHT):
for _ in range(GRID_WIDTH):
print(r'/ \_',end='')
print()
for _ in range(GRID_WIDTH):
print(r'\_/ ',end='')
print()
if __name__=='__main__':
main()
|
"""
A simple programme to print hex grid on terminal screen.
Tip: I have used `raw` strings.
Author: Sunil Dhaka
"""
grid_width = 20
grid_height = 16
def main():
for _ in range(GRID_HEIGHT):
for _ in range(GRID_WIDTH):
print('/ \\_', end='')
print()
for _ in range(GRID_WIDTH):
print('\\_/ ', end='')
print()
if __name__ == '__main__':
main()
|
'''
Order the following functions by asymptotic growth rate.
4nlog n+2n 210 2log n
3n+100log n 4n 2n
n2 +10n n3 nlog n
'''
'''
2^10 O(1)
3n+100log(n) O(log(n))
4n O(n)
4nlog(n)+2n and O(nlog(n))
n^2+10n and O(n^2)
n^3 O(n^3)
2^(log(n)) O(2^(log(n)))
2^n O(2^n)
'''
|
"""
Order the following functions by asymptotic growth rate.
4nlog n+2n 210 2log n
3n+100log n 4n 2n
n2 +10n n3 nlog n
"""
'\n2^10 O(1)\n3n+100log(n) O(log(n))\n4n O(n)\n4nlog(n)+2n and O(nlog(n))\nn^2+10n and O(n^2)\nn^3 O(n^3)\n2^(log(n)) O(2^(log(n)))\n2^n O(2^n)\n'
|
# encoding = utf-8
class GreekGetter:
def get(self, msgid):
return msgid[::-1]
class EnglishGetter:
def get(self, msgid):
return msgid[:]
def get_localizer(language="English"):
languages = dict(English=EnglishGetter, Greek=GreekGetter)
return languages[language]()
# Create our localizers
e, g = get_localizer("English"), get_localizer("Greek")
# Localize some text
print([(e.get(msgid), g.get(msgid)) for msgid in "dog parrot cat bear".split()])
|
class Greekgetter:
def get(self, msgid):
return msgid[::-1]
class Englishgetter:
def get(self, msgid):
return msgid[:]
def get_localizer(language='English'):
languages = dict(English=EnglishGetter, Greek=GreekGetter)
return languages[language]()
(e, g) = (get_localizer('English'), get_localizer('Greek'))
print([(e.get(msgid), g.get(msgid)) for msgid in 'dog parrot cat bear'.split()])
|
print("Enter the number of terms:")
n=int(input())
a=0
b=1
for i in range(n+1):
c=a+b
a=b
b=c
print(c,end=" ")
|
print('Enter the number of terms:')
n = int(input())
a = 0
b = 1
for i in range(n + 1):
c = a + b
a = b
b = c
print(c, end=' ')
|
class Foo:
def __init__(self):
self.tmp = False
def extract_method(self, condition1, condition2, condition3, condition4):
list = (1, 2, 3)
a = 6
b = False
if a in list or self.tmp:
if condition1:
print(condition1)
if b is not condition2:
print(b)
else:
self.bar(condition3, condition4)
def bar(self, condition3_new, condition4_new):
self.tmp2 = True
if condition3_new:
print(condition3_new)
if condition4_new:
print(condition4_new)
print("misterious extract method test")
f = Foo()
f.extract_method(True, True, True, True)
|
class Foo:
def __init__(self):
self.tmp = False
def extract_method(self, condition1, condition2, condition3, condition4):
list = (1, 2, 3)
a = 6
b = False
if a in list or self.tmp:
if condition1:
print(condition1)
if b is not condition2:
print(b)
else:
self.bar(condition3, condition4)
def bar(self, condition3_new, condition4_new):
self.tmp2 = True
if condition3_new:
print(condition3_new)
if condition4_new:
print(condition4_new)
print('misterious extract method test')
f = foo()
f.extract_method(True, True, True, True)
|
# Escape Sequences
# \\
# \'
# \"
# \n
course_name = "Pyton Mastery \n with Mosh"
print(course_name)
|
course_name = 'Pyton Mastery \n with Mosh'
print(course_name)
|
class VolumeRaidLevels(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_lun_raid_type(idx_name)
class VolumeRaidLevelsColumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_luns()
|
class Volumeraidlevels(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_lun_raid_type(idx_name)
class Volumeraidlevelscolumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_luns()
|
NORTH = 0
EAST = 1
SOUTH = 2
WEST = 3
X_MOD = [0,1,0,-1]
Y_MOD = [1,0,-1,0]
num_states = 0
state_trans = []
infected_state = 0
class Node:
def __init__(self, state, x, y):
self.x = x
self.y = y
self.state = state
def updateDir(self, dir):
'''
Directions can be anything from 0 to 3
trans state tells us where to jump to based
on the current state
'''
dir = (dir + state_trans[self.state]) % 4
return dir
def updateState(self):
'''
states always increment and are bounded by max # states
'''
self.state = ((self.state) + 1) % num_states
return self.state
def getNextNode(self, dir, nodes):
'''
based on direction an current position, find the next node
if we've never seen it before, create it
'''
x = self.x + X_MOD[dir]
y = self.y + Y_MOD[dir]
name = 'x%dy%d' % (x,y)
if not name in nodes:
nodes[name] = Node(0,x,y)
return nodes[name]
def update(self, dir, nodes):
'''
determine new direction, state and node
return
1) if we infected the node
2) the next node to process
3) the direction we are facing on the next node
'''
dir = self.updateDir(dir)
self.updateState()
return (self.state == infected_state), self.getNextNode(dir, nodes), dir
def solveInfected(lines, iterations):
'''
cretes the base list of nodes based on input
then determine how many infections occur
'''
nodes = {}
startx = (len(lines[0].strip()) // 2)
starty = (len(lines) // 2) * -1
startname = 'x%dy%d' % (startx, starty)
y = 0
for line in lines:
x = 0
for c in line.strip():
name = 'x%dy%d' % (x,y)
if c == '#':
nodes[name] = Node(infected_state,x,y)
else:
nodes[name] = Node(0,x,y)
x += 1
y -= 1
node = nodes[startname]
infect_count = 0
dir = NORTH
for i in range(iterations):
infected, node, dir = node.update(dir, nodes)
if infected:
infect_count += 1
print(infect_count)
with open("input") as f:
lines = f.readlines()
# for part 1, two states
# state 0, CLEAN, causes a right turn
# state 1, INFECTED, causes a left turn (or 3 right turns)
num_states = 2
state_trans = [3, 1]
infected_state = 1
solveInfected(lines, 10000)
# for part 2, fpir states
# state 0, CLEAN, causes a right turn
# state 1, WEAKENED, does not turn
# state 2, INFECTED, causes a left turn (or 3 right turns)
# state 3, FLAGGED, causes a turn around (or 2 right turns)
num_states = 4
state_trans = [3, 0, 1, 2]
infected_state = 2
solveInfected(lines, 10000000)
|
north = 0
east = 1
south = 2
west = 3
x_mod = [0, 1, 0, -1]
y_mod = [1, 0, -1, 0]
num_states = 0
state_trans = []
infected_state = 0
class Node:
def __init__(self, state, x, y):
self.x = x
self.y = y
self.state = state
def update_dir(self, dir):
"""
Directions can be anything from 0 to 3
trans state tells us where to jump to based
on the current state
"""
dir = (dir + state_trans[self.state]) % 4
return dir
def update_state(self):
"""
states always increment and are bounded by max # states
"""
self.state = (self.state + 1) % num_states
return self.state
def get_next_node(self, dir, nodes):
"""
based on direction an current position, find the next node
if we've never seen it before, create it
"""
x = self.x + X_MOD[dir]
y = self.y + Y_MOD[dir]
name = 'x%dy%d' % (x, y)
if not name in nodes:
nodes[name] = node(0, x, y)
return nodes[name]
def update(self, dir, nodes):
"""
determine new direction, state and node
return
1) if we infected the node
2) the next node to process
3) the direction we are facing on the next node
"""
dir = self.updateDir(dir)
self.updateState()
return (self.state == infected_state, self.getNextNode(dir, nodes), dir)
def solve_infected(lines, iterations):
"""
cretes the base list of nodes based on input
then determine how many infections occur
"""
nodes = {}
startx = len(lines[0].strip()) // 2
starty = len(lines) // 2 * -1
startname = 'x%dy%d' % (startx, starty)
y = 0
for line in lines:
x = 0
for c in line.strip():
name = 'x%dy%d' % (x, y)
if c == '#':
nodes[name] = node(infected_state, x, y)
else:
nodes[name] = node(0, x, y)
x += 1
y -= 1
node = nodes[startname]
infect_count = 0
dir = NORTH
for i in range(iterations):
(infected, node, dir) = node.update(dir, nodes)
if infected:
infect_count += 1
print(infect_count)
with open('input') as f:
lines = f.readlines()
num_states = 2
state_trans = [3, 1]
infected_state = 1
solve_infected(lines, 10000)
num_states = 4
state_trans = [3, 0, 1, 2]
infected_state = 2
solve_infected(lines, 10000000)
|
class Node:
def __init__(self, data=None, next_node=None):
self.data = data
self.next_node = next_node
def __str__(self):
p = self
nums = []
while p:
nums.append(p.data)
p = p.next_node
return "[" + ", ".join(map(str, nums)) + "]"
@staticmethod
def list_to_LL(L):
"""
Converts the given Python list into a linked list.
"""
head = None
for i in range(len(L) - 1, -1, -1):
head = Node(L[i], head)
return head
def reverse_list(head):
#---------------------------------------------------------------------------
# Method 1: Recursive.
#---------------------------------------------------------------------------
# if head:
# new_head = reverse_list(head.next_node)
# # Right now, head.next_node is the tail of the sublist.
# # We need the sublist's tail to be the (old) head instead.
# if new_head:
# head.next_node.next_node = head
# head.next_node = None
# return new_head
# return head # Linked list is just one node.
# return None # Linked list is empty.
#---------------------------------------------------------------------------
# Method 2: Tail recursive (the recursive call is at the end).
#---------------------------------------------------------------------------
# In languages other than Python, the compiler uses tail call optimization.
# So for each recursive call, we can simply reuse the current stack frame.
# It's also easy to convert tail recursive to iterative.
#---------------------------------------------------------------------------
# return tail_recurse(None, head)
#---------------------------------------------------------------------------
# Method 3: Iterative.
#---------------------------------------------------------------------------
prev = None
while head:
head.next_node, prev, head = prev, head, head.next_node
return prev
def tail_recurse(prev, curr):
"""
Using tail recursion, reverses the linked list starting at curr, then joins
the end of this linked list to the linked list starting at prev.
"""
if curr:
new_curr = curr.next_node
if new_curr:
curr.next_node = prev
return tail_recurse(curr, new_curr)
# We've reached the end.
curr.next_node = prev
return curr
return None # Linked list is empty/
if __name__ == "__main__":
testHeads = [
Node.list_to_LL([]),
Node.list_to_LL([1]),
Node.list_to_LL([1, 2]),
Node.list_to_LL([1, 2, 3]),
Node.list_to_LL([1, 2, 3, 4])
]
for (index, head) in enumerate(testHeads):
print("Test List #{}:".format(index + 1))
print(" BEFORE: {}".format(head))
head = reverse_list(head)
print(" AFTER: {}".format(head))
|
class Node:
def __init__(self, data=None, next_node=None):
self.data = data
self.next_node = next_node
def __str__(self):
p = self
nums = []
while p:
nums.append(p.data)
p = p.next_node
return '[' + ', '.join(map(str, nums)) + ']'
@staticmethod
def list_to_ll(L):
"""
Converts the given Python list into a linked list.
"""
head = None
for i in range(len(L) - 1, -1, -1):
head = node(L[i], head)
return head
def reverse_list(head):
prev = None
while head:
(head.next_node, prev, head) = (prev, head, head.next_node)
return prev
def tail_recurse(prev, curr):
"""
Using tail recursion, reverses the linked list starting at curr, then joins
the end of this linked list to the linked list starting at prev.
"""
if curr:
new_curr = curr.next_node
if new_curr:
curr.next_node = prev
return tail_recurse(curr, new_curr)
curr.next_node = prev
return curr
return None
if __name__ == '__main__':
test_heads = [Node.list_to_LL([]), Node.list_to_LL([1]), Node.list_to_LL([1, 2]), Node.list_to_LL([1, 2, 3]), Node.list_to_LL([1, 2, 3, 4])]
for (index, head) in enumerate(testHeads):
print('Test List #{}:'.format(index + 1))
print(' BEFORE: {}'.format(head))
head = reverse_list(head)
print(' AFTER: {}'.format(head))
|
# uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: pirates.makeapirate.MakeAPirateGlobals
BODYSHOP = 0
HEADSHOP = 1
MOUTHSHOP = 2
EYESSHOP = 3
NOSESHOP = 4
EARSHOP = 5
HAIRSHOP = 6
CLOTHESSHOP = 7
NAMESHOP = 8
TATTOOSHOP = 9
JEWELRYSHOP = 10
AVATAR_PIRATE = 0
AVATAR_SKELETON = 1
AVATAR_NAVY = 2
AVATAR_CAST = 3
ShopNames = [
'BodyShop', 'HeadShop', 'MouthShop', 'EyesShop', 'NoseShop', 'EarShop', 'HairShop', 'ClothesShop', 'NameShop', 'TattooShop', 'JewelryShop']
LODList = [
2000, 1000, 500]
AnimList = [
'idle', 'attention', 'axe_chop_idle', 'axe_chop_look_idle', 'bar_talk01_idle', 'bar_talk01_into_look', 'bar_talk01_look_idle', 'bar_talk01_outof_look', 'bar_talk02_idle', 'bar_talk02_into_look', 'bar_talk02_look_idle', 'bar_talk02_outof_look', 'bar_wipe', 'bar_wipe_into_look', 'bar_wipe_look_idle', 'bar_wipe_outof_look', 'bar_write_idle', 'bar_write_into_look', 'bar_write_look_idle', 'bar_write_outof_look', 'barrel_hide_idle', 'barrel_hide_into_look', 'barrel_hide_look_idle', 'barrel_hide_outof_look', 'bayonet_attackA', 'bayonet_attackB', 'bayonet_attackC', 'bayonet_attack_idle', 'bayonet_attack_walk', 'bayonet_drill', 'bayonet_fall_ground', 'bayonet_idle', 'bayonet_idle_to_fight_idle', 'bayonet_jump', 'bayonet_run', 'bayonet_turn_left', 'bayonet_turn_right', 'bayonet_walk', 'bigbomb_charge', 'bigbomb_charge_loop', 'bigbomb_charge_throw', 'bigbomb_draw', 'bigbomb_idle', 'bigbomb_throw', 'bigbomb_walk', 'bigbomb_walk_left', 'bigbomb_walk_left_diagonal', 'bigbomb_walk_right', 'bigbomb_walk_right_diagonal', 'bindPose', 'blacksmith_work_idle', 'blacksmith_work_into_look', 'blacksmith_work_look_idle', 'blacksmith_work_outof_look', 'blunderbuss_reload', 'board', 'bomb_charge', 'bomb_charge_loop', 'bomb_charge_throw', 'bomb_draw', 'bomb_hurt', 'bomb_idle', 'bomb_receive', 'bomb_throw', 'boxing_fromidle', 'boxing_haymaker', 'boxing_hit_head_right', 'boxing_idle', 'boxing_idle_alt', 'boxing_kick', 'boxing_punch', 'broadsword_combo', 'cards_bad_tell', 'cards_bet', 'cards_blackjack_hit', 'cards_blackjack_stay', 'cards_cheat', 'cards_check', 'cards_good_tell', 'cards_hide', 'cards_hide_hit', 'cards_hide_idle', 'cards_pick_up', 'cards_pick_up_idle', 'cards_set_down', 'cards_set_down_lose', 'cards_set_down_win', 'cards_set_down_win_show', 'cargomaster_work_idle', 'cargomaster_work_into_look', 'cargomaster_work_look_idle', 'cargomaster_work_outof_look', 'chant_a_idle', 'chant_b_idle', 'chest_idle', 'chest_kneel_to_steal', 'chest_putdown', 'chest_steal', 'chest_strafe_left', 'chest_strafe_right', 'chest_walk', 'coin_flip_idle', 'coin_flip_look_idle', 'coin_flip_old_idle', 'cower_idle', 'cower_into', 'cower_outof', 'crazy_idle', 'crazy_look_idle', 'cutlass_attention', 'cutlass_bladestorm', 'cutlass_combo', 'cutlass_headbutt', 'cutlass_hurt', 'cutlass_kick', 'cutlass_multihit', 'cutlass_sweep', 'cutlass_taunt', 'cutlass_walk_navy', 'dagger_asp', 'dagger_backstab', 'dagger_combo', 'dagger_coup', 'dagger_hurt', 'dagger_receive', 'dagger_throw_combo', 'dagger_throw_sand', 'dagger_vipers_nest', 'deal', 'deal_idle', 'deal_left', 'deal_right', 'death', 'death2', 'death3', 'death4', 'doctor_work_idle', 'doctor_work_into_look', 'doctor_work_look_idle', 'doctor_work_outof_look', 'drink_potion', 'dualcutlass_combo', 'dualcutlass_draw', 'dualcutlass_idle', 'emote_anger', 'emote_blow_kiss', 'emote_celebrate', 'emote_clap', 'emote_coin_toss', 'emote_crazy', 'emote_cut_throat', 'emote_dance_jig', 'emote_duhhh', 'emote_embarrassed', 'emote_face_smack', 'emote_fear', 'emote_flex', 'emote_flirt', 'emote_hand_it_over', 'emote_head_scratch', 'emote_laugh', 'emote_navy_scared', 'emote_navy_wants_fight', 'emote_nervous', 'emote_newyears', 'emote_no', 'emote_sad', 'emote_sassy', 'emote_scared', 'emote_show_me_the_money', 'emote_shrug', 'emote_sincere_thanks', 'emote_smile', 'emote_snarl', 'emote_talk_to_the_hand', 'emote_thriller', 'emote_wave', 'emote_wink', 'emote_yawn', 'emote_yes', 'fall_ground', 'flute_idle', 'flute_look_idle', 'foil_coup', 'foil_hack', 'foil_idle', 'foil_kick', 'foil_slash', 'foil_thrust', 'friend_pose', 'gun_aim_idle', 'gun_draw', 'gun_fire', 'gun_hurt', 'gun_pointedup_idle', 'gun_putaway', 'gun_reload', 'gun_strafe_left', 'hand_curse_check', 'hand_curse_get_sword', 'hand_curse_reaction', 'idle_B_shiftWeight', 'idle_butt_scratch', 'idle_flex', 'idle_handhip', 'idle_handhip_from_idle', 'idle_head_scratch', 'idle_head_scratch_side', 'idle_hit', 'idle_sit', 'idle_sit_alt', 'idle_yawn', 'injured_fall', 'injured_healing_into', 'injured_healing_loop', 'injured_healing_outof', 'injured_idle', 'injured_idle_shakehead', 'injured_standup', 'into_deal', 'jail_dropinto', 'jail_idle', 'jail_standup', 'jump', 'jump_idle', 'kick_door', 'kick_door_loop', 'kneel', 'kneel_fromidle', 'knife_throw', 'kraken_fight_idle', 'kraken_struggle_idle', 'left_face', 'loom_idle', 'loom_into_look', 'loom_look_idle', 'loom_outof_look', 'lute_idle', 'lute_into_look', 'lute_look_idle', 'lute_outof_look', 'map_head_into_look_left', 'map_head_look_left_idle', 'map_head_outof_look_left', 'map_look_arm_left', 'map_look_arm_right', 'map_look_boot_left', 'map_look_boot_right', 'map_look_pant_right', 'march', 'patient_work_idle', 'primp_idle', 'primp_into_look', 'primp_look_idle', 'primp_outof_look', 'repair_bench', 'repairfloor_idle', 'repairfloor_into', 'repairfloor_outof', 'rifle_fight_forward_diagonal_left', 'rifle_fight_forward_diagonal_right', 'rifle_fight_idle', 'rifle_fight_run_strafe_left', 'rifle_fight_run_strafe_right', 'rifle_fight_shoot_high', 'rifle_fight_shoot_high_idle', 'rifle_fight_shoot_hip', 'rifle_fight_walk', 'rifle_fight_walk_back_diagonal_left', 'rifle_fight_walk_back_diagonal_right', 'rifle_fight_walk_strafe_left', 'rifle_fight_walk_strafe_right', 'rifle_idle_to_fight_idle', 'rifle_reload_hip', 'rigging_climb', 'rigTest', 'rope_board', 'rope_dismount', 'rope_grab', 'rope_grab_from_idle', 'run', 'run_diagonal_left', 'run_diagonal_right', 'run_with_weapon', 'sabre_combo', 'sabre_comboA', 'sabre_comboB', 'sand_in_eyes', 'sand_in_eyes_holdweapon_noswing', 'screenshot_pose', 'search_low', 'search_med', 'semi_conscious_loop', 'semi_conscious_standup', 'shovel', 'shovel_idle', 'shovel_idle_into_dig', 'sit', 'sit_cower_idle', 'sit_cower_into_sleep', 'sit_hanginglegs_idle', 'sit_hanginglegs_into_look', 'sit_hanginglegs_look_idle', 'sit_hanginglegs_outof_look', 'sit_idle', 'sit_sleep_idle', 'sit_sleep_into_cower', 'sit_sleep_into_look', 'sit_sleep_look_idle', 'sit_sleep_outof_look', 'sleep_idle', 'sleep_into_look', 'sleep_outof_look', 'sleep_sick_idle', 'sleep_sick_into_look', 'sleep_sick_look_idle', 'sleep_sick_outof_look', 'sow_idle', 'sow_into_look', 'sow_look_idle', 'sow_outof_look', 'spin_left', 'spin_right', 'stir_idle', 'stir_into_look', 'stir_look_idle', 'stir_outof_look', 'stock_idle', 'stock_sleep', 'stock_sleep_to_idle', 'stowaway_get_in_crate', 'strafe_left', 'strafe_right', 'summon_idle', 'sweep', 'sweep_idle', 'sweep_into_look', 'sweep_look_idle', 'sweep_outof_look', 'swim', 'swim_back', 'swim_back_diagonal_left', 'swim_back_diagonal_right', 'swim_into_tread_water', 'swim_left', 'swim_left_diagonal', 'swim_right', 'swim_right_diagonal', 'swing_aboard', 'sword_cleave', 'sword_comboA', 'sword_draw', 'sword_hit', 'sword_idle', 'sword_lunge', 'sword_putaway', 'sword_roll_thrust', 'sword_slash', 'sword_thrust', 'tatoo_idle', 'tatoo_into_look', 'tatoo_look_idle', 'tatoo_outof_look', 'tatoo_receive_idle', 'tatoo_receive_into_look', 'tatoo_receive_look_idle', 'tatoo_receive_outof_look', 'teleport', 'tentacle_idle', 'tentacle_squeeze', 'tread_water', 'tread_water_into_teleport', 'turn_left', 'turn_right', 'voodoo_doll_hurt', 'voodoo_doll_poke', 'voodoo_draw', 'voodoo_idle', 'voodoo_swarm', 'voodoo_tune', 'voodoo_walk', 'walk', 'walk_back_diagonal_left', 'walk_back_diagonal_right', 'wand_cast_fire', 'wand_cast_idle', 'wand_cast_start', 'wand_hurt', 'wand_idle', 'wheel_idle', 'barf', 'burp', 'fart', 'fsh_idle', 'fsh_smallCast', 'fsh_bigCast', 'fsh_smallSuccess', 'fsh_bigSuccess', 'kneel_dizzy', 'mixing_idle']
SkeletonBodyTypes = [
'1', '2', '4', '8', 'djcr', 'djjm', 'djko', 'djpa', 'djtw', 'sp1', 'sp2', 'sp3', 'sp4', 'fr1', 'fr2', 'fr3', 'fr4']
CastBodyTypes = [
'js', 'wt', 'es', 'cb', 'td', 'dj', 'jg', 'jr', 'fl', 'sl']
COMPLECTIONTYPES = {0: [[9, 14, 15, 16, 17, 19], [6]], 1: [[4, 10, 11, 12, 13], [1, 6]], 2: [[5, 6, 7, 8], [0, 1, 3, 5, 6]], 3: [[0, 1, 2, 3], [0, 1, 2, 3, 4, 6]]}
MALE_BODYTYPE_SELECTIONS = [
0, 1, 1, 2, 2, 2, 3, 3, 4, 4]
FEMALE_BODYTYPE_SELECTIONS = [0, 1, 1, 2, 2, 2, 3, 3, 3, 4]
PREFERRED_MALE_HAIR_SELECTIONS = [
1, 2, 5, 6]
PREFERRED_FEMALE_HAIR_SELECTIONS = []
PREFERRED_MALE_BEARD_SELECTIONS = [
1, 2, 3, 4]
MALE_NOSE_RANGES = [
(
-1.0, 1.0), (-1.0, 1.0), (-0.8, 0.5), (-0.5, 0.5), (-1.0, 1.0), (-1.0, 0.7), (-0.7, 0.7), (-0.7, 0.7)]
FEMALE_NOSE_RANGES = [
(
-1.0, 1.0), (-0.7, 0.6), (-0.7, 1.0), (-0.3, 0.3), (-0.5, 0.75), (-1.0, 1.0), (-0.5, 0.5), (-0.5, 0.5)]
|
bodyshop = 0
headshop = 1
mouthshop = 2
eyesshop = 3
noseshop = 4
earshop = 5
hairshop = 6
clothesshop = 7
nameshop = 8
tattooshop = 9
jewelryshop = 10
avatar_pirate = 0
avatar_skeleton = 1
avatar_navy = 2
avatar_cast = 3
shop_names = ['BodyShop', 'HeadShop', 'MouthShop', 'EyesShop', 'NoseShop', 'EarShop', 'HairShop', 'ClothesShop', 'NameShop', 'TattooShop', 'JewelryShop']
lod_list = [2000, 1000, 500]
anim_list = ['idle', 'attention', 'axe_chop_idle', 'axe_chop_look_idle', 'bar_talk01_idle', 'bar_talk01_into_look', 'bar_talk01_look_idle', 'bar_talk01_outof_look', 'bar_talk02_idle', 'bar_talk02_into_look', 'bar_talk02_look_idle', 'bar_talk02_outof_look', 'bar_wipe', 'bar_wipe_into_look', 'bar_wipe_look_idle', 'bar_wipe_outof_look', 'bar_write_idle', 'bar_write_into_look', 'bar_write_look_idle', 'bar_write_outof_look', 'barrel_hide_idle', 'barrel_hide_into_look', 'barrel_hide_look_idle', 'barrel_hide_outof_look', 'bayonet_attackA', 'bayonet_attackB', 'bayonet_attackC', 'bayonet_attack_idle', 'bayonet_attack_walk', 'bayonet_drill', 'bayonet_fall_ground', 'bayonet_idle', 'bayonet_idle_to_fight_idle', 'bayonet_jump', 'bayonet_run', 'bayonet_turn_left', 'bayonet_turn_right', 'bayonet_walk', 'bigbomb_charge', 'bigbomb_charge_loop', 'bigbomb_charge_throw', 'bigbomb_draw', 'bigbomb_idle', 'bigbomb_throw', 'bigbomb_walk', 'bigbomb_walk_left', 'bigbomb_walk_left_diagonal', 'bigbomb_walk_right', 'bigbomb_walk_right_diagonal', 'bindPose', 'blacksmith_work_idle', 'blacksmith_work_into_look', 'blacksmith_work_look_idle', 'blacksmith_work_outof_look', 'blunderbuss_reload', 'board', 'bomb_charge', 'bomb_charge_loop', 'bomb_charge_throw', 'bomb_draw', 'bomb_hurt', 'bomb_idle', 'bomb_receive', 'bomb_throw', 'boxing_fromidle', 'boxing_haymaker', 'boxing_hit_head_right', 'boxing_idle', 'boxing_idle_alt', 'boxing_kick', 'boxing_punch', 'broadsword_combo', 'cards_bad_tell', 'cards_bet', 'cards_blackjack_hit', 'cards_blackjack_stay', 'cards_cheat', 'cards_check', 'cards_good_tell', 'cards_hide', 'cards_hide_hit', 'cards_hide_idle', 'cards_pick_up', 'cards_pick_up_idle', 'cards_set_down', 'cards_set_down_lose', 'cards_set_down_win', 'cards_set_down_win_show', 'cargomaster_work_idle', 'cargomaster_work_into_look', 'cargomaster_work_look_idle', 'cargomaster_work_outof_look', 'chant_a_idle', 'chant_b_idle', 'chest_idle', 'chest_kneel_to_steal', 'chest_putdown', 'chest_steal', 'chest_strafe_left', 'chest_strafe_right', 'chest_walk', 'coin_flip_idle', 'coin_flip_look_idle', 'coin_flip_old_idle', 'cower_idle', 'cower_into', 'cower_outof', 'crazy_idle', 'crazy_look_idle', 'cutlass_attention', 'cutlass_bladestorm', 'cutlass_combo', 'cutlass_headbutt', 'cutlass_hurt', 'cutlass_kick', 'cutlass_multihit', 'cutlass_sweep', 'cutlass_taunt', 'cutlass_walk_navy', 'dagger_asp', 'dagger_backstab', 'dagger_combo', 'dagger_coup', 'dagger_hurt', 'dagger_receive', 'dagger_throw_combo', 'dagger_throw_sand', 'dagger_vipers_nest', 'deal', 'deal_idle', 'deal_left', 'deal_right', 'death', 'death2', 'death3', 'death4', 'doctor_work_idle', 'doctor_work_into_look', 'doctor_work_look_idle', 'doctor_work_outof_look', 'drink_potion', 'dualcutlass_combo', 'dualcutlass_draw', 'dualcutlass_idle', 'emote_anger', 'emote_blow_kiss', 'emote_celebrate', 'emote_clap', 'emote_coin_toss', 'emote_crazy', 'emote_cut_throat', 'emote_dance_jig', 'emote_duhhh', 'emote_embarrassed', 'emote_face_smack', 'emote_fear', 'emote_flex', 'emote_flirt', 'emote_hand_it_over', 'emote_head_scratch', 'emote_laugh', 'emote_navy_scared', 'emote_navy_wants_fight', 'emote_nervous', 'emote_newyears', 'emote_no', 'emote_sad', 'emote_sassy', 'emote_scared', 'emote_show_me_the_money', 'emote_shrug', 'emote_sincere_thanks', 'emote_smile', 'emote_snarl', 'emote_talk_to_the_hand', 'emote_thriller', 'emote_wave', 'emote_wink', 'emote_yawn', 'emote_yes', 'fall_ground', 'flute_idle', 'flute_look_idle', 'foil_coup', 'foil_hack', 'foil_idle', 'foil_kick', 'foil_slash', 'foil_thrust', 'friend_pose', 'gun_aim_idle', 'gun_draw', 'gun_fire', 'gun_hurt', 'gun_pointedup_idle', 'gun_putaway', 'gun_reload', 'gun_strafe_left', 'hand_curse_check', 'hand_curse_get_sword', 'hand_curse_reaction', 'idle_B_shiftWeight', 'idle_butt_scratch', 'idle_flex', 'idle_handhip', 'idle_handhip_from_idle', 'idle_head_scratch', 'idle_head_scratch_side', 'idle_hit', 'idle_sit', 'idle_sit_alt', 'idle_yawn', 'injured_fall', 'injured_healing_into', 'injured_healing_loop', 'injured_healing_outof', 'injured_idle', 'injured_idle_shakehead', 'injured_standup', 'into_deal', 'jail_dropinto', 'jail_idle', 'jail_standup', 'jump', 'jump_idle', 'kick_door', 'kick_door_loop', 'kneel', 'kneel_fromidle', 'knife_throw', 'kraken_fight_idle', 'kraken_struggle_idle', 'left_face', 'loom_idle', 'loom_into_look', 'loom_look_idle', 'loom_outof_look', 'lute_idle', 'lute_into_look', 'lute_look_idle', 'lute_outof_look', 'map_head_into_look_left', 'map_head_look_left_idle', 'map_head_outof_look_left', 'map_look_arm_left', 'map_look_arm_right', 'map_look_boot_left', 'map_look_boot_right', 'map_look_pant_right', 'march', 'patient_work_idle', 'primp_idle', 'primp_into_look', 'primp_look_idle', 'primp_outof_look', 'repair_bench', 'repairfloor_idle', 'repairfloor_into', 'repairfloor_outof', 'rifle_fight_forward_diagonal_left', 'rifle_fight_forward_diagonal_right', 'rifle_fight_idle', 'rifle_fight_run_strafe_left', 'rifle_fight_run_strafe_right', 'rifle_fight_shoot_high', 'rifle_fight_shoot_high_idle', 'rifle_fight_shoot_hip', 'rifle_fight_walk', 'rifle_fight_walk_back_diagonal_left', 'rifle_fight_walk_back_diagonal_right', 'rifle_fight_walk_strafe_left', 'rifle_fight_walk_strafe_right', 'rifle_idle_to_fight_idle', 'rifle_reload_hip', 'rigging_climb', 'rigTest', 'rope_board', 'rope_dismount', 'rope_grab', 'rope_grab_from_idle', 'run', 'run_diagonal_left', 'run_diagonal_right', 'run_with_weapon', 'sabre_combo', 'sabre_comboA', 'sabre_comboB', 'sand_in_eyes', 'sand_in_eyes_holdweapon_noswing', 'screenshot_pose', 'search_low', 'search_med', 'semi_conscious_loop', 'semi_conscious_standup', 'shovel', 'shovel_idle', 'shovel_idle_into_dig', 'sit', 'sit_cower_idle', 'sit_cower_into_sleep', 'sit_hanginglegs_idle', 'sit_hanginglegs_into_look', 'sit_hanginglegs_look_idle', 'sit_hanginglegs_outof_look', 'sit_idle', 'sit_sleep_idle', 'sit_sleep_into_cower', 'sit_sleep_into_look', 'sit_sleep_look_idle', 'sit_sleep_outof_look', 'sleep_idle', 'sleep_into_look', 'sleep_outof_look', 'sleep_sick_idle', 'sleep_sick_into_look', 'sleep_sick_look_idle', 'sleep_sick_outof_look', 'sow_idle', 'sow_into_look', 'sow_look_idle', 'sow_outof_look', 'spin_left', 'spin_right', 'stir_idle', 'stir_into_look', 'stir_look_idle', 'stir_outof_look', 'stock_idle', 'stock_sleep', 'stock_sleep_to_idle', 'stowaway_get_in_crate', 'strafe_left', 'strafe_right', 'summon_idle', 'sweep', 'sweep_idle', 'sweep_into_look', 'sweep_look_idle', 'sweep_outof_look', 'swim', 'swim_back', 'swim_back_diagonal_left', 'swim_back_diagonal_right', 'swim_into_tread_water', 'swim_left', 'swim_left_diagonal', 'swim_right', 'swim_right_diagonal', 'swing_aboard', 'sword_cleave', 'sword_comboA', 'sword_draw', 'sword_hit', 'sword_idle', 'sword_lunge', 'sword_putaway', 'sword_roll_thrust', 'sword_slash', 'sword_thrust', 'tatoo_idle', 'tatoo_into_look', 'tatoo_look_idle', 'tatoo_outof_look', 'tatoo_receive_idle', 'tatoo_receive_into_look', 'tatoo_receive_look_idle', 'tatoo_receive_outof_look', 'teleport', 'tentacle_idle', 'tentacle_squeeze', 'tread_water', 'tread_water_into_teleport', 'turn_left', 'turn_right', 'voodoo_doll_hurt', 'voodoo_doll_poke', 'voodoo_draw', 'voodoo_idle', 'voodoo_swarm', 'voodoo_tune', 'voodoo_walk', 'walk', 'walk_back_diagonal_left', 'walk_back_diagonal_right', 'wand_cast_fire', 'wand_cast_idle', 'wand_cast_start', 'wand_hurt', 'wand_idle', 'wheel_idle', 'barf', 'burp', 'fart', 'fsh_idle', 'fsh_smallCast', 'fsh_bigCast', 'fsh_smallSuccess', 'fsh_bigSuccess', 'kneel_dizzy', 'mixing_idle']
skeleton_body_types = ['1', '2', '4', '8', 'djcr', 'djjm', 'djko', 'djpa', 'djtw', 'sp1', 'sp2', 'sp3', 'sp4', 'fr1', 'fr2', 'fr3', 'fr4']
cast_body_types = ['js', 'wt', 'es', 'cb', 'td', 'dj', 'jg', 'jr', 'fl', 'sl']
complectiontypes = {0: [[9, 14, 15, 16, 17, 19], [6]], 1: [[4, 10, 11, 12, 13], [1, 6]], 2: [[5, 6, 7, 8], [0, 1, 3, 5, 6]], 3: [[0, 1, 2, 3], [0, 1, 2, 3, 4, 6]]}
male_bodytype_selections = [0, 1, 1, 2, 2, 2, 3, 3, 4, 4]
female_bodytype_selections = [0, 1, 1, 2, 2, 2, 3, 3, 3, 4]
preferred_male_hair_selections = [1, 2, 5, 6]
preferred_female_hair_selections = []
preferred_male_beard_selections = [1, 2, 3, 4]
male_nose_ranges = [(-1.0, 1.0), (-1.0, 1.0), (-0.8, 0.5), (-0.5, 0.5), (-1.0, 1.0), (-1.0, 0.7), (-0.7, 0.7), (-0.7, 0.7)]
female_nose_ranges = [(-1.0, 1.0), (-0.7, 0.6), (-0.7, 1.0), (-0.3, 0.3), (-0.5, 0.75), (-1.0, 1.0), (-0.5, 0.5), (-0.5, 0.5)]
|
def bubble_sort(nums: list[float]) -> list[float]:
is_sorted = True
for loop in range(len(nums) - 1):
for indx in range(len(nums) - loop - 1):
if nums[indx] > nums[indx + 1]:
is_sorted = False
nums[indx], nums[indx + 1] = nums[indx + 1], nums[indx]
if is_sorted:
break
return nums
algorithm = bubble_sort
name = 'optimized'
|
def bubble_sort(nums: list[float]) -> list[float]:
is_sorted = True
for loop in range(len(nums) - 1):
for indx in range(len(nums) - loop - 1):
if nums[indx] > nums[indx + 1]:
is_sorted = False
(nums[indx], nums[indx + 1]) = (nums[indx + 1], nums[indx])
if is_sorted:
break
return nums
algorithm = bubble_sort
name = 'optimized'
|
#
# PySNMP MIB module MPLS-LSR-STD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MPLS-LSR-STD-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:43:25 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ValueSizeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsUnion")
AddressFamilyNumbers, = mibBuilder.importSymbols("IANA-ADDRESS-FAMILY-NUMBERS-MIB", "AddressFamilyNumbers")
ifCounterDiscontinuityGroup, InterfaceIndexOrZero, ifGeneralInformationGroup = mibBuilder.importSymbols("IF-MIB", "ifCounterDiscontinuityGroup", "InterfaceIndexOrZero", "ifGeneralInformationGroup")
InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress")
MplsLabel, MplsBitRate, MplsOwner, mplsStdMIB, MplsLSPID = mibBuilder.importSymbols("MPLS-TC-STD-MIB", "MplsLabel", "MplsBitRate", "MplsOwner", "mplsStdMIB", "MplsLSPID")
ObjectGroup, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "NotificationGroup", "ModuleCompliance")
NotificationType, zeroDotZero, MibIdentifier, iso, Bits, ObjectIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, ModuleIdentity, Unsigned32, Counter64, TimeTicks, IpAddress, Counter32, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "NotificationType", "zeroDotZero", "MibIdentifier", "iso", "Bits", "ObjectIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "ModuleIdentity", "Unsigned32", "Counter64", "TimeTicks", "IpAddress", "Counter32", "Gauge32")
TextualConvention, RowStatus, StorageType, RowPointer, TruthValue, DisplayString, TimeStamp = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "RowStatus", "StorageType", "RowPointer", "TruthValue", "DisplayString", "TimeStamp")
mplsLsrStdMIB = ModuleIdentity((1, 3, 6, 1, 2, 1, 10, 166, 2))
mplsLsrStdMIB.setRevisions(('2004-06-03 00:00',))
if mibBuilder.loadTexts: mplsLsrStdMIB.setLastUpdated('200406030000Z')
if mibBuilder.loadTexts: mplsLsrStdMIB.setOrganization('Multiprotocol Label Switching (MPLS) Working Group')
class MplsIndexType(TextualConvention, OctetString):
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(1, 24)
class MplsIndexNextType(TextualConvention, OctetString):
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(1, 24)
mplsLsrNotifications = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 0))
mplsLsrObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 1))
mplsLsrConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 2))
mplsInterfaceTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1), )
if mibBuilder.loadTexts: mplsInterfaceTable.setStatus('current')
mplsInterfaceEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsInterfaceIndex"))
if mibBuilder.loadTexts: mplsInterfaceEntry.setStatus('current')
mplsInterfaceIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 1), InterfaceIndexOrZero())
if mibBuilder.loadTexts: mplsInterfaceIndex.setStatus('current')
mplsInterfaceLabelMinIn = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 2), MplsLabel()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInterfaceLabelMinIn.setStatus('current')
mplsInterfaceLabelMaxIn = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 3), MplsLabel()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInterfaceLabelMaxIn.setStatus('current')
mplsInterfaceLabelMinOut = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 4), MplsLabel()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInterfaceLabelMinOut.setStatus('current')
mplsInterfaceLabelMaxOut = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 5), MplsLabel()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInterfaceLabelMaxOut.setStatus('current')
mplsInterfaceTotalBandwidth = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 6), MplsBitRate()).setUnits('kilobits per second').setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInterfaceTotalBandwidth.setStatus('current')
mplsInterfaceAvailableBandwidth = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 7), MplsBitRate()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInterfaceAvailableBandwidth.setStatus('current')
mplsInterfaceLabelParticipationType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 8), Bits().clone(namedValues=NamedValues(("perPlatform", 0), ("perInterface", 1)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInterfaceLabelParticipationType.setStatus('current')
mplsInterfacePerfTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2), )
if mibBuilder.loadTexts: mplsInterfacePerfTable.setStatus('current')
mplsInterfacePerfEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1), )
mplsInterfaceEntry.registerAugmentions(("MPLS-LSR-STD-MIB", "mplsInterfacePerfEntry"))
mplsInterfacePerfEntry.setIndexNames(*mplsInterfaceEntry.getIndexNames())
if mibBuilder.loadTexts: mplsInterfacePerfEntry.setStatus('current')
mplsInterfacePerfInLabelsInUse = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 1), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInterfacePerfInLabelsInUse.setStatus('current')
mplsInterfacePerfInLabelLookupFailures = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInterfacePerfInLabelLookupFailures.setStatus('current')
mplsInterfacePerfOutLabelsInUse = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 3), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInterfacePerfOutLabelsInUse.setStatus('current')
mplsInterfacePerfOutFragmentedPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInterfacePerfOutFragmentedPkts.setStatus('current')
mplsInSegmentIndexNext = MibScalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 3), MplsIndexNextType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInSegmentIndexNext.setStatus('current')
mplsInSegmentTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4), )
if mibBuilder.loadTexts: mplsInSegmentTable.setStatus('current')
mplsInSegmentEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsInSegmentIndex"))
if mibBuilder.loadTexts: mplsInSegmentEntry.setStatus('current')
mplsInSegmentIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 1), MplsIndexType())
if mibBuilder.loadTexts: mplsInSegmentIndex.setStatus('current')
mplsInSegmentInterface = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsInSegmentInterface.setStatus('current')
mplsInSegmentLabel = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 3), MplsLabel()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsInSegmentLabel.setStatus('current')
mplsInSegmentLabelPtr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 4), RowPointer().clone((0, 0))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsInSegmentLabelPtr.setStatus('current')
mplsInSegmentNPop = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647)).clone(1)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsInSegmentNPop.setStatus('current')
mplsInSegmentAddrFamily = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 6), AddressFamilyNumbers().clone('other')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsInSegmentAddrFamily.setStatus('current')
mplsInSegmentXCIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 7), MplsIndexType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInSegmentXCIndex.setStatus('current')
mplsInSegmentOwner = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 8), MplsOwner()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInSegmentOwner.setStatus('current')
mplsInSegmentTrafficParamPtr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 9), RowPointer().clone((0, 0))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsInSegmentTrafficParamPtr.setStatus('current')
mplsInSegmentRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 10), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsInSegmentRowStatus.setStatus('current')
mplsInSegmentStorageType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 11), StorageType().clone('volatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsInSegmentStorageType.setStatus('current')
mplsInSegmentPerfTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5), )
if mibBuilder.loadTexts: mplsInSegmentPerfTable.setStatus('current')
mplsInSegmentPerfEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1), )
mplsInSegmentEntry.registerAugmentions(("MPLS-LSR-STD-MIB", "mplsInSegmentPerfEntry"))
mplsInSegmentPerfEntry.setIndexNames(*mplsInSegmentEntry.getIndexNames())
if mibBuilder.loadTexts: mplsInSegmentPerfEntry.setStatus('current')
mplsInSegmentPerfOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInSegmentPerfOctets.setStatus('current')
mplsInSegmentPerfPackets = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInSegmentPerfPackets.setStatus('current')
mplsInSegmentPerfErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInSegmentPerfErrors.setStatus('current')
mplsInSegmentPerfDiscards = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInSegmentPerfDiscards.setStatus('current')
mplsInSegmentPerfHCOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 5), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInSegmentPerfHCOctets.setStatus('current')
mplsInSegmentPerfDiscontinuityTime = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 6), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInSegmentPerfDiscontinuityTime.setStatus('current')
mplsOutSegmentIndexNext = MibScalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 6), MplsIndexNextType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsOutSegmentIndexNext.setStatus('current')
mplsOutSegmentTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7), )
if mibBuilder.loadTexts: mplsOutSegmentTable.setStatus('current')
mplsOutSegmentEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsOutSegmentIndex"))
if mibBuilder.loadTexts: mplsOutSegmentEntry.setStatus('current')
mplsOutSegmentIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 1), MplsIndexType())
if mibBuilder.loadTexts: mplsOutSegmentIndex.setStatus('current')
mplsOutSegmentInterface = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 2), InterfaceIndexOrZero()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsOutSegmentInterface.setStatus('current')
mplsOutSegmentPushTopLabel = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 3), TruthValue().clone('true')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsOutSegmentPushTopLabel.setStatus('current')
mplsOutSegmentTopLabel = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 4), MplsLabel()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsOutSegmentTopLabel.setStatus('current')
mplsOutSegmentTopLabelPtr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 5), RowPointer().clone((0, 0))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsOutSegmentTopLabelPtr.setStatus('current')
mplsOutSegmentNextHopAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 6), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsOutSegmentNextHopAddrType.setStatus('current')
mplsOutSegmentNextHopAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 7), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsOutSegmentNextHopAddr.setStatus('current')
mplsOutSegmentXCIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 8), MplsIndexType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsOutSegmentXCIndex.setStatus('current')
mplsOutSegmentOwner = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 9), MplsOwner()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsOutSegmentOwner.setStatus('current')
mplsOutSegmentTrafficParamPtr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 10), RowPointer().clone((0, 0))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsOutSegmentTrafficParamPtr.setStatus('current')
mplsOutSegmentRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 11), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsOutSegmentRowStatus.setStatus('current')
mplsOutSegmentStorageType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 12), StorageType().clone('volatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsOutSegmentStorageType.setStatus('current')
mplsOutSegmentPerfTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8), )
if mibBuilder.loadTexts: mplsOutSegmentPerfTable.setStatus('current')
mplsOutSegmentPerfEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1), )
mplsOutSegmentEntry.registerAugmentions(("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfEntry"))
mplsOutSegmentPerfEntry.setIndexNames(*mplsOutSegmentEntry.getIndexNames())
if mibBuilder.loadTexts: mplsOutSegmentPerfEntry.setStatus('current')
mplsOutSegmentPerfOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsOutSegmentPerfOctets.setStatus('current')
mplsOutSegmentPerfPackets = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsOutSegmentPerfPackets.setStatus('current')
mplsOutSegmentPerfErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsOutSegmentPerfErrors.setStatus('current')
mplsOutSegmentPerfDiscards = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsOutSegmentPerfDiscards.setStatus('current')
mplsOutSegmentPerfHCOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 5), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsOutSegmentPerfHCOctets.setStatus('current')
mplsOutSegmentPerfDiscontinuityTime = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 6), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsOutSegmentPerfDiscontinuityTime.setStatus('current')
mplsXCIndexNext = MibScalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 9), MplsIndexNextType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsXCIndexNext.setStatus('current')
mplsXCTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10), )
if mibBuilder.loadTexts: mplsXCTable.setStatus('current')
mplsXCEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsXCIndex"), (0, "MPLS-LSR-STD-MIB", "mplsXCInSegmentIndex"), (0, "MPLS-LSR-STD-MIB", "mplsXCOutSegmentIndex"))
if mibBuilder.loadTexts: mplsXCEntry.setStatus('current')
mplsXCIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 1), MplsIndexType())
if mibBuilder.loadTexts: mplsXCIndex.setStatus('current')
mplsXCInSegmentIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 2), MplsIndexType())
if mibBuilder.loadTexts: mplsXCInSegmentIndex.setStatus('current')
mplsXCOutSegmentIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 3), MplsIndexType())
if mibBuilder.loadTexts: mplsXCOutSegmentIndex.setStatus('current')
mplsXCLspId = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 4), MplsLSPID()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsXCLspId.setStatus('current')
mplsXCLabelStackIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 5), MplsIndexType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsXCLabelStackIndex.setStatus('current')
mplsXCOwner = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 6), MplsOwner()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsXCOwner.setStatus('current')
mplsXCRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 7), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsXCRowStatus.setStatus('current')
mplsXCStorageType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 8), StorageType().clone('volatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsXCStorageType.setStatus('current')
mplsXCAdminStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3))).clone('up')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsXCAdminStatus.setStatus('current')
mplsXCOperStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3), ("unknown", 4), ("dormant", 5), ("notPresent", 6), ("lowerLayerDown", 7)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsXCOperStatus.setStatus('current')
mplsMaxLabelStackDepth = MibScalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 11), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsMaxLabelStackDepth.setStatus('current')
mplsLabelStackIndexNext = MibScalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 12), MplsIndexNextType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsLabelStackIndexNext.setStatus('current')
mplsLabelStackTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13), )
if mibBuilder.loadTexts: mplsLabelStackTable.setStatus('current')
mplsLabelStackEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsLabelStackIndex"), (0, "MPLS-LSR-STD-MIB", "mplsLabelStackLabelIndex"))
if mibBuilder.loadTexts: mplsLabelStackEntry.setStatus('current')
mplsLabelStackIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 1), MplsIndexType())
if mibBuilder.loadTexts: mplsLabelStackIndex.setStatus('current')
mplsLabelStackLabelIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647)))
if mibBuilder.loadTexts: mplsLabelStackLabelIndex.setStatus('current')
mplsLabelStackLabel = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 3), MplsLabel()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsLabelStackLabel.setStatus('current')
mplsLabelStackLabelPtr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 4), RowPointer().clone((0, 0))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsLabelStackLabelPtr.setStatus('current')
mplsLabelStackRowStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsLabelStackRowStatus.setStatus('current')
mplsLabelStackStorageType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 6), StorageType().clone('volatile')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: mplsLabelStackStorageType.setStatus('current')
mplsInSegmentMapTable = MibTable((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14), )
if mibBuilder.loadTexts: mplsInSegmentMapTable.setStatus('current')
mplsInSegmentMapEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1), ).setIndexNames((0, "MPLS-LSR-STD-MIB", "mplsInSegmentMapInterface"), (0, "MPLS-LSR-STD-MIB", "mplsInSegmentMapLabel"), (0, "MPLS-LSR-STD-MIB", "mplsInSegmentMapLabelPtrIndex"))
if mibBuilder.loadTexts: mplsInSegmentMapEntry.setStatus('current')
mplsInSegmentMapInterface = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 1), InterfaceIndexOrZero())
if mibBuilder.loadTexts: mplsInSegmentMapInterface.setStatus('current')
mplsInSegmentMapLabel = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 2), MplsLabel())
if mibBuilder.loadTexts: mplsInSegmentMapLabel.setStatus('current')
mplsInSegmentMapLabelPtrIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 3), RowPointer())
if mibBuilder.loadTexts: mplsInSegmentMapLabelPtrIndex.setStatus('current')
mplsInSegmentMapIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 4), MplsIndexType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: mplsInSegmentMapIndex.setStatus('current')
mplsXCNotificationsEnable = MibScalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 15), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: mplsXCNotificationsEnable.setStatus('current')
mplsXCUp = NotificationType((1, 3, 6, 1, 2, 1, 10, 166, 2, 0, 1)).setObjects(("MPLS-LSR-STD-MIB", "mplsXCOperStatus"), ("MPLS-LSR-STD-MIB", "mplsXCOperStatus"))
if mibBuilder.loadTexts: mplsXCUp.setStatus('current')
mplsXCDown = NotificationType((1, 3, 6, 1, 2, 1, 10, 166, 2, 0, 2)).setObjects(("MPLS-LSR-STD-MIB", "mplsXCOperStatus"), ("MPLS-LSR-STD-MIB", "mplsXCOperStatus"))
if mibBuilder.loadTexts: mplsXCDown.setStatus('current')
mplsLsrGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1))
mplsLsrCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 2))
mplsLsrModuleFullCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 2, 1)).setObjects(("IF-MIB", "ifGeneralInformationGroup"), ("IF-MIB", "ifCounterDiscontinuityGroup"), ("MPLS-LSR-STD-MIB", "mplsInterfaceGroup"), ("MPLS-LSR-STD-MIB", "mplsInSegmentGroup"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentGroup"), ("MPLS-LSR-STD-MIB", "mplsXCGroup"), ("MPLS-LSR-STD-MIB", "mplsPerfGroup"), ("MPLS-LSR-STD-MIB", "mplsLabelStackGroup"), ("MPLS-LSR-STD-MIB", "mplsHCInSegmentPerfGroup"), ("MPLS-LSR-STD-MIB", "mplsHCOutSegmentPerfGroup"), ("MPLS-LSR-STD-MIB", "mplsLsrNotificationGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsLsrModuleFullCompliance = mplsLsrModuleFullCompliance.setStatus('current')
mplsLsrModuleReadOnlyCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 2, 2)).setObjects(("IF-MIB", "ifGeneralInformationGroup"), ("IF-MIB", "ifCounterDiscontinuityGroup"), ("MPLS-LSR-STD-MIB", "mplsInterfaceGroup"), ("MPLS-LSR-STD-MIB", "mplsInSegmentGroup"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentGroup"), ("MPLS-LSR-STD-MIB", "mplsXCGroup"), ("MPLS-LSR-STD-MIB", "mplsPerfGroup"), ("MPLS-LSR-STD-MIB", "mplsLabelStackGroup"), ("MPLS-LSR-STD-MIB", "mplsHCInSegmentPerfGroup"), ("MPLS-LSR-STD-MIB", "mplsHCOutSegmentPerfGroup"), ("MPLS-LSR-STD-MIB", "mplsLsrNotificationGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsLsrModuleReadOnlyCompliance = mplsLsrModuleReadOnlyCompliance.setStatus('current')
mplsInterfaceGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 1)).setObjects(("MPLS-LSR-STD-MIB", "mplsInterfaceLabelMinIn"), ("MPLS-LSR-STD-MIB", "mplsInterfaceLabelMaxIn"), ("MPLS-LSR-STD-MIB", "mplsInterfaceLabelMinOut"), ("MPLS-LSR-STD-MIB", "mplsInterfaceLabelMaxOut"), ("MPLS-LSR-STD-MIB", "mplsInterfaceTotalBandwidth"), ("MPLS-LSR-STD-MIB", "mplsInterfaceAvailableBandwidth"), ("MPLS-LSR-STD-MIB", "mplsInterfaceLabelParticipationType"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsInterfaceGroup = mplsInterfaceGroup.setStatus('current')
mplsInSegmentGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 2)).setObjects(("MPLS-LSR-STD-MIB", "mplsInSegmentIndexNext"), ("MPLS-LSR-STD-MIB", "mplsInSegmentInterface"), ("MPLS-LSR-STD-MIB", "mplsInSegmentLabel"), ("MPLS-LSR-STD-MIB", "mplsInSegmentLabelPtr"), ("MPLS-LSR-STD-MIB", "mplsInSegmentNPop"), ("MPLS-LSR-STD-MIB", "mplsInSegmentAddrFamily"), ("MPLS-LSR-STD-MIB", "mplsInSegmentXCIndex"), ("MPLS-LSR-STD-MIB", "mplsInSegmentOwner"), ("MPLS-LSR-STD-MIB", "mplsInSegmentRowStatus"), ("MPLS-LSR-STD-MIB", "mplsInSegmentStorageType"), ("MPLS-LSR-STD-MIB", "mplsInSegmentTrafficParamPtr"), ("MPLS-LSR-STD-MIB", "mplsInSegmentMapIndex"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsInSegmentGroup = mplsInSegmentGroup.setStatus('current')
mplsOutSegmentGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 3)).setObjects(("MPLS-LSR-STD-MIB", "mplsOutSegmentIndexNext"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentInterface"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPushTopLabel"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentTopLabel"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentTopLabelPtr"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentNextHopAddrType"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentNextHopAddr"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentXCIndex"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentOwner"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfOctets"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfDiscards"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfErrors"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentRowStatus"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentStorageType"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentTrafficParamPtr"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsOutSegmentGroup = mplsOutSegmentGroup.setStatus('current')
mplsXCGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 4)).setObjects(("MPLS-LSR-STD-MIB", "mplsXCIndexNext"), ("MPLS-LSR-STD-MIB", "mplsXCLspId"), ("MPLS-LSR-STD-MIB", "mplsXCLabelStackIndex"), ("MPLS-LSR-STD-MIB", "mplsXCOwner"), ("MPLS-LSR-STD-MIB", "mplsXCStorageType"), ("MPLS-LSR-STD-MIB", "mplsXCAdminStatus"), ("MPLS-LSR-STD-MIB", "mplsXCOperStatus"), ("MPLS-LSR-STD-MIB", "mplsXCRowStatus"), ("MPLS-LSR-STD-MIB", "mplsXCNotificationsEnable"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsXCGroup = mplsXCGroup.setStatus('current')
mplsPerfGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 5)).setObjects(("MPLS-LSR-STD-MIB", "mplsInSegmentPerfOctets"), ("MPLS-LSR-STD-MIB", "mplsInSegmentPerfPackets"), ("MPLS-LSR-STD-MIB", "mplsInSegmentPerfErrors"), ("MPLS-LSR-STD-MIB", "mplsInSegmentPerfDiscards"), ("MPLS-LSR-STD-MIB", "mplsInSegmentPerfDiscontinuityTime"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfOctets"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfPackets"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfDiscards"), ("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfDiscontinuityTime"), ("MPLS-LSR-STD-MIB", "mplsInterfacePerfInLabelsInUse"), ("MPLS-LSR-STD-MIB", "mplsInterfacePerfInLabelLookupFailures"), ("MPLS-LSR-STD-MIB", "mplsInterfacePerfOutFragmentedPkts"), ("MPLS-LSR-STD-MIB", "mplsInterfacePerfOutLabelsInUse"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsPerfGroup = mplsPerfGroup.setStatus('current')
mplsHCInSegmentPerfGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 6)).setObjects(("MPLS-LSR-STD-MIB", "mplsInSegmentPerfHCOctets"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsHCInSegmentPerfGroup = mplsHCInSegmentPerfGroup.setStatus('current')
mplsHCOutSegmentPerfGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 7)).setObjects(("MPLS-LSR-STD-MIB", "mplsOutSegmentPerfHCOctets"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsHCOutSegmentPerfGroup = mplsHCOutSegmentPerfGroup.setStatus('current')
mplsLabelStackGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 8)).setObjects(("MPLS-LSR-STD-MIB", "mplsLabelStackLabel"), ("MPLS-LSR-STD-MIB", "mplsLabelStackLabelPtr"), ("MPLS-LSR-STD-MIB", "mplsLabelStackRowStatus"), ("MPLS-LSR-STD-MIB", "mplsLabelStackStorageType"), ("MPLS-LSR-STD-MIB", "mplsMaxLabelStackDepth"), ("MPLS-LSR-STD-MIB", "mplsLabelStackIndexNext"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsLabelStackGroup = mplsLabelStackGroup.setStatus('current')
mplsLsrNotificationGroup = NotificationGroup((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 9)).setObjects(("MPLS-LSR-STD-MIB", "mplsXCUp"), ("MPLS-LSR-STD-MIB", "mplsXCDown"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mplsLsrNotificationGroup = mplsLsrNotificationGroup.setStatus('current')
mibBuilder.exportSymbols("MPLS-LSR-STD-MIB", mplsInterfaceAvailableBandwidth=mplsInterfaceAvailableBandwidth, mplsLabelStackGroup=mplsLabelStackGroup, mplsInterfaceLabelMaxOut=mplsInterfaceLabelMaxOut, mplsXCTable=mplsXCTable, mplsInSegmentPerfDiscards=mplsInSegmentPerfDiscards, mplsLsrGroups=mplsLsrGroups, mplsXCEntry=mplsXCEntry, mplsInterfaceTotalBandwidth=mplsInterfaceTotalBandwidth, mplsLsrConformance=mplsLsrConformance, mplsOutSegmentPerfHCOctets=mplsOutSegmentPerfHCOctets, mplsInSegmentMapIndex=mplsInSegmentMapIndex, mplsInterfaceEntry=mplsInterfaceEntry, mplsOutSegmentOwner=mplsOutSegmentOwner, mplsLsrStdMIB=mplsLsrStdMIB, mplsXCLspId=mplsXCLspId, mplsLabelStackRowStatus=mplsLabelStackRowStatus, mplsInSegmentPerfPackets=mplsInSegmentPerfPackets, mplsInterfacePerfOutFragmentedPkts=mplsInterfacePerfOutFragmentedPkts, mplsLsrNotifications=mplsLsrNotifications, mplsOutSegmentTrafficParamPtr=mplsOutSegmentTrafficParamPtr, mplsXCDown=mplsXCDown, mplsInSegmentEntry=mplsInSegmentEntry, mplsOutSegmentStorageType=mplsOutSegmentStorageType, mplsInterfacePerfInLabelLookupFailures=mplsInterfacePerfInLabelLookupFailures, mplsInSegmentPerfErrors=mplsInSegmentPerfErrors, mplsLsrObjects=mplsLsrObjects, mplsInSegmentXCIndex=mplsInSegmentXCIndex, mplsInSegmentMapLabel=mplsInSegmentMapLabel, mplsInterfaceGroup=mplsInterfaceGroup, mplsXCIndex=mplsXCIndex, mplsInSegmentIndexNext=mplsInSegmentIndexNext, mplsInSegmentMapEntry=mplsInSegmentMapEntry, mplsOutSegmentPerfErrors=mplsOutSegmentPerfErrors, mplsLabelStackIndex=mplsLabelStackIndex, mplsLsrModuleReadOnlyCompliance=mplsLsrModuleReadOnlyCompliance, mplsInSegmentStorageType=mplsInSegmentStorageType, mplsLabelStackLabelPtr=mplsLabelStackLabelPtr, mplsLabelStackTable=mplsLabelStackTable, mplsInSegmentTrafficParamPtr=mplsInSegmentTrafficParamPtr, mplsPerfGroup=mplsPerfGroup, mplsHCInSegmentPerfGroup=mplsHCInSegmentPerfGroup, mplsInterfacePerfTable=mplsInterfacePerfTable, mplsOutSegmentNextHopAddrType=mplsOutSegmentNextHopAddrType, mplsXCIndexNext=mplsXCIndexNext, mplsXCOwner=mplsXCOwner, mplsInterfacePerfOutLabelsInUse=mplsInterfacePerfOutLabelsInUse, mplsOutSegmentPerfTable=mplsOutSegmentPerfTable, mplsInterfaceLabelMinIn=mplsInterfaceLabelMinIn, mplsOutSegmentGroup=mplsOutSegmentGroup, mplsOutSegmentTopLabelPtr=mplsOutSegmentTopLabelPtr, mplsInSegmentMapTable=mplsInSegmentMapTable, mplsInSegmentIndex=mplsInSegmentIndex, mplsXCOutSegmentIndex=mplsXCOutSegmentIndex, mplsInSegmentPerfTable=mplsInSegmentPerfTable, mplsInSegmentLabel=mplsInSegmentLabel, mplsOutSegmentPerfDiscontinuityTime=mplsOutSegmentPerfDiscontinuityTime, mplsXCGroup=mplsXCGroup, mplsOutSegmentIndex=mplsOutSegmentIndex, mplsLabelStackLabelIndex=mplsLabelStackLabelIndex, mplsInterfaceTable=mplsInterfaceTable, mplsOutSegmentPerfEntry=mplsOutSegmentPerfEntry, MplsIndexType=MplsIndexType, mplsXCInSegmentIndex=mplsXCInSegmentIndex, mplsOutSegmentEntry=mplsOutSegmentEntry, mplsInterfacePerfEntry=mplsInterfacePerfEntry, mplsXCStorageType=mplsXCStorageType, mplsLabelStackLabel=mplsLabelStackLabel, mplsOutSegmentPerfDiscards=mplsOutSegmentPerfDiscards, mplsInSegmentPerfDiscontinuityTime=mplsInSegmentPerfDiscontinuityTime, mplsXCAdminStatus=mplsXCAdminStatus, mplsInterfaceLabelMinOut=mplsInterfaceLabelMinOut, mplsLabelStackStorageType=mplsLabelStackStorageType, mplsInterfacePerfInLabelsInUse=mplsInterfacePerfInLabelsInUse, mplsXCRowStatus=mplsXCRowStatus, mplsOutSegmentIndexNext=mplsOutSegmentIndexNext, mplsOutSegmentTable=mplsOutSegmentTable, mplsLsrNotificationGroup=mplsLsrNotificationGroup, mplsOutSegmentPerfOctets=mplsOutSegmentPerfOctets, mplsLabelStackEntry=mplsLabelStackEntry, mplsMaxLabelStackDepth=mplsMaxLabelStackDepth, mplsInSegmentAddrFamily=mplsInSegmentAddrFamily, mplsInSegmentInterface=mplsInSegmentInterface, mplsInterfaceLabelMaxIn=mplsInterfaceLabelMaxIn, mplsInterfaceIndex=mplsInterfaceIndex, mplsInSegmentPerfHCOctets=mplsInSegmentPerfHCOctets, mplsXCOperStatus=mplsXCOperStatus, mplsOutSegmentNextHopAddr=mplsOutSegmentNextHopAddr, mplsLsrCompliances=mplsLsrCompliances, mplsInSegmentTable=mplsInSegmentTable, mplsOutSegmentRowStatus=mplsOutSegmentRowStatus, mplsXCUp=mplsXCUp, mplsInSegmentLabelPtr=mplsInSegmentLabelPtr, mplsXCNotificationsEnable=mplsXCNotificationsEnable, mplsInSegmentMapInterface=mplsInSegmentMapInterface, mplsOutSegmentTopLabel=mplsOutSegmentTopLabel, MplsIndexNextType=MplsIndexNextType, mplsInterfaceLabelParticipationType=mplsInterfaceLabelParticipationType, mplsInSegmentMapLabelPtrIndex=mplsInSegmentMapLabelPtrIndex, mplsInSegmentRowStatus=mplsInSegmentRowStatus, mplsInSegmentOwner=mplsInSegmentOwner, mplsInSegmentNPop=mplsInSegmentNPop, mplsInSegmentPerfEntry=mplsInSegmentPerfEntry, mplsHCOutSegmentPerfGroup=mplsHCOutSegmentPerfGroup, mplsLabelStackIndexNext=mplsLabelStackIndexNext, mplsOutSegmentPerfPackets=mplsOutSegmentPerfPackets, mplsInSegmentGroup=mplsInSegmentGroup, mplsInSegmentPerfOctets=mplsInSegmentPerfOctets, mplsOutSegmentPushTopLabel=mplsOutSegmentPushTopLabel, PYSNMP_MODULE_ID=mplsLsrStdMIB, mplsOutSegmentXCIndex=mplsOutSegmentXCIndex, mplsOutSegmentInterface=mplsOutSegmentInterface, mplsLsrModuleFullCompliance=mplsLsrModuleFullCompliance, mplsXCLabelStackIndex=mplsXCLabelStackIndex)
|
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, single_value_constraint, value_size_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsUnion')
(address_family_numbers,) = mibBuilder.importSymbols('IANA-ADDRESS-FAMILY-NUMBERS-MIB', 'AddressFamilyNumbers')
(if_counter_discontinuity_group, interface_index_or_zero, if_general_information_group) = mibBuilder.importSymbols('IF-MIB', 'ifCounterDiscontinuityGroup', 'InterfaceIndexOrZero', 'ifGeneralInformationGroup')
(inet_address_type, inet_address) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddressType', 'InetAddress')
(mpls_label, mpls_bit_rate, mpls_owner, mpls_std_mib, mpls_lspid) = mibBuilder.importSymbols('MPLS-TC-STD-MIB', 'MplsLabel', 'MplsBitRate', 'MplsOwner', 'mplsStdMIB', 'MplsLSPID')
(object_group, notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'ObjectGroup', 'NotificationGroup', 'ModuleCompliance')
(notification_type, zero_dot_zero, mib_identifier, iso, bits, object_identity, mib_scalar, mib_table, mib_table_row, mib_table_column, integer32, module_identity, unsigned32, counter64, time_ticks, ip_address, counter32, gauge32) = mibBuilder.importSymbols('SNMPv2-SMI', 'NotificationType', 'zeroDotZero', 'MibIdentifier', 'iso', 'Bits', 'ObjectIdentity', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Integer32', 'ModuleIdentity', 'Unsigned32', 'Counter64', 'TimeTicks', 'IpAddress', 'Counter32', 'Gauge32')
(textual_convention, row_status, storage_type, row_pointer, truth_value, display_string, time_stamp) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'RowStatus', 'StorageType', 'RowPointer', 'TruthValue', 'DisplayString', 'TimeStamp')
mpls_lsr_std_mib = module_identity((1, 3, 6, 1, 2, 1, 10, 166, 2))
mplsLsrStdMIB.setRevisions(('2004-06-03 00:00',))
if mibBuilder.loadTexts:
mplsLsrStdMIB.setLastUpdated('200406030000Z')
if mibBuilder.loadTexts:
mplsLsrStdMIB.setOrganization('Multiprotocol Label Switching (MPLS) Working Group')
class Mplsindextype(TextualConvention, OctetString):
status = 'current'
subtype_spec = OctetString.subtypeSpec + value_size_constraint(1, 24)
class Mplsindexnexttype(TextualConvention, OctetString):
status = 'current'
subtype_spec = OctetString.subtypeSpec + value_size_constraint(1, 24)
mpls_lsr_notifications = mib_identifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 0))
mpls_lsr_objects = mib_identifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 1))
mpls_lsr_conformance = mib_identifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 2))
mpls_interface_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1))
if mibBuilder.loadTexts:
mplsInterfaceTable.setStatus('current')
mpls_interface_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1)).setIndexNames((0, 'MPLS-LSR-STD-MIB', 'mplsInterfaceIndex'))
if mibBuilder.loadTexts:
mplsInterfaceEntry.setStatus('current')
mpls_interface_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 1), interface_index_or_zero())
if mibBuilder.loadTexts:
mplsInterfaceIndex.setStatus('current')
mpls_interface_label_min_in = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 2), mpls_label()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInterfaceLabelMinIn.setStatus('current')
mpls_interface_label_max_in = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 3), mpls_label()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInterfaceLabelMaxIn.setStatus('current')
mpls_interface_label_min_out = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 4), mpls_label()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInterfaceLabelMinOut.setStatus('current')
mpls_interface_label_max_out = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 5), mpls_label()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInterfaceLabelMaxOut.setStatus('current')
mpls_interface_total_bandwidth = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 6), mpls_bit_rate()).setUnits('kilobits per second').setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInterfaceTotalBandwidth.setStatus('current')
mpls_interface_available_bandwidth = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 7), mpls_bit_rate()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInterfaceAvailableBandwidth.setStatus('current')
mpls_interface_label_participation_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 1, 1, 8), bits().clone(namedValues=named_values(('perPlatform', 0), ('perInterface', 1)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInterfaceLabelParticipationType.setStatus('current')
mpls_interface_perf_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2))
if mibBuilder.loadTexts:
mplsInterfacePerfTable.setStatus('current')
mpls_interface_perf_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1))
mplsInterfaceEntry.registerAugmentions(('MPLS-LSR-STD-MIB', 'mplsInterfacePerfEntry'))
mplsInterfacePerfEntry.setIndexNames(*mplsInterfaceEntry.getIndexNames())
if mibBuilder.loadTexts:
mplsInterfacePerfEntry.setStatus('current')
mpls_interface_perf_in_labels_in_use = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 1), gauge32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInterfacePerfInLabelsInUse.setStatus('current')
mpls_interface_perf_in_label_lookup_failures = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInterfacePerfInLabelLookupFailures.setStatus('current')
mpls_interface_perf_out_labels_in_use = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 3), gauge32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInterfacePerfOutLabelsInUse.setStatus('current')
mpls_interface_perf_out_fragmented_pkts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 2, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInterfacePerfOutFragmentedPkts.setStatus('current')
mpls_in_segment_index_next = mib_scalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 3), mpls_index_next_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInSegmentIndexNext.setStatus('current')
mpls_in_segment_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4))
if mibBuilder.loadTexts:
mplsInSegmentTable.setStatus('current')
mpls_in_segment_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1)).setIndexNames((0, 'MPLS-LSR-STD-MIB', 'mplsInSegmentIndex'))
if mibBuilder.loadTexts:
mplsInSegmentEntry.setStatus('current')
mpls_in_segment_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 1), mpls_index_type())
if mibBuilder.loadTexts:
mplsInSegmentIndex.setStatus('current')
mpls_in_segment_interface = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 2), interface_index_or_zero()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsInSegmentInterface.setStatus('current')
mpls_in_segment_label = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 3), mpls_label()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsInSegmentLabel.setStatus('current')
mpls_in_segment_label_ptr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 4), row_pointer().clone((0, 0))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsInSegmentLabelPtr.setStatus('current')
mpls_in_segment_n_pop = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647)).clone(1)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsInSegmentNPop.setStatus('current')
mpls_in_segment_addr_family = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 6), address_family_numbers().clone('other')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsInSegmentAddrFamily.setStatus('current')
mpls_in_segment_xc_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 7), mpls_index_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInSegmentXCIndex.setStatus('current')
mpls_in_segment_owner = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 8), mpls_owner()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInSegmentOwner.setStatus('current')
mpls_in_segment_traffic_param_ptr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 9), row_pointer().clone((0, 0))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsInSegmentTrafficParamPtr.setStatus('current')
mpls_in_segment_row_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 10), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsInSegmentRowStatus.setStatus('current')
mpls_in_segment_storage_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 4, 1, 11), storage_type().clone('volatile')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsInSegmentStorageType.setStatus('current')
mpls_in_segment_perf_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5))
if mibBuilder.loadTexts:
mplsInSegmentPerfTable.setStatus('current')
mpls_in_segment_perf_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1))
mplsInSegmentEntry.registerAugmentions(('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfEntry'))
mplsInSegmentPerfEntry.setIndexNames(*mplsInSegmentEntry.getIndexNames())
if mibBuilder.loadTexts:
mplsInSegmentPerfEntry.setStatus('current')
mpls_in_segment_perf_octets = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 1), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInSegmentPerfOctets.setStatus('current')
mpls_in_segment_perf_packets = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInSegmentPerfPackets.setStatus('current')
mpls_in_segment_perf_errors = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInSegmentPerfErrors.setStatus('current')
mpls_in_segment_perf_discards = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInSegmentPerfDiscards.setStatus('current')
mpls_in_segment_perf_hc_octets = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 5), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInSegmentPerfHCOctets.setStatus('current')
mpls_in_segment_perf_discontinuity_time = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 5, 1, 6), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInSegmentPerfDiscontinuityTime.setStatus('current')
mpls_out_segment_index_next = mib_scalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 6), mpls_index_next_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsOutSegmentIndexNext.setStatus('current')
mpls_out_segment_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7))
if mibBuilder.loadTexts:
mplsOutSegmentTable.setStatus('current')
mpls_out_segment_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1)).setIndexNames((0, 'MPLS-LSR-STD-MIB', 'mplsOutSegmentIndex'))
if mibBuilder.loadTexts:
mplsOutSegmentEntry.setStatus('current')
mpls_out_segment_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 1), mpls_index_type())
if mibBuilder.loadTexts:
mplsOutSegmentIndex.setStatus('current')
mpls_out_segment_interface = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 2), interface_index_or_zero()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsOutSegmentInterface.setStatus('current')
mpls_out_segment_push_top_label = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 3), truth_value().clone('true')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsOutSegmentPushTopLabel.setStatus('current')
mpls_out_segment_top_label = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 4), mpls_label()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsOutSegmentTopLabel.setStatus('current')
mpls_out_segment_top_label_ptr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 5), row_pointer().clone((0, 0))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsOutSegmentTopLabelPtr.setStatus('current')
mpls_out_segment_next_hop_addr_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 6), inet_address_type()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsOutSegmentNextHopAddrType.setStatus('current')
mpls_out_segment_next_hop_addr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 7), inet_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsOutSegmentNextHopAddr.setStatus('current')
mpls_out_segment_xc_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 8), mpls_index_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsOutSegmentXCIndex.setStatus('current')
mpls_out_segment_owner = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 9), mpls_owner()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsOutSegmentOwner.setStatus('current')
mpls_out_segment_traffic_param_ptr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 10), row_pointer().clone((0, 0))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsOutSegmentTrafficParamPtr.setStatus('current')
mpls_out_segment_row_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 11), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsOutSegmentRowStatus.setStatus('current')
mpls_out_segment_storage_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 7, 1, 12), storage_type().clone('volatile')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsOutSegmentStorageType.setStatus('current')
mpls_out_segment_perf_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8))
if mibBuilder.loadTexts:
mplsOutSegmentPerfTable.setStatus('current')
mpls_out_segment_perf_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1))
mplsOutSegmentEntry.registerAugmentions(('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfEntry'))
mplsOutSegmentPerfEntry.setIndexNames(*mplsOutSegmentEntry.getIndexNames())
if mibBuilder.loadTexts:
mplsOutSegmentPerfEntry.setStatus('current')
mpls_out_segment_perf_octets = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 1), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsOutSegmentPerfOctets.setStatus('current')
mpls_out_segment_perf_packets = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 2), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsOutSegmentPerfPackets.setStatus('current')
mpls_out_segment_perf_errors = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsOutSegmentPerfErrors.setStatus('current')
mpls_out_segment_perf_discards = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 4), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsOutSegmentPerfDiscards.setStatus('current')
mpls_out_segment_perf_hc_octets = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 5), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsOutSegmentPerfHCOctets.setStatus('current')
mpls_out_segment_perf_discontinuity_time = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 8, 1, 6), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsOutSegmentPerfDiscontinuityTime.setStatus('current')
mpls_xc_index_next = mib_scalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 9), mpls_index_next_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsXCIndexNext.setStatus('current')
mpls_xc_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10))
if mibBuilder.loadTexts:
mplsXCTable.setStatus('current')
mpls_xc_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1)).setIndexNames((0, 'MPLS-LSR-STD-MIB', 'mplsXCIndex'), (0, 'MPLS-LSR-STD-MIB', 'mplsXCInSegmentIndex'), (0, 'MPLS-LSR-STD-MIB', 'mplsXCOutSegmentIndex'))
if mibBuilder.loadTexts:
mplsXCEntry.setStatus('current')
mpls_xc_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 1), mpls_index_type())
if mibBuilder.loadTexts:
mplsXCIndex.setStatus('current')
mpls_xc_in_segment_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 2), mpls_index_type())
if mibBuilder.loadTexts:
mplsXCInSegmentIndex.setStatus('current')
mpls_xc_out_segment_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 3), mpls_index_type())
if mibBuilder.loadTexts:
mplsXCOutSegmentIndex.setStatus('current')
mpls_xc_lsp_id = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 4), mpls_lspid()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsXCLspId.setStatus('current')
mpls_xc_label_stack_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 5), mpls_index_type()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsXCLabelStackIndex.setStatus('current')
mpls_xc_owner = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 6), mpls_owner()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsXCOwner.setStatus('current')
mpls_xc_row_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 7), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsXCRowStatus.setStatus('current')
mpls_xc_storage_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 8), storage_type().clone('volatile')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsXCStorageType.setStatus('current')
mpls_xc_admin_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('up', 1), ('down', 2), ('testing', 3))).clone('up')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsXCAdminStatus.setStatus('current')
mpls_xc_oper_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 10, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('up', 1), ('down', 2), ('testing', 3), ('unknown', 4), ('dormant', 5), ('notPresent', 6), ('lowerLayerDown', 7)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsXCOperStatus.setStatus('current')
mpls_max_label_stack_depth = mib_scalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 11), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsMaxLabelStackDepth.setStatus('current')
mpls_label_stack_index_next = mib_scalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 12), mpls_index_next_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsLabelStackIndexNext.setStatus('current')
mpls_label_stack_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13))
if mibBuilder.loadTexts:
mplsLabelStackTable.setStatus('current')
mpls_label_stack_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1)).setIndexNames((0, 'MPLS-LSR-STD-MIB', 'mplsLabelStackIndex'), (0, 'MPLS-LSR-STD-MIB', 'mplsLabelStackLabelIndex'))
if mibBuilder.loadTexts:
mplsLabelStackEntry.setStatus('current')
mpls_label_stack_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 1), mpls_index_type())
if mibBuilder.loadTexts:
mplsLabelStackIndex.setStatus('current')
mpls_label_stack_label_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 2), unsigned32().subtype(subtypeSpec=value_range_constraint(1, 2147483647)))
if mibBuilder.loadTexts:
mplsLabelStackLabelIndex.setStatus('current')
mpls_label_stack_label = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 3), mpls_label()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsLabelStackLabel.setStatus('current')
mpls_label_stack_label_ptr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 4), row_pointer().clone((0, 0))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsLabelStackLabelPtr.setStatus('current')
mpls_label_stack_row_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 5), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsLabelStackRowStatus.setStatus('current')
mpls_label_stack_storage_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 13, 1, 6), storage_type().clone('volatile')).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
mplsLabelStackStorageType.setStatus('current')
mpls_in_segment_map_table = mib_table((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14))
if mibBuilder.loadTexts:
mplsInSegmentMapTable.setStatus('current')
mpls_in_segment_map_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1)).setIndexNames((0, 'MPLS-LSR-STD-MIB', 'mplsInSegmentMapInterface'), (0, 'MPLS-LSR-STD-MIB', 'mplsInSegmentMapLabel'), (0, 'MPLS-LSR-STD-MIB', 'mplsInSegmentMapLabelPtrIndex'))
if mibBuilder.loadTexts:
mplsInSegmentMapEntry.setStatus('current')
mpls_in_segment_map_interface = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 1), interface_index_or_zero())
if mibBuilder.loadTexts:
mplsInSegmentMapInterface.setStatus('current')
mpls_in_segment_map_label = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 2), mpls_label())
if mibBuilder.loadTexts:
mplsInSegmentMapLabel.setStatus('current')
mpls_in_segment_map_label_ptr_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 3), row_pointer())
if mibBuilder.loadTexts:
mplsInSegmentMapLabelPtrIndex.setStatus('current')
mpls_in_segment_map_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 14, 1, 4), mpls_index_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
mplsInSegmentMapIndex.setStatus('current')
mpls_xc_notifications_enable = mib_scalar((1, 3, 6, 1, 2, 1, 10, 166, 2, 1, 15), truth_value().clone('false')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
mplsXCNotificationsEnable.setStatus('current')
mpls_xc_up = notification_type((1, 3, 6, 1, 2, 1, 10, 166, 2, 0, 1)).setObjects(('MPLS-LSR-STD-MIB', 'mplsXCOperStatus'), ('MPLS-LSR-STD-MIB', 'mplsXCOperStatus'))
if mibBuilder.loadTexts:
mplsXCUp.setStatus('current')
mpls_xc_down = notification_type((1, 3, 6, 1, 2, 1, 10, 166, 2, 0, 2)).setObjects(('MPLS-LSR-STD-MIB', 'mplsXCOperStatus'), ('MPLS-LSR-STD-MIB', 'mplsXCOperStatus'))
if mibBuilder.loadTexts:
mplsXCDown.setStatus('current')
mpls_lsr_groups = mib_identifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1))
mpls_lsr_compliances = mib_identifier((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 2))
mpls_lsr_module_full_compliance = module_compliance((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 2, 1)).setObjects(('IF-MIB', 'ifGeneralInformationGroup'), ('IF-MIB', 'ifCounterDiscontinuityGroup'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceGroup'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentGroup'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentGroup'), ('MPLS-LSR-STD-MIB', 'mplsXCGroup'), ('MPLS-LSR-STD-MIB', 'mplsPerfGroup'), ('MPLS-LSR-STD-MIB', 'mplsLabelStackGroup'), ('MPLS-LSR-STD-MIB', 'mplsHCInSegmentPerfGroup'), ('MPLS-LSR-STD-MIB', 'mplsHCOutSegmentPerfGroup'), ('MPLS-LSR-STD-MIB', 'mplsLsrNotificationGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mpls_lsr_module_full_compliance = mplsLsrModuleFullCompliance.setStatus('current')
mpls_lsr_module_read_only_compliance = module_compliance((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 2, 2)).setObjects(('IF-MIB', 'ifGeneralInformationGroup'), ('IF-MIB', 'ifCounterDiscontinuityGroup'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceGroup'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentGroup'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentGroup'), ('MPLS-LSR-STD-MIB', 'mplsXCGroup'), ('MPLS-LSR-STD-MIB', 'mplsPerfGroup'), ('MPLS-LSR-STD-MIB', 'mplsLabelStackGroup'), ('MPLS-LSR-STD-MIB', 'mplsHCInSegmentPerfGroup'), ('MPLS-LSR-STD-MIB', 'mplsHCOutSegmentPerfGroup'), ('MPLS-LSR-STD-MIB', 'mplsLsrNotificationGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mpls_lsr_module_read_only_compliance = mplsLsrModuleReadOnlyCompliance.setStatus('current')
mpls_interface_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 1)).setObjects(('MPLS-LSR-STD-MIB', 'mplsInterfaceLabelMinIn'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceLabelMaxIn'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceLabelMinOut'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceLabelMaxOut'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceTotalBandwidth'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceAvailableBandwidth'), ('MPLS-LSR-STD-MIB', 'mplsInterfaceLabelParticipationType'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mpls_interface_group = mplsInterfaceGroup.setStatus('current')
mpls_in_segment_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 2)).setObjects(('MPLS-LSR-STD-MIB', 'mplsInSegmentIndexNext'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentInterface'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentLabel'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentLabelPtr'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentNPop'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentAddrFamily'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentXCIndex'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentOwner'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentRowStatus'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentStorageType'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentTrafficParamPtr'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentMapIndex'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mpls_in_segment_group = mplsInSegmentGroup.setStatus('current')
mpls_out_segment_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 3)).setObjects(('MPLS-LSR-STD-MIB', 'mplsOutSegmentIndexNext'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentInterface'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPushTopLabel'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentTopLabel'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentTopLabelPtr'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentNextHopAddrType'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentNextHopAddr'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentXCIndex'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentOwner'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfOctets'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfDiscards'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfErrors'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentRowStatus'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentStorageType'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentTrafficParamPtr'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mpls_out_segment_group = mplsOutSegmentGroup.setStatus('current')
mpls_xc_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 4)).setObjects(('MPLS-LSR-STD-MIB', 'mplsXCIndexNext'), ('MPLS-LSR-STD-MIB', 'mplsXCLspId'), ('MPLS-LSR-STD-MIB', 'mplsXCLabelStackIndex'), ('MPLS-LSR-STD-MIB', 'mplsXCOwner'), ('MPLS-LSR-STD-MIB', 'mplsXCStorageType'), ('MPLS-LSR-STD-MIB', 'mplsXCAdminStatus'), ('MPLS-LSR-STD-MIB', 'mplsXCOperStatus'), ('MPLS-LSR-STD-MIB', 'mplsXCRowStatus'), ('MPLS-LSR-STD-MIB', 'mplsXCNotificationsEnable'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mpls_xc_group = mplsXCGroup.setStatus('current')
mpls_perf_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 5)).setObjects(('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfOctets'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfPackets'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfErrors'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfDiscards'), ('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfDiscontinuityTime'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfOctets'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfPackets'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfDiscards'), ('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfDiscontinuityTime'), ('MPLS-LSR-STD-MIB', 'mplsInterfacePerfInLabelsInUse'), ('MPLS-LSR-STD-MIB', 'mplsInterfacePerfInLabelLookupFailures'), ('MPLS-LSR-STD-MIB', 'mplsInterfacePerfOutFragmentedPkts'), ('MPLS-LSR-STD-MIB', 'mplsInterfacePerfOutLabelsInUse'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mpls_perf_group = mplsPerfGroup.setStatus('current')
mpls_hc_in_segment_perf_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 6)).setObjects(('MPLS-LSR-STD-MIB', 'mplsInSegmentPerfHCOctets'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mpls_hc_in_segment_perf_group = mplsHCInSegmentPerfGroup.setStatus('current')
mpls_hc_out_segment_perf_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 7)).setObjects(('MPLS-LSR-STD-MIB', 'mplsOutSegmentPerfHCOctets'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mpls_hc_out_segment_perf_group = mplsHCOutSegmentPerfGroup.setStatus('current')
mpls_label_stack_group = object_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 8)).setObjects(('MPLS-LSR-STD-MIB', 'mplsLabelStackLabel'), ('MPLS-LSR-STD-MIB', 'mplsLabelStackLabelPtr'), ('MPLS-LSR-STD-MIB', 'mplsLabelStackRowStatus'), ('MPLS-LSR-STD-MIB', 'mplsLabelStackStorageType'), ('MPLS-LSR-STD-MIB', 'mplsMaxLabelStackDepth'), ('MPLS-LSR-STD-MIB', 'mplsLabelStackIndexNext'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mpls_label_stack_group = mplsLabelStackGroup.setStatus('current')
mpls_lsr_notification_group = notification_group((1, 3, 6, 1, 2, 1, 10, 166, 2, 2, 1, 9)).setObjects(('MPLS-LSR-STD-MIB', 'mplsXCUp'), ('MPLS-LSR-STD-MIB', 'mplsXCDown'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
mpls_lsr_notification_group = mplsLsrNotificationGroup.setStatus('current')
mibBuilder.exportSymbols('MPLS-LSR-STD-MIB', mplsInterfaceAvailableBandwidth=mplsInterfaceAvailableBandwidth, mplsLabelStackGroup=mplsLabelStackGroup, mplsInterfaceLabelMaxOut=mplsInterfaceLabelMaxOut, mplsXCTable=mplsXCTable, mplsInSegmentPerfDiscards=mplsInSegmentPerfDiscards, mplsLsrGroups=mplsLsrGroups, mplsXCEntry=mplsXCEntry, mplsInterfaceTotalBandwidth=mplsInterfaceTotalBandwidth, mplsLsrConformance=mplsLsrConformance, mplsOutSegmentPerfHCOctets=mplsOutSegmentPerfHCOctets, mplsInSegmentMapIndex=mplsInSegmentMapIndex, mplsInterfaceEntry=mplsInterfaceEntry, mplsOutSegmentOwner=mplsOutSegmentOwner, mplsLsrStdMIB=mplsLsrStdMIB, mplsXCLspId=mplsXCLspId, mplsLabelStackRowStatus=mplsLabelStackRowStatus, mplsInSegmentPerfPackets=mplsInSegmentPerfPackets, mplsInterfacePerfOutFragmentedPkts=mplsInterfacePerfOutFragmentedPkts, mplsLsrNotifications=mplsLsrNotifications, mplsOutSegmentTrafficParamPtr=mplsOutSegmentTrafficParamPtr, mplsXCDown=mplsXCDown, mplsInSegmentEntry=mplsInSegmentEntry, mplsOutSegmentStorageType=mplsOutSegmentStorageType, mplsInterfacePerfInLabelLookupFailures=mplsInterfacePerfInLabelLookupFailures, mplsInSegmentPerfErrors=mplsInSegmentPerfErrors, mplsLsrObjects=mplsLsrObjects, mplsInSegmentXCIndex=mplsInSegmentXCIndex, mplsInSegmentMapLabel=mplsInSegmentMapLabel, mplsInterfaceGroup=mplsInterfaceGroup, mplsXCIndex=mplsXCIndex, mplsInSegmentIndexNext=mplsInSegmentIndexNext, mplsInSegmentMapEntry=mplsInSegmentMapEntry, mplsOutSegmentPerfErrors=mplsOutSegmentPerfErrors, mplsLabelStackIndex=mplsLabelStackIndex, mplsLsrModuleReadOnlyCompliance=mplsLsrModuleReadOnlyCompliance, mplsInSegmentStorageType=mplsInSegmentStorageType, mplsLabelStackLabelPtr=mplsLabelStackLabelPtr, mplsLabelStackTable=mplsLabelStackTable, mplsInSegmentTrafficParamPtr=mplsInSegmentTrafficParamPtr, mplsPerfGroup=mplsPerfGroup, mplsHCInSegmentPerfGroup=mplsHCInSegmentPerfGroup, mplsInterfacePerfTable=mplsInterfacePerfTable, mplsOutSegmentNextHopAddrType=mplsOutSegmentNextHopAddrType, mplsXCIndexNext=mplsXCIndexNext, mplsXCOwner=mplsXCOwner, mplsInterfacePerfOutLabelsInUse=mplsInterfacePerfOutLabelsInUse, mplsOutSegmentPerfTable=mplsOutSegmentPerfTable, mplsInterfaceLabelMinIn=mplsInterfaceLabelMinIn, mplsOutSegmentGroup=mplsOutSegmentGroup, mplsOutSegmentTopLabelPtr=mplsOutSegmentTopLabelPtr, mplsInSegmentMapTable=mplsInSegmentMapTable, mplsInSegmentIndex=mplsInSegmentIndex, mplsXCOutSegmentIndex=mplsXCOutSegmentIndex, mplsInSegmentPerfTable=mplsInSegmentPerfTable, mplsInSegmentLabel=mplsInSegmentLabel, mplsOutSegmentPerfDiscontinuityTime=mplsOutSegmentPerfDiscontinuityTime, mplsXCGroup=mplsXCGroup, mplsOutSegmentIndex=mplsOutSegmentIndex, mplsLabelStackLabelIndex=mplsLabelStackLabelIndex, mplsInterfaceTable=mplsInterfaceTable, mplsOutSegmentPerfEntry=mplsOutSegmentPerfEntry, MplsIndexType=MplsIndexType, mplsXCInSegmentIndex=mplsXCInSegmentIndex, mplsOutSegmentEntry=mplsOutSegmentEntry, mplsInterfacePerfEntry=mplsInterfacePerfEntry, mplsXCStorageType=mplsXCStorageType, mplsLabelStackLabel=mplsLabelStackLabel, mplsOutSegmentPerfDiscards=mplsOutSegmentPerfDiscards, mplsInSegmentPerfDiscontinuityTime=mplsInSegmentPerfDiscontinuityTime, mplsXCAdminStatus=mplsXCAdminStatus, mplsInterfaceLabelMinOut=mplsInterfaceLabelMinOut, mplsLabelStackStorageType=mplsLabelStackStorageType, mplsInterfacePerfInLabelsInUse=mplsInterfacePerfInLabelsInUse, mplsXCRowStatus=mplsXCRowStatus, mplsOutSegmentIndexNext=mplsOutSegmentIndexNext, mplsOutSegmentTable=mplsOutSegmentTable, mplsLsrNotificationGroup=mplsLsrNotificationGroup, mplsOutSegmentPerfOctets=mplsOutSegmentPerfOctets, mplsLabelStackEntry=mplsLabelStackEntry, mplsMaxLabelStackDepth=mplsMaxLabelStackDepth, mplsInSegmentAddrFamily=mplsInSegmentAddrFamily, mplsInSegmentInterface=mplsInSegmentInterface, mplsInterfaceLabelMaxIn=mplsInterfaceLabelMaxIn, mplsInterfaceIndex=mplsInterfaceIndex, mplsInSegmentPerfHCOctets=mplsInSegmentPerfHCOctets, mplsXCOperStatus=mplsXCOperStatus, mplsOutSegmentNextHopAddr=mplsOutSegmentNextHopAddr, mplsLsrCompliances=mplsLsrCompliances, mplsInSegmentTable=mplsInSegmentTable, mplsOutSegmentRowStatus=mplsOutSegmentRowStatus, mplsXCUp=mplsXCUp, mplsInSegmentLabelPtr=mplsInSegmentLabelPtr, mplsXCNotificationsEnable=mplsXCNotificationsEnable, mplsInSegmentMapInterface=mplsInSegmentMapInterface, mplsOutSegmentTopLabel=mplsOutSegmentTopLabel, MplsIndexNextType=MplsIndexNextType, mplsInterfaceLabelParticipationType=mplsInterfaceLabelParticipationType, mplsInSegmentMapLabelPtrIndex=mplsInSegmentMapLabelPtrIndex, mplsInSegmentRowStatus=mplsInSegmentRowStatus, mplsInSegmentOwner=mplsInSegmentOwner, mplsInSegmentNPop=mplsInSegmentNPop, mplsInSegmentPerfEntry=mplsInSegmentPerfEntry, mplsHCOutSegmentPerfGroup=mplsHCOutSegmentPerfGroup, mplsLabelStackIndexNext=mplsLabelStackIndexNext, mplsOutSegmentPerfPackets=mplsOutSegmentPerfPackets, mplsInSegmentGroup=mplsInSegmentGroup, mplsInSegmentPerfOctets=mplsInSegmentPerfOctets, mplsOutSegmentPushTopLabel=mplsOutSegmentPushTopLabel, PYSNMP_MODULE_ID=mplsLsrStdMIB, mplsOutSegmentXCIndex=mplsOutSegmentXCIndex, mplsOutSegmentInterface=mplsOutSegmentInterface, mplsLsrModuleFullCompliance=mplsLsrModuleFullCompliance, mplsXCLabelStackIndex=mplsXCLabelStackIndex)
|
n = int(input('How many sides the convex polygon have: '))
nd = (n * (n - 3)) / 2
print(f'The convex polygon have {nd} sides.')
|
n = int(input('How many sides the convex polygon have: '))
nd = n * (n - 3) / 2
print(f'The convex polygon have {nd} sides.')
|
# Minimal django settings to run tests
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ()
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': './sqlite3.db',
}
}
SECRET_KEY = 'alksjdf93jqpijsdaklfjq;3lejqklejlakefjas'
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
MIDDLEWARE_CLASSES = (
'django_seo_js.middleware.HashBangMiddleware',
'django_seo_js.middleware.UserAgentMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
)
INSTALLED_APPS += ('django_seo_js',)
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'django_seo_js'
}
}
SEO_JS_PRERENDER_TOKEN = "123456789"
|
debug = True
template_debug = DEBUG
admins = ()
managers = ADMINS
databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': './sqlite3.db'}}
secret_key = 'alksjdf93jqpijsdaklfjq;3lejqklejlakefjas'
template_loaders = ('django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader')
middleware_classes = ('django_seo_js.middleware.HashBangMiddleware', 'django_seo_js.middleware.UserAgentMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware')
installed_apps = ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles')
installed_apps += ('django_seo_js',)
caches = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'django_seo_js'}}
seo_js_prerender_token = '123456789'
|
#!/usr/bin/env python
TOOL = "tool"
PRECISION = "precision"
RECALL = "recall"
AVG_PRECISION = "avg_precision"
STD_DEV_PRECISION = "std_dev_precision"
SEM_PRECISION = "sem_precision"
AVG_RECALL = "avg_recall"
STD_DEV_RECALL = "std_dev_recall"
SEM_RECALL = "sem_recall"
RI_BY_BP = "rand_index_by_bp"
RI_BY_SEQ = "rand_index_by_seq"
ARI_BY_BP = "a_rand_index_by_bp"
ARI_BY_SEQ = "a_rand_index_by_seq"
PERCENTAGE_ASSIGNED_BPS = "percent_assigned_bps"
abbreviations = {'avg_precision': 'precision averaged over genome bins',
'std_dev_precision': 'standard deviation of precision averaged over genome bins',
'sem_precision': 'standard error of the mean of precision averaged over genome bins',
'avg_recall': 'recall averaged over genome bins',
'std_dev_recall': 'standard deviation of recall averaged over genome bins',
'sem_recall': 'standard error of the mean of recall averaged over genome bins',
'precision': 'precision weighed by base pairs',
'recall': 'recall weighed by base pairs',
'rand_index_by_bp': 'Rand index weighed by base pairs',
'rand_index_by_seq': 'Rand index weighed by sequence counts',
'a_rand_index_by_bp': 'adjusted Rand index weighed by base pairs',
'a_rand_index_by_seq': 'adjusted Rand index weighed by sequence counts',
'percent_assigned_bps': 'percentage of base pairs that were assigned to bins',
'>0.5compl<0.1cont': 'number of genomes with more than 50% completeness and less than 10% contamination',
'>0.7compl<0.1cont': 'number of genomes with more than 70% completeness and less than 10% contamination',
'>0.9compl<0.1cont': 'number of genomes with more than 90% completeness and less than 10% contamination',
'>0.5compl<0.05cont': 'number of genomes with more than 50% completeness and less than 5% contamination',
'>0.7compl<0.05cont': 'number of genomes with more than 70% completeness and less than 5% contamination',
'>0.9compl<0.05cont': 'number of genomes with more than 90% completeness and less than 5% contamination'}
|
tool = 'tool'
precision = 'precision'
recall = 'recall'
avg_precision = 'avg_precision'
std_dev_precision = 'std_dev_precision'
sem_precision = 'sem_precision'
avg_recall = 'avg_recall'
std_dev_recall = 'std_dev_recall'
sem_recall = 'sem_recall'
ri_by_bp = 'rand_index_by_bp'
ri_by_seq = 'rand_index_by_seq'
ari_by_bp = 'a_rand_index_by_bp'
ari_by_seq = 'a_rand_index_by_seq'
percentage_assigned_bps = 'percent_assigned_bps'
abbreviations = {'avg_precision': 'precision averaged over genome bins', 'std_dev_precision': 'standard deviation of precision averaged over genome bins', 'sem_precision': 'standard error of the mean of precision averaged over genome bins', 'avg_recall': 'recall averaged over genome bins', 'std_dev_recall': 'standard deviation of recall averaged over genome bins', 'sem_recall': 'standard error of the mean of recall averaged over genome bins', 'precision': 'precision weighed by base pairs', 'recall': 'recall weighed by base pairs', 'rand_index_by_bp': 'Rand index weighed by base pairs', 'rand_index_by_seq': 'Rand index weighed by sequence counts', 'a_rand_index_by_bp': 'adjusted Rand index weighed by base pairs', 'a_rand_index_by_seq': 'adjusted Rand index weighed by sequence counts', 'percent_assigned_bps': 'percentage of base pairs that were assigned to bins', '>0.5compl<0.1cont': 'number of genomes with more than 50% completeness and less than 10% contamination', '>0.7compl<0.1cont': 'number of genomes with more than 70% completeness and less than 10% contamination', '>0.9compl<0.1cont': 'number of genomes with more than 90% completeness and less than 10% contamination', '>0.5compl<0.05cont': 'number of genomes with more than 50% completeness and less than 5% contamination', '>0.7compl<0.05cont': 'number of genomes with more than 70% completeness and less than 5% contamination', '>0.9compl<0.05cont': 'number of genomes with more than 90% completeness and less than 5% contamination'}
|
# parameters used in experiment
# ==============================================================================
# optitrack communication ip (win10 is the server, the ubuntu receiving data is client)
# ==============================================================================
ip_win10 = '192.168.1.5'
ip_ubuntu_pc = '192.168.1.3'
# ==============================================================================
# Local lidar ports
# ==============================================================================
LIDAR_PORT1 = '/dev/ttyUSB0'
LIDAR_PORT2 = '/dev/ttyUSB1'
LIDAR_PORT3 = '/dev/ttyUSB2'
LIDAR_PORT4 = '/dev/ttyUSB3'
LIDAR_PORTs = [LIDAR_PORT1, LIDAR_PORT2, LIDAR_PORT3]
# ==============================================================================
# Parameters used in calibration
# ==============================================================================
# [t1, t2], rmax: car is in the lidar field of view [t1,t2] within range of rmax
# where the lidar measurements is in [0, 360 deg]
CarToLidar1FoV = dict(FoVs=[[0,40], [320, 360]], rmax=1400)
CarToLidar2FoV = dict(FoVs=[[0,40], [320, 360]], rmax=1400)
CarToLidar3FoV = dict(FoVs=[[0,40], [320, 360]], rmax=1400)
CarToLidarFoVs = [CarToLidar1FoV, CarToLidar2FoV, CarToLidar3FoV]
DistanceThreshold = [[0.2, 0.22], [0.11,0.14], [0.0, 0.06]] #range of l2 error between lidar and optitrack estimation in [meter]
HardErrBound = [0.1, 10] # hard max error bound
|
ip_win10 = '192.168.1.5'
ip_ubuntu_pc = '192.168.1.3'
lidar_port1 = '/dev/ttyUSB0'
lidar_port2 = '/dev/ttyUSB1'
lidar_port3 = '/dev/ttyUSB2'
lidar_port4 = '/dev/ttyUSB3'
lidar_por_ts = [LIDAR_PORT1, LIDAR_PORT2, LIDAR_PORT3]
car_to_lidar1_fo_v = dict(FoVs=[[0, 40], [320, 360]], rmax=1400)
car_to_lidar2_fo_v = dict(FoVs=[[0, 40], [320, 360]], rmax=1400)
car_to_lidar3_fo_v = dict(FoVs=[[0, 40], [320, 360]], rmax=1400)
car_to_lidar_fo_vs = [CarToLidar1FoV, CarToLidar2FoV, CarToLidar3FoV]
distance_threshold = [[0.2, 0.22], [0.11, 0.14], [0.0, 0.06]]
hard_err_bound = [0.1, 10]
|
Vocales = ("a","e","i","o","u", " ")
texto = input("Ingresar el texto: ")
texto_nuevo = 0
for letters in texto:
if letters not in Vocales:
texto_nuevo = texto_nuevo + 1
print("El numero de consonantes es: ", texto_nuevo)
|
vocales = ('a', 'e', 'i', 'o', 'u', ' ')
texto = input('Ingresar el texto: ')
texto_nuevo = 0
for letters in texto:
if letters not in Vocales:
texto_nuevo = texto_nuevo + 1
print('El numero de consonantes es: ', texto_nuevo)
|
FILE_PATH = "data/cows.mp4"
MODEL_PATH = "model/mobilenet_v2_ssd_coco_frozen_graph.pb"
CONFIG_PATH = "model/mobilenet_v2_ssd_coco_config.pbtxt"
LABEL_PATH = "model/coco_class_labels.txt"
WINDOW_NAME = "detection"
MIN_CONF = 0.4
MAX_IOU = 0.5
|
file_path = 'data/cows.mp4'
model_path = 'model/mobilenet_v2_ssd_coco_frozen_graph.pb'
config_path = 'model/mobilenet_v2_ssd_coco_config.pbtxt'
label_path = 'model/coco_class_labels.txt'
window_name = 'detection'
min_conf = 0.4
max_iou = 0.5
|
'''
data structures that used executive architecture
'''
class Command(object):
def __init__(self, Name, Payload):
self.Name = Name
self.Payload = Payload
class Gesture(object):
def __init__(self, ID, NAME, LastTimeSync,
IterableGesture, NumberOfGestureRepetitions,
NumberOfMotions, ListActions):
self.ID = ID
self.NAME = NAME
self.LastTimeSync = LastTimeSync
self.IterableGesture = IterableGesture
self.NumberOfGestureRepetitions = NumberOfGestureRepetitions
self.NumberOfMotions = NumberOfMotions
self.ListActions = ListActions
class GestureAction(object):
def __init__(self, PointerFingerPosition, MiddleFingerPosition, RingFinderPosition,
LittleFingerPosition, ThumbFingerPosition, Delay):
self.PointerFingerPosition = PointerFingerPosition
self.MiddleFingerPosition = MiddleFingerPosition
self.RingFinderPosition = RingFinderPosition
self.LittleFingerPosition = LittleFingerPosition
self.ThumbFingerPosition = ThumbFingerPosition
self.Delay = Delay
|
"""
data structures that used executive architecture
"""
class Command(object):
def __init__(self, Name, Payload):
self.Name = Name
self.Payload = Payload
class Gesture(object):
def __init__(self, ID, NAME, LastTimeSync, IterableGesture, NumberOfGestureRepetitions, NumberOfMotions, ListActions):
self.ID = ID
self.NAME = NAME
self.LastTimeSync = LastTimeSync
self.IterableGesture = IterableGesture
self.NumberOfGestureRepetitions = NumberOfGestureRepetitions
self.NumberOfMotions = NumberOfMotions
self.ListActions = ListActions
class Gestureaction(object):
def __init__(self, PointerFingerPosition, MiddleFingerPosition, RingFinderPosition, LittleFingerPosition, ThumbFingerPosition, Delay):
self.PointerFingerPosition = PointerFingerPosition
self.MiddleFingerPosition = MiddleFingerPosition
self.RingFinderPosition = RingFinderPosition
self.LittleFingerPosition = LittleFingerPosition
self.ThumbFingerPosition = ThumbFingerPosition
self.Delay = Delay
|
class Pattern:
"""
This class is used for N:M conversions.
"""
def __init__(self, name=""):
"""
Patterns are described by the components which make up the pattern
and the connections between those components.
"""
#
# Pattern name is used in the conversion rules
#
# Example: *Boost => Boost
# pattern name => Typhoon component type
self.name = name.strip()
# Components dict holds the type names of the
# components which will be converted, under a
# key which the user defines. This key is to be
# used later on in the conversion to reference
# exactly that one component which is being
# consumed for this pattern conversion.
# Example:
# {"M":"MOSFET",
# "D":"DIODE"}
self.components = {}
# Connections list holds the connections
# between components which must exist in order
# for the components to be matched with this pattern
self.connections = []
def __str__(self):
return f"{self.name}"
def __repr__(self):
return self.__str__()
class Rule:
"""
This class defines the conversion rules.
"""
def __init__(self,
source_type: str = "",
typhoon_type: str = "",
pattern_match: bool = False):
self.source_type = source_type.strip()
self.typhoon_type = typhoon_type.strip()
self.pattern_match = pattern_match
self.properties = []
# components = {"handle":{"type":"type_name1".
# "properties":["name":"value"],
# "}
# "connections":[{"start_handle":"terminal", "end_handle":"terminal"},
# {"start_handle":"terminal", "end_handle":"terminal"}],
# "ports":}
self.components = {}
self.connections = []
self.ports = {}
self.terminals = {}
self.predicates = []
def __str__(self):
return f"{self.source_type} -> {self.typhoon_type}"
def __repr__(self):
return self.__str__()
class Connection:
"""
This class is used to describe the connections
between components in pattern matches
"""
def __init__(self,
start_handle: str,
start_terminal: str,
end_handle: str,
end_terminal: str):
"""
Connection objects contain start and end terminals,
described by dicts. The keys are the user defined
names of component types in the pattern, and the values
are terminal keys of the matched component objects.
If both start and end terminals are in the same node,
the parent components of these terminals are matched
to the pattern.
Args:
start_handle (str): handle of the component -
the user defined name of
the component type
defined in the pattern
start_terminal (str): actual terminal key of
the component object's
terminal
end_handle (str): handle of the component -
the user defined name of
the component type defined
in the pattern
end_terminal (str): actual terminal key of
the component object's terminal
"""
self.start_handle = start_handle
self.start_terminal = start_terminal
self.end_handle = end_handle
self.end_terminal = end_terminal
def __str__(self):
return f"{self.start_handle}:{self.start_terminal} -> " \
f"{self.end_handle}:{self.end_terminal}"
def __repr__(self):
return self.__str__()
class Property:
"""
This class is used for describing properties within conversion rules.
These are the valid use cases:
1.) The property is a string value
2.) The property is a numeric value
3.) The property is a reference to another Component's property
4.) The property is the return value of a user defined function
"""
def __init__(self, prop_type="str", name="", value=None):
"""
Args:
type (str): type of the property - str/float/ref/func
name (str): name of the property of the Typhoon component
value: value of the property - either a string or a float
"""
self.name = name.strip()
self.prop_type = prop_type
self.value = value
self.params = {}
def __str__(self):
return f"{self.name} ({self.prop_type}) = {self.value} ({self.params})"
def __repr__(self):
return self.__str__()
class Predicate:
"""
This class is used to describe additional conditions
of component conversion, and is instantiated when
a conversion rule is annotated in the rule file.
A comparison of the component's property (property_name)
is done with the condition value, via the operator
(greater, lesser, equal, and their combinations).
"""
def __init__(self,
property_name: str,
operator: str,
condition_value: (str, float, int)):
self.property_name = property_name.strip()
condition_value = condition_value.strip()
if operator == ">":
self.operator = "gt"
elif operator == "<":
self.operator = "lt"
elif operator == "==":
self.operator = "eq"
elif operator == ">=":
self.operator = "gteq"
elif operator == "<=":
self.operator = "lteq"
else:
raise Exception("Predicate operators must be "
"either >, <, ==, >= or <= .")
try:
self.condition_value = float(condition_value)
except ValueError:
if self.operator == "eq":
self.condition_value = condition_value.strip("\"")
else:
raise Exception("Predicate operator must be '==' "
"for correct string comparison.")
def evaluate(self, component):
if component is None:
raise Exception("Cannot evaluate predicate on None type object.")
component_property_value = component.properties.get(self.property_name,
None)
if component_property_value is None:
return False
try:
if self.operator == "gt":
return component_property_value > self.condition_value
elif self.operator == "lt":
return component_property_value < self.condition_value
elif self.operator == "eq":
return component_property_value == self.condition_value
elif self.operator == "gteq":
return component_property_value >= self.condition_value
elif self.operator == "ltgt":
return component_property_value <= self.condition_value
except TypeError as e:
return False
|
class Pattern:
"""
This class is used for N:M conversions.
"""
def __init__(self, name=''):
"""
Patterns are described by the components which make up the pattern
and the connections between those components.
"""
self.name = name.strip()
self.components = {}
self.connections = []
def __str__(self):
return f'{self.name}'
def __repr__(self):
return self.__str__()
class Rule:
"""
This class defines the conversion rules.
"""
def __init__(self, source_type: str='', typhoon_type: str='', pattern_match: bool=False):
self.source_type = source_type.strip()
self.typhoon_type = typhoon_type.strip()
self.pattern_match = pattern_match
self.properties = []
self.components = {}
self.connections = []
self.ports = {}
self.terminals = {}
self.predicates = []
def __str__(self):
return f'{self.source_type} -> {self.typhoon_type}'
def __repr__(self):
return self.__str__()
class Connection:
"""
This class is used to describe the connections
between components in pattern matches
"""
def __init__(self, start_handle: str, start_terminal: str, end_handle: str, end_terminal: str):
"""
Connection objects contain start and end terminals,
described by dicts. The keys are the user defined
names of component types in the pattern, and the values
are terminal keys of the matched component objects.
If both start and end terminals are in the same node,
the parent components of these terminals are matched
to the pattern.
Args:
start_handle (str): handle of the component -
the user defined name of
the component type
defined in the pattern
start_terminal (str): actual terminal key of
the component object's
terminal
end_handle (str): handle of the component -
the user defined name of
the component type defined
in the pattern
end_terminal (str): actual terminal key of
the component object's terminal
"""
self.start_handle = start_handle
self.start_terminal = start_terminal
self.end_handle = end_handle
self.end_terminal = end_terminal
def __str__(self):
return f'{self.start_handle}:{self.start_terminal} -> {self.end_handle}:{self.end_terminal}'
def __repr__(self):
return self.__str__()
class Property:
"""
This class is used for describing properties within conversion rules.
These are the valid use cases:
1.) The property is a string value
2.) The property is a numeric value
3.) The property is a reference to another Component's property
4.) The property is the return value of a user defined function
"""
def __init__(self, prop_type='str', name='', value=None):
"""
Args:
type (str): type of the property - str/float/ref/func
name (str): name of the property of the Typhoon component
value: value of the property - either a string or a float
"""
self.name = name.strip()
self.prop_type = prop_type
self.value = value
self.params = {}
def __str__(self):
return f'{self.name} ({self.prop_type}) = {self.value} ({self.params})'
def __repr__(self):
return self.__str__()
class Predicate:
"""
This class is used to describe additional conditions
of component conversion, and is instantiated when
a conversion rule is annotated in the rule file.
A comparison of the component's property (property_name)
is done with the condition value, via the operator
(greater, lesser, equal, and their combinations).
"""
def __init__(self, property_name: str, operator: str, condition_value: (str, float, int)):
self.property_name = property_name.strip()
condition_value = condition_value.strip()
if operator == '>':
self.operator = 'gt'
elif operator == '<':
self.operator = 'lt'
elif operator == '==':
self.operator = 'eq'
elif operator == '>=':
self.operator = 'gteq'
elif operator == '<=':
self.operator = 'lteq'
else:
raise exception('Predicate operators must be either >, <, ==, >= or <= .')
try:
self.condition_value = float(condition_value)
except ValueError:
if self.operator == 'eq':
self.condition_value = condition_value.strip('"')
else:
raise exception("Predicate operator must be '==' for correct string comparison.")
def evaluate(self, component):
if component is None:
raise exception('Cannot evaluate predicate on None type object.')
component_property_value = component.properties.get(self.property_name, None)
if component_property_value is None:
return False
try:
if self.operator == 'gt':
return component_property_value > self.condition_value
elif self.operator == 'lt':
return component_property_value < self.condition_value
elif self.operator == 'eq':
return component_property_value == self.condition_value
elif self.operator == 'gteq':
return component_property_value >= self.condition_value
elif self.operator == 'ltgt':
return component_property_value <= self.condition_value
except TypeError as e:
return False
|
# Description: Count number of *.mtz files in current directory.
# Source: placeHolder
"""
cmd.do('print("Count the number of mtz structure factor files in current directory.");')
cmd.do('print("Usage: cntmtzs");')
cmd.do('myPath = os.getcwd();')
cmd.do('mtzCounter = len(glob.glob1(myPath,"*.mtz"));')
cmd.do('print("Number of number of mtz structure factor files in the current directory: ", mtzCounter);')
"""
cmd.do('print("Count the number of mtz structure factor files in current directory.");')
cmd.do('print("Usage: cntmtzs");')
cmd.do('myPath = os.getcwd();')
cmd.do('mtzCounter = len(glob.glob1(myPath,"*.mtz"));')
cmd.do('print("Number of number of mtz structure factor files in the current directory: ", mtzCounter);')
|
"""
cmd.do('print("Count the number of mtz structure factor files in current directory.");')
cmd.do('print("Usage: cntmtzs");')
cmd.do('myPath = os.getcwd();')
cmd.do('mtzCounter = len(glob.glob1(myPath,"*.mtz"));')
cmd.do('print("Number of number of mtz structure factor files in the current directory: ", mtzCounter);')
"""
cmd.do('print("Count the number of mtz structure factor files in current directory.");')
cmd.do('print("Usage: cntmtzs");')
cmd.do('myPath = os.getcwd();')
cmd.do('mtzCounter = len(glob.glob1(myPath,"*.mtz"));')
cmd.do('print("Number of number of mtz structure factor files in the current directory: ", mtzCounter);')
|
'''FreeProxy exceptions module'''
class FreeProxyException(Exception):
'''Exception class with message as a required parameter'''
def __init__(self, message) -> None:
self.message = message
super().__init__(self.message)
|
"""FreeProxy exceptions module"""
class Freeproxyexception(Exception):
"""Exception class with message as a required parameter"""
def __init__(self, message) -> None:
self.message = message
super().__init__(self.message)
|
__all__ = ["SENTINEL1_COLLECTION_ID", "VV", "VH", "IW", "ASCENDING", "DESCENDING"]
SENTINEL1_COLLECTION_ID = "COPERNICUS/S1_GRD_FLOAT"
VV = "VV"
VH = "VH"
IW = "IW"
ASCENDING = "ASCENDING"
DESCENDING = "DESCENDING"
GEE_PROPERTIES = [
"system:id",
"sliceNumber",
"system:time_start",
"relativeOrbitNumber_start",
"relativeOrbitNumber_stop",
"orbitNumber_start",
"orbitNumber_stop",
"instrumentConfigurationID",
"system:asset_size",
"cycleNumber",
]
|
__all__ = ['SENTINEL1_COLLECTION_ID', 'VV', 'VH', 'IW', 'ASCENDING', 'DESCENDING']
sentinel1_collection_id = 'COPERNICUS/S1_GRD_FLOAT'
vv = 'VV'
vh = 'VH'
iw = 'IW'
ascending = 'ASCENDING'
descending = 'DESCENDING'
gee_properties = ['system:id', 'sliceNumber', 'system:time_start', 'relativeOrbitNumber_start', 'relativeOrbitNumber_stop', 'orbitNumber_start', 'orbitNumber_stop', 'instrumentConfigurationID', 'system:asset_size', 'cycleNumber']
|
def problem303():
"""
# This function computes and returns the smallest positive multiple of n such that the result
# uses only the digits 0, 1, 2 in base 10. For example, fmm(2) = 2, fmm(3) = 12, fmm(5) = 10.
As an overview, the algorithm has two phases:
# 0. Determine whether a k-digit solution is possible, for increasing values of k.
# 1. Knowing that a k-digit solution exists, construct the minimum solution.
Let n >= 1 be an arbitrary integer that will remain constant for the rest of the explanation.
When we look at the set of all k-digit numbers using only the digits {0, 1, 2}
# (with possible leading zeros), each number will have a particular remainder modulo n.
# For example, the set of 3-digit numbers is {000, 001, 002, 010, ..., 120, ..., 221, 222} (having 3^3 = 27 elements).
# If one of these numbers is congruent to 0 mod n, then a solution to the original problem exists.
# If not, then we prepend the digits 0, 1, 2 to all the numbers to get the set of all 4-digit numbers.
The size of the set of k-digit numbers grows exponentially with the length k, but we can avoid constructing and
# working with the explicit set of numbers. Instead, we only need to keep track of whether each remainder modulo n has
# a number that generates it or not. But we also need to exclude 0 as a solution, even though it is a multiple of n.
For 0-digit numbers, the only possible remainder is 0. All other remainders modulo n are impossible.
# For 1-digit numbers, we look at all the possible 0-digit number remainders. If a remainder m is possible, then:
# - By prepending the digit 0, a remainder of (m + 0*1 mod n) is possible for 1-digit numbers.
# - By prepending the digit 1, a remainder of (m + 1*1 mod n) is possible for 1-digit numbers.
# - By prepending the digit 2, a remainder of (m + 2*1 mod n) is possible for 1-digit numbers.
# We keep iterating this process of tracking possible remainders for k-digit
# numbers until the remainder of 0 mod n is possible in a non-zero number.
Now we know that a k-digit solution exists, such that the k-digit number consists of only {0, 1, 2},
# and the number is congruent to 0 modulo n. To construct the minimum solution, we start at the most significant
# digit of the result, choose the lowest possible value, and work backward toward the least significant digit.
The leading digit must be 1 or 2, because if it were 0 then it would contradict the fact that
# no solution shorter than k digits exists. All subsequent digits can possibly be 0, 1, or 2.
At each value place, we choose the lowest digit value out of {0, 1, 2} such that there still
# exists a solution for the remaining suffix of the number. When we choose a value at a certain
# digit position, say 2 at the 8th place, we subtract 2 * 10^8 mod n from the ongoing remainder.
"""
def find_minimum_multiple(n):
# feasible[i][j] indicates whether there exists an i-digit number that consists of
# only the digits {0, 1, 2} (with possible leading zeros) having a remainder of j modulo n:
# - 0: No i-digit number can form this remainder
# - 1: Only zero can form this remainder
# - 2: Some non-zero number can form this remainder
# Initialization and base case
feasible = [[1] + [0] * (n - 1)]
# Add digits on the left side until a solution exists, using dynamic programming
i = 0
while feasible[i][0] != 2: # Unbounded loop
assert i == len(feasible) - 1
prev = feasible[i]
cur = list(prev) # Clone
digitmod = pow(10, i, n)
for j in range(n): # Run time of O(n)
if prev[j] > 0:
cur[(j + digitmod * 1) % n] = 2
cur[(j + digitmod * 2) % n] = 2
feasible.append(cur)
i += 1
# Construct the smallest solution using the Memoized table
# Run time of O(len(feasible)) bigint operations
result = 0
remainder = 0 # Modulo n
# Pick digit values from left (most significant) to right
for i in reversed(range(len(feasible) - 1)):
digitmod = pow(10, i, n)
# Leading digit must start searching at 1; subsequent digits start searching at 0
for j in range((1 if (i == len(feasible) - 2) else 0), 3):
newrem = (remainder - digitmod * j) % n
if feasible[i][newrem] > 0:
result = result * 10 + j
remainder = newrem
break
else:
raise AssertionError()
return result
ans = sum(find_minimum_multiple(n) // n for n in range(1, 10001))
return ans
if __name__ == "__main__":
print(problem303())
|
def problem303():
"""
# This function computes and returns the smallest positive multiple of n such that the result
# uses only the digits 0, 1, 2 in base 10. For example, fmm(2) = 2, fmm(3) = 12, fmm(5) = 10.
As an overview, the algorithm has two phases:
# 0. Determine whether a k-digit solution is possible, for increasing values of k.
# 1. Knowing that a k-digit solution exists, construct the minimum solution.
Let n >= 1 be an arbitrary integer that will remain constant for the rest of the explanation.
When we look at the set of all k-digit numbers using only the digits {0, 1, 2}
# (with possible leading zeros), each number will have a particular remainder modulo n.
# For example, the set of 3-digit numbers is {000, 001, 002, 010, ..., 120, ..., 221, 222} (having 3^3 = 27 elements).
# If one of these numbers is congruent to 0 mod n, then a solution to the original problem exists.
# If not, then we prepend the digits 0, 1, 2 to all the numbers to get the set of all 4-digit numbers.
The size of the set of k-digit numbers grows exponentially with the length k, but we can avoid constructing and
# working with the explicit set of numbers. Instead, we only need to keep track of whether each remainder modulo n has
# a number that generates it or not. But we also need to exclude 0 as a solution, even though it is a multiple of n.
For 0-digit numbers, the only possible remainder is 0. All other remainders modulo n are impossible.
# For 1-digit numbers, we look at all the possible 0-digit number remainders. If a remainder m is possible, then:
# - By prepending the digit 0, a remainder of (m + 0*1 mod n) is possible for 1-digit numbers.
# - By prepending the digit 1, a remainder of (m + 1*1 mod n) is possible for 1-digit numbers.
# - By prepending the digit 2, a remainder of (m + 2*1 mod n) is possible for 1-digit numbers.
# We keep iterating this process of tracking possible remainders for k-digit
# numbers until the remainder of 0 mod n is possible in a non-zero number.
Now we know that a k-digit solution exists, such that the k-digit number consists of only {0, 1, 2},
# and the number is congruent to 0 modulo n. To construct the minimum solution, we start at the most significant
# digit of the result, choose the lowest possible value, and work backward toward the least significant digit.
The leading digit must be 1 or 2, because if it were 0 then it would contradict the fact that
# no solution shorter than k digits exists. All subsequent digits can possibly be 0, 1, or 2.
At each value place, we choose the lowest digit value out of {0, 1, 2} such that there still
# exists a solution for the remaining suffix of the number. When we choose a value at a certain
# digit position, say 2 at the 8th place, we subtract 2 * 10^8 mod n from the ongoing remainder.
"""
def find_minimum_multiple(n):
feasible = [[1] + [0] * (n - 1)]
i = 0
while feasible[i][0] != 2:
assert i == len(feasible) - 1
prev = feasible[i]
cur = list(prev)
digitmod = pow(10, i, n)
for j in range(n):
if prev[j] > 0:
cur[(j + digitmod * 1) % n] = 2
cur[(j + digitmod * 2) % n] = 2
feasible.append(cur)
i += 1
result = 0
remainder = 0
for i in reversed(range(len(feasible) - 1)):
digitmod = pow(10, i, n)
for j in range(1 if i == len(feasible) - 2 else 0, 3):
newrem = (remainder - digitmod * j) % n
if feasible[i][newrem] > 0:
result = result * 10 + j
remainder = newrem
break
else:
raise assertion_error()
return result
ans = sum((find_minimum_multiple(n) // n for n in range(1, 10001)))
return ans
if __name__ == '__main__':
print(problem303())
|
start = 1
end = 100
for x in range(start,end):
if (x % 2 == 0):
continue
print(x)
|
start = 1
end = 100
for x in range(start, end):
if x % 2 == 0:
continue
print(x)
|
"""
You are given an n x n 2D matrix representing an image. Rotate the matrix 90 degrees clockwise in-place.
Example 1:
[[1, 2, 3], [[7, 4, 1],
[4, 5, 6], -> [8, 5, 2],
[7, 8, 9]], [9, 6, 3]]
Example 2:
[[ 5, 1, 9, 11], [[15, 13, 2, 5],
[ 2, 4, 8, 10], -> [14, 3, 4, 1],
[13, 3, 6, 7], [12, 6, 8, 9],
[15, 14, 12, 16]], [16, 7, 10, 11]]
"""
"""
We work our way through one side of concentrically smaller squares, shifting every side of the square clockwise.
"""
def rotate(matrix):
n = len(matrix)
for row_idx in range(n//2):
for col_idx in range(row_idx, square_size := n-row_idx-1):
diff = col_idx - row_idx
top = matrix[row_idx][col_idx]
matrix[row_idx][col_idx] = matrix[square_size - diff][row_idx] # top from left
matrix[square_size - diff][row_idx] = matrix[square_size][square_size - diff] # left from bottom
matrix[square_size][square_size - diff] = matrix[row_idx + diff][square_size] # bottom from right
matrix[row_idx + diff][square_size] = top # right from top
matrix = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
rotate(matrix)
assert matrix == [[7, 4, 1],
[8, 5, 2],
[9, 6, 3]]
matrix = [[5, 1, 9, 11],
[2, 4, 8, 10],
[13, 3, 6, 7],
[15, 14, 12, 16]]
rotate(matrix)
assert matrix == [[15, 13, 2, 5],
[14, 3, 4, 1],
[12, 6, 8, 9],
[16, 7, 10, 11]]
matrix = [[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]]
rotate(matrix)
assert matrix == [[21, 16, 11, 6, 1],
[22, 17, 12, 7, 2],
[23, 18, 13, 8, 3],
[24, 19, 14, 9, 4],
[25, 20, 15, 10, 5]]
|
"""
You are given an n x n 2D matrix representing an image. Rotate the matrix 90 degrees clockwise in-place.
Example 1:
[[1, 2, 3], [[7, 4, 1],
[4, 5, 6], -> [8, 5, 2],
[7, 8, 9]], [9, 6, 3]]
Example 2:
[[ 5, 1, 9, 11], [[15, 13, 2, 5],
[ 2, 4, 8, 10], -> [14, 3, 4, 1],
[13, 3, 6, 7], [12, 6, 8, 9],
[15, 14, 12, 16]], [16, 7, 10, 11]]
"""
'\nWe work our way through one side of concentrically smaller squares, shifting every side of the square clockwise.\n'
def rotate(matrix):
n = len(matrix)
for row_idx in range(n // 2):
for col_idx in range(row_idx, (square_size := (n - row_idx - 1))):
diff = col_idx - row_idx
top = matrix[row_idx][col_idx]
matrix[row_idx][col_idx] = matrix[square_size - diff][row_idx]
matrix[square_size - diff][row_idx] = matrix[square_size][square_size - diff]
matrix[square_size][square_size - diff] = matrix[row_idx + diff][square_size]
matrix[row_idx + diff][square_size] = top
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
rotate(matrix)
assert matrix == [[7, 4, 1], [8, 5, 2], [9, 6, 3]]
matrix = [[5, 1, 9, 11], [2, 4, 8, 10], [13, 3, 6, 7], [15, 14, 12, 16]]
rotate(matrix)
assert matrix == [[15, 13, 2, 5], [14, 3, 4, 1], [12, 6, 8, 9], [16, 7, 10, 11]]
matrix = [[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]]
rotate(matrix)
assert matrix == [[21, 16, 11, 6, 1], [22, 17, 12, 7, 2], [23, 18, 13, 8, 3], [24, 19, 14, 9, 4], [25, 20, 15, 10, 5]]
|
"""
1356. Sort Integers by The Number of 1 Bits
Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more integers have the same number of 1's you have to sort them in ascending order.
Return the sorted array.
Example 1:
Input: arr = [0,1,2,3,4,5,6,7,8]
Output: [0,1,2,4,8,3,5,6,7]
Explantion: [0] is the only integer with 0 bits.
[1,2,4,8] all have 1 bit.
[3,5,6] have 2 bits.
[7] has 3 bits.
The sorted array by bits is [0,1,2,4,8,3,5,6,7]
Example 2:
Input: arr = [1024,512,256,128,64,32,16,8,4,2,1]
Output: [1,2,4,8,16,32,64,128,256,512,1024]
Explantion: All integers have 1 bit in the binary representation, you should just sort them in ascending order.
Example 3:
Input: arr = [10000,10000]
Output: [10000,10000]
Example 4:
Input: arr = [2,3,5,7,11,13,17,19]
Output: [2,3,5,17,7,11,13,19]
Example 5:
Input: arr = [10,100,1000,10000]
Output: [10,100,10000,1000]
Constraints:
1 <= arr.length <= 500
0 <= arr[i] <= 10^4
"""
class Solution:
def sortByBits(self, arr: List[int]) -> List[int]:
return sorted(arr, key = lambda x: (bin(x).count('1'), x))
|
"""
1356. Sort Integers by The Number of 1 Bits
Given an integer array arr. You have to sort the integers in the array in ascending order by the number of 1's in their binary representation and in case of two or more integers have the same number of 1's you have to sort them in ascending order.
Return the sorted array.
Example 1:
Input: arr = [0,1,2,3,4,5,6,7,8]
Output: [0,1,2,4,8,3,5,6,7]
Explantion: [0] is the only integer with 0 bits.
[1,2,4,8] all have 1 bit.
[3,5,6] have 2 bits.
[7] has 3 bits.
The sorted array by bits is [0,1,2,4,8,3,5,6,7]
Example 2:
Input: arr = [1024,512,256,128,64,32,16,8,4,2,1]
Output: [1,2,4,8,16,32,64,128,256,512,1024]
Explantion: All integers have 1 bit in the binary representation, you should just sort them in ascending order.
Example 3:
Input: arr = [10000,10000]
Output: [10000,10000]
Example 4:
Input: arr = [2,3,5,7,11,13,17,19]
Output: [2,3,5,17,7,11,13,19]
Example 5:
Input: arr = [10,100,1000,10000]
Output: [10,100,10000,1000]
Constraints:
1 <= arr.length <= 500
0 <= arr[i] <= 10^4
"""
class Solution:
def sort_by_bits(self, arr: List[int]) -> List[int]:
return sorted(arr, key=lambda x: (bin(x).count('1'), x))
|
class AggResult:
def __init__(self, agg_key, result=None, return_counts=True):
self.return_counts = return_counts
if result is None:
self.total = 0
self._hits = []
else:
self.total = result['hits']['total']['value']
self._hits = result['aggregations'][agg_key]['buckets']
def __repr__(self):
return "hits {}, total: {}".format(self._hits, self.total)
def __iter__(self):
for hit in self._hits:
row = hit['key']
if self.return_counts:
count = hit['doc_count']
yield {row: count}
else:
yield row
def dict(self):
return {
"total": self.total,
"result": list(self)
}
|
class Aggresult:
def __init__(self, agg_key, result=None, return_counts=True):
self.return_counts = return_counts
if result is None:
self.total = 0
self._hits = []
else:
self.total = result['hits']['total']['value']
self._hits = result['aggregations'][agg_key]['buckets']
def __repr__(self):
return 'hits {}, total: {}'.format(self._hits, self.total)
def __iter__(self):
for hit in self._hits:
row = hit['key']
if self.return_counts:
count = hit['doc_count']
yield {row: count}
else:
yield row
def dict(self):
return {'total': self.total, 'result': list(self)}
|
input = """
a(1).
a(2).
b(1,2).
c(2).
c(3).
q(X,Y) :- a(X), c(Y).
p(X,Y,Z) :- a(X), q(Y,Z), m(X,Z).
m(X,Y) :- a(Z), p(Z,X,Y).
m(X,Y) :- b(X,Y), not n(X,Y).
n(X,Y) :- q(X,Y).
n(X,Y) :- b(X,Y), m(X,Y).
"""
output = """
a(1).
a(2).
b(1,2).
c(2).
c(3).
q(X,Y) :- a(X), c(Y).
p(X,Y,Z) :- a(X), q(Y,Z), m(X,Z).
m(X,Y) :- a(Z), p(Z,X,Y).
m(X,Y) :- b(X,Y), not n(X,Y).
n(X,Y) :- q(X,Y).
n(X,Y) :- b(X,Y), m(X,Y).
"""
|
input = '\na(1).\na(2).\nb(1,2).\nc(2).\nc(3).\n\nq(X,Y) :- a(X), c(Y).\n\np(X,Y,Z) :- a(X), q(Y,Z), m(X,Z).\n\nm(X,Y) :- a(Z), p(Z,X,Y).\n\nm(X,Y) :- b(X,Y), not n(X,Y).\n\nn(X,Y) :- q(X,Y).\n\nn(X,Y) :- b(X,Y), m(X,Y).\n'
output = '\na(1).\na(2).\nb(1,2).\nc(2).\nc(3).\n\nq(X,Y) :- a(X), c(Y).\n\np(X,Y,Z) :- a(X), q(Y,Z), m(X,Z).\n\nm(X,Y) :- a(Z), p(Z,X,Y).\n\nm(X,Y) :- b(X,Y), not n(X,Y).\n\nn(X,Y) :- q(X,Y).\n\nn(X,Y) :- b(X,Y), m(X,Y).\n'
|
class Solution:
def destCity(self, paths: List[List[str]]) -> str:
s = set()
for path in paths:
s.add(path[0])
s.add(path[1])
for path in paths:
s.remove(path[0])
return list(s).pop()
|
class Solution:
def dest_city(self, paths: List[List[str]]) -> str:
s = set()
for path in paths:
s.add(path[0])
s.add(path[1])
for path in paths:
s.remove(path[0])
return list(s).pop()
|
class Solution:
def checkString(self, s: str) -> bool:
flag = 0
for ch in s:
if flag == 0 and ch == 'b':
flag = 1
elif flag == 1 and ch == 'a':
return False
return True
|
class Solution:
def check_string(self, s: str) -> bool:
flag = 0
for ch in s:
if flag == 0 and ch == 'b':
flag = 1
elif flag == 1 and ch == 'a':
return False
return True
|
class Node:
def __init__(self, data=None) -> None:
self.data = data
self.next = None
self.prev = None
class DoublyList:
def __init__(self) -> None:
self.front = None
self.back = None
self.size = 0
def add_back(self, data: int) -> None:
node = Node(data)
if self.is_empty():
self.front = node
self.back = node
else:
self.back.next = node
node.prev = self.back
self.back = node
self.size += 1
def add_front(self, data: int) -> None:
node = Node(data)
if self.is_empty():
self.front = node
self.back = node
else:
node.next = self.front
self.front.prev = node
self.front = node
self.size += 1
def remove(self, data: int) -> None:
if self.is_empty():
raise Exception("Error: list is aleady empty.")
else:
ptr = self.front
while ptr.next is not None:
if (ptr.data == data):
ptr.prev = ptr.prev.prev
ptr.next = ptr.next.next
self.size -= 1
return
ptr = ptr.next
raise Exception("Error: element is not found on the list")
def remove_front(self)->None:
if self.is_empty():
return
else:
self.front = self.front.next
self.size -= 1
def remove_back(self)->None:
if self.is_empty():
return
else:
self.back = self.back.prev
self.size -= 1
def display(self) -> None:
ptr = self.front
while ptr.next is not None:
print(ptr.data)
ptr = ptr.next
def is_empty(self) -> bool:
return self.front is None and self.back is None
def display_reverse(self) -> None:
pass
|
class Node:
def __init__(self, data=None) -> None:
self.data = data
self.next = None
self.prev = None
class Doublylist:
def __init__(self) -> None:
self.front = None
self.back = None
self.size = 0
def add_back(self, data: int) -> None:
node = node(data)
if self.is_empty():
self.front = node
self.back = node
else:
self.back.next = node
node.prev = self.back
self.back = node
self.size += 1
def add_front(self, data: int) -> None:
node = node(data)
if self.is_empty():
self.front = node
self.back = node
else:
node.next = self.front
self.front.prev = node
self.front = node
self.size += 1
def remove(self, data: int) -> None:
if self.is_empty():
raise exception('Error: list is aleady empty.')
else:
ptr = self.front
while ptr.next is not None:
if ptr.data == data:
ptr.prev = ptr.prev.prev
ptr.next = ptr.next.next
self.size -= 1
return
ptr = ptr.next
raise exception('Error: element is not found on the list')
def remove_front(self) -> None:
if self.is_empty():
return
else:
self.front = self.front.next
self.size -= 1
def remove_back(self) -> None:
if self.is_empty():
return
else:
self.back = self.back.prev
self.size -= 1
def display(self) -> None:
ptr = self.front
while ptr.next is not None:
print(ptr.data)
ptr = ptr.next
def is_empty(self) -> bool:
return self.front is None and self.back is None
def display_reverse(self) -> None:
pass
|
class AlmostPrimeNumbers:
def getNext(self, m):
sieve = [True]*(10**6+2)
for i in xrange(2, 10**6+2):
if sieve[i]:
for j in xrange(2*i, 10**6+2, i):
sieve[j] = False
def is_almost(n):
return not sieve[n] and not any(n%i == 0 for i in xrange(2, 11))
i = m+1
while not is_almost(i):
i += 1
return i
|
class Almostprimenumbers:
def get_next(self, m):
sieve = [True] * (10 ** 6 + 2)
for i in xrange(2, 10 ** 6 + 2):
if sieve[i]:
for j in xrange(2 * i, 10 ** 6 + 2, i):
sieve[j] = False
def is_almost(n):
return not sieve[n] and (not any((n % i == 0 for i in xrange(2, 11))))
i = m + 1
while not is_almost(i):
i += 1
return i
|
class LandingType(object):
# For choosing what the main landing page displays
KICKOFF = 1
BUILDSEASON = 2
COMPETITIONSEASON = 3
OFFSEASON = 4
INSIGHTS = 5
CHAMPS = 6
NAMES = {
KICKOFF: 'Kickoff',
BUILDSEASON: 'Build Season',
COMPETITIONSEASON: 'Competition Season',
OFFSEASON: 'Offseason',
INSIGHTS: 'Insights',
CHAMPS: 'Championship',
}
|
class Landingtype(object):
kickoff = 1
buildseason = 2
competitionseason = 3
offseason = 4
insights = 5
champs = 6
names = {KICKOFF: 'Kickoff', BUILDSEASON: 'Build Season', COMPETITIONSEASON: 'Competition Season', OFFSEASON: 'Offseason', INSIGHTS: 'Insights', CHAMPS: 'Championship'}
|
#!/usr/bin/env python
polymer = input()
letters = [ord(c) for c in set(polymer.upper())]
polymer = [ord(c) for c in polymer]
def react(polymer, forbidden=set()):
stack = []
for unit in polymer:
if unit not in forbidden:
if stack and abs(unit - stack[-1]) == 32:
stack.pop()
else:
stack.append(unit)
return len(stack)
assert react(polymer) == 9172
lowest = min([react(polymer, {c, c + 32}) for c in letters])
assert lowest == 6550
|
polymer = input()
letters = [ord(c) for c in set(polymer.upper())]
polymer = [ord(c) for c in polymer]
def react(polymer, forbidden=set()):
stack = []
for unit in polymer:
if unit not in forbidden:
if stack and abs(unit - stack[-1]) == 32:
stack.pop()
else:
stack.append(unit)
return len(stack)
assert react(polymer) == 9172
lowest = min([react(polymer, {c, c + 32}) for c in letters])
assert lowest == 6550
|
HANGMAN_ASCII_ART = ("""
_ _
| | | |
| |__| | __ _ _ __ __ _ _ __ ___ __ _ _ __
| __ |/ _` | '_ \ / _` | '_ ` _ \ / _` | '_ \
| | | | (_| | | | | (_| | | | | | | (_| | | | |
|_| |_|\__,_|_| |_|\__, |_| |_| |_|\__,_|_| |_|
__/ |
|___/
\n""")
MAX_TRIES = 6
print(HANGMAN_ASCII_ART, MAX_TRIES)
"""
HANGMAN GAME ASCII LOGO AND MAX TRIES
"""
|
hangman_ascii_art = "\n _ _ \n | | | | \n | |__| | __ _ _ __ __ _ _ __ ___ __ _ _ __ \n | __ |/ _` | '_ \\ / _` | '_ ` _ \\ / _` | '_ \\ \n | | | | (_| | | | | (_| | | | | | | (_| | | | |\n |_| |_|\\__,_|_| |_|\\__, |_| |_| |_|\\__,_|_| |_|\n __/ | \n |___/\n \n"
max_tries = 6
print(HANGMAN_ASCII_ART, MAX_TRIES)
'\nHANGMAN GAME ASCII LOGO AND MAX TRIES\n'
|
#!/usr/bin/env python3
class colors:
GREEN = '\033[92m'
YELLOW = '\033[93m'
BLUE = '\033[94m'
RED = '\033[91m'
BOLD = '\033[1m'
RESET = '\033[0m'
|
class Colors:
green = '\x1b[92m'
yellow = '\x1b[93m'
blue = '\x1b[94m'
red = '\x1b[91m'
bold = '\x1b[1m'
reset = '\x1b[0m'
|
nombre_usuario = input("Introduce tu nombre de usuario: ")
print("El nombre es:", nombre_usuario)
print("El nombre es:", nombre_usuario.upper())
print("El nombre es:", nombre_usuario.lower())
print("El nombre es:", nombre_usuario.capitalize())
|
nombre_usuario = input('Introduce tu nombre de usuario: ')
print('El nombre es:', nombre_usuario)
print('El nombre es:', nombre_usuario.upper())
print('El nombre es:', nombre_usuario.lower())
print('El nombre es:', nombre_usuario.capitalize())
|
class Node:
def __init__(self, value=None):
self.value = value
self.next = None
def __str__(self):
return str(self.value)
class LinkedList:
def __init__(self):
self.head = None
self.tail = None
def __iter__(self):
node = self.head
while node != None:
yield node
node = node.next
class Queue:
def __init__(self):
self.linkedList = LinkedList()
def __str__(self):
values = [str(x) for x in self.linkedList]
return ' '.join(values)
def enqueue(self, value):
newNode = Node(value)
if self.linkedList.head == None:
self.linkedList.head = newNode
self.linkedList.tail = newNode
else:
self.linkedList.tail.next = newNode
self.linkedList.tail = newNode
def isEmpty(self):
if self.linkedList.head == None:
return True
else:
return False
def dequeue(self):
if self.isEmpty() == True:
return "There is not any node in the Queue"
else:
tempNode = self.linkedList.head
if self.linkedList.head == self.linkedList.tail:
self.linkedList.head = None
self.linkedList.tail = None
else:
self.linkedList.head = self.linkedList.head.next
return tempNode
def peek(self):
if self.isEmpty() == True:
return "There is not any node in the Queue"
else:
return self.linkedList.head.value
def delete(self):
if self.isEmpty() == True:
return "There is not any node in the Queue"
else:
self.linkedList.head = None
self.linkedList.tail = None
|
class Node:
def __init__(self, value=None):
self.value = value
self.next = None
def __str__(self):
return str(self.value)
class Linkedlist:
def __init__(self):
self.head = None
self.tail = None
def __iter__(self):
node = self.head
while node != None:
yield node
node = node.next
class Queue:
def __init__(self):
self.linkedList = linked_list()
def __str__(self):
values = [str(x) for x in self.linkedList]
return ' '.join(values)
def enqueue(self, value):
new_node = node(value)
if self.linkedList.head == None:
self.linkedList.head = newNode
self.linkedList.tail = newNode
else:
self.linkedList.tail.next = newNode
self.linkedList.tail = newNode
def is_empty(self):
if self.linkedList.head == None:
return True
else:
return False
def dequeue(self):
if self.isEmpty() == True:
return 'There is not any node in the Queue'
else:
temp_node = self.linkedList.head
if self.linkedList.head == self.linkedList.tail:
self.linkedList.head = None
self.linkedList.tail = None
else:
self.linkedList.head = self.linkedList.head.next
return tempNode
def peek(self):
if self.isEmpty() == True:
return 'There is not any node in the Queue'
else:
return self.linkedList.head.value
def delete(self):
if self.isEmpty() == True:
return 'There is not any node in the Queue'
else:
self.linkedList.head = None
self.linkedList.tail = None
|
RELEVANT_COLUMNS = [
"HONG KONG",
"JAPAN",
"CANADA",
"FINLAND",
"DENMARK",
"ESTONIA",
"POLAND",
"CZECH REPUBLIC",
"SLOVENIA and BALKANs",
"ITALY",
"SPAIN",
"SWITZERLAND",
"BENELUX",
"UK",
"ISLAND",
"USA Wholesale",
"Germany/ Austria",
"Sweden/ Norway",
"Store",
"Marketplaces (AZ+ ZA)",
"Webshop (INK US, CAN, FIN)",
]
def forecasts_handler(iterator):
for row in iterator:
if row["Article number "] == "":
continue
else:
for col in RELEVANT_COLUMNS:
try:
row[col] = int(row[col].replace(" ", ""))
except:
row[col] = 0
yield {
"Article_number": row["Article number "],
"Distribution_ID": col,
"Quantity": row[col],
}
|
relevant_columns = ['HONG KONG', 'JAPAN', 'CANADA', 'FINLAND', 'DENMARK', 'ESTONIA', 'POLAND', 'CZECH REPUBLIC', 'SLOVENIA and BALKANs', 'ITALY', 'SPAIN', 'SWITZERLAND', 'BENELUX', 'UK', 'ISLAND', 'USA Wholesale', 'Germany/ Austria', 'Sweden/ Norway', 'Store', 'Marketplaces (AZ+ ZA)', 'Webshop (INK US, CAN, FIN)']
def forecasts_handler(iterator):
for row in iterator:
if row['Article number '] == '':
continue
else:
for col in RELEVANT_COLUMNS:
try:
row[col] = int(row[col].replace(' ', ''))
except:
row[col] = 0
yield {'Article_number': row['Article number '], 'Distribution_ID': col, 'Quantity': row[col]}
|
'''
Author : MiKueen
Level : Hard
Company : Stripe
Problem Statement : First Missing Positive
Given an array of integers, find the first missing positive integer in linear time and constant space.
In other words, find the lowest positive integer that does not exist in the array.
The array can contain duplicates and negative numbers as well.
For example, the input [3, 4, -1, 1] should give 2. The input [1, 2, 0] should give 3.
You can modify the input array in-place.
'''
def firstMissingPositive(nums):
"""
:type nums: List[int]
:rtype: int
"""
# Method 1: Changing array values
# mark those elements who aren't in the range of [1, n]
n = len(nums)
for i in range(n):
if nums[i] <= 0 or nums[i] > n:
nums[i] = n + 1
# mark visited elements as negative
for i in range(n):
if (abs(nums[i]) - 1 < n and nums[abs(nums[i]) - 1] > 0):
nums[abs(nums[i]) - 1] = -nums[abs(nums[i]) - 1]
# find first positive/unmarked element and return its index
for i in range(n):
if (nums[i] > 0):
return i + 1
# if all elements are negative/marked means all elements are in the range of [1, n]
return n + 1
'''
# Method 2: Changing position of elements
n = len(nums)
for i in range(n):
pos = nums[i] - 1
while 1 <= nums[i] <= n and nums[i] != nums[pos]:
nums[i], nums[pos] = nums[pos], nums[i]
pos = nums[i] - 1
for i in range(n):
if nums[i] != i + 1:
return i + 1
return n + 1
'''
|
"""
Author : MiKueen
Level : Hard
Company : Stripe
Problem Statement : First Missing Positive
Given an array of integers, find the first missing positive integer in linear time and constant space.
In other words, find the lowest positive integer that does not exist in the array.
The array can contain duplicates and negative numbers as well.
For example, the input [3, 4, -1, 1] should give 2. The input [1, 2, 0] should give 3.
You can modify the input array in-place.
"""
def first_missing_positive(nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums)
for i in range(n):
if nums[i] <= 0 or nums[i] > n:
nums[i] = n + 1
for i in range(n):
if abs(nums[i]) - 1 < n and nums[abs(nums[i]) - 1] > 0:
nums[abs(nums[i]) - 1] = -nums[abs(nums[i]) - 1]
for i in range(n):
if nums[i] > 0:
return i + 1
return n + 1
'\n # Method 2: Changing position of elements\n n = len(nums)\n for i in range(n):\n pos = nums[i] - 1\n while 1 <= nums[i] <= n and nums[i] != nums[pos]:\n nums[i], nums[pos] = nums[pos], nums[i]\n pos = nums[i] - 1\n \n for i in range(n):\n if nums[i] != i + 1:\n return i + 1\n return n + 1\n '
|
#*****************************************************************************#
#* Copyright (c) 2004-2008, SRI International. *#
#* All rights reserved. *#
#* *#
#* Redistribution and use in source and binary forms, with or without *#
#* modification, are permitted provided that the following conditions are *#
#* met: *#
#* * Redistributions of source code must retain the above copyright *#
#* notice, this list of conditions and the following disclaimer. *#
#* * Redistributions in binary form must reproduce the above copyright *#
#* notice, this list of conditions and the following disclaimer in the *#
#* documentation and/or other materials provided with the distribution. *#
#* * Neither the name of SRI International nor the names of its *#
#* contributors may be used to endorse or promote products derived from *#
#* this software without specific prior written permission. *#
#* *#
#* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *#
#* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *#
#* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *#
#* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *#
#* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *#
#* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *#
#* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *#
#* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *#
#* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *#
#* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *#
#* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *#
#*****************************************************************************#
#* "$Revision:: 26 $" *#
#* "$HeadURL:: https://svn.ai.sri.com/projects/spark/trunk/spark/src/spar#$" *#
#*****************************************************************************#
def computeCycles(root, successors):
finished = []
companions = {}
path = []
_process(successors, [], companions, path, root)
return companions
def _process(successors, complete, companions, path, node):
#print "Processing", companions, path, node
if node in path: # we have found a cycle
pos = path.index(node)
#print "Found new cycle", path[pos:]
group = None
for cnode in path[pos:]:
# for every other node in this cycle, merge the companions
group = _merge_group(group, companions, cnode)
elif node in complete and _subset(companions.get(node,()), complete):
# every node in the companion group is complete
#print "Pruning search under", node
pass
else:
path.append(node)
#print "successors", node, successors(node)
for next in successors(node):
_process(successors, complete, companions, path, next)
path.pop()
complete.append(node)
def _subset(seq1, seq2):
for elt in seq1:
if elt not in seq2:
return False
return True
def _merge_group(group, companions, cnode):
"""Merge group with the previously known companions of cnode,
return the group (which should now be the companion list for
everything in group) """
# precondition: if group then forall x in group companions[x]==group
if group is not None and cnode in group:
return group
#print "_merge_group", group, companions, cnode
othergroup = companions.get(cnode)
if group is None:
if othergroup is None:
group = [cnode]
companions[cnode] = group
else:
group = othergroup
elif othergroup is None:
group.append(cnode)
companions[cnode] = group
elif group is not othergroup:
for onode in othergroup:
if onode not in group:
#print " adding", onode
group.append(onode)
companions[onode] = group
return group
TEST1 = {1:[2,3], 2:[1,4,5], 3:[6,7,8], 4:[1], 5:[], 6:[2], 7:[], 8:[8]}
ANSWER1 = {1: [1, 2, 4, 3, 6], 2: [1, 2, 4, 3, 6], 3: [1, 2, 4, 3, 6], 4: [1, 2, 4, 3, 6], 6: [1, 2, 4, 3, 6], 8:[8]}
def test():
result = computeCycles(1, TEST1.get)
if (result != ANSWER1): raise AssertionError
|
def compute_cycles(root, successors):
finished = []
companions = {}
path = []
_process(successors, [], companions, path, root)
return companions
def _process(successors, complete, companions, path, node):
if node in path:
pos = path.index(node)
group = None
for cnode in path[pos:]:
group = _merge_group(group, companions, cnode)
elif node in complete and _subset(companions.get(node, ()), complete):
pass
else:
path.append(node)
for next in successors(node):
_process(successors, complete, companions, path, next)
path.pop()
complete.append(node)
def _subset(seq1, seq2):
for elt in seq1:
if elt not in seq2:
return False
return True
def _merge_group(group, companions, cnode):
"""Merge group with the previously known companions of cnode,
return the group (which should now be the companion list for
everything in group) """
if group is not None and cnode in group:
return group
othergroup = companions.get(cnode)
if group is None:
if othergroup is None:
group = [cnode]
companions[cnode] = group
else:
group = othergroup
elif othergroup is None:
group.append(cnode)
companions[cnode] = group
elif group is not othergroup:
for onode in othergroup:
if onode not in group:
group.append(onode)
companions[onode] = group
return group
test1 = {1: [2, 3], 2: [1, 4, 5], 3: [6, 7, 8], 4: [1], 5: [], 6: [2], 7: [], 8: [8]}
answer1 = {1: [1, 2, 4, 3, 6], 2: [1, 2, 4, 3, 6], 3: [1, 2, 4, 3, 6], 4: [1, 2, 4, 3, 6], 6: [1, 2, 4, 3, 6], 8: [8]}
def test():
result = compute_cycles(1, TEST1.get)
if result != ANSWER1:
raise AssertionError
|
API = "api"
API_DEFAULT_DESCRIPTOR = "default"
API_ERROR_MESSAGES = "errorMessages"
API_QUERY_STRING = "query_string"
API_RESOURCE = "resource_name"
API_RETURN = "on_return"
COLUMN_FORMATING = "column_formating"
COLUMN_CLEANING = "column_cleaning"
COLUMN_EXPANDING = "column_expending"
DEFAULT_COLUMNS_TO_EXPAND = ["changelog", "fields", "renderedFields", "names", "schema", "operations", "editmeta", "versionedRepresentations"]
ENDPOINTS = "endpoints"
ITEM_VALUE = "{item_value}"
JIRA_BOARD_ID_404 = "Board {item_value} does not exists or the user does not have permission to view it."
JIRA_CORE_PAGINATION = {
"skip_key": "startAt",
"limit_key": "maxResults",
"total_key": "total"
}
JIRA_CORE_URL = "{site_url}rest/api/3/{resource_name}"
JIRA_IS_LAST_PAGE = "isLastPage"
JIRA_LICENSE_403 = "The user does not a have valid license"
JIRA_NEXT = "next"
JIRA_OPSGENIE_402 = "The account cannot do this action because of subscription plan"
JIRA_OPSGENIE_PAGING = "paging"
JIRA_OPSGENIE_URL = "api.opsgenie.com/{resource_name}"
JIRA_PAGING = "_links"
JIRA_SERVICE_DESK_ID_404 = "Service Desk ID {item_value} does not exists"
JIRA_SERVICE_DESK_PAGINATION = {
"next_page_key": ["_links", "next"]
}
JIRA_SERVICE_DESK_URL = "{site_url}rest/servicedeskapi/{resource_name}"
JIRA_SOFTWARE_URL = "{site_url}rest/agile/1.0/{resource_name}"
PAGINATION = "pagination"
endpoint_descriptors = {
API_DEFAULT_DESCRIPTOR: {
API_RESOURCE: "{endpoint_name}/{item_value}",
API: JIRA_CORE_URL,
API_RETURN: {
200: None,
401: "The user is not logged in",
403: "The user does not have permission to complete this request",
404: "Item {item_value} not found",
500: "Jira Internal Server Error"
},
COLUMN_EXPANDING: DEFAULT_COLUMNS_TO_EXPAND,
PAGINATION: JIRA_CORE_PAGINATION
},
ENDPOINTS: {
"dashboard": {API_RETURN: {200: ["dashboards", None]}},
"dashboard/search": {API_RETURN: {200: "values"}},
"field": {
API_RESOURCE: "{endpoint_name}",
},
"group": {
API_RESOURCE: "{endpoint_name}/member",
API_QUERY_STRING: {"groupname": ITEM_VALUE},
API_RETURN: {200: "values"}
},
"issue": {
API_QUERY_STRING: {"expand": "{expand}"}
},
"issue/createmeta": {
API_RESOURCE: "{endpoint_name}",
API_RETURN: {
200: "projects"
}
},
"issue(Filter)": {
API_RESOURCE: "search",
API_QUERY_STRING: {"jql": "filter={}".format(ITEM_VALUE), "expand": "{expand}"},
API_RETURN: {
200: "issues"
}
},
"issue(JQL)": {
API_RESOURCE: "search",
API_QUERY_STRING: {"jql": ITEM_VALUE, "expand": "{expand}"},
API_RETURN: {
200: "issues"
}
},
"project/components": {
API_RESOURCE: "project/{item_value}/components"
},
"project/search": {
API_RESOURCE: "{endpoint_name}",
API_QUERY_STRING: {"expand": "{expand}"},
# expand: description, projectKeyrs, lead, issueTypes, url, insight
API_RETURN: {
200: "values",
404: "Item not found"
}
},
"project/versions": {
API_RESOURCE: "project/{item_value}/versions",
API_QUERY_STRING: {"expand": "{expand}"}
# expand: issuesstatus, operations
},
"search": {
API_RESOURCE: "search",
API_QUERY_STRING: {"jql": ITEM_VALUE, "expand": "{expand}"},
API_RETURN: {
200: "issues"
}
},
"worklog/deleted": {},
"worklog/list": {
API_RESOURCE: "issue/{item_value}/worklog",
},
"organization": {
API: JIRA_SERVICE_DESK_URL,
API_RESOURCE: "organization/{item_value}",
API_RETURN: {
200: ["values", None],
404: "Organization ID {item_value} does not exists"
},
PAGINATION: JIRA_SERVICE_DESK_PAGINATION
},
"organization/user": {
API: JIRA_SERVICE_DESK_URL,
API_RESOURCE: "organization/{item_value}/user",
API_RETURN: {
200: "values",
404: "Organization ID {item_value} does not exists"
},
PAGINATION: JIRA_SERVICE_DESK_PAGINATION
},
"request": {
API: JIRA_SERVICE_DESK_URL,
API_RETURN: {
200: ["values", None]
},
PAGINATION: JIRA_SERVICE_DESK_PAGINATION
},
"servicedesk": {
API: JIRA_SERVICE_DESK_URL,
API_RESOURCE: "{endpoint_name}/{item_value}",
API_RETURN: {
200: ["values", None],
404: JIRA_SERVICE_DESK_ID_404
},
PAGINATION: JIRA_SERVICE_DESK_PAGINATION
},
"servicedesk/customer": {
API: JIRA_SERVICE_DESK_URL,
API_RESOURCE: "servicedesk/{item_value}/customer",
API_RETURN: {
200: "values",
404: JIRA_SERVICE_DESK_ID_404
},
PAGINATION: JIRA_SERVICE_DESK_PAGINATION
},
"servicedesk/organization": {
API: JIRA_SERVICE_DESK_URL,
API_RESOURCE: "servicedesk/{item_value}/organization",
API_RETURN: {
200: "values",
404: JIRA_SERVICE_DESK_ID_404
},
PAGINATION: JIRA_SERVICE_DESK_PAGINATION
},
"servicedesk/queue": {
API: JIRA_SERVICE_DESK_URL,
API_RESOURCE: "servicedesk/{item_value}/queue",
API_RETURN: {
200: "values",
404: JIRA_SERVICE_DESK_ID_404
},
PAGINATION: JIRA_SERVICE_DESK_PAGINATION
},
"servicedesk/queue/issue": {
API: JIRA_SERVICE_DESK_URL,
API_RESOURCE: "servicedesk/{item_value}/queue/{queue_id}/issue",
API_RETURN: {
200: "values",
404: "Service Desk ID {item_value} or queue ID {queue_id} do not exist"
},
PAGINATION: JIRA_SERVICE_DESK_PAGINATION
},
"board": {
API: JIRA_SOFTWARE_URL,
API_RESOURCE: "board",
API_RETURN: {
200: "values",
404: JIRA_BOARD_ID_404
}
},
"board/backlog": {
API: JIRA_SOFTWARE_URL,
API_RESOURCE: "board/{item_value}/backlog",
API_RETURN: {
200: "issues",
404: JIRA_BOARD_ID_404
}
},
"board/epic": {
API: JIRA_SOFTWARE_URL,
API_RESOURCE: "board/{item_value}/epic",
API_RETURN: {
200: "values",
404: JIRA_BOARD_ID_404
}
},
"board/epic/none/issue": {
API: JIRA_SOFTWARE_URL,
API_RESOURCE: "board/{item_value}/epic/none/issue",
API_RETURN: {
200: "issues",
404: JIRA_BOARD_ID_404
}
},
"board/issue": {
API: JIRA_SOFTWARE_URL,
API_RESOURCE: "board/{item_value}/issue",
API_RETURN: {
200: "issues",
404: JIRA_BOARD_ID_404
}
},
"board/project": {
API: JIRA_SOFTWARE_URL,
API_RESOURCE: "board/{item_value}/project",
API_RETURN: {
200: "values"
}
},
"board/project/full": {
API: JIRA_SOFTWARE_URL,
API_RESOURCE: "board/{item_value}/project/full",
API_RETURN: {
200: "values",
403: JIRA_LICENSE_403
}
},
"board/sprint": {
API: JIRA_SOFTWARE_URL,
API_RESOURCE: "board/{item_value}/sprint",
API_RETURN: {
200: "values",
403: JIRA_LICENSE_403
}
},
"board/version": {
API: JIRA_SOFTWARE_URL,
API_RESOURCE: "board/{item_value}/version",
API_RETURN: {
200: "values",
403: JIRA_LICENSE_403
}
},
"epic/none/issue": {
API: JIRA_SOFTWARE_URL,
API_RESOURCE: "epic/none/issue",
API_RETURN: {
200: "issues"
}
},
"alerts": {
API: JIRA_OPSGENIE_URL,
API_RESOURCE: "v2/alerts",
API_QUERY_STRING: {
"query": ITEM_VALUE
},
API_RETURN: {
200: "data",
402: JIRA_OPSGENIE_402
},
COLUMN_FORMATING: {
"integration_type": ["integration", "type"],
"integration_id": ["integration", "id"],
"integration_name": ["integration", "name"]
},
COLUMN_CLEANING: ["integration"]
},
"incidents": {
API: JIRA_OPSGENIE_URL,
API_RESOURCE: "v1/incidents",
API_QUERY_STRING: {
"query": ITEM_VALUE
},
API_RETURN: {
200: "data",
402: JIRA_OPSGENIE_402
}
},
"users": {
API: JIRA_OPSGENIE_URL,
API_RESOURCE: "v2/users",
API_QUERY_STRING: {
"query": ITEM_VALUE
},
API_RETURN: {
200: "data",
402: JIRA_OPSGENIE_402
},
COLUMN_FORMATING: {
"country": ["userAddress", "country"],
"state": ["userAddress", "state"],
"line": ["userAddress", "line"],
"zip_code": ["userAddress", "zipCode"],
"city": ["userAddress", "city"],
"role": ["role", "id"]
},
COLUMN_CLEANING: ["userAddress"]
},
"teams": {
API: JIRA_OPSGENIE_URL,
API_RESOURCE: "v2/teams",
API_QUERY_STRING: {
"query": ITEM_VALUE
},
API_RETURN: {
200: "data",
402: JIRA_OPSGENIE_402
},
COLUMN_EXPANDING: DEFAULT_COLUMNS_TO_EXPAND.append("links")
},
"schedules": {
API: JIRA_OPSGENIE_URL,
API_RESOURCE: "v2/schedules",
API_QUERY_STRING: {
"query": ITEM_VALUE
},
API_RETURN: {
200: "data",
402: JIRA_OPSGENIE_402
}
},
"escalations": {
API: JIRA_OPSGENIE_URL,
API_RESOURCE: "v2/escalations",
API_RETURN: {
200: "data",
402: JIRA_OPSGENIE_402
}
},
"services": {
API: JIRA_OPSGENIE_URL,
API_RESOURCE: "v1/services",
API_QUERY_STRING: {"query": ITEM_VALUE},
API_RETURN: {
200: "data",
402: JIRA_OPSGENIE_402
}
}
}
}
|
api = 'api'
api_default_descriptor = 'default'
api_error_messages = 'errorMessages'
api_query_string = 'query_string'
api_resource = 'resource_name'
api_return = 'on_return'
column_formating = 'column_formating'
column_cleaning = 'column_cleaning'
column_expanding = 'column_expending'
default_columns_to_expand = ['changelog', 'fields', 'renderedFields', 'names', 'schema', 'operations', 'editmeta', 'versionedRepresentations']
endpoints = 'endpoints'
item_value = '{item_value}'
jira_board_id_404 = 'Board {item_value} does not exists or the user does not have permission to view it.'
jira_core_pagination = {'skip_key': 'startAt', 'limit_key': 'maxResults', 'total_key': 'total'}
jira_core_url = '{site_url}rest/api/3/{resource_name}'
jira_is_last_page = 'isLastPage'
jira_license_403 = 'The user does not a have valid license'
jira_next = 'next'
jira_opsgenie_402 = 'The account cannot do this action because of subscription plan'
jira_opsgenie_paging = 'paging'
jira_opsgenie_url = 'api.opsgenie.com/{resource_name}'
jira_paging = '_links'
jira_service_desk_id_404 = 'Service Desk ID {item_value} does not exists'
jira_service_desk_pagination = {'next_page_key': ['_links', 'next']}
jira_service_desk_url = '{site_url}rest/servicedeskapi/{resource_name}'
jira_software_url = '{site_url}rest/agile/1.0/{resource_name}'
pagination = 'pagination'
endpoint_descriptors = {API_DEFAULT_DESCRIPTOR: {API_RESOURCE: '{endpoint_name}/{item_value}', API: JIRA_CORE_URL, API_RETURN: {200: None, 401: 'The user is not logged in', 403: 'The user does not have permission to complete this request', 404: 'Item {item_value} not found', 500: 'Jira Internal Server Error'}, COLUMN_EXPANDING: DEFAULT_COLUMNS_TO_EXPAND, PAGINATION: JIRA_CORE_PAGINATION}, ENDPOINTS: {'dashboard': {API_RETURN: {200: ['dashboards', None]}}, 'dashboard/search': {API_RETURN: {200: 'values'}}, 'field': {API_RESOURCE: '{endpoint_name}'}, 'group': {API_RESOURCE: '{endpoint_name}/member', API_QUERY_STRING: {'groupname': ITEM_VALUE}, API_RETURN: {200: 'values'}}, 'issue': {API_QUERY_STRING: {'expand': '{expand}'}}, 'issue/createmeta': {API_RESOURCE: '{endpoint_name}', API_RETURN: {200: 'projects'}}, 'issue(Filter)': {API_RESOURCE: 'search', API_QUERY_STRING: {'jql': 'filter={}'.format(ITEM_VALUE), 'expand': '{expand}'}, API_RETURN: {200: 'issues'}}, 'issue(JQL)': {API_RESOURCE: 'search', API_QUERY_STRING: {'jql': ITEM_VALUE, 'expand': '{expand}'}, API_RETURN: {200: 'issues'}}, 'project/components': {API_RESOURCE: 'project/{item_value}/components'}, 'project/search': {API_RESOURCE: '{endpoint_name}', API_QUERY_STRING: {'expand': '{expand}'}, API_RETURN: {200: 'values', 404: 'Item not found'}}, 'project/versions': {API_RESOURCE: 'project/{item_value}/versions', API_QUERY_STRING: {'expand': '{expand}'}}, 'search': {API_RESOURCE: 'search', API_QUERY_STRING: {'jql': ITEM_VALUE, 'expand': '{expand}'}, API_RETURN: {200: 'issues'}}, 'worklog/deleted': {}, 'worklog/list': {API_RESOURCE: 'issue/{item_value}/worklog'}, 'organization': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: 'organization/{item_value}', API_RETURN: {200: ['values', None], 404: 'Organization ID {item_value} does not exists'}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'organization/user': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: 'organization/{item_value}/user', API_RETURN: {200: 'values', 404: 'Organization ID {item_value} does not exists'}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'request': {API: JIRA_SERVICE_DESK_URL, API_RETURN: {200: ['values', None]}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'servicedesk': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: '{endpoint_name}/{item_value}', API_RETURN: {200: ['values', None], 404: JIRA_SERVICE_DESK_ID_404}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'servicedesk/customer': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: 'servicedesk/{item_value}/customer', API_RETURN: {200: 'values', 404: JIRA_SERVICE_DESK_ID_404}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'servicedesk/organization': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: 'servicedesk/{item_value}/organization', API_RETURN: {200: 'values', 404: JIRA_SERVICE_DESK_ID_404}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'servicedesk/queue': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: 'servicedesk/{item_value}/queue', API_RETURN: {200: 'values', 404: JIRA_SERVICE_DESK_ID_404}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'servicedesk/queue/issue': {API: JIRA_SERVICE_DESK_URL, API_RESOURCE: 'servicedesk/{item_value}/queue/{queue_id}/issue', API_RETURN: {200: 'values', 404: 'Service Desk ID {item_value} or queue ID {queue_id} do not exist'}, PAGINATION: JIRA_SERVICE_DESK_PAGINATION}, 'board': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board', API_RETURN: {200: 'values', 404: JIRA_BOARD_ID_404}}, 'board/backlog': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/backlog', API_RETURN: {200: 'issues', 404: JIRA_BOARD_ID_404}}, 'board/epic': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/epic', API_RETURN: {200: 'values', 404: JIRA_BOARD_ID_404}}, 'board/epic/none/issue': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/epic/none/issue', API_RETURN: {200: 'issues', 404: JIRA_BOARD_ID_404}}, 'board/issue': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/issue', API_RETURN: {200: 'issues', 404: JIRA_BOARD_ID_404}}, 'board/project': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/project', API_RETURN: {200: 'values'}}, 'board/project/full': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/project/full', API_RETURN: {200: 'values', 403: JIRA_LICENSE_403}}, 'board/sprint': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/sprint', API_RETURN: {200: 'values', 403: JIRA_LICENSE_403}}, 'board/version': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'board/{item_value}/version', API_RETURN: {200: 'values', 403: JIRA_LICENSE_403}}, 'epic/none/issue': {API: JIRA_SOFTWARE_URL, API_RESOURCE: 'epic/none/issue', API_RETURN: {200: 'issues'}}, 'alerts': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v2/alerts', API_QUERY_STRING: {'query': ITEM_VALUE}, API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}, COLUMN_FORMATING: {'integration_type': ['integration', 'type'], 'integration_id': ['integration', 'id'], 'integration_name': ['integration', 'name']}, COLUMN_CLEANING: ['integration']}, 'incidents': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v1/incidents', API_QUERY_STRING: {'query': ITEM_VALUE}, API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}}, 'users': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v2/users', API_QUERY_STRING: {'query': ITEM_VALUE}, API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}, COLUMN_FORMATING: {'country': ['userAddress', 'country'], 'state': ['userAddress', 'state'], 'line': ['userAddress', 'line'], 'zip_code': ['userAddress', 'zipCode'], 'city': ['userAddress', 'city'], 'role': ['role', 'id']}, COLUMN_CLEANING: ['userAddress']}, 'teams': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v2/teams', API_QUERY_STRING: {'query': ITEM_VALUE}, API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}, COLUMN_EXPANDING: DEFAULT_COLUMNS_TO_EXPAND.append('links')}, 'schedules': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v2/schedules', API_QUERY_STRING: {'query': ITEM_VALUE}, API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}}, 'escalations': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v2/escalations', API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}}, 'services': {API: JIRA_OPSGENIE_URL, API_RESOURCE: 'v1/services', API_QUERY_STRING: {'query': ITEM_VALUE}, API_RETURN: {200: 'data', 402: JIRA_OPSGENIE_402}}}}
|
region = 'us-west-2'
default_vpc = dict(
enable_dns_hostnames=True,
cidr_block='10.0.0.0/16',
tags={'Name': 'default'},
)
default_gateway = dict(vpc_id='${aws_vpc.default.id}')
internet_access_route = dict(
route_table_id='${aws_vpc.default.main_route_table_id}',
destination_cidr_block='0.0.0.0/0',
gateway_id='${aws_internet_gateway.default.id}'
)
config = dict(
provider=dict(
aws=dict(region=region)
),
resource=dict(
aws_vpc=dict(default=default_vpc),
aws_internet_gateway=dict(default=default_gateway),
aws_route=dict(internet_access=internet_access_route),
)
)
|
region = 'us-west-2'
default_vpc = dict(enable_dns_hostnames=True, cidr_block='10.0.0.0/16', tags={'Name': 'default'})
default_gateway = dict(vpc_id='${aws_vpc.default.id}')
internet_access_route = dict(route_table_id='${aws_vpc.default.main_route_table_id}', destination_cidr_block='0.0.0.0/0', gateway_id='${aws_internet_gateway.default.id}')
config = dict(provider=dict(aws=dict(region=region)), resource=dict(aws_vpc=dict(default=default_vpc), aws_internet_gateway=dict(default=default_gateway), aws_route=dict(internet_access=internet_access_route)))
|
ants_picture = """
.`
/
`:`
.-`
` --
`-` `-`.-`
`-. --..o
`..` .:. `y.
--` `-/-` `/+` -o`
`...` `-/-` `s+ ```-+`
..-````` /s `-+: -/ossyyys+/-
`-:://///:-.` `yh -o/` :dmmmdhhhhyo+`
```......:+so- :m/ oy/+o+:/yNNNmdhyhdo+o
``...........+hs. .h.`.+dhmmhyydddNNddyshhhs/
`.....-:/+/++++/os---+hhdmmddmdddmd/dmyyssyys+
``.-:/ohdhmdhhhhdy:dmmNmdddhyyysys+. sdyso+:. /-
`.-+hhhmmmmmdhydmmNdmyhsos//ss/--` ` o:
.+ydmdmmmmNmdddddd.-s+``o -+++//-. `/-```
.+sdmmmddddhoosyy+ s: o/ ``..//-` ``.......`
./shdhhyyssyoo/. `d- `y: `-:-.`` `...
.-/+++//:-` +s .y. `.-. `
:s` -+
`:-` o-
`::` -+`
`-:. `-.
.-` .-`
.` `:
`-` .`
`.
"""
ants_picture2 = \
"""
___ _ _____________
/ | / | / /_ __/ ___/
/ /| | / |/ / / / \__ \
/ ___ |/ /| / / / ___/ /
/_/ |_/_/ |_/ /_/ /____/
"""
print(ants_picture)
ants = 'Accelerated Neutron Transport Solution'
|
ants_picture = '\n .` \n / \n `:` \n .-` \n ` -- \n `-` `-`.-` \n `-. --..o \n `..` .:. `y. \n --` `-/-` `/+` -o` \n `...` `-/-` `s+ ```-+` \n ..-````` /s `-+: -/ossyyys+/- \n `-:://///:-.` `yh -o/` :dmmmdhhhhyo+` \n ```......:+so- :m/ oy/+o+:/yNNNmdhyhdo+o \n ``...........+hs. .h.`.+dhmmhyydddNNddyshhhs/ \n `.....-:/+/++++/os---+hhdmmddmdddmd/dmyyssyys+ \n ``.-:/ohdhmdhhhhdy:dmmNmdddhyyysys+. sdyso+:. /- \n `.-+hhhmmmmmdhydmmNdmyhsos//ss/--` ` o: \n .+ydmdmmmmNmdddddd.-s+``o -+++//-. `/-``` \n .+sdmmmddddhoosyy+ s: o/ ``..//-` ``.......` \n ./shdhhyyssyoo/. `d- `y: `-:-.`` `... \n .-/+++//:-` +s .y. `.-. ` \n :s` -+ \n `:-` o- \n `::` -+` \n `-:. `-. \n .-` .-` \n .` `: \n `-` .` \n `. \n'
ants_picture2 = '\n ___ _ _____________\n / | / | / /_ __/ ___/\n / /| | / |/ / / / \\__ \\ \n / ___ |/ /| / / / ___/ / \n /_/ |_/_/ |_/ /_/ /____/ \n \n'
print(ants_picture)
ants = 'Accelerated Neutron Transport Solution'
|
class BlackjackWinner:
def winnings(self, bet, dealer, dealerBlackjack, player, blackjack):
if player > 21 or (player < dealer and dealer <= 21):
return -bet
if dealerBlackjack and blackjack:
return 0
if dealerBlackjack and not blackjack:
return -bet
if not dealerBlackjack and blackjack:
return 1.5 * bet
if dealer > 21 or player > dealer:
return bet
return 0
|
class Blackjackwinner:
def winnings(self, bet, dealer, dealerBlackjack, player, blackjack):
if player > 21 or (player < dealer and dealer <= 21):
return -bet
if dealerBlackjack and blackjack:
return 0
if dealerBlackjack and (not blackjack):
return -bet
if not dealerBlackjack and blackjack:
return 1.5 * bet
if dealer > 21 or player > dealer:
return bet
return 0
|
# --------------------------------------
#! /usr/bin/python
# File: 977. Squared of a Sorted Array.py
# Author: Kimberly Gao
# My solution: (Run time: 132ms) (from website)
# Memory Usage: 15.6 MB
class Solution:
def _init_(self,name):
self.name = name
# Only for python. Using function sort()
# Will overwritting the inputs
def sortedSquares1(self, nums):
for i in range(nums):
nums[i] *= nums[i]
nums.sort()
return nums
# Making a new array, not in place, O(n) auxiliary space
def sortedSquares2(self, nums):
return sorted([v**2 for v in nums])
# Making a new array, not in place, O(1) auxiliary space
def sortedSquares3(self, nums):
newlist = [v**2 for v in nums]
newlist.sort() # This is in place!
return newlist
# Two pointers:
def sortedSquares4(self, nums):
# list comprehension: return a list with all None elements (its length=length of nums):
# result = [None for _ in nums]
result = [None] * len(nums) # 10x faster than above one
left, right = 0, len(nums) - 1
for index in range(len(nums)-1, -1, -1):
if abs(nums[left]) > abs(nums[right]):
result[index] = nums[left] ** 2
left += 1
else:
result[index] = nums[right] ** 2
right -= 1
return result
if __name__ == '__main__':
nums = [-4,-1,0,3,10]
solution = Solution().sortedSquares4(nums)
print(solution)
|
class Solution:
def _init_(self, name):
self.name = name
def sorted_squares1(self, nums):
for i in range(nums):
nums[i] *= nums[i]
nums.sort()
return nums
def sorted_squares2(self, nums):
return sorted([v ** 2 for v in nums])
def sorted_squares3(self, nums):
newlist = [v ** 2 for v in nums]
newlist.sort()
return newlist
def sorted_squares4(self, nums):
result = [None] * len(nums)
(left, right) = (0, len(nums) - 1)
for index in range(len(nums) - 1, -1, -1):
if abs(nums[left]) > abs(nums[right]):
result[index] = nums[left] ** 2
left += 1
else:
result[index] = nums[right] ** 2
right -= 1
return result
if __name__ == '__main__':
nums = [-4, -1, 0, 3, 10]
solution = solution().sortedSquares4(nums)
print(solution)
|
class GameStatus:
OPEN = 'OPEN'
CLOSED = 'CLOSED'
READY = 'READY'
IN_PLAY = 'IN_PLAY'
ENDED = 'ENDED'
class Action:
MOVE_UP = 'MOVE_UP'
MOVE_LEFT = 'MOVE_LEFT'
MOVE_DOWN = 'MOVE_DOWN'
MOVE_RIGHT = 'MOVE_RIGHT'
ATTACK_UP = 'ATTACK_UP'
ATTACK_LEFT = 'ATTACK_LEFT'
ATTACK_DOWN = 'ATTACK_DOWN'
ATTACK_RIGHT = 'ATTACK_RIGHT'
TRANSFORM_NORMAL = 'TRANSFORM_NORMAL'
TRANSFORM_FIRE = 'TRANSFORM_FIRE'
TRANSFORM_WATER = 'TRANSFORM_WATER'
TRANSFORM_GRASS = 'TRANSFORM_GRASS'
class ActionType:
MOVE = 'MOVE'
COLLECT = 'COLLECT'
TRANSFORM = 'TRANSFORM'
ATTACK = 'ATTACK'
RESTORE_HP = 'RESTORE_HP'
WAIT = 'WAIT'
class TileType:
NORMAL = 'NORMAL'
FIRE = 'FIRE'
WATER = 'WATER'
GRASS = 'GRASS'
class ItemType:
OBSTACLE = 'OBSTACLE'
FIRE = 'FIRE'
WATER = 'WATER'
GRASS = 'GRASS'
class Morph:
NEUTRAL = 'NEUTRAL'
FIRE = 'FIRE'
WATER = 'WATER'
GRASS = 'GRASS'
|
class Gamestatus:
open = 'OPEN'
closed = 'CLOSED'
ready = 'READY'
in_play = 'IN_PLAY'
ended = 'ENDED'
class Action:
move_up = 'MOVE_UP'
move_left = 'MOVE_LEFT'
move_down = 'MOVE_DOWN'
move_right = 'MOVE_RIGHT'
attack_up = 'ATTACK_UP'
attack_left = 'ATTACK_LEFT'
attack_down = 'ATTACK_DOWN'
attack_right = 'ATTACK_RIGHT'
transform_normal = 'TRANSFORM_NORMAL'
transform_fire = 'TRANSFORM_FIRE'
transform_water = 'TRANSFORM_WATER'
transform_grass = 'TRANSFORM_GRASS'
class Actiontype:
move = 'MOVE'
collect = 'COLLECT'
transform = 'TRANSFORM'
attack = 'ATTACK'
restore_hp = 'RESTORE_HP'
wait = 'WAIT'
class Tiletype:
normal = 'NORMAL'
fire = 'FIRE'
water = 'WATER'
grass = 'GRASS'
class Itemtype:
obstacle = 'OBSTACLE'
fire = 'FIRE'
water = 'WATER'
grass = 'GRASS'
class Morph:
neutral = 'NEUTRAL'
fire = 'FIRE'
water = 'WATER'
grass = 'GRASS'
|
__name__ = "restio"
__version__ = "1.0.0b5"
__author__ = "Eduardo Machado Starling"
__email__ = "[email protected]"
|
__name__ = 'restio'
__version__ = '1.0.0b5'
__author__ = 'Eduardo Machado Starling'
__email__ = '[email protected]'
|
class Solution:
#Function to remove a loop in the linked list.
def removeLoop(self, head):
ptr1 = head
ptr2 = head
while ptr2!=None and ptr2.next!=None:
ptr1 = ptr1.next
ptr2 = ptr2.next.next
if ptr1 == ptr2 :
self.delete_loop(head,ptr1)
else:
return 1
def delete_loop(self,head,loop_node):
ptr1 = head
i = 1
counter = loop_node
while counter.next != loop_node:
counter = counter.next
i+=1
ptr2 = head
for j in range(i):
ptr2 = ptr2.next
while ptr1!=ptr2:
ptr1 = ptr1.next
ptr2 = ptr2.next
while(ptr2.next != ptr1):
ptr2 = ptr2.next
ptr2.next = None
# code here
# remove the loop without losing any nodes
#{
# Driver Code Starts
# driver code:
class Node:
def __init__(self,val):
self.next=None
self.data=val
class linkedList:
def __init__(self):
self.head=None
self.tail=None
def add(self,num):
if self.head is None:
self.head=Node(num)
self.tail=self.head
else:
self.tail.next=Node(num)
self.tail=self.tail.next
def isLoop(self):
if self.head is None:
return False
fast=self.head.next
slow=self.head
while slow != fast:
if fast is None or fast.next is None:
return False
fast=fast.next.next
slow=slow.next
return True
def loopHere(self,position):
if position==0:
return
walk=self.head
for _ in range(1,position):
walk=walk.next
self.tail.next=walk
def length(self):
walk=self.head
ret=0
while walk:
ret+=1
walk=walk.next
return ret
if __name__=="__main__":
t=int(input())
for _ in range(t):
n=int(input())
arr=tuple(int(x) for x in input().split())
pos=int(input())
ll = linkedList()
for i in arr:
ll.add(i)
ll.loopHere(pos)
Solution().removeLoop(ll.head)
if ll.isLoop() or ll.length()!=n:
print(0)
continue
else:
print(1)
# } Driver Code Ends
|
class Solution:
def remove_loop(self, head):
ptr1 = head
ptr2 = head
while ptr2 != None and ptr2.next != None:
ptr1 = ptr1.next
ptr2 = ptr2.next.next
if ptr1 == ptr2:
self.delete_loop(head, ptr1)
else:
return 1
def delete_loop(self, head, loop_node):
ptr1 = head
i = 1
counter = loop_node
while counter.next != loop_node:
counter = counter.next
i += 1
ptr2 = head
for j in range(i):
ptr2 = ptr2.next
while ptr1 != ptr2:
ptr1 = ptr1.next
ptr2 = ptr2.next
while ptr2.next != ptr1:
ptr2 = ptr2.next
ptr2.next = None
class Node:
def __init__(self, val):
self.next = None
self.data = val
class Linkedlist:
def __init__(self):
self.head = None
self.tail = None
def add(self, num):
if self.head is None:
self.head = node(num)
self.tail = self.head
else:
self.tail.next = node(num)
self.tail = self.tail.next
def is_loop(self):
if self.head is None:
return False
fast = self.head.next
slow = self.head
while slow != fast:
if fast is None or fast.next is None:
return False
fast = fast.next.next
slow = slow.next
return True
def loop_here(self, position):
if position == 0:
return
walk = self.head
for _ in range(1, position):
walk = walk.next
self.tail.next = walk
def length(self):
walk = self.head
ret = 0
while walk:
ret += 1
walk = walk.next
return ret
if __name__ == '__main__':
t = int(input())
for _ in range(t):
n = int(input())
arr = tuple((int(x) for x in input().split()))
pos = int(input())
ll = linked_list()
for i in arr:
ll.add(i)
ll.loopHere(pos)
solution().removeLoop(ll.head)
if ll.isLoop() or ll.length() != n:
print(0)
continue
else:
print(1)
|
class ConsoleGenerator:
def print_tree(self, indent=0, depth=99):
if depth > 0:
print(" " * indent, str(self))
self.descend_tree(indent, depth)
def descend_tree(self, indent=0, depth=99):
# do descent here, other classes may overload this
pass
@staticmethod
def output(py_obj):
print("#" * 80)
print("data via console class: '{}'".format(py_obj.data))
print("#" * 80)
|
class Consolegenerator:
def print_tree(self, indent=0, depth=99):
if depth > 0:
print(' ' * indent, str(self))
self.descend_tree(indent, depth)
def descend_tree(self, indent=0, depth=99):
pass
@staticmethod
def output(py_obj):
print('#' * 80)
print("data via console class: '{}'".format(py_obj.data))
print('#' * 80)
|
"""BFS in Python."""
GRAPH = {"A": set(["B", "C", "E", "F"]),
"B": set(["A", "C", "D"]),
"C": set(["A", "B"]),
"D": set(["B"]),
"E": set(["B", "A"]),
"F": set(["A"])}
def bfs(graph, start):
"""Return visited nodes."""
visited = set()
queue = [start]
while queue:
vertex = queue.pop(0)
if vertex not in visited:
visited.add(vertex)
print(vertex)
queue.extend(graph[vertex]-visited)
return visited
def bfs_path(graph, start, end):
"""Return all paths."""
queue = [(start, [start])]
while queue:
(vertex, path) = queue.pop(0)
for i in graph[vertex] - set(path):
if i == end:
yield path + [i]
else:
queue.append((i, path + [i]))
def bfs_shortest_path(graph, start, end):
"""Find the shortest path with BFS."""
try:
return next(bfs_path(graph, start, end))
except StopIteration:
return None
print(bfs(GRAPH, "A"))
print(list(bfs_path(GRAPH, "F", "D")))
print(bfs_shortest_path(GRAPH, "F", "D"))
|
"""BFS in Python."""
graph = {'A': set(['B', 'C', 'E', 'F']), 'B': set(['A', 'C', 'D']), 'C': set(['A', 'B']), 'D': set(['B']), 'E': set(['B', 'A']), 'F': set(['A'])}
def bfs(graph, start):
"""Return visited nodes."""
visited = set()
queue = [start]
while queue:
vertex = queue.pop(0)
if vertex not in visited:
visited.add(vertex)
print(vertex)
queue.extend(graph[vertex] - visited)
return visited
def bfs_path(graph, start, end):
"""Return all paths."""
queue = [(start, [start])]
while queue:
(vertex, path) = queue.pop(0)
for i in graph[vertex] - set(path):
if i == end:
yield (path + [i])
else:
queue.append((i, path + [i]))
def bfs_shortest_path(graph, start, end):
"""Find the shortest path with BFS."""
try:
return next(bfs_path(graph, start, end))
except StopIteration:
return None
print(bfs(GRAPH, 'A'))
print(list(bfs_path(GRAPH, 'F', 'D')))
print(bfs_shortest_path(GRAPH, 'F', 'D'))
|
#
# PySNMP MIB module HH3C-LswINF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-LswINF-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:26:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, SingleValueConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection")
hh3clswCommon, = mibBuilder.importSymbols("HH3C-OID-MIB", "hh3clswCommon")
ifEntry, ifIndex = mibBuilder.importSymbols("IF-MIB", "ifEntry", "ifIndex")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, IpAddress, Counter32, ObjectIdentity, Bits, TimeTicks, ModuleIdentity, Gauge32, iso, NotificationType, Unsigned32, MibIdentifier, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "IpAddress", "Counter32", "ObjectIdentity", "Bits", "TimeTicks", "ModuleIdentity", "Gauge32", "iso", "NotificationType", "Unsigned32", "MibIdentifier", "Integer32")
TruthValue, RowStatus, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "RowStatus", "DisplayString", "TextualConvention")
hh3cLswL2InfMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5))
hh3cLswL2InfMib.setRevisions(('2001-06-29 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: hh3cLswL2InfMib.setRevisionsDescriptions(('',))
if mibBuilder.loadTexts: hh3cLswL2InfMib.setLastUpdated('200106290000Z')
if mibBuilder.loadTexts: hh3cLswL2InfMib.setOrganization('Hangzhou H3C Tech. Co., Ltd.')
if mibBuilder.loadTexts: hh3cLswL2InfMib.setContactInfo('Platform Team Hangzhou H3C Tech. Co., Ltd. Hai-Dian District Beijing P.R. China http://www.h3c.com Zip:100085 ')
if mibBuilder.loadTexts: hh3cLswL2InfMib.setDescription('')
class PortList(TextualConvention, OctetString):
description = "Each octet within this value specifies a set of eight ports, with the first octet specifying ports 1 through 8, the second octet specifying ports 9 through 16, etc. Within each octet, the most significant bit represents the lowest numbered port, and the least significant bit represents the highest numbered port. Thus, each port of the bridge is represented by a single bit within the value of this object. If that bit has a value of '1' then that port is included in the set of ports; the port is not included if its bit has a value of '0'."
status = 'current'
class VlanIndex(TextualConvention, Unsigned32):
description = 'A value used to index per-VLAN tables: values of 0 and 4095 are not permitted; if the value is between 1 and 4094 inclusive, it represents an IEEE 802.1Q VLAN-ID with global scope within a given bridged domain (see VlanId textual convention). If the value is greater than 4095 then it represents a VLAN with scope local to the particular agent, i.e. one without a global VLAN-ID assigned to it. Such VLANs are outside the scope of IEEE 802.1Q but it is convenient to be able to manage them in the same way using this MIB.'
status = 'current'
subtypeSpec = Unsigned32.subtypeSpec + ValueRangeConstraint(0, 4294967295)
class InterfaceIndex(TextualConvention, Integer32):
description = "A unique value, greater than zero, for each interface or interface sub-layer in the managed system. It is recommended that values are assigned contiguously starting from 1. The value for each interface sub-layer must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization."
status = 'current'
displayHint = 'd'
class DropDirection(TextualConvention, Integer32):
description = 'Representing the direction of dropping packets, if applicable.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))
namedValues = NamedValues(("disable", 1), ("enableInbound", 2), ("enableOutbound", 3), ("enableBoth", 4))
class SpeedModeFlag(TextualConvention, Bits):
description = 'Type of Negotiable Speed mode.'
status = 'current'
namedValues = NamedValues(("s10M", 0), ("s100M", 1), ("s1000M", 2), ("s10000M", 3), ("s24000M", 4))
hh3cLswExtInterface = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1))
hh3cifXXTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1), )
if mibBuilder.loadTexts: hh3cifXXTable.setStatus('current')
if mibBuilder.loadTexts: hh3cifXXTable.setDescription('Extended H3C private interface information table.')
hh3cifXXEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1), )
ifEntry.registerAugmentions(("HH3C-LswINF-MIB", "hh3cifXXEntry"))
hh3cifXXEntry.setIndexNames(*ifEntry.getIndexNames())
if mibBuilder.loadTexts: hh3cifXXEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cifXXEntry.setDescription('Entries of extended H3C private interface information table.')
hh3cifUnBoundPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 1), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifUnBoundPort.setStatus('current')
if mibBuilder.loadTexts: hh3cifUnBoundPort.setDescription('Whether it is the unbound port. (true indicates that the port is the main port of the aggregation or the port does not participate in the aggregation.)')
hh3cifISPhyPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 2), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifISPhyPort.setStatus('current')
if mibBuilder.loadTexts: hh3cifISPhyPort.setDescription('Whether it is a physical interface.')
hh3cifAggregatePort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 3), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifAggregatePort.setStatus('current')
if mibBuilder.loadTexts: hh3cifAggregatePort.setDescription('Whether it is the aggregated port. (if the port participates in the aggregation, this value is true.)')
hh3cifMirrorPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 4), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifMirrorPort.setStatus('current')
if mibBuilder.loadTexts: hh3cifMirrorPort.setDescription('Whether it is a mirror port.')
hh3cifVLANType = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("vLANTrunk", 1), ("access", 2), ("hybrid", 3), ("fabric", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifVLANType.setStatus('current')
if mibBuilder.loadTexts: hh3cifVLANType.setDescription('port vlan types. hybrid (3) port can carry multiple VLANs. If fabric function is supported, fabric(4) means the port is a fabric port.')
hh3cifMcastControl = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 100))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifMcastControl.setStatus('current')
if mibBuilder.loadTexts: hh3cifMcastControl.setDescription('Broadcast storm suppression with the step length of 1, ranging from 1 to 100 percent. In some products the step is 5, ranging from 5 to 100.')
hh3cifFlowControl = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 7), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifFlowControl.setStatus('current')
if mibBuilder.loadTexts: hh3cifFlowControl.setDescription('Flow control status.')
hh3cifSrcMacControl = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 8), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifSrcMacControl.setStatus('current')
if mibBuilder.loadTexts: hh3cifSrcMacControl.setDescription('Whether to filter by source MAC address.')
hh3cifClearStat = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("clear", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifClearStat.setStatus('current')
if mibBuilder.loadTexts: hh3cifClearStat.setDescription('Clear all port statistics. Read operation not supported.')
hh3cifXXBasePortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 10), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifXXBasePortIndex.setStatus('current')
if mibBuilder.loadTexts: hh3cifXXBasePortIndex.setDescription('Index number of the port and the first port index of the device is 1.')
hh3cifXXDevPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifXXDevPortIndex.setStatus('current')
if mibBuilder.loadTexts: hh3cifXXDevPortIndex.setDescription('Device index of the port.')
hh3cifPpsMcastControl = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 12), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifPpsMcastControl.setStatus('current')
if mibBuilder.loadTexts: hh3cifPpsMcastControl.setDescription('The broadcast suppression with pps(packet per second) type. The max value is determined by the port type and product.')
hh3cifPpsBcastDisValControl = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifPpsBcastDisValControl.setStatus('current')
if mibBuilder.loadTexts: hh3cifPpsBcastDisValControl.setDescription("Control the port's pps(packet per second) broadcast suppression. When the port is enabled, its pps broadcast suppression value is the global disperse value, and when disabled, it doesn't suppress broadcast.")
hh3cifUniSuppressionStep = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifUniSuppressionStep.setStatus('current')
if mibBuilder.loadTexts: hh3cifUniSuppressionStep.setDescription('The step of unicast suppression in ratio mode.')
hh3cifPpsUniSuppressionMax = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 15), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifPpsUniSuppressionMax.setStatus('current')
if mibBuilder.loadTexts: hh3cifPpsUniSuppressionMax.setDescription('The max pps(packet per second) value of unicast suppression in pps mode.')
hh3cifMulSuppressionStep = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 16), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifMulSuppressionStep.setStatus('current')
if mibBuilder.loadTexts: hh3cifMulSuppressionStep.setDescription('The step of multicast suppression in ratio mode.')
hh3cifPpsMulSuppressionMax = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 17), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifPpsMulSuppressionMax.setStatus('current')
if mibBuilder.loadTexts: hh3cifPpsMulSuppressionMax.setDescription('The max pps(packet per second) value of multicast suppression in pps mode.')
hh3cifUniSuppression = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 18), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifUniSuppression.setStatus('current')
if mibBuilder.loadTexts: hh3cifUniSuppression.setDescription('The unicast suppression with the ranging from 1 to 100 percent in ratio mode. The step is determined by hh3cifUniSuppressionStep.')
hh3cifPpsUniSuppression = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 19), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifPpsUniSuppression.setStatus('current')
if mibBuilder.loadTexts: hh3cifPpsUniSuppression.setDescription('The unicast suppression in pps(packet per second) mode. The max value is determined by hh3cifPpsUniSuppressionMax.')
hh3cifMulSuppression = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 20), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifMulSuppression.setStatus('current')
if mibBuilder.loadTexts: hh3cifMulSuppression.setDescription('The multicast suppression with ranging from 1 to 100 percent in ratio mode. The step is determined by hh3cifMulSuppressionStep.')
hh3cifPpsMulSuppression = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 21), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifPpsMulSuppression.setStatus('current')
if mibBuilder.loadTexts: hh3cifPpsMulSuppression.setDescription('The multicast suppression in pps(packet per second) mode. The max pps value is determined by hh3cifPpsMulSuppressionMax.')
hh3cifComboActivePort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("fiber", 1), ("copper", 2), ("na", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifComboActivePort.setStatus('obsolete')
if mibBuilder.loadTexts: hh3cifComboActivePort.setDescription('Active port on combo interface.')
hh3cifBMbpsMulSuppressionMax = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 23), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifBMbpsMulSuppressionMax.setStatus('current')
if mibBuilder.loadTexts: hh3cifBMbpsMulSuppressionMax.setDescription('The maximum value of the multicast suppression with bandwidth-based(Mbps) that a port can be configured.')
hh3cifBMbpsMulSuppression = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 24), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifBMbpsMulSuppression.setStatus('current')
if mibBuilder.loadTexts: hh3cifBMbpsMulSuppression.setDescription('With bandwidth-based multicast suppression, the bandwidth is measured in Mbps. The upper limit of the multicast suppession with bandwidth-based(Mbps) is the value of hh3cifBMbpsMulSuppressionMax in the entry. The default value of hh3cifBMbpsMulSuppression is the value of hh3cifBMbpsMulSuppressionMax.')
hh3cifBKbpsMulSuppressionMax = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 25), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifBKbpsMulSuppressionMax.setStatus('current')
if mibBuilder.loadTexts: hh3cifBKbpsMulSuppressionMax.setDescription('The maximum value of the multicast suppression with bandwidth-based(Kbps) that a port can be configured.')
hh3cifBKbpsMulSuppressionStep = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 26), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifBKbpsMulSuppressionStep.setStatus('current')
if mibBuilder.loadTexts: hh3cifBKbpsMulSuppressionStep.setDescription('The step of multicast suppression with bandwidth-based(Kbps).')
hh3cifBKbpsMulSuppression = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 27), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifBKbpsMulSuppression.setStatus('current')
if mibBuilder.loadTexts: hh3cifBKbpsMulSuppression.setDescription('With bandwidth-based multicast suppression, the bandwidth is measured in Kbps. The upper limit of the multicast suppession with bandwidth-based(Kbps) is the value of hh3cifBKbpsMulSuppressionMax in the entry. The value of hh3cifBKbpsMulSuppression must be multiple of the value of hh3cifBKbpsMulSuppressionStep. The default value of hh3cifBKbpsMulSuppression is the value of hh3cifBKbpsMulSuppressionMax.')
hh3cifUnknownPacketDropMul = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 28), DropDirection().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifUnknownPacketDropMul.setStatus('current')
if mibBuilder.loadTexts: hh3cifUnknownPacketDropMul.setDescription("Control the port's unknown-multicast packets drop. When inbound direction is enabled on this port, the port will drop unknown-multicast packets in inbound direction. When outbound direction is enabled on this port, the port will drop unknown-multicast packets in outbound direction. When both directions are enabled on this port, the port will drop unknown-multicast packets in both inbound and outbound directions.")
hh3cifUnknownPacketDropUni = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 29), DropDirection().clone('disable')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifUnknownPacketDropUni.setStatus('current')
if mibBuilder.loadTexts: hh3cifUnknownPacketDropUni.setDescription("Control the port's unknown-unicast packets drop. When inbound direction is enabled on this port, the port will drop unknown-unicast packets in inbound direction. When outbound direction is enabled on this port, the port will drop unknown-unicast packets in outbound direction. When both directions are enabled on this port, the port will drop unknown-unicast packets in both inbound and outbound directions.")
hh3cifBMbpsUniSuppressionMax = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 30), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifBMbpsUniSuppressionMax.setStatus('current')
if mibBuilder.loadTexts: hh3cifBMbpsUniSuppressionMax.setDescription(' The maximum value of the unicast suppression with bandwidth-based (Mbps) that a port can be configured.')
hh3cifBMbpsUniSuppression = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 31), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifBMbpsUniSuppression.setStatus('current')
if mibBuilder.loadTexts: hh3cifBMbpsUniSuppression.setDescription(' With bandwidth-based Unicast suppression, the bandwidth is measured in Mbps. The upper limit of the unicast suppession with bandwidth-based(Mbps) is the value of hh3cifBMbpsUniSuppressionMax in the entry. The default value of hh3cifBMbpsUniSuppression is the value of hh3cifBMbpsUniSuppressionMax.')
hh3cifBKbpsUniSuppressionMax = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 32), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifBKbpsUniSuppressionMax.setStatus('current')
if mibBuilder.loadTexts: hh3cifBKbpsUniSuppressionMax.setDescription(' The maximum value of the unicast suppression with bandwidth-based (Kbps) that a port can be configured.')
hh3cifBKbpsUniSuppressionStep = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 33), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifBKbpsUniSuppressionStep.setStatus('current')
if mibBuilder.loadTexts: hh3cifBKbpsUniSuppressionStep.setDescription(' The step of unicast suppression with bandwidth-based(Kbps).')
hh3cifBKbpsUniSuppression = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 34), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifBKbpsUniSuppression.setStatus('current')
if mibBuilder.loadTexts: hh3cifBKbpsUniSuppression.setDescription(' With bandwidth-based unicast suppression, the bandwidth is measured in Kbps. The upper limit of the unicast suppession with bandwidth-based(Kbps) is the value of hh3cifBKbpsUniSuppressionMax in the entry. The value of hh3cifBKbpsUniSuppression must be multiple of the value of hh3cifBKbpsUniSuppressionStep. The default value of hh3cifBKbpsUniSuppression is the value of hh3cifBKbpsUniSuppressionMax.')
hh3cifOutPayloadOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 35), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifOutPayloadOctets.setStatus('current')
if mibBuilder.loadTexts: hh3cifOutPayloadOctets.setDescription(' The actual output octets of the interface.')
hh3cifInPayloadOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 36), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifInPayloadOctets.setStatus('current')
if mibBuilder.loadTexts: hh3cifInPayloadOctets.setDescription(' The actual input octets of the interface.')
hh3cifInErrorPktsRate = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 37), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifInErrorPktsRate.setStatus('current')
if mibBuilder.loadTexts: hh3cifInErrorPktsRate.setDescription(' The rate of inbound error packets on the interface.')
hh3cifInPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 38), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifInPkts.setStatus('current')
if mibBuilder.loadTexts: hh3cifInPkts.setDescription(' The number of packets received on the interface.')
hh3cifInNormalPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 39), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifInNormalPkts.setStatus('current')
if mibBuilder.loadTexts: hh3cifInNormalPkts.setDescription(' The number of normal packets received on the interface.')
hh3cifOutPkts = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 40), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifOutPkts.setStatus('current')
if mibBuilder.loadTexts: hh3cifOutPkts.setDescription(' The number of packets sent on the interface.')
hh3cifAggregateTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2), )
if mibBuilder.loadTexts: hh3cifAggregateTable.setStatus('current')
if mibBuilder.loadTexts: hh3cifAggregateTable.setDescription('Port aggregation information table.')
hh3cifAggregateEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2, 1), ).setIndexNames((0, "HH3C-LswINF-MIB", "hh3cifAggregatePortIndex"))
if mibBuilder.loadTexts: hh3cifAggregateEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cifAggregateEntry.setDescription('Port aggregation information table.')
hh3cifAggregatePortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2, 1, 1), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifAggregatePortIndex.setStatus('current')
if mibBuilder.loadTexts: hh3cifAggregatePortIndex.setDescription('Index number of the main aggregated port.')
hh3cifAggregatePortName = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 40))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifAggregatePortName.setStatus('current')
if mibBuilder.loadTexts: hh3cifAggregatePortName.setDescription('Aggregation group name.')
hh3cifAggregatePortListPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2, 1, 3), PortList()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifAggregatePortListPorts.setStatus('current')
if mibBuilder.loadTexts: hh3cifAggregatePortListPorts.setDescription('Portlist of a aggregating.')
hh3cifAggregateModel = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("ingress", 1), ("both", 2), ("round-robin", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifAggregateModel.setStatus('current')
if mibBuilder.loadTexts: hh3cifAggregateModel.setDescription('Load sharing mode for the port aggregation.')
hh3cifAggregateOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cifAggregateOperStatus.setStatus('current')
if mibBuilder.loadTexts: hh3cifAggregateOperStatus.setDescription('Current operation status of the row.')
hh3cifHybridPortTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3), )
if mibBuilder.loadTexts: hh3cifHybridPortTable.setStatus('current')
if mibBuilder.loadTexts: hh3cifHybridPortTable.setDescription('Hybrid-port configuration table.')
hh3cifHybridPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3, 1), ).setIndexNames((0, "HH3C-LswINF-MIB", "hh3cifHybridPortIndex"))
if mibBuilder.loadTexts: hh3cifHybridPortEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cifHybridPortEntry.setDescription('Hybrid-port configuration table.')
hh3cifHybridPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifHybridPortIndex.setStatus('current')
if mibBuilder.loadTexts: hh3cifHybridPortIndex.setDescription('Index number of Hybrid-port.')
hh3cifHybridTaggedVlanListLow = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 256))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifHybridTaggedVlanListLow.setStatus('current')
if mibBuilder.loadTexts: hh3cifHybridTaggedVlanListLow.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 1 through 8, the second octet specifying VLANs 9 through 16, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each tagged VLAN of the hybrid port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is tagged in the set of VLANs; the VLAN is not tagged if its bit has a value of '0'.")
hh3cifHybridTaggedVlanListHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 256))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifHybridTaggedVlanListHigh.setStatus('current')
if mibBuilder.loadTexts: hh3cifHybridTaggedVlanListHigh.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 2049 through 2056, the second octet specifying VLANs 2057 through 2064, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each tagged VLAN of the hybrid port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is tagged in the set of VLANs; the VLAN is not tagged if its bit has a value of '0'.")
hh3cifHybridUnTaggedVlanListLow = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 256))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifHybridUnTaggedVlanListLow.setStatus('current')
if mibBuilder.loadTexts: hh3cifHybridUnTaggedVlanListLow.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 1 through 8, the second octet specifying VLANs 9 through 16, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each untagged VLAN of the hybrid port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is untagged in the set of VLANs; the VLAN is not untagged if its bit has a value of '0'.")
hh3cifHybridUnTaggedVlanListHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 256))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifHybridUnTaggedVlanListHigh.setStatus('current')
if mibBuilder.loadTexts: hh3cifHybridUnTaggedVlanListHigh.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 2049 through 2056, the second octet specifying VLANs 2057 through 2064, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each untagged VLAN of the hybrid port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is untagged in the set of VLANs; the VLAN is not untagged if its bit has a value of '0'.")
hh3cifComboPortTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 4), )
if mibBuilder.loadTexts: hh3cifComboPortTable.setStatus('current')
if mibBuilder.loadTexts: hh3cifComboPortTable.setDescription('Combo-port table.')
hh3cifComboPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 4, 1), ).setIndexNames((0, "HH3C-LswINF-MIB", "hh3cifComboPortIndex"))
if mibBuilder.loadTexts: hh3cifComboPortEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cifComboPortEntry.setDescription('The entry of hh3cifComboPortTable.')
hh3cifComboPortIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 4, 1, 1), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifComboPortIndex.setStatus('current')
if mibBuilder.loadTexts: hh3cifComboPortIndex.setDescription('The combo-port interface index. Its value is the same as the value of ifIndex in ifTable, but only includes indexes of the combo-port interfaces.')
hh3cifComboPortCurActive = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 4, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("fiber", 1), ("copper", 2), ("na", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifComboPortCurActive.setStatus('current')
if mibBuilder.loadTexts: hh3cifComboPortCurActive.setDescription("Current active interface of combo interfaces. The value 'fiber' means the interface with fiber connector of the pair of combo-port interfaces is active. The value 'copper' means the interface with copper connector of the pair is active. The value 'na' means not supported.")
hh3cLswL2InfMibObject = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1))
hh3cSlotPortMax = MibScalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cSlotPortMax.setStatus('current')
if mibBuilder.loadTexts: hh3cSlotPortMax.setDescription('Max ports of the slots.')
hh3cSwitchPortMax = MibScalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cSwitchPortMax.setStatus('current')
if mibBuilder.loadTexts: hh3cSwitchPortMax.setDescription('Max ports that this switch includes.')
hh3cifVLANTrunkStatusTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3), )
if mibBuilder.loadTexts: hh3cifVLANTrunkStatusTable.setStatus('current')
if mibBuilder.loadTexts: hh3cifVLANTrunkStatusTable.setDescription('Gmosaic attributes on the VlanTrunk port.')
hh3cifVLANTrunkStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1), ).setIndexNames((0, "HH3C-LswINF-MIB", "hh3cifVLANTrunkIndex"))
if mibBuilder.loadTexts: hh3cifVLANTrunkStatusEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cifVLANTrunkStatusEntry.setDescription('Gmosaic attributes on the VlanTrunk port.')
hh3cifVLANTrunkIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1, 1), InterfaceIndex()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifVLANTrunkIndex.setStatus('current')
if mibBuilder.loadTexts: hh3cifVLANTrunkIndex.setDescription('Index number of the VLANTrunk interface.')
hh3cifVLANTrunkGvrpRegistration = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("normal", 1), ("fixed", 2), ("forbidden", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifVLANTrunkGvrpRegistration.setStatus('current')
if mibBuilder.loadTexts: hh3cifVLANTrunkGvrpRegistration.setDescription('GMOSAIC registration information normal: This is the default configuration. Allow create, register and unregister vlans dynamiclly at this port. fixed: Aallow create and register vlan manually at this port. Prevent from unregistering vlans or registering known vlans of this port at another trunk port. forbidden: Unregister all vlans but vlan 1, forbid to create or register any other vlans at this port.')
hh3cifVLANTrunkPassListLow = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1, 4), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifVLANTrunkPassListLow.setStatus('current')
if mibBuilder.loadTexts: hh3cifVLANTrunkPassListLow.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 1 through 8, the second octet specifying VLANs 9 through 16, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each actually passed VLAN of the trunk port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is actually passed in the set of VLANs; the VLAN is not actually passed if its bit has a value of '0'.")
hh3cifVLANTrunkPassListHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1, 5), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifVLANTrunkPassListHigh.setStatus('current')
if mibBuilder.loadTexts: hh3cifVLANTrunkPassListHigh.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 2049 through 2056, the second octet specifying VLANs 2057 through 2064, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each actually passed VLAN of the trunk port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is actually passed in the set of VLANs; the VLAN is not actually passed if its bit has a value of '0'.")
hh3cifVLANTrunkAllowListLow = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1, 6), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifVLANTrunkAllowListLow.setStatus('current')
if mibBuilder.loadTexts: hh3cifVLANTrunkAllowListLow.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 1 through 8, the second octet specifying VLANs 9 through 16, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each allowed VLAN of the trunk port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is allowed in the set of VLANs; the VLAN is not allowed if its bit has a value of '0'.")
hh3cifVLANTrunkAllowListHigh = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1, 7), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifVLANTrunkAllowListHigh.setStatus('current')
if mibBuilder.loadTexts: hh3cifVLANTrunkAllowListHigh.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 2049 through 2056, the second octet specifying VLANs 2057 through 2064, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each allowed VLAN of the trunk port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is allowed in the set of VLANs; the VLAN is not allowed if its bit has a value of '0'.")
hh3cethernetTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4), )
if mibBuilder.loadTexts: hh3cethernetTable.setStatus('current')
if mibBuilder.loadTexts: hh3cethernetTable.setDescription('Ethernet port attribute table.')
hh3cethernetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1), )
ifEntry.registerAugmentions(("HH3C-LswINF-MIB", "hh3cethernetEntry"))
hh3cethernetEntry.setIndexNames(*ifEntry.getIndexNames())
if mibBuilder.loadTexts: hh3cethernetEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cethernetEntry.setDescription('Entries of Ethernet port attribute table')
hh3cifEthernetDuplex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("full", 1), ("half", 2), ("auto", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifEthernetDuplex.setStatus('current')
if mibBuilder.loadTexts: hh3cifEthernetDuplex.setDescription('Ethernet interface mode.')
hh3cifEthernetMTU = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 4), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifEthernetMTU.setStatus('current')
if mibBuilder.loadTexts: hh3cifEthernetMTU.setDescription('MTU on the Ethernet interface.')
hh3cifEthernetSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 10, 100, 1000, 10000, 24000))).clone(namedValues=NamedValues(("auto", 0), ("s10M", 10), ("s100M", 100), ("s1000M", 1000), ("s10000M", 10000), ("s24000M", 24000)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifEthernetSpeed.setStatus('current')
if mibBuilder.loadTexts: hh3cifEthernetSpeed.setDescription('Ethernet interface speed.')
hh3cifEthernetMdi = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("mdi-ii", 1), ("mdi-x", 2), ("mdi-auto", 3)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifEthernetMdi.setStatus('current')
if mibBuilder.loadTexts: hh3cifEthernetMdi.setDescription('Type of the line connected to the port. MDI-II (straight-through cable): 1 MDI-X (crossover cable): 2 MDI-AUTO (auto-sensing): 3')
hh3cMaxMacLearn = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-1, 2147483647))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cMaxMacLearn.setStatus('current')
if mibBuilder.loadTexts: hh3cMaxMacLearn.setDescription('The maximum number of MAC addresses that the port can learn. The value -1 means that the number of Mac addresses that the port can learn is unlimited.')
hh3cifMacAddressLearn = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifMacAddressLearn.setStatus('current')
if mibBuilder.loadTexts: hh3cifMacAddressLearn.setDescription('This object indicates if the interface is allowed to learn mac address. eanbled(1) means the interface can learn mac address, otherwise disabled(2) can be set.')
hh3cifEthernetTest = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1))).clone(namedValues=NamedValues(("test", 1)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifEthernetTest.setStatus('current')
if mibBuilder.loadTexts: hh3cifEthernetTest.setDescription('Test this interface. The actual testing will be different according to products. Read operation not supported.')
hh3cifMacAddrLearnMode = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("iVL", 1), ("sVL", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifMacAddrLearnMode.setStatus('current')
if mibBuilder.loadTexts: hh3cifMacAddrLearnMode.setDescription('Status indicates mac address learn mode of the interface. IVL(1) means independent VLAN learning. SVL means shared VLAN learning.')
hh3cifEthernetFlowInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(5, 300))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifEthernetFlowInterval.setStatus('current')
if mibBuilder.loadTexts: hh3cifEthernetFlowInterval.setDescription('Set flow interval of the ethernet. The NMS should set value to integer which is a multiple of 5.')
hh3cifEthernetIsolate = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 13), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifEthernetIsolate.setStatus('current')
if mibBuilder.loadTexts: hh3cifEthernetIsolate.setDescription("Isolate group means that all ports in the same isolate group can not send and receive packets each other. Each octet within this value specifies a set of eight isolate groups, with the first octet specifying isolate groups 1 through 8, the second octet specifying isolate groups 9 through 16, etc. Within each octet, the leftmost bit is the first bit. the first bit represents the lowest numbered isolate group, and the last bit represents the highest numbered isolate group. one port can belong to more than one isolate group. Thus, each isolate group is represented by a single bit within the value of this object. If that bit has a value of '1', then that isolate group includes this port; the port is not included if its bit has a value of '0'. for example, the first octet is '10000100' means that the port is included in the isolate group 1 and isolate group 6.")
hh3cifVlanVPNStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifVlanVPNStatus.setStatus('current')
if mibBuilder.loadTexts: hh3cifVlanVPNStatus.setDescription('Vlan VPN enable status.')
hh3cifVlanVPNUplinkStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifVlanVPNUplinkStatus.setStatus('current')
if mibBuilder.loadTexts: hh3cifVlanVPNUplinkStatus.setDescription('Vlan VPN uplink status.')
hh3cifVlanVPNTPID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifVlanVPNTPID.setStatus('current')
if mibBuilder.loadTexts: hh3cifVlanVPNTPID.setDescription('Port based Vlan VPN TPID(Tag Protocol Indentifier), default value is 0x8100. Please refer to hh3cVlanVPNTPIDMode to get more information.')
hh3cifIsolateGroupID = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 17), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifIsolateGroupID.setStatus('current')
if mibBuilder.loadTexts: hh3cifIsolateGroupID.setDescription('Isolate group identifier. Value zero means this interface does not belong to any isolate group.')
hh3cifisUplinkPort = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("yes", 1), ("no", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifisUplinkPort.setStatus('current')
if mibBuilder.loadTexts: hh3cifisUplinkPort.setDescription('Ethernet uplink status, default value is 2.')
hh3cifEthernetAutoSpeedMask = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 19), SpeedModeFlag()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cifEthernetAutoSpeedMask.setStatus('current')
if mibBuilder.loadTexts: hh3cifEthernetAutoSpeedMask.setDescription("This object specifies which kinds of speed mode can be negotiated. Each bit corresponds to a kind of speed mode. If the value of a bit is '1', it means the corresponding speed mode is negotiable on the port. Otherwise the negotiation for that kind of speed mode is not supported on this port. If there are several negotiable speed modes, all bits for them are '1'. For example, if the speed mode 's10M' and 's1000M' can be negotiable, the value of this object is 0xA0.")
hh3cifEthernetAutoSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 20), SpeedModeFlag()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cifEthernetAutoSpeed.setStatus('current')
if mibBuilder.loadTexts: hh3cifEthernetAutoSpeed.setDescription("This object indicates which kinds of speed mode are negotiable on this port. Only when a bit of hh3cifEthernetAutoSpeedMask is '1', the corresponding bit of this object can be set to '1', indicating the corresponding speed mode is negotiable. For example, if the value of hh3cifEthernetAutoSpeedMask is 0xA0, which indicates speed mode 's10M' and 's1000M' are negotiable, the possible value of this object should be one of the four values (0x00, 0x20, 0x80 and 0xA0). If the value of hh3cifEthernetSpeed is not 'auto', the value of this object is insignificant and should be ignored. The value length of this object should be as long as that of hh3cifEthernetAutoSpeedMask.")
hh3cIsolateGroupMax = MibScalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cIsolateGroupMax.setStatus('current')
if mibBuilder.loadTexts: hh3cIsolateGroupMax.setDescription('Max isolate group that this device support, the value is zero means that the device does not support isolate group.')
hh3cGlobalBroadcastMaxPps = MibScalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 14881000))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cGlobalBroadcastMaxPps.setStatus('current')
if mibBuilder.loadTexts: hh3cGlobalBroadcastMaxPps.setDescription('The global max packets per second. When it is set, the value of BroadcastMaxPps in all ports will be changed to that setting.')
hh3cGlobalBroadcastMaxRatio = MibScalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 100))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cGlobalBroadcastMaxRatio.setStatus('current')
if mibBuilder.loadTexts: hh3cGlobalBroadcastMaxRatio.setDescription('The global max-ratio of broadcast from 0 to 100 percent. When it is set, the value of BroadcastMaxRatio in all ports will be changed to that setting.')
hh3cBpduTunnelStatus = MibScalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cBpduTunnelStatus.setStatus('current')
if mibBuilder.loadTexts: hh3cBpduTunnelStatus.setDescription('Bpdu tunnel enable status.')
hh3cVlanVPNTPIDMode = MibScalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("port-based", 1), ("global", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cVlanVPNTPIDMode.setStatus('current')
if mibBuilder.loadTexts: hh3cVlanVPNTPIDMode.setDescription("Vlan VPN TPID mode. The value 'port-based' means VLAN VPN TPID value would be set based on port via hh3cifVlanVPNTPID. In this situation, hh3cVlanVPNTPID is meaningless and always return 0x8100. The value 'global' means VLAN VPN TPID value should be set globally via hh3cVlanVPNTPID. In this situation, hh3cifVlanVPNTPID in hh3cethernetTable has the same value with hh3cVlanVPNTPID.")
hh3cVlanVPNTPID = MibScalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: hh3cVlanVPNTPID.setStatus('current')
if mibBuilder.loadTexts: hh3cVlanVPNTPID.setDescription('Global Vlan VPN TPID(Tag Protocol Indentifier), default value is 0x8100.')
hh3cPortIsolateGroupTable = MibTable((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 11), )
if mibBuilder.loadTexts: hh3cPortIsolateGroupTable.setStatus('current')
if mibBuilder.loadTexts: hh3cPortIsolateGroupTable.setDescription('Isolate Group attribute table.')
hh3cPortIsolateGroupEntry = MibTableRow((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 11, 1), ).setIndexNames((0, "HH3C-LswINF-MIB", "hh3cPortIsolateGroupIndex"))
if mibBuilder.loadTexts: hh3cPortIsolateGroupEntry.setStatus('current')
if mibBuilder.loadTexts: hh3cPortIsolateGroupEntry.setDescription('The entry of hh3cPortIsolateGroupTable.')
hh3cPortIsolateGroupIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 11, 1, 1), Integer32())
if mibBuilder.loadTexts: hh3cPortIsolateGroupIndex.setStatus('current')
if mibBuilder.loadTexts: hh3cPortIsolateGroupIndex.setDescription('Port isolate group identifier. The index of the hh3cPortIsolateGroupTable. The value ranges from 1 to the limit of isolate group quantity.')
hh3cPortIsolateUplinkIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 11, 1, 2), InterfaceIndex()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cPortIsolateUplinkIfIndex.setStatus('current')
if mibBuilder.loadTexts: hh3cPortIsolateUplinkIfIndex.setDescription('Index number of the uplink interface.')
hh3cPortIsolateGroupRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 11, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cPortIsolateGroupRowStatus.setStatus('current')
if mibBuilder.loadTexts: hh3cPortIsolateGroupRowStatus.setDescription('Current operation status of the row.')
hh3cPortIsolateGroupDescription = MibTableColumn((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 11, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 80))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: hh3cPortIsolateGroupDescription.setStatus('current')
if mibBuilder.loadTexts: hh3cPortIsolateGroupDescription.setDescription('Port isolate group description, default value is zero-length string.')
hh3cMaxMacLearnRange = MibScalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 12), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: hh3cMaxMacLearnRange.setStatus('current')
if mibBuilder.loadTexts: hh3cMaxMacLearnRange.setDescription('The maximum number of MAC address that the port supports.')
mibBuilder.exportSymbols("HH3C-LswINF-MIB", hh3cMaxMacLearn=hh3cMaxMacLearn, hh3cifPpsUniSuppression=hh3cifPpsUniSuppression, hh3cifEthernetFlowInterval=hh3cifEthernetFlowInterval, hh3cifVLANType=hh3cifVLANType, hh3cGlobalBroadcastMaxRatio=hh3cGlobalBroadcastMaxRatio, hh3cifPpsMulSuppression=hh3cifPpsMulSuppression, hh3cifAggregateModel=hh3cifAggregateModel, hh3cIsolateGroupMax=hh3cIsolateGroupMax, hh3cifVLANTrunkAllowListLow=hh3cifVLANTrunkAllowListLow, hh3cifEthernetMdi=hh3cifEthernetMdi, hh3cifHybridPortIndex=hh3cifHybridPortIndex, hh3cVlanVPNTPID=hh3cVlanVPNTPID, hh3cifEthernetSpeed=hh3cifEthernetSpeed, hh3cifEthernetMTU=hh3cifEthernetMTU, hh3cifEthernetDuplex=hh3cifEthernetDuplex, hh3cLswL2InfMibObject=hh3cLswL2InfMibObject, hh3cifisUplinkPort=hh3cifisUplinkPort, hh3cifVLANTrunkPassListLow=hh3cifVLANTrunkPassListLow, hh3cBpduTunnelStatus=hh3cBpduTunnelStatus, hh3cifBMbpsUniSuppressionMax=hh3cifBMbpsUniSuppressionMax, hh3cifComboPortTable=hh3cifComboPortTable, SpeedModeFlag=SpeedModeFlag, hh3cifXXDevPortIndex=hh3cifXXDevPortIndex, hh3cifVlanVPNTPID=hh3cifVlanVPNTPID, hh3cifClearStat=hh3cifClearStat, hh3cifVLANTrunkAllowListHigh=hh3cifVLANTrunkAllowListHigh, hh3cifAggregatePort=hh3cifAggregatePort, hh3cPortIsolateGroupRowStatus=hh3cPortIsolateGroupRowStatus, hh3cPortIsolateGroupDescription=hh3cPortIsolateGroupDescription, hh3cifInNormalPkts=hh3cifInNormalPkts, hh3cifAggregatePortIndex=hh3cifAggregatePortIndex, hh3cifOutPayloadOctets=hh3cifOutPayloadOctets, hh3cifHybridUnTaggedVlanListHigh=hh3cifHybridUnTaggedVlanListHigh, hh3cifISPhyPort=hh3cifISPhyPort, hh3cifUnknownPacketDropMul=hh3cifUnknownPacketDropMul, hh3cifBKbpsUniSuppressionStep=hh3cifBKbpsUniSuppressionStep, hh3cifPpsMulSuppressionMax=hh3cifPpsMulSuppressionMax, hh3cifEthernetAutoSpeedMask=hh3cifEthernetAutoSpeedMask, hh3cifUniSuppression=hh3cifUniSuppression, hh3cifMacAddressLearn=hh3cifMacAddressLearn, hh3cPortIsolateGroupIndex=hh3cPortIsolateGroupIndex, hh3cifInPkts=hh3cifInPkts, hh3cifMcastControl=hh3cifMcastControl, hh3cifBKbpsUniSuppressionMax=hh3cifBKbpsUniSuppressionMax, hh3cifVLANTrunkStatusTable=hh3cifVLANTrunkStatusTable, hh3cLswL2InfMib=hh3cLswL2InfMib, hh3cifMulSuppressionStep=hh3cifMulSuppressionStep, DropDirection=DropDirection, hh3cifBMbpsMulSuppressionMax=hh3cifBMbpsMulSuppressionMax, hh3cifHybridTaggedVlanListHigh=hh3cifHybridTaggedVlanListHigh, hh3cifVLANTrunkStatusEntry=hh3cifVLANTrunkStatusEntry, hh3cifEthernetTest=hh3cifEthernetTest, hh3cifVLANTrunkIndex=hh3cifVLANTrunkIndex, hh3cifComboPortCurActive=hh3cifComboPortCurActive, PYSNMP_MODULE_ID=hh3cLswL2InfMib, hh3cPortIsolateGroupEntry=hh3cPortIsolateGroupEntry, hh3cifInPayloadOctets=hh3cifInPayloadOctets, hh3cifAggregatePortName=hh3cifAggregatePortName, hh3cifInErrorPktsRate=hh3cifInErrorPktsRate, hh3cifSrcMacControl=hh3cifSrcMacControl, InterfaceIndex=InterfaceIndex, hh3cifXXBasePortIndex=hh3cifXXBasePortIndex, hh3cifHybridPortTable=hh3cifHybridPortTable, hh3cSlotPortMax=hh3cSlotPortMax, hh3cifVLANTrunkGvrpRegistration=hh3cifVLANTrunkGvrpRegistration, hh3cPortIsolateUplinkIfIndex=hh3cPortIsolateUplinkIfIndex, hh3cLswExtInterface=hh3cLswExtInterface, hh3cifOutPkts=hh3cifOutPkts, hh3cifHybridTaggedVlanListLow=hh3cifHybridTaggedVlanListLow, hh3cifIsolateGroupID=hh3cifIsolateGroupID, PortList=PortList, hh3cPortIsolateGroupTable=hh3cPortIsolateGroupTable, hh3cifAggregateTable=hh3cifAggregateTable, hh3cifEthernetAutoSpeed=hh3cifEthernetAutoSpeed, hh3cifPpsUniSuppressionMax=hh3cifPpsUniSuppressionMax, hh3cifBKbpsUniSuppression=hh3cifBKbpsUniSuppression, VlanIndex=VlanIndex, hh3cifHybridUnTaggedVlanListLow=hh3cifHybridUnTaggedVlanListLow, hh3cifBKbpsMulSuppressionStep=hh3cifBKbpsMulSuppressionStep, hh3cSwitchPortMax=hh3cSwitchPortMax, hh3cifBMbpsUniSuppression=hh3cifBMbpsUniSuppression, hh3cifComboPortEntry=hh3cifComboPortEntry, hh3cifVlanVPNStatus=hh3cifVlanVPNStatus, hh3cifXXEntry=hh3cifXXEntry, hh3cifMirrorPort=hh3cifMirrorPort, hh3cifEthernetIsolate=hh3cifEthernetIsolate, hh3cifMulSuppression=hh3cifMulSuppression, hh3cGlobalBroadcastMaxPps=hh3cGlobalBroadcastMaxPps, hh3cifComboActivePort=hh3cifComboActivePort, hh3cifUniSuppressionStep=hh3cifUniSuppressionStep, hh3cifMacAddrLearnMode=hh3cifMacAddrLearnMode, hh3cifAggregateOperStatus=hh3cifAggregateOperStatus, hh3cifXXTable=hh3cifXXTable, hh3cifPpsMcastControl=hh3cifPpsMcastControl, hh3cifVlanVPNUplinkStatus=hh3cifVlanVPNUplinkStatus, hh3cifFlowControl=hh3cifFlowControl, hh3cifPpsBcastDisValControl=hh3cifPpsBcastDisValControl, hh3cMaxMacLearnRange=hh3cMaxMacLearnRange, hh3cethernetEntry=hh3cethernetEntry, hh3cifHybridPortEntry=hh3cifHybridPortEntry, hh3cethernetTable=hh3cethernetTable, hh3cifAggregateEntry=hh3cifAggregateEntry, hh3cifAggregatePortListPorts=hh3cifAggregatePortListPorts, hh3cifBKbpsMulSuppressionMax=hh3cifBKbpsMulSuppressionMax, hh3cifBMbpsMulSuppression=hh3cifBMbpsMulSuppression, hh3cVlanVPNTPIDMode=hh3cVlanVPNTPIDMode, hh3cifUnBoundPort=hh3cifUnBoundPort, hh3cifVLANTrunkPassListHigh=hh3cifVLANTrunkPassListHigh, hh3cifBKbpsMulSuppression=hh3cifBKbpsMulSuppression, hh3cifUnknownPacketDropUni=hh3cifUnknownPacketDropUni, hh3cifComboPortIndex=hh3cifComboPortIndex)
|
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, value_range_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection')
(hh3clsw_common,) = mibBuilder.importSymbols('HH3C-OID-MIB', 'hh3clswCommon')
(if_entry, if_index) = mibBuilder.importSymbols('IF-MIB', 'ifEntry', 'ifIndex')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(mib_scalar, mib_table, mib_table_row, mib_table_column, counter64, ip_address, counter32, object_identity, bits, time_ticks, module_identity, gauge32, iso, notification_type, unsigned32, mib_identifier, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter64', 'IpAddress', 'Counter32', 'ObjectIdentity', 'Bits', 'TimeTicks', 'ModuleIdentity', 'Gauge32', 'iso', 'NotificationType', 'Unsigned32', 'MibIdentifier', 'Integer32')
(truth_value, row_status, display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'RowStatus', 'DisplayString', 'TextualConvention')
hh3c_lsw_l2_inf_mib = module_identity((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5))
hh3cLswL2InfMib.setRevisions(('2001-06-29 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
hh3cLswL2InfMib.setRevisionsDescriptions(('',))
if mibBuilder.loadTexts:
hh3cLswL2InfMib.setLastUpdated('200106290000Z')
if mibBuilder.loadTexts:
hh3cLswL2InfMib.setOrganization('Hangzhou H3C Tech. Co., Ltd.')
if mibBuilder.loadTexts:
hh3cLswL2InfMib.setContactInfo('Platform Team Hangzhou H3C Tech. Co., Ltd. Hai-Dian District Beijing P.R. China http://www.h3c.com Zip:100085 ')
if mibBuilder.loadTexts:
hh3cLswL2InfMib.setDescription('')
class Portlist(TextualConvention, OctetString):
description = "Each octet within this value specifies a set of eight ports, with the first octet specifying ports 1 through 8, the second octet specifying ports 9 through 16, etc. Within each octet, the most significant bit represents the lowest numbered port, and the least significant bit represents the highest numbered port. Thus, each port of the bridge is represented by a single bit within the value of this object. If that bit has a value of '1' then that port is included in the set of ports; the port is not included if its bit has a value of '0'."
status = 'current'
class Vlanindex(TextualConvention, Unsigned32):
description = 'A value used to index per-VLAN tables: values of 0 and 4095 are not permitted; if the value is between 1 and 4094 inclusive, it represents an IEEE 802.1Q VLAN-ID with global scope within a given bridged domain (see VlanId textual convention). If the value is greater than 4095 then it represents a VLAN with scope local to the particular agent, i.e. one without a global VLAN-ID assigned to it. Such VLANs are outside the scope of IEEE 802.1Q but it is convenient to be able to manage them in the same way using this MIB.'
status = 'current'
subtype_spec = Unsigned32.subtypeSpec + value_range_constraint(0, 4294967295)
class Interfaceindex(TextualConvention, Integer32):
description = "A unique value, greater than zero, for each interface or interface sub-layer in the managed system. It is recommended that values are assigned contiguously starting from 1. The value for each interface sub-layer must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization."
status = 'current'
display_hint = 'd'
class Dropdirection(TextualConvention, Integer32):
description = 'Representing the direction of dropping packets, if applicable.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4))
named_values = named_values(('disable', 1), ('enableInbound', 2), ('enableOutbound', 3), ('enableBoth', 4))
class Speedmodeflag(TextualConvention, Bits):
description = 'Type of Negotiable Speed mode.'
status = 'current'
named_values = named_values(('s10M', 0), ('s100M', 1), ('s1000M', 2), ('s10000M', 3), ('s24000M', 4))
hh3c_lsw_ext_interface = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1))
hh3cif_xx_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1))
if mibBuilder.loadTexts:
hh3cifXXTable.setStatus('current')
if mibBuilder.loadTexts:
hh3cifXXTable.setDescription('Extended H3C private interface information table.')
hh3cif_xx_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1))
ifEntry.registerAugmentions(('HH3C-LswINF-MIB', 'hh3cifXXEntry'))
hh3cifXXEntry.setIndexNames(*ifEntry.getIndexNames())
if mibBuilder.loadTexts:
hh3cifXXEntry.setStatus('current')
if mibBuilder.loadTexts:
hh3cifXXEntry.setDescription('Entries of extended H3C private interface information table.')
hh3cif_un_bound_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 1), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifUnBoundPort.setStatus('current')
if mibBuilder.loadTexts:
hh3cifUnBoundPort.setDescription('Whether it is the unbound port. (true indicates that the port is the main port of the aggregation or the port does not participate in the aggregation.)')
hh3cif_is_phy_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 2), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifISPhyPort.setStatus('current')
if mibBuilder.loadTexts:
hh3cifISPhyPort.setDescription('Whether it is a physical interface.')
hh3cif_aggregate_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 3), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifAggregatePort.setStatus('current')
if mibBuilder.loadTexts:
hh3cifAggregatePort.setDescription('Whether it is the aggregated port. (if the port participates in the aggregation, this value is true.)')
hh3cif_mirror_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 4), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifMirrorPort.setStatus('current')
if mibBuilder.loadTexts:
hh3cifMirrorPort.setDescription('Whether it is a mirror port.')
hh3cif_vlan_type = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('vLANTrunk', 1), ('access', 2), ('hybrid', 3), ('fabric', 4)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifVLANType.setStatus('current')
if mibBuilder.loadTexts:
hh3cifVLANType.setDescription('port vlan types. hybrid (3) port can carry multiple VLANs. If fabric function is supported, fabric(4) means the port is a fabric port.')
hh3cif_mcast_control = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(1, 100))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifMcastControl.setStatus('current')
if mibBuilder.loadTexts:
hh3cifMcastControl.setDescription('Broadcast storm suppression with the step length of 1, ranging from 1 to 100 percent. In some products the step is 5, ranging from 5 to 100.')
hh3cif_flow_control = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 7), truth_value()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifFlowControl.setStatus('current')
if mibBuilder.loadTexts:
hh3cifFlowControl.setDescription('Flow control status.')
hh3cif_src_mac_control = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 8), truth_value()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifSrcMacControl.setStatus('current')
if mibBuilder.loadTexts:
hh3cifSrcMacControl.setDescription('Whether to filter by source MAC address.')
hh3cif_clear_stat = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1))).clone(namedValues=named_values(('clear', 1)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifClearStat.setStatus('current')
if mibBuilder.loadTexts:
hh3cifClearStat.setDescription('Clear all port statistics. Read operation not supported.')
hh3cif_xx_base_port_index = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 10), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifXXBasePortIndex.setStatus('current')
if mibBuilder.loadTexts:
hh3cifXXBasePortIndex.setDescription('Index number of the port and the first port index of the device is 1.')
hh3cif_xx_dev_port_index = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 11), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifXXDevPortIndex.setStatus('current')
if mibBuilder.loadTexts:
hh3cifXXDevPortIndex.setDescription('Device index of the port.')
hh3cif_pps_mcast_control = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 12), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifPpsMcastControl.setStatus('current')
if mibBuilder.loadTexts:
hh3cifPpsMcastControl.setDescription('The broadcast suppression with pps(packet per second) type. The max value is determined by the port type and product.')
hh3cif_pps_bcast_dis_val_control = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifPpsBcastDisValControl.setStatus('current')
if mibBuilder.loadTexts:
hh3cifPpsBcastDisValControl.setDescription("Control the port's pps(packet per second) broadcast suppression. When the port is enabled, its pps broadcast suppression value is the global disperse value, and when disabled, it doesn't suppress broadcast.")
hh3cif_uni_suppression_step = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 14), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifUniSuppressionStep.setStatus('current')
if mibBuilder.loadTexts:
hh3cifUniSuppressionStep.setDescription('The step of unicast suppression in ratio mode.')
hh3cif_pps_uni_suppression_max = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 15), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifPpsUniSuppressionMax.setStatus('current')
if mibBuilder.loadTexts:
hh3cifPpsUniSuppressionMax.setDescription('The max pps(packet per second) value of unicast suppression in pps mode.')
hh3cif_mul_suppression_step = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 16), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifMulSuppressionStep.setStatus('current')
if mibBuilder.loadTexts:
hh3cifMulSuppressionStep.setDescription('The step of multicast suppression in ratio mode.')
hh3cif_pps_mul_suppression_max = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 17), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifPpsMulSuppressionMax.setStatus('current')
if mibBuilder.loadTexts:
hh3cifPpsMulSuppressionMax.setDescription('The max pps(packet per second) value of multicast suppression in pps mode.')
hh3cif_uni_suppression = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 18), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifUniSuppression.setStatus('current')
if mibBuilder.loadTexts:
hh3cifUniSuppression.setDescription('The unicast suppression with the ranging from 1 to 100 percent in ratio mode. The step is determined by hh3cifUniSuppressionStep.')
hh3cif_pps_uni_suppression = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 19), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifPpsUniSuppression.setStatus('current')
if mibBuilder.loadTexts:
hh3cifPpsUniSuppression.setDescription('The unicast suppression in pps(packet per second) mode. The max value is determined by hh3cifPpsUniSuppressionMax.')
hh3cif_mul_suppression = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 20), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifMulSuppression.setStatus('current')
if mibBuilder.loadTexts:
hh3cifMulSuppression.setDescription('The multicast suppression with ranging from 1 to 100 percent in ratio mode. The step is determined by hh3cifMulSuppressionStep.')
hh3cif_pps_mul_suppression = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 21), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifPpsMulSuppression.setStatus('current')
if mibBuilder.loadTexts:
hh3cifPpsMulSuppression.setDescription('The multicast suppression in pps(packet per second) mode. The max pps value is determined by hh3cifPpsMulSuppressionMax.')
hh3cif_combo_active_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 22), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('fiber', 1), ('copper', 2), ('na', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifComboActivePort.setStatus('obsolete')
if mibBuilder.loadTexts:
hh3cifComboActivePort.setDescription('Active port on combo interface.')
hh3cif_b_mbps_mul_suppression_max = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 23), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifBMbpsMulSuppressionMax.setStatus('current')
if mibBuilder.loadTexts:
hh3cifBMbpsMulSuppressionMax.setDescription('The maximum value of the multicast suppression with bandwidth-based(Mbps) that a port can be configured.')
hh3cif_b_mbps_mul_suppression = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 24), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifBMbpsMulSuppression.setStatus('current')
if mibBuilder.loadTexts:
hh3cifBMbpsMulSuppression.setDescription('With bandwidth-based multicast suppression, the bandwidth is measured in Mbps. The upper limit of the multicast suppession with bandwidth-based(Mbps) is the value of hh3cifBMbpsMulSuppressionMax in the entry. The default value of hh3cifBMbpsMulSuppression is the value of hh3cifBMbpsMulSuppressionMax.')
hh3cif_b_kbps_mul_suppression_max = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 25), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifBKbpsMulSuppressionMax.setStatus('current')
if mibBuilder.loadTexts:
hh3cifBKbpsMulSuppressionMax.setDescription('The maximum value of the multicast suppression with bandwidth-based(Kbps) that a port can be configured.')
hh3cif_b_kbps_mul_suppression_step = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 26), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifBKbpsMulSuppressionStep.setStatus('current')
if mibBuilder.loadTexts:
hh3cifBKbpsMulSuppressionStep.setDescription('The step of multicast suppression with bandwidth-based(Kbps).')
hh3cif_b_kbps_mul_suppression = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 27), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifBKbpsMulSuppression.setStatus('current')
if mibBuilder.loadTexts:
hh3cifBKbpsMulSuppression.setDescription('With bandwidth-based multicast suppression, the bandwidth is measured in Kbps. The upper limit of the multicast suppession with bandwidth-based(Kbps) is the value of hh3cifBKbpsMulSuppressionMax in the entry. The value of hh3cifBKbpsMulSuppression must be multiple of the value of hh3cifBKbpsMulSuppressionStep. The default value of hh3cifBKbpsMulSuppression is the value of hh3cifBKbpsMulSuppressionMax.')
hh3cif_unknown_packet_drop_mul = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 28), drop_direction().clone('disable')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifUnknownPacketDropMul.setStatus('current')
if mibBuilder.loadTexts:
hh3cifUnknownPacketDropMul.setDescription("Control the port's unknown-multicast packets drop. When inbound direction is enabled on this port, the port will drop unknown-multicast packets in inbound direction. When outbound direction is enabled on this port, the port will drop unknown-multicast packets in outbound direction. When both directions are enabled on this port, the port will drop unknown-multicast packets in both inbound and outbound directions.")
hh3cif_unknown_packet_drop_uni = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 29), drop_direction().clone('disable')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifUnknownPacketDropUni.setStatus('current')
if mibBuilder.loadTexts:
hh3cifUnknownPacketDropUni.setDescription("Control the port's unknown-unicast packets drop. When inbound direction is enabled on this port, the port will drop unknown-unicast packets in inbound direction. When outbound direction is enabled on this port, the port will drop unknown-unicast packets in outbound direction. When both directions are enabled on this port, the port will drop unknown-unicast packets in both inbound and outbound directions.")
hh3cif_b_mbps_uni_suppression_max = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 30), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifBMbpsUniSuppressionMax.setStatus('current')
if mibBuilder.loadTexts:
hh3cifBMbpsUniSuppressionMax.setDescription(' The maximum value of the unicast suppression with bandwidth-based (Mbps) that a port can be configured.')
hh3cif_b_mbps_uni_suppression = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 31), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifBMbpsUniSuppression.setStatus('current')
if mibBuilder.loadTexts:
hh3cifBMbpsUniSuppression.setDescription(' With bandwidth-based Unicast suppression, the bandwidth is measured in Mbps. The upper limit of the unicast suppession with bandwidth-based(Mbps) is the value of hh3cifBMbpsUniSuppressionMax in the entry. The default value of hh3cifBMbpsUniSuppression is the value of hh3cifBMbpsUniSuppressionMax.')
hh3cif_b_kbps_uni_suppression_max = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 32), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifBKbpsUniSuppressionMax.setStatus('current')
if mibBuilder.loadTexts:
hh3cifBKbpsUniSuppressionMax.setDescription(' The maximum value of the unicast suppression with bandwidth-based (Kbps) that a port can be configured.')
hh3cif_b_kbps_uni_suppression_step = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 33), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifBKbpsUniSuppressionStep.setStatus('current')
if mibBuilder.loadTexts:
hh3cifBKbpsUniSuppressionStep.setDescription(' The step of unicast suppression with bandwidth-based(Kbps).')
hh3cif_b_kbps_uni_suppression = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 34), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifBKbpsUniSuppression.setStatus('current')
if mibBuilder.loadTexts:
hh3cifBKbpsUniSuppression.setDescription(' With bandwidth-based unicast suppression, the bandwidth is measured in Kbps. The upper limit of the unicast suppession with bandwidth-based(Kbps) is the value of hh3cifBKbpsUniSuppressionMax in the entry. The value of hh3cifBKbpsUniSuppression must be multiple of the value of hh3cifBKbpsUniSuppressionStep. The default value of hh3cifBKbpsUniSuppression is the value of hh3cifBKbpsUniSuppressionMax.')
hh3cif_out_payload_octets = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 35), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifOutPayloadOctets.setStatus('current')
if mibBuilder.loadTexts:
hh3cifOutPayloadOctets.setDescription(' The actual output octets of the interface.')
hh3cif_in_payload_octets = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 36), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifInPayloadOctets.setStatus('current')
if mibBuilder.loadTexts:
hh3cifInPayloadOctets.setDescription(' The actual input octets of the interface.')
hh3cif_in_error_pkts_rate = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 37), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifInErrorPktsRate.setStatus('current')
if mibBuilder.loadTexts:
hh3cifInErrorPktsRate.setDescription(' The rate of inbound error packets on the interface.')
hh3cif_in_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 38), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifInPkts.setStatus('current')
if mibBuilder.loadTexts:
hh3cifInPkts.setDescription(' The number of packets received on the interface.')
hh3cif_in_normal_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 39), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifInNormalPkts.setStatus('current')
if mibBuilder.loadTexts:
hh3cifInNormalPkts.setDescription(' The number of normal packets received on the interface.')
hh3cif_out_pkts = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 1, 1, 40), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifOutPkts.setStatus('current')
if mibBuilder.loadTexts:
hh3cifOutPkts.setDescription(' The number of packets sent on the interface.')
hh3cif_aggregate_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2))
if mibBuilder.loadTexts:
hh3cifAggregateTable.setStatus('current')
if mibBuilder.loadTexts:
hh3cifAggregateTable.setDescription('Port aggregation information table.')
hh3cif_aggregate_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2, 1)).setIndexNames((0, 'HH3C-LswINF-MIB', 'hh3cifAggregatePortIndex'))
if mibBuilder.loadTexts:
hh3cifAggregateEntry.setStatus('current')
if mibBuilder.loadTexts:
hh3cifAggregateEntry.setDescription('Port aggregation information table.')
hh3cif_aggregate_port_index = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2, 1, 1), interface_index()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifAggregatePortIndex.setStatus('current')
if mibBuilder.loadTexts:
hh3cifAggregatePortIndex.setDescription('Index number of the main aggregated port.')
hh3cif_aggregate_port_name = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(0, 40))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifAggregatePortName.setStatus('current')
if mibBuilder.loadTexts:
hh3cifAggregatePortName.setDescription('Aggregation group name.')
hh3cif_aggregate_port_list_ports = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2, 1, 3), port_list()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifAggregatePortListPorts.setStatus('current')
if mibBuilder.loadTexts:
hh3cifAggregatePortListPorts.setDescription('Portlist of a aggregating.')
hh3cif_aggregate_model = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('ingress', 1), ('both', 2), ('round-robin', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifAggregateModel.setStatus('current')
if mibBuilder.loadTexts:
hh3cifAggregateModel.setDescription('Load sharing mode for the port aggregation.')
hh3cif_aggregate_oper_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 2, 1, 5), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cifAggregateOperStatus.setStatus('current')
if mibBuilder.loadTexts:
hh3cifAggregateOperStatus.setDescription('Current operation status of the row.')
hh3cif_hybrid_port_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3))
if mibBuilder.loadTexts:
hh3cifHybridPortTable.setStatus('current')
if mibBuilder.loadTexts:
hh3cifHybridPortTable.setDescription('Hybrid-port configuration table.')
hh3cif_hybrid_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3, 1)).setIndexNames((0, 'HH3C-LswINF-MIB', 'hh3cifHybridPortIndex'))
if mibBuilder.loadTexts:
hh3cifHybridPortEntry.setStatus('current')
if mibBuilder.loadTexts:
hh3cifHybridPortEntry.setDescription('Hybrid-port configuration table.')
hh3cif_hybrid_port_index = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifHybridPortIndex.setStatus('current')
if mibBuilder.loadTexts:
hh3cifHybridPortIndex.setDescription('Index number of Hybrid-port.')
hh3cif_hybrid_tagged_vlan_list_low = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(0, 256))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifHybridTaggedVlanListLow.setStatus('current')
if mibBuilder.loadTexts:
hh3cifHybridTaggedVlanListLow.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 1 through 8, the second octet specifying VLANs 9 through 16, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each tagged VLAN of the hybrid port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is tagged in the set of VLANs; the VLAN is not tagged if its bit has a value of '0'.")
hh3cif_hybrid_tagged_vlan_list_high = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(0, 256))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifHybridTaggedVlanListHigh.setStatus('current')
if mibBuilder.loadTexts:
hh3cifHybridTaggedVlanListHigh.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 2049 through 2056, the second octet specifying VLANs 2057 through 2064, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each tagged VLAN of the hybrid port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is tagged in the set of VLANs; the VLAN is not tagged if its bit has a value of '0'.")
hh3cif_hybrid_un_tagged_vlan_list_low = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3, 1, 4), octet_string().subtype(subtypeSpec=value_size_constraint(0, 256))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifHybridUnTaggedVlanListLow.setStatus('current')
if mibBuilder.loadTexts:
hh3cifHybridUnTaggedVlanListLow.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 1 through 8, the second octet specifying VLANs 9 through 16, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each untagged VLAN of the hybrid port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is untagged in the set of VLANs; the VLAN is not untagged if its bit has a value of '0'.")
hh3cif_hybrid_un_tagged_vlan_list_high = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 3, 1, 5), octet_string().subtype(subtypeSpec=value_size_constraint(0, 256))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifHybridUnTaggedVlanListHigh.setStatus('current')
if mibBuilder.loadTexts:
hh3cifHybridUnTaggedVlanListHigh.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 2049 through 2056, the second octet specifying VLANs 2057 through 2064, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each untagged VLAN of the hybrid port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is untagged in the set of VLANs; the VLAN is not untagged if its bit has a value of '0'.")
hh3cif_combo_port_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 4))
if mibBuilder.loadTexts:
hh3cifComboPortTable.setStatus('current')
if mibBuilder.loadTexts:
hh3cifComboPortTable.setDescription('Combo-port table.')
hh3cif_combo_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 4, 1)).setIndexNames((0, 'HH3C-LswINF-MIB', 'hh3cifComboPortIndex'))
if mibBuilder.loadTexts:
hh3cifComboPortEntry.setStatus('current')
if mibBuilder.loadTexts:
hh3cifComboPortEntry.setDescription('The entry of hh3cifComboPortTable.')
hh3cif_combo_port_index = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 4, 1, 1), interface_index()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifComboPortIndex.setStatus('current')
if mibBuilder.loadTexts:
hh3cifComboPortIndex.setDescription('The combo-port interface index. Its value is the same as the value of ifIndex in ifTable, but only includes indexes of the combo-port interfaces.')
hh3cif_combo_port_cur_active = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 1, 4, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('fiber', 1), ('copper', 2), ('na', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifComboPortCurActive.setStatus('current')
if mibBuilder.loadTexts:
hh3cifComboPortCurActive.setDescription("Current active interface of combo interfaces. The value 'fiber' means the interface with fiber connector of the pair of combo-port interfaces is active. The value 'copper' means the interface with copper connector of the pair is active. The value 'na' means not supported.")
hh3c_lsw_l2_inf_mib_object = mib_identifier((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1))
hh3c_slot_port_max = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 1), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cSlotPortMax.setStatus('current')
if mibBuilder.loadTexts:
hh3cSlotPortMax.setDescription('Max ports of the slots.')
hh3c_switch_port_max = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 2), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cSwitchPortMax.setStatus('current')
if mibBuilder.loadTexts:
hh3cSwitchPortMax.setDescription('Max ports that this switch includes.')
hh3cif_vlan_trunk_status_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3))
if mibBuilder.loadTexts:
hh3cifVLANTrunkStatusTable.setStatus('current')
if mibBuilder.loadTexts:
hh3cifVLANTrunkStatusTable.setDescription('Gmosaic attributes on the VlanTrunk port.')
hh3cif_vlan_trunk_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1)).setIndexNames((0, 'HH3C-LswINF-MIB', 'hh3cifVLANTrunkIndex'))
if mibBuilder.loadTexts:
hh3cifVLANTrunkStatusEntry.setStatus('current')
if mibBuilder.loadTexts:
hh3cifVLANTrunkStatusEntry.setDescription('Gmosaic attributes on the VlanTrunk port.')
hh3cif_vlan_trunk_index = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1, 1), interface_index()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifVLANTrunkIndex.setStatus('current')
if mibBuilder.loadTexts:
hh3cifVLANTrunkIndex.setDescription('Index number of the VLANTrunk interface.')
hh3cif_vlan_trunk_gvrp_registration = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('normal', 1), ('fixed', 2), ('forbidden', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifVLANTrunkGvrpRegistration.setStatus('current')
if mibBuilder.loadTexts:
hh3cifVLANTrunkGvrpRegistration.setDescription('GMOSAIC registration information normal: This is the default configuration. Allow create, register and unregister vlans dynamiclly at this port. fixed: Aallow create and register vlan manually at this port. Prevent from unregistering vlans or registering known vlans of this port at another trunk port. forbidden: Unregister all vlans but vlan 1, forbid to create or register any other vlans at this port.')
hh3cif_vlan_trunk_pass_list_low = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1, 4), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifVLANTrunkPassListLow.setStatus('current')
if mibBuilder.loadTexts:
hh3cifVLANTrunkPassListLow.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 1 through 8, the second octet specifying VLANs 9 through 16, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each actually passed VLAN of the trunk port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is actually passed in the set of VLANs; the VLAN is not actually passed if its bit has a value of '0'.")
hh3cif_vlan_trunk_pass_list_high = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1, 5), octet_string()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifVLANTrunkPassListHigh.setStatus('current')
if mibBuilder.loadTexts:
hh3cifVLANTrunkPassListHigh.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 2049 through 2056, the second octet specifying VLANs 2057 through 2064, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each actually passed VLAN of the trunk port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is actually passed in the set of VLANs; the VLAN is not actually passed if its bit has a value of '0'.")
hh3cif_vlan_trunk_allow_list_low = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1, 6), octet_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifVLANTrunkAllowListLow.setStatus('current')
if mibBuilder.loadTexts:
hh3cifVLANTrunkAllowListLow.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 1 through 8, the second octet specifying VLANs 9 through 16, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each allowed VLAN of the trunk port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is allowed in the set of VLANs; the VLAN is not allowed if its bit has a value of '0'.")
hh3cif_vlan_trunk_allow_list_high = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 3, 1, 7), octet_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifVLANTrunkAllowListHigh.setStatus('current')
if mibBuilder.loadTexts:
hh3cifVLANTrunkAllowListHigh.setDescription("Each octet within this value specifies a set of eight VLANs, with the first octet specifying VLANs 2049 through 2056, the second octet specifying VLANs 2057 through 2064, etc. Within each octet, the most significant bit represents the highest numbered VLAN, and the least significant bit represents the lowest numbered VLAN. Thus, each allowed VLAN of the trunk port is represented by a single bit within the value of this object. If that bit has a value of '1' then that VLAN is allowed in the set of VLANs; the VLAN is not allowed if its bit has a value of '0'.")
hh3cethernet_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4))
if mibBuilder.loadTexts:
hh3cethernetTable.setStatus('current')
if mibBuilder.loadTexts:
hh3cethernetTable.setDescription('Ethernet port attribute table.')
hh3cethernet_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1))
ifEntry.registerAugmentions(('HH3C-LswINF-MIB', 'hh3cethernetEntry'))
hh3cethernetEntry.setIndexNames(*ifEntry.getIndexNames())
if mibBuilder.loadTexts:
hh3cethernetEntry.setStatus('current')
if mibBuilder.loadTexts:
hh3cethernetEntry.setDescription('Entries of Ethernet port attribute table')
hh3cif_ethernet_duplex = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('full', 1), ('half', 2), ('auto', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifEthernetDuplex.setStatus('current')
if mibBuilder.loadTexts:
hh3cifEthernetDuplex.setDescription('Ethernet interface mode.')
hh3cif_ethernet_mtu = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 4), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifEthernetMTU.setStatus('current')
if mibBuilder.loadTexts:
hh3cifEthernetMTU.setDescription('MTU on the Ethernet interface.')
hh3cif_ethernet_speed = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(0, 10, 100, 1000, 10000, 24000))).clone(namedValues=named_values(('auto', 0), ('s10M', 10), ('s100M', 100), ('s1000M', 1000), ('s10000M', 10000), ('s24000M', 24000)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifEthernetSpeed.setStatus('current')
if mibBuilder.loadTexts:
hh3cifEthernetSpeed.setDescription('Ethernet interface speed.')
hh3cif_ethernet_mdi = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('mdi-ii', 1), ('mdi-x', 2), ('mdi-auto', 3)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifEthernetMdi.setStatus('current')
if mibBuilder.loadTexts:
hh3cifEthernetMdi.setDescription('Type of the line connected to the port. MDI-II (straight-through cable): 1 MDI-X (crossover cable): 2 MDI-AUTO (auto-sensing): 3')
hh3c_max_mac_learn = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(-1, 2147483647))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cMaxMacLearn.setStatus('current')
if mibBuilder.loadTexts:
hh3cMaxMacLearn.setDescription('The maximum number of MAC addresses that the port can learn. The value -1 means that the number of Mac addresses that the port can learn is unlimited.')
hh3cif_mac_address_learn = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifMacAddressLearn.setStatus('current')
if mibBuilder.loadTexts:
hh3cifMacAddressLearn.setDescription('This object indicates if the interface is allowed to learn mac address. eanbled(1) means the interface can learn mac address, otherwise disabled(2) can be set.')
hh3cif_ethernet_test = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1))).clone(namedValues=named_values(('test', 1)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifEthernetTest.setStatus('current')
if mibBuilder.loadTexts:
hh3cifEthernetTest.setDescription('Test this interface. The actual testing will be different according to products. Read operation not supported.')
hh3cif_mac_addr_learn_mode = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('iVL', 1), ('sVL', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifMacAddrLearnMode.setStatus('current')
if mibBuilder.loadTexts:
hh3cifMacAddrLearnMode.setDescription('Status indicates mac address learn mode of the interface. IVL(1) means independent VLAN learning. SVL means shared VLAN learning.')
hh3cif_ethernet_flow_interval = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(5, 300))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifEthernetFlowInterval.setStatus('current')
if mibBuilder.loadTexts:
hh3cifEthernetFlowInterval.setDescription('Set flow interval of the ethernet. The NMS should set value to integer which is a multiple of 5.')
hh3cif_ethernet_isolate = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 13), octet_string()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifEthernetIsolate.setStatus('current')
if mibBuilder.loadTexts:
hh3cifEthernetIsolate.setDescription("Isolate group means that all ports in the same isolate group can not send and receive packets each other. Each octet within this value specifies a set of eight isolate groups, with the first octet specifying isolate groups 1 through 8, the second octet specifying isolate groups 9 through 16, etc. Within each octet, the leftmost bit is the first bit. the first bit represents the lowest numbered isolate group, and the last bit represents the highest numbered isolate group. one port can belong to more than one isolate group. Thus, each isolate group is represented by a single bit within the value of this object. If that bit has a value of '1', then that isolate group includes this port; the port is not included if its bit has a value of '0'. for example, the first octet is '10000100' means that the port is included in the isolate group 1 and isolate group 6.")
hh3cif_vlan_vpn_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 14), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifVlanVPNStatus.setStatus('current')
if mibBuilder.loadTexts:
hh3cifVlanVPNStatus.setDescription('Vlan VPN enable status.')
hh3cif_vlan_vpn_uplink_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifVlanVPNUplinkStatus.setStatus('current')
if mibBuilder.loadTexts:
hh3cifVlanVPNUplinkStatus.setDescription('Vlan VPN uplink status.')
hh3cif_vlan_vpntpid = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 16), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifVlanVPNTPID.setStatus('current')
if mibBuilder.loadTexts:
hh3cifVlanVPNTPID.setDescription('Port based Vlan VPN TPID(Tag Protocol Indentifier), default value is 0x8100. Please refer to hh3cVlanVPNTPIDMode to get more information.')
hh3cif_isolate_group_id = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 17), integer32()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifIsolateGroupID.setStatus('current')
if mibBuilder.loadTexts:
hh3cifIsolateGroupID.setDescription('Isolate group identifier. Value zero means this interface does not belong to any isolate group.')
hh3cifis_uplink_port = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 18), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('yes', 1), ('no', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifisUplinkPort.setStatus('current')
if mibBuilder.loadTexts:
hh3cifisUplinkPort.setDescription('Ethernet uplink status, default value is 2.')
hh3cif_ethernet_auto_speed_mask = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 19), speed_mode_flag()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cifEthernetAutoSpeedMask.setStatus('current')
if mibBuilder.loadTexts:
hh3cifEthernetAutoSpeedMask.setDescription("This object specifies which kinds of speed mode can be negotiated. Each bit corresponds to a kind of speed mode. If the value of a bit is '1', it means the corresponding speed mode is negotiable on the port. Otherwise the negotiation for that kind of speed mode is not supported on this port. If there are several negotiable speed modes, all bits for them are '1'. For example, if the speed mode 's10M' and 's1000M' can be negotiable, the value of this object is 0xA0.")
hh3cif_ethernet_auto_speed = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 4, 1, 20), speed_mode_flag()).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cifEthernetAutoSpeed.setStatus('current')
if mibBuilder.loadTexts:
hh3cifEthernetAutoSpeed.setDescription("This object indicates which kinds of speed mode are negotiable on this port. Only when a bit of hh3cifEthernetAutoSpeedMask is '1', the corresponding bit of this object can be set to '1', indicating the corresponding speed mode is negotiable. For example, if the value of hh3cifEthernetAutoSpeedMask is 0xA0, which indicates speed mode 's10M' and 's1000M' are negotiable, the possible value of this object should be one of the four values (0x00, 0x20, 0x80 and 0xA0). If the value of hh3cifEthernetSpeed is not 'auto', the value of this object is insignificant and should be ignored. The value length of this object should be as long as that of hh3cifEthernetAutoSpeedMask.")
hh3c_isolate_group_max = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cIsolateGroupMax.setStatus('current')
if mibBuilder.loadTexts:
hh3cIsolateGroupMax.setDescription('Max isolate group that this device support, the value is zero means that the device does not support isolate group.')
hh3c_global_broadcast_max_pps = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(0, 14881000))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cGlobalBroadcastMaxPps.setStatus('current')
if mibBuilder.loadTexts:
hh3cGlobalBroadcastMaxPps.setDescription('The global max packets per second. When it is set, the value of BroadcastMaxPps in all ports will be changed to that setting.')
hh3c_global_broadcast_max_ratio = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(0, 100))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cGlobalBroadcastMaxRatio.setStatus('current')
if mibBuilder.loadTexts:
hh3cGlobalBroadcastMaxRatio.setDescription('The global max-ratio of broadcast from 0 to 100 percent. When it is set, the value of BroadcastMaxRatio in all ports will be changed to that setting.')
hh3c_bpdu_tunnel_status = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cBpduTunnelStatus.setStatus('current')
if mibBuilder.loadTexts:
hh3cBpduTunnelStatus.setDescription('Bpdu tunnel enable status.')
hh3c_vlan_vpntpid_mode = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('port-based', 1), ('global', 2)))).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cVlanVPNTPIDMode.setStatus('current')
if mibBuilder.loadTexts:
hh3cVlanVPNTPIDMode.setDescription("Vlan VPN TPID mode. The value 'port-based' means VLAN VPN TPID value would be set based on port via hh3cifVlanVPNTPID. In this situation, hh3cVlanVPNTPID is meaningless and always return 0x8100. The value 'global' means VLAN VPN TPID value should be set globally via hh3cVlanVPNTPID. In this situation, hh3cifVlanVPNTPID in hh3cethernetTable has the same value with hh3cVlanVPNTPID.")
hh3c_vlan_vpntpid = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
hh3cVlanVPNTPID.setStatus('current')
if mibBuilder.loadTexts:
hh3cVlanVPNTPID.setDescription('Global Vlan VPN TPID(Tag Protocol Indentifier), default value is 0x8100.')
hh3c_port_isolate_group_table = mib_table((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 11))
if mibBuilder.loadTexts:
hh3cPortIsolateGroupTable.setStatus('current')
if mibBuilder.loadTexts:
hh3cPortIsolateGroupTable.setDescription('Isolate Group attribute table.')
hh3c_port_isolate_group_entry = mib_table_row((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 11, 1)).setIndexNames((0, 'HH3C-LswINF-MIB', 'hh3cPortIsolateGroupIndex'))
if mibBuilder.loadTexts:
hh3cPortIsolateGroupEntry.setStatus('current')
if mibBuilder.loadTexts:
hh3cPortIsolateGroupEntry.setDescription('The entry of hh3cPortIsolateGroupTable.')
hh3c_port_isolate_group_index = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 11, 1, 1), integer32())
if mibBuilder.loadTexts:
hh3cPortIsolateGroupIndex.setStatus('current')
if mibBuilder.loadTexts:
hh3cPortIsolateGroupIndex.setDescription('Port isolate group identifier. The index of the hh3cPortIsolateGroupTable. The value ranges from 1 to the limit of isolate group quantity.')
hh3c_port_isolate_uplink_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 11, 1, 2), interface_index()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cPortIsolateUplinkIfIndex.setStatus('current')
if mibBuilder.loadTexts:
hh3cPortIsolateUplinkIfIndex.setDescription('Index number of the uplink interface.')
hh3c_port_isolate_group_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 11, 1, 3), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cPortIsolateGroupRowStatus.setStatus('current')
if mibBuilder.loadTexts:
hh3cPortIsolateGroupRowStatus.setDescription('Current operation status of the row.')
hh3c_port_isolate_group_description = mib_table_column((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 11, 1, 4), display_string().subtype(subtypeSpec=value_size_constraint(0, 80))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
hh3cPortIsolateGroupDescription.setStatus('current')
if mibBuilder.loadTexts:
hh3cPortIsolateGroupDescription.setDescription('Port isolate group description, default value is zero-length string.')
hh3c_max_mac_learn_range = mib_scalar((1, 3, 6, 1, 4, 1, 25506, 8, 35, 5, 1, 12), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
hh3cMaxMacLearnRange.setStatus('current')
if mibBuilder.loadTexts:
hh3cMaxMacLearnRange.setDescription('The maximum number of MAC address that the port supports.')
mibBuilder.exportSymbols('HH3C-LswINF-MIB', hh3cMaxMacLearn=hh3cMaxMacLearn, hh3cifPpsUniSuppression=hh3cifPpsUniSuppression, hh3cifEthernetFlowInterval=hh3cifEthernetFlowInterval, hh3cifVLANType=hh3cifVLANType, hh3cGlobalBroadcastMaxRatio=hh3cGlobalBroadcastMaxRatio, hh3cifPpsMulSuppression=hh3cifPpsMulSuppression, hh3cifAggregateModel=hh3cifAggregateModel, hh3cIsolateGroupMax=hh3cIsolateGroupMax, hh3cifVLANTrunkAllowListLow=hh3cifVLANTrunkAllowListLow, hh3cifEthernetMdi=hh3cifEthernetMdi, hh3cifHybridPortIndex=hh3cifHybridPortIndex, hh3cVlanVPNTPID=hh3cVlanVPNTPID, hh3cifEthernetSpeed=hh3cifEthernetSpeed, hh3cifEthernetMTU=hh3cifEthernetMTU, hh3cifEthernetDuplex=hh3cifEthernetDuplex, hh3cLswL2InfMibObject=hh3cLswL2InfMibObject, hh3cifisUplinkPort=hh3cifisUplinkPort, hh3cifVLANTrunkPassListLow=hh3cifVLANTrunkPassListLow, hh3cBpduTunnelStatus=hh3cBpduTunnelStatus, hh3cifBMbpsUniSuppressionMax=hh3cifBMbpsUniSuppressionMax, hh3cifComboPortTable=hh3cifComboPortTable, SpeedModeFlag=SpeedModeFlag, hh3cifXXDevPortIndex=hh3cifXXDevPortIndex, hh3cifVlanVPNTPID=hh3cifVlanVPNTPID, hh3cifClearStat=hh3cifClearStat, hh3cifVLANTrunkAllowListHigh=hh3cifVLANTrunkAllowListHigh, hh3cifAggregatePort=hh3cifAggregatePort, hh3cPortIsolateGroupRowStatus=hh3cPortIsolateGroupRowStatus, hh3cPortIsolateGroupDescription=hh3cPortIsolateGroupDescription, hh3cifInNormalPkts=hh3cifInNormalPkts, hh3cifAggregatePortIndex=hh3cifAggregatePortIndex, hh3cifOutPayloadOctets=hh3cifOutPayloadOctets, hh3cifHybridUnTaggedVlanListHigh=hh3cifHybridUnTaggedVlanListHigh, hh3cifISPhyPort=hh3cifISPhyPort, hh3cifUnknownPacketDropMul=hh3cifUnknownPacketDropMul, hh3cifBKbpsUniSuppressionStep=hh3cifBKbpsUniSuppressionStep, hh3cifPpsMulSuppressionMax=hh3cifPpsMulSuppressionMax, hh3cifEthernetAutoSpeedMask=hh3cifEthernetAutoSpeedMask, hh3cifUniSuppression=hh3cifUniSuppression, hh3cifMacAddressLearn=hh3cifMacAddressLearn, hh3cPortIsolateGroupIndex=hh3cPortIsolateGroupIndex, hh3cifInPkts=hh3cifInPkts, hh3cifMcastControl=hh3cifMcastControl, hh3cifBKbpsUniSuppressionMax=hh3cifBKbpsUniSuppressionMax, hh3cifVLANTrunkStatusTable=hh3cifVLANTrunkStatusTable, hh3cLswL2InfMib=hh3cLswL2InfMib, hh3cifMulSuppressionStep=hh3cifMulSuppressionStep, DropDirection=DropDirection, hh3cifBMbpsMulSuppressionMax=hh3cifBMbpsMulSuppressionMax, hh3cifHybridTaggedVlanListHigh=hh3cifHybridTaggedVlanListHigh, hh3cifVLANTrunkStatusEntry=hh3cifVLANTrunkStatusEntry, hh3cifEthernetTest=hh3cifEthernetTest, hh3cifVLANTrunkIndex=hh3cifVLANTrunkIndex, hh3cifComboPortCurActive=hh3cifComboPortCurActive, PYSNMP_MODULE_ID=hh3cLswL2InfMib, hh3cPortIsolateGroupEntry=hh3cPortIsolateGroupEntry, hh3cifInPayloadOctets=hh3cifInPayloadOctets, hh3cifAggregatePortName=hh3cifAggregatePortName, hh3cifInErrorPktsRate=hh3cifInErrorPktsRate, hh3cifSrcMacControl=hh3cifSrcMacControl, InterfaceIndex=InterfaceIndex, hh3cifXXBasePortIndex=hh3cifXXBasePortIndex, hh3cifHybridPortTable=hh3cifHybridPortTable, hh3cSlotPortMax=hh3cSlotPortMax, hh3cifVLANTrunkGvrpRegistration=hh3cifVLANTrunkGvrpRegistration, hh3cPortIsolateUplinkIfIndex=hh3cPortIsolateUplinkIfIndex, hh3cLswExtInterface=hh3cLswExtInterface, hh3cifOutPkts=hh3cifOutPkts, hh3cifHybridTaggedVlanListLow=hh3cifHybridTaggedVlanListLow, hh3cifIsolateGroupID=hh3cifIsolateGroupID, PortList=PortList, hh3cPortIsolateGroupTable=hh3cPortIsolateGroupTable, hh3cifAggregateTable=hh3cifAggregateTable, hh3cifEthernetAutoSpeed=hh3cifEthernetAutoSpeed, hh3cifPpsUniSuppressionMax=hh3cifPpsUniSuppressionMax, hh3cifBKbpsUniSuppression=hh3cifBKbpsUniSuppression, VlanIndex=VlanIndex, hh3cifHybridUnTaggedVlanListLow=hh3cifHybridUnTaggedVlanListLow, hh3cifBKbpsMulSuppressionStep=hh3cifBKbpsMulSuppressionStep, hh3cSwitchPortMax=hh3cSwitchPortMax, hh3cifBMbpsUniSuppression=hh3cifBMbpsUniSuppression, hh3cifComboPortEntry=hh3cifComboPortEntry, hh3cifVlanVPNStatus=hh3cifVlanVPNStatus, hh3cifXXEntry=hh3cifXXEntry, hh3cifMirrorPort=hh3cifMirrorPort, hh3cifEthernetIsolate=hh3cifEthernetIsolate, hh3cifMulSuppression=hh3cifMulSuppression, hh3cGlobalBroadcastMaxPps=hh3cGlobalBroadcastMaxPps, hh3cifComboActivePort=hh3cifComboActivePort, hh3cifUniSuppressionStep=hh3cifUniSuppressionStep, hh3cifMacAddrLearnMode=hh3cifMacAddrLearnMode, hh3cifAggregateOperStatus=hh3cifAggregateOperStatus, hh3cifXXTable=hh3cifXXTable, hh3cifPpsMcastControl=hh3cifPpsMcastControl, hh3cifVlanVPNUplinkStatus=hh3cifVlanVPNUplinkStatus, hh3cifFlowControl=hh3cifFlowControl, hh3cifPpsBcastDisValControl=hh3cifPpsBcastDisValControl, hh3cMaxMacLearnRange=hh3cMaxMacLearnRange, hh3cethernetEntry=hh3cethernetEntry, hh3cifHybridPortEntry=hh3cifHybridPortEntry, hh3cethernetTable=hh3cethernetTable, hh3cifAggregateEntry=hh3cifAggregateEntry, hh3cifAggregatePortListPorts=hh3cifAggregatePortListPorts, hh3cifBKbpsMulSuppressionMax=hh3cifBKbpsMulSuppressionMax, hh3cifBMbpsMulSuppression=hh3cifBMbpsMulSuppression, hh3cVlanVPNTPIDMode=hh3cVlanVPNTPIDMode, hh3cifUnBoundPort=hh3cifUnBoundPort, hh3cifVLANTrunkPassListHigh=hh3cifVLANTrunkPassListHigh, hh3cifBKbpsMulSuppression=hh3cifBKbpsMulSuppression, hh3cifUnknownPacketDropUni=hh3cifUnknownPacketDropUni, hh3cifComboPortIndex=hh3cifComboPortIndex)
|
dt = 1/10
a = gamma.pdf( np.arange(0,10,dt), 2.5, 0 )
t = np.arange(0,10,dt)
# what should go into the np.cumsum() function?
v = np.cumsum(a*dt)
# this just plots your velocity:
with plt.xkcd():
plt.figure(figsize=(10,6))
plt.plot(t,a,label='acceleration [$m/s^2$]')
plt.plot(t,v,label='velocity [$m/s$]')
plt.xlabel('time [s]')
plt.ylabel('[motion]')
plt.legend(facecolor='xkcd:white')
plt.show()
|
dt = 1 / 10
a = gamma.pdf(np.arange(0, 10, dt), 2.5, 0)
t = np.arange(0, 10, dt)
v = np.cumsum(a * dt)
with plt.xkcd():
plt.figure(figsize=(10, 6))
plt.plot(t, a, label='acceleration [$m/s^2$]')
plt.plot(t, v, label='velocity [$m/s$]')
plt.xlabel('time [s]')
plt.ylabel('[motion]')
plt.legend(facecolor='xkcd:white')
plt.show()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.