content stringlengths 7 1.05M |
|---|
S = [int(x) for x in input()]
N = len(S)
if S[0] == 0 or S[-1] == 1 or any(S[i] != S[-i - 2] for i in range(N - 1)):
print(-1)
quit()
edge = [(1, 2)]
root, now = 2, 3
for i in range(1, N // 2 + 1):
edge.append((root, now))
if S[i] == 1:
root = now
now += 1
while now <= N:
edge.append((root, now))
now += 1
for s, t in edge:
print(s, t)
|
MANO_CONF_ROOT_DIR = './'
# Attetion: pretrained detnet and iknet are only trained for left model! use left hand
DETECTION_MODEL_PATH = MANO_CONF_ROOT_DIR+'model/detnet/detnet.ckpt'
IK_MODEL_PATH = MANO_CONF_ROOT_DIR+'model/iknet/iknet.ckpt'
# Convert 'HAND_MESH_MODEL_PATH' to 'HAND_MESH_MODEL_PATH_JSON' with 'prepare_mano.py'
HAND_MESH_MODEL_LEFT_PATH_JSON = MANO_CONF_ROOT_DIR+'model/hand_mesh/mano_hand_mesh_left.json'
HAND_MESH_MODEL_RIGHT_PATH_JSON = MANO_CONF_ROOT_DIR+'model/hand_mesh/mano_hand_mesh_right.json'
OFFICIAL_MANO_LEFT_PATH = MANO_CONF_ROOT_DIR+'model/mano/MANO_LEFT.pkl'
OFFICIAL_MANO_RIGHT_PATH = MANO_CONF_ROOT_DIR+'model/mano/MANO_RIGHT.pkl'
IK_UNIT_LENGTH = 0.09473151311686484 # in meter
OFFICIAL_MANO_PATH_LEFT_JSON = MANO_CONF_ROOT_DIR+'model/mano_handstate/mano_left.json'
OFFICIAL_MANO_PATH_RIGHT_JSON = MANO_CONF_ROOT_DIR+'model/mano_handstate/mano_right.json' |
#
# 1a.
#
1 == 1
# => True
#
# 1b.
#
1 != 1
# => False
#
# 1c.
#
(5 + 2) == 7
# => True
#
# 1d.
#
(5 + 2) == '7'
# => False
#
# 1e.
#
2 != (2 - 1)
# => True
#
# 1f.
#
(2 > 1) or (2 < 1)
# => True
#
# 1g.
#
'tim' == 'tim' or 'tim' == 'alice'
# => True
#
# 1h.
#
'tim' == 'tim' and not 'alice' == 'alice'
# => False
#
# 2.
#
def is_negative(number):
if number < 0:
# There are other ways you could write this, for example using String's
# `format` method (Anna's favourite way 😉)
print(str(number) + " is negative")
print(is_negative(5))
print(is_negative(-1))
# -1 is negative
#
# 3.
#
def is_negative(number):
# You can also just write `return number < 0`, since this expression
# evaluates to either `True` or `False`. Clever, huh?
if number < 0:
return True
else:
return False
print(is_negative(-1))
# => True
#
# 4.
#
def can_redeem(cost_in_avios, total_balance, account_frozen):
if account_frozen:
# The member's account is frozen, so they cannot redeem
return False
elif cost_in_avios > total_balance:
# The member doesn't have enough Avios, so they can't redeem
return False
else:
# The member can redeem 🎉 Dusseldorf, here I come!
return True
# 1. The member has enough Avios, but their account is frozen
print(can_redeem(9000, 9000, True))
# => False
# 2. The member's account isn't frozen, but they don't have enough Avios
print(can_redeem(9000, 8000, False))
# => False
# 3. The member's account isn't frozen AND they have enough Avios 🎉
print(can_redeem(9000, 9000, False))
# => True
#
# 5.
#
def can_redeem(cost_in_avios, total_balance, account_frozen):
return total_balance >= cost_in_avios and not account_frozen
#
# 6.
#
def can_collect(account_frozen):
if account_frozen:
raise ValueError
try:
can_collect(True)
except ValueError:
print("The member can't collect 😭")
|
# PyAlgoTrade
#
# Copyright 2012 Gabriel Martin Becedillas Ruiz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
.. moduleauthor:: Gabriel Martin Becedillas Ruiz <gabriel.becedillas@gmail.com>
"""
def get_change_percentage(actual, prev):
if actual is None or prev is None or prev == 0:
raise Exception("Invalid values")
diff = actual-prev
ret = diff/float(abs(prev))
return ret
def lt(v1, v2):
if v1 == None:
return True
elif v2 == None:
return False
else:
return v1 < v2
# Returns (values, ix1, ix2)
# values1 and values2 are assumed to be sorted
def intersect(values1, values2, skipNone = False):
ix1 = []
ix2 = []
values = []
i1 = 0
i2 = 0
while i1 < len(values1) and i2 < len(values2):
v1 = values1[i1]
v2 = values2[i2]
if v1 == v2 and (v1 != None or skipNone == False):
ix1.append(i1)
ix2.append(i2)
values.append(v1)
i1 += 1
i2 += 1
elif lt(v1, v2):
i1 += 1
else:
i2 += 1
return (values, ix1, ix2) |
# MEDIUM
# sliding window size: [Start,i]
# increment start if window size - most frequent char > k
# time O(N) Space O(1)
class Solution:
def characterReplacement(self, s: str, k: int) -> int:
count = [0]* 26
result,gmax,start = 0,0,0
for i in range(len(s)):
count[ord(s[i])-ord('A')]+= 1
gmax = max(gmax,count[ord(s[i])-ord('A')])
while i -start +1 - gmax >k:
count[ord(s[start])-ord('A')]-=1
start += 1
result = max(result,i-start +1)
return result |
def urlopen():
pass
usocket = None
|
def LABELS():
LABELS1 = {
"1": "speed limit 30 (prohibitory)",
"0": "speed limit 20 (prohibitory)",
"2": "speed limit 50 (prohibitory)",
"3": "speed limit 60 (prohibitory)",
"4": "speed limit 70 (prohibitory)",
"5": "speed limit 80 (prohibitory)",
"6": "restriction ends 80 (other)",
"7": "speed limit 100 (prohibitory)",
"8": "speed limit 120 (prohibitory)",
"9": "no overtaking (prohibitory)",
"10": "no overtaking (trucks) (prohibitory)",
"11": "priority at next intersection (danger)",
"12": "priority road (other)",
"13": "give way (other)",
"14": "stop (other)",
"15": "no traffic both ways (prohibitory)",
"16": "no trucks (prohibitory)",
"17": "no entry (other)",
"18": "danger (danger)",
"19": "bend left (danger)",
"20": "bend right (danger)",
"21": "bend (danger)",
"22": "uneven road (danger)",
"23": "slippery road (danger)",
"24": "road narrows (danger)",
"25": "construction (danger)",
"26": "traffic signal (danger)",
"27": "pedestrian crossing (danger)",
"28": "school crossing (danger)",
"29": "cycles crossing (danger)",
"30": "snow (danger)",
"31": "animals (danger)",
"32": "restriction ends (other)",
"33": "go right (mandatory)",
"34": "go left (mandatory)",
"35": "go straight (mandatory)",
"36": "go right or straight (mandatory)",
"37": "go left or straight (mandatory)",
"38": "keep right (mandatory)",
"39": "keep left (mandatory)",
"40": "roundabout (mandatory)",
"41": "restriction ends (overtaking) (other)",
"42": "restriction ends (overtaking (trucks)) (other)"
}
return LABELS1 |
"""
Name: Srinivas Jakkula
CIS 41A Spring 2020
Unit G Take-Home Assignment
"""
def part1():
max_pop = 0
max_state = ""
file_obj = open("States.txt", "r")
for line in file_obj:
line_list = line.split()
pop = int(line_list[2])
if line_list[1] == "Midwest" and pop > max_pop:
max_pop = pop
max_state = line_list[0]
print(f"Highest population state in the Midwest is: {max_state} {max_pop}")
file_obj.close()
def part2_and_part3():
d = {}
f = open("USPresidents.txt")
for line in f:
(state_name, president_name) = line.split()
if state_name not in d:
d[state_name] = [president_name]
else:
d[state_name].append(president_name)
f.close()
# for k, v in d.items():
# print(k, v)
max_presidents = max(d, key=lambda k: len(d[k]))
print(f"The state with the most presidents is {max_presidents} with {len(d[max_presidents])} presidents:")
for president_name in d[max_presidents]:
print(president_name)
print()
d1 = {}
for k, v in d.items():
d1[k] = len(v)
# for k, v in d1.items():
# print(k, v)
most_pop_states = {"CA", "TX", "FL", "NY", "IL", "PA", "OH", "GA", "NC", "MI"}
new_set = {(k, d1.get(k, 0)) for k in most_pop_states if d1.get(k, 0) != 0}
print(f"{len(new_set)} of the {len(most_pop_states)} high populations states have had presidents born in them:")
for s, no_of_pre in sorted(new_set):
print(s, no_of_pre)
def main():
# print("Part 1 output")
part1()
print()
# print("Part 2 output")
part2_and_part3()
if __name__ == "__main__":
main()
'''
Execution results:
/usr/bin/python3 /Users/jakkus/PycharmProjects/CIS41A/CIS41A_UNITG_TAKEHOME_ASSIGNMENT_1.py
Highest population state in the Midwest is: IL 12802000
The state with the most presidents is VA with 8 presidents:
George_Washington
James_Madison
James_Monroe
John_Tyler
Thomas_Jefferson
William_Henry_Harrison
Woodrow_Wilson
Zachary_Taylor
8 of the 10 high populations states have had presidents born in them:
CA 1
GA 1
IL 1
NC 2
NY 5
OH 7
PA 1
TX 2
Process finished with exit code 0
''' |
"""
This module contains heuristic search algorithm
implemtations, like A*.
The ``lib.search.graph.Graph`` is supposed to be
used as a bases for these implementations.
"""
|
"""Application base, containing global templates."""
default_app_config = 'pontoon.base.apps.BaseConfig'
MOZILLA_REPOS = (
'ssh://hg.mozilla.org/users/m_owca.info/firefox-beta/',
'ssh://hg.mozilla.org/users/m_owca.info/firefox-for-android-beta/',
'ssh://hg.mozilla.org/users/m_owca.info/thunderbird-beta/',
'ssh://hg.mozilla.org/users/m_owca.info/lightning-beta/',
'ssh://hg.mozilla.org/users/m_owca.info/seamonkey-beta/',
'ssh://hg.mozilla.org/users/m_owca.info/firefox-aurora/',
'ssh://hg.mozilla.org/users/m_owca.info/firefox-for-android-aurora/',
'ssh://hg.mozilla.org/users/m_owca.info/thunderbird-aurora/',
'ssh://hg.mozilla.org/users/m_owca.info/lightning-aurora/',
'ssh://hg.mozilla.org/users/m_owca.info/seamonkey-aurora/',
)
|
def reverse(x: int):
"""
takes in integer and output it's reverse
"""
result = 0
if x < 0:
x = x*(-1)
a = -1
else:
a = 1
while x > 0:
carry = x%10
result = result*10+carry
x = x//10
result = result*a
if result < -2**31 or result > (2**31-1):
return 0
return result
print(reverse(12548963)) |
SKIP = 2
driver.add_pipeline('Create', [
Filter(Service, CreateService),
CreateCounter(),
Filter(Message, [UnitCreated]),
Timer('unit creation intervals', SKIP)
])
units_per_level = Counter('units ordered per level', LinearOrderExtended, lambda entry: entry[Size])
timing_freq = Timer('timing unit decision intervals', SKIP)
driver.add_pipeline('Ordering', [
Filter(Message, [NewTimingUnit, LinearOrderExtended]),
units_per_level,
Filter(Message, NewTimingUnit),
timing_freq,
TXPS(units_per_level, timing_freq)
])
driver.add_pipeline('Latency', [
Filter(Message, [UnitCreated, OwnUnitOrdered]),
Delay('Ordering latency', [UnitCreated], OwnUnitOrdered, lambda entry: entry[Height], SKIP),
])
|
# super() deep dive
# mechanism of super()
# super() can also take two parameter:
# the first is the subclass, the second is an object that is an instance of
# that subclass
class Rectangle:
def __init__(self, length, width):
self.length = length
self.width = width
def area(self):
return self.length * self.width
def perimeter(self):
return 2 * self.length * self.width
class Square(Rectangle):
def __init__(self, length):
super(Square, self).__init__(length, length)
# class Cube(Square):
# def surface_area(self):
# face_area = super(Square, self).area()
# return face_area * 6
# def volume(self):
# face_area = super(Square, self).area()
# return face_area * self.length
sq = Square(10)
print(sq.area(), sq.perimeter(), sep="\n")
# cu = Cube(20)
# print(cu.volume(), cu.surface_area(), sep="\n")
# the above example setting Square as the subclass argument to super(), instead
# of Cube. This causes super() to start searching for a matching method.
# super() in multiple inheritance
class Triangle:
def __init__(self, base, height):
self.base = base
self.height = height
def area(self):
return 0.5 * self.base * self.height
class RightPyramid(Triangle, Square):
def __init__(self, base, slant_height):
self.base = base
self.slant_height = slant_height
super().__init__(self.base) # the right way to calculate area()
def area(self):
base_area = super().area()
perimeter = super().perimeter()
return 0.5 * perimeter * self.slant_height + base_area
# pyramid = RightPyramid(2, 4)
# print(pyramid.area()) # AttributeError here. because the method resolution order
# MRO
# MRO tells Python how to search for inherited methods.
# this comes in handy when you're using super() because the MRO tells you
# exactly wher Python will look for a method you're calling with super() and in
# what order
print(RightPyramid.__mro__)
# super() will be searched first in RightPyramid, then in Triangle, then in
# Square, then in Rectangle. if nothing is found, in object from which all
# classes originate
# Multiple inheritance alternative - mixin
class VolumeMixin:
def volume(self):
return self.area() * self.height
class Cube(VolumeMixin, Square):
def __init__(self, length):
super().__init__(length)
self.height = length
def face_area(self):
return super().area()
def surface_area(self):
return super().area() * 6
test = Cube(10)
print(test.area(), test.face_area(), test.surface_area(), test.volume(), sep="\n")
|
#create list
List = [1,2,3,4]
Tuple = (8,1,2011)
print("Size of list:", List.__sizeof__())
print("Size of tuple:", Tuple.__sizeof__())
|
def categorize(biblio, root, directory_keyname, category_keyname):
skip_len = len(root) + 1
for book in biblio:
directory = book[directory_keyname]
structure = directory[skip_len:]
category = structure.split('\\')
book[category_keyname] = category
|
name, age = "Harikrishnan", 25
username = "hari94codes"
print ('Hello!')
print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
|
matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
somap = somac3 = p = 0
for l in range(0, 3):
for c in range(0, 3):
matriz[l][c] = int(input(f'Digite os números para compor a matriz na posição [{l}, {c}]: '))
for l in range(0, 3):
for c in range(0, 3):
print(f'[{matriz[l][c]:^7}]', end='')
print()
for l in range(0, 3):
if matriz[l][2] >= 0:
somac3 += matriz[l][2]
for c in range(0, 3):
if matriz[l][c] % 2 == 0:
somap += matriz[l][c]
if matriz[1][c] >= p:
p = matriz[1][c]
print()
print(f'A somatória de TODOS os números pares desta matriz vale {somap}.')
print(f'A soma dos valores da terceira coluna da matriz vale {somac3}.')
print(f'O maior número da segunda linha da matriz é {p}.')
|
wsHub = {
"endPoint": "ws://192.168.0.163:8080/",
"onConnection": "hubConnected",
"onReceived": "receivedNote",
}
wsHassio = {
"endPoint": "ws://192.168.0.163:8123/api/websocket",
"onConnection": "hassioConnected",
"onReceived": "receivedNotice",
}
wsClient = wsHub
ttyBridge = {
"onReceived": None,
"onConnection": None,
"connection" : {
'port' : '/dev/pts/0',
'speed' : 115200,
'timeout' : None,
'parity' : 'N', #None
'xonxoff' : 0,
'rtscts' : 0,
}
}
posixBridge = {
'osCommand' : '/smartRemote/nodes/ttyNode/runPosix.sh',
}
noteFilter = {
'zone': 'masterBedroom'
}
hassioEvents = {
"event_type": "notePublished",
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI1NmVhNzU3ODkzMDE0MTMzOTJhOTZiYmY3MTZiOWYyOCIsImlhdCI6MTYxNDc1NzQ2OSwiZXhwIjoxOTMwMTE3NDY5fQ.K2WwAh_9OjXZP5ciIcJ4lXYiLcSgLGrC6AgTPeIp8BY"
'''
Note: send hassio script events with the following format
service: script.publish_note
data:
note: {'title': 'notePubished event', 'content': {'controlWord': 'Ok', 'zone': 'livingRoom'}}
'controlWord' = Specify a control word to send the desired key press
'zone' = Specify the zone this node is running in.
***Review the ./zones directory for supported zones and control words
'''
}
|
def divide1(x, y):
try:
# Floor Division : Gives only Fractional Part as Answer
result = x // y
print("Yeah ! Your answer is :", result)
except ZeroDivisionError:
print("Sorry ! You are dividing by zero ")
def divide2(x, y):
try:
print(f'{x}/{y} is {x / y}')
except ZeroDivisionError as e:
print(e)
else:
print("divide() function worked fine.")
finally:
print("close all the resources here")
|
#!/usr/bin/env python
# -*-coding:UTF-8 -*-
class Stack(object):
def __init__(self):
self.stack = []
def push(self,object):
self.stack.append(object)
def pop(self):
return self.stack.pop()
def length(self):
return len(self.stack)
class Stack1(list):
#为栈接口提供push方法
def push(self,object):
self.append(object)
|
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
# base case
if len(nums) <= 1:
return len(nums)
count = 1
j = 1
for i in range(len(nums) - 1):
while j < len(nums):
if nums[i] == nums[j]:
j += 1
else:
nums[i+1] = nums[j]
count += 1
j += 1
break
return count
|
class Unit(object):
def __init__(self):
pass
def __str__(self):
pass
class Seconds(Unit):
def __init__(self):
super().__init__()
def __str__(self):
return "(s)"
|
# write a python program to add two numbers
num1 = 1.5
num2 = 6.3
sum = num1 + num2
print(f'Sum: {sum}')
# write a python function to add two user provided numbers and return the sum
def add_two_numbers(num1, num2):
sum = num1 + num2
return sum
# write a program to find and print the largest among three numbers
num1 = 10
num2 = 12
num3 = 14
if (num1 >= num2) and (num1 >= num3):
largest = num1
elif (num2 >= num1) and (num2 >= num3):
largest = num2
else:
largest = num3
print(f'largest:{largest}')
|
# Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# MAGIC %run ../../Includes/classroom-setup-dlt-demo
# COMMAND ----------
# MAGIC %md
# MAGIC If you have not previously configured this DLT pipeline successfully, the following cell prints out two values that will be used during the configuration steps that follow.
# COMMAND ----------
print(f"Target: {DA.db_name}")
print(f"Storage location: {DA.paths.storage_location}")
# COMMAND ----------
# MAGIC %md
# MAGIC ## Create and configure a pipeline
# MAGIC
# MAGIC The instructions below refer to the same pipeline created during the previous code along for DLT; if you successfully configured this notebook previously, you should not need to reconfigure this pipeline now.
# MAGIC
# MAGIC
# MAGIC Steps:
# MAGIC 1. Click the **Jobs** button on the sidebar,
# MAGIC 1. Select the **Delta Live Tables** tab.
# MAGIC 1. Click **Create Pipeline**.
# MAGIC 1. Fill in a **Pipeline Name** of your choosing.
# MAGIC 1. For **Notebook Libraries**, use the navigator to locate and select the companion notebook called **2 - DLT Job**.
# MAGIC 1. In the **Target** field, specify the database name printed out next to **Target** in the cell above. (This should follow the pattern **`dbacademy_<username>_dlt_demo`**)
# MAGIC 1. In the **Storage location** field, copy the directory as printed above.
# MAGIC 1. For **Pipeline Mode**, select **Triggered**
# MAGIC 1. Uncheck the **Enable autoscaling** box, and set the number of workers to 1.,
# MAGIC 1. Click **Create**.
# COMMAND ----------
# MAGIC %md-sandbox
# MAGIC © 2022 Databricks, Inc. All rights reserved.<br/>
# MAGIC Apache, Apache Spark, Spark and the Spark logo are trademarks of the <a href="https://www.apache.org/">Apache Software Foundation</a>.<br/>
# MAGIC <br/>
# MAGIC <a href="https://databricks.com/privacy-policy">Privacy Policy</a> | <a href="https://databricks.com/terms-of-use">Terms of Use</a> | <a href="https://help.databricks.com/">Support</a>
|
# -*- coding: utf-8 -*-
STATE_START = 1
STATE_EXPORT_CHOOSE_FORMAT = 1
STATE_EXPORT = 2
STATE_CHOOSE_EXECUTIVES = 2
STATE_CHOOSE_DOCUMENT = 3
STATE_CHOOSE_STAGE = 4
TRANSLATION_SERVICE_ID = CHAPTER_STATE_TRANSLATION = 1
EDITING_SERVICE_ID = CHAPTER_STATE_EDITING = 2
CHAPTER_STATE_FINAL_EDITING = 10
CHAPTER_STATE_PUBLISHED = 20
CHAPTER_STATUS_COMPLETED = 'completed'
CHAPTER_STATUS_IN_PROGRESS = 'inProgress'
CHAPTER_STAGE_NAMES = {
CHAPTER_STATE_TRANSLATION: 'Перевод',
CHAPTER_STATE_EDITING: 'Редактирование',
CHAPTER_STATE_FINAL_EDITING: 'Чистовик',
CHAPTER_STATE_PUBLISHED: 'Опубликовано',
}
PONY_CHUNK_LENGTH = 750
PONY_CHUNK_SENSITIVITY = 20
|
followers = {}
while True:
command = input().split(": ")
if command[0] == "Log out":
break
username = command[1]
if command[0] == "New follower":
if username not in followers:
followers[username] = (0, 0)
elif command[0] == "Like":
count = int(command[2])
if username not in followers:
followers[username] = (count, 0)
else:
followers[username] = ((followers[username])[0] + count, (followers[username])[1])
elif command[0] == "Comment":
if username not in followers:
followers[username] = (0, 1)
else:
followers[username] = ((followers[username])[0], (followers[username])[1] + 1)
elif command[0] == "Blocked":
if username not in followers:
print(f"{username} doesn't exist.")
else:
del followers[username]
print(f"{len(followers)} followers")
for k, v in sorted(followers.items(), key=lambda item: item[1][0], reverse=True):
print(f"{k}: {v[0] + v[1]}") |
BIRD = [212, 4]
REPTILE = [358, 4]
MOLLUSCS = [52, 4]
CHEPHALOPODS = [136, 5]
MAMMAL = [359, 4]
RODENTS = [1459, 5]
FISSIPEDIA = [732, 5]
MUSTELIDAE = [5307, 6] # badgers, weasels, martens, ferrets, minks and wolverines
CANIDAE = [9701, 6] # domestic dogs, wolves, foxes, jackals, coyotes,
CANIS = [5219142, 7] # Dogs and wolves
CANIS_LUPUS = [5219173, 8] # Dogs and wolves
VULPES = [5219234, 7] # Foxes
FELIDAE = [9703, 6] # Cats
FELIS = [2435022, 7] # Familiar domestic cat and its closest wild relatives
LEOPARDUS = [2434918, 7] # Familiar domestic cat and its closest wild relatives
PANTHERA = [2435194, 7] # Familiar domestic cat and its closest wild relatives
PRIMATES = [798, 5]
OLD_WORLD_MONKEYS = [9622, 6]
MAN_LIKE_PRIMATES = [5483, 6]
HOMINOIDS = [2436435, 7]
DOLPHIN_WHALES = [733, 5]
ODD_TOED_UNGULATES = [795, 5]
EQUIDAE = [795, 6]
AMPHISBAENIANS = [715, 5] # Snakes, geckos, lizards
RAY_FINNED_FISHES = [204, 5]
CARTILAGENOUS_FISHES = [121, 5]
INSECTS = [216, 4]
ARACHNIDS = [367, 4]
CNIDARIANS = [43, 4] # Jellyfish
BEINGS = [
BIRD,
REPTILE,
MOLLUSCS,
CHEPHALOPODS,
MAMMAL,
RODENTS,
FISSIPEDIA,
MUSTELIDAE,
CANIDAE,
CANIS,
VULPES,
FELIDAE,
FELIS,
LEOPARDUS,
PANTHERA,
PRIMATES,
OLD_WORLD_MONKEYS,
MAN_LIKE_PRIMATES,
HOMINOIDS,
DOLPHIN_WHALES,
ODD_TOED_UNGULATES,
EQUIDAE,
AMPHISBAENIANS,
RAY_FINNED_FISHES,
CARTILAGENOUS_FISHES,
INSECTS,
ARACHNIDS,
CNIDARIANS
]
|
"""
Data format for unit commitment problem
"""
IG = 1
PG = 2 |
# Copyright 2015-2017 Cisco Systems, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""RFC 2858 subsequent address family numbers"""
SAFNUM_UNICAST = 1
SAFNUM_MULCAST = 2
SAFNUM_UNIMULC = 3
SAFNUM_MPLS_LABEL = 4 # rfc3107
SAFNUM_MCAST_VPN = 5 # draft-ietf-l3vpn-2547bis-mcast-bgp-08.txt
SAFNUM_ENCAPSULATION = 7 # rfc5512
SAFNUM_TUNNEL = 64 # draft-nalawade-kapoor-tunnel-safi-02.txt
SAFNUM_VPLS = 65
SAFNUM_MDT = 66 # rfc6037
SAFNUM_EVPN = 70 # RFC 7432
SAFNUM_BGPLS = 71
SAFNUM_SRTE = 73
SAFNUM_LAB_VPNUNICAST = 128 # Draft-rosen-rfc2547bis-03
SAFNUM_LAB_VPNMULCAST = 129
SAFNUM_LAB_VPNUNIMULC = 130
SAFNUM_ROUTE_TARGET = 132 # RFC 4684 Constrained Route Distribution for BGP/MPLS IP VPN
SAFNUM_FSPEC_RULE = 133 # RFC 5575 BGP flow spec SAFI
SAFNUM_FSPEC_VPN_RULE = 134 # RFC 5575 BGP flow spec SAFI VPN
|
"""
This is multi-language commands list in order to use for visionRecog.py,
vision_recog_with_hotword.py and vision_recog_with_button.py.
This file contains the versions of English, Spanish and Japanese,
but you can edit and add commands in other languages by adding the following dictionary.
"""
words_dict = {
'en':
{
'talk_start_button':
'Push the button and say comands. "What is this?", "Can you read this?" or "What logo is this?"',
'command_list':
'List of valid commands',
'waiting_button':
'Waiting to push the button...',
'waiting_hotword':
'Waiting to hear the hotword',
'waiting_command':
'Waiting to hear the command...',
'talk_sorry':
'I\'m sorry. Please try to say again.',
'your_command':
'Your command...',
'finish_list':
['thanks',
'thank you',
'goodbye'],
'talk_finish':
'program ended',
'read_text':
['can you read this',
'can you read that'],
'read_logo':
["what logo is this",
"what logo is that"],
'not_logo':
'Sorry I don\'t know that logo',
'label_detect':
["what is this",
"what is that"],
'talk_again':
'I \'m sorry. I cannot hear you well. Please repeat again.',
'text_loaded':
'Text loaded is as follows:',
'text_original':
'Following is the original text:',
'text_resulted':
'Following is the translated result:'
},
'es':
{
'talk_start_button':
'Presione el botón y diga comandos. "¿Qué es esto?", "¿Puedes leer esto?" o "¿Qué logo es este?" ',
'command_list':
'Lista de comandos válidos',
'waiting_button':
'Esperando para presionar el botón ...',
'waiting_hotword':
'Esperando escuchar la palabra clave',
'waiting_command':
'Esperando escuchar la orden ...',
'talk_sorry':
'Lo siento. Por favor, intente decirlo de nuevo.',
'your_command':
'Tu orden ...',
'finish_list':
['gracias',
'muchas gracias',
'adiós',
'hasta luego'],
'talk_finish':
'programa finalizado',
'read_text':
['puedes leer esto',
'puedes leer este texto'],
'read_logo':
['qué logo es este',
'Conoces este logo',],
'not_logo':
'Lo siento mucho, pero no conozco este logo.',
'label_detect':
['qué es esto',
'qué es'],
'talk_again':
'Lo siento. No puedo oirle bien. Por favor, repita de nuevo.',
'text_loaded':
'El texto cargado es el siguiente:',
'text_original':
'El siguiente es el texto original:',
'text_resulted':
'A continuación se muestra el resultado traducido:'
},
'ja':
{
'talk_start_button':
'ボタンを押して、「これは何ですか」「これは何と読みますか」\n「このロゴは何ですか」などのコマンドを言ってください',
'command_list':
'有効なコマンド一覧',
'waiting_button':
'ボタンが押されるのを待っています...',
'waiting_hotword':
'ホットワードを聞き取り中...',
'waiting_command':
'コマンドを聞き取り中...',
'talk_sorry':
'申し訳ございません。もう一度言ってください',
'your_command':
'あなたのコマンド',
'finish_list':
['終',
'終了',
'終わり',
'さようなら',
'さよなら',
'ありがとう'],
'talk_finish':
'プログラムを終了しました',
'read_text':
['これは何と読みますか',
'この文章は何ですか',
'この文を読んで'],
'read_logo':
["このロゴは何ですか",
"このロゴを知ってますか"],
'not_logo':
'申し訳ございませんが、そのロゴは分かりません',
'label_detect':
["これは何ですか",
"あれは何ですか"],
'talk_again':
'うまく聞き取れませんでした。もう一度おっしゃってください',
'text_loaded':
'読み取った文章は、以下のとおりです',
'text_original':
'原文での表示結果は、以下のとおりです',
'text_resulted':
'結果は以下のとおりです。'
}
} |
"""Helper functions for small things done in many places."""
def dot_join(*args):
"""Join the args together."""
return '.'.join(args)
|
NAMESPACE_FILE = '/var/run/secrets/kubernetes.io/serviceaccount/namespace'
def get_k8s_namespace():
with open(NAMESPACE_FILE, 'r') as f:
return f.read()
|
# !/usr/bin/python
# -*- encoding: utf-8 -*-
"""
:开发者: 陈浩
:开发日期: 2018年12月5日
:邮箱地址: chenhao1010@163.com
:个人博客: https://www.chenhao-home.cn/
:开发芯片: ESP-32
:修订日志:
1、字符生成请使用PCtoLCD2002(完美版)
2、
3、
4、
5、
"""
byte = {
0xe696b0:
[
0x00,0x08,0x0C,0x7F,0x22,0x12,0x7F,0x7F,0x08,0x7F,0x08,0x3A,0x69,0x48,0x18,0x10,
0x00,0x06,0x78,0x60,0x60,0x60,0xFE,0xE4,0x64,0xE4,0x64,0x44,0x44,0xC4,0x84,0x84
],#新
0xe8b5b7:
[
0x00,0x08,0x08,0x3E,0x08,0x08,0x08,0x7F,0x0C,0x3C,0x2F,0x2C,0x3C,0x4C,0x47,0x00,
0x00,0x00,0xFC,0x04,0x04,0x04,0x7C,0x7C,0x40,0x40,0x46,0x46,0x7C,0x00,0xFE,0x00
],#起
0xe782b9:
[
0x00,0x01,0x01,0x01,0x01,0x01,0x1F,0x10,0x10,0x10,0x1F,0x00,0x34,0x26,0x62,0x00,
0x00,0x00,0x00,0xFC,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x00,0x4C,0x44,0x26,0x00
],#点
0xe699ba:
[
0x00,0x18,0x10,0x3F,0x24,0x7F,0x0C,0x1B,0x31,0x2F,0x08,0x0F,0x08,0x08,0x0F,0x08,
0x00,0x00,0x00,0xFC,0x24,0xA4,0x24,0x3C,0xC0,0xF8,0x18,0xF8,0x18,0x18,0xF8,0x18
],#智
0xe883bd:
[
0x00,0x08,0x18,0x36,0x23,0x7F,0x00,0x3F,0x23,0x3F,0x23,0x23,0x3F,0x23,0x27,0x20,
0x00,0x40,0x44,0x58,0x60,0xC2,0x7E,0x00,0x40,0x44,0x78,0x60,0x40,0x42,0x7E,0x00
],#能
0xe5aeb6:
[
0x00,0x01,0x01,0x7F,0x60,0x6F,0x03,0x07,0x39,0x63,0x0C,0x71,0x06,0x18,0x63,0x01,
0x00,0x80,0x80,0xFE,0x06,0xF6,0x00,0x08,0x98,0xF0,0xD0,0x58,0x4C,0x46,0x80,0x00
],#家
0xe5b185:
[
0x00,0x00,0x3F,0x30,0x3F,0x30,0x30,0x3F,0x30,0x30,0x27,0x24,0x24,0x67,0x44,0x00,
0x00,0x00,0xFC,0x0C,0xFC,0xC0,0xC0,0xFE,0xC0,0xC0,0xFC,0x0C,0x0C,0xFC,0x0C,0x00
],#居
0xe6b8a9:
[
0x00,0x00,0x33,0x12,0x03,0x42,0x32,0x03,0x00,0x17,0x34,0x24,0x24,0x64,0x5F,0x00,
0x00,0x00,0xF8,0x08,0xF8,0x08,0x08,0xF8,0x00,0xFC,0xA4,0xA4,0xA4,0xA4,0xFE,0x00
],#温
0xe6b9bf:
[
0x00,0x00,0x23,0x1A,0x03,0x02,0x62,0x33,0x00,0x04,0x14,0x22,0x22,0x60,0x4F,0x00,
0x00,0x00,0xFC,0x04,0xFC,0x04,0x04,0xFC,0x00,0x92,0x92,0x94,0x9C,0x90,0xFE,0x00
],#湿
0xe5baa6:
[
0x00,0x00,0x00,0x3F,0x22,0x22,0x2F,0x22,0x23,0x20,0x2F,0x23,0x21,0x60,0x47,0x08,
0x00,0x80,0x80,0xFC,0x10,0x10,0xFC,0x10,0xF0,0x00,0xF8,0x10,0xA0,0xC0,0x3E,0x02
],#度
0xe28483:
[
0x00,0x20,0x50,0x50,0x23,0x02,0x06,0x04,0x04,0x04,0x04,0x06,0x03,0x01,0x00,0x00,
0x00,0x00,0x00,0xF0,0x0C,0x04,0x00,0x00,0x00,0x00,0x04,0x04,0x0C,0xF8,0x00,0x00
],#℃
0xe2968f:
[
0x01,0x02,0x04,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x09,0x0A,0x0A,0x09,0x04,0x03,
0x80,0x40,0x20,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0x90,0x50,0x50,0x90,0x20,0xC0
], #温度计 "▏"
0xe29692:
[
0x00,0x01,0x01,0x02,0x02,0x02,0x06,0x04,0x0C,0x08,0x0A,0x0A,0x0D,0x04,0x03,0x00,
0x00,0x80,0x80,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x10,0xB0,0x20,0xC0,0x00
], # 湿度计 "▒"
} |
# PySNMP SMI module. Autogenerated from smidump -f python TOKEN-RING-RMON-MIB
# by libsmi2pysnmp-0.1.3 at Mon Apr 2 20:39:46 2012,
# Python version sys.version_info(major=2, minor=7, micro=2, releaselevel='final', serial=0)
# Imports
( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
( ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint")
( EntryStatus, OwnerString, history, rmon, statistics, ) = mibBuilder.importSymbols("RFC1271-MIB", "EntryStatus", "OwnerString", "history", "rmon", "statistics")
( Bits, Counter32, Integer32, Integer32, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, TimeTicks, ) = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Counter32", "Integer32", "Integer32", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "TimeTicks")
# Types
class MacAddress(OctetString):
subtypeSpec = OctetString.subtypeSpec+ValueSizeConstraint(6,6)
fixedLength = 6
class TimeInterval(Integer32):
pass
# Objects
tokenRingMLStatsTable = MibTable((1, 3, 6, 1, 2, 1, 16, 1, 2))
if mibBuilder.loadTexts: tokenRingMLStatsTable.setDescription("A list of Mac-Layer Token Ring statistics\nentries.")
tokenRingMLStatsEntry = MibTableRow((1, 3, 6, 1, 2, 1, 16, 1, 2, 1)).setIndexNames((0, "TOKEN-RING-RMON-MIB", "tokenRingMLStatsIndex"))
if mibBuilder.loadTexts: tokenRingMLStatsEntry.setDescription("A collection of Mac-Layer statistics kept for a\nparticular Token Ring interface.")
tokenRingMLStatsIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsIndex.setDescription("The value of this object uniquely identifies this\ntokenRingMLStats entry.")
tokenRingMLStatsDataSource = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 2), ObjectIdentifier()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tokenRingMLStatsDataSource.setDescription("This object identifies the source of the data\nthat this tokenRingMLStats entry is configured to\nanalyze. This source can be any tokenRing\ninterface on this device. In order to identify a\nparticular interface, this object shall identify\nthe instance of the ifIndex object, defined in\nMIB-II [3], for the desired interface. For\nexample, if an entry were to receive data from\ninterface #1, this object would be set to\nifIndex.1.\n\nThe statistics in this group reflect all error\nreports on the local network segment attached to\nthe identified interface.\n\nThis object may not be modified if the associated\ntokenRingMLStatsStatus object is equal to\nvalid(1).")
tokenRingMLStatsDropEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsDropEvents.setDescription("The total number of events in which packets were\ndropped by the probe due to lack of resources.\nNote that this number is not necessarily the\nnumber of packets dropped; it is just the number\nof times this condition has been detected. This\nvalue is the same as the corresponding\ntokenRingPStatsDropEvents.")
tokenRingMLStatsMacOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsMacOctets.setDescription("The total number of octets of data in MAC packets\n(excluding those that were not good frames)\nreceived on the network (excluding framing bits\nbut including FCS octets).")
tokenRingMLStatsMacPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsMacPkts.setDescription("The total number of MAC packets (excluding\npackets that were not good frames) received.")
tokenRingMLStatsRingPurgeEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsRingPurgeEvents.setDescription("The total number of times that the ring enters\nthe ring purge state from normal ring state. The\nring purge state that comes in response to the\nclaim token or beacon state is not counted.")
tokenRingMLStatsRingPurgePkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsRingPurgePkts.setDescription("The total number of ring purge MAC packets\ndetected by probe.")
tokenRingMLStatsBeaconEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsBeaconEvents.setDescription("The total number of times that the ring enters a\nbeaconing state (beaconFrameStreamingState,\nbeaconBitStreamingState,\nbeaconSetRecoveryModeState, or\nbeaconRingSignalLossState) from a non-beaconing\nstate. Note that a change of the source address\nof the beacon packet does not constitute a new\nbeacon event.")
tokenRingMLStatsBeaconTime = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 9), TimeInterval()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsBeaconTime.setDescription("The total amount of time that the ring has been\nin the beaconing state.")
tokenRingMLStatsBeaconPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsBeaconPkts.setDescription("The total number of beacon MAC packets detected\nby the probe.")
tokenRingMLStatsClaimTokenEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsClaimTokenEvents.setDescription("The total number of times that the ring enters\nthe claim token state from normal ring state or\nring purge state. The claim token state that\ncomes in response to a beacon state is not\ncounted.")
tokenRingMLStatsClaimTokenPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsClaimTokenPkts.setDescription("The total number of claim token MAC packets\ndetected by the probe.")
tokenRingMLStatsNAUNChanges = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsNAUNChanges.setDescription("The total number of NAUN changes detected by the\nprobe.")
tokenRingMLStatsLineErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsLineErrors.setDescription("The total number of line errors reported in error\nreporting packets detected by the probe.")
tokenRingMLStatsInternalErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsInternalErrors.setDescription("The total number of adapter internal errors\nreported in error reporting packets detected by\nthe probe.")
tokenRingMLStatsBurstErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsBurstErrors.setDescription("The total number of burst errors reported in\nerror reporting packets detected by the probe.")
tokenRingMLStatsACErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsACErrors.setDescription("The total number of AC (Address Copied) errors\nreported in error reporting packets detected by\nthe probe.")
tokenRingMLStatsAbortErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsAbortErrors.setDescription("The total number of abort delimiters reported in\nerror reporting packets detected by the probe.")
tokenRingMLStatsLostFrameErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsLostFrameErrors.setDescription("The total number of lost frame errors reported in\nerror reporting packets detected by the probe.")
tokenRingMLStatsCongestionErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsCongestionErrors.setDescription("The total number of receive congestion errors\nreported in error reporting packets detected by\nthe probe.")
tokenRingMLStatsFrameCopiedErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsFrameCopiedErrors.setDescription("The total number of frame copied errors reported\nin error reporting packets detected by the probe.")
tokenRingMLStatsFrequencyErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsFrequencyErrors.setDescription("The total number of frequency errors reported in\nerror reporting packets detected by the probe.")
tokenRingMLStatsTokenErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 23), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsTokenErrors.setDescription("The total number of token errors reported in\nerror reporting packets detected by the probe.")
tokenRingMLStatsSoftErrorReports = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 24), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsSoftErrorReports.setDescription("The total number of soft error report frames\ndetected by the probe.")
tokenRingMLStatsRingPollEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 25), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLStatsRingPollEvents.setDescription("The total number of ring poll events detected by\nthe probe (i.e. the number of ring polls initiated\nby the active monitor that were detected).")
tokenRingMLStatsOwner = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 26), OwnerString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tokenRingMLStatsOwner.setDescription("The base_entity that configured this entry and is\ntherefore using the resources assigned to it.")
tokenRingMLStatsStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 2, 1, 27), EntryStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tokenRingMLStatsStatus.setDescription("The status of this tokenRingMLStats entry.")
tokenRingPStatsTable = MibTable((1, 3, 6, 1, 2, 1, 16, 1, 3))
if mibBuilder.loadTexts: tokenRingPStatsTable.setDescription("A list of promiscuous Token Ring statistics\nentries.")
tokenRingPStatsEntry = MibTableRow((1, 3, 6, 1, 2, 1, 16, 1, 3, 1)).setIndexNames((0, "TOKEN-RING-RMON-MIB", "tokenRingPStatsIndex"))
if mibBuilder.loadTexts: tokenRingPStatsEntry.setDescription("A collection of promiscuous statistics kept for\nnon-MAC packets on a particular Token Ring\ninterface.")
tokenRingPStatsIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsIndex.setDescription("The value of this object uniquely identifies this\ntokenRingPStats entry.")
tokenRingPStatsDataSource = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 2), ObjectIdentifier()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tokenRingPStatsDataSource.setDescription("This object identifies the source of the data\nthat this tokenRingPStats entry is configured to\nanalyze. This source can be any tokenRing\ninterface on this device. In order to identify a\nparticular interface, this object shall identify\nthe instance of the ifIndex object, defined in\nMIB-II [3], for the desired interface. For\nexample, if an entry were to receive data from\ninterface #1, this object would be set to\nifIndex.1.\n\nThe statistics in this group reflect all non-MAC\npackets on the local network segment attached to\nthe identified interface.\n\nThis object may not be modified if the associated\ntokenRingPStatsStatus object is equal to\nvalid(1).")
tokenRingPStatsDropEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDropEvents.setDescription("The total number of events in which packets were\ndropped by the probe due to lack of resources.\nNote that this number is not necessarily the\nnumber of packets dropped; it is just the number\nof times this condition has been detected. This\nvalue is the same as the corresponding\ntokenRingMLStatsDropEvents")
tokenRingPStatsDataOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataOctets.setDescription("The total number of octets of data in good frames\nreceived on the network (excluding framing bits\nbut including FCS octets) in non-MAC packets.")
tokenRingPStatsDataPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataPkts.setDescription("The total number of non-MAC packets in good\nframes. received.")
tokenRingPStatsDataBroadcastPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataBroadcastPkts.setDescription("The total number of good non-MAC frames received\nthat were directed to an LLC broadcast address\n(0xFFFFFFFFFFFF or 0xC000FFFFFFFF).")
tokenRingPStatsDataMulticastPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataMulticastPkts.setDescription("The total number of good non-MAC frames received\nthat were directed to a local or global multicast\nor functional address. Note that this number does\nnot include packets directed to the broadcast\naddress.")
tokenRingPStatsDataPkts18to63Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataPkts18to63Octets.setDescription("The total number of good non-MAC frames received\nthat were between 18 and 63 octets in length\ninclusive, excluding framing bits but including\nFCS octets.")
tokenRingPStatsDataPkts64to127Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataPkts64to127Octets.setDescription("The total number of good non-MAC frames received\nthat were between 64 and 127 octets in length\ninclusive, excluding framing bits but including\nFCS octets.")
tokenRingPStatsDataPkts128to255Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataPkts128to255Octets.setDescription("The total number of good non-MAC frames received\nthat were between 128 and 255 octets in length\ninclusive, excluding framing bits but including\nFCS octets.")
tokenRingPStatsDataPkts256to511Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataPkts256to511Octets.setDescription("The total number of good non-MAC frames received\nthat were between 256 and 511 octets in length\ninclusive, excluding framing bits but including\nFCS octets.")
tokenRingPStatsDataPkts512to1023Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataPkts512to1023Octets.setDescription("The total number of good non-MAC frames received\nthat were between 512 and 1023 octets in length\ninclusive, excluding framing bits but including\nFCS octets.")
tokenRingPStatsDataPkts1024to2047Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataPkts1024to2047Octets.setDescription("The total number of good non-MAC frames received\nthat were between 1024 and 2047 octets in length\ninclusive, excluding framing bits but including\nFCS octets.")
tokenRingPStatsDataPkts2048to4095Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataPkts2048to4095Octets.setDescription("The total number of good non-MAC frames received\nthat were between 2048 and 4095 octets in length\ninclusive, excluding framing bits but including\nFCS octets.")
tokenRingPStatsDataPkts4096to8191Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataPkts4096to8191Octets.setDescription("The total number of good non-MAC frames received\nthat were between 4096 and 8191 octets in length\ninclusive, excluding framing bits but including\nFCS octets.")
tokenRingPStatsDataPkts8192to18000Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataPkts8192to18000Octets.setDescription("The total number of good non-MAC frames received\nthat were between 8192 and 18000 octets in length\ninclusive, excluding framing bits but including\nFCS octets.")
tokenRingPStatsDataPktsGreaterThan18000Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPStatsDataPktsGreaterThan18000Octets.setDescription("The total number of good non-MAC frames received\nthat were greater than 18000 octets in length,\nexcluding framing bits but including FCS octets.")
tokenRingPStatsOwner = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 18), OwnerString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tokenRingPStatsOwner.setDescription("The base_entity that configured this entry and is\ntherefore using the resources assigned to it.")
tokenRingPStatsStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 1, 3, 1, 19), EntryStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: tokenRingPStatsStatus.setDescription("The status of this tokenRingPStats entry.")
tokenRingMLHistoryTable = MibTable((1, 3, 6, 1, 2, 1, 16, 2, 3))
if mibBuilder.loadTexts: tokenRingMLHistoryTable.setDescription("A list of Mac-Layer Token Ring statistics\nentries.")
tokenRingMLHistoryEntry = MibTableRow((1, 3, 6, 1, 2, 1, 16, 2, 3, 1)).setIndexNames((0, "TOKEN-RING-RMON-MIB", "tokenRingMLHistoryIndex"), (0, "TOKEN-RING-RMON-MIB", "tokenRingMLHistorySampleIndex"))
if mibBuilder.loadTexts: tokenRingMLHistoryEntry.setDescription("A collection of Mac-Layer statistics kept for a\nparticular Token Ring interface.")
tokenRingMLHistoryIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryIndex.setDescription("The history of which this entry is a part. The\nhistory identified by a particular value of this\nindex is the same history as identified by the\nsame value of historyControlIndex.")
tokenRingMLHistorySampleIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistorySampleIndex.setDescription("An index that uniquely identifies the particular\nMac-Layer sample this entry represents among all\nMac-Layer samples associated with the same\nhistoryControlEntry. This index starts at 1 and\nincreases by one as each new sample is taken.")
tokenRingMLHistoryIntervalStart = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 3), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryIntervalStart.setDescription("The value of sysUpTime at the start of the\ninterval over which this sample was measured. If\nthe probe keeps track of the time of day, it\nshould start the first sample of the history at a\ntime such that when the next hour of the day\nbegins, a sample is started at that instant. Note\nthat following this rule may require the probe to\ndelay collecting the first sample of the history,\nas each sample must be of the same interval. Also\nnote that the sample which is currently being\ncollected is not accessible in this table until\nthe end of its interval.")
tokenRingMLHistoryDropEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryDropEvents.setDescription("The total number of events in which packets were\ndropped by the probe due to lack of resources\nduring this sampling interval. Note that this\nnumber is not necessarily the number of packets\ndropped, it is just the number of times this\ncondition has been detected.")
tokenRingMLHistoryMacOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryMacOctets.setDescription("The total number of octets of data in MAC packets\n(excluding those that were not good frames)\nreceived on the network during this sampling\ninterval (excluding framing bits but including FCS\noctets).")
tokenRingMLHistoryMacPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryMacPkts.setDescription("The total number of MAC packets (excluding those\nthat were not good frames) received during this\nsampling interval.")
tokenRingMLHistoryRingPurgeEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryRingPurgeEvents.setDescription("The total number of times that the ring entered\nthe ring purge state from normal ring state during\nthis sampling interval. The ring purge state that\ncomes from the claim token or beacon state is not\ncounted.")
tokenRingMLHistoryRingPurgePkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryRingPurgePkts.setDescription("The total number of Ring Purge MAC packets\ndetected by the probe during this sampling\ninterval.")
tokenRingMLHistoryBeaconEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryBeaconEvents.setDescription("The total number of times that the ring enters a\nbeaconing state (beaconFrameStreamingState,\nbeaconBitStreamingState,\nbeaconSetRecoveryModeState, or\nbeaconRingSignalLossState) during this sampling\ninterval. Note that a change of the source\naddress of the beacon packet does not constitute a\nnew beacon event.")
tokenRingMLHistoryBeaconTime = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 10), TimeInterval()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryBeaconTime.setDescription("The amount of time that the ring has been in the\nbeaconing state during this sampling interval.")
tokenRingMLHistoryBeaconPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryBeaconPkts.setDescription("The total number of beacon MAC packets detected\nby the probe during this sampling interval.")
tokenRingMLHistoryClaimTokenEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryClaimTokenEvents.setDescription("The total number of times that the ring enters\nthe claim token state from normal ring state or\nring purge state during this sampling interval.\nThe claim token state that comes from the beacon\nstate is not counted.")
tokenRingMLHistoryClaimTokenPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryClaimTokenPkts.setDescription("The total number of claim token MAC packets\ndetected by the probe during this sampling\ninterval.")
tokenRingMLHistoryNAUNChanges = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryNAUNChanges.setDescription("The total number of NAUN changes detected by the\nprobe during this sampling interval.")
tokenRingMLHistoryLineErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryLineErrors.setDescription("The total number of line errors reported in error\nreporting packets detected by the probe during\nthis sampling interval.")
tokenRingMLHistoryInternalErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryInternalErrors.setDescription("The total number of adapter internal errors\nreported in error reporting packets detected by\nthe probe during this sampling interval.")
tokenRingMLHistoryBurstErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryBurstErrors.setDescription("The total number of burst errors reported in\nerror reporting packets detected by the probe\nduring this sampling interval.")
tokenRingMLHistoryACErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryACErrors.setDescription("The total number of AC (Address Copied) errors\nreported in error reporting packets detected by\nthe probe during this sampling interval.")
tokenRingMLHistoryAbortErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryAbortErrors.setDescription("The total number of abort delimiters reported in\nerror reporting packets detected by the probe\nduring this sampling interval.")
tokenRingMLHistoryLostFrameErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryLostFrameErrors.setDescription("The total number of lost frame errors reported in\nerror reporting packets detected by the probe\nduring this sampling interval.")
tokenRingMLHistoryCongestionErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryCongestionErrors.setDescription("The total number of receive congestion errors\nreported in error reporting packets detected by\nthe probe during this sampling interval.")
tokenRingMLHistoryFrameCopiedErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryFrameCopiedErrors.setDescription("The total number of frame copied errors reported\nin error reporting packets detected by the probe\nduring this sampling interval.")
tokenRingMLHistoryFrequencyErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 23), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryFrequencyErrors.setDescription("The total number of frequency errors reported in\nerror reporting packets detected by the probe\nduring this sampling interval.")
tokenRingMLHistoryTokenErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 24), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryTokenErrors.setDescription("The total number of token errors reported in\nerror reporting packets detected by the probe\nduring this sampling interval.")
tokenRingMLHistorySoftErrorReports = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 25), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistorySoftErrorReports.setDescription("The total number of soft error report frames\ndetected by the probe during this sampling\ninterval.")
tokenRingMLHistoryRingPollEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 26), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryRingPollEvents.setDescription("The total number of ring poll events detected by\nthe probe during this sampling interval.")
tokenRingMLHistoryActiveStations = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 3, 1, 27), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingMLHistoryActiveStations.setDescription("The maximum number of active stations on the ring\ndetected by the probe during this sampling\ninterval.")
tokenRingPHistoryTable = MibTable((1, 3, 6, 1, 2, 1, 16, 2, 4))
if mibBuilder.loadTexts: tokenRingPHistoryTable.setDescription("A list of promiscuous Token Ring statistics\nentries.")
tokenRingPHistoryEntry = MibTableRow((1, 3, 6, 1, 2, 1, 16, 2, 4, 1)).setIndexNames((0, "TOKEN-RING-RMON-MIB", "tokenRingPHistoryIndex"), (0, "TOKEN-RING-RMON-MIB", "tokenRingPHistorySampleIndex"))
if mibBuilder.loadTexts: tokenRingPHistoryEntry.setDescription("A collection of promiscuous statistics kept for a\nparticular Token Ring interface.")
tokenRingPHistoryIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryIndex.setDescription("The history of which this entry is a part. The\nhistory identified by a particular value of this\nindex is the same history as identified by the\nsame value of historyControlIndex.")
tokenRingPHistorySampleIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistorySampleIndex.setDescription("An index that uniquely identifies the particular\nsample this entry represents among all samples\nassociated with the same historyControlEntry.\nThis index starts at 1 and increases by one as\neach new sample is taken.")
tokenRingPHistoryIntervalStart = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 3), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryIntervalStart.setDescription("The value of sysUpTime at the start of the\ninterval over which this sample was measured. If\nthe probe keeps track of the time of day, it\nshould start the first sample of the history at a\ntime such that when the next hour of the day\nbegins, a sample is started at that instant. Note\nthat following this rule may require the probe to\ndelay collecting the first sample of the history,\nas each sample must be of the same interval. Also\nnote that the sample which is currently being\ncollected is not accessible in this table until\nthe end of its interval.")
tokenRingPHistoryDropEvents = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDropEvents.setDescription("The total number of events in which packets were\ndropped by the probe due to lack of resources\nduring this sampling interval. Note that this\nnumber is not necessarily the number of packets\ndropped, it is just the number of times this\ncondition has been detected.")
tokenRingPHistoryDataOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataOctets.setDescription("The total number of octets of data in good frames\nreceived on the network (excluding framing bits\nbut including FCS octets) in non-MAC packets\nduring this sampling interval.")
tokenRingPHistoryDataPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataPkts.setDescription("The total number of good non-MAC frames received\nduring this sampling interval.")
tokenRingPHistoryDataBroadcastPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataBroadcastPkts.setDescription("The total number of good non-MAC frames received\nduring this sampling interval that were directed\nto an LLC broadcast address (0xFFFFFFFFFFFF or\n0xC000FFFFFFFF).")
tokenRingPHistoryDataMulticastPkts = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataMulticastPkts.setDescription("The total number of good non-MAC frames received\nduring this sampling interval that were directed\nto a local or global multicast or functional\naddress. Note that this number does not include\npackets directed to the broadcast address.")
tokenRingPHistoryDataPkts18to63Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataPkts18to63Octets.setDescription("The total number of good non-MAC frames received\nduring this sampling interval that were between 18\nand 63 octets in length inclusive, excluding\nframing bits but including FCS octets.")
tokenRingPHistoryDataPkts64to127Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataPkts64to127Octets.setDescription("The total number of good non-MAC frames received\nduring this sampling interval that were between 64\nand 127 octets in length inclusive, excluding\nframing bits but including FCS octets.")
tokenRingPHistoryDataPkts128to255Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataPkts128to255Octets.setDescription("The total number of good non-MAC frames received\nduring this sampling interval that were between\n128 and 255 octets in length inclusive, excluding\nframing bits but including FCS octets.")
tokenRingPHistoryDataPkts256to511Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataPkts256to511Octets.setDescription("The total number of good non-MAC frames received\nduring this sampling interval that were between\n256 and 511 octets in length inclusive, excluding\nframing bits but including FCS octets.")
tokenRingPHistoryDataPkts512to1023Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataPkts512to1023Octets.setDescription("The total number of good non-MAC frames received\nduring this sampling interval that were between\n512 and 1023 octets in length inclusive, excluding\nframing bits but including FCS octets.")
tokenRingPHistoryDataPkts1024to2047Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataPkts1024to2047Octets.setDescription("The total number of good non-MAC frames received\nduring this sampling interval that were between\n1024 and 2047 octets in length inclusive,\nexcluding framing bits but including FCS octets.")
tokenRingPHistoryDataPkts2048to4095Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataPkts2048to4095Octets.setDescription("The total number of good non-MAC frames received\nduring this sampling interval that were between\n2048 and 4095 octets in length inclusive,\nexcluding framing bits but including FCS octets.")
tokenRingPHistoryDataPkts4096to8191Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataPkts4096to8191Octets.setDescription("The total number of good non-MAC frames received\nduring this sampling interval that were between\n4096 and 8191 octets in length inclusive,\nexcluding framing bits but including FCS octets.")
tokenRingPHistoryDataPkts8192to18000Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataPkts8192to18000Octets.setDescription("The total number of good non-MAC frames received\nduring this sampling interval that were between\n8192 and 18000 octets in length inclusive,\nexcluding framing bits but including FCS octets.")
tokenRingPHistoryDataPktsGreaterThan18000Octets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 2, 4, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: tokenRingPHistoryDataPktsGreaterThan18000Octets.setDescription("The total number of good non-MAC frames received\nduring this sampling interval that were greater\nthan 18000 octets in length, excluding framing\nbits but including FCS octets.")
tokenRing = MibIdentifier((1, 3, 6, 1, 2, 1, 16, 10))
ringStationControlTable = MibTable((1, 3, 6, 1, 2, 1, 16, 10, 1))
if mibBuilder.loadTexts: ringStationControlTable.setDescription("A list of ringStation table control entries.")
ringStationControlEntry = MibTableRow((1, 3, 6, 1, 2, 1, 16, 10, 1, 1)).setIndexNames((0, "TOKEN-RING-RMON-MIB", "ringStationControlIfIndex"))
if mibBuilder.loadTexts: ringStationControlEntry.setDescription("A list of parameters that set up the discovery of\nstations on a particular interface and the\ncollection of statistics about these stations.")
ringStationControlIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationControlIfIndex.setDescription("The value of this object uniquely identifies the\ninterface on this remote network monitoring device\nfrom which ringStation data is collected. The\ninterface identified by a particular value of this\nobject is the same interface as identified by the\nsame value of the ifIndex object, defined in MIB-\nII [3].")
ringStationControlTableSize = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 1, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationControlTableSize.setDescription("The number of ringStationEntries in the\nringStationTable associated with this\nringStationControlEntry.")
ringStationControlActiveStations = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 1, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationControlActiveStations.setDescription("The number of active ringStationEntries in the\nringStationTable associated with this\nringStationControlEntry.")
ringStationControlRingState = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 1, 1, 4), Integer().subtype(subtypeSpec=SingleValueConstraint(3,5,2,7,4,6,1,)).subtype(namedValues=NamedValues(("normalOperation", 1), ("ringPurgeState", 2), ("claimTokenState", 3), ("beaconFrameStreamingState", 4), ("beaconBitStreamingState", 5), ("beaconRingSignalLossState", 6), ("beaconSetRecoveryModeState", 7), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationControlRingState.setDescription("The current status of this ring.")
ringStationControlBeaconSender = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 1, 1, 5), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationControlBeaconSender.setDescription("The address of the sender of the last beacon\nframe received by the probe on this ring. If no\nbeacon frames have been received, this object\nshall be equal to six octets of zero.")
ringStationControlBeaconNAUN = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 1, 1, 6), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationControlBeaconNAUN.setDescription("The address of the NAUN in the last beacon frame\nreceived by the probe on this ring. If no beacon\nframes have been received, this object shall be\nequal to six octets of zero.")
ringStationControlActiveMonitor = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 1, 1, 7), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationControlActiveMonitor.setDescription("The address of the Active Monitor on this\nsegment. If this address is unknown, this object\nshall be equal to six octets of zero.")
ringStationControlOrderChanges = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 1, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationControlOrderChanges.setDescription("The number of add and delete events in the\nringStationOrderTable optionally associated with\nthis ringStationControlEntry.")
ringStationControlOwner = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 1, 1, 9), OwnerString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ringStationControlOwner.setDescription("The base_entity that configured this entry and is\ntherefore using the resources assigned to it.")
ringStationControlStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 1, 1, 10), EntryStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ringStationControlStatus.setDescription("The status of this ringStationControl entry.\n\nIf this object is not equal to valid(1), all\nassociated entries in the ringStationTable shall\nbe deleted by the agent.")
ringStationTable = MibTable((1, 3, 6, 1, 2, 1, 16, 10, 2))
if mibBuilder.loadTexts: ringStationTable.setDescription("A list of ring station entries. An entry will\nexist for each station that is now or has\npreviously been detected as physically present on\nthis ring.")
ringStationEntry = MibTableRow((1, 3, 6, 1, 2, 1, 16, 10, 2, 1)).setIndexNames((0, "TOKEN-RING-RMON-MIB", "ringStationIfIndex"), (0, "TOKEN-RING-RMON-MIB", "ringStationMacAddress"))
if mibBuilder.loadTexts: ringStationEntry.setDescription("A collection of statistics for a particular\nstation that has been discovered on a ring\nmonitored by this device.")
ringStationIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationIfIndex.setDescription("The value of this object uniquely identifies the\ninterface on this remote network monitoring device\non which this station was detected. The interface\nidentified by a particular value of this object is\nthe same interface as identified by the same value\nof the ifIndex object, defined in MIB-II [3].")
ringStationMacAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationMacAddress.setDescription("The physical address of this station.")
ringStationLastNAUN = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 3), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationLastNAUN.setDescription("The physical address of last known NAUN of this\nstation.")
ringStationStationStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 4), Integer().subtype(subtypeSpec=SingleValueConstraint(1,3,2,)).subtype(namedValues=NamedValues(("active", 1), ("inactive", 2), ("forcedRemoval", 3), ))).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationStationStatus.setDescription("The status of this station on the ring.")
ringStationLastEnterTime = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 5), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationLastEnterTime.setDescription("The value of sysUpTime at the time this station\nlast entered the ring. If the time is unknown,\nthis value shall be zero.")
ringStationLastExitTime = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 6), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationLastExitTime.setDescription("The value of sysUpTime at the time the probe\ndetected that this station last exited the ring.\nIf the time is unknown, this value shall be zero.")
ringStationDuplicateAddresses = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationDuplicateAddresses.setDescription("The number of times this station experienced a\nduplicate address error.")
ringStationInLineErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationInLineErrors.setDescription("The total number of line errors reported by this\nstation in error reporting packets detected by the\nprobe.")
ringStationOutLineErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationOutLineErrors.setDescription("The total number of line errors reported in error\nreporting packets sent by the nearest active\ndownstream neighbor of this station and detected\nby the probe.")
ringStationInternalErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationInternalErrors.setDescription("The total number of adapter internal errors\nreported by this station in error reporting\npackets detected by the probe.")
ringStationInBurstErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationInBurstErrors.setDescription("The total number of burst errors reported by this\nstation in error reporting packets detected by the\nprobe.")
ringStationOutBurstErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationOutBurstErrors.setDescription("The total number of burst errors reported in\nerror reporting packets sent by the nearest active\ndownstream neighbor of this station and detected\nby the probe.")
ringStationACErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationACErrors.setDescription("The total number of AC (Address Copied) errors\nreported in error reporting packets sent by the\nnearest active downstream neighbor of this station\nand detected by the probe.")
ringStationAbortErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationAbortErrors.setDescription("The total number of abort delimiters reported by\nthis station in error reporting packets detected\nby the probe.")
ringStationLostFrameErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationLostFrameErrors.setDescription("The total number of lost frame errors reported by\nthis station in error reporting packets detected\nby the probe.")
ringStationCongestionErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationCongestionErrors.setDescription("The total number of receive congestion errors\nreported by this station in error reporting\npackets detected by the probe.")
ringStationFrameCopiedErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationFrameCopiedErrors.setDescription("The total number of frame copied errors reported\nby this station in error reporting packets\ndetected by the probe.")
ringStationFrequencyErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationFrequencyErrors.setDescription("The total number of frequency errors reported by\nthis station in error reporting packets detected\nby the probe.")
ringStationTokenErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationTokenErrors.setDescription("The total number of token errors reported by this\nstation in error reporting frames detected by the\nprobe.")
ringStationInBeaconErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationInBeaconErrors.setDescription("The total number of beacon frames sent by this\nstation and detected by the probe.")
ringStationOutBeaconErrors = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationOutBeaconErrors.setDescription("The total number of beacon frames detected by the\nprobe that name this station as the NAUN.")
ringStationInsertions = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 2, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationInsertions.setDescription("The number of times the probe detected this\nstation inserting onto the ring.")
ringStationOrderTable = MibTable((1, 3, 6, 1, 2, 1, 16, 10, 3))
if mibBuilder.loadTexts: ringStationOrderTable.setDescription("A list of ring station entries for stations in\nthe ring poll, ordered by their ring-order.")
ringStationOrderEntry = MibTableRow((1, 3, 6, 1, 2, 1, 16, 10, 3, 1)).setIndexNames((0, "TOKEN-RING-RMON-MIB", "ringStationOrderIfIndex"), (0, "TOKEN-RING-RMON-MIB", "ringStationOrderOrderIndex"))
if mibBuilder.loadTexts: ringStationOrderEntry.setDescription("A collection of statistics for a particular\nstation that is active on a ring monitored by this\ndevice. This table will contain information for\nevery interface that has a\nringStationControlStatus equal to valid.")
ringStationOrderIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 3, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationOrderIfIndex.setDescription("The value of this object uniquely identifies the\ninterface on this remote network monitoring device\non which this station was detected. The interface\nidentified by a particular value of this object is\nthe same interface as identified by the same value\nof the ifIndex object, defined in MIB-II [3].")
ringStationOrderOrderIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationOrderOrderIndex.setDescription("This index denotes the location of this station\nwith respect to other stations on the ring. This\nindex is one more than the number of hops\ndownstream that this station is from the rmon\nprobe. The rmon probe itself gets the value one.")
ringStationOrderMacAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 3, 1, 3), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationOrderMacAddress.setDescription("The physical address of this station.")
ringStationConfigControlTable = MibTable((1, 3, 6, 1, 2, 1, 16, 10, 4))
if mibBuilder.loadTexts: ringStationConfigControlTable.setDescription("A list of ring station configuration control\nentries.")
ringStationConfigControlEntry = MibTableRow((1, 3, 6, 1, 2, 1, 16, 10, 4, 1)).setIndexNames((0, "TOKEN-RING-RMON-MIB", "ringStationConfigControlIfIndex"), (0, "TOKEN-RING-RMON-MIB", "ringStationConfigControlMacAddress"))
if mibBuilder.loadTexts: ringStationConfigControlEntry.setDescription("This entry controls active management of stations\nby the probe. One entry exists in this table for\neach active station in the ringStationTable.")
ringStationConfigControlIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 4, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationConfigControlIfIndex.setDescription("The value of this object uniquely identifies the\ninterface on this remote network monitoring device\non which this station was detected. The interface\nidentified by a particular value of this object is\nthe same interface as identified by the same value\nof the ifIndex object, defined in MIB-II [3].")
ringStationConfigControlMacAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 4, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationConfigControlMacAddress.setDescription("The physical address of this station.")
ringStationConfigControlRemove = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 4, 1, 3), Integer().subtype(subtypeSpec=SingleValueConstraint(2,1,)).subtype(namedValues=NamedValues(("stable", 1), ("removing", 2), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ringStationConfigControlRemove.setDescription("Setting this object to `removing(2)' causes a\nRemove Station MAC frame to be sent. The agent\nwill set this object to `stable(1)' after\nprocessing the request.")
ringStationConfigControlUpdateStats = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 4, 1, 4), Integer().subtype(subtypeSpec=SingleValueConstraint(1,2,)).subtype(namedValues=NamedValues(("stable", 1), ("updating", 2), ))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: ringStationConfigControlUpdateStats.setDescription("Setting this object to `updating(2)' causes the\nconfiguration information associate with this\nentry to be updated. The agent will set this\nobject to `stable(1)' after processing the\nrequest.")
ringStationConfigTable = MibTable((1, 3, 6, 1, 2, 1, 16, 10, 5))
if mibBuilder.loadTexts: ringStationConfigTable.setDescription("A list of configuration entries for stations on a\nring monitored by this probe.")
ringStationConfigEntry = MibTableRow((1, 3, 6, 1, 2, 1, 16, 10, 5, 1)).setIndexNames((0, "TOKEN-RING-RMON-MIB", "ringStationConfigIfIndex"), (0, "TOKEN-RING-RMON-MIB", "ringStationConfigMacAddress"))
if mibBuilder.loadTexts: ringStationConfigEntry.setDescription("A collection of statistics for a particular\nstation that has been discovered on a ring\nmonitored by this probe.")
ringStationConfigIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 5, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationConfigIfIndex.setDescription("The value of this object uniquely identifies the\ninterface on this remote network monitoring device\non which this station was detected. The interface\nidentified by a particular value of this object is\nthe same interface as identified by the same value\nof the ifIndex object, defined in MIB-II [3].")
ringStationConfigMacAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 5, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationConfigMacAddress.setDescription("The physical address of this station.")
ringStationConfigUpdateTime = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 5, 1, 3), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationConfigUpdateTime.setDescription("The value of sysUpTime at the time this\nconfiguration information was last updated\n(completely).")
ringStationConfigLocation = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 5, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationConfigLocation.setDescription("The assigned physical location of this station.")
ringStationConfigMicrocode = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 5, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(10, 10)).setFixedLength(10)).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationConfigMicrocode.setDescription("The microcode EC level of this station.")
ringStationConfigGroupAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 5, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationConfigGroupAddress.setDescription("The low-order 4 octets of the group address\nrecognized by this station.")
ringStationConfigFunctionalAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 5, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: ringStationConfigFunctionalAddress.setDescription("the functional addresses recognized by this\nstation.")
sourceRoutingStatsTable = MibTable((1, 3, 6, 1, 2, 1, 16, 10, 6))
if mibBuilder.loadTexts: sourceRoutingStatsTable.setDescription("A list of source routing statistics entries.")
sourceRoutingStatsEntry = MibTableRow((1, 3, 6, 1, 2, 1, 16, 10, 6, 1)).setIndexNames((0, "TOKEN-RING-RMON-MIB", "sourceRoutingStatsIfIndex"))
if mibBuilder.loadTexts: sourceRoutingStatsEntry.setDescription("A collection of source routing statistics kept\nfor a particular Token Ring interface.")
sourceRoutingStatsIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 1), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsIfIndex.setDescription("The value of this object uniquely identifies the\ninterface on this remote network monitoring device\non which source routing statistics will be\ndetected. The interface identified by a\nparticular value of this object is the same\ninterface as identified by the same value of the\nifIndex object, defined in MIB-II [3].")
sourceRoutingStatsRingNumber = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsRingNumber.setDescription("The ring number of the ring monitored by this\nentry. When any object in this entry is created,\nthe probe will attempt to discover the ring\nnumber. Only after the ring number is discovered\nwill this object be created. After creating an\nobject in this entry, the management station\nshould poll this object to detect when it is\ncreated. Only after this object is created can\nthe management station set the\nsourceRoutingStatsStatus entry to valid(1).")
sourceRoutingStatsInFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 3), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsInFrames.setDescription("The count of frames sent into this ring from\nanother ring.")
sourceRoutingStatsOutFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsOutFrames.setDescription("The count of frames sent from this ring to\nanother ring.")
sourceRoutingStatsThroughFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsThroughFrames.setDescription("The count of frames sent from another ring,\nthrough this ring, to another ring.")
sourceRoutingStatsAllRoutesBroadcastFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsAllRoutesBroadcastFrames.setDescription("The total number of good frames received that\nwere All Routes Broadcast.")
sourceRoutingStatsSingleRouteBroadcastFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsSingleRouteBroadcastFrames.setDescription("The total number of good frames received that\nwere Single Route Broadcast.")
sourceRoutingStatsInOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsInOctets.setDescription("The count of octets in good frames sent into this\nring from another ring.")
sourceRoutingStatsOutOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsOutOctets.setDescription("The count of octets in good frames sent from this\nring to another ring.")
sourceRoutingStatsThroughOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsThroughOctets.setDescription("The count of octets in good frames sent another\nring, through this ring, to another ring.")
sourceRoutingStatsAllRoutesBroadcastOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsAllRoutesBroadcastOctets.setDescription("The total number of octets in good frames\nreceived that were All Routes Broadcast.")
sourceRoutingStatsSingleRoutesBroadcastOctets = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsSingleRoutesBroadcastOctets.setDescription("The total number of octets in good frames\nreceived that were Single Route Broadcast.")
sourceRoutingStatsLocalLLCFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsLocalLLCFrames.setDescription("The total number of frames received who had no\nRIF field (or had a RIF field that only included\nthe local ring's number) and were not All Route\nBroadcast Frames.")
sourceRoutingStats1HopFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 14), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStats1HopFrames.setDescription("The total number of frames received whose route\nhad 1 hop, were not All Route Broadcast Frames,\nand whose source or destination were on this ring\n(i.e. frames that had a RIF field and had this\nring number in the first or last entry of the RIF\nfield).")
sourceRoutingStats2HopsFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 15), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStats2HopsFrames.setDescription("The total number of frames received whose route\nhad 2 hops, were not All Route Broadcast Frames,\nand whose source or destination were on this ring\n(i.e. frames that had a RIF field and had this\nring number in the first or last entry of the RIF\nfield).")
sourceRoutingStats3HopsFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 16), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStats3HopsFrames.setDescription("The total number of frames received whose route\nhad 3 hops, were not All Route Broadcast Frames,\nand whose source or destination were on this ring\n(i.e. frames that had a RIF field and had this\nring number in the first or last entry of the RIF\nfield).")
sourceRoutingStats4HopsFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 17), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStats4HopsFrames.setDescription("The total number of frames received whose route\nhad 4 hops, were not All Route Broadcast Frames,\nand whose source or destination were on this ring\n(i.e. frames that had a RIF field and had this\nring number in the first or last entry of the RIF\nfield).")
sourceRoutingStats5HopsFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 18), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStats5HopsFrames.setDescription("The total number of frames received whose route\nhad 5 hops, were not All Route Broadcast Frames,\nand whose source or destination were on this ring\n(i.e. frames that had a RIF field and had this\nring number in the first or last entry of the RIF\nfield).")
sourceRoutingStats6HopsFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 19), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStats6HopsFrames.setDescription("The total number of frames received whose route\nhad 6 hops, were not All Route Broadcast Frames,\nand whose source or destination were on this ring\n(i.e. frames that had a RIF field and had this\nring number in the first or last entry of the RIF\nfield).")
sourceRoutingStats7HopsFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 20), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStats7HopsFrames.setDescription("The total number of frames received whose route\nhad 7 hops, were not All Route Broadcast Frames,\nand whose source or destination were on this ring\n(i.e. frames that had a RIF field and had this\nring number in the first or last entry of the RIF\nfield).")
sourceRoutingStats8HopsFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 21), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStats8HopsFrames.setDescription("The total number of frames received whose route\nhad 8 hops, were not All Route Broadcast Frames,\nand whose source or destination were on this ring\n(i.e. frames that had a RIF field and had this\nring number in the first or last entry of the RIF\nfield).")
sourceRoutingStatsMoreThan8HopsFrames = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 22), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: sourceRoutingStatsMoreThan8HopsFrames.setDescription("The total number of frames received whose route\nhad more than 8 hops, were not All Route Broadcast\nFrames, and whose source or destination were on\nthis ring (i.e. frames that had a RIF field and\nhad this ring number in the first or last entry of\nthe RIF field).")
sourceRoutingStatsOwner = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 23), OwnerString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sourceRoutingStatsOwner.setDescription("The base_entity that configured this entry and is\ntherefore using the resources assigned to it.")
sourceRoutingStatsStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 16, 10, 6, 1, 24), EntryStatus()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: sourceRoutingStatsStatus.setDescription("The status of this sourceRoutingStats entry.")
# Augmentions
# Exports
# Types
mibBuilder.exportSymbols("TOKEN-RING-RMON-MIB", MacAddress=MacAddress, TimeInterval=TimeInterval)
# Objects
mibBuilder.exportSymbols("TOKEN-RING-RMON-MIB", tokenRingMLStatsTable=tokenRingMLStatsTable, tokenRingMLStatsEntry=tokenRingMLStatsEntry, tokenRingMLStatsIndex=tokenRingMLStatsIndex, tokenRingMLStatsDataSource=tokenRingMLStatsDataSource, tokenRingMLStatsDropEvents=tokenRingMLStatsDropEvents, tokenRingMLStatsMacOctets=tokenRingMLStatsMacOctets, tokenRingMLStatsMacPkts=tokenRingMLStatsMacPkts, tokenRingMLStatsRingPurgeEvents=tokenRingMLStatsRingPurgeEvents, tokenRingMLStatsRingPurgePkts=tokenRingMLStatsRingPurgePkts, tokenRingMLStatsBeaconEvents=tokenRingMLStatsBeaconEvents, tokenRingMLStatsBeaconTime=tokenRingMLStatsBeaconTime, tokenRingMLStatsBeaconPkts=tokenRingMLStatsBeaconPkts, tokenRingMLStatsClaimTokenEvents=tokenRingMLStatsClaimTokenEvents, tokenRingMLStatsClaimTokenPkts=tokenRingMLStatsClaimTokenPkts, tokenRingMLStatsNAUNChanges=tokenRingMLStatsNAUNChanges, tokenRingMLStatsLineErrors=tokenRingMLStatsLineErrors, tokenRingMLStatsInternalErrors=tokenRingMLStatsInternalErrors, tokenRingMLStatsBurstErrors=tokenRingMLStatsBurstErrors, tokenRingMLStatsACErrors=tokenRingMLStatsACErrors, tokenRingMLStatsAbortErrors=tokenRingMLStatsAbortErrors, tokenRingMLStatsLostFrameErrors=tokenRingMLStatsLostFrameErrors, tokenRingMLStatsCongestionErrors=tokenRingMLStatsCongestionErrors, tokenRingMLStatsFrameCopiedErrors=tokenRingMLStatsFrameCopiedErrors, tokenRingMLStatsFrequencyErrors=tokenRingMLStatsFrequencyErrors, tokenRingMLStatsTokenErrors=tokenRingMLStatsTokenErrors, tokenRingMLStatsSoftErrorReports=tokenRingMLStatsSoftErrorReports, tokenRingMLStatsRingPollEvents=tokenRingMLStatsRingPollEvents, tokenRingMLStatsOwner=tokenRingMLStatsOwner, tokenRingMLStatsStatus=tokenRingMLStatsStatus, tokenRingPStatsTable=tokenRingPStatsTable, tokenRingPStatsEntry=tokenRingPStatsEntry, tokenRingPStatsIndex=tokenRingPStatsIndex, tokenRingPStatsDataSource=tokenRingPStatsDataSource, tokenRingPStatsDropEvents=tokenRingPStatsDropEvents, tokenRingPStatsDataOctets=tokenRingPStatsDataOctets, tokenRingPStatsDataPkts=tokenRingPStatsDataPkts, tokenRingPStatsDataBroadcastPkts=tokenRingPStatsDataBroadcastPkts, tokenRingPStatsDataMulticastPkts=tokenRingPStatsDataMulticastPkts, tokenRingPStatsDataPkts18to63Octets=tokenRingPStatsDataPkts18to63Octets, tokenRingPStatsDataPkts64to127Octets=tokenRingPStatsDataPkts64to127Octets, tokenRingPStatsDataPkts128to255Octets=tokenRingPStatsDataPkts128to255Octets, tokenRingPStatsDataPkts256to511Octets=tokenRingPStatsDataPkts256to511Octets, tokenRingPStatsDataPkts512to1023Octets=tokenRingPStatsDataPkts512to1023Octets, tokenRingPStatsDataPkts1024to2047Octets=tokenRingPStatsDataPkts1024to2047Octets, tokenRingPStatsDataPkts2048to4095Octets=tokenRingPStatsDataPkts2048to4095Octets, tokenRingPStatsDataPkts4096to8191Octets=tokenRingPStatsDataPkts4096to8191Octets, tokenRingPStatsDataPkts8192to18000Octets=tokenRingPStatsDataPkts8192to18000Octets, tokenRingPStatsDataPktsGreaterThan18000Octets=tokenRingPStatsDataPktsGreaterThan18000Octets, tokenRingPStatsOwner=tokenRingPStatsOwner, tokenRingPStatsStatus=tokenRingPStatsStatus, tokenRingMLHistoryTable=tokenRingMLHistoryTable, tokenRingMLHistoryEntry=tokenRingMLHistoryEntry, tokenRingMLHistoryIndex=tokenRingMLHistoryIndex, tokenRingMLHistorySampleIndex=tokenRingMLHistorySampleIndex, tokenRingMLHistoryIntervalStart=tokenRingMLHistoryIntervalStart, tokenRingMLHistoryDropEvents=tokenRingMLHistoryDropEvents, tokenRingMLHistoryMacOctets=tokenRingMLHistoryMacOctets, tokenRingMLHistoryMacPkts=tokenRingMLHistoryMacPkts, tokenRingMLHistoryRingPurgeEvents=tokenRingMLHistoryRingPurgeEvents, tokenRingMLHistoryRingPurgePkts=tokenRingMLHistoryRingPurgePkts, tokenRingMLHistoryBeaconEvents=tokenRingMLHistoryBeaconEvents, tokenRingMLHistoryBeaconTime=tokenRingMLHistoryBeaconTime, tokenRingMLHistoryBeaconPkts=tokenRingMLHistoryBeaconPkts, tokenRingMLHistoryClaimTokenEvents=tokenRingMLHistoryClaimTokenEvents, tokenRingMLHistoryClaimTokenPkts=tokenRingMLHistoryClaimTokenPkts, tokenRingMLHistoryNAUNChanges=tokenRingMLHistoryNAUNChanges, tokenRingMLHistoryLineErrors=tokenRingMLHistoryLineErrors, tokenRingMLHistoryInternalErrors=tokenRingMLHistoryInternalErrors, tokenRingMLHistoryBurstErrors=tokenRingMLHistoryBurstErrors, tokenRingMLHistoryACErrors=tokenRingMLHistoryACErrors, tokenRingMLHistoryAbortErrors=tokenRingMLHistoryAbortErrors, tokenRingMLHistoryLostFrameErrors=tokenRingMLHistoryLostFrameErrors, tokenRingMLHistoryCongestionErrors=tokenRingMLHistoryCongestionErrors, tokenRingMLHistoryFrameCopiedErrors=tokenRingMLHistoryFrameCopiedErrors, tokenRingMLHistoryFrequencyErrors=tokenRingMLHistoryFrequencyErrors, tokenRingMLHistoryTokenErrors=tokenRingMLHistoryTokenErrors, tokenRingMLHistorySoftErrorReports=tokenRingMLHistorySoftErrorReports, tokenRingMLHistoryRingPollEvents=tokenRingMLHistoryRingPollEvents, tokenRingMLHistoryActiveStations=tokenRingMLHistoryActiveStations, tokenRingPHistoryTable=tokenRingPHistoryTable, tokenRingPHistoryEntry=tokenRingPHistoryEntry, tokenRingPHistoryIndex=tokenRingPHistoryIndex, tokenRingPHistorySampleIndex=tokenRingPHistorySampleIndex, tokenRingPHistoryIntervalStart=tokenRingPHistoryIntervalStart, tokenRingPHistoryDropEvents=tokenRingPHistoryDropEvents, tokenRingPHistoryDataOctets=tokenRingPHistoryDataOctets, tokenRingPHistoryDataPkts=tokenRingPHistoryDataPkts, tokenRingPHistoryDataBroadcastPkts=tokenRingPHistoryDataBroadcastPkts, tokenRingPHistoryDataMulticastPkts=tokenRingPHistoryDataMulticastPkts, tokenRingPHistoryDataPkts18to63Octets=tokenRingPHistoryDataPkts18to63Octets, tokenRingPHistoryDataPkts64to127Octets=tokenRingPHistoryDataPkts64to127Octets, tokenRingPHistoryDataPkts128to255Octets=tokenRingPHistoryDataPkts128to255Octets, tokenRingPHistoryDataPkts256to511Octets=tokenRingPHistoryDataPkts256to511Octets, tokenRingPHistoryDataPkts512to1023Octets=tokenRingPHistoryDataPkts512to1023Octets, tokenRingPHistoryDataPkts1024to2047Octets=tokenRingPHistoryDataPkts1024to2047Octets, tokenRingPHistoryDataPkts2048to4095Octets=tokenRingPHistoryDataPkts2048to4095Octets, tokenRingPHistoryDataPkts4096to8191Octets=tokenRingPHistoryDataPkts4096to8191Octets, tokenRingPHistoryDataPkts8192to18000Octets=tokenRingPHistoryDataPkts8192to18000Octets, tokenRingPHistoryDataPktsGreaterThan18000Octets=tokenRingPHistoryDataPktsGreaterThan18000Octets, tokenRing=tokenRing, ringStationControlTable=ringStationControlTable, ringStationControlEntry=ringStationControlEntry, ringStationControlIfIndex=ringStationControlIfIndex, ringStationControlTableSize=ringStationControlTableSize, ringStationControlActiveStations=ringStationControlActiveStations, ringStationControlRingState=ringStationControlRingState, ringStationControlBeaconSender=ringStationControlBeaconSender, ringStationControlBeaconNAUN=ringStationControlBeaconNAUN, ringStationControlActiveMonitor=ringStationControlActiveMonitor, ringStationControlOrderChanges=ringStationControlOrderChanges, ringStationControlOwner=ringStationControlOwner, ringStationControlStatus=ringStationControlStatus, ringStationTable=ringStationTable, ringStationEntry=ringStationEntry, ringStationIfIndex=ringStationIfIndex, ringStationMacAddress=ringStationMacAddress, ringStationLastNAUN=ringStationLastNAUN, ringStationStationStatus=ringStationStationStatus, ringStationLastEnterTime=ringStationLastEnterTime, ringStationLastExitTime=ringStationLastExitTime, ringStationDuplicateAddresses=ringStationDuplicateAddresses, ringStationInLineErrors=ringStationInLineErrors, ringStationOutLineErrors=ringStationOutLineErrors, ringStationInternalErrors=ringStationInternalErrors, ringStationInBurstErrors=ringStationInBurstErrors, ringStationOutBurstErrors=ringStationOutBurstErrors)
mibBuilder.exportSymbols("TOKEN-RING-RMON-MIB", ringStationACErrors=ringStationACErrors, ringStationAbortErrors=ringStationAbortErrors, ringStationLostFrameErrors=ringStationLostFrameErrors, ringStationCongestionErrors=ringStationCongestionErrors, ringStationFrameCopiedErrors=ringStationFrameCopiedErrors, ringStationFrequencyErrors=ringStationFrequencyErrors, ringStationTokenErrors=ringStationTokenErrors, ringStationInBeaconErrors=ringStationInBeaconErrors, ringStationOutBeaconErrors=ringStationOutBeaconErrors, ringStationInsertions=ringStationInsertions, ringStationOrderTable=ringStationOrderTable, ringStationOrderEntry=ringStationOrderEntry, ringStationOrderIfIndex=ringStationOrderIfIndex, ringStationOrderOrderIndex=ringStationOrderOrderIndex, ringStationOrderMacAddress=ringStationOrderMacAddress, ringStationConfigControlTable=ringStationConfigControlTable, ringStationConfigControlEntry=ringStationConfigControlEntry, ringStationConfigControlIfIndex=ringStationConfigControlIfIndex, ringStationConfigControlMacAddress=ringStationConfigControlMacAddress, ringStationConfigControlRemove=ringStationConfigControlRemove, ringStationConfigControlUpdateStats=ringStationConfigControlUpdateStats, ringStationConfigTable=ringStationConfigTable, ringStationConfigEntry=ringStationConfigEntry, ringStationConfigIfIndex=ringStationConfigIfIndex, ringStationConfigMacAddress=ringStationConfigMacAddress, ringStationConfigUpdateTime=ringStationConfigUpdateTime, ringStationConfigLocation=ringStationConfigLocation, ringStationConfigMicrocode=ringStationConfigMicrocode, ringStationConfigGroupAddress=ringStationConfigGroupAddress, ringStationConfigFunctionalAddress=ringStationConfigFunctionalAddress, sourceRoutingStatsTable=sourceRoutingStatsTable, sourceRoutingStatsEntry=sourceRoutingStatsEntry, sourceRoutingStatsIfIndex=sourceRoutingStatsIfIndex, sourceRoutingStatsRingNumber=sourceRoutingStatsRingNumber, sourceRoutingStatsInFrames=sourceRoutingStatsInFrames, sourceRoutingStatsOutFrames=sourceRoutingStatsOutFrames, sourceRoutingStatsThroughFrames=sourceRoutingStatsThroughFrames, sourceRoutingStatsAllRoutesBroadcastFrames=sourceRoutingStatsAllRoutesBroadcastFrames, sourceRoutingStatsSingleRouteBroadcastFrames=sourceRoutingStatsSingleRouteBroadcastFrames, sourceRoutingStatsInOctets=sourceRoutingStatsInOctets, sourceRoutingStatsOutOctets=sourceRoutingStatsOutOctets, sourceRoutingStatsThroughOctets=sourceRoutingStatsThroughOctets, sourceRoutingStatsAllRoutesBroadcastOctets=sourceRoutingStatsAllRoutesBroadcastOctets, sourceRoutingStatsSingleRoutesBroadcastOctets=sourceRoutingStatsSingleRoutesBroadcastOctets, sourceRoutingStatsLocalLLCFrames=sourceRoutingStatsLocalLLCFrames, sourceRoutingStats1HopFrames=sourceRoutingStats1HopFrames, sourceRoutingStats2HopsFrames=sourceRoutingStats2HopsFrames, sourceRoutingStats3HopsFrames=sourceRoutingStats3HopsFrames, sourceRoutingStats4HopsFrames=sourceRoutingStats4HopsFrames, sourceRoutingStats5HopsFrames=sourceRoutingStats5HopsFrames, sourceRoutingStats6HopsFrames=sourceRoutingStats6HopsFrames, sourceRoutingStats7HopsFrames=sourceRoutingStats7HopsFrames, sourceRoutingStats8HopsFrames=sourceRoutingStats8HopsFrames, sourceRoutingStatsMoreThan8HopsFrames=sourceRoutingStatsMoreThan8HopsFrames, sourceRoutingStatsOwner=sourceRoutingStatsOwner, sourceRoutingStatsStatus=sourceRoutingStatsStatus) |
#Body
"""
Compare two linked list
head could be None as well for empty list
Node is defined as
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
return back the head of the linked list in the below method.
"""
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
def CompareLists(headA, headB):
if headA and headB:
while headA and headB:
dataA = headA.data
dataB = headB.data
#print dataA, dataB, headA.next, headB.next
if dataA != dataB or (not headA.next and headB.next) or (headA.next and not headB.next):
return 0
else:
headA = headA.next
headB = headB.next
return 1
elif headA or headB:
return 0
|
HOST = "0.0.0.0"
PORT = 8140
# https://docs.sqlalchemy.org/en/14/dialects/postgresql.html
POSTGRESQL_URL = "postgresql+asyncpg://imgsmlr:imgsmlr-123456@127.0.0.1:5400/imgsmlr"
SQL_DEBUG = False
SEARCH_LIMIT = 50
SEARCH_SIMR_THRESHOLD = 4.5
|
# Copyright (c) 2018 PrimeVR
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php
def united_bitcoin_qualification(span):
ubtc_start = 494000
ubtc_end = 502315
if not span['defunded']:
return None
if (span['defunded']['block'] < ubtc_end and
span['defunded']['block'] > ubtc_start):
return span['defunded']['value']
return None
UNITED_BITCOIN = {
'id': 'united-bitcoin',
'qualification': united_bitcoin_qualification,
}
|
"""
Profile ../profile-datasets-py/div83/010.py
file automaticaly created by prof_gen.py script
"""
self["ID"] = "../profile-datasets-py/div83/010.py"
self["Q"] = numpy.array([ 2.095776, 2.465104, 3.1296 , 3.963974, 5.003875,
5.921015, 6.371809, 6.473068, 6.457728, 6.408619,
6.31879 , 6.221031, 6.186012, 6.208811, 6.248791,
6.249351, 6.238571, 6.208811, 6.148072, 6.044683,
5.886575, 5.628238, 5.349561, 5.054794, 4.733978,
4.362401, 3.939184, 3.492948, 3.046111, 2.642203,
2.323985, 2.093356, 1.938136, 1.855297, 1.823937,
1.825827, 1.847347, 1.870697, 1.873936, 1.853107,
1.814007, 1.790617, 1.804607, 1.857837, 1.941866,
2.129285, 2.500164, 2.836112, 3.006931, 3.12847 ,
3.21225 , 3.262739, 3.303259, 3.347139, 3.362529,
3.373449, 3.415948, 3.515398, 3.662857, 3.802286,
3.875425, 3.993384, 5.670948, 10.0286 , 15.87335 ,
21.89402 , 27.33565 , 32.30636 , 37.82687 , 45.09077 ,
53.92039 , 64.31746 , 76.55004 , 91.06231 , 108.4872 ,
128.7134 , 148.5269 , 161.091 , 160.1943 , 140.2593 ,
110.2268 , 91.40125 , 89.92581 , 103.0884 , 133.1153 ,
181.622 , 253.6816 , 347.6251 , 439.19 , 468.0418 ,
165.9215 , 160.9761 , 156.2436 , 151.711 , 147.3693 ,
143.2085 , 139.2176 , 135.3897 , 131.7156 , 128.1876 ,
124.7984 ])
self["P"] = numpy.array([ 5.00000000e-03, 1.61000000e-02, 3.84000000e-02,
7.69000000e-02, 1.37000000e-01, 2.24400000e-01,
3.45400000e-01, 5.06400000e-01, 7.14000000e-01,
9.75300000e-01, 1.29720000e+00, 1.68720000e+00,
2.15260000e+00, 2.70090000e+00, 3.33980000e+00,
4.07700000e+00, 4.92040000e+00, 5.87760000e+00,
6.95670000e+00, 8.16550000e+00, 9.51190000e+00,
1.10038000e+01, 1.26492000e+01, 1.44559000e+01,
1.64318000e+01, 1.85847000e+01, 2.09224000e+01,
2.34526000e+01, 2.61829000e+01, 2.91210000e+01,
3.22744000e+01, 3.56505000e+01, 3.92566000e+01,
4.31001000e+01, 4.71882000e+01, 5.15278000e+01,
5.61260000e+01, 6.09895000e+01, 6.61253000e+01,
7.15398000e+01, 7.72396000e+01, 8.32310000e+01,
8.95204000e+01, 9.61138000e+01, 1.03017000e+02,
1.10237000e+02, 1.17778000e+02, 1.25646000e+02,
1.33846000e+02, 1.42385000e+02, 1.51266000e+02,
1.60496000e+02, 1.70078000e+02, 1.80018000e+02,
1.90320000e+02, 2.00989000e+02, 2.12028000e+02,
2.23442000e+02, 2.35234000e+02, 2.47408000e+02,
2.59969000e+02, 2.72919000e+02, 2.86262000e+02,
3.00000000e+02, 3.14137000e+02, 3.28675000e+02,
3.43618000e+02, 3.58966000e+02, 3.74724000e+02,
3.90893000e+02, 4.07474000e+02, 4.24470000e+02,
4.41882000e+02, 4.59712000e+02, 4.77961000e+02,
4.96630000e+02, 5.15720000e+02, 5.35232000e+02,
5.55167000e+02, 5.75525000e+02, 5.96306000e+02,
6.17511000e+02, 6.39140000e+02, 6.61192000e+02,
6.83667000e+02, 7.06565000e+02, 7.29886000e+02,
7.53628000e+02, 7.77790000e+02, 8.02371000e+02,
8.27371000e+02, 8.52788000e+02, 8.78620000e+02,
9.04866000e+02, 9.31524000e+02, 9.58591000e+02,
9.86067000e+02, 1.01395000e+03, 1.04223000e+03,
1.07092000e+03, 1.10000000e+03])
self["CO2"] = numpy.array([ 373.3942, 373.3941, 373.3938, 373.3935, 373.3921, 373.3918,
373.3946, 373.4036, 373.4146, 373.4426, 373.4896, 373.5487,
373.6167, 373.7457, 373.8797, 373.9647, 373.9937, 373.9477,
373.8447, 373.7057, 373.5698, 373.4619, 373.359 , 373.2451,
373.1282, 373.0064, 372.9185, 372.8307, 372.7759, 372.719 ,
372.6741, 372.6262, 372.6273, 372.6313, 372.6903, 372.7783,
372.8793, 373.0013, 373.1303, 373.2973, 373.4763, 373.7093,
374.0053, 374.3173, 374.6923, 375.0842, 375.5021, 375.9429,
376.3999, 376.8598, 377.3388, 377.8728, 378.4337, 378.9727,
379.4857, 379.9377, 380.1537, 380.3697, 380.4166, 380.4656,
380.4875, 380.5065, 380.5098, 380.5082, 380.497 , 380.4827,
380.4586, 380.4307, 380.3936, 380.3518, 380.3065, 380.2585,
380.2139, 380.1684, 380.1278, 380.0871, 380.0505, 380.0208,
379.9991, 379.9867, 379.9801, 379.9713, 379.9658, 379.9588,
379.9484, 379.939 , 379.9266, 379.9019, 379.8731, 379.8501,
379.9549, 379.9488, 379.9446, 379.9423, 379.943 , 379.9446,
379.9461, 379.9476, 379.9489, 379.9503, 379.9516])
self["CO"] = numpy.array([ 0.6800446 , 0.6740193 , 0.6620749 , 0.6419505 , 0.6117519 ,
0.5703516 , 0.3488468 , 0.0930345 , 0.08980432, 0.07642571,
0.05501905, 0.03542598, 0.02273726, 0.0167016 , 0.01458811,
0.01381391, 0.01293702, 0.01186053, 0.01089353, 0.01022694,
0.01013334, 0.01029874, 0.01054954, 0.01068985, 0.01095735,
0.01133045, 0.01198095, 0.01272726, 0.01303036, 0.01325816,
0.01226177, 0.01127788, 0.01024268, 0.00924114, 0.00879343,
0.0085742 , 0.00847924, 0.00867004, 0.00887618, 0.00923515,
0.009644 , 0.01013538, 0.01072998, 0.01139158, 0.01216398,
0.01302787, 0.01413626, 0.01550166, 0.01705575, 0.01879384,
0.02078993, 0.02289143, 0.02525062, 0.02788281, 0.0308218 ,
0.03392959, 0.03658498, 0.03948956, 0.04125235, 0.04315494,
0.04419713, 0.04516932, 0.04572824, 0.04618014, 0.04645236,
0.04665698, 0.04677772, 0.04686359, 0.04688663, 0.04688609,
0.04686017, 0.04682749, 0.04676122, 0.04669305, 0.04663384,
0.0465858 , 0.04655648, 0.0465376 , 0.04652345, 0.04650948,
0.04649977, 0.04649525, 0.04650932, 0.0465258 , 0.0465483 ,
0.04657384, 0.04658478, 0.04656421, 0.04653585, 0.04651032,
0.04650158, 0.04647112, 0.04638355, 0.0461135 , 0.04584094,
0.04556567, 0.04528799, 0.04500801, 0.04472571, 0.0444411 ,
0.04415449])
self["T"] = numpy.array([ 203.241, 210.063, 221.314, 233.602, 248.271, 261.577,
272.444, 278.371, 278.595, 275.594, 270.871, 263.75 ,
255.163, 246.655, 238.909, 231.799, 223.896, 217.482,
212.546, 208.833, 205.703, 202.946, 200.522, 198.582,
197.057, 195.619, 194.223, 193.349, 192.952, 192.888,
192.912, 192.728, 192.467, 192.507, 192.821, 193.133,
193.235, 193.199, 193.315, 193.791, 194.586, 195.302,
195.506, 195.217, 195.025, 195.515, 196.602, 197.901,
199.067, 199.978, 200.682, 201.276, 201.715, 201.971,
202.121, 202.333, 202.75 , 203.402, 204.24 , 205.206,
206.259, 207.357, 208.502, 209.714, 211.033, 212.487,
214.102, 215.888, 217.825, 219.839, 221.862, 223.857,
225.812, 227.74 , 229.66 , 231.591, 233.507, 235.332,
236.977, 238.377, 239.532, 240.469, 241.198, 241.739,
242.134, 242.467, 242.864, 243.459, 244.284, 244.883,
235.445, 235.445, 235.445, 235.445, 235.445, 235.445,
235.445, 235.445, 235.445, 235.445, 235.445])
self["N2O"] = numpy.array([ 0.00583999, 0.00408999, 0.00279999, 0.00175999, 0.0009 ,
0.00056 , 0.00063 , 0.00079999, 0.00124999, 0.00144999,
0.00156999, 0.00246999, 0.00394998, 0.00493997, 0.00592996,
0.00703996, 0.00885994, 0.01220992, 0.01505991, 0.01560991,
0.01611991, 0.01919989, 0.02343987, 0.02749986, 0.03770982,
0.04834979, 0.05858977, 0.07489974, 0.09278972, 0.1100597 ,
0.1265997 , 0.1419997 , 0.1569097 , 0.1713697 , 0.1990496 ,
0.2246096 , 0.2487395 , 0.2694695 , 0.2866995 , 0.3030394 ,
0.3120394 , 0.3152494 , 0.3152494 , 0.3152494 , 0.3152494 ,
0.3152493 , 0.3152492 , 0.3152491 , 0.3152491 , 0.315249 ,
0.315249 , 0.315249 , 0.315249 , 0.3152489 , 0.3152489 ,
0.3152489 , 0.3152489 , 0.3152489 , 0.3152488 , 0.3152488 ,
0.3152488 , 0.3152487 , 0.3152482 , 0.3152468 , 0.315245 ,
0.3152431 , 0.3152414 , 0.3152398 , 0.3152381 , 0.3152358 ,
0.315233 , 0.3152297 , 0.3152259 , 0.3152213 , 0.3152158 ,
0.3152094 , 0.3152032 , 0.3151992 , 0.3151995 , 0.3152058 ,
0.3152153 , 0.3152212 , 0.3152217 , 0.3152175 , 0.315208 ,
0.3151927 , 0.31517 , 0.3151404 , 0.3151115 , 0.3151024 ,
0.3151977 , 0.3151993 , 0.3152007 , 0.3152022 , 0.3152035 ,
0.3152049 , 0.3152061 , 0.3152073 , 0.3152085 , 0.3152096 ,
0.3152107 ])
self["O3"] = numpy.array([ 0.2179525 , 0.4427619 , 0.8307214 , 1.071126 , 1.107014 ,
1.216323 , 1.368551 , 1.55042 , 1.820048 , 2.190766 ,
2.597004 , 3.080251 , 3.613488 , 4.076185 , 4.354673 ,
4.374823 , 4.346653 , 4.222944 , 4.203744 , 4.306514 ,
4.427884 , 4.416705 , 3.941799 , 3.148064 , 2.18333 ,
1.231965 , 0.8361127 , 0.6320258 , 0.5055445 , 0.4207969 ,
0.3808471 , 0.3781902 , 0.4033912 , 0.4428782 , 0.5194611 ,
0.6209939 , 0.7014897 , 0.7363626 , 0.7527296 , 0.7644786 ,
0.7908336 , 0.8463225 , 0.8622094 , 0.8290295 , 0.8426624 ,
0.9682409 , 1.023447 , 1.010207 , 0.9170352 , 0.8022415 ,
0.6979588 , 0.603872 , 0.5141203 , 0.4301826 , 0.3550448 ,
0.288998 , 0.2315552 , 0.1832504 , 0.1449635 , 0.1162426 ,
0.09470863, 0.07739049, 0.06345754, 0.05288787, 0.04548268,
0.04070251, 0.03783687, 0.03619263, 0.03520797, 0.03466834,
0.03440574, 0.0342611 , 0.03404529, 0.03356474, 0.03271215,
0.03201058, 0.03181097, 0.03218072, 0.03339005, 0.03605744,
0.04019977, 0.04384289, 0.04488666, 0.04469889, 0.04549454,
0.0456743 , 0.04436904, 0.0434255 , 0.04298391, 0.04331422,
0.03472694, 0.03472711, 0.03472727, 0.03472743, 0.03472758,
0.03472773, 0.03472786, 0.034728 , 0.03472813, 0.03472825,
0.03472837])
self["CH4"] = numpy.array([ 0.3025104 , 0.2017365 , 0.1268286 , 0.09570632, 0.207944 ,
0.2542325 , 0.2679163 , 0.2839972 , 0.311439 , 0.3420878 ,
0.3823386 , 0.4305423 , 0.483456 , 0.5286897 , 0.5675275 ,
0.5945863 , 0.6171152 , 0.6321481 , 0.64319 , 0.6320972 ,
0.6215293 , 0.6218035 , 0.6272516 , 0.6324708 , 0.6670328 ,
0.7040839 , 0.7397381 , 0.8120262 , 0.8943883 , 0.9500525 ,
1.009798 , 1.073758 , 1.142078 , 1.196758 , 1.249428 ,
1.299148 , 1.344888 , 1.385477 , 1.407137 , 1.429967 ,
1.454007 , 1.479277 , 1.505797 , 1.544097 , 1.579537 ,
1.616597 , 1.646126 , 1.670465 , 1.692875 , 1.702655 ,
1.712824 , 1.716834 , 1.719454 , 1.721334 , 1.722394 ,
1.723464 , 1.724494 , 1.725554 , 1.725644 , 1.725753 ,
1.725553 , 1.725293 , 1.72479 , 1.724173 , 1.723753 ,
1.723452 , 1.723333 , 1.723354 , 1.723415 , 1.723502 ,
1.723607 , 1.723709 , 1.723718 , 1.723693 , 1.723523 ,
1.723298 , 1.722944 , 1.722572 , 1.722194 , 1.721858 ,
1.72152 , 1.721163 , 1.720755 , 1.720323 , 1.719891 ,
1.719478 , 1.719064 , 1.718602 , 1.718255 , 1.718115 ,
1.718565 , 1.718523 , 1.718491 , 1.718469 , 1.718467 ,
1.718464 , 1.718471 , 1.718477 , 1.718484 , 1.71849 ,
1.718496 ])
self["CTP"] = 500.0
self["CFRACTION"] = 0.0
self["IDG"] = 0
self["ISH"] = 0
self["ELEVATION"] = 0.0
self["S2M"]["T"] = 235.445
self["S2M"]["Q"] = 124.79842341
self["S2M"]["O"] = 0.0347283654138
self["S2M"]["P"] = 813.02338
self["S2M"]["U"] = 0.0
self["S2M"]["V"] = 0.0
self["S2M"]["WFETC"] = 100000.0
self["SKIN"]["SURFTYPE"] = 0
self["SKIN"]["WATERTYPE"] = 1
self["SKIN"]["T"] = 235.445
self["SKIN"]["SALINITY"] = 35.0
self["SKIN"]["FOAM_FRACTION"] = 0.0
self["SKIN"]["FASTEM"] = numpy.array([ 3. , 5. , 15. , 0.1, 0.3])
self["ZENANGLE"] = 0.0
self["AZANGLE"] = 0.0
self["SUNZENANGLE"] = 0.0
self["SUNAZANGLE"] = 0.0
self["LATITUDE"] = -66.896
self["GAS_UNITS"] = 2
self["BE"] = 0.0
self["COSBK"] = 0.0
self["DATE"] = numpy.array([2006, 9, 1])
self["TIME"] = numpy.array([0, 0, 0])
|
class Protocol:
def __init__(self, data):
self.iniciator = data.get('iniciator', {})
self.responder = data.get('responder', {})
|
N = int(input())
t_list = [int(input()) for _ in range(N)]
if N == 1:
print(t_list[0])
exit()
ans = float("inf")
for bit in range(2 ** N):
one = 0
zero = 0
for j in range(N):
if 1 & bit >> j:
one += t_list[j]
else:
zero += t_list[j]
ans = min(ans, max(one, zero))
print(ans)
|
#"Automatizando tarefas maçantes com Python", capítulo 4, exercício 2 (pág.158
# do pdf)
#Objetivo: criar código para reproduzir, a partir do grid, a figura:
#..OO.OO..
#.OOOOOOO.
#.OOOOOOO.
#..OOOOO..
#...OOO...
#....O....
#Ou seja, transformar as colunas em linhas.
grid = [['.', '.', '.', '.', '.', '.'],
['.', 'O', 'O', '.', '.', '.'],
['O', 'O', 'O', 'O', '.', '.'],
['O', 'O', 'O', 'O', 'O', '.'],
['.', 'O', 'O', 'O', 'O', 'O'],
['O', 'O', 'O', 'O', 'O', '.'],
['O', 'O', 'O', 'O', '.', '.'],
['.', 'O', 'O', '.', '.', '.'],
['.', '.', '.', '.', '.', '.']]
x = 0
y = 0
for i in grid:
print(grid[x][y])
x += 1
|
"""
This script is used for course notes.
Author: Erick Marin
Date: 11/28/2020
"""
# Creating a file object and assigning a variable.
file = open("Course_2/Week_2/spider.txt")
# The operating system checks that we have permissions to access that file and
# then gives our code a file descriptor. This is a token generated by the OS
# that allows programs to do more operations with the file. This file
# descriptor is stored as an attribute of the files object. The file object
# gives us a bunch of methods that we can use to operate with the file.
print(file.readline())
# each time we call the readline method, the file object updates the current
# position in the file. So it keeps moving forward. We can also call the read
# method, which reads from the current position until the end of the file
# instead of just one line.
print(file.readline())
# The read method starts reading from wherever we currently are in the file.
# But instead of just one line, it reads all the way through to the files end.
print(file.read())
# Then we close the file. Open-use-close pattern.
file.close()
# To help us remember to close the file after at the we're done using it,
# Python lets us create a block of code by using the keyword "with". When we
# use a "with" block, Python will automatically close the file. So we don't
# need to remember to do that ourselves.
with open("Course_2/Week_2/spider.txt") as file:
print(file.readline())
|
# This controls how frequently the whole batch is iterated over vs only
# {QUICK_EVAL_PERCENT} of the data
QUICK_EVAL_FREQUENCY = 0
QUICK_EVAL_PERCENT = 0.05
QUICK_EVAL_TRAIN_PERCENT = 0.025
def train(
device,
model,
manifold,
dimension,
data,
optimizer,
loss_params,
n_epochs,
eval_every,
sample_neighbors_every,
lr_scheduler,
shared_params,
thread_number,
feature_manifold,
conformal_loss_params,
tensorboard_watch={},
eval_data=None
):
batch_num = 0
reporter = MemReporter()
for epoch in range(1, n_epochs + 1):
batch_losses = []
if conformal_loss_params is not None:
batch_conf_losses = []
t_start = timeit.default_timer()
if (epoch - 1) % sample_neighbors_every == 0 and thread_number == 0:
optimizer.zero_grad()
inputs = None
graph_dists = None
conf_loss = None
loss = None
# import gc; gc.collect()
# torch.cuda.empty_cache()
with torch.no_grad():
model.to(device)
nns = data.refresh_manifold_nn(model.get_embedding_matrix(), manifold,
return_nns=True)
if eval_data is not None:
eval_data.refresh_manifold_nn(model.get_embedding_matrix(), manifold,
manifold_nns=nns)
if epoch > 1:
syn_acc, sem_acc = embed_eval.eval_analogy(model, manifold, nns)
write_tensorboard('add_scalar', ['syn_acc', syn_acc, epoch - 1])
write_tensorboard('add_scalar', ['sem_acc', sem_acc, epoch - 1])
# import gc; gc.collect()
# torch.cuda.empty_cache()
data_iterator = tqdm(data) if thread_number == 0 else data
for batch in data_iterator:
if batch_num % eval_every == 0 and thread_number == 0:
mean_loss = 0 # float(np.mean(batch_losses)) use to eval every batch setting this to zero as its only used for printing output
savable_model = model.get_savable_model()
save_data = {
'epoch': epoch
}
if data.features is not None:
save_data["features"] = data.features
if model.get_additional_embeddings() is not None:
save_data[
"additional_embeddings_state_dict"] = model.get_additional_embeddings().state_dict()
if hasattr(model, "main_deltas"):
save_data["main_deltas_state_dict"] = model.main_deltas.state_dict()
if hasattr(model, "additional_deltas"):
save_data[
"additional_deltas_state_dict"] = model.additional_deltas.state_dict()
save_data["deltas"] = model.deltas
save_data.update(shared_params)
path = save_model(savable_model, save_data)
elapsed = 0 # Used to eval every batch setting this to zero as its only used for printing output
# embed_eval.eval_wordsim_benchmarks(model, manifold, device=device, iteration=batch_num)
if eval_data is not None:
with torch.no_grad():
hitsat10 = 0
rank_sum = 0
rec_rank_sum = 0
num_ranks = 0
if QUICK_EVAL_FREQUENCY > 0 and batch_num % (
eval_every * QUICK_EVAL_FREQUENCY) == 0:
eval_data.data_fraction = 1
total_eval = True
else:
eval_data.data_fraction = QUICK_EVAL_PERCENT
total_eval = False
eval_data.compute_train_ranks = False
for eval_batch in tqdm(eval_data):
inputs, graph_dists = eval_batch
inputs = inputs.to(device)
graph_dists = graph_dists.to(device)
input_embeddings = model(inputs)
sample_vertices = input_embeddings.narrow(1, 1,
input_embeddings.size(1) - 1)
main_vertices = input_embeddings.narrow(1, 0, 1).expand_as(
sample_vertices)
manifold_dists = manifold.dist(main_vertices, sample_vertices)
sorted_indices = manifold_dists.argsort(dim=-1)
manifold_dists_sorted = torch.gather(manifold_dists, -1, sorted_indices)
n_neighbors = (graph_dists < 2).sum(dim=-1)
batch_nums, neighbor_ranks = (
sorted_indices < n_neighbors.unsqueeze(1)).nonzero(
as_tuple=True)
neighbor_ranks += 1
adjust_indices = torch.arange(n_neighbors.max())
neighbor_adjustements = torch.cat(
[adjust_indices[:n_neighbors[i]] for i in
range(n_neighbors.size(0))])
neighbor_ranks -= neighbor_adjustements.to(device)
neighbor_ranks = neighbor_ranks.float()
rec_ranks = 1 / neighbor_ranks
hitsat10 += (neighbor_ranks <= 10).sum().cpu().numpy()
rank_sum += neighbor_ranks.sum().cpu().numpy()
rec_rank_sum += rec_ranks.sum().cpu().numpy()
num_ranks += neighbor_ranks.size(0)
mean_rank = rank_sum / num_ranks
mean_rec_rank = rec_rank_sum / num_ranks
hitsat10 = hitsat10 / num_ranks
postfix = "_approx"
if total_eval:
postfix = ""
write_tensorboard('add_scalar',
[f'mean_rank{postfix}', mean_rank, batch_num])
write_tensorboard('add_scalar',
[f'mean_rec_rank{postfix}', mean_rec_rank, batch_num])
write_tensorboard('add_scalar', [f'hitsat10{postfix}', hitsat10, batch_num])
if eval_data.is_eval:
hitsat10 = 0
rank_sum = 0
rec_rank_sum = 0
num_ranks = 0
eval_data.data_fraction = QUICK_EVAL_TRAIN_PERCENT
eval_data.compute_train_ranks = True
for eval_batch in tqdm(eval_data):
inputs, graph_dists = eval_batch
inputs = inputs.to(device)
graph_dists = graph_dists.to(device)
input_embeddings = model(inputs)
sample_vertices = input_embeddings.narrow(1, 1,
input_embeddings.size(
1) - 1)
main_vertices = input_embeddings.narrow(1, 0, 1).expand_as(
sample_vertices)
manifold_dists = manifold.dist(main_vertices, sample_vertices)
sorted_indices = manifold_dists.argsort(dim=-1)
manifold_dists_sorted = torch.gather(manifold_dists, -1,
sorted_indices)
n_neighbors = (graph_dists < 2).sum(dim=-1)
batch_nums, neighbor_ranks = (
sorted_indices < n_neighbors.unsqueeze(1)).nonzero(
as_tuple=True)
neighbor_ranks += 1
adjust_indices = torch.arange(n_neighbors.max())
neighbor_adjustements = torch.cat(
[adjust_indices[:n_neighbors[i]] for i in
range(n_neighbors.size(0))])
neighbor_ranks -= neighbor_adjustements.to(device)
neighbor_ranks = neighbor_ranks.float()
rec_ranks = 1 / neighbor_ranks
hitsat10 += (neighbor_ranks <= 10).sum().cpu().numpy()
rank_sum += neighbor_ranks.sum().cpu().numpy()
rec_rank_sum += rec_ranks.sum().cpu().numpy()
num_ranks += neighbor_ranks.size(0)
mean_rank = rank_sum / num_ranks
mean_rec_rank = rec_rank_sum / num_ranks
hitsat10 = hitsat10 / num_ranks
write_tensorboard('add_scalar',
[f'mean_rank_train', mean_rank, batch_num])
write_tensorboard('add_scalar',
[f'mean_rec_rank_train', mean_rec_rank, batch_num])
write_tensorboard('add_scalar',
[f'hitsat10_train', hitsat10, batch_num])
del manifold_dists, manifold_dists_sorted, sample_vertices, main_vertices, input_embeddings
# import gc;gc.collect()
# torch.cuda.empty_cache()
print(model)
reporter.report()
conf_loss = None
delta_loss = None
inputs, graph_dists = batch
inputs = inputs.to(device)
graph_dists = graph_dists.to(device)
optimizer.zero_grad()
rand_val = random.random()
optimizing_model = False
if hasattr(model, "get_additional_embeddings"):
if rand_val > .6:
optimizing_model = False
optimizing_deltas = False
# model.deltas = True
for p in model.parameters():
p.requires_grad = False
for p in model.get_additional_embeddings().parameters():
p.requires_grad = True
if model.deltas:
for p in model.main_deltas.parameters():
p.requires_grad = False
if hasattr(model, "additional_deltas"):
for p in model.additional_deltas.parameters():
p.requires_grad = False
# elif rand_val > 0.3:
elif rand_val > 0:
optimizing_model = True
optimizing_deltas = False
# model.deltas = True
for p in model.parameters():
p.requires_grad = True
for p in model.get_additional_embeddings().parameters():
p.requires_grad = False
if model.deltas:
for p in model.main_deltas.parameters():
p.requires_grad = False
if hasattr(model, "additional_deltas"):
for p in model.additional_deltas.parameters():
p.requires_grad = False
else:
optimizing_model = False
optimizing_deltas = True
model.deltas = True
for p in model.parameters():
p.requires_grad = False
for p in model.get_additional_embeddings().parameters():
p.requires_grad = False
if model.deltas:
for p in model.main_deltas.parameters():
p.requires_grad = True
if hasattr(model, "additional_deltas"):
for p in model.additional_deltas.parameters():
p.requires_grad = True
loss = 0.01 * manifold_dist_loss_relu_sum(model, inputs, graph_dists, manifold,
**loss_params)
loss.backward()
loss_grad_norm = optimizer.step()
batch_losses.append(loss.cpu().detach().numpy())
del loss
# import gc;gc.collect()
# torch.cuda.empty_cache()
if optimizing_model and hasattr(model,
'embedding_model') and conformal_loss_params is not None and epoch % \
conformal_loss_params["update_every"] == 0:
optimizer.zero_grad()
main_inputs = inputs.narrow(1, 0, 1).squeeze(1).clone().detach()
perm = torch.randperm(main_inputs.size(0))
idx = perm[:conformal_loss_params["num_samples"]]
main_inputs = main_inputs[idx]
# model.deltas = False
conf_loss = 0.5 * metric_loss(model, main_inputs, feature_manifold, manifold,
dimension,
isometric=conformal_loss_params["isometric"],
random_samples=conformal_loss_params[
"random_samples"],
random_init=conformal_loss_params["random_init"])
conf_loss.backward()
conf_loss_grad_norm = optimizer.step()
batch_conf_losses.append(conf_loss.cpu().detach().numpy())
if thread_number == 0:
write_tensorboard('add_scalar',
['minibatch_conf_loss', float(batch_conf_losses[-1]),
batch_num])
write_tensorboard('add_scalar',
['conf_loss_gradient_norm', conf_loss_grad_norm, batch_num])
del conf_loss
# import gc;gc.collect()
# torch.cuda.empty_cache()
# model.deltas = True
if hasattr(model, 'main_deltas') and optimizing_deltas:
main_inputs = inputs.view(inputs.shape[0], -1)
vals = model.main_deltas(
model.index_map[main_inputs][model.index_map[main_inputs] >= 0])
mean_deltas = torch.mean(torch.norm(vals, dim=-1))
delta_loss = 0.03 * torch.sum(torch.norm(vals, dim=-1) ** 2)
'''
total_loss = None
if conformal_loss_params is not None and conf_loss is not None:
total_loss = (1 - conformal_loss_params["weight"]) * loss + conformal_loss_params["weight"] * conf_loss
if delta_loss is not None:
# total_loss += delta_loss
pass
total_loss.backward()
else:
if conformal_loss_params is not None:
scaled_loss = (1 - conformal_loss_params["weight"]) * loss
else:
scaled_loss = loss
if delta_loss is not None:
scaled_loss += delta_loss
scaled_loss.backward()
'''
if thread_number == 0:
write_tensorboard('add_scalar',
['minibatch_loss', float(batch_losses[-1]), batch_num])
write_tensorboard('add_scalar', ['gradient_norm', loss_grad_norm, batch_num])
'''
if total_loss is not None:
write_tensorboard('add_scalar', ['minibatch_total_loss', total_loss.cpu().detach().numpy(), batch_num])
'''
if delta_loss is not None:
write_tensorboard('add_scalar',
['minibatch_delta_loss', delta_loss.cpu().detach().numpy(),
batch_num])
write_tensorboard('add_scalar',
['minibatch_delta_mean', mean_deltas.cpu().detach().numpy(),
batch_num])
for name, value in tensorboard_watch.items():
write_tensorboard('add_scalar', [name, value.cpu().detach().numpy(), batch_num])
elapsed = timeit.default_timer() - t_start
batch_num += 1
mean_loss = float(np.mean(batch_losses))
if thread_number == 0:
if conformal_loss_params is not None and len(batch_conf_losses) > 0:
mean_conf_loss = float(np.mean(batch_conf_losses))
metric_loss_type = "isometric" if conformal_loss_params[
"isometric"] else "conformal"
write_tensorboard('add_scalar',
[f'batch_{metric_loss_type}_loss', mean_conf_loss, epoch])
write_tensorboard('add_scalar', ['batch_loss', mean_loss, epoch])
write_tensorboard('add_scalar', ['learning_rate', lr_scheduler.get_lr()[0], epoch])
lr_scheduler.step()
|
class MyClass:
def __init__(self, value): self.__value = value
def __int__(self): return int(self.__value)
c = MyClass(1.23)
print(int(c))
|
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"component_save_data_fixture": "tst.components.ipynb",
"column_transformer_data_fixture": "tst.compose.ipynb",
"multi_split_data_fixture": "tst.compose.ipynb",
"test_pipeline_find_last_fitted_model_seq_others": "tst.compose.ipynb",
"test_pipeline_find_last_fitted_model_parallel_2": "tst.compose.ipynb",
"test_data_conversion_sequential_parallel_column_transformer": "tst.compose.ipynb",
"example_people_data_fixture": "tst.nbdev_utils.ipynb",
"Splitter": "blocks.ipynb",
"test_splitter": "blocks.ipynb",
"DoubleKFoldBase": "blocks.ipynb",
"SingleKFold": "blocks.ipynb",
"test_single_kfold": "blocks.ipynb",
"FixedDoubleKFold": "blocks.ipynb",
"test_fixed_double_kfold": "blocks.ipynb",
"SkSplitGenerator": "blocks.ipynb",
"test_sksplit_generator": "blocks.ipynb",
"PandasEvaluator": "blocks.ipynb",
"test_pandas_evaluator": "blocks.ipynb",
"OneHotEncoder": "preprocessing.ipynb",
"test_one_hot_encoder": "preprocessing.ipynb",
"WindowGenerator": "preprocessing.ipynb",
"generate_input_for_window_generator": "data_conversion.ipynb",
"test_window_generator": "preprocessing.ipynb",
"WindowAggregator": "preprocessing.ipynb",
"test_window_aggregator": "preprocessing.ipynb",
"path_results": "config.bt_defaults.ipynb",
"path_models": "config.bt_defaults.ipynb",
"path_data": "config.bt_defaults.ipynb",
"file_format": "config.bt_defaults.ipynb",
"verbose": "config.bt_defaults.ipynb",
"name_logger": "config.bt_defaults.ipynb",
"save_splits": "config.bt_defaults.ipynb",
"group": "config.bt_defaults.ipynb",
"error_if_present": "config.bt_defaults.ipynb",
"overwrite_field": "config.bt_defaults.ipynb",
"mode_logger": "config.bt_defaults.ipynb",
"separate_labels": "config.bt_defaults.ipynb",
"warning_if_nick_name_exists": "config.bt_defaults.ipynb",
"propagate": "config.bt_defaults.ipynb",
"path_session_folder": "config.bt_defaults.ipynb",
"session_filename": "config.bt_defaults.ipynb",
"path_logger_folder": "config.bt_defaults.ipynb",
"logger_filename": "config.bt_defaults.ipynb",
"logger_null_filename": "config.bt_defaults.ipynb",
"stdout_logger": "config.bt_defaults.ipynb",
"null_name_logger": "config.bt_defaults.ipynb",
"Component": "components.ipynb",
"test_component_config": "components.ipynb",
"test_component_store_attrs": "components.ipynb",
"test_component_aliases": "components.ipynb",
"test_component_predict": "components.ipynb",
"test_component_multiple_inputs": "components.ipynb",
"TransformWithFitApply": "components.ipynb",
"TransformWithoutFitApply": "components.ipynb",
"test_component_fit_apply": "components.ipynb",
"MyDataConverter": "components.ipynb",
"TransformWithFitApplyDC": "components.ipynb",
"test_component_validation_test": "components.ipynb",
"TransformWithoutFitApply2": "components.ipynb",
"TransformWithFitApply2": "components.ipynb",
"component_save_data": "components.ipynb",
"test_component_save_load": "components.ipynb",
"Transform1": "compose.ipynb",
"test_component_run_depend_on_existence": "components.ipynb",
"test_component_logger": "components.ipynb",
"test_component_data_converter": "components.ipynb",
"test_component_data_io": "components.ipynb",
"test_component_equal": "components.ipynb",
"test_set_paths": "components.ipynb",
"TransformWithoutFit": "components.ipynb",
"TransformWithFitApplyOnly": "components.ipynb",
"test_determine_fit_function": "components.ipynb",
"test_use_fit_from_loaded_estimator": "components.ipynb",
"test_direct_methods": "components.ipynb",
"test_pass_apply": "components.ipynb",
"test_get_specific_data_io_parameters_for_component": "components.ipynb",
"test_get_specific_data_io_parameters": "components.ipynb",
"test_standard_converter_in_component": "components.ipynb",
"test_set_suffix": "compose.ipynb",
"SamplingComponent": "components.ipynb",
"test_sampling_component": "components.ipynb",
"SklearnComponent": "components.ipynb",
"PickleSaverComponent": "components.ipynb",
"test_sklearn_component": "components.ipynb",
"NoSaverComponent": "components.ipynb",
"test_no_saver_component": "components.ipynb",
"OneClassSklearnComponent": "components.ipynb",
"get_data_for_one_class": "components.ipynb",
"test_one_class_sklearn_component": "components.ipynb",
"PandasComponent": "components.ipynb",
"test_pandas_component": "components.ipynb",
"MultiComponent": "compose.ipynb",
"SimpleMultiComponent": "compose.ipynb",
"test_multi_comp_io": "compose.ipynb",
"test_multi_comp_desc": "compose.ipynb",
"test_athena_pipeline_training": "compose.ipynb",
"test_gather_and_save_info": "compose.ipynb",
"test_multi_comp_hierarchy": "compose.ipynb",
"test_multi_comp_profiling": "compose.ipynb",
"test_multi_comp_all_equal": "compose.ipynb",
"test_multi_component_setters": "compose.ipynb",
"test_show_result_statistics": "compose.ipynb",
"test_pass_components": "compose.ipynb",
"test_chain_folders": "compose.ipynb",
"test_set_root": "compose.ipynb",
"test_set_root_2": "compose.ipynb",
"test_pass_functions_to_multi_component": "compose.ipynb",
"Pipeline": "compose.ipynb",
"Sequential": "compose.ipynb",
"Transform2": "compose.ipynb",
"SimplePipeline": "compose.ipynb",
"test_pipeline_fit_apply": "compose.ipynb",
"test_pipeline_fit_apply_bis": "compose.ipynb",
"test_pipeline_new_comp": "compose.ipynb",
"test_pipeline_set_comp": "compose.ipynb",
"test_pipeline_load_estimator": "compose.ipynb",
"build_pipeline_construct_diagram_1": "compose.ipynb",
"build_pipeline_construct_diagram_2": "compose.ipynb",
"test_construct_diagram": "compose.ipynb",
"test_show_summary": "compose.ipynb",
"test_multi_comp_profiling2": "compose.ipynb",
"make_pipeline": "compose.ipynb",
"test_make_pipeline": "compose.ipynb",
"pipeline_factory": "compose.ipynb",
"test_pipeline_factory": "compose.ipynb",
"PandasPipeline": "compose.ipynb",
"PandasTransformWithLabels1": "compose.ipynb",
"PandasTransformWithLabels2": "compose.ipynb",
"SimplePandasPipeline": "compose.ipynb",
"TransformWithLabels1": "compose.ipynb",
"TransformWithLabels2": "compose.ipynb",
"SimplePandasPipelineNoPandasComponent": "compose.ipynb",
"test_pandas_pipeline": "compose.ipynb",
"Parallel": "compose.ipynb",
"test_parallel": "compose.ipynb",
"test_pipeline_find_last_result": "compose.ipynb",
"test_pipeline_find_last_result_parallel1": "compose.ipynb",
"test_pipeline_find_last_result_parallel2": "compose.ipynb",
"test_pipeline_find_last_result_parallel3": "compose.ipynb",
"test_pipeline_find_last_fitted_model_seq": "compose.ipynb",
"test_pipeline_find_last_fitted_model_parallel": "compose.ipynb",
"test_pipeline_find_last_fitted_model_parallel_remove": "compose.ipynb",
"MultiModality": "compose.ipynb",
"TransformM": "compose.ipynb",
"test_multi_modality": "compose.ipynb",
"ColumnSelector": "compose.ipynb",
"test_column_selector": "compose.ipynb",
"Concat": "compose.ipynb",
"test_concat": "compose.ipynb",
"ColumnTransformer": "compose.ipynb",
"Identity": "compose.ipynb",
"test_identity": "compose.ipynb",
"make_column_transformer_pipelines": "compose.ipynb",
"make_column_transformer": "compose.ipynb",
"column_transformer_data": "compose.ipynb",
"test_make_column_transformer": "compose.ipynb",
"test_make_column_transformer_passthrough": "compose.ipynb",
"test_make_column_transformer_remainder": "compose.ipynb",
"test_make_column_transformer_descendants": "compose.ipynb",
"test_make_column_transformer_fit_transform": "compose.ipynb",
"MultiSplitComponent": "compose.ipynb",
"MultiSplitDict": "compose.ipynb",
"multi_split_data": "compose.ipynb",
"test_multi_split_transform": "compose.ipynb",
"test_multi_split_fit": "compose.ipynb",
"test_multi_split_chain": "compose.ipynb",
"test_multi_split_io": "compose.ipynb",
"test_multi_split_non_dict": "compose.ipynb",
"test_multi_split_non_dict_bis": "compose.ipynb",
"MultiSplitDFColumn": "compose.ipynb",
"multi_split_data_df_column": "compose.ipynb",
"test_multi_split_df_column_transform": "compose.ipynb",
"test_multi_split_df_column_fit": "compose.ipynb",
"ParallelInstances": "compose.ipynb",
"CrossValidator": "compose.ipynb",
"test_cross_validator_1": "compose.ipynb",
"test_cross_validator_2": "compose.ipynb",
"test_cross_validator_3": "compose.ipynb",
"DataConverter": "data_conversion.ipynb",
"test_data_converter_functions": "data_conversion.ipynb",
"NoConverter": "data_conversion.ipynb",
"test_no_converter": "data_conversion.ipynb",
"GenericConverter": "data_conversion.ipynb",
"test_generic_converter": "data_conversion.ipynb",
"StandardConverter": "data_conversion.ipynb",
"test_standard_converter": "data_conversion.ipynb",
"PandasConverter": "data_conversion.ipynb",
"test_pandas_converter": "data_conversion.ipynb",
"Window2Dto3Dconverter": "data_conversion.ipynb",
"test_window2d_to_3d_converter": "data_conversion.ipynb",
"data_converter_factory": "data_conversion.ipynb",
"test_data_converter_factory": "data_conversion.ipynb",
"save_csv": "utils.ipynb",
"save_parquet": "utils.ipynb",
"save_multi_index_parquet": "utils.ipynb",
"save_keras_model": "utils.ipynb",
"save_csv_gz": "utils.ipynb",
"read_csv": "utils.ipynb",
"read_csv_gz": "utils.ipynb",
"load_keras_model": "utils.ipynb",
"estimator2io": "utils.ipynb",
"result2io": "utils.ipynb",
"DataIO": "utils.ipynb",
"DummyComponent": "utils.ipynb",
"test_data_io_folder": "utils.ipynb",
"dummy_component": "utils.ipynb",
"test_data_io_chaining": "utils.ipynb",
"PandasIO": "utils.ipynb",
"PickleIO": "utils.ipynb",
"SklearnIO": "utils.ipynb",
"NoSaverIO": "utils.ipynb",
"data_io_factory": "utils.ipynb",
"test_data_io_factory": "utils.ipynb",
"ModelPlotter": "utils.ipynb",
"Profiler": "utils.ipynb",
"test_profiler": "utils.ipynb",
"Comparator": "utils.ipynb",
"MyTransformComparator": "utils.ipynb",
"test_comparator": "utils.ipynb",
"test_comparator2": "utils.ipynb",
"camel_to_snake": "utils.ipynb",
"snake_to_camel": "utils.ipynb",
"DataSet": "datasets.ipynb",
"MyDataSet": "datasets.ipynb",
"test_dataset": "datasets.ipynb",
"dsblocks_install_git_hooks": "cli.ipynb",
"main_dsblocks_install_git_hooks": "cli.ipynb",
"test_dsblocks_install_git_hooks": "cli.ipynb",
"SumXY": "dummies.ipynb",
"DummyEstimator": "dummies.ipynb",
"Intermediate": "dummies.ipynb",
"Higher": "dummies.ipynb",
"Sum1": "dummies.ipynb",
"Multiply10": "dummies.ipynb",
"NewParallel": "dummies.ipynb",
"MinMaxClass": "dummies.ipynb",
"Min10": "dummies.ipynb",
"Max10": "dummies.ipynb",
"make_pipe_fit1": "dummies.ipynb",
"make_pipe_fit2": "dummies.ipynb",
"make_pipe1": "dummies.ipynb",
"make_pipe2": "dummies.ipynb",
"Min10direct": "dummies.ipynb",
"Max10direct": "dummies.ipynb",
"Sum1direct": "dummies.ipynb",
"Multiply10direct": "dummies.ipynb",
"MaxOfPositiveWithSeparateLabels": "dummies.ipynb",
"MinOfPositiveWithoutSeparateLabels": "dummies.ipynb",
"DataSource": "dummies.ipynb",
"subtract_xy": "dummies.ipynb",
"DummyClassifier": "dummies.ipynb",
"test_dummy_classifier": "dummies.ipynb",
"cd_root": "nbdev_utils.ipynb",
"nbdev_setup": "nbdev_utils.ipynb",
"TestRunner": "nbdev_utils.ipynb",
"example_people_data": "nbdev_utils.ipynb",
"myf": "nbdev_utils.ipynb",
"my_first_test": "nbdev_utils.ipynb",
"second_fails": "nbdev_utils.ipynb",
"third_fails": "nbdev_utils.ipynb",
"test_test_runner": "nbdev_utils.ipynb",
"test_test_runner_two_tests": "nbdev_utils.ipynb",
"test_test_runner_two_targets": "nbdev_utils.ipynb",
"test_cd_root": "nbdev_utils.ipynb",
"test_nbdev_setup": "nbdev_utils.ipynb",
"md": "nbdev_utils.ipynb",
"replace_imports": "nbdev_utils.ipynb",
"nbdev_build_test": "nbdev_utils.ipynb",
"create_fake_tests": "nbdev_utils.ipynb",
"test_nbdev_build_test": "nbdev_utils.ipynb",
"json_load": "utils.ipynb",
"json_dump": "utils.ipynb",
"make_reproducible": "utils.ipynb",
"test_make_reproducible": "utils.ipynb",
"get_logging_level": "utils.ipynb",
"delete_logger": "utils.ipynb",
"set_logger": "utils.ipynb",
"set_empty_logger": "utils.ipynb",
"set_verbosity": "utils.ipynb",
"test_set_logger": "utils.ipynb",
"remove_previous_results": "utils.ipynb",
"set_tf_loglevel": "utils.ipynb",
"test_set_tf_loglevel": "utils.ipynb",
"get_top_function": "utils.ipynb",
"test_get_top_function": "utils.ipynb",
"check_last_part": "utils.ipynb",
"test_check_last_part": "utils.ipynb",
"argnames": "utils.ipynb",
"store_attr": "utils.ipynb",
"test_store_attr": "utils.ipynb",
"get_specific_dict_param": "utils.ipynb",
"obtain_class_specific_attrs": "utils.ipynb",
"get_hierarchy_level": "utils.ipynb",
"test_get_hierarchy": "utils.ipynb",
"replace_attr_and_store": "utils.ipynb",
"test_replace_attr_and_store": "utils.ipynb",
"test_replace_attr_and_store_no_rec": "utils.ipynb"}
modules = ["tests/blocks/test_blocks.py",
"tests/blocks/test_preprocessing.py",
"tests/core/test_components.py",
"tests/core/test_compose.py",
"tests/core/test_data_conversion.py",
"tests/core/test_utils.py",
"tests/datasets/test_datasets.py",
"tests/utils/test_cli.py",
"tests/utils/test_dummies.py",
"tests/utils/test_nbdev_utils.py",
"tests/utils/test_utils.py",
"blocks/blocks.py",
"blocks/preprocessing.py",
"config/bt_defaults.py",
"core/components.py",
"core/compose.py",
"core/data_conversion.py",
"core/utils.py",
"datasets/datasets.py",
"utils/cli.py",
"utils/dummies.py",
"utils/nbdev_utils.py",
"utils/utils.py"]
doc_url = "https://Jaume-JCI.github.io/"
git_url = "https://github.com/Jaume-JCI/ds-blocks/tree/main/"
def custom_doc_links(name): return None
|
def solution():
data = open(r'inputs\day13.in').readlines()
print('Part 1 result: ' + str(part1(data)))
print('Part 2 result: ' + str(part2(data)))
def part1(data):
# build out the grid and instructions from our data
grid, fold_instructions = build_grid_and_instructions(data)
# run the first fold only
grid = fold(grid, fold_instructions[0])
# the length of the grid is our answer
return len(grid)
def part2(data):
# build out the grid and instructions from our data
grid, fold_instructions = build_grid_and_instructions(data)
# loop through every fold instruction, running it
for i in range(len(fold_instructions)):
instr = fold_instructions[i]
grid = fold(grid, instr)
# get the max x and y values
X = max([x for (x,y) in grid.keys()]) + 1
Y = max([y for (x,y) in grid.keys()]) + 1
# print out the word by looping through the grid printing one row at a time
ans = ''
for y in range(Y):
for x in range(X):
ans += ('x' if (x,y) in grid else ' ')
print(ans)
ans = ''
return 'Read above'
def build_grid_and_instructions(data):
grid = {}
fold_instructions = []
for line in data:
line = line.strip()
# ignore the blank lines
if line == '':
continue
if line.startswith('fold'):
# split on the equals sign
a, b = line.split('=')
# now, split the first piece on the comma and take the third element, this is our axis
a = a.split(' ')[2]
# add the instruction as a tuple to our fold_instructions list, for example fold along y=3 would be ('y', 3)
fold_instructions.append((a, b))
else:
# split on the comma and cast both to ints
x, y = [int(x) for x in line.strip().split(',')]
# set that spot in our grid to be true
grid[(x, y)] = True
# return the grid & instructions
return grid, fold_instructions
def fold(grid, instruction):
grid2 = {}
# the line we want to fold along
fold_line = int(instruction[1])
if instruction[0] == 'x':
for (x, y) in grid:
# if our x value is less than the fold line, we leave it alone, and copy the same location to the new grid
if x < fold_line:
grid2[(x, y)] = True
else:
# otherwise, we need the new location to be flipped across the fold line,
# so its new x value is the fold line minus the distance between the fold line and the current x value
# i.e. an x of 7 folded over 5 would get moved to x = 3
grid2[((fold_line - (x - fold_line), y))] = True
else:
# if it isn't x, it must be y
assert instruction[0] == 'y'
for (x, y) in grid:
# if our y value is less than the fold line, we leave it alone, and copy the same location to the new grid
if y < fold_line:
grid2[(x, y)] = True
else:
# otherwise, we need the new location to be flipped across the fold line,
# same logic as above, but with y instead
grid2[((x, fold_line - (y - fold_line)))] = True
# return the new grid
return grid2
solution() |
if 3 > 0:
print('yes')
if 3 < 0:
print('ok')
if 3 < 0:
print('ok')
else:
print('not ok')
print('*' * 40)
# 数据类型也可以作为判断条件。任何值为0的数字都是False,非0为True
# 其他非空对象为True,空对象为False。
# None也表示False
if -0.0:
print('0 is False')
if 101:
print('101 is True')
if ' ':
print('white space is True')
if '':
print('empty string is False')
if []:
print('empty list is False')
if [1, 2]:
print('非空列表为True')
if ():
print('empty tuple is False')
if {'name': 'bob'}:
print('非空字典为True')
if not None:
print('None is False')
if not 0:
print('0 is False')
|
cappacity = 0
lines = int(input())
for i in range(0, lines):
water = int(input())
if cappacity + water > 255:
print("Insufficient capacity!")
continue
else:
cappacity += water
print(cappacity) |
# -*- coding: utf-8 -*-
# This file is generated automatically by: ECConverter
# Raw excel directory name: example_enum
# Do not modify this file manually
# Your modification will be overridden when the automatic generation is performed
# Unless you know what you are doing
class GameGlobalEvent(object):
"""
游戏全局事件
"""
ENTER_LOGIN_SCENE = 1 # 进入登录场景
ENTER_COMBAT_SCENE = 2 # 进入战斗场景
class SceneId(object):
"""
各场景id
"""
LOGIN_SCENE = 'LoginScene' # 登录场景
COMBAT_SCENE = 'CombatScene' # 战斗场景
class BTreeNodeState(object):
"""
行为树节点的状态
"""
FAILURE = 0 # 失败
SUCCESS = 1 # 成功
RUNNING = 2 # 运行中
BREAK = 3 # 运行中被打断
|
# Write your code here
def query(arr, x, l, r, k):
for i in range(l-1,r):
if arr[i] == x:
k -= 1
if k == 0:
print(i+1)
return
print(-1)
return
def update(arr, ind, value):
arr[ind-1] = value
n,x = map(int, input().split())
arr = list(map(int, input().split()))
Q = int(input())
for q in range(Q):
s = input().split()
if s[0] == '1':
l,r,k = int(s[1]), int(s[2]), int(s[3])
query(arr, x, l, r, k)
else:
ind, value = int(s[1]), int(s[2])
update(arr, ind, value)
|
"""
makers
======
Auxjad's leaf making classes.
"""
|
def foo(a, b):
a = a + b
print(a, b)
def bar(x):
x += 1
print(x+1)
x = x + 1
return x
def multi(
a,
b,
c=12):
pass
if a is None:
print(123)
if a == b and \
True:
print(bla)
class A:
def bar(self, aa):
print(aa)
|
def part_one(data_input: list) -> int:
frequency = 0
for line in data_input:
frequency += int(line)
return frequency
def part_two(data_input: list) -> int:
change_after_iteration = sum(data_input)
if not change_after_iteration:
return change_after_iteration
best_n_repetition = float("inf")
frequency = 0
first_row = []
for elem in data_input:
first_row.append(frequency + elem)
frequency += elem
for elem in first_row:
for rep in first_row:
if (rep - elem) % change_after_iteration == 0 and best_n_repetition > (
rep - elem) / change_after_iteration and rep - elem > 0:
best_n_repetition = (rep - elem) / change_after_iteration
frequency = rep
return frequency
|
'''
This is the 5th problem on Day 3 based on if else and if statements
In this problem, we are going to build a love calculator which shall calculate compatibility between 2 people
if score < 10 or score > 90, we have to print Your score is this, you go together like coke and mentos
if score >=40 and score <= 50 we have to print Your score is this, you are alright together
else print your score is this
'''
'''
The following function calculates the love compatibility between 2 people
Don\'t have to take this value seriously ;-). It is meant to be a fun project and created for the general understanding of if-elif-else and basic for loops
This function takes 2 names as input.
Then it counts the number of times the letters of the word TRUE occur in the 2 names. Let that be count_true
Secondly, it counts the number of times the letters of the word LOVE occur in the 2 names. Let that be count_love
Finally, the result is created by putting count_true in ten's place and count_love in unit's place
For example:-
name1 = Luis
name2 = Gerard
count_true = 4
count_love = 2
Result = 42
'''
def loveCalculator():
name1 = input("Enter your name: ").lower()
name2 = input("Enter your loved one\'s name: ").lower()
count_true = 0
count_love = 0
for s in name1:
if s in 'true':
count_true += 1
if s in 'love':
count_love += 1
for s in name2:
if s in 'true':
count_true += 1
if s in 'love':
count_love += 1
score = (count_true*10) + count_love
if score < 10 or score > 90:
print(f"Your score is {score}, you go together like coke and mentos")
elif score >= 40 and score <= 50:
print(f"Your score is {score}, you are alright together")
else:
print(f"Your score is {score}")
if __name__ == "__main__":
loveCalculator()
|
"""merge 886b65 and f94174
Revision ID: 99822318096d
Revises: f94174183e7e, 886b65e82e3e
Create Date: 2020-10-29 15:54:09.623122
"""
# revision identifiers, used by Alembic.
revision = '99822318096d'
down_revision = ('f94174183e7e', '886b65e82e3e')
branch_labels = None
depends_on = None
def upgrade():
pass
def downgrade():
pass
|
# learn about boolean
#a=True
#b=False
a=not True
b=not False
print(a)
print(b) |
def affiche_table(liste):
...
def construit_table(largeur, hauteur):
tab = [[],[]]
for nb in range(largeur):
tab[0].append(nb+1)
for nb in range(hauteur):
tab[1].append(nb+1)
for line in hauteur:
tab.append([])
return tab
|
name = "Gary"
number = len(name) * 3
print("Hello {}, your lucky number is {}".format(name, number))
|
# DP
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]
b = [[0] * N for _ in range(2)]
b[0][0] = A[0][0]
for i in range(1, N):
b[0][i] = b[0][i - 1] + A[0][i]
b[1][0] = b[0][0] + A[1][0]
for i in range(1, N):
b[1][i] = max(b[1][i - 1], b[0][i]) + A[1][i]
print(b[1][N - 1])
|
class Solution:
def missingNumber(self, nums: List[int]) -> int:
ideal_sum = 0
actual_sum = 0
for i in range(0, len(nums)):
ideal_sum += i
actual_sum += nums[i]
ideal_sum += len(nums)
return ideal_sum - actual_sum |
class TokenType:
ID = 'ID'
STRING = 'STRING'
NUMBER = 'NUMBER'
REGEX = 'REGEX'
COMMA = 'COMMA'
L_BRACKET = 'LEFT BRACKET'
R_BRACKET = 'RIGHT BRACKET'
COLON = 'COLON'
SEMICOLON = 'SEMICOLON'
NEW_LINE = 'NEW LINE'
TAB = 'TAB'
class Token:
def __init__(self, token_type, lexme, source_index):
self.token_type = token_type
self.lexme = lexme
self.source_index = source_index
def __str__(self):
if (self.token_type == TokenType.NEW_LINE or self.token_type == TokenType.TAB):
return self.token_type + "\t\t" + str(self.source_index)
return self.token_type + "\t" + self.lexme + "\t" + str(self.source_index) |
'''
给定一个整数数组,其中第 i 个元素代表了第 i 天的股票价格 。
设计一个算法计算出最大利润。在满足以下约束条件下,你可以尽可能地完成更多的交易(多次买卖一支股票):
你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。
卖出股票后,你无法在第二天买入股票 (即冷冻期为 1 天)。
示例:
输入: [1,2,3,0,2]
输出: 3
解释: 对应的交易状态为: [买入, 卖出, 冷冻期, 买入, 卖出]
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-with-cooldown
'''
class Solution:
def maxProfit(self, prices: List[int]) -> int:
if not prices:
return 0
n = len(prices)
f0, f1, f2 = -prices[0], 0, 0
for i in range(1, n):
newf0 = max(f0, f2 - prices[i])
newf1 = f0 + prices[i]
newf2 = max(f1, f2)
f0, f1, f2 = newf0, newf1, newf2
return max(f1, f2)
|
array = list(input().split(","))
def find_single(array):
for item in array:
if array.count(item) == 1:
return item
print(find_single(array))
|
n = int(input())
height = list(map(int,input().strip(" ").split()))
distinct = set(height)
average = sum(distinct)/len(distinct)
print(average)
|
# Write your solution for 1.4 here!
def is_prime(x):
a=0
for i in range(2,x):
if x%i==0:
a+=1
if a==1:
return(False)
print("False")
else:
return(True)
print("True")
is_prime(13)
is_prime(4)
|
def runner_cli(augury, args):
assert args.cmd == 'runner'
paths = {
'status': set_status,
'config': get_config,
'artifacts': add_artifacts,
}
paths[args.runner_cmd](augury, args)
def set_status(augury, args):
if args.status:
print(augury.set_runner_status(args.status))
else:
print(augury.get_runner_status())
def get_config(augury, args):
print(augury.fetch_config())
def add_artifacts(augury, args):
print(augury.add_artifacts(args.input))
def create_parser(parser):
runner = parser.add_parser('runner')
subparsers = runner.add_subparsers(dest='runner_cmd')
subparsers.required = True
status = subparsers.add_parser('status')
status.add_argument('-s', '--status', help='status text to set')
status.add_argument('-e', '--error', help='error message')
config = subparsers.add_parser('config')
artifacts = subparsers.add_parser('artifacts')
artifacts.add_argument('input', nargs='+', help='list of files to mark as artifacts')
|
locit_settings = {
'scaling': 'none'
}
coral_settings = {
'scaling': 'none' # needs to be none with separate test set!
}
pwmstl_settings = {
'mu': 0.1,
'rho': 1.0,
'beta1': 10.0,
'beta2': 10.0,
'kernel': 'linear',
'max_alpha': 10.0,
'tau_lambda': 1.0
} |
total = int(input('Quanto vc quer sacar? R$ '))
nota = 50
totalNotas = 0
while True:
if total >= nota:
total -= nota
totalNotas += 1
else:
if totalNotas > 0:
print(f'Serão {totalNotas} de R${nota}')
if nota == 50:
nota = 20
elif nota == 20:
nota = 10
elif nota == 10:
nota = 1
totalNotas = 0
if total == 0:
break
|
#
# Copyright 2022 Duncan Rose
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
FILL = 8080 # Go with DUIM's 100 screens
class SpaceReq():
def __init__(self, minx, desx, maxx, miny, desy, maxy):
self._xmax = _fill_or(maxx)
self._xmin = _fill_or(minx)
self._xpref = _fill_or(desx)
self._ymax = _fill_or(maxy)
self._ymin = _fill_or(miny)
self._ypref = _fill_or(desy)
def __repr__(self):
return "SpaceReq([{},{},{}], [{},{},{}])".format(
self.x_min() if self.x_min() < FILL else "FILL",
self.x_preferred() if self.x_preferred() < FILL else "FILL",
self.x_max() if self.x_max() < FILL else "FILL",
self.y_min() if self.y_min() < FILL else "FILL",
self.y_preferred() if self.y_preferred() < FILL else "FILL",
self.y_max() if self.y_max() < FILL else "FILL")
def x_max(self):
return self._xmax
def x_preferred(self):
return self._xpref
def x_min(self):
return self._xmin
def y_max(self):
return self._ymax
def y_preferred(self):
return self._ypref
def y_min(self):
return self._ymin
def _fill_or(n):
return n if n < FILL else FILL
def combine_spacereqs(sr1, sr2, xcombiners, ycombiners):
min_x = _fill_or(xcombiners[0](sr1._xmin, sr2._xmin))
pref_x = _fill_or(xcombiners[1](sr1._xpref, sr2._xpref))
max_x = _fill_or(xcombiners[2](sr1._xmax, sr2._xmax))
min_y = _fill_or(ycombiners[0](sr1._ymin, sr2._ymin))
pref_y = _fill_or(ycombiners[1](sr1._ypref, sr2._ypref))
max_y = _fill_or(ycombiners[2](sr1._ymax, sr2._ymax))
return SpaceReq(min_x, pref_x, max_x, min_y, pref_y, max_y)
|
errors = {
'NotFound': {
'status': 404,
},
'BadRequest': {
'status': 400,
},
'MethodNotAllowed': {
'status': 405,
}
} |
num = list()
pares = list()
impares = list()
print(f'Informe 10 números para colocar em uma lista:')
for a in range(0, 10):
num.append((int(input(f'Informe o {a + 1}º número: '))))
for p in num:
if p % 2 == 0:
pares.append(p)
else:
impares.append(p)
num.sort()
pares.sort()
impares.sort()
print(f'Os números digitados foram: {num}\n'
f'os pares são{pares}\n'
f'e por fim os impares são{impares}') |
# Copyright (c) 2019-2020 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
INSTALL = ['libva', 'libva-utils', 'gmmlib', 'ffmpeg', 'metrics-calc-lite', 'media-driver', 'mediasdk']
TEST_SCRIPT_PATH = infra_path / 'driver_tests'
TEST_ENV = {
'MFX_HOME': '/opt/intel/mediasdk',
'LD_LIBRARY_PATH': '/opt/intel/mediasdk/lib64',
'LIBVA_DRIVERS_PATH': '/opt/intel/msdk_driver/lib64',
'LIBVA_DRIVER_NAME': 'iHD'
}
DRIVER_TESTS = [
'CABA1_SVA_B',
'CABA1_Sony_D',
'avc_cbr_001',
'avc_cqp_001',
'scale_001'
]
ARTIFACTS_LAYOUT = {
str(options['LOGS_DIR']): 'logs',
str(infra_path / 'ted/results'): 'mediasdk',
str(infra_path / 'smoke_test' / 'hevc_fei_tests_res.log'): 'hevc_fei_tests.log'
}
action(f'Create temp dir for driver tests',
work_dir=TEST_SCRIPT_PATH,
cmd=f'mkdir -p temp',
verbose=True)
for test_id in DRIVER_TESTS:
action(f'Run media-driver test {test_id}',
work_dir=TEST_SCRIPT_PATH,
cmd=f'python3 run_test.py {test_id}',
env=TEST_ENV,
verbose=True)
action(f'Run MediaSDK TED test',
work_dir=infra_path,
cmd=f'python3 ted/ted.py',
env=TEST_ENV,
verbose=True)
action(f'Run MediaSDK fei test',
work_dir=infra_path,
cmd=f'python3 smoke_test/hevc_fei_smoke_test.py',
env=TEST_ENV,
verbose=True)
|
# This is my first Python Project using Project Euler.
# Find the sum of all the multiples of 3 or 5 below 1000.
# The easy and efficient way
# (1 + 2 + 3 + .... n) = 1/2 n(n+1)
print(0.5*((333*1002)+(199*1000)-(66*1005)))
# The second way
# I am defining a function to sum up all of the multiples of 3 and 5.
# I did not finish it because it did not work.
def sum():
# The multiples have to below 1000, they are between 1 and 1000 (including 1)
Number = range(1, 1000)
# In order to tell if the numbers are multiples of a number, you use modular arithmetic. You divide all
# the numbers by the number and see if the remainder is 0. The symbol is %.
def Multiple_of_3():
for x in Number:
y = x / 3
print(y)
if type(y) == int:
print(x)
else:
pass
Multiple_of_3()
sum()
# A third way I found on Project Euler Website that works.
a = range(1000)
count = 0
for i in a:
if i%3 !=0 and i%5 !=0:continue
count += i
print('sum:',count)
|
#!python3
print("Nome válido")
print("")
nome = input("Digite o nome completo de uma pessoa: ")
nomeValido = True
for i in range(0, len(nome)):
caractere = nome[i]
if (not caractere.isalpha()) and (not caractere.isspace()):
nomeValido = False
break
if nomeValido:
print("O nome informado é válido")
else:
print("O nome informado é inválido")
|
# Grandes magicos: Comece com uma copia de seu programa do Exercicio 8.9. Escreva uma funcao chamada make_great() que modifique a lista de magicos acrescentando a expressao o Grande ao nome de cada magico. Chame show_magicians() para ver se a lista foi realmente modificada.
def make_great(m):
for c in range(0, 6):
print(f"The {c+1}ª magicians name is, The Great {m[c]}")
return m
# Programa principal
magic = ''
magicians = list()
for magic in range(0, 6):
magic = str(input("Magician name: "))
magicians.append(magic)
result = magicians[:]
make_great(result)
|
"""
Adds the even valued numbers of the fibonacci series below limit
Author: Juan Rios
"""
def fibonacci_sum(limit):
a = 1
b = 2
sum = 0
while (b<limit):
if (b%2==0):
sum += b
temp = b
b += a
a = temp
return sum
if __name__ == "__main__":
limit = 4000000
print('The sum of even-valued fibonnaci terms below {0} is {1}'.format(limit, fibonacci_sum(limit))) |
'''Crie um programa onde o usuário possa digitar 5 valores numéricos e cadastre-os em uma lista, já na posição correta de inserção. No final, mostre a lista ordenada na tela.'''
num = list()
for n in range(0, 5):
num.append(int(input('Informe um número: ')))
num.sort()
print(f'Os números cadastrados na lista são {num}') |
'''
File: __init__.py
Project: src
File Created: Sunday, 28th February 2021 3:03:13 am
Author: Sparsh Dutta (sparsh.dtt@gmail.com)
-----
Last Modified: Sunday, 28th February 2021 3:03:13 am
Modified By: Sparsh Dutta (sparsh.dtt@gmail.com>)
-----
Copyright 2021 Sparsh Dutta
'''
|
""":mod:`Stock` -- Provides an interface for Neopets stocks
.. module:: Stock
:synopsis: Provides an interface for Neopets stocks
.. moduleauthor:: Kelly McBride <kemcbride28@gmail.com>
"""
def clean_numeric(string_value):
# Clean commas
cleaned = string_value.replace(',', '')
# Clean percent signs
cleaned = cleaned.replace('%', '')
return cleaned
class Stock:
""" An class representing a Neopets stock
Attributes
ticker
open
current price
qty || volume
% change
company -- maybe null
chg -- maybe null
paid -- maybe null
mkt value -- maybe null
"""
def __init__(self, data):
""" Initialized with data from an HTML row """
# Required Data
self.ticker = data['ticker'].split()[0]
self.volume = int(clean_numeric(data.get('volume', data.get('qty', ''))))
self.open_price = int(clean_numeric(data['open']))
self.curr_price = int(clean_numeric(data.get('curr')))
self.percent_change = float(clean_numeric(data['change'])) / 100.
# Optional Data
self.company = data.get('company', '')
self.absolute_change = data.get('chg')
self.paid = data.get('paid')
self.mkt_value = data.get('mkt value')
|
jpg1 = 0
jpg2 = 0
img1 = 0
img2 = 0
def setup():
global jpg1, jpg2
background(100)
smooth()
size(1200, 700)
noStroke()
jpg1 = loadImage ('br1.jpg')
jpg2 = loadImage ('bread1.gif')
def draw():
global jpg1, jpg2
if ( frameCount == 1):
image (jpg1 ,0 ,0)
val1 = int (random (0, 150))
val2 = int (random (0, 150))
img1 = jpg1.get(mouseX+val1, 0, 20, height)
img2 = jpg1.get(mouseX+val2, 0, 5, height)
blendMode (SUBTRACT)
tint (255, 20)
image (img1, mouseX+val1, random(0, height ))
blendMode ( BLEND )
noTint()
image (img2, mouseX-val2, 0)
image (jpg2, 0, 0)
def keyPressed():
if key == 's':
saveFrame( "myProcessing" + str(frameCount) + ".jpg ")
|
def slices(series, length):
if len(series) <= 0 or length <= 0:
raise ValueError("invalid arguments.")
if length > len(series):
raise ValueError(f"Cannot get {length} digit series from a {len(series)} digit string.")
resultList = []
diff = len(series) - length +1
for i in range (diff):
resultList.append(series[i:i+length])
return resultList
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 10 19:48:36 2019
@author: dvdgmf
"""
class MeteorologicalDiagnosis:
def __init__(self, obs, pred):
self.tptn = self.get_TPTN(obs, pred)
self.tn = self.tptn.count('TN')
self.tp = self.tptn.count('TP')
self.fn = self.tptn.count('FN')
self.fp = self.tptn.count('FP')
@staticmethod
def get_TPTN(obs, pred):
if len(obs) == len(pred):
if all(O in [0, 1] for O in obs) and all(P in [0, 1] for P in pred):
output_list = []
test = {
(0, 0): "TN",
(1, 1): "TP",
(0, 1): "FN",
(1, 0): "FP"
}
for O, P in zip(obs, pred):
output_list.append(test.get((O, P)))
return output_list
else:
print('Invalid values present in Y-Observed and/or Y-Predicted.'
'Only binary values 0 and 1 are supported!')
else:
print('Invalid list size. Y-Observed and Y-Predicted must match!')
def metrics(self):
val_accuracy = self.tryMetrics(self.accuracy)
val_bias = self.tryMetrics(self.bias)
val_pod = self.tryMetrics(self.pod)
val_pofd = self.tryMetrics(self.pofd)
val_far = self.tryMetrics(self.far)
val_csi = self.tryMetrics(self.csi)
val_ph = self.tryMetrics(self.ph)
val_ets = self.tryMetrics(self.ets)
val_hss = self.tryMetrics(self.hss)
val_hkd = self.tryMetrics(self.hkd)
return val_accuracy, val_bias, val_pod, val_pofd, val_far, val_csi, val_ph, val_ets, val_hss, val_hkd
def tryMetrics(self, fx):
tptn = self.tptn
tn = self.tn
tp = self.tp
fn = self.fn
fp = self.fp
try:
result = fx(tptn, tn, tp, fn, fp)
return result
except ZeroDivisionError as e:
pass
print('ZeroDivisionError:', e)
return None
except TypeError as e:
pass
print('TypeError:', e)
return None
def accuracy(self, tptn,tn,tp,fn,fp):
return (tp + tn) / len(tptn)
def bias(self, tptn,tn,tp,fn,fp):
return (tp + fp) / (tp + fn)
def pod(self, tptn,tn,tp,fn,fp):
return tp / (tp + fn)
def pofd(self, tptn,tn,tp,fn,fp):
return fp / (fp + tn)
def far(self, tptn,tn,tp,fn,fp):
return fp / (tp + fp)
def csi(self, tptn,tn,tp,fn,fp):
return tp / (tp + fp + fn)
def ph(self, tptn,tn,tp,fn,fp):
return ((tp + tn) * (tp + fp)) / (tp + tn + fp + fn)
def ets(self, tptn,tn,tp,fn,fp):
val_ph = self.tryMetrics(self.ph)
return (tp - val_ph) / (tp + fp + fn - val_ph)
def hss(self, tptn,tn,tp,fn,fp):
return ((tp * tn) - (fp * fn)) / ((((tp + fn) * (fn + tn)) + ((tp + fp) * (fp + tn))) / 2)
def hkd(self, tptn,tn,tp,fn,fp):
val_pod = self.tryMetrics(self.pod)
val_pofd = self.tryMetrics(self.pofd)
return val_pod - val_pofd
# ---------------------------------------------
if __name__ == '__main__':
obs = [0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1]
pred = [0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1]
mozao_tools = MeteorologicalDiagnosis(obs, pred)
val_accuracy, val_bias, val_pod, val_pofd, val_far, val_csi, val_ph, val_ets, val_hss, val_hkd = mozao_tools.metrics()
print('metrics:\n accuracy: {}\n bias: {}\n pod: {}\n pofd: {}\n far: {}'
'\n csi: {}\n ph: {}\n ets: {}\n hss: {}\n hkd: {}\n'.format(val_accuracy,
val_bias, val_pod, val_pofd, val_far,
val_csi, val_ph, val_ets, val_hss, val_hkd))
|
#desafio-040
nota1 = float(input('Digite a primeira nota: '))
nota2 = float(input('Digite a segunda nota: '))
med = (nota1 + nota2) / 2
if med > 7:
print('Você foi Aprovado PARABENS! ')
elif med < 5:
print('Você está REPROVADO ! ')
else:
med >= 5.1 or med >= 6.9
print('Você está de RECUPERACAO!!!') |
s = input('informe o seu sexo [M/F]: ')
while s not in 'MmFf':
s = input('Dados inválidos. Por favor, informe seu sexo[M/F]: ')
if s in 'Mm':
print('Sexo Masculino registrado com sucesso!')
elif s in 'Ff':
print('Sexo feminino registrado com sucesso!') |
"""
.. module:: base_geometry
:platform: Unix, Windows
:synopsis: Base classes for geometry
"""
def validate_knot(knot):
""" Confirm a knot is in the range [0, 1]
Parameters
----------
knot : float
Parameter to verify
Returns
-------
bool
Whether or not the knot is valid
"""
return (0.0 <= knot <= 1.0)
|
class Solution:
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
if len(nums) == 1:
return 1
idx = 1
for n in nums[2:]:
if n > nums[idx - 1]:
idx += 1
nums[idx] = n
return idx + 1
|
class Solution:
def gameOfLife(self, board: List[List[int]]) -> None:
"""
Do not return anything, modify board in-place instead.
"""
|
print('{:=^40}'.format(' LOJAS LACRAU '))
valorProduto = float(input('Qual o valor do produto? R$ '))
print('''FORMAS DE PAGAMENTO:
[ 1 ] À vista no dinheiro/cheque: 10% de desconto;
[ 2 ] À vista no cartão de débito/crédito: 5% de desconto;
[ 3 ] Em até 2x no cartão: preço normal;
[ 4 ] 3x ou mais no cartão: 20% de juros;
''')
formaPgto = int(input('Qual será a forma de pagamento? '))
if formaPgto == 1:
desconto = (valorProduto * 10) / 100
print('À vista no dinheiro/cheque, seu produto de R$ {:.2f}, fica R$ {:.2f} com 10% de desconto.'.format(valorProduto, valorProduto - desconto))
elif formaPgto == 2:
desconto = (valorProduto * 5) / 100
print('À vista no cartão de débito/crédito, seu produto de R$ {:.2f}, fica R$ {:.2f} com 5% de desconto.'.format(valorProduto, valorProduto - desconto))
elif formaPgto == 3:
print('Dividindo 2x no cartão, o seu produto no valor de R$ {:.2f}, você vai pagar 2x de R$ {:.2f}.'.format(valorProduto, valorProduto / 2))
elif formaPgto == 4:
juros = (valorProduto * 20) / 100
print('Divindo em 3x ou mais no cartão, o seu produto no valor de R$ {:.2f}, vai ficar R$ {:.2f} (20% de juros).'.format(valorProduto, valorProduto + juros))
else:
print('OPÇÃO INVÁLIDA, TENTE NOVAMENTE!')
|
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'AND ASSIGN COMMA DEF DIFF DIVIDE ELIF ELSE EQ FALSE FLOAT FOR GET GT ID IF IN INTEGER LBRACE LBRACKET LET LPAREN LT MINUS MINUSMINUS MULTIPLY NOT OR PLUS PLUSPLUS RBRACE RBRACKET RPAREN SEMI STRING TRUE WHILEcode : code sent\n\t\t\t\t| sent\n\t\t\t\t| emptysent : statement\n\t\t\t\t| instruction SEMIinstruction : assign\n\t\t\t\t\t | functionstatement : function_definition\n\t\t\t\t\t | for_statement\n\t\t\t\t\t | if_statement\n\t\t\t\t\t | while_statementfor_statement : FOR LPAREN for_valid_expr COMMA for_valid_expr COMMA for_valid_iter RPAREN LBRACE code RBRACE\n\t\t\t\t\t \t | FOR LPAREN ID IN ID RPAREN LBRACE code RBRACEfor_valid_expr : expr_num\n\t\t\t\t\t\t | expr_arithmfor_valid_iter : PLUS\n\t\t\t\t\t\t | PLUSPLUS\n\t\t\t\t\t\t | MINUS\n\t\t\t\t\t\t | MINUSMINUSif_statement : IF LPAREN logic_list RPAREN LBRACE code RBRACE\n\t\t\t \t\t\t| IF LPAREN logic_list RPAREN LBRACE code RBRACE elif_sent\n\t\t\t \t\t\t| IF LPAREN logic_list RPAREN LBRACE code RBRACE ELSE LBRACE code RBRACE\n\t\t\t \t\t\t| IF LPAREN logic_list RPAREN LBRACE code RBRACE elif_sent ELSE LBRACE code RBRACEelif_sent : ELIF LPAREN logic_list RPAREN LBRACE code RBRACE elif_sent\n\t\t\t\t\t | emptywhile_statement : WHILE LPAREN logic_list RPAREN LBRACE code RBRACEfunction_definition : DEF ID LPAREN RPAREN LBRACE code RBRACEassign : ID ASSIGN expr_type\n\t\t\t\t | ID ASSIGN expr_arithm\n\t\t\t\t | ID ASSIGN logic_list\n\t\t\t\t | ID ASSIGN expr_listassign : ID ASSIGN functionfunction : ID LPAREN list RPARENlist : list COMMA ID\n\t\t\t\t| list COMMA function\n\t\t\t\t| function\n\t\t\t\t| IDlist : list COMMA expr_type\n\t\t\t\t| expr_type\n\t\t\t\t| emptylist : list COMMA expr_arithm\n\t\t\t\t| list COMMA logic_list\n\t\t\t\t| expr_arithm\n\t\t\t\t| logic_listlogic_list : LPAREN logic_list RPARENlogic_list : logic_list AND logic_list\n\t\t\t\t\t | logic_list OR logic_list\n\t\t\t\t\t | expr_boolexpr_bool : expr_bool EQ expr_bool\n\t\t\t\t\t | expr_bool LT expr_bool\n\t\t\t\t\t | expr_bool LET expr_bool\n\t\t\t\t\t | expr_bool GT expr_bool\n\t\t\t\t\t | expr_bool GET expr_bool\n\t\t\t\t\t | expr_bool DIFF expr_bool\n\t\t\t\t\t | NOT expr_boolexpr_bool : functionexpr_bool : expr_type\n\t\t\t\t\t | expr_arithmexpr_arithm : LPAREN expr_arithm RPARENexpr_arithm : expr_arithm PLUS expr_arithm\n\t\t\t\t\t | expr_arithm MINUS expr_arithm\n\t\t\t\t\t | expr_arithm MULTIPLY expr_arithm\n\t\t\t\t\t | expr_arithm DIVIDE expr_arithm\n\t\t\t\t\t | MINUS expr_arithmexpr_arithm : ID\n\t\t\t\t\t | functionexpr_arithm : expr_typefunction : sent_index_listsent_index_list : sent_index_list LBRACKET ID RBRACKET\n\t\t\t\t\t\t | ID LBRACKET ID RBRACKETsent_index_list : sent_index_list LBRACKET INTEGER RBRACKET\n\t\t\t\t\t\t | ID LBRACKET INTEGER RBRACKETexpr_list : LBRACKET expr_inside_list RBRACKETexpr_inside_list : expr_inside_list COMMA expr_type\n\t\t\t\t\t\t\t| expr_inside_list COMMA expr_bool\n\t\t\t\t\t\t\t| expr_type\n\t\t\t\t\t\t\t| expr_bool\n\t\t\t\t\t\t\t| emptyexpr_type : expr_num\n\t\t\t\t\t | expr_stringexpr_bool : TRUEexpr_bool : FALSEexpr_num : FLOAT\n\t\t\t\t\t| INTEGERexpr_string : STRINGempty :'
_lr_action_items = {'DEF':([0,1,2,3,4,6,7,8,9,18,19,106,130,131,132,137,138,139,145,146,147,149,150,153,154,155,157,159,160,161,163,164,165,167,168,169,170,171,],[12,12,-2,-3,-4,-8,-9,-10,-11,-1,-5,12,12,12,12,12,12,-27,12,-20,-26,12,-21,-25,12,-13,12,12,12,12,-12,12,-22,-23,12,12,-86,-24,]),'FOR':([0,1,2,3,4,6,7,8,9,18,19,106,130,131,132,137,138,139,145,146,147,149,150,153,154,155,157,159,160,161,163,164,165,167,168,169,170,171,],[14,14,-2,-3,-4,-8,-9,-10,-11,-1,-5,14,14,14,14,14,14,-27,14,-20,-26,14,-21,-25,14,-13,14,14,14,14,-12,14,-22,-23,14,14,-86,-24,]),'IF':([0,1,2,3,4,6,7,8,9,18,19,106,130,131,132,137,138,139,145,146,147,149,150,153,154,155,157,159,160,161,163,164,165,167,168,169,170,171,],[15,15,-2,-3,-4,-8,-9,-10,-11,-1,-5,15,15,15,15,15,15,-27,15,-20,-26,15,-21,-25,15,-13,15,15,15,15,-12,15,-22,-23,15,15,-86,-24,]),'WHILE':([0,1,2,3,4,6,7,8,9,18,19,106,130,131,132,137,138,139,145,146,147,149,150,153,154,155,157,159,160,161,163,164,165,167,168,169,170,171,],[16,16,-2,-3,-4,-8,-9,-10,-11,-1,-5,16,16,16,16,16,16,-27,16,-20,-26,16,-21,-25,16,-13,16,16,16,16,-12,16,-22,-23,16,16,-86,-24,]),'ID':([0,1,2,3,4,6,7,8,9,12,18,19,21,22,23,24,25,26,27,37,38,40,44,56,63,73,74,75,76,77,78,84,85,86,87,88,89,96,100,101,106,122,130,131,132,137,138,139,145,146,147,149,150,153,154,155,157,158,159,160,161,163,164,165,167,168,169,170,171,],[13,13,-2,-3,-4,-8,-9,-10,-11,20,-1,-5,29,47,54,58,68,68,70,29,29,68,68,29,29,29,29,29,29,68,68,68,68,68,68,68,68,123,29,129,13,68,13,13,13,13,13,-27,13,-20,-26,13,-21,-25,13,-13,13,68,13,13,13,-12,13,-22,-23,13,13,-86,-24,]),'$end':([0,1,2,3,4,6,7,8,9,18,19,139,146,147,150,153,155,163,165,167,170,171,],[-86,0,-2,-3,-4,-8,-9,-10,-11,-1,-5,-27,-20,-26,-21,-25,-13,-12,-22,-23,-86,-24,]),'RBRACE':([2,3,4,6,7,8,9,18,19,106,130,131,132,137,138,139,145,146,147,149,150,153,154,155,157,159,160,161,163,164,165,167,168,169,170,171,],[-2,-3,-4,-8,-9,-10,-11,-1,-5,-86,-86,-86,139,146,147,-27,-86,-20,-26,155,-21,-25,-86,-13,-86,163,-86,165,-12,167,-22,-23,-86,170,-86,-24,]),'SEMI':([5,10,11,17,29,30,31,32,33,34,35,36,39,41,42,43,45,46,61,62,65,66,67,68,83,94,95,97,98,104,105,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,],[19,-6,-7,-68,-65,-28,-29,-30,-31,-32,-79,-80,-48,-83,-84,-85,-81,-82,-66,-67,-56,-57,-58,-65,-64,-55,-33,-70,-72,-69,-71,-60,-61,-62,-63,-46,-47,-59,-45,-49,-50,-51,-52,-53,-54,-73,]),'ASSIGN':([13,],[21,]),'LPAREN':([13,14,15,16,20,21,22,24,25,26,29,37,38,40,44,47,56,58,63,68,73,74,75,76,77,78,84,85,86,87,88,89,96,100,122,123,152,158,],[22,24,25,26,28,37,37,56,63,63,22,37,56,56,56,22,56,22,63,22,56,56,56,56,63,63,56,56,56,56,56,56,37,56,56,22,158,63,]),'LBRACKET':([13,17,21,29,47,58,68,97,98,104,105,123,],[23,27,40,23,23,23,23,-70,-72,-69,-71,23,]),'PLUS':([17,29,30,31,34,35,36,41,42,43,47,49,50,52,58,59,60,61,62,65,66,67,68,79,81,82,83,91,95,97,98,99,104,105,107,108,109,110,113,123,124,125,126,133,135,],[-68,-65,-67,73,-66,-79,-80,-83,-84,-85,-65,-66,-67,73,-65,-79,73,-66,-67,-66,-67,73,-65,73,-66,-67,73,-67,-33,-70,-72,73,-69,-71,73,73,73,73,-59,-65,-66,-67,73,-67,141,]),'MINUS':([17,21,22,24,25,26,29,30,31,34,35,36,37,38,40,41,42,43,44,47,49,50,52,56,58,59,60,61,62,63,65,66,67,68,73,74,75,76,77,78,79,81,82,83,84,85,86,87,88,89,91,95,96,97,98,99,100,104,105,107,108,109,110,113,122,123,124,125,126,133,135,158,],[-68,38,38,38,38,38,-65,-67,74,-66,-79,-80,38,38,38,-83,-84,-85,38,-65,-66,-67,74,38,-65,-79,74,-66,-67,38,-66,-67,74,-65,38,38,38,38,38,38,74,-66,-67,74,38,38,38,38,38,38,-67,-33,38,-70,-72,74,38,-69,-71,74,74,74,74,-59,38,-65,-66,-67,74,-67,143,38,]),'MULTIPLY':([17,29,30,31,34,35,36,41,42,43,47,49,50,52,58,59,60,61,62,65,66,67,68,79,81,82,83,91,95,97,98,99,104,105,107,108,109,110,113,123,124,125,126,133,],[-68,-65,-67,75,-66,-79,-80,-83,-84,-85,-65,-66,-67,75,-65,-79,75,-66,-67,-66,-67,75,-65,75,-66,-67,75,-67,-33,-70,-72,75,-69,-71,75,75,75,75,-59,-65,-66,-67,75,-67,]),'DIVIDE':([17,29,30,31,34,35,36,41,42,43,47,49,50,52,58,59,60,61,62,65,66,67,68,79,81,82,83,91,95,97,98,99,104,105,107,108,109,110,113,123,124,125,126,133,],[-68,-65,-67,76,-66,-79,-80,-83,-84,-85,-65,-66,-67,76,-65,-79,76,-66,-67,-66,-67,76,-65,76,-66,-67,76,-67,-33,-70,-72,76,-69,-71,76,76,76,76,-59,-65,-66,-67,76,-67,]),'EQ':([17,29,30,31,34,35,36,39,41,42,43,45,46,47,49,50,52,61,62,65,66,67,68,79,81,82,83,91,92,94,95,97,98,104,105,107,108,109,110,113,115,116,117,118,119,120,123,124,125,126,133,134,],[-68,-65,-57,-58,-56,-79,-80,84,-83,-84,-85,-81,-82,-65,-56,-57,-58,-66,-67,-56,-57,-58,-65,-58,-56,-57,-64,-57,84,84,-33,-70,-72,-69,-71,-60,-61,-62,-63,-59,84,84,84,84,84,84,-65,-56,-57,-58,-57,84,]),'LT':([17,29,30,31,34,35,36,39,41,42,43,45,46,47,49,50,52,61,62,65,66,67,68,79,81,82,83,91,92,94,95,97,98,104,105,107,108,109,110,113,115,116,117,118,119,120,123,124,125,126,133,134,],[-68,-65,-57,-58,-56,-79,-80,85,-83,-84,-85,-81,-82,-65,-56,-57,-58,-66,-67,-56,-57,-58,-65,-58,-56,-57,-64,-57,85,85,-33,-70,-72,-69,-71,-60,-61,-62,-63,-59,85,85,85,85,85,85,-65,-56,-57,-58,-57,85,]),'LET':([17,29,30,31,34,35,36,39,41,42,43,45,46,47,49,50,52,61,62,65,66,67,68,79,81,82,83,91,92,94,95,97,98,104,105,107,108,109,110,113,115,116,117,118,119,120,123,124,125,126,133,134,],[-68,-65,-57,-58,-56,-79,-80,86,-83,-84,-85,-81,-82,-65,-56,-57,-58,-66,-67,-56,-57,-58,-65,-58,-56,-57,-64,-57,86,86,-33,-70,-72,-69,-71,-60,-61,-62,-63,-59,86,86,86,86,86,86,-65,-56,-57,-58,-57,86,]),'GT':([17,29,30,31,34,35,36,39,41,42,43,45,46,47,49,50,52,61,62,65,66,67,68,79,81,82,83,91,92,94,95,97,98,104,105,107,108,109,110,113,115,116,117,118,119,120,123,124,125,126,133,134,],[-68,-65,-57,-58,-56,-79,-80,87,-83,-84,-85,-81,-82,-65,-56,-57,-58,-66,-67,-56,-57,-58,-65,-58,-56,-57,-64,-57,87,87,-33,-70,-72,-69,-71,-60,-61,-62,-63,-59,87,87,87,87,87,87,-65,-56,-57,-58,-57,87,]),'GET':([17,29,30,31,34,35,36,39,41,42,43,45,46,47,49,50,52,61,62,65,66,67,68,79,81,82,83,91,92,94,95,97,98,104,105,107,108,109,110,113,115,116,117,118,119,120,123,124,125,126,133,134,],[-68,-65,-57,-58,-56,-79,-80,88,-83,-84,-85,-81,-82,-65,-56,-57,-58,-66,-67,-56,-57,-58,-65,-58,-56,-57,-64,-57,88,88,-33,-70,-72,-69,-71,-60,-61,-62,-63,-59,88,88,88,88,88,88,-65,-56,-57,-58,-57,88,]),'DIFF':([17,29,30,31,34,35,36,39,41,42,43,45,46,47,49,50,52,61,62,65,66,67,68,79,81,82,83,91,92,94,95,97,98,104,105,107,108,109,110,113,115,116,117,118,119,120,123,124,125,126,133,134,],[-68,-65,-57,-58,-56,-79,-80,89,-83,-84,-85,-81,-82,-65,-56,-57,-58,-66,-67,-56,-57,-58,-65,-58,-56,-57,-64,-57,89,89,-33,-70,-72,-69,-71,-60,-61,-62,-63,-59,89,89,89,89,89,89,-65,-56,-57,-58,-57,89,]),'AND':([17,29,30,31,32,34,35,36,39,41,42,43,45,46,47,49,50,52,53,61,62,64,65,66,67,68,69,79,80,81,82,83,94,95,97,98,104,105,107,108,109,110,111,112,113,114,115,116,117,118,119,120,123,124,125,126,127,162,],[-68,-65,-57,-58,77,-56,-79,-80,-48,-83,-84,-85,-81,-82,-65,-56,-57,-58,77,-66,-67,77,-56,-57,-58,-65,77,-58,77,-56,-57,-64,-55,-33,-70,-72,-69,-71,-60,-61,-62,-63,77,77,-59,-45,-49,-50,-51,-52,-53,-54,-65,-56,-57,-58,77,77,]),'OR':([17,29,30,31,32,34,35,36,39,41,42,43,45,46,47,49,50,52,53,61,62,64,65,66,67,68,69,79,80,81,82,83,94,95,97,98,104,105,107,108,109,110,111,112,113,114,115,116,117,118,119,120,123,124,125,126,127,162,],[-68,-65,-57,-58,78,-56,-79,-80,-48,-83,-84,-85,-81,-82,-65,-56,-57,-58,78,-66,-67,78,-56,-57,-58,-65,78,-58,78,-56,-57,-64,-55,-33,-70,-72,-69,-71,-60,-61,-62,-63,78,78,-59,-45,-49,-50,-51,-52,-53,-54,-65,-56,-57,-58,78,78,]),'RPAREN':([17,22,28,29,35,36,39,41,42,43,45,46,47,48,49,50,51,52,53,61,62,64,65,66,67,68,69,79,80,81,82,83,94,95,97,98,99,104,105,107,108,109,110,111,112,113,114,115,116,117,118,119,120,123,124,125,126,127,129,140,141,142,143,144,162,],[-68,-86,72,-65,-79,-80,-48,-83,-84,-85,-81,-82,-37,95,-36,-39,-40,-43,-44,-66,-67,102,-56,-57,-58,-65,103,113,114,-56,-57,-64,-55,-33,-70,-72,113,-69,-71,-60,-61,-62,-63,-46,-47,-59,-45,-49,-50,-51,-52,-53,-54,-34,-35,-38,-41,-42,136,148,-16,-17,-18,-19,166,]),'COMMA':([17,22,29,35,36,39,40,41,42,43,45,46,47,48,49,50,51,52,53,57,58,59,60,61,62,65,66,67,68,83,90,91,92,93,94,95,97,98,104,105,107,108,109,110,111,112,113,114,115,116,117,118,119,120,123,124,125,126,127,128,133,134,],[-68,-86,-65,-79,-80,-48,-86,-83,-84,-85,-81,-82,-37,96,-36,-39,-40,-43,-44,100,-65,-14,-15,-66,-67,-56,-57,-58,-65,-64,122,-57,-77,-78,-55,-33,-70,-72,-69,-71,-60,-61,-62,-63,-46,-47,-59,-45,-49,-50,-51,-52,-53,-54,-34,-35,-38,-41,-42,135,-57,-75,]),'RBRACKET':([17,29,35,36,40,41,42,43,45,46,54,55,61,62,65,66,67,68,70,71,83,90,91,92,93,94,95,97,98,104,105,107,108,109,110,113,115,116,117,118,119,120,133,134,],[-68,-65,-79,-80,-86,-83,-84,-85,-81,-82,97,98,-66,-67,-56,-57,-58,-65,104,105,-64,121,-57,-77,-78,-55,-33,-70,-72,-69,-71,-60,-61,-62,-63,-59,-49,-50,-51,-52,-53,-54,-57,-75,]),'FLOAT':([21,22,24,25,26,37,38,40,44,56,63,73,74,75,76,77,78,84,85,86,87,88,89,96,100,122,158,],[41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,]),'INTEGER':([21,22,23,24,25,26,27,37,38,40,44,56,63,73,74,75,76,77,78,84,85,86,87,88,89,96,100,122,158,],[42,42,55,42,42,42,71,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,]),'STRING':([21,22,24,25,26,37,38,40,44,56,63,73,74,75,76,77,78,84,85,86,87,88,89,96,100,122,158,],[43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,]),'NOT':([21,22,25,26,37,40,44,63,77,78,84,85,86,87,88,89,96,122,158,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,]),'TRUE':([21,22,25,26,37,40,44,63,77,78,84,85,86,87,88,89,96,122,158,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,]),'FALSE':([21,22,25,26,37,40,44,63,77,78,84,85,86,87,88,89,96,122,158,],[46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,]),'IN':([58,],[101,]),'LBRACE':([72,102,103,136,148,151,156,166,],[106,130,131,145,154,157,160,168,]),'PLUSPLUS':([135,],[142,]),'MINUSMINUS':([135,],[144,]),'ELSE':([146,150,153,170,171,],[151,156,-25,-86,-24,]),'ELIF':([146,170,],[152,152,]),}
_lr_action = {}
for _k, _v in _lr_action_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_action: _lr_action[_x] = {}
_lr_action[_x][_k] = _y
del _lr_action_items
_lr_goto_items = {'code':([0,106,130,131,145,154,157,160,168,],[1,132,137,138,149,159,161,164,169,]),'sent':([0,1,106,130,131,132,137,138,145,149,154,157,159,160,161,164,168,169,],[2,18,2,2,2,18,18,18,2,18,2,2,18,2,18,18,2,18,]),'empty':([0,22,40,106,130,131,145,146,154,157,160,168,170,],[3,51,93,3,3,3,3,153,3,3,3,3,153,]),'statement':([0,1,106,130,131,132,137,138,145,149,154,157,159,160,161,164,168,169,],[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,]),'instruction':([0,1,106,130,131,132,137,138,145,149,154,157,159,160,161,164,168,169,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'function_definition':([0,1,106,130,131,132,137,138,145,149,154,157,159,160,161,164,168,169,],[6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,]),'for_statement':([0,1,106,130,131,132,137,138,145,149,154,157,159,160,161,164,168,169,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'if_statement':([0,1,106,130,131,132,137,138,145,149,154,157,159,160,161,164,168,169,],[8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,]),'while_statement':([0,1,106,130,131,132,137,138,145,149,154,157,159,160,161,164,168,169,],[9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,]),'assign':([0,1,106,130,131,132,137,138,145,149,154,157,159,160,161,164,168,169,],[10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,]),'function':([0,1,21,22,24,25,26,37,38,40,44,56,63,73,74,75,76,77,78,84,85,86,87,88,89,96,100,106,122,130,131,132,137,138,145,149,154,157,158,159,160,161,164,168,169,],[11,11,34,49,61,65,65,81,61,65,65,61,81,61,61,61,61,65,65,65,65,65,65,65,65,124,61,11,65,11,11,11,11,11,11,11,11,11,65,11,11,11,11,11,11,]),'sent_index_list':([0,1,21,22,24,25,26,37,38,40,44,56,63,73,74,75,76,77,78,84,85,86,87,88,89,96,100,106,122,130,131,132,137,138,145,149,154,157,158,159,160,161,164,168,169,],[17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,]),'expr_type':([21,22,24,25,26,37,38,40,44,56,63,73,74,75,76,77,78,84,85,86,87,88,89,96,100,122,158,],[30,50,62,66,66,82,62,91,66,62,82,62,62,62,62,66,66,66,66,66,66,66,66,125,62,133,66,]),'expr_arithm':([21,22,24,25,26,37,38,40,44,56,63,73,74,75,76,77,78,84,85,86,87,88,89,96,100,122,158,],[31,52,60,67,67,79,83,67,67,99,79,107,108,109,110,67,67,67,67,67,67,67,67,126,60,67,67,]),'logic_list':([21,22,25,26,37,63,77,78,96,158,],[32,53,64,69,80,80,111,112,127,162,]),'expr_list':([21,],[33,]),'expr_num':([21,22,24,25,26,37,38,40,44,56,63,73,74,75,76,77,78,84,85,86,87,88,89,96,100,122,158,],[35,35,59,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,59,35,35,]),'expr_string':([21,22,24,25,26,37,38,40,44,56,63,73,74,75,76,77,78,84,85,86,87,88,89,96,100,122,158,],[36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,]),'expr_bool':([21,22,25,26,37,40,44,63,77,78,84,85,86,87,88,89,96,122,158,],[39,39,39,39,39,92,94,39,39,39,115,116,117,118,119,120,39,134,39,]),'list':([22,],[48,]),'for_valid_expr':([24,100,],[57,128,]),'expr_inside_list':([40,],[90,]),'for_valid_iter':([135,],[140,]),'elif_sent':([146,170,],[150,171,]),}
_lr_goto = {}
for _k, _v in _lr_goto_items.items():
for _x, _y in zip(_v[0], _v[1]):
if not _x in _lr_goto: _lr_goto[_x] = {}
_lr_goto[_x][_k] = _y
del _lr_goto_items
_lr_productions = [
("S' -> code","S'",1,None,None,None),
('code -> code sent','code',2,'p_code','nbz_parser.py',41),
('code -> sent','code',1,'p_code','nbz_parser.py',42),
('code -> empty','code',1,'p_code','nbz_parser.py',43),
('sent -> statement','sent',1,'p_sent','nbz_parser.py',54),
('sent -> instruction SEMI','sent',2,'p_sent','nbz_parser.py',55),
('instruction -> assign','instruction',1,'p_instruction','nbz_parser.py',59),
('instruction -> function','instruction',1,'p_instruction','nbz_parser.py',60),
('statement -> function_definition','statement',1,'p_statement','nbz_parser.py',64),
('statement -> for_statement','statement',1,'p_statement','nbz_parser.py',65),
('statement -> if_statement','statement',1,'p_statement','nbz_parser.py',66),
('statement -> while_statement','statement',1,'p_statement','nbz_parser.py',67),
('for_statement -> FOR LPAREN for_valid_expr COMMA for_valid_expr COMMA for_valid_iter RPAREN LBRACE code RBRACE','for_statement',11,'p_sent_for_flow_int','nbz_parser.py',71),
('for_statement -> FOR LPAREN ID IN ID RPAREN LBRACE code RBRACE','for_statement',9,'p_sent_for_flow_int','nbz_parser.py',72),
('for_valid_expr -> expr_num','for_valid_expr',1,'p_for_valid_expressions_num','nbz_parser.py',85),
('for_valid_expr -> expr_arithm','for_valid_expr',1,'p_for_valid_expressions_num','nbz_parser.py',86),
('for_valid_iter -> PLUS','for_valid_iter',1,'p_for_valid_iterators','nbz_parser.py',90),
('for_valid_iter -> PLUSPLUS','for_valid_iter',1,'p_for_valid_iterators','nbz_parser.py',91),
('for_valid_iter -> MINUS','for_valid_iter',1,'p_for_valid_iterators','nbz_parser.py',92),
('for_valid_iter -> MINUSMINUS','for_valid_iter',1,'p_for_valid_iterators','nbz_parser.py',93),
('if_statement -> IF LPAREN logic_list RPAREN LBRACE code RBRACE','if_statement',7,'p_sent_if_flow','nbz_parser.py',97),
('if_statement -> IF LPAREN logic_list RPAREN LBRACE code RBRACE elif_sent','if_statement',8,'p_sent_if_flow','nbz_parser.py',98),
('if_statement -> IF LPAREN logic_list RPAREN LBRACE code RBRACE ELSE LBRACE code RBRACE','if_statement',11,'p_sent_if_flow','nbz_parser.py',99),
('if_statement -> IF LPAREN logic_list RPAREN LBRACE code RBRACE elif_sent ELSE LBRACE code RBRACE','if_statement',12,'p_sent_if_flow','nbz_parser.py',100),
('elif_sent -> ELIF LPAREN logic_list RPAREN LBRACE code RBRACE elif_sent','elif_sent',8,'p_sent_elif_flow','nbz_parser.py',130),
('elif_sent -> empty','elif_sent',1,'p_sent_elif_flow','nbz_parser.py',131),
('while_statement -> WHILE LPAREN logic_list RPAREN LBRACE code RBRACE','while_statement',7,'p_sent_while_flow','nbz_parser.py',141),
('function_definition -> DEF ID LPAREN RPAREN LBRACE code RBRACE','function_definition',7,'p_function_definition','nbz_parser.py',148),
('assign -> ID ASSIGN expr_type','assign',3,'p_assign_expr','nbz_parser.py',156),
('assign -> ID ASSIGN expr_arithm','assign',3,'p_assign_expr','nbz_parser.py',157),
('assign -> ID ASSIGN logic_list','assign',3,'p_assign_expr','nbz_parser.py',158),
('assign -> ID ASSIGN expr_list','assign',3,'p_assign_expr','nbz_parser.py',159),
('assign -> ID ASSIGN function','assign',3,'p_assign_func','nbz_parser.py',165),
('function -> ID LPAREN list RPAREN','function',4,'p_expr_funcs','nbz_parser.py',172),
('list -> list COMMA ID','list',3,'p_list_var','nbz_parser.py',182),
('list -> list COMMA function','list',3,'p_list_var','nbz_parser.py',183),
('list -> function','list',1,'p_list_var','nbz_parser.py',184),
('list -> ID','list',1,'p_list_var','nbz_parser.py',185),
('list -> list COMMA expr_type','list',3,'p_list_value','nbz_parser.py',224),
('list -> expr_type','list',1,'p_list_value','nbz_parser.py',225),
('list -> empty','list',1,'p_list_value','nbz_parser.py',226),
('list -> list COMMA expr_arithm','list',3,'p_list_expression','nbz_parser.py',237),
('list -> list COMMA logic_list','list',3,'p_list_expression','nbz_parser.py',238),
('list -> expr_arithm','list',1,'p_list_expression','nbz_parser.py',239),
('list -> logic_list','list',1,'p_list_expression','nbz_parser.py',240),
('logic_list -> LPAREN logic_list RPAREN','logic_list',3,'p_group_logic_list','nbz_parser.py',248),
('logic_list -> logic_list AND logic_list','logic_list',3,'p_logic_list','nbz_parser.py',252),
('logic_list -> logic_list OR logic_list','logic_list',3,'p_logic_list','nbz_parser.py',253),
('logic_list -> expr_bool','logic_list',1,'p_logic_list','nbz_parser.py',254),
('expr_bool -> expr_bool EQ expr_bool','expr_bool',3,'p_expr_logical','nbz_parser.py',264),
('expr_bool -> expr_bool LT expr_bool','expr_bool',3,'p_expr_logical','nbz_parser.py',265),
('expr_bool -> expr_bool LET expr_bool','expr_bool',3,'p_expr_logical','nbz_parser.py',266),
('expr_bool -> expr_bool GT expr_bool','expr_bool',3,'p_expr_logical','nbz_parser.py',267),
('expr_bool -> expr_bool GET expr_bool','expr_bool',3,'p_expr_logical','nbz_parser.py',268),
('expr_bool -> expr_bool DIFF expr_bool','expr_bool',3,'p_expr_logical','nbz_parser.py',269),
('expr_bool -> NOT expr_bool','expr_bool',2,'p_expr_logical','nbz_parser.py',270),
('expr_bool -> function','expr_bool',1,'p_logic_valid_var','nbz_parser.py',287),
('expr_bool -> expr_type','expr_bool',1,'p_logic_valid_type','nbz_parser.py',297),
('expr_bool -> expr_arithm','expr_bool',1,'p_logic_valid_type','nbz_parser.py',298),
('expr_arithm -> LPAREN expr_arithm RPAREN','expr_arithm',3,'p_group_expr_arithmethic','nbz_parser.py',302),
('expr_arithm -> expr_arithm PLUS expr_arithm','expr_arithm',3,'p_expr_aritmethic','nbz_parser.py',306),
('expr_arithm -> expr_arithm MINUS expr_arithm','expr_arithm',3,'p_expr_aritmethic','nbz_parser.py',307),
('expr_arithm -> expr_arithm MULTIPLY expr_arithm','expr_arithm',3,'p_expr_aritmethic','nbz_parser.py',308),
('expr_arithm -> expr_arithm DIVIDE expr_arithm','expr_arithm',3,'p_expr_aritmethic','nbz_parser.py',309),
('expr_arithm -> MINUS expr_arithm','expr_arithm',2,'p_expr_aritmethic','nbz_parser.py',310),
('expr_arithm -> ID','expr_arithm',1,'p_arithm_valid_var','nbz_parser.py',323),
('expr_arithm -> function','expr_arithm',1,'p_arithm_valid_var','nbz_parser.py',324),
('expr_arithm -> expr_type','expr_arithm',1,'p_arithm_valid_num','nbz_parser.py',343),
('function -> sent_index_list','function',1,'p_sent_index_list','nbz_parser.py',347),
('sent_index_list -> sent_index_list LBRACKET ID RBRACKET','sent_index_list',4,'p_index_list_var','nbz_parser.py',351),
('sent_index_list -> ID LBRACKET ID RBRACKET','sent_index_list',4,'p_index_list_var','nbz_parser.py',352),
('sent_index_list -> sent_index_list LBRACKET INTEGER RBRACKET','sent_index_list',4,'p_index_list_value','nbz_parser.py',378),
('sent_index_list -> ID LBRACKET INTEGER RBRACKET','sent_index_list',4,'p_index_list_value','nbz_parser.py',379),
('expr_list -> LBRACKET expr_inside_list RBRACKET','expr_list',3,'p_expr_list','nbz_parser.py',393),
('expr_inside_list -> expr_inside_list COMMA expr_type','expr_inside_list',3,'p_list_expr_inside_list','nbz_parser.py',397),
('expr_inside_list -> expr_inside_list COMMA expr_bool','expr_inside_list',3,'p_list_expr_inside_list','nbz_parser.py',398),
('expr_inside_list -> expr_type','expr_inside_list',1,'p_list_expr_inside_list','nbz_parser.py',399),
('expr_inside_list -> expr_bool','expr_inside_list',1,'p_list_expr_inside_list','nbz_parser.py',400),
('expr_inside_list -> empty','expr_inside_list',1,'p_list_expr_inside_list','nbz_parser.py',401),
('expr_type -> expr_num','expr_type',1,'p_expr_type','nbz_parser.py',412),
('expr_type -> expr_string','expr_type',1,'p_expr_type','nbz_parser.py',413),
('expr_bool -> TRUE','expr_bool',1,'p_expr_bool_true','nbz_parser.py',417),
('expr_bool -> FALSE','expr_bool',1,'p_expr_bool_false','nbz_parser.py',421),
('expr_num -> FLOAT','expr_num',1,'p_expr_number','nbz_parser.py',425),
('expr_num -> INTEGER','expr_num',1,'p_expr_number','nbz_parser.py',426),
('expr_string -> STRING','expr_string',1,'p_expr_string','nbz_parser.py',430),
('empty -> <empty>','empty',0,'p_empty','nbz_parser.py',435),
]
|
# To create a variable
character_name = "Jin"
character_age = "99"
print(character_name + " is " + character_age + " years old.")
# reassigning the variable
character_name = "mochi"
print(character_name + " is " + character_age + " years old.")
print("jin\nacademy")
print(len(character_name))
# to create a new line \n, to escape \
# to create a upper case
# string.upper()
# to create a lower case
# string.lower()
# to check if its upper case
# string.isupper()
# len is a length of the string
# chaining works for python
# to get a specific character
# index starts from 0
my_character = "mochi"
print(my_character[3])
# to check what position the character is in
print(my_character.index("h"))
# to change the character
my_phrase = "animal kingdom"
print(my_phrase.replace("animal", "vegetable"))
|
'''Crie um programa que crie uma matriz de dimensão 3x3 e a preencha com um valores lidos pelo
teclado:
#visualizar o exemplo no video
No final, mostre a matriz na tela, com a formatação correta.'''
'''lista = [[],[],[]]
for c in range (0,3):
for v in range (0,3):
lista[c].append(int(input(f'Digite um valor para posição [{c}, {v}]: ')))
for c in range(0,3):
for v in range(0,3):
print(f'[{lista[c][v]:^5}]', end='')
print()'''
#guanabar method
matriz = [[0,0,0], [0,0,0], [0,0,0]]
for l in range(0,3):#for para linha
for c in range (0,3): #for para coluna
matriz[l][c] = int(input(f'Digite um valor para a posição [{l}, {c}]: '))
print('-.'*30)
for l in range(0,3):
for c in range (0,3):
print(f'[{matriz[l][c]:^5}]', end='')
print()
|
def gimme5():
return 5
def gimme3():
return 3
|
class Solution:
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
p1 = 0
p2 = len(height) - 1
ret = 0
while p1 < p2:
ret = max(min(height[p1], height[p2]) * (p2 - p1), ret)
if height[p2] > height[p1]:
p1 += 1
else:
p2 -= 1
return ret
|
# -*- coding:utf8 -*-
# Power by zuosc 2016-09-27
# 递归函数
def fact(n):
if n == 1:
return 1
return n * fact(n - 1)
fact(7) |
def sqrt_approx(num):
i = 0
minsq = 0
maxsq = 0
while i <= num:
if i * i <= num:
minsq = i
if i * i >= num:
maxsq = i
break
i = i + 1
return minsq, maxsq
for i in range(0, 26):
print(i, sqrt_approx(i))
|
#
# PySNMP MIB module Wellfleet-IPEX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-IPEX-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:40:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ConstraintsUnion")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
Unsigned32, NotificationType, ObjectIdentity, IpAddress, Counter64, Gauge32, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, TimeTicks, Bits, Integer32, ModuleIdentity, iso, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "NotificationType", "ObjectIdentity", "IpAddress", "Counter64", "Gauge32", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "TimeTicks", "Bits", "Integer32", "ModuleIdentity", "iso", "MibIdentifier")
DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention")
wfIpexGroup, = mibBuilder.importSymbols("Wellfleet-COMMON-MIB", "wfIpexGroup")
wfIpex = MibIdentifier((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1))
wfIpexDelete = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexDelete.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexDelete.setDescription('Create/Delete parameter. Default is created. Users perform an SNMP SET operation on this object in order to create/delete IPEX.')
wfIpexDisable = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexDisable.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexDisable.setDescription('Enable/Disable parameter. Default is enabled. Users perform an SNMP SET operation on this object in order to enable/disable IPEX.')
wfIpexState = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("init", 3), ("notpresent", 4))).clone('down')).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexState.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexState.setDescription('The current state of IPEX.')
wfIpexMaxMessageSize = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(16, 4096)).clone(1600)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMaxMessageSize.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMaxMessageSize.setDescription('The maximum client message size that IPEX accepts. The size is in bytes.')
wfIpexInsCalledDte = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexInsCalledDte.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexInsCalledDte.setDescription('Enable/Disable parameter. Default is disabled. Users perform an SNMP SET operation on this object in order to enable/disable the support for inserting Called DTE address.')
wfIpexInsCallingDte = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexInsCallingDte.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexInsCallingDte.setDescription('Enable/disable the support for transmitting the calling DTE address over TCP tunnel. This changes the IPEX control message header format and hence this attribute should be enabled (only for 11.02 or up) on both ends (local & remote routers) for proper operation. This attribute applies only to End_to_End mode.')
wfIpexTcpRequestLimit = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1000)).clone(25)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexTcpRequestLimit.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexTcpRequestLimit.setDescription('The maximum number of TCP requests IPEX can have pending with TCP. Any addition requests will be queued until the number of pending requests fall below the limit.')
wfIpexTcpRequestCheck = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 30000)).clone(1000)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexTcpRequestCheck.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexTcpRequestCheck.setDescription('When IPEX has queued TCP requests, the time period (in milliseconds) between checking if the number of pending TCP requests have fallen below wfIpexTcpRequestLimit.')
wfIpexSendResetRequestOnTCPUp = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 9), Integer32().clone(9)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexSendResetRequestOnTCPUp.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSendResetRequestOnTCPUp.setDescription('Default(cause code) is 0x09 and PVC_TCP sends out the Reset Request with the cause code = 0x09 and TCP_PVC Router does not send the Reset Request when TCP is up. If the value is changed from the default cause code(0x09) then IPEX Gateway will send out the Reset Request with this value when network is operational. TCP_PVC will also send the Reset Request with this cause code when TCP connection is up.')
wfIpexTranslateNetworkOutOfOrder = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 10), Integer32().clone(29)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexTranslateNetworkOutOfOrder.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexTranslateNetworkOutOfOrder.setDescription('Default is 0x1d(29): Network out of order. If the value is changed from the default cause code = 0x1d then the IPEX Gateway will send the Reset Request with cause code specified when the network is out of order.')
wfIpexTcpUseIpAddress = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexTcpUseIpAddress.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexTcpUseIpAddress.setDescription('Enable/Disable parameter. Default is disabled. If set to Enabled, the IP address used for a TCP connection will be the coresponding address for the circuit.')
wfIpexBobEnabled = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2))).clone('disabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexBobEnabled.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexBobEnabled.setDescription('This attribute will indicate whether IPEX supports Bank Of Bahrain enhancement. If it is enabled, only calling DTE will be send in ASCII format in user defined area of message header, if header type is full.')
wfIpexBobTimeout = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 30000)).clone(15000)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexBobTimeout.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexBobTimeout.setDescription('This attribute will indicate the timeout in milliseconds, after which DEVICE UP message is to be send to BOB mainserver from router, as long as this service supports BOB functionality.')
wfIpexMaxAuditIp = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 14), Integer32().clone(25)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMaxAuditIp.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMaxAuditIp.setDescription("Default is 25. Specify the maximum of IP address and TCP port pairs that IPEX Audit gate can hold in its internal table when IPEX PVC-TCP Gateway is in TCP Retry Mode. Audit gate puts new ip address and TCP port pair to the internal table when it tries TCP connection. IPEX Audit gate will be re-trying TCP connections until the table is filled up. Once it is full then it won't re-try new TCP connections. Setting zero causes IPEX audit gate to try TCP connections without examining the IP address and TCP port pairs had already tried out or not.")
wfIpexSessionInstanceIdOffsetForSvc = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 1, 15), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexSessionInstanceIdOffsetForSvc.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionInstanceIdOffsetForSvc.setDescription('Default is 0. Specify the offset value for wfIpexSessionEntry when instances for SVC are created. For example, when it is set to 1023, instance ID for wfIpexSessionEntry for SVC connections will be wfIpexSessionEntry.*.3.1024 and the next one will be wfIpexSessionEntry.*.3.1025 and so on. This MIB object is introduced not to assign same instance ID to PVC and SVC when SVCs and PVCs are configured with single circuit. Because wfIpexSessionEntry for PVCs are based on the LCNs and the ones for SVCs are based on the order of each SVC being created, there would be the cases that same instance IDs are assigned to both SVC and PVC and it will cause the router to fault. It needs to be set to the value which is greater than the maximum LCN of the PVC connections when PVCs and SVCs co-exist on a single circuit.')
wfIpexMappingTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2), )
if mibBuilder.loadTexts: wfIpexMappingTable.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingTable.setDescription('A table which contains the list of mappings between TCP connections and X.25 connections. This is the configuration table in which each entry sets up the association between a TCP port number and a X.25 DTE address or connection. inst_id[] = wfIpexMappingSrcConnCct wfIpexMappingSrcConnType wfIpexMappingID')
wfIpexMappingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1), ).setIndexNames((0, "Wellfleet-IPEX-MIB", "wfIpexMappingSrcConnCct"), (0, "Wellfleet-IPEX-MIB", "wfIpexMappingSrcConnType"), (0, "Wellfleet-IPEX-MIB", "wfIpexMappingID1"), (0, "Wellfleet-IPEX-MIB", "wfIpexMappingID2"))
if mibBuilder.loadTexts: wfIpexMappingEntry.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingEntry.setDescription('An entry in wfIpexMappingTable.')
wfIpexMappingDelete = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingDelete.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingDelete.setDescription('Create/Delete attribute. Default is created. Users perform an SNMP SET operation on this object in order to create/delete a translation mapping record.')
wfIpexMappingDisable = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingDisable.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingDisable.setDescription('Enables or Disables this Mapping entry. Setting this attribute to DISABLED will disconnect all active Sessions pertaining to this Mapping entry')
wfIpexMappingSrcConnCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexMappingSrcConnCct.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingSrcConnCct.setDescription('The circuit from which the connection attempt is received that initiates a translation session.')
wfIpexMappingSrcConnType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8, 16))).clone(namedValues=NamedValues(("pvc", 1), ("svc", 2), ("dcesvc", 4), ("lapb", 8), ("tcp", 16)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexMappingSrcConnType.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingSrcConnType.setDescription('Defines the type of original connection attempt. Whether it is a PVC, SVC, DCE_SVC, LAPB or TCP')
wfIpexMappingID1 = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexMappingID1.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingID1.setDescription('The translation mapping identifier which identifies the remote connection of the translation session. This is an identifier that is available from the incoming connection attempt. The meaning of this object (wfIpexMappingID1) and the next object (wfIpexMappingID2) is dependent on the value of wfIpexMappingSrcConnType. SrcConnType ID1 ID2 --------------------------------------------------- pvc(1) LCN value 0 (Null) svc(2) 0 Called X.121 Address dcesvc(4) 0 0 (Null) lapb(8) 0 0 (Null) tcp(16) Port Number 0 (Null) ')
wfIpexMappingID2 = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 6), OctetString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexMappingID2.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingID2.setDescription('(See description for wfIpexMappingID1 above)')
wfIpexMappingDstConnCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 7), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingDstConnCct.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingDstConnCct.setDescription('The circuit from which the connection to the destination is to be established to set up a translation session.')
wfIpexMappingDstConnType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8, 16))).clone(namedValues=NamedValues(("pvc", 1), ("svc", 2), ("dcesvc", 4), ("lapb", 8), ("tcp", 16))).clone('pvc')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingDstConnType.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingDstConnType.setDescription('Defines type of connection at the destination end. Whether it is a PVC, SVC, DCE_SVC, LAPB or TCP')
wfIpexMappingLocalDTEAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 9), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingLocalDTEAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingLocalDTEAddr.setDescription('The Local DTE address (identifies the X.121 address of the X.25 interface on the IPEX). This attribute is only used in the case of a SVC connection initiated from the IPEX to the terminal')
wfIpexMappingRemoteDTEAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 10), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingRemoteDTEAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingRemoteDTEAddr.setDescription('The Remote DTE address (identifies the X.121 address of the X.25 interface on the terminal). This attribute is only used in the case of a SVC connection initiated from the IPEX to the terminal')
wfIpexMappingPvcLcn = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 4095)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingPvcLcn.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingPvcLcn.setDescription('The LCN of the PVC connection from the IPEX to the terminal (identifies the channel to be used to reset the PVC connection. This attribute * is only used in the case of a PVC connection initiated from the IPEX to the terminal')
wfIpexMappingRemoteIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 12), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingRemoteIpAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingRemoteIpAddr.setDescription('The IP address of the remote host with which this translation session is established. This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexMappingRemoteTcpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 13), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingRemoteTcpPort.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingRemoteTcpPort.setDescription('The remote TCP port number in the host to be used to establish a TCP connection from the IPEX to the host server. This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexMappingQueueSize = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(16, 8192)).clone(8192)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingQueueSize.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingQueueSize.setDescription('The size of the IPEX queues used for transfering data between TCP and X.25. The size is in bytes.')
wfIpexMappingSlotNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 13))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingSlotNumber.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingSlotNumber.setDescription('The slot of the access (X.25 or LAPB) circuit on which the X.25 or LAPB connections will be established.')
wfIpexMappingCtrlMode = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("local", 1), ("end2end", 2), ("gateway", 3))).clone('end2end')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingCtrlMode.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingCtrlMode.setDescription('Local mode configuration terminates X.25 at the router interface. The end2end mode configuration allows X.25 signalling and data to operate between two remote X.25 networks, using the router to translate both call control and data over a TCP/IP network. The gateway mode terminates X.25 at the router interface, but allows the user to configure 3 message header types at the TCP application layer. These header values are described in wfIpexMappingMsgHdrType.')
wfIpexMappingX25CUDF = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 17), OctetString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingX25CUDF.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingX25CUDF.setDescription('The X.25 Call User Data field (CUDF) in a X.25 Call Request packet header. This attribute is only used in the case of a SVC connection initiated from the IPEX to the terminal. It is used as the network layer protocol identifier of the X.25 connection.')
wfIpexMappingIdleTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 86400)).clone(120)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingIdleTimer.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingIdleTimer.setDescription('Idle session timeout period, in seconds. If an established TCP connection remains inactive for this interval, KEEPALIVE messages will be sent to the peer (if the Keepalive Timer is non-zero). Setting the Idle Timer to zero disables the keepalive feature.')
wfIpexMappingKeepaliveTimer = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 600)).clone(3)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingKeepaliveTimer.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingKeepaliveTimer.setDescription('KEEPALIVE retransmit timeout period, in seconds. This is the interval at which unacknowledged KEEPALIVE messages will be retransmitted. If the Idle Timer is set to zero, this timer ignored. If the Idle Timer is non-zero and this timer IS zero, no KEEPALIVEs are sent and the session is terminated upon expiration of the Idle Timer.')
wfIpexMappingKeepaliveRetries = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 20), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 99)).clone(5)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingKeepaliveRetries.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingKeepaliveRetries.setDescription('Number of unacknowledged KEEPALIVE messages retransmitted before the TCP session is terminated. If this count is set to zero, only one KEEPALIVE message will be sent.')
wfIpexMappingTrace = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 21), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingTrace.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingTrace.setDescription('This object is a bitmask, setting the low order bit enables tracing of IPEX internal events. Setting other individual bit postions disable logging of internal IPEX events. Values may be added together to disable multiple message groups. Hex Dec Value Value Message/Event --------------------------------------------------------- 0x0001 1 Enable IPEX tracing. 0x0002 2 Data packets from IPEX to X.25. 0x0004 4 Data packets from X.25 to IPEX. 0x0008 8 Window updates from X.25. 0x0010 16 Data from TCP to IPEX. 0x0020 32 Window updates from TCP. 0x0040 64 Window requests from TCP.')
wfIpexMappingMsgHdrType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("short", 2), ("long", 3), ("full", 4))).clone('full')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingMsgHdrType.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingMsgHdrType.setDescription('This attribute enables the Message Boundary Protocol. When enabled, this bit is used to mark the boundary of TCP application data that is consistent with Gateway Operation. The first three message header types are used only with wfIpexMappingCtlMode in gateway mode. The default value is used with wfIpexMappingCtlMode in the local or end2end mode of operation. NONE = Msg Boundary Protocol is off, no msg header. SHORT = Msg header condtains a 2-Byte length field. LONG = Msg header contains a 1-Byte type, 1-Byte version, and a 2-Byte length fields. FULL = Msg Header contains a 2-Byte length1 field, 1-Byte Version field, 1-Byte Type field and, a 1-Byte length2 field')
wfIpexMappingRemoteBackupIp = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 23), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingRemoteBackupIp.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingRemoteBackupIp.setDescription('The IP address of the remote host with which this translation session is established. This attribute is only used in the case of a TCP connection with the primary remote IP address (wfIpexMappingRemoteIpAddr) failed.')
wfIpexMappingXlateCallingX121 = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 24), DisplayString()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingXlateCallingX121.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingXlateCallingX121.setDescription('If this attribute is configured then insert this X.121 addr as the calling addr in the Call request pkt.')
wfIpexMappingTcpMaxRetry = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 16384))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingTcpMaxRetry.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingTcpMaxRetry.setDescription('The maximum number of attempts that PVC-TCP will make to re-establish the connection to the remote peer. The TCP Retry takes place every 15 seconds hence default setting will perform the TCP Retry forever.')
wfIpexMappingCfgLocalIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 26), IpAddress()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingCfgLocalIpAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingCfgLocalIpAddr.setDescription('The IP address on the router to use as the source of the TCP session. This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexMappingRemoteBackupTcpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 2, 1, 27), Integer32()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wfIpexMappingRemoteBackupTcpPort.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexMappingRemoteBackupTcpPort.setDescription('The TCP port of the remote host with which this translation session is established. This attribute is only used in the case of a TCP connection with the primary remote IP address (wfIpexMappingRemoteIpAddr) failed.')
wfIpexSessionTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3), )
if mibBuilder.loadTexts: wfIpexSessionTable.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionTable.setDescription('A table that contains the information about the current active IPEX translation sessions. The status and statistics information related to each translation session is provided here. inst_id[] = wfIpexSessionIndex')
wfIpexSessionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1), ).setIndexNames((0, "Wellfleet-IPEX-MIB", "wfIpexSessionSrcConnCct"), (0, "Wellfleet-IPEX-MIB", "wfIpexSessionIndex"))
if mibBuilder.loadTexts: wfIpexSessionEntry.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionEntry.setDescription('An entry in wfIpexSession.')
wfIpexSessionState = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("x25up", 1), ("tcpup", 2), ("ccestab", 3), ("notconn", 4), ("lapbup", 5))).clone('notconn')).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionState.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionState.setDescription('The IPEX state of this translation session. These are the steady states of the IPEX state machine. Transition states are not reflected.')
wfIpexSessionSrcConnCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 2), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionSrcConnCct.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionSrcConnCct.setDescription('The circuit from which the original connection attempt is received that initiated a translation session.')
wfIpexSessionIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 3), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionIndex.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionIndex.setDescription('The index of this translation session')
wfIpexSessionSrcConnType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8, 16))).clone(namedValues=NamedValues(("pvc", 1), ("svc", 2), ("dcesvc", 4), ("lapb", 8), ("tcp", 16)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionSrcConnType.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionSrcConnType.setDescription('Defines type of original connection attempt. Whether it is a PVC, SVC, DCE_SVC, LAPB or TCP')
wfIpexSessionDstConnCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 5), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionDstConnCct.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionDstConnCct.setDescription('The circuit from which the connection at the destination to be established to set up a translation session.')
wfIpexSessionDstConnType = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 4, 8, 16))).clone(namedValues=NamedValues(("pvc", 1), ("svc", 2), ("dcesvc", 4), ("lapb", 8), ("tcp", 16))).clone('pvc')).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionDstConnType.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionDstConnType.setDescription('Defines type of connection at the destination end. Whether it is a PVC, SVC, DCE_SVC, LAPB or TCP')
wfIpexSessionLocalDTEAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 7), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionLocalDTEAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionLocalDTEAddr.setDescription('The Local DTE address (identifies the X.121 address of the X.25 interface on the IPEX). This attribute is only used in the case of a SVC connection initiated from the IPEX to the terminal')
wfIpexSessionRemoteDTEAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 8), DisplayString()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionRemoteDTEAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionRemoteDTEAddr.setDescription('The Remote DTE address (identifies the X.121 address of the X.25 interface on the terminal). This attribute is only used in the case of a SVC connection initiated from the IPEX to the terminal')
wfIpexSessionLCN = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255)).clone(1)).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionLCN.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionLCN.setDescription('The LCN of the PVC (identifies the channel to be used to establish a PVC connection from the IPEX to the terminal')
wfIpexSessionLocalIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 10), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionLocalIpAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionLocalIpAddr.setDescription('The IP address of an interface on the IPEX to be used to establish a TCP connection with the host server. This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexSessionLocalTcpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 11), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionLocalTcpPort.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionLocalTcpPort.setDescription('The local TCP port number in the IPEX to be used to establish a TCP connection to the host server This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexSessionRemoteIpAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 12), IpAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionRemoteIpAddr.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionRemoteIpAddr.setDescription('The IP address of the remote host with which this translation session is established. This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexSessionRemoteTcpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 13), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionRemoteTcpPort.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionRemoteTcpPort.setDescription('The remote TCP port number in the host to be used to establish a TCP connection from the IPEX to the host server. This attribute is only used in the case of a TCP connection initiated from the IPEX to a host')
wfIpexSessionQueueSize = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 15, 3, 1, 14), Integer32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wfIpexSessionQueueSize.setStatus('mandatory')
if mibBuilder.loadTexts: wfIpexSessionQueueSize.setDescription('The size of the IPEX queues used for transfering data between IPEX and TCP. The size is in bytes.')
mibBuilder.exportSymbols("Wellfleet-IPEX-MIB", wfIpexSessionInstanceIdOffsetForSvc=wfIpexSessionInstanceIdOffsetForSvc, wfIpexMappingLocalDTEAddr=wfIpexMappingLocalDTEAddr, wfIpexSessionEntry=wfIpexSessionEntry, wfIpexMappingXlateCallingX121=wfIpexMappingXlateCallingX121, wfIpexMappingDisable=wfIpexMappingDisable, wfIpexMappingQueueSize=wfIpexMappingQueueSize, wfIpexMappingMsgHdrType=wfIpexMappingMsgHdrType, wfIpexMappingDstConnCct=wfIpexMappingDstConnCct, wfIpexSessionRemoteTcpPort=wfIpexSessionRemoteTcpPort, wfIpexBobEnabled=wfIpexBobEnabled, wfIpexDelete=wfIpexDelete, wfIpexMappingCfgLocalIpAddr=wfIpexMappingCfgLocalIpAddr, wfIpexMappingX25CUDF=wfIpexMappingX25CUDF, wfIpexSessionState=wfIpexSessionState, wfIpexTcpUseIpAddress=wfIpexTcpUseIpAddress, wfIpexMappingID2=wfIpexMappingID2, wfIpexMappingID1=wfIpexMappingID1, wfIpexSessionSrcConnCct=wfIpexSessionSrcConnCct, wfIpexMappingSlotNumber=wfIpexMappingSlotNumber, wfIpexDisable=wfIpexDisable, wfIpexSessionDstConnCct=wfIpexSessionDstConnCct, wfIpexInsCalledDte=wfIpexInsCalledDte, wfIpexMappingRemoteBackupIp=wfIpexMappingRemoteBackupIp, wfIpexMappingKeepaliveTimer=wfIpexMappingKeepaliveTimer, wfIpexMaxAuditIp=wfIpexMaxAuditIp, wfIpexMappingTable=wfIpexMappingTable, wfIpexSessionSrcConnType=wfIpexSessionSrcConnType, wfIpexMappingKeepaliveRetries=wfIpexMappingKeepaliveRetries, wfIpexSessionTable=wfIpexSessionTable, wfIpexSessionLocalIpAddr=wfIpexSessionLocalIpAddr, wfIpexMappingDstConnType=wfIpexMappingDstConnType, wfIpexMappingTcpMaxRetry=wfIpexMappingTcpMaxRetry, wfIpexInsCallingDte=wfIpexInsCallingDte, wfIpexSendResetRequestOnTCPUp=wfIpexSendResetRequestOnTCPUp, wfIpexSessionDstConnType=wfIpexSessionDstConnType, wfIpexMappingRemoteBackupTcpPort=wfIpexMappingRemoteBackupTcpPort, wfIpexTcpRequestCheck=wfIpexTcpRequestCheck, wfIpexState=wfIpexState, wfIpex=wfIpex, wfIpexMappingSrcConnType=wfIpexMappingSrcConnType, wfIpexMappingIdleTimer=wfIpexMappingIdleTimer, wfIpexSessionIndex=wfIpexSessionIndex, wfIpexSessionLocalDTEAddr=wfIpexSessionLocalDTEAddr, wfIpexSessionRemoteIpAddr=wfIpexSessionRemoteIpAddr, wfIpexTcpRequestLimit=wfIpexTcpRequestLimit, wfIpexMappingRemoteIpAddr=wfIpexMappingRemoteIpAddr, wfIpexSessionLocalTcpPort=wfIpexSessionLocalTcpPort, wfIpexMappingCtrlMode=wfIpexMappingCtrlMode, wfIpexMappingRemoteTcpPort=wfIpexMappingRemoteTcpPort, wfIpexSessionQueueSize=wfIpexSessionQueueSize, wfIpexMappingSrcConnCct=wfIpexMappingSrcConnCct, wfIpexTranslateNetworkOutOfOrder=wfIpexTranslateNetworkOutOfOrder, wfIpexMappingRemoteDTEAddr=wfIpexMappingRemoteDTEAddr, wfIpexMappingTrace=wfIpexMappingTrace, wfIpexSessionRemoteDTEAddr=wfIpexSessionRemoteDTEAddr, wfIpexMappingEntry=wfIpexMappingEntry, wfIpexMappingPvcLcn=wfIpexMappingPvcLcn, wfIpexBobTimeout=wfIpexBobTimeout, wfIpexSessionLCN=wfIpexSessionLCN, wfIpexMaxMessageSize=wfIpexMaxMessageSize, wfIpexMappingDelete=wfIpexMappingDelete)
|
## lists7.py
def main():
pals = ['Bob','Rob','Fred','Amy','Sarah']
pals2 = pals ## both variables refer to SAME LIST
pals.remove('Fred')
print(pals2) ### crude
pals3 = []
for p in pals:
pals3.append(p)
print(pals3) ### crude dump
del pals[0] ### deletes Bob
print(pals)
main()
|
"""
1. The oscillations start getting larger and larger which could in the end become uncontrollable
2. Looking at the shape of the spiral
""" |
"""
Definition of ParentTreeNode:
class ParentTreeNode:
def __init__(self, val):
self.val = val
self.parent, self.left, self.right = None, None, None
"""
class Solution:
"""
@param: root: The root of the tree
@param: A: node in the tree
@param: B: node in the tree
@return: The lowest common ancestor of A and B
sa = {4}
b = {7, 4}
"""
def lowestCommonAncestorII(self, root, A, B):
# write your code here
if not root or root == A or root == B:
return root
sa = set()
sa.add(A)
while A:
sa.add(A.parent)
A = A.parent
while B:
if B in sa:
return B
B = B.parent
def lowestCommonAncestorII_height(self, root, A, B):
# write your code here
ha = self.height(A)
hb = self.height(B)
while ha > hb:
A = A.parent
ha -= 1
while hb > ha:
B = B.parent
hb -= 1
while A != B:
A = A.parent
B = B.parent
return A
def height(self, node):
h = 0
while node:
h += 1
node = node.parent
return h
|
# Copyright 2021 John Millikin and the rust-fuse contributors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
_CHECKSUMS = {
"v5.2.0/pc-bios/edk2-x86_64-code.fd.bz2": "8d9af6d88f51cfb6732a2542fefa50e7d5adb81aa12d0b79342e1bc905a368f1",
}
_BUILD = """
filegroup(
name = "qemu",
srcs = glob(
["**/*"],
exclude = ["BUILD.bazel", "WORKSPACE"],
),
visibility = ["//visibility:public"],
)
"""
def _qemu_repository(ctx):
ctx.file("WORKSPACE", "workspace(name = {})\n".format(repr(ctx.name)))
ctx.file("BUILD.bazel", _BUILD)
edk2_filename = "v{}/pc-bios/edk2-x86_64-code.fd.bz2".format(ctx.attr.version)
ctx.download(
url = ["https://github.com/qemu/qemu/raw/" + edk2_filename],
output = "pc-bios/edk2-x86_64-code.fd.bz2",
sha256 = _CHECKSUMS[edk2_filename],
)
ctx.execute(["bzip2", "-d", "pc-bios/edk2-x86_64-code.fd.bz2"])
qemu_repository = repository_rule(
implementation = _qemu_repository,
attrs = {
"version": attr.string(
mandatory = True,
values = [
"5.2.0",
],
),
}
)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.