content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Limit:
def __init__(self, ratio=1, knee=0, gain=1, enable=True):
"""
:param float ratio: the compression ratio (1 means no compression).
ratio should usually between 0 and 1.
:param float knee: the ratio where the compression starts to kick in.
knee should usually be 0 <= knee <= ratio
:param float gain: post limiter output gain. gain should usually be >= 0
"""
# ratio and knee are properties, because we need to recompute _scale
self.ratio = ratio
self.knee = knee
self.gain = gain
self.enable = enable
def __bool__(self):
return self.enable and (self.gain != 1 or self.ratio < 1)
def limit(self, value):
if not (self.enable or self):
return value
overshoot = value - self.knee
if overshoot >= 0:
scale = (self.ratio - self.knee) / (1 - self.knee or 1)
value = self.knee + overshoot * scale
value = min(value, self.ratio)
return value * self.gain
def limit_colors(self, colors, math):
if self:
total = math.sum(colors)
max_total = 3 * 255 * len(colors)
average = total / max_total
limit = self.limit(average) / average
math.scale(colors, limit)
| class Limit:
def __init__(self, ratio=1, knee=0, gain=1, enable=True):
"""
:param float ratio: the compression ratio (1 means no compression).
ratio should usually between 0 and 1.
:param float knee: the ratio where the compression starts to kick in.
knee should usually be 0 <= knee <= ratio
:param float gain: post limiter output gain. gain should usually be >= 0
"""
self.ratio = ratio
self.knee = knee
self.gain = gain
self.enable = enable
def __bool__(self):
return self.enable and (self.gain != 1 or self.ratio < 1)
def limit(self, value):
if not (self.enable or self):
return value
overshoot = value - self.knee
if overshoot >= 0:
scale = (self.ratio - self.knee) / (1 - self.knee or 1)
value = self.knee + overshoot * scale
value = min(value, self.ratio)
return value * self.gain
def limit_colors(self, colors, math):
if self:
total = math.sum(colors)
max_total = 3 * 255 * len(colors)
average = total / max_total
limit = self.limit(average) / average
math.scale(colors, limit) |
'''
Gui/Views/Visualizer
____________________
Contains QTreeView, QWidget and PyQtGraph canvas definitions for
visualizer displays.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
'''
__all__ = []
| """
Gui/Views/Visualizer
____________________
Contains QTreeView, QWidget and PyQtGraph canvas definitions for
visualizer displays.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
"""
__all__ = [] |
n=int(input())
L=input().split()
k=dict()
for i in range(len(L)):
k[L[i]]=i
L2=input().split()
ans = 0
for i in range(n):
for j in range(i+1,n):
if k[L2[i]] < k[L2[j]]:
ans+=1
print("{}/{}".format(ans,n*(n-1)//2))
| n = int(input())
l = input().split()
k = dict()
for i in range(len(L)):
k[L[i]] = i
l2 = input().split()
ans = 0
for i in range(n):
for j in range(i + 1, n):
if k[L2[i]] < k[L2[j]]:
ans += 1
print('{}/{}'.format(ans, n * (n - 1) // 2)) |
#1 Write a python program, which adds a new value with the given key in dict.
dic = {"A":5,"B":9,"C":25}
def new_value(key,value,d):
d[key] = value
return d
#2 Write a python program which concat 2 dicts.
def concat(d1,d2):
d1.update(d2)
return d1
# 3 Write a python program, which create a dictionary for given number N, where keys are numbers from 1 to N, and values are cubs of
def cubes(N):
d = {}
for x in range(1, N):
d[x]=x ** 3
return d
#4 Write a python program which create dict from 2 lists with the same length
def new_dic(l1,l2):
dic = {}
for i in range(0,len(l1)):
dic[l1[i]] = l2[i]
return dic
#5 Write a python program which gets the maximum and minimum values of a dictionary.
def max_min(d):
l = list(d.values())
l.sort()
return l[-1],l[0]
#6 Write a python program which combines 2 dictionaries into one, if there is an element with the same key, appropriate element of combined dict will be an element with that key, and sum of values as value.
def sum(d1,d2):
for key,value in d2.items():
if key in d1.keys():
value = value + d1[key]
d1[key]=value
d1[key]=value
return d1
#7 Write a python program which create dict from string, where keys are letters of string, values are counts of letters in string
def new_dic_from_string(s):
d = {}
for i in range(0,len(s)):
d[s[i]]=s.count(s[i])
return d
def main():
s1 = {"A": 5, "B": 9, "C": 25}
s2 = {"D": 5, "E": 10, "F": 25}
l1 = [1, 2, 5, 6, 7]
l2 = ["A", "B", "C", "D", "E"]
print(new_value("A", 8, dic))
print(concat(s1,s2))
print(cubes(10))
print(new_dic(l1,l2))
print(max_min(s1))
print(sum(s1,s2))
print(new_dic_from_string("spring"))
main()
| dic = {'A': 5, 'B': 9, 'C': 25}
def new_value(key, value, d):
d[key] = value
return d
def concat(d1, d2):
d1.update(d2)
return d1
def cubes(N):
d = {}
for x in range(1, N):
d[x] = x ** 3
return d
def new_dic(l1, l2):
dic = {}
for i in range(0, len(l1)):
dic[l1[i]] = l2[i]
return dic
def max_min(d):
l = list(d.values())
l.sort()
return (l[-1], l[0])
def sum(d1, d2):
for (key, value) in d2.items():
if key in d1.keys():
value = value + d1[key]
d1[key] = value
d1[key] = value
return d1
def new_dic_from_string(s):
d = {}
for i in range(0, len(s)):
d[s[i]] = s.count(s[i])
return d
def main():
s1 = {'A': 5, 'B': 9, 'C': 25}
s2 = {'D': 5, 'E': 10, 'F': 25}
l1 = [1, 2, 5, 6, 7]
l2 = ['A', 'B', 'C', 'D', 'E']
print(new_value('A', 8, dic))
print(concat(s1, s2))
print(cubes(10))
print(new_dic(l1, l2))
print(max_min(s1))
print(sum(s1, s2))
print(new_dic_from_string('spring'))
main() |
prompt = """
<|endoftext|># I am a voice assistant. I execute commands on behalf of the user and answer their questions
# I have access to the following APIs:
# Spotipy
import spotipy
from spotipy.oauth2 import SpotifyOAuth as OAuth
spotify = spotipy.Spotify(auth_manager=OAuth(scope="user-read-recently-played,user-read-playback-state,user-top-read,app-remote-control,streaming,user-library-modify"))
# Kivy
import kivy
# Window is the window of the user
# - Window.say: Say something to the user
# Command: Say Hi
return "Hi"
# Command: List files inside the test directory
from os import listdir
return f"The files in the test directory are {listdir('./test')}"
# Command: Who is Albert Einstein?
return "Albert Einstein is physicist who developed the special and general theories of relativity, best known through the equation e=mc^2"
# Command: Play "The painful way" after this one
search = spotify.search("The painful way")
track = search['tracks']['items'][0]
spotify.add_to_queue(track['uri'])
return f"Okay, I've queued up {track['name']} by {track['artists'][0]['name']}"
# Command: What song am I currently playing?
track = spotify.current_playback()['item']
return f"You are currently playing {track['name']} by {track['artists'][0]['name']}"
# Command: Mark this song as my favorite
track = spotify.current_playback()['item']
spotify.current_user_saved_tracks_add([track['uri']])
return f"Okay, I've added {track['name']} in your liked tracks"
# Command: How much is e^i (-pi / 4)
import math
return f"The answer is {math.cos(-math.pi / 4) + 1j * math.sin(-math.pi / 4)}"
# Command: What are the lyrics of the current track?
import requests
track = spotify.current_playback()['item']
response = requests.get(f"https://api.lyrics.ovh/v1/{track['artists'][0]['name']}/{track['name']}")
lyrics = response.json()['lyrics']
return lyrics
# Command: Play my favorite song
import random
tracks = spotify.current_user_saved_tracks()['items']
track = random.choice(tracks)['track']
spotify.add_to_queue(track['uri'])
return f"Okay, I've queued up {track[f'name']} by {track['artists'][0]['name']}"
"""
| prompt = '\n<|endoftext|># I am a voice assistant. I execute commands on behalf of the user and answer their questions\n# I have access to the following APIs:\n# Spotipy\nimport spotipy\nfrom spotipy.oauth2 import SpotifyOAuth as OAuth\n\nspotify = spotipy.Spotify(auth_manager=OAuth(scope="user-read-recently-played,user-read-playback-state,user-top-read,app-remote-control,streaming,user-library-modify"))\n\n# Kivy\nimport kivy\n# Window is the window of the user\n# - Window.say: Say something to the user\n\n# Command: Say Hi\nreturn "Hi"\n\n# Command: List files inside the test directory\nfrom os import listdir\nreturn f"The files in the test directory are {listdir(\'./test\')}"\n\n# Command: Who is Albert Einstein?\nreturn "Albert Einstein is physicist who developed the special and general theories of relativity, best known through the equation e=mc^2"\n\n# Command: Play "The painful way" after this one\nsearch = spotify.search("The painful way")\ntrack = search[\'tracks\'][\'items\'][0]\nspotify.add_to_queue(track[\'uri\'])\n\nreturn f"Okay, I\'ve queued up {track[\'name\']} by {track[\'artists\'][0][\'name\']}"\n\n# Command: What song am I currently playing?\ntrack = spotify.current_playback()[\'item\']\n\nreturn f"You are currently playing {track[\'name\']} by {track[\'artists\'][0][\'name\']}"\n\n# Command: Mark this song as my favorite\ntrack = spotify.current_playback()[\'item\']\nspotify.current_user_saved_tracks_add([track[\'uri\']])\n\nreturn f"Okay, I\'ve added {track[\'name\']} in your liked tracks"\n\n# Command: How much is e^i (-pi / 4)\nimport math\n\nreturn f"The answer is {math.cos(-math.pi / 4) + 1j * math.sin(-math.pi / 4)}"\n\n# Command: What are the lyrics of the current track?\nimport requests\n\ntrack = spotify.current_playback()[\'item\']\nresponse = requests.get(f"https://api.lyrics.ovh/v1/{track[\'artists\'][0][\'name\']}/{track[\'name\']}")\nlyrics = response.json()[\'lyrics\']\n\nreturn lyrics\n\n# Command: Play my favorite song\nimport random\n\ntracks = spotify.current_user_saved_tracks()[\'items\']\ntrack = random.choice(tracks)[\'track\']\nspotify.add_to_queue(track[\'uri\'])\n\nreturn f"Okay, I\'ve queued up {track[f\'name\']} by {track[\'artists\'][0][\'name\']}"\n' |
"""
Deep inverse problems in Python
Multi-channel MRI forward operator
"""
| """
Deep inverse problems in Python
Multi-channel MRI forward operator
""" |
__author__ = 'Jeffrey Seifried'
__description__ = 'Scraping tools for getting me a damn Nintendo Switch'
__email__ = 'jeffrey.seifried@gmail.com'
__program__ = 'switch'
__url__ = 'http://github.com/jeffseif/{}'.format(__program__)
__version__ = '1.0.0'
__year__ = '2017'
HEADERS = {
'Accept': '*/*',
'Accept-Encoding': 'gzip, deflate, sdch',
'Accept-Language': 'en-US,en;q=0.8',
'Connection': 'keep-alive',
'Referer': 'https://www.google.com/',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36', # noqa
}
TTL = 600 # IO caches will be ignored after 10 minutes
| __author__ = 'Jeffrey Seifried'
__description__ = 'Scraping tools for getting me a damn Nintendo Switch'
__email__ = 'jeffrey.seifried@gmail.com'
__program__ = 'switch'
__url__ = 'http://github.com/jeffseif/{}'.format(__program__)
__version__ = '1.0.0'
__year__ = '2017'
headers = {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate, sdch', 'Accept-Language': 'en-US,en;q=0.8', 'Connection': 'keep-alive', 'Referer': 'https://www.google.com/', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36'}
ttl = 600 |
class Player:
"""A person taking part in a game.
The responsibility of Player is to record player moves and hints.
Stereotype:
Information Holder
Attributes:
_name (string): The player's name.
_move (Move): The player's last move.
"""
def __init__(self, players=list):
"""The class constructor.
Args:
self (Player): an instance of Player.
players (list): a list of player names
"""
self.__moves = {player: [] for player in players}
def get_moves(self, player=str):
"""Returns a player's move/hint record. If the player
hasn't moved yet this method returns None.
Args:
self (Player): an instance of Player.
"""
if player in self.__moves.keys():
return self.__moves[player]
return None
def record_move(self, player=str, move_hint=tuple):
"""Sets the player's last move to the given instance of Move.
Args:
self (Player): an instance of Player.
move_hint (tuple): a tuple of strings of the player's move,
followed by the resulting hint.
"""
self.__moves[player].append(move_hint)
| class Player:
"""A person taking part in a game.
The responsibility of Player is to record player moves and hints.
Stereotype:
Information Holder
Attributes:
_name (string): The player's name.
_move (Move): The player's last move.
"""
def __init__(self, players=list):
"""The class constructor.
Args:
self (Player): an instance of Player.
players (list): a list of player names
"""
self.__moves = {player: [] for player in players}
def get_moves(self, player=str):
"""Returns a player's move/hint record. If the player
hasn't moved yet this method returns None.
Args:
self (Player): an instance of Player.
"""
if player in self.__moves.keys():
return self.__moves[player]
return None
def record_move(self, player=str, move_hint=tuple):
"""Sets the player's last move to the given instance of Move.
Args:
self (Player): an instance of Player.
move_hint (tuple): a tuple of strings of the player's move,
followed by the resulting hint.
"""
self.__moves[player].append(move_hint) |
class FibonacciImpl:
arr = [0,1,1]
def calculate(self, num: int):
if num < len(self.arr):
return self.arr[num]
else:
for i in range(len(self.arr)-1, num):
new_fib = self.arr[i-1] + self.arr[i]
self.arr.append(new_fib)
return self.arr[num]
fib_impl = FibonacciImpl()
def fib(num):
global fib_impl
return fib_impl.calculate(num)
def metod_fib(func, a, b, eps=0.001, sigma=0.001 / 10):
N = int((b - a) / (2 * eps))
print('tyt N - ',N)
x1 = a + fib(N - 2) / fib(N) * (b - a)
x2 = a + fib(N - 1) / fib(N) * (b - a)
for k in range(2, N - 2):
if func(x1) <= func(x2):
b = x2
x2 = x1
x1 = a + fib(N - k - 3) / fib(N - k - 1) * (b - a)
else:
a = x1
x1 = x2
x2 = a + fib(N - k - 2) / fib(N - k - 1) * (b - a)
x2 = x1 + sigma
if func(x1) <= func(x2):
b = x2
else:
a = x1
return (a + b) / 2 | class Fibonacciimpl:
arr = [0, 1, 1]
def calculate(self, num: int):
if num < len(self.arr):
return self.arr[num]
else:
for i in range(len(self.arr) - 1, num):
new_fib = self.arr[i - 1] + self.arr[i]
self.arr.append(new_fib)
return self.arr[num]
fib_impl = fibonacci_impl()
def fib(num):
global fib_impl
return fib_impl.calculate(num)
def metod_fib(func, a, b, eps=0.001, sigma=0.001 / 10):
n = int((b - a) / (2 * eps))
print('tyt N - ', N)
x1 = a + fib(N - 2) / fib(N) * (b - a)
x2 = a + fib(N - 1) / fib(N) * (b - a)
for k in range(2, N - 2):
if func(x1) <= func(x2):
b = x2
x2 = x1
x1 = a + fib(N - k - 3) / fib(N - k - 1) * (b - a)
else:
a = x1
x1 = x2
x2 = a + fib(N - k - 2) / fib(N - k - 1) * (b - a)
x2 = x1 + sigma
if func(x1) <= func(x2):
b = x2
else:
a = x1
return (a + b) / 2 |
class Color(object):
def __init__(self, rgb_value, name):
self.rgb_value = rgb_value
self.name = name
if __name__ == "__main__":
c = Color("#ff0000", "bright_red")
print(c.name)
c.name = "red"
| class Color(object):
def __init__(self, rgb_value, name):
self.rgb_value = rgb_value
self.name = name
if __name__ == '__main__':
c = color('#ff0000', 'bright_red')
print(c.name)
c.name = 'red' |
def balanced_brackets(inp):
# if odd number, can't be balanced
if len(inp) % 2 is not 0: return False
# opening brackets
opening = set('[{(')
s = [] # functions as a stack (last in, first out)
for c in inp:
# if no items in stack, add first character
if len(s) is 0: s.append(c)
else:
# if character (c) is closing bracket and last item in stack is opening of same
# style bracket, remove opening from stack
if (s[-1] == "[" and c == "]") or (s[-1] == "{" and c == "}") or (s[-1] == "(" and c == ")"): s.pop()
# if character is new opening, add to stack
elif c in opening: s.append(c)
# if character is not opening (closing) and is not paired with an opening,
# unbalanced string (return false)
else: return False
# balanced if no leftover openings in stack (because all were removed due to
# correct closing brackets)
return len(s) is 0
print(balanced_brackets("([])[]({})") is True and balanced_brackets("([)]") is False and balanced_brackets("((()") is False) | def balanced_brackets(inp):
if len(inp) % 2 is not 0:
return False
opening = set('[{(')
s = []
for c in inp:
if len(s) is 0:
s.append(c)
elif s[-1] == '[' and c == ']' or (s[-1] == '{' and c == '}') or (s[-1] == '(' and c == ')'):
s.pop()
elif c in opening:
s.append(c)
else:
return False
return len(s) is 0
print(balanced_brackets('([])[]({})') is True and balanced_brackets('([)]') is False and (balanced_brackets('((()') is False)) |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : constant.py
@Contact : 379327479@qq.com
@License : MIT
@Modify Time @Author @Version @Description
------------ ------- -------- -----------
2021/10/25 16:34 zxd 1.0 None
"""
APP_PACKAGE = 'com.ss.android.ugc.aweme'
ACT_AD = ''
ACT_MAIN = 'com.ss.android.ugc.aweme.main.MainActivity'
ACT_SEARCH_RESULT = 'com.ss.android.ugc.aweme.search.activity.SearchResultActivity'
ACT_USER_PROFILE = 'com.ss.android.ugc.aweme.profile.ui.UserProfileActivity'
ACT_LIVE_DETAIL = 'com.ss.android.ugc.aweme.detail.ui.LiveDetailActivity'
SUCCESS = 0
ERROR_ACTION_PARAMS = 10
LAUNCH_ERROR = 100
SEARCH_ERROR = 200
LIVE_ERROR = 300 | """
@File : constant.py
@Contact : 379327479@qq.com
@License : MIT
@Modify Time @Author @Version @Description
------------ ------- -------- -----------
2021/10/25 16:34 zxd 1.0 None
"""
app_package = 'com.ss.android.ugc.aweme'
act_ad = ''
act_main = 'com.ss.android.ugc.aweme.main.MainActivity'
act_search_result = 'com.ss.android.ugc.aweme.search.activity.SearchResultActivity'
act_user_profile = 'com.ss.android.ugc.aweme.profile.ui.UserProfileActivity'
act_live_detail = 'com.ss.android.ugc.aweme.detail.ui.LiveDetailActivity'
success = 0
error_action_params = 10
launch_error = 100
search_error = 200
live_error = 300 |
def binarySearchSortedArray(nums, s):
"""
Args:
{List<int>} nums
{int} s
Returns:
{boolean} Whether s is in nums.
"""
# Write your code here.
beginning = 0
end = len(nums) - 1
found = False
while beginning <= end and not found:
mid = (beginning + end) // 2
if nums[mid] == s:
found = True
else:
if s <= nums[mid]:
end = mid - 1
if s >= nums[mid]:
beginning = mid + 1
return found | def binary_search_sorted_array(nums, s):
"""
Args:
{List<int>} nums
{int} s
Returns:
{boolean} Whether s is in nums.
"""
beginning = 0
end = len(nums) - 1
found = False
while beginning <= end and (not found):
mid = (beginning + end) // 2
if nums[mid] == s:
found = True
else:
if s <= nums[mid]:
end = mid - 1
if s >= nums[mid]:
beginning = mid + 1
return found |
class Solution:
def pathSum(self, root: TreeNode, sum: int) -> int:
if not root:
return 0
def dfs(root: TreeNode, sum: int) -> int:
if not root:
return 0
return (sum == root.val) + \
dfs(root.left, sum - root.val) + \
dfs(root.right, sum - root.val)
return dfs(root, sum) + \
self.pathSum(root.left, sum) + \
self.pathSum(root.right, sum)
| class Solution:
def path_sum(self, root: TreeNode, sum: int) -> int:
if not root:
return 0
def dfs(root: TreeNode, sum: int) -> int:
if not root:
return 0
return (sum == root.val) + dfs(root.left, sum - root.val) + dfs(root.right, sum - root.val)
return dfs(root, sum) + self.pathSum(root.left, sum) + self.pathSum(root.right, sum) |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @author JourWon
# @date 2022/1/7
# @file ListNode.py
def __init__(self, x):
self.val = x
self.next = None
| def __init__(self, x):
self.val = x
self.next = None |
#!/usr/bin/env python
def main():
print("Start training")
x_array = [1.0, 2.0, 3.0, 4.0, 5.0]
# y = 2x + 3
y_array = [5.0, 7.0, 9.0, 11.0, 13.0]
instance_number = len(x_array)
learning_rate = 0.01
epoch_number = 100
w = 1.0
b = 1.0
for epoch_index in range(epoch_number):
w_grad = 0.0
b_grad = 0.0
loss = 0.0
for i in range(instance_number):
x = x_array[i]
y = y_array[i]
w_grad += -2.0 / instance_number * x * (y - w * x - b)
b_grad += -2.0 / instance_number * (y - w * x - b)
loss += 1.0 / instance_number * pow(y - w * x - b, 2)
w -= learning_rate * w_grad
b -= learning_rate * b_grad
print("Epoch is: {} w is: {}, w is: {}, loss is: {}".format(
epoch_index, w, b, loss))
if __name__ == "__main__":
main()
| def main():
print('Start training')
x_array = [1.0, 2.0, 3.0, 4.0, 5.0]
y_array = [5.0, 7.0, 9.0, 11.0, 13.0]
instance_number = len(x_array)
learning_rate = 0.01
epoch_number = 100
w = 1.0
b = 1.0
for epoch_index in range(epoch_number):
w_grad = 0.0
b_grad = 0.0
loss = 0.0
for i in range(instance_number):
x = x_array[i]
y = y_array[i]
w_grad += -2.0 / instance_number * x * (y - w * x - b)
b_grad += -2.0 / instance_number * (y - w * x - b)
loss += 1.0 / instance_number * pow(y - w * x - b, 2)
w -= learning_rate * w_grad
b -= learning_rate * b_grad
print('Epoch is: {} w is: {}, w is: {}, loss is: {}'.format(epoch_index, w, b, loss))
if __name__ == '__main__':
main() |
def chunks(messageLength, chunkSize):
chunkValues = []
for i in range(0, len(messageLength), chunkSize):
chunkValues.append(messageLength[i:i+chunkSize])
return chunkValues
def leftRotate(chunk, rotateLength):
return ((chunk << rotateLength) | (chunk >> (32 - rotateLength))) & 0xffffffff
def sha1(message):
#initial hash values
h0 = 0x67452301
h1 = 0xEFCDAB89
h2 = 0x98BADCFE
h3 = 0x10325476
h4 = 0xC3D2E1F0
messageLength = ""
#preprocessing
for char in range(len(message)):
messageLength += '{0:08b}'.format(ord(message[char]))
temp = messageLength
messageLength += '1'
while(len(messageLength) % 512 != 448):
messageLength += '0'
messageLength += '{0:064b}'.format(len(temp))
chunk = chunks(messageLength, 512)
for eachChunk in chunk:
words = chunks(eachChunk, 32)
w = [0] * 80
for n in range(0, 16):
w[n] = int(words[n], 2)
for i in range(16, 80):
w[i] = leftRotate((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(0, 80):
if 0 <= i <= 19:
f = (b & c) | ((~b) & d)
k = 0x5A827999
elif 20 <= i <= 39:
f = b ^ c ^ d
k = 0x6ED9EBA1
elif 40 <= i <= 59:
f = (b & c) | (b & d) | (c & d)
k = 0x8F1BBCDC
elif 60 <= i <= 79:
f = b ^ c ^ d
k = 0xCA62C1D6
a, b, c, d, e = ((leftRotate(a, 5) + f + e + k + w[i]) & 0xffffffff, a, leftRotate(b, 30), c, d)
h0 = h0 + a & 0xffffffff
h1 = h1 + b & 0xffffffff
h2 = h2 + c & 0xffffffff
h3 = h3 + d & 0xffffffff
h4 = h4 + e & 0xffffffff
return '%08x%08x%08x%08x%08x' % (h0, h1, h2, h3, h4) | def chunks(messageLength, chunkSize):
chunk_values = []
for i in range(0, len(messageLength), chunkSize):
chunkValues.append(messageLength[i:i + chunkSize])
return chunkValues
def left_rotate(chunk, rotateLength):
return (chunk << rotateLength | chunk >> 32 - rotateLength) & 4294967295
def sha1(message):
h0 = 1732584193
h1 = 4023233417
h2 = 2562383102
h3 = 271733878
h4 = 3285377520
message_length = ''
for char in range(len(message)):
message_length += '{0:08b}'.format(ord(message[char]))
temp = messageLength
message_length += '1'
while len(messageLength) % 512 != 448:
message_length += '0'
message_length += '{0:064b}'.format(len(temp))
chunk = chunks(messageLength, 512)
for each_chunk in chunk:
words = chunks(eachChunk, 32)
w = [0] * 80
for n in range(0, 16):
w[n] = int(words[n], 2)
for i in range(16, 80):
w[i] = left_rotate(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(0, 80):
if 0 <= i <= 19:
f = b & c | ~b & d
k = 1518500249
elif 20 <= i <= 39:
f = b ^ c ^ d
k = 1859775393
elif 40 <= i <= 59:
f = b & c | b & d | c & d
k = 2400959708
elif 60 <= i <= 79:
f = b ^ c ^ d
k = 3395469782
(a, b, c, d, e) = (left_rotate(a, 5) + f + e + k + w[i] & 4294967295, a, left_rotate(b, 30), c, d)
h0 = h0 + a & 4294967295
h1 = h1 + b & 4294967295
h2 = h2 + c & 4294967295
h3 = h3 + d & 4294967295
h4 = h4 + e & 4294967295
return '%08x%08x%08x%08x%08x' % (h0, h1, h2, h3, h4) |
'''
- Leetcode problem: 937
- Difficulty: Easy
- Brief problem description:
You have an array of logs. Each log is a space delimited string of words.
For each log, the first word in each log is an alphanumeric identifier. Then, either:
Each word after the identifier will consist only of lowercase letters, or;
Each word after the identifier will consist only of digits.
We will call these two varieties of logs letter-logs and digit-logs. It is guaranteed that each log has at least one
word after its identifier.
Reorder the logs so that all of the letter-logs come before any digit-log. The letter-logs are ordered
lexicographically ignoring identifier, with the identifier used in case of ties. The digit-logs should be put in their
original order.
Return the final order of the logs.
Example 1:
Input: logs = ["dig1 8 1 5 1","let1 art can","dig2 3 6","let2 own kit dig","let3 art zero"]
Output: ["let1 art can","let3 art zero","let2 own kit dig","dig1 8 1 5 1","dig2 3 6"]
Constraints:
0 <= logs.length <= 100
3 <= logs[i].length <= 100
logs[i] is guaranteed to have an identifier, and a word after the identifier.
- Solution Summary:
- Used Resources:
--- Bo Zhou
'''
class Solution:
def reorderLogFiles(self, logs: List[str]) -> List[str]:
def sortFun(log):
head, body = log.split(' ', 1)
if body[0].isalpha():
return (0, body, head)
else:
return (1,)
return sorted(logs, key=sortFun) | """
- Leetcode problem: 937
- Difficulty: Easy
- Brief problem description:
You have an array of logs. Each log is a space delimited string of words.
For each log, the first word in each log is an alphanumeric identifier. Then, either:
Each word after the identifier will consist only of lowercase letters, or;
Each word after the identifier will consist only of digits.
We will call these two varieties of logs letter-logs and digit-logs. It is guaranteed that each log has at least one
word after its identifier.
Reorder the logs so that all of the letter-logs come before any digit-log. The letter-logs are ordered
lexicographically ignoring identifier, with the identifier used in case of ties. The digit-logs should be put in their
original order.
Return the final order of the logs.
Example 1:
Input: logs = ["dig1 8 1 5 1","let1 art can","dig2 3 6","let2 own kit dig","let3 art zero"]
Output: ["let1 art can","let3 art zero","let2 own kit dig","dig1 8 1 5 1","dig2 3 6"]
Constraints:
0 <= logs.length <= 100
3 <= logs[i].length <= 100
logs[i] is guaranteed to have an identifier, and a word after the identifier.
- Solution Summary:
- Used Resources:
--- Bo Zhou
"""
class Solution:
def reorder_log_files(self, logs: List[str]) -> List[str]:
def sort_fun(log):
(head, body) = log.split(' ', 1)
if body[0].isalpha():
return (0, body, head)
else:
return (1,)
return sorted(logs, key=sortFun) |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 29 14:53:39 2021
@author: akladke
"""
s = "azcbobobegghakl"
count = 0
for i in range(len(s)):
if s[i:i+3] == "bob":
count += 1
print("Number of times bob occurs is: " + str(count))
| """
Created on Fri Jan 29 14:53:39 2021
@author: akladke
"""
s = 'azcbobobegghakl'
count = 0
for i in range(len(s)):
if s[i:i + 3] == 'bob':
count += 1
print('Number of times bob occurs is: ' + str(count)) |
def add_arg(*args, **kwargs):
"""Used for shell argument parsing"""
return (args, kwargs)
def escape(str):
"""Precede all special characters with a backslash."""
out = ''
for char in str:
if char in '\\ ':
out += '\\'
out += char
return out
def unescape(str):
"""Undoes the effects of the escape() function."""
out = ''
prev_backslash = False
for char in str:
if not prev_backslash and char == '\\':
prev_backslash = True
continue
out += char
prev_backslash = False
return out
def align_cell(fmt, elem, width):
"""Returns an aligned element."""
if fmt == "<":
return elem + ' ' * (width - len(elem))
if fmt == ">":
return ' ' * (width - len(elem)) + elem
return elem
def column_print(fmt, rows, print_func):
"""Prints a formatted list, adjusting the width so everything fits.
fmt contains a single character for each column. < indicates that the
column should be left justified, > indicates that the column should
be right justified. The last column may be a space which imples left
justification and no padding.
"""
# Figure out the max width of each column
num_cols = len(fmt)
width = [max(0 if isinstance(row, str) else len(row[i]) for row in rows)
for i in range(num_cols)]
for row in rows:
if isinstance(row, str):
# Print a seperator line
print_func(' '.join([row * width[i] for i in range(num_cols)]))
else:
print_func(' '.join([align_cell(fmt[i], row[i], width[i])
for i in range(num_cols)]))
| def add_arg(*args, **kwargs):
"""Used for shell argument parsing"""
return (args, kwargs)
def escape(str):
"""Precede all special characters with a backslash."""
out = ''
for char in str:
if char in '\\ ':
out += '\\'
out += char
return out
def unescape(str):
"""Undoes the effects of the escape() function."""
out = ''
prev_backslash = False
for char in str:
if not prev_backslash and char == '\\':
prev_backslash = True
continue
out += char
prev_backslash = False
return out
def align_cell(fmt, elem, width):
"""Returns an aligned element."""
if fmt == '<':
return elem + ' ' * (width - len(elem))
if fmt == '>':
return ' ' * (width - len(elem)) + elem
return elem
def column_print(fmt, rows, print_func):
"""Prints a formatted list, adjusting the width so everything fits.
fmt contains a single character for each column. < indicates that the
column should be left justified, > indicates that the column should
be right justified. The last column may be a space which imples left
justification and no padding.
"""
num_cols = len(fmt)
width = [max((0 if isinstance(row, str) else len(row[i]) for row in rows)) for i in range(num_cols)]
for row in rows:
if isinstance(row, str):
print_func(' '.join([row * width[i] for i in range(num_cols)]))
else:
print_func(' '.join([align_cell(fmt[i], row[i], width[i]) for i in range(num_cols)])) |
"""
1) Data structure: Dictionary, Tuple, Set
Assignment
1) create dictionary of user data
2) Create list of user data dictionary with minimum of 10 user data
3) create 5 dictionaries which have list values
"""
# [] = List
# {} = Dictionary
# () = Tuple
dictionary_variable = {
'name': 'Kiran',
'address': 'home',
'mobile_number': 7760675005
}
print(dictionary_variable)
print(dictionary_variable['name'])
print(dictionary_variable.get('mobile_number', "Key does not found."))
print(dictionary_variable.get('contact_number', "Key does not found."))
print(dictionary_variable.keys())
print(dictionary_variable.values())
print(dictionary_variable.items())
contact_no = dictionary_variable['mobile_number']
dictionary_variable.pop('mobile_number')
print(dictionary_variable)
print(dictionary_variable)
dictionary_variable['contact_no'] = contact_no
print(dictionary_variable)
dict_01 = [
{'test1': 'test2', 'test3': 'test4'},
{'test5': [
{'test6': 'test7', 'test8': 'test9'},
{'test10': 'test11', 'test12': 'test13'}
]
}
]
dict_02 = {
'test1': 'test2',
'test3': [
{
'test4': 'test5',
'test6': ['test7',
'test8'
]
},
[{'test9': 'test10'}, 'test11',
{'test12': 'test13',
'test14': 'print_me'}]
,
{'test15': 'print_me_2'}
]
}
print(dict_02)
print(dict_02['test3'][1][2]['test14'])
print(dict_02['test3'][2]['test15'])
dictionary_variable = {
'name': 'Samarthview',
'address': 'Vishrantwadi',
'mobile_number': 7760675005}
print(dictionary_variable['name'],['address'],['mobile_number'])
dictionary_variable = {
'name': 'Kakde',
'address': 'Pune',
'mobile_number': 7760675005}
print(dictionary_variable)
dictionary_variable = {
'name': 'Inorbitmall',
'address': 'Wadi,Pune',
'mobile_number': 7760675005}
dictionary_variable = {
'name': 'Inorbitmall',
'address': 'Wadi,Pune',
'company': 'Samarthview',
'Class': 'Phyton03',
'Locality': 'Sathebiscut company',
'mobile_number': 8087004247}
print(dictionary_variable['name'],['address'],['company'],['Class'],['Locality'],['mobile_number'])
| """
1) Data structure: Dictionary, Tuple, Set
Assignment
1) create dictionary of user data
2) Create list of user data dictionary with minimum of 10 user data
3) create 5 dictionaries which have list values
"""
dictionary_variable = {'name': 'Kiran', 'address': 'home', 'mobile_number': 7760675005}
print(dictionary_variable)
print(dictionary_variable['name'])
print(dictionary_variable.get('mobile_number', 'Key does not found.'))
print(dictionary_variable.get('contact_number', 'Key does not found.'))
print(dictionary_variable.keys())
print(dictionary_variable.values())
print(dictionary_variable.items())
contact_no = dictionary_variable['mobile_number']
dictionary_variable.pop('mobile_number')
print(dictionary_variable)
print(dictionary_variable)
dictionary_variable['contact_no'] = contact_no
print(dictionary_variable)
dict_01 = [{'test1': 'test2', 'test3': 'test4'}, {'test5': [{'test6': 'test7', 'test8': 'test9'}, {'test10': 'test11', 'test12': 'test13'}]}]
dict_02 = {'test1': 'test2', 'test3': [{'test4': 'test5', 'test6': ['test7', 'test8']}, [{'test9': 'test10'}, 'test11', {'test12': 'test13', 'test14': 'print_me'}], {'test15': 'print_me_2'}]}
print(dict_02)
print(dict_02['test3'][1][2]['test14'])
print(dict_02['test3'][2]['test15'])
dictionary_variable = {'name': 'Samarthview', 'address': 'Vishrantwadi', 'mobile_number': 7760675005}
print(dictionary_variable['name'], ['address'], ['mobile_number'])
dictionary_variable = {'name': 'Kakde', 'address': 'Pune', 'mobile_number': 7760675005}
print(dictionary_variable)
dictionary_variable = {'name': 'Inorbitmall', 'address': 'Wadi,Pune', 'mobile_number': 7760675005}
dictionary_variable = {'name': 'Inorbitmall', 'address': 'Wadi,Pune', 'company': 'Samarthview', 'Class': 'Phyton03', 'Locality': 'Sathebiscut company', 'mobile_number': 8087004247}
print(dictionary_variable['name'], ['address'], ['company'], ['Class'], ['Locality'], ['mobile_number']) |
n, k = map(int, input().split())
participants = list(map(int, input().split()))
target_score = participants[k - 1]
total = 0
for participant in participants:
if participant >= target_score and participant > 0:
total += 1
print(total) | (n, k) = map(int, input().split())
participants = list(map(int, input().split()))
target_score = participants[k - 1]
total = 0
for participant in participants:
if participant >= target_score and participant > 0:
total += 1
print(total) |
"""
Advent of Code 2017
17 16 15 14 13
18 5 4 3 12
19 6 1 2 11
20 7 8 9 10
21 22 23---> ...
Input was:
368078
Answer is:
65, (-4, -4) =
369601
"""
DIR_RIGHT = 1
DIR_UP = 2
DIR_LEFT = 3
DIR_DOWN = 4
i = 1
data = { (0,0): 1 } # key = coords, val = position
data_vals = { (0,0): 1 }
x = 0
y = 0
minmax_x = [ 0, 0 ]
minmax_y = [ 0, 0 ]
cur_dir = DIR_RIGHT
while i <= 368078:
data[ (x,y) ] = i
# Calcuate sum of surrounding numbers
if x == 0 and y == 0:
total = 1
else:
total = 0
if (x+1,y) in data_vals:
total += data_vals[ (x+1,y) ]
if (x+1,y-1) in data_vals:
total += data_vals[ (x+1,y-1) ]
if (x,y-1) in data_vals:
total += data_vals[ (x,y-1) ]
if (x-1,y-1) in data_vals:
total += data_vals[ (x-1,y-1) ]
if (x-1,y) in data_vals:
total += data_vals[ (x-1,y) ]
if (x-1,y+1) in data_vals:
total += data_vals[ (x-1,y+1) ]
if (x,y+1) in data_vals:
total += data_vals[ (x,y+1) ]
if (x+1,y+1) in data_vals:
total += data_vals[ (x+1,y+1) ]
data_vals[ (x,y) ] = total
print( '{0}, {1} = {2}'.format( i, (x,y), total ) )
if total > 368078:
print( 'DONE' )
break
# Advance position around the spiral
if cur_dir == DIR_RIGHT:
x += 1
elif cur_dir == DIR_UP:
y -= 1
elif cur_dir == DIR_LEFT:
x -= 1
else:
y += 1
# If we're at the "end" of this spiral direction, make a turn
if x > minmax_x[ 1 ]:
minmax_x[ 1 ] = x
cur_dir += 1
elif y < minmax_y[ 0 ]:
minmax_y[ 0 ] = y
cur_dir += 1
elif x < minmax_x[ 0 ]:
minmax_x[ 0 ] = x
cur_dir += 1
elif y > minmax_y[ 1 ]:
minmax_y[ 1 ] = y
cur_dir += 1
if cur_dir > 4:
cur_dir = 1
i += 1
| """
Advent of Code 2017
17 16 15 14 13
18 5 4 3 12
19 6 1 2 11
20 7 8 9 10
21 22 23---> ...
Input was:
368078
Answer is:
65, (-4, -4) =
369601
"""
dir_right = 1
dir_up = 2
dir_left = 3
dir_down = 4
i = 1
data = {(0, 0): 1}
data_vals = {(0, 0): 1}
x = 0
y = 0
minmax_x = [0, 0]
minmax_y = [0, 0]
cur_dir = DIR_RIGHT
while i <= 368078:
data[x, y] = i
if x == 0 and y == 0:
total = 1
else:
total = 0
if (x + 1, y) in data_vals:
total += data_vals[x + 1, y]
if (x + 1, y - 1) in data_vals:
total += data_vals[x + 1, y - 1]
if (x, y - 1) in data_vals:
total += data_vals[x, y - 1]
if (x - 1, y - 1) in data_vals:
total += data_vals[x - 1, y - 1]
if (x - 1, y) in data_vals:
total += data_vals[x - 1, y]
if (x - 1, y + 1) in data_vals:
total += data_vals[x - 1, y + 1]
if (x, y + 1) in data_vals:
total += data_vals[x, y + 1]
if (x + 1, y + 1) in data_vals:
total += data_vals[x + 1, y + 1]
data_vals[x, y] = total
print('{0}, {1} = {2}'.format(i, (x, y), total))
if total > 368078:
print('DONE')
break
if cur_dir == DIR_RIGHT:
x += 1
elif cur_dir == DIR_UP:
y -= 1
elif cur_dir == DIR_LEFT:
x -= 1
else:
y += 1
if x > minmax_x[1]:
minmax_x[1] = x
cur_dir += 1
elif y < minmax_y[0]:
minmax_y[0] = y
cur_dir += 1
elif x < minmax_x[0]:
minmax_x[0] = x
cur_dir += 1
elif y > minmax_y[1]:
minmax_y[1] = y
cur_dir += 1
if cur_dir > 4:
cur_dir = 1
i += 1 |
# https://leetcode.com/problems/find-all-anagrams-in-a-string/
class Solution(object):
# Submitted by Jiganesh
# TC : O(LenP * LenS)
# SC : O(LenP + LenS)
# Runtime: 148 ms, faster than 50.90% of Python online submissions for Find All Anagrams in a String.
# Memory Usage: 14.2 MB, less than 92.80% of Python online submissions for Find All Anagrams in a String.
def findAnagrams(self, s, p):
"""
:type s: str
:type p: str
:rtype: List[int]
"""
dictP = {i : 0 for i in p}
dictS = {i : 0 for i in s}
lens, lenp = len(s), len(p)
# storing frequency of all the characters in p in dictP
for i in p:
dictP[i]+=1
startingPointer = 0
result=[]
while startingPointer<lens:
# after every iteration adding the next character
dictS[s[startingPointer]]+=1
# if the length by adding new character has increased from given length of p
# deleting the previous character which will be at startingPointer-lenp
# automatically given the frequency of all the elements in the window
if startingPointer>=lenp :
dictS[s[startingPointer-lenp]]-=1
# checking if the window are valid anagrams by comparing the frequency of all the elements in the window
for j in dictP:
# if some element is not present in the window then it is not valid anagram
# if element is present then the frequecy must be equal
# if frequency is not equal the also it is not valid anagram
# hence break the loop
if j not in dictS or (j in dictS and dictS[j] != dictP[j]):
break
else:
# if the loop is not broken then it is a valid anagram
# add the starting index to the result
result.append(startingPointer-lenp+1)
startingPointer+=1
return result
print(Solution().findAnagrams("cbaebabacd", "abc"))
print(Solution().findAnagrams("abab", "ab"))
print(Solution().findAnagrams("aa", "bb"))
| class Solution(object):
def find_anagrams(self, s, p):
"""
:type s: str
:type p: str
:rtype: List[int]
"""
dict_p = {i: 0 for i in p}
dict_s = {i: 0 for i in s}
(lens, lenp) = (len(s), len(p))
for i in p:
dictP[i] += 1
starting_pointer = 0
result = []
while startingPointer < lens:
dictS[s[startingPointer]] += 1
if startingPointer >= lenp:
dictS[s[startingPointer - lenp]] -= 1
for j in dictP:
if j not in dictS or (j in dictS and dictS[j] != dictP[j]):
break
else:
result.append(startingPointer - lenp + 1)
starting_pointer += 1
return result
print(solution().findAnagrams('cbaebabacd', 'abc'))
print(solution().findAnagrams('abab', 'ab'))
print(solution().findAnagrams('aa', 'bb')) |
""" note that the whole configuration is passed in the
form of a Python dictionary """
{
# App metadadta
'service_metadata': {
'service_name': 'iris',
'service_version': '0.1',
},
# Configure the dataset loader to help loading the data from the CSV file
'dataset_loader_train': {
# type of dataset loader to use
'__factory__': 'expose.dataset.Table',
'path': 'iris.data',
'names': [
'sepal length',
'sepal width',
'petal length',
'petal width',
'species',
],
'target_column': 'species',
'sep': ',',
'nrows': 100,
},
'dataset_loader_test': {
'__factory__': 'expose.dataset.Table',
'path': 'iris.data',
'names': [
'sepal length',
'sepal width',
'petal length',
'petal width',
'species',
],
'target_column': 'species',
'sep': ',',
'skiprows': 100,
},
'model': {
'__factory__': 'sklearn.linear_model.LogisticRegression',
'C': 0.3,
},
'grid_search': {
'param_grid': {
'C': [0.1, 0.3, 1.0],
},
'verbose': 4,
'n_jobs': -1,
},
'model_persister': {
'__factory__': 'expose.persistence.CachedUpdatePersister',
'update_cache_rrule': {'freq': 'HOURLY'},
'impl': {
'__factory__': 'expose.persistence.Database',
'url': 'sqlite:///iris-model.db',
},
},
'predict_service': {
'__factory__': 'expose.server.PredictService',
'mapping': [
('sepal length', 'float'),
('sepal width', 'float'),
('petal length', 'float'),
('petal width', 'float'),
],
},
'alive': {
'process_store_required': ('model',),
},
}
| """ note that the whole configuration is passed in the
form of a Python dictionary """
{'service_metadata': {'service_name': 'iris', 'service_version': '0.1'}, 'dataset_loader_train': {'__factory__': 'expose.dataset.Table', 'path': 'iris.data', 'names': ['sepal length', 'sepal width', 'petal length', 'petal width', 'species'], 'target_column': 'species', 'sep': ',', 'nrows': 100}, 'dataset_loader_test': {'__factory__': 'expose.dataset.Table', 'path': 'iris.data', 'names': ['sepal length', 'sepal width', 'petal length', 'petal width', 'species'], 'target_column': 'species', 'sep': ',', 'skiprows': 100}, 'model': {'__factory__': 'sklearn.linear_model.LogisticRegression', 'C': 0.3}, 'grid_search': {'param_grid': {'C': [0.1, 0.3, 1.0]}, 'verbose': 4, 'n_jobs': -1}, 'model_persister': {'__factory__': 'expose.persistence.CachedUpdatePersister', 'update_cache_rrule': {'freq': 'HOURLY'}, 'impl': {'__factory__': 'expose.persistence.Database', 'url': 'sqlite:///iris-model.db'}}, 'predict_service': {'__factory__': 'expose.server.PredictService', 'mapping': [('sepal length', 'float'), ('sepal width', 'float'), ('petal length', 'float'), ('petal width', 'float')]}, 'alive': {'process_store_required': ('model',)}} |
a,b,c,d = map(int, input().split())
if b > c and d > a and (c+d) > (a+b) and c > 0 and d > 0 and a%2 == 0:
print("Valores aceitos")
else:
print("Valores nao aceitos") | (a, b, c, d) = map(int, input().split())
if b > c and d > a and (c + d > a + b) and (c > 0) and (d > 0) and (a % 2 == 0):
print('Valores aceitos')
else:
print('Valores nao aceitos') |
def get_all_directions_values(row, col, board):
total = 0
total += int(board[0][col])
total += int(board[-1][col])
total += int(board[row][0])
total += int(board[row][-1])
return total
def outside_board(shoot):
row, col = shoot
return 0 > row or row > 6 or 0 > col or col > 6
def bullseye(shoot, board):
row, col = shoot
if board[row][col] == 'B':
return True
return False
def other_hit_conditions(shoot, current_player, board):
row, col = shoot
if board[row][col].isdigit():
current_player[1] -= int(board[row][col])
elif board[row][col] == 'D':
total = get_all_directions_values(row, col, board)
current_player[1] -= total * 2
elif board[row][col] == 'T':
total = get_all_directions_values(row, col, board)
current_player[1] -= total * 3
def play(player_names, board):
player_1 = [player_names[0], 501, 0]
player_2 = [player_names[1], 501, 0]
turn = 1
while True:
current_player = player_2 if turn % 2 == 0 else player_1
shoot = [int(n) for n in input().lstrip('(').rstrip(')').split(', ')]
current_player[2] += 1
if outside_board(shoot):
turn += 1
continue
elif bullseye(shoot, board):
return current_player[2], current_player[0]
else:
other_hit_conditions(shoot, current_player, board)
if current_player[1] <= 0:
return current_player[2], current_player[0]
turn += 1
def create_board():
board = []
for _ in range(7):
board.append(input().split(' '))
return board
player_names = input().split(', ')
board = create_board()
winner = play(player_names, board)
print(f'{winner[1]} won the game with {winner[0]} throws!')
| def get_all_directions_values(row, col, board):
total = 0
total += int(board[0][col])
total += int(board[-1][col])
total += int(board[row][0])
total += int(board[row][-1])
return total
def outside_board(shoot):
(row, col) = shoot
return 0 > row or row > 6 or 0 > col or (col > 6)
def bullseye(shoot, board):
(row, col) = shoot
if board[row][col] == 'B':
return True
return False
def other_hit_conditions(shoot, current_player, board):
(row, col) = shoot
if board[row][col].isdigit():
current_player[1] -= int(board[row][col])
elif board[row][col] == 'D':
total = get_all_directions_values(row, col, board)
current_player[1] -= total * 2
elif board[row][col] == 'T':
total = get_all_directions_values(row, col, board)
current_player[1] -= total * 3
def play(player_names, board):
player_1 = [player_names[0], 501, 0]
player_2 = [player_names[1], 501, 0]
turn = 1
while True:
current_player = player_2 if turn % 2 == 0 else player_1
shoot = [int(n) for n in input().lstrip('(').rstrip(')').split(', ')]
current_player[2] += 1
if outside_board(shoot):
turn += 1
continue
elif bullseye(shoot, board):
return (current_player[2], current_player[0])
else:
other_hit_conditions(shoot, current_player, board)
if current_player[1] <= 0:
return (current_player[2], current_player[0])
turn += 1
def create_board():
board = []
for _ in range(7):
board.append(input().split(' '))
return board
player_names = input().split(', ')
board = create_board()
winner = play(player_names, board)
print(f'{winner[1]} won the game with {winner[0]} throws!') |
bridgelist = []
with open('input.txt') as infile:
for line in infile.readlines():
i, o = line.strip().split('/')
i, o = int(i), int(o)
bridgelist.append((i,o,))
def build_bridge(bridgelist, already_used=None, current_value=0, connector_used=0):
if already_used == None:
already_used = ((0,0),)
cur_max = 0
for candidate in filter(lambda x: connector_used in x, bridgelist):
if candidate not in already_used:
begin, end = candidate
connects_to = end if begin == connector_used else begin
used_now = already_used + (candidate,)
value = build_bridge(bridgelist, already_used=used_now, current_value=(current_value+sum(candidate)), connector_used=connects_to)
if value > cur_max:
cur_max = value
if cur_max != 0:
return cur_max
else:
print('Found end of bridge')
return current_value
print(build_bridge(bridgelist))
| bridgelist = []
with open('input.txt') as infile:
for line in infile.readlines():
(i, o) = line.strip().split('/')
(i, o) = (int(i), int(o))
bridgelist.append((i, o))
def build_bridge(bridgelist, already_used=None, current_value=0, connector_used=0):
if already_used == None:
already_used = ((0, 0),)
cur_max = 0
for candidate in filter(lambda x: connector_used in x, bridgelist):
if candidate not in already_used:
(begin, end) = candidate
connects_to = end if begin == connector_used else begin
used_now = already_used + (candidate,)
value = build_bridge(bridgelist, already_used=used_now, current_value=current_value + sum(candidate), connector_used=connects_to)
if value > cur_max:
cur_max = value
if cur_max != 0:
return cur_max
else:
print('Found end of bridge')
return current_value
print(build_bridge(bridgelist)) |
# https://leetcode.com/explore/featured/card/top-interview-questions-easy/92/array/727/
class Solution:
def removeDuplicates(self, nums: list[int]) -> int:
length = 0
curNum = None
for idx in range(len(nums)):
if nums[idx] != curNum:
curNum = nums[idx]
nums[length] = curNum
length += 1
return length, nums
nums = [1, 1, 2]
length, nums = Solution().removeDuplicates(nums)
print(length, nums)
nums = [0, 0, 1, 1, 1, 2, 2, 3, 3, 4]
length, nums = Solution().removeDuplicates(nums)
print(length, nums) | class Solution:
def remove_duplicates(self, nums: list[int]) -> int:
length = 0
cur_num = None
for idx in range(len(nums)):
if nums[idx] != curNum:
cur_num = nums[idx]
nums[length] = curNum
length += 1
return (length, nums)
nums = [1, 1, 2]
(length, nums) = solution().removeDuplicates(nums)
print(length, nums)
nums = [0, 0, 1, 1, 1, 2, 2, 3, 3, 4]
(length, nums) = solution().removeDuplicates(nums)
print(length, nums) |
class workspaceApiPara:
getWorkspace_POST_request = {"ad_group_list": {"type": list, "default": []}}
setWorkspace_POST_request = {},
updateWorkspace_POST_request = {},
getWorkspace_GET_response = {},
setWorkspace_POST_response = {}
updateWorkspace_POST_response = {} | class Workspaceapipara:
get_workspace_post_request = {'ad_group_list': {'type': list, 'default': []}}
set_workspace_post_request = ({},)
update_workspace_post_request = ({},)
get_workspace_get_response = ({},)
set_workspace_post_response = {}
update_workspace_post_response = {} |
expected_output = {
"interfaces": {
"Port-channel1": {
"name": "Port-channel1",
"protocol": "lacp",
"members": {
"GigabitEthernet2": {
"interface": "GigabitEthernet2",
"oper_key": 1,
"admin_key": 1,
"port_num": 1,
"lacp_port_priority": 32768,
"flags": "SA",
"activity": "auto",
"state": "bndl",
"bundled": True,
"port_state": 61,
},
"GigabitEthernet3": {
"interface": "GigabitEthernet3",
"oper_key": 1,
"admin_key": 1,
"port_num": 1,
"lacp_port_priority": 32768,
"flags": "SA",
"activity": "auto",
"state": "bndl",
"bundled": True,
"port_state": 61,
},
},
},
"Port-channel2": {
"name": "Port-channel2",
"protocol": "lacp",
"members": {
"GigabitEthernet4": {
"interface": "GigabitEthernet4",
"oper_key": 2,
"admin_key": 2,
"port_num": 1,
"lacp_port_priority": 32768,
"flags": "SA",
"state": "bndl",
"activity": "auto",
"bundled": True,
"port_state": 61,
},
"GigabitEthernet5": {
"interface": "GigabitEthernet5",
"oper_key": 2,
"admin_key": 2,
"port_num": 1,
"lacp_port_priority": 32768,
"flags": "SA",
"activity": "auto",
"state": "bndl",
"bundled": True,
"port_state": 61,
},
"GigabitEthernet6": {
"interface": "GigabitEthernet6",
"oper_key": 2,
"admin_key": 2,
"port_num": 1,
"lacp_port_priority": 32768,
"flags": "SA",
"activity": "auto",
"state": "bndl",
"bundled": True,
"port_state": 61,
},
},
},
}
}
| expected_output = {'interfaces': {'Port-channel1': {'name': 'Port-channel1', 'protocol': 'lacp', 'members': {'GigabitEthernet2': {'interface': 'GigabitEthernet2', 'oper_key': 1, 'admin_key': 1, 'port_num': 1, 'lacp_port_priority': 32768, 'flags': 'SA', 'activity': 'auto', 'state': 'bndl', 'bundled': True, 'port_state': 61}, 'GigabitEthernet3': {'interface': 'GigabitEthernet3', 'oper_key': 1, 'admin_key': 1, 'port_num': 1, 'lacp_port_priority': 32768, 'flags': 'SA', 'activity': 'auto', 'state': 'bndl', 'bundled': True, 'port_state': 61}}}, 'Port-channel2': {'name': 'Port-channel2', 'protocol': 'lacp', 'members': {'GigabitEthernet4': {'interface': 'GigabitEthernet4', 'oper_key': 2, 'admin_key': 2, 'port_num': 1, 'lacp_port_priority': 32768, 'flags': 'SA', 'state': 'bndl', 'activity': 'auto', 'bundled': True, 'port_state': 61}, 'GigabitEthernet5': {'interface': 'GigabitEthernet5', 'oper_key': 2, 'admin_key': 2, 'port_num': 1, 'lacp_port_priority': 32768, 'flags': 'SA', 'activity': 'auto', 'state': 'bndl', 'bundled': True, 'port_state': 61}, 'GigabitEthernet6': {'interface': 'GigabitEthernet6', 'oper_key': 2, 'admin_key': 2, 'port_num': 1, 'lacp_port_priority': 32768, 'flags': 'SA', 'activity': 'auto', 'state': 'bndl', 'bundled': True, 'port_state': 61}}}}} |
#
# PySNMP MIB module CONTIVITY-INFO-V1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CONTIVITY-INFO-V1-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:26:50 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, ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint")
contivity, = mibBuilder.importSymbols("NEWOAK-MIB", "contivity")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Counter32, TimeTicks, IpAddress, Counter64, NotificationType, Gauge32, Integer32, Unsigned32, iso, ModuleIdentity, MibIdentifier, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Counter32", "TimeTicks", "IpAddress", "Counter64", "NotificationType", "Gauge32", "Integer32", "Unsigned32", "iso", "ModuleIdentity", "MibIdentifier", "ObjectIdentity")
TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString")
snmpAgentInfo_ces = ModuleIdentity((1, 3, 6, 1, 4, 1, 2505, 1, 15)).setLabel("snmpAgentInfo-ces")
snmpAgentInfo_ces.setRevisions(('1900-08-07 22:30',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: snmpAgentInfo_ces.setRevisionsDescriptions(('Added snmpAgentInfo-Utilities-RevDate-ces, snmpAgentInfo-Utilities-Rev-ces, snmpAgentInfo-Utilities-ServerRev-ces ',))
if mibBuilder.loadTexts: snmpAgentInfo_ces.setLastUpdated('0008072230Z')
if mibBuilder.loadTexts: snmpAgentInfo_ces.setOrganization('Nortel Networks,Inc.')
if mibBuilder.loadTexts: snmpAgentInfo_ces.setContactInfo('support@nortelnetworks.com Postal: Nortel Networks,Inc. 80 Central St. Boxboro, MA 01719 Tel: +1 978 264 7100 E-Mail: support@nortelnetworks.com')
if mibBuilder.loadTexts: snmpAgentInfo_ces.setDescription('on the Convitiy Extranet Switch.')
snmpAgentInfo_Utilities_ces = MibIdentifier((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1)).setLabel("snmpAgentInfo-Utilities-ces")
snmpAgentInfo_Utilities_Ping_ces = MibIdentifier((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1)).setLabel("snmpAgentInfo-Utilities-Ping-ces")
snmpAgentInfo_Utilities_RevDate_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 1), DisplayString()).setLabel("snmpAgentInfo-Utilities-RevDate-ces").setMaxAccess("readonly")
if mibBuilder.loadTexts: snmpAgentInfo_Utilities_RevDate_ces.setStatus('mandatory')
if mibBuilder.loadTexts: snmpAgentInfo_Utilities_RevDate_ces.setDescription('This value should match the LAST-UPDATED value in the MIB.')
snmpAgentInfo_Utilities_Rev_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 2), Integer32()).setLabel("snmpAgentInfo-Utilities-Rev-ces").setMaxAccess("readonly")
if mibBuilder.loadTexts: snmpAgentInfo_Utilities_Rev_ces.setStatus('mandatory')
if mibBuilder.loadTexts: snmpAgentInfo_Utilities_Rev_ces.setDescription('This is an integer that is increment for each change in the implementation of the MIB since the LAST-UPDATED date/time.')
snmpAgentInfo_Utilities_ServerRev_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 3), DisplayString()).setLabel("snmpAgentInfo-Utilities-ServerRev-ces").setMaxAccess("readonly")
if mibBuilder.loadTexts: snmpAgentInfo_Utilities_ServerRev_ces.setStatus('mandatory')
if mibBuilder.loadTexts: snmpAgentInfo_Utilities_ServerRev_ces.setDescription('This is the major and minor version numbers for the server image it is compatible with.')
pingAddress_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 4), IpAddress()).setLabel("pingAddress-ces")
if mibBuilder.loadTexts: pingAddress_ces.setStatus('mandatory')
if mibBuilder.loadTexts: pingAddress_ces.setDescription('')
pingRepetitions_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setLabel("pingRepetitions-ces")
if mibBuilder.loadTexts: pingRepetitions_ces.setStatus('mandatory')
if mibBuilder.loadTexts: pingRepetitions_ces.setDescription('')
pingPacketSize_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(64, 4076))).setLabel("pingPacketSize-ces")
if mibBuilder.loadTexts: pingPacketSize_ces.setStatus('mandatory')
if mibBuilder.loadTexts: pingPacketSize_ces.setDescription('')
pingSrcAddress_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 7), IpAddress()).setLabel("pingSrcAddress-ces")
if mibBuilder.loadTexts: pingSrcAddress_ces.setStatus('mandatory')
if mibBuilder.loadTexts: pingSrcAddress_ces.setDescription('')
pingTable_ces = MibTable((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 8), ).setLabel("pingTable-ces")
if mibBuilder.loadTexts: pingTable_ces.setStatus('mandatory')
if mibBuilder.loadTexts: pingTable_ces.setDescription('')
pingEntry_ces = MibTableRow((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 8, 1), ).setLabel("pingEntry-ces").setIndexNames((0, "CONTIVITY-INFO-V1-MIB", "pingAddress-ces"), (0, "CONTIVITY-INFO-V1-MIB", "pingRepetitions-ces"), (0, "CONTIVITY-INFO-V1-MIB", "pingPacketSize-ces"), (0, "CONTIVITY-INFO-V1-MIB", "pingSrcAddress-ces"))
if mibBuilder.loadTexts: pingEntry_ces.setStatus('mandatory')
if mibBuilder.loadTexts: pingEntry_ces.setDescription('')
pingAverageTime_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 8, 1, 1), Integer32()).setLabel("pingAverageTime-ces").setMaxAccess("readonly")
if mibBuilder.loadTexts: pingAverageTime_ces.setStatus('mandatory')
if mibBuilder.loadTexts: pingAverageTime_ces.setDescription('Possible Values: -1 indicates that the address could not be pinged. -2 indicates that the instance specified did not conform to valid IP address. A value other than -1 is the average of pings. If the value is 0, then the average ping time is less than 16ms')
pingPercentLoss_ces = MibScalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 8, 1, 2), Integer32()).setLabel("pingPercentLoss-ces").setMaxAccess("readonly")
if mibBuilder.loadTexts: pingPercentLoss_ces.setStatus('mandatory')
if mibBuilder.loadTexts: pingPercentLoss_ces.setDescription('Possible Values: -1 indicates that the address could not be pinged. -2 indicates that the instance specified did not conform to valid IP address. A value other than -1 is the percentage of pings loss')
mibBuilder.exportSymbols("CONTIVITY-INFO-V1-MIB", PYSNMP_MODULE_ID=snmpAgentInfo_ces, snmpAgentInfo_Utilities_Rev_ces=snmpAgentInfo_Utilities_Rev_ces, pingAddress_ces=pingAddress_ces, snmpAgentInfo_Utilities_Ping_ces=snmpAgentInfo_Utilities_Ping_ces, pingRepetitions_ces=pingRepetitions_ces, snmpAgentInfo_Utilities_RevDate_ces=snmpAgentInfo_Utilities_RevDate_ces, pingTable_ces=pingTable_ces, pingAverageTime_ces=pingAverageTime_ces, pingPacketSize_ces=pingPacketSize_ces, snmpAgentInfo_Utilities_ServerRev_ces=snmpAgentInfo_Utilities_ServerRev_ces, pingSrcAddress_ces=pingSrcAddress_ces, snmpAgentInfo_ces=snmpAgentInfo_ces, pingPercentLoss_ces=pingPercentLoss_ces, snmpAgentInfo_Utilities_ces=snmpAgentInfo_Utilities_ces, pingEntry_ces=pingEntry_ces)
| (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, constraints_union, single_value_constraint, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'SingleValueConstraint', 'ValueRangeConstraint')
(contivity,) = mibBuilder.importSymbols('NEWOAK-MIB', 'contivity')
(notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance')
(mib_scalar, mib_table, mib_table_row, mib_table_column, bits, counter32, time_ticks, ip_address, counter64, notification_type, gauge32, integer32, unsigned32, iso, module_identity, mib_identifier, object_identity) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'Counter32', 'TimeTicks', 'IpAddress', 'Counter64', 'NotificationType', 'Gauge32', 'Integer32', 'Unsigned32', 'iso', 'ModuleIdentity', 'MibIdentifier', 'ObjectIdentity')
(textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString')
snmp_agent_info_ces = module_identity((1, 3, 6, 1, 4, 1, 2505, 1, 15)).setLabel('snmpAgentInfo-ces')
snmpAgentInfo_ces.setRevisions(('1900-08-07 22:30',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
snmpAgentInfo_ces.setRevisionsDescriptions(('Added snmpAgentInfo-Utilities-RevDate-ces, snmpAgentInfo-Utilities-Rev-ces, snmpAgentInfo-Utilities-ServerRev-ces ',))
if mibBuilder.loadTexts:
snmpAgentInfo_ces.setLastUpdated('0008072230Z')
if mibBuilder.loadTexts:
snmpAgentInfo_ces.setOrganization('Nortel Networks,Inc.')
if mibBuilder.loadTexts:
snmpAgentInfo_ces.setContactInfo('support@nortelnetworks.com Postal: Nortel Networks,Inc. 80 Central St. Boxboro, MA 01719 Tel: +1 978 264 7100 E-Mail: support@nortelnetworks.com')
if mibBuilder.loadTexts:
snmpAgentInfo_ces.setDescription('on the Convitiy Extranet Switch.')
snmp_agent_info__utilities_ces = mib_identifier((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1)).setLabel('snmpAgentInfo-Utilities-ces')
snmp_agent_info__utilities__ping_ces = mib_identifier((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1)).setLabel('snmpAgentInfo-Utilities-Ping-ces')
snmp_agent_info__utilities__rev_date_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 1), display_string()).setLabel('snmpAgentInfo-Utilities-RevDate-ces').setMaxAccess('readonly')
if mibBuilder.loadTexts:
snmpAgentInfo_Utilities_RevDate_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
snmpAgentInfo_Utilities_RevDate_ces.setDescription('This value should match the LAST-UPDATED value in the MIB.')
snmp_agent_info__utilities__rev_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 2), integer32()).setLabel('snmpAgentInfo-Utilities-Rev-ces').setMaxAccess('readonly')
if mibBuilder.loadTexts:
snmpAgentInfo_Utilities_Rev_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
snmpAgentInfo_Utilities_Rev_ces.setDescription('This is an integer that is increment for each change in the implementation of the MIB since the LAST-UPDATED date/time.')
snmp_agent_info__utilities__server_rev_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 3), display_string()).setLabel('snmpAgentInfo-Utilities-ServerRev-ces').setMaxAccess('readonly')
if mibBuilder.loadTexts:
snmpAgentInfo_Utilities_ServerRev_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
snmpAgentInfo_Utilities_ServerRev_ces.setDescription('This is the major and minor version numbers for the server image it is compatible with.')
ping_address_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 4), ip_address()).setLabel('pingAddress-ces')
if mibBuilder.loadTexts:
pingAddress_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
pingAddress_ces.setDescription('')
ping_repetitions_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))).setLabel('pingRepetitions-ces')
if mibBuilder.loadTexts:
pingRepetitions_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
pingRepetitions_ces.setDescription('')
ping_packet_size_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(64, 4076))).setLabel('pingPacketSize-ces')
if mibBuilder.loadTexts:
pingPacketSize_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
pingPacketSize_ces.setDescription('')
ping_src_address_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 7), ip_address()).setLabel('pingSrcAddress-ces')
if mibBuilder.loadTexts:
pingSrcAddress_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
pingSrcAddress_ces.setDescription('')
ping_table_ces = mib_table((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 8)).setLabel('pingTable-ces')
if mibBuilder.loadTexts:
pingTable_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
pingTable_ces.setDescription('')
ping_entry_ces = mib_table_row((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 8, 1)).setLabel('pingEntry-ces').setIndexNames((0, 'CONTIVITY-INFO-V1-MIB', 'pingAddress-ces'), (0, 'CONTIVITY-INFO-V1-MIB', 'pingRepetitions-ces'), (0, 'CONTIVITY-INFO-V1-MIB', 'pingPacketSize-ces'), (0, 'CONTIVITY-INFO-V1-MIB', 'pingSrcAddress-ces'))
if mibBuilder.loadTexts:
pingEntry_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
pingEntry_ces.setDescription('')
ping_average_time_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 8, 1, 1), integer32()).setLabel('pingAverageTime-ces').setMaxAccess('readonly')
if mibBuilder.loadTexts:
pingAverageTime_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
pingAverageTime_ces.setDescription('Possible Values: -1 indicates that the address could not be pinged. -2 indicates that the instance specified did not conform to valid IP address. A value other than -1 is the average of pings. If the value is 0, then the average ping time is less than 16ms')
ping_percent_loss_ces = mib_scalar((1, 3, 6, 1, 4, 1, 2505, 1, 15, 1, 1, 8, 1, 2), integer32()).setLabel('pingPercentLoss-ces').setMaxAccess('readonly')
if mibBuilder.loadTexts:
pingPercentLoss_ces.setStatus('mandatory')
if mibBuilder.loadTexts:
pingPercentLoss_ces.setDescription('Possible Values: -1 indicates that the address could not be pinged. -2 indicates that the instance specified did not conform to valid IP address. A value other than -1 is the percentage of pings loss')
mibBuilder.exportSymbols('CONTIVITY-INFO-V1-MIB', PYSNMP_MODULE_ID=snmpAgentInfo_ces, snmpAgentInfo_Utilities_Rev_ces=snmpAgentInfo_Utilities_Rev_ces, pingAddress_ces=pingAddress_ces, snmpAgentInfo_Utilities_Ping_ces=snmpAgentInfo_Utilities_Ping_ces, pingRepetitions_ces=pingRepetitions_ces, snmpAgentInfo_Utilities_RevDate_ces=snmpAgentInfo_Utilities_RevDate_ces, pingTable_ces=pingTable_ces, pingAverageTime_ces=pingAverageTime_ces, pingPacketSize_ces=pingPacketSize_ces, snmpAgentInfo_Utilities_ServerRev_ces=snmpAgentInfo_Utilities_ServerRev_ces, pingSrcAddress_ces=pingSrcAddress_ces, snmpAgentInfo_ces=snmpAgentInfo_ces, pingPercentLoss_ces=pingPercentLoss_ces, snmpAgentInfo_Utilities_ces=snmpAgentInfo_Utilities_ces, pingEntry_ces=pingEntry_ces) |
def domain_name(url):
st = url.replace("http://", "")
tt = st.replace("https://","")
ut = tt.replace("www.","")
s = ut.split(".")
return s[0]
print(domain_name("http://github.com/carbonfive/raygun")) | def domain_name(url):
st = url.replace('http://', '')
tt = st.replace('https://', '')
ut = tt.replace('www.', '')
s = ut.split('.')
return s[0]
print(domain_name('http://github.com/carbonfive/raygun')) |
class BrainError(Exception):
"""
base class of brain_plasma exceptions
"""
pass
class BrainNamespaceNameError(BrainError):
pass
class BrainNamespaceRemoveDefaultError(BrainError):
pass
class BrainNamespaceNotExistError(BrainError):
pass
class BrainNameNotExistError(BrainError):
pass
class BrainNameLengthError(BrainError):
pass
class BrainNameTypeError(BrainError):
pass
class BrainClientDisconnectedError(BrainError):
pass
class BrainLearnNameError(BrainError):
pass
class BrainRemoveOldNameValueError(BrainError):
pass
class BrainUpdateNameError(BrainError):
pass
| class Brainerror(Exception):
"""
base class of brain_plasma exceptions
"""
pass
class Brainnamespacenameerror(BrainError):
pass
class Brainnamespaceremovedefaulterror(BrainError):
pass
class Brainnamespacenotexisterror(BrainError):
pass
class Brainnamenotexisterror(BrainError):
pass
class Brainnamelengtherror(BrainError):
pass
class Brainnametypeerror(BrainError):
pass
class Brainclientdisconnectederror(BrainError):
pass
class Brainlearnnameerror(BrainError):
pass
class Brainremoveoldnamevalueerror(BrainError):
pass
class Brainupdatenameerror(BrainError):
pass |
fullSWOF2DPath='../FullSWOF_2D'
def getFullSWOF2DPath():
return fullSWOF2DPath
| full_swof2_d_path = '../FullSWOF_2D'
def get_full_swof2_d_path():
return fullSWOF2DPath |
# INSTRUCTIONS
# ------------
# Create ```config.py``` in this folder, take this file as reference.
# ```config.py``` will not be committed to Git, added in .gitignore
# Add project settings and API_KEYS here...
NEWS_API_KEY = ""
| news_api_key = '' |
# -*- coding: utf-8 -*-
'''
File name: code\maximum_path_sum_ii\sol_67.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #67 :: Maximum path sum II
#
# For more information see:
# https://projecteuler.net/problem=67
# Problem Statement
'''
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.
37 4
2 4 6
8 5 9 3
That is, 3 + 7 + 4 + 9 = 23.
Find the maximum total from top to bottom in triangle.txt (right click and 'Save Link/Target As...'), a 15K text file containing a triangle with one-hundred rows.
NOTE: This is a much more difficult version of Problem 18. It is not possible to try every route to solve this problem, as there are 299 altogether! If you could check one trillion (1012) routes every second it would take over twenty billion years to check them all. There is an efficient algorithm to solve it. ;o)
'''
# Solution
# Solution Approach
'''
'''
| """
File name: code\\maximum_path_sum_ii\\sol_67.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
"""
"\nBy starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.\n37 4\n2 4 6\n8 5 9 3\nThat is, 3 + 7 + 4 + 9 = 23.\nFind the maximum total from top to bottom in triangle.txt (right click and 'Save Link/Target As...'), a 15K text file containing a triangle with one-hundred rows.\nNOTE: This is a much more difficult version of Problem 18. It is not possible to try every route to solve this problem, as there are 299 altogether! If you could check one trillion (1012) routes every second it would take over twenty billion years to check them all. There is an efficient algorithm to solve it. ;o)\n"
'\n' |
#
# PySNMP MIB module DIFF-SERV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DIFF-SERV-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:23:07 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")
SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueSizeConstraint")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
InetAddressType, InetAddress = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddressType", "InetAddress")
BurstSize, = mibBuilder.importSymbols("INTEGRATED-SERVICES-MIB", "BurstSize")
NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance")
Unsigned32, ModuleIdentity, MibIdentifier, mib_2, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, Integer32, TimeTicks, zeroDotZero, Bits, ObjectIdentity, NotificationType, Gauge32, IpAddress, iso, Counter64 = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "ModuleIdentity", "MibIdentifier", "mib-2", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "Integer32", "TimeTicks", "zeroDotZero", "Bits", "ObjectIdentity", "NotificationType", "Gauge32", "IpAddress", "iso", "Counter64")
DisplayString, RowStatus, TimeStamp, TextualConvention, RowPointer = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "TimeStamp", "TextualConvention", "RowPointer")
diffServMib = ModuleIdentity((1, 3, 6, 1, 2, 1, 12345))
diffServMib.setRevisions(('2000-07-13 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: diffServMib.setRevisionsDescriptions(('Initial version, published as RFC xxxx.',))
if mibBuilder.loadTexts: diffServMib.setLastUpdated('200007130000Z')
if mibBuilder.loadTexts: diffServMib.setOrganization('IETF Diffserv WG')
if mibBuilder.loadTexts: diffServMib.setContactInfo(' Brian Carpenter (co-chair of Diffserv WG) c/o iCAIR 1890 Maple Ave, #150 Evanston, IL 60201, USA Phone: +1 847 467 7811 E-mail: brian@icair.org Kathleen Nichols (co-chair of Diffserv WG) Packet Design E-mail: nichols@packetdesign.com Fred Baker (author) Cisco Systems 519 Lado Drive Santa Barbara, CA 93111, USA E-mail: fred@cisco.com Kwok Ho Chan (author) Nortel Networks 600 Technology Park Drive Billerica, MA 01821, USA E-mail: khchan@nortelnetworks.com Andrew Smith (author) E-mail: ah-smith@pacbell.net')
if mibBuilder.loadTexts: diffServMib.setDescription('This MIB defines the objects necessary to manage a device that uses the Differentiated Services Architecture described in RFC 2475 and the Informal Management Model for DiffServ Routers in draft-ietf-diffserv-model-04.txt.')
diffServObjects = MibIdentifier((1, 3, 6, 1, 2, 1, 12345, 1))
diffServTables = MibIdentifier((1, 3, 6, 1, 2, 1, 12345, 2))
diffServMIBConformance = MibIdentifier((1, 3, 6, 1, 2, 1, 12345, 3))
class Dscp(TextualConvention, Integer32):
description = 'The IP header Diffserv Code-Point that may be used for discriminating or marking a traffic stream. The value -1 is used to indicate a wildcard i.e. any value.'
status = 'current'
displayHint = 'd'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(ValueRangeConstraint(-1, -1), ValueRangeConstraint(0, 63), )
class SixTupleClfrL4Port(TextualConvention, Integer32):
description = 'A value indicating a Layer-4 protocol port number.'
status = 'current'
displayHint = 'd'
subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 65535)
class IfDirection(TextualConvention, Integer32):
description = "Specifies a direction of data travel on an interface. 'inbound' traffic is operated on during reception from the interface, while 'outbound' traffic is operated on prior to transmission on the interface."
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("inbound", 1), ("outbound", 2))
diffServClassifierTable = MibTable((1, 3, 6, 1, 2, 1, 12345, 2, 1), )
if mibBuilder.loadTexts: diffServClassifierTable.setReference('[MODEL] section 4.1')
if mibBuilder.loadTexts: diffServClassifierTable.setStatus('current')
if mibBuilder.loadTexts: diffServClassifierTable.setDescription('The classifier table defines the classifiers that are applied to traffic arriving at this interface in a particular direction. Specific classifiers are defined by RowPointers in the entries of this table which identify entries in filter tables of specific types, e.g. Multi-Field Classifiers (MFCs) for IP are defined in the diffServSixTupleClfrTable. Other classifier types may be defined elsewhere.')
diffServClassifierEntry = MibTableRow((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "DIFF-SERV-MIB", "diffServClassifierIfDirection"), (0, "DIFF-SERV-MIB", "diffServClassifierTcb"), (0, "DIFF-SERV-MIB", "diffServClassifierId"))
if mibBuilder.loadTexts: diffServClassifierEntry.setStatus('current')
if mibBuilder.loadTexts: diffServClassifierEntry.setDescription('An entry in the classifier table describes a single element of the classifier.')
diffServClassifierIfDirection = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 1), IfDirection())
if mibBuilder.loadTexts: diffServClassifierIfDirection.setStatus('current')
if mibBuilder.loadTexts: diffServClassifierIfDirection.setDescription('Specifies the direction for which this classifier entry applies on this interface.')
diffServClassifierTcb = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 2), Unsigned32())
if mibBuilder.loadTexts: diffServClassifierTcb.setStatus('current')
if mibBuilder.loadTexts: diffServClassifierTcb.setDescription('Specifies the TCB of which this classifier element is a part. Lower numbers indicate an element that belongs to a classifier that is part of a TCB that is, at least conceptually, applied to traffic before those with higher numbers - this is necessary to resolve ambiguity in cases where different TCBs contain filters that overlap with each other. A manager wanting to create a new TCB should either first search this table for existing entries and pick a value for this variable that is not currently represented - some form of pseudo- random choice is likely to minimise collisions. After successful creation of a conceptual row using the chosen value, the manager should check again that there are no other rows with this value that have been created by a different manager that could, potentially, interfere with the classifier elements that are desired.')
diffServClassifierId = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 3), Unsigned32())
if mibBuilder.loadTexts: diffServClassifierId.setStatus('current')
if mibBuilder.loadTexts: diffServClassifierId.setDescription('A classifier ID that enumerates the classifier elements. The set of such identifiers spans the whole agent. Managers should obtain new values for row creation in this table by reading diffServClassifierNextFree.')
diffServClassifierFilter = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 4), RowPointer().clone((0, 0))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServClassifierFilter.setStatus('current')
if mibBuilder.loadTexts: diffServClassifierFilter.setDescription('A pointer to a valid entry in another table that describes the applicable classification filter, e.g. an entry in diffServSixTupleClfrTable. If the row pointed to does not exist, the classifier is ignored. The value zeroDotZero is interpreted to match anything not matched by another classifier - only one such entry may exist in this table.')
diffServClassifierNext = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 5), RowPointer()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServClassifierNext.setStatus('current')
if mibBuilder.loadTexts: diffServClassifierNext.setDescription('This selects the next datapath element to handle packets matching the filter pattern. For example, this can point to an entry in a meter, action, algorithmic dropper or queue table. If the row pointed to does not exist, the classifier element is ignored.')
diffServClassifierPrecedence = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 6), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServClassifierPrecedence.setStatus('current')
if mibBuilder.loadTexts: diffServClassifierPrecedence.setDescription('The relative precedence in which classifiers are applied: higher numbers represent classifiers with higher precedence. Classifiers with the same precedence must be unambiguous i.e. they must define non-overlapping patterns, and are considered to be applied simultaneously to the traffic stream. Classifiers with different precedence may overlap in their filters: the classifier with the highest precedence that matches is taken. On a given interface, there must be a complete classifier in place at all times for the first TCB (lowest value of diffServClassifierTcb) in the ingress direction. This means that there will always be one or more filters that match every possible pattern that could be presented in an incoming packet. There is no such requirement for subsequent TCBs in the ingress direction, nor for any TCB in the egress direction.')
diffServClassifierStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 7), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServClassifierStatus.setStatus('current')
if mibBuilder.loadTexts: diffServClassifierStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of a classifier. Any writable variable may be modified whether the row is active or notInService.')
diffServClassifierNextFree = MibScalar((1, 3, 6, 1, 2, 1, 12345, 1, 1), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServClassifierNextFree.setStatus('current')
if mibBuilder.loadTexts: diffServClassifierNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServClassifierId instance. If a configuring system attempts to create a new row in the diffServClassifierTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diffServSixTupleClfrTable = MibTable((1, 3, 6, 1, 2, 1, 12345, 2, 2), )
if mibBuilder.loadTexts: diffServSixTupleClfrTable.setReference('[MODEL] section 4.2.2')
if mibBuilder.loadTexts: diffServSixTupleClfrTable.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrTable.setDescription('A table of IP Six-Tuple Classifier filter entries that a system may use to identify IP traffic.')
diffServSixTupleClfrEntry = MibTableRow((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1), ).setIndexNames((0, "DIFF-SERV-MIB", "diffServSixTupleClfrId"))
if mibBuilder.loadTexts: diffServSixTupleClfrEntry.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrEntry.setDescription('An IP Six-Tuple Classifier entry describes a single filter.')
diffServSixTupleClfrId = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 1), Unsigned32())
if mibBuilder.loadTexts: diffServSixTupleClfrId.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrId.setDescription('A unique identifier for the filter. Filters may be shared by multiple interfaces in the same system. Managers should obtain new values for row creation in this table by reading diffServSixTupleClfrNextFree.')
diffServSixTupleClfrDstAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 2), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrDstAddrType.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrDstAddrType.setDescription('The type of IP destination address used by this classifier entry.')
diffServSixTupleClfrDstAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 3), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrDstAddr.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrDstAddr.setDescription("The IP address to match against the packet's destination IP address.")
diffServSixTupleClfrDstAddrMask = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 4), Unsigned32()).setUnits('bits').setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrDstAddrMask.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrDstAddrMask.setDescription('The length of a mask for the matching of the destination IP address. Masks are constructed by setting bits in sequence from the most-significant bit downwards for diffServSixTupleClfrDstAddrMask bits length. All other bits in the mask, up to the number needed to fill the length of the address diffServSixTupleClfrDstAddr are cleared to zero. A zero bit in the mask then means that the corresponding bit in the address always matches.')
diffServSixTupleClfrSrcAddrType = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 5), InetAddressType()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrSrcAddrType.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrSrcAddrType.setDescription('The type of IP source address used by this classifier entry.')
diffServSixTupleClfrSrcAddr = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 6), InetAddress()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrSrcAddr.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrSrcAddr.setDescription('The IP address to match against the source IP address of each packet.')
diffServSixTupleClfrSrcAddrMask = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 7), Unsigned32()).setUnits('bits').setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrSrcAddrMask.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrSrcAddrMask.setDescription('The length of a mask for the matching of the source IP address. Masks are constructed by setting bits in sequence from the most- significant bit downwards for diffServSixTupleClfrSrcAddrMask bits length. All other bits in the mask, up to the number needed to fill the length of the address diffServSixTupleClfrSrcAddr are cleared to zero. A zero bit in the mask then means that the corresponding bit in the address always matches.')
diffServSixTupleClfrDscp = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 8), Dscp().clone(-1)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrDscp.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrDscp.setDescription('The value that the DSCP in the packet must have to match this entry. A value of -1 indicates that a specific DSCP value has not been defined and thus all DSCP values are considered a match.')
diffServSixTupleClfrProtocol = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrProtocol.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrProtocol.setDescription('The IP protocol to match against the IPv4 protocol number in the packet. A value of zero means match all.')
diffServSixTupleClfrDstL4PortMin = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 10), SixTupleClfrL4Port()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrDstL4PortMin.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrDstL4PortMin.setDescription('The minimum value that the layer-4 destination port number in the packet must have in order to match this classifier entry.')
diffServSixTupleClfrDstL4PortMax = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 11), SixTupleClfrL4Port().clone(65535)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrDstL4PortMax.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrDstL4PortMax.setDescription('The maximum value that the layer-4 destination port number in the packet must have in order to match this classifier entry. This value must be equal to or greater that the value specified for this entry in diffServSixTupleClfrDstL4PortMin.')
diffServSixTupleClfrSrcL4PortMin = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 12), SixTupleClfrL4Port()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrSrcL4PortMin.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrSrcL4PortMin.setDescription('The minimum value that the layer-4 source port number in the packet must have in order to match this classifier entry.')
diffServSixTupleClfrSrcL4PortMax = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 13), SixTupleClfrL4Port().clone(65535)).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrSrcL4PortMax.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrSrcL4PortMax.setDescription('The maximum value that the layer-4 source port number in the packet must have in oder to match this classifier entry. This value must be equal to or greater that the value specified for this entry in dsSixTupleIpSrcL4PortMin.')
diffServSixTupleClfrStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 14), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSixTupleClfrStatus.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of a classifier. Any writable variable may be modified whether the row is active or notInService.')
diffServSixTupleClfrNextFree = MibScalar((1, 3, 6, 1, 2, 1, 12345, 1, 2), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServSixTupleClfrNextFree.setStatus('current')
if mibBuilder.loadTexts: diffServSixTupleClfrNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServSixTupleClfrId instance. If a configuring system attempts to create a new row in the diffServSixTupleClfrTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diffServMeterTable = MibTable((1, 3, 6, 1, 2, 1, 12345, 2, 3), )
if mibBuilder.loadTexts: diffServMeterTable.setReference('[MODEL] section 5.1')
if mibBuilder.loadTexts: diffServMeterTable.setStatus('current')
if mibBuilder.loadTexts: diffServMeterTable.setDescription('This table enumerates generic meters that a system may use to police a stream of traffic. The traffic stream to be metered is determined by the element(s) upstream of the meter i.e. by the object(s) that point to each entry in this table. This may include all traffic on an interface. Specific meter details are to be found in diffServMeterSpecific.')
diffServMeterEntry = MibTableRow((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "DIFF-SERV-MIB", "diffServMeterIfDirection"), (0, "DIFF-SERV-MIB", "diffServMeterId"))
if mibBuilder.loadTexts: diffServMeterEntry.setStatus('current')
if mibBuilder.loadTexts: diffServMeterEntry.setDescription('An entry in the meter table describing a single meter.')
diffServMeterIfDirection = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1, 1), IfDirection())
if mibBuilder.loadTexts: diffServMeterIfDirection.setStatus('current')
if mibBuilder.loadTexts: diffServMeterIfDirection.setDescription('Specifies the direction for which this meter entry applies on this interface.')
diffServMeterId = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1, 2), Unsigned32())
if mibBuilder.loadTexts: diffServMeterId.setStatus('current')
if mibBuilder.loadTexts: diffServMeterId.setDescription('This identifies a meter entry. Managers should obtain new values for row creation in this table by reading diffServMeterNextFree.')
diffServMeterSucceedNext = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1, 3), RowPointer().clone((0, 0))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServMeterSucceedNext.setStatus('current')
if mibBuilder.loadTexts: diffServMeterSucceedNext.setDescription('If the traffic does conform to the meter, this indicates the next datapath element to handle the traffic e.g. an Action or another Meter datapath element. The value zeroDotZero in this variable indicates no further Diffserv treatment is performed on this traffic by the current interface for this interface direction. If the row pointed to does not exist, the meter element is considered inactive.')
diffServMeterFailNext = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1, 4), RowPointer().clone((0, 0))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServMeterFailNext.setStatus('current')
if mibBuilder.loadTexts: diffServMeterFailNext.setDescription('If the traffic does not conform to the meter, this indicates the next datapath element to handle the traffic e.g. an Action or Meter datapath element. The value zeroDotZero in this variable indicates no further Diffserv treatment is performed on this traffic by the current interface for this interface direction. If the row pointed to does not exist, the meter element is considered inactive.')
diffServMeterSpecific = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1, 5), ObjectIdentifier()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServMeterSpecific.setStatus('current')
if mibBuilder.loadTexts: diffServMeterSpecific.setDescription('This indicates the behaviour of the meter by pointing to a table containing detailed parameters. Note that entries in that specific table must be managed explicitly. One example of a valid object would be diffServTBMeterTable, whose entries are indexed by the same variables as this table, for describing an instance of a token-bucket meter.')
diffServMeterStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1, 6), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServMeterStatus.setStatus('current')
if mibBuilder.loadTexts: diffServMeterStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of a meter. Any writable variable may be modified whether the row is active or notInService.')
diffServMeterNextFree = MibScalar((1, 3, 6, 1, 2, 1, 12345, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServMeterNextFree.setStatus('current')
if mibBuilder.loadTexts: diffServMeterNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServMeterId instance. If a configuring system attempts to create a new row in the diffServMeterTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diffServTBMeterTable = MibTable((1, 3, 6, 1, 2, 1, 12345, 2, 4), )
if mibBuilder.loadTexts: diffServTBMeterTable.setReference('[MODEL] section 5.1.3')
if mibBuilder.loadTexts: diffServTBMeterTable.setStatus('current')
if mibBuilder.loadTexts: diffServTBMeterTable.setDescription('This table enumerates specific token-bucket meters that a system may use to police a stream of traffic. Such meters are modelled here as having a single rate and a burst size. Multiple meter elements may be logically cascaded using their diffServMeterSucceedNext pointers if a multi-rate token bucket is needed. One example of this might be for an AF PHB implementation that used two-rate meters. Such cascading of meter elements of specific type of token-bucket indicates forwarding behaviour that is functionally equivalent to a multi- rate meter: the sequential nature of the representation is merely a notational convenience for this MIB. Entries in this table share indexing with a parent diffServMeterEntry although they must be managed (e.g. created/deleted) by explicit management action, independently of the associated value of diffServMeterSpecific.')
diffServTBMeterEntry = MibTableRow((1, 3, 6, 1, 2, 1, 12345, 2, 4, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "DIFF-SERV-MIB", "diffServMeterIfDirection"), (0, "DIFF-SERV-MIB", "diffServMeterId"))
if mibBuilder.loadTexts: diffServTBMeterEntry.setStatus('current')
if mibBuilder.loadTexts: diffServTBMeterEntry.setDescription('An entry that describes a single token-bucket meter, indexed by the same variables as a diffServMeterEntry.')
diffServTBMeterRate = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 4, 1, 1), Unsigned32()).setUnits('kilobits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServTBMeterRate.setStatus('current')
if mibBuilder.loadTexts: diffServTBMeterRate.setDescription('The token-bucket rate, in kilobits per second (kbps).')
diffServTBMeterBurstSize = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 4, 1, 2), BurstSize()).setUnits('Bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServTBMeterBurstSize.setStatus('current')
if mibBuilder.loadTexts: diffServTBMeterBurstSize.setDescription('The maximum number of bytes in a single transmission burst. The interval over which the burst is to be measured can be derived as diffServTBMeterBurstSize*8*1000/diffServTBMeterRate.')
diffServTBMeterStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 4, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServTBMeterStatus.setStatus('current')
if mibBuilder.loadTexts: diffServTBMeterStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of a meter. Any writable variable may be modified whether the row is active or notInService.')
diffServActionTable = MibTable((1, 3, 6, 1, 2, 1, 12345, 2, 5), )
if mibBuilder.loadTexts: diffServActionTable.setReference('[MODEL] section 6.')
if mibBuilder.loadTexts: diffServActionTable.setStatus('current')
if mibBuilder.loadTexts: diffServActionTable.setDescription('The Action Table enumerates actions that can be performed to a stream of traffic. Multiple actions can be concatenated. For example, after marking a stream of traffic exiting from a meter, a device can then perform a count action of the conforming or non-conforming traffic. Specific actions are indicated by diffServActionSpecific which points to another object which describes the action in further detail.')
diffServActionEntry = MibTableRow((1, 3, 6, 1, 2, 1, 12345, 2, 5, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "DIFF-SERV-MIB", "diffServActionIfDirection"), (0, "DIFF-SERV-MIB", "diffServActionId"))
if mibBuilder.loadTexts: diffServActionEntry.setStatus('current')
if mibBuilder.loadTexts: diffServActionEntry.setDescription('An entry in the action table describing the actions applied to traffic arriving at its input.')
diffServActionIfDirection = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 5, 1, 1), IfDirection())
if mibBuilder.loadTexts: diffServActionIfDirection.setStatus('current')
if mibBuilder.loadTexts: diffServActionIfDirection.setDescription('Specifies the direction for which this action entry applies on this interface.')
diffServActionId = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 5, 1, 2), Unsigned32())
if mibBuilder.loadTexts: diffServActionId.setStatus('current')
if mibBuilder.loadTexts: diffServActionId.setDescription('This identifies the action entry. Managers should obtain new values for row creation in this table by reading diffServActionNextFree.')
diffServActionNext = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 5, 1, 3), RowPointer().clone((0, 0))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServActionNext.setStatus('current')
if mibBuilder.loadTexts: diffServActionNext.setDescription('The Next pointer indicates the next datapath element to handle the traffic. For example, a queue datapath element. The value zeroDotZero in this variable indicates no further DiffServ treatment is performed on this flow by the current interface for this interface direction. If the row pointed to does not exist, the action element is considered inactive.')
diffServActionSpecific = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 5, 1, 4), ObjectIdentifier()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServActionSpecific.setStatus('current')
if mibBuilder.loadTexts: diffServActionSpecific.setDescription('A pointer to an object instance providing additional information for the type of action indicated by this action table entry. For the standard actions defined by this MIB module, this should point to one of the following: a diffServDscpMarkActEntry, a diffServCountActEntry, the diffServAbsoluteDropAction OID. For other actions, it may point to an object instance defined in some other MIB.')
diffServActionStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 5, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServActionStatus.setStatus('current')
if mibBuilder.loadTexts: diffServActionStatus.setDescription('The RowStatus variable controls the activation, deactivation or deletion of an action element. Any writable variable may be modified whether the row is active or notInService.')
diffServActionNextFree = MibScalar((1, 3, 6, 1, 2, 1, 12345, 1, 4), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServActionNextFree.setStatus('current')
if mibBuilder.loadTexts: diffServActionNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServActionId instance. If a configuring system attempts to create a new row in the diffServActionTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diffServDscpMarkActTable = MibTable((1, 3, 6, 1, 2, 1, 12345, 2, 6), )
if mibBuilder.loadTexts: diffServDscpMarkActTable.setReference('[MODEL] section 6.1')
if mibBuilder.loadTexts: diffServDscpMarkActTable.setStatus('current')
if mibBuilder.loadTexts: diffServDscpMarkActTable.setDescription('This table enumerates specific DSCPs used for marking or remarking the DSCP field of IP packets. The entries of this table may be referenced by a diffServActionSpecific attribute that points to diffServDscpMarkActTable.')
diffServDscpMarkActEntry = MibTableRow((1, 3, 6, 1, 2, 1, 12345, 2, 6, 1), ).setIndexNames((0, "DIFF-SERV-MIB", "diffServDscpMarkActDscp"))
if mibBuilder.loadTexts: diffServDscpMarkActEntry.setStatus('current')
if mibBuilder.loadTexts: diffServDscpMarkActEntry.setDescription('An entry in the DSCP mark action table that describes a single DSCP used for marking.')
diffServDscpMarkActDscp = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 6, 1, 1), Dscp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServDscpMarkActDscp.setStatus('current')
if mibBuilder.loadTexts: diffServDscpMarkActDscp.setDescription('The DSCP that this Action uses for marking/remarking traffic. Note that a DSCP value of -1 is not permitted in this table. It is quite possible that the only packets subject to this Action are already marked with this DSCP. Note also that Diffserv may result in packet remarking both on ingress to a network and on egress from it and it is quite possible that ingress and egress would occur in the same router.')
diffServCountActTable = MibTable((1, 3, 6, 1, 2, 1, 12345, 2, 7), )
if mibBuilder.loadTexts: diffServCountActTable.setReference('[MODEL] section 6.5')
if mibBuilder.loadTexts: diffServCountActTable.setStatus('current')
if mibBuilder.loadTexts: diffServCountActTable.setDescription('This table contains counters for all the traffic passing through an action element.')
diffServCountActEntry = MibTableRow((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "DIFF-SERV-MIB", "diffServActionIfDirection"), (0, "DIFF-SERV-MIB", "diffServActionId"))
if mibBuilder.loadTexts: diffServCountActEntry.setStatus('current')
if mibBuilder.loadTexts: diffServCountActEntry.setDescription('An entry in the count action table that describes a single set of traffic counters. Entries in this table share indexing with those in the base diffServActionTable although they must be managed (e.g. created/deleted) by explicit management action, independently of the associated value of diffServActionSpecific.')
diffServCountActOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1, 1), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServCountActOctets.setStatus('current')
if mibBuilder.loadTexts: diffServCountActOctets.setDescription('The number of octets at the Action datapath element. On high speed devices, this object implements the least significant 32 bits of diffServcountActHCOctets. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of diffServCountActDiscontTime for this entry.')
diffServCountActHCOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1, 2), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServCountActHCOctets.setStatus('current')
if mibBuilder.loadTexts: diffServCountActHCOctets.setDescription('The number of octets at the Action datapath element. This object should be used on high speed interfaces. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of diffServCountActDiscontTime for this entry.')
diffServCountActPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServCountActPkts.setStatus('current')
if mibBuilder.loadTexts: diffServCountActPkts.setDescription('The number of packets at the Action datapath element. On high speed devices, this object implements the least significant 32 bits of diffServcountActHCPkts. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of diffServCountActDiscontTime for this entry.')
diffServCountActHCPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1, 4), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServCountActHCPkts.setStatus('current')
if mibBuilder.loadTexts: diffServCountActHCPkts.setDescription('The number of packets at the Action datapath element. This object should be used on high speed interfaces. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of diffServCountActDiscontTime for this entry.')
diffServCountActDiscontTime = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1, 5), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServCountActDiscontTime.setStatus('current')
if mibBuilder.loadTexts: diffServCountActDiscontTime.setDescription("The value of sysUpTime on the most recent occasion at which any one or more of this entry's counters suffered a discontinuity. If no such discontinuities have occurred since the last re- initialization of the local management subsystem, then this object contains a zero value.")
diffServCountActStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1, 6), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServCountActStatus.setStatus('current')
if mibBuilder.loadTexts: diffServCountActStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of this entry. Any writable variable may be modified whether the row is active or notInService.')
diffServAbsoluteDropAction = ObjectIdentity((1, 3, 6, 1, 2, 1, 12345, 1, 6))
if mibBuilder.loadTexts: diffServAbsoluteDropAction.setStatus('current')
if mibBuilder.loadTexts: diffServAbsoluteDropAction.setDescription('This object identifier may be used as the value of a diffServActionSpecific pointer in order to indicate that all packets following this path are to be dropped unconditionally at this point. It is likely, but not required, that this action will be preceded by a counter action.')
diffServAlgDropTable = MibTable((1, 3, 6, 1, 2, 1, 12345, 2, 8), )
if mibBuilder.loadTexts: diffServAlgDropTable.setReference('[MODEL] section 7.1.3')
if mibBuilder.loadTexts: diffServAlgDropTable.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropTable.setDescription('The algorithmic drop table contains entries describing an element that drops packets according to some algorithm.')
diffServAlgDropEntry = MibTableRow((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "DIFF-SERV-MIB", "diffServAlgDropIfDirection"), (0, "DIFF-SERV-MIB", "diffServAlgDropId"))
if mibBuilder.loadTexts: diffServAlgDropEntry.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropEntry.setDescription('An entry describes a process that drops packets according to some algorithm. Further details of the algorithm type are to be found in diffServAlgDropType and may be pointed to by diffServAlgDropSpecific.')
diffServAlgDropIfDirection = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 1), IfDirection())
if mibBuilder.loadTexts: diffServAlgDropIfDirection.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropIfDirection.setDescription('Specifies the direction for which this algorithmic dropper entry applies on this interface.')
diffServAlgDropId = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 2), Unsigned32())
if mibBuilder.loadTexts: diffServAlgDropId.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropId.setDescription('This identifies the drop action entry. Managers should obtain new values for row creation in this table by reading diffServAlgDropNextFree.')
diffServAlgDropType = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("tailDrop", 2), ("headDrop", 3), ("randomDrop", 4)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServAlgDropType.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropType.setDescription('The type of algorithm used by this dropper. A value of tailDrop(2) or headDrop(3) represents an algorithm that is completely specified by this MIB. A value of other(1) requires further specification in some other MIB module. The tailDrop(2) algorithm is described as follows: diffServAlgDropQThreshold represents the depth of the queue diffServAlgDropQMeasure at which all newly arriving packets will be dropped. The headDrop(3) algorithm is described as follows: if a packet arrives when the current depth of the queue diffServAlgDropQMeasure is at diffServAlgDropQThreshold, packets currently at the head of the queue are dropped to make room for the new packet to be enqueued at the tail of the queue. The randomDrop(4) algorithm is described as follows: on packet arrival, an algorithm is executed which may randomly drop the packet, or drop other packet(s) from the queue in its place. The specifics of the algorithm may be proprietary. For this algorithm, an associated diffServRandomDropEntry is indicated by pointing diffServAlgDropSpecific at the diffServRandomDropTable. The relevant entry in that table is selected by the common indexing of the two tables. For this algorithm, diffServAlgQThreshold is understood to be the absolute maximum size of the queue and additional parameters are described in diffServRandomDropTable.')
diffServAlgDropNext = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 4), RowPointer()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServAlgDropNext.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropNext.setDescription('The Next pointer indicates the next datapath element to handle the traffic e.g. a queue datapath element. The value zeroDotZero in this variable indicates no further DiffServ treatment is performed on this flow by the current interface for this interface direction. If the row pointed to does not exist, the algorithmic dropper element is considered inactive.')
diffServAlgDropQMeasure = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 5), RowPointer()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServAlgDropQMeasure.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropQMeasure.setDescription('Points to an entry in the diffServQueueTable to indicate the queue that a drop algorithm is to monitor when deciding whether to drop a packet. If the row pointed to does not exist, the algorithmic dropper element is considered inactive.')
diffServAlgDropQThreshold = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 6), Unsigned32()).setUnits('Bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServAlgDropQThreshold.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropQThreshold.setDescription('A threshold on the depth in bytes of the queue being measured at which a trigger is generated to the dropping algorithm. For the tailDrop(2) or headDrop(3) algorithms, this represents the depth of the queue diffServAlgDropQMeasure at which the drop action will take place. Other algorithms will need to define their own semantics for this threshold.')
diffServAlgDropSpecific = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 7), ObjectIdentifier()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServAlgDropSpecific.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropSpecific.setDescription('Points to a table (not an entry in the table) defined elsewhere that provides further detail regarding a drop algorithm. Entries in such a table are indexed by the same variables as this diffServAlgDropEntry but note that those entries must be managed independently of those in this table. Entries with diffServAlgDropType equal to other(1) may have this point to a table defined in another MIB module. Entries with diffServAlgDropType equal to randomDrop(4) must have this point to diffServRandomDropTable. For all other algorithms, this should take the value zeroDotzero.')
diffServAlgDropOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServAlgDropOctets.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropOctets.setDescription('The number of octets that have been dropped by this drop process. On high speed devices, this object implements the least significant 32 bits of diffServAlgDropHCOctets. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of ifCounterDiscontinuityTime appropriate to this interface.')
diffServAlgDropHCOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 9), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServAlgDropHCOctets.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropHCOctets.setDescription('The number of octets that have been dropped by this drop process. This object should be used on high speed interfaces. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of ifCounterDiscontinuityTime appropriate to this interface.')
diffServAlgDropPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServAlgDropPkts.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropPkts.setDescription('The number of packets that have been dropped by this drop process. On high speed devices, this object implements the least significant 32 bits of diffServAlgDropHCPkts. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of ifCounterDiscontinuityTime appropriate to this interface.')
diffServAlgDropHCPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 11), Counter64()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServAlgDropHCPkts.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropHCPkts.setDescription('The number of packets that have been dropped by this drop process. This object should be used on high speed interfaces. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of ifCounterDiscontinuityTime appropriate to this interface.')
diffServAlgDropStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 12), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServAlgDropStatus.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of this entry. Any writable variable may be modified whether the row is active or notInService.')
diffServAlgDropNextFree = MibScalar((1, 3, 6, 1, 2, 1, 12345, 1, 7), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServAlgDropNextFree.setStatus('current')
if mibBuilder.loadTexts: diffServAlgDropNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServAlgDropId instance. If a configuring system attempts to create a new row in the diffServAlgDropTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diffServRandomDropTable = MibTable((1, 3, 6, 1, 2, 1, 12345, 2, 9), )
if mibBuilder.loadTexts: diffServRandomDropTable.setReference('[MODEL] section 7.1.3')
if mibBuilder.loadTexts: diffServRandomDropTable.setStatus('current')
if mibBuilder.loadTexts: diffServRandomDropTable.setDescription('The random drop table augments the algorithmic drop table. It contains entries describing a process that drops packets randomly. This table is intended to be pointed to by the associated diffServAlgDropSpecific in such cases.')
diffServRandomDropEntry = MibTableRow((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "DIFF-SERV-MIB", "diffServAlgDropIfDirection"), (0, "DIFF-SERV-MIB", "diffServAlgDropId"))
if mibBuilder.loadTexts: diffServRandomDropEntry.setStatus('current')
if mibBuilder.loadTexts: diffServRandomDropEntry.setDescription('An entry describes a process that drops packets according to a random algorithm. Entries in this table share indexing with a parent diffServAlgDropEntry although they must be managed (e.g. created/deleted) by explicit management action, independently of the associated value of diffServAlgDropSpecific.')
diffServRandomDropMinThreshBytes = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 1), Unsigned32()).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServRandomDropMinThreshBytes.setStatus('current')
if mibBuilder.loadTexts: diffServRandomDropMinThreshBytes.setDescription('The average queue depth in bytes, beyond which traffic has a non-zero probability of being dropped. Changes in this variable may or may not be reflected in the reported value of diffServRandomDropMinThreshPkts.')
diffServRandomDropMinThreshPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 2), Unsigned32()).setUnits('packets').setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServRandomDropMinThreshPkts.setStatus('current')
if mibBuilder.loadTexts: diffServRandomDropMinThreshPkts.setDescription('The average queue depth in packets, beyond which traffic has a non-zero probability of being dropped. Changes in this variable may or may not be reflected in the reported value of diffServRandomDropMinThreshBytes.')
diffServRandomDropMaxThreshBytes = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 3), Unsigned32()).setUnits('bytes').setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServRandomDropMaxThreshBytes.setStatus('current')
if mibBuilder.loadTexts: diffServRandomDropMaxThreshBytes.setDescription('The average queue depth beyond which traffic has a probability indicated by diffServRandomDropInvMaxProb of being dropped or marked. Note that this differs from the physical queue limit, which is stored in diffServAlgDropQThreshold. Changes in this variable may or may not be reflected in the reported value of diffServRandomDropMaxThreshPkts.')
diffServRandomDropMaxThreshPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 4), Unsigned32()).setUnits('packets').setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServRandomDropMaxThreshPkts.setStatus('current')
if mibBuilder.loadTexts: diffServRandomDropMaxThreshPkts.setDescription('The average queue depth beyond which traffic has a probability indicated by diffServRandomDropInvMaxProb of being dropped or marked. Note that this differs from the physical queue limit, which is stored in diffServAlgDropQThreshold. Changes in this variable may or may not be reflected in the reported value of diffServRandomDropMaxThreshBytes.')
diffServRandomDropInvWeight = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 5), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServRandomDropInvWeight.setStatus('current')
if mibBuilder.loadTexts: diffServRandomDropInvWeight.setDescription('The weighting of past history in affecting the calculation of the current queue average. The moving average of the queue depth uses the inverse of this value as the factor for the new queue depth, and one minus that inverse as the factor for the historical average. Implementations may choose to limit the acceptable set of values to a specified set, such as powers of 2.')
diffServRandomDropProbMax = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 6), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServRandomDropProbMax.setStatus('current')
if mibBuilder.loadTexts: diffServRandomDropProbMax.setDescription('The worst case random drop probability, expressed in drops per thousand packets. For example, if every packet may be dropped in the worst case (100%), this has the value 1000. Alternatively, if in the worst case one percent (1%) of traffic may be dropped, it has the value 10.')
diffServRandomDropStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 7), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServRandomDropStatus.setStatus('current')
if mibBuilder.loadTexts: diffServRandomDropStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of this entry. Any writable variable may be modified whether the row is active or notInService.')
diffServQTable = MibTable((1, 3, 6, 1, 2, 1, 12345, 2, 10), )
if mibBuilder.loadTexts: diffServQTable.setStatus('current')
if mibBuilder.loadTexts: diffServQTable.setDescription('The Queue Table enumerates the individual queues on an interface.')
diffServQEntry = MibTableRow((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "DIFF-SERV-MIB", "diffServQIfDirection"), (0, "DIFF-SERV-MIB", "diffServQId"))
if mibBuilder.loadTexts: diffServQEntry.setStatus('current')
if mibBuilder.loadTexts: diffServQEntry.setDescription('An entry in the Queue Table describes a single queue in one direction on an interface.')
diffServQIfDirection = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 1), IfDirection())
if mibBuilder.loadTexts: diffServQIfDirection.setStatus('current')
if mibBuilder.loadTexts: diffServQIfDirection.setDescription('Specifies the direction for which this queue entry applies on this interface.')
diffServQId = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 2), Unsigned32())
if mibBuilder.loadTexts: diffServQId.setStatus('current')
if mibBuilder.loadTexts: diffServQId.setDescription('The Queue Id enumerates the Queue entry. Managers should obtain new values for row creation in this table by reading diffServQNextFree.')
diffServQNext = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 3), RowPointer()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServQNext.setStatus('current')
if mibBuilder.loadTexts: diffServQNext.setDescription('The Next pointer indicates the next datapath element to handle the traffic e.g. a scheduler datapath element. If the row pointed to does not exist, the queue element is considered inactive.')
diffServQPriority = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 4), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServQPriority.setStatus('current')
if mibBuilder.loadTexts: diffServQPriority.setDescription('The priority of this queue, to be used as a parameter to the next scheduler element downstream from this one.')
diffServQMinRateAbs = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 5), Unsigned32()).setUnits('kilobits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServQMinRateAbs.setReference('ifSpeed, ifHighSpeed from [IFMIB]')
if mibBuilder.loadTexts: diffServQMinRateAbs.setStatus('current')
if mibBuilder.loadTexts: diffServQMinRateAbs.setDescription("The minimum absolute rate, in kilobits/sec, that a downstream scheduler element should allocate to this queue. If the value is zero, then there is effectively no minimum rate guarantee. If the value is non-zero, the scheduler will assure the servicing of this queue to at least this rate. Note that this attribute's value is coupled to that of diffServQMinRateRel: changes to one will affect the value of the other. They are linked by the following equation: diffServQMinRateRel = diffServQMinRateAbs * 10,000,000/ifSpeed or, if appropriate: diffServQMinRateRel = diffServQMinRateAbs * 10 / ifHighSpeed")
diffServQMinRateRel = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 6), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServQMinRateRel.setReference('ifSpeed, ifHighSpeed from [IFMIB]')
if mibBuilder.loadTexts: diffServQMinRateRel.setStatus('current')
if mibBuilder.loadTexts: diffServQMinRateRel.setDescription("The minimum rate that a downstream scheduler element should allocate to this queue, relative to the maximum rate of the interface as reported by ifSpeed or ifHighSpeed, in units of 1/10,000 of 1. If the value is zero, then there is effectively no minimum rate guarantee. If the value is non-zero, the scheduler will assure the servicing of this queue to at least this rate. Note that this attribute's value is coupled to that of diffServQMinRateAbs: changes to one will affect the value of the other. They are linked by the following equation: diffServQMinRateAbs = ifSpeed * diffServQMinRateRel/10,000,000 or, if appropriate: diffServQMinRateAbs = ifHighSpeed * diffServQMinRateRel / 10")
diffServQMaxRateAbs = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 7), Unsigned32()).setUnits('kilobits per second').setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServQMaxRateAbs.setReference('ifSpeed, ifHighSpeed from [IFMIB]')
if mibBuilder.loadTexts: diffServQMaxRateAbs.setStatus('current')
if mibBuilder.loadTexts: diffServQMaxRateAbs.setDescription("The maximum rate in kilobits/sec that a downstream scheduler element should allocate to this queue. If the value is zero, then there is effectively no maximum rate limit and that the scheduler should attempt to be work-conserving for this queue. If the value is non-zero, the scheduler will limit the servicing of this queue to, at most, this rate in a non-work-conserving manner. Note that this attribute's value is coupled to that of diffServQMaxRateRel: changes to one will affect the value of the other. They are linked by the following equation: diffServQMaxRateRel = diffServQMaxRateAbs * 10,000,000/ifSpeed or, if appropriate: diffServQMaxRateRel = diffServQMaxRateAbs * 10 / ifHighSpeed")
diffServQMaxRateRel = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 8), Unsigned32()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServQMaxRateRel.setReference('ifSpeed, ifHighSpeed from [IFMIB]')
if mibBuilder.loadTexts: diffServQMaxRateRel.setStatus('current')
if mibBuilder.loadTexts: diffServQMaxRateRel.setDescription("The maximum rate that a downstream scheduler element should allocate to this queue, relative to the maximum rate of the interface as reported by ifSpeed or ifHighSpeed, in units of 1/10,000 of 1. If the value is zero, then there is effectively no maximum rate limit and the scheduler should attempt to be work-conserving for this queue. If the value is non-zero, the scheduler will limit the servicing of this queue to, at most, this rate in a non-work-conserving manner. Note that this attribute's value is coupled to that of diffServQMaxRateAbs: changes to one will affect the value of the other. They are linked by the following equation: diffServQMaxRateAbs = ifSpeed * diffServQMaxRateRel/10,000,000 or, if appropriate: diffServQMaxRateAbs = ifHighSpeed * diffServQMaxRateRel / 10")
diffServQStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 9), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServQStatus.setStatus('current')
if mibBuilder.loadTexts: diffServQStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of a queue. Any writable variable may be modified whether the row is active or notInService.')
diffServQNextFree = MibScalar((1, 3, 6, 1, 2, 1, 12345, 1, 8), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServQNextFree.setStatus('current')
if mibBuilder.loadTexts: diffServQNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServQId instance. If a configuring system attempts to create a new row in the diffServQTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diffServSchedulerTable = MibTable((1, 3, 6, 1, 2, 1, 12345, 2, 11), )
if mibBuilder.loadTexts: diffServSchedulerTable.setReference('[MODEL] section 7.1.2')
if mibBuilder.loadTexts: diffServSchedulerTable.setStatus('current')
if mibBuilder.loadTexts: diffServSchedulerTable.setDescription('The Scheduler Table enumerates packet schedulers. Multiple scheduling algorithms can be used on a given interface, with each algorithm described by one diffServSchedulerEntry.')
diffServSchedulerEntry = MibTableRow((1, 3, 6, 1, 2, 1, 12345, 2, 11, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "DIFF-SERV-MIB", "diffServSchedulerIfDirection"), (0, "DIFF-SERV-MIB", "diffServSchedulerId"))
if mibBuilder.loadTexts: diffServSchedulerEntry.setStatus('current')
if mibBuilder.loadTexts: diffServSchedulerEntry.setDescription('An entry in the Scheduler Table describing a single instance of a scheduling algorithm.')
diffServSchedulerIfDirection = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 11, 1, 1), IfDirection())
if mibBuilder.loadTexts: diffServSchedulerIfDirection.setStatus('current')
if mibBuilder.loadTexts: diffServSchedulerIfDirection.setDescription('Specifies the direction for which this scheduler entry applies on this interface.')
diffServSchedulerId = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 11, 1, 2), Unsigned32())
if mibBuilder.loadTexts: diffServSchedulerId.setStatus('current')
if mibBuilder.loadTexts: diffServSchedulerId.setDescription('This identifies the scheduler entry. Managers should obtain new values for row creation in this table by reading diffServSchedulerNextFree.')
diffServSchedulerMethod = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 11, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("other", 1), ("priorityq", 2), ("wrr", 3)))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSchedulerMethod.setReference('[MODEL] section 7.1.2')
if mibBuilder.loadTexts: diffServSchedulerMethod.setStatus('current')
if mibBuilder.loadTexts: diffServSchedulerMethod.setDescription('The scheduling algorithm used by this Scheduler. A value of priorityq(2) is used to indicate strict priority queueing: only the diffServQPriority attributes of the queues feeding this scheduler are used when determining the next packet to schedule. A value of wrr(3) indicates weighted round-robin scheduling. Packets are scheduled from each of the queues feeding this scheduler according to all of the parameters of the diffServQueue entry.')
diffServSchedulerNext = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 11, 1, 4), RowPointer().clone((0, 0))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSchedulerNext.setStatus('current')
if mibBuilder.loadTexts: diffServSchedulerNext.setDescription('Selects the next data path component, which can be another scheduler or other TC elements. One usage of multiple scheduler elements in series is for Class Base Queueing (CBQ). The value zeroDotZero in this variable indicates no further DiffServ treatment is performed on this flow by the current interface for this interface direction. For example, for an inbound interface the value zeroDotZero indicates that the packet flow has now completed inbound DiffServ treatment and should be forwarded on to the appropriate outbound interface. If the row pointed to does not exist, the scheduler element is considered inactive.')
diffServSchedulerStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 12345, 2, 11, 1, 5), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: diffServSchedulerStatus.setStatus('current')
if mibBuilder.loadTexts: diffServSchedulerStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of a queue. Any writable variable may be modified whether the row is active or notInService.')
diffServSchedulerNextFree = MibScalar((1, 3, 6, 1, 2, 1, 12345, 1, 9), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: diffServSchedulerNextFree.setStatus('current')
if mibBuilder.loadTexts: diffServSchedulerNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServSchedulerId instance. If a configuring system attempts to create a new row in the diffServSchedulerTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diffServMIBCompliances = MibIdentifier((1, 3, 6, 1, 2, 1, 12345, 3, 1))
diffServMIBGroups = MibIdentifier((1, 3, 6, 1, 2, 1, 12345, 3, 2))
diffServMIBCompliance = ModuleCompliance((1, 3, 6, 1, 2, 1, 12345, 3, 1, 1)).setObjects(("DIFF-SERV-MIB", "diffServMIBClassifierGroup"), ("DIFF-SERV-MIB", "diffServMIBSixTupleClfrGroup"), ("DIFF-SERV-MIB", "diffServMIBActionGroup"), ("DIFF-SERV-MIB", "diffServMIBAlgDropGroup"), ("DIFF-SERV-MIB", "diffServMIBQueueGroup"), ("DIFF-SERV-MIB", "diffServMIBSchedulerGroup"), ("DIFF-SERV-MIB", "diffServMIBCounterGroup"), ("DIFF-SERV-MIB", "diffServMIBHCCounterGroup"), ("DIFF-SERV-MIB", "diffServMIBVHCCounterGroup"), ("DIFF-SERV-MIB", "diffServMIBMeterGroup"), ("DIFF-SERV-MIB", "diffServMIBTokenBucketMeterGroup"), ("DIFF-SERV-MIB", "diffServMIBDscpMarkActionGroup"), ("DIFF-SERV-MIB", "diffServMIBRandomDropGroup"), ("DIFF-SERV-MIB", "diffServMIBStaticGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBCompliance = diffServMIBCompliance.setStatus('current')
if mibBuilder.loadTexts: diffServMIBCompliance.setDescription('This MIB may be implemented as a read-only or as a read-create MIB. As a result, it may be used for monitoring or for configuration.')
diffServMIBClassifierGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 1)).setObjects(("DIFF-SERV-MIB", "diffServClassifierFilter"), ("DIFF-SERV-MIB", "diffServClassifierNext"), ("DIFF-SERV-MIB", "diffServClassifierPrecedence"), ("DIFF-SERV-MIB", "diffServClassifierStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBClassifierGroup = diffServMIBClassifierGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBClassifierGroup.setDescription('The Classifier Group defines the MIB Objects that describe a generic classifier element.')
diffServMIBSixTupleClfrGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 2)).setObjects(("DIFF-SERV-MIB", "diffServSixTupleClfrDstAddrType"), ("DIFF-SERV-MIB", "diffServSixTupleClfrDstAddr"), ("DIFF-SERV-MIB", "diffServSixTupleClfrDstAddrMask"), ("DIFF-SERV-MIB", "diffServSixTupleClfrDstAddrType"), ("DIFF-SERV-MIB", "diffServSixTupleClfrSrcAddrType"), ("DIFF-SERV-MIB", "diffServSixTupleClfrSrcAddrMask"), ("DIFF-SERV-MIB", "diffServSixTupleClfrDscp"), ("DIFF-SERV-MIB", "diffServSixTupleClfrProtocol"), ("DIFF-SERV-MIB", "diffServSixTupleClfrDstL4PortMin"), ("DIFF-SERV-MIB", "diffServSixTupleClfrDstL4PortMax"), ("DIFF-SERV-MIB", "diffServSixTupleClfrSrcL4PortMin"), ("DIFF-SERV-MIB", "diffServSixTupleClfrSrcL4PortMax"), ("DIFF-SERV-MIB", "diffServSixTupleClfrStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBSixTupleClfrGroup = diffServMIBSixTupleClfrGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBSixTupleClfrGroup.setDescription('The Six-tuple Classifier Group defines the MIB Objects that describe a classifier element for matching on 6 fields of an IP and upper-layer protocol header.')
diffServMIBMeterGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 3)).setObjects(("DIFF-SERV-MIB", "diffServMeterSucceedNext"), ("DIFF-SERV-MIB", "diffServMeterFailNext"), ("DIFF-SERV-MIB", "diffServMeterSpecific"), ("DIFF-SERV-MIB", "diffServMeterStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBMeterGroup = diffServMIBMeterGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBMeterGroup.setDescription('The Meter Group defines the objects used in describing a generic meter element.')
diffServMIBTokenBucketMeterGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 4)).setObjects(("DIFF-SERV-MIB", "diffServTBMeterRate"), ("DIFF-SERV-MIB", "diffServTBMeterBurstSize"), ("DIFF-SERV-MIB", "diffServTBMeterStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBTokenBucketMeterGroup = diffServMIBTokenBucketMeterGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBTokenBucketMeterGroup.setDescription('The Token-Bucket Meter Group defines the objects used in describing a single-rate token bucket meter element.')
diffServMIBActionGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 5)).setObjects(("DIFF-SERV-MIB", "diffServActionNext"), ("DIFF-SERV-MIB", "diffServActionSpecific"), ("DIFF-SERV-MIB", "diffServActionStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBActionGroup = diffServMIBActionGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBActionGroup.setDescription('The Action Group defines the objects used in describing a generic action element.')
diffServMIBDscpMarkActionGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 6)).setObjects(("DIFF-SERV-MIB", "diffServDscpMarkActDscp"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBDscpMarkActionGroup = diffServMIBDscpMarkActionGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBDscpMarkActionGroup.setDescription('The DSCP Mark Action Group defines the objects used in describing a DSCP Marking Action element.')
diffServMIBCounterGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 7)).setObjects(("DIFF-SERV-MIB", "diffServCountActOctets"), ("DIFF-SERV-MIB", "diffServCountActPkts"), ("DIFF-SERV-MIB", "diffServCountActStatus"), ("DIFF-SERV-MIB", "diffServAlgDropOctets"), ("DIFF-SERV-MIB", "diffServAlgDropPkts"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBCounterGroup = diffServMIBCounterGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBCounterGroup.setDescription('A collection of objects providing information specific to non- high speed (non-high speed interfaces transmit and receive at speeds less than or equal to 20,000,000 bits/second) packet- oriented network interfaces.')
diffServMIBHCCounterGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 8)).setObjects(("DIFF-SERV-MIB", "diffServCountActOctets"), ("DIFF-SERV-MIB", "diffServCountActHCOctets"), ("DIFF-SERV-MIB", "diffServCountActPkts"), ("DIFF-SERV-MIB", "diffServCountActStatus"), ("DIFF-SERV-MIB", "diffServAlgDropOctets"), ("DIFF-SERV-MIB", "diffServAlgDropHCOctets"), ("DIFF-SERV-MIB", "diffServAlgDropPkts"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBHCCounterGroup = diffServMIBHCCounterGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBHCCounterGroup.setDescription('A collection of objects providing information specific to non- high speed (non-high speed interfaces transmit and receive at speeds less than or equal to 20,000,000 bits/second) packet- oriented network interfaces.')
diffServMIBVHCCounterGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 9)).setObjects(("DIFF-SERV-MIB", "diffServCountActOctets"), ("DIFF-SERV-MIB", "diffServCountActHCOctets"), ("DIFF-SERV-MIB", "diffServCountActPkts"), ("DIFF-SERV-MIB", "diffServCountActHCPkts"), ("DIFF-SERV-MIB", "diffServCountActStatus"), ("DIFF-SERV-MIB", "diffServAlgDropOctets"), ("DIFF-SERV-MIB", "diffServAlgDropHCOctets"), ("DIFF-SERV-MIB", "diffServAlgDropPkts"), ("DIFF-SERV-MIB", "diffServAlgDropHCPkts"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBVHCCounterGroup = diffServMIBVHCCounterGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBVHCCounterGroup.setDescription('A collection of objects providing information specific to non- high speed (non-high speed interfaces transmit and receive at speeds less than or equal to 20,000,000 bits/second) packet- oriented network interfaces.')
diffServMIBAlgDropGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 10)).setObjects(("DIFF-SERV-MIB", "diffServAlgDropType"), ("DIFF-SERV-MIB", "diffServAlgDropNext"), ("DIFF-SERV-MIB", "diffServAlgDropQMeasure"), ("DIFF-SERV-MIB", "diffServAlgDropQThreshold"), ("DIFF-SERV-MIB", "diffServAlgDropSpecific"), ("DIFF-SERV-MIB", "diffServAlgDropStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBAlgDropGroup = diffServMIBAlgDropGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBAlgDropGroup.setDescription('The Algorithmic Drop Group contains the objects that describe algorithmic dropper operation and configuration.')
diffServMIBRandomDropGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 11)).setObjects(("DIFF-SERV-MIB", "diffServRandomDropMinThreshBytes"), ("DIFF-SERV-MIB", "diffServRandomDropMinThreshPkts"), ("DIFF-SERV-MIB", "diffServRandomDropMaxThreshBytes"), ("DIFF-SERV-MIB", "diffServRandomDropMaxThreshPkts"), ("DIFF-SERV-MIB", "diffServRandomDropInvWeight"), ("DIFF-SERV-MIB", "diffServRandomDropProbMax"), ("DIFF-SERV-MIB", "diffServRandomDropStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBRandomDropGroup = diffServMIBRandomDropGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBRandomDropGroup.setDescription('The Random Drop Group augments the Algorithmic Drop Group for random dropper operation and configuration.')
diffServMIBQueueGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 12)).setObjects(("DIFF-SERV-MIB", "diffServQPriority"), ("DIFF-SERV-MIB", "diffServQNext"), ("DIFF-SERV-MIB", "diffServQMinRateAbs"), ("DIFF-SERV-MIB", "diffServQMinRateRel"), ("DIFF-SERV-MIB", "diffServQMaxRateAbs"), ("DIFF-SERV-MIB", "diffServQMaxRateRel"), ("DIFF-SERV-MIB", "diffServQStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBQueueGroup = diffServMIBQueueGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBQueueGroup.setDescription("The Queue Group contains the objects that describe an interface's queues.")
diffServMIBSchedulerGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 13)).setObjects(("DIFF-SERV-MIB", "diffServSchedulerMethod"), ("DIFF-SERV-MIB", "diffServSchedulerNext"), ("DIFF-SERV-MIB", "diffServSchedulerStatus"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBSchedulerGroup = diffServMIBSchedulerGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBSchedulerGroup.setDescription('The Scheduler Group contains the objects that describe packet schedulers on interfaces.')
diffServMIBStaticGroup = ObjectGroup((1, 3, 6, 1, 2, 1, 12345, 3, 2, 14)).setObjects(("DIFF-SERV-MIB", "diffServClassifierNextFree"), ("DIFF-SERV-MIB", "diffServSixTupleClfrNextFree"), ("DIFF-SERV-MIB", "diffServMeterNextFree"), ("DIFF-SERV-MIB", "diffServActionNextFree"), ("DIFF-SERV-MIB", "diffServAlgDropNextFree"), ("DIFF-SERV-MIB", "diffServQNextFree"), ("DIFF-SERV-MIB", "diffServSchedulerNextFree"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diffServMIBStaticGroup = diffServMIBStaticGroup.setStatus('current')
if mibBuilder.loadTexts: diffServMIBStaticGroup.setDescription('The Static Group contains readable scalar objects used in creating unique identifiers for classifiers, meters, actions and queues. These are required whenever row creation operations on such tables are supported.')
mibBuilder.exportSymbols("DIFF-SERV-MIB", diffServMeterId=diffServMeterId, diffServClassifierStatus=diffServClassifierStatus, diffServClassifierId=diffServClassifierId, diffServCountActHCPkts=diffServCountActHCPkts, diffServMeterSucceedNext=diffServMeterSucceedNext, diffServTBMeterStatus=diffServTBMeterStatus, diffServAlgDropQMeasure=diffServAlgDropQMeasure, diffServQMaxRateRel=diffServQMaxRateRel, diffServSixTupleClfrNextFree=diffServSixTupleClfrNextFree, diffServCountActPkts=diffServCountActPkts, diffServSixTupleClfrDstL4PortMin=diffServSixTupleClfrDstL4PortMin, diffServSixTupleClfrSrcAddrMask=diffServSixTupleClfrSrcAddrMask, diffServRandomDropMaxThreshPkts=diffServRandomDropMaxThreshPkts, diffServMIBHCCounterGroup=diffServMIBHCCounterGroup, diffServRandomDropMinThreshBytes=diffServRandomDropMinThreshBytes, diffServMIBSixTupleClfrGroup=diffServMIBSixTupleClfrGroup, diffServActionId=diffServActionId, diffServQNextFree=diffServQNextFree, diffServCountActHCOctets=diffServCountActHCOctets, diffServCountActOctets=diffServCountActOctets, diffServClassifierNextFree=diffServClassifierNextFree, diffServAlgDropId=diffServAlgDropId, diffServQPriority=diffServQPriority, diffServTBMeterRate=diffServTBMeterRate, diffServSixTupleClfrTable=diffServSixTupleClfrTable, PYSNMP_MODULE_ID=diffServMib, diffServCountActDiscontTime=diffServCountActDiscontTime, diffServQMaxRateAbs=diffServQMaxRateAbs, diffServSixTupleClfrDstAddr=diffServSixTupleClfrDstAddr, diffServSchedulerEntry=diffServSchedulerEntry, diffServDscpMarkActEntry=diffServDscpMarkActEntry, diffServRandomDropMaxThreshBytes=diffServRandomDropMaxThreshBytes, diffServSixTupleClfrDstAddrType=diffServSixTupleClfrDstAddrType, diffServSixTupleClfrEntry=diffServSixTupleClfrEntry, diffServSchedulerNextFree=diffServSchedulerNextFree, diffServMIBCounterGroup=diffServMIBCounterGroup, diffServSixTupleClfrDstL4PortMax=diffServSixTupleClfrDstL4PortMax, diffServAlgDropPkts=diffServAlgDropPkts, diffServMIBVHCCounterGroup=diffServMIBVHCCounterGroup, diffServSixTupleClfrSrcAddr=diffServSixTupleClfrSrcAddr, diffServMIBActionGroup=diffServMIBActionGroup, diffServAlgDropSpecific=diffServAlgDropSpecific, diffServQMinRateRel=diffServQMinRateRel, diffServMIBGroups=diffServMIBGroups, diffServSchedulerTable=diffServSchedulerTable, diffServObjects=diffServObjects, diffServSixTupleClfrSrcL4PortMax=diffServSixTupleClfrSrcL4PortMax, diffServAlgDropTable=diffServAlgDropTable, diffServClassifierEntry=diffServClassifierEntry, diffServClassifierFilter=diffServClassifierFilter, diffServRandomDropStatus=diffServRandomDropStatus, IfDirection=IfDirection, diffServAlgDropOctets=diffServAlgDropOctets, diffServActionTable=diffServActionTable, diffServAlgDropHCOctets=diffServAlgDropHCOctets, diffServSchedulerIfDirection=diffServSchedulerIfDirection, diffServRandomDropProbMax=diffServRandomDropProbMax, diffServMIBConformance=diffServMIBConformance, diffServMeterIfDirection=diffServMeterIfDirection, diffServRandomDropMinThreshPkts=diffServRandomDropMinThreshPkts, diffServActionIfDirection=diffServActionIfDirection, diffServQNext=diffServQNext, diffServCountActTable=diffServCountActTable, diffServRandomDropEntry=diffServRandomDropEntry, diffServMIBTokenBucketMeterGroup=diffServMIBTokenBucketMeterGroup, diffServTBMeterTable=diffServTBMeterTable, diffServMIBStaticGroup=diffServMIBStaticGroup, diffServAlgDropNext=diffServAlgDropNext, diffServSchedulerNext=diffServSchedulerNext, diffServMeterStatus=diffServMeterStatus, diffServQMinRateAbs=diffServQMinRateAbs, diffServSixTupleClfrSrcAddrType=diffServSixTupleClfrSrcAddrType, diffServMeterSpecific=diffServMeterSpecific, diffServMIBRandomDropGroup=diffServMIBRandomDropGroup, diffServAlgDropEntry=diffServAlgDropEntry, diffServSchedulerId=diffServSchedulerId, diffServTBMeterEntry=diffServTBMeterEntry, SixTupleClfrL4Port=SixTupleClfrL4Port, diffServClassifierNext=diffServClassifierNext, diffServSchedulerMethod=diffServSchedulerMethod, diffServDscpMarkActTable=diffServDscpMarkActTable, diffServMIBCompliance=diffServMIBCompliance, diffServAlgDropType=diffServAlgDropType, diffServAlgDropQThreshold=diffServAlgDropQThreshold, diffServCountActStatus=diffServCountActStatus, diffServQStatus=diffServQStatus, diffServClassifierIfDirection=diffServClassifierIfDirection, diffServSixTupleClfrDscp=diffServSixTupleClfrDscp, diffServClassifierTable=diffServClassifierTable, diffServSixTupleClfrDstAddrMask=diffServSixTupleClfrDstAddrMask, diffServAlgDropHCPkts=diffServAlgDropHCPkts, diffServMIBDscpMarkActionGroup=diffServMIBDscpMarkActionGroup, diffServSixTupleClfrStatus=diffServSixTupleClfrStatus, diffServMeterTable=diffServMeterTable, diffServActionNext=diffServActionNext, diffServMeterFailNext=diffServMeterFailNext, diffServActionNextFree=diffServActionNextFree, diffServActionStatus=diffServActionStatus, diffServCountActEntry=diffServCountActEntry, diffServRandomDropTable=diffServRandomDropTable, diffServSixTupleClfrSrcL4PortMin=diffServSixTupleClfrSrcL4PortMin, diffServMIBClassifierGroup=diffServMIBClassifierGroup, diffServMIBSchedulerGroup=diffServMIBSchedulerGroup, diffServClassifierPrecedence=diffServClassifierPrecedence, diffServRandomDropInvWeight=diffServRandomDropInvWeight, diffServMIBAlgDropGroup=diffServMIBAlgDropGroup, diffServSchedulerStatus=diffServSchedulerStatus, diffServQIfDirection=diffServQIfDirection, diffServMeterNextFree=diffServMeterNextFree, diffServAlgDropNextFree=diffServAlgDropNextFree, diffServDscpMarkActDscp=diffServDscpMarkActDscp, diffServTBMeterBurstSize=diffServTBMeterBurstSize, diffServQTable=diffServQTable, diffServClassifierTcb=diffServClassifierTcb, diffServTables=diffServTables, diffServMIBMeterGroup=diffServMIBMeterGroup, diffServAlgDropIfDirection=diffServAlgDropIfDirection, diffServQId=diffServQId, diffServMIBQueueGroup=diffServMIBQueueGroup, diffServMIBCompliances=diffServMIBCompliances, diffServAbsoluteDropAction=diffServAbsoluteDropAction, diffServMeterEntry=diffServMeterEntry, diffServActionSpecific=diffServActionSpecific, diffServAlgDropStatus=diffServAlgDropStatus, diffServQEntry=diffServQEntry, diffServSixTupleClfrProtocol=diffServSixTupleClfrProtocol, diffServMib=diffServMib, diffServActionEntry=diffServActionEntry, diffServSixTupleClfrId=diffServSixTupleClfrId, Dscp=Dscp)
| (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_intersection, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueSizeConstraint')
(if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex')
(inet_address_type, inet_address) = mibBuilder.importSymbols('INET-ADDRESS-MIB', 'InetAddressType', 'InetAddress')
(burst_size,) = mibBuilder.importSymbols('INTEGRATED-SERVICES-MIB', 'BurstSize')
(notification_group, object_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ObjectGroup', 'ModuleCompliance')
(unsigned32, module_identity, mib_identifier, mib_2, mib_scalar, mib_table, mib_table_row, mib_table_column, counter32, integer32, time_ticks, zero_dot_zero, bits, object_identity, notification_type, gauge32, ip_address, iso, counter64) = mibBuilder.importSymbols('SNMPv2-SMI', 'Unsigned32', 'ModuleIdentity', 'MibIdentifier', 'mib-2', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter32', 'Integer32', 'TimeTicks', 'zeroDotZero', 'Bits', 'ObjectIdentity', 'NotificationType', 'Gauge32', 'IpAddress', 'iso', 'Counter64')
(display_string, row_status, time_stamp, textual_convention, row_pointer) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'RowStatus', 'TimeStamp', 'TextualConvention', 'RowPointer')
diff_serv_mib = module_identity((1, 3, 6, 1, 2, 1, 12345))
diffServMib.setRevisions(('2000-07-13 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
diffServMib.setRevisionsDescriptions(('Initial version, published as RFC xxxx.',))
if mibBuilder.loadTexts:
diffServMib.setLastUpdated('200007130000Z')
if mibBuilder.loadTexts:
diffServMib.setOrganization('IETF Diffserv WG')
if mibBuilder.loadTexts:
diffServMib.setContactInfo(' Brian Carpenter (co-chair of Diffserv WG) c/o iCAIR 1890 Maple Ave, #150 Evanston, IL 60201, USA Phone: +1 847 467 7811 E-mail: brian@icair.org Kathleen Nichols (co-chair of Diffserv WG) Packet Design E-mail: nichols@packetdesign.com Fred Baker (author) Cisco Systems 519 Lado Drive Santa Barbara, CA 93111, USA E-mail: fred@cisco.com Kwok Ho Chan (author) Nortel Networks 600 Technology Park Drive Billerica, MA 01821, USA E-mail: khchan@nortelnetworks.com Andrew Smith (author) E-mail: ah-smith@pacbell.net')
if mibBuilder.loadTexts:
diffServMib.setDescription('This MIB defines the objects necessary to manage a device that uses the Differentiated Services Architecture described in RFC 2475 and the Informal Management Model for DiffServ Routers in draft-ietf-diffserv-model-04.txt.')
diff_serv_objects = mib_identifier((1, 3, 6, 1, 2, 1, 12345, 1))
diff_serv_tables = mib_identifier((1, 3, 6, 1, 2, 1, 12345, 2))
diff_serv_mib_conformance = mib_identifier((1, 3, 6, 1, 2, 1, 12345, 3))
class Dscp(TextualConvention, Integer32):
description = 'The IP header Diffserv Code-Point that may be used for discriminating or marking a traffic stream. The value -1 is used to indicate a wildcard i.e. any value.'
status = 'current'
display_hint = 'd'
subtype_spec = Integer32.subtypeSpec + constraints_union(value_range_constraint(-1, -1), value_range_constraint(0, 63))
class Sixtupleclfrl4Port(TextualConvention, Integer32):
description = 'A value indicating a Layer-4 protocol port number.'
status = 'current'
display_hint = 'd'
subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 65535)
class Ifdirection(TextualConvention, Integer32):
description = "Specifies a direction of data travel on an interface. 'inbound' traffic is operated on during reception from the interface, while 'outbound' traffic is operated on prior to transmission on the interface."
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2))
named_values = named_values(('inbound', 1), ('outbound', 2))
diff_serv_classifier_table = mib_table((1, 3, 6, 1, 2, 1, 12345, 2, 1))
if mibBuilder.loadTexts:
diffServClassifierTable.setReference('[MODEL] section 4.1')
if mibBuilder.loadTexts:
diffServClassifierTable.setStatus('current')
if mibBuilder.loadTexts:
diffServClassifierTable.setDescription('The classifier table defines the classifiers that are applied to traffic arriving at this interface in a particular direction. Specific classifiers are defined by RowPointers in the entries of this table which identify entries in filter tables of specific types, e.g. Multi-Field Classifiers (MFCs) for IP are defined in the diffServSixTupleClfrTable. Other classifier types may be defined elsewhere.')
diff_serv_classifier_entry = mib_table_row((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'DIFF-SERV-MIB', 'diffServClassifierIfDirection'), (0, 'DIFF-SERV-MIB', 'diffServClassifierTcb'), (0, 'DIFF-SERV-MIB', 'diffServClassifierId'))
if mibBuilder.loadTexts:
diffServClassifierEntry.setStatus('current')
if mibBuilder.loadTexts:
diffServClassifierEntry.setDescription('An entry in the classifier table describes a single element of the classifier.')
diff_serv_classifier_if_direction = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 1), if_direction())
if mibBuilder.loadTexts:
diffServClassifierIfDirection.setStatus('current')
if mibBuilder.loadTexts:
diffServClassifierIfDirection.setDescription('Specifies the direction for which this classifier entry applies on this interface.')
diff_serv_classifier_tcb = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 2), unsigned32())
if mibBuilder.loadTexts:
diffServClassifierTcb.setStatus('current')
if mibBuilder.loadTexts:
diffServClassifierTcb.setDescription('Specifies the TCB of which this classifier element is a part. Lower numbers indicate an element that belongs to a classifier that is part of a TCB that is, at least conceptually, applied to traffic before those with higher numbers - this is necessary to resolve ambiguity in cases where different TCBs contain filters that overlap with each other. A manager wanting to create a new TCB should either first search this table for existing entries and pick a value for this variable that is not currently represented - some form of pseudo- random choice is likely to minimise collisions. After successful creation of a conceptual row using the chosen value, the manager should check again that there are no other rows with this value that have been created by a different manager that could, potentially, interfere with the classifier elements that are desired.')
diff_serv_classifier_id = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 3), unsigned32())
if mibBuilder.loadTexts:
diffServClassifierId.setStatus('current')
if mibBuilder.loadTexts:
diffServClassifierId.setDescription('A classifier ID that enumerates the classifier elements. The set of such identifiers spans the whole agent. Managers should obtain new values for row creation in this table by reading diffServClassifierNextFree.')
diff_serv_classifier_filter = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 4), row_pointer().clone((0, 0))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServClassifierFilter.setStatus('current')
if mibBuilder.loadTexts:
diffServClassifierFilter.setDescription('A pointer to a valid entry in another table that describes the applicable classification filter, e.g. an entry in diffServSixTupleClfrTable. If the row pointed to does not exist, the classifier is ignored. The value zeroDotZero is interpreted to match anything not matched by another classifier - only one such entry may exist in this table.')
diff_serv_classifier_next = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 5), row_pointer()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServClassifierNext.setStatus('current')
if mibBuilder.loadTexts:
diffServClassifierNext.setDescription('This selects the next datapath element to handle packets matching the filter pattern. For example, this can point to an entry in a meter, action, algorithmic dropper or queue table. If the row pointed to does not exist, the classifier element is ignored.')
diff_serv_classifier_precedence = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 6), unsigned32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServClassifierPrecedence.setStatus('current')
if mibBuilder.loadTexts:
diffServClassifierPrecedence.setDescription('The relative precedence in which classifiers are applied: higher numbers represent classifiers with higher precedence. Classifiers with the same precedence must be unambiguous i.e. they must define non-overlapping patterns, and are considered to be applied simultaneously to the traffic stream. Classifiers with different precedence may overlap in their filters: the classifier with the highest precedence that matches is taken. On a given interface, there must be a complete classifier in place at all times for the first TCB (lowest value of diffServClassifierTcb) in the ingress direction. This means that there will always be one or more filters that match every possible pattern that could be presented in an incoming packet. There is no such requirement for subsequent TCBs in the ingress direction, nor for any TCB in the egress direction.')
diff_serv_classifier_status = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 1, 1, 7), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServClassifierStatus.setStatus('current')
if mibBuilder.loadTexts:
diffServClassifierStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of a classifier. Any writable variable may be modified whether the row is active or notInService.')
diff_serv_classifier_next_free = mib_scalar((1, 3, 6, 1, 2, 1, 12345, 1, 1), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServClassifierNextFree.setStatus('current')
if mibBuilder.loadTexts:
diffServClassifierNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServClassifierId instance. If a configuring system attempts to create a new row in the diffServClassifierTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diff_serv_six_tuple_clfr_table = mib_table((1, 3, 6, 1, 2, 1, 12345, 2, 2))
if mibBuilder.loadTexts:
diffServSixTupleClfrTable.setReference('[MODEL] section 4.2.2')
if mibBuilder.loadTexts:
diffServSixTupleClfrTable.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrTable.setDescription('A table of IP Six-Tuple Classifier filter entries that a system may use to identify IP traffic.')
diff_serv_six_tuple_clfr_entry = mib_table_row((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1)).setIndexNames((0, 'DIFF-SERV-MIB', 'diffServSixTupleClfrId'))
if mibBuilder.loadTexts:
diffServSixTupleClfrEntry.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrEntry.setDescription('An IP Six-Tuple Classifier entry describes a single filter.')
diff_serv_six_tuple_clfr_id = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 1), unsigned32())
if mibBuilder.loadTexts:
diffServSixTupleClfrId.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrId.setDescription('A unique identifier for the filter. Filters may be shared by multiple interfaces in the same system. Managers should obtain new values for row creation in this table by reading diffServSixTupleClfrNextFree.')
diff_serv_six_tuple_clfr_dst_addr_type = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 2), inet_address_type()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrDstAddrType.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrDstAddrType.setDescription('The type of IP destination address used by this classifier entry.')
diff_serv_six_tuple_clfr_dst_addr = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 3), inet_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrDstAddr.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrDstAddr.setDescription("The IP address to match against the packet's destination IP address.")
diff_serv_six_tuple_clfr_dst_addr_mask = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 4), unsigned32()).setUnits('bits').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrDstAddrMask.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrDstAddrMask.setDescription('The length of a mask for the matching of the destination IP address. Masks are constructed by setting bits in sequence from the most-significant bit downwards for diffServSixTupleClfrDstAddrMask bits length. All other bits in the mask, up to the number needed to fill the length of the address diffServSixTupleClfrDstAddr are cleared to zero. A zero bit in the mask then means that the corresponding bit in the address always matches.')
diff_serv_six_tuple_clfr_src_addr_type = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 5), inet_address_type()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrSrcAddrType.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrSrcAddrType.setDescription('The type of IP source address used by this classifier entry.')
diff_serv_six_tuple_clfr_src_addr = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 6), inet_address()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrSrcAddr.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrSrcAddr.setDescription('The IP address to match against the source IP address of each packet.')
diff_serv_six_tuple_clfr_src_addr_mask = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 7), unsigned32()).setUnits('bits').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrSrcAddrMask.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrSrcAddrMask.setDescription('The length of a mask for the matching of the source IP address. Masks are constructed by setting bits in sequence from the most- significant bit downwards for diffServSixTupleClfrSrcAddrMask bits length. All other bits in the mask, up to the number needed to fill the length of the address diffServSixTupleClfrSrcAddr are cleared to zero. A zero bit in the mask then means that the corresponding bit in the address always matches.')
diff_serv_six_tuple_clfr_dscp = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 8), dscp().clone(-1)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrDscp.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrDscp.setDescription('The value that the DSCP in the packet must have to match this entry. A value of -1 indicates that a specific DSCP value has not been defined and thus all DSCP values are considered a match.')
diff_serv_six_tuple_clfr_protocol = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrProtocol.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrProtocol.setDescription('The IP protocol to match against the IPv4 protocol number in the packet. A value of zero means match all.')
diff_serv_six_tuple_clfr_dst_l4_port_min = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 10), six_tuple_clfr_l4_port()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrDstL4PortMin.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrDstL4PortMin.setDescription('The minimum value that the layer-4 destination port number in the packet must have in order to match this classifier entry.')
diff_serv_six_tuple_clfr_dst_l4_port_max = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 11), six_tuple_clfr_l4_port().clone(65535)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrDstL4PortMax.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrDstL4PortMax.setDescription('The maximum value that the layer-4 destination port number in the packet must have in order to match this classifier entry. This value must be equal to or greater that the value specified for this entry in diffServSixTupleClfrDstL4PortMin.')
diff_serv_six_tuple_clfr_src_l4_port_min = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 12), six_tuple_clfr_l4_port()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrSrcL4PortMin.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrSrcL4PortMin.setDescription('The minimum value that the layer-4 source port number in the packet must have in order to match this classifier entry.')
diff_serv_six_tuple_clfr_src_l4_port_max = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 13), six_tuple_clfr_l4_port().clone(65535)).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrSrcL4PortMax.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrSrcL4PortMax.setDescription('The maximum value that the layer-4 source port number in the packet must have in oder to match this classifier entry. This value must be equal to or greater that the value specified for this entry in dsSixTupleIpSrcL4PortMin.')
diff_serv_six_tuple_clfr_status = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 2, 1, 14), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSixTupleClfrStatus.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of a classifier. Any writable variable may be modified whether the row is active or notInService.')
diff_serv_six_tuple_clfr_next_free = mib_scalar((1, 3, 6, 1, 2, 1, 12345, 1, 2), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServSixTupleClfrNextFree.setStatus('current')
if mibBuilder.loadTexts:
diffServSixTupleClfrNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServSixTupleClfrId instance. If a configuring system attempts to create a new row in the diffServSixTupleClfrTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diff_serv_meter_table = mib_table((1, 3, 6, 1, 2, 1, 12345, 2, 3))
if mibBuilder.loadTexts:
diffServMeterTable.setReference('[MODEL] section 5.1')
if mibBuilder.loadTexts:
diffServMeterTable.setStatus('current')
if mibBuilder.loadTexts:
diffServMeterTable.setDescription('This table enumerates generic meters that a system may use to police a stream of traffic. The traffic stream to be metered is determined by the element(s) upstream of the meter i.e. by the object(s) that point to each entry in this table. This may include all traffic on an interface. Specific meter details are to be found in diffServMeterSpecific.')
diff_serv_meter_entry = mib_table_row((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'DIFF-SERV-MIB', 'diffServMeterIfDirection'), (0, 'DIFF-SERV-MIB', 'diffServMeterId'))
if mibBuilder.loadTexts:
diffServMeterEntry.setStatus('current')
if mibBuilder.loadTexts:
diffServMeterEntry.setDescription('An entry in the meter table describing a single meter.')
diff_serv_meter_if_direction = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1, 1), if_direction())
if mibBuilder.loadTexts:
diffServMeterIfDirection.setStatus('current')
if mibBuilder.loadTexts:
diffServMeterIfDirection.setDescription('Specifies the direction for which this meter entry applies on this interface.')
diff_serv_meter_id = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1, 2), unsigned32())
if mibBuilder.loadTexts:
diffServMeterId.setStatus('current')
if mibBuilder.loadTexts:
diffServMeterId.setDescription('This identifies a meter entry. Managers should obtain new values for row creation in this table by reading diffServMeterNextFree.')
diff_serv_meter_succeed_next = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1, 3), row_pointer().clone((0, 0))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServMeterSucceedNext.setStatus('current')
if mibBuilder.loadTexts:
diffServMeterSucceedNext.setDescription('If the traffic does conform to the meter, this indicates the next datapath element to handle the traffic e.g. an Action or another Meter datapath element. The value zeroDotZero in this variable indicates no further Diffserv treatment is performed on this traffic by the current interface for this interface direction. If the row pointed to does not exist, the meter element is considered inactive.')
diff_serv_meter_fail_next = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1, 4), row_pointer().clone((0, 0))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServMeterFailNext.setStatus('current')
if mibBuilder.loadTexts:
diffServMeterFailNext.setDescription('If the traffic does not conform to the meter, this indicates the next datapath element to handle the traffic e.g. an Action or Meter datapath element. The value zeroDotZero in this variable indicates no further Diffserv treatment is performed on this traffic by the current interface for this interface direction. If the row pointed to does not exist, the meter element is considered inactive.')
diff_serv_meter_specific = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1, 5), object_identifier()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServMeterSpecific.setStatus('current')
if mibBuilder.loadTexts:
diffServMeterSpecific.setDescription('This indicates the behaviour of the meter by pointing to a table containing detailed parameters. Note that entries in that specific table must be managed explicitly. One example of a valid object would be diffServTBMeterTable, whose entries are indexed by the same variables as this table, for describing an instance of a token-bucket meter.')
diff_serv_meter_status = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 3, 1, 6), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServMeterStatus.setStatus('current')
if mibBuilder.loadTexts:
diffServMeterStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of a meter. Any writable variable may be modified whether the row is active or notInService.')
diff_serv_meter_next_free = mib_scalar((1, 3, 6, 1, 2, 1, 12345, 1, 3), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServMeterNextFree.setStatus('current')
if mibBuilder.loadTexts:
diffServMeterNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServMeterId instance. If a configuring system attempts to create a new row in the diffServMeterTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diff_serv_tb_meter_table = mib_table((1, 3, 6, 1, 2, 1, 12345, 2, 4))
if mibBuilder.loadTexts:
diffServTBMeterTable.setReference('[MODEL] section 5.1.3')
if mibBuilder.loadTexts:
diffServTBMeterTable.setStatus('current')
if mibBuilder.loadTexts:
diffServTBMeterTable.setDescription('This table enumerates specific token-bucket meters that a system may use to police a stream of traffic. Such meters are modelled here as having a single rate and a burst size. Multiple meter elements may be logically cascaded using their diffServMeterSucceedNext pointers if a multi-rate token bucket is needed. One example of this might be for an AF PHB implementation that used two-rate meters. Such cascading of meter elements of specific type of token-bucket indicates forwarding behaviour that is functionally equivalent to a multi- rate meter: the sequential nature of the representation is merely a notational convenience for this MIB. Entries in this table share indexing with a parent diffServMeterEntry although they must be managed (e.g. created/deleted) by explicit management action, independently of the associated value of diffServMeterSpecific.')
diff_serv_tb_meter_entry = mib_table_row((1, 3, 6, 1, 2, 1, 12345, 2, 4, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'DIFF-SERV-MIB', 'diffServMeterIfDirection'), (0, 'DIFF-SERV-MIB', 'diffServMeterId'))
if mibBuilder.loadTexts:
diffServTBMeterEntry.setStatus('current')
if mibBuilder.loadTexts:
diffServTBMeterEntry.setDescription('An entry that describes a single token-bucket meter, indexed by the same variables as a diffServMeterEntry.')
diff_serv_tb_meter_rate = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 4, 1, 1), unsigned32()).setUnits('kilobits per second').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServTBMeterRate.setStatus('current')
if mibBuilder.loadTexts:
diffServTBMeterRate.setDescription('The token-bucket rate, in kilobits per second (kbps).')
diff_serv_tb_meter_burst_size = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 4, 1, 2), burst_size()).setUnits('Bytes').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServTBMeterBurstSize.setStatus('current')
if mibBuilder.loadTexts:
diffServTBMeterBurstSize.setDescription('The maximum number of bytes in a single transmission burst. The interval over which the burst is to be measured can be derived as diffServTBMeterBurstSize*8*1000/diffServTBMeterRate.')
diff_serv_tb_meter_status = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 4, 1, 3), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServTBMeterStatus.setStatus('current')
if mibBuilder.loadTexts:
diffServTBMeterStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of a meter. Any writable variable may be modified whether the row is active or notInService.')
diff_serv_action_table = mib_table((1, 3, 6, 1, 2, 1, 12345, 2, 5))
if mibBuilder.loadTexts:
diffServActionTable.setReference('[MODEL] section 6.')
if mibBuilder.loadTexts:
diffServActionTable.setStatus('current')
if mibBuilder.loadTexts:
diffServActionTable.setDescription('The Action Table enumerates actions that can be performed to a stream of traffic. Multiple actions can be concatenated. For example, after marking a stream of traffic exiting from a meter, a device can then perform a count action of the conforming or non-conforming traffic. Specific actions are indicated by diffServActionSpecific which points to another object which describes the action in further detail.')
diff_serv_action_entry = mib_table_row((1, 3, 6, 1, 2, 1, 12345, 2, 5, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'DIFF-SERV-MIB', 'diffServActionIfDirection'), (0, 'DIFF-SERV-MIB', 'diffServActionId'))
if mibBuilder.loadTexts:
diffServActionEntry.setStatus('current')
if mibBuilder.loadTexts:
diffServActionEntry.setDescription('An entry in the action table describing the actions applied to traffic arriving at its input.')
diff_serv_action_if_direction = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 5, 1, 1), if_direction())
if mibBuilder.loadTexts:
diffServActionIfDirection.setStatus('current')
if mibBuilder.loadTexts:
diffServActionIfDirection.setDescription('Specifies the direction for which this action entry applies on this interface.')
diff_serv_action_id = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 5, 1, 2), unsigned32())
if mibBuilder.loadTexts:
diffServActionId.setStatus('current')
if mibBuilder.loadTexts:
diffServActionId.setDescription('This identifies the action entry. Managers should obtain new values for row creation in this table by reading diffServActionNextFree.')
diff_serv_action_next = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 5, 1, 3), row_pointer().clone((0, 0))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServActionNext.setStatus('current')
if mibBuilder.loadTexts:
diffServActionNext.setDescription('The Next pointer indicates the next datapath element to handle the traffic. For example, a queue datapath element. The value zeroDotZero in this variable indicates no further DiffServ treatment is performed on this flow by the current interface for this interface direction. If the row pointed to does not exist, the action element is considered inactive.')
diff_serv_action_specific = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 5, 1, 4), object_identifier()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServActionSpecific.setStatus('current')
if mibBuilder.loadTexts:
diffServActionSpecific.setDescription('A pointer to an object instance providing additional information for the type of action indicated by this action table entry. For the standard actions defined by this MIB module, this should point to one of the following: a diffServDscpMarkActEntry, a diffServCountActEntry, the diffServAbsoluteDropAction OID. For other actions, it may point to an object instance defined in some other MIB.')
diff_serv_action_status = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 5, 1, 5), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServActionStatus.setStatus('current')
if mibBuilder.loadTexts:
diffServActionStatus.setDescription('The RowStatus variable controls the activation, deactivation or deletion of an action element. Any writable variable may be modified whether the row is active or notInService.')
diff_serv_action_next_free = mib_scalar((1, 3, 6, 1, 2, 1, 12345, 1, 4), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServActionNextFree.setStatus('current')
if mibBuilder.loadTexts:
diffServActionNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServActionId instance. If a configuring system attempts to create a new row in the diffServActionTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diff_serv_dscp_mark_act_table = mib_table((1, 3, 6, 1, 2, 1, 12345, 2, 6))
if mibBuilder.loadTexts:
diffServDscpMarkActTable.setReference('[MODEL] section 6.1')
if mibBuilder.loadTexts:
diffServDscpMarkActTable.setStatus('current')
if mibBuilder.loadTexts:
diffServDscpMarkActTable.setDescription('This table enumerates specific DSCPs used for marking or remarking the DSCP field of IP packets. The entries of this table may be referenced by a diffServActionSpecific attribute that points to diffServDscpMarkActTable.')
diff_serv_dscp_mark_act_entry = mib_table_row((1, 3, 6, 1, 2, 1, 12345, 2, 6, 1)).setIndexNames((0, 'DIFF-SERV-MIB', 'diffServDscpMarkActDscp'))
if mibBuilder.loadTexts:
diffServDscpMarkActEntry.setStatus('current')
if mibBuilder.loadTexts:
diffServDscpMarkActEntry.setDescription('An entry in the DSCP mark action table that describes a single DSCP used for marking.')
diff_serv_dscp_mark_act_dscp = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 6, 1, 1), dscp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServDscpMarkActDscp.setStatus('current')
if mibBuilder.loadTexts:
diffServDscpMarkActDscp.setDescription('The DSCP that this Action uses for marking/remarking traffic. Note that a DSCP value of -1 is not permitted in this table. It is quite possible that the only packets subject to this Action are already marked with this DSCP. Note also that Diffserv may result in packet remarking both on ingress to a network and on egress from it and it is quite possible that ingress and egress would occur in the same router.')
diff_serv_count_act_table = mib_table((1, 3, 6, 1, 2, 1, 12345, 2, 7))
if mibBuilder.loadTexts:
diffServCountActTable.setReference('[MODEL] section 6.5')
if mibBuilder.loadTexts:
diffServCountActTable.setStatus('current')
if mibBuilder.loadTexts:
diffServCountActTable.setDescription('This table contains counters for all the traffic passing through an action element.')
diff_serv_count_act_entry = mib_table_row((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'DIFF-SERV-MIB', 'diffServActionIfDirection'), (0, 'DIFF-SERV-MIB', 'diffServActionId'))
if mibBuilder.loadTexts:
diffServCountActEntry.setStatus('current')
if mibBuilder.loadTexts:
diffServCountActEntry.setDescription('An entry in the count action table that describes a single set of traffic counters. Entries in this table share indexing with those in the base diffServActionTable although they must be managed (e.g. created/deleted) by explicit management action, independently of the associated value of diffServActionSpecific.')
diff_serv_count_act_octets = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1, 1), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServCountActOctets.setStatus('current')
if mibBuilder.loadTexts:
diffServCountActOctets.setDescription('The number of octets at the Action datapath element. On high speed devices, this object implements the least significant 32 bits of diffServcountActHCOctets. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of diffServCountActDiscontTime for this entry.')
diff_serv_count_act_hc_octets = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1, 2), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServCountActHCOctets.setStatus('current')
if mibBuilder.loadTexts:
diffServCountActHCOctets.setDescription('The number of octets at the Action datapath element. This object should be used on high speed interfaces. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of diffServCountActDiscontTime for this entry.')
diff_serv_count_act_pkts = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1, 3), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServCountActPkts.setStatus('current')
if mibBuilder.loadTexts:
diffServCountActPkts.setDescription('The number of packets at the Action datapath element. On high speed devices, this object implements the least significant 32 bits of diffServcountActHCPkts. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of diffServCountActDiscontTime for this entry.')
diff_serv_count_act_hc_pkts = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1, 4), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServCountActHCPkts.setStatus('current')
if mibBuilder.loadTexts:
diffServCountActHCPkts.setDescription('The number of packets at the Action datapath element. This object should be used on high speed interfaces. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of diffServCountActDiscontTime for this entry.')
diff_serv_count_act_discont_time = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1, 5), time_stamp()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServCountActDiscontTime.setStatus('current')
if mibBuilder.loadTexts:
diffServCountActDiscontTime.setDescription("The value of sysUpTime on the most recent occasion at which any one or more of this entry's counters suffered a discontinuity. If no such discontinuities have occurred since the last re- initialization of the local management subsystem, then this object contains a zero value.")
diff_serv_count_act_status = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 7, 1, 6), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServCountActStatus.setStatus('current')
if mibBuilder.loadTexts:
diffServCountActStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of this entry. Any writable variable may be modified whether the row is active or notInService.')
diff_serv_absolute_drop_action = object_identity((1, 3, 6, 1, 2, 1, 12345, 1, 6))
if mibBuilder.loadTexts:
diffServAbsoluteDropAction.setStatus('current')
if mibBuilder.loadTexts:
diffServAbsoluteDropAction.setDescription('This object identifier may be used as the value of a diffServActionSpecific pointer in order to indicate that all packets following this path are to be dropped unconditionally at this point. It is likely, but not required, that this action will be preceded by a counter action.')
diff_serv_alg_drop_table = mib_table((1, 3, 6, 1, 2, 1, 12345, 2, 8))
if mibBuilder.loadTexts:
diffServAlgDropTable.setReference('[MODEL] section 7.1.3')
if mibBuilder.loadTexts:
diffServAlgDropTable.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropTable.setDescription('The algorithmic drop table contains entries describing an element that drops packets according to some algorithm.')
diff_serv_alg_drop_entry = mib_table_row((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'DIFF-SERV-MIB', 'diffServAlgDropIfDirection'), (0, 'DIFF-SERV-MIB', 'diffServAlgDropId'))
if mibBuilder.loadTexts:
diffServAlgDropEntry.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropEntry.setDescription('An entry describes a process that drops packets according to some algorithm. Further details of the algorithm type are to be found in diffServAlgDropType and may be pointed to by diffServAlgDropSpecific.')
diff_serv_alg_drop_if_direction = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 1), if_direction())
if mibBuilder.loadTexts:
diffServAlgDropIfDirection.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropIfDirection.setDescription('Specifies the direction for which this algorithmic dropper entry applies on this interface.')
diff_serv_alg_drop_id = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 2), unsigned32())
if mibBuilder.loadTexts:
diffServAlgDropId.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropId.setDescription('This identifies the drop action entry. Managers should obtain new values for row creation in this table by reading diffServAlgDropNextFree.')
diff_serv_alg_drop_type = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('other', 1), ('tailDrop', 2), ('headDrop', 3), ('randomDrop', 4)))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServAlgDropType.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropType.setDescription('The type of algorithm used by this dropper. A value of tailDrop(2) or headDrop(3) represents an algorithm that is completely specified by this MIB. A value of other(1) requires further specification in some other MIB module. The tailDrop(2) algorithm is described as follows: diffServAlgDropQThreshold represents the depth of the queue diffServAlgDropQMeasure at which all newly arriving packets will be dropped. The headDrop(3) algorithm is described as follows: if a packet arrives when the current depth of the queue diffServAlgDropQMeasure is at diffServAlgDropQThreshold, packets currently at the head of the queue are dropped to make room for the new packet to be enqueued at the tail of the queue. The randomDrop(4) algorithm is described as follows: on packet arrival, an algorithm is executed which may randomly drop the packet, or drop other packet(s) from the queue in its place. The specifics of the algorithm may be proprietary. For this algorithm, an associated diffServRandomDropEntry is indicated by pointing diffServAlgDropSpecific at the diffServRandomDropTable. The relevant entry in that table is selected by the common indexing of the two tables. For this algorithm, diffServAlgQThreshold is understood to be the absolute maximum size of the queue and additional parameters are described in diffServRandomDropTable.')
diff_serv_alg_drop_next = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 4), row_pointer()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServAlgDropNext.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropNext.setDescription('The Next pointer indicates the next datapath element to handle the traffic e.g. a queue datapath element. The value zeroDotZero in this variable indicates no further DiffServ treatment is performed on this flow by the current interface for this interface direction. If the row pointed to does not exist, the algorithmic dropper element is considered inactive.')
diff_serv_alg_drop_q_measure = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 5), row_pointer()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServAlgDropQMeasure.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropQMeasure.setDescription('Points to an entry in the diffServQueueTable to indicate the queue that a drop algorithm is to monitor when deciding whether to drop a packet. If the row pointed to does not exist, the algorithmic dropper element is considered inactive.')
diff_serv_alg_drop_q_threshold = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 6), unsigned32()).setUnits('Bytes').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServAlgDropQThreshold.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropQThreshold.setDescription('A threshold on the depth in bytes of the queue being measured at which a trigger is generated to the dropping algorithm. For the tailDrop(2) or headDrop(3) algorithms, this represents the depth of the queue diffServAlgDropQMeasure at which the drop action will take place. Other algorithms will need to define their own semantics for this threshold.')
diff_serv_alg_drop_specific = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 7), object_identifier()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServAlgDropSpecific.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropSpecific.setDescription('Points to a table (not an entry in the table) defined elsewhere that provides further detail regarding a drop algorithm. Entries in such a table are indexed by the same variables as this diffServAlgDropEntry but note that those entries must be managed independently of those in this table. Entries with diffServAlgDropType equal to other(1) may have this point to a table defined in another MIB module. Entries with diffServAlgDropType equal to randomDrop(4) must have this point to diffServRandomDropTable. For all other algorithms, this should take the value zeroDotzero.')
diff_serv_alg_drop_octets = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 8), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServAlgDropOctets.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropOctets.setDescription('The number of octets that have been dropped by this drop process. On high speed devices, this object implements the least significant 32 bits of diffServAlgDropHCOctets. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of ifCounterDiscontinuityTime appropriate to this interface.')
diff_serv_alg_drop_hc_octets = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 9), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServAlgDropHCOctets.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropHCOctets.setDescription('The number of octets that have been dropped by this drop process. This object should be used on high speed interfaces. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of ifCounterDiscontinuityTime appropriate to this interface.')
diff_serv_alg_drop_pkts = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 10), counter32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServAlgDropPkts.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropPkts.setDescription('The number of packets that have been dropped by this drop process. On high speed devices, this object implements the least significant 32 bits of diffServAlgDropHCPkts. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of ifCounterDiscontinuityTime appropriate to this interface.')
diff_serv_alg_drop_hc_pkts = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 11), counter64()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServAlgDropHCPkts.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropHCPkts.setDescription('The number of packets that have been dropped by this drop process. This object should be used on high speed interfaces. Discontinuities in the value of this counter can occur at re- initialization of the management system and at other times as indicated by the value of ifCounterDiscontinuityTime appropriate to this interface.')
diff_serv_alg_drop_status = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 8, 1, 12), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServAlgDropStatus.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of this entry. Any writable variable may be modified whether the row is active or notInService.')
diff_serv_alg_drop_next_free = mib_scalar((1, 3, 6, 1, 2, 1, 12345, 1, 7), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServAlgDropNextFree.setStatus('current')
if mibBuilder.loadTexts:
diffServAlgDropNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServAlgDropId instance. If a configuring system attempts to create a new row in the diffServAlgDropTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diff_serv_random_drop_table = mib_table((1, 3, 6, 1, 2, 1, 12345, 2, 9))
if mibBuilder.loadTexts:
diffServRandomDropTable.setReference('[MODEL] section 7.1.3')
if mibBuilder.loadTexts:
diffServRandomDropTable.setStatus('current')
if mibBuilder.loadTexts:
diffServRandomDropTable.setDescription('The random drop table augments the algorithmic drop table. It contains entries describing a process that drops packets randomly. This table is intended to be pointed to by the associated diffServAlgDropSpecific in such cases.')
diff_serv_random_drop_entry = mib_table_row((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'DIFF-SERV-MIB', 'diffServAlgDropIfDirection'), (0, 'DIFF-SERV-MIB', 'diffServAlgDropId'))
if mibBuilder.loadTexts:
diffServRandomDropEntry.setStatus('current')
if mibBuilder.loadTexts:
diffServRandomDropEntry.setDescription('An entry describes a process that drops packets according to a random algorithm. Entries in this table share indexing with a parent diffServAlgDropEntry although they must be managed (e.g. created/deleted) by explicit management action, independently of the associated value of diffServAlgDropSpecific.')
diff_serv_random_drop_min_thresh_bytes = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 1), unsigned32()).setUnits('bytes').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServRandomDropMinThreshBytes.setStatus('current')
if mibBuilder.loadTexts:
diffServRandomDropMinThreshBytes.setDescription('The average queue depth in bytes, beyond which traffic has a non-zero probability of being dropped. Changes in this variable may or may not be reflected in the reported value of diffServRandomDropMinThreshPkts.')
diff_serv_random_drop_min_thresh_pkts = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 2), unsigned32()).setUnits('packets').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServRandomDropMinThreshPkts.setStatus('current')
if mibBuilder.loadTexts:
diffServRandomDropMinThreshPkts.setDescription('The average queue depth in packets, beyond which traffic has a non-zero probability of being dropped. Changes in this variable may or may not be reflected in the reported value of diffServRandomDropMinThreshBytes.')
diff_serv_random_drop_max_thresh_bytes = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 3), unsigned32()).setUnits('bytes').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServRandomDropMaxThreshBytes.setStatus('current')
if mibBuilder.loadTexts:
diffServRandomDropMaxThreshBytes.setDescription('The average queue depth beyond which traffic has a probability indicated by diffServRandomDropInvMaxProb of being dropped or marked. Note that this differs from the physical queue limit, which is stored in diffServAlgDropQThreshold. Changes in this variable may or may not be reflected in the reported value of diffServRandomDropMaxThreshPkts.')
diff_serv_random_drop_max_thresh_pkts = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 4), unsigned32()).setUnits('packets').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServRandomDropMaxThreshPkts.setStatus('current')
if mibBuilder.loadTexts:
diffServRandomDropMaxThreshPkts.setDescription('The average queue depth beyond which traffic has a probability indicated by diffServRandomDropInvMaxProb of being dropped or marked. Note that this differs from the physical queue limit, which is stored in diffServAlgDropQThreshold. Changes in this variable may or may not be reflected in the reported value of diffServRandomDropMaxThreshBytes.')
diff_serv_random_drop_inv_weight = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 5), unsigned32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServRandomDropInvWeight.setStatus('current')
if mibBuilder.loadTexts:
diffServRandomDropInvWeight.setDescription('The weighting of past history in affecting the calculation of the current queue average. The moving average of the queue depth uses the inverse of this value as the factor for the new queue depth, and one minus that inverse as the factor for the historical average. Implementations may choose to limit the acceptable set of values to a specified set, such as powers of 2.')
diff_serv_random_drop_prob_max = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 6), unsigned32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServRandomDropProbMax.setStatus('current')
if mibBuilder.loadTexts:
diffServRandomDropProbMax.setDescription('The worst case random drop probability, expressed in drops per thousand packets. For example, if every packet may be dropped in the worst case (100%), this has the value 1000. Alternatively, if in the worst case one percent (1%) of traffic may be dropped, it has the value 10.')
diff_serv_random_drop_status = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 9, 1, 7), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServRandomDropStatus.setStatus('current')
if mibBuilder.loadTexts:
diffServRandomDropStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of this entry. Any writable variable may be modified whether the row is active or notInService.')
diff_serv_q_table = mib_table((1, 3, 6, 1, 2, 1, 12345, 2, 10))
if mibBuilder.loadTexts:
diffServQTable.setStatus('current')
if mibBuilder.loadTexts:
diffServQTable.setDescription('The Queue Table enumerates the individual queues on an interface.')
diff_serv_q_entry = mib_table_row((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'DIFF-SERV-MIB', 'diffServQIfDirection'), (0, 'DIFF-SERV-MIB', 'diffServQId'))
if mibBuilder.loadTexts:
diffServQEntry.setStatus('current')
if mibBuilder.loadTexts:
diffServQEntry.setDescription('An entry in the Queue Table describes a single queue in one direction on an interface.')
diff_serv_q_if_direction = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 1), if_direction())
if mibBuilder.loadTexts:
diffServQIfDirection.setStatus('current')
if mibBuilder.loadTexts:
diffServQIfDirection.setDescription('Specifies the direction for which this queue entry applies on this interface.')
diff_serv_q_id = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 2), unsigned32())
if mibBuilder.loadTexts:
diffServQId.setStatus('current')
if mibBuilder.loadTexts:
diffServQId.setDescription('The Queue Id enumerates the Queue entry. Managers should obtain new values for row creation in this table by reading diffServQNextFree.')
diff_serv_q_next = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 3), row_pointer()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServQNext.setStatus('current')
if mibBuilder.loadTexts:
diffServQNext.setDescription('The Next pointer indicates the next datapath element to handle the traffic e.g. a scheduler datapath element. If the row pointed to does not exist, the queue element is considered inactive.')
diff_serv_q_priority = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 4), unsigned32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServQPriority.setStatus('current')
if mibBuilder.loadTexts:
diffServQPriority.setDescription('The priority of this queue, to be used as a parameter to the next scheduler element downstream from this one.')
diff_serv_q_min_rate_abs = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 5), unsigned32()).setUnits('kilobits per second').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServQMinRateAbs.setReference('ifSpeed, ifHighSpeed from [IFMIB]')
if mibBuilder.loadTexts:
diffServQMinRateAbs.setStatus('current')
if mibBuilder.loadTexts:
diffServQMinRateAbs.setDescription("The minimum absolute rate, in kilobits/sec, that a downstream scheduler element should allocate to this queue. If the value is zero, then there is effectively no minimum rate guarantee. If the value is non-zero, the scheduler will assure the servicing of this queue to at least this rate. Note that this attribute's value is coupled to that of diffServQMinRateRel: changes to one will affect the value of the other. They are linked by the following equation: diffServQMinRateRel = diffServQMinRateAbs * 10,000,000/ifSpeed or, if appropriate: diffServQMinRateRel = diffServQMinRateAbs * 10 / ifHighSpeed")
diff_serv_q_min_rate_rel = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 6), unsigned32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServQMinRateRel.setReference('ifSpeed, ifHighSpeed from [IFMIB]')
if mibBuilder.loadTexts:
diffServQMinRateRel.setStatus('current')
if mibBuilder.loadTexts:
diffServQMinRateRel.setDescription("The minimum rate that a downstream scheduler element should allocate to this queue, relative to the maximum rate of the interface as reported by ifSpeed or ifHighSpeed, in units of 1/10,000 of 1. If the value is zero, then there is effectively no minimum rate guarantee. If the value is non-zero, the scheduler will assure the servicing of this queue to at least this rate. Note that this attribute's value is coupled to that of diffServQMinRateAbs: changes to one will affect the value of the other. They are linked by the following equation: diffServQMinRateAbs = ifSpeed * diffServQMinRateRel/10,000,000 or, if appropriate: diffServQMinRateAbs = ifHighSpeed * diffServQMinRateRel / 10")
diff_serv_q_max_rate_abs = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 7), unsigned32()).setUnits('kilobits per second').setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServQMaxRateAbs.setReference('ifSpeed, ifHighSpeed from [IFMIB]')
if mibBuilder.loadTexts:
diffServQMaxRateAbs.setStatus('current')
if mibBuilder.loadTexts:
diffServQMaxRateAbs.setDescription("The maximum rate in kilobits/sec that a downstream scheduler element should allocate to this queue. If the value is zero, then there is effectively no maximum rate limit and that the scheduler should attempt to be work-conserving for this queue. If the value is non-zero, the scheduler will limit the servicing of this queue to, at most, this rate in a non-work-conserving manner. Note that this attribute's value is coupled to that of diffServQMaxRateRel: changes to one will affect the value of the other. They are linked by the following equation: diffServQMaxRateRel = diffServQMaxRateAbs * 10,000,000/ifSpeed or, if appropriate: diffServQMaxRateRel = diffServQMaxRateAbs * 10 / ifHighSpeed")
diff_serv_q_max_rate_rel = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 8), unsigned32()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServQMaxRateRel.setReference('ifSpeed, ifHighSpeed from [IFMIB]')
if mibBuilder.loadTexts:
diffServQMaxRateRel.setStatus('current')
if mibBuilder.loadTexts:
diffServQMaxRateRel.setDescription("The maximum rate that a downstream scheduler element should allocate to this queue, relative to the maximum rate of the interface as reported by ifSpeed or ifHighSpeed, in units of 1/10,000 of 1. If the value is zero, then there is effectively no maximum rate limit and the scheduler should attempt to be work-conserving for this queue. If the value is non-zero, the scheduler will limit the servicing of this queue to, at most, this rate in a non-work-conserving manner. Note that this attribute's value is coupled to that of diffServQMaxRateAbs: changes to one will affect the value of the other. They are linked by the following equation: diffServQMaxRateAbs = ifSpeed * diffServQMaxRateRel/10,000,000 or, if appropriate: diffServQMaxRateAbs = ifHighSpeed * diffServQMaxRateRel / 10")
diff_serv_q_status = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 10, 1, 9), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServQStatus.setStatus('current')
if mibBuilder.loadTexts:
diffServQStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of a queue. Any writable variable may be modified whether the row is active or notInService.')
diff_serv_q_next_free = mib_scalar((1, 3, 6, 1, 2, 1, 12345, 1, 8), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServQNextFree.setStatus('current')
if mibBuilder.loadTexts:
diffServQNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServQId instance. If a configuring system attempts to create a new row in the diffServQTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diff_serv_scheduler_table = mib_table((1, 3, 6, 1, 2, 1, 12345, 2, 11))
if mibBuilder.loadTexts:
diffServSchedulerTable.setReference('[MODEL] section 7.1.2')
if mibBuilder.loadTexts:
diffServSchedulerTable.setStatus('current')
if mibBuilder.loadTexts:
diffServSchedulerTable.setDescription('The Scheduler Table enumerates packet schedulers. Multiple scheduling algorithms can be used on a given interface, with each algorithm described by one diffServSchedulerEntry.')
diff_serv_scheduler_entry = mib_table_row((1, 3, 6, 1, 2, 1, 12345, 2, 11, 1)).setIndexNames((0, 'IF-MIB', 'ifIndex'), (0, 'DIFF-SERV-MIB', 'diffServSchedulerIfDirection'), (0, 'DIFF-SERV-MIB', 'diffServSchedulerId'))
if mibBuilder.loadTexts:
diffServSchedulerEntry.setStatus('current')
if mibBuilder.loadTexts:
diffServSchedulerEntry.setDescription('An entry in the Scheduler Table describing a single instance of a scheduling algorithm.')
diff_serv_scheduler_if_direction = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 11, 1, 1), if_direction())
if mibBuilder.loadTexts:
diffServSchedulerIfDirection.setStatus('current')
if mibBuilder.loadTexts:
diffServSchedulerIfDirection.setDescription('Specifies the direction for which this scheduler entry applies on this interface.')
diff_serv_scheduler_id = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 11, 1, 2), unsigned32())
if mibBuilder.loadTexts:
diffServSchedulerId.setStatus('current')
if mibBuilder.loadTexts:
diffServSchedulerId.setDescription('This identifies the scheduler entry. Managers should obtain new values for row creation in this table by reading diffServSchedulerNextFree.')
diff_serv_scheduler_method = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 11, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('other', 1), ('priorityq', 2), ('wrr', 3)))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSchedulerMethod.setReference('[MODEL] section 7.1.2')
if mibBuilder.loadTexts:
diffServSchedulerMethod.setStatus('current')
if mibBuilder.loadTexts:
diffServSchedulerMethod.setDescription('The scheduling algorithm used by this Scheduler. A value of priorityq(2) is used to indicate strict priority queueing: only the diffServQPriority attributes of the queues feeding this scheduler are used when determining the next packet to schedule. A value of wrr(3) indicates weighted round-robin scheduling. Packets are scheduled from each of the queues feeding this scheduler according to all of the parameters of the diffServQueue entry.')
diff_serv_scheduler_next = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 11, 1, 4), row_pointer().clone((0, 0))).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSchedulerNext.setStatus('current')
if mibBuilder.loadTexts:
diffServSchedulerNext.setDescription('Selects the next data path component, which can be another scheduler or other TC elements. One usage of multiple scheduler elements in series is for Class Base Queueing (CBQ). The value zeroDotZero in this variable indicates no further DiffServ treatment is performed on this flow by the current interface for this interface direction. For example, for an inbound interface the value zeroDotZero indicates that the packet flow has now completed inbound DiffServ treatment and should be forwarded on to the appropriate outbound interface. If the row pointed to does not exist, the scheduler element is considered inactive.')
diff_serv_scheduler_status = mib_table_column((1, 3, 6, 1, 2, 1, 12345, 2, 11, 1, 5), row_status()).setMaxAccess('readcreate')
if mibBuilder.loadTexts:
diffServSchedulerStatus.setStatus('current')
if mibBuilder.loadTexts:
diffServSchedulerStatus.setDescription('The RowStatus variable controls the activation, deactivation, or deletion of a queue. Any writable variable may be modified whether the row is active or notInService.')
diff_serv_scheduler_next_free = mib_scalar((1, 3, 6, 1, 2, 1, 12345, 1, 9), unsigned32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
diffServSchedulerNextFree.setStatus('current')
if mibBuilder.loadTexts:
diffServSchedulerNextFree.setDescription('This object yields a value when read that is currently-unused for a diffServSchedulerId instance. If a configuring system attempts to create a new row in the diffServSchedulerTable using this value, that operation will fail if the value has, in the meantime, been used to create another row that is currently valid.')
diff_serv_mib_compliances = mib_identifier((1, 3, 6, 1, 2, 1, 12345, 3, 1))
diff_serv_mib_groups = mib_identifier((1, 3, 6, 1, 2, 1, 12345, 3, 2))
diff_serv_mib_compliance = module_compliance((1, 3, 6, 1, 2, 1, 12345, 3, 1, 1)).setObjects(('DIFF-SERV-MIB', 'diffServMIBClassifierGroup'), ('DIFF-SERV-MIB', 'diffServMIBSixTupleClfrGroup'), ('DIFF-SERV-MIB', 'diffServMIBActionGroup'), ('DIFF-SERV-MIB', 'diffServMIBAlgDropGroup'), ('DIFF-SERV-MIB', 'diffServMIBQueueGroup'), ('DIFF-SERV-MIB', 'diffServMIBSchedulerGroup'), ('DIFF-SERV-MIB', 'diffServMIBCounterGroup'), ('DIFF-SERV-MIB', 'diffServMIBHCCounterGroup'), ('DIFF-SERV-MIB', 'diffServMIBVHCCounterGroup'), ('DIFF-SERV-MIB', 'diffServMIBMeterGroup'), ('DIFF-SERV-MIB', 'diffServMIBTokenBucketMeterGroup'), ('DIFF-SERV-MIB', 'diffServMIBDscpMarkActionGroup'), ('DIFF-SERV-MIB', 'diffServMIBRandomDropGroup'), ('DIFF-SERV-MIB', 'diffServMIBStaticGroup'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_compliance = diffServMIBCompliance.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBCompliance.setDescription('This MIB may be implemented as a read-only or as a read-create MIB. As a result, it may be used for monitoring or for configuration.')
diff_serv_mib_classifier_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 1)).setObjects(('DIFF-SERV-MIB', 'diffServClassifierFilter'), ('DIFF-SERV-MIB', 'diffServClassifierNext'), ('DIFF-SERV-MIB', 'diffServClassifierPrecedence'), ('DIFF-SERV-MIB', 'diffServClassifierStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_classifier_group = diffServMIBClassifierGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBClassifierGroup.setDescription('The Classifier Group defines the MIB Objects that describe a generic classifier element.')
diff_serv_mib_six_tuple_clfr_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 2)).setObjects(('DIFF-SERV-MIB', 'diffServSixTupleClfrDstAddrType'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrDstAddr'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrDstAddrMask'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrDstAddrType'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrSrcAddrType'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrSrcAddrMask'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrDscp'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrProtocol'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrDstL4PortMin'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrDstL4PortMax'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrSrcL4PortMin'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrSrcL4PortMax'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_six_tuple_clfr_group = diffServMIBSixTupleClfrGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBSixTupleClfrGroup.setDescription('The Six-tuple Classifier Group defines the MIB Objects that describe a classifier element for matching on 6 fields of an IP and upper-layer protocol header.')
diff_serv_mib_meter_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 3)).setObjects(('DIFF-SERV-MIB', 'diffServMeterSucceedNext'), ('DIFF-SERV-MIB', 'diffServMeterFailNext'), ('DIFF-SERV-MIB', 'diffServMeterSpecific'), ('DIFF-SERV-MIB', 'diffServMeterStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_meter_group = diffServMIBMeterGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBMeterGroup.setDescription('The Meter Group defines the objects used in describing a generic meter element.')
diff_serv_mib_token_bucket_meter_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 4)).setObjects(('DIFF-SERV-MIB', 'diffServTBMeterRate'), ('DIFF-SERV-MIB', 'diffServTBMeterBurstSize'), ('DIFF-SERV-MIB', 'diffServTBMeterStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_token_bucket_meter_group = diffServMIBTokenBucketMeterGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBTokenBucketMeterGroup.setDescription('The Token-Bucket Meter Group defines the objects used in describing a single-rate token bucket meter element.')
diff_serv_mib_action_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 5)).setObjects(('DIFF-SERV-MIB', 'diffServActionNext'), ('DIFF-SERV-MIB', 'diffServActionSpecific'), ('DIFF-SERV-MIB', 'diffServActionStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_action_group = diffServMIBActionGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBActionGroup.setDescription('The Action Group defines the objects used in describing a generic action element.')
diff_serv_mib_dscp_mark_action_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 6)).setObjects(('DIFF-SERV-MIB', 'diffServDscpMarkActDscp'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_dscp_mark_action_group = diffServMIBDscpMarkActionGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBDscpMarkActionGroup.setDescription('The DSCP Mark Action Group defines the objects used in describing a DSCP Marking Action element.')
diff_serv_mib_counter_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 7)).setObjects(('DIFF-SERV-MIB', 'diffServCountActOctets'), ('DIFF-SERV-MIB', 'diffServCountActPkts'), ('DIFF-SERV-MIB', 'diffServCountActStatus'), ('DIFF-SERV-MIB', 'diffServAlgDropOctets'), ('DIFF-SERV-MIB', 'diffServAlgDropPkts'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_counter_group = diffServMIBCounterGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBCounterGroup.setDescription('A collection of objects providing information specific to non- high speed (non-high speed interfaces transmit and receive at speeds less than or equal to 20,000,000 bits/second) packet- oriented network interfaces.')
diff_serv_mibhc_counter_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 8)).setObjects(('DIFF-SERV-MIB', 'diffServCountActOctets'), ('DIFF-SERV-MIB', 'diffServCountActHCOctets'), ('DIFF-SERV-MIB', 'diffServCountActPkts'), ('DIFF-SERV-MIB', 'diffServCountActStatus'), ('DIFF-SERV-MIB', 'diffServAlgDropOctets'), ('DIFF-SERV-MIB', 'diffServAlgDropHCOctets'), ('DIFF-SERV-MIB', 'diffServAlgDropPkts'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mibhc_counter_group = diffServMIBHCCounterGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBHCCounterGroup.setDescription('A collection of objects providing information specific to non- high speed (non-high speed interfaces transmit and receive at speeds less than or equal to 20,000,000 bits/second) packet- oriented network interfaces.')
diff_serv_mibvhc_counter_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 9)).setObjects(('DIFF-SERV-MIB', 'diffServCountActOctets'), ('DIFF-SERV-MIB', 'diffServCountActHCOctets'), ('DIFF-SERV-MIB', 'diffServCountActPkts'), ('DIFF-SERV-MIB', 'diffServCountActHCPkts'), ('DIFF-SERV-MIB', 'diffServCountActStatus'), ('DIFF-SERV-MIB', 'diffServAlgDropOctets'), ('DIFF-SERV-MIB', 'diffServAlgDropHCOctets'), ('DIFF-SERV-MIB', 'diffServAlgDropPkts'), ('DIFF-SERV-MIB', 'diffServAlgDropHCPkts'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mibvhc_counter_group = diffServMIBVHCCounterGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBVHCCounterGroup.setDescription('A collection of objects providing information specific to non- high speed (non-high speed interfaces transmit and receive at speeds less than or equal to 20,000,000 bits/second) packet- oriented network interfaces.')
diff_serv_mib_alg_drop_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 10)).setObjects(('DIFF-SERV-MIB', 'diffServAlgDropType'), ('DIFF-SERV-MIB', 'diffServAlgDropNext'), ('DIFF-SERV-MIB', 'diffServAlgDropQMeasure'), ('DIFF-SERV-MIB', 'diffServAlgDropQThreshold'), ('DIFF-SERV-MIB', 'diffServAlgDropSpecific'), ('DIFF-SERV-MIB', 'diffServAlgDropStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_alg_drop_group = diffServMIBAlgDropGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBAlgDropGroup.setDescription('The Algorithmic Drop Group contains the objects that describe algorithmic dropper operation and configuration.')
diff_serv_mib_random_drop_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 11)).setObjects(('DIFF-SERV-MIB', 'diffServRandomDropMinThreshBytes'), ('DIFF-SERV-MIB', 'diffServRandomDropMinThreshPkts'), ('DIFF-SERV-MIB', 'diffServRandomDropMaxThreshBytes'), ('DIFF-SERV-MIB', 'diffServRandomDropMaxThreshPkts'), ('DIFF-SERV-MIB', 'diffServRandomDropInvWeight'), ('DIFF-SERV-MIB', 'diffServRandomDropProbMax'), ('DIFF-SERV-MIB', 'diffServRandomDropStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_random_drop_group = diffServMIBRandomDropGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBRandomDropGroup.setDescription('The Random Drop Group augments the Algorithmic Drop Group for random dropper operation and configuration.')
diff_serv_mib_queue_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 12)).setObjects(('DIFF-SERV-MIB', 'diffServQPriority'), ('DIFF-SERV-MIB', 'diffServQNext'), ('DIFF-SERV-MIB', 'diffServQMinRateAbs'), ('DIFF-SERV-MIB', 'diffServQMinRateRel'), ('DIFF-SERV-MIB', 'diffServQMaxRateAbs'), ('DIFF-SERV-MIB', 'diffServQMaxRateRel'), ('DIFF-SERV-MIB', 'diffServQStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_queue_group = diffServMIBQueueGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBQueueGroup.setDescription("The Queue Group contains the objects that describe an interface's queues.")
diff_serv_mib_scheduler_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 13)).setObjects(('DIFF-SERV-MIB', 'diffServSchedulerMethod'), ('DIFF-SERV-MIB', 'diffServSchedulerNext'), ('DIFF-SERV-MIB', 'diffServSchedulerStatus'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_scheduler_group = diffServMIBSchedulerGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBSchedulerGroup.setDescription('The Scheduler Group contains the objects that describe packet schedulers on interfaces.')
diff_serv_mib_static_group = object_group((1, 3, 6, 1, 2, 1, 12345, 3, 2, 14)).setObjects(('DIFF-SERV-MIB', 'diffServClassifierNextFree'), ('DIFF-SERV-MIB', 'diffServSixTupleClfrNextFree'), ('DIFF-SERV-MIB', 'diffServMeterNextFree'), ('DIFF-SERV-MIB', 'diffServActionNextFree'), ('DIFF-SERV-MIB', 'diffServAlgDropNextFree'), ('DIFF-SERV-MIB', 'diffServQNextFree'), ('DIFF-SERV-MIB', 'diffServSchedulerNextFree'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
diff_serv_mib_static_group = diffServMIBStaticGroup.setStatus('current')
if mibBuilder.loadTexts:
diffServMIBStaticGroup.setDescription('The Static Group contains readable scalar objects used in creating unique identifiers for classifiers, meters, actions and queues. These are required whenever row creation operations on such tables are supported.')
mibBuilder.exportSymbols('DIFF-SERV-MIB', diffServMeterId=diffServMeterId, diffServClassifierStatus=diffServClassifierStatus, diffServClassifierId=diffServClassifierId, diffServCountActHCPkts=diffServCountActHCPkts, diffServMeterSucceedNext=diffServMeterSucceedNext, diffServTBMeterStatus=diffServTBMeterStatus, diffServAlgDropQMeasure=diffServAlgDropQMeasure, diffServQMaxRateRel=diffServQMaxRateRel, diffServSixTupleClfrNextFree=diffServSixTupleClfrNextFree, diffServCountActPkts=diffServCountActPkts, diffServSixTupleClfrDstL4PortMin=diffServSixTupleClfrDstL4PortMin, diffServSixTupleClfrSrcAddrMask=diffServSixTupleClfrSrcAddrMask, diffServRandomDropMaxThreshPkts=diffServRandomDropMaxThreshPkts, diffServMIBHCCounterGroup=diffServMIBHCCounterGroup, diffServRandomDropMinThreshBytes=diffServRandomDropMinThreshBytes, diffServMIBSixTupleClfrGroup=diffServMIBSixTupleClfrGroup, diffServActionId=diffServActionId, diffServQNextFree=diffServQNextFree, diffServCountActHCOctets=diffServCountActHCOctets, diffServCountActOctets=diffServCountActOctets, diffServClassifierNextFree=diffServClassifierNextFree, diffServAlgDropId=diffServAlgDropId, diffServQPriority=diffServQPriority, diffServTBMeterRate=diffServTBMeterRate, diffServSixTupleClfrTable=diffServSixTupleClfrTable, PYSNMP_MODULE_ID=diffServMib, diffServCountActDiscontTime=diffServCountActDiscontTime, diffServQMaxRateAbs=diffServQMaxRateAbs, diffServSixTupleClfrDstAddr=diffServSixTupleClfrDstAddr, diffServSchedulerEntry=diffServSchedulerEntry, diffServDscpMarkActEntry=diffServDscpMarkActEntry, diffServRandomDropMaxThreshBytes=diffServRandomDropMaxThreshBytes, diffServSixTupleClfrDstAddrType=diffServSixTupleClfrDstAddrType, diffServSixTupleClfrEntry=diffServSixTupleClfrEntry, diffServSchedulerNextFree=diffServSchedulerNextFree, diffServMIBCounterGroup=diffServMIBCounterGroup, diffServSixTupleClfrDstL4PortMax=diffServSixTupleClfrDstL4PortMax, diffServAlgDropPkts=diffServAlgDropPkts, diffServMIBVHCCounterGroup=diffServMIBVHCCounterGroup, diffServSixTupleClfrSrcAddr=diffServSixTupleClfrSrcAddr, diffServMIBActionGroup=diffServMIBActionGroup, diffServAlgDropSpecific=diffServAlgDropSpecific, diffServQMinRateRel=diffServQMinRateRel, diffServMIBGroups=diffServMIBGroups, diffServSchedulerTable=diffServSchedulerTable, diffServObjects=diffServObjects, diffServSixTupleClfrSrcL4PortMax=diffServSixTupleClfrSrcL4PortMax, diffServAlgDropTable=diffServAlgDropTable, diffServClassifierEntry=diffServClassifierEntry, diffServClassifierFilter=diffServClassifierFilter, diffServRandomDropStatus=diffServRandomDropStatus, IfDirection=IfDirection, diffServAlgDropOctets=diffServAlgDropOctets, diffServActionTable=diffServActionTable, diffServAlgDropHCOctets=diffServAlgDropHCOctets, diffServSchedulerIfDirection=diffServSchedulerIfDirection, diffServRandomDropProbMax=diffServRandomDropProbMax, diffServMIBConformance=diffServMIBConformance, diffServMeterIfDirection=diffServMeterIfDirection, diffServRandomDropMinThreshPkts=diffServRandomDropMinThreshPkts, diffServActionIfDirection=diffServActionIfDirection, diffServQNext=diffServQNext, diffServCountActTable=diffServCountActTable, diffServRandomDropEntry=diffServRandomDropEntry, diffServMIBTokenBucketMeterGroup=diffServMIBTokenBucketMeterGroup, diffServTBMeterTable=diffServTBMeterTable, diffServMIBStaticGroup=diffServMIBStaticGroup, diffServAlgDropNext=diffServAlgDropNext, diffServSchedulerNext=diffServSchedulerNext, diffServMeterStatus=diffServMeterStatus, diffServQMinRateAbs=diffServQMinRateAbs, diffServSixTupleClfrSrcAddrType=diffServSixTupleClfrSrcAddrType, diffServMeterSpecific=diffServMeterSpecific, diffServMIBRandomDropGroup=diffServMIBRandomDropGroup, diffServAlgDropEntry=diffServAlgDropEntry, diffServSchedulerId=diffServSchedulerId, diffServTBMeterEntry=diffServTBMeterEntry, SixTupleClfrL4Port=SixTupleClfrL4Port, diffServClassifierNext=diffServClassifierNext, diffServSchedulerMethod=diffServSchedulerMethod, diffServDscpMarkActTable=diffServDscpMarkActTable, diffServMIBCompliance=diffServMIBCompliance, diffServAlgDropType=diffServAlgDropType, diffServAlgDropQThreshold=diffServAlgDropQThreshold, diffServCountActStatus=diffServCountActStatus, diffServQStatus=diffServQStatus, diffServClassifierIfDirection=diffServClassifierIfDirection, diffServSixTupleClfrDscp=diffServSixTupleClfrDscp, diffServClassifierTable=diffServClassifierTable, diffServSixTupleClfrDstAddrMask=diffServSixTupleClfrDstAddrMask, diffServAlgDropHCPkts=diffServAlgDropHCPkts, diffServMIBDscpMarkActionGroup=diffServMIBDscpMarkActionGroup, diffServSixTupleClfrStatus=diffServSixTupleClfrStatus, diffServMeterTable=diffServMeterTable, diffServActionNext=diffServActionNext, diffServMeterFailNext=diffServMeterFailNext, diffServActionNextFree=diffServActionNextFree, diffServActionStatus=diffServActionStatus, diffServCountActEntry=diffServCountActEntry, diffServRandomDropTable=diffServRandomDropTable, diffServSixTupleClfrSrcL4PortMin=diffServSixTupleClfrSrcL4PortMin, diffServMIBClassifierGroup=diffServMIBClassifierGroup, diffServMIBSchedulerGroup=diffServMIBSchedulerGroup, diffServClassifierPrecedence=diffServClassifierPrecedence, diffServRandomDropInvWeight=diffServRandomDropInvWeight, diffServMIBAlgDropGroup=diffServMIBAlgDropGroup, diffServSchedulerStatus=diffServSchedulerStatus, diffServQIfDirection=diffServQIfDirection, diffServMeterNextFree=diffServMeterNextFree, diffServAlgDropNextFree=diffServAlgDropNextFree, diffServDscpMarkActDscp=diffServDscpMarkActDscp, diffServTBMeterBurstSize=diffServTBMeterBurstSize, diffServQTable=diffServQTable, diffServClassifierTcb=diffServClassifierTcb, diffServTables=diffServTables, diffServMIBMeterGroup=diffServMIBMeterGroup, diffServAlgDropIfDirection=diffServAlgDropIfDirection, diffServQId=diffServQId, diffServMIBQueueGroup=diffServMIBQueueGroup, diffServMIBCompliances=diffServMIBCompliances, diffServAbsoluteDropAction=diffServAbsoluteDropAction, diffServMeterEntry=diffServMeterEntry, diffServActionSpecific=diffServActionSpecific, diffServAlgDropStatus=diffServAlgDropStatus, diffServQEntry=diffServQEntry, diffServSixTupleClfrProtocol=diffServSixTupleClfrProtocol, diffServMib=diffServMib, diffServActionEntry=diffServActionEntry, diffServSixTupleClfrId=diffServSixTupleClfrId, Dscp=Dscp) |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def hasPathSum(self, root: TreeNode, targetSum: int) -> bool:
# return true, if adding up values along path = targetSum
# go through each node, if it exists:
# subtract value to targetSum
# if value is < 0: return
if not root:
return False
targetSum -= root.val
# check leaf node
if not root.left and not root.right and targetSum == 0:
return True
return self.hasPathSum(root.left, targetSum) or self.hasPathSum(
root.right, targetSum
)
# if left is zero, return true.
# if right is zero return true
| class Solution:
def has_path_sum(self, root: TreeNode, targetSum: int) -> bool:
if not root:
return False
target_sum -= root.val
if not root.left and (not root.right) and (targetSum == 0):
return True
return self.hasPathSum(root.left, targetSum) or self.hasPathSum(root.right, targetSum) |
USERNAME = 'super.user.1'
PASSWORD = 'X!16a99a4e'
CONSUMER_KEY = 'f3haancaj0vm4lkx2erk3uwdzy2elz00of513u5w'
TOKEN = 'eyJhbGciOiJIUzI1NiJ9.eyIiOiIifQ.Qjz0-kry1Yb7PH0Pw1PbRWrgaqsFYPbac3RHQ-eykk4'
# API server URL
BASE_URL = "https://openlab.openbankproject.com"
API_VERSION = "v3.0.0"
CONTENT_JSON = { 'content-type' : 'application/json' }
DL_TOKEN = { 'Authorization' : f'DirectLogin token={TOKEN}' }
# # API server will redirect your browser to this URL, should be non-functional
# # You will paste the redirect location here when running the script
# CALLBACK_URI = 'http://127.0.0.1/cb'
BANKS = ['hsbc.01.hk.hsbc', 'hsbc.02.hk.hsbc', 'hsbc.01.uk.uk', 'hsbc.02.uk.uk']
# OUR_BANK = 'gh.29.uk'
# # Our COUNTERPARTY account id (of the same currency)
# OUR_COUNTERPARTY = '8ca8a7e4-6d02-48e3-a029-0b2bf89de9f0'
# COUNTERPARTY_BANK = 'gh.29.uk'
# # this following two fields are just used in V210
# OUR_COUNTERPARTY_ID = ''
# OUR_COUNTERPARTY_IBAN = ''
# # Our currency to use
# OUR_CURRENCY = 'GBP'
# # Our value to transfer
# # values below 1000 do not requre challenge request
# OUR_VALUE = '0.01'
# OUR_VALUE_LARGE = '1000.00' | username = 'super.user.1'
password = 'X!16a99a4e'
consumer_key = 'f3haancaj0vm4lkx2erk3uwdzy2elz00of513u5w'
token = 'eyJhbGciOiJIUzI1NiJ9.eyIiOiIifQ.Qjz0-kry1Yb7PH0Pw1PbRWrgaqsFYPbac3RHQ-eykk4'
base_url = 'https://openlab.openbankproject.com'
api_version = 'v3.0.0'
content_json = {'content-type': 'application/json'}
dl_token = {'Authorization': f'DirectLogin token={TOKEN}'}
banks = ['hsbc.01.hk.hsbc', 'hsbc.02.hk.hsbc', 'hsbc.01.uk.uk', 'hsbc.02.uk.uk'] |
class Alerts:
def _init_ (self,Alert_Id, Alert_Name, Alert_Code):
self.Alert_Id= AlertId
self.Alert_Name = Alert_Name
self.Alert_Code = Alert_Code
| class Alerts:
def _init_(self, Alert_Id, Alert_Name, Alert_Code):
self.Alert_Id = AlertId
self.Alert_Name = Alert_Name
self.Alert_Code = Alert_Code |
class Solution:
def addStrings(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
chars1 = list(num1)
chars2 = list(num2)
chars1.reverse()
chars2.reverse()
i, j, sumValue, carry = 0, 0, 0, 0
res = list()
while i < len(chars1) or j < len(chars2) or carry != 0:
sumValue = carry
if i < len(chars1):
sumValue += int(chars1[i])
i += 1
if j < len(chars2):
sumValue += int(chars2[j])
j += 1
carry = sumValue // 10
sumValue = sumValue % 10
res.append(str(sumValue))
res.reverse()
return ''.join(res)
| class Solution:
def add_strings(self, num1, num2):
"""
:type num1: str
:type num2: str
:rtype: str
"""
chars1 = list(num1)
chars2 = list(num2)
chars1.reverse()
chars2.reverse()
(i, j, sum_value, carry) = (0, 0, 0, 0)
res = list()
while i < len(chars1) or j < len(chars2) or carry != 0:
sum_value = carry
if i < len(chars1):
sum_value += int(chars1[i])
i += 1
if j < len(chars2):
sum_value += int(chars2[j])
j += 1
carry = sumValue // 10
sum_value = sumValue % 10
res.append(str(sumValue))
res.reverse()
return ''.join(res) |
n = int(input('me diga um numero: '))
s = n + 1
a = n - 1
print ('o sucessor de {} e {}'. format(n, s))
print ('o antecessor de {} e {}'.format(n, a))
| n = int(input('me diga um numero: '))
s = n + 1
a = n - 1
print('o sucessor de {} e {}'.format(n, s))
print('o antecessor de {} e {}'.format(n, a)) |
def main():
a = 0
while True:
a += 1
if a % 1000 == 0:
print(a)
if __name__ == "__main__":
main()
| def main():
a = 0
while True:
a += 1
if a % 1000 == 0:
print(a)
if __name__ == '__main__':
main() |
def get_words(wordlist, resume=None):
with open(wordlist) as f:
raw_words = f.read()
found_resume = False
words = list()
for word in raw_words.split():
if resume is not None:
if found_resume:
words.append(word)
else:
if word == resume:
found_resume = True
print(f'Resuming wordlist from: {resume}')
else:
words.append(word)
return words | def get_words(wordlist, resume=None):
with open(wordlist) as f:
raw_words = f.read()
found_resume = False
words = list()
for word in raw_words.split():
if resume is not None:
if found_resume:
words.append(word)
elif word == resume:
found_resume = True
print(f'Resuming wordlist from: {resume}')
else:
words.append(word)
return words |
def fact(x):
if x == 1:
return 1
return x * fact(x-1)
if __name__=='__main__':
print("fact(5) = %s" % fact(5))
| def fact(x):
if x == 1:
return 1
return x * fact(x - 1)
if __name__ == '__main__':
print('fact(5) = %s' % fact(5)) |
"""
Utility functions for CICERO-SCM adapter
"""
def _get_unique_index_values(idf, index_col, assert_all_same=True):
"""
Get unique values in index column from a dataframe
Parameters
----------
idf : :obj:`pd.DataFrame`
Dataframe to get index values from
index_col : str
Column in index to get the values for
assert_all_same : bool
Should we assert that all the values are the same before
returning? If True, only a single value is returned. If
False, a list is returned.
Returns
-------
str, list
Values found, either a string or a list depending on
``assert_all_same``.
Raises
------
AssertionError
``assert_all_same`` is True and there's more than one
unique value.
"""
out = idf.index.get_level_values(index_col).unique().tolist()
if assert_all_same:
if len(out) > 1:
raise AssertionError(out)
return out[0]
return out
| """
Utility functions for CICERO-SCM adapter
"""
def _get_unique_index_values(idf, index_col, assert_all_same=True):
"""
Get unique values in index column from a dataframe
Parameters
----------
idf : :obj:`pd.DataFrame`
Dataframe to get index values from
index_col : str
Column in index to get the values for
assert_all_same : bool
Should we assert that all the values are the same before
returning? If True, only a single value is returned. If
False, a list is returned.
Returns
-------
str, list
Values found, either a string or a list depending on
``assert_all_same``.
Raises
------
AssertionError
``assert_all_same`` is True and there's more than one
unique value.
"""
out = idf.index.get_level_values(index_col).unique().tolist()
if assert_all_same:
if len(out) > 1:
raise assertion_error(out)
return out[0]
return out |
def extraerDatos(dato):
palo = dato[0:1] # Se extrae el primer caracter correspondiente a un palo
aux = dato.split(palo)
valor = int(aux[1]) # Se extra el valor del caracter
if (valor >= 10): # En el envido las cartas de 10 para arriba suman cero
valor = 0
return palo, valor
def contarEnvido(carta1,carta2,carta3):
palo1, aux1 = extraerDatos(carta1)
palo2, aux2 = extraerDatos(carta2)
palo3, aux3 = extraerDatos(carta3)
if ((palo1 == palo2) and (palo2 == palo3)):
#print("Flor") # Flor significa que las 3 cartas son del mismo palo
suma = 20 + aux1+aux2+aux3
if suma > 33: # La maxima suma que se puede realizar con la flor es 33
auxMax = max([aux1,aux2,aux3])
auxMin = min([aux1,aux2,aux3])
if ((aux1 > auxMin) and (aux1 < auxMax)): suma = 20 + aux1 + auxMax
if ((aux2 > auxMin) and (aux2 < auxMax)): suma = 20 + aux2 + auxMax
if ((aux3 > auxMin) and (aux3 < auxMax)): suma = 20 + aux3 + auxMax
texto = "FLOR. La suma de la flor es: " + str(suma)
#print("La suma de la flor es: {}".format(suma))
elif ((palo1 == palo2) and (palo2 != palo3)):
suma = 20 + aux1 + aux2
texto = "La suma del envido es: " + str(suma)
#print("La suma del envido es: {}".format(suma))
elif ((palo1 == palo3) and (palo1 != palo2)):
suma = 20 + aux1 + aux3
texto = "La suma del envido es: " + str(suma)
#print("La suma del envido es: {}".format(suma))
elif ((palo2 == palo3) and (palo1 != palo2)):
suma = 20 + aux2 + aux3
texto = "La suma del envido es: " + str(suma)
#print("La suma del envido es: {}".format(suma))
else:
#print("Mentiste. No tenias nada para el envido")
suma = max([aux1,aux2,aux3])
texto = "La suma del envido es: " + str(suma)
#print("La suma del envido es: {}".format(suma))
return texto
| def extraer_datos(dato):
palo = dato[0:1]
aux = dato.split(palo)
valor = int(aux[1])
if valor >= 10:
valor = 0
return (palo, valor)
def contar_envido(carta1, carta2, carta3):
(palo1, aux1) = extraer_datos(carta1)
(palo2, aux2) = extraer_datos(carta2)
(palo3, aux3) = extraer_datos(carta3)
if palo1 == palo2 and palo2 == palo3:
suma = 20 + aux1 + aux2 + aux3
if suma > 33:
aux_max = max([aux1, aux2, aux3])
aux_min = min([aux1, aux2, aux3])
if aux1 > auxMin and aux1 < auxMax:
suma = 20 + aux1 + auxMax
if aux2 > auxMin and aux2 < auxMax:
suma = 20 + aux2 + auxMax
if aux3 > auxMin and aux3 < auxMax:
suma = 20 + aux3 + auxMax
texto = 'FLOR. La suma de la flor es: ' + str(suma)
elif palo1 == palo2 and palo2 != palo3:
suma = 20 + aux1 + aux2
texto = 'La suma del envido es: ' + str(suma)
elif palo1 == palo3 and palo1 != palo2:
suma = 20 + aux1 + aux3
texto = 'La suma del envido es: ' + str(suma)
elif palo2 == palo3 and palo1 != palo2:
suma = 20 + aux2 + aux3
texto = 'La suma del envido es: ' + str(suma)
else:
suma = max([aux1, aux2, aux3])
texto = 'La suma del envido es: ' + str(suma)
return texto |
class Life:
def __init__(self, width, height):
self.width = width
self.height = height
self.frame = [[0 for x in range(width)] for y in range(height)]
def import_frame(self, fname):
with open(fname, 'r') as f:
lines = f.readlines()
for i, line in enumerate(lines):
line_vals = list(map(int, line.split(' ')))
self.frame[i] = [line_vals[j] if j < len(line_vals) else self.frame[i][j] for j in range(len(self.frame[i]))]
def tick(self):
next_gen = [[0 for x in range(self.width)] for y in range(self.height)]
f = self.frame
for i in range(self.height):
for j in range(self.width):
u = i - 1 #up
d = i + 1 if i + 1 < self.height else 0 #down
l = j - 1 #left
r = j + 1 if j + 1 < self.width else 0 #right
alive_neighbours = f[u][l] + f[u][j] + f[u][r] + f[i][l] + f[i][r] + f[d][l] + f[d][j] + f[d][r]
if f[i][j]:
if 1 < alive_neighbours < 4:
next_gen[i][j] = 1
else:
if alive_neighbours == 3:
next_gen[i][j] = 1
self.frame = next_gen
| class Life:
def __init__(self, width, height):
self.width = width
self.height = height
self.frame = [[0 for x in range(width)] for y in range(height)]
def import_frame(self, fname):
with open(fname, 'r') as f:
lines = f.readlines()
for (i, line) in enumerate(lines):
line_vals = list(map(int, line.split(' ')))
self.frame[i] = [line_vals[j] if j < len(line_vals) else self.frame[i][j] for j in range(len(self.frame[i]))]
def tick(self):
next_gen = [[0 for x in range(self.width)] for y in range(self.height)]
f = self.frame
for i in range(self.height):
for j in range(self.width):
u = i - 1
d = i + 1 if i + 1 < self.height else 0
l = j - 1
r = j + 1 if j + 1 < self.width else 0
alive_neighbours = f[u][l] + f[u][j] + f[u][r] + f[i][l] + f[i][r] + f[d][l] + f[d][j] + f[d][r]
if f[i][j]:
if 1 < alive_neighbours < 4:
next_gen[i][j] = 1
elif alive_neighbours == 3:
next_gen[i][j] = 1
self.frame = next_gen |
class Estadistica:
def __init__(self):
self.bodega_saladillo = []
self.bodega_saladillo_hora = []
self.bodega_andina = []
self.bodega_andina_hora = []
self.camiones_t2 = []
self.error_bodega = 0
self.barcos_puerto = []
self.ocupacion_trenes = []
def promedios(self):
suma1 = 0
suma2 = 0
for n in self.bodega_saladillo_hora:
suma1 += n
for n in self.bodega_andina_hora:
suma2 += n
self.bodega_saladillo.append(suma1/len(self.bodega_saladillo_hora))
self.bodega_andina.append(suma2/len(self.bodega_andina_hora))
def ocupacion_trenes_calculo(self, carga):
self.ocupacion_trenes.append(carga/740)
def nuevo_dia(self, saladillo, andina):
self.bodega_saladillo_hora.append(saladillo)
self.bodega_andina_hora.append(andina)
self.promedios()
self.bodega_saladillo_hora = []
self.bodega_andina_hora = []
def nueva_hora(self, saladillo, andina):
self.bodega_saladillo_hora.append(saladillo)
self.bodega_andina_hora.append(andina)
def nuevo_dia_dos(self, andina, saladillo):
self.bodega_andina.append(andina)
self.bodega_saladillo.append(saladillo)
def tramo2(self):
self.camiones_t2 += 1
def calculo_error(self, bodega):
if bodega > 7500:
self.error_bodega += 1
def usando_camiones(self, camiones):
self.camiones_t2.append(camiones)
def bodega_csv(self):
file = open('bodega_saladillo.csv', 'a')
for i in self.bodega_saladillo:
file.write(","+str(i) + '\n')
file.write("-" + '\n')
file2 = open('bodega_andina.csv', 'a')
for i in self.bodega_andina:
file2.write(","+str(i) + '\n')
file2.write("-" + '\n')
file3 = open('puerto.csv', 'a')
for i in self.barcos_puerto:
file3.write(";"+str(i) + '\n')
file3.write("-" + '\n')
file4 = open('tramo2.csv', 'a')
for i in self.camiones_t2:
file4.write(";"+str(i) + '\n')
file4.write("-"+'\n')
| class Estadistica:
def __init__(self):
self.bodega_saladillo = []
self.bodega_saladillo_hora = []
self.bodega_andina = []
self.bodega_andina_hora = []
self.camiones_t2 = []
self.error_bodega = 0
self.barcos_puerto = []
self.ocupacion_trenes = []
def promedios(self):
suma1 = 0
suma2 = 0
for n in self.bodega_saladillo_hora:
suma1 += n
for n in self.bodega_andina_hora:
suma2 += n
self.bodega_saladillo.append(suma1 / len(self.bodega_saladillo_hora))
self.bodega_andina.append(suma2 / len(self.bodega_andina_hora))
def ocupacion_trenes_calculo(self, carga):
self.ocupacion_trenes.append(carga / 740)
def nuevo_dia(self, saladillo, andina):
self.bodega_saladillo_hora.append(saladillo)
self.bodega_andina_hora.append(andina)
self.promedios()
self.bodega_saladillo_hora = []
self.bodega_andina_hora = []
def nueva_hora(self, saladillo, andina):
self.bodega_saladillo_hora.append(saladillo)
self.bodega_andina_hora.append(andina)
def nuevo_dia_dos(self, andina, saladillo):
self.bodega_andina.append(andina)
self.bodega_saladillo.append(saladillo)
def tramo2(self):
self.camiones_t2 += 1
def calculo_error(self, bodega):
if bodega > 7500:
self.error_bodega += 1
def usando_camiones(self, camiones):
self.camiones_t2.append(camiones)
def bodega_csv(self):
file = open('bodega_saladillo.csv', 'a')
for i in self.bodega_saladillo:
file.write(',' + str(i) + '\n')
file.write('-' + '\n')
file2 = open('bodega_andina.csv', 'a')
for i in self.bodega_andina:
file2.write(',' + str(i) + '\n')
file2.write('-' + '\n')
file3 = open('puerto.csv', 'a')
for i in self.barcos_puerto:
file3.write(';' + str(i) + '\n')
file3.write('-' + '\n')
file4 = open('tramo2.csv', 'a')
for i in self.camiones_t2:
file4.write(';' + str(i) + '\n')
file4.write('-' + '\n') |
# Write a program that reads in three strings and sorts them lexicographically.
# Enter a string: Charlie
# Enter a string: Able
# Enter a string: Baker
# Able
# Baker
# Charlie
string1 = str(input("Enter a string: "))
string2 = str(input("Enter a string: "))
string3 = str(input("Enter a string: "))
if string1 < string2 and string1 < string3:
print(string1)
if string2 < string3:
print(string2)
print(string3)
else:
print(string3)
print(string2)
elif string1 > string2 and string2 < string3:
print(string2)
if string1 < string3:
print(string1)
print(string3)
else:
print(string3)
print(string1)
else:
print(string3)
if string1 < string2:
print(string1)
print(string2)
else:
print(string2)
print(string1) | string1 = str(input('Enter a string: '))
string2 = str(input('Enter a string: '))
string3 = str(input('Enter a string: '))
if string1 < string2 and string1 < string3:
print(string1)
if string2 < string3:
print(string2)
print(string3)
else:
print(string3)
print(string2)
elif string1 > string2 and string2 < string3:
print(string2)
if string1 < string3:
print(string1)
print(string3)
else:
print(string3)
print(string1)
else:
print(string3)
if string1 < string2:
print(string1)
print(string2)
else:
print(string2)
print(string1) |
"""
Implements utility functions.
"""
def list_to_string(l: list) -> str:
"""
:param list l: A list to serialize.
:return str: The same list, as a string.
"""
return ', '.join([str(v) for v in l])
def string_to_list(s: str) -> list:
"""
:param str s: A serialized list.
:return list: The actual list.
"""
return s.split(', ')
| """
Implements utility functions.
"""
def list_to_string(l: list) -> str:
"""
:param list l: A list to serialize.
:return str: The same list, as a string.
"""
return ', '.join([str(v) for v in l])
def string_to_list(s: str) -> list:
"""
:param str s: A serialized list.
:return list: The actual list.
"""
return s.split(', ') |
#!/usr/bin/env python
#coding: utf-8
class Solution:
# @return a boolean
def isValid(self, s):
stack = []
for x in s:
if x == '(' or x == '{' or x == '[':
stack.append(x)
else:
if not stack: return False
y = stack.pop()
if x == ')' and y != '(': return False
if x == ']' and y != '[': return False
if x == '}' and y != '{': return False
if not stack: return True
return False
if __name__ == '__main__':
s = Solution()
assert True == s.isValid('()')
assert True == s.isValid('()[]{}')
assert False == s.isValid('(]')
assert False == s.isValid('([)]')
| class Solution:
def is_valid(self, s):
stack = []
for x in s:
if x == '(' or x == '{' or x == '[':
stack.append(x)
else:
if not stack:
return False
y = stack.pop()
if x == ')' and y != '(':
return False
if x == ']' and y != '[':
return False
if x == '}' and y != '{':
return False
if not stack:
return True
return False
if __name__ == '__main__':
s = solution()
assert True == s.isValid('()')
assert True == s.isValid('()[]{}')
assert False == s.isValid('(]')
assert False == s.isValid('([)]') |
def doSubtraction():
a=30
b=20
print(a-b)
doSubtraction()
#This is Code for Subtraction
| def do_subtraction():
a = 30
b = 20
print(a - b)
do_subtraction() |
o = int(input())
c = -1
for i in range(1000000000000):
i = str(i)
t = 0
for j in range(len(i)):
k = abs(int(i[j - 1]) - int(i[j]))
if k > 1:
t = 1
break
if t:
continue
c += 1
if c == o:
print(i)
break
| o = int(input())
c = -1
for i in range(1000000000000):
i = str(i)
t = 0
for j in range(len(i)):
k = abs(int(i[j - 1]) - int(i[j]))
if k > 1:
t = 1
break
if t:
continue
c += 1
if c == o:
print(i)
break |
print('hello world')
for item in [1,2,3,4,5,6,'foo','bar','baz']:
print('eh')
class MyCustomClass(object):
arg = None
def __init__(arg):
self.arg = arg
def my_method(self):
return self.arg + 1
def more_python(self):
return 1 + 1 + 2
def new_method():
return self.arg * arg
def asdf_asdf():
return "asdf"
def even_more_python(self):
return 1 + 3 + 4
@custom_generator
def generator_example(n):
run = 0
while run < 1000:
run = run + 1
yield run
@classmethod
def get_my_demos_done():
return False
@classmethod
def more_things():
return True
@classmethod
def asdfasdfdsa():
return "asdf"
def custom_generator(func):
return func()
| print('hello world')
for item in [1, 2, 3, 4, 5, 6, 'foo', 'bar', 'baz']:
print('eh')
class Mycustomclass(object):
arg = None
def __init__(arg):
self.arg = arg
def my_method(self):
return self.arg + 1
def more_python(self):
return 1 + 1 + 2
def new_method():
return self.arg * arg
def asdf_asdf():
return 'asdf'
def even_more_python(self):
return 1 + 3 + 4
@custom_generator
def generator_example(n):
run = 0
while run < 1000:
run = run + 1
yield run
@classmethod
def get_my_demos_done():
return False
@classmethod
def more_things():
return True
@classmethod
def asdfasdfdsa():
return 'asdf'
def custom_generator(func):
return func() |
class DocumentDocstring:
def __init__(self, expression):
self._exp = expression
self._docstring = expression.value.s
def title(self):
return self._docstring.split('\n')[0]
def body(self):
b = []
skipped_lines = 1
for s in self._docstring.split('\n'):
if skipped_lines == 0:
b.append(s)
else:
skipped_lines = skipped_lines - 1
return b | class Documentdocstring:
def __init__(self, expression):
self._exp = expression
self._docstring = expression.value.s
def title(self):
return self._docstring.split('\n')[0]
def body(self):
b = []
skipped_lines = 1
for s in self._docstring.split('\n'):
if skipped_lines == 0:
b.append(s)
else:
skipped_lines = skipped_lines - 1
return b |
class Solution:
def romanToInt(self, s: str) -> int:
res = 0
last = None
for d in s:
if d == 'M':
res += 800 if last == 'C' else 1000
elif d == 'D':
res += 300 if last == 'C' else 500
elif d == 'C':
res += 80 if last == 'X' else 100
elif d == 'L':
res += 30 if last == 'X' else 50
elif d == 'X':
res += 8 if last == 'I' else 10
elif d == 'V':
res += 3 if last == 'I' else 5
else: # d == 'I'
res += 1
last = d
return res
| class Solution:
def roman_to_int(self, s: str) -> int:
res = 0
last = None
for d in s:
if d == 'M':
res += 800 if last == 'C' else 1000
elif d == 'D':
res += 300 if last == 'C' else 500
elif d == 'C':
res += 80 if last == 'X' else 100
elif d == 'L':
res += 30 if last == 'X' else 50
elif d == 'X':
res += 8 if last == 'I' else 10
elif d == 'V':
res += 3 if last == 'I' else 5
else:
res += 1
last = d
return res |
s = 1
valor = soma = 0
for c in range(2, 101):
valor = s / c
soma += valor
print(f'{soma+1:.2f}')
| s = 1
valor = soma = 0
for c in range(2, 101):
valor = s / c
soma += valor
print(f'{soma + 1:.2f}') |
#!/usr/bin/env python
"""
CREATED AT: 2021/12/06
Des:
https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list
https://leetcode.com/explore/learn/card/linked-list/213/conclusion/1225/
GITHUB: https://github.com/Jiezhi/myleetcode
Difficulty: Medium
Tag:
See:
"""
# Definition for a Node.
class Node:
def __init__(self, val, prev, next, child):
self.val = val
self.prev = prev
self.next = next
self.child = child
class Solution:
def flatten(self, head: 'Node') -> 'Node':
"""
26 / 26 test cases passed.
Status: Accepted
Runtime: 36 ms
Memory Usage: 15.1 MB
The number of Nodes will not exceed 1000.
1 <= Node.val <= 10^5
:param head:
:return:
"""
def sub_flatten(head: 'Node') -> ('Node', 'Node'):
node = head
pre_tail = node
while node is not None:
pre_tail = node
if node.child is not None:
chead, ctail = sub_flatten(node.child)
if node.next is not None:
ctail.next = node.next
node.next.prev = ctail
node.next = chead
chead.prev = node
node.child = None
node = ctail
else:
node = node.next
return head, pre_tail
sub_flatten(head)
return head
def test():
# TODO build example node
# 1---2---3---4---5---6--NULL
# |
# 7---8---9---10--NULL
# |
# 11--12--NULL
pass
if __name__ == '__main__':
test()
| """
CREATED AT: 2021/12/06
Des:
https://leetcode.com/problems/flatten-a-multilevel-doubly-linked-list
https://leetcode.com/explore/learn/card/linked-list/213/conclusion/1225/
GITHUB: https://github.com/Jiezhi/myleetcode
Difficulty: Medium
Tag:
See:
"""
class Node:
def __init__(self, val, prev, next, child):
self.val = val
self.prev = prev
self.next = next
self.child = child
class Solution:
def flatten(self, head: 'Node') -> 'Node':
"""
26 / 26 test cases passed.
Status: Accepted
Runtime: 36 ms
Memory Usage: 15.1 MB
The number of Nodes will not exceed 1000.
1 <= Node.val <= 10^5
:param head:
:return:
"""
def sub_flatten(head: 'Node') -> ('Node', 'Node'):
node = head
pre_tail = node
while node is not None:
pre_tail = node
if node.child is not None:
(chead, ctail) = sub_flatten(node.child)
if node.next is not None:
ctail.next = node.next
node.next.prev = ctail
node.next = chead
chead.prev = node
node.child = None
node = ctail
else:
node = node.next
return (head, pre_tail)
sub_flatten(head)
return head
def test():
pass
if __name__ == '__main__':
test() |
a = 18
b = 13
print(a-b)
# Answer should be 5
| a = 18
b = 13
print(a - b) |
# Question: https://projecteuler.net/problem=115
M = 50
T = 10**6
DP1 = []
DP2 = []
for i in range(M):
DP1.append(1)
DP2.append(0)
while DP1[-1] + DP2[-1] <= T:
DP1_i = DP1[-1] + DP2[-1]
DP2_i = DP1[-M] + DP2[-1]
DP1.append(DP1_i)
DP2.append(DP2_i)
print(len(DP1) - 1)
# ---
# Even better recursive formula
# Let DP[N] = DP1[N] + DP2[N]
# We have, DP1[N] = DP1[N-1] + DP2[N-1] = DP[N-1] -> DP1[N] = DP[N-1]
# and DP2[N-1] = DP[N-1] - DP1[N-1] = DP[N-1] - DP[N-2]
# We have DP2[N] = DP1[N-M] + DP2[N-1] = DP[N-M-1] + (DP[N-1] - DP[N-2])
# So, DP[N] = DP1[N] + DP2[N] = DP[N-1] + (DP[N-M-1] + DP[N-1] - DP[N-2]) = 2 * DP[N-1] - DP[N-2] + DP[N-M-1]
DP = []
for i in range(M):
DP.append(1)
DP.append(2)
while DP[-1] <= T:
DP.append(2 * DP[-1] - DP[-2] + DP[-M-1])
print(len(DP) - 1)
assert(DP[-1] == DP1[-1] + DP2[-1])
| m = 50
t = 10 ** 6
dp1 = []
dp2 = []
for i in range(M):
DP1.append(1)
DP2.append(0)
while DP1[-1] + DP2[-1] <= T:
dp1_i = DP1[-1] + DP2[-1]
dp2_i = DP1[-M] + DP2[-1]
DP1.append(DP1_i)
DP2.append(DP2_i)
print(len(DP1) - 1)
dp = []
for i in range(M):
DP.append(1)
DP.append(2)
while DP[-1] <= T:
DP.append(2 * DP[-1] - DP[-2] + DP[-M - 1])
print(len(DP) - 1)
assert DP[-1] == DP1[-1] + DP2[-1] |
"""packer_builder/specs/builder/distros/debian.py"""
# pylint: disable=line-too-long
def debian_spec(**kwargs):
"Debian specs."
# Setup vars from kwargs
builder_spec = kwargs['data']['builder_spec']
distro = kwargs['data']['distro']
version = kwargs['data']['version']
bootstrap_cfg = 'preseed.cfg'
builder_spec.update(
{
'boot_command': [
'<esc><wait>',
'install<wait>',
' auto=true',
'<wait>',
' priority=critical',
'<wait>',
' url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/'f'{distro}-{version}-{bootstrap_cfg}', # noqa: E501
' <wait><enter>'
],
'boot_wait': '30s',
'shutdown_command': 'sudo /sbin/halt -h -p'
}
)
return bootstrap_cfg, builder_spec
| """packer_builder/specs/builder/distros/debian.py"""
def debian_spec(**kwargs):
"""Debian specs."""
builder_spec = kwargs['data']['builder_spec']
distro = kwargs['data']['distro']
version = kwargs['data']['version']
bootstrap_cfg = 'preseed.cfg'
builder_spec.update({'boot_command': ['<esc><wait>', 'install<wait>', ' auto=true', '<wait>', ' priority=critical', '<wait>', f' url=http://{{{{ .HTTPIP }}}}:{{{{ .HTTPPort }}}}/{distro}-{version}-{bootstrap_cfg}', ' <wait><enter>'], 'boot_wait': '30s', 'shutdown_command': 'sudo /sbin/halt -h -p'})
return (bootstrap_cfg, builder_spec) |
# -*- coding: utf-8 -*-
"""
@Author: Lyzhang
@Date:
@Description:
"""
VERSION, SET, USE_GPU, CUDA_ID = 10, 200, True, 3
HIDDEN_SIZE, Head_NUM, GCN_LAYER, K, RNN_LAYER, RNN_TYPE = 384, 2, 2, 64, 2, "GRU"
USE_ELMo, USE_POS = True, True
Partial_IN = False
TOKEN_SCORE = False
LR, LR_DECAY = 0.001, False
BATCH_SIZE, N_EPOCH, LOG_EVE, EVA_EVE = 1, 16, 20, 120
SAVE_MODEL = True
DROPOUT = 0.2
RESIDUAL_DROPOUT = 0.33
L2 = 1e-5
USE_ENC_DEC = True
BASELINE, Bias, SIM_BIAS, R = True, False, False, 32 # basic GCN
MLP_Layer = 1
SEED = 7
DEV_SIZE = 640
PAD = "<PAD>"
PAD_ID = 0
UNK = "<UNK>"
UNK_ID = 1
USE_ALL_SYN_INFO = False
tag2ids = {"O": 0, "B": 1, PAD: 2}
sync2ids = {"head": 0, "dep": 1, "self": 2}
TAG_LABELS = ["O", "B"]
SYN_SIZE = 81 if USE_ALL_SYN_INFO else 3
POS_TAG_NUM = 47
POS_TAG_SIZE = 30 if USE_POS else 0
WORDEMB_SIZE = 1024 if USE_ELMo else 300
ELMo_SIZE = 512
EMBED_LEARN = False
MAX_SEQ_LEN = 140
SMOO_VAL = -1e2
PRINT_EVE = 10000
| """
@Author: Lyzhang
@Date:
@Description:
"""
(version, set, use_gpu, cuda_id) = (10, 200, True, 3)
(hidden_size, head_num, gcn_layer, k, rnn_layer, rnn_type) = (384, 2, 2, 64, 2, 'GRU')
(use_el_mo, use_pos) = (True, True)
partial_in = False
token_score = False
(lr, lr_decay) = (0.001, False)
(batch_size, n_epoch, log_eve, eva_eve) = (1, 16, 20, 120)
save_model = True
dropout = 0.2
residual_dropout = 0.33
l2 = 1e-05
use_enc_dec = True
(baseline, bias, sim_bias, r) = (True, False, False, 32)
mlp__layer = 1
seed = 7
dev_size = 640
pad = '<PAD>'
pad_id = 0
unk = '<UNK>'
unk_id = 1
use_all_syn_info = False
tag2ids = {'O': 0, 'B': 1, PAD: 2}
sync2ids = {'head': 0, 'dep': 1, 'self': 2}
tag_labels = ['O', 'B']
syn_size = 81 if USE_ALL_SYN_INFO else 3
pos_tag_num = 47
pos_tag_size = 30 if USE_POS else 0
wordemb_size = 1024 if USE_ELMo else 300
el_mo_size = 512
embed_learn = False
max_seq_len = 140
smoo_val = -100.0
print_eve = 10000 |
expected_output = {
'event_num': {
2: {
'event_name': '_wdtimer',
'value': '180'
},
}
}
| expected_output = {'event_num': {2: {'event_name': '_wdtimer', 'value': '180'}}} |
d = {}; print(len(d))
d = {'k1':'v1', 'k2':'v2'}; print(len(d))
print(iter(d))
for i in iter(d): print(i)
| d = {}
print(len(d))
d = {'k1': 'v1', 'k2': 'v2'}
print(len(d))
print(iter(d))
for i in iter(d):
print(i) |
print('===== \033[31mDESAFIO 02\033[m =====')
dia = input('Dia = ')
mes = input('Mes = ')
ano = input('Ano = ')
print('Voce nasceu no dia \033[33m{}\033[m de \033[33m{}\033[m de \033[33m{}\033[m. Correto?'.format(dia, mes, ano))
| print('===== \x1b[31mDESAFIO 02\x1b[m =====')
dia = input('Dia = ')
mes = input('Mes = ')
ano = input('Ano = ')
print('Voce nasceu no dia \x1b[33m{}\x1b[m de \x1b[33m{}\x1b[m de \x1b[33m{}\x1b[m. Correto?'.format(dia, mes, ano)) |
#
# PySNMP MIB module ENVIRONMENT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENVIRONMENT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:05:02 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueSizeConstraint, ConstraintsIntersection, ValueRangeConstraint, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "SingleValueConstraint", "ConstraintsUnion")
ntEnterpriseDataTasmanMgmt, = mibBuilder.importSymbols("NT-ENTERPRISE-DATA-MIB", "ntEnterpriseDataTasmanMgmt")
ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup")
iso, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Unsigned32, TimeTicks, ObjectIdentity, IpAddress, MibIdentifier, Counter64, ModuleIdentity, Integer32, Gauge32, NotificationType = mibBuilder.importSymbols("SNMPv2-SMI", "iso", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Unsigned32", "TimeTicks", "ObjectIdentity", "IpAddress", "MibIdentifier", "Counter64", "ModuleIdentity", "Integer32", "Gauge32", "NotificationType")
TruthValue, TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TruthValue", "TextualConvention", "DisplayString")
nnenvironmentMib = ModuleIdentity((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3))
nnenvironmentMib.setRevisions(('1900-08-18 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: nnenvironmentMib.setRevisionsDescriptions(('Initial version of Environment MIB.',))
if mibBuilder.loadTexts: nnenvironmentMib.setLastUpdated('0008180000Z')
if mibBuilder.loadTexts: nnenvironmentMib.setOrganization('Nortel Networks')
if mibBuilder.loadTexts: nnenvironmentMib.setContactInfo(' Nortel Networks 8200 Dixie Road Brampton, Ontario L6T 5P6 Canada 1-800-4Nortel www.nortelnetworks.com ')
if mibBuilder.loadTexts: nnenvironmentMib.setDescription('')
class EnvState(TextualConvention, Integer32):
description = 'Represents the state of a device being monitored.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))
namedValues = NamedValues(("normal", 1), ("warning", 2), ("critical", 3), ("fail", 4), ("turned-off", 5))
class EnvInstalled(TextualConvention, Integer32):
description = 'Installed flag for power supply.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("not-installed", 1), ("installed", 2))
class EnvStatus(TextualConvention, Integer32):
description = 'Installed flag for power supply.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3))
namedValues = NamedValues(("absent", 1), ("failed", 2), ("normal", 3))
class EnvType(TextualConvention, Integer32):
description = 'Installed flag for power supply.'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))
namedValues = NamedValues(("supply-AC-ONLY", 1), ("supply-AC-PoE", 2), ("supply-DC", 3), ("unknown", 4))
nnenvObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1))
nnenvNotificationEnables = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 2))
nnenvNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3))
nnenvTraps = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0))
nnenvTempSensorGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 1))
nnenvTempSensorValue = MibScalar((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 1, 1), Gauge32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nnenvTempSensorValue.setStatus('current')
if mibBuilder.loadTexts: nnenvTempSensorValue.setDescription(' The Average value of the temperature sensors. ')
nnenvTempSensorState = MibScalar((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 1, 2), EnvState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nnenvTempSensorState.setStatus('current')
if mibBuilder.loadTexts: nnenvTempSensorState.setDescription(' The Average status of the temperature sensors. ')
nnenvFanTable = MibTable((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 2), )
if mibBuilder.loadTexts: nnenvFanTable.setStatus('current')
if mibBuilder.loadTexts: nnenvFanTable.setDescription('A list of fan unit entries.')
nnenvFanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 2, 1), ).setIndexNames((0, "ENVIRONMENT-MIB", "nnenvFanUnitIndex"))
if mibBuilder.loadTexts: nnenvFanEntry.setStatus('current')
if mibBuilder.loadTexts: nnenvFanEntry.setDescription('Entry containing information about a fan within the chassis.')
nnenvFanUnitIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: nnenvFanUnitIndex.setStatus('current')
if mibBuilder.loadTexts: nnenvFanUnitIndex.setDescription('The index to access an entry in the table. ')
nnenvFanState = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 2, 1, 2), EnvState()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nnenvFanState.setStatus('current')
if mibBuilder.loadTexts: nnenvFanState.setDescription(' The current state of fan 0, normal/fail. ')
nnenvPwrsupPowerFailCount = MibScalar((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nnenvPwrsupPowerFailCount.setStatus('current')
if mibBuilder.loadTexts: nnenvPwrsupPowerFailCount.setDescription('Number of failures of either power supply since boot-up.')
nnenvPwrsupTable = MibTable((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4), )
if mibBuilder.loadTexts: nnenvPwrsupTable.setStatus('current')
if mibBuilder.loadTexts: nnenvPwrsupTable.setDescription('A list of power supply status information.')
nnenvPwrsupEntry = MibTableRow((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1), ).setIndexNames((0, "ENVIRONMENT-MIB", "nnenvPwrsupIndex"))
if mibBuilder.loadTexts: nnenvPwrsupEntry.setStatus('current')
if mibBuilder.loadTexts: nnenvPwrsupEntry.setDescription('Entry containing power supply information.')
nnenvPwrsupIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2))).setMaxAccess("accessiblefornotify")
if mibBuilder.loadTexts: nnenvPwrsupIndex.setStatus('current')
if mibBuilder.loadTexts: nnenvPwrsupIndex.setDescription('Index to access entry.')
nnenvPwrsupInstalled = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1, 2), EnvInstalled()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nnenvPwrsupInstalled.setStatus('current')
if mibBuilder.loadTexts: nnenvPwrsupInstalled.setDescription('Power supply installed flag.')
nnenvPwrsupStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1, 3), EnvStatus()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nnenvPwrsupStatus.setStatus('current')
if mibBuilder.loadTexts: nnenvPwrsupStatus.setDescription('Power supply up/down status.')
nnenvPwrsupType = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1, 4), EnvType()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nnenvPwrsupType.setStatus('current')
if mibBuilder.loadTexts: nnenvPwrsupType.setDescription('Power supply type.')
nnenvPwrsupUptime = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nnenvPwrsupUptime.setStatus('current')
if mibBuilder.loadTexts: nnenvPwrsupUptime.setDescription('Seconds since power supply came up.')
nnenvPwrsupDowntime = MibTableColumn((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1, 6), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: nnenvPwrsupDowntime.setStatus('current')
if mibBuilder.loadTexts: nnenvPwrsupDowntime.setDescription('Seconds since power supply went down.')
nnenvEnableTemperatureNotification = MibScalar((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 2, 1), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nnenvEnableTemperatureNotification.setStatus('current')
if mibBuilder.loadTexts: nnenvEnableTemperatureNotification.setDescription('Indicates whether the system produces the envTemperatureNotification. The default is yes. Note: implementation is TBD. ')
nnenvEnableFanNotification = MibScalar((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 2, 2), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nnenvEnableFanNotification.setStatus('current')
if mibBuilder.loadTexts: nnenvEnableFanNotification.setDescription('Indicates whether the system produces the envFanNotification. The default is yes. ')
nnenvEnablePowerNotification = MibScalar((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 2, 3), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: nnenvEnablePowerNotification.setStatus('current')
if mibBuilder.loadTexts: nnenvEnablePowerNotification.setDescription('Indicates whether the system produces the envPowerNotification. The default is yes. ')
nnenvTemperatureNotification = NotificationType((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0, 1)).setObjects(("ENVIRONMENT-MIB", "nnenvTempSensorValue"), ("ENVIRONMENT-MIB", "nnenvTempSensorState"))
if mibBuilder.loadTexts: nnenvTemperatureNotification.setStatus('current')
if mibBuilder.loadTexts: nnenvTemperatureNotification.setDescription(' An envTemeratureNotification is sent if the environmental monitoring detects that the temperature is at a critical state. This may cause the system to shut down. This notification is sent only if envEnableTemperatureNotification is set to true. ')
nnenvFanNotification = NotificationType((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0, 2)).setObjects(("ENVIRONMENT-MIB", "nnenvFanUnitIndex"), ("ENVIRONMENT-MIB", "nnenvFanState"))
if mibBuilder.loadTexts: nnenvFanNotification.setStatus('current')
if mibBuilder.loadTexts: nnenvFanNotification.setDescription(' An envFanNotification is sent if the environmental monitoring detects that a fan is in a critical state. This may cause the system to shut down. This notification is sent only if envEnableFanNotification is set to true. ')
nnenvPowerSupply1DownNotification = NotificationType((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0, 3)).setObjects(("ENVIRONMENT-MIB", "nnenvPwrsupPowerFailCount"), ("ENVIRONMENT-MIB", "nnenvPwrsupIndex"), ("ENVIRONMENT-MIB", "nnenvPwrsupInstalled"), ("ENVIRONMENT-MIB", "nnenvPwrsupStatus"), ("ENVIRONMENT-MIB", "nnenvPwrsupType"), ("ENVIRONMENT-MIB", "nnenvPwrsupUptime"), ("ENVIRONMENT-MIB", "nnenvPwrsupDowntime"))
if mibBuilder.loadTexts: nnenvPowerSupply1DownNotification.setStatus('current')
if mibBuilder.loadTexts: nnenvPowerSupply1DownNotification.setDescription(' An envPowerNotification is sent if the environmental monitoring detects that a power supply has changed status. This notification is sent only if envEnablePowerNotification is set to true. ')
nnenvPowerSupply1UpNotification = NotificationType((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0, 4)).setObjects(("ENVIRONMENT-MIB", "nnenvPwrsupPowerFailCount"), ("ENVIRONMENT-MIB", "nnenvPwrsupIndex"), ("ENVIRONMENT-MIB", "nnenvPwrsupInstalled"), ("ENVIRONMENT-MIB", "nnenvPwrsupStatus"), ("ENVIRONMENT-MIB", "nnenvPwrsupType"), ("ENVIRONMENT-MIB", "nnenvPwrsupUptime"), ("ENVIRONMENT-MIB", "nnenvPwrsupDowntime"))
if mibBuilder.loadTexts: nnenvPowerSupply1UpNotification.setStatus('current')
if mibBuilder.loadTexts: nnenvPowerSupply1UpNotification.setDescription(' An envPowerNotification is sent if the environmental monitoring detects that a power supply has changed status. This notification is sent only if envEnablePowerNotification is set to true. ')
nnenvPowerSupply2DownNotification = NotificationType((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0, 5)).setObjects(("ENVIRONMENT-MIB", "nnenvPwrsupPowerFailCount"), ("ENVIRONMENT-MIB", "nnenvPwrsupIndex"), ("ENVIRONMENT-MIB", "nnenvPwrsupInstalled"), ("ENVIRONMENT-MIB", "nnenvPwrsupStatus"), ("ENVIRONMENT-MIB", "nnenvPwrsupType"), ("ENVIRONMENT-MIB", "nnenvPwrsupUptime"), ("ENVIRONMENT-MIB", "nnenvPwrsupDowntime"))
if mibBuilder.loadTexts: nnenvPowerSupply2DownNotification.setStatus('current')
if mibBuilder.loadTexts: nnenvPowerSupply2DownNotification.setDescription(' An envPowerNotification is sent if the environmental monitoring detects that a power supply has changed status. This notification is sent only if envEnablePowerNotification is set to true. ')
nnenvPowerSupply2UpNotification = NotificationType((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0, 6)).setObjects(("ENVIRONMENT-MIB", "nnenvPwrsupPowerFailCount"), ("ENVIRONMENT-MIB", "nnenvPwrsupIndex"), ("ENVIRONMENT-MIB", "nnenvPwrsupInstalled"), ("ENVIRONMENT-MIB", "nnenvPwrsupStatus"), ("ENVIRONMENT-MIB", "nnenvPwrsupType"), ("ENVIRONMENT-MIB", "nnenvPwrsupUptime"), ("ENVIRONMENT-MIB", "nnenvPwrsupDowntime"))
if mibBuilder.loadTexts: nnenvPowerSupply2UpNotification.setStatus('current')
if mibBuilder.loadTexts: nnenvPowerSupply2UpNotification.setDescription(' An envPowerNotification is sent if the environmental monitoring detects that a power supply has changed status. This notification is sent only if envEnablePowerNotification is set to true. ')
nnenvironementNotificationGroup = NotificationGroup((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 4)).setObjects(("ENVIRONMENT-MIB", "nnenvTemperatureNotification"), ("ENVIRONMENT-MIB", "nnenvFanNotification"), ("ENVIRONMENT-MIB", "nnenvPowerSupply1DownNotification"), ("ENVIRONMENT-MIB", "nnenvPowerSupply1UpNotification"), ("ENVIRONMENT-MIB", "nnenvPowerSupply2DownNotification"), ("ENVIRONMENT-MIB", "nnenvPowerSupply2UpNotification"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
nnenvironementNotificationGroup = nnenvironementNotificationGroup.setStatus('current')
if mibBuilder.loadTexts: nnenvironementNotificationGroup.setDescription('THE Envrionment MIB Notification Group')
mibBuilder.exportSymbols("ENVIRONMENT-MIB", nnenvPowerSupply1UpNotification=nnenvPowerSupply1UpNotification, nnenvEnableTemperatureNotification=nnenvEnableTemperatureNotification, nnenvObjects=nnenvObjects, nnenvPowerSupply1DownNotification=nnenvPowerSupply1DownNotification, nnenvPwrsupDowntime=nnenvPwrsupDowntime, nnenvTraps=nnenvTraps, nnenvPwrsupEntry=nnenvPwrsupEntry, nnenvPwrsupType=nnenvPwrsupType, nnenvEnablePowerNotification=nnenvEnablePowerNotification, nnenvNotifications=nnenvNotifications, nnenvFanNotification=nnenvFanNotification, nnenvEnableFanNotification=nnenvEnableFanNotification, nnenvPwrsupTable=nnenvPwrsupTable, EnvType=EnvType, nnenvFanTable=nnenvFanTable, EnvStatus=EnvStatus, nnenvironementNotificationGroup=nnenvironementNotificationGroup, PYSNMP_MODULE_ID=nnenvironmentMib, nnenvFanUnitIndex=nnenvFanUnitIndex, nnenvironmentMib=nnenvironmentMib, nnenvPwrsupUptime=nnenvPwrsupUptime, nnenvFanState=nnenvFanState, nnenvFanEntry=nnenvFanEntry, EnvState=EnvState, EnvInstalled=EnvInstalled, nnenvTempSensorGroup=nnenvTempSensorGroup, nnenvTemperatureNotification=nnenvTemperatureNotification, nnenvPowerSupply2UpNotification=nnenvPowerSupply2UpNotification, nnenvPowerSupply2DownNotification=nnenvPowerSupply2DownNotification, nnenvTempSensorState=nnenvTempSensorState, nnenvPwrsupPowerFailCount=nnenvPwrsupPowerFailCount, nnenvPwrsupStatus=nnenvPwrsupStatus, nnenvPwrsupIndex=nnenvPwrsupIndex, nnenvNotificationEnables=nnenvNotificationEnables, nnenvTempSensorValue=nnenvTempSensorValue, nnenvPwrsupInstalled=nnenvPwrsupInstalled)
| (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_intersection, value_range_constraint, single_value_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint', 'SingleValueConstraint', 'ConstraintsUnion')
(nt_enterprise_data_tasman_mgmt,) = mibBuilder.importSymbols('NT-ENTERPRISE-DATA-MIB', 'ntEnterpriseDataTasmanMgmt')
(module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup')
(iso, counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, bits, unsigned32, time_ticks, object_identity, ip_address, mib_identifier, counter64, module_identity, integer32, gauge32, notification_type) = mibBuilder.importSymbols('SNMPv2-SMI', 'iso', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Bits', 'Unsigned32', 'TimeTicks', 'ObjectIdentity', 'IpAddress', 'MibIdentifier', 'Counter64', 'ModuleIdentity', 'Integer32', 'Gauge32', 'NotificationType')
(truth_value, textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TruthValue', 'TextualConvention', 'DisplayString')
nnenvironment_mib = module_identity((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3))
nnenvironmentMib.setRevisions(('1900-08-18 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts:
nnenvironmentMib.setRevisionsDescriptions(('Initial version of Environment MIB.',))
if mibBuilder.loadTexts:
nnenvironmentMib.setLastUpdated('0008180000Z')
if mibBuilder.loadTexts:
nnenvironmentMib.setOrganization('Nortel Networks')
if mibBuilder.loadTexts:
nnenvironmentMib.setContactInfo(' Nortel Networks 8200 Dixie Road Brampton, Ontario L6T 5P6 Canada 1-800-4Nortel www.nortelnetworks.com ')
if mibBuilder.loadTexts:
nnenvironmentMib.setDescription('')
class Envstate(TextualConvention, Integer32):
description = 'Represents the state of a device being monitored.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4, 5))
named_values = named_values(('normal', 1), ('warning', 2), ('critical', 3), ('fail', 4), ('turned-off', 5))
class Envinstalled(TextualConvention, Integer32):
description = 'Installed flag for power supply.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2))
named_values = named_values(('not-installed', 1), ('installed', 2))
class Envstatus(TextualConvention, Integer32):
description = 'Installed flag for power supply.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3))
named_values = named_values(('absent', 1), ('failed', 2), ('normal', 3))
class Envtype(TextualConvention, Integer32):
description = 'Installed flag for power supply.'
status = 'current'
subtype_spec = Integer32.subtypeSpec + constraints_union(single_value_constraint(1, 2, 3, 4))
named_values = named_values(('supply-AC-ONLY', 1), ('supply-AC-PoE', 2), ('supply-DC', 3), ('unknown', 4))
nnenv_objects = mib_identifier((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1))
nnenv_notification_enables = mib_identifier((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 2))
nnenv_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3))
nnenv_traps = mib_identifier((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0))
nnenv_temp_sensor_group = mib_identifier((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 1))
nnenv_temp_sensor_value = mib_scalar((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 1, 1), gauge32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nnenvTempSensorValue.setStatus('current')
if mibBuilder.loadTexts:
nnenvTempSensorValue.setDescription(' The Average value of the temperature sensors. ')
nnenv_temp_sensor_state = mib_scalar((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 1, 2), env_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nnenvTempSensorState.setStatus('current')
if mibBuilder.loadTexts:
nnenvTempSensorState.setDescription(' The Average status of the temperature sensors. ')
nnenv_fan_table = mib_table((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 2))
if mibBuilder.loadTexts:
nnenvFanTable.setStatus('current')
if mibBuilder.loadTexts:
nnenvFanTable.setDescription('A list of fan unit entries.')
nnenv_fan_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 2, 1)).setIndexNames((0, 'ENVIRONMENT-MIB', 'nnenvFanUnitIndex'))
if mibBuilder.loadTexts:
nnenvFanEntry.setStatus('current')
if mibBuilder.loadTexts:
nnenvFanEntry.setDescription('Entry containing information about a fan within the chassis.')
nnenv_fan_unit_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 1))).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
nnenvFanUnitIndex.setStatus('current')
if mibBuilder.loadTexts:
nnenvFanUnitIndex.setDescription('The index to access an entry in the table. ')
nnenv_fan_state = mib_table_column((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 2, 1, 2), env_state()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nnenvFanState.setStatus('current')
if mibBuilder.loadTexts:
nnenvFanState.setDescription(' The current state of fan 0, normal/fail. ')
nnenv_pwrsup_power_fail_count = mib_scalar((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 3), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nnenvPwrsupPowerFailCount.setStatus('current')
if mibBuilder.loadTexts:
nnenvPwrsupPowerFailCount.setDescription('Number of failures of either power supply since boot-up.')
nnenv_pwrsup_table = mib_table((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4))
if mibBuilder.loadTexts:
nnenvPwrsupTable.setStatus('current')
if mibBuilder.loadTexts:
nnenvPwrsupTable.setDescription('A list of power supply status information.')
nnenv_pwrsup_entry = mib_table_row((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1)).setIndexNames((0, 'ENVIRONMENT-MIB', 'nnenvPwrsupIndex'))
if mibBuilder.loadTexts:
nnenvPwrsupEntry.setStatus('current')
if mibBuilder.loadTexts:
nnenvPwrsupEntry.setDescription('Entry containing power supply information.')
nnenv_pwrsup_index = mib_table_column((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2))).setMaxAccess('accessiblefornotify')
if mibBuilder.loadTexts:
nnenvPwrsupIndex.setStatus('current')
if mibBuilder.loadTexts:
nnenvPwrsupIndex.setDescription('Index to access entry.')
nnenv_pwrsup_installed = mib_table_column((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1, 2), env_installed()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nnenvPwrsupInstalled.setStatus('current')
if mibBuilder.loadTexts:
nnenvPwrsupInstalled.setDescription('Power supply installed flag.')
nnenv_pwrsup_status = mib_table_column((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1, 3), env_status()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nnenvPwrsupStatus.setStatus('current')
if mibBuilder.loadTexts:
nnenvPwrsupStatus.setDescription('Power supply up/down status.')
nnenv_pwrsup_type = mib_table_column((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1, 4), env_type()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nnenvPwrsupType.setStatus('current')
if mibBuilder.loadTexts:
nnenvPwrsupType.setDescription('Power supply type.')
nnenv_pwrsup_uptime = mib_table_column((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1, 5), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nnenvPwrsupUptime.setStatus('current')
if mibBuilder.loadTexts:
nnenvPwrsupUptime.setDescription('Seconds since power supply came up.')
nnenv_pwrsup_downtime = mib_table_column((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 1, 4, 1, 6), integer32()).setMaxAccess('readonly')
if mibBuilder.loadTexts:
nnenvPwrsupDowntime.setStatus('current')
if mibBuilder.loadTexts:
nnenvPwrsupDowntime.setDescription('Seconds since power supply went down.')
nnenv_enable_temperature_notification = mib_scalar((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 2, 1), truth_value().clone('true')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
nnenvEnableTemperatureNotification.setStatus('current')
if mibBuilder.loadTexts:
nnenvEnableTemperatureNotification.setDescription('Indicates whether the system produces the envTemperatureNotification. The default is yes. Note: implementation is TBD. ')
nnenv_enable_fan_notification = mib_scalar((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 2, 2), truth_value().clone('true')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
nnenvEnableFanNotification.setStatus('current')
if mibBuilder.loadTexts:
nnenvEnableFanNotification.setDescription('Indicates whether the system produces the envFanNotification. The default is yes. ')
nnenv_enable_power_notification = mib_scalar((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 2, 3), truth_value().clone('true')).setMaxAccess('readwrite')
if mibBuilder.loadTexts:
nnenvEnablePowerNotification.setStatus('current')
if mibBuilder.loadTexts:
nnenvEnablePowerNotification.setDescription('Indicates whether the system produces the envPowerNotification. The default is yes. ')
nnenv_temperature_notification = notification_type((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0, 1)).setObjects(('ENVIRONMENT-MIB', 'nnenvTempSensorValue'), ('ENVIRONMENT-MIB', 'nnenvTempSensorState'))
if mibBuilder.loadTexts:
nnenvTemperatureNotification.setStatus('current')
if mibBuilder.loadTexts:
nnenvTemperatureNotification.setDescription(' An envTemeratureNotification is sent if the environmental monitoring detects that the temperature is at a critical state. This may cause the system to shut down. This notification is sent only if envEnableTemperatureNotification is set to true. ')
nnenv_fan_notification = notification_type((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0, 2)).setObjects(('ENVIRONMENT-MIB', 'nnenvFanUnitIndex'), ('ENVIRONMENT-MIB', 'nnenvFanState'))
if mibBuilder.loadTexts:
nnenvFanNotification.setStatus('current')
if mibBuilder.loadTexts:
nnenvFanNotification.setDescription(' An envFanNotification is sent if the environmental monitoring detects that a fan is in a critical state. This may cause the system to shut down. This notification is sent only if envEnableFanNotification is set to true. ')
nnenv_power_supply1_down_notification = notification_type((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0, 3)).setObjects(('ENVIRONMENT-MIB', 'nnenvPwrsupPowerFailCount'), ('ENVIRONMENT-MIB', 'nnenvPwrsupIndex'), ('ENVIRONMENT-MIB', 'nnenvPwrsupInstalled'), ('ENVIRONMENT-MIB', 'nnenvPwrsupStatus'), ('ENVIRONMENT-MIB', 'nnenvPwrsupType'), ('ENVIRONMENT-MIB', 'nnenvPwrsupUptime'), ('ENVIRONMENT-MIB', 'nnenvPwrsupDowntime'))
if mibBuilder.loadTexts:
nnenvPowerSupply1DownNotification.setStatus('current')
if mibBuilder.loadTexts:
nnenvPowerSupply1DownNotification.setDescription(' An envPowerNotification is sent if the environmental monitoring detects that a power supply has changed status. This notification is sent only if envEnablePowerNotification is set to true. ')
nnenv_power_supply1_up_notification = notification_type((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0, 4)).setObjects(('ENVIRONMENT-MIB', 'nnenvPwrsupPowerFailCount'), ('ENVIRONMENT-MIB', 'nnenvPwrsupIndex'), ('ENVIRONMENT-MIB', 'nnenvPwrsupInstalled'), ('ENVIRONMENT-MIB', 'nnenvPwrsupStatus'), ('ENVIRONMENT-MIB', 'nnenvPwrsupType'), ('ENVIRONMENT-MIB', 'nnenvPwrsupUptime'), ('ENVIRONMENT-MIB', 'nnenvPwrsupDowntime'))
if mibBuilder.loadTexts:
nnenvPowerSupply1UpNotification.setStatus('current')
if mibBuilder.loadTexts:
nnenvPowerSupply1UpNotification.setDescription(' An envPowerNotification is sent if the environmental monitoring detects that a power supply has changed status. This notification is sent only if envEnablePowerNotification is set to true. ')
nnenv_power_supply2_down_notification = notification_type((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0, 5)).setObjects(('ENVIRONMENT-MIB', 'nnenvPwrsupPowerFailCount'), ('ENVIRONMENT-MIB', 'nnenvPwrsupIndex'), ('ENVIRONMENT-MIB', 'nnenvPwrsupInstalled'), ('ENVIRONMENT-MIB', 'nnenvPwrsupStatus'), ('ENVIRONMENT-MIB', 'nnenvPwrsupType'), ('ENVIRONMENT-MIB', 'nnenvPwrsupUptime'), ('ENVIRONMENT-MIB', 'nnenvPwrsupDowntime'))
if mibBuilder.loadTexts:
nnenvPowerSupply2DownNotification.setStatus('current')
if mibBuilder.loadTexts:
nnenvPowerSupply2DownNotification.setDescription(' An envPowerNotification is sent if the environmental monitoring detects that a power supply has changed status. This notification is sent only if envEnablePowerNotification is set to true. ')
nnenv_power_supply2_up_notification = notification_type((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 3, 0, 6)).setObjects(('ENVIRONMENT-MIB', 'nnenvPwrsupPowerFailCount'), ('ENVIRONMENT-MIB', 'nnenvPwrsupIndex'), ('ENVIRONMENT-MIB', 'nnenvPwrsupInstalled'), ('ENVIRONMENT-MIB', 'nnenvPwrsupStatus'), ('ENVIRONMENT-MIB', 'nnenvPwrsupType'), ('ENVIRONMENT-MIB', 'nnenvPwrsupUptime'), ('ENVIRONMENT-MIB', 'nnenvPwrsupDowntime'))
if mibBuilder.loadTexts:
nnenvPowerSupply2UpNotification.setStatus('current')
if mibBuilder.loadTexts:
nnenvPowerSupply2UpNotification.setDescription(' An envPowerNotification is sent if the environmental monitoring detects that a power supply has changed status. This notification is sent only if envEnablePowerNotification is set to true. ')
nnenvironement_notification_group = notification_group((1, 3, 6, 1, 4, 1, 562, 73, 1, 1, 1, 3, 4)).setObjects(('ENVIRONMENT-MIB', 'nnenvTemperatureNotification'), ('ENVIRONMENT-MIB', 'nnenvFanNotification'), ('ENVIRONMENT-MIB', 'nnenvPowerSupply1DownNotification'), ('ENVIRONMENT-MIB', 'nnenvPowerSupply1UpNotification'), ('ENVIRONMENT-MIB', 'nnenvPowerSupply2DownNotification'), ('ENVIRONMENT-MIB', 'nnenvPowerSupply2UpNotification'))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
nnenvironement_notification_group = nnenvironementNotificationGroup.setStatus('current')
if mibBuilder.loadTexts:
nnenvironementNotificationGroup.setDescription('THE Envrionment MIB Notification Group')
mibBuilder.exportSymbols('ENVIRONMENT-MIB', nnenvPowerSupply1UpNotification=nnenvPowerSupply1UpNotification, nnenvEnableTemperatureNotification=nnenvEnableTemperatureNotification, nnenvObjects=nnenvObjects, nnenvPowerSupply1DownNotification=nnenvPowerSupply1DownNotification, nnenvPwrsupDowntime=nnenvPwrsupDowntime, nnenvTraps=nnenvTraps, nnenvPwrsupEntry=nnenvPwrsupEntry, nnenvPwrsupType=nnenvPwrsupType, nnenvEnablePowerNotification=nnenvEnablePowerNotification, nnenvNotifications=nnenvNotifications, nnenvFanNotification=nnenvFanNotification, nnenvEnableFanNotification=nnenvEnableFanNotification, nnenvPwrsupTable=nnenvPwrsupTable, EnvType=EnvType, nnenvFanTable=nnenvFanTable, EnvStatus=EnvStatus, nnenvironementNotificationGroup=nnenvironementNotificationGroup, PYSNMP_MODULE_ID=nnenvironmentMib, nnenvFanUnitIndex=nnenvFanUnitIndex, nnenvironmentMib=nnenvironmentMib, nnenvPwrsupUptime=nnenvPwrsupUptime, nnenvFanState=nnenvFanState, nnenvFanEntry=nnenvFanEntry, EnvState=EnvState, EnvInstalled=EnvInstalled, nnenvTempSensorGroup=nnenvTempSensorGroup, nnenvTemperatureNotification=nnenvTemperatureNotification, nnenvPowerSupply2UpNotification=nnenvPowerSupply2UpNotification, nnenvPowerSupply2DownNotification=nnenvPowerSupply2DownNotification, nnenvTempSensorState=nnenvTempSensorState, nnenvPwrsupPowerFailCount=nnenvPwrsupPowerFailCount, nnenvPwrsupStatus=nnenvPwrsupStatus, nnenvPwrsupIndex=nnenvPwrsupIndex, nnenvNotificationEnables=nnenvNotificationEnables, nnenvTempSensorValue=nnenvTempSensorValue, nnenvPwrsupInstalled=nnenvPwrsupInstalled) |
# def combine_all(input):
# check1 = False
# check2 = False
# check3 = False
# if len(input) > 0:
# if input[0] == 'a':
# check1 = True
#
# main_s = []
# tmp_dict = {}
# for item in input:
# tmp_dict[item] = "0"
# if item not in ['a', 'b']:
# return False
#
# if item == "a":
# main_s.append(item)
# elif item == "b":
# try:
# main_s.pop()
# except:
# return False
#
# if len(tmp_dict.keys()) == 2:
# check2 = True
# if len(main_s) == 0:
# check3 = True
# if check1 and check2 and check3:
# return True
#
# return False
def longest_palidrom_substr(input_str):
l = 0
r = len(input_str)
counter = 0
while counter < r:
#print(input_str[counter:r])
if input_str[counter:r] == input_str[counter:r][::-1]:
return input_str[counter:r]
counter = counter + 1
counter = len(input_str)
while counter > l:
#print(input_str[l:counter])
if input_str[l:counter] == input_str[l:counter][::-1]:
return input_str[l:counter]
counter = counter - 1
return None
def get_sum_position(nums, target):
tmp_dict = {}
for i, item in enumerate(nums):
tmp_dict[item] = i
for i, item in enumerate(nums):
op = tmp_dict.get(target-item, None)
if op and op != i:
return [i, op]
return None
def findMedianSortedArrays(nums1, nums2):
p1 = 0
p2 = 0
op = []
while (p1 < len(nums1) and p2 < len(nums2)):
if nums1[p1] < nums2[p2]:
op.append(nums1[p1])
p1 += 1
else:
op.append(nums2[p2])
p2 += 1
op = op + nums1[p1:]
op = op + nums2[p2:]
print(op)
mid = (len(nums1) + len(nums2)) // 2
if (len(nums1) + len(nums2)) % 2 != 0:
return op[mid]
else:
return (op[mid-1] + op[mid]) / 2
def mergeTwoLists(l1, l2):
p1 = 0
p2 = 0
op = []
while (p1 < len(l1) and p2 < len(l2)):
if l1[p1] < l2[p2]:
op.append(l1[p1])
p1 += 1
else:
op.append(l2[p2])
p2 += 1
op = op + l1[p1:]
op = op + l2[p2:]
return op
def reverse(x):
if -2**31 <= x <= 2**31 -1 :
if x > 0:
return int(str(x)[::-1])
else:
return int(str(x*-1)[::-1])*-1
return 0
def shift_all_0_left(input_str):
input_str = list(input_str)
l = 0
r = len(input_str) - 1
while l < r:
if input_str[l] == '0':
l = l + 1
continue
if input_str[r] == '1':
r = r - 1
continue
input_str[l], input_str[r] = input_str[r], input_str[l]
l = l + 1
r = r - 1
return "".join(input_str)
def myAtoi(s):
s1 = s.rstrip()
s2 = s1.lstrip()
int_s = int(s2)
if -2147483648 <= int_s <= 2147483647:
return int_s
return 0
def threeSum(nums):
op = set()
for i in range(0,len(nums)):
for j in range(i,len(nums)):
for k in range(j,len(nums)):
if i !=j and i != k and j != k and (nums[i] + nums[j] + nums[k] == 0):
op.add((nums[i], nums[j], nums[k]))
return list(op)
def letterCombinations(digits):
chars_mapping = {
2 : ['a', 'b', 'c'],
3 : ['d','e','f'],
4 : ['g','h','i'],
5 : ['j','k','l'],
6 : ['m','n','o'],
7 : ['p','q','r','s'],
8 : ['t','u','v'],
9 : ['w','x','y','z']
}
if len(str(digits)) > 4 or len(str(digits)) <=0:
return None
else:
l_of_l = []
for c in str(digits):
l_of_l.append(chars_mapping.get(int(c)))
print(l_of_l)
def strStr(haystack, needle):
needle_len = len(needle)
i = 0
k = 0
while i < (len(haystack) - len(needle)):
if haystack[i] == needle[k]:
print()
i += 1
| def longest_palidrom_substr(input_str):
l = 0
r = len(input_str)
counter = 0
while counter < r:
if input_str[counter:r] == input_str[counter:r][::-1]:
return input_str[counter:r]
counter = counter + 1
counter = len(input_str)
while counter > l:
if input_str[l:counter] == input_str[l:counter][::-1]:
return input_str[l:counter]
counter = counter - 1
return None
def get_sum_position(nums, target):
tmp_dict = {}
for (i, item) in enumerate(nums):
tmp_dict[item] = i
for (i, item) in enumerate(nums):
op = tmp_dict.get(target - item, None)
if op and op != i:
return [i, op]
return None
def find_median_sorted_arrays(nums1, nums2):
p1 = 0
p2 = 0
op = []
while p1 < len(nums1) and p2 < len(nums2):
if nums1[p1] < nums2[p2]:
op.append(nums1[p1])
p1 += 1
else:
op.append(nums2[p2])
p2 += 1
op = op + nums1[p1:]
op = op + nums2[p2:]
print(op)
mid = (len(nums1) + len(nums2)) // 2
if (len(nums1) + len(nums2)) % 2 != 0:
return op[mid]
else:
return (op[mid - 1] + op[mid]) / 2
def merge_two_lists(l1, l2):
p1 = 0
p2 = 0
op = []
while p1 < len(l1) and p2 < len(l2):
if l1[p1] < l2[p2]:
op.append(l1[p1])
p1 += 1
else:
op.append(l2[p2])
p2 += 1
op = op + l1[p1:]
op = op + l2[p2:]
return op
def reverse(x):
if -2 ** 31 <= x <= 2 ** 31 - 1:
if x > 0:
return int(str(x)[::-1])
else:
return int(str(x * -1)[::-1]) * -1
return 0
def shift_all_0_left(input_str):
input_str = list(input_str)
l = 0
r = len(input_str) - 1
while l < r:
if input_str[l] == '0':
l = l + 1
continue
if input_str[r] == '1':
r = r - 1
continue
(input_str[l], input_str[r]) = (input_str[r], input_str[l])
l = l + 1
r = r - 1
return ''.join(input_str)
def my_atoi(s):
s1 = s.rstrip()
s2 = s1.lstrip()
int_s = int(s2)
if -2147483648 <= int_s <= 2147483647:
return int_s
return 0
def three_sum(nums):
op = set()
for i in range(0, len(nums)):
for j in range(i, len(nums)):
for k in range(j, len(nums)):
if i != j and i != k and (j != k) and (nums[i] + nums[j] + nums[k] == 0):
op.add((nums[i], nums[j], nums[k]))
return list(op)
def letter_combinations(digits):
chars_mapping = {2: ['a', 'b', 'c'], 3: ['d', 'e', 'f'], 4: ['g', 'h', 'i'], 5: ['j', 'k', 'l'], 6: ['m', 'n', 'o'], 7: ['p', 'q', 'r', 's'], 8: ['t', 'u', 'v'], 9: ['w', 'x', 'y', 'z']}
if len(str(digits)) > 4 or len(str(digits)) <= 0:
return None
else:
l_of_l = []
for c in str(digits):
l_of_l.append(chars_mapping.get(int(c)))
print(l_of_l)
def str_str(haystack, needle):
needle_len = len(needle)
i = 0
k = 0
while i < len(haystack) - len(needle):
if haystack[i] == needle[k]:
print()
i += 1 |
"""palavras = ("aprender", "programar", "linguagem", "python", "curso",
"gratis", "estudar", "praticar", "trabalhar", "mercado",
"programador", "futuro")
for p in palavras:
print(f"\n Na palavra {p.upper():-<20} temos:", end="")
for letra in p:
if letra.lower() in "aeiou":
print(f"{letra:.>7}", end="")
for j, i in enumerate(palavras):
print(f"\n No indice {j+1} tempos a palavra: {i.upper():=<20} ", end="")
for y in i:
if y.lower() in "aeiou0":
print(f"{y}", end="")"""
palavra = ("aprender", "programar", "linguagem", "python", "curso",
"gratis", "estudar", "praticar", "trabalhar", "mercado",
"programador", "futuro")
for c in palavra:
print(f"\no valor encontrado foi {c.upper():.<20}", end="")
for letras in c:
if letras.lower() in "aeiou":
print(f"{letras:.>7}", end="")
| """palavras = ("aprender", "programar", "linguagem", "python", "curso",
"gratis", "estudar", "praticar", "trabalhar", "mercado",
"programador", "futuro")
for p in palavras:
print(f"
Na palavra {p.upper():-<20} temos:", end="")
for letra in p:
if letra.lower() in "aeiou":
print(f"{letra:.>7}", end="")
for j, i in enumerate(palavras):
print(f"
No indice {j+1} tempos a palavra: {i.upper():=<20} ", end="")
for y in i:
if y.lower() in "aeiou0":
print(f"{y}", end="")"""
palavra = ('aprender', 'programar', 'linguagem', 'python', 'curso', 'gratis', 'estudar', 'praticar', 'trabalhar', 'mercado', 'programador', 'futuro')
for c in palavra:
print(f'\no valor encontrado foi {c.upper():.<20}', end='')
for letras in c:
if letras.lower() in 'aeiou':
print(f'{letras:.>7}', end='') |
myApp = App("chrome.app")
if not myApp.window(): # chrome not open
App.open("C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe")
wait(10)
myApp.focus()
wait(1)
wait("1392883544404.png", FOREVER)
click("1392883741646.png")
type("http://10.112.18.28/testcases/symbol/BoxMarkerSymbol.html\n")
wait("1392884154681.png", FOREVER)
click("1392882778695.png")
if exists("1392882825935.png"):
print("create box marker symbol success!")
else:
print("create box marker symbol fail!")
click("1392884525302.png")
if exists("1392884539217.png"):
print("create box marker symbol(json) success!")
else:
print("create box marker symbol(json) fail!")
doubleClick("1392885884712.png")
type("55000")
click("1392884721664.png")
if exists("1392884749355.png"):
print("set extent width success!")
else:
print("set extent width fail!")
doubleClick(find("1392885400212.png").right().find("1392885665897.png"))
type("90000")
click("1392884721664.png")
if exists("1392884874286.png"):
print("set extent height success!")
else:
print("set extent height fail!")
doubleClick(find("1392885422517.png").right().find("1392885665897.png"))
type("500000")
click("1392884721664.png")
if exists("1392884956412.png"):
print("set extent depth success!")
else:
print("set extent depth fail!")
click("1392884996587.png")
if exists("1392885018993.png"):
print("set tilt + 30 success!")
else:
print("set tilt + 30 fail!")
click("1392885066449.png")
click("1392885066449.png")
if exists("1392885097714.png"):
print("set tilt - 30 success!")
else:
print("set tilt - 30 fail!")
doubleClick("1392885160730.png")
type("145")
click("1392885184156.png")
if exists("1392885212829.png"):
print("set tilt success!")
else:
print("set tilt fail!")
click("1392886744095.png")
click("1392886744095.png")
click("1392886744095.png")
if exists("1392886801194.png"):
print("set heading + 30 success!")
else:
print("set heading + 30 fail!")
click("1392886838690.png")
click("1392886838690.png")
if exists("1392886861619.png"):
print("set heading - 30 success!")
else:
print("set heading - 30 fail!")
doubleClick(find("1392887108781.png").left().find("1392887121837.png"))
type("90")
click("1392887150799.png")
if exists("1392887181313.png"):
print("set heading success!")
else:
print("set heading fail!")
dragDrop("1392949672422.png","1392949687298.png" )
click("1392887213432.png")
click("1392887213432.png")
click("1392887213432.png")
if exists("1392887260658.png"):
print("set up offset success!")
else:
print("set up offset fail!")
| my_app = app('chrome.app')
if not myApp.window():
App.open('C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe')
wait(10)
myApp.focus()
wait(1)
wait('1392883544404.png', FOREVER)
click('1392883741646.png')
type('http://10.112.18.28/testcases/symbol/BoxMarkerSymbol.html\n')
wait('1392884154681.png', FOREVER)
click('1392882778695.png')
if exists('1392882825935.png'):
print('create box marker symbol success!')
else:
print('create box marker symbol fail!')
click('1392884525302.png')
if exists('1392884539217.png'):
print('create box marker symbol(json) success!')
else:
print('create box marker symbol(json) fail!')
double_click('1392885884712.png')
type('55000')
click('1392884721664.png')
if exists('1392884749355.png'):
print('set extent width success!')
else:
print('set extent width fail!')
double_click(find('1392885400212.png').right().find('1392885665897.png'))
type('90000')
click('1392884721664.png')
if exists('1392884874286.png'):
print('set extent height success!')
else:
print('set extent height fail!')
double_click(find('1392885422517.png').right().find('1392885665897.png'))
type('500000')
click('1392884721664.png')
if exists('1392884956412.png'):
print('set extent depth success!')
else:
print('set extent depth fail!')
click('1392884996587.png')
if exists('1392885018993.png'):
print('set tilt + 30 success!')
else:
print('set tilt + 30 fail!')
click('1392885066449.png')
click('1392885066449.png')
if exists('1392885097714.png'):
print('set tilt - 30 success!')
else:
print('set tilt - 30 fail!')
double_click('1392885160730.png')
type('145')
click('1392885184156.png')
if exists('1392885212829.png'):
print('set tilt success!')
else:
print('set tilt fail!')
click('1392886744095.png')
click('1392886744095.png')
click('1392886744095.png')
if exists('1392886801194.png'):
print('set heading + 30 success!')
else:
print('set heading + 30 fail!')
click('1392886838690.png')
click('1392886838690.png')
if exists('1392886861619.png'):
print('set heading - 30 success!')
else:
print('set heading - 30 fail!')
double_click(find('1392887108781.png').left().find('1392887121837.png'))
type('90')
click('1392887150799.png')
if exists('1392887181313.png'):
print('set heading success!')
else:
print('set heading fail!')
drag_drop('1392949672422.png', '1392949687298.png')
click('1392887213432.png')
click('1392887213432.png')
click('1392887213432.png')
if exists('1392887260658.png'):
print('set up offset success!')
else:
print('set up offset fail!') |
#!/usr/bin/env python
appd_auth = {
'controller': '',
'account': '',
'user': '',
'password': ''
}
APPD_APP = ''
APPD_TIER = ''
| appd_auth = {'controller': '', 'account': '', 'user': '', 'password': ''}
appd_app = ''
appd_tier = '' |
print("Hello World!")
print ("Hello Again")
print("I like typing this.")
print("This is fun.")
print('Yay! Printing.')
print("I'd much rather you 'not'.")
print('I "said" do not touch this.')
print('this command will print one line')
print('this\n command\n will\n print\n multiple\n lines')
# print('nevermind')
# --Output--
# Hello World!
# Hello Again
# I like typing this.
# This is fun.
# Yay! Printing.
# I'd much rather you 'not'.
# I "said" do not touch this.
# this command will print one line
# this
# command
# will
# print
# multiple
# lines
| print('Hello World!')
print('Hello Again')
print('I like typing this.')
print('This is fun.')
print('Yay! Printing.')
print("I'd much rather you 'not'.")
print('I "said" do not touch this.')
print('this command will print one line')
print('this\n command\n will\n print\n multiple\n lines') |
""" Python single line for loop """
# Generate a list of numbers range 0-10
number_list = [x for x in range(10)]
print("Number list: ", number_list)
# Generate a list of numbers range 0-10
even_number_list = [x for x in range(10) if x % 2 == 0]
print("Even number list: ", even_number_list)
# Multiple two lists
# It takes each element of list1 with each element
# of list2
list1 = [2, 4, 6]
list2 = [2, 4, 6]
list3 = [x * y for x in list1 for y in list2]
print(list3)
| """ Python single line for loop """
number_list = [x for x in range(10)]
print('Number list: ', number_list)
even_number_list = [x for x in range(10) if x % 2 == 0]
print('Even number list: ', even_number_list)
list1 = [2, 4, 6]
list2 = [2, 4, 6]
list3 = [x * y for x in list1 for y in list2]
print(list3) |
"""
entrada
a-->int-->a
b-->int-->b
c-->int-->c
salida
respuesta-->str-->resultado
"""
a, b, c, d = map(int, input("Digite los 4 datos: ").split())
if d==0 :
resultado = (a-c)**2
elif d>0 :
resultado = ((a-b)**3)/d
print("El resultado es: "+str (resultado))
| """
entrada
a-->int-->a
b-->int-->b
c-->int-->c
salida
respuesta-->str-->resultado
"""
(a, b, c, d) = map(int, input('Digite los 4 datos: ').split())
if d == 0:
resultado = (a - c) ** 2
elif d > 0:
resultado = (a - b) ** 3 / d
print('El resultado es: ' + str(resultado)) |
# Not runnable
end_point = "team/frc254"
url = f"https://www.thebluealliance.com/api/v3/{end_point}"
"https://www.thebluealliance.com/api/v3/team/frc254"
| end_point = 'team/frc254'
url = f'https://www.thebluealliance.com/api/v3/{end_point}'
'https://www.thebluealliance.com/api/v3/team/frc254' |
class DoublyLinkedListNode:
def __init__(self, node_data):
self.data = node_data
self.next = None
self.prev = None
def to_str(head):
data = []
while head:
data.append(str(head.data))
head = head.next
return ', '.join(data)
def reverse_recursive(head):
if head is None or head.next is None:
return head
new_head = reverse_recursive(head.next)
new_head.prev = head
head.next.next = head
head.next = None
return new_head
def reverse_iterative(head):
if head is None or head.next is None:
return head
current = head
new_head = DoublyLinkedListNode(current.data)
new_head_start = new_head
current = current.next
while current:
new = DoublyLinkedListNode(current.data)
new.prev = new_head
new_head.next = new
new_head = new
current = current.next
return new_head_start
if __name__ == '__main__':
h = DoublyLinkedListNode(0)
h_current = h
for x in range(1, 11):
n = DoublyLinkedListNode(x*2)
n.prev = h_current
h_current.next = n
h_current = n
print(to_str(h))
h = reverse_iterative(h)
print(to_str(h))
| class Doublylinkedlistnode:
def __init__(self, node_data):
self.data = node_data
self.next = None
self.prev = None
def to_str(head):
data = []
while head:
data.append(str(head.data))
head = head.next
return ', '.join(data)
def reverse_recursive(head):
if head is None or head.next is None:
return head
new_head = reverse_recursive(head.next)
new_head.prev = head
head.next.next = head
head.next = None
return new_head
def reverse_iterative(head):
if head is None or head.next is None:
return head
current = head
new_head = doubly_linked_list_node(current.data)
new_head_start = new_head
current = current.next
while current:
new = doubly_linked_list_node(current.data)
new.prev = new_head
new_head.next = new
new_head = new
current = current.next
return new_head_start
if __name__ == '__main__':
h = doubly_linked_list_node(0)
h_current = h
for x in range(1, 11):
n = doubly_linked_list_node(x * 2)
n.prev = h_current
h_current.next = n
h_current = n
print(to_str(h))
h = reverse_iterative(h)
print(to_str(h)) |
class Piece:
def __init__(self, index: int, piece_hash: bytes,
piece_length: int, block_length: int):
self.index = index
self.hash = piece_hash
self.piece_length = piece_length
self.block_length = block_length
self.blocks = [Block(i, i*block_length, block_length)
for i in range(piece_length // block_length)]
self.blocks.append(Block(len(self.blocks),
piece_length - block_length,
piece_length % block_length))
@property
def completed(self):
return all(block.state == Block.Have for block in self.blocks)
def __str__(self):
attributes = self.__dict__.items()
attributes = ', '.join(f'{key}={value}' for key, value in attributes)
return f'{self.__class__.__name__}({attributes})'
def __repr__(self):
return self.__str__()
class Block:
Missing = 0
Have = 1
Ongoing = 2
def __init__(self, index: int, offset: int, length: int):
self.index = index
self.offset = offset
self.length = length
self.state = Block.Missing
self.data = bytes(self.length)
def __str__(self):
attributes = self.__dict__.copy()
del attributes['data']
attributes = attributes.items()
attributes = ', '.join(f'{key}={value}' for key, value in attributes)
return f'{self.__class__.__name__}({attributes})'
def __repr__(self):
return self.__str__()
| class Piece:
def __init__(self, index: int, piece_hash: bytes, piece_length: int, block_length: int):
self.index = index
self.hash = piece_hash
self.piece_length = piece_length
self.block_length = block_length
self.blocks = [block(i, i * block_length, block_length) for i in range(piece_length // block_length)]
self.blocks.append(block(len(self.blocks), piece_length - block_length, piece_length % block_length))
@property
def completed(self):
return all((block.state == Block.Have for block in self.blocks))
def __str__(self):
attributes = self.__dict__.items()
attributes = ', '.join((f'{key}={value}' for (key, value) in attributes))
return f'{self.__class__.__name__}({attributes})'
def __repr__(self):
return self.__str__()
class Block:
missing = 0
have = 1
ongoing = 2
def __init__(self, index: int, offset: int, length: int):
self.index = index
self.offset = offset
self.length = length
self.state = Block.Missing
self.data = bytes(self.length)
def __str__(self):
attributes = self.__dict__.copy()
del attributes['data']
attributes = attributes.items()
attributes = ', '.join((f'{key}={value}' for (key, value) in attributes))
return f'{self.__class__.__name__}({attributes})'
def __repr__(self):
return self.__str__() |
a = list1[0]
list1[0] = "def"
list1.remove ( 3 )
list1.append ( 4 )
print ( list1 )
del list1[1:2]
print ( list1 )
| a = list1[0]
list1[0] = 'def'
list1.remove(3)
list1.append(4)
print(list1)
del list1[1:2]
print(list1) |
n = int(input())
v = []
trocas = 0
for i in range (n):
for j in range (5): #para coletar os elementos do vetor
v.append(int(input()))
for j in range (5): #para ordenar o vetor
for k in range (4):
if v[k] > v[k+1]:
t = v[k]
v[k] = v[k+1]
v[k+1] = t
trocas = trocas + 1 #para contar quantas trocas esse vetor fez
print(trocas)
trocas = 0
v = []
| n = int(input())
v = []
trocas = 0
for i in range(n):
for j in range(5):
v.append(int(input()))
for j in range(5):
for k in range(4):
if v[k] > v[k + 1]:
t = v[k]
v[k] = v[k + 1]
v[k + 1] = t
trocas = trocas + 1
print(trocas)
trocas = 0
v = [] |
junk_drawer = [3, 4]
# Using the list provided, add a pen, a scrap paper, a 7.3 and a True element
____
# ____
# ____
# ____
# What's the length of the list now?
# Save it in an object named drawer_length
# ____ = ____
# Slice the junk_drawer object to include the element 4 to scrap paper
# Save this in an object named cleaned_junk_drawer
# ____ = ____
# Next convert it into a set and name it junk_set
# ____ = ____.(____)
# ____
| junk_drawer = [3, 4]
____ |
# dictionary = {key: value for element in iterable}
fruits = ['apple', 'kiwi', 'banana', 'orange', 'apricot']
fruit_dict = {element: len(element) for element in
fruits if len(element) > 5}
print('\n'.join("{} {}".format(element, leng) for (element, leng) in fruit_dict.items())) | fruits = ['apple', 'kiwi', 'banana', 'orange', 'apricot']
fruit_dict = {element: len(element) for element in fruits if len(element) > 5}
print('\n'.join(('{} {}'.format(element, leng) for (element, leng) in fruit_dict.items()))) |
'''Memoization decorator for functions taking one or more arguments.
Copyright (c) 2018-2019 Machine Zone, Inc. All rights reserved.
'''
def memoize(f):
"""Memoization decorator for functions taking one or more arguments."""
class Memodict(dict):
'''Helper class derived from dict'''
def __init__(self, f):
'''Constructor'''
dict.__init__(self)
self.f = f
def __call__(self, *args):
'''Call function'''
return self[args]
def __missing__(self, key):
'''Missing method'''
ret = self[key] = self.f(*key)
return ret
return Memodict(f)
| """Memoization decorator for functions taking one or more arguments.
Copyright (c) 2018-2019 Machine Zone, Inc. All rights reserved.
"""
def memoize(f):
"""Memoization decorator for functions taking one or more arguments."""
class Memodict(dict):
"""Helper class derived from dict"""
def __init__(self, f):
"""Constructor"""
dict.__init__(self)
self.f = f
def __call__(self, *args):
"""Call function"""
return self[args]
def __missing__(self, key):
"""Missing method"""
ret = self[key] = self.f(*key)
return ret
return memodict(f) |
class QueryOperatorProcessor(object):
def __init__(self, dispatcher):
self.dispatcher = dispatcher
def process(self, child_nodes):
raise NotImplementedError()
def _process_node(self, node):
return self.dispatcher.dispatch(node)
def _process_all_nodes(self, nodes):
return [self._process_node(node) for node in nodes]
| class Queryoperatorprocessor(object):
def __init__(self, dispatcher):
self.dispatcher = dispatcher
def process(self, child_nodes):
raise not_implemented_error()
def _process_node(self, node):
return self.dispatcher.dispatch(node)
def _process_all_nodes(self, nodes):
return [self._process_node(node) for node in nodes] |
# SPDX-License-Identifier: MIT
# Copyright (c) 2021 Akumatic
#
# https://adventofcode.com/2021/day/17
def read_file(filename: str = "input.txt") -> list:
with open(f"{__file__.rstrip('code.py')}{filename}", "r") as f:
lines = [s[2:].split("..") for s in f.read().strip().replace("target area: ", "").split(", ")]
return [(int(lines[0][0]), int(lines[0][1])), (int(lines[1][0]), int(lines[1][1]))]
def fire_probe(vel_x, vel_y, goal_x, goal_y) -> tuple:
vx, vy = vel_x, vel_y
x, y = 0, 0
max_y = 0
while x + vx < goal_x.stop:
x += vx
y += vy
max_y = max(y, max_y)
vx += 0 if vx == 0 else -1 if vx > 0 else 1
vy -= 1
if vx == 0 and (x < goal_x.start or y < goal_y.start):
break
if x in goal_x and y in goal_y:
return vel_x, vel_y, max_y
return vel_x, vel_y, None
def brute_force(vals: list):
r_x = range(vals[0][0], vals[0][1] + 1)
r_y = range(vals[1][0], vals[1][1] + 1)
tmp = [fire_probe(x, y, r_x, r_y) for x in range(vals[0][1] + 1) for y in range(-100, 100)]
return [velocity for velocity in tmp if velocity[2] is not None]
def part1(velocities: list) -> int:
return max(velocities, key=lambda x: x[2])[2]
def part2(velocities: list) -> int:
return len(velocities)
if __name__ == "__main__":
vals = read_file()
vals = brute_force(vals)
print(f"Part 1: {part1(vals)}")
print(f"Part 2: {part2(vals)}")
| def read_file(filename: str='input.txt') -> list:
with open(f"{__file__.rstrip('code.py')}{filename}", 'r') as f:
lines = [s[2:].split('..') for s in f.read().strip().replace('target area: ', '').split(', ')]
return [(int(lines[0][0]), int(lines[0][1])), (int(lines[1][0]), int(lines[1][1]))]
def fire_probe(vel_x, vel_y, goal_x, goal_y) -> tuple:
(vx, vy) = (vel_x, vel_y)
(x, y) = (0, 0)
max_y = 0
while x + vx < goal_x.stop:
x += vx
y += vy
max_y = max(y, max_y)
vx += 0 if vx == 0 else -1 if vx > 0 else 1
vy -= 1
if vx == 0 and (x < goal_x.start or y < goal_y.start):
break
if x in goal_x and y in goal_y:
return (vel_x, vel_y, max_y)
return (vel_x, vel_y, None)
def brute_force(vals: list):
r_x = range(vals[0][0], vals[0][1] + 1)
r_y = range(vals[1][0], vals[1][1] + 1)
tmp = [fire_probe(x, y, r_x, r_y) for x in range(vals[0][1] + 1) for y in range(-100, 100)]
return [velocity for velocity in tmp if velocity[2] is not None]
def part1(velocities: list) -> int:
return max(velocities, key=lambda x: x[2])[2]
def part2(velocities: list) -> int:
return len(velocities)
if __name__ == '__main__':
vals = read_file()
vals = brute_force(vals)
print(f'Part 1: {part1(vals)}')
print(f'Part 2: {part2(vals)}') |
x = 0;
for i in range(1000000):
x = x + 1;
| x = 0
for i in range(1000000):
x = x + 1 |
N = int(input())
a = list(map(int, input().split()))
t = []
for i in range(N):
t.append([a[i], i])
t.sort(key=lambda x: x[0])
for i in t[::-1]:
print(i[1] + 1)
| n = int(input())
a = list(map(int, input().split()))
t = []
for i in range(N):
t.append([a[i], i])
t.sort(key=lambda x: x[0])
for i in t[::-1]:
print(i[1] + 1) |
#retomando clase pasada
#Estructura de datos
#################################
#listas
otra_lista = [1, 2, 3, 4 , 5, 6]
#Accediendo a los elementos de una lista
print(otra_lista[0])
print(otra_lista[-1])
#Slicing
print(otra_lista[0:3])
print(otra_lista[3:])
copia_lista = otra_lista
copia_lista.append(7)
print(otra_lista)
print(copia_lista)
##################
#estructura de control y de iteracion
#######################################
if True:
print("Es verdad")
semaforo = 'rojo'
if semaforo == 'rojo':
print('detenido')
elif semaforo == 'verde':
print('avanza')
else:
print('detente')
print('No esta en la lista') if 1 in otra_lista else print('No esta en la lista')
#while
while otra_lista != []:
elemento_borrado = otra_lista.pop()
print(f'Extraje elemento {elemento_borrado}') #interpolacion
while copia_lista:
elemento_borrado = copia_lista.pop()
print('Extraje elemento de copia_lista {}'.format(elemento_borrado)) #interpolacion
else:
print("No entro en el while:(")
#For
vocales = 'aeiou'
for vocal in vocales:
print(vocal)
vocales = 'aeiou'
for i in range(0, len(vocales)):
print(vocales[i])
for n in range(0, 101, 2):
print(n)
nueva_lista = [0, 1, 2['otra', 'lista',[3, 4, 5]]]
print(nueva_lista[3][2][0])
print(isinstance(nueva_lista,list))
print('*' * 5)
for i in nueva_lista:
if isinstance(i,list)== False:
print(i)
continue
for j in i:
if isinstance(j, list)== False:
print(j)
continue
for k in j:
print(k)
#listas comprimidas
pares = [ i for i in range(0, 101, 2) if i % 2==0]
print(pares)
impares = [ i for i in range(1, 100, 2) if i % 2==0]
print(impares)
# Function map()
animales= ['gato', 'perro', 'oso','leon', 'ballenaa']
print(list(map(str.upper, animales)))
################
#Tuplas
################
una_tupla=(1, 2, 3)
print(una_tupla)
tupla_comprimida = tuple( x for x in string.ascii.lowercase if x in 'aeiou')
print(tupla_comprimida)
#################
#Diccionarios
#################
mi_diccionario = {
'luis':['perro','gato'],
'daniela':['loro','gato'],
'romina':['camaleon','gato'],
}
print(mi_diccionario)
print(mi_diccionario['daniela'])
for key in mi_diccionario.keys():
print(f'key "{key}"')
for value in mi_diccionario.values():
print(f'Value "{value}"')
############################
#Funcion
###########################
def sum(a, b):
print(a+b)
def rest(a, b):
print(a - b)
def division(a, b):
print(a / b)
def multiplicacion(a, b):
print(a * b)
sum(5, 5)
rest(5, 5)
division(5, 5)
multiplicacion(5, 5)
#########################
#clases y objetos
########################
class Calculadora:
def __init__(self) -> None:
self.a = a
self.b = b
def suma(self) -> int:
print(self.a + self.b)
def __str__(self):
return '#### Numeros ###\nA: {self.a}\nB: {self.b}'
mi_calculadora = Calculadora(5,5)
mi_calculadora.suma
pass
| otra_lista = [1, 2, 3, 4, 5, 6]
print(otra_lista[0])
print(otra_lista[-1])
print(otra_lista[0:3])
print(otra_lista[3:])
copia_lista = otra_lista
copia_lista.append(7)
print(otra_lista)
print(copia_lista)
if True:
print('Es verdad')
semaforo = 'rojo'
if semaforo == 'rojo':
print('detenido')
elif semaforo == 'verde':
print('avanza')
else:
print('detente')
print('No esta en la lista') if 1 in otra_lista else print('No esta en la lista')
while otra_lista != []:
elemento_borrado = otra_lista.pop()
print(f'Extraje elemento {elemento_borrado}')
while copia_lista:
elemento_borrado = copia_lista.pop()
print('Extraje elemento de copia_lista {}'.format(elemento_borrado))
else:
print('No entro en el while:(')
vocales = 'aeiou'
for vocal in vocales:
print(vocal)
vocales = 'aeiou'
for i in range(0, len(vocales)):
print(vocales[i])
for n in range(0, 101, 2):
print(n)
nueva_lista = [0, 1, 2['otra', 'lista', [3, 4, 5]]]
print(nueva_lista[3][2][0])
print(isinstance(nueva_lista, list))
print('*' * 5)
for i in nueva_lista:
if isinstance(i, list) == False:
print(i)
continue
for j in i:
if isinstance(j, list) == False:
print(j)
continue
for k in j:
print(k)
pares = [i for i in range(0, 101, 2) if i % 2 == 0]
print(pares)
impares = [i for i in range(1, 100, 2) if i % 2 == 0]
print(impares)
animales = ['gato', 'perro', 'oso', 'leon', 'ballenaa']
print(list(map(str.upper, animales)))
una_tupla = (1, 2, 3)
print(una_tupla)
tupla_comprimida = tuple((x for x in string.ascii.lowercase if x in 'aeiou'))
print(tupla_comprimida)
mi_diccionario = {'luis': ['perro', 'gato'], 'daniela': ['loro', 'gato'], 'romina': ['camaleon', 'gato']}
print(mi_diccionario)
print(mi_diccionario['daniela'])
for key in mi_diccionario.keys():
print(f'key "{key}"')
for value in mi_diccionario.values():
print(f'Value "{value}"')
def sum(a, b):
print(a + b)
def rest(a, b):
print(a - b)
def division(a, b):
print(a / b)
def multiplicacion(a, b):
print(a * b)
sum(5, 5)
rest(5, 5)
division(5, 5)
multiplicacion(5, 5)
class Calculadora:
def __init__(self) -> None:
self.a = a
self.b = b
def suma(self) -> int:
print(self.a + self.b)
def __str__(self):
return '#### Numeros ###\nA: {self.a}\nB: {self.b}'
mi_calculadora = calculadora(5, 5)
mi_calculadora.suma
pass |
class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
dp = [1]*len(nums)
for i in range(1,len(nums)):
for j in range(i):
if nums[i] > nums[j]:
dp[i] = max( dp[i], dp[j]+1 )
return max(dp)
class SolutionII:
def lengthOfLIS(self, nums: List[int]) -> int:
sub = []
for num in nums:
i = bisect_left(sub, num)
if i == len(sub):
sub.append(num)
else:
sub[i] = num
return len(sub)
| class Solution:
def length_of_lis(self, nums: List[int]) -> int:
dp = [1] * len(nums)
for i in range(1, len(nums)):
for j in range(i):
if nums[i] > nums[j]:
dp[i] = max(dp[i], dp[j] + 1)
return max(dp)
class Solutionii:
def length_of_lis(self, nums: List[int]) -> int:
sub = []
for num in nums:
i = bisect_left(sub, num)
if i == len(sub):
sub.append(num)
else:
sub[i] = num
return len(sub) |
"""
https://leetcode.com/problems/find-first-palindromic-string-in-the-array
"""
# define an input for testing purposes
words = ["def", "ghi"]
# actual code to submit
def solution(words: str) -> str:
for word in words:
if word == word[::-1]:
return word
return ""
# use print statement to check if it works
print(solution(words))
# My Submission: https://leetcode.com/submissions/detail/610802135/
| """
https://leetcode.com/problems/find-first-palindromic-string-in-the-array
"""
words = ['def', 'ghi']
def solution(words: str) -> str:
for word in words:
if word == word[::-1]:
return word
return ''
print(solution(words)) |
def can_make_arithmetic_progression(arr):
arr = sorted(arr)
prev_diff = arr[1] - arr[0]
for i in range(1, len(arr)):
difference = arr[i] - arr[i - 1]
if not difference == prev_diff:
return False
prev_diff = difference
return True
print(can_make_arithmetic_progression([3, 5, 1]))
print(can_make_arithmetic_progression([1, 2, 4]))
| def can_make_arithmetic_progression(arr):
arr = sorted(arr)
prev_diff = arr[1] - arr[0]
for i in range(1, len(arr)):
difference = arr[i] - arr[i - 1]
if not difference == prev_diff:
return False
prev_diff = difference
return True
print(can_make_arithmetic_progression([3, 5, 1]))
print(can_make_arithmetic_progression([1, 2, 4])) |
"""Exceptions for NS."""
class NSError(Exception):
"""Generic NS exception."""
pass
class NSConnectionError(NSError):
"""NS connection exception."""
pass
| """Exceptions for NS."""
class Nserror(Exception):
"""Generic NS exception."""
pass
class Nsconnectionerror(NSError):
"""NS connection exception."""
pass |
""" This module holds some frequently used alogs """
# @param a and b two integers
# @return int gcd(a, b)
def gcd(a, b):
""" compute gcd a and b"""
if a == 0:
return b
if b == 0:
return a
return gcd(b, a % b)
# @param three integers a, b, m
# @return integer a^b mod m
def modulo_expo(a, b, m):
""" compute a^b mod m """
if b == 0:
return 1
temp = modulo_expo(a, b >> 2, m)
temp *= 2
if b & 1 > 0:
temp *= a
temp %= m
return temp
| """ This module holds some frequently used alogs """
def gcd(a, b):
""" compute gcd a and b"""
if a == 0:
return b
if b == 0:
return a
return gcd(b, a % b)
def modulo_expo(a, b, m):
""" compute a^b mod m """
if b == 0:
return 1
temp = modulo_expo(a, b >> 2, m)
temp *= 2
if b & 1 > 0:
temp *= a
temp %= m
return temp |
model_status = [
{ 'code': 0, 'description': 'Model uploaded'},
{ 'code': 1, 'description': 'File csv uploaded'},
{ 'code': 2, 'description': 'Send to elm'},
{ 'code': 3, 'description': 'Training', 'perc': 0},
{ 'code': 4, 'description': 'Done'}
] | model_status = [{'code': 0, 'description': 'Model uploaded'}, {'code': 1, 'description': 'File csv uploaded'}, {'code': 2, 'description': 'Send to elm'}, {'code': 3, 'description': 'Training', 'perc': 0}, {'code': 4, 'description': 'Done'}] |
class CmfParseError(Exception):
def __init__(self, parseinfo, msg):
self.message = '({}:{}) Error: {}'.format(
parseinfo.line + 1, parseinfo.pos, msg)
def __str__(self):
return self.message
| class Cmfparseerror(Exception):
def __init__(self, parseinfo, msg):
self.message = '({}:{}) Error: {}'.format(parseinfo.line + 1, parseinfo.pos, msg)
def __str__(self):
return self.message |
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def Watermelon(i):
w =i
result = "YES" if w%2 == 0 and w > 2 else "NO"
print(result + " " + str(i))
Watermelon(int(input()))
| def watermelon(i):
w = i
result = 'YES' if w % 2 == 0 and w > 2 else 'NO'
print(result + ' ' + str(i))
watermelon(int(input())) |
matrix = ["1.1 2.2 3.3", "4.4 5.5 6.6", "7.7 8.8 9.9"]
def transpose(matrix):
return [" ".join(row.split()[i] for row in matrix) for i in range(len(matrix))]
print(transpose(matrix))
| matrix = ['1.1 2.2 3.3', '4.4 5.5 6.6', '7.7 8.8 9.9']
def transpose(matrix):
return [' '.join((row.split()[i] for row in matrix)) for i in range(len(matrix))]
print(transpose(matrix)) |
print('Meta definition')
class Meta(type):
def __new__(mcs, name, bases, namespace):
print('Meta __new__:', mcs, name, namespace)
ret = type.__new__(mcs, name, bases, namespace) # class creation
print('Meta __new__ ret:', ret)
return ret
def __init__(cls, name, bases=None, namespace=None):
print('Meta __init__:', cls, name, bases, namespace)
super(Meta, cls).__init__(name, bases, namespace) # can be suppressed in some cases
print('Meta post __init__:', cls, name, bases, namespace)
def __call__(cls, *args, **kwargs):
print('Meta __call__:', cls, args, kwargs)
ret = type.__call__(cls, *args) # class instance creation
print('Meta __call__ ret:', ret)
print('Meta __call__ ret __dict__:', ret.__dict__)
return ret
print('\nBase definition')
class Base(metaclass=Meta):
def __new__(cls, *args, **kwargs):
print('Base __new__:', cls, args, kwargs)
ret = super(Base, cls).__new__(cls)
print('Base __new__ ret:', ret)
return ret
def __init__(self, *args, **kwargs):
print('Base __init__:', self, args, kwargs)
def __call__(self, *args, **kwargs):
print('Base __call__:', self, args, kwargs)
print('\nB definition')
class B(Base):
prop = True
def func(self):
pass
def __init__(self, p=2, *args):
super(B, self).__init__(*args, p=2)
self.p = p
print('\nCreate B instance')
b = B(1, p=2)
print('\nCall B instance')
b(3, b=4)
print('\nCreate Base2 class')
Base2 = Meta('Base2', (), {})
print('\nCreate B2 class')
B2 = type('B2', (Base2,), {}) # Meta will be used to create B2 class
print('\nCreate B2 instance')
b2 = B2()
print('\nTest B2 class')
def B2_call(self, *args, **kwargs):
print(self, args, kwargs)
B2.__call__ = B2_call
b2(1, a=2)
| print('Meta definition')
class Meta(type):
def __new__(mcs, name, bases, namespace):
print('Meta __new__:', mcs, name, namespace)
ret = type.__new__(mcs, name, bases, namespace)
print('Meta __new__ ret:', ret)
return ret
def __init__(cls, name, bases=None, namespace=None):
print('Meta __init__:', cls, name, bases, namespace)
super(Meta, cls).__init__(name, bases, namespace)
print('Meta post __init__:', cls, name, bases, namespace)
def __call__(cls, *args, **kwargs):
print('Meta __call__:', cls, args, kwargs)
ret = type.__call__(cls, *args)
print('Meta __call__ ret:', ret)
print('Meta __call__ ret __dict__:', ret.__dict__)
return ret
print('\nBase definition')
class Base(metaclass=Meta):
def __new__(cls, *args, **kwargs):
print('Base __new__:', cls, args, kwargs)
ret = super(Base, cls).__new__(cls)
print('Base __new__ ret:', ret)
return ret
def __init__(self, *args, **kwargs):
print('Base __init__:', self, args, kwargs)
def __call__(self, *args, **kwargs):
print('Base __call__:', self, args, kwargs)
print('\nB definition')
class B(Base):
prop = True
def func(self):
pass
def __init__(self, p=2, *args):
super(B, self).__init__(*args, p=2)
self.p = p
print('\nCreate B instance')
b = b(1, p=2)
print('\nCall B instance')
b(3, b=4)
print('\nCreate Base2 class')
base2 = meta('Base2', (), {})
print('\nCreate B2 class')
b2 = type('B2', (Base2,), {})
print('\nCreate B2 instance')
b2 = b2()
print('\nTest B2 class')
def b2_call(self, *args, **kwargs):
print(self, args, kwargs)
B2.__call__ = B2_call
b2(1, a=2) |
print("Input: ",end="")
a, b, t = 2020, 2021, int(input())
for i in range(t):
n = int(input("\n"))
def sum(x, a, b, check, n):
if x > n:
return
if check[x]:
return
check[x] = True
sum(x + a, a, b, check, n)
sum(x + b, a, b, check, n)
def sumPossible(n, a, b):
check = [False] * (n + 1)
sum(0, a, b, check, n)
return check[n]
if sumPossible(n, a, b):
print("Output: YES")
else:
print("Output: NO")
| print('Input: ', end='')
(a, b, t) = (2020, 2021, int(input()))
for i in range(t):
n = int(input('\n'))
def sum(x, a, b, check, n):
if x > n:
return
if check[x]:
return
check[x] = True
sum(x + a, a, b, check, n)
sum(x + b, a, b, check, n)
def sum_possible(n, a, b):
check = [False] * (n + 1)
sum(0, a, b, check, n)
return check[n]
if sum_possible(n, a, b):
print('Output: YES')
else:
print('Output: NO') |
class PROJECT(object):
NAME = "leafytracker"
DESC = "A set of tools to aggregate Leafy Games' developer posts for PULSAR: Lost Colony."
URL = "https://github.com/TomRichter/leafytracker"
VERSION = "0.0.0"
| class Project(object):
name = 'leafytracker'
desc = "A set of tools to aggregate Leafy Games' developer posts for PULSAR: Lost Colony."
url = 'https://github.com/TomRichter/leafytracker'
version = '0.0.0' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.