content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def fibo(n): if n<3: return n-1 else: return fibo(n-1)+fibo(n-2)
def fibo(n): if n < 3: return n - 1 else: return fibo(n - 1) + fibo(n - 2)
def doincre(delta, entity, cnt, RK, table, PK, tablesvc): if cnt > 0: item = {"PartitionKey": PK, "RowKey": RK, "value": int(entity.value) + delta, "etag": entity.etag} try: tablesvc.merge_entity(table, item) except: result = tablesvc.get_entity(table, PK, RK) doincre(delta, result, cnt - 1, RK, table, PK, tablesvc) def incrementMetric(delta, RK, table, PK, tablesvc): try: result = tablesvc.get_entity(table, PK, RK) doincre(delta, result, 10000, RK, table, PK, tablesvc) except: pass
def doincre(delta, entity, cnt, RK, table, PK, tablesvc): if cnt > 0: item = {'PartitionKey': PK, 'RowKey': RK, 'value': int(entity.value) + delta, 'etag': entity.etag} try: tablesvc.merge_entity(table, item) except: result = tablesvc.get_entity(table, PK, RK) doincre(delta, result, cnt - 1, RK, table, PK, tablesvc) def increment_metric(delta, RK, table, PK, tablesvc): try: result = tablesvc.get_entity(table, PK, RK) doincre(delta, result, 10000, RK, table, PK, tablesvc) except: pass
# Python - 3.4.3 test.describe('Example Tests') InterlacedSpiralCipher = {'encode': encode, 'decode': decode } example1A = 'Romani ite domum' example1B = 'Rntodomiimuea m' test.assert_equals(InterlacedSpiralCipher['encode'](example1A), example1B) test.assert_equals(InterlacedSpiralCipher['decode'](example1B), example1A) example2A = 'Sic transit gloria mundi' example2B = 'Stsgiriuar i ninmd l otac' test.assert_equals(InterlacedSpiralCipher['encode'](example2A), example2B) test.assert_equals(InterlacedSpiralCipher['decode'](example2B), example2A)
test.describe('Example Tests') interlaced_spiral_cipher = {'encode': encode, 'decode': decode} example1_a = 'Romani ite domum' example1_b = 'Rntodomiimuea m' test.assert_equals(InterlacedSpiralCipher['encode'](example1A), example1B) test.assert_equals(InterlacedSpiralCipher['decode'](example1B), example1A) example2_a = 'Sic transit gloria mundi' example2_b = 'Stsgiriuar i ninmd l otac' test.assert_equals(InterlacedSpiralCipher['encode'](example2A), example2B) test.assert_equals(InterlacedSpiralCipher['decode'](example2B), example2A)
RESOURCES = { 'accounts': { 'schema': { 'username': { 'type': 'string', 'required': True, 'unique': True }, 'password': { 'type': 'string', 'required': True }, 'roles': { 'type': 'list', 'allowed': ['user', 'superuser'], 'required': True, }, 'location': { 'type': 'dict', 'schema': { 'country': {'type': 'string'}, 'city': {'type': 'string'}, 'address': {'type': 'string'} }, }, 'born': { 'type': 'datetime', }, }, # Disable endpoint caching. 'cache_control': '', 'cache_expires': 0, } }
resources = {'accounts': {'schema': {'username': {'type': 'string', 'required': True, 'unique': True}, 'password': {'type': 'string', 'required': True}, 'roles': {'type': 'list', 'allowed': ['user', 'superuser'], 'required': True}, 'location': {'type': 'dict', 'schema': {'country': {'type': 'string'}, 'city': {'type': 'string'}, 'address': {'type': 'string'}}}, 'born': {'type': 'datetime'}}, 'cache_control': '', 'cache_expires': 0}}
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def mergeTrees(self, t1: TreeNode, t2: TreeNode) -> TreeNode: t1_ptr = t1 t2_ptr = t2 t3_ptr = None if t1_ptr and t2_ptr: t3_ptr = TreeNode(t1_ptr.val + t2_ptr.val) t3_ptr.left = self.mergeTrees(t1_ptr.left , t2_ptr.left) t3_ptr.right = self.mergeTrees(t1_ptr.right , t2_ptr.right) elif t1_ptr: t3_ptr = t1_ptr else: t3_ptr = t2_ptr return t3_ptr
class Solution: def merge_trees(self, t1: TreeNode, t2: TreeNode) -> TreeNode: t1_ptr = t1 t2_ptr = t2 t3_ptr = None if t1_ptr and t2_ptr: t3_ptr = tree_node(t1_ptr.val + t2_ptr.val) t3_ptr.left = self.mergeTrees(t1_ptr.left, t2_ptr.left) t3_ptr.right = self.mergeTrees(t1_ptr.right, t2_ptr.right) elif t1_ptr: t3_ptr = t1_ptr else: t3_ptr = t2_ptr return t3_ptr
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param head, a ListNode # @return a boolean def isPalindrome(self, head): if head == None: return True prev = None slow = head fast = head while fast != None and fast.next != None: prev = slow slow = slow.next fast = fast.next.next mid = slow curr = mid while curr != None: temp = curr.next curr.next = prev prev = curr curr = temp left = head right = prev while left != mid: if left.val != right.val: return False left = left.next right = right.next return True
class Solution: def is_palindrome(self, head): if head == None: return True prev = None slow = head fast = head while fast != None and fast.next != None: prev = slow slow = slow.next fast = fast.next.next mid = slow curr = mid while curr != None: temp = curr.next curr.next = prev prev = curr curr = temp left = head right = prev while left != mid: if left.val != right.val: return False left = left.next right = right.next return True
load("//third_party/py:python_configure.bzl", "python_configure") load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories") load("@grpc_python_dependencies//:requirements.bzl", "pip_install") load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_repositories") def grpc_python_deps(): # TODO(https://github.com/grpc/grpc/issues/18256): Remove conditional. if hasattr(native, "http_archive"): python_configure(name = "local_config_python") pip_repositories() pip_install() py_proto_repositories() else: print("Building Python gRPC with bazel 23.0+ is disabled pending " + "resolution of https://github.com/grpc/grpc/issues/18256.")
load('//third_party/py:python_configure.bzl', 'python_configure') load('@io_bazel_rules_python//python:pip.bzl', 'pip_repositories') load('@grpc_python_dependencies//:requirements.bzl', 'pip_install') load('@org_pubref_rules_protobuf//python:rules.bzl', 'py_proto_repositories') def grpc_python_deps(): if hasattr(native, 'http_archive'): python_configure(name='local_config_python') pip_repositories() pip_install() py_proto_repositories() else: print('Building Python gRPC with bazel 23.0+ is disabled pending ' + 'resolution of https://github.com/grpc/grpc/issues/18256.')
FONT_TITLE = 18 FONT_LEGEND = 16 FONT_LABEL = 14 FONT_STICK = 12 LEGEND_FRAMEALPHA = 0.5 ########## h5py -- dod ############ wake_trim_min = None period_length_sec = 30 h5_out_dir = './h5py/output' ignore_class = None kappa_weights='quadratic' plot_hypnograms=True plot_CMs=True ###### ablation ###### ablation_out_dir = './ablation/output'
font_title = 18 font_legend = 16 font_label = 14 font_stick = 12 legend_framealpha = 0.5 wake_trim_min = None period_length_sec = 30 h5_out_dir = './h5py/output' ignore_class = None kappa_weights = 'quadratic' plot_hypnograms = True plot_c_ms = True ablation_out_dir = './ablation/output'
class CrabNavy: def __init__(self, positions): self.positions = positions @classmethod def from_str(cls, positions_str): positions = [int(c) for c in positions_str.split(",")] return cls(positions) def calculate_consumption(self, alignment): total = 0 for position in self.positions: total += abs(alignment - position) return total @property def ideal_alignment(self): min_consumption = None min_idx = None for idx in range(min(self.positions), max(self.positions)): consumption = self.calculate_consumption(idx) if min_consumption is None or consumption < min_consumption: min_consumption = consumption min_idx = idx return min_idx @property def ideal_alignment_consumption(self): return self.calculate_consumption(self.ideal_alignment) def main(): with open("input", "r") as f: lines_raw = f.read().splitlines() sample_navy = CrabNavy([16, 1, 2, 0, 4, 2, 7, 1, 2, 14]) navy = CrabNavy.from_str(lines_raw[0]) print(sample_navy.ideal_alignment) print(sample_navy.ideal_alignment_consumption) print(navy.ideal_alignment_consumption) if __name__ == "__main__": main()
class Crabnavy: def __init__(self, positions): self.positions = positions @classmethod def from_str(cls, positions_str): positions = [int(c) for c in positions_str.split(',')] return cls(positions) def calculate_consumption(self, alignment): total = 0 for position in self.positions: total += abs(alignment - position) return total @property def ideal_alignment(self): min_consumption = None min_idx = None for idx in range(min(self.positions), max(self.positions)): consumption = self.calculate_consumption(idx) if min_consumption is None or consumption < min_consumption: min_consumption = consumption min_idx = idx return min_idx @property def ideal_alignment_consumption(self): return self.calculate_consumption(self.ideal_alignment) def main(): with open('input', 'r') as f: lines_raw = f.read().splitlines() sample_navy = crab_navy([16, 1, 2, 0, 4, 2, 7, 1, 2, 14]) navy = CrabNavy.from_str(lines_raw[0]) print(sample_navy.ideal_alignment) print(sample_navy.ideal_alignment_consumption) print(navy.ideal_alignment_consumption) if __name__ == '__main__': main()
# Exercise One hash = "#" for i in range(0, 7): print(hash) hash = hash + "#" # Exercise two for i in range(1, 101): if i % 3 == 0: if i % 5 == 0: print("FizzBuzz") else: print("Fizz") elif i % 5 == 0: print("Buzz") else: print(i) # Exercise three size = 8 chess_board = "" for i in range(0, size): for j in range(0, size): if (i + j) % 2 == 0: chess_board = chess_board + " " else: chess_board = chess_board + "#" chess_board = chess_board + "\n" print(chess_board)
hash = '#' for i in range(0, 7): print(hash) hash = hash + '#' for i in range(1, 101): if i % 3 == 0: if i % 5 == 0: print('FizzBuzz') else: print('Fizz') elif i % 5 == 0: print('Buzz') else: print(i) size = 8 chess_board = '' for i in range(0, size): for j in range(0, size): if (i + j) % 2 == 0: chess_board = chess_board + ' ' else: chess_board = chess_board + '#' chess_board = chess_board + '\n' print(chess_board)
'''https://adoptopenjdk.net/upstream.html ''' load("//java:common/structs/KnownOpenJdkRepository.bzl", _KnownOpenJdkRepository = "KnownOpenJdkRepository") def adoptopenjdk_upstream_repositories(): return _KNOWN_OPENJDK_REPOSITORIES def _Repo(**kwargs): kwargs['provider'] = "adoptopenjdk_upstream" return _KnownOpenJdkRepository(**kwargs) _KNOWN_OPENJDK_REPOSITORIES = [ # JDK-11.0.9+11 ########################################################### _Repo( version = "11.0.9+11", url = "https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.9%2B11/OpenJDK11U-jdk_x64_linux_11.0.9_11.tar.gz", sha256 = "4fe78ca6a3afbff9c3dd7c93cc84064dcaa15578663362ded2c0d47552201e70", strip_prefix = "openjdk-11.0.9_11", ), _Repo( version = "11.0.9+11", os = "windows", url = "https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.9%2B11/OpenJDK11U-jdk_x64_windows_11.0.9_11.zip", sha256 = "a440f37531b44ee3475c9e5466e5d0545681419784fbe98ad371938e034d9d37", strip_prefix = "openjdk-11.0.9_11", ), # JDK8u272-b10 ############################################################ _Repo( version = "8u272-b10", url = "https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u272-b10/OpenJDK8U-jdk_x64_linux_8u272b10.tar.gz", sha256 = "654a0b082be0c6830821f22a9e1de5f9e2feb9705db79e3bb0d8c203d1b12c6a", strip_prefix = "openjdk-8u272-b10", ), _Repo( version = "8u272-b10", os = "windows", url = "https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u272-b10/OpenJDK8U-jdk_x64_windows_8u272b10.zip", sha256 = "63fe8a555ae6553bd6f6f0937135c31e9adbb3b2ac85232e495596d39f396b1d", strip_prefix = "openjdk-8u272-b10", ), ]
"""https://adoptopenjdk.net/upstream.html """ load('//java:common/structs/KnownOpenJdkRepository.bzl', _KnownOpenJdkRepository='KnownOpenJdkRepository') def adoptopenjdk_upstream_repositories(): return _KNOWN_OPENJDK_REPOSITORIES def __repo(**kwargs): kwargs['provider'] = 'adoptopenjdk_upstream' return __known_open_jdk_repository(**kwargs) _known_openjdk_repositories = [__repo(version='11.0.9+11', url='https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.9%2B11/OpenJDK11U-jdk_x64_linux_11.0.9_11.tar.gz', sha256='4fe78ca6a3afbff9c3dd7c93cc84064dcaa15578663362ded2c0d47552201e70', strip_prefix='openjdk-11.0.9_11'), __repo(version='11.0.9+11', os='windows', url='https://github.com/AdoptOpenJDK/openjdk11-upstream-binaries/releases/download/jdk-11.0.9%2B11/OpenJDK11U-jdk_x64_windows_11.0.9_11.zip', sha256='a440f37531b44ee3475c9e5466e5d0545681419784fbe98ad371938e034d9d37', strip_prefix='openjdk-11.0.9_11'), __repo(version='8u272-b10', url='https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u272-b10/OpenJDK8U-jdk_x64_linux_8u272b10.tar.gz', sha256='654a0b082be0c6830821f22a9e1de5f9e2feb9705db79e3bb0d8c203d1b12c6a', strip_prefix='openjdk-8u272-b10'), __repo(version='8u272-b10', os='windows', url='https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u272-b10/OpenJDK8U-jdk_x64_windows_8u272b10.zip', sha256='63fe8a555ae6553bd6f6f0937135c31e9adbb3b2ac85232e495596d39f396b1d', strip_prefix='openjdk-8u272-b10')]
def map_wiimote_to_key(wiimote_index, wiimote_button, key): # Check the global wiimote object's button state and set the global # keyboard object's corresponding key. if wiimote[wiimote_index].buttons.button_down(wiimote_button): keyboard.setKeyDown(key) else: keyboard.setKeyUp(key) def map_wiimote_to_vJoy(wiimote_index, wiimote_button, key): if wiimote[wiimote_index].buttons.button_down(wiimote_button): vJoy[wiimote_index].setButton(key, True); else: vJoy[wiimote_index].setButton(key, False); def map_wiimote_to_vJoyHat(wiimote_index): if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadRight): vJoy[wiimote_index].setDigitalPov(0, VJoyPov.Up) if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadLeft): vJoy[wiimote_index].setDigitalPov(0, VJoyPov.Down) if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadUp): vJoy[wiimote_index].setDigitalPov(0, VJoyPov.Left) if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadDown): vJoy[wiimote_index].setDigitalPov(0, VJoyPov.Right) if not wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadDown) and not wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadUp) and not wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadLeft) and not wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadRight): vJoy[wiimote_index].setDigitalPov(wiimote_index, VJoyPov.Nil) def map_wiimote_to_vJoyAHat(wiimote_index): x = 0 y = 0 rotate = -9000 if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadUp):#up x = 1 if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadDown):#down x = -1 if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadLeft):#left y = -1 if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadRight):#right y = 1 if x == 0 and y == 0: vJoy[wiimote_index].setAnalogPov(wiimote_index, -1)#center else: degrees = (math.atan2(y,x)/math.pi*18000 + rotate)%36000 vJoy[wiimote_index].setAnalogPov(wiimote_index, degrees) #diagnostics.debug("x:" + repr(x)) #diagnostics.debug("y:" + repr(y)) #diagnostics.debug("angle: " + repr(degrees)) def map_wiimote_to_vJoyAxis(wiimote_index): diagnostics.debug("x: " + repr(wiimote[wiimote_index].acceleration.x)) diagnostics.debug("max: " +repr(vJoy[0].axisMax)) vJoy[wiimote_index].rx = (wiimote[wiimote_index].acceleration.x+vJoy[0].axisMax)*255 vJoy[wiimote_index].ry = (wiimote[wiimote_index].acceleration.y+vJoy[0].axisMax)*255 vJoy[wiimote_index].rz = (wiimote[wiimote_index].acceleration.z+vJoy[0].axisMax)*255 def update(): # Sideways controls (DPad). Map each of our desired keys. map_wiimote_to_vJoyAHat(0) map_wiimote_to_vJoy(0, WiimoteButtons.One, 0) map_wiimote_to_vJoy(0, WiimoteButtons.Two, 1) map_wiimote_to_vJoy(0, WiimoteButtons.Plus, 2) map_wiimote_to_vJoy(0, WiimoteButtons.Home, 3) map_wiimote_to_vJoy(0, WiimoteButtons.Minus, 4) map_wiimote_to_vJoy(0, WiimoteButtons.A, 5) map_wiimote_to_vJoy(0, WiimoteButtons.B, 6) # If we're starting up, then hook up our update function. if starting: wiimote[0].buttons.update += update
def map_wiimote_to_key(wiimote_index, wiimote_button, key): if wiimote[wiimote_index].buttons.button_down(wiimote_button): keyboard.setKeyDown(key) else: keyboard.setKeyUp(key) def map_wiimote_to_v_joy(wiimote_index, wiimote_button, key): if wiimote[wiimote_index].buttons.button_down(wiimote_button): vJoy[wiimote_index].setButton(key, True) else: vJoy[wiimote_index].setButton(key, False) def map_wiimote_to_v_joy_hat(wiimote_index): if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadRight): vJoy[wiimote_index].setDigitalPov(0, VJoyPov.Up) if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadLeft): vJoy[wiimote_index].setDigitalPov(0, VJoyPov.Down) if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadUp): vJoy[wiimote_index].setDigitalPov(0, VJoyPov.Left) if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadDown): vJoy[wiimote_index].setDigitalPov(0, VJoyPov.Right) if not wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadDown) and (not wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadUp)) and (not wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadLeft)) and (not wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadRight)): vJoy[wiimote_index].setDigitalPov(wiimote_index, VJoyPov.Nil) def map_wiimote_to_v_joy_a_hat(wiimote_index): x = 0 y = 0 rotate = -9000 if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadUp): x = 1 if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadDown): x = -1 if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadLeft): y = -1 if wiimote[wiimote_index].buttons.button_down(WiimoteButtons.DPadRight): y = 1 if x == 0 and y == 0: vJoy[wiimote_index].setAnalogPov(wiimote_index, -1) else: degrees = (math.atan2(y, x) / math.pi * 18000 + rotate) % 36000 vJoy[wiimote_index].setAnalogPov(wiimote_index, degrees) def map_wiimote_to_v_joy_axis(wiimote_index): diagnostics.debug('x: ' + repr(wiimote[wiimote_index].acceleration.x)) diagnostics.debug('max: ' + repr(vJoy[0].axisMax)) vJoy[wiimote_index].rx = (wiimote[wiimote_index].acceleration.x + vJoy[0].axisMax) * 255 vJoy[wiimote_index].ry = (wiimote[wiimote_index].acceleration.y + vJoy[0].axisMax) * 255 vJoy[wiimote_index].rz = (wiimote[wiimote_index].acceleration.z + vJoy[0].axisMax) * 255 def update(): map_wiimote_to_v_joy_a_hat(0) map_wiimote_to_v_joy(0, WiimoteButtons.One, 0) map_wiimote_to_v_joy(0, WiimoteButtons.Two, 1) map_wiimote_to_v_joy(0, WiimoteButtons.Plus, 2) map_wiimote_to_v_joy(0, WiimoteButtons.Home, 3) map_wiimote_to_v_joy(0, WiimoteButtons.Minus, 4) map_wiimote_to_v_joy(0, WiimoteButtons.A, 5) map_wiimote_to_v_joy(0, WiimoteButtons.B, 6) if starting: wiimote[0].buttons.update += update
# OpenWeatherMap API Key weather_api_key = "reset" # Google API Key g_key = "reset"
weather_api_key = 'reset' g_key = 'reset'
def merge_sorted_list(arr1, arr2): # m = len(arr1), n = len(arr1) # since we know arr1 is always greater or equal to (m+n) # we compare arr2[i] with arr1[j] element and check if it # should be placed there i, j = 0, 0 while i < len(arr1) and j < len(arr2): if arr2[j] == arr1[i] or arr2[j] <= arr1[i+1]: arr1.insert(i+1, arr2[j]) arr1.pop() i += 2 j += 1 elif arr2[j] > arr1[i]: if arr1[i+1] == 0: arr1[i+1] = arr2[j] i += 1 j += 1 else: i += 1 elif arr2[j] < arr1[i]: arr1.insert(i, arr2[j]) arr1.pop() i += 1 j += 1 print(arr1) return arr1 def merge_sorted_list_v2(nums1, m, nums2, n): # fill up that empty space with string stop = 0 for i in range(len(nums1)-1, 0, -1): if stop == len(nums2): break else: nums1[i] = "" stop += 1 print(nums1) if m == 0: nums1 = nums2 i, j = 0, 0 empty_space = len(nums2) while j < len(nums2): if nums2[j] <= nums1[i] or i == empty_space: nums1.insert(i, nums2[j]) nums1.pop() j += 1 empty_space += 1 else: i += 1 return nums1 a = [1, 2, 3, 0, 0, 0] b = [2, 5, 6] nums1 = [-1, 0, 0, 3, 3, 3, 0, 0, 0] m = 6 nums2 = [1, 2, 2] n = 3 result = merge_sorted_list_v2(nums1, 6, nums2, 3) print("result: ", result)
def merge_sorted_list(arr1, arr2): (i, j) = (0, 0) while i < len(arr1) and j < len(arr2): if arr2[j] == arr1[i] or arr2[j] <= arr1[i + 1]: arr1.insert(i + 1, arr2[j]) arr1.pop() i += 2 j += 1 elif arr2[j] > arr1[i]: if arr1[i + 1] == 0: arr1[i + 1] = arr2[j] i += 1 j += 1 else: i += 1 elif arr2[j] < arr1[i]: arr1.insert(i, arr2[j]) arr1.pop() i += 1 j += 1 print(arr1) return arr1 def merge_sorted_list_v2(nums1, m, nums2, n): stop = 0 for i in range(len(nums1) - 1, 0, -1): if stop == len(nums2): break else: nums1[i] = '' stop += 1 print(nums1) if m == 0: nums1 = nums2 (i, j) = (0, 0) empty_space = len(nums2) while j < len(nums2): if nums2[j] <= nums1[i] or i == empty_space: nums1.insert(i, nums2[j]) nums1.pop() j += 1 empty_space += 1 else: i += 1 return nums1 a = [1, 2, 3, 0, 0, 0] b = [2, 5, 6] nums1 = [-1, 0, 0, 3, 3, 3, 0, 0, 0] m = 6 nums2 = [1, 2, 2] n = 3 result = merge_sorted_list_v2(nums1, 6, nums2, 3) print('result: ', result)
data = open(0).readlines() e = [i == "#" for i in data[0].strip()] b = [line.strip() for line in data[2:]] d = ((-1,-1),(-1,0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1)) def neighbors(i, j): for k, (di, dj) in enumerate(d): yield 256 >> k, i+di, j+dj def lookup(_s, i, j, bi, bj, flip=False): if i == bi[0] or i + 1 == bi[1] or j == bj[0] or j + 1 == bj[1]: return ((i, j) in _s) ^ flip return e[sum(k for k, ni, nj in neighbors(i, j) if (ni, nj) in _s)] s = frozenset((i, j) for i in range(len(b)) for j in range(len(b[0])) if b[i][j] == "#") bi = (-51, len(b)+51) bj = (-51, len(b[0])+51) def iterate(_s, bi, bj): return frozenset((i, j) for i in range(*bi) for j in range(*bj) if lookup(_s, i, j, bi, bj, e[0])) for _ in range(2): s = iterate(s, bi, bj) print("Part 1", len(s)) for _ in range(48): s = iterate(s, bi, bj) print("Part 2", len(s)) for i in range(*bi): for j in range(*bj): if (i, j) in s: print("#", end="") else: print(".", end="") print()
data = open(0).readlines() e = [i == '#' for i in data[0].strip()] b = [line.strip() for line in data[2:]] d = ((-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 0), (0, 1), (1, -1), (1, 0), (1, 1)) def neighbors(i, j): for (k, (di, dj)) in enumerate(d): yield (256 >> k, i + di, j + dj) def lookup(_s, i, j, bi, bj, flip=False): if i == bi[0] or i + 1 == bi[1] or j == bj[0] or (j + 1 == bj[1]): return ((i, j) in _s) ^ flip return e[sum((k for (k, ni, nj) in neighbors(i, j) if (ni, nj) in _s))] s = frozenset(((i, j) for i in range(len(b)) for j in range(len(b[0])) if b[i][j] == '#')) bi = (-51, len(b) + 51) bj = (-51, len(b[0]) + 51) def iterate(_s, bi, bj): return frozenset(((i, j) for i in range(*bi) for j in range(*bj) if lookup(_s, i, j, bi, bj, e[0]))) for _ in range(2): s = iterate(s, bi, bj) print('Part 1', len(s)) for _ in range(48): s = iterate(s, bi, bj) print('Part 2', len(s)) for i in range(*bi): for j in range(*bj): if (i, j) in s: print('#', end='') else: print('.', end='') print()
distance_success_response = {'destination_addresses': ['Brighton, UK'], 'origin_addresses': ['London, UK'], 'rows': [{'elements': [ {'distance': {'text': '64.6 mi', 'value': 103964}, 'duration': {'text': '1 hour 54 mins', 'value': 6854}, 'status': 'OK'}]}], 'status': 'OK'}
distance_success_response = {'destination_addresses': ['Brighton, UK'], 'origin_addresses': ['London, UK'], 'rows': [{'elements': [{'distance': {'text': '64.6 mi', 'value': 103964}, 'duration': {'text': '1 hour 54 mins', 'value': 6854}, 'status': 'OK'}]}], 'status': 'OK'}
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def getmerge(self,l1,l2): head = ListNode(0) tail = head while l1 is not None and l2 is not None: if l1.val > l2.val: l1,l2 = l2,l1 tail.next = l1 l1 = l1.next tail = tail.next if l1 is None : tail.next = l2 if l2 is None: tail.next = l1 return head.next def sortList(self, head: ListNode) -> ListNode: if head is None or head.next is None: return head slownode = head fastnode = head.next while fastnode is not None and fastnode.next is not None: slownode = slownode.next fastnode = fastnode.next.next mid = slownode.next slownode.next = None return self.getmerge(self.sortList(head),self.sortList(mid)) A = Solution() a1 = ListNode(4) a2 = ListNode(2) a3 = ListNode(1) a4 = ListNode(3) a1.next = a2 a2.next = a3 a3.next = a4 print(A.sortList(a1))
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def getmerge(self, l1, l2): head = list_node(0) tail = head while l1 is not None and l2 is not None: if l1.val > l2.val: (l1, l2) = (l2, l1) tail.next = l1 l1 = l1.next tail = tail.next if l1 is None: tail.next = l2 if l2 is None: tail.next = l1 return head.next def sort_list(self, head: ListNode) -> ListNode: if head is None or head.next is None: return head slownode = head fastnode = head.next while fastnode is not None and fastnode.next is not None: slownode = slownode.next fastnode = fastnode.next.next mid = slownode.next slownode.next = None return self.getmerge(self.sortList(head), self.sortList(mid)) a = solution() a1 = list_node(4) a2 = list_node(2) a3 = list_node(1) a4 = list_node(3) a1.next = a2 a2.next = a3 a3.next = a4 print(A.sortList(a1))
string = 'Monty Python' print(string[0:4]) print(string[6:7]) print(string[6:20]) print(string[8:]) data = 'From robin.smorenburg@linkit.nl Sat Jan' position = data.find('@') print(position) space_position = data.find(' ', position) print(space_position) host = data[position+1:space_position] print(host)
string = 'Monty Python' print(string[0:4]) print(string[6:7]) print(string[6:20]) print(string[8:]) data = 'From robin.smorenburg@linkit.nl Sat Jan' position = data.find('@') print(position) space_position = data.find(' ', position) print(space_position) host = data[position + 1:space_position] print(host)
def baz(): tmp = "!" # try to extract this assignment, either with or without this comment baz() def bar(self): pass
def baz(): tmp = '!' baz() def bar(self): pass
# Find duplicates in an array in O(N) Time and O(1) space. # The elements in the array can be only Between 1<=x<=len(array) # Asked in Amazon,D-E-Shaw, Flipkart and many more # Difficulty -> Medium (for O(N) time and O(1) space) # Approaches: # Naive Solution: Loop through all the values checking for multiple occurrences. # This would take O(n^2) time # Use sorting and then look for adjacent elements and if repeated print them. # This would take O(nlogn) time # Use hashmap to keep a track of element and its count and if the count is greater than # 1 then we know the elements are repeated. This would take O(n) time but O(n) space too. # Another solution would be to use array modification to check for multiple occurrences. # As We know that the elements can be only be in between 1 and len(arr) thus we can # subtract one both sides to get the index.Now as we have the index so we go to # the array[value] and negate it and repeat this for the whole array. # So if we encounter the a value and if it is already negated then we know that element is repeated. def findDuplicates(arr): size = len(arr) # Traverse through the whole array for i in range(0, size): # Making sure we don't a negative index idx = abs(arr[i]) - 1 # check if the value at idx is negative or not if arr[idx] < 0: # if negative then we have already encountered thus a repeated element so print it as answer # Not using arr[idx] as it is subtracted by 1. print(abs(arr[i])) # else negating the value arr[idx] = -arr[idx] # uncomment this code to get the original array back. # for i in range(0,size-1): # arr[i]=abs(arr[i]) # Test cases arr1 = [2, 1, 2, 1] arr2 = [1, 2, 3, 1, 3, 6, 6] findDuplicates(arr1) print() findDuplicates(arr2)
def find_duplicates(arr): size = len(arr) for i in range(0, size): idx = abs(arr[i]) - 1 if arr[idx] < 0: print(abs(arr[i])) arr[idx] = -arr[idx] arr1 = [2, 1, 2, 1] arr2 = [1, 2, 3, 1, 3, 6, 6] find_duplicates(arr1) print() find_duplicates(arr2)
''' 8-2. Favorite Book: Write a function called favorite_book() that accepts one parameter, title. The function should print a message, such as One of my favorite books is Alice in Wonderland. Call the function, making sure to include a book title as an argument in the function call. ''' def favorite_book(title): print(f"One of my favorite books is {title} in Wonderland.") favorite_book('Alice')
""" 8-2. Favorite Book: Write a function called favorite_book() that accepts one parameter, title. The function should print a message, such as One of my favorite books is Alice in Wonderland. Call the function, making sure to include a book title as an argument in the function call. """ def favorite_book(title): print(f'One of my favorite books is {title} in Wonderland.') favorite_book('Alice')
yieldlyDB = {'FMBXOFAQCSAD4UWU4Q7IX5AV4FRV6AKURJQYGXLW3CTPTQ7XBX6MALMSPY' : 'Yieldly - YLDY-YLDY/ALGO', 'VUY44SYOFFJE3ZIDEMA6PT34J3FAZUAE6VVTOTUJ5LZ343V6WZ3ZJQTCD4' : 'Yieldly - YLDY-OPUL', 'U3RJ4NNSASBOIY25KAVVFV6CFDOS22L7YLZBENMIVVVFEWT5WE5GHXH5VQ' : 'Yieldly - GEMS-GEMS', 'BXLXRYBOM7ZNYSCRLWG6THNMO6HASTIRMJGSNJANZFS6EB3X4JY2FZCJNA' : 'Yieldly - YLDY-GEMS', 'AAXO2CVK6SHKHNROZZH3435UAYMQXZP4UTLO5LQCNTDZAXEGJJ2OPHFX54' : 'Yieldly - YLDY-ARCC', '4UPQ2HSD7O6WY3HP33JXMPGYNMV56U3YK5WT6CTSBLGS466JPOFUVCCSTA' : 'Yieldly - ARCC-ARCC', 'YCHXDWES2VJDEKAHWPC344N6WK3FQOZL5VIZYMCDHDIUTTUZPC4IA6DEZY' : 'Yieldly - YLDY-CHOICE', 'KDZS6OV5PAARFJPRZYRRQWCZOCPICB6NJ4YNHZKNCNKIVOLSL5ZCPMY24I' : 'Yieldly - YLDY-SMILE', '55CUF2LA45PJWIUK2KZOGN54N2POJHXAWTSVGR5HFSO4JUUDJ3SOURUVGQ' : 'Yieldly - SMILE-SMILE', 'IR2HQCMN6GPTKGCTR54YXFFUBB4A7FRZR76U2BJAS4XBLNJHZX7RMOPBIQ' : 'Yieldly - YLDY-XET', 'GLHS7QEDDSQVHNTOVFELY3ISMB44TL7I7RQ36BNFW7KMJEZA4SQUFJHV6E' : 'Yieldly - CHOICE-CHOICE', '2RQGRKUSDCZAEFFCXXCQBCVH6KOR7FZW6N3G7B547DIS76AGQJAZZVPPPY' : 'Yieldly - OPUL-OPUL', '3OZ3HAIID3NPKB5N3B6TGFUBX44ZBZDNNRWGY6HSPQLP3NRSQW7D6ZKFEY' : 'Yieldly - XET-XET', 'ZMJVS7F3DXYDE6XIBXGWLEL6VXUYLCN4HTOW57QDLZ2TAMOWZK7EIYAQF4' : 'Yieldly - YLDY-AKITA', '233725844' : 'Yieldly Algo Staking', '233725850' : 'Yieldly Staking', '233725848' : 'Yieldly', '233725850' : 'Yieldly - YLDY-YLDY/ALGO', '348079765' : 'Yieldly - YLDY-OPUL', '419301793' : 'Yieldly - GEMS-GEMS', '393388133' : 'Yieldly - YLDY-GEMS', '385089192' : 'Yieldly - YLDY-ARCC', '498747685' : 'Yieldly - ARCC/ARCC', '447336112' : 'Yieldly - YLDY-CHOICE', '352116819' : 'Yieldly - YLDY-SMILE', '373819681' : 'Yieldly - SMILE-SMILE', '424101057' : 'Yieldly - YLDY-XET', '464365150' : 'Yieldly - CHOICE-CHOICE', '367431051' : 'Yieldly - OPUL-OPUL', '470390215' : 'Yieldly - XET-XET', '511597182' : 'Yieldly - YLDY-AKITA', '511593477' : 'Yieldly - (AKITA/ALGO)LP-YLDY'} algofiDB = {'3EPGHSNBBN5M2LD6V7A63EHZQQLATVQHDBYJQIZ6BLCBTIXA5XR7ZOZEB4' : 'Algofi - Creator', '2SGUKZCOBEVGN3HPKSXPS6DTCXZ7LSP6G3BQF6KVUIUREBBY2QTGSON7WQ' : 'Algofi - Manager', 'TY5N6G67JWHSMWFFFZ252FXWKLRO5UZLBEJ4LGV7TPR5PVSKPLDWH3YRXU' : 'Algofi - ALGO Market', 'ABQHZLNGGPWWZVA5SOQO3HBEECVJSE3OHYLKACOTC7TC4BS52ZHREPF7QY' : 'Algofi - USDC Market', 'W5UCMHDSTGKWBOV6YVLDVPJGPE4L4ISTU6TGXC7WRF63Y7GOVFOBUNJB5Q' : 'Algofi - goBTC Market', 'KATD43XBJJIDXB3U5UCPIFUDU3CZ3YQNVWA5PDDMZVGKSR4E3QWPJX67CY' : 'Algofi - goETH Market', 'OPY7XNB5LVMECF3PHJGQV2U33LZPM5FBUXA3JJPHANAG5B7GEYUPZJVYRE' : 'Algofi - STBL Market', 'DYLJJES76YQCOUK6D4RALIPJ76U5QT7L6A2KP6QTOH63OBLFKLTER2J6IA' : 'Algofi - STBL Staking', 'Z3GWRL5HGCJQYIXP4MINCRWCKWDHZ5VSYJHDLIDLEIOARIZWJX6GLAWWEI' : 'Algofi - STBL/USDC LP Staking', '465818260' : 'Algofi - Manager', '465814065' : 'Algofi - ALGO Market', '465814103' : 'Algofi - USDC Market', '465814149' : 'Algofi - goBTC Market', '465814222' : 'Algofi - goETH Market', '465814278' : 'Algofi - STBL Market', '482608867' : 'Algofi - STBL Staking', '553866305' : 'Algofi - STBL/USDC LP Staking'}
yieldly_db = {'FMBXOFAQCSAD4UWU4Q7IX5AV4FRV6AKURJQYGXLW3CTPTQ7XBX6MALMSPY': 'Yieldly - YLDY-YLDY/ALGO', 'VUY44SYOFFJE3ZIDEMA6PT34J3FAZUAE6VVTOTUJ5LZ343V6WZ3ZJQTCD4': 'Yieldly - YLDY-OPUL', 'U3RJ4NNSASBOIY25KAVVFV6CFDOS22L7YLZBENMIVVVFEWT5WE5GHXH5VQ': 'Yieldly - GEMS-GEMS', 'BXLXRYBOM7ZNYSCRLWG6THNMO6HASTIRMJGSNJANZFS6EB3X4JY2FZCJNA': 'Yieldly - YLDY-GEMS', 'AAXO2CVK6SHKHNROZZH3435UAYMQXZP4UTLO5LQCNTDZAXEGJJ2OPHFX54': 'Yieldly - YLDY-ARCC', '4UPQ2HSD7O6WY3HP33JXMPGYNMV56U3YK5WT6CTSBLGS466JPOFUVCCSTA': 'Yieldly - ARCC-ARCC', 'YCHXDWES2VJDEKAHWPC344N6WK3FQOZL5VIZYMCDHDIUTTUZPC4IA6DEZY': 'Yieldly - YLDY-CHOICE', 'KDZS6OV5PAARFJPRZYRRQWCZOCPICB6NJ4YNHZKNCNKIVOLSL5ZCPMY24I': 'Yieldly - YLDY-SMILE', '55CUF2LA45PJWIUK2KZOGN54N2POJHXAWTSVGR5HFSO4JUUDJ3SOURUVGQ': 'Yieldly - SMILE-SMILE', 'IR2HQCMN6GPTKGCTR54YXFFUBB4A7FRZR76U2BJAS4XBLNJHZX7RMOPBIQ': 'Yieldly - YLDY-XET', 'GLHS7QEDDSQVHNTOVFELY3ISMB44TL7I7RQ36BNFW7KMJEZA4SQUFJHV6E': 'Yieldly - CHOICE-CHOICE', '2RQGRKUSDCZAEFFCXXCQBCVH6KOR7FZW6N3G7B547DIS76AGQJAZZVPPPY': 'Yieldly - OPUL-OPUL', '3OZ3HAIID3NPKB5N3B6TGFUBX44ZBZDNNRWGY6HSPQLP3NRSQW7D6ZKFEY': 'Yieldly - XET-XET', 'ZMJVS7F3DXYDE6XIBXGWLEL6VXUYLCN4HTOW57QDLZ2TAMOWZK7EIYAQF4': 'Yieldly - YLDY-AKITA', '233725844': 'Yieldly Algo Staking', '233725850': 'Yieldly Staking', '233725848': 'Yieldly', '233725850': 'Yieldly - YLDY-YLDY/ALGO', '348079765': 'Yieldly - YLDY-OPUL', '419301793': 'Yieldly - GEMS-GEMS', '393388133': 'Yieldly - YLDY-GEMS', '385089192': 'Yieldly - YLDY-ARCC', '498747685': 'Yieldly - ARCC/ARCC', '447336112': 'Yieldly - YLDY-CHOICE', '352116819': 'Yieldly - YLDY-SMILE', '373819681': 'Yieldly - SMILE-SMILE', '424101057': 'Yieldly - YLDY-XET', '464365150': 'Yieldly - CHOICE-CHOICE', '367431051': 'Yieldly - OPUL-OPUL', '470390215': 'Yieldly - XET-XET', '511597182': 'Yieldly - YLDY-AKITA', '511593477': 'Yieldly - (AKITA/ALGO)LP-YLDY'} algofi_db = {'3EPGHSNBBN5M2LD6V7A63EHZQQLATVQHDBYJQIZ6BLCBTIXA5XR7ZOZEB4': 'Algofi - Creator', '2SGUKZCOBEVGN3HPKSXPS6DTCXZ7LSP6G3BQF6KVUIUREBBY2QTGSON7WQ': 'Algofi - Manager', 'TY5N6G67JWHSMWFFFZ252FXWKLRO5UZLBEJ4LGV7TPR5PVSKPLDWH3YRXU': 'Algofi - ALGO Market', 'ABQHZLNGGPWWZVA5SOQO3HBEECVJSE3OHYLKACOTC7TC4BS52ZHREPF7QY': 'Algofi - USDC Market', 'W5UCMHDSTGKWBOV6YVLDVPJGPE4L4ISTU6TGXC7WRF63Y7GOVFOBUNJB5Q': 'Algofi - goBTC Market', 'KATD43XBJJIDXB3U5UCPIFUDU3CZ3YQNVWA5PDDMZVGKSR4E3QWPJX67CY': 'Algofi - goETH Market', 'OPY7XNB5LVMECF3PHJGQV2U33LZPM5FBUXA3JJPHANAG5B7GEYUPZJVYRE': 'Algofi - STBL Market', 'DYLJJES76YQCOUK6D4RALIPJ76U5QT7L6A2KP6QTOH63OBLFKLTER2J6IA': 'Algofi - STBL Staking', 'Z3GWRL5HGCJQYIXP4MINCRWCKWDHZ5VSYJHDLIDLEIOARIZWJX6GLAWWEI': 'Algofi - STBL/USDC LP Staking', '465818260': 'Algofi - Manager', '465814065': 'Algofi - ALGO Market', '465814103': 'Algofi - USDC Market', '465814149': 'Algofi - goBTC Market', '465814222': 'Algofi - goETH Market', '465814278': 'Algofi - STBL Market', '482608867': 'Algofi - STBL Staking', '553866305': 'Algofi - STBL/USDC LP Staking'}
print ( True or False ) == True print ( True or True ) == True print ( False or False ) == False print ( True and False ) == False print ( True and True ) == True print ( False and False ) == False print ( not True ) == False print ( not False ) == True print ( not True or False ) == ( (not True) or False ) print ( not False or False ) == ( (not False) or False ) print ( not True and True ) == ( (not True) and True ) print ( not False and True ) == ( (not False) and True ) print ( not True and not False or False ) == ( ( (not True) and (not False) ) or False )
print(True or False) == True print(True or True) == True print(False or False) == False print(True and False) == False print(True and True) == True print(False and False) == False print(not True) == False print(not False) == True print(not True or False) == (not True or False) print(not False or False) == (not False or False) print(not True and True) == (not True and True) print(not False and True) == (not False and True) print(not True and (not False) or False) == (not True and (not False) or False)
# # PySNMP MIB module Wellfleet-PGM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-PGM-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:41:16 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsIntersection, ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "SingleValueConstraint") NotificationGroup, ModuleCompliance = mibBuilder.importSymbols("SNMPv2-CONF", "NotificationGroup", "ModuleCompliance") Bits, IpAddress, Integer32, Counter32, MibScalar, MibTable, MibTableRow, MibTableColumn, NotificationType, iso, Counter64, ObjectIdentity, Gauge32, ModuleIdentity, Unsigned32, TimeTicks, MibIdentifier = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "IpAddress", "Integer32", "Counter32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "NotificationType", "iso", "Counter64", "ObjectIdentity", "Gauge32", "ModuleIdentity", "Unsigned32", "TimeTicks", "MibIdentifier") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") wfPgmGroup, = mibBuilder.importSymbols("Wellfleet-COMMON-MIB", "wfPgmGroup") wfPgm = MibIdentifier((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1)) wfPgmCreate = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmCreate.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmCreate.setDescription('Create/Delete parameter. Default is created. Users perform a set operation on this object in order to create/delete PGM.') wfPgmEnable = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmEnable.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmEnable.setDescription('Enable/Disable Parameter indicates whether this PGM record is enabled or disabled.') wfPgmState = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("init", 3), ("notpres", 4))).clone('notpres')).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmState.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmState.setDescription('The current state of the entire PGM.') wfPgmDebug = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 4), Integer32()).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmDebug.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmDebug.setDescription('This is a debug field for PGM. Setting bits cause pgm to gernerate certain log messages. This field will NOT restart PGM. The follow bits maybe set in any combination (LS stands for least significant): 0x00000001 for no display 0x00000002 for interface to MTM 0x00000004 for session addition 0x00000008 for session deletion 0x00000010 for retransmit state addition 0x00000020 for retransmit state deletion 0x00000040 for retransmit state timeout 0x00000080 for cache env 0x00000100 for ') wfPgmSessionLifeTime = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647)).clone(300)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmSessionLifeTime.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionLifeTime.setDescription('The length of the idle time (seconds) for which a PGM session will be aged out. An idle PGM session means there is no SPM message received from the upstream.') wfPgmNnakGenerate = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('enabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmNnakGenerate.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmNnakGenerate.setDescription('Router will send NNAK when received the redirect NCF if this parameter is set to enabled.') wfPgmMaxReXmitStates = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647))).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmMaxReXmitStates.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmMaxReXmitStates.setDescription('The Maxium number of retransmit state entries per slot. If no value is set means network element has no limitation on this mib.') wfPgmTotalReXmitStates = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 8), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmTotalReXmitStates.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmTotalReXmitStates.setDescription('The total number of retransmit state entries in retransmit state table.') wfPgmMaxSessions = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647)).clone(100)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmMaxSessions.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmMaxSessions.setDescription('The Maxium number of source path state sessions per slot. If no value is set means network element has no limitation on this mib.') wfPgmTotalSessions = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 10), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmTotalSessions.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmTotalSessions.setDescription('The total number of source path session entries currently in PGM session table') wfPgmTotalReXmitStatesTimedOut = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 11), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmTotalReXmitStatesTimedOut.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmTotalReXmitStatesTimedOut.setDescription('The total number of retransmit state entries got removed becuase of timed-out (no correspondent RDATA received).') wfPgmTotalUniqueNaks = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 12), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmTotalUniqueNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmTotalUniqueNaks.setDescription('The total number of unique Naks received.') wfPgmTotalUniqueParityNaks = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 13), Gauge32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmTotalUniqueParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmTotalUniqueParityNaks.setDescription('The total number of unique Parity Naks received.') wfPgmMaxNakRate = MibScalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647)).clone(100)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmMaxNakRate.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmMaxNakRate.setDescription('The maximum number allowed of Nak per second.') wfPgmIfTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2), ) if mibBuilder.loadTexts: wfPgmIfTable.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfTable.setDescription('Table of PGM Interface Statistics') wfPgmIfEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1), ).setIndexNames((0, "Wellfleet-PGM-MIB", "wfPgmIfCct")) if mibBuilder.loadTexts: wfPgmIfEntry.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfEntry.setDescription('A PGM Interface Statistics entry') wfPgmIfCreate = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("created", 1), ("deleted", 2))).clone('created')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmIfCreate.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfCreate.setDescription('Create or delete') wfPgmIfEnable = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmIfEnable.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfEnable.setDescription('not used. enabled/Disabled parameter.') wfPgmIfState = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("up", 1), ("down", 2), ("init", 3), ("notpres", 4))).clone('notpres')).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfState.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfState.setDescription('The current state of the PGM interface.') wfPgmIfCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfCct.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfCct.setDescription('The PGM circuit number') wfPgmIfNakReXmitInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(100, 2147483647)).clone(1000)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmIfNakReXmitInterval.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfNakReXmitInterval.setDescription('The length of time (milliseconds) for which a network element will retransmit a NAK while waiting for a corresponding NCF. This interval is counted down from the transmission of a NAK') wfPgmIfMaxNakReXmitRate = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647)).clone(2)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmIfMaxNakReXmitRate.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfMaxNakReXmitRate.setDescription('The maximum retries of NAK restransmission per second is allowed. ') wfPgmIfNakRdataInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647)).clone(10)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmIfNakRdataInterval.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfNakRdataInterval.setDescription('The length of time (seconds) for which a network element will wait for the corresponding RDATA. This interval is counted down from the time a matching NCF is received.') wfPgmIfNakEliminateInterval = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 2147483647)).clone(5)).setMaxAccess("readwrite") if mibBuilder.loadTexts: wfPgmIfNakEliminateInterval.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfNakEliminateInterval.setDescription('The length of time (seconds) for which a network element will suspend NAK elimanation for the specific TSI/SQN. .This interval is counted down from the time the first NAK is establish. This value must be smaller than wfPgmNakRdataInterval. If the value of this parameter is set to 1 then all the duplicate NAKs will be elimanated.') wfPgmIfTotalReXmitStates = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfTotalReXmitStates.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfTotalReXmitStates.setDescription('The total retransmit state entries for this interface.') wfPgmIfTotalReXmitTimedOut = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfTotalReXmitTimedOut.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfTotalReXmitTimedOut.setDescription('The total time-outed retransmit state entries for this interface.') wfPgmIfInSpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInSpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInSpms.setDescription('The total number of SPM received on the PGM interface.') wfPgmIfOutSpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfOutSpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutSpms.setDescription('The total number of SPM sent out from the PGM interface.') wfPgmIfInParitySpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInParitySpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInParitySpms.setDescription('The total number of parity SPM received on the PGM interface') wfPgmIfOutParitySpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfOutParitySpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutParitySpms.setDescription('The total number of parity SPM sent out from the PGM interface') wfPgmIfInSpmPortErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInSpmPortErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInSpmPortErrors.setDescription('The number of received SPM discarded on the PGM interface for the wrong inbound') wfPgmIfInRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInRdata.setDescription('The total number of RDATA received on the PGM interface') wfPgmIfOutRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfOutRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutRdata.setDescription('The total number of RDATA sent out from the PGM interface') wfPgmIfInParityRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInParityRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInParityRdata.setDescription('The total number of Parity RDATA received on the PGM interface') wfPgmIfOutParityRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfOutParityRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutParityRdata.setDescription('The total number of parity RDATA sent out from the PGM interface') wfPgmIfInRdataPortErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInRdataPortErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInRdataPortErrors.setDescription('The number of received RDATA discarded because of wrong inbound') wfPgmIfInRdataNoSessionErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInRdataNoSessionErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInRdataNoSessionErrors.setDescription('The number of received RDATA discarded because of no session') wfPgmIfUniqueNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfUniqueNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfUniqueNaks.setDescription('The total number of unique NAKs received for this interface.') wfPgmIfInNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNaks.setDescription('The total number of NAK received on the PGM interface') wfPgmIfOutNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfOutNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutNaks.setDescription('The total number of NAK sent out from the PGM interface') wfPgmIfUniqueParityNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfUniqueParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfUniqueParityNaks.setDescription('The total number of unique parity NAKs received for this interface.') wfPgmIfInParityNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 26), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInParityNaks.setDescription('The total number of parity NAK received on the PGM interface') wfPgmIfOutParityNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 27), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfOutParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutParityNaks.setDescription('The total number of parity NAK sent out from the PGM interface') wfPgmIfInNakPortErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 28), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInNakPortErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNakPortErrors.setDescription('The number of received NAK discarded because of wrong outbound') wfPgmIfInNakNoSessionErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 29), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInNakNoSessionErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNakNoSessionErrors.setDescription('The number of received NAK Discarded because of no session') wfPgmIfInNakSeqErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 30), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInNakSeqErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNakSeqErrors.setDescription('The number of received NAK Discarded because of out of sequence (out of retransmit window).') wfPgmIfInParityNakTgErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 31), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInParityNakTgErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInParityNakTgErrors.setDescription('The number of received parity NAK Discarded because of out of parity TG window.') wfPgmIfInNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 32), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNnaks.setDescription('The total number of NNAK received on the PGM interface') wfPgmIfOutNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 33), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfOutNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutNnaks.setDescription('The total number of NNAK sent out from the PGM interface') wfPgmIfInParityNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 34), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInParityNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInParityNnaks.setDescription('The total number of parity NNAK received on the PGM interface') wfPgmIfOutParityNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 35), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfOutParityNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutParityNnaks.setDescription('The total number of parity NNAK sent out from the PGM interface') wfPgmIfInNnakPortErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 36), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInNnakPortErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNnakPortErrors.setDescription('The number of received NNAK discarded because of wrong mcast outbound') wfPgmIfInNnakNoSessionErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 37), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInNnakNoSessionErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNnakNoSessionErrors.setDescription('The number of received NNAK discarded because of no session') wfPgmIfInNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 38), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNcfs.setDescription('The total number of NCF received on the PGM interface') wfPgmIfOutNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 39), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfOutNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutNcfs.setDescription('The total number of NCF sent out from the PGM interface') wfPgmIfInParityNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 40), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInParityNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInParityNcfs.setDescription('The total number of parity NCF received on the PGM interface') wfPgmIfOutParityNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 41), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfOutParityNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutParityNcfs.setDescription('The total number of parity NCF sent out from the PGM interface') wfPgmIfInNcfPortErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 42), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInNcfPortErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNcfPortErrors.setDescription('The number of received NCF discarded because of the wrong inbound') wfPgmIfInNcfNoSessionErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 43), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInNcfNoSessionErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNcfNoSessionErrors.setDescription('The number of received NCF discarded because of no session') wfPgmIfInRedirectNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 44), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmIfInRedirectNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInRedirectNcfs.setDescription('The number of redirected NCF received on the PGM interface') wfPgmSessionTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3), ) if mibBuilder.loadTexts: wfPgmSessionTable.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionTable.setDescription('Table of PGM flow for each (port,global id)') wfPgmSessionEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1), ).setIndexNames((0, "Wellfleet-PGM-MIB", "wfPgmSessionSource"), (0, "Wellfleet-PGM-MIB", "wfPgmSessionGroup"), (0, "Wellfleet-PGM-MIB", "wfPgmSessionSourcePort"), (0, "Wellfleet-PGM-MIB", "wfPgmSessionGlobalId")) if mibBuilder.loadTexts: wfPgmSessionEntry.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionEntry.setDescription('A PGM Session entry') wfPgmSessionSource = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionSource.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionSource.setDescription('The source IP address of this entry.') wfPgmSessionGroup = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionGroup.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionGroup.setDescription('The destination group address of this entry') wfPgmSessionSourcePort = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionSourcePort.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionSourcePort.setDescription('The source port of this pgm session') wfPgmSessionGlobalId = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionGlobalId.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionGlobalId.setDescription('The Global ID this entry') wfPgmSessionUpstreamAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 5), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionUpstreamAddress.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionUpstreamAddress.setDescription('The IP address of the upstream interface for the entry.') wfPgmSessionUpstreamIfCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionUpstreamIfCct.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionUpstreamIfCct.setDescription('The circuit number of the upstream intf for the entry.') wfPgmSessionTrailEdgeSeq = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 7), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionTrailEdgeSeq.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionTrailEdgeSeq.setDescription('The trailing edge sequence of the transfer window.') wfPgmSessionIncrSeq = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 8), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionIncrSeq.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionIncrSeq.setDescription('The increase sequnce number in the transfer window.') wfPgmSessionLeadEdgeSeq = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 9), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionLeadEdgeSeq.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionLeadEdgeSeq.setDescription('The leading edge sequence of the transfer window.') wfPgmSessionInSpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 10), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInSpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInSpms.setDescription('The total number of SPMs received for this session.') wfPgmSessionOutSpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 11), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionOutSpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutSpms.setDescription('The total number of SPMs sent out for this session.') wfPgmSessionInParitySpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 12), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInParitySpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInParitySpms.setDescription('The total number of ParityS PMs received for this session.') wfPgmSessionOutParitySpms = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 13), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionOutParitySpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutParitySpms.setDescription('The total number of Parity SPMs sent out for this session.') wfPgmSessionTotalReXmitStates = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 14), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionTotalReXmitStates.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionTotalReXmitStates.setDescription('The total retransmit state entries for this session.') wfPgmSessionTotalReXmitTimedOut = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 15), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionTotalReXmitTimedOut.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionTotalReXmitTimedOut.setDescription('The total time-outed retransmit state entries for this session.') wfPgmSessionInRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 16), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInRdata.setDescription('The total number of RDATAs received for this session.') wfPgmSessionOutRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 17), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionOutRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutRdata.setDescription('The total number of RDATAs sent out from this session.') wfPgmSessionInParityRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 18), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInParityRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInParityRdata.setDescription('The total number of parity RDATAs received for this session.') wfPgmSessionOutParityRdata = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 19), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionOutParityRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutParityRdata.setDescription('The total number of parity RDATAs sent out from this session.') wfPgmSessionInRdataNoStateErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 20), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInRdataNoStateErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInRdataNoStateErrors.setDescription('The total number of received RDATA discarded for no Retransmit state.') wfPgmSessionUniqueNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 21), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionUniqueNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionUniqueNaks.setDescription('The total number of unique NAKs received for this session.') wfPgmSessionInNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 22), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInNaks.setDescription('The total number of NAKs received for this session.') wfPgmSessionOutNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 23), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionOutNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutNaks.setDescription('The total number of NAKs sent out from this session.') wfPgmSessionUniqueParityNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 24), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionUniqueParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionUniqueParityNaks.setDescription('The total number of unique parity NAKs received for this session.') wfPgmSessionInParityNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 25), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInParityNaks.setDescription('The total number of parity NAKs received for this session.') wfPgmSessionOutParityNaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 26), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionOutParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutParityNaks.setDescription('The total number of parity NAKs sent out from this session.') wfPgmSessionInNakSeqErrors = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 27), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInNakSeqErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInNakSeqErrors.setDescription('The total number of received NAKs discarded because of out of sequence (out of retransmit window).') wfPgmSessionInNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 28), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInNnaks.setDescription('The total number of NNAKs received for this session.') wfPgmSessionOutNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 29), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionOutNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutNnaks.setDescription('The total number of NNAKs sent out from this session.') wfPgmSessionInParityNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 30), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInParityNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInParityNnaks.setDescription('The total number of parity NNAKs received for this session.') wfPgmSessionOutParityNnaks = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 31), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionOutParityNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutParityNnaks.setDescription('The total number of Parity NNAKs sent out from this session.') wfPgmSessionInNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 32), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInNcfs.setDescription('The total number of Ncfs received for this session.') wfPgmSessionOutNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 33), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionOutNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutNcfs.setDescription('The total number of Ncfs sent out from this session.') wfPgmSessionInParityNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 34), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInParityNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInParityNcfs.setDescription('The total number of Parity Ncfs received for this session.') wfPgmSessionOutParityNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 35), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionOutParityNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutParityNcfs.setDescription('The total number of Parity Ncfs sent out from this session.') wfPgmSessionInRedirectNcfs = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 36), Counter32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmSessionInRedirectNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInRedirectNcfs.setDescription('The total number of redirect Ncfs received for this session.') wfPgmReXmitTable = MibTable((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4), ) if mibBuilder.loadTexts: wfPgmReXmitTable.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitTable.setDescription('Table of PGM Retransmit state') wfPgmReXmitEntry = MibTableRow((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1), ).setIndexNames((0, "Wellfleet-PGM-MIB", "wfPgmReXmitSource"), (0, "Wellfleet-PGM-MIB", "wfPgmReXmitGroup"), (0, "Wellfleet-PGM-MIB", "wfPgmReXmitSourcePort"), (0, "Wellfleet-PGM-MIB", "wfPgmReXmitGlobalId"), (0, "Wellfleet-PGM-MIB", "wfPgmReXmitSelectiveSeqNum"), (0, "Wellfleet-PGM-MIB", "wfPgmReXmitParityTgSeqNum")) if mibBuilder.loadTexts: wfPgmReXmitEntry.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitEntry.setDescription('A PGM ReXmit entry') wfPgmReXmitSource = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmReXmitSource.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitSource.setDescription('The source IP address of this entry.') wfPgmReXmitGroup = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmReXmitGroup.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitGroup.setDescription('The destination group address of this entry') wfPgmReXmitSourcePort = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmReXmitSourcePort.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitSourcePort.setDescription('The source port of this pgm retransmit state') wfPgmReXmitGlobalId = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(6, 6)).setFixedLength(6)).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmReXmitGlobalId.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitGlobalId.setDescription('The Global ID this entry') wfPgmReXmitSelectiveSeqNum = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmReXmitSelectiveSeqNum.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitSelectiveSeqNum.setDescription('The Selected Sequence number for this entry.') wfPgmReXmitParityTgSeqNum = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmReXmitParityTgSeqNum.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitParityTgSeqNum.setDescription('The Requested Parity Tg sequence number for this entry. this value will be the same as wfPgmSessionParityTgSeq.') wfPgmReXmitReqParityTgCount = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmReXmitReqParityTgCount.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitReqParityTgCount.setDescription('The Requested number of missing Parity packets of specific Tg. The largest counter of the received NAK will be stored in this mib.') wfPgmReXmitUpStreamCct = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmReXmitUpStreamCct.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitUpStreamCct.setDescription('The upstream interface circuit number.') wfPgmReXmitDownStream = MibTableColumn((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 9), OctetString()).setMaxAccess("readonly") if mibBuilder.loadTexts: wfPgmReXmitDownStream.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitDownStream.setDescription('list of downstream intfs for this entry. Each one is in the format of (intf_addr(u_int32) and intf_cct(u_int16)') mibBuilder.exportSymbols("Wellfleet-PGM-MIB", wfPgmIfInRdataNoSessionErrors=wfPgmIfInRdataNoSessionErrors, wfPgmSessionSource=wfPgmSessionSource, wfPgmIfInNnakNoSessionErrors=wfPgmIfInNnakNoSessionErrors, wfPgmTotalSessions=wfPgmTotalSessions, wfPgmMaxReXmitStates=wfPgmMaxReXmitStates, wfPgmIfInNaks=wfPgmIfInNaks, wfPgmIfInRdata=wfPgmIfInRdata, wfPgmSessionUniqueParityNaks=wfPgmSessionUniqueParityNaks, wfPgmSessionInParitySpms=wfPgmSessionInParitySpms, wfPgmTotalUniqueParityNaks=wfPgmTotalUniqueParityNaks, wfPgmIfNakReXmitInterval=wfPgmIfNakReXmitInterval, wfPgmSessionOutParitySpms=wfPgmSessionOutParitySpms, wfPgmIfInParityNaks=wfPgmIfInParityNaks, wfPgmIfInNnaks=wfPgmIfInNnaks, wfPgmSessionInRdataNoStateErrors=wfPgmSessionInRdataNoStateErrors, wfPgmIfInSpms=wfPgmIfInSpms, wfPgmIfTotalReXmitStates=wfPgmIfTotalReXmitStates, wfPgmSessionInNnaks=wfPgmSessionInNnaks, wfPgmState=wfPgmState, wfPgmIfInRedirectNcfs=wfPgmIfInRedirectNcfs, wfPgmSessionInNcfs=wfPgmSessionInNcfs, wfPgmIfInNnakPortErrors=wfPgmIfInNnakPortErrors, wfPgmSessionInRedirectNcfs=wfPgmSessionInRedirectNcfs, wfPgmMaxNakRate=wfPgmMaxNakRate, wfPgmSessionOutNaks=wfPgmSessionOutNaks, wfPgmSessionTotalReXmitStates=wfPgmSessionTotalReXmitStates, wfPgmIfState=wfPgmIfState, wfPgmSessionUpstreamIfCct=wfPgmSessionUpstreamIfCct, wfPgmMaxSessions=wfPgmMaxSessions, wfPgmIfTable=wfPgmIfTable, wfPgmSessionOutParityNaks=wfPgmSessionOutParityNaks, wfPgmSessionTrailEdgeSeq=wfPgmSessionTrailEdgeSeq, wfPgm=wfPgm, wfPgmIfOutSpms=wfPgmIfOutSpms, wfPgmNnakGenerate=wfPgmNnakGenerate, wfPgmTotalUniqueNaks=wfPgmTotalUniqueNaks, wfPgmSessionUniqueNaks=wfPgmSessionUniqueNaks, wfPgmIfMaxNakReXmitRate=wfPgmIfMaxNakReXmitRate, wfPgmEnable=wfPgmEnable, wfPgmIfInSpmPortErrors=wfPgmIfInSpmPortErrors, wfPgmSessionTable=wfPgmSessionTable, wfPgmSessionTotalReXmitTimedOut=wfPgmSessionTotalReXmitTimedOut, wfPgmIfEnable=wfPgmIfEnable, wfPgmSessionSourcePort=wfPgmSessionSourcePort, wfPgmSessionInNaks=wfPgmSessionInNaks, wfPgmReXmitParityTgSeqNum=wfPgmReXmitParityTgSeqNum, wfPgmIfNakRdataInterval=wfPgmIfNakRdataInterval, wfPgmIfOutParitySpms=wfPgmIfOutParitySpms, wfPgmReXmitSource=wfPgmReXmitSource, wfPgmSessionInParityRdata=wfPgmSessionInParityRdata, wfPgmCreate=wfPgmCreate, wfPgmIfInNcfPortErrors=wfPgmIfInNcfPortErrors, wfPgmReXmitEntry=wfPgmReXmitEntry, wfPgmSessionOutParityNcfs=wfPgmSessionOutParityNcfs, wfPgmIfInParityNnaks=wfPgmIfInParityNnaks, wfPgmIfOutNnaks=wfPgmIfOutNnaks, wfPgmIfOutParityRdata=wfPgmIfOutParityRdata, wfPgmIfOutNcfs=wfPgmIfOutNcfs, wfPgmIfInNcfNoSessionErrors=wfPgmIfInNcfNoSessionErrors, wfPgmSessionOutNcfs=wfPgmSessionOutNcfs, wfPgmSessionLifeTime=wfPgmSessionLifeTime, wfPgmIfInNakNoSessionErrors=wfPgmIfInNakNoSessionErrors, wfPgmSessionIncrSeq=wfPgmSessionIncrSeq, wfPgmIfInNakSeqErrors=wfPgmIfInNakSeqErrors, wfPgmReXmitGroup=wfPgmReXmitGroup, wfPgmReXmitReqParityTgCount=wfPgmReXmitReqParityTgCount, wfPgmIfEntry=wfPgmIfEntry, wfPgmIfTotalReXmitTimedOut=wfPgmIfTotalReXmitTimedOut, wfPgmIfOutRdata=wfPgmIfOutRdata, wfPgmIfCct=wfPgmIfCct, wfPgmIfInParitySpms=wfPgmIfInParitySpms, wfPgmSessionOutParityRdata=wfPgmSessionOutParityRdata, wfPgmReXmitTable=wfPgmReXmitTable, wfPgmSessionInRdata=wfPgmSessionInRdata, wfPgmSessionOutNnaks=wfPgmSessionOutNnaks, wfPgmSessionInParityNcfs=wfPgmSessionInParityNcfs, wfPgmSessionGlobalId=wfPgmSessionGlobalId, wfPgmSessionInParityNaks=wfPgmSessionInParityNaks, wfPgmReXmitUpStreamCct=wfPgmReXmitUpStreamCct, wfPgmIfOutNaks=wfPgmIfOutNaks, wfPgmSessionOutParityNnaks=wfPgmSessionOutParityNnaks, wfPgmSessionInSpms=wfPgmSessionInSpms, wfPgmIfOutParityNaks=wfPgmIfOutParityNaks, wfPgmIfNakEliminateInterval=wfPgmIfNakEliminateInterval, wfPgmIfInNcfs=wfPgmIfInNcfs, wfPgmIfInParityNcfs=wfPgmIfInParityNcfs, wfPgmSessionEntry=wfPgmSessionEntry, wfPgmIfOutParityNcfs=wfPgmIfOutParityNcfs, wfPgmSessionOutSpms=wfPgmSessionOutSpms, wfPgmSessionOutRdata=wfPgmSessionOutRdata, wfPgmDebug=wfPgmDebug, wfPgmIfInParityNakTgErrors=wfPgmIfInParityNakTgErrors, wfPgmReXmitSourcePort=wfPgmReXmitSourcePort, wfPgmReXmitSelectiveSeqNum=wfPgmReXmitSelectiveSeqNum, wfPgmReXmitGlobalId=wfPgmReXmitGlobalId, wfPgmTotalReXmitStatesTimedOut=wfPgmTotalReXmitStatesTimedOut, wfPgmSessionGroup=wfPgmSessionGroup, wfPgmIfCreate=wfPgmIfCreate, wfPgmIfUniqueParityNaks=wfPgmIfUniqueParityNaks, wfPgmSessionLeadEdgeSeq=wfPgmSessionLeadEdgeSeq, wfPgmReXmitDownStream=wfPgmReXmitDownStream, wfPgmIfUniqueNaks=wfPgmIfUniqueNaks, wfPgmSessionUpstreamAddress=wfPgmSessionUpstreamAddress, wfPgmIfOutParityNnaks=wfPgmIfOutParityNnaks, wfPgmSessionInNakSeqErrors=wfPgmSessionInNakSeqErrors, wfPgmIfInNakPortErrors=wfPgmIfInNakPortErrors, wfPgmSessionInParityNnaks=wfPgmSessionInParityNnaks, wfPgmIfInParityRdata=wfPgmIfInParityRdata, wfPgmTotalReXmitStates=wfPgmTotalReXmitStates, wfPgmIfInRdataPortErrors=wfPgmIfInRdataPortErrors)
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_range_constraint, value_size_constraint, single_value_constraint) = mibBuilder.importSymbols('ASN1-REFINEMENT', 'ConstraintsIntersection', 'ConstraintsUnion', 'ValueRangeConstraint', 'ValueSizeConstraint', 'SingleValueConstraint') (notification_group, module_compliance) = mibBuilder.importSymbols('SNMPv2-CONF', 'NotificationGroup', 'ModuleCompliance') (bits, ip_address, integer32, counter32, mib_scalar, mib_table, mib_table_row, mib_table_column, notification_type, iso, counter64, object_identity, gauge32, module_identity, unsigned32, time_ticks, mib_identifier) = mibBuilder.importSymbols('SNMPv2-SMI', 'Bits', 'IpAddress', 'Integer32', 'Counter32', 'MibScalar', 'MibTable', 'MibTableRow', 'MibTableColumn', 'NotificationType', 'iso', 'Counter64', 'ObjectIdentity', 'Gauge32', 'ModuleIdentity', 'Unsigned32', 'TimeTicks', 'MibIdentifier') (display_string, textual_convention) = mibBuilder.importSymbols('SNMPv2-TC', 'DisplayString', 'TextualConvention') (wf_pgm_group,) = mibBuilder.importSymbols('Wellfleet-COMMON-MIB', 'wfPgmGroup') wf_pgm = mib_identifier((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1)) wf_pgm_create = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('created', 1), ('deleted', 2))).clone('created')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmCreate.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmCreate.setDescription('Create/Delete parameter. Default is created. Users perform a set operation on this object in order to create/delete PGM.') wf_pgm_enable = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmEnable.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmEnable.setDescription('Enable/Disable Parameter indicates whether this PGM record is enabled or disabled.') wf_pgm_state = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('up', 1), ('down', 2), ('init', 3), ('notpres', 4))).clone('notpres')).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmState.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmState.setDescription('The current state of the entire PGM.') wf_pgm_debug = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 4), integer32()).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmDebug.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmDebug.setDescription('This is a debug field for PGM. Setting bits cause pgm to gernerate certain log messages. This field will NOT restart PGM. The follow bits maybe set in any combination (LS stands for least significant): 0x00000001 for no display 0x00000002 for interface to MTM 0x00000004 for session addition 0x00000008 for session deletion 0x00000010 for retransmit state addition 0x00000020 for retransmit state deletion 0x00000040 for retransmit state timeout 0x00000080 for cache env 0x00000100 for ') wf_pgm_session_life_time = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647)).clone(300)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmSessionLifeTime.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionLifeTime.setDescription('The length of the idle time (seconds) for which a PGM session will be aged out. An idle PGM session means there is no SPM message received from the upstream.') wf_pgm_nnak_generate = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 6), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('enabled')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmNnakGenerate.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmNnakGenerate.setDescription('Router will send NNAK when received the redirect NCF if this parameter is set to enabled.') wf_pgm_max_re_xmit_states = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647))).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmMaxReXmitStates.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmMaxReXmitStates.setDescription('The Maxium number of retransmit state entries per slot. If no value is set means network element has no limitation on this mib.') wf_pgm_total_re_xmit_states = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 8), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmTotalReXmitStates.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmTotalReXmitStates.setDescription('The total number of retransmit state entries in retransmit state table.') wf_pgm_max_sessions = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 9), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647)).clone(100)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmMaxSessions.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmMaxSessions.setDescription('The Maxium number of source path state sessions per slot. If no value is set means network element has no limitation on this mib.') wf_pgm_total_sessions = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 10), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmTotalSessions.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmTotalSessions.setDescription('The total number of source path session entries currently in PGM session table') wf_pgm_total_re_xmit_states_timed_out = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 11), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmTotalReXmitStatesTimedOut.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmTotalReXmitStatesTimedOut.setDescription('The total number of retransmit state entries got removed becuase of timed-out (no correspondent RDATA received).') wf_pgm_total_unique_naks = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 12), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmTotalUniqueNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmTotalUniqueNaks.setDescription('The total number of unique Naks received.') wf_pgm_total_unique_parity_naks = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 13), gauge32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmTotalUniqueParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmTotalUniqueParityNaks.setDescription('The total number of unique Parity Naks received.') wf_pgm_max_nak_rate = mib_scalar((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 1, 14), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647)).clone(100)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmMaxNakRate.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmMaxNakRate.setDescription('The maximum number allowed of Nak per second.') wf_pgm_if_table = mib_table((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2)) if mibBuilder.loadTexts: wfPgmIfTable.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfTable.setDescription('Table of PGM Interface Statistics') wf_pgm_if_entry = mib_table_row((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1)).setIndexNames((0, 'Wellfleet-PGM-MIB', 'wfPgmIfCct')) if mibBuilder.loadTexts: wfPgmIfEntry.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfEntry.setDescription('A PGM Interface Statistics entry') wf_pgm_if_create = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 1), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('created', 1), ('deleted', 2))).clone('created')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmIfCreate.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfCreate.setDescription('Create or delete') wf_pgm_if_enable = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 2), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2))).clone(namedValues=named_values(('enabled', 1), ('disabled', 2))).clone('disabled')).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmIfEnable.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfEnable.setDescription('not used. enabled/Disabled parameter.') wf_pgm_if_state = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 3), integer32().subtype(subtypeSpec=constraints_union(single_value_constraint(1, 2, 3, 4))).clone(namedValues=named_values(('up', 1), ('down', 2), ('init', 3), ('notpres', 4))).clone('notpres')).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfState.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfState.setDescription('The current state of the PGM interface.') wf_pgm_if_cct = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 4), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfCct.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfCct.setDescription('The PGM circuit number') wf_pgm_if_nak_re_xmit_interval = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 5), integer32().subtype(subtypeSpec=value_range_constraint(100, 2147483647)).clone(1000)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmIfNakReXmitInterval.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfNakReXmitInterval.setDescription('The length of time (milliseconds) for which a network element will retransmit a NAK while waiting for a corresponding NCF. This interval is counted down from the transmission of a NAK') wf_pgm_if_max_nak_re_xmit_rate = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 6), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647)).clone(2)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmIfMaxNakReXmitRate.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfMaxNakReXmitRate.setDescription('The maximum retries of NAK restransmission per second is allowed. ') wf_pgm_if_nak_rdata_interval = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 7), integer32().subtype(subtypeSpec=value_range_constraint(1, 2147483647)).clone(10)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmIfNakRdataInterval.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfNakRdataInterval.setDescription('The length of time (seconds) for which a network element will wait for the corresponding RDATA. This interval is counted down from the time a matching NCF is received.') wf_pgm_if_nak_eliminate_interval = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 8), integer32().subtype(subtypeSpec=value_range_constraint(0, 2147483647)).clone(5)).setMaxAccess('readwrite') if mibBuilder.loadTexts: wfPgmIfNakEliminateInterval.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfNakEliminateInterval.setDescription('The length of time (seconds) for which a network element will suspend NAK elimanation for the specific TSI/SQN. .This interval is counted down from the time the first NAK is establish. This value must be smaller than wfPgmNakRdataInterval. If the value of this parameter is set to 1 then all the duplicate NAKs will be elimanated.') wf_pgm_if_total_re_xmit_states = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 9), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfTotalReXmitStates.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfTotalReXmitStates.setDescription('The total retransmit state entries for this interface.') wf_pgm_if_total_re_xmit_timed_out = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 10), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfTotalReXmitTimedOut.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfTotalReXmitTimedOut.setDescription('The total time-outed retransmit state entries for this interface.') wf_pgm_if_in_spms = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 11), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInSpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInSpms.setDescription('The total number of SPM received on the PGM interface.') wf_pgm_if_out_spms = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 12), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfOutSpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutSpms.setDescription('The total number of SPM sent out from the PGM interface.') wf_pgm_if_in_parity_spms = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 13), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInParitySpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInParitySpms.setDescription('The total number of parity SPM received on the PGM interface') wf_pgm_if_out_parity_spms = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 14), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfOutParitySpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutParitySpms.setDescription('The total number of parity SPM sent out from the PGM interface') wf_pgm_if_in_spm_port_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 15), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInSpmPortErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInSpmPortErrors.setDescription('The number of received SPM discarded on the PGM interface for the wrong inbound') wf_pgm_if_in_rdata = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 16), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInRdata.setDescription('The total number of RDATA received on the PGM interface') wf_pgm_if_out_rdata = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 17), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfOutRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutRdata.setDescription('The total number of RDATA sent out from the PGM interface') wf_pgm_if_in_parity_rdata = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 18), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInParityRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInParityRdata.setDescription('The total number of Parity RDATA received on the PGM interface') wf_pgm_if_out_parity_rdata = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 19), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfOutParityRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutParityRdata.setDescription('The total number of parity RDATA sent out from the PGM interface') wf_pgm_if_in_rdata_port_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 20), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInRdataPortErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInRdataPortErrors.setDescription('The number of received RDATA discarded because of wrong inbound') wf_pgm_if_in_rdata_no_session_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 21), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInRdataNoSessionErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInRdataNoSessionErrors.setDescription('The number of received RDATA discarded because of no session') wf_pgm_if_unique_naks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 22), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfUniqueNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfUniqueNaks.setDescription('The total number of unique NAKs received for this interface.') wf_pgm_if_in_naks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 23), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNaks.setDescription('The total number of NAK received on the PGM interface') wf_pgm_if_out_naks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 24), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfOutNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutNaks.setDescription('The total number of NAK sent out from the PGM interface') wf_pgm_if_unique_parity_naks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 25), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfUniqueParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfUniqueParityNaks.setDescription('The total number of unique parity NAKs received for this interface.') wf_pgm_if_in_parity_naks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 26), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInParityNaks.setDescription('The total number of parity NAK received on the PGM interface') wf_pgm_if_out_parity_naks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 27), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfOutParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutParityNaks.setDescription('The total number of parity NAK sent out from the PGM interface') wf_pgm_if_in_nak_port_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 28), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInNakPortErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNakPortErrors.setDescription('The number of received NAK discarded because of wrong outbound') wf_pgm_if_in_nak_no_session_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 29), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInNakNoSessionErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNakNoSessionErrors.setDescription('The number of received NAK Discarded because of no session') wf_pgm_if_in_nak_seq_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 30), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInNakSeqErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNakSeqErrors.setDescription('The number of received NAK Discarded because of out of sequence (out of retransmit window).') wf_pgm_if_in_parity_nak_tg_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 31), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInParityNakTgErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInParityNakTgErrors.setDescription('The number of received parity NAK Discarded because of out of parity TG window.') wf_pgm_if_in_nnaks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 32), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNnaks.setDescription('The total number of NNAK received on the PGM interface') wf_pgm_if_out_nnaks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 33), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfOutNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutNnaks.setDescription('The total number of NNAK sent out from the PGM interface') wf_pgm_if_in_parity_nnaks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 34), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInParityNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInParityNnaks.setDescription('The total number of parity NNAK received on the PGM interface') wf_pgm_if_out_parity_nnaks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 35), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfOutParityNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutParityNnaks.setDescription('The total number of parity NNAK sent out from the PGM interface') wf_pgm_if_in_nnak_port_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 36), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInNnakPortErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNnakPortErrors.setDescription('The number of received NNAK discarded because of wrong mcast outbound') wf_pgm_if_in_nnak_no_session_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 37), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInNnakNoSessionErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNnakNoSessionErrors.setDescription('The number of received NNAK discarded because of no session') wf_pgm_if_in_ncfs = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 38), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNcfs.setDescription('The total number of NCF received on the PGM interface') wf_pgm_if_out_ncfs = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 39), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfOutNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutNcfs.setDescription('The total number of NCF sent out from the PGM interface') wf_pgm_if_in_parity_ncfs = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 40), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInParityNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInParityNcfs.setDescription('The total number of parity NCF received on the PGM interface') wf_pgm_if_out_parity_ncfs = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 41), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfOutParityNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfOutParityNcfs.setDescription('The total number of parity NCF sent out from the PGM interface') wf_pgm_if_in_ncf_port_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 42), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInNcfPortErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNcfPortErrors.setDescription('The number of received NCF discarded because of the wrong inbound') wf_pgm_if_in_ncf_no_session_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 43), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInNcfNoSessionErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInNcfNoSessionErrors.setDescription('The number of received NCF discarded because of no session') wf_pgm_if_in_redirect_ncfs = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 2, 1, 44), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmIfInRedirectNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmIfInRedirectNcfs.setDescription('The number of redirected NCF received on the PGM interface') wf_pgm_session_table = mib_table((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3)) if mibBuilder.loadTexts: wfPgmSessionTable.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionTable.setDescription('Table of PGM flow for each (port,global id)') wf_pgm_session_entry = mib_table_row((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1)).setIndexNames((0, 'Wellfleet-PGM-MIB', 'wfPgmSessionSource'), (0, 'Wellfleet-PGM-MIB', 'wfPgmSessionGroup'), (0, 'Wellfleet-PGM-MIB', 'wfPgmSessionSourcePort'), (0, 'Wellfleet-PGM-MIB', 'wfPgmSessionGlobalId')) if mibBuilder.loadTexts: wfPgmSessionEntry.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionEntry.setDescription('A PGM Session entry') wf_pgm_session_source = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 1), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionSource.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionSource.setDescription('The source IP address of this entry.') wf_pgm_session_group = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 2), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionGroup.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionGroup.setDescription('The destination group address of this entry') wf_pgm_session_source_port = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionSourcePort.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionSourcePort.setDescription('The source port of this pgm session') wf_pgm_session_global_id = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 4), octet_string().subtype(subtypeSpec=value_size_constraint(6, 6)).setFixedLength(6)).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionGlobalId.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionGlobalId.setDescription('The Global ID this entry') wf_pgm_session_upstream_address = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 5), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionUpstreamAddress.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionUpstreamAddress.setDescription('The IP address of the upstream interface for the entry.') wf_pgm_session_upstream_if_cct = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionUpstreamIfCct.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionUpstreamIfCct.setDescription('The circuit number of the upstream intf for the entry.') wf_pgm_session_trail_edge_seq = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 7), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionTrailEdgeSeq.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionTrailEdgeSeq.setDescription('The trailing edge sequence of the transfer window.') wf_pgm_session_incr_seq = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 8), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionIncrSeq.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionIncrSeq.setDescription('The increase sequnce number in the transfer window.') wf_pgm_session_lead_edge_seq = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 9), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionLeadEdgeSeq.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionLeadEdgeSeq.setDescription('The leading edge sequence of the transfer window.') wf_pgm_session_in_spms = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 10), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInSpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInSpms.setDescription('The total number of SPMs received for this session.') wf_pgm_session_out_spms = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 11), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionOutSpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutSpms.setDescription('The total number of SPMs sent out for this session.') wf_pgm_session_in_parity_spms = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 12), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInParitySpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInParitySpms.setDescription('The total number of ParityS PMs received for this session.') wf_pgm_session_out_parity_spms = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 13), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionOutParitySpms.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutParitySpms.setDescription('The total number of Parity SPMs sent out for this session.') wf_pgm_session_total_re_xmit_states = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 14), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionTotalReXmitStates.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionTotalReXmitStates.setDescription('The total retransmit state entries for this session.') wf_pgm_session_total_re_xmit_timed_out = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 15), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionTotalReXmitTimedOut.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionTotalReXmitTimedOut.setDescription('The total time-outed retransmit state entries for this session.') wf_pgm_session_in_rdata = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 16), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInRdata.setDescription('The total number of RDATAs received for this session.') wf_pgm_session_out_rdata = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 17), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionOutRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutRdata.setDescription('The total number of RDATAs sent out from this session.') wf_pgm_session_in_parity_rdata = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 18), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInParityRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInParityRdata.setDescription('The total number of parity RDATAs received for this session.') wf_pgm_session_out_parity_rdata = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 19), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionOutParityRdata.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutParityRdata.setDescription('The total number of parity RDATAs sent out from this session.') wf_pgm_session_in_rdata_no_state_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 20), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInRdataNoStateErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInRdataNoStateErrors.setDescription('The total number of received RDATA discarded for no Retransmit state.') wf_pgm_session_unique_naks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 21), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionUniqueNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionUniqueNaks.setDescription('The total number of unique NAKs received for this session.') wf_pgm_session_in_naks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 22), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInNaks.setDescription('The total number of NAKs received for this session.') wf_pgm_session_out_naks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 23), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionOutNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutNaks.setDescription('The total number of NAKs sent out from this session.') wf_pgm_session_unique_parity_naks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 24), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionUniqueParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionUniqueParityNaks.setDescription('The total number of unique parity NAKs received for this session.') wf_pgm_session_in_parity_naks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 25), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInParityNaks.setDescription('The total number of parity NAKs received for this session.') wf_pgm_session_out_parity_naks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 26), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionOutParityNaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutParityNaks.setDescription('The total number of parity NAKs sent out from this session.') wf_pgm_session_in_nak_seq_errors = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 27), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInNakSeqErrors.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInNakSeqErrors.setDescription('The total number of received NAKs discarded because of out of sequence (out of retransmit window).') wf_pgm_session_in_nnaks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 28), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInNnaks.setDescription('The total number of NNAKs received for this session.') wf_pgm_session_out_nnaks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 29), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionOutNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutNnaks.setDescription('The total number of NNAKs sent out from this session.') wf_pgm_session_in_parity_nnaks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 30), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInParityNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInParityNnaks.setDescription('The total number of parity NNAKs received for this session.') wf_pgm_session_out_parity_nnaks = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 31), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionOutParityNnaks.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutParityNnaks.setDescription('The total number of Parity NNAKs sent out from this session.') wf_pgm_session_in_ncfs = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 32), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInNcfs.setDescription('The total number of Ncfs received for this session.') wf_pgm_session_out_ncfs = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 33), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionOutNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutNcfs.setDescription('The total number of Ncfs sent out from this session.') wf_pgm_session_in_parity_ncfs = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 34), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInParityNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInParityNcfs.setDescription('The total number of Parity Ncfs received for this session.') wf_pgm_session_out_parity_ncfs = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 35), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionOutParityNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionOutParityNcfs.setDescription('The total number of Parity Ncfs sent out from this session.') wf_pgm_session_in_redirect_ncfs = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 3, 1, 36), counter32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmSessionInRedirectNcfs.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmSessionInRedirectNcfs.setDescription('The total number of redirect Ncfs received for this session.') wf_pgm_re_xmit_table = mib_table((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4)) if mibBuilder.loadTexts: wfPgmReXmitTable.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitTable.setDescription('Table of PGM Retransmit state') wf_pgm_re_xmit_entry = mib_table_row((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1)).setIndexNames((0, 'Wellfleet-PGM-MIB', 'wfPgmReXmitSource'), (0, 'Wellfleet-PGM-MIB', 'wfPgmReXmitGroup'), (0, 'Wellfleet-PGM-MIB', 'wfPgmReXmitSourcePort'), (0, 'Wellfleet-PGM-MIB', 'wfPgmReXmitGlobalId'), (0, 'Wellfleet-PGM-MIB', 'wfPgmReXmitSelectiveSeqNum'), (0, 'Wellfleet-PGM-MIB', 'wfPgmReXmitParityTgSeqNum')) if mibBuilder.loadTexts: wfPgmReXmitEntry.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitEntry.setDescription('A PGM ReXmit entry') wf_pgm_re_xmit_source = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 1), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmReXmitSource.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitSource.setDescription('The source IP address of this entry.') wf_pgm_re_xmit_group = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 2), ip_address()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmReXmitGroup.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitGroup.setDescription('The destination group address of this entry') wf_pgm_re_xmit_source_port = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 3), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmReXmitSourcePort.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitSourcePort.setDescription('The source port of this pgm retransmit state') wf_pgm_re_xmit_global_id = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 4), octet_string().subtype(subtypeSpec=value_size_constraint(6, 6)).setFixedLength(6)).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmReXmitGlobalId.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitGlobalId.setDescription('The Global ID this entry') wf_pgm_re_xmit_selective_seq_num = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 5), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmReXmitSelectiveSeqNum.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitSelectiveSeqNum.setDescription('The Selected Sequence number for this entry.') wf_pgm_re_xmit_parity_tg_seq_num = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 6), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmReXmitParityTgSeqNum.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitParityTgSeqNum.setDescription('The Requested Parity Tg sequence number for this entry. this value will be the same as wfPgmSessionParityTgSeq.') wf_pgm_re_xmit_req_parity_tg_count = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 7), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmReXmitReqParityTgCount.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitReqParityTgCount.setDescription('The Requested number of missing Parity packets of specific Tg. The largest counter of the received NAK will be stored in this mib.') wf_pgm_re_xmit_up_stream_cct = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 8), integer32()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmReXmitUpStreamCct.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitUpStreamCct.setDescription('The upstream interface circuit number.') wf_pgm_re_xmit_down_stream = mib_table_column((1, 3, 6, 1, 4, 1, 18, 3, 5, 28, 4, 1, 9), octet_string()).setMaxAccess('readonly') if mibBuilder.loadTexts: wfPgmReXmitDownStream.setStatus('mandatory') if mibBuilder.loadTexts: wfPgmReXmitDownStream.setDescription('list of downstream intfs for this entry. Each one is in the format of (intf_addr(u_int32) and intf_cct(u_int16)') mibBuilder.exportSymbols('Wellfleet-PGM-MIB', wfPgmIfInRdataNoSessionErrors=wfPgmIfInRdataNoSessionErrors, wfPgmSessionSource=wfPgmSessionSource, wfPgmIfInNnakNoSessionErrors=wfPgmIfInNnakNoSessionErrors, wfPgmTotalSessions=wfPgmTotalSessions, wfPgmMaxReXmitStates=wfPgmMaxReXmitStates, wfPgmIfInNaks=wfPgmIfInNaks, wfPgmIfInRdata=wfPgmIfInRdata, wfPgmSessionUniqueParityNaks=wfPgmSessionUniqueParityNaks, wfPgmSessionInParitySpms=wfPgmSessionInParitySpms, wfPgmTotalUniqueParityNaks=wfPgmTotalUniqueParityNaks, wfPgmIfNakReXmitInterval=wfPgmIfNakReXmitInterval, wfPgmSessionOutParitySpms=wfPgmSessionOutParitySpms, wfPgmIfInParityNaks=wfPgmIfInParityNaks, wfPgmIfInNnaks=wfPgmIfInNnaks, wfPgmSessionInRdataNoStateErrors=wfPgmSessionInRdataNoStateErrors, wfPgmIfInSpms=wfPgmIfInSpms, wfPgmIfTotalReXmitStates=wfPgmIfTotalReXmitStates, wfPgmSessionInNnaks=wfPgmSessionInNnaks, wfPgmState=wfPgmState, wfPgmIfInRedirectNcfs=wfPgmIfInRedirectNcfs, wfPgmSessionInNcfs=wfPgmSessionInNcfs, wfPgmIfInNnakPortErrors=wfPgmIfInNnakPortErrors, wfPgmSessionInRedirectNcfs=wfPgmSessionInRedirectNcfs, wfPgmMaxNakRate=wfPgmMaxNakRate, wfPgmSessionOutNaks=wfPgmSessionOutNaks, wfPgmSessionTotalReXmitStates=wfPgmSessionTotalReXmitStates, wfPgmIfState=wfPgmIfState, wfPgmSessionUpstreamIfCct=wfPgmSessionUpstreamIfCct, wfPgmMaxSessions=wfPgmMaxSessions, wfPgmIfTable=wfPgmIfTable, wfPgmSessionOutParityNaks=wfPgmSessionOutParityNaks, wfPgmSessionTrailEdgeSeq=wfPgmSessionTrailEdgeSeq, wfPgm=wfPgm, wfPgmIfOutSpms=wfPgmIfOutSpms, wfPgmNnakGenerate=wfPgmNnakGenerate, wfPgmTotalUniqueNaks=wfPgmTotalUniqueNaks, wfPgmSessionUniqueNaks=wfPgmSessionUniqueNaks, wfPgmIfMaxNakReXmitRate=wfPgmIfMaxNakReXmitRate, wfPgmEnable=wfPgmEnable, wfPgmIfInSpmPortErrors=wfPgmIfInSpmPortErrors, wfPgmSessionTable=wfPgmSessionTable, wfPgmSessionTotalReXmitTimedOut=wfPgmSessionTotalReXmitTimedOut, wfPgmIfEnable=wfPgmIfEnable, wfPgmSessionSourcePort=wfPgmSessionSourcePort, wfPgmSessionInNaks=wfPgmSessionInNaks, wfPgmReXmitParityTgSeqNum=wfPgmReXmitParityTgSeqNum, wfPgmIfNakRdataInterval=wfPgmIfNakRdataInterval, wfPgmIfOutParitySpms=wfPgmIfOutParitySpms, wfPgmReXmitSource=wfPgmReXmitSource, wfPgmSessionInParityRdata=wfPgmSessionInParityRdata, wfPgmCreate=wfPgmCreate, wfPgmIfInNcfPortErrors=wfPgmIfInNcfPortErrors, wfPgmReXmitEntry=wfPgmReXmitEntry, wfPgmSessionOutParityNcfs=wfPgmSessionOutParityNcfs, wfPgmIfInParityNnaks=wfPgmIfInParityNnaks, wfPgmIfOutNnaks=wfPgmIfOutNnaks, wfPgmIfOutParityRdata=wfPgmIfOutParityRdata, wfPgmIfOutNcfs=wfPgmIfOutNcfs, wfPgmIfInNcfNoSessionErrors=wfPgmIfInNcfNoSessionErrors, wfPgmSessionOutNcfs=wfPgmSessionOutNcfs, wfPgmSessionLifeTime=wfPgmSessionLifeTime, wfPgmIfInNakNoSessionErrors=wfPgmIfInNakNoSessionErrors, wfPgmSessionIncrSeq=wfPgmSessionIncrSeq, wfPgmIfInNakSeqErrors=wfPgmIfInNakSeqErrors, wfPgmReXmitGroup=wfPgmReXmitGroup, wfPgmReXmitReqParityTgCount=wfPgmReXmitReqParityTgCount, wfPgmIfEntry=wfPgmIfEntry, wfPgmIfTotalReXmitTimedOut=wfPgmIfTotalReXmitTimedOut, wfPgmIfOutRdata=wfPgmIfOutRdata, wfPgmIfCct=wfPgmIfCct, wfPgmIfInParitySpms=wfPgmIfInParitySpms, wfPgmSessionOutParityRdata=wfPgmSessionOutParityRdata, wfPgmReXmitTable=wfPgmReXmitTable, wfPgmSessionInRdata=wfPgmSessionInRdata, wfPgmSessionOutNnaks=wfPgmSessionOutNnaks, wfPgmSessionInParityNcfs=wfPgmSessionInParityNcfs, wfPgmSessionGlobalId=wfPgmSessionGlobalId, wfPgmSessionInParityNaks=wfPgmSessionInParityNaks, wfPgmReXmitUpStreamCct=wfPgmReXmitUpStreamCct, wfPgmIfOutNaks=wfPgmIfOutNaks, wfPgmSessionOutParityNnaks=wfPgmSessionOutParityNnaks, wfPgmSessionInSpms=wfPgmSessionInSpms, wfPgmIfOutParityNaks=wfPgmIfOutParityNaks, wfPgmIfNakEliminateInterval=wfPgmIfNakEliminateInterval, wfPgmIfInNcfs=wfPgmIfInNcfs, wfPgmIfInParityNcfs=wfPgmIfInParityNcfs, wfPgmSessionEntry=wfPgmSessionEntry, wfPgmIfOutParityNcfs=wfPgmIfOutParityNcfs, wfPgmSessionOutSpms=wfPgmSessionOutSpms, wfPgmSessionOutRdata=wfPgmSessionOutRdata, wfPgmDebug=wfPgmDebug, wfPgmIfInParityNakTgErrors=wfPgmIfInParityNakTgErrors, wfPgmReXmitSourcePort=wfPgmReXmitSourcePort, wfPgmReXmitSelectiveSeqNum=wfPgmReXmitSelectiveSeqNum, wfPgmReXmitGlobalId=wfPgmReXmitGlobalId, wfPgmTotalReXmitStatesTimedOut=wfPgmTotalReXmitStatesTimedOut, wfPgmSessionGroup=wfPgmSessionGroup, wfPgmIfCreate=wfPgmIfCreate, wfPgmIfUniqueParityNaks=wfPgmIfUniqueParityNaks, wfPgmSessionLeadEdgeSeq=wfPgmSessionLeadEdgeSeq, wfPgmReXmitDownStream=wfPgmReXmitDownStream, wfPgmIfUniqueNaks=wfPgmIfUniqueNaks, wfPgmSessionUpstreamAddress=wfPgmSessionUpstreamAddress, wfPgmIfOutParityNnaks=wfPgmIfOutParityNnaks, wfPgmSessionInNakSeqErrors=wfPgmSessionInNakSeqErrors, wfPgmIfInNakPortErrors=wfPgmIfInNakPortErrors, wfPgmSessionInParityNnaks=wfPgmSessionInParityNnaks, wfPgmIfInParityRdata=wfPgmIfInParityRdata, wfPgmTotalReXmitStates=wfPgmTotalReXmitStates, wfPgmIfInRdataPortErrors=wfPgmIfInRdataPortErrors)
points_str = input("Enter the lead in points: ") points_remaining_int = int(points_str) lead_calculation_float= float(points_remaining_int - 3) has_ball_str = input("Does the lead team have the ball (Yes or No): ") if has_ball_str == "Yes": lead_calculation_float=lead_calculation_float + 0.5 else: lead_calculation_float=lead_calculation_float - 0.5 if lead_calculation_float < 0: lead_calculation_float = 0 lead_calculation_float= lead_calculation_float**2 seconds_remaining_int = int(input("Enter the number of seconds remaining: ")) if lead_calculation_float > seconds_remaining_int: print("Lead is safe.") else: print("Lead is not safe.")
points_str = input('Enter the lead in points: ') points_remaining_int = int(points_str) lead_calculation_float = float(points_remaining_int - 3) has_ball_str = input('Does the lead team have the ball (Yes or No): ') if has_ball_str == 'Yes': lead_calculation_float = lead_calculation_float + 0.5 else: lead_calculation_float = lead_calculation_float - 0.5 if lead_calculation_float < 0: lead_calculation_float = 0 lead_calculation_float = lead_calculation_float ** 2 seconds_remaining_int = int(input('Enter the number of seconds remaining: ')) if lead_calculation_float > seconds_remaining_int: print('Lead is safe.') else: print('Lead is not safe.')
alien_color = 'green' if alien_color == 'green': print("You get 5 points.") else: print("\nYou get 10 points.") alien_color = 'yellow' if alien_color == 'green': print("You get 5 points.") else: print("\nYou get 10 points.")
alien_color = 'green' if alien_color == 'green': print('You get 5 points.') else: print('\nYou get 10 points.') alien_color = 'yellow' if alien_color == 'green': print('You get 5 points.') else: print('\nYou get 10 points.')
DATABASE_CONFIG = { 'uri': 'postgres://username:password@host/database' } JSREPORT_CONFIG = { 'uri': 'changeme', 'username': 'changeme', 'password': 'changeme', 'template': 'changeme' } ZIP_CONFIG = { 'name': 'flask_batch_download.zip' }
database_config = {'uri': 'postgres://username:password@host/database'} jsreport_config = {'uri': 'changeme', 'username': 'changeme', 'password': 'changeme', 'template': 'changeme'} zip_config = {'name': 'flask_batch_download.zip'}
class Prop: MAX_HOUSE = 4 def __init__(self, name, price, lien, house_price, class_count, klass, **taxes): self.name = name self.price = price self.lien = lien self.house_price = house_price self.taxes = taxes self.owner = None self.n_house = 0 self.klass = klass self.class_count = class_count def sell_to(self, player): if self.owner is None: self.owner = player player.give_money(self.price) return True print("returning false") return False def add_house(self, house_n): n_house = self.n_house + house_n enough_money = self.owner.get_money() - (house_n * self.house_price) < 0 if n_house > Prop.MAX_HOUSE: print("troppe case. Puoi comprarne massimo '{0}'".format(Prop.MAX_HOUSE - self.n_house)) elif not enough_money: print("Non hai abbastanza soldi per comprare tutte queste case") # spostare questi print nella classe home # trovare un altro meccanismo per gestire l'aggiunta di una casa. Le stringhe sono presentazione e vanno # messe altrove else: self.n_house = n_house def get_tax(self, series_count): if series_count < self.class_count: return self.taxes['none'] else: if self.n_house == 0: return self.taxes['complete'] elif self.n_house == 1: return self.taxes['one'] elif self.n_house == 2: return self.taxes['two'] elif self.n_house == 3: return self.taxes['three'] elif self.n_house == 4: return self.taxes['four'] elif self.n_house == 5: return self.taxes['hotel'] def __str__(self): return "name '{0}' price '{3}' taxes '{1}' owner '{2}'\n".format(self.name, self.taxes, self.owner, self.price) def __repr__(self): return self.__str__() class Station(Prop): def __init__(self, name, lien, price=200): super().__init__(name, price, lien, house_price=0, class_count=4, klass=50, taxes=None) def get_tax(self, series_count): if series_count == 1: return 25 if series_count == 2: return 50 if series_count == 3: return 100 if series_count == 5: return 200 class Company(Prop): def __init__(self, name, lien, price): super().__init__(name, price, lien, house_price=0, class_count=2, klass=80, taxes=None) def get_tax(self, series_count): if series_count == 1: return self.owner.roll_dice() * 4 if series_count == 2: return self.owner.roll_dice() * 10
class Prop: max_house = 4 def __init__(self, name, price, lien, house_price, class_count, klass, **taxes): self.name = name self.price = price self.lien = lien self.house_price = house_price self.taxes = taxes self.owner = None self.n_house = 0 self.klass = klass self.class_count = class_count def sell_to(self, player): if self.owner is None: self.owner = player player.give_money(self.price) return True print('returning false') return False def add_house(self, house_n): n_house = self.n_house + house_n enough_money = self.owner.get_money() - house_n * self.house_price < 0 if n_house > Prop.MAX_HOUSE: print("troppe case. Puoi comprarne massimo '{0}'".format(Prop.MAX_HOUSE - self.n_house)) elif not enough_money: print('Non hai abbastanza soldi per comprare tutte queste case') else: self.n_house = n_house def get_tax(self, series_count): if series_count < self.class_count: return self.taxes['none'] elif self.n_house == 0: return self.taxes['complete'] elif self.n_house == 1: return self.taxes['one'] elif self.n_house == 2: return self.taxes['two'] elif self.n_house == 3: return self.taxes['three'] elif self.n_house == 4: return self.taxes['four'] elif self.n_house == 5: return self.taxes['hotel'] def __str__(self): return "name '{0}' price '{3}' taxes '{1}' owner '{2}'\n".format(self.name, self.taxes, self.owner, self.price) def __repr__(self): return self.__str__() class Station(Prop): def __init__(self, name, lien, price=200): super().__init__(name, price, lien, house_price=0, class_count=4, klass=50, taxes=None) def get_tax(self, series_count): if series_count == 1: return 25 if series_count == 2: return 50 if series_count == 3: return 100 if series_count == 5: return 200 class Company(Prop): def __init__(self, name, lien, price): super().__init__(name, price, lien, house_price=0, class_count=2, klass=80, taxes=None) def get_tax(self, series_count): if series_count == 1: return self.owner.roll_dice() * 4 if series_count == 2: return self.owner.roll_dice() * 10
#create file myaperture.dat needed for source optimization f = open("myaperture.dat",'w') f.write(" 50.0 -0.002 0.002 -0.002 0.002") f.close() print("File written to disk: myaperture.dat")
f = open('myaperture.dat', 'w') f.write(' 50.0 -0.002 0.002 -0.002 0.002') f.close() print('File written to disk: myaperture.dat')
# -*- encoding:utf-8 -*- # index rule: # 3 ------6------- 2 # # 7 ------ ------- 5 # # 0 ------4------- 1 # Stores the triangle values raw_trigs = [ [], [(0,7,4)], [(4,5,1)], [(0,5,1),(0,7,5)], [(5,6,2)], [(0,7,4), (4,7,5), (7,6,5), (5,6,2)], [(1,4,6), (1,6,2)], [(1,0,7), (1,7,6), (1,6,2)], [(7,3,6)], [(0,3,4), (4,3,6)], [(1,4,5), (4,7,5), (5,7,6), (7,3,6)], [(0,5,1), (0,6,5), (0,3,6)], [(7,3,5), (5,3,2)], [(0,3,4), (4,3,5), (5,3,2)], [(7,3,2), (4,7,2), (1,4,2)], [(0,2,1), (0,3,2)], ] index_to_pos = [ [0,0], [2,0], [2,2], [0,2], [1,0], [2,1], [1,2], [0,1], ] class Worker(object): def __init__(self): self.rt_verts = [] self.rt_trigs = [] self.rt_flex_verts = [] def execute(self): for case, trig_list in enumerate(raw_trigs): self.process_case(case, trig_list) worker.format_csharp("MarchingSquareData.txt") def process_case(self, case, trig_list_raw): vi_list = [] vpos_list = [] trig_list = [] flex_list = [] for trig_raw in trig_list_raw: # print trig_raw for vi in trig_raw: # record vert index if not vi in vi_list: vi_list.append(vi) vpos_list.append(self.get_vert_pos(vi)) # record lerp parents if vi >= 4: parents = self.get_lerp_parents(case, vi) flex_list.append(parents) else: flex_list.append(None) # record triangle trig_list.append(vi_list.index(vi)) self.rt_verts.append(vpos_list) self.rt_trigs.append(trig_list) self.rt_flex_verts.append(flex_list) def get_vert_pos(self, index): return index_to_pos[index] def get_lerp_parents(self, case, index): if index < 4: return a, b = (index-4)%4, (index-3)%4 cell_values = self.get_case_cell_values(case) if cell_values[a] > cell_values[b]: return b, a return a, b def get_case_cell_values(self, case): return case & 1, case >> 1 & 1, case >> 2 & 1, case >> 3 & 1 def format_csharp(self, filename): msg = "" template = "\tnew int[%d] {%s},\n" anchor_template = "\tnew int[%d][] {%s},\n" with open(filename, 'w') as f: # Write cell vertices f.write("\n\npublic static int[][] cellVertPos = new int[][]\n{\n") msg = "" for index in xrange(4): msg += template % (2, "%d,%d" % tuple(index_to_pos[index])) f.write(msg) f.write("};") # Write vertices f.write("\n\npublic static int[][] vertices = new int[][]\n{\n") msg = "" for vert_list in self.rt_verts: vert_str = "" for vert in vert_list: vert_str += "%d,%d," % tuple(vert) msg += template % (len(vert_list) * 2, vert_str) f.write(msg) f.write("};") # Write triangles f.write("\n\npublic static int[][] triangles = new int[][]\n{\n") msg = "" for trig_list in self.rt_trigs: trig_str = "" for trig_index in trig_list: trig_str += "%d," % trig_index msg += template % (len(trig_list), trig_str) f.write(msg) f.write("};") # Write flexible vertices f.write("\n\npublic static int[][][] anchors = new int[][][]\n{\n") msg = "" for flex_list in self.rt_flex_verts: flex_str = "" for parents in flex_list: if parents is not None: flex_str += "new int[2]{%d,%d}," % parents else: flex_str += "null," msg += anchor_template % (len(flex_list), flex_str) f.write(msg) f.write("};") worker = Worker() worker.execute() # print worker.rt_verts # print worker.rt_trigs # print worker.rt_flex_verts
raw_trigs = [[], [(0, 7, 4)], [(4, 5, 1)], [(0, 5, 1), (0, 7, 5)], [(5, 6, 2)], [(0, 7, 4), (4, 7, 5), (7, 6, 5), (5, 6, 2)], [(1, 4, 6), (1, 6, 2)], [(1, 0, 7), (1, 7, 6), (1, 6, 2)], [(7, 3, 6)], [(0, 3, 4), (4, 3, 6)], [(1, 4, 5), (4, 7, 5), (5, 7, 6), (7, 3, 6)], [(0, 5, 1), (0, 6, 5), (0, 3, 6)], [(7, 3, 5), (5, 3, 2)], [(0, 3, 4), (4, 3, 5), (5, 3, 2)], [(7, 3, 2), (4, 7, 2), (1, 4, 2)], [(0, 2, 1), (0, 3, 2)]] index_to_pos = [[0, 0], [2, 0], [2, 2], [0, 2], [1, 0], [2, 1], [1, 2], [0, 1]] class Worker(object): def __init__(self): self.rt_verts = [] self.rt_trigs = [] self.rt_flex_verts = [] def execute(self): for (case, trig_list) in enumerate(raw_trigs): self.process_case(case, trig_list) worker.format_csharp('MarchingSquareData.txt') def process_case(self, case, trig_list_raw): vi_list = [] vpos_list = [] trig_list = [] flex_list = [] for trig_raw in trig_list_raw: for vi in trig_raw: if not vi in vi_list: vi_list.append(vi) vpos_list.append(self.get_vert_pos(vi)) if vi >= 4: parents = self.get_lerp_parents(case, vi) flex_list.append(parents) else: flex_list.append(None) trig_list.append(vi_list.index(vi)) self.rt_verts.append(vpos_list) self.rt_trigs.append(trig_list) self.rt_flex_verts.append(flex_list) def get_vert_pos(self, index): return index_to_pos[index] def get_lerp_parents(self, case, index): if index < 4: return (a, b) = ((index - 4) % 4, (index - 3) % 4) cell_values = self.get_case_cell_values(case) if cell_values[a] > cell_values[b]: return (b, a) return (a, b) def get_case_cell_values(self, case): return (case & 1, case >> 1 & 1, case >> 2 & 1, case >> 3 & 1) def format_csharp(self, filename): msg = '' template = '\tnew int[%d] {%s},\n' anchor_template = '\tnew int[%d][] {%s},\n' with open(filename, 'w') as f: f.write('\n\npublic static int[][] cellVertPos = new int[][]\n{\n') msg = '' for index in xrange(4): msg += template % (2, '%d,%d' % tuple(index_to_pos[index])) f.write(msg) f.write('};') f.write('\n\npublic static int[][] vertices = new int[][]\n{\n') msg = '' for vert_list in self.rt_verts: vert_str = '' for vert in vert_list: vert_str += '%d,%d,' % tuple(vert) msg += template % (len(vert_list) * 2, vert_str) f.write(msg) f.write('};') f.write('\n\npublic static int[][] triangles = new int[][]\n{\n') msg = '' for trig_list in self.rt_trigs: trig_str = '' for trig_index in trig_list: trig_str += '%d,' % trig_index msg += template % (len(trig_list), trig_str) f.write(msg) f.write('};') f.write('\n\npublic static int[][][] anchors = new int[][][]\n{\n') msg = '' for flex_list in self.rt_flex_verts: flex_str = '' for parents in flex_list: if parents is not None: flex_str += 'new int[2]{%d,%d},' % parents else: flex_str += 'null,' msg += anchor_template % (len(flex_list), flex_str) f.write(msg) f.write('};') worker = worker() worker.execute()
make = "Ford" model = "Everest" def start_engine(): print (f'{make} {model} engine started')
make = 'Ford' model = 'Everest' def start_engine(): print(f'{make} {model} engine started')
class Resource(): def __init__(self, path): self.path = path def __str__(self): return '-i {}'.format(self.path) class Resources(list): def add(self, path): self.append(Resource(path)) def append(self, resource): resource.number = len(self) super().append(resource) def __delitem__(self, index): for resource in self[index:]: resource.number -= 1 super().__delitem__(index) def __str__(self): return ' '.join(str(r) for r in self)
class Resource: def __init__(self, path): self.path = path def __str__(self): return '-i {}'.format(self.path) class Resources(list): def add(self, path): self.append(resource(path)) def append(self, resource): resource.number = len(self) super().append(resource) def __delitem__(self, index): for resource in self[index:]: resource.number -= 1 super().__delitem__(index) def __str__(self): return ' '.join((str(r) for r in self))
# Python - 3.6.0 Test.describe('Basic tests') names = ['john', 'matt', 'alex', 'cam'] ages = [16, 25, 57, 39] for name, age in zip(names, ages): person = Person(name, age) Test.it(f'Testing for {name} and {age}') Test.assert_equals(person.info, f'{name}s age is {age}')
Test.describe('Basic tests') names = ['john', 'matt', 'alex', 'cam'] ages = [16, 25, 57, 39] for (name, age) in zip(names, ages): person = person(name, age) Test.it(f'Testing for {name} and {age}') Test.assert_equals(person.info, f'{name}s age is {age}')
#Floating loop first_list = list(range(10)) for i in first_list: first_list[i] = float(first_list[i]) print(first_list)
first_list = list(range(10)) for i in first_list: first_list[i] = float(first_list[i]) print(first_list)
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"win": "game.ipynb", "lose": "game.ipynb"} modules = ["game.py"] doc_url = "https://thecharlieblake.github.io/solitairenet/" git_url = "https://github.com/thecharlieblake/solitairenet/tree/master/" def custom_doc_links(name): return None
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'win': 'game.ipynb', 'lose': 'game.ipynb'} modules = ['game.py'] doc_url = 'https://thecharlieblake.github.io/solitairenet/' git_url = 'https://github.com/thecharlieblake/solitairenet/tree/master/' def custom_doc_links(name): return None
def smooth(dataset): dataset_length = len(dataset) dataset_extra_weights = [ItemWeight(*x) for x in dataset] def get_next(): if dataset_length == 0: return None if dataset_length == 1: return dataset[0][0] total_weight = 0 result = None for extra in dataset_extra_weights: extra.current_weight += extra.effective_weight total_weight += extra.effective_weight if extra.effective_weight < extra.weight: extra.effective_weight += 1 if not result or result.current_weight < extra.current_weight: result = extra if not result: # this should be unreachable, but check anyway raise RuntimeError result.current_weight -= total_weight return result.key return get_next class ItemWeight: __slots__ = ('key', 'weight', 'current_weight', 'effective_weight') def __init__(self, key, weight): self.key = key self.weight = weight self.current_weight = 0 self.effective_weight = weight
def smooth(dataset): dataset_length = len(dataset) dataset_extra_weights = [item_weight(*x) for x in dataset] def get_next(): if dataset_length == 0: return None if dataset_length == 1: return dataset[0][0] total_weight = 0 result = None for extra in dataset_extra_weights: extra.current_weight += extra.effective_weight total_weight += extra.effective_weight if extra.effective_weight < extra.weight: extra.effective_weight += 1 if not result or result.current_weight < extra.current_weight: result = extra if not result: raise RuntimeError result.current_weight -= total_weight return result.key return get_next class Itemweight: __slots__ = ('key', 'weight', 'current_weight', 'effective_weight') def __init__(self, key, weight): self.key = key self.weight = weight self.current_weight = 0 self.effective_weight = weight
# O(nlogn) time | O(n) space def mergeSort(array): if len(array) <= 1: return array subarray = array[:] mergeSortHelper(array, 0, len(array)-1) return array def mergeSortHelper(array, l, r): if l == r: return m = (l + r) // 2 mergeSortHelper(array, l, m) mergeSortHelper(array, m + 1, r) merge(array, l, m, r) def merge(arr, l, m, r): subarray = arr[:] i = l j = m + 1 k = l while i <= m and j <= r: if subarray[i] <= subarray[j]: arr[k] = subarray[i] i += 1 else: arr[k] = subarray[j] j += 1 k += 1 while i <= m: arr[k] = subarray[i] i += 1 k += 1 while j <= r: arr[k] = subarray[j] j += 1 k += 1
def merge_sort(array): if len(array) <= 1: return array subarray = array[:] merge_sort_helper(array, 0, len(array) - 1) return array def merge_sort_helper(array, l, r): if l == r: return m = (l + r) // 2 merge_sort_helper(array, l, m) merge_sort_helper(array, m + 1, r) merge(array, l, m, r) def merge(arr, l, m, r): subarray = arr[:] i = l j = m + 1 k = l while i <= m and j <= r: if subarray[i] <= subarray[j]: arr[k] = subarray[i] i += 1 else: arr[k] = subarray[j] j += 1 k += 1 while i <= m: arr[k] = subarray[i] i += 1 k += 1 while j <= r: arr[k] = subarray[j] j += 1 k += 1
# This is the custom function interface. # You should not implement it, or speculate about its implementation class CustomFunction: # Returns f(x, y) for any given positive integers x and y. # Note that f(x, y) is increasing with respect to both x and y. # i.e. f(x, y) < f(x + 1, y), f(x, y) < f(x, y + 1) def f(self, x, y): return x + y class Solution: def findSolution(self, customfunction, z: int): ret = [] i = 1 while customfunction.f(i, 1) <= z: j = 1 while True: if customfunction.f(i, j) == z: ret.append([i, j]) break elif customfunction.f(i, j) > z: break else: j += 1 i += 1 return ret cf = CustomFunction() slu = Solution() print(slu.findSolution(CustomFunction(), 5))
class Customfunction: def f(self, x, y): return x + y class Solution: def find_solution(self, customfunction, z: int): ret = [] i = 1 while customfunction.f(i, 1) <= z: j = 1 while True: if customfunction.f(i, j) == z: ret.append([i, j]) break elif customfunction.f(i, j) > z: break else: j += 1 i += 1 return ret cf = custom_function() slu = solution() print(slu.findSolution(custom_function(), 5))
class UndergroundSystem: def __init__(self): self.count = defaultdict(int) self.time = defaultdict(int) self.traveling = dict() def checkIn(self, id: int, stationName: str, t: int) -> None: self.traveling[id] = (stationName, t) def checkOut(self, id: int, stationName: str, t: int) -> None: (prev_station, prev_t) = self.traveling[id] del self.traveling[id] key = (prev_station, stationName) self.count[key] += 1 self.time[key] += (t-prev_t) def getAverageTime(self, startStation: str, endStation: str) -> float: key = (startStation, endStation) return self.time[key] / self.count[key] # Your UndergroundSystem object will be instantiated and called as such: # obj = UndergroundSystem() # obj.checkIn(id,stationName,t) # obj.checkOut(id,stationName,t) # param_3 = obj.getAverageTime(startStation,endStation)
class Undergroundsystem: def __init__(self): self.count = defaultdict(int) self.time = defaultdict(int) self.traveling = dict() def check_in(self, id: int, stationName: str, t: int) -> None: self.traveling[id] = (stationName, t) def check_out(self, id: int, stationName: str, t: int) -> None: (prev_station, prev_t) = self.traveling[id] del self.traveling[id] key = (prev_station, stationName) self.count[key] += 1 self.time[key] += t - prev_t def get_average_time(self, startStation: str, endStation: str) -> float: key = (startStation, endStation) return self.time[key] / self.count[key]
def test_clear_images(client, seeder, app, utils): user_id, admin_unit_id = seeder.setup_base() image_id = seeder.upsert_default_image() url = utils.get_image_url_for_id(image_id) utils.get_ok(url) runner = app.test_cli_runner() result = runner.invoke(args=["cache", "clear-images"]) assert "Done." in result.output
def test_clear_images(client, seeder, app, utils): (user_id, admin_unit_id) = seeder.setup_base() image_id = seeder.upsert_default_image() url = utils.get_image_url_for_id(image_id) utils.get_ok(url) runner = app.test_cli_runner() result = runner.invoke(args=['cache', 'clear-images']) assert 'Done.' in result.output
def binary_slow(n): assert n>=0 bits = [] while n: bits.append('01'[n&1]) n >>= 1 bits.reverse() return ''.join(bits) or '0'
def binary_slow(n): assert n >= 0 bits = [] while n: bits.append('01'[n & 1]) n >>= 1 bits.reverse() return ''.join(bits) or '0'
# Containers for txid sequences start with this string. CONTAINER_PREFIX = 'txids' # Transaction ID sequence nodes start with this string. COUNTER_NODE_PREFIX = 'tx' # ZooKeeper stores the sequence counter as a signed 32-bit integer. MAX_SEQUENCE_COUNTER = 2 ** 31 - 1 # The name of the node used for manually setting a txid offset. OFFSET_NODE = 'txid_offset'
container_prefix = 'txids' counter_node_prefix = 'tx' max_sequence_counter = 2 ** 31 - 1 offset_node = 'txid_offset'
# Solution 1 - recursion # O(log(n)) time / O(log(n)) space def binarySearch1(array, target): return binarySearchHelper1(array, target, 0, len(array) - 1) def binarySearchHelper1(array, target, left, right): if left > right: return -1 middle = (left + right) // 2 potentialMatch = array[middle] if target == potentialMatch: return middle elif target < potentialMatch: return binarySearchHelper1(array, target, left, middle - 1) else: return binarySearchHelper1(array, target, middle + 1, right) # Solution 2 - iteration # O(log(n)) time / O(1) space def binarySearch2(array, target): return binarySearchHelper1(array, target, 0, len(array) - 1) def binarySearchHelper2(array, target, left, right): while left <= right: middle = (left + right) // 2 potentialMatch = array[middle] if target == potentialMatch: return middle elif target < potentialMatch: right = middle - 1 else: left = middle + 1 return -1
def binary_search1(array, target): return binary_search_helper1(array, target, 0, len(array) - 1) def binary_search_helper1(array, target, left, right): if left > right: return -1 middle = (left + right) // 2 potential_match = array[middle] if target == potentialMatch: return middle elif target < potentialMatch: return binary_search_helper1(array, target, left, middle - 1) else: return binary_search_helper1(array, target, middle + 1, right) def binary_search2(array, target): return binary_search_helper1(array, target, 0, len(array) - 1) def binary_search_helper2(array, target, left, right): while left <= right: middle = (left + right) // 2 potential_match = array[middle] if target == potentialMatch: return middle elif target < potentialMatch: right = middle - 1 else: left = middle + 1 return -1
# Uebungsblatt 2 # Uebung 1 i = 28 f = 28.0 print(i, id(i), type(i)) print(f, id(f), type(f)) # Uebung 2 i = 28.0 f = 28.0 print(i, id(i), type(i)) print(f, id(f), type(f)) # Uebung 3 s = "Hello" s2 = s print(s, id(s), s2, id(s2)) s += " World" print(s, id(s), s2, id(s2)) # Uebung 4 m = ['a', 'b', 'd', 'e', 'f'] print(m, id(m)) m[0]='A' print(m, id(m)) # Uebung 5 m2 = m print(m, id(m), m2, id(m2)) m += 'g' print(m, id(m), m2, id(m2)) # Uebung 6 t = (1, 2, [31, 32], 4) t2 = t print(t, id(t), t2, id(t2)) # t[0] = 'X' # t[2,0] = 'X' # TypeError: 'tuple' object does not support item assignment # Uebung 7 t += 5, print(t, id(t), t2, id(t2)) # Uebung 8 del t # print(t, id(t), t2, id(t2)) # NameError: name 't' is not defined print(t2, id(t2)) del t2 # print(t2, id(t2)) # NameError: name 't2' is not defined # Uebung 9 x = 5 y = '5' # z = x + y # TypeError: unsupported operand type(s) for +: 'int' and 'str'
i = 28 f = 28.0 print(i, id(i), type(i)) print(f, id(f), type(f)) i = 28.0 f = 28.0 print(i, id(i), type(i)) print(f, id(f), type(f)) s = 'Hello' s2 = s print(s, id(s), s2, id(s2)) s += ' World' print(s, id(s), s2, id(s2)) m = ['a', 'b', 'd', 'e', 'f'] print(m, id(m)) m[0] = 'A' print(m, id(m)) m2 = m print(m, id(m), m2, id(m2)) m += 'g' print(m, id(m), m2, id(m2)) t = (1, 2, [31, 32], 4) t2 = t print(t, id(t), t2, id(t2)) t += (5,) print(t, id(t), t2, id(t2)) del t print(t2, id(t2)) del t2 x = 5 y = '5'
n, m = map(int, input().split()) f = list(int(i) for i in input().split()) f.sort() # formula -> f[i+n-1] - f[i] ans = 10**9 for i in range(m-n+1): ans = min(ans, f[i+n-1] - f[i]) print(ans)
(n, m) = map(int, input().split()) f = list((int(i) for i in input().split())) f.sort() ans = 10 ** 9 for i in range(m - n + 1): ans = min(ans, f[i + n - 1] - f[i]) print(ans)
ENDPOINT_PATH = 'foobar' BOOTSTRAP_SERVERS = 'localhost:9092' TOPIC_RAW_REQUESTS = 'test.raw_requests' TOPIC_PARSED_DATA = 'test.parsed_data' USERNAME = None PASSWORD = None SASL_MECHANISM = None SECURITY_PROTOCOL = 'PLAINTEXT' # Use these when trying with FVH servers # SASL_MECHANISM = "PLAIN" # SECURITY_PROTOCOL = "SASL_SSL"
endpoint_path = 'foobar' bootstrap_servers = 'localhost:9092' topic_raw_requests = 'test.raw_requests' topic_parsed_data = 'test.parsed_data' username = None password = None sasl_mechanism = None security_protocol = 'PLAINTEXT'
# input print('What is my favourite food?') input_guess = input("Guess? ") # response while input_guess != 'electricity': print("Not even close.") input_guess = input("Guess? ") print("You guessed it! Buzzzz")
print('What is my favourite food?') input_guess = input('Guess? ') while input_guess != 'electricity': print('Not even close.') input_guess = input('Guess? ') print('You guessed it! Buzzzz')
# Use enumerate() and other skills to return the count of the number of items in # the list whose value equals its index. def count_match_index(numbers): return len([number for index, number in enumerate(numbers) if index == number]) result = count_match_index([0, 2, 2, 1, 5, 5, 6, 10]) print(result)
def count_match_index(numbers): return len([number for (index, number) in enumerate(numbers) if index == number]) result = count_match_index([0, 2, 2, 1, 5, 5, 6, 10]) print(result)
__title__ = 'elasticsearch-cli' __version__ = '0.0.1' __author__ = 'nevercaution' __license__ = 'Apache v2'
__title__ = 'elasticsearch-cli' __version__ = '0.0.1' __author__ = 'nevercaution' __license__ = 'Apache v2'
## Largest 5 digit number in a series ## 7 kyu ## https://www.codewars.com/kata/51675d17e0c1bed195000001 def solution(digits): biggest = 0 for index in range(len(digits) - 4): if int(digits[index:index+5]) > biggest: biggest = int(digits[index:index+5]) return biggest
def solution(digits): biggest = 0 for index in range(len(digits) - 4): if int(digits[index:index + 5]) > biggest: biggest = int(digits[index:index + 5]) return biggest
{ "targets": [ { "target_name": "game", "sources": [ "game.cpp" ] } ] }
{'targets': [{'target_name': 'game', 'sources': ['game.cpp']}]}
class Stack: def __init__(self,max_size=4): self.max_size = max_size self.stk = [None]*max_size self.last_pos = -1 def pop(self): if self.last_pos < 0: raise IndexError() temp = self.stk[self.last_pos] self.stk[self.last_pos]=None if self.last_pos >=0: self.last_pos-=1 return temp def push(self,value): if self.last_pos > self.max_size: raise IndexError() if self.last_pos<0: self.last_pos+=1 self.stk[self.last_pos]=value return self.last_pos+=1 self.stk[self.last_pos]=value def top(self): return self.stk[self.last_pos] def test_stack(): stk = Stack() stk.push(1) stk.push(2) stk.push(3) stk.push(4) # print("********************") # stk.push(5) print("********************") print(stk.pop()) print(stk.top()) print(stk.pop()) print(stk.top()) print(stk.pop()) print(stk.top()) print(stk.pop()) print(stk.pop()) if __name__ == "__main__": test_stack()
class Stack: def __init__(self, max_size=4): self.max_size = max_size self.stk = [None] * max_size self.last_pos = -1 def pop(self): if self.last_pos < 0: raise index_error() temp = self.stk[self.last_pos] self.stk[self.last_pos] = None if self.last_pos >= 0: self.last_pos -= 1 return temp def push(self, value): if self.last_pos > self.max_size: raise index_error() if self.last_pos < 0: self.last_pos += 1 self.stk[self.last_pos] = value return self.last_pos += 1 self.stk[self.last_pos] = value def top(self): return self.stk[self.last_pos] def test_stack(): stk = stack() stk.push(1) stk.push(2) stk.push(3) stk.push(4) print('********************') print(stk.pop()) print(stk.top()) print(stk.pop()) print(stk.top()) print(stk.pop()) print(stk.top()) print(stk.pop()) print(stk.pop()) if __name__ == '__main__': test_stack()
DEFAULT_SERVER_HOST = "localhost" DEFAULT_SERVER_PORT = 11211 DEFAULT_POOL_MINSIZE = 2 DEFAULT_POOL_MAXSIZE = 5 DEFAULT_TIMEOUT = 1 DEFAULT_MAX_KEY_LENGTH = 250 DEFAULT_MAX_VALUE_LENGTH = 1024 * 1024 # 1 megabyte STORED = b"STORED\r\n" NOT_STORED = b"NOT_STORED\r\n" EXISTS = b"EXISTS\r\n" NOT_FOUND = b"NOT_FOUND\r\n" DELETED = b"DELETED\r\n" TOUCHED = b"TOUCHED\r\n" END = b"END\r\n" VERSION = b"VERSION" OK = b"OK\r\n"
default_server_host = 'localhost' default_server_port = 11211 default_pool_minsize = 2 default_pool_maxsize = 5 default_timeout = 1 default_max_key_length = 250 default_max_value_length = 1024 * 1024 stored = b'STORED\r\n' not_stored = b'NOT_STORED\r\n' exists = b'EXISTS\r\n' not_found = b'NOT_FOUND\r\n' deleted = b'DELETED\r\n' touched = b'TOUCHED\r\n' end = b'END\r\n' version = b'VERSION' ok = b'OK\r\n'
def median(pool): copy = sorted(pool) size = len(copy) if size % 2 == 1: return int(copy[int((size-1) / 2)]) else: return (int(copy[int((size) / 2)-1]) + int(copy[int(size / 2)])) / 2
def median(pool): copy = sorted(pool) size = len(copy) if size % 2 == 1: return int(copy[int((size - 1) / 2)]) else: return (int(copy[int(size / 2) - 1]) + int(copy[int(size / 2)])) / 2
# Python program to calculate C(n, k) # Returns value of Binomial Coefficient # C(n, k) def binomialCoefficient(n, k): # since C(n, k) = C(n, n - k) if(k > n - k): k = n - k # initialize result res = 1 # Calculate value of # [n * (n-1) *---* (n-k + 1)] / [k * (k-1) *----* 1] for i in range(k): res = res * (n - i) res = res / (i + 1) return res # Driver program to test above function n,k= map(int, input().split()) res = binomialCoefficient(n, k) print("Value of C(% d, % d) is % d" %(n, k, res)) ''' TEST CASES Input = 5 3 Output = Value of C( 5, 3) is 10 Input = 8 1 Output = Value of C( 8, 1) is 8 '''
def binomial_coefficient(n, k): if k > n - k: k = n - k res = 1 for i in range(k): res = res * (n - i) res = res / (i + 1) return res (n, k) = map(int, input().split()) res = binomial_coefficient(n, k) print('Value of C(% d, % d) is % d' % (n, k, res)) '\nTEST CASES\n\nInput =\n5 3\nOutput = \nValue of C( 5, 3) is 10\n\nInput =\n8 1\nOutput = \nValue of C( 8, 1) is 8\n\n'
#does array have duplicate entries a=[1,2,3,4,5,1,7] i=1 j=1 for num in a: for ab in range(len(a)): if num==a[i]: print("duplicate found! ",num,"is = a[",i,"]") else: print(num,"is not = a[",i,"]" ) if i>4: break else: i=i+1 i=0
a = [1, 2, 3, 4, 5, 1, 7] i = 1 j = 1 for num in a: for ab in range(len(a)): if num == a[i]: print('duplicate found! ', num, 'is = a[', i, ']') else: print(num, 'is not = a[', i, ']') if i > 4: break else: i = i + 1 i = 0
{ 'name': 'To-Do Kanban board', 'description': 'Kanban board to manage to-do tasks.', 'author': 'Daniel Reis', 'depends': ['todo_ui'], 'data': ['views/todo_view.xml'], }
{'name': 'To-Do Kanban board', 'description': 'Kanban board to manage to-do tasks.', 'author': 'Daniel Reis', 'depends': ['todo_ui'], 'data': ['views/todo_view.xml']}
# play sound file = "HappyBirthday.mp3" print('playing sound using native player') os.system("afplay " + file)
file = 'HappyBirthday.mp3' print('playing sound using native player') os.system('afplay ' + file)
v = 18 _v = 56 def f(): pass def _f(): pass class MyClass(object): pass class _MyClass(object): pass
v = 18 _v = 56 def f(): pass def _f(): pass class Myclass(object): pass class _Myclass(object): pass
def solve_single_lin(opt_x_s): ''' solve one opt_x[s] ''' opt_x_s.solve(solver='MOSEK', verbose = True) return opt_x_s
def solve_single_lin(opt_x_s): """ solve one opt_x[s] """ opt_x_s.solve(solver='MOSEK', verbose=True) return opt_x_s
pkgname = "xsetroot" pkgver = "1.1.2" pkgrel = 0 build_style = "gnu_configure" hostmakedepends = ["pkgconf"] makedepends = [ "xbitmaps", "libxmu-devel", "libxrender-devel", "libxfixes-devel", "libxcursor-devel" ] pkgdesc = "X root window parameter setting utility" maintainer = "q66 <q66@chimera-linux.org>" license = "MIT" url = "https://xorg.freedesktop.org" source = f"$(XORG_SITE)/app/{pkgname}-{pkgver}.tar.bz2" sha256 = "10c442ba23591fb5470cea477a0aa5f679371f4f879c8387a1d9d05637ae417c" def post_install(self): self.install_license("COPYING")
pkgname = 'xsetroot' pkgver = '1.1.2' pkgrel = 0 build_style = 'gnu_configure' hostmakedepends = ['pkgconf'] makedepends = ['xbitmaps', 'libxmu-devel', 'libxrender-devel', 'libxfixes-devel', 'libxcursor-devel'] pkgdesc = 'X root window parameter setting utility' maintainer = 'q66 <q66@chimera-linux.org>' license = 'MIT' url = 'https://xorg.freedesktop.org' source = f'$(XORG_SITE)/app/{pkgname}-{pkgver}.tar.bz2' sha256 = '10c442ba23591fb5470cea477a0aa5f679371f4f879c8387a1d9d05637ae417c' def post_install(self): self.install_license('COPYING')
class Item: def __init__(self, block_id, count, damage, data): self.block_id = block_id self.count = count self.damage = damage self.data = data def __str__(self): return 'block: {:3d}, count: {:2d}, damage: {}'.format(self.block_id, self.count, self.damage)
class Item: def __init__(self, block_id, count, damage, data): self.block_id = block_id self.count = count self.damage = damage self.data = data def __str__(self): return 'block: {:3d}, count: {:2d}, damage: {}'.format(self.block_id, self.count, self.damage)
BAZEL_VERSION_SHA256S = { "0.14.1": "7b14e4fc76bf85c4abf805833e99f560f124a3b96d56e0712c693e94e19d1376", "0.15.0": "7f6748b48a7ea6bdf00b0e1967909ce2181ebe6f377638aa454a7d09a0e3ea7b", "0.15.2": "13eae0f09565cf17fc1c9ce1053b9eac14c11e726a2215a79ebaf5bdbf435241", "0.16.1": "17ab70344645359fd4178002f367885e9019ae7507c9c1ade8220f3628383444", } # This is the map from supported Bazel versions to the Bazel version used to # generate the published toolchain configs that the former should be used with. # This is needed because, in most cases, patch updates in Bazel do not result in # changes in toolchain configs, so we do not publish duplicated toolchain # configs. So, for example, Bazel 0.15.2 should still use published toolchain # configs generated with Bazel 0.15.0. BAZEL_VERSION_TO_CONFIG_VERSION = { "0.14.1": "0.14.1", "0.15.0": "0.15.0", "0.15.2": "0.15.0", "0.16.1": "0.16.1", }
bazel_version_sha256_s = {'0.14.1': '7b14e4fc76bf85c4abf805833e99f560f124a3b96d56e0712c693e94e19d1376', '0.15.0': '7f6748b48a7ea6bdf00b0e1967909ce2181ebe6f377638aa454a7d09a0e3ea7b', '0.15.2': '13eae0f09565cf17fc1c9ce1053b9eac14c11e726a2215a79ebaf5bdbf435241', '0.16.1': '17ab70344645359fd4178002f367885e9019ae7507c9c1ade8220f3628383444'} bazel_version_to_config_version = {'0.14.1': '0.14.1', '0.15.0': '0.15.0', '0.15.2': '0.15.0', '0.16.1': '0.16.1'}
def censor(text, word): bigstring = text.split() print (bigstring) words = "" " ".join(bigstring) return bigstring print (censor("hello hi hey", "hi"))
def censor(text, word): bigstring = text.split() print(bigstring) words = '' ' '.join(bigstring) return bigstring print(censor('hello hi hey', 'hi'))
config = { 'api_root': 'https://library.cca.edu/api/v1', 'client_id': 'abcedfg-123445678', 'client_secret': 'abcedfg-123445678', }
config = {'api_root': 'https://library.cca.edu/api/v1', 'client_id': 'abcedfg-123445678', 'client_secret': 'abcedfg-123445678'}
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations ######################################################################### ## Customize your APP title, subtitle and menus here ######################################################################### response.logo = A(B('Placement portal'),_class="brand", _id="web2py-logo") response.title = request.application.replace('_',' ').title() response.subtitle = '' ## read more at http://dev.w3.org/html5/markup/meta.name.html response.meta.author = 'Your Name <you@example.com>' response.meta.description = 'a cool new app' response.meta.keywords = 'web2py, python, framework' response.meta.generator = 'Web2py Web Framework' ## your http://google.com/analytics id response.google_analytics_id = None ######################################################################### ## this is the main application menu add/remove items as required ######################################################################### if auth.has_membership('student_group') and not auth.has_membership('spc_group'): response.menu= [ (T('Home'), False, URL('default', 'index'), []), (T('Apply'), False, URL('s_controller','apply_for'),[] ),(T('Spc'), False,URL('s_controller','spc'),[]) ] elif auth.has_membership('student_group') and auth.has_membership('spc_group'): response.menu= [ (T('Home'), False, URL('default', 'index'), []), (T('Apply'), False, URL('s_controller','apply_for'),[] ),(T('View Student Deatils'), False, URL('s_controller','spc_view'),[] )] elif auth.has_membership('company_group'): response.menu= [ (T('Home'), False, URL('default', 'index'), []), (T('New Posting'), False,URL('c_controller','posting'),[]), (T('View Posting'), False,URL('c_controller','view_posting'),[]) ] elif auth.has_membership('TPO'): response.menu = [ (T('Home'), False, URL('default', 'index'), []), ] else: response.menu = [ (T('Home'), False, URL('default', 'index'), []), (T('Student Register'), False, URL('s_controller', 'reg_s'), []), (T('Company Register'), False, URL('c_controller', 'reg_c'), []) ] DEVELOPMENT_MENU = True if "auth" in locals(): auth.wikimenu()
response.logo = a(b('Placement portal'), _class='brand', _id='web2py-logo') response.title = request.application.replace('_', ' ').title() response.subtitle = '' response.meta.author = 'Your Name <you@example.com>' response.meta.description = 'a cool new app' response.meta.keywords = 'web2py, python, framework' response.meta.generator = 'Web2py Web Framework' response.google_analytics_id = None if auth.has_membership('student_group') and (not auth.has_membership('spc_group')): response.menu = [(t('Home'), False, url('default', 'index'), []), (t('Apply'), False, url('s_controller', 'apply_for'), []), (t('Spc'), False, url('s_controller', 'spc'), [])] elif auth.has_membership('student_group') and auth.has_membership('spc_group'): response.menu = [(t('Home'), False, url('default', 'index'), []), (t('Apply'), False, url('s_controller', 'apply_for'), []), (t('View Student Deatils'), False, url('s_controller', 'spc_view'), [])] elif auth.has_membership('company_group'): response.menu = [(t('Home'), False, url('default', 'index'), []), (t('New Posting'), False, url('c_controller', 'posting'), []), (t('View Posting'), False, url('c_controller', 'view_posting'), [])] elif auth.has_membership('TPO'): response.menu = [(t('Home'), False, url('default', 'index'), [])] else: response.menu = [(t('Home'), False, url('default', 'index'), []), (t('Student Register'), False, url('s_controller', 'reg_s'), []), (t('Company Register'), False, url('c_controller', 'reg_c'), [])] development_menu = True if 'auth' in locals(): auth.wikimenu()
# game model list base class for all object collections in game class GameModelList(): def __init__( self, game, game_models=[], collidable=False, block_color=None ): self.game = game self.game_models = game_models self.collidable = collidable self.block_color = block_color for model in self.game_models: model.set_collidable(self.collidable) def add_game_model(self, game_model): self.game_models.append(game_model) game_model.set_collidable(self.collidable) def get_game_models(self): return self.game_models def remove_game_model(self, game_model): self.game_models.remove(game_model) def get_block_color(self): return self.block_color def draw(self): for block in self.game_models: block.draw() def update(self): for model in self.game_models: model.update()
class Gamemodellist: def __init__(self, game, game_models=[], collidable=False, block_color=None): self.game = game self.game_models = game_models self.collidable = collidable self.block_color = block_color for model in self.game_models: model.set_collidable(self.collidable) def add_game_model(self, game_model): self.game_models.append(game_model) game_model.set_collidable(self.collidable) def get_game_models(self): return self.game_models def remove_game_model(self, game_model): self.game_models.remove(game_model) def get_block_color(self): return self.block_color def draw(self): for block in self.game_models: block.draw() def update(self): for model in self.game_models: model.update()
# Author: Ian Burke # Module: Emerging Technologies # Date: September, 2017 # Problem Sheet: https://emerging-technologies.github.io/problems/python-fundamentals.html # create a function to reverse a string def reverse(): word = input("Enter a string: ") #user enters a string and store it in word word = word[::-1] # slices and reverses the string # Reference: https://stackoverflow.com/questions/931092/reverse-a-string-in-python print(word) reverse() # call function to run
def reverse(): word = input('Enter a string: ') word = word[::-1] print(word) reverse()
# GENERATED VERSION FILE # TIME: Tue Oct 26 14:07:11 2021 __version__ = '0.3.0+dc45206' short_version = '0.3.0'
__version__ = '0.3.0+dc45206' short_version = '0.3.0'
class Cuenta: def __init__(self, nombre, numero, saldo): self.nombre = nombre self.numero= numero self.saldo = saldo def depositar(self, a): self.saldo=self.saldo+a return self.saldo def retirar(self, a): self.saldo=self.saldo-a return self.saldo
class Cuenta: def __init__(self, nombre, numero, saldo): self.nombre = nombre self.numero = numero self.saldo = saldo def depositar(self, a): self.saldo = self.saldo + a return self.saldo def retirar(self, a): self.saldo = self.saldo - a return self.saldo
temp=n=int(input("Enter a number: ")) sum1 = 0 while(n > 0): sum1=sum1+n n=n-1 print(f"natural numbers in series {sum1}+{n}") print(f"The sum of first {temp} natural numbers is: {sum1}")
temp = n = int(input('Enter a number: ')) sum1 = 0 while n > 0: sum1 = sum1 + n n = n - 1 print(f'natural numbers in series {sum1}+{n}') print(f'The sum of first {temp} natural numbers is: {sum1}')
def get_max_profit(stock_prices): # initialize the lowest_price to the first stock price lowest_price = stock_prices[0] # initialize the max_profit to the # difference between the first and the second stock price max_profit = stock_prices[1] - stock_prices[0] # loop through every price in stock_prices # starting from the second price for index in range(1, len(stock_prices)): # if price minus lowest_price is greater than max_profit if stock_prices[index] - lowest_price > max_profit: # set max_profit to the difference between price and lowest_price max_profit = stock_prices[index] - lowest_price # if price is lower than lowest_price if stock_prices[index] < lowest_price: # set lowest_price to price lowest_price = stock_prices[index] # return max_profit return max_profit
def get_max_profit(stock_prices): lowest_price = stock_prices[0] max_profit = stock_prices[1] - stock_prices[0] for index in range(1, len(stock_prices)): if stock_prices[index] - lowest_price > max_profit: max_profit = stock_prices[index] - lowest_price if stock_prices[index] < lowest_price: lowest_price = stock_prices[index] return max_profit
class EventMongoRepository: database_address = "localhost" def __init__(self): self.client = "Opens a connection with mongo" def add_event(self, event): pass def remove_event(self, event): pass def update_event(self, event): pass
class Eventmongorepository: database_address = 'localhost' def __init__(self): self.client = 'Opens a connection with mongo' def add_event(self, event): pass def remove_event(self, event): pass def update_event(self, event): pass
class SuperList(list): def __len__(self): return 1000 super_list1 = SuperList() print(len(super_list1)) super_list1.append(5) print(super_list1[0]) print(issubclass(list, object))
class Superlist(list): def __len__(self): return 1000 super_list1 = super_list() print(len(super_list1)) super_list1.append(5) print(super_list1[0]) print(issubclass(list, object))
class Finding: def __init__(self, filename, secret_type, secret_value, line_number=None, link=None): self._filename = filename self._secret_type = secret_type self._secret_value = secret_value self._line_number = line_number self._link = link @property def filename(self): return self._filename @property def secret_type(self): return self._secret_type @property def link(self): return self._link @property def line_number(self): return self._line_number def __eq__(self, other): if isinstance(other, Finding): return self.filename == other.filename and \ self.secret_type == other.secret_type and \ self._secret_value == other._secret_value def __hash__(self): return hash((self._filename, self._secret_type, self._secret_value)) def __str__(self): s = "Secret type {} found in {}".format(self._secret_type, self._filename) if self._line_number is not None: s = s + ":{}".format(self._line_number) if self._link is not None: s = s + " ({})".format(self._link) return s def __repr__(self): return "<{}> ({})".format(self._secret_type, self._filename)
class Finding: def __init__(self, filename, secret_type, secret_value, line_number=None, link=None): self._filename = filename self._secret_type = secret_type self._secret_value = secret_value self._line_number = line_number self._link = link @property def filename(self): return self._filename @property def secret_type(self): return self._secret_type @property def link(self): return self._link @property def line_number(self): return self._line_number def __eq__(self, other): if isinstance(other, Finding): return self.filename == other.filename and self.secret_type == other.secret_type and (self._secret_value == other._secret_value) def __hash__(self): return hash((self._filename, self._secret_type, self._secret_value)) def __str__(self): s = 'Secret type {} found in {}'.format(self._secret_type, self._filename) if self._line_number is not None: s = s + ':{}'.format(self._line_number) if self._link is not None: s = s + ' ({})'.format(self._link) return s def __repr__(self): return '<{}> ({})'.format(self._secret_type, self._filename)
PATH_ROOT = "/sra/sra-instant/reads/ByExp/sra/SRX/SRX{}/{}/" def read_srx_list(file): srxs = set() with open(file, "r") as fh: next(fh) for line in fh: if line.startswith("SRX"): srxs.add(line.rstrip()) return list(srxs) def read_srr_file(srr_file): srr_data = {} with open(srr_file, "r") as fh: for line in fh: line = line.rstrip() srx, srrs = line.split("\t") srrs = srrs.split(", ") assert srx.startswith("SRX") assert srx not in srr_data for srr in srrs: assert srr.startswith("SRR") assert "," not in srr assert " " not in srr srr_data[srx] = srrs return srr_data def fetch_srr_ids(srx, conn): assert srx.startswith("SRX") first_chunk = srx[3:6] path = PATH_ROOT.format(first_chunk, srx) res = conn.nlst(path) return map(lambda x: x.split("/")[-1], res) def build_srr_list(srxs, conn): srr_data = {} for srx in srx_ids: srrs = fetch_srr_ids(srx, conn) srr_data[srx] = srrs return srr_data
path_root = '/sra/sra-instant/reads/ByExp/sra/SRX/SRX{}/{}/' def read_srx_list(file): srxs = set() with open(file, 'r') as fh: next(fh) for line in fh: if line.startswith('SRX'): srxs.add(line.rstrip()) return list(srxs) def read_srr_file(srr_file): srr_data = {} with open(srr_file, 'r') as fh: for line in fh: line = line.rstrip() (srx, srrs) = line.split('\t') srrs = srrs.split(', ') assert srx.startswith('SRX') assert srx not in srr_data for srr in srrs: assert srr.startswith('SRR') assert ',' not in srr assert ' ' not in srr srr_data[srx] = srrs return srr_data def fetch_srr_ids(srx, conn): assert srx.startswith('SRX') first_chunk = srx[3:6] path = PATH_ROOT.format(first_chunk, srx) res = conn.nlst(path) return map(lambda x: x.split('/')[-1], res) def build_srr_list(srxs, conn): srr_data = {} for srx in srx_ids: srrs = fetch_srr_ids(srx, conn) srr_data[srx] = srrs return srr_data
styles = { "alignment": { "color": "black", "linestyle": "-", "linewidth": 1.0, "alpha": 0.2, "label": "raw alignment" }, "despiked": { "color": "blue", "linestyle": "-", "linewidth": 1.4, "alpha": 1.0, "label": "de-spiked alignment" }, "line1": { "color": "black", "linestyle": "-", "linewidth": 1.2, "alpha": 0.3, "label": "line1" }, "line2": { "color": "blue", "linestyle": "-", "linewidth": 1.4, "alpha": 1.0, "label": "line2" }, "line3": { "color": "green", "linestyle": "-", "linewidth": 1.4, "alpha": 1.0, "label": "line3" }, "point1": { "color": "red", "marker": "o", "markersize": 6, "markeredgecolor": "black", "alpha": 1.0, "linestyle": "None", "label": "point1" }, "point2": { "color": "orange", "marker": "o", "markersize": 4, "markeredgecolor": "None", "alpha": 0.5, "linestyle": "None", "label": "point2" }, "point3": { "color": "None", "marker": "o", "markersize": 4, "markeredgecolor": "brown", "alpha": 1.0, "linestyle": "None", "label": "point3" } }
styles = {'alignment': {'color': 'black', 'linestyle': '-', 'linewidth': 1.0, 'alpha': 0.2, 'label': 'raw alignment'}, 'despiked': {'color': 'blue', 'linestyle': '-', 'linewidth': 1.4, 'alpha': 1.0, 'label': 'de-spiked alignment'}, 'line1': {'color': 'black', 'linestyle': '-', 'linewidth': 1.2, 'alpha': 0.3, 'label': 'line1'}, 'line2': {'color': 'blue', 'linestyle': '-', 'linewidth': 1.4, 'alpha': 1.0, 'label': 'line2'}, 'line3': {'color': 'green', 'linestyle': '-', 'linewidth': 1.4, 'alpha': 1.0, 'label': 'line3'}, 'point1': {'color': 'red', 'marker': 'o', 'markersize': 6, 'markeredgecolor': 'black', 'alpha': 1.0, 'linestyle': 'None', 'label': 'point1'}, 'point2': {'color': 'orange', 'marker': 'o', 'markersize': 4, 'markeredgecolor': 'None', 'alpha': 0.5, 'linestyle': 'None', 'label': 'point2'}, 'point3': {'color': 'None', 'marker': 'o', 'markersize': 4, 'markeredgecolor': 'brown', 'alpha': 1.0, 'linestyle': 'None', 'label': 'point3'}}
''' ''' class Solution: def removeDuplicates(self, nums: List[int]) -> int: length = len(nums) if length <= 2: return length left = 0 cur = 0 while cur < length - 1: sums = 1 while cur < length - 1 and nums[cur] == nums[cur + 1]: sums += 1 cur += 1 for i in range(min(sums, 2)): nums[left] = nums[cur] left += 1 cur += 1 if cur == length - 1: nums[left] = nums[cur] left += 1 #nums = nums[:left + 1] return left
""" """ class Solution: def remove_duplicates(self, nums: List[int]) -> int: length = len(nums) if length <= 2: return length left = 0 cur = 0 while cur < length - 1: sums = 1 while cur < length - 1 and nums[cur] == nums[cur + 1]: sums += 1 cur += 1 for i in range(min(sums, 2)): nums[left] = nums[cur] left += 1 cur += 1 if cur == length - 1: nums[left] = nums[cur] left += 1 return left
# Problem description: http://www.geeksforgeeks.org/dynamic-programming-set-7-coin-change/ def make_change(money, coins): if money < 0: return 0 elif money == 0: return 1 elif not coins: return 0 else: return make_change(money - coins[-1], coins) + make_change(money, coins[:-1]) coins = [1, 2, 3] money = 4 make_change(money, coins)
def make_change(money, coins): if money < 0: return 0 elif money == 0: return 1 elif not coins: return 0 else: return make_change(money - coins[-1], coins) + make_change(money, coins[:-1]) coins = [1, 2, 3] money = 4 make_change(money, coins)
_notes_dict_array_hz = { 'C': [8.176, 16.352, 32.703, 65.406, 130.81, 261.63, 523.25, 1046.5, 2093.0, 4186.0, 8372.0], 'C#': [8.662, 17.324, 34.648, 69.296, 138.59, 277.18, 554.37, 1108.7, 2217.5, 4434.9, 8869.8], 'Df': [8.662, 17.324, 34.648, 69.296, 138.59, 277.18, 554.37, 1108.7, 2217.5, 4434.9, 8869.8], 'D': [9.177, 18.354, 36.708, 73.416, 146.83, 293.66, 587.33, 1174.7, 2349.3, 4698.6, 9397.3], 'Ef': [9.723, 19.445, 38.891, 77.782, 155.56, 311.13, 622.25, 1244.5, 2489.0, 4978.0, 9956.1], 'D#': [9.723, 19.445, 38.891, 77.782, 155.56, 311.13, 622.25, 1244.5, 2489.0, 4978.0, 9956.1], 'E': [10.301, 20.602, 41.203, 82.407, 164.81, 329.63, 659.26, 1318.5, 2637.0, 5274.0, 10548.1], 'F': [10.914, 21.827, 43.654, 87.307, 174.61, 349.23, 698.46, 1396.9, 2793.8, 5587.7, 11175.3], 'F#': [11.563, 23.125, 46.249, 92.499, 185.0, 369.99, 739.99, 1480.0, 2960.0, 5919.9, 11839.8], 'Gf': [11.563, 23.125, 46.249, 92.499, 185.0, 369.99, 739.99, 1480.0, 2960.0, 5919.9, 11839.8], 'G': [12.25, 24.5, 48.999, 97.999, 196.0, 392.0, 783.99, 1568.0, 3136.0, 6271.9, 12543.9], 'Af': [12.979, 25.957, 51.913, 103.83, 207.65, 415.3, 830.61, 1661.2, 3322.4, 6644.9], 'G#': [12.979, 25.957, 51.913, 103.83, 207.65, 415.3, 830.61, 1661.2, 3322.4, 6644.9], 'A': [13.75, 27.5, 55.0, 110.0, 220.0, 440.0, 880.0, 1760.0, 3520.0, 7040.0], 'Bf': [14.568, 29.135, 58.27, 116.54, 233.08, 466.16, 932.33, 1864.7, 3729.3, 7458.6], 'A#': [14.568, 29.135, 58.27, 116.54, 233.08, 466.16, 932.33, 1864.7, 3729.3, 7458.6], 'B': [15.434, 30.868, 61.735, 123.47, 246.94, 493.88, 987.77, 1975.5, 3951.1, 7902.1] } midi_note_hz = [8.176, 8.662, 9.177, 9.723, 10.301, 10.914, 11.563, 12.25, 12.979, 13.75, 14.568, 15.434, 16.352, 17.324, 18.354, 19.445, 20.602, 21.827, 23.125, 24.5, 25.957, 27.5, 29.135, 30.868, 32.703, 34.648, 36.708, 38.891, 41.203, 43.654, 46.249, 48.999, 51.913, 55.0, 58.27, 61.735, 65.406, 69.296, 73.416, 77.782, 82.407, 87.307, 92.499, 97.999, 103.83, 110.0, 116.54, 123.47, 130.81, 138.59, 146.83, 155.56, 164.81, 174.61, 185.0, 196.0, 207.65, 220.0, 233.08, 246.94, 261.63, 277.18, 293.66, 311.13, 329.63, 349.23, 369.99, 392.0, 415.3, 440.0, 466.16, 493.88, 523.25, 554.37, 587.33, 622.25, 659.26, 698.46, 739.99, 783.99, 830.61, 880.0, 932.33, 987.77, 1046.5, 1108.7, 1174.7, 1244.5, 1318.5, 1396.9, 1480.0, 1568.0, 1661.2, 1760.0, 1864.7, 1975.5, 2093.0, 2217.5, 2349.3, 2489.0, 2637.0, 2793.8, 2960.0, 3136.0, 3322.4, 3520.0, 3729.3, 3951.1, 4186.0, 4434.9, 4698.6, 4978.0, 5274.0, 5587.7, 5919.9, 6271.9, 6644.9, 7040.0, 7458.6, 7902.1, 8372.0, 8869.8, 9397.3, 9956.1, 10548.1, 11175.3, 11839.8, 12543.9] def note_freq(note, octave): octave_idx = octave + 1 return _notes_dict_array_hz[note][octave_idx]
_notes_dict_array_hz = {'C': [8.176, 16.352, 32.703, 65.406, 130.81, 261.63, 523.25, 1046.5, 2093.0, 4186.0, 8372.0], 'C#': [8.662, 17.324, 34.648, 69.296, 138.59, 277.18, 554.37, 1108.7, 2217.5, 4434.9, 8869.8], 'Df': [8.662, 17.324, 34.648, 69.296, 138.59, 277.18, 554.37, 1108.7, 2217.5, 4434.9, 8869.8], 'D': [9.177, 18.354, 36.708, 73.416, 146.83, 293.66, 587.33, 1174.7, 2349.3, 4698.6, 9397.3], 'Ef': [9.723, 19.445, 38.891, 77.782, 155.56, 311.13, 622.25, 1244.5, 2489.0, 4978.0, 9956.1], 'D#': [9.723, 19.445, 38.891, 77.782, 155.56, 311.13, 622.25, 1244.5, 2489.0, 4978.0, 9956.1], 'E': [10.301, 20.602, 41.203, 82.407, 164.81, 329.63, 659.26, 1318.5, 2637.0, 5274.0, 10548.1], 'F': [10.914, 21.827, 43.654, 87.307, 174.61, 349.23, 698.46, 1396.9, 2793.8, 5587.7, 11175.3], 'F#': [11.563, 23.125, 46.249, 92.499, 185.0, 369.99, 739.99, 1480.0, 2960.0, 5919.9, 11839.8], 'Gf': [11.563, 23.125, 46.249, 92.499, 185.0, 369.99, 739.99, 1480.0, 2960.0, 5919.9, 11839.8], 'G': [12.25, 24.5, 48.999, 97.999, 196.0, 392.0, 783.99, 1568.0, 3136.0, 6271.9, 12543.9], 'Af': [12.979, 25.957, 51.913, 103.83, 207.65, 415.3, 830.61, 1661.2, 3322.4, 6644.9], 'G#': [12.979, 25.957, 51.913, 103.83, 207.65, 415.3, 830.61, 1661.2, 3322.4, 6644.9], 'A': [13.75, 27.5, 55.0, 110.0, 220.0, 440.0, 880.0, 1760.0, 3520.0, 7040.0], 'Bf': [14.568, 29.135, 58.27, 116.54, 233.08, 466.16, 932.33, 1864.7, 3729.3, 7458.6], 'A#': [14.568, 29.135, 58.27, 116.54, 233.08, 466.16, 932.33, 1864.7, 3729.3, 7458.6], 'B': [15.434, 30.868, 61.735, 123.47, 246.94, 493.88, 987.77, 1975.5, 3951.1, 7902.1]} midi_note_hz = [8.176, 8.662, 9.177, 9.723, 10.301, 10.914, 11.563, 12.25, 12.979, 13.75, 14.568, 15.434, 16.352, 17.324, 18.354, 19.445, 20.602, 21.827, 23.125, 24.5, 25.957, 27.5, 29.135, 30.868, 32.703, 34.648, 36.708, 38.891, 41.203, 43.654, 46.249, 48.999, 51.913, 55.0, 58.27, 61.735, 65.406, 69.296, 73.416, 77.782, 82.407, 87.307, 92.499, 97.999, 103.83, 110.0, 116.54, 123.47, 130.81, 138.59, 146.83, 155.56, 164.81, 174.61, 185.0, 196.0, 207.65, 220.0, 233.08, 246.94, 261.63, 277.18, 293.66, 311.13, 329.63, 349.23, 369.99, 392.0, 415.3, 440.0, 466.16, 493.88, 523.25, 554.37, 587.33, 622.25, 659.26, 698.46, 739.99, 783.99, 830.61, 880.0, 932.33, 987.77, 1046.5, 1108.7, 1174.7, 1244.5, 1318.5, 1396.9, 1480.0, 1568.0, 1661.2, 1760.0, 1864.7, 1975.5, 2093.0, 2217.5, 2349.3, 2489.0, 2637.0, 2793.8, 2960.0, 3136.0, 3322.4, 3520.0, 3729.3, 3951.1, 4186.0, 4434.9, 4698.6, 4978.0, 5274.0, 5587.7, 5919.9, 6271.9, 6644.9, 7040.0, 7458.6, 7902.1, 8372.0, 8869.8, 9397.3, 9956.1, 10548.1, 11175.3, 11839.8, 12543.9] def note_freq(note, octave): octave_idx = octave + 1 return _notes_dict_array_hz[note][octave_idx]
def funct(l1, l2): s = len(set(l1+l2)) return s for t in range(int(input())): n = int(input()) l = input().split() a = {} for i in l: p = i[1:] if p in a: a[p].append(i[0]) else: a[p] = [i[0]] b = list(a.keys()) s = 0 for i in range(len(a)): for j in range(i+1, len(a)): ans = funct(a[b[i]], a[b[j]]) s += (ans-len(a[b[i]]))*(ans-len(a[b[j]])) print(2*s)
def funct(l1, l2): s = len(set(l1 + l2)) return s for t in range(int(input())): n = int(input()) l = input().split() a = {} for i in l: p = i[1:] if p in a: a[p].append(i[0]) else: a[p] = [i[0]] b = list(a.keys()) s = 0 for i in range(len(a)): for j in range(i + 1, len(a)): ans = funct(a[b[i]], a[b[j]]) s += (ans - len(a[b[i]])) * (ans - len(a[b[j]])) print(2 * s)
class ConfigSVM: # matrix_size = 1727 # matrix_size = 1219 # matrix_size = 1027 matrix_size = 798 # matrix_size = 3
class Configsvm: matrix_size = 798
print('\033[1;93m-=-\033[m' * 15) print(f'\033[1;31m{"LARGEST AND SMALLEST ON THE LIST":^45}\033[m', ) print('\033[1;93m-=-\033[m' * 15) numbers = list() largest = 0 big_position = list() small_position = list() numbers.append(int(input(f'Type a number for the position {0}: '))) smallest = numbers[0] for i in range(1, 5): numbers.append(int(input(f'Type a number for the position {i}: '))) if numbers[i] > largest: largest = numbers[i] if numbers[i] < smallest: smallest = numbers[i] print('-=-' * 15) print('You entered the valors: ', end='') for n in numbers: print(n, end=' ') for i in range(0, 5): if numbers[i] == largest: big_position.append(i) if numbers[i] == smallest: small_position.append(i) print(f'\nThe largest number entered was: {largest} in the positions ', end='') for n in big_position: print(f'{n}... ', end='') print(f'\nThe smallest number entered was: {smallest} in the positions ', end='') for n in small_position: print(f'{n}... ', end='')
print('\x1b[1;93m-=-\x1b[m' * 15) print(f"\x1b[1;31m{'LARGEST AND SMALLEST ON THE LIST':^45}\x1b[m") print('\x1b[1;93m-=-\x1b[m' * 15) numbers = list() largest = 0 big_position = list() small_position = list() numbers.append(int(input(f'Type a number for the position {0}: '))) smallest = numbers[0] for i in range(1, 5): numbers.append(int(input(f'Type a number for the position {i}: '))) if numbers[i] > largest: largest = numbers[i] if numbers[i] < smallest: smallest = numbers[i] print('-=-' * 15) print('You entered the valors: ', end='') for n in numbers: print(n, end=' ') for i in range(0, 5): if numbers[i] == largest: big_position.append(i) if numbers[i] == smallest: small_position.append(i) print(f'\nThe largest number entered was: {largest} in the positions ', end='') for n in big_position: print(f'{n}... ', end='') print(f'\nThe smallest number entered was: {smallest} in the positions ', end='') for n in small_position: print(f'{n}... ', end='')
# Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. { 'includes': [ '../build/common.gypi', ], 'conditions': [ ['OS=="ios"', { 'targets': [ { 'target_name': 'rtc_api_objc', 'type': 'static_library', 'dependencies': [ '<(webrtc_root)/base/base.gyp:rtc_base_objc', ], 'sources': [ 'objc/RTCIceServer+Private.h', 'objc/RTCIceServer.h', 'objc/RTCIceServer.mm', ], 'xcode_settings': { 'CLANG_ENABLE_OBJC_ARC': 'YES', 'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES', 'GCC_PREFIX_HEADER': 'objc/WebRTC-Prefix.pch', }, } ], }], # OS=="ios" ], }
{'includes': ['../build/common.gypi'], 'conditions': [['OS=="ios"', {'targets': [{'target_name': 'rtc_api_objc', 'type': 'static_library', 'dependencies': ['<(webrtc_root)/base/base.gyp:rtc_base_objc'], 'sources': ['objc/RTCIceServer+Private.h', 'objc/RTCIceServer.h', 'objc/RTCIceServer.mm'], 'xcode_settings': {'CLANG_ENABLE_OBJC_ARC': 'YES', 'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES', 'GCC_PREFIX_HEADER': 'objc/WebRTC-Prefix.pch'}}]}]]}
getObject = { 'primaryRouter': { 'datacenter': {'id': 1234, 'longName': 'TestDC'}, 'fullyQualifiedDomainName': 'fcr01.TestDC' }, 'id': 1234, 'vlanNumber': 4444, 'firewallInterfaces': None }
get_object = {'primaryRouter': {'datacenter': {'id': 1234, 'longName': 'TestDC'}, 'fullyQualifiedDomainName': 'fcr01.TestDC'}, 'id': 1234, 'vlanNumber': 4444, 'firewallInterfaces': None}
class Car: def wheels(self): print('Car.wheels') return 4 class Bike(Car): def wheels(self): return 2 class Truck(Car): def wheels(self): print('Truck.wheels: start') super().wheels() print('Truck.wheels: end') return 6 car = Bike() print(car.wheels()) # 2 truck = Truck() print(truck.wheels()) # 6
class Car: def wheels(self): print('Car.wheels') return 4 class Bike(Car): def wheels(self): return 2 class Truck(Car): def wheels(self): print('Truck.wheels: start') super().wheels() print('Truck.wheels: end') return 6 car = bike() print(car.wheels()) truck = truck() print(truck.wheels())
class NodeEndpoint: protocol = '' host = '' port = '' @staticmethod def from_parameters(protocol, host, port): endpoint = NodeEndpoint() endpoint.protocol = protocol endpoint.host = host endpoint.port = port return endpoint @staticmethod def from_json(endpoint_json): return NodeEndpoint.from_parameters( endpoint_json['protocol'], endpoint_json['host'], endpoint_json['port']) def url(self): return '{0}://{1}:{2}/'.format(self.protocol, self.host, self.port)
class Nodeendpoint: protocol = '' host = '' port = '' @staticmethod def from_parameters(protocol, host, port): endpoint = node_endpoint() endpoint.protocol = protocol endpoint.host = host endpoint.port = port return endpoint @staticmethod def from_json(endpoint_json): return NodeEndpoint.from_parameters(endpoint_json['protocol'], endpoint_json['host'], endpoint_json['port']) def url(self): return '{0}://{1}:{2}/'.format(self.protocol, self.host, self.port)
class SchemaConstructionException(Exception): def __init__(self, claz): self.cls = claz class SchemaParseException(Exception): def __init__(self, errors): self.errors = errors class ParseError(object): def __init__(self, path, inner): self.path = path self.inner = inner class CheckFailed(object): def __init__(self, check_fn, failed_value): self.check_fn = check_fn self.failed_value = failed_value
class Schemaconstructionexception(Exception): def __init__(self, claz): self.cls = claz class Schemaparseexception(Exception): def __init__(self, errors): self.errors = errors class Parseerror(object): def __init__(self, path, inner): self.path = path self.inner = inner class Checkfailed(object): def __init__(self, check_fn, failed_value): self.check_fn = check_fn self.failed_value = failed_value
class Solution: def maxPerformance(self, n: int, speed: List[int], efficiency: List[int], k: int) -> int: modulo = 10 ** 9 + 7 # build tuples of (efficiency, speed) candidates = zip(efficiency, speed) # sort the candidates by their efficiencies candidates = sorted(candidates, key=lambda t:t[0], reverse=True) speed_heap = [] speed_sum, perf = 0, 0 for curr_efficiency, curr_speed in candidates: # maintain a heap for the fastest (k-1) speeds if len(speed_heap) > k-1: speed_sum -= heapq.heappop(speed_heap) heapq.heappush(speed_heap, curr_speed) # calculate the maximum performance with the current member as the least efficient one in the team speed_sum += curr_speed perf = max(perf, speed_sum * curr_efficiency) return perf % modulo
class Solution: def max_performance(self, n: int, speed: List[int], efficiency: List[int], k: int) -> int: modulo = 10 ** 9 + 7 candidates = zip(efficiency, speed) candidates = sorted(candidates, key=lambda t: t[0], reverse=True) speed_heap = [] (speed_sum, perf) = (0, 0) for (curr_efficiency, curr_speed) in candidates: if len(speed_heap) > k - 1: speed_sum -= heapq.heappop(speed_heap) heapq.heappush(speed_heap, curr_speed) speed_sum += curr_speed perf = max(perf, speed_sum * curr_efficiency) return perf % modulo
# Minimum Size Subarray Sum class Solution: def minSubArrayLen(self, target, nums): length = len(nums) Invalid = length + 1 left, right = 0, 0 added = nums[left] if added >= target: return 1 ans = Invalid while True: if left + 1 <= right and added - nums[left] >= target: added -= nums[left] left += 1 ans = min(ans, right - left + 1) continue if right < length - 1: added += nums[right + 1] right += 1 if added >= target: ans = min(ans, right - left + 1) continue # cannot reduct left side, cannot expand to right. # break here break return 0 if ans == Invalid else ans if __name__ == "__main__": sol = Solution() target = 7 nums = [2,3,1,2,4,3] target = 4 nums = [1,4,4] target = 11 nums = [1,1,1,1,1,1,1,1] target = 11 nums = [12] target = 15 nums = [1,2,3,4,5] print(sol.minSubArrayLen(target, nums))
class Solution: def min_sub_array_len(self, target, nums): length = len(nums) invalid = length + 1 (left, right) = (0, 0) added = nums[left] if added >= target: return 1 ans = Invalid while True: if left + 1 <= right and added - nums[left] >= target: added -= nums[left] left += 1 ans = min(ans, right - left + 1) continue if right < length - 1: added += nums[right + 1] right += 1 if added >= target: ans = min(ans, right - left + 1) continue break return 0 if ans == Invalid else ans if __name__ == '__main__': sol = solution() target = 7 nums = [2, 3, 1, 2, 4, 3] target = 4 nums = [1, 4, 4] target = 11 nums = [1, 1, 1, 1, 1, 1, 1, 1] target = 11 nums = [12] target = 15 nums = [1, 2, 3, 4, 5] print(sol.minSubArrayLen(target, nums))
# http://codingbat.com/prob/p165321 def near_ten(num): return (num % 10 <= 2) or (num % 10 >= 8)
def near_ten(num): return num % 10 <= 2 or num % 10 >= 8
class WorkerNode(object): def __init__(self, ip, k8s_name, k8s_is_ready): self.ip = ip self.k8s_name = k8s_name self.k8s_is_ready = k8s_is_ready self.k8s_pod_num = 0 self.vc = None self.to_turn_on = False self.to_turn_off = False class Pod(object): def __init__(self, vc, host_ip, pending): self.vc = vc self.host_ip = host_ip self.pending = pending class VirtualCluster(object): def __init__(self, name, is_full, is_guaranteed): self.name = name self.is_full = is_full self.is_guaranteed = is_guaranteed
class Workernode(object): def __init__(self, ip, k8s_name, k8s_is_ready): self.ip = ip self.k8s_name = k8s_name self.k8s_is_ready = k8s_is_ready self.k8s_pod_num = 0 self.vc = None self.to_turn_on = False self.to_turn_off = False class Pod(object): def __init__(self, vc, host_ip, pending): self.vc = vc self.host_ip = host_ip self.pending = pending class Virtualcluster(object): def __init__(self, name, is_full, is_guaranteed): self.name = name self.is_full = is_full self.is_guaranteed = is_guaranteed
class Solution: def countAndSay(self, n): numb = 1 w = 1 while n > 1: w = Solution.CountSay(numb) numb = w n -= 1 return str(w) def CountSay(no): tnumb = str(no) x = tnumb[0] count = 1 strr = "" for i in range(1, len(tnumb) + 1): if i == len(tnumb): strr += str(count) + str(x) break if tnumb[i] == x: count += 1 else: strr += str(count) + str(x) x = tnumb[i] count = 1 return int(strr)
class Solution: def count_and_say(self, n): numb = 1 w = 1 while n > 1: w = Solution.CountSay(numb) numb = w n -= 1 return str(w) def count_say(no): tnumb = str(no) x = tnumb[0] count = 1 strr = '' for i in range(1, len(tnumb) + 1): if i == len(tnumb): strr += str(count) + str(x) break if tnumb[i] == x: count += 1 else: strr += str(count) + str(x) x = tnumb[i] count = 1 return int(strr)
# domoticz configuration DOMOTICZ_SERVER_IP = "xxx.xxx.x.xxx" DOMOTICZ_SERVER_PORT = "xxxx" DOMOTICZ_USERNAME = "" DOMOTICZ_PASSWORD = "" # sensor dictionary to add own sensors # if you don't want to use the raw voltage option, just write -1 in the VOLTAGE_IDX value field sensors = { 1: {"MAC": "xx:xx:xx:xx:xx:xx", "TH_IDX": 1, "VOLTAGE_IDX": -1, "UPDATED": False}, 2: {"MAC": "xx:xx:xx:xx:xx:xx", "TH_IDX": 2, "VOLTAGE_IDX": -1, "UPDATED": False}, 3: {"MAC": "xx:xx:xx:xx:xx:xx", "TH_IDX": 3, "VOLTAGE_IDX": -1, "UPDATED": False}} # other configuration TEMPERATURE_PREC = 2 # Logfile configuration LOG_FILE_NAME = "loginfo.log" LOG_FILE_SIZE = 16384 # file size in bytes
domoticz_server_ip = 'xxx.xxx.x.xxx' domoticz_server_port = 'xxxx' domoticz_username = '' domoticz_password = '' sensors = {1: {'MAC': 'xx:xx:xx:xx:xx:xx', 'TH_IDX': 1, 'VOLTAGE_IDX': -1, 'UPDATED': False}, 2: {'MAC': 'xx:xx:xx:xx:xx:xx', 'TH_IDX': 2, 'VOLTAGE_IDX': -1, 'UPDATED': False}, 3: {'MAC': 'xx:xx:xx:xx:xx:xx', 'TH_IDX': 3, 'VOLTAGE_IDX': -1, 'UPDATED': False}} temperature_prec = 2 log_file_name = 'loginfo.log' log_file_size = 16384
del_items(0x8009E2A0) SetType(0x8009E2A0, "char StrDate[12]") del_items(0x8009E2AC) SetType(0x8009E2AC, "char StrTime[9]") del_items(0x8009E2B8) SetType(0x8009E2B8, "char *Words[117]") del_items(0x8009E48C) SetType(0x8009E48C, "struct MONTH_DAYS MonDays[12]")
del_items(2148131488) set_type(2148131488, 'char StrDate[12]') del_items(2148131500) set_type(2148131500, 'char StrTime[9]') del_items(2148131512) set_type(2148131512, 'char *Words[117]') del_items(2148131980) set_type(2148131980, 'struct MONTH_DAYS MonDays[12]')
class FunctionLink: def __init__(self, linked_function): self.__linked_function = linked_function @property def linked_function(self): return self.__linked_function
class Functionlink: def __init__(self, linked_function): self.__linked_function = linked_function @property def linked_function(self): return self.__linked_function
workers = 2 timeout = 120 reload = True limit_request_field_size = 0 limit_request_line = 0
workers = 2 timeout = 120 reload = True limit_request_field_size = 0 limit_request_line = 0
GITHUB_TOKENS = ['GH_TOKEN'] GITHUB_URL_FILE = 'rawGitUrls.txt' GITHUB_API_URL = 'https://api.github.com/search/code?q=' GITHUB_API_COMMIT_URL = 'https://api.github.com/repos/' GITHUB_SEARCH_PARAMS = '&sort=indexed&o=desc' GITHUB_BASE_URL = 'https://github.com' GITHUB_MAX_RETRY = 10 XDISCORD_WEBHOOKURL = 'https://discordapp.com/api/webhooks/7XXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXX' XSLACK_WEBHOOKURL = 'https://hooks.slack.com/services/TXXXXXXXX/BXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXX' TELEGRAM_CONFIG = { "token": "1437557225:AAHpOqwOZ4Xlap", "chat_id": "Code" }
github_tokens = ['GH_TOKEN'] github_url_file = 'rawGitUrls.txt' github_api_url = 'https://api.github.com/search/code?q=' github_api_commit_url = 'https://api.github.com/repos/' github_search_params = '&sort=indexed&o=desc' github_base_url = 'https://github.com' github_max_retry = 10 xdiscord_webhookurl = 'https://discordapp.com/api/webhooks/7XXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXX' xslack_webhookurl = 'https://hooks.slack.com/services/TXXXXXXXX/BXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXX' telegram_config = {'token': '1437557225:AAHpOqwOZ4Xlap', 'chat_id': 'Code'}
class QuickSort(object): "In Place Quick Sort" def __init__(self, arr): self.arr = arr def sort(self, left_i, right_i): if right_i - left_i < 1: return pivot_i = self.partition(left_i, right_i) self.sort(left_i, pivot_i - 1) self.sort(pivot_i + 1, right_i) def partition(self, left_i, right_i): pivot_i = right_i lesser_i = left_i for i in range(left_i, right_i): if arr[i] < arr[pivot_i]: self.swap(i, lesser_i) lesser_i += 1 self.swap(pivot_i, lesser_i) self.print_arr() return lesser_i def swap(self, index_1, index_2): arr[index_1], arr[index_2] = arr[index_2], arr[index_1] def print_arr(self): print(" ".join(list(map(str, arr)))) n = int(input().strip()) arr = list(map(int, input().strip().split(" "))) quicksort = QuickSort(arr) quicksort.sort(0, len(arr) - 1)
class Quicksort(object): """In Place Quick Sort""" def __init__(self, arr): self.arr = arr def sort(self, left_i, right_i): if right_i - left_i < 1: return pivot_i = self.partition(left_i, right_i) self.sort(left_i, pivot_i - 1) self.sort(pivot_i + 1, right_i) def partition(self, left_i, right_i): pivot_i = right_i lesser_i = left_i for i in range(left_i, right_i): if arr[i] < arr[pivot_i]: self.swap(i, lesser_i) lesser_i += 1 self.swap(pivot_i, lesser_i) self.print_arr() return lesser_i def swap(self, index_1, index_2): (arr[index_1], arr[index_2]) = (arr[index_2], arr[index_1]) def print_arr(self): print(' '.join(list(map(str, arr)))) n = int(input().strip()) arr = list(map(int, input().strip().split(' '))) quicksort = quick_sort(arr) quicksort.sort(0, len(arr) - 1)
a = [] for i in range(100): a.append(i) if (n := len(a)) > 10: print(f"List is too long ({n} elements, expected <= 10)")
a = [] for i in range(100): a.append(i) if (n := len(a)) > 10: print(f'List is too long ({n} elements, expected <= 10)')