content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
''' def candies(n, arr): count = 0 for i in range(n): even = True sum_even = 0 sum_odd = 0 for j in range(n): if i == j: continue if even: sum_even += arr[j] even = False else: sum_odd += arr[j] even = True if sum_odd == sum_even: count += 1 return count ''' def make_to_left(n, arr): flag = True ret = [-1]*n flag_sum = 0 not_flag_sum = 0 for i in range(n-1, -1, -1): if flag: flag_sum += arr[i] ret[i] = flag_sum flag = False else: not_flag_sum += arr[i] ret[i] = not_flag_sum flag=True return ret def make_to_right(n, arr): flag = True ret = [-1]*n flag_sum = 0 not_flag_sum = 0 for i in range(n): if flag: flag_sum += arr[i] ret[i] = flag_sum flag = False else: not_flag_sum += arr[i] ret[i] = not_flag_sum flag=True return ret def candies(n, arr): to_left = make_to_left(n, arr) to_right = make_to_right(n, arr) ret = 0 for i in range(n): even = 0 odd = 0 if i < n-1: even += to_left[i+1] if i < n-2: odd += to_left[i+2] if i > 1: even += to_right[i-2] if i > 0: odd += to_right[i-1] if even == odd: ret += 1 return ret if __name__ == "__main__": n = int(input()) arr = [int(a) for a in input().split(" ")] ret = candies(n, arr) print(ret)
""" def candies(n, arr): count = 0 for i in range(n): even = True sum_even = 0 sum_odd = 0 for j in range(n): if i == j: continue if even: sum_even += arr[j] even = False else: sum_odd += arr[j] even = True if sum_odd == sum_even: count += 1 return count """ def make_to_left(n, arr): flag = True ret = [-1] * n flag_sum = 0 not_flag_sum = 0 for i in range(n - 1, -1, -1): if flag: flag_sum += arr[i] ret[i] = flag_sum flag = False else: not_flag_sum += arr[i] ret[i] = not_flag_sum flag = True return ret def make_to_right(n, arr): flag = True ret = [-1] * n flag_sum = 0 not_flag_sum = 0 for i in range(n): if flag: flag_sum += arr[i] ret[i] = flag_sum flag = False else: not_flag_sum += arr[i] ret[i] = not_flag_sum flag = True return ret def candies(n, arr): to_left = make_to_left(n, arr) to_right = make_to_right(n, arr) ret = 0 for i in range(n): even = 0 odd = 0 if i < n - 1: even += to_left[i + 1] if i < n - 2: odd += to_left[i + 2] if i > 1: even += to_right[i - 2] if i > 0: odd += to_right[i - 1] if even == odd: ret += 1 return ret if __name__ == '__main__': n = int(input()) arr = [int(a) for a in input().split(' ')] ret = candies(n, arr) print(ret)
class Queue: #Constructor def __init__(self): self.queue = list() self.maxSize = 8 self.head = 0 self.tail = 0 #Adding elements def enqueue(self,data): #Checking if the queue is full if self.size() >= self.maxSize: return ("Queue Full") self.queue.append(data) self.tail += 1 return True #Deleting elements def dequeue(self): #Checking if the queue is empty if self.size() <= 0: self.resetQueue() return ("Queue Empty") data = self.queue[self.head] self.head+=1 return data #Calculate size def size(self): return self.tail - self.head #Reset queue def resetQueue(self): self.tail = 0 self.head = 0 self.queue = list() q = Queue() print(q.enqueue(1))#prints True print(q.enqueue(2))#prints True print(q.enqueue(3))#prints True print(q.enqueue(4))#prints True print(q.enqueue(5))#prints True print(q.enqueue(6))#prints True print(q.enqueue(7))#prints True print(q.enqueue(8))#prints True print(q.enqueue(9))#prints Queue Full! print(q.size())#prints 8 print(q.dequeue())#prints 8 print(q.dequeue())#prints 7 print(q.dequeue())#prints 6 print(q.dequeue())#prints 5 print(q.dequeue())#prints 4 print(q.dequeue())#prints 3 print(q.dequeue())#prints 2 print(q.dequeue())#prints 1 print(q.dequeue())#prints Queue Empty #Queue is reset here print(q.enqueue(1))#prints True print(q.enqueue(2))#prints True print(q.enqueue(3))#prints True print(q.enqueue(4))#prints True
class Queue: def __init__(self): self.queue = list() self.maxSize = 8 self.head = 0 self.tail = 0 def enqueue(self, data): if self.size() >= self.maxSize: return 'Queue Full' self.queue.append(data) self.tail += 1 return True def dequeue(self): if self.size() <= 0: self.resetQueue() return 'Queue Empty' data = self.queue[self.head] self.head += 1 return data def size(self): return self.tail - self.head def reset_queue(self): self.tail = 0 self.head = 0 self.queue = list() q = queue() print(q.enqueue(1)) print(q.enqueue(2)) print(q.enqueue(3)) print(q.enqueue(4)) print(q.enqueue(5)) print(q.enqueue(6)) print(q.enqueue(7)) print(q.enqueue(8)) print(q.enqueue(9)) print(q.size()) print(q.dequeue()) print(q.dequeue()) print(q.dequeue()) print(q.dequeue()) print(q.dequeue()) print(q.dequeue()) print(q.dequeue()) print(q.dequeue()) print(q.dequeue()) print(q.enqueue(1)) print(q.enqueue(2)) print(q.enqueue(3)) print(q.enqueue(4))
class Defaults(object): window_size = 7 filter_nums = [100, 100, 100] filter_sizes = [3, 4, 5] hidden_sizes = [1200] hidden_activation = 'relu' max_vocab_size = 1000000 optimizer = 'adam' learning_rate = 1e-4 epochs = 20 iobes = True # Map tags to IOBES on input max_tokens = None # Max dataset size in tokens encoding = 'utf-8' # Data encoding output_drop_prob = 0.75 # Dropout probablility prior to output token_level_eval = False # Force token-level evaluation verbosity = 1 # 0=quiet, 1=progress bar, 2=one line per epoch fixed_wordvecs = True # Don't fine-tune word vectors word_features = False batch_size = 200 train_steps = 20000 #Amount of train steps, each of batch_size to train for evaluate_every = 5000 evaluate_min = 0 #The minimum step to start evaluating from viterbi = False percent_keep = 1.0 #The percentage of the given training set that should be used for training class CharDefaults(object): word_length = 7 filter_nums = [25, 25, 25] filter_sizes = [3, 4, 5] hidden_sizes = [20] hidden_activation = 'relu' optimizer = 'adam' learning_rate = 1e-4 epochs = 20 encoding = 'utf-8' # Data encoding output_drop_prob = 0.0 # Dropout probablility prior to output token_level_eval = False # Force token-level evaluation verbosity = 1 # 0=quiet, 1=progress bar, 2=one line per epoch fixed_wordvecs = True # Don't fine-tune word vectors word_features = False batch_size = 200 train_steps = 20000 #Amount of train steps, each of batch_size to train for evaluate_every = 5000 evaluate_min = 0 #The minimum step to start evaluating from viterbi = False vocab = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,;.!?:/\|_@#$%&* +-=<>()[]{}" #vocab = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,;.!?:/\|_@#$%&* +-=<>()[]{}"
class Defaults(object): window_size = 7 filter_nums = [100, 100, 100] filter_sizes = [3, 4, 5] hidden_sizes = [1200] hidden_activation = 'relu' max_vocab_size = 1000000 optimizer = 'adam' learning_rate = 0.0001 epochs = 20 iobes = True max_tokens = None encoding = 'utf-8' output_drop_prob = 0.75 token_level_eval = False verbosity = 1 fixed_wordvecs = True word_features = False batch_size = 200 train_steps = 20000 evaluate_every = 5000 evaluate_min = 0 viterbi = False percent_keep = 1.0 class Chardefaults(object): word_length = 7 filter_nums = [25, 25, 25] filter_sizes = [3, 4, 5] hidden_sizes = [20] hidden_activation = 'relu' optimizer = 'adam' learning_rate = 0.0001 epochs = 20 encoding = 'utf-8' output_drop_prob = 0.0 token_level_eval = False verbosity = 1 fixed_wordvecs = True word_features = False batch_size = 200 train_steps = 20000 evaluate_every = 5000 evaluate_min = 0 viterbi = False vocab = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,;.!?:/\\|_@#$%&* +-=<>()[]{}'
def average_weight(file_name): min_value=45 max_value=125 average=0 count_number=0 with open(file_name,"r") as FILE: list1=list(FILE.read().split()) for i in list1: i=int(i) if(min_value<=i<=max_value): average+=i count_number+=1 if(average!=0): return (float(average/count_number)) else: return 0
def average_weight(file_name): min_value = 45 max_value = 125 average = 0 count_number = 0 with open(file_name, 'r') as file: list1 = list(FILE.read().split()) for i in list1: i = int(i) if min_value <= i <= max_value: average += i count_number += 1 if average != 0: return float(average / count_number) else: return 0
#Python program to illustrate # combining else with while count = 0 while (count < 3): count = count + 1 print("Hello Geek") else: print("In Else Block")
count = 0 while count < 3: count = count + 1 print('Hello Geek') else: print('In Else Block')
DEFAULT_IMAGETYPES = {'jpg', 'png', 'apng', 'bmp', 'jpeg', 'gif', 'svg', 'webp'} ZIP_TYPES = {'zip', 'cbz'} RAR_TYPES = {'rar', 'cbr'} _7Z_TYPES = {'7z', 'cb7'} ASSETS = { 'styles.css', 'scripts.js', 'zenscroll.js', 'menu.svg', 'menu-light.svg', 'scroll.svg', 'scroll-light.svg', 'roboto-bold.woff2', 'roboto-regular.woff2', }
default_imagetypes = {'jpg', 'png', 'apng', 'bmp', 'jpeg', 'gif', 'svg', 'webp'} zip_types = {'zip', 'cbz'} rar_types = {'rar', 'cbr'} _7_z_types = {'7z', 'cb7'} assets = {'styles.css', 'scripts.js', 'zenscroll.js', 'menu.svg', 'menu-light.svg', 'scroll.svg', 'scroll-light.svg', 'roboto-bold.woff2', 'roboto-regular.woff2'}
# Create a function taking a positive integer as its parameter and returning a string containing the Roman Numeral representation of that integer. # Modern Roman numerals are written by expressing each digit separately starting with the left most digit and skipping any digit with a value of zero. In Roman numerals 1990 is rendered: 1000=M, 900=CM, 90=XC; resulting in MCMXC. 2008 is written as 2000=MM, 8=VIII; or MMVIII. 1666 uses each Roman symbol in descending order: MDCLXVI. # Example: # solution(1000) # should return 'M' # Help: # Symbol Value # I 1 # V 5 # X 10 # L 50 # C 100 # D 500 # M 1,000 # Remember that there can't be more than 3 identical symbols in a row. # https://www.codewars.com/kata/roman-numerals-encoder/python def solution(n): if n == 0: return '' my_dict = { 1000: 'M', 900: 'CM', 500: 'D', 400: 'CD', 100: 'C', 90: 'XC', 50: 'L', 40: 'XL', 10: 'X', 9: 'IX', 5: 'V', 4: 'IV', 1: 'I' } for i in [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]: # n - 1000 > 0 => M if (n - i) >= 0: return my_dict.get(i) + ''.join(solution(n-i)) break
def solution(n): if n == 0: return '' my_dict = {1000: 'M', 900: 'CM', 500: 'D', 400: 'CD', 100: 'C', 90: 'XC', 50: 'L', 40: 'XL', 10: 'X', 9: 'IX', 5: 'V', 4: 'IV', 1: 'I'} for i in [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]: if n - i >= 0: return my_dict.get(i) + ''.join(solution(n - i)) break
a=0 b=1 n=10 print(1) for i in range(n): c=a+b a=b b=c print(c)
a = 0 b = 1 n = 10 print(1) for i in range(n): c = a + b a = b b = c print(c)
# Advent of Code 2015 # # From https://adventofcode.com/2015/day/5 # VOWELS = set('aeiou') PAIRS = {x * 2 for x in 'abcdefghijklmnopqrstuvwxyz'} NAUGHTY = {'ab', 'cd', 'pq', 'xy'} def part1_check(string_): if sum(string_.count(v) for v in VOWELS) >= 3: pairs = set(string_[i:i + 2] for i in range(len(string_) - 1)) if not pairs.intersection(NAUGHTY) and pairs.intersection(PAIRS): return True return False def part2_check(string_): pair_check = any(string_.count(pair) >= 2 for pair in set(string_[i:i + 2] for i in range(len(string_) - 1))) skip_check = any(set(string_[i:i + 3:2] for i in range(len(string_) - 2)).intersection(PAIRS)) return all((pair_check, skip_check)) inputs = [data.strip() for data in open('../inputs/Advent2015_05.txt', 'r')] print(f"AoC 2015 Day 5, Part 1 answer is {sum(part1_check(x) for x in inputs)}") print(f"AoC 2015 Day 5, Part 2 answer is {sum(part2_check(x) for x in inputs)}")
vowels = set('aeiou') pairs = {x * 2 for x in 'abcdefghijklmnopqrstuvwxyz'} naughty = {'ab', 'cd', 'pq', 'xy'} def part1_check(string_): if sum((string_.count(v) for v in VOWELS)) >= 3: pairs = set((string_[i:i + 2] for i in range(len(string_) - 1))) if not pairs.intersection(NAUGHTY) and pairs.intersection(PAIRS): return True return False def part2_check(string_): pair_check = any((string_.count(pair) >= 2 for pair in set((string_[i:i + 2] for i in range(len(string_) - 1))))) skip_check = any(set((string_[i:i + 3:2] for i in range(len(string_) - 2))).intersection(PAIRS)) return all((pair_check, skip_check)) inputs = [data.strip() for data in open('../inputs/Advent2015_05.txt', 'r')] print(f'AoC 2015 Day 5, Part 1 answer is {sum((part1_check(x) for x in inputs))}') print(f'AoC 2015 Day 5, Part 2 answer is {sum((part2_check(x) for x in inputs))}')
BORDOR_LEFT = "CURSOR_REACH_LEFT" BORDOR_RIGHT = "CURSOR_REACH_RIGHT" BORDOR_TOP = "CURSOR_REACH_TOP" BORDOR_BOTTOM = "CURSOR_REACH_BOTTOM"
bordor_left = 'CURSOR_REACH_LEFT' bordor_right = 'CURSOR_REACH_RIGHT' bordor_top = 'CURSOR_REACH_TOP' bordor_bottom = 'CURSOR_REACH_BOTTOM'
# # @lc app=leetcode id=226 lang=python3 # # [226] Invert Binary Tree # # https://leetcode.com/problems/invert-binary-tree/description/ # # algorithms # Easy (66.70%) # Likes: 4930 # Dislikes: 72 # Total Accepted: 670.1K # Total Submissions: 997K # Testcase Example: '[4,2,7,1,3,6,9]' # # Given the root of a binary tree, invert the tree, and return its root. # # # Example 1: # # # Input: root = [4,2,7,1,3,6,9] # Output: [4,7,2,9,6,3,1] # # # Example 2: # # # Input: root = [2,1,3] # Output: [2,3,1] # # # Example 3: # # # Input: root = [] # Output: [] # # # # Constraints: # # # The number of nodes in the tree is in the range [0, 100]. # -100 <= Node.val <= 100 # # # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def invertTree(self, root: TreeNode) -> TreeNode: if not root: return root left = self.invertTree(root.left) right = self.invertTree(root.right) root.right = left root.left = right return root # @lc code=end
class Solution: def invert_tree(self, root: TreeNode) -> TreeNode: if not root: return root left = self.invertTree(root.left) right = self.invertTree(root.right) root.right = left root.left = right return root
number=int(input('What is your number? ')) prime=True for fac in range(2, number): if int(number)%fac==0 and not number==2: prime=False if prime==True and not number<2: print('The number is prime.') else: print('The number is not prime.')
number = int(input('What is your number? ')) prime = True for fac in range(2, number): if int(number) % fac == 0 and (not number == 2): prime = False if prime == True and (not number < 2): print('The number is prime.') else: print('The number is not prime.')
# Source : https://leetcode.com/problems/check-if-numbers-are-ascending-in-a-sentence/ # Author : foxfromworld # Date : 30/11/2021 # First attempt class Solution: def areNumbersAscending(self, s: str) -> bool: curr = 0 for token in s.split(' '): if token.isdigit(): #if token.isnumeric(): token = int(token) if token > curr: curr = token else: return False return True if curr > 0 else False
class Solution: def are_numbers_ascending(self, s: str) -> bool: curr = 0 for token in s.split(' '): if token.isdigit(): token = int(token) if token > curr: curr = token else: return False return True if curr > 0 else False
class SquareRoot: @staticmethod def square_root(a): c = pow(a, 0.5) return c
class Squareroot: @staticmethod def square_root(a): c = pow(a, 0.5) return c
# HS08TEST amt,bal=map(float,input().split()) if(int(amt)%5==0): if(amt<=(bal-0.5)): print("{:.2f}".format(bal-0.5-amt)) else: print("{:.2f}".format(bal)) else: print("{:.2f}".format(bal))
(amt, bal) = map(float, input().split()) if int(amt) % 5 == 0: if amt <= bal - 0.5: print('{:.2f}'.format(bal - 0.5 - amt)) else: print('{:.2f}'.format(bal)) else: print('{:.2f}'.format(bal))
class UrlManager: def __init__(self): self.pending_urls = set() self.crawled_urls = set() def has_pending_url(self): return len(self.pending_urls) != 0 def add_url(self, url): if url is None or len(url) == 0: return if url in self.crawled_urls: return self.pending_urls.add(url) def add_urls(self, urls): for url in urls: self.add_url(url) def get_url(self): url = self.pending_urls.pop() self.crawled_urls.add(url) return url
class Urlmanager: def __init__(self): self.pending_urls = set() self.crawled_urls = set() def has_pending_url(self): return len(self.pending_urls) != 0 def add_url(self, url): if url is None or len(url) == 0: return if url in self.crawled_urls: return self.pending_urls.add(url) def add_urls(self, urls): for url in urls: self.add_url(url) def get_url(self): url = self.pending_urls.pop() self.crawled_urls.add(url) return url
# let the library to know how many jobs it has to allocate GRID_SEARCH_CV_PARAMS = { "n_jobs" : 4, "cv" : 10 } VERBOSE = True VERBOSITY = 1 POS_NEG_DATASET_DIR = "./data/Positve_negative_sentences/" HAM_SPAM_DATASET_DIR = "./data/Ham_Spam_comments/" TRAINING_DIR= "Training/" TEST_DIR = "Test/"
grid_search_cv_params = {'n_jobs': 4, 'cv': 10} verbose = True verbosity = 1 pos_neg_dataset_dir = './data/Positve_negative_sentences/' ham_spam_dataset_dir = './data/Ham_Spam_comments/' training_dir = 'Training/' test_dir = 'Test/'
first_name = input() second_name = input() delimiter = input() print(f"{first_name}{delimiter}{second_name}")
first_name = input() second_name = input() delimiter = input() print(f'{first_name}{delimiter}{second_name}')
# encoding:utf-8 save_problem_schema = { 'type': 'object', 'properties': { 'title': {'type': 'string'}, 'content': {'type': 'string'}, 'time_limit': {'type': 'integer'}, 'memory_limit': {'type': 'integer'}, 'difficulty' : {'type': 'string'}, 'case_list': {'type': 'array'}, 'answer_list': {'type': 'array'} }, 'required': ['title', 'content', 'time_limit', 'memory_limit', 'case_list', 'answer_list'] } update_problem_schema = { 'type': 'object', 'properties': { 'title': {'type': 'string'}, 'content': {'type': 'string'}, 'time_limit': {'type': 'integer'}, 'memory_limit': {'type': 'integer'} } } update_cases_answers_schema = { 'type': 'object', 'properties': { 'case_list': {'type': 'array'}, 'answer_list': {'type': 'array'} }, 'required': ['case_list', 'answer_list'] }
save_problem_schema = {'type': 'object', 'properties': {'title': {'type': 'string'}, 'content': {'type': 'string'}, 'time_limit': {'type': 'integer'}, 'memory_limit': {'type': 'integer'}, 'difficulty': {'type': 'string'}, 'case_list': {'type': 'array'}, 'answer_list': {'type': 'array'}}, 'required': ['title', 'content', 'time_limit', 'memory_limit', 'case_list', 'answer_list']} update_problem_schema = {'type': 'object', 'properties': {'title': {'type': 'string'}, 'content': {'type': 'string'}, 'time_limit': {'type': 'integer'}, 'memory_limit': {'type': 'integer'}}} update_cases_answers_schema = {'type': 'object', 'properties': {'case_list': {'type': 'array'}, 'answer_list': {'type': 'array'}}, 'required': ['case_list', 'answer_list']}
def main(grains): return { 'states': ['vim'], 'pillars': {} }
def main(grains): return {'states': ['vim'], 'pillars': {}}
class A: def __init__(self): self.x = 1 def _foo(self): print(self.x) a = A() a._foo() print(a.x)
class A: def __init__(self): self.x = 1 def _foo(self): print(self.x) a = a() a._foo() print(a.x)
# for data acquisition: numberOfChannels = 8 samplingRate = 500.0 # for preprocessing: lowBandPassFreq = 2.0 highBandPassFreq = 100.0 lowBandStopFreq = 49 highBandStopFreq = 51 # for feature calculation: windowSize = 0.15 # in s -> 150ms = 0.15s samplesPerWindow = int(windowSize / (1. / samplingRate)) windowShift = int(samplesPerWindow / 2) dataSampleCorrection = 0.000001 # virtual midi cable: virtualMIDICable = 'my_midi_cable' createMIDICable = True
number_of_channels = 8 sampling_rate = 500.0 low_band_pass_freq = 2.0 high_band_pass_freq = 100.0 low_band_stop_freq = 49 high_band_stop_freq = 51 window_size = 0.15 samples_per_window = int(windowSize / (1.0 / samplingRate)) window_shift = int(samplesPerWindow / 2) data_sample_correction = 1e-06 virtual_midi_cable = 'my_midi_cable' create_midi_cable = True
# a module # define the function def showState(state): if(state == True): print("On") else: print("Off")
def show_state(state): if state == True: print('On') else: print('Off')
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education, obj[2]: Occupation, obj[3]: Restaurant20to50, obj[4]: Distance # {"feature": "Coupon", "instances": 8147, "metric_value": 0.4722, "depth": 1} if obj[0]>1: # {"feature": "Distance", "instances": 5903, "metric_value": 0.4599, "depth": 2} if obj[4]<=2: # {"feature": "Restaurant20to50", "instances": 5355, "metric_value": 0.4555, "depth": 3} if obj[3]<=1.0: # {"feature": "Occupation", "instances": 3552, "metric_value": 0.4632, "depth": 4} if obj[2]>0: # {"feature": "Education", "instances": 3508, "metric_value": 0.4649, "depth": 5} if obj[1]<=3: return 'True' elif obj[1]>3: return 'True' else: return 'True' elif obj[2]<=0: # {"feature": "Education", "instances": 44, "metric_value": 0.2332, "depth": 5} if obj[1]<=0: return 'True' elif obj[1]>0: return 'True' else: return 'True' else: return 'True' elif obj[3]>1.0: # {"feature": "Education", "instances": 1803, "metric_value": 0.4356, "depth": 4} if obj[1]>1: # {"feature": "Occupation", "instances": 1112, "metric_value": 0.4511, "depth": 5} if obj[2]<=19: return 'True' elif obj[2]>19: return 'False' else: return 'False' elif obj[1]<=1: # {"feature": "Occupation", "instances": 691, "metric_value": 0.404, "depth": 5} if obj[2]<=18: return 'True' elif obj[2]>18: return 'True' else: return 'True' else: return 'True' else: return 'True' elif obj[4]>2: # {"feature": "Education", "instances": 548, "metric_value": 0.4922, "depth": 3} if obj[1]<=4: # {"feature": "Restaurant20to50", "instances": 545, "metric_value": 0.4927, "depth": 4} if obj[3]>-1.0: # {"feature": "Occupation", "instances": 542, "metric_value": 0.4941, "depth": 5} if obj[2]<=7.586715867158672: return 'False' elif obj[2]>7.586715867158672: return 'False' else: return 'False' elif obj[3]<=-1.0: return 'False' else: return 'False' elif obj[1]>4: return 'True' else: return 'True' else: return 'False' elif obj[0]<=1: # {"feature": "Restaurant20to50", "instances": 2244, "metric_value": 0.4761, "depth": 2} if obj[3]<=1.0: # {"feature": "Education", "instances": 1483, "metric_value": 0.4612, "depth": 3} if obj[1]>0: # {"feature": "Occupation", "instances": 938, "metric_value": 0.4448, "depth": 4} if obj[2]<=19.108887169188915: # {"feature": "Distance", "instances": 893, "metric_value": 0.449, "depth": 5} if obj[4]<=2: return 'False' elif obj[4]>2: return 'False' else: return 'False' elif obj[2]>19.108887169188915: # {"feature": "Distance", "instances": 45, "metric_value": 0.342, "depth": 5} if obj[4]>1: return 'False' elif obj[4]<=1: return 'False' else: return 'False' else: return 'False' elif obj[1]<=0: # {"feature": "Occupation", "instances": 545, "metric_value": 0.4774, "depth": 4} if obj[2]>1.391821210055043: # {"feature": "Distance", "instances": 440, "metric_value": 0.4955, "depth": 5} if obj[4]>1: return 'False' elif obj[4]<=1: return 'False' else: return 'False' elif obj[2]<=1.391821210055043: # {"feature": "Distance", "instances": 105, "metric_value": 0.394, "depth": 5} if obj[4]<=2: return 'False' elif obj[4]>2: return 'False' else: return 'False' else: return 'False' else: return 'False' elif obj[3]>1.0: # {"feature": "Occupation", "instances": 761, "metric_value": 0.4916, "depth": 3} if obj[2]<=13.94152603856423: # {"feature": "Distance", "instances": 642, "metric_value": 0.4962, "depth": 4} if obj[4]>1: # {"feature": "Education", "instances": 425, "metric_value": 0.4939, "depth": 5} if obj[1]<=3: return 'False' elif obj[1]>3: return 'True' else: return 'True' elif obj[4]<=1: # {"feature": "Education", "instances": 217, "metric_value": 0.4887, "depth": 5} if obj[1]<=4: return 'True' elif obj[1]>4: return 'True' else: return 'True' else: return 'True' elif obj[2]>13.94152603856423: # {"feature": "Education", "instances": 119, "metric_value": 0.4224, "depth": 4} if obj[1]>0: # {"feature": "Distance", "instances": 64, "metric_value": 0.4866, "depth": 5} if obj[4]<=2: return 'True' elif obj[4]>2: return 'False' else: return 'False' elif obj[1]<=0: # {"feature": "Distance", "instances": 55, "metric_value": 0.3335, "depth": 5} if obj[4]>1: return 'True' elif obj[4]<=1: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'False'
def find_decision(obj): if obj[0] > 1: if obj[4] <= 2: if obj[3] <= 1.0: if obj[2] > 0: if obj[1] <= 3: return 'True' elif obj[1] > 3: return 'True' else: return 'True' elif obj[2] <= 0: if obj[1] <= 0: return 'True' elif obj[1] > 0: return 'True' else: return 'True' else: return 'True' elif obj[3] > 1.0: if obj[1] > 1: if obj[2] <= 19: return 'True' elif obj[2] > 19: return 'False' else: return 'False' elif obj[1] <= 1: if obj[2] <= 18: return 'True' elif obj[2] > 18: return 'True' else: return 'True' else: return 'True' else: return 'True' elif obj[4] > 2: if obj[1] <= 4: if obj[3] > -1.0: if obj[2] <= 7.586715867158672: return 'False' elif obj[2] > 7.586715867158672: return 'False' else: return 'False' elif obj[3] <= -1.0: return 'False' else: return 'False' elif obj[1] > 4: return 'True' else: return 'True' else: return 'False' elif obj[0] <= 1: if obj[3] <= 1.0: if obj[1] > 0: if obj[2] <= 19.108887169188915: if obj[4] <= 2: return 'False' elif obj[4] > 2: return 'False' else: return 'False' elif obj[2] > 19.108887169188915: if obj[4] > 1: return 'False' elif obj[4] <= 1: return 'False' else: return 'False' else: return 'False' elif obj[1] <= 0: if obj[2] > 1.391821210055043: if obj[4] > 1: return 'False' elif obj[4] <= 1: return 'False' else: return 'False' elif obj[2] <= 1.391821210055043: if obj[4] <= 2: return 'False' elif obj[4] > 2: return 'False' else: return 'False' else: return 'False' else: return 'False' elif obj[3] > 1.0: if obj[2] <= 13.94152603856423: if obj[4] > 1: if obj[1] <= 3: return 'False' elif obj[1] > 3: return 'True' else: return 'True' elif obj[4] <= 1: if obj[1] <= 4: return 'True' elif obj[1] > 4: return 'True' else: return 'True' else: return 'True' elif obj[2] > 13.94152603856423: if obj[1] > 0: if obj[4] <= 2: return 'True' elif obj[4] > 2: return 'False' else: return 'False' elif obj[1] <= 0: if obj[4] > 1: return 'True' elif obj[4] <= 1: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'True' else: return 'False'
# Shallow Copy meta.append(arr) # Deep Copy meta.append(arr[:])
meta.append(arr) meta.append(arr[:])
def solve(data): result = 0 for lines in data: dimensions = list(map(int, lines.split('x'))) l = dimensions[0] w = dimensions[1] h = dimensions[2] dimensions[0] = l * w dimensions[1] = w * h dimensions[2] = h * l smallest_side = min(dimensions) for dimension in dimensions: result += dimension * 2 result += smallest_side return result
def solve(data): result = 0 for lines in data: dimensions = list(map(int, lines.split('x'))) l = dimensions[0] w = dimensions[1] h = dimensions[2] dimensions[0] = l * w dimensions[1] = w * h dimensions[2] = h * l smallest_side = min(dimensions) for dimension in dimensions: result += dimension * 2 result += smallest_side return result
person_schema = { "fname": {'type': 'string'}, "lname": {'type': 'string'}, "person_id": {'type': 'number'}, "timestamp": {'type': 'string'} }
person_schema = {'fname': {'type': 'string'}, 'lname': {'type': 'string'}, 'person_id': {'type': 'number'}, 'timestamp': {'type': 'string'}}
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def maxPathSum(self, root: TreeNode) -> int: self.res = float('-inf') def dfs(root): if not root: return 0 left = max(0, dfs(root.left)) right = max(0, dfs(root.right)) val = root.val + left + right self.res = max(self.res, val) return root.val + max(left, right) dfs(root) return self.res
class Solution: def max_path_sum(self, root: TreeNode) -> int: self.res = float('-inf') def dfs(root): if not root: return 0 left = max(0, dfs(root.left)) right = max(0, dfs(root.right)) val = root.val + left + right self.res = max(self.res, val) return root.val + max(left, right) dfs(root) return self.res
def dx(ux, u, nx, dx, order): # summation-by-parts finite difference operators for first derivatives du/dx m = nx-1 # second order accurate case if order==2: # calculate partial derivatives on the boundaries:[0, m] with one-sided difference operators ux[0, :] = (u[1, :] - u[0, :])/dx ux[m, :] = (u[m, :] - u[m-1, :])/dx #calculate partial derivatives in the interior:(1:nx-1) for j in range(1, m): ux[j, :] = (u[j+1, :] - u[j-1, :])/(2.0*dx) # fourth order accurate case if order==4: ################################################# # calculate partial derivatives on the boundaries:(0,1,2,3, : m-3, m-2, m-1, m) # with one-sided difference operators ux[0,:] = -24./17*u[0,:] + 59./34*u[1, :] - 4./17*u[2, :] - 3./34*u[3,:] ux[1,:] = -1./2*u[0,:] + 1./2*u[2, :] ; ux[2,:] = 4./43*u[0,:] - 59./86*u[1, :] + 59./86*u[3, :] - 4./43*u[4,:] ux[3,:] = 3./98*u[0,:] - 59./98*u[2, :] + 32./49*u[4, :] - 4./49*u[5,:] ux[m,:] = 24./17*u[m,:] - 59./34*u[m-1, :] + 4./17*u[m-2, :] + 3./34*u[m-3,:] ux[m-1,:] = 1./2*u[m,:] - 1./2*u[m-2, :] ; ux[m-2,:] = -4./43*u[m,:] + 59./86*u[m-1, :]- 59./86*u[m-3, :]+ 4./43*u[m-4,:] ux[m-3,:] = -3./98*u[m,:] + 59./98*u[m-2, :]- 32./49*u[m-4, :]+ 4./49*u[m-5,:] #------------------------------------------------------------------------------------------------------------------------------ for i in range(4, m - 3): ux[i,:] = 0.083333333333333*u[i-2,:] - 0.666666666666667*u[i-1,:] + 0.666666666666667*u[i+1,:] - 0.083333333333333*u[i+2,:] ux[:,:] = ux/dx # sixth order accurate case ################################################# if order==6: # calculate partial derivatives on the boundaries:(0,1,2,3,4,5,6 : m-6, m-5, m-4, m-3, m-2, m-1, m) # with one-sided difference operators ux[0,:] = -1.694834962162858*u[0,:] + 2.245634824947698*u[1,:] - 0.055649692295628*u[2,:] - 0.670383570370653*u[3,:]\ - 0.188774952148393*u[4,:] + 0.552135032829910*u[5,:] - 0.188126680800077*u[6,:] ux[1,:] = -0.434411786832708*u[0,:] + 0.107043134706685*u[2,:] + 0.420172642668695*u[3,:] + 0.119957288069806*u[4,:]\ - 0.328691543801578*u[5,:] + 0.122487487014485*u[6,:] - 0.006557221825386*u[7,:] ux[2,:] = 0.063307644169533*u[0,:] - 0.629491308812471*u[1,:] + 0.809935419586724*u[3,:] - 0.699016381364484*u[4,:]\ + 0.850345731199969*u[5,:] - 0.509589652965290*u[6,:] + 0.114508548186019*u[7,:] ux[3,:] = 0.110198643174386*u[0,:] - 0.357041083340051*u[1,:] - 0.117033418681039*u[2,:] + 0.120870009174558*u[4,:]\ + 0.349168902725368*u[5,:] - 0.104924741749615*u[6,:] - 0.001238311303608*u[7,:] ux[4,:] = 0.133544619364965*u[0,:] - 0.438678347579289*u[1,:] + 0.434686341173840*u[2,:] - 0.520172867814934*u[3,:]\ + 0.049912002176267*u[5,:] + 0.504693510958978*u[6,:] - 0.163985258279827*u[7,:] ux[5,:] = -0.127754693486067*u[0,:] + 0.393149407857401*u[1,:] - 0.172955234680916*u[2,:] - 0.491489487857764*u[3,:]\ - 0.016325050231672*u[4,:] + 0.428167552785852*u[6,:] - 0.025864364383975*u[7,:] + 0.013071869997141*u[8,:] ux[6,:] = 0.060008241515128*u[0,:] - 0.201971348965594*u[1,:] + 0.142885356631256*u[2,:] + 0.203603636754774*u[3,:]\ - 0.227565385120003*u[4,:] - 0.590259111130048*u[5,:] + 0.757462553894374*u[7,:] - 0.162184436527372*u[8,:]\ + 0.018020492947486*u[9,:] ux[7,:] = 0.009910488565285*u[1,:] - 0.029429452176588*u[2,:] + 0.002202493355677*u[3,:] + 0.067773581604826*u[4,:]\ + 0.032681945726690*u[5,:] - 0.694285851935105*u[6,:] + 0.743286642396343*u[8,:] - 0.148657328479269*u[9,:]\ + 0.016517480942141*u[10,:] ux[m-7,:] =-0.016517480942141*u[m-10,:] + 0.148657328479269*u[m-9,:] - 0.743286642396343*u[m-8,:] + 0.694285851935105*u[m-6,:]\ - 0.032681945726690*u[m-5,:] - 0.067773581604826*u[m-4,:] - 0.002202493355677*u[m-3,:] + 0.029429452176588*u[m-2,:]\ - 0.009910488565285*u[m-1,:] ux[m-6,:] =-0.018020492947486*u[m-9,:] + 0.162184436527372*u[m-8,:] - 0.757462553894374*u[m-7,:] + 0.590259111130048*u[m-5,:]\ + 0.227565385120003*u[m-4,:] - 0.203603636754774*u[m-3,:] - 0.142885356631256*u[m-2,:] + 0.201971348965594*u[m-1,:]\ - 0.060008241515128*u[m,:] ux[m-5,:] =-0.013071869997141*u[m-8,:] + 0.025864364383975*u[m-7,:] - 0.428167552785852*u[m-6,:] + 0.016325050231672*u[m-4,:]\ + 0.491489487857764*u[m-3,:] + 0.172955234680916*u[m-2,:] - 0.393149407857401*u[m-1,:] + 0.127754693486067*u[m,:] ux[m-4,:] = 0.163985258279827*u[m-7,:] - 0.504693510958978*u[m-6,:] - 0.049912002176267*u[m-5,:] + 0.520172867814934*u[m-3,:]\ - 0.434686341173840*u[m-2,:] + 0.438678347579289*u[m-1,:] - 0.133544619364965*u[m,:] ux[m-3,:] = 0.001238311303608*u[m-7,:] + 0.104924741749615*u[m-6,:] - 0.349168902725368*u[m-5,:] - 0.120870009174558*u[m-4,:]\ + 0.117033418681039*u[m-2,:] + 0.357041083340051*u[m-1,:] - 0.110198643174386*u[m,:] ux[m-2,:] =-0.114508548186019*u[m-7,:] + 0.509589652965290*u[m-6,:] - 0.850345731199969*u[m-5,:] + 0.699016381364484*u[m-4,:]\ - 0.809935419586724*u[m-3,:] + 0.629491308812471*u[m-1,:] - 0.063307644169533*u[m,:] ux[m-1,:] = 0.006557221825386*u[m-7,:] - 0.122487487014485*u[m-6,:] + 0.328691543801578*u[m-5,:] - 0.119957288069806*u[m-4,:]\ - 0.420172642668695*u[m-3,:] - 0.107043134706685*u[m-2,:] + 0.434411786832708*u[m,:] ux[m,:] = 0.188126680800077*u[m-6,:] - 0.552135032829910*u[m-5,:] + 0.188774952148393*u[m-4,:] + 0.670383570370653*u[m-3,:]\ + 0.055649692295628*u[m-2,:] - 2.245634824947698*u[m-1,:] + 1.694834962162858*u[m,:] for i in range(8, m-7): ux[i,:] = -0.016666666666667*u[i-3,:] + 0.15*u[i-2,:] - 0.75*u[i-1,:] + 0.75*u[i+1,:] - 0.15*u[i+2,:] + 0.016666666666667*u[i+3,:] ux[:,:] = ux[:,:]/dx def dy(uy, u, ny, dy, order): # summation-by-parts finite difference operators for first derivatives du/dy m = ny-1 if order == 2: uy[:,0]= u[:,1]-u[:,0] uy[: m] = u[:,m]-u[:,m-1] for j in range(1, m): uy[:, j] = 0.5*(u[:, j+1] - u[:, j-1]) uy[:,:] = 1.0/dy*uy[:,:] if order == 4: uy[:, 0] = -24.0/17.0*u[:,0] + 59.0/34.0*u[:,1] - 4.0/17.0*u[:, 2] - 3.0/34.0*u[:, 3] uy[:, 1] = -1.0/2.0*u[:,0] + 1.0/2.0*u[:,2] uy[:, 2] = 4.0/43.0*u[:,0] - 59.0/86.0*u[:,1] + 59.0/86.0*u[:,3] - 4.0/43.0*u[:,4] uy[:, 3] = 3.0/98.0*u[:,0] - 59.0/98.0*u[:,2] + 32.0/49.0*u[:,4] - 4.0/49.0*u[:,5] uy[:, m] = 24.0/17.0*u[:,m] - 59.0/34.0*u[:,m-1] + 4.0/17.0*u[:,m-2] + 3.0/34.0*u[:,m-3] uy[:, m-1] = 1.0/2.0*u[:,m] - 1.0/2.0*u[:,m-2] uy[:, m-2] = -4.0/43.0*u[:,m] + 59.0/86.0*u[:,m-1] - 59.0/86.0*u[:,m-3] + 4.0/43.0*u[:,m-4] uy[:, m-3] = -3.0/98.0*u[:,m] + 59.0/98.0*u[:,m-2] - 32.0/49.0*u[:,m-4] + 4.0/49.0*u[:,m-5] for j in range(4, m-3): uy[:, j] = 1.0/12.0*u[:,j-2] - 2.0/3.0*u[:,j-1] + 2.0/3.0*u[:,j+1] - 1.0/12.0*u[:,j+2] uy[:,:] = 1.0/dy*uy[:,:] if order == 6: uy[:,0] = -1.694834962162858*u[:,0] + 2.245634824947698*u[:,1] - 0.055649692295628*u[:,2] - 0.670383570370653*u[:,3]\ - 0.188774952148393*u[:,4] + 0.552135032829910*u[:,5] - 0.188126680800077*u[:,6] uy[:,1] = -0.434411786832708*u[:,0] + 0.107043134706685*u[:,2] + 0.420172642668695*u[:,3] + 0.119957288069806*u[:,4]\ - 0.328691543801578*u[:,5] + 0.122487487014485*u[:,6] - 0.006557221825386*u[:,7] uy[:,2] = 0.063307644169533*u[:,0] - 0.629491308812471*u[:,1] + 0.809935419586724*u[:,3] - 0.699016381364484*u[:,4]\ + 0.850345731199969*u[:,5] - 0.509589652965290*u[:,6] + 0.114508548186019*u[:,7] uy[:,3] = 0.110198643174386*u[:,0] - 0.357041083340051*u[:,1] - 0.117033418681039*u[:,2] + 0.120870009174558*u[:,4]\ + 0.349168902725368*u[:,5] - 0.104924741749615*u[:,6] - 0.001238311303608*u[:,7] uy[:,4] = 0.133544619364965*u[:,0] - 0.438678347579289*u[:,1] + 0.434686341173840*u[:,2] - 0.520172867814934*u[:,3]\ + 0.049912002176267*u[:,5] + 0.504693510958978*u[:,6] - 0.163985258279827*u[:,7] uy[:,5] = -0.127754693486067*u[:,0] + 0.393149407857401*u[:,1] - 0.172955234680916*u[:,2] - 0.491489487857764*u[:,3]\ - 0.016325050231672*u[:,4] + 0.428167552785852*u[:,6] - 0.025864364383975*u[:,7] + 0.013071869997141*u[:,8] uy[:,6] = 0.060008241515128*u[:,0] - 0.201971348965594*u[:,1] + 0.142885356631256*u[:,2] + 0.203603636754774*u[:,3]\ - 0.227565385120003*u[:,4] - 0.590259111130048*u[:,5] + 0.757462553894374*u[:,7] - 0.162184436527372*u[:,8]\ + 0.018020492947486*u[:,9] uy[:,7] = 0.009910488565285*u[:,1] - 0.029429452176588*u[:,2] + 0.002202493355677*u[:,3] + 0.067773581604826*u[:,4]\ + 0.032681945726690*u[:,5] - 0.694285851935105*u[:,6] + 0.743286642396343*u[:,8] - 0.148657328479269*u[:,9]\ + 0.016517480942141*u[:,10] uy[:,m-7] =-0.016517480942141*u[:,m-10] + 0.148657328479269*u[:,m-9] - 0.743286642396343*u[:,m-8] + 0.694285851935105*u[:,m-6]\ - 0.032681945726690*u[:,m-5] - 0.067773581604826*u[:,m-4] - 0.002202493355677*u[:,m-3] + 0.029429452176588*u[:,m-2]\ - 0.009910488565285*u[:,m-1] uy[:,m-6] =-0.018020492947486*u[:,m-9] + 0.162184436527372*u[:,m-8] - 0.757462553894374*u[:,m-7] + 0.590259111130048*u[:,m-5]\ + 0.227565385120003*u[:,m-4] - 0.203603636754774*u[:,m-3] - 0.142885356631256*u[:,m-2] + 0.201971348965594*u[:,m-1]\ - 0.060008241515128*u[:,m] uy[:,m-5] =-0.013071869997141*u[:,m-8] + 0.025864364383975*u[:,m-7] - 0.428167552785852*u[:,m-6] + 0.016325050231672*u[:,m-4]\ + 0.491489487857764*u[:,m-3] + 0.172955234680916*u[:,m-2] - 0.393149407857401*u[:,m-1] + 0.127754693486067*u[:,m] uy[:,m-4] = 0.163985258279827*u[:,m-7] - 0.504693510958978*u[:,m-6] - 0.049912002176267*u[:,m-5] + 0.520172867814934*u[:,m-3]\ - 0.434686341173840*u[:,m-2] + 0.438678347579289*u[:,m-1] - 0.133544619364965*u[:,m] uy[:,m-3] = 0.001238311303608*u[:,m-7] + 0.104924741749615*u[:,m-6] - 0.349168902725368*u[:,m-5] - 0.120870009174558*u[:,m-4]\ + 0.117033418681039*u[:,m-2] + 0.357041083340051*u[:,m-1] - 0.110198643174386*u[:,m] uy[:,m-2] =-0.114508548186019*u[:,m-7] + 0.509589652965290*u[:,m-6] - 0.850345731199969*u[:,m-5] + 0.699016381364484*u[:,m-4]\ - 0.809935419586724*u[:,m-3] + 0.629491308812471*u[:,m-1] - 0.063307644169533*u[:,m] uy[:,m-1] = 0.006557221825386*u[:,m-7] - 0.122487487014485*u[:,m-6] + 0.328691543801578*u[:,m-5] - 0.119957288069806*u[:,m-4]\ - 0.420172642668695*u[:,m-3] - 0.107043134706685*u[:,m-2] + 0.434411786832708*u[:,m] uy[:,m] = 0.188126680800077*u[:,m-6] - 0.552135032829910*u[:,m-5] + 0.188774952148393*u[:,m-4] + 0.670383570370653*u[:,m-3]\ + 0.055649692295628*u[:,m-2] - 2.245634824947698*u[:,m-1] + 1.694834962162858*u[:,m] for j in range(8, m-7): uy[:, j] = -0.016666666666666667*u[:,j-3] + 0.15*u[:,j-2] - 0.75*u[:,j-1] + 0.75*u[:,j+1] - 0.15*u[:,j+2] + 0.01666666666666667*u[:,j+3] uy[:,:] = (1.0/dy)*uy[:,:]; def dx2d(ux, u, nx, i, j, dx, order): # summation-by-parts finite difference operators for first derivatives du/dx m = nx-1 # second order accurate case if order==2: # calculate partial derivatives on the boundaries:[0, m] with one-sided difference operators if i == 0: ux[:] = (u[1, j, :] - u[0,j, :])/dx if i == m: ux[:] = (u[m,j, :] - u[m-1,j, :])/dx #calculate partial derivatives in the interior:(1:nx-1) if (i > 0) and (i < m): ux[:] = (u[i+1, j,:] - u[i-1, j,:])/(2.0*dx) # fourth order accurate case if order==4: ################################################# # calculate partial derivatives on the boundaries:(0,1,2,3, : m-3, m-2, m-1, m) # with one-sided difference operators if i == 0: ux[:] = -24./17*u[0,j,:] + 59./34*u[1, j,:] - 4./17*u[2, j,:] - 3./34*u[3,j,:] if i == 1: ux[:] = -1./2*u[0,j,:] + 1./2*u[2, j,:] if i == 2: ux[:] = 4./43*u[0,j,:] - 59./86*u[1, j,:] + 59./86*u[3, j,:] - 4./43*u[4,j,:] if i == 3: ux[:] = 3./98*u[0,j,:] - 59./98*u[2, j,:] + 32./49*u[4, j,:] - 4./49*u[5,j,:] if i == m: ux[:] = 24./17*u[m,j,:] - 59./34*u[m-1, j,:] + 4./17*u[m-2, j,:] + 3./34*u[m-3,j,:] if i == m-1: ux[:] = 1./2*u[m,j,:] - 1./2*u[m-2, j,:] if i == m-2: ux[:] = -4./43*u[m,j,:] + 59./86*u[m-1, j,:]- 59./86*u[m-3, j,:]+ 4./43*u[m-4,j,:] if i == m-3: ux[:] = -3./98*u[m,j,:] + 59./98*u[m-2, j,:]- 32./49*u[m-4, j,:]+ 4./49*u[m-5,j,:] #------------------------------------------------------------------------------------------------------------------------------ if (i > 3) and (i<m-3): ux[:] = 0.083333333333333*u[i-2,j,:] - 0.666666666666667*u[i-1,j,:] + 0.666666666666667*u[i+1,j,:] - 0.083333333333333*u[i+2,j,:] ux[:] = ux[:]/dx # sixth order accurate case ################################################# if order==6: # calculate partial derivatives on the boundaries:(0,1,2,3,4,5,6 : m-6, m-5, m-4, m-3, m-2, m-1, m) # with one-sided difference operators if i == 0: ux[:] = -1.694834962162858*u[0,j,:] + 2.245634824947698*u[1,j,:] - 0.055649692295628*u[2,j,:] - 0.670383570370653*u[3,j,:]\ - 0.188774952148393*u[4,j,:] + 0.552135032829910*u[5,j,:] - 0.188126680800077*u[6,j,:] if i == 1: ux[:] = -0.434411786832708*u[0,j,:] + 0.107043134706685*u[2,j,:] + 0.420172642668695*u[3,j,:] + 0.119957288069806*u[4,j,:]\ - 0.328691543801578*u[5,j,:] + 0.122487487014485*u[6,j,:] - 0.006557221825386*u[7,j,:] if i == 2: ux[:] = 0.063307644169533*u[0,j,:] - 0.629491308812471*u[1,j,:] + 0.809935419586724*u[3,j,:] - 0.699016381364484*u[4,j,:]\ + 0.850345731199969*u[5,j,:] - 0.509589652965290*u[6,j,:] + 0.114508548186019*u[7,j,:] if i == 3: ux[:] = 0.110198643174386*u[0,j,:] - 0.357041083340051*u[1,j,:] - 0.117033418681039*u[2,j,:] + 0.120870009174558*u[4,j,:]\ + 0.349168902725368*u[5,j,:] - 0.104924741749615*u[6,j,:] - 0.001238311303608*u[7,j,:] if i == 4: ux[:] = 0.133544619364965*u[0,j,:] - 0.438678347579289*u[1,j,:] + 0.434686341173840*u[2,j,:] - 0.520172867814934*u[3,j,:]\ + 0.049912002176267*u[5,j,:] + 0.504693510958978*u[6,j,:] - 0.163985258279827*u[7,j,:] if i == 5: ux[:] = -0.127754693486067*u[0,j,:] + 0.393149407857401*u[1,j,:] - 0.172955234680916*u[2,j,:] - 0.491489487857764*u[3,j,:]\ - 0.016325050231672*u[4,j,:] + 0.428167552785852*u[6,j,:] - 0.025864364383975*u[7,j,:] + 0.013071869997141*u[8,j,:] if i == 6: ux[:] = 0.060008241515128*u[0,j,:] - 0.201971348965594*u[1,j,:] + 0.142885356631256*u[2,j,:] + 0.203603636754774*u[3,j,:]\ - 0.227565385120003*u[4,j,:] - 0.590259111130048*u[5,j,:] + 0.757462553894374*u[7,j,:] - 0.162184436527372*u[8,j,:]\ + 0.018020492947486*u[9,j,:] if i == 7: ux[:] = 0.009910488565285*u[1,j,:] - 0.029429452176588*u[2,j,:] + 0.002202493355677*u[3,j,:] + 0.067773581604826*u[4,j,:]\ + 0.032681945726690*u[5,j,:] - 0.694285851935105*u[6,j,:] + 0.743286642396343*u[8,j,:] - 0.148657328479269*u[9,j,:]\ + 0.016517480942141*u[10,j,:] if i == m-7: ux[:] =-0.016517480942141*u[m-10,j,:] + 0.148657328479269*u[m-9,j,:] - 0.743286642396343*u[m-8,j,:] + 0.694285851935105*u[m-6,j,:]\ - 0.032681945726690*u[m-5,j,:] - 0.067773581604826*u[m-4,j,:] - 0.002202493355677*u[m-3,j,:] + 0.029429452176588*u[m-2,j,:]\ - 0.009910488565285*u[m-1,j,:] if i == m-6: ux[:] =-0.018020492947486*u[m-9,j,:] + 0.162184436527372*u[m-8,j,:] - 0.757462553894374*u[m-7,j,:] + 0.590259111130048*u[m-5,j,:]\ + 0.227565385120003*u[m-4,j,:] - 0.203603636754774*u[m-3,j,:] - 0.142885356631256*u[m-2,j,:] + 0.201971348965594*u[m-1,j,:]\ - 0.060008241515128*u[m,j,:] if i == m-5: ux[:] =-0.013071869997141*u[m-8,j,:] + 0.025864364383975*u[m-7,j,:] - 0.428167552785852*u[m-6,j,:] + 0.016325050231672*u[m-4,j,:]\ + 0.491489487857764*u[m-3,j,:] + 0.172955234680916*u[m-2,j,:] - 0.393149407857401*u[m-1,j,:] + 0.127754693486067*u[m,j,:] if i == m-4: ux[:] = 0.163985258279827*u[m-7,j,:] - 0.504693510958978*u[m-6,j,:] - 0.049912002176267*u[m-5,j,:] + 0.520172867814934*u[m-3,j,:]\ - 0.434686341173840*u[m-2,j,:] + 0.438678347579289*u[m-1,j,:] - 0.133544619364965*u[m,j,:] if i == m-3: ux[:] = 0.001238311303608*u[m-7,j,:] + 0.104924741749615*u[m-6,j,:] - 0.349168902725368*u[m-5,j,:] - 0.120870009174558*u[m-4,j,:]\ + 0.117033418681039*u[m-2,j,:] + 0.357041083340051*u[m-1,j,:] - 0.110198643174386*u[m,j,:] if i == m-2: ux[:] =-0.114508548186019*u[m-7,j,:] + 0.509589652965290*u[m-6,j,:] - 0.850345731199969*u[m-5,j,:] + 0.699016381364484*u[m-4,j,:]\ - 0.809935419586724*u[m-3,j,:] + 0.629491308812471*u[m-1,j,:] - 0.063307644169533*u[m,j,:] if i == m-1: ux[:] = 0.006557221825386*u[m-7,j,:] - 0.122487487014485*u[m-6,j,:] + 0.328691543801578*u[m-5,j,:] - 0.119957288069806*u[m-4,j,:]\ - 0.420172642668695*u[m-3,j,:] - 0.107043134706685*u[m-2,j,:] + 0.434411786832708*u[m,j,:] if i == m: ux[:] = 0.188126680800077*u[m-6,j,:] - 0.552135032829910*u[m-5,j,:] + 0.188774952148393*u[m-4,j,:] + 0.670383570370653*u[m-3,j,:]\ + 0.055649692295628*u[m-2,j,:] - 2.245634824947698*u[m-1,j,:] + 1.694834962162858*u[m,j,:] if (i > 7) and (i < m-7): ux[:] = -0.016666666666667*u[i-3,j,:] + 0.15*u[i-2,j,:] - 0.75*u[i-1,j,:] + 0.75*u[i+1,j,:] - 0.15*u[i+2,j,:] + 0.016666666666667*u[i+3,j,:] ux[:] = ux[:]/dx def dy2d(uy, u, ny, i, j, dy, order): # summation-by-parts finite difference operators for first derivatives du/dy m = ny-1 if order == 2: if j == 0: uy[:]= u[i,1,:]-u[i,0,:] if j == m: uy[:] = u[i,m,:]-u[i,m-1,:] if (j > 0) and j < m: uy[:] = 0.5*(u[i, j+1,:] - u[i, j-1,:]) uy[:] = 1.0/dy*uy[:] if order == 4: if j == 0: uy[:] = -24.0/17.0*u[i,0,:] + 59.0/34.0*u[i,1,:] - 4.0/17.0*u[i, 2,:] - 3.0/34.0*u[i, 3,:] if j == 1: uy[:] = -1.0/2.0*u[i,0,:] + 1.0/2.0*u[i,2,:] if j == 2: uy[:] = 4.0/43.0*u[i,0,:] - 59.0/86.0*u[i,1,:] + 59.0/86.0*u[i,3,:] - 4.0/43.0*u[i,4,:] if j == 3: uy[:] = 3.0/98.0*u[i,0,:] - 59.0/98.0*u[i,2,:] + 32.0/49.0*u[i,4,:] - 4.0/49.0*u[i,5,:] if j == m: uy[:] = 24.0/17.0*u[i,m,:] - 59.0/34.0*u[i,m-1,:] + 4.0/17.0*u[i,m-2,:] + 3.0/34.0*u[i,m-3,:] if j == m-1: uy[:] = 1.0/2.0*u[i,m,:] - 1.0/2.0*u[i,m-2,:] if j == m-2: uy[:] = -4.0/43.0*u[i,m,:] + 59.0/86.0*u[i,m-1,:] - 59.0/86.0*u[i,m-3,:] + 4.0/43.0*u[i,m-4,:] if j == m-3: uy[:] = -3.0/98.0*u[i,m,:] + 59.0/98.0*u[i,m-2,:] - 32.0/49.0*u[i,m-4,:] + 4.0/49.0*u[i,m-5,:] if (j> 3) and (j<m-3): uy[:] = 1.0/12.0*u[i,j-2,:] - 2.0/3.0*u[i,j-1,:] + 2.0/3.0*u[i,j+1,:] - 1.0/12.0*u[i,j+2,:] uy[:] = 1.0/dy*uy[:] if order == 6: if j == 0: uy[:] = -1.694834962162858*u[i,0,:] + 2.245634824947698*u[i,1,:] - 0.055649692295628*u[i,2,:] - 0.670383570370653*u[i,3,:]\ - 0.188774952148393*u[i,4,:] + 0.552135032829910*u[i,5,:] - 0.188126680800077*u[i,6,:] if j == 1: uy[:] = -0.434411786832708*u[i,0,:] + 0.107043134706685*u[i,2,:] + 0.420172642668695*u[i,3,:] + 0.119957288069806*u[i,4,:]\ - 0.328691543801578*u[i,5,:] + 0.122487487014485*u[i,6,:] - 0.006557221825386*u[i,7,:] if j == 2: uy[:] = 0.063307644169533*u[i,0,:] - 0.629491308812471*u[i,1,:] + 0.809935419586724*u[i,3,:] - 0.699016381364484*u[i,4,:]\ + 0.850345731199969*u[i,5,:] - 0.509589652965290*u[i,6,:] + 0.114508548186019*u[i,7,:] if j == 3: uy[:] = 0.110198643174386*u[i,0,:] - 0.357041083340051*u[i,1,:] - 0.117033418681039*u[i,2,:] + 0.120870009174558*u[i,4,:]\ + 0.349168902725368*u[i,5,:] - 0.104924741749615*u[i,6,:] - 0.001238311303608*u[i,7,:] if j == 4: uy[:] = 0.133544619364965*u[i,0,:] - 0.438678347579289*u[i,1,:] + 0.434686341173840*u[i,2,:] - 0.520172867814934*u[i,3,:]\ + 0.049912002176267*u[i,5,:] + 0.504693510958978*u[i,6,:] - 0.163985258279827*u[i,7,:] if j == 5: uy[:] = -0.127754693486067*u[i,0,:] + 0.393149407857401*u[i,1,:] - 0.172955234680916*u[i,2,:] - 0.491489487857764*u[i,3,:]\ - 0.016325050231672*u[i,4,:] + 0.428167552785852*u[i,6,:] - 0.025864364383975*u[i,7,:] + 0.013071869997141*u[i,8,:] if j == 6: uy[:] = 0.060008241515128*u[i,0,:] - 0.201971348965594*u[i,1,:] + 0.142885356631256*u[i,2,:] + 0.203603636754774*u[i,3,:]\ - 0.227565385120003*u[i,4,:] - 0.590259111130048*u[i,5,:] + 0.757462553894374*u[i,7,:] - 0.162184436527372*u[i,8,:]\ + 0.018020492947486*u[i,9,:] if j == 7: uy[:] = 0.009910488565285*u[i,1,:] - 0.029429452176588*u[i,2,:] + 0.002202493355677*u[i,3,:] + 0.067773581604826*u[i,4,:]\ + 0.032681945726690*u[i,5,:] - 0.694285851935105*u[i,6,:] + 0.743286642396343*u[i,8,:] - 0.148657328479269*u[i,9,:]\ + 0.016517480942141*u[i,10,:] if j == m-7: uy[:] =-0.016517480942141*u[i,m-10,:] + 0.148657328479269*u[i,m-9,:] - 0.743286642396343*u[i,m-8,:] + 0.694285851935105*u[i,m-6,:]\ - 0.032681945726690*u[i,m-5,:] - 0.067773581604826*u[i,m-4,:] - 0.002202493355677*u[i,m-3,:] + 0.029429452176588*u[i,m-2,:]\ - 0.009910488565285*u[i,m-1,:] if j == m-6: uy[:] =-0.018020492947486*u[i,m-9,:] + 0.162184436527372*u[i,m-8,:] - 0.757462553894374*u[i,m-7,:] + 0.590259111130048*u[i,m-5,:]\ + 0.227565385120003*u[i,m-4,:] - 0.203603636754774*u[i,m-3,:] - 0.142885356631256*u[i,m-2,:] + 0.201971348965594*u[i,m-1,:]\ - 0.060008241515128*u[i,m,:] if j == m-5: uy[:] =-0.013071869997141*u[i,m-8,:] + 0.025864364383975*u[i,m-7,:] - 0.428167552785852*u[i,m-6,:] + 0.016325050231672*u[i,m-4,:]\ + 0.491489487857764*u[i,m-3,:] + 0.172955234680916*u[i,m-2,:] - 0.393149407857401*u[i,m-1,:] + 0.127754693486067*u[i,m,:] if j == m-4: uy[:] = 0.163985258279827*u[i,m-7,:] - 0.504693510958978*u[i,m-6,:] - 0.049912002176267*u[i,m-5,:] + 0.520172867814934*u[i,m-3,:]\ - 0.434686341173840*u[i,m-2,:] + 0.438678347579289*u[i,m-1,:] - 0.133544619364965*u[i,m,:] if j == m-3: uy[:] = 0.001238311303608*u[i,m-7,:] + 0.104924741749615*u[i,m-6,:] - 0.349168902725368*u[i,m-5,:] - 0.120870009174558*u[i,m-4,:]\ + 0.117033418681039*u[i,m-2,:] + 0.357041083340051*u[i,m-1,:] - 0.110198643174386*u[i,m,:] if j == m-2: uy[:] =-0.114508548186019*u[i,m-7,:] + 0.509589652965290*u[i,m-6,:] - 0.850345731199969*u[i,m-5,:] + 0.699016381364484*u[i,m-4,:]\ - 0.809935419586724*u[i,m-3,:] + 0.629491308812471*u[i,m-1,:] - 0.063307644169533*u[i,m,:] if j == m-1: uy[:] = 0.006557221825386*u[i,m-7,:] - 0.122487487014485*u[i,m-6,:] + 0.328691543801578*u[i,m-5,:] - 0.119957288069806*u[i,m-4,:]\ - 0.420172642668695*u[i,m-3,:] - 0.107043134706685*u[i,m-2,:] + 0.434411786832708*u[i,m,:] if j == m: uy[:] = 0.188126680800077*u[i,m-6,:] - 0.552135032829910*u[i,m-5,:] + 0.188774952148393*u[i,m-4,:] + 0.670383570370653*u[i,m-3,:]\ + 0.055649692295628*u[i,m-2,:] - 2.245634824947698*u[i,m-1,:] + 1.694834962162858*u[i,m,:] if (j> 7) and (j<m-7): uy[:] = -0.016666666666666667*u[i,j-3,:] + 0.15*u[i,j-2,:] - 0.75*u[i,j-1,:] + 0.75*u[i,j+1,:] - 0.15*u[i,j+2,:] + 0.01666666666666667*u[i,j+3,:] uy[:] = (1.0/dy)*uy[:]
def dx(ux, u, nx, dx, order): m = nx - 1 if order == 2: ux[0, :] = (u[1, :] - u[0, :]) / dx ux[m, :] = (u[m, :] - u[m - 1, :]) / dx for j in range(1, m): ux[j, :] = (u[j + 1, :] - u[j - 1, :]) / (2.0 * dx) if order == 4: ux[0, :] = -24.0 / 17 * u[0, :] + 59.0 / 34 * u[1, :] - 4.0 / 17 * u[2, :] - 3.0 / 34 * u[3, :] ux[1, :] = -1.0 / 2 * u[0, :] + 1.0 / 2 * u[2, :] ux[2, :] = 4.0 / 43 * u[0, :] - 59.0 / 86 * u[1, :] + 59.0 / 86 * u[3, :] - 4.0 / 43 * u[4, :] ux[3, :] = 3.0 / 98 * u[0, :] - 59.0 / 98 * u[2, :] + 32.0 / 49 * u[4, :] - 4.0 / 49 * u[5, :] ux[m, :] = 24.0 / 17 * u[m, :] - 59.0 / 34 * u[m - 1, :] + 4.0 / 17 * u[m - 2, :] + 3.0 / 34 * u[m - 3, :] ux[m - 1, :] = 1.0 / 2 * u[m, :] - 1.0 / 2 * u[m - 2, :] ux[m - 2, :] = -4.0 / 43 * u[m, :] + 59.0 / 86 * u[m - 1, :] - 59.0 / 86 * u[m - 3, :] + 4.0 / 43 * u[m - 4, :] ux[m - 3, :] = -3.0 / 98 * u[m, :] + 59.0 / 98 * u[m - 2, :] - 32.0 / 49 * u[m - 4, :] + 4.0 / 49 * u[m - 5, :] for i in range(4, m - 3): ux[i, :] = 0.083333333333333 * u[i - 2, :] - 0.666666666666667 * u[i - 1, :] + 0.666666666666667 * u[i + 1, :] - 0.083333333333333 * u[i + 2, :] ux[:, :] = ux / dx if order == 6: ux[0, :] = -1.694834962162858 * u[0, :] + 2.245634824947698 * u[1, :] - 0.055649692295628 * u[2, :] - 0.670383570370653 * u[3, :] - 0.188774952148393 * u[4, :] + 0.55213503282991 * u[5, :] - 0.188126680800077 * u[6, :] ux[1, :] = -0.434411786832708 * u[0, :] + 0.107043134706685 * u[2, :] + 0.420172642668695 * u[3, :] + 0.119957288069806 * u[4, :] - 0.328691543801578 * u[5, :] + 0.122487487014485 * u[6, :] - 0.006557221825386 * u[7, :] ux[2, :] = 0.063307644169533 * u[0, :] - 0.629491308812471 * u[1, :] + 0.809935419586724 * u[3, :] - 0.699016381364484 * u[4, :] + 0.850345731199969 * u[5, :] - 0.50958965296529 * u[6, :] + 0.114508548186019 * u[7, :] ux[3, :] = 0.110198643174386 * u[0, :] - 0.357041083340051 * u[1, :] - 0.117033418681039 * u[2, :] + 0.120870009174558 * u[4, :] + 0.349168902725368 * u[5, :] - 0.104924741749615 * u[6, :] - 0.001238311303608 * u[7, :] ux[4, :] = 0.133544619364965 * u[0, :] - 0.438678347579289 * u[1, :] + 0.43468634117384 * u[2, :] - 0.520172867814934 * u[3, :] + 0.049912002176267 * u[5, :] + 0.504693510958978 * u[6, :] - 0.163985258279827 * u[7, :] ux[5, :] = -0.127754693486067 * u[0, :] + 0.393149407857401 * u[1, :] - 0.172955234680916 * u[2, :] - 0.491489487857764 * u[3, :] - 0.016325050231672 * u[4, :] + 0.428167552785852 * u[6, :] - 0.025864364383975 * u[7, :] + 0.013071869997141 * u[8, :] ux[6, :] = 0.060008241515128 * u[0, :] - 0.201971348965594 * u[1, :] + 0.142885356631256 * u[2, :] + 0.203603636754774 * u[3, :] - 0.227565385120003 * u[4, :] - 0.590259111130048 * u[5, :] + 0.757462553894374 * u[7, :] - 0.162184436527372 * u[8, :] + 0.018020492947486 * u[9, :] ux[7, :] = 0.009910488565285 * u[1, :] - 0.029429452176588 * u[2, :] + 0.002202493355677 * u[3, :] + 0.067773581604826 * u[4, :] + 0.03268194572669 * u[5, :] - 0.694285851935105 * u[6, :] + 0.743286642396343 * u[8, :] - 0.148657328479269 * u[9, :] + 0.016517480942141 * u[10, :] ux[m - 7, :] = -0.016517480942141 * u[m - 10, :] + 0.148657328479269 * u[m - 9, :] - 0.743286642396343 * u[m - 8, :] + 0.694285851935105 * u[m - 6, :] - 0.03268194572669 * u[m - 5, :] - 0.067773581604826 * u[m - 4, :] - 0.002202493355677 * u[m - 3, :] + 0.029429452176588 * u[m - 2, :] - 0.009910488565285 * u[m - 1, :] ux[m - 6, :] = -0.018020492947486 * u[m - 9, :] + 0.162184436527372 * u[m - 8, :] - 0.757462553894374 * u[m - 7, :] + 0.590259111130048 * u[m - 5, :] + 0.227565385120003 * u[m - 4, :] - 0.203603636754774 * u[m - 3, :] - 0.142885356631256 * u[m - 2, :] + 0.201971348965594 * u[m - 1, :] - 0.060008241515128 * u[m, :] ux[m - 5, :] = -0.013071869997141 * u[m - 8, :] + 0.025864364383975 * u[m - 7, :] - 0.428167552785852 * u[m - 6, :] + 0.016325050231672 * u[m - 4, :] + 0.491489487857764 * u[m - 3, :] + 0.172955234680916 * u[m - 2, :] - 0.393149407857401 * u[m - 1, :] + 0.127754693486067 * u[m, :] ux[m - 4, :] = 0.163985258279827 * u[m - 7, :] - 0.504693510958978 * u[m - 6, :] - 0.049912002176267 * u[m - 5, :] + 0.520172867814934 * u[m - 3, :] - 0.43468634117384 * u[m - 2, :] + 0.438678347579289 * u[m - 1, :] - 0.133544619364965 * u[m, :] ux[m - 3, :] = 0.001238311303608 * u[m - 7, :] + 0.104924741749615 * u[m - 6, :] - 0.349168902725368 * u[m - 5, :] - 0.120870009174558 * u[m - 4, :] + 0.117033418681039 * u[m - 2, :] + 0.357041083340051 * u[m - 1, :] - 0.110198643174386 * u[m, :] ux[m - 2, :] = -0.114508548186019 * u[m - 7, :] + 0.50958965296529 * u[m - 6, :] - 0.850345731199969 * u[m - 5, :] + 0.699016381364484 * u[m - 4, :] - 0.809935419586724 * u[m - 3, :] + 0.629491308812471 * u[m - 1, :] - 0.063307644169533 * u[m, :] ux[m - 1, :] = 0.006557221825386 * u[m - 7, :] - 0.122487487014485 * u[m - 6, :] + 0.328691543801578 * u[m - 5, :] - 0.119957288069806 * u[m - 4, :] - 0.420172642668695 * u[m - 3, :] - 0.107043134706685 * u[m - 2, :] + 0.434411786832708 * u[m, :] ux[m, :] = 0.188126680800077 * u[m - 6, :] - 0.55213503282991 * u[m - 5, :] + 0.188774952148393 * u[m - 4, :] + 0.670383570370653 * u[m - 3, :] + 0.055649692295628 * u[m - 2, :] - 2.245634824947698 * u[m - 1, :] + 1.694834962162858 * u[m, :] for i in range(8, m - 7): ux[i, :] = -0.016666666666667 * u[i - 3, :] + 0.15 * u[i - 2, :] - 0.75 * u[i - 1, :] + 0.75 * u[i + 1, :] - 0.15 * u[i + 2, :] + 0.016666666666667 * u[i + 3, :] ux[:, :] = ux[:, :] / dx def dy(uy, u, ny, dy, order): m = ny - 1 if order == 2: uy[:, 0] = u[:, 1] - u[:, 0] uy[:m] = u[:, m] - u[:, m - 1] for j in range(1, m): uy[:, j] = 0.5 * (u[:, j + 1] - u[:, j - 1]) uy[:, :] = 1.0 / dy * uy[:, :] if order == 4: uy[:, 0] = -24.0 / 17.0 * u[:, 0] + 59.0 / 34.0 * u[:, 1] - 4.0 / 17.0 * u[:, 2] - 3.0 / 34.0 * u[:, 3] uy[:, 1] = -1.0 / 2.0 * u[:, 0] + 1.0 / 2.0 * u[:, 2] uy[:, 2] = 4.0 / 43.0 * u[:, 0] - 59.0 / 86.0 * u[:, 1] + 59.0 / 86.0 * u[:, 3] - 4.0 / 43.0 * u[:, 4] uy[:, 3] = 3.0 / 98.0 * u[:, 0] - 59.0 / 98.0 * u[:, 2] + 32.0 / 49.0 * u[:, 4] - 4.0 / 49.0 * u[:, 5] uy[:, m] = 24.0 / 17.0 * u[:, m] - 59.0 / 34.0 * u[:, m - 1] + 4.0 / 17.0 * u[:, m - 2] + 3.0 / 34.0 * u[:, m - 3] uy[:, m - 1] = 1.0 / 2.0 * u[:, m] - 1.0 / 2.0 * u[:, m - 2] uy[:, m - 2] = -4.0 / 43.0 * u[:, m] + 59.0 / 86.0 * u[:, m - 1] - 59.0 / 86.0 * u[:, m - 3] + 4.0 / 43.0 * u[:, m - 4] uy[:, m - 3] = -3.0 / 98.0 * u[:, m] + 59.0 / 98.0 * u[:, m - 2] - 32.0 / 49.0 * u[:, m - 4] + 4.0 / 49.0 * u[:, m - 5] for j in range(4, m - 3): uy[:, j] = 1.0 / 12.0 * u[:, j - 2] - 2.0 / 3.0 * u[:, j - 1] + 2.0 / 3.0 * u[:, j + 1] - 1.0 / 12.0 * u[:, j + 2] uy[:, :] = 1.0 / dy * uy[:, :] if order == 6: uy[:, 0] = -1.694834962162858 * u[:, 0] + 2.245634824947698 * u[:, 1] - 0.055649692295628 * u[:, 2] - 0.670383570370653 * u[:, 3] - 0.188774952148393 * u[:, 4] + 0.55213503282991 * u[:, 5] - 0.188126680800077 * u[:, 6] uy[:, 1] = -0.434411786832708 * u[:, 0] + 0.107043134706685 * u[:, 2] + 0.420172642668695 * u[:, 3] + 0.119957288069806 * u[:, 4] - 0.328691543801578 * u[:, 5] + 0.122487487014485 * u[:, 6] - 0.006557221825386 * u[:, 7] uy[:, 2] = 0.063307644169533 * u[:, 0] - 0.629491308812471 * u[:, 1] + 0.809935419586724 * u[:, 3] - 0.699016381364484 * u[:, 4] + 0.850345731199969 * u[:, 5] - 0.50958965296529 * u[:, 6] + 0.114508548186019 * u[:, 7] uy[:, 3] = 0.110198643174386 * u[:, 0] - 0.357041083340051 * u[:, 1] - 0.117033418681039 * u[:, 2] + 0.120870009174558 * u[:, 4] + 0.349168902725368 * u[:, 5] - 0.104924741749615 * u[:, 6] - 0.001238311303608 * u[:, 7] uy[:, 4] = 0.133544619364965 * u[:, 0] - 0.438678347579289 * u[:, 1] + 0.43468634117384 * u[:, 2] - 0.520172867814934 * u[:, 3] + 0.049912002176267 * u[:, 5] + 0.504693510958978 * u[:, 6] - 0.163985258279827 * u[:, 7] uy[:, 5] = -0.127754693486067 * u[:, 0] + 0.393149407857401 * u[:, 1] - 0.172955234680916 * u[:, 2] - 0.491489487857764 * u[:, 3] - 0.016325050231672 * u[:, 4] + 0.428167552785852 * u[:, 6] - 0.025864364383975 * u[:, 7] + 0.013071869997141 * u[:, 8] uy[:, 6] = 0.060008241515128 * u[:, 0] - 0.201971348965594 * u[:, 1] + 0.142885356631256 * u[:, 2] + 0.203603636754774 * u[:, 3] - 0.227565385120003 * u[:, 4] - 0.590259111130048 * u[:, 5] + 0.757462553894374 * u[:, 7] - 0.162184436527372 * u[:, 8] + 0.018020492947486 * u[:, 9] uy[:, 7] = 0.009910488565285 * u[:, 1] - 0.029429452176588 * u[:, 2] + 0.002202493355677 * u[:, 3] + 0.067773581604826 * u[:, 4] + 0.03268194572669 * u[:, 5] - 0.694285851935105 * u[:, 6] + 0.743286642396343 * u[:, 8] - 0.148657328479269 * u[:, 9] + 0.016517480942141 * u[:, 10] uy[:, m - 7] = -0.016517480942141 * u[:, m - 10] + 0.148657328479269 * u[:, m - 9] - 0.743286642396343 * u[:, m - 8] + 0.694285851935105 * u[:, m - 6] - 0.03268194572669 * u[:, m - 5] - 0.067773581604826 * u[:, m - 4] - 0.002202493355677 * u[:, m - 3] + 0.029429452176588 * u[:, m - 2] - 0.009910488565285 * u[:, m - 1] uy[:, m - 6] = -0.018020492947486 * u[:, m - 9] + 0.162184436527372 * u[:, m - 8] - 0.757462553894374 * u[:, m - 7] + 0.590259111130048 * u[:, m - 5] + 0.227565385120003 * u[:, m - 4] - 0.203603636754774 * u[:, m - 3] - 0.142885356631256 * u[:, m - 2] + 0.201971348965594 * u[:, m - 1] - 0.060008241515128 * u[:, m] uy[:, m - 5] = -0.013071869997141 * u[:, m - 8] + 0.025864364383975 * u[:, m - 7] - 0.428167552785852 * u[:, m - 6] + 0.016325050231672 * u[:, m - 4] + 0.491489487857764 * u[:, m - 3] + 0.172955234680916 * u[:, m - 2] - 0.393149407857401 * u[:, m - 1] + 0.127754693486067 * u[:, m] uy[:, m - 4] = 0.163985258279827 * u[:, m - 7] - 0.504693510958978 * u[:, m - 6] - 0.049912002176267 * u[:, m - 5] + 0.520172867814934 * u[:, m - 3] - 0.43468634117384 * u[:, m - 2] + 0.438678347579289 * u[:, m - 1] - 0.133544619364965 * u[:, m] uy[:, m - 3] = 0.001238311303608 * u[:, m - 7] + 0.104924741749615 * u[:, m - 6] - 0.349168902725368 * u[:, m - 5] - 0.120870009174558 * u[:, m - 4] + 0.117033418681039 * u[:, m - 2] + 0.357041083340051 * u[:, m - 1] - 0.110198643174386 * u[:, m] uy[:, m - 2] = -0.114508548186019 * u[:, m - 7] + 0.50958965296529 * u[:, m - 6] - 0.850345731199969 * u[:, m - 5] + 0.699016381364484 * u[:, m - 4] - 0.809935419586724 * u[:, m - 3] + 0.629491308812471 * u[:, m - 1] - 0.063307644169533 * u[:, m] uy[:, m - 1] = 0.006557221825386 * u[:, m - 7] - 0.122487487014485 * u[:, m - 6] + 0.328691543801578 * u[:, m - 5] - 0.119957288069806 * u[:, m - 4] - 0.420172642668695 * u[:, m - 3] - 0.107043134706685 * u[:, m - 2] + 0.434411786832708 * u[:, m] uy[:, m] = 0.188126680800077 * u[:, m - 6] - 0.55213503282991 * u[:, m - 5] + 0.188774952148393 * u[:, m - 4] + 0.670383570370653 * u[:, m - 3] + 0.055649692295628 * u[:, m - 2] - 2.245634824947698 * u[:, m - 1] + 1.694834962162858 * u[:, m] for j in range(8, m - 7): uy[:, j] = -0.016666666666666666 * u[:, j - 3] + 0.15 * u[:, j - 2] - 0.75 * u[:, j - 1] + 0.75 * u[:, j + 1] - 0.15 * u[:, j + 2] + 0.01666666666666667 * u[:, j + 3] uy[:, :] = 1.0 / dy * uy[:, :] def dx2d(ux, u, nx, i, j, dx, order): m = nx - 1 if order == 2: if i == 0: ux[:] = (u[1, j, :] - u[0, j, :]) / dx if i == m: ux[:] = (u[m, j, :] - u[m - 1, j, :]) / dx if i > 0 and i < m: ux[:] = (u[i + 1, j, :] - u[i - 1, j, :]) / (2.0 * dx) if order == 4: if i == 0: ux[:] = -24.0 / 17 * u[0, j, :] + 59.0 / 34 * u[1, j, :] - 4.0 / 17 * u[2, j, :] - 3.0 / 34 * u[3, j, :] if i == 1: ux[:] = -1.0 / 2 * u[0, j, :] + 1.0 / 2 * u[2, j, :] if i == 2: ux[:] = 4.0 / 43 * u[0, j, :] - 59.0 / 86 * u[1, j, :] + 59.0 / 86 * u[3, j, :] - 4.0 / 43 * u[4, j, :] if i == 3: ux[:] = 3.0 / 98 * u[0, j, :] - 59.0 / 98 * u[2, j, :] + 32.0 / 49 * u[4, j, :] - 4.0 / 49 * u[5, j, :] if i == m: ux[:] = 24.0 / 17 * u[m, j, :] - 59.0 / 34 * u[m - 1, j, :] + 4.0 / 17 * u[m - 2, j, :] + 3.0 / 34 * u[m - 3, j, :] if i == m - 1: ux[:] = 1.0 / 2 * u[m, j, :] - 1.0 / 2 * u[m - 2, j, :] if i == m - 2: ux[:] = -4.0 / 43 * u[m, j, :] + 59.0 / 86 * u[m - 1, j, :] - 59.0 / 86 * u[m - 3, j, :] + 4.0 / 43 * u[m - 4, j, :] if i == m - 3: ux[:] = -3.0 / 98 * u[m, j, :] + 59.0 / 98 * u[m - 2, j, :] - 32.0 / 49 * u[m - 4, j, :] + 4.0 / 49 * u[m - 5, j, :] if i > 3 and i < m - 3: ux[:] = 0.083333333333333 * u[i - 2, j, :] - 0.666666666666667 * u[i - 1, j, :] + 0.666666666666667 * u[i + 1, j, :] - 0.083333333333333 * u[i + 2, j, :] ux[:] = ux[:] / dx if order == 6: if i == 0: ux[:] = -1.694834962162858 * u[0, j, :] + 2.245634824947698 * u[1, j, :] - 0.055649692295628 * u[2, j, :] - 0.670383570370653 * u[3, j, :] - 0.188774952148393 * u[4, j, :] + 0.55213503282991 * u[5, j, :] - 0.188126680800077 * u[6, j, :] if i == 1: ux[:] = -0.434411786832708 * u[0, j, :] + 0.107043134706685 * u[2, j, :] + 0.420172642668695 * u[3, j, :] + 0.119957288069806 * u[4, j, :] - 0.328691543801578 * u[5, j, :] + 0.122487487014485 * u[6, j, :] - 0.006557221825386 * u[7, j, :] if i == 2: ux[:] = 0.063307644169533 * u[0, j, :] - 0.629491308812471 * u[1, j, :] + 0.809935419586724 * u[3, j, :] - 0.699016381364484 * u[4, j, :] + 0.850345731199969 * u[5, j, :] - 0.50958965296529 * u[6, j, :] + 0.114508548186019 * u[7, j, :] if i == 3: ux[:] = 0.110198643174386 * u[0, j, :] - 0.357041083340051 * u[1, j, :] - 0.117033418681039 * u[2, j, :] + 0.120870009174558 * u[4, j, :] + 0.349168902725368 * u[5, j, :] - 0.104924741749615 * u[6, j, :] - 0.001238311303608 * u[7, j, :] if i == 4: ux[:] = 0.133544619364965 * u[0, j, :] - 0.438678347579289 * u[1, j, :] + 0.43468634117384 * u[2, j, :] - 0.520172867814934 * u[3, j, :] + 0.049912002176267 * u[5, j, :] + 0.504693510958978 * u[6, j, :] - 0.163985258279827 * u[7, j, :] if i == 5: ux[:] = -0.127754693486067 * u[0, j, :] + 0.393149407857401 * u[1, j, :] - 0.172955234680916 * u[2, j, :] - 0.491489487857764 * u[3, j, :] - 0.016325050231672 * u[4, j, :] + 0.428167552785852 * u[6, j, :] - 0.025864364383975 * u[7, j, :] + 0.013071869997141 * u[8, j, :] if i == 6: ux[:] = 0.060008241515128 * u[0, j, :] - 0.201971348965594 * u[1, j, :] + 0.142885356631256 * u[2, j, :] + 0.203603636754774 * u[3, j, :] - 0.227565385120003 * u[4, j, :] - 0.590259111130048 * u[5, j, :] + 0.757462553894374 * u[7, j, :] - 0.162184436527372 * u[8, j, :] + 0.018020492947486 * u[9, j, :] if i == 7: ux[:] = 0.009910488565285 * u[1, j, :] - 0.029429452176588 * u[2, j, :] + 0.002202493355677 * u[3, j, :] + 0.067773581604826 * u[4, j, :] + 0.03268194572669 * u[5, j, :] - 0.694285851935105 * u[6, j, :] + 0.743286642396343 * u[8, j, :] - 0.148657328479269 * u[9, j, :] + 0.016517480942141 * u[10, j, :] if i == m - 7: ux[:] = -0.016517480942141 * u[m - 10, j, :] + 0.148657328479269 * u[m - 9, j, :] - 0.743286642396343 * u[m - 8, j, :] + 0.694285851935105 * u[m - 6, j, :] - 0.03268194572669 * u[m - 5, j, :] - 0.067773581604826 * u[m - 4, j, :] - 0.002202493355677 * u[m - 3, j, :] + 0.029429452176588 * u[m - 2, j, :] - 0.009910488565285 * u[m - 1, j, :] if i == m - 6: ux[:] = -0.018020492947486 * u[m - 9, j, :] + 0.162184436527372 * u[m - 8, j, :] - 0.757462553894374 * u[m - 7, j, :] + 0.590259111130048 * u[m - 5, j, :] + 0.227565385120003 * u[m - 4, j, :] - 0.203603636754774 * u[m - 3, j, :] - 0.142885356631256 * u[m - 2, j, :] + 0.201971348965594 * u[m - 1, j, :] - 0.060008241515128 * u[m, j, :] if i == m - 5: ux[:] = -0.013071869997141 * u[m - 8, j, :] + 0.025864364383975 * u[m - 7, j, :] - 0.428167552785852 * u[m - 6, j, :] + 0.016325050231672 * u[m - 4, j, :] + 0.491489487857764 * u[m - 3, j, :] + 0.172955234680916 * u[m - 2, j, :] - 0.393149407857401 * u[m - 1, j, :] + 0.127754693486067 * u[m, j, :] if i == m - 4: ux[:] = 0.163985258279827 * u[m - 7, j, :] - 0.504693510958978 * u[m - 6, j, :] - 0.049912002176267 * u[m - 5, j, :] + 0.520172867814934 * u[m - 3, j, :] - 0.43468634117384 * u[m - 2, j, :] + 0.438678347579289 * u[m - 1, j, :] - 0.133544619364965 * u[m, j, :] if i == m - 3: ux[:] = 0.001238311303608 * u[m - 7, j, :] + 0.104924741749615 * u[m - 6, j, :] - 0.349168902725368 * u[m - 5, j, :] - 0.120870009174558 * u[m - 4, j, :] + 0.117033418681039 * u[m - 2, j, :] + 0.357041083340051 * u[m - 1, j, :] - 0.110198643174386 * u[m, j, :] if i == m - 2: ux[:] = -0.114508548186019 * u[m - 7, j, :] + 0.50958965296529 * u[m - 6, j, :] - 0.850345731199969 * u[m - 5, j, :] + 0.699016381364484 * u[m - 4, j, :] - 0.809935419586724 * u[m - 3, j, :] + 0.629491308812471 * u[m - 1, j, :] - 0.063307644169533 * u[m, j, :] if i == m - 1: ux[:] = 0.006557221825386 * u[m - 7, j, :] - 0.122487487014485 * u[m - 6, j, :] + 0.328691543801578 * u[m - 5, j, :] - 0.119957288069806 * u[m - 4, j, :] - 0.420172642668695 * u[m - 3, j, :] - 0.107043134706685 * u[m - 2, j, :] + 0.434411786832708 * u[m, j, :] if i == m: ux[:] = 0.188126680800077 * u[m - 6, j, :] - 0.55213503282991 * u[m - 5, j, :] + 0.188774952148393 * u[m - 4, j, :] + 0.670383570370653 * u[m - 3, j, :] + 0.055649692295628 * u[m - 2, j, :] - 2.245634824947698 * u[m - 1, j, :] + 1.694834962162858 * u[m, j, :] if i > 7 and i < m - 7: ux[:] = -0.016666666666667 * u[i - 3, j, :] + 0.15 * u[i - 2, j, :] - 0.75 * u[i - 1, j, :] + 0.75 * u[i + 1, j, :] - 0.15 * u[i + 2, j, :] + 0.016666666666667 * u[i + 3, j, :] ux[:] = ux[:] / dx def dy2d(uy, u, ny, i, j, dy, order): m = ny - 1 if order == 2: if j == 0: uy[:] = u[i, 1, :] - u[i, 0, :] if j == m: uy[:] = u[i, m, :] - u[i, m - 1, :] if j > 0 and j < m: uy[:] = 0.5 * (u[i, j + 1, :] - u[i, j - 1, :]) uy[:] = 1.0 / dy * uy[:] if order == 4: if j == 0: uy[:] = -24.0 / 17.0 * u[i, 0, :] + 59.0 / 34.0 * u[i, 1, :] - 4.0 / 17.0 * u[i, 2, :] - 3.0 / 34.0 * u[i, 3, :] if j == 1: uy[:] = -1.0 / 2.0 * u[i, 0, :] + 1.0 / 2.0 * u[i, 2, :] if j == 2: uy[:] = 4.0 / 43.0 * u[i, 0, :] - 59.0 / 86.0 * u[i, 1, :] + 59.0 / 86.0 * u[i, 3, :] - 4.0 / 43.0 * u[i, 4, :] if j == 3: uy[:] = 3.0 / 98.0 * u[i, 0, :] - 59.0 / 98.0 * u[i, 2, :] + 32.0 / 49.0 * u[i, 4, :] - 4.0 / 49.0 * u[i, 5, :] if j == m: uy[:] = 24.0 / 17.0 * u[i, m, :] - 59.0 / 34.0 * u[i, m - 1, :] + 4.0 / 17.0 * u[i, m - 2, :] + 3.0 / 34.0 * u[i, m - 3, :] if j == m - 1: uy[:] = 1.0 / 2.0 * u[i, m, :] - 1.0 / 2.0 * u[i, m - 2, :] if j == m - 2: uy[:] = -4.0 / 43.0 * u[i, m, :] + 59.0 / 86.0 * u[i, m - 1, :] - 59.0 / 86.0 * u[i, m - 3, :] + 4.0 / 43.0 * u[i, m - 4, :] if j == m - 3: uy[:] = -3.0 / 98.0 * u[i, m, :] + 59.0 / 98.0 * u[i, m - 2, :] - 32.0 / 49.0 * u[i, m - 4, :] + 4.0 / 49.0 * u[i, m - 5, :] if j > 3 and j < m - 3: uy[:] = 1.0 / 12.0 * u[i, j - 2, :] - 2.0 / 3.0 * u[i, j - 1, :] + 2.0 / 3.0 * u[i, j + 1, :] - 1.0 / 12.0 * u[i, j + 2, :] uy[:] = 1.0 / dy * uy[:] if order == 6: if j == 0: uy[:] = -1.694834962162858 * u[i, 0, :] + 2.245634824947698 * u[i, 1, :] - 0.055649692295628 * u[i, 2, :] - 0.670383570370653 * u[i, 3, :] - 0.188774952148393 * u[i, 4, :] + 0.55213503282991 * u[i, 5, :] - 0.188126680800077 * u[i, 6, :] if j == 1: uy[:] = -0.434411786832708 * u[i, 0, :] + 0.107043134706685 * u[i, 2, :] + 0.420172642668695 * u[i, 3, :] + 0.119957288069806 * u[i, 4, :] - 0.328691543801578 * u[i, 5, :] + 0.122487487014485 * u[i, 6, :] - 0.006557221825386 * u[i, 7, :] if j == 2: uy[:] = 0.063307644169533 * u[i, 0, :] - 0.629491308812471 * u[i, 1, :] + 0.809935419586724 * u[i, 3, :] - 0.699016381364484 * u[i, 4, :] + 0.850345731199969 * u[i, 5, :] - 0.50958965296529 * u[i, 6, :] + 0.114508548186019 * u[i, 7, :] if j == 3: uy[:] = 0.110198643174386 * u[i, 0, :] - 0.357041083340051 * u[i, 1, :] - 0.117033418681039 * u[i, 2, :] + 0.120870009174558 * u[i, 4, :] + 0.349168902725368 * u[i, 5, :] - 0.104924741749615 * u[i, 6, :] - 0.001238311303608 * u[i, 7, :] if j == 4: uy[:] = 0.133544619364965 * u[i, 0, :] - 0.438678347579289 * u[i, 1, :] + 0.43468634117384 * u[i, 2, :] - 0.520172867814934 * u[i, 3, :] + 0.049912002176267 * u[i, 5, :] + 0.504693510958978 * u[i, 6, :] - 0.163985258279827 * u[i, 7, :] if j == 5: uy[:] = -0.127754693486067 * u[i, 0, :] + 0.393149407857401 * u[i, 1, :] - 0.172955234680916 * u[i, 2, :] - 0.491489487857764 * u[i, 3, :] - 0.016325050231672 * u[i, 4, :] + 0.428167552785852 * u[i, 6, :] - 0.025864364383975 * u[i, 7, :] + 0.013071869997141 * u[i, 8, :] if j == 6: uy[:] = 0.060008241515128 * u[i, 0, :] - 0.201971348965594 * u[i, 1, :] + 0.142885356631256 * u[i, 2, :] + 0.203603636754774 * u[i, 3, :] - 0.227565385120003 * u[i, 4, :] - 0.590259111130048 * u[i, 5, :] + 0.757462553894374 * u[i, 7, :] - 0.162184436527372 * u[i, 8, :] + 0.018020492947486 * u[i, 9, :] if j == 7: uy[:] = 0.009910488565285 * u[i, 1, :] - 0.029429452176588 * u[i, 2, :] + 0.002202493355677 * u[i, 3, :] + 0.067773581604826 * u[i, 4, :] + 0.03268194572669 * u[i, 5, :] - 0.694285851935105 * u[i, 6, :] + 0.743286642396343 * u[i, 8, :] - 0.148657328479269 * u[i, 9, :] + 0.016517480942141 * u[i, 10, :] if j == m - 7: uy[:] = -0.016517480942141 * u[i, m - 10, :] + 0.148657328479269 * u[i, m - 9, :] - 0.743286642396343 * u[i, m - 8, :] + 0.694285851935105 * u[i, m - 6, :] - 0.03268194572669 * u[i, m - 5, :] - 0.067773581604826 * u[i, m - 4, :] - 0.002202493355677 * u[i, m - 3, :] + 0.029429452176588 * u[i, m - 2, :] - 0.009910488565285 * u[i, m - 1, :] if j == m - 6: uy[:] = -0.018020492947486 * u[i, m - 9, :] + 0.162184436527372 * u[i, m - 8, :] - 0.757462553894374 * u[i, m - 7, :] + 0.590259111130048 * u[i, m - 5, :] + 0.227565385120003 * u[i, m - 4, :] - 0.203603636754774 * u[i, m - 3, :] - 0.142885356631256 * u[i, m - 2, :] + 0.201971348965594 * u[i, m - 1, :] - 0.060008241515128 * u[i, m, :] if j == m - 5: uy[:] = -0.013071869997141 * u[i, m - 8, :] + 0.025864364383975 * u[i, m - 7, :] - 0.428167552785852 * u[i, m - 6, :] + 0.016325050231672 * u[i, m - 4, :] + 0.491489487857764 * u[i, m - 3, :] + 0.172955234680916 * u[i, m - 2, :] - 0.393149407857401 * u[i, m - 1, :] + 0.127754693486067 * u[i, m, :] if j == m - 4: uy[:] = 0.163985258279827 * u[i, m - 7, :] - 0.504693510958978 * u[i, m - 6, :] - 0.049912002176267 * u[i, m - 5, :] + 0.520172867814934 * u[i, m - 3, :] - 0.43468634117384 * u[i, m - 2, :] + 0.438678347579289 * u[i, m - 1, :] - 0.133544619364965 * u[i, m, :] if j == m - 3: uy[:] = 0.001238311303608 * u[i, m - 7, :] + 0.104924741749615 * u[i, m - 6, :] - 0.349168902725368 * u[i, m - 5, :] - 0.120870009174558 * u[i, m - 4, :] + 0.117033418681039 * u[i, m - 2, :] + 0.357041083340051 * u[i, m - 1, :] - 0.110198643174386 * u[i, m, :] if j == m - 2: uy[:] = -0.114508548186019 * u[i, m - 7, :] + 0.50958965296529 * u[i, m - 6, :] - 0.850345731199969 * u[i, m - 5, :] + 0.699016381364484 * u[i, m - 4, :] - 0.809935419586724 * u[i, m - 3, :] + 0.629491308812471 * u[i, m - 1, :] - 0.063307644169533 * u[i, m, :] if j == m - 1: uy[:] = 0.006557221825386 * u[i, m - 7, :] - 0.122487487014485 * u[i, m - 6, :] + 0.328691543801578 * u[i, m - 5, :] - 0.119957288069806 * u[i, m - 4, :] - 0.420172642668695 * u[i, m - 3, :] - 0.107043134706685 * u[i, m - 2, :] + 0.434411786832708 * u[i, m, :] if j == m: uy[:] = 0.188126680800077 * u[i, m - 6, :] - 0.55213503282991 * u[i, m - 5, :] + 0.188774952148393 * u[i, m - 4, :] + 0.670383570370653 * u[i, m - 3, :] + 0.055649692295628 * u[i, m - 2, :] - 2.245634824947698 * u[i, m - 1, :] + 1.694834962162858 * u[i, m, :] if j > 7 and j < m - 7: uy[:] = -0.016666666666666666 * u[i, j - 3, :] + 0.15 * u[i, j - 2, :] - 0.75 * u[i, j - 1, :] + 0.75 * u[i, j + 1, :] - 0.15 * u[i, j + 2, :] + 0.01666666666666667 * u[i, j + 3, :] uy[:] = 1.0 / dy * uy[:]
set_example={"ATGCT","ATAGTATA","ATGCT"} #set will remove the duplicate members print(set_example) set_example={"YC1","YC2","YC3","YC3"} print(set_example) t_cell_epitopes={"LPVLQV","FGDSVE","VEKGVLPQLEQ","ARTAPH","EIPVA"} b_cell_epitopes={"ARTAPH","IQYG","EIPVA"} #all the available epitopes #union operation all_epitopes=t_cell_epitopes|b_cell_epitopes print(all_epitopes) # #common eitopes common_epitopes=t_cell_epitopes&b_cell_epitopes print(common_epitopes) #all the epitopes that are present in tcell but in bcell print(t_cell_epitopes-b_cell_epitopes) #all the epitopes that are present in bcell but in tcell print(b_cell_epitopes-t_cell_epitopes) #all the epitopes that are present in either t cell or bcell but not in both #symmetric difference print(b_cell_epitopes^t_cell_epitopes) set1={1,2,3} set2={3,4} print((set1|set2)-set1) b_cell_epitopes={"ARTAPH","IQYG","EIPVA"} b_cell_epitopes.add("IQY") print(b_cell_epitopes) b_cell_epitopes.add("IQY") b_cell_epitopes.add("IQY") b_cell_epitopes.add("IQY") print(b_cell_epitopes)
set_example = {'ATGCT', 'ATAGTATA', 'ATGCT'} print(set_example) set_example = {'YC1', 'YC2', 'YC3', 'YC3'} print(set_example) t_cell_epitopes = {'LPVLQV', 'FGDSVE', 'VEKGVLPQLEQ', 'ARTAPH', 'EIPVA'} b_cell_epitopes = {'ARTAPH', 'IQYG', 'EIPVA'} all_epitopes = t_cell_epitopes | b_cell_epitopes print(all_epitopes) common_epitopes = t_cell_epitopes & b_cell_epitopes print(common_epitopes) print(t_cell_epitopes - b_cell_epitopes) print(b_cell_epitopes - t_cell_epitopes) print(b_cell_epitopes ^ t_cell_epitopes) set1 = {1, 2, 3} set2 = {3, 4} print((set1 | set2) - set1) b_cell_epitopes = {'ARTAPH', 'IQYG', 'EIPVA'} b_cell_epitopes.add('IQY') print(b_cell_epitopes) b_cell_epitopes.add('IQY') b_cell_epitopes.add('IQY') b_cell_epitopes.add('IQY') print(b_cell_epitopes)
MOCK_ENTRIES = [{ "symbol": "GE", "companyName": "General Electric Company", "exchange": "New York Stock Exchange", "industry": "Industrial Products", "website": "http://www.ge.com", "description": "General Electric Co is a digital industrial company. It operates" " in various segments, including power and water, oil and gas," " energy management, aviation, healthcare, transportation," " appliances and lighting, and more.", "CEO": "John L. Flannery", "issueType": "cs", "sector": "Industrials" }, { "symbol": "JE", "companyName": "General Electric Company", "exchange": "New York Stock Exchange", "industry": "Industrial Products", "website": "http://www.ge.com", "description": "General Electric Co is a digital industrial company. It operates" " in various segments, including power and water, oil and gas," " energy management, aviation, healthcare, transportation," " appliances and lighting, and more.", "CEO": "John L. Flannery", "issueType": "cs", "sector": "Industrials" }, { "symbol": "KE", "companyName": "General Electric Company", "exchange": "New York Stock Exchange", "industry": "Industrial Products", "website": "http://www.ge.com", "description": "General Electric Co is a digital industrial company. It operates" " in various segments, including power and water, oil and gas," " energy management, aviation, healthcare, transportation," " appliances and lighting, and more.", "CEO": "John L. Flannery", "issueType": "cs", "sector": "Industrials" }, { "symbol": "AE", "companyName": "General Electric Company", "exchange": "New York Stock Exchange", "industry": "Industrial Products", "website": "http://www.ge.com", "description": "General Electric Co is a digital industrial company. It operates" " in various segments, including power and water, oil and gas," " energy management, aviation, healthcare, transportation," " appliances and lighting, and more.", "CEO": "John L. Flannery", "issueType": "cs", "sector": "Industrials" }, { "symbol": "BE", "companyName": "General Electric Company", "exchange": "New York Stock Exchange", "industry": "Industrial Products", "website": "http://www.ge.com", "description": "General Electric Co is a digital industrial company. It operates" " in various segments, including power and water, oil and gas," " energy management, aviation, healthcare, transportation," " appliances and lighting, and more.", "CEO": "John L. Flannery", "issueType": "cs", "sector": "Industrials" }, { "symbol": "CE", "companyName": "General Electric Company", "exchange": "New York Stock Exchange", "industry": "Industrial Products", "website": "http://www.ge.com", "description": "General Electric Co is a digital industrial company. It operates" " in various segments, including power and water, oil and gas," " energy management, aviation, healthcare, transportation," " appliances and lighting, and more.", "CEO": "John L. Flannery", "issueType": "cs", "sector": "Industrials" }, { "symbol": "DE", "companyName": "General Electric Company", "exchange": "New York Stock Exchange", "industry": "Industrial Products", "website": "http://www.ge.com", "description": "General Electric Co is a digital industrial company. It operates" " in various segments, including power and water, oil and gas," " energy management, aviation, healthcare, transportation," " appliances and lighting, and more.", "CEO": "John L. Flannery", "issueType": "cs", "sector": "Industrials" }, { "symbol": "EE", "companyName": "General Electric Company", "exchange": "New York Stock Exchange", "industry": "Industrial Products", "website": "http://www.ge.com", "description": "General Electric Co is a digital industrial company. It operates" " in various segments, including power and water, oil and gas," " energy management, aviation, healthcare, transportation," " appliances and lighting, and more.", "CEO": "John L. Flannery", "issueType": "cs", "sector": "Industrials" }, { "symbol": "FE", "companyName": "General Electric Company", "exchange": "New York Stock Exchange", "industry": "Industrial Products", "website": "http://www.ge.com", "description": "General Electric Co is a digital industrial company. It operates" " in various segments, including power and water, oil and gas," " energy management, aviation, healthcare, transportation," " appliances and lighting, and more.", "CEO": "John L. Flannery", "issueType": "cs", "sector": "Industrials" }, { "symbol": "HE", "companyName": "General Electric Company", "exchange": "New York Stock Exchange", "industry": "Industrial Products", "website": "http://www.ge.com", "description": "General Electric Co is a digital industrial company. It operates" " in various segments, including power and water, oil and gas," " energy management, aviation, healthcare, transportation," " appliances and lighting, and more.", "CEO": "John L. Flannery", "issueType": "cs", "sector": "Industrials" }]
mock_entries = [{'symbol': 'GE', 'companyName': 'General Electric Company', 'exchange': 'New York Stock Exchange', 'industry': 'Industrial Products', 'website': 'http://www.ge.com', 'description': 'General Electric Co is a digital industrial company. It operates in various segments, including power and water, oil and gas, energy management, aviation, healthcare, transportation, appliances and lighting, and more.', 'CEO': 'John L. Flannery', 'issueType': 'cs', 'sector': 'Industrials'}, {'symbol': 'JE', 'companyName': 'General Electric Company', 'exchange': 'New York Stock Exchange', 'industry': 'Industrial Products', 'website': 'http://www.ge.com', 'description': 'General Electric Co is a digital industrial company. It operates in various segments, including power and water, oil and gas, energy management, aviation, healthcare, transportation, appliances and lighting, and more.', 'CEO': 'John L. Flannery', 'issueType': 'cs', 'sector': 'Industrials'}, {'symbol': 'KE', 'companyName': 'General Electric Company', 'exchange': 'New York Stock Exchange', 'industry': 'Industrial Products', 'website': 'http://www.ge.com', 'description': 'General Electric Co is a digital industrial company. It operates in various segments, including power and water, oil and gas, energy management, aviation, healthcare, transportation, appliances and lighting, and more.', 'CEO': 'John L. Flannery', 'issueType': 'cs', 'sector': 'Industrials'}, {'symbol': 'AE', 'companyName': 'General Electric Company', 'exchange': 'New York Stock Exchange', 'industry': 'Industrial Products', 'website': 'http://www.ge.com', 'description': 'General Electric Co is a digital industrial company. It operates in various segments, including power and water, oil and gas, energy management, aviation, healthcare, transportation, appliances and lighting, and more.', 'CEO': 'John L. Flannery', 'issueType': 'cs', 'sector': 'Industrials'}, {'symbol': 'BE', 'companyName': 'General Electric Company', 'exchange': 'New York Stock Exchange', 'industry': 'Industrial Products', 'website': 'http://www.ge.com', 'description': 'General Electric Co is a digital industrial company. It operates in various segments, including power and water, oil and gas, energy management, aviation, healthcare, transportation, appliances and lighting, and more.', 'CEO': 'John L. Flannery', 'issueType': 'cs', 'sector': 'Industrials'}, {'symbol': 'CE', 'companyName': 'General Electric Company', 'exchange': 'New York Stock Exchange', 'industry': 'Industrial Products', 'website': 'http://www.ge.com', 'description': 'General Electric Co is a digital industrial company. It operates in various segments, including power and water, oil and gas, energy management, aviation, healthcare, transportation, appliances and lighting, and more.', 'CEO': 'John L. Flannery', 'issueType': 'cs', 'sector': 'Industrials'}, {'symbol': 'DE', 'companyName': 'General Electric Company', 'exchange': 'New York Stock Exchange', 'industry': 'Industrial Products', 'website': 'http://www.ge.com', 'description': 'General Electric Co is a digital industrial company. It operates in various segments, including power and water, oil and gas, energy management, aviation, healthcare, transportation, appliances and lighting, and more.', 'CEO': 'John L. Flannery', 'issueType': 'cs', 'sector': 'Industrials'}, {'symbol': 'EE', 'companyName': 'General Electric Company', 'exchange': 'New York Stock Exchange', 'industry': 'Industrial Products', 'website': 'http://www.ge.com', 'description': 'General Electric Co is a digital industrial company. It operates in various segments, including power and water, oil and gas, energy management, aviation, healthcare, transportation, appliances and lighting, and more.', 'CEO': 'John L. Flannery', 'issueType': 'cs', 'sector': 'Industrials'}, {'symbol': 'FE', 'companyName': 'General Electric Company', 'exchange': 'New York Stock Exchange', 'industry': 'Industrial Products', 'website': 'http://www.ge.com', 'description': 'General Electric Co is a digital industrial company. It operates in various segments, including power and water, oil and gas, energy management, aviation, healthcare, transportation, appliances and lighting, and more.', 'CEO': 'John L. Flannery', 'issueType': 'cs', 'sector': 'Industrials'}, {'symbol': 'HE', 'companyName': 'General Electric Company', 'exchange': 'New York Stock Exchange', 'industry': 'Industrial Products', 'website': 'http://www.ge.com', 'description': 'General Electric Co is a digital industrial company. It operates in various segments, including power and water, oil and gas, energy management, aviation, healthcare, transportation, appliances and lighting, and more.', 'CEO': 'John L. Flannery', 'issueType': 'cs', 'sector': 'Industrials'}]
#from swagger_server.models.configurations import Configurations #from swagger_server.models.configuration import Configuration class GuardAgentSecurityContext(object): class __GuardAgentSecurityContext: def __init__(self): # self._time_between_probes=Configuration("time_between_probes", "int", "Time consumed between probing in seconds", "60") # self._time_between_pings=Configuration("time_between_pings","int", "time ellapsed between two pings in seconds", "60") # self.configurations=Configurations([self._time_between_probes, self._time_between_pings]) pass def to_dict(self): return self.configurations.to_dict() def to_str(self): return self.configurations.to_str() def time_between_probes(self,tbp: int=None): if tbp is None: return int(self._time_between_probes._value) else: self._time_between_probes._value = str(tbp) def time_between_pings(self,tbp: int=None): if tbp is None: return int(self._time_between_pings._value) else: self._time_between_pings._value = str(tbp) instance=None def __new__(cls, *args, **kwargs): if GuardAgentSecurityContext.instance is None: GuardAgentSecurityContext.instance = GuardAgentSecurityContext.__GuardAgentSecurityContext() return GuardAgentSecurityContext.instance def __getattr__(self, name): return getattr(self.instance, name) def __setattr__(self, name): return setattr(self.instance, name)
class Guardagentsecuritycontext(object): class __Guardagentsecuritycontext: def __init__(self): pass def to_dict(self): return self.configurations.to_dict() def to_str(self): return self.configurations.to_str() def time_between_probes(self, tbp: int=None): if tbp is None: return int(self._time_between_probes._value) else: self._time_between_probes._value = str(tbp) def time_between_pings(self, tbp: int=None): if tbp is None: return int(self._time_between_pings._value) else: self._time_between_pings._value = str(tbp) instance = None def __new__(cls, *args, **kwargs): if GuardAgentSecurityContext.instance is None: GuardAgentSecurityContext.instance = GuardAgentSecurityContext.__GuardAgentSecurityContext() return GuardAgentSecurityContext.instance def __getattr__(self, name): return getattr(self.instance, name) def __setattr__(self, name): return setattr(self.instance, name)
s = str(__import__('sys').stdin.readline().strip()).replace("()","0") res = 0 sticker = 0 for x in s: if x == "(": sticker += 1 elif x == "0": res += sticker else: sticker -= 1 res += 1 print(res)
s = str(__import__('sys').stdin.readline().strip()).replace('()', '0') res = 0 sticker = 0 for x in s: if x == '(': sticker += 1 elif x == '0': res += sticker else: sticker -= 1 res += 1 print(res)
# # PySNMP MIB module VMWARE-VA-AGENTCAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VMWARE-VA-AGENTCAP-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:35:03 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") ConstraintsUnion, ValueSizeConstraint, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueSizeConstraint", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint") AgentCapabilities, NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "AgentCapabilities", "NotificationGroup", "ModuleCompliance") Integer32, Counter64, MibScalar, MibTable, MibTableRow, MibTableColumn, ModuleIdentity, Bits, MibIdentifier, TimeTicks, iso, ObjectIdentity, IpAddress, Counter32, NotificationType, Gauge32, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "Counter64", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "ModuleIdentity", "Bits", "MibIdentifier", "TimeTicks", "iso", "ObjectIdentity", "IpAddress", "Counter32", "NotificationType", "Gauge32", "Unsigned32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") vmwareAgentCapabilities, = mibBuilder.importSymbols("VMWARE-ROOT-MIB", "vmwareAgentCapabilities") vmwVAAgentCapabilityMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 6876, 70, 5)) vmwVAAgentCapabilityMIB.setRevisions(('2015-01-12 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: vmwVAAgentCapabilityMIB.setRevisionsDescriptions(('Capabilities for VMware Virutal Appliance.',)) if mibBuilder.loadTexts: vmwVAAgentCapabilityMIB.setLastUpdated('201501120000Z') if mibBuilder.loadTexts: vmwVAAgentCapabilityMIB.setOrganization('VMware, Inc') if mibBuilder.loadTexts: vmwVAAgentCapabilityMIB.setContactInfo('VMware, Inc 3401 Hillview Ave Palo Alto, CA 94304 Tel: 1-877-486-9273 or 650-427-5000 Fax: 650-427-5001 Web: http://communities.vmware.com/community/developer/forums/managementapi ') if mibBuilder.loadTexts: vmwVAAgentCapabilityMIB.setDescription('This module defines agent capabilities for deployed VMware Virtual Appliance agents by release.') vmwVACapability = MibIdentifier((1, 3, 6, 1, 4, 1, 6876, 70, 5, 1)) vmwVA2015x = AgentCapabilities((1, 3, 6, 1, 4, 1, 6876, 70, 5, 1, 5)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): vmwVA2015x = vmwVA2015x.setProductRelease('6.0.x') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): vmwVA2015x = vmwVA2015x.setStatus('current') if mibBuilder.loadTexts: vmwVA2015x.setDescription("Release 2015 aka 6.0 for VMware Virtual Appliance supporting SNMPv1, SNMPv2c, and SNMPv3. This agent supports read-only protocol operations, shares same configuration file as VMware ESXi agent. This implies that configuring the SNMPv3 Agent can not be done via SET operations or use SET PDU to discover engine id. Hence IETF standard SNMPv3 agent configuration mibs are not provided. The SNMPv3 protocol is fully supported once configured via the CLI command interface, run applianceh shell using the 'snmp' command set. Lastly this SNMP agent provides one read-only view of the entire system to which all SNMPv3 users configured are assigned. This initial release does not have: UDP-MIB, TCP-MIB modules. ") vmwVA2015x.setReference('http://www.vmware.com/products') mibBuilder.exportSymbols("VMWARE-VA-AGENTCAP-MIB", vmwVA2015x=vmwVA2015x, vmwVAAgentCapabilityMIB=vmwVAAgentCapabilityMIB, PYSNMP_MODULE_ID=vmwVAAgentCapabilityMIB, vmwVACapability=vmwVACapability)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueSizeConstraint', 'SingleValueConstraint', 'ConstraintsIntersection', 'ValueRangeConstraint') (agent_capabilities, notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'AgentCapabilities', 'NotificationGroup', 'ModuleCompliance') (integer32, counter64, mib_scalar, mib_table, mib_table_row, mib_table_column, module_identity, bits, mib_identifier, time_ticks, iso, object_identity, ip_address, counter32, notification_type, gauge32, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Integer32', 'Counter64', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'ModuleIdentity', 'Bits', 'MibIdentifier', 'TimeTicks', 'iso', 'ObjectIdentity', 'IpAddress', 'Counter32', 'NotificationType', 'Gauge32', 'Unsigned32') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') (vmware_agent_capabilities,) = mibBuilder.importSymbols('VMWARE-ROOT-MIB', 'vmwareAgentCapabilities') vmw_va_agent_capability_mib = module_identity((1, 3, 6, 1, 4, 1, 6876, 70, 5)) vmwVAAgentCapabilityMIB.setRevisions(('2015-01-12 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: vmwVAAgentCapabilityMIB.setRevisionsDescriptions(('Capabilities for VMware Virutal Appliance.',)) if mibBuilder.loadTexts: vmwVAAgentCapabilityMIB.setLastUpdated('201501120000Z') if mibBuilder.loadTexts: vmwVAAgentCapabilityMIB.setOrganization('VMware, Inc') if mibBuilder.loadTexts: vmwVAAgentCapabilityMIB.setContactInfo('VMware, Inc 3401 Hillview Ave Palo Alto, CA 94304 Tel: 1-877-486-9273 or 650-427-5000 Fax: 650-427-5001 Web: http://communities.vmware.com/community/developer/forums/managementapi ') if mibBuilder.loadTexts: vmwVAAgentCapabilityMIB.setDescription('This module defines agent capabilities for deployed VMware Virtual Appliance agents by release.') vmw_va_capability = mib_identifier((1, 3, 6, 1, 4, 1, 6876, 70, 5, 1)) vmw_va2015x = agent_capabilities((1, 3, 6, 1, 4, 1, 6876, 70, 5, 1, 5)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): vmw_va2015x = vmwVA2015x.setProductRelease('6.0.x') if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): vmw_va2015x = vmwVA2015x.setStatus('current') if mibBuilder.loadTexts: vmwVA2015x.setDescription("Release 2015 aka 6.0 for VMware Virtual Appliance supporting SNMPv1, SNMPv2c, and SNMPv3. This agent supports read-only protocol operations, shares same configuration file as VMware ESXi agent. This implies that configuring the SNMPv3 Agent can not be done via SET operations or use SET PDU to discover engine id. Hence IETF standard SNMPv3 agent configuration mibs are not provided. The SNMPv3 protocol is fully supported once configured via the CLI command interface, run applianceh shell using the 'snmp' command set. Lastly this SNMP agent provides one read-only view of the entire system to which all SNMPv3 users configured are assigned. This initial release does not have: UDP-MIB, TCP-MIB modules. ") vmwVA2015x.setReference('http://www.vmware.com/products') mibBuilder.exportSymbols('VMWARE-VA-AGENTCAP-MIB', vmwVA2015x=vmwVA2015x, vmwVAAgentCapabilityMIB=vmwVAAgentCapabilityMIB, PYSNMP_MODULE_ID=vmwVAAgentCapabilityMIB, vmwVACapability=vmwVACapability)
''' 1. True y 2. False y 3. False y 4. True y 5. True y 6. False n 7. False y 8. True y 9. False y 10. False y 11. True y 12. False y 13. True y 14. False y 15. False y 16. True n 17. True y 18. True y 19. False y 20. False y '''
""" 1. True y 2. False y 3. False y 4. True y 5. True y 6. False n 7. False y 8. True y 9. False y 10. False y 11. True y 12. False y 13. True y 14. False y 15. False y 16. True n 17. True y 18. True y 19. False y 20. False y """
def palm_pilot(general, dev, msg) : code = 13 prio = 800 prio += adjust_prio(general, dev, msg) keys=list(); keys.append('Bottom of Cesar Chavez (LHS)') keys.append('South Hall entrance 1') if ( disallowed(general, dev) or not contains(dev, keys) ) : return (0, 0, 0, '', '') if ( dev['Bottom of Cesar Chavez (LHS)']['last_seen'] > dev['South Hall entrance 1']['last_seen'] and general['time']-dev['Bottom of Cesar Chavez (LHS)']['last_seen'] < 45*60 and general['time']-dev['South Hall entrance 1']['last_seen'] < 90*60) : code=13 else : return (0, 0, 0, '', '') title = "Palm pilot" body = "\ Do you know the history of this palm circle? Apparently the first people to settle San Jose, long before the Spanish arrived, before even the first dot com boom, found a circle of huge palms growing alone in the desert. There was nothing else for miles around, no people, no plants, no water. As they approached the tops of the trees could be seen through the haze swaying gently above the horizon. Then their massive trunks. Then the roots surrounded by the broken husks of fallen coconuts. It seemed to take a lifetime to finally reach the base of the trees through the unforgiving heat. When they did they found the shells of the broken nuts and the roots of the trees had combined in such a way that they were perfectly aligned with the path they had taken, and also with the route they were planning to take. Legend has it that over the millennia travellers more numerous than I could mention have found their path mapped out at the foot of those great trees. Many found their way when before they were lost, often saving them from certain death in the desert.\n\ \n\ I dont know if this is why people chose to settle in San Jose, but they say it is still possible to find your way by the palm tree circle. I had a little look just a few minutes ago, from what I could tell some traveller has arrived from the South, passing what looks like the South Hall exhibition center at %s and reaching the bottom of Plaza de Cesar Chavez at %s." % \ ( approx_time(dev['South Hall entrance 1']['last_seen']), approx_time(dev['Bottom of Cesar Chavez (LHS)']['last_seen']) ) body += sig('Sly') body += location_and_time(general) body += dev_log(general, dev, msg) body += loca_sig() return ( prio, code, title, title, body )
def palm_pilot(general, dev, msg): code = 13 prio = 800 prio += adjust_prio(general, dev, msg) keys = list() keys.append('Bottom of Cesar Chavez (LHS)') keys.append('South Hall entrance 1') if disallowed(general, dev) or not contains(dev, keys): return (0, 0, 0, '', '') if dev['Bottom of Cesar Chavez (LHS)']['last_seen'] > dev['South Hall entrance 1']['last_seen'] and general['time'] - dev['Bottom of Cesar Chavez (LHS)']['last_seen'] < 45 * 60 and (general['time'] - dev['South Hall entrance 1']['last_seen'] < 90 * 60): code = 13 else: return (0, 0, 0, '', '') title = 'Palm pilot' body = 'Do you know the history of this palm circle? Apparently the first people to settle San Jose, long before the Spanish arrived, before even the first dot com boom, found a circle of huge palms growing alone in the desert. There was nothing else for miles around, no people, no plants, no water. As they approached the tops of the trees could be seen through the haze swaying gently above the horizon. Then their massive trunks. Then the roots surrounded by the broken husks of fallen coconuts. It seemed to take a lifetime to finally reach the base of the trees through the unforgiving heat. When they did they found the shells of the broken nuts and the roots of the trees had combined in such a way that they were perfectly aligned with the path they had taken, and also with the route they were planning to take. Legend has it that over the millennia travellers more numerous than I could mention have found their path mapped out at the foot of those great trees. Many found their way when before they were lost, often saving them from certain death in the desert.\n\nI dont know if this is why people chose to settle in San Jose, but they say it is still possible to find your way by the palm tree circle. I had a little look just a few minutes ago, from what I could tell some traveller has arrived from the South, passing what looks like the South Hall exhibition center at %s and reaching the bottom of Plaza de Cesar Chavez at %s.' % (approx_time(dev['South Hall entrance 1']['last_seen']), approx_time(dev['Bottom of Cesar Chavez (LHS)']['last_seen'])) body += sig('Sly') body += location_and_time(general) body += dev_log(general, dev, msg) body += loca_sig() return (prio, code, title, title, body)
{ "targets": [ { "target_name": "addon", "sources": [ "src/logql.cc" ], "libraries": [ "<!(pwd)/logql.so" ] } ] }
{'targets': [{'target_name': 'addon', 'sources': ['src/logql.cc'], 'libraries': ['<!(pwd)/logql.so']}]}
def Articles(): articles = [ { 'id': 1, 'title': 'Article One', 'body': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', 'author': 'Felix Essienne', 'created_at': '04-25-2019' }, { 'id': 2, 'title': 'Article Two', 'body': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', 'author': 'John Doe', 'created_at': '11-01-2019' }, { 'id': 3, 'title': 'Article Three', 'body': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', 'author': 'Adelaide Nyaba', 'created_at': '04-12-2019' }, { 'id': 4, 'title': 'Article Four', 'body': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', 'author': 'Rosina Ama', 'created_at': '01-09-2019' } ] return articles
def articles(): articles = [{'id': 1, 'title': 'Article One', 'body': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', 'author': 'Felix Essienne', 'created_at': '04-25-2019'}, {'id': 2, 'title': 'Article Two', 'body': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', 'author': 'John Doe', 'created_at': '11-01-2019'}, {'id': 3, 'title': 'Article Three', 'body': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', 'author': 'Adelaide Nyaba', 'created_at': '04-12-2019'}, {'id': 4, 'title': 'Article Four', 'body': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', 'author': 'Rosina Ama', 'created_at': '01-09-2019'}] return articles
def removeDuplicates(s: str) -> str: i = 0 while i < len(s)-1: if s[i] == s[i+1]: s = s[i+2:] if s==0 else s[:i]+s[i+2:] i = 0 if i==0 else i-1 else: i+=1 return s print(removeDuplicates("gnyogdbncigrwnjjtqtyregqyhkinjxgzmkpxskloxjcensflhhxlpfkrcmuctrrqahjlmziiupsenyaagbamdkxgqswexvffjygshlkcvdmjypmpduactfnlezrltjirqntomjomkkjdotvlfjafboajhklqvboluugoorigqswfzblnzqmxrootnudnqenmtffuzhallvqmlvmhvulbasxmbtfytqrpdxthbfezwfmaenimwnjhxjhtncyhmlazjjlqxtavunztuhhxduzbwnunjeiorsjnqqtkpoomfpoomshvaolvhkaeldunxvaheorqjjsvbxijmeftlsglnijdfgnpeisacakcyogdvwaeanzinmzecqzptmaqymdtcnctdyqukzxjjoqgllpyzmoaqdbiurwgdnxzaavdvjfoplymjkhzailvdqoohdrwihokdxzfqnnpsccfwfappvpozccxfefflqpstzzxvjpgdwenirlsxfkcstwvuatmturxgczkriaalhoqylrnrullmqajxrxvmkeyrcogpjwralyvxhdinhsfeksbwdtywbdnmucgdukrcltsjqehvkbhqmhvarpupvgwxqydnbrvmxmqlddaqvalnewursnrvlcofejwjryexpvglkyjkrgigpewxdbfoacmnxjqzqumtjmyjcmnukfotapbfybhnnbgtnyvneoiiiabqonoqaykrtopgdvcnwcfhqeamvbwzgmzrjegszfzgxfasgvicxqxmllgvhqzypaapfrjrmgrwdpcvfgdgkmkwmlyymybryxyunjzglpfqbwhihtsvujejryntmqldlgtegkwxmzwfqjexuiznzycstunbzpcfrlmocijwoclexdzdkkgeflesklphhsqteplpscgsjhfrmxmwstpljhsvcqyuscnvuadidyprjqyoygvgwozqigmxtstoetsfjvvdpmmfbfnpijjybxquvfaxsfrzlecwboqqlqbffhqaynmfhfbanspotydwtdllbolveyjwrkrvnpcdmgtsikrfylusoyyqrpglmviwqzebuoxslildwbjlimytbsvrypkwgdqdcwxkbtlvklhiwhytbqycipvtuiuebszihybdrzpobnszrdhdltnnrbqbvqxjrpltvxydhmwbwswkgxzrpupoxhtdercsvhkizpjwqlqtncvyufaxtjdznojtvbplgfzgtuvrtuujfhxcxupddmduklodecnxtlgszswmowszfrqakrqnsvnvipyadbruuknkijpphdtbkxveyijdoaflwdetbagvqhksabyapmvlufeftzfkvxzrhasuianvslpfcikzrdvghokiwntuouiadysnghymcyvnworaecsffciwsmrxzcsopmifigkxbqmdsgtelajmgabzxgsqqtanmkebcpwudwwsmtfaqrxiyohfymgqcifgyvydqtpvzbrhwhntnhwrflrrayknllojkdijbbupaklzvpzlxofjiidyllitjtgxfvhxzhxbngdjvbamlouxrtfzgtfqyuthhlhiiwropqlsxazzqcjpomvwctotidohpaavhvuiwljdzeycjasacdedxpdlkxkqukhueicdxdzrbgpagenspiyuguowbmsydcxfldnfdstyqeacyrdbrbicepwevbhugzecqengmpadgkksqyycnqeilfyomjtmyulgavbogsibfoajcoqsblehgvivoibhkwuulvzawebjbusbpnthtidkgivptcwqgeealdmmsfzdlsksqyvfogzxirsyupfphvndljblgiklherznezjoqratdpaubvdicijbqiemtcfjghzxkbrryttfhpusfbkhmgmmoexltbhsoflpqdmwvhpgzkdqwpszznjimvlwhmwqpinnorgjpptpwxpwgagtubszwvgiczsfzwrmvrjwvwupapsiolbzbjitxjedfyughkzpkhujvkahsxyblsewzanydmzwlgmjvftwmsbjecdosfikvhjrqqhxmehavbyeemteuqvgoxjkpgvgrlabpypckbkkoqfauyuqojtmxmyzwgtxfgxqoxaahzpkbrbtuymrgdxmrfqmwbrpjnkqzdolptzcwmnvjxkbdahyytikvvbandzfhjjbaogoxxfyjbraqjjmoyiibmfterpaxrkreymmtpfjvztgquwbxkxrvfkegvaxwktzhvfrykrvsyrixjpfrbmzcoszektofgdpdfvqsbjfygregsygkhdfndqhoijkzloradgzbwjpnavwzdrnvptsdgfmapqmhaoakadjybfqgorzcnkaojmcotombnchjdskxavyrjtpwcjgaoilcyvqalofltksjildedotsitktyzenywwvtttuyimlnbtoxlazvmjiwvvdeikdzmuitdbxufvtdmypsunrpdnqxfcobdkfvsojfwnifscjcvypndgbyjqntwfxflyktjbpjqsnfkqpbwuahoyhgeoouulkbcnfkqlxqfynefjkwitpsmnsrhficxzcyobzodyvrvskzqeivwytfpjnqmmiuyvvzsmuqyqkolvaccbyqixtbljwhisxilhadwqejoazilbizmuzyolnfpvxfguikclbsdsgpdtezexgcrlbkkpgnftwtqtdfztkhwxwbhwlcxeinmsiiivskkrjpvznuukjzxiyajbpduurpakyigieabqdiopchzechzllywazexaqiegwmldblzylsxahzspbgwnvfklluljgolyztuonjxxhpwkyuykafgvparuerfyynxygqhtelsildgeqvcsxkmpteyotadxwnxcybayrlgvtkmlsaxcoalarzbvgbonaafidquicefrcrytzgqgxosduscpilmbbrlnriyrfsracyctdmunsmzoytixvdgrroyfapjwztamzurqwcdcbqmwvhorwtjukxjbhktvwmqhysoyvcwzzprewkgmjcfdhhohgimpzltltzxinlpukbcaevgghltiwnlbozzfitkxncpjjminjzjrhvxbgvfcuzfcpsdlcklxmbdfafqixwlmfyuckxdoyeqceiqqxysygjdlwrzkiqwihaqotvacvuadhwlfcpgazbpahgmxhqnbjuuwnkdrbtypuboeiwendakeejucjudqjwvbuqfemilgvytqsjismxlgrqltwekymjlyqzeqpjhdgacklbsfyspxnqxcyqzvqmgihhuhpbavrhdpkjqmvusvkemobcmmmuostueklvejcoyqmsjlgiuzzypvxjlvskzlkntyaiippsurcowvrnymwukxazmfnurbjgidyjzbgmqwjcfmnssdebzkavddltmsooxgbczfjhpiammeuhnzqdushgcadvluimeysgtjyznyqqqmenmadaborhcncuqutravcrthhfmthsbicnfevimbpbishsrraksjwlvdwonecuvoeevmyhmtxstkvlxenpmkkygiiyqzfrsvpxrpflpccnzvnqnbexajvciibqkhzvizcgvwnetisxyailxkrxjkkoankqyigyrmjclaqrzxyffkzcnnfhwgqgmiwpkjtgnjwvohconiugobjtnxpevvvqsxtrvhbdmmjjltkxlfkselygkyjkbkktzwqadejsgxwsqhxrjgsgmqxmlwnqbotshysrhyqpxqbiqlyzxanxcqwryaeadjjhlbpgwrfixaialnjtplrgxiafbslmjmblexbuczzllrkivtjoyinaxhdaxeklkakwgtifpdnepryvqekumvhvkqwqdhvxnmxivhsosiwhbfysmdenpcyqvjfgldyfiusdxtliiprkkdvmdzwcmgkitpbsxoyzucuijiljjgvopispzuwtltkidxsybztgyczzsgvudyvvwejqqdqjatodzltqucgnstoemxcotgqdvdrzytddqamurevcpndikbsrfhgiitwrzpaecookkciybfvwmodedewgofydbfqfgwuhyjuhskdpdtujducgoxogjfsouqkhkfplnvoqywnwnonrltolbgzjohdxlwobucbuwghkdulemgryelbclvwkwijlsyrlzocybrqhcfmpovcbmfvfikegaqpdzkpvbfmkezlxpseeisbnwncjlolumwzikksrkxhfkllyureidpmmrtkkvkjbumdnmpxitrlxqlktwrtqdgatdazmqrztrmvknijwormqebfgnfbbncfggmzfvfkzsexmyrxrcvuipjulrmgwvmejztilytfjjyhuutslzhpwasosxqoothdspqinvbjhgrrzbbbmzedhdwfzihznptdggxgflqaiavtctifhlcshebkfajbcdxwngkikdzytddbebzayrphmmobhvvaodgntojbhvaemxzffwqpdmsqjoujbhxjoasbayfpdgjfulvfcrgwslnyqyqdmzfhxvufcotpzdwyhxqsisvonqgsplgsxqogblheybufdwddutmsyfuvfjgyccrfgawhzqejocwjguihzdvyfzeaimvtcdcjqrzcuwzvqrgjrdhjpnfkppprgqvgpivfikpdzkkjkgtusrvujdxltvsrhchzcgdvucnzzyskwdntywzqbwzzarwirgxmokhdixuoqrxhexmsbytnrcfkpxyldalbkqauihsxlcrbqjzzobwsensohnqprzxusmewymtkdfcolfhwxqippmksmlrnlfqlhrenldnjzxqdrtjjygcwqbdhtqicpkqwhmdevlsgmobqosqjmpffoeixbxxrhvrumebtgimhiijhtdrppzhiuhrunmrvzbswlzgvymmgqwihuoflwwhaywajadpfzojkjhdncqtrfpaqqfagvwcntbkdqhzkciwlapkomodmqyxwtquypbbjdefmezkerketzctzdoiislfmleaufovnpabwychebmvxlnkjsfybfuoxsoomxgioiomzauwaspldxwrntkvawlcovclrkfonxdvkazqtzazsanoqwzozlyryyotdxxaiosmfugkrgclmxbvvscmlgbpqmluctdvicyhirqmfvcblaaattivahnrxhhfgxccklbrcbvlbkjwpultvhathockapgjhtrkfrdqrreantgyishlmqmwxubmyxvjdmelwatuqgticskxchgzfueeglpizljgqwdwcowuvmeufsscdgljkobyqikworwzgddwdasgwehoxxcvdxykualubmrzhtwvvrpnburqtuygvzjuypuojbcuaiqidfywduhpuyqfksxzooadifrokqjxmrpqmdmakpbnswdhtfzmxsivqeervgfzyrmyftnoxauluiiecabgmoquqtywzwgkltrgzygxeuphhpgydtyxnobwfornvqitfcwatqjnogpteroweniwnkeehkgnahxaaqsdgvwbltozxewnqblchuacnkpzjxgvaoywrufaseezukagdoabsqmihrctxmcxgstcjsxvdxqzodlfezoegtwzkkoshhxcsfzkzbyclhhjfxzspjfewflnfyspwupkrvwyykgvzhwhabxpdofyaeryazdqfmlipwtlnlfadqnbwfnrqrzceigjrcbubuoonhywhcxajdclvpbnrjcxxbvgyyganyqszugltgonbynqzvqoflqkxwijvdemyobvbmkqctfbpmpcdxpwcmmbupmkefntdldjvrkqukotlebzwyenuajedcgwjrrcqhfktzvlysxbjpauhkjrfkvudtefkdxsaywuhqjbwybfcorchxdcleidjwafrqxlcmcmrxkmpzcazdgdlxyxoebzknsxrdsobttyncpgdxccoxhqmohiwwtqgflnedlavzisporhtbhzizggmwarrckwowcxhzyvjpbvbatduzrudsmezkhzfxchyizgsjwsllmplbtcdtotkzepwsrrddmwvpgwmwhqsnfkyhzmfhymzwhhvqgnixjsqtrxvrdjdbitwxrlnuovbwtqrtnqmauznxhqlsoylhtummzrkopngaelgmjzgsbotpndmimipiozinfxnskmqbuzjhwnmuoxwrngfrplzytzlzmfhvwgvcldmzmauvhhovriwzkixrmshtanxacgryjamqbsfakxynmlylqgirberwaaaaauczpsgscppglpndnnnqdlgospkypvafxiwspkhsobxgvsemqvtmpsluigwmdwqipzrkeyawxxplibsenftdymuavxvnxuutqvzwjbezzgrlpzmpmvjfyudcbqdjhkrmhykjoaiywqvnzrhfihenbwlenwibzldkyrsdqfrcfrlgkbkkscceohmlobydzsphyoitoaoexrdcqjsfkopecyywgazzfftugzykmtymuurwikeoivibpfwtxvekpidkbgrnqkgdwvyofxpnxihgrpahtkwlackzawblhhevosqpodrcxnljqikojnpmhonbogxnvszqlxmrfpjkiwcbsflawkejxnnhtdtzxpnmhdggshhrgapvptobkkogamtdpzeuskdhiyuhkeysxbktqneiqmfksxklqrxfozpakjjmiiqwljdmkgqzgwssqbpjsiqzmumpiynjuwknkdozxicwcdliabidlovhqpkcpjbnwprjnvxxlqzbfcisxxvtltolvslqrgsjqlibhtmlzppcfqriyovojwliqlgyybyrkopnhxfmwtliozuvfjwovqyjhayojbnlkegveqoahwdnpdnaxcbzrnjlqmmlvprejbbjpytaizkjdsalkvsjkxhhohlhkpasgkkdsnvbnwaiwzlaeryuuorxevqwqfevlegfnavetxgykukwoazrjkzimbecpllxuoeonnfcdekzurlphocsqfwhvidekpojgongdguzzkxshfcygxmtwfxvynrgwoursradnecinkuzhctelpyecxsxlqhstgpqfwkbfxsumxcmczkdopgxbbytegpqbimjpwfcyloenxgluiturfokzalymywqdemncrajozxnyrdgyulacxgmmktpagkrpsdmfbvublbwkouexgoclqozuvgzshudfscnlufbclkbkrubjfrbnhpxxnszcyifmsdykbocwocvqoytozfkgwmeiczobuvwrucfjelntebzblroiqsbteocdptimlcjcuwecbfgrbpwnqmasbrtlyeqezyesnszbjnjnvzabwylchplvadoklzwykazdlambaixczmdhteioflodvscdzrwgedapbvjcbdulvlvqulgbbahxlojejzgavpkfviutyklsmfrcjruljtgtvlifosigvsvybmjbcpfcbxybdqpdkmndcjyyefbjnymfuwvwevhqryoqqfcwwkqwnngjcorpqyealbdqiwktlqkwmuhcckaqtqdspcpcuoshjypfvvcjzmcfcanblrbwpacejfefcjlpcbcqyuisngcjmqhueuliyacwpuztjgunhbetupfpetfhmiskwwygwptpsemeebvvrkumzwkbwshptbhudoctvbidokgwdfvfsxsxzoialdhxlivaztakzteqkfncwzzqxixigjpqjxusexlqdcanidqxtvmktzgvzmqpbkygnoifholvuiimnbrmgduttnlqzyjdksmlcodwerzmnwkkaqhafjtuarcyvxwgvnchvqihbwbhhmsrhifspkaoqvkgdnuktbtdytdnqzifkhxoxqeetbiconkkfwmtsyhkegyuuqikntnhcoblfbljmpbgobskezlqicxmvxwgxzskdalreybmwcafktnuuzcvkuqqhohzejqyqalqxngkprtwrocrafpovbnzlgwpvktxrszdspmstqnlicnokqdcoolftqwifelogwwncnmaustpmexrpqqbvssqfkucwfmsbxjpszqjpysnsvmwbdnchrodyzubnwrptbefojsjeehhyifyqnjrpwbfodhjrhytnfpvzwbwhxqzpblgindehlhinkozsupqrbptortjglaimblyizcbgxxoknpdhpjlrpkdntftgw"))
def remove_duplicates(s: str) -> str: i = 0 while i < len(s) - 1: if s[i] == s[i + 1]: s = s[i + 2:] if s == 0 else s[:i] + s[i + 2:] i = 0 if i == 0 else i - 1 else: i += 1 return s print(remove_duplicates('gnyogdbncigrwnjjtqtyregqyhkinjxgzmkpxskloxjcensflhhxlpfkrcmuctrrqahjlmziiupsenyaagbamdkxgqswexvffjygshlkcvdmjypmpduactfnlezrltjirqntomjomkkjdotvlfjafboajhklqvboluugoorigqswfzblnzqmxrootnudnqenmtffuzhallvqmlvmhvulbasxmbtfytqrpdxthbfezwfmaenimwnjhxjhtncyhmlazjjlqxtavunztuhhxduzbwnunjeiorsjnqqtkpoomfpoomshvaolvhkaeldunxvaheorqjjsvbxijmeftlsglnijdfgnpeisacakcyogdvwaeanzinmzecqzptmaqymdtcnctdyqukzxjjoqgllpyzmoaqdbiurwgdnxzaavdvjfoplymjkhzailvdqoohdrwihokdxzfqnnpsccfwfappvpozccxfefflqpstzzxvjpgdwenirlsxfkcstwvuatmturxgczkriaalhoqylrnrullmqajxrxvmkeyrcogpjwralyvxhdinhsfeksbwdtywbdnmucgdukrcltsjqehvkbhqmhvarpupvgwxqydnbrvmxmqlddaqvalnewursnrvlcofejwjryexpvglkyjkrgigpewxdbfoacmnxjqzqumtjmyjcmnukfotapbfybhnnbgtnyvneoiiiabqonoqaykrtopgdvcnwcfhqeamvbwzgmzrjegszfzgxfasgvicxqxmllgvhqzypaapfrjrmgrwdpcvfgdgkmkwmlyymybryxyunjzglpfqbwhihtsvujejryntmqldlgtegkwxmzwfqjexuiznzycstunbzpcfrlmocijwoclexdzdkkgeflesklphhsqteplpscgsjhfrmxmwstpljhsvcqyuscnvuadidyprjqyoygvgwozqigmxtstoetsfjvvdpmmfbfnpijjybxquvfaxsfrzlecwboqqlqbffhqaynmfhfbanspotydwtdllbolveyjwrkrvnpcdmgtsikrfylusoyyqrpglmviwqzebuoxslildwbjlimytbsvrypkwgdqdcwxkbtlvklhiwhytbqycipvtuiuebszihybdrzpobnszrdhdltnnrbqbvqxjrpltvxydhmwbwswkgxzrpupoxhtdercsvhkizpjwqlqtncvyufaxtjdznojtvbplgfzgtuvrtuujfhxcxupddmduklodecnxtlgszswmowszfrqakrqnsvnvipyadbruuknkijpphdtbkxveyijdoaflwdetbagvqhksabyapmvlufeftzfkvxzrhasuianvslpfcikzrdvghokiwntuouiadysnghymcyvnworaecsffciwsmrxzcsopmifigkxbqmdsgtelajmgabzxgsqqtanmkebcpwudwwsmtfaqrxiyohfymgqcifgyvydqtpvzbrhwhntnhwrflrrayknllojkdijbbupaklzvpzlxofjiidyllitjtgxfvhxzhxbngdjvbamlouxrtfzgtfqyuthhlhiiwropqlsxazzqcjpomvwctotidohpaavhvuiwljdzeycjasacdedxpdlkxkqukhueicdxdzrbgpagenspiyuguowbmsydcxfldnfdstyqeacyrdbrbicepwevbhugzecqengmpadgkksqyycnqeilfyomjtmyulgavbogsibfoajcoqsblehgvivoibhkwuulvzawebjbusbpnthtidkgivptcwqgeealdmmsfzdlsksqyvfogzxirsyupfphvndljblgiklherznezjoqratdpaubvdicijbqiemtcfjghzxkbrryttfhpusfbkhmgmmoexltbhsoflpqdmwvhpgzkdqwpszznjimvlwhmwqpinnorgjpptpwxpwgagtubszwvgiczsfzwrmvrjwvwupapsiolbzbjitxjedfyughkzpkhujvkahsxyblsewzanydmzwlgmjvftwmsbjecdosfikvhjrqqhxmehavbyeemteuqvgoxjkpgvgrlabpypckbkkoqfauyuqojtmxmyzwgtxfgxqoxaahzpkbrbtuymrgdxmrfqmwbrpjnkqzdolptzcwmnvjxkbdahyytikvvbandzfhjjbaogoxxfyjbraqjjmoyiibmfterpaxrkreymmtpfjvztgquwbxkxrvfkegvaxwktzhvfrykrvsyrixjpfrbmzcoszektofgdpdfvqsbjfygregsygkhdfndqhoijkzloradgzbwjpnavwzdrnvptsdgfmapqmhaoakadjybfqgorzcnkaojmcotombnchjdskxavyrjtpwcjgaoilcyvqalofltksjildedotsitktyzenywwvtttuyimlnbtoxlazvmjiwvvdeikdzmuitdbxufvtdmypsunrpdnqxfcobdkfvsojfwnifscjcvypndgbyjqntwfxflyktjbpjqsnfkqpbwuahoyhgeoouulkbcnfkqlxqfynefjkwitpsmnsrhficxzcyobzodyvrvskzqeivwytfpjnqmmiuyvvzsmuqyqkolvaccbyqixtbljwhisxilhadwqejoazilbizmuzyolnfpvxfguikclbsdsgpdtezexgcrlbkkpgnftwtqtdfztkhwxwbhwlcxeinmsiiivskkrjpvznuukjzxiyajbpduurpakyigieabqdiopchzechzllywazexaqiegwmldblzylsxahzspbgwnvfklluljgolyztuonjxxhpwkyuykafgvparuerfyynxygqhtelsildgeqvcsxkmpteyotadxwnxcybayrlgvtkmlsaxcoalarzbvgbonaafidquicefrcrytzgqgxosduscpilmbbrlnriyrfsracyctdmunsmzoytixvdgrroyfapjwztamzurqwcdcbqmwvhorwtjukxjbhktvwmqhysoyvcwzzprewkgmjcfdhhohgimpzltltzxinlpukbcaevgghltiwnlbozzfitkxncpjjminjzjrhvxbgvfcuzfcpsdlcklxmbdfafqixwlmfyuckxdoyeqceiqqxysygjdlwrzkiqwihaqotvacvuadhwlfcpgazbpahgmxhqnbjuuwnkdrbtypuboeiwendakeejucjudqjwvbuqfemilgvytqsjismxlgrqltwekymjlyqzeqpjhdgacklbsfyspxnqxcyqzvqmgihhuhpbavrhdpkjqmvusvkemobcmmmuostueklvejcoyqmsjlgiuzzypvxjlvskzlkntyaiippsurcowvrnymwukxazmfnurbjgidyjzbgmqwjcfmnssdebzkavddltmsooxgbczfjhpiammeuhnzqdushgcadvluimeysgtjyznyqqqmenmadaborhcncuqutravcrthhfmthsbicnfevimbpbishsrraksjwlvdwonecuvoeevmyhmtxstkvlxenpmkkygiiyqzfrsvpxrpflpccnzvnqnbexajvciibqkhzvizcgvwnetisxyailxkrxjkkoankqyigyrmjclaqrzxyffkzcnnfhwgqgmiwpkjtgnjwvohconiugobjtnxpevvvqsxtrvhbdmmjjltkxlfkselygkyjkbkktzwqadejsgxwsqhxrjgsgmqxmlwnqbotshysrhyqpxqbiqlyzxanxcqwryaeadjjhlbpgwrfixaialnjtplrgxiafbslmjmblexbuczzllrkivtjoyinaxhdaxeklkakwgtifpdnepryvqekumvhvkqwqdhvxnmxivhsosiwhbfysmdenpcyqvjfgldyfiusdxtliiprkkdvmdzwcmgkitpbsxoyzucuijiljjgvopispzuwtltkidxsybztgyczzsgvudyvvwejqqdqjatodzltqucgnstoemxcotgqdvdrzytddqamurevcpndikbsrfhgiitwrzpaecookkciybfvwmodedewgofydbfqfgwuhyjuhskdpdtujducgoxogjfsouqkhkfplnvoqywnwnonrltolbgzjohdxlwobucbuwghkdulemgryelbclvwkwijlsyrlzocybrqhcfmpovcbmfvfikegaqpdzkpvbfmkezlxpseeisbnwncjlolumwzikksrkxhfkllyureidpmmrtkkvkjbumdnmpxitrlxqlktwrtqdgatdazmqrztrmvknijwormqebfgnfbbncfggmzfvfkzsexmyrxrcvuipjulrmgwvmejztilytfjjyhuutslzhpwasosxqoothdspqinvbjhgrrzbbbmzedhdwfzihznptdggxgflqaiavtctifhlcshebkfajbcdxwngkikdzytddbebzayrphmmobhvvaodgntojbhvaemxzffwqpdmsqjoujbhxjoasbayfpdgjfulvfcrgwslnyqyqdmzfhxvufcotpzdwyhxqsisvonqgsplgsxqogblheybufdwddutmsyfuvfjgyccrfgawhzqejocwjguihzdvyfzeaimvtcdcjqrzcuwzvqrgjrdhjpnfkppprgqvgpivfikpdzkkjkgtusrvujdxltvsrhchzcgdvucnzzyskwdntywzqbwzzarwirgxmokhdixuoqrxhexmsbytnrcfkpxyldalbkqauihsxlcrbqjzzobwsensohnqprzxusmewymtkdfcolfhwxqippmksmlrnlfqlhrenldnjzxqdrtjjygcwqbdhtqicpkqwhmdevlsgmobqosqjmpffoeixbxxrhvrumebtgimhiijhtdrppzhiuhrunmrvzbswlzgvymmgqwihuoflwwhaywajadpfzojkjhdncqtrfpaqqfagvwcntbkdqhzkciwlapkomodmqyxwtquypbbjdefmezkerketzctzdoiislfmleaufovnpabwychebmvxlnkjsfybfuoxsoomxgioiomzauwaspldxwrntkvawlcovclrkfonxdvkazqtzazsanoqwzozlyryyotdxxaiosmfugkrgclmxbvvscmlgbpqmluctdvicyhirqmfvcblaaattivahnrxhhfgxccklbrcbvlbkjwpultvhathockapgjhtrkfrdqrreantgyishlmqmwxubmyxvjdmelwatuqgticskxchgzfueeglpizljgqwdwcowuvmeufsscdgljkobyqikworwzgddwdasgwehoxxcvdxykualubmrzhtwvvrpnburqtuygvzjuypuojbcuaiqidfywduhpuyqfksxzooadifrokqjxmrpqmdmakpbnswdhtfzmxsivqeervgfzyrmyftnoxauluiiecabgmoquqtywzwgkltrgzygxeuphhpgydtyxnobwfornvqitfcwatqjnogpteroweniwnkeehkgnahxaaqsdgvwbltozxewnqblchuacnkpzjxgvaoywrufaseezukagdoabsqmihrctxmcxgstcjsxvdxqzodlfezoegtwzkkoshhxcsfzkzbyclhhjfxzspjfewflnfyspwupkrvwyykgvzhwhabxpdofyaeryazdqfmlipwtlnlfadqnbwfnrqrzceigjrcbubuoonhywhcxajdclvpbnrjcxxbvgyyganyqszugltgonbynqzvqoflqkxwijvdemyobvbmkqctfbpmpcdxpwcmmbupmkefntdldjvrkqukotlebzwyenuajedcgwjrrcqhfktzvlysxbjpauhkjrfkvudtefkdxsaywuhqjbwybfcorchxdcleidjwafrqxlcmcmrxkmpzcazdgdlxyxoebzknsxrdsobttyncpgdxccoxhqmohiwwtqgflnedlavzisporhtbhzizggmwarrckwowcxhzyvjpbvbatduzrudsmezkhzfxchyizgsjwsllmplbtcdtotkzepwsrrddmwvpgwmwhqsnfkyhzmfhymzwhhvqgnixjsqtrxvrdjdbitwxrlnuovbwtqrtnqmauznxhqlsoylhtummzrkopngaelgmjzgsbotpndmimipiozinfxnskmqbuzjhwnmuoxwrngfrplzytzlzmfhvwgvcldmzmauvhhovriwzkixrmshtanxacgryjamqbsfakxynmlylqgirberwaaaaauczpsgscppglpndnnnqdlgospkypvafxiwspkhsobxgvsemqvtmpsluigwmdwqipzrkeyawxxplibsenftdymuavxvnxuutqvzwjbezzgrlpzmpmvjfyudcbqdjhkrmhykjoaiywqvnzrhfihenbwlenwibzldkyrsdqfrcfrlgkbkkscceohmlobydzsphyoitoaoexrdcqjsfkopecyywgazzfftugzykmtymuurwikeoivibpfwtxvekpidkbgrnqkgdwvyofxpnxihgrpahtkwlackzawblhhevosqpodrcxnljqikojnpmhonbogxnvszqlxmrfpjkiwcbsflawkejxnnhtdtzxpnmhdggshhrgapvptobkkogamtdpzeuskdhiyuhkeysxbktqneiqmfksxklqrxfozpakjjmiiqwljdmkgqzgwssqbpjsiqzmumpiynjuwknkdozxicwcdliabidlovhqpkcpjbnwprjnvxxlqzbfcisxxvtltolvslqrgsjqlibhtmlzppcfqriyovojwliqlgyybyrkopnhxfmwtliozuvfjwovqyjhayojbnlkegveqoahwdnpdnaxcbzrnjlqmmlvprejbbjpytaizkjdsalkvsjkxhhohlhkpasgkkdsnvbnwaiwzlaeryuuorxevqwqfevlegfnavetxgykukwoazrjkzimbecpllxuoeonnfcdekzurlphocsqfwhvidekpojgongdguzzkxshfcygxmtwfxvynrgwoursradnecinkuzhctelpyecxsxlqhstgpqfwkbfxsumxcmczkdopgxbbytegpqbimjpwfcyloenxgluiturfokzalymywqdemncrajozxnyrdgyulacxgmmktpagkrpsdmfbvublbwkouexgoclqozuvgzshudfscnlufbclkbkrubjfrbnhpxxnszcyifmsdykbocwocvqoytozfkgwmeiczobuvwrucfjelntebzblroiqsbteocdptimlcjcuwecbfgrbpwnqmasbrtlyeqezyesnszbjnjnvzabwylchplvadoklzwykazdlambaixczmdhteioflodvscdzrwgedapbvjcbdulvlvqulgbbahxlojejzgavpkfviutyklsmfrcjruljtgtvlifosigvsvybmjbcpfcbxybdqpdkmndcjyyefbjnymfuwvwevhqryoqqfcwwkqwnngjcorpqyealbdqiwktlqkwmuhcckaqtqdspcpcuoshjypfvvcjzmcfcanblrbwpacejfefcjlpcbcqyuisngcjmqhueuliyacwpuztjgunhbetupfpetfhmiskwwygwptpsemeebvvrkumzwkbwshptbhudoctvbidokgwdfvfsxsxzoialdhxlivaztakzteqkfncwzzqxixigjpqjxusexlqdcanidqxtvmktzgvzmqpbkygnoifholvuiimnbrmgduttnlqzyjdksmlcodwerzmnwkkaqhafjtuarcyvxwgvnchvqihbwbhhmsrhifspkaoqvkgdnuktbtdytdnqzifkhxoxqeetbiconkkfwmtsyhkegyuuqikntnhcoblfbljmpbgobskezlqicxmvxwgxzskdalreybmwcafktnuuzcvkuqqhohzejqyqalqxngkprtwrocrafpovbnzlgwpvktxrszdspmstqnlicnokqdcoolftqwifelogwwncnmaustpmexrpqqbvssqfkucwfmsbxjpszqjpysnsvmwbdnchrodyzubnwrptbefojsjeehhyifyqnjrpwbfodhjrhytnfpvzwbwhxqzpblgindehlhinkozsupqrbptortjglaimblyizcbgxxoknpdhpjlrpkdntftgw'))
#!/usr/local/bin/python3 def resultado_f1(**kwargs): for posicao, piloto in kwargs.items(): print(f'{posicao} -> {piloto}') if __name__ == '__main__': resultado_f1(primeiro='Hamilton', segundo='Massa') podium = {'primeiro': 'Hamilton', 'segundo': 'Massa'} resultado_f1(**podium)
def resultado_f1(**kwargs): for (posicao, piloto) in kwargs.items(): print(f'{posicao} -> {piloto}') if __name__ == '__main__': resultado_f1(primeiro='Hamilton', segundo='Massa') podium = {'primeiro': 'Hamilton', 'segundo': 'Massa'} resultado_f1(**podium)
#Write a class complex to represent complex numbers, #along with overloaded operators + and * which adds and multiplies them. #Formula --> (a+bi)(c+di) = (ac-bd) + (ad+bc)i class Complex: def __init__(self, r, i): self.real = r self.imaginary = i def __add__(self, c): return Complex(self.real +c.real, self.imaginary + c.imaginary) def __mul__(self, c): mulReal = self.real * c.real - self.imaginary * c.imaginary mulImg = self.real * c.imaginary + self.imaginary * c.real return Complex(mulReal, mulImg) def __str__(self): if self.imaginary < 0: return f"{self.real} - {-self.imaginary}i" else: return f"{self.real} + {self.imaginary}i" c1 = Complex(3, 2) c2 = Complex(1, 7) print(c1 + c2) print(c1 * c2)
class Complex: def __init__(self, r, i): self.real = r self.imaginary = i def __add__(self, c): return complex(self.real + c.real, self.imaginary + c.imaginary) def __mul__(self, c): mul_real = self.real * c.real - self.imaginary * c.imaginary mul_img = self.real * c.imaginary + self.imaginary * c.real return complex(mulReal, mulImg) def __str__(self): if self.imaginary < 0: return f'{self.real} - {-self.imaginary}i' else: return f'{self.real} + {self.imaginary}i' c1 = complex(3, 2) c2 = complex(1, 7) print(c1 + c2) print(c1 * c2)
guess = None value = 5 trial = 5 print("WELCOME TO OUR GUESS GAME") while trial > 0: print('Your remaining trial is {}'.format(trial)) guess = int(input('enter a number: ')) if guess == value: print('You win') break else: trial = trial-1 else: print('You loss')
guess = None value = 5 trial = 5 print('WELCOME TO OUR GUESS GAME') while trial > 0: print('Your remaining trial is {}'.format(trial)) guess = int(input('enter a number: ')) if guess == value: print('You win') break else: trial = trial - 1 else: print('You loss')
class IllegalArgumentException(Exception): pass class LinkedList: class _Node: def __init__(self, val=None, next_node=None): self.val = val self.next = next_node # def __str__(self): # return str(self.val) # def __repr__(self): # return self.__str__() def __init__(self): self._dummy_head = self._Node() self._size = 0 def get_size(self): return self._size def is_empty(self): return self._size == 0 def add(self, index, e): if index < 0 or index > self._size: raise IllegalArgumentException("add failed, illegal index.") prev = self._dummy_head for _ in range(index): prev = prev.next prev.next = self._Node(e, prev.next) self._size += 1 def add_first(self, e): self.add(0, e) def add_last(self, e): self.add(self._size, e) def get(self, index): if index < 0 or index >= self._size: raise IllegalArgumentException("get failed, illegal index.") cur = self._dummy_head.next for _ in range(index): cur = cur.next return cur.val def get_first(self): return self.get(0) def get_last(self): return self.get(self._size - 1) def set(self, index, e): if index < 0 or index >= self._size: raise IllegalArgumentException("set failed, illegal index.") cur = self._dummy_head.next for _ in range(index): cur = cur.next cur.val = e def contains(self, e): cur = self._dummy_head.next while cur is not None: if cur.val == e: return True cur = cur.next return False def remove(self, index): if index < 0 or index >= self._size: raise IllegalArgumentException("remove failed, illegal index.") prev = self._dummy_head for _ in range(index): prev = prev.next ret = prev.next prev.next = ret.next self._size -= 1 return ret.val def remove_first(self): return self.remove(0) def remove_last(self): return self.remove(self._size - 1) def __str__(self): res = "" cur = self._dummy_head.next while cur is not None: res += str(cur.val) + "->" cur = cur.next res += "NULL" return res def __repr__(self): return self.__str__()
class Illegalargumentexception(Exception): pass class Linkedlist: class _Node: def __init__(self, val=None, next_node=None): self.val = val self.next = next_node def __init__(self): self._dummy_head = self._Node() self._size = 0 def get_size(self): return self._size def is_empty(self): return self._size == 0 def add(self, index, e): if index < 0 or index > self._size: raise illegal_argument_exception('add failed, illegal index.') prev = self._dummy_head for _ in range(index): prev = prev.next prev.next = self._Node(e, prev.next) self._size += 1 def add_first(self, e): self.add(0, e) def add_last(self, e): self.add(self._size, e) def get(self, index): if index < 0 or index >= self._size: raise illegal_argument_exception('get failed, illegal index.') cur = self._dummy_head.next for _ in range(index): cur = cur.next return cur.val def get_first(self): return self.get(0) def get_last(self): return self.get(self._size - 1) def set(self, index, e): if index < 0 or index >= self._size: raise illegal_argument_exception('set failed, illegal index.') cur = self._dummy_head.next for _ in range(index): cur = cur.next cur.val = e def contains(self, e): cur = self._dummy_head.next while cur is not None: if cur.val == e: return True cur = cur.next return False def remove(self, index): if index < 0 or index >= self._size: raise illegal_argument_exception('remove failed, illegal index.') prev = self._dummy_head for _ in range(index): prev = prev.next ret = prev.next prev.next = ret.next self._size -= 1 return ret.val def remove_first(self): return self.remove(0) def remove_last(self): return self.remove(self._size - 1) def __str__(self): res = '' cur = self._dummy_head.next while cur is not None: res += str(cur.val) + '->' cur = cur.next res += 'NULL' return res def __repr__(self): return self.__str__()
line_num = 0 total = 0 visited = {} with open("day8.txt") as f: data = f.readlines() def nop(num): global line_num line_num += 1 def jmp(num): global line_num line_num += num def acc(num): global total global line_num total += num line_num += 1 cmds = {'nop':nop, 'jmp':jmp, 'acc':acc} while True: if line_num in visited: break visited[line_num] = 1 line = data[line_num] parts = line.split() cmd = parts[0] num = int(parts[1]) cmds[cmd](num) print (cmd, num, total) print(total)
line_num = 0 total = 0 visited = {} with open('day8.txt') as f: data = f.readlines() def nop(num): global line_num line_num += 1 def jmp(num): global line_num line_num += num def acc(num): global total global line_num total += num line_num += 1 cmds = {'nop': nop, 'jmp': jmp, 'acc': acc} while True: if line_num in visited: break visited[line_num] = 1 line = data[line_num] parts = line.split() cmd = parts[0] num = int(parts[1]) cmds[cmd](num) print(cmd, num, total) print(total)
# Divyanshu Lohani: https://github.com/DivyanshuLohani def pypart(n): for i in range(0, n): for j in range(0, i+1): # printing stars print("* ",end="") # ending line after each row print("\r") n = 5 pypart(n)
def pypart(n): for i in range(0, n): for j in range(0, i + 1): print('* ', end='') print('\r') n = 5 pypart(n)
built_modules = list(name for name in "Core;Gui;Widgets;PrintSupport;Sql;Network;Test;Concurrent;Xml;Help;OpenGL;OpenGLFunctions;OpenGLWidgets;Qml;Quick;QuickControls2;QuickWidgets;Svg;SvgWidgets;UiTools" .split(";")) shiboken_library_soversion = str(6.0) pyside_library_soversion = str(6.0) version = "6.0.0" version_info = (6, 0, 0, "", "") __build_date__ = '2020-12-09T14:38:39+00:00' __setup_py_package_version__ = '6.0.0'
built_modules = list((name for name in 'Core;Gui;Widgets;PrintSupport;Sql;Network;Test;Concurrent;Xml;Help;OpenGL;OpenGLFunctions;OpenGLWidgets;Qml;Quick;QuickControls2;QuickWidgets;Svg;SvgWidgets;UiTools'.split(';'))) shiboken_library_soversion = str(6.0) pyside_library_soversion = str(6.0) version = '6.0.0' version_info = (6, 0, 0, '', '') __build_date__ = '2020-12-09T14:38:39+00:00' __setup_py_package_version__ = '6.0.0'
''' Pattern Enter number of rows: 5 5 54 543 5432 54321 ''' print('Pattern: ') number_rows=int(input('Enter number of rows: ')) for row in range(number_rows,0,-1): for column in range(number_rows,row-1,-1): if column < 10: print(f'0{column}',end=' ') else: print(column,end=' ') print()
""" Pattern Enter number of rows: 5 5 54 543 5432 54321 """ print('Pattern: ') number_rows = int(input('Enter number of rows: ')) for row in range(number_rows, 0, -1): for column in range(number_rows, row - 1, -1): if column < 10: print(f'0{column}', end=' ') else: print(column, end=' ') print()
line = input().split() n = int(line[0]) m = int(line[1]) ans = min(n,m) if(ans%2==0): print("Malvika") else: print("Akshat")
line = input().split() n = int(line[0]) m = int(line[1]) ans = min(n, m) if ans % 2 == 0: print('Malvika') else: print('Akshat')
data = open("day15.txt").read().replace("\n", "").split(",") data = [int(x) for x in data] def find_last_number(data, stop): previous = data[-1] turn = len(data) last_spoken = {value: key + 1 for key, value in enumerate(data[:-1])} while turn < stop: new_number = turn - \ last_spoken[previous] if previous in last_spoken else 0 last_spoken[previous] = turn previous = new_number turn += 1 return previous def part_one(): return find_last_number(data, 2020) def part_two(): return find_last_number(data, 30000000) print(part_one()) print(part_two())
data = open('day15.txt').read().replace('\n', '').split(',') data = [int(x) for x in data] def find_last_number(data, stop): previous = data[-1] turn = len(data) last_spoken = {value: key + 1 for (key, value) in enumerate(data[:-1])} while turn < stop: new_number = turn - last_spoken[previous] if previous in last_spoken else 0 last_spoken[previous] = turn previous = new_number turn += 1 return previous def part_one(): return find_last_number(data, 2020) def part_two(): return find_last_number(data, 30000000) print(part_one()) print(part_two())
# Approach 2 - Left-to-Right Pass Improved values = { "I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000, "IV": 4, "IX": 9, "XL": 40, "XC": 90, "CD": 400, "CM": 900 } class Solution: def romanToInt(self, s: str) -> int: total = 0 i = 0 while i < len(s): # subtractive case if i < len(s) - 1 and s[i : i + 2] in values: total += values[s[i : i + 2]] i += 2 else: total += values[s[i]] i += 1 return total
values = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900} class Solution: def roman_to_int(self, s: str) -> int: total = 0 i = 0 while i < len(s): if i < len(s) - 1 and s[i:i + 2] in values: total += values[s[i:i + 2]] i += 2 else: total += values[s[i]] i += 1 return total
# # PySNMP MIB module CTRON-SSR-TRAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-SSR-TRAP-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:31:35 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ValueRangeConstraint, ConstraintsIntersection, SingleValueConstraint, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "SingleValueConstraint", "ConstraintsUnion") capCPUCurrentUtilization, = mibBuilder.importSymbols("CTRON-SSR-CAPACITY-MIB", "capCPUCurrentUtilization") sysHwPowerSupply, sysHwFan, sysHwTemperature, sysHwModuleSlotNumber = mibBuilder.importSymbols("CTRON-SSR-HARDWARE-MIB", "sysHwPowerSupply", "sysHwFan", "sysHwTemperature", "sysHwModuleSlotNumber") polAclName, polAclItem = mibBuilder.importSymbols("CTRON-SSR-POLICY-MIB", "polAclName", "polAclItem") ssrTraps, ssrMibs = mibBuilder.importSymbols("CTRON-SSR-SMI-MIB", "ssrTraps", "ssrMibs") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, iso, MibIdentifier, Counter32, Counter64, ModuleIdentity, NotificationType, ObjectIdentity, Integer32, Gauge32, Unsigned32, IpAddress, Bits = mibBuilder.importSymbols("SNMPv2-SMI", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "iso", "MibIdentifier", "Counter32", "Counter64", "ModuleIdentity", "NotificationType", "ObjectIdentity", "Integer32", "Gauge32", "Unsigned32", "IpAddress", "Bits") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") ssrTrapsMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300)) ssrTrapsMIB.setRevisions(('2002-07-23 17:20', '2001-02-16 00:00',)) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ssrTrapsMIB.setRevisionsDescriptions(('Update contact information. Add notifications for access denial by access control list (ACL) entry.', 'Add notifications for backup control module failure, line card failure, and CPU threshold exceeded.',)) if mibBuilder.loadTexts: ssrTrapsMIB.setLastUpdated('200207231720Z') if mibBuilder.loadTexts: ssrTrapsMIB.setOrganization('Enterasys Networks, Inc.') if mibBuilder.loadTexts: ssrTrapsMIB.setContactInfo('Postal: Enterasys Networks, Inc. 35 Industrial Way, P.O. Box 5005 Rochester, NH 03867-0505 Phone: +1 603 332 9400 E-mail: support@enterasys.com WWW: http://www.enterasys.com') if mibBuilder.loadTexts: ssrTrapsMIB.setDescription('This module describes the traps specific to the Smart Switch Router.') trapControl = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 10, 1)) envTrapGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2)) polTrapGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 10, 3)) envPowerSupplyFailed = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 1)).setObjects(("CTRON-SSR-HARDWARE-MIB", "sysHwPowerSupply")) if mibBuilder.loadTexts: envPowerSupplyFailed.setStatus('current') if mibBuilder.loadTexts: envPowerSupplyFailed.setDescription('A power supply on the sending device has failed. The sysHwPowerSupply object identifies the failed supply.') envPowerSupplyRecovered = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 2)).setObjects(("CTRON-SSR-HARDWARE-MIB", "sysHwPowerSupply")) if mibBuilder.loadTexts: envPowerSupplyRecovered.setStatus('current') if mibBuilder.loadTexts: envPowerSupplyRecovered.setDescription('A power supply on the sending device has recovered after failure. The sysHwPowerSupply object identifies the recovered supply.') envFanFailed = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 3)).setObjects(("CTRON-SSR-HARDWARE-MIB", "sysHwFan")) if mibBuilder.loadTexts: envFanFailed.setStatus('current') if mibBuilder.loadTexts: envFanFailed.setDescription('A Fan tray on the sending device has failed. The sysHwFan object identifies the failed fan tray.') envFanRecovered = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 4)).setObjects(("CTRON-SSR-HARDWARE-MIB", "sysHwFan")) if mibBuilder.loadTexts: envFanRecovered.setStatus('current') if mibBuilder.loadTexts: envFanRecovered.setDescription('A Fan tray on the sending device has recovered after failure. The sysHwFan object identifies the recovered Fan tray.') envTempExceeded = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 5)).setObjects(("CTRON-SSR-HARDWARE-MIB", "sysHwTemperature")) if mibBuilder.loadTexts: envTempExceeded.setStatus('current') if mibBuilder.loadTexts: envTempExceeded.setDescription('A temperature inside the chassis on the sending device has exceeded normal operating temperature. The sysHwTemperature object identifies the current status.') envTempNormal = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 6)).setObjects(("CTRON-SSR-HARDWARE-MIB", "sysHwTemperature")) if mibBuilder.loadTexts: envTempNormal.setStatus('current') if mibBuilder.loadTexts: envTempNormal.setDescription('A temperature inside the chassis on the sending device has returned to normal operating temperature. The sysHwTemperature object identifies the current status.') envHotSwapIn = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 7)).setObjects(("CTRON-SSR-HARDWARE-MIB", "sysHwModuleSlotNumber")) if mibBuilder.loadTexts: envHotSwapIn.setStatus('current') if mibBuilder.loadTexts: envHotSwapIn.setDescription('A module has been inserted into the chassis. sysHwModuleSlotNumber identifies the slot the module was inserted into.') envHotSwapOut = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 8)).setObjects(("CTRON-SSR-HARDWARE-MIB", "sysHwModuleSlotNumber")) if mibBuilder.loadTexts: envHotSwapOut.setStatus('current') if mibBuilder.loadTexts: envHotSwapOut.setDescription('A module has been turned off or removed from the chassis. sysHwModuleSlotNumber identifies the slot the module was removed from.') envBackupControlModuleOnline = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 9)).setObjects(("CTRON-SSR-HARDWARE-MIB", "sysHwModuleSlotNumber")) if mibBuilder.loadTexts: envBackupControlModuleOnline.setStatus('current') if mibBuilder.loadTexts: envBackupControlModuleOnline.setDescription('A backup control module that was in standby mode has taken over for a failed primary control module. Poll sysHwControlModuleBackupState for current state of backup control module. sysHwModuleSlotNumber is the index into the sysHwModuleTable for the now active control module.') envBackupControlModuleFailure = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 10)).setObjects(("CTRON-SSR-HARDWARE-MIB", "sysHwModuleSlotNumber")) if mibBuilder.loadTexts: envBackupControlModuleFailure.setStatus('current') if mibBuilder.loadTexts: envBackupControlModuleFailure.setDescription('A backup control module that was in standby mode has changed to inactive or notInstalled. Poll sysHwControlModuleBackupState for current state of backup control module.') envLineModuleFailure = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 11)).setObjects(("CTRON-SSR-HARDWARE-MIB", "sysHwModuleSlotNumber")) if mibBuilder.loadTexts: envLineModuleFailure.setStatus('current') if mibBuilder.loadTexts: envLineModuleFailure.setDescription('A line card module which was in the online state changed to the offline state indicating an error condition.') envCPUThresholdExceeded = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 12)).setObjects(("CTRON-SSR-HARDWARE-MIB", "sysHwModuleSlotNumber"), ("CTRON-SSR-CAPACITY-MIB", "capCPUCurrentUtilization")) if mibBuilder.loadTexts: envCPUThresholdExceeded.setStatus('current') if mibBuilder.loadTexts: envCPUThresholdExceeded.setDescription('The CPU utilization has exceeded the value of capCPUMaxThreshold after having been below the value of capCPUMinThreshold. Once this trap has occurred it will not occurred again until the utilization has dropped below capCPUMinThreshold. Poll capCPUMinThreshold and capCPUMaxThreshold to determine the configured threshold settings.') polNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 10, 3, 0)) polAclDenied = NotificationType((1, 3, 6, 1, 4, 1, 52, 2501, 10, 3, 0, 1)).setObjects(("CTRON-SSR-POLICY-MIB", "polAclName"), ("CTRON-SSR-POLICY-MIB", "polAclItem"), ("IF-MIB", "ifIndex")) if mibBuilder.loadTexts: polAclDenied.setStatus('current') if mibBuilder.loadTexts: polAclDenied.setDescription("The polAclDenied trap indicates that a message was dropped because of a 'deny' ACL. The polAclName and polAclItem identify the entry in the polAclTable. The ifIndex value identifies the interface on which the deny ACL was applied.") ssrTrapsConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2)) ssrTrapsCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 1)) ssrTrapsGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2)) ssrTrapsComplianceV10 = ModuleCompliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 1, 1)).setObjects(("CTRON-SSR-TRAP-MIB", "ssrTrapsConfGroupV10")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssrTrapsComplianceV10 = ssrTrapsComplianceV10.setStatus('obsolete') if mibBuilder.loadTexts: ssrTrapsComplianceV10.setDescription('The compliance statement for the CTRON-SSR-TRAPS-MIB.') ssrTrapsComplianceV20 = ModuleCompliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 2, 1)).setObjects(("CTRON-SSR-TRAP-MIB", "ssrTrapsConfGroupV20")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssrTrapsComplianceV20 = ssrTrapsComplianceV20.setStatus('deprecated') if mibBuilder.loadTexts: ssrTrapsComplianceV20.setDescription('The compliance statement for the CTRON-SSR-TRAPS-MIB.') ssrTrapsComplianceV30 = ModuleCompliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 3, 1)).setObjects(("CTRON-SSR-TRAP-MIB", "ssrTrapsConfGroupV30")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssrTrapsComplianceV30 = ssrTrapsComplianceV30.setStatus('deprecated') if mibBuilder.loadTexts: ssrTrapsComplianceV30.setDescription('The compliance statement for the CTRON-SSR-TRAPS-MIB.') ssrTrapsComplianceV40 = ModuleCompliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 4, 1)).setObjects(("CTRON-SSR-TRAP-MIB", "ssrTrapsConfGroupV40")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssrTrapsComplianceV40 = ssrTrapsComplianceV40.setStatus('current') if mibBuilder.loadTexts: ssrTrapsComplianceV40.setDescription('The compliance statement for the CTRON-SSR-TRAPS-MIB.') ssrTrapsComplianceV50 = ModuleCompliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 5, 1)).setObjects(("CTRON-SSR-TRAP-MIB", "ssrTrapsConfGroupV50")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssrTrapsComplianceV50 = ssrTrapsComplianceV50.setStatus('current') if mibBuilder.loadTexts: ssrTrapsComplianceV50.setDescription('The compliance statement for the CTRON-SSR-TRAPS-MIB.') ssrTrapsConfGroupV10 = NotificationGroup((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 1)).setObjects(("CTRON-SSR-TRAP-MIB", "envPowerSupplyFailed"), ("CTRON-SSR-TRAP-MIB", "envPowerSupplyRecovered")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssrTrapsConfGroupV10 = ssrTrapsConfGroupV10.setStatus('obsolete') if mibBuilder.loadTexts: ssrTrapsConfGroupV10.setDescription('A set of managed objects that make up version 1.0 of the SSR Trap MIB.') ssrTrapsConfGroupV20 = NotificationGroup((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 2)).setObjects(("CTRON-SSR-TRAP-MIB", "envPowerSupplyFailed"), ("CTRON-SSR-TRAP-MIB", "envPowerSupplyRecovered"), ("CTRON-SSR-TRAP-MIB", "envFanFailed"), ("CTRON-SSR-TRAP-MIB", "envFanRecovered"), ("CTRON-SSR-TRAP-MIB", "envTempExceeded"), ("CTRON-SSR-TRAP-MIB", "envTempNormal")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssrTrapsConfGroupV20 = ssrTrapsConfGroupV20.setStatus('deprecated') if mibBuilder.loadTexts: ssrTrapsConfGroupV20.setDescription('A set of managed objects that make up version 2.0 of the SSR Trap MIB.') ssrTrapsConfGroupV30 = NotificationGroup((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 3)).setObjects(("CTRON-SSR-TRAP-MIB", "envPowerSupplyFailed"), ("CTRON-SSR-TRAP-MIB", "envPowerSupplyRecovered"), ("CTRON-SSR-TRAP-MIB", "envFanFailed"), ("CTRON-SSR-TRAP-MIB", "envFanRecovered"), ("CTRON-SSR-TRAP-MIB", "envTempExceeded"), ("CTRON-SSR-TRAP-MIB", "envTempNormal"), ("CTRON-SSR-TRAP-MIB", "envHotSwapIn"), ("CTRON-SSR-TRAP-MIB", "envHotSwapOut")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssrTrapsConfGroupV30 = ssrTrapsConfGroupV30.setStatus('deprecated') if mibBuilder.loadTexts: ssrTrapsConfGroupV30.setDescription('A set of managed objects that make up version 3.0 of the SSR Trap MIB.') ssrTrapsConfGroupV40 = NotificationGroup((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 4)).setObjects(("CTRON-SSR-TRAP-MIB", "envPowerSupplyFailed"), ("CTRON-SSR-TRAP-MIB", "envPowerSupplyRecovered"), ("CTRON-SSR-TRAP-MIB", "envFanFailed"), ("CTRON-SSR-TRAP-MIB", "envFanRecovered"), ("CTRON-SSR-TRAP-MIB", "envTempExceeded"), ("CTRON-SSR-TRAP-MIB", "envTempNormal"), ("CTRON-SSR-TRAP-MIB", "envHotSwapIn"), ("CTRON-SSR-TRAP-MIB", "envHotSwapOut"), ("CTRON-SSR-TRAP-MIB", "envBackupControlModuleOnline"), ("CTRON-SSR-TRAP-MIB", "envBackupControlModuleFailure"), ("CTRON-SSR-TRAP-MIB", "envLineModuleFailure"), ("CTRON-SSR-TRAP-MIB", "envCPUThresholdExceeded")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssrTrapsConfGroupV40 = ssrTrapsConfGroupV40.setStatus('deprecated') if mibBuilder.loadTexts: ssrTrapsConfGroupV40.setDescription('A set of managed objects that make up version 4.0 of the SSR Trap MIB.') ssrTrapsConfGroupV50 = NotificationGroup((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 5)).setObjects(("CTRON-SSR-TRAP-MIB", "envPowerSupplyFailed"), ("CTRON-SSR-TRAP-MIB", "envPowerSupplyRecovered"), ("CTRON-SSR-TRAP-MIB", "envFanFailed"), ("CTRON-SSR-TRAP-MIB", "envFanRecovered"), ("CTRON-SSR-TRAP-MIB", "envTempExceeded"), ("CTRON-SSR-TRAP-MIB", "envTempNormal"), ("CTRON-SSR-TRAP-MIB", "envHotSwapIn"), ("CTRON-SSR-TRAP-MIB", "envHotSwapOut"), ("CTRON-SSR-TRAP-MIB", "envBackupControlModuleOnline"), ("CTRON-SSR-TRAP-MIB", "envBackupControlModuleFailure"), ("CTRON-SSR-TRAP-MIB", "envLineModuleFailure"), ("CTRON-SSR-TRAP-MIB", "envCPUThresholdExceeded"), ("CTRON-SSR-TRAP-MIB", "polAclDenied")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssrTrapsConfGroupV50 = ssrTrapsConfGroupV50.setStatus('current') if mibBuilder.loadTexts: ssrTrapsConfGroupV50.setDescription('A set of managed objects that make up version 5.0 of the SSR Trap MIB.') mibBuilder.exportSymbols("CTRON-SSR-TRAP-MIB", envBackupControlModuleOnline=envBackupControlModuleOnline, envBackupControlModuleFailure=envBackupControlModuleFailure, ssrTrapsGroups=ssrTrapsGroups, ssrTrapsComplianceV10=ssrTrapsComplianceV10, ssrTrapsComplianceV50=ssrTrapsComplianceV50, envFanFailed=envFanFailed, envFanRecovered=envFanRecovered, ssrTrapsConfGroupV40=ssrTrapsConfGroupV40, envHotSwapOut=envHotSwapOut, ssrTrapsConformance=ssrTrapsConformance, ssrTrapsConfGroupV30=ssrTrapsConfGroupV30, envTrapGroup=envTrapGroup, envPowerSupplyRecovered=envPowerSupplyRecovered, envLineModuleFailure=envLineModuleFailure, ssrTrapsConfGroupV20=ssrTrapsConfGroupV20, polTrapGroup=polTrapGroup, ssrTrapsConfGroupV10=ssrTrapsConfGroupV10, envTempExceeded=envTempExceeded, polNotifications=polNotifications, envTempNormal=envTempNormal, PYSNMP_MODULE_ID=ssrTrapsMIB, envPowerSupplyFailed=envPowerSupplyFailed, ssrTrapsConfGroupV50=ssrTrapsConfGroupV50, ssrTrapsComplianceV40=ssrTrapsComplianceV40, envHotSwapIn=envHotSwapIn, polAclDenied=polAclDenied, trapControl=trapControl, ssrTrapsComplianceV20=ssrTrapsComplianceV20, ssrTrapsCompliances=ssrTrapsCompliances, envCPUThresholdExceeded=envCPUThresholdExceeded, ssrTrapsMIB=ssrTrapsMIB, ssrTrapsComplianceV30=ssrTrapsComplianceV30)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'SingleValueConstraint', 'ConstraintsUnion') (cap_cpu_current_utilization,) = mibBuilder.importSymbols('CTRON-SSR-CAPACITY-MIB', 'capCPUCurrentUtilization') (sys_hw_power_supply, sys_hw_fan, sys_hw_temperature, sys_hw_module_slot_number) = mibBuilder.importSymbols('CTRON-SSR-HARDWARE-MIB', 'sysHwPowerSupply', 'sysHwFan', 'sysHwTemperature', 'sysHwModuleSlotNumber') (pol_acl_name, pol_acl_item) = mibBuilder.importSymbols('CTRON-SSR-POLICY-MIB', 'polAclName', 'polAclItem') (ssr_traps, ssr_mibs) = mibBuilder.importSymbols('CTRON-SSR-SMI-MIB', 'ssrTraps', 'ssrMibs') (if_index,) = mibBuilder.importSymbols('IF-MIB', 'ifIndex') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (time_ticks, mib_scalar, mib_table, mib_table_row, mib_table_column, iso, mib_identifier, counter32, counter64, module_identity, notification_type, object_identity, integer32, gauge32, unsigned32, ip_address, bits) = mibBuilder.importSymbols('SNMPv2-SMI', 'TimeTicks', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'iso', 'MibIdentifier', 'Counter32', 'Counter64', 'ModuleIdentity', 'NotificationType', 'ObjectIdentity', 'Integer32', 'Gauge32', 'Unsigned32', 'IpAddress', 'Bits') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') ssr_traps_mib = module_identity((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300)) ssrTrapsMIB.setRevisions(('2002-07-23 17:20', '2001-02-16 00:00')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): if mibBuilder.loadTexts: ssrTrapsMIB.setRevisionsDescriptions(('Update contact information. Add notifications for access denial by access control list (ACL) entry.', 'Add notifications for backup control module failure, line card failure, and CPU threshold exceeded.')) if mibBuilder.loadTexts: ssrTrapsMIB.setLastUpdated('200207231720Z') if mibBuilder.loadTexts: ssrTrapsMIB.setOrganization('Enterasys Networks, Inc.') if mibBuilder.loadTexts: ssrTrapsMIB.setContactInfo('Postal: Enterasys Networks, Inc. 35 Industrial Way, P.O. Box 5005 Rochester, NH 03867-0505 Phone: +1 603 332 9400 E-mail: support@enterasys.com WWW: http://www.enterasys.com') if mibBuilder.loadTexts: ssrTrapsMIB.setDescription('This module describes the traps specific to the Smart Switch Router.') trap_control = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 10, 1)) env_trap_group = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2)) pol_trap_group = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 10, 3)) env_power_supply_failed = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 1)).setObjects(('CTRON-SSR-HARDWARE-MIB', 'sysHwPowerSupply')) if mibBuilder.loadTexts: envPowerSupplyFailed.setStatus('current') if mibBuilder.loadTexts: envPowerSupplyFailed.setDescription('A power supply on the sending device has failed. The sysHwPowerSupply object identifies the failed supply.') env_power_supply_recovered = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 2)).setObjects(('CTRON-SSR-HARDWARE-MIB', 'sysHwPowerSupply')) if mibBuilder.loadTexts: envPowerSupplyRecovered.setStatus('current') if mibBuilder.loadTexts: envPowerSupplyRecovered.setDescription('A power supply on the sending device has recovered after failure. The sysHwPowerSupply object identifies the recovered supply.') env_fan_failed = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 3)).setObjects(('CTRON-SSR-HARDWARE-MIB', 'sysHwFan')) if mibBuilder.loadTexts: envFanFailed.setStatus('current') if mibBuilder.loadTexts: envFanFailed.setDescription('A Fan tray on the sending device has failed. The sysHwFan object identifies the failed fan tray.') env_fan_recovered = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 4)).setObjects(('CTRON-SSR-HARDWARE-MIB', 'sysHwFan')) if mibBuilder.loadTexts: envFanRecovered.setStatus('current') if mibBuilder.loadTexts: envFanRecovered.setDescription('A Fan tray on the sending device has recovered after failure. The sysHwFan object identifies the recovered Fan tray.') env_temp_exceeded = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 5)).setObjects(('CTRON-SSR-HARDWARE-MIB', 'sysHwTemperature')) if mibBuilder.loadTexts: envTempExceeded.setStatus('current') if mibBuilder.loadTexts: envTempExceeded.setDescription('A temperature inside the chassis on the sending device has exceeded normal operating temperature. The sysHwTemperature object identifies the current status.') env_temp_normal = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 6)).setObjects(('CTRON-SSR-HARDWARE-MIB', 'sysHwTemperature')) if mibBuilder.loadTexts: envTempNormal.setStatus('current') if mibBuilder.loadTexts: envTempNormal.setDescription('A temperature inside the chassis on the sending device has returned to normal operating temperature. The sysHwTemperature object identifies the current status.') env_hot_swap_in = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 7)).setObjects(('CTRON-SSR-HARDWARE-MIB', 'sysHwModuleSlotNumber')) if mibBuilder.loadTexts: envHotSwapIn.setStatus('current') if mibBuilder.loadTexts: envHotSwapIn.setDescription('A module has been inserted into the chassis. sysHwModuleSlotNumber identifies the slot the module was inserted into.') env_hot_swap_out = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 8)).setObjects(('CTRON-SSR-HARDWARE-MIB', 'sysHwModuleSlotNumber')) if mibBuilder.loadTexts: envHotSwapOut.setStatus('current') if mibBuilder.loadTexts: envHotSwapOut.setDescription('A module has been turned off or removed from the chassis. sysHwModuleSlotNumber identifies the slot the module was removed from.') env_backup_control_module_online = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 9)).setObjects(('CTRON-SSR-HARDWARE-MIB', 'sysHwModuleSlotNumber')) if mibBuilder.loadTexts: envBackupControlModuleOnline.setStatus('current') if mibBuilder.loadTexts: envBackupControlModuleOnline.setDescription('A backup control module that was in standby mode has taken over for a failed primary control module. Poll sysHwControlModuleBackupState for current state of backup control module. sysHwModuleSlotNumber is the index into the sysHwModuleTable for the now active control module.') env_backup_control_module_failure = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 10)).setObjects(('CTRON-SSR-HARDWARE-MIB', 'sysHwModuleSlotNumber')) if mibBuilder.loadTexts: envBackupControlModuleFailure.setStatus('current') if mibBuilder.loadTexts: envBackupControlModuleFailure.setDescription('A backup control module that was in standby mode has changed to inactive or notInstalled. Poll sysHwControlModuleBackupState for current state of backup control module.') env_line_module_failure = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 11)).setObjects(('CTRON-SSR-HARDWARE-MIB', 'sysHwModuleSlotNumber')) if mibBuilder.loadTexts: envLineModuleFailure.setStatus('current') if mibBuilder.loadTexts: envLineModuleFailure.setDescription('A line card module which was in the online state changed to the offline state indicating an error condition.') env_cpu_threshold_exceeded = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 2, 12)).setObjects(('CTRON-SSR-HARDWARE-MIB', 'sysHwModuleSlotNumber'), ('CTRON-SSR-CAPACITY-MIB', 'capCPUCurrentUtilization')) if mibBuilder.loadTexts: envCPUThresholdExceeded.setStatus('current') if mibBuilder.loadTexts: envCPUThresholdExceeded.setDescription('The CPU utilization has exceeded the value of capCPUMaxThreshold after having been below the value of capCPUMinThreshold. Once this trap has occurred it will not occurred again until the utilization has dropped below capCPUMinThreshold. Poll capCPUMinThreshold and capCPUMaxThreshold to determine the configured threshold settings.') pol_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 10, 3, 0)) pol_acl_denied = notification_type((1, 3, 6, 1, 4, 1, 52, 2501, 10, 3, 0, 1)).setObjects(('CTRON-SSR-POLICY-MIB', 'polAclName'), ('CTRON-SSR-POLICY-MIB', 'polAclItem'), ('IF-MIB', 'ifIndex')) if mibBuilder.loadTexts: polAclDenied.setStatus('current') if mibBuilder.loadTexts: polAclDenied.setDescription("The polAclDenied trap indicates that a message was dropped because of a 'deny' ACL. The polAclName and polAclItem identify the entry in the polAclTable. The ifIndex value identifies the interface on which the deny ACL was applied.") ssr_traps_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2)) ssr_traps_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 1)) ssr_traps_groups = mib_identifier((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2)) ssr_traps_compliance_v10 = module_compliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 1, 1)).setObjects(('CTRON-SSR-TRAP-MIB', 'ssrTrapsConfGroupV10')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssr_traps_compliance_v10 = ssrTrapsComplianceV10.setStatus('obsolete') if mibBuilder.loadTexts: ssrTrapsComplianceV10.setDescription('The compliance statement for the CTRON-SSR-TRAPS-MIB.') ssr_traps_compliance_v20 = module_compliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 2, 1)).setObjects(('CTRON-SSR-TRAP-MIB', 'ssrTrapsConfGroupV20')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssr_traps_compliance_v20 = ssrTrapsComplianceV20.setStatus('deprecated') if mibBuilder.loadTexts: ssrTrapsComplianceV20.setDescription('The compliance statement for the CTRON-SSR-TRAPS-MIB.') ssr_traps_compliance_v30 = module_compliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 3, 1)).setObjects(('CTRON-SSR-TRAP-MIB', 'ssrTrapsConfGroupV30')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssr_traps_compliance_v30 = ssrTrapsComplianceV30.setStatus('deprecated') if mibBuilder.loadTexts: ssrTrapsComplianceV30.setDescription('The compliance statement for the CTRON-SSR-TRAPS-MIB.') ssr_traps_compliance_v40 = module_compliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 4, 1)).setObjects(('CTRON-SSR-TRAP-MIB', 'ssrTrapsConfGroupV40')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssr_traps_compliance_v40 = ssrTrapsComplianceV40.setStatus('current') if mibBuilder.loadTexts: ssrTrapsComplianceV40.setDescription('The compliance statement for the CTRON-SSR-TRAPS-MIB.') ssr_traps_compliance_v50 = module_compliance((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 5, 1)).setObjects(('CTRON-SSR-TRAP-MIB', 'ssrTrapsConfGroupV50')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssr_traps_compliance_v50 = ssrTrapsComplianceV50.setStatus('current') if mibBuilder.loadTexts: ssrTrapsComplianceV50.setDescription('The compliance statement for the CTRON-SSR-TRAPS-MIB.') ssr_traps_conf_group_v10 = notification_group((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 1)).setObjects(('CTRON-SSR-TRAP-MIB', 'envPowerSupplyFailed'), ('CTRON-SSR-TRAP-MIB', 'envPowerSupplyRecovered')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssr_traps_conf_group_v10 = ssrTrapsConfGroupV10.setStatus('obsolete') if mibBuilder.loadTexts: ssrTrapsConfGroupV10.setDescription('A set of managed objects that make up version 1.0 of the SSR Trap MIB.') ssr_traps_conf_group_v20 = notification_group((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 2)).setObjects(('CTRON-SSR-TRAP-MIB', 'envPowerSupplyFailed'), ('CTRON-SSR-TRAP-MIB', 'envPowerSupplyRecovered'), ('CTRON-SSR-TRAP-MIB', 'envFanFailed'), ('CTRON-SSR-TRAP-MIB', 'envFanRecovered'), ('CTRON-SSR-TRAP-MIB', 'envTempExceeded'), ('CTRON-SSR-TRAP-MIB', 'envTempNormal')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssr_traps_conf_group_v20 = ssrTrapsConfGroupV20.setStatus('deprecated') if mibBuilder.loadTexts: ssrTrapsConfGroupV20.setDescription('A set of managed objects that make up version 2.0 of the SSR Trap MIB.') ssr_traps_conf_group_v30 = notification_group((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 3)).setObjects(('CTRON-SSR-TRAP-MIB', 'envPowerSupplyFailed'), ('CTRON-SSR-TRAP-MIB', 'envPowerSupplyRecovered'), ('CTRON-SSR-TRAP-MIB', 'envFanFailed'), ('CTRON-SSR-TRAP-MIB', 'envFanRecovered'), ('CTRON-SSR-TRAP-MIB', 'envTempExceeded'), ('CTRON-SSR-TRAP-MIB', 'envTempNormal'), ('CTRON-SSR-TRAP-MIB', 'envHotSwapIn'), ('CTRON-SSR-TRAP-MIB', 'envHotSwapOut')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssr_traps_conf_group_v30 = ssrTrapsConfGroupV30.setStatus('deprecated') if mibBuilder.loadTexts: ssrTrapsConfGroupV30.setDescription('A set of managed objects that make up version 3.0 of the SSR Trap MIB.') ssr_traps_conf_group_v40 = notification_group((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 4)).setObjects(('CTRON-SSR-TRAP-MIB', 'envPowerSupplyFailed'), ('CTRON-SSR-TRAP-MIB', 'envPowerSupplyRecovered'), ('CTRON-SSR-TRAP-MIB', 'envFanFailed'), ('CTRON-SSR-TRAP-MIB', 'envFanRecovered'), ('CTRON-SSR-TRAP-MIB', 'envTempExceeded'), ('CTRON-SSR-TRAP-MIB', 'envTempNormal'), ('CTRON-SSR-TRAP-MIB', 'envHotSwapIn'), ('CTRON-SSR-TRAP-MIB', 'envHotSwapOut'), ('CTRON-SSR-TRAP-MIB', 'envBackupControlModuleOnline'), ('CTRON-SSR-TRAP-MIB', 'envBackupControlModuleFailure'), ('CTRON-SSR-TRAP-MIB', 'envLineModuleFailure'), ('CTRON-SSR-TRAP-MIB', 'envCPUThresholdExceeded')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssr_traps_conf_group_v40 = ssrTrapsConfGroupV40.setStatus('deprecated') if mibBuilder.loadTexts: ssrTrapsConfGroupV40.setDescription('A set of managed objects that make up version 4.0 of the SSR Trap MIB.') ssr_traps_conf_group_v50 = notification_group((1, 3, 6, 1, 4, 1, 52, 2501, 1, 300, 2, 2, 5)).setObjects(('CTRON-SSR-TRAP-MIB', 'envPowerSupplyFailed'), ('CTRON-SSR-TRAP-MIB', 'envPowerSupplyRecovered'), ('CTRON-SSR-TRAP-MIB', 'envFanFailed'), ('CTRON-SSR-TRAP-MIB', 'envFanRecovered'), ('CTRON-SSR-TRAP-MIB', 'envTempExceeded'), ('CTRON-SSR-TRAP-MIB', 'envTempNormal'), ('CTRON-SSR-TRAP-MIB', 'envHotSwapIn'), ('CTRON-SSR-TRAP-MIB', 'envHotSwapOut'), ('CTRON-SSR-TRAP-MIB', 'envBackupControlModuleOnline'), ('CTRON-SSR-TRAP-MIB', 'envBackupControlModuleFailure'), ('CTRON-SSR-TRAP-MIB', 'envLineModuleFailure'), ('CTRON-SSR-TRAP-MIB', 'envCPUThresholdExceeded'), ('CTRON-SSR-TRAP-MIB', 'polAclDenied')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): ssr_traps_conf_group_v50 = ssrTrapsConfGroupV50.setStatus('current') if mibBuilder.loadTexts: ssrTrapsConfGroupV50.setDescription('A set of managed objects that make up version 5.0 of the SSR Trap MIB.') mibBuilder.exportSymbols('CTRON-SSR-TRAP-MIB', envBackupControlModuleOnline=envBackupControlModuleOnline, envBackupControlModuleFailure=envBackupControlModuleFailure, ssrTrapsGroups=ssrTrapsGroups, ssrTrapsComplianceV10=ssrTrapsComplianceV10, ssrTrapsComplianceV50=ssrTrapsComplianceV50, envFanFailed=envFanFailed, envFanRecovered=envFanRecovered, ssrTrapsConfGroupV40=ssrTrapsConfGroupV40, envHotSwapOut=envHotSwapOut, ssrTrapsConformance=ssrTrapsConformance, ssrTrapsConfGroupV30=ssrTrapsConfGroupV30, envTrapGroup=envTrapGroup, envPowerSupplyRecovered=envPowerSupplyRecovered, envLineModuleFailure=envLineModuleFailure, ssrTrapsConfGroupV20=ssrTrapsConfGroupV20, polTrapGroup=polTrapGroup, ssrTrapsConfGroupV10=ssrTrapsConfGroupV10, envTempExceeded=envTempExceeded, polNotifications=polNotifications, envTempNormal=envTempNormal, PYSNMP_MODULE_ID=ssrTrapsMIB, envPowerSupplyFailed=envPowerSupplyFailed, ssrTrapsConfGroupV50=ssrTrapsConfGroupV50, ssrTrapsComplianceV40=ssrTrapsComplianceV40, envHotSwapIn=envHotSwapIn, polAclDenied=polAclDenied, trapControl=trapControl, ssrTrapsComplianceV20=ssrTrapsComplianceV20, ssrTrapsCompliances=ssrTrapsCompliances, envCPUThresholdExceeded=envCPUThresholdExceeded, ssrTrapsMIB=ssrTrapsMIB, ssrTrapsComplianceV30=ssrTrapsComplianceV30)
remote = ("example.com", 80) page = "/response" auth = "" reqthreads = 4
remote = ('example.com', 80) page = '/response' auth = '' reqthreads = 4
class Queue: def __init__(self): self.__items = [] def enqueue(self, item): self.__items.append(item) def dequeue(self): if not self.length(): raise QueueEmptyException() item = self.__items[0] self.__items = self.__items[1:] return item def length(self): return len(self.__items) class QueueEmptyException(Exception): pass
class Queue: def __init__(self): self.__items = [] def enqueue(self, item): self.__items.append(item) def dequeue(self): if not self.length(): raise queue_empty_exception() item = self.__items[0] self.__items = self.__items[1:] return item def length(self): return len(self.__items) class Queueemptyexception(Exception): pass
def solve(data, part_two=False): max_found = -1 seat_ids = [] for l in data: row_max = 127 row_min = 0 seat_max = 7 seat_min = 0 for c in l: if c == 'F': row_max = ((row_max-row_min) // 2) + row_min elif c == 'B': row_min = ((row_max-row_min) // 2) + 1 + row_min elif c == 'L': seat_max = ((seat_max-seat_min) // 2) + seat_min elif c == 'R': seat_min = ((seat_max-seat_min) // 2) + 1 + seat_min seat_id = row_max * 8 + seat_max seat_ids.append(seat_id) if seat_id > max_found: max_found = seat_id if not part_two: return max_found else: sorted_seat_ids = sorted(seat_ids) set_seat_ids = set(seat_ids) for potential_seat_id in range(sorted_seat_ids[0], sorted_seat_ids[-1]): if potential_seat_id not in set_seat_ids: return potential_seat_id
def solve(data, part_two=False): max_found = -1 seat_ids = [] for l in data: row_max = 127 row_min = 0 seat_max = 7 seat_min = 0 for c in l: if c == 'F': row_max = (row_max - row_min) // 2 + row_min elif c == 'B': row_min = (row_max - row_min) // 2 + 1 + row_min elif c == 'L': seat_max = (seat_max - seat_min) // 2 + seat_min elif c == 'R': seat_min = (seat_max - seat_min) // 2 + 1 + seat_min seat_id = row_max * 8 + seat_max seat_ids.append(seat_id) if seat_id > max_found: max_found = seat_id if not part_two: return max_found else: sorted_seat_ids = sorted(seat_ids) set_seat_ids = set(seat_ids) for potential_seat_id in range(sorted_seat_ids[0], sorted_seat_ids[-1]): if potential_seat_id not in set_seat_ids: return potential_seat_id
# !/usr/bin/env python3 # Author: C.K # Email: theck17@163.com # DateTime:2021-12-04 09:48:17 # Description: class Solution: def longestWord(self, words: List[str]) -> str: valid = set([""]) for word in sorted(words, key=lambda x: len(x)): if word[:-1] in valid: valid.add(word) return max(sorted(valid), key=lambda x: len(x)) if __name__ == "__main__": pass
class Solution: def longest_word(self, words: List[str]) -> str: valid = set(['']) for word in sorted(words, key=lambda x: len(x)): if word[:-1] in valid: valid.add(word) return max(sorted(valid), key=lambda x: len(x)) if __name__ == '__main__': pass
class Bipartite(object): def __init__(self, graph): self.is_bipartite = True self.color = [False for _ in range(graph.v)] self.marked = [False for _ in range(graph.v)] self.edge_to = [0 for _ in range(graph.v)] self.odd_length_cycle = [] for v in range(graph.v): if not self.marked[v]: self.dfs(graph, v) def dfs(self, graph, v): self.marked[v] = True for w in graph.get_siblings(v): # short circuit if odd-length cycle found if self.odd_length_cycle: return # found uncolored vertex, so recur if not self.marked[w]: self.edge_to[w] = v self.color[w] = not self.color[v] self.dfs[graph, w] # if v-w create an odd-length cycle, find it elif self.color[w] == self.color[v]: self.is_bipartite = False self.odd_length_cycle.append(w) x = v while x != w: self.odd_length_cycle.append(x) x = self.edge_to[x] self.odd_length_cycle.append(w) def is_bipartite(self): return self.is_bipartite def get_color(self, v): if not self.is_bipartite: raise return self.color[v]
class Bipartite(object): def __init__(self, graph): self.is_bipartite = True self.color = [False for _ in range(graph.v)] self.marked = [False for _ in range(graph.v)] self.edge_to = [0 for _ in range(graph.v)] self.odd_length_cycle = [] for v in range(graph.v): if not self.marked[v]: self.dfs(graph, v) def dfs(self, graph, v): self.marked[v] = True for w in graph.get_siblings(v): if self.odd_length_cycle: return if not self.marked[w]: self.edge_to[w] = v self.color[w] = not self.color[v] self.dfs[graph, w] elif self.color[w] == self.color[v]: self.is_bipartite = False self.odd_length_cycle.append(w) x = v while x != w: self.odd_length_cycle.append(x) x = self.edge_to[x] self.odd_length_cycle.append(w) def is_bipartite(self): return self.is_bipartite def get_color(self, v): if not self.is_bipartite: raise return self.color[v]
# The objective is to find the summation of the odd elements in the array # Define a simple array sample =[12,33,54,89,776,3] # Get length of the array l= len(sample) s=0 # Looping on the array up to max length to sum up the odd elements for i in range(l): if (i%2!=0): s = s + int(sample[i]) #print the summation print(s)
sample = [12, 33, 54, 89, 776, 3] l = len(sample) s = 0 for i in range(l): if i % 2 != 0: s = s + int(sample[i]) print(s)
class SmokeTestFail(Exception): pass class SmokeTestRegistry(object): def __init__(self): self.tests = {} def register(self, sequence, name): def decorator(fn): self.tests[name] = { 'sequence': sequence, 'test': fn } return fn return decorator def __iter__(self): seq = lambda key: self.tests[key]['sequence'] for name in sorted(self.tests, key=seq): yield name, self.tests[name]['test'] def execute(self): for name, test in iter(self): status = True message = '' try: test() except SmokeTestFail as fail: status = False message = str(fail) yield { 'name': name, 'status': status, 'message': message } smoketests = SmokeTestRegistry()
class Smoketestfail(Exception): pass class Smoketestregistry(object): def __init__(self): self.tests = {} def register(self, sequence, name): def decorator(fn): self.tests[name] = {'sequence': sequence, 'test': fn} return fn return decorator def __iter__(self): seq = lambda key: self.tests[key]['sequence'] for name in sorted(self.tests, key=seq): yield (name, self.tests[name]['test']) def execute(self): for (name, test) in iter(self): status = True message = '' try: test() except SmokeTestFail as fail: status = False message = str(fail) yield {'name': name, 'status': status, 'message': message} smoketests = smoke_test_registry()
# Stores JSON schema version, incrementing major/minor number = incompatible CDOT_JSON_VERSION_KEY = "cdot_version" # Keys used in dictionary (serialized to JSON) CONTIG = "contig" CHROM = "chrom" START = "start" END = "stop" STRAND = "strand" BEST_REGION_TYPE_ORDER = ["coding", "5PUTR", "3PUTR", "non coding", "intron"]
cdot_json_version_key = 'cdot_version' contig = 'contig' chrom = 'chrom' start = 'start' end = 'stop' strand = 'strand' best_region_type_order = ['coding', '5PUTR', '3PUTR', 'non coding', 'intron']
def int_from_rgb(r, g, b): return (r << 16) + (g << 8) + b def rgb_from_int(color): return ((color >> 16) & 255), ((color >> 8) & 255), (color & 255)
def int_from_rgb(r, g, b): return (r << 16) + (g << 8) + b def rgb_from_int(color): return (color >> 16 & 255, color >> 8 & 255, color & 255)
questions = ['''A 2m long stick, when it is at rest, moves past an observer on the ground with a speed of 0.5c. (a) What is the length measured by the observer ? (b) If the same stick moves with the velocity of 0.05c what would be its length measured by the observer ''',''' A small lantern of mass 100 gm is hanged from the pole of a bullock cart using a massless string. What is the tension in the string, (Assume that cart moves smoothly). (a) when the bullock cart is at rest, (b) moves with uniform velocity of 3 m/s (c) moves with an acceleration of 2 m/s2 ''',''' X-ray of wavelength 0.5Ao are scattered by the electron in a block of carbon through 90o . (i) Find the wavelength of scattered Photon (ii) the maximum wavelength present in scattered radiation and (iii) the maximum kinetic energy of recoil electron.''','''According to the India Meteorological Department (IMD), fairly widespread to widespread rains with isolated heavy falls are very likely to continue over Northeast India until Tuesday, August 24. Thereafter, the intensity of the rainfall is set to increase, with isolated very heavy falls expected to lash Arunachal Pradesh, Assam and Meghalaya between Tuesday to Friday, August 24-27. Furthermore, isolated extremely heavy falls may also bombard Assam and Meghalaya on Wednesday, August 25. ''','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'] answers = ["","answer 2","","asnwer 4"] time_of_exam = "23:15:00" student_name = "Ishaan Dwivedi" en_no = "191b130" number_of_questions=len(questions) max_col = 10 max_row = number_of_questions // max_col if (number_of_questions % max_col) > 0 : max_row = max_row + 1 list_of_done = [1,3] revisit= [4] current_question = 0 # timer data month = 'Aug' day = '28' year = '2021' time = '20:40:00'
questions = ['A 2m long stick, when it is at rest, moves past an observer on the ground with a speed of 0.5c.\n(a) What is the length measured by the observer ?\n(b) If the same stick moves with the velocity of 0.05c what would be its length measured by the observer ', ' A small lantern of mass 100 gm is hanged from the pole of a bullock cart using a massless string. What is the tension in the string, (Assume that cart moves smoothly).\n\n(a) when the bullock cart is at rest,\n(b) moves with uniform velocity of 3 m/s\n(c) moves with an acceleration of 2 m/s2 ', ' X-ray of wavelength 0.5Ao are scattered by the electron in a block of carbon through 90o . (i) Find the wavelength of scattered Photon (ii) the maximum wavelength present in scattered radiation and (iii) the maximum kinetic energy of recoil electron.', 'According to the India Meteorological Department (IMD), fairly widespread to widespread rains with isolated heavy falls are very likely to continue over Northeast India until Tuesday, August 24.\n\nThereafter, the intensity of the rainfall is set to increase, with isolated very heavy falls expected to lash Arunachal Pradesh, Assam and Meghalaya between Tuesday to Friday, August 24-27.\n\nFurthermore, isolated extremely heavy falls may also bombard Assam and Meghalaya on Wednesday, August 25.\n\n', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1'] answers = ['', 'answer 2', '', 'asnwer 4'] time_of_exam = '23:15:00' student_name = 'Ishaan Dwivedi' en_no = '191b130' number_of_questions = len(questions) max_col = 10 max_row = number_of_questions // max_col if number_of_questions % max_col > 0: max_row = max_row + 1 list_of_done = [1, 3] revisit = [4] current_question = 0 month = 'Aug' day = '28' year = '2021' time = '20:40:00'
pkg_dnf = {} actions = { 'dnf_makecache': { 'command': 'dnf makecache', 'triggered': True, }, } files = { '/etc/dnf/dnf.conf': { 'source': 'dnf.conf', 'mode': '0644', }, } if node.metadata.get('dnf', {}).get('auto_downloads', False): pkg_dnf['yum-cron'] = {} svc_systemd = { 'yum-cron': { 'needs': ['pkg_dnf:yum-cron'], }, } files['/etc/yum/yum-cron.conf'] = { 'source': 'yum-cron.conf', 'mode': '0644', 'content_type': 'mako', 'needs': ['pkg_dnf:yum-cron'], } files['/etc/yum/yum-cron-hourly.conf'] = { 'source': 'yum-cron-hourly.conf', 'mode': '0644', 'content_type': 'mako', 'needs': ['pkg_dnf:yum-cron'], } for package in node.metadata.get('dnf', {}).get('extra_packages', {}): pkg_dnf['{}'.format(package)] = {} for package in node.metadata.get('dnf', {}).get('remove_extra_packages', {}): pkg_dnf['{}'.format(package)] = { 'installed': False, } for repo_id, repo in sorted(node.metadata.get('dnf', {}).get('repositories', {}).items()): files['/etc/yum.repos.d/{}.repo'.format(repo_id)] = { 'content_type': 'mako', 'source': 'repo_template', 'mode': '0644', 'context': { 'repo_items': repo, 'repo_id': repo_id, }, 'triggers': ['action:dnf_makecache'], }
pkg_dnf = {} actions = {'dnf_makecache': {'command': 'dnf makecache', 'triggered': True}} files = {'/etc/dnf/dnf.conf': {'source': 'dnf.conf', 'mode': '0644'}} if node.metadata.get('dnf', {}).get('auto_downloads', False): pkg_dnf['yum-cron'] = {} svc_systemd = {'yum-cron': {'needs': ['pkg_dnf:yum-cron']}} files['/etc/yum/yum-cron.conf'] = {'source': 'yum-cron.conf', 'mode': '0644', 'content_type': 'mako', 'needs': ['pkg_dnf:yum-cron']} files['/etc/yum/yum-cron-hourly.conf'] = {'source': 'yum-cron-hourly.conf', 'mode': '0644', 'content_type': 'mako', 'needs': ['pkg_dnf:yum-cron']} for package in node.metadata.get('dnf', {}).get('extra_packages', {}): pkg_dnf['{}'.format(package)] = {} for package in node.metadata.get('dnf', {}).get('remove_extra_packages', {}): pkg_dnf['{}'.format(package)] = {'installed': False} for (repo_id, repo) in sorted(node.metadata.get('dnf', {}).get('repositories', {}).items()): files['/etc/yum.repos.d/{}.repo'.format(repo_id)] = {'content_type': 'mako', 'source': 'repo_template', 'mode': '0644', 'context': {'repo_items': repo, 'repo_id': repo_id}, 'triggers': ['action:dnf_makecache']}
#https://stackabuse.com/parallel-processing-in-python/ def load_deck(deck_loc): deck_list = open('vintage_cube.txt', 'r') deck = Queue() for card in deck_list: deck.put(card) deck_list.close() return deck
def load_deck(deck_loc): deck_list = open('vintage_cube.txt', 'r') deck = queue() for card in deck_list: deck.put(card) deck_list.close() return deck
n=[int(x) for x in input("Enter the numbers with space: ").split()] x=[ ] s=0 for i in range(len(n)): for j in range(i+1,len(n)): x.append((n[i],n[j])) for i in range(int(len(x))): a = min(x[i])+min(x[len(x)-i-1]) if(a>s): s=a print("OUTPUT: ",s)
n = [int(x) for x in input('Enter the numbers with space: ').split()] x = [] s = 0 for i in range(len(n)): for j in range(i + 1, len(n)): x.append((n[i], n[j])) for i in range(int(len(x))): a = min(x[i]) + min(x[len(x) - i - 1]) if a > s: s = a print('OUTPUT: ', s)
class Params (): def __init__(self): print('HotpotQA') self.name = "HotpotQA" ################################ # dataset ################################ data_path = '' DATA_TRAIN = 'train.pkl' DATA_DEV = 'dev.pkl' DATA_TEST = 'dev.pkl' DATA_DEBUG = 'debug.pkl' DIC = 'vocab-elmo.txt' ELMO_TOKEN = 'ELMO_token_embeddings.hdf5' ELMO_OPTIONS = 'ELMO_options.json' ELMO_WEIGHTS = 'ELMO_weights.hdf5' ################################ # training ################################ batch_size = 128 lr = 0.001 dr = 1.0 dr_rnn = 1.0 hop = 1 num_train_steps = 10000 is_save = 0 graph_prefix = "default" pre_model = "default" EMBEDDING_TRAIN = True # True == (fine-tuning) CAL_ACCURACY_FROM = 0 # run iteration without excuting validation MAX_EARLY_STOP_COUNT = 4 EPOCH_PER_VALID_FREQ = 0.2 QUICK_SAVE_THRESHOLD = 0.70 ################################ # model ################################ # train wordQ/wordS/Sent max 108/394/144 avg 17.9/22.3/40.9 std 9.5/10.9/11.2 # dev wordQ/wordS/Sent max 46/318/147 avg 15.8/22.4/41.3 std 5.5/10.9/11.2 MAX_LENGTH_Q = 66 # 110 MAX_LENGTH_S = 76 # 250 MAX_SENTENCES= 95 # 150 PAD_INDEX = 0 DIM_WORD_EMBEDDING = 1024 DIM_SENTENCE_EMBEDDING = 1024 IS_RNN_EMBEDDING = True USE_PRE_NODE_INFO = True PRJ_MLP = False USE_CHAR_ELMO = False LOSS_ATTN_RATIO = 1e+0 L2_LOSS_RATIO = 2e-4 ################################ # topology ################################ EDGE_PASSAGE_PASSAGE = True EDGE_SENTENCE_QUESTION = True EDGE_SELF = True EDGE_WITHIN_PASSAGE = 1 # 0: neighbor, 1:fully-connected ################################ # MEASRE ################################ USE_WANG_MAP = True # calculate MAP from wang's implementation ################################ # ETC ################################ IS_DEBUG = False # load sample data for debugging IS_SAVE_RESULTS_TO_FILE = False class Params_small (Params): def __init__(self): print('HotpotQA_small') self.name = "HotpotQA_small" ################################ # model ################################ # train wordQ/wordS/Sent max 108/394/144 avg 17.9/22.3/40.9 std 9.5/10.9/11.2 # dev wordQ/wordS/Sent max 46/318/147 avg 15.8/22.4/41.3 std 5.5/10.9/11.2 MAX_LENGTH_Q = 66 # 110 MAX_LENGTH_S = 76 # 250 MAX_SENTENCES= 95 # 150 PAD_INDEX = 0 DIM_WORD_EMBEDDING = 256 DIM_SENTENCE_EMBEDDING = 512 IS_RNN_EMBEDDING = True USE_PRE_NODE_INFO = True PRJ_MLP = False USE_CHAR_ELMO = False LOSS_ATTN_RATIO = 1e+0 L2_LOSS_RATIO = 2e-4 ################################ # topology ################################ EDGE_PASSAGE_PASSAGE = True EDGE_SENTENCE_QUESTION = True EDGE_SELF = True EDGE_WITHIN_PASSAGE = 1 # 0: neighbor, 1:fully-connected ################################ # ETC ################################ IS_DEBUG = False # load sample data for debugging IS_SAVE_RESULTS_TO_FILE = False
class Params: def __init__(self): print('HotpotQA') self.name = 'HotpotQA' data_path = '' data_train = 'train.pkl' data_dev = 'dev.pkl' data_test = 'dev.pkl' data_debug = 'debug.pkl' dic = 'vocab-elmo.txt' elmo_token = 'ELMO_token_embeddings.hdf5' elmo_options = 'ELMO_options.json' elmo_weights = 'ELMO_weights.hdf5' batch_size = 128 lr = 0.001 dr = 1.0 dr_rnn = 1.0 hop = 1 num_train_steps = 10000 is_save = 0 graph_prefix = 'default' pre_model = 'default' embedding_train = True cal_accuracy_from = 0 max_early_stop_count = 4 epoch_per_valid_freq = 0.2 quick_save_threshold = 0.7 max_length_q = 66 max_length_s = 76 max_sentences = 95 pad_index = 0 dim_word_embedding = 1024 dim_sentence_embedding = 1024 is_rnn_embedding = True use_pre_node_info = True prj_mlp = False use_char_elmo = False loss_attn_ratio = 1.0 l2_loss_ratio = 0.0002 edge_passage_passage = True edge_sentence_question = True edge_self = True edge_within_passage = 1 use_wang_map = True is_debug = False is_save_results_to_file = False class Params_Small(Params): def __init__(self): print('HotpotQA_small') self.name = 'HotpotQA_small' max_length_q = 66 max_length_s = 76 max_sentences = 95 pad_index = 0 dim_word_embedding = 256 dim_sentence_embedding = 512 is_rnn_embedding = True use_pre_node_info = True prj_mlp = False use_char_elmo = False loss_attn_ratio = 1.0 l2_loss_ratio = 0.0002 edge_passage_passage = True edge_sentence_question = True edge_self = True edge_within_passage = 1 is_debug = False is_save_results_to_file = False
pkgname = "duktape" pkgver = "2.7.0" pkgrel = 0 build_style = "makefile" make_cmd = "gmake" make_build_args = ["-f", "Makefile.sharedlibrary"] make_install_args = ["-f", "Makefile.sharedlibrary", "INSTALL_PREFIX=/usr"] hostmakedepends = ["gmake", "pkgconf"] pkgdesc = "Embeddeable JavaScript engine" maintainer = "q66 <q66@chimera-linux.org>" license = "MIT" url = "https://duktape.org" source = f"https://github.com/svaarala/{pkgname}/releases/download/v{pkgver}/{pkgname}-{pkgver}.tar.xz" sha256 = "90f8d2fa8b5567c6899830ddef2c03f3c27960b11aca222fa17aa7ac613c2890" # no check target options = ["!check"] def post_install(self): self.install_license("LICENSE.txt") @subpackage("duktape-devel") def _devel(self): return self.default_devel()
pkgname = 'duktape' pkgver = '2.7.0' pkgrel = 0 build_style = 'makefile' make_cmd = 'gmake' make_build_args = ['-f', 'Makefile.sharedlibrary'] make_install_args = ['-f', 'Makefile.sharedlibrary', 'INSTALL_PREFIX=/usr'] hostmakedepends = ['gmake', 'pkgconf'] pkgdesc = 'Embeddeable JavaScript engine' maintainer = 'q66 <q66@chimera-linux.org>' license = 'MIT' url = 'https://duktape.org' source = f'https://github.com/svaarala/{pkgname}/releases/download/v{pkgver}/{pkgname}-{pkgver}.tar.xz' sha256 = '90f8d2fa8b5567c6899830ddef2c03f3c27960b11aca222fa17aa7ac613c2890' options = ['!check'] def post_install(self): self.install_license('LICENSE.txt') @subpackage('duktape-devel') def _devel(self): return self.default_devel()
config = { 'row_data_path': './data/rel_data.txt', 'triplet_data_path': './data/triplet_data.txt', 'kg_data_path': './output/kg_data.json', 'template_path': './output/template.xlsx', 'url': "http://localhost:7474", 'user': "neo4j", 'password': "123456" }
config = {'row_data_path': './data/rel_data.txt', 'triplet_data_path': './data/triplet_data.txt', 'kg_data_path': './output/kg_data.json', 'template_path': './output/template.xlsx', 'url': 'http://localhost:7474', 'user': 'neo4j', 'password': '123456'}
class Villager: def __init__(self, number, books): self.number = number self.books = books self.goodTrades = [] def getNumber(self): return self.number def getBooks(self): return self.books def addGoodTrade(self, book): self.goodTrades.append(book) def getGoodTrades(self): return self.goodTrades class Enchantment: def __init__(self, name, maxRank, minCost): self.name = name self.maxRank = maxRank self.minCost = minCost self.currentCost = None self.villagers = [] def reset(self): self.currentCost = None self.villagers = [] def compareCost(self, cost, rank, villager): diff = self.maxRank - rank actualCost = cost*(2**diff) if self.currentCost == None or actualCost < self.currentCost: self.currentCost = actualCost self.updateVillager(villager) elif actualCost == self.currentCost: self.addVillager(villager) elif actualCost > self.currentCost: return -1 def matchCost(self, cost, rank): diff = self.maxRank - rank actualCost = cost*(2**diff) if actualCost == self.currentCost: return 1 else: return 0 def updateCost(self, cost): self.currentCost = cost def updateVillager(self, villager): self.villagers = [] self.villagers.append(villager) def addVillager(self, villager): self.villagers.append(villager) def getName(self): return self.name def getMaxRank(self): return self.maxRank def getMinCost(self): return self.minCost def getCurrentCost(self): return self.currentCost def getVillagers(self): return self.villagers class Book(): def __init__(self, ench, rank, cost): self.ench = ench self.rank = rank self.cost = cost def getEnch(self): return self.ench def getRank(self): return self.rank def getCost(self): return self.cost
class Villager: def __init__(self, number, books): self.number = number self.books = books self.goodTrades = [] def get_number(self): return self.number def get_books(self): return self.books def add_good_trade(self, book): self.goodTrades.append(book) def get_good_trades(self): return self.goodTrades class Enchantment: def __init__(self, name, maxRank, minCost): self.name = name self.maxRank = maxRank self.minCost = minCost self.currentCost = None self.villagers = [] def reset(self): self.currentCost = None self.villagers = [] def compare_cost(self, cost, rank, villager): diff = self.maxRank - rank actual_cost = cost * 2 ** diff if self.currentCost == None or actualCost < self.currentCost: self.currentCost = actualCost self.updateVillager(villager) elif actualCost == self.currentCost: self.addVillager(villager) elif actualCost > self.currentCost: return -1 def match_cost(self, cost, rank): diff = self.maxRank - rank actual_cost = cost * 2 ** diff if actualCost == self.currentCost: return 1 else: return 0 def update_cost(self, cost): self.currentCost = cost def update_villager(self, villager): self.villagers = [] self.villagers.append(villager) def add_villager(self, villager): self.villagers.append(villager) def get_name(self): return self.name def get_max_rank(self): return self.maxRank def get_min_cost(self): return self.minCost def get_current_cost(self): return self.currentCost def get_villagers(self): return self.villagers class Book: def __init__(self, ench, rank, cost): self.ench = ench self.rank = rank self.cost = cost def get_ench(self): return self.ench def get_rank(self): return self.rank def get_cost(self): return self.cost
#!/usr/bin/env python3 def lookandsay(n): acc = [(1,n[0])] for c in n[1:]: count, num = acc[-1] if num == c: acc[-1] = (count+1, num) else: acc += [(1, c)] return "".join(["".join((str(x),y)) for (x,y) in acc]) seed = "3113322113" for i in range(50): seed = lookandsay(seed) if i == 39: print("Answer 1:", len(seed)) print("Answer 2:", len(seed))
def lookandsay(n): acc = [(1, n[0])] for c in n[1:]: (count, num) = acc[-1] if num == c: acc[-1] = (count + 1, num) else: acc += [(1, c)] return ''.join([''.join((str(x), y)) for (x, y) in acc]) seed = '3113322113' for i in range(50): seed = lookandsay(seed) if i == 39: print('Answer 1:', len(seed)) print('Answer 2:', len(seed))
class RBI: def __init__(self, fmeca): self.fmeca = fmeca self._generate_rbi() def _generate_rbi(self): # TODO: Add rbi logic (from risk_calculator but modified to take a # fmeca argument and loop through each inspection type) if self._total_risk is None: print('Calculating total component risk.') # self.subcomponents_calculated = copy.deepcopy(self.subcomponents) self._total_risk = 0 for subcomponent in self.subcomponents: failures = subcomponent.failures for failure in failures: if failure.inspection_type == inspection_type and not failure.time_dependant: if failure.detectable == 'Lagging': self._total_risk += 0.5 * failure.risk else: self._total_risk += failure.risk return self._total_risk
class Rbi: def __init__(self, fmeca): self.fmeca = fmeca self._generate_rbi() def _generate_rbi(self): if self._total_risk is None: print('Calculating total component risk.') self._total_risk = 0 for subcomponent in self.subcomponents: failures = subcomponent.failures for failure in failures: if failure.inspection_type == inspection_type and (not failure.time_dependant): if failure.detectable == 'Lagging': self._total_risk += 0.5 * failure.risk else: self._total_risk += failure.risk return self._total_risk
def parse(it): result = [] while True: try: tk = next(it) except StopIteration: break if tk == '}': break val = next(it) if val == '{': result.append((tk,parse(it))) else: result.append((tk, val)) return result with open('C:\\scripts\\python27\\coffe_test\\cifar10_quick.prototxt') as f: s = f.read() prototxt_name = re.findall(r'^name:\s+\"(\w+)\"',s) #pprint.pprint(prototxt_name) print(prototxt_name)
def parse(it): result = [] while True: try: tk = next(it) except StopIteration: break if tk == '}': break val = next(it) if val == '{': result.append((tk, parse(it))) else: result.append((tk, val)) return result with open('C:\\scripts\\python27\\coffe_test\\cifar10_quick.prototxt') as f: s = f.read() prototxt_name = re.findall('^name:\\s+\\"(\\w+)\\"', s) print(prototxt_name)
kminicial = float(input('Insira a km inicial: ')) kmatual = float(input('insira a km atual: ')) dias = int(input('Quantos dias ficou alugado? ')) kmpercorrido = kmatual - kminicial rkm = kmpercorrido * 0.15 rdias = dias * 60 total = rkm+rdias print ('O total de km percorrido foi: {}. A quantidade de dias utilizado foi: {}, que resultou no valor de R$: {}'.format(kmpercorrido,dias,total))
kminicial = float(input('Insira a km inicial: ')) kmatual = float(input('insira a km atual: ')) dias = int(input('Quantos dias ficou alugado? ')) kmpercorrido = kmatual - kminicial rkm = kmpercorrido * 0.15 rdias = dias * 60 total = rkm + rdias print('O total de km percorrido foi: {}. A quantidade de dias utilizado foi: {}, que resultou no valor de R$: {}'.format(kmpercorrido, dias, total))
attribute_filter_parameter_schema = [ { 'name': 'search', 'in': 'query', 'required': False, 'description': 'Lucene query syntax string for use with Elasticsearch. ' 'See <a href=https://www.elastic.co/guide/en/elasticsearch/' 'reference/7.10/query-dsl-query-string-query.html#query-string-syntax>reference</a>. ' 'This search string only applies to the relevant objects, not children or ' 'parents. For media, child annotations can be searched with `annotation_search`. ' 'For localizations and states, parent media can be searched with `media_search`.', 'schema': {'type': 'string'}, 'examples': { 'no_search': { 'summary': 'No search', 'value': '', }, 'basic': { 'summary': 'Generic search', 'value': '"My search string"', }, 'user_attribute': { 'summary': 'Search on user-defined attribute', 'value': 'Species:lobster', }, 'builtin_attribute': { 'summary': 'Search built-in attribute', 'value': '_name:*.mp4', }, 'numerical_attribute': { 'summary': 'Search numerical attribute', 'value': '_width:<0.5', }, 'wildcard': { 'summary': 'Wildcard search', 'value': 'Species:*hake', }, 'boolean': { 'summary': 'Boolean search', 'value': '_name:*.mp4 AND Species:*hake', }, }, }, { 'name': 'attribute', 'in': 'query', 'required': False, 'description': 'Attribute equality filter. Format is ' 'attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_lt', 'in': 'query', 'required': False, 'description': 'Attribute less than filter. Format is ' 'attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_lte', 'in': 'query', 'required': False, 'description': 'Attribute less than or equal filter. Format is ' 'attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_gt', 'in': 'query', 'required': False, 'description': 'Attribute greater than filter. Format is ' 'attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_gte', 'in': 'query', 'required': False, 'description': 'Attribute greater than or equal filter. Format is ' 'attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_contains', 'in': 'query', 'required': False, 'description': 'Attribute contains filter. Format is ' 'attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_distance', 'in': 'query', 'required': False, 'description': 'Range filter for geoposition attributes. Format is ' 'attribute1::distance_km2::lat2::lon2,' '[attribute2::distancekm2::lat2::lon2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'attribute_null', 'in': 'query', 'required': False, 'description': 'Attribute null filter. Returns elements for which ' 'a given attribute is not defined.', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False, }, { 'name': 'start', 'in': 'query', 'required': False, 'description': 'Pagination start index. Index of the first item in a larger list to ' 'return.', 'schema': {'type': 'integer'}, }, { 'name': 'stop', 'in': 'query', 'required': False, 'description': 'Pagination start index. Non-inclusive ndex of the last item in a ' 'larger list to return.', 'schema': {'type': 'integer'}, }, { 'name': 'force_es', 'in': 'query', 'required': False, 'description': 'Set to 1 to require an Elasticsearch based query. This can be used ' 'as a consistency check or for performance comparison.', 'schema': {'type': 'integer', 'enum': [0, 1]}, }, ]
attribute_filter_parameter_schema = [{'name': 'search', 'in': 'query', 'required': False, 'description': 'Lucene query syntax string for use with Elasticsearch. See <a href=https://www.elastic.co/guide/en/elasticsearch/reference/7.10/query-dsl-query-string-query.html#query-string-syntax>reference</a>. This search string only applies to the relevant objects, not children or parents. For media, child annotations can be searched with `annotation_search`. For localizations and states, parent media can be searched with `media_search`.', 'schema': {'type': 'string'}, 'examples': {'no_search': {'summary': 'No search', 'value': ''}, 'basic': {'summary': 'Generic search', 'value': '"My search string"'}, 'user_attribute': {'summary': 'Search on user-defined attribute', 'value': 'Species:lobster'}, 'builtin_attribute': {'summary': 'Search built-in attribute', 'value': '_name:*.mp4'}, 'numerical_attribute': {'summary': 'Search numerical attribute', 'value': '_width:<0.5'}, 'wildcard': {'summary': 'Wildcard search', 'value': 'Species:*hake'}, 'boolean': {'summary': 'Boolean search', 'value': '_name:*.mp4 AND Species:*hake'}}}, {'name': 'attribute', 'in': 'query', 'required': False, 'description': 'Attribute equality filter. Format is attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_lt', 'in': 'query', 'required': False, 'description': 'Attribute less than filter. Format is attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_lte', 'in': 'query', 'required': False, 'description': 'Attribute less than or equal filter. Format is attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_gt', 'in': 'query', 'required': False, 'description': 'Attribute greater than filter. Format is attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_gte', 'in': 'query', 'required': False, 'description': 'Attribute greater than or equal filter. Format is attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_contains', 'in': 'query', 'required': False, 'description': 'Attribute contains filter. Format is attribute1::value1,[attribute2::value2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_distance', 'in': 'query', 'required': False, 'description': 'Range filter for geoposition attributes. Format is attribute1::distance_km2::lat2::lon2,[attribute2::distancekm2::lat2::lon2].', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'attribute_null', 'in': 'query', 'required': False, 'description': 'Attribute null filter. Returns elements for which a given attribute is not defined.', 'schema': {'type': 'array', 'items': {'type': 'string'}}, 'explode': False}, {'name': 'start', 'in': 'query', 'required': False, 'description': 'Pagination start index. Index of the first item in a larger list to return.', 'schema': {'type': 'integer'}}, {'name': 'stop', 'in': 'query', 'required': False, 'description': 'Pagination start index. Non-inclusive ndex of the last item in a larger list to return.', 'schema': {'type': 'integer'}}, {'name': 'force_es', 'in': 'query', 'required': False, 'description': 'Set to 1 to require an Elasticsearch based query. This can be used as a consistency check or for performance comparison.', 'schema': {'type': 'integer', 'enum': [0, 1]}}]
def get_max_profit(prices, fee, reserve=0, buyable=True): if not prices: return reserve price_offset = -prices[0] - fee if buyable else prices[0] return max( get_max_profit(prices[1:], fee, reserve, buyable), get_max_profit(prices[1:], fee, reserve + price_offset, not buyable) ) # Tests assert get_max_profit([1, 3, 2, 8, 4, 10], 2) == 9 assert get_max_profit([1, 3, 2, 1, 4, 10], 2) == 7
def get_max_profit(prices, fee, reserve=0, buyable=True): if not prices: return reserve price_offset = -prices[0] - fee if buyable else prices[0] return max(get_max_profit(prices[1:], fee, reserve, buyable), get_max_profit(prices[1:], fee, reserve + price_offset, not buyable)) assert get_max_profit([1, 3, 2, 8, 4, 10], 2) == 9 assert get_max_profit([1, 3, 2, 1, 4, 10], 2) == 7
# ============================================================================= # Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/ # FileName: 11056.py # Description: UVa Online Judge - 11056 # ============================================================================= while True: try: N = int(input()) except EOFError: break A = [] # (name, time) for i in range(N): line = input() name, time_str = line.split(" : ") time_token = time_str.split() time = 60 * 1000 * int(time_token[0]) + 1000 * int(time_token[2]) + int(time_token[4]) A.append((name, time)) A.sort(key=lambda x:(x[1], x[0].lower())) n_row = (len(A)+1)//2 for i in range(n_row): start = 2*i end = min(start+2, len(A)) print(f"Row {i+1}") for j in range(start, end): print(A[j][0]) print("") try: input() except EOFError: break
while True: try: n = int(input()) except EOFError: break a = [] for i in range(N): line = input() (name, time_str) = line.split(' : ') time_token = time_str.split() time = 60 * 1000 * int(time_token[0]) + 1000 * int(time_token[2]) + int(time_token[4]) A.append((name, time)) A.sort(key=lambda x: (x[1], x[0].lower())) n_row = (len(A) + 1) // 2 for i in range(n_row): start = 2 * i end = min(start + 2, len(A)) print(f'Row {i + 1}') for j in range(start, end): print(A[j][0]) print('') try: input() except EOFError: break
class ModbusException(Exception): @staticmethod def fromExceptionCode(exception_code: int): if exception_code == 1: return IllegalFunctionError elif exception_code == 2: return IllegalDataAddressError elif exception_code == 3: return IllegalDataValueError elif exception_code == 4: return SlaveDeviceFailureError elif exception_code == 5: return AcknowledgeError elif exception_code == 6: return SlaveDeviceBusyError elif exception_code == 7: return NegativeAcknowledgeError elif exception_code == 8: return MemoryParityError elif exception_code == 10: return GatewayPathUnavailableError elif exception_code == 11: return GatewayTargetDeviceFailedToRespondError else: return Exception(f'Slave reported a unknown error, exception code: {exception_code}') class IllegalFunctionError(ModbusException): pass class IllegalDataAddressError(ModbusException): pass class IllegalDataValueError(ModbusException): pass class SlaveDeviceFailureError(ModbusException): pass class AcknowledgeError(ModbusException): pass class SlaveDeviceBusyError(ModbusException): pass class NegativeAcknowledgeError(ModbusException): pass class MemoryParityError(ModbusException): pass class GatewayPathUnavailableError(ModbusException): pass class GatewayTargetDeviceFailedToRespondError(ModbusException): pass
class Modbusexception(Exception): @staticmethod def from_exception_code(exception_code: int): if exception_code == 1: return IllegalFunctionError elif exception_code == 2: return IllegalDataAddressError elif exception_code == 3: return IllegalDataValueError elif exception_code == 4: return SlaveDeviceFailureError elif exception_code == 5: return AcknowledgeError elif exception_code == 6: return SlaveDeviceBusyError elif exception_code == 7: return NegativeAcknowledgeError elif exception_code == 8: return MemoryParityError elif exception_code == 10: return GatewayPathUnavailableError elif exception_code == 11: return GatewayTargetDeviceFailedToRespondError else: return exception(f'Slave reported a unknown error, exception code: {exception_code}') class Illegalfunctionerror(ModbusException): pass class Illegaldataaddresserror(ModbusException): pass class Illegaldatavalueerror(ModbusException): pass class Slavedevicefailureerror(ModbusException): pass class Acknowledgeerror(ModbusException): pass class Slavedevicebusyerror(ModbusException): pass class Negativeacknowledgeerror(ModbusException): pass class Memoryparityerror(ModbusException): pass class Gatewaypathunavailableerror(ModbusException): pass class Gatewaytargetdevicefailedtoresponderror(ModbusException): pass
# aoc 2020 day 9 def two_sum(val, lst): for x in lst: for y in lst: if x + y == val: return True return False prelude_len = 25 with open("aoc_2020_9.in") as f: data = f.readlines() data = list(map(int, data)) part_one_answer = 0 for idx in range(prelude_len, len(data)): preceding = data[(idx - prelude_len): idx] if not two_sum(data[idx], preceding): part_one_answer = data[idx] break print("Part one answer is ", part_one_answer) pt2 = [] def part2(d): for x in range(len(d) - 1): for y in range(1, len(d)): if sum(d[x:y]) == part_one_answer and x != y: return [min(d[x:y]), max(d[x:y])] pt2 = part2(data) print("Part two answer is ", sum(pt2)) assert(part_one_answer == 85848519) assert(sum(pt2) == 13414198)
def two_sum(val, lst): for x in lst: for y in lst: if x + y == val: return True return False prelude_len = 25 with open('aoc_2020_9.in') as f: data = f.readlines() data = list(map(int, data)) part_one_answer = 0 for idx in range(prelude_len, len(data)): preceding = data[idx - prelude_len:idx] if not two_sum(data[idx], preceding): part_one_answer = data[idx] break print('Part one answer is ', part_one_answer) pt2 = [] def part2(d): for x in range(len(d) - 1): for y in range(1, len(d)): if sum(d[x:y]) == part_one_answer and x != y: return [min(d[x:y]), max(d[x:y])] pt2 = part2(data) print('Part two answer is ', sum(pt2)) assert part_one_answer == 85848519 assert sum(pt2) == 13414198
# # PySNMP MIB module A3COM-SWITCHING-SYSTEMS-FDDI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/A3COM-SWITCHING-SYSTEMS-FDDI-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:08:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, OctetString, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "Integer", "OctetString", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueRangeConstraint, ConstraintsIntersection, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ConstraintsIntersection", "ValueSizeConstraint", "SingleValueConstraint") fddimibPORTLerFlag, fddimibPORTMyType, fddimibMACCopiedCts, fddimibPORTLerEstimate, fddimibMACNotCopiedRatio, fddimibPORTLemRejectCts, fddimibMACUnaDaFlag, fddimibMACLostCts, fddimibPORTAvailablePaths, fddimibSMTCFState, fddimibSMTStationId, fddimibPORTRequestedPaths, fddimibMACOldUpstreamNbr, fddimibMACRequestedPaths, FddiTimeNano, fddimibMACCurrentPath, fddimibPORTLerAlarm, fddimibPORTConnectState, fddimibMACAvailablePaths, fddimibSMTPeerWrapFlag, fddimibMACUpstreamNbr, fddimibMACSMTAddress, fddimibPORTCurrentPath, fddimibMACNotCopiedCts, fddimibMACDownstreamNbr, fddimibPORTPCWithhold, fddimibMACFrameErrorFlag, fddimibMACOldDownstreamNbr, fddimibMACFrameCts, fddimibMACFrameErrorRatio, fddimibMACDaFlag, fddimibMACNotCopiedFlag, fddimibPORTNeighborType, fddimibMACErrorCts, fddimibPORTLerCutoff, fddimibPORTLemCts, FddiSMTStationIdType = mibBuilder.importSymbols("FDDI-SMT73-MIB", "fddimibPORTLerFlag", "fddimibPORTMyType", "fddimibMACCopiedCts", "fddimibPORTLerEstimate", "fddimibMACNotCopiedRatio", "fddimibPORTLemRejectCts", "fddimibMACUnaDaFlag", "fddimibMACLostCts", "fddimibPORTAvailablePaths", "fddimibSMTCFState", "fddimibSMTStationId", "fddimibPORTRequestedPaths", "fddimibMACOldUpstreamNbr", "fddimibMACRequestedPaths", "FddiTimeNano", "fddimibMACCurrentPath", "fddimibPORTLerAlarm", "fddimibPORTConnectState", "fddimibMACAvailablePaths", "fddimibSMTPeerWrapFlag", "fddimibMACUpstreamNbr", "fddimibMACSMTAddress", "fddimibPORTCurrentPath", "fddimibMACNotCopiedCts", "fddimibMACDownstreamNbr", "fddimibPORTPCWithhold", "fddimibMACFrameErrorFlag", "fddimibMACOldDownstreamNbr", "fddimibMACFrameCts", "fddimibMACFrameErrorRatio", "fddimibMACDaFlag", "fddimibMACNotCopiedFlag", "fddimibPORTNeighborType", "fddimibMACErrorCts", "fddimibPORTLerCutoff", "fddimibPORTLemCts", "FddiSMTStationIdType") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, Counter64, MibIdentifier, iso, Bits, Gauge32, ObjectIdentity, Unsigned32, enterprises, Counter32, TimeTicks, IpAddress, NotificationType, ModuleIdentity, Integer32 = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "Counter64", "MibIdentifier", "iso", "Bits", "Gauge32", "ObjectIdentity", "Unsigned32", "enterprises", "Counter32", "TimeTicks", "IpAddress", "NotificationType", "ModuleIdentity", "Integer32") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") a3Com = MibIdentifier((1, 3, 6, 1, 4, 1, 43)) switchingSystemsMibs = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 29)) a3ComSwitchingSystemsFddiMib = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 29, 10)) a3ComFddiSMT = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 1)) a3ComFddiMAC = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 2)) a3ComFddiPATH = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 3)) a3ComFddiPORT = MibIdentifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 4)) a3ComFddiSMTTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1), ) if mibBuilder.loadTexts: a3ComFddiSMTTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTTable.setDescription('A list of optional SMT entries. The number of entries shall not exceed the value of snmpFddiSMTNumber.') a3ComFddiSMTEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiSMTIndex")) if mibBuilder.loadTexts: a3ComFddiSMTEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTEntry.setDescription('An optional SMT entry containing information common to a given optional SMT.') a3ComFddiSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiSMTManufacturerOUI = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(3, 3)).setFixedLength(3)).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiSMTManufacturerOUI.setReference('ANSI { fddiSMT 16 }') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerOUI.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerOUI.setDescription('The three octets of manufacturer data which make up the manufacturerOUI component.') a3ComFddiSMTManufacturerData = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(29, 29)).setFixedLength(29)).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiSMTManufacturerData.setReference('ANSI { fddiSMT 16 }') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerData.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerData.setDescription('The 29 octets of manufacturer data which make up the manufacturerData component.') a3ComFddiSMTHoldState = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("not-implemented", 1), ("not-holding", 2), ("holding-prm", 3), ("holding-sec", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiSMTHoldState.setReference('ANSI { fddiSMT 43 }') if mibBuilder.loadTexts: a3ComFddiSMTHoldState.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTHoldState.setDescription("This variable indicates the current state of the Hold function. The value 'not-holding' is the default and initial value. The value must be set to 'not-holding' as part of Active-Actions and when the conditions causing 'holding-prm' or 'holding-sec' are no longer true. The value 'holding-prm' must be set when the condition (notTR-Flag & not RE-Flag & (PC-LS=QLS | LEM-Fail TNE>NS-Max | (not LS-Flag & TPC > T-Out))) is satisfied in state PC8:ACTIVE for the A Port. The value 'holding-sec' must be set when the condition (notTR-Flag & not RE-Flag & (PC-LS=QLS | LEM-Fail TNE>NS-Max | (not LS-Flag & TPC > T-Out))) is satisfied in state PC8:ACTIVE for the B Port.") a3ComFddiSMTSetCount = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiSMTSetCount.setReference('ANSI { fddiSMT 53 }') if mibBuilder.loadTexts: a3ComFddiSMTSetCount.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTSetCount.setDescription('This variable is composed of a count incremented in response to a Set operation on the MIB, and the time of the change, however only the count is reported here (refer to ANSI SMT 8.4.1).') a3ComFddiSMTLastSetStationId = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 6), FddiSMTStationIdType()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiSMTLastSetStationId.setReference('ANSI { fddiSMT 54 }') if mibBuilder.loadTexts: a3ComFddiSMTLastSetStationId.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTLastSetStationId.setDescription('The Station ID of the station that effected the last change in the FDDI MIB.') a3ComFddiMACBridgeFunctionTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1), ) if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionTable.setDescription('A list of MAC bridge function entries.') a3ComFddiMACBridgeFunctionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiMACBridgeFunctionSMTIndex"), (0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiMACBridgeFunctionMACIndex")) if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionEntry.setDescription('Bridge function information for a given MAC within a given SMT.') a3ComFddiMACBridgeFunctionSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiMACBridgeFunctionMACIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionMACIndex.setReference('ANSI { fddiMAC 34 }') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionMACIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionMACIndex.setDescription('Index variable for uniquely identifying the MAC object instances.') a3ComFddiMACBridgeFunctions = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-1, 7))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctions.setReference('ANSI { fddiMAC 12 }') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctions.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctions.setDescription("Indicates the MAC's optional bridging functions. The Value -1 is used to indicate that bridging is not supported by this MAC. The value is a sum. This value initially takes the value zero, then for each function present, 2 raised to a power is added to the sum. The powers are according to the following table: Function Power tb 0 -- Transparent bridging active sr 1 -- Src routing active srt 2 -- Src routing transparent active ") a3ComFddiMACTPriTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2), ) if mibBuilder.loadTexts: a3ComFddiMACTPriTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriTable.setDescription('A list of MAC T-Pri entries.') a3ComFddiMACTPriEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiMACTPriSMTIndex"), (0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiMACTPriMACIndex")) if mibBuilder.loadTexts: a3ComFddiMACTPriEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriEntry.setDescription('A collection of T-Pri information for a given MAC within a given SMT.') a3ComFddiMACTPriSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPriSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiMACTPriMACIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPriMACIndex.setReference('ANSI { fddiMAC 34 }') if mibBuilder.loadTexts: a3ComFddiMACTPriMACIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriMACIndex.setDescription('Index variable for uniquely identifying the MAC object instances.') a3ComFddiMACTPri0 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 3), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri0.setReference('ANSI { fddiMAC 56 }') if mibBuilder.loadTexts: a3ComFddiMACTPri0.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri0.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiMACTPri1 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 4), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri1.setReference('ANSI { fddiMAC 57 }') if mibBuilder.loadTexts: a3ComFddiMACTPri1.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri1.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiMACTPri2 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 5), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri2.setReference('ANSI { fddiMAC 58 }') if mibBuilder.loadTexts: a3ComFddiMACTPri2.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri2.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiMACTPri3 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 6), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri3.setReference('ANSI { fddiMAC 59 }') if mibBuilder.loadTexts: a3ComFddiMACTPri3.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri3.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiMACTPri4 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 7), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri4.setReference('ANSI { fddiMAC 60 }') if mibBuilder.loadTexts: a3ComFddiMACTPri4.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri4.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiMACTPri5 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 8), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri5.setReference('ANSI { fddiMAC 61 }') if mibBuilder.loadTexts: a3ComFddiMACTPri5.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri5.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiMACTPri6 = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 9), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiMACTPri6.setReference('ANSI { fddiMAC 62 }') if mibBuilder.loadTexts: a3ComFddiMACTPri6.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri6.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3ComFddiPATHRingTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1), ) if mibBuilder.loadTexts: a3ComFddiPATHRingTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingTable.setDescription('A list of PATH ring entries.') a3ComFddiPATHRingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPATHRingSMTIndex"), (0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPATHRingPATHIndex")) if mibBuilder.loadTexts: a3ComFddiPATHRingEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingEntry.setDescription('Ring latency, trace status, and T-Rmode information for a given PATH within a given SMT.') a3ComFddiPATHRingSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPATHRingSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiPATHRingPATHIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPATHRingPATHIndex.setReference('ANSI { fddiPATH 11 }') if mibBuilder.loadTexts: a3ComFddiPATHRingPATHIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingPATHIndex.setDescription('Index variable for uniquely identifying the primary, secondary and local PATH object instances. Local PATH object instances are represented with integer values 3 to 255.') a3ComFddiPATHRingLatency = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 3), FddiTimeNano()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPATHRingLatency.setReference('ANSI { fddiPATH 13 }') if mibBuilder.loadTexts: a3ComFddiPATHRingLatency.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingLatency.setDescription('Gives the total accumulated latency of the ring associated with this path. May be measured directly by the station or calculated by a management station. Values of this object are reported in 1 ns units.') a3ComFddiPATHTraceStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 15))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPATHTraceStatus.setReference('ANSI { fddiPATH 14 }') if mibBuilder.loadTexts: a3ComFddiPATHTraceStatus.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHTraceStatus.setDescription('This attribute indicates the current trace status of the path. The value is a sum which represents all of the trace status information which applies. This value initially takes the value zero, then for each condition which applies, 2 raised to a power is added to the sum. the powers are according to the following table: TraceStatus Power traceinitiated 0 tracepropragated 1 traceterminated 2 tracetimeout 3') a3ComFddiPATHT_Rmode = MibScalar((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 5), FddiTimeNano()).setLabel("a3ComFddiPATHT-Rmode").setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPATHT_Rmode.setReference('ANSI { fddiPATH 19 }') if mibBuilder.loadTexts: a3ComFddiPATHT_Rmode.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHT_Rmode.setDescription('Used by RMT to limit the duration of restricted dialogs on a path. This object is reported in 1 ns units.') a3ComFddiPATHSbaTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2), ) if mibBuilder.loadTexts: a3ComFddiPATHSbaTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaTable.setDescription('A list of PATH Sba entries.') a3ComFddiPATHSbaEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPATHSbaSMTIndex"), (0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPATHSbaPATHIndex")) if mibBuilder.loadTexts: a3ComFddiPATHSbaEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaEntry.setDescription('Sba information for a given PATH within a given SMT.') a3ComFddiPATHSbaSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPATHSbaSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiPATHSbaPATHIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPATHSbaPATHIndex.setReference('ANSI { fddiPATH 11 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaPATHIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaPATHIndex.setDescription('Index variable for uniquely identifying the primary, secondary and local PATH object instances. Local PATH object instances are represented with integer values 3 to 255.') a3ComFddiPATHSbaPayload = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1562))).setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPATHSbaPayload.setReference('ANSI { fddiPATH 15 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaPayload.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaPayload.setDescription('The payload portion of the Synchronous Bandwidth Allocation for thi path. This value represents the maximum number of bytes of data allocated for transmission per 125 microseconds.') a3ComFddiPATHSbaOverhead = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPATHSbaOverhead.setReference('ANSI { fddiPATH 16 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaOverhead.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaOverhead.setDescription('The overhead portion of the Synchronous Bandwith Allocation for this path. This value repersents the maximum number of bytes overhead (token capture, frame header, etc.) used pre negotiated Target Token Rotation Time (T-neg).') a3ComFddiPATHSbaAvailable = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 12500000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPATHSbaAvailable.setReference('ANSI { fddiPATH 20 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaAvailable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaAvailable.setDescription('This value is the maximum Synchronous Bandwith available for a path in bytes per second.') a3ComFddiPORTTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1), ) if mibBuilder.loadTexts: a3ComFddiPORTTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTTable.setDescription('A list of optional PORT entries.') a3ComFddiPORTEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPORTSMTIndex"), (0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPORTIndex")) if mibBuilder.loadTexts: a3ComFddiPORTEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTEntry.setDescription('MAC loop time and EB error count information for a given PORT within a given SMT.') a3ComFddiPORTSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPORTSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiPORTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPORTIndex.setReference('ANSI { fddiPORT 29 }') if mibBuilder.loadTexts: a3ComFddiPORTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTIndex.setDescription('Index variable for uniquely identifying the PORT object instances.') a3ComFddiPORTMACLoopTime = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 3), FddiTimeNano()).setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPORTMACLoopTime.setReference('ANSI { fddiPORT 21 }') if mibBuilder.loadTexts: a3ComFddiPORTMACLoopTime.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTMACLoopTime.setDescription('This attribute controls the value used for T-Next(9) (see 9.4.4.2.3). This object is reported in 1 ns units.') a3ComFddiPORTEBErrorCt = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCt.setReference('ANSI { fddiPORT 41 }') if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCt.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCt.setDescription('A count that should as closely as possible match the times an Elasticity Buffer Error has occurred while in active line state.') a3ComFddiPORTLSTable = MibTable((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2), ) if mibBuilder.loadTexts: a3ComFddiPORTLSTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSTable.setDescription('A list of optional PORT line state entries.') a3ComFddiPORTLSEntry = MibTableRow((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1), ).setIndexNames((0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPORTLSSMTIndex"), (0, "A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPORTLSPORTIndex")) if mibBuilder.loadTexts: a3ComFddiPORTLSEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSEntry.setDescription('Maintenance line state and PC line state information for a given PORT within a given SMT.') a3ComFddiPORTLSSMTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPORTLSSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3ComFddiPORTLSPORTIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPORTLSPORTIndex.setReference('ANSI { fddiPORT 29 }') if mibBuilder.loadTexts: a3ComFddiPORTLSPORTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSPORTIndex.setDescription('Index variable for uniquely identifying the PORT object instances.') a3ComFddiPORTMaintLS = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("quiet", 1), ("idle", 2), ("master", 3), ("halt", 4), ("receive-active", 5), ("receive-unknown", 6), ("receive-noise", 7)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: a3ComFddiPORTMaintLS.setReference('ANSI { fddiPORT 31 }') if mibBuilder.loadTexts: a3ComFddiPORTMaintLS.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTMaintLS.setDescription('The PORT Maintenance Line State specifies the line state (Maint-LS) to be transmitted when the PCM state machine for the port is in state PC9 Maint.') a3ComFddiPORTPCLS = MibTableColumn((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=NamedValues(("quiet", 1), ("idle", 2), ("master", 3), ("halt", 4), ("receive-active", 5), ("receive-unknown", 6), ("receive-noise", 7)))).setMaxAccess("readonly") if mibBuilder.loadTexts: a3ComFddiPORTPCLS.setReference('ANSI { fddiPORT 34 }') if mibBuilder.loadTexts: a3ComFddiPORTPCLS.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTPCLS.setDescription('This attribute indicates the line state (PC-LS) received by the port.') a3ComFddiSMTHoldCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,1)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiSMTHoldState")) if mibBuilder.loadTexts: a3ComFddiSMTHoldCondition.setDescription('Generated when fddiSMTHoldState (fddimibSMTHoldState) assumes the state holding-prm or holding-sec. This notification is a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiSMTHoldCondition.setReference('ANSI { fddiSMT 71 }') a3ComFddiSMTPeerWrapCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,2)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibSMTCFState"), ("FDDI-SMT73-MIB", "fddimibSMTPeerWrapFlag")) if mibBuilder.loadTexts: a3ComFddiSMTPeerWrapCondition.setDescription('This condition is active when fddiSMTPeerWrapFlag (fddimibSMTPeerWrapFlag) is set. This notification is a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiSMTPeerWrapCondition.setReference('ANSI { fddiSMT 72 }') a3ComFddiMACDuplicateAddressCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,3)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibMACSMTAddress"), ("FDDI-SMT73-MIB", "fddimibMACUpstreamNbr"), ("FDDI-SMT73-MIB", "fddimibMACDaFlag"), ("FDDI-SMT73-MIB", "fddimibMACUnaDaFlag")) if mibBuilder.loadTexts: a3ComFddiMACDuplicateAddressCondition.setDescription('This condition is active when either fddiMACDA-Flag (fddimibMACDaFlag) or fddiMACUNDA-Flag (fddimibMACUnaDaFlag) is set. This event is handled as a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACDuplicateAddressCondition.setReference('ANSI { fddiMAC 140 }') a3ComFddiMACFrameErrorCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,4)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibMACFrameErrorFlag"), ("FDDI-SMT73-MIB", "fddimibMACFrameCts"), ("FDDI-SMT73-MIB", "fddimibMACErrorCts"), ("FDDI-SMT73-MIB", "fddimibMACLostCts"), ("FDDI-SMT73-MIB", "fddimibMACFrameErrorRatio")) if mibBuilder.loadTexts: a3ComFddiMACFrameErrorCondition.setDescription('Generated when the fddiMACFrameErrorRatio (fddimibMACFrameErrorRatio) is greater than or equal to fddiMACFrameErrorThreshold (fddimibMACFrameErrorThreshold). This event is handled as a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACFrameErrorCondition.setReference('ANSI { fddiMAC 141 }') a3ComFddiMACNotCopiedCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,5)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibMACNotCopiedCts"), ("FDDI-SMT73-MIB", "fddimibMACCopiedCts"), ("FDDI-SMT73-MIB", "fddimibMACNotCopiedRatio"), ("FDDI-SMT73-MIB", "fddimibMACNotCopiedFlag")) if mibBuilder.loadTexts: a3ComFddiMACNotCopiedCondition.setDescription('Generated when the fddiMACNotCopiedRatio (fddimibMACNotCopiedRatio) is greater than or equal to the fddiMACNotCopiedThreshold (a3ComFddiMACNotCopiedThreshold). This event is handled as a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACNotCopiedCondition.setReference('ANSI { fddiMAC 142 }') a3ComFddiMACNeighborChangeEvent = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,6)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibMACUpstreamNbr"), ("FDDI-SMT73-MIB", "fddimibMACOldUpstreamNbr"), ("FDDI-SMT73-MIB", "fddimibMACDownstreamNbr"), ("FDDI-SMT73-MIB", "fddimibMACOldDownstreamNbr"), ("FDDI-SMT73-MIB", "fddimibMACCurrentPath"), ("FDDI-SMT73-MIB", "fddimibMACSMTAddress")) if mibBuilder.loadTexts: a3ComFddiMACNeighborChangeEvent.setDescription("Generated when a change in a MAC's upstream neighbor address or downstream neighbor address is detected. (see 7.2.7 and 8.3).") if mibBuilder.loadTexts: a3ComFddiMACNeighborChangeEvent.setReference('ANSI { fddiMAC 143 }') a3ComFddiMACPathChangeEvent = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,7)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibMACAvailablePaths"), ("FDDI-SMT73-MIB", "fddimibMACCurrentPath"), ("FDDI-SMT73-MIB", "fddimibMACRequestedPaths")) if mibBuilder.loadTexts: a3ComFddiMACPathChangeEvent.setDescription('This event is generated when the value of the fddiMACCurrentPath (fddimibMACCurrentPath) changes. This event shall be supressed if the value changes from isolated to local or local to isolated (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACPathChangeEvent.setReference('ANSI { fddiMAC 144 }') a3ComFddiPORTLerCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,8)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibPORTLerCutoff"), ("FDDI-SMT73-MIB", "fddimibPORTLerAlarm"), ("FDDI-SMT73-MIB", "fddimibPORTLerEstimate"), ("FDDI-SMT73-MIB", "fddimibPORTLemRejectCts"), ("FDDI-SMT73-MIB", "fddimibPORTLemCts"), ("FDDI-SMT73-MIB", "fddimibPORTLerFlag")) if mibBuilder.loadTexts: a3ComFddiPORTLerCondition.setDescription('This condition becomes active when the value of fddiPORTLer-Estimate (fddimibPORTLerEstimate) is less than or equal to fddiPORTLer-Alarm (fddimibPORTLerAlarm). This will be reported with the Status Report Frames (SRF) (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiPORTLerCondition.setReference('ANSI { fddiPORT 80 }') a3ComFddiPORTUndesiredConnAttemptEvent = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,9)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibPORTMyType"), ("FDDI-SMT73-MIB", "fddimibPORTConnectState"), ("FDDI-SMT73-MIB", "fddimibPORTNeighborType"), ("FDDI-SMT73-MIB", "fddimibPORTPCWithhold")) if mibBuilder.loadTexts: a3ComFddiPORTUndesiredConnAttemptEvent.setDescription('Generated when an undesired connection attempt has been made (see 5.2.4, 7.2.7, and 8.3).') if mibBuilder.loadTexts: a3ComFddiPORTUndesiredConnAttemptEvent.setReference('ANSI { fddiPORT 81 }') a3ComFddiPORTEBErrorCondition = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,10)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("A3COM-SWITCHING-SYSTEMS-FDDI-MIB", "a3ComFddiPORTEBErrorCt")) if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCondition.setDescription("Generated when the Elasticity Buffer Error-Ct (a3ComFddiPORTEBErrorCt) increments. This is handled as a condition in the Status Report Protocol. It is generated when an increment occurs in the station's sampling period (see 7.2.7 and 8.3).") if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCondition.setReference('ANSI { fddiPORT 82 }') a3ComFddiPORTPathChangeEvent = NotificationType((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0,11)).setObjects(("FDDI-SMT73-MIB", "fddimibSMTStationId"), ("FDDI-SMT73-MIB", "fddimibPORTAvailablePaths"), ("FDDI-SMT73-MIB", "fddimibPORTCurrentPath"), ("FDDI-SMT73-MIB", "fddimibPORTRequestedPaths"), ("FDDI-SMT73-MIB", "fddimibPORTMyType"), ("FDDI-SMT73-MIB", "fddimibPORTNeighborType")) if mibBuilder.loadTexts: a3ComFddiPORTPathChangeEvent.setDescription('This event is generated when the value of the fddiPORTCurrentPath (a3ComFddiPORTCurrentPath) changes. This event shall be surpressed if the value changes from isolated to local or local to isolated (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiPORTPathChangeEvent.setReference('ANSI { fddiPORT 83 }') mibBuilder.exportSymbols("A3COM-SWITCHING-SYSTEMS-FDDI-MIB", a3ComFddiPORT=a3ComFddiPORT, a3ComFddiPORTMaintLS=a3ComFddiPORTMaintLS, a3ComFddiPATHSbaTable=a3ComFddiPATHSbaTable, a3ComFddiSMT=a3ComFddiSMT, a3ComFddiPATHRingEntry=a3ComFddiPATHRingEntry, a3ComFddiPATHSbaPATHIndex=a3ComFddiPATHSbaPATHIndex, a3ComFddiPORTEntry=a3ComFddiPORTEntry, a3ComFddiMACDuplicateAddressCondition=a3ComFddiMACDuplicateAddressCondition, a3ComFddiMACPathChangeEvent=a3ComFddiMACPathChangeEvent, a3ComFddiPORTPCLS=a3ComFddiPORTPCLS, a3ComFddiSMTIndex=a3ComFddiSMTIndex, a3ComFddiMACTPri6=a3ComFddiMACTPri6, a3ComFddiPORTLSTable=a3ComFddiPORTLSTable, a3ComFddiMACBridgeFunctionSMTIndex=a3ComFddiMACBridgeFunctionSMTIndex, a3ComFddiPATHSbaOverhead=a3ComFddiPATHSbaOverhead, a3ComFddiPORTEBErrorCt=a3ComFddiPORTEBErrorCt, a3ComFddiSMTTable=a3ComFddiSMTTable, a3ComFddiPORTMACLoopTime=a3ComFddiPORTMACLoopTime, a3Com=a3Com, a3ComFddiSMTEntry=a3ComFddiSMTEntry, a3ComFddiSMTManufacturerOUI=a3ComFddiSMTManufacturerOUI, a3ComFddiMACTPriEntry=a3ComFddiMACTPriEntry, a3ComFddiMACTPri4=a3ComFddiMACTPri4, a3ComFddiPATHRingPATHIndex=a3ComFddiPATHRingPATHIndex, a3ComFddiPORTIndex=a3ComFddiPORTIndex, a3ComFddiPATHTraceStatus=a3ComFddiPATHTraceStatus, a3ComFddiMACNeighborChangeEvent=a3ComFddiMACNeighborChangeEvent, a3ComFddiPATHRingTable=a3ComFddiPATHRingTable, a3ComFddiSMTHoldCondition=a3ComFddiSMTHoldCondition, a3ComFddiMACNotCopiedCondition=a3ComFddiMACNotCopiedCondition, a3ComFddiSMTManufacturerData=a3ComFddiSMTManufacturerData, a3ComFddiPATHRingSMTIndex=a3ComFddiPATHRingSMTIndex, a3ComFddiPATHSbaAvailable=a3ComFddiPATHSbaAvailable, a3ComFddiMACBridgeFunctionEntry=a3ComFddiMACBridgeFunctionEntry, a3ComFddiPORTSMTIndex=a3ComFddiPORTSMTIndex, a3ComFddiMACTPri1=a3ComFddiMACTPri1, a3ComFddiPATHT_Rmode=a3ComFddiPATHT_Rmode, a3ComFddiPATHSbaSMTIndex=a3ComFddiPATHSbaSMTIndex, a3ComFddiMACBridgeFunctionMACIndex=a3ComFddiMACBridgeFunctionMACIndex, a3ComFddiPATH=a3ComFddiPATH, a3ComFddiMACTPri5=a3ComFddiMACTPri5, a3ComFddiPATHSbaPayload=a3ComFddiPATHSbaPayload, a3ComFddiSMTHoldState=a3ComFddiSMTHoldState, a3ComFddiPORTTable=a3ComFddiPORTTable, a3ComFddiSMTLastSetStationId=a3ComFddiSMTLastSetStationId, a3ComFddiMACBridgeFunctions=a3ComFddiMACBridgeFunctions, a3ComFddiMACTPriTable=a3ComFddiMACTPriTable, a3ComFddiSMTPeerWrapCondition=a3ComFddiSMTPeerWrapCondition, a3ComFddiPORTLSSMTIndex=a3ComFddiPORTLSSMTIndex, a3ComFddiPORTLSPORTIndex=a3ComFddiPORTLSPORTIndex, a3ComFddiPORTEBErrorCondition=a3ComFddiPORTEBErrorCondition, a3ComFddiMAC=a3ComFddiMAC, a3ComSwitchingSystemsFddiMib=a3ComSwitchingSystemsFddiMib, a3ComFddiMACFrameErrorCondition=a3ComFddiMACFrameErrorCondition, a3ComFddiPORTUndesiredConnAttemptEvent=a3ComFddiPORTUndesiredConnAttemptEvent, a3ComFddiMACTPri3=a3ComFddiMACTPri3, a3ComFddiSMTSetCount=a3ComFddiSMTSetCount, a3ComFddiMACTPriSMTIndex=a3ComFddiMACTPriSMTIndex, a3ComFddiMACTPri2=a3ComFddiMACTPri2, a3ComFddiPORTLSEntry=a3ComFddiPORTLSEntry, switchingSystemsMibs=switchingSystemsMibs, a3ComFddiPORTPathChangeEvent=a3ComFddiPORTPathChangeEvent, a3ComFddiPATHRingLatency=a3ComFddiPATHRingLatency, a3ComFddiMACBridgeFunctionTable=a3ComFddiMACBridgeFunctionTable, a3ComFddiPATHSbaEntry=a3ComFddiPATHSbaEntry, a3ComFddiPORTLerCondition=a3ComFddiPORTLerCondition, a3ComFddiMACTPri0=a3ComFddiMACTPri0, a3ComFddiMACTPriMACIndex=a3ComFddiMACTPriMACIndex)
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, constraints_intersection, value_size_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsUnion', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ValueSizeConstraint', 'SingleValueConstraint') (fddimib_port_ler_flag, fddimib_port_my_type, fddimib_mac_copied_cts, fddimib_port_ler_estimate, fddimib_mac_not_copied_ratio, fddimib_port_lem_reject_cts, fddimib_mac_una_da_flag, fddimib_mac_lost_cts, fddimib_port_available_paths, fddimib_smtcf_state, fddimib_smt_station_id, fddimib_port_requested_paths, fddimib_mac_old_upstream_nbr, fddimib_mac_requested_paths, fddi_time_nano, fddimib_mac_current_path, fddimib_port_ler_alarm, fddimib_port_connect_state, fddimib_mac_available_paths, fddimib_smt_peer_wrap_flag, fddimib_mac_upstream_nbr, fddimib_macsmt_address, fddimib_port_current_path, fddimib_mac_not_copied_cts, fddimib_mac_downstream_nbr, fddimib_portpc_withhold, fddimib_mac_frame_error_flag, fddimib_mac_old_downstream_nbr, fddimib_mac_frame_cts, fddimib_mac_frame_error_ratio, fddimib_mac_da_flag, fddimib_mac_not_copied_flag, fddimib_port_neighbor_type, fddimib_mac_error_cts, fddimib_port_ler_cutoff, fddimib_port_lem_cts, fddi_smt_station_id_type) = mibBuilder.importSymbols('FDDI-SMT73-MIB', 'fddimibPORTLerFlag', 'fddimibPORTMyType', 'fddimibMACCopiedCts', 'fddimibPORTLerEstimate', 'fddimibMACNotCopiedRatio', 'fddimibPORTLemRejectCts', 'fddimibMACUnaDaFlag', 'fddimibMACLostCts', 'fddimibPORTAvailablePaths', 'fddimibSMTCFState', 'fddimibSMTStationId', 'fddimibPORTRequestedPaths', 'fddimibMACOldUpstreamNbr', 'fddimibMACRequestedPaths', 'FddiTimeNano', 'fddimibMACCurrentPath', 'fddimibPORTLerAlarm', 'fddimibPORTConnectState', 'fddimibMACAvailablePaths', 'fddimibSMTPeerWrapFlag', 'fddimibMACUpstreamNbr', 'fddimibMACSMTAddress', 'fddimibPORTCurrentPath', 'fddimibMACNotCopiedCts', 'fddimibMACDownstreamNbr', 'fddimibPORTPCWithhold', 'fddimibMACFrameErrorFlag', 'fddimibMACOldDownstreamNbr', 'fddimibMACFrameCts', 'fddimibMACFrameErrorRatio', 'fddimibMACDaFlag', 'fddimibMACNotCopiedFlag', 'fddimibPORTNeighborType', 'fddimibMACErrorCts', 'fddimibPORTLerCutoff', 'fddimibPORTLemCts', 'FddiSMTStationIdType') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, counter64, mib_identifier, iso, bits, gauge32, object_identity, unsigned32, enterprises, counter32, time_ticks, ip_address, notification_type, module_identity, integer32) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'Counter64', 'MibIdentifier', 'iso', 'Bits', 'Gauge32', 'ObjectIdentity', 'Unsigned32', 'enterprises', 'Counter32', 'TimeTicks', 'IpAddress', 'NotificationType', 'ModuleIdentity', 'Integer32') (textual_convention, display_string) = mibBuilder.importSymbols('SNMPv2-TC', 'TextualConvention', 'DisplayString') a3_com = mib_identifier((1, 3, 6, 1, 4, 1, 43)) switching_systems_mibs = mib_identifier((1, 3, 6, 1, 4, 1, 43, 29)) a3_com_switching_systems_fddi_mib = mib_identifier((1, 3, 6, 1, 4, 1, 43, 29, 10)) a3_com_fddi_smt = mib_identifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 1)) a3_com_fddi_mac = mib_identifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 2)) a3_com_fddi_path = mib_identifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 3)) a3_com_fddi_port = mib_identifier((1, 3, 6, 1, 4, 1, 43, 29, 10, 4)) a3_com_fddi_smt_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1)) if mibBuilder.loadTexts: a3ComFddiSMTTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTTable.setDescription('A list of optional SMT entries. The number of entries shall not exceed the value of snmpFddiSMTNumber.') a3_com_fddi_smt_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiSMTIndex')) if mibBuilder.loadTexts: a3ComFddiSMTEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTEntry.setDescription('An optional SMT entry containing information common to a given optional SMT.') a3_com_fddi_smt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_smt_manufacturer_oui = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(3, 3)).setFixedLength(3)).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerOUI.setReference('ANSI { fddiSMT 16 }') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerOUI.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerOUI.setDescription('The three octets of manufacturer data which make up the manufacturerOUI component.') a3_com_fddi_smt_manufacturer_data = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(29, 29)).setFixedLength(29)).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerData.setReference('ANSI { fddiSMT 16 }') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerData.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTManufacturerData.setDescription('The 29 octets of manufacturer data which make up the manufacturerData component.') a3_com_fddi_smt_hold_state = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('not-implemented', 1), ('not-holding', 2), ('holding-prm', 3), ('holding-sec', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiSMTHoldState.setReference('ANSI { fddiSMT 43 }') if mibBuilder.loadTexts: a3ComFddiSMTHoldState.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTHoldState.setDescription("This variable indicates the current state of the Hold function. The value 'not-holding' is the default and initial value. The value must be set to 'not-holding' as part of Active-Actions and when the conditions causing 'holding-prm' or 'holding-sec' are no longer true. The value 'holding-prm' must be set when the condition (notTR-Flag & not RE-Flag & (PC-LS=QLS | LEM-Fail TNE>NS-Max | (not LS-Flag & TPC > T-Out))) is satisfied in state PC8:ACTIVE for the A Port. The value 'holding-sec' must be set when the condition (notTR-Flag & not RE-Flag & (PC-LS=QLS | LEM-Fail TNE>NS-Max | (not LS-Flag & TPC > T-Out))) is satisfied in state PC8:ACTIVE for the B Port.") a3_com_fddi_smt_set_count = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiSMTSetCount.setReference('ANSI { fddiSMT 53 }') if mibBuilder.loadTexts: a3ComFddiSMTSetCount.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTSetCount.setDescription('This variable is composed of a count incremented in response to a Set operation on the MIB, and the time of the change, however only the count is reported here (refer to ANSI SMT 8.4.1).') a3_com_fddi_smt_last_set_station_id = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 1, 1, 1, 6), fddi_smt_station_id_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiSMTLastSetStationId.setReference('ANSI { fddiSMT 54 }') if mibBuilder.loadTexts: a3ComFddiSMTLastSetStationId.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiSMTLastSetStationId.setDescription('The Station ID of the station that effected the last change in the FDDI MIB.') a3_com_fddi_mac_bridge_function_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1)) if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionTable.setDescription('A list of MAC bridge function entries.') a3_com_fddi_mac_bridge_function_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiMACBridgeFunctionSMTIndex'), (0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiMACBridgeFunctionMACIndex')) if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionEntry.setDescription('Bridge function information for a given MAC within a given SMT.') a3_com_fddi_mac_bridge_function_smt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_mac_bridge_function_mac_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionMACIndex.setReference('ANSI { fddiMAC 34 }') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionMACIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctionMACIndex.setDescription('Index variable for uniquely identifying the MAC object instances.') a3_com_fddi_mac_bridge_functions = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 1, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(-1, 7))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctions.setReference('ANSI { fddiMAC 12 }') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctions.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACBridgeFunctions.setDescription("Indicates the MAC's optional bridging functions. The Value -1 is used to indicate that bridging is not supported by this MAC. The value is a sum. This value initially takes the value zero, then for each function present, 2 raised to a power is added to the sum. The powers are according to the following table: Function Power tb 0 -- Transparent bridging active sr 1 -- Src routing active srt 2 -- Src routing transparent active ") a3_com_fddi_mact_pri_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2)) if mibBuilder.loadTexts: a3ComFddiMACTPriTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriTable.setDescription('A list of MAC T-Pri entries.') a3_com_fddi_mact_pri_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiMACTPriSMTIndex'), (0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiMACTPriMACIndex')) if mibBuilder.loadTexts: a3ComFddiMACTPriEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriEntry.setDescription('A collection of T-Pri information for a given MAC within a given SMT.') a3_com_fddi_mact_pri_smt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPriSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_mact_pri_mac_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPriMACIndex.setReference('ANSI { fddiMAC 34 }') if mibBuilder.loadTexts: a3ComFddiMACTPriMACIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPriMACIndex.setDescription('Index variable for uniquely identifying the MAC object instances.') a3_com_fddi_mact_pri0 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 3), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri0.setReference('ANSI { fddiMAC 56 }') if mibBuilder.loadTexts: a3ComFddiMACTPri0.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri0.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_mact_pri1 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 4), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri1.setReference('ANSI { fddiMAC 57 }') if mibBuilder.loadTexts: a3ComFddiMACTPri1.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri1.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_mact_pri2 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 5), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri2.setReference('ANSI { fddiMAC 58 }') if mibBuilder.loadTexts: a3ComFddiMACTPri2.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri2.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_mact_pri3 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 6), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri3.setReference('ANSI { fddiMAC 59 }') if mibBuilder.loadTexts: a3ComFddiMACTPri3.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri3.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_mact_pri4 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 7), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri4.setReference('ANSI { fddiMAC 60 }') if mibBuilder.loadTexts: a3ComFddiMACTPri4.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri4.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_mact_pri5 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 8), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri5.setReference('ANSI { fddiMAC 61 }') if mibBuilder.loadTexts: a3ComFddiMACTPri5.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri5.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_mact_pri6 = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 2, 2, 1, 9), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiMACTPri6.setReference('ANSI { fddiMAC 62 }') if mibBuilder.loadTexts: a3ComFddiMACTPri6.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiMACTPri6.setDescription('This attribute is an unsigned twos-complement T-pri threshold as described in the MAC standard converted to non-twos-complement form and reported in 1 ns units.') a3_com_fddi_path_ring_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1)) if mibBuilder.loadTexts: a3ComFddiPATHRingTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingTable.setDescription('A list of PATH ring entries.') a3_com_fddi_path_ring_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPATHRingSMTIndex'), (0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPATHRingPATHIndex')) if mibBuilder.loadTexts: a3ComFddiPATHRingEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingEntry.setDescription('Ring latency, trace status, and T-Rmode information for a given PATH within a given SMT.') a3_com_fddi_path_ring_smt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPATHRingSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_path_ring_path_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPATHRingPATHIndex.setReference('ANSI { fddiPATH 11 }') if mibBuilder.loadTexts: a3ComFddiPATHRingPATHIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingPATHIndex.setDescription('Index variable for uniquely identifying the primary, secondary and local PATH object instances. Local PATH object instances are represented with integer values 3 to 255.') a3_com_fddi_path_ring_latency = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 3), fddi_time_nano()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPATHRingLatency.setReference('ANSI { fddiPATH 13 }') if mibBuilder.loadTexts: a3ComFddiPATHRingLatency.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHRingLatency.setDescription('Gives the total accumulated latency of the ring associated with this path. May be measured directly by the station or calculated by a management station. Values of this object are reported in 1 ns units.') a3_com_fddi_path_trace_status = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 15))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPATHTraceStatus.setReference('ANSI { fddiPATH 14 }') if mibBuilder.loadTexts: a3ComFddiPATHTraceStatus.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHTraceStatus.setDescription('This attribute indicates the current trace status of the path. The value is a sum which represents all of the trace status information which applies. This value initially takes the value zero, then for each condition which applies, 2 raised to a power is added to the sum. the powers are according to the following table: TraceStatus Power traceinitiated 0 tracepropragated 1 traceterminated 2 tracetimeout 3') a3_com_fddi_patht__rmode = mib_scalar((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 1, 1, 5), fddi_time_nano()).setLabel('a3ComFddiPATHT-Rmode').setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPATHT_Rmode.setReference('ANSI { fddiPATH 19 }') if mibBuilder.loadTexts: a3ComFddiPATHT_Rmode.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHT_Rmode.setDescription('Used by RMT to limit the duration of restricted dialogs on a path. This object is reported in 1 ns units.') a3_com_fddi_path_sba_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2)) if mibBuilder.loadTexts: a3ComFddiPATHSbaTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaTable.setDescription('A list of PATH Sba entries.') a3_com_fddi_path_sba_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPATHSbaSMTIndex'), (0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPATHSbaPATHIndex')) if mibBuilder.loadTexts: a3ComFddiPATHSbaEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaEntry.setDescription('Sba information for a given PATH within a given SMT.') a3_com_fddi_path_sba_smt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPATHSbaSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_path_sba_path_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPATHSbaPATHIndex.setReference('ANSI { fddiPATH 11 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaPATHIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaPATHIndex.setDescription('Index variable for uniquely identifying the primary, secondary and local PATH object instances. Local PATH object instances are represented with integer values 3 to 255.') a3_com_fddi_path_sba_payload = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(0, 1562))).setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPATHSbaPayload.setReference('ANSI { fddiPATH 15 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaPayload.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaPayload.setDescription('The payload portion of the Synchronous Bandwidth Allocation for thi path. This value represents the maximum number of bytes of data allocated for transmission per 125 microseconds.') a3_com_fddi_path_sba_overhead = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 4), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPATHSbaOverhead.setReference('ANSI { fddiPATH 16 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaOverhead.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaOverhead.setDescription('The overhead portion of the Synchronous Bandwith Allocation for this path. This value repersents the maximum number of bytes overhead (token capture, frame header, etc.) used pre negotiated Target Token Rotation Time (T-neg).') a3_com_fddi_path_sba_available = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 3, 2, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 12500000))).setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPATHSbaAvailable.setReference('ANSI { fddiPATH 20 }') if mibBuilder.loadTexts: a3ComFddiPATHSbaAvailable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPATHSbaAvailable.setDescription('This value is the maximum Synchronous Bandwith available for a path in bytes per second.') a3_com_fddi_port_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1)) if mibBuilder.loadTexts: a3ComFddiPORTTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTTable.setDescription('A list of optional PORT entries.') a3_com_fddi_port_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPORTSMTIndex'), (0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPORTIndex')) if mibBuilder.loadTexts: a3ComFddiPORTEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTEntry.setDescription('MAC loop time and EB error count information for a given PORT within a given SMT.') a3_com_fddi_portsmt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPORTSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_port_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPORTIndex.setReference('ANSI { fddiPORT 29 }') if mibBuilder.loadTexts: a3ComFddiPORTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTIndex.setDescription('Index variable for uniquely identifying the PORT object instances.') a3_com_fddi_portmac_loop_time = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 3), fddi_time_nano()).setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPORTMACLoopTime.setReference('ANSI { fddiPORT 21 }') if mibBuilder.loadTexts: a3ComFddiPORTMACLoopTime.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTMACLoopTime.setDescription('This attribute controls the value used for T-Next(9) (see 9.4.4.2.3). This object is reported in 1 ns units.') a3_com_fddi_porteb_error_ct = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 1, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCt.setReference('ANSI { fddiPORT 41 }') if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCt.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCt.setDescription('A count that should as closely as possible match the times an Elasticity Buffer Error has occurred while in active line state.') a3_com_fddi_portls_table = mib_table((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2)) if mibBuilder.loadTexts: a3ComFddiPORTLSTable.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSTable.setDescription('A list of optional PORT line state entries.') a3_com_fddi_portls_entry = mib_table_row((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1)).setIndexNames((0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPORTLSSMTIndex'), (0, 'A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPORTLSPORTIndex')) if mibBuilder.loadTexts: a3ComFddiPORTLSEntry.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSEntry.setDescription('Maintenance line state and PC line state information for a given PORT within a given SMT.') a3_com_fddi_portlssmt_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPORTLSSMTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSSMTIndex.setDescription("A unique value for each SMT. Its value ranges between 1 and the value of snmpFddiSMTNumber. The value for each SMT must remain constant at least from one re-initialization of the entity's network management system to the next re-initialization.") a3_com_fddi_portlsport_index = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPORTLSPORTIndex.setReference('ANSI { fddiPORT 29 }') if mibBuilder.loadTexts: a3ComFddiPORTLSPORTIndex.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTLSPORTIndex.setDescription('Index variable for uniquely identifying the PORT object instances.') a3_com_fddi_port_maint_ls = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('quiet', 1), ('idle', 2), ('master', 3), ('halt', 4), ('receive-active', 5), ('receive-unknown', 6), ('receive-noise', 7)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: a3ComFddiPORTMaintLS.setReference('ANSI { fddiPORT 31 }') if mibBuilder.loadTexts: a3ComFddiPORTMaintLS.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTMaintLS.setDescription('The PORT Maintenance Line State specifies the line state (Maint-LS) to be transmitted when the PCM state machine for the port is in state PC9 Maint.') a3_com_fddi_portpcls = mib_table_column((1, 3, 6, 1, 4, 1, 43, 29, 10, 4, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7))).clone(namedValues=named_values(('quiet', 1), ('idle', 2), ('master', 3), ('halt', 4), ('receive-active', 5), ('receive-unknown', 6), ('receive-noise', 7)))).setMaxAccess('readonly') if mibBuilder.loadTexts: a3ComFddiPORTPCLS.setReference('ANSI { fddiPORT 34 }') if mibBuilder.loadTexts: a3ComFddiPORTPCLS.setStatus('mandatory') if mibBuilder.loadTexts: a3ComFddiPORTPCLS.setDescription('This attribute indicates the line state (PC-LS) received by the port.') a3_com_fddi_smt_hold_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 1)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiSMTHoldState')) if mibBuilder.loadTexts: a3ComFddiSMTHoldCondition.setDescription('Generated when fddiSMTHoldState (fddimibSMTHoldState) assumes the state holding-prm or holding-sec. This notification is a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiSMTHoldCondition.setReference('ANSI { fddiSMT 71 }') a3_com_fddi_smt_peer_wrap_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 2)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibSMTCFState'), ('FDDI-SMT73-MIB', 'fddimibSMTPeerWrapFlag')) if mibBuilder.loadTexts: a3ComFddiSMTPeerWrapCondition.setDescription('This condition is active when fddiSMTPeerWrapFlag (fddimibSMTPeerWrapFlag) is set. This notification is a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiSMTPeerWrapCondition.setReference('ANSI { fddiSMT 72 }') a3_com_fddi_mac_duplicate_address_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 3)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibMACSMTAddress'), ('FDDI-SMT73-MIB', 'fddimibMACUpstreamNbr'), ('FDDI-SMT73-MIB', 'fddimibMACDaFlag'), ('FDDI-SMT73-MIB', 'fddimibMACUnaDaFlag')) if mibBuilder.loadTexts: a3ComFddiMACDuplicateAddressCondition.setDescription('This condition is active when either fddiMACDA-Flag (fddimibMACDaFlag) or fddiMACUNDA-Flag (fddimibMACUnaDaFlag) is set. This event is handled as a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACDuplicateAddressCondition.setReference('ANSI { fddiMAC 140 }') a3_com_fddi_mac_frame_error_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 4)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibMACFrameErrorFlag'), ('FDDI-SMT73-MIB', 'fddimibMACFrameCts'), ('FDDI-SMT73-MIB', 'fddimibMACErrorCts'), ('FDDI-SMT73-MIB', 'fddimibMACLostCts'), ('FDDI-SMT73-MIB', 'fddimibMACFrameErrorRatio')) if mibBuilder.loadTexts: a3ComFddiMACFrameErrorCondition.setDescription('Generated when the fddiMACFrameErrorRatio (fddimibMACFrameErrorRatio) is greater than or equal to fddiMACFrameErrorThreshold (fddimibMACFrameErrorThreshold). This event is handled as a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACFrameErrorCondition.setReference('ANSI { fddiMAC 141 }') a3_com_fddi_mac_not_copied_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 5)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibMACNotCopiedCts'), ('FDDI-SMT73-MIB', 'fddimibMACCopiedCts'), ('FDDI-SMT73-MIB', 'fddimibMACNotCopiedRatio'), ('FDDI-SMT73-MIB', 'fddimibMACNotCopiedFlag')) if mibBuilder.loadTexts: a3ComFddiMACNotCopiedCondition.setDescription('Generated when the fddiMACNotCopiedRatio (fddimibMACNotCopiedRatio) is greater than or equal to the fddiMACNotCopiedThreshold (a3ComFddiMACNotCopiedThreshold). This event is handled as a Condition in the Status Report Protocol (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACNotCopiedCondition.setReference('ANSI { fddiMAC 142 }') a3_com_fddi_mac_neighbor_change_event = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 6)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibMACUpstreamNbr'), ('FDDI-SMT73-MIB', 'fddimibMACOldUpstreamNbr'), ('FDDI-SMT73-MIB', 'fddimibMACDownstreamNbr'), ('FDDI-SMT73-MIB', 'fddimibMACOldDownstreamNbr'), ('FDDI-SMT73-MIB', 'fddimibMACCurrentPath'), ('FDDI-SMT73-MIB', 'fddimibMACSMTAddress')) if mibBuilder.loadTexts: a3ComFddiMACNeighborChangeEvent.setDescription("Generated when a change in a MAC's upstream neighbor address or downstream neighbor address is detected. (see 7.2.7 and 8.3).") if mibBuilder.loadTexts: a3ComFddiMACNeighborChangeEvent.setReference('ANSI { fddiMAC 143 }') a3_com_fddi_mac_path_change_event = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 7)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibMACAvailablePaths'), ('FDDI-SMT73-MIB', 'fddimibMACCurrentPath'), ('FDDI-SMT73-MIB', 'fddimibMACRequestedPaths')) if mibBuilder.loadTexts: a3ComFddiMACPathChangeEvent.setDescription('This event is generated when the value of the fddiMACCurrentPath (fddimibMACCurrentPath) changes. This event shall be supressed if the value changes from isolated to local or local to isolated (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiMACPathChangeEvent.setReference('ANSI { fddiMAC 144 }') a3_com_fddi_port_ler_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 8)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibPORTLerCutoff'), ('FDDI-SMT73-MIB', 'fddimibPORTLerAlarm'), ('FDDI-SMT73-MIB', 'fddimibPORTLerEstimate'), ('FDDI-SMT73-MIB', 'fddimibPORTLemRejectCts'), ('FDDI-SMT73-MIB', 'fddimibPORTLemCts'), ('FDDI-SMT73-MIB', 'fddimibPORTLerFlag')) if mibBuilder.loadTexts: a3ComFddiPORTLerCondition.setDescription('This condition becomes active when the value of fddiPORTLer-Estimate (fddimibPORTLerEstimate) is less than or equal to fddiPORTLer-Alarm (fddimibPORTLerAlarm). This will be reported with the Status Report Frames (SRF) (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiPORTLerCondition.setReference('ANSI { fddiPORT 80 }') a3_com_fddi_port_undesired_conn_attempt_event = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 9)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibPORTMyType'), ('FDDI-SMT73-MIB', 'fddimibPORTConnectState'), ('FDDI-SMT73-MIB', 'fddimibPORTNeighborType'), ('FDDI-SMT73-MIB', 'fddimibPORTPCWithhold')) if mibBuilder.loadTexts: a3ComFddiPORTUndesiredConnAttemptEvent.setDescription('Generated when an undesired connection attempt has been made (see 5.2.4, 7.2.7, and 8.3).') if mibBuilder.loadTexts: a3ComFddiPORTUndesiredConnAttemptEvent.setReference('ANSI { fddiPORT 81 }') a3_com_fddi_porteb_error_condition = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 10)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('A3COM-SWITCHING-SYSTEMS-FDDI-MIB', 'a3ComFddiPORTEBErrorCt')) if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCondition.setDescription("Generated when the Elasticity Buffer Error-Ct (a3ComFddiPORTEBErrorCt) increments. This is handled as a condition in the Status Report Protocol. It is generated when an increment occurs in the station's sampling period (see 7.2.7 and 8.3).") if mibBuilder.loadTexts: a3ComFddiPORTEBErrorCondition.setReference('ANSI { fddiPORT 82 }') a3_com_fddi_port_path_change_event = notification_type((1, 3, 6, 1, 4, 1, 43, 29, 10) + (0, 11)).setObjects(('FDDI-SMT73-MIB', 'fddimibSMTStationId'), ('FDDI-SMT73-MIB', 'fddimibPORTAvailablePaths'), ('FDDI-SMT73-MIB', 'fddimibPORTCurrentPath'), ('FDDI-SMT73-MIB', 'fddimibPORTRequestedPaths'), ('FDDI-SMT73-MIB', 'fddimibPORTMyType'), ('FDDI-SMT73-MIB', 'fddimibPORTNeighborType')) if mibBuilder.loadTexts: a3ComFddiPORTPathChangeEvent.setDescription('This event is generated when the value of the fddiPORTCurrentPath (a3ComFddiPORTCurrentPath) changes. This event shall be surpressed if the value changes from isolated to local or local to isolated (see 7.2.7 and 8.3).') if mibBuilder.loadTexts: a3ComFddiPORTPathChangeEvent.setReference('ANSI { fddiPORT 83 }') mibBuilder.exportSymbols('A3COM-SWITCHING-SYSTEMS-FDDI-MIB', a3ComFddiPORT=a3ComFddiPORT, a3ComFddiPORTMaintLS=a3ComFddiPORTMaintLS, a3ComFddiPATHSbaTable=a3ComFddiPATHSbaTable, a3ComFddiSMT=a3ComFddiSMT, a3ComFddiPATHRingEntry=a3ComFddiPATHRingEntry, a3ComFddiPATHSbaPATHIndex=a3ComFddiPATHSbaPATHIndex, a3ComFddiPORTEntry=a3ComFddiPORTEntry, a3ComFddiMACDuplicateAddressCondition=a3ComFddiMACDuplicateAddressCondition, a3ComFddiMACPathChangeEvent=a3ComFddiMACPathChangeEvent, a3ComFddiPORTPCLS=a3ComFddiPORTPCLS, a3ComFddiSMTIndex=a3ComFddiSMTIndex, a3ComFddiMACTPri6=a3ComFddiMACTPri6, a3ComFddiPORTLSTable=a3ComFddiPORTLSTable, a3ComFddiMACBridgeFunctionSMTIndex=a3ComFddiMACBridgeFunctionSMTIndex, a3ComFddiPATHSbaOverhead=a3ComFddiPATHSbaOverhead, a3ComFddiPORTEBErrorCt=a3ComFddiPORTEBErrorCt, a3ComFddiSMTTable=a3ComFddiSMTTable, a3ComFddiPORTMACLoopTime=a3ComFddiPORTMACLoopTime, a3Com=a3Com, a3ComFddiSMTEntry=a3ComFddiSMTEntry, a3ComFddiSMTManufacturerOUI=a3ComFddiSMTManufacturerOUI, a3ComFddiMACTPriEntry=a3ComFddiMACTPriEntry, a3ComFddiMACTPri4=a3ComFddiMACTPri4, a3ComFddiPATHRingPATHIndex=a3ComFddiPATHRingPATHIndex, a3ComFddiPORTIndex=a3ComFddiPORTIndex, a3ComFddiPATHTraceStatus=a3ComFddiPATHTraceStatus, a3ComFddiMACNeighborChangeEvent=a3ComFddiMACNeighborChangeEvent, a3ComFddiPATHRingTable=a3ComFddiPATHRingTable, a3ComFddiSMTHoldCondition=a3ComFddiSMTHoldCondition, a3ComFddiMACNotCopiedCondition=a3ComFddiMACNotCopiedCondition, a3ComFddiSMTManufacturerData=a3ComFddiSMTManufacturerData, a3ComFddiPATHRingSMTIndex=a3ComFddiPATHRingSMTIndex, a3ComFddiPATHSbaAvailable=a3ComFddiPATHSbaAvailable, a3ComFddiMACBridgeFunctionEntry=a3ComFddiMACBridgeFunctionEntry, a3ComFddiPORTSMTIndex=a3ComFddiPORTSMTIndex, a3ComFddiMACTPri1=a3ComFddiMACTPri1, a3ComFddiPATHT_Rmode=a3ComFddiPATHT_Rmode, a3ComFddiPATHSbaSMTIndex=a3ComFddiPATHSbaSMTIndex, a3ComFddiMACBridgeFunctionMACIndex=a3ComFddiMACBridgeFunctionMACIndex, a3ComFddiPATH=a3ComFddiPATH, a3ComFddiMACTPri5=a3ComFddiMACTPri5, a3ComFddiPATHSbaPayload=a3ComFddiPATHSbaPayload, a3ComFddiSMTHoldState=a3ComFddiSMTHoldState, a3ComFddiPORTTable=a3ComFddiPORTTable, a3ComFddiSMTLastSetStationId=a3ComFddiSMTLastSetStationId, a3ComFddiMACBridgeFunctions=a3ComFddiMACBridgeFunctions, a3ComFddiMACTPriTable=a3ComFddiMACTPriTable, a3ComFddiSMTPeerWrapCondition=a3ComFddiSMTPeerWrapCondition, a3ComFddiPORTLSSMTIndex=a3ComFddiPORTLSSMTIndex, a3ComFddiPORTLSPORTIndex=a3ComFddiPORTLSPORTIndex, a3ComFddiPORTEBErrorCondition=a3ComFddiPORTEBErrorCondition, a3ComFddiMAC=a3ComFddiMAC, a3ComSwitchingSystemsFddiMib=a3ComSwitchingSystemsFddiMib, a3ComFddiMACFrameErrorCondition=a3ComFddiMACFrameErrorCondition, a3ComFddiPORTUndesiredConnAttemptEvent=a3ComFddiPORTUndesiredConnAttemptEvent, a3ComFddiMACTPri3=a3ComFddiMACTPri3, a3ComFddiSMTSetCount=a3ComFddiSMTSetCount, a3ComFddiMACTPriSMTIndex=a3ComFddiMACTPriSMTIndex, a3ComFddiMACTPri2=a3ComFddiMACTPri2, a3ComFddiPORTLSEntry=a3ComFddiPORTLSEntry, switchingSystemsMibs=switchingSystemsMibs, a3ComFddiPORTPathChangeEvent=a3ComFddiPORTPathChangeEvent, a3ComFddiPATHRingLatency=a3ComFddiPATHRingLatency, a3ComFddiMACBridgeFunctionTable=a3ComFddiMACBridgeFunctionTable, a3ComFddiPATHSbaEntry=a3ComFddiPATHSbaEntry, a3ComFddiPORTLerCondition=a3ComFddiPORTLerCondition, a3ComFddiMACTPri0=a3ComFddiMACTPri0, a3ComFddiMACTPriMACIndex=a3ComFddiMACTPriMACIndex)
# Huu Hung Nguyen # 12/07/2021 # Nguyen_HuuHung_freq_distribution.py # The program takes a numbers list and creates a frequency distribution table. # It then display the frequency distribution table. def get_max(data_list): ''' Take a data list and return its maximum data. ''' # Determine the number having in the data list n = len(data_list) # Check whether the data list is empty if n == 0: max_data = 0 else: # Initialize a maximum value max_data = data_list[0] for data in data_list[1:]: if data > max_data: max_data = data return max_data def get_min(data_list): ''' Take a data list and return its minimum data. ''' # Determine the number having in the data list n = len(data_list) # Check whether the data list is empty if n == 0: min_data = 0 else: # Initialize a minimum value min_data = data_list[0] for data in data_list[1:]: if data < min_data: min_data = data return min_data def display_counts(data_list, categories, min, max): ''' Take a data list, categories, min and max values Display counts. ''' # Determine the value between ranges category_size = (max - min) // categories # Determine the sorted data sorted_data = sorted(data_list) # Initialize a positionition, a counting, and a sum counting position = 0 count = 0 sum_count = 0 print('Frequency Distribution Table:') for data in sorted_data: # Check whether the data is out of the ranges if data < min or data > max: sorted_data.remove(data) else: again = True # Keep checking the data until it is in a range while again: # Determine the start and end of each range start = min + category_size * position end = start + category_size # Check whether the next end is out of the range if end + category_size > max: end = max + 1 # Check whether the data is in the range if data in range(start, end): # Add up 1 to the counting if the data is in the range count += 1 again = False else: # Display the range and its counting print(f'{start}-{end - 1}: {count}') # Calculate the sum counting sum_count += count # Determine the next position and the next counting position += 1 count = 0 # Display the last range and its counting print(f'{start}-{end - 1}: {len(sorted_data) - sum_count}') def main(): ''' Define main function. ''' # Prompt the user for a list of numbers separated by a comma input_prompt = 'Enter numbers separated by a comma: ' data_list = [int(number) for number in input(input_prompt).split(',')] # data_list = [35, 37, 19, 45, 49, 68, 95, 7, 5, 82, 84] # sorted_data = [5, 7, 19, 35, 37, 45, 49, 68, 82, 84, 95] # Display the ranges and its counting display_counts(data_list, 5, 0, 100) print('-----------') display_counts(data_list, 4, get_min(data_list), get_max(data_list)) # Call main fucntion main()
def get_max(data_list): """ Take a data list and return its maximum data. """ n = len(data_list) if n == 0: max_data = 0 else: max_data = data_list[0] for data in data_list[1:]: if data > max_data: max_data = data return max_data def get_min(data_list): """ Take a data list and return its minimum data. """ n = len(data_list) if n == 0: min_data = 0 else: min_data = data_list[0] for data in data_list[1:]: if data < min_data: min_data = data return min_data def display_counts(data_list, categories, min, max): """ Take a data list, categories, min and max values Display counts. """ category_size = (max - min) // categories sorted_data = sorted(data_list) position = 0 count = 0 sum_count = 0 print('Frequency Distribution Table:') for data in sorted_data: if data < min or data > max: sorted_data.remove(data) else: again = True while again: start = min + category_size * position end = start + category_size if end + category_size > max: end = max + 1 if data in range(start, end): count += 1 again = False else: print(f'{start}-{end - 1}: {count}') sum_count += count position += 1 count = 0 print(f'{start}-{end - 1}: {len(sorted_data) - sum_count}') def main(): """ Define main function. """ input_prompt = 'Enter numbers separated by a comma: ' data_list = [int(number) for number in input(input_prompt).split(',')] display_counts(data_list, 5, 0, 100) print('-----------') display_counts(data_list, 4, get_min(data_list), get_max(data_list)) main()
n = int(input()) data = list(map(int,input().split())) one , two , three = [] , [] , [] for i in range(len(data)): if data[i] == 1: one.append(i+1) elif data[i] == 2: two.append(i+1) else: three.append(i+1) teams = min(len(one),len(two),len(three)) print(teams) for i in range(teams): print(*[one[i],two[i],three[i]])
n = int(input()) data = list(map(int, input().split())) (one, two, three) = ([], [], []) for i in range(len(data)): if data[i] == 1: one.append(i + 1) elif data[i] == 2: two.append(i + 1) else: three.append(i + 1) teams = min(len(one), len(two), len(three)) print(teams) for i in range(teams): print(*[one[i], two[i], three[i]])
one_char = ["!", "#", "%", "&", "\\", "'", "(", ")", "*", "+", "-", ".", "/", ":", ";", "<", "=", ">", "?", "[", "]", "^", "{", "|", "}", "~", ","] # they must be ordered by length decreasing multi_char = ["...", "::", ">>=", "<<=", ">>>", "<<<", "===", "!=", "==", "===", "<=", ">=", "*=", "&&", "-=", "+=", "||", "--", "++", "|=", "&=", "%=", "/=", "^=", "::"] # it counts the number of slash before a specific position (used to check if " or ' are escaped or not) def count_slash(ss, position): count = 0; pos = position - 1 try: while ss[pos] == "\\": count += 1 pos -= 1 except: pass return count # given a line of code, it retrieves the start end the end position for each string def get_strings(code): start = list() end = list() start_string = False for i, c in enumerate(code): if c == "\"": num_slash = count_slash(code, i) if num_slash % 2 == 0 and start_string: end.append(i) start_string = False elif num_slash % 2 == 0: start.append(i) start_string = True return start, end # given a line of code, it retrieves the start end the end position for each char (e.g. 'c') def get_chars(code): start = list() end = list() start_string = False for i, c in enumerate(code): if c == "'": num_slash = count_slash(code, i) if num_slash % 2 == 0 and start_string: end.append(i) start_string = False elif num_slash % 2 == 0: start.append(i) start_string = True return start, end # tokenizer (given a line of code, it returns the list of tokens) def tokenize(code): mask = code.replace("<z>", "") s, e = get_strings(mask) dict_string = dict() dict_chars = dict() delay = 0 # replace each string with a placeholder for i, (a, b) in enumerate(zip(s, e)): dict_string[i] = mask[a:b + 1] mask = mask[:a + delay] + " ___STRING___" + str(i) + "__ " + mask[b + 1 + delay:] delay = len(" ___STRING___" + str(i) + "__ ") - (b + 1 - a) s, e = get_chars(mask) # replace each char with a placeholder for i, (a, b) in enumerate(zip(s, e)): dict_chars[i] = mask[a:b + 1] mask = mask[:a + delay] + " ___CHARS___" + str(i) + "__ " + mask[b + 1 + delay:] delay = len(" ___CHARS___" + str(i) + "__ ") - (b + 1 - a) # replace each char with multiple chars with a placeholder for i, c in enumerate(multi_char): mask = mask.replace(c, " " + "__ID__" + str(i) + "__ ") # add a space before and after each char for c in one_char: if c == ".": # it should be a number (0.09) index_ = [i for i, ltr in enumerate(mask) if ltr == c] # print(index_) for i in index_: try: if mask[i + 1].isnumeric(): continue else: mask = mask.replace(c, " " + c + " ") except: pass else: mask = mask.replace(c, " " + c + " ") # remove all multichars' placeholders for i, c in enumerate(multi_char): mask = mask.replace("__ID__" + str(i) + "__", c) # removing double spaces while " " in mask: mask = mask.replace(" ", " ") mask = mask.strip() # retrieving the list of tokens tokens = mask.split(" ") for t in tokens: try: if "___STRING___" in t: curr = t.replace("___STRING___", "").replace("__", "") t = dict_string[int(curr)] if "___CHARS___" in t: curr = t.replace("___CHARS___", "").replace("__", "") t = dict_chars[int(curr)] except: pass # if len(mask.split(" ")) != int(real_length[key]): # print(len(mask.split(" ")), real_length[temp[0]]) # print(code, mask, mask.split(" ")) return tokens
one_char = ['!', '#', '%', '&', '\\', "'", '(', ')', '*', '+', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '^', '{', '|', '}', '~', ','] multi_char = ['...', '::', '>>=', '<<=', '>>>', '<<<', '===', '!=', '==', '===', '<=', '>=', '*=', '&&', '-=', '+=', '||', '--', '++', '|=', '&=', '%=', '/=', '^=', '::'] def count_slash(ss, position): count = 0 pos = position - 1 try: while ss[pos] == '\\': count += 1 pos -= 1 except: pass return count def get_strings(code): start = list() end = list() start_string = False for (i, c) in enumerate(code): if c == '"': num_slash = count_slash(code, i) if num_slash % 2 == 0 and start_string: end.append(i) start_string = False elif num_slash % 2 == 0: start.append(i) start_string = True return (start, end) def get_chars(code): start = list() end = list() start_string = False for (i, c) in enumerate(code): if c == "'": num_slash = count_slash(code, i) if num_slash % 2 == 0 and start_string: end.append(i) start_string = False elif num_slash % 2 == 0: start.append(i) start_string = True return (start, end) def tokenize(code): mask = code.replace('<z>', '') (s, e) = get_strings(mask) dict_string = dict() dict_chars = dict() delay = 0 for (i, (a, b)) in enumerate(zip(s, e)): dict_string[i] = mask[a:b + 1] mask = mask[:a + delay] + ' ___STRING___' + str(i) + '__ ' + mask[b + 1 + delay:] delay = len(' ___STRING___' + str(i) + '__ ') - (b + 1 - a) (s, e) = get_chars(mask) for (i, (a, b)) in enumerate(zip(s, e)): dict_chars[i] = mask[a:b + 1] mask = mask[:a + delay] + ' ___CHARS___' + str(i) + '__ ' + mask[b + 1 + delay:] delay = len(' ___CHARS___' + str(i) + '__ ') - (b + 1 - a) for (i, c) in enumerate(multi_char): mask = mask.replace(c, ' ' + '__ID__' + str(i) + '__ ') for c in one_char: if c == '.': index_ = [i for (i, ltr) in enumerate(mask) if ltr == c] for i in index_: try: if mask[i + 1].isnumeric(): continue else: mask = mask.replace(c, ' ' + c + ' ') except: pass else: mask = mask.replace(c, ' ' + c + ' ') for (i, c) in enumerate(multi_char): mask = mask.replace('__ID__' + str(i) + '__', c) while ' ' in mask: mask = mask.replace(' ', ' ') mask = mask.strip() tokens = mask.split(' ') for t in tokens: try: if '___STRING___' in t: curr = t.replace('___STRING___', '').replace('__', '') t = dict_string[int(curr)] if '___CHARS___' in t: curr = t.replace('___CHARS___', '').replace('__', '') t = dict_chars[int(curr)] except: pass return tokens
class MachopCommand(object): def shutdown(self): pass def cleanup(self): pass
class Machopcommand(object): def shutdown(self): pass def cleanup(self): pass
INPUT_SCHEMA = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Deriva Demo Input", "description": ("Input schema for the demo DERIVA ingest Action Provider. This Action " "Provider can restore a DERIVA backup to a new or existing catalog, " "or create a new DERIVA catalog from a BDBag containing TableSchema."), "type": "object", "oneOf": [{ "properties": { "restore_url": { "type": "string", "format": "uri", "description": "The URL of the DERIVA restore data, for a restore operation." }, "restore_catalog": { "type": "string", "description": ("The DERIVA catalog to restore into. If a catalog is specified, " "the catalog must already exist for the restore to succeed.") } }, "required": [ "restore_url" ] }, { "properties": { "ingest_url": { "type": "string", "format": "uri", "description": ("The URL to the BDBag containing TableSchema to ingest " "into a new catalog.") }, "ingest_catalog_acls": { "type": "object", "description": ("The DERIVA permissions to apply to the new catalog. " "If no ACLs are provided here, default ones will be used."), "properties": { "owner": { "type": "array", "description": "Formatted UUIDs for 'owner' permissions.", "items": { "type": "string", "description": "One UUID" } }, "insert": { "type": "array", "description": "Formatted UUIDs for 'insert' permissions.", "items": { "type": "string", "description": "One UUID" } }, "update": { "type": "array", "description": "Formatted UUIDs for 'update' permissions.", "items": { "type": "string", "description": "One UUID" } }, "delete": { "type": "array", "description": "Formatted UUIDs for 'delete' permissions.", "items": { "type": "string", "description": "One UUID" } }, "select": { "type": "array", "description": "Formatted UUIDs for 'select' permissions.", "items": { "type": "string", "description": "One UUID" } }, "enumerate": { "type": "array", "description": "Formatted UUIDs for 'enumerate' permissions.", "items": { "type": "string", "description": "One UUID" } } } } }, "required": [ "ingest_url" ] }] } # TODO OUTPUT_SCHEMA = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Deriva Demo Output", "description": "Output schema for the demo Deriva ingest Action Provider.", "type": "object", "properties": { }, "required": [ ] }
input_schema = {'$schema': 'http://json-schema.org/draft-04/schema#', 'title': 'Deriva Demo Input', 'description': 'Input schema for the demo DERIVA ingest Action Provider. This Action Provider can restore a DERIVA backup to a new or existing catalog, or create a new DERIVA catalog from a BDBag containing TableSchema.', 'type': 'object', 'oneOf': [{'properties': {'restore_url': {'type': 'string', 'format': 'uri', 'description': 'The URL of the DERIVA restore data, for a restore operation.'}, 'restore_catalog': {'type': 'string', 'description': 'The DERIVA catalog to restore into. If a catalog is specified, the catalog must already exist for the restore to succeed.'}}, 'required': ['restore_url']}, {'properties': {'ingest_url': {'type': 'string', 'format': 'uri', 'description': 'The URL to the BDBag containing TableSchema to ingest into a new catalog.'}, 'ingest_catalog_acls': {'type': 'object', 'description': 'The DERIVA permissions to apply to the new catalog. If no ACLs are provided here, default ones will be used.', 'properties': {'owner': {'type': 'array', 'description': "Formatted UUIDs for 'owner' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'insert': {'type': 'array', 'description': "Formatted UUIDs for 'insert' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'update': {'type': 'array', 'description': "Formatted UUIDs for 'update' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'delete': {'type': 'array', 'description': "Formatted UUIDs for 'delete' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'select': {'type': 'array', 'description': "Formatted UUIDs for 'select' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}, 'enumerate': {'type': 'array', 'description': "Formatted UUIDs for 'enumerate' permissions.", 'items': {'type': 'string', 'description': 'One UUID'}}}}}, 'required': ['ingest_url']}]} output_schema = {'$schema': 'http://json-schema.org/draft-04/schema#', 'title': 'Deriva Demo Output', 'description': 'Output schema for the demo Deriva ingest Action Provider.', 'type': 'object', 'properties': {}, 'required': []}
class TestClassConverter: @classmethod def setup_class(cls): print("\nsetup_class: setup any state specific to the execution of the given class\n") @classmethod def teardown_class(cls): print("\nteardown_class: teardown any state that was previously setup with a call to setup_class.\n") def setup_method(self, method): print("\nsetup_method: setup_method is invoked for every test method of a class.\n") def teardown_method(self, method): print("\nteardown_method: teardown any state that was previously setup with a setup_method call.\n") def test_sanity(self): assert 1 == 1
class Testclassconverter: @classmethod def setup_class(cls): print('\nsetup_class: setup any state specific to the execution of the given class\n') @classmethod def teardown_class(cls): print('\nteardown_class: teardown any state that was previously setup with a call to setup_class.\n') def setup_method(self, method): print('\nsetup_method: setup_method is invoked for every test method of a class.\n') def teardown_method(self, method): print('\nteardown_method: teardown any state that was previously setup with a setup_method call.\n') def test_sanity(self): assert 1 == 1
# model settings norm_cfg = dict(type='GN', num_groups=32, requires_grad=True) model = dict( type='TDN', pretrained='modelzoo://resnet50', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style='pytorch'), neck=dict( type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=5), rpn_head=dict( type='RPNHead', in_channels=256, feat_channels=256, anchor_scales=[8], anchor_ratios=[0.5, 1.0, 2.0], anchor_strides=[4, 8, 16, 32, 64], target_means=[.0, .0, .0, .0], target_stds=[1.0, 1.0, 1.0, 1.0], loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)), bbox_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=256, featmap_strides=[4, 8, 16, 32]), bbox_head=dict( type='SharedFCBBoxHead', num_fcs=2, in_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=4, target_means=[0., 0., 0., 0.], target_stds=[0.1, 0.1, 0.2, 0.2], reg_class_agnostic=True, loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), prop_track_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=801, featmap_strides=[4, 8, 16, 32]), prop_track_head=dict( type='PropRegTrackHead', num_shared_convs=4, num_shared_fcs=1, in_channels=801, fc_out_channels=1024, num_classes=2, reg_class_agnostic=True, target_means=[.0, .0, .0, .0], target_stds=[0.1, 0.1, 0.2, 0.2], norm_cfg=norm_cfg, loss_cls=dict( type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), asso_track_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=256, featmap_strides=[4, 8, 16, 32]), asso_track_head=dict( type='AssoAppearTrackHead', num_convs=4, num_fcs=1, in_channels=256, roi_feat_size=7, fc_out_channels=1024, norm_cfg=norm_cfg, norm_similarity=False, loss_asso=dict( type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), freeze_exclude_tracker=False, corr_params=dict( patch_size=17, kernel_size=1, padding=0, stride=1, dilation_patch=1)) # model training and testing settings train_cfg = dict( rpn=dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.7, neg_iou_thr=0.3, min_pos_iou=0.3, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=256, pos_fraction=0.5, neg_pos_ub=-1, add_gt_as_proposals=False), allowed_border=0, pos_weight=-1, debug=False), rpn_proposal=dict( nms_across_levels=False, nms_pre=2000, nms_post=2000, max_num=2000, nms_thr=0.7, min_bbox_size=0), rcnn=dict( assigner=dict( type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0.5, ignore_iof_thr=-1), sampler=dict( type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), pos_weight=-1, debug=False), track=dict(asso_use_neg=False)) test_cfg = dict( rpn=dict( nms_across_levels=False, nms_pre=1000, nms_post=1000, max_num=1000, nms_thr=0.7, min_bbox_size=0), rcnn=dict( score_thr=0.05, nms=dict(type='nms', iou_thr=0.5), max_per_img=100), # soft-nms is also supported for rcnn testing # e.g., nms=dict(type='soft_nms', iou_thr=0.5, min_score=0.05) track=dict( new_obj_score_thre=0.8, clean_before_short_assign=False, clean_before_long_assign=True, prop_overlap_thre=0.6, prop_score_thre=0.6, use_reid=True, long_term_frames=15, asso_score_thre=0.6, embed_momentum=0.5, prop_fn=False, update_score=True, plot_track_results=False)) # dataset settings dataset_type = 'BDDVideo' data_root = 'data/BDD/BDD_Tracking/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) data = dict( imgs_per_gpu=2, workers_per_gpu=2, train=dict( type=dataset_type, ann_file=data_root + 'annotations/bdd_tracking_train_0918.json', img_prefix=data_root + 'images/train/', img_scale=(1296, 720), img_norm_cfg=img_norm_cfg, size_divisor=32, flip_ratio=0.5, with_mask=False, with_track=True, with_crowd=True, with_label=True, train_sample_interval=3), val=dict( type=dataset_type, ann_file=data_root + 'annotations/mini_val_0918.json', img_prefix=data_root + 'images/val/', img_scale=(1296, 720), img_norm_cfg=img_norm_cfg, size_divisor=32, flip_ratio=0, with_mask=False, with_crowd=True, with_label=True, with_track=True), test=dict( type=dataset_type, ann_file=data_root + 'annotations/bdd_tracking_val_0918.json', img_prefix=data_root + 'images/val/', img_scale=(1296, 720), img_norm_cfg=img_norm_cfg, size_divisor=32, flip_ratio=0, with_mask=False, with_label=False, test_mode=True, with_track=True)) # optimizer optimizer = dict( type='SGD', lr=0.0004, momentum=0.9, weight_decay=0.0001, track_enhance=10) optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) # learning policy lr_config = dict( policy='step', warmup='exp', warmup_iters=2000, warmup_ratio=1.0 / 10.0, step=[5, 7]) checkpoint_config = dict(interval=1) # yapf:disable log_config = dict( interval=20, hooks=[ dict(type='TextLoggerHook'), # dict(type='TensorboardLoggerHook') ]) # yapf:enable # runtime settings total_epochs = 8 dist_params = dict(backend='nccl') log_level = 'INFO' load_from = 'data/init_models/frcnn_r50_bdd100k_cls3_1x-65034c1b.pth' # load_from = 'data/init_models/tdn_lr10-b3211c74.pth' work_dir = './work_dirs/debug/' resume_from = None workflow = [('train', 1)]
norm_cfg = dict(type='GN', num_groups=32, requires_grad=True) model = dict(type='TDN', pretrained='modelzoo://resnet50', backbone=dict(type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, style='pytorch'), neck=dict(type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=5), rpn_head=dict(type='RPNHead', in_channels=256, feat_channels=256, anchor_scales=[8], anchor_ratios=[0.5, 1.0, 2.0], anchor_strides=[4, 8, 16, 32, 64], target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[1.0, 1.0, 1.0, 1.0], loss_cls=dict(type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)), bbox_roi_extractor=dict(type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=256, featmap_strides=[4, 8, 16, 32]), bbox_head=dict(type='SharedFCBBoxHead', num_fcs=2, in_channels=256, fc_out_channels=1024, roi_feat_size=7, num_classes=4, target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[0.1, 0.1, 0.2, 0.2], reg_class_agnostic=True, loss_cls=dict(type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), prop_track_roi_extractor=dict(type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=801, featmap_strides=[4, 8, 16, 32]), prop_track_head=dict(type='PropRegTrackHead', num_shared_convs=4, num_shared_fcs=1, in_channels=801, fc_out_channels=1024, num_classes=2, reg_class_agnostic=True, target_means=[0.0, 0.0, 0.0, 0.0], target_stds=[0.1, 0.1, 0.2, 0.2], norm_cfg=norm_cfg, loss_cls=dict(type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)), asso_track_roi_extractor=dict(type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', out_size=7, sample_num=2), out_channels=256, featmap_strides=[4, 8, 16, 32]), asso_track_head=dict(type='AssoAppearTrackHead', num_convs=4, num_fcs=1, in_channels=256, roi_feat_size=7, fc_out_channels=1024, norm_cfg=norm_cfg, norm_similarity=False, loss_asso=dict(type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0)), freeze_exclude_tracker=False, corr_params=dict(patch_size=17, kernel_size=1, padding=0, stride=1, dilation_patch=1)) train_cfg = dict(rpn=dict(assigner=dict(type='MaxIoUAssigner', pos_iou_thr=0.7, neg_iou_thr=0.3, min_pos_iou=0.3, ignore_iof_thr=-1), sampler=dict(type='RandomSampler', num=256, pos_fraction=0.5, neg_pos_ub=-1, add_gt_as_proposals=False), allowed_border=0, pos_weight=-1, debug=False), rpn_proposal=dict(nms_across_levels=False, nms_pre=2000, nms_post=2000, max_num=2000, nms_thr=0.7, min_bbox_size=0), rcnn=dict(assigner=dict(type='MaxIoUAssigner', pos_iou_thr=0.5, neg_iou_thr=0.5, min_pos_iou=0.5, ignore_iof_thr=-1), sampler=dict(type='RandomSampler', num=512, pos_fraction=0.25, neg_pos_ub=-1, add_gt_as_proposals=True), pos_weight=-1, debug=False), track=dict(asso_use_neg=False)) test_cfg = dict(rpn=dict(nms_across_levels=False, nms_pre=1000, nms_post=1000, max_num=1000, nms_thr=0.7, min_bbox_size=0), rcnn=dict(score_thr=0.05, nms=dict(type='nms', iou_thr=0.5), max_per_img=100), track=dict(new_obj_score_thre=0.8, clean_before_short_assign=False, clean_before_long_assign=True, prop_overlap_thre=0.6, prop_score_thre=0.6, use_reid=True, long_term_frames=15, asso_score_thre=0.6, embed_momentum=0.5, prop_fn=False, update_score=True, plot_track_results=False)) dataset_type = 'BDDVideo' data_root = 'data/BDD/BDD_Tracking/' img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) data = dict(imgs_per_gpu=2, workers_per_gpu=2, train=dict(type=dataset_type, ann_file=data_root + 'annotations/bdd_tracking_train_0918.json', img_prefix=data_root + 'images/train/', img_scale=(1296, 720), img_norm_cfg=img_norm_cfg, size_divisor=32, flip_ratio=0.5, with_mask=False, with_track=True, with_crowd=True, with_label=True, train_sample_interval=3), val=dict(type=dataset_type, ann_file=data_root + 'annotations/mini_val_0918.json', img_prefix=data_root + 'images/val/', img_scale=(1296, 720), img_norm_cfg=img_norm_cfg, size_divisor=32, flip_ratio=0, with_mask=False, with_crowd=True, with_label=True, with_track=True), test=dict(type=dataset_type, ann_file=data_root + 'annotations/bdd_tracking_val_0918.json', img_prefix=data_root + 'images/val/', img_scale=(1296, 720), img_norm_cfg=img_norm_cfg, size_divisor=32, flip_ratio=0, with_mask=False, with_label=False, test_mode=True, with_track=True)) optimizer = dict(type='SGD', lr=0.0004, momentum=0.9, weight_decay=0.0001, track_enhance=10) optimizer_config = dict(grad_clip=dict(max_norm=35, norm_type=2)) lr_config = dict(policy='step', warmup='exp', warmup_iters=2000, warmup_ratio=1.0 / 10.0, step=[5, 7]) checkpoint_config = dict(interval=1) log_config = dict(interval=20, hooks=[dict(type='TextLoggerHook')]) total_epochs = 8 dist_params = dict(backend='nccl') log_level = 'INFO' load_from = 'data/init_models/frcnn_r50_bdd100k_cls3_1x-65034c1b.pth' work_dir = './work_dirs/debug/' resume_from = None workflow = [('train', 1)]
# convert a decimal number to bukiyip. def decimal_to_bukiyip(a): bukiyip = '' quotient = 2000000 while quotient > 0: quotient = a // 3 remainder = a % 3 bukiyip += str(remainder) a = quotient return bukiyip[::-1] # convert a bukiyip number to decimal def bukiyip_to_decimal(a): decimal = 0 string_a = str(a) power = 0 for i in string_a[::-1]: decimal += int(i) * pow(3, power) power += 1 return int(decimal) # add two Bukiyip numbers. def bukiyip_add(a, b): return decimal_to_bukiyip(bukiyip_to_decimal(a) + bukiyip_to_decimal(b)) # multiply two Bukiyip numbers. def bukiyip_multiply(a, b): return decimal_to_bukiyip(bukiyip_to_decimal(a) * bukiyip_to_decimal(b))
def decimal_to_bukiyip(a): bukiyip = '' quotient = 2000000 while quotient > 0: quotient = a // 3 remainder = a % 3 bukiyip += str(remainder) a = quotient return bukiyip[::-1] def bukiyip_to_decimal(a): decimal = 0 string_a = str(a) power = 0 for i in string_a[::-1]: decimal += int(i) * pow(3, power) power += 1 return int(decimal) def bukiyip_add(a, b): return decimal_to_bukiyip(bukiyip_to_decimal(a) + bukiyip_to_decimal(b)) def bukiyip_multiply(a, b): return decimal_to_bukiyip(bukiyip_to_decimal(a) * bukiyip_to_decimal(b))
expected_output = { 'type': { 'IP route': { 'address': '10.21.12.0', 'mask': '255.255.255.0', 'state': 'Down', 'state_description': 'no ip route', 'delayed': { 'delayed_state': 'Up', 'secs_remaining': 1.0, 'connection_state': 'connected', }, 'change_count': 1, 'last_change': '00:00:24', } }, 'delay_up_secs': 20.0, 'delay_down_secs': 10.0, 'first_hop_interface_state': 'unknown', 'prev_first_hop_interface': 'Ethernet1/0', 'tracked_by': { 1: { 'name': 'HSRP', 'interface': 'Ethernet0/0', 'group_id': '3' }, 2: { 'name': 'HSRP', 'interface': 'Ethernet0/1', 'group_id': '3' } } }
expected_output = {'type': {'IP route': {'address': '10.21.12.0', 'mask': '255.255.255.0', 'state': 'Down', 'state_description': 'no ip route', 'delayed': {'delayed_state': 'Up', 'secs_remaining': 1.0, 'connection_state': 'connected'}, 'change_count': 1, 'last_change': '00:00:24'}}, 'delay_up_secs': 20.0, 'delay_down_secs': 10.0, 'first_hop_interface_state': 'unknown', 'prev_first_hop_interface': 'Ethernet1/0', 'tracked_by': {1: {'name': 'HSRP', 'interface': 'Ethernet0/0', 'group_id': '3'}, 2: {'name': 'HSRP', 'interface': 'Ethernet0/1', 'group_id': '3'}}}
# Open terminal > python3 condition.py # Start typing below commands and see the output x = int(input('Please enter an integer: ')) if x < 0: print(str(x) + ' is a negative number') elif x == 0: print(str(x) + ' is zero') else: print(str(x) + ' is a positive number')
x = int(input('Please enter an integer: ')) if x < 0: print(str(x) + ' is a negative number') elif x == 0: print(str(x) + ' is zero') else: print(str(x) + ' is a positive number')
name0_0_1_1_0_0_0 = None name0_0_1_1_0_0_1 = None name0_0_1_1_0_0_2 = None name0_0_1_1_0_0_3 = None name0_0_1_1_0_0_4 = None
name0_0_1_1_0_0_0 = None name0_0_1_1_0_0_1 = None name0_0_1_1_0_0_2 = None name0_0_1_1_0_0_3 = None name0_0_1_1_0_0_4 = None
if float(input()) < 16 : print('Master' if input() == 'm' else 'Miss') else: print('Mr.' if input() == 'm' else 'Ms.')
if float(input()) < 16: print('Master' if input() == 'm' else 'Miss') else: print('Mr.' if input() == 'm' else 'Ms.')
fruit = {"orange":"a sweet, orange, citrus fruit", "apple": " good for making cider", "lemon":"a sour, yellow citrus fruit", "grape":"a small, sweet fruit growing in bunches", "lime": "a sour, green citrus fruit", "lime":"its yellow"} print(fruit) # .items will produce a dynamic view object that looks like tuples print(fruit.items()) f_tuple = tuple(fruit.items()) print(f_tuple) for snack in f_tuple: item, description = snack print(item + "-" + description) print("-"*80) #Python allows to construct dict out of tuples print(dict(f_tuple)) # strings are actually immutable objects and concatenating two strings in a for loop # might not be efficient
fruit = {'orange': 'a sweet, orange, citrus fruit', 'apple': ' good for making cider', 'lemon': 'a sour, yellow citrus fruit', 'grape': 'a small, sweet fruit growing in bunches', 'lime': 'a sour, green citrus fruit', 'lime': 'its yellow'} print(fruit) print(fruit.items()) f_tuple = tuple(fruit.items()) print(f_tuple) for snack in f_tuple: (item, description) = snack print(item + '-' + description) print('-' * 80) print(dict(f_tuple))
def isPalindrome(s): s = s.lower() holdit = "" for charac in s: if charac.isalpha(): holdit+=charac i=0 j=len(holdit)-1 while i<=j: if holdit[i]!=holdit[j]: return False i+=1 j-=1 return True s = "0P" print(isPalindrome(s))
def is_palindrome(s): s = s.lower() holdit = '' for charac in s: if charac.isalpha(): holdit += charac i = 0 j = len(holdit) - 1 while i <= j: if holdit[i] != holdit[j]: return False i += 1 j -= 1 return True s = '0P' print(is_palindrome(s))
############################################################################## # # Copyright (c) 2003-2020 by The University of Queensland # http://www.uq.edu.au # # Primary Business: Queensland, Australia # Licensed under the Apache License, version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # # Development until 2012 by Earth Systems Science Computational Center (ESSCC) # Development 2012-2013 by School of Earth Sciences # Development from 2014 by Centre for Geoscience Computing (GeoComp) # Development from 2019 by School of Earth and Environmental Sciences # ############################################################################## # This is a template configuration file for escript on Debian/GNU Linux. # Refer to README_FIRST for usage instructions. escript_opts_version = 203 openmp = True umfpack = True umfpack_prefix = ['/usr/include/suitesparse', '/usr/lib'] umfpack_libs = ['umfpack', 'blas', 'amd'] pythoncmd="/usr/bin/python3" pythonlibname = 'python3.8' pythonlibpath = '/usr/lib/x86_64-linux-gnu/' pythonincpath = '/usr/include/python3.8' boost_python='boost_python38'
escript_opts_version = 203 openmp = True umfpack = True umfpack_prefix = ['/usr/include/suitesparse', '/usr/lib'] umfpack_libs = ['umfpack', 'blas', 'amd'] pythoncmd = '/usr/bin/python3' pythonlibname = 'python3.8' pythonlibpath = '/usr/lib/x86_64-linux-gnu/' pythonincpath = '/usr/include/python3.8' boost_python = 'boost_python38'
def trace_get_attributes(cls: type): class Wrapper: def __init__(self, *args, **kwargs): self.wrapped = cls(*args, **kwargs) def __getattr__(self, item): result = getattr(self.wrapped, item) print(f"-- getting attribute '{item}' = {result}") return result return Wrapper
def trace_get_attributes(cls: type): class Wrapper: def __init__(self, *args, **kwargs): self.wrapped = cls(*args, **kwargs) def __getattr__(self, item): result = getattr(self.wrapped, item) print(f"-- getting attribute '{item}' = {result}") return result return Wrapper
class Controller: def __init__(self, cfg): self.internal = 0 # self.update_period = cfg.policy.params.period self.last_action = None def reset(self): raise NotImplementedError("Subclass must implement this function") def get_action(self, state): raise NotImplementedError("Subclass must implement this function")
class Controller: def __init__(self, cfg): self.internal = 0 self.last_action = None def reset(self): raise not_implemented_error('Subclass must implement this function') def get_action(self, state): raise not_implemented_error('Subclass must implement this function')
#!usr/bin/python # -*- coding:utf8 -*- class Cat(object): def say(self): print("I am a cat") class Dog(object): def say(self): print("I am a dog") def __getitem__(self, item): return "bobby" class Duck(object): def say(self): print("I am a duck") # animal = Cat # animal().say() animal_list = [Cat, Dog, Duck] for animal in animal_list: animal().say() dog = Dog() a = ["bobby1", "bobby2"] b = ["bobby2", "bobby"] name_tuple = ["bobby3", "bobby4"] name_set = set() name_set.add("bobby5") name_set.add("bobby6") a.extend(dog) # extend(self, iterable) print(a)
class Cat(object): def say(self): print('I am a cat') class Dog(object): def say(self): print('I am a dog') def __getitem__(self, item): return 'bobby' class Duck(object): def say(self): print('I am a duck') animal_list = [Cat, Dog, Duck] for animal in animal_list: animal().say() dog = dog() a = ['bobby1', 'bobby2'] b = ['bobby2', 'bobby'] name_tuple = ['bobby3', 'bobby4'] name_set = set() name_set.add('bobby5') name_set.add('bobby6') a.extend(dog) print(a)
# coding=utf-8 # /usr/bin/env python ''' Author: wenqiangw Email: wenqiangw@opera.com Date: 2020-07-30 11:05 Desc: '''
""" Author: wenqiangw Email: wenqiangw@opera.com Date: 2020-07-30 11:05 Desc: """
name = 'tinymce4' authors = 'Joost Cassee, Aljosa Mohorovic' version = '3.0.2' release = version
name = 'tinymce4' authors = 'Joost Cassee, Aljosa Mohorovic' version = '3.0.2' release = version
#!/usr/bin/python3 def solution(A): if not A: return 0 max_profit = 0 min_value = A[0] for a in A: max_profit = max(max_profit, a - min_value) min_value = min(min_value, a) return max_profit
def solution(A): if not A: return 0 max_profit = 0 min_value = A[0] for a in A: max_profit = max(max_profit, a - min_value) min_value = min(min_value, a) return max_profit
#-*- coding : utf-8 -*- class Distribute(object): def __init__(self): self.__layout = 0 self.__funcs = {list:self._list, dict:self._dict} @property def funcs(self): return self.__funcs def _drowTab( self, tab, add=' |' ): add = add * tab return " {add}".format(**locals()) def _dict( self, data, tab ): for idx, (dName, dVal) in enumerate(data.items(), 1): #print(self.__layout, tab) try : if self.__layout < tab : self.__layout = tab print("{0} {1}".format(self._drowTab(tab),type(data))) print("{0} \"{dName}\"".format(self._drowTab(tab), **locals())) self.funcs[type(dVal)](dVal, tab+1) except: if self.__layout > tab : self.__layout -= 1 print("{0} | \"{dVal}\"<\'{dName} value\'>".format(self._drowTab(tab),**locals())) def _list( self, data, tab ): for item in data: #print(self.__layout, tab) try : if self.__layout < tab : self.__layout = tab print("{0} {1}".format(self._drowTab(tab),type(data))) self.funcs[type(item)](item, tab+1 ) except: if self.__layout > tab : self.__layout -= 1 print("{0} \"{item}\"".format(self._drowTab(tab), **locals())) def process( self, data ): self.funcs[type(data)](data, 1) def display(data, title=None): if title == None : title = "Display" print("< {title} >".format(**locals())) distri = Distribute() distri.process(data) if __name__ == "__main__" : display([1,2,3,4,5,6,[7],0,0,0, [8]]) display({"key":[1,2,3,4,5,6,[7,{"InKey_val_array":[9,9,9,9]}],0,{"K":"v","K2":[10,9,8,7],"K3":"v3"},0,0,[8]]})
class Distribute(object): def __init__(self): self.__layout = 0 self.__funcs = {list: self._list, dict: self._dict} @property def funcs(self): return self.__funcs def _drow_tab(self, tab, add=' |'): add = add * tab return ' {add}'.format(**locals()) def _dict(self, data, tab): for (idx, (d_name, d_val)) in enumerate(data.items(), 1): try: if self.__layout < tab: self.__layout = tab print('{0} {1}'.format(self._drowTab(tab), type(data))) print('{0} "{dName}"'.format(self._drowTab(tab), **locals())) self.funcs[type(dVal)](dVal, tab + 1) except: if self.__layout > tab: self.__layout -= 1 print('{0} | "{dVal}"<\'{dName} value\'>'.format(self._drowTab(tab), **locals())) def _list(self, data, tab): for item in data: try: if self.__layout < tab: self.__layout = tab print('{0} {1}'.format(self._drowTab(tab), type(data))) self.funcs[type(item)](item, tab + 1) except: if self.__layout > tab: self.__layout -= 1 print('{0} "{item}"'.format(self._drowTab(tab), **locals())) def process(self, data): self.funcs[type(data)](data, 1) def display(data, title=None): if title == None: title = 'Display' print('< {title} >'.format(**locals())) distri = distribute() distri.process(data) if __name__ == '__main__': display([1, 2, 3, 4, 5, 6, [7], 0, 0, 0, [8]]) display({'key': [1, 2, 3, 4, 5, 6, [7, {'InKey_val_array': [9, 9, 9, 9]}], 0, {'K': 'v', 'K2': [10, 9, 8, 7], 'K3': 'v3'}, 0, 0, [8]]})