content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def sortNums(nums): # constant space solution i = 0 j = len(nums) - 1 index = 0 while index <= j: if nums[index] == 1: nums[index], nums[i] = nums[i], nums[index] index += 1 i += 1 if nums[index] == 2: index += 1 if nums[index] == 3: nums[index], nums[j] = nums[j], nums[index] j -= 1 return nums print(sortNums([2, 3, 2, 2, 3, 2, 3, 1, 1, 2, 1, 3]))
def sort_nums(nums): i = 0 j = len(nums) - 1 index = 0 while index <= j: if nums[index] == 1: (nums[index], nums[i]) = (nums[i], nums[index]) index += 1 i += 1 if nums[index] == 2: index += 1 if nums[index] == 3: (nums[index], nums[j]) = (nums[j], nums[index]) j -= 1 return nums print(sort_nums([2, 3, 2, 2, 3, 2, 3, 1, 1, 2, 1, 3]))
#!/usr/bin/env python def num_digits(k): c = 0 while k > 0: c += 1 k /= 10 return c def is_kaprekar(k): k2 = pow(k, 2) p10ndk = pow(10, num_digits(k)) if k == (k2 // p10ndk) + (k2 % p10ndk): return True else: return False if __name__ == '__main__': for k in range(1, 1001): if is_kaprekar(k): print(k)
def num_digits(k): c = 0 while k > 0: c += 1 k /= 10 return c def is_kaprekar(k): k2 = pow(k, 2) p10ndk = pow(10, num_digits(k)) if k == k2 // p10ndk + k2 % p10ndk: return True else: return False if __name__ == '__main__': for k in range(1, 1001): if is_kaprekar(k): print(k)
def citerator(data: list, x: int, y: int, layer = False) -> list: """Bi-dimensional matrix iterator starting from any point (i, j), iterating layer by layer around the starting coordinates. Args: data (list): Data set to iterate over. x (int): X starting coordinate. y (int): Y starting coordinate. Optional args: layered (bool): Yield value by value or entire layer. Yields: value: Layer value. list: Matrix layer. """ if layer: yield [data[x][y]] else: yield data[x][y] for depth in range(len(data)): l = [] # top row wpos = x - depth - 1 for i in range(y - depth - 1, y + depth + 1): if (not (i < 0 or wpos < 0 or i >= len(data) or wpos >= len(data)) and not (wpos >= len(data) or i >= len(data[wpos]))): l.append(data[wpos][i]) # right column hpos = y + depth + 1 for i in range(x - depth - 1, x + depth + 1): if (not (i < 0 or hpos < 0 or i >= len(data) or hpos >= len(data)) and not (hpos >= len(data) or hpos >= len(data[i]))): l.append(data[i][hpos]) # bottom row wpos = x + depth + 1 for i in reversed(range(y - depth, y + depth + 2)): if (not (i < 0 or wpos < 0 or i >= len(data) or wpos >= len(data)) and not (wpos >= len(data) or i >= len(data[wpos]))): l.append(data[wpos][i]) # left column hpos = y - depth - 1 for i in reversed(range(x - depth, x + depth + 2)): if (not (i < 0 or hpos < 0 or i >= len(data) or hpos >= len(data)) and not (hpos >= len(data) or hpos >= len(data[i]))): l.append(data[i][hpos]) if l: if layer: yield l else: for v in l: yield v else: break
def citerator(data: list, x: int, y: int, layer=False) -> list: """Bi-dimensional matrix iterator starting from any point (i, j), iterating layer by layer around the starting coordinates. Args: data (list): Data set to iterate over. x (int): X starting coordinate. y (int): Y starting coordinate. Optional args: layered (bool): Yield value by value or entire layer. Yields: value: Layer value. list: Matrix layer. """ if layer: yield [data[x][y]] else: yield data[x][y] for depth in range(len(data)): l = [] wpos = x - depth - 1 for i in range(y - depth - 1, y + depth + 1): if not (i < 0 or wpos < 0 or i >= len(data) or (wpos >= len(data))) and (not (wpos >= len(data) or i >= len(data[wpos]))): l.append(data[wpos][i]) hpos = y + depth + 1 for i in range(x - depth - 1, x + depth + 1): if not (i < 0 or hpos < 0 or i >= len(data) or (hpos >= len(data))) and (not (hpos >= len(data) or hpos >= len(data[i]))): l.append(data[i][hpos]) wpos = x + depth + 1 for i in reversed(range(y - depth, y + depth + 2)): if not (i < 0 or wpos < 0 or i >= len(data) or (wpos >= len(data))) and (not (wpos >= len(data) or i >= len(data[wpos]))): l.append(data[wpos][i]) hpos = y - depth - 1 for i in reversed(range(x - depth, x + depth + 2)): if not (i < 0 or hpos < 0 or i >= len(data) or (hpos >= len(data))) and (not (hpos >= len(data) or hpos >= len(data[i]))): l.append(data[i][hpos]) if l: if layer: yield l else: for v in l: yield v else: break
def decorating_fun(func): def wrapping_function(): print("this is wrapping function and get func start") func() print("func end") return wrapping_function @decorating_fun def decorated_func(): print("i`m decoraed") decorated_func()
def decorating_fun(func): def wrapping_function(): print('this is wrapping function and get func start') func() print('func end') return wrapping_function @decorating_fun def decorated_func(): print('i`m decoraed') decorated_func()
class CannotAssignValueFromParentCategory(Exception): def __init__(self): super().__init__("422 Cannot assign value from parent category")
class Cannotassignvaluefromparentcategory(Exception): def __init__(self): super().__init__('422 Cannot assign value from parent category')
# read file f=open("funny.txt","r") for line in f: print(line) f.close() # readlines() f=open("funny.txt","r") lines = f.readlines() print(lines) # write file f=open("love.txt","w") f.write("I love python") f.close() # same file when you write i love javascript the previous line goes away f=open("love.txt","w") f.write("I love javascript") f.close() # You can use append mode to stop having previous lines overwritten f=open("love.txt","a") f.write("I love javascript") f.close() # show a picture of file open modes (12:12 in old video) # writelines f=open("love.txt","w") f.writelines(["I love C++\n","I love scala"]) f.close() # with statement with open("funny.txt","r") as f: for line in f: print(line) # https://www.cricketworldcup.com/teams/india/players/107 player_scores = {} with open("scores.csv","r") as f: for line in f: tokens = line.split(',') player = tokens[0] score = int(tokens[1]) if player in player_scores: player_scores[player].append(score) else: player_scores[player] = [score] print(player_scores) for player, score_list in player_scores.items(): min_score=min(score_list) max_score=max(score_list) avg_score=sum(score_list)/len(score_list) print(f"{player}==>Min:{min_score}, Max:{max_score}, Avg:{avg_score}")
f = open('funny.txt', 'r') for line in f: print(line) f.close() f = open('funny.txt', 'r') lines = f.readlines() print(lines) f = open('love.txt', 'w') f.write('I love python') f.close() f = open('love.txt', 'w') f.write('I love javascript') f.close() f = open('love.txt', 'a') f.write('I love javascript') f.close() f = open('love.txt', 'w') f.writelines(['I love C++\n', 'I love scala']) f.close() with open('funny.txt', 'r') as f: for line in f: print(line) player_scores = {} with open('scores.csv', 'r') as f: for line in f: tokens = line.split(',') player = tokens[0] score = int(tokens[1]) if player in player_scores: player_scores[player].append(score) else: player_scores[player] = [score] print(player_scores) for (player, score_list) in player_scores.items(): min_score = min(score_list) max_score = max(score_list) avg_score = sum(score_list) / len(score_list) print(f'{player}==>Min:{min_score}, Max:{max_score}, Avg:{avg_score}')
class NoKeywordsException(Exception): """Website does not contains any keywords in <meta> tag""" pass class BadURLException(Exception): """Website does not exists in a given URL""" pass
class Nokeywordsexception(Exception): """Website does not contains any keywords in <meta> tag""" pass class Badurlexception(Exception): """Website does not exists in a given URL""" pass
# -*- coding: utf-8 -*- """ This software is licensed under the License (MIT) located at https://github.com/ephreal/rollbot/Licence Please see the license for any restrictions or rights granted to you by the License. """ # A mock guild object for testing class MockGuild(): def __init__(self, name=None, text_channels=None, users=None): self.name = name self.text_channels = text_channels self.users = users
""" This software is licensed under the License (MIT) located at https://github.com/ephreal/rollbot/Licence Please see the license for any restrictions or rights granted to you by the License. """ class Mockguild: def __init__(self, name=None, text_channels=None, users=None): self.name = name self.text_channels = text_channels self.users = users
def get_first_matching_attr(obj, *attrs, default=None): for attr in attrs: if hasattr(obj, attr): return getattr(obj, attr) return default def get_error_message(exc) -> str: if hasattr(exc, 'message_dict'): return exc.message_dict error_msg = get_first_matching_attr(exc, 'message', 'messages') if isinstance(error_msg, list): error_msg = ', '.join(error_msg) if error_msg is None: error_msg = str(exc) return error_msg
def get_first_matching_attr(obj, *attrs, default=None): for attr in attrs: if hasattr(obj, attr): return getattr(obj, attr) return default def get_error_message(exc) -> str: if hasattr(exc, 'message_dict'): return exc.message_dict error_msg = get_first_matching_attr(exc, 'message', 'messages') if isinstance(error_msg, list): error_msg = ', '.join(error_msg) if error_msg is None: error_msg = str(exc) return error_msg
class Batcher(object): """ Batcher enables developers to batch multiple retrieval requests. Example usage #1:: from pycacher import Cacher cacher = Cacher() batcher = cacher.create_batcher() batcher.add('testkey') batcher.add('testkey1') batcher.add('testkey2') values = batcher.batch() It is possible to use batcher as context manager. Inside the context manager, developers can call the `.register` method of cached functions to register its keys to the currently active batcher for later batching. Then, when the actual cached functions that were registered earlier inside the context manager were actually called, it will seek its value from the batcher context. Example usage #2:: from pycacher import Cacher cacher = Cacher() batcher = cacher.create_batcher() with batcher: cached_func.register(1, 2) cached_func_2.register(1, 2) cached_func_3.register(3, 5) batcher.batch() #Later.. with batcher: cached_func(1, 2) #will look for its value from the batcher cached_func_2(1, 2) cached_func(3, 5) #You can also do this: batcher.register(cached_func, 1, 2) batcher.register(cached_func_2, 1, 2) """ def __init__(self, cacher=None): self.cacher = cacher self._keys = set() self._last_batched_values = None self._autobatch_flag = False self._hooks = {'register':[], 'call':[]} def add(self, key): if isinstance(key, list): for k in key: self._keys.add(k) else: self._keys.add(key) def reset(self): self._keys = set() def batch(self): self._last_batched_values = self.cacher.backend.multi_get(self._keys) return self._last_batched_values def has_batched(self): return self._last_batched_values is not None def register(self, decorated_func, *args): cache_key = decorated_func.build_cache_key(*args) self.add(cache_key) #run the hooks on the batcher first self.trigger_hooks('register', cache_key, self) self.cacher.trigger_hooks('register', cache_key, self) def register_list(self, decorated_list_func, *args, **kwargs): """Registers a cached list function. """ skip = kwargs['skip'] limit = kwargs['limit'] #add the ranged cache keys to the actual internal key batch list. for ranged_cache_key in decorated_list_func.get_ranged_cache_keys(skip=skip, limit=limit, *args): self.add(ranged_cache_key) #Build the "root" cache key to be passed to the hook functions. #Note that we do not pass the ranged cache key to the hook functions, #it's completely for internal use. cache_key = decorated_list_func.build_cache_key(*args) #run the hooks on the batcher first self.trigger_hooks('register', cache_key, self) self.cacher.trigger_hooks('register', cache_key, self) def get_last_batched_values(self): return self._last_batched_values def get_values(self): return self.get_last_batched_values() def get_keys(self): return self._keys def get(self, key): if self._last_batched_values: return self._last_batched_values.get(key) return None def is_batched(self, key): """Checks whether a key is included in the latest batch. Example: self.batcher.add('test-1') self.batcher.batch() self.batcher.is_batched('test-1') >> True """ if self._last_batched_values: return key in self._last_batched_values return False def autobatch(self): """autobatch enables the batcher to automatically batch the batcher keys in the end of the context manager call. Example Usage:: with batcher.autobatch(): expensive_function.register(1, 2) #is similar to: with batcher: expensive_function.register(1, 2) batcher.batch() """ self._autobatch_flag = True return self def __enter__(self): """ On context manager enter step, we're basically pushing this Batcher instance to the parent cacher's batcher context, so when the there are decorated functions that are registering, they know to which batcher to register to.""" self.cacher.push_batcher(self) def __exit__(self, type, value, traceback): """ On exit, pop the batcher. """ if self._autobatch_flag: self.batch() self._autobatch_flag = False self.cacher.pop_batcher() def add_hook(self, event, fn): """ Add hook function to be executed on event. Example usage:: def on_cacher_invalidate(key): pass cacher.add_hook('invalidate', on_cacher_invalidate) """ if event not in ('invalidate', 'call', 'register'): raise InvalidHookEventException(\ "Hook event must be 'invalidate', 'call', or 'register'") self._hooks[event].append(fn) def trigger_hooks(self, event, *args, **kwargs): if event not in ('invalidate', 'call', 'register'): raise InvalidHookEventException(\ "Hook event must be 'invalidate', 'call', or 'register'") for fn in self._hooks[event]: fn(*args, **kwargs) def remove_all_hooks(self, event): if event not in ('invalidate', 'call', 'register'): raise InvalidHookEventException(\ "Hook event must be 'invalidate', 'call', or 'register'") #reset self._hooks[event] = []
class Batcher(object): """ Batcher enables developers to batch multiple retrieval requests. Example usage #1:: from pycacher import Cacher cacher = Cacher() batcher = cacher.create_batcher() batcher.add('testkey') batcher.add('testkey1') batcher.add('testkey2') values = batcher.batch() It is possible to use batcher as context manager. Inside the context manager, developers can call the `.register` method of cached functions to register its keys to the currently active batcher for later batching. Then, when the actual cached functions that were registered earlier inside the context manager were actually called, it will seek its value from the batcher context. Example usage #2:: from pycacher import Cacher cacher = Cacher() batcher = cacher.create_batcher() with batcher: cached_func.register(1, 2) cached_func_2.register(1, 2) cached_func_3.register(3, 5) batcher.batch() #Later.. with batcher: cached_func(1, 2) #will look for its value from the batcher cached_func_2(1, 2) cached_func(3, 5) #You can also do this: batcher.register(cached_func, 1, 2) batcher.register(cached_func_2, 1, 2) """ def __init__(self, cacher=None): self.cacher = cacher self._keys = set() self._last_batched_values = None self._autobatch_flag = False self._hooks = {'register': [], 'call': []} def add(self, key): if isinstance(key, list): for k in key: self._keys.add(k) else: self._keys.add(key) def reset(self): self._keys = set() def batch(self): self._last_batched_values = self.cacher.backend.multi_get(self._keys) return self._last_batched_values def has_batched(self): return self._last_batched_values is not None def register(self, decorated_func, *args): cache_key = decorated_func.build_cache_key(*args) self.add(cache_key) self.trigger_hooks('register', cache_key, self) self.cacher.trigger_hooks('register', cache_key, self) def register_list(self, decorated_list_func, *args, **kwargs): """Registers a cached list function. """ skip = kwargs['skip'] limit = kwargs['limit'] for ranged_cache_key in decorated_list_func.get_ranged_cache_keys(*args, skip=skip, limit=limit): self.add(ranged_cache_key) cache_key = decorated_list_func.build_cache_key(*args) self.trigger_hooks('register', cache_key, self) self.cacher.trigger_hooks('register', cache_key, self) def get_last_batched_values(self): return self._last_batched_values def get_values(self): return self.get_last_batched_values() def get_keys(self): return self._keys def get(self, key): if self._last_batched_values: return self._last_batched_values.get(key) return None def is_batched(self, key): """Checks whether a key is included in the latest batch. Example: self.batcher.add('test-1') self.batcher.batch() self.batcher.is_batched('test-1') >> True """ if self._last_batched_values: return key in self._last_batched_values return False def autobatch(self): """autobatch enables the batcher to automatically batch the batcher keys in the end of the context manager call. Example Usage:: with batcher.autobatch(): expensive_function.register(1, 2) #is similar to: with batcher: expensive_function.register(1, 2) batcher.batch() """ self._autobatch_flag = True return self def __enter__(self): """ On context manager enter step, we're basically pushing this Batcher instance to the parent cacher's batcher context, so when the there are decorated functions that are registering, they know to which batcher to register to.""" self.cacher.push_batcher(self) def __exit__(self, type, value, traceback): """ On exit, pop the batcher. """ if self._autobatch_flag: self.batch() self._autobatch_flag = False self.cacher.pop_batcher() def add_hook(self, event, fn): """ Add hook function to be executed on event. Example usage:: def on_cacher_invalidate(key): pass cacher.add_hook('invalidate', on_cacher_invalidate) """ if event not in ('invalidate', 'call', 'register'): raise invalid_hook_event_exception("Hook event must be 'invalidate', 'call', or 'register'") self._hooks[event].append(fn) def trigger_hooks(self, event, *args, **kwargs): if event not in ('invalidate', 'call', 'register'): raise invalid_hook_event_exception("Hook event must be 'invalidate', 'call', or 'register'") for fn in self._hooks[event]: fn(*args, **kwargs) def remove_all_hooks(self, event): if event not in ('invalidate', 'call', 'register'): raise invalid_hook_event_exception("Hook event must be 'invalidate', 'call', or 'register'") self._hooks[event] = []
''' Implement the BSTIterator class that represents an iterator over the in-order traversal of a binary search tree (BST): BSTIterator(TreeNode root) Initializes an object of the BSTIterator class. The root of the BST is given as part of the constructor. The pointer should be initialized to a non-existent number smaller than any element in the BST. boolean hasNext() Returns true if there exists a number in the traversal to the right of the pointer, otherwise returns false. int next() Moves the pointer to the right, then returns the number at the pointer. Notice that by initializing the pointer to a non-existent smallest number, the first call to next() will return the smallest element in the BST. You may assume that next() calls will always be valid. That is, there will be at least a next number in the in-order traversal when next() is called. ''' # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class BSTIterator(object): def __init__(self, root): """ :type root: TreeNode """ self.stack = [root] self.size = 1 def next(self): """ :rtype: int """ while self.stack: node = self.stack.pop() if not node: node = self.stack.pop() self.size = len(self.stack) return node.val if node.right: self.stack.append(node.right) self.stack.append(node) self.stack.append(None) if node.left: self.stack.append(node.left) return None def hasNext(self): """ :rtype: bool """ return self.size > 0 # Your BSTIterator object will be instantiated and called as such: # obj = BSTIterator(root) # param_1 = obj.next() # param_2 = obj.hasNext()
""" Implement the BSTIterator class that represents an iterator over the in-order traversal of a binary search tree (BST): BSTIterator(TreeNode root) Initializes an object of the BSTIterator class. The root of the BST is given as part of the constructor. The pointer should be initialized to a non-existent number smaller than any element in the BST. boolean hasNext() Returns true if there exists a number in the traversal to the right of the pointer, otherwise returns false. int next() Moves the pointer to the right, then returns the number at the pointer. Notice that by initializing the pointer to a non-existent smallest number, the first call to next() will return the smallest element in the BST. You may assume that next() calls will always be valid. That is, there will be at least a next number in the in-order traversal when next() is called. """ class Bstiterator(object): def __init__(self, root): """ :type root: TreeNode """ self.stack = [root] self.size = 1 def next(self): """ :rtype: int """ while self.stack: node = self.stack.pop() if not node: node = self.stack.pop() self.size = len(self.stack) return node.val if node.right: self.stack.append(node.right) self.stack.append(node) self.stack.append(None) if node.left: self.stack.append(node.left) return None def has_next(self): """ :rtype: bool """ return self.size > 0
c = input().strip() fr = input().split() n = 0 for i in fr: if c in i: n += 1 print('{:.1f}'.format(n*100/len(fr)))
c = input().strip() fr = input().split() n = 0 for i in fr: if c in i: n += 1 print('{:.1f}'.format(n * 100 / len(fr)))
# Copyright 2021 Huawei Technologies Co., Ltd # # 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. _base_ = [ '../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/coco_instance.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( rpn_head=dict( anchor_generator=dict(type='LegacyAnchorGenerator', center_offset=0.5), bbox_coder=dict(type='LegacyDeltaXYWHBBoxCoder'), loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)), roi_head=dict( bbox_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict( type='RoIAlign', output_size=7, sampling_ratio=2, aligned=False)), mask_roi_extractor=dict( type='SingleRoIExtractor', roi_layer=dict( type='RoIAlign', output_size=14, sampling_ratio=2, aligned=False)), bbox_head=dict( bbox_coder=dict(type='LegacyDeltaXYWHBBoxCoder'), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)))) # model training and testing settings train_cfg = dict( rpn_proposal=dict(nms_post=2000, max_num=2000), rcnn=dict(assigner=dict(match_low_quality=True)))
_base_ = ['../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/coco_instance.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'] model = dict(rpn_head=dict(anchor_generator=dict(type='LegacyAnchorGenerator', center_offset=0.5), bbox_coder=dict(type='LegacyDeltaXYWHBBoxCoder'), loss_bbox=dict(type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0)), roi_head=dict(bbox_roi_extractor=dict(type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', output_size=7, sampling_ratio=2, aligned=False)), mask_roi_extractor=dict(type='SingleRoIExtractor', roi_layer=dict(type='RoIAlign', output_size=14, sampling_ratio=2, aligned=False)), bbox_head=dict(bbox_coder=dict(type='LegacyDeltaXYWHBBoxCoder'), loss_bbox=dict(type='SmoothL1Loss', beta=1.0, loss_weight=1.0)))) train_cfg = dict(rpn_proposal=dict(nms_post=2000, max_num=2000), rcnn=dict(assigner=dict(match_low_quality=True)))
raw_data = [ b'\x1cT#01 61.01,\r\nT#03 88.07,90.78,90.17,29.48,14.41\r\n \r\n \xae$\xe2\x02\xe0D\x143P\x02\xe0', b'T#01 56.92,\r\nT#03 88.10,90.62,90.42,29.68,14.39\r\n \r\n C \xfc', b'T#01 63.51,\r\nT#03 87.98,90.36,90.15,29.30,14.41\r\n \r\n \x03\x82\x01\x80$\x9f\xd8\xbc\x0f\x08', b'T#01 56.05,\r\nT#03 87.99,90.66,90.52,29.00,14.40\r\n \r\n \x080"', b'T#01 59.20,\r\nT#03 88.17,91.09,90.62,28.79,14.41\r\n \r\n \x803\x06\x18\xf8', b'T#01 52.21,\r\nT#03 87.93,90.57,90.56,28.65,14.40\r\n \r\n \xf83\x0b\x1c', b'T#01 49.17,\r\nT#03 87.75,90.50,90.40,28.24,14.41\r\n \r\n :\x02@\x8c\x06', b'T#01 45.93,\r\nT#03 87.86,91.08,90.75,27.81,14.42\r\n \r\n \x01\x80\xa1s\x86\xe7\x03\xfc', b'T#01 50.86,\r\nT#03 87.79,90.61,90.53,27.23,14.43\r\n \r\n \x86\x16 \x80\xf0\xc7\xf2\xc0', b'\x1e\x80\xf8T#01 47.12,\r\nT#03 87.54,90.59,90.41,26.66,14.42\r\n \r\n \xf1\x17a\x80\x02\xfe', b'T#01 50.26,\r\nT#03 87.60,90.97,90.42,26.95,14.40\r\n \r\n \xc0\xf3[\xd3\x81\xfc9\xf5\xb8\x06\x80\xfe', b'T#01 57.21,\r\nT#03 87.64,90.55,90.13,25.40,14.42\r\n \r\n \x04\x08\x93\x98\xd9\xfc', b'T#01 54.55,\r\nT#03 87.86,90.88,90.43,25.55,14.40\r\n \r\n \x01\x80\t\x18\xc6!`\xfe', b'#01 53.39,\r\nT#03 87.89,90.84,90.12,25.71,14.41\r\n \r\n \x01(\x12 \xfe', b'T#01 52.59,\r\nT#03 88.06,90.75,90.29,26.29,14.40\r\n \r\n \xf2\x83l\x1e<\x90\x04', b'\xfeT#01 54.47,\r\nT#03 87.93,90.83,90.04,26.48,14.41\r\n \r\n k|^y\xfe', b'T#01 55.85,\r\nT#03 87.83,90.89,90.51,26.45,14.42\r\n \r\n \xc4\xd6>4\xfa', b'T#01 52.55,\r\nT#03 87.59,90.84,90.53,25.37,14.42\r\n \r\n \x02:\\@\x84G\x01\x84', b'T#01 54.72,\r\nT#03 87.76,90.86,90.25,25.36,14.40\r\n \r\n \x90\x80B\xc8;\x80\x0e\x80', b'T#01 54.70,\r\nT#03 87.78,90.64,90.08,25.54,14.40\r\n \r\n \x88P\xc2\x06', b'T#01 55.10,\r\nT#03 87.96,90.90,90.54,26.46,14.41\r\n \r\n @\xf0kT\xfc', b'T#01 53.83,\r\nT#03 87.90,90.91,90.32,25.77,14.42\r\n \r\n \x12\x0e"\xf2 \xbb\x0f\x80', b'T#01 54.64,\r\nT#03 87.99,90.50,90.26,26.15,14.43\r\n \r\n ', b'T#01 53.13,\r\nT#03 87.85,91.07,90.40,25.94,14.43\r\n \r\n \x80\xf8', b'T#01 60.26,\r\nT#03 87.62,91.09,90.31,25.16,14.42\r\n \r\n \x18A\x04', b'T#01 56.29,\r\nT#03 87.71,91.03,90.17,24.70,14.40\r\n \r\n "\xc8H\xc0', b'T#01 66.20,\r\nT#03 87.77,91.03,90.26,24.44,14.40\r\n \r\n ', b'T#01 57.08,\r\nT#03 87.82,91.13,90.22,24.22,14.40\r\n \r\n \x01\x02\x80@\x04', b'T#01 61.81,\r\nT#03 87.69,91.07,90.28,24.03,14.40\r\n \r\n \xf3', b'T#01 59.01,\r\nT#03 87.73,90.70,90.07,23.99,14.42\r\n \r\n @\xfc', b'T#01 56.05,\r\nT#03 87.69,91.02,90.36,24.32,14.40\r\n \r\n \xa0\x8f\x0b\x07\x01', b'T#01 63.64,\r\nT#03 87.72,90.99,90.34,24.45,14.41\r\nT#01 64.58,\r\n \r\n \xfe', b'\xfcT#01 67.45,\r\nT#03 87.80,90.83,90.22,24.52,14.42\r\n \r\n \x02\x04\xfe ,@\xa3\x03', b'T#01 60.04,\r\nT#03 87.69,90.80,90.57,24.98,14.41\r\n \r\n \xe0\x01\x14', b'T#01 59.57,\r\nT#03 87.72,90.96,90.57,25.91,14.42\r\n \r\n \x01\xe4s\xe10D\x03\xe0', b'T#01 61.67,\r\nT#03 87.73,91.05,90.40,26.04,14.42\r\n \r\n \xe0\xfa\xe2\xc8\x84\x1e', b'\x12\xf8T#01 85.78,\r\nT#03 87.71,91.21,90.41,25.67,14.39\r\n \r\n 2\x011\x95\x89\x80\r\xf0', b'T#01 69.74,\r\nT#03 87.91,90.97,90.49,25.24,14.42\r\n \r\n \xf0', b'T#01 65.01,\r\nT#03 87.93,90.61,90.60,25.28,14.41\r\n \r\n \x01\xf3HB', b'T#01 63.63,\r\nT#03 87.97,90.90,90.92,26.12,14.40\r\n \r\n \xfe', b'T#01 61.84,\r\nT#03 88.17,91.13,90.78,26.92,14.42\r\n \r\n \x80H\xf0', b'T#01 65.72,\r\nT#03 87.72,90.93,90.51,26.14,14.40\r\n \r\n \xfe1\x8e', b'T#01 61.01,\r\nT#03 87.61,90.94,90.65,25.93,14.40\r\n \r\n \x02\x1cH\xe0', b'T#01 60.10,\r\nT#03 87.62,90.97,90.60,25.87,14.39\r\n \r\n \xf1', b'T#01 61.83,\r\nT#03 87.83,91.03,90.29,25.60,14.43\r\n \r\n \xf8\xe8', b'T#01 65.53,\r\nT#03 88.13,90.71,90.49,25.44,14.42\r\n \r\n \xc7a"\x12\x04', b'T#01 67.88,\r\nT#03 87.83,91.02,90.20,25.28,14.42\r\n \r\n 0\x07@\x12D', b'T#01 77.61,\r\nT#03 87.68,91.06,90.27,24.85,14.42\r\n \r\n \x800\xfb\x02\xdc\x03\x01\x1e', b'T#01 67.28,\r\nT#03 87.94,91.08,90.61,24.95,14.40\r\n \r\n \xc0|\xdb\xe8g<', b'T#01 63.90,\r\nT#03 87.86,90.98,90.53,24.97,14.43\r\n \r\n \xc7\x02\x80', b'T#01 60.11,\r\nT#03 87.76,90.91,90.52,25.06,14.40\r\n \r\n ', b'T#01 66.12,\r\nT#03 87.65,90.85,90.69,25.25,14.42\r\n \r\n \xe0\x02\x80X\t\x04@', b'T#01 71.97,\r\nT#03 87.81,90.91,90.32,25.65,14.42\r\n \r\n \xc8\x06\x047', b'T#01 66.58,\r\nT#03 87.79,91.06,90.35,25.46,14.43\r\n \r\n `\x80\x88\xa4\xfc', b'T#01 58.96,\r\nT#03 87.32,90.92,90.27,25.17,14.39\r\n \r\n \x08\xfa', b'T#01 58.30,\r\nT#03 87.23,90.91,90.43,24.80,14.41\r\n \r\n ', b'T#01 56.55,\r\nT#03 87.35,90.98,90.50,24.71,14.39\r\n \r\n \xf8<-\x0c', b'T#01 58.05,\r\nT#03 87.40,90.91,90.18,24.76,14.41\r\n \r\n \x05', b'T#01 76.65,\r\nT#03 87.64,91.03,90.22,24.38,14.42\r\n \r\n `\x81\xc2\xc0#\x0c\x1c', b'T#01 65.58,\r\nT#03 87.69,90.56,90.21,24.26,14.40\r\n \r\n \xc8', b'T#01 62.54,\r\nT#03 87.65,90.73,90.48,24.64,14.42\r\n \r\n \x0e7\x124\r\xfe', b'T#01 62.07,\r\nT#03 87.48,90.98,90.17,25.01,14.42\r\n \r\n \x80\xfea\x92\xc4\xae', b'T#01 63.46,\r\nT#03 87.52,91.04,90.37,24.83,14.40\r\n \r\n \x80\xc0', b'T#01 60.82,\r\nT#03 87.18,90.87,90.26,24.67,14.39\r\n \r\n \x03?h\x04\xb1\x98\t\x80\x0f\x81\x01\x80', b'T#01 54.87,\r\nT#03 87.27,90.85,90.50,24.82,14.41\r\n \r\n \xfc(\x04B\x1c\xf0', b'T#01 73.36,\r\nT#03 87.56,90\xfc\x04\x01\x12\x12\xf5\x1e0\x01\x80', b'T#01 71.44,\r\nT#03 87.76,91.00,90.31,24.82,14.14\r\n \r\n \xc0t', b'T#01 64.59,\r\nT#03 87.24,91.05,90.08,24.17,14.42\r\n \r\n \x02\xe0', b'T#01 72.30,\r\nT#03 87.32,91.08,90.14,23.47,14.42\r\n \r\n @H\x80\x01\xa0\x19\x15\x03', b'T#01 65.38,\r\nT#03 87.48,90.94,90.24,23.25,14.44\r\n \r\n \x03\x10\x06\x85l0\x18', b'T#01 64.02,\r\nT#03 87.45,90.98,90.18,22.97,14.42\r\n \r\n \x80\xfe\x1b', b'\x01\xf9T#01 87.72,\r\nT#03 87.60,91.12,90.06,22.60,14.27\r\n \r\n \x80\xf8\x8c\x10\x8b', b'T#01 80.09,\r\nT#03 87.47,91.07,89.97,22.08,14.09\r\nT#01 86.17,\r\nT#03 87.47,91.09,90.05,21.94,14.04\r\n \r\n \xfcM\x06D\x06', b'T#01 67.42,\r\nT#03 87.45,91.03,90.00,21.38,14.42\r\n \r\n \xfd9P\x0c\\\x04', b'T#01 72.79,\r\nT#03 87.40,91.07,90.09,20.90,14.13\r\n \r\n \xc1\x03', b'T#01 72.22,\r\nT#03 87.66,91.27,90.00,20.44,13.91\r\n \r\n \x10\x10\x80\x0c\xd0t\xc4\x17\x0c\x80', b'T#01 71.30,\r\nT#03 87.56,91.18,90.11,20.04,13.76\r\n \r\n \x01\xea', b'T#01 83.55,\r\nT#03 87.52,90.96,89.86,19.28,13.64\r\n \r\n \xf4', b'T#01 77.06,\r\nT#03 87.75,91.30,90.21,18.97,13.49\r\n \r\n \xa0\x8a&\x02', b'T#01 79.01,\r\nT#03 87.55,91.02,90.12,18.57,13.39\r\n \r\n \x0c\x03\x03\xc0\xe1\x80 \xfc', b'T#01 91.21,\r\nT#03 87.67,91.03,90.01,18.39,13.28\r\n \r\n \xe6\x19\xd0\x01\xd0', b'T#01 89.87,\r\nT#03 88.16,91.20,90.12,18.07,13.16\r\n \r\n \xe0\xc4\x90\xc2\x03\xf0', b'T#01 89.64,\r\nT#03 87.91,90.82,89.80,17.45,13.08\r\n \r\n \x02\x02\x13\xc0c\xc8\x19\xfc', b'T#01 88.11,\r\nT#03 87.94,90.98,89.85,17.33,13.01\r\n \r\n \x80\r\x18\xfe', b'T#01 89.66,\r\nT#03 87.88,91.42,89.75,17.03,12.96\r\n \r\n \xc0x\x80\x08\xbd\x0f', b'T#01 92.55,\r\nT#03 87.94,90.80,89.64,16.70,12.93\r\n \r\n \xfev\xa9\x04', b'T#01 88.17,\r\nT#03 87.94,91.15,89.74,16.60,12.93\r\n \r\n \x050\x89\xc1\x81\xe7V\x06&', b'T#01 92.07,\r\nT#03 87.76,90.92,89.62,16.64,12.93\r\n \r\n \xfc\x01<\xe0\x08\x04', b'T#01 89.57,\r\nT#03 87.67,90.97,89.57,16.57,12.93\r\n \r\n \x01"\x80\x04\xfe', b'T#01 88.74,\r\nT#03 88.18,91.11,90.09,16.61,12.93\r\n \r\n \x03\x060\xfe\x8f\x97\x0e\x170\x01\xc0', b'T#01 88.81,\r\nT#03 87.98,90.89,89.86,16.19,12.95\r\n \r\n \xf0\x85\x0e8\xe8\x03', b'T#01 95.93,\r\nT#03 87.88,90.96,90.01,16.06,12.96\r\n \r\n \xfa', b'\xf8T#01 92.55,\r\nT#03 87.87,90.92,90.17,15.88,12.96\r\n \r\n \xc9\x08,', b'T#01 93.25,\r\nT#03 87.74,90.88,89.86,15.81,12.96\r\n \r\n \xfe%m\x03\x91\x0f', b'\x0c\xc0T#01 94.89,\r\nT#03 87.81,91.07,89.78,15.67,12.96\r\n \r\n \x01\xfa0\x08', b'T#01 92.07,\r\nT#03 87.87,90.94,89.96,15.63,12.96\r\n \r\n \xfe\x0b\xe0\xc3', b'T#01 97.30,\r\nT#03 87.75,91.06,90.04,15.38,12.96\r\n \r\n \x02@', b'T#01 95.69,\r\nT#03 87.68,91.04,89.88,15.24,12.96\r\n \r\n \x900\xe4', b'T#01 95.21,\r\nT#03 87.78,90.99,89.73,15.18,12.96\r\n \r\n C\xfe\x1cD\n\x89\x81', b'T#01 91.75,\r\nT#03 87.90,90.96,89.65,15.18,12.96\r\n \r\n @\xf2,A', ] clean_data = [ [['61.01', ], ], [['56.92', ], ], [['63.51', ], ], [['56.05', ], ], [['59.20', ], ], [['52.21', ], ], [['49.17', ], ], [['45.93', ], ], [['50.86', ], ], [['47.12', ], ], [['50.26', ], ], [['57.21', ], ], [['54.55', ], ], [['53.39', ], ], [['52.59', ], ], [['54.47', ], ], [['55.85', ], ], [['52.55', ], ], [['54.72', ], ], [['54.70', ], ], [['55.10', ], ], [['53.83', ], ], [['54.64', ], ], [['53.13', ], ], [['60.26', ], ], [['56.29', ], ], [['66.20', ], ], [['57.08', ], ], [['61.81', ], ], [['59.01', ], ], [['56.05', ], ], [['63.64', ], ['64.58', ], ], [['67.45', ], ], [['60.04', ], ], [['59.57', ], ], [['61.67', ], ], [['85.78', ], ], [['69.74', ], ], [['65.01', ], ], [['63.63', ], ], [['61.84', ], ], [['65.72', ], ], [['61.01', ], ], [['60.10', ], ], [['61.83', ], ], [['65.53', ], ], [['67.88', ], ], [['77.61', ], ], [['67.28', ], ], [['63.90', ], ], [['60.11', ], ], [['66.12', ], ], [['71.97', ], ], [['66.58', ], ], [['58.96', ], ], [['58.30', ], ], [['56.55', ], ], [['58.05', ], ], [['76.65', ], ], [['65.58', ], ], [['62.54', ], ], [['62.07', ], ], [['63.46', ], ], [['60.82', ], ], [['54.87', ], ], [['73.36', ], ], [['71.44', ], ], [['64.59', ], ], [['72.30', ], ], [['65.38', ], ], [['64.02', ], ], [['87.72', ], ], [['80.09', ], ['86.17', ], ], [['67.42', ], ], [['72.79', ], ], [['72.22', ], ], [['71.30', ], ], [['83.55', ], ], [['77.06', ], ], [['79.01', ], ], [['91.21', ], ], [['89.87', ], ], [['89.64', ], ], [['88.11', ], ], [['89.66', ], ], [['92.55', ], ], [['88.17', ], ], [['92.07', ], ], [['89.57', ], ], [['88.74', ], ], [['88.81', ], ], [['95.93', ], ], [['92.55', ], ], [['93.25', ], ], [['94.89', ], ], [['92.07', ], ], [['97.30', ], ], [['95.69', ], ], [['95.21', ], ], [['91.75', ], ], ]
raw_data = [b'\x1cT#01 61.01,\r\nT#03 88.07,90.78,90.17,29.48,14.41\r\n \r\n \xae$\xe2\x02\xe0D\x143P\x02\xe0', b'T#01 56.92,\r\nT#03 88.10,90.62,90.42,29.68,14.39\r\n \r\n C \xfc', b'T#01 63.51,\r\nT#03 87.98,90.36,90.15,29.30,14.41\r\n \r\n \x03\x82\x01\x80$\x9f\xd8\xbc\x0f\x08', b'T#01 56.05,\r\nT#03 87.99,90.66,90.52,29.00,14.40\r\n \r\n \x080"', b'T#01 59.20,\r\nT#03 88.17,91.09,90.62,28.79,14.41\r\n \r\n \x803\x06\x18\xf8', b'T#01 52.21,\r\nT#03 87.93,90.57,90.56,28.65,14.40\r\n \r\n \xf83\x0b\x1c', b'T#01 49.17,\r\nT#03 87.75,90.50,90.40,28.24,14.41\r\n \r\n :\x02@\x8c\x06', b'T#01 45.93,\r\nT#03 87.86,91.08,90.75,27.81,14.42\r\n \r\n \x01\x80\xa1s\x86\xe7\x03\xfc', b'T#01 50.86,\r\nT#03 87.79,90.61,90.53,27.23,14.43\r\n \r\n \x86\x16 \x80\xf0\xc7\xf2\xc0', b'\x1e\x80\xf8T#01 47.12,\r\nT#03 87.54,90.59,90.41,26.66,14.42\r\n \r\n \xf1\x17a\x80\x02\xfe', b'T#01 50.26,\r\nT#03 87.60,90.97,90.42,26.95,14.40\r\n \r\n \xc0\xf3[\xd3\x81\xfc9\xf5\xb8\x06\x80\xfe', b'T#01 57.21,\r\nT#03 87.64,90.55,90.13,25.40,14.42\r\n \r\n \x04\x08\x93\x98\xd9\xfc', b'T#01 54.55,\r\nT#03 87.86,90.88,90.43,25.55,14.40\r\n \r\n \x01\x80\t\x18\xc6!`\xfe', b'#01 53.39,\r\nT#03 87.89,90.84,90.12,25.71,14.41\r\n \r\n \x01(\x12 \xfe', b'T#01 52.59,\r\nT#03 88.06,90.75,90.29,26.29,14.40\r\n \r\n \xf2\x83l\x1e<\x90\x04', b'\xfeT#01 54.47,\r\nT#03 87.93,90.83,90.04,26.48,14.41\r\n \r\n k|^y\xfe', b'T#01 55.85,\r\nT#03 87.83,90.89,90.51,26.45,14.42\r\n \r\n \xc4\xd6>4\xfa', b'T#01 52.55,\r\nT#03 87.59,90.84,90.53,25.37,14.42\r\n \r\n \x02:\\@\x84G\x01\x84', b'T#01 54.72,\r\nT#03 87.76,90.86,90.25,25.36,14.40\r\n \r\n \x90\x80B\xc8;\x80\x0e\x80', b'T#01 54.70,\r\nT#03 87.78,90.64,90.08,25.54,14.40\r\n \r\n \x88P\xc2\x06', b'T#01 55.10,\r\nT#03 87.96,90.90,90.54,26.46,14.41\r\n \r\n @\xf0kT\xfc', b'T#01 53.83,\r\nT#03 87.90,90.91,90.32,25.77,14.42\r\n \r\n \x12\x0e"\xf2 \xbb\x0f\x80', b'T#01 54.64,\r\nT#03 87.99,90.50,90.26,26.15,14.43\r\n \r\n ', b'T#01 53.13,\r\nT#03 87.85,91.07,90.40,25.94,14.43\r\n \r\n \x80\xf8', b'T#01 60.26,\r\nT#03 87.62,91.09,90.31,25.16,14.42\r\n \r\n \x18A\x04', b'T#01 56.29,\r\nT#03 87.71,91.03,90.17,24.70,14.40\r\n \r\n "\xc8H\xc0', b'T#01 66.20,\r\nT#03 87.77,91.03,90.26,24.44,14.40\r\n \r\n ', b'T#01 57.08,\r\nT#03 87.82,91.13,90.22,24.22,14.40\r\n \r\n \x01\x02\x80@\x04', b'T#01 61.81,\r\nT#03 87.69,91.07,90.28,24.03,14.40\r\n \r\n \xf3', b'T#01 59.01,\r\nT#03 87.73,90.70,90.07,23.99,14.42\r\n \r\n @\xfc', b'T#01 56.05,\r\nT#03 87.69,91.02,90.36,24.32,14.40\r\n \r\n \xa0\x8f\x0b\x07\x01', b'T#01 63.64,\r\nT#03 87.72,90.99,90.34,24.45,14.41\r\nT#01 64.58,\r\n \r\n \xfe', b'\xfcT#01 67.45,\r\nT#03 87.80,90.83,90.22,24.52,14.42\r\n \r\n \x02\x04\xfe ,@\xa3\x03', b'T#01 60.04,\r\nT#03 87.69,90.80,90.57,24.98,14.41\r\n \r\n \xe0\x01\x14', b'T#01 59.57,\r\nT#03 87.72,90.96,90.57,25.91,14.42\r\n \r\n \x01\xe4s\xe10D\x03\xe0', b'T#01 61.67,\r\nT#03 87.73,91.05,90.40,26.04,14.42\r\n \r\n \xe0\xfa\xe2\xc8\x84\x1e', b'\x12\xf8T#01 85.78,\r\nT#03 87.71,91.21,90.41,25.67,14.39\r\n \r\n 2\x011\x95\x89\x80\r\xf0', b'T#01 69.74,\r\nT#03 87.91,90.97,90.49,25.24,14.42\r\n \r\n \xf0', b'T#01 65.01,\r\nT#03 87.93,90.61,90.60,25.28,14.41\r\n \r\n \x01\xf3HB', b'T#01 63.63,\r\nT#03 87.97,90.90,90.92,26.12,14.40\r\n \r\n \xfe', b'T#01 61.84,\r\nT#03 88.17,91.13,90.78,26.92,14.42\r\n \r\n \x80H\xf0', b'T#01 65.72,\r\nT#03 87.72,90.93,90.51,26.14,14.40\r\n \r\n \xfe1\x8e', b'T#01 61.01,\r\nT#03 87.61,90.94,90.65,25.93,14.40\r\n \r\n \x02\x1cH\xe0', b'T#01 60.10,\r\nT#03 87.62,90.97,90.60,25.87,14.39\r\n \r\n \xf1', b'T#01 61.83,\r\nT#03 87.83,91.03,90.29,25.60,14.43\r\n \r\n \xf8\xe8', b'T#01 65.53,\r\nT#03 88.13,90.71,90.49,25.44,14.42\r\n \r\n \xc7a"\x12\x04', b'T#01 67.88,\r\nT#03 87.83,91.02,90.20,25.28,14.42\r\n \r\n 0\x07@\x12D', b'T#01 77.61,\r\nT#03 87.68,91.06,90.27,24.85,14.42\r\n \r\n \x800\xfb\x02\xdc\x03\x01\x1e', b'T#01 67.28,\r\nT#03 87.94,91.08,90.61,24.95,14.40\r\n \r\n \xc0|\xdb\xe8g<', b'T#01 63.90,\r\nT#03 87.86,90.98,90.53,24.97,14.43\r\n \r\n \xc7\x02\x80', b'T#01 60.11,\r\nT#03 87.76,90.91,90.52,25.06,14.40\r\n \r\n ', b'T#01 66.12,\r\nT#03 87.65,90.85,90.69,25.25,14.42\r\n \r\n \xe0\x02\x80X\t\x04@', b'T#01 71.97,\r\nT#03 87.81,90.91,90.32,25.65,14.42\r\n \r\n \xc8\x06\x047', b'T#01 66.58,\r\nT#03 87.79,91.06,90.35,25.46,14.43\r\n \r\n `\x80\x88\xa4\xfc', b'T#01 58.96,\r\nT#03 87.32,90.92,90.27,25.17,14.39\r\n \r\n \x08\xfa', b'T#01 58.30,\r\nT#03 87.23,90.91,90.43,24.80,14.41\r\n \r\n ', b'T#01 56.55,\r\nT#03 87.35,90.98,90.50,24.71,14.39\r\n \r\n \xf8<-\x0c', b'T#01 58.05,\r\nT#03 87.40,90.91,90.18,24.76,14.41\r\n \r\n \x05', b'T#01 76.65,\r\nT#03 87.64,91.03,90.22,24.38,14.42\r\n \r\n `\x81\xc2\xc0#\x0c\x1c', b'T#01 65.58,\r\nT#03 87.69,90.56,90.21,24.26,14.40\r\n \r\n \xc8', b'T#01 62.54,\r\nT#03 87.65,90.73,90.48,24.64,14.42\r\n \r\n \x0e7\x124\r\xfe', b'T#01 62.07,\r\nT#03 87.48,90.98,90.17,25.01,14.42\r\n \r\n \x80\xfea\x92\xc4\xae', b'T#01 63.46,\r\nT#03 87.52,91.04,90.37,24.83,14.40\r\n \r\n \x80\xc0', b'T#01 60.82,\r\nT#03 87.18,90.87,90.26,24.67,14.39\r\n \r\n \x03?h\x04\xb1\x98\t\x80\x0f\x81\x01\x80', b'T#01 54.87,\r\nT#03 87.27,90.85,90.50,24.82,14.41\r\n \r\n \xfc(\x04B\x1c\xf0', b'T#01 73.36,\r\nT#03 87.56,90\xfc\x04\x01\x12\x12\xf5\x1e0\x01\x80', b'T#01 71.44,\r\nT#03 87.76,91.00,90.31,24.82,14.14\r\n \r\n \xc0t', b'T#01 64.59,\r\nT#03 87.24,91.05,90.08,24.17,14.42\r\n \r\n \x02\xe0', b'T#01 72.30,\r\nT#03 87.32,91.08,90.14,23.47,14.42\r\n \r\n @H\x80\x01\xa0\x19\x15\x03', b'T#01 65.38,\r\nT#03 87.48,90.94,90.24,23.25,14.44\r\n \r\n \x03\x10\x06\x85l0\x18', b'T#01 64.02,\r\nT#03 87.45,90.98,90.18,22.97,14.42\r\n \r\n \x80\xfe\x1b', b'\x01\xf9T#01 87.72,\r\nT#03 87.60,91.12,90.06,22.60,14.27\r\n \r\n \x80\xf8\x8c\x10\x8b', b'T#01 80.09,\r\nT#03 87.47,91.07,89.97,22.08,14.09\r\nT#01 86.17,\r\nT#03 87.47,91.09,90.05,21.94,14.04\r\n \r\n \xfcM\x06D\x06', b'T#01 67.42,\r\nT#03 87.45,91.03,90.00,21.38,14.42\r\n \r\n \xfd9P\x0c\\\x04', b'T#01 72.79,\r\nT#03 87.40,91.07,90.09,20.90,14.13\r\n \r\n \xc1\x03', b'T#01 72.22,\r\nT#03 87.66,91.27,90.00,20.44,13.91\r\n \r\n \x10\x10\x80\x0c\xd0t\xc4\x17\x0c\x80', b'T#01 71.30,\r\nT#03 87.56,91.18,90.11,20.04,13.76\r\n \r\n \x01\xea', b'T#01 83.55,\r\nT#03 87.52,90.96,89.86,19.28,13.64\r\n \r\n \xf4', b'T#01 77.06,\r\nT#03 87.75,91.30,90.21,18.97,13.49\r\n \r\n \xa0\x8a&\x02', b'T#01 79.01,\r\nT#03 87.55,91.02,90.12,18.57,13.39\r\n \r\n \x0c\x03\x03\xc0\xe1\x80 \xfc', b'T#01 91.21,\r\nT#03 87.67,91.03,90.01,18.39,13.28\r\n \r\n \xe6\x19\xd0\x01\xd0', b'T#01 89.87,\r\nT#03 88.16,91.20,90.12,18.07,13.16\r\n \r\n \xe0\xc4\x90\xc2\x03\xf0', b'T#01 89.64,\r\nT#03 87.91,90.82,89.80,17.45,13.08\r\n \r\n \x02\x02\x13\xc0c\xc8\x19\xfc', b'T#01 88.11,\r\nT#03 87.94,90.98,89.85,17.33,13.01\r\n \r\n \x80\r\x18\xfe', b'T#01 89.66,\r\nT#03 87.88,91.42,89.75,17.03,12.96\r\n \r\n \xc0x\x80\x08\xbd\x0f', b'T#01 92.55,\r\nT#03 87.94,90.80,89.64,16.70,12.93\r\n \r\n \xfev\xa9\x04', b'T#01 88.17,\r\nT#03 87.94,91.15,89.74,16.60,12.93\r\n \r\n \x050\x89\xc1\x81\xe7V\x06&', b'T#01 92.07,\r\nT#03 87.76,90.92,89.62,16.64,12.93\r\n \r\n \xfc\x01<\xe0\x08\x04', b'T#01 89.57,\r\nT#03 87.67,90.97,89.57,16.57,12.93\r\n \r\n \x01"\x80\x04\xfe', b'T#01 88.74,\r\nT#03 88.18,91.11,90.09,16.61,12.93\r\n \r\n \x03\x060\xfe\x8f\x97\x0e\x170\x01\xc0', b'T#01 88.81,\r\nT#03 87.98,90.89,89.86,16.19,12.95\r\n \r\n \xf0\x85\x0e8\xe8\x03', b'T#01 95.93,\r\nT#03 87.88,90.96,90.01,16.06,12.96\r\n \r\n \xfa', b'\xf8T#01 92.55,\r\nT#03 87.87,90.92,90.17,15.88,12.96\r\n \r\n \xc9\x08,', b'T#01 93.25,\r\nT#03 87.74,90.88,89.86,15.81,12.96\r\n \r\n \xfe%m\x03\x91\x0f', b'\x0c\xc0T#01 94.89,\r\nT#03 87.81,91.07,89.78,15.67,12.96\r\n \r\n \x01\xfa0\x08', b'T#01 92.07,\r\nT#03 87.87,90.94,89.96,15.63,12.96\r\n \r\n \xfe\x0b\xe0\xc3', b'T#01 97.30,\r\nT#03 87.75,91.06,90.04,15.38,12.96\r\n \r\n \x02@', b'T#01 95.69,\r\nT#03 87.68,91.04,89.88,15.24,12.96\r\n \r\n \x900\xe4', b'T#01 95.21,\r\nT#03 87.78,90.99,89.73,15.18,12.96\r\n \r\n C\xfe\x1cD\n\x89\x81', b'T#01 91.75,\r\nT#03 87.90,90.96,89.65,15.18,12.96\r\n \r\n @\xf2,A'] clean_data = [[['61.01']], [['56.92']], [['63.51']], [['56.05']], [['59.20']], [['52.21']], [['49.17']], [['45.93']], [['50.86']], [['47.12']], [['50.26']], [['57.21']], [['54.55']], [['53.39']], [['52.59']], [['54.47']], [['55.85']], [['52.55']], [['54.72']], [['54.70']], [['55.10']], [['53.83']], [['54.64']], [['53.13']], [['60.26']], [['56.29']], [['66.20']], [['57.08']], [['61.81']], [['59.01']], [['56.05']], [['63.64'], ['64.58']], [['67.45']], [['60.04']], [['59.57']], [['61.67']], [['85.78']], [['69.74']], [['65.01']], [['63.63']], [['61.84']], [['65.72']], [['61.01']], [['60.10']], [['61.83']], [['65.53']], [['67.88']], [['77.61']], [['67.28']], [['63.90']], [['60.11']], [['66.12']], [['71.97']], [['66.58']], [['58.96']], [['58.30']], [['56.55']], [['58.05']], [['76.65']], [['65.58']], [['62.54']], [['62.07']], [['63.46']], [['60.82']], [['54.87']], [['73.36']], [['71.44']], [['64.59']], [['72.30']], [['65.38']], [['64.02']], [['87.72']], [['80.09'], ['86.17']], [['67.42']], [['72.79']], [['72.22']], [['71.30']], [['83.55']], [['77.06']], [['79.01']], [['91.21']], [['89.87']], [['89.64']], [['88.11']], [['89.66']], [['92.55']], [['88.17']], [['92.07']], [['89.57']], [['88.74']], [['88.81']], [['95.93']], [['92.55']], [['93.25']], [['94.89']], [['92.07']], [['97.30']], [['95.69']], [['95.21']], [['91.75']]]
# -*- coding: utf-8 -*- # # Unless explicitly stated otherwise all files in this repository are licensed # under the Apache 2 License. # # This product includes software developed at Datadog # (https://www.datadoghq.com/). # # Copyright 2018 Datadog, Inc. # """crud_service.py Service-helpers for creating and updating data. """ class CRUDService(object): """CRUD persistent storage service. An abstract class for creating and mutating data. """ def create(self): """Creates and persists a new record to the database.""" pass def update(self): """Updates a persisted record.""" pass def delete(self): """Deletes a persisted record.""" pass
"""crud_service.py Service-helpers for creating and updating data. """ class Crudservice(object): """CRUD persistent storage service. An abstract class for creating and mutating data. """ def create(self): """Creates and persists a new record to the database.""" pass def update(self): """Updates a persisted record.""" pass def delete(self): """Deletes a persisted record.""" pass
# # @lc app=leetcode id=1299 lang=python3 # # [1299] Replace Elements with Greatest Element on Right Side # # @lc code=start class Solution: def replaceElements(self, arr: List[int]) -> List[int]: index = 0 result = [] for i,v in enumerate(arr): if i+1 == len(arr): result.append(-1) break result.append(max(arr[i+1:len(arr)])) index = index + 1 return result # @lc code=end
class Solution: def replace_elements(self, arr: List[int]) -> List[int]: index = 0 result = [] for (i, v) in enumerate(arr): if i + 1 == len(arr): result.append(-1) break result.append(max(arr[i + 1:len(arr)])) index = index + 1 return result
class Solution: def findNumberOfLIS(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 dp = [1 for i in range(len(nums))] c = [1 for i in range(len(nums))] for i in range(1, len(nums)): for j in range(i): if nums[j] < nums[i]: #dp[i] = max(dp[j]+1, dp[i]) if dp[i] < dp[j] + 1: dp[i] = dp[j] + 1 c[i] = c[j] elif dp[i] == dp[j] + 1: c[i] += c[j] print(c) print(dp) m = max(dp) res = 0 for i in range(len(dp)): if dp[i] == m: res += c[i] return res
class Solution: def find_number_of_lis(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 dp = [1 for i in range(len(nums))] c = [1 for i in range(len(nums))] for i in range(1, len(nums)): for j in range(i): if nums[j] < nums[i]: if dp[i] < dp[j] + 1: dp[i] = dp[j] + 1 c[i] = c[j] elif dp[i] == dp[j] + 1: c[i] += c[j] print(c) print(dp) m = max(dp) res = 0 for i in range(len(dp)): if dp[i] == m: res += c[i] return res
def rotate(cur_direction, rotation_command): # Assumes there are only R/L 90/180/270 invert_rl = { "R": "L", "L": "R", } if int(rotation_command[1:]) == 270: rotation_command = f"{invert_rl[rotation_command[0]]}90" elif int(rotation_command[1:]) == 180: flip = { "N": "S", "E": "W", "S": "N", "W": "E", } return flip[cur_direction] lookup = { "L90" : { "N": "W", "E": "N", "S": "E", "W": "S", }, "R90" : { "N": "E", "E": "S", "S": "W", "W": "N", }, } return lookup[rotation_command][cur_direction] def rotate_waypoint(x, y, rotation_command): # Assumes there are only R/L 90/180/270 invert_rl = { "R": "L", "L": "R", } if int(rotation_command[1:]) == 270: rotation_command = f"{invert_rl[rotation_command[0]]}90" elif int(rotation_command[1:]) == 180: return -1 * x, -1 * y if rotation_command == "L90": return -1 * y, x elif rotation_command == "R90": return y, -1 * x else: print(f"Invalid command: {rotation_command}") exit(-1) def shift_coords(curx, cury, command): n = int(command[1:]) offsets = { "N": (0, 1), "S": (0, -1), "W": (-1, 0), "E": (1, 0), } offx, offy = offsets[command[0]] return n * offx + curx, n * offy + cury class Ship: def __init__(self): self.direction = "E" self.x = 0 self.y = 0 def run_command(self, command): if "L" in command or "R" in command: self.direction = rotate(self.direction, command) else: command = command.replace("F", self.direction) self.x, self.y = shift_coords(self.x, self.y, command) def manhattan_dist(self): return abs(self.x) + abs(self.y) class ShipWithWaypoint: def __init__(self): self.x = 0 self.y = 0 self.waypoint_x = 10 self.waypoint_y = 1 def run_command(self, command): if "L" in command or "R" in command: self.waypoint_x, self.waypoint_y = rotate_waypoint(self.waypoint_x, self.waypoint_y, command) elif "F" in command: n = int(command[1:]) self.x += self.waypoint_x * n self.y += self.waypoint_y * n else: self.waypoint_x, self.waypoint_y = shift_coords(self.waypoint_x, self.waypoint_y, command) def manhattan_dist(self): return abs(self.x) + abs(self.y)
def rotate(cur_direction, rotation_command): invert_rl = {'R': 'L', 'L': 'R'} if int(rotation_command[1:]) == 270: rotation_command = f'{invert_rl[rotation_command[0]]}90' elif int(rotation_command[1:]) == 180: flip = {'N': 'S', 'E': 'W', 'S': 'N', 'W': 'E'} return flip[cur_direction] lookup = {'L90': {'N': 'W', 'E': 'N', 'S': 'E', 'W': 'S'}, 'R90': {'N': 'E', 'E': 'S', 'S': 'W', 'W': 'N'}} return lookup[rotation_command][cur_direction] def rotate_waypoint(x, y, rotation_command): invert_rl = {'R': 'L', 'L': 'R'} if int(rotation_command[1:]) == 270: rotation_command = f'{invert_rl[rotation_command[0]]}90' elif int(rotation_command[1:]) == 180: return (-1 * x, -1 * y) if rotation_command == 'L90': return (-1 * y, x) elif rotation_command == 'R90': return (y, -1 * x) else: print(f'Invalid command: {rotation_command}') exit(-1) def shift_coords(curx, cury, command): n = int(command[1:]) offsets = {'N': (0, 1), 'S': (0, -1), 'W': (-1, 0), 'E': (1, 0)} (offx, offy) = offsets[command[0]] return (n * offx + curx, n * offy + cury) class Ship: def __init__(self): self.direction = 'E' self.x = 0 self.y = 0 def run_command(self, command): if 'L' in command or 'R' in command: self.direction = rotate(self.direction, command) else: command = command.replace('F', self.direction) (self.x, self.y) = shift_coords(self.x, self.y, command) def manhattan_dist(self): return abs(self.x) + abs(self.y) class Shipwithwaypoint: def __init__(self): self.x = 0 self.y = 0 self.waypoint_x = 10 self.waypoint_y = 1 def run_command(self, command): if 'L' in command or 'R' in command: (self.waypoint_x, self.waypoint_y) = rotate_waypoint(self.waypoint_x, self.waypoint_y, command) elif 'F' in command: n = int(command[1:]) self.x += self.waypoint_x * n self.y += self.waypoint_y * n else: (self.waypoint_x, self.waypoint_y) = shift_coords(self.waypoint_x, self.waypoint_y, command) def manhattan_dist(self): return abs(self.x) + abs(self.y)
#------------------------------------------------------------------------------- # Name: module2 # Purpose: # # Author: user # # Created: 28/03/2019 # Copyright: (c) user 2019 # Licence: <your licence> #------------------------------------------------------------------------------- print("LISTS") print("Working with LISTS") print(''' lists=[], this is an epty list ''') list=["kevin", 5, 7.9, True] # list values are indexed friend=["kevin", "KAren", "Jim", "Toddy", "Frog"] # 0 1 2 3 4 print(''' list=["kevin", 5, 7.9, True] # list values are indexed friend=["kevin", "KAren", "Jim", "Toddy", "Frog"] # 0 1 2 3 4 ''') print(''' print(friend[0]) =''') print(friend[0]) print(''' print(friend[-1]) ''') print(friend[-1]) print(''' print(friend[-3]) ''') print(friend[-3]) print(''' print(friend[1:2]) ''') print(friend[1:2]) print(''' print(friend[1:3]) ''') print(friend[1:3]) print(''' print(friend[1:4]) =''') print(friend[1:4]) print(''' update or modify list values friend[0]= "000" print(friend[0]) =''') friend[0]= "000" print(friend[0]) print(''' update or modify list values friend[0:1]= ["000", "ttt"] print(friend[0:2]) =''') friend[0:1]= ["000", "ttt"] print(friend[0:2]) print(''' List Functions print(' List Functions ') ''') print(''' Items=["car", "chair", "table", "mat"] num=[8.8, 7.7,9.9,5.5,25,34,35,43,45,50,52,53,55,61,70,71,77,91,92,93,99,105,115, 122,125,133,151,155,160,170,171,177,181,192,205,250,322,331] numbers=[4,8,15,16,23,42] FRINDS=["kevin", "KAren", "Jim", "Toddy", "Frog", "Todd", "Jorge", "Lang"] # 0 1 2 3 4 5 7 8 ''') Items=["car", "chair", "table", "mat"] num=[8.8, 7.7,9.9,5.5,25,34,35,43,45,50,52,53,55,61,70,71,77,91,92,93,99,105,115, 122,125,133,151,155,160,170,171,177,181,192,205,250,322,331] numbers=[4,8,15,16,23,42] FRINDS=["kevin", "KAren", "Jim", "Toddy", "Frog", "Todd", "Jorge", "Lang"] # 0 1 2 3 4 5 7 8 print(''' FRINDS.extend(numbers) print(FRINDS) =''') FRINDS.extend(numbers) print(FRINDS) print(''' FRINDS.append(num) print(FRINDS) =''') FRINDS.append(num) print(FRINDS) print(''' FRINDS.extend(Items) FRINDS.extend("77777777777") print(FRINDS) =''') FRINDS.extend(Items) FRINDS.extend("77777777777") print(FRINDS) print(''' FRINDS.append(Items) FRINDS.append("55555555555") print(FRINDS) =''') FRINDS.append(Items) FRINDS.append("55555555555") print(FRINDS) print(''' FRINDS.insert(1,"00000000000000") # index 1, replace with print(FRINDS) =''') FRINDS.insert(1,"00000000000000") # index 1, replace with this print(FRINDS) print(''' =''') print(''' FRINDS.insert(7,Items*3) print(FRINDS) =''') FRINDS.insert(7,Items*3) print(FRINDS) print(''' remove one item FRINDS.remove("00000000000000") print(FRINDS) =''') FRINDS.remove("00000000000000" ) print(FRINDS) print(''' clear or remove last element\item of the list FRINDS.pop() print(FRINDS) =''') FRINDS.pop() print(FRINDS) print(''' find element\item of the list FRINDS.index('Toddy') FRINDS.index("car") print(FRINDS.index("car")) =''') print(''' count number of a value print(FRINDS.count("car")) print(FRINDS.count("7")) =''') print(FRINDS.index("car")) print(FRINDS.index('Toddy')) print(FRINDS.count("car")) print(FRINDS.count("7")) print(''' clear all items FRINDS.clear() print(FRINDS) =''') FRINDS.clear() print(FRINDS) FRINDS=["You","HE", "he", "WE", "we","We", "wE"] math=[3, 33, 4.4, 9.0, 9, .1, 0.1, 0, 0.0, .0, .00, 00, 00.00, 00.000, 0000] print(''' sort/arrange all items alphabetically in assending order FRINDS=["You","HE", "he", "WE", "we","We", "wE"] math=[3, 33, 4.4, 9.0, 9, .1, 0.1, 0, 0.0, .0, .00, 00, 00.00, 00.000, 0000] FRINDS.sort() math.sort() print(FRINDS) print(math) =''') FRINDS.sort() math.sort() print(FRINDS) print(math) print(""" reverse the list items FRINDS.reverse() math.reverse() print(FRINDS) print(math) """) FRINDS.reverse() math.reverse() print(FRINDS) print(math) print(""" copy the list items to another list FRINDS3=math FRINDS2=math.copy() FRINDS3=math print(FRINDS2) print(FRINDS3) """) FRINDS3=math FRINDS2=math.copy() FRINDS3=math print(FRINDS2) print(FRINDS3) #------------------------------------------------------------------------------- # Name: Print Book pages module1 # Purpose: Get printed missing pages / numbers # # Author: user/shyed # # Created: 27/03/2019 # Copyright: (c) user 2019 # Licence: <your licence> #------------------------------------------------------------------------------- a=225 # start at 225 b=226 # start at 226 l=599 # stop at 599 list1=[] # initialize an empty list for i in range(a,l+1,4): list1.append(i) for j in range(b,l, 4): list1.append(j) list1.sort() print(list1) print(''' a=225 b=226 l=599 list1=[] for i in range(a,l+1,4): list1.append(i) for j in range(b,l, 4): list1.append(j) list1.sort() print(list1) ''') print(""" That code will result this list, [225, 226, 229, 230, 233, 234, 237, 238, 241, 242, 245, 246, 249, 250, 253, 254, 257, 258, 261, 262, 265, 266, 269, 270, 273, 274, 277, 278, 281, 282, 285, 286, 289, 290, 293, 294, 297, 298, 301, 302, 305, 306, 309, 310, 313, 314, 317, 318, 321, 322, 325, 326, 329, 330, 333, 334, 337, 338, 341, 342, 345, 346, 349, 350, 353, 354, 357, 358, 361, 362, 365, 366, 369, 370, 373, 374, 377, 378, 381, 382, 385, 386, 389, 390, 393, 394, 397, 398, 401, 402, 405, 406, 409, 410, 413, 414, 417, 418, 421, 422, 425, 426, 429, 430, 433, 434, 437, 438, 441, 442, 445, 446, 449, 450, 453, 454, 457, 458, 461, 462, 465, 466, 469, 470, 473, 474, 477, 478, 481, 482, 485, 486, 489, 490, 493, 494, 497, 498, 501, 502, 505, 506, 509, 510, 513, 514, 517, 518, 521, 522, 525, 526, 529, 530, 533, 534, 537, 538, 541, 542, 545, 546, 549, 550, 553, 554, 557, 558, 561, 562, 565, 566, 569, 570, 573, 574, 577, 578, 581, 582, 585, 586, 589, 590, 593, 594, 597, 598]""")
print('LISTS') print('Working with LISTS') print('\nlists=[], this is an epty list\n') list = ['kevin', 5, 7.9, True] friend = ['kevin', 'KAren', 'Jim', 'Toddy', 'Frog'] print('\nlist=["kevin", 5, 7.9, True]\n# list values are indexed\n\nfriend=["kevin", "KAren", "Jim", "Toddy", "Frog"]\n# 0 1 2 3 4\n\n') print(' print(friend[0])\n\n=') print(friend[0]) print('\nprint(friend[-1])\n') print(friend[-1]) print('\nprint(friend[-3])\n') print(friend[-3]) print('\nprint(friend[1:2])\n') print(friend[1:2]) print('\nprint(friend[1:3])\n') print(friend[1:3]) print('\nprint(friend[1:4])\n=') print(friend[1:4]) print('\nupdate or modify list values\nfriend[0]= "000"\nprint(friend[0])\n=') friend[0] = '000' print(friend[0]) print(' update or modify list values\nfriend[0:1]= ["000", "ttt"]\nprint(friend[0:2])\n=') friend[0:1] = ['000', 'ttt'] print(friend[0:2]) print("\nList Functions\nprint('\nList Functions\n')\n") print('\nItems=["car", "chair", "table", "mat"]\nnum=[8.8, 7.7,9.9,5.5,25,34,35,43,45,50,52,53,55,61,70,71,77,91,92,93,99,105,115,\n122,125,133,151,155,160,170,171,177,181,192,205,250,322,331]\nnumbers=[4,8,15,16,23,42]\nFRINDS=["kevin", "KAren", "Jim", "Toddy", "Frog", "Todd", "Jorge", "Lang"]\n# 0 1 2 3 4 5 7 8\n') items = ['car', 'chair', 'table', 'mat'] num = [8.8, 7.7, 9.9, 5.5, 25, 34, 35, 43, 45, 50, 52, 53, 55, 61, 70, 71, 77, 91, 92, 93, 99, 105, 115, 122, 125, 133, 151, 155, 160, 170, 171, 177, 181, 192, 205, 250, 322, 331] numbers = [4, 8, 15, 16, 23, 42] frinds = ['kevin', 'KAren', 'Jim', 'Toddy', 'Frog', 'Todd', 'Jorge', 'Lang'] print('\nFRINDS.extend(numbers)\nprint(FRINDS)\n=') FRINDS.extend(numbers) print(FRINDS) print('\nFRINDS.append(num)\nprint(FRINDS)\n=') FRINDS.append(num) print(FRINDS) print('\nFRINDS.extend(Items)\nFRINDS.extend("77777777777")\nprint(FRINDS)\n=') FRINDS.extend(Items) FRINDS.extend('77777777777') print(FRINDS) print('\nFRINDS.append(Items)\nFRINDS.append("55555555555")\nprint(FRINDS)\n=') FRINDS.append(Items) FRINDS.append('55555555555') print(FRINDS) print('\nFRINDS.insert(1,"00000000000000")\n# index 1, replace with\nprint(FRINDS)\n=') FRINDS.insert(1, '00000000000000') print(FRINDS) print('\n\n=') print('\nFRINDS.insert(7,Items*3)\nprint(FRINDS)\n=') FRINDS.insert(7, Items * 3) print(FRINDS) print(' remove one item\nFRINDS.remove("00000000000000")\nprint(FRINDS)\n=') FRINDS.remove('00000000000000') print(FRINDS) print(' clear or remove last element\\item of the list\nFRINDS.pop()\nprint(FRINDS)\n=') FRINDS.pop() print(FRINDS) print(' find element\\item of the list\nFRINDS.index(\'Toddy\')\nFRINDS.index("car")\nprint(FRINDS.index("car"))\n=') print(' count number of a value\nprint(FRINDS.count("car"))\nprint(FRINDS.count("7"))\n=') print(FRINDS.index('car')) print(FRINDS.index('Toddy')) print(FRINDS.count('car')) print(FRINDS.count('7')) print(' clear all items\nFRINDS.clear()\nprint(FRINDS)\n=') FRINDS.clear() print(FRINDS) frinds = ['You', 'HE', 'he', 'WE', 'we', 'We', 'wE'] math = [3, 33, 4.4, 9.0, 9, 0.1, 0.1, 0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0] print(' sort/arrange all items alphabetically in assending order\nFRINDS=["You","HE", "he", "WE", "we","We", "wE"]\nmath=[3, 33, 4.4, 9.0, 9, .1, 0.1, 0, 0.0, .0, .00, 00, 00.00, 00.000, 0000]\nFRINDS.sort()\nmath.sort()\nprint(FRINDS)\nprint(math)\n=') FRINDS.sort() math.sort() print(FRINDS) print(math) print(' reverse the list items\nFRINDS.reverse()\nmath.reverse()\nprint(FRINDS)\nprint(math)\n') FRINDS.reverse() math.reverse() print(FRINDS) print(math) print(' copy the list items to another list\nFRINDS3=math\nFRINDS2=math.copy()\nFRINDS3=math\nprint(FRINDS2)\nprint(FRINDS3)\n') frinds3 = math frinds2 = math.copy() frinds3 = math print(FRINDS2) print(FRINDS3) a = 225 b = 226 l = 599 list1 = [] for i in range(a, l + 1, 4): list1.append(i) for j in range(b, l, 4): list1.append(j) list1.sort() print(list1) print('\na=225\nb=226\nl=599\nlist1=[]\nfor i in range(a,l+1,4): list1.append(i)\nfor j in range(b,l, 4): list1.append(j)\nlist1.sort()\nprint(list1)\n') print(' That code will result this list,\n[225, 226, 229, 230, 233, 234, 237, 238, 241, 242, 245, 246,\n 249, 250, 253, 254, 257, 258, 261, 262, 265, 266, 269, 270, 273, 274,\n 277, 278, 281, 282, 285, 286, 289, 290, 293, 294, 297, 298, 301, 302,\n 305, 306, 309, 310, 313, 314, 317, 318, 321, 322, 325, 326, 329,\n 330, 333, 334, 337, 338, 341, 342, 345, 346, 349, 350, 353, 354,\n 357, 358, 361, 362, 365, 366, 369, 370, 373, 374, 377, 378, 381,\n382, 385, 386, 389, 390, 393, 394, 397, 398, 401, 402, 405, 406,\n 409, 410, 413, 414, 417, 418, 421, 422, 425, 426, 429, 430, 433,\n 434, 437, 438, 441, 442, 445, 446, 449, 450, 453, 454, 457, 458,\n 461, 462, 465, 466, 469, 470, 473, 474, 477, 478, 481, 482, 485,\n 486, 489, 490, 493, 494, 497, 498, 501, 502, 505, 506, 509, 510,\n 513, 514, 517, 518, 521, 522, 525, 526, 529, 530, 533, 534,\n 537, 538, 541, 542, 545, 546, 549, 550, 553, 554, 557, 558,\n 561, 562, 565, 566, 569, 570, 573, 574, 577, 578, 581, 582,\n585, 586, 589, 590, 593, 594, 597, 598]')
# https://codeforces.com/problemsets/acmsguru/problem/99999/100 A, B = map(int, input().split()) print(A+B)
(a, b) = map(int, input().split()) print(A + B)
""" Check if items are in list """ def has_invalid_fields(fields): for field in fields: if field not in ['foo', 'bar']: return True return False def has_invalid_fields2(fields): return bool(set(fields) - set(['foo', 'bar'])) """ set eliminates duplicates """ """ Code is valid but it will a variation of the example many times """ def add_animal_in_family(species, animal, family): if family not in species: species[family] = set() species[family].add(animal) species = {} add_animal_in_family(species, 'cat', 'felidea') # import collections def add_animal_in_family2(species, animal, family): species[family].add(animal) species = collections.defaultdict(set) add_animal_in_family2(species, 'cat', 'felidea') """ Each time you try try to access a nonexistent item from your dict the defaultdict will use the function that was passed as argument to its constructor to build a new value instead of raising a KeyError. In this case the set() function is used to build a new set each time we need it. """ # Ordered list and bisect """ Sorted lists use a bisecting algorithm for lookup to achieve a retrieve time of O(logn). The idea is to split the list in half and look on which side, left or right, the item must appear in and so which side should be searched next. We need to import bisect """ farm = sorted(['haystack', 'needle', 'cow', 'pig']) bisect.bisect(farm, 'needle') """ bisect.bisect() returns the position where an element should be inserted to keep the list sorted. Only works if the list is properly sorted to begin with. Using bisect module you could also create a special SortedList class inheriting from list to create a list that is always sorted,""" class SortedList(list): def __init__(self, iterable): super(SortedList, self).__init__(sorted(iterable)) def insort(self, item): bisect.insort(self, item) def extend(self, other): for item in other: self.insort(item) @staticmethod def append(o): raise RuntimeError("Cannot append to a sorted list") def index(self, value, start=None, stop=None): place = bisect.bisect_left(self[start:stop], value) if start: place += start end = stop or len(self) if place < end and self[place] == value: return place raise ValueError(f'{value} is not in list') """ In python regular objects store all of their attributes inside a dictionary and this dictionary is itself store in the __dict__ attribute """ class Point(object): def __init__(self, x, y): self.x = x self.y = y p = Point(1, 2) p.__dict__ """ {'y': 2, 'x': 1} Instead we can use __slots__ that will turn this dictionary into list, the idea is that dictionaries are expensive for memory but lists are less, only works for classes that inherit from object, or when we have large number of simple objects """ class Foobar(object): __slots__ = ('x',) def __init__(self, x): self.x = x """ However this limits us to them being immutable. Rather than having to reference them by index, namedtuple provides the ability to retrieve tuple elements by referencing a named attribute. import collections Foobar = collections.namedtuple('Foodbar', [x]) Foobar(42) Foobar(42).x 42 Its a little bit less efficient than __slots__ but gives the ability to inde by name """ # Memoization """ Its an optimization technique used to speed up function calls by caching their results. The results of a function can be cached only if the function is pure. functools module provides a least recently used LRU cache decorator. This provides the same functionality as memoization but with the benefit that it limits the number of entries in the cache removing the least recently used one when the cache reaches its maximum size. Also provides statistics.>>> import functools >>> import math >>> @functools.lru_cache(maxsize=2) ... def memoized_sin(x): ... return math.sin(x) ... >>> memoized_sin(2) 0.9092974268256817 >>> memoized_sin.cache_info() CacheInfo(hits=0, misses=1, maxsize=2, currsize=1) >>> memoized_sin(2) 0.9092974268256817 >>> memoized_sin.cache_info() CacheInfo(hits=1, misses=1, maxsize=2, currsize=1) >>> memoized_sin(3) 0.1411200080598672 >>> memoized_sin.cache_info() CacheInfo(hits=1, misses=2, maxsize=2, currsize=2) >>> memoized_sin(4) -0.7568024953079282 >>> memoized_sin.cache_info() """
""" Check if items are in list """ def has_invalid_fields(fields): for field in fields: if field not in ['foo', 'bar']: return True return False def has_invalid_fields2(fields): return bool(set(fields) - set(['foo', 'bar'])) ' set eliminates duplicates ' ' Code is valid but it will a variation of the example\nmany times ' def add_animal_in_family(species, animal, family): if family not in species: species[family] = set() species[family].add(animal) species = {} add_animal_in_family(species, 'cat', 'felidea') def add_animal_in_family2(species, animal, family): species[family].add(animal) species = collections.defaultdict(set) add_animal_in_family2(species, 'cat', 'felidea') ' Each time you try try to access a nonexistent item from \nyour dict the defaultdict will use the function that was \npassed as argument to its constructor to build a new \nvalue instead of raising a KeyError. In this case the\nset() function is used to build a new set each time we\nneed it.\n' ' Sorted lists use a bisecting algorithm for lookup \nto achieve a retrieve time of O(logn). The idea is to split\nthe list in half and look on which side, left or right, the \nitem must appear in and so which side should be searched next.\nWe need to import bisect\n' farm = sorted(['haystack', 'needle', 'cow', 'pig']) bisect.bisect(farm, 'needle') ' bisect.bisect() returns the position where an element\nshould be inserted to keep the list sorted. Only works if\nthe list is properly sorted to begin with.\nUsing bisect module you could also create a special SortedList\nclass inheriting from list to create a list that is always \nsorted,' class Sortedlist(list): def __init__(self, iterable): super(SortedList, self).__init__(sorted(iterable)) def insort(self, item): bisect.insort(self, item) def extend(self, other): for item in other: self.insort(item) @staticmethod def append(o): raise runtime_error('Cannot append to a sorted list') def index(self, value, start=None, stop=None): place = bisect.bisect_left(self[start:stop], value) if start: place += start end = stop or len(self) if place < end and self[place] == value: return place raise value_error(f'{value} is not in list') ' In python regular objects store all of their attributes inside\na dictionary and this dictionary is itself store in the __dict__\nattribute ' class Point(object): def __init__(self, x, y): self.x = x self.y = y p = point(1, 2) p.__dict__ " {'y': 2, 'x': 1} \nInstead we can use __slots__ that will turn this dictionary into\nlist, the idea is that dictionaries are expensive for memory but\nlists are less, only works for classes that inherit from object, \nor when we have large number of simple objects\n" class Foobar(object): __slots__ = ('x',) def __init__(self, x): self.x = x " However this limits us to them being immutable. Rather than \nhaving to reference them by index, namedtuple provides the ability to\nretrieve tuple elements by referencing a named attribute.\n\nimport collections \nFoobar = collections.namedtuple('Foodbar', [x])\nFoobar(42)\n\nFoobar(42).x\n42\n\n\nIts a little bit less efficient than __slots__ but gives\nthe ability to inde by name\n" ' Its an optimization technique used to speed up function \ncalls by caching their results. The results of a function \ncan be cached only if the function is pure. \nfunctools module provides a least recently used LRU cache\ndecorator. This provides the same functionality as memoization\nbut with the benefit that it limits the number of entries in the cache\nremoving the least recently used one when the cache reaches its \nmaximum size. Also provides statistics.>>> import functools\n>>> import math\n>>> @functools.lru_cache(maxsize=2)\n... def memoized_sin(x):\n... return math.sin(x)\n...\n>>> memoized_sin(2)\n0.9092974268256817\n>>> memoized_sin.cache_info()\nCacheInfo(hits=0, misses=1, maxsize=2, currsize=1)\n>>> memoized_sin(2)\n0.9092974268256817\n>>> memoized_sin.cache_info()\nCacheInfo(hits=1, misses=1, maxsize=2, currsize=1)\n>>> memoized_sin(3)\n0.1411200080598672\n>>> memoized_sin.cache_info()\nCacheInfo(hits=1, misses=2, maxsize=2, currsize=2)\n>>> memoized_sin(4)\n-0.7568024953079282\n>>> memoized_sin.cache_info()\n\n'
# Hand decompiled day 19 part 2 a,b,c,d,e,f = 1,0,0,0,0,0 c += 2 c *= c c *= 209 b += 2 b *= 22 b += 7 c += b if a == 1: b = 27 b *= 28 b += 29 b *= 30 b *= 14 b *= 32 c += b a = 0 for d in range(1, c+1): if c % d == 0: a += d print(a)
(a, b, c, d, e, f) = (1, 0, 0, 0, 0, 0) c += 2 c *= c c *= 209 b += 2 b *= 22 b += 7 c += b if a == 1: b = 27 b *= 28 b += 29 b *= 30 b *= 14 b *= 32 c += b a = 0 for d in range(1, c + 1): if c % d == 0: a += d print(a)
class test_result(): """Log the performance on the test set""" def __init__(self, autonet, X_test, Y_test): self.autonet = autonet self.X_test = X_test self.Y_test = Y_test def __call__(self, model, epochs): if self.Y_test is None or self.X_test is None: return float("nan") return self.autonet.score(self.X_test, self.Y_test) class gradient_norm(): """Log the norm of the gradients""" def __init_(self): pass def __call__(self, network, epoch): total_gradient = 0 n_params = 0 for p in list(filter(lambda p: p.grad is not None, network.parameters())): total_gradient += p.grad.data.norm(2).item() n_params += 1 # Prevent division through 0 if total_gradient==0: n_params = 1 return total_gradient/n_params
class Test_Result: """Log the performance on the test set""" def __init__(self, autonet, X_test, Y_test): self.autonet = autonet self.X_test = X_test self.Y_test = Y_test def __call__(self, model, epochs): if self.Y_test is None or self.X_test is None: return float('nan') return self.autonet.score(self.X_test, self.Y_test) class Gradient_Norm: """Log the norm of the gradients""" def __init_(self): pass def __call__(self, network, epoch): total_gradient = 0 n_params = 0 for p in list(filter(lambda p: p.grad is not None, network.parameters())): total_gradient += p.grad.data.norm(2).item() n_params += 1 if total_gradient == 0: n_params = 1 return total_gradient / n_params
'''Crow/AAP Alarm IP Module Feedback Class for alarm state''' class StatusState: # Zone State @staticmethod def get_initial_zone_state(maxZones): """Builds the proper zone state collection.""" _zoneState = {} for i in range (1, maxZones+1): _zoneState[i] = {'status': {'open': False, 'bypass': False, 'alarm': False, 'tamper': False}, 'last_fault': 0} return _zoneState # Area State @staticmethod def get_initial_area_state(maxAreas): """Builds the proper alarm state collection.""" _areaState = {} for i in range(1, maxAreas+1): _areaState[i] = {'status': {'alarm': False, 'armed': False, 'stay_armed': False, 'disarmed': False,'exit_delay': False, 'stay_exit_delay': False, 'alarm_zone': '', 'last_disarmed_by_user': '', 'last_armed_by_user': '' }} return _areaState # Output State @staticmethod def get_initial_output_state(maxOutputs): _outputState = {} for i in range (1, maxOutputs+1): _outputState[i] = {'status': {'open': False}} return _outputState # System Status State @staticmethod def get_initial_system_state(): _systemState = {'status':{'mains': True, 'battery': True,'tamper': False, 'line': True, 'dialler': True,'ready': True, 'fuse': True, 'zonebattery': True, 'pendantbattery': True, 'codetamper': False}} return _systemState
"""Crow/AAP Alarm IP Module Feedback Class for alarm state""" class Statusstate: @staticmethod def get_initial_zone_state(maxZones): """Builds the proper zone state collection.""" _zone_state = {} for i in range(1, maxZones + 1): _zoneState[i] = {'status': {'open': False, 'bypass': False, 'alarm': False, 'tamper': False}, 'last_fault': 0} return _zoneState @staticmethod def get_initial_area_state(maxAreas): """Builds the proper alarm state collection.""" _area_state = {} for i in range(1, maxAreas + 1): _areaState[i] = {'status': {'alarm': False, 'armed': False, 'stay_armed': False, 'disarmed': False, 'exit_delay': False, 'stay_exit_delay': False, 'alarm_zone': '', 'last_disarmed_by_user': '', 'last_armed_by_user': ''}} return _areaState @staticmethod def get_initial_output_state(maxOutputs): _output_state = {} for i in range(1, maxOutputs + 1): _outputState[i] = {'status': {'open': False}} return _outputState @staticmethod def get_initial_system_state(): _system_state = {'status': {'mains': True, 'battery': True, 'tamper': False, 'line': True, 'dialler': True, 'ready': True, 'fuse': True, 'zonebattery': True, 'pendantbattery': True, 'codetamper': False}} return _systemState
def go(o, a, b): if o == '+': return a + b return a * b def main(): a, o, b = int(input()), input(), int(input()) return go(o, a, b) if __name__ == '__main__': print(main())
def go(o, a, b): if o == '+': return a + b return a * b def main(): (a, o, b) = (int(input()), input(), int(input())) return go(o, a, b) if __name__ == '__main__': print(main())
"""Migration for a given Submitty course database.""" def up(config, database, semester, course): if not database.table_has_column('teams', 'last_viewed_time'): database.execute('ALTER TABLE teams ADD COLUMN last_viewed_time timestamp with time zone') def down(config, database, semester, course): pass
"""Migration for a given Submitty course database.""" def up(config, database, semester, course): if not database.table_has_column('teams', 'last_viewed_time'): database.execute('ALTER TABLE teams ADD COLUMN last_viewed_time timestamp with time zone') def down(config, database, semester, course): pass
def cube(a): """Cube the number a. Args: a (float): The number to be squared. """ return a**3
def cube(a): """Cube the number a. Args: a (float): The number to be squared. """ return a ** 3
# # This file contains the Python code from Program 14.14 of # "Data Structures and Algorithms # with Object-Oriented Design Patterns in Python" # by Bruno R. Preiss. # # Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved. # # http://www.brpreiss.com/books/opus7/programs/pgm14_14.txt # class SimpleRV(RandomVariable): def getNext(self): return RandomNumberGenerator.next
class Simplerv(RandomVariable): def get_next(self): return RandomNumberGenerator.next
def test_list(client, seeder, utils): user_id, admin_unit_id = seeder.setup_base() seeder.create_event(admin_unit_id) url = utils.get_url("planing") utils.get_ok(url) url = utils.get_url("planing", keyword="name") utils.get_ok(url)
def test_list(client, seeder, utils): (user_id, admin_unit_id) = seeder.setup_base() seeder.create_event(admin_unit_id) url = utils.get_url('planing') utils.get_ok(url) url = utils.get_url('planing', keyword='name') utils.get_ok(url)
class Solution: def to_hex(self, num: int) -> str: if num == 0: return "0" prefix, ans = "0123456789abcdef", "" num = 2 ** 32 + num if num < 0 else num while num: item = num & 15 # num % 16 ans = prefix[item] + ans num >>= 4 # num //= 4 return ans
class Solution: def to_hex(self, num: int) -> str: if num == 0: return '0' (prefix, ans) = ('0123456789abcdef', '') num = 2 ** 32 + num if num < 0 else num while num: item = num & 15 ans = prefix[item] + ans num >>= 4 return ans
classifiers = """ License :: OSI Approved :: BSD License Operating System :: POSIX Intended Audience :: Developers Intended Audience :: Science/Research Programming Language :: C Programming Language :: C++ Programming Language :: Cython Programming Language :: Python Programming Language :: Python :: 2 Programming Language :: Python :: 3 Topic :: Scientific/Engineering Topic :: Software Development :: Libraries :: Python Modules """ keywords = """ scientific computing parallel computing """ metadata = { 'author' : 'Lisandro Dalcin', 'author_email' : 'dalcinl@gmail.com', 'classifiers' : [c for c in classifiers.split('\n') if c], 'keywords' : [k for k in keywords.split('\n') if k], 'license' : 'BSD', 'platforms' : ['POSIX'], 'maintainer' : 'Lisandro Dalcin', 'maintainer_email' : 'dalcinl@gmail.com', }
classifiers = '\nLicense :: OSI Approved :: BSD License\nOperating System :: POSIX\nIntended Audience :: Developers\nIntended Audience :: Science/Research\nProgramming Language :: C\nProgramming Language :: C++\nProgramming Language :: Cython\nProgramming Language :: Python\nProgramming Language :: Python :: 2\nProgramming Language :: Python :: 3\nTopic :: Scientific/Engineering\nTopic :: Software Development :: Libraries :: Python Modules\n' keywords = '\nscientific computing\nparallel computing\n' metadata = {'author': 'Lisandro Dalcin', 'author_email': 'dalcinl@gmail.com', 'classifiers': [c for c in classifiers.split('\n') if c], 'keywords': [k for k in keywords.split('\n') if k], 'license': 'BSD', 'platforms': ['POSIX'], 'maintainer': 'Lisandro Dalcin', 'maintainer_email': 'dalcinl@gmail.com'}
def partTwo(instr: str) -> int: # This is the parsing section service_list = instr.strip().split("\n")[-1].split(",") eqns = [] for i, svc in enumerate(service_list): if svc == "x": continue svc = int(svc) v = 0 if i != 0: v = svc - i # This is the only maths stuff in the parsing eqns.append((v, svc)) # This is the maths section n = 1 for (_, v) in eqns: n *= v sigma_x = 0 for (bi, ni) in eqns: # this type cast could potentially cause a problem. # int required for pow function and the division *should* produce a whole number anyway Ni = int(n / ni) yi = pow(Ni, -1, ni) # https://stackoverflow.com/a/9758173 sigma_x += bi * Ni * yi return sigma_x % n
def part_two(instr: str) -> int: service_list = instr.strip().split('\n')[-1].split(',') eqns = [] for (i, svc) in enumerate(service_list): if svc == 'x': continue svc = int(svc) v = 0 if i != 0: v = svc - i eqns.append((v, svc)) n = 1 for (_, v) in eqns: n *= v sigma_x = 0 for (bi, ni) in eqns: ni = int(n / ni) yi = pow(Ni, -1, ni) sigma_x += bi * Ni * yi return sigma_x % n
''' Motion Event Provider ===================== Abstract class for the implemention of a :class:`~kivy.input.motionevent.MotionEvent` provider. The implementation must support the :meth:`~MotionEventProvider.start`, :meth:`~MotionEventProvider.stop` and :meth:`~MotionEventProvider.update` methods. ''' __all__ = ('MotionEventProvider', ) class MotionEventProvider(object): '''Base class for a provider. ''' def __init__(self, device, args): self.device = device if self.__class__ == MotionEventProvider: raise NotImplementedError('class MotionEventProvider is abstract') def start(self): '''Start the provider. This method is automatically called when the application is started and if the configuration uses the current provider. ''' pass def stop(self): '''Stop the provider. ''' pass def update(self, dispatch_fn): '''Update the provider and dispatch all the new touch events though the `dispatch_fn` argument. ''' pass
""" Motion Event Provider ===================== Abstract class for the implemention of a :class:`~kivy.input.motionevent.MotionEvent` provider. The implementation must support the :meth:`~MotionEventProvider.start`, :meth:`~MotionEventProvider.stop` and :meth:`~MotionEventProvider.update` methods. """ __all__ = ('MotionEventProvider',) class Motioneventprovider(object): """Base class for a provider. """ def __init__(self, device, args): self.device = device if self.__class__ == MotionEventProvider: raise not_implemented_error('class MotionEventProvider is abstract') def start(self): """Start the provider. This method is automatically called when the application is started and if the configuration uses the current provider. """ pass def stop(self): """Stop the provider. """ pass def update(self, dispatch_fn): """Update the provider and dispatch all the new touch events though the `dispatch_fn` argument. """ pass
class Model(object): def __init__(self, xml): self.raw_data = xml def __str__(self): return self.raw_data.toprettyxml( ) def _get_attribute(self, attr): val = self.raw_data.getAttribute(attr) if val == '': return None return val def _get_element(self, name): nodes = self.raw_data.getElementsByTagName(name) if len(nodes) == 0: return None if len(nodes) > 1: raise AttributeError("Too many elements with name %s" % name) return nodes[0] def _get_childNodes(self, name): return self._get_element(name).childNodes if self._get_element(name) else [] def _get_nodeValue(self, node): if isinstance(node, str): nodes = self._get_childNodes(node) elif hasattr(node, 'childNodes'): nodes = node.childNodes else: return None if len(nodes) == 0: return None if len(nodes) > 1: raise AttributeError("Unable to parse value from node with name %s" % name) return nodes[0].nodeValue class Book(Model): @property def book_id(self): return self._get_attribute('book_id') @property def isbn(self): return self._get_attribute('isbn') @property def isbn13(self): return self._get_attribute('isbn13') @property def title(self): return self._get_nodeValue('Title') @property def title_long(self): return self._get_nodeValue('TitleLong') @property def authors_text(self): return self._get_nodeValue('AuthorsText') @property def authors(self): for node in self._get_childNodes('Authors'): if node.nodeType == node.ELEMENT_NODE: aid = node.getAttribute('person_id') name = self._get_nodeValue(node) yield { 'person_id': aid, 'person_text': name, } @property def publisher_id(self): pelem = self._get_element('PublisherText') if pelem is not None: val = pelem.getAttribute('publisher_id') if val != '': return val return None @property def publisher_text(self): return self._get_nodeValue('PublisherText') @property def details(self): delem = self._get_element('Details') if delem is not None: return dict(delem.attributes.items()) return None @property def summary(self): return self._get_nodeValue('Summary') @property def notes(self): return self._get_nodeValue('Notes') @property def urls_text(self): return self._get_nodeValue('UrlsText') @property def awards_text(self): return self._get_nodeValue('AwardsText') @property def prices(self): for node in self._get_childNodes('Prices'): if node.nodeType == node.ELEMENT_NODE: yield dict(node.attributes.items()) @property def subjects(self): for node in self._get_childNodes('Subjects'): if node.nodeType == node.ELEMENT_NODE: sid = node.getAttribute('subject_id') text = self._get_nodeValue(node) yield { 'subject_id': sid, 'subject_text': text, } @property def marc_records(self): for node in self._get_childNodes('MARCRecords'): if node.nodeType == node.ELEMENT_NODE: yield dict(node.attributes.items()) class Subject(Model): @property def subject_id(self): return self._get_attribute('subject_id') @property def book_count(self): return self._get_attribute('book_count') @property def marc_field(self): return self._get_attribute('marc_field') @property def marc_indicators(self): return (self._get_attribute('marc_indicator_1'), self._get_attribute('marc_indicator_2')) @property def name(self): return self._get_nodeValue('Name') @property def categories(self): for node in self._get_childNodes('Categories'): if node.nodeType == node.ELEMENT_NODE: cid = node.getAttribute('category_id') text = self._get_nodeValue(node) yield { 'category_id': cid, 'category_text': text, } @property def structure(self): for node in self._get_childNodes('SubjectStructure'): if node.nodeType == node.ELEMENT_NODE: yield dict(node.attributes.items()) class Category(Model): @property def category_id(self): return self._get_attribute('category_id') @property def parent_id(self): return self._get_attribute('parent_id') @property def name(self): return self._get_nodeValue('Name') @property def details(self): delem = self._get_element('Details') if delem: return dict(delem.attributes.items()) return {} @property def subcategories(self): for node in self._get_childNodes('SubCategories'): if node.nodeType == node.ELEMENT_NODE: yield dict(node.attributes.items()) class Author(Model): @property def author_id(self): return self._get_attribute('person_id') @property def name(self): return self._get_nodeValue('Name') @property def details(self): delem = self._get_element('Details') if delem: return dict(delem.attributes.items()) return None @property def categories(self): for node in self._get_childNodes('Categories'): if node.nodeType == node.ELEMENT_NODE: cid = node.getAttribute('category_id') text = self._get_nodeValue(node) yield { 'category_id': cid, 'category_text': text, } @property def subjects(self): for node in self._get_childNodes('Subjects'): if node.nodeType == node.ELEMENT_NODE: sid = node.getAttribute('subject_id') count = node.getAttribute('book_count') text = self._get_nodeValue(node) yield { 'subject_id': sid, 'book_count': count, 'subject_text': text, } class Publisher(Model): @property def publisher_id(self): return self._get_attribute('publisher_id') @property def name(self): return self._get_nodeValue('Name') @property def details(self): delem = self._get_element('Details') if delem: return dict(delem.attributes.items()) return None @property def categories(self): for node in self._get_childNodes('Categories'): if node.nodeType == node.ELEMENT_NODE: cid = node.getAttribute('category_id') text = self._get_nodeValue(node) yield { 'category_id': cid, 'category_text': text, }
class Model(object): def __init__(self, xml): self.raw_data = xml def __str__(self): return self.raw_data.toprettyxml() def _get_attribute(self, attr): val = self.raw_data.getAttribute(attr) if val == '': return None return val def _get_element(self, name): nodes = self.raw_data.getElementsByTagName(name) if len(nodes) == 0: return None if len(nodes) > 1: raise attribute_error('Too many elements with name %s' % name) return nodes[0] def _get_child_nodes(self, name): return self._get_element(name).childNodes if self._get_element(name) else [] def _get_node_value(self, node): if isinstance(node, str): nodes = self._get_childNodes(node) elif hasattr(node, 'childNodes'): nodes = node.childNodes else: return None if len(nodes) == 0: return None if len(nodes) > 1: raise attribute_error('Unable to parse value from node with name %s' % name) return nodes[0].nodeValue class Book(Model): @property def book_id(self): return self._get_attribute('book_id') @property def isbn(self): return self._get_attribute('isbn') @property def isbn13(self): return self._get_attribute('isbn13') @property def title(self): return self._get_nodeValue('Title') @property def title_long(self): return self._get_nodeValue('TitleLong') @property def authors_text(self): return self._get_nodeValue('AuthorsText') @property def authors(self): for node in self._get_childNodes('Authors'): if node.nodeType == node.ELEMENT_NODE: aid = node.getAttribute('person_id') name = self._get_nodeValue(node) yield {'person_id': aid, 'person_text': name} @property def publisher_id(self): pelem = self._get_element('PublisherText') if pelem is not None: val = pelem.getAttribute('publisher_id') if val != '': return val return None @property def publisher_text(self): return self._get_nodeValue('PublisherText') @property def details(self): delem = self._get_element('Details') if delem is not None: return dict(delem.attributes.items()) return None @property def summary(self): return self._get_nodeValue('Summary') @property def notes(self): return self._get_nodeValue('Notes') @property def urls_text(self): return self._get_nodeValue('UrlsText') @property def awards_text(self): return self._get_nodeValue('AwardsText') @property def prices(self): for node in self._get_childNodes('Prices'): if node.nodeType == node.ELEMENT_NODE: yield dict(node.attributes.items()) @property def subjects(self): for node in self._get_childNodes('Subjects'): if node.nodeType == node.ELEMENT_NODE: sid = node.getAttribute('subject_id') text = self._get_nodeValue(node) yield {'subject_id': sid, 'subject_text': text} @property def marc_records(self): for node in self._get_childNodes('MARCRecords'): if node.nodeType == node.ELEMENT_NODE: yield dict(node.attributes.items()) class Subject(Model): @property def subject_id(self): return self._get_attribute('subject_id') @property def book_count(self): return self._get_attribute('book_count') @property def marc_field(self): return self._get_attribute('marc_field') @property def marc_indicators(self): return (self._get_attribute('marc_indicator_1'), self._get_attribute('marc_indicator_2')) @property def name(self): return self._get_nodeValue('Name') @property def categories(self): for node in self._get_childNodes('Categories'): if node.nodeType == node.ELEMENT_NODE: cid = node.getAttribute('category_id') text = self._get_nodeValue(node) yield {'category_id': cid, 'category_text': text} @property def structure(self): for node in self._get_childNodes('SubjectStructure'): if node.nodeType == node.ELEMENT_NODE: yield dict(node.attributes.items()) class Category(Model): @property def category_id(self): return self._get_attribute('category_id') @property def parent_id(self): return self._get_attribute('parent_id') @property def name(self): return self._get_nodeValue('Name') @property def details(self): delem = self._get_element('Details') if delem: return dict(delem.attributes.items()) return {} @property def subcategories(self): for node in self._get_childNodes('SubCategories'): if node.nodeType == node.ELEMENT_NODE: yield dict(node.attributes.items()) class Author(Model): @property def author_id(self): return self._get_attribute('person_id') @property def name(self): return self._get_nodeValue('Name') @property def details(self): delem = self._get_element('Details') if delem: return dict(delem.attributes.items()) return None @property def categories(self): for node in self._get_childNodes('Categories'): if node.nodeType == node.ELEMENT_NODE: cid = node.getAttribute('category_id') text = self._get_nodeValue(node) yield {'category_id': cid, 'category_text': text} @property def subjects(self): for node in self._get_childNodes('Subjects'): if node.nodeType == node.ELEMENT_NODE: sid = node.getAttribute('subject_id') count = node.getAttribute('book_count') text = self._get_nodeValue(node) yield {'subject_id': sid, 'book_count': count, 'subject_text': text} class Publisher(Model): @property def publisher_id(self): return self._get_attribute('publisher_id') @property def name(self): return self._get_nodeValue('Name') @property def details(self): delem = self._get_element('Details') if delem: return dict(delem.attributes.items()) return None @property def categories(self): for node in self._get_childNodes('Categories'): if node.nodeType == node.ELEMENT_NODE: cid = node.getAttribute('category_id') text = self._get_nodeValue(node) yield {'category_id': cid, 'category_text': text}
# cook your dish here a=int(input()) b=int(input()) while(1): if a%b==0: print(a) break else: a-=1
a = int(input()) b = int(input()) while 1: if a % b == 0: print(a) break else: a -= 1
""" 1. **kwargs usage """ def test(**kwargs): # Do not use **kwargs # Print key serials print(*kwargs) _dict = kwargs for k in _dict.keys(): print("Key=", k) print("Value=", _dict[k]) print() test(a=1, b=2, c=3) """ 1. * -> unpack container type """ list1 = [1, 2, 3] tuple1 = (3, 4, 5) set1 = {5, 6, 7} dict1= {"aa": 123, "bb": 456, "cc": 789} str1 = "itcast" print(*list1) def test2(): return 3, 4, 5 # uppack container a, b, c = test2()
""" 1. **kwargs usage """ def test(**kwargs): print(*kwargs) _dict = kwargs for k in _dict.keys(): print('Key=', k) print('Value=', _dict[k]) print() test(a=1, b=2, c=3) '\n 1. * -> unpack container type\n' list1 = [1, 2, 3] tuple1 = (3, 4, 5) set1 = {5, 6, 7} dict1 = {'aa': 123, 'bb': 456, 'cc': 789} str1 = 'itcast' print(*list1) def test2(): return (3, 4, 5) (a, b, c) = test2()
# -*- coding: utf-8 -*- AUCTIONS = { 'simple': 'openprocurement.auction.esco.auctions.simple', 'multilot': 'openprocurement.auction.esco.auctions.multilot', }
auctions = {'simple': 'openprocurement.auction.esco.auctions.simple', 'multilot': 'openprocurement.auction.esco.auctions.multilot'}
# python3 def max_pairwise_product(numbers): x = sorted(numbers) n = len(numbers) return x[n-1] * x[n-2] if __name__ == '__main__': input_n = int(input()) input_numbers = [int(x) for x in input().split()] print(max_pairwise_product(input_numbers))
def max_pairwise_product(numbers): x = sorted(numbers) n = len(numbers) return x[n - 1] * x[n - 2] if __name__ == '__main__': input_n = int(input()) input_numbers = [int(x) for x in input().split()] print(max_pairwise_product(input_numbers))
#!/usr/bin/env python3 """ Custom errors for Seisflows """ class ParameterError(ValueError): """ A new ValueError class which explains the Parameter's that threw the error """ def __init__(self, *args): if len(args) == 0: msg = "Bad parameter." super(ParameterError, self).__init__(msg) elif len(args) == 1: msg = f"Bad parameter: {args[0]}" super(ParameterError, self).__init__(msg) elif args[1] not in args[0]: msg = f"{args[1]} is not defined." super(ParameterError, self).__init__(msg) elif key in obj: msg = f"{args[0]} has bad value: {args[1].__getattr__(args[0])}" super(ParameterError, self).__init__(msg) class CheckError(ValueError): """ An error called by the Check functions within each module, that returns the name of the class that raised the error, as well as the parameter in question. """ def __init__(self, cls, par): """ CheckError simply returns a print message """ msg = f"{cls.__class__.__name__} requires parameter {par}" super(CheckError, self).__init__(msg)
""" Custom errors for Seisflows """ class Parametererror(ValueError): """ A new ValueError class which explains the Parameter's that threw the error """ def __init__(self, *args): if len(args) == 0: msg = 'Bad parameter.' super(ParameterError, self).__init__(msg) elif len(args) == 1: msg = f'Bad parameter: {args[0]}' super(ParameterError, self).__init__(msg) elif args[1] not in args[0]: msg = f'{args[1]} is not defined.' super(ParameterError, self).__init__(msg) elif key in obj: msg = f'{args[0]} has bad value: {args[1].__getattr__(args[0])}' super(ParameterError, self).__init__(msg) class Checkerror(ValueError): """ An error called by the Check functions within each module, that returns the name of the class that raised the error, as well as the parameter in question. """ def __init__(self, cls, par): """ CheckError simply returns a print message """ msg = f'{cls.__class__.__name__} requires parameter {par}' super(CheckError, self).__init__(msg)
''' Homework assignment for the 'Python is easy' course by Pirple. Written by Ed Yablonsky. It pprints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". It also adds "prime" to the output when the number is a prime (divisible only by itself and one). ''' for number in range(1, 101): output = "" # collects output for the number if number % 3 == 0: output += "Fizz" if number % 5 == 0: output += "Buzz" if output == "": output = str(number) isPrime = True # assume the number is a prime by default for divisor in range(2, number): if number % divisor == 0: isPrime = False # mark the number as not a prime break if isPrime: output += " prime" print(output)
""" Homework assignment for the 'Python is easy' course by Pirple. Written by Ed Yablonsky. It pprints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". It also adds "prime" to the output when the number is a prime (divisible only by itself and one). """ for number in range(1, 101): output = '' if number % 3 == 0: output += 'Fizz' if number % 5 == 0: output += 'Buzz' if output == '': output = str(number) is_prime = True for divisor in range(2, number): if number % divisor == 0: is_prime = False break if isPrime: output += ' prime' print(output)
""" 1309. Decrypt String from Alphabet to Integer Mapping Given a string s formed by digits ('0' - '9') and '#' . We want to map s to English lowercase characters as follows: Characters ('a' to 'i') are represented by ('1' to '9') respectively. Characters ('j' to 'z') are represented by ('10#' to '26#') respectively. Return the string formed after mapping. It's guaranteed that a unique mapping will always exist. Example 1: Input: s = "10#11#12" Output: "jkab" Explanation: "j" -> "10#" , "k" -> "11#" , "a" -> "1" , "b" -> "2". Example 2: Input: s = "1326#" Output: "acz" Example 3: Input: s = "25#" Output: "y" Example 4: Input: s = "12345678910#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#" Output: "abcdefghijklmnopqrstuvwxyz" Constraints: 1 <= s.length <= 1000 s[i] only contains digits letters ('0'-'9') and '#' letter. s will be valid string such that mapping is always possible. """ class Solution: def freqAlphabets(self, s: str): return s.replace("10#", "j")\ .replace("11#", "k")\ .replace("12#", "l")\ .replace("13#", "m")\ .replace("14#", "n")\ .replace("15#", "o")\ .replace("16#", "p")\ .replace("17#", "q")\ .replace("18#", "r")\ .replace("19#", "s")\ .replace("20#", "t")\ .replace("21#", "u")\ .replace("22#", "v")\ .replace("23#", "w")\ .replace("24#", "x")\ .replace("25#", "y")\ .replace("26#", "z")\ .replace("1", "a")\ .replace("2", "b")\ .replace("3", "c")\ .replace("4", "d")\ .replace("5", "e")\ .replace("6", "f")\ .replace("7", "g")\ .replace("8", "h")\ .replace("9", "i") class Solution: def freqAlphabets(self, s: str): return re.sub(r'\d{2}#|\d', lambda x: chr(int(x.group()[:2])+96), s)
""" 1309. Decrypt String from Alphabet to Integer Mapping Given a string s formed by digits ('0' - '9') and '#' . We want to map s to English lowercase characters as follows: Characters ('a' to 'i') are represented by ('1' to '9') respectively. Characters ('j' to 'z') are represented by ('10#' to '26#') respectively. Return the string formed after mapping. It's guaranteed that a unique mapping will always exist. Example 1: Input: s = "10#11#12" Output: "jkab" Explanation: "j" -> "10#" , "k" -> "11#" , "a" -> "1" , "b" -> "2". Example 2: Input: s = "1326#" Output: "acz" Example 3: Input: s = "25#" Output: "y" Example 4: Input: s = "12345678910#11#12#13#14#15#16#17#18#19#20#21#22#23#24#25#26#" Output: "abcdefghijklmnopqrstuvwxyz" Constraints: 1 <= s.length <= 1000 s[i] only contains digits letters ('0'-'9') and '#' letter. s will be valid string such that mapping is always possible. """ class Solution: def freq_alphabets(self, s: str): return s.replace('10#', 'j').replace('11#', 'k').replace('12#', 'l').replace('13#', 'm').replace('14#', 'n').replace('15#', 'o').replace('16#', 'p').replace('17#', 'q').replace('18#', 'r').replace('19#', 's').replace('20#', 't').replace('21#', 'u').replace('22#', 'v').replace('23#', 'w').replace('24#', 'x').replace('25#', 'y').replace('26#', 'z').replace('1', 'a').replace('2', 'b').replace('3', 'c').replace('4', 'd').replace('5', 'e').replace('6', 'f').replace('7', 'g').replace('8', 'h').replace('9', 'i') class Solution: def freq_alphabets(self, s: str): return re.sub('\\d{2}#|\\d', lambda x: chr(int(x.group()[:2]) + 96), s)
a=input() print(a) print(a) print(a)
a = input() print(a) print(a) print(a)
load( "@io_bazel_rules_dotnet//dotnet/private:providers.bzl", "DotnetLibrary", ) def collect_transitive_info(deps): """Collects transitive information. Args: deps: Dependencies that the DotnetLibrary depends on. Returns: A depsets of the references, runfiles and deps. References and deps also include direct dependencies provided by deps. However, runtfiles do not include direct runfiles. """ direct_refs = [] direct_deps = [] transitive_refs = [] transitive_runfiles = [] transitive_deps = [] for dep in deps: assembly = dep[DotnetLibrary] if assembly.ref: direct_refs += assembly.ref.files.to_list() elif assembly.result: direct_refs.append(assembly.result) if assembly.transitive_refs: transitive_refs.append(assembly.transitive_refs) transitive_runfiles.append(assembly.runfiles) direct_deps.append(assembly) if assembly.transitive: transitive_deps.append(assembly.transitive) return ( depset(direct = direct_refs, transitive = transitive_refs), depset(direct = [], transitive = transitive_runfiles), depset(direct = direct_deps, transitive = transitive_deps), )
load('@io_bazel_rules_dotnet//dotnet/private:providers.bzl', 'DotnetLibrary') def collect_transitive_info(deps): """Collects transitive information. Args: deps: Dependencies that the DotnetLibrary depends on. Returns: A depsets of the references, runfiles and deps. References and deps also include direct dependencies provided by deps. However, runtfiles do not include direct runfiles. """ direct_refs = [] direct_deps = [] transitive_refs = [] transitive_runfiles = [] transitive_deps = [] for dep in deps: assembly = dep[DotnetLibrary] if assembly.ref: direct_refs += assembly.ref.files.to_list() elif assembly.result: direct_refs.append(assembly.result) if assembly.transitive_refs: transitive_refs.append(assembly.transitive_refs) transitive_runfiles.append(assembly.runfiles) direct_deps.append(assembly) if assembly.transitive: transitive_deps.append(assembly.transitive) return (depset(direct=direct_refs, transitive=transitive_refs), depset(direct=[], transitive=transitive_runfiles), depset(direct=direct_deps, transitive=transitive_deps))
# ================================================================================ # Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============LICENSE_END========================================================= # """contants of policy-handler""" POLICY_ID = 'policy_id' POLICY_BODY = 'policy_body' CATCH_UP = "catch_up" AUTO_CATCH_UP = "auto catch_up" AUTO_RECONFIGURE = "auto reconfigure" LATEST_POLICIES = "latest_policies" REMOVED_POLICIES = "removed_policies" ERRORED_POLICIES = "errored_policies" POLICY_FILTER = "policy_filter" POLICY_FILTERS = "policy_filters" POLICIES = "policies" POLICY_VERSIONS = "policy_versions" POLICY_NAMES = "policy_names" POLICY_FILTER_MATCHES = "policy_filter_matches" TARGET_ENTITY = "target_entity"
"""contants of policy-handler""" policy_id = 'policy_id' policy_body = 'policy_body' catch_up = 'catch_up' auto_catch_up = 'auto catch_up' auto_reconfigure = 'auto reconfigure' latest_policies = 'latest_policies' removed_policies = 'removed_policies' errored_policies = 'errored_policies' policy_filter = 'policy_filter' policy_filters = 'policy_filters' policies = 'policies' policy_versions = 'policy_versions' policy_names = 'policy_names' policy_filter_matches = 'policy_filter_matches' target_entity = 'target_entity'
# Fancy-pants method for getting a where clause that groups adjacent image keys # using "BETWEEN X AND Y" ... unfortunately this usually takes far more # characters than using "ImageNumber IN (X,Y,Z...)" since we don't run into # queries asking for consecutive image numbers very often (except when we do it # deliberately). It is also slower than the "IN" method unless the ImageNumbers # come in a smaller list of consecutive groups. # # ...still, this may be very useful since it is notably faster when ImageNumbers # are consecutive. def get_where_clause_for_images(keys, is_sorted=False): ''' takes a list of keys and returns a (hopefully) short where clause that includes those keys. ''' def in_sequence(k1,k2): if len(k1)>1: if k1[:-1] != k2[:-1]: return False return k1[-1]==(k2[-1]-1) def optimize_for_query(keys, is_sorted=False): if not is_sorted: keys.sort() groups = [] in_run = False for i in range(len(keys)): if i == len(keys)-1: if in_run: groups[-1] += [keys[i]] else: groups += [[keys[i]]] break if in_run: if in_sequence(keys[i], keys[i+1]): continue else: groups[-1] += [keys[i]] in_run = False else: if in_sequence(keys[i], keys[i+1]): in_run = True groups += [[keys[i]]] return groups groups = optimize_for_query(keys) wheres = [] for k in groups: if len(k)==1: wheres += ['%s=%s'%(col,value) for col, value in zip(object_key_columns(), k[0])] else: # expect 2 keys: the first and last of a contiguous run first, last = k if p.table_id: wheres += ['(%s=%s AND %s BETWEEN %s and %s)'% (p.table_id, first[0], p.image_id, first[1], last[1])] else: wheres += ['(%s BETWEEN %s and %s)'% (p.image_id, first[0], last[0])] return ' OR '.join(wheres)
def get_where_clause_for_images(keys, is_sorted=False): """ takes a list of keys and returns a (hopefully) short where clause that includes those keys. """ def in_sequence(k1, k2): if len(k1) > 1: if k1[:-1] != k2[:-1]: return False return k1[-1] == k2[-1] - 1 def optimize_for_query(keys, is_sorted=False): if not is_sorted: keys.sort() groups = [] in_run = False for i in range(len(keys)): if i == len(keys) - 1: if in_run: groups[-1] += [keys[i]] else: groups += [[keys[i]]] break if in_run: if in_sequence(keys[i], keys[i + 1]): continue else: groups[-1] += [keys[i]] in_run = False else: if in_sequence(keys[i], keys[i + 1]): in_run = True groups += [[keys[i]]] return groups groups = optimize_for_query(keys) wheres = [] for k in groups: if len(k) == 1: wheres += ['%s=%s' % (col, value) for (col, value) in zip(object_key_columns(), k[0])] else: (first, last) = k if p.table_id: wheres += ['(%s=%s AND %s BETWEEN %s and %s)' % (p.table_id, first[0], p.image_id, first[1], last[1])] else: wheres += ['(%s BETWEEN %s and %s)' % (p.image_id, first[0], last[0])] return ' OR '.join(wheres)
# A module for class Restaurant """A set of classes that can be used to represent a restaurant.""" class Restaurant(): """A model of a restaurant.""" def __init__(self, name, cuisine): """Initialize name and age attributes.""" self.name = name self.cuisine = cuisine def describe_restaurant(self): """Simulate a description of restaurant.""" print(self.name.title() + " is the restaurant.") print(self.cuisine.title() + " is the type of cuisine.") def open_restaurant(self): """Simulate a message alerting that the restaurant is open.""" print(self.name.title() + " is open.") class IceCreamStand(Restaurant): """Represent aspects of a restaurant, specific to ice cream stands.""" def __init__(self, name, cuisine): """Initialize attributes of parent class; then initialize attributes specific to an ice cream stand.""" super().__init__(name, cuisine) flavors = "vanilla, chocolate, strawberry, and rocky road." self.flavors = flavors def describe_ice_cream_flavors(self): """Print a statement describing the ice cream flavors offered.""" print("This ice cream stand has the following flavors: " + self.flavors)
"""A set of classes that can be used to represent a restaurant.""" class Restaurant: """A model of a restaurant.""" def __init__(self, name, cuisine): """Initialize name and age attributes.""" self.name = name self.cuisine = cuisine def describe_restaurant(self): """Simulate a description of restaurant.""" print(self.name.title() + ' is the restaurant.') print(self.cuisine.title() + ' is the type of cuisine.') def open_restaurant(self): """Simulate a message alerting that the restaurant is open.""" print(self.name.title() + ' is open.') class Icecreamstand(Restaurant): """Represent aspects of a restaurant, specific to ice cream stands.""" def __init__(self, name, cuisine): """Initialize attributes of parent class; then initialize attributes specific to an ice cream stand.""" super().__init__(name, cuisine) flavors = 'vanilla, chocolate, strawberry, and rocky road.' self.flavors = flavors def describe_ice_cream_flavors(self): """Print a statement describing the ice cream flavors offered.""" print('This ice cream stand has the following flavors: ' + self.flavors)
g = int(input().strip()) for _ in range(g): n = int(input().strip()) s = [int(x) for x in input().strip().split(' ')] x = 0 for i in s: x ^= i if len(set(s))==1 and 1 in s: #here x=0 or 1 if x:#odd no. of ones print("Second") else:#even no. of ones print("First") else: if x: print("First") else: print("Second")
g = int(input().strip()) for _ in range(g): n = int(input().strip()) s = [int(x) for x in input().strip().split(' ')] x = 0 for i in s: x ^= i if len(set(s)) == 1 and 1 in s: if x: print('Second') else: print('First') elif x: print('First') else: print('Second')
class SerializerNotFound(Exception): """ Serializer not found """
class Serializernotfound(Exception): """ Serializer not found """
class A(object): def do_this(self): print('do_this() in A') class B(A): pass class C(A): def do_this(self): print('do_this() in C') class D(B, C): pass D_instance = D() D_instance.do_this() print(D.mro()) # Method resolution order
class A(object): def do_this(self): print('do_this() in A') class B(A): pass class C(A): def do_this(self): print('do_this() in C') class D(B, C): pass d_instance = d() D_instance.do_this() print(D.mro())
a, b = 0, 1 while b < 10: print(b) a, b = b, a + b # 1 # 1 # 2 # 3 # 5 # 8 a, b = 0, 1 while b < 1000: print(b, end='->') a, b = b, a + b # 1->1->2->3->5->8->13->21->34->55->89->144->233->377->610->987->%
(a, b) = (0, 1) while b < 10: print(b) (a, b) = (b, a + b) (a, b) = (0, 1) while b < 1000: print(b, end='->') (a, b) = (b, a + b)
class AutoScaleSettingVO: def __init__(self, mini_size=1, max_size=1, mem_exc=0, deploy_name = ""): self.miniSize = mini_size self.maxSize = max_size self.memExc = mem_exc self.deployName = deploy_name self.operationResult = ""
class Autoscalesettingvo: def __init__(self, mini_size=1, max_size=1, mem_exc=0, deploy_name=''): self.miniSize = mini_size self.maxSize = max_size self.memExc = mem_exc self.deployName = deploy_name self.operationResult = ''
#Date: 031622 #Difficulty: Easy class Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ write=0 for read in range(len(nums)): if nums[read]!=val: nums[write]=nums[read] write+=1 return write
class Solution(object): def remove_element(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ write = 0 for read in range(len(nums)): if nums[read] != val: nums[write] = nums[read] write += 1 return write
# # PySNMP MIB module STN-ATM-VPN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-ATM-VPN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:03:27 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # Integer, ObjectIdentifier, OctetString = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "ConstraintsIntersection") InterfaceIndex, = mibBuilder.importSymbols("IF-MIB", "InterfaceIndex") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") MibScalar, MibTable, MibTableRow, MibTableColumn, Integer32, ModuleIdentity, MibIdentifier, NotificationType, Unsigned32, Counter32, Gauge32, Counter64, iso, ObjectIdentity, TimeTicks, Bits, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Integer32", "ModuleIdentity", "MibIdentifier", "NotificationType", "Unsigned32", "Counter32", "Gauge32", "Counter64", "iso", "ObjectIdentity", "TimeTicks", "Bits", "IpAddress") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") stnNotification, = mibBuilder.importSymbols("SPRING-TIDE-NETWORKS-SMI", "stnNotification") stnRouterAtmVpn, = mibBuilder.importSymbols("STN-ROUTER-MIB", "stnRouterAtmVpn") stnAtmVpn = ModuleIdentity((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1)) if mibBuilder.loadTexts: stnAtmVpn.setLastUpdated('0008080000Z') if mibBuilder.loadTexts: stnAtmVpn.setOrganization('Spring Tide Networks') stnAtmVpnTrunkObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1)) stnAtmVpnLinkObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2)) stnAtmVpnTrunkTable = MibTable((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1), ) if mibBuilder.loadTexts: stnAtmVpnTrunkTable.setStatus('current') stnAtmVpnTrunkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1), ).setIndexNames((0, "STN-ATM-VPN-MIB", "stnAtmVpnTrunkIfIndex")) if mibBuilder.loadTexts: stnAtmVpnTrunkEntry.setStatus('current') stnAtmVpnTrunkIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 1), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkIfIndex.setStatus('current') stnAtmVpnTrunkViId = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkViId.setStatus('current') stnAtmVpnTrunkName = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkName.setStatus('current') stnAtmVpnTrunkState = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkState.setStatus('current') stnAtmVpnTrunkLowerIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 5), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkLowerIfIndex.setStatus('current') stnAtmVpnTrunkVpnPaths = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkVpnPaths.setStatus('current') stnAtmVpnTrunkInUnknownVpnId = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 7), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkInUnknownVpnId.setStatus('current') stnAtmVpnTrunkInVpnIdIfaceInvalid = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkInVpnIdIfaceInvalid.setStatus('current') stnAtmVpnTrunkOutUnknownVpnId = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkOutUnknownVpnId.setStatus('current') stnAtmVpnTrunkOutVpnIdIfaceInvalid = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkOutVpnIdIfaceInvalid.setStatus('current') stnAtmVpnTrunkPathTable = MibTable((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2), ) if mibBuilder.loadTexts: stnAtmVpnTrunkPathTable.setStatus('current') stnAtmVpnTrunkPathEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1), ).setIndexNames((0, "STN-ATM-VPN-MIB", "stnAtmVpnTrunkPathTrunkIfIndex"), (0, "STN-ATM-VPN-MIB", "stnAtmVpnTrunkPathVpnOUI"), (0, "STN-ATM-VPN-MIB", "stnAtmVpnTrunkPathVpnIndex"), (0, "STN-ATM-VPN-MIB", "stnAtmVpnTrunkPathVpnSubIndex")) if mibBuilder.loadTexts: stnAtmVpnTrunkPathEntry.setStatus('current') stnAtmVpnTrunkPathTrunkIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 1), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathTrunkIfIndex.setStatus('current') stnAtmVpnTrunkPathVpnOUI = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathVpnOUI.setStatus('current') stnAtmVpnTrunkPathVpnIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathVpnIndex.setStatus('current') stnAtmVpnTrunkPathVpnSubIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathVpnSubIndex.setStatus('current') stnAtmVpnTrunkPathType = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("vpnLearnedPath", 1), ("vpnStaticPath", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathType.setStatus('current') stnAtmVpnTrunkPathNextIfType = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("atmVpnLink", 1), ("atmVpnTrunk", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathNextIfType.setStatus('current') stnAtmVpnTrunkPathNextIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 7), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathNextIfIndex.setStatus('current') stnAtmVpnTrunkPathInPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 8), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathInPackets.setStatus('current') stnAtmVpnTrunkPathInOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 9), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathInOctets.setStatus('current') stnAtmVpnTrunkPathOutPackets = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathOutPackets.setStatus('current') stnAtmVpnTrunkPathOutOctets = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnTrunkPathOutOctets.setStatus('current') stnAtmVpnLinkTable = MibTable((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1), ) if mibBuilder.loadTexts: stnAtmVpnLinkTable.setStatus('current') stnAtmVpnLinkEntry = MibTableRow((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1), ).setIndexNames((0, "STN-ATM-VPN-MIB", "stnAtmVpnLinkIfIndex")) if mibBuilder.loadTexts: stnAtmVpnLinkEntry.setStatus('current') stnAtmVpnLinkIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 1), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkIfIndex.setStatus('current') stnAtmVpnLinkViId = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkViId.setStatus('current') stnAtmVpnLinkName = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 3), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkName.setStatus('current') stnAtmVpnLinkVpnOUI = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkVpnOUI.setStatus('current') stnAtmVpnLinkVpnIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkVpnIndex.setStatus('current') stnAtmVpnLinkVpnSubIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkVpnSubIndex.setStatus('current') stnAtmVpnLinkState = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("testing", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkState.setStatus('current') stnAtmVpnLinkTrunkViId = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkTrunkViId.setStatus('current') stnAtmVpnLinkLowerIfIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 9), InterfaceIndex()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkLowerIfIndex.setStatus('current') stnAtmVpnLinkOutUnknownVpnId = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 10), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkOutUnknownVpnId.setStatus('current') stnAtmVpnLinkOutVpnIdIfaceInvalid = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 11), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkOutVpnIdIfaceInvalid.setStatus('current') stnAtmVpnLinkInVpnIdIfaceInvalid = MibTableColumn((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 12), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: stnAtmVpnLinkInVpnIdIfaceInvalid.setStatus('current') mibBuilder.exportSymbols("STN-ATM-VPN-MIB", stnAtmVpnLinkIfIndex=stnAtmVpnLinkIfIndex, stnAtmVpnTrunkState=stnAtmVpnTrunkState, stnAtmVpnTrunkPathInOctets=stnAtmVpnTrunkPathInOctets, stnAtmVpnLinkLowerIfIndex=stnAtmVpnLinkLowerIfIndex, stnAtmVpnLinkInVpnIdIfaceInvalid=stnAtmVpnLinkInVpnIdIfaceInvalid, stnAtmVpnLinkObjects=stnAtmVpnLinkObjects, stnAtmVpnTrunkPathVpnSubIndex=stnAtmVpnTrunkPathVpnSubIndex, stnAtmVpnTrunkPathTable=stnAtmVpnTrunkPathTable, stnAtmVpn=stnAtmVpn, PYSNMP_MODULE_ID=stnAtmVpn, stnAtmVpnLinkState=stnAtmVpnLinkState, stnAtmVpnTrunkOutVpnIdIfaceInvalid=stnAtmVpnTrunkOutVpnIdIfaceInvalid, stnAtmVpnTrunkInVpnIdIfaceInvalid=stnAtmVpnTrunkInVpnIdIfaceInvalid, stnAtmVpnTrunkName=stnAtmVpnTrunkName, stnAtmVpnTrunkEntry=stnAtmVpnTrunkEntry, stnAtmVpnTrunkVpnPaths=stnAtmVpnTrunkVpnPaths, stnAtmVpnTrunkPathVpnOUI=stnAtmVpnTrunkPathVpnOUI, stnAtmVpnTrunkViId=stnAtmVpnTrunkViId, stnAtmVpnTrunkTable=stnAtmVpnTrunkTable, stnAtmVpnLinkVpnOUI=stnAtmVpnLinkVpnOUI, stnAtmVpnTrunkPathVpnIndex=stnAtmVpnTrunkPathVpnIndex, stnAtmVpnTrunkPathInPackets=stnAtmVpnTrunkPathInPackets, stnAtmVpnTrunkPathNextIfType=stnAtmVpnTrunkPathNextIfType, stnAtmVpnTrunkOutUnknownVpnId=stnAtmVpnTrunkOutUnknownVpnId, stnAtmVpnTrunkInUnknownVpnId=stnAtmVpnTrunkInUnknownVpnId, stnAtmVpnLinkOutUnknownVpnId=stnAtmVpnLinkOutUnknownVpnId, stnAtmVpnTrunkPathOutPackets=stnAtmVpnTrunkPathOutPackets, stnAtmVpnLinkTrunkViId=stnAtmVpnLinkTrunkViId, stnAtmVpnTrunkPathTrunkIfIndex=stnAtmVpnTrunkPathTrunkIfIndex, stnAtmVpnTrunkPathNextIfIndex=stnAtmVpnTrunkPathNextIfIndex, stnAtmVpnTrunkPathEntry=stnAtmVpnTrunkPathEntry, stnAtmVpnTrunkIfIndex=stnAtmVpnTrunkIfIndex, stnAtmVpnLinkTable=stnAtmVpnLinkTable, stnAtmVpnLinkOutVpnIdIfaceInvalid=stnAtmVpnLinkOutVpnIdIfaceInvalid, stnAtmVpnTrunkPathType=stnAtmVpnTrunkPathType, stnAtmVpnLinkVpnSubIndex=stnAtmVpnLinkVpnSubIndex, stnAtmVpnLinkName=stnAtmVpnLinkName, stnAtmVpnTrunkObjects=stnAtmVpnTrunkObjects, stnAtmVpnLinkVpnIndex=stnAtmVpnLinkVpnIndex, stnAtmVpnLinkEntry=stnAtmVpnLinkEntry, stnAtmVpnLinkViId=stnAtmVpnLinkViId, stnAtmVpnTrunkPathOutOctets=stnAtmVpnTrunkPathOutOctets, stnAtmVpnTrunkLowerIfIndex=stnAtmVpnTrunkLowerIfIndex)
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueSizeConstraint', 'ValueRangeConstraint', 'ConstraintsUnion', 'ConstraintsIntersection') (interface_index,) = mibBuilder.importSymbols('IF-MIB', 'InterfaceIndex') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (mib_scalar, mib_table, mib_table_row, mib_table_column, integer32, module_identity, mib_identifier, notification_type, unsigned32, counter32, gauge32, counter64, iso, object_identity, time_ticks, bits, ip_address) = mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Integer32', 'ModuleIdentity', 'MibIdentifier', 'NotificationType', 'Unsigned32', 'Counter32', 'Gauge32', 'Counter64', 'iso', 'ObjectIdentity', 'TimeTicks', 'Bits', 'IpAddress') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') (stn_notification,) = mibBuilder.importSymbols('SPRING-TIDE-NETWORKS-SMI', 'stnNotification') (stn_router_atm_vpn,) = mibBuilder.importSymbols('STN-ROUTER-MIB', 'stnRouterAtmVpn') stn_atm_vpn = module_identity((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1)) if mibBuilder.loadTexts: stnAtmVpn.setLastUpdated('0008080000Z') if mibBuilder.loadTexts: stnAtmVpn.setOrganization('Spring Tide Networks') stn_atm_vpn_trunk_objects = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1)) stn_atm_vpn_link_objects = mib_identifier((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2)) stn_atm_vpn_trunk_table = mib_table((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1)) if mibBuilder.loadTexts: stnAtmVpnTrunkTable.setStatus('current') stn_atm_vpn_trunk_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1)).setIndexNames((0, 'STN-ATM-VPN-MIB', 'stnAtmVpnTrunkIfIndex')) if mibBuilder.loadTexts: stnAtmVpnTrunkEntry.setStatus('current') stn_atm_vpn_trunk_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 1), interface_index()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkIfIndex.setStatus('current') stn_atm_vpn_trunk_vi_id = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkViId.setStatus('current') stn_atm_vpn_trunk_name = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(1, 32))).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkName.setStatus('current') stn_atm_vpn_trunk_state = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 4), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('up', 1), ('down', 2), ('testing', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkState.setStatus('current') stn_atm_vpn_trunk_lower_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 5), interface_index()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkLowerIfIndex.setStatus('current') stn_atm_vpn_trunk_vpn_paths = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkVpnPaths.setStatus('current') stn_atm_vpn_trunk_in_unknown_vpn_id = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 7), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkInUnknownVpnId.setStatus('current') stn_atm_vpn_trunk_in_vpn_id_iface_invalid = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 8), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkInVpnIdIfaceInvalid.setStatus('current') stn_atm_vpn_trunk_out_unknown_vpn_id = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 9), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkOutUnknownVpnId.setStatus('current') stn_atm_vpn_trunk_out_vpn_id_iface_invalid = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 1, 1, 10), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkOutVpnIdIfaceInvalid.setStatus('current') stn_atm_vpn_trunk_path_table = mib_table((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2)) if mibBuilder.loadTexts: stnAtmVpnTrunkPathTable.setStatus('current') stn_atm_vpn_trunk_path_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1)).setIndexNames((0, 'STN-ATM-VPN-MIB', 'stnAtmVpnTrunkPathTrunkIfIndex'), (0, 'STN-ATM-VPN-MIB', 'stnAtmVpnTrunkPathVpnOUI'), (0, 'STN-ATM-VPN-MIB', 'stnAtmVpnTrunkPathVpnIndex'), (0, 'STN-ATM-VPN-MIB', 'stnAtmVpnTrunkPathVpnSubIndex')) if mibBuilder.loadTexts: stnAtmVpnTrunkPathEntry.setStatus('current') stn_atm_vpn_trunk_path_trunk_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 1), interface_index()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkPathTrunkIfIndex.setStatus('current') stn_atm_vpn_trunk_path_vpn_oui = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkPathVpnOUI.setStatus('current') stn_atm_vpn_trunk_path_vpn_index = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkPathVpnIndex.setStatus('current') stn_atm_vpn_trunk_path_vpn_sub_index = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkPathVpnSubIndex.setStatus('current') stn_atm_vpn_trunk_path_type = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 5), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('vpnLearnedPath', 1), ('vpnStaticPath', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkPathType.setStatus('current') stn_atm_vpn_trunk_path_next_if_type = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('atmVpnLink', 1), ('atmVpnTrunk', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkPathNextIfType.setStatus('current') stn_atm_vpn_trunk_path_next_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 7), interface_index()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkPathNextIfIndex.setStatus('current') stn_atm_vpn_trunk_path_in_packets = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 8), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkPathInPackets.setStatus('current') stn_atm_vpn_trunk_path_in_octets = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 9), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkPathInOctets.setStatus('current') stn_atm_vpn_trunk_path_out_packets = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 10), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkPathOutPackets.setStatus('current') stn_atm_vpn_trunk_path_out_octets = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 1, 2, 1, 11), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnTrunkPathOutOctets.setStatus('current') stn_atm_vpn_link_table = mib_table((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1)) if mibBuilder.loadTexts: stnAtmVpnLinkTable.setStatus('current') stn_atm_vpn_link_entry = mib_table_row((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1)).setIndexNames((0, 'STN-ATM-VPN-MIB', 'stnAtmVpnLinkIfIndex')) if mibBuilder.loadTexts: stnAtmVpnLinkEntry.setStatus('current') stn_atm_vpn_link_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 1), interface_index()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnLinkIfIndex.setStatus('current') stn_atm_vpn_link_vi_id = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 2), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnLinkViId.setStatus('current') stn_atm_vpn_link_name = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 3), display_string().subtype(subtypeSpec=value_size_constraint(1, 32))).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnLinkName.setStatus('current') stn_atm_vpn_link_vpn_oui = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnLinkVpnOUI.setStatus('current') stn_atm_vpn_link_vpn_index = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnLinkVpnIndex.setStatus('current') stn_atm_vpn_link_vpn_sub_index = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnLinkVpnSubIndex.setStatus('current') stn_atm_vpn_link_state = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3))).clone(namedValues=named_values(('up', 1), ('down', 2), ('testing', 3)))).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnLinkState.setStatus('current') stn_atm_vpn_link_trunk_vi_id = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 8), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnLinkTrunkViId.setStatus('current') stn_atm_vpn_link_lower_if_index = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 9), interface_index()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnLinkLowerIfIndex.setStatus('current') stn_atm_vpn_link_out_unknown_vpn_id = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 10), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnLinkOutUnknownVpnId.setStatus('current') stn_atm_vpn_link_out_vpn_id_iface_invalid = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 11), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnLinkOutVpnIdIfaceInvalid.setStatus('current') stn_atm_vpn_link_in_vpn_id_iface_invalid = mib_table_column((1, 3, 6, 1, 4, 1, 3551, 2, 7, 1, 7, 1, 2, 1, 1, 12), counter64()).setMaxAccess('readonly') if mibBuilder.loadTexts: stnAtmVpnLinkInVpnIdIfaceInvalid.setStatus('current') mibBuilder.exportSymbols('STN-ATM-VPN-MIB', stnAtmVpnLinkIfIndex=stnAtmVpnLinkIfIndex, stnAtmVpnTrunkState=stnAtmVpnTrunkState, stnAtmVpnTrunkPathInOctets=stnAtmVpnTrunkPathInOctets, stnAtmVpnLinkLowerIfIndex=stnAtmVpnLinkLowerIfIndex, stnAtmVpnLinkInVpnIdIfaceInvalid=stnAtmVpnLinkInVpnIdIfaceInvalid, stnAtmVpnLinkObjects=stnAtmVpnLinkObjects, stnAtmVpnTrunkPathVpnSubIndex=stnAtmVpnTrunkPathVpnSubIndex, stnAtmVpnTrunkPathTable=stnAtmVpnTrunkPathTable, stnAtmVpn=stnAtmVpn, PYSNMP_MODULE_ID=stnAtmVpn, stnAtmVpnLinkState=stnAtmVpnLinkState, stnAtmVpnTrunkOutVpnIdIfaceInvalid=stnAtmVpnTrunkOutVpnIdIfaceInvalid, stnAtmVpnTrunkInVpnIdIfaceInvalid=stnAtmVpnTrunkInVpnIdIfaceInvalid, stnAtmVpnTrunkName=stnAtmVpnTrunkName, stnAtmVpnTrunkEntry=stnAtmVpnTrunkEntry, stnAtmVpnTrunkVpnPaths=stnAtmVpnTrunkVpnPaths, stnAtmVpnTrunkPathVpnOUI=stnAtmVpnTrunkPathVpnOUI, stnAtmVpnTrunkViId=stnAtmVpnTrunkViId, stnAtmVpnTrunkTable=stnAtmVpnTrunkTable, stnAtmVpnLinkVpnOUI=stnAtmVpnLinkVpnOUI, stnAtmVpnTrunkPathVpnIndex=stnAtmVpnTrunkPathVpnIndex, stnAtmVpnTrunkPathInPackets=stnAtmVpnTrunkPathInPackets, stnAtmVpnTrunkPathNextIfType=stnAtmVpnTrunkPathNextIfType, stnAtmVpnTrunkOutUnknownVpnId=stnAtmVpnTrunkOutUnknownVpnId, stnAtmVpnTrunkInUnknownVpnId=stnAtmVpnTrunkInUnknownVpnId, stnAtmVpnLinkOutUnknownVpnId=stnAtmVpnLinkOutUnknownVpnId, stnAtmVpnTrunkPathOutPackets=stnAtmVpnTrunkPathOutPackets, stnAtmVpnLinkTrunkViId=stnAtmVpnLinkTrunkViId, stnAtmVpnTrunkPathTrunkIfIndex=stnAtmVpnTrunkPathTrunkIfIndex, stnAtmVpnTrunkPathNextIfIndex=stnAtmVpnTrunkPathNextIfIndex, stnAtmVpnTrunkPathEntry=stnAtmVpnTrunkPathEntry, stnAtmVpnTrunkIfIndex=stnAtmVpnTrunkIfIndex, stnAtmVpnLinkTable=stnAtmVpnLinkTable, stnAtmVpnLinkOutVpnIdIfaceInvalid=stnAtmVpnLinkOutVpnIdIfaceInvalid, stnAtmVpnTrunkPathType=stnAtmVpnTrunkPathType, stnAtmVpnLinkVpnSubIndex=stnAtmVpnLinkVpnSubIndex, stnAtmVpnLinkName=stnAtmVpnLinkName, stnAtmVpnTrunkObjects=stnAtmVpnTrunkObjects, stnAtmVpnLinkVpnIndex=stnAtmVpnLinkVpnIndex, stnAtmVpnLinkEntry=stnAtmVpnLinkEntry, stnAtmVpnLinkViId=stnAtmVpnLinkViId, stnAtmVpnTrunkPathOutOctets=stnAtmVpnTrunkPathOutOctets, stnAtmVpnTrunkLowerIfIndex=stnAtmVpnTrunkLowerIfIndex)
class MenuItem: # Definiskan method info def info(self): print('Tampilkan nama dan harga dari menu item') menu_item1 = MenuItem() menu_item1.name = 'Roti Lapis' menu_item1.price = 5 # Panggil method info dari menu_item1 menu_item1.info() menu_item2 = MenuItem() menu_item2.name = 'Kue Coklat' menu_item2.price = 4 # Panggil method info dari menu_item2 menu_item2.info()
class Menuitem: def info(self): print('Tampilkan nama dan harga dari menu item') menu_item1 = menu_item() menu_item1.name = 'Roti Lapis' menu_item1.price = 5 menu_item1.info() menu_item2 = menu_item() menu_item2.name = 'Kue Coklat' menu_item2.price = 4 menu_item2.info()
#!/user/bin/python '''Number of Inversions '''
"""Number of Inversions """
class HideX(object): # def x(): # def fget(self): # return ~self.__x # def fset(self, x): # assert isinstance(x, int), 'x must be int' # self.__x = ~x # return locals() # x = property(**x()) @property def x(self): return ~self.__x @x.setter def x(self, x): assert isinstance(x, int), 'x must be int' self.__x = ~x o = HideX() o.x = 5 print(o.x) print(o._HideX__x)
class Hidex(object): @property def x(self): return ~self.__x @x.setter def x(self, x): assert isinstance(x, int), 'x must be int' self.__x = ~x o = hide_x() o.x = 5 print(o.x) print(o._HideX__x)
#coding=utf-8 ''' Created on 2015-10-10 @author: Devuser ''' class HomeTaskPath(object): left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="task/home_task_leftsub_nav.html" task_index_path="task/home_task_index.html" class HomeProjectPath(object): left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="project/home_project_leftsub_nav.html" project_list_template_path="project/home_project_listview.html" project_list_control_path="project/home_project_list_control.html" class HomeAutoTaskPath(object): left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="autotask/home_autotask_leftsub_nav.html" project_list_template_path="autotask/home_autotask_listview.html" class HomeDashBoardPath(object): left_nav_template_path="home/home_left_nav.html" activity_template_path="dashboard/home_dashboard_activity.html" summary_template_path="dashboard/home_dashboard_summary.html" class HomeFortestingPath(object): left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="fortesting/home_fortesting_leftsub_nav.html" class HomeIssuePath(object): left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="issue/home_issue_leftsub_nav.html" home_issue_webapp="issue/home_issue_webapp.html" home_issue_index="issue/index.html" class HomeWebappsPath(object): webapps_index_path="webapps/home_webapp_index.html" left_nav_template_path="home/home_left_nav.html" sub_nav_template_path="webapps/home_webapps_leftsub_nav.html" webapps_webpart_path="webapps/home_webapp_webpart.html" webapps_create_dialog_path="webapps/home_webapp_create_dialog.html" class Home_unloginPagePath(object): home_page_path="home/home_page.html" home_welcome_path="home/home_page_welcome.html" home_project_summary_path="home/home_page_project_summary.html" home_device_page_path="home/home_page_device.html" class DevicePagePath(object): left_nav_template_path="home/home_left_nav.html" device_page_path="device/home_device_index.html" device_list_page="device/home_device_list_page.html" device_list_controll="device/home_device_list_controll.html"
""" Created on 2015-10-10 @author: Devuser """ class Hometaskpath(object): left_nav_template_path = 'home/home_left_nav.html' sub_nav_template_path = 'task/home_task_leftsub_nav.html' task_index_path = 'task/home_task_index.html' class Homeprojectpath(object): left_nav_template_path = 'home/home_left_nav.html' sub_nav_template_path = 'project/home_project_leftsub_nav.html' project_list_template_path = 'project/home_project_listview.html' project_list_control_path = 'project/home_project_list_control.html' class Homeautotaskpath(object): left_nav_template_path = 'home/home_left_nav.html' sub_nav_template_path = 'autotask/home_autotask_leftsub_nav.html' project_list_template_path = 'autotask/home_autotask_listview.html' class Homedashboardpath(object): left_nav_template_path = 'home/home_left_nav.html' activity_template_path = 'dashboard/home_dashboard_activity.html' summary_template_path = 'dashboard/home_dashboard_summary.html' class Homefortestingpath(object): left_nav_template_path = 'home/home_left_nav.html' sub_nav_template_path = 'fortesting/home_fortesting_leftsub_nav.html' class Homeissuepath(object): left_nav_template_path = 'home/home_left_nav.html' sub_nav_template_path = 'issue/home_issue_leftsub_nav.html' home_issue_webapp = 'issue/home_issue_webapp.html' home_issue_index = 'issue/index.html' class Homewebappspath(object): webapps_index_path = 'webapps/home_webapp_index.html' left_nav_template_path = 'home/home_left_nav.html' sub_nav_template_path = 'webapps/home_webapps_leftsub_nav.html' webapps_webpart_path = 'webapps/home_webapp_webpart.html' webapps_create_dialog_path = 'webapps/home_webapp_create_dialog.html' class Home_Unloginpagepath(object): home_page_path = 'home/home_page.html' home_welcome_path = 'home/home_page_welcome.html' home_project_summary_path = 'home/home_page_project_summary.html' home_device_page_path = 'home/home_page_device.html' class Devicepagepath(object): left_nav_template_path = 'home/home_left_nav.html' device_page_path = 'device/home_device_index.html' device_list_page = 'device/home_device_list_page.html' device_list_controll = 'device/home_device_list_controll.html'
#Link Class is given! class Link: """A linked list. >>> s = Link(1, Link(2, Link(3))) >>> s.first 1 >>> s.rest Link(2, Link(3)) """ empty = () def __init__(self, first, rest=empty): assert rest is Link.empty or isinstance(rest, Link) self.first = first self.rest = rest def __repr__(self): if self.rest is Link.empty: return 'Link({})'.format(self.first) else: return 'Link({}, {})'.format(self.first, repr(self.rest)) def __str__(self): """Returns a human-readable string representation of the Link >>> s = Link(1, Link(2, Link(3, Link(4)))) >>> str(s) '<1 2 3 4>' >>> str(Link(1)) '<1>' >>> str(Link.empty) # empty tuple '()' """ string = '<' while self.rest is not Link.empty: string += str(self.first) + ' ' self = self.rest return string + str(self.first) + '>' def __eq__(self, other): """Compares if two Linked Lists contain same values or not. >>> s, t = Link(1, Link(2)), Link(1, Link(2)) >>> s == t True """ if self is Link.empty and other is Link.empty: return True if self is Link.empty or other is Link.empty: return False return self.first == other.first and self.rest == other.rest def list_to_link(lst): """Takes a Python list and returns a Link with the same elements. >>> link = list_to_link([1, 2, 3]) >>> link 'Link(1, Link(2, Link(3)))' """ "***YOUR CODE HERE***" def link_to_list(link): """Takes a Link and returns a Python list with the same elements. >>> link = Link(1, Link(2, Link(3, Link(4)))) >>> link_to_list(link) [1, 2, 3, 4] >>> link_to_list(Link.empty) [] """ "*** YOUR CODE HERE ***" def remove_all(link , value): """Remove all the nodes containing value. Assume there exists some nodes to be removed and the first element is never removed. >>> l1 = Link(0, Link(2, Link(2, Link(3, Link(1, Link(2, Link(3))))))) >>> remove_all(l1, 2) >>> l1 Link(0, Link(3, Link(1, Link(3)))) >>> remove_all(l1, 3) >>> l1 Link(0, Link(1)) """ "*** YOUR CODE HERE ***" def linked_sum(lnk, total): """Return the number of combinations of elements in lnk that sum up to total . >>> # Four combinations : 1 1 1 1 , 1 1 2 , 1 3 , 2 2 >>> linked_sum (Link(1, Link(2, Link(3, Link(5)))), 4) 4 >>> linked_sum(Link(2, Link(3, Link(5))), 1) 0 >>> # One combination : 2 3 >>> linked_sum(Link(2, Link(4, Link(3))), 5) 1 """ "*** YOUR CODE HERE ***" def has_cycle(s): """ >>> has_cycle(Link.empty) False >>> a = Link(1, Link(2, Link(3))) >>> has_cycle(a) False >>> a.rest.rest.rest = a >>> has_cycle(a) True """ "*** YOUR CODE HERE ***"
class Link: """A linked list. >>> s = Link(1, Link(2, Link(3))) >>> s.first 1 >>> s.rest Link(2, Link(3)) """ empty = () def __init__(self, first, rest=empty): assert rest is Link.empty or isinstance(rest, Link) self.first = first self.rest = rest def __repr__(self): if self.rest is Link.empty: return 'Link({})'.format(self.first) else: return 'Link({}, {})'.format(self.first, repr(self.rest)) def __str__(self): """Returns a human-readable string representation of the Link >>> s = Link(1, Link(2, Link(3, Link(4)))) >>> str(s) '<1 2 3 4>' >>> str(Link(1)) '<1>' >>> str(Link.empty) # empty tuple '()' """ string = '<' while self.rest is not Link.empty: string += str(self.first) + ' ' self = self.rest return string + str(self.first) + '>' def __eq__(self, other): """Compares if two Linked Lists contain same values or not. >>> s, t = Link(1, Link(2)), Link(1, Link(2)) >>> s == t True """ if self is Link.empty and other is Link.empty: return True if self is Link.empty or other is Link.empty: return False return self.first == other.first and self.rest == other.rest def list_to_link(lst): """Takes a Python list and returns a Link with the same elements. >>> link = list_to_link([1, 2, 3]) >>> link 'Link(1, Link(2, Link(3)))' """ '***YOUR CODE HERE***' def link_to_list(link): """Takes a Link and returns a Python list with the same elements. >>> link = Link(1, Link(2, Link(3, Link(4)))) >>> link_to_list(link) [1, 2, 3, 4] >>> link_to_list(Link.empty) [] """ '*** YOUR CODE HERE ***' def remove_all(link, value): """Remove all the nodes containing value. Assume there exists some nodes to be removed and the first element is never removed. >>> l1 = Link(0, Link(2, Link(2, Link(3, Link(1, Link(2, Link(3))))))) >>> remove_all(l1, 2) >>> l1 Link(0, Link(3, Link(1, Link(3)))) >>> remove_all(l1, 3) >>> l1 Link(0, Link(1)) """ '*** YOUR CODE HERE ***' def linked_sum(lnk, total): """Return the number of combinations of elements in lnk that sum up to total . >>> # Four combinations : 1 1 1 1 , 1 1 2 , 1 3 , 2 2 >>> linked_sum (Link(1, Link(2, Link(3, Link(5)))), 4) 4 >>> linked_sum(Link(2, Link(3, Link(5))), 1) 0 >>> # One combination : 2 3 >>> linked_sum(Link(2, Link(4, Link(3))), 5) 1 """ '*** YOUR CODE HERE ***' def has_cycle(s): """ >>> has_cycle(Link.empty) False >>> a = Link(1, Link(2, Link(3))) >>> has_cycle(a) False >>> a.rest.rest.rest = a >>> has_cycle(a) True """ '*** YOUR CODE HERE ***'
class Reccomandation: def __init__(self, input_text): self.text = input_text def __get__(self, name ): return self.name
class Reccomandation: def __init__(self, input_text): self.text = input_text def __get__(self, name): return self.name
""" https://leetcode.com/problems/count-primes/ """ class Solution: # @param {integer} n # @return {integer} def countPrimes(self, n): if n <=2: return 0 if n == 3: return 1 count = n-2 d = [True for i in xrange(n)] for i in xrange(2, int(n**0.5)+1): if d[i]: j = 2 while i*j < n: if d[i*j]: d[i*j] = False count -=1 j +=1 return count
""" https://leetcode.com/problems/count-primes/ """ class Solution: def count_primes(self, n): if n <= 2: return 0 if n == 3: return 1 count = n - 2 d = [True for i in xrange(n)] for i in xrange(2, int(n ** 0.5) + 1): if d[i]: j = 2 while i * j < n: if d[i * j]: d[i * j] = False count -= 1 j += 1 return count
__author__ = 'nickbortolotti' """ Parte 1 1.utilizar un arreglo que almacene 2 cadenas y 2 valores enteros 2.mostrar en pantalla el la ubicacion 1 mostrar desde el 0-2 mostrar del 2 en adelante mostrar del 1 en reversa mostrar el ultimo elemento del arreglo en reversa """
__author__ = 'nickbortolotti' '\nParte 1\n1.utilizar un arreglo que almacene 2 cadenas y 2 valores enteros\n2.mostrar en pantalla el la ubicacion 1\nmostrar desde el 0-2\nmostrar del 2 en adelante\nmostrar del 1 en reversa\nmostrar el ultimo elemento del arreglo en reversa\n'
def error_output(number_of_parameters): """Write the optimized error values into the params file near the corresponding parameter identicator""" try: file2 = open("parameters", "r+") file2.seek(0) position2 = file2.tell() file = open("fort.13","r") file.seek(0) position = file.tell() try: file.seek(0) error = file.read(12) file2.seek(20) file2.write(" " + error.rjust(18)) finally: file.close() except IOError: pass def error_output_bf(number_of_parameters, parameters_file_name): """Write the optimized error values into the params file near the corresponding parameter identicator""" try: file2 = open(parameters_file_name, "a+") #file2.seek(0) #position2 = file2.tell() file = open("fort.13","r") file.seek(0) position = file.tell() try: file.seek(0) error_bf = file.read(12) #file2.seek(20) file2.write("\n TOTAL ERROR: " + error_bf.rjust(18)) finally: file.close() except IOError: pass return error_bf
def error_output(number_of_parameters): """Write the optimized error values into the params file near the corresponding parameter identicator""" try: file2 = open('parameters', 'r+') file2.seek(0) position2 = file2.tell() file = open('fort.13', 'r') file.seek(0) position = file.tell() try: file.seek(0) error = file.read(12) file2.seek(20) file2.write(' ' + error.rjust(18)) finally: file.close() except IOError: pass def error_output_bf(number_of_parameters, parameters_file_name): """Write the optimized error values into the params file near the corresponding parameter identicator""" try: file2 = open(parameters_file_name, 'a+') file = open('fort.13', 'r') file.seek(0) position = file.tell() try: file.seek(0) error_bf = file.read(12) file2.write('\n TOTAL ERROR: ' + error_bf.rjust(18)) finally: file.close() except IOError: pass return error_bf
num_classes = 81 # model settings model = dict( type='SOLOv2', #pretrained='torchvision://resnet50', # The backbone weights will be overwritten when using load_from or resume_from. # https://github.com/open-mmlab/mmdetection/issues/7817#issuecomment-1108503826 backbone=dict( type='ResNet', depth=50, in_channels = 3, num_stages=4, out_indices=(0, 1, 2, 3), # C2, C3, C4, C5 frozen_stages=-1, # -1 is unfrozen, 0 -> C1 is frozen, 1 - C1, C2 are frozen and so on style='pytorch'), # norm_eval = True # true by default, "you're fine-tuning to minimize training, it's typically best to keep batch normalization frozen" # https://stackoverflow.com/questions/63016740/why-its-necessary-to-frozen-all-inner-state-of-a-batch-normalization-layer-when # required for traning from scratch neck=dict( type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, start_level=0, num_outs=5), bbox_head=dict( type='SOLOv2Head', num_classes=num_classes, in_channels=256, stacked_convs=2, seg_feat_channels=256, strides=[8, 8, 16, 32, 32], scale_ranges=((1, 56), (28, 112), (56, 224), (112, 448), (224, 896)), sigma=0.2, num_grids=[40, 36, 24, 16, 12], ins_out_channels=128, loss_ins=dict( type='DiceLoss', use_sigmoid=True, loss_weight=3.0), loss_cate=dict( type='FocalLoss', use_sigmoid=True, gamma=2.0, alpha=0.25, loss_weight=1.0)), mask_feat_head=dict( type='MaskFeatHead', in_channels=256, out_channels=128, start_level=0, end_level=3, num_classes=128, norm_cfg=dict(type='GN', num_groups=32, requires_grad=True)), ) # training and testing settings train_cfg = dict() test_cfg = dict( nms_pre=500, score_thr=0.1, mask_thr=0.5, update_thr=0.05, kernel='gaussian', # gaussian/linear sigma=2.0, max_per_img=100)
num_classes = 81 model = dict(type='SOLOv2', backbone=dict(type='ResNet', depth=50, in_channels=3, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=-1, style='pytorch'), neck=dict(type='FPN', in_channels=[256, 512, 1024, 2048], out_channels=256, start_level=0, num_outs=5), bbox_head=dict(type='SOLOv2Head', num_classes=num_classes, in_channels=256, stacked_convs=2, seg_feat_channels=256, strides=[8, 8, 16, 32, 32], scale_ranges=((1, 56), (28, 112), (56, 224), (112, 448), (224, 896)), sigma=0.2, num_grids=[40, 36, 24, 16, 12], ins_out_channels=128, loss_ins=dict(type='DiceLoss', use_sigmoid=True, loss_weight=3.0), loss_cate=dict(type='FocalLoss', use_sigmoid=True, gamma=2.0, alpha=0.25, loss_weight=1.0)), mask_feat_head=dict(type='MaskFeatHead', in_channels=256, out_channels=128, start_level=0, end_level=3, num_classes=128, norm_cfg=dict(type='GN', num_groups=32, requires_grad=True))) train_cfg = dict() test_cfg = dict(nms_pre=500, score_thr=0.1, mask_thr=0.5, update_thr=0.05, kernel='gaussian', sigma=2.0, max_per_img=100)
#!/usr/bin/env prey async def main(): word = input("Give me a word: ") await x(f"echo {word}")
async def main(): word = input('Give me a word: ') await x(f'echo {word}')
class ToolConfig (): def __init__ (self): self.one = './data/onetwothree1.wav' self.two = './data/onetwothree8.wav' self.digits_path = './data/digits'
class Toolconfig: def __init__(self): self.one = './data/onetwothree1.wav' self.two = './data/onetwothree8.wav' self.digits_path = './data/digits'
# # PySNMP MIB module SW-DES3x50-ACLMGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SW-DES3x50-ACLMGMT-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:12:30 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") ValueRangeConstraint, SingleValueConstraint, ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "SingleValueConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion") dlink_mgmt, = mibBuilder.importSymbols("DLINK-ID-REC-MIB", "dlink-mgmt") PortList, = mibBuilder.importSymbols("Q-BRIDGE-MIB", "PortList") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Counter64, NotificationType, iso, MibIdentifier, Integer32, IpAddress, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter32, Gauge32, ObjectIdentity, Bits, TimeTicks, ModuleIdentity, Unsigned32 = mibBuilder.importSymbols("SNMPv2-SMI", "Counter64", "NotificationType", "iso", "MibIdentifier", "Integer32", "IpAddress", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter32", "Gauge32", "ObjectIdentity", "Bits", "TimeTicks", "ModuleIdentity", "Unsigned32") DisplayString, RowStatus, TextualConvention, MacAddress = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "RowStatus", "TextualConvention", "MacAddress") swAclMgmtMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 171, 11, 5)) if mibBuilder.loadTexts: swAclMgmtMIB.setLastUpdated('0007150000Z') if mibBuilder.loadTexts: swAclMgmtMIB.setOrganization('enterprise, Inc.') if mibBuilder.loadTexts: swAclMgmtMIB.setContactInfo(' Customer Service Postal: Tel: E-mail: ') if mibBuilder.loadTexts: swAclMgmtMIB.setDescription('The Structure of Access Control List Information for the proprietary enterprise.') swAclMaskMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 11, 5, 1)) swAclRuleMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 11, 5, 2)) swACLEthernetTable = MibTable((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1), ) if mibBuilder.loadTexts: swACLEthernetTable.setStatus('current') if mibBuilder.loadTexts: swACLEthernetTable.setDescription("This table contain ACL mask of Ethernet information. Access profiles will be created on the switch by row creation and to define which parts of each incoming frame's layer 2 part of header the switch will examine. Masks can be entered that will be combined with the values the switch finds in the specified frame header fields. ") swACLEthernetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1), ).setIndexNames((0, "SW-DES3x50-ACLMGMT-MIB", "swACLEthernetProfileID")) if mibBuilder.loadTexts: swACLEthernetEntry.setStatus('current') if mibBuilder.loadTexts: swACLEthernetEntry.setDescription('A list of information about ACL of Ethernet.') swACLEthernetProfileID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLEthernetProfileID.setStatus('current') if mibBuilder.loadTexts: swACLEthernetProfileID.setDescription('The ID of ACL mask entry ,and is unique in the mask list.') swACLEthernetUsevlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetUsevlan.setStatus('current') if mibBuilder.loadTexts: swACLEthernetUsevlan.setDescription('Specifies that the switch will examine the VLAN part of each packet header.') swACLEthernetMacAddrMaskState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("dst-mac-addr", 2), ("src-mac-addr", 3), ("dst-src-mac-addr", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetMacAddrMaskState.setStatus('current') if mibBuilder.loadTexts: swACLEthernetMacAddrMaskState.setDescription("This object indicates the status of MAC address mask. other(1) - Neither source MAC address nor destination MAC address are masked. dst-mac-addr(2) - recieved frames's destination MAC address are currently used to be filtered as it meets with the MAC address entry of the table. src-mac-addr(3) - recieved frames's source MAC address are currently used to be filtered as it meets with the MAC address entry of the table. dst-src-mac-addr(4) - recieved frames's destination MAC address or source MAC address are currently used to be filtered as it meets with the MAC address entry of the table.") swACLEthernetSrcMacAddrMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 4), MacAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetSrcMacAddrMask.setStatus('current') if mibBuilder.loadTexts: swACLEthernetSrcMacAddrMask.setDescription('This object Specifies the MAC address mask for the source MAC address.') swACLEthernetDstMacAddrMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 5), MacAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetDstMacAddrMask.setStatus('current') if mibBuilder.loadTexts: swACLEthernetDstMacAddrMask.setDescription('This object Specifies the MAC address mask for the destination MAC address.') swACLEthernetUse8021p = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetUse8021p.setStatus('current') if mibBuilder.loadTexts: swACLEthernetUse8021p.setDescription("Specifies if the switch will examine the 802.1p priority value in the frame's header or not.") swACLEthernetUseEthernetType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetUseEthernetType.setStatus('current') if mibBuilder.loadTexts: swACLEthernetUseEthernetType.setDescription("Specifies if the switch will examine the Ethernet type value in each frame's header or not.") swACLEthernetPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 8), PortList().subtype(subtypeSpec=ValueSizeConstraint(0, 127))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetPort.setStatus('current') if mibBuilder.loadTexts: swACLEthernetPort.setDescription('.') swACLEthernetRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 9), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEthernetRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLEthernetRowStatus.setDescription('This object indicates the status of this entry.') swACLIpTable = MibTable((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2), ) if mibBuilder.loadTexts: swACLIpTable.setStatus('current') if mibBuilder.loadTexts: swACLIpTable.setDescription("This table contain ACL mask of IP information. Access profiles will be created on the switch by row creation and to define which parts of each incoming frame's IP layer part of header the switch will examine. Masks can be entered that will be combined with the values the switch finds in the specified frame header fields.") swACLIpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1), ).setIndexNames((0, "SW-DES3x50-ACLMGMT-MIB", "swACLIpProfileID")) if mibBuilder.loadTexts: swACLIpEntry.setStatus('current') if mibBuilder.loadTexts: swACLIpEntry.setDescription('A list of information about ACL of IP Layer.') swACLIpProfileID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLIpProfileID.setStatus('current') if mibBuilder.loadTexts: swACLIpProfileID.setDescription('The ID of ACL mask entry ,and is unique in the mask list.') swACLIpUsevlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpUsevlan.setStatus('current') if mibBuilder.loadTexts: swACLIpUsevlan.setDescription('This object indicates if IP layer vlan is examined or not.') swACLIpIpAddrMaskState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("dst-ip-addr", 2), ("src-ip-addr", 3), ("dst-src-ip-addr", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpIpAddrMaskState.setStatus('current') if mibBuilder.loadTexts: swACLIpIpAddrMaskState.setDescription("This object indicates the status of IP address mask. other(1) - Neither source IP address nor destination IP address are masked. dst-ip-addr(2) - recieved frames's destination IP address are currently used to be filtered as it meets with the IP address entry of the table. src-ip-addr(3) - recieved frames's source IP address are currently used to be filtered as it meets with the IP address entry of the table. dst-src-ip-addr(4) - recieved frames's destination IP address or source IP address are currently used to be filtered as it meets with the IP address entry of the table.") swACLIpSrcIpAddrMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 4), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpSrcIpAddrMask.setStatus('current') if mibBuilder.loadTexts: swACLIpSrcIpAddrMask.setDescription('This object Specifies IP address mask for the source IP address.') swACLIpDstIpAddrMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 5), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpDstIpAddrMask.setStatus('current') if mibBuilder.loadTexts: swACLIpDstIpAddrMask.setDescription('This object Specifies the IP address mask for the destination IP address.') swACLIpUseDSCP = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpUseDSCP.setStatus('current') if mibBuilder.loadTexts: swACLIpUseDSCP.setDescription('This object indicates DSCP protocol is is examined or not.') swACLIpUseProtoType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("none", 1), ("icmp", 2), ("igmp", 3), ("tcp", 4), ("udp", 5), ("protocolId", 6)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpUseProtoType.setStatus('current') if mibBuilder.loadTexts: swACLIpUseProtoType.setDescription('That object indicates which protocol will be examined.') swACLIpIcmpOption = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("none", 1), ("type", 2), ("code", 3), ("type-code", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpIcmpOption.setStatus('current') if mibBuilder.loadTexts: swACLIpIcmpOption.setDescription('This object indicates which fields should be filled in of ICMP. none(1)- two fields are null. type(2)- type field should be filled in. code(3)- code field should be filled in. type-code(4)- not only type fileld but code field should be filled in. ') swACLIpIgmpOption = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 9), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpIgmpOption.setStatus('current') if mibBuilder.loadTexts: swACLIpIgmpOption.setDescription('This object indicates Options of IGMP is examined or not.') swACLIpTcpOption = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("dst-addr", 2), ("src-addr", 3), ("dst-src-addr", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpTcpOption.setStatus('current') if mibBuilder.loadTexts: swACLIpTcpOption.setDescription("This object indicates the status of filtered address of TCP. other(1) - Neither source port nor destination port are masked. dst-addr(2) - recieved frames's destination port are currently used to be filtered . src-addr(3) - recieved frames's source port are currently used to be filtered . dst-src-addr(4) - both recieved frames's destination port and source port are currently used to be filtered .") swACLIpUdpOption = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("other", 1), ("dst-addr", 2), ("src-addr", 3), ("dst-src-addr", 4)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpUdpOption.setStatus('current') if mibBuilder.loadTexts: swACLIpUdpOption.setDescription("This object indicates the status of filtered address of UDP . other(1) - Neither source port nor destination port are masked. dst-addr(2) - recieved frames's destination port are currently used to be filtered . src-addr(3) - recieved frames's source port are currently used to be filtered . dst-src-addr(4) - recieved frames's destination port or source port are currently used to be filtered.") swACLIpTCPorUDPSrcPortMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 12), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpTCPorUDPSrcPortMask.setStatus('current') if mibBuilder.loadTexts: swACLIpTCPorUDPSrcPortMask.setDescription('Specifies a TCP port mask for the source port if swACLIpUseProtoType is TCP Specifies a UDP port mask for the source port if swACLIpUseProtoType is UDP. ') swACLIpTCPorUDPDstPortMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 13), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpTCPorUDPDstPortMask.setStatus('current') if mibBuilder.loadTexts: swACLIpTCPorUDPDstPortMask.setDescription('Specifies a TCP port mask for the destination port if swACLIpUseProtoType is TCP Specifies a UDP port mask for the destination port if swACLIpUseProtoType is UDP.') swACLIpTCPFlagBit = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpTCPFlagBit.setStatus('current') if mibBuilder.loadTexts: swACLIpTCPFlagBit.setDescription('Specifies a TCP connection flag mask.') swACLIpProtoIDOption = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enable", 1), ("disable", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpProtoIDOption.setStatus('current') if mibBuilder.loadTexts: swACLIpProtoIDOption.setDescription("Specifies that the switch will examine each frame's Protocol ID field or not.") swACLIpProtoIDMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 16), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpProtoIDMask.setStatus('current') if mibBuilder.loadTexts: swACLIpProtoIDMask.setDescription('Specifies that the rule applies to the IP protocol ID and the mask options behind the IP header.') swACLIpPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 17), PortList().subtype(subtypeSpec=ValueSizeConstraint(0, 127))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpPort.setStatus('current') if mibBuilder.loadTexts: swACLIpPort.setDescription('.') swACLIpRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 18), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLIpRowStatus.setDescription('This object indicates the status of this entry.') swACLPayloadTable = MibTable((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3), ) if mibBuilder.loadTexts: swACLPayloadTable.setStatus('current') if mibBuilder.loadTexts: swACLPayloadTable.setDescription('') swACLPayloadEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1), ).setIndexNames((0, "SW-DES3x50-ACLMGMT-MIB", "swACLPayloadProfileID")) if mibBuilder.loadTexts: swACLPayloadEntry.setStatus('current') if mibBuilder.loadTexts: swACLPayloadEntry.setDescription('') swACLPayloadProfileID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLPayloadProfileID.setStatus('current') if mibBuilder.loadTexts: swACLPayloadProfileID.setDescription('.') swACLPayloadOffSet0to15 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadOffSet0to15.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet0to15.setDescription('.') swACLPayloadOffSet16to31 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadOffSet16to31.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet16to31.setDescription('.') swACLPayloadOffSet32to47 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadOffSet32to47.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet32to47.setDescription('.') swACLPayloadOffSet48to63 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadOffSet48to63.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet48to63.setDescription('.') swACLPayloadOffSet64to79 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadOffSet64to79.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet64to79.setDescription('.') swACLPayloadPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 7), PortList().subtype(subtypeSpec=ValueSizeConstraint(0, 127))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadPort.setStatus('current') if mibBuilder.loadTexts: swACLPayloadPort.setDescription('.') swACLPayloadRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 8), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRowStatus.setDescription('.') swACLEtherRuleTable = MibTable((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1), ) if mibBuilder.loadTexts: swACLEtherRuleTable.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleTable.setDescription('This table contain ACL rule of ethernet information.') swACLEtherRuleEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1), ).setIndexNames((0, "SW-DES3x50-ACLMGMT-MIB", "swACLEtherRuleProfileID"), (0, "SW-DES3x50-ACLMGMT-MIB", "swACLEtherRuleAccessID")) if mibBuilder.loadTexts: swACLEtherRuleEntry.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleEntry.setDescription('A list of information about ACL rule of the layer 2 part of each packet.') swACLEtherRuleProfileID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLEtherRuleProfileID.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleProfileID.setDescription('The ID of ACL mask entry ,and is unique in the mask list.') swACLEtherRuleAccessID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLEtherRuleAccessID.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleAccessID.setDescription('The ID of ACL rule entry relate to swACLEtherRuleProfileID.') swACLEtherRuleVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 3), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleVlan.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleVlan.setDescription('Specifies that the access will apply to only to this VLAN.') swACLEtherRuleSrcMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 4), MacAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleSrcMacAddress.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleSrcMacAddress.setDescription('Specifies that the access will apply to only packets with this source MAC address.') swACLEtherRuleDstMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 5), MacAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleDstMacAddress.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleDstMacAddress.setDescription('Specifies that the access will apply to only packets with this destination MAC address.') swACLEtherRule8021P = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRule8021P.setStatus('current') if mibBuilder.loadTexts: swACLEtherRule8021P.setDescription('Specifies that the access will apply only to packets with this 802.1p priority value.') swACLEtherRuleEtherType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(2, 2)).setFixedLength(2)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleEtherType.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleEtherType.setDescription('Specifies that the access will apply only to packets with this hexidecimal 802.1Q Ethernet type value in the packet header.') swACLEtherRuleEnablePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleEnablePriority.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleEnablePriority.setDescription('Specifies that the access will apply only to packets with priority value.') swACLEtherRulePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRulePriority.setStatus('current') if mibBuilder.loadTexts: swACLEtherRulePriority.setDescription('Specific the priority will change to the packets while the swACLEtherRuleReplacePriority is enabled .') swACLEtherRuleReplacePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleReplacePriority.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleReplacePriority.setDescription('Specific the packets that match the access profile will changed the 802.1p priority tag field by the switch or not .') swACLEtherRuleEnableReplaceDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleEnableReplaceDscp.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleEnableReplaceDscp.setDescription('Specific the packets that match the access profile will replaced the DSCP field by the switch or not .') swACLEtherRuleRepDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleRepDscp.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleRepDscp.setDescription('specify a value to be written to the DSCP field of an incoming packet that meets the criteria specified in the first part of the command. This value will over-write the value in the DSCP field of the packet.') swACLEtherRulePermit = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("permit", 1), ("deny", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRulePermit.setStatus('current') if mibBuilder.loadTexts: swACLEtherRulePermit.setDescription('This object indicates resoult of examination is permit or deny;default is permit(1) permit - Specifies that packets that match the access profile are permitted to be forwarded by the switch. deny - Specifies that packets that do not match the access profile are not permitted to be forwarded by the switch and will be filtered.') swACLEtherRuleRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 14), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLEtherRuleRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleRowStatus.setDescription('This object indicates the status of this entry.') swACLIpRuleTable = MibTable((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2), ) if mibBuilder.loadTexts: swACLIpRuleTable.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleTable.setDescription('.') swACLIpRuleEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1), ).setIndexNames((0, "SW-DES3x50-ACLMGMT-MIB", "swACLIpRuleProfileID"), (0, "SW-DES3x50-ACLMGMT-MIB", "swACLIpRuleAccessID")) if mibBuilder.loadTexts: swACLIpRuleEntry.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleEntry.setDescription('.') swACLIpRuleProfileID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLIpRuleProfileID.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleProfileID.setDescription('The ID of ACL mask entry ,and is unique in the mask list.') swACLIpRuleAccessID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLIpRuleAccessID.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleAccessID.setDescription('The ID of ACL IP rule entry .') swACLIpRuleVlan = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 3), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(1, 32))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleVlan.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleVlan.setDescription('Specifies that the access will apply to only to this VLAN.') swACLIpRuleSrcIpaddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 4), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleSrcIpaddress.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleSrcIpaddress.setDescription('Specific an IP source address.') swACLIpRuleDstIpaddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 5), IpAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleDstIpaddress.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleDstIpaddress.setDescription('Specific an IP destination address.') swACLIpRuleDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleDscp.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleDscp.setDescription('Specific the value of dscp, the value can be configured 0 to 63') swACLIpRuleProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5, 6))).clone(namedValues=NamedValues(("none", 1), ("icmp", 2), ("igmp", 3), ("tcp", 4), ("udp", 5), ("protocolId", 6)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLIpRuleProtocol.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleProtocol.setDescription('Specifies the IP protocol which has been configured in swACLIpEntry .') swACLIpRuleType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleType.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleType.setDescription('Specific that the rule applies to the value of icmp type traffic.') swACLIpRuleCode = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleCode.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleCode.setDescription('Specific that the rule applies to the value of icmp code traffic.') swACLIpRuleSrcPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleSrcPort.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleSrcPort.setDescription('Specific that the rule applies the range of tcp/udp source port') swACLIpRuleDstPort = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 65535))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleDstPort.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleDstPort.setDescription('Specific the range of tcp/udp destination port range') swACLIpRuleFlagBits = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleFlagBits.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleFlagBits.setDescription('A value which indicates the set of TCP flags that this entity may potentially offers. The value is a sum. This sum initially takes the value zero, Then, for each flag, L, in the range 1 through 6, that this node performs transactions for, 2 raised to (L - 1) is added to the sum. Note that values should be calculated accordingly: Flag functionality 6 urg bit 5 ack bit 4 rsh bit 3 rst bit 2 syn bit 1 fin bit For example,it you want to enable urg bit and ack bit,you should set vlaue 48(2^(5-1) + 2^(6-1)).') swACLIpRuleProtoID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleProtoID.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleProtoID.setDescription('Specific that the rule applies to the value of ip protocol id traffic') swACLIpRuleUserMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 14), OctetString().subtype(subtypeSpec=ValueSizeConstraint(4, 4)).setFixedLength(4)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleUserMask.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleUserMask.setDescription('Specific that the rule applies to the ip protocol id and the range of options behind the IP header.') swACLIpRuleEnablePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 15), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleEnablePriority.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleEnablePriority.setDescription('Specifies that the access will apply only to packets with priority value.') swACLIpRulePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRulePriority.setStatus('current') if mibBuilder.loadTexts: swACLIpRulePriority.setDescription('Specifies that the access profile will apply to packets that contain this value in their 802.1p priority field of their header.') swACLIpRuleReplacePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 17), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleReplacePriority.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleReplacePriority.setDescription('Specific the packets that match the access profile will changed the 802.1p priority tag field by the switch or not .') swACLIpRuleEnableReplaceDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleEnableReplaceDscp.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleEnableReplaceDscp.setDescription('Indicate weather the DSCP field can be over-write or not. ') swACLIpRuleRepDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleRepDscp.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleRepDscp.setDescription('specify a value to be written to the DSCP field of an incoming packet that meets the criteria specified in the first part of the command. This value will over-write the value in the DSCP field of the packet.') swACLIpRulePermit = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 20), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("deny", 1), ("permit", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRulePermit.setStatus('current') if mibBuilder.loadTexts: swACLIpRulePermit.setDescription('This object indicates filter is permit or deny; default is permit(1)') swACLIpRuleRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 21), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLIpRuleRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleRowStatus.setDescription('This object indicates the status of this entry.') swACLPayloadRuleTable = MibTable((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3), ) if mibBuilder.loadTexts: swACLPayloadRuleTable.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleTable.setDescription('') swACLPayloadRuleEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1), ).setIndexNames((0, "SW-DES3x50-ACLMGMT-MIB", "swACLPayloadRuleProfileID"), (0, "SW-DES3x50-ACLMGMT-MIB", "swACLPayloadRuleAccessID")) if mibBuilder.loadTexts: swACLPayloadRuleEntry.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleEntry.setDescription('') swACLPayloadRuleProfileID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLPayloadRuleProfileID.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleProfileID.setDescription('') swACLPayloadRuleAccessID = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 255))).setMaxAccess("readonly") if mibBuilder.loadTexts: swACLPayloadRuleAccessID.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleAccessID.setDescription('') swACLPayloadRuleOffSet0to15 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleOffSet0to15.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet0to15.setDescription('') swACLPayloadRuleOffSet16to31 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleOffSet16to31.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet16to31.setDescription('') swACLPayloadRuleOffSet32to47 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 5), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleOffSet32to47.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet32to47.setDescription('') swACLPayloadRuleOffSet48to63 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 6), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleOffSet48to63.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet48to63.setDescription('') swACLPayloadRuleOffSet64to79 = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 7), OctetString().subtype(subtypeSpec=ValueSizeConstraint(16, 16)).setFixedLength(16)).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleOffSet64to79.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet64to79.setDescription('') swACLPayloadRuleEnablePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 8), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleEnablePriority.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleEnablePriority.setDescription('') swACLPayloadRulePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRulePriority.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRulePriority.setDescription('Specifies that the access profile will apply to packets that contain this value in their 802.1p priority field of their header.') swACLPayloadRuleReplacePriority = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 10), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleReplacePriority.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleReplacePriority.setDescription('') swACLPayloadRuleEnableReplaceDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleEnableReplaceDscp.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleEnableReplaceDscp.setDescription('Indicate wether the DSCP field can be over-write or not ') swACLPayloadRuleRepDscp = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 63))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleRepDscp.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleRepDscp.setDescription('specify a value to be written to the DSCP field of an incoming packet that meets the criteria specified in the first part of the command. This value will over-write the value in the DSCP field of the packet.') swACLPayloadRulePermit = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("permit", 1), ("deny", 2)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRulePermit.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRulePermit.setDescription('') swACLPayloadRuleRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 14), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swACLPayloadRuleRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleRowStatus.setDescription('') mibBuilder.exportSymbols("SW-DES3x50-ACLMGMT-MIB", swACLIpUseDSCP=swACLIpUseDSCP, swACLIpRuleFlagBits=swACLIpRuleFlagBits, swACLEthernetPort=swACLEthernetPort, swACLIpRuleEntry=swACLIpRuleEntry, swACLIpUdpOption=swACLIpUdpOption, swACLIpRuleSrcPort=swACLIpRuleSrcPort, swACLPayloadRuleEnablePriority=swACLPayloadRuleEnablePriority, swACLPayloadOffSet48to63=swACLPayloadOffSet48to63, swACLIpTCPorUDPDstPortMask=swACLIpTCPorUDPDstPortMask, swACLPayloadOffSet64to79=swACLPayloadOffSet64to79, swACLPayloadRuleOffSet16to31=swACLPayloadRuleOffSet16to31, swACLIpIgmpOption=swACLIpIgmpOption, swACLEtherRuleDstMacAddress=swACLEtherRuleDstMacAddress, swAclMgmtMIB=swAclMgmtMIB, swACLIpRulePermit=swACLIpRulePermit, swACLIpRuleProtocol=swACLIpRuleProtocol, swACLIpUsevlan=swACLIpUsevlan, swACLPayloadRulePriority=swACLPayloadRulePriority, swACLIpRuleDstIpaddress=swACLIpRuleDstIpaddress, swACLIpEntry=swACLIpEntry, swACLIpRuleEnableReplaceDscp=swACLIpRuleEnableReplaceDscp, swACLIpSrcIpAddrMask=swACLIpSrcIpAddrMask, swACLEtherRuleRowStatus=swACLEtherRuleRowStatus, swACLIpRuleEnablePriority=swACLIpRuleEnablePriority, swACLIpRuleType=swACLIpRuleType, swACLIpRuleUserMask=swACLIpRuleUserMask, swACLIpUseProtoType=swACLIpUseProtoType, swACLIpRulePriority=swACLIpRulePriority, swACLIpRuleSrcIpaddress=swACLIpRuleSrcIpaddress, swACLPayloadProfileID=swACLPayloadProfileID, swACLEthernetTable=swACLEthernetTable, swACLIpTCPorUDPSrcPortMask=swACLIpTCPorUDPSrcPortMask, swACLPayloadPort=swACLPayloadPort, swACLPayloadRuleOffSet32to47=swACLPayloadRuleOffSet32to47, swAclMaskMgmt=swAclMaskMgmt, swACLPayloadRuleRowStatus=swACLPayloadRuleRowStatus, swACLEthernetRowStatus=swACLEthernetRowStatus, swACLEtherRuleEntry=swACLEtherRuleEntry, swACLIpRuleAccessID=swACLIpRuleAccessID, swACLIpTable=swACLIpTable, swACLEthernetUseEthernetType=swACLEthernetUseEthernetType, swACLIpTcpOption=swACLIpTcpOption, swACLEtherRuleTable=swACLEtherRuleTable, swACLIpRuleCode=swACLIpRuleCode, swACLEthernetProfileID=swACLEthernetProfileID, swAclRuleMgmt=swAclRuleMgmt, swACLEthernetSrcMacAddrMask=swACLEthernetSrcMacAddrMask, swACLPayloadOffSet16to31=swACLPayloadOffSet16to31, swACLPayloadRuleOffSet64to79=swACLPayloadRuleOffSet64to79, swACLIpTCPFlagBit=swACLIpTCPFlagBit, swACLPayloadRuleTable=swACLPayloadRuleTable, swACLEthernetEntry=swACLEthernetEntry, swACLEtherRuleSrcMacAddress=swACLEtherRuleSrcMacAddress, PYSNMP_MODULE_ID=swAclMgmtMIB, swACLEthernetUse8021p=swACLEthernetUse8021p, swACLPayloadRuleEnableReplaceDscp=swACLPayloadRuleEnableReplaceDscp, swACLPayloadOffSet0to15=swACLPayloadOffSet0to15, swACLIpRuleVlan=swACLIpRuleVlan, swACLIpProtoIDMask=swACLIpProtoIDMask, swACLPayloadRulePermit=swACLPayloadRulePermit, swACLPayloadRuleEntry=swACLPayloadRuleEntry, swACLEthernetMacAddrMaskState=swACLEthernetMacAddrMaskState, swACLEtherRuleReplacePriority=swACLEtherRuleReplacePriority, swACLEtherRuleRepDscp=swACLEtherRuleRepDscp, swACLEtherRule8021P=swACLEtherRule8021P, swACLIpRowStatus=swACLIpRowStatus, swACLPayloadRuleOffSet48to63=swACLPayloadRuleOffSet48to63, swACLIpDstIpAddrMask=swACLIpDstIpAddrMask, swACLPayloadTable=swACLPayloadTable, swACLIpProtoIDOption=swACLIpProtoIDOption, swACLEtherRuleProfileID=swACLEtherRuleProfileID, swACLIpRuleTable=swACLIpRuleTable, swACLEtherRuleVlan=swACLEtherRuleVlan, swACLPayloadEntry=swACLPayloadEntry, swACLPayloadRuleAccessID=swACLPayloadRuleAccessID, swACLEthernetUsevlan=swACLEthernetUsevlan, swACLPayloadOffSet32to47=swACLPayloadOffSet32to47, swACLIpRuleRowStatus=swACLIpRuleRowStatus, swACLEtherRuleEnablePriority=swACLEtherRuleEnablePriority, swACLIpPort=swACLIpPort, swACLPayloadRuleReplacePriority=swACLPayloadRuleReplacePriority, swACLEtherRulePriority=swACLEtherRulePriority, swACLIpRuleDstPort=swACLIpRuleDstPort, swACLIpRuleRepDscp=swACLIpRuleRepDscp, swACLPayloadRowStatus=swACLPayloadRowStatus, swACLEtherRuleEnableReplaceDscp=swACLEtherRuleEnableReplaceDscp, swACLEthernetDstMacAddrMask=swACLEthernetDstMacAddrMask, swACLIpProfileID=swACLIpProfileID, swACLIpRuleProfileID=swACLIpRuleProfileID, swACLPayloadRuleRepDscp=swACLPayloadRuleRepDscp, swACLIpRuleProtoID=swACLIpRuleProtoID, swACLEtherRuleAccessID=swACLEtherRuleAccessID, swACLEtherRulePermit=swACLEtherRulePermit, swACLIpIcmpOption=swACLIpIcmpOption, swACLIpIpAddrMaskState=swACLIpIpAddrMaskState, swACLEtherRuleEtherType=swACLEtherRuleEtherType, swACLPayloadRuleProfileID=swACLPayloadRuleProfileID, swACLPayloadRuleOffSet0to15=swACLPayloadRuleOffSet0to15, swACLIpRuleReplacePriority=swACLIpRuleReplacePriority, swACLIpRuleDscp=swACLIpRuleDscp)
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ValueRangeConstraint', 'SingleValueConstraint', 'ValueSizeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion') (dlink_mgmt,) = mibBuilder.importSymbols('DLINK-ID-REC-MIB', 'dlink-mgmt') (port_list,) = mibBuilder.importSymbols('Q-BRIDGE-MIB', 'PortList') (snmp_admin_string,) = mibBuilder.importSymbols('SNMP-FRAMEWORK-MIB', 'SnmpAdminString') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (counter64, notification_type, iso, mib_identifier, integer32, ip_address, mib_scalar, mib_table, mib_table_row, mib_table_column, counter32, gauge32, object_identity, bits, time_ticks, module_identity, unsigned32) = mibBuilder.importSymbols('SNMPv2-SMI', 'Counter64', 'NotificationType', 'iso', 'MibIdentifier', 'Integer32', 'IpAddress', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'Counter32', 'Gauge32', 'ObjectIdentity', 'Bits', 'TimeTicks', 'ModuleIdentity', 'Unsigned32') (display_string, row_status, textual_convention, mac_address) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'RowStatus', 'TextualConvention', 'MacAddress') sw_acl_mgmt_mib = module_identity((1, 3, 6, 1, 4, 1, 171, 11, 5)) if mibBuilder.loadTexts: swAclMgmtMIB.setLastUpdated('0007150000Z') if mibBuilder.loadTexts: swAclMgmtMIB.setOrganization('enterprise, Inc.') if mibBuilder.loadTexts: swAclMgmtMIB.setContactInfo(' Customer Service Postal: Tel: E-mail: ') if mibBuilder.loadTexts: swAclMgmtMIB.setDescription('The Structure of Access Control List Information for the proprietary enterprise.') sw_acl_mask_mgmt = mib_identifier((1, 3, 6, 1, 4, 1, 171, 11, 5, 1)) sw_acl_rule_mgmt = mib_identifier((1, 3, 6, 1, 4, 1, 171, 11, 5, 2)) sw_acl_ethernet_table = mib_table((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1)) if mibBuilder.loadTexts: swACLEthernetTable.setStatus('current') if mibBuilder.loadTexts: swACLEthernetTable.setDescription("This table contain ACL mask of Ethernet information. Access profiles will be created on the switch by row creation and to define which parts of each incoming frame's layer 2 part of header the switch will examine. Masks can be entered that will be combined with the values the switch finds in the specified frame header fields. ") sw_acl_ethernet_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1)).setIndexNames((0, 'SW-DES3x50-ACLMGMT-MIB', 'swACLEthernetProfileID')) if mibBuilder.loadTexts: swACLEthernetEntry.setStatus('current') if mibBuilder.loadTexts: swACLEthernetEntry.setDescription('A list of information about ACL of Ethernet.') sw_acl_ethernet_profile_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: swACLEthernetProfileID.setStatus('current') if mibBuilder.loadTexts: swACLEthernetProfileID.setDescription('The ID of ACL mask entry ,and is unique in the mask list.') sw_acl_ethernet_usevlan = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEthernetUsevlan.setStatus('current') if mibBuilder.loadTexts: swACLEthernetUsevlan.setDescription('Specifies that the switch will examine the VLAN part of each packet header.') sw_acl_ethernet_mac_addr_mask_state = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('other', 1), ('dst-mac-addr', 2), ('src-mac-addr', 3), ('dst-src-mac-addr', 4)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEthernetMacAddrMaskState.setStatus('current') if mibBuilder.loadTexts: swACLEthernetMacAddrMaskState.setDescription("This object indicates the status of MAC address mask. other(1) - Neither source MAC address nor destination MAC address are masked. dst-mac-addr(2) - recieved frames's destination MAC address are currently used to be filtered as it meets with the MAC address entry of the table. src-mac-addr(3) - recieved frames's source MAC address are currently used to be filtered as it meets with the MAC address entry of the table. dst-src-mac-addr(4) - recieved frames's destination MAC address or source MAC address are currently used to be filtered as it meets with the MAC address entry of the table.") sw_acl_ethernet_src_mac_addr_mask = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 4), mac_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEthernetSrcMacAddrMask.setStatus('current') if mibBuilder.loadTexts: swACLEthernetSrcMacAddrMask.setDescription('This object Specifies the MAC address mask for the source MAC address.') sw_acl_ethernet_dst_mac_addr_mask = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 5), mac_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEthernetDstMacAddrMask.setStatus('current') if mibBuilder.loadTexts: swACLEthernetDstMacAddrMask.setDescription('This object Specifies the MAC address mask for the destination MAC address.') sw_acl_ethernet_use8021p = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEthernetUse8021p.setStatus('current') if mibBuilder.loadTexts: swACLEthernetUse8021p.setDescription("Specifies if the switch will examine the 802.1p priority value in the frame's header or not.") sw_acl_ethernet_use_ethernet_type = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEthernetUseEthernetType.setStatus('current') if mibBuilder.loadTexts: swACLEthernetUseEthernetType.setDescription("Specifies if the switch will examine the Ethernet type value in each frame's header or not.") sw_acl_ethernet_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 8), port_list().subtype(subtypeSpec=value_size_constraint(0, 127))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEthernetPort.setStatus('current') if mibBuilder.loadTexts: swACLEthernetPort.setDescription('.') sw_acl_ethernet_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 1, 1, 9), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEthernetRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLEthernetRowStatus.setDescription('This object indicates the status of this entry.') sw_acl_ip_table = mib_table((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2)) if mibBuilder.loadTexts: swACLIpTable.setStatus('current') if mibBuilder.loadTexts: swACLIpTable.setDescription("This table contain ACL mask of IP information. Access profiles will be created on the switch by row creation and to define which parts of each incoming frame's IP layer part of header the switch will examine. Masks can be entered that will be combined with the values the switch finds in the specified frame header fields.") sw_acl_ip_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1)).setIndexNames((0, 'SW-DES3x50-ACLMGMT-MIB', 'swACLIpProfileID')) if mibBuilder.loadTexts: swACLIpEntry.setStatus('current') if mibBuilder.loadTexts: swACLIpEntry.setDescription('A list of information about ACL of IP Layer.') sw_acl_ip_profile_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: swACLIpProfileID.setStatus('current') if mibBuilder.loadTexts: swACLIpProfileID.setDescription('The ID of ACL mask entry ,and is unique in the mask list.') sw_acl_ip_usevlan = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpUsevlan.setStatus('current') if mibBuilder.loadTexts: swACLIpUsevlan.setDescription('This object indicates if IP layer vlan is examined or not.') sw_acl_ip_ip_addr_mask_state = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('other', 1), ('dst-ip-addr', 2), ('src-ip-addr', 3), ('dst-src-ip-addr', 4)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpIpAddrMaskState.setStatus('current') if mibBuilder.loadTexts: swACLIpIpAddrMaskState.setDescription("This object indicates the status of IP address mask. other(1) - Neither source IP address nor destination IP address are masked. dst-ip-addr(2) - recieved frames's destination IP address are currently used to be filtered as it meets with the IP address entry of the table. src-ip-addr(3) - recieved frames's source IP address are currently used to be filtered as it meets with the IP address entry of the table. dst-src-ip-addr(4) - recieved frames's destination IP address or source IP address are currently used to be filtered as it meets with the IP address entry of the table.") sw_acl_ip_src_ip_addr_mask = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 4), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpSrcIpAddrMask.setStatus('current') if mibBuilder.loadTexts: swACLIpSrcIpAddrMask.setDescription('This object Specifies IP address mask for the source IP address.') sw_acl_ip_dst_ip_addr_mask = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 5), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpDstIpAddrMask.setStatus('current') if mibBuilder.loadTexts: swACLIpDstIpAddrMask.setDescription('This object Specifies the IP address mask for the destination IP address.') sw_acl_ip_use_dscp = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpUseDSCP.setStatus('current') if mibBuilder.loadTexts: swACLIpUseDSCP.setDescription('This object indicates DSCP protocol is is examined or not.') sw_acl_ip_use_proto_type = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('none', 1), ('icmp', 2), ('igmp', 3), ('tcp', 4), ('udp', 5), ('protocolId', 6)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpUseProtoType.setStatus('current') if mibBuilder.loadTexts: swACLIpUseProtoType.setDescription('That object indicates which protocol will be examined.') sw_acl_ip_icmp_option = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('none', 1), ('type', 2), ('code', 3), ('type-code', 4)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpIcmpOption.setStatus('current') if mibBuilder.loadTexts: swACLIpIcmpOption.setDescription('This object indicates which fields should be filled in of ICMP. none(1)- two fields are null. type(2)- type field should be filled in. code(3)- code field should be filled in. type-code(4)- not only type fileld but code field should be filled in. ') sw_acl_ip_igmp_option = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 9), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpIgmpOption.setStatus('current') if mibBuilder.loadTexts: swACLIpIgmpOption.setDescription('This object indicates Options of IGMP is examined or not.') sw_acl_ip_tcp_option = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('other', 1), ('dst-addr', 2), ('src-addr', 3), ('dst-src-addr', 4)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpTcpOption.setStatus('current') if mibBuilder.loadTexts: swACLIpTcpOption.setDescription("This object indicates the status of filtered address of TCP. other(1) - Neither source port nor destination port are masked. dst-addr(2) - recieved frames's destination port are currently used to be filtered . src-addr(3) - recieved frames's source port are currently used to be filtered . dst-src-addr(4) - both recieved frames's destination port and source port are currently used to be filtered .") sw_acl_ip_udp_option = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('other', 1), ('dst-addr', 2), ('src-addr', 3), ('dst-src-addr', 4)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpUdpOption.setStatus('current') if mibBuilder.loadTexts: swACLIpUdpOption.setDescription("This object indicates the status of filtered address of UDP . other(1) - Neither source port nor destination port are masked. dst-addr(2) - recieved frames's destination port are currently used to be filtered . src-addr(3) - recieved frames's source port are currently used to be filtered . dst-src-addr(4) - recieved frames's destination port or source port are currently used to be filtered.") sw_acl_ip_tc_por_udp_src_port_mask = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 12), octet_string().subtype(subtypeSpec=value_size_constraint(2, 2)).setFixedLength(2)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpTCPorUDPSrcPortMask.setStatus('current') if mibBuilder.loadTexts: swACLIpTCPorUDPSrcPortMask.setDescription('Specifies a TCP port mask for the source port if swACLIpUseProtoType is TCP Specifies a UDP port mask for the source port if swACLIpUseProtoType is UDP. ') sw_acl_ip_tc_por_udp_dst_port_mask = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 13), octet_string().subtype(subtypeSpec=value_size_constraint(2, 2)).setFixedLength(2)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpTCPorUDPDstPortMask.setStatus('current') if mibBuilder.loadTexts: swACLIpTCPorUDPDstPortMask.setDescription('Specifies a TCP port mask for the destination port if swACLIpUseProtoType is TCP Specifies a UDP port mask for the destination port if swACLIpUseProtoType is UDP.') sw_acl_ip_tcp_flag_bit = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 14), integer32().subtype(subtypeSpec=value_range_constraint(0, 63))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpTCPFlagBit.setStatus('current') if mibBuilder.loadTexts: swACLIpTCPFlagBit.setDescription('Specifies a TCP connection flag mask.') sw_acl_ip_proto_id_option = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enable', 1), ('disable', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpProtoIDOption.setStatus('current') if mibBuilder.loadTexts: swACLIpProtoIDOption.setDescription("Specifies that the switch will examine each frame's Protocol ID field or not.") sw_acl_ip_proto_id_mask = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 16), octet_string().subtype(subtypeSpec=value_size_constraint(4, 4)).setFixedLength(4)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpProtoIDMask.setStatus('current') if mibBuilder.loadTexts: swACLIpProtoIDMask.setDescription('Specifies that the rule applies to the IP protocol ID and the mask options behind the IP header.') sw_acl_ip_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 17), port_list().subtype(subtypeSpec=value_size_constraint(0, 127))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpPort.setStatus('current') if mibBuilder.loadTexts: swACLIpPort.setDescription('.') sw_acl_ip_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 2, 1, 18), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLIpRowStatus.setDescription('This object indicates the status of this entry.') sw_acl_payload_table = mib_table((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3)) if mibBuilder.loadTexts: swACLPayloadTable.setStatus('current') if mibBuilder.loadTexts: swACLPayloadTable.setDescription('') sw_acl_payload_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1)).setIndexNames((0, 'SW-DES3x50-ACLMGMT-MIB', 'swACLPayloadProfileID')) if mibBuilder.loadTexts: swACLPayloadEntry.setStatus('current') if mibBuilder.loadTexts: swACLPayloadEntry.setDescription('') sw_acl_payload_profile_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: swACLPayloadProfileID.setStatus('current') if mibBuilder.loadTexts: swACLPayloadProfileID.setDescription('.') sw_acl_payload_off_set0to15 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 2), octet_string().subtype(subtypeSpec=value_size_constraint(16, 16)).setFixedLength(16)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadOffSet0to15.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet0to15.setDescription('.') sw_acl_payload_off_set16to31 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(16, 16)).setFixedLength(16)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadOffSet16to31.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet16to31.setDescription('.') sw_acl_payload_off_set32to47 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 4), octet_string().subtype(subtypeSpec=value_size_constraint(16, 16)).setFixedLength(16)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadOffSet32to47.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet32to47.setDescription('.') sw_acl_payload_off_set48to63 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 5), octet_string().subtype(subtypeSpec=value_size_constraint(16, 16)).setFixedLength(16)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadOffSet48to63.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet48to63.setDescription('.') sw_acl_payload_off_set64to79 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 6), octet_string().subtype(subtypeSpec=value_size_constraint(16, 16)).setFixedLength(16)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadOffSet64to79.setStatus('current') if mibBuilder.loadTexts: swACLPayloadOffSet64to79.setDescription('.') sw_acl_payload_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 7), port_list().subtype(subtypeSpec=value_size_constraint(0, 127))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadPort.setStatus('current') if mibBuilder.loadTexts: swACLPayloadPort.setDescription('.') sw_acl_payload_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 1, 3, 1, 8), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRowStatus.setDescription('.') sw_acl_ether_rule_table = mib_table((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1)) if mibBuilder.loadTexts: swACLEtherRuleTable.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleTable.setDescription('This table contain ACL rule of ethernet information.') sw_acl_ether_rule_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1)).setIndexNames((0, 'SW-DES3x50-ACLMGMT-MIB', 'swACLEtherRuleProfileID'), (0, 'SW-DES3x50-ACLMGMT-MIB', 'swACLEtherRuleAccessID')) if mibBuilder.loadTexts: swACLEtherRuleEntry.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleEntry.setDescription('A list of information about ACL rule of the layer 2 part of each packet.') sw_acl_ether_rule_profile_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: swACLEtherRuleProfileID.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleProfileID.setDescription('The ID of ACL mask entry ,and is unique in the mask list.') sw_acl_ether_rule_access_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: swACLEtherRuleAccessID.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleAccessID.setDescription('The ID of ACL rule entry relate to swACLEtherRuleProfileID.') sw_acl_ether_rule_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 3), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(1, 32))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEtherRuleVlan.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleVlan.setDescription('Specifies that the access will apply to only to this VLAN.') sw_acl_ether_rule_src_mac_address = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 4), mac_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEtherRuleSrcMacAddress.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleSrcMacAddress.setDescription('Specifies that the access will apply to only packets with this source MAC address.') sw_acl_ether_rule_dst_mac_address = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 5), mac_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEtherRuleDstMacAddress.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleDstMacAddress.setDescription('Specifies that the access will apply to only packets with this destination MAC address.') sw_acl_ether_rule8021_p = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEtherRule8021P.setStatus('current') if mibBuilder.loadTexts: swACLEtherRule8021P.setDescription('Specifies that the access will apply only to packets with this 802.1p priority value.') sw_acl_ether_rule_ether_type = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 7), octet_string().subtype(subtypeSpec=value_size_constraint(2, 2)).setFixedLength(2)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEtherRuleEtherType.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleEtherType.setDescription('Specifies that the access will apply only to packets with this hexidecimal 802.1Q Ethernet type value in the packet header.') sw_acl_ether_rule_enable_priority = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEtherRuleEnablePriority.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleEnablePriority.setDescription('Specifies that the access will apply only to packets with priority value.') sw_acl_ether_rule_priority = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEtherRulePriority.setStatus('current') if mibBuilder.loadTexts: swACLEtherRulePriority.setDescription('Specific the priority will change to the packets while the swACLEtherRuleReplacePriority is enabled .') sw_acl_ether_rule_replace_priority = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEtherRuleReplacePriority.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleReplacePriority.setDescription('Specific the packets that match the access profile will changed the 802.1p priority tag field by the switch or not .') sw_acl_ether_rule_enable_replace_dscp = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEtherRuleEnableReplaceDscp.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleEnableReplaceDscp.setDescription('Specific the packets that match the access profile will replaced the DSCP field by the switch or not .') sw_acl_ether_rule_rep_dscp = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(0, 63))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEtherRuleRepDscp.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleRepDscp.setDescription('specify a value to be written to the DSCP field of an incoming packet that meets the criteria specified in the first part of the command. This value will over-write the value in the DSCP field of the packet.') sw_acl_ether_rule_permit = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('permit', 1), ('deny', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEtherRulePermit.setStatus('current') if mibBuilder.loadTexts: swACLEtherRulePermit.setDescription('This object indicates resoult of examination is permit or deny;default is permit(1) permit - Specifies that packets that match the access profile are permitted to be forwarded by the switch. deny - Specifies that packets that do not match the access profile are not permitted to be forwarded by the switch and will be filtered.') sw_acl_ether_rule_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 1, 1, 14), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLEtherRuleRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLEtherRuleRowStatus.setDescription('This object indicates the status of this entry.') sw_acl_ip_rule_table = mib_table((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2)) if mibBuilder.loadTexts: swACLIpRuleTable.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleTable.setDescription('.') sw_acl_ip_rule_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1)).setIndexNames((0, 'SW-DES3x50-ACLMGMT-MIB', 'swACLIpRuleProfileID'), (0, 'SW-DES3x50-ACLMGMT-MIB', 'swACLIpRuleAccessID')) if mibBuilder.loadTexts: swACLIpRuleEntry.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleEntry.setDescription('.') sw_acl_ip_rule_profile_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: swACLIpRuleProfileID.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleProfileID.setDescription('The ID of ACL mask entry ,and is unique in the mask list.') sw_acl_ip_rule_access_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: swACLIpRuleAccessID.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleAccessID.setDescription('The ID of ACL IP rule entry .') sw_acl_ip_rule_vlan = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 3), snmp_admin_string().subtype(subtypeSpec=value_size_constraint(1, 32))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleVlan.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleVlan.setDescription('Specifies that the access will apply to only to this VLAN.') sw_acl_ip_rule_src_ipaddress = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 4), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleSrcIpaddress.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleSrcIpaddress.setDescription('Specific an IP source address.') sw_acl_ip_rule_dst_ipaddress = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 5), ip_address()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleDstIpaddress.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleDstIpaddress.setDescription('Specific an IP destination address.') sw_acl_ip_rule_dscp = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(0, 63))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleDscp.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleDscp.setDescription('Specific the value of dscp, the value can be configured 0 to 63') sw_acl_ip_rule_protocol = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4, 5, 6))).clone(namedValues=named_values(('none', 1), ('icmp', 2), ('igmp', 3), ('tcp', 4), ('udp', 5), ('protocolId', 6)))).setMaxAccess('readonly') if mibBuilder.loadTexts: swACLIpRuleProtocol.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleProtocol.setDescription('Specifies the IP protocol which has been configured in swACLIpEntry .') sw_acl_ip_rule_type = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleType.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleType.setDescription('Specific that the rule applies to the value of icmp type traffic.') sw_acl_ip_rule_code = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleCode.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleCode.setDescription('Specific that the rule applies to the value of icmp code traffic.') sw_acl_ip_rule_src_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 10), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleSrcPort.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleSrcPort.setDescription('Specific that the rule applies the range of tcp/udp source port') sw_acl_ip_rule_dst_port = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 11), integer32().subtype(subtypeSpec=value_range_constraint(0, 65535))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleDstPort.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleDstPort.setDescription('Specific the range of tcp/udp destination port range') sw_acl_ip_rule_flag_bits = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(0, 63))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleFlagBits.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleFlagBits.setDescription('A value which indicates the set of TCP flags that this entity may potentially offers. The value is a sum. This sum initially takes the value zero, Then, for each flag, L, in the range 1 through 6, that this node performs transactions for, 2 raised to (L - 1) is added to the sum. Note that values should be calculated accordingly: Flag functionality 6 urg bit 5 ack bit 4 rsh bit 3 rst bit 2 syn bit 1 fin bit For example,it you want to enable urg bit and ack bit,you should set vlaue 48(2^(5-1) + 2^(6-1)).') sw_acl_ip_rule_proto_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 13), integer32().subtype(subtypeSpec=value_range_constraint(0, 255))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleProtoID.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleProtoID.setDescription('Specific that the rule applies to the value of ip protocol id traffic') sw_acl_ip_rule_user_mask = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 14), octet_string().subtype(subtypeSpec=value_size_constraint(4, 4)).setFixedLength(4)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleUserMask.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleUserMask.setDescription('Specific that the rule applies to the ip protocol id and the range of options behind the IP header.') sw_acl_ip_rule_enable_priority = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 15), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleEnablePriority.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleEnablePriority.setDescription('Specifies that the access will apply only to packets with priority value.') sw_acl_ip_rule_priority = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 16), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRulePriority.setStatus('current') if mibBuilder.loadTexts: swACLIpRulePriority.setDescription('Specifies that the access profile will apply to packets that contain this value in their 802.1p priority field of their header.') sw_acl_ip_rule_replace_priority = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 17), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleReplacePriority.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleReplacePriority.setDescription('Specific the packets that match the access profile will changed the 802.1p priority tag field by the switch or not .') sw_acl_ip_rule_enable_replace_dscp = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 18), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleEnableReplaceDscp.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleEnableReplaceDscp.setDescription('Indicate weather the DSCP field can be over-write or not. ') sw_acl_ip_rule_rep_dscp = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 19), integer32().subtype(subtypeSpec=value_range_constraint(0, 63))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleRepDscp.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleRepDscp.setDescription('specify a value to be written to the DSCP field of an incoming packet that meets the criteria specified in the first part of the command. This value will over-write the value in the DSCP field of the packet.') sw_acl_ip_rule_permit = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 20), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('deny', 1), ('permit', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRulePermit.setStatus('current') if mibBuilder.loadTexts: swACLIpRulePermit.setDescription('This object indicates filter is permit or deny; default is permit(1)') sw_acl_ip_rule_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 2, 1, 21), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLIpRuleRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLIpRuleRowStatus.setDescription('This object indicates the status of this entry.') sw_acl_payload_rule_table = mib_table((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3)) if mibBuilder.loadTexts: swACLPayloadRuleTable.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleTable.setDescription('') sw_acl_payload_rule_entry = mib_table_row((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1)).setIndexNames((0, 'SW-DES3x50-ACLMGMT-MIB', 'swACLPayloadRuleProfileID'), (0, 'SW-DES3x50-ACLMGMT-MIB', 'swACLPayloadRuleAccessID')) if mibBuilder.loadTexts: swACLPayloadRuleEntry.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleEntry.setDescription('') sw_acl_payload_rule_profile_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: swACLPayloadRuleProfileID.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleProfileID.setDescription('') sw_acl_payload_rule_access_id = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 2), integer32().subtype(subtypeSpec=value_range_constraint(1, 255))).setMaxAccess('readonly') if mibBuilder.loadTexts: swACLPayloadRuleAccessID.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleAccessID.setDescription('') sw_acl_payload_rule_off_set0to15 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 3), octet_string().subtype(subtypeSpec=value_size_constraint(16, 16)).setFixedLength(16)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRuleOffSet0to15.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet0to15.setDescription('') sw_acl_payload_rule_off_set16to31 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 4), octet_string().subtype(subtypeSpec=value_size_constraint(16, 16)).setFixedLength(16)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRuleOffSet16to31.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet16to31.setDescription('') sw_acl_payload_rule_off_set32to47 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 5), octet_string().subtype(subtypeSpec=value_size_constraint(16, 16)).setFixedLength(16)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRuleOffSet32to47.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet32to47.setDescription('') sw_acl_payload_rule_off_set48to63 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 6), octet_string().subtype(subtypeSpec=value_size_constraint(16, 16)).setFixedLength(16)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRuleOffSet48to63.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet48to63.setDescription('') sw_acl_payload_rule_off_set64to79 = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 7), octet_string().subtype(subtypeSpec=value_size_constraint(16, 16)).setFixedLength(16)).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRuleOffSet64to79.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleOffSet64to79.setDescription('') sw_acl_payload_rule_enable_priority = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 8), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRuleEnablePriority.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleEnablePriority.setDescription('') sw_acl_payload_rule_priority = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 7))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRulePriority.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRulePriority.setDescription('Specifies that the access profile will apply to packets that contain this value in their 802.1p priority field of their header.') sw_acl_payload_rule_replace_priority = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 10), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRuleReplacePriority.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleReplacePriority.setDescription('') sw_acl_payload_rule_enable_replace_dscp = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 11), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRuleEnableReplaceDscp.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleEnableReplaceDscp.setDescription('Indicate wether the DSCP field can be over-write or not ') sw_acl_payload_rule_rep_dscp = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 12), integer32().subtype(subtypeSpec=value_range_constraint(0, 63))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRuleRepDscp.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleRepDscp.setDescription('specify a value to be written to the DSCP field of an incoming packet that meets the criteria specified in the first part of the command. This value will over-write the value in the DSCP field of the packet.') sw_acl_payload_rule_permit = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 13), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('permit', 1), ('deny', 2)))).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRulePermit.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRulePermit.setDescription('') sw_acl_payload_rule_row_status = mib_table_column((1, 3, 6, 1, 4, 1, 171, 11, 5, 2, 3, 1, 14), row_status()).setMaxAccess('readcreate') if mibBuilder.loadTexts: swACLPayloadRuleRowStatus.setStatus('current') if mibBuilder.loadTexts: swACLPayloadRuleRowStatus.setDescription('') mibBuilder.exportSymbols('SW-DES3x50-ACLMGMT-MIB', swACLIpUseDSCP=swACLIpUseDSCP, swACLIpRuleFlagBits=swACLIpRuleFlagBits, swACLEthernetPort=swACLEthernetPort, swACLIpRuleEntry=swACLIpRuleEntry, swACLIpUdpOption=swACLIpUdpOption, swACLIpRuleSrcPort=swACLIpRuleSrcPort, swACLPayloadRuleEnablePriority=swACLPayloadRuleEnablePriority, swACLPayloadOffSet48to63=swACLPayloadOffSet48to63, swACLIpTCPorUDPDstPortMask=swACLIpTCPorUDPDstPortMask, swACLPayloadOffSet64to79=swACLPayloadOffSet64to79, swACLPayloadRuleOffSet16to31=swACLPayloadRuleOffSet16to31, swACLIpIgmpOption=swACLIpIgmpOption, swACLEtherRuleDstMacAddress=swACLEtherRuleDstMacAddress, swAclMgmtMIB=swAclMgmtMIB, swACLIpRulePermit=swACLIpRulePermit, swACLIpRuleProtocol=swACLIpRuleProtocol, swACLIpUsevlan=swACLIpUsevlan, swACLPayloadRulePriority=swACLPayloadRulePriority, swACLIpRuleDstIpaddress=swACLIpRuleDstIpaddress, swACLIpEntry=swACLIpEntry, swACLIpRuleEnableReplaceDscp=swACLIpRuleEnableReplaceDscp, swACLIpSrcIpAddrMask=swACLIpSrcIpAddrMask, swACLEtherRuleRowStatus=swACLEtherRuleRowStatus, swACLIpRuleEnablePriority=swACLIpRuleEnablePriority, swACLIpRuleType=swACLIpRuleType, swACLIpRuleUserMask=swACLIpRuleUserMask, swACLIpUseProtoType=swACLIpUseProtoType, swACLIpRulePriority=swACLIpRulePriority, swACLIpRuleSrcIpaddress=swACLIpRuleSrcIpaddress, swACLPayloadProfileID=swACLPayloadProfileID, swACLEthernetTable=swACLEthernetTable, swACLIpTCPorUDPSrcPortMask=swACLIpTCPorUDPSrcPortMask, swACLPayloadPort=swACLPayloadPort, swACLPayloadRuleOffSet32to47=swACLPayloadRuleOffSet32to47, swAclMaskMgmt=swAclMaskMgmt, swACLPayloadRuleRowStatus=swACLPayloadRuleRowStatus, swACLEthernetRowStatus=swACLEthernetRowStatus, swACLEtherRuleEntry=swACLEtherRuleEntry, swACLIpRuleAccessID=swACLIpRuleAccessID, swACLIpTable=swACLIpTable, swACLEthernetUseEthernetType=swACLEthernetUseEthernetType, swACLIpTcpOption=swACLIpTcpOption, swACLEtherRuleTable=swACLEtherRuleTable, swACLIpRuleCode=swACLIpRuleCode, swACLEthernetProfileID=swACLEthernetProfileID, swAclRuleMgmt=swAclRuleMgmt, swACLEthernetSrcMacAddrMask=swACLEthernetSrcMacAddrMask, swACLPayloadOffSet16to31=swACLPayloadOffSet16to31, swACLPayloadRuleOffSet64to79=swACLPayloadRuleOffSet64to79, swACLIpTCPFlagBit=swACLIpTCPFlagBit, swACLPayloadRuleTable=swACLPayloadRuleTable, swACLEthernetEntry=swACLEthernetEntry, swACLEtherRuleSrcMacAddress=swACLEtherRuleSrcMacAddress, PYSNMP_MODULE_ID=swAclMgmtMIB, swACLEthernetUse8021p=swACLEthernetUse8021p, swACLPayloadRuleEnableReplaceDscp=swACLPayloadRuleEnableReplaceDscp, swACLPayloadOffSet0to15=swACLPayloadOffSet0to15, swACLIpRuleVlan=swACLIpRuleVlan, swACLIpProtoIDMask=swACLIpProtoIDMask, swACLPayloadRulePermit=swACLPayloadRulePermit, swACLPayloadRuleEntry=swACLPayloadRuleEntry, swACLEthernetMacAddrMaskState=swACLEthernetMacAddrMaskState, swACLEtherRuleReplacePriority=swACLEtherRuleReplacePriority, swACLEtherRuleRepDscp=swACLEtherRuleRepDscp, swACLEtherRule8021P=swACLEtherRule8021P, swACLIpRowStatus=swACLIpRowStatus, swACLPayloadRuleOffSet48to63=swACLPayloadRuleOffSet48to63, swACLIpDstIpAddrMask=swACLIpDstIpAddrMask, swACLPayloadTable=swACLPayloadTable, swACLIpProtoIDOption=swACLIpProtoIDOption, swACLEtherRuleProfileID=swACLEtherRuleProfileID, swACLIpRuleTable=swACLIpRuleTable, swACLEtherRuleVlan=swACLEtherRuleVlan, swACLPayloadEntry=swACLPayloadEntry, swACLPayloadRuleAccessID=swACLPayloadRuleAccessID, swACLEthernetUsevlan=swACLEthernetUsevlan, swACLPayloadOffSet32to47=swACLPayloadOffSet32to47, swACLIpRuleRowStatus=swACLIpRuleRowStatus, swACLEtherRuleEnablePriority=swACLEtherRuleEnablePriority, swACLIpPort=swACLIpPort, swACLPayloadRuleReplacePriority=swACLPayloadRuleReplacePriority, swACLEtherRulePriority=swACLEtherRulePriority, swACLIpRuleDstPort=swACLIpRuleDstPort, swACLIpRuleRepDscp=swACLIpRuleRepDscp, swACLPayloadRowStatus=swACLPayloadRowStatus, swACLEtherRuleEnableReplaceDscp=swACLEtherRuleEnableReplaceDscp, swACLEthernetDstMacAddrMask=swACLEthernetDstMacAddrMask, swACLIpProfileID=swACLIpProfileID, swACLIpRuleProfileID=swACLIpRuleProfileID, swACLPayloadRuleRepDscp=swACLPayloadRuleRepDscp, swACLIpRuleProtoID=swACLIpRuleProtoID, swACLEtherRuleAccessID=swACLEtherRuleAccessID, swACLEtherRulePermit=swACLEtherRulePermit, swACLIpIcmpOption=swACLIpIcmpOption, swACLIpIpAddrMaskState=swACLIpIpAddrMaskState, swACLEtherRuleEtherType=swACLEtherRuleEtherType, swACLPayloadRuleProfileID=swACLPayloadRuleProfileID, swACLPayloadRuleOffSet0to15=swACLPayloadRuleOffSet0to15, swACLIpRuleReplacePriority=swACLIpRuleReplacePriority, swACLIpRuleDscp=swACLIpRuleDscp)
""" Augment 3D images of a focal lesion with 3D rotation, flip, and translation. import_mhd: Prepare patches from lung CT scan images and annotations. (See readme.md - Installation for details.) datasets: Retrieve patches after augmentation for training. classify_patch: Demonstrate the use of datasets for training 3D deep convolution net. """
""" Augment 3D images of a focal lesion with 3D rotation, flip, and translation. import_mhd: Prepare patches from lung CT scan images and annotations. (See readme.md - Installation for details.) datasets: Retrieve patches after augmentation for training. classify_patch: Demonstrate the use of datasets for training 3D deep convolution net. """
# Michael O'Regan 05/May/2019 # https://www.sanfoundry.com/python-program-implement-bucket-sort/ def bucketSort(alist): largest = max(alist) length = len(alist) size = largest/length buckets = [[] for _ in range(length)] for i in range(length): j = int(alist[i]/size) if j != length: buckets[j].append(alist[i]) else: buckets[length - 1].append(alist[i]) for i in range(length): insertionSort(buckets[i]) result = [] for i in range(length): result = result + buckets[i] return result def insertionSort(alist): for i in range(1, len(alist)): temp = alist[i] j = i - 1 while (j >= 0 and temp < alist[j]): alist[j + 1] = alist[j] j = j - 1 alist[j + 1] = temp alist = [54,26,93,17,77,31,44,55,20] bucketSort(alist) print(bucketSort(alist))
def bucket_sort(alist): largest = max(alist) length = len(alist) size = largest / length buckets = [[] for _ in range(length)] for i in range(length): j = int(alist[i] / size) if j != length: buckets[j].append(alist[i]) else: buckets[length - 1].append(alist[i]) for i in range(length): insertion_sort(buckets[i]) result = [] for i in range(length): result = result + buckets[i] return result def insertion_sort(alist): for i in range(1, len(alist)): temp = alist[i] j = i - 1 while j >= 0 and temp < alist[j]: alist[j + 1] = alist[j] j = j - 1 alist[j + 1] = temp alist = [54, 26, 93, 17, 77, 31, 44, 55, 20] bucket_sort(alist) print(bucket_sort(alist))
""" It is commonly said that one human year is equivalent to 7 dog years. However this simple conversion fails to recognize that dogs reach adulthood in approximately two years. As a result, some people believe that it is better to count each of the first two human years as 10.5 dog years, and then count each additional human year as 4 dog years. Write a program that implements the conversion from human years to dog years described in the previous paragraph. Ensure that your program works correctly for conversions of less than two human years and for conversions of two or more human years. Your program should display an appropriate error message if the user enters a negative number. Remember that: - the FIRST TWO HUMAN YEARS are equivalent to 10.5 CANINE YEARS - the FOLLOWING HUMAN YEARS are equivalent to FOUR CANINE YEARS. """ # START Definition of FUNCTIONS def valutaIntPositive(numero): if numero.isdigit(): if numero != "0": return True return False def yearsHumanDog(etaHuman): if etaHuman == 1: etaDog = 10.5 return etaDog elif etaHuman == 2: etaDog = 21 return etaDog else: etaDog = 21 + ((etaHuman-2) * 4) return etaDog # END Definition of FUNCTIONS # Acquisition and Control of the DATA entered by the USER etaHuman = input("Enter the HUMAN Years: ") etaHumanIntPositive = valutaIntPositive(etaHuman) while not(etaHumanIntPositive): print("Incorrect entry. Try again.") etaHuman = input("Enter the HUMAN Years: ") etaHumanIntPositive = valutaIntPositive(etaHuman) # Conversion STR -> INT etaHuman = int(etaHuman) # DOG YEARS computing etaDog = yearsHumanDog(etaHuman) # Displaying the RESULTS if etaHuman == 1: print(str(etaHuman) + " HUMAN year is equal to " + str(etaDog) + " DOG years.") else: print(str(etaHuman) + " HUMAN years is equal to " + str(etaDog) + " DOG years.")
""" It is commonly said that one human year is equivalent to 7 dog years. However this simple conversion fails to recognize that dogs reach adulthood in approximately two years. As a result, some people believe that it is better to count each of the first two human years as 10.5 dog years, and then count each additional human year as 4 dog years. Write a program that implements the conversion from human years to dog years described in the previous paragraph. Ensure that your program works correctly for conversions of less than two human years and for conversions of two or more human years. Your program should display an appropriate error message if the user enters a negative number. Remember that: - the FIRST TWO HUMAN YEARS are equivalent to 10.5 CANINE YEARS - the FOLLOWING HUMAN YEARS are equivalent to FOUR CANINE YEARS. """ def valuta_int_positive(numero): if numero.isdigit(): if numero != '0': return True return False def years_human_dog(etaHuman): if etaHuman == 1: eta_dog = 10.5 return etaDog elif etaHuman == 2: eta_dog = 21 return etaDog else: eta_dog = 21 + (etaHuman - 2) * 4 return etaDog eta_human = input('Enter the HUMAN Years: ') eta_human_int_positive = valuta_int_positive(etaHuman) while not etaHumanIntPositive: print('Incorrect entry. Try again.') eta_human = input('Enter the HUMAN Years: ') eta_human_int_positive = valuta_int_positive(etaHuman) eta_human = int(etaHuman) eta_dog = years_human_dog(etaHuman) if etaHuman == 1: print(str(etaHuman) + ' HUMAN year is equal to ' + str(etaDog) + ' DOG years.') else: print(str(etaHuman) + ' HUMAN years is equal to ' + str(etaDog) + ' DOG years.')
divs = {} def sm(x): s = 0 for i in range(2,int(x**0.5)): if x%i == 0: s += i s += x/i if i*i == x: s -= i return s+1 for i in range(10001): divs[i] = sm(i) ans = 0 for i in range(10001): for j in range(10001): if divs[i] == j and divs[j] == i and i!=j: ans += i print(ans)
divs = {} def sm(x): s = 0 for i in range(2, int(x ** 0.5)): if x % i == 0: s += i s += x / i if i * i == x: s -= i return s + 1 for i in range(10001): divs[i] = sm(i) ans = 0 for i in range(10001): for j in range(10001): if divs[i] == j and divs[j] == i and (i != j): ans += i print(ans)
####################### # MaudeMiner Settings # ####################### # Database settings DATABASE_PATH = '/Users/tklovett/maude/' DATABASE_NAME = 'maude' # These setting control where the text files and zip files retrieved from the FDA website are stored DATA_PATH = '/Users/tklovett/maude/data/' ZIPS_PATH = DATA_PATH + 'zips/' TXTS_PATH = DATA_PATH + 'txts/' # The downloader module will use MAUDE_DATA_ORIGIN = 'http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/PostmarketRequirements/ReportingAdverseEvents/ucm127891.htm' LINES_PER_DB_COMMIT = 1000 * 50 # MaudeMiner will load any modules listed here INSTALLED_MODULES = ( "querier", "tokenizer", "html_generator", "cleanser", )
database_path = '/Users/tklovett/maude/' database_name = 'maude' data_path = '/Users/tklovett/maude/data/' zips_path = DATA_PATH + 'zips/' txts_path = DATA_PATH + 'txts/' maude_data_origin = 'http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/PostmarketRequirements/ReportingAdverseEvents/ucm127891.htm' lines_per_db_commit = 1000 * 50 installed_modules = ('querier', 'tokenizer', 'html_generator', 'cleanser')
# https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ # 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 sortedArrayToBST(self, nums: List[int]) -> TreeNode: return self.generateTree(nums, 0, len(nums) - 1) def generateTree(self, nums, left, right): if left > right: return None mid = (left + right) // 2 curNode = TreeNode(nums[mid]) curNode.left = self.generateTree(nums, left, mid - 1) curNode.right = self.generateTree(nums, mid + 1, right) return curNode
class Solution: def sorted_array_to_bst(self, nums: List[int]) -> TreeNode: return self.generateTree(nums, 0, len(nums) - 1) def generate_tree(self, nums, left, right): if left > right: return None mid = (left + right) // 2 cur_node = tree_node(nums[mid]) curNode.left = self.generateTree(nums, left, mid - 1) curNode.right = self.generateTree(nums, mid + 1, right) return curNode
class _LinearWithBias(Module): __parameters__ = ["weight", "bias", ] __buffers__ = [] weight : Tensor bias : Tensor training : bool
class _Linearwithbias(Module): __parameters__ = ['weight', 'bias'] __buffers__ = [] weight: Tensor bias: Tensor training: bool
count = 0 current_group = set() with open('in', 'r') as f: for line in f.readlines(): l = line.strip() if len(l) == 0: # this is end of the last group count += len(current_group) current_group = set() else: # add answers to the current group for chr in l: current_group.add(chr) # don't forget the last group count += len(current_group) print(count)
count = 0 current_group = set() with open('in', 'r') as f: for line in f.readlines(): l = line.strip() if len(l) == 0: count += len(current_group) current_group = set() else: for chr in l: current_group.add(chr) count += len(current_group) print(count)
stim_positions = { "double": [ [(0.4584, 0.2575, 0.2038), (0.4612, 0.2690, -0.0283)], # 3d location [(0.4601, 0.1549, 0.1937), (0.4614, 0.1660, -0.0358)], ], "double_20070301": [ [(0.4538, 0.2740, 0.1994), (0.4565, 0.2939, -0.0531)], # top highy [(0.4516, 0.1642, 0.1872), (0.4541, 0.1767, -0.0606)], # top lowy ], "half": [[(0.4567, 0.2029, 0.1958), (0.4581, 0.2166, -0.0329)],], "half_20070303": [[(0.4628, 0.2066, 0.1920), (0.4703, 0.2276, -0.0555)]], "tall": [[(0.4562, 0.1951, 0.2798), (0.4542, 0.2097, -0.0325)],], ##from 20061205: ##tall=[( 456.2, 195.1, 279.8), ## ( 454.2, 209.7,-32.5)] ##from 20061212: ##short=[( 461.4, 204.2, 128.1), ## ( 462.5, 205.3, 114.4)] ##from 20061219: ##necklace = [( 455.9, 194.4, 262.8), ## ( 456.2, 212.8,-42.2)] ## 'no post (smoothed)' : [( .4562, .1951, .2798), ## ( .4542, .2097,-.0325)], "short": [[(0.4614, 0.2042, 0.1281), (0.4625, 0.2053, 0.1144)]], "necklace": [[(0.4559, 0.1944, 0.2628), (0.4562, 0.2128, -0.0422)]], None: [], }
stim_positions = {'double': [[(0.4584, 0.2575, 0.2038), (0.4612, 0.269, -0.0283)], [(0.4601, 0.1549, 0.1937), (0.4614, 0.166, -0.0358)]], 'double_20070301': [[(0.4538, 0.274, 0.1994), (0.4565, 0.2939, -0.0531)], [(0.4516, 0.1642, 0.1872), (0.4541, 0.1767, -0.0606)]], 'half': [[(0.4567, 0.2029, 0.1958), (0.4581, 0.2166, -0.0329)]], 'half_20070303': [[(0.4628, 0.2066, 0.192), (0.4703, 0.2276, -0.0555)]], 'tall': [[(0.4562, 0.1951, 0.2798), (0.4542, 0.2097, -0.0325)]], 'short': [[(0.4614, 0.2042, 0.1281), (0.4625, 0.2053, 0.1144)]], 'necklace': [[(0.4559, 0.1944, 0.2628), (0.4562, 0.2128, -0.0422)]], None: []}
class Node(object): def __init__(self): super().__init__() self.__filename = '' self.__children = [] self.__line_number = 0 self.__column_number = 0 def get_children(self) -> list: return self.__children def add_child(self, child: 'Node') -> None: assert isinstance(child, Node) self.__children.append(child) def get_line_number(self) -> int: return self.__line_number def set_line_number(self, n: int) -> None: self.__line_number = int(n) def get_column_number(self) -> int: return self.__column_number def set_column_number(self, n: int) -> None: self.__column_number = int(n) def get_file_name(self) -> str: return self.__filename def set_file_name(self, f: str) -> None: self.__filename = str(f) def is_leaf(self) -> bool: if len(self.__children) == 0: return True return False
class Node(object): def __init__(self): super().__init__() self.__filename = '' self.__children = [] self.__line_number = 0 self.__column_number = 0 def get_children(self) -> list: return self.__children def add_child(self, child: 'Node') -> None: assert isinstance(child, Node) self.__children.append(child) def get_line_number(self) -> int: return self.__line_number def set_line_number(self, n: int) -> None: self.__line_number = int(n) def get_column_number(self) -> int: return self.__column_number def set_column_number(self, n: int) -> None: self.__column_number = int(n) def get_file_name(self) -> str: return self.__filename def set_file_name(self, f: str) -> None: self.__filename = str(f) def is_leaf(self) -> bool: if len(self.__children) == 0: return True return False
"""TO BE EDITED. """ # from easyml import def test_foo(): assert 1 == 1
"""TO BE EDITED. """ def test_foo(): assert 1 == 1
def binary_search(nums, target): low = 0 high = len(nums) - 1 while low <= high: mid = low + ((high - low) // 2) if nums[mid] > target: high = mid-1 elif nums[mid] < target: low = mid+1 else: return mid return -1 if __name__ == "__main__": lst = [0, 1, 2, 5, 6, 7, 8] print(binary_search(lst, 10)) print(binary_search(lst, 7)) print(binary_search(lst, 1))
def binary_search(nums, target): low = 0 high = len(nums) - 1 while low <= high: mid = low + (high - low) // 2 if nums[mid] > target: high = mid - 1 elif nums[mid] < target: low = mid + 1 else: return mid return -1 if __name__ == '__main__': lst = [0, 1, 2, 5, 6, 7, 8] print(binary_search(lst, 10)) print(binary_search(lst, 7)) print(binary_search(lst, 1))
# # PySNMP MIB module ALVARION-USER-ACCOUNT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-USER-ACCOUNT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:06:37 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) # alvarionMgmtV2, = mibBuilder.importSymbols("ALVARION-SMI", "alvarionMgmtV2") OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") SingleValueConstraint, ValueRangeConstraint, ConstraintsIntersection, ConstraintsUnion, ValueSizeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "SingleValueConstraint", "ValueRangeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "ValueSizeConstraint") NotificationGroup, ObjectGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ObjectGroup", "ModuleCompliance") Bits, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, Unsigned32, MibIdentifier, Integer32, Counter64, Gauge32, TimeTicks, ObjectIdentity, IpAddress, ModuleIdentity, Counter32, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "Unsigned32", "MibIdentifier", "Integer32", "Counter64", "Gauge32", "TimeTicks", "ObjectIdentity", "IpAddress", "ModuleIdentity", "Counter32", "iso") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") alvarionUserAccountMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35)) if mibBuilder.loadTexts: alvarionUserAccountMIB.setLastUpdated('200710310000Z') if mibBuilder.loadTexts: alvarionUserAccountMIB.setOrganization('Alvarion Ltd.') alvarionUserAccountMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1)) coUserAccountStatusGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1)) coUserAccountStatusTable = MibTable((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1), ) if mibBuilder.loadTexts: coUserAccountStatusTable.setStatus('current') coUserAccountStatusEntry = MibTableRow((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1), ).setIndexNames((0, "ALVARION-USER-ACCOUNT-MIB", "coUserAccIndex")) if mibBuilder.loadTexts: coUserAccountStatusEntry.setStatus('current') coUserAccIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))) if mibBuilder.loadTexts: coUserAccIndex.setStatus('current') coUserAccUserName = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 2), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccUserName.setStatus('current') coUserAccPlanName = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccPlanName.setStatus('current') coUserAccRemainingOnlineTime = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 4), Integer32()).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccRemainingOnlineTime.setStatus('current') coUserAccFirstLoginTime = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 5), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccFirstLoginTime.setStatus('current') coUserAccRemainingSessionTime = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 6), Integer32()).setUnits('seconds').setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccRemainingSessionTime.setStatus('current') coUserAccStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("valid", 1), ("invalid", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccStatus.setStatus('current') coUserAccExpirationTime = MibTableColumn((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 8), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: coUserAccExpirationTime.setStatus('current') alvarionUserAccountMIBNotificationPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 2)) alvarionUserAccountMIBNotifications = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 2, 0)) alvarionUserAccountMIBConformance = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3)) alvarionUserAccountMIBCompliances = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3, 1)) alvarionUserAccountMIBGroups = MibIdentifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3, 2)) alvarionUserAccountMIBCompliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3, 1, 1)).setObjects(("ALVARION-USER-ACCOUNT-MIB", "alvarionUserAccountStatusMIBGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alvarionUserAccountMIBCompliance = alvarionUserAccountMIBCompliance.setStatus('current') alvarionUserAccountStatusMIBGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3, 2, 1)).setObjects(("ALVARION-USER-ACCOUNT-MIB", "coUserAccUserName"), ("ALVARION-USER-ACCOUNT-MIB", "coUserAccPlanName"), ("ALVARION-USER-ACCOUNT-MIB", "coUserAccRemainingOnlineTime"), ("ALVARION-USER-ACCOUNT-MIB", "coUserAccFirstLoginTime"), ("ALVARION-USER-ACCOUNT-MIB", "coUserAccRemainingSessionTime"), ("ALVARION-USER-ACCOUNT-MIB", "coUserAccStatus"), ("ALVARION-USER-ACCOUNT-MIB", "coUserAccExpirationTime")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alvarionUserAccountStatusMIBGroup = alvarionUserAccountStatusMIBGroup.setStatus('current') mibBuilder.exportSymbols("ALVARION-USER-ACCOUNT-MIB", coUserAccountStatusEntry=coUserAccountStatusEntry, coUserAccountStatusTable=coUserAccountStatusTable, alvarionUserAccountMIBNotificationPrefix=alvarionUserAccountMIBNotificationPrefix, alvarionUserAccountMIBGroups=alvarionUserAccountMIBGroups, alvarionUserAccountStatusMIBGroup=alvarionUserAccountStatusMIBGroup, coUserAccountStatusGroup=coUserAccountStatusGroup, alvarionUserAccountMIBCompliances=alvarionUserAccountMIBCompliances, PYSNMP_MODULE_ID=alvarionUserAccountMIB, coUserAccRemainingOnlineTime=coUserAccRemainingOnlineTime, coUserAccExpirationTime=coUserAccExpirationTime, coUserAccUserName=coUserAccUserName, coUserAccFirstLoginTime=coUserAccFirstLoginTime, alvarionUserAccountMIB=alvarionUserAccountMIB, alvarionUserAccountMIBCompliance=alvarionUserAccountMIBCompliance, coUserAccStatus=coUserAccStatus, coUserAccPlanName=coUserAccPlanName, coUserAccIndex=coUserAccIndex, alvarionUserAccountMIBConformance=alvarionUserAccountMIBConformance, coUserAccRemainingSessionTime=coUserAccRemainingSessionTime, alvarionUserAccountMIBObjects=alvarionUserAccountMIBObjects, alvarionUserAccountMIBNotifications=alvarionUserAccountMIBNotifications)
(alvarion_mgmt_v2,) = mibBuilder.importSymbols('ALVARION-SMI', 'alvarionMgmtV2') (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_intersection, constraints_union, value_size_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'SingleValueConstraint', 'ValueRangeConstraint', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueSizeConstraint') (notification_group, object_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ObjectGroup', 'ModuleCompliance') (bits, mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, unsigned32, mib_identifier, integer32, counter64, gauge32, time_ticks, object_identity, ip_address, module_identity, counter32, iso) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'Unsigned32', 'MibIdentifier', 'Integer32', 'Counter64', 'Gauge32', 'TimeTicks', 'ObjectIdentity', 'IpAddress', 'ModuleIdentity', 'Counter32', 'iso') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') alvarion_user_account_mib = module_identity((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35)) if mibBuilder.loadTexts: alvarionUserAccountMIB.setLastUpdated('200710310000Z') if mibBuilder.loadTexts: alvarionUserAccountMIB.setOrganization('Alvarion Ltd.') alvarion_user_account_mib_objects = mib_identifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1)) co_user_account_status_group = mib_identifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1)) co_user_account_status_table = mib_table((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1)) if mibBuilder.loadTexts: coUserAccountStatusTable.setStatus('current') co_user_account_status_entry = mib_table_row((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1)).setIndexNames((0, 'ALVARION-USER-ACCOUNT-MIB', 'coUserAccIndex')) if mibBuilder.loadTexts: coUserAccountStatusEntry.setStatus('current') co_user_acc_index = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 1), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647))) if mibBuilder.loadTexts: coUserAccIndex.setStatus('current') co_user_acc_user_name = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 2), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: coUserAccUserName.setStatus('current') co_user_acc_plan_name = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 3), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: coUserAccPlanName.setStatus('current') co_user_acc_remaining_online_time = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 4), integer32()).setUnits('seconds').setMaxAccess('readonly') if mibBuilder.loadTexts: coUserAccRemainingOnlineTime.setStatus('current') co_user_acc_first_login_time = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 5), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: coUserAccFirstLoginTime.setStatus('current') co_user_acc_remaining_session_time = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 6), integer32()).setUnits('seconds').setMaxAccess('readonly') if mibBuilder.loadTexts: coUserAccRemainingSessionTime.setStatus('current') co_user_acc_status = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 7), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('valid', 1), ('invalid', 2)))).setMaxAccess('readonly') if mibBuilder.loadTexts: coUserAccStatus.setStatus('current') co_user_acc_expiration_time = mib_table_column((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 1, 1, 1, 1, 8), display_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: coUserAccExpirationTime.setStatus('current') alvarion_user_account_mib_notification_prefix = mib_identifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 2)) alvarion_user_account_mib_notifications = mib_identifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 2, 0)) alvarion_user_account_mib_conformance = mib_identifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3)) alvarion_user_account_mib_compliances = mib_identifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3, 1)) alvarion_user_account_mib_groups = mib_identifier((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3, 2)) alvarion_user_account_mib_compliance = module_compliance((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3, 1, 1)).setObjects(('ALVARION-USER-ACCOUNT-MIB', 'alvarionUserAccountStatusMIBGroup')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alvarion_user_account_mib_compliance = alvarionUserAccountMIBCompliance.setStatus('current') alvarion_user_account_status_mib_group = object_group((1, 3, 6, 1, 4, 1, 12394, 1, 10, 5, 35, 3, 2, 1)).setObjects(('ALVARION-USER-ACCOUNT-MIB', 'coUserAccUserName'), ('ALVARION-USER-ACCOUNT-MIB', 'coUserAccPlanName'), ('ALVARION-USER-ACCOUNT-MIB', 'coUserAccRemainingOnlineTime'), ('ALVARION-USER-ACCOUNT-MIB', 'coUserAccFirstLoginTime'), ('ALVARION-USER-ACCOUNT-MIB', 'coUserAccRemainingSessionTime'), ('ALVARION-USER-ACCOUNT-MIB', 'coUserAccStatus'), ('ALVARION-USER-ACCOUNT-MIB', 'coUserAccExpirationTime')) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): alvarion_user_account_status_mib_group = alvarionUserAccountStatusMIBGroup.setStatus('current') mibBuilder.exportSymbols('ALVARION-USER-ACCOUNT-MIB', coUserAccountStatusEntry=coUserAccountStatusEntry, coUserAccountStatusTable=coUserAccountStatusTable, alvarionUserAccountMIBNotificationPrefix=alvarionUserAccountMIBNotificationPrefix, alvarionUserAccountMIBGroups=alvarionUserAccountMIBGroups, alvarionUserAccountStatusMIBGroup=alvarionUserAccountStatusMIBGroup, coUserAccountStatusGroup=coUserAccountStatusGroup, alvarionUserAccountMIBCompliances=alvarionUserAccountMIBCompliances, PYSNMP_MODULE_ID=alvarionUserAccountMIB, coUserAccRemainingOnlineTime=coUserAccRemainingOnlineTime, coUserAccExpirationTime=coUserAccExpirationTime, coUserAccUserName=coUserAccUserName, coUserAccFirstLoginTime=coUserAccFirstLoginTime, alvarionUserAccountMIB=alvarionUserAccountMIB, alvarionUserAccountMIBCompliance=alvarionUserAccountMIBCompliance, coUserAccStatus=coUserAccStatus, coUserAccPlanName=coUserAccPlanName, coUserAccIndex=coUserAccIndex, alvarionUserAccountMIBConformance=alvarionUserAccountMIBConformance, coUserAccRemainingSessionTime=coUserAccRemainingSessionTime, alvarionUserAccountMIBObjects=alvarionUserAccountMIBObjects, alvarionUserAccountMIBNotifications=alvarionUserAccountMIBNotifications)
class Solution: def superPow(self, a: int, b: List[int]) -> int: if (a % 1337 == 0): return 0 return pow(a, reduce(lambda x, y: x * 10 + y, b), 1337)
class Solution: def super_pow(self, a: int, b: List[int]) -> int: if a % 1337 == 0: return 0 return pow(a, reduce(lambda x, y: x * 10 + y, b), 1337)
print("Hello, world!") x = "Hello World" print(x) y = 42 print(y)
print('Hello, world!') x = 'Hello World' print(x) y = 42 print(y)
def StringToDict(s): RES = dict() for e in set(s): RES[e] = 0 for e in s: RES[e] += 1 return RES
def string_to_dict(s): res = dict() for e in set(s): RES[e] = 0 for e in s: RES[e] += 1 return RES
""" Master list of constants for logger Mostly logger keys, but some other constants as well. """ # loggerkey - header HEADER = "header" # loggerkey - timing info EPOCH_START = "epoch_start" EPOCH_STOP = "epoch_stop" RUN_START = "run_start" RUN_STOP = "run_stop" BATCH_START = "batch_start" BATCH_STOP = "batch_stop" # loggerkey - run information NUM_BATCHES = "num_batches" BATCH_SIZE = "batch_size" FLOPS = "flops" # loggerkey - model hyperparameters LEARNING_RATE = "learning_rate" # type of summary view saved to file INTERMEDIATE_VIEW = "intermediate_view" # table view RAW_VIEW = "raw_view" # json view # available types of score metrics EXPS = "exps" # examples/sec (throughput) TFPS = "tfps" # teraflops/sec (floating point ops rate) GBPS = "gbps" # gb/sec
""" Master list of constants for logger Mostly logger keys, but some other constants as well. """ header = 'header' epoch_start = 'epoch_start' epoch_stop = 'epoch_stop' run_start = 'run_start' run_stop = 'run_stop' batch_start = 'batch_start' batch_stop = 'batch_stop' num_batches = 'num_batches' batch_size = 'batch_size' flops = 'flops' learning_rate = 'learning_rate' intermediate_view = 'intermediate_view' raw_view = 'raw_view' exps = 'exps' tfps = 'tfps' gbps = 'gbps'
DO_RUN_BIAS_TEST=False DEBUG = False INPUT_CSV=False ROOT_FOLDER="/home/jupyter/forms-ocr" OUTPUT_FOLDER= ROOT_FOLDER + "/sample_images" GEN_FOLDER = OUTPUT_FOLDER + "/img" LOCALE = "en_GB" DUMMY_GENERATOR=0 FIELD_DICT_3FIELDS= {'Name':(0,0),'Tax':(0,0), 'Address':(0,0) } FIELD_DICT_7FIELDS= {'Name':(0,0),'BusinessName':(0,0), 'Tax':(0,0), 'Address':(0,0), 'City':(0,0), 'Requester':(0,0), 'Signature':(0,0) } FIELD_DICT_16FIELDS= {'Name':(0,0),'BusinessName':(0,0), 'Tax':(0,0), 'Address':(0,0), 'City':(0,0), 'Requester':(0,0), 'Signature':(0,0), 'ssn1':(0,0), 'ssn2':(0,0), 'ssn3':(0,0), 'ssn4':(0,0), 'ssn5':(0,0), 'ssn6':(0,0), 'ssn7':(0,0), 'ssn8':(0,0), 'ssn9':(0,0) } FIELD_DICT_23FIELDS= {'Name':(0,0),'BusinessName':(0,0), 'Tax':(0,0), 'Address':(0,0), 'City':(0,0), 'Requester':(0,0), 'Signature':(0,0), 'ssn1':(0,0), 'ssn2':(0,0), 'ssn3':(0,0), 'ssn4':(0,0), 'ssn5':(0,0), 'ssn6':(0,0), 'ssn7':(0,0), 'ssn8':(0,0), 'ssn9':(0,0), 'Tax2':(0,0), 'Tax3':(0,0), 'Tax4':(0,0), 'Tax5':(0,0), 'Tax6':(0,0), 'Tax7':(0,0), 'Date':(0,0) } FIELD_DICT_SSN= {'ssn1':(0,0), 'ssn2':(0,0), 'ssn3':(0,0), 'ssn4':(0,0), 'ssn5':(0,0), 'ssn6':(0,0), 'ssn7':(0,0), 'ssn8':(0,0), 'ssn9':(0,0) } FIELD_DICT= {'Name':(0,0),'BusinessName':(0,0), 'Tax':(0,0), 'Instructions':(0,0), 'Exemptions':(0,0), 'ExemptionCode':(0,0), 'Address':(0,0), 'City':(0,0), 'Requester':(0,0),'Account':(0,0), 'SocialSeciurityNumber':(0,0), 'EmpIdentificationNumber':(0,0) } ############################### FAKER_GENERATOR=1 HANDWRITING_FIXED=0 HANDWRITING_PRESET_FLAG=1
do_run_bias_test = False debug = False input_csv = False root_folder = '/home/jupyter/forms-ocr' output_folder = ROOT_FOLDER + '/sample_images' gen_folder = OUTPUT_FOLDER + '/img' locale = 'en_GB' dummy_generator = 0 field_dict_3_fields = {'Name': (0, 0), 'Tax': (0, 0), 'Address': (0, 0)} field_dict_7_fields = {'Name': (0, 0), 'BusinessName': (0, 0), 'Tax': (0, 0), 'Address': (0, 0), 'City': (0, 0), 'Requester': (0, 0), 'Signature': (0, 0)} field_dict_16_fields = {'Name': (0, 0), 'BusinessName': (0, 0), 'Tax': (0, 0), 'Address': (0, 0), 'City': (0, 0), 'Requester': (0, 0), 'Signature': (0, 0), 'ssn1': (0, 0), 'ssn2': (0, 0), 'ssn3': (0, 0), 'ssn4': (0, 0), 'ssn5': (0, 0), 'ssn6': (0, 0), 'ssn7': (0, 0), 'ssn8': (0, 0), 'ssn9': (0, 0)} field_dict_23_fields = {'Name': (0, 0), 'BusinessName': (0, 0), 'Tax': (0, 0), 'Address': (0, 0), 'City': (0, 0), 'Requester': (0, 0), 'Signature': (0, 0), 'ssn1': (0, 0), 'ssn2': (0, 0), 'ssn3': (0, 0), 'ssn4': (0, 0), 'ssn5': (0, 0), 'ssn6': (0, 0), 'ssn7': (0, 0), 'ssn8': (0, 0), 'ssn9': (0, 0), 'Tax2': (0, 0), 'Tax3': (0, 0), 'Tax4': (0, 0), 'Tax5': (0, 0), 'Tax6': (0, 0), 'Tax7': (0, 0), 'Date': (0, 0)} field_dict_ssn = {'ssn1': (0, 0), 'ssn2': (0, 0), 'ssn3': (0, 0), 'ssn4': (0, 0), 'ssn5': (0, 0), 'ssn6': (0, 0), 'ssn7': (0, 0), 'ssn8': (0, 0), 'ssn9': (0, 0)} field_dict = {'Name': (0, 0), 'BusinessName': (0, 0), 'Tax': (0, 0), 'Instructions': (0, 0), 'Exemptions': (0, 0), 'ExemptionCode': (0, 0), 'Address': (0, 0), 'City': (0, 0), 'Requester': (0, 0), 'Account': (0, 0), 'SocialSeciurityNumber': (0, 0), 'EmpIdentificationNumber': (0, 0)} faker_generator = 1 handwriting_fixed = 0 handwriting_preset_flag = 1
class Student: studentLevel = 'first year computer science 2020/2021 session' studentCounter = 0 def __init__(self, thename, thematricno, thesex, thehostelname , theage,thecsc102examscore): self.name = thename self.matricno = thematricno self.sex = thesex self.hostelname = thehostelname self.age = theage self.csc102examscore = thecsc102examscore Student.studentCounter = Student.studentCounter registeredCourse = 'CSC102' @classmethod def registeredcourse(cls): print("registerd course is {Student.registeredCourse}") def function(self): if self.age > 16: return "yes, he is older than 16" else: return "no he is not older than 16" def getName(self): return self.name def setName(self, thenewName): self.name = thenewName @staticmethod def PAUNanthem(): print('Pau, here we come, Pau, here we come ') studendt1 = Student('James Kaka', '021074', 'M','cooperative mall',15,98) print(studendt1.getName()) studendt1.setName('James Gaga') print(studendt1.getName()) print(studendt1.function()) Student.registeredCourse() Student.PAUNanthem()
class Student: student_level = 'first year computer science 2020/2021 session' student_counter = 0 def __init__(self, thename, thematricno, thesex, thehostelname, theage, thecsc102examscore): self.name = thename self.matricno = thematricno self.sex = thesex self.hostelname = thehostelname self.age = theage self.csc102examscore = thecsc102examscore Student.studentCounter = Student.studentCounter registered_course = 'CSC102' @classmethod def registeredcourse(cls): print('registerd course is {Student.registeredCourse}') def function(self): if self.age > 16: return 'yes, he is older than 16' else: return 'no he is not older than 16' def get_name(self): return self.name def set_name(self, thenewName): self.name = thenewName @staticmethod def pau_nanthem(): print('Pau, here we come, Pau, here we come ') studendt1 = student('James Kaka', '021074', 'M', 'cooperative mall', 15, 98) print(studendt1.getName()) studendt1.setName('James Gaga') print(studendt1.getName()) print(studendt1.function()) Student.registeredCourse() Student.PAUNanthem()
# -*- coding: utf-8 -*- """ Created on Sun Apr 19 19:32:39 2020 @author: abcdk """ # 5 Data types # Int, Float, Boolean, String, Null
""" Created on Sun Apr 19 19:32:39 2020 @author: abcdk """
# success values # sql.h SQL_INVALID_HANDLE = -2 SQL_ERROR = -1 SQL_SUCCESS = 0 SQL_SUCCESS_WITH_INFO = 1 SQL_STILL_EXECUTING = 2 SQL_NEED_DATA = 99 SQL_NO_DATA_FOUND = 100 sql_errors = [SQL_ERROR, SQL_INVALID_HANDLE] # sqlext.h SQL_FETCH_NEXT = 0x01 SQL_FETCH_FIRST = 0x02 SQL_FETCH_LAST = 0x04 SQL_FETCH_PRIOR = 0x08 SQL_FETCH_ABSOLUTE = 0x10 SQL_FETCH_RELATIVE = 0x20 SQL_FETCH_RESUME = 0x40 SQL_FETCH_BOOKMARK = 0x80 # sql types SQL_TYPE_NULL = 0 SQL_CHAR = 1 SQL_NUMERIC = 2 SQL_DECIMAL = 3 SQL_INTEGER = 4 SQL_SMALLINT = 5 SQL_FLOAT = 6 SQL_REAL = 7 SQL_DOUBLE = 8 SQL_DATE = 9 SQL_TIME = 10 SQL_TIMESTAMP = 11 SQL_VARCHAR = 12 # SQL extended datatypes SQL_LONGVARCHAR = -1 SQL_BINARY = -2 SQL_VARBINARY = -3 SQL_LONGVARBINARY = -4 SQL_BIGINT = -5 SQL_TINYINT = -6 SQL_BIT = -7 SQL_INTERVAL_YEAR = -80 SQL_INTERVAL_MONTH = -81 SQL_INTERVAL_YEAR_TO_MONTH = -82 SQL_INTERVAL_DAY = -83 SQL_INTERVAL_HOUR = -84 SQL_INTERVAL_MINUTE = -85 SQL_INTERVAL_SECOND = -86 SQL_INTERVAL_DAY_TO_HOUR = -87 SQL_INTERVAL_DAY_TO_MINUTE = -88 SQL_INTERVAL_DAY_TO_SECOND = -89 SQL_INTERVAL_HOUR_TO_MINUTE = -90 SQL_INTERVAL_HOUR_TO_SECOND = -91 SQL_INTERVAL_MINUTE_TO_SECOND = -92 SQL_UNICODE = -95 SQL_UNICODE_VARCHAR = -96 SQL_UNICODE_LONGVARCHAR = -97 SQL_UNICODE_CHAR = SQL_UNICODE SQL_TYPE_DRIVER_START = SQL_INTERVAL_YEAR SQL_TYPE_DRIVER_END = SQL_UNICODE_LONGVARCHAR SQL_SIGNED_OFFSET = -20 SQL_UNSIGNED_OFFSET = -22 # Special length values (don't work yet) SQL_NULL_DATA = -1 SQL_DATA_AT_EXEC = -2 SQL_NTS = -3 # SQLGetInfo type types STRING = 's' INT16 = 'h' INT32 = 'l' # C datatype to SQL datatype mapping SQL types SQL_C_CHAR = SQL_CHAR # CHAR, VARCHAR, DECIMAL, NUMERIC SQL_C_LONG = SQL_INTEGER # INTEGER SQL_C_SHORT = SQL_SMALLINT # SMALLINT SQL_C_FLOAT = SQL_REAL # REAL SQL_C_DOUBLE = SQL_DOUBLE # FLOAT, DOUBLE SQL_C_DEFAULT = 99 # SQL_C_DATE = SQL_DATE SQL_C_TIME = SQL_TIME SQL_C_TIMESTAMP = SQL_TIMESTAMP SQL_C_BINARY = SQL_BINARY SQL_C_BIT = SQL_BIT SQL_C_TINYINT = SQL_TINYINT SQL_C_SLONG = SQL_C_LONG+SQL_SIGNED_OFFSET # SIGNED INTEGER SQL_C_SSHORT = SQL_C_SHORT+SQL_SIGNED_OFFSET # SIGNED SMALLINT SQL_C_STINYINT = SQL_TINYINT+SQL_SIGNED_OFFSET # SIGNED TINYINT SQL_C_ULONG = SQL_C_LONG+SQL_UNSIGNED_OFFSET # UNSIGNED INTEGER SQL_C_USHORT = SQL_C_SHORT+SQL_UNSIGNED_OFFSET # UNSIGNED SMALLINT SQL_C_UTINYINT = SQL_TINYINT+SQL_UNSIGNED_OFFSET # UNSIGNED TINYINT SQL_C_BOOKMARK = SQL_C_ULONG # BOOKMARK # from "sql.h" # Defines for SQLGetInfo SQL_ACTIVE_CONNECTIONS = 0, INT16 SQL_ACTIVE_STATEMENTS = 1, INT16 SQL_DATA_SOURCE_NAME = 2, STRING SQL_DRIVER_HDBC = 3, INT32 SQL_DRIVER_HENV = 4, INT32 SQL_DRIVER_HSTMT = 5, INT32 SQL_DRIVER_NAME = 6, STRING SQL_DRIVER_VER = 7, STRING SQL_FETCH_DIRECTION = 8, INT32 SQL_ODBC_API_CONFORMANCE = 9, INT16 SQL_ODBC_VER = 10, STRING SQL_ROW_UPDATES = 11, STRING SQL_ODBC_SAG_CLI_CONFORMANCE = 12, INT16 SQL_SERVER_NAME = 13, STRING SQL_SEARCH_PATTERN_ESCAPE = 14, STRING SQL_ODBC_SQL_CONFORMANCE = 15, INT16 SQL_DATABASE_NAME = 16, STRING SQL_DBMS_NAME = 17, STRING SQL_DBMS_VER = 18, STRING SQL_ACCESSIBLE_TABLES = 19, STRING SQL_ACCESSIBLE_PROCEDURES = 20, STRING SQL_PROCEDURES = 21, STRING SQL_CONCAT_NULL_BEHAVIOR = 22, INT16 SQL_CURSOR_COMMIT_BEHAVIOR = 23, INT16 SQL_CURSOR_ROLLBACK_BEHAVIOR = 24, INT16 SQL_DATA_SOURCE_READ_ONLY = 25, STRING SQL_DEFAULT_TXN_ISOLATION = 26, INT32 SQL_EXPRESSIONS_IN_ORDERBY = 27, STRING SQL_IDENTIFIER_CASE = 28, INT16 SQL_IDENTIFIER_QUOTE_CHAR = 29, STRING SQL_MAX_COLUMN_NAME_LEN = 30, INT16 SQL_MAX_CURSOR_NAME_LEN = 31, INT16 SQL_MAX_OWNER_NAME_LEN = 32, INT16 SQL_MAX_PROCEDURE_NAME_LEN = 33, INT16 SQL_MAX_QUALIFIER_NAME_LEN = 34, INT16 SQL_MAX_TABLE_NAME_LEN = 35, INT16 SQL_MULT_RESULT_SETS = 36, STRING SQL_MULTIPLE_ACTIVE_TXN = 37, STRING SQL_OUTER_JOINS = 38, STRING SQL_OWNER_TERM = 39, STRING SQL_PROCEDURE_TERM = 40, STRING SQL_QUALIFIER_NAME_SEPARATOR = 41, STRING SQL_QUALIFIER_TERM = 42, STRING SQL_SCROLL_CONCURRENCY = 43, INT32 SQL_SCROLL_OPTIONS = 44, INT32 SQL_TABLE_TERM = 45, STRING SQL_TXN_CAPABLE = 46, INT16 SQL_USER_NAME = 47, STRING SQL_CONVERT_FUNCTIONS = 48, INT32 SQL_NUMERIC_FUNCTIONS = 49, INT32 SQL_STRING_FUNCTIONS = 50, INT32 SQL_SYSTEM_FUNCTIONS = 51, INT32 SQL_TIMEDATE_FUNCTIONS = 52, INT32 SQL_CONVERT_BIGINT = 53, INT32 SQL_CONVERT_BINARY = 54, INT32 SQL_CONVERT_BIT = 55, INT32 SQL_CONVERT_CHAR = 56, INT32 SQL_CONVERT_DATE = 57, INT32 SQL_CONVERT_DECIMAL = 58, INT32 SQL_CONVERT_DOUBLE = 59, INT32 SQL_CONVERT_FLOAT = 60, INT32 SQL_CONVERT_INTEGER = 61, INT32 SQL_CONVERT_LONGVARCHAR = 62, INT32 SQL_CONVERT_NUMERIC = 63, INT32 SQL_CONVERT_REAL = 64, INT32 SQL_CONVERT_SMALLINT = 65, INT32 SQL_CONVERT_TIME = 66, INT32 SQL_CONVERT_TIMESTAMP = 67, INT32 SQL_CONVERT_TINYINT = 68, INT32 SQL_CONVERT_VARBINARY = 69, INT32 SQL_CONVERT_VARCHAR = 70, INT32 SQL_CONVERT_LONGVARBINARY = 71, INT32 SQL_TXN_ISOLATION_OPTION = 72, INT32 SQL_ODBC_SQL_OPT_IEF = 73, STRING SQL_CORRELATION_NAME = 74, INT16 SQL_NON_NULLABLE_COLUMNS = 75, INT16 SQL_DRIVER_HLIB = 76, INT32 SQL_DRIVER_ODBC_VER = 77, STRING SQL_LOCK_TYPES = 78, INT32 SQL_POS_OPERATIONS = 79, INT32 SQL_POSITIONED_STATEMENTS = 80, INT32 SQL_GETDATA_EXTENSIONS = 81, INT32 SQL_BOOKMARK_PERSISTENCE = 82, INT32 SQL_STATIC_SENSITIVITY = 83, INT32 SQL_FILE_USAGE = 84, INT16 SQL_NULL_COLLATION = 85, INT16 SQL_ALTER_TABLE = 86, INT32 SQL_COLUMN_ALIAS = 87, STRING SQL_GROUP_BY = 88, INT16 SQL_KEYWORDS = 89, STRING SQL_ORDER_BY_COLUMNS_IN_SELECT = 90, STRING SQL_OWNER_USAGE = 91, INT32 SQL_QUALIFIER_USAGE = 92, INT32 SQL_QUOTED_IDENTIFIER_CASE = 93, INT32 SQL_SPECIAL_CHARACTERS = 94, STRING SQL_SUBQUERIES = 95, INT32 SQL_UNION = 96, INT32 SQL_MAX_COLUMNS_IN_GROUP_BY = 97, INT16 SQL_MAX_COLUMNS_IN_INDEX = 98, INT16 SQL_MAX_COLUMNS_IN_ORDER_BY = 99, INT16 SQL_MAX_COLUMNS_IN_SELECT = 100, INT16 SQL_MAX_COLUMNS_IN_TABLE = 101, INT16 SQL_MAX_INDEX_SIZE = 102, INT32 SQL_MAX_ROW_SIZE_INCLUDES_LONG = 103, STRING SQL_MAX_ROW_SIZE = 104, INT32 SQL_MAX_STATEMENT_LEN = 105, INT32 SQL_MAX_TABLES_IN_SELECT = 106, INT16 SQL_MAX_USER_NAME_LEN = 107, INT16 SQL_MAX_CHAR_LITERAL_LEN = 108, INT32 SQL_TIMEDATE_ADD_INTERVALS = 109, INT32 SQL_TIMEDATE_DIFF_INTERVALS = 110, INT32 SQL_NEED_LONG_DATA_LEN = 111, STRING SQL_MAX_BINARY_LITERAL_LEN = 112, INT32 SQL_LIKE_ESCAPE_CLAUSE = 113, STRING SQL_QUALIFIER_LOCATION = 114, INT16 # # <Phew!> # # Level 1 Prototypes # <sqlext.h> # Options for SQLDriverConnect SQL_DRIVER_NOPROMPT = 0 SQL_DRIVER_COMPLETE = 1 SQL_DRIVER_PROMPT = 2 SQL_DRIVER_COMPLETE_REQUIRED = 3 # For SQLGetFunctions SQL_API_ALL_FUNCTIONS = 0 # Defines for SQLBindParameter and # SQLProcedureColumns (returned in the result set) SQL_PARAM_TYPE_UNKNOWN = 0 SQL_PARAM_INPUT = 1 SQL_PARAM_INPUT_OUTPUT = 2 SQL_RESULT_COL = 3 SQL_PARAM_OUTPUT = 4 SQL_RETURN_VALUE = 5 # SQLFreeStmt defines SQL_CLOSE = 0 SQL_DROP = 1 SQL_UNBIND = 2 SQL_RESET_PARAMS = 3 # Added by Edward Akerboom: # SQL Handles SQL_HANDLE_ENV = 1 SQL_HANDLE_DBC = 2 SQL_HANDLE_STMT = 3 SQL_HANDLE_DESC = 4 # SQLGetEnvAttr - Attributes SQL_ATTR_ODBC_VERSION = 200 SQL_ATTR_CONNECTION_POOLING = 201 SQL_ATTR_CP_MATCH = 202 # SQLGetEnvAttr - SQL_ATTR_ODBC_VERSION SQL_OV_ODBC2 = 2, INT32 SQL_OV_ODBC3 = 3, INT32 # # SQLGetEnvAttr - SQL_ATTR_CONNECTION_POOLING # SQL_CP_OFF 0UL # SQL_CP_ONE_PER_DRIVER 1UL # SQL_CP_ONE_PER_HENV 2UL # SQL_CP_DEFAULT SQL_CP_OFF # # # # SQLGetEnvAttr - SQL_ATTR_CP_MATCH # SQL_CP_STRICT_MATCH 0UL # SQL_CP_RELAXED_MATCH 1UL # SQL_CP_MATCH_DEFAULT SQL_CP_STRICT_MATCH SQL_NO_DATA = 100 SQL_NULL_HENV = 0 SQL_NULL_HDBC = 0 SQL_NULL_HSTMT = 0 # Don't know if this works: SQL_IS_POINTER = -4 SQL_IS_UINTEGER = -5 SQL_IS_INTEGER = -6 SQL_IS_USMALLINT = -7 SQL_IS_SMALLINT = -8
sql_invalid_handle = -2 sql_error = -1 sql_success = 0 sql_success_with_info = 1 sql_still_executing = 2 sql_need_data = 99 sql_no_data_found = 100 sql_errors = [SQL_ERROR, SQL_INVALID_HANDLE] sql_fetch_next = 1 sql_fetch_first = 2 sql_fetch_last = 4 sql_fetch_prior = 8 sql_fetch_absolute = 16 sql_fetch_relative = 32 sql_fetch_resume = 64 sql_fetch_bookmark = 128 sql_type_null = 0 sql_char = 1 sql_numeric = 2 sql_decimal = 3 sql_integer = 4 sql_smallint = 5 sql_float = 6 sql_real = 7 sql_double = 8 sql_date = 9 sql_time = 10 sql_timestamp = 11 sql_varchar = 12 sql_longvarchar = -1 sql_binary = -2 sql_varbinary = -3 sql_longvarbinary = -4 sql_bigint = -5 sql_tinyint = -6 sql_bit = -7 sql_interval_year = -80 sql_interval_month = -81 sql_interval_year_to_month = -82 sql_interval_day = -83 sql_interval_hour = -84 sql_interval_minute = -85 sql_interval_second = -86 sql_interval_day_to_hour = -87 sql_interval_day_to_minute = -88 sql_interval_day_to_second = -89 sql_interval_hour_to_minute = -90 sql_interval_hour_to_second = -91 sql_interval_minute_to_second = -92 sql_unicode = -95 sql_unicode_varchar = -96 sql_unicode_longvarchar = -97 sql_unicode_char = SQL_UNICODE sql_type_driver_start = SQL_INTERVAL_YEAR sql_type_driver_end = SQL_UNICODE_LONGVARCHAR sql_signed_offset = -20 sql_unsigned_offset = -22 sql_null_data = -1 sql_data_at_exec = -2 sql_nts = -3 string = 's' int16 = 'h' int32 = 'l' sql_c_char = SQL_CHAR sql_c_long = SQL_INTEGER sql_c_short = SQL_SMALLINT sql_c_float = SQL_REAL sql_c_double = SQL_DOUBLE sql_c_default = 99 sql_c_date = SQL_DATE sql_c_time = SQL_TIME sql_c_timestamp = SQL_TIMESTAMP sql_c_binary = SQL_BINARY sql_c_bit = SQL_BIT sql_c_tinyint = SQL_TINYINT sql_c_slong = SQL_C_LONG + SQL_SIGNED_OFFSET sql_c_sshort = SQL_C_SHORT + SQL_SIGNED_OFFSET sql_c_stinyint = SQL_TINYINT + SQL_SIGNED_OFFSET sql_c_ulong = SQL_C_LONG + SQL_UNSIGNED_OFFSET sql_c_ushort = SQL_C_SHORT + SQL_UNSIGNED_OFFSET sql_c_utinyint = SQL_TINYINT + SQL_UNSIGNED_OFFSET sql_c_bookmark = SQL_C_ULONG sql_active_connections = (0, INT16) sql_active_statements = (1, INT16) sql_data_source_name = (2, STRING) sql_driver_hdbc = (3, INT32) sql_driver_henv = (4, INT32) sql_driver_hstmt = (5, INT32) sql_driver_name = (6, STRING) sql_driver_ver = (7, STRING) sql_fetch_direction = (8, INT32) sql_odbc_api_conformance = (9, INT16) sql_odbc_ver = (10, STRING) sql_row_updates = (11, STRING) sql_odbc_sag_cli_conformance = (12, INT16) sql_server_name = (13, STRING) sql_search_pattern_escape = (14, STRING) sql_odbc_sql_conformance = (15, INT16) sql_database_name = (16, STRING) sql_dbms_name = (17, STRING) sql_dbms_ver = (18, STRING) sql_accessible_tables = (19, STRING) sql_accessible_procedures = (20, STRING) sql_procedures = (21, STRING) sql_concat_null_behavior = (22, INT16) sql_cursor_commit_behavior = (23, INT16) sql_cursor_rollback_behavior = (24, INT16) sql_data_source_read_only = (25, STRING) sql_default_txn_isolation = (26, INT32) sql_expressions_in_orderby = (27, STRING) sql_identifier_case = (28, INT16) sql_identifier_quote_char = (29, STRING) sql_max_column_name_len = (30, INT16) sql_max_cursor_name_len = (31, INT16) sql_max_owner_name_len = (32, INT16) sql_max_procedure_name_len = (33, INT16) sql_max_qualifier_name_len = (34, INT16) sql_max_table_name_len = (35, INT16) sql_mult_result_sets = (36, STRING) sql_multiple_active_txn = (37, STRING) sql_outer_joins = (38, STRING) sql_owner_term = (39, STRING) sql_procedure_term = (40, STRING) sql_qualifier_name_separator = (41, STRING) sql_qualifier_term = (42, STRING) sql_scroll_concurrency = (43, INT32) sql_scroll_options = (44, INT32) sql_table_term = (45, STRING) sql_txn_capable = (46, INT16) sql_user_name = (47, STRING) sql_convert_functions = (48, INT32) sql_numeric_functions = (49, INT32) sql_string_functions = (50, INT32) sql_system_functions = (51, INT32) sql_timedate_functions = (52, INT32) sql_convert_bigint = (53, INT32) sql_convert_binary = (54, INT32) sql_convert_bit = (55, INT32) sql_convert_char = (56, INT32) sql_convert_date = (57, INT32) sql_convert_decimal = (58, INT32) sql_convert_double = (59, INT32) sql_convert_float = (60, INT32) sql_convert_integer = (61, INT32) sql_convert_longvarchar = (62, INT32) sql_convert_numeric = (63, INT32) sql_convert_real = (64, INT32) sql_convert_smallint = (65, INT32) sql_convert_time = (66, INT32) sql_convert_timestamp = (67, INT32) sql_convert_tinyint = (68, INT32) sql_convert_varbinary = (69, INT32) sql_convert_varchar = (70, INT32) sql_convert_longvarbinary = (71, INT32) sql_txn_isolation_option = (72, INT32) sql_odbc_sql_opt_ief = (73, STRING) sql_correlation_name = (74, INT16) sql_non_nullable_columns = (75, INT16) sql_driver_hlib = (76, INT32) sql_driver_odbc_ver = (77, STRING) sql_lock_types = (78, INT32) sql_pos_operations = (79, INT32) sql_positioned_statements = (80, INT32) sql_getdata_extensions = (81, INT32) sql_bookmark_persistence = (82, INT32) sql_static_sensitivity = (83, INT32) sql_file_usage = (84, INT16) sql_null_collation = (85, INT16) sql_alter_table = (86, INT32) sql_column_alias = (87, STRING) sql_group_by = (88, INT16) sql_keywords = (89, STRING) sql_order_by_columns_in_select = (90, STRING) sql_owner_usage = (91, INT32) sql_qualifier_usage = (92, INT32) sql_quoted_identifier_case = (93, INT32) sql_special_characters = (94, STRING) sql_subqueries = (95, INT32) sql_union = (96, INT32) sql_max_columns_in_group_by = (97, INT16) sql_max_columns_in_index = (98, INT16) sql_max_columns_in_order_by = (99, INT16) sql_max_columns_in_select = (100, INT16) sql_max_columns_in_table = (101, INT16) sql_max_index_size = (102, INT32) sql_max_row_size_includes_long = (103, STRING) sql_max_row_size = (104, INT32) sql_max_statement_len = (105, INT32) sql_max_tables_in_select = (106, INT16) sql_max_user_name_len = (107, INT16) sql_max_char_literal_len = (108, INT32) sql_timedate_add_intervals = (109, INT32) sql_timedate_diff_intervals = (110, INT32) sql_need_long_data_len = (111, STRING) sql_max_binary_literal_len = (112, INT32) sql_like_escape_clause = (113, STRING) sql_qualifier_location = (114, INT16) sql_driver_noprompt = 0 sql_driver_complete = 1 sql_driver_prompt = 2 sql_driver_complete_required = 3 sql_api_all_functions = 0 sql_param_type_unknown = 0 sql_param_input = 1 sql_param_input_output = 2 sql_result_col = 3 sql_param_output = 4 sql_return_value = 5 sql_close = 0 sql_drop = 1 sql_unbind = 2 sql_reset_params = 3 sql_handle_env = 1 sql_handle_dbc = 2 sql_handle_stmt = 3 sql_handle_desc = 4 sql_attr_odbc_version = 200 sql_attr_connection_pooling = 201 sql_attr_cp_match = 202 sql_ov_odbc2 = (2, INT32) sql_ov_odbc3 = (3, INT32) sql_no_data = 100 sql_null_henv = 0 sql_null_hdbc = 0 sql_null_hstmt = 0 sql_is_pointer = -4 sql_is_uinteger = -5 sql_is_integer = -6 sql_is_usmallint = -7 sql_is_smallint = -8
class Solution: # @param A : list of integers # @return an integer def perfectPeak(self, A): n = len(A) left = [0] * n right = [0] * n left[0] = A[0] right[n-1] = A[n-1] for i in range(1, n) : left[i] = max(left[i-1], A[i]) for i in range(n-2, -1, -1) : right[i] = min(right[i+1], A[i]) for i in range(1, n-1) : if A[i] > left[i-1] and A[i] < right[i+1] : return 1 return 0 A = [ 5706, 26963, 24465, 29359, 16828, 26501, 28146, 18468, 9962, 2996, 492, 11479, 23282, 19170, 15725, 6335 ] ob = Solution() print(ob.perfectPeak(A))
class Solution: def perfect_peak(self, A): n = len(A) left = [0] * n right = [0] * n left[0] = A[0] right[n - 1] = A[n - 1] for i in range(1, n): left[i] = max(left[i - 1], A[i]) for i in range(n - 2, -1, -1): right[i] = min(right[i + 1], A[i]) for i in range(1, n - 1): if A[i] > left[i - 1] and A[i] < right[i + 1]: return 1 return 0 a = [5706, 26963, 24465, 29359, 16828, 26501, 28146, 18468, 9962, 2996, 492, 11479, 23282, 19170, 15725, 6335] ob = solution() print(ob.perfectPeak(A))
class Matrix: def __init__(self, matrix_string: str): # Split matrix_string into lines, split lines on whitespace and cast elements as integers. self.matrix = [[int(j) for j in i.split()] for i in matrix_string.splitlines()] def row(self, index: int) -> list[int]: return self.matrix[index - 1] def column(self, index: int) -> list[int]: return [i[index - 1] for i in self.matrix]
class Matrix: def __init__(self, matrix_string: str): self.matrix = [[int(j) for j in i.split()] for i in matrix_string.splitlines()] def row(self, index: int) -> list[int]: return self.matrix[index - 1] def column(self, index: int) -> list[int]: return [i[index - 1] for i in self.matrix]
Colors = {'snow': ('255', '250', '250'), 'ghostwhite': ('248', '248', '255'), 'GhostWhite': ('248', '248', '255'), 'whitesmoke': ('245', '245', '245'), 'WhiteSmoke': ('245', '245', '245'), 'gainsboro': ('220', '220', '220'), 'floralwhite': ('255', '250', '240'), 'FloralWhite': ('255', '250', '240'), 'oldlace': ('253', '245', '230'), 'OldLace': ('253', '245', '230'), 'linen': ('250', '240', '230'), 'antiquewhite': ('250', '235', '215'), 'AntiqueWhite': ('250', '235', '215'), 'papayawhip': ('255', '239', '213'), 'PapayaWhip': ('255', '239', '213'), 'blanchedalmond': ('255', '235', '205'), 'BlanchedAlmond': ('255', '235', '205'), 'bisque': ('255', '228', '196'), 'peachpuff': ('255', '218', '185'), 'PeachPuff': ('255', '218', '185'), 'navajowhite': ('255', '222', '173'), 'NavajoWhite': ('255', '222', '173'), 'moccasin': ('255', '228', '181'), 'cornsilk': ('255', '248', '220'), 'ivory': ('255', '255', '240'), 'lemonchiffon': ('255', '250', '205'), 'LemonChiffon': ('255', '250', '205'), 'seashell': ('255', '245', '238'), 'honeydew': ('240', '255', '240'), 'mintcream': ('245', '255', '250'), 'MintCream': ('245', '255', '250'), 'azure': ('240', '255', '255'), 'aliceblue': ('240', '248', '255'), 'AliceBlue': ('240', '248', '255'), 'lavender': ('230', '230', '250'), 'lavenderblush': ('255', '240', '245'), 'LavenderBlush': ('255', '240', '245'), 'mistyrose': ('255', '228', '225'), 'MistyRose': ('255', '228', '225'), 'white': ('255', '255', '255'), 'black': ('0', '0', '0'), 'darkslategray': ('47', '79', '79'), 'DarkSlateGray': ('47', '79', '79'), 'darkslategrey': ('47', '79', '79'), 'DarkSlateGrey': ('47', '79', '79'), 'dimgray': ('105', '105', '105'), 'DimGray': ('105', '105', '105'), 'dimgrey': ('105', '105', '105'), 'DimGrey': ('105', '105', '105'), 'slategray': ('112', '128', '144'), 'SlateGray': ('112', '128', '144'), 'slategrey': ('112', '128', '144'), 'SlateGrey': ('112', '128', '144'), 'lightslategray': ('119', '136', '153'), 'LightSlateGray': ('119', '136', '153'), 'lightslategrey': ('119', '136', '153'), 'LightSlateGrey': ('119', '136', '153'), 'gray': ('190', '190', '190'), 'grey': ('190', '190', '190'), 'lightgrey': ('211', '211', '211'), 'LightGrey': ('211', '211', '211'), 'lightgray': ('211', '211', '211'), 'LightGray': ('211', '211', '211'), 'midnightblue': ('25', '25', '112'), 'MidnightBlue': ('25', '25', '112'), 'navy': ('0', '0', '128'), 'navyblue': ('0', '0', '128'), 'NavyBlue': ('0', '0', '128'), 'cornflowerblue': ('100', '149', '237'), 'CornflowerBlue': ('100', '149', '237'), 'darkslateblue': ('72', '61', '139'), 'DarkSlateBlue': ('72', '61', '139'), 'slateblue': ('106', '90', '205'), 'SlateBlue': ('106', '90', '205'), 'mediumslateblue': ('123', '104', '238'), 'MediumSlateBlue': ('123', '104', '238'), 'lightslateblue': ('132', '112', '255'), 'LightSlateBlue': ('132', '112', '255'), 'mediumblue': ('0', '0', '205'), 'MediumBlue': ('0', '0', '205'), 'royalblue': ('65', '105', '225'), 'RoyalBlue': ('65', '105', '225'), 'blue': ('0', '0', '255'), 'dodgerblue': ('30', '144', '255'), 'DodgerBlue': ('30', '144', '255'), 'deepskyblue': ('0', '191', '255'), 'DeepSkyBlue': ('0', '191', '255'), 'skyblue': ('135', '206', '235'), 'SkyBlue': ('135', '206', '235'), 'lightskyblue': ('135', '206', '250'), 'LightSkyBlue': ('135', '206', '250'), 'steelblue': ('70', '130', '180'), 'SteelBlue': ('70', '130', '180'), 'lightsteelblue': ('176', '196', '222'), 'LightSteelBlue': ('176', '196', '222'), 'lightblue': ('173', '216', '230'), 'LightBlue': ('173', '216', '230'), 'powderblue': ('176', '224', '230'), 'PowderBlue': ('176', '224', '230'), 'paleturquoise': ('175', '238', '238'), 'PaleTurquoise': ('175', '238', '238'), 'darkturquoise': ('0', '206', '209'), 'DarkTurquoise': ('0', '206', '209'), 'mediumturquoise': ('72', '209', '204'), 'MediumTurquoise': ('72', '209', '204'), 'turquoise': ('64', '224', '208'), 'cyan': ('0', '255', '255'), 'lightcyan': ('224', '255', '255'), 'LightCyan': ('224', '255', '255'), 'cadetblue': ('95', '158', '160'), 'CadetBlue': ('95', '158', '160'), 'mediumaquamarine': ('102', '205', '170'), 'MediumAquamarine': ('102', '205', '170'), 'aquamarine': ('127', '255', '212'), 'darkgreen': ('0', '100', '0'), 'DarkGreen': ('0', '100', '0'), 'darkolivegreen': ('85', '107', '47'), 'DarkOliveGreen': ('85', '107', '47'), 'darkseagreen': ('143', '188', '143'), 'DarkSeaGreen': ('143', '188', '143'), 'seagreen': ('46', '139', '87'), 'SeaGreen': ('46', '139', '87'), 'mediumseagreen': ('60', '179', '113'), 'MediumSeaGreen': ('60', '179', '113'), 'lightseagreen': ('32', '178', '170'), 'LightSeaGreen': ('32', '178', '170'), 'palegreen': ('152', '251', '152'), 'PaleGreen': ('152', '251', '152'), 'springgreen': ('0', '255', '127'), 'SpringGreen': ('0', '255', '127'), 'lawngreen': ('124', '252', '0'), 'LawnGreen': ('124', '252', '0'), 'green': ('0', '255', '0'), 'chartreuse': ('127', '255', '0'), 'mediumspringgreen': ('0', '250', '154'), 'MediumSpringGreen': ('0', '250', '154'), 'greenyellow': ('173', '255', '47'), 'GreenYellow': ('173', '255', '47'), 'limegreen': ('50', '205', '50'), 'LimeGreen': ('50', '205', '50'), 'yellowgreen': ('154', '205', '50'), 'YellowGreen': ('154', '205', '50'), 'forestgreen': ('34', '139', '34'), 'ForestGreen': ('34', '139', '34'), 'olivedrab': ('107', '142', '35'), 'OliveDrab': ('107', '142', '35'), 'darkkhaki': ('189', '183', '107'), 'DarkKhaki': ('189', '183', '107'), 'khaki': ('240', '230', '140'), 'palegoldenrod': ('238', '232', '170'), 'PaleGoldenrod': ('238', '232', '170'), 'lightgoldenrodyellow': ('250', '250', '210'), 'LightGoldenrodYellow': ('250', '250', '210'), 'lightyellow': ('255', '255', '224'), 'LightYellow': ('255', '255', '224'), 'yellow': ('255', '255', '0'), 'gold': ('255', '215', '0'), 'lightgoldenrod': ('238', '221', '130'), 'LightGoldenrod': ('238', '221', '130'), 'goldenrod': ('218', '165', '32'), 'darkgoldenrod': ('184', '134', '11'), 'DarkGoldenrod': ('184', '134', '11'), 'rosybrown': ('188', '143', '143'), 'RosyBrown': ('188', '143', '143'), 'indianred': ('205', '92', '92'), 'IndianRed': ('205', '92', '92'), 'saddlebrown': ('139', '69', '19'), 'SaddleBrown': ('139', '69', '19'), 'sienna': ('160', '82', '45'), 'peru': ('205', '133', '63'), 'burlywood': ('222', '184', '135'), 'beige': ('245', '245', '220'), 'wheat': ('245', '222', '179'), 'sandybrown': ('244', '164', '96'), 'SandyBrown': ('244', '164', '96'), 'tan': ('210', '180', '140'), 'chocolate': ('210', '105', '30'), 'firebrick': ('178', '34', '34'), 'brown': ('165', '42', '42'), 'darksalmon': ('233', '150', '122'), 'DarkSalmon': ('233', '150', '122'), 'salmon': ('250', '128', '114'), 'lightsalmon': ('255', '160', '122'), 'LightSalmon': ('255', '160', '122'), 'orange': ('255', '165', '0'), 'darkorange': ('255', '140', '0'), 'DarkOrange': ('255', '140', '0'), 'coral': ('255', '127', '80'), 'lightcoral': ('240', '128', '128'), 'LightCoral': ('240', '128', '128'), 'tomato': ('255', '99', '71'), 'orangered': ('255', '69', '0'), 'OrangeRed': ('255', '69', '0'), 'red': ('255', '0', '0'), 'hotpink': ('255', '105', '180'), 'HotPink': ('255', '105', '180'), 'deeppink': ('255', '20', '147'), 'DeepPink': ('255', '20', '147'), 'pink': ('255', '192', '203'), 'lightpink': ('255', '182', '193'), 'LightPink': ('255', '182', '193'), 'palevioletred': ('219', '112', '147'), 'PaleVioletRed': ('219', '112', '147'), 'maroon': ('176', '48', '96'), 'mediumvioletred': ('199', '21', '133'), 'MediumVioletRed': ('199', '21', '133'), 'violetred': ('208', '32', '144'), 'VioletRed': ('208', '32', '144'), 'magenta': ('255', '0', '255'), 'violet': ('238', '130', '238'), 'plum': ('221', '160', '221'), 'orchid': ('218', '112', '214'), 'mediumorchid': ('186', '85', '211'), 'MediumOrchid': ('186', '85', '211'), 'darkorchid': ('153', '50', '204'), 'DarkOrchid': ('153', '50', '204'), 'darkviolet': ('148', '0', '211'), 'DarkViolet': ('148', '0', '211'), 'blueviolet': ('138', '43', '226'), 'BlueViolet': ('138', '43', '226'), 'purple': ('160', '32', '240'), 'mediumpurple': ('147', '112', '219'), 'MediumPurple': ('147', '112', '219'), 'thistle': ('216', '191', '216'), 'snow1': ('255', '250', '250'), 'snow2': ('238', '233', '233'), 'snow3': ('205', '201', '201'), 'snow4': ('139', '137', '137'), 'seashell1': ('255', '245', '238'), 'seashell2': ('238', '229', '222'), 'seashell3': ('205', '197', '191'), 'seashell4': ('139', '134', '130'), 'AntiqueWhite1': ('255', '239', '219'), 'AntiqueWhite2': ('238', '223', '204'), 'AntiqueWhite3': ('205', '192', '176'), 'AntiqueWhite4': ('139', '131', '120'), 'bisque1': ('255', '228', '196'), 'bisque2': ('238', '213', '183'), 'bisque3': ('205', '183', '158'), 'bisque4': ('139', '125', '107'), 'PeachPuff1': ('255', '218', '185'), 'PeachPuff2': ('238', '203', '173'), 'PeachPuff3': ('205', '175', '149'), 'PeachPuff4': ('139', '119', '101'), 'NavajoWhite1': ('255', '222', '173'), 'NavajoWhite2': ('238', '207', '161'), 'NavajoWhite3': ('205', '179', '139'), 'NavajoWhite4': ('139', '121', '94'), 'LemonChiffon1': ('255', '250', '205'), 'LemonChiffon2': ('238', '233', '191'), 'LemonChiffon3': ('205', '201', '165'), 'LemonChiffon4': ('139', '137', '112'), 'cornsilk1': ('255', '248', '220'), 'cornsilk2': ('238', '232', '205'), 'cornsilk3': ('205', '200', '177'), 'cornsilk4': ('139', '136', '120'), 'ivory1': ('255', '255', '240'), 'ivory2': ('238', '238', '224'), 'ivory3': ('205', '205', '193'), 'ivory4': ('139', '139', '131'), 'honeydew1': ('240', '255', '240'), 'honeydew2': ('224', '238', '224'), 'honeydew3': ('193', '205', '193'), 'honeydew4': ('131', '139', '131'), 'LavenderBlush1': ('255', '240', '245'), 'LavenderBlush2': ('238', '224', '229'), 'LavenderBlush3': ('205', '193', '197'), 'LavenderBlush4': ('139', '131', '134'), 'MistyRose1': ('255', '228', '225'), 'MistyRose2': ('238', '213', '210'), 'MistyRose3': ('205', '183', '181'), 'MistyRose4': ('139', '125', '123'), 'azure1': ('240', '255', '255'), 'azure2': ('224', '238', '238'), 'azure3': ('193', '205', '205'), 'azure4': ('131', '139', '139'), 'SlateBlue1': ('131', '111', '255'), 'SlateBlue2': ('122', '103', '238'), 'SlateBlue3': ('105', '89', '205'), 'SlateBlue4': ('71', '60', '139'), 'RoyalBlue1': ('72', '118', '255'), 'RoyalBlue2': ('67', '110', '238'), 'RoyalBlue3': ('58', '95', '205'), 'RoyalBlue4': ('39', '64', '139'), 'blue1': ('0', '0', '255'), 'blue2': ('0', '0', '238'), 'blue3': ('0', '0', '205'), 'blue4': ('0', '0', '139'), 'DodgerBlue1': ('30', '144', '255'), 'DodgerBlue2': ('28', '134', '238'), 'DodgerBlue3': ('24', '116', '205'), 'DodgerBlue4': ('16', '78', '139'), 'SteelBlue1': ('99', '184', '255'), 'SteelBlue2': ('92', '172', '238'), 'SteelBlue3': ('79', '148', '205'), 'SteelBlue4': ('54', '100', '139'), 'DeepSkyBlue1': ('0', '191', '255'), 'DeepSkyBlue2': ('0', '178', '238'), 'DeepSkyBlue3': ('0', '154', '205'), 'DeepSkyBlue4': ('0', '104', '139'), 'SkyBlue1': ('135', '206', '255'), 'SkyBlue2': ('126', '192', '238'), 'SkyBlue3': ('108', '166', '205'), 'SkyBlue4': ('74', '112', '139'), 'LightSkyBlue1': ('176', '226', '255'), 'LightSkyBlue2': ('164', '211', '238'), 'LightSkyBlue3': ('141', '182', '205'), 'LightSkyBlue4': ('96', '123', '139'), 'SlateGray1': ('198', '226', '255'), 'SlateGray2': ('185', '211', '238'), 'SlateGray3': ('159', '182', '205'), 'SlateGray4': ('108', '123', '139'), 'LightSteelBlue1': ('202', '225', '255'), 'LightSteelBlue2': ('188', '210', '238'), 'LightSteelBlue3': ('162', '181', '205'), 'LightSteelBlue4': ('110', '123', '139'), 'LightBlue1': ('191', '239', '255'), 'LightBlue2': ('178', '223', '238'), 'LightBlue3': ('154', '192', '205'), 'LightBlue4': ('104', '131', '139'), 'LightCyan1': ('224', '255', '255'), 'LightCyan2': ('209', '238', '238'), 'LightCyan3': ('180', '205', '205'), 'LightCyan4': ('122', '139', '139'), 'PaleTurquoise1': ('187', '255', '255'), 'PaleTurquoise2': ('174', '238', '238'), 'PaleTurquoise3': ('150', '205', '205'), 'PaleTurquoise4': ('102', '139', '139'), 'CadetBlue1': ('152', '245', '255'), 'CadetBlue2': ('142', '229', '238'), 'CadetBlue3': ('122', '197', '205'), 'CadetBlue4': ('83', '134', '139'), 'turquoise1': ('0', '245', '255'), 'turquoise2': ('0', '229', '238'), 'turquoise3': ('0', '197', '205'), 'turquoise4': ('0', '134', '139'), 'cyan1': ('0', '255', '255'), 'cyan2': ('0', '238', '238'), 'cyan3': ('0', '205', '205'), 'cyan4': ('0', '139', '139'), 'DarkSlateGray1': ('151', '255', '255'), 'DarkSlateGray2': ('141', '238', '238'), 'DarkSlateGray3': ('121', '205', '205'), 'DarkSlateGray4': ('82', '139', '139'), 'aquamarine1': ('127', '255', '212'), 'aquamarine2': ('118', '238', '198'), 'aquamarine3': ('102', '205', '170'), 'aquamarine4': ('69', '139', '116'), 'DarkSeaGreen1': ('193', '255', '193'), 'DarkSeaGreen2': ('180', '238', '180'), 'DarkSeaGreen3': ('155', '205', '155'), 'DarkSeaGreen4': ('105', '139', '105'), 'SeaGreen1': ('84', '255', '159'), 'SeaGreen2': ('78', '238', '148'), 'SeaGreen3': ('67', '205', '128'), 'SeaGreen4': ('46', '139', '87'), 'PaleGreen1': ('154', '255', '154'), 'PaleGreen2': ('144', '238', '144'), 'PaleGreen3': ('124', '205', '124'), 'PaleGreen4': ('84', '139', '84'), 'SpringGreen1': ('0', '255', '127'), 'SpringGreen2': ('0', '238', '118'), 'SpringGreen3': ('0', '205', '102'), 'SpringGreen4': ('0', '139', '69'), 'green1': ('0', '255', '0'), 'green2': ('0', '238', '0'), 'green3': ('0', '205', '0'), 'green4': ('0', '139', '0'), 'chartreuse1': ('127', '255', '0'), 'chartreuse2': ('118', '238', '0'), 'chartreuse3': ('102', '205', '0'), 'chartreuse4': ('69', '139', '0'), 'OliveDrab1': ('192', '255', '62'), 'OliveDrab2': ('179', '238', '58'), 'OliveDrab3': ('154', '205', '50'), 'OliveDrab4': ('105', '139', '34'), 'DarkOliveGreen1': ('202', '255', '112'), 'DarkOliveGreen2': ('188', '238', '104'), 'DarkOliveGreen3': ('162', '205', '90'), 'DarkOliveGreen4': ('110', '139', '61'), 'khaki1': ('255', '246', '143'), 'khaki2': ('238', '230', '133'), 'khaki3': ('205', '198', '115'), 'khaki4': ('139', '134', '78'), 'LightGoldenrod1': ('255', '236', '139'), 'LightGoldenrod2': ('238', '220', '130'), 'LightGoldenrod3': ('205', '190', '112'), 'LightGoldenrod4': ('139', '129', '76'), 'LightYellow1': ('255', '255', '224'), 'LightYellow2': ('238', '238', '209'), 'LightYellow3': ('205', '205', '180'), 'LightYellow4': ('139', '139', '122'), 'yellow1': ('255', '255', '0'), 'yellow2': ('238', '238', '0'), 'yellow3': ('205', '205', '0'), 'yellow4': ('139', '139', '0'), 'gold1': ('255', '215', '0'), 'gold2': ('238', '201', '0'), 'gold3': ('205', '173', '0'), 'gold4': ('139', '117', '0'), 'goldenrod1': ('255', '193', '37'), 'goldenrod2': ('238', '180', '34'), 'goldenrod3': ('205', '155', '29'), 'goldenrod4': ('139', '105', '20'), 'DarkGoldenrod1': ('255', '185', '15'), 'DarkGoldenrod2': ('238', '173', '14'), 'DarkGoldenrod3': ('205', '149', '12'), 'DarkGoldenrod4': ('139', '101', '8'), 'RosyBrown1': ('255', '193', '193'), 'RosyBrown2': ('238', '180', '180'), 'RosyBrown3': ('205', '155', '155'), 'RosyBrown4': ('139', '105', '105'), 'IndianRed1': ('255', '106', '106'), 'IndianRed2': ('238', '99', '99'), 'IndianRed3': ('205', '85', '85'), 'IndianRed4': ('139', '58', '58'), 'sienna1': ('255', '130', '71'), 'sienna2': ('238', '121', '66'), 'sienna3': ('205', '104', '57'), 'sienna4': ('139', '71', '38'), 'burlywood1': ('255', '211', '155'), 'burlywood2': ('238', '197', '145'), 'burlywood3': ('205', '170', '125'), 'burlywood4': ('139', '115', '85'), 'wheat1': ('255', '231', '186'), 'wheat2': ('238', '216', '174'), 'wheat3': ('205', '186', '150'), 'wheat4': ('139', '126', '102'), 'tan1': ('255', '165', '79'), 'tan2': ('238', '154', '73'), 'tan3': ('205', '133', '63'), 'tan4': ('139', '90', '43'), 'chocolate1': ('255', '127', '36'), 'chocolate2': ('238', '118', '33'), 'chocolate3': ('205', '102', '29'), 'chocolate4': ('139', '69', '19'), 'firebrick1': ('255', '48', '48'), 'firebrick2': ('238', '44', '44'), 'firebrick3': ('205', '38', '38'), 'firebrick4': ('139', '26', '26'), 'brown1': ('255', '64', '64'), 'brown2': ('238', '59', '59'), 'brown3': ('205', '51', '51'), 'brown4': ('139', '35', '35'), 'salmon1': ('255', '140', '105'), 'salmon2': ('238', '130', '98'), 'salmon3': ('205', '112', '84'), 'salmon4': ('139', '76', '57'), 'LightSalmon1': ('255', '160', '122'), 'LightSalmon2': ('238', '149', '114'), 'LightSalmon3': ('205', '129', '98'), 'LightSalmon4': ('139', '87', '66'), 'orange1': ('255', '165', '0'), 'orange2': ('238', '154', '0'), 'orange3': ('205', '133', '0'), 'orange4': ('139', '90', '0'), 'DarkOrange1': ('255', '127', '0'), 'DarkOrange2': ('238', '118', '0'), 'DarkOrange3': ('205', '102', '0'), 'DarkOrange4': ('139', '69', '0'), 'coral1': ('255', '114', '86'), 'coral2': ('238', '106', '80'), 'coral3': ('205', '91', '69'), 'coral4': ('139', '62', '47'), 'tomato1': ('255', '99', '71'), 'tomato2': ('238', '92', '66'), 'tomato3': ('205', '79', '57'), 'tomato4': ('139', '54', '38'), 'OrangeRed1': ('255', '69', '0'), 'OrangeRed2': ('238', '64', '0'), 'OrangeRed3': ('205', '55', '0'), 'OrangeRed4': ('139', '37', '0'), 'red1': ('255', '0', '0'), 'red2': ('238', '0', '0'), 'red3': ('205', '0', '0'), 'red4': ('139', '0', '0'), 'DeepPink1': ('255', '20', '147'), 'DeepPink2': ('238', '18', '137'), 'DeepPink3': ('205', '16', '118'), 'DeepPink4': ('139', '10', '80'), 'HotPink1': ('255', '110', '180'), 'HotPink2': ('238', '106', '167'), 'HotPink3': ('205', '96', '144'), 'HotPink4': ('139', '58', '98'), 'pink1': ('255', '181', '197'), 'pink2': ('238', '169', '184'), 'pink3': ('205', '145', '158'), 'pink4': ('139', '99', '108'), 'LightPink1': ('255', '174', '185'), 'LightPink2': ('238', '162', '173'), 'LightPink3': ('205', '140', '149'), 'LightPink4': ('139', '95', '101'), 'PaleVioletRed1': ('255', '130', '171'), 'PaleVioletRed2': ('238', '121', '159'), 'PaleVioletRed3': ('205', '104', '137'), 'PaleVioletRed4': ('139', '71', '93'), 'maroon1': ('255', '52', '179'), 'maroon2': ('238', '48', '167'), 'maroon3': ('205', '41', '144'), 'maroon4': ('139', '28', '98'), 'VioletRed1': ('255', '62', '150'), 'VioletRed2': ('238', '58', '140'), 'VioletRed3': ('205', '50', '120'), 'VioletRed4': ('139', '34', '82'), 'magenta1': ('255', '0', '255'), 'magenta2': ('238', '0', '238'), 'magenta3': ('205', '0', '205'), 'magenta4': ('139', '0', '139'), 'orchid1': ('255', '131', '250'), 'orchid2': ('238', '122', '233'), 'orchid3': ('205', '105', '201'), 'orchid4': ('139', '71', '137'), 'plum1': ('255', '187', '255'), 'plum2': ('238', '174', '238'), 'plum3': ('205', '150', '205'), 'plum4': ('139', '102', '139'), 'MediumOrchid1': ('224', '102', '255'), 'MediumOrchid2': ('209', '95', '238'), 'MediumOrchid3': ('180', '82', '205'), 'MediumOrchid4': ('122', '55', '139'), 'DarkOrchid1': ('191', '62', '255'), 'DarkOrchid2': ('178', '58', '238'), 'DarkOrchid3': ('154', '50', '205'), 'DarkOrchid4': ('104', '34', '139'), 'purple1': ('155', '48', '255'), 'purple2': ('145', '44', '238'), 'purple3': ('125', '38', '205'), 'purple4': ('85', '26', '139'), 'MediumPurple1': ('171', '130', '255'), 'MediumPurple2': ('159', '121', '238'), 'MediumPurple3': ('137', '104', '205'), 'MediumPurple4': ('93', '71', '139'), 'thistle1': ('255', '225', '255'), 'thistle2': ('238', '210', '238'), 'thistle3': ('205', '181', '205'), 'thistle4': ('139', '123', '139'), 'gray0': ('0', '0', '0'), 'grey0': ('0', '0', '0'), 'gray1': ('3', '3', '3'), 'grey1': ('3', '3', '3'), 'gray2': ('5', '5', '5'), 'grey2': ('5', '5', '5'), 'gray3': ('8', '8', '8'), 'grey3': ('8', '8', '8'), 'gray4': ('10', '10', '10'), 'grey4': ('10', '10', '10'), 'gray5': ('13', '13', '13'), 'grey5': ('13', '13', '13'), 'gray6': ('15', '15', '15'), 'grey6': ('15', '15', '15'), 'gray7': ('18', '18', '18'), 'grey7': ('18', '18', '18'), 'gray8': ('20', '20', '20'), 'grey8': ('20', '20', '20'), 'gray9': ('23', '23', '23'), 'grey9': ('23', '23', '23'), 'gray10': ('26', '26', '26'), 'grey10': ('26', '26', '26'), 'gray11': ('28', '28', '28'), 'grey11': ('28', '28', '28'), 'gray12': ('31', '31', '31'), 'grey12': ('31', '31', '31'), 'gray13': ('33', '33', '33'), 'grey13': ('33', '33', '33'), 'gray14': ('36', '36', '36'), 'grey14': ('36', '36', '36'), 'gray15': ('38', '38', '38'), 'grey15': ('38', '38', '38'), 'gray16': ('41', '41', '41'), 'grey16': ('41', '41', '41'), 'gray17': ('43', '43', '43'), 'grey17': ('43', '43', '43'), 'gray18': ('46', '46', '46'), 'grey18': ('46', '46', '46'), 'gray19': ('48', '48', '48'), 'grey19': ('48', '48', '48'), 'gray20': ('51', '51', '51'), 'grey20': ('51', '51', '51'), 'gray21': ('54', '54', '54'), 'grey21': ('54', '54', '54'), 'gray22': ('56', '56', '56'), 'grey22': ('56', '56', '56'), 'gray23': ('59', '59', '59'), 'grey23': ('59', '59', '59'), 'gray24': ('61', '61', '61'), 'grey24': ('61', '61', '61'), 'gray25': ('64', '64', '64'), 'grey25': ('64', '64', '64'), 'gray26': ('66', '66', '66'), 'grey26': ('66', '66', '66'), 'gray27': ('69', '69', '69'), 'grey27': ('69', '69', '69'), 'gray28': ('71', '71', '71'), 'grey28': ('71', '71', '71'), 'gray29': ('74', '74', '74'), 'grey29': ('74', '74', '74'), 'gray30': ('77', '77', '77'), 'grey30': ('77', '77', '77'), 'gray31': ('79', '79', '79'), 'grey31': ('79', '79', '79'), 'gray32': ('82', '82', '82'), 'grey32': ('82', '82', '82'), 'gray33': ('84', '84', '84'), 'grey33': ('84', '84', '84'), 'gray34': ('87', '87', '87'), 'grey34': ('87', '87', '87'), 'gray35': ('89', '89', '89'), 'grey35': ('89', '89', '89'), 'gray36': ('92', '92', '92'), 'grey36': ('92', '92', '92'), 'gray37': ('94', '94', '94'), 'grey37': ('94', '94', '94'), 'gray38': ('97', '97', '97'), 'grey38': ('97', '97', '97'), 'gray39': ('99', '99', '99'), 'grey39': ('99', '99', '99'), 'gray40': ('102', '102', '102'), 'grey40': ('102', '102', '102'), 'gray41': ('105', '105', '105'), 'grey41': ('105', '105', '105'), 'gray42': ('107', '107', '107'), 'grey42': ('107', '107', '107'), 'gray43': ('110', '110', '110'), 'grey43': ('110', '110', '110'), 'gray44': ('112', '112', '112'), 'grey44': ('112', '112', '112'), 'gray45': ('115', '115', '115'), 'grey45': ('115', '115', '115'), 'gray46': ('117', '117', '117'), 'grey46': ('117', '117', '117'), 'gray47': ('120', '120', '120'), 'grey47': ('120', '120', '120'), 'gray48': ('122', '122', '122'), 'grey48': ('122', '122', '122'), 'gray49': ('125', '125', '125'), 'grey49': ('125', '125', '125'), 'gray50': ('127', '127', '127'), 'grey50': ('127', '127', '127'), 'gray51': ('130', '130', '130'), 'grey51': ('130', '130', '130'), 'gray52': ('133', '133', '133'), 'grey52': ('133', '133', '133'), 'gray53': ('135', '135', '135'), 'grey53': ('135', '135', '135'), 'gray54': ('138', '138', '138'), 'grey54': ('138', '138', '138'), 'gray55': ('140', '140', '140'), 'grey55': ('140', '140', '140'), 'gray56': ('143', '143', '143'), 'grey56': ('143', '143', '143'), 'gray57': ('145', '145', '145'), 'grey57': ('145', '145', '145'), 'gray58': ('148', '148', '148'), 'grey58': ('148', '148', '148'), 'gray59': ('150', '150', '150'), 'grey59': ('150', '150', '150'), 'gray60': ('153', '153', '153'), 'grey60': ('153', '153', '153'), 'gray61': ('156', '156', '156'), 'grey61': ('156', '156', '156'), 'gray62': ('158', '158', '158'), 'grey62': ('158', '158', '158'), 'gray63': ('161', '161', '161'), 'grey63': ('161', '161', '161'), 'gray64': ('163', '163', '163'), 'grey64': ('163', '163', '163'), 'gray65': ('166', '166', '166'), 'grey65': ('166', '166', '166'), 'gray66': ('168', '168', '168'), 'grey66': ('168', '168', '168'), 'gray67': ('171', '171', '171'), 'grey67': ('171', '171', '171'), 'gray68': ('173', '173', '173'), 'grey68': ('173', '173', '173'), 'gray69': ('176', '176', '176'), 'grey69': ('176', '176', '176'), 'gray70': ('179', '179', '179'), 'grey70': ('179', '179', '179'), 'gray71': ('181', '181', '181'), 'grey71': ('181', '181', '181'), 'gray72': ('184', '184', '184'), 'grey72': ('184', '184', '184'), 'gray73': ('186', '186', '186'), 'grey73': ('186', '186', '186'), 'gray74': ('189', '189', '189'), 'grey74': ('189', '189', '189'), 'gray75': ('191', '191', '191'), 'grey75': ('191', '191', '191'), 'gray76': ('194', '194', '194'), 'grey76': ('194', '194', '194'), 'gray77': ('196', '196', '196'), 'grey77': ('196', '196', '196'), 'gray78': ('199', '199', '199'), 'grey78': ('199', '199', '199'), 'gray79': ('201', '201', '201'), 'grey79': ('201', '201', '201'), 'gray80': ('204', '204', '204'), 'grey80': ('204', '204', '204'), 'gray81': ('207', '207', '207'), 'grey81': ('207', '207', '207'), 'gray82': ('209', '209', '209'), 'grey82': ('209', '209', '209'), 'gray83': ('212', '212', '212'), 'grey83': ('212', '212', '212'), 'gray84': ('214', '214', '214'), 'grey84': ('214', '214', '214'), 'gray85': ('217', '217', '217'), 'grey85': ('217', '217', '217'), 'gray86': ('219', '219', '219'), 'grey86': ('219', '219', '219'), 'gray87': ('222', '222', '222'), 'grey87': ('222', '222', '222'), 'gray88': ('224', '224', '224'), 'grey88': ('224', '224', '224'), 'gray89': ('227', '227', '227'), 'grey89': ('227', '227', '227'), 'gray90': ('229', '229', '229'), 'grey90': ('229', '229', '229'), 'gray91': ('232', '232', '232'), 'grey91': ('232', '232', '232'), 'gray92': ('235', '235', '235'), 'grey92': ('235', '235', '235'), 'gray93': ('237', '237', '237'), 'grey93': ('237', '237', '237'), 'gray94': ('240', '240', '240'), 'grey94': ('240', '240', '240'), 'gray95': ('242', '242', '242'), 'grey95': ('242', '242', '242'), 'gray96': ('245', '245', '245'), 'grey96': ('245', '245', '245'), 'gray97': ('247', '247', '247'), 'grey97': ('247', '247', '247'), 'gray98': ('250', '250', '250'), 'grey98': ('250', '250', '250'), 'gray99': ('252', '252', '252'), 'grey99': ('252', '252', '252'), 'gray100': ('255', '255', '255'), 'grey100': ('255', '255', '255'), 'darkgrey': ('169', '169', '169'), 'DarkGrey': ('169', '169', '169'), 'darkgray': ('169', '169', '169'), 'DarkGray': ('169', '169', '169'), 'darkblue': ('0', '0', '139'), 'DarkBlue': ('0', '0', '139'), 'darkcyan': ('0', '139', '139'), 'DarkCyan': ('0', '139', '139'), 'darkmagenta': ('139', '0', '139'), 'DarkMagenta': ('139', '0', '139'), 'darkred': ('139', '0', '0'), 'DarkRed': ('139', '0', '0'), 'lightgreen': ('144', '238', '144'), 'LightGreen': ('144', '238', '144')}
colors = {'snow': ('255', '250', '250'), 'ghostwhite': ('248', '248', '255'), 'GhostWhite': ('248', '248', '255'), 'whitesmoke': ('245', '245', '245'), 'WhiteSmoke': ('245', '245', '245'), 'gainsboro': ('220', '220', '220'), 'floralwhite': ('255', '250', '240'), 'FloralWhite': ('255', '250', '240'), 'oldlace': ('253', '245', '230'), 'OldLace': ('253', '245', '230'), 'linen': ('250', '240', '230'), 'antiquewhite': ('250', '235', '215'), 'AntiqueWhite': ('250', '235', '215'), 'papayawhip': ('255', '239', '213'), 'PapayaWhip': ('255', '239', '213'), 'blanchedalmond': ('255', '235', '205'), 'BlanchedAlmond': ('255', '235', '205'), 'bisque': ('255', '228', '196'), 'peachpuff': ('255', '218', '185'), 'PeachPuff': ('255', '218', '185'), 'navajowhite': ('255', '222', '173'), 'NavajoWhite': ('255', '222', '173'), 'moccasin': ('255', '228', '181'), 'cornsilk': ('255', '248', '220'), 'ivory': ('255', '255', '240'), 'lemonchiffon': ('255', '250', '205'), 'LemonChiffon': ('255', '250', '205'), 'seashell': ('255', '245', '238'), 'honeydew': ('240', '255', '240'), 'mintcream': ('245', '255', '250'), 'MintCream': ('245', '255', '250'), 'azure': ('240', '255', '255'), 'aliceblue': ('240', '248', '255'), 'AliceBlue': ('240', '248', '255'), 'lavender': ('230', '230', '250'), 'lavenderblush': ('255', '240', '245'), 'LavenderBlush': ('255', '240', '245'), 'mistyrose': ('255', '228', '225'), 'MistyRose': ('255', '228', '225'), 'white': ('255', '255', '255'), 'black': ('0', '0', '0'), 'darkslategray': ('47', '79', '79'), 'DarkSlateGray': ('47', '79', '79'), 'darkslategrey': ('47', '79', '79'), 'DarkSlateGrey': ('47', '79', '79'), 'dimgray': ('105', '105', '105'), 'DimGray': ('105', '105', '105'), 'dimgrey': ('105', '105', '105'), 'DimGrey': ('105', '105', '105'), 'slategray': ('112', '128', '144'), 'SlateGray': ('112', '128', '144'), 'slategrey': ('112', '128', '144'), 'SlateGrey': ('112', '128', '144'), 'lightslategray': ('119', '136', '153'), 'LightSlateGray': ('119', '136', '153'), 'lightslategrey': ('119', '136', '153'), 'LightSlateGrey': ('119', '136', '153'), 'gray': ('190', '190', '190'), 'grey': ('190', '190', '190'), 'lightgrey': ('211', '211', '211'), 'LightGrey': ('211', '211', '211'), 'lightgray': ('211', '211', '211'), 'LightGray': ('211', '211', '211'), 'midnightblue': ('25', '25', '112'), 'MidnightBlue': ('25', '25', '112'), 'navy': ('0', '0', '128'), 'navyblue': ('0', '0', '128'), 'NavyBlue': ('0', '0', '128'), 'cornflowerblue': ('100', '149', '237'), 'CornflowerBlue': ('100', '149', '237'), 'darkslateblue': ('72', '61', '139'), 'DarkSlateBlue': ('72', '61', '139'), 'slateblue': ('106', '90', '205'), 'SlateBlue': ('106', '90', '205'), 'mediumslateblue': ('123', '104', '238'), 'MediumSlateBlue': ('123', '104', '238'), 'lightslateblue': ('132', '112', '255'), 'LightSlateBlue': ('132', '112', '255'), 'mediumblue': ('0', '0', '205'), 'MediumBlue': ('0', '0', '205'), 'royalblue': ('65', '105', '225'), 'RoyalBlue': ('65', '105', '225'), 'blue': ('0', '0', '255'), 'dodgerblue': ('30', '144', '255'), 'DodgerBlue': ('30', '144', '255'), 'deepskyblue': ('0', '191', '255'), 'DeepSkyBlue': ('0', '191', '255'), 'skyblue': ('135', '206', '235'), 'SkyBlue': ('135', '206', '235'), 'lightskyblue': ('135', '206', '250'), 'LightSkyBlue': ('135', '206', '250'), 'steelblue': ('70', '130', '180'), 'SteelBlue': ('70', '130', '180'), 'lightsteelblue': ('176', '196', '222'), 'LightSteelBlue': ('176', '196', '222'), 'lightblue': ('173', '216', '230'), 'LightBlue': ('173', '216', '230'), 'powderblue': ('176', '224', '230'), 'PowderBlue': ('176', '224', '230'), 'paleturquoise': ('175', '238', '238'), 'PaleTurquoise': ('175', '238', '238'), 'darkturquoise': ('0', '206', '209'), 'DarkTurquoise': ('0', '206', '209'), 'mediumturquoise': ('72', '209', '204'), 'MediumTurquoise': ('72', '209', '204'), 'turquoise': ('64', '224', '208'), 'cyan': ('0', '255', '255'), 'lightcyan': ('224', '255', '255'), 'LightCyan': ('224', '255', '255'), 'cadetblue': ('95', '158', '160'), 'CadetBlue': ('95', '158', '160'), 'mediumaquamarine': ('102', '205', '170'), 'MediumAquamarine': ('102', '205', '170'), 'aquamarine': ('127', '255', '212'), 'darkgreen': ('0', '100', '0'), 'DarkGreen': ('0', '100', '0'), 'darkolivegreen': ('85', '107', '47'), 'DarkOliveGreen': ('85', '107', '47'), 'darkseagreen': ('143', '188', '143'), 'DarkSeaGreen': ('143', '188', '143'), 'seagreen': ('46', '139', '87'), 'SeaGreen': ('46', '139', '87'), 'mediumseagreen': ('60', '179', '113'), 'MediumSeaGreen': ('60', '179', '113'), 'lightseagreen': ('32', '178', '170'), 'LightSeaGreen': ('32', '178', '170'), 'palegreen': ('152', '251', '152'), 'PaleGreen': ('152', '251', '152'), 'springgreen': ('0', '255', '127'), 'SpringGreen': ('0', '255', '127'), 'lawngreen': ('124', '252', '0'), 'LawnGreen': ('124', '252', '0'), 'green': ('0', '255', '0'), 'chartreuse': ('127', '255', '0'), 'mediumspringgreen': ('0', '250', '154'), 'MediumSpringGreen': ('0', '250', '154'), 'greenyellow': ('173', '255', '47'), 'GreenYellow': ('173', '255', '47'), 'limegreen': ('50', '205', '50'), 'LimeGreen': ('50', '205', '50'), 'yellowgreen': ('154', '205', '50'), 'YellowGreen': ('154', '205', '50'), 'forestgreen': ('34', '139', '34'), 'ForestGreen': ('34', '139', '34'), 'olivedrab': ('107', '142', '35'), 'OliveDrab': ('107', '142', '35'), 'darkkhaki': ('189', '183', '107'), 'DarkKhaki': ('189', '183', '107'), 'khaki': ('240', '230', '140'), 'palegoldenrod': ('238', '232', '170'), 'PaleGoldenrod': ('238', '232', '170'), 'lightgoldenrodyellow': ('250', '250', '210'), 'LightGoldenrodYellow': ('250', '250', '210'), 'lightyellow': ('255', '255', '224'), 'LightYellow': ('255', '255', '224'), 'yellow': ('255', '255', '0'), 'gold': ('255', '215', '0'), 'lightgoldenrod': ('238', '221', '130'), 'LightGoldenrod': ('238', '221', '130'), 'goldenrod': ('218', '165', '32'), 'darkgoldenrod': ('184', '134', '11'), 'DarkGoldenrod': ('184', '134', '11'), 'rosybrown': ('188', '143', '143'), 'RosyBrown': ('188', '143', '143'), 'indianred': ('205', '92', '92'), 'IndianRed': ('205', '92', '92'), 'saddlebrown': ('139', '69', '19'), 'SaddleBrown': ('139', '69', '19'), 'sienna': ('160', '82', '45'), 'peru': ('205', '133', '63'), 'burlywood': ('222', '184', '135'), 'beige': ('245', '245', '220'), 'wheat': ('245', '222', '179'), 'sandybrown': ('244', '164', '96'), 'SandyBrown': ('244', '164', '96'), 'tan': ('210', '180', '140'), 'chocolate': ('210', '105', '30'), 'firebrick': ('178', '34', '34'), 'brown': ('165', '42', '42'), 'darksalmon': ('233', '150', '122'), 'DarkSalmon': ('233', '150', '122'), 'salmon': ('250', '128', '114'), 'lightsalmon': ('255', '160', '122'), 'LightSalmon': ('255', '160', '122'), 'orange': ('255', '165', '0'), 'darkorange': ('255', '140', '0'), 'DarkOrange': ('255', '140', '0'), 'coral': ('255', '127', '80'), 'lightcoral': ('240', '128', '128'), 'LightCoral': ('240', '128', '128'), 'tomato': ('255', '99', '71'), 'orangered': ('255', '69', '0'), 'OrangeRed': ('255', '69', '0'), 'red': ('255', '0', '0'), 'hotpink': ('255', '105', '180'), 'HotPink': ('255', '105', '180'), 'deeppink': ('255', '20', '147'), 'DeepPink': ('255', '20', '147'), 'pink': ('255', '192', '203'), 'lightpink': ('255', '182', '193'), 'LightPink': ('255', '182', '193'), 'palevioletred': ('219', '112', '147'), 'PaleVioletRed': ('219', '112', '147'), 'maroon': ('176', '48', '96'), 'mediumvioletred': ('199', '21', '133'), 'MediumVioletRed': ('199', '21', '133'), 'violetred': ('208', '32', '144'), 'VioletRed': ('208', '32', '144'), 'magenta': ('255', '0', '255'), 'violet': ('238', '130', '238'), 'plum': ('221', '160', '221'), 'orchid': ('218', '112', '214'), 'mediumorchid': ('186', '85', '211'), 'MediumOrchid': ('186', '85', '211'), 'darkorchid': ('153', '50', '204'), 'DarkOrchid': ('153', '50', '204'), 'darkviolet': ('148', '0', '211'), 'DarkViolet': ('148', '0', '211'), 'blueviolet': ('138', '43', '226'), 'BlueViolet': ('138', '43', '226'), 'purple': ('160', '32', '240'), 'mediumpurple': ('147', '112', '219'), 'MediumPurple': ('147', '112', '219'), 'thistle': ('216', '191', '216'), 'snow1': ('255', '250', '250'), 'snow2': ('238', '233', '233'), 'snow3': ('205', '201', '201'), 'snow4': ('139', '137', '137'), 'seashell1': ('255', '245', '238'), 'seashell2': ('238', '229', '222'), 'seashell3': ('205', '197', '191'), 'seashell4': ('139', '134', '130'), 'AntiqueWhite1': ('255', '239', '219'), 'AntiqueWhite2': ('238', '223', '204'), 'AntiqueWhite3': ('205', '192', '176'), 'AntiqueWhite4': ('139', '131', '120'), 'bisque1': ('255', '228', '196'), 'bisque2': ('238', '213', '183'), 'bisque3': ('205', '183', '158'), 'bisque4': ('139', '125', '107'), 'PeachPuff1': ('255', '218', '185'), 'PeachPuff2': ('238', '203', '173'), 'PeachPuff3': ('205', '175', '149'), 'PeachPuff4': ('139', '119', '101'), 'NavajoWhite1': ('255', '222', '173'), 'NavajoWhite2': ('238', '207', '161'), 'NavajoWhite3': ('205', '179', '139'), 'NavajoWhite4': ('139', '121', '94'), 'LemonChiffon1': ('255', '250', '205'), 'LemonChiffon2': ('238', '233', '191'), 'LemonChiffon3': ('205', '201', '165'), 'LemonChiffon4': ('139', '137', '112'), 'cornsilk1': ('255', '248', '220'), 'cornsilk2': ('238', '232', '205'), 'cornsilk3': ('205', '200', '177'), 'cornsilk4': ('139', '136', '120'), 'ivory1': ('255', '255', '240'), 'ivory2': ('238', '238', '224'), 'ivory3': ('205', '205', '193'), 'ivory4': ('139', '139', '131'), 'honeydew1': ('240', '255', '240'), 'honeydew2': ('224', '238', '224'), 'honeydew3': ('193', '205', '193'), 'honeydew4': ('131', '139', '131'), 'LavenderBlush1': ('255', '240', '245'), 'LavenderBlush2': ('238', '224', '229'), 'LavenderBlush3': ('205', '193', '197'), 'LavenderBlush4': ('139', '131', '134'), 'MistyRose1': ('255', '228', '225'), 'MistyRose2': ('238', '213', '210'), 'MistyRose3': ('205', '183', '181'), 'MistyRose4': ('139', '125', '123'), 'azure1': ('240', '255', '255'), 'azure2': ('224', '238', '238'), 'azure3': ('193', '205', '205'), 'azure4': ('131', '139', '139'), 'SlateBlue1': ('131', '111', '255'), 'SlateBlue2': ('122', '103', '238'), 'SlateBlue3': ('105', '89', '205'), 'SlateBlue4': ('71', '60', '139'), 'RoyalBlue1': ('72', '118', '255'), 'RoyalBlue2': ('67', '110', '238'), 'RoyalBlue3': ('58', '95', '205'), 'RoyalBlue4': ('39', '64', '139'), 'blue1': ('0', '0', '255'), 'blue2': ('0', '0', '238'), 'blue3': ('0', '0', '205'), 'blue4': ('0', '0', '139'), 'DodgerBlue1': ('30', '144', '255'), 'DodgerBlue2': ('28', '134', '238'), 'DodgerBlue3': ('24', '116', '205'), 'DodgerBlue4': ('16', '78', '139'), 'SteelBlue1': ('99', '184', '255'), 'SteelBlue2': ('92', '172', '238'), 'SteelBlue3': ('79', '148', '205'), 'SteelBlue4': ('54', '100', '139'), 'DeepSkyBlue1': ('0', '191', '255'), 'DeepSkyBlue2': ('0', '178', '238'), 'DeepSkyBlue3': ('0', '154', '205'), 'DeepSkyBlue4': ('0', '104', '139'), 'SkyBlue1': ('135', '206', '255'), 'SkyBlue2': ('126', '192', '238'), 'SkyBlue3': ('108', '166', '205'), 'SkyBlue4': ('74', '112', '139'), 'LightSkyBlue1': ('176', '226', '255'), 'LightSkyBlue2': ('164', '211', '238'), 'LightSkyBlue3': ('141', '182', '205'), 'LightSkyBlue4': ('96', '123', '139'), 'SlateGray1': ('198', '226', '255'), 'SlateGray2': ('185', '211', '238'), 'SlateGray3': ('159', '182', '205'), 'SlateGray4': ('108', '123', '139'), 'LightSteelBlue1': ('202', '225', '255'), 'LightSteelBlue2': ('188', '210', '238'), 'LightSteelBlue3': ('162', '181', '205'), 'LightSteelBlue4': ('110', '123', '139'), 'LightBlue1': ('191', '239', '255'), 'LightBlue2': ('178', '223', '238'), 'LightBlue3': ('154', '192', '205'), 'LightBlue4': ('104', '131', '139'), 'LightCyan1': ('224', '255', '255'), 'LightCyan2': ('209', '238', '238'), 'LightCyan3': ('180', '205', '205'), 'LightCyan4': ('122', '139', '139'), 'PaleTurquoise1': ('187', '255', '255'), 'PaleTurquoise2': ('174', '238', '238'), 'PaleTurquoise3': ('150', '205', '205'), 'PaleTurquoise4': ('102', '139', '139'), 'CadetBlue1': ('152', '245', '255'), 'CadetBlue2': ('142', '229', '238'), 'CadetBlue3': ('122', '197', '205'), 'CadetBlue4': ('83', '134', '139'), 'turquoise1': ('0', '245', '255'), 'turquoise2': ('0', '229', '238'), 'turquoise3': ('0', '197', '205'), 'turquoise4': ('0', '134', '139'), 'cyan1': ('0', '255', '255'), 'cyan2': ('0', '238', '238'), 'cyan3': ('0', '205', '205'), 'cyan4': ('0', '139', '139'), 'DarkSlateGray1': ('151', '255', '255'), 'DarkSlateGray2': ('141', '238', '238'), 'DarkSlateGray3': ('121', '205', '205'), 'DarkSlateGray4': ('82', '139', '139'), 'aquamarine1': ('127', '255', '212'), 'aquamarine2': ('118', '238', '198'), 'aquamarine3': ('102', '205', '170'), 'aquamarine4': ('69', '139', '116'), 'DarkSeaGreen1': ('193', '255', '193'), 'DarkSeaGreen2': ('180', '238', '180'), 'DarkSeaGreen3': ('155', '205', '155'), 'DarkSeaGreen4': ('105', '139', '105'), 'SeaGreen1': ('84', '255', '159'), 'SeaGreen2': ('78', '238', '148'), 'SeaGreen3': ('67', '205', '128'), 'SeaGreen4': ('46', '139', '87'), 'PaleGreen1': ('154', '255', '154'), 'PaleGreen2': ('144', '238', '144'), 'PaleGreen3': ('124', '205', '124'), 'PaleGreen4': ('84', '139', '84'), 'SpringGreen1': ('0', '255', '127'), 'SpringGreen2': ('0', '238', '118'), 'SpringGreen3': ('0', '205', '102'), 'SpringGreen4': ('0', '139', '69'), 'green1': ('0', '255', '0'), 'green2': ('0', '238', '0'), 'green3': ('0', '205', '0'), 'green4': ('0', '139', '0'), 'chartreuse1': ('127', '255', '0'), 'chartreuse2': ('118', '238', '0'), 'chartreuse3': ('102', '205', '0'), 'chartreuse4': ('69', '139', '0'), 'OliveDrab1': ('192', '255', '62'), 'OliveDrab2': ('179', '238', '58'), 'OliveDrab3': ('154', '205', '50'), 'OliveDrab4': ('105', '139', '34'), 'DarkOliveGreen1': ('202', '255', '112'), 'DarkOliveGreen2': ('188', '238', '104'), 'DarkOliveGreen3': ('162', '205', '90'), 'DarkOliveGreen4': ('110', '139', '61'), 'khaki1': ('255', '246', '143'), 'khaki2': ('238', '230', '133'), 'khaki3': ('205', '198', '115'), 'khaki4': ('139', '134', '78'), 'LightGoldenrod1': ('255', '236', '139'), 'LightGoldenrod2': ('238', '220', '130'), 'LightGoldenrod3': ('205', '190', '112'), 'LightGoldenrod4': ('139', '129', '76'), 'LightYellow1': ('255', '255', '224'), 'LightYellow2': ('238', '238', '209'), 'LightYellow3': ('205', '205', '180'), 'LightYellow4': ('139', '139', '122'), 'yellow1': ('255', '255', '0'), 'yellow2': ('238', '238', '0'), 'yellow3': ('205', '205', '0'), 'yellow4': ('139', '139', '0'), 'gold1': ('255', '215', '0'), 'gold2': ('238', '201', '0'), 'gold3': ('205', '173', '0'), 'gold4': ('139', '117', '0'), 'goldenrod1': ('255', '193', '37'), 'goldenrod2': ('238', '180', '34'), 'goldenrod3': ('205', '155', '29'), 'goldenrod4': ('139', '105', '20'), 'DarkGoldenrod1': ('255', '185', '15'), 'DarkGoldenrod2': ('238', '173', '14'), 'DarkGoldenrod3': ('205', '149', '12'), 'DarkGoldenrod4': ('139', '101', '8'), 'RosyBrown1': ('255', '193', '193'), 'RosyBrown2': ('238', '180', '180'), 'RosyBrown3': ('205', '155', '155'), 'RosyBrown4': ('139', '105', '105'), 'IndianRed1': ('255', '106', '106'), 'IndianRed2': ('238', '99', '99'), 'IndianRed3': ('205', '85', '85'), 'IndianRed4': ('139', '58', '58'), 'sienna1': ('255', '130', '71'), 'sienna2': ('238', '121', '66'), 'sienna3': ('205', '104', '57'), 'sienna4': ('139', '71', '38'), 'burlywood1': ('255', '211', '155'), 'burlywood2': ('238', '197', '145'), 'burlywood3': ('205', '170', '125'), 'burlywood4': ('139', '115', '85'), 'wheat1': ('255', '231', '186'), 'wheat2': ('238', '216', '174'), 'wheat3': ('205', '186', '150'), 'wheat4': ('139', '126', '102'), 'tan1': ('255', '165', '79'), 'tan2': ('238', '154', '73'), 'tan3': ('205', '133', '63'), 'tan4': ('139', '90', '43'), 'chocolate1': ('255', '127', '36'), 'chocolate2': ('238', '118', '33'), 'chocolate3': ('205', '102', '29'), 'chocolate4': ('139', '69', '19'), 'firebrick1': ('255', '48', '48'), 'firebrick2': ('238', '44', '44'), 'firebrick3': ('205', '38', '38'), 'firebrick4': ('139', '26', '26'), 'brown1': ('255', '64', '64'), 'brown2': ('238', '59', '59'), 'brown3': ('205', '51', '51'), 'brown4': ('139', '35', '35'), 'salmon1': ('255', '140', '105'), 'salmon2': ('238', '130', '98'), 'salmon3': ('205', '112', '84'), 'salmon4': ('139', '76', '57'), 'LightSalmon1': ('255', '160', '122'), 'LightSalmon2': ('238', '149', '114'), 'LightSalmon3': ('205', '129', '98'), 'LightSalmon4': ('139', '87', '66'), 'orange1': ('255', '165', '0'), 'orange2': ('238', '154', '0'), 'orange3': ('205', '133', '0'), 'orange4': ('139', '90', '0'), 'DarkOrange1': ('255', '127', '0'), 'DarkOrange2': ('238', '118', '0'), 'DarkOrange3': ('205', '102', '0'), 'DarkOrange4': ('139', '69', '0'), 'coral1': ('255', '114', '86'), 'coral2': ('238', '106', '80'), 'coral3': ('205', '91', '69'), 'coral4': ('139', '62', '47'), 'tomato1': ('255', '99', '71'), 'tomato2': ('238', '92', '66'), 'tomato3': ('205', '79', '57'), 'tomato4': ('139', '54', '38'), 'OrangeRed1': ('255', '69', '0'), 'OrangeRed2': ('238', '64', '0'), 'OrangeRed3': ('205', '55', '0'), 'OrangeRed4': ('139', '37', '0'), 'red1': ('255', '0', '0'), 'red2': ('238', '0', '0'), 'red3': ('205', '0', '0'), 'red4': ('139', '0', '0'), 'DeepPink1': ('255', '20', '147'), 'DeepPink2': ('238', '18', '137'), 'DeepPink3': ('205', '16', '118'), 'DeepPink4': ('139', '10', '80'), 'HotPink1': ('255', '110', '180'), 'HotPink2': ('238', '106', '167'), 'HotPink3': ('205', '96', '144'), 'HotPink4': ('139', '58', '98'), 'pink1': ('255', '181', '197'), 'pink2': ('238', '169', '184'), 'pink3': ('205', '145', '158'), 'pink4': ('139', '99', '108'), 'LightPink1': ('255', '174', '185'), 'LightPink2': ('238', '162', '173'), 'LightPink3': ('205', '140', '149'), 'LightPink4': ('139', '95', '101'), 'PaleVioletRed1': ('255', '130', '171'), 'PaleVioletRed2': ('238', '121', '159'), 'PaleVioletRed3': ('205', '104', '137'), 'PaleVioletRed4': ('139', '71', '93'), 'maroon1': ('255', '52', '179'), 'maroon2': ('238', '48', '167'), 'maroon3': ('205', '41', '144'), 'maroon4': ('139', '28', '98'), 'VioletRed1': ('255', '62', '150'), 'VioletRed2': ('238', '58', '140'), 'VioletRed3': ('205', '50', '120'), 'VioletRed4': ('139', '34', '82'), 'magenta1': ('255', '0', '255'), 'magenta2': ('238', '0', '238'), 'magenta3': ('205', '0', '205'), 'magenta4': ('139', '0', '139'), 'orchid1': ('255', '131', '250'), 'orchid2': ('238', '122', '233'), 'orchid3': ('205', '105', '201'), 'orchid4': ('139', '71', '137'), 'plum1': ('255', '187', '255'), 'plum2': ('238', '174', '238'), 'plum3': ('205', '150', '205'), 'plum4': ('139', '102', '139'), 'MediumOrchid1': ('224', '102', '255'), 'MediumOrchid2': ('209', '95', '238'), 'MediumOrchid3': ('180', '82', '205'), 'MediumOrchid4': ('122', '55', '139'), 'DarkOrchid1': ('191', '62', '255'), 'DarkOrchid2': ('178', '58', '238'), 'DarkOrchid3': ('154', '50', '205'), 'DarkOrchid4': ('104', '34', '139'), 'purple1': ('155', '48', '255'), 'purple2': ('145', '44', '238'), 'purple3': ('125', '38', '205'), 'purple4': ('85', '26', '139'), 'MediumPurple1': ('171', '130', '255'), 'MediumPurple2': ('159', '121', '238'), 'MediumPurple3': ('137', '104', '205'), 'MediumPurple4': ('93', '71', '139'), 'thistle1': ('255', '225', '255'), 'thistle2': ('238', '210', '238'), 'thistle3': ('205', '181', '205'), 'thistle4': ('139', '123', '139'), 'gray0': ('0', '0', '0'), 'grey0': ('0', '0', '0'), 'gray1': ('3', '3', '3'), 'grey1': ('3', '3', '3'), 'gray2': ('5', '5', '5'), 'grey2': ('5', '5', '5'), 'gray3': ('8', '8', '8'), 'grey3': ('8', '8', '8'), 'gray4': ('10', '10', '10'), 'grey4': ('10', '10', '10'), 'gray5': ('13', '13', '13'), 'grey5': ('13', '13', '13'), 'gray6': ('15', '15', '15'), 'grey6': ('15', '15', '15'), 'gray7': ('18', '18', '18'), 'grey7': ('18', '18', '18'), 'gray8': ('20', '20', '20'), 'grey8': ('20', '20', '20'), 'gray9': ('23', '23', '23'), 'grey9': ('23', '23', '23'), 'gray10': ('26', '26', '26'), 'grey10': ('26', '26', '26'), 'gray11': ('28', '28', '28'), 'grey11': ('28', '28', '28'), 'gray12': ('31', '31', '31'), 'grey12': ('31', '31', '31'), 'gray13': ('33', '33', '33'), 'grey13': ('33', '33', '33'), 'gray14': ('36', '36', '36'), 'grey14': ('36', '36', '36'), 'gray15': ('38', '38', '38'), 'grey15': ('38', '38', '38'), 'gray16': ('41', '41', '41'), 'grey16': ('41', '41', '41'), 'gray17': ('43', '43', '43'), 'grey17': ('43', '43', '43'), 'gray18': ('46', '46', '46'), 'grey18': ('46', '46', '46'), 'gray19': ('48', '48', '48'), 'grey19': ('48', '48', '48'), 'gray20': ('51', '51', '51'), 'grey20': ('51', '51', '51'), 'gray21': ('54', '54', '54'), 'grey21': ('54', '54', '54'), 'gray22': ('56', '56', '56'), 'grey22': ('56', '56', '56'), 'gray23': ('59', '59', '59'), 'grey23': ('59', '59', '59'), 'gray24': ('61', '61', '61'), 'grey24': ('61', '61', '61'), 'gray25': ('64', '64', '64'), 'grey25': ('64', '64', '64'), 'gray26': ('66', '66', '66'), 'grey26': ('66', '66', '66'), 'gray27': ('69', '69', '69'), 'grey27': ('69', '69', '69'), 'gray28': ('71', '71', '71'), 'grey28': ('71', '71', '71'), 'gray29': ('74', '74', '74'), 'grey29': ('74', '74', '74'), 'gray30': ('77', '77', '77'), 'grey30': ('77', '77', '77'), 'gray31': ('79', '79', '79'), 'grey31': ('79', '79', '79'), 'gray32': ('82', '82', '82'), 'grey32': ('82', '82', '82'), 'gray33': ('84', '84', '84'), 'grey33': ('84', '84', '84'), 'gray34': ('87', '87', '87'), 'grey34': ('87', '87', '87'), 'gray35': ('89', '89', '89'), 'grey35': ('89', '89', '89'), 'gray36': ('92', '92', '92'), 'grey36': ('92', '92', '92'), 'gray37': ('94', '94', '94'), 'grey37': ('94', '94', '94'), 'gray38': ('97', '97', '97'), 'grey38': ('97', '97', '97'), 'gray39': ('99', '99', '99'), 'grey39': ('99', '99', '99'), 'gray40': ('102', '102', '102'), 'grey40': ('102', '102', '102'), 'gray41': ('105', '105', '105'), 'grey41': ('105', '105', '105'), 'gray42': ('107', '107', '107'), 'grey42': ('107', '107', '107'), 'gray43': ('110', '110', '110'), 'grey43': ('110', '110', '110'), 'gray44': ('112', '112', '112'), 'grey44': ('112', '112', '112'), 'gray45': ('115', '115', '115'), 'grey45': ('115', '115', '115'), 'gray46': ('117', '117', '117'), 'grey46': ('117', '117', '117'), 'gray47': ('120', '120', '120'), 'grey47': ('120', '120', '120'), 'gray48': ('122', '122', '122'), 'grey48': ('122', '122', '122'), 'gray49': ('125', '125', '125'), 'grey49': ('125', '125', '125'), 'gray50': ('127', '127', '127'), 'grey50': ('127', '127', '127'), 'gray51': ('130', '130', '130'), 'grey51': ('130', '130', '130'), 'gray52': ('133', '133', '133'), 'grey52': ('133', '133', '133'), 'gray53': ('135', '135', '135'), 'grey53': ('135', '135', '135'), 'gray54': ('138', '138', '138'), 'grey54': ('138', '138', '138'), 'gray55': ('140', '140', '140'), 'grey55': ('140', '140', '140'), 'gray56': ('143', '143', '143'), 'grey56': ('143', '143', '143'), 'gray57': ('145', '145', '145'), 'grey57': ('145', '145', '145'), 'gray58': ('148', '148', '148'), 'grey58': ('148', '148', '148'), 'gray59': ('150', '150', '150'), 'grey59': ('150', '150', '150'), 'gray60': ('153', '153', '153'), 'grey60': ('153', '153', '153'), 'gray61': ('156', '156', '156'), 'grey61': ('156', '156', '156'), 'gray62': ('158', '158', '158'), 'grey62': ('158', '158', '158'), 'gray63': ('161', '161', '161'), 'grey63': ('161', '161', '161'), 'gray64': ('163', '163', '163'), 'grey64': ('163', '163', '163'), 'gray65': ('166', '166', '166'), 'grey65': ('166', '166', '166'), 'gray66': ('168', '168', '168'), 'grey66': ('168', '168', '168'), 'gray67': ('171', '171', '171'), 'grey67': ('171', '171', '171'), 'gray68': ('173', '173', '173'), 'grey68': ('173', '173', '173'), 'gray69': ('176', '176', '176'), 'grey69': ('176', '176', '176'), 'gray70': ('179', '179', '179'), 'grey70': ('179', '179', '179'), 'gray71': ('181', '181', '181'), 'grey71': ('181', '181', '181'), 'gray72': ('184', '184', '184'), 'grey72': ('184', '184', '184'), 'gray73': ('186', '186', '186'), 'grey73': ('186', '186', '186'), 'gray74': ('189', '189', '189'), 'grey74': ('189', '189', '189'), 'gray75': ('191', '191', '191'), 'grey75': ('191', '191', '191'), 'gray76': ('194', '194', '194'), 'grey76': ('194', '194', '194'), 'gray77': ('196', '196', '196'), 'grey77': ('196', '196', '196'), 'gray78': ('199', '199', '199'), 'grey78': ('199', '199', '199'), 'gray79': ('201', '201', '201'), 'grey79': ('201', '201', '201'), 'gray80': ('204', '204', '204'), 'grey80': ('204', '204', '204'), 'gray81': ('207', '207', '207'), 'grey81': ('207', '207', '207'), 'gray82': ('209', '209', '209'), 'grey82': ('209', '209', '209'), 'gray83': ('212', '212', '212'), 'grey83': ('212', '212', '212'), 'gray84': ('214', '214', '214'), 'grey84': ('214', '214', '214'), 'gray85': ('217', '217', '217'), 'grey85': ('217', '217', '217'), 'gray86': ('219', '219', '219'), 'grey86': ('219', '219', '219'), 'gray87': ('222', '222', '222'), 'grey87': ('222', '222', '222'), 'gray88': ('224', '224', '224'), 'grey88': ('224', '224', '224'), 'gray89': ('227', '227', '227'), 'grey89': ('227', '227', '227'), 'gray90': ('229', '229', '229'), 'grey90': ('229', '229', '229'), 'gray91': ('232', '232', '232'), 'grey91': ('232', '232', '232'), 'gray92': ('235', '235', '235'), 'grey92': ('235', '235', '235'), 'gray93': ('237', '237', '237'), 'grey93': ('237', '237', '237'), 'gray94': ('240', '240', '240'), 'grey94': ('240', '240', '240'), 'gray95': ('242', '242', '242'), 'grey95': ('242', '242', '242'), 'gray96': ('245', '245', '245'), 'grey96': ('245', '245', '245'), 'gray97': ('247', '247', '247'), 'grey97': ('247', '247', '247'), 'gray98': ('250', '250', '250'), 'grey98': ('250', '250', '250'), 'gray99': ('252', '252', '252'), 'grey99': ('252', '252', '252'), 'gray100': ('255', '255', '255'), 'grey100': ('255', '255', '255'), 'darkgrey': ('169', '169', '169'), 'DarkGrey': ('169', '169', '169'), 'darkgray': ('169', '169', '169'), 'DarkGray': ('169', '169', '169'), 'darkblue': ('0', '0', '139'), 'DarkBlue': ('0', '0', '139'), 'darkcyan': ('0', '139', '139'), 'DarkCyan': ('0', '139', '139'), 'darkmagenta': ('139', '0', '139'), 'DarkMagenta': ('139', '0', '139'), 'darkred': ('139', '0', '0'), 'DarkRed': ('139', '0', '0'), 'lightgreen': ('144', '238', '144'), 'LightGreen': ('144', '238', '144')}
class Student: def __init__(self, id: str, name: str) -> None: self.id = id self.name = name class Course: def __init__(self, id: str, name: str, hours: int, grades = None) -> None: self.id = id self.name = name self.hours = hours self.grades = grades or {} def add_grade(self, student: Student, grade: str): self.grades[student.id] = grade @staticmethod def convert_grade_to_points(grade: str) -> float: return { "A+": 4.0, "A" : 4.0, "A-": 3.7, "B+": 3.5, "B" : 3.3, "B-": 3.0, "C+": 2.7, "C" : 2.5, "C-": 2.3, "D" : 2.0, "F" : 0.0 }.get(grade, 0)
class Student: def __init__(self, id: str, name: str) -> None: self.id = id self.name = name class Course: def __init__(self, id: str, name: str, hours: int, grades=None) -> None: self.id = id self.name = name self.hours = hours self.grades = grades or {} def add_grade(self, student: Student, grade: str): self.grades[student.id] = grade @staticmethod def convert_grade_to_points(grade: str) -> float: return {'A+': 4.0, 'A': 4.0, 'A-': 3.7, 'B+': 3.5, 'B': 3.3, 'B-': 3.0, 'C+': 2.7, 'C': 2.5, 'C-': 2.3, 'D': 2.0, 'F': 0.0}.get(grade, 0)
class WebServerDefinitions: name = None root = None template = None https = False default_template = 'laravel' def __init__(self, name, root, template=None, https=False): self.name = name self.root = root self.https = https if not template: template = self.default_template self.template = template
class Webserverdefinitions: name = None root = None template = None https = False default_template = 'laravel' def __init__(self, name, root, template=None, https=False): self.name = name self.root = root self.https = https if not template: template = self.default_template self.template = template
class GraphReprBase(object): @staticmethod def read_from_file(input_file): raise NotImplemented()
class Graphreprbase(object): @staticmethod def read_from_file(input_file): raise not_implemented()
STATUS_MAP = { 'RECEIVED_UNREAD': b'0', 'RECEIVED_READ': b'1', 'STORED_UNSENT': b'2', 'STORED_SENT': b'3', 'ALL': b'4' } STATUS_MAP_R = { b'0': 'RECEIVED_UNREAD', b'1': 'RECEIVED_READ', b'2': 'STORED_UNSENT', b'3': 'STORED_SENT', b'4': 'ALL' } DELETE_FLAG = { 'ALL_READ': b'1', 'READ_AND_SENT': b'2', 'READ_AND_UNSENT': b'3', 'ALL': b'4' } ERROR_CODES = [ b'+CMS ERROR', b'+CME ERROR' ] # EC25 URC codes with the corresponding chunk count UNSOLICITED_RESULT_CODES = [ (b'+CREG', 1), (b'+CGREG', 1), (b'+CTZV', 1), (b'+CTZE', 1), (b'+CMTI', 1), (b'+CMT', 2), (b'^HCMT', 2), (b'+CBM', 2), (b'+CDS', 1), (b'+CDSI', 1), (b'^HCDS', 2), (b'+COLP', 1), (b'+CLIP', 1), (b'+CRING', 1), (b'+CCWA', 1), (b'+CSSI', 1), (b'+CSSU', 1), (b'+CUSD', 1), (b'RDY', 1), (b'+CFUN', 1), (b'+CPIN', 1), (b'+QIND', 1), (b'POWERED DOWN', 1), (b'+CGEV', 1), (b'NO CARRIER', 1) ]
status_map = {'RECEIVED_UNREAD': b'0', 'RECEIVED_READ': b'1', 'STORED_UNSENT': b'2', 'STORED_SENT': b'3', 'ALL': b'4'} status_map_r = {b'0': 'RECEIVED_UNREAD', b'1': 'RECEIVED_READ', b'2': 'STORED_UNSENT', b'3': 'STORED_SENT', b'4': 'ALL'} delete_flag = {'ALL_READ': b'1', 'READ_AND_SENT': b'2', 'READ_AND_UNSENT': b'3', 'ALL': b'4'} error_codes = [b'+CMS ERROR', b'+CME ERROR'] unsolicited_result_codes = [(b'+CREG', 1), (b'+CGREG', 1), (b'+CTZV', 1), (b'+CTZE', 1), (b'+CMTI', 1), (b'+CMT', 2), (b'^HCMT', 2), (b'+CBM', 2), (b'+CDS', 1), (b'+CDSI', 1), (b'^HCDS', 2), (b'+COLP', 1), (b'+CLIP', 1), (b'+CRING', 1), (b'+CCWA', 1), (b'+CSSI', 1), (b'+CSSU', 1), (b'+CUSD', 1), (b'RDY', 1), (b'+CFUN', 1), (b'+CPIN', 1), (b'+QIND', 1), (b'POWERED DOWN', 1), (b'+CGEV', 1), (b'NO CARRIER', 1)]
def collatz(n, count): if n == 1: return count else: count = count + 1 if n % 2 == 0: n = n /2 else: n = 3 * n + 1 return collatz(n, count) max_collatz = 1 iteration = 1 for i in range(1, 1000000): count = 1 contesting = collatz(i, 1) if contesting > max_collatz: max_collatz = contesting iteration = i print("Final winner is integer {}".format(iteration))
def collatz(n, count): if n == 1: return count else: count = count + 1 if n % 2 == 0: n = n / 2 else: n = 3 * n + 1 return collatz(n, count) max_collatz = 1 iteration = 1 for i in range(1, 1000000): count = 1 contesting = collatz(i, 1) if contesting > max_collatz: max_collatz = contesting iteration = i print('Final winner is integer {}'.format(iteration))
# -*- coding: utf-8 -*- """ Actually, i want to design a django model-like with fields and inline validators, of course time is against me, so i wrote this; close enough (not really) xD If 'f' is None means that validator generate the content of the field """ MAIN_FIELDS = [ { 'f': None, # From JSON 't': 'offer-id', # To XML 'type': 'uuid', 'required': True }, { 'f': 'name', 't': 'title', 'type': 'text', 'max_length': 80, 'required': True }, { 'f': None, 't': 'product-url', 'type': 'url', 'max_length': None, 'required': True }, { 'f': 'price', 't': 'price', 'type': 'number', 'required': True }, { 'f': 'stock', 't': 'availability', 'type': 'check_stock', 'required': True }, { 'f': 'shipping', 't': 'deliver-cost', 'type': 'check_shipping', 'required': True }, { 'f': 'brand', 't': 'brand', 'type': 'text', 'max_length': None }, { 'f': 'description', 't': 'description', 'type': 'text', 'max_length': 300 }, { 'f': 'images', 't': 'image-url', 'type': 'image_array' }, { 'f': 'id_category', 't': 'merchant-category', 'type': 'category_array' }, { 'f': 'sku', 't': 'sku', 'type': 'text', 'max-length': None }, { 'f': None, 't': 'currency', 'type': 'currency' } ] # TODO: create custom validator for custom product """ FASHION: fashion-type fashion-gender fashion-size color """
""" Actually, i want to design a django model-like with fields and inline validators, of course time is against me, so i wrote this; close enough (not really) xD If 'f' is None means that validator generate the content of the field """ main_fields = [{'f': None, 't': 'offer-id', 'type': 'uuid', 'required': True}, {'f': 'name', 't': 'title', 'type': 'text', 'max_length': 80, 'required': True}, {'f': None, 't': 'product-url', 'type': 'url', 'max_length': None, 'required': True}, {'f': 'price', 't': 'price', 'type': 'number', 'required': True}, {'f': 'stock', 't': 'availability', 'type': 'check_stock', 'required': True}, {'f': 'shipping', 't': 'deliver-cost', 'type': 'check_shipping', 'required': True}, {'f': 'brand', 't': 'brand', 'type': 'text', 'max_length': None}, {'f': 'description', 't': 'description', 'type': 'text', 'max_length': 300}, {'f': 'images', 't': 'image-url', 'type': 'image_array'}, {'f': 'id_category', 't': 'merchant-category', 'type': 'category_array'}, {'f': 'sku', 't': 'sku', 'type': 'text', 'max-length': None}, {'f': None, 't': 'currency', 'type': 'currency'}] '\nFASHION:\n fashion-type\n fashion-gender\n fashion-size\n color\n'
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ # Functions allow variable-length argument lists def main(): kitten('meow', 'grrr', 'purr') # We treat it as a sequence, actually a tuple def kitten(*args): # It's denoted as *args. args is the conventional name if len(args): # If the length of args is greater than zero for s in args: print(s) # If len(args), print all the items in the tuple else: print('Meow.') # otherwise print meow if __name__ == '__main__': main() # You can call the kitten function like this: x = ('hiss', 'howl', 'roar', 'screech') kitten(*x) # note the star
def main(): kitten('meow', 'grrr', 'purr') def kitten(*args): if len(args): for s in args: print(s) else: print('Meow.') if __name__ == '__main__': main() x = ('hiss', 'howl', 'roar', 'screech') kitten(*x)
for i in range(5): for j in range(5): if i==j: print('#',end='') else: print("+",end='') print("")
for i in range(5): for j in range(5): if i == j: print('#', end='') else: print('+', end='') print('')
DATA_URL = 'http://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data' DATA_COLUMNS = ['MPG', 'Cylinders', 'Displacement', 'Horsepower', 'Weight', 'Acceleration', 'Model Year', 'Origin'] NORMALIZE = False TARGET_VARIABLE = 'MPG' # FEATURES_TO_USE = [ 'Cylinders', 'Displacement', 'Horsepower', 'Weight', 'Acceleration', 'Model Year', 'Europe', 'Japan', 'USA'] FEATURES_TO_USE = [ 'MPG', 'Horsepower','Displacement'] NORMALIZE_HORSEPOWER = False
data_url = 'http://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data' data_columns = ['MPG', 'Cylinders', 'Displacement', 'Horsepower', 'Weight', 'Acceleration', 'Model Year', 'Origin'] normalize = False target_variable = 'MPG' features_to_use = ['MPG', 'Horsepower', 'Displacement'] normalize_horsepower = False
# question : https://quera.ir/problemset/contest/8901 x_n = input().split(' ') x = x_n[1] n = int(x_n[0]) default_value = { 'L': 0, 'M': 0, 'R': 0, } movements = [] for one_input in range(n): movements.append(input().split(' ')) default_value[x] = 1 for one_movement in movements: temp = default_value.get(one_movement[0]) default_value[one_movement[0]] = default_value.get(one_movement[1]) default_value[one_movement[1]] = temp for index in default_value: if default_value.get(index) == 1: print(index) break
x_n = input().split(' ') x = x_n[1] n = int(x_n[0]) default_value = {'L': 0, 'M': 0, 'R': 0} movements = [] for one_input in range(n): movements.append(input().split(' ')) default_value[x] = 1 for one_movement in movements: temp = default_value.get(one_movement[0]) default_value[one_movement[0]] = default_value.get(one_movement[1]) default_value[one_movement[1]] = temp for index in default_value: if default_value.get(index) == 1: print(index) break