content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Function for checking the divisibility # Notice the indentation after function declaration # and if and else statements def checkDivisibility(a, b): if a % b == 0 : print ("a is divisible by b") else: print ("a is not divisible by b") #Driver program to test the above function checkDivisibility(5, 2)
def check_divisibility(a, b): if a % b == 0: print('a is divisible by b') else: print('a is not divisible by b') check_divisibility(5, 2)
OPEN = { '{': '}', '[': ']', '(': ')', '<': '>', } CLOSED = {v: k for k, v in OPEN.items()} def check_balanced(s): """Check for balanced parentheses, braces and brackets.""" stack = [] for i, c in enumerate(s): if c in OPEN: stack.append((i, c)) elif c in CLOSED: try: k, o = stack.pop() except IndexError: raise ValueError( f"Unmatched {c} at index {i} in {s!r}") if CLOSED[c] != o: raise ValueError( f"Mismatched {o} at index {k} with {c} at index {i} in {s!r}") if len(stack) != 0: raise ValueError( "Unmatched {}, in {!r}".format( ', '.join(f"{j} at index {d}" for d, j in stack), s) ) return True
open = {'{': '}', '[': ']', '(': ')', '<': '>'} closed = {v: k for (k, v) in OPEN.items()} def check_balanced(s): """Check for balanced parentheses, braces and brackets.""" stack = [] for (i, c) in enumerate(s): if c in OPEN: stack.append((i, c)) elif c in CLOSED: try: (k, o) = stack.pop() except IndexError: raise value_error(f'Unmatched {c} at index {i} in {s!r}') if CLOSED[c] != o: raise value_error(f'Mismatched {o} at index {k} with {c} at index {i} in {s!r}') if len(stack) != 0: raise value_error('Unmatched {}, in {!r}'.format(', '.join((f'{j} at index {d}' for (d, j) in stack)), s)) return True
class Tri(object): p1 = PVector(0,0) p2 = PVector(0,0) p3 = PVector(0,0) w = 10 h = 10 def __init__(self, _p1, _p2, _p3): #constructor self.p1 = _p1 self.p2 = _p2 self.p3 = _p3 def display_lines(self, col): # method of class display fill(col,100) beginShape() vertex(self.p1.x,self.p1.y) vertex(self.p2.x,self.p2.y) vertex(self.p3.x,self.p3.y) endShape(CLOSE) def display_ellipse(self, col): # method of class display fill(col) ellipse(self.p1.x, self.p1.y, self.w, self.h) ellipse(self.p2.x, self.p2.y, self.w, self.h) ellipse(self.p3.x, self.p3.y, self.w, self.h)
class Tri(object): p1 = p_vector(0, 0) p2 = p_vector(0, 0) p3 = p_vector(0, 0) w = 10 h = 10 def __init__(self, _p1, _p2, _p3): self.p1 = _p1 self.p2 = _p2 self.p3 = _p3 def display_lines(self, col): fill(col, 100) begin_shape() vertex(self.p1.x, self.p1.y) vertex(self.p2.x, self.p2.y) vertex(self.p3.x, self.p3.y) end_shape(CLOSE) def display_ellipse(self, col): fill(col) ellipse(self.p1.x, self.p1.y, self.w, self.h) ellipse(self.p2.x, self.p2.y, self.w, self.h) ellipse(self.p3.x, self.p3.y, self.w, self.h)
class AbstractEnv: def reset(self): raise NotImplementedError() def step(self): raise NotImplementedError() def setup_test(self): raise NotImplementedError()
class Abstractenv: def reset(self): raise not_implemented_error() def step(self): raise not_implemented_error() def setup_test(self): raise not_implemented_error()
num = int(input()) for i in range(num): person = int(input()) hshake = person*(person - 1)//2 print(hshake)
num = int(input()) for i in range(num): person = int(input()) hshake = person * (person - 1) // 2 print(hshake)
class Solution: def longestDupSubstring(self, S: str) -> str: nums = [ord(S[i])-ord('a') for i in range(len(S))] left, right = 1, len(S)-1 while left<=right: mid = left+(right-left)//2 if self.helper(mid, nums)!=-1: left = mid + 1 else: right = mid - 1 start = self.helper(left-1, nums) return S[start: start+left-1] if start != -1 else "" def helper(self, pos, nums): h = 0 for i in range(pos): h = (h*26 + nums[i])%(2**32) aL = 26**pos %(2**32) visited = set() visited.add(h) for start in range(1, len(nums)-pos+1): h = ((h*26 - nums[start-1]*aL)+nums[start+pos-1])%(2**32) if h in visited: return start visited.add(h) return -1 # https://leetcode-cn.com/problems/longest-duplicate-substring/solution/zui-chang-zhong-fu-zi-chuan-by-leetcode/
class Solution: def longest_dup_substring(self, S: str) -> str: nums = [ord(S[i]) - ord('a') for i in range(len(S))] (left, right) = (1, len(S) - 1) while left <= right: mid = left + (right - left) // 2 if self.helper(mid, nums) != -1: left = mid + 1 else: right = mid - 1 start = self.helper(left - 1, nums) return S[start:start + left - 1] if start != -1 else '' def helper(self, pos, nums): h = 0 for i in range(pos): h = (h * 26 + nums[i]) % 2 ** 32 a_l = 26 ** pos % 2 ** 32 visited = set() visited.add(h) for start in range(1, len(nums) - pos + 1): h = (h * 26 - nums[start - 1] * aL + nums[start + pos - 1]) % 2 ** 32 if h in visited: return start visited.add(h) return -1
class IProvider(object): def normalizedAlias(self, metaStr, aliasStr): raise NotImplementedError("Subclass must implement this method!") def aggr(self): raise NotImplementedError("Subclass must implement this method!")
class Iprovider(object): def normalized_alias(self, metaStr, aliasStr): raise not_implemented_error('Subclass must implement this method!') def aggr(self): raise not_implemented_error('Subclass must implement this method!')
opt_xgb = "xgb" opt_cut_negatives = "cut_negatives" opt_validation_size_negatives = "validation_size" opt_validation_size_positives = "validation_size_gt" opt_predict_test = "predict_test" opt_num_boost_round = "num_boost_round" opt_early_stopping_rounds = "early_stopping_rounds" opt_verbose_eval = "verbose_eval" opt_predictor = "predictor" opt_tree_method = "tree_method" opt_eval_metric = "eval_metric" opt_objective = "objective" opt_max_depth = "max_depth" opt_silent = "silent" opt_seed = "seed" eval_metric_logloss = "logloss" predictor_gpu = "gpu_predictor" tree_method_gpu_hist = "gpu_hist" objective_bin_logistic = "binary:logistic"
opt_xgb = 'xgb' opt_cut_negatives = 'cut_negatives' opt_validation_size_negatives = 'validation_size' opt_validation_size_positives = 'validation_size_gt' opt_predict_test = 'predict_test' opt_num_boost_round = 'num_boost_round' opt_early_stopping_rounds = 'early_stopping_rounds' opt_verbose_eval = 'verbose_eval' opt_predictor = 'predictor' opt_tree_method = 'tree_method' opt_eval_metric = 'eval_metric' opt_objective = 'objective' opt_max_depth = 'max_depth' opt_silent = 'silent' opt_seed = 'seed' eval_metric_logloss = 'logloss' predictor_gpu = 'gpu_predictor' tree_method_gpu_hist = 'gpu_hist' objective_bin_logistic = 'binary:logistic'
#!/usr/bin/env python3 # Get the input file with open('input', 'r') as input_file: input_list = [line.strip() for line in input_file.readlines()] answer_p1 = 0 answer_p2 = 0 # Pre-process our input answers_list = [] curr_line = "" for line in input_list: # If we have a empty line, then the info about this answer is over if line == '': answers_list.append(curr_line) curr_line = '' else: # If this is the first line of info, curr_line is empty if curr_line == '': curr_line = line # Otherwire, append info with a space else: curr_line = f"{curr_line} {line}" # Don't forget to add that last info, as the file doesn't end with a new-line answers_list.append(curr_line) print(answers_list) # We now have a pre-formatted list of answers, where each index contains all the answers from a group, and separated by ' '. # Implement the algorithm for both parts print("-------------\nFirst and second part...\n-------------\n") for group in answers_list: print(f"Group: '{group}'") answer_map = {} num_persons = 0 for person in group.split(' '): num_persons = num_persons + 1 print(f"Person: '{person}'") for question in person: if not question in answer_map.keys(): answer_map[question] = 1 else: answer_map[question] = answer_map[question] + 1 print(answer_map) answer_p1 = answer_p1 + len(answer_map.keys()) for key in answer_map.keys(): if answer_map[key] == num_persons: answer_p2 = answer_p2 + 1 # Final output print('\n---------------') print(f'Final answer (part 1): "{answer_p1}"') print(f'Final answer (part 2): "{answer_p2}"')
with open('input', 'r') as input_file: input_list = [line.strip() for line in input_file.readlines()] answer_p1 = 0 answer_p2 = 0 answers_list = [] curr_line = '' for line in input_list: if line == '': answers_list.append(curr_line) curr_line = '' elif curr_line == '': curr_line = line else: curr_line = f'{curr_line} {line}' answers_list.append(curr_line) print(answers_list) print('-------------\nFirst and second part...\n-------------\n') for group in answers_list: print(f"Group: '{group}'") answer_map = {} num_persons = 0 for person in group.split(' '): num_persons = num_persons + 1 print(f"Person: '{person}'") for question in person: if not question in answer_map.keys(): answer_map[question] = 1 else: answer_map[question] = answer_map[question] + 1 print(answer_map) answer_p1 = answer_p1 + len(answer_map.keys()) for key in answer_map.keys(): if answer_map[key] == num_persons: answer_p2 = answer_p2 + 1 print('\n---------------') print(f'Final answer (part 1): "{answer_p1}"') print(f'Final answer (part 2): "{answer_p2}"')
""" Module containing submodules and/or scripts covering downloading, generation, processing or cleaning of data. Author ------ Tom Fleet License ------- MIT """
""" Module containing submodules and/or scripts covering downloading, generation, processing or cleaning of data. Author ------ Tom Fleet License ------- MIT """
class Solution: def productExceptSelf(self, nums: List[int]) -> List[int]: dt=Counter(nums) op=[] for i in nums: dt[i]-=1 tp=1 if dt[i]==0: del dt[i] for t in dt.keys(): tp*=t**dt[t] op.append(tp) if i not in dt: dt[i]=1 else: dt[i]+=1 return op
class Solution: def product_except_self(self, nums: List[int]) -> List[int]: dt = counter(nums) op = [] for i in nums: dt[i] -= 1 tp = 1 if dt[i] == 0: del dt[i] for t in dt.keys(): tp *= t ** dt[t] op.append(tp) if i not in dt: dt[i] = 1 else: dt[i] += 1 return op
# Write a short Python function, is_even(k), that takes an integer value and returns True if k is even, and False otherwise. However, your function cannot use modulo, multiplication, or division operators def is_even(k): temp = str(k)[-1] return temp == '0' or temp == '2' or temp == '4' or temp == '6' or temp == '8' k = input("Enter number: ") print(is_even(k))
def is_even(k): temp = str(k)[-1] return temp == '0' or temp == '2' or temp == '4' or (temp == '6') or (temp == '8') k = input('Enter number: ') print(is_even(k))
# key: value dict1 = {x: x**2 for x in range(10)} print(dict1) # nur gerade dict2 = {x: x**2 for x in range(10) if x % 2 == 0} print(dict2) # wenn > 5 quadrieren ansonsten hoch 1/2 dict3 = {x: x**2 if x > 5 else x**(1/2) for x in range(10) if x % 2 == 0} print(dict3) friends = ['hans', 'peter', 'max'] friend_keys = ['firstname', 'lastname', 'birthday'] """ my_friend_dict = { 'hans': {'firstname': None, 'lastname': None, 'birthday': None}, 'peter': {'firstname': None, 'lastname': None, 'birthday': None}, 'max': {'firstname': None, 'lastname': None, 'birthday': None} } print(my_friend_dict) """ # als Dict Comprehension my_friend_dict2 = {friend_name: {key: None for key in friend_keys} for friend_name in friends} print(my_friend_dict2)
dict1 = {x: x ** 2 for x in range(10)} print(dict1) dict2 = {x: x ** 2 for x in range(10) if x % 2 == 0} print(dict2) dict3 = {x: x ** 2 if x > 5 else x ** (1 / 2) for x in range(10) if x % 2 == 0} print(dict3) friends = ['hans', 'peter', 'max'] friend_keys = ['firstname', 'lastname', 'birthday'] "\nmy_friend_dict = {\n 'hans': {'firstname': None, 'lastname': None, 'birthday': None}, \n 'peter': {'firstname': None, 'lastname': None, 'birthday': None}, \n 'max': {'firstname': None, 'lastname': None, 'birthday': None}\n }\nprint(my_friend_dict)\n" my_friend_dict2 = {friend_name: {key: None for key in friend_keys} for friend_name in friends} print(my_friend_dict2)
def hail_friend(name): print("Hail, " + name + "!") def add_numbers(num1, num2): return num1+num2
def hail_friend(name): print('Hail, ' + name + '!') def add_numbers(num1, num2): return num1 + num2
class Employee: 'Common base class for all employees' emp_count = 0 def __init__(self, name, salary): self.name = name self.salary = salary Employee.emp_count += 1 def display_count(self): print("Total Employee %d" % Employee.emp_count) def display_employee(self): print("Name : ", self.name, ", Salary: ", self.salary) "This would create first object of Employee class" emp1 = Employee("Zara", 2000) "This would create second object of Employee class" emp2 = Employee("Manni", 5000) emp1.display_employee() emp2.display_employee() print("Total Employee %d" % Employee.emp_count) # Returns true if 'age' attribute exists print("has age attribute:", hasattr(emp1, 'age')) # Set attribute 'age' at 8 setattr(emp1, 'age', 8) # Returns value of 'age' attribute print("age: ", getattr(emp1, 'age')) # Delete attribute 'age' delattr(emp1, 'age') print("Employee.__doc__:", Employee.__doc__) print("Employee.__name__:", Employee.__name__) print("Employee.__module__:", Employee.__module__) print("Employee.__bases__:", Employee.__bases__) print("Employee.__dict__:", Employee.__dict__)
class Employee: """Common base class for all employees""" emp_count = 0 def __init__(self, name, salary): self.name = name self.salary = salary Employee.emp_count += 1 def display_count(self): print('Total Employee %d' % Employee.emp_count) def display_employee(self): print('Name : ', self.name, ', Salary: ', self.salary) 'This would create first object of Employee class' emp1 = employee('Zara', 2000) 'This would create second object of Employee class' emp2 = employee('Manni', 5000) emp1.display_employee() emp2.display_employee() print('Total Employee %d' % Employee.emp_count) print('has age attribute:', hasattr(emp1, 'age')) setattr(emp1, 'age', 8) print('age: ', getattr(emp1, 'age')) delattr(emp1, 'age') print('Employee.__doc__:', Employee.__doc__) print('Employee.__name__:', Employee.__name__) print('Employee.__module__:', Employee.__module__) print('Employee.__bases__:', Employee.__bases__) print('Employee.__dict__:', Employee.__dict__)
m_start = 'Hello! \nYou are in an anonymous dating chat! \n' \ 'Press the button below to start chatting with the patner. '\ 'If you want to get to know a person better - press the like button and with mutual sympathy ' \ 'you will be able to find out the nickname of the partner. If you don\'t like the patner, '\ 'then feel free to press the dislike button and start a new chat. \n' \ 'ATTENTION! For the bot to work successfully, you must have a nickname, '\ 'check your settings and make sure you have it listed! \n' \ 'To stop the bot, call the /stop command. '\ 'Please note that all your data will be deleted, otherwise you will remain in the database.' m_is_not_free_users = 'Sorry, but there are no free users at the moment. '\ 'As soon as another user logs in, we will connect you!' m_is_connect = 'The connection has been established. Greet your patner!' m_play_again = 'Want to chat with someone else?' m_is_not_user_name = 'Sorry, but in our bot it is possible to communicate only if you have a username' m_good_bye = 'Bot: Goodbye, we will be glad to see you again!' m_disconnect_user = 'Bot: Your patner has disconnected' m_failed = 'Bot: An error has occurred!' m_like = 'Bot: Great choice!' m_dislike_user = 'Bot: Dialogue ended' m_dislike_user_to = 'Bot: The patner did not like you, sorry' m_send_some_messages = 'Bot: you cannot forward your own messages' m_has_not_dialog = 'You are not in dialogue' dislike_str = '\U0001F44E Dislike' like_str = '\U0001F44D Like' def m_all_like(x): return 'The patner liked you \n '+'His username: '+ '@' + str (x) + \ '\nGood luck in your communication! \nThank you for being with us!'
m_start = "Hello! \nYou are in an anonymous dating chat! \nPress the button below to start chatting with the patner. If you want to get to know a person better - press the like button and with mutual sympathy you will be able to find out the nickname of the partner. If you don't like the patner, then feel free to press the dislike button and start a new chat. \nATTENTION! For the bot to work successfully, you must have a nickname, check your settings and make sure you have it listed! \nTo stop the bot, call the /stop command. Please note that all your data will be deleted, otherwise you will remain in the database." m_is_not_free_users = 'Sorry, but there are no free users at the moment. As soon as another user logs in, we will connect you!' m_is_connect = 'The connection has been established. Greet your patner!' m_play_again = 'Want to chat with someone else?' m_is_not_user_name = 'Sorry, but in our bot it is possible to communicate only if you have a username' m_good_bye = 'Bot: Goodbye, we will be glad to see you again!' m_disconnect_user = 'Bot: Your patner has disconnected' m_failed = 'Bot: An error has occurred!' m_like = 'Bot: Great choice!' m_dislike_user = 'Bot: Dialogue ended' m_dislike_user_to = 'Bot: The patner did not like you, sorry' m_send_some_messages = 'Bot: you cannot forward your own messages' m_has_not_dialog = 'You are not in dialogue' dislike_str = '👎 Dislike' like_str = '👍 Like' def m_all_like(x): return 'The patner liked you \n ' + 'His username: ' + '@' + str(x) + '\nGood luck in your communication! \nThank you for being with us!'
''' File: __init__.py Project: metrics File Created: Monday, 17th August 2020 3:14:39 pm Author: Sparsh Dutta (sparsh.dtt@gmail.com) ----- Last Modified: Monday, 17th August 2020 3:14:39 pm Modified By: Sparsh Dutta (sparsh.dtt@gmail.com>) ----- Copyright 2020 Sparsh Dutta '''
""" File: __init__.py Project: metrics File Created: Monday, 17th August 2020 3:14:39 pm Author: Sparsh Dutta (sparsh.dtt@gmail.com) ----- Last Modified: Monday, 17th August 2020 3:14:39 pm Modified By: Sparsh Dutta (sparsh.dtt@gmail.com>) ----- Copyright 2020 Sparsh Dutta """
"""A class with an instance variable.""" class MyClass(object): def __init__(myself, value): #print(value) myself.instance_var = value myself.var2 = 2 def print_me(myself): myself.var3 = 1234 print(myself.instance_var) def add(self, x): print(x+2) def print_again(self): self.var4 = "i am var4" #print(self.xyz) # create an object obj = MyClass("It is an instance variable") obj.print_again() obj.xyz = 987 #print(obj.xyz) obj.print_again() obj1 = MyClass("any string") obj1.print_again() # obj1 = MyClass("I am another one") # obj.print_me() # == MyClass.print_me(obj) # obj1.print_me() # obj1.print_again() # obj.add(5) # access an object data members # print(obj.instance_var) # # print("\n\n-------- Class With Methods -----------") # # # class MyClassWithMethod(object): # def __init__(self, value): # self.instance_var = value # # def my_method(self): # return self.instance_var # # obj = MyClassWithMethod(1) # # # That is how we access method # print(obj.my_method()) # # print("\n\n-------- Class With Class Member -----------") # # # # class with class members # class MyClassWithMembers: # class_var = 2 # # # Access class member with class name directly # print(MyClassWithMembers.class_var) # # obj1 = MyClassWithMembers() # obj2 = MyClassWithMembers() # # # Access class member with objects # print(obj1.class_var) # print(obj2.class_var) # # # Setting value for class member with class # MyClassWithMembers.class_var = 3 # # # value stayed same across # print("value stayed same across") # print(MyClassWithMembers.class_var) # print(obj1.class_var) # print(obj2.class_var) # # # # Setting value for class member via object # obj1.class_var = 4 # # print(MyClassWithMembers.class_var) # # ''' # value for obj1 has changed, obj1 did not have class_var # member and thus it got added as member for obj1. # ''' # print(obj1.class_var) # print(obj2.class_var) # # # class Dog: # kind = 'canine' # class variable shared by all instances # # def __init__(self, name): # self.name = name # instance variable unique to each instance # # d = Dog('Fido') # e = Dog('Buddy') # print(d.kind) # shared by all dogs # print(e.kind) # shared by all dogs # print(d.name) # unique to d # print(e.name) # unique to e # # # e.kind = "abc" # print(d.kind) # print(e.kind) # print(Dog.kind)
"""A class with an instance variable.""" class Myclass(object): def __init__(myself, value): myself.instance_var = value myself.var2 = 2 def print_me(myself): myself.var3 = 1234 print(myself.instance_var) def add(self, x): print(x + 2) def print_again(self): self.var4 = 'i am var4' obj = my_class('It is an instance variable') obj.print_again() obj.xyz = 987 obj.print_again() obj1 = my_class('any string') obj1.print_again()
x = 10 y = 20 z = x+y print('z is: %s' % z)
x = 10 y = 20 z = x + y print('z is: %s' % z)
# 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 verticalTraversal(self, root: Optional[TreeNode]) -> List[List[int]]: # method for preorder traversal def preorder(root, row, col): if col in coord: coord[col].append((row, root.val)) else: coord[col] = [(row, root.val)] if root.left: preorder(root.left, row + 1, col - 1) # for left child if root.right: preorder(root.right, row + 1, col + 1) # for left child # call the method preorder() coord = {} # dictionary to hold the node values along with row number against the column numbers if root: preorder(root, 0, 0) output = [] for key in sorted(coord.keys()): if len(coord[key]) == 1: value = coord[key][0][1] output.append([value]) else: # a column has nodes in multple rows temp = [] for item in sorted(coord[key]): temp.append(item[1]) output.append(temp) return output
class Solution: def vertical_traversal(self, root: Optional[TreeNode]) -> List[List[int]]: def preorder(root, row, col): if col in coord: coord[col].append((row, root.val)) else: coord[col] = [(row, root.val)] if root.left: preorder(root.left, row + 1, col - 1) if root.right: preorder(root.right, row + 1, col + 1) coord = {} if root: preorder(root, 0, 0) output = [] for key in sorted(coord.keys()): if len(coord[key]) == 1: value = coord[key][0][1] output.append([value]) else: temp = [] for item in sorted(coord[key]): temp.append(item[1]) output.append(temp) return output
### SET x = {1,2,3} x.add(4) print(x) x.remove(2) print(x) x.discard(100) print(x) x= {1,2,4} y ={"Three",4} print(x.intersection(y)) x.update(y) print(x) x = set('aAbcd') y =set('Ax') print(x-y) print(x|y) print(x&y) print(x^y) # Practice any other methods from SET
x = {1, 2, 3} x.add(4) print(x) x.remove(2) print(x) x.discard(100) print(x) x = {1, 2, 4} y = {'Three', 4} print(x.intersection(y)) x.update(y) print(x) x = set('aAbcd') y = set('Ax') print(x - y) print(x | y) print(x & y) print(x ^ y)
class TwoSum(object): def __init__(self): """ initialize your data structure here """ self.internal = [] self.dic = {} def add(self, number): """ Add the number to an internal data structure. :rtype: nothing """ self.internal.append(number) if number in self.dic: # more than once self.dic[number] = True return # once self.dic[number] = False def find(self, value): """ Find if there exists any pair of numbers which sum is equal to the value. :type value: int :rtype: bool """ for v in self.internal: if value - v in self.dic: if v << 1 == value and not self.dic[v]: continue return True return False # Your TwoSum object will be instantiated and called as such: # twoSum = TwoSum() # twoSum.add(number) # twoSum.find(value)
class Twosum(object): def __init__(self): """ initialize your data structure here """ self.internal = [] self.dic = {} def add(self, number): """ Add the number to an internal data structure. :rtype: nothing """ self.internal.append(number) if number in self.dic: self.dic[number] = True return self.dic[number] = False def find(self, value): """ Find if there exists any pair of numbers which sum is equal to the value. :type value: int :rtype: bool """ for v in self.internal: if value - v in self.dic: if v << 1 == value and (not self.dic[v]): continue return True return False
# d - cijeli broj # f - realni broj # s - string #primjer formatiranog ispisa a=3.12345 print('{0:f},{1:0.1f}'.format(a, a))
a = 3.12345 print('{0:f},{1:0.1f}'.format(a, a))
x = 1 y = 2 print("x is {}".format(x)) print("y is {}".format(y)) print("swapping... ") (x, y) = (y, x) # a, b, c = foo() returning multiple print('swapped.') print("x is {}".format(x)) print("y is {}".format(y))
x = 1 y = 2 print('x is {}'.format(x)) print('y is {}'.format(y)) print('swapping... ') (x, y) = (y, x) print('swapped.') print('x is {}'.format(x)) print('y is {}'.format(y))
# -*- coding: utf-8 -*- """ Created on Wed Mar 13 11:30:05 2019 @author: Jongmin Sung custom_funcs.py In projectname/projectname/custom_funcs.py, we can put in custom code that gets used across more than notebook. One example would be downstream data preprocessing that is only necessary for a subset of notebooks. # custom_funcs.py """ # Add one def add_one(x): return x+1 # Capital case def capital_case(x): return x.capitalize()
""" Created on Wed Mar 13 11:30:05 2019 @author: Jongmin Sung custom_funcs.py In projectname/projectname/custom_funcs.py, we can put in custom code that gets used across more than notebook. One example would be downstream data preprocessing that is only necessary for a subset of notebooks. # custom_funcs.py """ def add_one(x): return x + 1 def capital_case(x): return x.capitalize()
# The goal is sum the digits. valor = int(input('Enter a whole number: ')) sum = 0 while valor > 0: rest = valor % 10 valor = (valor - rest) / 10 sum += rest print(int(sum))
valor = int(input('Enter a whole number: ')) sum = 0 while valor > 0: rest = valor % 10 valor = (valor - rest) / 10 sum += rest print(int(sum))
def add(filename, siglas, carrera): with open(filename, 'a') as f_obj: f_obj.write(f'\n{siglas} {carrera}') def sacacarrera(linea): siglas = '' carrera = '' counter = 0 for c in linea: if c == ' ': counter=1 if counter != 1: siglas+=c if counter == 1: carrera+=c carrera = carrera[1:] return(siglas, carrera) def search(filename, carrera): with open(filename) as f_obj: lines = f_obj.readlines() # print(lines) # Forma noob: # for line in f_obj: # # print(line) # print(line.rstrip()) for line in lines: if line.rstrip() != '': siglatxt, carreratxt = sacacarrera(line.rstrip()) if carreratxt == carrera: return siglatxt def printfile(filename): with open(filename) as f_obj: lines = f_obj.readlines() # print(lines) # Forma noob: # for line in f_obj: # # print(line) # print(line.rstrip()) for line in lines: if line.rstrip() != '': print(line.rstrip()) option=0 while option!= 4: option = int(input("Selecciona una opcion\n1 -> Ver todas las carreras con sus siglas\n2 -> Agregar una carrera dada sus siglas y su nombre\n3 -> Dado el nombre de la carrera imprimir las siglas\n4 -> Exit\n")) if option == 1: printfile("programaseducativos.txt") print() elif option == 2: siglas = input("Sigla: ") nombre = input("Nombre: ") add('programaseducativos.txt', siglas, nombre) print() elif option == 3: nombre = input("Nombre: ") siglas = search('programaseducativos.txt', nombre) print(f"Sigla: {siglas}") print() elif option == 4: print("Que tenga un buen dia\n") else: print("Opcion no disponible\n")
def add(filename, siglas, carrera): with open(filename, 'a') as f_obj: f_obj.write(f'\n{siglas} {carrera}') def sacacarrera(linea): siglas = '' carrera = '' counter = 0 for c in linea: if c == ' ': counter = 1 if counter != 1: siglas += c if counter == 1: carrera += c carrera = carrera[1:] return (siglas, carrera) def search(filename, carrera): with open(filename) as f_obj: lines = f_obj.readlines() for line in lines: if line.rstrip() != '': (siglatxt, carreratxt) = sacacarrera(line.rstrip()) if carreratxt == carrera: return siglatxt def printfile(filename): with open(filename) as f_obj: lines = f_obj.readlines() for line in lines: if line.rstrip() != '': print(line.rstrip()) option = 0 while option != 4: option = int(input('Selecciona una opcion\n1 -> Ver todas las carreras con sus siglas\n2 -> Agregar una carrera dada sus siglas y su nombre\n3 -> Dado el nombre de la carrera imprimir las siglas\n4 -> Exit\n')) if option == 1: printfile('programaseducativos.txt') print() elif option == 2: siglas = input('Sigla: ') nombre = input('Nombre: ') add('programaseducativos.txt', siglas, nombre) print() elif option == 3: nombre = input('Nombre: ') siglas = search('programaseducativos.txt', nombre) print(f'Sigla: {siglas}') print() elif option == 4: print('Que tenga un buen dia\n') else: print('Opcion no disponible\n')
NODE, EDGE, ATTR = range(3) class Node: def __init__(self, name, attrs): self.name = name self.attrs = attrs def __eq__(self, other): return self.name == other.name and self.attrs == other.attrs class Edge: def __init__(self, src, dst, attrs): self.src = src self.dst = dst self.attrs = attrs def __eq__(self, other): return (self.src == other.src and self.dst == other.dst and self.attrs == other.attrs) class Graph: def __init__(self, data=None): self.nodes = [] self.edges = [] self.attrs = {} if data is None: data = [] if not isinstance(data, list): raise TypeError("Graph data malformed") for item in data: if len(item) < 3: raise TypeError("Graph item incomplete") type_ = item[0] if type_ == ATTR: if len(item) != 3: raise ValueError("ATTR malformed") self.attrs[item[1]] = item[2] elif type_ == NODE: if len(item) != 3: raise ValueError("NODE malformed") self.nodes.append(Node(item[1], item[2])) elif type_ == EDGE: if len(item) != 4: raise ValueError("EDGE malformed") self.edges.append(Edge(item[1], item[2], item[3])) else: raise ValueError("Unknown item {}".format(item[0]))
(node, edge, attr) = range(3) class Node: def __init__(self, name, attrs): self.name = name self.attrs = attrs def __eq__(self, other): return self.name == other.name and self.attrs == other.attrs class Edge: def __init__(self, src, dst, attrs): self.src = src self.dst = dst self.attrs = attrs def __eq__(self, other): return self.src == other.src and self.dst == other.dst and (self.attrs == other.attrs) class Graph: def __init__(self, data=None): self.nodes = [] self.edges = [] self.attrs = {} if data is None: data = [] if not isinstance(data, list): raise type_error('Graph data malformed') for item in data: if len(item) < 3: raise type_error('Graph item incomplete') type_ = item[0] if type_ == ATTR: if len(item) != 3: raise value_error('ATTR malformed') self.attrs[item[1]] = item[2] elif type_ == NODE: if len(item) != 3: raise value_error('NODE malformed') self.nodes.append(node(item[1], item[2])) elif type_ == EDGE: if len(item) != 4: raise value_error('EDGE malformed') self.edges.append(edge(item[1], item[2], item[3])) else: raise value_error('Unknown item {}'.format(item[0]))
prov_cap = { "Hebei": "Shijiazhuang", "Shanxi": "Taiyuan", "Liaoning": "Shenyang", "Jilin": "Changchun", "Heilongjiang": "Harbin", "Jiangsu": "Nanjing", "Zhejiang": "Hangzhou", "Anhui": "Hefei", "Fujian": "Fuzhou", "Jiangxi": "Nanchang", "Shandong": "Jinan", "Henan": "Zhengzhou", "Hubei": "Wuhan", "Hunan": "Changsha", "Guangdong": "Guangzhou", "Hainan": "Haikou", "Sichuan": "Chengdu", "Guizhou": "Guiyang", "Yunnan": "Kunming", "Shaanxi": "Xi'an", "Gansu": "Lanzhou", "Qinghai": "Xining", "Taiwan": "Taipei" } autregion = { "Inner Mongolia": "NM", "Guangxi Zhuang": "GX", "Tibet": "XZ", "Ningxia Hui": "NX", "Xinjiang Uyghur": "XJ" } autregion_capitals = { "Inner Mongolia": "Hohhot", "Guangxi Zhuang": "Nanning", "Tibet": "Lhasa", "Ningxia Hui": "Yinchuan", "Xinjiang Uyghur": "Urumqi" } admregion = { "Hong Kong": "HK", "Macau": "MC" } admregion_capitals = { "Hong Kong": "Hong Kong", "Macau": "Macau" } municipality = { "Beijing": "BJ", "Tianjin": "TJ", "Shanghai": "SH", "Chongqing": "CQ" } mun_capitals = { "Beijing": "Beijing", "Tianjin": "Tianjin", "Shanghai": "Shanghai", "Chongqing": "Chongqing" }
prov_cap = {'Hebei': 'Shijiazhuang', 'Shanxi': 'Taiyuan', 'Liaoning': 'Shenyang', 'Jilin': 'Changchun', 'Heilongjiang': 'Harbin', 'Jiangsu': 'Nanjing', 'Zhejiang': 'Hangzhou', 'Anhui': 'Hefei', 'Fujian': 'Fuzhou', 'Jiangxi': 'Nanchang', 'Shandong': 'Jinan', 'Henan': 'Zhengzhou', 'Hubei': 'Wuhan', 'Hunan': 'Changsha', 'Guangdong': 'Guangzhou', 'Hainan': 'Haikou', 'Sichuan': 'Chengdu', 'Guizhou': 'Guiyang', 'Yunnan': 'Kunming', 'Shaanxi': "Xi'an", 'Gansu': 'Lanzhou', 'Qinghai': 'Xining', 'Taiwan': 'Taipei'} autregion = {'Inner Mongolia': 'NM', 'Guangxi Zhuang': 'GX', 'Tibet': 'XZ', 'Ningxia Hui': 'NX', 'Xinjiang Uyghur': 'XJ'} autregion_capitals = {'Inner Mongolia': 'Hohhot', 'Guangxi Zhuang': 'Nanning', 'Tibet': 'Lhasa', 'Ningxia Hui': 'Yinchuan', 'Xinjiang Uyghur': 'Urumqi'} admregion = {'Hong Kong': 'HK', 'Macau': 'MC'} admregion_capitals = {'Hong Kong': 'Hong Kong', 'Macau': 'Macau'} municipality = {'Beijing': 'BJ', 'Tianjin': 'TJ', 'Shanghai': 'SH', 'Chongqing': 'CQ'} mun_capitals = {'Beijing': 'Beijing', 'Tianjin': 'Tianjin', 'Shanghai': 'Shanghai', 'Chongqing': 'Chongqing'}
# Get the aggregated number of a specific POI category per H3 index at a given resolution def get_pois_by_category_in_polygon( dbt_controller, category, resolution, polygon_coords ): return dbt_controller.run_macro( macro_category="poi", macro_name="get_pois_in_polygon", args="{" + f"h3_resolution: {str(resolution)}, category: {category}, " f"polygon_coords: '{polygon_coords}'" + "}", ) # Get the total average popularity for H3 indexes at a given resolution def get_popularity_in_polygon(dbt_controller, resolution, polygon_coords): return dbt_controller.run_macro( macro_category="poi", macro_name="get_popularity_in_polygon", args="{" + f"h3_resolution: {resolution}, polygon_coords: '{polygon_coords}'" + "}", )
def get_pois_by_category_in_polygon(dbt_controller, category, resolution, polygon_coords): return dbt_controller.run_macro(macro_category='poi', macro_name='get_pois_in_polygon', args='{' + f"h3_resolution: {str(resolution)}, category: {category}, polygon_coords: '{polygon_coords}'" + '}') def get_popularity_in_polygon(dbt_controller, resolution, polygon_coords): return dbt_controller.run_macro(macro_category='poi', macro_name='get_popularity_in_polygon', args='{' + f"h3_resolution: {resolution}, polygon_coords: '{polygon_coords}'" + '}')
__all__ = [ "sis_vs_smc", "ekf_vs_ukf", "ekf_vs_ukf_mlp", "eekf_logistic_regression", "ekf_mlp_anim", "linreg_kf", "kf_parallel", "kf_continuous_circle", "kf_spiral", "kf_tracking", "bootstrap_filter", "pendulum_1d", "ekf_continuous" ]
__all__ = ['sis_vs_smc', 'ekf_vs_ukf', 'ekf_vs_ukf_mlp', 'eekf_logistic_regression', 'ekf_mlp_anim', 'linreg_kf', 'kf_parallel', 'kf_continuous_circle', 'kf_spiral', 'kf_tracking', 'bootstrap_filter', 'pendulum_1d', 'ekf_continuous']
''' representations qumis/qasm input: script ordered list: arrays containing the 1Q and the 2Q steps rotation list: arrays, but instead of strings, su2 operations on the same mw step are packed into one euler list: arrays, but instead of su2 rotations, we already have their szxz representation compiled list: z gates are packed, and x gates are rotated by their preceding zs qumis/qasm final: script ----------------------------- ''' class qasm: def __init__(self, lines, n_qubits): self.lines = lines self.n_qubits = n_qubits self.depth = len(lines) class structured_script: def __init__(self, lines_1Q, lines_2Q, n_qubits): """ Representation of a circuit as an "Structured script". Structure means that the circuit is provided as a list of layers with 1 qubit operations and 2 qubit operations. That is a circuit of the shape 1Q_layer, [2Q_layer,1Q_layer] x num_layers, RO To be of this shape, the number of 1Q layers need to be one more than the number of 2Q layers. """ self.n_qubits = n_qubits # 1Qubit- and 2Qubit-operations layers do not match in size if not((len(lines_2Q)+1) == len(lines_1Q)): raise ValueError( '1Qubit- and 2Qubit-operations layers do not match in size') self.depth = 1+2*len(lines_2Q) self.lines_1Q = lines_1Q self.lines_2Q = lines_2Q class rotation_list: def __init__(self, rotations_1Q, lines_2Q, n_qubits): """ Representation of a circuit as "Rotation list". On top of the structure (see Structured script representation), 1Q layers are compiled to the corresponding rotations. The 1Q layers are now represented with a rotation vector. rotations_1Q = [layer, qubit, rotation_vector] rotation_vector = [axis_of_rotation (3 numbers), angle_of_rotation] """ self.rotations_1Q = rotations_1Q self.lines_2Q = lines_2Q self.n_qubits = n_qubits dim_depth, dim_qubits, dim_rot = self.rotations_1Q.shape self.depth = 1+2*len(lines_2Q) # 1Q rotations vector does not match the depth if not((2*dim_depth-1) == self.depth): raise ValueError('1Q rotations vector does not match the depth') # 1Q rotations vector does not match the qubit number if not(dim_qubits == n_qubits): raise ValueError( '1Q rotations vector does not match the qubit number') # 1Q rotations vector does not match the parameter number if not(dim_rot == 4): raise ValueError( '1Q rotations vector does not match the parameter number') def print_to_file(self, fname): raw_script = [] f = open(fname, mode='w+') n_d = len(self.rotations_1Q[:, 0, 0]) for i in range(n_d): for j in range(self.n_qubits): if self.rotations_1Q[i, j, 0] == 0 and self.rotations_1Q[i, j, 1] == 0: line = 'I q%d\n' % j else: line = 'R %.3f, %.3f, %.3f, %.3f q%d\n' % (self.rotations_1Q[i, j, 0], self.rotations_1Q[i, j, 1], self.rotations_1Q[i, j, 2], self.rotations_1Q[i, j, 3], j) raw_script.append(line) if i+1 < n_d: print(i) raw_script.append(self.lines_2Q[i]+'\n') f.writelines(raw_script) f.close() class euler_list: def __init__(self, euler_1Q, lines_2Q, n_qubits): """ Representation of a circuit as "Euler angles list". On top of the rotation list (see Rotations list representation), these rotations are converted to Euler angles. The 1Q layers are now represented with an euler vector. rotations_1Q = [layer, qubit, euler_vector] euler_vector = [rot_Z(first), rot_X, rot_Z2(third)] The euler-angle decomposition is defined as: Rotation_input = Rotation_Z2 . Rotation_X . Rotation_Z1 """ self.euler_1Q = euler_1Q self.lines_2Q = lines_2Q self.n_qubits = n_qubits dim_depth, dim_qubits, dim_euler = self.euler_1Q.shape self.depth = 1+2*len(lines_2Q) # euler angles vector does not match the depth if not((2*dim_depth-1) == self.depth): raise ValueError('euler angles vector does not match the depth') # euler angles vector does not match the qubit number if not(dim_qubits == n_qubits): raise ValueError( 'euler angles vector does not match the qubit number') # euler angles vector does not match the parameter number if not(dim_euler == 3): raise ValueError( 'euler angles vector does not match the parameter number') def print_to_file(self, fname): raw_script = [] f = open(fname, mode='w+') n_d = len(self.euler_1Q[:, 0, 0]) for i in range(n_d): for j in range(self.n_qubits): if self.euler_1Q[i, j, 0] == 0 and self.euler_1Q[i, j, 1] == 0: line = 'I q%d\n' % j else: line = 'E %.3f, %.3f, %.3f q%d\n' % (self.euler_1Q[i, j, 0], self.euler_1Q[i, j, 1], self.euler_1Q[i, j, 2], j) raw_script.append(line) if i+1 < n_d: print(i) raw_script.append(self.lines_2Q[i]+'\n') f.writelines(raw_script) f.close() class XYcompiled_list: def __init__(self, XY_rotations, lines_2Q, n_qubits): """ Representation of a circuit as "XY list". On top of the Euler list (see Euler list representation), The euler angles are compiled into a single MW gate (rotation around axis in the azimutal plane) through virtual phase updates. The 1Q layers are now represented with an XY vector. rotations_1Q = [layer, qubit, XY_vector] XY_vector = [axis(azimutal angle), rotation_angle] """ self.XY_rotations = XY_rotations self.lines_2Q = lines_2Q self.n_qubits = n_qubits dim_depth, dim_qubits, dim_XY = self.XY_rotations.shape self.depth = 1+2*len(lines_2Q) # XY rotations vector does not match the depth if not((2*dim_depth-1) == self.depth): raise ValueError('XY rotations vector does not match the depth') # XY rotations vector does not match the qubit number if not(dim_qubits == n_qubits): raise ValueError( 'XY rotations vector does not match the qubit number') # XY rotations vector does not match the parameter number if not(dim_XY == 2): raise ValueError( 'XY rotations vector does not match the parameter number') def print_to_file(self, fname): raw_script = [] f = open(fname, mode='w+') n_d = len(self.XY_rotations[:, 0, 0]) for i in range(n_d): for j in range(self.n_qubits): if self.XY_rotations[i, j, 0] == 0 and self.XY_rotations[i, j, 1] == 0: line = 'I q%d\n' % j else: line = 'MW %.3f, %.3f q%d\n' % (self.XY_rotations[i, j, 0], self.XY_rotations[i, j, 1], j) raw_script.append(line) if i+1 < n_d: print(i) raw_script.append(self.lines_2Q[i]+'\n') f.writelines(raw_script) f.close()
""" representations qumis/qasm input: script ordered list: arrays containing the 1Q and the 2Q steps rotation list: arrays, but instead of strings, su2 operations on the same mw step are packed into one euler list: arrays, but instead of su2 rotations, we already have their szxz representation compiled list: z gates are packed, and x gates are rotated by their preceding zs qumis/qasm final: script ----------------------------- """ class Qasm: def __init__(self, lines, n_qubits): self.lines = lines self.n_qubits = n_qubits self.depth = len(lines) class Structured_Script: def __init__(self, lines_1Q, lines_2Q, n_qubits): """ Representation of a circuit as an "Structured script". Structure means that the circuit is provided as a list of layers with 1 qubit operations and 2 qubit operations. That is a circuit of the shape 1Q_layer, [2Q_layer,1Q_layer] x num_layers, RO To be of this shape, the number of 1Q layers need to be one more than the number of 2Q layers. """ self.n_qubits = n_qubits if not len(lines_2Q) + 1 == len(lines_1Q): raise value_error('1Qubit- and 2Qubit-operations layers do not match in size') self.depth = 1 + 2 * len(lines_2Q) self.lines_1Q = lines_1Q self.lines_2Q = lines_2Q class Rotation_List: def __init__(self, rotations_1Q, lines_2Q, n_qubits): """ Representation of a circuit as "Rotation list". On top of the structure (see Structured script representation), 1Q layers are compiled to the corresponding rotations. The 1Q layers are now represented with a rotation vector. rotations_1Q = [layer, qubit, rotation_vector] rotation_vector = [axis_of_rotation (3 numbers), angle_of_rotation] """ self.rotations_1Q = rotations_1Q self.lines_2Q = lines_2Q self.n_qubits = n_qubits (dim_depth, dim_qubits, dim_rot) = self.rotations_1Q.shape self.depth = 1 + 2 * len(lines_2Q) if not 2 * dim_depth - 1 == self.depth: raise value_error('1Q rotations vector does not match the depth') if not dim_qubits == n_qubits: raise value_error('1Q rotations vector does not match the qubit number') if not dim_rot == 4: raise value_error('1Q rotations vector does not match the parameter number') def print_to_file(self, fname): raw_script = [] f = open(fname, mode='w+') n_d = len(self.rotations_1Q[:, 0, 0]) for i in range(n_d): for j in range(self.n_qubits): if self.rotations_1Q[i, j, 0] == 0 and self.rotations_1Q[i, j, 1] == 0: line = 'I q%d\n' % j else: line = 'R %.3f, %.3f, %.3f, %.3f q%d\n' % (self.rotations_1Q[i, j, 0], self.rotations_1Q[i, j, 1], self.rotations_1Q[i, j, 2], self.rotations_1Q[i, j, 3], j) raw_script.append(line) if i + 1 < n_d: print(i) raw_script.append(self.lines_2Q[i] + '\n') f.writelines(raw_script) f.close() class Euler_List: def __init__(self, euler_1Q, lines_2Q, n_qubits): """ Representation of a circuit as "Euler angles list". On top of the rotation list (see Rotations list representation), these rotations are converted to Euler angles. The 1Q layers are now represented with an euler vector. rotations_1Q = [layer, qubit, euler_vector] euler_vector = [rot_Z(first), rot_X, rot_Z2(third)] The euler-angle decomposition is defined as: Rotation_input = Rotation_Z2 . Rotation_X . Rotation_Z1 """ self.euler_1Q = euler_1Q self.lines_2Q = lines_2Q self.n_qubits = n_qubits (dim_depth, dim_qubits, dim_euler) = self.euler_1Q.shape self.depth = 1 + 2 * len(lines_2Q) if not 2 * dim_depth - 1 == self.depth: raise value_error('euler angles vector does not match the depth') if not dim_qubits == n_qubits: raise value_error('euler angles vector does not match the qubit number') if not dim_euler == 3: raise value_error('euler angles vector does not match the parameter number') def print_to_file(self, fname): raw_script = [] f = open(fname, mode='w+') n_d = len(self.euler_1Q[:, 0, 0]) for i in range(n_d): for j in range(self.n_qubits): if self.euler_1Q[i, j, 0] == 0 and self.euler_1Q[i, j, 1] == 0: line = 'I q%d\n' % j else: line = 'E %.3f, %.3f, %.3f q%d\n' % (self.euler_1Q[i, j, 0], self.euler_1Q[i, j, 1], self.euler_1Q[i, j, 2], j) raw_script.append(line) if i + 1 < n_d: print(i) raw_script.append(self.lines_2Q[i] + '\n') f.writelines(raw_script) f.close() class Xycompiled_List: def __init__(self, XY_rotations, lines_2Q, n_qubits): """ Representation of a circuit as "XY list". On top of the Euler list (see Euler list representation), The euler angles are compiled into a single MW gate (rotation around axis in the azimutal plane) through virtual phase updates. The 1Q layers are now represented with an XY vector. rotations_1Q = [layer, qubit, XY_vector] XY_vector = [axis(azimutal angle), rotation_angle] """ self.XY_rotations = XY_rotations self.lines_2Q = lines_2Q self.n_qubits = n_qubits (dim_depth, dim_qubits, dim_xy) = self.XY_rotations.shape self.depth = 1 + 2 * len(lines_2Q) if not 2 * dim_depth - 1 == self.depth: raise value_error('XY rotations vector does not match the depth') if not dim_qubits == n_qubits: raise value_error('XY rotations vector does not match the qubit number') if not dim_XY == 2: raise value_error('XY rotations vector does not match the parameter number') def print_to_file(self, fname): raw_script = [] f = open(fname, mode='w+') n_d = len(self.XY_rotations[:, 0, 0]) for i in range(n_d): for j in range(self.n_qubits): if self.XY_rotations[i, j, 0] == 0 and self.XY_rotations[i, j, 1] == 0: line = 'I q%d\n' % j else: line = 'MW %.3f, %.3f q%d\n' % (self.XY_rotations[i, j, 0], self.XY_rotations[i, j, 1], j) raw_script.append(line) if i + 1 < n_d: print(i) raw_script.append(self.lines_2Q[i] + '\n') f.writelines(raw_script) f.close()
n=int(input())*300 n1=int(input())*1500 n2=int(input())*600 n3=int(input())*1000 n4=int(input())*150 resp=(n+n1+n2+n3+n4)+225 print(resp)
n = int(input()) * 300 n1 = int(input()) * 1500 n2 = int(input()) * 600 n3 = int(input()) * 1000 n4 = int(input()) * 150 resp = n + n1 + n2 + n3 + n4 + 225 print(resp)
myinput=list(input("Enter a String : " )) word = "" for x in myinput: if (myinput.index(x) % 2 == 0): word += x print(word)
myinput = list(input('Enter a String : ')) word = '' for x in myinput: if myinput.index(x) % 2 == 0: word += x print(word)
class BindingsCollection(BaseCollection,ICollection,IEnumerable): """ Represents a collection of System.Windows.Forms.Binding objects for a control. """ def Add(self,*args): """ Add(self: BindingsCollection,binding: Binding) Adds the specified binding to the collection. binding: The System.Windows.Forms.Binding to add to the collection. """ pass def AddCore(self,*args): """ AddCore(self: BindingsCollection,dataBinding: Binding) Adds a System.Windows.Forms.Binding to the collection. dataBinding: The System.Windows.Forms.Binding to add to the collection. """ pass def Clear(self,*args): """ Clear(self: BindingsCollection) Clears the collection of binding objects. """ pass def ClearCore(self,*args): """ ClearCore(self: BindingsCollection) Clears the collection of any members. """ pass def MemberwiseClone(self,*args): """ MemberwiseClone(self: MarshalByRefObject,cloneIdentity: bool) -> MarshalByRefObject Creates a shallow copy of the current System.MarshalByRefObject object. cloneIdentity: false to delete the current System.MarshalByRefObject object's identity,which will cause the object to be assigned a new identity when it is marshaled across a remoting boundary. A value of false is usually appropriate. true to copy the current System.MarshalByRefObject object's identity to its clone,which will cause remoting client calls to be routed to the remote server object. Returns: A shallow copy of the current System.MarshalByRefObject object. MemberwiseClone(self: object) -> object Creates a shallow copy of the current System.Object. Returns: A shallow copy of the current System.Object. """ pass def OnCollectionChanged(self,*args): """ OnCollectionChanged(self: BindingsCollection,ccevent: CollectionChangeEventArgs) Raises the System.Windows.Forms.BindingsCollection.CollectionChanged event. ccevent: A System.ComponentModel.CollectionChangeEventArgs that contains the event data. """ pass def OnCollectionChanging(self,*args): """ OnCollectionChanging(self: BindingsCollection,e: CollectionChangeEventArgs) Raises the System.Windows.Forms.BindingsCollection.CollectionChanging event. e: A System.ComponentModel.CollectionChangeEventArgs that contains event data. """ pass def Remove(self,*args): """ Remove(self: BindingsCollection,binding: Binding) Deletes the specified binding from the collection. binding: The Binding to remove from the collection. """ pass def RemoveAt(self,*args): """ RemoveAt(self: BindingsCollection,index: int) Deletes the binding from the collection at the specified index. index: The index of the System.Windows.Forms.Binding to remove. """ pass def RemoveCore(self,*args): """ RemoveCore(self: BindingsCollection,dataBinding: Binding) Removes the specified System.Windows.Forms.Binding from the collection. dataBinding: The System.Windows.Forms.Binding to remove. """ pass def ShouldSerializeMyAll(self,*args): """ ShouldSerializeMyAll(self: BindingsCollection) -> bool Gets a value that indicates whether the collection should be serialized. Returns: true if the collection count is greater than zero; otherwise,false. """ pass def __getitem__(self,*args): """ x.__getitem__(y) <==> x[y] """ pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __iter__(self,*args): """ __iter__(self: IEnumerable) -> object """ pass def __len__(self,*args): """ x.__len__() <==> len(x) """ pass Count=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the total number of bindings in the collection. Get: Count(self: BindingsCollection) -> int """ List=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the bindings in the collection as an object. """ CollectionChanged=None CollectionChanging=None
class Bindingscollection(BaseCollection, ICollection, IEnumerable): """ Represents a collection of System.Windows.Forms.Binding objects for a control. """ def add(self, *args): """ Add(self: BindingsCollection,binding: Binding) Adds the specified binding to the collection. binding: The System.Windows.Forms.Binding to add to the collection. """ pass def add_core(self, *args): """ AddCore(self: BindingsCollection,dataBinding: Binding) Adds a System.Windows.Forms.Binding to the collection. dataBinding: The System.Windows.Forms.Binding to add to the collection. """ pass def clear(self, *args): """ Clear(self: BindingsCollection) Clears the collection of binding objects. """ pass def clear_core(self, *args): """ ClearCore(self: BindingsCollection) Clears the collection of any members. """ pass def memberwise_clone(self, *args): """ MemberwiseClone(self: MarshalByRefObject,cloneIdentity: bool) -> MarshalByRefObject Creates a shallow copy of the current System.MarshalByRefObject object. cloneIdentity: false to delete the current System.MarshalByRefObject object's identity,which will cause the object to be assigned a new identity when it is marshaled across a remoting boundary. A value of false is usually appropriate. true to copy the current System.MarshalByRefObject object's identity to its clone,which will cause remoting client calls to be routed to the remote server object. Returns: A shallow copy of the current System.MarshalByRefObject object. MemberwiseClone(self: object) -> object Creates a shallow copy of the current System.Object. Returns: A shallow copy of the current System.Object. """ pass def on_collection_changed(self, *args): """ OnCollectionChanged(self: BindingsCollection,ccevent: CollectionChangeEventArgs) Raises the System.Windows.Forms.BindingsCollection.CollectionChanged event. ccevent: A System.ComponentModel.CollectionChangeEventArgs that contains the event data. """ pass def on_collection_changing(self, *args): """ OnCollectionChanging(self: BindingsCollection,e: CollectionChangeEventArgs) Raises the System.Windows.Forms.BindingsCollection.CollectionChanging event. e: A System.ComponentModel.CollectionChangeEventArgs that contains event data. """ pass def remove(self, *args): """ Remove(self: BindingsCollection,binding: Binding) Deletes the specified binding from the collection. binding: The Binding to remove from the collection. """ pass def remove_at(self, *args): """ RemoveAt(self: BindingsCollection,index: int) Deletes the binding from the collection at the specified index. index: The index of the System.Windows.Forms.Binding to remove. """ pass def remove_core(self, *args): """ RemoveCore(self: BindingsCollection,dataBinding: Binding) Removes the specified System.Windows.Forms.Binding from the collection. dataBinding: The System.Windows.Forms.Binding to remove. """ pass def should_serialize_my_all(self, *args): """ ShouldSerializeMyAll(self: BindingsCollection) -> bool Gets a value that indicates whether the collection should be serialized. Returns: true if the collection count is greater than zero; otherwise,false. """ pass def __getitem__(self, *args): """ x.__getitem__(y) <==> x[y] """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __iter__(self, *args): """ __iter__(self: IEnumerable) -> object """ pass def __len__(self, *args): """ x.__len__() <==> len(x) """ pass count = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets the total number of bindings in the collection.\n\n\n\nGet: Count(self: BindingsCollection) -> int\n\n\n\n' list = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets the bindings in the collection as an object.\n\n\n\n' collection_changed = None collection_changing = None
def alphabet_position(text): alphabet = {} chars = [chr(x) for x in range(97, 123)] for i in range(len(chars)): alphabet[chars[i]] = str(i+1) return ' '.join([alphabet[x] for x in text.lower() if x in alphabet])
def alphabet_position(text): alphabet = {} chars = [chr(x) for x in range(97, 123)] for i in range(len(chars)): alphabet[chars[i]] = str(i + 1) return ' '.join([alphabet[x] for x in text.lower() if x in alphabet])
""" T="/Users/james/cache/hg18/align/multiz28way/chr10.maf" def test(): s = os.stat( T ).st_size real_f = open( T ) f = filecache.FileCache( real_f, s ) for i in range( 1000 ): f.readline() def test_random_seeking(): s = os.stat( T ).st_size raw = open( T ) f = filecache.FileCache( open( T ), s ) for i in range( 10000 ): seek_to = random.randrange( s ) f.seek( seek_to ) raw.seek( seek_to ) l1 = f.readline() l2 = raw.readline() assert l1 == l2 """
""" T="/Users/james/cache/hg18/align/multiz28way/chr10.maf" def test(): s = os.stat( T ).st_size real_f = open( T ) f = filecache.FileCache( real_f, s ) for i in range( 1000 ): f.readline() def test_random_seeking(): s = os.stat( T ).st_size raw = open( T ) f = filecache.FileCache( open( T ), s ) for i in range( 10000 ): seek_to = random.randrange( s ) f.seek( seek_to ) raw.seek( seek_to ) l1 = f.readline() l2 = raw.readline() assert l1 == l2 """
class HypothesisSpace: def __init__(self, *params, **kw_params): self.hypotheses = self.create_hypothesis_space(*params, **kw_params) def __len__(self): return len(self.hypotheses) def __iter__(self): return self.hypotheses.__iter__() def create_hypothesis_space(self, *params, **kw_params): """ Given lists of parameters, return a list of hypotheses, """ raise NotImplementedError def observe(self, observation): """ Given an observation, return a set of ids which hypothesis of that id is consistent with the observation. """ valid_ids = [] for i in range(len(self.hypotheses)): if self.match(i, observation): valid_ids.append(i) return valid_ids def match(self, i, observation): """ Test if a hypothesis is in consistent with the observation. Return True if it is, False elsewise. """ raise NotImplementedError def execute_on_subspace(self, executor, subset_id): """ Execute the executor on part of the hypothesis space given by the subset_id list. Return a list of answers. """ raise NotImplementedError
class Hypothesisspace: def __init__(self, *params, **kw_params): self.hypotheses = self.create_hypothesis_space(*params, **kw_params) def __len__(self): return len(self.hypotheses) def __iter__(self): return self.hypotheses.__iter__() def create_hypothesis_space(self, *params, **kw_params): """ Given lists of parameters, return a list of hypotheses, """ raise NotImplementedError def observe(self, observation): """ Given an observation, return a set of ids which hypothesis of that id is consistent with the observation. """ valid_ids = [] for i in range(len(self.hypotheses)): if self.match(i, observation): valid_ids.append(i) return valid_ids def match(self, i, observation): """ Test if a hypothesis is in consistent with the observation. Return True if it is, False elsewise. """ raise NotImplementedError def execute_on_subspace(self, executor, subset_id): """ Execute the executor on part of the hypothesis space given by the subset_id list. Return a list of answers. """ raise NotImplementedError
load("@rules_jvm_external//:defs.bzl", "maven_install") load("@rules_jvm_external//:specs.bzl", "maven") def selenium_java_deps(): netty_version = "4.1.63.Final" opentelemetry_version = "1.2.0" maven_install( artifacts = [ "com.beust:jcommander:1.81", "com.github.javaparser:javaparser-core:3.22.0", maven.artifact( group = "com.github.spotbugs", artifact = "spotbugs", version = "4.2.3", exclusions = [ "org.slf4j:slf4j-api", ], ), "com.google.code.gson:gson:2.8.6", "com.google.guava:guava:30.1.1-jre", "com.google.auto:auto-common:1.0", "com.google.auto.service:auto-service:1.0", "com.google.auto.service:auto-service-annotations:1.0", "com.graphql-java:graphql-java:16.2", "io.grpc:grpc-context:1.37.0", "io.lettuce:lettuce-core:6.1.2.RELEASE", "io.netty:netty-buffer:%s" % netty_version, "io.netty:netty-codec-haproxy:%s" % netty_version, "io.netty:netty-codec-http:%s" % netty_version, "io.netty:netty-codec-http2:%s" % netty_version, "io.netty:netty-common:%s" % netty_version, "io.netty:netty-handler:%s" % netty_version, "io.netty:netty-handler-proxy:%s" % netty_version, "io.netty:netty-transport:%s" % netty_version, "io.netty:netty-transport-native-epoll:%s" % netty_version, "io.netty:netty-transport-native-epoll:jar:linux-x86_64:%s" % netty_version, "io.netty:netty-transport-native-kqueue:%s" % netty_version, "io.netty:netty-transport-native-kqueue:jar:osx-x86_64:%s" % netty_version, "io.netty:netty-transport-native-unix-common:%s" % netty_version, "io.opentelemetry:opentelemetry-api:%s" % opentelemetry_version, "io.opentelemetry:opentelemetry-context:%s" % opentelemetry_version, "io.opentelemetry:opentelemetry-exporter-logging:%s" % opentelemetry_version, "io.opentelemetry:opentelemetry-semconv:%s" % opentelemetry_version + "-alpha", "io.opentelemetry:opentelemetry-sdk:%s" % opentelemetry_version, "io.opentelemetry:opentelemetry-sdk-common:%s" % opentelemetry_version, "io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:%s" % opentelemetry_version + "-alpha", "io.opentelemetry:opentelemetry-sdk-testing:%s" % opentelemetry_version, "io.opentelemetry:opentelemetry-sdk-trace:%s" % opentelemetry_version, "io.ous:jtoml:2.0.0", "it.ozimov:embedded-redis:0.7.3", "javax.servlet:javax.servlet-api:4.0.1", maven.artifact( group = "junit", artifact = "junit", version = "4.13.2", exclusions = [ "org.hamcrest:hamcrest-all", "org.hamcrest:hamcrest-core", "org.hamcrest:hamcrest-library", ], ), "net.bytebuddy:byte-buddy:1.11.0", "net.jodah:failsafe:2.4.0", "net.sourceforge.htmlunit:htmlunit-core-js:2.49.0", "org.apache.commons:commons-exec:1.3", "org.assertj:assertj-core:3.19.0", "org.asynchttpclient:async-http-client:2.12.3", "org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5", "org.hamcrest:hamcrest:2.2", "org.hsqldb:hsqldb:2.6.0", "org.mockito:mockito-core:3.10.0", "org.slf4j:slf4j-api:1.7.30", "org.slf4j:slf4j-jdk14:1.7.30", "org.testng:testng:7.4.0", "org.zeromq:jeromq:0.5.2", "xyz.rogfam:littleproxy:2.0.3", "org.seleniumhq.selenium:htmlunit-driver:2.49.1", "org.redisson:redisson:3.15.5", ], excluded_artifacts = [ "org.hamcrest:hamcrest-all", # Replaced by hamcrest 2 "org.hamcrest:hamcrest-core", "io.netty:netty-all", # Depend on the actual things you need ], override_targets = { "org.seleniumhq.selenium:selenium-api": "@//java/client/src/org/openqa/selenium:core", "org.seleniumhq.selenium:selenium-remote-driver": "@//java/client/src/org/openqa/selenium/remote:remote", "org.seleniumhq.selenium:selenium-support": "@//java/client/src/org/openqa/selenium/support", }, fail_on_missing_checksum = True, fail_if_repin_required = True, fetch_sources = True, strict_visibility = True, repositories = [ "https://repo1.maven.org/maven2", "https://maven.google.com", ], maven_install_json = "@selenium//java:maven_install.json", )
load('@rules_jvm_external//:defs.bzl', 'maven_install') load('@rules_jvm_external//:specs.bzl', 'maven') def selenium_java_deps(): netty_version = '4.1.63.Final' opentelemetry_version = '1.2.0' maven_install(artifacts=['com.beust:jcommander:1.81', 'com.github.javaparser:javaparser-core:3.22.0', maven.artifact(group='com.github.spotbugs', artifact='spotbugs', version='4.2.3', exclusions=['org.slf4j:slf4j-api']), 'com.google.code.gson:gson:2.8.6', 'com.google.guava:guava:30.1.1-jre', 'com.google.auto:auto-common:1.0', 'com.google.auto.service:auto-service:1.0', 'com.google.auto.service:auto-service-annotations:1.0', 'com.graphql-java:graphql-java:16.2', 'io.grpc:grpc-context:1.37.0', 'io.lettuce:lettuce-core:6.1.2.RELEASE', 'io.netty:netty-buffer:%s' % netty_version, 'io.netty:netty-codec-haproxy:%s' % netty_version, 'io.netty:netty-codec-http:%s' % netty_version, 'io.netty:netty-codec-http2:%s' % netty_version, 'io.netty:netty-common:%s' % netty_version, 'io.netty:netty-handler:%s' % netty_version, 'io.netty:netty-handler-proxy:%s' % netty_version, 'io.netty:netty-transport:%s' % netty_version, 'io.netty:netty-transport-native-epoll:%s' % netty_version, 'io.netty:netty-transport-native-epoll:jar:linux-x86_64:%s' % netty_version, 'io.netty:netty-transport-native-kqueue:%s' % netty_version, 'io.netty:netty-transport-native-kqueue:jar:osx-x86_64:%s' % netty_version, 'io.netty:netty-transport-native-unix-common:%s' % netty_version, 'io.opentelemetry:opentelemetry-api:%s' % opentelemetry_version, 'io.opentelemetry:opentelemetry-context:%s' % opentelemetry_version, 'io.opentelemetry:opentelemetry-exporter-logging:%s' % opentelemetry_version, 'io.opentelemetry:opentelemetry-semconv:%s' % opentelemetry_version + '-alpha', 'io.opentelemetry:opentelemetry-sdk:%s' % opentelemetry_version, 'io.opentelemetry:opentelemetry-sdk-common:%s' % opentelemetry_version, 'io.opentelemetry:opentelemetry-sdk-extension-autoconfigure:%s' % opentelemetry_version + '-alpha', 'io.opentelemetry:opentelemetry-sdk-testing:%s' % opentelemetry_version, 'io.opentelemetry:opentelemetry-sdk-trace:%s' % opentelemetry_version, 'io.ous:jtoml:2.0.0', 'it.ozimov:embedded-redis:0.7.3', 'javax.servlet:javax.servlet-api:4.0.1', maven.artifact(group='junit', artifact='junit', version='4.13.2', exclusions=['org.hamcrest:hamcrest-all', 'org.hamcrest:hamcrest-core', 'org.hamcrest:hamcrest-library']), 'net.bytebuddy:byte-buddy:1.11.0', 'net.jodah:failsafe:2.4.0', 'net.sourceforge.htmlunit:htmlunit-core-js:2.49.0', 'org.apache.commons:commons-exec:1.3', 'org.assertj:assertj-core:3.19.0', 'org.asynchttpclient:async-http-client:2.12.3', 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5', 'org.hamcrest:hamcrest:2.2', 'org.hsqldb:hsqldb:2.6.0', 'org.mockito:mockito-core:3.10.0', 'org.slf4j:slf4j-api:1.7.30', 'org.slf4j:slf4j-jdk14:1.7.30', 'org.testng:testng:7.4.0', 'org.zeromq:jeromq:0.5.2', 'xyz.rogfam:littleproxy:2.0.3', 'org.seleniumhq.selenium:htmlunit-driver:2.49.1', 'org.redisson:redisson:3.15.5'], excluded_artifacts=['org.hamcrest:hamcrest-all', 'org.hamcrest:hamcrest-core', 'io.netty:netty-all'], override_targets={'org.seleniumhq.selenium:selenium-api': '@//java/client/src/org/openqa/selenium:core', 'org.seleniumhq.selenium:selenium-remote-driver': '@//java/client/src/org/openqa/selenium/remote:remote', 'org.seleniumhq.selenium:selenium-support': '@//java/client/src/org/openqa/selenium/support'}, fail_on_missing_checksum=True, fail_if_repin_required=True, fetch_sources=True, strict_visibility=True, repositories=['https://repo1.maven.org/maven2', 'https://maven.google.com'], maven_install_json='@selenium//java:maven_install.json')
### Noisy DQN Pong_ML-Agents Config ### env = {"name": "pong_mlagent", "train_mode": True} agent = { "name": "noisy", "network": "noisy", "gamma": 0.99, "explore_ratio": 0.1, "buffer_size": 50000, "batch_size": 32, "start_train_step": 25000, "target_update_period": 1000, # noisy "noise_type": "factorized", # [independent, factorized] } optim = { "name": "adam", "lr": 2.5e-4, } train = { "training": True, "load_path": None, "run_step": 200000, "print_period": 5000, "save_period": 50000, "eval_iteration": 10, # distributed setting "update_period": 8, "num_workers": 16, }
env = {'name': 'pong_mlagent', 'train_mode': True} agent = {'name': 'noisy', 'network': 'noisy', 'gamma': 0.99, 'explore_ratio': 0.1, 'buffer_size': 50000, 'batch_size': 32, 'start_train_step': 25000, 'target_update_period': 1000, 'noise_type': 'factorized'} optim = {'name': 'adam', 'lr': 0.00025} train = {'training': True, 'load_path': None, 'run_step': 200000, 'print_period': 5000, 'save_period': 50000, 'eval_iteration': 10, 'update_period': 8, 'num_workers': 16}
class Solution: def preorderTraversal(self, root: TreeNode) -> List[int]: res = [] self.traverse(root, res) return res def traverse(self, root, res) : if not root: return res.append(root.val) self.traverse(root.left, res) self.traverse(root.right, res)
class Solution: def preorder_traversal(self, root: TreeNode) -> List[int]: res = [] self.traverse(root, res) return res def traverse(self, root, res): if not root: return res.append(root.val) self.traverse(root.left, res) self.traverse(root.right, res)
CELERY_BROKER_URL_DOCKER = 'amqp://admin:mypass@rabbit:5672/' CELERY_BROKER_URL_LOCAL = 'amqp://localhost/' CM_REGISTER_Q = 'rpc_queue_CM_register' CM_NAME = 'CM - Heat load profiles' RPC_CM_ALIVE= 'rpc_queue_CM_ALIVE' RPC_Q = 'rpc_queue_CM_compute' # Do no change this value CM_ID = 9 PORT_LOCAL = int('500' + str(CM_ID)) PORT_DOCKER = 80 #TODO*********************************************************************** CELERY_BROKER_URL = CELERY_BROKER_URL_DOCKER PORT = PORT_DOCKER #TODO*********************************************************************** TRANFER_PROTOCOLE ='http://' INPUTS_CALCULATION_MODULE = [ {'input_name': 'Residential heating', 'input_type': 'input', 'input_parameter_name': 'res_heating_share', 'input_value': 0.33, 'input_unit': 'none', 'input_min': 0, 'input_max': 1, 'cm_id': CM_ID }, {'input_name': 'Industry', 'input_type': 'input', 'input_parameter_name': 'industry_share', 'input_value': 0.33, 'input_unit': 'none', 'input_min': 0, 'input_max': 1, 'cm_id': CM_ID }, {'input_name': 'Tertiary heating', 'input_type': 'input', 'input_parameter_name': 'tertiary_share', 'input_value': 0.33, 'input_unit': 'none', 'input_min': 0, 'input_max': 1, 'cm_id': CM_ID } ] SIGNATURE = { "category": "Buildings", "cm_name": CM_NAME, "layers_needed": [ "heat_tot_curr_density", "heat_res_curr_density", "heat_nonres_curr_density", "nuts_id_number", "gfa_res_curr_density", "gfa_nonres_curr_density" ], "vectors_needed": [ # "lp_residential_shw_and_heating_yearlong_2010", # "lp_industry_iron_and_steel_yearlong_2018", # "lp_industry_paper_yearlong_2018", # "lp_industry_non_metalic_minerals_yearlong_2018", # "lp_industry_food_and_tobacco_yearlong_2018", # "lp_industry_chemicals_and_petrochemicals_yearlong_2018" ], "type_layer_needed": [ "nuts_id_number", "heat", "gross_floor_area", "gross_floor_area" ], "cm_url": "Do not add something", "cm_description": "CM generating new load profiles", "cm_id": CM_ID, 'inputs_calculation_module': INPUTS_CALCULATION_MODULE }
celery_broker_url_docker = 'amqp://admin:mypass@rabbit:5672/' celery_broker_url_local = 'amqp://localhost/' cm_register_q = 'rpc_queue_CM_register' cm_name = 'CM - Heat load profiles' rpc_cm_alive = 'rpc_queue_CM_ALIVE' rpc_q = 'rpc_queue_CM_compute' cm_id = 9 port_local = int('500' + str(CM_ID)) port_docker = 80 celery_broker_url = CELERY_BROKER_URL_DOCKER port = PORT_DOCKER tranfer_protocole = 'http://' inputs_calculation_module = [{'input_name': 'Residential heating', 'input_type': 'input', 'input_parameter_name': 'res_heating_share', 'input_value': 0.33, 'input_unit': 'none', 'input_min': 0, 'input_max': 1, 'cm_id': CM_ID}, {'input_name': 'Industry', 'input_type': 'input', 'input_parameter_name': 'industry_share', 'input_value': 0.33, 'input_unit': 'none', 'input_min': 0, 'input_max': 1, 'cm_id': CM_ID}, {'input_name': 'Tertiary heating', 'input_type': 'input', 'input_parameter_name': 'tertiary_share', 'input_value': 0.33, 'input_unit': 'none', 'input_min': 0, 'input_max': 1, 'cm_id': CM_ID}] signature = {'category': 'Buildings', 'cm_name': CM_NAME, 'layers_needed': ['heat_tot_curr_density', 'heat_res_curr_density', 'heat_nonres_curr_density', 'nuts_id_number', 'gfa_res_curr_density', 'gfa_nonres_curr_density'], 'vectors_needed': [], 'type_layer_needed': ['nuts_id_number', 'heat', 'gross_floor_area', 'gross_floor_area'], 'cm_url': 'Do not add something', 'cm_description': 'CM generating new load profiles', 'cm_id': CM_ID, 'inputs_calculation_module': INPUTS_CALCULATION_MODULE}
class Box: def __init__(self, length, width, height): self.length = length self.width = width self.height = height def pack(self, something): print(f"pack {something}")
class Box: def __init__(self, length, width, height): self.length = length self.width = width self.height = height def pack(self, something): print(f'pack {something}')
# This is a python script for adding package information # To modify syntax rule, you must: # 1. modify JavaParser.g4 # 2. Execute `antlr4 JavaParser.g4` # 3. Run this script # import os # os.chdir('./src/main/java/mastery.translator/java') # import subprocess # subprocess.run(['antlr4', 'JavaParser.g4'], stdout=subprocess.PIPE) names = ["JavaParser.java", "JavaParserBaseListener.java", "JavaParserListener.java"] for filename in names: with open(filename, 'r') as f: content = f.read() with open(filename, 'w') as f: f.write('package mastery.translator.java;\n\n') f.write(content)
names = ['JavaParser.java', 'JavaParserBaseListener.java', 'JavaParserListener.java'] for filename in names: with open(filename, 'r') as f: content = f.read() with open(filename, 'w') as f: f.write('package mastery.translator.java;\n\n') f.write(content)
''' Description: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths are there? Note: m and n will be at most 100. Example 1: Input: m = 3, n = 2 Output: 3 Explanation: From the top-left corner, there are a total of 3 ways to reach the bottom-right corner: 1. Right -> Right -> Down 2. Right -> Down -> Right 3. Down -> Right -> Right Example 2: Input: m = 7, n = 3 Output: 28 ''' class Solution: def uniquePaths(self, m: int, n: int) -> int: rows, cols = m, n path_dp = [ [ 1 for j in range(cols)] for i in range(rows) ] # Dynamic Programming relation: # Base case: # DP(0, j) = 1 , only reachable from one step left # DP(i, 0) = 1 , only reachable from one step up # General case: # DP(i,j) = number of path reach to (i, j) # = number of path reach to one step left + number of path reach to one step up # = number of path reach to (i, j-1) + number of path to (i-1, j) # = DP(i, j-1) + DP(i-1, j) for i in range(1, rows): for j in range(1, cols): path_dp[i][j] = path_dp[i][j-1] + path_dp[i-1][j] # Destination coordination = (rows-1, cols-1) return path_dp[rows-1][cols-1] # m, n : dimension of rows and columns ## Time Complexity: O( m * n ) # # The overhead in time is the nested for loops iterating on (i, j), which is of O( m * n) ## Space Complexity: O( m * n ) # # The overhead in space is the storage for table path_dp, which is of O( m * n) def test_bench(): test_data = [(3,2), (7,3), (6,8)] for m, n in test_data: print( Solution().uniquePaths( m, n) ) return if __name__ == '__main__': test_bench()
""" Description: A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). How many possible unique paths are there? Note: m and n will be at most 100. Example 1: Input: m = 3, n = 2 Output: 3 Explanation: From the top-left corner, there are a total of 3 ways to reach the bottom-right corner: 1. Right -> Right -> Down 2. Right -> Down -> Right 3. Down -> Right -> Right Example 2: Input: m = 7, n = 3 Output: 28 """ class Solution: def unique_paths(self, m: int, n: int) -> int: (rows, cols) = (m, n) path_dp = [[1 for j in range(cols)] for i in range(rows)] for i in range(1, rows): for j in range(1, cols): path_dp[i][j] = path_dp[i][j - 1] + path_dp[i - 1][j] return path_dp[rows - 1][cols - 1] def test_bench(): test_data = [(3, 2), (7, 3), (6, 8)] for (m, n) in test_data: print(solution().uniquePaths(m, n)) return if __name__ == '__main__': test_bench()
# Dua buah data yang tersimpan dalam tipe list data1 = [70, 70, 70, 100, 100, 100, 120, 120, 150, 150] data2 = [50, 60, 60, 50, 70, 70, 100, 80, 100, 90] # Definisikan fungsi hitng_rata_rata def hitung_rata_rata(data): jumlah = 0 for item in data: jumlah += item rata_rata = jumlah/len(data) return rata_rata # Hitung nilai rata-rata dari kedua data yang dimiliki print('Rata-rata data1:') print(hitung_rata_rata(data1)) print('Rata-rata data2:') print(hitung_rata_rata(data2))
data1 = [70, 70, 70, 100, 100, 100, 120, 120, 150, 150] data2 = [50, 60, 60, 50, 70, 70, 100, 80, 100, 90] def hitung_rata_rata(data): jumlah = 0 for item in data: jumlah += item rata_rata = jumlah / len(data) return rata_rata print('Rata-rata data1:') print(hitung_rata_rata(data1)) print('Rata-rata data2:') print(hitung_rata_rata(data2))
GITHUB_OAUTH_CLIENT_ID = "XXXXX" GITHUB_OAUTH_CLIENT_SECRET = "XXXXX" GITHUB_TOKEN = "XXXXX" DISQUS_TOKEN = "XXXXX" SECRET_KEY = "XXXXX"
github_oauth_client_id = 'XXXXX' github_oauth_client_secret = 'XXXXX' github_token = 'XXXXX' disqus_token = 'XXXXX' secret_key = 'XXXXX'
# HARD # build 2 stacks store successor and predecssor with O(H) time # merge 2 stack with O(K) time # Time: O(H) class Solution: def closestKValues(self, root: TreeNode, target: float, k: int) -> List[int]: def initSucc(root,tar): large = [] while root: if root.val == tar: large.append(root) break elif root.val > tar: large.append(root) root = root.left else : root = root.right return large def initPrev(root,tar): arr = [] while root: if root.val == tar: arr.append(root) break elif root.val < tar: arr.append(root) root = root.right else: root = root.left return arr def getNextPrev(prev): curr = prev.pop() ret = curr.val curr = curr.left while curr: prev.append(curr) curr = curr.right return ret def getNextSucc(succ): curr = succ.pop() ret = curr.val curr = curr.right while curr: succ.append(curr) curr = curr.left return ret succ,prev = initSucc(root,target),initPrev(root,target) print([r.val for r in prev]) print([r.val for r in succ]) if succ and prev and succ[-1].val == prev[-1].val: getNextPrev(prev) print([r.val for r in prev]) print([r.val for r in succ]) ret = [] while k >0 : if not succ: ret.append(getNextPrev(prev)) elif not prev: ret.append(getNextSucc(succ)) else: succDiff = abs(succ[-1].val - target) prevDiff = abs(prev[-1].val -target) if succDiff < prevDiff: ret.append(getNextSucc(succ)) else: ret.append(getNextPrev(prev)) k-= 1 return ret
class Solution: def closest_k_values(self, root: TreeNode, target: float, k: int) -> List[int]: def init_succ(root, tar): large = [] while root: if root.val == tar: large.append(root) break elif root.val > tar: large.append(root) root = root.left else: root = root.right return large def init_prev(root, tar): arr = [] while root: if root.val == tar: arr.append(root) break elif root.val < tar: arr.append(root) root = root.right else: root = root.left return arr def get_next_prev(prev): curr = prev.pop() ret = curr.val curr = curr.left while curr: prev.append(curr) curr = curr.right return ret def get_next_succ(succ): curr = succ.pop() ret = curr.val curr = curr.right while curr: succ.append(curr) curr = curr.left return ret (succ, prev) = (init_succ(root, target), init_prev(root, target)) print([r.val for r in prev]) print([r.val for r in succ]) if succ and prev and (succ[-1].val == prev[-1].val): get_next_prev(prev) print([r.val for r in prev]) print([r.val for r in succ]) ret = [] while k > 0: if not succ: ret.append(get_next_prev(prev)) elif not prev: ret.append(get_next_succ(succ)) else: succ_diff = abs(succ[-1].val - target) prev_diff = abs(prev[-1].val - target) if succDiff < prevDiff: ret.append(get_next_succ(succ)) else: ret.append(get_next_prev(prev)) k -= 1 return ret
def ex_situ_hardxray(t=1): # samples = ['PLA2','PLA1','CON6','CON5', 'CON4','CON3','CON2','CON1', # '05_Ca_1', '05_Ca_2', '05_UT_1', '05_UT_2', 'PLA6','PLA4','PLA3', # ] # samples = ['B5_1','B5_2','B5_3', 'B6_1','B6_2','B6_3','B7_1','B7_2','B7_3','B12_1','B12_2','B12_3'] # x_list = [45550, 41200, 35600, 25600, 20900, 15400, -1900, -7900, -14000, -24100, -28200, -32700, ] # y_list = [-9300, -9300, -9300, -9300, -9300, -9300, -9300, -9300, -9300, -9300, -9300, -9300] # samples = ['A1_1','A1_2','A1_3', 'A1_4','A2_5','A2_6','A2_7','A2_8','A3_9','A3_10','A3_11','A3_12','A3_13','A3_14','A4_15', 'A4_16', 'A4_17', 'A4_19'] # x_list = [45950, 43250, 37250, 31650, 24400, 18850, 12500, 8000, -3400, -7300, -11300, -16800, -20900, -26400, -33000, -37400, -41900, -45200] # y_list = [3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500, 3500] # samples = ['C8_32', 'C8_33', 'C8_34', 'C8_35', 'C9_36', 'C9_37', 'C9_38', 'C9_39', 'C10_40', 'C10_41', 'C10_42', 'C10_43', # 'C10_44', 'C10_45', 'C11_46', 'C11_47', 'C11_48', 'C11_49', 'C11_50'] # x_list = [43700, 38300, 34000, 27800, 20900, 16200, 12100, 7100, -2700, -6700, -10500, -15700, -20000, # -24200, -29300, -32700, -36700, -41000, -45000] # y_list = [3700, 3700, 3700, 3700, 3700, 3700, 3700, 3700, 3700, 3700, 3700, 3700, 3700, # 3700, 3700, 3700, 3700, 3700, 3700] samples = ['D13_51','D13_52','D13_53','D14_54','D14_55','D14_56','D15_57','D15_58','D15_59','D16_60','D16_61','D16_62','D16_63','D16_64', 'D17_65','D17_66','D17_67'] x_list = [43700, 38400, 34000, 25200, 20000, 15400, 6700, 2500, -2300, -6800, -14000, -19000, -23300, -28500, -34700, -39300, -43600] y_list = [-9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880] # Detectors, motors: dets = [pil1M, pil300KW] waxs_range = np.linspace(13, 0, 3) ypos = [0, 400, 3] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' det_exposure_time(t,t) for wa in waxs_range: yield from bps.mv(waxs, wa) for sam, x, y in zip(samples, x_list, y_list): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) name_fmt = '{sam}_wa{waxs}' sample_name = name_fmt.format(sam=sam, waxs='%2.1f'%wa) sample_id(user_name='OS', sample_name=sample_name) yield from bp.rel_scan(dets, piezo.y, *ypos) sample_id(user_name='test', sample_name='test') det_exposure_time(0.3,0.3) def ex_situ_hardxray_2020_3(t=1): yield from bps.mv(stage.y, 0) yield from bps.mv(stage.th, 0) samples = ['F22_83','F22_84','F22_85','F23_86','F23_87','F23_88','F24_89','F24_90','F24_91','F24_92','F24_93','F24_94','F25_95','F25_96','F25_97','F25_98'] x_list = [45100, 38750, 33500, 26450, 21600, 17300, 7800, 3600, -2300, -7800, -13400, -18500, -28800, -32400, -36700, -42500] y_list = [-1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500] z_list = [ 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700] # Detectors, motors: dets = [pil1M, pil300KW] waxs_range = np.linspace(0, 32.5, 6) ypos = [0, 400, 3] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' det_exposure_time(t,t) for wa in waxs_range: yield from bps.mv(waxs, wa) for sam, x, y, z in zip(samples, x_list, y_list, z_list): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) name_fmt = '{sam}_wa{waxs}' sample_name = name_fmt.format(sam=sam, waxs='%2.1f'%wa) sample_id(user_name='OS', sample_name=sample_name) yield from bp.rel_scan(dets, piezo.y, *ypos) sample_id(user_name='test', sample_name='test') # det_exposure_time(0.3,0.3) yield from bps.mv(stage.th, 1.5) yield from bps.mv(stage.y, -11) samples = ['E18_67','E18_68','E18_69','E19_70','E19_71','E19_72','E19_73','E19_74','E19_75','E20_76','E20_77','E20_78','E21_79','E21_80','E21_81','E22_82'] x_list = [43500, 37500, 32100, 23600, 18350, 13000, 7200, 3300, -450, -9400, -14300, -19400, -25900, -31300, -36200, -43200] y_list = [-9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700] z_list = [ 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200] # Detectors, motors: dets = [pil1M, pil300KW] waxs_range = np.linspace(0, 32.5, 6) ypos = [0, 400, 3] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' det_exposure_time(t,t) for wa in waxs_range: yield from bps.mv(waxs, wa) for sam, x, y, z in zip(samples, x_list, y_list, z_list): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) name_fmt = '{sam}_16.1keV_wa{waxs}' sample_name = name_fmt.format(sam=sam, waxs='%2.1f'%wa) sample_id(user_name='OS', sample_name=sample_name) yield from bp.rel_scan(dets, piezo.y, *ypos) sample_id(user_name='test', sample_name='test') det_exposure_time(0.3,0.3) # def ex_situ_hardxray_2021_1(t=1): # yield from bps.mv(stage.y, 0) # yield from bps.mv(stage.th, 0) # samples = ['F22_83','F22_84','F22_85','F23_86','F23_87','F23_88','F24_89','F24_90','F24_91','F24_92','F24_93','F24_94','F25_95','F25_96','F25_97','F25_98'] # x_list = [45100, 38750, 33500, 26450, 21600, 17300, 7800, 3600, -2300, -7800, -13400, -18500, -28800, -32400, -36700, -42500] # y_list = [-1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500] # z_list = [ 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700] # # Detectors, motors: # dets = [pil1M, pil300KW] # waxs_range = np.linspace(0, 32.5, 6) # ypos = [0, 400, 3] # assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' # assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' # det_exposure_time(t,t) # for wa in waxs_range: # yield from bps.mv(waxs, wa) # for sam, x, y, z in zip(samples, x_list, y_list, z_list): # yield from bps.mv(piezo.x, x) # yield from bps.mv(piezo.y, y) # yield from bps.mv(piezo.z, z) # name_fmt = '{sam}_wa{waxs}' # sample_name = name_fmt.format(sam=sam, waxs='%2.1f'%wa) # sample_id(user_name='OS', sample_name=sample_name) # yield from bp.rel_scan(dets, piezo.y, *ypos) # sample_id(user_name='test', sample_name='test') # # det_exposure_time(0.3,0.3) # yield from bps.mv(stage.th, 1.5) # yield from bps.mv(stage.y, -11) # samples = ['E18_67','E18_68','E18_69','E19_70','E19_71','E19_72','E19_73','E19_74','E19_75','E20_76','E20_77','E20_78','E21_79','E21_80','E21_81','E22_82'] # x_list = [43500, 37500, 32100, 23600, 18350, 13000, 7200, 3300, -450, -9400, -14300, -19400, -25900, -31300, -36200, -43200] # y_list = [-9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700] # z_list = [ 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200] # # Detectors, motors: # dets = [pil1M, pil300KW] # waxs_range = np.linspace(0, 32.5, 6) # ypos = [0, 400, 3] # assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' # assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' # det_exposure_time(t,t) # for wa in waxs_range: # yield from bps.mv(waxs, wa) # for sam, x, y, z in zip(samples, x_list, y_list, z_list): # yield from bps.mv(piezo.x, x) # yield from bps.mv(piezo.y, y) # yield from bps.mv(piezo.z, z) # name_fmt = '{sam}_16.1keV_wa{waxs}' # sample_name = name_fmt.format(sam=sam, waxs='%2.1f'%wa) # sample_id(user_name='OS', sample_name=sample_name) # yield from bp.rel_scan(dets, piezo.y, *ypos) # sample_id(user_name='test', sample_name='test') det_exposure_time(0.3,0.3) def ex_situ_hardxray_2021_1(t=1): yield from bps.mv(stage.th, 0) yield from bps.mv(stage.y, 0) # samples = ['P1_1', 'P1_2', 'P1_3', 'P2_1', 'P2_2', 'P2_3', 'P3_1', 'P3_2', 'P3_3', 'P4_1', 'P4_2', 'P4_3', 'P5_1', 'P5_2', 'P5_3', # 'P6_1', 'P6_2', 'P6_3', 'P7_1', 'P7_2', 'P7_3', 'P8_1', 'P8_2', 'P8_3'] # x_list = [ 45400, 41100, 37500, 32400, 29400, 25900, 20200, 16700, 13100, 6800, 3700, 200, -4600, -8400, -12000, -17200, -20600, # -24000, -29400, -33100, -36200, -40000, -42500, -45500] # y_list = [ -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, # -3000, -3000, -3000, -3000, -3000, -3000, -3000] # z_list = [ 4000, 4000, 4100, 4100, 4200, 4200, 4200, 4200, 4300, 4300, 4400, 4400, 4500, 4500, 4600, 4600, 4700, # 4700, 4800, 4800, 4900, 4900, 5000, 5000] samples = ['N1_1', 'N1_2', 'N1_3', 'N1_4', 'N2_1', 'N2_2', 'N2_3', 'N2_4', 'N3_1', 'N3_2', 'N3_3', 'N4_1', 'N4_2', 'N4_3', 'N5_1', 'N5_2', 'N5_3'] x_list = [ 45300, 41400, 38200, 34700, 29600, 26300, 22900, 18400, 7700, 3100, -1300, -9300, -14200, -19600, -28600, -35100, -41200] y_list = [ -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500] z_list = [ 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500] # Detectors, motors: dets = [pil1M, pil300KW] waxs_range = np.linspace(0, 32.5, 6) ypos = [0, 400, 3] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' det_exposure_time(t,t) for wa in waxs_range: yield from bps.mv(waxs, wa) for sam, x, y, z in zip(samples, x_list, y_list, z_list): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) name_fmt = '{sam}_wa{waxs}_sdd8.3m_16.1keV' sample_name = name_fmt.format(sam=sam, waxs='%2.1f'%wa) sample_id(user_name='OS', sample_name=sample_name) yield from bp.rel_scan(dets, piezo.y, *ypos) sample_id(user_name='test', sample_name='test') det_exposure_time(0.3,0.3) # yield from bps.mv(stage.th, 2.5) # yield from bps.mv(stage.y, -13) # samples = ['R1_1', 'R1_2', 'R1_3', 'R2_1', 'R2_2', 'R2_3', 'R3_1', 'R3_2', 'R3_3', 'R4_1', 'R4_2', 'R4_3', 'R5_1', 'R5_2', 'R5_3'] # x_list = [ 44800, 40300, 34800, 24800, 18800, 12300, 4000, -1700, -7800, -13700, -20700, -27700, -33200, -38200, -43400] # y_list = [ -9500, -9500, -9500, -9500, -9500, -9500, -9500, -9500, -9500, -9500, -9500, -9500, -9500, -9500, -9500] # z_list = [ 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000, 3000] # for wa in waxs_range: # yield from bps.mv(waxs, wa) # for sam, x, y, z in zip(samples, x_list, y_list, z_list): # yield from bps.mv(piezo.x, x) # yield from bps.mv(piezo.y, y) # yield from bps.mv(piezo.z, z) # name_fmt = '{sam}_wa{waxs}_sdd8.3m_16.1keV' # sample_name = name_fmt.format(sam=sam, waxs='%2.1f'%wa) # sample_id(user_name='OS', sample_name=sample_name) # yield from bp.rel_scan(dets, piezo.y, *ypos) # sample_id(user_name='test', sample_name='test') # det_exposure_time(0.3,0.3) def run_saxs_nexafs(t=1): yield from waxs_prep_multisample_nov(t=0.5) # yield from bps.sleep(10) # yield from nexafs_prep_multisample_nov(t=1) def saxs_prep_multisample_nov(t=1): dets = [pil1M] energies = [4030, 4040, 4050, 4055, 4065, 4075, 4105] det_exposure_time(t,t) name_fmt = '{sample}_{energy}eV_pos{posi}_wa{wa}_xbpm{xbpm}' waxs_range = [32.5] ypos = [0, 400, 3] for wa in waxs_range: yield from bps.mv(waxs, wa) yield from bps.mv(stage.th, 3.5) yield from bps.mv(stage.y, -13) # samples = ['K5-6', 'K5-5', 'K5-4', 'K5-3', 'K5-2', 'K5-1', 'K4-3', 'K4-2', 'K4-1', 'K3-3', 'K3-2', 'K3-1', 'K2-3', 'K2-2', 'K2-1', 'K1-3', 'K1-2', 'K1-1'] # x_list = [41400, 37700,34300,26750,23800,20600,1700,-2100,-5300,-10200,-14150,-19200,-27500,-32000,-37500,-41100,-45800,-49400] # y_list = [-9500, -9500,-9500,-9500,-9500,-9500,-9500,-9500,-9500,-9500, -9500, -9500, -9500, -9500, -9500, -9500, -9700, -9500] # z_list = [ 5500, 5500, 5400, 5300, 5200, 5100, 5000, 4900, 4800, 4700, 4600, 4500, 4400, 4300, 4200, 4100, 4000, 3900] # samples = ['M14-1', 'M14-2', 'M14-3', 'M15-1', 'M15-2', 'M15-3', 'M16-1', 'M16-2', 'M16-3', 'M17-1', 'M17-2', 'M17-3', 'M18-1', 'M18-2', 'M18-3', 'M18-4', 'M18-5'] # x_list = [ 46900, 44500, 41500, 31900, 27300, 22750, 12750, 10500, 7800, -2800, -4900, -9100, -17400, -20800, -23800, -26550, -29950] # y_list = [ -8500, -8500, -8500, -8500, -8500, -8500, -8500, -8500, -8500, -8100, -8500, -8500, -8500, -8500, -8500, -8500, -8500] # z_list = [ 4800, 4800, 4700, 4600, 4500, 4500, 4400, 4300, 4200, 4100, 4100, 4000, 3900, 3800, 3800, 3700, 3600] samples = [ 'M16-2', 'M16-3', 'M17-1', 'M17-2', 'M17-3', 'M18-1', 'M18-2', 'M18-3', 'M18-4', 'M18-5'] x_list = [ 10500, 7800, -2800, -4900, -9100, -17400, -20800, -23800, -26550, -29950] y_list = [ -8500, -8500, -8100, -8500, -8500, -8500, -8500, -8500, -8500, -8500] z_list = [ 4300, 4200, 4100, 4100, 4000, 3900, 3800, 3800, 3700, 3600] for x, y, z, name in zip(x_list, y_list, z_list, samples): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) for k, e in enumerate(energies): yield from bps.mv(energy, e) yield from bps.sleep(3) name_fmt = '{sample}_{energy}eV_5m_xbpm{xbpm}_wa{wa}' sample_name = name_fmt.format(sample=name, energy=e, xbpm = '%3.1f'%xbpm3.sumY.value, wa='%2.1f'%wa) sample_id(user_name='OS', sample_name=sample_name) print(f'\n\t=== Sample: {sample_name} ===\n') yield from bp.rel_scan(dets, piezo.y, *ypos) yield from bps.mv(energy, 4080) yield from bps.mv(energy, 4055) yield from bps.mv(energy, 4030) # for wa in waxs_range: # yield from bps.mv(waxs, wa) # yield from bps.mv(stage.y, 0) # yield from bps.mv(stage.th, 0) # samples = ['L13-3', 'L13-2', 'L13-1', 'L12-3', 'L12-2', 'L12-1', 'L11-3', 'L11-2', 'L11-1', 'L10-3', 'L10-2', 'L10-1', 'L9-3', 'L9-2', 'L9-1', 'L8-3', 'L8-2', # 'L8-1', 'L7-3', 'L7-2', 'L7-1', 'L6-3', 'L6-2', 'L6-1'] # x_list = [40600, 37500, 34500, 29400, 25600, 22300, 17100, 14250, 10800, 5900, 3450, 550, -5050, -7250, -9100, -13900,-16200,-18500,-22300,-24700,-27050, # -34800, -38450, -42250] # y_list = [-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, # -1000, -1000, -1000] # z_list = [ 5400, 5400, 5300, 5200, 5100, 5000, 4900, 4800, 4700, 4600, 4500, 4400, 4300, 4200, 4100, 4000, 3900, 3800, 3700, 3600, 3500, # 3300, 3400, 3300] # assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' # assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' # assert len(x_list) == len(z_list), f'Number of X coordinates ({len(x_list)}) is different from number of z coord ({len(z_list)})' # for x, y, z, name in zip(x_list, y_list, z_list, samples): # yield from bps.mv(piezo.x, x) # yield from bps.mv(piezo.y, y) # yield from bps.mv(piezo.z, z) # for k, e in enumerate(energies): # yield from bps.mv(energy, e) # yield from bps.sleep(3) # name_fmt = '{sample}_{energy}eV_xbpm{xbpm}_wa{wa}' # sample_name = name_fmt.format(sample=name, energy=e, xbpm = '%3.1f'%xbpm3.sumY.value, wa='%2.1f'%wa) # sample_id(user_name='OS', sample_name=sample_name) # print(f'\n\t=== Sample: {sample_name} ===\n') # yield from bp.rel_scan(dets, piezo.y, *ypos) # yield from bps.mv(energy, 4080) # yield from bps.mv(energy, 4055) # yield from bps.mv(energy, 4030) sample_id(user_name='test', sample_name='test') det_exposure_time(0.3,0.3) def waxs_prep_multisample_nov(t=1): dets = [pil300KW] energies = [4030, 4040, 4050, 4055, 4065, 4075, 4105] det_exposure_time(t,t) name_fmt = '{sample}_{energy}eV_pos{posi}_wa{wa}_xbpm{xbpm}' waxs_range = [0, 6.5, 13.0, 19.5, 26, 32.5, 39.0, 45.5] ypos = [0, 400, 3] # for wa in waxs_range: # yield from bps.mv(waxs, wa) # yield from bps.mv(stage.th, 3.5) # yield from bps.mv(stage.y, -13) # # samples = ['K5-6', 'K5-5', 'K5-4', 'K5-3', 'K5-2', 'K5-1', 'K4-3', 'K4-2', 'K4-1', 'K3-3', 'K3-2', 'K3-1', 'K2-3', 'K2-2', 'K2-1', 'K1-3', 'K1-2', 'K1-1'] # # x_list = [41400, 37700,34300,26750,23800,20600,1700,-2100,-5300,-10200,-14150,-19200,-27500,-32000,-37500,-41100,-45800,-49400] # # y_list = [-9500, -9500,-9500,-9500,-9500,-9500,-9500,-9500,-9500,-9500, -9500, -9500, -9500, -9500, -9500, -9500, -9700, -9500] # # z_list = [ 5500, 5500, 5400, 5300, 5200, 5100, 5000, 4900, 4800, 4700, 4600, 4500, 4400, 4300, 4200, 4100, 4000, 3900] # samples = ['M14-1', 'M14-2', 'M14-3', 'M15-1', 'M15-2', 'M15-3', 'M16-1', 'M16-2', 'M16-3', 'M17-1', 'M17-2', 'M17-3', 'M18-1', 'M18-2', 'M18-3', 'M18-4', 'M18-5'] # x_list = [ 46900, 44500, 41500, 31900, 27300, 22750, 12750, 10500, 7800, -2800, -4900, -9100, -17400, -20800, -23800, -26550, -29950] # y_list = [ -8500, -8500, -8500, -8500, -8500, -8500, -8500, -8500, -8500, -8100, -8500, -8500, -8500, -8500, -8500, -8500, -8500] # z_list = [ 4800, 4800, 4700, 4600, 4500, 4500, 4400, 4300, 4200, 4100, 4100, 4000, 3900, 3800, 3800, 3700, 3600] # for x, y, z, name in zip(x_list, y_list, z_list, samples): # yield from bps.mv(piezo.x, x) # yield from bps.mv(piezo.y, y) # yield from bps.mv(piezo.z, z) # for k, e in enumerate(energies): # yield from bps.mv(energy, e) # yield from bps.sleep(3) # name_fmt = '{sample}_{energy}eV_xbpm{xbpm}_wa{wa}' # sample_name = name_fmt.format(sample=name, energy=e, xbpm = '%3.1f'%xbpm3.sumY.value, wa='%2.1f'%wa) # sample_id(user_name='OS', sample_name=sample_name) # print(f'\n\t=== Sample: {sample_name} ===\n') # yield from bp.rel_scan(dets, piezo.y, *ypos) # yield from bps.mv(energy, 4080) # yield from bps.mv(energy, 4055) # yield from bps.mv(energy, 4030) # energies = [4030, 4040, 4050, 4055, 4065, 4075, 4105] # waxs_range = [0, 6.5, 13.0, 19.5, 26, 32.5, 39.0, 45.5] # for wa in waxs_range: # yield from bps.mv(waxs, wa) # yield from bps.mv(stage.y, 0) # yield from bps.mv(stage.th, 0) # # samples = ['L13-3', 'L13-2', 'L13-1', 'L12-3', 'L12-2', 'L12-1', 'L11-3', 'L11-2', 'L11-1', 'L10-3', 'L10-2', 'L10-1', 'L9-3', 'L9-2', 'L9-1', 'L8-3', 'L8-2', # # 'L8-1', 'L7-3', 'L7-2', 'L7-1', 'L6-3', 'L6-2', 'L6-1'] # # x_list = [40600, 37500, 34500, 29400, 25600, 22300, 17100, 14250, 10800, 5900, 3450, 550, -5050, -7250, -9100, -13900,-16200,-18500,-22300,-24700,-27050, # # -34800, -38450, -42250] # # y_list = [-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, # # -1000, -1000, -1000] # # z_list = [ 5400, 5400, 5300, 5200, 5100, 5000, 4900, 4800, 4700, 4600, 4500, 4400, 4300, 4200, 4100, 4000, 3900, 3800, 3700, 3600, 3500, # # 3300, 3400, 3300] # samples = [ 'P1', 'P2', 'E1', 'E2', 'PG1', 'PG2'] # x_list = [11400, 6200, 200, -5200, -13200, -26200] # y_list = [-1000, -900, -900, -700, -1300, -1300] # z_list = [ 4500, 4300, 4200, 4100, 4000, 4000] # assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' # assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' # assert len(x_list) == len(z_list), f'Number of X coordinates ({len(x_list)}) is different from number of z coord ({len(z_list)})' # for x, y, z, name in zip(x_list, y_list, z_list, samples): # yield from bps.mv(piezo.x, x) # yield from bps.mv(piezo.y, y) # yield from bps.mv(piezo.z, z) # for k, e in enumerate(energies): # yield from bps.mv(energy, e) # yield from bps.sleep(3) # name_fmt = '{sample}_{energy}eV_xbpm{xbpm}_wa{wa}' # sample_name = name_fmt.format(sample=name, energy=e, xbpm = '%3.1f'%xbpm3.sumY.value, wa='%2.1f'%wa) # sample_id(user_name='OS', sample_name=sample_name) # print(f'\n\t=== Sample: {sample_name} ===\n') # yield from bp.rel_scan(dets, piezo.y, *ypos) # yield from bps.mv(energy, 4080) # yield from bps.mv(energy, 4055) # yield from bps.mv(energy, 4030) energies = np.arange(4030, 4040, 5).tolist() + np.arange(4040, 4060, 0.5).tolist() + np.arange(4060, 4080, 2).tolist() + np.arange(4080, 4150, 5).tolist() # waxs_range = [0, 6.5, 13.0, 19.5, 26, 32.5, 39.0, 45.5] waxs_range = [6.5] for wa in waxs_range: yield from bps.mv(waxs, wa) yield from bps.mv(stage.y, 0) yield from bps.mv(stage.th, 0) # samples = [ 'U1', 'U2', 'Ca1', 'Ca2'] # x_list = [43000, 31000, -36500, -44000] # y_list = [ -700, -700, -900, -900] # z_list = [ 4600, 4600, 3600, 3600] samples = [ 'Ca2'] x_list = [ -44000] y_list = [ -900] z_list = [ 3600] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' assert len(x_list) == len(z_list), f'Number of X coordinates ({len(x_list)}) is different from number of z coord ({len(z_list)})' for x, y, z, name in zip(x_list, y_list, z_list, samples): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) for k, e in enumerate(energies): yield from bps.mv(energy, e) yield from bps.sleep(3) name_fmt = '{sample}_{energy}eV_xbpm{xbpm}_wa{wa}' sample_name = name_fmt.format(sample=name, energy=e, xbpm = '%3.1f'%xbpm3.sumY.value, wa='%2.1f'%wa) sample_id(user_name='OS', sample_name=sample_name) print(f'\n\t=== Sample: {sample_name} ===\n') yield from bp.rel_scan(dets, piezo.y, *ypos) yield from bps.mv(energy, 4120) yield from bps.mv(energy, 4090) yield from bps.mv(energy, 4060) yield from bps.mv(energy, 4030) sample_id(user_name='test', sample_name='test') det_exposure_time(0.3,0.3) def nexafs_prep_multisample_nov(t=1): # samples = ['K5-6', 'K5-5', 'K5-4', 'K5-3', 'K5-2', 'K5-1', 'K4-3', 'K4-2', 'K4-1', 'K3-3', 'K3-2', 'K3-1', 'K2-3', 'K2-2', 'K2-1', 'K1-3', 'K1-2', 'K1-1'] # x_list = [41400, 37700, 34300, 26750, 23800, 20600, 1700, -2100, -5300, -10200,-14150,-19200,-27500,-32000,-37500,-41100,-45800,-49400] # y_list = [-9500, -9500, -9500, -9500, -9500, -9500, -9500,- 9500, -9500,-9500, -9500, -9500, -9500, -9500, -9500, -9500, -9700, -9500] # z_list = [ 5500, 5500, 5400, 5300, 5200, 5100, 5000, 4900, 4800, 4700, 4600, 4500, 4400, 4300, 4200, 4100, 4000, 3900] yield from bps.mv(stage.th, 3.5) yield from bps.mv(stage.y, -13) samples = ['M14-1', 'M14-2', 'M14-3', 'M15-1', 'M15-2', 'M15-3', 'M16-1', 'M16-2', 'M16-3', 'M17-1', 'M17-2', 'M17-3', 'M18-1', 'M18-2', 'M18-3', 'M18-4', 'M18-5'] x_list = [ 46900, 44500, 41500, 31900, 27300, 22750, 12750, 10500, 7800, -2800, -4900, -9100, -17400, -20800, -23800, -26550, -29950] y_list = [ -8500, -8500, -8500, -8500, -8500, -8500, -8500, -8500, -8500, -8100, -8500, -8500, -8500, -8500, -8500, -8500, -8500] z_list = [ 4800, 4800, 4700, 4600, 4500, 4500, 4400, 4300, 4200, 4100, 4100, 4000, 3900, 3800, 3800, 3700, 3600] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' assert len(x_list) == len(z_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(z_list)})' for x, y, z, name in zip(x_list, y_list, z_list, samples): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) yield from NEXAFS_Ca_edge_multi(t=t, name=name) yield from bps.mv(stage.y, 0) yield from bps.mv(stage.th, 0) # samples = ['L13-3', 'L13-2', 'L13-1', 'L12-3', 'L12-2', 'L12-1', 'L11-3', 'L11-2', 'L11-1', 'L10-3', 'L10-2', 'L10-1', 'L9-3', 'L9-2', 'L9-1', 'L8-3', 'L8-2', # 'L8-1', 'L7-3', 'L7-2', 'L7-1', 'L6-3', 'L6-2', 'L6-1'] # x_list = [40600, 37500, 34500, 29400, 25600, 22300, 17100, 14250, 10800, 5900, 3450, 550, -5050, -7250, -9100, -13900,-16200,-18500,-22300,-24700,-27050, # -34800, -38450, -42250] # y_list = [-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, # -1000, -1000, -1000] # z_list = [ 5400, 5400, 5300, 5200, 5100, 5000, 4900, 4800, 4700, 4600, 4500, 4400, 4300, 4200, 4100, 4000, 3900, 3800, 3700, 3600, 3500, # 3300, 3400, 3300] samples = [ 'C1', 'C2', 'P1', 'P2', 'E1', 'E2', 'PG1', 'PG2'] x_list = [21800, 16500, 11400, 6200, 200, -5200, -13200, -26200] y_list = [ -900, -700, -800, -700, -700, -500, -1100, -1100] z_list = [ 4600, 4600, 4500, 4300, 4200, 4100, 4000, 4000] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' assert len(x_list) == len(z_list), f'Number of X coordinates ({len(x_list)}) is different from number of z coord ({len(z_list)})' for x, y, z, name in zip(x_list, y_list, z_list, samples): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) yield from NEXAFS_Ca_edge_multi(t=t, name=name) # sample_id(user_name='test', sample_name='test') # yield from bps.mv(att2_11, 'Insert') # yield from bps.mv(GV7.open_cmd, 1 ) # yield from bps.sleep(2) # yield from bps.mv(att2_11, 'Insert') # yield from bps.mv(GV7.open_cmd, 1 ) def NEXAFS_Ca_edge_multi(t=0.5, name='test'): yield from bps.mv(waxs, 52) dets = [pil300KW] energies = np.linspace(4030, 4150, 121) det_exposure_time(t,t) name_fmt = 'nexafs_{sample}_{energy}eV_xbpm{xbpm}' for e in energies: yield from bps.mv(energy, e) yield from bps.sleep(3) sample_name = name_fmt.format(sample=name, energy=e, xbpm = '%3.1f'%xbpm3.sumY.value) RE.md['filename_amptek'] = sample_name sample_id(user_name='OS', sample_name=sample_name) print(f'\n\t=== Sample: {sample_name} ===\n') yield from bp.count(dets, num=1) yield from bps.mv(energy, 4125) yield from bps.mv(energy, 4100) yield from bps.mv(energy, 4075) yield from bps.mv(energy, 4050) yield from bps.mv(energy, 4030) sample_id(user_name='test', sample_name='test')
def ex_situ_hardxray(t=1): samples = ['D13_51', 'D13_52', 'D13_53', 'D14_54', 'D14_55', 'D14_56', 'D15_57', 'D15_58', 'D15_59', 'D16_60', 'D16_61', 'D16_62', 'D16_63', 'D16_64', 'D17_65', 'D17_66', 'D17_67'] x_list = [43700, 38400, 34000, 25200, 20000, 15400, 6700, 2500, -2300, -6800, -14000, -19000, -23300, -28500, -34700, -39300, -43600] y_list = [-9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880, -9880] dets = [pil1M, pil300KW] waxs_range = np.linspace(13, 0, 3) ypos = [0, 400, 3] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' det_exposure_time(t, t) for wa in waxs_range: yield from bps.mv(waxs, wa) for (sam, x, y) in zip(samples, x_list, y_list): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) name_fmt = '{sam}_wa{waxs}' sample_name = name_fmt.format(sam=sam, waxs='%2.1f' % wa) sample_id(user_name='OS', sample_name=sample_name) yield from bp.rel_scan(dets, piezo.y, *ypos) sample_id(user_name='test', sample_name='test') det_exposure_time(0.3, 0.3) def ex_situ_hardxray_2020_3(t=1): yield from bps.mv(stage.y, 0) yield from bps.mv(stage.th, 0) samples = ['F22_83', 'F22_84', 'F22_85', 'F23_86', 'F23_87', 'F23_88', 'F24_89', 'F24_90', 'F24_91', 'F24_92', 'F24_93', 'F24_94', 'F25_95', 'F25_96', 'F25_97', 'F25_98'] x_list = [45100, 38750, 33500, 26450, 21600, 17300, 7800, 3600, -2300, -7800, -13400, -18500, -28800, -32400, -36700, -42500] y_list = [-1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500, -1500] z_list = [2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700, 2700] dets = [pil1M, pil300KW] waxs_range = np.linspace(0, 32.5, 6) ypos = [0, 400, 3] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' det_exposure_time(t, t) for wa in waxs_range: yield from bps.mv(waxs, wa) for (sam, x, y, z) in zip(samples, x_list, y_list, z_list): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) name_fmt = '{sam}_wa{waxs}' sample_name = name_fmt.format(sam=sam, waxs='%2.1f' % wa) sample_id(user_name='OS', sample_name=sample_name) yield from bp.rel_scan(dets, piezo.y, *ypos) sample_id(user_name='test', sample_name='test') yield from bps.mv(stage.th, 1.5) yield from bps.mv(stage.y, -11) samples = ['E18_67', 'E18_68', 'E18_69', 'E19_70', 'E19_71', 'E19_72', 'E19_73', 'E19_74', 'E19_75', 'E20_76', 'E20_77', 'E20_78', 'E21_79', 'E21_80', 'E21_81', 'E22_82'] x_list = [43500, 37500, 32100, 23600, 18350, 13000, 7200, 3300, -450, -9400, -14300, -19400, -25900, -31300, -36200, -43200] y_list = [-9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700, -9700] z_list = [4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200, 4200] dets = [pil1M, pil300KW] waxs_range = np.linspace(0, 32.5, 6) ypos = [0, 400, 3] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' det_exposure_time(t, t) for wa in waxs_range: yield from bps.mv(waxs, wa) for (sam, x, y, z) in zip(samples, x_list, y_list, z_list): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) name_fmt = '{sam}_16.1keV_wa{waxs}' sample_name = name_fmt.format(sam=sam, waxs='%2.1f' % wa) sample_id(user_name='OS', sample_name=sample_name) yield from bp.rel_scan(dets, piezo.y, *ypos) sample_id(user_name='test', sample_name='test') det_exposure_time(0.3, 0.3) det_exposure_time(0.3, 0.3) def ex_situ_hardxray_2021_1(t=1): yield from bps.mv(stage.th, 0) yield from bps.mv(stage.y, 0) samples = ['N1_1', 'N1_2', 'N1_3', 'N1_4', 'N2_1', 'N2_2', 'N2_3', 'N2_4', 'N3_1', 'N3_2', 'N3_3', 'N4_1', 'N4_2', 'N4_3', 'N5_1', 'N5_2', 'N5_3'] x_list = [45300, 41400, 38200, 34700, 29600, 26300, 22900, 18400, 7700, 3100, -1300, -9300, -14200, -19600, -28600, -35100, -41200] y_list = [-2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500, -2500] z_list = [4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500, 4500] dets = [pil1M, pil300KW] waxs_range = np.linspace(0, 32.5, 6) ypos = [0, 400, 3] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' det_exposure_time(t, t) for wa in waxs_range: yield from bps.mv(waxs, wa) for (sam, x, y, z) in zip(samples, x_list, y_list, z_list): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) name_fmt = '{sam}_wa{waxs}_sdd8.3m_16.1keV' sample_name = name_fmt.format(sam=sam, waxs='%2.1f' % wa) sample_id(user_name='OS', sample_name=sample_name) yield from bp.rel_scan(dets, piezo.y, *ypos) sample_id(user_name='test', sample_name='test') det_exposure_time(0.3, 0.3) def run_saxs_nexafs(t=1): yield from waxs_prep_multisample_nov(t=0.5) def saxs_prep_multisample_nov(t=1): dets = [pil1M] energies = [4030, 4040, 4050, 4055, 4065, 4075, 4105] det_exposure_time(t, t) name_fmt = '{sample}_{energy}eV_pos{posi}_wa{wa}_xbpm{xbpm}' waxs_range = [32.5] ypos = [0, 400, 3] for wa in waxs_range: yield from bps.mv(waxs, wa) yield from bps.mv(stage.th, 3.5) yield from bps.mv(stage.y, -13) samples = ['M16-2', 'M16-3', 'M17-1', 'M17-2', 'M17-3', 'M18-1', 'M18-2', 'M18-3', 'M18-4', 'M18-5'] x_list = [10500, 7800, -2800, -4900, -9100, -17400, -20800, -23800, -26550, -29950] y_list = [-8500, -8500, -8100, -8500, -8500, -8500, -8500, -8500, -8500, -8500] z_list = [4300, 4200, 4100, 4100, 4000, 3900, 3800, 3800, 3700, 3600] for (x, y, z, name) in zip(x_list, y_list, z_list, samples): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) for (k, e) in enumerate(energies): yield from bps.mv(energy, e) yield from bps.sleep(3) name_fmt = '{sample}_{energy}eV_5m_xbpm{xbpm}_wa{wa}' sample_name = name_fmt.format(sample=name, energy=e, xbpm='%3.1f' % xbpm3.sumY.value, wa='%2.1f' % wa) sample_id(user_name='OS', sample_name=sample_name) print(f'\n\t=== Sample: {sample_name} ===\n') yield from bp.rel_scan(dets, piezo.y, *ypos) yield from bps.mv(energy, 4080) yield from bps.mv(energy, 4055) yield from bps.mv(energy, 4030) sample_id(user_name='test', sample_name='test') det_exposure_time(0.3, 0.3) def waxs_prep_multisample_nov(t=1): dets = [pil300KW] energies = [4030, 4040, 4050, 4055, 4065, 4075, 4105] det_exposure_time(t, t) name_fmt = '{sample}_{energy}eV_pos{posi}_wa{wa}_xbpm{xbpm}' waxs_range = [0, 6.5, 13.0, 19.5, 26, 32.5, 39.0, 45.5] ypos = [0, 400, 3] energies = np.arange(4030, 4040, 5).tolist() + np.arange(4040, 4060, 0.5).tolist() + np.arange(4060, 4080, 2).tolist() + np.arange(4080, 4150, 5).tolist() waxs_range = [6.5] for wa in waxs_range: yield from bps.mv(waxs, wa) yield from bps.mv(stage.y, 0) yield from bps.mv(stage.th, 0) samples = ['Ca2'] x_list = [-44000] y_list = [-900] z_list = [3600] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' assert len(x_list) == len(z_list), f'Number of X coordinates ({len(x_list)}) is different from number of z coord ({len(z_list)})' for (x, y, z, name) in zip(x_list, y_list, z_list, samples): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) for (k, e) in enumerate(energies): yield from bps.mv(energy, e) yield from bps.sleep(3) name_fmt = '{sample}_{energy}eV_xbpm{xbpm}_wa{wa}' sample_name = name_fmt.format(sample=name, energy=e, xbpm='%3.1f' % xbpm3.sumY.value, wa='%2.1f' % wa) sample_id(user_name='OS', sample_name=sample_name) print(f'\n\t=== Sample: {sample_name} ===\n') yield from bp.rel_scan(dets, piezo.y, *ypos) yield from bps.mv(energy, 4120) yield from bps.mv(energy, 4090) yield from bps.mv(energy, 4060) yield from bps.mv(energy, 4030) sample_id(user_name='test', sample_name='test') det_exposure_time(0.3, 0.3) def nexafs_prep_multisample_nov(t=1): yield from bps.mv(stage.th, 3.5) yield from bps.mv(stage.y, -13) samples = ['M14-1', 'M14-2', 'M14-3', 'M15-1', 'M15-2', 'M15-3', 'M16-1', 'M16-2', 'M16-3', 'M17-1', 'M17-2', 'M17-3', 'M18-1', 'M18-2', 'M18-3', 'M18-4', 'M18-5'] x_list = [46900, 44500, 41500, 31900, 27300, 22750, 12750, 10500, 7800, -2800, -4900, -9100, -17400, -20800, -23800, -26550, -29950] y_list = [-8500, -8500, -8500, -8500, -8500, -8500, -8500, -8500, -8500, -8100, -8500, -8500, -8500, -8500, -8500, -8500, -8500] z_list = [4800, 4800, 4700, 4600, 4500, 4500, 4400, 4300, 4200, 4100, 4100, 4000, 3900, 3800, 3800, 3700, 3600] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' assert len(x_list) == len(z_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(z_list)})' for (x, y, z, name) in zip(x_list, y_list, z_list, samples): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) yield from nexafs__ca_edge_multi(t=t, name=name) yield from bps.mv(stage.y, 0) yield from bps.mv(stage.th, 0) samples = ['C1', 'C2', 'P1', 'P2', 'E1', 'E2', 'PG1', 'PG2'] x_list = [21800, 16500, 11400, 6200, 200, -5200, -13200, -26200] y_list = [-900, -700, -800, -700, -700, -500, -1100, -1100] z_list = [4600, 4600, 4500, 4300, 4200, 4100, 4000, 4000] assert len(x_list) == len(samples), f'Number of X coordinates ({len(x_list)}) is different from number of samples ({len(samples)})' assert len(x_list) == len(y_list), f'Number of X coordinates ({len(x_list)}) is different from number of Y coord ({len(y_list)})' assert len(x_list) == len(z_list), f'Number of X coordinates ({len(x_list)}) is different from number of z coord ({len(z_list)})' for (x, y, z, name) in zip(x_list, y_list, z_list, samples): yield from bps.mv(piezo.x, x) yield from bps.mv(piezo.y, y) yield from bps.mv(piezo.z, z) yield from nexafs__ca_edge_multi(t=t, name=name) def nexafs__ca_edge_multi(t=0.5, name='test'): yield from bps.mv(waxs, 52) dets = [pil300KW] energies = np.linspace(4030, 4150, 121) det_exposure_time(t, t) name_fmt = 'nexafs_{sample}_{energy}eV_xbpm{xbpm}' for e in energies: yield from bps.mv(energy, e) yield from bps.sleep(3) sample_name = name_fmt.format(sample=name, energy=e, xbpm='%3.1f' % xbpm3.sumY.value) RE.md['filename_amptek'] = sample_name sample_id(user_name='OS', sample_name=sample_name) print(f'\n\t=== Sample: {sample_name} ===\n') yield from bp.count(dets, num=1) yield from bps.mv(energy, 4125) yield from bps.mv(energy, 4100) yield from bps.mv(energy, 4075) yield from bps.mv(energy, 4050) yield from bps.mv(energy, 4030) sample_id(user_name='test', sample_name='test')
class Sources: ''' source class that defines the news source ''' def __init__(self,id,name,description,url,category,language,country): self.id=id self.name=name self.description=description self.url=url self.category=category self.language=language self.country=country class Article: ''' Article class that defines the articles objects ''' def __init__(self,author,title,description,url,urlToImage,publishedAt,content): self.author=author self.title=title self.description=description self.url=url self.urlToImage=urlToImage self.publishedAt=publishedAt self.content=content
class Sources: """ source class that defines the news source """ def __init__(self, id, name, description, url, category, language, country): self.id = id self.name = name self.description = description self.url = url self.category = category self.language = language self.country = country class Article: """ Article class that defines the articles objects """ def __init__(self, author, title, description, url, urlToImage, publishedAt, content): self.author = author self.title = title self.description = description self.url = url self.urlToImage = urlToImage self.publishedAt = publishedAt self.content = content
class Solution: def smallestRangeII(self, A, K): """ :type A: List[int] :type K: int :rtype: int """ # + 0 or 2 * K # to which index: add 2 * K A.sort() res = A[-1] - A[0] for i in range(0, len(A) - 1): mn = min(A[0] + 2 * K, A[i + 1]) mx = max(A[-1], A[i] + 2 * K) res = min(res, mx - mn) return res
class Solution: def smallest_range_ii(self, A, K): """ :type A: List[int] :type K: int :rtype: int """ A.sort() res = A[-1] - A[0] for i in range(0, len(A) - 1): mn = min(A[0] + 2 * K, A[i + 1]) mx = max(A[-1], A[i] + 2 * K) res = min(res, mx - mn) return res
# # @lc app=leetcode id=918 lang=python3 # # [918] Maximum Sum Circular Subarray # # @lc code=start class Solution: def maxSubarraySumCircular(self, A: List[int]) -> int: def ka(nums): res = float('-inf') current = float('-inf') for num in nums: current = max(0, current) + num res = max(res, current) return res if_neg = max(A) if if_neg < 0: return if_neg res1 = ka(A) res2 = sum(A) + ka([-num for num in A]) return max(res1, res2) # @lc code=end
class Solution: def max_subarray_sum_circular(self, A: List[int]) -> int: def ka(nums): res = float('-inf') current = float('-inf') for num in nums: current = max(0, current) + num res = max(res, current) return res if_neg = max(A) if if_neg < 0: return if_neg res1 = ka(A) res2 = sum(A) + ka([-num for num in A]) return max(res1, res2)
def configure(configuration_context): third_party_node = configuration_context.path.make_node('bugengine/3rdparty') for category in third_party_node.listdir(): if category[0] != '.': category_node = third_party_node.make_node(category) for third_party in category_node.listdir(): configuration_context.recurse( '%s/%s/%s/mak/configure.py' % (third_party_node.abspath(), category, third_party) )
def configure(configuration_context): third_party_node = configuration_context.path.make_node('bugengine/3rdparty') for category in third_party_node.listdir(): if category[0] != '.': category_node = third_party_node.make_node(category) for third_party in category_node.listdir(): configuration_context.recurse('%s/%s/%s/mak/configure.py' % (third_party_node.abspath(), category, third_party))
# Copyright 2021 Code Intelligence GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. def java_fuzz_target_test( name, target_class = None, deps = [], hook_classes = [], data = [], sanitizer = None, visibility = None, tags = [], fuzzer_args = [], srcs = [], size = None, timeout = None, env = None, verify_crash_input = True, verify_crash_reproducer = True, execute_crash_reproducer = False, **kwargs): target_name = name + "_target" deploy_manifest_lines = [] if target_class: deploy_manifest_lines.append("Jazzer-Fuzz-Target-Class: %s" % target_class) if hook_classes: deploy_manifest_lines.append("Jazzer-Hook-Classes: %s" % ":".join(hook_classes)) # Deps can only be specified on java_binary targets with sources, which # excludes e.g. Kotlin libraries wrapped into java_binary via runtime_deps. target_deps = deps + ["//agent:jazzer_api_compile_only"] if srcs else [] native.java_binary( name = target_name, srcs = srcs, visibility = ["//visibility:private"], create_executable = False, deploy_manifest_lines = deploy_manifest_lines, deps = target_deps, testonly = True, **kwargs ) additional_args = [] if sanitizer == None: driver = "//driver:jazzer_driver" elif sanitizer == "address": driver = "//driver:jazzer_driver_asan" elif sanitizer == "undefined": driver = "//driver:jazzer_driver_ubsan" else: fail("Invalid sanitizer: " + sanitizer) native.java_test( name = name, runtime_deps = [ "//bazel:fuzz_target_test_wrapper", "//agent:jazzer_api_deploy.jar", ":%s_deploy.jar" % target_name, ], size = size or "enormous", timeout = timeout or "moderate", args = [ "$(rootpath %s)" % driver, "$(rootpath //agent:jazzer_api_deploy.jar)", "$(rootpath :%s_deploy.jar)" % target_name, str(verify_crash_input), str(verify_crash_reproducer), str(execute_crash_reproducer), ] + additional_args + fuzzer_args + [ # Verify the call graph functionality by enabling it for every test. "--call_graph_basepath=/tmp/icfg", ], data = [ ":%s_deploy.jar" % target_name, "//agent:jazzer_agent_deploy.jar", "//agent:jazzer_api_deploy.jar", driver, ] + data, env = env, main_class = "FuzzTargetTestWrapper", use_testrunner = False, tags = tags, visibility = visibility, )
def java_fuzz_target_test(name, target_class=None, deps=[], hook_classes=[], data=[], sanitizer=None, visibility=None, tags=[], fuzzer_args=[], srcs=[], size=None, timeout=None, env=None, verify_crash_input=True, verify_crash_reproducer=True, execute_crash_reproducer=False, **kwargs): target_name = name + '_target' deploy_manifest_lines = [] if target_class: deploy_manifest_lines.append('Jazzer-Fuzz-Target-Class: %s' % target_class) if hook_classes: deploy_manifest_lines.append('Jazzer-Hook-Classes: %s' % ':'.join(hook_classes)) target_deps = deps + ['//agent:jazzer_api_compile_only'] if srcs else [] native.java_binary(name=target_name, srcs=srcs, visibility=['//visibility:private'], create_executable=False, deploy_manifest_lines=deploy_manifest_lines, deps=target_deps, testonly=True, **kwargs) additional_args = [] if sanitizer == None: driver = '//driver:jazzer_driver' elif sanitizer == 'address': driver = '//driver:jazzer_driver_asan' elif sanitizer == 'undefined': driver = '//driver:jazzer_driver_ubsan' else: fail('Invalid sanitizer: ' + sanitizer) native.java_test(name=name, runtime_deps=['//bazel:fuzz_target_test_wrapper', '//agent:jazzer_api_deploy.jar', ':%s_deploy.jar' % target_name], size=size or 'enormous', timeout=timeout or 'moderate', args=['$(rootpath %s)' % driver, '$(rootpath //agent:jazzer_api_deploy.jar)', '$(rootpath :%s_deploy.jar)' % target_name, str(verify_crash_input), str(verify_crash_reproducer), str(execute_crash_reproducer)] + additional_args + fuzzer_args + ['--call_graph_basepath=/tmp/icfg'], data=[':%s_deploy.jar' % target_name, '//agent:jazzer_agent_deploy.jar', '//agent:jazzer_api_deploy.jar', driver] + data, env=env, main_class='FuzzTargetTestWrapper', use_testrunner=False, tags=tags, visibility=visibility)
_base_ = '/home/jj/Documents/mmdetection/configs/_base_/models/faster_rcnn_r50_fpn.py' # model settings model = dict( neck=[ dict( type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=5), dict( type='BFP', in_channels=256, num_levels=5, refine_level=2, refine_type='non_local') ], roi_head=dict( bbox_head=dict( loss_bbox=dict( _delete_=True, type='BalancedL1Loss', alpha=0.5, gamma=1.5, beta=1.0, loss_weight=1.0)))) # model training and testing settings train_cfg = dict( rpn=dict(sampler=dict(neg_pos_ub=5), allowed_border=-1), rcnn=dict( sampler=dict( _delete_=True, type='CombinedSampler', num=512, pos_fraction=0.25, add_gt_as_proposals=True, pos_sampler=dict(type='InstanceBalancedPosSampler'), neg_sampler=dict( type='IoUBalancedNegSampler', floor_thr=-1, floor_fraction=0, num_bins=3))))
_base_ = '/home/jj/Documents/mmdetection/configs/_base_/models/faster_rcnn_r50_fpn.py' model = dict(neck=[dict(type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, num_outs=5), dict(type='BFP', in_channels=256, num_levels=5, refine_level=2, refine_type='non_local')], roi_head=dict(bbox_head=dict(loss_bbox=dict(_delete_=True, type='BalancedL1Loss', alpha=0.5, gamma=1.5, beta=1.0, loss_weight=1.0)))) train_cfg = dict(rpn=dict(sampler=dict(neg_pos_ub=5), allowed_border=-1), rcnn=dict(sampler=dict(_delete_=True, type='CombinedSampler', num=512, pos_fraction=0.25, add_gt_as_proposals=True, pos_sampler=dict(type='InstanceBalancedPosSampler'), neg_sampler=dict(type='IoUBalancedNegSampler', floor_thr=-1, floor_fraction=0, num_bins=3))))
def print1ToN(n): if n<=1: print("1",end =" ") return 0 print1ToN(n-1) print(n,end = " ") def printNto1(n): if n<=1: print("1",end =" ") return 0 print(n,end = " ") printNto1(n-1) n = int(input("Enter Input : ")) print1ToN(n) printNto1(n)
def print1_to_n(n): if n <= 1: print('1', end=' ') return 0 print1_to_n(n - 1) print(n, end=' ') def print_nto1(n): if n <= 1: print('1', end=' ') return 0 print(n, end=' ') print_nto1(n - 1) n = int(input('Enter Input : ')) print1_to_n(n) print_nto1(n)
users = [ { 'id': 0, 'photo': 'img0.jpg', 'firstname':'calvin', 'lastname':'settachatgul', 'nickname':'cal', 'email': 'calvin.settachatgul@gmail.com', 'aboutme': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In condimentum neque a enim bibendum tempus. Proin condimentum, nisi sed sagittis suscipit, ex lacus posuere turpis, et rutrum urna velit quis libero. Proin ornare, dui in congue sagittis, lorem sapien porttitor orci, pulvinar aliquet est risus ullamcorper leo. Phasellus sagittis mi vel posuere finibus. Etiam sed diam vehicula, ultricies arcu sit amet, sagittis risus. Aenean nec feugiat neque. Proin vulputate facilisis diam non ullamcorper.' }, { 'id': 1, 'photo': 'img1.jpg', 'firstname':'stanley', 'lastname':'chan', 'nickname':'stan', 'email': 'stan@example.com', 'aboutme': 'Vivamus auctor turpis mauris, fringilla porta turpis consectetur commodo. Phasellus interdum fermentum mauris eu tincidunt. Donec nec diam pretium, dapibus ligula nec, dignissim nisl. Etiam tincidunt eget neque ac dapibus. Etiam pellentesque ac justo semper faucibus. Nulla at orci luctus, malesuada erat et, sagittis nunc. Praesent elementum urna sit amet urna cursus, ut ultrices neque commodo. Nunc et lobortis nibh. In sed dolor non lacus venenatis tempus. Sed tempus volutpat diam, sed commodo massa placerat non.' }, { 'id': 2, 'photo': 'img2.jpg', 'firstname':'tiffany', 'lastname':'tiffany lastname', 'nickname':'tiff', 'email': 'tiff@example.com', 'aboutme': 'Quisque fringilla nisi sed tellus fringilla rutrum. Sed a volutpat ligula, in tincidunt augue. Ut elementum neque orci, non finibus arcu sodales at. Aliquam lacinia auctor odio at blandit. Curabitur consequat id dui vitae semper. Cras quis felis velit. Aliquam nec iaculis purus, non commodo mauris. Proin imperdiet, sem in lacinia posuere, est metus dictum enim, et viverra mauris augue et urna. Pellentesque laoreet augue nibh, ut vehicula nisi rhoncus mattis. Fusce vestibulum a neque et pretium. Phasellus posuere libero ut enim porta, at dapibus sem condimentum. Aliquam aliquam auctor accumsan.' }, { 'id': 3, 'photo': 'img3.jpg', 'firstname':'michael', 'lastname':'michael lastname', 'nickname':'mike', 'email': 'mike@example.com', 'aboutme': 'Nam laoreet facilisis pellentesque. Integer scelerisque sapien vitae lacus pellentesque vehicula. Aliquam eget mauris quam. Aliquam viverra mi diam, at bibendum nibh placerat vitae. Sed nec mi vitae dolor placerat facilisis. Maecenas at arcu at justo venenatis posuere nec sit amet tortor. Aenean eleifend commodo sem, non facilisis sem vestibulum a. Nullam sagittis vulputate turpis, non mollis diam.' } ]
users = [{'id': 0, 'photo': 'img0.jpg', 'firstname': 'calvin', 'lastname': 'settachatgul', 'nickname': 'cal', 'email': 'calvin.settachatgul@gmail.com', 'aboutme': 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In condimentum neque a enim bibendum tempus. Proin condimentum, nisi sed sagittis suscipit, ex lacus posuere turpis, et rutrum urna velit quis libero. Proin ornare, dui in congue sagittis, lorem sapien porttitor orci, pulvinar aliquet est risus ullamcorper leo. Phasellus sagittis mi vel posuere finibus. Etiam sed diam vehicula, ultricies arcu sit amet, sagittis risus. Aenean nec feugiat neque. Proin vulputate facilisis diam non ullamcorper.'}, {'id': 1, 'photo': 'img1.jpg', 'firstname': 'stanley', 'lastname': 'chan', 'nickname': 'stan', 'email': 'stan@example.com', 'aboutme': 'Vivamus auctor turpis mauris, fringilla porta turpis consectetur commodo. Phasellus interdum fermentum mauris eu tincidunt. Donec nec diam pretium, dapibus ligula nec, dignissim nisl. Etiam tincidunt eget neque ac dapibus. Etiam pellentesque ac justo semper faucibus. Nulla at orci luctus, malesuada erat et, sagittis nunc. Praesent elementum urna sit amet urna cursus, ut ultrices neque commodo. Nunc et lobortis nibh. In sed dolor non lacus venenatis tempus. Sed tempus volutpat diam, sed commodo massa placerat non.'}, {'id': 2, 'photo': 'img2.jpg', 'firstname': 'tiffany', 'lastname': 'tiffany lastname', 'nickname': 'tiff', 'email': 'tiff@example.com', 'aboutme': 'Quisque fringilla nisi sed tellus fringilla rutrum. Sed a volutpat ligula, in tincidunt augue. Ut elementum neque orci, non finibus arcu sodales at. Aliquam lacinia auctor odio at blandit. Curabitur consequat id dui vitae semper. Cras quis felis velit. Aliquam nec iaculis purus, non commodo mauris. Proin imperdiet, sem in lacinia posuere, est metus dictum enim, et viverra mauris augue et urna. Pellentesque laoreet augue nibh, ut vehicula nisi rhoncus mattis. Fusce vestibulum a neque et pretium. Phasellus posuere libero ut enim porta, at dapibus sem condimentum. Aliquam aliquam auctor accumsan.'}, {'id': 3, 'photo': 'img3.jpg', 'firstname': 'michael', 'lastname': 'michael lastname', 'nickname': 'mike', 'email': 'mike@example.com', 'aboutme': 'Nam laoreet facilisis pellentesque. Integer scelerisque sapien vitae lacus pellentesque vehicula. Aliquam eget mauris quam. Aliquam viverra mi diam, at bibendum nibh placerat vitae. Sed nec mi vitae dolor placerat facilisis. Maecenas at arcu at justo venenatis posuere nec sit amet tortor. Aenean eleifend commodo sem, non facilisis sem vestibulum a. Nullam sagittis vulputate turpis, non mollis diam.'}]
# # PySNMP MIB module FDDI-SMT73-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FDDI-SMT73-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 16:53:32 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") ConstraintsIntersection, ValueSizeConstraint, ConstraintsUnion, ValueRangeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ValueSizeConstraint", "ConstraintsUnion", "ValueRangeConstraint", "SingleValueConstraint") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Counter64, MibIdentifier, Gauge32, iso, IpAddress, ModuleIdentity, Integer32, transmission, Unsigned32, NotificationType, ObjectIdentity, Bits, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "MibIdentifier", "Gauge32", "iso", "IpAddress", "ModuleIdentity", "Integer32", "transmission", "Unsigned32", "NotificationType", "ObjectIdentity", "Bits", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") fddi = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15)) fddimib = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15, 73)) class FddiTimeNano(Integer32): subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 2147483647) class FddiTimeMilli(Integer32): subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 2147483647) class FddiResourceId(Integer32): subtypeSpec = Integer32.subtypeSpec + ValueRangeConstraint(0, 65535) class FddiSMTStationIdType(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(8, 8) fixedLength = 8 class FddiMACLongAddressType(OctetString): subtypeSpec = OctetString.subtypeSpec + ValueSizeConstraint(6, 6) fixedLength = 6 fddimibSMT = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 1)) fddimibMAC = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 2)) fddimibMACCounters = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 3)) fddimibPATH = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 4)) fddimibPORT = MibIdentifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 5)) fddimibSMTNumber = MibScalar((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTNumber.setStatus('mandatory') fddimibSMTTable = MibTable((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2), ) if mibBuilder.loadTexts: fddimibSMTTable.setStatus('mandatory') fddimibSMTEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1), ).setIndexNames((0, "FDDI-SMT73-MIB", "fddimibSMTIndex")) if mibBuilder.loadTexts: fddimibSMTEntry.setStatus('mandatory') fddimibSMTIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTIndex.setStatus('mandatory') fddimibSMTStationId = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 2), FddiSMTStationIdType()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTStationId.setStatus('mandatory') fddimibSMTOpVersionId = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTOpVersionId.setStatus('mandatory') fddimibSMTHiVersionId = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTHiVersionId.setStatus('mandatory') fddimibSMTLoVersionId = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTLoVersionId.setStatus('mandatory') fddimibSMTUserData = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(32, 32)).setFixedLength(32)).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTUserData.setStatus('mandatory') fddimibSMTMIBVersionId = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTMIBVersionId.setStatus('mandatory') fddimibSMTMACCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTMACCts.setStatus('mandatory') fddimibSMTNonMasterCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTNonMasterCts.setStatus('mandatory') fddimibSMTMasterCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTMasterCts.setStatus('mandatory') fddimibSMTAvailablePaths = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTAvailablePaths.setStatus('mandatory') fddimibSMTConfigCapabilities = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTConfigCapabilities.setStatus('mandatory') fddimibSMTConfigPolicy = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTConfigPolicy.setStatus('mandatory') fddimibSMTConnectionPolicy = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(32768, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTConnectionPolicy.setStatus('mandatory') fddimibSMTTNotify = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(2, 30))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTTNotify.setStatus('mandatory') fddimibSMTStatRptPolicy = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 16), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTStatRptPolicy.setStatus('mandatory') fddimibSMTTraceMaxExpiration = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 17), FddiTimeMilli()).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTTraceMaxExpiration.setStatus('mandatory') fddimibSMTBypassPresent = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTBypassPresent.setStatus('mandatory') fddimibSMTECMState = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 19), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("ec0", 1), ("ec1", 2), ("ec2", 3), ("ec3", 4), ("ec4", 5), ("ec5", 6), ("ec6", 7), ("ec7", 8)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTECMState.setStatus('mandatory') fddimibSMTCFState = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13))).clone(namedValues=NamedValues(("cf0", 1), ("cf1", 2), ("cf2", 3), ("cf3", 4), ("cf4", 5), ("cf5", 6), ("cf6", 7), ("cf7", 8), ("cf8", 9), ("cf9", 10), ("cf10", 11), ("cf11", 12), ("cf12", 13)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTCFState.setStatus('mandatory') fddimibSMTRemoteDisconnectFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTRemoteDisconnectFlag.setStatus('mandatory') fddimibSMTStationStatus = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("concatenated", 1), ("separated", 2), ("thru", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTStationStatus.setStatus('mandatory') fddimibSMTPeerWrapFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 23), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTPeerWrapFlag.setStatus('mandatory') fddimibSMTTimeStamp = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 24), FddiTimeMilli()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTTimeStamp.setStatus('mandatory') fddimibSMTTransitionTimeStamp = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 25), FddiTimeMilli()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibSMTTransitionTimeStamp.setStatus('mandatory') fddimibSMTStationAction = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 26), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("other", 1), ("connect", 2), ("disconnect", 3), ("path-Test", 4), ("self-Test", 5), ("disable-a", 6), ("disable-b", 7), ("disable-m", 8)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibSMTStationAction.setStatus('mandatory') fddimibMACNumber = MibScalar((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACNumber.setStatus('mandatory') fddimibMACTable = MibTable((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2), ) if mibBuilder.loadTexts: fddimibMACTable.setStatus('mandatory') fddimibMACEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1), ).setIndexNames((0, "FDDI-SMT73-MIB", "fddimibMACSMTIndex"), (0, "FDDI-SMT73-MIB", "fddimibMACIndex")) if mibBuilder.loadTexts: fddimibMACEntry.setStatus('mandatory') fddimibMACSMTIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACSMTIndex.setStatus('mandatory') fddimibMACIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACIndex.setStatus('mandatory') fddimibMACIfIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACIfIndex.setStatus('mandatory') fddimibMACFrameStatusFunctions = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACFrameStatusFunctions.setStatus('mandatory') fddimibMACTMaxCapability = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 5), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTMaxCapability.setStatus('mandatory') fddimibMACTVXCapability = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 6), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTVXCapability.setStatus('mandatory') fddimibMACAvailablePaths = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACAvailablePaths.setStatus('mandatory') fddimibMACCurrentPath = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("isolated", 1), ("local", 2), ("secondary", 3), ("primary", 4), ("concatenated", 5), ("thru", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACCurrentPath.setStatus('mandatory') fddimibMACUpstreamNbr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 9), FddiMACLongAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACUpstreamNbr.setStatus('mandatory') fddimibMACDownstreamNbr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 10), FddiMACLongAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACDownstreamNbr.setStatus('mandatory') fddimibMACOldUpstreamNbr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 11), FddiMACLongAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACOldUpstreamNbr.setStatus('mandatory') fddimibMACOldDownstreamNbr = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 12), FddiMACLongAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACOldDownstreamNbr.setStatus('mandatory') fddimibMACDupAddressTest = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("none", 1), ("pass", 2), ("fail", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACDupAddressTest.setStatus('mandatory') fddimibMACRequestedPaths = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibMACRequestedPaths.setStatus('mandatory') fddimibMACDownstreamPORTType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("a", 1), ("b", 2), ("s", 3), ("m", 4), ("none", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACDownstreamPORTType.setStatus('mandatory') fddimibMACSMTAddress = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 16), FddiMACLongAddressType()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACSMTAddress.setStatus('mandatory') fddimibMACTReq = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 17), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTReq.setStatus('mandatory') fddimibMACTNeg = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 18), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTNeg.setStatus('mandatory') fddimibMACTMax = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 19), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTMax.setStatus('mandatory') fddimibMACTvxValue = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 20), FddiTimeNano()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTvxValue.setStatus('mandatory') fddimibMACFrameCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACFrameCts.setStatus('mandatory') fddimibMACCopiedCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACCopiedCts.setStatus('mandatory') fddimibMACTransmitCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTransmitCts.setStatus('mandatory') fddimibMACErrorCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACErrorCts.setStatus('mandatory') fddimibMACLostCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACLostCts.setStatus('mandatory') fddimibMACFrameErrorThreshold = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 26), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibMACFrameErrorThreshold.setStatus('mandatory') fddimibMACFrameErrorRatio = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 27), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACFrameErrorRatio.setStatus('mandatory') fddimibMACRMTState = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 28), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("rm0", 1), ("rm1", 2), ("rm2", 3), ("rm3", 4), ("rm4", 5), ("rm5", 6), ("rm6", 7), ("rm7", 8)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACRMTState.setStatus('mandatory') fddimibMACDaFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 29), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACDaFlag.setStatus('mandatory') fddimibMACUnaDaFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 30), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACUnaDaFlag.setStatus('mandatory') fddimibMACFrameErrorFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 31), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACFrameErrorFlag.setStatus('mandatory') fddimibMACMAUnitdataAvailable = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 32), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACMAUnitdataAvailable.setStatus('mandatory') fddimibMACHardwarePresent = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 33), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACHardwarePresent.setStatus('mandatory') fddimibMACMAUnitdataEnable = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 34), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibMACMAUnitdataEnable.setStatus('mandatory') fddimibMACCountersTable = MibTable((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1), ) if mibBuilder.loadTexts: fddimibMACCountersTable.setStatus('mandatory') fddimibMACCountersEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1), ).setIndexNames((0, "FDDI-SMT73-MIB", "fddimibMACSMTIndex"), (0, "FDDI-SMT73-MIB", "fddimibMACIndex")) if mibBuilder.loadTexts: fddimibMACCountersEntry.setStatus('mandatory') fddimibMACTokenCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 1), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTokenCts.setStatus('mandatory') fddimibMACTvxExpiredCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 2), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACTvxExpiredCts.setStatus('mandatory') fddimibMACNotCopiedCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 3), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACNotCopiedCts.setStatus('mandatory') fddimibMACLateCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 4), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACLateCts.setStatus('mandatory') fddimibMACRingOpCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 5), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACRingOpCts.setStatus('mandatory') fddimibMACNotCopiedRatio = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACNotCopiedRatio.setStatus('mandatory') fddimibMACNotCopiedFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibMACNotCopiedFlag.setStatus('mandatory') fddimibMACNotCopiedThreshold = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibMACNotCopiedThreshold.setStatus('mandatory') fddimibPATHNumber = MibScalar((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHNumber.setStatus('mandatory') fddimibPATHTable = MibTable((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2), ) if mibBuilder.loadTexts: fddimibPATHTable.setStatus('mandatory') fddimibPATHEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1), ).setIndexNames((0, "FDDI-SMT73-MIB", "fddimibPATHSMTIndex"), (0, "FDDI-SMT73-MIB", "fddimibPATHIndex")) if mibBuilder.loadTexts: fddimibPATHEntry.setStatus('mandatory') fddimibPATHSMTIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHSMTIndex.setStatus('mandatory') fddimibPATHIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHIndex.setStatus('mandatory') fddimibPATHTVXLowerBound = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 3), FddiTimeNano()).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPATHTVXLowerBound.setStatus('mandatory') fddimibPATHTMaxLowerBound = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 4), FddiTimeNano()).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPATHTMaxLowerBound.setStatus('mandatory') fddimibPATHMaxTReq = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 5), FddiTimeNano()).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPATHMaxTReq.setStatus('mandatory') fddimibPATHConfigTable = MibTable((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3), ) if mibBuilder.loadTexts: fddimibPATHConfigTable.setStatus('mandatory') fddimibPATHConfigEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1), ).setIndexNames((0, "FDDI-SMT73-MIB", "fddimibPATHConfigSMTIndex"), (0, "FDDI-SMT73-MIB", "fddimibPATHConfigPATHIndex"), (0, "FDDI-SMT73-MIB", "fddimibPATHConfigTokenOrder")) if mibBuilder.loadTexts: fddimibPATHConfigEntry.setStatus('mandatory') fddimibPATHConfigSMTIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHConfigSMTIndex.setStatus('mandatory') fddimibPATHConfigPATHIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHConfigPATHIndex.setStatus('mandatory') fddimibPATHConfigTokenOrder = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHConfigTokenOrder.setStatus('mandatory') fddimibPATHConfigResourceType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(2, 4))).clone(namedValues=NamedValues(("mac", 2), ("port", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHConfigResourceType.setStatus('mandatory') fddimibPATHConfigResourceIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHConfigResourceIndex.setStatus('mandatory') fddimibPATHConfigCurrentPath = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("isolated", 1), ("local", 2), ("secondary", 3), ("primary", 4), ("concatenated", 5), ("thru", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPATHConfigCurrentPath.setStatus('mandatory') fddimibPORTNumber = MibScalar((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTNumber.setStatus('mandatory') fddimibPORTTable = MibTable((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2), ) if mibBuilder.loadTexts: fddimibPORTTable.setStatus('mandatory') fddimibPORTEntry = MibTableRow((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1), ).setIndexNames((0, "FDDI-SMT73-MIB", "fddimibPORTSMTIndex"), (0, "FDDI-SMT73-MIB", "fddimibPORTIndex")) if mibBuilder.loadTexts: fddimibPORTEntry.setStatus('mandatory') fddimibPORTSMTIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTSMTIndex.setStatus('mandatory') fddimibPORTIndex = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 65535))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTIndex.setStatus('mandatory') fddimibPORTMyType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("a", 1), ("b", 2), ("s", 3), ("m", 4), ("none", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTMyType.setStatus('mandatory') fddimibPORTNeighborType = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("a", 1), ("b", 2), ("s", 3), ("m", 4), ("none", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTNeighborType.setStatus('mandatory') fddimibPORTConnectionPolicies = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPORTConnectionPolicies.setStatus('mandatory') fddimibPORTMACIndicated = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("tVal9FalseRVal9False", 1), ("tVal9FalseRVal9True", 2), ("tVal9TrueRVal9False", 3), ("tVal9TrueRVal9True", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTMACIndicated.setStatus('mandatory') fddimibPORTCurrentPath = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("ce0", 1), ("ce1", 2), ("ce2", 3), ("ce3", 4), ("ce4", 5), ("ce5", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTCurrentPath.setStatus('mandatory') fddimibPORTRequestedPaths = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 8), OctetString().subtype(subtypeSpec=ValueSizeConstraint(3, 3)).setFixedLength(3)).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPORTRequestedPaths.setStatus('mandatory') fddimibPORTMACPlacement = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 9), FddiResourceId()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTMACPlacement.setStatus('mandatory') fddimibPORTAvailablePaths = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTAvailablePaths.setStatus('mandatory') fddimibPORTPMDClass = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=NamedValues(("multimode", 1), ("single-mode1", 2), ("single-mode2", 3), ("sonet", 4), ("low-cost-fiber", 5), ("twisted-pair", 6), ("unknown", 7), ("unspecified", 8)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTPMDClass.setStatus('mandatory') fddimibPORTConnectionCapabilities = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 3))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTConnectionCapabilities.setStatus('mandatory') fddimibPORTBSFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTBSFlag.setStatus('mandatory') fddimibPORTLCTFailCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTLCTFailCts.setStatus('mandatory') fddimibPORTLerEstimate = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(4, 15))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTLerEstimate.setStatus('mandatory') fddimibPORTLemRejectCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTLemRejectCts.setStatus('mandatory') fddimibPORTLemCts = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTLemCts.setStatus('mandatory') fddimibPORTLerCutoff = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(4, 15))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPORTLerCutoff.setStatus('mandatory') fddimibPORTLerAlarm = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(4, 15))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPORTLerAlarm.setStatus('mandatory') fddimibPORTConnectState = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("disabled", 1), ("connecting", 2), ("standby", 3), ("active", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTConnectState.setStatus('mandatory') fddimibPORTPCMState = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 21), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=NamedValues(("pc0", 1), ("pc1", 2), ("pc2", 3), ("pc3", 4), ("pc4", 5), ("pc5", 6), ("pc6", 7), ("pc7", 8), ("pc8", 9), ("pc9", 10)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTPCMState.setStatus('mandatory') fddimibPORTPCWithhold = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 22), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("m-m", 2), ("otherincompatible", 3), ("pathnotavailable", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTPCWithhold.setStatus('mandatory') fddimibPORTLerFlag = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 23), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTLerFlag.setStatus('mandatory') fddimibPORTHardwarePresent = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 24), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("true", 1), ("false", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: fddimibPORTHardwarePresent.setStatus('mandatory') fddimibPORTAction = MibTableColumn((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 25), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("other", 1), ("maintPORT", 2), ("enablePORT", 3), ("disablePORT", 4), ("startPORT", 5), ("stopPORT", 6)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: fddimibPORTAction.setStatus('mandatory') mibBuilder.exportSymbols("FDDI-SMT73-MIB", fddimibPATHConfigSMTIndex=fddimibPATHConfigSMTIndex, fddimibMACTable=fddimibMACTable, fddimibPORTPCMState=fddimibPORTPCMState, fddimibSMTAvailablePaths=fddimibSMTAvailablePaths, fddimibPATHConfigCurrentPath=fddimibPATHConfigCurrentPath, fddimibMACLateCts=fddimibMACLateCts, fddimibMACOldDownstreamNbr=fddimibMACOldDownstreamNbr, fddimibMACCountersEntry=fddimibMACCountersEntry, fddimibMACTransmitCts=fddimibMACTransmitCts, fddimibPORTLemRejectCts=fddimibPORTLemRejectCts, fddimibSMTRemoteDisconnectFlag=fddimibSMTRemoteDisconnectFlag, fddimibSMTEntry=fddimibSMTEntry, fddimibPATH=fddimibPATH, fddimibSMTTNotify=fddimibSMTTNotify, fddimibPATHSMTIndex=fddimibPATHSMTIndex, fddimibPATHConfigTable=fddimibPATHConfigTable, fddimibMACTMax=fddimibMACTMax, fddimibSMTTraceMaxExpiration=fddimibSMTTraceMaxExpiration, fddimibSMTOpVersionId=fddimibSMTOpVersionId, fddimibSMTPeerWrapFlag=fddimibSMTPeerWrapFlag, fddimibSMTTransitionTimeStamp=fddimibSMTTransitionTimeStamp, fddimibSMTStatRptPolicy=fddimibSMTStatRptPolicy, fddimibMACTMaxCapability=fddimibMACTMaxCapability, fddimibMACCurrentPath=fddimibMACCurrentPath, fddimibPORTRequestedPaths=fddimibPORTRequestedPaths, fddimibMACCounters=fddimibMACCounters, fddimibMACFrameErrorFlag=fddimibMACFrameErrorFlag, fddimibPORTMACPlacement=fddimibPORTMACPlacement, fddimibMACCopiedCts=fddimibMACCopiedCts, fddimibPORTConnectionCapabilities=fddimibPORTConnectionCapabilities, fddimibPORTConnectionPolicies=fddimibPORTConnectionPolicies, fddimibPATHIndex=fddimibPATHIndex, fddimibMACSMTAddress=fddimibMACSMTAddress, fddimibPORTIndex=fddimibPORTIndex, fddimibPORTPMDClass=fddimibPORTPMDClass, fddimibMACFrameCts=fddimibMACFrameCts, fddimibMACDownstreamNbr=fddimibMACDownstreamNbr, fddimibPORTMyType=fddimibPORTMyType, fddimibMACAvailablePaths=fddimibMACAvailablePaths, fddimibMACLostCts=fddimibMACLostCts, fddimibMACNotCopiedThreshold=fddimibMACNotCopiedThreshold, fddimibPORTLerFlag=fddimibPORTLerFlag, fddimibMACTvxValue=fddimibMACTvxValue, fddimibPORTLCTFailCts=fddimibPORTLCTFailCts, fddimibMACFrameErrorThreshold=fddimibMACFrameErrorThreshold, fddimibMACRingOpCts=fddimibMACRingOpCts, fddimibSMTHiVersionId=fddimibSMTHiVersionId, fddimibPORTMACIndicated=fddimibPORTMACIndicated, fddimibPORTBSFlag=fddimibPORTBSFlag, fddimibPORTConnectState=fddimibPORTConnectState, fddimibPATHConfigResourceType=fddimibPATHConfigResourceType, fddimibMACDaFlag=fddimibMACDaFlag, fddimibSMTTimeStamp=fddimibSMTTimeStamp, fddimibSMT=fddimibSMT, fddimibMACNotCopiedFlag=fddimibMACNotCopiedFlag, fddimibMACDupAddressTest=fddimibMACDupAddressTest, fddimibSMTNumber=fddimibSMTNumber, fddimibSMTMIBVersionId=fddimibSMTMIBVersionId, fddimibSMTMACCts=fddimibSMTMACCts, fddimibMACHardwarePresent=fddimibMACHardwarePresent, fddimibPORTEntry=fddimibPORTEntry, fddimibSMTLoVersionId=fddimibSMTLoVersionId, fddimibPORTLemCts=fddimibPORTLemCts, FddiSMTStationIdType=FddiSMTStationIdType, fddimibMACTVXCapability=fddimibMACTVXCapability, FddiMACLongAddressType=FddiMACLongAddressType, fddimibMACOldUpstreamNbr=fddimibMACOldUpstreamNbr, fddimibMACTNeg=fddimibMACTNeg, fddimibSMTCFState=fddimibSMTCFState, fddimibMACTvxExpiredCts=fddimibMACTvxExpiredCts, fddimibMACRequestedPaths=fddimibMACRequestedPaths, fddimibSMTMasterCts=fddimibSMTMasterCts, fddimibMACRMTState=fddimibMACRMTState, fddimibPORT=fddimibPORT, fddimibPATHNumber=fddimibPATHNumber, fddimibMACUpstreamNbr=fddimibMACUpstreamNbr, fddimibMACIfIndex=fddimibMACIfIndex, fddimibMACDownstreamPORTType=fddimibMACDownstreamPORTType, fddimibPORTNumber=fddimibPORTNumber, fddimibPORTPCWithhold=fddimibPORTPCWithhold, FddiTimeNano=FddiTimeNano, fddimibPATHTMaxLowerBound=fddimibPATHTMaxLowerBound, fddimibMACFrameErrorRatio=fddimibMACFrameErrorRatio, fddimibSMTNonMasterCts=fddimibSMTNonMasterCts, fddimibSMTStationStatus=fddimibSMTStationStatus, fddimibMACTReq=fddimibMACTReq, fddimibSMTConfigCapabilities=fddimibSMTConfigCapabilities, fddimibPORTAvailablePaths=fddimibPORTAvailablePaths, fddimibMACIndex=fddimibMACIndex, fddimibPORTLerCutoff=fddimibPORTLerCutoff, fddimibSMTConnectionPolicy=fddimibSMTConnectionPolicy, fddimibPATHConfigTokenOrder=fddimibPATHConfigTokenOrder, fddimibMACNotCopiedRatio=fddimibMACNotCopiedRatio, fddimibMAC=fddimibMAC, fddimibPORTLerAlarm=fddimibPORTLerAlarm, fddimibPATHTable=fddimibPATHTable, fddimibMACCountersTable=fddimibMACCountersTable, FddiResourceId=FddiResourceId, fddimibSMTECMState=fddimibSMTECMState, fddimibPATHMaxTReq=fddimibPATHMaxTReq, fddimibMACUnaDaFlag=fddimibMACUnaDaFlag, fddimibPORTCurrentPath=fddimibPORTCurrentPath, fddimibPORTHardwarePresent=fddimibPORTHardwarePresent, fddimibPORTSMTIndex=fddimibPORTSMTIndex, fddimibMACNotCopiedCts=fddimibMACNotCopiedCts, fddimibSMTStationId=fddimibSMTStationId, fddimibSMTStationAction=fddimibSMTStationAction, fddimibPORTLerEstimate=fddimibPORTLerEstimate, fddimibPATHConfigResourceIndex=fddimibPATHConfigResourceIndex, fddimibPORTTable=fddimibPORTTable, fddimib=fddimib, fddimibMACMAUnitdataAvailable=fddimibMACMAUnitdataAvailable, fddimibMACNumber=fddimibMACNumber, fddimibMACTokenCts=fddimibMACTokenCts, fddimibSMTBypassPresent=fddimibSMTBypassPresent, fddimibPATHConfigPATHIndex=fddimibPATHConfigPATHIndex, fddimibPORTNeighborType=fddimibPORTNeighborType, fddi=fddi, fddimibSMTConfigPolicy=fddimibSMTConfigPolicy, FddiTimeMilli=FddiTimeMilli, fddimibMACMAUnitdataEnable=fddimibMACMAUnitdataEnable, fddimibMACSMTIndex=fddimibMACSMTIndex, fddimibPATHEntry=fddimibPATHEntry, fddimibSMTIndex=fddimibSMTIndex, fddimibPORTAction=fddimibPORTAction, fddimibMACErrorCts=fddimibMACErrorCts, fddimibSMTTable=fddimibSMTTable, fddimibMACFrameStatusFunctions=fddimibMACFrameStatusFunctions, fddimibPATHTVXLowerBound=fddimibPATHTVXLowerBound, fddimibPATHConfigEntry=fddimibPATHConfigEntry, fddimibMACEntry=fddimibMACEntry, fddimibSMTUserData=fddimibSMTUserData)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, constraints_union, value_range_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ValueSizeConstraint', 'ConstraintsUnion', 'ValueRangeConstraint', 'SingleValueConstraint') (module_compliance, notification_group) = mibBuilder.importSymbols('SNMPv2-CONF', 'ModuleCompliance', 'NotificationGroup') (counter64, mib_identifier, gauge32, iso, ip_address, module_identity, integer32, transmission, unsigned32, notification_type, object_identity, bits, time_ticks, mib_scalar, mib_table, mib_table_row, mib_table_column, counter32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'MibIdentifier', 'Gauge32', 'iso', 'IpAddress', 'ModuleIdentity', 'Integer32', 'transmission', 'Unsigned32', 'NotificationType', 'ObjectIdentity', 'Bits', 'TimeTicks', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter32') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') fddi = mib_identifier((1, 3, 6, 1, 2, 1, 10, 15)) fddimib = mib_identifier((1, 3, 6, 1, 2, 1, 10, 15, 73)) class Fdditimenano(Integer32): subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 2147483647) class Fdditimemilli(Integer32): subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 2147483647) class Fddiresourceid(Integer32): subtype_spec = Integer32.subtypeSpec + value_range_constraint(0, 65535) class Fddismtstationidtype(OctetString): subtype_spec = OctetString.subtypeSpec + value_size_constraint(8, 8) fixed_length = 8 class Fddimaclongaddresstype(OctetString): subtype_spec = OctetString.subtypeSpec + value_size_constraint(6, 6) fixed_length = 6 fddimib_smt = mib_identifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 1)) fddimib_mac = mib_identifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 2)) fddimib_mac_counters = mib_identifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 3)) fddimib_path = mib_identifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 4)) fddimib_port = mib_identifier((1, 3, 6, 1, 2, 1, 10, 15, 73, 5)) fddimib_smt_number = mib_scalar((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTNumber.setStatus('mandatory') fddimib_smt_table = mib_table((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2)) if mibBuilder.loadTexts: fddimibSMTTable.setStatus('mandatory') fddimib_smt_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1)).setIndexNames((0, 'FDDI-SMT73-MIB', 'fddimibSMTIndex')) if mibBuilder.loadTexts: fddimibSMTEntry.setStatus('mandatory') fddimib_smt_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTIndex.setStatus('mandatory') fddimib_smt_station_id = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 2), fddi_smt_station_id_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTStationId.setStatus('mandatory') fddimib_smt_op_version_id = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTOpVersionId.setStatus('mandatory') fddimib_smt_hi_version_id = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTHiVersionId.setStatus('mandatory') fddimib_smt_lo_version_id = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTLoVersionId.setStatus('mandatory') fddimib_smt_user_data = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 6), octet_string().subtype(subtypeSpec=value_size_constraint(32, 32)).setFixedLength(32)).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibSMTUserData.setStatus('mandatory') fddimib_smtmib_version_id = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTMIBVersionId.setStatus('mandatory') fddimib_smtmac_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTMACCts.setStatus('mandatory') fddimib_smt_non_master_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 2))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTNonMasterCts.setStatus('mandatory') fddimib_smt_master_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTMasterCts.setStatus('mandatory') fddimib_smt_available_paths = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 11), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTAvailablePaths.setStatus('mandatory') fddimib_smt_config_capabilities = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(0, 3))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTConfigCapabilities.setStatus('mandatory') fddimib_smt_config_policy = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 13), integer32().subtype(subtypeSpec=value_range_constraint(0, 1))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibSMTConfigPolicy.setStatus('mandatory') fddimib_smt_connection_policy = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 14), integer32().subtype(subtypeSpec=value_range_constraint(32768, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibSMTConnectionPolicy.setStatus('mandatory') fddimib_smtt_notify = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 15), integer32().subtype(subtypeSpec=value_range_constraint(2, 30))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibSMTTNotify.setStatus('mandatory') fddimib_smt_stat_rpt_policy = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 16), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibSMTStatRptPolicy.setStatus('mandatory') fddimib_smt_trace_max_expiration = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 17), fddi_time_milli()).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibSMTTraceMaxExpiration.setStatus('mandatory') fddimib_smt_bypass_present = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 18), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTBypassPresent.setStatus('mandatory') fddimib_smtecm_state = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 19), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('ec0', 1), ('ec1', 2), ('ec2', 3), ('ec3', 4), ('ec4', 5), ('ec5', 6), ('ec6', 7), ('ec7', 8)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTECMState.setStatus('mandatory') fddimib_smtcf_state = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 20), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13))).clone(namedValues=named_values(('cf0', 1), ('cf1', 2), ('cf2', 3), ('cf3', 4), ('cf4', 5), ('cf5', 6), ('cf6', 7), ('cf7', 8), ('cf8', 9), ('cf9', 10), ('cf10', 11), ('cf11', 12), ('cf12', 13)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTCFState.setStatus('mandatory') fddimib_smt_remote_disconnect_flag = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 21), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTRemoteDisconnectFlag.setStatus('mandatory') fddimib_smt_station_status = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 22), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('concatenated', 1), ('separated', 2), ('thru', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTStationStatus.setStatus('mandatory') fddimib_smt_peer_wrap_flag = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 23), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTPeerWrapFlag.setStatus('mandatory') fddimib_smt_time_stamp = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 24), fddi_time_milli()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTTimeStamp.setStatus('mandatory') fddimib_smt_transition_time_stamp = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 25), fddi_time_milli()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibSMTTransitionTimeStamp.setStatus('mandatory') fddimib_smt_station_action = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 1, 2, 1, 26), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('other', 1), ('connect', 2), ('disconnect', 3), ('path-Test', 4), ('self-Test', 5), ('disable-a', 6), ('disable-b', 7), ('disable-m', 8)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibSMTStationAction.setStatus('mandatory') fddimib_mac_number = mib_scalar((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACNumber.setStatus('mandatory') fddimib_mac_table = mib_table((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2)) if mibBuilder.loadTexts: fddimibMACTable.setStatus('mandatory') fddimib_mac_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1)).setIndexNames((0, 'FDDI-SMT73-MIB', 'fddimibMACSMTIndex'), (0, 'FDDI-SMT73-MIB', 'fddimibMACIndex')) if mibBuilder.loadTexts: fddimibMACEntry.setStatus('mandatory') fddimib_macsmt_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACSMTIndex.setStatus('mandatory') fddimib_mac_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACIndex.setStatus('mandatory') fddimib_mac_if_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACIfIndex.setStatus('mandatory') fddimib_mac_frame_status_functions = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 4), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACFrameStatusFunctions.setStatus('mandatory') fddimib_mact_max_capability = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 5), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACTMaxCapability.setStatus('mandatory') fddimib_mactvx_capability = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 6), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACTVXCapability.setStatus('mandatory') fddimib_mac_available_paths = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACAvailablePaths.setStatus('mandatory') fddimib_mac_current_path = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('isolated', 1), ('local', 2), ('secondary', 3), ('primary', 4), ('concatenated', 5), ('thru', 6)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACCurrentPath.setStatus('mandatory') fddimib_mac_upstream_nbr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 9), fddi_mac_long_address_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACUpstreamNbr.setStatus('mandatory') fddimib_mac_downstream_nbr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 10), fddi_mac_long_address_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACDownstreamNbr.setStatus('mandatory') fddimib_mac_old_upstream_nbr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 11), fddi_mac_long_address_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACOldUpstreamNbr.setStatus('mandatory') fddimib_mac_old_downstream_nbr = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 12), fddi_mac_long_address_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACOldDownstreamNbr.setStatus('mandatory') fddimib_mac_dup_address_test = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('none', 1), ('pass', 2), ('fail', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACDupAddressTest.setStatus('mandatory') fddimib_mac_requested_paths = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 14), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibMACRequestedPaths.setStatus('mandatory') fddimib_mac_downstream_port_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('a', 1), ('b', 2), ('s', 3), ('m', 4), ('none', 5)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACDownstreamPORTType.setStatus('mandatory') fddimib_macsmt_address = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 16), fddi_mac_long_address_type()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACSMTAddress.setStatus('mandatory') fddimib_mact_req = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 17), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACTReq.setStatus('mandatory') fddimib_mact_neg = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 18), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACTNeg.setStatus('mandatory') fddimib_mact_max = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 19), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACTMax.setStatus('mandatory') fddimib_mac_tvx_value = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 20), fddi_time_nano()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACTvxValue.setStatus('mandatory') fddimib_mac_frame_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 21), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACFrameCts.setStatus('mandatory') fddimib_mac_copied_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 22), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACCopiedCts.setStatus('mandatory') fddimib_mac_transmit_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 23), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACTransmitCts.setStatus('mandatory') fddimib_mac_error_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 24), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACErrorCts.setStatus('mandatory') fddimib_mac_lost_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 25), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACLostCts.setStatus('mandatory') fddimib_mac_frame_error_threshold = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 26), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibMACFrameErrorThreshold.setStatus('mandatory') fddimib_mac_frame_error_ratio = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 27), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACFrameErrorRatio.setStatus('mandatory') fddimib_macrmt_state = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 28), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('rm0', 1), ('rm1', 2), ('rm2', 3), ('rm3', 4), ('rm4', 5), ('rm5', 6), ('rm6', 7), ('rm7', 8)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACRMTState.setStatus('mandatory') fddimib_mac_da_flag = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 29), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACDaFlag.setStatus('mandatory') fddimib_mac_una_da_flag = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 30), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACUnaDaFlag.setStatus('mandatory') fddimib_mac_frame_error_flag = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 31), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACFrameErrorFlag.setStatus('mandatory') fddimib_macma_unitdata_available = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 32), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACMAUnitdataAvailable.setStatus('mandatory') fddimib_mac_hardware_present = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 33), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACHardwarePresent.setStatus('mandatory') fddimib_macma_unitdata_enable = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 2, 2, 1, 34), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibMACMAUnitdataEnable.setStatus('mandatory') fddimib_mac_counters_table = mib_table((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1)) if mibBuilder.loadTexts: fddimibMACCountersTable.setStatus('mandatory') fddimib_mac_counters_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1)).setIndexNames((0, 'FDDI-SMT73-MIB', 'fddimibMACSMTIndex'), (0, 'FDDI-SMT73-MIB', 'fddimibMACIndex')) if mibBuilder.loadTexts: fddimibMACCountersEntry.setStatus('mandatory') fddimib_mac_token_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 1), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACTokenCts.setStatus('mandatory') fddimib_mac_tvx_expired_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 2), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACTvxExpiredCts.setStatus('mandatory') fddimib_mac_not_copied_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 3), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACNotCopiedCts.setStatus('mandatory') fddimib_mac_late_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 4), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACLateCts.setStatus('mandatory') fddimib_mac_ring_op_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 5), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACRingOpCts.setStatus('mandatory') fddimib_mac_not_copied_ratio = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACNotCopiedRatio.setStatus('mandatory') fddimib_mac_not_copied_flag = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibMACNotCopiedFlag.setStatus('mandatory') fddimib_mac_not_copied_threshold = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 3, 1, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibMACNotCopiedThreshold.setStatus('mandatory') fddimib_path_number = mib_scalar((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPATHNumber.setStatus('mandatory') fddimib_path_table = mib_table((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2)) if mibBuilder.loadTexts: fddimibPATHTable.setStatus('mandatory') fddimib_path_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1)).setIndexNames((0, 'FDDI-SMT73-MIB', 'fddimibPATHSMTIndex'), (0, 'FDDI-SMT73-MIB', 'fddimibPATHIndex')) if mibBuilder.loadTexts: fddimibPATHEntry.setStatus('mandatory') fddimib_pathsmt_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPATHSMTIndex.setStatus('mandatory') fddimib_path_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPATHIndex.setStatus('mandatory') fddimib_pathtvx_lower_bound = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 3), fddi_time_nano()).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibPATHTVXLowerBound.setStatus('mandatory') fddimib_patht_max_lower_bound = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 4), fddi_time_nano()).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibPATHTMaxLowerBound.setStatus('mandatory') fddimib_path_max_t_req = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 2, 1, 5), fddi_time_nano()).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibPATHMaxTReq.setStatus('mandatory') fddimib_path_config_table = mib_table((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3)) if mibBuilder.loadTexts: fddimibPATHConfigTable.setStatus('mandatory') fddimib_path_config_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1)).setIndexNames((0, 'FDDI-SMT73-MIB', 'fddimibPATHConfigSMTIndex'), (0, 'FDDI-SMT73-MIB', 'fddimibPATHConfigPATHIndex'), (0, 'FDDI-SMT73-MIB', 'fddimibPATHConfigTokenOrder')) if mibBuilder.loadTexts: fddimibPATHConfigEntry.setStatus('mandatory') fddimib_path_config_smt_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPATHConfigSMTIndex.setStatus('mandatory') fddimib_path_config_path_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPATHConfigPATHIndex.setStatus('mandatory') fddimib_path_config_token_order = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 3), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPATHConfigTokenOrder.setStatus('mandatory') fddimib_path_config_resource_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(2, 4))).clone(namedValues=named_values(('mac', 2), ('port', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPATHConfigResourceType.setStatus('mandatory') fddimib_path_config_resource_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPATHConfigResourceIndex.setStatus('mandatory') fddimib_path_config_current_path = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 4, 3, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('isolated', 1), ('local', 2), ('secondary', 3), ('primary', 4), ('concatenated', 5), ('thru', 6)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPATHConfigCurrentPath.setStatus('mandatory') fddimib_port_number = mib_scalar((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 1), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTNumber.setStatus('mandatory') fddimib_port_table = mib_table((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2)) if mibBuilder.loadTexts: fddimibPORTTable.setStatus('mandatory') fddimib_port_entry = mib_table_row((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1)).setIndexNames((0, 'FDDI-SMT73-MIB', 'fddimibPORTSMTIndex'), (0, 'FDDI-SMT73-MIB', 'fddimibPORTIndex')) if mibBuilder.loadTexts: fddimibPORTEntry.setStatus('mandatory') fddimib_portsmt_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTSMTIndex.setStatus('mandatory') fddimib_port_index = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 65535))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTIndex.setStatus('mandatory') fddimib_port_my_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('a', 1), ('b', 2), ('s', 3), ('m', 4), ('none', 5)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTMyType.setStatus('mandatory') fddimib_port_neighbor_type = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5))).clone(namedValues=named_values(('a', 1), ('b', 2), ('s', 3), ('m', 4), ('none', 5)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTNeighborType.setStatus('mandatory') fddimib_port_connection_policies = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 3))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibPORTConnectionPolicies.setStatus('mandatory') fddimib_portmac_indicated = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('tVal9FalseRVal9False', 1), ('tVal9FalseRVal9True', 2), ('tVal9TrueRVal9False', 3), ('tVal9TrueRVal9True', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTMACIndicated.setStatus('mandatory') fddimib_port_current_path = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('ce0', 1), ('ce1', 2), ('ce2', 3), ('ce3', 4), ('ce4', 5), ('ce5', 6)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTCurrentPath.setStatus('mandatory') fddimib_port_requested_paths = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 8), octet_string().subtype(subtypeSpec=value_size_constraint(3, 3)).setFixedLength(3)).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibPORTRequestedPaths.setStatus('mandatory') fddimib_portmac_placement = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 9), fddi_resource_id()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTMACPlacement.setStatus('mandatory') fddimib_port_available_paths = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTAvailablePaths.setStatus('mandatory') fddimib_portpmd_class = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8))).clone(namedValues=named_values(('multimode', 1), ('single-mode1', 2), ('single-mode2', 3), ('sonet', 4), ('low-cost-fiber', 5), ('twisted-pair', 6), ('unknown', 7), ('unspecified', 8)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTPMDClass.setStatus('mandatory') fddimib_port_connection_capabilities = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(0, 3))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTConnectionCapabilities.setStatus('mandatory') fddimib_portbs_flag = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTBSFlag.setStatus('mandatory') fddimib_portlct_fail_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 14), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTLCTFailCts.setStatus('mandatory') fddimib_port_ler_estimate = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 15), integer32().subtype(subtypeSpec=value_range_constraint(4, 15))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTLerEstimate.setStatus('mandatory') fddimib_port_lem_reject_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 16), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTLemRejectCts.setStatus('mandatory') fddimib_port_lem_cts = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 17), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTLemCts.setStatus('mandatory') fddimib_port_ler_cutoff = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 18), integer32().subtype(subtypeSpec=value_range_constraint(4, 15))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibPORTLerCutoff.setStatus('mandatory') fddimib_port_ler_alarm = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 19), integer32().subtype(subtypeSpec=value_range_constraint(4, 15))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibPORTLerAlarm.setStatus('mandatory') fddimib_port_connect_state = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 20), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('disabled', 1), ('connecting', 2), ('standby', 3), ('active', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTConnectState.setStatus('mandatory') fddimib_portpcm_state = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 21), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))).clone(namedValues=named_values(('pc0', 1), ('pc1', 2), ('pc2', 3), ('pc3', 4), ('pc4', 5), ('pc5', 6), ('pc6', 7), ('pc7', 8), ('pc8', 9), ('pc9', 10)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTPCMState.setStatus('mandatory') fddimib_portpc_withhold = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 22), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('none', 1), ('m-m', 2), ('otherincompatible', 3), ('pathnotavailable', 4)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTPCWithhold.setStatus('mandatory') fddimib_port_ler_flag = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 23), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTLerFlag.setStatus('mandatory') fddimib_port_hardware_present = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 24), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('true', 1), ('false', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: fddimibPORTHardwarePresent.setStatus('mandatory') fddimib_port_action = mib_table_column((1, 3, 6, 1, 2, 1, 10, 15, 73, 5, 2, 1, 25), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('other', 1), ('maintPORT', 2), ('enablePORT', 3), ('disablePORT', 4), ('startPORT', 5), ('stopPORT', 6)))).setMaxAccess('readwrite') if mibBuilder.loadTexts: fddimibPORTAction.setStatus('mandatory') mibBuilder.exportSymbols('FDDI-SMT73-MIB', fddimibPATHConfigSMTIndex=fddimibPATHConfigSMTIndex, fddimibMACTable=fddimibMACTable, fddimibPORTPCMState=fddimibPORTPCMState, fddimibSMTAvailablePaths=fddimibSMTAvailablePaths, fddimibPATHConfigCurrentPath=fddimibPATHConfigCurrentPath, fddimibMACLateCts=fddimibMACLateCts, fddimibMACOldDownstreamNbr=fddimibMACOldDownstreamNbr, fddimibMACCountersEntry=fddimibMACCountersEntry, fddimibMACTransmitCts=fddimibMACTransmitCts, fddimibPORTLemRejectCts=fddimibPORTLemRejectCts, fddimibSMTRemoteDisconnectFlag=fddimibSMTRemoteDisconnectFlag, fddimibSMTEntry=fddimibSMTEntry, fddimibPATH=fddimibPATH, fddimibSMTTNotify=fddimibSMTTNotify, fddimibPATHSMTIndex=fddimibPATHSMTIndex, fddimibPATHConfigTable=fddimibPATHConfigTable, fddimibMACTMax=fddimibMACTMax, fddimibSMTTraceMaxExpiration=fddimibSMTTraceMaxExpiration, fddimibSMTOpVersionId=fddimibSMTOpVersionId, fddimibSMTPeerWrapFlag=fddimibSMTPeerWrapFlag, fddimibSMTTransitionTimeStamp=fddimibSMTTransitionTimeStamp, fddimibSMTStatRptPolicy=fddimibSMTStatRptPolicy, fddimibMACTMaxCapability=fddimibMACTMaxCapability, fddimibMACCurrentPath=fddimibMACCurrentPath, fddimibPORTRequestedPaths=fddimibPORTRequestedPaths, fddimibMACCounters=fddimibMACCounters, fddimibMACFrameErrorFlag=fddimibMACFrameErrorFlag, fddimibPORTMACPlacement=fddimibPORTMACPlacement, fddimibMACCopiedCts=fddimibMACCopiedCts, fddimibPORTConnectionCapabilities=fddimibPORTConnectionCapabilities, fddimibPORTConnectionPolicies=fddimibPORTConnectionPolicies, fddimibPATHIndex=fddimibPATHIndex, fddimibMACSMTAddress=fddimibMACSMTAddress, fddimibPORTIndex=fddimibPORTIndex, fddimibPORTPMDClass=fddimibPORTPMDClass, fddimibMACFrameCts=fddimibMACFrameCts, fddimibMACDownstreamNbr=fddimibMACDownstreamNbr, fddimibPORTMyType=fddimibPORTMyType, fddimibMACAvailablePaths=fddimibMACAvailablePaths, fddimibMACLostCts=fddimibMACLostCts, fddimibMACNotCopiedThreshold=fddimibMACNotCopiedThreshold, fddimibPORTLerFlag=fddimibPORTLerFlag, fddimibMACTvxValue=fddimibMACTvxValue, fddimibPORTLCTFailCts=fddimibPORTLCTFailCts, fddimibMACFrameErrorThreshold=fddimibMACFrameErrorThreshold, fddimibMACRingOpCts=fddimibMACRingOpCts, fddimibSMTHiVersionId=fddimibSMTHiVersionId, fddimibPORTMACIndicated=fddimibPORTMACIndicated, fddimibPORTBSFlag=fddimibPORTBSFlag, fddimibPORTConnectState=fddimibPORTConnectState, fddimibPATHConfigResourceType=fddimibPATHConfigResourceType, fddimibMACDaFlag=fddimibMACDaFlag, fddimibSMTTimeStamp=fddimibSMTTimeStamp, fddimibSMT=fddimibSMT, fddimibMACNotCopiedFlag=fddimibMACNotCopiedFlag, fddimibMACDupAddressTest=fddimibMACDupAddressTest, fddimibSMTNumber=fddimibSMTNumber, fddimibSMTMIBVersionId=fddimibSMTMIBVersionId, fddimibSMTMACCts=fddimibSMTMACCts, fddimibMACHardwarePresent=fddimibMACHardwarePresent, fddimibPORTEntry=fddimibPORTEntry, fddimibSMTLoVersionId=fddimibSMTLoVersionId, fddimibPORTLemCts=fddimibPORTLemCts, FddiSMTStationIdType=FddiSMTStationIdType, fddimibMACTVXCapability=fddimibMACTVXCapability, FddiMACLongAddressType=FddiMACLongAddressType, fddimibMACOldUpstreamNbr=fddimibMACOldUpstreamNbr, fddimibMACTNeg=fddimibMACTNeg, fddimibSMTCFState=fddimibSMTCFState, fddimibMACTvxExpiredCts=fddimibMACTvxExpiredCts, fddimibMACRequestedPaths=fddimibMACRequestedPaths, fddimibSMTMasterCts=fddimibSMTMasterCts, fddimibMACRMTState=fddimibMACRMTState, fddimibPORT=fddimibPORT, fddimibPATHNumber=fddimibPATHNumber, fddimibMACUpstreamNbr=fddimibMACUpstreamNbr, fddimibMACIfIndex=fddimibMACIfIndex, fddimibMACDownstreamPORTType=fddimibMACDownstreamPORTType, fddimibPORTNumber=fddimibPORTNumber, fddimibPORTPCWithhold=fddimibPORTPCWithhold, FddiTimeNano=FddiTimeNano, fddimibPATHTMaxLowerBound=fddimibPATHTMaxLowerBound, fddimibMACFrameErrorRatio=fddimibMACFrameErrorRatio, fddimibSMTNonMasterCts=fddimibSMTNonMasterCts, fddimibSMTStationStatus=fddimibSMTStationStatus, fddimibMACTReq=fddimibMACTReq, fddimibSMTConfigCapabilities=fddimibSMTConfigCapabilities, fddimibPORTAvailablePaths=fddimibPORTAvailablePaths, fddimibMACIndex=fddimibMACIndex, fddimibPORTLerCutoff=fddimibPORTLerCutoff, fddimibSMTConnectionPolicy=fddimibSMTConnectionPolicy, fddimibPATHConfigTokenOrder=fddimibPATHConfigTokenOrder, fddimibMACNotCopiedRatio=fddimibMACNotCopiedRatio, fddimibMAC=fddimibMAC, fddimibPORTLerAlarm=fddimibPORTLerAlarm, fddimibPATHTable=fddimibPATHTable, fddimibMACCountersTable=fddimibMACCountersTable, FddiResourceId=FddiResourceId, fddimibSMTECMState=fddimibSMTECMState, fddimibPATHMaxTReq=fddimibPATHMaxTReq, fddimibMACUnaDaFlag=fddimibMACUnaDaFlag, fddimibPORTCurrentPath=fddimibPORTCurrentPath, fddimibPORTHardwarePresent=fddimibPORTHardwarePresent, fddimibPORTSMTIndex=fddimibPORTSMTIndex, fddimibMACNotCopiedCts=fddimibMACNotCopiedCts, fddimibSMTStationId=fddimibSMTStationId, fddimibSMTStationAction=fddimibSMTStationAction, fddimibPORTLerEstimate=fddimibPORTLerEstimate, fddimibPATHConfigResourceIndex=fddimibPATHConfigResourceIndex, fddimibPORTTable=fddimibPORTTable, fddimib=fddimib, fddimibMACMAUnitdataAvailable=fddimibMACMAUnitdataAvailable, fddimibMACNumber=fddimibMACNumber, fddimibMACTokenCts=fddimibMACTokenCts, fddimibSMTBypassPresent=fddimibSMTBypassPresent, fddimibPATHConfigPATHIndex=fddimibPATHConfigPATHIndex, fddimibPORTNeighborType=fddimibPORTNeighborType, fddi=fddi, fddimibSMTConfigPolicy=fddimibSMTConfigPolicy, FddiTimeMilli=FddiTimeMilli, fddimibMACMAUnitdataEnable=fddimibMACMAUnitdataEnable, fddimibMACSMTIndex=fddimibMACSMTIndex, fddimibPATHEntry=fddimibPATHEntry, fddimibSMTIndex=fddimibSMTIndex, fddimibPORTAction=fddimibPORTAction, fddimibMACErrorCts=fddimibMACErrorCts, fddimibSMTTable=fddimibSMTTable, fddimibMACFrameStatusFunctions=fddimibMACFrameStatusFunctions, fddimibPATHTVXLowerBound=fddimibPATHTVXLowerBound, fddimibPATHConfigEntry=fddimibPATHConfigEntry, fddimibMACEntry=fddimibMACEntry, fddimibSMTUserData=fddimibSMTUserData)
#!/usr/bin/python """ This module contains helper functions to parser Multi2Sim trace """ def parser(keyword, line): """ Main parser function """ try: for item in line.split(' '): if keyword in item: return item.split('=')[1] except IndexError: return "[ERR] parser: " + line def parse_as_int(keyword, line): """ Decode and return as integer """ return int(parser(keyword, line)) def parse_as_string(keyword, line): """ Decode and return as string, remove redundant characters """ temp = line.replace('"', '') temp = temp.replace('\n', '') string = parser(keyword, temp) return string def get_inst_uid(line): """ Get instruction unique id """ return parse_as_string('cu', line) + parse_as_string('id', line) def get_id(line): """ Decode id """ return int(parser('id', line)) def get_cu(line): """ Decode cu """ return int(parser('cu', line)) def get_ib(line): """ Decode ib """ return int(parser('ib', line)) def get_wg(line): """ Decode wg """ return int(parser('wg', line)) def get_wf(line): """ Decode wf """ return int(parser('wf', line)) def get_uop(line): """ Decode uop """ return int(parser('uop_id', line)) def get_stg(line): """ Decode stg """ if 'si.end_inst' in line: return 'end' else: return parse_as_string('stg', line) def get_asm(line): """ Decode asm """ return parse_as_string('asm', line) def get_inst_type(line): """ Decode instruction type """ asm = parse_as_string('asm', line) is_scalar = 0 is_mem = 0 is_load = 0 is_ds = 0 if asm.split('_')[0] == 's': is_scalar = 1 if asm.split('_')[0] == 'ds': is_ds = 1 if 'load' in asm: is_mem = 1 is_load = 1 elif 'store' in asm: is_mem = 1 is_load = 0 return is_scalar << 3 + is_mem << 2 + is_load << 1 + is_ds def get_name(line): """ Decode name """ return parse_as_string('name', line) def get_addr(line): """ Decode addr """ return parser('addr', line) def get_type(line): """ Decode type """ return parse_as_string('type', line) def get_state(line): """ Decode state """ return parse_as_string('state', line) def get_state_location(line): """ Decode state location: L1 or LDS """ return get_state(line).split(':')[0] def get_state_action(line): """ Decode state action: Load, Store or NC Store """ return get_state(line).split(':')[1] def get_access_id(line): """ Decode access id """ return int(get_name(line).split('-')[1])
""" This module contains helper functions to parser Multi2Sim trace """ def parser(keyword, line): """ Main parser function """ try: for item in line.split(' '): if keyword in item: return item.split('=')[1] except IndexError: return '[ERR] parser: ' + line def parse_as_int(keyword, line): """ Decode and return as integer """ return int(parser(keyword, line)) def parse_as_string(keyword, line): """ Decode and return as string, remove redundant characters """ temp = line.replace('"', '') temp = temp.replace('\n', '') string = parser(keyword, temp) return string def get_inst_uid(line): """ Get instruction unique id """ return parse_as_string('cu', line) + parse_as_string('id', line) def get_id(line): """ Decode id """ return int(parser('id', line)) def get_cu(line): """ Decode cu """ return int(parser('cu', line)) def get_ib(line): """ Decode ib """ return int(parser('ib', line)) def get_wg(line): """ Decode wg """ return int(parser('wg', line)) def get_wf(line): """ Decode wf """ return int(parser('wf', line)) def get_uop(line): """ Decode uop """ return int(parser('uop_id', line)) def get_stg(line): """ Decode stg """ if 'si.end_inst' in line: return 'end' else: return parse_as_string('stg', line) def get_asm(line): """ Decode asm """ return parse_as_string('asm', line) def get_inst_type(line): """ Decode instruction type """ asm = parse_as_string('asm', line) is_scalar = 0 is_mem = 0 is_load = 0 is_ds = 0 if asm.split('_')[0] == 's': is_scalar = 1 if asm.split('_')[0] == 'ds': is_ds = 1 if 'load' in asm: is_mem = 1 is_load = 1 elif 'store' in asm: is_mem = 1 is_load = 0 return is_scalar << 3 + is_mem << 2 + is_load << 1 + is_ds def get_name(line): """ Decode name """ return parse_as_string('name', line) def get_addr(line): """ Decode addr """ return parser('addr', line) def get_type(line): """ Decode type """ return parse_as_string('type', line) def get_state(line): """ Decode state """ return parse_as_string('state', line) def get_state_location(line): """ Decode state location: L1 or LDS """ return get_state(line).split(':')[0] def get_state_action(line): """ Decode state action: Load, Store or NC Store """ return get_state(line).split(':')[1] def get_access_id(line): """ Decode access id """ return int(get_name(line).split('-')[1])
class ODLIRD(): def load_odl_ird(self, odl_ird): self.content = odl_ird return self def rfc_ird(self): return { 'meta': self.to_rfc_meta(self.content['meta']), 'resources': self.to_rfc_resources(self.content['resources']) } def to_rfc_meta(self, odl_meta): return { 'cost-types': self.to_rfc_cost_type(odl_meta['cost-types']), 'default-alto-network-map': odl_meta['default-alto-network-map']['resource-id'] } def to_rfc_cost_type(self, odl_cost_types): cost_types = {} for cost_type in odl_cost_types: cost_type_name = cost_type['cost-type-name'] cost_types[cost_type_name] = { 'cost-mode': cost_type['cost-mode'], 'cost-metric': cost_type['cost-metric'], 'description': cost_type['description'] } return cost_types def to_rfc_resources(self, odl_resources): resources = {} for resource in odl_resources: resource_id = resource['resource-id'] resources[resource_id] = self.to_rfc_resource(resource) return resources def to_rfc_resource(self, odl_resource): rfc_resource = { 'uri': odl_resource['uri'], 'media-type': odl_resource['media-type'] } if 'accepts' in odl_resource: rfc_resource['accepts'] = ','.join(odl_resource['accepts']) if 'capabilities' in odl_resource: rfc_resource['capabilities'] = odl_resource['capabilities'] if 'uses' in odl_resource: rfc_resource['uses'] = odl_resource['uses'] return rfc_resource
class Odlird: def load_odl_ird(self, odl_ird): self.content = odl_ird return self def rfc_ird(self): return {'meta': self.to_rfc_meta(self.content['meta']), 'resources': self.to_rfc_resources(self.content['resources'])} def to_rfc_meta(self, odl_meta): return {'cost-types': self.to_rfc_cost_type(odl_meta['cost-types']), 'default-alto-network-map': odl_meta['default-alto-network-map']['resource-id']} def to_rfc_cost_type(self, odl_cost_types): cost_types = {} for cost_type in odl_cost_types: cost_type_name = cost_type['cost-type-name'] cost_types[cost_type_name] = {'cost-mode': cost_type['cost-mode'], 'cost-metric': cost_type['cost-metric'], 'description': cost_type['description']} return cost_types def to_rfc_resources(self, odl_resources): resources = {} for resource in odl_resources: resource_id = resource['resource-id'] resources[resource_id] = self.to_rfc_resource(resource) return resources def to_rfc_resource(self, odl_resource): rfc_resource = {'uri': odl_resource['uri'], 'media-type': odl_resource['media-type']} if 'accepts' in odl_resource: rfc_resource['accepts'] = ','.join(odl_resource['accepts']) if 'capabilities' in odl_resource: rfc_resource['capabilities'] = odl_resource['capabilities'] if 'uses' in odl_resource: rfc_resource['uses'] = odl_resource['uses'] return rfc_resource
N, A, B, C = map(int, input().split()) l_list = [int(input()) for _ in range(N)] inf = float("inf") def dfs(cur, a, b, c): if cur == N: return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else inf ans0 = dfs(cur + 1, a, b, c) ans1 = dfs(cur + 1, a + l_list[cur], b, c) + 10 ans2 = dfs(cur + 1, a, b + l_list[cur], c) + 10 ans3 = dfs(cur + 1, a, b, c + l_list[cur]) + 10 return min(ans0, ans1, ans2, ans3) print(dfs(0, 0, 0, 0))
(n, a, b, c) = map(int, input().split()) l_list = [int(input()) for _ in range(N)] inf = float('inf') def dfs(cur, a, b, c): if cur == N: return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else inf ans0 = dfs(cur + 1, a, b, c) ans1 = dfs(cur + 1, a + l_list[cur], b, c) + 10 ans2 = dfs(cur + 1, a, b + l_list[cur], c) + 10 ans3 = dfs(cur + 1, a, b, c + l_list[cur]) + 10 return min(ans0, ans1, ans2, ans3) print(dfs(0, 0, 0, 0))
class Pickleable(object): """ Base class that implements getstate/setstate, since most of the classes are overriding getattr. """ def __getstate__(self): return self.__dict__ def __setstate__(self, data): self.__dict__.update(data)
class Pickleable(object): """ Base class that implements getstate/setstate, since most of the classes are overriding getattr. """ def __getstate__(self): return self.__dict__ def __setstate__(self, data): self.__dict__.update(data)
conditions = { 'test_project_ids': ['*'], 'test_suite_ids': ['*'], 'test_names': ['logout'], } def post_test_run(): pass
conditions = {'test_project_ids': ['*'], 'test_suite_ids': ['*'], 'test_names': ['logout']} def post_test_run(): pass
__author__ = 'tilmannbruckhaus' class Pandigital: def __init__(self, digits): self.p = digits self.N = len(self.p) def find(self, n): for i in range(n - 1): self.step() return self.get() def step(self): # The algorithm is described in E. W. Dijkstra, A Discipline of Programming, Prentice-Hall, 1997, p. 71 i = self.N - 1 while self.p[i-1] >= self.p[i]: i -= 1 j = self.N while self.p[j - 1] <= self.p[i - 1]: j -= 1 self.swap(i-1, j-1) # swap values at positions (i-1) and (j-1) i += 1 j = self.N while i < j: self.swap(i-1, j-1) i += 1 j -= 1 def swap(self, i, j): swap = self.p[j] self.p[j] = self.p[i] self.p[i] = swap def next(self): if not self.has_next(): return False self.step() return self.get() def has_next(self): for i in range(self.N - 1): if self.p[i] < self.p[i + 1]: return True return False def get(self): return ''.join([str(d) for d in self.p])
__author__ = 'tilmannbruckhaus' class Pandigital: def __init__(self, digits): self.p = digits self.N = len(self.p) def find(self, n): for i in range(n - 1): self.step() return self.get() def step(self): i = self.N - 1 while self.p[i - 1] >= self.p[i]: i -= 1 j = self.N while self.p[j - 1] <= self.p[i - 1]: j -= 1 self.swap(i - 1, j - 1) i += 1 j = self.N while i < j: self.swap(i - 1, j - 1) i += 1 j -= 1 def swap(self, i, j): swap = self.p[j] self.p[j] = self.p[i] self.p[i] = swap def next(self): if not self.has_next(): return False self.step() return self.get() def has_next(self): for i in range(self.N - 1): if self.p[i] < self.p[i + 1]: return True return False def get(self): return ''.join([str(d) for d in self.p])
""" 151. Reverse Words in a String Medium Given an input string s, reverse the order of the words. A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space. Return a string of the words in reverse order concatenated by a single space. Note that s may contain leading or trailing spaces or multiple spaces between two words. The returned string should only have a single space separating the words. Do not include any extra spaces. Example 1: Input: s = "the sky is blue" Output: "blue is sky the" Example 2: Input: s = " hello world " Output: "world hello" Explanation: Your reversed string should not contain leading or trailing spaces. Example 3: Input: s = "a good example" Output: "example good a" Explanation: You need to reduce multiple spaces between two words to a single space in the reversed string. Constraints: 1 <= s.length <= 104 s contains English letters (upper-case and lower-case), digits, and spaces ' '. There is at least one word in s. Follow-up: If the string data type is mutable in your language, can you solve it in-place with O(1) extra space? """ # V0 # IDEA : py string op class Solution(object): def reverseWords(self, s): _s = s.strip().split(" ") _s_list = [x for x in _s if len(x) > 0][::-1] return " ".join(_s_list) # V1 # http://bookshadow.com/weblog/2014/10/16/leetcode-reverse-words-string/ class Solution: # @param s, a string # @return a string def reverseWords(self, s): words = s.split() words.reverse() return " ".join(words) # V2 # Time: O(n) # Space: O(n) class Solution(object): # @param s, a string # @return a string def reverseWords(self, s): return ' '.join(reversed(s.split()))
""" 151. Reverse Words in a String Medium Given an input string s, reverse the order of the words. A word is defined as a sequence of non-space characters. The words in s will be separated by at least one space. Return a string of the words in reverse order concatenated by a single space. Note that s may contain leading or trailing spaces or multiple spaces between two words. The returned string should only have a single space separating the words. Do not include any extra spaces. Example 1: Input: s = "the sky is blue" Output: "blue is sky the" Example 2: Input: s = " hello world " Output: "world hello" Explanation: Your reversed string should not contain leading or trailing spaces. Example 3: Input: s = "a good example" Output: "example good a" Explanation: You need to reduce multiple spaces between two words to a single space in the reversed string. Constraints: 1 <= s.length <= 104 s contains English letters (upper-case and lower-case), digits, and spaces ' '. There is at least one word in s. Follow-up: If the string data type is mutable in your language, can you solve it in-place with O(1) extra space? """ class Solution(object): def reverse_words(self, s): _s = s.strip().split(' ') _s_list = [x for x in _s if len(x) > 0][::-1] return ' '.join(_s_list) class Solution: def reverse_words(self, s): words = s.split() words.reverse() return ' '.join(words) class Solution(object): def reverse_words(self, s): return ' '.join(reversed(s.split()))
""" Module: 'io' on LEGO EV3 v1.0.0 """ # MCU: sysname=ev3, nodename=ev3, release=('v1.0.0',), version=('0.0.0',), machine=ev3 # Stubber: 1.3.2 class BytesIO: '' def close(): pass def flush(): pass def getvalue(): pass def read(): pass def readinto(): pass def readline(): pass def seek(): pass def write(): pass class FileIO: '' def close(): pass def fileno(): pass def flush(): pass def read(): pass def readinto(): pass def readline(): pass def readlines(): pass def seek(): pass def tell(): pass def write(): pass class IOBase: '' SEEK_CUR = 1 SEEK_END = 2 SEEK_SET = 0 class StringIO: '' def close(): pass def flush(): pass def getvalue(): pass def read(): pass def readinto(): pass def readline(): pass def seek(): pass def write(): pass class TextIOWrapper: '' def close(): pass def fileno(): pass def flush(): pass def read(): pass def readinto(): pass def readline(): pass def readlines(): pass def seek(): pass def tell(): pass def write(): pass def open(): pass
""" Module: 'io' on LEGO EV3 v1.0.0 """ class Bytesio: """""" def close(): pass def flush(): pass def getvalue(): pass def read(): pass def readinto(): pass def readline(): pass def seek(): pass def write(): pass class Fileio: """""" def close(): pass def fileno(): pass def flush(): pass def read(): pass def readinto(): pass def readline(): pass def readlines(): pass def seek(): pass def tell(): pass def write(): pass class Iobase: """""" seek_cur = 1 seek_end = 2 seek_set = 0 class Stringio: """""" def close(): pass def flush(): pass def getvalue(): pass def read(): pass def readinto(): pass def readline(): pass def seek(): pass def write(): pass class Textiowrapper: """""" def close(): pass def fileno(): pass def flush(): pass def read(): pass def readinto(): pass def readline(): pass def readlines(): pass def seek(): pass def tell(): pass def write(): pass def open(): pass
"""Some additional journal abbreviations which are not provided by Crossref.""" JOURNAL_ABBRVS = { "American Journal of Mathematics": "Am. J. Math.", "American Journal of Physics": "Am. J. Phys", "Annals of Physics": "Ann. Phys.", "Communications in Mathematical Physics": "Commun. Math. Phys.", "Journal of Mathematical Physics": "J. Math. Phys.", "Journal of Statistical Physics": "J. Stat. Phys.", "Nature Physics": "Nat. Phys.", "Nuclear Physics B": "Nucl. Phys. B", "Physics Letters A": "Phys. Lett. A", "Physics Letters B": "Phys. Lett. B", "Journal of High Energy Physics": "J. High Energ. Phys.", "Journal of Magnetism and Magnetic Materials": "J. Magn. Magn. Mater.", "Nature Communications": "Nat. Commun.", "Scientific Reports": "Sci. Rep.", "Journal of Applied Physics": "J. Appl. Phys.", "Physics Reports": "Phys. Rep.", "Computer Physics Communications": "Comput. Phys. Commun." }
"""Some additional journal abbreviations which are not provided by Crossref.""" journal_abbrvs = {'American Journal of Mathematics': 'Am. J. Math.', 'American Journal of Physics': 'Am. J. Phys', 'Annals of Physics': 'Ann. Phys.', 'Communications in Mathematical Physics': 'Commun. Math. Phys.', 'Journal of Mathematical Physics': 'J. Math. Phys.', 'Journal of Statistical Physics': 'J. Stat. Phys.', 'Nature Physics': 'Nat. Phys.', 'Nuclear Physics B': 'Nucl. Phys. B', 'Physics Letters A': 'Phys. Lett. A', 'Physics Letters B': 'Phys. Lett. B', 'Journal of High Energy Physics': 'J. High Energ. Phys.', 'Journal of Magnetism and Magnetic Materials': 'J. Magn. Magn. Mater.', 'Nature Communications': 'Nat. Commun.', 'Scientific Reports': 'Sci. Rep.', 'Journal of Applied Physics': 'J. Appl. Phys.', 'Physics Reports': 'Phys. Rep.', 'Computer Physics Communications': 'Comput. Phys. Commun.'}
class Config: def __init__(self, **kwargs): self.protocol = kwargs.get('protocol') self.ip = kwargs.get('ip') self.port = kwargs.get('port') self.heavy_traffic = kwargs.get('heavy_traffic') self.time_patterns = kwargs.get('time_patterns') self.start_time = kwargs.get('start_time') self.post_data: list = kwargs.get('post_data') self.delete_data: list = kwargs.get('delete_data') self.end_time = kwargs.get('end_time') self.max_connection_refuse_count = kwargs.get('max_connection_refuse_count') self.dataset_file = kwargs.get('dataset_file') self.initial_timestamp = kwargs.get('initial_timestamp') # passing default value since the object is used in both generating traffic and invoking traffic self.script_runtime = kwargs.get('script_runtime', 0) self.no_of_data_points = kwargs.get('no_of_data_points', 0)
class Config: def __init__(self, **kwargs): self.protocol = kwargs.get('protocol') self.ip = kwargs.get('ip') self.port = kwargs.get('port') self.heavy_traffic = kwargs.get('heavy_traffic') self.time_patterns = kwargs.get('time_patterns') self.start_time = kwargs.get('start_time') self.post_data: list = kwargs.get('post_data') self.delete_data: list = kwargs.get('delete_data') self.end_time = kwargs.get('end_time') self.max_connection_refuse_count = kwargs.get('max_connection_refuse_count') self.dataset_file = kwargs.get('dataset_file') self.initial_timestamp = kwargs.get('initial_timestamp') self.script_runtime = kwargs.get('script_runtime', 0) self.no_of_data_points = kwargs.get('no_of_data_points', 0)
x = [0] print(x) x.__setitem__(0,1) print(x) x.__setitem__(0,2) print(x) x = [4,5,6] x.__setitem__(1,7) print(x) x.__setitem__(2,8) print(x)
x = [0] print(x) x.__setitem__(0, 1) print(x) x.__setitem__(0, 2) print(x) x = [4, 5, 6] x.__setitem__(1, 7) print(x) x.__setitem__(2, 8) print(x)
for row in range(1,11): for col in range(1,21): prod = row*col if prod < 10: print('','', prod, '',end='') elif prod < 100: print('', prod, '',end='') else: print(prod, '',end='') print()
for row in range(1, 11): for col in range(1, 21): prod = row * col if prod < 10: print('', '', prod, '', end='') elif prod < 100: print('', prod, '', end='') else: print(prod, '', end='') print()
a=100 class A: b=200 def fn(self,a=1): print("fn in A") def mfn(): print("Inside mfn") print("Mod1")
a = 100 class A: b = 200 def fn(self, a=1): print('fn in A') def mfn(): print('Inside mfn') print('Mod1')
{ "targets": [ { "target_name": "node_shoom", "include_dirs": [ "vendor/shoom/include", "<!(node -e \"require('nan')\")" ], "sources": [ "addon.cc", "node_shoom.cc" ], "conditions": [ ["OS == 'win'", { "sources": [ "vendor/shoom/src/shoom_win32.cc" ] }], ["OS != 'win'", { "sources": [ "vendor/shoom/src/shoom_unix_darwin.cc" ] }], ] } ] }
{'targets': [{'target_name': 'node_shoom', 'include_dirs': ['vendor/shoom/include', '<!(node -e "require(\'nan\')")'], 'sources': ['addon.cc', 'node_shoom.cc'], 'conditions': [["OS == 'win'", {'sources': ['vendor/shoom/src/shoom_win32.cc']}], ["OS != 'win'", {'sources': ['vendor/shoom/src/shoom_unix_darwin.cc']}]]}]}
def split_annotation(annotation: dict): context = annotation['@context'] body = annotation['body'] target = annotation['target'] custom_keys = [ key for key in annotation if key not in ['body', 'target', '@context', 'id', 'type'] ] custom = {k: annotation[k] for k in custom_keys} if isinstance(context, list) and len(context) > 1: custom_contexts = [c for c in context if c != "http://www.w3.org/ns/anno.jsonld"] else: custom_contexts = None return body, target, custom, custom_contexts
def split_annotation(annotation: dict): context = annotation['@context'] body = annotation['body'] target = annotation['target'] custom_keys = [key for key in annotation if key not in ['body', 'target', '@context', 'id', 'type']] custom = {k: annotation[k] for k in custom_keys} if isinstance(context, list) and len(context) > 1: custom_contexts = [c for c in context if c != 'http://www.w3.org/ns/anno.jsonld'] else: custom_contexts = None return (body, target, custom, custom_contexts)
requirements = [ 'marshmallow==3.5.1', 'bumpversion==0.6.0' ]
requirements = ['marshmallow==3.5.1', 'bumpversion==0.6.0']
# -*- coding: utf-8 -*- DEBUG = True SQLALCHEMY_ECHO = True SQLALCHEMY_DATABASE_URI = 'mysql://root:123456@127.0.0.1/food_db?charset=utf8mb4' SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_ENCODING = "utf8mb4"
debug = True sqlalchemy_echo = True sqlalchemy_database_uri = 'mysql://root:123456@127.0.0.1/food_db?charset=utf8mb4' sqlalchemy_track_modifications = False sqlalchemy_encoding = 'utf8mb4'
k1 = input("birinci kelime:") k2 = input("ikinci kelime:") temp1 = k1[0:2] temp2 = k2[0:2] for i in k2[2:]: temp1 += i for i in k1[2:]: temp2 += i print(temp2) print(temp1)
k1 = input('birinci kelime:') k2 = input('ikinci kelime:') temp1 = k1[0:2] temp2 = k2[0:2] for i in k2[2:]: temp1 += i for i in k1[2:]: temp2 += i print(temp2) print(temp1)
def hr(n): if n % 2 == 0: return int(n // 2) else: return 3 * n + 1 while True: n = int(input()) if n == 0: break m = n while n != 1: if m < n: m = n n = hr(n) print(m)
def hr(n): if n % 2 == 0: return int(n // 2) else: return 3 * n + 1 while True: n = int(input()) if n == 0: break m = n while n != 1: if m < n: m = n n = hr(n) print(m)
class Solution: def largestOverlap(self, A: List[List[int]], B: List[List[int]]) -> int: C = [[0 for _ in range(len(B[0]) * 3 - 2)] for _ in range(len(B) * 3 - 2)] for i in range(len(B)): for j in range(len(B[0])): C[i + len(B) - 1][j + len(B[0]) - 1] = B[i][j] total_cnt = 0 for i in range(len(C) - len(A) + 1): for j in range(len(C[0]) - len(A[0]) + 1): cnt = 0 #Traversing count for a in range(len(A)): for b in range(len(A[0])): #Traversing count ia & jb, Counting ia, jb = i + a, j + b #If A covers B, we incrementing 'cnt' value by 1 if 1 == C[ia][jb] == A[a][b]: cnt += 1 #and returning the maximum value ('total_cnt') is what we want. if cnt > total_cnt: total_cnt = cnt return total_cnt
class Solution: def largest_overlap(self, A: List[List[int]], B: List[List[int]]) -> int: c = [[0 for _ in range(len(B[0]) * 3 - 2)] for _ in range(len(B) * 3 - 2)] for i in range(len(B)): for j in range(len(B[0])): C[i + len(B) - 1][j + len(B[0]) - 1] = B[i][j] total_cnt = 0 for i in range(len(C) - len(A) + 1): for j in range(len(C[0]) - len(A[0]) + 1): cnt = 0 for a in range(len(A)): for b in range(len(A[0])): (ia, jb) = (i + a, j + b) if 1 == C[ia][jb] == A[a][b]: cnt += 1 if cnt > total_cnt: total_cnt = cnt return total_cnt
PROXMOX_CLUSTER_SCHEMA = { 'type': 'object', 'properties': { 'name': {'type': 'string'}, 'nodes': { 'type': 'array', 'items': { 'type': 'object', 'properties': { 'name': {'type': 'string'}, 'ip': {'type': 'string'}, 'host': {'type': 'string'}, 'user': {'type': 'string'}, 'password': {'type': 'string'}, 'key_filename': {'type': 'string'}, 'key_passphrase': {'type': 'string'}, 'port': {'type': 'integer'}, 'sudo': {'type': 'boolean'} }, 'required': ['name'] }, 'minItems': 1, 'uniqueItems': True }, 'network': { 'type': 'object', 'properties': { 'base': {'type': 'string'}, 'gateway': {'type': 'string'}, 'allocated': { 'type': 'array', 'items': { 'type': 'string', 'uniqueItems': True } }, 'allowed_range': { 'type': 'object', 'properties': { 'start': { 'type': 'integer', 'minimum': 6, 'maximum': 254 }, 'end': { 'type': 'integer', 'minimum': 6, 'maximum': 254 } }, 'required': ['start', 'end'] }, 'loadbalancer_range': { 'type': 'object', 'properties': { 'start': { 'type': 'integer', 'minimum': 6, 'maximum': 254 }, 'end': { 'type': 'integer', 'minimum': 6, 'maximum': 254 } }, 'required': ['start', 'end'] } }, 'required': ['base', 'gateway', 'allowed_range'] } }, 'required': ['name', 'nodes', 'network'] } KUBE_CLUSTER_SCHEMA = { 'type': 'object', 'properties': { 'name': {'type': 'string'}, 'user': {'type': 'string'}, 'context': {'type': 'string'}, 'pool': {'type': 'string'}, 'os_type': { 'type': 'string', 'pattern': '^(ubuntu|centos)$' }, 'ssh_key': {'type': 'string'}, 'versions': { 'type': 'object', 'properties': { 'kubernetes': { 'type': 'string', 'pattern': '^(1.15|1.15.*|1.16|1.16.*|1.17|1.17.*)$' }, # 'docker': { # 'type': 'string', # 'pattern': '^(18|18.06|18.06.*|18.09|18.09.*|19|19.03|19.03.*)$' # }, 'docker_ce': {'type': 'boolean'} }, 'required': [] }, 'template': { 'type': 'object', 'properties': { 'pve_storage': { 'type': 'object', 'properties': { 'instance': { 'type': 'object', 'properties': { 'type': { 'type': 'string', 'pattern': '^(cephfs|cifs|dir|drbd|fake|glusterfs|iscsi|iscsidirect|lvm|lvmthin|nfs|rbd|sheepdog|zfs|zfspool)$' } }, 'required': ['type'] }, 'image': { 'type': 'object', 'properties': { 'type': { 'type': 'string', 'pattern': '^(cephfs|cifs|dir|drbd|fake|glusterfs|iscsi|iscsidirect|lvm|lvmthin|nfs|rbd|sheepdog|zfs|zfspool)$' } }, 'required': ['type'] } }, 'required': ['instance', 'image'] }, 'name': {'type': 'string'}, 'node': {'type': 'string'}, 'cpus': { 'type': 'integer', 'minimum': 1 }, 'memory': { 'type': 'integer', 'minimum': 1 }, 'disk': { 'type': 'object', 'properties': { 'size': { 'type': 'integer', 'minimum': 1 }, 'hotplug': {'type': 'boolean'}, 'hotplug_size': { 'type': 'integer', 'minimum': 1 } }, 'required': ['size'] }, 'scsi': {'type': 'boolean'} }, 'required': ['pve_storage', 'node'] }, 'control_plane': { 'type': 'object', 'properties': { 'ha_masters': {'type': 'boolean'}, 'networking': { 'type': 'string', 'pattern': '^(calico|weave)$' }, 'apiserver': { 'type': 'object', 'properties': { 'ip': { 'type': ['string', 'null'], 'format': 'ipv4' }, 'port': {'type': ['integer', 'string']} }, 'required': [] } }, 'required': [] }, 'dashboard': {'type': 'boolean'}, 'storage': { 'type': ['string', 'null'], 'pattern': '^(rook|nfs|glusterfs)$' }, 'loadbalancer': {'type': 'boolean'}, 'helm': { 'type': 'object', 'properties': { 'version': { 'type': 'string', 'pattern': '^(v2|v3)$' }, 'local': {'type': 'boolean'}, 'tiller': {'type': 'boolean'} }, 'required': [] }, 'masters': { 'type': 'object', 'properties': { 'name': {'type': 'string'}, 'node': {'type': 'string'}, 'scale': { 'type': 'integer', 'minimum': 1 }, 'cpus': { 'type': 'integer', 'minimum': 1 }, 'memory': { 'type': 'integer', 'minimum': 1 }, 'pve_storage': { 'type': 'object', 'properties': { 'type': { 'type': 'string', 'pattern': '^(cephfs|cifs|dir|drbd|fake|glusterfs|iscsi|iscsidirect|lvm|lvmthin|nfs|rbd|sheepdog|zfs|zfspool)$' } }, 'required': ['type'] }, 'disk': { 'type': 'object', 'properties': { 'size': { 'type': 'integer', 'minimum': 1 }, 'hotplug': {'type': 'boolean'}, 'hotplug_size': { 'type': 'integer', 'minimum': 1 } }, 'required': ['size'] }, 'scsi': {'type': 'boolean'} }, 'required': ['name', 'node', 'scale', 'cpus', 'memory', 'disk'] }, 'workers': { 'type': 'array', 'items': { 'type': 'object', 'properties': { 'name': {'type': 'string'}, 'node': {'type': 'string'}, 'role': {'type': 'string'}, 'scale': { 'type': 'integer', 'minimum': 0 }, 'cpus': { 'type': 'integer', 'minimum': 1 }, 'memory': { 'type': 'integer', 'minimum': 1 }, 'pve_storage': { 'type': 'object', 'properties': { 'type': { 'type': 'string', 'pattern': '^(cephfs|cifs|dir|drbd|fake|glusterfs|iscsi|iscsidirect|lvm|lvmthin|nfs|rbd|sheepdog|zfs|zfspool)$' } }, 'required': ['type'] }, 'disk': { 'type': 'object', 'properties': { 'size': { 'type': 'integer', 'minimum': 1 }, 'hotplug': {'type': 'boolean'}, 'hotplug_size': { 'type': 'integer', 'minimum': 1 } }, 'required': ['size'] }, 'scsi': {'type': 'boolean'}, 'secondary_iface': {'type': 'boolean'} }, 'required': ['name', 'node', 'scale', 'cpus', 'memory', 'disk'], 'uniqueItems': True } } }, 'required': ['name', 'pool', 'os_type', 'ssh_key', 'template', 'masters', 'workers'] }
proxmox_cluster_schema = {'type': 'object', 'properties': {'name': {'type': 'string'}, 'nodes': {'type': 'array', 'items': {'type': 'object', 'properties': {'name': {'type': 'string'}, 'ip': {'type': 'string'}, 'host': {'type': 'string'}, 'user': {'type': 'string'}, 'password': {'type': 'string'}, 'key_filename': {'type': 'string'}, 'key_passphrase': {'type': 'string'}, 'port': {'type': 'integer'}, 'sudo': {'type': 'boolean'}}, 'required': ['name']}, 'minItems': 1, 'uniqueItems': True}, 'network': {'type': 'object', 'properties': {'base': {'type': 'string'}, 'gateway': {'type': 'string'}, 'allocated': {'type': 'array', 'items': {'type': 'string', 'uniqueItems': True}}, 'allowed_range': {'type': 'object', 'properties': {'start': {'type': 'integer', 'minimum': 6, 'maximum': 254}, 'end': {'type': 'integer', 'minimum': 6, 'maximum': 254}}, 'required': ['start', 'end']}, 'loadbalancer_range': {'type': 'object', 'properties': {'start': {'type': 'integer', 'minimum': 6, 'maximum': 254}, 'end': {'type': 'integer', 'minimum': 6, 'maximum': 254}}, 'required': ['start', 'end']}}, 'required': ['base', 'gateway', 'allowed_range']}}, 'required': ['name', 'nodes', 'network']} kube_cluster_schema = {'type': 'object', 'properties': {'name': {'type': 'string'}, 'user': {'type': 'string'}, 'context': {'type': 'string'}, 'pool': {'type': 'string'}, 'os_type': {'type': 'string', 'pattern': '^(ubuntu|centos)$'}, 'ssh_key': {'type': 'string'}, 'versions': {'type': 'object', 'properties': {'kubernetes': {'type': 'string', 'pattern': '^(1.15|1.15.*|1.16|1.16.*|1.17|1.17.*)$'}, 'docker_ce': {'type': 'boolean'}}, 'required': []}, 'template': {'type': 'object', 'properties': {'pve_storage': {'type': 'object', 'properties': {'instance': {'type': 'object', 'properties': {'type': {'type': 'string', 'pattern': '^(cephfs|cifs|dir|drbd|fake|glusterfs|iscsi|iscsidirect|lvm|lvmthin|nfs|rbd|sheepdog|zfs|zfspool)$'}}, 'required': ['type']}, 'image': {'type': 'object', 'properties': {'type': {'type': 'string', 'pattern': '^(cephfs|cifs|dir|drbd|fake|glusterfs|iscsi|iscsidirect|lvm|lvmthin|nfs|rbd|sheepdog|zfs|zfspool)$'}}, 'required': ['type']}}, 'required': ['instance', 'image']}, 'name': {'type': 'string'}, 'node': {'type': 'string'}, 'cpus': {'type': 'integer', 'minimum': 1}, 'memory': {'type': 'integer', 'minimum': 1}, 'disk': {'type': 'object', 'properties': {'size': {'type': 'integer', 'minimum': 1}, 'hotplug': {'type': 'boolean'}, 'hotplug_size': {'type': 'integer', 'minimum': 1}}, 'required': ['size']}, 'scsi': {'type': 'boolean'}}, 'required': ['pve_storage', 'node']}, 'control_plane': {'type': 'object', 'properties': {'ha_masters': {'type': 'boolean'}, 'networking': {'type': 'string', 'pattern': '^(calico|weave)$'}, 'apiserver': {'type': 'object', 'properties': {'ip': {'type': ['string', 'null'], 'format': 'ipv4'}, 'port': {'type': ['integer', 'string']}}, 'required': []}}, 'required': []}, 'dashboard': {'type': 'boolean'}, 'storage': {'type': ['string', 'null'], 'pattern': '^(rook|nfs|glusterfs)$'}, 'loadbalancer': {'type': 'boolean'}, 'helm': {'type': 'object', 'properties': {'version': {'type': 'string', 'pattern': '^(v2|v3)$'}, 'local': {'type': 'boolean'}, 'tiller': {'type': 'boolean'}}, 'required': []}, 'masters': {'type': 'object', 'properties': {'name': {'type': 'string'}, 'node': {'type': 'string'}, 'scale': {'type': 'integer', 'minimum': 1}, 'cpus': {'type': 'integer', 'minimum': 1}, 'memory': {'type': 'integer', 'minimum': 1}, 'pve_storage': {'type': 'object', 'properties': {'type': {'type': 'string', 'pattern': '^(cephfs|cifs|dir|drbd|fake|glusterfs|iscsi|iscsidirect|lvm|lvmthin|nfs|rbd|sheepdog|zfs|zfspool)$'}}, 'required': ['type']}, 'disk': {'type': 'object', 'properties': {'size': {'type': 'integer', 'minimum': 1}, 'hotplug': {'type': 'boolean'}, 'hotplug_size': {'type': 'integer', 'minimum': 1}}, 'required': ['size']}, 'scsi': {'type': 'boolean'}}, 'required': ['name', 'node', 'scale', 'cpus', 'memory', 'disk']}, 'workers': {'type': 'array', 'items': {'type': 'object', 'properties': {'name': {'type': 'string'}, 'node': {'type': 'string'}, 'role': {'type': 'string'}, 'scale': {'type': 'integer', 'minimum': 0}, 'cpus': {'type': 'integer', 'minimum': 1}, 'memory': {'type': 'integer', 'minimum': 1}, 'pve_storage': {'type': 'object', 'properties': {'type': {'type': 'string', 'pattern': '^(cephfs|cifs|dir|drbd|fake|glusterfs|iscsi|iscsidirect|lvm|lvmthin|nfs|rbd|sheepdog|zfs|zfspool)$'}}, 'required': ['type']}, 'disk': {'type': 'object', 'properties': {'size': {'type': 'integer', 'minimum': 1}, 'hotplug': {'type': 'boolean'}, 'hotplug_size': {'type': 'integer', 'minimum': 1}}, 'required': ['size']}, 'scsi': {'type': 'boolean'}, 'secondary_iface': {'type': 'boolean'}}, 'required': ['name', 'node', 'scale', 'cpus', 'memory', 'disk'], 'uniqueItems': True}}}, 'required': ['name', 'pool', 'os_type', 'ssh_key', 'template', 'masters', 'workers']}
n = int(input('Provide a number: ')) nums = [] for i in range(1, n+1): nums.append(i) print(*nums, sep=", ")
n = int(input('Provide a number: ')) nums = [] for i in range(1, n + 1): nums.append(i) print(*nums, sep=', ')
""" MicroPython MAX44009 Ambient Light Sensor https://github.com/mcauser/micropython-max44009 MIT License Copyright (c) 2020 Mike Causer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ __version__ = '0.0.6' # registers _MAX44009_INT_STATUS = const(0x00) # Interrupt status _MAX44009_INT_ENABLE = const(0x01) # Interrupt enable _MAX44009_CONFIG = const(0x02) # Configuration _MAX44009_LUX_HI = const(0x03) # Lux high byte _MAX44009_LUX_LO = const(0x04) # Lux low byte _MAX44009_UP_THRES = const(0x05) # Upper threshold high byte _MAX44009_LO_THRES = const(0x06) # Lower threshold high byte _MAX44009_THRES_TIMER = const(0x07) # Threshold timer class MAX44009: def __init__(self, i2c, address=0x4A): self._i2c = i2c self._address = address # 0x4A-0x4B self._config = 0x03 # power on reset state self._buf = bytearray(1) #self.check() def check(self): if self._i2c.scan().count(self._address) == 0: raise OSError('MAX44009 not found at I2C address {:#x}'.format(self._address)) @property def continuous(self): return (self._config >> 7) & 1 @continuous.setter def continuous(self, on): self._config = (self._config & ~128) | ((on << 7) & 128) self._write_config() @property def manual(self): return (self._config >> 6) & 1 @manual.setter def manual(self, on): self._config = (self._config & ~64) | ((on << 6) & 64) self._write_config() @property def current_division_ratio(self): return (self._config >> 3) & 1 @current_division_ratio.setter def current_division_ratio(self, divide_by_8): self._config = (self._config & ~8) | ((divide_by_8 << 3) & 8) self._write_config() @property def integration_time(self): return self._config & 7 @integration_time.setter def integration_time(self, time): self._config = (self._config & ~7) | (time & 7) self._write_config() @property def lux(self): # The dodgy way - may contain hi and lo bits of separate sensor reads. # An I2C start condition blocks sensor from updating its registers and an I2C stop condition resumes updates. # If you perform a repeated start transfer, it ensures you're getting bits from the same sensor reading. #self._read8(_MAX44009_LUX_HI) #exponent = self._buf[0] >> 4 #mantissa = ((self._buf[0] & 0x0F) << 4) #self._read8(_MAX44009_LUX_LO) #mantissa |= (self._buf[0] & 0x0F) #return self._exponent_mantissa_to_lux(exponent, mantissa) # The correct way - repeated start reads of the lux hi and lux lo registers. # First 3 writes/reads block sending the I2C stop condition. # Last read sends the stop condition after its done, allowing the sensor to resume populating the registers. self._buf[0] = _MAX44009_LUX_HI self._i2c.writeto(self._address, self._buf, False) self._i2c.readfrom_into(self._address, self._buf, False) exponent = self._buf[0] >> 4 mantissa = ((self._buf[0] & 0x0F) << 4) self._buf[0] = _MAX44009_LUX_LO self._i2c.writeto(self._address, self._buf, False) self._i2c.readfrom_into(self._address, self._buf, True) mantissa |= (self._buf[0] & 0x0F) return self._exponent_mantissa_to_lux(exponent, mantissa) @property def lux_fast(self): # Faster but slightly less accurate version # Only hitting the lux hi bits register self._read8(_MAX44009_LUX_HI) exponent = self._buf[0] >> 4 mantissa = ((self._buf[0] & 0x0F) << 4) return self._exponent_mantissa_to_lux(exponent, mantissa) @property def int_status(self): self._read8(_MAX44009_INT_STATUS) return self._buf[0] & 1 @property def int_enable(self): self._read8(_MAX44009_INT_ENABLE) return self._buf[0] & 1 @int_enable.setter def int_enable(self, en): self._write8(_MAX44009_INT_ENABLE, en & 1) @property def upper_threshold(self): return self._get_threshold(_MAX44009_UP_THRES, 15) @upper_threshold.setter def upper_threshold(self, lux): self._set_threshold(_MAX44009_UP_THRES, lux) @property def lower_threshold(self): return self._get_threshold(_MAX44009_LO_THRES, 0) @lower_threshold.setter def lower_threshold(self, lux): self._set_threshold(_MAX44009_LO_THRES, lux) @property def threshold_timer(self): self._read8(_MAX44009_THRES_TIMER) return self._buf[0] * 100 @threshold_timer.setter def threshold_timer(self, ms): # range 0 - 25500 ms (0 - 25.5 sec) assert 0 <= ms <= 25500 self._write8(_MAX44009_THRES_TIMER, int(ms) // 100) def _read8(self, reg): self._i2c.readfrom_mem_into(self._address, reg, self._buf) return self._buf[0] def _write8(self, reg, val): self._buf[0] = val self._i2c.writeto_mem(self._address, reg, self._buf) def _write_config(self): self._write8(_MAX44009_CONFIG, self._config) def _read_config(self): self._read8(_MAX44009_CONFIG) self._config = self._buf[0] def _lux_to_exponent_mantissa(self, lux): mantissa = int(lux * 1000) // 45 exponent = 0 while (mantissa > 255): mantissa >>= 1 exponent += 1 return (exponent, mantissa) def _exponent_mantissa_to_lux(self, exponent, mantissa): return (2 ** exponent) * mantissa * 0.045 def _get_threshold(self, reg, bonus_mantissa): self._read8(reg) exponent = self._buf[0] >> 4 mantissa = ((self._buf[0] & 0x0F) << 4) | bonus_mantissa return self._exponent_mantissa_to_lux(exponent, mantissa) def _set_threshold(self, reg, lux): (exponent, mantissa) = self._lux_to_exponent_mantissa(lux) assert 0 <= exponent <= 14 assert 0 <= mantissa <= 255 self._write8(reg, (exponent << 4) | (mantissa >> 4))
""" MicroPython MAX44009 Ambient Light Sensor https://github.com/mcauser/micropython-max44009 MIT License Copyright (c) 2020 Mike Causer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ __version__ = '0.0.6' _max44009_int_status = const(0) _max44009_int_enable = const(1) _max44009_config = const(2) _max44009_lux_hi = const(3) _max44009_lux_lo = const(4) _max44009_up_thres = const(5) _max44009_lo_thres = const(6) _max44009_thres_timer = const(7) class Max44009: def __init__(self, i2c, address=74): self._i2c = i2c self._address = address self._config = 3 self._buf = bytearray(1) def check(self): if self._i2c.scan().count(self._address) == 0: raise os_error('MAX44009 not found at I2C address {:#x}'.format(self._address)) @property def continuous(self): return self._config >> 7 & 1 @continuous.setter def continuous(self, on): self._config = self._config & ~128 | on << 7 & 128 self._write_config() @property def manual(self): return self._config >> 6 & 1 @manual.setter def manual(self, on): self._config = self._config & ~64 | on << 6 & 64 self._write_config() @property def current_division_ratio(self): return self._config >> 3 & 1 @current_division_ratio.setter def current_division_ratio(self, divide_by_8): self._config = self._config & ~8 | divide_by_8 << 3 & 8 self._write_config() @property def integration_time(self): return self._config & 7 @integration_time.setter def integration_time(self, time): self._config = self._config & ~7 | time & 7 self._write_config() @property def lux(self): self._buf[0] = _MAX44009_LUX_HI self._i2c.writeto(self._address, self._buf, False) self._i2c.readfrom_into(self._address, self._buf, False) exponent = self._buf[0] >> 4 mantissa = (self._buf[0] & 15) << 4 self._buf[0] = _MAX44009_LUX_LO self._i2c.writeto(self._address, self._buf, False) self._i2c.readfrom_into(self._address, self._buf, True) mantissa |= self._buf[0] & 15 return self._exponent_mantissa_to_lux(exponent, mantissa) @property def lux_fast(self): self._read8(_MAX44009_LUX_HI) exponent = self._buf[0] >> 4 mantissa = (self._buf[0] & 15) << 4 return self._exponent_mantissa_to_lux(exponent, mantissa) @property def int_status(self): self._read8(_MAX44009_INT_STATUS) return self._buf[0] & 1 @property def int_enable(self): self._read8(_MAX44009_INT_ENABLE) return self._buf[0] & 1 @int_enable.setter def int_enable(self, en): self._write8(_MAX44009_INT_ENABLE, en & 1) @property def upper_threshold(self): return self._get_threshold(_MAX44009_UP_THRES, 15) @upper_threshold.setter def upper_threshold(self, lux): self._set_threshold(_MAX44009_UP_THRES, lux) @property def lower_threshold(self): return self._get_threshold(_MAX44009_LO_THRES, 0) @lower_threshold.setter def lower_threshold(self, lux): self._set_threshold(_MAX44009_LO_THRES, lux) @property def threshold_timer(self): self._read8(_MAX44009_THRES_TIMER) return self._buf[0] * 100 @threshold_timer.setter def threshold_timer(self, ms): assert 0 <= ms <= 25500 self._write8(_MAX44009_THRES_TIMER, int(ms) // 100) def _read8(self, reg): self._i2c.readfrom_mem_into(self._address, reg, self._buf) return self._buf[0] def _write8(self, reg, val): self._buf[0] = val self._i2c.writeto_mem(self._address, reg, self._buf) def _write_config(self): self._write8(_MAX44009_CONFIG, self._config) def _read_config(self): self._read8(_MAX44009_CONFIG) self._config = self._buf[0] def _lux_to_exponent_mantissa(self, lux): mantissa = int(lux * 1000) // 45 exponent = 0 while mantissa > 255: mantissa >>= 1 exponent += 1 return (exponent, mantissa) def _exponent_mantissa_to_lux(self, exponent, mantissa): return 2 ** exponent * mantissa * 0.045 def _get_threshold(self, reg, bonus_mantissa): self._read8(reg) exponent = self._buf[0] >> 4 mantissa = (self._buf[0] & 15) << 4 | bonus_mantissa return self._exponent_mantissa_to_lux(exponent, mantissa) def _set_threshold(self, reg, lux): (exponent, mantissa) = self._lux_to_exponent_mantissa(lux) assert 0 <= exponent <= 14 assert 0 <= mantissa <= 255 self._write8(reg, exponent << 4 | mantissa >> 4)
t = int(input()) while t: N, X = map(int, input().split()) S = input() arr = [] arr.append(X) for i in S: if i=='R': X += 1 arr.append(X) if i=='L': X -= 1 arr.append(X) arr = set(arr) print(len(arr)) t = t-1
t = int(input()) while t: (n, x) = map(int, input().split()) s = input() arr = [] arr.append(X) for i in S: if i == 'R': x += 1 arr.append(X) if i == 'L': x -= 1 arr.append(X) arr = set(arr) print(len(arr)) t = t - 1
netron_link = "https://lutzroeder.github.io/netron" cors_proxy = "https://cors-anywhere.herokuapp.com" release_url = "https://github.com/larq/zoo/releases/download" def html_format(source, language, css_class, options, md): return f'<a href="{netron_link}/?url={cors_proxy}/{release_url}/{source}">Interactive architecture diagram</a>'
netron_link = 'https://lutzroeder.github.io/netron' cors_proxy = 'https://cors-anywhere.herokuapp.com' release_url = 'https://github.com/larq/zoo/releases/download' def html_format(source, language, css_class, options, md): return f'<a href="{netron_link}/?url={cors_proxy}/{release_url}/{source}">Interactive architecture diagram</a>'
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """Helpers for referring to React Native open source code. This lets us build React Native: - At Facebook by running buck from the root of the fb repo - Outside of Facebook by running buck in the root of the git repo """ # @lint-ignore-every BUCKRESTRICTEDSYNTAX _DEBUG_PREPROCESSOR_FLAGS = [] _APPLE_COMPILER_FLAGS = [] def get_apple_compiler_flags(): return _APPLE_COMPILER_FLAGS def get_preprocessor_flags_for_build_mode(): return _DEBUG_PREPROCESSOR_FLAGS def get_static_library_ios_flags(): return _APPLE_COMPILER_FLAGS def get_objc_arc_preprocessor_flags(): return [ "-fobjc-arc", "-fno-objc-arc-exceptions", "-Qunused-arguments", ] IS_OSS_BUILD = True GLOG_DEP = "//ReactAndroid/build/third-party-ndk/glog:glog" INSPECTOR_FLAGS = [] # Platform Definitions CXX = "Default" ANDROID = "Android" APPLE = "Apple" # Apple SDK Definitions IOS = "ios" MACOSX = "macosx" YOGA_TARGET = "//ReactAndroid/src/main/java/com/facebook:yoga" YOGA_CXX_TARGET = "//ReactCommon/yoga:yoga" FBGLOGINIT_TARGET = "//ReactAndroid/src/main/jni/first-party/fbgloginit:fbgloginit" FBJNI_TARGET = "//ReactAndroid/src/main/jni/first-party/fb:jni" JNI_TARGET = "//ReactAndroid/src/main/jni/first-party/jni-hack:jni-hack" KEYSTORE_TARGET = "//keystores:debug" def get_apple_inspector_flags(): return [] def get_android_inspector_flags(): return [] def get_react_native_preprocessor_flags(): # TODO: use this to define the compiler flag REACT_NATIVE_DEBUG in debug/dev mode builds only. # This is a replacement for NDEBUG since NDEBUG is always defined in Buck on all Android builds. return [] # Building is not supported in OSS right now def rn_xplat_cxx_library(name, **kwargs): new_kwargs = { k: v for k, v in kwargs.items() if k.startswith("exported_") } native.cxx_library( name = name, visibility = kwargs.get("visibility", []), **new_kwargs ) # Example: react_native_target('java/com/facebook/react/common:common') def react_native_target(path): return "//ReactAndroid/src/main/" + path # Example: react_native_xplat_target('bridge:bridge') def react_native_xplat_target(path): return "//ReactCommon/" + path def react_native_xplat_target_apple(path): return react_native_xplat_target(path) + "Apple" def react_native_root_target(path): return "//" + path def react_native_xplat_shared_library_target(path): return react_native_xplat_target(path) # Example: react_native_tests_target('java/com/facebook/react/modules:modules') def react_native_tests_target(path): return "//ReactAndroid/src/test/" + path # Example: react_native_integration_tests_target('java/com/facebook/react/testing:testing') def react_native_integration_tests_target(path): return "//ReactAndroid/src/androidTest/" + path # Helpers for referring to non-RN code from RN OSS code. # Example: react_native_dep('java/com/facebook/systrace:systrace') def react_native_dep(path): return "//ReactAndroid/src/main/" + path def react_native_android_toplevel_dep(path): return react_native_dep(path) # Example: react_native_xplat_dep('java/com/facebook/systrace:systrace') def react_native_xplat_dep(path): return "//ReactCommon/" + path def rn_extra_build_flags(): return [] def _unique(li): return list({x: () for x in li}) # React property preprocessor def rn_android_library(name, deps = [], plugins = [], *args, **kwargs): _ = kwargs.pop("autoglob", False) _ = kwargs.pop("is_androidx", False) if react_native_target( "java/com/facebook/react/uimanager/annotations:annotations", ) in deps and name != "processing": react_property_plugins = [ react_native_target( "java/com/facebook/react/processing:processing", ), ] plugins = _unique(plugins + react_property_plugins) if react_native_target( "java/com/facebook/react/module/annotations:annotations", ) in deps and name != "processing": react_module_plugins = [ react_native_target( "java/com/facebook/react/module/processing:processing", ), ] plugins = _unique(plugins + react_module_plugins) native.android_library(name = name, deps = deps, plugins = plugins, *args, **kwargs) def rn_android_binary(*args, **kwargs): native.android_binary(*args, **kwargs) def rn_android_build_config(*args, **kwargs): native.android_build_config(*args, **kwargs) def rn_android_resource(*args, **kwargs): native.android_resource(*args, **kwargs) def rn_android_prebuilt_aar(*args, **kwargs): native.android_prebuilt_aar(*args, **kwargs) def rn_apple_library(*args, **kwargs): kwargs.setdefault("link_whole", True) kwargs.setdefault("enable_exceptions", True) kwargs.setdefault("target_sdk_version", "11.0") # Unsupported kwargs _ = kwargs.pop("autoglob", False) _ = kwargs.pop("plugins_only", False) _ = kwargs.pop("enable_exceptions", False) _ = kwargs.pop("extension_api_only", False) _ = kwargs.pop("sdks", []) native.apple_library(*args, **kwargs) def rn_java_library(*args, **kwargs): _ = kwargs.pop("is_androidx", False) native.java_library(*args, **kwargs) def rn_java_annotation_processor(*args, **kwargs): native.java_annotation_processor(*args, **kwargs) def rn_prebuilt_native_library(*args, **kwargs): native.prebuilt_native_library(*args, **kwargs) def rn_prebuilt_jar(*args, **kwargs): native.prebuilt_jar(*args, **kwargs) def rn_genrule(*args, **kwargs): native.genrule(*args, **kwargs) def rn_robolectric_test(name, srcs, vm_args = None, *args, **kwargs): vm_args = vm_args or [] _ = kwargs.pop("autoglob", False) _ = kwargs.pop("is_androidx", False) kwargs["deps"] = kwargs.pop("deps", []) + [ react_native_android_toplevel_dep("third-party/java/mockito2:mockito2"), react_native_dep("third-party/java/robolectric:robolectric"), react_native_tests_target("resources:robolectric"), react_native_xplat_dep("libraries/fbcore/src/test/java/com/facebook/powermock:powermock2"), ] extra_vm_args = [ "-XX:+UseConcMarkSweepGC", # required by -XX:+CMSClassUnloadingEnabled "-XX:+CMSClassUnloadingEnabled", "-XX:ReservedCodeCacheSize=150M", "-Drobolectric.dependency.dir=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric/4.4", "-Dlibraries=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric/4.4/*.jar", "-Drobolectric.logging.enabled=true", "-XX:MaxPermSize=620m", "-Drobolectric.offline=true", "-Drobolectric.looperMode=LEGACY", ] if native.read_config("user", "use_dev_shm"): extra_vm_args.append("-Djava.io.tmpdir=/dev/shm") # RN tests use Powermock, which means they get their own ClassLoaders. # Because the yoga native library (or any native library) can only be loaded into one # ClassLoader at a time, we need to run each in its own process, hence fork_mode = 'per_test'. native.robolectric_test( name = name, use_cxx_libraries = True, cxx_library_whitelist = [ "//ReactCommon/yoga:yoga", "//ReactAndroid/src/main/jni/first-party/yogajni:jni", ], fork_mode = "per_test", srcs = srcs, vm_args = vm_args + extra_vm_args, *args, **kwargs ) def cxx_library(allow_jni_merging = None, **kwargs): _ignore = allow_jni_merging args = { k: v for k, v in kwargs.items() if not (k.startswith("fbandroid_") or k.startswith("fbobjc_")) } native.cxx_library(**args) def _paths_join(path, *others): """Joins one or more path components.""" result = path for p in others: if p.startswith("/"): # absolute result = p elif not result or result.endswith("/"): result += p else: result += "/" + p return result def subdir_glob(glob_specs, exclude = None, prefix = ""): """Returns a dict of sub-directory relative paths to full paths. The subdir_glob() function is useful for defining header maps for C/C++ libraries which should be relative the given sub-directory. Given a list of tuples, the form of (relative-sub-directory, glob-pattern), it returns a dict of sub-directory relative paths to full paths. Please refer to native.glob() for explanations and examples of the pattern. Args: glob_specs: The array of tuples in form of (relative-sub-directory, glob-pattern inside relative-sub-directory). type: List[Tuple[str, str]] exclude: A list of patterns to identify files that should be removed from the set specified by the first argument. Defaults to []. type: Optional[List[str]] prefix: If is not None, prepends it to each key in the dictionary. Defaults to None. type: Optional[str] Returns: A dict of sub-directory relative paths to full paths. """ if exclude == None: exclude = [] results = [] for dirpath, glob_pattern in glob_specs: results.append( _single_subdir_glob(dirpath, glob_pattern, exclude, prefix), ) return _merge_maps(*results) def _merge_maps(*file_maps): result = {} for file_map in file_maps: for key in file_map: if key in result and result[key] != file_map[key]: fail( "Conflicting files in file search paths. " + "\"%s\" maps to both \"%s\" and \"%s\"." % (key, result[key], file_map[key]), ) result[key] = file_map[key] return result def _single_subdir_glob(dirpath, glob_pattern, exclude = None, prefix = None): if exclude == None: exclude = [] results = {} files = native.glob([_paths_join(dirpath, glob_pattern)], exclude = exclude) for f in files: if dirpath: key = f[len(dirpath) + 1:] else: key = f if prefix: key = _paths_join(prefix, key) results[key] = f return results def fb_apple_library(*args, **kwargs): native.apple_library(*args, **kwargs) def oss_cxx_library(**kwargs): cxx_library(**kwargs) def jni_instrumentation_test_lib(**_kwargs): """A noop stub for OSS build.""" pass def fb_xplat_cxx_test(**_kwargs): """A noop stub for OSS build.""" pass # iOS Plugin support. def react_module_plugin_providers(): # Noop for now return []
"""Helpers for referring to React Native open source code. This lets us build React Native: - At Facebook by running buck from the root of the fb repo - Outside of Facebook by running buck in the root of the git repo """ _debug_preprocessor_flags = [] _apple_compiler_flags = [] def get_apple_compiler_flags(): return _APPLE_COMPILER_FLAGS def get_preprocessor_flags_for_build_mode(): return _DEBUG_PREPROCESSOR_FLAGS def get_static_library_ios_flags(): return _APPLE_COMPILER_FLAGS def get_objc_arc_preprocessor_flags(): return ['-fobjc-arc', '-fno-objc-arc-exceptions', '-Qunused-arguments'] is_oss_build = True glog_dep = '//ReactAndroid/build/third-party-ndk/glog:glog' inspector_flags = [] cxx = 'Default' android = 'Android' apple = 'Apple' ios = 'ios' macosx = 'macosx' yoga_target = '//ReactAndroid/src/main/java/com/facebook:yoga' yoga_cxx_target = '//ReactCommon/yoga:yoga' fbgloginit_target = '//ReactAndroid/src/main/jni/first-party/fbgloginit:fbgloginit' fbjni_target = '//ReactAndroid/src/main/jni/first-party/fb:jni' jni_target = '//ReactAndroid/src/main/jni/first-party/jni-hack:jni-hack' keystore_target = '//keystores:debug' def get_apple_inspector_flags(): return [] def get_android_inspector_flags(): return [] def get_react_native_preprocessor_flags(): return [] def rn_xplat_cxx_library(name, **kwargs): new_kwargs = {k: v for (k, v) in kwargs.items() if k.startswith('exported_')} native.cxx_library(name=name, visibility=kwargs.get('visibility', []), **new_kwargs) def react_native_target(path): return '//ReactAndroid/src/main/' + path def react_native_xplat_target(path): return '//ReactCommon/' + path def react_native_xplat_target_apple(path): return react_native_xplat_target(path) + 'Apple' def react_native_root_target(path): return '//' + path def react_native_xplat_shared_library_target(path): return react_native_xplat_target(path) def react_native_tests_target(path): return '//ReactAndroid/src/test/' + path def react_native_integration_tests_target(path): return '//ReactAndroid/src/androidTest/' + path def react_native_dep(path): return '//ReactAndroid/src/main/' + path def react_native_android_toplevel_dep(path): return react_native_dep(path) def react_native_xplat_dep(path): return '//ReactCommon/' + path def rn_extra_build_flags(): return [] def _unique(li): return list({x: () for x in li}) def rn_android_library(name, deps=[], plugins=[], *args, **kwargs): _ = kwargs.pop('autoglob', False) _ = kwargs.pop('is_androidx', False) if react_native_target('java/com/facebook/react/uimanager/annotations:annotations') in deps and name != 'processing': react_property_plugins = [react_native_target('java/com/facebook/react/processing:processing')] plugins = _unique(plugins + react_property_plugins) if react_native_target('java/com/facebook/react/module/annotations:annotations') in deps and name != 'processing': react_module_plugins = [react_native_target('java/com/facebook/react/module/processing:processing')] plugins = _unique(plugins + react_module_plugins) native.android_library(*args, name=name, deps=deps, plugins=plugins, **kwargs) def rn_android_binary(*args, **kwargs): native.android_binary(*args, **kwargs) def rn_android_build_config(*args, **kwargs): native.android_build_config(*args, **kwargs) def rn_android_resource(*args, **kwargs): native.android_resource(*args, **kwargs) def rn_android_prebuilt_aar(*args, **kwargs): native.android_prebuilt_aar(*args, **kwargs) def rn_apple_library(*args, **kwargs): kwargs.setdefault('link_whole', True) kwargs.setdefault('enable_exceptions', True) kwargs.setdefault('target_sdk_version', '11.0') _ = kwargs.pop('autoglob', False) _ = kwargs.pop('plugins_only', False) _ = kwargs.pop('enable_exceptions', False) _ = kwargs.pop('extension_api_only', False) _ = kwargs.pop('sdks', []) native.apple_library(*args, **kwargs) def rn_java_library(*args, **kwargs): _ = kwargs.pop('is_androidx', False) native.java_library(*args, **kwargs) def rn_java_annotation_processor(*args, **kwargs): native.java_annotation_processor(*args, **kwargs) def rn_prebuilt_native_library(*args, **kwargs): native.prebuilt_native_library(*args, **kwargs) def rn_prebuilt_jar(*args, **kwargs): native.prebuilt_jar(*args, **kwargs) def rn_genrule(*args, **kwargs): native.genrule(*args, **kwargs) def rn_robolectric_test(name, srcs, vm_args=None, *args, **kwargs): vm_args = vm_args or [] _ = kwargs.pop('autoglob', False) _ = kwargs.pop('is_androidx', False) kwargs['deps'] = kwargs.pop('deps', []) + [react_native_android_toplevel_dep('third-party/java/mockito2:mockito2'), react_native_dep('third-party/java/robolectric:robolectric'), react_native_tests_target('resources:robolectric'), react_native_xplat_dep('libraries/fbcore/src/test/java/com/facebook/powermock:powermock2')] extra_vm_args = ['-XX:+UseConcMarkSweepGC', '-XX:+CMSClassUnloadingEnabled', '-XX:ReservedCodeCacheSize=150M', '-Drobolectric.dependency.dir=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric/4.4', '-Dlibraries=buck-out/gen/ReactAndroid/src/main/third-party/java/robolectric/4.4/*.jar', '-Drobolectric.logging.enabled=true', '-XX:MaxPermSize=620m', '-Drobolectric.offline=true', '-Drobolectric.looperMode=LEGACY'] if native.read_config('user', 'use_dev_shm'): extra_vm_args.append('-Djava.io.tmpdir=/dev/shm') native.robolectric_test(*args, name=name, use_cxx_libraries=True, cxx_library_whitelist=['//ReactCommon/yoga:yoga', '//ReactAndroid/src/main/jni/first-party/yogajni:jni'], fork_mode='per_test', srcs=srcs, vm_args=vm_args + extra_vm_args, **kwargs) def cxx_library(allow_jni_merging=None, **kwargs): _ignore = allow_jni_merging args = {k: v for (k, v) in kwargs.items() if not (k.startswith('fbandroid_') or k.startswith('fbobjc_'))} native.cxx_library(**args) def _paths_join(path, *others): """Joins one or more path components.""" result = path for p in others: if p.startswith('/'): result = p elif not result or result.endswith('/'): result += p else: result += '/' + p return result def subdir_glob(glob_specs, exclude=None, prefix=''): """Returns a dict of sub-directory relative paths to full paths. The subdir_glob() function is useful for defining header maps for C/C++ libraries which should be relative the given sub-directory. Given a list of tuples, the form of (relative-sub-directory, glob-pattern), it returns a dict of sub-directory relative paths to full paths. Please refer to native.glob() for explanations and examples of the pattern. Args: glob_specs: The array of tuples in form of (relative-sub-directory, glob-pattern inside relative-sub-directory). type: List[Tuple[str, str]] exclude: A list of patterns to identify files that should be removed from the set specified by the first argument. Defaults to []. type: Optional[List[str]] prefix: If is not None, prepends it to each key in the dictionary. Defaults to None. type: Optional[str] Returns: A dict of sub-directory relative paths to full paths. """ if exclude == None: exclude = [] results = [] for (dirpath, glob_pattern) in glob_specs: results.append(_single_subdir_glob(dirpath, glob_pattern, exclude, prefix)) return _merge_maps(*results) def _merge_maps(*file_maps): result = {} for file_map in file_maps: for key in file_map: if key in result and result[key] != file_map[key]: fail('Conflicting files in file search paths. ' + '"%s" maps to both "%s" and "%s".' % (key, result[key], file_map[key])) result[key] = file_map[key] return result def _single_subdir_glob(dirpath, glob_pattern, exclude=None, prefix=None): if exclude == None: exclude = [] results = {} files = native.glob([_paths_join(dirpath, glob_pattern)], exclude=exclude) for f in files: if dirpath: key = f[len(dirpath) + 1:] else: key = f if prefix: key = _paths_join(prefix, key) results[key] = f return results def fb_apple_library(*args, **kwargs): native.apple_library(*args, **kwargs) def oss_cxx_library(**kwargs): cxx_library(**kwargs) def jni_instrumentation_test_lib(**_kwargs): """A noop stub for OSS build.""" pass def fb_xplat_cxx_test(**_kwargs): """A noop stub for OSS build.""" pass def react_module_plugin_providers(): return []
class Stack(list): def __getitem__(self,key): try: return super(Stack, self).__getitem__(key) except IndexError: return 0 def pop(self): try: return super(Stack, self).pop() except: return 0
class Stack(list): def __getitem__(self, key): try: return super(Stack, self).__getitem__(key) except IndexError: return 0 def pop(self): try: return super(Stack, self).pop() except: return 0
class ValidPalindrome: def isPalindrome(self, s): if len(s) == 0: return True else: s = "".join([i for i in s.lower() if i.isalnum()]) i= 0 j=len(s)-1 while j>i: if s[i] != s[j]: return False i += 1 j -= 1 return True if __name__ == "__main__": a="A man, a plan, a canal: Panama" b="race a car" print(ValidPalindrome().isPalindrome(a)) print(ValidPalindrome().isPalindrome(b))
class Validpalindrome: def is_palindrome(self, s): if len(s) == 0: return True else: s = ''.join([i for i in s.lower() if i.isalnum()]) i = 0 j = len(s) - 1 while j > i: if s[i] != s[j]: return False i += 1 j -= 1 return True if __name__ == '__main__': a = 'A man, a plan, a canal: Panama' b = 'race a car' print(valid_palindrome().isPalindrome(a)) print(valid_palindrome().isPalindrome(b))
arr = [] for arr_i in range(6): arr_t = [int(arr_temp) for arr_temp in input().split(' ')] arr.append(arr_t) #print (arr) hourglass_sums = [] for i in range(4): for j in range(4): hourglass_sums.append(sum(arr[i][j:j+3]) + arr[i+1][j+1] + sum(arr[i+2][j:j+3])) print (max(hourglass_sums))
arr = [] for arr_i in range(6): arr_t = [int(arr_temp) for arr_temp in input().split(' ')] arr.append(arr_t) hourglass_sums = [] for i in range(4): for j in range(4): hourglass_sums.append(sum(arr[i][j:j + 3]) + arr[i + 1][j + 1] + sum(arr[i + 2][j:j + 3])) print(max(hourglass_sums))
############################################################################### '''''' ############################################################################### class CoProperty(property): def __set_name__(self, owner, name): self.cooperators = tuple( # pylint: disable=W0201 acls.__dict__[name] for acls in owner.__bases__ if name in acls.__dict__ ) def allyield(self, instance, owner): for coop in self.cooperators: yield from coop.allyield(instance, owner) yield from super().__get__(instance, owner) def __get__(self, instance, owner): return tuple(self.allyield(instance, owner)) coproperty = CoProperty.__call__ ############################################################################### ###############################################################################
"""""" class Coproperty(property): def __set_name__(self, owner, name): self.cooperators = tuple((acls.__dict__[name] for acls in owner.__bases__ if name in acls.__dict__)) def allyield(self, instance, owner): for coop in self.cooperators: yield from coop.allyield(instance, owner) yield from super().__get__(instance, owner) def __get__(self, instance, owner): return tuple(self.allyield(instance, owner)) coproperty = CoProperty.__call__
""" This module contains the result sentences and intents for the English version of the Pick something random app. """ # Result sentences and their parts: RESULT_HEADS = "Heads" RESULT_TAILS = "Tails" # See the following documentation for the format codes: # https://arrow.readthedocs.io/en/latest/#format RESULT_MONTH_DAY = "MMMM D" RESULT_DATE_ALREADY_PICKED = "It looks like you already picked a date. Are you trying to trick me?" RESULT_NUMBERS_WRONG_ORDER = "Is this a trick? {} is smaller than {}." RESULT_ONE_NUMBER = "It looks like you already picked a number. Are you trying to trick me?" RESULT_TOO_MANY_DICE = "I'm sorry but I don't have {} dice to roll." RESULT_NEGATIVE_DICE = "Are you trying to trick me? I can't throw a negative number of dice, obviously." RESULT_ZERO_DICE = "I threw zero dice. Have you heard them fall?" RESULT_DICE_NO_INTEGER = "Are you trying to trick me? I can't throw a non-integer number of dice, obviously." RESULT_FACES_NO_INTEGER = "Are you trying to trick me? I can't throw dice with a non-integer number of faces, obviously." RESULT_ZERO_FACES = "I threw a die with zero faces. Have you seen its number?" RESULT_NEGATIVE_FACES = "Are you trying to trick me? I can't throw dice with a negative number of faces, obviously." AND = ", and " # Intents INTENT_FLIP_COIN = 'koan:FlipCoin' INTENT_RANDOM_DATE = 'koan:RandomDate' INTENT_RANDOM_NUMBER = 'koan:RandomNumber' INTENT_ROLL_DICE = 'koan:RollDice'
""" This module contains the result sentences and intents for the English version of the Pick something random app. """ result_heads = 'Heads' result_tails = 'Tails' result_month_day = 'MMMM D' result_date_already_picked = 'It looks like you already picked a date. Are you trying to trick me?' result_numbers_wrong_order = 'Is this a trick? {} is smaller than {}.' result_one_number = 'It looks like you already picked a number. Are you trying to trick me?' result_too_many_dice = "I'm sorry but I don't have {} dice to roll." result_negative_dice = "Are you trying to trick me? I can't throw a negative number of dice, obviously." result_zero_dice = 'I threw zero dice. Have you heard them fall?' result_dice_no_integer = "Are you trying to trick me? I can't throw a non-integer number of dice, obviously." result_faces_no_integer = "Are you trying to trick me? I can't throw dice with a non-integer number of faces, obviously." result_zero_faces = 'I threw a die with zero faces. Have you seen its number?' result_negative_faces = "Are you trying to trick me? I can't throw dice with a negative number of faces, obviously." and = ', and ' intent_flip_coin = 'koan:FlipCoin' intent_random_date = 'koan:RandomDate' intent_random_number = 'koan:RandomNumber' intent_roll_dice = 'koan:RollDice'
"""Helper functions Consists of functions to typically be used within templates, but also available to Controllers. This module is available to both as 'h'. """
"""Helper functions Consists of functions to typically be used within templates, but also available to Controllers. This module is available to both as 'h'. """
banner = """ _ _ _ _ _____ _ | | | | | | (_) |_ _| (_) | | | | __ _| | ___ _ __ _ ___ | | ___ __ _ _ __ ___ _________ | | | |/ _` | |/ _ \ '__| |/ _ \ | |/ _ \ / _` | '_ \ / _ \_ /_ / | \ \_/ / (_| | | __/ | | | (_) | | | (_) | (_| | | | | (_) / / / /| | \___/ \__,_|_|\___|_| |_|\___/ \_/\___/ \__, |_| |_|\___/___/___|_| __/ | |___/ _____ ___________ _____ _____ / __ \ |_ _| ___|_ _/ ___| | / \/ ___ _ __ ___ ___ ______ | | | |_ | | \ `--. | | / _ \| '__/ __|/ _ \ |______| | | | _| | | `--. \ | \__/\ (_) | | \__ \ (_) | _| |_| | | | /\__/ / \____/\___/|_| |___/\___/ \___/\_| \_/ \____/ ________ ___ ___ ______ _____ ___ ___ ___ _ _ _ _______ ___ _____ _____ _ _______ _____ _ _ _____ / ___| \/ | / _ \ | ___ \_ _| | \/ | / _ \ | \ | | | | | ___/ _ \/ __ \_ _| | | | ___ \_ _| \ | | __ \ \ `--.| . . |/ /_\ \| |_/ / | | | . . |/ /_\ \| \| | | | | |_ / /_\ \ / \/ | | | | | | |_/ / | | | \| | | \/ `--. \ |\/| || _ || / | | | |\/| || _ || . ` | | | | _|| _ | | | | | | | | / | | | . ` | | __ /\__/ / | | || | | || |\ \ | | | | | || | | || |\ | |_| | | | | | | \__/\ | | | |_| | |\ \ _| |_| |\ | |_\ \ \____/\_| |_/\_| |_/\_| \_| \_/ \_| |_/\_| |_/\_| \_/\___/\_| \_| |_/\____/ \_/ \___/\_| \_|\___/\_| \_/\____/ ______ _____ _ _ _____ _ ___________ ___________ ___ _____ | _ \ ___| | | | ___| | | _ | ___ \ ___| ___ \ / || _ | | | | | |__ | | | | |__ | | | | | | |_/ / |__ | |_/ / / /| || |/' | | | | | __|| | | | __|| | | | | | __/| __|| / / /_| || /| | | |/ /| |___\ \_/ / |___| |___\ \_/ / | | |___| |\ \ \___ |\ |_/ / |___/ \____/ \___/\____/\_____/\___/\_| \____/\_| \_| |_(_)___/ """
banner = "\n _ _ _ _ _____ _ \n| | | | | | (_) |_ _| (_) \n| | | | __ _| | ___ _ __ _ ___ | | ___ __ _ _ __ ___ _________ \n| | | |/ _` | |/ _ \\ '__| |/ _ \\ | |/ _ \\ / _` | '_ \\ / _ \\_ /_ / | \n\\ \\_/ / (_| | | __/ | | | (_) | | | (_) | (_| | | | | (_) / / / /| | \n \\___/ \\__,_|_|\\___|_| |_|\\___/ \\_/\\___/ \\__, |_| |_|\\___/___/___|_| \n __/ | \n |___/ \n _____ ___________ _____ _____ \n/ __ \\ |_ _| ___|_ _/ ___| \n| / \\/ ___ _ __ ___ ___ ______ | | | |_ | | \\ `--. \n| | / _ \\| '__/ __|/ _ \\ |______| | | | _| | | `--. \\ \n| \\__/\\ (_) | | \\__ \\ (_) | _| |_| | | | /\\__/ / \n \\____/\\___/|_| |___/\\___/ \\___/\\_| \\_/ \\____/ \n \n \n ________ ___ ___ ______ _____ ___ ___ ___ _ _ _ _______ ___ _____ _____ _ _______ _____ _ _ _____ \n/ ___| \\/ | / _ \\ | ___ \\_ _| | \\/ | / _ \\ | \\ | | | | | ___/ _ \\/ __ \\_ _| | | | ___ \\_ _| \\ | | __ \\ \n\\ `--.| . . |/ /_\\ \\| |_/ / | | | . . |/ /_\\ \\| \\| | | | | |_ / /_\\ \\ / \\/ | | | | | | |_/ / | | | \\| | | \\/ \n `--. \\ |\\/| || _ || / | | | |\\/| || _ || . ` | | | | _|| _ | | | | | | | | / | | | . ` | | __ \n/\\__/ / | | || | | || |\\ \\ | | | | | || | | || |\\ | |_| | | | | | | \\__/\\ | | | |_| | |\\ \\ _| |_| |\\ | |_\\ \\ \n\\____/\\_| |_/\\_| |_/\\_| \\_| \\_/ \\_| |_/\\_| |_/\\_| \\_/\\___/\\_| \\_| |_/\\____/ \\_/ \\___/\\_| \\_|\\___/\\_| \\_/\\____/ \n \n \n______ _____ _ _ _____ _ ___________ ___________ ___ _____ \n| _ \\ ___| | | | ___| | | _ | ___ \\ ___| ___ \\ / || _ | \n| | | | |__ | | | | |__ | | | | | | |_/ / |__ | |_/ / / /| || |/' | \n| | | | __|| | | | __|| | | | | | __/| __|| / / /_| || /| | \n| |/ /| |___\\ \\_/ / |___| |___\\ \\_/ / | | |___| |\\ \\ \\___ |\\ |_/ / \n|___/ \\____/ \\___/\\____/\\_____/\\___/\\_| \\____/\\_| \\_| |_(_)___/ \n \n \n \n \n"
class Node: def __init__(self,data): self.data = data self.left = self.right = None def sorted_array(nums): if not nums: return mid = len(nums)//2 root = Node(nums[mid]) root.left = sorted_array(nums[:mid]) root.right = sorted_array(nums[mid+1:]) return root def utility(root,res): if root is None: return res.append(root.data) utility(root.left,res) utility(root.right,res) def preorder(root): res = [] utility(root,res) return res def sortedArrayToBST(nums): root = sorted_array(nums) return preorder(root) ### Driver code..!!!! if __name__ == "__main__": nums = [-5 ,-2 ,-2 ,1 ,1 ,1 ,5 ,7] print("BST after convert",sortedArrayToBST(nums))
class Node: def __init__(self, data): self.data = data self.left = self.right = None def sorted_array(nums): if not nums: return mid = len(nums) // 2 root = node(nums[mid]) root.left = sorted_array(nums[:mid]) root.right = sorted_array(nums[mid + 1:]) return root def utility(root, res): if root is None: return res.append(root.data) utility(root.left, res) utility(root.right, res) def preorder(root): res = [] utility(root, res) return res def sorted_array_to_bst(nums): root = sorted_array(nums) return preorder(root) if __name__ == '__main__': nums = [-5, -2, -2, 1, 1, 1, 5, 7] print('BST after convert', sorted_array_to_bst(nums))
for _ in range(int(input())): n=input() if len(n)>10: print("{}{}{}".format(n[0],len(n)-2,n[-1])) else: print(n)
for _ in range(int(input())): n = input() if len(n) > 10: print('{}{}{}'.format(n[0], len(n) - 2, n[-1])) else: print(n)
"""Provides a redirection point for platform specific implementations of Starlark utilities.""" load( "//tensorflow/core/profiler/builds/oss:build_config.bzl", _tf_profiler_alias = "tf_profiler_alias", ) tf_profiler_alias = _tf_profiler_alias def if_profiler_oss(if_true, if_false = []): return select({ "//tensorflow/core/profiler/builds:profiler_build_oss": if_true, "//conditions:default": if_false, })
"""Provides a redirection point for platform specific implementations of Starlark utilities.""" load('//tensorflow/core/profiler/builds/oss:build_config.bzl', _tf_profiler_alias='tf_profiler_alias') tf_profiler_alias = _tf_profiler_alias def if_profiler_oss(if_true, if_false=[]): return select({'//tensorflow/core/profiler/builds:profiler_build_oss': if_true, '//conditions:default': if_false})
ONOS_ORIGIN = "ONOS Community" ONOS_GROUP_ID = "org.onosproject" ONOS_VERSION = "1.14.0-SNAPSHOT" DEFAULT_APP_CATEGORY = "Utility" ONOS_ARTIFACT_BASE = "onos-" APP_PREFIX = ONOS_GROUP_ID + "."
onos_origin = 'ONOS Community' onos_group_id = 'org.onosproject' onos_version = '1.14.0-SNAPSHOT' default_app_category = 'Utility' onos_artifact_base = 'onos-' app_prefix = ONOS_GROUP_ID + '.'
# souce from https://stackoverflow.com/a/25471508 '''Stub for fcntl. only for Windows dev/testing.''' def fcntl(fd, op, arg=0): return 0 def ioctl(fd, op, arg=0, mutable_flag=True): if mutable_flag: return 0 else: return "" def flock(fd, op): return def lockf(fd, operation, length=0, start=0, whence=0): return
"""Stub for fcntl. only for Windows dev/testing.""" def fcntl(fd, op, arg=0): return 0 def ioctl(fd, op, arg=0, mutable_flag=True): if mutable_flag: return 0 else: return '' def flock(fd, op): return def lockf(fd, operation, length=0, start=0, whence=0): return
class prdError(Exception): """Base error raised by pyramdeconv.""" class MainDelegatorError(prdError): """Raised when a method in the main delegator fails.""" class DataBaseError(prdError): """Raised when interaction with the default database fails"""
class Prderror(Exception): """Base error raised by pyramdeconv.""" class Maindelegatorerror(prdError): """Raised when a method in the main delegator fails.""" class Databaseerror(prdError): """Raised when interaction with the default database fails"""
for i in range(0,6): if i !=3: print(i) result = 1 for i in range(1,6): result =result*i print(result) result = 0 for i in range(1,6): result = result +i print(result) result=0 for word in 'this is my 6th string'.split(): result = result+1 print(result)
for i in range(0, 6): if i != 3: print(i) result = 1 for i in range(1, 6): result = result * i print(result) result = 0 for i in range(1, 6): result = result + i print(result) result = 0 for word in 'this is my 6th string'.split(): result = result + 1 print(result)
# config.py # DEBUG = False # SQLALCHEMY_ECHO = False # instance/config.py DEBUG = True SQLALCHEMY_ECHO = True ARCFACE_PREBATCHNORM_LAYER_INDEX = -4 ARCFACE_POOLING_LAYER_INDEX = -3
debug = True sqlalchemy_echo = True arcface_prebatchnorm_layer_index = -4 arcface_pooling_layer_index = -3
class RequestInfoList(object): """A data stream from any platform/hub: """ def __init__(self): self.requests = [] def __len__(self): return len(self.requests)
class Requestinfolist(object): """A data stream from any platform/hub: """ def __init__(self): self.requests = [] def __len__(self): return len(self.requests)