content stringlengths 7 1.05M |
|---|
transactions_count = int(input('Enter number of transactions: '))
total = 0
while True:
if transactions_count <= 0:
break
transactions_cash = float(input('Enter transactions amount: '))
if transactions_cash >= 1:
total += transactions_cash
transactions_count -= 1
continue
print('Invalid operation!')
break
print(f'Total: {total:.2f}') |
class dotRebarSplice_t(object):
# no doc
BarPositions=None
Clearance=None
LapLength=None
ModelObject=None
Offset=None
Reinforcement1=None
Reinforcement2=None
Type=None
|
# coding: utf-8
MAX_INT = 2147483647
MIN_INT = -2147483648
class Solution(object):
def myAtoi(self, input_string):
"""
:type input_string: str
:rtype: int
"""
number = 0
sign = 1
i = 0
length = len(input_string)
while i < length and input_string[i].isspace():
i += 1
if i < length and input_string[i] in ('-', '+'):
sign = -1 if input_string[i] == '-' else 1
i += 1
while i < length and input_string[i].isdigit():
number = number * 10 + ord(input_string[i]) - ord('0')
if sign * number > MAX_INT:
return MAX_INT
if sign * number < MIN_INT:
return MIN_INT
i += 1
return sign * number
if __name__ == '__main__':
assert Solution().myAtoi('') == 0
assert Solution().myAtoi(' ') == 0
assert Solution().myAtoi(' asdfas ') == 0
assert Solution().myAtoi(' asdfas12341') == 0
assert Solution().myAtoi(' asdfas+12341') == 0
assert Solution().myAtoi(' +asdfas+12341') == 0
assert Solution().myAtoi(' -asdfas+12341') == 0
assert Solution().myAtoi('0') == 0
assert Solution().myAtoi('0number') == 0
assert Solution().myAtoi('+0number') == 0
assert Solution().myAtoi('1234') == 1234
assert Solution().myAtoi('+1234') == 1234
assert Solution().myAtoi('-1234asdf') == -1234
assert Solution().myAtoi('123412341234123413241234') == MAX_INT
assert Solution().myAtoi('-123412341234123413241234asdfasfasdfsa') == MIN_INT
|
class Word:
"""
This class represents word as an object and has
feature extraction method that is used to build matrix for each word
based on most informative features by language experts
"""
def __init__(self, word):
self.word = word
@staticmethod
def extract_features(word):
"""
Focus on word structure not frequency.
Get features from word and store in dict
"""
feat_3 = 1 if len(word) >= 4 and word[-1] == 'ن' else 0
feat_4 = 1 if len(word) >= 5 and word[0:2] == 'ال' and word[0:4] != 'الأ'else 0
feat_5 = 1 if len(word) >= 4 and word[1] == 'ا' else 0
if feat_5:
if word[3] == 'ا':
feat_5 = 0
feat_44 = 0
if feat_4 and word[-1] == 'ى':
feat_44 = 1
feat_6 = 1 if len(word) >= 5 and word[-2:] == 'ات' else 0
feat_7 = 1 if len(word) >= 5 and word[-2:] == 'ون' else 0
feat_8 = 1 if len(word) >= 5 and word[-2:] == 'ين' else 0
feat_9 = 1 if len(word) >= 5 and word[-2:] == 'ان' else 0
feat_10 = 1 if len(word) >= 5 and word[-2:] == 'وا' else 0
feat_11 = 1 if len(word) >= 4 and word[-2] == 'ي' else 0
feat_12 = 1 if len(word) >= 4 and word[-2] == 'و' else 0
feat_13 = 1 if len(word) >= 4 and word[-2] == 'ا' else 0
feat_14 = 1 if len(word) >= 4 and word[-1] == 'ة' else 0
feat_15 = 1 if len(word) >= 4 and word[-1] == 'ت' else 0
feat_16 = 1 if len(word) >= 4 and word[0] == 'م' else 0
feat_17 = 1 if len(word) >= 4 and word[0] == 'ي' else 0
feat_18 = 1 if len(word) >= 4 and word[0] == 'أ' else 0
feat_19 = 1 if len(word) >= 4 and word[0] == 'ن' else 0
feat_47 = 1 if feat_19 and word[-2] == 'و' else 0
feat_20 = 1 if len(word) >= 4 and word[0] == 'ت' else 0
feat_21 = 1 if len(word) >= 4 and word[0] == 'ا' else 0
feat_22 = 1 if 'ّ' in word else 0
feat_23 = 1 if len(word) >= 4 and word[0] == 'ا' and word[-1] == 'ا' else 0
feat_33 = 1 if len(word) >= 4 and word[0] == 'ا' and word[-1] == 'ي' else 0
feat_27 = 0
if feat_4:
feat_27 = 1 if len(word) >= 4 and word[0] == 'ا' and word[-1] == 'ن' else 0
feat_24 = 1 if len(word) >= 5 and word[0:3] == 'الأ' else 0
feat_43 = 1 if feat_24 and word[-2] == 'و' else 0
feat_35 = 0
feat_46 = 0
if not feat_24:
feat_35 = 1 if len(word) >= 5 and word[3] == 'ا' else 0 # الجامح
feat_46 = 1 if len(word) >= 5 and word[2] == 'ا' else 0 # ملاعب
feat_25 = 1 if len(word) >= 3 and 'آ' in word else 0
feat_26 = 1 if len(word) >= 4 and 'ي' in word else 0
feat_28 = 1 if len(word) >= 5 and word[0:3] == 'الم' else 0
feat_49 = 1 if len(word) >= 5 and word[0:4] == 'الما' else 0
feat_29 = 1 if len(word) >= 4 and word[0] == 'م' else 0
feat_30 = 1 if len(word) >= 5 and word[-2:] == 'نا' else 0
feat_42 = 1 if len(word) >= 5 and word[-3:-1] == 'او' else 0
feat_41 = 1 if len(word) >= 5 and word[-2:] == 'يا' else 0
feat_31 = 1 if len(word) >= 4 and word[-1] == 'ى' else 0
feat_32 = 1 if len(word) >= 5 and word[-2:] == 'تم' else 0
feat_34 = 1 if len(word) == 4 and word[0] == 'ن' and word[-1] == 'ا' else 0
feat_36 = 1 if len(word) >= 6 and 'ا' in word and 'ّا' in word else 0
feat_48 = 1 if feat_28 and word[-3:-1] == 'او' else 0
if feat_28:
feat_29 = 1 if len(word) >= 4 and word[2] == 'م' else 0
feat_37 = 0
has_shaddeh_ = 0
feat_38 = 0
if feat_28 and word[-1] == 'ة':
feat_37 = 1 if word[4] == 'ا' else 0
feat_38 = 1 if word[4] == 'ّ' else 0
feat_45 = 1 if feat_24 and word[-1] == 'ى' else 0
feat_39 = 0
if feat_28:
feat_39 = 1 if word[-1] == 'ة' else 0
feat_40 = 1 if len(word) >= 5 and word[0:4] == 'المت' else 0
feat_50 = 1 if 'مم' in word else 0
feat_dict = {
# feat_1: Length of word
'feat_1': len(word) + 1 if 'آ' in word else len(word),
# feat_2: Length of word
'feat_2': len(word) + 1 if 'آ' in word else len(word),
# feat_3: ينتهي بالنون
# مثال: منون , افعلن
'feat_3': feat_3,
#feat_4 يبدأ بال التعريف
# الشاكر , الماجدات
'feat_4': feat_4, # Give more weighs for this feature by replication!
#feat_5: يحتوي ألف
# مثال: قال, صلاح
'feat_5': feat_5,
# feat_6: تبدأ (ألف تاء) ات
# مثال: حامدات
'feat_6': feat_6,
# feat_7: ينتهي ب(واو نون) ون
# مثال: شاكرون
'feat_7': feat_7,
# feat_8: ينتهي ب(ياء و نون) ان
# مثال: شاكرين
'feat_8': feat_8,
# feat_9: ينتهي ب(ألف و نون) ان
# مثال: شاكران
'feat_9': feat_9,
# feat_10: ينتهي ب(واو ألف) ان
# مثال: شكروا
'feat_10': feat_10,
# feat_11: يحتوي حرف (ياء) قبل الآخر
# مثال: قتيل
'feat_11': feat_11,
# feat_12: يحتوي حرف (واو) قبل الآخر
# مثال: شكور
'feat_12': feat_12,
# feat_13: يحتوي حرف (الف) قبل الآخر
# مثال: فلاح
'feat_13': feat_13,
# feat_14: ينتهي بتاء مربوطة(ة)
# مثال: حديقة
'feat_14': feat_14,
# feat_15: ينتهي بتاء مفتوحة)
# مثال: شكرت
'feat_15': feat_15,
# feat_16: يبدأ ب(ميم) م
# مثال: فعلتم, نلتم
'feat_16': feat_16,
# feat_17: يبدأ ب(ياء) ي
# مثال: يحصل
'feat_17': feat_17,
# feat_18: يبدأ ب(همزة) ء
# مثال: أكل
'feat_18': feat_18,
# feat_19: يبدأ ب(نون) ن
# مثال: نلعب
'feat_19': feat_19,
# feat_20: يبدأ ب(تاء) ت
# مثال: تلعب
'feat_20': feat_20,
# feat_21: يبدأ ب(الف) ا
# مثال: العب
'feat_21': feat_21,
# feat_22: تحتوي شدة
# مثال: صدّيق
'feat_22': feat_22,
# feat_23: تبدأ الف تنتهي الف
# مثال: احصلا
'feat_23': feat_23,
# feat_24: تبدأ (ألف لام همزة) الأ
# مثال: الأكثر
'feat_24': feat_24,
# feat_25: يحتوي مد
# مثال: مآل
'feat_25': feat_25,
# feat_26: يحتوي ياء أي مكان
# مثال: كثير
'feat_26': feat_26,
# feat_27: يبدأ(الف ينتهي نون) ان
# صادقان
'feat_27': feat_27,
# feat_28: يبدأ(الف لام ميم) الم
# المستحيل
'feat_28': feat_28,
# feat_29: يحتوي (ميم) ميم
# مثال: المستحيل
'feat_29': feat_29,
# feat_30: ينتهي ي (نون الف) نا
# مثال: ركضنا
'feat_30': feat_30,
# feat_31: ينتهي ب (ألف مقصورة) ى
# مثال: كبرى
'feat_31': feat_31,
# feat_32: ينتهي ب (ألف تاء ميم) تم
# مثال: كبرى
'feat_32': feat_32,
# feat_33: يبدأ الف ينتهي ياء
# مثال: اركضي
'feat_33': feat_33,
# feat_34: يبدأ نون ينتهي الف
# مثال: نقلنا
'feat_34': feat_34,
# feat_35: يحتوي الف كحرف ثالث أو رابع
# مثال: ملامح, الجامح
'feat_35': feat_35,
# feat_36: يحتوي شدة ثم الف
# مثال: حفّار
'feat_36': feat_36,
# feat_37: يبدأ ب (ألف لام ميم) المـ
# مثال: المعالم
'feat_37': feat_37,
# feat_38: يبدأ ب (ألف لام ميم) ينتهي بتاء مربوطه و حرفه الخامس شدة
# مثال: الميسّرة
'feat_38': feat_38,
# feat_39: يبدأ ب (ألف لام ميم) ينتهي بتاء مربوطه
# مثال: الميسرة
'feat_39': feat_39,
# feat_40: يبدأ ب (ألف لام ميم تاء)
# مثال: المتعلّم
'feat_40': feat_40,
# feat_41: ينتهي ب(ياء الف) يا
# مثال: لقيا
'feat_41': feat_41,
# feat_42: يحتوي واو الف
# مثال: المقاول
'feat_42': feat_42,
# feat_43: يبدأ الف لام و ينتهي بواو
# مثال: الأقاول
'feat_43': feat_43,
# feat_44: يبدأ ب(الف و لام) التعريف وينتهي بألف مقصورة
# مثال: الكبرى
'feat_44': feat_44,
# feat_45: يبدأ ب(الف و لام و همزة) -الأ- وينتهي بألف مقصورة
# مثال: الأسمى
'feat_45': feat_45,
# feat_46: يحتوي ألف ثالث أو رابع
# مثال: ملاعب, الجامح
'feat_46': feat_46,
# feat_47: يبدأ بنون و يحتوي واو قبل الأخير
# مثال: نسور
'feat_47': feat_47,
# feat_48: يبدأ ب(ألف لاوم ميم) و يحتوي (واو الف) قبل الأخير
# مثال: المقاول
'feat_48': feat_48,
# feat_49: يبدأ ب(ألف لاوم ميم الف) -الما-
# مثال: المارق
'feat_49': feat_49,
# feat_50: يحتوي (ميم ميم)
# مثال: الممسحة
'feat_50': feat_50,
}
return feat_dict
def get_lines(file_name):
"""
Read file called data.txt and return generator of lists
list of index 0: verb
list of index 1: wazen
:return:
"""
verbs_wazens = (line.strip().split() for line in open(file_name, encoding='utf-8')
if line.strip())
return verbs_wazens
def get_data_target(file_name='data.txt'):
"""
Reads word from file and extracts features
Then append data and feature
:return: Data, Target
"""
verb_wazen = get_lines(file_name)
Data = []
Target = []
for sub_list in verb_wazen:
wazen, verb = sub_list[1], sub_list[0]
word = Word(verb)
features = word.extract_features(word.word)
Data.append(list(features.values()))
Target.append(wazen)
return Data, Target |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
dummy = l3 = ListNode(0)
while l1 and l2:
if l1.val > l2.val:
l3.next = ListNode(l2.val)
l3 = l3.next
l2 = l2.next
else:
l3.next = ListNode(l1.val)
l3 = l3.next
l1 = l1.next
while l1:
l3.next = ListNode(l1.val)
l3 = l3.next
l1 = l1.next
while l2:
l3.next = ListNode(l2.val)
l3 = l3.next
l2 = l2.next
return dummy.next
# Slightly More Optimized
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
head = l3 = ListNode()
while l1 and l2:
if l1.val < l2.val:
l3.next = ListNode(l1.val)
l1 = l1.next
l3 = l3.next
else:
l3.next = ListNode(l2.val)
l2 = l2.next
l3 = l3.next
l3.next = l1 or l2
return head.next
|
'''https://leetcode.com/problems/remove-duplicates-from-sorted-array/'''
# class Solution:
# def removeDuplicates(self, nums: List[int]) -> int:
# l = len(nums)
# ans = 0
# for i in range(1, l):
# if nums[i]!=nums[ans]:
# ans+=1
# nums[i], nums[ans] = nums[ans], nums[i]
# return ans+1
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
if len(nums)<2:
return len(nums)
p1, p2 = 0, 1
while p2<len(nums):
if nums[p2]!=nums[p1]:
p1+=1
nums[p1] = nums[p2]
p2+=1
return p1+1
|
#!/usr/bin/env python3
def lst_intersection(lst1:list, lst2:list):
'''
Source: https://www.geeksforgeeks.org/python-intersection-two-lists/
'''
return [value for value in lst1 if value in set(lst2)]
def main():
return lst_intersection(lst1, lst2)
if __name__ == "__main__":
main()
|
__author__ = 'huanpc'
########################################################################################################################
HOST = "25.22.28.94"
PORT = 3307
USER = "root"
PASSWORD = "root"
DB = "opencart"
TABLE_ADDRESS = 'oc_address'
TABLE_CUSTOMER= 'oc_customer'
########################################################################################################################
DIR_OUTPUT_PATH = './Test_plan'
# So ban ghi can tao
NUM_OF_THREADS = 10
OPENCART_PORT = 10000
RAM_UP = 10
CONFIG_FILE_PATH = DIR_OUTPUT_PATH+'/config.csv'
TEST_PLAN_FILE_PATH_1 = DIR_OUTPUT_PATH+'/plan/Opencart_register_'+str(NUM_OF_THREADS)+'.jmx'
TEST_PLAN_FILE_PATH_2 = DIR_OUTPUT_PATH+'/plan/Opencart_order_'+str(NUM_OF_THREADS)+'.jmx'
CSV_FILE_PATH_1 = DIR_OUTPUT_PATH+'/register_infor.csv'
CSV_FILE_PATH_2 = DIR_OUTPUT_PATH+'/order_infor.csv'
RESULT_FILE_PATH_1 = './Test_plan/result1.jtl'
RESULT_FILE_PATH_2 = './Test_plan/result2.jtl'
RUN_JMETER_1 = 'sh ../bin/jmeter -n -t '+TEST_PLAN_FILE_PATH_1+' -l '+RESULT_FILE_PATH_1
RUN_JMETER_2 = 'sh ../bin/jmeter -n -t '+TEST_PLAN_FILE_PATH_2+' -l '+RESULT_FILE_PATH_2
TIME_DELAY = 5
######################################################################################################################## |
def abort_if_false(ctx, param, value):
if not value:
ctx.abort()
|
HOST = "irc.twitch.tv"
PORT = 6667
OAUTH = "" # generate from http://www.twitchapps.com/tmi/
IDENT = "" # twitch account for which you used the oauth
CHANNEL = "" |
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
capacity = 5000-A[0]
apples = sorted(A[1:])
sum = 0
total = 0
for idx,a in enumerate(apples):
if a+sum > capacity:
total = idx
break
else:
sum+=a
return total
if __name__=="__main__":
print(solution([4650,150,150,150])==2)
print(solution([4850,100,30,30,100,50,100]) == 3)
|
whole_clinit = [
'\n'
'.method static constructor <clinit>()V\n'
' .locals 1\n'
'\n'
' :try_start_0\n'
' const-string v0, "nc"\n'
'\n'
' invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V\n'
' :try_end_0\n'
' .catch Ljava/lang/UnsatisfiedLinkError; {:try_start_0 .. :try_end_0} :catch_0\n'
'\n'
' goto :goto_0\n'
'\n'
' :catch_0\n'
' move-exception v0\n'
'\n'
' .local v0, "e":Ljava/lang/UnsatisfiedLinkError;\n'
' invoke-virtual {v0}, Ljava/lang/UnsatisfiedLinkError;->printStackTrace()V\n'
'\n'
' .end local v0 # "e":Ljava/lang/UnsatisfiedLinkError;\n'
' :goto_0\n'
' return-void\n'
'.end method\n'
]
insert_clinit = [
'\n'
' :try_start_ab\n'
' const-string v0, "nc"\n'
'\n'
' invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V\n'
' :try_end_ab\n'
' .catch Ljava/lang/UnsatisfiedLinkError; {:try_start_ab .. :try_end_ab} :catch_ab\n'
'\n'
' goto :goto_ab\n'
'\n'
' :catch_ab\n'
' move-exception v0\n'
'\n'
' .local v0, "e":Ljava/lang/UnsatisfiedLinkError;\n'
' invoke-virtual {v0}, Ljava/lang/UnsatisfiedLinkError;->printStackTrace()V\n'
'\n'
' .end local v0 # "e":Ljava/lang/UnsatisfiedLinkError;\n'
' :goto_ab\n'
]
|
class ValidBlockNetException(Exception):
pass
|
class Account:
all = []
def __init__(self, name:str, email: str, password: str):
self.name=name
self.email = email
self.password = password
Account.all.append(self)
def __repr__(self):
return f"{self.name}('{self.email}', '{self.password}')"
spotify = Account("spotify","andres@outlook.es", "contraseña")
netflix = Account("netflix","anrnet@outlook.es", "peliculasyseries")
amazon = Account("amazon","andrescompras@outlook.es", "smszona")
youtube = Account("youtube","andresvids@outlook.es", "viraltrending")
facebook = Account("facebook","andressocial@outlook.es", "contraseñaface")
instagram = Account("instagram","andresocial@outlook.es", "contraseñainsta")
print(Account.all)
|
'''
Given two integer arrays startTime and endTime and given an integer queryTime.
The ith student started doing their homework at the time startTime[i] and finished it at time endTime[i].
Return the number of students doing their homework at time queryTime. More formally, return the number of students where queryTime lays in the interval [startTime[i], endTime[i]] inclusive.
'''
class Solution:
def busyStudent(self, startTime: List[int], endTime: List[int], queryTime: int) -> int:
intervals = list(zip(startTime, endTime))
counter = 0
for i in range(len(intervals)):
if queryTime >= intervals[i][0] and queryTime <= intervals[i][1]:
counter+=1
return counter
|
# 12. put the string “avocado” in a variable and the string “radar” in another one
a='avocado'
r='radar'
# 13. print both strings in reverse
print(a[::-1])
print(r[::-1])
# 14. evaluate whether any of the two strings is palindrome (i.e. a string is palindrome if it can be read in the same way both from left to right and from right to left)
def palindrome(str):
if str == str[::-1]:
print("palindrome")
else:
print("not a palindrome")
palindrome(a)
palindrome(r)
# 15. print the first half of the first string and the second half of the second one
print('first half of each string')
def halfstring(stri):
print(stri[:len(stri)//2])
halfstring(a)
halfstring(r) |
# -*- coding:utf-8 -*-
"""
@author:SiriYang
@file: __init__.py
@time: 2019.12.24 20:33
"""
|
def as_div(form):
"""This formatter arranges label, widget, help text and error messages by
using divs. Apply to custom form classes, or use to monkey patch form
classes not under our direct control."""
# Yes, evil but the easiest way to set this property for all forms.
form.required_css_class = 'required'
return form._html_output(
normal_row=u'<div class="field"><div %(html_class_attr)s>%(label)s %(errors)s <div class="helptext">%(help_text)s</div> %(field)s</div></div>',
error_row=u'%s',
row_ender='</div>',
help_text_html=u'%s',
errors_on_separate_row=False
)
|
numbers = input('Enter a list of numbers (csv): ').replace(' ','').split(',')
numbers = [int(i) for i in numbers]
def sum_of_three(numbers):
summ = 0
for i in numbers:
summ += i
return summ
print('Sum:', sum_of_three(numbers)) |
{
"targets": [{
"target_name" : "test",
"defines": [ "V8_DEPRECATION_WARNINGS=1" ],
"sources" : [ "test.cpp" ],
"include_dirs": ["<!(node -e \"require('..')\")"]
}]
}
|
class QualifierList:
def __init__(self, qualifiers):
self.qualifiers = qualifiers
def insert_qualifier(self, qualifier):
self.qualifiers.insert(0, qualifier)
def __len__(self):
return len(self.qualifiers)
def __iter__(self):
return self.qualifiers
def __str__(self):
return " ".join([str(obs) for obs in self.qualifiers])
|
st = input("enter the string")
upCount=0
lowCount=0
vowels=0
# for i in range (0,len(st)):
# print(st[i])
for i in range (0,len(st)):
# print(st[i])
if(st[i].isupper()):
upCount+=1
else:
lowCount+=1
for i in range(0,len(st)):
if(st[i]=='a') or (st[i]=='A') or (st[i]=='e') or (st[i]=='E') or (st[i]=='i') or (st[i]=='I') or (st[i]=='o') or (st[i]=='O') or (st[i]=='u') or (st[i]=='U'):
vowels+=1
print("upper case", upCount)
print("lower case", lowCount)
print("vowels", vowels) |
class Solution:
def scoreOfParentheses(self, S):
"""
:type S: str
:rtype: int
"""
cnt, layer = 0, 0
for a, b in zip(S, S[1:]):
layer += (1 if a == '(' else -1)
if a + b == '()':
cnt += 2 ** (layer - 1)
return cnt |
def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Gender, obj[4]: Age, obj[5]: Children, obj[6]: Education, obj[7]: Occupation, obj[8]: Income, obj[9]: Bar, obj[10]: Coffeehouse, obj[11]: Restaurant20to50, obj[12]: Direction_same, obj[13]: Distance
# {"feature": "Income", "instances": 34, "metric_value": 0.9774, "depth": 1}
if obj[8]<=5:
# {"feature": "Education", "instances": 22, "metric_value": 0.994, "depth": 2}
if obj[6]<=3:
# {"feature": "Occupation", "instances": 19, "metric_value": 0.9495, "depth": 3}
if obj[7]>2:
# {"feature": "Age", "instances": 17, "metric_value": 0.9774, "depth": 4}
if obj[4]<=5:
# {"feature": "Restaurant20to50", "instances": 15, "metric_value": 0.9183, "depth": 5}
if obj[11]>0.0:
# {"feature": "Coffeehouse", "instances": 12, "metric_value": 0.9799, "depth": 6}
if obj[10]>0.0:
# {"feature": "Coupon", "instances": 10, "metric_value": 0.8813, "depth": 7}
if obj[2]>2:
# {"feature": "Bar", "instances": 6, "metric_value": 0.65, "depth": 8}
if obj[9]<=2.0:
return 'False'
elif obj[9]>2.0:
# {"feature": "Passanger", "instances": 2, "metric_value": 1.0, "depth": 9}
if obj[0]<=1:
return 'False'
elif obj[0]>1:
return 'True'
else: return 'True'
else: return 'False'
elif obj[2]<=2:
# {"feature": "Time", "instances": 4, "metric_value": 1.0, "depth": 8}
if obj[1]<=3:
# {"feature": "Passanger", "instances": 3, "metric_value": 0.9183, "depth": 9}
if obj[0]>0:
# {"feature": "Gender", "instances": 2, "metric_value": 1.0, "depth": 10}
if obj[3]<=1:
# {"feature": "Children", "instances": 2, "metric_value": 1.0, "depth": 11}
if obj[5]<=1:
# {"feature": "Bar", "instances": 2, "metric_value": 1.0, "depth": 12}
if obj[9]<=0.0:
# {"feature": "Direction_same", "instances": 2, "metric_value": 1.0, "depth": 13}
if obj[12]<=0:
# {"feature": "Distance", "instances": 2, "metric_value": 1.0, "depth": 14}
if obj[13]<=3:
return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
else: return 'True'
elif obj[0]<=0:
return 'False'
else: return 'False'
elif obj[1]>3:
return 'True'
else: return 'True'
else: return 'True'
elif obj[10]<=0.0:
return 'True'
else: return 'True'
elif obj[11]<=0.0:
return 'False'
else: return 'False'
elif obj[4]>5:
return 'True'
else: return 'True'
elif obj[7]<=2:
return 'False'
else: return 'False'
elif obj[6]>3:
return 'True'
else: return 'True'
elif obj[8]>5:
# {"feature": "Occupation", "instances": 12, "metric_value": 0.65, "depth": 2}
if obj[7]<=8:
return 'True'
elif obj[7]>8:
# {"feature": "Age", "instances": 4, "metric_value": 1.0, "depth": 3}
if obj[4]>3:
return 'True'
elif obj[4]<=3:
return 'False'
else: return 'False'
else: return 'True'
else: return 'True'
|
# Bollinger Bands (BB)
"""
There are three bands when using Bollinger Bands
Middle Band – 20 Day Simple Moving Average
Upper Band – 20 Day Simple Moving Average + (Standard Deviation x 2)
Lower Band – 20 Day Simple Moving Average - (Standard Deviation x 2)
"""
def _bb_calc(ohlcv, period=20, number_of_std=2, ohlcv_series="close"):
"""RETURN Pandas DataFrame the contains all the necessary values/calculations of the Bollinger Band Indicator"""
_ohlcv = ohlcv[[ohlcv_series]].copy(deep=True)
_ohlcv["mid_band"] = _ohlcv[ohlcv_series].rolling(window=period, min_periods=period).mean()
# ddof=0 means Degree of Freedom is 0. This calculates the population STD,
# rather than the sample STD.
_ohlcv["std"] = _ohlcv[ohlcv_series].rolling(window=period, min_periods=period).std(ddof=0)
_ohlcv["lower_band"] = _ohlcv["mid_band"] - number_of_std * _ohlcv["std"]
_ohlcv["upper_band"] = _ohlcv["mid_band"] + number_of_std * _ohlcv["std"]
return _ohlcv
def boll(ohlcv, period=20, number_of_std=2, ohlcv_series="close"):
"""RETURN Three variables for the Bollinger Band indicator"""
_ohlcv = _bb_calc(ohlcv, period, number_of_std, ohlcv_series)
return _ohlcv[["lower_band", "mid_band", "upper_band"]]
def percent_b(ohlcv, period=20, number_of_std=2, ohlcv_series="close"):
_ohlcv = _bb_calc(ohlcv, period, number_of_std, ohlcv_series)
indicator_values = (_ohlcv[ohlcv_series] - _ohlcv['lower_band']) / (_ohlcv['upper_band'] - _ohlcv['lower_band'])
return indicator_values
|
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2013 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list ofconditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materialsprovided with the
# distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
class SingleList(object):
""" single list module for mini-stl(Python)
it just same as std::slist<T> in C++ sgi stl
"""
class ListNode(object):
def __init__(self):
self.next = None
self.data = None
def __del__(self):
self.next = None
self.data = None
def __init__(self):
self.front_ = None
self.rear_ = None
self.size_ = 0
self.iter_ = None
def __del__(self):
self.clear()
self.iter_ = None
def __iter__(self):
self.iter_ = self.front_
return self
def next(self):
if self.iter_ == None:
raise StopIteration
else:
data = self.iter_.data
self.iter_ = self.iter_.next
return data
def clear(self):
while self.front_ != None:
node = self.front_
self.front_ = self.front_.next
del node
self.front_ = None
self.rear_ = None
self.size_ = 0
def empty(self):
return self.front_ == None
def size(self):
return self.size_
def push_back(self, x):
node = self.ListNode()
node.next = None
node.data = x
if self.front_ == None:
self.front_ = node
self.rear_ = node
else:
self.rear_.next = node
self.rear_ = node
self.size_ += 1
def push_front(self, x):
node = self.ListNode()
node.next = self.front_
node.data = x
if self.front_ == None:
self.rear_ = node
self.front_ = node
self.size_ += 1
def pop_front(self):
if self.front_ == None:
return
node = self.front_
self.front_ = self.front_.next
del node
self.size_ -= 1
def front(self):
if self.front_ == None:
return None
return self.front_.data
def back(self):
if self.rear_ == None:
return None
return self.rear_.data
def for_each(self, visit):
assert visit
node = self.front_
while node != None:
visit(node.data)
node = node.next
|
# (c) Copyright IBM Corp. 2010, 2020. All Rights Reserved.
# Validate that incident name does not contain 'X'
if 'X' in incident.name:
helper.fail("The name must not contain 'X'.")
# Validate length of the incident name
if len(incident.name) > 100:
helper.fail("The name must be less than 100 characters.")
|
class VerifierError(Exception):
pass
class VerifierTranslatorError(Exception):
pass
__all__ = ["VerifierError", "VerifierTranslatorError"]
|
a = input()
a = int(a)
b = input()
set1 = set()
b.lower()
for x in b:
set1.add(x.lower())
if len(set1) == 26:
print("YES")
else:
print("NO")
|
"""
def elevator_distance(array):
return sum(abs(array[i+1] - array[i]) for i in range(len(array)-1))
"""
def elevator_distance(array):
d = 0
for i in range(0, len(array) -1):
d += abs(array[i] - array[i+1])
return d
|
# https://leetcode.com/problems/counting-bits/
#Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary representation of i.
class Solution(object):
def countBits(self, n):
"""
:type n: int
:rtype: List[int]
"""
ans = [0] * (n + 1)
for i in range(1, n + 1):
ans[i] = ans[i >> 1] + (i & 1)
return ans |
#
# @lc app=leetcode id=125 lang=python3
#
# [125] Valid Palindrome
#
# https://leetcode.com/problems/valid-palindrome/description/
#
# algorithms
# Easy (30.28%)
# Total Accepted: 324.8K
# Total Submissions: 1.1M
# Testcase Example: '"A man, a plan, a canal: Panama"'
#
# Given a string, determine if it is a palindrome, considering only
# alphanumeric characters and ignoring cases.
#
# Note: For the purpose of this problem, we define empty string as valid
# palindrome.
#
# Example 1:
#
#
# Input: "A man, a plan, a canal: Panama"
# Output: true
#
#
# Example 2:
#
#
# Input: "race a car"
# Output: false
#
#
#
class Solution:
def isPalindrome(self, s: str) -> bool:
i: int = 0
j: int = len(s) - 1
while i < j:
a = s[i]
if not a.isalnum():
i += 1
continue
b = s[j]
if not b.isalnum():
j -= 1
continue
if a.lower() != b.lower():
return False
i += 1
j -= 1
return True
|
vfx = None
##
# Init midi module
#
# @param: vfx object
# @return: void
##
def init(vfx_obj):
global vfx
vfx = vfx_obj
def debug():
global vfx
if(vfx.usb_midi_connected == False):
print('Midi not connected')
pass
print("Midi trig: %s | id: %s | name: %s |active ch: %s | midi new: %s | clock: %s | pgm: %s | cc: %s | note: %s " %
(str(vfx.usb_midi_trig),
str(vfx.default_input_id),
str(vfx.usb_midi_name),
str(vfx.midi_channel),
str(vfx.midi_new),
str(vfx.midi_clk),
str(vfx.midi_pgm),
str(vfx.midi_cc),
str(vfx.midi_notes)
)
) |
"""Preset GridWorlds module
Are used by the :obj:`~smartexploration.environments.gridworld.GridWorld` to
generate the gridworld.
"""
def easy():
"""Easy GridWorld
Returns
-------
:obj:`str`
name
double :obj:`list` of `int`
layout
:obj:`int`
scale
"""
name = "Easy"
layout = [[3, 0, 0],
[1, 1, 0],
[1, 1, 0],
[2, 0, 0]]
scale = 5
return name, layout, scale
def medium():
"""Medium GridWorld
Returns
-------
:obj:`str`
name
double :obj:`list` of `int`
layout
:obj:`int`
scale
"""
name = "Medium"
layout = [[3, 0, 0, 0, 0],
[1, 1, 1, 1, 0],
[0, 0, 0, 0, 0],
[0, 1, 1, 1, 1],
[0, 0, 0, 0, 2]]
scale = 5
return name, layout, scale
def hard():
"""Hard GridWorld
Returns
-------
:obj:`str`
name
double :obj:`list` of `int`
layout
:obj:`int`
scale
"""
name = "Hard"
layout = [[3, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 1, 1, 1, 1, 1, 1],
[0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 0],
[2, 0, 0, 0, 0, 0, 0]]
scale = 5
return name, layout, scale
def extreme():
"""Extreme GridWorld
Returns
-------
:obj:`str`
name
double :obj:`list` of `int`
layout
:obj:`int`
scale
"""
name = "Extreme"
layout = [[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3],
[1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0],
[0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
[0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1],
[0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0],
[0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0],
[0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0],
[0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0],
[1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0],
[0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0],
[0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0],
[0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0],
[0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0],
[0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0],
[1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0],
[0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1],
[0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0],
[1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0],
[2, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0]]
scale = 3
return name, layout, scale
|
def mail_send(to, subject, content):
print(to)
print(subject)
print(content)
|
# https://leetcode-cn.com/problems/permutation-sequence/solution/
# 第K个排列
class Solution(object):
def dfs(self, nums, length, depth, path, used, ans):
if length == depth:
return path
# 当前层的排列数
cur = self.factorial(length - depth - 1)
for i in range(0, length):
if used[i] is True:
continue
# 减枝
if cur < k:
k -= cur
continue
path.append(nums[i])
used[i] = True
return self.dfs(nums, length, depth + 1, path, used, ans)
return None
def factorial(self, n):
total = 1
while(n > 0):
total *= n
n -= 1
return total
def permute(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
if len(nums) == 0: return []
ans = []
path = []
used = [False] * len(nums)
return self.dfs(nums, len(nums), 0, path, used, ans)
|
SAFE_METHODS = ("GET", "HEAD", "OPTIONS")
class BasePermission(object):
"""
A base class from which all permission classes should inherit.
"""
def has_permission(self, request, view):
"""
Return `True` if permission is granted, `False` otherwise.
"""
return True
def has_object_permission(self, request, view, obj):
"""
Return `True` if permission is granted, `False` otherwise.
"""
return True
class AllowAny(BasePermission):
"""
Allow any access.
This isn't strictly required, since you could use an empty
permission_classes list, but it's useful because it makes the intention
more explicit.
"""
def has_permission(self, request, view):
return True
class IsAuthenticated(BasePermission):
"""
Allows access only to authenticated users.
"""
def has_permission(self, request, view):
return request.user and request.user.is_authenticated
class IsAdminUser(BasePermission):
"""
Allows access only to admin users.
"""
def has_permission(self, request, view):
return request.user and request.user.is_staff
class IsAuthenticatedOrReadOnly(BasePermission):
"""
The request is authenticated as a user, or is a read-only request.
"""
def has_permission(self, request, view):
return (
request.method in SAFE_METHODS
or request.user
and request.user.is_authenticated
)
|
a = 1
b = 0
c = 0
i = 0
while True:
c = a + b
b = a
a = c
if i % 100000 == 0:
print(c)
i += 1
|
def create_sensorinfo_file(directory):
pass
def create_metadata_file(directory):
pass
def create_delivery_note_file(directory):
pass
def create_data_delivery(directory):
pass
|
class Plugin_OBJ():
def __init__(self, plugin_utils):
self.plugin_utils = plugin_utils
self.channels_json_url = "https://iptv-org.github.io/iptv/channels.json"
self.filter_dict = {}
self.setup_filters()
self.unfiltered_chan_json = None
self.filtered_chan_json = None
@property
def tuners(self):
return self.plugin_utils.config.dict["iptvorg"]["tuners"]
@property
def stream_method(self):
return self.plugin_utils.config.dict["iptvorg"]["stream_method"]
@property
def filtered_chan_list(self):
if not self.filtered_chan_json:
self.filtered_chan_json = self.filterlist()
return self.filtered_chan_json
@property
def unfiltered_chan_list(self):
if not self.unfiltered_chan_json:
self.unfiltered_chan_json = self.get_unfiltered_chan_json()
return self.unfiltered_chan_json
def setup_filters(self):
for x in ["countries", "languages", "category"]:
self.filter_dict[x] = []
for filter in list(self.filter_dict.keys()):
filterconf = self.plugin_utils.config.dict["iptvorg"]["filter_%s" % filter]
if filterconf:
if isinstance(filterconf, str):
filterconf = [filterconf]
self.plugin_utils.logger.info("Found %s Enabled %s Filters" % (len(filterconf), filter))
self.filter_dict[filter].extend(filterconf)
else:
self.plugin_utils.logger.info("Found No Enabled %s Filters" % (filter))
def get_channels(self):
channel_list = []
self.plugin_utils.logger.info("Pulling Unfiltered Channels: %s" % self.channels_json_url)
self.unfiltered_chan_json = self.get_unfiltered_chan_json()
self.plugin_utils.logger.info("Found %s Total Channels" % len(self.unfiltered_chan_json))
self.filtered_chan_json = self.filterlist()
self.plugin_utils.logger.info("Found %s Channels after applying filters and Deduping." % len(self.filtered_chan_list))
for channel_dict in self.filtered_chan_list:
clean_station_item = {
"name": channel_dict["name"],
"id": channel_dict["name"],
"thumbnail": channel_dict["logo"],
}
channel_list.append(clean_station_item)
return channel_list
def get_channel_stream(self, chandict, stream_args):
streamdict = self.get_channel_dict(self.filtered_chan_list, "name", chandict["origin_name"])
streamurl = streamdict["url"]
stream_info = {"url": streamurl}
return stream_info
def get_unfiltered_chan_json(self):
urlopn = self.plugin_utils.web.session.get(self.channels_json_url)
return urlopn.json()
def filterlist(self):
filtered_chan_list = []
for channels_item in self.unfiltered_chan_list:
filters_passed = []
for filter_key in list(self.filter_dict.keys()):
if not len(self.filter_dict[filter_key]):
filters_passed.append(True)
else:
if filter_key in list(channels_item.keys()):
if filter_key in ["countries", "languages"]:
if isinstance(channels_item[filter_key], list):
if len(channels_item[filter_key]):
chan_values = []
chan_values.extend([x["name"] for x in channels_item[filter_key]])
chan_values.extend([x["code"] for x in channels_item[filter_key]])
else:
chan_values = []
else:
chan_values = []
chan_values.append(channels_item[filter_key]["name"])
chan_values.append(channels_item[filter_key]["code"])
elif filter_key in ["category"]:
chan_values = [channels_item[filter_key]]
else:
chan_values = []
if not len(chan_values):
filter_passed = False
else:
values_passed = []
for chan_value in chan_values:
if str(chan_value).lower() in [x.lower() for x in self.filter_dict[filter_key]]:
values_passed.append(True)
else:
values_passed.append(False)
if True in values_passed:
filter_passed = True
else:
filter_passed = False
filters_passed.append(filter_passed)
if False not in filters_passed:
if channels_item["name"] not in [x["name"] for x in filtered_chan_list]:
filtered_chan_list.append(channels_item)
return filtered_chan_list
def get_channel_dict(self, chanlist, keyfind, valfind):
return next(item for item in chanlist if item[keyfind] == valfind) or None
|
nome = 'Cristiano'
sobrenome = 'Cunha'
nome_completo = f'{nome} {sobrenome}'
idade = 22
print(f'Nome: {nome_completo} - Idade: {idade}')
print(type(idade))
#Tudo no python são objetos |
# Chicago 106 problem
# try https://e-maxx.ru/algo/levit_algorithm
places, streets = list(map(int, input().split()))
graph = dict()
# dynamic = [-1 for i in range(places)]
for i in range(streets):
start, end, prob = list(map(int, input().split()))
if start not in graph:
graph[start] = list()
if end not in graph:
graph[end] = list()
graph[start].append(end)
graph[end].append(start)
|
line = input()
while line != "0 0 0 0":
line = list(map(int, line.split()))
starting = line[0]
for i in range(4):
line[i] = ((line[i] + 40 - starting) % 40) * 9
res = 360 * 3 + (360 - line[1]) % 360 + (360 + line[2] - line[1]) % 360 + (360 + line[2] - line[3]) % 360
print(res)
line = input()
|
dia = input('Qual o dia do seu anivesario? ')
mes = input('Qual o mes do seu aniversario? ')
ano = input('Qual o ano do seu aniversario? ')
print('Você nasceu dia', dia,'de',mes,'de',ano,', Correto?')
|
#
# PySNMP MIB module CISCO-DOT11-WIDS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DOT11-WIDS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:55:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion")
ciscoMgmt, = mibBuilder.importSymbols("CISCO-SMI", "ciscoMgmt")
ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex")
NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance")
ObjectIdentity, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, Integer32, Counter32, Unsigned32, TimeTicks, Counter64, IpAddress, NotificationType, Bits, ModuleIdentity, Gauge32 = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "Integer32", "Counter32", "Unsigned32", "TimeTicks", "Counter64", "IpAddress", "NotificationType", "Bits", "ModuleIdentity", "Gauge32")
MacAddress, TruthValue, TimeStamp, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "MacAddress", "TruthValue", "TimeStamp", "DisplayString", "TextualConvention")
ciscoDot11WidsMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9, 9, 456))
ciscoDot11WidsMIB.setRevisions(('2004-11-30 00:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: ciscoDot11WidsMIB.setRevisionsDescriptions(('Initial version of this MIB module. ',))
if mibBuilder.loadTexts: ciscoDot11WidsMIB.setLastUpdated('200411300000Z')
if mibBuilder.loadTexts: ciscoDot11WidsMIB.setOrganization('Cisco System Inc.')
if mibBuilder.loadTexts: ciscoDot11WidsMIB.setContactInfo(' Cisco Systems, Customer Service Postal: 170 West Tasman Drive San Jose, CA 95134 USA Tel: +1 800 553-NETS E-mail: cs-dot11@cisco.com')
if mibBuilder.loadTexts: ciscoDot11WidsMIB.setDescription('This MIB is intended to be implemented on the following IOS based network entities for the purpose of providing network management stations information about the various attempts to compromise the security in the 802.11-based wireless networks. (i) 802.11 Access Points that accept wireless client associations. The MIB reports the information about the following attacks that can happen either at the initial authentication phase or during normal data communication between the client and the AP. EAPOL flooding - This is an attempt made by an invalid 802.11 client to send too many EAPOL-Start messages and bring the authentication services on the Authenticator, typically the AP, down. BlackListing - This is the process of marking a client as invalid when its authentication attempts fail. The client is put in a list when its authentication attempt fails for the first time. If the number of consecutive failed authentication attempts reach a threshold, any subsequent authentication requests made by the client will be rejected from that point for a configurable period of time. Protection Failures - These kind of failures happen when the attacker injects invalid packets onto the wireless network thereby corrupting the 802.11 data traffic between an AP and its associated wireless clients. The administrator, through the NMS, can configure the thresholds on the AP using this MIB to enable the AP detect the EAPOL flood attacks and provide related statistics to the NMS. To detect protection failures, the AP provides the relevant statistics about the protection errors in the form of MIB objects, which are compared against the thresholds configured on the NMS and appropriate events are raised by the NMS, if thresholds are found to be exceeded. The hierarchy of the AP and MNs is as follows. +~-~-~+ +~-~-~+ +~-~-~+ +~-~-~+ + + + + + + + + + AP + + AP + + AP + + AP + + + + + + + + + +~-~-~+ +~-~-~+ +~-~-~+ +~-~-~+ .. . . . .. . . . . . . . . . . . . . . . . . . . . . . . \\/ \\/ \\/ \\/ \\/ +.....+ +.....+ +-.-.-.+ +~-~-~+ +......+ + + + + + + + + + + + MN + + MN + + MN + + MN + + MN + + + + + + + + + + + +.....+ +.....+ +-.-.-.+ +~-~-~+ +......+ The wireless connections are represented as dotted lines in the above diagram. GLOSSARY Access Point ( AP ) An entity that contains an 802.11 medium access control ( MAC ) and physical layer ( PHY ) interface and provides access to the distribution services via the wireless medium for associated clients. Mobile Node ( MN ) A roaming 802.11 wireless device in a wireless network associated with an access point. Service Set Identifier (SSID) The Radio Service Set ID that is used by the mobile wireless clients for identification during the association with the APs. Temporal Key Integrity Protocol (TKIP) A security protocol defined to enhance the limitations of WEP. Message Integrity Check and per-packet keying on all WEP-encrypted frames are two significant enhancements provided by TKIP to WEP. Counter mode with CBC-MAC Protocol (CCMP) A security protocol that uses the counter mode in conjunction with cipher block chaining. This method divides the data into blocks, encrypts the first block, XORs the results with the second block, encrypts the result, XORs the result with the next block and continues till all the blocks are processed. This way, this protocol derives a 64-bit MIC which is appended to the plaintext data which is again encrypted using the counter mode. Message Integrity Check (MIC) The Message Integrity Check is an improvement over the Integrity Check Function (ICV) of the 802.11 standard. MIC adds two new fields to the wireless frames - a sequence number field for detecting out-of-order frames and a MIC field to provide a frame integrity check to overcome the mathematical shortcomings of the ICV. 802.1x The IEEE ratified standard for enforcing port based access control. This was originally intended for use on wired LANs and later extended for use in 802.11 WLAN environments. This defines an architecture with three main parts - a supplicant (Ex. an 802.11 wireless client), an authenticator (the AP) and an authentication server(a Radius server). The authenticator passes messages back and forth between the supplicant and the authentication server to enable the supplicant get authenticated to the network. Extensible Authentication Protocol Over LAN (EAPOL) This is an encapsulation method defined by 802.1x passing EAP packets over Ethernet frames. ')
ciscoDot11WidsMIBNotifs = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 456, 0))
ciscoDot11WidsMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 456, 1))
ciscoDot11WidsAuthFailures = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1))
ciscoDot11WidsProtectFailures = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2))
ciscoDot11WidsMIBConform = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 456, 2))
ciscoDot11WidsMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 456, 2, 1))
ciscoDot11WidsMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 9, 9, 456, 2, 2))
cDot11WidsFloodDetectEnable = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 1), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cDot11WidsFloodDetectEnable.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsFloodDetectEnable.setDescription("This object is used to enable or disable the WIDS flood detection feature. Set this MIB object to 'true' to enable the flood detection and 'false' to disable it. Note that the values configured through cDot11WidsFloodThreshold and cDot11WidsEapolFloodInterval take effect only if flood detection is enabled through this MIB object. ")
cDot11WidsEapolFloodThreshold = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 512)).clone(3)).setUnits('attempts').setMaxAccess("readwrite")
if mibBuilder.loadTexts: cDot11WidsEapolFloodThreshold.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsEapolFloodThreshold.setDescription('This object specifies the maximum number of authentication attempts allowed for all the clients taken together in the interval specified by cDot11WidsEapolFloodInterval. The attempts include both the successful as well as failed attempts. ')
cDot11WidsEapolFloodInterval = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 300)).clone(60)).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: cDot11WidsEapolFloodInterval.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsEapolFloodInterval.setDescription('This object specifies the time duration for which the client authentication attempts have to be monitored for detecting the flood attack. ')
cDot11WidsBlackListThreshold = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 4), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 512)).clone(3)).setUnits('attempts').setMaxAccess("readwrite")
if mibBuilder.loadTexts: cDot11WidsBlackListThreshold.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsBlackListThreshold.setDescription('This object configures the maximum threshold on the number of unsuccessful authentication attempts, that can be made by a particular client. Once the threshold is reached, the client is retained in the list for a period of time equal to the value configured through cDot11WidsBlackListDuration, during which its attempts to get authenticated are blocked. ')
cDot11WidsBlackListDuration = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 5), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 300)).clone(60)).setUnits('seconds').setMaxAccess("readwrite")
if mibBuilder.loadTexts: cDot11WidsBlackListDuration.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsBlackListDuration.setDescription('This object indicates the time duration for which a particular client has to be kept in the black list after the number of unsuccessful attempts reach the threshold given by cDot11WidsBlackListThreshold. ')
cDot11WidsFloodMaxEntriesPerIntf = MibScalar((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: cDot11WidsFloodMaxEntriesPerIntf.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsFloodMaxEntriesPerIntf.setDescription('This object indicates the maximum number of entries that can be held for a particular 802.11 radio interface identified by ifIndex. ')
cDot11WidsEapolFloodTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 7), )
if mibBuilder.loadTexts: cDot11WidsEapolFloodTable.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsEapolFloodTable.setDescription("This table gives the statistics on the EAPOL flood attacks observed at this radio interface. An entry in this table is created by the agent when this 802.11 station detects an EAPOL flood attack. All the columns in the entries except the cDot11WidsEapolFloodStopTime are populated when the attack is observed first. The object cDot11WidsEapolFloodStopTime is populated when no flood conditions are observed following the initial observation at the time indicated by cDot11WidsEapolFloodStartTime. This can be illustrated by the following example. Assume that the monitoring interval is configured to 1 minute through the cDot11WidsEapolFloodInterval object and the number of attempts is set to 5. At the end of the first minute after this configuration is made, client c1 is found to have made 4 attempts and another client c2 have made 3. Hence, in total, the attempt count exceeds 7 and the agent adds a new row to this table. The cDot11WidsFloodStopTime carries a value of 0 at this point in the newly added row. The MIB object cDot11WidsEapolFloodClientMac at this point holds the MAC address of c1 and cDot11WidsEapolFloodClientCount holds the value of 4. At the end of the second interval, assume that the clients are found to have made only 4 attempts in total with c1 and c2 making 3 and 1 attempt(s) respectively. Now the total count is not found to exceed the threshold. Hence the flood is observed to be stopped. The object cDot11WidsEapolFloodStopTime is now populated with this time at which the flood is observed to be stopped. The MIB object cDot11WidsEapolFloodClientMac at this point holds c1's MAC address and cDot11WidsEapolFloodClientCount would hold a value of 7. If the count is found to exceed in the next interval, it will be treated as a beginning of a new flood event and hence a new entry will be created for the same. Assume the case where, at the end of the second interval, the total count continues at the rate above the threshold, with c1 making 5 and c2 making 2 attempts respectively. Since the flood is not observed to be stopped, the object cDot11WidsFloodStopTime continues to hold a value of zero. The agent at anytime will retain only the most recent and maximum number of entries, as given by cDot11WidsFloodMaxEntriesPerIntf, for a particular value of ifIndex. The older entries are purged automatically when the number of entries for a particular ifIndex reaches its maximum. This table has a expansion dependent relationship with ifTable defined in IF-MIB. There exists a row in this table corresponding to the row for each interface of iftype ieee80211(71) found in ifTable. cDot11WidsEapolFloodIndex acts as the expansion index. ")
cDot11WidsEapolFloodEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 7, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "CISCO-DOT11-WIDS-MIB", "cDot11WidsEapolFloodIndex"))
if mibBuilder.loadTexts: cDot11WidsEapolFloodEntry.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsEapolFloodEntry.setDescription('An entry holds the statistics about one instance of EAPOL flood attack observed at this particular radio interface. ')
cDot11WidsEapolFloodIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 7, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 100)))
if mibBuilder.loadTexts: cDot11WidsEapolFloodIndex.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsEapolFloodIndex.setDescription('This object identifies the set of information about one instance of an EAPOL flood event observed at this radio interface between the start and stop times indicated by cDot11WidsEapolFloodStartTime and cDot11WidsEapolFloodStopTime. ')
cDot11WidsEapolFloodClientMac = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 7, 1, 2), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsEapolFloodClientMac.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsEapolFloodClientMac.setDescription('This object identifies the MAC address of the wireless client that has made the maximum number of authentication attempts in the duration specified by the cDot11WidsEapolFloodInterval object. At the end of each interval time indicated by cDot11WidsFloodInterval, the 802.11 station checks whether the total count of the number of authentication attempts made by all the clients exceed the threshold configured through the object cDot11WidsEapolFloodThreshold. If yes, then the agent populates this MIB object with the MAC of the wireless client that has made the maximum number of authentication attempts in that interval. When the flood event is observed to be stopped, as indicated by a non-zero value for the cDot11WidsEapolFloodStopTime object, this object indicates the MAC of the wireless client that has made the maximum number of attempts for the entire duration of the flood observed between the times indicated by the objects cDot11WidsEapolFloodStartTime and cDot11WidsEapolFloodStopTime respectively. ')
cDot11WidsEapolFloodClientCount = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 7, 1, 3), Unsigned32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsEapolFloodClientCount.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsEapolFloodClientCount.setDescription('This object provides the count associated with the client with largest number of attempts in the last interval. When the flood event is observed to be stopped, as indicated by a non-zero value for the cDot11WidsEapolFloodStopTime object, this object gives the count associated with the client with the largest number of attempts, for the entire duration of the flood observed between the times indicated by the objects cDot11WidsEapolFloodStartTime and cDot11WidsEapolFloodStopTime respectively. ')
cDot11WidsEapolFloodStartTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 7, 1, 4), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsEapolFloodStartTime.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsEapolFloodStartTime.setDescription('This object indicates the time at which the EAPOL flood event identified by one entry of this table was observed first at this radio interface. ')
cDot11WidsEapolFloodStopTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 7, 1, 5), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsEapolFloodStopTime.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsEapolFloodStopTime.setDescription('This object indicates the time at which the the EAPOL flood event observed first at the time indicated by cDot11WidsEapolFloodStartTime has stopped. If this 802.11 station finds that the flood conditions observed in the one or more prior intervals has ceased, it marks the flood event as stopped at the time indicated by this object. That the flood has ceased is indicated by the number of authentication attempts dropping below the value specified by the cDot11WidsEapolFloodThreshold object. A value of 0 for this object indicates that the number of authentication attempts continue to exceed the value specified by the cDot11WidsEapolFloodThreshold object. ')
cDot11WidsEapolFloodTotalCount = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 7, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsEapolFloodTotalCount.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsEapolFloodTotalCount.setDescription('This object gives the accumulated count of the number of authentication attempts made by all the clients at the time of query. ')
cDot11WidsBlackListTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 8), )
if mibBuilder.loadTexts: cDot11WidsBlackListTable.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsBlackListTable.setDescription('This table gives the information about the 802.11 wireless clients that have been blacklisted while attempting to get authenticated with this 802.11 station at this radio interface. An entry is added to this table when the number of consecutive failed authentication attempts made by a client equals the value configured through cDot11WidsBlackListThreshold. The client will then be blocked from getting authenticated for a time period equal to the value configured through cDot11WidsBlackListDuration. After this time elapses, the client is taken off from the list and the agent automatically removes the entry corresponding to that client from this table. This table has a expansion dependent relationship on the ifTable. For each entry in this table, there exists at least an entry in the ifTable of ifType ieee80211(71). cDot11BlackListIndex acts as the expansion index. ')
cDot11WidsBlackListEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 8, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "CISCO-DOT11-WIDS-MIB", "cDot11WidsBlackListClientMac"))
if mibBuilder.loadTexts: cDot11WidsBlackListEntry.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsBlackListEntry.setDescription('Each entry holds the information about one 802.11 wireless client that has been blacklisted when attempting to get authenticated with this 802.11 station at this radio interface. ')
cDot11WidsBlackListClientMac = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 8, 1, 1), MacAddress())
if mibBuilder.loadTexts: cDot11WidsBlackListClientMac.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsBlackListClientMac.setDescription('This object indicates the Mac Address of the blacklisted client. ')
cDot11WidsBlackListAttemptCount = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 8, 1, 2), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsBlackListAttemptCount.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsBlackListAttemptCount.setDescription('This object counts the total number of attempts made by the client identified by cDot11WidsBlackListClientMac to get authenticated with the 802.11 station through this radio interface. ')
cDot11WidsBlackListTime = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 1, 8, 1, 3), TimeStamp()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsBlackListTime.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsBlackListTime.setDescription('This object indicates the time at which the client was blacklisted after failing in its attempt to get authenticated with this 802.11 station at this radio interface. ')
cDot11WidsProtectFailClientTable = MibTable((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1), )
if mibBuilder.loadTexts: cDot11WidsProtectFailClientTable.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsProtectFailClientTable.setDescription('This table gives the statistics on the various protection failures occurred during the data communication of this 802.11 station with a particular client currently associated at this dot11 interface. Note that the agent populates this table with an entry for an associated client if and only if at least one of the error statistics, as reported by the counter-type objects of this table, has a non-zero value. This table has a expansion dependent relationship on the ifTable. For each entry in this table, there exists at least an entry in the ifTable of ifType ieee80211(71). cDot11WidsSsid and cDot11WidsClientMacAddress act as the expansion indices. ')
cDot11WidsProtectFailClientEntry = MibTableRow((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex"), (0, "CISCO-DOT11-WIDS-MIB", "cDot11WidsSsid"), (0, "CISCO-DOT11-WIDS-MIB", "cDot11WidsClientMacAddress"))
if mibBuilder.loadTexts: cDot11WidsProtectFailClientEntry.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsProtectFailClientEntry.setDescription('Each entry holds the information about the protection failures observed at this radio interface when this 802.11 station communicates with its associated client identified by cDot11WidsClientMacAddress at the interface identified by ifIndex. The clients are grouped according to the SSIDs they use for their association with the dot11 interface. ')
cDot11WidsSsid = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(1, 32)))
if mibBuilder.loadTexts: cDot11WidsSsid.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsSsid.setDescription('This object specifies one of the SSIDs of this radio interface using which the client has associated with the 802.11 station. ')
cDot11WidsClientMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 2), MacAddress())
if mibBuilder.loadTexts: cDot11WidsClientMacAddress.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsClientMacAddress.setDescription('This object identifies the MAC address of the associated client to which this set of statistics are applicable. ')
cDot11WidsSelPairWiseCipher = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsSelPairWiseCipher.setReference('Section 7.3.2.25.1, 802.11i Amendment 6: Medium Access Control(MAC) Security Enhancements. ')
if mibBuilder.loadTexts: cDot11WidsSelPairWiseCipher.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsSelPairWiseCipher.setDescription('This object identifies the pairwise cipher used by the client identified by cDot11WidsClientMacAddress during its association with this 802.11 station at the interface identified by ifIndex. ')
cDot11WidsTkipIcvErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsTkipIcvErrors.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsTkipIcvErrors.setDescription("This object counts the total number of TKIP ICV Errors observed in the data communication between this 802.11 station and the client indicated by cDot11WidsClientMacAddress since the client's association with this 802.11 station at the radio interface identified by ifIndex. ")
cDot11WidsTkipLocalMicFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsTkipLocalMicFailures.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsTkipLocalMicFailures.setDescription("This object counts the total number of TKIP local MIC failures observed in the data communication between this 802.11 station and the client indicated by cDot11WidsClientMacAddress since the client's association with this 802.11 station at the radio interface identified by ifIndex. ")
cDot11WidsTkipRemoteMicFailures = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 6), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsTkipRemoteMicFailures.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsTkipRemoteMicFailures.setDescription("This object counts the total number of TKIP remote MIC failures observed in the data communication between this 802.11 station and the client indicated by cDot11WidsClientMacAddress since the client's association with this 802.11 station at the radio interface identified by ifIndex. ")
cDot11WidsCcmpReplays = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 7), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsCcmpReplays.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsCcmpReplays.setDescription("This object counts the total number of CCMP replay failures observed in the data communication between this 802.11 station and the client indicated by cDot11WidsClientMacAddress since the client's association with this 802.11 station at the radio interface identified by ifIndex. ")
cDot11WidsCcmpDecryptErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 8), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsCcmpDecryptErrors.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsCcmpDecryptErrors.setDescription("This object counts the total number of CCMP decryption failures observed in the data communication between this 802.11 station and the client indicated by cDot11WidsClientMacAddress since the client's association with this 802.11 station at the radio interface identified by ifIndex. ")
cDot11WidsTkipReplays = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 9), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsTkipReplays.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsTkipReplays.setDescription("This object counts the total number of TKIP replay failures observed in the data communication between this 802.11 station and the client indicated by cDot11WidsClientMacAddress since the client's association with this 802.11 station at the radio interface identified by ifIndex. ")
cDot11WidsWepReplays = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 10), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsWepReplays.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsWepReplays.setDescription("This object counts the total number of WEP Replay errors observed in the data communication between this 802.11 station and the client indicated by cDot11WidsClientMacAddress since the client's association with this 802.11 station at the radio interface identified by ifIndex. ")
cDot11WidsWepIcvErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 11), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsWepIcvErrors.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsWepIcvErrors.setDescription("This object counts the total number of WEP ICV errors observed in the data communication between this 802.11 station and the client indicated by cDot11WidsClientMacAddress since the client's association with this 802.11 station at the radio interface identified by ifIndex. ")
cDot11WidsCkipReplays = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 12), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsCkipReplays.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsCkipReplays.setDescription("This object counts the total number of CKIP replay errors observed in the data communication between this 802.11 station and the client indicated by cDot11WidsClientMacAddress since the client's association with this 802.11 station at the radio interface identified by ifIndex. ")
cDot11WidsCkipCmicErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 9, 9, 456, 1, 2, 1, 1, 13), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: cDot11WidsCkipCmicErrors.setStatus('current')
if mibBuilder.loadTexts: cDot11WidsCkipCmicErrors.setDescription("This object counts the total number of CKIP-CMIC errors observed in the data communication between this 802.11 station and the client indicated by cDot11WidsClientMacAddress since the client's association with this 802.11 station at the radio interface identified by ifIndex. ")
ciscoDot11WidsMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 9, 9, 456, 2, 1, 1)).setObjects(("CISCO-DOT11-WIDS-MIB", "ciscoDot11WidsAuthFailGroup"), ("CISCO-DOT11-WIDS-MIB", "ciscoDot11WidsProtectFailGroup"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDot11WidsMIBCompliance = ciscoDot11WidsMIBCompliance.setStatus('current')
if mibBuilder.loadTexts: ciscoDot11WidsMIBCompliance.setDescription('The compliance statement for the SNMP entities that implement the ciscoDot11WidsMIB module.')
ciscoDot11WidsAuthFailGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 456, 2, 2, 1)).setObjects(("CISCO-DOT11-WIDS-MIB", "cDot11WidsFloodDetectEnable"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsEapolFloodThreshold"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsEapolFloodInterval"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsBlackListThreshold"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsBlackListDuration"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsFloodMaxEntriesPerIntf"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsEapolFloodTotalCount"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsEapolFloodClientMac"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsEapolFloodClientCount"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsEapolFloodStartTime"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsEapolFloodStopTime"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsBlackListAttemptCount"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsBlackListTime"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDot11WidsAuthFailGroup = ciscoDot11WidsAuthFailGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDot11WidsAuthFailGroup.setDescription('This collection of objects provide information about configuration needed on the 802.11 station to detect the EAPOL flood attacks and black-list clients, the general statistics about the detected flood flood attacks and the information about the blacklisted clients. ')
ciscoDot11WidsProtectFailGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 9, 9, 456, 2, 2, 2)).setObjects(("CISCO-DOT11-WIDS-MIB", "cDot11WidsSelPairWiseCipher"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsTkipIcvErrors"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsTkipLocalMicFailures"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsTkipRemoteMicFailures"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsCcmpReplays"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsCcmpDecryptErrors"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsTkipReplays"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsWepReplays"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsWepIcvErrors"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsCkipReplays"), ("CISCO-DOT11-WIDS-MIB", "cDot11WidsCkipCmicErrors"))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
ciscoDot11WidsProtectFailGroup = ciscoDot11WidsProtectFailGroup.setStatus('current')
if mibBuilder.loadTexts: ciscoDot11WidsProtectFailGroup.setDescription("This collection of objects provide information about the various protection failures observed during the associated clients' data communications with this 802.11 station. ")
mibBuilder.exportSymbols("CISCO-DOT11-WIDS-MIB", cDot11WidsCkipReplays=cDot11WidsCkipReplays, cDot11WidsEapolFloodStopTime=cDot11WidsEapolFloodStopTime, ciscoDot11WidsProtectFailures=ciscoDot11WidsProtectFailures, cDot11WidsClientMacAddress=cDot11WidsClientMacAddress, cDot11WidsEapolFloodInterval=cDot11WidsEapolFloodInterval, cDot11WidsTkipReplays=cDot11WidsTkipReplays, cDot11WidsTkipRemoteMicFailures=cDot11WidsTkipRemoteMicFailures, cDot11WidsEapolFloodThreshold=cDot11WidsEapolFloodThreshold, ciscoDot11WidsMIBCompliance=ciscoDot11WidsMIBCompliance, cDot11WidsProtectFailClientTable=cDot11WidsProtectFailClientTable, cDot11WidsBlackListTable=cDot11WidsBlackListTable, ciscoDot11WidsAuthFailGroup=ciscoDot11WidsAuthFailGroup, ciscoDot11WidsMIBNotifs=ciscoDot11WidsMIBNotifs, cDot11WidsBlackListAttemptCount=cDot11WidsBlackListAttemptCount, cDot11WidsBlackListThreshold=cDot11WidsBlackListThreshold, cDot11WidsWepReplays=cDot11WidsWepReplays, ciscoDot11WidsMIBCompliances=ciscoDot11WidsMIBCompliances, cDot11WidsBlackListTime=cDot11WidsBlackListTime, ciscoDot11WidsMIB=ciscoDot11WidsMIB, cDot11WidsSsid=cDot11WidsSsid, cDot11WidsEapolFloodStartTime=cDot11WidsEapolFloodStartTime, cDot11WidsEapolFloodTable=cDot11WidsEapolFloodTable, ciscoDot11WidsMIBObjects=ciscoDot11WidsMIBObjects, ciscoDot11WidsProtectFailGroup=ciscoDot11WidsProtectFailGroup, cDot11WidsEapolFloodClientMac=cDot11WidsEapolFloodClientMac, cDot11WidsEapolFloodClientCount=cDot11WidsEapolFloodClientCount, cDot11WidsFloodMaxEntriesPerIntf=cDot11WidsFloodMaxEntriesPerIntf, cDot11WidsEapolFloodIndex=cDot11WidsEapolFloodIndex, ciscoDot11WidsAuthFailures=ciscoDot11WidsAuthFailures, cDot11WidsCcmpDecryptErrors=cDot11WidsCcmpDecryptErrors, cDot11WidsCkipCmicErrors=cDot11WidsCkipCmicErrors, cDot11WidsTkipIcvErrors=cDot11WidsTkipIcvErrors, cDot11WidsTkipLocalMicFailures=cDot11WidsTkipLocalMicFailures, cDot11WidsEapolFloodEntry=cDot11WidsEapolFloodEntry, cDot11WidsEapolFloodTotalCount=cDot11WidsEapolFloodTotalCount, cDot11WidsCcmpReplays=cDot11WidsCcmpReplays, cDot11WidsWepIcvErrors=cDot11WidsWepIcvErrors, ciscoDot11WidsMIBGroups=ciscoDot11WidsMIBGroups, cDot11WidsSelPairWiseCipher=cDot11WidsSelPairWiseCipher, cDot11WidsBlackListEntry=cDot11WidsBlackListEntry, PYSNMP_MODULE_ID=ciscoDot11WidsMIB, cDot11WidsBlackListDuration=cDot11WidsBlackListDuration, cDot11WidsProtectFailClientEntry=cDot11WidsProtectFailClientEntry, cDot11WidsFloodDetectEnable=cDot11WidsFloodDetectEnable, cDot11WidsBlackListClientMac=cDot11WidsBlackListClientMac, ciscoDot11WidsMIBConform=ciscoDot11WidsMIBConform)
|
SETTING_SERVER_CLOCK = "RAZBERRY_CLOCK"
SETTING_SERVER_TIME = "RAZBERRY_TIME"
SETTING_LAST_UPDATE = "LAST_UPDATED"
SETTING_SERVER_ADDRRESS = "RAZBERRY_SERVER"
SETTING_SERVICE_TIMEOUT = "SERVICE_TIMEOUT" |
# Example 1
i = 0
while i <= 10:
print(i)
i += 1
# Example 2
available_fruits = ["Apple", "Pearl", "Banana", "Grapes"]
chosen_fruit = ''
print("We have the following available fruits: Apple, Pearl, Banana, Grapes")
while chosen_fruit not in available_fruits:
chosen_fruit = input("Please choose one of the options above: ")
if chosen_fruit == "exit":
print("Good bye!")
break
else:
print("Enjoy your fruit!")
|
class PaymentError(Exception):
pass
class MpesaError(PaymentError):
pass
class InvalidTransactionAmount(MpesaError):
pass
|
def balancedStringSplit(self, s: str) -> int:
l, r = 0, 0
c = 0
for i in range(len(s)):
if s[i] == "L":
l += 1
if s[i] == "R":
r+=1
if l == r:
c+=1
return c |
def fail():
raise Exception("Ooops")
def main():
fail()
print("We will never reach here")
try:
main()
except Exception as exc:
print("Some kind of exception happened")
print(exc)
|
PREPROD_ENV = 'UAT'
PROD_ENV = 'PROD'
PREPROD_URL = "https://mercury-uat.phonepe.com"
PROD_URL = "https://mercury.phonepe.com"
URLS = {PREPROD_ENV:PREPROD_URL,PROD_ENV:PROD_URL} |
"""\
Bunch.py: Generic collection that can be accessed as a class. This can
be easily overrided and used as container for a variety of objects.
This program is part of the PyQuante quantum chemistry program suite
Copyright (c) 2004, Richard P. Muller. All Rights Reserved.
PyQuante version 1.2 and later is covered by the modified BSD
license. Please see the file LICENSE that is part of this
distribution.
"""
# Bunch is a generic object that can hold data. You can access it
# using object syntax: b.attr1, b.attr2, etc., which makes it simpler
# than a dictionary
class Bunch:
def __init__(self,**keyw):
for key in keyw.keys():
self.__dict__[key] = keyw[key]
return
|
class FanHealthStatus(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_fan_health_status(idx_name)
class FanHealthStatusColumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_fans()
|
# Time: O(26 * n)
# Space: O(26 * n)
class UnionFind(object): # Time: O(n * alpha(n)), Space: O(n)
def __init__(self, n):
self.set = range(n)
self.rank = [0]*n
self.size = [1]*n
self.total = n
def find_set(self, x):
stk = []
while self.set[x] != x: # path compression
stk.append(x)
x = self.set[x]
while stk:
self.set[stk.pop()] = x
return x
def union_set(self, x, y):
x, y = self.find_set(x), self.find_set(y)
if x == y:
return False
if self.rank[x] > self.rank[y]: # union by rank
x, y = y, x
self.set[x] = self.set[y]
if self.rank[x] == self.rank[y]:
self.rank[y] += 1
self.size[y] += self.size[x]
self.total -= 1
return True
# bitmasks, union find
class Solution(object):
def groupStrings(self, words):
"""
:type words: List[str]
:rtype: List[int]
"""
uf = UnionFind(len(words))
lookup = {}
for i, x in enumerate(words):
mask = reduce(lambda x, y: x|(1<<(ord(y)-ord('a'))), x, 0)
if mask not in lookup:
lookup[mask] = i
uf.union_set(i, lookup[mask])
bit = 1
while bit <= mask:
if mask&bit:
if mask^bit not in lookup:
lookup[mask^bit] = i
uf.union_set(i, lookup[mask^bit])
bit <<= 1
return [uf.total, max(uf.size)]
|
__all__ = ['authorize',
'config',
'interactive',
'process']
|
XM_OFF = 649.900675
YM_OFF = -25400.296854
ZM_OFF = 15786.311942
MM_00 = 0.990902
MM_01 = 0.006561
MM_02 = 0.006433
MM_10 = 0.006561
MM_11 = 0.978122
MM_12 = 0.006076
MM_20 = 0.006433
MM_21 = 0.006076
MM_22 = 0.914589
XA_OFF = 0.141424
YA_OFF = 0.380157
ZA_OFF = -0.192037
AC_00 = 100.154822
AC_01 = 0.327635
AC_02 = -0.321495
AC_10 = 0.327635
AC_11 = 102.504150
AC_12 = -1.708150
AC_20 = -0.321495
AC_21 = -1.708150
AC_22 = 103.199592
MFSTR = +43.33
|
# The mathematical modulo is used to calculate the remainder of the
# integer division. As an example, 102%25 is 2.
# Write a function that takes two values as parameters and returns
# the calculation of a modulo from the two values.
def mathematical_modulo(a, b):
''' divide a by b, return the remainder '''
return a % b
print('Divide 100 by 25, remainder is: ', mathematical_modulo(100, 25))
print('Divide 102 by 25, remainder is: ', mathematical_modulo(102, 25))
|
class CohereError(Exception):
def __init__(
self,
message=None,
http_status=None,
headers=None,
) -> None:
super(CohereError, self).__init__(message)
self.message = message
self.http_status = http_status
self.headers = headers or {}
def __str__(self) -> str:
msg = self.message or '<empty message>'
return msg
def __repr__(self) -> str:
return '%s(message=%r, http_status=%r, request_id=%r)' % (
self.__class__.__name__,
self.message,
self.http_status,
)
|
"""
:testcase_name record_metrics
:author Sriteja Kummita
:script_type class
:description Metrics contains the getters and setter for precision and recall. RecordMetrics uses these methods
to set and get the respective metrics.
"""
class Metrics:
def __init__(self):
self.precision = 0.0
self.recall = 0.0
def record_precision(self, p):
self.precision = p
def record_recall(self, r):
self.recall = r
def get_precision(self):
return self.precision
def get_recall(self):
return self.recall
class RecordMetrics:
def __init__(self):
self.m = Metrics()
def record(self, p, r):
self.m.record_precision(p)
self.m.record_recall(r)
def get_metrics(self):
return self.m
if __name__ == '__main__':
obj = RecordMetrics()
obj.record(10.0, 14.0)
|
"""
Default termsets for various languages
"""
# portuguese termset dictionary
pt = dict()
pseudo = [
'não mais',
'não é capaz de ser',
'não está certo se',
'não necessariamente',
'sem mais',
'sem dificuldade',
'talvez não',
'não só',
'sem aumento',
'sem alterações significativas',
'sem alterações',
'sem alterações definitivas',
'não alargar',
'não causa',
'não está certo se'
]
pt["pseudo_negations"] = pseudo
preceding = [
"inexistência de",
"ausência de",
'declinado',
'negado',
'nega',
'negação',
'nenhum sinal de',
'sem sinais de',
'não',
'não demonstrar',
'sintomas atípicos',
'dúvida',
'negativo para',
'sem',
'não faz isso.',
'não',
'não faças isso',
'não estava',
'não estavam',
'não é',
'não estão',
'não pode',
'não posso.',
'não pode',
'não podia',
'não foi possível',
'nunca'
]
pt["preceding_negations"] = preceding
following = [
'declinado',
'improvável',
'não foi',
'não foram',
'não estava',
'não estavam'
]
pt["following_negations"] = following
termination = [
'embora',
'com excepção de',
'tal como existem',
'para além de',
'mas',
'excepto',
'entretanto',
'que envolvem',
'apesar disso',
'ainda',
'apesar de',
'ainda'
]
pt["termination"] = termination
# pt_clinical builds upon en
pt_clinical = dict()
pseudo_clinical = pseudo + [
'negativo',
'não descartar',
'não excluído',
'não foram excluídos',
'não drenar',
'sem alterações suspeitas',
'sem alteração do intervalo',
'sem alteração significativa do intervalo',
]
pt_clinical["pseudo_negations"] = pseudo_clinical
preceding_clinical = preceding + [
'o paciente não foi',
'sem indicação de',
'sem sinal de',
'sem sinais de',
'sem quaisquer reacções ou sinais de',
'sem queixas de',
'não há provas de',
'nenhuma causa de',
'avaliar para',
'não consegue revelar',
'isentos de',
'nunca desenvolvidos',
'nunca tive',
'não expôs',
'exclui',
'descartar',
'descarta-o',
'descarte-a',
'descartar o paciente',
'descartar o paciente',
'excluídos',
'rejeitou-o rejeitou-a',
'doentes excluídos do tratamento',
'rejeitou o paciente',
]
pt_clinical["preceding_negations"] = preceding_clinical
following_clinical = following + ["foi descartado", "foram descartados", "livre"]
pt_clinical["following_negations"] = following_clinical
termination_clinical = termination + [
'causa de',
'causa de',
'causas de',
'causas de',
'etiologia para',
'etiologia da',
'origem para',
'Origem da',
'originárias para',
'originárias de',
'outras possibilidades de',
'razão para',
'razão de',
'Razões de',
'razões de',
'secundária a',
'fonte para',
'fontes para',
'fontes de',
'evento de desencadeamento para',
]
pt_clinical["termination"] = termination_clinical
pt_clinical_sensitive = dict()
preceding_clinical_sensitive = preceding_clinical + [
'preocupação com',
'suposto',
'que causam',
'leva a',
'h/o',
'histórico de',
'em vez de',
'se sentir',
'se tiver',
'ensino do paciente',
'ensinou ao paciente',
'ensinar ao paciente',
'educado o paciente',
'educar o paciente',
'monitorizado para',
'monitorar para',
'ensaio de',
'ensaios para',
]
pt_clinical_sensitive["pseudo_negations"] = pseudo_clinical
pt_clinical_sensitive["preceding_negations"] = preceding_clinical_sensitive
pt_clinical_sensitive["following_negations"] = following_clinical
pt_clinical_sensitive["termination"] = termination_clinical
LANGUAGES = dict()
LANGUAGES["pt"] = pt
LANGUAGES["pt_clinical"] = pt_clinical
LANGUAGES["pt_clinical_sensitive"] = pt_clinical_sensitive
|
#
# PySNMP MIB module WWP-LEOS-PORT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-PORT-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:38:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)
#
Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
ConstraintsIntersection, ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ValueSizeConstraint")
dot3adAggPortListPorts, dot3adAggPortActorAdminKey = mibBuilder.importSymbols("IEEE8023-LAG-MIB", "dot3adAggPortListPorts", "dot3adAggPortActorAdminKey")
NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance")
sysName, sysLocation = mibBuilder.importSymbols("SNMPv2-MIB", "sysName", "sysLocation")
ObjectIdentity, IpAddress, Unsigned32, MibIdentifier, Bits, ModuleIdentity, Counter64, TimeTicks, Counter32, iso, Gauge32, Integer32, NotificationType, MibScalar, MibTable, MibTableRow, MibTableColumn = mibBuilder.importSymbols("SNMPv2-SMI", "ObjectIdentity", "IpAddress", "Unsigned32", "MibIdentifier", "Bits", "ModuleIdentity", "Counter64", "TimeTicks", "Counter32", "iso", "Gauge32", "Integer32", "NotificationType", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn")
RowStatus, TruthValue, MacAddress, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TruthValue", "MacAddress", "DisplayString", "TextualConvention")
wwpModulesLeos, wwpModules = mibBuilder.importSymbols("WWP-SMI", "wwpModulesLeos", "wwpModules")
wwpLeosPortMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2))
wwpLeosPortMIB.setRevisions(('2012-05-25 00:00', '2011-02-02 00:00', '2010-11-01 00:00', '2010-07-28 00:00', '2010-05-05 17:00', '2008-11-14 00:00', '2008-07-21 00:00', '2007-08-11 00:00', '2007-06-20 00:00', '2006-05-26 00:00', '2006-05-18 00:00', '2006-03-15 00:00', '2005-07-28 00:00', '2004-04-18 17:00',))
if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0):
if mibBuilder.loadTexts: wwpLeosPortMIB.setRevisionsDescriptions(('Added wwpLeosEtherPortAdvertSpeed and wwpLeosEtherPortAdvertDuplex to WwpLeosEtherPortEntry MIB object', 'Added admitOnlyUntagged to wwpLeosEtherPortAcceptableFrameTypes MIB object', 'Added wwpLeosEtherPortEgressCosPolicy', 'Added wwpLeosEtherFixedRColor and wwpLeosEtherPortFrameCosMapId mib objects', 'Added changed length of wwpLeosPortDescr from 32 to 128.', 'Added wwpLeosEtherPortEgressPortQueueMapId to wwpLeosEtherPortEntryTable. Added 10 gig option to wwpLeosEtherInterfaceType, wwpLeosEtherAdminSpeed and wwpLeosEtherOperSpeed', 'Added wwpLeosEtherPortResolvedCosPolicy,wwpLeosEtherPortMode and wwpLeosEtherFixedRcos mib objects', 'Added new mib object wwpLeosEtherPortStateMirrorGroupType.', 'Added new mib object wwpLeosEtherPortUntagDataVid.', 'Added new mib object wwpLeosEtherPortOperAutoNeg.', 'Added new mib object wwpLeosEtherPortStateMirrorGroupOperStatus. Added new mib object wwpLeosEtherPortStateMirrorGroupNumSrcPorts. Added new mib object wwpLeosEtherPortStateMirrorGroupNumDstPorts. Added new mib object wwpLeosEtherPortStateMirrorGroupMemOperState.', 'This MIB module is for the Extension of the dot1dBasePortTable for WWP Products', 'Added eumeration to wwpLeosEtherPortAdminSpeed.', 'Added new tables to support port state mirroring feature.',))
if mibBuilder.loadTexts: wwpLeosPortMIB.setLastUpdated('201205250000Z')
if mibBuilder.loadTexts: wwpLeosPortMIB.setOrganization('Ciena, Inc')
if mibBuilder.loadTexts: wwpLeosPortMIB.setContactInfo('Mib Meister 115 North Sullivan Road Spokane Valley, WA 99037 USA Phone: +1 509 242 9000 Email: support@ciena.com')
if mibBuilder.loadTexts: wwpLeosPortMIB.setDescription('This MIB defines the managed objects for Ethernet ports.')
class PortList(TextualConvention, OctetString):
description = "Each octet within this value specifies a set of eight ports, with the first octet specifying ports 1 through 8, the second octet specifying ports 9 through 16, etc. Within each octet, the most significant bit represents the lowest numbered port, and the least significant bit represents the highest numbered port. Thus, each port of the bridge is represented by a single bit within the value of this object. If that bit has a value of '1' then that port is included in the set of ports; the port is not included if its bit has a value of '0'."
status = 'current'
subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(0, 255)
class PortEgressFrameCosPolicy(TextualConvention, Integer32):
description = 'Egress cos policy to use on this port ignore means leave egress map disabled'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("ingore", 1), ("rcosToL2OuterPcpMap", 2))
class PortIngressFixedColor(TextualConvention, Integer32):
description = 'Egress cos policy to use on this port ignore means leave egress map disabled'
status = 'current'
subtypeSpec = Integer32.subtypeSpec + ConstraintsUnion(SingleValueConstraint(1, 2))
namedValues = NamedValues(("green", 1), ("yellow", 2))
wwpLeosPortMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1))
wwpLeosEtherPort = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1))
wwpLeosEtherPortNotif = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 2))
wwpLeosPortMIBNotificationPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2))
wwpLeosPortMIBNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0))
wwpLeosPortMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 3))
wwpLeosPortMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 3, 1))
wwpLeosPortMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 3, 2))
wwpLeosEtherPortTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1), )
if mibBuilder.loadTexts: wwpLeosEtherPortTable.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortTable.setDescription('Table of Ethernet Ports.')
wwpLeosEtherPortEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1), ).setIndexNames((0, "WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"))
if mibBuilder.loadTexts: wwpLeosEtherPortEntry.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortEntry.setDescription('Port Entry in the Ethernet Port Table.')
wwpLeosEtherPortId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortId.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortId.setDescription("Port ID for the instance. Port ID's start at 1, and may not be consecutive for each additional port. This port Id should refer to the dot1dBasePort in the Dot1dBasePortEntry.")
wwpLeosEtherPortName = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 8))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortName.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortName.setDescription('A textual string containing information about the port. This string should indicate about the physical location of the port as well.')
wwpLeosEtherPortDesc = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortDesc.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortDesc.setDescription('A textual string containing port description.')
wwpLeosEtherPortType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("ethernet", 1), ("fastEthernet", 2), ("hundredFx", 3), ("gigEthernet", 4), ("lagPort", 5), ("unknown", 6), ("gigHundredFx", 7), ("tripleSpeed", 8), ("tenGigEthernet", 9), ("gigTenGigEthernet", 10)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortType.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortType.setDescription('The port type for the port.')
wwpLeosEtherPortPhysAddr = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 5), MacAddress()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortPhysAddr.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortPhysAddr.setDescription('The ethernet MAC address for the port. This information can also be achieved via dot1dTpFdbTable')
wwpLeosEtherPortAutoNeg = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 6), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortAutoNeg.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortAutoNeg.setDescription('The object sets the port to AUTO NEG MOde and vice versa. Specific platforms may have requirements of configuring speed before moving the port to out of AUTO-NEG mode.')
wwpLeosEtherPortAdminStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("up", 1), ("down", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortAdminStatus.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortAdminStatus.setDescription('The desired state of the port.')
wwpLeosEtherPortOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("notauth", 3), ("lbtx", 4), ("lbrx", 5), ("linkflap", 6)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortOperStatus.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortOperStatus.setDescription('The current operational state of Port.')
wwpLeosEtherPortAdminSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("tenMb", 1), ("hundredMb", 2), ("gig", 3), ("auto", 4), ("tenGig", 5)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortAdminSpeed.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortAdminSpeed.setDescription('Desired speed of the port. Set the port speed to be either 10MB, 100MB, or gig. Set the port speed to auto to enable automatic port speed detection. The default value for this object depends upon the platform.')
wwpLeosEtherPortOperSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4))).clone(namedValues=NamedValues(("unknown", 0), ("tenMb", 1), ("hundredMb", 2), ("gig", 3), ("tenGig", 4)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortOperSpeed.setStatus('deprecated')
if mibBuilder.loadTexts: wwpLeosEtherPortOperSpeed.setDescription('The current operational speed of the port.')
wwpLeosEtherPortAdminDuplex = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("half", 1), ("full", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortAdminDuplex.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortAdminDuplex.setDescription('The desired mode for the port. It can be set to either half or full duplex operation. The default value for this object depends upon the platform.')
wwpLeosEtherPortOperDuplex = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("half", 1), ("full", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortOperDuplex.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortOperDuplex.setDescription('The current duplex mode of the port.')
wwpLeosEtherPortAdminFlowCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("off", 2), ("asymTx", 3), ("asymRx", 4), ("sym", 5)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortAdminFlowCtrl.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortAdminFlowCtrl.setDescription('Configures the ports flow control operation.')
wwpLeosEtherPortOperFlowCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 14), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("off", 2), ("asymTx", 3), ("asymRx", 4), ("sym", 5)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortOperFlowCtrl.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortOperFlowCtrl.setDescription('Shows ports flow control configuration.')
wwpLeosEtherIngressPvid = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 24576)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherIngressPvid.setReference('IEEE 802.1Q/D11 Section 12.10.1.1')
if mibBuilder.loadTexts: wwpLeosEtherIngressPvid.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherIngressPvid.setDescription('The Ingress PVID, the VLAN ID associated with untagged frames ingressing the port or if tunnel is enabled on this port. The max value for this object is platform dependent. Refer to architecture document for details of platform dependency.')
wwpLeosEtherUntagEgressVlanId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 24576))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherUntagEgressVlanId.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherUntagEgressVlanId.setDescription('All the egress frames whose VLAN id matches the wwpLeosEtherUntagEgressVlanId, will egress the port as untagged. To egress the frames tagged set wwpLeosEtherUntagEgressVlanId to 0. The max value for this object is platform dependent. Refer to architecture document for details of platform dependency.')
wwpLeosEtherPortAcceptableFrameTypes = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("admitAll", 1), ("admitOnlyVlanTagged", 2), ("admitOnlyUntagged", 3))).clone('admitAll')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortAcceptableFrameTypes.setReference('IEEE 802.1Q/D11 Section 12.10.1.3')
if mibBuilder.loadTexts: wwpLeosEtherPortAcceptableFrameTypes.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortAcceptableFrameTypes.setDescription('When this is admitOnlyVlanTagged(2) the device will discard untagged frames or Priority-Tagged frames received on this port. When admitOnlyUntagged(3) is set, the device will discard VLAN tagged frames received on this port. With admitOnlyUntagged(3) and admitAll(1), untagged frames or Priority-Tagged frames received on this port will be accepted and assigned to the PVID for this port. This control does not affect VLAN independent BPDU frames, such as GVRP and STP. It does affect VLAN dependent BPDU frames, such as GMRP.')
wwpLeosEtherPortUntaggedPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("p0", 0), ("p1", 1), ("p2", 2), ("p3", 3), ("p4", 4), ("p5", 5), ("p6", 6), ("p7", 7)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortUntaggedPriority.setStatus('deprecated')
if mibBuilder.loadTexts: wwpLeosEtherPortUntaggedPriority.setDescription('The 802.1p packet priority to be assigned to packets ingressing this port that do not have an 802.1Q VLAN header. This priority is also assigned to ingress frame if tunnel is enabled on this port.')
wwpLeosEtherPortMaxFrameSize = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1522, 9216))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortMaxFrameSize.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortMaxFrameSize.setDescription('Setting this object will set the max frame size allowed on a port. The max frame size can vary from 1522 bytes to 9216 bytes. Default value is 1526 bytes.')
wwpLeosEtherPortVlanIngressFiltering = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 20), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortVlanIngressFiltering.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortVlanIngressFiltering.setDescription('When this is true(1) the device will discard incoming frames for VLANs which do not include this Port in its Member set. When false(2), the port will accept all incoming frames.')
wwpLeosEtherPortAdminAdvertisedFlowCtrl = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("unknown", 1), ("off", 2), ("asymTx", 3), ("sym", 4), ("symAsymRx", 5)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortAdminAdvertisedFlowCtrl.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortAdminAdvertisedFlowCtrl.setDescription('This object specifies the advertised flow control for given port.')
wwpLeosEtherPortVplsPortType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("notDefined", 1), ("subscriber", 2), ("networkFacing", 3)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortVplsPortType.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortVplsPortType.setDescription('This object specifies whether port is in subscriber type, network facing side or both. ')
wwpLeosEtherPortIngressCosPolicy = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 23), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("leave", 1), ("fixed", 2), ("ippInherit", 3), ("phbgInherit", 4)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortIngressCosPolicy.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortIngressCosPolicy.setDescription('This object specifies the ingress cos policy to be applied to all frames coming in on the given port.')
wwpLeosEtherPortIngressFixedDot1dPri = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 24), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortIngressFixedDot1dPri.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortIngressFixedDot1dPri.setDescription("The 802.1p packet priority to be assigned to packets ingressing this port that do not have an 802.1Q VLAN header. This priority is also assigned to ingress untagged frame if the virtual switch cos policy is set to 'fix' for a given port.")
wwpLeosEtherPortUntagDataVsi = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVsi.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVsi.setDescription('This object specifies the virtual switch to be used for this port if data frame is untagged. If this object is set to 0 then device will unset this object. When setting this object to Mpls Vsi Index then wwpLeosEtherPortUntagDataVsiType must also be set to mpls (Use multiple set operation)')
wwpLeosEtherPortOperationalSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 26), Gauge32()).setUnits('kbps').setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortOperationalSpeed.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortOperationalSpeed.setDescription("An estimate of the port's current bandwidth in k-bits per second for given port.")
wwpLeosEtherPortUntagCtrlVsi = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 27), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortUntagCtrlVsi.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortUntagCtrlVsi.setDescription('This object specifies the virtual switch to be used for this port if control frame is untagged. If this object is set to 0 then device will unset this object. When setting this object to Mpls Vsi Index then wwpLeosEtherPortUntagCtrlVsiType must also be set to mpls (Use multiple set operation)')
wwpLeosEtherPortMirrorPort = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 28), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortMirrorPort.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortMirrorPort.setDescription('This object defines whether the port will allow traffic from other ports to be mirrored to this port. To allow traffic from other ports to be sent to this port, set this object to True(1). This port is known as a mirror port. If set to true, then other ports may set the values of their wwpLeosEtherPortMirrorIngress or wwpLeosEtherPortMirrorEgress objects to the port index of this port. Setting this object to false(2) disables this port as a mirror port.')
wwpLeosEtherPortMirrorIngress = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 29), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortMirrorIngress.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortMirrorIngress.setDescription("The value of this object is the port index of a mirror port. The ingress traffic of this port can be mirrored by setting the destination port's wwpLeosEtherPortMirrorPort object to true. If the value of this object is set to zero this port's ingress traffic will not be mirrored.")
wwpLeosEtherPortMirrorEgress = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 30), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEgress.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEgress.setDescription("The value of this object is the port index of a mirror port. The egress traffic of this port can be mirrored by setting the destination port's wwpLeosEtherPortMirrorPort object to true. If the value of this object is set to zero this port's egress traffic will not be mirrored.")
wwpLeosEtherPortUntagDataVsiType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ethernet", 1), ("mpls", 2))).clone('ethernet')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVsiType.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVsiType.setDescription('This object specifies the virtual switch instance type associated with this port. This object defaults to ethernet and specifies if wwpLeosEtherPortUntagDataVsi belongs to ethernet virtual switch table (wwpLeosVplsVirtualSwitchEthTable in WWP-LEOS-VPLS-MIB) or mpls virtual switch table (wwpLeosVplsVirtualSwitchMplsTable in WWP-LEOS-VPLS-MIB). When setting wwpLeosEtherPortUntagDataVsi to MPLS Vsi Index then this object must also be set to mpls (Use mutliple set operation).')
wwpLeosEtherPortUntagCtrlVsiType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ethernet", 1), ("mpls", 2))).clone('ethernet')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortUntagCtrlVsiType.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortUntagCtrlVsiType.setDescription('This object specifies the virtual switch instance type associated with this port. This object defaults to ethernet and specifies if wwpLeosEtherPortUntagCtrlVsi belongs to ethernet virtual switch table (wwpLeosVplsVirtualSwitchEthTable) or mpls virtual switch table (wwpLeosVplsVirtualSwitchMplsTable). When setting wwpLeosEtherPortUntagCtrlVsi to MPLS Vsi Index then this object must also be set to mpls (Use mutliple set operation)')
wwpLeosEtherPortVsIngressFiltering = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 33), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortVsIngressFiltering.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortVsIngressFiltering.setDescription('This item is applicable to this port when the port is added as a per-port member to a virtual switch. If true(1) the device will discard incoming tagged frames. If false(2) the device will forwared incoming tagged frames so long as those customer tagged frames do not match another virtual switch with this port included as a per-port-per-vlan member.')
wwpLeosEtherPortOperAutoNeg = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 34), TruthValue()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortOperAutoNeg.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortOperAutoNeg.setDescription('The object specifies the operational auto neg state.')
wwpLeosEtherPortUpTime = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 35), TimeTicks()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortUpTime.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortUpTime.setDescription('The object specifies the port up time in hundredths of a second.')
wwpLeosEtherPortUntagDataVid = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 36), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 24576)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVid.setReference('IEEE 802.1Q/D11 Section 12.10.1.1')
if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVid.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortUntagDataVid.setDescription('The Ingress Untagged Data Vid, the VLAN ID stamped on untagged frames ingressing the port or if tunnel is enabled on this port. To disable tagging of untagged data on ingress write a value of 0. The max value for this object is platform dependent. Refer to architecture document for details of platform dependency.')
wwpLeosEtherPortPhyLoopback = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 37), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortPhyLoopback.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortPhyLoopback.setDescription('This object defines whether the phy has been placed in loopback mode, which causes frames egressing the port to be looped back to the port.')
wwpLeosEtherPortVlanIngressFilterStrict = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 38), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortVlanIngressFilterStrict.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortVlanIngressFilterStrict.setDescription('This item is applicable to this port when the port is added as a to a virtual switch. If true(1) the legacy ingress filter behavior will be enforced at member addition (drop bit will be set to drop untagged traffic). If false, the splat bit will not be changed. Note that external VLAN associations are also maintained when strict is false.')
wwpLeosEtherPortMacSaDaSwap = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 39), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortMacSaDaSwap.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortMacSaDaSwap.setDescription('This object defines whether the MAC SA and DA will be swapped on frames egressing the port. This only works on a 311V.')
wwpLeosEtherPortMacSaDaSwapVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 40), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 24576))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortMacSaDaSwapVlan.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortMacSaDaSwapVlan.setDescription('This object defines whether the MAC SA and DA will be swapped on specific VLAN frames egressing the port. This only works on a 311V.')
wwpLeosEtherPortResolvedCosPolicy = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 41), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 99))).clone(namedValues=NamedValues(("dot1d", 1), ("l3DscpCos", 2), ("fixedCos", 3), ("unknown", 99)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosPolicy.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosPolicy.setDescription(' The Resolved Cost Policy. Setting this attribute is not supported in leos version 4')
wwpLeosEtherPortMode = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 42), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 99))).clone(namedValues=NamedValues(("rj45", 1), ("sfp", 2), ("default", 3), ("unknown", 99)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortMode.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortMode.setDescription('The mode of the port Setting this attribute is not supported in leos version 4')
wwpLeosEtherFixedRcos = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 43), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherFixedRcos.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherFixedRcos.setDescription('The fixed Resolve Cost value. Setting this attribute is not supported in leos version 4')
wwpLeosEtherPortEgressPortQueueMapId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 44), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortEgressPortQueueMapId.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortEgressPortQueueMapId.setDescription('The Egress-port-Queue associated with this port. Setting this attribute is not supported in leos version 4')
wwpLeosEtherPortResolvedCosMapId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 45), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosMapId.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosMapId.setDescription('RCOS map id for the port. Setting this attribute is not supported in leos version 4')
wwpLeosEtherPortResolvedCosRemarkL2 = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 46), TruthValue()).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosRemarkL2.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortResolvedCosRemarkL2.setDescription('The object specifies whether to remark L2 based on L3. This applies when the resolved cos policy is either l3-dscp-cos or dot1d-tag1-cos but not when it is fixed-cos policy. Setting this attribute is not supported in leos version 4')
wwpLeosEtherPortL2TransformMode = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 47), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1, 2, 3))).clone(namedValues=NamedValues(("none", 0), ("iPush-e-Pop", 1), ("iStamp-Push-e-QualifiedPopStamp", 2), ("iPush-e-PopStamp", 3))).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortL2TransformMode.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortL2TransformMode.setDescription('L2 transform action for port. Setting this attribute is not supported in leos version 4')
wwpLeosEtherPortLinkFlapDetection = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 48), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapDetection.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapDetection.setDescription('This object defines whether link flap detection will be enabled on the port.')
wwpLeosEtherPortLinkFlapCount = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 49), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 64)).clone(5)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapCount.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapCount.setDescription('This object defines how many link down events are required to trigger a link flap event.')
wwpLeosEtherPortLinkFlapDetectTime = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 50), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 600)).clone(10)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapDetectTime.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapDetectTime.setDescription('This object defines the time in seconds during which link down events are accumlated to trigger a link flap event.')
wwpLeosEtherPortLinkFlapHoldTime = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 51), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 600)).clone(300)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapHoldTime.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortLinkFlapHoldTime.setDescription('This object defines the time in seconds that a port will be operationally disabled after a link flap event, before it is re-enabled. A value of zero causes the port to remain disabled until manually enabled.')
wwpLeosEtherFixedRColor = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 52), PortIngressFixedColor().clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherFixedRColor.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherFixedRColor.setDescription('This sets the fixed color to green (default) or yellow. Setting this attribute is not supported in saos version 4')
wwpLeosEtherPortFrameCosMapId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 53), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortFrameCosMapId.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortFrameCosMapId.setDescription('Frame COS map id for the port. Setting this attribute is not supported in leos version 4')
wwpLeosEtherPortEgressCosPolicy = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 54), PortEgressFrameCosPolicy().clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortEgressCosPolicy.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortEgressCosPolicy.setDescription('Sets the egress frame cos policy Setting this attribute is not supported in leos version 4')
wwpLeosEtherPortEgressSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 55), Gauge32()).setUnits('kbps').setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortEgressSpeed.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortEgressSpeed.setDescription("An estimate of the port's current egress bandwidth restriction in k-bits per second for given port. A value of 0 means there is no active restriction. This attribute not supported in leos version 6")
wwpLeosEtherPortAdaptiveRateSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 56), Gauge32()).setUnits('kbps').setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortAdaptiveRateSpeed.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortAdaptiveRateSpeed.setDescription("An estimate of the port's current adaptive-rate bandwidth restriction in k-bits per second for given port. A value of 0 means there is no active restriction. This attribute not supported in leos version 6")
wwpLeosEtherPortMirrorEncap = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 57), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(0, 1))).clone(namedValues=NamedValues(("none", 0), ("vlanTag", 1))).clone('none')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncap.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncap.setDescription('This object defines whether the port will encapsulate mirrored frames by adding a vlan-tag. (Or, in the case where a mirrored frame is already tagged, by adding a further vlan-tag to the frame) To allow mirrored traffic to be encapsulated, set this object to vlan-tag(1). If set to vlan-tag, then the values of wwpLeosEtherPortMirrorEncapVid and wwpLeosEtherPortMirrorEncapTpid will be used to populate tag added to each mirrored frame. Setting this object to none(0) indicates no tag is to be added to the mirrored frames.')
wwpLeosEtherPortMirrorEncapVid = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 58), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 24576)).clone(1)).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncapVid.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncapVid.setDescription('This object defines the VID that will be added to mirrored frames when the mirroring encapsulation mode is vlan-tag')
wwpLeosEtherPortMirrorEncapTpid = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 59), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("tpid8100", 1), ("tpid9100", 2), ("tpid88A8", 3))).clone('tpid8100')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncapTpid.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortMirrorEncapTpid.setDescription('This object defines the tpid used in the tag that is added to mirrored frames, when the mirroring encapsulation mode is vlan-tag')
wwpLeosEtherPortIfgDecrease = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 60), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 5))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortIfgDecrease.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortIfgDecrease.setDescription('This object defines the number of bytes that will be subtracted from the minimum standard IFG of 12 bytes as defined in IEEE 802.3. SAOS 6.x only supports a value of 0 or 4.')
wwpLeosEtherPortAdvertSpeed = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 61), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("not-applicable", 1), ("ten", 2), ("hundred", 3), ("gigabit", 4), ("ten-hundred-gigabit", 5))).clone('ten-hundred-gigabit')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortAdvertSpeed.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortAdvertSpeed.setDescription('This object defines the speed capabilities that will be advertised during the auto-negotiation process.')
wwpLeosEtherPortAdvertDuplex = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 1, 1, 62), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("not-applicable", 1), ("half", 2), ("full", 3), ("half-full", 4))).clone('half-full')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortAdvertDuplex.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortAdvertDuplex.setDescription('This object defines the duplex capabilities that will be advertised during the auto-negotiation process.')
wwpLeosEtherPortFlushTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 2), )
if mibBuilder.loadTexts: wwpLeosEtherPortFlushTable.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortFlushTable.setDescription('Table of port flush entries.')
wwpLeosEtherPortFlushEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 2, 1), ).setIndexNames((0, "WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"))
if mibBuilder.loadTexts: wwpLeosEtherPortFlushEntry.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortFlushEntry.setDescription('Broadcast containment port entry in the Ethernet Port Table.')
wwpLeosEtherPortFlushActivate = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 2, 1, 1), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortFlushActivate.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortFlushActivate.setDescription("Setting this object to 'true' will cause the Macs to be flushed for the port specified by wwpLeosEtherPortId.")
wwpLeosEtherPortTrapsTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 3), )
if mibBuilder.loadTexts: wwpLeosEtherPortTrapsTable.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortTrapsTable.setDescription('Table of Ethernet Ports Traps.')
wwpLeosEtherPortTrapsEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 3, 1), ).setIndexNames((0, "WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"))
if mibBuilder.loadTexts: wwpLeosEtherPortTrapsEntry.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortTrapsEntry.setDescription('Port Traps Entry in the Ethernet Port Trap Table.')
wwpLeosEtherPortTrapsState = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disable", 1), ("enable", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortTrapsState.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortTrapsState.setDescription('Setting this object will enable or disable all traps on given port.')
wwpLeosEtherPortStateMirrorGroupTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4), )
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupTable.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupTable.setDescription('This table can be used to keep track of all the port state mirror groups. To create entry in this table along with indexes following mib objects must be set using multiple set operation wwpLeosEtherPortStateMirrorGroupName must be valid string. wwpLeosEtherPortStateMirrorGroupStatus must be set.')
wwpLeosEtherPortStateMirrorGroupEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1), ).setIndexNames((0, "WWP-LEOS-PORT-MIB", "wwpLeosEtherPortStateMirrorGroupId"))
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupEntry.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupEntry.setDescription('Each entry in this table will define the port state mirror group.')
wwpLeosEtherPortStateMirrorGroupId = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupId.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupId.setDescription('This mib object is used as index in the table and is used to identify the unique group id.')
wwpLeosEtherPortStateMirrorGroupName = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 15))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupName.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupName.setDescription('This mib object is used to specify the name of the group.')
wwpLeosEtherPortStateMirrorGroupOperStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupOperStatus.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupOperStatus.setDescription('This mib object is used to specify the operational status of the group.')
wwpLeosEtherPortStateMirrorGroupNumSrcPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 4), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupNumSrcPorts.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupNumSrcPorts.setDescription('This mib object is used to specify the total number of source ports that exists in the group.')
wwpLeosEtherPortStateMirrorGroupNumDstPorts = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 5), Counter32()).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupNumDstPorts.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupNumDstPorts.setDescription('This mib object is used to specify the total number of destination ports that exists in the group.')
wwpLeosEtherPortStateMirrorGroupStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 6), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupStatus.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupStatus.setDescription('Used to manage the creation and deletion of the conceptual rows in this table.')
wwpLeosEtherPortStateMirrorGroupType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 4, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("unidirectional", 1), ("bidirectional", 2)))).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupType.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupType.setDescription("This mib object is used to specify the directional mode type for the port state mirror group. A uni-directional(1) mirror group type will only mirror the port state of the source port(s) to the destination port(s). The bi-directional(2) mirror group type will mirror state of either the source port(s) to the destination port(s) or the state of the destination port(s) will be mirrored to the source port(s). Where there are more than one source or destination ports the combined state of the source or destination group will be the combined 'OR'ed status of all the ports in either the source or destination groups. In other words, if one or more source ports is 'UP' then the source group is 'UP' and the mirrored destination state may be 'UP'. The default for this object type is uni-directional.")
wwpLeosEtherPortStateMirrorGroupMemTable = MibTable((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5), )
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemTable.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemTable.setDescription('This table is used to keep track of port group membership.')
wwpLeosEtherPortStateMirrorGroupMemEntry = MibTableRow((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5, 1), ).setIndexNames((0, "WWP-LEOS-PORT-MIB", "wwpLeosEtherPortStateMirrorGroupId"), (0, "WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"))
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemEntry.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemEntry.setDescription('Each entry in this table is used to represent the membership of port to a given group and group type.')
wwpLeosEtherPortStateMirrorGroupMemType = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("srcPort", 1), ("dstPort", 2))).clone('srcPort')).setMaxAccess("readcreate")
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemType.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemType.setDescription('Setting this object will specify the type of group this port is member of for a given port state mirror group. This object can only be set while creating the entry. This object cannot be modified once entry is created.')
wwpLeosEtherPortStateMirrorGroupMemOperState = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("disabled", 1), ("enabled", 2)))).setMaxAccess("readonly")
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemOperState.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemOperState.setDescription('This mib object is used to specify the operational status of the port.')
wwpLeosEtherPortStateMirrorGroupMemStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 1, 5, 1, 3), RowStatus()).setMaxAccess("readcreate")
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemStatus.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortStateMirrorGroupMemStatus.setDescription('Used to manage the creation and deletion of the conceptual rows in this table.')
wwpLeosEtherStndLinkUpDownTrapsEnable = MibScalar((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 2, 1), TruthValue().clone('true')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherStndLinkUpDownTrapsEnable.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherStndLinkUpDownTrapsEnable.setDescription("Setting this object to 'false(2)' will cause standard Link Up Down Traps to be suppressed.")
wwpLeosEtherPortLinkUpDownTrapsEnable = MibScalar((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 2, 2), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherPortLinkUpDownTrapsEnable.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherPortLinkUpDownTrapsEnable.setDescription("Setting this object to 'true(1)' will cause wwp specific port up down trap to be generated.")
wwpLeosEtherAggPortLinkUpDownTrapsEnable = MibScalar((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 1, 2, 3), TruthValue().clone('false')).setMaxAccess("readwrite")
if mibBuilder.loadTexts: wwpLeosEtherAggPortLinkUpDownTrapsEnable.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEtherAggPortLinkUpDownTrapsEnable.setDescription("Setting this object to 'true(1)' will cause wwp specific agg port up down trap to be generated for a link state change on a physical port that is a member of a agg.")
wwpLeosEthLinkUp = NotificationType((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 3)).setObjects(("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortName"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortType"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortAdminStatus"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortOperStatus"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortDesc"))
if mibBuilder.loadTexts: wwpLeosEthLinkUp.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEthLinkUp.setDescription('A wwpLeosEthLinkUp trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links has entered the up state.')
wwpLeosEthLinkDown = NotificationType((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 4)).setObjects(("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortType"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortName"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortAdminStatus"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortOperStatus"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortDesc"))
if mibBuilder.loadTexts: wwpLeosEthLinkDown.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEthLinkDown.setDescription('A wwpLeosEthLinkDown trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links has entered the down state.')
wwpLeosEthAdminSpeedIncompatible = NotificationType((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 5)).setObjects(("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"))
if mibBuilder.loadTexts: wwpLeosEthAdminSpeedIncompatible.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEthAdminSpeedIncompatible.setDescription("A wwpLeosEthAdminSpeedIncompatible trap is generated when the port administrative speed doesn't match the speed of the SFP transceiver installed.")
wwpLeosEthLinkFlap = NotificationType((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 6)).setObjects(("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortType"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortName"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortOperStatus"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortDesc"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortLinkFlapHoldTime"))
if mibBuilder.loadTexts: wwpLeosEthLinkFlap.setStatus('current')
if mibBuilder.loadTexts: wwpLeosEthLinkFlap.setDescription('A wwpLeosEthLinkFlap trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links has been changed due to link flap detection.')
wwpLeosAggLinkUpDown = NotificationType((1, 3, 6, 1, 4, 1, 6141, 2, 60, 2, 2, 0, 7)).setObjects(("SNMPv2-MIB", "sysName"), ("SNMPv2-MIB", "sysLocation"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortId"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortName"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortDesc"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortType"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortAdminStatus"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortOperStatus"), ("IEEE8023-LAG-MIB", "dot3adAggPortActorAdminKey"), ("IEEE8023-LAG-MIB", "dot3adAggPortListPorts"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortName"), ("WWP-LEOS-PORT-MIB", "wwpLeosEtherPortDesc"))
if mibBuilder.loadTexts: wwpLeosAggLinkUpDown.setStatus('current')
if mibBuilder.loadTexts: wwpLeosAggLinkUpDown.setDescription('A wwpLeosAggLinkUpDown trap signifies that the SNMP entity, acting in an agent role, has detected that the ifOperStatus object for one of its communication links has changed state.')
mibBuilder.exportSymbols("WWP-LEOS-PORT-MIB", wwpLeosEthLinkDown=wwpLeosEthLinkDown, wwpLeosEtherPortUntagCtrlVsi=wwpLeosEtherPortUntagCtrlVsi, wwpLeosEtherPortOperFlowCtrl=wwpLeosEtherPortOperFlowCtrl, wwpLeosEtherPortUntagDataVid=wwpLeosEtherPortUntagDataVid, wwpLeosEtherPortStateMirrorGroupMemStatus=wwpLeosEtherPortStateMirrorGroupMemStatus, wwpLeosEtherPortUntaggedPriority=wwpLeosEtherPortUntaggedPriority, wwpLeosEtherPortEntry=wwpLeosEtherPortEntry, wwpLeosEtherFixedRcos=wwpLeosEtherFixedRcos, wwpLeosEtherPortAdvertSpeed=wwpLeosEtherPortAdvertSpeed, wwpLeosEtherUntagEgressVlanId=wwpLeosEtherUntagEgressVlanId, wwpLeosEtherPortStateMirrorGroupType=wwpLeosEtherPortStateMirrorGroupType, wwpLeosEtherPortLinkFlapDetection=wwpLeosEtherPortLinkFlapDetection, wwpLeosEtherPortAdminStatus=wwpLeosEtherPortAdminStatus, PortEgressFrameCosPolicy=PortEgressFrameCosPolicy, wwpLeosEtherPortAcceptableFrameTypes=wwpLeosEtherPortAcceptableFrameTypes, wwpLeosPortMIBGroups=wwpLeosPortMIBGroups, wwpLeosEtherPortType=wwpLeosEtherPortType, wwpLeosEthLinkUp=wwpLeosEthLinkUp, wwpLeosEtherPortMirrorEgress=wwpLeosEtherPortMirrorEgress, wwpLeosEtherPortVsIngressFiltering=wwpLeosEtherPortVsIngressFiltering, wwpLeosEtherPortAdminAdvertisedFlowCtrl=wwpLeosEtherPortAdminAdvertisedFlowCtrl, wwpLeosEtherPortDesc=wwpLeosEtherPortDesc, wwpLeosEtherPortResolvedCosMapId=wwpLeosEtherPortResolvedCosMapId, wwpLeosEtherPortEgressPortQueueMapId=wwpLeosEtherPortEgressPortQueueMapId, wwpLeosEtherPortStateMirrorGroupMemOperState=wwpLeosEtherPortStateMirrorGroupMemOperState, wwpLeosEtherPortResolvedCosPolicy=wwpLeosEtherPortResolvedCosPolicy, wwpLeosPortMIBCompliances=wwpLeosPortMIBCompliances, wwpLeosEtherPortL2TransformMode=wwpLeosEtherPortL2TransformMode, wwpLeosEtherPortVlanIngressFiltering=wwpLeosEtherPortVlanIngressFiltering, wwpLeosPortMIBNotificationPrefix=wwpLeosPortMIBNotificationPrefix, wwpLeosEtherPortPhysAddr=wwpLeosEtherPortPhysAddr, wwpLeosEtherPortAutoNeg=wwpLeosEtherPortAutoNeg, wwpLeosEtherPortStateMirrorGroupMemTable=wwpLeosEtherPortStateMirrorGroupMemTable, wwpLeosEtherPortFlushActivate=wwpLeosEtherPortFlushActivate, wwpLeosEtherPortOperDuplex=wwpLeosEtherPortOperDuplex, wwpLeosEtherPort=wwpLeosEtherPort, wwpLeosEtherPortStateMirrorGroupNumSrcPorts=wwpLeosEtherPortStateMirrorGroupNumSrcPorts, wwpLeosEtherPortFlushTable=wwpLeosEtherPortFlushTable, wwpLeosEtherPortStateMirrorGroupStatus=wwpLeosEtherPortStateMirrorGroupStatus, wwpLeosEthAdminSpeedIncompatible=wwpLeosEthAdminSpeedIncompatible, wwpLeosEtherPortNotif=wwpLeosEtherPortNotif, wwpLeosEtherPortStateMirrorGroupMemEntry=wwpLeosEtherPortStateMirrorGroupMemEntry, wwpLeosEtherPortAdminFlowCtrl=wwpLeosEtherPortAdminFlowCtrl, wwpLeosEtherPortUntagCtrlVsiType=wwpLeosEtherPortUntagCtrlVsiType, wwpLeosEtherPortStateMirrorGroupMemType=wwpLeosEtherPortStateMirrorGroupMemType, wwpLeosEtherPortResolvedCosRemarkL2=wwpLeosEtherPortResolvedCosRemarkL2, wwpLeosEtherPortStateMirrorGroupName=wwpLeosEtherPortStateMirrorGroupName, wwpLeosPortMIB=wwpLeosPortMIB, wwpLeosEtherPortLinkUpDownTrapsEnable=wwpLeosEtherPortLinkUpDownTrapsEnable, wwpLeosEtherIngressPvid=wwpLeosEtherIngressPvid, wwpLeosPortMIBConformance=wwpLeosPortMIBConformance, wwpLeosEtherPortMirrorEncapTpid=wwpLeosEtherPortMirrorEncapTpid, wwpLeosEtherPortMirrorIngress=wwpLeosEtherPortMirrorIngress, wwpLeosEtherPortAdaptiveRateSpeed=wwpLeosEtherPortAdaptiveRateSpeed, wwpLeosEtherPortLinkFlapDetectTime=wwpLeosEtherPortLinkFlapDetectTime, wwpLeosEtherPortTrapsTable=wwpLeosEtherPortTrapsTable, wwpLeosEtherPortMirrorEncap=wwpLeosEtherPortMirrorEncap, wwpLeosEtherPortMacSaDaSwapVlan=wwpLeosEtherPortMacSaDaSwapVlan, wwpLeosEtherPortTrapsEntry=wwpLeosEtherPortTrapsEntry, wwpLeosEtherPortIngressFixedDot1dPri=wwpLeosEtherPortIngressFixedDot1dPri, wwpLeosEtherPortMirrorPort=wwpLeosEtherPortMirrorPort, wwpLeosPortMIBNotifications=wwpLeosPortMIBNotifications, wwpLeosEtherFixedRColor=wwpLeosEtherFixedRColor, wwpLeosEtherPortVplsPortType=wwpLeosEtherPortVplsPortType, wwpLeosEtherPortIngressCosPolicy=wwpLeosEtherPortIngressCosPolicy, wwpLeosEtherPortStateMirrorGroupTable=wwpLeosEtherPortStateMirrorGroupTable, wwpLeosEtherPortMode=wwpLeosEtherPortMode, wwpLeosEtherPortOperationalSpeed=wwpLeosEtherPortOperationalSpeed, wwpLeosEtherPortName=wwpLeosEtherPortName, wwpLeosEtherPortOperSpeed=wwpLeosEtherPortOperSpeed, wwpLeosEtherPortStateMirrorGroupOperStatus=wwpLeosEtherPortStateMirrorGroupOperStatus, wwpLeosEtherPortOperAutoNeg=wwpLeosEtherPortOperAutoNeg, wwpLeosAggLinkUpDown=wwpLeosAggLinkUpDown, wwpLeosPortMIBObjects=wwpLeosPortMIBObjects, wwpLeosEtherPortStateMirrorGroupEntry=wwpLeosEtherPortStateMirrorGroupEntry, PortIngressFixedColor=PortIngressFixedColor, wwpLeosEtherPortId=wwpLeosEtherPortId, wwpLeosEtherPortVlanIngressFilterStrict=wwpLeosEtherPortVlanIngressFilterStrict, wwpLeosEtherPortStateMirrorGroupId=wwpLeosEtherPortStateMirrorGroupId, wwpLeosEtherPortIfgDecrease=wwpLeosEtherPortIfgDecrease, wwpLeosEtherPortUpTime=wwpLeosEtherPortUpTime, wwpLeosEtherPortMirrorEncapVid=wwpLeosEtherPortMirrorEncapVid, wwpLeosEtherPortUntagDataVsi=wwpLeosEtherPortUntagDataVsi, wwpLeosEtherPortFrameCosMapId=wwpLeosEtherPortFrameCosMapId, wwpLeosEtherPortLinkFlapCount=wwpLeosEtherPortLinkFlapCount, wwpLeosEtherStndLinkUpDownTrapsEnable=wwpLeosEtherStndLinkUpDownTrapsEnable, wwpLeosEtherPortOperStatus=wwpLeosEtherPortOperStatus, wwpLeosEtherPortAdvertDuplex=wwpLeosEtherPortAdvertDuplex, wwpLeosEtherPortStateMirrorGroupNumDstPorts=wwpLeosEtherPortStateMirrorGroupNumDstPorts, PortList=PortList, wwpLeosEtherPortTrapsState=wwpLeosEtherPortTrapsState, wwpLeosEtherPortMaxFrameSize=wwpLeosEtherPortMaxFrameSize, wwpLeosEtherPortPhyLoopback=wwpLeosEtherPortPhyLoopback, wwpLeosEtherPortUntagDataVsiType=wwpLeosEtherPortUntagDataVsiType, wwpLeosEtherPortFlushEntry=wwpLeosEtherPortFlushEntry, wwpLeosEtherPortLinkFlapHoldTime=wwpLeosEtherPortLinkFlapHoldTime, PYSNMP_MODULE_ID=wwpLeosPortMIB, wwpLeosEtherPortEgressSpeed=wwpLeosEtherPortEgressSpeed, wwpLeosEthLinkFlap=wwpLeosEthLinkFlap, wwpLeosEtherPortTable=wwpLeosEtherPortTable, wwpLeosEtherAggPortLinkUpDownTrapsEnable=wwpLeosEtherAggPortLinkUpDownTrapsEnable, wwpLeosEtherPortMacSaDaSwap=wwpLeosEtherPortMacSaDaSwap, wwpLeosEtherPortEgressCosPolicy=wwpLeosEtherPortEgressCosPolicy, wwpLeosEtherPortAdminSpeed=wwpLeosEtherPortAdminSpeed, wwpLeosEtherPortAdminDuplex=wwpLeosEtherPortAdminDuplex)
|
'''Reescreva a função leiaInt() que fizemos no desafio 104, incluindo agora a possibilidade da digitação
de um número de tipo inválido. Aproveite e crie também uma função leiaFloat() com a mesma funcionalidade.'''
def leiaint(msg):
while True:
try:
n=int(input(msg))
except(ValueError,TypeError):
print('\033[31mERRO: Por favor,digite um número inteiro válido.\033[m')
continue
except(KeyboardInterrupt):
print('\033[31Usuário preferiu não digitar esse número.\033[m')
return 0
else:
return n
def leiafloat(msg):
while True:
try:
n=float(input(msg))
except(ValueError,TypeError):
print('\033[31mERRO: Por favor,digite um número real válido.\033[m')
continue
except(KeyboardInterrupt):
print('\033[31Usuário preferiu não digitar esse número.\033[m')
return 0
else:
return n
n1=leiaint('Digite um Inteiro: ')
n1=leiafloat('Digite um Real: ')
print(f'O valor digitado inteiro foi {n1} e o real foi {n2}')
|
budget = int(input())
season = input()
fisherman = int(input())
rent_price = 0
if season == "Spring":
rent_price = 3000
elif season == "Summer" or season == "Autumn":
rent_price = 4200
elif season == "Winter":
rent_price = 2600
if fisherman <= 6:
rent_price = rent_price - (rent_price * 0.1)
elif 7 <= fisherman <= 11:
rent_price = rent_price - (rent_price * 0.15)
elif fisherman >= 12:
rent_price = rent_price - (rent_price * 0.25)
if fisherman % 2 == 0 and season == "Spring":
rent_price = rent_price - (rent_price * 0.05)
elif fisherman % 2 == 0 and season == "Summer":
rent_price = rent_price - (rent_price * 0.05)
elif fisherman % 2 == 0 and season == "Winter":
rent_price = rent_price - (rent_price * 0.05)
else:
rent_price = rent_price
if budget >= rent_price:
extra_money = budget - rent_price
print(f"Yes! You have {extra_money:.2f} leva left.")
else:
lack = rent_price - budget
print(f"Not enough money! You need {lack:.2f} leva.") |
def pascal_triangle(n):
if n == 0:
return [1]
else:
row = [1]
line_behind = pascal_triangle(n - 1)
for r in range(len(line_behind) - 1):
row.append(line_behind[r] + line_behind[r + 1])
row += [1]
return row
print(pascal_triangle(4))
|
class YesError(Exception):
pass
class YesUserCanceledError(YesError):
pass
class YesUnknownIssuerError(YesError):
pass
class YesAccountSelectionRequested(YesError):
redirect_uri: str
class YesOAuthError(YesError):
oauth_error: str
oauth_error_description: str
|
class Packtry(object):
@staticmethod
def print():
print('print')
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class UnsupportedFileFormatError(Exception):
"""
This exception is intended to communicate that the file extension is not one of
the supported file types and cannot be parsed with AICSImage.
"""
def __init__(self, data, **kwargs):
super().__init__(**kwargs)
self.data = data
def __str__(self):
return f"AICSImage module does not support this image file type: '{self.data}'."
class InvalidDimensionOrderingError(Exception):
"""
A general exception that can be thrown when handling dimension ordering or
validation. Should be provided a message for the user to be given more context.
"""
def __init__(self, message: str, **kwargs):
super().__init__(**kwargs)
self.message = message
def __str__(self):
return self.message
class ConflictingArgumentsError(Exception):
"""
This exception is returned when 2 arguments to the same function are in conflict.
"""
pass
class InconsistentShapeError(Exception):
"""
A general function to use when the shape returned or requested from an array
operation is invalid.
"""
pass
class InconsistentPixelType(Exception):
"""
This exception is returned when the metadata has conflicting pixel types.
"""
pass
|
class Constants:
APPLICATION_TITLE = "Welcome to Kafka Local Setup Tool"
APPLICATION_WINDOW_TITLE = "Kafka Application Tool"
START_BUTTON = "Start"
STOP_BUTTON = "Stop"
CHOOSE_FOLDER = "Choose Folder"
SELECT_FOLDER = "Select the folder"
ZOOKEEPER_START_SERVER_PATH = "bin/zookeeper-server-start.sh"
APACHE_ZOOKEEPER_START_SERVER_CONFIG = "config/zookeeper.properties"
CONFLUENT_ZOOKEEPER_START_SERVER_CONFIG = "etc/zookeeper.properties"
KAFKA_START_SERVER_PATH = "bin/kafka-server-start.sh"
APACHE_KAFKA_START_SERVER_CONFIG = "config/server.properties"
CONFLUENT_KAFKA_START_SERVER_CONFIG = "etc/server.properties"
ZOOKEEPER_STOP_SERVER_PATH = "bin/zookeeper-server-stop.sh"
KAFKA_STOP_SERVER_PATH = "bin/kafka-server-stop.sh"
KAFKA_BASE_IMAGE = "app/images/kafka.png"
APACHE_KAFKA = "Apache"
CONFLUENT_KAFKA = "Confluent"
|
class User():
def __init__(self, Name, LastName, ID, Mail, Phone):
self.Name = Name
self.LastName = LastName
self.ID = ID
self.Mail = Mail
self.Phone = Phone
def Describe_U(self):
s = "\nName: " + self.Name + " "+self.LastName + "\nID: "+self.ID
s += "\nInfo contacto\nPhone: " + self.Phone + " Mail: " + self.Mail
print(s)
def Greet_U(self):
s = "\nWelcome " + self.Name + " " + self.LastName + "\n"
print(s)
Usuarios = []
Usuarios.append(User("Omar","Padilla","1","omarpadilla@mail.com","1234567890"))
Usuarios.append(User("Diego","Castillo","2","castillo117@mail.com","0987654321"))
Usuarios.append(User("Fernanda","Cisneros","3","fercis@mail.com","7894561230"))
Usuarios.append(User("Alejandra","Sanchez","4","alesa19@mail.com","3692581470"))
Usuarios.append(User("Armando","Garces","5","chivascampeon@mail.com","4561237890"))
for i in Usuarios:
i.Describe_U()
i.Greet_U() |
with open("data_100.vrt", "rb") as f_in:
with open("data_broken_header.vrt", "wb") as f_out:
f_out.write(f_in.read(2))
with open("data_missing_fields.vrt", "wb") as f_out:
f_out.write(f_in.read(4))
with open("data_broken_fields.vrt", "wb") as f_out:
f_out.write(f_in.read(6))
with open("data_missing_trailer.vrt", "wb") as f_out:
f_out.write(f_in.read(4 * 514))
with open("data_missing_words.vrt", "wb") as f_out:
f_out.write(f_in.read(4 * 514))
f_in.seek(4 * 7)
f_out.write(f_in.read(4 * 10 * 515))
with open("if_context_100.vrt", "rb") as f_in:
with open("if_context_missing_context.vrt", "wb") as f_out:
f_out.write(f_in.read(4 * 2))
with open("if_context_broken_context.vrt", "wb") as f_out:
f_out.write(f_in.read(4 * 3)) |
"""
Euclidean common divisor algorithm.
"""
def greatest_common_divisor(num_a: int, num_b: int) -> int:
"""
A method to compute the greatest common divisor.
Args:
num_a (int): The first number.
num_b (int): Second number
Returns:
The greatest common divisor.
"""
if num_b == 0:
return num_a
print(f">>> Value of num_b: {num_b}")
return greatest_common_divisor(num_b, num_a % num_b)
if __name__ == "__main__":
a = 357
b = 234
print(f">>> GCD of {a} and {b} is: {greatest_common_divisor(a, b)}")
|
n = int(input())
arr = [int(x) for x in input().split()]
if all(item < 0 for item in arr):
print(0)
else:
mx = 0
su = 0
for item in arr:
su += item
if su < 0:
su = 0
if su > mx:
mx = su
print(mx)
|
def flatten_list(mylist,index=0,newlist=[]):
if(index==len(mylist)):
return newlist
if(type(mylist[index])== list):
newlist.extend(flatten_list(mylist[index],0,[]))
else:
newlist.append(mylist[index])
return flatten_list(mylist,index+1,newlist)
mylist=[1,2,[3,4],[5,[6,7,[8]]],[],9]
print(mylist)
flat_list= flatten_list(mylist)
print(flat_list)
|
# !/usr/bin/env python
# -*-coding:utf-8 -*-
# Warning :The Hard Way Is Easier
"""
现在IPV4下用一个32位无符号整数来表示,
一般用点分方式来显示,点将IP地址分成4个部分,
每个部分为8位,表示成一个无符号整数(因此不需要用正号出现),
如10.137.17.1,是我们非常熟悉的IP地址,一个IP地址串中没有空格出现(因为要表示成一个32数字)。
现在需要你用程序来判断IP是否合法。
# 核心: 判断每个部分数值是否小于255
"""
def Solution(s: str):
l = [int(i) for i in s.split(".")]
for n in l:
if n > 255 or n < 0:
print("NO")
break
else:
print("YES")
if __name__ == '__main__':
t = "10.138.15.1"
Solution(t)
t = "255.0.0.255"
Solution(t)
t = "255.255.255.1000"
Solution(t)
|
class Service(object):
'''Basic service interface.
If you want your own service, you should respect this interface
so that your service can be used by the looper.
'''
def __init__(self, cfg, comp, outdir):
'''
cfg: framework.config.Service object containing whatever parameters
you need
comp: dummy parameter
outdir: output directory for your service (feel free not to use it)
Please have a look at TFileService for more information
'''
def start(self):
'''Start the service.
Called by the looper, not by the user.
'''
pass
def stop(self):
'''Stop the service.
Called by the looper, not by the user.
'''
pass
|
# Copyright 2015 Curtis Sand
#
# 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.
class CommandMixin(object):
"""Command Mixin: Used to add commands to an interpreter.
Subclasses of the CommandMixin should use mangled class attributes to avoid
collisions when the interpreter object is put together.
Example::
class Example(CommandMixin):
'''Example command help documentation.'''
def __count(self, opts):
pass # some code goes here
def __setup_parser(self):
parser = ArgumentParser(prog='example',
description=Example.__doc__)
self._add_argument(parser, '-c', '--count', const=self.__count)
return parser, self.__count
def do_example(self, line):
return super(Test2, self)._do(line, self.__setup_parser)
def help_example(self):
print(Example.__doc__)
"""
def __init__(self, engine):
self.engine = engine
def _do(self, line, setup_parser):
"""
The parser object will set arg.action to a method which will perform
the action for this command. If opts.action is None, the method
returned from "__setup_parser" will be called instead.
"""
try:
parser, default_action = setup_parser()
(opts, args) = parser.parse_known_args(line.split(' '))
setattr(opts, 'args', args)
if opts.action is None:
default_action(opts)
else:
opts.action(opts)
except SystemExit:
pass
return False
def _add_argument(self, parser, *args, **kwargs):
"""Help set the "action" and "dest" attrs for the argument"""
action = 'action'
dest = 'dest'
if action not in kwargs:
kwargs[action] = 'store_const'
if dest not in kwargs:
kwargs[dest] = action
parser.add_argument(*args, **kwargs)
|
def shorten_string(string : str, max_length : int):
shortened_name = string
if len(string) > max_length:
shortened_name = string[0:max_length] + '...'
return shortened_name |
#!/usr/bin/env python3
#
# Prints to stdout very fast.
#
# Optimal time:
# time ./stress.py >/dev/null
# Actual time:
# time ./stress.py
for i in range(1000000):
print('\033[31;1m', i, '\033[0m')
|
GstreamerPackage ('gstreamer', 'gst-plugins-bad', '0.10.23', configure_flags = [
' --disable-gtk-doc',
' --with-plugins=quicktime',
' --disable-apexsink',
' --disable-bz2',
' --disable-metadata',
' --disable-oss4',
' --disable-theoradec'
])
|
n = int(input())
list_names = []
for i in range(n):
name = input()
list_names.append(name)
print(list_names) |
class CubeOrder:
"""""
There does not seem to be one single standard for cube representation among various solvers.
Different programs will receive an input string expecting a different order.
This class allows us to convert from one order to another order allowing stitching among solvers.
The names of the facelet positions of the cube
|************|
|*U1**U2**U3*|
|************|
|*U4**U5**U6*|
|************|
|*U7**U8**U9*|
|************|
|************|************|************|************|
|*L1**L2**L3*|*F1**F2**F3*|*R1**R2**R3*|*B1**B2**B3*|
|************|************|************|************|
|*L4**L5**L6*|*F4**F5**F6*|*R4**R5**R6*|*B4**B5**B6*|
|************|************|************|************|
|*L7**L8**L9*|*F7**F8**F9*|*R7**R8**R9*|*B7**B8**B9*|
|************|************|************|************|
|************|
|*D1**D2**D3*|
|************|
|*D4**D5**D6*|
|************|
|*D7**D8**D9*|
|************|
Note that the bottom (B1-B9) is considered viewed from the bottom.
So B1 is adjacent to R3. And B3 is adjacent to L1. Etc.
"""
U1 = "U1"
U2 = "U2"
U3 = "U3"
U4 = "U4"
U5 = "U5"
U6 = "U6"
U7 = "U7"
U8 = "U8"
U9 = "U9"
L1 = "L1"
L2 = "L2"
L3 = "L3"
L4 = "L4"
L5 = "L5"
L6 = "L6"
L7 = "L7"
L8 = "L8"
L9 = "L9"
F1 = "F1"
F2 = "F2"
F3 = "F3"
F4 = "F4"
F5 = "F5"
F6 = "F6"
F7 = "F7"
F8 = "F8"
F9 = "F9"
R1 = "R1"
R2 = "R2"
R3 = "R3"
R4 = "R4"
R5 = "R5"
R6 = "R6"
R7 = "R7"
R8 = "R8"
R9 = "R9"
B1 = "B1"
B2 = "B2"
B3 = "B3"
B4 = "B4"
B5 = "B5"
B6 = "B6"
B7 = "B7"
B8 = "B8"
B9 = "B9"
D1 = "D1"
D2 = "D2"
D3 = "D3"
D4 = "D4"
D5 = "D5"
D6 = "D6"
D7 = "D7"
D8 = "D8"
D9 = "D9"
# kociemba defines INPUT/OUPUT for his cube in an order that keeps the stickers of every face together
# U1-U9, R1-R9, F1-F9, D1-D9, L1-L9, B1-B9
# Note: B7 is adjacent to R9
STICKER_GROUPS_URFDLB = [
U1, U2, U3,
U4, U5, U6,
U7, U8, U9,
R1, R2, R3, # R3 is next to B1
R4, R5, R6, # R6 is next to B4
R7, R8, R9, # R9 is next to B7
F1, F2, F3,
F4, F5, F6,
F7, F8, F9,
D1, D2, D3,
D4, D5, D6,
D7, D8, D9,
L1, L2, L3,
L4, L5, L6,
L7, L8, L9,
B1, B2, B3, # R3 is next to B1
B4, B5, B6, # R6 is next to B4
B7, B8, B9 # R9 is next to B7
]
#https://github.com/hkociemba/RubiksCube-TwophaseSolver
KOCIEMBA_ORDER = STICKER_GROUPS_URFDLB
#https://github.com/dwalton76/rubiks-color-resolver
COLOR_RESOLVER_ORDER = [
U1, U2, U3,
U4, U5, U6,
U7, U8, U9,
R1, R2, R3,
R4, R5, R6,
R7, R8, R9,
F1, F2, F3,
F4, F5, F6,
F7, F8, F9,
D1, D2, D3,
D4, D5, D6,
D7, D8, D9,
L1, L2, L3,
L4, L5, L6,
L7, L8, L9,
B1, B2, B3,
B4, B5, B6,
B7, B8, B9
#B3, B2, B1,
#B6, B5, B4,
#B9, B8, B7
]
# Other solvers represent INPUT/OUTPUT by unfolding the cube then simply reading order:
# in top to bottom rows read left to right
# Unfold back means we think of the Back as if viewed from below, looking up
# as if unfolding a paper box and laying it down flat
# The Back pieces retain their order as we rotate the entire cube around Z
# Note: B7 is adjacent to R9
#https://github.com/pglass/cube
SLICE_UNFOLD_BACK = [
U1, U2, U3,
U4, U5, U6,
U7, U8, U9,
L1, L2, L3, F1, F2, F3, R1, R2, R3, B1, B2, B3,
L4, L5, L6, F4, F5, F6, R4, R5, R6, B4, B5, B6,
L7, L8, L9, F7, F8, F9, R7, R8, R9, B7, B8, B9,
D1, D2, D3,
D4, D5, D6,
D7, D8, D9
]
# Xray slices means we think of the Back as if viewed through the front
# Note: B7 is adjacent to R9
SLICE_XRAYBACK = [
U1, U2, U3,
U4, U5, U6,
U7, U8, U9,
L1, L2, L3, F1, F2, F3, R1, R2, R3, B3, B2, B1,
L4, L5, L6, F4, F5, F6, R4, R5, R6, B6, B5, B4,
L7, L8, L9, F7, F8, F9, R7, R8, R9, B9, B8, B7,
D1, D2, D3,
D4, D5, D6,
D7, D8, D9
]
#AnimCubeJS https://cubing.github.io/AnimCubeJS/animcubejs.html
SLICE_ANIMJS3 = [
U7, U8, U9,
U4, U5, U6,
U1, U2, U3,
D1, D4, D7,
D2, D5, D8,
D3, D6, D9,
F1, F4, F7,
F2, F5, F8,
F3, F6, F9,
B1, B4, B7,
B2, B5, B8,
B3, B6, B9,
L3, L2, L1,
L6, L5, L4,
L9, L8, L7,
R1, R4, R7,
R2, R5, R8,
R3, R6, R9,
]
animOrderLookup = [
7, 8, 9,
4, 5, 6,
1, 2, 3,
39, 38, 37, 19, 22, 25, 46, 49, 52, 28, 31, 34,
42, 41, 40, 20, 23, 26, 47, 50, 53, 29, 32, 35,
45, 44, 43, 21, 24, 27, 48, 51, 54, 30, 33, 36,
10, 13, 16,
11, 14, 17,
12, 15, 18,
]
def convert (self, cubeString, fromType, toType):
convertedList = [None]*54
for i, cubeChar in enumerate(cubeString):
sticker = fromType[i]
j = toType.index(sticker)
convertedList[j] = cubeChar
assert None not in convertedList
convertString = "".join(convertedList)
return convertString
|
class Dataset(object):
"""
Class representation of a dataset on Citrination.
"""
def __init__(self, id, name=None, description=None,
created_at=None):
"""
Constructor.
:param id: The ID of the dataset (required for instantiation)
:type id: int
:param name: The name of the dataset
:type name: str
:param description: The description of the dataset
:type description: str
:param created_at: The timestamp for creation of the dataset
:type created_at: str
"""
self._name = name
self._description = description
self._id = id
self._created_at = created_at
@property
def id(self):
return self._id
@property
def name(self):
return self._name
@name.setter
def name(self, value):
self._name = value
@name.deleter
def name(self):
self._name = None
@property
def description(self):
return self._description
@description.setter
def description(self, value):
self._description = value
@description.deleter
def description(self):
self._description = None
@property
def created_at(self):
return self._created_at
@created_at.setter
def created_at(self, value):
self._created_at = value
@created_at.deleter
def created_at(self):
self._created_at = None
|
"""Exception types."""
class IntegratorError(RuntimeError):
"""Error raised when integrator step fails."""
class NonReversibleStepError(IntegratorError):
"""Error raised when integrator step fails reversibility check."""
class ConvergenceError(IntegratorError):
"""Error raised when solver fails to converge within allowed iterations."""
|
class Solution:
# 1st two-pass solution
# O(2n) time | O(1) space
def sortColors(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
zero = 0
for i in range(len(nums)):
if nums[i] == 0:
nums[i], nums[zero] = nums[zero], nums[i]
zero += 1
two = len(nums) - 1
for i in reversed(range(len(nums))):
if nums[i] == 2:
nums[i], nums[two] = nums[two], nums[i]
two -= 1
# 2nd one-pass solution
# O(n) time | O(1) space
def sortColors(self, nums: List[int]) -> None:
""" Since all numbers befor zero index have been checked, we could move forward directly.
But for numbers after two index, after we change the numbers, we need to check current number again.
"""
zero = 0
two = len(nums) - 1
i = 0
while i <= two:
if nums[i] == 0:
nums[i], nums[zero] = nums[zero], nums[i]
zero += 1
i += 1
elif nums[i] == 2:
nums[i], nums[two] = nums[two], nums[i]
two -= 1
elif nums[i] == 1:
i += 1 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
EXPECTED_REPR = u""""""
EXPECTED_AGG_QUERY = {
"week": {
"aggs": {
"nested_below_week": {
"aggs": {
"local_metrics.field_class.name": {
"aggs": {
"min_f1_score": {
"min": {
"field": "local_metrics.performance.test.f1_score"
}
}
},
"terms": {
"field": "local_metrics.field_class.name",
"size": 10,
},
}
},
"nested": {"path": "local_metrics"},
}
},
"date_histogram": {"field": "date", "format": "yyyy-MM-dd", "interval": "1w"},
}
}
|
"""Py4research main library. Note that it consists
of two modules.
"""
__version__ = '1.0.1'
|
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class DbTypeEnum(object):
"""Implementation of the 'DbType' enum.
Specifies the type of the database in Oracle Protection Source.
'kRACDatabase' indicates the database is a RAC DB.
'kSingleInstance' indicates that the database is single instance.
Attributes:
KSINGLEINSTANCE: TODO: type description here.
KRACDATABASE: TODO: type description here.
"""
KSINGLEINSTANCE = 'kSingleInstance'
KRACDATABASE = 'kRACDatabase'
|
# -*- coding: utf-8 -*-
textFile = """
.
.
.
One has to consider that the database is closed.
Spyder
"""
print("Osman Orhun OZSAN")
print("2017-01-19 14:00:00")
print(textFile)
|
def mergeSort(myArray):
# print to show splitting
print("Splitting ",myArray)
# if array is greater than 1 then:
if len(myArray) > 1:
# mid, leftside, and right side of array stored as variables
mid = len(myArray)//2
lefthalf = myArray[:mid]
righthalf = myArray[mid:]
# function mergeSort passed both sides of array
mergeSort(lefthalf)
mergeSort(righthalf)
# initialise
i=0
j=0
k=0
# while loop, while i less than the length of leftside of array and right side of the array do the following
while i < len(lefthalf) and j < len(righthalf):
if lefthalf[i] < righthalf[j]:
myArray[k] = lefthalf[i]
i=i+1
else:
myArray[k] = righthalf[j]
j = j+1
k = k+1
# while loop, while i less than the length of leftside of array do the following
while i < len(lefthalf):
myArray[k] = lefthalf[i]
i = i+1
k = k+1
# while loop, while j less than the length of rightside of array do the following
while j < len(righthalf):
myArray[k] = righthalf[j]
j = j+1
k = k+1
# print to show merging
print("Merging ",myArray)
myArrray = [22,55,91,15,66,22,25,5,18]
mergeSort(myArrray)
print(myArrray) |
class TSheetsError(Exception):
"""Exception Class to handle the failure of the request."""
def __init__(self, base_exception=None):
self.base_exception = base_exception
def __str__(self):
if self.base_exception:
return str(self.base_exception)
return "An unknown error occurred."
class FilterInvalidValueError(TSheetsError):
pass
class MethodNotAvailableError(TSheetsError):
pass
class TSheetsExpectedError(Exception):
def __init__(self, base_exception=None, response=None):
self.base_exception = base_exception
self.response = response
def __str__(self):
error_msg = ""
if self.base_exception:
error_msg = str(self.base_exception)
if self.response.status_code == 417:
try:
r = self.response.json()
error = r.get("error", {})
msg = error.get("message", None)
error_msg = msg
except:
pass
return str(error_msg) |
"""Compatibility support for Python 2 and 3."""
try:
string_types = (basestring,)
except NameError:
string_types = (str,)
|
""" Faça um programa que leia três números e mostre qual é o MAIOR
e qual o MENOR."""
num1 = int(input("Digite o primeiro número:"))
num2 = int(input('Digite o segundo número:'))
num3 = int(input('Digite o terceiro número:'))
if num1 > num2 and num1 > num3:
maior = num1
else:
if num2 > num3:
maior = num2
else:
maior = num3
print(f'MAIOR = {maior}')
if num1 < num2 and num1 < num3:
menor = num1
else:
if num2 < num3:
menor = num2
else:
menor = num3
print(f'MENOR = {menor}') |
ATOM, BOND, DIGIT, LPAR, RPAR, LSPAR, RSPAR, PLUS, MINUS, DOT, WILDCARD, PERCENT, AT, COLON, EOF = (
'ATOM', 'BOND', 'DIGIT', '(', ')', '[', ']', '+', '-', '.', '*', '%', '@', ':', 'EOF'
)
SYMBOLS_TR = {
'=': BOND,
'#': BOND,
'$': BOND,
'/': BOND,
'\\': BOND,
'(': LPAR,
')': RPAR,
'[': LSPAR,
']': RSPAR,
'+': PLUS,
'-': MINUS,
'.': DOT,
'*': WILDCARD,
'%': PERCENT,
'@': AT,
':': COLON,
# chain terminators:
' ': EOF,
'\t': EOF,
'\n': EOF,
'\r': EOF,
'\0': EOF,
}
BONDS_TYPE = [BOND, MINUS, COLON]
BOND_ORDER = {
'.': 0,
'-': 1,
'=': 2,
'#': 3,
'$': 4,
'/': 1,
'\\': 1
}
ELEMENT_SYMBOLS = [
'H', 'He',
'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne',
'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar',
'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 'Kr',
'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Tc', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te', 'I', 'Xe',
'Cs', 'Ba', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn',
'Fr', 'Ra', 'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds', 'Rg', 'Cn', 'Fl', 'Lv', # TODO: next symbols
'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu',
'Ac', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm', 'Md', 'No', 'Lr'
]
AROMATIC_SYMBOLS = ['b', 'c', 'n', 'o', 'p', 's', 'se', 'as']
ALIPHATIC_SYMBOLS = ['B', 'C', 'N', 'O', 'S', 'P', 'F', 'Cl', 'Br']
TOT_SYMBOLS = ELEMENT_SYMBOLS + AROMATIC_SYMBOLS
ORGANIC_SUBSET = AROMATIC_SYMBOLS + ALIPHATIC_SYMBOLS
NORMAL_VALENCES = {
'B': (3,),
'C': (4,),
'N': (3, 5),
'O': (2,),
'P': (3, 5),
'S': (2, 4, 6),
'F': (1,),
'Cl': (1,),
'Br': (1,),
'I': (1,),
'Se': (2, 4, 6),
'As': (3, 5)
}
class Token:
"""Token class"""
def __init__(self, type_, value, position=-1):
self.type = type_
self.value = value
self.position = position
def __repr__(self):
return 'Token({}, {}{})'.format(
self.type, repr(self.value), ', {}'.format(self.position) if self.position > -1 else '')
|
#!/usr/bin/env python3
class Flower():
color = 'unknown'
rose = Flower()
rose.color = "red"
violet = Flower()
violet.color = "blue"
this_pun_is_for_you = "The honey is sweet and so are you"
print("Roses are {},".format(rose.color))
print("violets are {},".format(violet.color))
print(this_pun_is_for_you)
|
def query(start, end):
if start < end:
print('M {} {}'.format(start, end), flush=True)
else:
print('M {} {}'.format(end, start), flush=True)
def swap(pos1, pos2):
if pos1 < pos2:
print('S {} {}'.format(pos1, pos2), flush=True)
else:
print('S {} {}'.format(pos2, pos1), flush=True)
def solve(n):
for i in range(1, n):
start = i
end = n
query(start, end)
min = int(input())
if min != i:
swap(min, i)
print('D')
result = int(input())
if result != 1:
quit()
if __name__ == '__main__':
t, n = list(map(int, input().split()))
for case in range(1, t+1):
solve(n) |
# -*- mode: python -*-
DOCUMENTATION = '''
---
module: group_by
short_description: Create Ansible groups based on facts
description:
- Use facts to create ad-hoc groups that can be used later in a playbook.
version_added: "0.9"
options:
key:
description:
- The variables whose values will be used as groups
required: true
author: Jeroen Hoekx
notes:
- Spaces in group names are converted to dashes '-'.
'''
EXAMPLES = '''
# Create groups based on the machine architecture
- group_by: key=machine_{{ ansible_machine }}
# Create groups like 'kvm-host'
- group_by: key=virt_{{ ansible_virtualization_type }}_{{ ansible_virtualization_role }}
'''
|
"""
10.2.1
Can you implement the dynamic-set operation INSERT on a singly linked list in O(1) time? How about DELETE?
"""
class Node:
def __init__(self, data=0, next=None):
self.data = data
self.next = next
class LinkedList:
def __init__(self):
self.head = None
"""Insertion at the head is done in O(1) time"""
def insert_at_head(self, data):
new_node = Node(data)
new_node.next = self.head
self.head = new_node
def insert_at_tail(self, data):
new_node = Node(data)
if self.head is None:
self.head = new_node
else:
curr = self.head
while curr.next:
curr = curr.next
curr.next = new_node
def printll(self):
curr = self.head
while curr:
print(curr.data, end=" -> ")
curr = curr.next
print("/")
ll = LinkedList()
ll.insert_at_tail(40)
ll.insert_at_head(5)
ll.insert_at_head(10)
ll.printll()
ll.insert_at_head(15)
ll.insert_at_tail(20)
ll.printll()
"""
Insertion at the head is only done in O(1) time
DELETE operation can not be performed in O(1) time
"""
|
array = [3, 2, 1]
index = 1 # 0: first item, 1: second item...
item = 100
print(array) # [3, 2, 1]
array = array[0:index] + [item] + array[index:] # ≡
print(array) # [3, 100, 2, 1] |
#!/usr/bin/env python3
"""Advent of Code 2021 Day 12 - Passage Pathing"""
with open('inputs/day_12.txt', 'r') as aoc_input:
lines = [line.strip().split('-') for line in aoc_input.readlines()]
connections = {}
for line in lines:
from_cave, to_cave = line
if from_cave not in connections.keys():
connections[from_cave] = set()
if to_cave not in connections.keys():
connections[to_cave] = set()
connections[from_cave].add(to_cave)
connections[to_cave].add(from_cave)
paths = set()
current_paths = []
for to_cave in connections['start']:
current_paths.append(('start', to_cave))
while current_paths:
path = current_paths.pop()
current_cave = path[-1]
for connected_cave in connections[current_cave]:
# Can't revisit small caves
if connected_cave in path and connected_cave.lower() == connected_cave:
continue
new_path = path + (connected_cave,)
# Check if at end and unique path
if connected_cave == 'end' and new_path not in paths:
paths.add(new_path)
continue
current_paths.append(new_path)
# Answer One
print("Number of paths through cave system:", len(paths))
paths = set()
current_paths = []
for to_cave in connections['start']:
current_paths.append((('start', to_cave), False))
while current_paths:
path, revisited = current_paths.pop()
current_cave = path[-1]
for connected_cave in connections[current_cave]:
new_path_revisited = revisited
# Can't go back to start
if connected_cave == 'start':
continue
# Can't revisit small caves more than once for one of them
if connected_cave in path:
if connected_cave.lower() == connected_cave:
if new_path_revisited:
continue
else:
new_path_revisited = True
new_path = path + (connected_cave,)
# Check if at end and unique path
if connected_cave == 'end' and new_path not in paths:
paths.add(new_path)
continue
current_paths.append(((new_path), new_path_revisited))
# Answer Two
print("Number of paths through cave system:", len(paths))
|
#class that represents a resource
class Resource:
def __init__(self,name,id):
self.name = name
self.ID = id
self.aliases = [name]
#list of all the events this resource is involved in
#reflects when the resource worked on which object
#list of Event objects
self.events = []
def getName(self):
return self.name
def setName(self,name):
self.name = name
def getID(self):
return self.ID
#add an alias for this resource
def addAlias(self,name):
if not (name in self.aliases):
self.aliases.append(name)
#get list of resource names
def getNames(self):
return self.aliases
#returns a string of all the resource aliases
def getLabel(self):
label = ""
count = 0
for alias in self.aliases:
if(count != 0):
label += "+"
label += alias
count += 1
return label
def getEvents(self):
return self.events
#Append this event to the resource's list of events in which he was involved
#@param event : event object
def addEvent(self,event):
self.events.append(event)
#@returns a list of all the objects this programmer worked on in his Event list
def getListOfObjects(self):
files = []
for e in self.events:
f = e.getObject()
if f not in files:
files.append(f)
return files
#@param file : Object object
#@returns a list of time stamps the programmer worked on this object
def getTimestampsForObject(self,file):
timestamps = []
for e in self.events:
if e.getObject() == file:
time = e.getTimestamp()
if time not in timestamps:
timestamps.append(time)
return timestamps
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.